codexui-android 0.1.106 → 0.1.108
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/{DirectoryHub-DSkzrx9M.js → DirectoryHub-BeJqaP4D.js} +1 -1
- package/dist/assets/{ReviewPane-CpFUdAhb.js → ReviewPane-IP5BRZ-3.js} +1 -1
- package/dist/assets/{ThreadConversation-TbvxTGZL.js → ThreadConversation-DKfW7vC7.js} +1 -1
- package/dist/assets/{ThreadTerminalPanel-DVFhduDv.js → ThreadTerminalPanel-CrJKkAvB.js} +1 -1
- package/dist/assets/index-DfEYiJAK.js +63 -0
- package/dist/assets/{index-D3-QOh5C.css → index-KQ_3KeZN.css} +1 -1
- package/dist/index.html +2 -2
- package/dist-cli/index.js +69 -32
- package/dist-cli/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/index-Dgv-diAL.js +0 -63
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-TbvxTGZL.js","assets/ThreadConversation-BwA4BCDu.css","assets/ThreadTerminalPanel-DVFhduDv.js","assets/ThreadTerminalPanel-nYqGBGVO.css","assets/ReviewPane-CpFUdAhb.js","assets/ReviewPane-BAfo9D_N.css","assets/DirectoryHub-DSkzrx9M.js","assets/DirectoryHub-BjsbwciN.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();/**
|
|
3
|
-
* @vue/shared v3.5.34
|
|
4
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
-
* @license MIT
|
|
6
|
-
**/function Tc(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Ut={},xs=[],Oo=()=>{},Rh=()=>!1,Al=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),El=e=>e.startsWith("onUpdate:"),En=Object.assign,kc=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},eg=Object.prototype.hasOwnProperty,$t=(e,t)=>eg.call(e,t),nt=Array.isArray,As=e=>Ii(e)==="[object Map]",Il=e=>Ii(e)==="[object Set]",kd=e=>Ii(e)==="[object Date]",ct=e=>typeof e=="function",Yt=e=>typeof e=="string",mo=e=>typeof e=="symbol",Nt=e=>e!==null&&typeof e=="object",Ph=e=>(Nt(e)||ct(e))&&ct(e.then)&&ct(e.catch),Mh=Object.prototype.toString,Ii=e=>Mh.call(e),tg=e=>Ii(e).slice(8,-1),$h=e=>Ii(e)==="[object Object]",Cc=e=>Yt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,hi=Tc(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Rl=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ng=/-\w/g,hr=Rl(e=>e.replace(ng,t=>t.slice(1).toUpperCase())),rg=/\B([A-Z])/g,Ra=Rl(e=>e.replace(rg,"-$1").toLowerCase()),Pl=Rl(e=>e.charAt(0).toUpperCase()+e.slice(1)),hu=Rl(e=>e?`on${Pl(e)}`:""),co=(e,t)=>!Object.is(e,t),dl=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Nh=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Sc=e=>{const t=parseFloat(e);return isNaN(t)?e:t},og=e=>{const t=Yt(e)?Number(e):NaN;return isNaN(t)?e:t};let Cd;const Ml=()=>Cd||(Cd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function oa(e){if(nt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],a=Yt(r)?lg(r):oa(r);if(a)for(const o in a)t[o]=a[o]}return t}else if(Yt(e)||Nt(e))return e}const ag=/;(?![^(]*\))/g,sg=/:([^]+)/,ig=/\/\*[^]*?\*\//g;function lg(e){const t={};return e.replace(ig,"").split(ag).forEach(n=>{if(n){const r=n.split(sg);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function et(e){let t="";if(Yt(e))t=e;else if(nt(e))for(let n=0;n<e.length;n++){const r=et(e[n]);r&&(t+=r+" ")}else if(Nt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const ug="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",cg=Tc(ug);function Lh(e){return!!e||e===""}function dg(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Ri(e[r],t[r]);return n}function Ri(e,t){if(e===t)return!0;let n=kd(e),r=kd(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=mo(e),r=mo(t),n||r)return e===t;if(n=nt(e),r=nt(t),n||r)return n&&r?dg(e,t):!1;if(n=Nt(e),r=Nt(t),n||r){if(!n||!r)return!1;const a=Object.keys(e).length,o=Object.keys(t).length;if(a!==o)return!1;for(const s in e){const l=e.hasOwnProperty(s),c=t.hasOwnProperty(s);if(l&&!c||!l&&c||!Ri(e[s],t[s]))return!1}}return String(e)===String(t)}function Oh(e,t){return e.findIndex(n=>Ri(n,t))}const jh=e=>!!(e&&e.__v_isRef===!0),$=e=>Yt(e)?e:e==null?"":nt(e)||Nt(e)&&(e.toString===Mh||!ct(e.toString))?jh(e)?$(e.value):JSON.stringify(e,Dh,2):String(e),Dh=(e,t)=>jh(t)?Dh(e,t.value):As(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,a],o)=>(n[pu(r,o)+" =>"]=a,n),{})}:Il(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>pu(n))}:mo(t)?pu(t):Nt(t)&&!nt(t)&&!$h(t)?String(t):t,pu=(e,t="")=>{var n;return mo(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
|
|
7
|
-
* @vue/reactivity v3.5.34
|
|
8
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
|
-
* @license MIT
|
|
10
|
-
**/let Un;class fg{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&&Un&&(Un.active?(this.parent=Un,this.index=(Un.scopes||(Un.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].pause();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=Un;try{return Un=this,t()}finally{Un=n}}}on(){++this._on===1&&(this.prevScope=Un,Un=this)}off(){if(this._on>0&&--this._on===0){if(Un===this)Un=this.prevScope;else{let t=Un;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const a=this.parent.scopes.pop();a&&a!==this&&(this.parent.scopes[this.index]=a,a.index=this.index)}this.parent=void 0}}}function hg(){return Un}let Ht;const mu=new WeakSet;class Fh{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,Un&&(Un.active?Un.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,mu.has(this)&&(mu.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Bh(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Sd(this),qh(this);const t=Ht,n=ho;Ht=this,ho=!0;try{return this.fn()}finally{Hh(this),Ht=t,ho=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Ec(t);this.deps=this.depsTail=void 0,Sd(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?mu.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){zu(this)&&this.run()}get dirty(){return zu(this)}}let Uh=0,pi,mi;function Bh(e,t=!1){if(e.flags|=8,t){e.next=mi,mi=e;return}e.next=pi,pi=e}function xc(){Uh++}function Ac(){if(--Uh>0)return;if(mi){let t=mi;for(mi=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;pi;){let t=pi;for(pi=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 qh(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Hh(e){let t,n=e.depsTail,r=n;for(;r;){const a=r.prevDep;r.version===-1?(r===n&&(n=a),Ec(r),pg(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=a}e.deps=t,e.depsTail=n}function zu(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Wh(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Wh(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ti)||(e.globalVersion=Ti,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!zu(e))))return;e.flags|=2;const t=e.dep,n=Ht,r=ho;Ht=e,ho=!0;try{qh(e);const a=e.fn(e._value);(t.version===0||co(a,e._value))&&(e.flags|=128,e._value=a,t.version++)}catch(a){throw t.version++,a}finally{Ht=n,ho=r,Hh(e),e.flags&=-3}}function Ec(e,t=!1){const{dep:n,prevSub:r,nextSub:a}=e;if(r&&(r.nextSub=a,e.prevSub=void 0),a&&(a.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let o=n.computed.deps;o;o=o.nextDep)Ec(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function pg(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let ho=!0;const zh=[];function aa(){zh.push(ho),ho=!1}function sa(){const e=zh.pop();ho=e===void 0?!0:e}function Sd(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ht;Ht=void 0;try{t()}finally{Ht=n}}}let Ti=0;class mg{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 Ic{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(!Ht||!ho||Ht===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ht)n=this.activeLink=new mg(Ht,this),Ht.deps?(n.prevDep=Ht.depsTail,Ht.depsTail.nextDep=n,Ht.depsTail=n):Ht.deps=Ht.depsTail=n,Vh(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=Ht.depsTail,n.nextDep=void 0,Ht.depsTail.nextDep=n,Ht.depsTail=n,Ht.deps===n&&(Ht.deps=r)}return n}trigger(t){this.version++,Ti++,this.notify(t)}notify(t){xc();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Ac()}}}function Vh(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)Vh(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Vu=new WeakMap,Za=Symbol(""),Gu=Symbol(""),ki=Symbol("");function Qn(e,t,n){if(ho&&Ht){let r=Vu.get(e);r||Vu.set(e,r=new Map);let a=r.get(n);a||(r.set(n,a=new Ic),a.map=r,a.key=n),a.track()}}function na(e,t,n,r,a,o){const s=Vu.get(e);if(!s){Ti++;return}const l=c=>{c&&c.trigger()};if(xc(),t==="clear")s.forEach(l);else{const c=nt(e),h=c&&Cc(n);if(c&&n==="length"){const f=Number(r);s.forEach((g,_)=>{(_==="length"||_===ki||!mo(_)&&_>=f)&&l(g)})}else switch((n!==void 0||s.has(void 0))&&l(s.get(n)),h&&l(s.get(ki)),t){case"add":c?h&&l(s.get("length")):(l(s.get(Za)),As(e)&&l(s.get(Gu)));break;case"delete":c||(l(s.get(Za)),As(e)&&l(s.get(Gu)));break;case"set":As(e)&&l(s.get(Za));break}}Ac()}function ps(e){const t=Rt(e);return t===e?t:(Qn(t,"iterate",ki),Yr(e)?t:t.map(vo))}function $l(e){return Qn(e=Rt(e),"iterate",ki),e}function $o(e,t){return ia(e)?Ns(es(e)?vo(t):t):vo(t)}const vg={__proto__:null,[Symbol.iterator](){return vu(this,Symbol.iterator,e=>$o(this,e))},concat(...e){return ps(this).concat(...e.map(t=>nt(t)?ps(t):t))},entries(){return vu(this,"entries",e=>(e[1]=$o(this,e[1]),e))},every(e,t){return Jo(this,"every",e,t,void 0,arguments)},filter(e,t){return Jo(this,"filter",e,t,n=>n.map(r=>$o(this,r)),arguments)},find(e,t){return Jo(this,"find",e,t,n=>$o(this,n),arguments)},findIndex(e,t){return Jo(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Jo(this,"findLast",e,t,n=>$o(this,n),arguments)},findLastIndex(e,t){return Jo(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Jo(this,"forEach",e,t,void 0,arguments)},includes(...e){return gu(this,"includes",e)},indexOf(...e){return gu(this,"indexOf",e)},join(e){return ps(this).join(e)},lastIndexOf(...e){return gu(this,"lastIndexOf",e)},map(e,t){return Jo(this,"map",e,t,void 0,arguments)},pop(){return ri(this,"pop")},push(...e){return ri(this,"push",e)},reduce(e,...t){return xd(this,"reduce",e,t)},reduceRight(e,...t){return xd(this,"reduceRight",e,t)},shift(){return ri(this,"shift")},some(e,t){return Jo(this,"some",e,t,void 0,arguments)},splice(...e){return ri(this,"splice",e)},toReversed(){return ps(this).toReversed()},toSorted(e){return ps(this).toSorted(e)},toSpliced(...e){return ps(this).toSpliced(...e)},unshift(...e){return ri(this,"unshift",e)},values(){return vu(this,"values",e=>$o(this,e))}};function vu(e,t,n){const r=$l(e),a=r[t]();return r!==e&&!Yr(e)&&(a._next=a.next,a.next=()=>{const o=a._next();return o.done||(o.value=n(o.value)),o}),a}const gg=Array.prototype;function Jo(e,t,n,r,a,o){const s=$l(e),l=s!==e&&!Yr(e),c=s[t];if(c!==gg[t]){const g=c.apply(e,o);return l?vo(g):g}let h=n;s!==e&&(l?h=function(g,_){return n.call(this,$o(e,g),_,e)}:n.length>2&&(h=function(g,_){return n.call(this,g,_,e)}));const f=c.call(s,h,r);return l&&a?a(f):f}function xd(e,t,n,r){const a=$l(e),o=a!==e&&!Yr(e);let s=n,l=!1;a!==e&&(o?(l=r.length===0,s=function(h,f,g){return l&&(l=!1,h=$o(e,h)),n.call(this,h,$o(e,f),g,e)}):n.length>3&&(s=function(h,f,g){return n.call(this,h,f,g,e)}));const c=a[t](s,...r);return l?$o(e,c):c}function gu(e,t,n){const r=Rt(e);Qn(r,"iterate",ki);const a=r[t](...n);return(a===-1||a===!1)&&Mc(n[0])?(n[0]=Rt(n[0]),r[t](...n)):a}function ri(e,t,n=[]){aa(),xc();const r=Rt(e)[t].apply(e,n);return Ac(),sa(),r}const yg=Tc("__proto__,__v_isRef,__isVue"),Gh=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(mo));function wg(e){mo(e)||(e=String(e));const t=Rt(this);return Qn(t,"has",e),t.hasOwnProperty(e)}class Kh{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const a=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!a;if(n==="__v_isReadonly")return a;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(a?o?Ig:Xh:o?Jh:Qh).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const s=nt(t);if(!a){let c;if(s&&(c=vg[n]))return c;if(n==="hasOwnProperty")return wg}const l=Reflect.get(t,n,Xn(t)?t:r);if((mo(n)?Gh.has(n):yg(n))||(a||Qn(t,"get",n),o))return l;if(Xn(l)){const c=s&&Cc(n)?l:l.value;return a&&Nt(c)?Yu(c):c}return Nt(l)?a?Yu(l):Nl(l):l}}class Yh extends Kh{constructor(t=!1){super(!1,t)}set(t,n,r,a){let o=t[n];const s=nt(t)&&Cc(n);if(!this._isShallow){const h=ia(o);if(!Yr(r)&&!ia(r)&&(o=Rt(o),r=Rt(r)),!s&&Xn(o)&&!Xn(r))return h||(o.value=r),!0}const l=s?Number(n)<t.length:$t(t,n),c=Reflect.set(t,n,r,Xn(t)?t:a);return t===Rt(a)&&(l?co(r,o)&&na(t,"set",n,r):na(t,"add",n,r)),c}deleteProperty(t,n){const r=$t(t,n);t[n];const a=Reflect.deleteProperty(t,n);return a&&r&&na(t,"delete",n,void 0),a}has(t,n){const r=Reflect.has(t,n);return(!mo(n)||!Gh.has(n))&&Qn(t,"has",n),r}ownKeys(t){return Qn(t,"iterate",nt(t)?"length":Za),Reflect.ownKeys(t)}}class bg extends Kh{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const _g=new Yh,Tg=new bg,kg=new Yh(!0);const Ku=e=>e,Qi=e=>Reflect.getPrototypeOf(e);function Cg(e,t,n){return function(...r){const a=this.__v_raw,o=Rt(a),s=As(o),l=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,h=a[e](...r),f=n?Ku:t?Ns:vo;return!t&&Qn(o,"iterate",c?Gu:Za),En(Object.create(h),{next(){const{value:g,done:_}=h.next();return _?{value:g,done:_}:{value:l?[f(g[0]),f(g[1])]:f(g),done:_}}})}}function Ji(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Sg(e,t){const n={get(a){const o=this.__v_raw,s=Rt(o),l=Rt(a);e||(co(a,l)&&Qn(s,"get",a),Qn(s,"get",l));const{has:c}=Qi(s),h=t?Ku:e?Ns:vo;if(c.call(s,a))return h(o.get(a));if(c.call(s,l))return h(o.get(l));o!==s&&o.get(a)},get size(){const a=this.__v_raw;return!e&&Qn(Rt(a),"iterate",Za),a.size},has(a){const o=this.__v_raw,s=Rt(o),l=Rt(a);return e||(co(a,l)&&Qn(s,"has",a),Qn(s,"has",l)),a===l?o.has(a):o.has(a)||o.has(l)},forEach(a,o){const s=this,l=s.__v_raw,c=Rt(l),h=t?Ku:e?Ns:vo;return!e&&Qn(c,"iterate",Za),l.forEach((f,g)=>a.call(o,h(f),h(g),s))}};return En(n,e?{add:Ji("add"),set:Ji("set"),delete:Ji("delete"),clear:Ji("clear")}:{add(a){const o=Rt(this),s=Qi(o),l=Rt(a),c=!t&&!Yr(a)&&!ia(a)?l:a;return s.has.call(o,c)||co(a,c)&&s.has.call(o,a)||co(l,c)&&s.has.call(o,l)||(o.add(c),na(o,"add",c,c)),this},set(a,o){!t&&!Yr(o)&&!ia(o)&&(o=Rt(o));const s=Rt(this),{has:l,get:c}=Qi(s);let h=l.call(s,a);h||(a=Rt(a),h=l.call(s,a));const f=c.call(s,a);return s.set(a,o),h?co(o,f)&&na(s,"set",a,o):na(s,"add",a,o),this},delete(a){const o=Rt(this),{has:s,get:l}=Qi(o);let c=s.call(o,a);c||(a=Rt(a),c=s.call(o,a)),l&&l.call(o,a);const h=o.delete(a);return c&&na(o,"delete",a,void 0),h},clear(){const a=Rt(this),o=a.size!==0,s=a.clear();return o&&na(a,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(a=>{n[a]=Cg(a,e,t)}),n}function Rc(e,t){const n=Sg(e,t);return(r,a,o)=>a==="__v_isReactive"?!e:a==="__v_isReadonly"?e:a==="__v_raw"?r:Reflect.get($t(n,a)&&a in r?n:r,a,o)}const xg={get:Rc(!1,!1)},Ag={get:Rc(!1,!0)},Eg={get:Rc(!0,!1)};const Qh=new WeakMap,Jh=new WeakMap,Xh=new WeakMap,Ig=new WeakMap;function Rg(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Pg(e){return e.__v_skip||!Object.isExtensible(e)?0:Rg(tg(e))}function Nl(e){return ia(e)?e:Pc(e,!1,_g,xg,Qh)}function Zh(e){return Pc(e,!1,kg,Ag,Jh)}function Yu(e){return Pc(e,!0,Tg,Eg,Xh)}function Pc(e,t,n,r,a){if(!Nt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Pg(e);if(o===0)return e;const s=a.get(e);if(s)return s;const l=new Proxy(e,o===2?r:n);return a.set(e,l),l}function es(e){return ia(e)?es(e.__v_raw):!!(e&&e.__v_isReactive)}function ia(e){return!!(e&&e.__v_isReadonly)}function Yr(e){return!!(e&&e.__v_isShallow)}function Mc(e){return e?!!e.__v_raw:!1}function Rt(e){const t=e&&e.__v_raw;return t?Rt(t):e}function Mg(e){return!$t(e,"__v_skip")&&Object.isExtensible(e)&&Nh(e,"__v_skip",!0),e}const vo=e=>Nt(e)?Nl(e):e,Ns=e=>Nt(e)?Yu(e):e;function Xn(e){return e?e.__v_isRef===!0:!1}function A(e){return ep(e,!1)}function $g(e){return ep(e,!0)}function ep(e,t){return Xn(e)?e:new Ng(e,t)}class Ng{constructor(t,n){this.dep=new Ic,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Rt(t),this._value=n?t:vo(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||Yr(t)||ia(t);t=r?t:Rt(t),co(t,n)&&(this._rawValue=t,this._value=r?t:vo(t),this.dep.trigger())}}function S(e){return Xn(e)?e.value:e}const Lg={get:(e,t,n)=>t==="__v_raw"?e:S(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const a=e[t];return Xn(a)&&!Xn(n)?(a.value=n,!0):Reflect.set(e,t,n,r)}};function tp(e){return es(e)?e:new Proxy(e,Lg)}class Og{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Ic(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ti-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Ht!==this)return Bh(this,!0),!0}get value(){const t=this.dep.track();return Wh(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function jg(e,t,n=!1){let r,a;return ct(e)?r=e:(r=e.get,a=e.set),new Og(r,a,n)}const Xi={},vl=new WeakMap;let Va;function Dg(e,t=!1,n=Va){if(n){let r=vl.get(n);r||vl.set(n,r=[]),r.push(e)}}function Fg(e,t,n=Ut){const{immediate:r,deep:a,once:o,scheduler:s,augmentJob:l,call:c}=n,h=Z=>a?Z:Yr(Z)||a===!1||a===0?ra(Z,1):ra(Z);let f,g,_,E,O=!1,H=!1;if(Xn(e)?(g=()=>e.value,O=Yr(e)):es(e)?(g=()=>h(e),O=!0):nt(e)?(H=!0,O=e.some(Z=>es(Z)||Yr(Z)),g=()=>e.map(Z=>{if(Xn(Z))return Z.value;if(es(Z))return h(Z);if(ct(Z))return c?c(Z,2):Z()})):ct(e)?t?g=c?()=>c(e,2):e:g=()=>{if(_){aa();try{_()}finally{sa()}}const Z=Va;Va=f;try{return c?c(e,3,[E]):e(E)}finally{Va=Z}}:g=Oo,t&&a){const Z=g,be=a===!0?1/0:a;g=()=>ra(Z(),be)}const X=hg(),D=()=>{f.stop(),X&&X.active&&kc(X.effects,f)};if(o&&t){const Z=t;t=(...be)=>{Z(...be),D()}}let j=H?new Array(e.length).fill(Xi):Xi;const K=Z=>{if(!(!(f.flags&1)||!f.dirty&&!Z))if(t){const be=f.run();if(a||O||(H?be.some((pe,de)=>co(pe,j[de])):co(be,j))){_&&_();const pe=Va;Va=f;try{const de=[be,j===Xi?void 0:H&&j[0]===Xi?[]:j,E];j=be,c?c(t,3,de):t(...de)}finally{Va=pe}}}else f.run()};return l&&l(K),f=new Fh(g),f.scheduler=s?()=>s(K,!1):K,E=Z=>Dg(Z,!1,f),_=f.onStop=()=>{const Z=vl.get(f);if(Z){if(c)c(Z,4);else for(const be of Z)be();vl.delete(f)}},t?r?K(!0):j=f.run():s?s(K.bind(null,!0),!0):f.run(),D.pause=f.pause.bind(f),D.resume=f.resume.bind(f),D.stop=D,D}function ra(e,t=1/0,n){if(t<=0||!Nt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Xn(e))ra(e.value,t,n);else if(nt(e))for(let r=0;r<e.length;r++)ra(e[r],t,n);else if(Il(e)||As(e))e.forEach(r=>{ra(r,t,n)});else if($h(e)){for(const r in e)ra(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&ra(e[r],t,n)}return e}/**
|
|
11
|
-
* @vue/runtime-core v3.5.34
|
|
12
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
-
* @license MIT
|
|
14
|
-
**/function Pi(e,t,n,r){try{return r?e(...r):e()}catch(a){Mi(a,t,n)}}function go(e,t,n,r){if(ct(e)){const a=Pi(e,t,n,r);return a&&Ph(a)&&a.catch(o=>{Mi(o,t,n)}),a}if(nt(e)){const a=[];for(let o=0;o<e.length;o++)a.push(go(e[o],t,n,r));return a}}function Mi(e,t,n,r=!0){const a=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Ut;if(t){let l=t.parent;const c=t.proxy,h=`https://vuejs.org/error-reference/#runtime-${n}`;for(;l;){const f=l.ec;if(f){for(let g=0;g<f.length;g++)if(f[g](e,c,h)===!1)return}l=l.parent}if(o){aa(),Pi(o,null,10,[e,c,h]),sa();return}}Ug(e,n,a,r,s)}function Ug(e,t,n,r=!0,a=!1){if(a)throw e;console.error(e)}const dr=[];let Po=-1;const Es=[];let Sa=null,ws=0;const np=Promise.resolve();let gl=null;function Xt(e){const t=gl||np;return e?t.then(this?e.bind(this):e):t}function Bg(e){let t=Po+1,n=dr.length;for(;t<n;){const r=t+n>>>1,a=dr[r],o=Ci(a);o<e||o===e&&a.flags&2?t=r+1:n=r}return t}function $c(e){if(!(e.flags&1)){const t=Ci(e),n=dr[dr.length-1];!n||!(e.flags&2)&&t>=Ci(n)?dr.push(e):dr.splice(Bg(t),0,e),e.flags|=1,rp()}}function rp(){gl||(gl=np.then(ap))}function qg(e){nt(e)?Es.push(...e):Sa&&e.id===-1?Sa.splice(ws+1,0,e):e.flags&1||(Es.push(e),e.flags|=1),rp()}function Ad(e,t,n=Po+1){for(;n<dr.length;n++){const r=dr[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;dr.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function op(e){if(Es.length){const t=[...new Set(Es)].sort((n,r)=>Ci(n)-Ci(r));if(Es.length=0,Sa){Sa.push(...t);return}for(Sa=t,ws=0;ws<Sa.length;ws++){const n=Sa[ws];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Sa=null,ws=0}}const Ci=e=>e.id==null?e.flags&2?-1:1/0:e.id;function ap(e){try{for(Po=0;Po<dr.length;Po++){const t=dr[Po];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Pi(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Po<dr.length;Po++){const t=dr[Po];t&&(t.flags&=-2)}Po=-1,dr.length=0,op(),gl=null,(dr.length||Es.length)&&ap()}}let qn=null,sp=null;function yl(e){const t=qn;return qn=e,sp=e&&e.type.__scopeId||null,t}function ht(e,t=qn,n){if(!t||e._n)return e;const r=(...a)=>{r._d&&_l(-1);const o=yl(t);let s;try{s=e(...a)}finally{yl(o),r._d&&_l(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function tn(e,t){if(qn===null)return e;const n=Fl(qn),r=e.dirs||(e.dirs=[]);for(let a=0;a<t.length;a++){let[o,s,l,c=Ut]=t[a];o&&(ct(o)&&(o={mounted:o,updated:o}),o.deep&&ra(s),r.push({dir:o,instance:n,value:s,oldValue:void 0,arg:l,modifiers:c}))}return e}function qa(e,t,n,r){const a=e.dirs,o=t&&t.dirs;for(let s=0;s<a.length;s++){const l=a[s];o&&(l.oldValue=o[s].value);let c=l.dir[r];c&&(aa(),go(c,n,8,[e.el,l,e,t]),sa())}}function fl(e,t){if(Bn){let n=Bn.provides;const r=Bn.parent&&Bn.parent.provides;r===n&&(n=Bn.provides=Object.create(r)),n[e]=t}}function po(e,t,n=!1){const r=Uc();if(r||Rs){let a=Rs?Rs._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(a&&e in a)return a[e];if(arguments.length>1)return n&&ct(t)?t.call(r&&r.proxy):t}}const Hg=Symbol.for("v-scx"),Wg=()=>po(Hg);function pt(e,t,n){return ip(e,t,n)}function ip(e,t,n=Ut){const{immediate:r,deep:a,flush:o,once:s}=n,l=En({},n),c=t&&r||!t&&o!=="post";let h;if(Os){if(o==="sync"){const E=Wg();h=E.__watcherHandles||(E.__watcherHandles=[])}else if(!c){const E=()=>{};return E.stop=Oo,E.resume=Oo,E.pause=Oo,E}}const f=Bn;l.call=(E,O,H)=>go(E,f,O,H);let g=!1;o==="post"?l.scheduler=E=>{ur(E,f&&f.suspense)}:o!=="sync"&&(g=!0,l.scheduler=(E,O)=>{O?E():$c(E)}),l.augmentJob=E=>{t&&(E.flags|=4),g&&(E.flags|=2,f&&(E.id=f.uid,E.i=f))};const _=Fg(e,t,l);return Os&&(h?h.push(_):c&&_()),_}function zg(e,t,n){const r=this.proxy,a=Yt(e)?e.includes(".")?lp(r,e):()=>r[e]:e.bind(r,r);let o;ct(t)?o=t:(o=t.handler,n=t);const s=Ni(this),l=ip(a,o.bind(r),n);return s(),l}function lp(e,t){const n=t.split(".");return()=>{let r=e;for(let a=0;a<n.length&&r;a++)r=r[n[a]];return r}}const Ca=new WeakMap,up=Symbol("_vte"),cp=e=>e.__isTeleport,Ga=e=>e&&(e.disabled||e.disabled===""),Vg=e=>e&&(e.defer||e.defer===""),Ed=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Id=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Qu=(e,t)=>{const n=e&&e.to;return Yt(n)?t?t(n):null:n},Gg={name:"Teleport",__isTeleport:!0,process(e,t,n,r,a,o,s,l,c,h){const{mc:f,pc:g,pbc:_,o:{insert:E,querySelector:O,createText:H,createComment:X,parentNode:D}}=h,j=Ga(t.props);let{dynamicChildren:K}=t;const Z=(de,Pe,G)=>{de.shapeFlag&16&&f(de.children,Pe,G,a,o,s,l,c)},be=(de=t)=>{const Pe=Ga(de.props),G=de.target=Qu(de.props,O),ve=Ju(G,de,H,E);G&&(s!=="svg"&&Ed(G)?s="svg":s!=="mathml"&&Id(G)&&(s="mathml"),a&&a.isCE&&(a.ce._teleportTargets||(a.ce._teleportTargets=new Set)).add(G),Pe||(Z(de,G,ve),li(de,!1)))},pe=de=>{const Pe=()=>{if(Ca.get(de)===Pe){if(Ca.delete(de),Ga(de.props)){const G=D(de.el)||n;Z(de,G,de.anchor),li(de,!0)}be(de)}};Ca.set(de,Pe),ur(Pe,o)};if(e==null){const de=t.el=H(""),Pe=t.anchor=H("");if(E(de,n,r),E(Pe,n,r),Vg(t.props)||o&&o.pendingBranch){pe(t);return}j&&(Z(t,n,Pe),li(t,!0)),be()}else{t.el=e.el;const de=t.anchor=e.anchor,Pe=Ca.get(e);if(Pe){Pe.flags|=8,Ca.delete(e),pe(t);return}t.targetStart=e.targetStart;const G=t.target=e.target,ve=t.targetAnchor=e.targetAnchor,Te=Ga(e.props),oe=Te?n:G,ke=Te?de:ve;if(s==="svg"||Ed(G)?s="svg":(s==="mathml"||Id(G))&&(s="mathml"),K?(_(e.dynamicChildren,K,oe,a,o,s,l),Dc(e,t,!0)):c||g(e,t,oe,ke,a,o,s,l,!1),j)Te?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Zi(t,n,de,h,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const De=t.target=Qu(t.props,O);De&&Zi(t,De,null,h,0)}else Te&&Zi(t,G,ve,h,1);li(t,j)}},remove(e,t,n,{um:r,o:{remove:a}},o){const{shapeFlag:s,children:l,anchor:c,targetStart:h,targetAnchor:f,target:g,props:_}=e;let E=o||!Ga(_);const O=Ca.get(e);if(O&&(O.flags|=8,Ca.delete(e),E=!1),g&&(a(h),a(f)),o&&a(c),s&16)for(let H=0;H<l.length;H++){const X=l[H];r(X,t,n,E,!!X.dynamicChildren)}},move:Zi,hydrate:Kg};function Zi(e,t,n,{o:{insert:r},m:a},o=2){o===0&&r(e.targetAnchor,t,n);const{el:s,anchor:l,shapeFlag:c,children:h,props:f}=e,g=o===2;if(g&&r(s,t,n),!Ca.has(e)&&(!g||Ga(f))&&c&16)for(let _=0;_<h.length;_++)a(h[_],t,n,2);g&&r(l,t,n)}function Kg(e,t,n,r,a,o,{o:{nextSibling:s,parentNode:l,querySelector:c,insert:h,createText:f}},g){function _(X,D){let j=D;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,X._lpa=t.targetAnchor&&s(t.targetAnchor);break}}j=s(j)}}function E(X,D){D.anchor=g(s(X),D,l(X),n,r,a,o)}const O=t.target=Qu(t.props,c),H=Ga(t.props);if(O){const X=O._lpa||O.firstChild;t.shapeFlag&16&&(H?(E(e,t),_(O,X),t.targetAnchor||Ju(O,t,f,h,l(e)===O?e:null)):(t.anchor=s(e),_(O,X),t.targetAnchor||Ju(O,t,f,h),g(X&&s(X),t,O,n,r,a,o))),li(t,H)}else H&&t.shapeFlag&16&&(E(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const Qa=Gg;function li(e,t){const n=e.ctx;if(n&&n.ut){let r,a;for(t?(r=e.el,a=e.anchor):(r=e.targetStart,a=e.targetAnchor);r&&r!==a;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Ju(e,t,n,r,a=null){const o=t.targetStart=n(""),s=t.targetAnchor=n("");return o[up]=s,e&&(r(o,e,a),r(s,e,a)),s}const Mo=Symbol("_leaveCb"),oi=Symbol("_enterCb");function Yg(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ca(()=>{e.isMounted=!0}),Pa(()=>{e.isUnmounting=!0}),e}const Kr=[Function,Array],dp={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Kr,onEnter:Kr,onAfterEnter:Kr,onEnterCancelled:Kr,onBeforeLeave:Kr,onLeave:Kr,onAfterLeave:Kr,onLeaveCancelled:Kr,onBeforeAppear:Kr,onAppear:Kr,onAfterAppear:Kr,onAppearCancelled:Kr},fp=e=>{const t=e.subTree;return t.component?fp(t.component):t},Qg={name:"BaseTransition",props:dp,setup(e,{slots:t}){const n=Uc(),r=Yg();return()=>{const a=t.default&&mp(t.default(),!0),o=a&&a.length?hp(a):n.subTree?J():void 0;if(!o)return;const s=Rt(e),{mode:l}=s;if(r.isLeaving)return yu(o);const c=Rd(o);if(!c)return yu(o);let h=Xu(c,s,r,n,g=>h=g);c.type!==Jn&&Si(c,h);let f=n.subTree&&Rd(n.subTree);if(f&&f.type!==Jn&&!Ka(f,c)&&fp(n).type!==Jn){let g=Xu(f,s,r,n);if(Si(f,g),l==="out-in"&&c.type!==Jn)return r.isLeaving=!0,g.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete g.afterLeave,f=void 0},yu(o);l==="in-out"&&c.type!==Jn?g.delayLeave=(_,E,O)=>{const H=pp(r,f);H[String(f.key)]=f,_[Mo]=()=>{E(),_[Mo]=void 0,delete h.delayedLeave,f=void 0},h.delayedLeave=()=>{O(),delete h.delayedLeave,f=void 0}}:f=void 0}else f&&(f=void 0);return o}}};function hp(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Jn){t=n;break}}return t}const Jg=Qg;function pp(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 Xu(e,t,n,r,a){const{appear:o,mode:s,persisted:l=!1,onBeforeEnter:c,onEnter:h,onAfterEnter:f,onEnterCancelled:g,onBeforeLeave:_,onLeave:E,onAfterLeave:O,onLeaveCancelled:H,onBeforeAppear:X,onAppear:D,onAfterAppear:j,onAppearCancelled:K}=t,Z=String(e.key),be=pp(n,e),pe=(G,ve)=>{G&&go(G,r,9,ve)},de=(G,ve)=>{const Te=ve[1];pe(G,ve),nt(G)?G.every(oe=>oe.length<=1)&&Te():G.length<=1&&Te()},Pe={mode:s,persisted:l,beforeEnter(G){let ve=c;if(!n.isMounted)if(o)ve=X||c;else return;G[Mo]&&G[Mo](!0);const Te=be[Z];Te&&Ka(e,Te)&&Te.el[Mo]&&Te.el[Mo](),pe(ve,[G])},enter(G){if(be[Z]===e)return;let ve=h,Te=f,oe=g;if(!n.isMounted)if(o)ve=D||h,Te=j||f,oe=K||g;else return;let ke=!1;G[oi]=Be=>{ke||(ke=!0,Be?pe(oe,[G]):pe(Te,[G]),Pe.delayedLeave&&Pe.delayedLeave(),G[oi]=void 0)};const De=G[oi].bind(null,!1);ve?de(ve,[G,De]):De()},leave(G,ve){const Te=String(e.key);if(G[oi]&&G[oi](!0),n.isUnmounting)return ve();pe(_,[G]);let oe=!1;G[Mo]=De=>{oe||(oe=!0,ve(),De?pe(H,[G]):pe(O,[G]),G[Mo]=void 0,be[Te]===e&&delete be[Te])};const ke=G[Mo].bind(null,!1);be[Te]=e,E?de(E,[G,ke]):ke()},clone(G){const ve=Xu(G,t,n,r,a);return a&&a(ve),ve}};return Pe}function yu(e){if($i(e))return e=Ia(e),e.children=null,e}function Rd(e){if(!$i(e))return cp(e.type)&&e.children?hp(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&&ct(n.default))return n.default()}}function Si(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Si(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 mp(e,t=!1,n){let r=[],a=0;for(let o=0;o<e.length;o++){let s=e[o];const l=n==null?s.key:String(n)+String(s.key!=null?s.key:o);s.type===Ye?(s.patchFlag&128&&a++,r=r.concat(mp(s.children,t,l))):(t||s.type!==Jn)&&r.push(l!=null?Ia(s,{key:l}):s)}if(a>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Hn(e,t){return ct(e)?En({name:e.name},t,{setup:e}):e}function Nc(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Pd(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const wl=new WeakMap;function vi(e,t,n,r,a=!1){if(nt(e)){e.forEach((H,X)=>vi(H,t&&(nt(t)?t[X]:t),n,r,a));return}if(Is(r)&&!a){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&vi(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?Fl(r.component):r.el,s=a?null:o,{i:l,r:c}=e,h=t&&t.r,f=l.refs===Ut?l.refs={}:l.refs,g=l.setupState,_=Rt(g),E=g===Ut?Rh:H=>Pd(f,H)?!1:$t(_,H),O=(H,X)=>!(X&&Pd(f,X));if(h!=null&&h!==c){if(Md(t),Yt(h))f[h]=null,E(h)&&(g[h]=null);else if(Xn(h)){const H=t;O(h,H.k)&&(h.value=null),H.k&&(f[H.k]=null)}}if(ct(c))Pi(c,l,12,[s,f]);else{const H=Yt(c),X=Xn(c);if(H||X){const D=()=>{if(e.f){const j=H?E(c)?g[c]:f[c]:O()||!e.k?c.value:f[e.k];if(a)nt(j)&&kc(j,o);else if(nt(j))j.includes(o)||j.push(o);else if(H)f[c]=[o],E(c)&&(g[c]=f[c]);else{const K=[o];O(c,e.k)&&(c.value=K),e.k&&(f[e.k]=K)}}else H?(f[c]=s,E(c)&&(g[c]=s)):X&&(O(c,e.k)&&(c.value=s),e.k&&(f[e.k]=s))};if(s){const j=()=>{D(),wl.delete(e)};j.id=-1,wl.set(e,j),ur(j,n)}else Md(e),D()}}}function Md(e){const t=wl.get(e);t&&(t.flags|=8,wl.delete(e))}const $d=e=>e.nodeType===8;Ml().requestIdleCallback;Ml().cancelIdleCallback;function Xg(e,t){if($d(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if($d(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const Is=e=>!!e.type.__asyncLoader;function el(e){ct(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:a=200,hydrate:o,timeout:s,suspensible:l=!0,onError:c}=e;let h=null,f,g=0;const _=()=>(g++,h=null,E()),E=()=>{let O;return h||(O=h=t().catch(H=>{if(H=H instanceof Error?H:new Error(String(H)),c)return new Promise((X,D)=>{c(H,()=>X(_()),()=>D(H),g+1)});throw H}).then(H=>O!==h&&h?h:(H&&(H.__esModule||H[Symbol.toStringTag]==="Module")&&(H=H.default),f=H,H)))};return Hn({name:"AsyncComponentWrapper",__asyncLoader:E,__asyncHydrate(O,H,X){let D=!1;(H.bu||(H.bu=[])).push(()=>D=!0);const j=()=>{D||X()},K=o?()=>{const Z=o(j,be=>Xg(O,be));Z&&(H.bum||(H.bum=[])).push(Z)}:j;f?K():E().then(()=>!H.isUnmounted&&K())},get __asyncResolved(){return f},setup(){const O=Bn;if(Nc(O),f)return()=>tl(f,O);const H=K=>{h=null,Mi(K,O,13,!r)};if(l&&O.suspense||Os)return E().then(K=>()=>tl(K,O)).catch(K=>(H(K),()=>r?Oe(r,{error:K}):null));const X=A(!1),D=A(),j=A(!!a);return a&&setTimeout(()=>{j.value=!1},a),s!=null&&setTimeout(()=>{if(!X.value&&!D.value){const K=new Error(`Async component timed out after ${s}ms.`);H(K),D.value=K}},s),E().then(()=>{X.value=!0,O.parent&&$i(O.parent.vnode)&&O.parent.update()}).catch(K=>{H(K),D.value=K}),()=>{if(X.value&&f)return tl(f,O);if(D.value&&r)return Oe(r,{error:D.value});if(n&&!j.value)return tl(n,O)}}})}function tl(e,t){const{ref:n,props:r,children:a,ce:o}=t.vnode,s=Oe(e,r,a);return s.ref=n,s.ce=o,delete t.vnode.ce,s}const $i=e=>e.type.__isKeepAlive;function Zg(e,t){vp(e,"a",t)}function ey(e,t){vp(e,"da",t)}function vp(e,t,n=Bn){const r=e.__wdc||(e.__wdc=()=>{let a=n;for(;a;){if(a.isDeactivated)return;a=a.parent}return e()});if(Ll(t,r,n),n){let a=n.parent;for(;a&&a.parent;)$i(a.parent.vnode)&&ty(r,t,n,a),a=a.parent}}function ty(e,t,n,r){const a=Ll(t,e,r,!0);Ol(()=>{kc(r[t],a)},n)}function Ll(e,t,n=Bn,r=!1){if(n){const a=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...s)=>{aa();const l=Ni(n),c=go(t,n,e,s);return l(),sa(),c});return r?a.unshift(o):a.push(o),o}}const ua=e=>(t,n=Bn)=>{(!Os||e==="sp")&&Ll(e,(...r)=>t(...r),n)},ny=ua("bm"),ca=ua("m"),ry=ua("bu"),oy=ua("u"),Pa=ua("bum"),Ol=ua("um"),ay=ua("sp"),sy=ua("rtg"),iy=ua("rtc");function ly(e,t=Bn){Ll("ec",e,t)}const uy="components",gp=Symbol.for("v-ndc");function Lc(e){return Yt(e)?cy(uy,e,!1)||e:e||gp}function cy(e,t,n=!0,r=!1){const a=qn||Bn;if(a){const o=a.type;{const l=Ky(o,!1);if(l&&(l===t||l===hr(t)||l===Pl(hr(t))))return o}const s=Nd(a[e]||o[e],t)||Nd(a.appContext[e],t);return!s&&r?o:s}}function Nd(e,t){return e&&(e[t]||e[hr(t)]||e[Pl(hr(t))])}function Kt(e,t,n,r){let a;const o=n,s=nt(e);if(s||Yt(e)){const l=s&&es(e);let c=!1,h=!1;l&&(c=!Yr(e),h=ia(e),e=$l(e)),a=new Array(e.length);for(let f=0,g=e.length;f<g;f++)a[f]=t(c?h?Ns(vo(e[f])):vo(e[f]):e[f],f,void 0,o)}else if(typeof e=="number"){a=new Array(e);for(let l=0;l<e;l++)a[l]=t(l+1,l,void 0,o)}else if(Nt(e))if(e[Symbol.iterator])a=Array.from(e,(l,c)=>t(l,c,void 0,o));else{const l=Object.keys(e);a=new Array(l.length);for(let c=0,h=l.length;c<h;c++){const f=l[c];a[c]=t(e[f],f,c,o)}}else a=[];return a}function Lo(e,t,n={},r,a){if(qn.ce||qn.parent&&Is(qn.parent)&&qn.parent.ce){const h=Object.keys(n).length>0;return t!=="default"&&(n.name=t),k(),Ze(Ye,null,[Oe("slot",n,r)],h?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),k();const s=o&&yp(o(n)),l=n.key||s&&s.key,c=Ze(Ye,{key:(l&&!mo(l)?l:`_${t}`)+(!s&&r?"_fb":"")},s||[],s&&e._===1?64:-2);return o&&o._c&&(o._d=!0),c}function yp(e){return e.some(t=>xi(t)?!(t.type===Jn||t.type===Ye&&!yp(t.children)):!0)?e:null}const Zu=e=>e?Dp(e)?Fl(e):Zu(e.parent):null,gi=En(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=>Zu(e.parent),$root:e=>Zu(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>bp(e),$forceUpdate:e=>e.f||(e.f=()=>{$c(e.update)}),$nextTick:e=>e.n||(e.n=Xt.bind(e.proxy)),$watch:e=>zg.bind(e)}),wu=(e,t)=>e!==Ut&&!e.__isScriptSetup&&$t(e,t),dy={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:a,props:o,accessCache:s,type:l,appContext:c}=e;if(t[0]!=="$"){const _=s[t];if(_!==void 0)switch(_){case 1:return r[t];case 2:return a[t];case 4:return n[t];case 3:return o[t]}else{if(wu(r,t))return s[t]=1,r[t];if(a!==Ut&&$t(a,t))return s[t]=2,a[t];if($t(o,t))return s[t]=3,o[t];if(n!==Ut&&$t(n,t))return s[t]=4,n[t];ec&&(s[t]=0)}}const h=gi[t];let f,g;if(h)return t==="$attrs"&&Qn(e.attrs,"get",""),h(e);if((f=l.__cssModules)&&(f=f[t]))return f;if(n!==Ut&&$t(n,t))return s[t]=4,n[t];if(g=c.config.globalProperties,$t(g,t))return g[t]},set({_:e},t,n){const{data:r,setupState:a,ctx:o}=e;return wu(a,t)?(a[t]=n,!0):r!==Ut&&$t(r,t)?(r[t]=n,!0):$t(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:a,props:o,type:s}},l){let c;return!!(n[l]||e!==Ut&&l[0]!=="$"&&$t(e,l)||wu(t,l)||$t(o,l)||$t(r,l)||$t(gi,l)||$t(a.config.globalProperties,l)||(c=s.__cssModules)&&c[l])},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 fy(){return hy().slots}function hy(e){const t=Uc();return t.setupContext||(t.setupContext=Up(t))}function Ld(e){return nt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let ec=!0;function py(e){const t=bp(e),n=e.proxy,r=e.ctx;ec=!1,t.beforeCreate&&Od(t.beforeCreate,e,"bc");const{data:a,computed:o,methods:s,watch:l,provide:c,inject:h,created:f,beforeMount:g,mounted:_,beforeUpdate:E,updated:O,activated:H,deactivated:X,beforeDestroy:D,beforeUnmount:j,destroyed:K,unmounted:Z,render:be,renderTracked:pe,renderTriggered:de,errorCaptured:Pe,serverPrefetch:G,expose:ve,inheritAttrs:Te,components:oe,directives:ke,filters:De}=t;if(h&&my(h,r,null),s)for(const Le in s){const Se=s[Le];ct(Se)&&(r[Le]=Se.bind(n))}if(a){const Le=a.call(n,n);Nt(Le)&&(e.data=Nl(Le))}if(ec=!0,o)for(const Le in o){const Se=o[Le],Qe=ct(Se)?Se.bind(n,n):ct(Se.get)?Se.get.bind(n,n):Oo,tt=!ct(Se)&&ct(Se.set)?Se.set.bind(n):Oo,Ue=ne({get:Qe,set:tt});Object.defineProperty(r,Le,{enumerable:!0,configurable:!0,get:()=>Ue.value,set:He=>Ue.value=He})}if(l)for(const Le in l)wp(l[Le],r,n,Le);if(c){const Le=ct(c)?c.call(n):c;Reflect.ownKeys(Le).forEach(Se=>{fl(Se,Le[Se])})}f&&Od(f,e,"c");function Ke(Le,Se){nt(Se)?Se.forEach(Qe=>Le(Qe.bind(n))):Se&&Le(Se.bind(n))}if(Ke(ny,g),Ke(ca,_),Ke(ry,E),Ke(oy,O),Ke(Zg,H),Ke(ey,X),Ke(ly,Pe),Ke(iy,pe),Ke(sy,de),Ke(Pa,j),Ke(Ol,Z),Ke(ay,G),nt(ve))if(ve.length){const Le=e.exposed||(e.exposed={});ve.forEach(Se=>{Object.defineProperty(Le,Se,{get:()=>n[Se],set:Qe=>n[Se]=Qe,enumerable:!0})})}else e.exposed||(e.exposed={});be&&e.render===Oo&&(e.render=be),Te!=null&&(e.inheritAttrs=Te),oe&&(e.components=oe),ke&&(e.directives=ke),G&&Nc(e)}function my(e,t,n=Oo){nt(e)&&(e=tc(e));for(const r in e){const a=e[r];let o;Nt(a)?"default"in a?o=po(a.from||r,a.default,!0):o=po(a.from||r):o=po(a),Xn(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:s=>o.value=s}):t[r]=o}}function Od(e,t,n){go(nt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function wp(e,t,n,r){let a=r.includes(".")?lp(n,r):()=>n[r];if(Yt(e)){const o=t[e];ct(o)&&pt(a,o)}else if(ct(e))pt(a,e.bind(n));else if(Nt(e))if(nt(e))e.forEach(o=>wp(o,t,n,r));else{const o=ct(e.handler)?e.handler.bind(n):t[e.handler];ct(o)&&pt(a,o,e)}}function bp(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:a,optionsCache:o,config:{optionMergeStrategies:s}}=e.appContext,l=o.get(t);let c;return l?c=l:!a.length&&!n&&!r?c=t:(c={},a.length&&a.forEach(h=>bl(c,h,s,!0)),bl(c,t,s)),Nt(t)&&o.set(t,c),c}function bl(e,t,n,r=!1){const{mixins:a,extends:o}=t;o&&bl(e,o,n,!0),a&&a.forEach(s=>bl(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const l=vy[s]||n&&n[s];e[s]=l?l(e[s],t[s]):t[s]}return e}const vy={data:jd,props:Dd,emits:Dd,methods:ui,computed:ui,beforeCreate:lr,created:lr,beforeMount:lr,mounted:lr,beforeUpdate:lr,updated:lr,beforeDestroy:lr,beforeUnmount:lr,destroyed:lr,unmounted:lr,activated:lr,deactivated:lr,errorCaptured:lr,serverPrefetch:lr,components:ui,directives:ui,watch:yy,provide:jd,inject:gy};function jd(e,t){return t?e?function(){return En(ct(e)?e.call(this,this):e,ct(t)?t.call(this,this):t)}:t:e}function gy(e,t){return ui(tc(e),tc(t))}function tc(e){if(nt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function lr(e,t){return e?[...new Set([].concat(e,t))]:t}function ui(e,t){return e?En(Object.create(null),e,t):t}function Dd(e,t){return e?nt(e)&&nt(t)?[...new Set([...e,...t])]:En(Object.create(null),Ld(e),Ld(t??{})):t}function yy(e,t){if(!e)return t;if(!t)return e;const n=En(Object.create(null),e);for(const r in t)n[r]=lr(e[r],t[r]);return n}function _p(){return{app:null,config:{isNativeTag:Rh,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 wy=0;function by(e,t){return function(r,a=null){ct(r)||(r=En({},r)),a!=null&&!Nt(a)&&(a=null);const o=_p(),s=new WeakSet,l=[];let c=!1;const h=o.app={_uid:wy++,_component:r,_props:a,_container:null,_context:o,_instance:null,version:Jy,get config(){return o.config},set config(f){},use(f,...g){return s.has(f)||(f&&ct(f.install)?(s.add(f),f.install(h,...g)):ct(f)&&(s.add(f),f(h,...g))),h},mixin(f){return o.mixins.includes(f)||o.mixins.push(f),h},component(f,g){return g?(o.components[f]=g,h):o.components[f]},directive(f,g){return g?(o.directives[f]=g,h):o.directives[f]},mount(f,g,_){if(!c){const E=h._ceVNode||Oe(r,a);return E.appContext=o,_===!0?_="svg":_===!1&&(_=void 0),e(E,f,_),c=!0,h._container=f,f.__vue_app__=h,Fl(E.component)}},onUnmount(f){l.push(f)},unmount(){c&&(go(l,h._instance,16),e(null,h._container),delete h._container.__vue_app__)},provide(f,g){return o.provides[f]=g,h},runWithContext(f){const g=Rs;Rs=h;try{return f()}finally{Rs=g}}};return h}}let Rs=null;const _y=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${hr(t)}Modifiers`]||e[`${Ra(t)}Modifiers`];function Ty(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Ut;let a=n;const o=t.startsWith("update:"),s=o&&_y(r,t.slice(7));s&&(s.trim&&(a=n.map(f=>Yt(f)?f.trim():f)),s.number&&(a=n.map(Sc)));let l,c=r[l=hu(t)]||r[l=hu(hr(t))];!c&&o&&(c=r[l=hu(Ra(t))]),c&&go(c,e,6,a);const h=r[l+"Once"];if(h){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,go(h,e,6,a)}}const ky=new WeakMap;function Tp(e,t,n=!1){const r=n?ky:t.emitsCache,a=r.get(e);if(a!==void 0)return a;const o=e.emits;let s={},l=!1;if(!ct(e)){const c=h=>{const f=Tp(h,t,!0);f&&(l=!0,En(s,f))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!o&&!l?(Nt(e)&&r.set(e,null),null):(nt(o)?o.forEach(c=>s[c]=null):En(s,o),Nt(e)&&r.set(e,s),s)}function jl(e,t){return!e||!Al(t)?!1:(t=t.slice(2).replace(/Once$/,""),$t(e,t[0].toLowerCase()+t.slice(1))||$t(e,Ra(t))||$t(e,t))}function Fd(e){const{type:t,vnode:n,proxy:r,withProxy:a,propsOptions:[o],slots:s,attrs:l,emit:c,render:h,renderCache:f,props:g,data:_,setupState:E,ctx:O,inheritAttrs:H}=e,X=yl(e);let D,j;try{if(n.shapeFlag&4){const Z=a||r,be=Z;D=No(h.call(be,Z,f,g,E,_,O)),j=l}else{const Z=t;D=No(Z.length>1?Z(g,{attrs:l,slots:s,emit:c}):Z(g,null)),j=t.props?l:Cy(l)}}catch(Z){yi.length=0,Mi(Z,e,1),D=Oe(Jn)}let K=D;if(j&&H!==!1){const Z=Object.keys(j),{shapeFlag:be}=K;Z.length&&be&7&&(o&&Z.some(El)&&(j=Sy(j,o)),K=Ia(K,j,!1,!0))}return n.dirs&&(K=Ia(K,null,!1,!0),K.dirs=K.dirs?K.dirs.concat(n.dirs):n.dirs),n.transition&&Si(K,n.transition),D=K,yl(X),D}const Cy=e=>{let t;for(const n in e)(n==="class"||n==="style"||Al(n))&&((t||(t={}))[n]=e[n]);return t},Sy=(e,t)=>{const n={};for(const r in e)(!El(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function xy(e,t,n){const{props:r,children:a,component:o}=e,{props:s,children:l,patchFlag:c}=t,h=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?Ud(r,s,h):!!s;if(c&8){const f=t.dynamicProps;for(let g=0;g<f.length;g++){const _=f[g];if(kp(s,r,_)&&!jl(h,_))return!0}}}else return(a||l)&&(!l||!l.$stable)?!0:r===s?!1:r?s?Ud(r,s,h):!0:!!s;return!1}function Ud(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let a=0;a<r.length;a++){const o=r[a];if(kp(t,e,o)&&!jl(n,o))return!0}return!1}function kp(e,t,n){const r=e[n],a=t[n];return n==="style"&&Nt(r)&&Nt(a)?!Ri(r,a):r!==a}function Ay({vnode:e,parent:t,suspense:n},r){for(;t;){const a=t.subTree;if(a.suspense&&a.suspense.activeBranch===e&&(a.suspense.vnode.el=a.el=r,e=a),a===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const Cp={},Sp=()=>Object.create(Cp),xp=e=>Object.getPrototypeOf(e)===Cp;function Ey(e,t,n,r=!1){const a={},o=Sp();e.propsDefaults=Object.create(null),Ap(e,t,a,o);for(const s in e.propsOptions[0])s in a||(a[s]=void 0);n?e.props=r?a:Zh(a):e.type.props?e.props=a:e.props=o,e.attrs=o}function Iy(e,t,n,r){const{props:a,attrs:o,vnode:{patchFlag:s}}=e,l=Rt(a),[c]=e.propsOptions;let h=!1;if((r||s>0)&&!(s&16)){if(s&8){const f=e.vnode.dynamicProps;for(let g=0;g<f.length;g++){let _=f[g];if(jl(e.emitsOptions,_))continue;const E=t[_];if(c)if($t(o,_))E!==o[_]&&(o[_]=E,h=!0);else{const O=hr(_);a[O]=nc(c,l,O,E,e,!1)}else E!==o[_]&&(o[_]=E,h=!0)}}}else{Ap(e,t,a,o)&&(h=!0);let f;for(const g in l)(!t||!$t(t,g)&&((f=Ra(g))===g||!$t(t,f)))&&(c?n&&(n[g]!==void 0||n[f]!==void 0)&&(a[g]=nc(c,l,g,void 0,e,!0)):delete a[g]);if(o!==l)for(const g in o)(!t||!$t(t,g))&&(delete o[g],h=!0)}h&&na(e.attrs,"set","")}function Ap(e,t,n,r){const[a,o]=e.propsOptions;let s=!1,l;if(t)for(let c in t){if(hi(c))continue;const h=t[c];let f;a&&$t(a,f=hr(c))?!o||!o.includes(f)?n[f]=h:(l||(l={}))[f]=h:jl(e.emitsOptions,c)||(!(c in r)||h!==r[c])&&(r[c]=h,s=!0)}if(o){const c=Rt(n),h=l||Ut;for(let f=0;f<o.length;f++){const g=o[f];n[g]=nc(a,c,g,h[g],e,!$t(h,g))}}return s}function nc(e,t,n,r,a,o){const s=e[n];if(s!=null){const l=$t(s,"default");if(l&&r===void 0){const c=s.default;if(s.type!==Function&&!s.skipFactory&&ct(c)){const{propsDefaults:h}=a;if(n in h)r=h[n];else{const f=Ni(a);r=h[n]=c.call(null,t),f()}}else r=c;a.ce&&a.ce._setProp(n,r)}s[0]&&(o&&!l?r=!1:s[1]&&(r===""||r===Ra(n))&&(r=!0))}return r}const Ry=new WeakMap;function Ep(e,t,n=!1){const r=n?Ry:t.propsCache,a=r.get(e);if(a)return a;const o=e.props,s={},l=[];let c=!1;if(!ct(e)){const f=g=>{c=!0;const[_,E]=Ep(g,t,!0);En(s,_),E&&l.push(...E)};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!o&&!c)return Nt(e)&&r.set(e,xs),xs;if(nt(o))for(let f=0;f<o.length;f++){const g=hr(o[f]);Bd(g)&&(s[g]=Ut)}else if(o)for(const f in o){const g=hr(f);if(Bd(g)){const _=o[f],E=s[g]=nt(_)||ct(_)?{type:_}:En({},_),O=E.type;let H=!1,X=!0;if(nt(O))for(let D=0;D<O.length;++D){const j=O[D],K=ct(j)&&j.name;if(K==="Boolean"){H=!0;break}else K==="String"&&(X=!1)}else H=ct(O)&&O.name==="Boolean";E[0]=H,E[1]=X,(H||$t(E,"default"))&&l.push(g)}}const h=[s,l];return Nt(e)&&r.set(e,h),h}function Bd(e){return e[0]!=="$"&&!hi(e)}const Oc=e=>e==="_"||e==="_ctx"||e==="$stable",jc=e=>nt(e)?e.map(No):[No(e)],Py=(e,t,n)=>{if(t._n)return t;const r=ht((...a)=>jc(t(...a)),n);return r._c=!1,r},Ip=(e,t,n)=>{const r=e._ctx;for(const a in e){if(Oc(a))continue;const o=e[a];if(ct(o))t[a]=Py(a,o,r);else if(o!=null){const s=jc(o);t[a]=()=>s}}},Rp=(e,t)=>{const n=jc(t);e.slots.default=()=>n},Pp=(e,t,n)=>{for(const r in t)(n||!Oc(r))&&(e[r]=t[r])},My=(e,t,n)=>{const r=e.slots=Sp();if(e.vnode.shapeFlag&32){const a=t._;a?(Pp(r,t,n),n&&Nh(r,"_",a,!0)):Ip(t,r)}else t&&Rp(e,t)},$y=(e,t,n)=>{const{vnode:r,slots:a}=e;let o=!0,s=Ut;if(r.shapeFlag&32){const l=t._;l?n&&l===1?o=!1:Pp(a,t,n):(o=!t.$stable,Ip(t,a)),s=t}else t&&(Rp(e,t),s={default:1});if(o)for(const l in a)!Oc(l)&&s[l]==null&&delete a[l]},ur=Dy;function Ny(e){return Ly(e)}function Ly(e,t){const n=Ml();n.__VUE__=!0;const{insert:r,remove:a,patchProp:o,createElement:s,createText:l,createComment:c,setText:h,setElementText:f,parentNode:g,nextSibling:_,setScopeId:E=Oo,insertStaticContent:O}=e,H=(x,P,z,ae=null,Q=null,le=null,fe=void 0,ye=null,we=!!P.dynamicChildren)=>{if(x===P)return;x&&!Ka(x,P)&&(ae=ee(x),He(x,Q,le,!0),x=null),P.patchFlag===-2&&(we=!1,P.dynamicChildren=null);const{type:he,ref:je,shapeFlag:me}=P;switch(he){case Dl:X(x,P,z,ae);break;case Jn:D(x,P,z,ae);break;case _u:x==null&&j(P,z,ae,fe);break;case Ye:oe(x,P,z,ae,Q,le,fe,ye,we);break;default:me&1?be(x,P,z,ae,Q,le,fe,ye,we):me&6?ke(x,P,z,ae,Q,le,fe,ye,we):(me&64||me&128)&&he.process(x,P,z,ae,Q,le,fe,ye,we,Fe)}je!=null&&Q?vi(je,x&&x.ref,le,P||x,!P):je==null&&x&&x.ref!=null&&vi(x.ref,null,le,x,!0)},X=(x,P,z,ae)=>{if(x==null)r(P.el=l(P.children),z,ae);else{const Q=P.el=x.el;P.children!==x.children&&h(Q,P.children)}},D=(x,P,z,ae)=>{x==null?r(P.el=c(P.children||""),z,ae):P.el=x.el},j=(x,P,z,ae)=>{[x.el,x.anchor]=O(x.children,P,z,ae,x.el,x.anchor)},K=({el:x,anchor:P},z,ae)=>{let Q;for(;x&&x!==P;)Q=_(x),r(x,z,ae),x=Q;r(P,z,ae)},Z=({el:x,anchor:P})=>{let z;for(;x&&x!==P;)z=_(x),a(x),x=z;a(P)},be=(x,P,z,ae,Q,le,fe,ye,we)=>{if(P.type==="svg"?fe="svg":P.type==="math"&&(fe="mathml"),x==null)pe(P,z,ae,Q,le,fe,ye,we);else{const he=x.el&&x.el._isVueCE?x.el:null;try{he&&he._beginPatch(),G(x,P,Q,le,fe,ye,we)}finally{he&&he._endPatch()}}},pe=(x,P,z,ae,Q,le,fe,ye)=>{let we,he;const{props:je,shapeFlag:me,transition:Me,dirs:Ie}=x;if(we=x.el=s(x.type,le,je&&je.is,je),me&8?f(we,x.children):me&16&&Pe(x.children,we,null,ae,Q,bu(x,le),fe,ye),Ie&&qa(x,null,ae,"created"),de(we,x,x.scopeId,fe,ae),je){for(const dt in je)dt!=="value"&&!hi(dt)&&o(we,dt,null,je[dt],le,ae);"value"in je&&o(we,"value",null,je.value,le),(he=je.onVnodeBeforeMount)&&Ro(he,ae,x)}Ie&&qa(x,null,ae,"beforeMount");const at=Oy(Q,Me);at&&Me.beforeEnter(we),r(we,P,z),((he=je&&je.onVnodeMounted)||at||Ie)&&ur(()=>{try{he&&Ro(he,ae,x),at&&Me.enter(we),Ie&&qa(x,null,ae,"mounted")}finally{}},Q)},de=(x,P,z,ae,Q)=>{if(z&&E(x,z),ae)for(let le=0;le<ae.length;le++)E(x,ae[le]);if(Q){let le=Q.subTree;if(P===le||Np(le.type)&&(le.ssContent===P||le.ssFallback===P)){const fe=Q.vnode;de(x,fe,fe.scopeId,fe.slotScopeIds,Q.parent)}}},Pe=(x,P,z,ae,Q,le,fe,ye,we=0)=>{for(let he=we;he<x.length;he++){const je=x[he]=ye?ta(x[he]):No(x[he]);H(null,je,P,z,ae,Q,le,fe,ye)}},G=(x,P,z,ae,Q,le,fe)=>{const ye=P.el=x.el;let{patchFlag:we,dynamicChildren:he,dirs:je}=P;we|=x.patchFlag&16;const me=x.props||Ut,Me=P.props||Ut;let Ie;if(z&&Ha(z,!1),(Ie=Me.onVnodeBeforeUpdate)&&Ro(Ie,z,P,x),je&&qa(P,x,z,"beforeUpdate"),z&&Ha(z,!0),(me.innerHTML&&Me.innerHTML==null||me.textContent&&Me.textContent==null)&&f(ye,""),he?ve(x.dynamicChildren,he,ye,z,ae,bu(P,Q),le):fe||Se(x,P,ye,null,z,ae,bu(P,Q),le,!1),we>0){if(we&16)Te(ye,me,Me,z,Q);else if(we&2&&me.class!==Me.class&&o(ye,"class",null,Me.class,Q),we&4&&o(ye,"style",me.style,Me.style,Q),we&8){const at=P.dynamicProps;for(let dt=0;dt<at.length;dt++){const lt=at[dt],gt=me[lt],kt=Me[lt];(kt!==gt||lt==="value")&&o(ye,lt,gt,kt,Q,z)}}we&1&&x.children!==P.children&&f(ye,P.children)}else!fe&&he==null&&Te(ye,me,Me,z,Q);((Ie=Me.onVnodeUpdated)||je)&&ur(()=>{Ie&&Ro(Ie,z,P,x),je&&qa(P,x,z,"updated")},ae)},ve=(x,P,z,ae,Q,le,fe)=>{for(let ye=0;ye<P.length;ye++){const we=x[ye],he=P[ye],je=we.el&&(we.type===Ye||!Ka(we,he)||we.shapeFlag&198)?g(we.el):z;H(we,he,je,null,ae,Q,le,fe,!0)}},Te=(x,P,z,ae,Q)=>{if(P!==z){if(P!==Ut)for(const le in P)!hi(le)&&!(le in z)&&o(x,le,P[le],null,Q,ae);for(const le in z){if(hi(le))continue;const fe=z[le],ye=P[le];fe!==ye&&le!=="value"&&o(x,le,ye,fe,Q,ae)}"value"in z&&o(x,"value",P.value,z.value,Q)}},oe=(x,P,z,ae,Q,le,fe,ye,we)=>{const he=P.el=x?x.el:l(""),je=P.anchor=x?x.anchor:l("");let{patchFlag:me,dynamicChildren:Me,slotScopeIds:Ie}=P;Ie&&(ye=ye?ye.concat(Ie):Ie),x==null?(r(he,z,ae),r(je,z,ae),Pe(P.children||[],z,je,Q,le,fe,ye,we)):me>0&&me&64&&Me&&x.dynamicChildren&&x.dynamicChildren.length===Me.length?(ve(x.dynamicChildren,Me,z,Q,le,fe,ye),(P.key!=null||Q&&P===Q.subTree)&&Dc(x,P,!0)):Se(x,P,z,je,Q,le,fe,ye,we)},ke=(x,P,z,ae,Q,le,fe,ye,we)=>{P.slotScopeIds=ye,x==null?P.shapeFlag&512?Q.ctx.activate(P,z,ae,fe,we):De(P,z,ae,Q,le,fe,we):Be(x,P,we)},De=(x,P,z,ae,Q,le,fe)=>{const ye=x.component=Wy(x,ae,Q);if($i(x)&&(ye.ctx.renderer=Fe),zy(ye,!1,fe),ye.asyncDep){if(Q&&Q.registerDep(ye,Ke,fe),!x.el){const we=ye.subTree=Oe(Jn);D(null,we,P,z),x.placeholder=we.el}}else Ke(ye,x,P,z,Q,le,fe)},Be=(x,P,z)=>{const ae=P.component=x.component;if(xy(x,P,z))if(ae.asyncDep&&!ae.asyncResolved){Le(ae,P,z);return}else ae.next=P,ae.update();else P.el=x.el,ae.vnode=P},Ke=(x,P,z,ae,Q,le,fe)=>{const ye=()=>{if(x.isMounted){let{next:me,bu:Me,u:Ie,parent:at,vnode:dt}=x;{const U=Mp(x);if(U){me&&(me.el=dt.el,Le(x,me,fe)),U.asyncDep.then(()=>{ur(()=>{x.isUnmounted||he()},Q)});return}}let lt=me,gt;Ha(x,!1),me?(me.el=dt.el,Le(x,me,fe)):me=dt,Me&&dl(Me),(gt=me.props&&me.props.onVnodeBeforeUpdate)&&Ro(gt,at,me,dt),Ha(x,!0);const kt=Fd(x),q=x.subTree;x.subTree=kt,H(q,kt,g(q.el),ee(q),x,Q,le),me.el=kt.el,lt===null&&Ay(x,kt.el),Ie&&ur(Ie,Q),(gt=me.props&&me.props.onVnodeUpdated)&&ur(()=>Ro(gt,at,me,dt),Q)}else{let me;const{el:Me,props:Ie}=P,{bm:at,m:dt,parent:lt,root:gt,type:kt}=x,q=Is(P);Ha(x,!1),at&&dl(at),!q&&(me=Ie&&Ie.onVnodeBeforeMount)&&Ro(me,lt,P),Ha(x,!0);{gt.ce&>.ce._hasShadowRoot()&>.ce._injectChildStyle(kt,x.parent?x.parent.type:void 0);const U=x.subTree=Fd(x);H(null,U,z,ae,x,Q,le),P.el=U.el}if(dt&&ur(dt,Q),!q&&(me=Ie&&Ie.onVnodeMounted)){const U=P;ur(()=>Ro(me,lt,U),Q)}(P.shapeFlag&256||lt&&Is(lt.vnode)&<.vnode.shapeFlag&256)&&x.a&&ur(x.a,Q),x.isMounted=!0,P=z=ae=null}};x.scope.on();const we=x.effect=new Fh(ye);x.scope.off();const he=x.update=we.run.bind(we),je=x.job=we.runIfDirty.bind(we);je.i=x,je.id=x.uid,we.scheduler=()=>$c(je),Ha(x,!0),he()},Le=(x,P,z)=>{P.component=x;const ae=x.vnode.props;x.vnode=P,x.next=null,Iy(x,P.props,ae,z),$y(x,P.children,z),aa(),Ad(x),sa()},Se=(x,P,z,ae,Q,le,fe,ye,we=!1)=>{const he=x&&x.children,je=x?x.shapeFlag:0,me=P.children,{patchFlag:Me,shapeFlag:Ie}=P;if(Me>0){if(Me&128){tt(he,me,z,ae,Q,le,fe,ye,we);return}else if(Me&256){Qe(he,me,z,ae,Q,le,fe,ye,we);return}}Ie&8?(je&16&&Tt(he,Q,le),me!==he&&f(z,me)):je&16?Ie&16?tt(he,me,z,ae,Q,le,fe,ye,we):Tt(he,Q,le,!0):(je&8&&f(z,""),Ie&16&&Pe(me,z,ae,Q,le,fe,ye,we))},Qe=(x,P,z,ae,Q,le,fe,ye,we)=>{x=x||xs,P=P||xs;const he=x.length,je=P.length,me=Math.min(he,je);let Me;for(Me=0;Me<me;Me++){const Ie=P[Me]=we?ta(P[Me]):No(P[Me]);H(x[Me],Ie,z,null,Q,le,fe,ye,we)}he>je?Tt(x,Q,le,!0,!1,me):Pe(P,z,ae,Q,le,fe,ye,we,me)},tt=(x,P,z,ae,Q,le,fe,ye,we)=>{let he=0;const je=P.length;let me=x.length-1,Me=je-1;for(;he<=me&&he<=Me;){const Ie=x[he],at=P[he]=we?ta(P[he]):No(P[he]);if(Ka(Ie,at))H(Ie,at,z,null,Q,le,fe,ye,we);else break;he++}for(;he<=me&&he<=Me;){const Ie=x[me],at=P[Me]=we?ta(P[Me]):No(P[Me]);if(Ka(Ie,at))H(Ie,at,z,null,Q,le,fe,ye,we);else break;me--,Me--}if(he>me){if(he<=Me){const Ie=Me+1,at=Ie<je?P[Ie].el:ae;for(;he<=Me;)H(null,P[he]=we?ta(P[he]):No(P[he]),z,at,Q,le,fe,ye,we),he++}}else if(he>Me)for(;he<=me;)He(x[he],Q,le,!0),he++;else{const Ie=he,at=he,dt=new Map;for(he=at;he<=Me;he++){const Ce=P[he]=we?ta(P[he]):No(P[he]);Ce.key!=null&&dt.set(Ce.key,he)}let lt,gt=0;const kt=Me-at+1;let q=!1,U=0;const F=new Array(kt);for(he=0;he<kt;he++)F[he]=0;for(he=Ie;he<=me;he++){const Ce=x[he];if(gt>=kt){He(Ce,Q,le,!0);continue}let Ne;if(Ce.key!=null)Ne=dt.get(Ce.key);else for(lt=at;lt<=Me;lt++)if(F[lt-at]===0&&Ka(Ce,P[lt])){Ne=lt;break}Ne===void 0?He(Ce,Q,le,!0):(F[Ne-at]=he+1,Ne>=U?U=Ne:q=!0,H(Ce,P[Ne],z,null,Q,le,fe,ye,we),gt++)}const se=q?jy(F):xs;for(lt=se.length-1,he=kt-1;he>=0;he--){const Ce=at+he,Ne=P[Ce],ze=P[Ce+1],xt=Ce+1<je?ze.el||$p(ze):ae;F[he]===0?H(null,Ne,z,xt,Q,le,fe,ye,we):q&&(lt<0||he!==se[lt]?Ue(Ne,z,xt,2):lt--)}}},Ue=(x,P,z,ae,Q=null)=>{const{el:le,type:fe,transition:ye,children:we,shapeFlag:he}=x;if(he&6){Ue(x.component.subTree,P,z,ae);return}if(he&128){x.suspense.move(P,z,ae);return}if(he&64){fe.move(x,P,z,Fe);return}if(fe===Ye){r(le,P,z);for(let me=0;me<we.length;me++)Ue(we[me],P,z,ae);r(x.anchor,P,z);return}if(fe===_u){K(x,P,z);return}if(ae!==2&&he&1&&ye)if(ae===0)ye.beforeEnter(le),r(le,P,z),ur(()=>ye.enter(le),Q);else{const{leave:me,delayLeave:Me,afterLeave:Ie}=ye,at=()=>{x.ctx.isUnmounted?a(le):r(le,P,z)},dt=()=>{le._isLeaving&&le[Mo](!0),me(le,()=>{at(),Ie&&Ie()})};Me?Me(le,at,dt):dt()}else r(le,P,z)},He=(x,P,z,ae=!1,Q=!1)=>{const{type:le,props:fe,ref:ye,children:we,dynamicChildren:he,shapeFlag:je,patchFlag:me,dirs:Me,cacheIndex:Ie,memo:at}=x;if(me===-2&&(Q=!1),ye!=null&&(aa(),vi(ye,null,z,x,!0),sa()),Ie!=null&&(P.renderCache[Ie]=void 0),je&256){P.ctx.deactivate(x);return}const dt=je&1&&Me,lt=!Is(x);let gt;if(lt&&(gt=fe&&fe.onVnodeBeforeUnmount)&&Ro(gt,P,x),je&6)We(x.component,z,ae);else{if(je&128){x.suspense.unmount(z,ae);return}dt&&qa(x,null,P,"beforeUnmount"),je&64?x.type.remove(x,P,z,Fe,ae):he&&!he.hasOnce&&(le!==Ye||me>0&&me&64)?Tt(he,P,z,!1,!0):(le===Ye&&me&384||!Q&&je&16)&&Tt(we,P,z),ae&&ft(x)}const kt=at!=null&&Ie==null;(lt&&(gt=fe&&fe.onVnodeUnmounted)||dt||kt)&&ur(()=>{gt&&Ro(gt,P,x),dt&&qa(x,null,P,"unmounted"),kt&&(x.el=null)},z)},ft=x=>{const{type:P,el:z,anchor:ae,transition:Q}=x;if(P===Ye){Je(z,ae);return}if(P===_u){Z(x);return}const le=()=>{a(z),Q&&!Q.persisted&&Q.afterLeave&&Q.afterLeave()};if(x.shapeFlag&1&&Q&&!Q.persisted){const{leave:fe,delayLeave:ye}=Q,we=()=>fe(z,le);ye?ye(x.el,le,we):we()}else le()},Je=(x,P)=>{let z;for(;x!==P;)z=_(x),a(x),x=z;a(P)},We=(x,P,z)=>{const{bum:ae,scope:Q,job:le,subTree:fe,um:ye,m:we,a:he}=x;qd(we),qd(he),ae&&dl(ae),Q.stop(),le&&(le.flags|=8,He(fe,x,P,z)),ye&&ur(ye,P),ur(()=>{x.isUnmounted=!0},P)},Tt=(x,P,z,ae=!1,Q=!1,le=0)=>{for(let fe=le;fe<x.length;fe++)He(x[fe],P,z,ae,Q)},ee=x=>{if(x.shapeFlag&6)return ee(x.component.subTree);if(x.shapeFlag&128)return x.suspense.next();const P=_(x.anchor||x.el),z=P&&P[up];return z?_(z):P};let xe=!1;const Ae=(x,P,z)=>{let ae;x==null?P._vnode&&(He(P._vnode,null,null,!0),ae=P._vnode.component):H(P._vnode||null,x,P,null,null,null,z),P._vnode=x,xe||(xe=!0,Ad(ae),op(),xe=!1)},Fe={p:H,um:He,m:Ue,r:ft,mt:De,mc:Pe,pc:Se,pbc:ve,n:ee,o:e};return{render:Ae,hydrate:void 0,createApp:by(Ae)}}function bu({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 Ha({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Oy(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Dc(e,t,n=!1){const r=e.children,a=t.children;if(nt(r)&&nt(a))for(let o=0;o<r.length;o++){const s=r[o];let l=a[o];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=a[o]=ta(a[o]),l.el=s.el),!n&&l.patchFlag!==-2&&Dc(s,l)),l.type===Dl&&(l.patchFlag===-1&&(l=a[o]=ta(l)),l.el=s.el),l.type===Jn&&!l.el&&(l.el=s.el)}}function jy(e){const t=e.slice(),n=[0];let r,a,o,s,l;const c=e.length;for(r=0;r<c;r++){const h=e[r];if(h!==0){if(a=n[n.length-1],e[a]<h){t[r]=a,n.push(r);continue}for(o=0,s=n.length-1;o<s;)l=o+s>>1,e[n[l]]<h?o=l+1:s=l;h<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,s=n[o-1];o-- >0;)n[o]=s,s=t[s];return n}function Mp(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Mp(t)}function qd(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function $p(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?$p(t.subTree):null}const Np=e=>e.__isSuspense;function Dy(e,t){t&&t.pendingBranch?nt(e)?t.effects.push(...e):t.effects.push(e):qg(e)}const Ye=Symbol.for("v-fgt"),Dl=Symbol.for("v-txt"),Jn=Symbol.for("v-cmt"),_u=Symbol.for("v-stc"),yi=[];let fr=null;function k(e=!1){yi.push(fr=e?null:[])}function Fy(){yi.pop(),fr=yi[yi.length-1]||null}let Ls=1;function _l(e,t=!1){Ls+=e,e<0&&fr&&t&&(fr.hasOnce=!0)}function Lp(e){return e.dynamicChildren=Ls>0?fr||xs:null,Fy(),Ls>0&&fr&&fr.push(e),e}function R(e,t,n,r,a,o){return Lp(m(e,t,n,r,a,o,!0))}function Ze(e,t,n,r,a){return Lp(Oe(e,t,n,r,a,!0))}function xi(e){return e?e.__v_isVNode===!0:!1}function Ka(e,t){return e.type===t.type&&e.key===t.key}const Op=({key:e})=>e??null,hl=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Yt(e)||Xn(e)||ct(e)?{i:qn,r:e,k:t,f:!!n}:e:null);function m(e,t=null,n=null,r=0,a=null,o=e===Ye?0:1,s=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Op(t),ref:t&&hl(t),scopeId:sp,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:o,patchFlag:r,dynamicProps:a,dynamicChildren:null,appContext:null,ctx:qn};return l?(Fc(c,n),o&128&&e.normalize(c)):n&&(c.shapeFlag|=Yt(n)?8:16),Ls>0&&!s&&fr&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&&fr.push(c),c}const Oe=Uy;function Uy(e,t=null,n=null,r=0,a=null,o=!1){if((!e||e===gp)&&(e=Jn),xi(e)){const l=Ia(e,t,!0);return n&&Fc(l,n),Ls>0&&!o&&fr&&(l.shapeFlag&6?fr[fr.indexOf(e)]=l:fr.push(l)),l.patchFlag=-2,l}if(Yy(e)&&(e=e.__vccOpts),t){t=By(t);let{class:l,style:c}=t;l&&!Yt(l)&&(t.class=et(l)),Nt(c)&&(Mc(c)&&!nt(c)&&(c=En({},c)),t.style=oa(c))}const s=Yt(e)?1:Np(e)?128:cp(e)?64:Nt(e)?4:ct(e)?2:0;return m(e,t,n,r,a,s,o,!0)}function By(e){return e?Mc(e)||xp(e)?En({},e):e:null}function Ia(e,t,n=!1,r=!1){const{props:a,ref:o,patchFlag:s,children:l,transition:c}=e,h=t?jp(a||{},t):a,f={__v_isVNode:!0,__v_skip:!0,type:e.type,props:h,key:h&&Op(h),ref:t&&t.ref?n&&o?nt(o)?o.concat(hl(t)):[o,hl(t)]:hl(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Ye?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Ia(e.ssContent),ssFallback:e.ssFallback&&Ia(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&Si(f,c.clone(f)),f}function ns(e=" ",t=0){return Oe(Dl,null,e,t)}function J(e="",t=!1){return t?(k(),Ze(Jn,null,e)):Oe(Jn,null,e)}function No(e){return e==null||typeof e=="boolean"?Oe(Jn):nt(e)?Oe(Ye,null,e.slice()):xi(e)?ta(e):Oe(Dl,null,String(e))}function ta(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ia(e)}function Fc(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(nt(t))n=16;else if(typeof t=="object")if(r&65){const a=t.default;a&&(a._c&&(a._d=!1),Fc(e,a()),a._c&&(a._d=!0));return}else{n=32;const a=t._;!a&&!xp(t)?t._ctx=qn:a===3&&qn&&(qn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else ct(t)?(t={default:t,_ctx:qn},n=32):(t=String(t),r&64?(n=16,t=[ns(t)]):n=8);e.children=t,e.shapeFlag|=n}function jp(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const a in r)if(a==="class")t.class!==r.class&&(t.class=et([t.class,r.class]));else if(a==="style")t.style=oa([t.style,r.style]);else if(Al(a)){const o=t[a],s=r[a];s&&o!==s&&!(nt(o)&&o.includes(s))?t[a]=o?[].concat(o,s):s:s==null&&o==null&&!El(a)&&(t[a]=s)}else a!==""&&(t[a]=r[a])}return t}function Ro(e,t,n,r=null){go(e,t,7,[n,r])}const qy=_p();let Hy=0;function Wy(e,t,n){const r=e.type,a=(t?t.appContext:e.appContext)||qy,o={uid:Hy++,vnode:e,type:r,parent:t,appContext:a,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new fg(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(a.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Ep(r,a),emitsOptions:Tp(r,a),emit:null,emitted:null,propsDefaults:Ut,inheritAttrs:r.inheritAttrs,ctx:Ut,data:Ut,props:Ut,attrs:Ut,slots:Ut,refs:Ut,setupState:Ut,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 o.ctx={_:o},o.root=t?t.root:o,o.emit=Ty.bind(null,o),e.ce&&e.ce(o),o}let Bn=null;const Uc=()=>Bn||qn;let Tl,rc;{const e=Ml(),t=(n,r)=>{let a;return(a=e[n])||(a=e[n]=[]),a.push(r),o=>{a.length>1?a.forEach(s=>s(o)):a[0](o)}};Tl=t("__VUE_INSTANCE_SETTERS__",n=>Bn=n),rc=t("__VUE_SSR_SETTERS__",n=>Os=n)}const Ni=e=>{const t=Bn;return Tl(e),e.scope.on(),()=>{e.scope.off(),Tl(t)}},Hd=()=>{Bn&&Bn.scope.off(),Tl(null)};function Dp(e){return e.vnode.shapeFlag&4}let Os=!1;function zy(e,t=!1,n=!1){t&&rc(t);const{props:r,children:a}=e.vnode,o=Dp(e);Ey(e,r,o,t),My(e,a,n||t);const s=o?Vy(e,t):void 0;return t&&rc(!1),s}function Vy(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,dy);const{setup:r}=n;if(r){aa();const a=e.setupContext=r.length>1?Up(e):null,o=Ni(e),s=Pi(r,e,0,[e.props,a]),l=Ph(s);if(sa(),o(),(l||e.sp)&&!Is(e)&&Nc(e),l){if(s.then(Hd,Hd),t)return s.then(c=>{Wd(e,c)}).catch(c=>{Mi(c,e,0)});e.asyncDep=s}else Wd(e,s)}else Fp(e)}function Wd(e,t,n){ct(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Nt(t)&&(e.setupState=tp(t)),Fp(e)}function Fp(e,t,n){const r=e.type;e.render||(e.render=r.render||Oo);{const a=Ni(e);aa();try{py(e)}finally{sa(),a()}}}const Gy={get(e,t){return Qn(e,"get",""),e[t]}};function Up(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Gy),slots:e.slots,emit:e.emit,expose:t}}function Fl(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(tp(Mg(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in gi)return gi[n](e)},has(t,n){return n in t||n in gi}})):e.proxy}function Ky(e,t=!0){return ct(e)?e.displayName||e.name:e.name||t&&e.__name}function Yy(e){return ct(e)&&"__vccOpts"in e}const ne=(e,t)=>jg(e,t,Os);function Bc(e,t,n){try{_l(-1);const r=arguments.length;return r===2?Nt(t)&&!nt(t)?xi(t)?Oe(e,null,[t]):Oe(e,t):Oe(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&xi(n)&&(n=[n]),Oe(e,t,n))}finally{_l(1)}}function SM(e,t,n,r){const a=n[r];if(a&&Qy(a,e))return a;const o=t();return o.memo=e.slice(),o.cacheIndex=r,n[r]=o}function Qy(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(co(n[r],t[r]))return!1;return Ls>0&&fr&&fr.push(e),!0}const Jy="3.5.34";/**
|
|
15
|
-
* @vue/runtime-dom v3.5.34
|
|
16
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
|
-
* @license MIT
|
|
18
|
-
**/let oc;const zd=typeof window<"u"&&window.trustedTypes;if(zd)try{oc=zd.createPolicy("vue",{createHTML:e=>e})}catch{}const Bp=oc?e=>oc.createHTML(e):e=>e,Xy="http://www.w3.org/2000/svg",Zy="http://www.w3.org/1998/Math/MathML",ea=typeof document<"u"?document:null,Vd=ea&&ea.createElement("template"),ew={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 a=t==="svg"?ea.createElementNS(Xy,e):t==="mathml"?ea.createElementNS(Zy,e):n?ea.createElement(e,{is:n}):ea.createElement(e);return e==="select"&&r&&r.multiple!=null&&a.setAttribute("multiple",r.multiple),a},createText:e=>ea.createTextNode(e),createComment:e=>ea.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>ea.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,a,o){const s=n?n.previousSibling:t.lastChild;if(a&&(a===o||a.nextSibling))for(;t.insertBefore(a.cloneNode(!0),n),!(a===o||!(a=a.nextSibling)););else{Vd.innerHTML=Bp(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const l=Vd.content;if(r==="svg"||r==="mathml"){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}t.insertBefore(l,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},_a="transition",ai="animation",Ai=Symbol("_vtc"),qp={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},tw=En({},dp,qp),nw=e=>(e.displayName="Transition",e.props=tw,e),Hp=nw((e,{slots:t})=>Bc(Jg,rw(e),t)),Wa=(e,t=[])=>{nt(e)?e.forEach(n=>n(...t)):e&&e(...t)},Gd=e=>e?nt(e)?e.some(t=>t.length>1):e.length>1:!1;function rw(e){const t={};for(const oe in e)oe in qp||(t[oe]=e[oe]);if(e.css===!1)return t;const{name:n="v",type:r,duration:a,enterFromClass:o=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:c=o,appearActiveClass:h=s,appearToClass:f=l,leaveFromClass:g=`${n}-leave-from`,leaveActiveClass:_=`${n}-leave-active`,leaveToClass:E=`${n}-leave-to`}=e,O=ow(a),H=O&&O[0],X=O&&O[1],{onBeforeEnter:D,onEnter:j,onEnterCancelled:K,onLeave:Z,onLeaveCancelled:be,onBeforeAppear:pe=D,onAppear:de=j,onAppearCancelled:Pe=K}=t,G=(oe,ke,De,Be)=>{oe._enterCancelled=Be,za(oe,ke?f:l),za(oe,ke?h:s),De&&De()},ve=(oe,ke)=>{oe._isLeaving=!1,za(oe,g),za(oe,E),za(oe,_),ke&&ke()},Te=oe=>(ke,De)=>{const Be=oe?de:j,Ke=()=>G(ke,oe,De);Wa(Be,[ke,Ke]),Kd(()=>{za(ke,oe?c:o),Xo(ke,oe?f:l),Gd(Be)||Yd(ke,r,H,Ke)})};return En(t,{onBeforeEnter(oe){Wa(D,[oe]),Xo(oe,o),Xo(oe,s)},onBeforeAppear(oe){Wa(pe,[oe]),Xo(oe,c),Xo(oe,h)},onEnter:Te(!1),onAppear:Te(!0),onLeave(oe,ke){oe._isLeaving=!0;const De=()=>ve(oe,ke);Xo(oe,g),oe._enterCancelled?(Xo(oe,_),Xd(oe)):(Xd(oe),Xo(oe,_)),Kd(()=>{oe._isLeaving&&(za(oe,g),Xo(oe,E),Gd(Z)||Yd(oe,r,X,De))}),Wa(Z,[oe,De])},onEnterCancelled(oe){G(oe,!1,void 0,!0),Wa(K,[oe])},onAppearCancelled(oe){G(oe,!0,void 0,!0),Wa(Pe,[oe])},onLeaveCancelled(oe){ve(oe),Wa(be,[oe])}})}function ow(e){if(e==null)return null;if(Nt(e))return[Tu(e.enter),Tu(e.leave)];{const t=Tu(e);return[t,t]}}function Tu(e){return og(e)}function Xo(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Ai]||(e[Ai]=new Set)).add(t)}function za(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Ai];n&&(n.delete(t),n.size||(e[Ai]=void 0))}function Kd(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let aw=0;function Yd(e,t,n,r){const a=e._endId=++aw,o=()=>{a===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:s,timeout:l,propCount:c}=sw(e,t);if(!s)return r();const h=s+"end";let f=0;const g=()=>{e.removeEventListener(h,_),o()},_=E=>{E.target===e&&++f>=c&&g()};setTimeout(()=>{f<c&&g()},l+1),e.addEventListener(h,_)}function sw(e,t){const n=window.getComputedStyle(e),r=O=>(n[O]||"").split(", "),a=r(`${_a}Delay`),o=r(`${_a}Duration`),s=Qd(a,o),l=r(`${ai}Delay`),c=r(`${ai}Duration`),h=Qd(l,c);let f=null,g=0,_=0;t===_a?s>0&&(f=_a,g=s,_=o.length):t===ai?h>0&&(f=ai,g=h,_=c.length):(g=Math.max(s,h),f=g>0?s>h?_a:ai:null,_=f?f===_a?o.length:c.length:0);const E=f===_a&&/\b(?:transform|all)(?:,|$)/.test(r(`${_a}Property`).toString());return{type:f,timeout:g,propCount:_,hasTransform:E}}function Qd(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Jd(n)+Jd(e[r])))}function Jd(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Xd(e){return(e?e.ownerDocument:document).body.offsetHeight}function iw(e,t,n){const r=e[Ai];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Zd=Symbol("_vod"),lw=Symbol("_vsh"),uw=Symbol(""),cw=/(?:^|;)\s*display\s*:/;function dw(e,t,n){const r=e.style,a=Yt(n);let o=!1;if(n&&!a){if(t)if(Yt(t))for(const s of t.split(";")){const l=s.slice(0,s.indexOf(":")).trim();n[l]==null&&ci(r,l,"")}else for(const s in t)n[s]==null&&ci(r,s,"");for(const s in n){s==="display"&&(o=!0);const l=n[s];l!=null?hw(e,s,!Yt(t)&&t?t[s]:void 0,l)||ci(r,s,l):ci(r,s,"")}}else if(a){if(t!==n){const s=r[uw];s&&(n+=";"+s),r.cssText=n,o=cw.test(n)}}else t&&e.removeAttribute("style");Zd in e&&(e[Zd]=o?r.display:"",e[lw]&&(r.display="none"))}const ef=/\s*!important$/;function ci(e,t,n){if(nt(n))n.forEach(r=>ci(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=fw(e,t);ef.test(n)?e.setProperty(Ra(r),n.replace(ef,""),"important"):e[r]=n}}const tf=["Webkit","Moz","ms"],ku={};function fw(e,t){const n=ku[t];if(n)return n;let r=hr(t);if(r!=="filter"&&r in e)return ku[t]=r;r=Pl(r);for(let a=0;a<tf.length;a++){const o=tf[a]+r;if(o in e)return ku[t]=o}return t}function hw(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Yt(r)&&n===r}const nf="http://www.w3.org/1999/xlink";function rf(e,t,n,r,a,o=cg(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(nf,t.slice(6,t.length)):e.setAttributeNS(nf,t,n):n==null||o&&!Lh(n)?e.removeAttribute(t):e.setAttribute(t,o?"":mo(n)?String(n):n)}function of(e,t,n,r,a){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Bp(n):n);return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){const l=o==="OPTION"?e.getAttribute("value")||"":e.value,c=n==null?e.type==="checkbox"?"on":"":String(n);(l!==c||!("_value"in e))&&(e.value=c),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=Lh(n):n==null&&l==="string"?(n="",s=!0):l==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(a||t)}function Ya(e,t,n,r){e.addEventListener(t,n,r)}function pw(e,t,n,r){e.removeEventListener(t,n,r)}const af=Symbol("_vei");function mw(e,t,n,r,a=null){const o=e[af]||(e[af]={}),s=o[t];if(r&&s)s.value=r;else{const[l,c]=vw(t);if(r){const h=o[t]=ww(r,a);Ya(e,l,h,c)}else s&&(pw(e,l,s,c),o[t]=void 0)}}const sf=/(?:Once|Passive|Capture)$/;function vw(e){let t;if(sf.test(e)){t={};let r;for(;r=e.match(sf);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Ra(e.slice(2)),t]}let Cu=0;const gw=Promise.resolve(),yw=()=>Cu||(gw.then(()=>Cu=0),Cu=Date.now());function ww(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;go(bw(r,n.value),t,5,[r])};return n.value=e,n.attached=yw(),n}function bw(e,t){if(nt(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>a=>!a._stopped&&r&&r(a))}else return t}const lf=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,_w=(e,t,n,r,a,o)=>{const s=a==="svg";t==="class"?iw(e,r,s):t==="style"?dw(e,n,r):Al(t)?El(t)||mw(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Tw(e,t,r,s))?(of(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&rf(e,t,r,s,o,t!=="value")):e._isVueCE&&(kw(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Yt(r)))?of(e,hr(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),rf(e,t,r,s))};function Tw(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&lf(t)&&ct(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 a=e.tagName;if(a==="IMG"||a==="VIDEO"||a==="CANVAS"||a==="SOURCE")return!1}return lf(t)&&Yt(n)?!1:t in e}function kw(e,t){const n=e._def.props;if(!n)return!1;const r=hr(t);return Array.isArray(n)?n.some(a=>hr(a)===r):Object.keys(n).some(a=>hr(a)===r)}const kl=e=>{const t=e.props["onUpdate:modelValue"]||!1;return nt(t)?n=>dl(t,n):t};function Cw(e){e.target.composing=!0}function uf(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Ps=Symbol("_assign");function cf(e,t,n){return t&&(e=e.trim()),n&&(e=Sc(e)),e}const un={created(e,{modifiers:{lazy:t,trim:n,number:r}},a){e[Ps]=kl(a);const o=r||a.props&&a.props.type==="number";Ya(e,t?"change":"input",s=>{s.target.composing||e[Ps](cf(e.value,n,o))}),(n||o)&&Ya(e,"change",()=>{e.value=cf(e.value,n,o)}),t||(Ya(e,"compositionstart",Cw),Ya(e,"compositionend",uf),Ya(e,"change",uf))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:a,number:o}},s){if(e[Ps]=kl(s),e.composing)return;const l=(o||e.type==="number")&&!/^0\d/.test(e.value)?Sc(e.value):e.value,c=t??"";if(l===c)return;const h=e.getRootNode();(h instanceof Document||h instanceof ShadowRoot)&&h.activeElement===e&&e.type!=="range"&&(r&&t===n||a&&e.value.trim()===c)||(e.value=c)}},Sw={deep:!0,created(e,t,n){e[Ps]=kl(n),Ya(e,"change",()=>{const r=e._modelValue,a=xw(e),o=e.checked,s=e[Ps];if(nt(r)){const l=Oh(r,a),c=l!==-1;if(o&&!c)s(r.concat(a));else if(!o&&c){const h=[...r];h.splice(l,1),s(h)}}else if(Il(r)){const l=new Set(r);o?l.add(a):l.delete(a),s(l)}else s(Wp(e,o))})},mounted:df,beforeUpdate(e,t,n){e[Ps]=kl(n),df(e,t,n)}};function df(e,{value:t,oldValue:n},r){e._modelValue=t;let a;if(nt(t))a=Oh(t,r.props.value)>-1;else if(Il(t))a=t.has(r.props.value);else{if(t===n)return;a=Ri(t,Wp(e,!0))}e.checked!==a&&(e.checked=a)}function xw(e){return"_value"in e?e._value:e.value}function Wp(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Aw=["ctrl","shift","alt","meta"],Ew={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)=>Aw.some(n=>e[`${n}Key`]&&!t.includes(n))},Xe=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((a,...o)=>{for(let s=0;s<t.length;s++){const l=Ew[t[s]];if(l&&l(a,t))return}return e(a,...o)}))},Iw={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},mn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(a=>{if(!("key"in a))return;const o=Ra(a.key);if(t.some(s=>s===o||Iw[s]===o))return e(a)}))},Rw=En({patchProp:_w},ew);let ff;function Pw(){return ff||(ff=Ny(Rw))}const Mw=((...e)=>{const t=Pw().createApp(...e),{mount:n}=t;return t.mount=r=>{const a=Nw(r);if(!a)return;const o=t._component;!ct(o)&&!o.render&&!o.template&&(o.template=a.innerHTML),a.nodeType===1&&(a.textContent="");const s=n(a,!1,$w(a));return a instanceof Element&&(a.removeAttribute("v-cloak"),a.setAttribute("data-v-app","")),s},t});function $w(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Nw(e){return Yt(e)?document.querySelector(e):e}const Lw="modulepreload",Ow=function(e){return"/"+e},hf={},nl=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let s=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=s(n.map(h=>{if(h=Ow(h),h in hf)return;hf[h]=!0;const f=h.endsWith(".css"),g=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const _=document.createElement("link");if(_.rel=f?"stylesheet":Lw,f||(_.as="script"),_.crossOrigin="",_.href=h,c&&_.setAttribute("nonce",c),document.head.appendChild(_),f)return new Promise((E,O)=>{_.addEventListener("load",E),_.addEventListener("error",()=>O(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return a.then(s=>{for(const l of s||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})};/*!
|
|
19
|
-
* vue-router v4.6.4
|
|
20
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
21
|
-
* @license MIT
|
|
22
|
-
*/const bs=typeof document<"u";function zp(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function jw(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&zp(e.default)}const Mt=Object.assign;function Su(e,t){const n={};for(const r in t){const a=t[r];n[r]=yo(a)?a.map(e):e(a)}return n}const wi=()=>{},yo=Array.isArray;function pf(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Vp=/#/g,Dw=/&/g,Fw=/\//g,Uw=/=/g,Bw=/\?/g,Gp=/\+/g,qw=/%5B/g,Hw=/%5D/g,Kp=/%5E/g,Ww=/%60/g,Yp=/%7B/g,zw=/%7C/g,Qp=/%7D/g,Vw=/%20/g;function qc(e){return e==null?"":encodeURI(""+e).replace(zw,"|").replace(qw,"[").replace(Hw,"]")}function Gw(e){return qc(e).replace(Yp,"{").replace(Qp,"}").replace(Kp,"^")}function ac(e){return qc(e).replace(Gp,"%2B").replace(Vw,"+").replace(Vp,"%23").replace(Dw,"%26").replace(Ww,"`").replace(Yp,"{").replace(Qp,"}").replace(Kp,"^")}function Kw(e){return ac(e).replace(Uw,"%3D")}function Yw(e){return qc(e).replace(Vp,"%23").replace(Bw,"%3F")}function Qw(e){return Yw(e).replace(Fw,"%2F")}function Ei(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Jw=/\/$/,Xw=e=>e.replace(Jw,"");function xu(e,t,n="/"){let r,a={},o="",s="";const l=t.indexOf("#");let c=t.indexOf("?");return c=l>=0&&c>l?-1:c,c>=0&&(r=t.slice(0,c),o=t.slice(c,l>0?l:t.length),a=e(o.slice(1))),l>=0&&(r=r||t.slice(0,l),s=t.slice(l,t.length)),r=nb(r??t,n),{fullPath:r+o+s,path:r,query:a,hash:Ei(s)}}function Zw(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function mf(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function eb(e,t,n){const r=t.matched.length-1,a=n.matched.length-1;return r>-1&&r===a&&js(t.matched[r],n.matched[a])&&Jp(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function js(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Jp(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!tb(e[n],t[n]))return!1;return!0}function tb(e,t){return yo(e)?vf(e,t):yo(t)?vf(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function vf(e,t){return yo(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function nb(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),a=r[r.length-1];(a===".."||a===".")&&r.push("");let o=n.length-1,s,l;for(s=0;s<r.length;s++)if(l=r[s],l!==".")if(l==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(s).join("/")}const Ta={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let sc=(function(e){return e.pop="pop",e.push="push",e})({}),Au=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function rb(e){if(!e)if(bs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Xw(e)}const ob=/^[^#]+#/;function ab(e,t){return e.replace(ob,"#")+t}function sb(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 Ul=()=>({left:window.scrollX,top:window.scrollY});function ib(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),a=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!a)return;t=sb(a,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 gf(e,t){return(history.state?history.state.position-t:-1)+e}const ic=new Map;function lb(e,t){ic.set(e,t)}function ub(e){const t=ic.get(e);return ic.delete(e),t}function cb(e){return typeof e=="string"||e&&typeof e=="object"}function Xp(e){return typeof e=="string"||typeof e=="symbol"}let ln=(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 Zp=Symbol("");ln.MATCHER_NOT_FOUND+"",ln.NAVIGATION_GUARD_REDIRECT+"",ln.NAVIGATION_ABORTED+"",ln.NAVIGATION_CANCELLED+"",ln.NAVIGATION_DUPLICATED+"";function Ds(e,t){return Mt(new Error,{type:e,[Zp]:!0},t)}function Zo(e,t){return e instanceof Error&&Zp in e&&(t==null||!!(e.type&t))}const db=["params","query","hash"];function fb(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of db)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function hb(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 a=n[r].replace(Gp," "),o=a.indexOf("="),s=Ei(o<0?a:a.slice(0,o)),l=o<0?null:Ei(a.slice(o+1));if(s in t){let c=t[s];yo(c)||(c=t[s]=[c]),c.push(l)}else t[s]=l}return t}function yf(e){let t="";for(let n in e){const r=e[n];if(n=Kw(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(yo(r)?r.map(a=>a&&ac(a)):[r&&ac(r)]).forEach(a=>{a!==void 0&&(t+=(t.length?"&":"")+n,a!=null&&(t+="="+a))})}return t}function pb(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=yo(r)?r.map(a=>a==null?null:""+a):r==null?r:""+r)}return t}const mb=Symbol(""),wf=Symbol(""),Bl=Symbol(""),Hc=Symbol(""),lc=Symbol("");function si(){let e=[];function t(r){return e.push(r),()=>{const a=e.indexOf(r);a>-1&&e.splice(a,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function xa(e,t,n,r,a,o=s=>s()){const s=r&&(r.enterCallbacks[a]=r.enterCallbacks[a]||[]);return()=>new Promise((l,c)=>{const h=_=>{_===!1?c(Ds(ln.NAVIGATION_ABORTED,{from:n,to:t})):_ instanceof Error?c(_):cb(_)?c(Ds(ln.NAVIGATION_GUARD_REDIRECT,{from:t,to:_})):(s&&r.enterCallbacks[a]===s&&typeof _=="function"&&s.push(_),l())},f=o(()=>e.call(r&&r.instances[a],t,n,h));let g=Promise.resolve(f);e.length<3&&(g=g.then(h)),g.catch(_=>c(_))})}function Eu(e,t,n,r,a=o=>o()){const o=[];for(const s of e)for(const l in s.components){let c=s.components[l];if(!(t!=="beforeRouteEnter"&&!s.instances[l]))if(zp(c)){const h=(c.__vccOpts||c)[t];h&&o.push(xa(h,n,r,s,l,a))}else{let h=c();o.push(()=>h.then(f=>{if(!f)throw new Error(`Couldn't resolve component "${l}" at "${s.path}"`);const g=jw(f)?f.default:f;s.mods[l]=f,s.components[l]=g;const _=(g.__vccOpts||g)[t];return _&&xa(_,n,r,s,l,a)()}))}}return o}function vb(e,t){const n=[],r=[],a=[],o=Math.max(t.matched.length,e.matched.length);for(let s=0;s<o;s++){const l=t.matched[s];l&&(e.matched.find(h=>js(h,l))?r.push(l):n.push(l));const c=e.matched[s];c&&(t.matched.find(h=>js(h,c))||a.push(c))}return[n,r,a]}/*!
|
|
23
|
-
* vue-router v4.6.4
|
|
24
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
-
* @license MIT
|
|
26
|
-
*/let gb=()=>location.protocol+"//"+location.host;function em(e,t){const{pathname:n,search:r,hash:a}=t,o=e.indexOf("#");if(o>-1){let s=a.includes(e.slice(o))?e.slice(o).length:1,l=a.slice(s);return l[0]!=="/"&&(l="/"+l),mf(l,"")}return mf(n,e)+r+a}function yb(e,t,n,r){let a=[],o=[],s=null;const l=({state:_})=>{const E=em(e,location),O=n.value,H=t.value;let X=0;if(_){if(n.value=E,t.value=_,s&&s===O){s=null;return}X=H?_.position-H.position:0}else r(E);a.forEach(D=>{D(n.value,O,{delta:X,type:sc.pop,direction:X?X>0?Au.forward:Au.back:Au.unknown})})};function c(){s=n.value}function h(_){a.push(_);const E=()=>{const O=a.indexOf(_);O>-1&&a.splice(O,1)};return o.push(E),E}function f(){if(document.visibilityState==="hidden"){const{history:_}=window;if(!_.state)return;_.replaceState(Mt({},_.state,{scroll:Ul()}),"")}}function g(){for(const _ of o)_();o=[],window.removeEventListener("popstate",l),window.removeEventListener("pagehide",f),document.removeEventListener("visibilitychange",f)}return window.addEventListener("popstate",l),window.addEventListener("pagehide",f),document.addEventListener("visibilitychange",f),{pauseListeners:c,listen:h,destroy:g}}function bf(e,t,n,r=!1,a=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:a?Ul():null}}function wb(e){const{history:t,location:n}=window,r={value:em(e,n)},a={value:t.state};a.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(c,h,f){const g=e.indexOf("#"),_=g>-1?(n.host&&document.querySelector("base")?e:e.slice(g))+c:gb()+e+c;try{t[f?"replaceState":"pushState"](h,"",_),a.value=h}catch(E){console.error(E),n[f?"replace":"assign"](_)}}function s(c,h){o(c,Mt({},t.state,bf(a.value.back,c,a.value.forward,!0),h,{position:a.value.position}),!0),r.value=c}function l(c,h){const f=Mt({},a.value,t.state,{forward:c,scroll:Ul()});o(f.current,f,!0),o(c,Mt({},bf(r.value,c,null),{position:f.position+1},h),!1),r.value=c}return{location:r,state:a,push:l,replace:s}}function bb(e){e=rb(e);const t=wb(e),n=yb(e,t.state,t.location,t.replace);function r(o,s=!0){s||n.pauseListeners(),history.go(o)}const a=Mt({location:"",base:e,go:r,createHref:ab.bind(null,e)},t,n);return Object.defineProperty(a,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(a,"state",{enumerable:!0,get:()=>t.state.value}),a}function _b(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),bb(e)}let Ja=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var xn=(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})(xn||{});const Tb={type:Ja.Static,value:""},kb=/[a-zA-Z0-9_]/;function Cb(e){if(!e)return[[]];if(e==="/")return[[Tb]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(E){throw new Error(`ERR (${n})/"${h}": ${E}`)}let n=xn.Static,r=n;const a=[];let o;function s(){o&&a.push(o),o=[]}let l=0,c,h="",f="";function g(){h&&(n===xn.Static?o.push({type:Ja.Static,value:h}):n===xn.Param||n===xn.ParamRegExp||n===xn.ParamRegExpEnd?(o.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${h}) must be alone in its segment. eg: '/:ids+.`),o.push({type:Ja.Param,value:h,regexp:f,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),h="")}function _(){h+=c}for(;l<e.length;){if(c=e[l++],c==="\\"&&n!==xn.ParamRegExp){r=n,n=xn.EscapeNext;continue}switch(n){case xn.Static:c==="/"?(h&&g(),s()):c===":"?(g(),n=xn.Param):_();break;case xn.EscapeNext:_(),n=r;break;case xn.Param:c==="("?n=xn.ParamRegExp:kb.test(c)?_():(g(),n=xn.Static,c!=="*"&&c!=="?"&&c!=="+"&&l--);break;case xn.ParamRegExp:c===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+c:n=xn.ParamRegExpEnd:f+=c;break;case xn.ParamRegExpEnd:g(),n=xn.Static,c!=="*"&&c!=="?"&&c!=="+"&&l--,f="";break;default:t("Unknown state");break}}return n===xn.ParamRegExp&&t(`Unfinished custom RegExp for param "${h}"`),g(),s(),a}const _f="[^/]+?",Sb={sensitive:!1,strict:!1,start:!0,end:!0};var cr=(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})(cr||{});const xb=/[.+*?^${}()[\]/\\]/g;function Ab(e,t){const n=Mt({},Sb,t),r=[];let a=n.start?"^":"";const o=[];for(const h of e){const f=h.length?[]:[cr.Root];n.strict&&!h.length&&(a+="/");for(let g=0;g<h.length;g++){const _=h[g];let E=cr.Segment+(n.sensitive?cr.BonusCaseSensitive:0);if(_.type===Ja.Static)g||(a+="/"),a+=_.value.replace(xb,"\\$&"),E+=cr.Static;else if(_.type===Ja.Param){const{value:O,repeatable:H,optional:X,regexp:D}=_;o.push({name:O,repeatable:H,optional:X});const j=D||_f;if(j!==_f){E+=cr.BonusCustomRegExp;try{`${j}`}catch(Z){throw new Error(`Invalid custom RegExp for param "${O}" (${j}): `+Z.message)}}let K=H?`((?:${j})(?:/(?:${j}))*)`:`(${j})`;g||(K=X&&h.length<2?`(?:/${K})`:"/"+K),X&&(K+="?"),a+=K,E+=cr.Dynamic,X&&(E+=cr.BonusOptional),H&&(E+=cr.BonusRepeatable),j===".*"&&(E+=cr.BonusWildcard)}f.push(E)}r.push(f)}if(n.strict&&n.end){const h=r.length-1;r[h][r[h].length-1]+=cr.BonusStrict}n.strict||(a+="/?"),n.end?a+="$":n.strict&&!a.endsWith("/")&&(a+="(?:/|$)");const s=new RegExp(a,n.sensitive?"":"i");function l(h){const f=h.match(s),g={};if(!f)return null;for(let _=1;_<f.length;_++){const E=f[_]||"",O=o[_-1];g[O.name]=E&&O.repeatable?E.split("/"):E}return g}function c(h){let f="",g=!1;for(const _ of e){(!g||!f.endsWith("/"))&&(f+="/"),g=!1;for(const E of _)if(E.type===Ja.Static)f+=E.value;else if(E.type===Ja.Param){const{value:O,repeatable:H,optional:X}=E,D=O in h?h[O]:"";if(yo(D)&&!H)throw new Error(`Provided param "${O}" is an array but it is not repeatable (* or + modifiers)`);const j=yo(D)?D.join("/"):D;if(!j)if(X)_.length<2&&(f.endsWith("/")?f=f.slice(0,-1):g=!0);else throw new Error(`Missing required param "${O}"`);f+=j}}return f||"/"}return{re:s,score:r,keys:o,parse:l,stringify:c}}function Eb(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]===cr.Static+cr.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===cr.Static+cr.Segment?1:-1:0}function tm(e,t){let n=0;const r=e.score,a=t.score;for(;n<r.length&&n<a.length;){const o=Eb(r[n],a[n]);if(o)return o;n++}if(Math.abs(a.length-r.length)===1){if(Tf(r))return 1;if(Tf(a))return-1}return a.length-r.length}function Tf(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Ib={strict:!1,end:!0,sensitive:!1};function Rb(e,t,n){const r=Ab(Cb(e.path),n),a=Mt(r,{record:e,parent:t,children:[],alias:[]});return t&&!a.record.aliasOf==!t.record.aliasOf&&t.children.push(a),a}function Pb(e,t){const n=[],r=new Map;t=pf(Ib,t);function a(g){return r.get(g)}function o(g,_,E){const O=!E,H=Cf(g);H.aliasOf=E&&E.record;const X=pf(t,g),D=[H];if("alias"in g){const Z=typeof g.alias=="string"?[g.alias]:g.alias;for(const be of Z)D.push(Cf(Mt({},H,{components:E?E.record.components:H.components,path:be,aliasOf:E?E.record:H})))}let j,K;for(const Z of D){const{path:be}=Z;if(_&&be[0]!=="/"){const pe=_.record.path,de=pe[pe.length-1]==="/"?"":"/";Z.path=_.record.path+(be&&de+be)}if(j=Rb(Z,_,X),E?E.alias.push(j):(K=K||j,K!==j&&K.alias.push(j),O&&g.name&&!Sf(j)&&s(g.name)),nm(j)&&c(j),H.children){const pe=H.children;for(let de=0;de<pe.length;de++)o(pe[de],j,E&&E.children[de])}E=E||j}return K?()=>{s(K)}:wi}function s(g){if(Xp(g)){const _=r.get(g);_&&(r.delete(g),n.splice(n.indexOf(_),1),_.children.forEach(s),_.alias.forEach(s))}else{const _=n.indexOf(g);_>-1&&(n.splice(_,1),g.record.name&&r.delete(g.record.name),g.children.forEach(s),g.alias.forEach(s))}}function l(){return n}function c(g){const _=Nb(g,n);n.splice(_,0,g),g.record.name&&!Sf(g)&&r.set(g.record.name,g)}function h(g,_){let E,O={},H,X;if("name"in g&&g.name){if(E=r.get(g.name),!E)throw Ds(ln.MATCHER_NOT_FOUND,{location:g});X=E.record.name,O=Mt(kf(_.params,E.keys.filter(K=>!K.optional).concat(E.parent?E.parent.keys.filter(K=>K.optional):[]).map(K=>K.name)),g.params&&kf(g.params,E.keys.map(K=>K.name))),H=E.stringify(O)}else if(g.path!=null)H=g.path,E=n.find(K=>K.re.test(H)),E&&(O=E.parse(H),X=E.record.name);else{if(E=_.name?r.get(_.name):n.find(K=>K.re.test(_.path)),!E)throw Ds(ln.MATCHER_NOT_FOUND,{location:g,currentLocation:_});X=E.record.name,O=Mt({},_.params,g.params),H=E.stringify(O)}const D=[];let j=E;for(;j;)D.unshift(j.record),j=j.parent;return{name:X,path:H,params:O,matched:D,meta:$b(D)}}e.forEach(g=>o(g));function f(){n.length=0,r.clear()}return{addRoute:o,resolve:h,removeRoute:s,clearRoutes:f,getRoutes:l,getRecordMatcher:a}}function kf(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Cf(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Mb(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 Mb(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 Sf(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function $b(e){return e.reduce((t,n)=>Mt(t,n.meta),{})}function Nb(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;tm(e,t[o])<0?r=o:n=o+1}const a=Lb(e);return a&&(r=t.lastIndexOf(a,r-1)),r}function Lb(e){let t=e;for(;t=t.parent;)if(nm(t)&&tm(e,t)===0)return t}function nm({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function xf(e){const t=po(Bl),n=po(Hc),r=ne(()=>{const c=S(e.to);return t.resolve(c)}),a=ne(()=>{const{matched:c}=r.value,{length:h}=c,f=c[h-1],g=n.matched;if(!f||!g.length)return-1;const _=g.findIndex(js.bind(null,f));if(_>-1)return _;const E=Af(c[h-2]);return h>1&&Af(f)===E&&g[g.length-1].path!==E?g.findIndex(js.bind(null,c[h-2])):_}),o=ne(()=>a.value>-1&&Ub(n.params,r.value.params)),s=ne(()=>a.value>-1&&a.value===n.matched.length-1&&Jp(n.params,r.value.params));function l(c={}){if(Fb(c)){const h=t[S(e.replace)?"replace":"push"](S(e.to)).catch(wi);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>h),h}return Promise.resolve()}return{route:r,href:ne(()=>r.value.href),isActive:o,isExactActive:s,navigate:l}}function Ob(e){return e.length===1?e[0]:e}const jb=Hn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:xf,setup(e,{slots:t}){const n=Nl(xf(e)),{options:r}=po(Bl),a=ne(()=>({[Ef(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Ef(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&Ob(t.default(n));return e.custom?o:Bc("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:a.value},o)}}}),Db=jb;function Fb(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 Ub(e,t){for(const n in t){const r=t[n],a=e[n];if(typeof r=="string"){if(r!==a)return!1}else if(!yo(a)||a.length!==r.length||r.some((o,s)=>o.valueOf()!==a[s].valueOf()))return!1}return!0}function Af(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Ef=(e,t,n)=>e??t??n,Bb=Hn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=po(lc),a=ne(()=>e.route||r.value),o=po(wf,0),s=ne(()=>{let h=S(o);const{matched:f}=a.value;let g;for(;(g=f[h])&&!g.components;)h++;return h}),l=ne(()=>a.value.matched[s.value]);fl(wf,ne(()=>s.value+1)),fl(mb,l),fl(lc,a);const c=A();return pt(()=>[c.value,l.value,e.name],([h,f,g],[_,E,O])=>{f&&(f.instances[g]=h,E&&E!==f&&h&&h===_&&(f.leaveGuards.size||(f.leaveGuards=E.leaveGuards),f.updateGuards.size||(f.updateGuards=E.updateGuards))),h&&f&&(!E||!js(f,E)||!_)&&(f.enterCallbacks[g]||[]).forEach(H=>H(h))},{flush:"post"}),()=>{const h=a.value,f=e.name,g=l.value,_=g&&g.components[f];if(!_)return If(n.default,{Component:_,route:h});const E=g.props[f],O=E?E===!0?h.params:typeof E=="function"?E(h):E:null,X=Bc(_,Mt({},O,t,{onVnodeUnmounted:D=>{D.component.isUnmounted&&(g.instances[f]=null)},ref:c}));return If(n.default,{Component:X,route:h})||X}}});function If(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const qb=Bb;function Hb(e){const t=Pb(e.routes,e),n=e.parseQuery||hb,r=e.stringifyQuery||yf,a=e.history,o=si(),s=si(),l=si(),c=$g(Ta);let h=Ta;bs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const f=Su.bind(null,ee=>""+ee),g=Su.bind(null,Qw),_=Su.bind(null,Ei);function E(ee,xe){let Ae,Fe;return Xp(ee)?(Ae=t.getRecordMatcher(ee),Fe=xe):Fe=ee,t.addRoute(Fe,Ae)}function O(ee){const xe=t.getRecordMatcher(ee);xe&&t.removeRoute(xe)}function H(){return t.getRoutes().map(ee=>ee.record)}function X(ee){return!!t.getRecordMatcher(ee)}function D(ee,xe){if(xe=Mt({},xe||c.value),typeof ee=="string"){const z=xu(n,ee,xe.path),ae=t.resolve({path:z.path},xe),Q=a.createHref(z.fullPath);return Mt(z,ae,{params:_(ae.params),hash:Ei(z.hash),redirectedFrom:void 0,href:Q})}let Ae;if(ee.path!=null)Ae=Mt({},ee,{path:xu(n,ee.path,xe.path).path});else{const z=Mt({},ee.params);for(const ae in z)z[ae]==null&&delete z[ae];Ae=Mt({},ee,{params:g(z)}),xe.params=g(xe.params)}const Fe=t.resolve(Ae,xe),Ge=ee.hash||"";Fe.params=f(_(Fe.params));const x=Zw(r,Mt({},ee,{hash:Gw(Ge),path:Fe.path})),P=a.createHref(x);return Mt({fullPath:x,hash:Ge,query:r===yf?pb(ee.query):ee.query||{}},Fe,{redirectedFrom:void 0,href:P})}function j(ee){return typeof ee=="string"?xu(n,ee,c.value.path):Mt({},ee)}function K(ee,xe){if(h!==ee)return Ds(ln.NAVIGATION_CANCELLED,{from:xe,to:ee})}function Z(ee){return de(ee)}function be(ee){return Z(Mt(j(ee),{replace:!0}))}function pe(ee,xe){const Ae=ee.matched[ee.matched.length-1];if(Ae&&Ae.redirect){const{redirect:Fe}=Ae;let Ge=typeof Fe=="function"?Fe(ee,xe):Fe;return typeof Ge=="string"&&(Ge=Ge.includes("?")||Ge.includes("#")?Ge=j(Ge):{path:Ge},Ge.params={}),Mt({query:ee.query,hash:ee.hash,params:Ge.path!=null?{}:ee.params},Ge)}}function de(ee,xe){const Ae=h=D(ee),Fe=c.value,Ge=ee.state,x=ee.force,P=ee.replace===!0,z=pe(Ae,Fe);if(z)return de(Mt(j(z),{state:typeof z=="object"?Mt({},Ge,z.state):Ge,force:x,replace:P}),xe||Ae);const ae=Ae;ae.redirectedFrom=xe;let Q;return!x&&eb(r,Fe,Ae)&&(Q=Ds(ln.NAVIGATION_DUPLICATED,{to:ae,from:Fe}),Ue(Fe,Fe,!0,!1)),(Q?Promise.resolve(Q):ve(ae,Fe)).catch(le=>Zo(le)?Zo(le,ln.NAVIGATION_GUARD_REDIRECT)?le:tt(le):Se(le,ae,Fe)).then(le=>{if(le){if(Zo(le,ln.NAVIGATION_GUARD_REDIRECT))return de(Mt({replace:P},j(le.to),{state:typeof le.to=="object"?Mt({},Ge,le.to.state):Ge,force:x}),xe||ae)}else le=oe(ae,Fe,!0,P,Ge);return Te(ae,Fe,le),le})}function Pe(ee,xe){const Ae=K(ee,xe);return Ae?Promise.reject(Ae):Promise.resolve()}function G(ee){const xe=Je.values().next().value;return xe&&typeof xe.runWithContext=="function"?xe.runWithContext(ee):ee()}function ve(ee,xe){let Ae;const[Fe,Ge,x]=vb(ee,xe);Ae=Eu(Fe.reverse(),"beforeRouteLeave",ee,xe);for(const z of Fe)z.leaveGuards.forEach(ae=>{Ae.push(xa(ae,ee,xe))});const P=Pe.bind(null,ee,xe);return Ae.push(P),Tt(Ae).then(()=>{Ae=[];for(const z of o.list())Ae.push(xa(z,ee,xe));return Ae.push(P),Tt(Ae)}).then(()=>{Ae=Eu(Ge,"beforeRouteUpdate",ee,xe);for(const z of Ge)z.updateGuards.forEach(ae=>{Ae.push(xa(ae,ee,xe))});return Ae.push(P),Tt(Ae)}).then(()=>{Ae=[];for(const z of x)if(z.beforeEnter)if(yo(z.beforeEnter))for(const ae of z.beforeEnter)Ae.push(xa(ae,ee,xe));else Ae.push(xa(z.beforeEnter,ee,xe));return Ae.push(P),Tt(Ae)}).then(()=>(ee.matched.forEach(z=>z.enterCallbacks={}),Ae=Eu(x,"beforeRouteEnter",ee,xe,G),Ae.push(P),Tt(Ae))).then(()=>{Ae=[];for(const z of s.list())Ae.push(xa(z,ee,xe));return Ae.push(P),Tt(Ae)}).catch(z=>Zo(z,ln.NAVIGATION_CANCELLED)?z:Promise.reject(z))}function Te(ee,xe,Ae){l.list().forEach(Fe=>G(()=>Fe(ee,xe,Ae)))}function oe(ee,xe,Ae,Fe,Ge){const x=K(ee,xe);if(x)return x;const P=xe===Ta,z=bs?history.state:{};Ae&&(Fe||P?a.replace(ee.fullPath,Mt({scroll:P&&z&&z.scroll},Ge)):a.push(ee.fullPath,Ge)),c.value=ee,Ue(ee,xe,Ae,P),tt()}let ke;function De(){ke||(ke=a.listen((ee,xe,Ae)=>{if(!We.listening)return;const Fe=D(ee),Ge=pe(Fe,We.currentRoute.value);if(Ge){de(Mt(Ge,{replace:!0,force:!0}),Fe).catch(wi);return}h=Fe;const x=c.value;bs&&lb(gf(x.fullPath,Ae.delta),Ul()),ve(Fe,x).catch(P=>Zo(P,ln.NAVIGATION_ABORTED|ln.NAVIGATION_CANCELLED)?P:Zo(P,ln.NAVIGATION_GUARD_REDIRECT)?(de(Mt(j(P.to),{force:!0}),Fe).then(z=>{Zo(z,ln.NAVIGATION_ABORTED|ln.NAVIGATION_DUPLICATED)&&!Ae.delta&&Ae.type===sc.pop&&a.go(-1,!1)}).catch(wi),Promise.reject()):(Ae.delta&&a.go(-Ae.delta,!1),Se(P,Fe,x))).then(P=>{P=P||oe(Fe,x,!1),P&&(Ae.delta&&!Zo(P,ln.NAVIGATION_CANCELLED)?a.go(-Ae.delta,!1):Ae.type===sc.pop&&Zo(P,ln.NAVIGATION_ABORTED|ln.NAVIGATION_DUPLICATED)&&a.go(-1,!1)),Te(Fe,x,P)}).catch(wi)}))}let Be=si(),Ke=si(),Le;function Se(ee,xe,Ae){tt(ee);const Fe=Ke.list();return Fe.length?Fe.forEach(Ge=>Ge(ee,xe,Ae)):console.error(ee),Promise.reject(ee)}function Qe(){return Le&&c.value!==Ta?Promise.resolve():new Promise((ee,xe)=>{Be.add([ee,xe])})}function tt(ee){return Le||(Le=!ee,De(),Be.list().forEach(([xe,Ae])=>ee?Ae(ee):xe()),Be.reset()),ee}function Ue(ee,xe,Ae,Fe){const{scrollBehavior:Ge}=e;if(!bs||!Ge)return Promise.resolve();const x=!Ae&&ub(gf(ee.fullPath,0))||(Fe||!Ae)&&history.state&&history.state.scroll||null;return Xt().then(()=>Ge(ee,xe,x)).then(P=>P&&ib(P)).catch(P=>Se(P,ee,xe))}const He=ee=>a.go(ee);let ft;const Je=new Set,We={currentRoute:c,listening:!0,addRoute:E,removeRoute:O,clearRoutes:t.clearRoutes,hasRoute:X,getRoutes:H,resolve:D,options:e,push:Z,replace:be,go:He,back:()=>He(-1),forward:()=>He(1),beforeEach:o.add,beforeResolve:s.add,afterEach:l.add,onError:Ke.add,isReady:Qe,install(ee){ee.component("RouterLink",Db),ee.component("RouterView",qb),ee.config.globalProperties.$router=We,Object.defineProperty(ee.config.globalProperties,"$route",{enumerable:!0,get:()=>S(c)}),bs&&!ft&&c.value===Ta&&(ft=!0,Z(a.location).catch(Fe=>{}));const xe={};for(const Fe in Ta)Object.defineProperty(xe,Fe,{get:()=>c.value[Fe],enumerable:!0});ee.provide(Bl,We),ee.provide(Hc,Zh(xe)),ee.provide(lc,c);const Ae=ee.unmount;Je.add(ee),ee.unmount=function(){Je.delete(ee),Je.size<1&&(h=Ta,ke&&ke(),ke=null,c.value=Ta,ft=!1,Le=!1),Ae()}}};function Tt(ee){return ee.reduce((xe,Ae)=>xe.then(()=>G(Ae)),Promise.resolve())}return We}function Wb(){return po(Bl)}function zb(e){return po(Hc)}const Rf=768;function Wc(){const e=A(typeof window<"u"?window.innerWidth<Rf:!1);let t=null;function n(r){e.value=r.matches}return ca(()=>{t=window.matchMedia(`(max-width: ${Rf-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Ol(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const Vb={key:0,class:"desktop-sidebar"},Gb={class:"desktop-main"},Pf="codex-web-local.sidebar-width.v1",Kb=260,Yb=620,Mf=320,Qb=Hn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Wc();function r(h){return Math.min(Yb,Math.max(Kb,h))}function a(){if(typeof window>"u")return Mf;const h=window.localStorage.getItem(Pf),f=Number(h);return Number.isFinite(f)?r(f):Mf}const o=A(a()),s=ne(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${o.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function l(h){typeof window>"u"||window.localStorage.setItem(Pf,String(h))}function c(h){h.preventDefault();const f=h.clientX,g=o.value,_=O=>{const H=O.clientX-f;o.value=r(g+H)},E=()=>{l(o.value),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",E)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",E)}return(h,f)=>(k(),R("div",{class:et(["desktop-layout",{"is-mobile":S(n)}]),style:oa(s.value)},[S(n)?(k(),Ze(Qa,{key:0,to:"body"},[Oe(Hp,{name:"drawer"},{default:ht(()=>[e.isSidebarCollapsed?J("",!0):(k(),R("div",{key:0,class:"mobile-drawer-backdrop",onClick:f[1]||(f[1]=g=>h.$emit("close-sidebar"))},[m("aside",{class:"mobile-drawer",onClick:f[0]||(f[0]=Xe(()=>{},["stop"]))},[Lo(h.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):J("",!0),S(n)?J("",!0):(k(),R(Ye,{key:1},[e.isSidebarCollapsed?J("",!0):(k(),R("aside",Vb,[Lo(h.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?J("",!0):(k(),R("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:c},null,32))],64)),m("section",Gb,[Lo(h.$slots,"content",{},void 0)])],6))}}),It=(e,t)=>{const n=e.__vccOpts||e;for(const[r,a]of t)n[r]=a;return n},Jb=It(Qb,[["__scopeId","data-v-4c6dbcd7"]]);function $f(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class jo extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function da(e,t){if(typeof e=="string"&&e.length>0)return e;const n=$f(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const a=$f(r);return a&&typeof a.message=="string"&&a.message.length>0?a.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function la(e,t,n){return e instanceof jo?e:e instanceof Error?new jo(e.message||t,{code:"unknown_error",method:n}):new jo(t,{code:"unknown_error",method:n})}function rm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function Xb(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(l){throw new jo(l instanceof Error?l.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let a=null,o=null;try{o=await r.text(),a=JSON.parse(o)}catch{a=null}if(!r.ok){const l=da(a,"")||(o==null?void 0:o.slice(0,500))||"",c=`RPC ${e} failed with HTTP ${r.status}`;throw new jo(l?`${c}: ${l}`:c,{code:"http_error",method:e,status:r.status})}const s=a;if(!s||typeof s!="object"||!("result"in s))throw new jo(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return s.result}async function Zb(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new jo(da(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 e0(e){const t=rm(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 Nf(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function t0(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const a=()=>{r!==null&&(window.clearTimeout(r),r=null)},o=(h,f)=>{if(n||r!==null)return;const g=Math.min(1e3*2**f,1e4);r=window.setTimeout(()=>{r=null,!n&&h()},g)},s=h=>{const f=e0(h);f&&e(f)},l=(h=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const f=new EventSource("/codex-api/events");let g=!1;f.onmessage=_=>{try{s(JSON.parse(_.data))}catch{}},f.addEventListener("ready",_=>{try{const E=_.data?JSON.parse(_.data):{ok:!0};Nf(e,E)}catch{Nf(e)}}),f.onerror=()=>{n||g||f.readyState===EventSource.CLOSED&&(g=!0,f.close(),o(()=>l(h+1),h))},t=()=>{g=!0,f.close()}},c=(h=0)=>{if(typeof WebSocket>"u"||n){l();return}t==null||t();const f=window.location.protocol==="https:"?"wss:":"ws:",g=new WebSocket(`${f}//${window.location.host}/codex-api/ws`);let _=!1,E=!1,O=window.setTimeout(()=>{_||n||E||(E=!0,g.close(),l())},2500);g.onopen=()=>{_=!0,a(),O!==null&&(window.clearTimeout(O),O=null)},g.onmessage=H=>{try{s(JSON.parse(String(H.data)))}catch{}},g.onerror=()=>{},g.onclose=()=>{if(O!==null&&(window.clearTimeout(O),O=null),!(n||E)){if(!_){l();return}o(()=>c(h+1),h)}},t=()=>{E=!0,O!==null&&(window.clearTimeout(O),O=null),g.close()}};return typeof WebSocket<"u"?c():l(),()=>{n=!0,a(),t==null||t()}}async function n0(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(r){throw new jo(r instanceof Error?r.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new jo(da(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function r0(){const e=await fetch("/codex-api/server-requests/pending");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new jo(da(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=rm(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function o0(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function rt(e){return o0(e)}function a0(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function s0(e){const t=rt(e).replace(/[\\/]+/gu,"/");return a0(t)?t.toLowerCase():t}function Nr(e){const t=rt(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function Ms(e){const t=rt(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function Qr(e){return Nr(e)||rt(e)||"Projectless"}function Cl(e){const t=rt(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function Lf(e){return new Date(e*1e3).toISOString()}function i0(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const l0=/^##\s+(.+?):\s+(.+?)\s*$/,u0=/^#\s*files mentioned by the user\s*:?\s*$/i;function c0(e){var a,o;const t=e.split(`
|
|
27
|
-
`).findIndex(s=>u0.test(s.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
-
`).slice(t+1),r=[];for(const s of n){const l=s.trim();if(!l)continue;const c=l.match(l0);if(!c)break;const h=(a=c[1])==null?void 0:a.trim(),f=(o=c[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");h&&f&&r.push({label:h,path:f})}return r}function d0(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 a=r.index+r[0].length;return e.slice(a).trim()}function om(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function f0(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 h0(e){return e.replace(/</giu,"<").replace(/>/giu,">").replace(/&/giu,"&")}function Iu(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?h0(n[1].trim()):""}function p0(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=Iu(t,"current_time_iso"),r=Iu(t,"instructions");return!n||!r?null:{automationId:Iu(t,"automation_id"),currentTimeIso:n,instructions:r}}function m0(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],a=[],o=[];for(const[h,f]of t.entries()){if(f.type==="text"&&typeof f.text=="string"&&f.text.length>0&&n.push(f.text),f.type==="image"&&typeof f.url=="string"&&f.url.trim().length>0&&r.push(f.url.trim()),f.type==="localImage"&&typeof f.path=="string"&&f.path.trim().length>0&&r.push(om(f.path.trim())),f.type==="skill"){const g=typeof f.name=="string"?f.name.trim():"",_=typeof f.path=="string"?f.path.trim():"";g&&_&&a.push({name:g,path:_})}f.type!=="text"&&f.type!=="image"&&f.type!=="localImage"&&f.type!=="skill"&&o.push({id:`${e}:user-content:${h}`,role:"user",text:"",messageType:`userContent.${f.type}`,rawPayload:i0(f),isUnhandled:!0})}const s=n.join(`
|
|
29
|
-
`),l=c0(s),c=p0(s);return{text:(c==null?void 0:c.instructions)??d0(s),images:r,skills:a,fileAttachments:l,rawBlocks:o,isAutomationRun:c!==null,automationDisplayName:(c==null?void 0:c.automationId)||null}}function v0(e){var o;const t=e.replace(/\r\n/g,`
|
|
30
|
-
`).trim();if(!t)return null;const n=t.split(`
|
|
31
|
-
`),r=[],a=[];for(const s of n){const l=s.trim();if(!l){r.length===0&&a.push("");continue}const c=l.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(c){const h=(c[1]??" ").toLowerCase(),f=(o=c[2])==null?void 0:o.trim();if(!f)continue;let g="pending";h==="x"&&(g="completed"),(h==="~"||h===">"||h==="-")&&(g="inProgress"),r.push({step:f,status:g});continue}a.push(l)}return r.length===0?null:{explanation:a.join(`
|
|
32
|
-
`).trim()||void 0,steps:r}}function Of(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 g0(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 am(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function sm(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){const a=r,o=typeof a.path=="string"?a.path:"",s=typeof a.diff=="string"?a.diff:"",l=a.kind,c=l==null?void 0:l.type;if(!o||c!=="add"&&c!=="delete"&&c!=="update")continue;const h=c==="update"&&typeof(l==null?void 0:l.move_path)=="string"?l.move_path:null,f=c==="update"?g0(s):c==="add"?{addedLineCount:Of(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:Of(s)};n.push({path:o,operation:c,movedToPath:h,diff:s,...f})}return n}function y0(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=m0(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0||t.skills.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,skills:t.skills.length>0?t.skills:void 0,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,messageType:e.type,isAutomationRun:t.isAutomationRun,automationDisplayName:t.automationDisplayName}),n.push(...t.rawBlocks),n.length===0?[]:n}if(e.type==="imageView"){const t=typeof e.path=="string"?e.path.trim():"";return t?[{id:e.id,role:"assistant",text:"",images:[om(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?f0(t.result):"";return n?[{id:e.id,role:"assistant",text:"",images:[n],messageType:"imageView"}]:[]}}if(e.type==="reasoning")return[];if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:v0(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=w0(t.status),r=typeof t.command=="string"?t.command:"",a=typeof t.cwd=="string"?t.cwd:null,o=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:a,status:n,aggregatedOutput:o,exitCode:s}}]}if(e.type==="fileChange"){const t=sm(e.changes),n=am(e.status);return t.length===0||n!=="completed"?[]:[{id:e.id,role:"system",text:"",messageType:"fileChange",fileChangeStatus:n,fileChanges:t}]}return[]}function w0(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function b0(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 _0(e){const t=b0(e);return t.length>0?t:"Untitled thread"}function zc(e){return(e==null?void 0:e.status)==="inProgress"}function T0(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return zc(r)}function k0(e){const t=e,n=rt(typeof t.cwd=="string"?t.cwd:e.cwd),r=s0(n),a=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:_0(e),projectName:Qr(n),cwd:n,hasWorktree:a,createdAtIso:Lf(e.createdAt),updatedAtIso:Lf(e.updatedAt),preview:e.preview,unread:!1,inProgress:T0(e)}}function C0(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((a,o)=>new Date(o.updatedAtIso).getTime()-new Date(a.updatedAtIso).getTime())})).sort((n,r)=>{var s,l;const a=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((l=r.threads[0])==null?void 0:l.updatedAtIso)??0).getTime()-a})}function S0(e){const t=e.data.map(k0);return C0(t)}function ql(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n=[];for(let r=0;r<t.length;r++){const a=t[r],o=typeof(a==null?void 0:a.id)=="string"?a.id:void 0,s=Array.isArray(a.items)?a.items:[];for(const l of s)for(const c of y0(l))n.push({...c,turnId:o,turnIndex:r})}return n}function im(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return zc(t.at(-1))}function lm(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(zc(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const x0=5e3;function Ru(e){return e&&e.length>0?e:null}function Pu(e){return e&&e.length>0?e:null}let rl=null,bi=null;const jf=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function it(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ce(e){return typeof e=="string"&&e.length>0?e:null}function An(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Jr(e){return typeof e=="boolean"?e:null}function ks(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function A0(e){return e==="payment_required"?e:null}function E0(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function Df(e){const t=it(e);if(!t)return null;const n=An(t.usedPercent??t.used_percent);if(n===null)return null;const r=An(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:An(t.resetsAt??t.resets_at)}}function I0(e){const t=it(e);if(!t)return null;const n=Jr(t.hasCredits??t.has_credits),r=Jr(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:ce(t.balance)}}function uc(e){const t=it(e);if(!t)return null;const n=Df(t.primary),r=Df(t.secondary),a=I0(t.credits);return!n&&!r&&!a?null:{limitId:ce(t.limitId??t.limit_id),limitName:ce(t.limitName??t.limit_name),primary:n,secondary:r,credits:a,planType:ce(t.planType??t.plan_type)}}function um(e,t=null){const n=it(e);if(!n)return null;const r=ce(n.accountId),a=ce(n.quotaStatus),o=a==="loading"||a==="ready"||a==="error"?a:"idle";return r?{accountId:r,authMode:ce(n.authMode),email:ce(n.email),planType:ce(n.planType),lastRefreshedAtIso:ce(n.lastRefreshedAtIso)??"",lastActivatedAtIso:ce(n.lastActivatedAtIso),quotaSnapshot:uc(n.quotaSnapshot),quotaUpdatedAtIso:ce(n.quotaUpdatedAtIso),quotaStatus:o,quotaError:ce(n.quotaError),unavailableReason:A0(n.unavailableReason)??(E0(ce(n.quotaError))?"payment_required":null),isActive:Jr(n.isActive)??r===t}:null}function cm(e){const t=it(e);if(!t)return null;const n=it(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=uc(n==null?void 0:n.codex);return r||uc(t.rateLimits??t.rate_limits)}async function Lt(e,t){try{return await Xb(e,t)}catch(n){throw la(n,`RPC ${e} failed`,e)}}function dm(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n={};for(let r=0;r<t.length;r+=1){const a=t[r];typeof(a==null?void 0:a.id)!="string"||a.id.length===0||(n[a.id]=r)}return n}function R0(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}function P0(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}const M0=50,$0=100;async function N0(e,t){const n=await Lt("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:S0(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function L0(e){const t=await Lt("thread/read",{threadId:e,includeTurns:!0});return{messages:ql(t),inProgress:im(t),activeTurnId:lm(t),turnIndexByTurnId:dm(t)}}async function Ff(e=null,t=M0){try{return await N0(e,t)}catch(n){throw la(n,"Failed to load thread groups","thread/list")}}function O0(){return $0}async function Uf(e){try{return await L0(e)}catch(t){throw la(t,`Failed to load thread ${e}`,"thread/read")}}function j0(e){const t=it(e);if(!t)return null;const n=ce(t.key),r=typeof t.text=="string"?t.text:"",a=ce(t.kind);return!n||!a||a!=="meta"&&a!=="hunk"&&a!=="add"&&a!=="remove"&&a!=="context"?null:{key:n,kind:a,text:r,oldLine:An(t.oldLine),newLine:An(t.newLine)}}function D0(e){const t=it(e);if(!t)return null;const n=ce(t.id),r=typeof t.header=="string"?t.header:"",a=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:r,patch:a,addedLineCount:An(t.addedLineCount)??0,removedLineCount:An(t.removedLineCount)??0,oldStart:An(t.oldStart),oldLineCount:An(t.oldLineCount)??0,newStart:An(t.newStart),newLineCount:An(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(o=>j0(o)).filter(o=>o!==null):[]}:null}function F0(e){const t=it(e);if(!t)return null;const n=ce(t.id),r=ce(t.path),a=ce(t.absolutePath),o=ce(t.operation);return!n||!r||!a||!o||o!=="add"&&o!=="delete"&&o!=="update"&&o!=="rename"?null:{id:n,path:r,absolutePath:a,previousPath:ce(t.previousPath),previousAbsolutePath:ce(t.previousAbsolutePath),operation:o,addedLineCount:An(t.addedLineCount)??0,removedLineCount:An(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>D0(s)).filter(s=>s!==null):[]}}function fm(e){const t=it(e),n=it(t==null?void 0:t.data),r=it(n==null?void 0:n.summary),a=ce(n==null?void 0:n.scope)==="baseBranch"?"baseBranch":"workspace",o=ce(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:ce(n==null?void 0:n.cwd)??"",gitRoot:ce(n==null?void 0:n.gitRoot),isGitRepo:Jr(n==null?void 0:n.isGitRepo)??!1,scope:a,workspaceView:o,baseBranch:ce(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(s=>ce(s)).filter(s=>typeof s=="string"&&s.length>0):[],headBranch:ce(n==null?void 0:n.headBranch),mergeBaseSha:ce(n==null?void 0:n.mergeBaseSha),generatedAtIso:ce(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:An(r==null?void 0:r.fileCount)??0,addedLineCount:An(r==null?void 0:r.addedLineCount)??0,removedLineCount:An(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(s=>F0(s)).filter(s=>s!==null):[]}}function U0(e){var r;const t=e.trim();if(!t)return{absolutePath:null,startLine:null,endLine:null};const n=t.match(/^(.*?):(\d+)-(\d+)$/u);return n?{absolutePath:((r=n[1])==null?void 0:r.trim())||null,startLine:Number(n[2]),endLine:Number(n[3])}:{absolutePath:t||null,startLine:null,endLine:null}}function B0(e){var s;const t=e.replace(/\r\n/g,`
|
|
38
|
-
`).trim();if(!t)return{reviewText:"",summary:"",findings:[]};const n=t.search(/\n(?:Full review comments|Review comment):\n/iu),r=n>=0?t.slice(0,n).trim():t,a=n>=0?t.slice(n).trim():"",o=[];if(a){const c=a.replace(/^(?:Full review comments|Review comment):\n*/iu,"").trim().matchAll(/^- (.+?) — (.+)\n?((?: .*(?:\n|$))*)/gmu);let h=0;for(const f of c){const g=((s=f[1])==null?void 0:s.trim())??"",_=U0(f[2]??""),E=(f[0]??"").trim(),O=(f[3]??"").split(`
|
|
39
|
-
`).map(H=>H.replace(/^ /u,"")).join(`
|
|
40
|
-
`).trim();o.push({id:`finding:${h}`,title:g||`Finding ${h+1}`,body:O,path:_.absolutePath?_.absolutePath.split("/").filter(Boolean).slice(-1)[0]??_.absolutePath:null,absolutePath:_.absolutePath,startLine:_.startLine,endLine:_.endLine,rawText:E}),h+=1}}return{reviewText:t,summary:r,findings:o}}function Bf(e,t){const n=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let r=n.length-1;r>=0;r-=1){const a=n[r],o=Array.isArray(a==null?void 0:a.items)?a.items:[];for(let s=o.length-1;s>=0;s-=1){const l=o[s];if((l==null?void 0:l.type)!==t)continue;const c=typeof l.review=="string"?l.review.trim():"";if(c)return c}}return null}async function xM(e){const t=await Lt("thread/read",{threadId:e,includeTurns:!0}),n=Bf(t,"exitedReviewMode");return{enteredReviewLabel:Bf(t,"enteredReviewMode"),result:n?B0(n):null}}async function AM(){return Zb()}function cc(e){const t=it(e);if(!t)return null;const n=ce(t.id),r=ce(t.kind),a=ce(t.name),o=ce(t.prompt),s=ce(t.rrule),l=ce(t.status);return!n||!a||!o||!s||r!=="heartbeat"&&r!=="cron"||l!=="ACTIVE"&&l!=="PAUSED"?null:{id:n,kind:r,name:a,prompt:o,rrule:s,status:l,targetThreadId:ce(t.targetThreadId),createdAtMs:An(t.createdAtMs),updatedAtMs:An(t.updatedAtMs),nextRunAtMs:An(t.nextRunAtMs)}}function q0(e){if(Array.isArray(e))return e.flatMap(n=>{const r=cc(n);return r?[r]:[]});const t=cc(e);return t?[t]:[]}async function H0(){var a;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(da(t,"Failed to load thread automations"));const n=it((a=it(t))==null?void 0:a.data),r={};if(!n)return r;for(const[o,s]of Object.entries(n)){const l=q0(s);l.length>0&&(r[o]=l)}return r}async function W0(e){var a;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(da(n,"Failed to save thread automation"));const r=cc((a=it(n))==null?void 0:a.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function qf(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"}),a=await r.json().catch(()=>null);if(!r.ok)throw new Error(da(a,"Failed to delete thread automation"))}async function z0(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(da(r,"Failed to run thread automation"))}function V0(e){return t0(e)}function G0(e){const t=it(e);if(!t)return null;const n=ce(t.id),r=ce(t.threadId),a=ce(t.cwd),o=ce(t.shell);return!n||!r||!a||!o?null:{id:n,threadId:r,cwd:a,shell:o,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Jr(t.truncated)??!1}}async function Bs(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(da(r,`Terminal request failed with HTTP ${n.status}`));return r}async function EM(e){var r;const t=await Bs("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=G0((r=it(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function K0(){const e=await Bs("/codex-api/thread-terminal/status"),t=it(e);return{available:Jr(t==null?void 0:t.available)??!1,reason:ce(t==null?void 0:t.reason)||null}}async function Y0(e){const t=await Bs(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=it(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(a=>{const o=it(a),s=ce(o==null?void 0:o.label),l=ce(o==null?void 0:o.value),c=ce(o==null?void 0:o.source);return!s||!l||c!=="package"&&c!=="script"&&c!=="make"?[]:[{label:s,value:l,source:c}]})}async function IM(e,t){await Bs("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function RM(e,t,n){await Bs("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function PM(e){await Bs("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}async function Q0(e,t){await n0({id:e,...t})}async function J0(){return r0()}async function X0(){try{const e=await Lt("account/rateLimits/read");return cm(e)}catch(e){throw la(e,"Failed to load account rate limits","account/rateLimits/read")}}function Hl(e){const t=it(e),n=ce(t==null?void 0:t.activeAccountId),r=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,importedAccountId:ce(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(a=>um(a,n)).filter(a=>a!==null)}}async function Z0(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Nn(t,"Failed to load accounts"));const n=it(t);return Hl(n==null?void 0:n.data)}async function e_(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Nn(t,"Failed to refresh accounts"));const n=it(t);return Hl(n==null?void 0:n.data)}async function t_(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Nn(t,"Failed to start Codex login"));const n=it(t),r=it(n==null?void 0:n.data),a=ce(r==null?void 0:r.loginUrl);if(!a)throw new Error("Failed to start Codex login");return a}async function n_(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(Nn(n,"Failed to complete Codex login"));const r=it(n);return Hl(r==null?void 0:r.data)}async function r_(e){const t=await fetch("/codex-api/accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Nn(n,"Failed to switch account"));const r=it(n),a=it(r==null?void 0:r.data),o=um(a==null?void 0:a.account,ce(a==null?void 0:a.activeAccountId));if(!o)throw new Error("Failed to switch account");return o}async function o_(e){const t=await fetch("/codex-api/accounts/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Nn(n,"Failed to remove account"));const r=it(n);return Hl(r==null?void 0:r.data)}async function Mu(e){const t=await Lt("thread/resume",{threadId:e});return{model:Sl(t),messages:ql(t),inProgress:im(t),activeTurnId:lm(t),turnIndexByTurnId:dm(t)}}async function a_(e){await Lt("thread/archive",{threadId:e})}async function s_(e,t){await Lt("thread/name/set",{threadId:e,name:t})}async function $u(e,t){const n=await Lt("thread/rollback",{threadId:e,numTurns:t});return ql(n)}async function i_(e,t,n){try{const r=await fetch("/codex-api/thread/rollback-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,cwd:n})});return r.ok?await r.json():{reverted:0,errors:["Server error"]}}catch{return{reverted:0,errors:["Network error"]}}}function dc(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 l_(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 Sl(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}async function Hf(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 Lt("thread/start",n),a=dc(r);if(!a)throw new Error("thread/start did not return a thread id");return{threadId:a,model:Sl(r)}}catch(n){throw la(n,"Failed to start a new thread","thread/start")}}async function Wf(e,t,n){if(arguments.length<=1)try{const r=await Lt("thread/fork",{threadId:e,persistExtendedHistory:!0}),a=dc(r);if(!a)throw new Error("thread/fork did not return a thread id");return{threadId:a,cwd:l_(r),model:Sl(r),messages:ql(r)}}catch(r){throw la(r,`Failed to fork thread ${e}`,"thread/fork")}try{const r=e.trim();if(!r)throw new Error("thread/fork requires threadId");const a={threadId:r};typeof t=="string"&&t.trim().length>0&&(a.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(a.model=n.trim());const o=await Lt("thread/fork",a),s=dc(o);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,model:Sl(o)}}catch(r){throw la(r,`Failed to fork thread ${e}`,"thread/fork")}}function zf(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 u_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
41
|
-
`;for(const r of t)n+=`
|
|
42
|
-
## ${r.label}: ${r.path}
|
|
43
|
-
`;return`${n}
|
|
44
|
-
## My request for Codex:
|
|
45
|
-
|
|
46
|
-
${e}
|
|
47
|
-
`}function c_(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function d_(e,t,n){var c;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?Ru(n):Pu(n)};let a=null;try{a=await pm()}catch{a=null}const o=(a==null?void 0:a.model.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?Ru(n??(a==null?void 0:a.reasoningEffort)):Pu(n??(a==null?void 0:a.reasoningEffort))};let s=[];try{s=await hm()}catch{s=[]}const l=((c=s.find(h=>h.trim().length>0))==null?void 0:c.trim())??"";if(l)return{model:l,reasoningEffort:e==="plan"?Ru(n??(a==null?void 0:a.reasoningEffort)):Pu(n??(a==null?void 0:a.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function Nu(e,t,n=[],r,a,o,s=[],l){var c;try{const h=(r==null?void 0:r.trim())??"",f=[];for(const j of n){const K=zf(j.trim());K&&f.push({label:c_(K),path:K,fsPath:K})}const g=[...s,...f],_=g.filter((j,K)=>g.findIndex(Z=>Z.fsPath===j.fsPath)===K),O=[{type:"text",text:u_(t,_)}];for(const j of n){const K=j.trim();if(!K)continue;const Z=zf(K);if(Z){O.push({type:"localImage",path:Z});continue}O.push({type:"image",url:K,image_url:K})}if(o)for(const j of o)O.push({type:"skill",name:j.name,path:j.path});const H=_.map(j=>({label:j.label,path:j.path,fsPath:j.fsPath})),X={threadId:e,input:O};if(H.length>0&&(X.attachments=H),h&&(X.model=h),typeof a=="string"&&a.length>0&&(X.effort=a),l){const j=await d_(l,h,a);X.collaborationMode={mode:l,settings:{model:j.model,reasoning_effort:j.reasoningEffort,developer_instructions:null}}}const D=await Lt("turn/start",X);return typeof((c=D==null?void 0:D.turn)==null?void 0:c.id)=="string"?D.turn.id.trim():""}catch(h){throw la(h,`Failed to start turn for thread ${e}`,"turn/start")}}async function f_(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 Lt("turn/interrupt",{threadId:n,turnId:r})}catch(a){throw la(a,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function h_(e){const t=e==="fast"?"fast":"standard";await Lt("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 p_(){return await(await fetch("/codex-api/free-mode/status")).json()}async function Vf(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function Gf(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 ms(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 hm(e={}){const t=await Lt("model/list",{}),n=[];for(const r of t.data){const a=r.id||r.model;!a||n.includes(a)||n.push(a)}if(e.includeProviderModels===!1)return n;try{const r=await fetch("/codex-api/provider-models",{signal:AbortSignal.timeout(x0)});let a=null;try{a=await r.json()}catch{a=null}if(r.ok&&Array.isArray(a==null?void 0:a.data)){if(a.exclusive)return a.data.filter(o=>typeof o=="string"&&o.trim().length>0);for(const o of a.data){if(typeof o!="string")continue;const s=o.trim();!s||n.includes(s)||n.push(s)}}}catch{}return n}async function pm(){const e=await Lt("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=R0(e.config.model_reasoning_effort),a=P0(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:a}}function mm(e){const t=it(e);if(!t)return null;const n=ce(t.id),r=ce(t.name);return!n||!r?null:{id:n,name:r,description:ce(t.description)??"",installUrl:ce(t.installUrl??t.install_url)??"",needsAuth:Jr(t.needsAuth??t.needs_auth)??!1}}function m_(e){const t=it(e);if(!t)return null;const n=ce(t.name),r=ce(t.path);if(!n||!r)return null;const a=it(t.interface);return{name:n,path:r,description:ce(t.description)??"",enabled:Jr(t.enabled)??!0,displayName:ce((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??n,shortDescription:ce(t.shortDescription??t.short_description)??""}}function vm(e,t={}){const n=it(e);if(!n)return null;const r=ce(n.id),a=ce(n.name);if(!r||!a)return null;const o=it(n.interface),s=it(n.source),l=ce(s==null?void 0:s.type)??"",c=ce(s==null?void 0:s.path),h=ce(s==null?void 0:s.url)??"",f=l==="remote"?t.name??null:null,g=t.path??(l==="local"?c:null),_=ce((o==null?void 0:o.displayName)??(o==null?void 0:o.display_name))??a,E=ce((o==null?void 0:o.shortDescription)??(o==null?void 0:o.short_description)),O=ce((o==null?void 0:o.longDescription)??(o==null?void 0:o.long_description))??"";return{id:r,name:a,displayName:_,description:E??O,longDescription:O,developerName:ce((o==null?void 0:o.developerName)??(o==null?void 0:o.developer_name))??"",category:ce(o==null?void 0:o.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:g,remoteMarketplaceName:f,sourceType:l,sourceUrl:h,installed:Jr(n.installed)??!1,enabled:Jr(n.enabled)??!0,installPolicy:ce(n.installPolicy??n.install_policy)??"",authPolicy:ce(n.authPolicy??n.auth_policy)??"",logoUrl:ce((o==null?void 0:o.logoUrl)??(o==null?void 0:o.logo_url))??"",logoPath:ce(o==null?void 0:o.logo)??"",composerIconUrl:ce((o==null?void 0:o.composerIconUrl)??(o==null?void 0:o.composer_icon_url))??"",composerIconPath:ce((o==null?void 0:o.composerIcon)??(o==null?void 0:o.composer_icon))??"",brandColor:ce((o==null?void 0:o.brandColor)??(o==null?void 0:o.brand_color))??"",capabilities:ks(o==null?void 0:o.capabilities),defaultPrompt:ks((o==null?void 0:o.defaultPrompt)??(o==null?void 0:o.default_prompt)),screenshotUrls:ks((o==null?void 0:o.screenshotUrls)??(o==null?void 0:o.screenshot_urls)),screenshots:ks(o==null?void 0:o.screenshots),websiteUrl:ce((o==null?void 0:o.websiteUrl)??(o==null?void 0:o.website_url))??"",privacyPolicyUrl:ce((o==null?void 0:o.privacyPolicyUrl)??(o==null?void 0:o.privacy_policy_url))??"",termsOfServiceUrl:ce((o==null?void 0:o.termsOfServiceUrl)??(o==null?void 0:o.terms_of_service_url))??""}}function v_(e,t=0){const n=it(e);if(!n)return null;const r=ce(n.id),a=ce(n.name);if(!r||!a)return null;const o=it(n.branding),s=it(n.appMetadata??n.app_metadata);return{id:r,name:a,description:ce(n.description)??ce((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:ce(n.logoUrl??n.logo_url)??"",logoUrlDark:ce(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:ce(n.distributionChannel??n.distribution_channel)??"",installUrl:ce(n.installUrl??n.install_url)??"",isAccessible:Jr(n.isAccessible??n.is_accessible)??!1,isEnabled:Jr(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:ks(n.pluginDisplayNames??n.plugin_display_names),category:ce(o==null?void 0:o.category)??"",developer:ce(o==null?void 0:o.developer)??ce(s==null?void 0:s.developer)??"",website:ce(o==null?void 0:o.website)??"",privacyPolicy:ce((o==null?void 0:o.privacyPolicy)??(o==null?void 0:o.privacy_policy))??"",termsOfService:ce((o==null?void 0:o.termsOfService)??(o==null?void 0:o.terms_of_service))??"",catalogRank:t}}function g_(e){const t=it(e);if(!t)return null;const n=ce(t.name);if(!n)return null;const r=it(t.tools)??{},a=Object.entries(r).map(([c,h])=>{const f=it(h);return{name:ce(f==null?void 0:f.name)??c,title:ce(f==null?void 0:f.title)??"",description:ce(f==null?void 0:f.description)??""}}),o=Array.isArray(t.resources)?t.resources.map(c=>{const h=it(c);return{name:ce(h==null?void 0:h.name)??"",title:ce(h==null?void 0:h.title)??"",uri:ce(h==null?void 0:h.uri)??"",description:ce(h==null?void 0:h.description)??""}}).filter(c=>c.name||c.uri):[],s=t.resourceTemplates??t.resource_templates,l=Array.isArray(s)?s.map(c=>{const h=it(c);return{name:ce(h==null?void 0:h.name)??"",title:ce(h==null?void 0:h.title)??"",uriTemplate:ce((h==null?void 0:h.uriTemplate)??(h==null?void 0:h.uri_template))??"",description:ce(h==null?void 0:h.description)??""}}).filter(c=>c.name||c.uriTemplate):[];return{name:n,authStatus:ce(t.authStatus??t.auth_status)??"unsupported",tools:a,resources:o,resourceTemplates:l}}async function MM(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await Lt("plugin/list",t),r=[];for(const a of n.marketplaces??[]){const o=it(a);if(!o)continue;const s=it(o.interface),l={name:ce(o.name)??"",displayName:ce((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:ce(o.path)},c=Array.isArray(o.plugins)?o.plugins:[];for(const h of c){const f=vm(h,l);f&&r.push(f)}}return r}async function $M(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await Lt("plugin/read",t),r=it(n.plugin);if(!r)throw new Error("Plugin detail response is empty");const a=vm(r.summary,{name:ce(r.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:ce(r.marketplacePath)??e.marketplacePath})??e;return{summary:a,description:ce(r.description)??a.longDescription,apps:Array.isArray(r.apps)?r.apps.map(mm).filter(o=>o!==null):[],skills:Array.isArray(r.skills)?r.skills.map(m_).filter(o=>o!==null):[],mcpServers:ks(r.mcpServers??r.mcp_servers)}}async function NM(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await Lt("plugin/install",t),r=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:ce(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:r.map(mm).filter(a=>a!==null)}}async function LM(e){await Lt("plugin/uninstall",{pluginId:e})}async function OM(e,t){await Lt("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function jM(e){const t=[];let n=null,r=0;do{const a={limit:100};n&&(a.cursor=n),e&&(a.threadId=e);const o=await Lt("app/list",a);for(const s of o.data??[]){const l=v_(s,r);l&&t.push(l),r+=1}n=ce(o.nextCursor??o.next_cursor)}while(n);return t}async function DM(e,t){await Lt("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function FM(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const r=await Lt("mcpServerStatus/list",n);for(const a of r.data??[]){const o=g_(a);o&&e.push(o)}t=ce(r.nextCursor??r.next_cursor)}while(t);return e}async function UM(){await Lt("config/mcpServer/reload",{})}async function BM(e){const t=await Lt("mcpServer/oauth/login",{name:e});return{authorizationUrl:ce(t.authorizationUrl??t.authorization_url)??""}}async function qM(){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 HM(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 a=r.toString(),o=await fetch(`/codex-api/composio/connectors${a?`?${a}`:""}`);if(!o.ok)throw new Error(`Failed to list Composio connectors (${o.status})`);const s=await o.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 WM(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 zM(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 VM(){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 GM(){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 y_(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function w_(){try{const e=await Lt("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const a=r.mode;a!=="default"&&a!=="plan"||t.has(a)||(t.add(a),n.push({value:a,label:y_(r.name||a)||(a==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of jf)t.has(r.value)||n.push(r);return n.sort((r,a)=>r.value===a.value?0:r.value==="default"?-1:1)}}catch{}return jf}function b_(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=o=>{if(!Array.isArray(o))return[];const s=[];for(const l of o)typeof l=="string"&&l.length>0&&!s.includes(l)&&s.push(l);return s},r=t.labels,a={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[o,s]of Object.entries(r)){const l=typeof o=="string"?rt(o):"";l.length>0&&typeof s=="string"&&(a[l]=s)}return{order:n(t.order).map(o=>rt(o)),labels:a,active:n(t.active).map(o=>rt(o)),projectOrder:n(t.projectOrder).map(o=>rt(o)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(o=>{if(!o||typeof o!="object"||Array.isArray(o))return[];const s=o,l=typeof s.id=="string"?s.id.trim():"";return l?[{id:l,hostId:typeof s.hostId=="string"?s.hostId.trim():"",remotePath:typeof s.remotePath=="string"?rt(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}function __(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):[],a=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const l=s,c=typeof l.name=="string"?l.name.trim():"",h=typeof l.path=="string"?l.path.trim():"";return c&&h?[{name:c,path:h}]:[]}):[],o=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const l=s,c=typeof l.label=="string"?l.label.trim():"",h=typeof l.path=="string"?l.path.trim():"",f=typeof l.fsPath=="string"?l.fsPath.trim():"";return c&&h&&f?[{label:c,path:h,fsPath:f}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:r,skills:a,fileAttachments:o,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function gm(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const a=n.trim();if(!a||!Array.isArray(r))continue;const o=r.flatMap(s=>{const l=__(s);return l?[l]:[]});o.length>0&&(t[a]=o)}return t}async function _s(){return bi?fc(bi):(rl||(rl=T_().then(e=>(bi=e,e)).finally(()=>{rl=null})),fc(await rl))}async function T_(){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 b_(n.data)}function fc(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 k_(){bi=null}async function Kf(){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 gm(n.data)}async function C_(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(gm(e))})).ok)throw new Error("Failed to save thread queue state")}async function S_(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})}),a=await r.json();if(!r.ok||!a.data)throw new Error(a.error||"Failed to create worktree");return{...a.data,cwd:rt(a.data.cwd),gitRoot:rt(a.data.gitRoot)}}async function x_(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:rt(r.data.cwd),gitRoot:rt(r.data.gitRoot)}}async function A_(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),r=await fetch(`/codex-api/worktree/branches?${n.toString()}`),a=await r.json();if(!r.ok)throw new Error(a.error||"Failed to load branches");const o=Array.isArray(a.data)?a.data:[],s=[],l=new Set;for(const c of o){if(!c||typeof c!="object"||Array.isArray(c))continue;const h=c,f=typeof h.value=="string"?h.value.trim():"",g=typeof h.label=="string"?h.label.trim():"";!f||l.has(f)||(l.add(f),s.push({value:f,label:g||f}))}return s}async function E_(e){const t=e.trim();if(!t)return{currentBranch:null,headSha:null,headSubject:null,headDate:null,detached:!1,dirty:!1,gitRoot:"",options:[]};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/branches?${n.toString()}`),a=await r.json();if(!r.ok)throw new Error(a.error||"Failed to load Git branch state");const o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},s=o.currentBranch,l=typeof s=="string"&&s.trim()?s.trim():null,c=Array.isArray(o.options)?o.options:[],h=[],f=new Set;for(const H of c){if(!H||typeof H!="object"||Array.isArray(H))continue;const X=H,D=typeof X.value=="string"?X.value.trim():"",j=typeof X.label=="string"?X.label.trim():"";!D||f.has(D)||(f.add(D),h.push({value:D,label:j||D,isCurrent:X.isCurrent===!0,isRemote:X.isRemote===!0}))}l&&!f.has(l)&&h.unshift({value:l,label:l,isCurrent:!0});const g=o.headSha,_=o.headSubject,E=o.headDate,O=o.gitRoot;return{currentBranch:l,headSha:typeof g=="string"&&g.trim()?g.trim():null,headSubject:typeof _=="string"&&_.trim()?_.trim():null,headDate:typeof E=="string"&&E.trim()?E.trim():null,detached:o.detached===!0,dirty:o.dirty===!0,gitRoot:typeof O=="string"?rt(O):"",options:h}}async function I_(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()}`),a=await r.json();if(!r.ok)throw new Error(a.error||"Failed to read Git repository status");const o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{};return{isGitRepo:o.isGitRepo===!0,gitRoot:typeof o.gitRoot=="string"?rt(o.gitRoot):""}}async function R_(e,t){var o;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 a=(o=r.data)==null?void 0:o.currentBranch;return typeof a=="string"&&a.trim()?a.trim():null}async function P_(e,t){const n=e.trim(),r=t.trim();if(!n||!r)return[];const a=new URLSearchParams({cwd:n,branch:r}),o=await fetch(`/codex-api/git/branch-commits?${a.toString()}`),s=await o.json();if(!o.ok)throw new Error(s.error||"Failed to load branch commits");return(Array.isArray(s.data)?s.data:[]).flatMap(c=>{if(!c||typeof c!="object"||Array.isArray(c))return[];const h=c,f=typeof h.sha=="string"?h.sha.trim():"",g=typeof h.shortSha=="string"?h.shortSha.trim():"",_=typeof h.subject=="string"?h.subject.trim():"",E=typeof h.date=="string"?h.date.trim():"";return!f||!g?[]:[{sha:f,shortSha:g,subject:_||g,date:E}]})}async function M_(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()})}),a=await r.json();if(!r.ok)throw new Error(a.error||"Failed to reset branch to commit");const o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{};return{currentBranch:typeof o.currentBranch=="string"&&o.currentBranch.trim()?o.currentBranch.trim():null,headSha:typeof o.headSha=="string"&&o.headSha.trim()?o.headSha.trim():null,headSubject:typeof o.headSubject=="string"&&o.headSubject.trim()?o.headSubject.trim():null,headDate:typeof o.headDate=="string"&&o.headDate.trim()?o.headDate.trim():null,detached:o.detached===!0,dirty:o.dirty===!0,gitRoot:typeof o.gitRoot=="string"?rt(o.gitRoot):"",options:[]}}async function KM(e,t,n,r){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});r&&r.trim()&&a.set("baseBranch",r.trim());const o=await fetch(`/codex-api/review/snapshot?${a.toString()}`),s=await o.json();if(!o.ok)throw new Error(Nn(s,"Failed to load review snapshot"));return fm(s)}async function YM(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(Nn(n,"Failed to apply review action"));return fm(n)}async function QM(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(Nn(n,"Failed to initialize Git"))}async function JM(e,t,n,r){const a=t==="baseBranch"?{type:"baseBranch",branch:(r??"").trim()}:{type:"uncommittedChanges"};if(a.type==="baseBranch"&&!a.branch)throw new Error("Base branch is unavailable");await Lt("review/start",{threadId:e,target:a,delivery:"inline"})}async function Yf(){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 $_(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()}`),a=await Vc(r);if(!r.ok){const c=Nn(a,"Failed to load local directories");throw new Error(c)}const o=a&&typeof a=="object"&&!Array.isArray(a)?a:{},s=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},l=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?rt(s.path):"",parentPath:typeof s.parentPath=="string"?rt(s.parentPath):"",entries:l.flatMap(c=>{if(!c||typeof c!="object"||Array.isArray(c))return[];const h=c,f=typeof h.name=="string"?h.name.trim():"",g=typeof h.path=="string"?rt(h.path):"";return f&&g?[{name:f,path:g}]:[]})}}async function Vc(e){const t=await e.text();if(!t)return{};try{return JSON.parse(t)}catch{throw new Error(`Expected JSON response from ${e.url||"request"}`)}}async function Lu(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");bi=fc(e)}async function ol(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 l=Nn(r,"Failed to open project root");throw new Error(l)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},s=typeof o.path=="string"?rt(o.path):"";return k_(),s}async function N_(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Vc(t);if(!t.ok){const o=Nn(n,"Failed to create local directory");throw new Error(o)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return typeof a.path=="string"?rt(a.path):""}async function L_(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 Vc(t);if(!t.ok){const s=Nn(n,"Failed to create new chat folder");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},o=typeof a.cwd=="string"?rt(a.cwd):"";if(!o)throw new Error("Failed to create new chat folder");return{cwd:o,outputDirectory:typeof a.outputDirectory=="string"?rt(a.outputDirectory):o,workspaceRoot:typeof a.workspaceRoot=="string"?rt(a.workspaceRoot):""}}async function O_(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=Nn(r,"Failed to suggest project name");throw new Error(s)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{};return{name:typeof o.name=="string"?o.name.trim():"",path:typeof o.path=="string"?rt(o.path):""}}async function j_(e,t,n=20){const r=e.trim();if(!r)return[];const a=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),o=await a.json();if(!a.ok){const h=Nn(o,"Failed to search files");throw new Error(h)}const s=o&&typeof o=="object"&&!Array.isArray(o)?o:{},l=Array.isArray(s.data)?s.data:[],c=[];for(const h of l){if(!h||typeof h!="object"||Array.isArray(h))continue;const g=h.path,_=typeof g=="string"?g.trim():"";_&&c.push({path:_})}return c}async function D_(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}async function F_(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 a=Nn(r,"Failed to connect Telegram bot");throw new Error(a)}}async function U_(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=Nn(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:{},a=Array.isArray(r.allowedUserIds)?r.allowedUserIds:[],o=[];for(const s of a){if(s==="*"){o.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&o.push(Math.trunc(s))}return{botToken:typeof r.botToken=="string"?r.botToken:"",allowedUserIds:o}}async function B_(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const a=Nn(t,"Failed to load Telegram status");throw new Error(a)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:r.configured===!0,active:r.active===!0,mappedChats:typeof r.mappedChats=="number"?r.mappedChats:0,mappedThreads:typeof r.mappedThreads=="number"?r.mappedThreads:0,allowedUsers:typeof r.allowedUsers=="number"?r.allowedUsers:0,allowAllUsers:r.allowAllUsers===!0,lastError:typeof r.lastError=="string"?r.lastError:""}}function Nn(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 a=n.error;return typeof a=="string"&&a.trim().length>0?a:t}async function q_(){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 Ou(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-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function W_(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function z_(){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 V_(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 G_(e,t){var n;try{return((n=(await Lt("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function hc(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function K_(e,t){const n=hc(e),r=n.split("/").filter(Boolean);if(r.length<2)return null;const a=r.lastIndexOf("skills");if(a>=2){const c=r[a-2]??"";if(c){const h=`/${[...r.slice(0,a+1),c,"SKILL.md"].join("/")}`;if(t.has(h))return{rootPath:h,rootName:c,isNested:h!==n}}}const o=r.indexOf("skills");if(o<0||o+1>=r.length-1)return null;const s=r[o+1]??"";if(!s)return null;const l=`/${[...r.slice(0,o+2),"SKILL.md"].join("/")}`;return t.has(l)?{rootPath:l,rootName:s,isNested:l!==n}:{rootPath:l,rootName:s,isNested:l!==n}}async function Y_(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await Lt("skills/list",t),r=n.data.flatMap(s=>s.skills),a=new Set(r.map(s=>hc(s.path)).filter(Boolean)),o=new Map;for(const s of n.data)for(const l of s.skills){if(!l.name)continue;const c=K_(l.path,a),h=hc(l.path),g=!!(c!=null&&c.isNested&&a.has(c.rootPath))?c.rootPath:h,_=h===g,E=o.get(g),O={name:l.name,displayName:c&&g===c.rootPath?c.rootName:void 0,description:l.shortDescription||l.description||"",path:g,scope:l.scope,enabled:l.enabled,__hasRoot:_};if(!E){o.set(g,O);continue}if(E.enabled=E.enabled||l.enabled,!E.__hasRoot&&_){o.set(g,O);continue}!E.displayName&&O.displayName&&(E.displayName=O.displayName),!E.description&&O.description&&(E.description=O.description)}return Array.from(o.values()).map(({__hasRoot:s,...l})=>l)}catch{return[]}}async function Q_(){try{const e=await fetch("/codex-api/prompts");if(!e.ok)return[];const t=await e.json();return Array.isArray(t.data)?t.data:[]}catch{return[]}}async function J_(e,t){try{const n=await fetch("/codex-api/prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,content:t})});return n.ok?(await n.json()).data??null:null}catch{return null}}async function X_(e){try{const t=new URLSearchParams({path:e});return(await fetch(`/codex-api/prompts?${t.toString()}`,{method:"DELETE"})).ok}catch{return!1}}const Z_=6e4;async function ju(e){const t=new AbortController,n=setTimeout(()=>t.abort(),Z_);try{const r=new FormData;r.append("file",e);const a=await fetch("/codex-api/upload-file",{method:"POST",body:r,signal:t.signal});return a.ok?(await a.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}const eT={},tT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function nT(e,t){return k(),R("svg",tT,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Xa=It(eT,[["render",nT]]),rT={},oT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function aT(e,t){return k(),R("svg",oT,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const di=It(rT,[["render",aT]]),sT={},iT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function lT(e,t){return k(),R("svg",iT,[...t[0]||(t[0]=[m("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 vs=It(sT,[["render",lT]]),uT={},cT={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function dT(e,t){return k(),R("svg",cT,[...t[0]||(t[0]=[m("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 Fs=It(uT,[["render",dT]]),fT={},hT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function pT(e,t){return k(),R("svg",hT,[...t[0]||(t[0]=[m("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 Gc=It(fT,[["render",pT]]),mT={},vT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function gT(e,t){return k(),R("svg",vT,[...t[0]||(t[0]=[m("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 yT=It(mT,[["render",gT]]),wT={},bT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function _T(e,t){return k(),R("svg",bT,[...t[0]||(t[0]=[m("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 Cs=It(wT,[["render",_T]]),TT={},kT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function CT(e,t){return k(),R("svg",kT,[...t[0]||(t[0]=[m("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 al=It(TT,[["render",CT]]),ym="codex-web-local.ui-language.v1",ST={English:"English","Simplified Chinese":"简体中文","Search threads":"搜索线程","Filter threads...":"筛选线程...","Clear search":"清除搜索",Chats:"聊天",Projects:"项目",Pinned:"已固定","Chats first":"聊天优先","Sort by":"排序",Created:"创建时间",Updated:"更新时间","New chat":"新聊天","No chats":"没有聊天","Skills Hub":"技能中心","Expand accounts":"展开账户","Collapse accounts":"折叠账户",Accounts:"账户","Reloading…":"重新加载中…",Reload:"重新加载","Run `codex login`, then click reload.":"先运行 `codex login`,然后点击重新加载。",Account:"账户",Workspace:"工作区","Require ⌘ + enter to send":"需要 ⌘ + Enter 才发送","When busy, send as":"忙碌时发送方式",Steer:"引导",Queue:"排队",Appearance:"外观",System:"跟随系统",Dark:"深色",Light:"浅色","Chat width":"聊天宽度","Click to toggle dictation":"点击切换语音输入","Auto send dictation":"语音输入后自动发送",Provider:"提供方","Choose the API provider for the Codex backend":"选择 Codex 后端使用的 API 提供方","OpenRouter API key":"OpenRouter API Key","Get API key":"获取 API Key","Remove custom key, use community keys":"移除自定义 key,改用社区 key",Set:"设置",Save:"保存","API format":"API 格式","OpenRouter API format":"OpenRouter API 格式",Responses:"Responses",Completions:"Completions","OpenCode Zen API key":"OpenCode Zen API Key","Custom endpoint URL":"自定义端点 URL","API key":"API Key","Custom endpoint API format":"自定义端点 API 格式","UI language":"界面语言","Choose the interface language for the app.":"选择应用界面语言。","Dictation language":"听写语言","Auto-detect":"自动检测","Search language...":"搜索语言...",Telegram:"Telegram","Bot token":"Bot Token","Allowed Telegram user IDs":"允许的 Telegram 用户 ID","Put one Telegram user ID per line or separate them with commas. Use `*` to allow all Telegram users. Unauthorized users will see their own ID in the rejection message so they can copy it here.":"每行填写一个 Telegram 用户 ID,或用逗号分隔。使用 `*` 可允许所有 Telegram 用户。未授权用户会在拒绝消息中看到自己的 ID,方便复制到这里。","Saving…":"保存中…","Save Telegram config":"保存 Telegram 配置",Context:"上下文","Worktree name and version":"工作树名称和版本",Settings:"设置","Toggle terminal":"切换终端","Open terminal":"打开终端","Terminal command":"终端命令","No commands":"没有命令","Search branches...":"搜索分支...","Let's build":"开始构建","Choose folder":"选择文件夹","Quick search project":"快速搜索项目","Selected folder":"已选文件夹","Select folder":"选择文件夹","Create Project":"创建项目","Current folder":"当前文件夹",Unavailable:"不可用","Opening…":"打开中…",Open:"打开","Show hidden folders":"显示隐藏文件夹","New folder":"新建文件夹","Folder name":"文件夹名称","Filter folders...":"筛选文件夹...",Retry:"重试","Loading folders…":"加载文件夹中…","No folders match this filter.":"没有匹配此筛选条件的文件夹。","No subfolders found here.":"这里没有子文件夹。","Base branch":"基础分支","Select branch":"选择分支","Loading branches…":"加载分支中…","No Git branches found for this folder.":"此文件夹未找到 Git 分支。","Local project":"本地项目","New worktree":"新工作树","Service worker registration failed.":"Service Worker 注册失败。","No matching files":"没有匹配的文件","Add photos & files":"添加图片和文件","Add folder":"添加文件夹","Take photo":"拍照","In-progress send":"执行中发送","Fast mode":"快速模式","Plan mode":"规划模式","Agent proposes a plan before acting":"代理在执行前先提出计划",Model:"模型","Search models...":"搜索模型...",Skills:"技能","Search skills...":"搜索技能...","Search skills and prompts...":"搜索技能和提示词...",Thinking:"思考强度","Saving thread before stop is available":"线程保存后才能停止",Stop:"停止","Queue message":"加入队列","Send message":"发送消息",Send:"发送","Drop images or files":"拖放图片或文件","Selected image":"已选图片","Loading messages...":"加载消息中...",Plan:"计划",Updating:"更新中","Edit this message":"编辑此消息","Edit message":"编辑消息","Fork thread from this response":"从此回复分叉线程",Fork:"分叉","Response copied":"回复已复制","Copy response":"复制回复","Jump to latest":"跳转到最新","Jump to latest output":"跳转到最新输出","Close image preview":"关闭图片预览","Expanded message image":"放大消息图片","Changed files":"已更改文件","Close diff viewer":"关闭 diff 查看器","No diff available":"没有可用 diff","This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.":"此摘要是从最终回答文本恢复的,但线程历史中不包含该文件的补丁 diff 内容。",Review:"审查","Close review pane":"关闭审查面板",Compare:"比较",Branch:"分支",Changes:"更改","Reviewing…":"审查中…","Run review":"运行审查","Loading review state":"加载审查状态中","This folder is not a Git repository":"此文件夹不是 Git 仓库","Initialize Git to review local changes and run Codex review.":"初始化 Git 后即可审查本地更改并运行 Codex review。","Initializing…":"初始化中…","Initialize Git":"初始化 Git","Base branch unavailable":"基础分支不可用","Could not resolve `origin/HEAD`, `main`, or `master` for this repository.":"无法为此仓库解析 `origin/HEAD`、`main` 或 `master`。","No changes in this scope":"此范围内没有更改","Your current workspace is clean.":"当前工作区很干净。","No merge diff found against the base branch.":"未找到相对基础分支的合并 diff。","No unified diff available.":"没有可用的统一 diff。",Summary:"摘要","No structured findings yet":"暂时没有结构化发现","The latest review only returned summary text.":"最近一次审查仅返回了摘要文本。","Run review to populate this pane.":"运行审查后会填充此面板。",Findings:"发现",Added:"新增",Deleted:"删除",Renamed:"重命名",Modified:"修改","Repository review":"仓库审查","Staged changes":"已暂存更改","Workspace changes":"工作区更改","Unstage all":"全部取消暂存","Stage all":"全部暂存","Revert all":"全部还原","Unstage file":"取消暂存文件","Stage file":"暂存文件","Revert file":"还原文件","Unstage hunk":"取消暂存代码块","Stage hunk":"暂存代码块","Revert hunk":"还原代码块","Failed to load review snapshot":"加载审查快照失败","Failed to apply review action":"应用审查操作失败","Failed to initialize Git":"初始化 Git 失败","Reviewing current changes":"正在审查当前更改","Failed to start review":"启动审查失败","Review in progress":"审查进行中","Failed to load review result":"加载审查结果失败",pin:"固定","Worktree thread":"工作树线程",Threads:"线程","Organize threads":"整理线程",Organize:"整理","By project":"按项目","Chronological list":"按时间顺序","No matching threads":"没有匹配的线程","Loading threads...":"加载线程中...","Edit name":"编辑名称",Remove:"移除","Project name":"项目名称","No threads":"没有线程","Thread title":"线程标题","Rename thread":"重命名线程","Make it short and recognizable.":"尽量简短且易识别。","Add title...":"输入标题...",Cancel:"取消","Delete thread":"删除线程","Thread automation":"线程自动化","This creates a heartbeat automation attached to the selected thread.":"这会创建一个附加到所选线程的心跳自动化。",Name:"名称","Automation name":"自动化名称",Prompt:"提示词","Search prompt...":"搜索提示词...","Describe what the automation should do":"描述自动化需要执行的内容","Schedule (RRULE)":"计划(RRULE)",Status:"状态",Active:"启用",Paused:"暂停","Expand sidebar":"展开侧边栏","Collapse sidebar":"折叠侧边栏","Start new thread":"新建线程","No skills found":"未找到技能","No results":"没有结果","Approval choices":"审批选项","No, and tell Codex what to do differently":"不允许,并告诉 Codex 应如何调整",Skip:"跳过",Server:"服务器","Open authorization link":"打开授权链接",Value:"值",Choice:"选项","Select true or false":"选择 true 或 false",True:"True",False:"False","Select an option":"选择一个选项",Decline:"拒绝",Continue:"继续","Other answer":"其他答案","Fail Tool Call":"使工具调用失败","Success (Empty)":"成功(空结果)","Return Empty Result":"返回空结果","New terminal":"新终端","Hide terminal":"隐藏终端",Close:"关闭","Edit queued message":"编辑排队消息","Send now without interrupting work":"立即发送且不中断当前工作","Delete queued message":"删除排队消息","AppServer API":"AppServer API","Loading method catalog...":"加载方法目录中...",Disabled:"已禁用",Installed:"已安装","Browse files":"浏览文件","Loading skill contents...":"加载技能内容中...","View on GitHub":"在 GitHub 查看","Show all":"显示全部","Hide all":"隐藏全部","No types yet":"还没有类型","Manage installed skills on this machine":"管理此机器上已安装的技能","Skills Sync (GitHub)":"技能同步(GitHub)",Connected:"已连接","Logged in as":"已登录为","Not connected":"未连接",Startup:"启动",Action:"动作","Manual sync":"手动同步","GitHub device login":"GitHub 设备登录","and enter code:":"并输入代码:","Login with GitHub":"使用 GitHub 登录","Device Login":"设备登录","Logout GitHub":"退出 GitHub","Syncing...":"同步中...","Startup Sync":"启动同步","Pulling...":"拉取中...",Pull:"拉取","Pushing...":"推送中...",Push:"推送","Installed ({count})":"已安装({count})","Find skills":"查找技能","Search the Skills registry with npx skills find.":"使用 npx skills find 搜索 Skills 注册表。","Searching...":"搜索中...","Search results ({count})":"搜索结果({count})","No matching skills found.":"未找到匹配的技能。","No installed skills found.":"未找到已安装的技能。","Continue in":"运行方式","Search daily":"搜索(日)","Search weekly":"搜索(周)","Search monthly":"搜索(月)","Trending daily":"热门(日)","Trending weekly":"热门(周)","Trending monthly":"热门(月)",Newest:"最新","A-Z":"A-Z","Loading skills...":"加载技能中...","Choose a thread":"选择一个线程","New worktree branch will start from {branch}.":"新工作树分支将从 {branch} 开始。","Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.":"本地项目会直接使用所选文件夹。新工作树会在第一次提问前创建一个隔离的 Git worktree。","Not configured":"未配置",Online:"在线","Configured (offline)":"已配置(离线)","allow all users":"允许所有用户","allowed user(s)":"个允许用户","chat(s)":"个聊天","thread(s)":"个线程",error:"错误",unknown:"未知","Switching…":"切换中…",Switch:"切换","Removing…":"移除中…","Click again to remove":"再次点击以移除","402 Payment Required":"402 需要付费","weekly remaining":"周剩余额度","Unlimited credits":"无限额度",credits:"额度","Loading quota…":"加载额度中…","Quota unavailable":"额度不可用","Fetching account details…":"获取账户详情中…","Unavailable account":"不可用账户","Waiting for Codex thread/tokenUsage/updated events for this thread.":"等待此线程的 Codex tokenUsage 更新事件。","Current context usage":"当前上下文使用量","Cumulative thread usage":"累计线程使用量","Model context window":"模型上下文窗口","Remaining context":"剩余上下文",tokens:"tokens","Model context window is unavailable in the latest usage event.":"最新使用事件中未提供模型上下文窗口。","Awaiting data":"等待数据中",left:"剩余",used:"已用","Updates after the next token usage event":"下次 token 使用事件后更新","Window size unavailable":"窗口大小不可用","Telegram bot token is required.":"需要填写 Telegram Bot Token。","At least one allowed Telegram user ID or * is required.":"至少需要一个允许的 Telegram 用户 ID 或 `*`。","Telegram bot configured. Only allowlisted Telegram users can use the bridge.":"Telegram 机器人已配置。只有白名单中的 Telegram 用户可以使用桥接。","Failed to connect Telegram bot":"连接 Telegram 机器人失败","Failed to load accounts":"加载账户失败","Failed to refresh accounts":"刷新账户失败",Login:"登录","Starting login…":"正在启动登录…","Open login URL":"打开登录链接","Paste localhost callback URL":"粘贴 localhost 回调 URL","Complete Codex login":"完成 Codex 登录","Finish login in the browser, then paste the localhost callback URL here.":"在浏览器中完成登录,然后在这里粘贴 localhost 回调 URL。",Complete:"完成","Completing…":"正在完成…","Failed to start Codex login":"启动 Codex 登录失败","Failed to complete Codex login":"完成 Codex 登录失败","Click Login, or run `codex login`, then click reload.":"点击登录,或运行 `codex login`,然后点击重新加载。","Finish the current turn and pending requests before switching accounts.":"请先完成当前轮次并处理待处理请求后再切换账户。","Failed to switch account":"切换账户失败","Finish the current turn and pending requests before removing the active account.":"请先完成当前轮次并处理待处理请求后再移除当前活动账户。","Failed to remove account":"移除账户失败",enabled:"已启用",disabled:"已禁用","Saving speed setting...":"保存速度设置中...","About 1.5x faster, with credits used at 2x":"速度约提升 1.5 倍,额度消耗为 2 倍","Default speed with normal credit usage":"默认速度,按正常额度消耗","Stop dictation":"停止听写","Click to dictate":"点击开始听写","Hold to dictate":"按住听写",failed:"失败",attaching:"正在附加",Attaching:"正在附加","Attaching file...":"正在附加文件...","files...":"个文件...",attached:"已附加","Could not attach file.":"无法附加文件。","Could not attach":"无法附加","files.":"个文件。","Select a thread to send a message":"选择一个线程后才能发送消息","Loading models for plan mode...":"正在为规划模式加载模型...","Type a message... (@ for files)":"输入消息...(@ 选择文件)",Hide:"隐藏",Terminal:"终端","Terminal input failed":"终端输入失败","Terminal attach failed":"终端附加失败","Creating worktree":"创建工作树","Creating a worktree and running setup.":"正在创建工作树并执行初始化。","Worktree setup failed":"工作树初始化失败","Unable to create worktree. Try again or switch to Local project.":"无法创建工作树。请重试,或切换到本地项目。",Edit:"编辑",image:"图片",images:"图片",file:"文件",files:"文件",skill:"技能",skills:"技能","(empty queued message)":"(空的排队消息)",Files:"文件",Unstaged:"未暂存",Staged:"已暂存",Refresh:"刷新",Against:"对比",selected:"已选","Reject Request":"拒绝请求","Uninstalling...":"卸载中...",Uninstall:"卸载","Installing...":"安装中...",Install:"安装",Disable:"禁用",Enable:"启用","When enabled, press Enter to send. When disabled, use Command+Enter to send.":"启用时按 Enter 发送;禁用时使用 Command+Enter 发送。","If a turn is still running, choose whether a new prompt should steer the current turn or be queued.":"如果当前轮次仍在运行,选择新提示是引导当前轮次还是加入队列。","Switch between system theme, light mode, and dark mode.":"在跟随系统、浅色和深色主题之间切换。","Choose how wide the conversation column and composer can grow on desktop screens.":"选择桌面端会话列和输入框的最大宽度。","Use click-to-start and click-to-stop dictation instead of hold-to-talk.":"使用点击开始/停止听写,而不是按住说话。","Automatically send transcribed dictation when recording stops.":"录音停止后自动发送转写结果。","Show or hide GitHub trending project cards on the new thread screen.":"显示或隐藏新线程页面上的 GitHub 热门项目卡片。","Choose transcription language or keep auto-detect.":"选择转写语言,或保持自动检测。",Standard:"标准",Wide:"宽","Extra wide":"超宽"},Qf={en:"English","zh-CN":"简体中文"};function xT(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(ym))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const Wl=A(xT());function wm(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}wm(Wl.value);function AT(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??"")):e}function ET(e){Wl.value=e,wm(e),typeof window<"u"&&window.localStorage.setItem(ym,e)}function bm(e,t){const n=Wl.value==="zh-CN"?ST[e]??e:e;return AT(n,t)}function Ma(){return{uiLanguage:Wl,uiLanguageOptions:[{value:"en",label:Qf.en},{value:"zh-CN",label:Qf["zh-CN"]}],t:bm,setUiLanguage:ET}}const IT={key:0,class:"sidebar-menu-row-left"},RT={class:"sidebar-menu-row-main"},PT={key:1,class:"sidebar-menu-row-right"},MT={key:0,class:"sidebar-menu-row-right-default"},$T={key:1,class:"sidebar-menu-row-right-hover"},NT=Hn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=fy(),r=ne(()=>!!n.left),a=ne(()=>!!n.right),o=ne(()=>!!n["right-hover"]),s=ne(()=>a.value||o.value);return(l,c)=>(k(),Ze(Lc(t.as),jp({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":s.value,"data-has-right-hover":o.value,"data-force-right-hover":t.forceRightHover},l.$attrs),{default:ht(()=>[r.value?(k(),R("span",IT,[Lo(l.$slots,"left",{},void 0,!0)])):J("",!0),m("span",RT,[Lo(l.$slots,"default",{},void 0,!0)]),s.value?(k(),R("span",PT,[a.value?(k(),R("span",MT,[Lo(l.$slots,"right",{},void 0,!0)])):J("",!0),o.value?(k(),R("span",$T,[Lo(l.$slots,"right-hover",{},void 0,!0)])):J("",!0)])):J("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),lo=It(NT,[["__scopeId","data-v-36239f39"]]),LT=["title","aria-label","disabled"],OT={key:1,class:"composer-dropdown-value"},jT={class:"composer-dropdown-menu"},DT={key:0,class:"composer-dropdown-search-wrap"},FT=["placeholder","onKeydown"],UT={class:"composer-dropdown-options",role:"listbox"},BT=["onClick"],qT={key:0,class:"composer-dropdown-empty"},HT=Hn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},iconOnly:{type:Boolean},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},emptyLabel:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,a=A(null),o=A(null),s=A(!1),l=A(""),c=ne(()=>{var be;const Z=n.options.find(pe=>pe.value===n.modelValue);return Z?Z.label:((be=n.placeholder)==null?void 0:be.trim())||""}),h=ne(()=>n.openDirection??"down"),f=ne(()=>n.iconOnly===!0),g=ne(()=>n.enableSearch===!0),_=ne(()=>{var Z;return((Z=n.searchPlaceholder)==null?void 0:Z.trim())||"Quick search projects"}),E=ne(()=>{var Z;return((Z=n.emptyLabel)==null?void 0:Z.trim())||"No results"}),O=ne(()=>{var Z;return c.value||((Z=n.placeholder)==null?void 0:Z.trim())||"Select option"}),H=ne(()=>{const Z=l.value.trim().toLowerCase();return Z?n.options.filter(be=>be.label.toLowerCase().includes(Z)||be.value.toLowerCase().includes(Z)):n.options});function X(){n.disabled||(s.value=!s.value)}function D(Z){r("update:modelValue",Z),s.value=!1,l.value=""}function j(){if(l.value.length>0){l.value="";return}s.value=!1}function K(Z){if(!s.value)return;const be=a.value;if(!be)return;const pe=Z.target;pe instanceof Node&&(be.contains(pe)||(s.value=!1,l.value=""))}return pt(s,Z=>{Z&&g.value&&Xt(()=>{var be;return(be=o.value)==null?void 0:be.focus()})}),ca(()=>{window.addEventListener("pointerdown",K)}),Pa(()=>{window.removeEventListener("pointerdown",K)}),(Z,be)=>(k(),R("div",{ref_key:"rootRef",ref:a,class:"composer-dropdown"},[m("button",{class:"composer-dropdown-trigger",type:"button",title:O.value,"aria-label":O.value,disabled:e.disabled,onClick:X},[e.selectedPrefixIcon?(k(),Ze(Lc(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):J("",!0),f.value?J("",!0):(k(),R("span",OT,$(c.value),1)),Oe(Xa,{class:"composer-dropdown-chevron"})],8,LT),s.value?(k(),R("div",{key:0,class:et(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":h.value==="up","composer-dropdown-menu-wrap-down":h.value==="down"}])},[m("div",jT,[g.value?(k(),R("div",DT,[tn(m("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":be[0]||(be[0]=pe=>l.value=pe),class:"composer-dropdown-search-input",type:"text",placeholder:_.value,onKeydown:mn(Xe(j,["prevent"]),["esc"])},null,40,FT),[[un,l.value]])])):J("",!0),m("ul",UT,[(k(!0),R(Ye,null,Kt(H.value,pe=>(k(),R("li",{key:pe.value},[m("button",{class:et(["composer-dropdown-option",{"is-selected":pe.value===e.modelValue}]),type:"button",onClick:de=>D(pe.value)},$(pe.label),11,BT)]))),128)),H.value.length===0?(k(),R("li",qT,$(E.value),1)):J("",!0)])])],2)):J("",!0)],512))}}),Lr=It(HT,[["__scopeId","data-v-5243a93d"]]),WT={key:0,class:"pinned-section"},zT={class:"thread-tree-header"},VT={key:0,class:"thread-list"},GT=["data-menu-open"],KT={class:"thread-left-stack"},YT=["data-state"],QT=["data-confirming","title","onClick"],JT={key:0,class:"thread-delete-confirm-label"},XT=["onClick"],ZT={class:"thread-row-title-wrap"},ek={class:"thread-row-title-line"},tk={class:"thread-row-title"},nk=["title"],rk=["data-state"],ok={class:"thread-row-time"},ak=["onClick"],sk={class:"projects-section"},ik={class:"thread-tree-header"},lk=["aria-expanded","aria-label","title"],uk={class:"organize-menu-title"},ck=["data-active"],dk={key:0},fk=["data-active"],hk={key:0},pk=["data-active"],mk={key:0},vk={class:"organize-menu-title"},gk=["data-active"],yk={key:0},wk=["data-active"],bk={key:0},_k={key:0,class:"thread-tree-no-results"},Tk={key:1,class:"thread-tree-loading"},kk={key:2,class:"thread-list thread-list-global"},Ck=["data-menu-open"],Sk={class:"thread-left-stack"},xk=["data-state"],Ak=["data-confirming","title","onClick"],Ek={key:0,class:"thread-delete-confirm-label"},Ik=["onClick"],Rk={class:"thread-row-title-wrap"},Pk={class:"thread-row-title-line"},Mk={class:"thread-row-title"},$k=["title"],Nk=["data-state"],Lk={class:"thread-row-time"},Ok=["onClick"],jk=["data-project-name","data-expanded","data-dragging"],Dk={class:"project-icon-stack"},Fk={class:"project-icon-folder"},Uk={class:"project-icon-chevron"},Bk=["data-dragging-handle","onMousedown"],qk=["title"],Hk={class:"project-hover-controls"},Wk=["onClick"],zk=["data-open-direction"],Vk=["onClick"],Gk=["onClick"],Kk=["onClick"],Yk=["onClick"],Qk={class:"project-menu-label"},Jk=["onInput"],Xk=["aria-label","title","onClick"],Zk={key:0,class:"thread-list"},e1=["data-menu-open"],t1={class:"thread-left-stack"},n1=["data-state"],r1=["data-confirming","title","onClick"],o1={key:0,class:"thread-delete-confirm-label"},a1=["onClick"],s1={class:"thread-row-title-wrap"},i1={class:"thread-row-title-line"},l1={class:"thread-row-title"},u1=["title"],c1=["data-state"],d1={class:"thread-row-time"},f1=["onClick"],h1={class:"project-empty"},p1=["onClick"],m1={class:"chats-section"},v1={class:"thread-tree-header"},g1={class:"chats-section-actions"},y1=["aria-label","title"],w1={key:0,class:"thread-tree-no-results"},b1={key:1,class:"thread-list thread-list-global"},_1=["data-menu-open"],T1={class:"thread-left-stack"},k1=["data-state"],C1=["data-confirming","title","onClick"],S1={key:0,class:"thread-delete-confirm-label"},x1=["onClick"],A1={class:"thread-row-title-wrap"},E1={class:"thread-row-title-line"},I1={class:"thread-row-title"},R1=["title"],P1=["data-state"],M1={class:"thread-row-time"},$1=["onClick"],N1=["data-open-direction"],L1={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},O1={class:"rename-thread-title"},j1=["onKeydown"],D1={class:"rename-thread-actions"},F1={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},U1={class:"rename-thread-title"},B1={class:"rename-thread-subtitle"},q1={class:"rename-thread-actions"},H1={class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread automation"},W1={class:"rename-thread-title"},z1={key:0,class:"automation-thread-list","aria-label":"Thread automations"},V1=["onClick"],G1={class:"automation-thread-field"},K1={class:"automation-thread-field"},Y1={class:"automation-thread-field"},Q1={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},J1={key:0,class:"automation-schedule-row"},X1={key:1,class:"automation-schedule-row"},Z1={class:"automation-schedule-preview"},eC={class:"automation-thread-field"},tC={key:1,class:"rename-thread-subtitle automation-thread-error"},nC={key:2,class:"rename-thread-subtitle automation-thread-notice"},rC={class:"rename-thread-actions"},oC=["disabled"],aC=["disabled"],sC=["disabled"],iC=["disabled"],lC=4,Jf=6,Xf="codex-web-local.sidebar-section-expansion.v1",Zf="codex-web-local.sidebar-chats-first.v1",eh="codex-web-local.sidebar-chat-sort-mode.v1",th="codex-web-local.thread-view-mode.v1",nh="codex-web-local.collapsed-projects.v1",uC=Hn({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},projectGitRepoByName:{},selectedThreadId:{},isLoading:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-thread-files","browse-project-files","request-project-git-status","create-project-worktree","rename-project","rename-thread","remove-project","reorder-project","export-thread","fork-thread","start-new-chat"],setup(e,{emit:t}){const n=e,{t:r}=Ma(),a=t,o=A({}),s=A({}),l=A(!0),c=A(!0),h=A(!0),f=A(!1),g=A(lt(Zf,!1)),_=A(gt());let E=!1;const O=A([]),H=A(""),X=A([]),D=A(""),j=A(""),K=A({}),Z=A({}),be=A({}),pe=A("actions"),de=A(""),Pe=A(!1),G=A(""),ve=A(""),Te=A(null),oe=A(!1),ke=A(""),De=A(""),Be=A({}),Ke=A(!1),Le=A(""),Se=A(""),Qe=A("create"),tt=A(""),Ue=A(""),He=A(!1),ft=A(!1),Je=A({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),We=A({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),Tt=[{value:"minutes",label:"minutes"},{value:"hours",label:"hours"},{value:"days",label:"days"}],ee=ne(()=>[{value:"ACTIVE",label:r("Active")},{value:"PAUSED",label:r("Paused")}]),xe=ne(()=>{const y=Le.value;return y?Be.value[y]??[]:[]}),Ae=ne(()=>Sr(Je.value.rrule)),Fe=A(null),Ge=A(null),x=A(null);let P=null,z=null;const ae=A(""),Q=A({}),le=new Map,fe=new Map,ye=new Map,we=new WeakMap,he=A(null),je=A(null),me=A(!1),Me=A(dt()),Ie=typeof window<"u"?new ResizeObserver(y=>{for(const b of y){const w=b.target,L=we.get(w);L&&oo(L,w)}}):null;function at(){if(typeof window>"u")return{};try{const y=window.localStorage.getItem(nh);if(!y)return{};const b=JSON.parse(y);return!b||typeof b!="object"||Array.isArray(b)?{}:b}catch{return{}}}function dt(){return typeof window>"u"?"project":window.localStorage.getItem(th)==="chronological"?"chronological":"project"}function lt(y,b){if(typeof window>"u")return b;const w=window.localStorage.getItem(y);return w==="true"?!0:w==="false"?!1:b}function gt(){return typeof window>"u"?"updated":window.localStorage.getItem(eh)==="created"?"created":"updated"}s.value=at();function kt(){if(!(typeof window>"u"))try{const y=JSON.parse(window.localStorage.getItem(Xf)||"{}");typeof y.pinned=="boolean"&&(l.value=y.pinned),typeof y.projects=="boolean"&&(c.value=y.projects),typeof y.chats=="boolean"&&(h.value=y.chats)}catch{}}function q(){typeof window>"u"||window.localStorage.setItem(Xf,JSON.stringify({pinned:l.value,projects:c.value,chats:h.value}))}kt(),pt(s,y=>{typeof window>"u"||window.localStorage.setItem(nh,JSON.stringify(y))},{deep:!0}),pt(Me,y=>{typeof window>"u"||window.localStorage.setItem(th,y)}),pt(g,y=>{typeof window>"u"||window.localStorage.setItem(Zf,String(y))}),pt(_,y=>{typeof window>"u"||window.localStorage.setItem(eh,y)}),pt([l,c,h],q);const U=ne(()=>n.searchQuery.trim().toLowerCase()),F=ne(()=>U.value.length>0),se=ne(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null),Ce=ne(()=>new Set(O.value)),Ne=ne(()=>new Set(X.value));function ze(y){if(Ne.value.has(y.id))return!1;if(!F.value)return!0;if(se.value)return se.value.has(y.id);const b=U.value;return y.title.toLowerCase().includes(b)||y.preview.toLowerCase().includes(b)}const xt=ne(()=>n.groups.flatMap(y=>{const b=y.threads.filter(w=>!Cl(w.cwd)&&ze(w));return b.length>0?[{...y,threads:b}]:!F.value&&y.threads.length===0?[{...y,threads:b}]:[]})),Bt=ne(()=>Me.value==="chronological"),Wt=ne(()=>{const y=[];for(const b of n.groups)for(const w of b.threads)Ce.value.has(w.id)||ze(w)&&y.push(w);return y.sort((b,w)=>{const L=new Date(b.updatedAtIso||b.createdAtIso).getTime();return new Date(w.updatedAtIso||w.createdAtIso).getTime()-L})}),Wn=ne(()=>{const y=Wt.value.filter(w=>Cl(w.cwd)),b=_.value==="created"?"createdAtIso":"updatedAtIso";return y.sort((w,L)=>{const Ee=new Date(w[b]||w.updatedAtIso||w.createdAtIso).getTime();return new Date(L[b]||L.updatedAtIso||L.createdAtIso).getTime()-Ee})}),pr=ne(()=>F.value||f.value?Wn.value:Wn.value.slice(0,10)),Xr=ne(()=>F.value?!1:Wn.value.length>10),Ln=ne(()=>{const y=new Map;for(const b of n.groups)for(const w of b.threads)Ne.value.has(w.id)||y.set(w.id,w);return y});pt(O,y=>{E&&W_(y)}),pt(Ln,y=>{const b=O.value.filter(w=>y.has(w));b.length!==O.value.length&&(O.value=b)}),ca(async()=>{const{threadIds:y}=await H_(),b=Array.isArray(y)?y.filter(w=>typeof w=="string").map(w=>w.trim()).filter((w,L,Ee)=>w.length>0&&Ee.indexOf(w)===L):[];b.length>0&&(O.value=b);try{Be.value=await H0()}catch{Be.value={}}E=!0});const Cr=ne(()=>In(ke.value)),fa=ne(()=>{const y=new Map;for(const b of n.groups)for(const w of b.threads)y.set(w.id,b.projectName);return y}),Do=ne(()=>{const y=new Map;for(const b of n.groups){const w=b.threads.filter(L=>!Ce.value.has(L.id)&&!Ne.value.has(L.id));y.set(b.projectName,w)}return y}),vn=ne(()=>{const y=new Map;for(const b of n.groups)for(const w of b.threads){const L=new Date(w.updatedAtIso||w.createdAtIso).getTime();y.set(w.id,L)}return y}),Zt=ne(()=>{const y=j.value;return y?Ln.value.get(y)??null:null}),wo=ne(()=>O.value.map(y=>Ln.value.get(y)??null).filter(y=>y!==null).filter(ze));function Fo(){l.value=!l.value}function ot(){c.value=!c.value}function cn(){h.value=!h.value}const zt=ne(()=>{const y=x.value;if(!y||y.dropTargetIndexFull===null||n.groups.length===0)return null;const b=Math.max(0,Math.min(y.dropTargetIndexFull,n.groups.length)),w=b>y.fromIndex?b-1:b,L=Math.max(0,Math.min(w,n.groups.length-1));return L===y.fromIndex?null:L}),Or=ne(()=>{const b=(F.value?xt.value:n.groups).map(Pt=>Pt.projectName),w=x.value,L=zt.value;if(!w||L===null)return b;const Ee=[...b],[ut]=Ee.splice(w.fromIndex,1);return ut?(Ee.splice(L,0,ut),Ee):b}),nn=ne(()=>{const y={};let b=0;for(const w of Or.value)y[w]=b,b+=br(w);return y}),zn=ne(()=>{let y=0;for(const b of Or.value)y+=br(b);return{height:`${Math.max(0,y)}px`}});function Zr(y){if(Number.isNaN(y))return"n/a";const b=Math.abs(Date.now()-y);if(b<6e4)return"now";const w=Math.floor(b/6e4);if(w<60)return`${w}m`;const L=Math.floor(w/60);return L<24?`${L}h`:`${Math.floor(L/24)}d`}function dn(y){const b=vn.value.get(y.id);return Zr(typeof b=="number"?b:new Date(y.updatedAtIso||y.createdAtIso).getTime())}function Dt(y){return Ce.value.has(y)}function rn(y){if(Dt(y)){O.value=O.value.filter(b=>b!==y);return}O.value=[y,...O.value]}function wn(y){rn(y),yt()}function on(y){H.value="",a("select",y)}function In(y){var b;return(((b=Be.value[y])==null?void 0:b.length)??0)>0}function eo(y){const b=Be.value[y]??[];if(b.length===0)return"";if(b.length>1){const Ee=b.filter(ut=>ut.status==="ACTIVE").length;return`${b.length} automations • ${Ee} active`}const[w]=b,L=w.status==="PAUSED"?"-":w.nextRunAtMs?new Date(w.nextRunAtMs).toLocaleString():"Not scheduled";return`${w.name} • Next run: ${L}`}function On(y){return String(Math.max(0,y)).padStart(2,"0")}function to(y,b){const w=typeof y=="number"?y:Number(y);return Number.isFinite(w)?Math.max(1,Math.floor(w)):b}function bo(y){const[b,w]=y.split(":"),L=Math.min(23,Math.max(0,Number(b)||0)),Ee=Math.min(59,Math.max(0,Number(w)||0));return`FREQ=DAILY;BYHOUR=${L};BYMINUTE=${Ee}`}function Zn(y,b){const w=to(y,1);return b==="minutes"?`FREQ=MINUTELY;INTERVAL=${w}`:b==="hours"?`FREQ=HOURLY;INTERVAL=${w}`:`FREQ=DAILY;INTERVAL=${w}`}function jr(y){return Object.fromEntries(y.split(";").map(b=>b.trim()).filter(Boolean).map(b=>{const[w,...L]=b.split("=");return[w.toUpperCase(),L.join("=").trim()]}).filter(([b,w])=>b&&w))}function er(y){var Ee;const b=jr(y),w=(Ee=b.FREQ)==null?void 0:Ee.toUpperCase(),L=to(b.INTERVAL,1);if(w==="DAILY"&&b.BYHOUR!==void 0&&b.BYMINUTE!==void 0&&L===1){const ut=Math.min(23,Math.max(0,Number(b.BYHOUR)||0)),Pt=Math.min(59,Math.max(0,Number(b.BYMINUTE)||0));return{mode:"daily",dailyTime:`${On(ut)}:${On(Pt)}`,interval:1,intervalUnit:"hours"}}return w==="MINUTELY"||w==="HOURLY"||w==="DAILY"&&b.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:L,intervalUnit:w==="MINUTELY"?"minutes":w==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function Sr(y){var Ee;const b=jr(y),w=(Ee=b.FREQ)==null?void 0:Ee.toUpperCase(),L=to(b.INTERVAL,1);if(w==="DAILY"&&b.BYHOUR!==void 0&&b.BYMINUTE!==void 0&&L===1){const ut=Math.min(23,Math.max(0,Number(b.BYHOUR)||0)),Pt=Math.min(59,Math.max(0,Number(b.BYMINUTE)||0));return`RRULE: ${y} · runs daily at ${On(ut)}:${On(Pt)}`}return w==="MINUTELY"?`RRULE: ${y} · runs every ${L} minute${L===1?"":"s"}`:w==="HOURLY"?`RRULE: ${y} · runs every ${L} hour${L===1?"":"s"}`:w==="DAILY"&&b.INTERVAL!==void 0?`RRULE: ${y} · runs every ${L} day${L===1?"":"s"}`:y?`RRULE: ${y}`:"RRULE is required."}function bn(){const y=We.value;y.mode==="daily"?Je.value.rrule=bo(y.dailyTime):y.mode==="interval"&&(Je.value.rrule=Zn(y.interval,y.intervalUnit))}function Dr(){We.value=er(Je.value.rrule)}function jn(y){y!=="minutes"&&y!=="hours"&&y!=="days"||(We.value.intervalUnit=y,bn())}function tr(y){We.value={...We.value,mode:y},bn()}function Vn(y){a("export-thread",y),yt()}function _o(y){a("fork-thread",y),yt()}function Ft(y){return`start new thread ${Pn(y)}`}function mr(y){a("start-new-thread",y)}function xr(y){a("browse-thread-files",y),yt()}async function Ar(y){var w,L;const b=((L=(w=Ln.value.get(y))==null?void 0:w.cwd)==null?void 0:L.trim())??"";if(yt(),!(!b||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(b)}catch{}}function fn(y,b){if(j.value===y){if(b){const w=b.relatedTarget,L=je.value;if(w instanceof Node&&L&&L.contains(w))return}yt()}}function Ct(y){return j.value===y}function yt(){j.value="",be.value={}}function nr(y){if(H.value="",j.value===y){yt();return}Re(),me.value=!1,j.value=y,Xt(()=>{ro(y)})}function Rn(y,b){y.preventDefault(),H.value="",j.value=b}function Fr(y,b){G.value=y,ve.value=b,Pe.value=!0,yt(),Xt(()=>{var w,L;(w=Te.value)==null||w.focus(),(L=Te.value)==null||L.select()})}function gn(){Pe.value=!1,G.value="",ve.value=""}function vr(){const y=G.value,b=ve.value.trim();!y||!b||(a("rename-thread",{threadId:y,title:b}),gn())}function To(y,b){H.value="",ke.value=y,De.value=b,oe.value=!0,yt()}function wt(){oe.value=!1,ke.value="",De.value=""}async function Et(){const y=ke.value;y&&(Qt(y),wt())}function Ot(y){return H.value===y}function hn(y){if(H.value!==y){H.value=y,yt();return}Qt(y),H.value=""}function Qt(y){Ne.value.has(y)||(X.value=[y,...X.value]),H.value="",yt(),O.value=O.value.filter(b=>b!==y),a("archive",y),In(y)&&(qf(y).catch(()=>{}),Be.value=rr(Be.value,y))}function Ur(y){var w;Le.value=y,tt.value="",Ue.value="";const b=(w=Be.value[y])==null?void 0:w[0];b?yn(b.id):gr(),Ke.value=!0,yt()}function gr(){Se.value="",Qe.value="create",tt.value="",Ue.value="",Je.value={name:"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},We.value=er(Je.value.rrule)}function yn(y){const b=xe.value.find(w=>w.id===y);b&&(Se.value=b.id,Qe.value="edit",tt.value="",Ue.value="",Je.value={name:b.name,prompt:b.prompt,rrule:b.rrule,status:b.status},We.value=er(b.rrule))}function Er(){Ke.value=!1,Le.value="",Se.value="",tt.value="",Ue.value="",He.value=!1,ft.value=!1}function rr(y,b){return Object.fromEntries(Object.entries(y).filter(([w])=>w!==b))}function Dn(y,b,w){const L=y[b]??[],Ee=L.findIndex(Pt=>Pt.id===w.id),ut=[...L];return Ee>=0?ut.splice(Ee,1,w):ut.push(w),{...y,[b]:ut}}function Gn(y,b,w){const L=(y[b]??[]).filter(Ee=>Ee.id!==w);return L.length>0?{...y,[b]:L}:rr(y,b)}async function Vt(){const y=Le.value;if(y){He.value=!0,tt.value="",Ue.value="";try{bn();const b=await W0({threadId:y,id:Se.value||void 0,name:Je.value.name,prompt:Je.value.prompt,rrule:Je.value.rrule,status:Je.value.status});Be.value=Dn(Be.value,y,b),yn(b.id),Ue.value="Automation saved.",He.value=!1}catch(b){tt.value=b instanceof Error?b.message:"Failed to save automation",He.value=!1}}}async function yr(){var w;const y=Le.value,b=Se.value;if(!(!y||!b)){He.value=!0,tt.value="",Ue.value="";try{await qf(y,b),Be.value=Gn(Be.value,y,b);const L=(w=Be.value[y])==null?void 0:w[0];L?yn(L.id):gr(),He.value=!1}catch(L){tt.value=L instanceof Error?L.message:"Failed to remove automation",He.value=!1}}}async function Br(){const y=Le.value,b=Se.value;if(!(!y||!b)){ft.value=!0,tt.value="",Ue.value="";try{await z0(y,b),Ue.value="Automation run queued."}catch(w){tt.value=w instanceof Error?w.message:"Failed to run automation"}finally{ft.value=!1}}}function Pn(y){return n.projectDisplayNameById[y]??y}function wr(y){return y.includes("/")||y.includes("\\")}function Mn(y){return wr(y)?y:Pn(y)}function I(y){const b=Nr(y);if(!b)return!1;let w=0;for(const L of n.groups)if(wr(L.projectName)&&Nr(L.projectName)===b&&(w+=1,w>1))return!0;return!1}function B(y){const b=n.projectDisplayNameById[y.projectName],w=Pn(y.projectName),L=y.projectName;if(b&&!wr(L)&&L!==w)return w.includes(L)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(L)?w:`${w} ${L}`;if(b&&wr(L)){const Pt=Nr(L),Cn=Nr(Ms(L)),an=I(L)?Cn:Pt;return an&&an!==w?`${w} ${an}`:w}if(!w.includes("/")&&!w.includes("\\"))return w;const Ee=Nr(w)||w,ut=Nr(Ms(w));return ut.startsWith(".")&&ut!==Ee?`${Ee} ${ut}`:y.threads.length>0||!I(L)?Ee:ut?`${Ee} ${ut}`:Ee}function re(y){return D.value===y}function Re(){D.value="",pe.value="actions",de.value=""}function vt(){const y=!me.value;y&&(Re(),yt()),me.value=y}function Jt(y){Me.value=y,me.value=!1}function pn(){g.value=!g.value}function $e(y){_.value=y}function _e(y){a("request-project-git-status",y),Xt(()=>{Pr(y)})}function mt(y){if(D.value===y){Re();return}yt(),me.value=!1,D.value=y,pe.value="actions",de.value=Pn(y),_e(y)}function _n(y){yt(),me.value=!1,D.value=y,pe.value="actions",de.value=Pn(y),_e(y)}function Kn(y){return n.projectDisplayNameById[y.projectName]??B(y)}function qs(y){yt();const b=y.projectName;D.value=b,pe.value="rename",de.value=Kn(y),Xt(()=>{Pr(b)})}function en(y){a("browse-project-files",y),Re()}function Uo(y){a("create-project-worktree",y),Re()}function no(y){a("rename-project",{projectName:y,displayName:de.value})}function Ir(y){a("remove-project",y),Re()}function Bo(y,b){if(!y.altKey||y.key!=="ArrowUp"&&y.key!=="ArrowDown")return;const w=n.groups.findIndex(ut=>ut.projectName===b);if(w<0)return;const L=y.key==="ArrowUp"?-1:1,Ee=Math.max(0,Math.min(w+L,n.groups.length-1));Ee!==w&&(y.preventDefault(),a("reorder-project",{projectName:b,toIndex:Ee}))}function qo(y){return o.value[y]===!0}function or(y){return s.value[y]===!0}function Ho(y){o.value={...o.value,[y]:!qo(y)}}function qr(){f.value=!f.value}function ko(y){if(ae.value===y){ae.value="";return}s.value={...s.value,[y]:!or(y)}}function br(y){const b=Q.value[y]??0,w=x.value,Ee=((w==null?void 0:w.projectName)===y?w.groupHeight:null)??b,ut=or(y)?0:Jf;return Math.max(0,Ee+ut)}function Co(y,b){const w=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(w){fe.set(y,w);return}fe.delete(y)}function Tn(y,b){const w=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(w){ye.set(y,w);return}ye.delete(y)}function Hr(y){let b=y.parentElement;for(;b;){const w=window.getComputedStyle(b),L=w.overflowY||w.overflow;if(L==="auto"||L==="scroll"||L==="hidden"||L==="clip")return b.getBoundingClientRect();b=b.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Rr(y,b){const w=y.getBoundingClientRect(),L=Hr(y),Ee=6,ut=L.bottom-w.bottom,Pt=w.top-L.top;return ut>=b+Ee?"down":Pt>ut?"up":"down"}function rs(y,b){const w=ye.get(y);if(!w)return"down";const L=Rr(w,b);return Z.value={...Z.value,[y]:L},L}function os(y){return Z.value[y]??"down"}function Pr(y){const b=fe.get(y);if(!b)return;const w=b.querySelector(".project-menu-panel"),L=(w==null?void 0:w.getBoundingClientRect().height)??0;K.value={...K.value,[y]:Rr(b,L)}}function Yn(y,b,w){return Math.min(Math.max(y,b),w)}function ro(y){const b=ye.get(y);if(!b)return;const w=je.value,L=w==null?void 0:w.getBoundingClientRect(),Ee=(L==null?void 0:L.height)||(w==null?void 0:w.offsetHeight)||112,ut=(L==null?void 0:L.width)||(w==null?void 0:w.offsetWidth)||160,Pt=rs(y,Ee),Cn=b.getBoundingClientRect(),an=8,Fn=4,so=Math.max(an,window.innerWidth-ut-an),ga=Yn(Cn.right-ut,an,so),Ko=Yn(Pt==="up"?Cn.top-Ee-Fn:Cn.bottom+Fn,an,Math.max(an,window.innerHeight-Ee-an));be.value={left:`${Math.round(ga)}px`,top:`${Math.round(Ko)}px`}}function Wr(){const y=j.value;y&&ro(y)}function kn(){window.addEventListener("resize",Wr),document.addEventListener("scroll",Wr,!0)}function $n(){window.removeEventListener("resize",Wr),document.removeEventListener("scroll",Wr,!0)}function ar(y){const b=D.value;if(!b)return!1;const w=fe.get(b);if(!w)return!1;if((typeof y.composedPath=="function"?y.composedPath():[]).includes(w))return!0;const Ee=y.target;return Ee instanceof Node?w.contains(Ee):!1}function ha(y){const b=j.value;if(!b)return!1;const w=ye.get(b);if(!w)return!1;const L=typeof y.composedPath=="function"?y.composedPath():[];if(L.includes(w))return!0;const Ee=je.value;if(Ee&&L.includes(Ee))return!0;const ut=y.target;return ut instanceof Node?!!(w.contains(ut)||Ee&&Ee.contains(ut)):!1}function _r(y){if(me.value){const b=he.value,w=typeof y.composedPath=="function"?y.composedPath():[];!!b&&(w.includes(b)||y.target instanceof Node&&b.contains(y.target))||(me.value=!1)}D.value&&(ar(y)||Re(),j.value&&(ha(y)||yt()))}function sr(y){D.value&&!ar(y)&&Re(),j.value&&!ha(y)&&yt()}function Wo(){me.value&&(me.value=!1),D.value&&Re(),j.value&&yt()}function $a(){window.addEventListener("pointerdown",_r,{capture:!0}),window.addEventListener("focusin",sr,{capture:!0}),window.addEventListener("blur",Wo)}function pa(){window.removeEventListener("pointerdown",_r,{capture:!0}),window.removeEventListener("focusin",sr,{capture:!0}),window.removeEventListener("blur",Wo)}function oo(y,b){const w=b.getBoundingClientRect().height;if(!Number.isFinite(w)||w<=0)return;const L=Q.value[y];L!==void 0&&Math.abs(L-w)<.5||(Q.value={...Q.value,[y]:w})}function Na(y,b){const w=le.get(y);w&&w!==b&&Ie&&Ie.unobserve(w);const L=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(L){le.set(y,L),we.set(L,y),oo(y,L),Ie==null||Ie.observe(L);return}w&&(Ie==null||Ie.unobserve(w)),le.delete(y)}function zo(y,b){if(y.button!==0||F.value||Ge.value||x.value)return;const w=n.groups.findIndex(Pt=>Pt.projectName===b),L=le.get(b);if(w<0||!L)return;const Ee=L.getBoundingClientRect(),ut=or(b)?0:Jf;Ge.value={projectName:b,fromIndex:w,startClientX:y.clientX,startClientY:y.clientY,pointerOffsetY:y.clientY-Ee.top,groupLeft:Ee.left,groupWidth:Ee.width,groupHeight:Ee.height,groupOuterHeight:Ee.height+ut},y.preventDefault(),zr()}function zr(){window.addEventListener("mousemove",So),window.addEventListener("mouseup",Vr),window.addEventListener("keydown",jt)}function La(){window.removeEventListener("mousemove",So),window.removeEventListener("mouseup",Vr),window.removeEventListener("keydown",jt)}function So(y){P={clientX:y.clientX,clientY:y.clientY},Oa()}function Vr(y){as({clientX:y.clientX,clientY:y.clientY});const b=x.value;if(b&&zt.value!==null){const w=n.groups.findIndex(L=>L.projectName===b.projectName);if(w>=0){const L=zt.value;L!==w&&a("reorder-project",{projectName:b.projectName,toIndex:L})}}ir({preserveToggleSuppression:!!b})}function jt(y){y.key==="Escape"&&(!Ge.value&&!x.value||(y.preventDefault(),ir()))}function ir(y={}){z!==null&&(window.cancelAnimationFrame(z),z=null),P=null,Ge.value=null,x.value=null,y.preserveToggleSuppression||(ae.value=""),La()}function Oa(){z===null&&(z=window.requestAnimationFrame(()=>{if(z=null,!P)return;const y=P;P=null,as(y)}))}function as(y){const b=Ge.value;if(!x.value&&b){const w=y.clientX-b.startClientX,L=y.clientY-b.startClientY;if(Math.hypot(w,L)<lC)return;Re(),ae.value=b.projectName,x.value={projectName:b.projectName,fromIndex:b.fromIndex,pointerOffsetY:b.pointerOffsetY,groupLeft:b.groupLeft,groupWidth:b.groupWidth,groupHeight:b.groupHeight,groupOuterHeight:b.groupOuterHeight,ghostTop:y.clientY-b.pointerOffsetY,dropTargetIndexFull:null}}x.value&&Hs(y)}function Hs(y){const b=x.value;if(!b)return;if(b.ghostTop=y.clientY-b.pointerOffsetY,!ma(y)){b.dropTargetIndexFull=null;return}const w=y.clientY,L=Fe.value;if(!L){b.dropTargetIndexFull=null;return}const Ee=L.getBoundingClientRect(),ut=new Map(n.groups.map((Fn,so)=>[Fn.projectName,so])),Pt=n.groups.map(Fn=>Fn.projectName).filter(Fn=>Fn!==b.projectName);let Cn=0,an=n.groups.length;for(const Fn of Pt){const so=ut.get(Fn);if(so===void 0)continue;const ga=br(Fn),Ko=Ee.top+Cn+ga/2;if(w<Ko){an=so;break}Cn+=ga}b.dropTargetIndexFull=an}function ma(y){const b=Fe.value;if(!b)return!1;const w=b.getBoundingClientRect(),L=y.clientX>=w.left&&y.clientX<=w.right,Ee=y.clientY>=w.top-32&&y.clientY<=w.bottom+32;return L&&Ee}function ss(y){var b;return((b=x.value)==null?void 0:b.projectName)===y}function xo(y){const b=x.value,w=nn.value[y]??0,L=j.value?fa.value.get(j.value)??"":"",Ee=D.value===y||L===y;return!b||b.projectName!==y?{position:"absolute",top:"0",left:"0",right:"0",zIndex:Ee?"40":"1",transform:`translate3d(0, ${w}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 Vo(y){return Do.value.get(y.projectName)??[]}function is(y){if(F.value)return Vo(y);if(or(y.projectName))return[];const b=Vo(y);return qo(y.projectName)?b:b.slice(0,10)}function qt(y){return F.value?!1:!or(y.projectName)&&Vo(y).length>10}function Ws(y){return Vo(y).length>0}function va(y){return!!y.pendingRequestState||y.inProgress||y.unread}function Mr(y){return y.pendingRequestState==="approval"?"Awaiting approval":"Awaiting response"}function ao(y){return y.pendingRequestState==="approval"?"awaiting-approval":y.pendingRequestState==="response"?"awaiting-response":y.inProgress?"working":y.unread?"unread":"idle"}pt(()=>n.groups.map(y=>y.projectName),y=>{var Ee,ut;const b=((Ee=x.value)==null?void 0:Ee.projectName)??((ut=Ge.value)==null?void 0:ut.projectName)??"";b&&!n.groups.some(Pt=>Pt.projectName===b)&&ir();const w=new Set(y),L=Object.fromEntries(Object.entries(Q.value).filter(([Pt])=>w.has(Pt)));Object.keys(L).length!==Object.keys(Q.value).length&&(Q.value=L)}),pt(()=>{const y=D.value;return y?n.projectGitRepoByName[y]:void 0},()=>{const y=D.value;y&&Xt(()=>{D.value===y&&Pr(y)})});const Go=ne(()=>me.value||D.value!==""||j.value!=="");return pt(Go,y=>{if(y){$a();return}pa()}),pt(j,y=>{if(!y){$n();return}kn(),Xt(()=>{ro(y)})}),Pa(()=>{for(const y of le.values())Ie==null||Ie.unobserve(y);le.clear(),fe.clear(),$n(),pa(),ir()}),(y,b)=>(k(),R("section",{class:et(["thread-tree-root",{"chats-first":g.value}])},[wo.value.length>0?(k(),R("section",WT,[Oe(lo,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":l.value,onClick:Fo},{left:ht(()=>[l.value?(k(),Ze(Xa,{key:1,class:"thread-icon"})):(k(),Ze(di,{key:0,class:"thread-icon"}))]),default:ht(()=>[m("span",zT,$(S(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),l.value?(k(),R("ul",VT,[(k(!0),R(Ye,null,Kt(wo.value,w=>(k(),R("li",{key:w.id,class:"thread-row-item","data-menu-open":Ct(w.id)?"true":"false"},[Oe(lo,{class:"thread-row","data-active":w.id===e.selectedThreadId,"data-pinned":Dt(w.id),"data-menu-open":Ct(w.id)?"true":"false","force-right-hover":Ct(w.id),onClick:L=>on(w.id),onMouseleave:L=>fn(w.id,L),onContextmenu:L=>Rn(L,w.id)},{left:ht(()=>[m("span",KT,[va(w)?(k(),R("span",{key:0,class:"thread-status-indicator","data-state":ao(w)},null,8,YT)):J("",!0),m("button",{class:"thread-delete-button",type:"button","data-confirming":Ot(w.id),title:Ot(w.id)?"Confirm delete":S(r)("Delete thread"),onClick:Xe(L=>hn(w.id),["stop"])},[Ot(w.id)?(k(),R("span",JT,"Confirm")):(k(),Ze(al,{key:1,class:"thread-icon"}))],8,QT)])]),right:ht(()=>[m("span",ok,$(dn(w)),1)]),"right-hover":ht(()=>[m("div",{ref_for:!0,ref:L=>Tn(w.id,L),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Xe(L=>nr(w.id),["stop"])},[Oe(vs,{class:"thread-icon"})],8,ak)],512)]),default:ht(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Xe(L=>on(w.id),["stop"])},[m("span",ZT,[m("span",ek,[m("span",tk,$(w.title),1),w.hasWorktree?(k(),Ze(Cs,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):J("",!0),In(w.id)?(k(),R("span",{key:1,class:"thread-row-automation-chip",title:eo(w.id)}," Auto ",8,nk)):J("",!0),w.pendingRequestState?(k(),R("span",{key:2,class:"thread-row-request-chip","data-state":w.pendingRequestState},$(Mr(w)),9,rk)):J("",!0)])])],8,XT)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,GT))),128))])):J("",!0)])):J("",!0),m("section",sk,[Oe(lo,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":c.value,onClick:ot},{left:ht(()=>[c.value?(k(),Ze(Xa,{key:1,class:"thread-icon"})):(k(),Ze(di,{key:0,class:"thread-icon"}))]),right:ht(()=>[m("div",{ref_key:"organizeMenuWrapRef",ref:he,class:"organize-menu-wrap"},[m("button",{class:"organize-menu-trigger",type:"button","aria-expanded":me.value,"aria-label":S(r)("Organize threads"),title:S(r)("Organize threads"),onClick:Xe(vt,["stop"])},[Oe(vs,{class:"thread-icon"})],8,lk),me.value?(k(),R("div",{key:0,class:"organize-menu-panel",onClick:b[4]||(b[4]=Xe(()=>{},["stop"]))},[m("p",uk,$(S(r)("Organize")),1),m("button",{class:"organize-menu-item","data-active":Me.value==="project",type:"button",onClick:b[0]||(b[0]=w=>Jt("project"))},[m("span",null,$(S(r)("By project")),1),Me.value==="project"?(k(),R("span",dk,"✓")):J("",!0)],8,ck),m("button",{class:"organize-menu-item","data-active":Me.value==="chronological",type:"button",onClick:b[1]||(b[1]=w=>Jt("chronological"))},[m("span",null,$(S(r)("Chronological list")),1),Me.value==="chronological"?(k(),R("span",hk,"✓")):J("",!0)],8,fk),m("button",{class:"organize-menu-item","data-active":g.value,type:"button",onClick:pn},[m("span",null,$(S(r)("Chats first")),1),g.value?(k(),R("span",mk,"✓")):J("",!0)],8,pk),b[27]||(b[27]=m("div",{class:"organize-menu-separator"},null,-1)),m("p",vk,$(S(r)("Sort by")),1),m("button",{class:"organize-menu-item","data-active":_.value==="created",type:"button",onClick:b[2]||(b[2]=w=>$e("created"))},[m("span",null,$(S(r)("Created")),1),_.value==="created"?(k(),R("span",yk,"✓")):J("",!0)],8,gk),m("button",{class:"organize-menu-item","data-active":_.value==="updated",type:"button",onClick:b[3]||(b[3]=w=>$e("updated"))},[m("span",null,$(S(r)("Updated")),1),_.value==="updated"?(k(),R("span",bk,"✓")):J("",!0)],8,wk)])):J("",!0)],512)]),default:ht(()=>[m("span",ik,$(S(r)("Projects")),1)]),_:1},8,["aria-expanded"]),c.value?(k(),R(Ye,{key:0},[F.value&&xt.value.length===0?(k(),R("p",_k,$(S(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(k(),R("p",Tk,$(S(r)("Loading threads...")),1)):Bt.value?(k(),R("ul",kk,[(k(!0),R(Ye,null,Kt(Wt.value,w=>(k(),R("li",{key:w.id,class:"thread-row-item","data-menu-open":Ct(w.id)?"true":"false"},[Oe(lo,{class:"thread-row","data-active":w.id===e.selectedThreadId,"data-pinned":Dt(w.id),"data-menu-open":Ct(w.id)?"true":"false","force-right-hover":Ct(w.id),onClick:L=>on(w.id),onMouseleave:L=>fn(w.id,L),onContextmenu:L=>Rn(L,w.id)},{left:ht(()=>[m("span",Sk,[va(w)?(k(),R("span",{key:0,class:"thread-status-indicator","data-state":ao(w)},null,8,xk)):J("",!0),m("button",{class:"thread-delete-button",type:"button","data-confirming":Ot(w.id),title:Ot(w.id)?"Confirm delete":S(r)("Delete thread"),onClick:Xe(L=>hn(w.id),["stop"])},[Ot(w.id)?(k(),R("span",Ek,"Confirm")):(k(),Ze(al,{key:1,class:"thread-icon"}))],8,Ak)])]),right:ht(()=>[m("span",Lk,$(dn(w)),1)]),"right-hover":ht(()=>[m("div",{ref_for:!0,ref:L=>Tn(w.id,L),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Xe(L=>nr(w.id),["stop"])},[Oe(vs,{class:"thread-icon"})],8,Ok)],512)]),default:ht(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Xe(L=>on(w.id),["stop"])},[m("span",Rk,[m("span",Pk,[m("span",Mk,$(w.title),1),w.hasWorktree?(k(),Ze(Cs,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):J("",!0),In(w.id)?(k(),R("span",{key:1,class:"thread-row-automation-chip",title:eo(w.id)}," Auto ",8,$k)):J("",!0),w.pendingRequestState?(k(),R("span",{key:2,class:"thread-row-request-chip","data-state":w.pendingRequestState},$(Mr(w)),9,Nk)):J("",!0)])])],8,Ik)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,Ck))),128))])):(k(),R("div",{key:3,ref_key:"groupsContainerRef",ref:Fe,class:"thread-tree-groups",style:oa(zn.value)},[(k(!0),R(Ye,null,Kt(xt.value,w=>(k(),R("article",{key:w.projectName,ref_for:!0,ref:L=>Na(w.projectName,L),class:"project-group","data-project-name":w.projectName,"data-expanded":!or(w.projectName),"data-dragging":ss(w.projectName),style:oa(xo(w.projectName))},[Oe(lo,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:L=>ko(w.projectName),onContextmenu:Xe(L=>_n(w.projectName),["prevent"]),onKeydown:[L=>Bo(L,w.projectName),mn(Xe(L=>ko(w.projectName),["prevent"]),["enter"]),mn(Xe(L=>ko(w.projectName),["prevent"]),["space"])]},{left:ht(()=>[m("span",Dk,[m("span",Fk,[or(w.projectName)?(k(),Ze(Gc,{key:0,class:"thread-icon"})):(k(),Ze(yT,{key:1,class:"thread-icon"}))]),m("span",Uk,[or(w.projectName)?(k(),Ze(di,{key:0,class:"thread-icon"})):(k(),Ze(Xa,{key:1,class:"thread-icon"}))])])]),right:ht(()=>[m("div",Hk,[m("div",{ref_for:!0,ref:L=>Co(w.projectName,L),class:"project-menu-wrap"},[m("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:Xe(L=>mt(w.projectName),["stop"])},[Oe(vs,{class:"thread-icon"})],8,Wk),re(w.projectName)?(k(),R("div",{key:0,class:"project-menu-panel","data-open-direction":K.value[w.projectName]??"down",onClick:b[6]||(b[6]=Xe(()=>{},["stop"]))},[pe.value==="actions"?(k(),R(Ye,{key:0},[m("button",{class:"project-menu-item",type:"button",onClick:L=>en(w.projectName)}," Browse files ",8,Vk),e.projectGitRepoByName[w.projectName]?(k(),R("button",{key:0,class:"project-menu-item",type:"button",onClick:L=>Uo(w.projectName)}," New worktree ",8,Gk)):J("",!0),m("button",{class:"project-menu-item",type:"button",onClick:L=>qs(w)}," Rename project ",8,Kk),m("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:L=>Ir(w.projectName)}," Remove ",8,Yk)],64)):(k(),R(Ye,{key:1},[m("label",Qk,$(S(r)("Project name")),1),tn(m("input",{"onUpdate:modelValue":b[5]||(b[5]=L=>de.value=L),class:"project-menu-input",type:"text",onInput:L=>no(w.projectName)},null,40,Jk),[[un,de.value]])],64))],8,zk)):J("",!0)],512),m("button",{class:"thread-start-button",type:"button","aria-label":Ft(w.projectName),title:Ft(w.projectName),onClick:Xe(L=>mr(w.projectName),["stop"])},[Oe(Fs,{class:"thread-icon"})],8,Xk)])]),default:ht(()=>[m("span",{class:"project-main-button","data-dragging-handle":ss(w.projectName),onMousedown:Xe(L=>zo(L,w.projectName),["left"])},[m("span",{class:"project-title",title:Mn(w.projectName)},$(B(w)),9,qk)],40,Bk)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),Ws(w)?(k(),R("ul",Zk,[(k(!0),R(Ye,null,Kt(is(w),L=>(k(),R("li",{key:L.id,class:"thread-row-item","data-menu-open":Ct(L.id)?"true":"false"},[Oe(lo,{class:"thread-row","data-active":L.id===e.selectedThreadId,"data-pinned":Dt(L.id),"data-menu-open":Ct(L.id)?"true":"false","force-right-hover":Ct(L.id),onClick:Ee=>on(L.id),onMouseleave:Ee=>fn(L.id,Ee),onContextmenu:Ee=>Rn(Ee,L.id)},{left:ht(()=>[m("span",t1,[va(L)?(k(),R("span",{key:0,class:"thread-status-indicator","data-state":ao(L)},null,8,n1)):J("",!0),m("button",{class:"thread-delete-button",type:"button","data-confirming":Ot(L.id),title:Ot(L.id)?"Confirm delete":S(r)("Delete thread"),onClick:Xe(Ee=>hn(L.id),["stop"])},[Ot(L.id)?(k(),R("span",o1,"Confirm")):(k(),Ze(al,{key:1,class:"thread-icon"}))],8,r1)])]),right:ht(()=>[m("span",d1,$(dn(L)),1)]),"right-hover":ht(()=>[m("div",{ref_for:!0,ref:Ee=>Tn(L.id,Ee),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Xe(Ee=>nr(L.id),["stop"])},[Oe(vs,{class:"thread-icon"})],8,f1)],512)]),default:ht(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Xe(Ee=>on(L.id),["stop"])},[m("span",s1,[m("span",i1,[m("span",l1,$(L.title),1),L.hasWorktree?(k(),Ze(Cs,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):J("",!0),In(L.id)?(k(),R("span",{key:1,class:"thread-row-automation-chip",title:eo(L.id)}," Auto ",8,u1)):J("",!0),L.pendingRequestState?(k(),R("span",{key:2,class:"thread-row-request-chip","data-state":L.pendingRequestState},$(Mr(L)),9,c1)):J("",!0)])])],8,a1)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,e1))),128))])):(k(),Ze(lo,{key:1,as:"p",class:"project-empty-row"},{left:ht(()=>[...b[28]||(b[28]=[m("span",{class:"project-empty-spacer"},null,-1)])]),default:ht(()=>[m("span",h1,$(S(r)("No threads")),1)]),_:1})),qt(w)?(k(),Ze(lo,{key:2,class:"thread-show-more-row"},{left:ht(()=>[...b[29]||(b[29]=[m("span",{class:"thread-show-more-spacer"},null,-1)])]),default:ht(()=>[m("button",{class:"thread-show-more-button",type:"button",onClick:L=>Ho(w.projectName)},$(qo(w.projectName)?"Show less":"Show more"),9,p1)]),_:2},1024)):J("",!0)],12,jk))),128))],4))],64)):J("",!0)]),m("section",m1,[Oe(lo,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":h.value,onClick:cn},{left:ht(()=>[h.value?(k(),Ze(Xa,{key:1,class:"thread-icon"})):(k(),Ze(di,{key:0,class:"thread-icon"}))]),right:ht(()=>[m("div",g1,[m("button",{class:"chats-section-action",type:"button","aria-label":S(r)("New chat"),title:S(r)("New chat"),onClick:b[7]||(b[7]=Xe(w=>y.$emit("start-new-chat"),["stop"]))},[Oe(Fs,{class:"thread-icon"})],8,y1)])]),default:ht(()=>[m("span",v1,$(S(r)("Chats")),1)]),_:1},8,["aria-expanded"]),h.value&&Wn.value.length===0?(k(),R("p",w1,$(S(r)("No chats")),1)):h.value?(k(),R("ul",b1,[(k(!0),R(Ye,null,Kt(pr.value,w=>(k(),R("li",{key:w.id,class:"thread-row-item","data-menu-open":Ct(w.id)?"true":"false"},[Oe(lo,{class:"thread-row","data-active":w.id===e.selectedThreadId,"data-pinned":Dt(w.id),"data-menu-open":Ct(w.id)?"true":"false","force-right-hover":Ct(w.id),onClick:L=>on(w.id),onMouseleave:L=>fn(w.id,L),onContextmenu:L=>Rn(L,w.id)},{left:ht(()=>[m("span",T1,[va(w)?(k(),R("span",{key:0,class:"thread-status-indicator","data-state":ao(w)},null,8,k1)):J("",!0),m("button",{class:"thread-delete-button",type:"button","data-confirming":Ot(w.id),title:Ot(w.id)?"Confirm delete":S(r)("Delete thread"),onClick:Xe(L=>hn(w.id),["stop"])},[Ot(w.id)?(k(),R("span",S1,"Confirm")):(k(),Ze(al,{key:1,class:"thread-icon"}))],8,C1)])]),right:ht(()=>[m("span",M1,$(dn(w)),1)]),"right-hover":ht(()=>[m("div",{ref_for:!0,ref:L=>Tn(w.id,L),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Xe(L=>nr(w.id),["stop"])},[Oe(vs,{class:"thread-icon"})],8,$1)],512)]),default:ht(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Xe(L=>on(w.id),["stop"])},[m("span",A1,[m("span",E1,[m("span",I1,$(w.title),1),w.hasWorktree?(k(),Ze(Cs,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):J("",!0),In(w.id)?(k(),R("span",{key:1,class:"thread-row-automation-chip",title:eo(w.id)}," Auto ",8,R1)):J("",!0),w.pendingRequestState?(k(),R("span",{key:2,class:"thread-row-request-chip","data-state":w.pendingRequestState},$(Mr(w)),9,P1)):J("",!0)])])],8,x1)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,_1))),128))])):J("",!0),h.value&&Xr.value?(k(),Ze(lo,{key:2,class:"thread-show-more-row"},{left:ht(()=>[...b[30]||(b[30]=[m("span",{class:"thread-show-more-spacer"},null,-1)])]),default:ht(()=>[m("button",{class:"thread-show-more-button",type:"button",onClick:qr},$(f.value?"Show less":"Show more"),1)]),_:1})):J("",!0)]),(k(),Ze(Qa,{to:"body"},[Zt.value?(k(),R("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:je,class:"thread-menu-panel thread-menu-panel-fixed",style:oa(be.value),"data-open-direction":os(Zt.value.id),onClick:b[16]||(b[16]=Xe(()=>{},["stop"]))},[m("button",{class:"thread-menu-item",type:"button",onClick:b[8]||(b[8]=w=>Ur(Zt.value.id))},$(In(Zt.value.id)?"Manage automations…":"Add automation…"),1),m("button",{class:"thread-menu-item",type:"button",onClick:b[9]||(b[9]=w=>xr(Zt.value.id))}," Browse files "),m("button",{class:"thread-menu-item",type:"button",onClick:b[10]||(b[10]=w=>Ar(Zt.value.id))}," Copy path "),m("button",{class:"thread-menu-item",type:"button",onClick:b[11]||(b[11]=w=>Vn(Zt.value.id))}," Export chat "),m("button",{class:"thread-menu-item",type:"button",onClick:b[12]||(b[12]=w=>_o(Zt.value.id))}," Create chat fork "),m("button",{class:"thread-menu-item",type:"button",onClick:b[13]||(b[13]=w=>wn(Zt.value.id))},$(Dt(Zt.value.id)?"Unpin thread":"Pin thread"),1),m("button",{class:"thread-menu-item",type:"button",onClick:b[14]||(b[14]=w=>Fr(Zt.value.id,Zt.value.title))},$(S(r)("Rename thread")),1),m("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:b[15]||(b[15]=w=>To(Zt.value.id,Zt.value.title))},$(S(r)("Delete thread")),1)],12,N1)):J("",!0)])),(k(),Ze(Qa,{to:"body"},[Pe.value?(k(),R("div",{key:0,class:"rename-thread-overlay",onClick:Xe(gn,["self"])},[m("div",L1,[m("h3",O1,$(S(r)("Rename thread")),1),b[31]||(b[31]=m("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),tn(m("input",{ref_key:"renameThreadInputRef",ref:Te,"onUpdate:modelValue":b[17]||(b[17]=w=>ve.value=w),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[mn(Xe(vr,["prevent"]),["enter"]),mn(Xe(gn,["prevent"]),["esc"])]},null,40,j1),[[un,ve.value]]),m("div",D1,[m("button",{class:"rename-thread-button",type:"button",onClick:gn},$(S(r)("Cancel")),1),m("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:vr},$(S(r)("Save")),1)])])])):J("",!0)])),(k(),Ze(Qa,{to:"body"},[oe.value?(k(),R("div",{key:0,class:"rename-thread-overlay",onClick:Xe(wt,["self"])},[m("div",F1,[m("h3",U1,$(Cr.value?"Archive chat and remove automations?":"Delete thread?"),1),m("p",B1,[Cr.value?(k(),R(Ye,{key:0},[ns(' This will archive the thread "'+$(De.value)+'" and remove the attached heartbeat automations. ',1)],64)):(k(),R(Ye,{key:1},[ns(' This will archive the thread "'+$(De.value)+'". You can find it later in archived threads. ',1)],64))]),m("div",q1,[m("button",{class:"rename-thread-button",type:"button",onClick:wt},"Cancel"),m("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Et},$(Cr.value?"Archive and remove":"Delete"),1)])])])):J("",!0)])),(k(),Ze(Qa,{to:"body"},[Ke.value?(k(),R("div",{key:0,class:"rename-thread-overlay",onClick:Xe(Er,["self"])},[m("div",H1,[m("h3",W1,$(Qe.value==="edit"?"Edit automation":"Add automation"),1),b[38]||(b[38]=m("p",{class:"rename-thread-subtitle"},"This creates heartbeat automations attached to the selected thread.",-1)),xe.value.length>0?(k(),R("div",z1,[(k(!0),R(Ye,null,Kt(xe.value,w=>(k(),R("button",{key:w.id,class:et(["automation-thread-list-item",{"is-active":w.id===Se.value}]),type:"button",onClick:L=>yn(w.id)},[m("span",null,$(w.name),1),m("small",null,$(w.status==="PAUSED"?"Paused":"Active"),1)],10,V1))),128)),m("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:gr}," Add another automation ")])):J("",!0),m("label",G1,[b[32]||(b[32]=m("span",{class:"automation-thread-label"},"Name",-1)),tn(m("input",{"onUpdate:modelValue":b[18]||(b[18]=w=>Je.value.name=w),class:"rename-thread-input",type:"text",placeholder:"Automation name"},null,512),[[un,Je.value.name]])]),m("label",K1,[b[33]||(b[33]=m("span",{class:"automation-thread-label"},"Prompt",-1)),tn(m("textarea",{"onUpdate:modelValue":b[19]||(b[19]=w=>Je.value.prompt=w),class:"automation-thread-textarea",rows:"6",placeholder:"Describe what the automation should do"},null,512),[[un,Je.value.prompt]])]),m("div",Y1,[b[36]||(b[36]=m("span",{class:"automation-thread-label"},"Schedule",-1)),m("div",Q1,[m("button",{class:et(["automation-schedule-mode",{"is-active":We.value.mode==="daily"}]),type:"button",onClick:b[20]||(b[20]=w=>tr("daily"))}," Daily ",2),m("button",{class:et(["automation-schedule-mode",{"is-active":We.value.mode==="interval"}]),type:"button",onClick:b[21]||(b[21]=w=>tr("interval"))}," Interval ",2),m("button",{class:et(["automation-schedule-mode",{"is-active":We.value.mode==="advanced"}]),type:"button",onClick:b[22]||(b[22]=w=>tr("advanced"))}," RRULE ",2)]),We.value.mode==="daily"?(k(),R("div",J1,[b[34]||(b[34]=m("span",{class:"automation-schedule-copy"},"Run every day at",-1)),tn(m("input",{"onUpdate:modelValue":b[23]||(b[23]=w=>We.value.dailyTime=w),class:"automation-schedule-time",type:"time",onInput:bn},null,544),[[un,We.value.dailyTime]])])):We.value.mode==="interval"?(k(),R("div",X1,[b[35]||(b[35]=m("span",{class:"automation-schedule-copy"},"Run every",-1)),tn(m("input",{"onUpdate:modelValue":b[24]||(b[24]=w=>We.value.interval=w),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:bn},null,544),[[un,We.value.interval,void 0,{number:!0}]]),Oe(Lr,{class:"automation-schedule-unit","model-value":We.value.intervalUnit,options:Tt,"onUpdate:modelValue":jn},null,8,["model-value"])])):J("",!0),We.value.mode==="advanced"?tn((k(),R("input",{key:2,"onUpdate:modelValue":b[25]||(b[25]=w=>Je.value.rrule=w),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:Dr},null,544)),[[un,Je.value.rrule]]):J("",!0),m("p",Z1,$(Ae.value),1)]),m("label",eC,[b[37]||(b[37]=m("span",{class:"automation-thread-label"},"Status",-1)),Oe(Lr,{class:"automation-thread-select","model-value":Je.value.status,options:ee.value,"onUpdate:modelValue":b[26]||(b[26]=w=>Je.value.status=w)},null,8,["model-value","options"])]),tt.value?(k(),R("p",tC,$(tt.value),1)):Ue.value?(k(),R("p",nC,$(Ue.value),1)):J("",!0),m("div",rC,[Qe.value==="edit"?(k(),R("button",{key:0,class:"rename-thread-button",type:"button",disabled:He.value||ft.value,onClick:Br},$(ft.value?"Running…":"Run now"),9,oC)):J("",!0),Qe.value==="edit"?(k(),R("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:He.value||ft.value,onClick:yr}," Remove ",8,aC)):J("",!0),m("button",{class:"rename-thread-button",type:"button",disabled:He.value||ft.value,onClick:Er},$(S(r)("Cancel")),9,sC),m("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:He.value||ft.value,onClick:Vt},$(He.value?"Saving…":"Save"),9,iC)])])])):J("",!0)]))],2))}}),cC=It(uC,[["__scopeId","data-v-3c34356c"]]),dC={class:"content-header"},fC=["title"],hC={class:"content-actions"},pC=Hn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(k(),R("header",dC,[m("div",{class:et(["content-leading",{"is-accent":e.accent}])},[Lo(t.$slots,"leading",{},void 0)],2),m("h1",{class:et(["content-title",{"is-accent":e.accent}]),title:e.title},$(e.title),11,fC),m("div",hC,[Lo(t.$slots,"actions",{},void 0)])]))}}),mC=It(pC,[["__scopeId","data-v-f96f7210"]]),rh=.0025,Du=3,oh=2,vC=256;function gC(e){var Te;const t=A("idle"),n=A(typeof navigator<"u"&&!!((Te=navigator.mediaDevices)!=null&&Te.getUserMedia)),r=A(0),a=A(null);let o=null,s=null,l=[],c=null,h=null,f=null,g=null,_=[],E=!1,O=!1,H=null;function X(){H&&(H.abort(),H=null),t.value==="transcribing"&&(t.value="idle")}function D(){const oe=a.value;if(!oe||typeof window>"u")return;const ke=oe.getContext("2d");if(!ke)return;const De=Math.max(1,Math.floor(oe.clientWidth)),Be=Math.max(1,Math.floor(oe.clientHeight||36)),Ke=window.devicePixelRatio||1,Le=Math.max(1,Math.floor(De*Ke)),Se=Math.max(1,Math.floor(Be*Ke));(oe.width!==Le||oe.height!==Se)&&(oe.width=Le,oe.height=Se),ke.setTransform(Ke,0,0,Ke,0,0),ke.clearRect(0,0,De,Be);const Qe=Math.max(12,Math.floor(De/(Du+oh))),tt=_.slice(-Qe),Ue=Math.max(0,Qe-tt.length),He=Be/2,ft=getComputedStyle(oe).color||"#000000";for(let Je=0;Je<Qe;Je+=1){const We=tt[Je-Ue]??0,ee=Math.max(.08,Math.min(1,We*18))*He,xe=Je*(Du+oh);ke.globalAlpha=We<=rh?.35:1,ke.fillStyle=ft,ke.fillRect(xe,He-ee,Du,ee*2)}ke.globalAlpha=1}function j(){_=[],r.value=0,D()}function K(){f&&(f.disconnect(),f.onaudioprocess=null,f=null),h&&(h.disconnect(),h=null),c&&(c.close(),c=null),g=null}function Z(oe){if(typeof window>"u")return;const ke=window.webkitAudioContext,De=window.AudioContext??ke;De&&(K(),j(),c=new De,h=c.createMediaStreamSource(oe),f=c.createScriptProcessor(2048,1,1),g=performance.now(),f.onaudioprocess=Be=>{const Ke=Be.inputBuffer.getChannelData(0);let Le=0;for(let Se=0;Se<Ke.length;Se+=1){const Qe=Math.abs(Ke[Se]??0);Le+=Qe<rh?0:Qe}_.push(Le/Ke.length),_.length>vC&&_.shift(),g!==null&&(r.value=Math.max(0,performance.now()-g)),D()},h.connect(f),f.connect(c.destination),D())}async function be(){var oe;if(t.value==="transcribing"&&X(),!(t.value!=="idle"||!n.value||E)){E=!0,O=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),l=[],o=new MediaRecorder(s),o.ondataavailable=ke=>{ke.data.size>0&&l.push(ke.data)},o.onstop=()=>{var Be;const ke=l,De=(o==null?void 0:o.mimeType)||((Be=ke[0])==null?void 0:Be.type)||"audio/webm";G(),Pe(ke,De)},Z(s),o.start(250),t.value="recording",O&&pe()}catch(ke){G(),t.value="idle",(oe=e.onError)==null||oe.call(e,ke)}finally{E=!1}}}function pe(){if(E&&t.value==="idle"){O=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}function de(){O=!1,X(),G(),t.value="idle"}async function Pe(oe,ke){var Ke,Le,Se,Qe,tt;if(oe.length===0){(Ke=e.onEmpty)==null||Ke.call(e),t.value="idle";return}const De=new Blob(oe,{type:ke});t.value="transcribing";let Be=null;try{const Ue=ke.split(/[/;]/)[1]??"webm",He=new FormData;He.append("file",De,`codex.${Ue}`);const ft=((Le=e.getLanguage)==null?void 0:Le.call(e).trim())??"";ft&&ft.toLowerCase()!=="auto"&&He.append("language",ft),Be=new AbortController,H=Be;const Je=await fetch("/codex-api/transcribe",{method:"POST",body:He,signal:Be.signal}),We=await Je.text();let Tt=null;try{Tt=We.trim()?JSON.parse(We):null}catch{Tt=null}if(!Je.ok){const xe=(Se=Tt==null?void 0:Tt.error)==null?void 0:Se.trim(),Ae=We.trim();throw new Error(xe||Ae||`Transcription failed: ${Je.status}`)}const ee=((Tt==null?void 0:Tt.text)??"").trim();ee.length>0?e.onTranscript(ee):(Qe=e.onEmpty)==null||Qe.call(e)}catch(Ue){if(Ue instanceof DOMException&&Ue.name==="AbortError")return;(tt=e.onError)==null||tt.call(e,Ue)}finally{Be&&H===Be&&(H=null),t.value==="transcribing"&&(t.value="idle")}}function G(){K(),j(),o&&(o.ondataavailable=null,o.onstop=null,o=null),s&&(s.getTracks().forEach(oe=>oe.stop()),s=null),l=[]}Pa(()=>{de()});function ve(){if(t.value==="recording"){pe();return}(t.value==="idle"||t.value==="transcribing")&&be()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:a,startRecording:be,stopRecording:pe,toggleRecording:ve,cancel:de}}const yC={},wC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function bC(e,t){return k(),R("svg",wC,[...t[0]||(t[0]=[m("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 _C=It(yC,[["render",bC]]),TC={},kC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function CC(e,t){return k(),R("svg",kC,[...t[0]||(t[0]=[m("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 pl=It(TC,[["render",CC]]),SC={},xC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function AC(e,t){return k(),R("svg",xC,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 2m0 3a3 3 0 0 1 3-3h0a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h0a3 3 0 0 1-3-3zM5 10a7 7 0 0 0 14 0M8 21h8M12 17v4"},null,-1)])])}const EC=It(SC,[["render",AC]]),IC={},RC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function PC(e,t){return k(),R("svg",RC,[...t[0]||(t[0]=[m("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),m("path",{fill:"currentColor",d:"M8 5a3 3 0 0 0 -3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-8z"},null,-1)])])}const ah=It(IC,[["render",PC]]),MC=["disabled"],$C={class:"search-dropdown-value"},NC={class:"search-dropdown-search-wrap"},LC={class:"search-dropdown-search-row"},OC=["placeholder","onKeydown"],jC=["aria-label","title"],DC={key:0,class:"search-dropdown-list",role:"listbox"},FC=["onPointerenter"],UC=["onClick"],BC={class:"search-dropdown-option-check"},qC=["title"],HC={class:"search-dropdown-option-copy"},WC={class:"search-dropdown-option-label-row"},zC={class:"search-dropdown-option-label"},VC={key:0,class:"search-dropdown-option-type"},GC={key:0,class:"search-dropdown-option-desc"},KC=["aria-label","title","onClick"],YC={key:1,class:"search-dropdown-empty"},QC=Hn({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{},createLabel:{},allowRemove:{type:Boolean},removeLabel:{},displayLabelOverride:{}},emits:["toggle","create","remove"],setup(e,{emit:t}){const n=e,r=t,a=A(null),o=A(null),s=A(null),l=A(!1),c=A(""),h=A(0),f=A({}),{t:g}=Ma(),_=ne(()=>n.openDirection??"down"),E=ne(()=>new Set(n.selectedValues)),O=ne(()=>{var de;if((de=n.displayLabelOverride)!=null&&de.trim())return n.displayLabelOverride.trim();if(n.selectedValues.length===0)return n.placeholder||g("Select...");if(n.selectedValues.length===1){const Pe=n.options.find(G=>G.value===n.selectedValues[0]);return(Pe==null?void 0:Pe.label)||n.placeholder||g("Select...")}return`${n.selectedValues.length} ${g("selected")}`}),H=ne(()=>{const de=c.value.toLowerCase().trim();return de?n.options.filter(Pe=>{var G;return Pe.label.toLowerCase().includes(de)||(((G=Pe.description)==null?void 0:G.toLowerCase().includes(de))??!1)}):n.options});function X(){const de=o.value,Pe=a.value;if(!de||!Pe)return;const G=Pe.getBoundingClientRect(),ve=window.innerWidth,Te=window.innerHeight,oe=Math.min(384,ve-16),ke=Math.max(8,Math.min(G.right-oe,ve-oe-8));if(ve<640){f.value={position:"fixed",left:"0.5rem",right:"0.5rem",width:"auto",top:_.value==="up"?"auto":`${G.bottom+8}px`,bottom:_.value==="up"?`${Te-G.top+8}px`:"auto",zIndex:"120"};return}f.value={position:"fixed",width:`${oe}px`,left:`${ke}px`,top:_.value==="up"?"auto":`${G.bottom+8}px`,bottom:_.value==="up"?`${Te-G.top+8}px`:"auto",zIndex:"120"}}function D(){n.disabled||(l.value=!l.value,l.value&&(c.value="",h.value=0,Xt(()=>{var de;Xt(()=>{X()}),(de=s.value)==null||de.focus()})))}function j(de){r("toggle",de.value,!E.value.has(de.value)),l.value=!1}function K(de){H.value.length!==0&&(h.value=(h.value+de+H.value.length)%H.value.length)}function Z(){const de=H.value[h.value];de&&j(de)}function be(de){if(!l.value)return;const Pe=a.value,G=o.value;if(!Pe)return;const ve=de.target;ve instanceof Node&&(Pe.contains(ve)||G!=null&&G.contains(ve)||(l.value=!1))}pt(c,()=>{h.value=0});function pe(){l.value&&X()}return ca(()=>{window.addEventListener("pointerdown",be),window.addEventListener("resize",pe),window.addEventListener("scroll",pe,!0)}),Pa(()=>{window.removeEventListener("pointerdown",be),window.removeEventListener("resize",pe),window.removeEventListener("scroll",pe,!0)}),(de,Pe)=>(k(),R("div",{ref_key:"rootRef",ref:a,class:"search-dropdown"},[m("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:D},[m("span",$C,$(O.value),1),Oe(Xa,{class:"search-dropdown-chevron"})],8,MC),(k(),Ze(Qa,{to:"body"},[l.value?(k(),R("div",{key:0,ref_key:"menuRef",ref:o,class:et(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":_.value==="up","search-dropdown-menu-wrap-down":_.value==="down"}]),style:oa(f.value)},[m("div",NC,[m("div",LC,[tn(m("input",{ref_key:"searchRef",ref:s,"onUpdate:modelValue":Pe[0]||(Pe[0]=G=>c.value=G),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[Pe[1]||(Pe[1]=mn(Xe(G=>l.value=!1,["prevent"]),["escape"])),mn(Xe(Z,["prevent"]),["enter"]),Pe[2]||(Pe[2]=mn(Xe(G=>K(1),["prevent"]),["arrow-down"])),Pe[3]||(Pe[3]=mn(Xe(G=>K(-1),["prevent"]),["arrow-up"]))]},null,40,OC),[[un,c.value]]),e.createLabel?(k(),R("button",{key:0,class:"search-dropdown-create-icon",type:"button","aria-label":e.createLabel,title:e.createLabel,onClick:Pe[4]||(Pe[4]=G=>r("create"))}," + ",8,jC)):J("",!0)]),e.createLabel?(k(),R("button",{key:0,class:"search-dropdown-create",type:"button",onClick:Pe[5]||(Pe[5]=G=>r("create"))},$(e.createLabel),1)):J("",!0)]),H.value.length>0?(k(),R("ul",DC,[(k(!0),R(Ye,null,Kt(H.value,(G,ve)=>(k(),R("li",{key:G.value},[m("div",{class:et(["search-dropdown-option",{"is-selected":E.value.has(G.value),"is-highlighted":ve===h.value}]),onPointerenter:Te=>h.value=ve},[m("button",{class:"search-dropdown-option-main",type:"button",onClick:Te=>j(G)},[m("span",BC,$(E.value.has(G.value)?"✓":""),1),G.badge?(k(),R("span",{key:0,class:et(["search-dropdown-option-badge",G.badgeTone?`is-${G.badgeTone}`:""]),title:G.badgeLabel||G.badge,"aria-hidden":"true"},$(G.badge),11,qC)):J("",!0),m("span",HC,[m("span",WC,[m("span",zC,$(G.label),1),G.badgeLabel?(k(),R("span",VC,$(G.badgeLabel),1)):J("",!0)]),G.description?(k(),R("span",GC,$(G.description),1)):J("",!0)])],8,UC),e.allowRemove&&G.removable?(k(),R("button",{key:0,class:"search-dropdown-option-remove",type:"button","aria-label":`${e.removeLabel} ${G.label}`,title:`${e.removeLabel} ${G.label}`,onClick:Xe(Te=>r("remove",G.value),["stop"])}," × ",8,KC)):J("",!0)],42,FC)]))),128))])):(k(),R("div",YC,$(S(g)("No results")),1))],6)):J("",!0)]))],512))}}),JC=It(QC,[["__scopeId","data-v-65ed7fdf"]]),XC={key:0,class:"thread-composer-dictation-error"},ZC={key:0,class:"thread-composer-attachments"},eS=["src","alt"],tS=["aria-label","disabled","onClick"],nS={key:1,class:"thread-composer-folder-chips"},rS=["title"],oS={class:"thread-composer-folder-chip-meta"},aS=["aria-label","disabled","onClick"],sS={key:2,class:"thread-composer-file-chips"},iS=["title"],lS=["aria-label","disabled","onClick"],uS={key:3,class:"thread-composer-skill-chips"},cS=["title","aria-label","onClick"],dS=["aria-label","onClick"],fS={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},hS={key:1,class:"thread-composer-file-mentions"},pS=["onMousedown"],mS={key:1,class:"thread-composer-file-mention-icon-markdown"},vS={class:"thread-composer-file-mention-text"},gS={class:"thread-composer-file-mention-name"},yS={key:0,class:"thread-composer-file-mention-dir"},wS={key:1,class:"thread-composer-file-mention-empty"},bS=["placeholder","disabled"],_S=["aria-label","disabled"],TS={key:0,class:"thread-composer-attach-menu"},kS=["disabled"],CS=["disabled"],SS=["disabled"],xS={class:"thread-composer-attach-mode"},AS={class:"thread-composer-attach-mode-label"},ES={class:"thread-composer-attach-mode-buttons"},IS=["disabled"],RS=["disabled"],PS=["aria-checked","aria-label","disabled"],MS={class:"thread-composer-attach-setting-copy"},$S={class:"thread-composer-attach-setting-label"},NS={class:"thread-composer-attach-setting-description"},LS=["aria-checked","aria-label","disabled"],OS={class:"thread-composer-attach-setting-copy"},jS={class:"thread-composer-attach-setting-label"},DS={class:"thread-composer-attach-setting-description"},FS={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},US={key:1,class:"thread-composer-dictation-timer"},BS=["aria-label","title","disabled"],qS=["aria-label","title","disabled"],HS={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},WS=["aria-label","title","disabled"],zS=["disabled"],VS=["disabled"],GS=["disabled"],KS=2e3,Fu="prompt:",YS="codex-web-local.thread-draft.v1.",QS=Hn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},collaborationModes:{},selectedCollaborationMode:{},models:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},threadTokenUsage:{},codexQuota:{},isTurnInProgress:{type:Boolean},isStopPending:{type:Boolean},isInterruptingTurn:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{}},emits:["submit","interrupt","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode"],setup(e,{expose:t,emit:n}){const r=e,a=n,{t:o}=Ma(),s=A(""),l=A([]),c=A([]),h=A([]),f=A([]),g=A([]),_=A(""),E=A(0),O=A(null),H=A(!1),{state:X,isSupported:D,recordingDurationMs:j,waveformCanvasRef:K,startRecording:Z,stopRecording:be,toggleRecording:pe,cancel:de}=gC({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:I=>{if(s.value=s.value?`${s.value}
|
|
48
|
-
${I}`:I,_.value="",r.dictationAutoSend!==!1){const B=r.isTurnInProgress?Ie.value:"steer";U(B);return}Xt(()=>{var B;return(B=oe.value)==null?void 0:B.focus()})},onEmpty:()=>{_.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:I=>{if(I instanceof DOMException&&I.name==="NotAllowedError"){_.value="Microphone access was denied.";return}_.value=I instanceof Error?I.message:"Dictation failed."}}),Pe=A(null),G=A(null),ve=A(null),Te=A(null),oe=A(null),{isMobile:ke}=Wc(),De=A(!1),Be=A(null),Ke=A(""),Le=A([]),Se=A(!1),Qe=A(0),tt=A(0);let Ue=0,He=null,ft=!1,Je=0,We=0;const Tt=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let ee="";const xe=[{value:"none",label:"None"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra high"}];function Ae(I){return I.trim().replace(/^gpt/i,"GPT")}const Fe=ne(()=>r.models.map(I=>({value:I,label:Ae(I)}))),Ge=ne(()=>r.selectedCollaborationMode==="plan"),x=ne(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),P=ne(()=>c.value.map(I=>I.path)),z=ne(()=>[...(r.skills??[]).map(I=>{const B=Pn(I);return{value:I.path,label:I.name,description:I.description,badge:B.badge,badgeLabel:B.badgeLabel,badgeTone:B.badgeTone,removable:!1}}),...h.value.map(I=>({value:Qt(I.path),label:I.name,description:I.description,badge:"T",badgeLabel:"Prompt",badgeTone:"prompt",removable:!0}))]),ae=ne(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||x.value||E.value>0?!1:s.value.trim().length>0||l.value.length>0||f.value.length>0),Q=ne(()=>s.value.trim().length>0||l.value.length>0||c.value.length>0||f.value.length>0||g.value.length>0),le=ne(()=>{const I=new Set;for(const B of g.value)for(const re of B.filePaths)I.add(re);return f.value.filter(B=>!I.has(B.fsPath))}),fe=ne(()=>r.disabled||!r.activeThreadId),ye=ne(()=>r.disabled||!r.activeThreadId),we=ne(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(r.selectedModel.trim())),he=ne(()=>r.selectedSpeedMode==="fast"&&we.value),je=ne(()=>fe.value||r.isUpdatingSpeedMode===!0),me=ne(()=>r.isUpdatingSpeedMode?o("Saving speed setting..."):r.selectedSpeedMode==="fast"?o("About 1.5x faster, with credits used at 2x"):o("Default speed with normal credit usage")),Me=ne(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),Ie=A(Me.value),at=ne(()=>X.value==="recording"),dt=ne(()=>X.value==="recording"?o("Stop dictation"):r.dictationClickToToggle?o("Click to dictate"):o("Hold to dictate")),lt=ne(()=>X.value==="idle"?_.value.trim():""),gt=ne(()=>{const I=Math.max(0,Math.floor(j.value/1e3)),B=Math.floor(I/60),re=I%60;return`${B}:${String(re).padStart(2,"0")}`}),kt=ne(()=>r.activeThreadId?x.value?o("Loading models for plan mode..."):o("Type a message... (@ for files)"):o("Select a thread to send a message")),q=ne(()=>s.value.trim().length>0||l.value.length>0||f.value.length>0);function U(I="steer"){var re;const B=s.value.trim();if(ae.value){if(a("submit",{text:B,imageUrls:l.value.map(Re=>Re.url),fileAttachments:[...f.value],skills:c.value.map(Re=>({name:Re.name,path:Re.path})),mode:I}),Bt(r.activeThreadId),Ce(),g.value=[],De.value=!1,gn(),Tt||ke.value){(re=oe.value)==null||re.blur();return}Xt(()=>{var Re;return(Re=oe.value)==null?void 0:Re.focus()})}}function F(I){Ie.value=I}function se(I){tt.value+=1,s.value=I.text,l.value=I.imageUrls.map((B,re)=>({id:`queued-${Date.now()}-${re}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${re+1}`,url:B})),c.value=I.skills.map(B=>(r.skills??[]).find(re=>re.path===B.path)??{name:B.name,displayName:void 0,description:"",path:B.path}),f.value=I.fileAttachments.map(B=>({...B})),g.value=[],_.value="",O.value=null,E.value=0,De.value=!1,gn(),We+=1}function Ce(){se({text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Ne(I){return`${YS}${I}`}function ze(I){if(typeof window>"u")return null;const B=I.trim();if(!B)return null;try{const re=window.localStorage.getItem(Ne(B));if(!re)return null;const Re=JSON.parse(re);return typeof Re=="string"?{text:Re,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Re.text=="string"?Re.text:"",imageUrls:Array.isArray(Re.imageUrls)?Re.imageUrls.filter(vt=>typeof vt=="string"):[],fileAttachments:Array.isArray(Re.fileAttachments)?Re.fileAttachments.filter(vt=>!!vt&&typeof vt.label=="string"&&typeof vt.path=="string"&&typeof vt.fsPath=="string"):[],skills:Array.isArray(Re.skills)?Re.skills.filter(vt=>!!vt&&typeof vt.name=="string"&&typeof vt.path=="string"):[]}}catch{return null}}function xt(I,B){if(typeof window>"u")return;const re=I.trim();if(re)try{if(B.text.trim().length>0||B.imageUrls.length>0||B.fileAttachments.length>0||B.skills.length>0){window.localStorage.setItem(Ne(re),JSON.stringify(B));return}window.localStorage.removeItem(Ne(re))}catch{}}function Bt(I){xt(I,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Wt(){return{text:s.value,imageUrls:l.value.map(I=>I.url),fileAttachments:f.value.map(I=>({...I})),skills:c.value.map(I=>({name:I.name,path:I.path}))}}function Wn(){a("interrupt")}function pr(I){a("update:selected-model",I)}function Xr(){a("update:selected-collaboration-mode",Ge.value?"default":"plan")}function Ln(I){a("update:selected-reasoning-effort",I)}function Cr(){je.value||a("update:selected-speed-mode",r.selectedSpeedMode==="fast"?"standard":"fast")}function fa(){r.dictationClickToToggle&&(_.value&&(_.value=""),pe())}function Do(I){if(r.dictationClickToToggle||(I.preventDefault(),ft))return;ft=!0;const B=I.currentTarget;if(B)try{B.setPointerCapture(I.pointerId)}catch{}_.value&&(_.value=""),window.addEventListener("pointerup",vn),window.addEventListener("pointercancel",vn),window.addEventListener("blur",vn),Z()}function vn(){r.dictationClickToToggle||ft&&(ft=!1,window.removeEventListener("pointerup",vn),window.removeEventListener("pointercancel",vn),window.removeEventListener("blur",vn),be())}function Zt(){fe.value||(De.value=!De.value)}function wo(){var I;(I=G.value)==null||I.click()}function Fo(){var I;(I=ve.value)==null||I.click()}function ot(){var I;(I=Te.value)==null||I.click()}function cn(I){l.value=l.value.filter(B=>B.id!==I)}function zt(I){c.value=c.value.filter(B=>B.path!==I)}function Or(I){const B=I.trim();return B?B.endsWith("/SKILL.md")?B:`${B.replace(/\/+$/,"")}/SKILL.md`:""}function nn(I){const B=Or(I.path);!B||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(B)}`,"_blank","noopener,noreferrer")}function zn(I){f.value=f.value.filter(B=>B.fsPath!==I)}function Zr(I){const B=g.value.find(Re=>Re.id===I);if(!B)return;const re=new Set(B.filePaths);f.value=f.value.filter(Re=>!re.has(Re.fsPath)),g.value=g.value.filter(Re=>Re.id!==I)}function dn(I){return I.total<=0?0:Math.round(I.processed/I.total*100)}function Dt(I,B){const re=I.replace(/\\/g,"/");if(f.value.some(Jt=>Jt.fsPath===re))return;const Re=re.split("/").filter(Boolean),vt=(B==null?void 0:B.trim())||Re[Re.length-1]||re;f.value=[...f.value,{label:vt,path:re,fsPath:re}]}function rn(I){return I.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(I.name)}function wn(I){return I?Array.from(I):[]}function on(I){return I!==We?!1:(E.value+=1,!0)}function In(I){I===We&&(E.value=Math.max(0,E.value-1))}function eo(I){if(I<=0)return;const B=O.value,re=B?B.succeeded+B.failed:0;if(!B||re>=B.total){O.value={total:I,succeeded:0,failed:0};return}O.value={...B,total:B.total+I}}function On(I){const B=O.value;B&&(O.value={...B,succeeded:B.succeeded+(I==="success"?1:0),failed:B.failed+(I==="failure"?1:0)})}function to(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function bo(I){const B=new Date,re=[B.getFullYear(),String(B.getMonth()+1).padStart(2,"0"),String(B.getDate()).padStart(2,"0"),String(B.getHours()).padStart(2,"0"),String(B.getMinutes()).padStart(2,"0"),String(B.getSeconds()).padStart(2,"0")].join("-"),Re=I.type.startsWith("image/")&&I.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${re}.${Re}`}function Zn(){const I=new Date;return`pasted-text-${[I.getFullYear(),String(I.getMonth()+1).padStart(2,"0"),String(I.getDate()).padStart(2,"0"),String(I.getHours()).padStart(2,"0"),String(I.getMinutes()).padStart(2,"0"),String(I.getSeconds()).padStart(2,"0")].join("-")}.txt`}function jr(I){return I.name.trim()?I:new File([I],bo(I),{type:I.type||"image/png",lastModified:Date.now()})}async function er(I,B){if(on(B))try{const re=jr(I),Re=await ju(re);if(B!==We)return;if(!Re){On("failure");return}l.value=[...l.value,{id:to(),name:re.name,url:`/codex-local-image?path=${encodeURIComponent(Re)}`}],On("success")}catch{B===We&&On("failure")}finally{In(B)}}async function Sr(I,B){if(on(B))try{const re=await ju(I);if(B!==We)return;if(!re){On("failure");return}Dt(re),On("success")}catch{B===We&&On("failure")}finally{In(B)}}function bn(I){const B=wn(I);if(B.length===0)return;eo(B.length),De.value=!1,gn();const re=We;for(const Re of B)rn(Re)?er(Re,re):Sr(Re,re)}function Dr(){Je=0,H.value=!1}function jn(I){return I?Array.from(I.types??[]).includes("Files"):!1}async function tr(I){if(!I||I.length===0)return;const B=tt.value,re=Array.from(I),vt=(re[0].webkitRelativePath||re[0].name).split("/").filter(Boolean)[0]||"Folder",Jt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;g.value=[...g.value,{id:Jt,name:vt,total:re.length,processed:0,filePaths:[],isUploading:!0}];const pn=$e=>{B===tt.value&&(g.value=g.value.map(_e=>_e.id===Jt?$e(_e):_e))};for(const $e of re)try{const _e=await ju($e);if(B!==tt.value)return;if(_e){const mt=$e.webkitRelativePath||$e.name;Dt(_e,mt),pn(_n=>({..._n,processed:_n.processed+1,filePaths:[..._n.filePaths,_e]}));continue}pn(mt=>({...mt,processed:mt.processed+1}))}catch{pn(_e=>({..._e,processed:_e.processed+1}))}pn($e=>({...$e,isUploading:!1}))}function Vn(I){I&&(I.value="")}function _o(I){const B=I.target;bn((B==null?void 0:B.files)??null),Vn(B),De.value=!1}function Ft(I){const B=I.target;bn((B==null?void 0:B.files)??null),Vn(B),De.value=!1}function mr(I){const B=I.target;tr((B==null?void 0:B.files)??null),Vn(B),De.value=!1}function xr(I){fe.value||!jn(I.dataTransfer)||(I.preventDefault(),Je+=1,H.value=!0)}function Ar(I){fe.value||!jn(I.dataTransfer)||(I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="copy"),H.value=!0)}function fn(I){H.value&&(I.preventDefault(),Je=Math.max(0,Je-1),Je===0&&Dr())}function Ct(I){var B;fe.value||!jn(I.dataTransfer)||(I.preventDefault(),Dr(),bn(((B=I.dataTransfer)==null?void 0:B.files)??null))}function yt(){!H.value&&Je===0||Dr()}function nr(I){var Jt,pn;if(fe.value)return;const B=((Jt=I.clipboardData)==null?void 0:Jt.getData("text/plain"))??"";if(B.length>=KS){I.preventDefault();const $e=new File([B],Zn(),{type:"text/plain",lastModified:Date.now()});bn([$e]);return}const re=Array.from(((pn=I.clipboardData)==null?void 0:pn.items)??[]);if(re.length===0)return;const Re=B.length>0,vt=re.filter($e=>$e.kind==="file"&&$e.type.startsWith("image/")).map($e=>$e.getAsFile()).filter($e=>$e instanceof File);vt.length!==0&&(Re||I.preventDefault(),bn(vt))}function Rn(){_.value&&(_.value=""),vr()}function Fr(I){if(Se.value){if(I.key==="Escape"){I.preventDefault(),gn();return}if(I.key==="ArrowDown"){I.preventDefault(),Le.value.length>0&&(Qe.value=(Qe.value+1)%Le.value.length);return}if(I.key==="ArrowUp"){if(I.preventDefault(),Le.value.length>0){const re=Le.value.length;Qe.value=(Qe.value+re-1)%re}return}if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();const re=Le.value[Qe.value];re?wt(re):gn();return}}if(r.sendWithEnter!==!1?I.key==="Enter"&&!I.shiftKey:I.key==="Enter"&&(I.metaKey||I.ctrlKey)){I.preventDefault(),U(r.isTurnInProgress?Ie.value:"steer");return}}function gn(){Se.value=!1,Be.value=null,Ke.value="",Le.value=[],Qe.value=0}function vr(){const I=oe.value;if(!I){gn();return}const B=I.selectionStart??s.value.length,Re=s.value.slice(0,B).match(/(^|\s)(@[^\s@]*)$/);if(!Re){gn();return}const vt=Re[2]??"",Jt=vt.length,pn=B-Jt;Be.value=pn,Ke.value=vt.slice(1),Se.value=!0,To()}async function To(){if(!Se.value)return;const I=(r.cwd??"").trim();if(!I){Le.value=[];return}He&&clearTimeout(He);const B=++Ue;He=setTimeout(async()=>{try{const re=await j_(I,Ke.value,20);if(!Se.value||B!==Ue)return;Le.value=re,Qe.value=0}catch{if(!Se.value||B!==Ue)return;Le.value=[]}},120)}function wt(I){const B=oe.value,re=Be.value;if(re!==null&&B){const Re=B.selectionStart??s.value.length;s.value=`${s.value.slice(0,re)}${s.value.slice(Re)}`.trimEnd()}Dt(I.path),gn(),Xt(()=>B==null?void 0:B.focus())}function Et(I){de(),se(I),Xt(()=>{var B;return(B=oe.value)==null?void 0:B.focus()})}function Ot(I){const B=I.trim();B&&(de(),s.value.trim().length>0?s.value=`${s.value.trimEnd()}
|
|
49
|
-
${B}`:s.value=B,Xt(()=>{var re;return(re=oe.value)==null?void 0:re.focus()}))}async function hn(){h.value=await Q_()}function Qt(I){return`${Fu}${I}`}function Ur(I){return I.startsWith(Fu)?I.slice(Fu.length):null}async function gr(){var Re;const I=((Re=window.prompt(o("Prompt name")))==null?void 0:Re.trim())??"";if(!I)return;const B=window.prompt(o("Prompt content"))??"";if(!B.trim())return;const re=await J_(I,B);re&&(await hn(),Ot(re.content))}async function yn(I){const B=Ur(I)??I,re=h.value.find(Jt=>Jt.path===B);!window.confirm(re?`${o("Remove prompt")} "${re.name}"?`:o("Remove prompt"))||!await X_(B)||await hn()}function Er(I){const B=h.value.find(re=>re.path===I);B&&Ot(B.content)}function rr(I){const B=I.lastIndexOf("/");return B<0?I:I.slice(B+1)}function Dn(I){const B=I.lastIndexOf("/");return B<=0?"":I.slice(0,B)}function Gn(I){const B=rr(I),re=B.lastIndexOf(".");return re<=0?"":B.slice(re+1).toLowerCase()}function Vt(I){const B=Gn(I);return B==="ts"?"TS":B==="tsx"?"TSX":B==="js"?"JS":B==="jsx"?"JSX":B==="json"?"{}":""}function yr(I){const B=Gn(I);return B.startsWith("ts")?"ts":B.startsWith("js")?"js":B==="json"?"json":"default"}function Br(I){const B=Gn(I);return B==="md"||B==="mdx"}function Pn(I){return I.path.toLowerCase().includes("/plugins/cache/")?{badge:"P",badgeLabel:"Plugin",badgeTone:"plugin"}:I.scope==="repo"?{badge:"R",badgeLabel:"Repo",badgeTone:"repo"}:I.scope==="system"?{badge:"S",badgeLabel:"System",badgeTone:"system"}:{badge:"U",badgeLabel:"User",badgeTone:"user"}}function wr(I,B){const re=Ur(I);if(re){Er(re);return}if(B){const Re=(r.skills??[]).find(vt=>vt.path===I);Re&&!c.value.some(vt=>vt.path===I)&&(c.value=[...c.value,Re])}else c.value=c.value.filter(Re=>Re.path!==I)}function Mn(I){if(!De.value)return;const B=Pe.value;if(!B)return;const re=I.target;!re||B.contains(re)||(De.value=!1)}return ca(()=>{document.addEventListener("click",Mn),window.addEventListener("drop",yt),window.addEventListener("dragend",yt),window.addEventListener("blur",yt),hn()}),t({hydrateDraft:Et,appendTextToDraft:Ot,hasUnsavedDraft:()=>Q.value}),Pa(()=>{document.removeEventListener("click",Mn),window.removeEventListener("drop",yt),window.removeEventListener("dragend",yt),window.removeEventListener("blur",yt),window.removeEventListener("pointerup",vn),window.removeEventListener("pointercancel",vn),window.removeEventListener("blur",vn),He&&clearTimeout(He)}),pt(()=>r.activeThreadId,I=>{de(),ee&&xt(ee,Wt()),Ce();const B=ze(I);B&&(se(B),Rn()),ee=I.trim()},{immediate:!0}),pt([s,l,f,c],()=>{ee&&xt(ee,Wt())},{deep:!0}),pt(()=>r.cwd,()=>{Se.value&&To()}),pt(Me,I=>{Ie.value=I}),(I,B)=>(k(),R("form",{class:"thread-composer",onSubmit:B[4]||(B[4]=Xe(re=>U(e.isTurnInProgress?Ie.value:"steer"),["prevent"]))},[lt.value?(k(),R("p",XC,$(lt.value),1)):J("",!0),m("div",{class:et(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":H.value}])},[l.value.length>0?(k(),R("div",ZC,[(k(!0),R(Ye,null,Kt(l.value,re=>(k(),R("div",{key:re.id,class:"thread-composer-attachment"},[m("img",{class:"thread-composer-attachment-image",src:re.url,alt:re.name||"Selected image"},null,8,eS),m("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${re.name||"image"}`,disabled:fe.value,onClick:Re=>cn(re.id)}," x ",8,tS)]))),128))])):J("",!0),g.value.length>0?(k(),R("div",nS,[(k(!0),R(Ye,null,Kt(g.value,re=>(k(),R("span",{key:re.id,class:"thread-composer-folder-chip"},[Oe(Gc,{class:"thread-composer-folder-chip-icon"}),m("span",{class:"thread-composer-folder-chip-name",title:re.name},$(re.name),9,rS),m("span",oS,[re.isUploading?(k(),R(Ye,{key:0},[ns($(dn(re))+"% uploading ("+$(re.processed)+"/"+$(re.total)+") ",1)],64)):(k(),R(Ye,{key:1},[ns($(re.filePaths.length)+" file"+$(re.filePaths.length===1?"":"s"),1)],64))]),m("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${re.name}`,disabled:fe.value,onClick:Re=>Zr(re.id)},"×",8,aS)]))),128))])):J("",!0),le.value.length>0?(k(),R("div",sS,[(k(!0),R(Ye,null,Kt(le.value,re=>(k(),R("span",{key:re.fsPath,class:"thread-composer-file-chip"},[Oe(Fs,{class:"thread-composer-file-chip-icon"}),m("span",{class:"thread-composer-file-chip-name",title:re.fsPath},$(re.label),9,iS),m("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${re.label}`,disabled:fe.value,onClick:Re=>zn(re.fsPath)},"×",8,lS)]))),128))])):J("",!0),c.value.length>0?(k(),R("div",uS,[(k(!0),R(Ye,null,Kt(c.value,re=>(k(),R("span",{key:re.path,class:"thread-composer-skill-chip"},[m("button",{class:"thread-composer-skill-chip-name",type:"button",title:Or(re.path),"aria-label":`Open ${re.displayName||re.name} SKILL.md`,onClick:Re=>nn(re)},$(re.displayName||re.name),9,cS),m("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${re.displayName||re.name}`,onClick:Re=>zt(re.path)},"×",8,dS)]))),128))])):J("",!0),m("div",{class:et(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":H.value}]),onDragenter:xr,onDragover:Ar,onDragleave:fn,onDrop:Ct},[H.value?(k(),R("div",fS,[...B[5]||(B[5]=[m("span",{class:"thread-composer-drop-overlay-copy"},"Drop images or files",-1)])])):J("",!0),Se.value?(k(),R("div",hS,[Le.value.length>0?(k(!0),R(Ye,{key:0},Kt(Le.value,(re,Re)=>(k(),R("button",{key:re.path,class:et(["thread-composer-file-mention-row",{"is-active":Re===Qe.value}]),type:"button",onMousedown:Xe(vt=>wt(re),["prevent"])},[Vt(re.path)?(k(),R("span",{key:0,class:et(["thread-composer-file-mention-icon-badge",`is-${yr(re.path)}`])},$(Vt(re.path)),3)):Br(re.path)?(k(),R("span",mS,"↓")):(k(),Ze(Fs,{key:2,class:"thread-composer-file-mention-icon-file"})),m("span",vS,[m("span",gS,$(rr(re.path)),1),Dn(re.path)?(k(),R("span",yS,$(Dn(re.path)),1)):J("",!0)])],42,pS))),128)):(k(),R("div",wS,$(S(o)("No matching files")),1))])):J("",!0),tn(m("textarea",{ref_key:"inputRef",ref:oe,"onUpdate:modelValue":B[0]||(B[0]=re=>s.value=re),class:"thread-composer-input",placeholder:kt.value,disabled:fe.value,onInput:Rn,onKeydown:Fr,onPaste:nr},null,40,bS),[[un,s.value]])],34),m("div",{class:et(["thread-composer-controls",{"thread-composer-controls--recording":at.value}])},[m("div",{ref_key:"attachMenuRootRef",ref:Pe,class:"thread-composer-attach"},[m("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":S(o)("Add photos & files"),disabled:fe.value,onClick:Zt}," + ",8,_S),De.value?(k(),R("div",TS,[m("button",{class:"thread-composer-attach-item",type:"button",disabled:fe.value,onClick:wo},$(S(o)("Add photos & files")),9,kS),m("button",{class:"thread-composer-attach-item",type:"button",disabled:fe.value,onClick:ot},$(S(o)("Add folder")),9,CS),m("button",{class:"thread-composer-attach-item",type:"button",disabled:fe.value,onClick:Fo},$(S(o)("Take photo")),9,SS),B[6]||(B[6]=m("div",{class:"thread-composer-attach-separator"},null,-1)),m("div",xS,[m("span",AS,$(S(o)("In-progress send")),1),m("div",ES,[m("button",{class:et(["thread-composer-attach-mode-button",{"is-active":Ie.value==="steer"}]),type:"button",disabled:fe.value,onClick:B[1]||(B[1]=re=>F("steer"))},$(S(o)("Steer")),11,IS),m("button",{class:et(["thread-composer-attach-mode-button",{"is-active":Ie.value==="queue"}]),type:"button",disabled:fe.value,onClick:B[2]||(B[2]=re=>F("queue"))},$(S(o)("Queue")),11,RS)])]),B[7]||(B[7]=m("div",{class:"thread-composer-attach-separator"},null,-1)),we.value?(k(),R("button",{key:0,class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":e.selectedSpeedMode==="fast","aria-label":`${S(o)("Fast mode")} ${e.selectedSpeedMode==="fast"?S(o)("enabled"):S(o)("disabled")}`,disabled:je.value,onClick:Cr},[m("span",MS,[m("span",$S,$(S(o)("Fast mode")),1),m("span",NS,$(me.value),1)]),m("span",{class:et(["thread-composer-attach-switch",{"is-on":e.selectedSpeedMode==="fast","is-busy":e.isUpdatingSpeedMode,"is-disabled":je.value}])},null,2)],8,PS)):J("",!0),m("button",{class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":Ge.value,"aria-label":Ge.value?S(o)("Disable plan mode"):S(o)("Enable plan mode"),disabled:ye.value,onClick:Xr},[m("span",OS,[m("span",jS,$(S(o)("Plan mode")),1),m("span",DS,$(S(o)("Agent proposes a plan before acting")),1)]),m("span",{class:et(["thread-composer-attach-switch",{"is-on":Ge.value}])},null,2)],8,LS)])):J("",!0)],512),at.value?J("",!0):(k(),R(Ye,{key:0},[Oe(Lr,{class:"thread-composer-control","model-value":e.selectedModel,options:Fe.value,"selected-prefix-icon":he.value?pl:null,placeholder:S(o)("Model"),"open-direction":"up",disabled:ye.value||e.models.length===0,"enable-search":"","search-placeholder":S(o)("Search models..."),"onUpdate:modelValue":pr},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Oe(JC,{class:"thread-composer-control",options:z.value,"selected-values":P.value,placeholder:S(o)("Skills"),"search-placeholder":S(o)("Search skills and prompts..."),"create-label":S(o)("Add new prompt"),"allow-remove":!0,"remove-label":S(o)("Remove prompt"),"open-direction":"up",disabled:ye.value,onToggle:wr,onCreate:gr,onRemove:yn},null,8,["options","selected-values","placeholder","search-placeholder","create-label","remove-label","disabled"]),Oe(Lr,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:xe,placeholder:S(o)("Thinking"),"open-direction":"up",disabled:ye.value,"onUpdate:modelValue":Ln},null,8,["model-value","placeholder","disabled"])],64)),m("div",{class:et(["thread-composer-actions",{"thread-composer-actions--recording":at.value}])},[S(X)==="recording"?(k(),R("div",FS,[m("canvas",{ref_key:"dictationWaveformCanvasRef",ref:K,class:"thread-composer-dictation-waveform"},null,512)])):J("",!0),S(X)==="recording"?(k(),R("span",US,$(gt.value),1)):J("",!0),S(D)?(k(),R("button",{key:2,class:et(["thread-composer-mic",{"thread-composer-mic--active":S(X)==="recording"}]),type:"button","aria-label":dt.value,title:dt.value,disabled:fe.value,onClick:fa,onPointerdown:Do,onPointerup:vn,onPointercancel:vn},[S(X)==="recording"?(k(),Ze(ah,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(k(),Ze(EC,{key:1,class:"thread-composer-mic-icon"}))],42,BS)):J("",!0),e.isTurnInProgress&&!q.value?(k(),R("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?S(o)("Saving thread before stop is available"):S(o)("Stop"),title:e.isStopPending?S(o)("Saving thread before stop is available"):S(o)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending,onClick:Wn},[e.isStopPending?(k(),R("span",HS)):(k(),Ze(ah,{key:1,class:"thread-composer-stop-icon"}))],8,qS)):(k(),R("button",{key:4,class:et(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Ie.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&Ie.value==="queue"?S(o)("Queue message"):S(o)("Send message"),title:e.isTurnInProgress?`${S(o)("Send")} ${Ie.value==="queue"?S(o)("Queue"):S(o)("Steer")}`:S(o)("Send"),disabled:!ae.value,onClick:B[3]||(B[3]=re=>U(e.isTurnInProgress?Ie.value:"steer"))},[Oe(_C,{class:"thread-composer-submit-icon"})],10,WS))],2)],2)],2),m("input",{ref_key:"photoLibraryInputRef",ref:G,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:fe.value,onChange:_o},null,40,zS),m("input",{ref_key:"cameraCaptureInputRef",ref:ve,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:fe.value,onChange:Ft},null,40,VS),m("input",{ref_key:"folderPickerInputRef",ref:Te,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:fe.value,onChange:mr},null,40,GS)],32))}}),sh=It(QS,[["__scopeId","data-v-9f6b9876"]]),JS={key:0,class:"thread-pending-request"},XS={class:"thread-pending-request-title"},ZS=["title"],ex={class:"thread-pending-request-approval"},tx=["aria-label"],nx=["aria-pressed","onClick"],rx={class:"thread-pending-request-option-index"},ox={class:"thread-pending-request-option-label"},ax={class:"thread-pending-request-footer thread-pending-request-footer--approval"},sx=["value","placeholder"],ix={class:"thread-pending-request-header"},lx={class:"thread-pending-request-heading"},ux={class:"thread-pending-request-eyebrow"},cx={class:"thread-pending-request-title"},dx={key:0,class:"thread-pending-request-counter"},fx={key:0,class:"thread-pending-request-preview"},hx={class:"thread-pending-request-preview-code"},px={key:1,class:"thread-pending-request-user-input"},mx={key:0,class:"thread-pending-request-question-description"},vx=["href"],gx={class:"thread-pending-request-question-title"},yx={key:0},wx={key:0,class:"thread-pending-request-question-text"},bx={key:1,class:"thread-pending-request-input-wrap"},_x={class:"thread-pending-request-select-label"},Tx=["type","value","onInput"],kx={key:2,class:"thread-pending-request-select-wrap"},Cx={class:"thread-pending-request-select-label"},Sx={key:3,class:"thread-pending-request-select-wrap"},xx={class:"thread-pending-request-select-label"},Ax={key:4,class:"thread-pending-request-question-options"},Ex=["checked","onChange"],Ix={class:"thread-pending-request-checkbox-label"},Rx={key:2,class:"thread-pending-request-validation-error"},Px={class:"thread-pending-request-footer"},Mx={key:2,class:"thread-pending-request-user-input"},$x={class:"thread-pending-request-question-title"},Nx={key:0,class:"thread-pending-request-question-text"},Lx={key:1,class:"thread-pending-request-question-options"},Ox={class:"thread-pending-request-select-wrap"},jx={class:"thread-pending-request-select-label"},Dx={key:0,class:"thread-pending-request-question-description"},Fx={key:2,class:"thread-pending-request-input-wrap"},Ux={class:"thread-pending-request-select-label"},Bx=["value","placeholder","onInput"],qx={class:"thread-pending-request-footer"},Hx={key:3,class:"thread-pending-request-actions"},Wx={key:4,class:"thread-pending-request-actions"},zx=Hn({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean}},emits:["respondServerRequest"],setup(e,{emit:t}){const n=e,r=t,a=A("accept"),o=A(""),s=A({}),l=A({}),c=A({}),h=A(""),{t:f}=Ma();function g(q){return q!==null&&typeof q=="object"&&!Array.isArray(q)?q:null}function _(q){return typeof q=="string"?q.trim():""}function E(q){return typeof q=="string"?q:null}function O(q){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(q)?q:JSON.stringify(q)}function H(q){const F=(Array.isArray(q.commandActions)?q.commandActions:[]).map(se=>g(se)).map(se=>_(se==null?void 0:se.command)).find(se=>se.length>0);if(F)return F.replace(/\s+/g," ").trim();if(Array.isArray(q.command)){const se=q.command.filter(Ce=>typeof Ce=="string").map(Ce=>Ce.trim()).filter(Ce=>Ce.length>0);if(se.length>0)return se.map(Ce=>O(Ce)).join(" ")}return Pe(_(q.command))}function X(q){return q.method==="item/commandExecution/requestApproval"||q.method==="execCommandApproval"}function D(q){return q.method==="item/fileChange/requestApproval"||q.method==="applyPatchApproval"}function j(q){return q.method==="item/permissions/requestApproval"}function K(q){return X(q)||D(q)||j(q)}function Z(q){return q.method==="mcpServer/elicitation/request"}function be(q){const U=g(q.params);return _(U==null?void 0:U.reason)||_(U==null?void 0:U.prompt)||_(U==null?void 0:U.message)}function pe(q){return K(q)?"Awaiting approval":Z(q)?"MCP server input required":q.method==="item/tool/requestUserInput"?"Awaiting response":q.method==="item/tool/call"?"Tool call waiting for response":q.method}function de(q){const U=be(q);return U||(X(q)?"Do you want to run this command?":D(q)?"Do you want to make these changes?":j(q)?"Do you want to grant these permissions?":Z(q)?"An MCP server needs your input before Codex can continue.":q.method==="item/tool/requestUserInput"?"Codex needs your answer before it can continue.":"Codex is waiting for a response before it can continue.")}function Pe(q){var Ne;const U=q.trim();if(!U)return"";const F=U.match(/-Command\s+(.+)$/i),se=((Ne=F==null?void 0:F[1])==null?void 0:Ne.trim())??U;return(se.startsWith('"')&&se.endsWith('"')?se.slice(1,-1):se).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function G(q){const U=g(q.params);if(!U)return"";if(X(q))return H(U);if(D(q)){const F=_(U.grantRoot)||_(U.grant_root);if(F)return F.replace(/\s+/g," ").trim();const se=g(U.fileChanges)??g(U.changes);if(!se)return"";const Ce=Object.keys(se).map(Ne=>Ne.trim()).filter(Ne=>Ne.length>0);return Ce.length===0?"":Ce.slice(0,3).join(", ")}return j(q)?ve(U.permissions):Z(q)?_(U.serverName)||_(U.url):""}function ve(q){const U=g(q);if(!U)return"";const F=[],se=g(U.fileSystem),Ce=g(U.network),Ne=Array.isArray(se==null?void 0:se.read)?se.read.filter(xt=>typeof xt=="string"):[],ze=Array.isArray(se==null?void 0:se.write)?se.write.filter(xt=>typeof xt=="string"):[];return Ne.length>0&&F.push(`Read: ${Ne.join(", ")}`),ze.length>0&&F.push(`Write: ${ze.join(", ")}`),(Ce==null?void 0:Ce.enabled)===!0&&F.push("Network access"),F.join(" • ")}function Te(q){return!q||!K(q)?[]:[{id:"accept",label:"Yes"},{id:"acceptForSession",label:"Yes for Session"}]}const oe=ne(()=>Te(n.request));pt(()=>{var q;return((q=n.request)==null?void 0:q.id)??0},()=>{var q;o.value="",s.value={},l.value={},c.value={},h.value="",a.value=((q=oe.value[0])==null?void 0:q.id)??"accept"},{immediate:!0}),pt(oe,q=>{var U;a.value!=="decline"&&(q.some(F=>F.id===a.value)||(a.value=((U=q[0])==null?void 0:U.id)??"accept"))},{immediate:!0});function ke(q,U){return`${String(q)}:${U}`}function De(q){const U=g(q.params),F=Array.isArray(U==null?void 0:U.questions)?U.questions:[],se=[];for(const Ce of F){const Ne=g(Ce);if(!Ne)continue;const ze=_(Ne.id);if(!ze)continue;const xt=Array.isArray(Ne.options)?Ne.options.map(Bt=>g(Bt)).map(Bt=>({label:_(Bt==null?void 0:Bt.label),description:_(Bt==null?void 0:Bt.description)})).filter(Bt=>Bt.label.length>0):[];se.push({id:ze,header:_(Ne.header),question:_(Ne.question),isOther:Ne.isOther===!0,options:xt})}return se}function Be(q,U,F){const se=ke(q,U),Ce=s.value[se];return typeof Ce=="string"&&Ce.length>0?Ce:F}function Ke(q){return q.map(U=>({value:U.label,label:U.label}))}function Le(q,U){return l.value[ke(q,U)]??""}function Se(q,U,F){const se=ke(q,U);s.value={...s.value,[se]:F}}function Qe(q,U,F){const se=F.target;if(!(se instanceof HTMLInputElement))return;const Ce=ke(q,U);l.value={...l.value,[Ce]:se.value}}function tt(q,U,F){var Ce,Ne;const se=Be(q,U,((Ce=F[0])==null?void 0:Ce.label)||"");return((Ne=F.find(ze=>ze.label===se))==null?void 0:Ne.description)??""}function Ue(q,U){return`${String(q)}:${U}`}function He(q){var U;return _((U=g(q.params))==null?void 0:U.serverName)}function ft(q){var F;const U=_((F=g(q.params))==null?void 0:F.url);if(!U)return"";try{const se=new URL(U),Ce=se.protocol.toLowerCase();return Ce==="https:"||Ce==="http:"?se.toString():""}catch{return""}}function Je(q){const U=g(q.params),F=g(U==null?void 0:U.requestedSchema),se=g(F==null?void 0:F.properties);if(!se)return[];const Ce=new Set(Array.isArray(F==null?void 0:F.required)?F.required.filter(Ne=>typeof Ne=="string"):[]);return Object.entries(se).map(([Ne,ze])=>We(Ne,g(ze),Ce.has(Ne))).filter(Ne=>Ne!==null)}function We(q,U,F){if(!U)return null;const se=_(U.title)||q,Ce=_(U.description),Ne=_(U.type);if(Ne==="boolean")return{key:q,label:se,description:Ce,required:F,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof U.default=="boolean"?U.default:null,hasExplicitDefault:typeof U.default=="boolean"};if(Ne==="number"||Ne==="integer")return{key:q,label:se,description:Ce,required:F,kind:"number",inputType:"number",options:[],defaultValue:typeof U.default=="number"?U.default:null,hasExplicitDefault:typeof U.default=="number"};const ze=Tt(U);if(Ne==="array")return{key:q,label:se,description:Ce,required:F,kind:"multiEnum",inputType:"checkbox",options:ze,defaultValue:Array.isArray(U.default)?U.default.filter(Bt=>typeof Bt=="string"):[],hasExplicitDefault:Array.isArray(U.default)};const xt=E(U.default);return ze.length>0?{key:q,label:se,description:Ce,required:F,kind:"singleEnum",inputType:"select",options:ze,defaultValue:xt,hasExplicitDefault:xt!==null}:{key:q,label:se,description:Ce,required:F,kind:"string",inputType:ee(U),options:[],defaultValue:xt,hasExplicitDefault:xt!==null}}function Tt(q){const F=(Array.isArray(q.oneOf)?q.oneOf:Array.isArray(q.anyOf)?q.anyOf:[]).map(ze=>g(ze)).map(ze=>({value:_(ze==null?void 0:ze.const),label:_(ze==null?void 0:ze.title)||_(ze==null?void 0:ze.const)})).filter(ze=>ze.value.length>0);if(F.length>0)return F;const se=g(q.items);if(se){const ze=Tt(se);if(ze.length>0)return ze}const Ce=Array.isArray(q.enum)?q.enum.filter(ze=>typeof ze=="string"):[],Ne=Array.isArray(q.enumNames)?q.enumNames.filter(ze=>typeof ze=="string"):[];return Ce.map((ze,xt)=>({value:ze,label:Ne[xt]||ze}))}function ee(q){const U=_(q.format);return U==="email"?"email":U==="uri"?"url":U==="date"?"date":U==="date-time"?"datetime-local":"text"}function xe(q,U){const F=c.value[Ue(q,U.key)];return F!==void 0?F:U.defaultValue}function Ae(q,U){const F=xe(q,U);return Array.isArray(F)?F.filter(se=>typeof se=="string"):[]}function Fe(q,U,F){const se=F.target;!(se instanceof HTMLInputElement)&&!(se instanceof HTMLSelectElement)||Ge(q,U,se.value)}function Ge(q,U,F){const se=(U.kind==="number",F);c.value={...c.value,[Ue(q,U.key)]:F.length>0?se:null},h.value=""}function x(q,U,F){let se=null;F==="true"?se=!0:F==="false"&&(se=!1),c.value={...c.value,[Ue(q,U.key)]:se},h.value=""}function P(q){return[...q.hasExplicitDefault?[]:[{value:"",label:f("Select true or false")}],{value:"true",label:f("True")},{value:"false",label:f("False")}]}function z(q){return[...q.hasExplicitDefault?[]:[{value:"",label:f("Select an option")}],...q.options]}function ae(q,U,F,se){const Ce=se.target;if(!(Ce instanceof HTMLInputElement))return;const Ne=new Set(Ae(q,U));Ce.checked?Ne.add(F):Ne.delete(F),c.value={...c.value,[Ue(q,U.key)]:Array.from(Ne)},h.value=""}function Q(q){return q===!0?"true":q===!1?"false":""}function le(q,U){const F=xe(q,U);return U.kind==="multiEnum"?Array.isArray(F)&&F.length>0:U.kind==="boolean"?typeof F=="boolean":U.kind==="number"&&typeof F=="number"?!0:typeof F=="string"&&F.trim().length>0}function fe(q){const U=Je(q).filter(F=>F.required&&!le(q.id,F)).map(F=>F.label);return U.length===0?"":U.length===1?`Answer the required field: ${U[0]}.`:`Answer the required fields: ${U.join(", ")}.`}function ye(q){const U={};for(const F of Je(q)){const se=xe(q.id,F);if(F.kind==="multiEnum"){const Ne=Array.isArray(se)?se:[];(Ne.length>0||F.required)&&(U[F.key]=Ne);continue}if(F.kind==="boolean"){typeof se=="boolean"&&(U[F.key]=se);continue}if(F.kind==="number"){const Ne=typeof se=="number"?se:Number(String(se).trim());Number.isNaN(Ne)||(U[F.key]=Ne);continue}const Ce=String(se??"").trim();(Ce.length>0||F.required)&&(U[F.key]=Ce)}return U}function we(q){a.value=q}function he(){a.value="decline"}function je(q){const U=q.target;U instanceof HTMLInputElement&&(o.value=U.value,a.value="decline")}function me(q,U){var F;if(j(q)){if(U==="decline"||U==="cancel"){r("respondServerRequest",{id:q.id,error:{code:-32e3,message:U==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const se=g((F=g(q.params))==null?void 0:F.permissions)??{};r("respondServerRequest",{id:q.id,result:{permissions:se,scope:U==="acceptForSession"?"session":"turn"}});return}r("respondServerRequest",{id:q.id,result:{decision:U}})}function Me(q){const U=o.value.trim(),F=U.length>0?"decline":a.value;if(j(q)){me(q,F);return}r("respondServerRequest",{id:q.id,result:{decision:F},followUpMessageText:U||void 0})}function Ie(q,U){const F=g(q.params),se={action:U};if(U==="accept"&&_(F==null?void 0:F.mode)==="form"){const Ce=fe(q);if(Ce){h.value=Ce;return}se.content=ye(q)}r("respondServerRequest",{id:q.id,result:se})}function at(q){var se;const U=De(q),F={};for(const Ce of U){const Ne=Be(q.id,Ce.id,((se=Ce.options[0])==null?void 0:se.label)||""),ze=Le(q.id,Ce.id).trim(),xt=[Ne,ze].map(Bt=>Bt.trim()).filter(Bt=>Bt.length>0);F[Ce.id]={answers:xt}}r("respondServerRequest",{id:q.id,result:{answers:F}})}function dt(q){r("respondServerRequest",{id:q.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function lt(q){r("respondServerRequest",{id:q.id,result:{success:!0,contentItems:[]}})}function gt(q){r("respondServerRequest",{id:q.id,result:{}})}function kt(q){r("respondServerRequest",{id:q.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(q,U)=>e.request?(k(),R("section",JS,[m("article",{class:et(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":e.hasQueueAbove}])},[K(e.request)?(k(),R(Ye,{key:0},[m("p",XS,$(de(e.request)),1),G(e.request)?(k(),R("p",{key:0,class:"thread-pending-request-command-line",title:G(e.request)},$(G(e.request)),9,ZS)):J("",!0),m("section",ex,[m("div",{class:"thread-pending-request-options",role:"radiogroup","aria-label":S(f)("Approval choices")},[(k(!0),R(Ye,null,Kt(oe.value,(F,se)=>(k(),R("button",{key:F.id,type:"button",class:et(["thread-pending-request-option",{"is-selected":a.value===F.id}]),"aria-pressed":a.value===F.id,onClick:Ce=>we(F.id)},[m("span",rx,$(se+1)+".",1),m("span",ox,$(F.label),1)],10,nx))),128))],8,tx),m("footer",ax,[m("label",{class:et(["thread-pending-request-inline-input",{"is-active":a.value==="decline"||o.value.length>0}])},[U[11]||(U[11]=m("span",{class:"thread-pending-request-option-index"},"3.",-1)),m("input",{class:"thread-pending-request-inline-control",type:"text",value:o.value,placeholder:S(f)("No, and tell Codex what to do differently"),onFocus:he,onInput:je,onKeydown:U[0]||(U[0]=mn(Xe(F=>Me(e.request),["prevent"]),["enter"]))},null,40,sx)],2),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:U[1]||(U[1]=F=>me(e.request,"cancel"))},$(S(f)("Skip")),1),m("button",{type:"button",class:"thread-pending-request-primary",onClick:U[2]||(U[2]=F=>Me(e.request))},$(S(f)("Send")),1)])])],64)):(k(),R(Ye,{key:1},[m("header",ix,[m("div",lx,[m("p",ux,$(pe(e.request)),1),m("p",cx,$(de(e.request)),1)]),(e.requestCount??0)>1?(k(),R("span",dx,$(e.requestCount??0)+" pending",1)):J("",!0)]),G(e.request)?(k(),R("div",fx,[m("code",hx,$(G(e.request)),1)])):J("",!0),e.request.method==="mcpServer/elicitation/request"?(k(),R("section",px,[He(e.request)?(k(),R("p",mx,$(S(f)("Server"))+": "+$(He(e.request)),1)):J("",!0),ft(e.request)?(k(),R("a",{key:1,class:"thread-pending-request-link",href:ft(e.request),target:"_blank",rel:"noopener noreferrer"},$(S(f)("Open authorization link")),9,vx)):J("",!0),(k(!0),R(Ye,null,Kt(Je(e.request),F=>(k(),R("div",{key:`${e.request.id}:${F.key}`,class:"thread-pending-request-question"},[m("p",gx,[ns($(F.label),1),F.required?(k(),R("span",yx," *")):J("",!0)]),F.description?(k(),R("p",wx,$(F.description),1)):J("",!0),F.kind==="string"||F.kind==="number"?(k(),R("label",bx,[m("span",_x,$(S(f)("Value")),1),m("input",{class:"thread-pending-request-input",type:F.inputType,value:String(xe(e.request.id,F)??""),onInput:se=>Fe(e.request.id,F,se)},null,40,Tx)])):F.kind==="boolean"?(k(),R("label",kx,[m("span",Cx,$(S(f)("Choice")),1),Oe(Lr,{class:"thread-pending-request-select","model-value":Q(xe(e.request.id,F)),options:P(F),placeholder:S(f)("Select true or false"),"onUpdate:modelValue":se=>x(e.request.id,F,se)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):F.kind==="singleEnum"?(k(),R("label",Sx,[m("span",xx,$(S(f)("Choice")),1),Oe(Lr,{class:"thread-pending-request-select","model-value":String(xe(e.request.id,F)??""),options:z(F),placeholder:S(f)("Select an option"),"onUpdate:modelValue":se=>Ge(e.request.id,F,se)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):(k(),R("div",Ax,[(k(!0),R(Ye,null,Kt(F.options,se=>(k(),R("label",{key:`${e.request.id}:${F.key}:${se.value}`,class:"thread-pending-request-checkbox-row"},[m("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:Ae(e.request.id,F).includes(se.value),onChange:Ce=>ae(e.request.id,F,se.value,Ce)},null,40,Ex),m("span",Ix,$(se.label),1)]))),128))]))]))),128)),h.value?(k(),R("p",Rx,$(h.value),1)):J("",!0),m("footer",Px,[m("button",{type:"button",class:"thread-pending-request-secondary",onClick:U[3]||(U[3]=F=>Ie(e.request,"cancel"))},$(S(f)("Cancel")),1),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:U[4]||(U[4]=F=>Ie(e.request,"decline"))},$(S(f)("Decline")),1),m("button",{type:"button",class:"thread-pending-request-primary",onClick:U[5]||(U[5]=F=>Ie(e.request,"accept"))},$(S(f)("Continue")),1)])])):e.request.method==="item/tool/requestUserInput"?(k(),R("section",Mx,[(k(!0),R(Ye,null,Kt(De(e.request),F=>{var se;return k(),R("div",{key:`${e.request.id}:${F.id}`,class:"thread-pending-request-question"},[m("p",$x,$(F.header||F.question),1),F.question?(k(),R("p",Nx,$(F.question),1)):J("",!0),F.options.length>0?(k(),R("div",Lx,[m("label",Ox,[m("span",jx,$(S(f)("Choice")),1),Oe(Lr,{class:"thread-pending-request-select","model-value":Be(e.request.id,F.id,((se=F.options[0])==null?void 0:se.label)||""),options:Ke(F.options),"onUpdate:modelValue":Ce=>Se(e.request.id,F.id,Ce)},null,8,["model-value","options","onUpdate:modelValue"])]),tt(e.request.id,F.id,F.options)?(k(),R("p",Dx,$(tt(e.request.id,F.id,F.options)),1)):J("",!0)])):J("",!0),F.isOther?(k(),R("label",Fx,[m("span",Ux,$(S(f)("Other answer")),1),m("input",{class:"thread-pending-request-input",type:"text",value:Le(e.request.id,F.id),placeholder:S(f)("Other answer"),onInput:Ce=>Qe(e.request.id,F.id,Ce)},null,40,Bx)])):J("",!0)])}),128)),m("footer",qx,[m("button",{type:"button",class:"thread-pending-request-primary",onClick:U[6]||(U[6]=F=>at(e.request))},$(S(f)("Send")),1)])])):e.request.method==="item/tool/call"?(k(),R("section",Hx,[m("button",{type:"button",class:"thread-pending-request-primary",onClick:U[7]||(U[7]=F=>dt(e.request))},$(S(f)("Fail Tool Call")),1),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:U[8]||(U[8]=F=>lt(e.request))},$(S(f)("Success (Empty)")),1)])):(k(),R("section",Wx,[m("button",{type:"button",class:"thread-pending-request-primary",onClick:U[9]||(U[9]=F=>gt(e.request))},$(S(f)("Return Empty Result")),1),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:U[10]||(U[10]=F=>kt(e.request))},$(S(f)("Reject Request")),1)]))],64))],2)])):J("",!0)}}),Vx=It(zx,[["__scopeId","data-v-7c342c87"]]),Gx={key:0,class:"queued-messages"},Kx={class:"queued-messages-inner"},Yx=["onDragstart","onDragover","onDragleave","onDrop"],Qx=["aria-label","title"],Jx={class:"queued-row-text"},Xx={class:"queued-row-actions"},Zx=["title","onClick"],eA=["title","onClick"],tA=["aria-label","title","onClick"],nA=Hn({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete","reorder"],setup(e,{emit:t}){const n=t,{t:r}=Ma(),a=A(""),o=A("");function s(_,E){var O;a.value=E,o.value="",(O=_.dataTransfer)==null||O.setData("text/plain",E),_.dataTransfer&&(_.dataTransfer.effectAllowed="move")}function l(_){!a.value||a.value===_||(o.value=_)}function c(_){o.value===_&&(o.value="")}function h(_){const E=a.value;f(),!(!E||E===_)&&n("reorder",{draggedId:E,targetId:_})}function f(){a.value="",o.value=""}function g(_){var j,K,Z;const E=_.text.trim();if(E)return E;const O=[],H=((j=_.imageUrls)==null?void 0:j.length)??0,X=((K=_.fileAttachments)==null?void 0:K.length)??0,D=((Z=_.skills)==null?void 0:Z.length)??0;return H>0&&O.push(`${H} ${r(H===1?"image":"images")}`),X>0&&O.push(`${X} ${r(X===1?"file":"files")}`),D>0&&O.push(`${D} ${r(D===1?"skill":"skills")}`),O.join(", ")||r("(empty queued message)")}return(_,E)=>e.messages.length>0?(k(),R("div",Gx,[m("div",Kx,[(k(!0),R(Ye,null,Kt(e.messages,O=>(k(),R("div",{key:O.id,class:et(["queued-row",{"is-dragging":a.value===O.id,"is-drop-target":o.value===O.id&&a.value!==O.id}]),draggable:"true",onDragstart:H=>s(H,O.id),onDragover:Xe(H=>l(O.id),["prevent"]),onDragleave:H=>c(O.id),onDrop:Xe(H=>h(O.id),["prevent"]),onDragend:f},[m("button",{class:"queued-row-drag",type:"button","aria-label":S(r)("Drag to reorder queued message"),title:S(r)("Drag to reorder queued message")},[...E[0]||(E[0]=[m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[m("path",{fill:"currentColor",d:"M9 5.5A1.5 1.5 0 1 1 6 5.5a1.5 1.5 0 0 1 3 0m0 6.5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8A1.5 1.5 0 1 0 7.5 17a1.5 1.5 0 0 0 0 3m10-13A1.5 1.5 0 1 0 17.5 4a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3"})],-1)])],8,Qx),E[2]||(E[2]=m("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})],-1)),m("span",Jx,$(g(O)),1),m("div",Xx,[m("button",{class:"queued-row-edit",type:"button",title:S(r)("Edit queued message"),onClick:H=>_.$emit("edit",O.id)},$(S(r)("Edit")),9,Zx),m("button",{class:"queued-row-steer",type:"button",title:S(r)("Send now without interrupting work"),onClick:H=>_.$emit("steer",O.id)},$(S(r)("Steer")),9,eA),m("button",{class:"queued-row-delete",type:"button","aria-label":S(r)("Delete queued message"),title:S(r)("Delete queued message"),onClick:H=>_.$emit("delete",O.id)},[...E[1]||(E[1]=[m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"})],-1)])],8,tA)])],42,Yx))),128))])])):J("",!0)}}),rA=It(nA,[["__scopeId","data-v-b7a3edb8"]]),oA={key:0,class:"rate-limit-status","aria-live":"polite"},aA=["title"],sA={class:"rate-limit-card-header"},iA={class:"rate-limit-card-title"},lA={key:0,class:"rate-limit-card-plan"},uA={class:"rate-limit-card-metrics"},cA={key:0,class:"rate-limit-card-footer"},dA=Hn({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(D){var j,K;return((j=D.limitId)==null?void 0:j.trim())||((K=D.limitName)==null?void 0:K.trim())||"__default__"}function n(D){var j,K;return((j=D.limitName)==null?void 0:j.trim())||((K=D.limitId)==null?void 0:K.trim())||"Rate limits"}function r(D){const j=D.trim();return j?j.replace(/[_-]+/g," ").replace(/\b\w/g,K=>K.toUpperCase()):""}function a(D){return!D||D<=0?"Window":D%1440===0?`${D/1440}d`:D%60===0?`${D/60}h`:D<60?`${D}m`:`${Math.round(D/60*10)/10}h`}function o(D){const j=Math.max(0,Math.min(100,100-D));return`${Math.round(j)}% left`}function s(D){return`${Math.round(D)}%`}function l(D,j){return{key:j,label:`${a(D.windowDurationMins)} ${o(D.usedPercent)}`}}function c(D){const j=[];return D.primary&&j.push(l(D.primary,"primary")),D.secondary&&j.push(l(D.secondary,"secondary")),j}function h(D){if(!D)return"";const j=new Date(D*1e3),K=j.getMonth()+1,Z=String(j.getDate()).padStart(2,"0"),be=String(j.getHours()).padStart(2,"0"),pe=String(j.getMinutes()).padStart(2,"0");return`${K}.${Z} ${be}:${pe}`}function f(D){if(!(D!=null&&D.resetsAt))return"";const j=D.resetsAt*1e3-Date.now();if(j<=0)return"Resetting now";const K=Math.round(j/6e4);if(K<60)return`Resets in ${K}m`;const Z=Math.round(K/60);return Z<24?`Resets in ${Z}h`:`Resets in ${Math.round(Z/24)}d`}function g(D){return[D.primary,D.secondary].filter(j=>j!==null)}function _(D){const j=g(D);return j.length===0?null:[...j].sort((K,Z)=>{const be=K.windowDurationMins??Number.MAX_SAFE_INTEGER,pe=Z.windowDurationMins??Number.MAX_SAFE_INTEGER;return be!==pe?be-pe:(K.resetsAt??Number.MAX_SAFE_INTEGER)-(Z.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function E(D){const j=g(D);if(j.length===0)return"";const K=[...j].sort((be,pe)=>{const de=be.windowDurationMins??-1,Pe=pe.windowDurationMins??-1;return de!==Pe?Pe-de:(pe.resetsAt??-1)-(be.resetsAt??-1)})[0],Z=h(K.resetsAt);return Z||""}function O(D){const j=D.credits;return j?j.unlimited?"Unlimited credits":j.balance?`Credits ${j.balance}`:j.hasCredits?"Credits available":"":""}function H(D){return[f(_(D)),E(D),O(D)].filter(j=>j.length>0)}function X(D){const j=[n(D)];for(const K of c(D))j.push(K.label);for(const K of g(D))j.push(`${a(K.windowDurationMins)} used ${s(K.usedPercent)}`);for(const K of H(D))j.push(K);return j.join(`
|
|
50
|
-
`)}return(D,j)=>e.snapshots.length>0?(k(),R("aside",oA,[(k(!0),R(Ye,null,Kt(e.snapshots,K=>(k(),R("div",{key:t(K),class:"rate-limit-card",title:X(K)},[m("div",sA,[m("span",iA,$(n(K)),1),K.planType?(k(),R("span",lA,$(r(K.planType)),1)):J("",!0)]),m("div",uA,[(k(!0),R(Ye,null,Kt(c(K),Z=>(k(),R("span",{key:Z.key,class:"rate-limit-card-metric"},$(Z.label),1))),128))]),H(K).length>0?(k(),R("div",cA,$(H(K).join(" | ")),1)):J("",!0)],8,aA))),128))])):J("",!0)}}),fA=It(dA,[["__scopeId","data-v-df88906b"]]),hA=["disabled","title","aria-label"],pA={class:"header-git-trigger-label"},mA={key:0,class:"header-git-dirty-dot","aria-label":"Uncommitted changes"},vA={key:0,class:"header-git-menu-wrap"},gA={class:"header-git-menu"},yA={class:"header-git-state"},wA={class:"header-git-state-label"},bA={class:"header-git-state-value"},_A={key:0,class:"header-git-state-meta"},TA={class:"header-git-search-wrap"},kA=["onKeydown"],CA={class:"header-git-branches",role:"listbox"},SA={class:"header-git-branch-row"},xA=["aria-label","onClick"],AA=["disabled","onClick"],EA={class:"header-git-branch-name"},IA={key:0,class:"header-git-branch-meta"},RA={key:1,class:"header-git-branch-meta"},PA={key:0,class:"header-git-commits"},MA={key:0,class:"header-git-commits-empty"},$A={key:1,class:"header-git-commits-empty is-error"},NA=["disabled","title","onClick"],LA={class:"header-git-commit-top"},OA={class:"header-git-commit-meta"},jA={key:0,class:"header-git-branch-meta"},DA={class:"header-git-commit-subject"},FA={key:2,class:"header-git-commits-empty"},UA={key:0,class:"header-git-empty"},BA=Hn({__name:"HeaderGitBranchDropdown",props:{currentBranch:{},headSha:{},headSubject:{},headDate:{},detached:{type:Boolean},dirty:{type:Boolean},branches:{},commitsByBranch:{},commitsLoadingFor:{},commitsError:{},loading:{type:Boolean},busy:{type:Boolean},error:{},reviewOpen:{type:Boolean},showReview:{type:Boolean}},emits:["toggleReview","checkoutBranch","resetBranchToCommit","loadCommits"],setup(e,{emit:t}){const n=e,r=t,a=A(null),o=A(null),s=A(!1),l=A(""),c=A(""),h=ne(()=>n.showReview!==!1),f=ne(()=>n.currentBranch?n.currentBranch:n.headSubject?n.headSubject:n.headSha?`Detached ${n.headSha}`:n.loading?"Loading branch...":"Detached HEAD"),g=ne(()=>n.detached?[n.headSha,n.headDate].filter(Boolean).join(" · "):""),_=ne(()=>`Git branch: ${f.value}`),E=ne(()=>n.loading&&n.branches.length===0),O=ne(()=>n.busy||n.loading),H=ne(()=>n.error||(n.dirty?"Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them.":"")),X=ne(()=>n.error?"error":"info"),D=ne(()=>{const G=l.value.trim().toLowerCase(),ve=n.branches;return G?ve.filter(Te=>Te.label.toLowerCase().includes(G)||Te.value.toLowerCase().includes(G)):ve});function j(){E.value||(s.value=!s.value)}function K(G){c.value=c.value===G?"":G,c.value&&r("loadCommits",G)}function Z(G){var Te;const ve=((Te=n.headSha)==null?void 0:Te.trim())??"";return ve?G.sha===ve||G.shortSha===ve||G.sha.startsWith(ve):!1}function be(G,ve){return G.isRemote?"Remote branches cannot be reset from this menu":`Reset ${G.value} to ${ve.shortSha}`}function pe(G,ve){G.isRemote||r("resetBranchToCommit",{branch:G.value,sha:ve.sha})}function de(){if(l.value){l.value="";return}s.value=!1}function Pe(G){if(!s.value)return;const ve=a.value,Te=G.target;!ve||!(Te instanceof Node)||ve.contains(Te)||(s.value=!1,l.value="")}return pt(s,G=>{G&&Xt(()=>{var ve;return(ve=o.value)==null?void 0:ve.focus()})}),ca(()=>window.addEventListener("pointerdown",Pe)),Pa(()=>window.removeEventListener("pointerdown",Pe)),(G,ve)=>(k(),R("div",{ref_key:"rootRef",ref:a,class:et(["header-git-dropdown",{"is-review-open":e.reviewOpen}])},[m("button",{class:"header-git-trigger",type:"button",disabled:E.value,title:_.value,"aria-label":_.value,onClick:j},[Oe(Cs,{class:"header-git-trigger-icon"}),m("span",pA,$(f.value),1),e.dirty?(k(),R("span",mA)):J("",!0),Oe(Xa,{class:"header-git-trigger-chevron"})],8,hA),s.value?(k(),R("div",vA,[m("div",gA,[h.value?(k(),R("button",{key:0,class:"header-git-review-row",type:"button",onClick:ve[0]||(ve[0]=Te=>r("toggleReview"))},[Oe(Fs,{class:"header-git-row-icon"}),m("span",null,$(e.reviewOpen?"Review (Open)":"Review"),1)])):J("",!0),m("div",yA,[m("span",wA,$(e.detached?"Detached HEAD":"Current branch"),1),m("span",bA,$(f.value),1),g.value?(k(),R("span",_A,$(g.value),1)):J("",!0)]),H.value?(k(),R("div",{key:1,class:et(["header-git-status",{"is-error":X.value==="error"}])},$(H.value),3)):J("",!0),m("div",TA,[tn(m("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":ve[1]||(ve[1]=Te=>l.value=Te),class:"header-git-search",type:"text",placeholder:"Search branches...",onKeydown:mn(Xe(de,["prevent"]),["esc"])},null,40,kA),[[un,l.value]])]),m("ul",CA,[(k(!0),R(Ye,null,Kt(D.value,Te=>(k(),R("li",{key:Te.value,class:"header-git-branch-item"},[m("div",SA,[m("button",{class:"header-git-branch-expand",type:"button","aria-label":c.value===Te.value?"Hide commits":"Show commits",onClick:oe=>K(Te.value)},[Oe(di,{class:et(["header-git-expand-icon",{"is-expanded":c.value===Te.value}])},null,8,["class"])],8,xA),m("button",{class:et(["header-git-branch-button",{"is-current":Te.value===e.currentBranch}]),type:"button",disabled:O.value,onClick:oe=>r("checkoutBranch",Te.value)},[m("span",EA,$(Te.label),1),Te.value===e.currentBranch?(k(),R("span",IA,"current")):Te.isRemote?(k(),R("span",RA,"remote")):J("",!0)],10,AA)]),c.value===Te.value?(k(),R("div",PA,[e.commitsLoadingFor===Te.value?(k(),R("div",MA,"Loading commits...")):e.commitsError?(k(),R("div",$A,$(e.commitsError),1)):J("",!0),(k(!0),R(Ye,null,Kt(e.commitsByBranch[Te.value]||[],oe=>(k(),R("button",{key:oe.sha,class:et(["header-git-commit",{"is-current":Z(oe)}]),type:"button",disabled:O.value||Te.isRemote,title:be(Te,oe),onClick:ke=>pe(Te,oe)},[m("span",LA,[m("code",null,$(oe.shortSha),1),m("span",OA,[Z(oe)?(k(),R("span",jA,"current")):J("",!0),m("span",null,$(oe.date),1)])]),m("span",DA,$(oe.subject),1)],10,NA))),128)),e.commitsLoadingFor!==Te.value&&!e.commitsError&&(e.commitsByBranch[Te.value]||[]).length===0?(k(),R("div",FA," No commits found. ")):J("",!0)])):J("",!0)]))),128)),D.value.length===0?(k(),R("li",UA,"No branches found.")):J("",!0)])])])):J("",!0)],2))}}),qA=It(BA,[["__scopeId","data-v-5f4121b3"]]),HA=["aria-label"],WA=["aria-checked","onClick"],zA={class:"runtime-toggle-option-label"},VA=Hn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:r}=Ma(),a=[{value:"local",label:r("Local project"),icon:Gc},{value:"worktree",label:r("New worktree"),icon:Cs}];function o(s){n("update:modelValue",s)}return(s,l)=>(k(),R("div",{class:"runtime-toggle",role:"radiogroup","aria-label":S(r)("Continue in")},[(k(),R(Ye,null,Kt(a,c=>m("button",{key:c.value,class:et(["runtime-toggle-option",{"is-selected":e.modelValue===c.value}]),type:"button",role:"radio","aria-checked":e.modelValue===c.value,onClick:h=>o(c.value)},[(k(),Ze(Lc(c.icon),{class:"runtime-toggle-option-icon"})),m("span",zA,$(c.label),1)],10,WA)),64))],8,HA))}}),GA=It(VA,[["__scopeId","data-v-0f175c28"]]),KA={},YA={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 QA(e,t){return k(),R("svg",YA,[...t[0]||(t[0]=[m("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),m("path",{d:"M9 4l0 16"},null,-1)])])}const JA=It(KA,[["render",QA]]),XA={},ZA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function eE(e,t){return k(),R("svg",ZA,[...t[0]||(t[0]=[m("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 tE=It(XA,[["render",eE]]),nE={class:"sidebar-thread-controls"},rE=["aria-label","title"],oE=["aria-label","title"],aE=Hn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=Ma();return(n,r)=>(k(),R("div",nE,[m("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?S(t)("Expand sidebar"):S(t)("Collapse sidebar"),title:e.isSidebarCollapsed?S(t)("Expand sidebar"):S(t)("Collapse sidebar"),onClick:r[0]||(r[0]=a=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(k(),Ze(tE,{key:0,class:"sidebar-thread-controls-icon"})):(k(),Ze(JA,{key:1,class:"sidebar-thread-controls-icon"}))],8,rE),Lo(n.$slots,"default",{},void 0),e.showNewThreadButton?(k(),R("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":S(t)("Start new thread"),title:S(t)("Start new thread"),onClick:r[1]||(r[1]=a=>n.$emit("start-new-thread"))},[Oe(Fs,{class:"sidebar-thread-controls-icon"})],8,oE)):J("",!0)]))}}),ih=It(aE,[["__scopeId","data-v-2369affb"]]),sE={},iE={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function lE(e,t){return k(),R("svg",iE,[...t[0]||(t[0]=[m("circle",{cx:"11",cy:"11",r:"8"},null,-1),m("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const lh=It(sE,[["render",lE]]),uE={},cE={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function dE(e,t){return k(),R("svg",cE,[...t[0]||(t[0]=[m("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[m("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"}),m("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const fE=It(uE,[["render",dE]]),hE={},pE={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function mE(e,t){return k(),R("svg",pE,[...t[0]||(t[0]=[m("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),m("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const vE=It(hE,[["render",mE]]),gE={},yE={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function wE(e,t){return k(),R("svg",yE,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const bE=It(gE,[["render",wE]]);function kr(e){return e.flatMap(t=>t.threads)}function _E(e,t){var r,a;const n=e.findIndex(o=>o.id===t);return n<0?"":((r=e[n+1])==null?void 0:r.id)??((a=e[n-1])==null?void 0:a.id)??""}const _m="codex-web-local.thread-read-state.v1",uh="codex-web-local.thread-unread-cutoff.v1",Tm="codex-web-local.thread-token-usage.v1",km="codex-web-local.thread-terminal-open.v1",pc="codex-web-local.selected-thread-id.v1",mc="codex-web-local.selected-model-by-context.v1",Cm="codex-web-local.selected-model-id.v1",Sm="codex-web-local.project-order.v1",xm="codex-web-local.project-display-name.v1",vc="codex-web-local.collaboration-mode-by-context.v1",TE="codex-web-local.collaboration-mode.v1",Ea="__new-thread__",Am="__new-thread-provider__::",Uu=220,kE=1e4,CE=500,SE=3e3,xE=2e3,ch=["none","minimal","low","medium","high","xhigh"],gs="__global__",uo="gpt-5.4-mini";function AE(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(_m);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function dh(e){typeof window>"u"||window.localStorage.setItem(_m,JSON.stringify(e))}function EE(){if(typeof window>"u")return"";const e=window.localStorage.getItem(uh);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(uh,t),t}function IE(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 RE(e,t,n){return IE(e,t??n)}function Em(e){return e==="plan"?"plan":"default"}function Us(e){return typeof e=="string"?e.trim():""}function fo(){return Object.create(null)}function fi(e){const t=fo();for(const[n,r]of Object.entries(e))t[n]=r;return t}function _i(e,t){if(!(t in e))return e;const n=fo();for(const[r,a]of Object.entries(e))r!==t&&(n[r]=a);return n}function fh(e,t){let n=!1;const r=fo();for(const[a,o]of Object.entries(e)){if(a===Ea||a.startsWith(Am)||t.has(a)){r[a]=o;continue}n=!0}return n?r:e}function Im(e){return e.trim().toLowerCase()||"codex"}function PE(e){return e===Ea}function Bu(e){const t=Im(e);return`${Am}${t}`}function $s(e){return e.trim()||Ea}function ME(){if(typeof window>"u")return fo();try{const n=window.localStorage.getItem(mc);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return fo();const a=fo();for(const[o,s]of Object.entries(r)){if(typeof o!="string"||o.length===0)continue;const l=Us(s);l&&(a[o]=l)}return a}}catch{}const e=Us(window.localStorage.getItem(Cm)),t=fo();return e&&(t[Ea]=e),t}function hh(e,t){const n=$s(t),r=Us(e[n]);return r||Us(e[Ea])}function sl(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(mc):window.localStorage.setItem(mc,JSON.stringify(e)),window.localStorage.removeItem(Cm)}catch{}}function $E(){if(typeof window>"u")return fo();try{const e=window.localStorage.getItem(vc);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return fo();const n=fo();for(const[r,a]of Object.entries(t)){if(typeof r!="string"||r.length===0)continue;const o=Em(a);o==="plan"&&(n[r]=o)}return n}}catch{}return fo()}function il(e,t){const n=$s(t);return Em(e[n])}function ph(e,t,n){const r=$s(t);if(PE(r))return _i(e,r);if(n==="plan"){const a=fi(e);return a[r]="plan",a}return _i(e,r)}function qu(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(vc):window.localStorage.setItem(vc,JSON.stringify(e)),window.localStorage.removeItem(TE)}catch{}}function Rm(e,t,n){return Math.min(Math.max(e,t),n)}function Ts(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 mh(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:Ts(t.totalTokens)??0,inputTokens:Ts(t.inputTokens)??0,cachedInputTokens:Ts(t.cachedInputTokens)??0,outputTokens:Ts(t.outputTokens)??0,reasoningOutputTokens:Ts(t.reasoningOutputTokens)??0}}function NE(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=mh(t.total),r=mh(t.last);if(!n||!r)return null;const a=Ts(t.modelContextWindow),o=r.totalTokens,s=typeof a=="number"?Math.max(a-o,0):null,l=typeof a=="number"&&a>0?Rm(Math.round((s??0)/a*100),0,100):null;return{total:n,last:r,modelContextWindow:a,currentContextTokens:o,remainingContextTokens:s,remainingContextPercent:l}}function LE(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Tm);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,a]of Object.entries(t)){if(!r)continue;const o=NE(a);o&&(n[r]=o)}return n}catch{return{}}}function vh(e){typeof window>"u"||window.localStorage.setItem(Tm,JSON.stringify(e))}function OE(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(km);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,a]of Object.entries(t))r&&typeof a=="boolean"&&(n[r]=a);return n}catch{return{}}}function jE(e){typeof window>"u"||window.localStorage.setItem(km,JSON.stringify(e))}function DE(){return typeof window>"u"?"":window.localStorage.getItem(pc)??""}function FE(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(pc);return}window.localStorage.setItem(pc,e)}}function UE(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Sm);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 a=Qr(r);a.length>0&&!n.includes(a)&&n.push(a)}return n}catch{return[]}}function ii(e){typeof window>"u"||window.localStorage.setItem(Sm,JSON.stringify(e))}function BE(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(xm);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,a]of Object.entries(t)){const o=typeof r=="string"?Qr(r):"";o.length>0&&typeof a=="string"&&(n[o]=a)}return n}catch{return{}}}function gh(e){typeof window>"u"||window.localStorage.setItem(xm,JSON.stringify(e))}function ys(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 Aa(e,n)?e:n}function Hu(e,t){const n=new Map(e.map(a=>[a.projectName,a])),r=t.map(a=>n.get(a)??null).filter(a=>a!==null);for(const a of e)t.includes(a.projectName)||r.push(a);return r}function Aa(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let a=0;a<n.length;a+=1)if(n[a]!==r[a])return!1;return!0}function qE(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[a]=r.splice(t,1);return r.splice(n,0,a),r}function HE(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function WE(e=[],t=[]){var n,r,a,o;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)||((a=e[s])==null?void 0:a.status)!==((o=t[s])==null?void 0:o.status))return!1;return!0}function zE(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&WE(e.steps,t.steps)}function ll(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 gc(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Aa(e.images,t.images)&&GE(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&HE(e.commandExecution,t.commandExecution)&&zE(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function Ss(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 VE(e,t,n={}){const r=new Map(e.map(f=>[f.id,f])),a=new Map(t.map(f=>[f.id,f])),o=t.map(f=>{const g=r.get(f.id);return g&&gc(g,f)?g:f});if(n.preserveMissing!==!0)return Ss(e,o)?e:o;const s=e.map(f=>{const g=a.get(f.id);return!g||gc(f,g)?f:g}),l=new Set(e.map(f=>f.id)),c=o.filter(f=>!l.has(f.id)),h=[...s,...c];return Ss(e,h)?e:h}function GE(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],a=t[n];if(r.path!==a.path||r.operation!==a.operation||r.movedToPath!==a.movedToPath||r.diff!==a.diff||r.addedLineCount!==a.addedLineCount||r.removedLineCount!==a.removedLineCount)return!1}return!0}function yc(e){return e.replace(/\s+/gu," ").trim()}function KE(e,t){const n=new Set(t.map(o=>o.id)),r=new Set(t.filter(o=>o.role==="assistant").map(o=>yc(o.text)).filter(o=>o.length>0));if(r.size===0)return e;const a=e.filter(o=>{if(o.messageType!=="agentMessage.live")return!0;if(n.has(o.id))return!1;const s=yc(o.text);return s.length===0?!1:!r.has(s)});return a.length===e.length?e:a}function ul(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(gc(r,t))return e;const a=[...e];return a.splice(n,1,t),a}const Pm="worked";function ka(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function YE(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),a=t%60,o=[];n>0&&o.push(`${n}h`),(r>0||n>0)&&o.push(`${r}m`);const s=a>0||o.length===0?a:0;return o.push(`${s}s`),o.join(" ")}function QE(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function JE(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 XE(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${YE(e.durationMs)}`,messageType:Pm,turnId:e.turnId}}function ZE(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function eI(e,t){const n=XE(t),r=e.filter(s=>s.messageType!==Pm),a=ZE(r);if(a<0)return[...r,n];const o=[...r];return o.splice(a,0,n),o}function At(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function tI(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[a,o]of Object.entries(e)){if(t.has(a)){n=!0;continue}r[a]=o}return n?r:e}function nI(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 rI(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 oI(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 sn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function yh(e,t){const n=t.trim();if(!n)return e;let r=!1;const a=[];for(const o of e){const s=o.threads.filter(c=>c.id!==n),l=s.length!==o.threads.length;l&&(r=!0),s.length>0?a.push(l?{...o,threads:s}:o):o.threads.length===0&&a.push(o)}return r?a:e}function cl(e,t){const n=new Map(e.map(a=>[a.projectName,a])),r=t.map(a=>{const o=n.get(a.projectName),s=new Map((o==null?void 0:o.threads.map(c=>[c.id,c]))??[]),l=a.threads.map(c=>{const h=s.get(c.id);return h&&nI(h,c)?h:c});return o&&o.projectName===a.projectName&&rI(o.threads,l)?o:{projectName:a.projectName,threads:l}});return oI(e,r)?e:r}function aI(e,t,n){const r=new Set(kr(t).map(l=>l.id)),a=kr(e).filter(l=>n[l.id]===!0&&!r.has(l.id));if(a.length===0)return t;const o=new Map(t.map(l=>[l.projectName,l])),s=t.map(l=>({projectName:l.projectName,threads:[...l.threads]}));for(const l of a){if(o.get(l.projectName)){const h=s.findIndex(f=>f.projectName===l.projectName);h>=0&&(s[h]={projectName:s[h].projectName,threads:[l,...s[h].threads]});continue}s.push({projectName:l.projectName,threads:[l]})}return s}function ts(e){return Qr(e)}function sI(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function iI(e){const t=e.label||Qr(e.remotePath),n=sI(e.hostId);return n?`${t} ${n}`:t}function Mm(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function zl(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(a=>a.id)),r=e.projectOrder.filter(a=>t.has(a)||n.has(a));for(const a of e.order)r.includes(a)||r.push(a);for(const a of n)r.includes(a)||r.push(a);return r}function wc(e,t){const n=Mm(e);return zl(e).map(r=>{if(n.has(r))return r;const a=rt(r).trim(),o=ts(a);return t.has(o)?a:o})}function ml(e,t){return rt(e).trim()===t||ts(e)===t}function lI(e,t){const n=new Set;for(const r of e.order)ml(r,t)&&n.add(r);for(const r of e.active)ml(r,t)&&n.add(r);for(const r of Object.keys(e.labels))ml(r,t)&&n.add(r);return n}function uI(e,t,n){var h,f;const r=new Set((e.remoteProjects??[]).map(g=>g.id)),a=new Map;for(const g of e.order){const _=ts(g);a.has(_)||a.set(_,g)}for(const g of n){const _=((f=(h=g.threads[0])==null?void 0:h.cwd)==null?void 0:f.trim())??"";_&&a.set(g.projectName,_)}const o=[],s=g=>{g&&!o.includes(g)&&o.push(g)};for(const g of t){if(r.has(g)){s(g);continue}const _=a.get(g);_&&s(_)}for(const g of zl(e))s(g);const l=o.filter(g=>e.order.includes(g));for(const g of e.order)l.includes(g)||l.push(g);const c=e.active.filter(g=>l.includes(g));return c.length===0&&l.length>0&&c.push(l[0]),{order:l,active:c,projectOrder:o}}function cI(e,t,n){const r=wc(t,n);if(r.length===0)return e;const a=new Map(r.map((o,s)=>[o,s]));return[...e].sort((o,s)=>{if(_c(o)||_c(s))return 0;const l=a.get(o.projectName)??Number.POSITIVE_INFINITY,c=a.get(s.projectName)??Number.POSITIVE_INFINITY;return l===c?0:l-c})}function bc(e,t){const n=new Map,r=new Map,a=s=>{const l=rt(s).trim();if(!l)return;const c=Qr(l),h=n.get(c)??new Set;h.add(l),n.set(c,h)};for(const s of(t==null?void 0:t.order)??[]){const l=rt(s).trim();if(!l)continue;const c=Qr(l);xl(l)||r.set(c,(r.get(c)??0)+1),a(s)}for(const s of e)for(const l of s.threads){const c=rt(l.cwd).trim(),h=Qr(c),f=(t==null?void 0:t.order.some(g=>rt(g).trim()===c))===!0;xl(c)&&!f&&r.get(h)===1||a(l.cwd)}const o=new Set;for(const[s,l]of n.entries())l.size>1&&o.add(s);return o}function xl(e){return e.includes("/.codex/worktrees/")}function dI(e,t){const n=bc(e,t);if(n.size===0)return e;const r=new Set,a=new Set,o=new Map,s=new Set;for(const h of(t==null?void 0:t.order)??[]){const f=rt(h).trim();if(!f||(s.add(f),xl(f)))continue;const g=Qr(f);r.has(g)?(r.delete(g),a.add(g),o.delete(g)):a.has(g)||(r.add(g),o.set(g,f))}const l=[],c=new Map;for(const h of e)for(const f of h.threads){const g=rt(f.cwd).trim(),_=Qr(g),E=s.has(g),O=xl(g)&&!E&&r.has(_);let H=h.projectName;O&&n.has(_)?H=o.get(_)??h.projectName:g&&n.has(_)&&(H=g);const X=f.projectName===H?f:{...f,projectName:H},D=c.get(H);if(D)D.threads.push(X);else{const j={projectName:H,threads:[X]};c.set(H,j),l.push(j)}}return l}function fI(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const r=new Set(e.map(s=>s.projectName)),a=[...e],o=Mm(t);for(const s of zl(t)){if(o.has(s)){if(r.has(s))continue;a.push({projectName:s,threads:[]}),r.add(s);continue}const l=rt(s).trim();if(!l)continue;const c=ts(l),h=n.has(c)?l:c;r.has(h)||(a.push({projectName:h,threads:[]}),r.add(h))}return a}function hI(e){const t=e.split(`
|
|
51
|
-
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function pI(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function _c(e){return e.threads.some(t=>t.cwd.trim().length===0||Cl(t.cwd))}function mI(){const e=A([]),t=A([]),n=A(DE()),r=A({}),a=A({}),o=A({}),s=A({}),l=A({}),c=A({}),h=A({}),f=A({}),g=A({});let _=!1;const E=A({}),O=A([]),H=A([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),X=A($E()),D=A(ME()),j=A(il(X.value,n.value)),K=A(hh(D.value,n.value)),Z=A("medium"),be=A("standard"),pe=A(""),de=A(AE()),Pe=A(EE()),G=A(UE()),ve=A(BE()),Te=A({}),oe=A({}),ke=A({}),De=A({}),Be=A({}),Ke=A({}),Le=A({}),Se=A({}),Qe=A({}),tt=A({}),Ue=A({}),He=A({}),ft=A({}),Je=A(null),We=A(LE()),Tt=A(OE()),ee=A({}),xe=A([]),Ae=A([]),Fe=A(!1),Ge=A(!1),x=A(!1),P=A(!1),z=A(!1),ae=A(!1),Q=A(""),le=A(!1),fe=A(!1);function ye(i){var d;try{const v=new URL(i,"http://localhost");return v.pathname!=="/codex-local-image"?"":((d=v.searchParams.get("path"))==null?void 0:d.trim())??""}catch{return""}}function we(i){const d=i.trim().toLowerCase();return d?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(d):!1}function he(i){var v;const d=r.value[i]??[];for(let T=d.length-1;T>=0;T-=1){const M=d[T];if(!(M.role!=="user"||!Array.isArray(M.images)||M.images.length===0))for(let N=M.images.length-1;N>=0;N-=1){const W=((v=M.images[N])==null?void 0:v.trim())??"";if(W&&ye(W))return W}}return""}let je=null,me=null,Me=null;const Ie=new Map;let at=null;const dt=new Map;let lt=null,gt=null,kt=!1;const q=new Set,U=new Map;let F=null,se=null,Ce=!1,Ne=!1,ze=[],xt=null,Bt=!1,Wt=!1;const Wn=new Map,pr=new Set,Xr=ne(()=>kr(e.value)),Ln=ne(()=>Xr.value.find(i=>i.id===n.value)??null),Cr=ne(()=>{const i=n.value;return!!(i&&Tt.value[i]===!0)}),fa=ne(()=>{const i=n.value;return i?Qe.value[i]===!0:!1}),Do=ne(()=>{const i=[],d=n.value;return d&&Array.isArray(He.value[d])&&i.push(...He.value[d]),Array.isArray(He.value[gs])&&i.push(...He.value[gs]),i.sort((v,T)=>v.receivedAtIso.localeCompare(T.receivedAtIso))}),vn=ne(()=>{var N;const i=n.value;if(!i)return null;const d=h.value[i]===!0,v=d?Ke.value[i]:void 0,T=d?(s.value[i]??"").trim():"",M=(((N=Le.value[i])==null?void 0:N.message)??"").trim();return!v&&!T&&!M?null:{activityLabel:(v==null?void 0:v.label)||"Thinking",activityDetails:(v==null?void 0:v.details)??[],reasoningText:T,errorText:M}}),Zt=ne(()=>Je.value),wo=ne(()=>{const i=n.value;return i?We.value[i]??null:null}),Fo=ne(()=>{const i=n.value;if(!i)return[];const d=r.value[i]??[],v=a.value[i]??[],T=o.value[i]??[],M=l.value[i]??[],N=c.value[i]??[],W=[...d,...v,...M,...N,...T],Y=Be.value[i];return Y?eI(W,Y):W});function ot(i){if($s(i)===Ea){const v=Bu(pe.value),T=v?Us(D.value[v]):"";if(T)return T}return hh(D.value,i).trim()}function cn(...i){const d=[...O.value];for(const v of i){const T=v.trim();T&&!d.includes(T)&&d.push(T)}Aa(O.value,d)||(O.value=d)}function zt(i){n.value!==i&&(n.value=i,FE(i),K.value=ot(i),cn(K.value),j.value=il(X.value,i),Wt=!1)}function Or(i,d){const v=d.trim(),T=$s(i);if(v){const M=fi(D.value);M[T]=v,D.value=M}else D.value=_i(D.value,T);if(i.trim()===n.value?(K.value=ot(n.value),cn(K.value)):cn(v),T===Ea){const M=Bu(pe.value);if(M)if(v){const N=fi(D.value);N[M]=v,D.value=N}else D.value=_i(D.value,M)}sl(D.value)}function nn(i){Or(n.value,i)}function zn(i,d){const v=i.trim();if(!v)return;const T=d.trim();if(T){const M=fi(D.value);M[v]=T,D.value=M}else D.value=_i(D.value,v);cn(T),n.value===v&&(K.value=ot(n.value)),sl(D.value)}function Zr(i,d){const v=i.trim();if(!v)return;if(!d){if(!(v in We.value))return;We.value=At(We.value,v),vh(We.value);return}const T=We.value[v];T&&JSON.stringify(T)===JSON.stringify(d)||(We.value={...We.value,[v]:d},vh(We.value))}function dn(i){const d=i==="plan"?"plan":"default",v=$s(n.value);il(X.value,n.value)===d&&j.value===d||(j.value=d,X.value=ph(X.value,v,d),qu(X.value))}function Dt(i,d){const v=d==="plan"?"plan":"default";X.value=ph(X.value,i,v),i.trim()===n.value&&(j.value=v),qu(X.value)}function rn(i){Je.value=i}async function wn(i=n.value){i.trim()?zn(i,uo):nn(uo),cn(uo)}function on(i,d){ft.value={...ft.value,[i]:d}}function In(i){ft.value[i]&&(ft.value=At(ft.value,i))}async function eo(i){if(pr.has(i))return;const d=ft.value[i];if(!(!d||d.fallbackRetried)){pr.add(i),on(i,{...d,fallbackRetried:!0});try{await wn(i);try{const v=await $u(i,1);yn(i,v),I(i),Er(i,[]),Mn(i),l.value[i]&&(l.value=At(l.value,i))}catch{}Et(i,null),Q.value="",fn(i,null),wt(i,{label:"Thinking",details:Zn(uo,d.effort,d.collaborationMode)}),Ct(i,!0),ke.value[i]!==!0&&await Mu(i),await Nu(i,d.text,d.imageUrls,uo,d.effort||void 0,d.skills.length>0?d.skills:void 0,d.fileAttachments,d.collaborationMode),ke.value={...ke.value,[i]:!0},Sr(),q.add(i),await io()}catch(v){const T=v instanceof Error?v.message:"Unknown application error";Et(i,T),Q.value=T,Ct(i,!1),wt(i,null)}finally{pr.delete(i)}}}function On(i){i&&!ch.includes(i)||(Z.value=i)}async function to(i){const d=i==="fast"?"fast":"standard";if(z.value||be.value===d)return;const v=be.value;be.value=d,z.value=!0,Q.value="";try{await h_(d)}catch(T){be.value=v,Q.value=T instanceof Error?T.message:"Failed to update Fast mode"}finally{z.value=!1}}async function bo(){try{const i=await w_();H.value=i,i.some(d=>d.value===j.value)||dn("default")}catch{}}function Zn(i,d,v=j.value){const T=i.trim()||"default",M=d||"default",N=v==="plan"?"Plan":"Default",W=be.value==="fast"?"Fast":"Standard";return[`Mode: ${N}`,`Model: ${T}`,`Thinking: ${M}`,`Speed: ${W}`]}async function jr(i){try{const[d,v]=await Promise.all([hm({includeProviderModels:(i==null?void 0:i.includeProviderModels)!==!1}),pm()]),T=ot(n.value),M=v.model.trim(),N=Im(v.providerId);pe.value=N;const W=Bu(N),Y=W?Us(D.value[W]):"",ie=[...d];if(!(i!=null&&i.providerChanged))for(const Ve of[T,M])Ve&&!ie.includes(Ve)&&ie.push(Ve);O.value=ie;const ge=T&&d.includes(T);if((!T||!ge||i!=null&&i.providerChanged)&&(i!=null&&i.providerChanged&&ie.length>0?M&&ie.includes(M)?nn(M):Y&&ie.includes(Y)?nn(Y):nn(ie[0]):M&&ie.includes(M)?nn(v.model):ie.length>0?nn(ie[0]):nn("")),W&&K.value.trim().length>0){const Ve=fi(D.value);Ve[W]=K.value.trim(),D.value=Ve,sl(D.value)}v.reasoningEffort&&ch.includes(v.reasoningEffort)&&(Z.value=v.reasoningEffort),be.value=v.speedMode}catch{}}async function er(){if(gt){await gt;return}gt=(async()=>{try{const i=await X0();rn(i),Ae.value=i?[i]:[]}catch{}finally{gt=null}})(),await gt}function Sr(){if(typeof window>"u"){er();return}Me!==null&&window.clearTimeout(Me),Me=window.setTimeout(()=>{Me=null,er()},CE)}function bn(i){if(!i||typeof window>"u")return;const d=Ie.get(i);d!==void 0&&(window.clearTimeout(d),Ie.delete(i))}function Dr(i){if(!i||typeof window>"u")return;bn(i);const d=window.setTimeout(()=>{Ie.delete(i),q.add(i),io()},SE);Ie.set(i,d)}function jn(i){const d=ee.value;return Object.keys(d).length===0?i:i.map(v=>({projectName:v.projectName,threads:v.threads.map(T=>{const M=d[T.id];return M?{...T,title:M}:T})}))}function tr(i){return i?Array.isArray(He.value[i])?He.value[i]:[]:[]}function Vn(i){return i==="item/commandExecution/requestApproval"||i==="item/fileChange/requestApproval"||i==="item/permissions/requestApproval"||i==="execCommandApproval"||i==="applyPatchApproval"}function _o(i){return i.some(d=>Vn(d.method))?"approval":i.length>0?"response":null}function Ft(){const d=jn(t.value).map(v=>({projectName:v.projectName,threads:v.threads.map(T=>{const M=h.value[T.id]===!0,N=_o(tr(T.id)),W=n.value===T.id,Y=E.value[T.id]===!0,ie=RE(T.updatedAtIso,de.value[T.id],Pe.value);return{...T,inProgress:M,unread:!W&&!M&&(Y||ie),pendingRequestState:N}})}));e.value=cl(e.value,d)}function mr(i,d,v){const T=new Date().toISOString(),M=rt(d),N=Qr(M),W={id:i,title:hI(v),projectName:N,cwd:M,hasWorktree:M.includes("/.codex/worktrees/")||M.includes("/.git/worktrees/"),createdAtIso:T,updatedAtIso:T,preview:v,unread:!1,inProgress:!1},Y=t.value.findIndex(ge=>ge.projectName===N);if(Y>=0){const Ve=t.value[Y].threads.filter(St=>St.id!==i),bt={projectName:N,threads:[W,...Ve]},_t=[...t.value];_t.splice(Y,1,bt),t.value=_t}else t.value=[{projectName:N,threads:[W]},...t.value];const ie=ys(G.value,t.value);Aa(G.value,ie)||(G.value=ie,ii(G.value)),Ft()}function xr(i){const d=new Set(i.map(ie=>ie.id)),v=n.value.trim();v&&d.add(v);const T=fh(D.value,d);T!==D.value&&(D.value=T,K.value=ot(n.value),cn(K.value),sl(T));const M=fh(X.value,d);M!==X.value&&(X.value=M,j.value=il(M,n.value),qu(M));const N=sn(de.value,d);N!==de.value&&(de.value=N,dh(N)),oe.value=sn(oe.value,d),Te.value=sn(Te.value,d),ke.value=sn(ke.value,d),De.value=sn(De.value,d),r.value=sn(r.value,d),o.value=sn(o.value,d),s.value=sn(s.value,d),l.value=sn(l.value,d),c.value=sn(c.value,d),Be.value=sn(Be.value,d),Ke.value=sn(Ke.value,d),Le.value=sn(Le.value,d),Se.value=sn(Se.value,d),Qe.value=sn(Qe.value,d),tt.value=sn(tt.value,d),Ue.value=sn(Ue.value,d);const W=sn(f.value,d);W!==f.value&&(f.value=W,Go()),We.value=sn(We.value,d),E.value=sn(E.value,d),h.value=sn(h.value,d);const Y={};for(const[ie,ge]of Object.entries(He.value))(ie===gs||d.has(ie))&&(Y[ie]=ge);He.value=Y}function Ar(i){const d=kr(t.value).find(v=>v.id===i);d&&(de.value={...de.value,[i]:d.updatedAtIso},dh(de.value),E.value[i]&&(E.value=At(E.value,i)),Ft())}function fn(i,d){if(!i)return;const v=Be.value[i];if(d){if(QE(v,d))return;Be.value={...Be.value,[i]:d}}else v&&(Be.value=At(Be.value,i))}function Ct(i,d){!i||h.value[i]===!0===d||(d?h.value={...h.value,[i]:!0}:(h.value=At(h.value,i),re(i),yt(i)),Ft(),!d&&!L()&&F&&Ee())}function yt(i){i&&(Qe.value[i]&&(Qe.value=At(Qe.value,i)),tt.value[i]&&(tt.value=At(tt.value,i)),Ue.value[i]&&(Ue.value=At(Ue.value,i)))}function nr(i){i&&(Qe.value={...Qe.value,[i]:!0},tt.value[i]&&(tt.value=At(tt.value,i)),Ue.value[i]&&(Ue.value=At(Ue.value,i)))}function Rn(i){i&&Qe.value[i]===!0&&tt.value[i]===!0&&Ue.value[i]===!0&&yt(i)}function Fr(i,d){!i||!d||Qe.value[i]===!0&&yt(i)}function gn(i){const d=Object.keys(Qe.value);if(d.length===0)return;let v=tt.value,T=!1;for(const M of d)!i.has(M)||v[M]===!0||(v={...v,[M]:!0},T=!0);if(T){tt.value=v;for(const M of d)Rn(M)}}function vr(i,d){i&&Qe.value[i]===!0&&d.some(v=>v.role==="user")&&(Ue.value[i]!==!0&&(Ue.value={...Ue.value,[i]:!0}),Rn(i))}function To(i){i&&i!==n.value&&E.value[i]!==!0&&(E.value={...E.value,[i]:!0},Ft())}function wt(i,d){if(!i)return;const v=Ke.value[i];if(!d){v&&(Ke.value=At(Ke.value,i));return}const T=os(d.label)||"Thinking",M=d.details.map(Y=>os(Y)).filter(Y=>Y.length>0&&Y!==T),N=Array.from(new Set([...(v==null?void 0:v.details)??[],...M])).slice(-3),W={label:T,details:N};JE(v,W)||(Ke.value={...Ke.value,[i]:W})}function Et(i,d,v={}){if(!i)return;const T=Le.value[i],M=d?yc(d):"";if(!M){T&&(Le.value=At(Le.value,i));return}const N=v.transient===!0;(T==null?void 0:T.message)===M&&T.transient===N||(Le.value={...Le.value,[i]:{message:M,transient:N}})}function Ot(i){var d;i&&(d=Le.value[i])!=null&&d.transient&&Et(i,null)}function hn(){const i=Object.entries(Le.value).filter(([,v])=>v==null?void 0:v.transient).map(([v])=>v);if(i.length===0)return;let d=Le.value;for(const v of i)d=At(d,v);Le.value=d}function Qt(i){const d=kr(t.value).find(v=>v.id===i);return(d==null?void 0:d.updatedAtIso)??""}function Ur(i,d){if(!i)return;const v={...Tt.value};d?v[i]=!0:delete v[i],Tt.value=v,jE(v)}function gr(){const i=n.value;i&&Ur(i,!Cr.value)}function yn(i,d){const v=r.value[i]??[];Ss(v,d)||(r.value={...r.value,[i]:d})}function Er(i,d){const v=o.value[i]??[];Ss(v,d)||(o.value={...o.value,[i]:d})}function rr(i){i&&i in o.value&&(o.value=At(o.value,i))}function Dn(i,d){const v=c.value[i]??[];Ss(v,d)||(c.value={...c.value,[i]:d})}function Gn(i,d){const v=a.value[i]??[];Ss(v,d)||(a.value={...a.value,[i]:d})}function Vt(i,d){const v=a.value[i]??[],T=ul(v,d);Gn(i,T)}function yr(i,d){const v=o.value[i]??[],T=ul(v,d);Er(i,T)}function Br(i,d){const v=c.value[i]??[],T=ul(v,d);Dn(i,T)}function Pn(i,d){if(!i)return;const v=d.trim(),T=s.value[i]??"";if(v.length===0){if(!T)return;s.value=At(s.value,i);return}T!==v&&(s.value={...s.value,[i]:v})}function wr(i,d){if(!i)return;const v=s.value[i]??"";Pn(i,`${v}${d}`)}function Mn(i){i&&i in s.value&&(s.value=At(s.value,i))}function I(i){i&&i in a.value&&(a.value=At(a.value,i))}function B(i){i&&i in c.value&&(c.value=At(c.value,i))}function re(i){i&&(I(i),Mn(i),wt(i,null),n.value,l.value[i]&&(l.value=At(l.value,i)),Se.value[i]&&(Se.value=At(Se.value,i)),In(i))}function Re(i){return i==="completed"?"completed":i==="inProgress"||i==="in_progress"?"inProgress":"pending"}function vt(i){var v;const d=[];(v=i.explanation)!=null&&v.trim()&&d.push(i.explanation.trim());for(const T of i.steps){const M=T.status==="completed"?"x":T.status==="inProgress"?"~":" ";d.push(`- [${M}] ${T.step}`)}return d.join(`
|
|
52
|
-
`).trim()}function Jt(i){if(i.method!=="turn/plan/updated")return null;const d=$e(i.params),v=en(i),T=_e(d==null?void 0:d.turnId)||_e(d==null?void 0:d.turn_id),N=(Array.isArray(d==null?void 0:d.plan)?d==null?void 0:d.plan:[]).map(ie=>$e(ie)).map(ie=>({step:_e(ie==null?void 0:ie.step),status:Re(ie==null?void 0:ie.status)})).filter(ie=>ie.step.length>0);if(!v||!T)return null;const Y={explanation:_e(d==null?void 0:d.explanation).trim()||void 0,steps:N,isStreaming:!0};return{threadId:v,message:{id:`${T}:plan`,role:"assistant",text:vt(Y),messageType:"plan.live",plan:Y}}}function pn(i){if(i.method!=="item/plan/delta")return null;const d=$e(i.params),v=en(i),T=_e(d==null?void 0:d.turnId)||_e(d==null?void 0:d.turn_id),M=_e(d==null?void 0:d.delta);if(!v||!T||!M)return null;const N=`${T}:plan`,W=(a.value[v]??[]).find(ge=>ge.id===N),Y=`${(W==null?void 0:W.text)??""}${M}`,ie=W!=null&&W.plan?{...W.plan,isStreaming:!0}:void 0;return{threadId:v,message:{id:N,role:"assistant",text:Y,messageType:"plan.live",plan:ie}}}function $e(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:null}function _e(i){return typeof i=="string"?i:""}function mt(i){return typeof i=="number"&&Number.isFinite(i)?i:null}function _n(i){const d=$e(i);if(!d)return null;const v=mt(d.totalTokens??d.total_tokens),T=mt(d.inputTokens??d.input_tokens),M=mt(d.cachedInputTokens??d.cached_input_tokens),N=mt(d.outputTokens??d.output_tokens),W=mt(d.reasoningOutputTokens??d.reasoning_output_tokens);return v===null||T===null||M===null||N===null||W===null?null:{totalTokens:v,inputTokens:T,cachedInputTokens:M,outputTokens:N,reasoningOutputTokens:W}}function Kn(i){const d=$e(i);if(!d)return null;const v=_n(d.total),T=_n(d.last);if(!v||!T)return null;const M=mt(d.modelContextWindow??d.model_context_window),N=T.totalTokens,W=typeof M=="number"?Math.max(M-N,0):null,Y=typeof M=="number"&&M>0?Rm(Math.round((W??0)/M*100),0,100):null;return{total:v,last:T,modelContextWindow:M,currentContextTokens:N,remainingContextTokens:W,remainingContextPercent:Y}}function qs(i){if(i.method!=="thread/tokenUsage/updated")return null;const d=$e(i.params),v=en(i),T=Kn((d==null?void 0:d.tokenUsage)??(d==null?void 0:d.token_usage));return!v||!T?null:{threadId:v,usage:T}}function en(i){const d=$e(i.params);if(!d)return"";const v=_e(d.threadId);if(v)return v;const T=_e(d.thread_id);if(T)return T;const M=_e(d.conversationId);if(M)return M;const N=_e(d.conversation_id);if(N)return N;const W=$e(d.thread),Y=_e(W==null?void 0:W.id);if(Y)return Y;const ie=$e(d.turn),ge=_e(ie==null?void 0:ie.threadId);if(ge)return ge;const Ve=_e(ie==null?void 0:ie.thread_id);return Ve||""}function Uo(i){if(i.method!=="turn/completed")return"";const d=$e(i.params),v=$e(d==null?void 0:d.turn);if(!v||v.status!=="failed")return"";const T=$e(v.error);return _e(T==null?void 0:T.message)}function no(i){var T;if(i.method!=="error")return null;const d=$e(i.params),v=_e(d==null?void 0:d.message)||_e((T=$e(d==null?void 0:d.error))==null?void 0:T.message);return v?{message:v,transient:(d==null?void 0:d.willRetry)===!0}:null}function Ir(i){const d=$e(i);if(!d)return null;const v=d.id,T=_e(d.method),M=d.params;if(typeof v!="number"||!Number.isInteger(v)||!T)return null;const N=$e(M),W=Bo(T,N),Y=_e(N==null?void 0:N.threadId)||_e(N==null?void 0:N.thread_id)||_e(N==null?void 0:N.conversationId)||_e(N==null?void 0:N.conversation_id)||gs,ie=_e(N==null?void 0:N.turnId)||_e(N==null?void 0:N.turn_id),ge=_e(N==null?void 0:N.itemId)||_e(N==null?void 0:N.item_id)||_e(N==null?void 0:N.callId)||_e(N==null?void 0:N.call_id),Ve=_e(d.receivedAtIso)||new Date().toISOString();return{id:v,method:W,threadId:Y,turnId:ie,itemId:ge,receivedAtIso:Ve,params:M??null}}function Bo(i,d){const v=i.trim();return v&&(v==="item/commandExecution/requestApproval"||v==="execCommandApproval"||v==="exec_approval_request"||qo(d)?"item/commandExecution/requestApproval":v==="item/fileChange/requestApproval"||v==="applyPatchApproval"||v==="apply_patch_approval_request"||or(d)?"item/fileChange/requestApproval":v==="item/tool/requestUserInput"||v==="request_user_input"||Ho(d)?"item/tool/requestUserInput":v==="mcpServer/elicitation/request"||v==="elicitation_request"||ko(d)?"mcpServer/elicitation/request":v==="item/permissions/requestApproval"||br(d)?"item/permissions/requestApproval":v==="item/tool/call"||v==="dynamic_tool_call_request"||qr(d)?"item/tool/call":v)}function qo(i){if(!i)return!1;const d=i.command;return Array.isArray(d)&&d.some(v=>typeof v=="string"&&v.trim().length>0)||typeof d=="string"&&d.trim().length>0?!0:Array.isArray(i.commandActions)}function or(i){return i?typeof i.grantRoot=="string"&&i.grantRoot.trim().length>0||typeof i.grant_root=="string"&&i.grant_root.trim().length>0||$e(i.fileChanges)?!0:$e(i.changes)!==null:!1}function Ho(i){return!!(i&&Array.isArray(i.questions))}function qr(i){return i?typeof i.toolName=="string"||typeof i.tool_name=="string"||typeof i.name=="string"||Array.isArray(i.arguments):!1}function ko(i){if(!i)return!1;const d=_e(i.mode);return typeof i.serverName=="string"&&typeof i.threadId=="string"&&typeof i.message=="string"&&(d==="form"||d==="url")}function br(i){return i?typeof i.threadId=="string"&&typeof i.turnId=="string"&&typeof i.itemId=="string"&&$e(i.permissions)!==null:!1}function Co(i){if(i.method!=="item/tool/requestUserInput")return[];const d=$e(i.params),v=Array.isArray(d==null?void 0:d.questions)?d.questions:[],T=[];for(const M of v){const N=$e(M),W=_e(N==null?void 0:N.id).trim();W&&T.push(W)}return T}function Tn(i){const d=i.threadId||gs,v=He.value[d]??[],T=v.findIndex(N=>N.id===i.id),M=[...v];T>=0?M.splice(T,1,i):M.push(i),He.value={...He.value,[d]:M.sort((N,W)=>N.receivedAtIso.localeCompare(W.receivedAtIso))},Ft()}function Hr(i){const d={};for(const[v,T]of Object.entries(He.value)){const M=T.filter(N=>N.id!==i);M.length>0&&(d[v]=M)}He.value=d,Ft()}function Rr(i){const d={};for(const v of i){const T=v.threadId||gs,M=d[T]??[];M.push(v),d[T]=M}for(const v of Object.values(d))v.sort((T,M)=>T.receivedAtIso.localeCompare(M.receivedAtIso));He.value=d}function rs(i){if(i.method==="server/request"){const d=Ir(i.params);return d&&Tn(d),!0}if(i.method==="server/request/resolved"){const d=$e(i.params),v=d==null?void 0:d.id;return typeof v=="number"&&Number.isInteger(v)&&Hr(v),!0}return!1}function os(i){return i.replace(/\s+/gu," ").trim()}function Pr(i){const d=en(i);if(!d)return null;if(i.method==="turn/started")return{threadId:d,activity:{label:"Thinking",details:[]}};if(i.method==="item/started"){const v=$e(i.params),T=$e(v==null?void 0:v.item),M=_e(T==null?void 0:T.type).toLowerCase();if(M==="reasoning")return{threadId:d,activity:{label:"Thinking",details:[]}};if(M==="agentmessage")return{threadId:d,activity:{label:"Writing response",details:[]}};if(M==="commandexecution"){const N=_e(T==null?void 0:T.command);return{threadId:d,activity:{label:"Running command",details:N?[N]:[]}}}if(M==="filechange"){const W=(Array.isArray(T==null?void 0:T.changes)?T.changes:[])[0],Y=_e(W==null?void 0:W.path);return{threadId:d,activity:{label:"Applying changes",details:Y?[Y]:[]}}}}return i.method==="item/commandExecution/outputDelta"?{threadId:d,activity:{label:"Running command",details:[]}}:i.method==="item/fileChange/outputDelta"?{threadId:d,activity:{label:"Applying changes",details:[]}}:i.method==="item/reasoning/summaryTextDelta"||i.method==="item/reasoning/summaryPartAdded"?{threadId:d,activity:{label:"Thinking",details:[]}}:i.method==="item/agentMessage/delta"?{threadId:d,activity:{label:"Writing response",details:[]}}:null}function Yn(i){if(i.method!=="turn/started")return null;const d=$e(i.params);if(!d)return null;const v=en(i);if(!v)return null;const T=$e(d.turn),M=_e(T==null?void 0:T.id)||_e(d.turnId)||`${v}:unknown`;if(!M)return null;const N=ka(_e(T==null?void 0:T.startedAt))??ka(_e(d.startedAt))??ka(i.atIso)??Date.now();return{threadId:v,turnId:M,startedAtMs:N}}function ro(i){if(i.method!=="turn/completed")return null;const d=$e(i.params);if(!d)return null;const v=en(i);if(!v)return null;const T=$e(d.turn),M=_e(T==null?void 0:T.id)||_e(d.turnId)||`${v}:unknown`;if(!M)return null;const N=ka(_e(T==null?void 0:T.completedAt))??ka(_e(d.completedAt))??ka(i.atIso)??Date.now(),W=ka(_e(T==null?void 0:T.startedAt))??ka(_e(d.startedAt))??void 0;return{threadId:v,turnId:M,completedAtMs:N,startedAtMs:W}}function Wr(i){return`${i}:live-reasoning`}function kn(i){const d=r.value[i]??[];let v=-1;for(const T of d)typeof T.turnIndex=="number"&&Number.isFinite(T.turnIndex)&&(v=Math.max(v,T.turnIndex));return v+1}function $n(i,d,v){if(!i||!d||!Number.isInteger(v)||v<0)return;const T=De.value[i]??{};T[d]!==v&&(De.value={...De.value,[i]:{...T,[d]:v}})}function ar(i,d){const v=De.value[i]??{},T=Object.entries(v),M=Object.entries(d);T.length===M.length&&T.every(([N,W])=>d[N]===W)||(De.value={...De.value,[i]:{...d}})}function ha(i){const d=c.value[i];if(!d||d.length===0)return;const v=De.value[i]??{};let T=!1;const M=d.map(N=>{if(typeof N.turnIndex=="number"||!N.turnId)return N;const W=v[N.turnId];return typeof W!="number"?N:(T=!0,{...N,turnIndex:W})});T&&(c.value={...c.value,[i]:M})}function _r(i){const d=$e(i.params);if(!d)return"";if(i.method==="item/started"){const v=$e(d.item);return!v||v.type!=="reasoning"?"":_e(v.id)}return""}function sr(i){const d=$e(i.params);if(!d)return null;if(i.method==="item/reasoning/summaryTextDelta"){const v=_e(d.itemId),T=_e(d.delta);return!v||!T?null:{messageId:Wr(v),delta:T}}return null}function Wo(i){const d=$e(i.params);if(!d)return"";if(i.method==="item/reasoning/summaryPartAdded"){const v=_e(d.itemId);return v?Wr(v):""}return""}function $a(i){const d=$e(i.params);if(!d)return"";if(i.method==="item/completed"){const v=$e(d.item);return!v||v.type!=="reasoning"?"":Wr(_e(v.id))}return""}function pa(i){const d=$e(i.params);if(!d)return"";if(i.method==="item/started"){const v=$e(d.item);return!v||v.type!=="agentMessage"?"":_e(v.id)}return""}function oo(i){const d=$e(i.params);if(!d)return null;if(i.method==="item/agentMessage/delta"){const v=_e(d.itemId),T=_e(d.delta);return!v||!T?null:{messageId:v,delta:T}}return null}function Na(i){const d=$e(i.params);if(!d)return null;if(i.method==="item/completed"){const v=$e(d.item);if(!v||v.type!=="agentMessage")return null;const T=_e(v.id),M=_e(v.text);return!T||!M?null:{id:T,role:"assistant",text:M,messageType:"agentMessage.live"}}return null}function zo(i){return`/codex-local-image?path=${encodeURIComponent(i)}`}function zr(i){const d=i.trim();if(!d)return"";if(d.startsWith("data:")||d.startsWith("http://")||d.startsWith("https://")||d.startsWith("/codex-local-image?"))return d;const v=d.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(v)?`data:image/png;base64,${v}`:""}function La(i){if(i.method!=="item/completed")return null;const d=$e(i.params),v=$e(d==null?void 0:d.item);if(!v)return null;const T=_e(v.id);if(!T)return null;if(v.type==="imageView"){const W=_e(v.path);return W?{id:T,role:"assistant",text:"",images:[zo(W)],messageType:"imageView"}:null}if(v.type!=="imageGeneration"&&v.type!=="image_generation")return null;const M=_e(v.result),N=M?zr(M):"";return N?{id:T,role:"assistant",text:"",images:[N],messageType:"imageView"}:null}function So(i){var ge;if(i.method!=="item/started")return null;const d=$e(i.params),v=$e(d==null?void 0:d.item);if(!v||v.type!=="commandExecution")return null;const T=_e(v.id),M=_e(v.command);if(!T)return null;const N=typeof v.cwd=="string"?v.cwd:null,W=en(i),Y=_e(d==null?void 0:d.turnId)||_e(d==null?void 0:d.turn_id),ie=W&&Y?(ge=De.value[W])==null?void 0:ge[Y]:void 0;return{id:T,role:"system",text:M,messageType:"commandExecution",commandExecution:{command:M,cwd:N,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:Y||void 0,turnIndex:typeof ie=="number"?ie:void 0}}function Vr(i){if(i.method!=="item/commandExecution/outputDelta")return null;const d=$e(i.params);if(!d)return null;const v=_e(d.itemId),T=_e(d.delta);return!v||!T?null:{itemId:v,delta:T}}function jt(i){var St;if(i.method!=="item/completed")return null;const d=$e(i.params),v=$e(d==null?void 0:d.item);if(!v||v.type!=="commandExecution")return null;const T=_e(v.id),M=_e(v.command);if(!T)return null;const N=typeof v.cwd=="string"?v.cwd:null,W=_e(v.status),Y=W==="failed"?"failed":W==="declined"?"declined":W==="interrupted"?"interrupted":"completed",ie=typeof v.aggregatedOutput=="string"?v.aggregatedOutput:"",ge=typeof v.exitCode=="number"?v.exitCode:null,Ve=en(i),bt=_e(d==null?void 0:d.turnId)||_e(d==null?void 0:d.turn_id),_t=Ve&&bt?(St=De.value[Ve])==null?void 0:St[bt]:void 0;return{id:T,role:"system",text:M,messageType:"commandExecution",commandExecution:{command:M,cwd:N,status:Y,aggregatedOutput:ie,exitCode:ge},turnId:bt||void 0,turnIndex:typeof _t=="number"?_t:void 0}}function ir(i){var ge;if(i.method!=="item/completed")return null;const d=$e(i.params),v=$e(d==null?void 0:d.item);if(!v||v.type!=="fileChange")return null;const T=_e(v.id);if(!T)return null;const M=_e(d==null?void 0:d.threadId),N=_e(d==null?void 0:d.turnId),W=M&&N?(ge=De.value[M])==null?void 0:ge[N]:void 0,Y=sm(v.changes),ie=am(v.status);return Y.length===0||ie!=="completed"?null:{id:T,role:"system",text:"",messageType:"fileChange",fileChangeStatus:ie,fileChanges:Y,turnId:N||void 0,turnIndex:typeof W=="number"?W:void 0}}function Oa(i,d){const v=l.value[i]??[],T=ul(v,d);T!==v&&(l.value={...l.value,[i]:T})}function as(i,d){const v=l.value[i];if(!v||v.length===0)return;const T=new Set(d.map(N=>N.id)),M=v.filter(N=>!T.has(N.id));M.length!==v.length&&(M.length===0?l.value=At(l.value,i):l.value={...l.value,[i]:M})}function Hs(i,d){const v=c.value[i];if(!v||v.length===0)return;const T=new Set(d.map(Y=>Y.id)),M=new Set(d.filter(Y=>Y.messageType==="fileChange"&&typeof Y.turnId=="string"&&Y.turnId.length>0).map(Y=>Y.turnId)),N=new Set(d.filter(Y=>Y.messageType==="fileChange"&&typeof Y.turnIndex=="number").map(Y=>Y.turnIndex)),W=v.filter(Y=>!T.has(Y.id)&&!(Y.turnId&&M.has(Y.turnId))&&!(typeof Y.turnIndex=="number"&&N.has(Y.turnIndex)));W.length!==v.length&&(W.length===0?c.value=At(c.value,i):c.value={...c.value,[i]:W})}function ma(i){if(i.method==="item/agentMessage/delta")return!0;const d=$e(i.params);if(!d)return!1;if(i.method==="item/completed"){const v=$e(d.item);return(v==null?void 0:v.type)==="agentMessage"}return!1}function ss(i){var Bi,fs,qi,Hi,Wi;if(rs(i))return;if(i.method==="account/rateLimits/updated"&&Sr(),i.method==="thread/name/updated"){const st=$e(i.params),Tr=_e(st==null?void 0:st.threadId),Qo=_e(st==null?void 0:st.threadName);Tr&&Qo&&(ee.value={...ee.value,[Tr]:Qo},Ft(),Ou(Tr,Qo))}if(i.method==="account/rateLimits/updated"){rn(cm(i.params));return}const d=qs(i);if(d){Zr(d.threadId,d.usage);return}const v=Pr(i);v&&wt(v.threadId,v.activity);const T=en(i),M=no(i);!M&&T&&Ot(T);const N=Yn(i);N&&(Wn.set(N.turnId,N),$n(N.threadId,N.turnId,kn(N.threadId)),Se.value={...Se.value,[N.threadId]:N.turnId},Fr(N.threadId,N.turnId),I(N.threadId),B(N.threadId),fn(N.threadId,null),Et(N.threadId,null),Ct(N.threadId,!0),us(N.threadId),E.value[N.threadId]&&(E.value=At(E.value,N.threadId)));const W=ro(i),Y=Uo(i),ie=(W==null?void 0:W.threadId)??en(i),ge=ie?ot(ie):"",Ve=!!ie&&!!Y&&ge!==uo&&ll(new Error(Y));if(W){ft.value[W.threadId];const st=Wn.get(W.turnId);st&&Wn.delete(W.turnId);const Tr=mt((Bi=$e(i.params))==null?void 0:Bi.durationMs)??mt((qi=$e((fs=$e(i.params))==null?void 0:fs.turn))==null?void 0:qi.durationMs)??(typeof W.startedAtMs=="number"?W.completedAtMs-W.startedAtMs:null)??(st?W.completedAtMs-st.startedAtMs:null),Qo=typeof Tr=="number"?Math.max(0,Tr):0;fn(W.threadId,{turnId:W.turnId,durationMs:Qo}),Se.value[W.threadId]&&(Se.value=At(Se.value,W.threadId)),Ct(W.threadId,!1),wt(W.threadId,null),To(W.threadId),Ve||(In(W.threadId),us(W.threadId))}if(Y){const st=(W==null?void 0:W.threadId)||en(i);st&&Et(st,Y),Q.value=Y,st&&Ve&&eo(st)}else W&&Et(W.threadId,null);if(M){const st=T,Tr=st?ot(st):K.value.trim();st&&Et(st,M.message,{transient:M.transient}),Q.value=M.message,Tr!==uo&&ll(new Error(M.message))&&(st?eo(st):wn())}const bt=Jt(i);bt&&(Vt(bt.threadId,bt.message),wt(bt.threadId,{label:"Planning",details:((Hi=bt.message.plan)==null?void 0:Hi.steps.map(st=>st.step).slice(0,2))??[]}));const _t=pn(i);if(_t&&(Vt(_t.threadId,_t.message),wt(_t.threadId,{label:"Planning",details:[]})),!T||T!==n.value)return;pa(i);const St=oo(i);if(St){const st=(o.value[T]??[]).find(Qo=>Qo.id===St.messageId),Tr=`${(st==null?void 0:st.text)??""}${St.delta}`;yr(T,{id:St.messageId,role:"assistant",text:Tr,messageType:"agentMessage.live"})}const Sn=Na(i);Sn&&yr(T,Sn);const Fa=La(i);Fa&&yr(T,Fa),_r(i);const ds=sr(i);if(ds&&wr(T,ds.delta),Wo(i)){const st=s.value[T]??"";st.trim().length>0&&!st.endsWith(`
|
|
53
|
-
|
|
54
|
-
`)&&Pn(T,`${st}
|
|
55
|
-
|
|
56
|
-
`)}$a(i);const wa=So(i);wa&&(Oa(T,wa),wt(T,{label:"Running command",details:[((Wi=wa.commandExecution)==null?void 0:Wi.command)??""]}));const Ua=Vr(i);if(Ua){const st=(l.value[T]??[]).find(Tr=>Tr.id===Ua.itemId);st!=null&&st.commandExecution&&Oa(T,{...st,commandExecution:{...st.commandExecution,aggregatedOutput:`${st.commandExecution.aggregatedOutput}${Ua.delta}`}})}const Yo=jt(i);Yo&&Oa(T,Yo);const Ui=ir(i);if(Ui&&Br(T,Ui),ma(i)&&Mn(T),i.method==="turn/completed"){Wt=!1,Mn(T),l.value[T]&&(l.value=At(l.value,T));const st=en(i);st&&(Ct(st,!1),wt(st,null),To(st),Ve||(In(st),us(st)))}}function xo(i){if(i.method==="thread/tokenUsage/updated")return;const d=i.method,v=d==="turn/started"||d==="turn/completed"||d==="error",T=d.startsWith("thread/")||d==="turn/completed";if(!v&&!T)return;const M=en(i);M&&v&&q.add(M),T&&(kt=!0),!(me!==null||typeof window>"u")&&(me=window.setTimeout(()=>{me=null,io()},Uu))}async function Vo(i,d){if(!Bt){Bt=!0;try{if(!d)return;const v=[];for(const T of zl(d)){const M=ts(T);v.includes(M)||v.push(M)}if(v.length>0){const T=d.projectOrder.length>0?ys(v,i):ys(G.value,i);Aa(G.value,T)||(G.value=T)}if(Object.keys(d.labels).length>0||(d.remoteProjects??[]).length>0){const T={...ve.value};let M=!1;for(const[N,W]of Object.entries(d.labels)){const Y=rt(N).trim(),ie=[ts(N)];Y&&ie.push(Y);for(const ge of ie)T[ge]!==W&&(T[ge]=W,M=!0)}for(const N of d.order){const W=ts(N),Y=Qr(Ms(N));if(!Y.startsWith(".")||Y===W)continue;const ie=`${W} ${Y}`;T[W]!==void 0||T[W]===ie||(T[W]=ie,M=!0)}for(const N of d.remoteProjects??[]){const W=iI(N);T[N.id]!==W&&(T[N.id]=W,M=!0)}M&&(ve.value=T)}}catch{}}}async function is(){if(!(Object.keys(ee.value).length>0))try{const i=await q_();Object.keys(i.titles).length>0&&(ee.value=i.titles)}catch{}}async function qt(){try{return await _s()}catch{return null}}async function Ws(i,d,v){if(ee.value[i])return;const T=d.trim();if(!T)return;const M=T.length>300?T.slice(0,300):T;try{const N=await G_(M,v);if(!N||ee.value[i])return;ee.value={...ee.value,[i]:N},Ft(),Ou(i,N)}catch{}}function va(i,d){const v=bc(i,d),T=dI(i,d),M=fI(T,d,v);if(!d||d.order.length===0&&(d.remoteProjects??[]).length===0)return M;const N=new Set;for(const Y of wc(d,v))N.add(Y);const W=M.filter(Y=>N.has(Y.projectName)?!0:_c(Y));return cI(W,d,v)}function Mr(i,d){const v=va(i,d),T=!!(d&&(d.order.length>0||d.projectOrder.length>0||(d.remoteProjects??[]).length>0)),M=d!=null&&d.projectOrder.length?ys(wc(d,bc(i,d)),v):ys(G.value,v);Aa(G.value,M)||(G.value=M,T||ii(G.value));const N=Hu(v,G.value);gn(new Set(kr(N).map(Y=>Y.id)));const W=aI(t.value,N,h.value);t.value=cl(t.value,W),h.value=sn(h.value,new Set(kr(t.value).map(Y=>Y.id))),Ft()}function ao(i){const d={};for(const[v,T]of Object.entries(i)){const M=v.trim();!M||T.length===0||(d[M]=T.map(N=>({id:N.id,text:N.text,imageUrls:[...N.imageUrls],skills:N.skills.map(W=>({name:W.name,path:W.path})),fileAttachments:N.fileAttachments.map(W=>({label:W.label,path:W.path,fsPath:W.fsPath})),collaborationMode:N.collaborationMode})))}return d}function Go(){C_(ao(f.value)).catch(()=>{})}async function y(){if(!_){_=!0;try{f.value=await Kf()}catch{}}}function b(i){ze=yh(ze,i),t.value=yh(t.value,i),h.value=At(h.value,i),Ft()}function w(i,d){if(i.length===0)return d;if(d.length===0)return i;const v=new Map;for(const M of kr(i))v.set(M.id,M);for(const M of kr(d))v.set(M.id,M);const T=new Map;for(const M of v.values()){const N=T.get(M.projectName);N?N.push(M):T.set(M.projectName,[M])}return Array.from(T.entries()).map(([M,N])=>({projectName:M,threads:N.sort((W,Y)=>new Date(Y.updatedAtIso).getTime()-new Date(W.updatedAtIso).getTime())})).sort((M,N)=>{var ie,ge;const W=new Date(((ie=M.threads[0])==null?void 0:ie.updatedAtIso)??0).getTime();return new Date(((ge=N.threads[0])==null?void 0:ge.updatedAtIso)??0).getTime()-W})}function L(){return Object.values(h.value).some(i=>i===!0)}function Ee(i=xt){if(!(!F||Ce||L())){if(xt=i,typeof window>"u"){ut(i);return}se!==null&&window.clearTimeout(se),se=window.setTimeout(()=>{se=null,!(!F||L())&&ut(xt)},kE)}}async function ut(i){if(!(Ce||!F||L())){Ce=!0;try{const d=await Ff(F,O0());F=d.nextCursor,Ne=d.nextCursor===null,ze=w(ze,d.groups),Mr(ze,i)}catch{}finally{Ce=!1,F&&!L()&&Ee(i)}}}async function Pt(){if(at){await at;return}at=(async()=>{var i;fe.value||(Fe.value=!0);try{const[d,v]=await Promise.all([Ff(),qt(),is()]);xt=v;const T=d.groups;ze=fe.value?w(ze,T):T,F=fe.value&&!Ne?F:d.nextCursor,Ne=d.nextCursor===null,await Vo(T,v),Mr(ze,v),fe.value=!0,Ne||Ee(v);const M=kr(e.value);xr(M),!M.some(W=>W.id===n.value)&&!n.value&&zt(((i=M[0])==null?void 0:i.id)??"")}finally{Fe.value=!1}})().finally(()=>{at=null}),await at}async function Cn(i,d={}){if(!i)return;const v=dt.get(i);if(v){await v;return}const T=oe.value[i]===!0,M=d.silent!==!0&&!T;M&&(Ge.value=!0);const N=(async()=>{try{const W=Qt(i),Y=Te.value[i]??"",ie=Date.now()-(U.get(i)??0)<xE;if(T&&(ie||(W.length===0||Y===W)&&h.value[i]!==!0)){Ar(i);return}const bt=ke.value[i]!==!0?await Mu(i):null,_t=bt??await Uf(i);bt&&(zn(i,bt.model),ke.value={...ke.value,[i]:!0});const{messages:St,inProgress:Sn,activeTurnId:Fa,turnIndexByTurnId:ds}=_t;vr(i,St),ar(i,ds),ha(i);const Fi=r.value[i]??[],wa=VE(Fi,St,{preserveMissing:d.silent===!0});yn(i,wa);const Ua=o.value[i]??[];if(Sn){const Yo=KE(Ua,St);Er(i,Yo)}else rr(i);as(i,St),Hs(i,St),oe.value={...oe.value,[i]:!0},U.set(i,Date.now()),W&&(Te.value={...Te.value,[i]:W}),Ct(i,Sn),Fa?Se.value={...Se.value,[i]:Fa}:Se.value[i]&&(Se.value=At(Se.value,i)),Sn||re(i),Ar(i)}finally{M&&(Ge.value=!1)}})().finally(()=>{dt.delete(i)});dt.set(i,N),await N}async function an(i,d={}){i&&oe.value[i]!==!0&&await Cn(i,d)}async function Fn(){if(lt){await lt;return}lt=(async()=>{var i,d;try{const v=((d=(i=Ln.value)==null?void 0:i.cwd)==null?void 0:d.trim())??"";xe.value=await Y_(v?[v]:void 0)}catch{}finally{lt=null}})(),await lt}async function so(i={}){await Promise.allSettled([jr({providerChanged:i.providerChanged,includeProviderModels:i.includeProviderModels}),er(),bo(),Fn()])}function ga(i={}){const d=()=>{so(i)};if(typeof window>"u"){d();return}window.setTimeout(d,0)}async function Ko(i={}){Q.value="";const d=i.includeSelectedThreadMessages!==!1,v=i.awaitAncillaryRefreshes===!0;try{await y(),await Pt(),d&&await Cn(n.value),v?await so({providerChanged:i.providerChanged,includeProviderModels:i.providerChanged===!0||v}):ga({providerChanged:i.providerChanged,includeProviderModels:!1})}catch(T){Q.value=T instanceof Error?T.message:"Unknown application error"}}async function zs(i){zt(i);try{await Cn(i),Fn()}catch(d){Q.value=d instanceof Error?d.message:"Unknown application error"}}async function Vl(i){const d=n.value===i,v=d?_E(kr(e.value),i):"";d&&(zt(v),v&&Cn(v,{silent:!0}));try{await a_(i),b(i),await Pt(),d&&v&&n.value===v&&await an(v,{silent:!0})}catch(T){Q.value=T instanceof Error?T.message:"Unknown application error"}}async function ja(i,d){const v=d.trim();if(!(!i||!v))try{await s_(i,v),ee.value={...ee.value,[i]:v},Ft(),Ou(i,v)}catch(T){Q.value=T instanceof Error?T.message:"Unknown application error"}}async function Li(i){var W,Y;const d=i.trim();if(!d)return"";const v=kr(t.value).find(ie=>ie.id===d),T=((W=v==null?void 0:v.cwd)==null?void 0:W.trim())??"",M=((Y=v==null?void 0:v.title)==null?void 0:Y.trim())??"Forked chat",N=ot(d);Q.value="";try{const ie=await Wf(d,T||void 0,N||void 0),ge=ie.threadId.trim();return ge?(mr(ge,T,M),zn(ge,ie.model),ke.value={...ke.value,[ge]:!0},zt(ge),await Pt(),await Cn(ge),ge):""}catch(ie){return Q.value=ie instanceof Error?ie.message:"Unknown application error",""}}async function Vs(i,d){var W;const v=i.trim();if(!v||!Number.isInteger(d)||d<0)return"";if(h.value[v]===!0)return Q.value="Finish the current turn before forking from a response.","";if(oe.value[v]!==!0)try{await Cn(v)}catch(Y){return Q.value=Y instanceof Error?Y.message:"Unknown application error",""}const T=r.value[v]??[];let M=-1;for(const Y of T)typeof Y.turnIndex=="number"&&Number.isFinite(Y.turnIndex)&&(M=Math.max(M,Y.turnIndex));if(M>=0&&d>M)return"";const N=kr(t.value).find(Y=>Y.id===v)??null;try{Q.value="";const Y=await Wf(v),ie=Y.threadId.trim();if(!ie)return"";const ge=Y.cwd.trim()||((W=N==null?void 0:N.cwd)==null?void 0:W.trim())||"",Ve=pI((N==null?void 0:N.title)||(N==null?void 0:N.preview)||"Untitled thread");mr(ie,ge,Ve),zn(ie,Y.model),yn(ie,Y.messages),oe.value={...oe.value,[ie]:!0},ke.value={...ke.value,[ie]:!0},I(ie),Er(ie,[]),Mn(ie),l.value[ie]&&(l.value=At(l.value,ie)),fn(ie,null),wt(ie,null),Et(ie,null),Ct(ie,!1);const bt=M-d;if(bt>0){const _t=await $u(ie,bt);yn(ie,_t)}return await ja(ie,Ve),zt(ie),Pt().catch(()=>{}),ie}catch(Y){return Q.value=Y instanceof Error?Y.message:"Unknown application error",""}}async function Ao(i,d,v=[],T=[],M=[]){if(!i||!d.trim()||v.length>0||T.length>0||M.length>0)return!1;const W=(He.value[i]??[]).filter(ge=>ge.method==="item/tool/requestUserInput");if(W.length!==1)return!1;const[Y]=W,ie=Co(Y);return ie.length!==1?!1:Eo({id:Y.id,result:{answers:{[ie[0]]:{answers:[d.trim()]}}}})}async function Oi(i,d=[],v=[],T="steer",M=[],N,W){if(z.value)return;const Y=n.value,ie=i.trim();if(!Y||!ie&&d.length===0&&M.length===0||await Ao(Y,ie,d,v,M))return;const ge=h.value[Y]===!0;if(ge&&T==="queue"){const Ve=f.value[Y]??[],bt=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,_t=[...Ve],St=typeof N=="number"?Math.max(0,Math.min(N,_t.length)):_t.length;_t.splice(St,0,{id:bt,text:ie,imageUrls:d,skills:v,fileAttachments:M,collaborationMode:W==="plan"?"plan":W==="default"?"default":j.value}),f.value={...f.value,[Y]:_t},Go();return}if(ge){Wt=!0,ls(Y,ie,d,v,M,W).catch(Ve=>{const bt=Ve instanceof Error?Ve.message:"Unknown application error";Et(Y,bt),Q.value=bt});return}Q.value="",Wt=!0,fn(Y,null),wt(Y,{label:"Thinking",details:Zn(ot(Y),Z.value,W==="plan"?"plan":W==="default"?"default":j.value)}),Et(Y,null),Ct(Y,!0);try{await ls(Y,ie,d,v,M,W)}catch(Ve){Wt=!1,Ct(Y,!1),wt(Y,null);const bt=Ve instanceof Error?Ve.message:"Unknown application error";throw Et(Y,bt),Q.value=bt,Ve}}async function Gs(i,d,v=[],T=[],M=[]){if(z.value)return"";const N=i.trim(),W=d.trim(),Y=ot(Ea).trim(),ie=j.value;if(!N&&v.length===0&&M.length===0)return"";x.value=!0,Q.value="";let ge="";try{try{const St=await Hf(W||void 0,Y||void 0);ge=St.threadId,zn(ge,St.model),Dt(ge,ie)}catch(St){if(Y&&Y!==uo&&ll(St)){await wn();const Sn=await Hf(W||void 0,uo);ge=Sn.threadId,zn(ge,Sn.model),Dt(ge,ie)}else throw St}if(!ge)return"";mr(ge,W,N||"[Image]"),nr(ge),ke.value={...ke.value,[ge]:!0},zt(ge),Wt=!0,fn(ge,null),wt(ge,{label:"Thinking",details:Zn(ot(ge),Z.value,ie)}),Et(ge,null),Ct(ge,!0);const Ve=ge,bt=W||null,_t=N;return ls(ge,N,v,T,M,ie).catch(St=>{Wt=!1,Ct(ge,!1),wt(ge,null);const Sn=St instanceof Error?St.message:"Unknown application error";Et(ge,Sn),Q.value=Sn}).finally(()=>{x.value=!1}),Ws(Ve,_t,bt),ge}catch(Ve){Wt=!1,ge&&(Ct(ge,!1),wt(ge,null));const bt=Ve instanceof Error?Ve.message:"Unknown application error";throw ge&&Et(ge,bt),Q.value=bt,x.value=!1,Ve}}async function ls(i,d,v=[],T=[],M=[],N){const W=Z.value,Y=N==="plan"?"plan":N==="default"?"default":j.value,ie=d.trim(),ge=[...v];if(ge.length===0&&we(ie)){const _t=he(i);_t&&ge.push(_t)}const Ve=T.map(_t=>({name:_t.name,path:_t.path})),bt=M.map(_t=>({..._t}));on(i,{text:ie,imageUrls:[...ge],skills:Ve,fileAttachments:bt,effort:W,collaborationMode:Y,fallbackRetried:!1});try{if(ke.value[i]!==!0){const Sn=await Mu(i);zn(i,Sn.model)}const _t=ot(i);let St="";try{St=await Nu(i,d,ge,_t||void 0,W||void 0,T.length>0?T:void 0,M,Y)}catch(Sn){if(_t&&_t!==uo&&ll(Sn))await wn(i),on(i,{text:ie,imageUrls:[...ge],skills:Ve,fileAttachments:bt,effort:W,collaborationMode:Y,fallbackRetried:!0}),St=await Nu(i,d,ge,uo,W||void 0,T.length>0?T:void 0,M,Y);else throw Sn}St&&(Se.value={...Se.value,[i]:St},Fr(i,St)),ke.value={...ke.value,[i]:!0},q.add(i),await io(),Dr(i)}catch(_t){throw _t}}async function Ks(i){if(g.value[i]!==!0){g.value={...g.value,[i]:!0};try{f.value=await Kf()}catch{}finally{g.value=At(g.value,i)}}}function us(i){Ks(i),!(typeof window>"u")&&window.setTimeout(()=>{Ks(i)},650)}async function Gl(){const i=n.value;if(!i||h.value[i]!==!0||Qe.value[i]===!0)return;let d=Se.value[i];if(!d){const{activeTurnId:v}=await Uf(i);d=v,d&&(Se.value={...Se.value,[i]:d})}if(!d)throw new Error("Could not determine active turn id for interrupt");P.value=!0,Q.value="";try{await f_(i,d),Ct(i,!1),wt(i,null),Et(i,null),Se.value[i]&&(Se.value=At(Se.value,i)),q.add(i),kt=!0,await io()}catch(v){const T=v instanceof Error?v.message:"Failed to interrupt active turn";Et(i,T),Q.value=T}finally{P.value=!1}}async function Da(i){var Y,ie;const d=n.value;if(!d||ae.value||!i.trim())return;const v=r.value[d]??[],T=v.find(ge=>ge.turnId===i),M=typeof(T==null?void 0:T.turnIndex)=="number"?T.turnIndex:-1;if(M<0)return;const N=v.reduce((ge,Ve)=>typeof Ve.turnIndex=="number"&&Ve.turnIndex>ge?Ve.turnIndex:ge,-1);if(N<0||M>N)return;const W=N-M+1;if(!(W<1)){ae.value=!0,Q.value="";try{const ge=((ie=(Y=Ln.value)==null?void 0:Y.cwd)==null?void 0:ie.trim())??"";ge&&await i_(d,i,ge);const Ve=await $u(d,W);yn(d,Ve),Er(d,[]),Mn(d),l.value[d]&&(l.value=At(l.value,d)),fn(d,null),wt(d,null),Et(d,null),kt=!0,await io()}catch(ge){Q.value=ge instanceof Error?ge.message:"Failed to rollback thread"}finally{ae.value=!1}}}let cs=null;async function Kl(i,d){try{const v=await _s(),T={...v.labels};let M=!1;for(const N of v.order){if(!ml(N,i))continue;const W=d.trim();W.length===0?T[N]!==void 0&&(delete T[N],M=!0):T[N]!==W&&(T[N]=W,M=!0)}M&&await Lu({order:v.order,labels:T,active:v.active,projectOrder:v.projectOrder})}catch{}}function ji(i,d){i.length===0||(ve.value[i]??"")===d||(ve.value={...ve.value,[i]:d},gh(ve.value),cs!==null&&clearTimeout(cs),cs=setTimeout(()=>{cs=null,Kl(i,d)},500))}async function Ys(i){var N;if(i.length===0)return;const d=G.value.filter(W=>W!==i);if(Aa(G.value,d)||(G.value=d,ii(G.value)),t.value=t.value.filter(W=>W.projectName!==i),ve.value[i]!==void 0){const W={...ve.value};delete W[i],ve.value=W,gh(W)}Ft();const v=kr(e.value);xr(v),v.some(W=>W.id===n.value)||zt(((N=v[0])==null?void 0:N.id)??"");const M=new Set;try{const W=await _s();lI(W,i).forEach(Y=>{M.add(Y)})}catch{}if(M.size>0)try{const W=await _s(),Y=W.order.filter(Ve=>!M.has(Ve)),ie=W.active.filter(Ve=>!M.has(Ve)),ge=ie.length===0&&Y.length>0?[Y[0]]:ie;await Lu({order:Y,labels:tI(W.labels,M),active:ge,projectOrder:W.projectOrder.filter(Ve=>Ve!==i&&!M.has(Ve))});return}catch{}await Qs()}function ya(i,d){if(i.length===0||t.value.length===0)return;const v=t.value.map(ie=>ie.projectName),T=v.indexOf(i);if(T===-1)return;const M=Math.max(0,Math.min(d,v.length-1)),N=qE(v,T,M);if(N===v)return;const W=ys(N,t.value);G.value=W,ii(G.value);const Y=Hu(t.value,G.value);t.value=cl(t.value,Y),Ft(),Qs()}function Yl(i){const d=i.trim();if(!d)return;const v=[d,...G.value.filter(M=>M!==d)];if(Aa(G.value,v))return;G.value=v,ii(G.value);const T=Hu(t.value,G.value);t.value=cl(t.value,T),Ft(),Qs()}async function Qs(){try{const i=await _s(),d=uI(i,G.value,t.value);await Lu({order:d.order,labels:i.labels,active:d.active,projectOrder:d.projectOrder})}catch{}}async function io(){if(le.value){typeof window<"u"&&me===null&&(me=window.setTimeout(()=>{me=null,io()},Uu));return}le.value=!0;const i=kt,d=new Set(q);kt=!1,q.clear();try{i&&await Pt();const v=n.value;if(!v)return;const T=d.has(v),M=h.value[v]===!0,N=Qt(v),W=Te.value[v]??"";(N.length>0&&N!==W||M&&oe.value[v]!==!0||T&&oe.value[v]!==!0||i&&oe.value[v]!==!0)&&await Cn(v,{silent:!0})}catch{}finally{le.value=!1,(kt||q.size>0)&&typeof window<"u"&&me===null&&(me=window.setTimeout(()=>{me=null,io()},Uu))}}async function Ql(){await Di(),kt=!fe.value,n.value&&oe.value[n.value]!==!0&&q.add(n.value),await io()}function Jl(){typeof window>"u"||je||(Di(),je=V0(i=>{if(i.method==="ready"){hn(),Ql();return}ss(i),xo(i)}))}async function Di(){try{const d=(await J0()).map(v=>Ir(v)).filter(v=>v!==null);Rr(d)}catch{}}async function Eo(i){try{return await Q0(i.id,{result:i.result,error:i.error}),Hr(i.id),!0}catch(d){return Q.value=d instanceof Error?d.message:"Failed to reply to server request",!1}}function Xl(){if(je&&(je(),je=null),kt=!1,q.clear(),Wn.clear(),me!==null&&typeof window<"u"&&(window.clearTimeout(me),me=null),Me!==null&&typeof window<"u"&&(window.clearTimeout(Me),Me=null),se!==null&&typeof window<"u"&&(window.clearTimeout(se),se=null),typeof window<"u")for(const i of Ie.values())window.clearTimeout(i);Ie.clear(),Wt=!1,r.value={},a.value={},o.value={},s.value={},l.value={},c.value={},De.value={},Ke.value={},Be.value={},Le.value={},Se.value={},Qe.value={},tt.value={},Ue.value={},f.value={},g.value={},Go(),Je.value=null,We.value={}}const Js=ne(()=>{const i=n.value;return i?f.value[i]??[]:[]});function Xs(i){const d=n.value;if(!d)return;const v=f.value[d];if(!v)return;const T=v.filter(M=>M.id!==i);f.value=T.length>0?{...f.value,[d]:T}:At(f.value,d),Go()}function Zl(i,d){const v=n.value;if(!v)return;const T=f.value[v];if(!T)return;const M=T.findIndex(ie=>ie.id===i),N=T.findIndex(ie=>ie.id===d);if(M<0||N<0||M===N)return;const W=[...T],[Y]=W.splice(M,1);W.splice(N,0,Y),f.value={...f.value,[v]:W},Go()}function eu(i){const d=n.value;if(!d)return;const v=f.value[d];if(!v)return;const T=v.find(M=>M.id===i);T&&(Xs(i),dn(T.collaborationMode),Oi(T.text,T.imageUrls,T.skills,"steer",T.fileAttachments))}function tu(i){zt(i)}return{projectGroups:e,projectDisplayNameById:ve,selectedThread:Ln,selectedThreadTokenUsage:wo,selectedThreadTerminalOpen:Cr,isSelectedThreadInterruptPending:fa,selectedThreadServerRequests:Do,selectedLiveOverlay:vn,codexQuota:Zt,selectedThreadId:n,availableCollaborationModes:H,availableModelIds:O,selectedCollaborationMode:j,selectedModelId:K,selectedReasoningEffort:Z,selectedSpeedMode:be,installedSkills:xe,accountRateLimitSnapshots:Ae,messages:Fo,isLoadingThreads:Fe,isLoadingMessages:Ge,isSendingMessage:x,isInterruptingTurn:P,isUpdatingSpeedMode:z,isRollingBack:ae,error:Q,refreshAll:Ko,refreshSkills:Fn,selectThread:zs,loadMessages:Cn,ensureThreadMessagesLoaded:an,setThreadTerminalOpen:Ur,toggleSelectedThreadTerminal:gr,archiveThreadById:Vl,renameThreadById:ja,forkThreadById:Li,forkThreadFromTurn:Vs,rollbackSelectedThread:Da,sendMessageToSelectedThread:Oi,sendMessageToNewThread:Gs,interruptSelectedThreadTurn:Gl,selectedThreadQueuedMessages:Js,removeQueuedMessage:Xs,reorderQueuedMessage:Zl,steerQueuedMessage:eu,setSelectedCollaborationMode:dn,readModelIdForThread:ot,setSelectedModelIdForThread:Or,setSelectedModelId:nn,setSelectedReasoningEffort:On,updateSelectedSpeedMode:to,respondToPendingServerRequest:Eo,renameProject:ji,removeProject:Ys,reorderProject:ya,pinProjectToTop:Yl,startPolling:Jl,stopPolling:Xl,primeSelectedThread:tu}}const vI={class:"sidebar-root"},gI={class:"sidebar-scrollable"},yI=["aria-pressed","aria-label","title"],wI={key:1,class:"sidebar-search-bar"},bI=["placeholder"],_I=["aria-label"],TI={class:"sidebar-skills-link-icon","aria-hidden":"true"},kI={class:"sidebar-skills-link-copy"},CI={class:"sidebar-skills-link-title"},SI={class:"sidebar-skills-link-subtitle"},xI={class:"sidebar-settings-account-section"},AI={class:"sidebar-settings-account-header"},EI={class:"sidebar-settings-account-header-main"},II=["aria-expanded","title"],RI={class:"sidebar-settings-account-collapse-icon"},PI={class:"sidebar-settings-account-title"},MI={class:"sidebar-settings-account-count"},$I=["disabled"],NI={key:0,class:"sidebar-settings-account-error"},LI={class:"sidebar-settings-account-login"},OI=["disabled"],jI=["href"],DI={key:1,class:"sidebar-settings-account-empty"},FI={key:2,class:"sidebar-settings-account-list"},UI=["title","onMouseenter","onMouseleave"],BI={class:"sidebar-settings-account-main"},qI={class:"sidebar-settings-account-email"},HI={class:"sidebar-settings-account-meta"},WI={class:"sidebar-settings-account-quota"},zI={class:"sidebar-settings-account-id"},VI={class:"sidebar-settings-account-actions"},GI=["disabled","onClick"],KI=["disabled","onClick"],YI=["title"],QI={class:"sidebar-settings-label"},JI=["title"],XI={class:"sidebar-settings-label"},ZI={class:"sidebar-settings-value"},eR=["title"],tR={class:"sidebar-settings-label"},nR={class:"sidebar-settings-value"},rR=["title"],oR={class:"sidebar-settings-label"},aR=["title"],sR={class:"sidebar-settings-label"},iR={class:"sidebar-settings-value"},lR=["title"],uR={class:"sidebar-settings-label"},cR=["title"],dR={class:"sidebar-settings-label"},fR=["title"],hR={class:"sidebar-settings-label"},pR={key:0,class:"sidebar-settings-row sidebar-settings-error"},mR={key:1,class:"sidebar-settings-row sidebar-settings-row--input"},vR={class:"sidebar-settings-provider-info"},gR={class:"sidebar-settings-label"},yR={class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},wR={class:"sidebar-settings-key-group"},bR={class:"sidebar-settings-key-masked"},_R=["disabled","title"],TR=["placeholder"],kR=["disabled"],CR={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},SR={class:"sidebar-settings-label"},xR=["aria-label"],AR=["disabled"],ER=["disabled"],IR={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},RR={class:"sidebar-settings-provider-info"},PR={class:"sidebar-settings-label"},MR={class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},$R={class:"sidebar-settings-key-group"},NR=["placeholder"],LR=["disabled"],OR={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},jR={class:"sidebar-settings-label"},DR={class:"sidebar-settings-key-group"},FR=["placeholder"],UR={class:"sidebar-settings-label",style:{"margin-top":"4px"}},BR={class:"sidebar-settings-key-group"},qR=["placeholder"],HR=["disabled"],WR={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},zR={class:"sidebar-settings-label"},VR=["aria-label"],GR=["title"],KR={class:"sidebar-settings-label"},YR={class:"sidebar-settings-label"},QR={class:"sidebar-settings-value"},JR={key:4,class:"sidebar-settings-telegram-panel"},XR={class:"sidebar-settings-field"},ZR={class:"sidebar-settings-field-label"},eP={class:"sidebar-settings-field"},tP={class:"sidebar-settings-field-label"},nP={class:"sidebar-settings-field-help"},rP={key:0,class:"sidebar-settings-telegram-error"},oP={class:"sidebar-settings-telegram-actions"},aP=["disabled"],sP=["data-state","title"],iP={class:"sidebar-settings-label"},lP=["data-state"],uP={class:"sidebar-settings-context-meta"},cP={class:"sidebar-settings-rate-limits"},dP=["aria-label"],fP={class:"sidebar-settings-button-version"},hP={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},pP={key:1,class:"skills-route-header-icon","aria-hidden":"true"},mP={class:"content-body"},vP={key:1,class:"content-grid content-grid-home"},gP={class:"new-thread-empty"},yP={class:"new-thread-hero"},wP=["title"],bP={class:"new-thread-folder-actions"},_P={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},TP={class:"new-thread-launch-card-copy"},kP={class:"new-thread-launch-card-topline"},CP={class:"new-thread-launch-card-badge","aria-hidden":"true"},SP={class:"new-thread-launch-card-eyebrow"},xP={class:"new-thread-launch-card-title"},AP={class:"new-thread-launch-card-text"},EP={class:"new-thread-launch-card-actions"},IP=["aria-label","onKeydown"],RP={class:"new-thread-open-folder-header"},PP={class:"new-thread-open-folder-title"},MP={class:"new-thread-open-folder-label"},$P={class:"new-thread-open-folder-current"},NP=["placeholder","title","disabled","onKeydown"],LP=["disabled"],OP={class:"new-thread-open-folder-actions"},jP={class:"new-thread-open-folder-toggle"},DP=["aria-pressed","disabled"],FP={key:0,class:"new-thread-open-folder-create"},UP={class:"new-thread-open-folder-create-composer"},BP=["placeholder","onKeydown"],qP=["disabled"],HP={key:0,class:"new-thread-open-folder-error"},WP=["placeholder","onKeydown"],zP={key:1,class:"new-thread-open-folder-error-actions"},VP={class:"new-thread-open-folder-error"},GP=["disabled"],KP={key:2,class:"new-thread-open-folder-status"},YP={key:3,class:"new-thread-open-folder-status"},QP={key:4,class:"new-thread-open-folder-list"},JP=["title","disabled","onClick"],XP={class:"new-thread-open-folder-item-name"},ZP=["disabled","onClick"],eM={key:3,class:"new-thread-branch-select"},tM={class:"new-thread-branch-select-label"},nM={class:"new-thread-branch-select-help"},rM={key:4,class:"new-thread-runtime-help"},oM={class:"worktree-init-status-title"},aM={class:"worktree-init-status-message"},sM={class:"composer-with-queue"},iM={key:2,class:"content-grid"},lM={class:"content-thread"},uM={class:"composer-with-queue"},cM=["aria-label"],dM={class:"codex-login-modal-header"},fM={class:"codex-login-modal-title"},hM=["aria-label","disabled"],pM={class:"codex-login-modal-copy"},mM=["href"],vM=["placeholder","disabled"],gM={key:1,class:"codex-login-modal-error"},yM={class:"codex-login-modal-actions"},wM=["disabled"],bM=["disabled"],wh="codex-web-local.sidebar-collapsed.v1",bh="codex-web-local.accounts-section-collapsed.v1",_h="codex-web-local.terminal-quick-commands.v1",Th="__toggle_terminal__",kh="codex-web-local.send-with-enter.v1",Ch="codex-web-local.in-progress-send-mode.v1",Sh="codex-web-local.dark-mode.v1",xh="codex-web-local.dictation-click-to-toggle.v1",Ah="codex-web-local.dictation-auto-send.v1",Eh="codex-web-local.dictation-language.v1",Ih="codex-web-local.chat-width.v1",_M=400,TM=Hn({__name:"App",setup(e){var _d,Td;const t=el(()=>nl(()=>import("./ThreadConversation-TbvxTGZL.js"),__vite__mapDeps([0,1]))),n=el(()=>nl(()=>import("./ThreadTerminalPanel-DVFhduDv.js"),__vite__mapDeps([2,3]))),r=el(()=>nl(()=>import("./ReviewPane-CpFUdAhb.js"),__vite__mapDeps([4,5]))),a=el(()=>nl(()=>import("./DirectoryHub-DSkzrx9M.js"),__vite__mapDeps([6,7]))),{t:o,uiLanguage:s,uiLanguageOptions:l,setUiLanguage:c}=Ma(),h="44cd",f="0.1.87",g={sendWithEnter:o("When enabled, press Enter to send. When disabled, use Command+Enter to send."),inProgressSendMode:o("If a turn is still running, choose whether a new prompt should steer the current turn or be queued."),appearance:o("Switch between system theme, light mode, and dark mode."),chatWidth:o("Choose how wide the conversation column and composer can grow on desktop screens."),dictationClickToToggle:o("Use click-to-start and click-to-stop dictation instead of hold-to-talk."),dictationAutoSend:o("Automatically send transcribed dictation when recording stops."),dictationLanguage:o("Choose transcription language or keep auto-detect.")},_={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},E={en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese",yue:"cantonese"},{projectGroups:O,projectDisplayNameById:H,selectedThread:X,selectedThreadTokenUsage:D,selectedThreadTerminalOpen:j,selectedThreadServerRequests:K,selectedLiveOverlay:Z,codexQuota:be,selectedThreadId:pe,availableCollaborationModes:de,availableModelIds:Pe,selectedCollaborationMode:G,selectedReasoningEffort:ve,selectedSpeedMode:Te,installedSkills:oe,accountRateLimitSnapshots:ke,messages:De,isLoadingThreads:Be,isLoadingMessages:Ke,isSendingMessage:Le,isInterruptingTurn:Se,isSelectedThreadInterruptPending:Qe,isUpdatingSpeedMode:tt,refreshAll:Ue,refreshSkills:He,selectThread:ft,ensureThreadMessagesLoaded:Je,setThreadTerminalOpen:We,toggleSelectedThreadTerminal:Tt,archiveThreadById:ee,forkThreadById:xe,renameThreadById:Ae,forkThreadFromTurn:Fe,sendMessageToSelectedThread:Ge,sendMessageToNewThread:x,interruptSelectedThreadTurn:P,selectedThreadQueuedMessages:z,removeQueuedMessage:ae,reorderQueuedMessage:Q,steerQueuedMessage:le,setSelectedCollaborationMode:fe,readModelIdForThread:ye,setSelectedModelIdForThread:we,setSelectedReasoningEffort:he,updateSelectedSpeedMode:je,respondToPendingServerRequest:me,renameProject:Me,removeProject:Ie,reorderProject:at,pinProjectToTop:dt,startPolling:lt,stopPolling:gt,primeSelectedThread:kt,rollbackSelectedThread:q}=mI(),U=zb(),F=Wb(),{isMobile:se}=Wc(),Ce=A(null),Ne=A(null),ze=A(null),xt=A(null),Bt=A(null),Wt=A(!1),Wn=A(!1),pr=A(!1),Xr=A(!0),Ln=A([]),Cr=A(Jm()),fa=A(""),Do=A(null),vn=A(!1),Zt=A("");let wo=!1;const Fo=A(!1),ot=A(""),cn=A("local"),zt=A({}),Or=new Map,nn=A(""),zn=A([]),Zr=A(!1),dn=A({order:[],labels:{},projectOrder:[]}),Dt=A({phase:"idle",title:"",message:""}),rn=A(Hv()),wn=A(""),on=A(!1),In=A(null),eo=A(null),On=A(null),to=A(null),bo=A(null);let Zn=null,jr=null,er=0,Sr=0;const bn=A("New Project (1)"),Dr=A(""),jn=A(!1),tr=A(zv()),Vn=A(!1),_o=A([]),Ft=A(null),mr=A(null),xr=A(null),Ar=A(null),fn=A(!1),Ct=A(!1),yt=A(""),nr=A({}),Rn=A(""),Fr=A(""),gn=A(!1),vr=A(!1),To=A(null),wt=A([]),Et=A(!1),Ot=A(!1),hn=A(!1),Qt=A(!1),Ur=A(!1),gr=A(""),yn=A(""),Er=A(null),rr=A(""),Dn=A(""),Gn=A(""),Vt=A(""),yr=A(lu(kh,!0)),Br=A(Rv()),Pn=A(Iv()),wr=A(Pv()),Mn=A(lu(xh,!1)),I=A(lu(Ah,!0)),B=A(Bv()),re=ne(()=>qv()),Re=A(!1),vt=A(!1),Jt=A(!1),pn=A(""),$e=A(!1),_e=A(null),mt=A(!1),_n=A(""),Kn=A("codex"),qs=ne(()=>[{value:"codex",label:"Codex"},{value:"openrouter",label:"OpenRouter"},{value:"opencode-zen",label:"OpenCode Zen"},{value:"custom",label:o("Custom endpoint")}]),en=A(""),Uo=A(""),no=A("responses"),Ir=A("responses"),Bo=A(""),qo=A(!1),or=A(""),Ho=A(""),qr=A(""),ko=A(!1),br=A(!1),Co=A(""),Tn=A(""),Hr=A(!1),Rr=A(!1),rs=A(null),os=A(null),Pr=A(""),Yn=A(""),ro=A(""),Wr=A([]),kn=A(""),$n=A(!1),ar=A(!1),ha=A(!1),_r=A(""),sr=A({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Wo=A(null),$a=A(!1),pa=A(!1),oo=A(typeof window<"u"?((_d=window.visualViewport)==null?void 0:_d.height)??window.innerHeight:0),Na=A(typeof window<"u"?((Td=window.visualViewport)==null?void 0:Td.offsetTop)??0:0),zo=A(typeof window<"u"?window.innerHeight:0);let zr=null,La=!1,So=0;const Vr=ne(()=>{const u=U.params.threadId;return typeof u=="string"?u:""}),jt=ne(()=>U.name==="home"),ir=ne(()=>U.name==="skills"),Oa=ne(()=>{var u;return ir.value?o("Skills"):jt.value?o("Start new thread"):((u=X.value)==null?void 0:u.title)??o("Choose a thread")}),as=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",Hs=ne(()=>{var p,C;return(((C=(p=X.value)==null?void 0:p.title)==null?void 0:C.trim())??"")||as}),ma=ne(()=>De.value.filter(u=>{const p=Gv(u.messageType,u.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),ss=ne(()=>Z.value),xo=ne(()=>jt.value?"__new-thread__":pe.value),Vo=ne(()=>ye(xo.value)),is=ne(()=>{const u=K.value;return u.length>0?u[u.length-1]:null}),qt=ne(()=>{var u,p;return jt.value?ot.value.trim():((p=(u=X.value)==null?void 0:u.cwd)==null?void 0:p.trim())??""}),Ws=ne(()=>Xr.value&&(jt.value&&qt.value.length>0||U.name==="thread"&&pe.value.length>0)),va=ne(()=>U.name==="thread"&&pe.value.length>0||jt.value&&Ao.value),Mr=ne(()=>jt.value?Wt.value:j.value),ao=ne(()=>!se.value||oo.value<=0||zo.value<=0?!1:zo.value-oo.value>120),Go=ne(()=>ao.value||Mr.value&&pr.value),y=ne(()=>{var u,p;return((p=(u=X.value)==null?void 0:u.cwd)==null?void 0:p.trim())??ot.value.trim()}),b=ne(()=>{var u;return!jt.value&&((u=X.value)==null?void 0:u.inProgress)===!0}),w=ne(()=>!jt.value&&!ir.value&&pe.value.trim().length>0),L=ne(()=>Le.value||Se.value||b.value||K.value.length>0);function Ee(u){return Number.isFinite(u)?new Intl.NumberFormat("en-US",{notation:u>=1e3?"compact":"standard",maximumFractionDigits:u>=1e5?0:1}).format(Math.max(0,Math.trunc(u))):"0"}function ut(u){if(!u)return o("Waiting for Codex thread/tokenUsage/updated events for this thread.");const p=[`${o("Current context usage")}: ${u.currentContextTokens.toLocaleString()} ${o("tokens")}`,`${o("Cumulative thread usage")}: ${u.total.totalTokens.toLocaleString()} ${o("tokens")}`];return typeof u.modelContextWindow=="number"?(p.unshift(`${o("Model context window")}: ${u.modelContextWindow.toLocaleString()} ${o("tokens")}`),p.push(`${o("Remaining context")}: ${(u.remainingContextTokens??0).toLocaleString()} ${o("tokens")}`)):p.push(o("Model context window is unavailable in the latest usage event.")),p.join(`
|
|
57
|
-
`)}function Pt(){Re.value&&(Re.value=!1,V_(!0))}function Cn(){Pt(),F.push({name:"skills",query:{tab:"plugins"}})}const an=ne(()=>{var p;const u=(p=D.value)==null?void 0:p.remainingContextPercent;return u===null||typeof u!="number"?"pending":u<=10?"danger":u<=25?"warning":"ok"}),Fn=ne(()=>{const u=D.value;return u?typeof u.remainingContextTokens=="number"?`${Ee(u.remainingContextTokens)} ${o("left")}`:`${Ee(u.currentContextTokens)} ${o("used")}`:o("Awaiting data")}),so=ne(()=>{const u=D.value;return u?typeof u.modelContextWindow=="number"?`${Ee(u.currentContextTokens)} ${o("used")} / ${Ee(u.modelContextWindow)}`:o("Window size unavailable"):o("Updates after the next token usage event")}),ga=ne(()=>ut(D.value));function Ko(u,p){const C=rt(u).trim(),V=Nr(C);return!C||!V?!1:p.some(te=>{const ue=rt(te).trim();return ue!==C&&Nr(ue)===V})}function zs(u,p=""){const C=rt(u).trim(),V=p.trim();if(V)return V;const te=Nr(C),ue=[...dn.value.order,...O.value.map(qe=>{var Gt,$r;return(($r=(Gt=qe.threads[0])==null?void 0:Gt.cwd)==null?void 0:$r.trim())??""}).filter(Boolean)];return Ko(C,ue)?C:te}function Vl(){const u=new Set(dn.value.order),p=dn.value.projectOrder.filter(C=>u.has(C));for(const C of dn.value.order)p.includes(C)||p.push(C);return p}function ja(u){const p=rt(u).trim(),C=[...dn.value.order,...O.value.map(V=>{var te,ue;return((ue=(te=V.threads[0])==null?void 0:te.cwd)==null?void 0:ue.trim())??""}).filter(Boolean)];return Ko(p,C)?p:Nr(p)}function Li(u){const p=rt(u).trim();if(!p)return"";const C=[...dn.value.order,...O.value.map(V=>{var te,ue;return((ue=(te=V.threads[0])==null?void 0:te.cwd)==null?void 0:ue.trim())??""}).filter(Boolean)];for(const V of dn.value.order){const te=rt(V).trim();if(!te)continue;const ue=Nr(te),qe=Ko(te,C)?te:ue;if(te===p||qe===p||ue===p)return te}return""}const Vs=ne(()=>{var V,te;const u=[],p=new Set;for(const ue of Vl()){const qe=ue.trim();!qe||p.has(qe)||(p.add(qe),u.push({value:qe,label:zs(qe,dn.value.labels[qe])}))}for(const ue of O.value){const qe=((te=(V=ue.threads[0])==null?void 0:V.cwd)==null?void 0:te.trim())??"";!qe||p.has(qe)||Cl(qe)||(p.add(qe),u.push({value:qe,label:zs(qe,H.value[ue.projectName])}))}const C=ot.value.trim();return C&&!p.has(C)&&u.unshift({value:C,label:zs(C)}),u}),Ao=ne(()=>{const u=ot.value.trim();return u?zt.value[u]===!0:!1}),Oi=ne(()=>{var p,C;const u={};for(const V of O.value){const te=Zs(V.projectName,((C=(p=V.threads[0])==null?void 0:p.cwd)==null?void 0:C.trim())??"");u[V.projectName]=te?zt.value[te]===!0:!1}return u}),Gs=ne(()=>{const u=nn.value.trim(),p=[...zn.value];return u&&!p.some(C=>C.value===u)&&p.unshift({value:u,label:u}),p}),ls=ne(()=>{const u=nn.value.trim();if(!u)return"";const p=Gs.value.find(C=>C.value===u);return(p==null?void 0:p.label)??u}),Ks=ne(()=>Yn.value.trim()),us=ne(()=>{const u=Co.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),Gl=ne(()=>us.value&&Ks.value.trim().length>0&&!kn.value),Da=ne(()=>{const u=rt(Pr.value).trim();return u||Yn.value.trim()}),cs=ne(()=>Hr.value?"Creating…":"Create"),Kl=ne(()=>{const u=Yn.value.trim(),p=ro.value.trim();return!!(u&&p&&u!==p)}),ji=ne(()=>{const u=[];Kl.value&&u.push({key:`parent:${ro.value}`,name:"..",path:ro.value,kind:"parent"});for(const p of Wr.value)u.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return u}),Ys=ne(()=>{const u=_r.value.trim().toLowerCase();return u?ji.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(u)):ji.value}),ya=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Yl=ne(()=>o(_[wr.value].label)),Qs=ne(()=>Mr.value?o("Terminal"):o("Open terminal")),io=ne(()=>{const u=new Map(Cr.value.map(C=>[C.value,C]));return[...Ln.value.map((C,V)=>({label:C.label,value:C.value,usageCount:0,lastUsedAt:0,...u.get(C.value)??{},custom:!1,sourceIndex:V}))].sort(Qm)}),Ql=ne(()=>[{label:Mr.value?o("Hide terminal"):o("Open terminal"),value:Th},...io.value.map(u=>({label:u.label,value:u.value}))]),Jl=ne(()=>{const u=_[wr.value],p=Math.max(0,zo.value-oo.value-Na.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":oo.value>0?`${oo.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Na.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),Di=ne(()=>{if(!sr.value.configured)return o("Not configured");const u=sr.value.active?o("Online"):o("Configured (offline)"),p=sr.value.allowAllUsers?o("allow all users"):`${sr.value.allowedUsers} ${o("allowed user(s)")}`,C=`${sr.value.mappedChats} ${o("chat(s)")}, ${sr.value.mappedThreads} ${o("thread(s)")}, ${p}`,V=sr.value.lastError?`, ${o("error")}: ${sr.value.lastError}`:"";return`${u}, ${C}${V}`});ca(()=>{var u,p;document.addEventListener("pointerdown",rd),window.addEventListener("keydown",Jc),document.addEventListener("visibilitychange",od),window.addEventListener("pageshow",ad),window.addEventListener("focus",sd),window.addEventListener("resize",Eo),(u=window.visualViewport)==null||u.addEventListener("resize",Eo),(p=window.visualViewport)==null||p.addEventListener("scroll",Eo),Eo(),Yi(),ya==null||ya.addEventListener("change",Yi),Kv(),bv(),Zl(),Ba(),Io(),Xs(),Js(),cu(),tv(),Xc()}),Ol(()=>{var u,p;document.removeEventListener("pointerdown",rd),window.removeEventListener("keydown",Jc),document.removeEventListener("visibilitychange",od),window.removeEventListener("pageshow",ad),window.removeEventListener("focus",sd),window.removeEventListener("resize",Eo),(u=window.visualViewport)==null||u.removeEventListener("resize",Eo),(p=window.visualViewport)==null||p.removeEventListener("scroll",Eo),ya==null||ya.removeEventListener("change",Yi),zr!==null&&(window.clearInterval(zr),zr=null),Zn&&(clearTimeout(Zn),Zn=null),Vi(),gt()});function Eo(){var u,p;typeof window>"u"||(zo.value=Math.max(zo.value,window.innerHeight),oo.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Na.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}pt(wn,u=>{const p=u.trim();if(Zn&&(clearTimeout(Zn),Zn=null),!p){bo.value=null;return}Zn=setTimeout(()=>{D_(p,1e3).then(C=>{wn.value.trim()===p&&(bo.value=C.threadIds)}).catch(()=>{wn.value.trim()===p&&(bo.value=null)})},220)}),pt(ao,u=>{u||(pr.value=!1)}),pt(wt,()=>{if(typeof window>"u")return;if(!wt.value.some(p=>p.quotaStatus==="loading")){zr!==null&&(window.clearInterval(zr),zr=null);return}zr===null&&(zr=window.setInterval(()=>{La||(La=!0,Yo({silent:!0}).finally(()=>{La=!1}))},1500))},{deep:!0});function Xl(){He()}async function Js(){try{sr.value=await B_()}catch(u){const p=u instanceof Error?u.message:"Failed to load Telegram status";sr.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function Xs(){try{const u=await U_();or.value=u.botToken,Ho.value=u.allowedUserIds.map(p=>String(p)).join(`
|
|
58
|
-
`),qr.value=""}catch(u){qr.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function Zl(){const u=await z_();Re.value=u.dismissed!==!0}function eu(u){const p=u.split(/[\n,]/).map(te=>te.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),C=p.includes("*"),V=Array.from(new Set(p.filter(te=>/^-?\d+$/.test(te)).map(te=>Number.parseInt(te,10))));return C?["*",...V]:V}async function tu(){const u=or.value.trim(),p=eu(Ho.value);if(!u){qr.value=o("Telegram bot token is required.");return}if(p.length===0){qr.value=o("At least one allowed Telegram user ID or * is required.");return}ko.value=!0,qr.value="";try{await F_(u,p),Ho.value=p.map(C=>String(C)).join(`
|
|
59
|
-
`),await Promise.all([Xs(),Js()]),window.alert(o("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(C){qr.value=C instanceof Error?C.message:o("Failed to connect Telegram bot"),Js()}finally{ko.value=!1}}function i(){on.value=!on.value,on.value?Xt(()=>{var u;return(u=In.value)==null?void 0:u.focus()}):wn.value=""}function d(){var u;wn.value="",(u=In.value)==null||u.focus()}function v(u){u.key==="Escape"&&(on.value=!1,wn.value="")}function T(u){u&&(U.name==="thread"&&Vr.value===u||(F.push({name:"thread",params:{threadId:u}}),se.value&&Gr(!0)))}async function M(u){u&&(pe.value!==u&&(await ft(u),await F.push({name:"thread",params:{threadId:u}})),await Xt(),Sv())}function N(u){return u.length>8?u.slice(-8):u}function W(u){const p=[u.planType||o("unknown")];return u.authMode&&p.unshift(u.authMode),p.join(" · ")}function Y(u){if(!u)return!1;const p=u.toLowerCase();return p.includes("payment required")||/\b402\b/.test(p)}function ie(u){return u.unavailableReason==="payment_required"||Y(u.quotaError)}function ge(u){return Et.value||Ot.value||hn.value||Qt.value||rr.value.length>0||u.isActive&&rr.value!==u.accountId&&L.value}function Ve(u){return Dn.value===u.accountId}function bt(u){return Gn.value===u.accountId||Ve(u)}function _t(u){return ie(u)?o("Unavailable"):u.isActive?o("Active"):Ot.value?o("Switching…"):o("Switch")}function St(u){return rr.value===u.accountId?o("Removing…"):Ve(u)?o("Click again to remove"):o("Remove")}function Sn(u){Gn.value=u}function Fa(u){Gn.value===u&&(Gn.value=""),rr.value!==u&&Dn.value===u&&(Dn.value="")}function ds(u){const p=u.quotaSnapshot;if(!p)return null;const C=[p==null?void 0:p.primary,p==null?void 0:p.secondary].filter(ue=>ue!==null),V=C.find(ue=>ue.windowMinutes===10080);if(V)return V;const te=C.filter(ue=>typeof ue.windowMinutes=="number"&&ue.windowMinutes>=10080).sort((ue,qe)=>(ue.windowMinutes??0)-(qe.windowMinutes??0))[0]??null;return te||(p.secondary??null)}function Fi(u){if(typeof u!="number"||!Number.isFinite(u))return"";const p=new Date(u*1e3);return`${p.getMonth()+1}月${p.getDate()}日`}function wa(u){var ue,qe;if(ie(u))return u.quotaError||o("402 Payment Required");const p=u.quotaSnapshot,C=ds(u),V=(p==null?void 0:p.primary)??(p==null?void 0:p.secondary)??null,te=C??V;if(te){const Gt=Math.max(0,Math.min(100,100-Math.round(te.usedPercent))),$r=Fi(te.resetsAt);return $r?`${Gt}% ${o("weekly remaining")} · ${$r}`:`${Gt}% ${o("weekly remaining")}`}return(ue=p==null?void 0:p.credits)!=null&&ue.unlimited?o("Unlimited credits"):(qe=p==null?void 0:p.credits)!=null&&qe.hasCredits&&p.credits.balance?`${p.credits.balance} ${o("credits")}`:u.quotaStatus==="loading"?o("Loading quota…"):u.quotaStatus==="error"?u.quotaError||o("Quota unavailable"):u.quotaStatus==="ready"||u.quotaStatus==="idle"?o("Quota unavailable"):o("Fetching account details…")}function Ua(u){return[u.email||o("Account"),W(u),ie(u)?o("Unavailable account"):null,wa(u),`${o("Workspace")} ${u.accountId}`].filter(Boolean).join(`
|
|
60
|
-
`)}async function Yo(u={}){try{const p=await Z0();wt.value=p.accounts,p.accounts.some(C=>C.accountId===Gn.value)||(Gn.value=""),p.accounts.some(C=>C.accountId===Dn.value)||(Dn.value="")}catch(p){if(u.silent===!0)return;Vt.value=p instanceof Error?p.message:o("Failed to load accounts")}}async function Ui(){if(!(Et.value||Ot.value||hn.value||Qt.value)){Vt.value="",Gn.value="",Dn.value="",Et.value=!0;try{const u=await e_();wt.value=u.accounts,gt(),lt(),Ue({includeSelectedThreadMessages:!0})}catch(u){Vt.value=u instanceof Error?u.message:o("Failed to refresh accounts")}finally{Et.value=!1}}}async function Bi(){var u;if(!(Et.value||Ot.value||hn.value||Qt.value)){Vt.value="",yn.value="",hn.value=!0;try{const p=await t_();gr.value=p,Ur.value=!0,window.open(p,"_blank","noopener,noreferrer"),await Xt(),(u=Er.value)==null||u.focus()}catch(p){Vt.value=p instanceof Error?p.message:o("Failed to start Codex login")}finally{hn.value=!1}}}function fs(){Qt.value||(Ur.value=!1,yn.value="")}async function qi(){const u=yn.value.trim();u&&await Hi(u)}async function Hi(u){if(!(Qt.value||u.length===0)){Vt.value="",Qt.value=!0;try{const p=await n_(u);wt.value=p.accounts,gr.value="",yn.value="",Ur.value=!1,gt(),lt(),Ue({includeSelectedThreadMessages:!0})}catch(p){Vt.value=p instanceof Error?p.message:o("Failed to complete Codex login")}finally{Qt.value=!1}}}async function Wi(u){if(!(Ot.value||Et.value||hn.value||Qt.value)){if(L.value){Vt.value=o("Finish the current turn and pending requests before switching accounts.");return}Vt.value="",Gn.value="",Dn.value="",Ot.value=!0;try{const p=await r_(u);wt.value=wt.value.map(C=>C.accountId===u?p:{...C,isActive:!1}),gt(),lt(),Ue({includeSelectedThreadMessages:!0}),Yo({silent:!0})}catch(p){Vt.value=p instanceof Error?p.message:o("Failed to switch account")}finally{Ot.value=!1}}}async function st(u){if(Et.value||Ot.value||hn.value||Qt.value||rr.value.length>0)return;const p=wt.value.find(V=>V.accountId===u)??null;if(!p)return;if(Dn.value!==u){Dn.value=u;return}if(p.isActive&&L.value){Vt.value=o("Finish the current turn and pending requests before removing the active account.");return}const C=p.isActive;Vt.value="",Dn.value="",rr.value=u;try{const V=await o_(u);wt.value=V.accounts,gt(),lt(),C&&Ue({includeSelectedThreadMessages:!0}),Yo({silent:!0})}catch(V){Vt.value=V instanceof Error?V.message:o("Failed to remove account")}finally{rr.value=""}}function Tr(u){ee(u)}async function Qo(u){const p=await xe(u);p&&(jt.value?await F.replace({name:"thread",params:{threadId:p}}):await F.push({name:"thread",params:{threadId:p}}),se.value&&Gr(!0))}function Kc(u){const p=u.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function Zs(u,p=""){var ue,qe,Gt;const C=O.value.find($r=>$r.projectName===u);if(!C)return Li(u)||p.trim();const V=C.threads.find($r=>!Kc($r.cwd));return(((ue=V==null?void 0:V.cwd)==null?void 0:ue.trim())??((Gt=(qe=C.threads[0])==null?void 0:qe.cwd)==null?void 0:Gt.trim())??"")||Li(u)||p.trim()}function $m(u){var V,te;const p=O.value.find(ue=>ue.projectName===u),C=Zs(u,((te=(V=p==null?void 0:p.threads[0])==null?void 0:V.cwd)==null?void 0:te.trim())??"");C&&(ot.value=C),se.value&&Gr(!0),!jt.value&&F.push({name:"home"})}function Nm(u){var C;let p="";for(const V of O.value){const te=V.threads.find(ue=>ue.id===u);if((C=te==null?void 0:te.cwd)!=null&&C.trim()){p=te.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function Yc(u){var C,V;const p=O.value.find(te=>te.projectName===u);return Zs(u,((V=(C=p==null?void 0:p.threads[0])==null?void 0:C.cwd)==null?void 0:V.trim())??"")}function Lm(u){return(H.value[u]??u).trim()||u}function Om(u){return Lm(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function jm(u){const p=Yc(u);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function Dm(u){const p=Yc(u);if(!p||typeof window>"u"||(await zi(p),zt.value[p]!==!0))return;const C=`${Om(u)}-`,V=window.prompt("New worktree folder name",C);if(V===null)return;const te=V.trim();if(te){if(te.includes("/")||te.includes("\\")||te==="."||te===".."){window.alert("Worktree name must be a single folder name.");return}try{const ue=await x_(p,te),qe=await ol(ue.cwd,{createIfMissing:!1,label:""});if(!qe)return;ot.value=qe,cn.value="local",dt(ja(qe)),await Ba(),await Io(),se.value&&Gr(!0),jt.value||await F.push({name:"home"})}catch(ue){const qe=ue instanceof Error?ue.message:"Failed to create worktree.";window.alert(qe)}}}function nu(){ot.value="",cn.value="local",se.value&&Gr(!0),!jt.value&&F.push({name:"home"})}async function zi(u){const p=u.trim();if(!p||Object.prototype.hasOwnProperty.call(zt.value,p))return;const C=Or.get(p);if(C){const ue=await C;Object.prototype.hasOwnProperty.call(zt.value,p)||(zt.value={...zt.value,[p]:ue});return}const V=I_(p).then(ue=>ue.isGitRepo).catch(()=>!1).finally(()=>{Or.delete(p)});Or.set(p,V);const te=await V;Object.prototype.hasOwnProperty.call(zt.value,p)||(zt.value={...zt.value,[p]:te})}function Fm(u){Me(u.projectName,u.displayName)}function Um(u){Ae(u.threadId,u.title)}async function Bm(u){await Ie(u),await Ba(),Io()}function qm(u){at(u.projectName,u.toIndex)}function Hm(u){var V,te;const p=O.value.find(ue=>ue.projectName===u),C=Zs(u,((te=(V=p==null?void 0:p.threads[0])==null?void 0:V.cwd)==null?void 0:te.trim())??"");zi(C)}function Qc(u){Wm(u)}async function Wm(u){var V;const p=await me(u),C=((V=u.followUpMessageText)==null?void 0:V.trim())??"";if(!(!p||!C||jt.value))try{await Ge(C,[],[],"steer",[])}catch{}}async function zm(u){const p=await Fe(u.threadId,u.turnIndex);p&&(await F.push({name:"thread",params:{threadId:p}}),pe.value!==p&&await ft(p),se.value&&Gr(!0))}function Gr(u){rn.value!==u&&(rn.value=u,Wv(u))}function Jc(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&jn.value){jn.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const p=u.key.toLowerCase();if(p==="b"){u.preventDefault(),Gr(!rn.value);return}if(p==="j"&&U.name==="thread"&&pe.value){u.preventDefault(),ru();return}p==="j"&&jt.value&&qt.value&&(u.preventDefault(),ru())}function ru(){if(Xr.value){if(jt.value){if(!qt.value)return;Wt.value=!Wt.value,Wt.value||ei();return}Tt(),j.value||ei()}}function Vm(u){if(fa.value="",!!u){if(u===Th){ru();return}Gm(u)}}async function Gm(u){if(!Xr.value||!qt.value)return;if(jt.value)Wt.value=!0;else if(pe.value)We(pe.value,!0);else return;const p=await Km();if(p)try{await p.runQuickCommand(u),Ym(u)}catch{}}async function Km(){for(let u=0;u<20;u+=1){await Xt();const p=jt.value?xt.value:Bt.value;if(p)return p;await new Promise(C=>window.setTimeout(C,25))}return null}async function Xc(){const u=qt.value.trim();if(!u){Ln.value=[];return}try{Ln.value=await Y0(u)}catch{Ln.value=[]}}function Ym(u){const p=Zc(u);if(!p)return;const C=Cr.value.find(Gt=>Gt.value===p),V=Ln.value.findIndex(Gt=>Gt.value===p),te=V>=0?Ln.value[V]:null;if(!te)return;const ue={label:(C==null?void 0:C.label)||(te==null?void 0:te.label)||p,value:p,custom:!1,usageCount:((C==null?void 0:C.usageCount)??0)+1,lastUsedAt:Date.now(),sourceIndex:V>=0?V:void 0},qe=[...Cr.value.filter(Gt=>Gt.value!==p),ue];Cr.value=qe,Xm(qe)}function Zc(u){return u.trim().replace(/\s+/g," ")}function Qm(u,p){if(p.usageCount!==u.usageCount)return p.usageCount-u.usageCount;if(p.lastUsedAt!==u.lastUsedAt)return p.lastUsedAt-u.lastUsedAt;const C=typeof u.sourceIndex=="number"?u.sourceIndex:Number.MAX_SAFE_INTEGER,V=typeof p.sourceIndex=="number"?p.sourceIndex:Number.MAX_SAFE_INTEGER;return C-V}function Jm(){if(typeof window>"u")return[];try{const u=window.localStorage.getItem(_h);if(!u)return[];const p=JSON.parse(u);if(!Array.isArray(p))return[];const C=new Set,V=[];for(const te of p){const ue=te!==null&&typeof te=="object"&&!Array.isArray(te)?te:null,qe=Zc(ed(ue==null?void 0:ue.value));!qe||C.has(qe)||(C.add(qe),V.push({label:ed(ue==null?void 0:ue.label)||qe,value:qe,custom:(ue==null?void 0:ue.custom)!==!1,usageCount:td(ue==null?void 0:ue.usageCount),lastUsedAt:td(ue==null?void 0:ue.lastUsedAt)}))}return V}catch{return[]}}function Xm(u){typeof window>"u"||window.localStorage.setItem(_h,JSON.stringify(u.map(p=>({label:p.label,value:p.value,custom:p.custom===!0,usageCount:p.usageCount,lastUsedAt:p.lastUsedAt}))))}function ed(u){return typeof u=="string"?u:""}function td(u){if(typeof u=="number"&&Number.isFinite(u))return Math.max(0,Math.trunc(u));if(typeof u=="string"){const p=Number(u);if(Number.isFinite(p))return Math.max(0,Math.trunc(p))}return 0}function nd(u){if(Wn.value=u,!u){pr.value=!1,Vi();return}pr.value=!0,Vi(),jr=setTimeout(()=>{jr=null,ao.value||(pr.value=!1)},1500)}function Zm(){Wt.value=!1,ei()}function ev(){pe.value&&We(pe.value,!1),ei()}function ei(){Wn.value=!1,pr.value=!1,Vi()}function Vi(){jr&&(clearTimeout(jr),jr=null)}async function tv(){try{const u=await K0();Xr.value=u.available,u.available||(Wt.value=!1,pe.value&&We(pe.value,!1))}catch{Xr.value=!1,Wt.value=!1}}function rd(u){var C,V;const p=u.target;if(p instanceof Node){if(Wn.value){const te=p instanceof Element?p:p.parentElement;te!=null&&te.closest(".thread-terminal-panel")||ei()}jn.value&&((C=On.value)!=null&&C.contains(p)||(V=to.value)!=null&&V.contains(p)||(jn.value=!1))}}function nv(u){var C,V;if(!jn.value)return;const p=u.target;p instanceof Node&&((C=On.value)!=null&&C.contains(p)||(V=to.value)!=null&&V.contains(p)||(jn.value=!1))}function od(){if(!(typeof document>"u")&&se.value){if(document.visibilityState==="hidden"){Wo.value=Date.now(),$a.value=!1;return}ou()}}function ad(u){u.persisted&&ou()}function sd(){U.name==="home"&&(Ba(),Io()),ou()}function ou(){typeof window>"u"||typeof document>"u"||!se.value||document.visibilityState!=="visible"||$a.value||Wo.value===null||Date.now()-Wo.value<_M||($a.value=!0,Wo.value=null,rv())}async function rv(){if(!pa.value){pa.value=!0;try{await Ue({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await fu()}finally{pa.value=!1}}}function id(u){const p=u.text;Gi();const C=Do.value,V=u.mode==="queue"&&C&&C.threadId===pe.value?C.queueIndex:void 0;if(Do.value=null,jt.value){Qv(p,u.imageUrls,u.skills,u.fileAttachments);return}Ge(p,u.imageUrls,u.skills,u.mode,u.fileAttachments,V)}function ov(u){const p=z.value.findIndex(ue=>ue.id===u),C=p>=0?z.value[p]:void 0,V=Ne.value;if(!C||!V||V.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Do.value=pe.value?{threadId:pe.value,queueIndex:p}:null;const te={text:C.text,imageUrls:[...C.imageUrls],fileAttachments:C.fileAttachments.map(ue=>({...ue})),skills:C.skills.map(ue=>({...ue}))};V.hydrateDraft(te),ae(u)}function Gi(){if(!se.value||jt.value)return;const u=()=>{var p;(p=ze.value)==null||p.jumpToLatest()};u(),Xt(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function av(u){ot.value=u.trim(),Tn.value=""}function sv(u){nn.value=u.trim()}function Ki(u){const p=qt.value.trim();return!u||p!==u?!1:U.name==="thread"||U.name==="home"&&Ao.value}function ld(){er+=1,Sr+=1,_o.value=[],Ft.value=null,mr.value=null,xr.value=null,Ar.value=null,fn.value=!1,Ct.value=!1,nr.value={},Rn.value="",Fr.value="",yt.value="",gn.value=!1}async function ti(u){const p=u.trim();if(!p){ld();return}const C=++er;gn.value=!0,yt.value="";try{const V=await E_(p);if(C!==er||!Ki(p))return;_o.value=V.options,Ft.value=V.currentBranch,mr.value=V.headSha,xr.value=V.headSubject,Ar.value=V.headDate,fn.value=V.detached,Ct.value=V.dirty}catch{if(C!==er||!Ki(p))return;_o.value=[],Ft.value=null,mr.value=null,xr.value=null,Ar.value=null,fn.value=!1,Ct.value=!1}finally{C===er&&(gn.value=!1)}}function iv(u){Ft.value=u.currentBranch,mr.value=u.headSha,xr.value=u.headSubject,Ar.value=u.headDate,fn.value=u.detached,Ct.value=u.dirty}function lv(u){if(vr.value)return;const p=u.trim();if(!p||p===(Ft.value??""))return;const C=qt.value.trim();C&&(vr.value=!0,yt.value="",R_(C,p).then(V=>(Ft.value=V||p,mr.value=null,xr.value=null,Ar.value=null,fn.value=!1,Vn.value=!1,ti(C))).catch(V=>{const te=V instanceof Error?V.message:"Failed to switch branch";ti(C).finally(()=>{yt.value=te})}).finally(()=>{vr.value=!1}))}function uv(u){if(vr.value)return;const p=u.branch.trim(),C=u.sha.trim(),V=qt.value.trim();!p||!C||!V||(vr.value=!0,yt.value="",M_(V,p,C).then(te=>(iv(te),Vn.value=!1,ti(V))).catch(te=>{const ue=te instanceof Error?te.message:"Failed to reset branch to commit";ti(V).finally(()=>{yt.value=ue})}).finally(()=>{vr.value=!1}))}function cv(u){const p=u.trim(),C=qt.value.trim();if(!p||!C||Rn.value===p||nr.value[p])return;const V=++Sr;Rn.value=p,Fr.value="",P_(C,p).then(te=>{V!==Sr||!Ki(C)||(nr.value={...nr.value,[p]:te})}).catch(te=>{V!==Sr||!Ki(C)||(Fr.value=te instanceof Error?te.message:"Failed to load branch commits")}).finally(()=>{V===Sr&&Rn.value===p&&(Rn.value="")})}async function dv(){const u=await su();if(!u)return;await Io();const p=bn.value.trim()||"New Project (1)",C=window.prompt(`Create project in ${u}`,p);if(C===null)return;const V=C.trim();if(!V)return;const te=fd(dd(u,V));if(te)try{const ue=await ol(te,{createIfMissing:!0,label:""});if(!ue)return;ot.value=ue,dt(ja(ue)),await Ba(),await Io()}catch(ue){const qe=ue instanceof Error?ue.message:"Failed to create the project.";window.alert(qe)}}async function fv(){const u=ot.value.trim()||await su();u&&(br.value=!1,Rr.value=!0,_r.value="",await ba(u),kn.value||Xt(()=>{var p;return(p=rs.value)==null?void 0:p.focus()}))}function hs(){So+=1,Rr.value=!1,$n.value=!1,kn.value="",_r.value="",Pr.value="",ni()}async function hv(u){!u||$n.value||(_r.value="",await ba(u))}function pv(){const u=Yn.value.trim();!Rr.value||!u||ba(u)}function mv(){const u=Da.value;!Rr.value||!u||$n.value||ba(u)}function vv(){if(!Rr.value||$n.value||ar.value)return;const u=Da.value,p=Yn.value.trim();!u||u===p||ba(u)}function gv(){const u=Da.value,p=Yn.value.trim();if(u){if(u!==p){ba(u);return}au(u)}}async function au(u=Da.value){const p=rt(u).trim();if(p){kn.value="",ar.value=!0;try{const C=await ol(p,{createIfMissing:!1,label:""});if(!C){kn.value="Failed to open the selected folder.";return}ot.value=C,dt(ja(C)),await Ba(),await Io(),hs()}catch(C){kn.value=C instanceof Error?C.message:"Failed to open the selected folder."}finally{ar.value=!1}}}async function yv(){if(Tn.value="",br.value){ni();return}if(!Rr.value){const u=ot.value.trim()||await su();if(!u||(Rr.value=!0,_r.value="",await ba(u),kn.value))return}kn.value||(Co.value=bn.value,br.value=!0,Xt(()=>{var u;return(u=To.value)==null?void 0:u.focus()}))}function ni(){Tn.value="",Co.value="",br.value=!1}async function ud(){const u=Co.value.trim();if(!u)return;if(Tn.value="",kn.value){Tn.value="Reload the current folder before creating a new one.";return}Hr.value=!0;const p=Ks.value.trim(),C=fd(dd(p,u));if(!C){Tn.value="Unable to determine where the new folder should be created.",Hr.value=!1;return}if(!us.value){Tn.value="Enter a single folder name.",Hr.value=!1;return}try{const V=await N_(C);if(!V){Tn.value="Failed to create the folder.";return}Tn.value="",_r.value="",await ba(V),ni()}catch(V){Tn.value=V instanceof Error?V.message:"Failed to create folder."}finally{Hr.value=!1}}async function wv(){var p;if(typeof window>"u")return!1;const u=((p=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:p.trim())??"";if(!u)return!1;try{const C=await ol(u,{createIfMissing:!1,label:""});if(!C)return!1;ot.value=C,dt(ja(C)),await F.replace({name:"home"}),await Ba();const V=new URL(window.location.href);return V.searchParams.delete("openProjectPath"),window.history.replaceState({},"",V.toString()),!0}catch{return!1}}async function su(){const u=cd();if(u)return u;try{const p=await Yf();if(p)return Dr.value=p,p}catch{}return""}async function Io(){const u=cd();if(!u){bn.value="New Project (1)";return}try{const p=await O_(u);bn.value=p.name||"New Project (1)"}catch{bn.value="New Project (1)"}}function cd(){var C,V;const u=ot.value.trim();if(u)return Ms(u);const p=((V=(C=Vs.value[0])==null?void 0:C.value)==null?void 0:V.trim())??"";return p?Ms(p):Dr.value.trim()}async function bv(){try{Dr.value=await Yf()}catch{Dr.value=""}}async function Ba(){try{const u=await _s();dn.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{dn.value={order:[],labels:{},projectOrder:[]}}}async function ba(u){const p=++So,C=rt(u).trim();Pr.value=C,Yn.value=C,kn.value="",$n.value=!0;try{const V=await $_(u,{showHidden:ha.value});if(p!==So)return;Pr.value=V.path,Yn.value=V.path,ro.value=V.parentPath,Wr.value=V.entries}catch(V){if(p!==So)return;kn.value=V instanceof Error?V.message:"Failed to load local folders.",ro.value=Ms(Yn.value),Wr.value=[],ni()}finally{p===So&&($n.value=!1)}}function dd(u,p){const C=rt(u).trim(),V=rt(p).trim().replace(/^[\\/]+/u,"");if(!C||!V)return"";const te=C.includes("\\")&&!C.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(C))return`${C.slice(0,2)}${te}${V}`;if(/^\/+$/u.test(C))return`/${V}`;const ue=C.replace(/[\\/]+$/u,"");return ue?`${ue}${te}${V}`:""}function fd(u){const p=rt(u).trim();if(!p)return"";const C=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(C){const[,te,ue,qe=""]=C,Gt=iu(qe.split(/[\\/]+/u));return Gt.length>0?`\\\\${te}\\${ue}\\${Gt.join("\\")}`:`\\\\${te}\\${ue}`}const V=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(V){const[,te,ue=""]=V,qe=p.includes("\\")&&!p.includes("/")?"\\":"/",Gt=iu(ue.split(/[\\/]+/u));return Gt.length>0?`${te}${qe}${Gt.join(qe)}`:`${te}${qe}`}if(p.startsWith("/")){const te=iu(p.split("/"));return te.length>0?`/${te.join("/")}`:"/"}return p}function iu(u){const p=[];for(const C of u){const V=C.trim();if(!(!V||V===".")){if(V===".."){p.length>0&&p.pop();continue}p.push(V)}}return p}function _v(u){Q(u.draggedId,u.targetId)}function hd(u){we(xo.value,u)}function pd(u){he(u)}function md(u){je(u)}function Tv(){P()}function kv(u){const p=u.turnId.trim();if(p.length>0){const C=[...ma.value].reverse().find(V=>{var te;return V.role==="user"&&(((te=V.turnId)==null?void 0:te.trim())??"")===p&&V.text.trim().length>0});C!=null&&C.text&&Ne.value&&Ne.value.appendTextToDraft(C.text)}q(u.turnId)}function Cv(u){jt.value||!pe.value||(fe("default"),Gi(),Ge("Implement",[],[],"steer",[],void 0,"default"))}function Sv(){if(jt.value||ir.value||typeof document>"u"||!X.value||ma.value.length===0)return;const u=xv(),p=Av(),C=new Blob([u],{type:"text/markdown;charset=utf-8"}),V=URL.createObjectURL(C),te=document.createElement("a");te.href=V,te.download=p,document.body.appendChild(te),te.click(),document.body.removeChild(te),window.setTimeout(()=>URL.revokeObjectURL(V),0)}function xv(){var C,V,te;const u=[],p=((V=(C=X.value)==null?void 0:C.title)==null?void 0:V.trim())||"Untitled thread";u.push(`# ${Ev(p)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((te=X.value)==null?void 0:te.id)??""}`),u.push(""),u.push("---"),u.push("");for(const ue of ma.value){const qe=ue.role?ue.role.toUpperCase():"MESSAGE";u.push(`## ${qe}`),u.push("");const Gt=ue.text.trim();if(Gt&&(u.push(Gt),u.push("")),ue.commandExecution&&(u.push("```text"),u.push(`command: ${ue.commandExecution.command}`),u.push(`status: ${ue.commandExecution.status}`),ue.commandExecution.cwd&&u.push(`cwd: ${ue.commandExecution.cwd}`),ue.commandExecution.exitCode!==null&&u.push(`exitCode: ${ue.commandExecution.exitCode}`),u.push(ue.commandExecution.aggregatedOutput||"(no output)"),u.push("```"),u.push("")),ue.fileAttachments&&ue.fileAttachments.length>0){u.push("Attachments:");for(const $r of ue.fileAttachments)u.push(`- ${$r.path}`);u.push("")}if(ue.images&&ue.images.length>0){u.push("Images:");for(const $r of ue.images)u.push(`- ${$r}`);u.push("")}}return`${u.join(`
|
|
61
|
-
`).trimEnd()}
|
|
62
|
-
`}function Av(){var te,ue;const C=(((ue=(te=X.value)==null?void 0:te.title)==null?void 0:ue.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",V=new Date().toISOString().replace(/[:.]/g,"-");return`${C}-${V}.md`}function Ev(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function lu(u,p){if(typeof window>"u")return p;const C=window.localStorage.getItem(u);return C===null?p:C==="1"}function Iv(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(Sh);return u==="light"||u==="dark"?u:"system"}function Rv(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(Ch);return u==="steer"||u==="queue"?u:"queue"}function Pv(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem(Ih);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function Mv(){yr.value=!yr.value,window.localStorage.setItem(kh,yr.value?"1":"0")}function $v(){Br.value=Br.value==="steer"?"queue":"steer",window.localStorage.setItem(Ch,Br.value)}function Nv(){const u=["system","light","dark"],p=u.indexOf(Pn.value);Pn.value=u[(p+1)%u.length],window.localStorage.setItem(Sh,Pn.value),Yi()}function Lv(){const u=["standard","wide","extra-wide"],p=u.indexOf(wr.value);wr.value=u[(p+1)%u.length],window.localStorage.setItem(Ih,wr.value)}function Ov(){Mn.value=!Mn.value,window.localStorage.setItem(xh,Mn.value?"1":"0")}function jv(){I.value=!I.value,window.localStorage.setItem(Ah,I.value?"1":"0")}async function Dv(u){if(!Jt.value){Jt.value=!0;try{if(u==="codex"){Kn.value="codex";const p=await Vf(!1);vt.value=p.enabled}else if(u==="openrouter"){Kn.value="openrouter";const p=await Vf(!0);vt.value=p.enabled,await ms("","",{wireApi:Ir.value,provider:"openrouter"})}else u==="opencode-zen"?(Kn.value="opencode-zen",await ms("",Bo.value.trim(),{wireApi:"chat",provider:"opencode-zen"}),vt.value=!0):u==="custom"&&(Kn.value="custom",en.value.trim()&&Uo.value.trim()&&(await ms(en.value.trim(),Uo.value.trim(),{wireApi:no.value}),vt.value=!0));_n.value="",await Ue({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0}),U.name==="thread"&&F.push({name:"home"})}catch(p){_n.value=p instanceof Error?p.message:"Failed to switch provider"}finally{Jt.value=!1}}}async function uu(){if(mt.value)return;const u=en.value.trim();if(u){mt.value=!0;try{_n.value="",await ms(u,Uo.value.trim(),{wireApi:no.value}),vt.value=!0,await Ue({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){_n.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{mt.value=!1}}}async function vd(u){if(mt.value||Jt.value||Ir.value===u)return;const p=Ir.value;Ir.value=u,mt.value=!0;try{_n.value="",await ms("","",{wireApi:u,provider:"openrouter"}),vt.value=!0,await Ue({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(C){Ir.value=p,_n.value=C instanceof Error?C.message:"Failed to save OpenRouter API format"}finally{mt.value=!1}}async function gd(){if(mt.value)return;const u=Bo.value.trim();if(u){mt.value=!0;try{_n.value="",await ms("",u,{wireApi:"chat",provider:"opencode-zen"}),vt.value=!0,await Ue({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){_n.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{mt.value=!1}}}async function yd(){if(!mt.value){mt.value=!0;try{const u=pn.value.trim();await Gf(u),pn.value="",await cu(),await Ue({includeSelectedThreadMessages:!1})}catch{}finally{mt.value=!1}}}async function Fv(){if(!mt.value){mt.value=!0;try{await Gf(""),pn.value="",await cu(),await Ue({includeSelectedThreadMessages:!1})}catch{}finally{mt.value=!1}}}async function cu(){try{const u=await p_();vt.value=u.enabled,$e.value=u.customKey??!1,_e.value=u.maskedKey??null,u.enabled?u.provider==="opencode-zen"?Kn.value="opencode-zen":u.provider==="custom"?(Kn.value="custom",en.value=u.customBaseUrl??"",no.value=u.wireApi==="chat"?"chat":"responses"):(Kn.value="openrouter",Ir.value=u.wireApi==="chat"?"chat":"responses"):Kn.value="codex"}catch{}}function Uv(u){const C=du(u.trim())||"auto";B.value=C,window.localStorage.setItem(Eh,C)}function Bv(){var C;if(typeof window>"u")return"auto";const u=((C=window.localStorage.getItem(Eh))==null?void 0:C.trim())||"auto";return du(u)||"auto"}function qv(){const u=[{value:"auto",label:o("Auto-detect")}],p=new Set(["auto"]);function C(te){const ue=E[te]||te;return`${ue.charAt(0).toUpperCase()+ue.slice(1)} (${te})`}for(const te of typeof navigator<"u"?navigator.languages??[]:[]){const ue=du(te);!ue||p.has(ue)||(p.add(ue),u.push({value:ue,label:`Preferred: ${C(ue)}`}))}for(const te of Object.keys(E))p.has(te)||(p.add(te),u.push({value:te,label:C(te)}));const V=B.value.trim();return V&&!p.has(V)&&u.push({value:V,label:C(V)}),u}function du(u){const p=u.trim().toLowerCase();if(!p||p==="auto")return"";if(p in E)return p;const C=p.split("-")[0]??p;return C in E?C:""}function Yi(){const u=document.documentElement;if(Pn.value==="dark")u.classList.add("dark");else if(Pn.value==="light")u.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",p)}}function Hv(){return typeof window>"u"?!1:window.localStorage.getItem(wh)==="1"}function Wv(u){typeof window>"u"||window.localStorage.setItem(wh,u?"1":"0")}function zv(){if(typeof window>"u")return!0;const u=window.localStorage.getItem(bh);return u===null?!0:u==="1"}function Vv(){tr.value=!tr.value,!(typeof window>"u")&&window.localStorage.setItem(bh,tr.value?"1":"0")}function Gv(u,p){const C=(u??"").trim();return C.length>0?C:p.trim()||"message"}function wd(u){fe(u)}async function Kv(){await F.isReady(),U.name==="thread"&&Vr.value&&kt(Vr.value),await Ue({includeSelectedThreadMessages:U.name==="thread"}),Yo({silent:!0}),await wv(),Fo.value=!0,await fu(),lt()}function Yv(u){return u?O.value.some(p=>p.threads.some(C=>C.id===u)):!1}async function fu(){if(vn.value){wo=!0;return}vn.value=!0;try{do{if(wo=!1,U.name==="home"||U.name==="skills"){pe.value!==""&&await ft("");continue}if(U.name==="thread"){const u=Vr.value;if(!u)continue;if(pe.value!==u){if(!Yv(u)){pe.value?await F.replace({name:"thread",params:{threadId:pe.value}}):await F.replace({name:"home"});continue}await ft(u)}else Je(u,{silent:!0})}}while(wo)}finally{vn.value=!1}}pt(()=>[U.name,Vr.value,Be.value,pe.value],async()=>{Fo.value&&await fu()}),pt(()=>qt.value,()=>{Xc()}),pt(()=>[U.name,qt.value],([u,p])=>{u==="thread"&&zi(p)},{immediate:!0}),pt(()=>pe.value,async u=>{if(Fo.value&&!vn.value&&!(jt.value||ir.value)){if(!u){U.name!=="home"&&await F.replace({name:"home"});return}U.name==="thread"&&Vr.value===u||await F.replace({name:"thread",params:{threadId:u}})}}),pt(()=>Vs.value,u=>{if(u.length===0){ot.value="",Io();return}const p=ot.value.trim();p&&(u.some(V=>V.value===p)||(ot.value="")),Io()},{immediate:!0}),pt(()=>ot.value,()=>{Dt.value={phase:"idle",title:"",message:""},Io()}),pt(()=>[U.name,ot.value],([u,p])=>{u==="home"&&zi(p)},{immediate:!0}),pt(Ao,u=>{!u&&cn.value==="worktree"&&(cn.value="local")},{immediate:!0}),pt(()=>[cn.value,ot.value],([u,p])=>{u!=="worktree"||!Ao.value||bd(p)},{immediate:!0}),pt(()=>cn.value,u=>{var p;if(u==="local"){Dt.value={phase:"idle",title:"",message:""};const C=ot.value.trim();if(C&&Kc(C)){const V=((p=X.value)==null?void 0:p.projectName)??Nr(C),te=Zs(V,"");te&&(ot.value=te)}return}Ao.value&&bd(ot.value)}),pt(()=>U.name,u=>{u!=="home"&&(Dt.value={phase:"idle",title:"",message:""}),u!=="thread"&&(Vn.value=!1)}),pt(()=>pe.value,()=>{Dt.value={phase:"idle",title:"",message:""}}),pt(()=>[U.name,qt.value,Ao.value],([u,p,C])=>{if(!(u==="thread"||u==="home"&&C)){ld();return}Sr+=1,nr.value={},Rn.value="",Fr.value="",ti(p)},{immediate:!0}),pt(Hs,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),pt(se,u=>{u&&!rn.value&&Gr(!0)},{immediate:!0});async function Qv(u,p=[],C=[],V=[]){try{Dt.value={phase:"idle",title:"",message:""};let te=ot.value;if(cn.value==="worktree"){Dt.value={phase:"running",title:o("Creating worktree"),message:o("Creating a worktree and running setup.")};try{const qe=await S_(ot.value,nn.value);te=qe.cwd,ot.value=qe.cwd,Dt.value={phase:"idle",title:"",message:""}}catch{Dt.value={phase:"error",title:o("Worktree setup failed"),message:o("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!te.trim()){const qe=await L_(u);te=qe.cwd,ot.value=qe.cwd}const ue=await x(u,te,p,C,V);if(!ue)return;await F.replace({name:"thread",params:{threadId:ue}}),Gi()}catch{}}function Jv(u){var V;if((V=u.prompt)!=null&&V.trim())return u.prompt.trim();const p=u.displayName.trim()||u.name.trim(),C=u.kind==="skill"?"skill":u.kind==="plugin"?"plugin":u.kind==="composio"?"Composio connector":"app";return`Test ${p} ${C}. Give me a list of what it can do and one useful example.`}function Xv(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function Zv(u){var V;if(Zt.value)return;Zt.value=Xv(u);const p=Jv(u),C=(V=u.attachedSkills)!=null&&V.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[];try{const te=y.value.trim()||qt.value.trim(),ue=await x(p,te,[],C,[]);if(!ue)return;await F.replace({name:"thread",params:{threadId:ue}}),Gi()}catch{}finally{Zt.value=""}}async function bd(u){var C;const p=u.trim();if(!p){zn.value=[],nn.value="";return}Zr.value=!0;try{const V=await A_(p);zn.value=V;const te=nn.value.trim();if(!(te.length>0&&V.some(qe=>qe.value===te))){const qe=V.find(Gt=>Gt.value.trim()==="main");nn.value=(qe==null?void 0:qe.value)??((C=V[0])==null?void 0:C.value)??""}}catch{zn.value=[],nn.value=""}finally{Zr.value=!1}}return(u,p)=>(k(),R(Ye,null,[Oe(Jb,{"is-sidebar-collapsed":rn.value,onCloseSidebar:p[26]||(p[26]=C=>Gr(!0))},{sidebar:ht(()=>[m("section",vI,[m("div",gI,[rn.value?J("",!0):(k(),Ze(ih,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":rn.value,"show-new-thread-button":!0,onToggleSidebar:p[0]||(p[0]=C=>Gr(!rn.value)),onStartNewThread:nu},{default:ht(()=>[m("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":on.value,"aria-label":S(o)("Search threads"),title:S(o)("Search threads"),onClick:i},[Oe(lh,{class:"sidebar-search-toggle-icon"})],8,yI)]),_:1},8,["is-sidebar-collapsed"])),!rn.value&&on.value?(k(),R("div",wI,[Oe(lh,{class:"sidebar-search-bar-icon"}),tn(m("input",{ref_key:"sidebarSearchInputRef",ref:In,"onUpdate:modelValue":p[1]||(p[1]=C=>wn.value=C),class:"sidebar-search-input",type:"text",placeholder:S(o)("Filter threads..."),onKeydown:v},null,40,bI),[[un,wn.value]]),wn.value.length>0?(k(),R("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":S(o)("Clear search"),onClick:d},[Oe(bE,{class:"sidebar-search-clear-icon"})],8,_I)):J("",!0)])):J("",!0),rn.value?J("",!0):(k(),R("button",{key:2,class:et(["sidebar-skills-link",{"is-active":ir.value}]),type:"button",onClick:p[2]||(p[2]=C=>{S(F).push({name:"skills"}),S(se)&&Gr(!0)})},[m("span",TI,[Oe(pl)]),m("span",kI,[m("span",CI,$(S(o)("Skills")),1),m("span",SI,$(S(o)("Plugins, apps, MCPs")),1)])],2)),rn.value?J("",!0):(k(),Ze(cC,{key:3,groups:S(O),"project-display-name-by-id":S(H),"project-git-repo-by-name":Oi.value,"selected-thread-id":S(pe),"is-loading":S(Be),"search-query":wn.value,"search-matched-thread-ids":bo.value,onSelect:T,onArchive:Tr,onStartNewThread:$m,onRenameProject:Fm,onBrowseThreadFiles:Nm,onBrowseProjectFiles:jm,onRequestProjectGitStatus:Hm,onCreateProjectWorktree:Dm,onRenameThread:Um,onForkThread:Qo,onRemoveProject:Bm,onReorderProject:qm,onExportThread:M,onStartNewChat:nu},null,8,["groups","project-display-name-by-id","project-git-repo-by-name","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),rn.value?J("",!0):(k(),R("div",{key:0,ref_key:"settingsAreaRef",ref:eo,class:"sidebar-settings-area",onClick:nv},[Oe(Hp,{name:"settings-panel"},{default:ht(()=>[jn.value?(k(),R("div",{key:0,ref_key:"settingsPanelRef",ref:On,class:"sidebar-settings-panel",onClick:p[15]||(p[15]=Xe(()=>{},["stop"]))},[m("div",xI,[m("div",AI,[m("div",EI,[m("button",{class:"sidebar-settings-account-collapse",type:"button","aria-expanded":!tr.value,title:tr.value?S(o)("Expand accounts"):S(o)("Collapse accounts"),onClick:Vv},[m("span",RI,$(tr.value?"▸":"▾"),1)],8,II),m("span",PI,$(S(o)("Accounts")),1),m("span",MI,$(wt.value.length),1)]),m("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:Et.value||Ot.value||hn.value||Qt.value,onClick:Ui},$(Et.value?S(o)("Reloading…"):S(o)("Reload")),9,$I)]),tr.value?J("",!0):(k(),R(Ye,{key:0},[Vt.value?(k(),R("p",NI,$(Vt.value),1)):J("",!0),m("div",LI,[m("button",{class:"sidebar-settings-account-login-button",type:"button",disabled:Et.value||Ot.value||hn.value||Qt.value,onClick:Bi},$(hn.value?S(o)("Starting login…"):S(o)("Login")),9,OI),gr.value?(k(),R("a",{key:0,class:"sidebar-settings-account-login-link",href:gr.value,target:"_blank",rel:"noreferrer"},$(S(o)("Open login URL")),9,jI)):J("",!0)]),wt.value.length===0?(k(),R("p",DI,$(S(o)("Click Login, or run `codex login`, then click reload.")),1)):(k(),R("div",FI,[(k(!0),R(Ye,null,Kt(wt.value,C=>(k(),R("article",{key:C.accountId,class:et(["sidebar-settings-account-item",{"is-active":C.isActive,"is-unavailable":ie(C),"is-confirming-remove":Ve(C),"is-remove-visible":bt(C)}]),title:Ua(C),onMouseenter:V=>Sn(C.accountId),onMouseleave:V=>Fa(C.accountId)},[m("div",BI,[m("p",qI,$(C.email||S(o)("Account")),1),m("p",HI,$(W(C)),1),m("p",WI,$(wa(C)),1),m("p",zI," Workspace "+$(N(C.accountId)),1)]),m("div",VI,[m("button",{class:"sidebar-settings-account-switch",type:"button",disabled:ge(C)||C.isActive||ie(C),onClick:V=>Wi(C.accountId)},$(_t(C)),9,GI),m("button",{class:et(["sidebar-settings-account-remove",{"is-visible":bt(C),"is-confirming":Ve(C)}]),type:"button",disabled:ge(C),onClick:V=>st(C.accountId)},$(St(C)),11,KI)])],42,UI))),128))]))],64))]),m("button",{class:"sidebar-settings-row",type:"button",title:g.sendWithEnter,onClick:Mv},[m("span",QI,$(S(o)("Require ⌘ + enter to send")),1),m("span",{class:et(["sidebar-settings-toggle",{"is-on":!yr.value}])},null,2)],8,YI),m("button",{class:"sidebar-settings-row",type:"button",title:g.inProgressSendMode,onClick:$v},[m("span",XI,$(S(o)("When busy, send as")),1),m("span",ZI,$(Br.value==="steer"?S(o)("Steer"):S(o)("Queue")),1)],8,JI),m("button",{class:"sidebar-settings-row",type:"button",title:g.appearance,onClick:Nv},[m("span",tR,$(S(o)("Appearance")),1),m("span",nR,$(Pn.value==="system"?S(o)("System"):Pn.value==="dark"?S(o)("Dark"):S(o)("Light")),1)],8,eR),m("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:S(o)("Choose the interface language for the app.")},[m("span",oR,$(S(o)("UI language")),1),Oe(Lr,{class:"sidebar-settings-language-dropdown","model-value":S(s),options:S(l),"open-direction":"up","onUpdate:modelValue":p[3]||(p[3]=C=>S(c)(C))},null,8,["model-value","options"])],8,rR),m("button",{class:"sidebar-settings-row",type:"button",title:g.chatWidth,onClick:Lv},[m("span",sR,$(S(o)("Chat width")),1),m("span",iR,$(Yl.value),1)],8,aR),m("button",{class:"sidebar-settings-row",type:"button",title:g.dictationClickToToggle,onClick:Ov},[m("span",uR,$(S(o)("Click to toggle dictation")),1),m("span",{class:et(["sidebar-settings-toggle",{"is-on":Mn.value}])},null,2)],8,lR),m("button",{class:"sidebar-settings-row",type:"button",title:g.dictationAutoSend,onClick:jv},[m("span",dR,$(S(o)("Auto send dictation")),1),m("span",{class:et(["sidebar-settings-toggle",{"is-on":I.value}])},null,2)],8,cR),m("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:S(o)("Choose the API provider for the Codex backend")},[m("span",hR,$(S(o)("Provider")),1),Oe(Lr,{class:"sidebar-settings-provider-dropdown","model-value":Kn.value,options:qs.value,disabled:Jt.value,placeholder:S(o)("Provider"),"open-direction":"up","onUpdate:modelValue":Dv},null,8,["model-value","options","disabled","placeholder"])],8,fR),_n.value?(k(),R("div",pR,$(_n.value),1)):J("",!0),Kn.value==="openrouter"?(k(),R("div",mR,[m("div",vR,[m("span",gR,$(S(o)("OpenRouter API key")),1),m("a",yR,$(S(o)("Get API key")),1)]),m("div",wR,[$e.value&&!pn.value?(k(),R(Ye,{key:0},[m("span",bR,$(_e.value),1),m("button",{class:"sidebar-settings-key-clear",type:"button",disabled:mt.value,title:S(o)("Remove custom key, use community keys"),onClick:Fv},"✕",8,_R)],64)):(k(),R(Ye,{key:1},[tn(m("input",{"onUpdate:modelValue":p[4]||(p[4]=C=>pn.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(o)("sk-or-v1-... (optional, uses free keys if empty)"),onKeydown:mn(yd,["enter"])},null,40,TR),[[un,pn.value]]),m("button",{class:"sidebar-settings-key-save",type:"button",disabled:mt.value||!pn.value.trim(),onClick:yd},$(mt.value?"...":S(o)("Set")),9,kR)],64))]),m("div",CR,[m("span",SR,$(S(o)("API format")),1),m("div",{class:"sidebar-settings-segmented",role:"group","aria-label":S(o)("OpenRouter API format")},[m("button",{type:"button",class:et(["sidebar-settings-segmented-option",{"is-active":Ir.value==="responses"}]),disabled:mt.value||Jt.value,onClick:p[5]||(p[5]=C=>vd("responses"))}," Responses ",10,AR),m("button",{type:"button",class:et(["sidebar-settings-segmented-option",{"is-active":Ir.value==="chat"}]),disabled:mt.value||Jt.value,onClick:p[6]||(p[6]=C=>vd("chat"))}," Completions ",10,ER)],8,xR)])])):J("",!0),Kn.value==="opencode-zen"?(k(),R("div",IR,[m("div",RR,[m("span",PR,$(S(o)("OpenCode Zen API key")),1),m("a",MR,$(S(o)("Get API key")),1)]),m("div",$R,[tn(m("input",{"onUpdate:modelValue":p[7]||(p[7]=C=>Bo.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(o)("sk-..."),onKeydown:mn(gd,["enter"])},null,40,NR),[[un,Bo.value]]),m("button",{class:"sidebar-settings-key-save",type:"button",disabled:mt.value||!Bo.value.trim(),onClick:gd},$(mt.value?"...":S(o)("Save")),9,LR)])])):J("",!0),Kn.value==="custom"?(k(),R("div",OR,[m("span",jR,$(S(o)("Custom endpoint URL")),1),m("div",DR,[tn(m("input",{"onUpdate:modelValue":p[8]||(p[8]=C=>en.value=C),class:"sidebar-settings-key-input",type:"url",placeholder:S(o)("https://api.example.com/v1"),onKeydown:mn(uu,["enter"])},null,40,FR),[[un,en.value]])]),m("span",UR,$(S(o)("API key")),1),m("div",BR,[tn(m("input",{"onUpdate:modelValue":p[9]||(p[9]=C=>Uo.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(o)("Bearer token (optional)"),onKeydown:mn(uu,["enter"])},null,40,qR),[[un,Uo.value]]),m("button",{class:"sidebar-settings-key-save",type:"button",disabled:mt.value||!en.value.trim(),onClick:uu},$(mt.value?"...":S(o)("Save")),9,HR)]),m("div",WR,[m("span",zR,$(S(o)("API format")),1),m("div",{class:"sidebar-settings-segmented",role:"group","aria-label":S(o)("Custom endpoint API format")},[m("button",{type:"button",class:et(["sidebar-settings-segmented-option",{"is-active":no.value==="responses"}]),onClick:p[10]||(p[10]=C=>no.value="responses")}," Responses ",2),m("button",{type:"button",class:et(["sidebar-settings-segmented-option",{"is-active":no.value==="chat"}]),onClick:p[11]||(p[11]=C=>no.value="chat")}," Completions ",2)],8,VR)])])):J("",!0),m("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:g.dictationLanguage},[m("span",KR,$(S(o)("Dictation language")),1),Oe(Lr,{class:"sidebar-settings-language-dropdown","model-value":B.value,options:re.value,placeholder:S(o)("Auto-detect"),"open-direction":"up","enable-search":!0,"search-placeholder":S(o)("Search language..."),"onUpdate:modelValue":Uv},null,8,["model-value","options","placeholder","search-placeholder"])],8,GR),m("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:p[12]||(p[12]=C=>qo.value=!qo.value)},[m("span",YR,$(S(o)("Telegram")),1),m("span",QR,$(Di.value),1)]),qo.value?(k(),R("div",JR,[m("label",XR,[m("span",ZR,$(S(o)("Bot token")),1),tn(m("input",{"onUpdate:modelValue":p[13]||(p[13]=C=>or.value=C),class:"sidebar-settings-input",type:"password",placeholder:"123456:ABCDEF",autocomplete:"off",spellcheck:"false"},null,512),[[un,or.value]])]),m("label",eP,[m("span",tP,$(S(o)("Allowed Telegram user IDs")),1),tn(m("textarea",{"onUpdate:modelValue":p[14]||(p[14]=C=>Ho.value=C),class:"sidebar-settings-textarea",rows:"3",placeholder:`123456789
|
|
63
|
-
987654321`,spellcheck:"false"},null,512),[[un,Ho.value]])]),m("div",nP,$(S(o)("Put one Telegram user ID per line or separate them with commas. Use `*` to allow all Telegram users. Unauthorized users will see their own ID in the rejection message so they can copy it here.")),1),qr.value?(k(),R("div",rP,$(qr.value),1)):J("",!0),m("div",oP,[m("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:ko.value,onClick:tu},$(ko.value?S(o)("Saving…"):S(o)("Save Telegram config")),9,aP)])])):J("",!0),w.value?(k(),R("div",{key:5,class:"sidebar-settings-row sidebar-settings-context-row","data-state":an.value,title:ga.value},[m("span",iP,$(S(o)("Context")),1),m("span",{class:"sidebar-settings-context-value","data-state":an.value},[ns($(Fn.value)+" ",1),m("span",uP,$(so.value),1)],8,lP)],8,sP)):J("",!0),m("div",cP,[Oe(fA,{snapshots:S(ke)},null,8,["snapshots"])]),m("div",{class:"sidebar-settings-build-label","aria-label":S(o)("Worktree name and version")}," WT "+$(S(h))+" · v"+$(S(f)),9,dP)],512)):J("",!0)]),_:1}),m("button",{ref_key:"settingsButtonRef",ref:to,class:"sidebar-settings-button",type:"button",onClick:p[16]||(p[16]=Xe(C=>jn.value=!jn.value,["stop"]))},[Oe(fE,{class:"sidebar-settings-icon"}),m("span",null,$(S(o)("Settings")),1),m("span",fP,$(S(h))+" · v"+$(S(f)),1)],512)],512))])]),content:ht(()=>[m("section",{class:et(["content-root",{"is-virtual-keyboard-open":Go.value,"is-terminal-open":Mr.value}]),style:oa(Jl.value)},[ao.value?(k(),R("span",hP)):J("",!0),Oe(mC,{title:Oa.value,accent:ir.value},{leading:ht(()=>[rn.value||S(se)?(k(),Ze(ih,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":rn.value,"show-new-thread-button":!0,onToggleSidebar:p[17]||(p[17]=C=>Gr(!rn.value)),onStartNewThread:nu},null,8,["is-sidebar-collapsed"])):J("",!0),ir.value?(k(),R("span",pP,[Oe(pl)])):J("",!0)]),actions:ht(()=>[Ws.value?(k(),Ze(Lr,{key:0,class:et(["content-header-terminal-command",{"is-open":Mr.value}]),"model-value":fa.value,options:Ql.value,placeholder:Qs.value,"selected-prefix-icon":vE,"icon-only":!0,"empty-label":S(o)("No commands"),"onUpdate:modelValue":Vm},null,8,["class","model-value","options","placeholder","empty-label"])):J("",!0),va.value?(k(),Ze(qA,{key:1,class:"content-header-branch-dropdown","current-branch":Ft.value,"head-sha":mr.value,"head-subject":xr.value,"head-date":Ar.value,detached:fn.value,dirty:Ct.value,branches:_o.value,"commits-by-branch":nr.value,"commits-loading-for":Rn.value,"commits-error":Fr.value,loading:gn.value,busy:vr.value,error:yt.value,"review-open":Vn.value,"show-review":S(U).name==="thread"&&S(pe).length>0,onToggleReview:p[18]||(p[18]=C=>Vn.value=!Vn.value),onCheckoutBranch:lv,onResetBranchToCommit:uv,onLoadCommits:cv},null,8,["current-branch","head-sha","head-subject","head-date","detached","dirty","branches","commits-by-branch","commits-loading-for","commits-error","loading","busy","error","review-open","show-review"])):J("",!0)]),_:1},8,["title","accent"]),m("section",mP,[ir.value?(k(),Ze(S(a),{key:0,cwd:y.value,"thread-id":Vr.value,"try-in-flight-key":Zt.value,onSkillsChanged:Xl,onTryItem:Zv},null,8,["cwd","thread-id","try-in-flight-key"])):jt.value?(k(),R("div",vP,[m("div",gP,[m("p",yP,$(S(o)("Let's build")),1),Oe(Lr,{class:"new-thread-folder-dropdown","model-value":ot.value,options:Vs.value,placeholder:S(o)("Choose folder"),"enable-search":!0,"search-placeholder":S(o)("Quick search project"),disabled:!1,"onUpdate:modelValue":av},null,8,["model-value","options","placeholder","search-placeholder"]),ot.value?(k(),R("p",{key:0,class:"new-thread-folder-selected",title:ot.value},$(S(o)("Selected folder"))+": "+$(ot.value),9,wP)):J("",!0),m("div",bP,[m("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:fv},$(S(o)("Select folder")),1),m("button",{class:"new-thread-folder-action",type:"button",onClick:dv},$(S(o)("Create Project")),1)]),Re.value?(k(),R("section",_P,[m("div",TP,[m("div",kP,[m("span",CP,[Oe(pl)]),m("p",SP,$(S(o)("New in Codex")),1)]),m("h2",xP,$(S(o)("Plugins are here")),1),m("p",AP,$(S(o)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),p[29]||(p[29]=m("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[m("span",{class:"new-thread-launch-card-pill"},"Gmail"),m("span",{class:"new-thread-launch-card-pill"},"Calendar"),m("span",{class:"new-thread-launch-card-pill"},"GitHub"),m("span",{class:"new-thread-launch-card-pill"},"Slack"),m("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),m("div",EP,[m("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Cn},$(S(o)("Explore Plugins & Apps")),1),m("button",{class:"new-thread-launch-card-button",type:"button",onClick:Pt},$(S(o)("Dismiss")),1)])])):J("",!0),(k(),Ze(Qa,{to:"body"},[Rr.value?(k(),R("div",{key:0,class:"new-thread-open-folder-overlay",onClick:Xe(hs,["self"])},[m("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":S(o)("Select folder"),onKeydown:mn(Xe(hs,["prevent"]),["esc"])},[m("div",RP,[m("p",PP,$(S(o)("Select folder")),1),m("button",{class:"new-thread-open-folder-close",type:"button",onClick:hs},$(S(o)("Cancel")),1)]),m("p",MP,$(S(o)("Current folder")),1),m("div",$P,[tn(m("input",{ref_key:"existingFolderPathInputRef",ref:rs,"onUpdate:modelValue":p[19]||(p[19]=C=>Pr.value=C),class:"new-thread-open-folder-path",type:"text",placeholder:S(o)("Current folder"),title:Pr.value||S(o)("Unavailable"),disabled:$n.value||ar.value,onBlur:vv,onKeydown:[mn(Xe(gv,["prevent"]),["enter"]),mn(Xe(hs,["prevent"]),["esc"])]},null,40,NP),[[un,Pr.value]]),m("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!Da.value||$n.value||ar.value,onClick:p[20]||(p[20]=C=>au())},$(ar.value?S(o)("Opening…"):S(o)("Open")),9,LP)]),m("div",OP,[m("label",jP,[tn(m("input",{"onUpdate:modelValue":p[21]||(p[21]=C=>ha.value=C),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:pv},null,544),[[Sw,ha.value]]),m("span",null,$(S(o)("Show hidden folders")),1)]),m("button",{class:et(["new-thread-folder-action",{"new-thread-folder-action-primary":br.value}]),type:"button","aria-pressed":br.value,disabled:!Yn.value||$n.value||ar.value||Hr.value||!!kn.value&&!br.value,onClick:yv},$(S(o)("New folder")),11,DP)]),br.value?(k(),R("div",FP,[m("div",UP,[tn(m("input",{ref_key:"createFolderInputRef",ref:To,"onUpdate:modelValue":p[22]||(p[22]=C=>Co.value=C),class:"new-thread-open-folder-create-input",type:"text",placeholder:S(o)("Folder name"),onKeydown:[mn(Xe(ud,["prevent"]),["enter"]),mn(Xe(ni,["prevent"]),["esc"])]},null,40,BP),[[un,Co.value]]),m("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!Gl.value||Hr.value,onClick:ud},$(cs.value),9,qP)]),Tn.value?(k(),R("p",HP,$(Tn.value),1)):J("",!0)])):J("",!0),tn(m("input",{ref_key:"existingFolderFilterInputRef",ref:os,"onUpdate:modelValue":p[23]||(p[23]=C=>_r.value=C),class:"new-thread-open-folder-filter",type:"text",placeholder:S(o)("Filter folders..."),onKeydown:mn(Xe(hs,["prevent"]),["esc"])},null,40,WP),[[un,_r.value]]),kn.value?(k(),R("div",zP,[m("p",VP,$(kn.value),1),m("button",{class:"new-thread-folder-action",type:"button",disabled:$n.value||ar.value,onClick:mv},$(S(o)("Retry")),9,GP)])):J("",!0),$n.value?(k(),R("p",KP,$(S(o)("Loading folders…")),1)):!kn.value&&Ys.value.length===0?(k(),R("p",YP,$(_r.value.trim()?S(o)("No folders match this filter."):S(o)("No subfolders found here.")),1)):Ys.value.length>0?(k(),R("ul",QP,[(k(!0),R(Ye,null,Kt(Ys.value,C=>(k(),R("li",{key:C.key,class:"new-thread-open-folder-item"},[m("button",{class:"new-thread-open-folder-item-main",type:"button",title:C.path,disabled:$n.value||ar.value,onClick:V=>hv(C.path)},[m("span",XP,$(C.name),1)],8,JP),C.kind==="directory"?(k(),R("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:$n.value||ar.value,onClick:V=>au(C.path)},$(S(o)("Open")),9,ZP)):J("",!0)]))),128))])):J("",!0)],40,IP)])):J("",!0)])),Ao.value?(k(),Ze(GA,{key:2,class:"new-thread-runtime-dropdown",modelValue:cn.value,"onUpdate:modelValue":p[24]||(p[24]=C=>cn.value=C)},null,8,["modelValue"])):J("",!0),cn.value==="worktree"?(k(),R("div",eM,[m("p",tM,$(S(o)("Base branch")),1),Oe(Lr,{class:"new-thread-branch-dropdown","model-value":nn.value,options:Gs.value,placeholder:S(o)("Select branch"),"enable-search":!0,"search-placeholder":S(o)("Search branches..."),disabled:Zr.value||Gs.value.length===0,"onUpdate:modelValue":sv},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),m("p",nM,$(Zr.value?S(o)("Loading branches…"):ls.value?S(o)("New worktree branch will start from {branch}.",{branch:ls.value}):S(o)("No Git branches found for this folder.")),1)])):J("",!0),Ao.value?(k(),R("p",rM,$(S(o)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):J("",!0),Dt.value.phase!=="idle"?(k(),R("div",{key:5,class:et(["worktree-init-status",{"is-running":Dt.value.phase==="running","is-error":Dt.value.phase==="error"}])},[m("strong",oM,$(Dt.value.title),1),m("span",aM,$(Dt.value.message),1)],2)):J("",!0)]),m("div",sM,[Wt.value&&qt.value?(k(),Ze(S(n),{key:0,ref_key:"homeTerminalPanelRef",ref:xt,class:"content-thread-terminal-panel","thread-id":xo.value,cwd:qt.value,onHide:Zm,onTerminalFocusChange:nd},null,8,["thread-id","cwd"])):J("",!0),Oe(sh,{ref_key:"homeThreadComposerRef",ref:Ce,"active-thread-id":xo.value,cwd:qt.value,"collaboration-modes":S(de),"selected-collaboration-mode":S(G),models:S(Pe),"selected-model":Vo.value,"selected-reasoning-effort":S(ve),"selected-speed-mode":S(Te),"is-updating-speed-mode":S(tt),skills:S(oe),"thread-token-usage":S(D),"codex-quota":S(be),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":yr.value,"in-progress-submit-mode":Br.value,"dictation-click-to-toggle":Mn.value,"dictation-auto-send":I.value,"dictation-language":B.value,onSubmit:id,"onUpdate:selectedCollaborationMode":wd,"onUpdate:selectedModel":hd,"onUpdate:selectedReasoningEffort":pd,"onUpdate:selectedSpeedMode":md},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language"])])])):(k(),R("div",iM,[Vn.value&&S(pe)&&qt.value?(k(),Ze(S(r),{key:0,"thread-id":S(pe),cwd:qt.value,"is-thread-in-progress":b.value,onClose:p[25]||(p[25]=C=>Vn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress"])):(k(),R(Ye,{key:1},[m("div",lM,[Oe(S(t),{ref_key:"threadConversationRef",ref:ze,messages:ma.value,"is-loading":S(Ke),"active-thread-id":xo.value,cwd:qt.value,"live-overlay":ss.value,"pending-requests":S(K),onForkThread:zm,onRollback:kv,onImplementPlan:Cv,onRespondServerRequest:Qc},null,8,["messages","is-loading","active-thread-id","cwd","live-overlay","pending-requests"])]),m("div",uM,[Oe(rA,{messages:S(z),onEdit:ov,onSteer:S(le),onDelete:S(ae),onReorder:_v},null,8,["messages","onSteer","onDelete"]),S(j)&&S(pe)&&qt.value?(k(),Ze(S(n),{key:0,ref_key:"threadTerminalPanelRef",ref:Bt,class:"content-thread-terminal-panel","thread-id":S(pe),cwd:qt.value,onHide:ev,onTerminalFocusChange:nd},null,8,["thread-id","cwd"])):J("",!0),is.value?(k(),Ze(Vx,{key:1,request:is.value,"request-count":S(K).length,"has-queue-above":S(z).length>0,onRespondServerRequest:Qc},null,8,["request","request-count","has-queue-above"])):(k(),Ze(sh,{key:2,ref_key:"threadComposerRef",ref:Ne,"active-thread-id":xo.value,cwd:qt.value,"collaboration-modes":S(de),"selected-collaboration-mode":S(G),models:S(Pe),"selected-model":Vo.value,"selected-reasoning-effort":S(ve),"selected-speed-mode":S(Te),"is-updating-speed-mode":S(tt),skills:S(oe),"thread-token-usage":S(D),"codex-quota":S(be),"is-turn-in-progress":b.value,"is-stop-pending":S(Qe),"is-interrupting-turn":S(Se),"has-queue-above":S(z).length>0,"send-with-enter":yr.value,"in-progress-submit-mode":Br.value,"dictation-click-to-toggle":Mn.value,"dictation-auto-send":I.value,"dictation-language":B.value,"onUpdate:selectedCollaborationMode":wd,onSubmit:id,"onUpdate:selectedModel":hd,"onUpdate:selectedReasoningEffort":pd,"onUpdate:selectedSpeedMode":md,onInterrupt:Tv},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","is-turn-in-progress","is-stop-pending","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language"]))])],64))]))])],6)]),_:1},8,["is-sidebar-collapsed"]),Ur.value?(k(),R("div",{key:0,class:"codex-login-modal-backdrop",role:"presentation",onClick:fs},[m("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":S(o)("Complete Codex login"),onSubmit:Xe(qi,["prevent"]),onClick:p[28]||(p[28]=Xe(()=>{},["stop"]))},[m("div",dM,[m("h2",fM,$(S(o)("Complete Codex login")),1),m("button",{class:"codex-login-modal-close",type:"button","aria-label":S(o)("Close"),disabled:Qt.value,onClick:fs}," × ",8,hM)]),m("p",pM,$(S(o)("Finish login in the browser, then paste the localhost callback URL here.")),1),gr.value?(k(),R("a",{key:0,class:"codex-login-modal-link",href:gr.value,target:"_blank",rel:"noreferrer"},$(S(o)("Open login URL")),9,mM)):J("",!0),tn(m("input",{ref_key:"codexLoginCallbackInputRef",ref:Er,"onUpdate:modelValue":p[27]||(p[27]=C=>yn.value=C),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:S(o)("Paste localhost callback URL"),disabled:Qt.value},null,8,vM),[[un,yn.value]]),Vt.value?(k(),R("p",gM,$(Vt.value),1)):J("",!0),m("div",yM,[m("button",{class:"codex-login-modal-cancel",type:"button",disabled:Qt.value,onClick:fs},$(S(o)("Cancel")),9,wM),m("button",{class:"codex-login-modal-submit",type:"submit",disabled:Qt.value||yn.value.trim().length===0},$(Qt.value?S(o)("Completing…"):S(o)("Complete")),9,bM)])],40,cM)])):J("",!0)],64))}}),kM=It(TM,[["__scopeId","data-v-26a47e33"]]),Wu={render:()=>null},CM=Hb({history:_b(),routes:[{path:"/",name:"home",component:Wu},{path:"/thread/:threadId",name:"thread",component:Wu},{path:"/skills",name:"skills",component:Wu},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. github: https://github.com/friuns2/codexUI");Mw(kM).use(CM).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(bm("Service worker registration failed."),e)})});export{AM as $,Ze as A,Lc as B,V0 as C,IM as D,EM as E,Ye as F,RM as G,Y0 as H,Fs as I,Ma as J,PM as K,Lr as L,KM as M,QM as N,JM as O,xM as P,YM as Q,Gc as R,Qa as S,Hp as T,tn as U,un as V,di as W,Lo as X,zb as Y,Wb as Z,It as _,m as a,MM as a0,jM as a1,qM as a2,HM as a3,$M as a4,BM as a5,WM as a6,VM as a7,GM as a8,NM as a9,LM as aa,OM as ab,DM as ac,UM as ad,FM as ae,zM as af,ca as b,R as c,Hn as d,Pa as e,J as f,et as g,SM as h,Oe as i,Cs as j,_C as k,bE as l,Xe as m,Xt as n,k as o,oa as p,S as q,Kt as r,ns as s,$ as t,Wc as u,ht as v,pt as w,A as x,ne as y,nl as z};
|