@nervmor/codexui 1.0.3 → 1.0.5
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/index-BQpi2jbn.css +1 -0
- package/dist/assets/index-CNfDYn0C.js +1455 -0
- package/dist/index.html +2 -2
- package/dist-cli/index.js +462 -46
- package/dist-cli/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/assets/index-BRHjQaZ8.css +0 -1
- package/dist/assets/index-C2tfimEi.js +0 -1441
|
@@ -0,0 +1,1455 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();/**
|
|
2
|
+
* @vue/shared v3.5.30
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/function yl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Lt={},qs=[],Sr=()=>{},dd=()=>!1,Oi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),wl=e=>e.startsWith("onUpdate:"),tn=Object.assign,bl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Jh=Object.prototype.hasOwnProperty,Ct=(e,t)=>Jh.call(e,t),Xe=Array.isArray,Gs=e=>Vo(e)==="[object Map]",fd=e=>Vo(e)==="[object Set]",rc=e=>Vo(e)==="[object Date]",nt=e=>typeof e=="function",Gt=e=>typeof e=="string",lr=e=>typeof e=="symbol",At=e=>e!==null&&typeof e=="object",hd=e=>(At(e)||nt(e))&&nt(e.then)&&nt(e.catch),pd=Object.prototype.toString,Vo=e=>pd.call(e),Yh=e=>Vo(e).slice(8,-1),md=e=>Vo(e)==="[object Object]",_l=e=>Gt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,wo=yl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ni=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Qh=/-\w/g,Rn=Ni(e=>e.replace(Qh,t=>t.slice(1).toUpperCase())),Xh=/\B([A-Z])/g,hs=Ni(e=>e.replace(Xh,"-$1").toLowerCase()),Li=Ni(e=>e.charAt(0).toUpperCase()+e.slice(1)),Zi=Ni(e=>e?`on${Li(e)}`:""),br=(e,t)=>!Object.is(e,t),ci=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},gd=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},kl=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Zh=e=>{const t=Gt(e)?Number(e):NaN;return isNaN(t)?e:t};let sc;const Di=()=>sc||(sc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function cs(e){if(Xe(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Gt(r)?rp(r):cs(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(Gt(e)||At(e))return e}const ep=/;(?![^(]*\))/g,tp=/:([^]+)/,np=/\/\*[^]*?\*\//g;function rp(e){const t={};return e.replace(np,"").split(ep).forEach(n=>{if(n){const r=n.split(tp);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function tt(e){let t="";if(Gt(e))t=e;else if(Xe(e))for(let n=0;n<e.length;n++){const r=tt(e[n]);r&&(t+=r+" ")}else if(At(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const sp="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",op=yl(sp);function vd(e){return!!e||e===""}function ip(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Tl(e[r],t[r]);return n}function Tl(e,t){if(e===t)return!0;let n=rc(e),r=rc(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=lr(e),r=lr(t),n||r)return e===t;if(n=Xe(e),r=Xe(t),n||r)return n&&r?ip(e,t):!1;if(n=At(e),r=At(t),n||r){if(!n||!r)return!1;const s=Object.keys(e).length,o=Object.keys(t).length;if(s!==o)return!1;for(const i in e){const a=e.hasOwnProperty(i),l=t.hasOwnProperty(i);if(a&&!l||!a&&l||!Tl(e[i],t[i]))return!1}}return String(e)===String(t)}const yd=e=>!!(e&&e.__v_isRef===!0),G=e=>Gt(e)?e:e==null?"":Xe(e)||At(e)&&(e.toString===pd||!nt(e.toString))?yd(e)?G(e.value):JSON.stringify(e,wd,2):String(e),wd=(e,t)=>yd(t)?wd(e,t.value):Gs(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[ea(r,o)+" =>"]=s,n),{})}:fd(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ea(n))}:lr(t)?ea(t):At(t)&&!Xe(t)&&!md(t)?String(t):t,ea=(e,t="")=>{var n;return lr(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
|
|
6
|
+
* @vue/reactivity v3.5.30
|
|
7
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
8
|
+
* @license MIT
|
|
9
|
+
**/let Fn;class ap{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=Fn,!t&&Fn&&(this.index=(Fn.scopes||(Fn.scopes=[])).push(this)-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=Fn;try{return Fn=this,t()}finally{Fn=n}}}on(){++this._on===1&&(this.prevScope=Fn,Fn=this)}off(){this._on>0&&--this._on===0&&(Fn=this.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 s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function lp(){return Fn}let Ft;const ta=new WeakSet;class bd{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,Fn&&Fn.active&&Fn.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ta.has(this)&&(ta.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||kd(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,oc(this),Td(this);const t=Ft,n=or;Ft=this,or=!0;try{return this.fn()}finally{Sd(this),Ft=t,or=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)El(t);this.deps=this.depsTail=void 0,oc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ta.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Da(this)&&this.run()}get dirty(){return Da(this)}}let _d=0,bo,_o;function kd(e,t=!1){if(e.flags|=8,t){e.next=_o,_o=e;return}e.next=bo,bo=e}function Sl(){_d++}function Il(){if(--_d>0)return;if(_o){let t=_o;for(_o=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;bo;){let t=bo;for(bo=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 Td(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Sd(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),El(r),cp(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Da(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Id(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Id(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ro)||(e.globalVersion=Ro,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Da(e))))return;e.flags|=2;const t=e.dep,n=Ft,r=or;Ft=e,or=!0;try{Td(e);const s=e.fn(e._value);(t.version===0||br(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Ft=n,or=r,Sd(e),e.flags&=-3}}function El(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.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)El(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function cp(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let or=!0;const Ed=[];function Fr(){Ed.push(or),or=!1}function Br(){const e=Ed.pop();or=e===void 0?!0:e}function oc(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ft;Ft=void 0;try{t()}finally{Ft=n}}}let Ro=0;class up{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 Cl{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(!Ft||!or||Ft===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ft)n=this.activeLink=new up(Ft,this),Ft.deps?(n.prevDep=Ft.depsTail,Ft.depsTail.nextDep=n,Ft.depsTail=n):Ft.deps=Ft.depsTail=n,Cd(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=Ft.depsTail,n.nextDep=void 0,Ft.depsTail.nextDep=n,Ft.depsTail=n,Ft.deps===n&&(Ft.deps=r)}return n}trigger(t){this.version++,Ro++,this.notify(t)}notify(t){Sl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Il()}}}function Cd(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)Cd(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const ja=new WeakMap,Ms=Symbol(""),Fa=Symbol(""),Po=Symbol("");function yn(e,t,n){if(or&&Ft){let r=ja.get(e);r||ja.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new Cl),s.map=r,s.key=n),s.track()}}function Or(e,t,n,r,s,o){const i=ja.get(e);if(!i){Ro++;return}const a=l=>{l&&l.trigger()};if(Sl(),t==="clear")i.forEach(a);else{const l=Xe(e),f=l&&_l(n);if(l&&n==="length"){const u=Number(r);i.forEach((g,_)=>{(_==="length"||_===Po||!lr(_)&&_>=u)&&a(g)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),f&&a(i.get(Po)),t){case"add":l?f&&a(i.get("length")):(a(i.get(Ms)),Gs(e)&&a(i.get(Fa)));break;case"delete":l||(a(i.get(Ms)),Gs(e)&&a(i.get(Fa)));break;case"set":Gs(e)&&a(i.get(Ms));break}}Il()}function Fs(e){const t=Tt(e);return t===e?t:(yn(t,"iterate",Po),Xn(e)?t:t.map(cr))}function ji(e){return yn(e=Tt(e),"iterate",Po),e}function yr(e,t){return Ur(e)?to($s(e)?cr(t):t):cr(t)}const dp={__proto__:null,[Symbol.iterator](){return na(this,Symbol.iterator,e=>yr(this,e))},concat(...e){return Fs(this).concat(...e.map(t=>Xe(t)?Fs(t):t))},entries(){return na(this,"entries",e=>(e[1]=yr(this,e[1]),e))},every(e,t){return xr(this,"every",e,t,void 0,arguments)},filter(e,t){return xr(this,"filter",e,t,n=>n.map(r=>yr(this,r)),arguments)},find(e,t){return xr(this,"find",e,t,n=>yr(this,n),arguments)},findIndex(e,t){return xr(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return xr(this,"findLast",e,t,n=>yr(this,n),arguments)},findLastIndex(e,t){return xr(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return xr(this,"forEach",e,t,void 0,arguments)},includes(...e){return ra(this,"includes",e)},indexOf(...e){return ra(this,"indexOf",e)},join(e){return Fs(this).join(e)},lastIndexOf(...e){return ra(this,"lastIndexOf",e)},map(e,t){return xr(this,"map",e,t,void 0,arguments)},pop(){return fo(this,"pop")},push(...e){return fo(this,"push",e)},reduce(e,...t){return ic(this,"reduce",e,t)},reduceRight(e,...t){return ic(this,"reduceRight",e,t)},shift(){return fo(this,"shift")},some(e,t){return xr(this,"some",e,t,void 0,arguments)},splice(...e){return fo(this,"splice",e)},toReversed(){return Fs(this).toReversed()},toSorted(e){return Fs(this).toSorted(e)},toSpliced(...e){return Fs(this).toSpliced(...e)},unshift(...e){return fo(this,"unshift",e)},values(){return na(this,"values",e=>yr(this,e))}};function na(e,t,n){const r=ji(e),s=r[t]();return r!==e&&!Xn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const fp=Array.prototype;function xr(e,t,n,r,s,o){const i=ji(e),a=i!==e&&!Xn(e),l=i[t];if(l!==fp[t]){const g=l.apply(e,o);return a?cr(g):g}let f=n;i!==e&&(a?f=function(g,_){return n.call(this,yr(e,g),_,e)}:n.length>2&&(f=function(g,_){return n.call(this,g,_,e)}));const u=l.call(i,f,r);return a&&s?s(u):u}function ic(e,t,n,r){const s=ji(e),o=s!==e&&!Xn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(f,u,g){return a&&(a=!1,f=yr(e,f)),n.call(this,f,yr(e,u),g,e)}):n.length>3&&(i=function(f,u,g){return n.call(this,f,u,g,e)}));const l=s[t](i,...r);return a?yr(e,l):l}function ra(e,t,n){const r=Tt(e);yn(r,"iterate",Po);const s=r[t](...n);return(s===-1||s===!1)&&Rl(n[0])?(n[0]=Tt(n[0]),r[t](...n)):s}function fo(e,t,n=[]){Fr(),Sl();const r=Tt(e)[t].apply(e,n);return Il(),Br(),r}const hp=yl("__proto__,__v_isRef,__isVue"),Ad=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(lr));function pp(e){lr(e)||(e=String(e));const t=Tt(this);return yn(t,"has",e),t.hasOwnProperty(e)}class xd{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(s?o?Sp:$d:o?Md:Pd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Xe(t);if(!s){let l;if(i&&(l=dp[n]))return l;if(n==="hasOwnProperty")return pp}const a=Reflect.get(t,n,_n(t)?t:r);if((lr(n)?Ad.has(n):hp(n))||(s||yn(t,"get",n),o))return a;if(_n(a)){const l=i&&_l(n)?a:a.value;return s&&At(l)?Ua(l):l}return At(a)?s?Ua(a):Fi(a):a}}class Rd extends xd{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Xe(t)&&_l(n);if(!this._isShallow){const f=Ur(o);if(!Xn(r)&&!Ur(r)&&(o=Tt(o),r=Tt(r)),!i&&_n(o)&&!_n(r))return f||(o.value=r),!0}const a=i?Number(n)<t.length:Ct(t,n),l=Reflect.set(t,n,r,_n(t)?t:s);return t===Tt(s)&&(a?br(r,o)&&Or(t,"set",n,r):Or(t,"add",n,r)),l}deleteProperty(t,n){const r=Ct(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Or(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!lr(n)||!Ad.has(n))&&yn(t,"has",n),r}ownKeys(t){return yn(t,"iterate",Xe(t)?"length":Ms),Reflect.ownKeys(t)}}class mp extends xd{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const gp=new Rd,vp=new mp,yp=new Rd(!0);const Ba=e=>e,ei=e=>Reflect.getPrototypeOf(e);function wp(e,t,n){return function(...r){const s=this.__v_raw,o=Tt(s),i=Gs(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,f=s[e](...r),u=n?Ba:t?to:cr;return!t&&yn(o,"iterate",l?Fa:Ms),tn(Object.create(f),{next(){const{value:g,done:_}=f.next();return _?{value:g,done:_}:{value:a?[u(g[0]),u(g[1])]:u(g),done:_}}})}}function ti(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function bp(e,t){const n={get(s){const o=this.__v_raw,i=Tt(o),a=Tt(s);e||(br(s,a)&&yn(i,"get",s),yn(i,"get",a));const{has:l}=ei(i),f=t?Ba:e?to:cr;if(l.call(i,s))return f(o.get(s));if(l.call(i,a))return f(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&yn(Tt(s),"iterate",Ms),s.size},has(s){const o=this.__v_raw,i=Tt(o),a=Tt(s);return e||(br(s,a)&&yn(i,"has",s),yn(i,"has",a)),s===a?o.has(s):o.has(s)||o.has(a)},forEach(s,o){const i=this,a=i.__v_raw,l=Tt(a),f=t?Ba:e?to:cr;return!e&&yn(l,"iterate",Ms),a.forEach((u,g)=>s.call(o,f(u),f(g),i))}};return tn(n,e?{add:ti("add"),set:ti("set"),delete:ti("delete"),clear:ti("clear")}:{add(s){const o=Tt(this),i=ei(o),a=Tt(s),l=!t&&!Xn(s)&&!Ur(s)?a:s;return i.has.call(o,l)||br(s,l)&&i.has.call(o,s)||br(a,l)&&i.has.call(o,a)||(o.add(l),Or(o,"add",l,l)),this},set(s,o){!t&&!Xn(o)&&!Ur(o)&&(o=Tt(o));const i=Tt(this),{has:a,get:l}=ei(i);let f=a.call(i,s);f||(s=Tt(s),f=a.call(i,s));const u=l.call(i,s);return i.set(s,o),f?br(o,u)&&Or(i,"set",s,o):Or(i,"add",s,o),this},delete(s){const o=Tt(this),{has:i,get:a}=ei(o);let l=i.call(o,s);l||(s=Tt(s),l=i.call(o,s)),a&&a.call(o,s);const f=o.delete(s);return l&&Or(o,"delete",s,void 0),f},clear(){const s=Tt(this),o=s.size!==0,i=s.clear();return o&&Or(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=wp(s,e,t)}),n}function Al(e,t){const n=bp(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(Ct(n,s)&&s in r?n:r,s,o)}const _p={get:Al(!1,!1)},kp={get:Al(!1,!0)},Tp={get:Al(!0,!1)};const Pd=new WeakMap,Md=new WeakMap,$d=new WeakMap,Sp=new WeakMap;function Ip(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Ep(e){return e.__v_skip||!Object.isExtensible(e)?0:Ip(Yh(e))}function Fi(e){return Ur(e)?e:xl(e,!1,gp,_p,Pd)}function Od(e){return xl(e,!1,yp,kp,Md)}function Ua(e){return xl(e,!0,vp,Tp,$d)}function xl(e,t,n,r,s){if(!At(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Ep(e);if(o===0)return e;const i=s.get(e);if(i)return i;const a=new Proxy(e,o===2?r:n);return s.set(e,a),a}function $s(e){return Ur(e)?$s(e.__v_raw):!!(e&&e.__v_isReactive)}function Ur(e){return!!(e&&e.__v_isReadonly)}function Xn(e){return!!(e&&e.__v_isShallow)}function Rl(e){return e?!!e.__v_raw:!1}function Tt(e){const t=e&&e.__v_raw;return t?Tt(t):e}function Cp(e){return!Ct(e,"__v_skip")&&Object.isExtensible(e)&&gd(e,"__v_skip",!0),e}const cr=e=>At(e)?Fi(e):e,to=e=>At(e)?Ua(e):e;function _n(e){return e?e.__v_isRef===!0:!1}function D(e){return Nd(e,!1)}function Ap(e){return Nd(e,!0)}function Nd(e,t){return _n(e)?e:new xp(e,t)}class xp{constructor(t,n){this.dep=new Cl,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Tt(t),this._value=n?t:cr(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||Xn(t)||Ur(t);t=r?t:Tt(t),br(t,n)&&(this._rawValue=t,this._value=r?t:cr(t),this.dep.trigger())}}function be(e){return _n(e)?e.value:e}const Rp={get:(e,t,n)=>t==="__v_raw"?e:be(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return _n(s)&&!_n(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Ld(e){return $s(e)?e:new Proxy(e,Rp)}class Pp{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Cl(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ro-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Ft!==this)return kd(this,!0),!0}get value(){const t=this.dep.track();return Id(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Mp(e,t,n=!1){let r,s;return nt(e)?r=e:(r=e.get,s=e.set),new Pp(r,s,n)}const ni={},wi=new WeakMap;let Es;function $p(e,t=!1,n=Es){if(n){let r=wi.get(n);r||wi.set(n,r=[]),r.push(e)}}function Op(e,t,n=Lt){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,f=te=>s?te:Xn(te)||s===!1||s===0?Nr(te,1):Nr(te);let u,g,_,I,F=!1,$=!1;if(_n(e)?(g=()=>e.value,F=Xn(e)):$s(e)?(g=()=>f(e),F=!0):Xe(e)?($=!0,F=e.some(te=>$s(te)||Xn(te)),g=()=>e.map(te=>{if(_n(te))return te.value;if($s(te))return f(te);if(nt(te))return l?l(te,2):te()})):nt(e)?t?g=l?()=>l(e,2):e:g=()=>{if(_){Fr();try{_()}finally{Br()}}const te=Es;Es=u;try{return l?l(e,3,[I]):e(I)}finally{Es=te}}:g=Sr,t&&s){const te=g,Te=s===!0?1/0:s;g=()=>Nr(te(),Te)}const Q=lp(),ae=()=>{u.stop(),Q&&Q.active&&bl(Q.effects,u)};if(o&&t){const te=t;t=(...Te)=>{te(...Te),ae()}}let q=$?new Array(e.length).fill(ni):ni;const ee=te=>{if(!(!(u.flags&1)||!u.dirty&&!te))if(t){const Te=u.run();if(s||F||($?Te.some((ve,ye)=>br(ve,q[ye])):br(Te,q))){_&&_();const ve=Es;Es=u;try{const ye=[Te,q===ni?void 0:$&&q[0]===ni?[]:q,I];q=Te,l?l(t,3,ye):t(...ye)}finally{Es=ve}}}else u.run()};return a&&a(ee),u=new bd(g),u.scheduler=i?()=>i(ee,!1):ee,I=te=>$p(te,!1,u),_=u.onStop=()=>{const te=wi.get(u);if(te){if(l)l(te,4);else for(const Te of te)Te();wi.delete(u)}},t?r?ee(!0):q=u.run():i?i(ee.bind(null,!0),!0):u.run(),ae.pause=u.pause.bind(u),ae.resume=u.resume.bind(u),ae.stop=ae,ae}function Nr(e,t=1/0,n){if(t<=0||!At(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,_n(e))Nr(e.value,t,n);else if(Xe(e))for(let r=0;r<e.length;r++)Nr(e[r],t,n);else if(fd(e)||Gs(e))e.forEach(r=>{Nr(r,t,n)});else if(md(e)){for(const r in e)Nr(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Nr(e[r],t,n)}return e}/**
|
|
10
|
+
* @vue/runtime-core v3.5.30
|
|
11
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
12
|
+
* @license MIT
|
|
13
|
+
**/function zo(e,t,n,r){try{return r?e(...r):e()}catch(s){Bi(s,t,n)}}function ur(e,t,n,r){if(nt(e)){const s=zo(e,t,n,r);return s&&hd(s)&&s.catch(o=>{Bi(o,t,n)}),s}if(Xe(e)){const s=[];for(let o=0;o<e.length;o++)s.push(ur(e[o],t,n,r));return s}}function Bi(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Lt;if(t){let a=t.parent;const l=t.proxy,f=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let g=0;g<u.length;g++)if(u[g](e,l,f)===!1)return}a=a.parent}if(o){Fr(),zo(o,null,10,[e,l,f]),Br();return}}Np(e,n,s,r,i)}function Np(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const An=[];let gr=-1;const Ks=[];let rs=null,Ws=0;const Dd=Promise.resolve();let bi=null;function en(e){const t=bi||Dd;return e?t.then(this?e.bind(this):e):t}function Lp(e){let t=gr+1,n=An.length;for(;t<n;){const r=t+n>>>1,s=An[r],o=Mo(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function Pl(e){if(!(e.flags&1)){const t=Mo(e),n=An[An.length-1];!n||!(e.flags&2)&&t>=Mo(n)?An.push(e):An.splice(Lp(t),0,e),e.flags|=1,jd()}}function jd(){bi||(bi=Dd.then(Bd))}function Dp(e){Xe(e)?Ks.push(...e):rs&&e.id===-1?rs.splice(Ws+1,0,e):e.flags&1||(Ks.push(e),e.flags|=1),jd()}function ac(e,t,n=gr+1){for(;n<An.length;n++){const r=An[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;An.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Fd(e){if(Ks.length){const t=[...new Set(Ks)].sort((n,r)=>Mo(n)-Mo(r));if(Ks.length=0,rs){rs.push(...t);return}for(rs=t,Ws=0;Ws<rs.length;Ws++){const n=rs[Ws];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}rs=null,Ws=0}}const Mo=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Bd(e){try{for(gr=0;gr<An.length;gr++){const t=An[gr];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),zo(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;gr<An.length;gr++){const t=An[gr];t&&(t.flags&=-2)}gr=-1,An.length=0,Fd(),bi=null,(An.length||Ks.length)&&Bd()}}let pn=null,Ud=null;function _i(e){const t=pn;return pn=e,Ud=e&&e.type.__scopeId||null,t}function It(e,t=pn,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Ii(-1);const o=_i(t);let i;try{i=e(...s)}finally{_i(o),r._d&&Ii(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Hr(e,t){if(pn===null)return e;const n=qi(pn),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=Lt]=t[s];o&&(nt(o)&&(o={mounted:o,updated:o}),o.deep&&Nr(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function _s(e,t,n,r){const s=e.dirs,o=t&&t.dirs;for(let i=0;i<s.length;i++){const a=s[i];o&&(a.oldValue=o[i].value);let l=a.dir[r];l&&(Fr(),ur(l,n,8,[e.el,a,e,t]),Br())}}function ui(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 ir(e,t,n=!1){const r=Ll();if(r||Ys){let s=Ys?Ys._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(s&&e in s)return s[e];if(arguments.length>1)return n&&nt(t)?t.call(r&&r.proxy):t}}const jp=Symbol.for("v-scx"),Fp=()=>ir(jp);function ht(e,t,n){return Hd(e,t,n)}function Hd(e,t,n=Lt){const{immediate:r,deep:s,flush:o,once:i}=n,a=tn({},n),l=t&&r||!t&&o!=="post";let f;if(Do){if(o==="sync"){const I=Fp();f=I.__watcherHandles||(I.__watcherHandles=[])}else if(!l){const I=()=>{};return I.stop=Sr,I.resume=Sr,I.pause=Sr,I}}const u=bn;a.call=(I,F,$)=>ur(I,u,F,$);let g=!1;o==="post"?a.scheduler=I=>{vn(I,u&&u.suspense)}:o!=="sync"&&(g=!0,a.scheduler=(I,F)=>{F?I():Pl(I)}),a.augmentJob=I=>{t&&(I.flags|=4),g&&(I.flags|=2,u&&(I.id=u.uid,I.i=u))};const _=Op(e,t,a);return Do&&(f?f.push(_):l&&_()),_}function Bp(e,t,n){const r=this.proxy,s=Gt(e)?e.includes(".")?Wd(r,e):()=>r[e]:e.bind(r,r);let o;nt(t)?o=t:(o=t.handler,n=t);const i=qo(this),a=Hd(s,o.bind(r),n);return i(),a}function Wd(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;s<n.length&&r;s++)r=r[n[s]];return r}}const Vd=Symbol("_vte"),zd=e=>e.__isTeleport,ko=e=>e&&(e.disabled||e.disabled===""),lc=e=>e&&(e.defer||e.defer===""),cc=e=>typeof SVGElement<"u"&&e instanceof SVGElement,uc=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Ha=(e,t)=>{const n=e&&e.to;return Gt(n)?t?t(n):null:n},qd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,f){const{mc:u,pc:g,pbc:_,o:{insert:I,querySelector:F,createText:$,createComment:Q}}=f,ae=ko(t.props);let{shapeFlag:q,children:ee,dynamicChildren:te}=t;if(e==null){const Te=t.el=$(""),ve=t.anchor=$("");I(Te,n,r),I(ve,n,r);const ye=(le,re)=>{q&16&&u(ee,le,re,s,o,i,a,l)},Le=()=>{const le=t.target=Ha(t.props,F),re=Wa(le,t,$,I);le&&(i!=="svg"&&cc(le)?i="svg":i!=="mathml"&&uc(le)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(le),ae||(ye(le,re),di(t,!1)))};ae&&(ye(n,ve),di(t,!0)),lc(t.props)?(t.el.__isMounted=!1,vn(()=>{Le(),delete t.el.__isMounted},o)):Le()}else{if(lc(t.props)&&e.el.__isMounted===!1){vn(()=>{qd.process(e,t,n,r,s,o,i,a,l,f)},o);return}t.el=e.el,t.targetStart=e.targetStart;const Te=t.anchor=e.anchor,ve=t.target=e.target,ye=t.targetAnchor=e.targetAnchor,Le=ko(e.props),le=Le?n:ve,re=Le?Te:ye;if(i==="svg"||cc(ve)?i="svg":(i==="mathml"||uc(ve))&&(i="mathml"),te?(_(e.dynamicChildren,te,le,s,o,i,a),Ol(e,t,!0)):l||g(e,t,le,re,s,o,i,a,!1),ae)Le?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):ri(t,n,Te,f,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ce=t.target=Ha(t.props,F);ce&&ri(t,ce,null,f,0)}else Le&&ri(t,ve,ye,f,1);di(t,ae)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:f,targetAnchor:u,target:g,props:_}=e;if(g&&(s(f),s(u)),o&&s(l),i&16){const I=o||!ko(_);for(let F=0;F<a.length;F++){const $=a[F];r($,t,n,I,!!$.dynamicChildren)}}},move:ri,hydrate:Up};function ri(e,t,n,{o:{insert:r},m:s},o=2){o===0&&r(e.targetAnchor,t,n);const{el:i,anchor:a,shapeFlag:l,children:f,props:u}=e,g=o===2;if(g&&r(i,t,n),(!g||ko(u))&&l&16)for(let _=0;_<f.length;_++)s(f[_],t,n,2);g&&r(a,t,n)}function Up(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:f,createText:u}},g){function _(Q,ae){let q=ae;for(;q;){if(q&&q.nodeType===8){if(q.data==="teleport start anchor")t.targetStart=q;else if(q.data==="teleport anchor"){t.targetAnchor=q,Q._lpa=t.targetAnchor&&i(t.targetAnchor);break}}q=i(q)}}function I(Q,ae){ae.anchor=g(i(Q),ae,a(Q),n,r,s,o)}const F=t.target=Ha(t.props,l),$=ko(t.props);if(F){const Q=F._lpa||F.firstChild;t.shapeFlag&16&&($?(I(e,t),_(F,Q),t.targetAnchor||Wa(F,t,u,f,a(e)===F?e:null)):(t.anchor=i(e),_(F,Q),t.targetAnchor||Wa(F,t,u,f),g(Q&&i(Q),t,F,n,r,s,o))),di(t,$)}else $&&t.shapeFlag&16&&(I(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const To=qd;function di(e,t){const n=e.ctx;if(n&&n.ut){let r,s;for(t?(r=e.el,s=e.anchor):(r=e.targetStart,s=e.targetAnchor);r&&r!==s;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Wa(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[Vd]=i,e&&(r(o,e,s),r(i,e,s)),i}const vr=Symbol("_leaveCb"),ho=Symbol("_enterCb");function Hp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Gr(()=>{e.isMounted=!0}),Kr(()=>{e.isUnmounting=!0}),e}const Yn=[Function,Array],Gd={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Yn,onEnter:Yn,onAfterEnter:Yn,onEnterCancelled:Yn,onBeforeLeave:Yn,onLeave:Yn,onAfterLeave:Yn,onLeaveCancelled:Yn,onBeforeAppear:Yn,onAppear:Yn,onAfterAppear:Yn,onAppearCancelled:Yn},Kd=e=>{const t=e.subTree;return t.component?Kd(t.component):t},Wp={name:"BaseTransition",props:Gd,setup(e,{slots:t}){const n=Ll(),r=Hp();return()=>{const s=t.default&&Qd(t.default(),!0);if(!s||!s.length)return;const o=Jd(s),i=Tt(e),{mode:a}=i;if(r.isLeaving)return sa(o);const l=dc(o);if(!l)return sa(o);let f=Va(l,i,r,n,g=>f=g);l.type!==wn&&$o(l,f);let u=n.subTree&&dc(n.subTree);if(u&&u.type!==wn&&!As(u,l)&&Kd(n).type!==wn){let g=Va(u,i,r,n);if($o(u,g),a==="out-in"&&l.type!==wn)return r.isLeaving=!0,g.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete g.afterLeave,u=void 0},sa(o);a==="in-out"&&l.type!==wn?g.delayLeave=(_,I,F)=>{const $=Yd(r,u);$[String(u.key)]=u,_[vr]=()=>{I(),_[vr]=void 0,delete f.delayedLeave,u=void 0},f.delayedLeave=()=>{F(),delete f.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return o}}};function Jd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==wn){t=n;break}}return t}const Vp=Wp;function Yd(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 Va(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:f,onAfterEnter:u,onEnterCancelled:g,onBeforeLeave:_,onLeave:I,onAfterLeave:F,onLeaveCancelled:$,onBeforeAppear:Q,onAppear:ae,onAfterAppear:q,onAppearCancelled:ee}=t,te=String(e.key),Te=Yd(n,e),ve=(le,re)=>{le&&ur(le,r,9,re)},ye=(le,re)=>{const ce=re[1];ve(le,re),Xe(le)?le.every(ne=>ne.length<=1)&&ce():le.length<=1&&ce()},Le={mode:i,persisted:a,beforeEnter(le){let re=l;if(!n.isMounted)if(o)re=Q||l;else return;le[vr]&&le[vr](!0);const ce=Te[te];ce&&As(e,ce)&&ce.el[vr]&&ce.el[vr](),ve(re,[le])},enter(le){if(Te[te]===e)return;let re=f,ce=u,ne=g;if(!n.isMounted)if(o)re=ae||f,ce=q||u,ne=ee||g;else return;let Pe=!1;le[ho]=Ge=>{Pe||(Pe=!0,Ge?ve(ne,[le]):ve(ce,[le]),Le.delayedLeave&&Le.delayedLeave(),le[ho]=void 0)};const Ye=le[ho].bind(null,!1);re?ye(re,[le,Ye]):Ye()},leave(le,re){const ce=String(e.key);if(le[ho]&&le[ho](!0),n.isUnmounting)return re();ve(_,[le]);let ne=!1;le[vr]=Ye=>{ne||(ne=!0,re(),Ye?ve($,[le]):ve(F,[le]),le[vr]=void 0,Te[ce]===e&&delete Te[ce])};const Pe=le[vr].bind(null,!1);Te[ce]=e,I?ye(I,[le,Pe]):Pe()},clone(le){const re=Va(le,t,n,r,s);return s&&s(re),re}};return Le}function sa(e){if(Ui(e))return e=fs(e),e.children=null,e}function dc(e){if(!Ui(e))return zd(e.type)&&e.children?Jd(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&&nt(n.default))return n.default()}}function $o(e,t){e.shapeFlag&6&&e.component?(e.transition=t,$o(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 Qd(e,t=!1,n){let r=[],s=0;for(let o=0;o<e.length;o++){let i=e[o];const a=n==null?i.key:String(n)+String(i.key!=null?i.key:o);i.type===Ne?(i.patchFlag&128&&s++,r=r.concat(Qd(i.children,t,a))):(t||i.type!==wn)&&r.push(a!=null?fs(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function cn(e,t){return nt(e)?tn({name:e.name},t,{setup:e}):e}function Xd(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function fc(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const ki=new WeakMap;function So(e,t,n,r,s=!1){if(Xe(e)){e.forEach(($,Q)=>So($,t&&(Xe(t)?t[Q]:t),n,r,s));return}if(Js(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&So(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?qi(r.component):r.el,i=s?null:o,{i:a,r:l}=e,f=t&&t.r,u=a.refs===Lt?a.refs={}:a.refs,g=a.setupState,_=Tt(g),I=g===Lt?dd:$=>fc(u,$)?!1:Ct(_,$),F=($,Q)=>!(Q&&fc(u,Q));if(f!=null&&f!==l){if(hc(t),Gt(f))u[f]=null,I(f)&&(g[f]=null);else if(_n(f)){const $=t;F(f,$.k)&&(f.value=null),$.k&&(u[$.k]=null)}}if(nt(l))zo(l,a,12,[i,u]);else{const $=Gt(l),Q=_n(l);if($||Q){const ae=()=>{if(e.f){const q=$?I(l)?g[l]:u[l]:F()||!e.k?l.value:u[e.k];if(s)Xe(q)&&bl(q,o);else if(Xe(q))q.includes(o)||q.push(o);else if($)u[l]=[o],I(l)&&(g[l]=u[l]);else{const ee=[o];F(l,e.k)&&(l.value=ee),e.k&&(u[e.k]=ee)}}else $?(u[l]=i,I(l)&&(g[l]=i)):Q&&(F(l,e.k)&&(l.value=i),e.k&&(u[e.k]=i))};if(i){const q=()=>{ae(),ki.delete(e)};q.id=-1,ki.set(e,q),vn(q,n)}else hc(e),ae()}}}function hc(e){const t=ki.get(e);t&&(t.flags|=8,ki.delete(e))}Di().requestIdleCallback;Di().cancelIdleCallback;const Js=e=>!!e.type.__asyncLoader,Ui=e=>e.type.__isKeepAlive;function zp(e,t){Zd(e,"a",t)}function qp(e,t){Zd(e,"da",t)}function Zd(e,t,n=bn){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Hi(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Ui(s.parent.vnode)&&Gp(r,t,n,s),s=s.parent}}function Gp(e,t,n,r){const s=Hi(t,e,r,!0);Wi(()=>{bl(r[t],s)},n)}function Hi(e,t,n=bn,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{Fr();const a=qo(n),l=ur(t,n,e,i);return a(),Br(),l});return r?s.unshift(o):s.push(o),o}}const qr=e=>(t,n=bn)=>{(!Do||e==="sp")&&Hi(e,(...r)=>t(...r),n)},Kp=qr("bm"),Gr=qr("m"),Jp=qr("bu"),Yp=qr("u"),Kr=qr("bum"),Wi=qr("um"),Qp=qr("sp"),Xp=qr("rtg"),Zp=qr("rtc");function em(e,t=bn){Hi("ec",e,t)}const tm="components",ef=Symbol.for("v-ndc");function Ti(e){return Gt(e)?nm(tm,e,!1)||e:e||ef}function nm(e,t,n=!0,r=!1){const s=pn||bn;if(s){const o=s.type;{const a=Bm(o,!1);if(a&&(a===t||a===Rn(t)||a===Li(Rn(t))))return o}const i=pc(s[e]||o[e],t)||pc(s.appContext[e],t);return!i&&r?o:i}}function pc(e,t){return e&&(e[t]||e[Rn(t)]||e[Li(Rn(t))])}function vt(e,t,n,r){let s;const o=n,i=Xe(e);if(i||Gt(e)){const a=i&&$s(e);let l=!1,f=!1;a&&(l=!Xn(e),f=Ur(e),e=ji(e)),s=new Array(e.length);for(let u=0,g=e.length;u<g;u++)s[u]=t(l?f?to(cr(e[u])):cr(e[u]):e[u],u,void 0,o)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,o)}else if(At(e))if(e[Symbol.iterator])s=Array.from(e,(a,l)=>t(a,l,void 0,o));else{const a=Object.keys(e);s=new Array(a.length);for(let l=0,f=a.length;l<f;l++){const u=a[l];s[l]=t(e[u],u,l,o)}}else s=[];return s}function Tr(e,t,n={},r,s){if(pn.ce||pn.parent&&Js(pn.parent)&&pn.parent.ce){const f=Object.keys(n).length>0;return t!=="default"&&(n.name=t),y(),wt(Ne,null,[De("slot",n,r)],f?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),y();const i=o&&tf(o(n)),a=n.key||i&&i.key,l=wt(Ne,{key:(a&&!lr(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function tf(e){return e.some(t=>No(t)?!(t.type===wn||t.type===Ne&&!tf(t.children)):!0)?e:null}const za=e=>e?kf(e)?qi(e):za(e.parent):null,Io=tn(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=>za(e.parent),$root:e=>za(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>rf(e),$forceUpdate:e=>e.f||(e.f=()=>{Pl(e.update)}),$nextTick:e=>e.n||(e.n=en.bind(e.proxy)),$watch:e=>Bp.bind(e)}),oa=(e,t)=>e!==Lt&&!e.__isScriptSetup&&Ct(e,t),rm={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:o,accessCache:i,type:a,appContext:l}=e;if(t[0]!=="$"){const _=i[t];if(_!==void 0)switch(_){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if(oa(r,t))return i[t]=1,r[t];if(s!==Lt&&Ct(s,t))return i[t]=2,s[t];if(Ct(o,t))return i[t]=3,o[t];if(n!==Lt&&Ct(n,t))return i[t]=4,n[t];qa&&(i[t]=0)}}const f=Io[t];let u,g;if(f)return t==="$attrs"&&yn(e.attrs,"get",""),f(e);if((u=a.__cssModules)&&(u=u[t]))return u;if(n!==Lt&&Ct(n,t))return i[t]=4,n[t];if(g=l.config.globalProperties,Ct(g,t))return g[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return oa(s,t)?(s[t]=n,!0):r!==Lt&&Ct(r,t)?(r[t]=n,!0):Ct(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:s,props:o,type:i}},a){let l;return!!(n[a]||e!==Lt&&a[0]!=="$"&&Ct(e,a)||oa(t,a)||Ct(o,a)||Ct(r,a)||Ct(Io,a)||Ct(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Ct(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function sm(){return om().slots}function om(e){const t=Ll();return t.setupContext||(t.setupContext=Sf(t))}function mc(e){return Xe(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let qa=!0;function im(e){const t=rf(e),n=e.proxy,r=e.ctx;qa=!1,t.beforeCreate&&gc(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:f,created:u,beforeMount:g,mounted:_,beforeUpdate:I,updated:F,activated:$,deactivated:Q,beforeDestroy:ae,beforeUnmount:q,destroyed:ee,unmounted:te,render:Te,renderTracked:ve,renderTriggered:ye,errorCaptured:Le,serverPrefetch:le,expose:re,inheritAttrs:ce,components:ne,directives:Pe,filters:Ye}=t;if(f&&am(f,r,null),i)for(const Ue in i){const Re=i[Ue];nt(Re)&&(r[Ue]=Re.bind(n))}if(s){const Ue=s.call(n,n);At(Ue)&&(e.data=Fi(Ue))}if(qa=!0,o)for(const Ue in o){const Re=o[Ue],rt=nt(Re)?Re.bind(n,n):nt(Re.get)?Re.get.bind(n,n):Sr,Ae=!nt(Re)&&nt(Re.set)?Re.set.bind(n):Sr,Be=de({get:rt,set:Ae});Object.defineProperty(r,Ue,{enumerable:!0,configurable:!0,get:()=>Be.value,set:lt=>Be.value=lt})}if(a)for(const Ue in a)nf(a[Ue],r,n,Ue);if(l){const Ue=nt(l)?l.call(n):l;Reflect.ownKeys(Ue).forEach(Re=>{ui(Re,Ue[Re])})}u&&gc(u,e,"c");function Ve(Ue,Re){Xe(Re)?Re.forEach(rt=>Ue(rt.bind(n))):Re&&Ue(Re.bind(n))}if(Ve(Kp,g),Ve(Gr,_),Ve(Jp,I),Ve(Yp,F),Ve(zp,$),Ve(qp,Q),Ve(em,Le),Ve(Zp,ve),Ve(Xp,ye),Ve(Kr,q),Ve(Wi,te),Ve(Qp,le),Xe(re))if(re.length){const Ue=e.exposed||(e.exposed={});re.forEach(Re=>{Object.defineProperty(Ue,Re,{get:()=>n[Re],set:rt=>n[Re]=rt,enumerable:!0})})}else e.exposed||(e.exposed={});Te&&e.render===Sr&&(e.render=Te),ce!=null&&(e.inheritAttrs=ce),ne&&(e.components=ne),Pe&&(e.directives=Pe),le&&Xd(e)}function am(e,t,n=Sr){Xe(e)&&(e=Ga(e));for(const r in e){const s=e[r];let o;At(s)?"default"in s?o=ir(s.from||r,s.default,!0):o=ir(s.from||r):o=ir(s),_n(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function gc(e,t,n){ur(Xe(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function nf(e,t,n,r){let s=r.includes(".")?Wd(n,r):()=>n[r];if(Gt(e)){const o=t[e];nt(o)&&ht(s,o)}else if(nt(e))ht(s,e.bind(n));else if(At(e))if(Xe(e))e.forEach(o=>nf(o,t,n,r));else{const o=nt(e.handler)?e.handler.bind(n):t[e.handler];nt(o)&&ht(s,o,e)}}function rf(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,a=o.get(t);let l;return a?l=a:!s.length&&!n&&!r?l=t:(l={},s.length&&s.forEach(f=>Si(l,f,i,!0)),Si(l,t,i)),At(t)&&o.set(t,l),l}function Si(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&Si(e,o,n,!0),s&&s.forEach(i=>Si(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=lm[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const lm={data:vc,props:yc,emits:yc,methods:vo,computed:vo,beforeCreate:En,created:En,beforeMount:En,mounted:En,beforeUpdate:En,updated:En,beforeDestroy:En,beforeUnmount:En,destroyed:En,unmounted:En,activated:En,deactivated:En,errorCaptured:En,serverPrefetch:En,components:vo,directives:vo,watch:um,provide:vc,inject:cm};function vc(e,t){return t?e?function(){return tn(nt(e)?e.call(this,this):e,nt(t)?t.call(this,this):t)}:t:e}function cm(e,t){return vo(Ga(e),Ga(t))}function Ga(e){if(Xe(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function En(e,t){return e?[...new Set([].concat(e,t))]:t}function vo(e,t){return e?tn(Object.create(null),e,t):t}function yc(e,t){return e?Xe(e)&&Xe(t)?[...new Set([...e,...t])]:tn(Object.create(null),mc(e),mc(t??{})):t}function um(e,t){if(!e)return t;if(!t)return e;const n=tn(Object.create(null),e);for(const r in t)n[r]=En(e[r],t[r]);return n}function sf(){return{app:null,config:{isNativeTag:dd,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 dm=0;function fm(e,t){return function(r,s=null){nt(r)||(r=tn({},r)),s!=null&&!At(s)&&(s=null);const o=sf(),i=new WeakSet,a=[];let l=!1;const f=o.app={_uid:dm++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Hm,get config(){return o.config},set config(u){},use(u,...g){return i.has(u)||(u&&nt(u.install)?(i.add(u),u.install(f,...g)):nt(u)&&(i.add(u),u(f,...g))),f},mixin(u){return o.mixins.includes(u)||o.mixins.push(u),f},component(u,g){return g?(o.components[u]=g,f):o.components[u]},directive(u,g){return g?(o.directives[u]=g,f):o.directives[u]},mount(u,g,_){if(!l){const I=f._ceVNode||De(r,s);return I.appContext=o,_===!0?_="svg":_===!1&&(_=void 0),e(I,u,_),l=!0,f._container=u,u.__vue_app__=f,qi(I.component)}},onUnmount(u){a.push(u)},unmount(){l&&(ur(a,f._instance,16),e(null,f._container),delete f._container.__vue_app__)},provide(u,g){return o.provides[u]=g,f},runWithContext(u){const g=Ys;Ys=f;try{return u()}finally{Ys=g}}};return f}}let Ys=null;const hm=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Rn(t)}Modifiers`]||e[`${hs(t)}Modifiers`];function pm(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Lt;let s=n;const o=t.startsWith("update:"),i=o&&hm(r,t.slice(7));i&&(i.trim&&(s=n.map(u=>Gt(u)?u.trim():u)),i.number&&(s=n.map(kl)));let a,l=r[a=Zi(t)]||r[a=Zi(Rn(t))];!l&&o&&(l=r[a=Zi(hs(t))]),l&&ur(l,e,6,s);const f=r[a+"Once"];if(f){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,ur(f,e,6,s)}}const mm=new WeakMap;function of(e,t,n=!1){const r=n?mm:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!nt(e)){const l=f=>{const u=of(f,t,!0);u&&(a=!0,tn(i,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(At(e)&&r.set(e,null),null):(Xe(o)?o.forEach(l=>i[l]=null):tn(i,o),At(e)&&r.set(e,i),i)}function Vi(e,t){return!e||!Oi(t)?!1:(t=t.slice(2).replace(/Once$/,""),Ct(e,t[0].toLowerCase()+t.slice(1))||Ct(e,hs(t))||Ct(e,t))}function wc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:f,renderCache:u,props:g,data:_,setupState:I,ctx:F,inheritAttrs:$}=e,Q=_i(e);let ae,q;try{if(n.shapeFlag&4){const te=s||r,Te=te;ae=wr(f.call(Te,te,u,g,I,_,F)),q=a}else{const te=t;ae=wr(te.length>1?te(g,{attrs:a,slots:i,emit:l}):te(g,null)),q=t.props?a:gm(a)}}catch(te){Eo.length=0,Bi(te,e,1),ae=De(wn)}let ee=ae;if(q&&$!==!1){const te=Object.keys(q),{shapeFlag:Te}=ee;te.length&&Te&7&&(o&&te.some(wl)&&(q=vm(q,o)),ee=fs(ee,q,!1,!0))}return n.dirs&&(ee=fs(ee,null,!1,!0),ee.dirs=ee.dirs?ee.dirs.concat(n.dirs):n.dirs),n.transition&&$o(ee,n.transition),ae=ee,_i(Q),ae}const gm=e=>{let t;for(const n in e)(n==="class"||n==="style"||Oi(n))&&((t||(t={}))[n]=e[n]);return t},vm=(e,t)=>{const n={};for(const r in e)(!wl(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function ym(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,f=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?bc(r,i,f):!!i;if(l&8){const u=t.dynamicProps;for(let g=0;g<u.length;g++){const _=u[g];if(af(i,r,_)&&!Vi(f,_))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?bc(r,i,f):!0:!!i;return!1}function bc(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let s=0;s<r.length;s++){const o=r[s];if(af(t,e,o)&&!Vi(n,o))return!0}return!1}function af(e,t,n){const r=e[n],s=t[n];return n==="style"&&At(r)&&At(s)?!Tl(r,s):r!==s}function wm({vnode:e,parent:t},n){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.el=e.el),r===e)(e=t.vnode).el=n,t=t.parent;else break}}const lf={},cf=()=>Object.create(lf),uf=e=>Object.getPrototypeOf(e)===lf;function bm(e,t,n,r=!1){const s={},o=cf();e.propsDefaults=Object.create(null),df(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Od(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function _m(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=Tt(s),[l]=e.propsOptions;let f=!1;if((r||i>0)&&!(i&16)){if(i&8){const u=e.vnode.dynamicProps;for(let g=0;g<u.length;g++){let _=u[g];if(Vi(e.emitsOptions,_))continue;const I=t[_];if(l)if(Ct(o,_))I!==o[_]&&(o[_]=I,f=!0);else{const F=Rn(_);s[F]=Ka(l,a,F,I,e,!1)}else I!==o[_]&&(o[_]=I,f=!0)}}}else{df(e,t,s,o)&&(f=!0);let u;for(const g in a)(!t||!Ct(t,g)&&((u=hs(g))===g||!Ct(t,u)))&&(l?n&&(n[g]!==void 0||n[u]!==void 0)&&(s[g]=Ka(l,a,g,void 0,e,!0)):delete s[g]);if(o!==a)for(const g in o)(!t||!Ct(t,g))&&(delete o[g],f=!0)}f&&Or(e.attrs,"set","")}function df(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(wo(l))continue;const f=t[l];let u;s&&Ct(s,u=Rn(l))?!o||!o.includes(u)?n[u]=f:(a||(a={}))[u]=f:Vi(e.emitsOptions,l)||(!(l in r)||f!==r[l])&&(r[l]=f,i=!0)}if(o){const l=Tt(n),f=a||Lt;for(let u=0;u<o.length;u++){const g=o[u];n[g]=Ka(s,l,g,f[g],e,!Ct(f,g))}}return i}function Ka(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=Ct(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&nt(l)){const{propsDefaults:f}=s;if(n in f)r=f[n];else{const u=qo(s);r=f[n]=l.call(null,t),u()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===hs(n))&&(r=!0))}return r}const km=new WeakMap;function ff(e,t,n=!1){const r=n?km:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!nt(e)){const u=g=>{l=!0;const[_,I]=ff(g,t,!0);tn(i,_),I&&a.push(...I)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!o&&!l)return At(e)&&r.set(e,qs),qs;if(Xe(o))for(let u=0;u<o.length;u++){const g=Rn(o[u]);_c(g)&&(i[g]=Lt)}else if(o)for(const u in o){const g=Rn(u);if(_c(g)){const _=o[u],I=i[g]=Xe(_)||nt(_)?{type:_}:tn({},_),F=I.type;let $=!1,Q=!0;if(Xe(F))for(let ae=0;ae<F.length;++ae){const q=F[ae],ee=nt(q)&&q.name;if(ee==="Boolean"){$=!0;break}else ee==="String"&&(Q=!1)}else $=nt(F)&&F.name==="Boolean";I[0]=$,I[1]=Q,($||Ct(I,"default"))&&a.push(g)}}const f=[i,a];return At(e)&&r.set(e,f),f}function _c(e){return e[0]!=="$"&&!wo(e)}const Ml=e=>e==="_"||e==="_ctx"||e==="$stable",$l=e=>Xe(e)?e.map(wr):[wr(e)],Tm=(e,t,n)=>{if(t._n)return t;const r=It((...s)=>$l(t(...s)),n);return r._c=!1,r},hf=(e,t,n)=>{const r=e._ctx;for(const s in e){if(Ml(s))continue;const o=e[s];if(nt(o))t[s]=Tm(s,o,r);else if(o!=null){const i=$l(o);t[s]=()=>i}}},pf=(e,t)=>{const n=$l(t);e.slots.default=()=>n},mf=(e,t,n)=>{for(const r in t)(n||!Ml(r))&&(e[r]=t[r])},Sm=(e,t,n)=>{const r=e.slots=cf();if(e.vnode.shapeFlag&32){const s=t._;s?(mf(r,t,n),n&&gd(r,"_",s,!0)):hf(t,r)}else t&&pf(e,t)},Im=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=Lt;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:mf(s,t,n):(o=!t.$stable,hf(t,s)),i=t}else t&&(pf(e,t),i={default:1});if(o)for(const a in s)!Ml(a)&&i[a]==null&&delete s[a]},vn=Rm;function Em(e){return Cm(e)}function Cm(e,t){const n=Di();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:f,setElementText:u,parentNode:g,nextSibling:_,setScopeId:I=Sr,insertStaticContent:F}=e,$=(T,E,O,z=null,Y=null,N=null,B=void 0,H=null,X=!!E.dynamicChildren)=>{if(T===E)return;T&&!As(T,E)&&(z=V(T),lt(T,Y,N,!0),T=null),E.patchFlag===-2&&(X=!1,E.dynamicChildren=null);const{type:Z,ref:Ee,shapeFlag:we}=E;switch(Z){case zi:Q(T,E,O,z);break;case wn:ae(T,E,O,z);break;case aa:T==null&&q(E,O,z,B);break;case Ne:ne(T,E,O,z,Y,N,B,H,X);break;default:we&1?Te(T,E,O,z,Y,N,B,H,X):we&6?Pe(T,E,O,z,Y,N,B,H,X):(we&64||we&128)&&Z.process(T,E,O,z,Y,N,B,H,X,ge)}Ee!=null&&Y?So(Ee,T&&T.ref,N,E||T,!E):Ee==null&&T&&T.ref!=null&&So(T.ref,null,N,T,!0)},Q=(T,E,O,z)=>{if(T==null)r(E.el=a(E.children),O,z);else{const Y=E.el=T.el;E.children!==T.children&&f(Y,E.children)}},ae=(T,E,O,z)=>{T==null?r(E.el=l(E.children||""),O,z):E.el=T.el},q=(T,E,O,z)=>{[T.el,T.anchor]=F(T.children,E,O,z,T.el,T.anchor)},ee=({el:T,anchor:E},O,z)=>{let Y;for(;T&&T!==E;)Y=_(T),r(T,O,z),T=Y;r(E,O,z)},te=({el:T,anchor:E})=>{let O;for(;T&&T!==E;)O=_(T),s(T),T=O;s(E)},Te=(T,E,O,z,Y,N,B,H,X)=>{if(E.type==="svg"?B="svg":E.type==="math"&&(B="mathml"),T==null)ve(E,O,z,Y,N,B,H,X);else{const Z=T.el&&T.el._isVueCE?T.el:null;try{Z&&Z._beginPatch(),le(T,E,Y,N,B,H,X)}finally{Z&&Z._endPatch()}}},ve=(T,E,O,z,Y,N,B,H)=>{let X,Z;const{props:Ee,shapeFlag:we,transition:ke,dirs:xe}=T;if(X=T.el=i(T.type,N,Ee&&Ee.is,Ee),we&8?u(X,T.children):we&16&&Le(T.children,X,null,z,Y,ia(T,N),B,H),xe&&_s(T,null,z,"created"),ye(X,T,T.scopeId,B,z),Ee){for(const it in Ee)it!=="value"&&!wo(it)&&o(X,it,null,Ee[it],N,z);"value"in Ee&&o(X,"value",null,Ee.value,N),(Z=Ee.onVnodeBeforeMount)&&mr(Z,z,T)}xe&&_s(T,null,z,"beforeMount");const ze=Am(Y,ke);ze&&ke.beforeEnter(X),r(X,E,O),((Z=Ee&&Ee.onVnodeMounted)||ze||xe)&&vn(()=>{Z&&mr(Z,z,T),ze&&ke.enter(X),xe&&_s(T,null,z,"mounted")},Y)},ye=(T,E,O,z,Y)=>{if(O&&I(T,O),z)for(let N=0;N<z.length;N++)I(T,z[N]);if(Y){let N=Y.subTree;if(E===N||yf(N.type)&&(N.ssContent===E||N.ssFallback===E)){const B=Y.vnode;ye(T,B,B.scopeId,B.slotScopeIds,Y.parent)}}},Le=(T,E,O,z,Y,N,B,H,X=0)=>{for(let Z=X;Z<T.length;Z++){const Ee=T[Z]=H?$r(T[Z]):wr(T[Z]);$(null,Ee,E,O,z,Y,N,B,H)}},le=(T,E,O,z,Y,N,B)=>{const H=E.el=T.el;let{patchFlag:X,dynamicChildren:Z,dirs:Ee}=E;X|=T.patchFlag&16;const we=T.props||Lt,ke=E.props||Lt;let xe;if(O&&ks(O,!1),(xe=ke.onVnodeBeforeUpdate)&&mr(xe,O,E,T),Ee&&_s(E,T,O,"beforeUpdate"),O&&ks(O,!0),(we.innerHTML&&ke.innerHTML==null||we.textContent&&ke.textContent==null)&&u(H,""),Z?re(T.dynamicChildren,Z,H,O,z,ia(E,Y),N):B||Re(T,E,H,null,O,z,ia(E,Y),N,!1),X>0){if(X&16)ce(H,we,ke,O,Y);else if(X&2&&we.class!==ke.class&&o(H,"class",null,ke.class,Y),X&4&&o(H,"style",we.style,ke.style,Y),X&8){const ze=E.dynamicProps;for(let it=0;it<ze.length;it++){const We=ze[it],pt=we[We],bt=ke[We];(bt!==pt||We==="value")&&o(H,We,pt,bt,Y,O)}}X&1&&T.children!==E.children&&u(H,E.children)}else!B&&Z==null&&ce(H,we,ke,O,Y);((xe=ke.onVnodeUpdated)||Ee)&&vn(()=>{xe&&mr(xe,O,E,T),Ee&&_s(E,T,O,"updated")},z)},re=(T,E,O,z,Y,N,B)=>{for(let H=0;H<E.length;H++){const X=T[H],Z=E[H],Ee=X.el&&(X.type===Ne||!As(X,Z)||X.shapeFlag&198)?g(X.el):O;$(X,Z,Ee,null,z,Y,N,B,!0)}},ce=(T,E,O,z,Y)=>{if(E!==O){if(E!==Lt)for(const N in E)!wo(N)&&!(N in O)&&o(T,N,E[N],null,Y,z);for(const N in O){if(wo(N))continue;const B=O[N],H=E[N];B!==H&&N!=="value"&&o(T,N,H,B,Y,z)}"value"in O&&o(T,"value",E.value,O.value,Y)}},ne=(T,E,O,z,Y,N,B,H,X)=>{const Z=E.el=T?T.el:a(""),Ee=E.anchor=T?T.anchor:a("");let{patchFlag:we,dynamicChildren:ke,slotScopeIds:xe}=E;xe&&(H=H?H.concat(xe):xe),T==null?(r(Z,O,z),r(Ee,O,z),Le(E.children||[],O,Ee,Y,N,B,H,X)):we>0&&we&64&&ke&&T.dynamicChildren&&T.dynamicChildren.length===ke.length?(re(T.dynamicChildren,ke,O,Y,N,B,H),(E.key!=null||Y&&E===Y.subTree)&&Ol(T,E,!0)):Re(T,E,O,Ee,Y,N,B,H,X)},Pe=(T,E,O,z,Y,N,B,H,X)=>{E.slotScopeIds=H,T==null?E.shapeFlag&512?Y.ctx.activate(E,O,z,B,X):Ye(E,O,z,Y,N,B,X):Ge(T,E,X)},Ye=(T,E,O,z,Y,N,B)=>{const H=T.component=Lm(T,z,Y);if(Ui(T)&&(H.ctx.renderer=ge),Dm(H,!1,B),H.asyncDep){if(Y&&Y.registerDep(H,Ve,B),!T.el){const X=H.subTree=De(wn);ae(null,X,E,O),T.placeholder=X.el}}else Ve(H,T,E,O,Y,N,B)},Ge=(T,E,O)=>{const z=E.component=T.component;if(ym(T,E,O))if(z.asyncDep&&!z.asyncResolved){Ue(z,E,O);return}else z.next=E,z.update();else E.el=T.el,z.vnode=E},Ve=(T,E,O,z,Y,N,B)=>{const H=()=>{if(T.isMounted){let{next:we,bu:ke,u:xe,parent:ze,vnode:it}=T;{const Ke=gf(T);if(Ke){we&&(we.el=it.el,Ue(T,we,B)),Ke.asyncDep.then(()=>{vn(()=>{T.isUnmounted||Z()},Y)});return}}let We=we,pt;ks(T,!1),we?(we.el=it.el,Ue(T,we,B)):we=it,ke&&ci(ke),(pt=we.props&&we.props.onVnodeBeforeUpdate)&&mr(pt,ze,we,it),ks(T,!0);const bt=wc(T),Pt=T.subTree;T.subTree=bt,$(Pt,bt,g(Pt.el),V(Pt),T,Y,N),we.el=bt.el,We===null&&wm(T,bt.el),xe&&vn(xe,Y),(pt=we.props&&we.props.onVnodeUpdated)&&vn(()=>mr(pt,ze,we,it),Y)}else{let we;const{el:ke,props:xe}=E,{bm:ze,m:it,parent:We,root:pt,type:bt}=T,Pt=Js(E);ks(T,!1),ze&&ci(ze),!Pt&&(we=xe&&xe.onVnodeBeforeMount)&&mr(we,We,E),ks(T,!0);{pt.ce&&pt.ce._hasShadowRoot()&&pt.ce._injectChildStyle(bt,T.parent?T.parent.type:void 0);const Ke=T.subTree=wc(T);$(null,Ke,O,z,T,Y,N),E.el=Ke.el}if(it&&vn(it,Y),!Pt&&(we=xe&&xe.onVnodeMounted)){const Ke=E;vn(()=>mr(we,We,Ke),Y)}(E.shapeFlag&256||We&&Js(We.vnode)&&We.vnode.shapeFlag&256)&&T.a&&vn(T.a,Y),T.isMounted=!0,E=O=z=null}};T.scope.on();const X=T.effect=new bd(H);T.scope.off();const Z=T.update=X.run.bind(X),Ee=T.job=X.runIfDirty.bind(X);Ee.i=T,Ee.id=T.uid,X.scheduler=()=>Pl(Ee),ks(T,!0),Z()},Ue=(T,E,O)=>{E.component=T;const z=T.vnode.props;T.vnode=E,T.next=null,_m(T,E.props,z,O),Im(T,E.children,O),Fr(),ac(T),Br()},Re=(T,E,O,z,Y,N,B,H,X=!1)=>{const Z=T&&T.children,Ee=T?T.shapeFlag:0,we=E.children,{patchFlag:ke,shapeFlag:xe}=E;if(ke>0){if(ke&128){Ae(Z,we,O,z,Y,N,B,H,X);return}else if(ke&256){rt(Z,we,O,z,Y,N,B,H,X);return}}xe&8?(Ee&16&&He(Z,Y,N),we!==Z&&u(O,we)):Ee&16?xe&16?Ae(Z,we,O,z,Y,N,B,H,X):He(Z,Y,N,!0):(Ee&8&&u(O,""),xe&16&&Le(we,O,z,Y,N,B,H,X))},rt=(T,E,O,z,Y,N,B,H,X)=>{T=T||qs,E=E||qs;const Z=T.length,Ee=E.length,we=Math.min(Z,Ee);let ke;for(ke=0;ke<we;ke++){const xe=E[ke]=X?$r(E[ke]):wr(E[ke]);$(T[ke],xe,O,null,Y,N,B,H,X)}Z>Ee?He(T,Y,N,!0,!1,we):Le(E,O,z,Y,N,B,H,X,we)},Ae=(T,E,O,z,Y,N,B,H,X)=>{let Z=0;const Ee=E.length;let we=T.length-1,ke=Ee-1;for(;Z<=we&&Z<=ke;){const xe=T[Z],ze=E[Z]=X?$r(E[Z]):wr(E[Z]);if(As(xe,ze))$(xe,ze,O,null,Y,N,B,H,X);else break;Z++}for(;Z<=we&&Z<=ke;){const xe=T[we],ze=E[ke]=X?$r(E[ke]):wr(E[ke]);if(As(xe,ze))$(xe,ze,O,null,Y,N,B,H,X);else break;we--,ke--}if(Z>we){if(Z<=ke){const xe=ke+1,ze=xe<Ee?E[xe].el:z;for(;Z<=ke;)$(null,E[Z]=X?$r(E[Z]):wr(E[Z]),O,ze,Y,N,B,H,X),Z++}}else if(Z>ke)for(;Z<=we;)lt(T[Z],Y,N,!0),Z++;else{const xe=Z,ze=Z,it=new Map;for(Z=ze;Z<=ke;Z++){const dt=E[Z]=X?$r(E[Z]):wr(E[Z]);dt.key!=null&&it.set(dt.key,Z)}let We,pt=0;const bt=ke-ze+1;let Pt=!1,Ke=0;const Bt=new Array(bt);for(Z=0;Z<bt;Z++)Bt[Z]=0;for(Z=xe;Z<=we;Z++){const dt=T[Z];if(pt>=bt){lt(dt,Y,N,!0);continue}let _t;if(dt.key!=null)_t=it.get(dt.key);else for(We=ze;We<=ke;We++)if(Bt[We-ze]===0&&As(dt,E[We])){_t=We;break}_t===void 0?lt(dt,Y,N,!0):(Bt[_t-ze]=Z+1,_t>=Ke?Ke=_t:Pt=!0,$(dt,E[_t],O,null,Y,N,B,H,X),pt++)}const zt=Pt?xm(Bt):qs;for(We=zt.length-1,Z=bt-1;Z>=0;Z--){const dt=ze+Z,_t=E[dt],gt=E[dt+1],nn=dt+1<Ee?gt.el||vf(gt):z;Bt[Z]===0?$(null,_t,O,nn,Y,N,B,H,X):Pt&&(We<0||Z!==zt[We]?Be(_t,O,nn,2):We--)}}},Be=(T,E,O,z,Y=null)=>{const{el:N,type:B,transition:H,children:X,shapeFlag:Z}=T;if(Z&6){Be(T.component.subTree,E,O,z);return}if(Z&128){T.suspense.move(E,O,z);return}if(Z&64){B.move(T,E,O,ge);return}if(B===Ne){r(N,E,O);for(let we=0;we<X.length;we++)Be(X[we],E,O,z);r(T.anchor,E,O);return}if(B===aa){ee(T,E,O);return}if(z!==2&&Z&1&&H)if(z===0)H.beforeEnter(N),r(N,E,O),vn(()=>H.enter(N),Y);else{const{leave:we,delayLeave:ke,afterLeave:xe}=H,ze=()=>{T.ctx.isUnmounted?s(N):r(N,E,O)},it=()=>{N._isLeaving&&N[vr](!0),we(N,()=>{ze(),xe&&xe()})};ke?ke(N,ze,it):it()}else r(N,E,O)},lt=(T,E,O,z=!1,Y=!1)=>{const{type:N,props:B,ref:H,children:X,dynamicChildren:Z,shapeFlag:Ee,patchFlag:we,dirs:ke,cacheIndex:xe}=T;if(we===-2&&(Y=!1),H!=null&&(Fr(),So(H,null,O,T,!0),Br()),xe!=null&&(E.renderCache[xe]=void 0),Ee&256){E.ctx.deactivate(T);return}const ze=Ee&1&&ke,it=!Js(T);let We;if(it&&(We=B&&B.onVnodeBeforeUnmount)&&mr(We,E,T),Ee&6)ct(T.component,O,z);else{if(Ee&128){T.suspense.unmount(O,z);return}ze&&_s(T,null,E,"beforeUnmount"),Ee&64?T.type.remove(T,E,O,ge,z):Z&&!Z.hasOnce&&(N!==Ne||we>0&&we&64)?He(Z,E,O,!1,!0):(N===Ne&&we&384||!Y&&Ee&16)&&He(X,E,O),z&&Ht(T)}(it&&(We=B&&B.onVnodeUnmounted)||ze)&&vn(()=>{We&&mr(We,E,T),ze&&_s(T,null,E,"unmounted")},O)},Ht=T=>{const{type:E,el:O,anchor:z,transition:Y}=T;if(E===Ne){mt(O,z);return}if(E===aa){te(T);return}const N=()=>{s(O),Y&&!Y.persisted&&Y.afterLeave&&Y.afterLeave()};if(T.shapeFlag&1&&Y&&!Y.persisted){const{leave:B,delayLeave:H}=Y,X=()=>B(O,N);H?H(T.el,N,X):X()}else N()},mt=(T,E)=>{let O;for(;T!==E;)O=_(T),s(T),T=O;s(E)},ct=(T,E,O)=>{const{bum:z,scope:Y,job:N,subTree:B,um:H,m:X,a:Z}=T;kc(X),kc(Z),z&&ci(z),Y.stop(),N&&(N.flags|=8,lt(B,T,E,O)),H&&vn(H,E),vn(()=>{T.isUnmounted=!0},E)},He=(T,E,O,z=!1,Y=!1,N=0)=>{for(let B=N;B<T.length;B++)lt(T[B],E,O,z,Y)},V=T=>{if(T.shapeFlag&6)return V(T.component.subTree);if(T.shapeFlag&128)return T.suspense.next();const E=_(T.anchor||T.el),O=E&&E[Vd];return O?_(O):E};let _e=!1;const he=(T,E,O)=>{let z;T==null?E._vnode&&(lt(E._vnode,null,null,!0),z=E._vnode.component):$(E._vnode||null,T,E,null,null,null,O),E._vnode=T,_e||(_e=!0,ac(z),Fd(),_e=!1)},ge={p:$,um:lt,m:Be,r:Ht,mt:Ye,mc:Le,pc:Re,pbc:re,n:V,o:e};return{render:he,hydrate:void 0,createApp:fm(he)}}function ia({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 ks({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Am(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ol(e,t,n=!1){const r=e.children,s=t.children;if(Xe(r)&&Xe(s))for(let o=0;o<r.length;o++){const i=r[o];let a=s[o];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[o]=$r(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&Ol(i,a)),a.type===zi&&(a.patchFlag===-1&&(a=s[o]=$r(a)),a.el=i.el),a.type===wn&&!a.el&&(a.el=i.el)}}function xm(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const f=e[r];if(f!==0){if(s=n[n.length-1],e[s]<f){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<f?o=a+1:i=a;f<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,i=n[o-1];o-- >0;)n[o]=i,i=t[i];return n}function gf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:gf(t)}function kc(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function vf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?vf(t.subTree):null}const yf=e=>e.__isSuspense;function Rm(e,t){t&&t.pendingBranch?Xe(e)?t.effects.push(...e):t.effects.push(e):Dp(e)}const Ne=Symbol.for("v-fgt"),zi=Symbol.for("v-txt"),wn=Symbol.for("v-cmt"),aa=Symbol.for("v-stc"),Eo=[];let qn=null;function y(e=!1){Eo.push(qn=e?null:[])}function Pm(){Eo.pop(),qn=Eo[Eo.length-1]||null}let Oo=1;function Ii(e,t=!1){Oo+=e,e<0&&qn&&t&&(qn.hasOnce=!0)}function wf(e){return e.dynamicChildren=Oo>0?qn||qs:null,Pm(),Oo>0&&qn&&qn.push(e),e}function k(e,t,n,r,s,o){return wf(v(e,t,n,r,s,o,!0))}function wt(e,t,n,r,s){return wf(De(e,t,n,r,s,!0))}function No(e){return e?e.__v_isVNode===!0:!1}function As(e,t){return e.type===t.type&&e.key===t.key}const bf=({key:e})=>e??null,fi=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Gt(e)||_n(e)||nt(e)?{i:pn,r:e,k:t,f:!!n}:e:null);function v(e,t=null,n=null,r=0,s=null,o=e===Ne?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&bf(t),ref:t&&fi(t),scopeId:Ud,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:s,dynamicChildren:null,appContext:null,ctx:pn};return a?(Nl(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=Gt(n)?8:16),Oo>0&&!i&&qn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&qn.push(l),l}const De=Mm;function Mm(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===ef)&&(e=wn),No(e)){const a=fs(e,t,!0);return n&&Nl(a,n),Oo>0&&!o&&qn&&(a.shapeFlag&6?qn[qn.indexOf(e)]=a:qn.push(a)),a.patchFlag=-2,a}if(Um(e)&&(e=e.__vccOpts),t){t=$m(t);let{class:a,style:l}=t;a&&!Gt(a)&&(t.class=tt(a)),At(l)&&(Rl(l)&&!Xe(l)&&(l=tn({},l)),t.style=cs(l))}const i=Gt(e)?1:yf(e)?128:zd(e)?64:At(e)?4:nt(e)?2:0;return v(e,t,n,r,s,i,o,!0)}function $m(e){return e?Rl(e)||uf(e)?tn({},e):e:null}function fs(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,f=t?_f(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&bf(f),ref:t&&t.ref?n&&o?Xe(o)?o.concat(fi(t)):[o,fi(t)]:fi(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Ne?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&fs(e.ssContent),ssFallback:e.ssFallback&&fs(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&$o(u,l.clone(u)),u}function Lo(e=" ",t=0){return De(zi,null,e,t)}function fe(e="",t=!1){return t?(y(),wt(wn,null,e)):De(wn,null,e)}function wr(e){return e==null||typeof e=="boolean"?De(wn):Xe(e)?De(Ne,null,e.slice()):No(e)?$r(e):De(zi,null,String(e))}function $r(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:fs(e)}function Nl(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Xe(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),Nl(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!uf(t)?t._ctx=pn:s===3&&pn&&(pn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else nt(t)?(t={default:t,_ctx:pn},n=32):(t=String(t),r&64?(n=16,t=[Lo(t)]):n=8);e.children=t,e.shapeFlag|=n}function _f(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const s in r)if(s==="class")t.class!==r.class&&(t.class=tt([t.class,r.class]));else if(s==="style")t.style=cs([t.style,r.style]);else if(Oi(s)){const o=t[s],i=r[s];i&&o!==i&&!(Xe(o)&&o.includes(i))&&(t[s]=o?[].concat(o,i):i)}else s!==""&&(t[s]=r[s])}return t}function mr(e,t,n,r=null){ur(e,t,7,[n,r])}const Om=sf();let Nm=0;function Lm(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Om,o={uid:Nm++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ap(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(s.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:ff(r,s),emitsOptions:of(r,s),emit:null,emitted:null,propsDefaults:Lt,inheritAttrs:r.inheritAttrs,ctx:Lt,data:Lt,props:Lt,attrs:Lt,slots:Lt,refs:Lt,setupState:Lt,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=pm.bind(null,o),e.ce&&e.ce(o),o}let bn=null;const Ll=()=>bn||pn;let Ei,Ja;{const e=Di(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),o=>{s.length>1?s.forEach(i=>i(o)):s[0](o)}};Ei=t("__VUE_INSTANCE_SETTERS__",n=>bn=n),Ja=t("__VUE_SSR_SETTERS__",n=>Do=n)}const qo=e=>{const t=bn;return Ei(e),e.scope.on(),()=>{e.scope.off(),Ei(t)}},Tc=()=>{bn&&bn.scope.off(),Ei(null)};function kf(e){return e.vnode.shapeFlag&4}let Do=!1;function Dm(e,t=!1,n=!1){t&&Ja(t);const{props:r,children:s}=e.vnode,o=kf(e);bm(e,r,o,t),Sm(e,s,n||t);const i=o?jm(e,t):void 0;return t&&Ja(!1),i}function jm(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,rm);const{setup:r}=n;if(r){Fr();const s=e.setupContext=r.length>1?Sf(e):null,o=qo(e),i=zo(r,e,0,[e.props,s]),a=hd(i);if(Br(),o(),(a||e.sp)&&!Js(e)&&Xd(e),a){if(i.then(Tc,Tc),t)return i.then(l=>{Sc(e,l)}).catch(l=>{Bi(l,e,0)});e.asyncDep=i}else Sc(e,i)}else Tf(e)}function Sc(e,t,n){nt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:At(t)&&(e.setupState=Ld(t)),Tf(e)}function Tf(e,t,n){const r=e.type;e.render||(e.render=r.render||Sr);{const s=qo(e);Fr();try{im(e)}finally{Br(),s()}}}const Fm={get(e,t){return yn(e,"get",""),e[t]}};function Sf(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Fm),slots:e.slots,emit:e.emit,expose:t}}function qi(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Ld(Cp(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Io)return Io[n](e)},has(t,n){return n in t||n in Io}})):e.proxy}function Bm(e,t=!0){return nt(e)?e.displayName||e.name:e.name||t&&e.__name}function Um(e){return nt(e)&&"__vccOpts"in e}const de=(e,t)=>Mp(e,t,Do);function Dl(e,t,n){try{Ii(-1);const r=arguments.length;return r===2?At(t)&&!Xe(t)?No(t)?De(e,null,[t]):De(e,t):De(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&No(n)&&(n=[n]),De(e,t,n))}finally{Ii(1)}}const Hm="3.5.30";/**
|
|
14
|
+
* @vue/runtime-dom v3.5.30
|
|
15
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
16
|
+
* @license MIT
|
|
17
|
+
**/let Ya;const Ic=typeof window<"u"&&window.trustedTypes;if(Ic)try{Ya=Ic.createPolicy("vue",{createHTML:e=>e})}catch{}const If=Ya?e=>Ya.createHTML(e):e=>e,Wm="http://www.w3.org/2000/svg",Vm="http://www.w3.org/1998/Math/MathML",Mr=typeof document<"u"?document:null,Ec=Mr&&Mr.createElement("template"),zm={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 s=t==="svg"?Mr.createElementNS(Wm,e):t==="mathml"?Mr.createElementNS(Vm,e):n?Mr.createElement(e,{is:n}):Mr.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Mr.createTextNode(e),createComment:e=>Mr.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Mr.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,o){const i=n?n.previousSibling:t.lastChild;if(s&&(s===o||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{Ec.innerHTML=If(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=Ec.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Zr="transition",po="animation",jo=Symbol("_vtc"),Ef={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},qm=tn({},Gd,Ef),Gm=e=>(e.displayName="Transition",e.props=qm,e),Cf=Gm((e,{slots:t})=>Dl(Vp,Km(e),t)),Ts=(e,t=[])=>{Xe(e)?e.forEach(n=>n(...t)):e&&e(...t)},Cc=e=>e?Xe(e)?e.some(t=>t.length>1):e.length>1:!1;function Km(e){const t={};for(const ne in e)ne in Ef||(t[ne]=e[ne]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:f=i,appearToClass:u=a,leaveFromClass:g=`${n}-leave-from`,leaveActiveClass:_=`${n}-leave-active`,leaveToClass:I=`${n}-leave-to`}=e,F=Jm(s),$=F&&F[0],Q=F&&F[1],{onBeforeEnter:ae,onEnter:q,onEnterCancelled:ee,onLeave:te,onLeaveCancelled:Te,onBeforeAppear:ve=ae,onAppear:ye=q,onAppearCancelled:Le=ee}=t,le=(ne,Pe,Ye,Ge)=>{ne._enterCancelled=Ge,Ss(ne,Pe?u:a),Ss(ne,Pe?f:i),Ye&&Ye()},re=(ne,Pe)=>{ne._isLeaving=!1,Ss(ne,g),Ss(ne,I),Ss(ne,_),Pe&&Pe()},ce=ne=>(Pe,Ye)=>{const Ge=ne?ye:q,Ve=()=>le(Pe,ne,Ye);Ts(Ge,[Pe,Ve]),Ac(()=>{Ss(Pe,ne?l:o),Rr(Pe,ne?u:a),Cc(Ge)||xc(Pe,r,$,Ve)})};return tn(t,{onBeforeEnter(ne){Ts(ae,[ne]),Rr(ne,o),Rr(ne,i)},onBeforeAppear(ne){Ts(ve,[ne]),Rr(ne,l),Rr(ne,f)},onEnter:ce(!1),onAppear:ce(!0),onLeave(ne,Pe){ne._isLeaving=!0;const Ye=()=>re(ne,Pe);Rr(ne,g),ne._enterCancelled?(Rr(ne,_),Mc(ne)):(Mc(ne),Rr(ne,_)),Ac(()=>{ne._isLeaving&&(Ss(ne,g),Rr(ne,I),Cc(te)||xc(ne,r,Q,Ye))}),Ts(te,[ne,Ye])},onEnterCancelled(ne){le(ne,!1,void 0,!0),Ts(ee,[ne])},onAppearCancelled(ne){le(ne,!0,void 0,!0),Ts(Le,[ne])},onLeaveCancelled(ne){re(ne),Ts(Te,[ne])}})}function Jm(e){if(e==null)return null;if(At(e))return[la(e.enter),la(e.leave)];{const t=la(e);return[t,t]}}function la(e){return Zh(e)}function Rr(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[jo]||(e[jo]=new Set)).add(t)}function Ss(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[jo];n&&(n.delete(t),n.size||(e[jo]=void 0))}function Ac(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Ym=0;function xc(e,t,n,r){const s=e._endId=++Ym,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=Qm(e,t);if(!i)return r();const f=i+"end";let u=0;const g=()=>{e.removeEventListener(f,_),o()},_=I=>{I.target===e&&++u>=l&&g()};setTimeout(()=>{u<l&&g()},a+1),e.addEventListener(f,_)}function Qm(e,t){const n=window.getComputedStyle(e),r=F=>(n[F]||"").split(", "),s=r(`${Zr}Delay`),o=r(`${Zr}Duration`),i=Rc(s,o),a=r(`${po}Delay`),l=r(`${po}Duration`),f=Rc(a,l);let u=null,g=0,_=0;t===Zr?i>0&&(u=Zr,g=i,_=o.length):t===po?f>0&&(u=po,g=f,_=l.length):(g=Math.max(i,f),u=g>0?i>f?Zr:po:null,_=u?u===Zr?o.length:l.length:0);const I=u===Zr&&/\b(?:transform|all)(?:,|$)/.test(r(`${Zr}Property`).toString());return{type:u,timeout:g,propCount:_,hasTransform:I}}function Rc(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Pc(n)+Pc(e[r])))}function Pc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Mc(e){return(e?e.ownerDocument:document).body.offsetHeight}function Xm(e,t,n){const r=e[jo];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const $c=Symbol("_vod"),Zm=Symbol("_vsh"),eg=Symbol(""),tg=/(?:^|;)\s*display\s*:/;function ng(e,t,n){const r=e.style,s=Gt(n);let o=!1;if(n&&!s){if(t)if(Gt(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&hi(r,a,"")}else for(const i in t)n[i]==null&&hi(r,i,"");for(const i in n)i==="display"&&(o=!0),hi(r,i,n[i])}else if(s){if(t!==n){const i=r[eg];i&&(n+=";"+i),r.cssText=n,o=tg.test(n)}}else t&&e.removeAttribute("style");$c in e&&(e[$c]=o?r.display:"",e[Zm]&&(r.display="none"))}const Oc=/\s*!important$/;function hi(e,t,n){if(Xe(n))n.forEach(r=>hi(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=rg(e,t);Oc.test(n)?e.setProperty(hs(r),n.replace(Oc,""),"important"):e[r]=n}}const Nc=["Webkit","Moz","ms"],ca={};function rg(e,t){const n=ca[t];if(n)return n;let r=Rn(t);if(r!=="filter"&&r in e)return ca[t]=r;r=Li(r);for(let s=0;s<Nc.length;s++){const o=Nc[s]+r;if(o in e)return ca[t]=o}return t}const Lc="http://www.w3.org/1999/xlink";function Dc(e,t,n,r,s,o=op(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Lc,t.slice(6,t.length)):e.setAttributeNS(Lc,t,n):n==null||o&&!vd(n)?e.removeAttribute(t):e.setAttribute(t,o?"":lr(n)?String(n):n)}function jc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?If(n):n);return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){const a=o==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let i=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=vd(n):n==null&&a==="string"?(n="",i=!0):a==="number"&&(n=0,i=!0)}try{e[t]=n}catch{}i&&e.removeAttribute(s||t)}function Vs(e,t,n,r){e.addEventListener(t,n,r)}function sg(e,t,n,r){e.removeEventListener(t,n,r)}const Fc=Symbol("_vei");function og(e,t,n,r,s=null){const o=e[Fc]||(e[Fc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=ig(t);if(r){const f=o[t]=cg(r,s);Vs(e,a,f,l)}else i&&(sg(e,a,i,l),o[t]=void 0)}}const Bc=/(?:Once|Passive|Capture)$/;function ig(e){let t;if(Bc.test(e)){t={};let r;for(;r=e.match(Bc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):hs(e.slice(2)),t]}let ua=0;const ag=Promise.resolve(),lg=()=>ua||(ag.then(()=>ua=0),ua=Date.now());function cg(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;ur(ug(r,n.value),t,5,[r])};return n.value=e,n.attached=lg(),n}function ug(e,t){if(Xe(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const Uc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,dg=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?Xm(e,r,i):t==="style"?ng(e,n,r):Oi(t)?wl(t)||og(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):fg(e,t,r,i))?(jc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Dc(e,t,r,i,o,t!=="value")):e._isVueCE&&(hg(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Gt(r)))?jc(e,Rn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Dc(e,t,r,i))};function fg(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Uc(t)&&nt(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 s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Uc(t)&&Gt(n)?!1:t in e}function hg(e,t){const n=e._def.props;if(!n)return!1;const r=Rn(t);return Array.isArray(n)?n.some(s=>Rn(s)===r):Object.keys(n).some(s=>Rn(s)===r)}const Hc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Xe(t)?n=>ci(t,n):t};function pg(e){e.target.composing=!0}function Wc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const da=Symbol("_assign");function Vc(e,t,n){return t&&(e=e.trim()),n&&(e=kl(e)),e}const Wr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[da]=Hc(s);const o=r||s.props&&s.props.type==="number";Vs(e,t?"change":"input",i=>{i.target.composing||e[da](Vc(e.value,n,o))}),(n||o)&&Vs(e,"change",()=>{e.value=Vc(e.value,n,o)}),t||(Vs(e,"compositionstart",pg),Vs(e,"compositionend",Wc),Vs(e,"change",Wc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[da]=Hc(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?kl(e.value):e.value,l=t??"";a!==l&&(document.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l))}},mg=["ctrl","shift","alt","meta"],gg={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)=>mg.some(n=>e[`${n}Key`]&&!t.includes(n))},kt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((s,...o)=>{for(let i=0;i<t.length;i++){const a=gg[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},vg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},xn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=hs(s.key);if(t.some(i=>i===o||vg[i]===o))return e(s)}))},yg=tn({patchProp:dg},zm);let zc;function wg(){return zc||(zc=Em(yg))}const bg=((...e)=>{const t=wg().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=kg(r);if(!s)return;const o=t._component;!nt(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,_g(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function _g(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function kg(e){return Gt(e)?document.querySelector(e):e}/*!
|
|
18
|
+
* vue-router v4.6.4
|
|
19
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
20
|
+
* @license MIT
|
|
21
|
+
*/const zs=typeof document<"u";function Af(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Tg(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Af(e.default)}const Et=Object.assign;function fa(e,t){const n={};for(const r in t){const s=t[r];n[r]=dr(s)?s.map(e):e(s)}return n}const Co=()=>{},dr=Array.isArray;function qc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const xf=/#/g,Sg=/&/g,Ig=/\//g,Eg=/=/g,Cg=/\?/g,Rf=/\+/g,Ag=/%5B/g,xg=/%5D/g,Pf=/%5E/g,Rg=/%60/g,Mf=/%7B/g,Pg=/%7C/g,$f=/%7D/g,Mg=/%20/g;function jl(e){return e==null?"":encodeURI(""+e).replace(Pg,"|").replace(Ag,"[").replace(xg,"]")}function $g(e){return jl(e).replace(Mf,"{").replace($f,"}").replace(Pf,"^")}function Qa(e){return jl(e).replace(Rf,"%2B").replace(Mg,"+").replace(xf,"%23").replace(Sg,"%26").replace(Rg,"`").replace(Mf,"{").replace($f,"}").replace(Pf,"^")}function Og(e){return Qa(e).replace(Eg,"%3D")}function Ng(e){return jl(e).replace(xf,"%23").replace(Cg,"%3F")}function Lg(e){return Ng(e).replace(Ig,"%2F")}function Fo(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Dg=/\/$/,jg=e=>e.replace(Dg,"");function ha(e,t,n="/"){let r,s={},o="",i="";const a=t.indexOf("#");let l=t.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=t.slice(0,l),o=t.slice(l,a>0?a:t.length),s=e(o.slice(1))),a>=0&&(r=r||t.slice(0,a),i=t.slice(a,t.length)),r=Hg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:Fo(i)}}function Fg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Gc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Bg(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&no(t.matched[r],n.matched[s])&&Of(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function no(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Of(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Ug(e[n],t[n]))return!1;return!0}function Ug(e,t){return dr(e)?Kc(e,t):dr(t)?Kc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Kc(e,t){return dr(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Hg(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let o=n.length-1,i,a;for(i=0;i<r.length;i++)if(a=r[i],a!==".")if(a==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i).join("/")}const es={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Xa=(function(e){return e.pop="pop",e.push="push",e})({}),pa=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Wg(e){if(!e)if(zs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),jg(e)}const Vg=/^[^#]+#/;function zg(e,t){return e.replace(Vg,"#")+t}function qg(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 Gi=()=>({left:window.scrollX,top:window.scrollY});function Gg(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=qg(s,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 Jc(e,t){return(history.state?history.state.position-t:-1)+e}const Za=new Map;function Kg(e,t){Za.set(e,t)}function Jg(e){const t=Za.get(e);return Za.delete(e),t}function Yg(e){return typeof e=="string"||e&&typeof e=="object"}function Nf(e){return typeof e=="string"||typeof e=="symbol"}let Jt=(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 Lf=Symbol("");Jt.MATCHER_NOT_FOUND+"",Jt.NAVIGATION_GUARD_REDIRECT+"",Jt.NAVIGATION_ABORTED+"",Jt.NAVIGATION_CANCELLED+"",Jt.NAVIGATION_DUPLICATED+"";function ro(e,t){return Et(new Error,{type:e,[Lf]:!0},t)}function Pr(e,t){return e instanceof Error&&Lf in e&&(t==null||!!(e.type&t))}const Qg=["params","query","hash"];function Xg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Qg)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Zg(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 s=n[r].replace(Rf," "),o=s.indexOf("="),i=Fo(o<0?s:s.slice(0,o)),a=o<0?null:Fo(s.slice(o+1));if(i in t){let l=t[i];dr(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Yc(e){let t="";for(let n in e){const r=e[n];if(n=Og(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(dr(r)?r.map(s=>s&&Qa(s)):[r&&Qa(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function ev(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=dr(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const tv=Symbol(""),Qc=Symbol(""),Ki=Symbol(""),Fl=Symbol(""),el=Symbol("");function mo(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function ss(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const f=_=>{_===!1?l(ro(Jt.NAVIGATION_ABORTED,{from:n,to:t})):_ instanceof Error?l(_):Yg(_)?l(ro(Jt.NAVIGATION_GUARD_REDIRECT,{from:t,to:_})):(i&&r.enterCallbacks[s]===i&&typeof _=="function"&&i.push(_),a())},u=o(()=>e.call(r&&r.instances[s],t,n,f));let g=Promise.resolve(u);e.length<3&&(g=g.then(f)),g.catch(_=>l(_))})}function ma(e,t,n,r,s=o=>o()){const o=[];for(const i of e)for(const a in i.components){let l=i.components[a];if(!(t!=="beforeRouteEnter"&&!i.instances[a]))if(Af(l)){const f=(l.__vccOpts||l)[t];f&&o.push(ss(f,n,r,i,a,s))}else{let f=l();o.push(()=>f.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const g=Tg(u)?u.default:u;i.mods[a]=u,i.components[a]=g;const _=(g.__vccOpts||g)[t];return _&&ss(_,n,r,i,a,s)()}))}}return o}function nv(e,t){const n=[],r=[],s=[],o=Math.max(t.matched.length,e.matched.length);for(let i=0;i<o;i++){const a=t.matched[i];a&&(e.matched.find(f=>no(f,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(f=>no(f,l))||s.push(l))}return[n,r,s]}/*!
|
|
22
|
+
* vue-router v4.6.4
|
|
23
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
24
|
+
* @license MIT
|
|
25
|
+
*/let rv=()=>location.protocol+"//"+location.host;function Df(e,t){const{pathname:n,search:r,hash:s}=t,o=e.indexOf("#");if(o>-1){let i=s.includes(e.slice(o))?e.slice(o).length:1,a=s.slice(i);return a[0]!=="/"&&(a="/"+a),Gc(a,"")}return Gc(n,e)+r+s}function sv(e,t,n,r){let s=[],o=[],i=null;const a=({state:_})=>{const I=Df(e,location),F=n.value,$=t.value;let Q=0;if(_){if(n.value=I,t.value=_,i&&i===F){i=null;return}Q=$?_.position-$.position:0}else r(I);s.forEach(ae=>{ae(n.value,F,{delta:Q,type:Xa.pop,direction:Q?Q>0?pa.forward:pa.back:pa.unknown})})};function l(){i=n.value}function f(_){s.push(_);const I=()=>{const F=s.indexOf(_);F>-1&&s.splice(F,1)};return o.push(I),I}function u(){if(document.visibilityState==="hidden"){const{history:_}=window;if(!_.state)return;_.replaceState(Et({},_.state,{scroll:Gi()}),"")}}function g(){for(const _ of o)_();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:f,destroy:g}}function Xc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?Gi():null}}function ov(e){const{history:t,location:n}=window,r={value:Df(e,n)},s={value:t.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(l,f,u){const g=e.indexOf("#"),_=g>-1?(n.host&&document.querySelector("base")?e:e.slice(g))+l:rv()+e+l;try{t[u?"replaceState":"pushState"](f,"",_),s.value=f}catch(I){console.error(I),n[u?"replace":"assign"](_)}}function i(l,f){o(l,Et({},t.state,Xc(s.value.back,l,s.value.forward,!0),f,{position:s.value.position}),!0),r.value=l}function a(l,f){const u=Et({},s.value,t.state,{forward:l,scroll:Gi()});o(u.current,u,!0),o(l,Et({},Xc(r.value,l,null),{position:u.position+1},f),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function iv(e){e=Wg(e);const t=ov(e),n=sv(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=Et({location:"",base:e,go:r,createHref:zg.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}function av(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),iv(e)}let Rs=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Zt=(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})(Zt||{});const lv={type:Rs.Static,value:""},cv=/[a-zA-Z0-9_]/;function uv(e){if(!e)return[[]];if(e==="/")return[[lv]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(I){throw new Error(`ERR (${n})/"${f}": ${I}`)}let n=Zt.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,f="",u="";function g(){f&&(n===Zt.Static?o.push({type:Rs.Static,value:f}):n===Zt.Param||n===Zt.ParamRegExp||n===Zt.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${f}) must be alone in its segment. eg: '/:ids+.`),o.push({type:Rs.Param,value:f,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),f="")}function _(){f+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Zt.ParamRegExp){r=n,n=Zt.EscapeNext;continue}switch(n){case Zt.Static:l==="/"?(f&&g(),i()):l===":"?(g(),n=Zt.Param):_();break;case Zt.EscapeNext:_(),n=r;break;case Zt.Param:l==="("?n=Zt.ParamRegExp:cv.test(l)?_():(g(),n=Zt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Zt.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=Zt.ParamRegExpEnd:u+=l;break;case Zt.ParamRegExpEnd:g(),n=Zt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===Zt.ParamRegExp&&t(`Unfinished custom RegExp for param "${f}"`),g(),i(),s}const Zc="[^/]+?",dv={sensitive:!1,strict:!1,start:!0,end:!0};var Cn=(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})(Cn||{});const fv=/[.+*?^${}()[\]/\\]/g;function hv(e,t){const n=Et({},dv,t),r=[];let s=n.start?"^":"";const o=[];for(const f of e){const u=f.length?[]:[Cn.Root];n.strict&&!f.length&&(s+="/");for(let g=0;g<f.length;g++){const _=f[g];let I=Cn.Segment+(n.sensitive?Cn.BonusCaseSensitive:0);if(_.type===Rs.Static)g||(s+="/"),s+=_.value.replace(fv,"\\$&"),I+=Cn.Static;else if(_.type===Rs.Param){const{value:F,repeatable:$,optional:Q,regexp:ae}=_;o.push({name:F,repeatable:$,optional:Q});const q=ae||Zc;if(q!==Zc){I+=Cn.BonusCustomRegExp;try{`${q}`}catch(te){throw new Error(`Invalid custom RegExp for param "${F}" (${q}): `+te.message)}}let ee=$?`((?:${q})(?:/(?:${q}))*)`:`(${q})`;g||(ee=Q&&f.length<2?`(?:/${ee})`:"/"+ee),Q&&(ee+="?"),s+=ee,I+=Cn.Dynamic,Q&&(I+=Cn.BonusOptional),$&&(I+=Cn.BonusRepeatable),q===".*"&&(I+=Cn.BonusWildcard)}u.push(I)}r.push(u)}if(n.strict&&n.end){const f=r.length-1;r[f][r[f].length-1]+=Cn.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(f){const u=f.match(i),g={};if(!u)return null;for(let _=1;_<u.length;_++){const I=u[_]||"",F=o[_-1];g[F.name]=I&&F.repeatable?I.split("/"):I}return g}function l(f){let u="",g=!1;for(const _ of e){(!g||!u.endsWith("/"))&&(u+="/"),g=!1;for(const I of _)if(I.type===Rs.Static)u+=I.value;else if(I.type===Rs.Param){const{value:F,repeatable:$,optional:Q}=I,ae=F in f?f[F]:"";if(dr(ae)&&!$)throw new Error(`Provided param "${F}" is an array but it is not repeatable (* or + modifiers)`);const q=dr(ae)?ae.join("/"):ae;if(!q)if(Q)_.length<2&&(u.endsWith("/")?u=u.slice(0,-1):g=!0);else throw new Error(`Missing required param "${F}"`);u+=q}}return u||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function pv(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]===Cn.Static+Cn.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===Cn.Static+Cn.Segment?1:-1:0}function jf(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=pv(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(eu(r))return 1;if(eu(s))return-1}return s.length-r.length}function eu(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const mv={strict:!1,end:!0,sensitive:!1};function gv(e,t,n){const r=hv(uv(e.path),n),s=Et(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function vv(e,t){const n=[],r=new Map;t=qc(mv,t);function s(g){return r.get(g)}function o(g,_,I){const F=!I,$=nu(g);$.aliasOf=I&&I.record;const Q=qc(t,g),ae=[$];if("alias"in g){const te=typeof g.alias=="string"?[g.alias]:g.alias;for(const Te of te)ae.push(nu(Et({},$,{components:I?I.record.components:$.components,path:Te,aliasOf:I?I.record:$})))}let q,ee;for(const te of ae){const{path:Te}=te;if(_&&Te[0]!=="/"){const ve=_.record.path,ye=ve[ve.length-1]==="/"?"":"/";te.path=_.record.path+(Te&&ye+Te)}if(q=gv(te,_,Q),I?I.alias.push(q):(ee=ee||q,ee!==q&&ee.alias.push(q),F&&g.name&&!ru(q)&&i(g.name)),Ff(q)&&l(q),$.children){const ve=$.children;for(let ye=0;ye<ve.length;ye++)o(ve[ye],q,I&&I.children[ye])}I=I||q}return ee?()=>{i(ee)}:Co}function i(g){if(Nf(g)){const _=r.get(g);_&&(r.delete(g),n.splice(n.indexOf(_),1),_.children.forEach(i),_.alias.forEach(i))}else{const _=n.indexOf(g);_>-1&&(n.splice(_,1),g.record.name&&r.delete(g.record.name),g.children.forEach(i),g.alias.forEach(i))}}function a(){return n}function l(g){const _=bv(g,n);n.splice(_,0,g),g.record.name&&!ru(g)&&r.set(g.record.name,g)}function f(g,_){let I,F={},$,Q;if("name"in g&&g.name){if(I=r.get(g.name),!I)throw ro(Jt.MATCHER_NOT_FOUND,{location:g});Q=I.record.name,F=Et(tu(_.params,I.keys.filter(ee=>!ee.optional).concat(I.parent?I.parent.keys.filter(ee=>ee.optional):[]).map(ee=>ee.name)),g.params&&tu(g.params,I.keys.map(ee=>ee.name))),$=I.stringify(F)}else if(g.path!=null)$=g.path,I=n.find(ee=>ee.re.test($)),I&&(F=I.parse($),Q=I.record.name);else{if(I=_.name?r.get(_.name):n.find(ee=>ee.re.test(_.path)),!I)throw ro(Jt.MATCHER_NOT_FOUND,{location:g,currentLocation:_});Q=I.record.name,F=Et({},_.params,g.params),$=I.stringify(F)}const ae=[];let q=I;for(;q;)ae.unshift(q.record),q=q.parent;return{name:Q,path:$,params:F,matched:ae,meta:wv(ae)}}e.forEach(g=>o(g));function u(){n.length=0,r.clear()}return{addRoute:o,resolve:f,removeRoute:i,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function tu(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function nu(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:yv(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 yv(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 ru(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function wv(e){return e.reduce((t,n)=>Et(t,n.meta),{})}function bv(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;jf(e,t[o])<0?r=o:n=o+1}const s=_v(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function _v(e){let t=e;for(;t=t.parent;)if(Ff(t)&&jf(e,t)===0)return t}function Ff({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function su(e){const t=ir(Ki),n=ir(Fl),r=de(()=>{const l=be(e.to);return t.resolve(l)}),s=de(()=>{const{matched:l}=r.value,{length:f}=l,u=l[f-1],g=n.matched;if(!u||!g.length)return-1;const _=g.findIndex(no.bind(null,u));if(_>-1)return _;const I=ou(l[f-2]);return f>1&&ou(u)===I&&g[g.length-1].path!==I?g.findIndex(no.bind(null,l[f-2])):_}),o=de(()=>s.value>-1&&Ev(n.params,r.value.params)),i=de(()=>s.value>-1&&s.value===n.matched.length-1&&Of(n.params,r.value.params));function a(l={}){if(Iv(l)){const f=t[be(e.replace)?"replace":"push"](be(e.to)).catch(Co);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>f),f}return Promise.resolve()}return{route:r,href:de(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function kv(e){return e.length===1?e[0]:e}const Tv=cn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:su,setup(e,{slots:t}){const n=Fi(su(e)),{options:r}=ir(Ki),s=de(()=>({[iu(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[iu(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&kv(t.default(n));return e.custom?o:Dl("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),Sv=Tv;function Iv(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 Ev(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!dr(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function ou(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const iu=(e,t,n)=>e??t??n,Cv=cn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=ir(el),s=de(()=>e.route||r.value),o=ir(Qc,0),i=de(()=>{let f=be(o);const{matched:u}=s.value;let g;for(;(g=u[f])&&!g.components;)f++;return f}),a=de(()=>s.value.matched[i.value]);ui(Qc,de(()=>i.value+1)),ui(tv,a),ui(el,s);const l=D();return ht(()=>[l.value,a.value,e.name],([f,u,g],[_,I,F])=>{u&&(u.instances[g]=f,I&&I!==u&&f&&f===_&&(u.leaveGuards.size||(u.leaveGuards=I.leaveGuards),u.updateGuards.size||(u.updateGuards=I.updateGuards))),f&&u&&(!I||!no(u,I)||!_)&&(u.enterCallbacks[g]||[]).forEach($=>$(f))},{flush:"post"}),()=>{const f=s.value,u=e.name,g=a.value,_=g&&g.components[u];if(!_)return au(n.default,{Component:_,route:f});const I=g.props[u],F=I?I===!0?f.params:typeof I=="function"?I(f):I:null,Q=Dl(_,Et({},F,t,{onVnodeUnmounted:ae=>{ae.component.isUnmounted&&(g.instances[u]=null)},ref:l}));return au(n.default,{Component:Q,route:f})||Q}}});function au(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Av=Cv;function xv(e){const t=vv(e.routes,e),n=e.parseQuery||Zg,r=e.stringifyQuery||Yc,s=e.history,o=mo(),i=mo(),a=mo(),l=Ap(es);let f=es;zs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=fa.bind(null,V=>""+V),g=fa.bind(null,Lg),_=fa.bind(null,Fo);function I(V,_e){let he,ge;return Nf(V)?(he=t.getRecordMatcher(V),ge=_e):ge=V,t.addRoute(ge,he)}function F(V){const _e=t.getRecordMatcher(V);_e&&t.removeRoute(_e)}function $(){return t.getRoutes().map(V=>V.record)}function Q(V){return!!t.getRecordMatcher(V)}function ae(V,_e){if(_e=Et({},_e||l.value),typeof V=="string"){const O=ha(n,V,_e.path),z=t.resolve({path:O.path},_e),Y=s.createHref(O.fullPath);return Et(O,z,{params:_(z.params),hash:Fo(O.hash),redirectedFrom:void 0,href:Y})}let he;if(V.path!=null)he=Et({},V,{path:ha(n,V.path,_e.path).path});else{const O=Et({},V.params);for(const z in O)O[z]==null&&delete O[z];he=Et({},V,{params:g(O)}),_e.params=g(_e.params)}const ge=t.resolve(he,_e),Ce=V.hash||"";ge.params=u(_(ge.params));const T=Fg(r,Et({},V,{hash:$g(Ce),path:ge.path})),E=s.createHref(T);return Et({fullPath:T,hash:Ce,query:r===Yc?ev(V.query):V.query||{}},ge,{redirectedFrom:void 0,href:E})}function q(V){return typeof V=="string"?ha(n,V,l.value.path):Et({},V)}function ee(V,_e){if(f!==V)return ro(Jt.NAVIGATION_CANCELLED,{from:_e,to:V})}function te(V){return ye(V)}function Te(V){return te(Et(q(V),{replace:!0}))}function ve(V,_e){const he=V.matched[V.matched.length-1];if(he&&he.redirect){const{redirect:ge}=he;let Ce=typeof ge=="function"?ge(V,_e):ge;return typeof Ce=="string"&&(Ce=Ce.includes("?")||Ce.includes("#")?Ce=q(Ce):{path:Ce},Ce.params={}),Et({query:V.query,hash:V.hash,params:Ce.path!=null?{}:V.params},Ce)}}function ye(V,_e){const he=f=ae(V),ge=l.value,Ce=V.state,T=V.force,E=V.replace===!0,O=ve(he,ge);if(O)return ye(Et(q(O),{state:typeof O=="object"?Et({},Ce,O.state):Ce,force:T,replace:E}),_e||he);const z=he;z.redirectedFrom=_e;let Y;return!T&&Bg(r,ge,he)&&(Y=ro(Jt.NAVIGATION_DUPLICATED,{to:z,from:ge}),Be(ge,ge,!0,!1)),(Y?Promise.resolve(Y):re(z,ge)).catch(N=>Pr(N)?Pr(N,Jt.NAVIGATION_GUARD_REDIRECT)?N:Ae(N):Re(N,z,ge)).then(N=>{if(N){if(Pr(N,Jt.NAVIGATION_GUARD_REDIRECT))return ye(Et({replace:E},q(N.to),{state:typeof N.to=="object"?Et({},Ce,N.to.state):Ce,force:T}),_e||z)}else N=ne(z,ge,!0,E,Ce);return ce(z,ge,N),N})}function Le(V,_e){const he=ee(V,_e);return he?Promise.reject(he):Promise.resolve()}function le(V){const _e=mt.values().next().value;return _e&&typeof _e.runWithContext=="function"?_e.runWithContext(V):V()}function re(V,_e){let he;const[ge,Ce,T]=nv(V,_e);he=ma(ge.reverse(),"beforeRouteLeave",V,_e);for(const O of ge)O.leaveGuards.forEach(z=>{he.push(ss(z,V,_e))});const E=Le.bind(null,V,_e);return he.push(E),He(he).then(()=>{he=[];for(const O of o.list())he.push(ss(O,V,_e));return he.push(E),He(he)}).then(()=>{he=ma(Ce,"beforeRouteUpdate",V,_e);for(const O of Ce)O.updateGuards.forEach(z=>{he.push(ss(z,V,_e))});return he.push(E),He(he)}).then(()=>{he=[];for(const O of T)if(O.beforeEnter)if(dr(O.beforeEnter))for(const z of O.beforeEnter)he.push(ss(z,V,_e));else he.push(ss(O.beforeEnter,V,_e));return he.push(E),He(he)}).then(()=>(V.matched.forEach(O=>O.enterCallbacks={}),he=ma(T,"beforeRouteEnter",V,_e,le),he.push(E),He(he))).then(()=>{he=[];for(const O of i.list())he.push(ss(O,V,_e));return he.push(E),He(he)}).catch(O=>Pr(O,Jt.NAVIGATION_CANCELLED)?O:Promise.reject(O))}function ce(V,_e,he){a.list().forEach(ge=>le(()=>ge(V,_e,he)))}function ne(V,_e,he,ge,Ce){const T=ee(V,_e);if(T)return T;const E=_e===es,O=zs?history.state:{};he&&(ge||E?s.replace(V.fullPath,Et({scroll:E&&O&&O.scroll},Ce)):s.push(V.fullPath,Ce)),l.value=V,Be(V,_e,he,E),Ae()}let Pe;function Ye(){Pe||(Pe=s.listen((V,_e,he)=>{if(!ct.listening)return;const ge=ae(V),Ce=ve(ge,ct.currentRoute.value);if(Ce){ye(Et(Ce,{replace:!0,force:!0}),ge).catch(Co);return}f=ge;const T=l.value;zs&&Kg(Jc(T.fullPath,he.delta),Gi()),re(ge,T).catch(E=>Pr(E,Jt.NAVIGATION_ABORTED|Jt.NAVIGATION_CANCELLED)?E:Pr(E,Jt.NAVIGATION_GUARD_REDIRECT)?(ye(Et(q(E.to),{force:!0}),ge).then(O=>{Pr(O,Jt.NAVIGATION_ABORTED|Jt.NAVIGATION_DUPLICATED)&&!he.delta&&he.type===Xa.pop&&s.go(-1,!1)}).catch(Co),Promise.reject()):(he.delta&&s.go(-he.delta,!1),Re(E,ge,T))).then(E=>{E=E||ne(ge,T,!1),E&&(he.delta&&!Pr(E,Jt.NAVIGATION_CANCELLED)?s.go(-he.delta,!1):he.type===Xa.pop&&Pr(E,Jt.NAVIGATION_ABORTED|Jt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),ce(ge,T,E)}).catch(Co)}))}let Ge=mo(),Ve=mo(),Ue;function Re(V,_e,he){Ae(V);const ge=Ve.list();return ge.length?ge.forEach(Ce=>Ce(V,_e,he)):console.error(V),Promise.reject(V)}function rt(){return Ue&&l.value!==es?Promise.resolve():new Promise((V,_e)=>{Ge.add([V,_e])})}function Ae(V){return Ue||(Ue=!V,Ye(),Ge.list().forEach(([_e,he])=>V?he(V):_e()),Ge.reset()),V}function Be(V,_e,he,ge){const{scrollBehavior:Ce}=e;if(!zs||!Ce)return Promise.resolve();const T=!he&&Jg(Jc(V.fullPath,0))||(ge||!he)&&history.state&&history.state.scroll||null;return en().then(()=>Ce(V,_e,T)).then(E=>E&&Gg(E)).catch(E=>Re(E,V,_e))}const lt=V=>s.go(V);let Ht;const mt=new Set,ct={currentRoute:l,listening:!0,addRoute:I,removeRoute:F,clearRoutes:t.clearRoutes,hasRoute:Q,getRoutes:$,resolve:ae,options:e,push:te,replace:Te,go:lt,back:()=>lt(-1),forward:()=>lt(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:Ve.add,isReady:rt,install(V){V.component("RouterLink",Sv),V.component("RouterView",Av),V.config.globalProperties.$router=ct,Object.defineProperty(V.config.globalProperties,"$route",{enumerable:!0,get:()=>be(l)}),zs&&!Ht&&l.value===es&&(Ht=!0,te(s.location).catch(ge=>{}));const _e={};for(const ge in es)Object.defineProperty(_e,ge,{get:()=>l.value[ge],enumerable:!0});V.provide(Ki,ct),V.provide(Fl,Od(_e)),V.provide(el,l);const he=V.unmount;mt.add(V),V.unmount=function(){mt.delete(V),mt.size<1&&(f=es,Pe&&Pe(),Pe=null,l.value=es,Ht=!1,Ue=!1),he()}}};function He(V){return V.reduce((_e,he)=>_e.then(()=>le(he)),Promise.resolve())}return ct}function Rv(){return ir(Ki)}function Pv(e){return ir(Fl)}const lu=768;function Bf(){const e=D(typeof window<"u"?window.innerWidth<lu:!1);let t=null;function n(r){e.value=r.matches}return Gr(()=>{t=window.matchMedia(`(max-width: ${lu-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Wi(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const Mv={key:0,class:"desktop-sidebar"},$v={class:"desktop-main"},cu="codex-web-local.sidebar-width.v1",Ov=260,Nv=620,uu=320,Lv=cn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Bf();function r(f){return Math.min(Nv,Math.max(Ov,f))}function s(){if(typeof window>"u")return uu;const f=window.localStorage.getItem(cu),u=Number(f);return Number.isFinite(u)?r(u):uu}const o=D(s()),i=de(()=>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 a(f){typeof window>"u"||window.localStorage.setItem(cu,String(f))}function l(f){f.preventDefault();const u=f.clientX,g=o.value,_=F=>{const $=F.clientX-u;o.value=r(g+$)},I=()=>{a(o.value),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",I)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",I)}return(f,u)=>(y(),k("div",{class:tt(["desktop-layout",{"is-mobile":be(n)}]),style:cs(i.value)},[be(n)?(y(),wt(To,{key:0,to:"body"},[De(Cf,{name:"drawer"},{default:It(()=>[e.isSidebarCollapsed?fe("",!0):(y(),k("div",{key:0,class:"mobile-drawer-backdrop",onClick:u[1]||(u[1]=g=>f.$emit("close-sidebar"))},[v("aside",{class:"mobile-drawer",onClick:u[0]||(u[0]=kt(()=>{},["stop"]))},[Tr(f.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):fe("",!0),be(n)?fe("",!0):(y(),k(Ne,{key:1},[e.isSidebarCollapsed?fe("",!0):(y(),k("aside",Mv,[Tr(f.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?fe("",!0):(y(),k("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),v("section",$v,[Tr(f.$slots,"content",{},void 0)])],6))}}),yt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},Dv=yt(Lv,[["__scopeId","data-v-068d06c5"]]),jv={},Fv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Bv(e,t){return y(),k("svg",Fv,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Ji=yt(jv,[["render",Bv]]),Uv={},Hv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Wv(e,t){return y(),k("svg",Hv,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const Uf=yt(Uv,[["render",Wv]]),Vv={},zv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function qv(e,t){return y(),k("svg",zv,[...t[0]||(t[0]=[v("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 go=yt(Vv,[["render",qv]]),Gv={},Kv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Jv(e,t){return y(),k("svg",Kv,[...t[0]||(t[0]=[v("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 Ci=yt(Gv,[["render",Jv]]),Yv={},Qv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Xv(e,t){return y(),k("svg",Qv,[...t[0]||(t[0]=[v("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 Bl=yt(Yv,[["render",Xv]]),Zv={},ey={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ty(e,t){return y(),k("svg",ey,[...t[0]||(t[0]=[v("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 ny=yt(Zv,[["render",ty]]),ry={},sy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function oy(e,t){return y(),k("svg",sy,[...t[0]||(t[0]=[v("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 pi=yt(ry,[["render",oy]]),iy={},ay={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ly(e,t){return y(),k("svg",ay,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 4.5l-4 4L7 10l-1.5 1.5l7 7L14 17l1.5-4l4-4M9 15l-4.5 4.5M14.5 4L20 9.5"},null,-1)])])}const ga=yt(iy,[["render",ly]]),cy={key:0,class:"sidebar-menu-row-left"},uy={class:"sidebar-menu-row-main"},dy={key:1,class:"sidebar-menu-row-right"},fy={key:0,class:"sidebar-menu-row-right-default"},hy={key:1,class:"sidebar-menu-row-right-hover"},py=cn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=sm(),r=de(()=>!!n.left),s=de(()=>!!n.right),o=de(()=>!!n["right-hover"]),i=de(()=>s.value||o.value);return(a,l)=>(y(),wt(Ti(t.as),_f({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":i.value,"data-has-right-hover":o.value,"data-force-right-hover":t.forceRightHover},a.$attrs),{default:It(()=>[r.value?(y(),k("span",cy,[Tr(a.$slots,"left",{},void 0,!0)])):fe("",!0),v("span",uy,[Tr(a.$slots,"default",{},void 0,!0)]),i.value?(y(),k("span",dy,[s.value?(y(),k("span",fy,[Tr(a.$slots,"right",{},void 0,!0)])):fe("",!0),o.value?(y(),k("span",hy,[Tr(a.$slots,"right-hover",{},void 0,!0)])):fe("",!0)])):fe("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Is=yt(py,[["__scopeId","data-v-36239f39"]]),my={class:"thread-tree-root"},gy={key:0,class:"pinned-section"},vy={class:"thread-list"},yy=["data-menu-open"],wy={class:"thread-left-stack"},by=["data-state"],_y=["onClick"],ky=["onClick"],Ty={class:"thread-row-title-wrap"},Sy={class:"thread-row-title"},Iy={class:"thread-row-time"},Ey=["onClick"],Cy=["aria-expanded"],Ay=["data-active"],xy={key:0},Ry=["data-active"],Py={key:0},My={key:1,class:"thread-tree-no-results"},$y={key:2,class:"thread-tree-loading"},Oy={key:3,class:"thread-list thread-list-global"},Ny=["data-menu-open"],Ly={class:"thread-left-stack"},Dy=["data-state"],jy=["onClick"],Fy=["onClick"],By={class:"thread-row-title-wrap"},Uy={class:"thread-row-title"},Hy={class:"thread-row-time"},Wy=["onClick"],Vy=["data-project-name","data-expanded","data-dragging"],zy={class:"project-icon-stack"},qy={class:"project-icon-folder"},Gy={class:"project-icon-chevron"},Ky=["data-dragging-handle","onMousedown"],Jy={class:"project-title"},Yy={class:"project-hover-controls"},Qy=["onClick"],Xy=["data-open-direction"],Zy=["onClick"],ew=["onClick"],tw=["onClick"],nw=["onInput"],rw=["aria-label","title","onClick"],sw={key:0,class:"thread-list"},ow=["data-menu-open"],iw={class:"thread-left-stack"},aw=["data-state"],lw=["onClick"],cw=["onClick"],uw={class:"thread-row-title-wrap"},dw={class:"thread-row-title"},fw={class:"thread-row-time"},hw=["onClick"],pw=["onClick"],mw=["data-open-direction"],gw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},vw=["onKeydown"],yw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},ww={class:"rename-thread-subtitle"},bw=4,du=6,fu="codex-web-local.thread-view-mode.v1",hu="codex-web-local.collapsed-projects.v1",_w=cn({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},selectedThreadId:{},isLoading:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-project-files","rename-project","rename-thread","remove-project","reorder-project","export-thread"],setup(e,{emit:t}){const n=e,r=t,s=D({}),o=D({}),i=D([]),a=D(""),l=D(""),f=D({}),u=D({}),g=D({}),_=D("actions"),I=D(""),F=D(!1),$=D(""),Q=D(""),ae=D(null),q=D(!1),ee=D(""),te=D(""),Te=D(null),ve=D(null),ye=D(null);let Le=null,le=null;const re=D(""),ce=D({}),ne=new Map,Pe=new Map,Ye=new Map,Ge=new WeakMap,Ve=D(null),Ue=D(null),Re=D(!1),rt=D(lt()),Ae=typeof window<"u"?new ResizeObserver(S=>{for(const R of S){const P=R.target,J=Ge.get(P);J&&sn(J,P)}}):null;function Be(){if(typeof window>"u")return{};try{const S=window.localStorage.getItem(hu);if(!S)return{};const R=JSON.parse(S);return!R||typeof R!="object"||Array.isArray(R)?{}:R}catch{return{}}}function lt(){return typeof window>"u"?"project":window.localStorage.getItem(fu)==="chronological"?"chronological":"project"}o.value=Be(),ht(o,S=>{typeof window>"u"||window.localStorage.setItem(hu,JSON.stringify(S))},{deep:!0}),ht(rt,S=>{typeof window>"u"||window.localStorage.setItem(fu,S)});const Ht=de(()=>n.searchQuery.trim().toLowerCase()),mt=de(()=>Ht.value.length>0),ct=de(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function He(S){if(!mt.value)return!0;if(ct.value)return ct.value.has(S.id);const R=Ht.value;return S.title.toLowerCase().includes(R)||S.preview.toLowerCase().includes(R)}const V=de(()=>mt.value?n.groups.map(S=>({...S,threads:S.threads.filter(He)})).filter(S=>S.threads.length>0):n.groups),_e=de(()=>rt.value==="chronological"),he=de(()=>{const S=V.value,R=[];for(const P of S)for(const J of P.threads)B(J.id)||R.push(J);return R.sort((P,J)=>{const Fe=new Date(P.updatedAtIso||P.createdAtIso).getTime();return new Date(J.updatedAtIso||J.createdAtIso).getTime()-Fe})}),ge=de(()=>{const S=new Map;for(const R of n.groups)for(const P of R.threads)S.set(P.id,P);return S}),Ce=de(()=>{const S=l.value;return S?ge.value.get(S)??null:null}),T=de(()=>i.value.map(S=>ge.value.get(S)??null).filter(S=>S!==null).filter(He)),E=de(()=>{const S=ye.value;if(!S||S.dropTargetIndexFull===null||n.groups.length===0)return null;const R=Math.max(0,Math.min(S.dropTargetIndexFull,n.groups.length)),P=R>S.fromIndex?R-1:R,J=Math.max(0,Math.min(P,n.groups.length-1));return J===S.fromIndex?null:J}),O=de(()=>{const R=(mt.value?V.value:n.groups).map(qt=>qt.projectName),P=ye.value,J=E.value;if(!P||J===null)return R;const Fe=[...R],[St]=Fe.splice(P.fromIndex,1);return St?(Fe.splice(J,0,St),Fe):R}),z=de(()=>{const S={};let R=0;for(const P of O.value)S[P]=R,R+=Tn(P);return S}),Y=de(()=>{let S=0;for(const R of O.value)S+=Tn(R);return{height:`${Math.max(0,S)}px`}});function N(S){const R=new Date(S).getTime();if(Number.isNaN(R))return"n/a";const P=Math.abs(Date.now()-R);if(P<6e4)return"now";const J=Math.floor(P/6e4);if(J<60)return`${J}m`;const Fe=Math.floor(J/60);return Fe<24?`${Fe}h`:`${Math.floor(Fe/24)}d`}function B(S){return i.value.includes(S)}function H(S){if(B(S)){i.value=i.value.filter(R=>R!==S);return}i.value=[S,...i.value]}function X(S){r("select",S)}function Z(S){r("export-thread",S),xe()}function Ee(S){return`start new thread ${Bt(S)}`}function we(S){r("start-new-thread",S)}function ke(S){return l.value===S}function xe(){l.value="",g.value={}}function ze(S){if(l.value===S){xe();return}dt(),Re.value=!1,l.value=S,en(()=>{$e(S)})}function it(S,R){$.value=S,Q.value=R,F.value=!0,xe(),en(()=>{var P,J;(P=ae.value)==null||P.focus(),(J=ae.value)==null||J.select()})}function We(){F.value=!1,$.value="",Q.value=""}function pt(){const S=$.value,R=Q.value.trim();!S||!R||(r("rename-thread",{threadId:S,title:R}),We())}function bt(S,R){ee.value=S,te.value=R,q.value=!0,xe()}function Pt(){q.value=!1,ee.value="",te.value=""}function Ke(){const S=ee.value;S&&(i.value=i.value.filter(R=>R!==S),r("archive",S),Pt())}function Bt(S){return n.projectDisplayNameById[S]??S}function zt(S){return a.value===S}function dt(){a.value="",_.value="actions",I.value=""}function _t(){const S=!Re.value;S&&(dt(),xe()),Re.value=S}function gt(S){rt.value=S,Re.value=!1}function nn(S){if(a.value===S){dt();return}xe(),Re.value=!1,a.value=S,_.value="actions",I.value=Bt(S),en(()=>{Hn(S)})}function xt(S){xe(),a.value=S,_.value="rename",I.value=Bt(S),en(()=>{Hn(S)})}function Rt(S){r("rename-project",{projectName:S,displayName:I.value})}function Mn(S){r("remove-project",S),dt()}function Wt(S){r("browse-project-files",S),dt()}function $n(S,R){if(!S.altKey||S.key!=="ArrowUp"&&S.key!=="ArrowDown")return;const P=n.groups.findIndex(St=>St.projectName===R);if(P<0)return;const J=S.key==="ArrowUp"?-1:1,Fe=Math.max(0,Math.min(P+J,n.groups.length-1));Fe!==P&&(S.preventDefault(),r("reorder-project",{projectName:R,toIndex:Fe}))}function Mt(S){return s.value[S]===!0}function Kt(S){return o.value[S]===!0}function Dt(S){s.value={...s.value,[S]:!Mt(S)}}function rn(S){if(re.value===S){re.value="";return}o.value={...o.value,[S]:!Kt(S)}}function Tn(S){const R=ce.value[S]??0,P=ye.value,Fe=((P==null?void 0:P.projectName)===S?P.groupHeight:null)??R,St=Kt(S)?0:du;return Math.max(0,Fe+St)}function un(S,R){const P=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(P){Pe.set(S,P);return}Pe.delete(S)}function Bn(S,R){const P=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(P){Ye.set(S,P);return}Ye.delete(S)}function dn(S){let R=S.parentElement;for(;R;){const P=window.getComputedStyle(R),J=P.overflowY||P.overflow;if(J==="auto"||J==="scroll"||J==="hidden"||J==="clip")return R.getBoundingClientRect();R=R.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Un(S,R){const P=S.getBoundingClientRect(),J=dn(S),Fe=6,St=J.bottom-P.bottom,qt=P.top-J.top;return St>=R+Fe?"down":qt>St?"up":"down"}function Gn(S,R){const P=Ye.get(S);if(!P)return"down";const J=Un(P,R);return u.value={...u.value,[S]:J},J}function er(S){return u.value[S]??"down"}function Hn(S){const R=Pe.get(S);R&&(f.value={...f.value,[S]:Un(R,112)})}function Me(S,R,P){return Math.min(Math.max(S,R),P)}function $e(S){const R=Ye.get(S);if(!R)return;const P=Ue.value,J=P==null?void 0:P.getBoundingClientRect(),Fe=(J==null?void 0:J.height)||(P==null?void 0:P.offsetHeight)||112,St=(J==null?void 0:J.width)||(P==null?void 0:P.offsetWidth)||160,qt=Gn(S,Fe),In=R.getBoundingClientRect(),on=8,an=4,Dn=Math.max(on,window.innerWidth-St-on),fr=Me(In.right-St,on,Dn),rr=Me(qt==="up"?In.top-Fe-an:In.bottom+an,on,Math.max(on,window.innerHeight-Fe-on));g.value={left:`${Math.round(fr)}px`,top:`${Math.round(rr)}px`}}function On(){const S=l.value;S&&$e(S)}function Yt(){window.addEventListener("resize",On),document.addEventListener("scroll",On,!0)}function Wn(){window.removeEventListener("resize",On),document.removeEventListener("scroll",On,!0)}function Nn(S){const R=a.value;if(!R)return!1;const P=Pe.get(R);if(!P)return!1;if((typeof S.composedPath=="function"?S.composedPath():[]).includes(P))return!0;const Fe=S.target;return Fe instanceof Node?P.contains(Fe):!1}function mn(S){const R=l.value;if(!R)return!1;const P=Ye.get(R);if(!P)return!1;if((typeof S.composedPath=="function"?S.composedPath():[]).includes(P))return!0;const Fe=S.target;return Fe instanceof Node?P.contains(Fe):!1}function tr(S){if(Re.value){const R=Ve.value,P=typeof S.composedPath=="function"?S.composedPath():[];!!R&&(P.includes(R)||S.target instanceof Node&&R.contains(S.target))||(Re.value=!1)}a.value&&(Nn(S)||dt(),l.value&&(mn(S)||xe()))}function Kn(S){a.value&&!Nn(S)&&dt(),l.value&&!mn(S)&&xe()}function Ut(){Re.value&&(Re.value=!1),a.value&&dt(),l.value&&xe()}function fn(){window.addEventListener("pointerdown",tr,{capture:!0}),window.addEventListener("focusin",Kn,{capture:!0}),window.addEventListener("blur",Ut)}function nr(){window.removeEventListener("pointerdown",tr,{capture:!0}),window.removeEventListener("focusin",Kn,{capture:!0}),window.removeEventListener("blur",Ut)}function sn(S,R){const P=R.getBoundingClientRect().height;if(!Number.isFinite(P)||P<=0)return;const J=ce.value[S];J!==void 0&&Math.abs(J-P)<.5||(ce.value={...ce.value,[S]:P})}function x(S,R){const P=ne.get(S);P&&P!==R&&Ae&&Ae.unobserve(P);const J=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(J){ne.set(S,J),Ge.set(J,S),sn(S,J),Ae==null||Ae.observe(J);return}P&&(Ae==null||Ae.unobserve(P)),ne.delete(S)}function U(S,R){if(S.button!==0||ve.value||ye.value)return;const P=n.groups.findIndex(qt=>qt.projectName===R),J=ne.get(R);if(P<0||!J)return;const Fe=J.getBoundingClientRect(),St=Kt(R)?0:du;ve.value={projectName:R,fromIndex:P,startClientX:S.clientX,startClientY:S.clientY,pointerOffsetY:S.clientY-Fe.top,groupLeft:Fe.left,groupWidth:Fe.width,groupHeight:Fe.height,groupOuterHeight:Fe.height+St},S.preventDefault(),se()}function se(){window.addEventListener("mousemove",ot),window.addEventListener("mouseup",ut),window.addEventListener("keydown",ft)}function je(){window.removeEventListener("mousemove",ot),window.removeEventListener("mouseup",ut),window.removeEventListener("keydown",ft)}function ot(S){Le={clientX:S.clientX,clientY:S.clientY},Sn()}function ut(S){Vn({clientX:S.clientX,clientY:S.clientY});const R=ye.value;if(R&&E.value!==null){const P=n.groups.findIndex(J=>J.projectName===R.projectName);if(P>=0){const J=E.value;J!==P&&r("reorder-project",{projectName:R.projectName,toIndex:J})}}Ot()}function ft(S){S.key==="Escape"&&(!ve.value&&!ye.value||(S.preventDefault(),Ot()))}function Ot(){le!==null&&(window.cancelAnimationFrame(le),le=null),Le=null,ve.value=null,ye.value=null,re.value="",je()}function Sn(){le===null&&(le=window.requestAnimationFrame(()=>{if(le=null,!Le)return;const S=Le;Le=null,Vn(S)}))}function Vn(S){const R=ve.value;if(!ye.value&&R){const P=S.clientX-R.startClientX,J=S.clientY-R.startClientY;if(Math.hypot(P,J)<bw)return;dt(),re.value=R.projectName,ye.value={projectName:R.projectName,fromIndex:R.fromIndex,pointerOffsetY:R.pointerOffsetY,groupLeft:R.groupLeft,groupWidth:R.groupWidth,groupHeight:R.groupHeight,groupOuterHeight:R.groupOuterHeight,ghostTop:S.clientY-R.pointerOffsetY,dropTargetIndexFull:null}}ye.value&&Jr(S)}function Jr(S){const R=ye.value;if(!R)return;if(R.ghostTop=S.clientY-R.pointerOffsetY,!ms(S)){R.dropTargetIndexFull=null;return}const P=S.clientY,J=Te.value;if(!J){R.dropTargetIndexFull=null;return}const Fe=J.getBoundingClientRect(),St=new Map(n.groups.map((an,Dn)=>[an.projectName,Dn])),qt=n.groups.map(an=>an.projectName).filter(an=>an!==R.projectName);let In=0,on=n.groups.length;for(const an of qt){const Dn=St.get(an);if(Dn===void 0)continue;const fr=Tn(an),rr=Fe.top+In+fr/2;if(P<rr){on=Dn;break}In+=fr}R.dropTargetIndexFull=on}function ms(S){const R=Te.value;if(!R)return!1;const P=R.getBoundingClientRect(),J=S.clientX>=P.left&&S.clientX<=P.right,Fe=S.clientY>=P.top-32&&S.clientY<=P.bottom+32;return J&&Fe}function Yr(S){var R;return((R=ye.value)==null?void 0:R.projectName)===S}function Ln(S){const R=ye.value,P=z.value[S]??0,J=a.value===S;return!R||R.projectName!==S?{position:"absolute",top:"0",left:"0",right:"0",zIndex:J?"40":"1",transform:`translate3d(0, ${P}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${R.groupLeft}px`,width:`${R.groupWidth}px`,height:`${R.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${R.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Jn(S){return S.threads.filter(R=>!B(R.id))}function Qr(S){if(mt.value)return Jn(S);if(Kt(S.projectName))return[];const R=Jn(S);return Mt(S.projectName)?R:R.slice(0,10)}function gs(S){return mt.value?!1:!Kt(S.projectName)&&Jn(S).length>10}function vs(S){return Jn(S).length>0}function Cr(S){return S.inProgress?"working":S.unread?"unread":"idle"}ht(()=>n.groups.map(S=>S.projectName),S=>{var Fe,St;const R=((Fe=ye.value)==null?void 0:Fe.projectName)??((St=ve.value)==null?void 0:St.projectName)??"";R&&!n.groups.some(qt=>qt.projectName===R)&&Ot();const P=new Set(S),J=Object.fromEntries(Object.entries(ce.value).filter(([qt])=>P.has(qt)));Object.keys(J).length!==Object.keys(ce.value).length&&(ce.value=J)});const ys=de(()=>Re.value||a.value!==""||l.value!=="");return ht(ys,S=>{if(S){fn();return}nr()}),ht(l,S=>{if(!S){Wn();return}Yt(),en(()=>{$e(S)})}),Kr(()=>{for(const S of ne.values())Ae==null||Ae.unobserve(S);ne.clear(),Pe.clear(),Wn(),nr(),Ot()}),(S,R)=>(y(),k("section",my,[T.value.length>0?(y(),k("section",gy,[v("ul",vy,[(y(!0),k(Ne,null,vt(T.value,P=>(y(),k("li",{key:P.id,class:"thread-row-item","data-menu-open":ke(P.id)?"true":"false"},[De(Is,{class:"thread-row","data-active":P.id===e.selectedThreadId,"data-pinned":B(P.id),"data-menu-open":ke(P.id)?"true":"false","force-right-hover":ke(P.id)},{left:It(()=>[v("span",wy,[P.inProgress||P.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Cr(P)},null,8,by)):fe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:J=>H(P.id)},[De(ga,{class:"thread-icon"})],8,_y)])]),right:It(()=>[v("span",Iy,G(N(P.createdAtIso||P.updatedAtIso)),1)]),"right-hover":It(()=>[v("div",{ref_for:!0,ref:J=>Bn(P.id,J),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:kt(J=>ze(P.id),["stop"])},[De(go,{class:"thread-icon"})],8,Ey)],512)]),default:It(()=>[v("button",{class:"thread-main-button",type:"button",onClick:J=>X(P.id)},[v("span",Ty,[v("span",Sy,G(P.title),1),P.hasWorktree?(y(),wt(pi,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):fe("",!0)])],8,ky)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,yy))),128))])])):fe("",!0),De(Is,{as:"header",class:"thread-tree-header-row"},{right:It(()=>[v("div",{ref_key:"organizeMenuWrapRef",ref:Ve,class:"organize-menu-wrap"},[v("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Re.value,"aria-label":"Organize threads",title:"Organize threads",onClick:_t},[De(go,{class:"thread-icon"})],8,Cy),Re.value?(y(),k("div",{key:0,class:"organize-menu-panel",onClick:R[2]||(R[2]=kt(()=>{},["stop"]))},[R[12]||(R[12]=v("p",{class:"organize-menu-title"},"Organize",-1)),v("button",{class:"organize-menu-item","data-active":rt.value==="project",type:"button",onClick:R[0]||(R[0]=P=>gt("project"))},[R[10]||(R[10]=v("span",null,"By project",-1)),rt.value==="project"?(y(),k("span",xy,"✓")):fe("",!0)],8,Ay),v("button",{class:"organize-menu-item","data-active":rt.value==="chronological",type:"button",onClick:R[1]||(R[1]=P=>gt("chronological"))},[R[11]||(R[11]=v("span",null,"Chronological list",-1)),rt.value==="chronological"?(y(),k("span",Py,"✓")):fe("",!0)],8,Ry)])):fe("",!0)],512)]),default:It(()=>[R[13]||(R[13]=v("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),mt.value&&V.value.length===0?(y(),k("p",My,"No matching threads")):e.isLoading&&e.groups.length===0?(y(),k("p",$y,"Loading threads...")):_e.value?(y(),k("ul",Oy,[(y(!0),k(Ne,null,vt(he.value,P=>(y(),k("li",{key:P.id,class:"thread-row-item","data-menu-open":ke(P.id)?"true":"false"},[De(Is,{class:"thread-row","data-active":P.id===e.selectedThreadId,"data-pinned":B(P.id),"data-menu-open":ke(P.id)?"true":"false","force-right-hover":ke(P.id)},{left:It(()=>[v("span",Ly,[P.inProgress||P.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Cr(P)},null,8,Dy)):fe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:J=>H(P.id)},[De(ga,{class:"thread-icon"})],8,jy)])]),right:It(()=>[v("span",Hy,G(N(P.createdAtIso||P.updatedAtIso)),1)]),"right-hover":It(()=>[v("div",{ref_for:!0,ref:J=>Bn(P.id,J),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:kt(J=>ze(P.id),["stop"])},[De(go,{class:"thread-icon"})],8,Wy)],512)]),default:It(()=>[v("button",{class:"thread-main-button",type:"button",onClick:J=>X(P.id)},[v("span",By,[v("span",Uy,G(P.title),1),P.hasWorktree?(y(),wt(pi,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):fe("",!0)])],8,Fy)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,Ny))),128))])):(y(),k("div",{key:4,ref_key:"groupsContainerRef",ref:Te,class:"thread-tree-groups",style:cs(Y.value)},[(y(!0),k(Ne,null,vt(V.value,P=>(y(),k("article",{key:P.projectName,ref_for:!0,ref:J=>x(P.projectName,J),class:"project-group","data-project-name":P.projectName,"data-expanded":!Kt(P.projectName),"data-dragging":Yr(P.projectName),style:cs(Ln(P.projectName))},[De(Is,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:J=>rn(P.projectName),onKeydown:[J=>$n(J,P.projectName),xn(kt(J=>rn(P.projectName),["prevent"]),["enter"]),xn(kt(J=>rn(P.projectName),["prevent"]),["space"])]},{left:It(()=>[v("span",zy,[v("span",qy,[Kt(P.projectName)?(y(),wt(Bl,{key:0,class:"thread-icon"})):(y(),wt(ny,{key:1,class:"thread-icon"}))]),v("span",Gy,[Kt(P.projectName)?(y(),wt(Uf,{key:0,class:"thread-icon"})):(y(),wt(Ji,{key:1,class:"thread-icon"}))])])]),right:It(()=>[v("div",Yy,[v("div",{ref_for:!0,ref:J=>un(P.projectName,J),class:"project-menu-wrap"},[v("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:kt(J=>nn(P.projectName),["stop"])},[De(go,{class:"thread-icon"})],8,Qy),zt(P.projectName)?(y(),k("div",{key:0,class:"project-menu-panel","data-open-direction":f.value[P.projectName]??"down",onClick:R[4]||(R[4]=kt(()=>{},["stop"]))},[_.value==="actions"?(y(),k(Ne,{key:0},[v("button",{class:"project-menu-item",type:"button",onClick:J=>Wt(P.projectName)}," Browse files ",8,Zy),v("button",{class:"project-menu-item",type:"button",onClick:J=>xt(P.projectName)}," Edit name ",8,ew),v("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:J=>Mn(P.projectName)}," Remove ",8,tw)],64)):(y(),k(Ne,{key:1},[R[14]||(R[14]=v("label",{class:"project-menu-label"},"Project name",-1)),Hr(v("input",{"onUpdate:modelValue":R[3]||(R[3]=J=>I.value=J),class:"project-menu-input",type:"text",onInput:J=>Rt(P.projectName)},null,40,nw),[[Wr,I.value]])],64))],8,Xy)):fe("",!0)],512),v("button",{class:"thread-start-button",type:"button","aria-label":Ee(P.projectName),title:Ee(P.projectName),onClick:kt(J=>we(P.projectName),["stop"])},[De(Ci,{class:"thread-icon"})],8,rw)])]),default:It(()=>[v("span",{class:"project-main-button","data-dragging-handle":Yr(P.projectName),onMousedown:kt(J=>U(J,P.projectName),["left"])},[v("span",Jy,G(Bt(P.projectName)),1)],40,Ky)]),_:2},1032,["onClick","onKeydown"]),vs(P)?(y(),k("ul",sw,[(y(!0),k(Ne,null,vt(Qr(P),J=>(y(),k("li",{key:J.id,class:"thread-row-item","data-menu-open":ke(J.id)?"true":"false"},[De(Is,{class:"thread-row","data-active":J.id===e.selectedThreadId,"data-pinned":B(J.id),"data-menu-open":ke(J.id)?"true":"false","force-right-hover":ke(J.id)},{left:It(()=>[v("span",iw,[J.inProgress||J.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Cr(J)},null,8,aw)):fe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Fe=>H(J.id)},[De(ga,{class:"thread-icon"})],8,lw)])]),right:It(()=>[v("span",fw,G(N(J.createdAtIso||J.updatedAtIso)),1)]),"right-hover":It(()=>[v("div",{ref_for:!0,ref:Fe=>Bn(J.id,Fe),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:kt(Fe=>ze(J.id),["stop"])},[De(go,{class:"thread-icon"})],8,hw)],512)]),default:It(()=>[v("button",{class:"thread-main-button",type:"button",onClick:Fe=>X(J.id)},[v("span",uw,[v("span",dw,G(J.title),1),J.hasWorktree?(y(),wt(pi,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):fe("",!0)])],8,cw)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,ow))),128))])):(y(),wt(Is,{key:1,as:"p",class:"project-empty-row"},{left:It(()=>[...R[15]||(R[15]=[v("span",{class:"project-empty-spacer"},null,-1)])]),default:It(()=>[R[16]||(R[16]=v("span",{class:"project-empty"},"No threads",-1))]),_:1})),gs(P)?(y(),wt(Is,{key:2,class:"thread-show-more-row"},{left:It(()=>[...R[17]||(R[17]=[v("span",{class:"thread-show-more-spacer"},null,-1)])]),default:It(()=>[v("button",{class:"thread-show-more-button",type:"button",onClick:J=>Dt(P.projectName)},G(Mt(P.projectName)?"Show less":"Show more"),9,pw)]),_:2},1024)):fe("",!0)],12,Vy))),128))],4)),(y(),wt(To,{to:"body"},[Ce.value?(y(),k("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Ue,class:"thread-menu-panel thread-menu-panel-fixed",style:cs(g.value),"data-open-direction":er(Ce.value.id),onClick:R[8]||(R[8]=kt(()=>{},["stop"]))},[v("button",{class:"thread-menu-item",type:"button",onClick:R[5]||(R[5]=P=>Z(Ce.value.id))}," Export chat "),v("button",{class:"thread-menu-item",type:"button",onClick:R[6]||(R[6]=P=>it(Ce.value.id,Ce.value.title))}," Rename thread "),v("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:R[7]||(R[7]=P=>bt(Ce.value.id,Ce.value.title))}," Delete thread ")],12,mw)):fe("",!0)])),(y(),wt(To,{to:"body"},[F.value?(y(),k("div",{key:0,class:"rename-thread-overlay",onClick:kt(We,["self"])},[v("div",gw,[R[18]||(R[18]=v("h3",{class:"rename-thread-title"},"Rename thread",-1)),R[19]||(R[19]=v("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),Hr(v("input",{ref_key:"renameThreadInputRef",ref:ae,"onUpdate:modelValue":R[9]||(R[9]=P=>Q.value=P),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[xn(kt(pt,["prevent"]),["enter"]),xn(kt(We,["prevent"]),["esc"])]},null,40,vw),[[Wr,Q.value]]),v("div",{class:"rename-thread-actions"},[v("button",{class:"rename-thread-button",type:"button",onClick:We},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:pt},"Save")])])])):fe("",!0)])),(y(),wt(To,{to:"body"},[q.value?(y(),k("div",{key:0,class:"rename-thread-overlay",onClick:kt(Pt,["self"])},[v("div",yw,[R[20]||(R[20]=v("h3",{class:"rename-thread-title"},"Delete thread?",-1)),v("p",ww,' This will archive the thread "'+G(te.value)+'". You can find it later in archived threads. ',1),v("div",{class:"rename-thread-actions"},[v("button",{class:"rename-thread-button",type:"button",onClick:Pt},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Ke},"Delete")])])])):fe("",!0)]))]))}}),kw=yt(_w,[["__scopeId","data-v-2e1439c4"]]),Tw={class:"content-header"},Sw={class:"content-leading"},Iw={class:"content-title"},Ew={class:"content-actions"},Cw=cn({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(y(),k("header",Tw,[v("div",Sw,[Tr(t.$slots,"leading",{},void 0)]),v("h1",Iw,G(e.title),1),v("div",Ew,[Tr(t.$slots,"actions",{},void 0)])]))}}),Aw=yt(Cw,[["__scopeId","data-v-66ee223c"]]),xw={},Rw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Pw(e,t){return y(),k("svg",Rw,[...t[0]||(t[0]=[v("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 Hf=yt(xw,[["render",Pw]]),Mw={},$w={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Ow(e,t){return y(),k("svg",$w,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zm-4 4a2 2 0 0 1-2-2V8m4 8h10"},null,-1)])])}const Nw=yt(Mw,[["render",Ow]]),Lw={},Dw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function jw(e,t){return y(),k("svg",Dw,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Ul=yt(Lw,[["render",jw]]),Fw={class:"conversation-root"},Bw={key:0,class:"conversation-loading"},Uw={key:1,class:"conversation-empty"},Hw=["data-role","data-message-type"],Ww={key:0,class:"message-row","data-role":"system"},Vw={class:"message-stack","data-role":"system"},zw=["onClick"],qw={class:"cmd-group-label"},Gw={class:"cmd-status"},Kw={class:"cmd-group-inner"},Jw=["onClick"],Yw={class:"cmd-label"},Qw={class:"cmd-status"},Xw={class:"cmd-output-inner"},Zw=["textContent"],eb=["onClick"],tb={class:"cmd-label"},nb={class:"cmd-status"},rb={class:"cmd-output-inner"},sb=["textContent"],ob=["data-role","data-message-type"],ib=["data-role"],ab=["data-role"],lb=["data-role"],cb=["onClick"],ub=["src"],db={key:1,class:"message-file-attachments"},fb=["href","title"],hb=["data-role"],pb={key:0,class:"worked-separator-wrap","aria-live":"polite"},mb=["onClick"],gb={class:"worked-separator-text"},vb={key:0,class:"worked-details"},yb=["onClick"],wb={class:"cmd-label"},bb={class:"cmd-status"},_b={class:"cmd-output-inner"},kb=["textContent"],Tb=["data-streaming"],Sb={class:"plan-card-header"},Ib={key:0,class:"plan-card-badge"},Eb=["innerHTML"],Cb={key:1,class:"plan-step-list"},Ab=["data-status"],xb=["data-status"],Rb=["innerHTML"],Pb=["innerHTML"],Mb={key:2,class:"message-text-flow"},$b={key:0,class:"message-text"},Ob={key:0},Nb={key:1,class:"message-bold-text"},Lb={key:2,class:"message-italic-text"},Db={key:3,class:"message-strikethrough-text"},jb=["href","title"],Fb=["href","title"],Bb={key:6,class:"message-inline-code"},Ub={key:0},Hb={key:1,class:"message-bold-text"},Wb={key:2,class:"message-italic-text"},Vb={key:3,class:"message-strikethrough-text"},zb=["href","title"],qb=["href","title"],Gb={key:6,class:"message-inline-code"},Kb={key:2,class:"message-blockquote"},Jb={key:0},Yb={key:1,class:"message-bold-text"},Qb={key:2,class:"message-italic-text"},Xb={key:3,class:"message-strikethrough-text"},Zb=["href","title"],e_=["href","title"],t_={key:6,class:"message-inline-code"},n_={key:3,class:"message-list message-list-unordered"},r_=["innerHTML"],s_={key:4,class:"message-list message-task-list"},o_=["data-checked"],i_={class:"message-list-item-text"},a_={key:0},l_={key:1,class:"message-bold-text"},c_={key:2,class:"message-italic-text"},u_={key:3,class:"message-strikethrough-text"},d_=["href","title"],f_=["href","title"],h_={key:6,class:"message-inline-code"},p_={key:5,class:"message-list message-list-ordered"},m_=["innerHTML"],g_={key:6,class:"message-code-block"},v_={key:0,class:"message-code-language"},y_={class:"message-code-pre"},w_={key:7,class:"message-divider"},b_={key:8,class:"message-text"},__=["onClick"],k_=["src","alt","onError"],T_=["data-role"],S_=["data-copied","aria-label","title","onClick"],I_={class:"message-copy-label"},E_={key:0,class:"conversation-item conversation-item-overlay"},C_={class:"message-row"},A_={class:"message-stack"},x_={class:"live-overlay-inline","aria-live":"polite"},R_={class:"live-overlay-label"},P_={key:1,class:"live-overlay-error"},M_={class:"message-row"},$_={class:"message-stack"},O_={class:"request-card"},N_={class:"request-title"},L_={class:"request-meta"},D_={key:0,class:"request-reason"},j_={key:1,class:"request-actions"},F_=["onClick"],B_=["onClick"],U_=["onClick"],H_=["onClick"],W_={key:2,class:"request-actions"},V_=["onClick"],z_=["onClick"],q_=["onClick"],G_=["onClick"],K_={key:3,class:"request-user-input"},J_={class:"request-question-title"},Y_={key:0,class:"request-question-text"},Q_=["value","onChange"],X_=["value"],Z_={key:2,class:"request-question-option-description"},ek=["type","value","placeholder","onInput"],tk=["type","value","onInput"],nk=["onClick"],rk={key:4,class:"request-actions"},sk=["onClick"],ok=["onClick"],ik={key:5,class:"request-actions"},ak=["onClick"],lk=["onClick"],ck=["src"],uk=16,dk=cn({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{}},emits:["updateScrollState","respondServerRequest"],setup(e,{emit:t}){var Ar;const n=D(new Set),r=D(new Set),s=D(new Set),o=D(new Set);function i(d){var L;const m=d.replace(/\r\n/g,`
|
|
26
|
+
`).trim();if(!m)return null;const h=[],A=[];for(const M of m.split(`
|
|
27
|
+
`)){const pe=M.trim();if(!pe){h.length===0&&A.push("");continue}const W=pe.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(W){const Se=(W[1]??" ").toLowerCase();let Oe="pending";Se==="x"&&(Oe="completed"),(Se==="~"||Se===">"||Se==="-")&&(Oe="inProgress"),h.push({step:((L=W[2])==null?void 0:L.trim())??"",status:Oe});continue}A.push(pe)}return h.length===0?null:{explanation:A.join(`
|
|
28
|
+
`).trim(),steps:h.filter(M=>M.step.length>0)}}function a(d){var m;return d.plan&&d.plan.steps.length>0?{explanation:((m=d.plan.explanation)==null?void 0:m.trim())??"",steps:d.plan.steps}:i(d.text)}function l(d){return d.messageType==="commandExecution"&&!!d.commandExecution}function f(d){return d.messageType==="plan"||d.messageType==="plan.live"}function u(d){return d.role==="assistant"&&!l(d)&&d.messageType!=="worked"&&!(d.messageType??"").endsWith(".live")}const g=de(()=>{var d;for(let m=Ae.messages.length-1;m>=0;m-=1){const h=Ae.messages[m];if(h.messageType==="commandExecution"&&((d=h.commandExecution)==null?void 0:d.status)==="inProgress")return h.id}return""}),_=de(()=>Ae.messages.some(d=>d.role==="assistant"&&d.messageType==="agentMessage.live"&&d.text.trim().length>0)),I=de(()=>!!Ae.liveOverlay||g.value.length>0||_.value),F=de(()=>{const d={};for(let m=0;m<Ae.messages.length;){const h=Ae.messages[m];if(!l(h)){m+=1;continue}const A=[];for(;m<Ae.messages.length&&l(Ae.messages[m]);)A.push(Ae.messages[m]),m+=1;if(A.length<=1)continue;const L=A[A.length-1];d[L.id]=A.slice(0,-1)}return d}),$=de(()=>{const d=new Set;for(const m of Object.values(F.value))for(const h of m)d.add(h.id);return d});function Q(d){var m;return((m=a(d))==null?void 0:m.explanation)??""}function ae(d){var m;return((m=a(d))==null?void 0:m.steps)??[]}function q(d){switch(d){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function ee(d){return!_.value&&d.id===g.value}function te(d){return l(d)?n.value.has(d.id)||!r.value.has(d.id)&&ee(d):!1}function Te(d){return l(d)&&I.value}function ve(d){var m;return l(d)&&(I.value||((m=d.commandExecution)==null?void 0:m.status)==="inProgress")}function ye(d){if(!l(d))return;const m=new Set(n.value),h=new Set(r.value),A=ee(d);m.has(d.id)?(m.delete(d.id),A&&h.add(d.id)):A&&!h.has(d.id)?h.add(d.id):(m.add(d.id),h.delete(d.id)),n.value=m,r.value=h}function Le(d){return F.value[d.id]??[]}function le(d){return l(d)?[...Le(d),d]:[]}function re(d){if(Le(d).length===0)return;const h=new Set(s.value);h.has(d.id)?h.delete(d.id):h.add(d.id),s.value=h}function ce(d){return s.value.has(d.id)}function ne(d){var M,pe;const h=le(d).length,A=((pe=(M=d.commandExecution)==null?void 0:M.command)==null?void 0:pe.trim())||"(command)";return`${h===1?"1 command":`${h} commands`} · latest: ${A}`}function Pe(d){return Ve(d)}function Ye(d){const m=new Set(o.value);m.has(d.id)?m.delete(d.id):m.add(d.id),o.value=m}function Ge(d){return o.value.has(d.id)}function Ve(d){const m=d.commandExecution;if(!m)return"";const h=Te(d);switch(m.status){case"inProgress":return h?"Running":"⟳ Running";case"completed":return m.exitCode===0?h?"Done":"✓ Completed":`Exit ${m.exitCode??"?"}`;case"failed":return h?"Failed":"✗ Failed";case"declined":return h?"Declined":"⊘ Declined";case"interrupted":return h?"Stopped":"⊘ Interrupted";default:return""}}function Ue(d){var h,A;const m=(h=d.commandExecution)==null?void 0:h.status;return m==="inProgress"?"cmd-status-running":m==="completed"&&((A=d.commandExecution)==null?void 0:A.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function Re(d,m){if(d.size===0)return d;const h=new Set;for(const A of d)m.has(A)&&h.add(A);return h.size===d.size?d:h}function rt(d,m){const h=[];for(let A=m-1;A>=0;A--){const L=d[A];if(L.messageType==="commandExecution")h.unshift(L);else if(L.role==="user"||L.messageType==="worked")break}return h}const Ae=e,Be=t,lt=D(null),Ht=D(null),mt=D(null),ct=D(""),He=D(""),V=D({}),_e=D({}),he=D(((Ar=Ae.scrollState)==null?void 0:Ar.isAtBottom)!==!1);let ge=0,Ce=0,T=0,E=null;const O=new WeakSet,z=D(new Set),Y=de(()=>!he.value&&(Ae.messages.length>0||Ae.pendingRequests.length>0||!!Ae.liveOverlay));function N(d){if(!d||/\s/u.test(d)||d.endsWith("/")||d.endsWith("\\"))return!1;if(d.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(d))return!1;const m=d.startsWith("/"),h=/^[A-Za-z]:[\\/]/u.test(d),A=d.startsWith("./")||d.startsWith("../")||d.startsWith("~/"),L=d.includes("/")||d.includes("\\");return m||h||A||L}function B(d){return d.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||d}function H(d){return d.replace(/\\/gu,"/")}function X(d){if(!d.startsWith("file://"))return d;let m=d.replace(/^file:\/\//u,"");try{m=decodeURIComponent(m)}catch{}return/^\/[A-Za-z]:\//u.test(m)&&(m=m.slice(1)),m}function Z(d){const m=H(d),h=m.match(/^\/Users\/([^/]+)/u);if(h)return`/Users/${h[1]}`;const A=m.match(/^\/home\/([^/]+)/u);return A?`/home/${A[1]}`:""}function Ee(d){const m=H(d);if(!m)return m;let h="",A=m;const L=A.match(/^([A-Za-z]:)(\/.*)?$/u);L?(h=`${L[1]}/`,A=(L[2]??"").replace(/^\/+/u,"")):A.startsWith("/")&&(h="/",A=A.slice(1));const M=A.split("/").filter(Boolean),pe=[];for(const Se of M)if(Se!=="."){if(Se===".."){pe.length>0&&pe.pop();continue}pe.push(Se)}const W=pe.join("/");return h?`${h}${W}`.replace(/\/+$/u,"")||h:W||m}function we(d,m){const h=H(X(d.trim()));if(!h)return"";if(h.startsWith("/")||/^[A-Za-z]:\//u.test(h))return Ee(h);if(h.startsWith("~/")){const M=Z(m);if(M)return Ee(`${M}/${h.slice(2)}`)}const L=H(m.trim());return Ee(L?`${L.replace(/\/+$/u,"")}/${h}`:h)}function ke(d){if(!d)return null;let m=d.trim();m=xe(m).core.trim();let A=null;const L=m.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(L)m=L[1],A=Number(L[2]);else{const M=m.match(/^(.*):(\d+)(?::\d+)?$/u);M&&(m=M[1],A=Number(M[2]))}return m=X(m),N(m)?{path:m,line:A}:null}function xe(d){let m=d,h="",A="";for(;/^[('"`[{<“‘]/u.test(m);)h+=m[0],m=m.slice(1);for(;/[)"'`\]}>”’]$/u.test(m);)A=m.slice(-1)+A,m=m.slice(0,-1);return{core:m,leading:h,trailing:A}}function ze(d){const h=d.trim().match(/^\[([^\]\n]+)\]\(([^)\n]+)\)$/u);if(!h)return null;const A=(h[1]??"").trim(),L=(h[2]??"").trim(),M=xe(A).core.trim()||A,pe=xe(L).core.trim();return pe?{label:M,target:pe}:null}function it(d){const m=Math.min(6,Math.max(1,Math.trunc(d)));return`h${String(m)}`}function We(d){switch(Math.min(6,Math.max(1,Math.trunc(d)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}function pt(d){switch(d){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function bt(d){var A;const m=a(d);if(!m)return"";const h=[];return(A=m.explanation)!=null&&A.trim()&&h.push(m.explanation.trim()),m.steps.length>0&&h.push(m.steps.map(L=>`- ${pt(L.status)} ${L.step}`.trim()).join(`
|
|
29
|
+
`)),h.join(`
|
|
30
|
+
|
|
31
|
+
`).trim()}function Pt(d){const m=[],h=d.text.trim()||bt(d),A=f(d)&&h?`Plan
|
|
32
|
+
${h}`:h;A&&m.push(A);const L=(d.fileAttachments??[]).map(pe=>pe.path.trim()).filter(pe=>pe.length>0);L.length>0&&m.push(`Files:
|
|
33
|
+
${L.join(`
|
|
34
|
+
`)}`);const M=(d.images??[]).map(pe=>pe.trim()).filter(pe=>pe.length>0);return M.length>0&&m.push(`Images:
|
|
35
|
+
${M.join(`
|
|
36
|
+
`)}`),m.join(`
|
|
37
|
+
|
|
38
|
+
`).trim()}const Ke=de(()=>{const d=new Map;for(const h of Ae.messages){if(!u(h))continue;const A=Pt(h);if(!A)continue;const L=typeof h.turnIndex=="number"?`turn:${h.turnIndex}`:`message:${h.id}`,M=d.get(L);if(M){M.anchorMessageId=h.id,M.parts.push(A);continue}d.set(L,{anchorMessageId:h.id,parts:[A]})}const m={};for(const h of d.values()){const A=h.parts.join(`
|
|
39
|
+
|
|
40
|
+
`).trim();A&&(m[h.anchorMessageId]=A)}return m});function Bt(d){return typeof Ke.value[d.id]=="string"}function zt(d){if(typeof document>"u")return!1;const m=document.createElement("textarea");m.value=d,m.setAttribute("readonly","true"),m.style.position="fixed",m.style.left="-9999px",m.style.opacity="0",m.style.pointerEvents="none",document.body.appendChild(m),m.focus(),m.select(),m.setSelectionRange(0,d.length);try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(m)}}async function dt(d){var A;const m=Ke.value[d]??"";if(!m)return;let h=!1;if(typeof navigator<"u"&&((A=navigator.clipboard)!=null&&A.writeText))try{await navigator.clipboard.writeText(m),h=!0}catch{h=!1}h||(h=zt(m)),h&&(He.value=d,E&&clearTimeout(E),E=setTimeout(()=>{He.value===d&&(He.value=""),E=null},1800))}function _t(d){const m=[],h=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let A=0;for(const L of d.matchAll(h)){if(typeof L.index!="number")continue;const M=L.index,pe=M+L[0].length;M>A&&m.push({kind:"text",value:d.slice(A,M)});let W=L[0],Se="";for(;/[.,;:]$/u.test(W);)Se=W.slice(-1)+Se,W=W.slice(0,-1);const Oe=xe(W);W=Oe.core;const Qe=Oe.leading,$t=Oe.trailing+Se;if(Qe&&m.push({kind:"text",value:Qe}),W.startsWith("**")&&W.endsWith("**")&&W.length>4)m.push({kind:"bold",value:W.slice(2,-2)}),$t&&m.push({kind:"text",value:$t});else if(/^https?:\/\//u.test(W))m.push({kind:"url",value:W,href:W}),$t&&m.push({kind:"text",value:$t});else{const Vt=ke(W);Vt?(m.push({kind:"file",value:W,path:Vt.path,displayPath:W,downloadName:B(Vt.path)}),$t&&m.push({kind:"text",value:$t})):m.push({kind:"text",value:L[0]})}A=pe}return A<d.length&&m.push({kind:"text",value:d.slice(A)}),nn(m)}function gt(d,m){const h=[];let A=!1,L="";const M=pe=>{pe&&h.push({kind:"text",value:pe})};for(const pe of d){if(pe.kind!=="text"){A&&(M(`${m.marker}${L}`),A=!1,L=""),h.push(pe);continue}let W=pe.value;for(;W.length>0;){const Se=W.indexOf(m.marker);if(Se<0){A?L+=W:M(W);break}const Oe=W.slice(0,Se);if(A?L+=Oe:M(Oe),W=W.slice(Se+m.marker.length),A){const Qe=L;Qe.length>0&&(!m.isValidContent||m.isValidContent(Qe))?h.push({kind:m.kind,value:Qe}):M(`${m.marker}${Qe}${m.marker}`),L="",A=!1}else A=!0}}return A&&M(`${m.marker}${L}`),h}function nn(d){const m=A=>A.trim().length>0&&!/^\s/u.test(A)&&!/\s$/u.test(A);let h=gt(d,{marker:"**",kind:"bold",isValidContent:m});return h=gt(h,{marker:"~~",kind:"strikethrough",isValidContent:m}),h=gt(h,{marker:"*",kind:"italic",isValidContent:m}),h}function xt(d){const m=/\[([^\]\n]+)\]\(([^)\n]+)\)/gu,h=[];let A=0;for(const L of d.matchAll(m)){if(typeof L.index!="number")continue;const[M,pe,W]=L,Se=L.index,Oe=Se+M.length;Se>A&&h.push(..._t(d.slice(A,Se)));const Qe=ze(`[${pe??""}](${W??""})`),$t=(Qe==null?void 0:Qe.label)??(pe??"").trim(),Vt=(Qe==null?void 0:Qe.target)??(W??"").trim();if(/^https?:\/\//u.test(Vt))h.push({kind:"url",value:$t||Vt,href:Vt});else{const c=ke(Vt);c?h.push({kind:"file",value:Vt,path:c.path,displayPath:$t||Vt,downloadName:B(c.path)}):h.push({kind:"text",value:M})}A=Oe}return A<d.length&&h.push(..._t(d.slice(A))),h}function Rt(d){if(!d.includes("`"))return xt(d);const m=[];let h=0,A=0;for(;h<d.length;){if(d[h]!=="`"){h+=1;continue}let L=1;for(;h+L<d.length&&d[h+L]==="`";)L+=1;const M="`".repeat(L);let pe=h+L,W=-1;for(;pe<d.length;){const Oe=d.indexOf(M,pe);if(Oe<0)break;const Qe=Oe>0&&d[Oe-1]==="`",$t=Oe+L<d.length&&d[Oe+L]==="`",Vt=d.slice(h+L,Oe).includes(`
|
|
41
|
+
`);if(!Qe&&!$t&&!Vt){W=Oe;break}pe=Oe+1}if(W<0){h+=L;continue}h>A&&m.push(...xt(d.slice(A,h)));const Se=d.slice(h+L,W);if(Se.length>0){const Oe=ze(Se);if(Oe)if(/^https?:\/\//u.test(Oe.target))m.push({kind:"url",value:Oe.label||Oe.target,href:Oe.target});else{const Qe=ke(Oe.target);Qe?m.push({kind:"file",value:Oe.target,path:Qe.path,displayPath:Oe.label||Oe.target,downloadName:B(Qe.path)}):m.push({kind:"code",value:Se})}else{const Qe=ke(Se);if(Qe){const $t=Qe.line?`${Qe.path}:${String(Qe.line)}`:Qe.path;m.push({kind:"file",value:Se,path:Qe.path,displayPath:$t,downloadName:B(Qe.path)})}else m.push({kind:"code",value:Se})}}else m.push({kind:"text",value:`${M}${M}`});h=W+L,A=h}return A<d.length&&m.push(...xt(d.slice(A))),m}function Mn(d){const m=d.trim();if(!m)return"";if(m.startsWith("data:")||m.startsWith("blob:")||m.startsWith("http://")||m.startsWith("https://")||m.startsWith("/codex-local-image?"))return m;if(m.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(m)}`;const h=m.startsWith("/"),A=/^[A-Za-z]:[\\/]/u.test(m);return h||A?`/codex-local-image?path=${encodeURIComponent(m)}`:m}function Wt(d){const m=d.trim();if(!m)return"#";const h=pe=>pe.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(pe),A=ke(m),L=(A==null?void 0:A.path)??m,M=we(L,Ae.cwd);if(h(M)){const pe=M.startsWith("/")?M:`/${M}`;return`/codex-local-browse${encodeURI(pe)}`}return"#"}function $n(d){return d.replace(/\r\n/gu,`
|
|
42
|
+
`)}function Mt(d){var h;return(((h=d.match(/^\s*/u))==null?void 0:h[0])??"").replace(/\t/gu," ").length}function Kt(d,m){if(m<=0)return d.trimStart();let h=0,A=0;for(;h<d.length&&A<m;){const L=d[h];A+=L===" "?4:1,h+=1}return d.slice(h)}function Dt(d){return d.trim().length===0}function rn(d){const m=d.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return m?{level:m[1].length,value:m[2].trim()}:null}function Tn(d){const m=d.match(/^\s{0,3}>\s?(.*)$/u);return m?m[1]??"":null}function un(d){var h;const m=d.match(/^\s*[-*+]\s+(.+)$/u);return((h=m==null?void 0:m[1])==null?void 0:h.trim())??null}function Bn(d){var h;const m=d.match(/^(\s*)[-*+]\s+(.+)$/u);return m?{indent:Mt(m[1]??""),text:((h=m[2])==null?void 0:h.trim())??""}:null}function dn(d){var h;const m=d.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return m?{checked:(m[1]??" ").toLowerCase()==="x",text:((h=m[2])==null?void 0:h.trim())??""}:null}function Un(d){var h;const m=d.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return m?{indent:Mt(m[1]??""),item:{checked:(m[2]??" ").toLowerCase()==="x",text:((h=m[3])==null?void 0:h.trim())??""}}:null}function Gn(d){var h;const m=d.match(/^\s*\d+[.)]\s+(.+)$/u);return((h=m==null?void 0:m[1])==null?void 0:h.trim())??null}function er(d){var h;const m=d.match(/^(\s*)\d+[.)]\s+(.+)$/u);return m?{indent:Mt(m[1]??""),text:((h=m[2])==null?void 0:h.trim())??""}:null}function Hn(d){return Dt(d)||Nn(d)!==null||Wn(d)||rn(d)!==null||Tn(d)!==null||dn(d)!==null||un(d)!==null||Gn(d)!==null}function Me(d,m,h=-1){const A=[];let L=m;for(;L<d.length&&!(Hn(d[L])||h>=0&&Mt(d[L])<=h);)A.push(h>=0?Kt(d[L],h+1):d[L]),L+=1;const M=A.join(`
|
|
43
|
+
`).trim();return M?{value:M,nextIndex:L}:null}function $e(d,m){for(let h=m;h<d.length;h+=1)if(!Dt(d[h]))return h;return-1}function On(d,m,h,A=null,L=!1){const M=[];let pe=m;for(;pe<d.length;){const W=d[pe];if(Dt(W)){const $t=$e(d,pe+1);if($t===-1){M.push(""),pe=d.length;break}const Vt=A==null?void 0:A(d[$t]);if(Vt&&Vt.indent===h||Mt(d[$t])<=h)break;M.push(""),pe+=1;continue}const Se=A==null?void 0:A(W);if(Se&&Se.indent===h)break;const Oe=Mt(W),Qe=L&&(dn(W)!==null||un(W)!==null);if(Oe<=h&&!Qe)break;M.push(Oe>h?Kt(W,h+1):W.trimStart()),pe+=1}for(;M.length>0&&Dt(M[0]);)M.shift();for(;M.length>0&&Dt(M[M.length-1]);)M.pop();return M.length===0?null:{blocks:mn(M.join(`
|
|
44
|
+
`)),nextIndex:pe}}function Yt(d,m,h,A=!1){const L=[];let M=m;const pe=h(d[m]);if(!pe)return null;const W=pe.indent;for(;M<d.length;){const Se=h(d[M]);if(Se===null||Se.indent!==W)break;const Oe=[Se.text],Qe=[];for(M+=1;M<d.length;){if(Dt(d[M])){const w=$e(d,M+1);if(w===-1){M=d.length;break}const C=h(d[w]);if(C&&C.indent===W){M=w;break}if(Mt(d[w])<=W){M=w;break}M+=1;continue}const $t=h(d[M]);if($t&&$t.indent===W)break;const Vt=Mt(d[M])>W,c=A&&(dn(d[M])!==null||un(d[M])!==null);if(Vt||c){const w=On(d,M,W,h,A);if(w){Qe.push(...w.blocks),M=w.nextIndex;continue}}if(Mt(d[M])<=W)break;const p=Me(d,M,W);if(!p)break;Oe.push(p.value),M=p.nextIndex}L.push(Qe.length>0?{paragraphs:Oe,children:Qe}:{paragraphs:Oe})}return L.length>0?{items:L,nextIndex:M}:null}function Wn(d){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(d.trim())}function Nn(d){const m=d.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return m?{marker:m[1],language:(m[2]??"").trim()}:null}function mn(d){var M;const h=$n(d).split(`
|
|
45
|
+
`),A=[];let L=0;for(;L<h.length;){if(Dt(h[L])){L+=1;continue}const pe=Nn(h[L]);if(pe){L+=1;const p=[];for(;L<h.length;){if(h[L].trim()===pe.marker){L+=1;break}p.push(h[L]),L+=1}A.push({kind:"codeBlock",language:pe.language,value:p.join(`
|
|
46
|
+
`)});continue}if(Wn(h[L])){A.push({kind:"thematicBreak"}),L+=1;continue}const W=rn(h[L]);if(W){A.push({kind:"heading",level:W.level,value:W.value}),L+=1;continue}if(Tn(h[L])!==null){const p=[];for(;L<h.length;){const w=Tn(h[L]);if(w===null)break;p.push(w),L+=1}A.push({kind:"blockquote",value:p.join(`
|
|
47
|
+
`).trim()});continue}if(dn(h[L])!==null){const p=[],w=((M=Un(h[L]))==null?void 0:M.indent)??0;for(;L<h.length;){const C=Un(h[L]);if(C===null||C.indent!==w)break;p.push(C.item),L+=1}if(p.length>0){A.push({kind:"taskList",items:p});continue}}const Qe=un(h[L]);if(Qe!==null){const p=Yt(h,L,Bn);if(p){A.push({kind:"unorderedList",items:p.items}),L=p.nextIndex;continue}if(Qe.length>0){A.push({kind:"unorderedList",items:[{paragraphs:[Qe]}]}),L+=1;continue}}const $t=Gn(h[L]);if($t!==null){const p=Yt(h,L,er,!0);if(p){A.push({kind:"orderedList",items:p.items}),L=p.nextIndex;continue}if($t.length>0){A.push({kind:"orderedList",items:[{paragraphs:[$t]}]}),L+=1;continue}}const Vt=[];for(;L<h.length&&!(Dt(h[L])||Nn(h[L])||Wn(h[L])||rn(h[L])||Tn(h[L])!==null||dn(h[L])!==null||un(h[L])!==null||Gn(h[L])!==null);)Vt.push(h[L]),L+=1;const c=Vt.join(`
|
|
48
|
+
`).trim();c&&A.push({kind:"paragraph",value:c})}return A}function tr(d){if(!d.includes(")return mn(d);const m=[],h=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let A=0;for(const L of d.matchAll(h)){const[M,pe,W]=L;if(typeof L.index!="number")continue;const Se=L.index,Oe=Se+M.length,Qe=Mn(W.trim());Qe&&(Se>A&&m.push(...mn(d.slice(A,Se))),m.push({kind:"image",url:Qe,alt:pe.trim(),markdown:M}),A=Oe)}return A<d.length&&m.push(...mn(d.slice(A))),m}function Kn(d){const h=$n(d).split(`
|
|
49
|
+
`),A=[];let L=0,M=0;const pe=W=>{if(W<=M)return;const Se=h.slice(M,W).join(`
|
|
50
|
+
`);A.push(...tr(Se))};for(;L<h.length;){const W=Nn(h[L]);if(!W){L+=1;continue}pe(L),L+=1;const Se=[];for(;L<h.length;){if(h[L].trim()===W.marker){L+=1;break}Se.push(h[L]),L+=1}A.push({kind:"codeBlock",language:W.language,value:Se.join(`
|
|
51
|
+
`)}),M=L}return pe(h.length),A.length>0?A:[{kind:"paragraph",value:d}]}function Ut(d){return d.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">").replace(/"/gu,""").replace(/'/gu,"'")}function fn(d){return Rt(d).map(m=>m.kind==="text"?Ut(m.value):m.kind==="bold"?`<strong class="message-bold-text">${Ut(m.value)}</strong>`:m.kind==="italic"?`<em class="message-italic-text">${Ut(m.value)}</em>`:m.kind==="strikethrough"?`<s class="message-strikethrough-text">${Ut(m.value)}</s>`:m.kind==="file"?`<a class="message-file-link" href="${Ut(Wt(m.path))}" target="_blank" rel="noopener noreferrer" title="${Ut(m.path)}">${Ut(m.displayPath)}</a>`:m.kind==="url"?`<a class="message-file-link" href="${Ut(m.href)}" target="_blank" rel="noopener noreferrer" title="${Ut(m.href)}">${Ut(m.value)}</a>`:`<code class="message-inline-code">${Ut(m.value)}</code>`).join("")}function nr(d){return d.paragraphs.map(m=>`<div class="message-list-item-text message-list-item-paragraph">${fn(m)}</div>`).join("")}function sn(d){var A;const m=nr(d),h=((A=d.children)==null?void 0:A.map(L=>x(L)).join(""))??"";return m+h}function x(d){if(d.kind==="paragraph")return`<p class="message-text">${fn(d.value)}</p>`;if(d.kind==="heading"){const m=Math.min(6,Math.max(1,Math.trunc(d.level))),h=it(m),A=`message-heading ${We(m)}`;return`<${h} class="${A}">${fn(d.value)}</${h}>`}return d.kind==="blockquote"?`<blockquote class="message-blockquote">${fn(d.value)}</blockquote>`:d.kind==="unorderedList"?`<ul class="message-list message-list-unordered">${d.items.map(h=>`<li class="message-list-item"><div class="message-list-item-content">${sn(h)}</div></li>`).join("")}</ul>`:d.kind==="taskList"?`<ul class="message-list message-task-list">${d.items.map(h=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${h.checked?"true":"false"}">${h.checked?"☑":"☐"}</span><div class="message-list-item-text">${fn(h.text)}</div></li>`).join("")}</ul>`:d.kind==="orderedList"?`<ol class="message-list message-list-ordered">${d.items.map(h=>`<li class="message-list-item"><div class="message-list-item-content">${sn(h)}</div></li>`).join("")}</ol>`:d.kind==="codeBlock"?`<div class="message-code-block">${d.language?`<div class="message-code-language">${Ut(d.language)}</div>`:""}<pre class="message-code-pre"><code>${Ut(d.value)}</code></pre></div>`:d.kind==="thematicBreak"?'<hr class="message-divider">':`<img class="message-image-preview message-markdown-image" src="${Ut(d.url)}" alt="${Ut(d.alt||"Embedded message image")}" loading="lazy">`}function U(d){return Kn(d).map(m=>x(m)).join("")}function se(d){return d!==null&&typeof d=="object"&&!Array.isArray(d)?d:null}function je(d){const m=new Date(d);return Number.isNaN(m.getTime())?d:m.toLocaleTimeString()}function ot(d){const m=se(d.params),h=m==null?void 0:m.reason;return typeof h=="string"?h.trim():""}function ut(d,m){return`${String(d)}:${m}`}function ft(d){const m=se(d.params),h=Array.isArray(m==null?void 0:m.questions)?m.questions:[],A=[];for(const L of h){const M=se(L);if(!M)continue;const pe=typeof M.id=="string"?M.id:"";if(!pe)continue;const W=Array.isArray(M.options)?M.options.map(Se=>se(Se)).map(Se=>({label:typeof(Se==null?void 0:Se.label)=="string"?Se.label:"",description:typeof(Se==null?void 0:Se.description)=="string"?Se.description:""})).filter(Se=>Se.label.length>0):[];A.push({id:pe,header:typeof M.header=="string"?M.header:"",question:typeof M.question=="string"?M.question:"",isSecret:M.isSecret===!0,isOther:M.isOther===!0,options:W})}return A}function Ot(d,m,h){const A=ut(d,m),L=V.value[A];return typeof L=="string"&&L.length>0?L:h}function Sn(d,m,h){const A=h.target;if(!(A instanceof HTMLInputElement))return;const L=ut(d,m);V.value={...V.value,[L]:A.value}}function Vn(d,m){var L;const h=Ot(d,m.id,((L=m.options[0])==null?void 0:L.label)||""),A=m.options.find(M=>M.label===h);return(A==null?void 0:A.description)??""}function Jr(d,m){const h=ut(d,m);return _e.value[h]??""}function ms(d,m,h){const A=h.target;if(!(A instanceof HTMLSelectElement))return;const L=ut(d,m);V.value={...V.value,[L]:A.value}}function Yr(d,m,h){const A=h.target;if(!(A instanceof HTMLInputElement))return;const L=ut(d,m);_e.value={..._e.value,[L]:A.value}}function Ln(d,m){Be("respondServerRequest",{id:d,result:{decision:m}})}function Jn(d){var A;const m=ft(d),h={};for(const L of m){const M=Ot(d.id,L.id,((A=L.options[0])==null?void 0:A.label)||""),pe=Jr(d.id,L.id).trim(),W=[M,pe].map(Se=>Se.trim()).filter(Se=>Se.length>0);h[L.id]={answers:W}}Be("respondServerRequest",{id:d.id,result:{answers:h}})}function Qr(d){Be("respondServerRequest",{id:d,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function gs(d){Be("respondServerRequest",{id:d,result:{success:!0,contentItems:[]}})}function vs(d){Be("respondServerRequest",{id:d,result:{}})}function Cr(d){Be("respondServerRequest",{id:d,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function ys(){const d=lt.value,m=Ht.value;!d||!m||(d.scrollTop=d.scrollHeight,m.scrollIntoView({block:"end"}))}function S(d){return d.scrollHeight-(d.scrollTop+d.clientHeight)<=uk}function R(d){if(!Ae.activeThreadId)return;const m=Math.max(d.scrollHeight-d.clientHeight,0),h=m>0?Math.min(Math.max(d.scrollTop/m,0),1):1;Be("updateScrollState",{threadId:Ae.activeThreadId,state:{scrollTop:d.scrollTop,isAtBottom:S(d),scrollRatio:h}})}function P(){const d=lt.value;if(!d)return;const m=Ae.scrollState;if(he.value){J();return}if(!m||m.isAtBottom){R(d);return}const h=Math.max(d.scrollHeight-d.clientHeight,0),A=typeof m.scrollRatio=="number"?m.scrollRatio*h:m.scrollTop;d.scrollTop=Math.min(Math.max(A,0),h),R(d)}function J(){const d=lt.value;d&&(ys(),R(d))}function Fe(){return he.value}function St(){if(!Fe()){T=0,Ce=0;return}if(J(),T-=1,T<=0){Ce=0;return}Ce=requestAnimationFrame(St)}function qt(d=6){Fe()&&(Ce&&(cancelAnimationFrame(Ce),Ce=0),T=Math.max(d,1),Ce=requestAnimationFrame(St))}function In(){qt(3)}function on(){he.value=!0,J(),qt(4)}function an(){if(!Fe())return;const d=lt.value;if(!d)return;const m=d.querySelectorAll("img.message-image-preview");for(const h of m)h.complete||O.has(h)||(O.add(h),h.addEventListener("load",In,{once:!0}),h.addEventListener("error",In,{once:!0}))}async function Dn(){await en(),ge&&cancelAnimationFrame(ge),ge=requestAnimationFrame(()=>{ge=0,P(),an(),qt()})}ht(()=>Ae.messages,async d=>{if(Ae.isLoading)return;const m=new Set(d.filter(h=>h.messageType==="commandExecution"&&h.commandExecution).map(h=>h.id));n.value=Re(n.value,m),r.value=Re(r.value,m),s.value=Re(s.value,new Set(Object.keys(F.value))),await Dn()}),ht(g,(d,m)=>{if(!m||m===d||!r.value.has(m))return;const h=new Set(r.value);h.delete(m),r.value=h}),ht(()=>Ae.pendingRequests,async()=>{Ae.isLoading||await Dn()},{deep:!0}),ht(()=>Ae.liveOverlay,async d=>{d&&(await en(),Fe()&&(J(),qt(8)))},{deep:!0}),ht(()=>Ae.isLoading,async d=>{d||await Dn()}),ht(()=>Ae.activeThreadId,()=>{var d;he.value=((d=Ae.scrollState)==null?void 0:d.isAtBottom)!==!1,ct.value="",z.value=new Set},{flush:"post"}),ht(()=>{var d;return(d=Ae.scrollState)==null?void 0:d.isAtBottom},d=>{he.value=d!==!1});function fr(){const d=lt.value;!d||Ae.isLoading||(he.value=S(d),R(d))}function rr(d){ct.value=Mn(d)}function js(d,m){return`${d}:${String(m)}`}function Xr(d,m){const h=new Set(z.value);h.add(js(d,m)),z.value=h}function hr(d,m){return z.value.has(js(d,m))}function ws(){ct.value=""}function co(){const d=mt.value;d&&(d.scrollTop=d.scrollHeight)}return ht(()=>{var d;return(d=Ae.liveOverlay)==null?void 0:d.reasoningText},async d=>{d&&(await en(),co())}),Kr(()=>{ge&&cancelAnimationFrame(ge),Ce&&cancelAnimationFrame(Ce),E&&clearTimeout(E)}),(d,m)=>(y(),k("section",Fw,[e.isLoading?(y(),k("p",Bw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(y(),k("p",Uw," No messages in this thread yet. ")):(y(),k("ul",{key:2,ref_key:"conversationListRef",ref:lt,class:"conversation-list",onScroll:fr},[(y(!0),k(Ne,null,vt(e.messages,h=>{var A,L;return y(),k(Ne,{key:h.id},[$.value.has(h.id)?fe("",!0):(y(),k("li",{key:0,class:"conversation-item","data-role":h.role,"data-message-type":h.messageType||""},[l(h)?(y(),k("div",Ww,[v("div",Vw,[Le(h).length>0?(y(),k("button",{key:0,type:"button",class:tt(["cmd-row cmd-row-group cmd-compact",[Ue(h),{"cmd-expanded":ce(h)}]]),onClick:M=>re(h)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":ce(h)}])},"▶",2),v("span",qw,G(ne(h)),1),v("span",Gw,G(Pe(h)),1)],10,zw)):fe("",!0),Le(h).length>0?(y(),k("div",{key:1,class:tt(["cmd-group-wrap",{"cmd-group-visible":ce(h)}])},[v("div",Kw,[(y(!0),k(Ne,null,vt(le(h),M=>{var pe,W;return y(),k("div",{key:`grouped-cmd-${M.id}`,class:"worked-cmd-item"},[v("button",{type:"button",class:tt(["cmd-row",[Ue(M),{"cmd-expanded":te(M),"cmd-compact":!0}]]),onClick:Se=>ye(M)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":te(M)}])},"▶",2),v("code",Yw,G(((pe=M.commandExecution)==null?void 0:pe.command)||"(command)"),1),v("span",Qw,G(Ve(M)),1)],10,Jw),v("div",{class:tt(["cmd-output-wrap",{"cmd-output-visible":te(M)}])},[v("div",Xw,[v("pre",{class:tt(["cmd-output",{"cmd-output-condensed":ve(M)}]),textContent:G(((W=M.commandExecution)==null?void 0:W.aggregatedOutput)||"(no output)")},null,10,Zw)])],2)])}),128))])],2)):(y(),k(Ne,{key:2},[v("button",{type:"button",class:tt(["cmd-row",[Ue(h),{"cmd-expanded":te(h),"cmd-compact":Te(h)}]]),onClick:M=>ye(h)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":te(h)}])},"▶",2),v("code",tb,G(((A=h.commandExecution)==null?void 0:A.command)||"(command)"),1),v("span",nb,G(Ve(h)),1)],10,eb),v("div",{class:tt(["cmd-output-wrap",{"cmd-output-visible":te(h)}])},[v("div",rb,[v("pre",{class:tt(["cmd-output",{"cmd-output-condensed":ve(h)}]),textContent:G(((L=h.commandExecution)==null?void 0:L.aggregatedOutput)||"(no output)")},null,10,sb)])],2)],64))])])):(y(),k("div",{key:1,class:"message-row","data-role":h.role,"data-message-type":h.messageType||""},[v("div",{class:"message-stack","data-role":h.role},[v("article",{class:"message-body","data-role":h.role},[h.images&&h.images.length>0?(y(),k("ul",{key:0,class:"message-image-list","data-role":h.role},[(y(!0),k(Ne,null,vt(h.images,M=>(y(),k("li",{key:M,class:"message-image-item"},[v("button",{class:"message-image-button",type:"button",onClick:pe=>rr(M)},[v("img",{class:"message-image-preview",src:Mn(M),alt:"Message image preview",loading:"lazy"},null,8,ub)],8,cb)]))),128))],8,lb)):fe("",!0),h.fileAttachments&&h.fileAttachments.length>0?(y(),k("div",db,[(y(!0),k(Ne,null,vt(h.fileAttachments,M=>(y(),k("span",{key:M.path,class:"message-file-chip"},[m[1]||(m[1]=v("span",{class:"message-file-chip-icon"},"📄",-1)),v("a",{class:"message-file-link message-file-chip-name",href:Wt(M.path),target:"_blank",rel:"noopener noreferrer",title:M.path},G(M.path),9,fb)]))),128))])):fe("",!0),h.text.length>0?(y(),k("article",{key:2,class:"message-card","data-role":h.role},[h.messageType==="worked"?(y(),k("div",pb,[v("button",{type:"button",class:"worked-separator",onClick:M=>Ye(h)},[m[2]||(m[2]=v("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),v("span",{class:tt(["worked-chevron",{"worked-chevron-open":Ge(h)}])},"▶",2),v("p",gb,G(h.text),1),m[3]||(m[3]=v("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,mb),Ge(h)?(y(),k("div",vb,[(y(!0),k(Ne,null,vt(rt(e.messages,e.messages.indexOf(h)),M=>{var pe,W;return y(),k("div",{key:`worked-cmd-${M.id}`,class:"worked-cmd-item"},[v("button",{type:"button",class:tt(["cmd-row",[Ue(M),{"cmd-expanded":te(M),"cmd-compact":Te(M)}]]),onClick:Se=>ye(M)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":te(M)}])},"▶",2),v("code",wb,G(((pe=M.commandExecution)==null?void 0:pe.command)||"(command)"),1),v("span",bb,G(Ve(M)),1)],10,yb),v("div",{class:tt(["cmd-output-wrap",{"cmd-output-visible":te(M)}])},[v("div",_b,[v("pre",{class:tt(["cmd-output",{"cmd-output-condensed":ve(M)}]),textContent:G(((W=M.commandExecution)==null?void 0:W.aggregatedOutput)||"(no output)")},null,10,kb)])],2)])}),128))])):fe("",!0)])):f(h)?(y(),k("div",{key:1,class:"plan-card","data-streaming":h.messageType==="plan.live"},[v("div",Sb,[m[4]||(m[4]=v("p",{class:"plan-card-title"},"Plan",-1)),h.messageType==="plan.live"?(y(),k("span",Ib,"Updating")):fe("",!0)]),Q(h)?(y(),k("div",{key:0,class:"plan-card-explanation plan-card-markdown",innerHTML:U(Q(h))},null,8,Eb)):fe("",!0),ae(h).length>0?(y(),k("ol",Cb,[(y(!0),k(Ne,null,vt(ae(h),(M,pe)=>(y(),k("li",{key:`${h.id}:plan-step:${pe}`,class:"plan-step-item","data-status":M.status},[v("span",{class:"plan-step-status","data-status":M.status},G(q(M.status)),9,xb),v("div",{class:"plan-step-text plan-card-markdown",innerHTML:U(M.step)},null,8,Rb)],8,Ab))),128))])):(y(),k("div",{key:2,class:"plan-card-markdown",innerHTML:U(h.text)},null,8,Pb))],8,Tb)):(y(),k("div",Mb,[(y(!0),k(Ne,null,vt(Kn(h.text),(M,pe)=>(y(),k(Ne,{key:`block-${pe}`},[M.kind==="paragraph"?(y(),k("p",$b,[(y(!0),k(Ne,null,vt(Rt(M.value),(W,Se)=>(y(),k(Ne,{key:`seg-${pe}-${Se}`},[W.kind==="text"?(y(),k("span",Ob,G(W.value),1)):W.kind==="bold"?(y(),k("strong",Nb,G(W.value),1)):W.kind==="italic"?(y(),k("em",Lb,G(W.value),1)):W.kind==="strikethrough"?(y(),k("s",Db,G(W.value),1)):W.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Wt(W.path),target:"_blank",rel:"noopener noreferrer",title:W.path},G(W.displayPath),9,jb)):W.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:W.href,target:"_blank",rel:"noopener noreferrer",title:W.href},G(W.value),9,Fb)):(y(),k("code",Bb,G(W.value),1))],64))),128))])):M.kind==="heading"?(y(),wt(Ti(it(M.level)),{key:1,class:tt(["message-heading",We(M.level)])},{default:It(()=>[(y(!0),k(Ne,null,vt(Rt(M.value),(W,Se)=>(y(),k(Ne,{key:`heading-seg-${pe}-${Se}`},[W.kind==="text"?(y(),k("span",Ub,G(W.value),1)):W.kind==="bold"?(y(),k("strong",Hb,G(W.value),1)):W.kind==="italic"?(y(),k("em",Wb,G(W.value),1)):W.kind==="strikethrough"?(y(),k("s",Vb,G(W.value),1)):W.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Wt(W.path),target:"_blank",rel:"noopener noreferrer",title:W.path},G(W.displayPath),9,zb)):W.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:W.href,target:"_blank",rel:"noopener noreferrer",title:W.href},G(W.value),9,qb)):(y(),k("code",Gb,G(W.value),1))],64))),128))]),_:2},1032,["class"])):M.kind==="blockquote"?(y(),k("blockquote",Kb,[(y(!0),k(Ne,null,vt(Rt(M.value),(W,Se)=>(y(),k(Ne,{key:`quote-seg-${pe}-${Se}`},[W.kind==="text"?(y(),k("span",Jb,G(W.value),1)):W.kind==="bold"?(y(),k("strong",Yb,G(W.value),1)):W.kind==="italic"?(y(),k("em",Qb,G(W.value),1)):W.kind==="strikethrough"?(y(),k("s",Xb,G(W.value),1)):W.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Wt(W.path),target:"_blank",rel:"noopener noreferrer",title:W.path},G(W.displayPath),9,Zb)):W.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:W.href,target:"_blank",rel:"noopener noreferrer",title:W.href},G(W.value),9,e_)):(y(),k("code",t_,G(W.value),1))],64))),128))])):M.kind==="unorderedList"?(y(),k("ul",n_,[(y(!0),k(Ne,null,vt(M.items,(W,Se)=>(y(),k("li",{key:`ul-${pe}-${Se}`,class:"message-list-item"},[v("div",{class:"message-list-item-content",innerHTML:sn(W)},null,8,r_)]))),128))])):M.kind==="taskList"?(y(),k("ul",s_,[(y(!0),k(Ne,null,vt(M.items,(W,Se)=>(y(),k("li",{key:`task-${pe}-${Se}`,class:"message-task-item"},[v("span",{class:"message-task-checkbox","data-checked":W.checked},G(W.checked?"☑":"☐"),9,o_),v("div",i_,[(y(!0),k(Ne,null,vt(Rt(W.text),(Oe,Qe)=>(y(),k(Ne,{key:`task-seg-${pe}-${Se}-${Qe}`},[Oe.kind==="text"?(y(),k("span",a_,G(Oe.value),1)):Oe.kind==="bold"?(y(),k("strong",l_,G(Oe.value),1)):Oe.kind==="italic"?(y(),k("em",c_,G(Oe.value),1)):Oe.kind==="strikethrough"?(y(),k("s",u_,G(Oe.value),1)):Oe.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Wt(Oe.path),target:"_blank",rel:"noopener noreferrer",title:Oe.path},G(Oe.displayPath),9,d_)):Oe.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:Oe.href,target:"_blank",rel:"noopener noreferrer",title:Oe.href},G(Oe.value),9,f_)):(y(),k("code",h_,G(Oe.value),1))],64))),128))])]))),128))])):M.kind==="orderedList"?(y(),k("ol",p_,[(y(!0),k(Ne,null,vt(M.items,(W,Se)=>(y(),k("li",{key:`ol-${pe}-${Se}`,class:"message-list-item"},[v("div",{class:"message-list-item-content",innerHTML:sn(W)},null,8,m_)]))),128))])):M.kind==="codeBlock"?(y(),k("div",g_,[M.language?(y(),k("div",v_,G(M.language),1)):fe("",!0),v("pre",y_,[v("code",null,G(M.value),1)])])):M.kind==="thematicBreak"?(y(),k("hr",w_)):hr(h.id,pe)?(y(),k("p",b_,G(M.markdown),1)):(y(),k("button",{key:9,class:"message-image-button",type:"button",onClick:W=>rr(M.url)},[v("img",{class:"message-image-preview message-markdown-image",src:M.url,alt:M.alt||"Embedded message image",loading:"lazy",onError:W=>Xr(h.id,pe)},null,40,k_)],8,__))],64))),128))]))],8,hb)):fe("",!0),Bt(h)?(y(),k("div",{key:3,class:"message-toolbar","data-role":h.role},[v("button",{type:"button",class:"message-copy-button","data-copied":He.value===h.id,"aria-label":He.value===h.id?"Response copied":"Copy response",title:He.value===h.id?"Response copied":"Copy response",onClick:M=>dt(h.id)},[De(Nw,{class:"icon-svg message-copy-icon"}),v("span",I_,G(He.value===h.id?"Copied":"Copy"),1)],8,S_)],8,T_)):fe("",!0)],8,ab)],8,ib)],8,ob))],8,Hw))],64)}),128)),e.liveOverlay?(y(),k("li",E_,[v("div",C_,[v("div",A_,[v("article",x_,[v("p",R_,G(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(y(),k("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:mt},G(e.liveOverlay.reasoningText),513)):fe("",!0),e.liveOverlay.errorText?(y(),k("p",P_,G(e.liveOverlay.errorText),1)):fe("",!0)])])])])):fe("",!0),(y(!0),k(Ne,null,vt(e.pendingRequests,h=>(y(),k("li",{key:`server-request:${h.id}`,class:"conversation-item conversation-item-request"},[v("div",M_,[v("div",$_,[v("article",O_,[v("p",N_,G(h.method),1),v("p",L_,"Request #"+G(h.id)+" · "+G(je(h.receivedAtIso)),1),ot(h)?(y(),k("p",D_,G(ot(h)),1)):fe("",!0),h.method==="item/commandExecution/requestApproval"?(y(),k("section",j_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:A=>Ln(h.id,"accept")},"Accept",8,F_),v("button",{type:"button",class:"request-button",onClick:A=>Ln(h.id,"acceptForSession")},"Accept for Session",8,B_),v("button",{type:"button",class:"request-button",onClick:A=>Ln(h.id,"decline")},"Decline",8,U_),v("button",{type:"button",class:"request-button",onClick:A=>Ln(h.id,"cancel")},"Cancel",8,H_)])):h.method==="item/fileChange/requestApproval"?(y(),k("section",W_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:A=>Ln(h.id,"accept")},"Accept",8,V_),v("button",{type:"button",class:"request-button",onClick:A=>Ln(h.id,"acceptForSession")},"Accept for Session",8,z_),v("button",{type:"button",class:"request-button",onClick:A=>Ln(h.id,"decline")},"Decline",8,q_),v("button",{type:"button",class:"request-button",onClick:A=>Ln(h.id,"cancel")},"Cancel",8,G_)])):h.method==="item/tool/requestUserInput"?(y(),k("section",K_,[(y(!0),k(Ne,null,vt(ft(h),A=>{var L;return y(),k("div",{key:`${h.id}:${A.id}`,class:"request-question"},[v("p",J_,G(A.header||A.question),1),A.header&&A.question?(y(),k("p",Y_,G(A.question),1)):fe("",!0),A.options.length>0?(y(),k("select",{key:1,class:"request-select",value:Ot(h.id,A.id,((L=A.options[0])==null?void 0:L.label)||""),onChange:M=>ms(h.id,A.id,M)},[(y(!0),k(Ne,null,vt(A.options,M=>(y(),k("option",{key:`${h.id}:${A.id}:${M.label}`,value:M.label},G(M.label),9,X_))),128))],40,Q_)):fe("",!0),A.options.length>0&&Vn(h.id,A)?(y(),k("p",Z_,G(Vn(h.id,A)),1)):(y(),k("input",{key:3,class:"request-input",type:A.isSecret?"password":"text",value:Ot(h.id,A.id,""),placeholder:A.isSecret?"Enter secret answer":"Enter answer",onInput:M=>Sn(h.id,A.id,M)},null,40,ek)),A.isOther?(y(),k("input",{key:4,class:"request-input",type:A.isSecret?"password":"text",value:Jr(h.id,A.id),placeholder:"Other answer",onInput:M=>Yr(h.id,A.id,M)},null,40,tk)):fe("",!0)])}),128)),v("button",{type:"button",class:"request-button request-button-primary",onClick:A=>Jn(h)}," Submit Answers ",8,nk)])):h.method==="item/tool/call"?(y(),k("section",rk,[v("button",{type:"button",class:"request-button request-button-primary",onClick:A=>Qr(h.id)},"Fail Tool Call",8,sk),v("button",{type:"button",class:"request-button",onClick:A=>gs(h.id)},"Success (Empty)",8,ok)])):(y(),k("section",ik,[v("button",{type:"button",class:"request-button request-button-primary",onClick:A=>vs(h.id)},"Return Empty Result",8,ak),v("button",{type:"button",class:"request-button",onClick:A=>Cr(h.id)},"Reject Request",8,lk)]))])])])]))),128)),v("li",{ref_key:"bottomAnchorRef",ref:Ht,class:"conversation-bottom-anchor"},null,512)],544)),Y.value?(y(),k("button",{key:3,type:"button",class:"jump-to-latest-button",title:"Jump to latest","aria-label":"Jump to latest output",onClick:on},[De(Hf,{class:"icon-svg jump-to-latest-icon"})])):fe("",!0),ct.value.length>0?(y(),k("div",{key:4,class:"image-modal-backdrop",onClick:ws},[v("div",{class:"image-modal-content",onClick:m[0]||(m[0]=kt(()=>{},["stop"]))},[v("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:ws},[De(Ul,{class:"icon-svg"})]),v("img",{class:"image-modal-image",src:ct.value,alt:"Expanded message image"},null,8,ck)])])):fe("",!0)]))}}),fk=yt(dk,[["__scopeId","data-v-de2beab9"]]),pu=.0025,va=3,mu=2,hk=256;function pk(e){var Le;const t=D("idle"),n=D(typeof navigator<"u"&&!!((Le=navigator.mediaDevices)!=null&&Le.getUserMedia)),r=D(0),s=D(null);let o=null,i=null,a=[],l=null,f=null,u=null,g=null,_=[],I=!1,F=!1;function $(){const le=s.value;if(!le||typeof window>"u")return;const re=le.getContext("2d");if(!re)return;const ce=Math.max(1,Math.floor(le.clientWidth)),ne=Math.max(1,Math.floor(le.clientHeight||36)),Pe=window.devicePixelRatio||1,Ye=Math.max(1,Math.floor(ce*Pe)),Ge=Math.max(1,Math.floor(ne*Pe));(le.width!==Ye||le.height!==Ge)&&(le.width=Ye,le.height=Ge),re.setTransform(Pe,0,0,Pe,0,0),re.clearRect(0,0,ce,ne);const Ve=Math.max(12,Math.floor(ce/(va+mu))),Ue=_.slice(-Ve),Re=Math.max(0,Ve-Ue.length),rt=ne/2,Ae=getComputedStyle(le).color||"#000000";for(let Be=0;Be<Ve;Be+=1){const lt=Ue[Be-Re]??0,mt=Math.max(.08,Math.min(1,lt*18))*rt,ct=Be*(va+mu);re.globalAlpha=lt<=pu?.35:1,re.fillStyle=Ae,re.fillRect(ct,rt-mt,va,mt*2)}re.globalAlpha=1}function Q(){_=[],r.value=0,$()}function ae(){u&&(u.disconnect(),u.onaudioprocess=null,u=null),f&&(f.disconnect(),f=null),l&&(l.close(),l=null),g=null}function q(le){if(typeof window>"u")return;const re=window.webkitAudioContext,ce=window.AudioContext??re;ce&&(ae(),Q(),l=new ce,f=l.createMediaStreamSource(le),u=l.createScriptProcessor(2048,1,1),g=performance.now(),u.onaudioprocess=ne=>{const Pe=ne.inputBuffer.getChannelData(0);let Ye=0;for(let Ge=0;Ge<Pe.length;Ge+=1){const Ve=Math.abs(Pe[Ge]??0);Ye+=Ve<pu?0:Ve}_.push(Ye/Pe.length),_.length>hk&&_.shift(),g!==null&&(r.value=Math.max(0,performance.now()-g)),$()},f.connect(u),u.connect(l.destination),$())}async function ee(){var le;if(!(t.value!=="idle"||!n.value||I)){I=!0,F=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=re=>{re.data.size>0&&a.push(re.data)},o.onstop=()=>{var ne;const re=a,ce=(o==null?void 0:o.mimeType)||((ne=re[0])==null?void 0:ne.type)||"audio/webm";ve(),Te(re,ce)},q(i),o.start(250),t.value="recording",F&&te()}catch(re){ve(),t.value="idle",(le=e.onError)==null||le.call(e,re)}finally{I=!1}}}function te(){if(I&&t.value==="idle"){F=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}async function Te(le,re){var ne,Pe,Ye,Ge;if(le.length===0){(ne=e.onEmpty)==null||ne.call(e),t.value="idle";return}const ce=new Blob(le,{type:re});t.value="transcribing";try{const Ve=re.split(/[/;]/)[1]??"webm",Ue=new FormData;Ue.append("file",ce,`codex.${Ve}`);const Re=await fetch("/codex-api/transcribe",{method:"POST",body:Ue}),rt=await Re.text();let Ae=null;try{Ae=rt.trim()?JSON.parse(rt):null}catch{Ae=null}if(!Re.ok){const lt=(Pe=Ae==null?void 0:Ae.error)==null?void 0:Pe.trim(),Ht=rt.trim();throw new Error(lt||Ht||`Transcription failed: ${Re.status}`)}const Be=((Ae==null?void 0:Ae.text)??"").trim();Be.length>0?e.onTranscript(Be):(Ye=e.onEmpty)==null||Ye.call(e)}catch(Ve){(Ge=e.onError)==null||Ge.call(e,Ve)}finally{t.value="idle"}}function ve(){ae(),Q(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(le=>le.stop()),i=null),a=[]}Kr(ve);function ye(){if(t.value==="recording"){te();return}t.value==="idle"&&ee()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:ee,stopRecording:te,toggleRecording:ye}}function gu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class jr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Hl(e,t){const n=gu(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=gu(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function Ls(e,t,n){return e instanceof jr?e:e instanceof Error?new jr(e.message||t,{code:"unknown_error",method:n}):new jr(t,{code:"unknown_error",method:n})}function Wf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function mk(e,t){const n={method:e,params:t??null};let r;try{r=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new jr(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let s=null;try{s=await r.json()}catch{s=null}if(!r.ok)throw new jr(Hl(s,`RPC ${e} failed with HTTP ${r.status}`),{code:"http_error",method:e,status:r.status});const o=s;if(!o||typeof o!="object"||!("result"in o))throw new jr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function gk(e){const t=Wf(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 vu(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function vk(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const s=()=>{r!==null&&(window.clearTimeout(r),r=null)},o=(f,u)=>{if(n||r!==null)return;const g=Math.min(1e3*2**u,1e4);r=window.setTimeout(()=>{r=null,!n&&f()},g)},i=f=>{const u=gk(f);u&&e(u)},a=(f=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const u=new EventSource("/codex-api/events");let g=!1;u.onmessage=_=>{try{i(JSON.parse(_.data))}catch{}},u.addEventListener("ready",_=>{try{const I=_.data?JSON.parse(_.data):{ok:!0};vu(e,I)}catch{vu(e)}}),u.onerror=()=>{n||g||u.readyState===EventSource.CLOSED&&(g=!0,u.close(),o(()=>a(f+1),f))},t=()=>{g=!0,u.close()}},l=(f=0)=>{if(typeof WebSocket>"u"||n){a();return}t==null||t();const u=window.location.protocol==="https:"?"wss:":"ws:",g=new WebSocket(`${u}//${window.location.host}/codex-api/ws`);let _=!1,I=!1,F=window.setTimeout(()=>{_||n||I||(I=!0,g.close(),a())},2500);g.onopen=()=>{_=!0,s(),F!==null&&(window.clearTimeout(F),F=null)},g.onmessage=$=>{try{i(JSON.parse(String($.data)))}catch{}},g.onerror=()=>{},g.onclose=()=>{if(F!==null&&(window.clearTimeout(F),F=null),!(n||I)){if(!_){a();return}o(()=>l(f+1),f)}},t=()=>{I=!0,F!==null&&(window.clearTimeout(F),F=null),g.close()}};return typeof WebSocket<"u"?l():a(),()=>{n=!0,s(),t==null||t()}}async function yk(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 jr(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 jr(Hl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function wk(){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 jr(Hl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Wf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function yu(e){return new Date(e*1e3).toISOString()}function bk(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function _k(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const kk=/^##\s+(.+?):\s+(.+?)\s*$/,Tk=/^#\s*files mentioned by the user\s*:?\s*$/i;function Sk(e){var s,o;const t=e.split(`
|
|
52
|
+
`).findIndex(i=>Tk.test(i.trim()));if(t<0)return[];const n=e.split(`
|
|
53
|
+
`).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(kk);if(!l)break;const f=(s=l[1])==null?void 0:s.trim(),u=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");f&&u&&r.push({label:f,path:u})}return r}function Ik(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 s=r.index+r[0].length;return e.slice(s).trim()}function Ek(e,t){if(!Array.isArray(t))return{text:"",images:[],fileAttachments:[],rawBlocks:[]};const n=[],r=[],s=[];for(const[a,l]of t.entries())l.type==="text"&&typeof l.text=="string"&&l.text.length>0&&n.push(l.text),l.type==="image"&&typeof l.url=="string"&&l.url.trim().length>0&&r.push(l.url.trim()),l.type!=="text"&&l.type!=="image"&&s.push({id:`${e}:user-content:${a}`,role:"user",text:"",messageType:`userContent.${l.type}`,rawPayload:_k(l),isUnhandled:!0});const o=n.join(`
|
|
54
|
+
`),i=Sk(o);return{text:Ik(o),images:r,fileAttachments:i,rawBlocks:s}}function Ck(e){var o;const t=e.replace(/\r\n/g,`
|
|
55
|
+
`).trim();if(!t)return null;const n=t.split(`
|
|
56
|
+
`),r=[],s=[];for(const i of n){const a=i.trim();if(!a){r.length===0&&s.push("");continue}const l=a.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const f=(l[1]??" ").toLowerCase(),u=(o=l[2])==null?void 0:o.trim();if(!u)continue;let g="pending";f==="x"&&(g="completed"),(f==="~"||f===">"||f==="-")&&(g="inProgress"),r.push({step:u,status:g});continue}s.push(a)}return r.length===0?null:{explanation:s.join(`
|
|
57
|
+
`).trim()||void 0,steps:r}}function Ak(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=Ek(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,messageType:e.type}),n.push(...t.rawBlocks),n.length===0?[]:n}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:Ck(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=xk(t.status),r=typeof t.command=="string"?t.command:"",s=typeof t.cwd=="string"?t.cwd:null,o=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",i=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:r,messageType:"commandExecution",commandExecution:{command:r,cwd:s,status:n,aggregatedOutput:o,exitCode:i}}]}return[]}function xk(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Rk(e){const t=[e.preview];for(const n of t)if(typeof n=="string"&&n.trim().length>0)return n.trim();return""}function Pk(e){const t=Rk(e);return t.length>0?t:"Untitled thread"}function Vf(e){return(e==null?void 0:e.status)==="inProgress"}function Mk(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 Vf(r)}function $k(e){const t=e,n=typeof t.cwd=="string"?t.cwd:e.cwd,r=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||n.includes("/.codex/worktrees/")||n.includes("/.git/worktrees/");return{id:e.id,title:Pk(e),projectName:bk(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:yu(e.createdAt),updatedAtIso:yu(e.updatedAt),preview:e.preview,unread:!1,inProgress:Mk(e)}}function Ok(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((s,o)=>new Date(o.updatedAtIso).getTime()-new Date(s.updatedAtIso).getTime())})).sort((n,r)=>{var i,a;const s=new Date(((i=n.threads[0])==null?void 0:i.updatedAtIso)??0).getTime();return new Date(((a=r.threads[0])==null?void 0:a.updatedAtIso)??0).getTime()-s})}function Nk(e){const t=e.data.map($k);return Ok(t)}function zf(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n=[];for(let r=0;r<t.length;r++){const s=t[r],o=Array.isArray(s.items)?s.items:[];for(const i of o)for(const a of Ak(i))n.push({...a,turnIndex:r})}return n}function Lk(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Vf(t.at(-1))}function ya(e){return e&&e.length>0?e:null}const wu=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Zn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function hn(e){return typeof e=="string"&&e.length>0?e:null}function wa(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function tl(e){return typeof e=="boolean"?e:null}function Dk(e){return e==="payment_required"?e:null}function jk(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function bu(e){const t=Zn(e);if(!t)return null;const n=wa(t.usedPercent??t.used_percent);return n===null?null:{usedPercent:n,windowMinutes:wa(t.windowDurationMins??t.window_minutes),resetsAt:wa(t.resetsAt??t.resets_at)}}function Fk(e){const t=Zn(e);if(!t)return null;const n=tl(t.hasCredits??t.has_credits),r=tl(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:hn(t.balance)}}function nl(e){const t=Zn(e);if(!t)return null;const n=bu(t.primary),r=bu(t.secondary),s=Fk(t.credits);return!n&&!r&&!s?null:{limitId:hn(t.limitId??t.limit_id),limitName:hn(t.limitName??t.limit_name),primary:n,secondary:r,credits:s,planType:hn(t.planType??t.plan_type)}}function qf(e,t=null){const n=Zn(e);if(!n)return null;const r=hn(n.accountId),s=hn(n.quotaStatus),o=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,authMode:hn(n.authMode),email:hn(n.email),planType:hn(n.planType),lastRefreshedAtIso:hn(n.lastRefreshedAtIso)??"",lastActivatedAtIso:hn(n.lastActivatedAtIso),quotaSnapshot:nl(n.quotaSnapshot),quotaUpdatedAtIso:hn(n.quotaUpdatedAtIso),quotaStatus:o,quotaError:hn(n.quotaError),unavailableReason:Dk(n.unavailableReason)??(jk(hn(n.quotaError))?"payment_required":null),isActive:tl(n.isActive)??r===t}:null}function Gf(e){const t=Zn(e);if(!t)return null;const n=Zn(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=nl(n==null?void 0:n.codex);return r||nl(t.rateLimits??t.rate_limits)}async function kn(e,t){try{return await mk(e,t)}catch(n){throw Ls(n,`RPC ${e} failed`,e)}}function Bk(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}async function Uk(){const e=await kn("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return Nk(e)}async function Hk(e){const t=await kn("thread/read",{threadId:e,includeTurns:!0});return{messages:zf(t),inProgress:Lk(t)}}async function Wk(){try{return await Uk()}catch(e){throw Ls(e,"Failed to load thread groups","thread/list")}}async function Vk(e){try{return await Hk(e)}catch(t){throw Ls(t,`Failed to load thread ${e}`,"thread/read")}}function zk(e){return vk(e)}async function qk(e,t){await yk({id:e,...t})}async function Gk(){return wk()}async function Kk(){try{const e=await kn("account/rateLimits/read");return Gf(e)}catch(e){throw Ls(e,"Failed to load account rate limits","account/rateLimits/read")}}function Wl(e){const t=Zn(e),n=hn(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:hn(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(s=>qf(s,n)).filter(s=>s!==null)}}async function Jk(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Ds(t,"Failed to load accounts"));const n=Zn(t);return Wl(n==null?void 0:n.data)}async function Yk(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Ds(t,"Failed to refresh accounts"));const n=Zn(t);return Wl(n==null?void 0:n.data)}async function Qk(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(Ds(n,"Failed to switch account"));const r=Zn(n),s=Zn(r==null?void 0:r.data),o=qf(s==null?void 0:s.account,hn(s==null?void 0:s.activeAccountId));if(!o)throw new Error("Failed to switch account");return o}async function Xk(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(Ds(n,"Failed to remove account"));const r=Zn(n);return Wl(r==null?void 0:r.data)}async function ba(e){await kn("thread/resume",{threadId:e})}async function Zk(e){await kn("thread/archive",{threadId:e})}async function e0(e,t){await kn("thread/name/set",{threadId:e,name:t})}async function t0(e,t){const n=await kn("thread/rollback",{threadId:e,numTurns:t});return zf(n)}function n0(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""}async function _u(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 kn("thread/start",n),s=n0(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw Ls(n,"Failed to start a new thread","thread/start")}}function r0(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
58
|
+
`;for(const r of t)n+=`
|
|
59
|
+
## ${r.label}: ${r.path}
|
|
60
|
+
`;return`${n}
|
|
61
|
+
## My request for Codex:
|
|
62
|
+
|
|
63
|
+
${e}
|
|
64
|
+
`}async function s0(e,t){var a;const n=(e==null?void 0:e.trim())??"";if(n)return{model:n,reasoningEffort:ya(t)};let r=null;try{r=await Jf()}catch{r=null}const s=(r==null?void 0:r.model.trim())??"";if(s)return{model:s,reasoningEffort:ya(t??(r==null?void 0:r.reasoningEffort))};let o=[];try{o=await Kf()}catch{o=[]}const i=((a=o.find(l=>l.trim().length>0))==null?void 0:a.trim())??"";if(i)return{model:i,reasoningEffort:ya(t??(r==null?void 0:r.reasoningEffort))};throw new Error("Plan mode requires an available model. Wait for models to load and try again.")}async function _a(e,t,n=[],r,s,o,i=[],a){try{const l=(r==null?void 0:r.trim())??"",u=[{type:"text",text:r0(t,i)}];for(const I of n){const F=I.trim();F&&u.push({type:"image",url:F,image_url:F})}if(o)for(const I of o)u.push({type:"skill",name:I.name,path:I.path});const g=i.map(I=>({label:I.label,path:I.path,fsPath:I.fsPath})),_={threadId:e,input:u};if(g.length>0&&(_.attachments=g),l&&(_.model=l),typeof s=="string"&&s.length>0&&(_.effort=s),a==="plan"){const I=await s0(l,s);_.collaborationMode={mode:"plan",settings:{model:I.model,reasoning_effort:I.reasoningEffort,developer_instructions:null}}}await kn("turn/start",_)}catch(l){throw Ls(l,`Failed to start turn for thread ${e}`,"turn/start")}}async function o0(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 kn("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw Ls(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function i0(e){await kn("setDefaultModel",{model:e})}async function Kf(){const e=await kn("model/list",{}),t=[];for(const n of e.data){const r=n.id||n.model;!r||t.includes(r)||t.push(r)}return t}async function Jf(){const e=await kn("config/read",{}),t=e.config.model??"",n=Bk(e.config.model_reasoning_effort);return{model:t,reasoningEffort:n}}function a0(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function l0(){try{const e=await kn("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const s=r.mode;s!=="default"&&s!=="plan"||t.has(s)||(t.add(s),n.push({value:s,label:a0(r.name||s)||(s==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of wu)t.has(r.value)||n.push(r);return n.sort((r,s)=>r.value===s.value?0:r.value==="default"?-1:1)}}catch{}return wu}function c0(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=o=>{if(!Array.isArray(o))return[];const i=[];for(const a of o)typeof a=="string"&&a.length>0&&!i.includes(a)&&i.push(a);return i},r=t.labels,s={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[o,i]of Object.entries(r))typeof o=="string"&&o.length>0&&typeof i=="string"&&(s[o]=i);return{order:n(t.order),labels:s,active:n(t.active)}}async function yo(){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 c0(n.data)}async function u0(e){const t=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e})}),n=await t.json();if(!t.ok||!n.data)throw new Error(n.error||"Failed to create worktree");return n.data}async function ku(){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 Tu(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")}async function Su(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 a=Ds(r,"Failed to open project root");throw new Error(a)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return typeof o.path=="string"?o.path.trim():""}async function d0(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 i=Ds(r,"Failed to suggest project name");throw new Error(i)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return{name:typeof o.name=="string"?o.name.trim():"",path:typeof o.path=="string"?o.path.trim():""}}async function f0(e,t,n=20){const r=e.trim();if(!r)return[];const s=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 s.json();if(!s.ok){const f=Ds(o,"Failed to search files");throw new Error(f)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const f of a){if(!f||typeof f!="object"||Array.isArray(f))continue;const g=f.path,_=typeof g=="string"?g.trim():"";_&&l.push({path:_})}return l}async function h0(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}function Ds(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 s=n.error;return typeof s=="string"&&s.trim().length>0?s:t}async function p0(){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 ka(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 m0(e,t){var n;try{return((n=(await kn("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function g0(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await kn("skills/list",t),r=[],s=new Set;for(const o of n.data)for(const i of o.skills)!i.name||s.has(i.path)||(s.add(i.path),r.push({name:i.name,description:i.shortDescription||i.description||"",path:i.path,scope:i.scope,enabled:i.enabled}));return r}catch{return[]}}async function Iu(e){try{const t=new FormData;t.append("file",e);const n=await fetch("/codex-api/upload-file",{method:"POST",body:t});return n.ok?(await n.json()).path??null:null}catch{return null}}const v0={},y0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function w0(e,t){return y(),k("svg",y0,[...t[0]||(t[0]=[v("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 b0=yt(v0,[["render",w0]]),_0={},k0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function T0(e,t){return y(),k("svg",k0,[...t[0]||(t[0]=[v("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),v("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 Eu=yt(_0,[["render",T0]]),S0=["disabled"],I0={class:"composer-dropdown-value"},E0={class:"composer-dropdown-menu"},C0={key:0,class:"composer-dropdown-search-wrap"},A0=["placeholder","onKeydown"],x0={class:"composer-dropdown-options",role:"listbox"},R0=["onClick"],P0={key:0,class:"composer-dropdown-empty"},M0={key:1,class:"composer-dropdown-add-wrap"},$0=["placeholder","onKeydown"],O0=cn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},showAddAction:{type:Boolean},addActionLabel:{},defaultAddValue:{},addPlaceholder:{}},emits:["update:modelValue","add"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(null),a=D(!1),l=D(""),f=D(!1),u=D(""),g=de(()=>{var ce;const re=n.options.find(ne=>ne.value===n.modelValue);return re?re.label:((ce=n.placeholder)==null?void 0:ce.trim())||""}),_=de(()=>n.openDirection??"down"),I=de(()=>n.enableSearch===!0),F=de(()=>n.showAddAction===!0),$=de(()=>{var re;return((re=n.searchPlaceholder)==null?void 0:re.trim())||"Quick search projects"}),Q=de(()=>{var re;return((re=n.addActionLabel)==null?void 0:re.trim())||"Add new project"}),ae=de(()=>{var re;return((re=n.addPlaceholder)==null?void 0:re.trim())||"Project name or absolute path"}),q=de(()=>{const re=l.value.trim().toLowerCase();return re?n.options.filter(ce=>ce.label.toLowerCase().includes(re)||ce.value.toLowerCase().includes(re)):n.options});function ee(){n.disabled||(a.value=!a.value)}function te(re){r("update:modelValue",re),a.value=!1,l.value=""}function Te(){var re;f.value=!0,u.value=((re=n.defaultAddValue)==null?void 0:re.trim())||"",en(()=>{var ce;return(ce=i.value)==null?void 0:ce.focus()})}function ve(){if(l.value.length>0){l.value="";return}a.value=!1}function ye(){const re=u.value.trim();re&&(r("add",re),f.value=!1,u.value="",a.value=!1,l.value="")}function Le(){f.value=!1,u.value="",a.value=!1,l.value=""}function le(re){if(!a.value)return;const ce=s.value;if(!ce)return;const ne=re.target;ne instanceof Node&&(ce.contains(ne)||(a.value=!1,l.value="",f.value=!1,u.value=""))}return ht(a,re=>{if(!re){f.value=!1,u.value="";return}I.value&&en(()=>{var ce;return(ce=o.value)==null?void 0:ce.focus()})}),Gr(()=>{window.addEventListener("pointerdown",le)}),Kr(()=>{window.removeEventListener("pointerdown",le)}),(re,ce)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[v("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:ee},[v("span",I0,G(g.value),1),De(Ji,{class:"composer-dropdown-chevron"})],8,S0),a.value?(y(),k("div",{key:0,class:tt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":_.value==="up","composer-dropdown-menu-wrap-down":_.value==="down"}])},[v("div",E0,[I.value?(y(),k("div",C0,[Hr(v("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":ce[0]||(ce[0]=ne=>l.value=ne),class:"composer-dropdown-search-input",type:"text",placeholder:$.value,onKeydown:xn(kt(ve,["prevent"]),["esc"])},null,40,A0),[[Wr,l.value]])])):fe("",!0),v("ul",x0,[(y(!0),k(Ne,null,vt(q.value,ne=>(y(),k("li",{key:ne.value},[v("button",{class:tt(["composer-dropdown-option",{"is-selected":ne.value===e.modelValue}]),type:"button",onClick:Pe=>te(ne.value)},G(ne.label),11,R0)]))),128)),q.value.length===0?(y(),k("li",P0," No matching projects ")):fe("",!0)]),F.value?(y(),k("div",M0,[f.value?(y(),k(Ne,{key:0},[Hr(v("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":ce[1]||(ce[1]=ne=>u.value=ne),class:"composer-dropdown-add-input",type:"text",placeholder:ae.value,onKeydown:[xn(kt(ye,["prevent"]),["enter"]),xn(kt(Le,["prevent"]),["esc"])]},null,40,$0),[[Wr,u.value]]),v("div",{class:"composer-dropdown-add-actions"},[v("button",{type:"button",class:"composer-dropdown-add-btn",onClick:ye},"Open"),v("button",{type:"button",class:"composer-dropdown-add-btn",onClick:Le},"Cancel")])],64)):(y(),k("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:Te},G(Q.value),1))])):fe("",!0)])],2)):fe("",!0)],512))}}),rl=yt(O0,[["__scopeId","data-v-7cfa2012"]]),N0=["disabled"],L0={class:"search-dropdown-value"},D0={class:"search-dropdown-search-wrap"},j0=["placeholder","onKeydown"],F0={key:0,class:"search-dropdown-list",role:"listbox"},B0=["onClick","onPointerenter"],U0={class:"search-dropdown-option-check"},H0={class:"search-dropdown-option-label"},W0={key:0,class:"search-dropdown-option-desc"},V0={key:1,class:"search-dropdown-empty"},z0=cn({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(!1),a=D(""),l=D(0),f=de(()=>n.openDirection??"down"),u=de(()=>new Set(n.selectedValues)),g=de(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const q=n.options.find(ee=>ee.value===n.selectedValues[0]);return(q==null?void 0:q.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),_=de(()=>{const q=a.value.toLowerCase().trim();return q?n.options.filter(ee=>{var te;return ee.label.toLowerCase().includes(q)||(((te=ee.description)==null?void 0:te.toLowerCase().includes(q))??!1)}):n.options});function I(){n.disabled||(i.value=!i.value,i.value&&(a.value="",l.value=0,en(()=>{var q;return(q=o.value)==null?void 0:q.focus()})))}function F(q){r("toggle",q.value,!u.value.has(q.value))}function $(q){_.value.length!==0&&(l.value=(l.value+q+_.value.length)%_.value.length)}function Q(){const q=_.value[l.value];q&&F(q)}function ae(q){if(!i.value)return;const ee=s.value;if(!ee)return;const te=q.target;te instanceof Node&&(ee.contains(te)||(i.value=!1))}return ht(a,()=>{l.value=0}),Gr(()=>window.addEventListener("pointerdown",ae)),Kr(()=>window.removeEventListener("pointerdown",ae)),(q,ee)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[v("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:I},[v("span",L0,G(g.value),1),De(Ji,{class:"search-dropdown-chevron"})],8,N0),i.value?(y(),k("div",{key:0,class:tt(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":f.value==="up","search-dropdown-menu-wrap-down":f.value==="down"}])},[v("div",D0,[Hr(v("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":ee[0]||(ee[0]=te=>a.value=te),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[ee[1]||(ee[1]=xn(kt(te=>i.value=!1,["prevent"]),["escape"])),xn(kt(Q,["prevent"]),["enter"]),ee[2]||(ee[2]=xn(kt(te=>$(1),["prevent"]),["arrow-down"])),ee[3]||(ee[3]=xn(kt(te=>$(-1),["prevent"]),["arrow-up"]))]},null,40,j0),[[Wr,a.value]])]),_.value.length>0?(y(),k("ul",F0,[(y(!0),k(Ne,null,vt(_.value,(te,Te)=>(y(),k("li",{key:te.value},[v("button",{class:tt(["search-dropdown-option",{"is-selected":u.value.has(te.value),"is-highlighted":Te===l.value}]),type:"button",onClick:ve=>F(te),onPointerenter:ve=>l.value=Te},[v("span",U0,G(u.value.has(te.value)?"✓":""),1),v("span",H0,G(te.label),1),te.description?(y(),k("span",W0,G(te.description),1)):fe("",!0)],42,B0)]))),128))])):(y(),k("div",V0,"No results"))],2)):fe("",!0)],512))}}),q0=yt(z0,[["__scopeId","data-v-a0f2edd4"]]),G0={class:"skill-picker-header"},K0=["onKeydown"],J0={key:0,class:"skill-picker-list",role:"listbox"},Y0=["onClick","onPointerenter"],Q0={class:"skill-picker-name"},X0={key:0,class:"skill-picker-desc"},Z0={key:1,class:"skill-picker-empty"},eT=cn({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(""),a=D(0),l=de(()=>{const _=i.value.toLowerCase().trim();return _?n.skills.filter(I=>I.name.toLowerCase().includes(_)||I.description.toLowerCase().includes(_)):n.skills}),f=de(()=>{const _={};return n.anchorBottom!=null&&(_.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(_.left=`${n.anchorLeft}px`),_});function u(_){l.value.length!==0&&(a.value=(a.value+_+l.value.length)%l.value.length)}function g(){const _=l.value[a.value];_&&r("select",_)}return ht(()=>n.visible,_=>{_&&(i.value="",a.value=0,en(()=>{var I;return(I=o.value)==null?void 0:I.focus()}))}),ht(i,()=>{a.value=0}),(_,I)=>e.visible?(y(),k("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:cs(f.value)},[v("div",G0,[Hr(v("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":I[0]||(I[0]=F=>i.value=F),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[I[1]||(I[1]=xn(kt(F=>_.$emit("close"),["prevent"]),["escape"])),xn(kt(g,["prevent"]),["enter"]),I[2]||(I[2]=xn(kt(F=>u(1),["prevent"]),["arrow-down"])),I[3]||(I[3]=xn(kt(F=>u(-1),["prevent"]),["arrow-up"]))]},null,40,K0),[[Wr,i.value]])]),l.value.length>0?(y(),k("ul",J0,[(y(!0),k(Ne,null,vt(l.value,(F,$)=>(y(),k("li",{key:F.path},[v("button",{class:tt(["skill-picker-item",{"is-highlighted":$===a.value}]),type:"button",onClick:Q=>_.$emit("select",F),onPointerenter:Q=>a.value=$},[v("span",Q0,G(F.name),1),F.description?(y(),k("span",X0,G(F.description),1)):fe("",!0)],42,Y0)]))),128))])):(y(),k("div",Z0,"No skills found"))],4)):fe("",!0)}}),tT=yt(eT,[["__scopeId","data-v-ff3fb7dc"]]),nT={key:0,class:"thread-composer-dictation-error"},rT={key:0,class:"thread-composer-attachments"},sT=["src","alt"],oT=["aria-label","disabled","onClick"],iT={key:1,class:"thread-composer-folder-chips"},aT=["title"],lT={class:"thread-composer-folder-chip-meta"},cT=["aria-label","disabled","onClick"],uT={key:2,class:"thread-composer-file-chips"},dT=["title"],fT=["aria-label","disabled","onClick"],hT={key:3,class:"thread-composer-skill-chips"},pT={class:"thread-composer-skill-chip-name"},mT=["aria-label","onClick"],gT=["title"],vT={class:"thread-composer-rate-limit-row"},yT={class:"thread-composer-rate-limit-value"},wT={key:0,class:"thread-composer-rate-limit-refresh"},bT={class:"thread-composer-input-wrap"},_T={key:0,class:"thread-composer-file-mentions"},kT=["onMousedown"],TT={key:1,class:"thread-composer-file-mention-icon-markdown"},ST={class:"thread-composer-file-mention-text"},IT={class:"thread-composer-file-mention-name"},ET={key:0,class:"thread-composer-file-mention-dir"},CT={key:1,class:"thread-composer-file-mention-empty"},AT=["placeholder","disabled"],xT=["disabled"],RT={key:0,class:"thread-composer-attach-menu"},PT=["disabled"],MT=["disabled"],$T=["disabled"],OT=["aria-label","aria-pressed","disabled"],NT={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},LT={key:1,class:"thread-composer-dictation-timer"},DT=["aria-label","title","disabled"],jT={key:1,class:"thread-composer-mic-spinner","aria-hidden":"true"},FT=["disabled"],BT=["aria-label","title","disabled"],UT=["disabled"],HT=["disabled"],WT=["disabled"],VT=cn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},collaborationModes:{},selectedCollaborationMode:{},models:{},selectedModel:{},selectedReasoningEffort:{},skills:{},codexQuota:{},isTurnInProgress:{type:Boolean},isInterruptingTurn:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean}},emits:["submit","interrupt","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,r=t,s=D(""),o=D([]),i=D([]),a=D([]),l=D([]),f=D(""),{state:u,isSupported:g,recordingDurationMs:_,waveformCanvasRef:I,startRecording:F,stopRecording:$,toggleRecording:Q}=pk({onTranscript:x=>{s.value=s.value?`${s.value}
|
|
65
|
+
${x}`:x,f.value="",en(()=>{var U;return(U=Te.value)==null?void 0:U.focus()})},onEmpty:()=>{f.value=n.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:x=>{if(x instanceof DOMException&&x.name==="NotAllowedError"){f.value="Microphone access was denied.";return}f.value=x instanceof Error?x.message:"Dictation failed."}}),ae=D(null),q=D(null),ee=D(null),te=D(null),Te=D(null),ve=D(!1),ye=D(!1),Le=D(null),le=D(""),re=D([]),ce=D(!1),ne=D(0);let Pe=0,Ye=null,Ge=!1;const Ve=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),Ue=[{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"}],Re=de(()=>n.models.map(x=>({value:x,label:x}))),rt=de(()=>n.selectedCollaborationMode==="plan"),Ae=de(()=>n.selectedCollaborationMode==="plan"&&n.selectedModel.trim().length===0),Be=de(()=>n.skills??[]),lt=de(()=>i.value.map(x=>x.path)),Ht=de(()=>(n.skills??[]).map(x=>({value:x.path,label:x.name,description:x.description}))),mt=de(()=>n.disabled||!n.activeThreadId||Ae.value?!1:s.value.trim().length>0||o.value.length>0||a.value.length>0),ct=de(()=>{const x=new Set;for(const U of l.value)for(const se of U.filePaths)x.add(se);return a.value.filter(U=>!x.has(U.fsPath))}),He=de(()=>n.disabled||!n.activeThreadId),V=de(()=>n.inProgressSubmitMode==="steer"?"steer":"queue"),_e=de(()=>u.value==="recording"),he=de(()=>u.value==="recording"?"Stop dictation":u.value==="transcribing"?"Transcribing dictation":n.dictationClickToToggle?"Click to dictate":"Hold to dictate"),ge=de(()=>u.value==="idle"?f.value.trim():""),Ce=de(()=>{const x=Math.max(0,Math.floor(_.value/1e3)),U=Math.floor(x/60),se=x%60;return`${U}:${String(se).padStart(2,"0")}`}),T=de(()=>n.activeThreadId?Ae.value?"Loading models for plan mode...":"Type a message... (@ for files, / for skills)":"Select a thread to send a message"),E=de(()=>we(n.codexQuota??null)),O=de(()=>""),z=de(()=>ke(n.codexQuota??null));function Y(x){return!x||x==="unknown"?"":x==="edu"?"Education":`${x.slice(0,1).toUpperCase()}${x.slice(1)}`}function N(x){return typeof x!="number"||!Number.isFinite(x)||x<=0?"":x%1440===0?`${x/1440}d`:x%60===0?`${x/60}h`:`${x}m`}function B(x){if(typeof x!="number"||!Number.isFinite(x))return"";const se=x*1e3-Date.now();if(se<=0)return"resetting now";const je=Math.round(se/6e4);if(je<60)return`resets in ${Math.max(1,je)}m`;const ot=Math.round(je/60);if(ot<48)return`resets in ${Math.max(1,ot)}h`;const ut=Math.round(ot/24);return`resets in ${Math.max(1,ut)}d`}function H(x){return typeof x!="number"||!Number.isFinite(x)?"":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(x*1e3))}function X(x){if(typeof x!="number"||!Number.isFinite(x))return"";const U=new Date(x*1e3);return`${U.getMonth()+1}月${U.getDate()}日`}function Z(x){const U=[x.primary,x.secondary].filter(ot=>ot!==null),se=U.find(ot=>ot.windowMinutes===10080);if(se)return se;const je=U.filter(ot=>typeof ot.windowMinutes=="number"&&ot.windowMinutes>=10080).sort((ot,ut)=>(ot.windowMinutes??0)-(ut.windowMinutes??0));return je[0]?je[0]:x.secondary??null}function Ee(x){const U=Math.max(0,Math.min(100,100-Math.round(x.usedPercent))),se=N(x.windowMinutes);return se?`${U}% / ${se}`:`${U}%`}function we(x){var ut,ft;if(!x)return"";const U=[],se=Y(x.planType);se&&U.push(se),x.primary&&U.push(Ee(x.primary)),x.secondary&&U.push(Ee(x.secondary));const je=Z(x),ot=X((je==null?void 0:je.resetsAt)??null);return ot&&U.push(ot),U.length===0&&((ut=x.credits)!=null&&ut.unlimited)?U.push("Unlimited credits"):U.length===0&&((ft=x.credits)!=null&&ft.hasCredits)&&x.credits.balance&&U.push(`${x.credits.balance} credits`),U.join(" · ")}function ke(x){var ot,ut;if(!x)return"";const U=[],se=Y(x.planType);if(se&&U.push(`Plan: ${se}`),x.primary){const ft=B(x.primary.resetsAt);U.push(`Primary window: ${Ee(x.primary)}${ft?`, ${ft}`:""}`)}if(x.secondary){const ft=B(x.secondary.resetsAt);U.push(`Secondary window: ${Ee(x.secondary)}${ft?`, ${ft}`:""}`)}(ot=x.credits)!=null&&ot.unlimited?U.push("Credits: unlimited"):(ut=x.credits)!=null&&ut.hasCredits&&x.credits.balance&&U.push(`Credits: ${x.credits.balance}`);const je=Z(x);if(je){const ft=H(je.resetsAt);ft&&U.push(`Weekly refresh: ${ft}`)}return U.join(`
|
|
66
|
+
`)}function xe(x="steer"){var se;const U=s.value.trim();if(mt.value){if(r("submit",{text:U,imageUrls:o.value.map(je=>je.url),fileAttachments:[...a.value],skills:i.value.map(je=>({name:je.name,path:je.path})),mode:x}),s.value="",o.value=[],i.value=[],a.value=[],l.value=[],ve.value=!1,ye.value=!1,Me(),Ve){(se=Te.value)==null||se.blur();return}en(()=>{var je;return(je=Te.value)==null?void 0:je.focus()})}}function ze(){r("interrupt")}function it(x){r("update:selected-model",x)}function We(){r("update:selected-collaboration-mode",rt.value?"default":"plan")}function pt(x){r("update:selected-reasoning-effort",x)}function bt(){n.dictationClickToToggle&&(f.value&&(f.value=""),Q())}function Pt(x){if(n.dictationClickToToggle||(x.preventDefault(),Ge))return;Ge=!0;const U=x.currentTarget;if(U)try{U.setPointerCapture(x.pointerId)}catch{}f.value&&(f.value=""),window.addEventListener("pointerup",Ke),window.addEventListener("pointercancel",Ke),window.addEventListener("blur",Ke),F()}function Ke(){n.dictationClickToToggle||Ge&&(Ge=!1,window.removeEventListener("pointerup",Ke),window.removeEventListener("pointercancel",Ke),window.removeEventListener("blur",Ke),$())}function Bt(){He.value||(ve.value=!ve.value)}function zt(){var x;(x=q.value)==null||x.click()}function dt(){var x;(x=ee.value)==null||x.click()}function _t(){var x;(x=te.value)==null||x.click()}function gt(x){o.value=o.value.filter(U=>U.id!==x)}function nn(x){i.value=i.value.filter(U=>U.path!==x)}function xt(x){a.value=a.value.filter(U=>U.fsPath!==x)}function Rt(x){const U=l.value.find(je=>je.id===x);if(!U)return;const se=new Set(U.filePaths);a.value=a.value.filter(je=>!se.has(je.fsPath)),l.value=l.value.filter(je=>je.id!==x)}function Mn(x){return x.total<=0?0:Math.round(x.processed/x.total*100)}function Wt(x,U){const se=x.replace(/\\/g,"/");if(a.value.some(ut=>ut.fsPath===se))return;const je=se.split("/").filter(Boolean),ot=(U==null?void 0:U.trim())||je[je.length-1]||se;a.value=[...a.value,{label:ot,path:se,fsPath:se}]}function $n(x){return x.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(x.name)}function Mt(x){const U=new FileReader;U.onload=()=>{typeof U.result=="string"&&o.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:x.name||`Pasted image ${o.value.length+1}`,url:U.result})},U.readAsDataURL(x)}function Kt(x){if(!(!x||x.length===0))for(const U of Array.from(x)){if($n(U)){Mt(U);continue}Iu(U).then(se=>{se&&Wt(se)}).catch(()=>{})}}function Dt(x){var je,ot;const U=(je=x.clipboardData)==null?void 0:je.items;if(U&&U.length>0){const ut=[];for(const ft of Array.from(U)){if(ft.kind!=="file"||!ft.type.startsWith("image/"))continue;const Ot=ft.getAsFile();Ot&&ut.push(Ot)}if(ut.length>0)return ut}const se=(ot=x.clipboardData)==null?void 0:ot.files;return!se||se.length===0?[]:Array.from(se).filter(ut=>$n(ut))}function rn(x){if(He.value)return;const U=Dt(x);U.length!==0&&(x.preventDefault(),Kt(U),ve.value=!1,f.value&&(f.value=""))}async function Tn(x){if(!x||x.length===0)return;const U=Array.from(x),je=(U[0].webkitRelativePath||U[0].name).split("/").filter(Boolean)[0]||"Folder",ot=`${Date.now()}-${Math.random().toString(36).slice(2)}`;l.value=[...l.value,{id:ot,name:je,total:U.length,processed:0,filePaths:[],isUploading:!0}];const ut=ft=>{l.value=l.value.map(Ot=>Ot.id===ot?ft(Ot):Ot)};for(const ft of U)try{const Ot=await Iu(ft);if(Ot){const Sn=ft.webkitRelativePath||ft.name;Wt(Ot,Sn),ut(Vn=>({...Vn,processed:Vn.processed+1,filePaths:[...Vn.filePaths,Ot]}));continue}ut(Sn=>({...Sn,processed:Sn.processed+1}))}catch{ut(Ot=>({...Ot,processed:Ot.processed+1}))}ut(ft=>({...ft,isUploading:!1}))}function un(x){x&&(x.value="")}function Bn(x){const U=x.target;Kt((U==null?void 0:U.files)??null),un(U),ve.value=!1}function dn(x){const U=x.target;Kt((U==null?void 0:U.files)??null),un(U),ve.value=!1}function Un(x){const U=x.target;Tn((U==null?void 0:U.files)??null),un(U),ve.value=!1}function Gn(){f.value&&(f.value="");const U=s.value.startsWith("/");U!==ye.value&&(ye.value=U),$e()}function er(x){if(ce.value){if(x.key==="Escape"){x.preventDefault(),Me();return}if(x.key==="ArrowDown"){x.preventDefault(),re.value.length>0&&(ne.value=(ne.value+1)%re.value.length);return}if(x.key==="ArrowUp"){if(x.preventDefault(),re.value.length>0){const se=re.value.length;ne.value=(ne.value+se-1)%se}return}if(x.key==="Enter"||x.key==="Tab"){x.preventDefault();const se=re.value[ne.value];se?Yt(se):Me();return}}if(n.sendWithEnter!==!1?x.key==="Enter"&&!x.shiftKey:x.key==="Enter"&&(x.metaKey||x.ctrlKey)){x.preventDefault(),xe(n.isTurnInProgress?V.value:"steer");return}if(ye.value){if(x.key==="Escape"){x.preventDefault(),Hn();return}if(x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();return}}}function Hn(){var x;ye.value=!1,(x=Te.value)==null||x.focus()}function Me(){ce.value=!1,Le.value=null,le.value="",re.value=[],ne.value=0}function $e(){const x=Te.value;if(!x){Me();return}const U=x.selectionStart??s.value.length,je=s.value.slice(0,U).match(/(^|\s)(@[^\s@]*)$/);if(!je){Me();return}const ot=je[2]??"",ut=ot.length,ft=U-ut;Le.value=ft,le.value=ot.slice(1),ce.value=!0,On()}async function On(){if(!ce.value)return;const x=(n.cwd??"").trim();if(!x){re.value=[];return}Ye&&clearTimeout(Ye);const U=++Pe;Ye=setTimeout(async()=>{try{const se=await f0(x,le.value,20);if(!ce.value||U!==Pe)return;re.value=se,ne.value=0}catch{if(!ce.value||U!==Pe)return;re.value=[]}},120)}function Yt(x){const U=Te.value,se=Le.value;if(se!==null&&U){const je=U.selectionStart??s.value.length;s.value=`${s.value.slice(0,se)}${s.value.slice(je)}`.trimEnd()}Wt(x.path),Me(),en(()=>U==null?void 0:U.focus())}function Wn(x){const U=x.lastIndexOf("/");return U<0?x:x.slice(U+1)}function Nn(x){const U=x.lastIndexOf("/");return U<=0?"":x.slice(0,U)}function mn(x){const U=Wn(x),se=U.lastIndexOf(".");return se<=0?"":U.slice(se+1).toLowerCase()}function tr(x){const U=mn(x);return U==="ts"?"TS":U==="tsx"?"TSX":U==="js"?"JS":U==="jsx"?"JSX":U==="json"?"{}":""}function Kn(x){const U=mn(x);return U.startsWith("ts")?"ts":U.startsWith("js")?"js":U==="json"?"json":"default"}function Ut(x){const U=mn(x);return U==="md"||U==="mdx"}function fn(x){var U;i.value.some(se=>se.path===x.path)||(i.value=[...i.value,x]),s.value=s.value.startsWith("/")?"":s.value,ye.value=!1,(U=Te.value)==null||U.focus()}function nr(x,U){if(U){const se=(n.skills??[]).find(je=>je.path===x);se&&!i.value.some(je=>je.path===x)&&(i.value=[...i.value,se])}else i.value=i.value.filter(se=>se.path!==x)}function sn(x){if(!ve.value)return;const U=ae.value;if(!U)return;const se=x.target;!se||U.contains(se)||(ve.value=!1)}return Gr(()=>{document.addEventListener("click",sn)}),Kr(()=>{document.removeEventListener("click",sn),window.removeEventListener("pointerup",Ke),window.removeEventListener("pointercancel",Ke),window.removeEventListener("blur",Ke),Ye&&clearTimeout(Ye)}),ht(()=>n.activeThreadId,()=>{s.value="",o.value=[],i.value=[],a.value=[],l.value=[],f.value="",ve.value=!1,ye.value=!1,Me()}),ht(()=>n.cwd,()=>{ce.value&&On()}),(x,U)=>(y(),k("form",{class:"thread-composer",onSubmit:U[2]||(U[2]=kt(se=>xe("steer"),["prevent"]))},[ge.value?(y(),k("p",nT,G(ge.value),1)):fe("",!0),v("div",{class:tt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[o.value.length>0?(y(),k("div",rT,[(y(!0),k(Ne,null,vt(o.value,se=>(y(),k("div",{key:se.id,class:"thread-composer-attachment"},[v("img",{class:"thread-composer-attachment-image",src:se.url,alt:se.name||"Selected image"},null,8,sT),v("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${se.name||"image"}`,disabled:He.value,onClick:je=>gt(se.id)}," x ",8,oT)]))),128))])):fe("",!0),l.value.length>0?(y(),k("div",iT,[(y(!0),k(Ne,null,vt(l.value,se=>(y(),k("span",{key:se.id,class:"thread-composer-folder-chip"},[De(Bl,{class:"thread-composer-folder-chip-icon"}),v("span",{class:"thread-composer-folder-chip-name",title:se.name},G(se.name),9,aT),v("span",lT,[se.isUploading?(y(),k(Ne,{key:0},[Lo(G(Mn(se))+"% uploading ("+G(se.processed)+"/"+G(se.total)+") ",1)],64)):(y(),k(Ne,{key:1},[Lo(G(se.filePaths.length)+" file"+G(se.filePaths.length===1?"":"s"),1)],64))]),v("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${se.name}`,disabled:He.value,onClick:je=>Rt(se.id)},"×",8,cT)]))),128))])):fe("",!0),ct.value.length>0?(y(),k("div",uT,[(y(!0),k(Ne,null,vt(ct.value,se=>(y(),k("span",{key:se.fsPath,class:"thread-composer-file-chip"},[De(Ci,{class:"thread-composer-file-chip-icon"}),v("span",{class:"thread-composer-file-chip-name",title:se.fsPath},G(se.label),9,dT),v("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${se.label}`,disabled:He.value,onClick:je=>xt(se.fsPath)},"×",8,fT)]))),128))])):fe("",!0),i.value.length>0?(y(),k("div",hT,[(y(!0),k(Ne,null,vt(i.value,se=>(y(),k("span",{key:se.path,class:"thread-composer-skill-chip"},[v("span",pT,G(se.name),1),v("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${se.name}`,onClick:je=>nn(se.path)},"×",8,mT)]))),128))])):fe("",!0),E.value?(y(),k("div",{key:4,class:"thread-composer-rate-limit",title:z.value,"aria-live":"polite"},[v("span",vT,[v("span",yT,G(E.value),1)]),O.value?(y(),k("span",wT,G(O.value),1)):fe("",!0)],8,gT)):fe("",!0),v("div",bT,[ce.value?(y(),k("div",_T,[re.value.length>0?(y(!0),k(Ne,{key:0},vt(re.value,(se,je)=>(y(),k("button",{key:se.path,class:tt(["thread-composer-file-mention-row",{"is-active":je===ne.value}]),type:"button",onMousedown:kt(ot=>Yt(se),["prevent"])},[tr(se.path)?(y(),k("span",{key:0,class:tt(["thread-composer-file-mention-icon-badge",`is-${Kn(se.path)}`])},G(tr(se.path)),3)):Ut(se.path)?(y(),k("span",TT,"↓")):(y(),wt(Ci,{key:2,class:"thread-composer-file-mention-icon-file"})),v("span",ST,[v("span",IT,G(Wn(se.path)),1),Nn(se.path)?(y(),k("span",ET,G(Nn(se.path)),1)):fe("",!0)])],42,kT))),128)):(y(),k("div",CT,"No matching files"))])):fe("",!0),Hr(v("textarea",{ref_key:"inputRef",ref:Te,"onUpdate:modelValue":U[0]||(U[0]=se=>s.value=se),class:"thread-composer-input",placeholder:T.value,disabled:He.value,onInput:Gn,onKeydown:er,onPaste:rn},null,40,AT),[[Wr,s.value]]),De(tT,{skills:Be.value,visible:ye.value,"anchor-bottom":44,"anchor-left":0,onSelect:fn,onClose:Hn},null,8,["skills","visible"])]),v("div",{class:tt(["thread-composer-controls",{"thread-composer-controls--recording":_e.value}])},[v("div",{ref_key:"attachMenuRootRef",ref:ae,class:"thread-composer-attach"},[v("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:He.value,onClick:Bt}," + ",8,xT),ve.value?(y(),k("div",RT,[v("button",{class:"thread-composer-attach-item",type:"button",disabled:He.value,onClick:zt}," Add photos & files ",8,PT),v("button",{class:"thread-composer-attach-item",type:"button",disabled:He.value,onClick:_t}," Add folder ",8,MT),v("button",{class:"thread-composer-attach-item",type:"button",disabled:He.value,onClick:dt}," Take photo ",8,$T)])):fe("",!0)],512),_e.value?fe("",!0):(y(),k(Ne,{key:0},[v("button",{class:tt(["thread-composer-plan-toggle",{"is-active":rt.value}]),type:"button","aria-label":rt.value?"Disable plan mode":"Enable plan mode","aria-pressed":rt.value,disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onClick:We},[...U[3]||(U[3]=[v("span",{class:"thread-composer-plan-toggle-label"},"Plan",-1),v("span",{class:"thread-composer-plan-toggle-switch","aria-hidden":"true"},[v("span",{class:"thread-composer-plan-toggle-switch-thumb"})],-1)])],10,OT),De(rl,{class:"thread-composer-control","model-value":e.selectedModel,options:Re.value,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":it},null,8,["model-value","options","disabled"]),De(q0,{class:"thread-composer-control",options:Ht.value,"selected-values":lt.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:nr},null,8,["options","selected-values","disabled"]),De(rl,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Ue,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":pt},null,8,["model-value","disabled"])],64)),v("div",{class:tt(["thread-composer-actions",{"thread-composer-actions--recording":_e.value}])},[be(u)==="recording"?(y(),k("div",NT,[v("canvas",{ref_key:"dictationWaveformCanvasRef",ref:I,class:"thread-composer-dictation-waveform"},null,512)])):fe("",!0),be(u)==="recording"?(y(),k("span",LT,G(Ce.value),1)):fe("",!0),be(g)&&!e.isTurnInProgress?(y(),k("button",{key:2,class:tt(["thread-composer-mic",{"thread-composer-mic--active":be(u)==="recording","thread-composer-mic--transcribing":be(u)==="transcribing"}]),type:"button","aria-label":he.value,title:he.value,disabled:He.value||be(u)==="transcribing",onClick:bt,onPointerdown:Pt,onPointerup:Ke,onPointercancel:Ke},[be(u)==="recording"?(y(),wt(Eu,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):be(u)==="transcribing"?(y(),k("span",jT)):(y(),wt(b0,{key:2,class:"thread-composer-mic-icon"}))],42,DT)):fe("",!0),e.isTurnInProgress?(y(),k("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:ze},[De(Eu,{class:"thread-composer-stop-icon"})],8,FT)):fe("",!0),v("button",{class:tt(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&V.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&V.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${V.value}`:"Send",disabled:!mt.value,onClick:U[1]||(U[1]=se=>xe(e.isTurnInProgress?V.value:"steer"))},[De(Hf,{class:"thread-composer-submit-icon"})],10,BT)],2)],2)],2),v("input",{ref_key:"photoLibraryInputRef",ref:q,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:He.value,onChange:Bn},null,40,UT),v("input",{ref_key:"cameraCaptureInputRef",ref:ee,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:He.value,onChange:dn},null,40,HT),v("input",{ref_key:"folderPickerInputRef",ref:te,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:He.value,onChange:Un},null,40,WT)],32))}}),Cu=yt(VT,[["__scopeId","data-v-dc703024"]]),zT={key:0,class:"queued-messages"},qT={class:"queued-messages-inner"},GT={class:"queued-row-text"},KT={class:"queued-row-actions"},JT=["onClick"],YT=["onClick"],QT=cn({__name:"QueuedMessages",props:{messages:{}},emits:["steer","delete"],setup(e){return(t,n)=>e.messages.length>0?(y(),k("div",zT,[v("div",qT,[(y(!0),k(Ne,null,vt(e.messages,r=>(y(),k("div",{key:r.id,class:"queued-row"},[n[1]||(n[1]=v("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[v("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)),v("span",GT,G(r.text),1),v("div",KT,[v("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:s=>t.$emit("steer",r.id)},"Steer",8,JT),v("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:s=>t.$emit("delete",r.id)},[...n[0]||(n[0]=[v("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[v("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,YT)])]))),128))])])):fe("",!0)}}),XT=yt(QT,[["__scopeId","data-v-ea583733"]]),ZT={class:"runtime-dropdown-trigger-label"},eS={key:0,class:"runtime-dropdown-menu-wrap"},tS={class:"runtime-dropdown-menu"},nS=["onClick"],rS={class:"runtime-dropdown-option-label"},sS={key:0,class:"runtime-dropdown-option-check"},oS=cn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(!1),i=[{value:"local",label:"Local project",icon:Bl},{value:"worktree",label:"New worktree",icon:pi}],a=de(()=>i.find(u=>u.value===n.modelValue)??i[0]);function l(u){r("update:modelValue",u),o.value=!1}function f(u){if(!o.value)return;const g=s.value;if(!g)return;const _=u.target;_ instanceof Node&&(g.contains(_)||(o.value=!1))}return Gr(()=>{window.addEventListener("pointerdown",f)}),Kr(()=>{window.removeEventListener("pointerdown",f)}),(u,g)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[v("button",{class:"runtime-dropdown-trigger",type:"button",onClick:g[0]||(g[0]=_=>o.value=!o.value)},[(y(),wt(Ti(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),v("span",ZT,G(a.value.label),1),De(Ji,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(y(),k("div",eS,[v("div",tS,[g[1]||(g[1]=v("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(y(),k(Ne,null,vt(i,_=>v("button",{key:_.value,class:tt(["runtime-dropdown-option",{"is-selected":e.modelValue===_.value}]),type:"button",onClick:I=>l(_.value)},[(y(),wt(Ti(_.icon),{class:"runtime-dropdown-option-icon"})),v("span",rS,G(_.label),1),e.modelValue===_.value?(y(),k("span",sS,"✓")):fe("",!0)],10,nS)),64))])])):fe("",!0)],512))}}),iS=yt(oS,[["__scopeId","data-v-9c9b71e5"]]),aS={},lS={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function cS(e,t){return y(),k("svg",lS,[...t[0]||(t[0]=[v("circle",{cx:"11",cy:"11",r:"8"},null,-1),v("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const sl=yt(aS,[["render",cS]]),uS={class:"skill-card-top"},dS=["src","alt"],fS={key:1,class:"skill-card-avatar-fallback"},hS={class:"skill-card-info"},pS={class:"skill-card-header"},mS={class:"skill-card-name"},gS={key:0,class:"skill-card-badge-disabled"},vS={key:1,class:"skill-card-badge"},yS={class:"skill-card-owner"},wS={key:0,class:"skill-card-desc"},bS={key:1,class:"skill-card-date"},_S=cn({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=de(()=>{const s=t.skill.publishedAt;if(!s)return"";const o=new Date(s),a=Date.now()-s;return a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:a<2592e6?`${Math.floor(a/864e5)}d ago`:o.toLocaleDateString("en-US",{month:"short",day:"numeric"})});function r(s){const o=s.target;o.style.display="none"}return(s,o)=>(y(),k("button",{class:tt(["skill-card",{"is-disabled":e.skill.installed&&e.skill.enabled===!1}]),type:"button",onClick:o[0]||(o[0]=i=>s.$emit("select",e.skill))},[v("div",uS,[e.skill.avatarUrl?(y(),k("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,dS)):(y(),k("div",fS,G(e.skill.owner.charAt(0)),1)),v("div",hS,[v("div",pS,[v("span",mS,G(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(y(),k("span",gS,"Disabled")):e.skill.installed?(y(),k("span",vS,"Installed")):fe("",!0)]),v("span",yS,G(e.skill.owner),1)])]),e.skill.description?(y(),k("p",wS,G(e.skill.description),1)):fe("",!0),n.value?(y(),k("span",bS,G(n.value),1)):fe("",!0)],2))}}),Au=yt(_S,[["__scopeId","data-v-2a1e8196"]]),kS={class:"sdm-panel"},TS={class:"sdm-header"},SS={class:"sdm-title-area"},IS=["src","alt"],ES={class:"sdm-title-col"},CS={class:"sdm-title-row"},AS={class:"sdm-title"},xS={key:0,class:"sdm-badge-disabled"},RS={class:"sdm-owner"},PS={class:"sdm-body"},MS={key:0,class:"sdm-desc"},$S={key:1,class:"sdm-readme-loading"},OS=["innerHTML"],NS=["href"],LS={class:"sdm-footer"},DS={class:"sdm-footer-actions"},jS=["disabled"],FS=["disabled"],BS=["disabled"],US=cn({__name:"SkillDetailModal",props:{skill:{},visible:{type:Boolean},isInstalling:{type:Boolean},isUninstalling:{type:Boolean}},emits:["close","install","uninstall","toggle-enabled"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(""),i=D(!1),a=de(()=>s.value??n.skill.enabled??!0),l=de(()=>n.isInstalling===!0||n.isUninstalling===!0),f=de(()=>{const $=o.value;if(!$)return"";const Q=$.replace(/^---[\s\S]*?---\s*/,"");return u(Q)});function u($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/^### (.+)$/gm,"<h4>$1</h4>").replace(/^## (.+)$/gm,"<h3>$1</h3>").replace(/^# (.+)$/gm,"<h2>$1</h2>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/`([^`]+)`/g,"<code>$1</code>").replace(/^- (.+)$/gm,"<li>$1</li>").replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>").replace(/\n{2,}/g,"<br/><br/>").replace(/\n/g,"<br/>")}async function g(){if(!(!n.skill.owner||!n.skill.name)){i.value=!0,o.value="";try{const $=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),Q=await fetch(`/codex-api/skills-hub/readme?${$}`);if(!Q.ok)return;const ae=await Q.json();o.value=ae.content??""}catch{}finally{i.value=!1}}}ht(()=>n.visible,$=>{$&&(s.value=null,o.value="",g())});function _(){r("install",n.skill)}function I(){r("uninstall",n.skill)}function F(){const $=!a.value;s.value=$,r("toggle-enabled",n.skill,$)}return($,Q)=>(y(),wt(To,{to:"body"},[e.visible?(y(),k("div",{key:0,class:"sdm-overlay",onClick:Q[1]||(Q[1]=kt(ae=>$.$emit("close"),["self"]))},[v("div",kS,[v("div",TS,[v("div",SS,[e.skill.avatarUrl?(y(),k("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,IS)):fe("",!0),v("div",ES,[v("div",CS,[v("h3",AS,G(e.skill.displayName||e.skill.name),1),e.skill.installed&&!a.value?(y(),k("span",xS,"Disabled")):fe("",!0)]),v("span",RS,G(e.skill.owner),1)])]),v("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:Q[0]||(Q[0]=ae=>$.$emit("close"))},[De(Ul,{class:"sdm-close-icon"})])]),v("div",PS,[e.skill.description?(y(),k("p",MS,G(e.skill.description),1)):fe("",!0),i.value?(y(),k("div",$S,"Loading skill contents...")):o.value?(y(),k("div",{key:2,class:"sdm-readme",innerHTML:f.value},null,8,OS)):fe("",!0),v("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,NS)]),v("div",LS,[v("div",DS,[e.skill.installed?(y(),k("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:l.value,onClick:I},G(n.isUninstalling?"Uninstalling...":"Uninstall"),9,jS)):(y(),k("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:l.value,onClick:_},G(n.isInstalling?"Installing...":"Install"),9,FS)),e.skill.installed?(y(),k("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:l.value,onClick:F},G(a.value?"Disable":"Enable"),9,BS)):fe("",!0)])])])])):fe("",!0)]))}}),HS=yt(US,[["__scopeId","data-v-19a385ca"]]),WS=()=>{};var xu={};/**
|
|
67
|
+
* @license
|
|
68
|
+
* Copyright 2017 Google LLC
|
|
69
|
+
*
|
|
70
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
71
|
+
* you may not use this file except in compliance with the License.
|
|
72
|
+
* You may obtain a copy of the License at
|
|
73
|
+
*
|
|
74
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
75
|
+
*
|
|
76
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
77
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
78
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
79
|
+
* See the License for the specific language governing permissions and
|
|
80
|
+
* limitations under the License.
|
|
81
|
+
*/const Yf=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=s&63|128):(s&64512)===55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=s&63|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=s&63|128)}return t},VS=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const o=e[n++];t[r++]=String.fromCharCode((s&31)<<6|o&63)}else if(s>239&&s<365){const o=e[n++],i=e[n++],a=e[n++],l=((s&7)<<18|(o&63)<<12|(i&63)<<6|a&63)-65536;t[r++]=String.fromCharCode(55296+(l>>10)),t[r++]=String.fromCharCode(56320+(l&1023))}else{const o=e[n++],i=e[n++];t[r++]=String.fromCharCode((s&15)<<12|(o&63)<<6|i&63)}}return t.join("")},Qf={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<e.length;s+=3){const o=e[s],i=s+1<e.length,a=i?e[s+1]:0,l=s+2<e.length,f=l?e[s+2]:0,u=o>>2,g=(o&3)<<4|a>>4;let _=(a&15)<<2|f>>6,I=f&63;l||(I=64,i||(_=64)),r.push(n[u],n[g],n[_],n[I])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Yf(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):VS(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<e.length;){const o=n[e.charAt(s++)],a=s<e.length?n[e.charAt(s)]:0;++s;const f=s<e.length?n[e.charAt(s)]:64;++s;const g=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||f==null||g==null)throw new zS;const _=o<<2|a>>4;if(r.push(_),f!==64){const I=a<<4&240|f>>2;if(r.push(I),g!==64){const F=f<<6&192|g;r.push(F)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class zS extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const qS=function(e){const t=Yf(e);return Qf.encodeByteArray(t,!0)},Xf=function(e){return qS(e).replace(/\./g,"")},Zf=function(e){try{return Qf.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
|
|
82
|
+
* @license
|
|
83
|
+
* Copyright 2022 Google LLC
|
|
84
|
+
*
|
|
85
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
86
|
+
* you may not use this file except in compliance with the License.
|
|
87
|
+
* You may obtain a copy of the License at
|
|
88
|
+
*
|
|
89
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
90
|
+
*
|
|
91
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
92
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
93
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
94
|
+
* See the License for the specific language governing permissions and
|
|
95
|
+
* limitations under the License.
|
|
96
|
+
*/function GS(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
|
|
97
|
+
* @license
|
|
98
|
+
* Copyright 2022 Google LLC
|
|
99
|
+
*
|
|
100
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
101
|
+
* you may not use this file except in compliance with the License.
|
|
102
|
+
* You may obtain a copy of the License at
|
|
103
|
+
*
|
|
104
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
105
|
+
*
|
|
106
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
107
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
108
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
109
|
+
* See the License for the specific language governing permissions and
|
|
110
|
+
* limitations under the License.
|
|
111
|
+
*/const KS=()=>GS().__FIREBASE_DEFAULTS__,JS=()=>{if(typeof process>"u"||typeof xu>"u")return;const e=xu.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},YS=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Zf(e[1]);return t&&JSON.parse(t)},Vl=()=>{try{return WS()||KS()||JS()||YS()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},QS=e=>{var t,n;return(n=(t=Vl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},eh=()=>{var e;return(e=Vl())==null?void 0:e.config},th=e=>{var t;return(t=Vl())==null?void 0:t[`_${e}`]};/**
|
|
112
|
+
* @license
|
|
113
|
+
* Copyright 2017 Google LLC
|
|
114
|
+
*
|
|
115
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
116
|
+
* you may not use this file except in compliance with the License.
|
|
117
|
+
* You may obtain a copy of the License at
|
|
118
|
+
*
|
|
119
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
120
|
+
*
|
|
121
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
122
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
123
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
124
|
+
* See the License for the specific language governing permissions and
|
|
125
|
+
* limitations under the License.
|
|
126
|
+
*/class XS{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n})}wrapCallback(t){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(n):t(n,r))}}}/**
|
|
127
|
+
* @license
|
|
128
|
+
* Copyright 2017 Google LLC
|
|
129
|
+
*
|
|
130
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
131
|
+
* you may not use this file except in compliance with the License.
|
|
132
|
+
* You may obtain a copy of the License at
|
|
133
|
+
*
|
|
134
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
135
|
+
*
|
|
136
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
137
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
138
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
139
|
+
* See the License for the specific language governing permissions and
|
|
140
|
+
* limitations under the License.
|
|
141
|
+
*/function Pn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function ZS(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Pn())}function eI(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function tI(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function nI(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function rI(){const e=Pn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function sI(){try{return typeof indexedDB=="object"}catch{return!1}}function oI(){return new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var o;t(((o=s.error)==null?void 0:o.message)||"")}}catch(n){t(n)}})}/**
|
|
142
|
+
* @license
|
|
143
|
+
* Copyright 2017 Google LLC
|
|
144
|
+
*
|
|
145
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
146
|
+
* you may not use this file except in compliance with the License.
|
|
147
|
+
* You may obtain a copy of the License at
|
|
148
|
+
*
|
|
149
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
150
|
+
*
|
|
151
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
152
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
153
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
154
|
+
* See the License for the specific language governing permissions and
|
|
155
|
+
* limitations under the License.
|
|
156
|
+
*/const iI="FirebaseError";class ps extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=iI,Object.setPrototypeOf(this,ps.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Go.prototype.create)}}class Go{constructor(t,n,r){this.service=t,this.serviceName=n,this.errors=r}create(t,...n){const r=n[0]||{},s=`${this.service}/${t}`,o=this.errors[t],i=o?aI(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new ps(s,a,r)}}function aI(e,t){return e.replace(lI,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const lI=/\{\$([^}]+)}/g;function cI(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function so(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const s of n){if(!r.includes(s))return!1;const o=e[s],i=t[s];if(Ru(o)&&Ru(i)){if(!so(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function Ru(e){return e!==null&&typeof e=="object"}/**
|
|
157
|
+
* @license
|
|
158
|
+
* Copyright 2017 Google LLC
|
|
159
|
+
*
|
|
160
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
161
|
+
* you may not use this file except in compliance with the License.
|
|
162
|
+
* You may obtain a copy of the License at
|
|
163
|
+
*
|
|
164
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
165
|
+
*
|
|
166
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
167
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
168
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
169
|
+
* See the License for the specific language governing permissions and
|
|
170
|
+
* limitations under the License.
|
|
171
|
+
*/function Ko(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(s=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function uI(e,t){const n=new dI(e,t);return n.subscribe.bind(n)}class dI{constructor(t,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{t(this)}).catch(r=>{this.error(r)})}next(t){this.forEachObserver(n=>{n.next(t)})}error(t){this.forEachObserver(n=>{n.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,n,r){let s;if(t===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");fI(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=Ta),s.error===void 0&&(s.error=Ta),s.complete===void 0&&(s.complete=Ta);const o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),o}unsubscribeOne(t){this.observers===void 0||this.observers[t]===void 0||(delete this.observers[t],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,t)}sendOne(t,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[t]!==void 0)try{n(this.observers[t])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(t){this.finalized||(this.finalized=!0,t!==void 0&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function fI(e,t){if(typeof e!="object"||e===null)return!1;for(const n of t)if(n in e&&typeof e[n]=="function")return!0;return!1}function Ta(){}/**
|
|
172
|
+
* @license
|
|
173
|
+
* Copyright 2021 Google LLC
|
|
174
|
+
*
|
|
175
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
176
|
+
* you may not use this file except in compliance with the License.
|
|
177
|
+
* You may obtain a copy of the License at
|
|
178
|
+
*
|
|
179
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
180
|
+
*
|
|
181
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
182
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
183
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
184
|
+
* See the License for the specific language governing permissions and
|
|
185
|
+
* limitations under the License.
|
|
186
|
+
*/function ao(e){return e&&e._delegate?e._delegate:e}/**
|
|
187
|
+
* @license
|
|
188
|
+
* Copyright 2025 Google LLC
|
|
189
|
+
*
|
|
190
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
191
|
+
* you may not use this file except in compliance with the License.
|
|
192
|
+
* You may obtain a copy of the License at
|
|
193
|
+
*
|
|
194
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
195
|
+
*
|
|
196
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
197
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
198
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
|
+
* See the License for the specific language governing permissions and
|
|
200
|
+
* limitations under the License.
|
|
201
|
+
*/function zl(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function hI(e){return(await fetch(e,{credentials:"include"})).ok}class oo{constructor(t,n,r){this.name=t,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}/**
|
|
202
|
+
* @license
|
|
203
|
+
* Copyright 2019 Google LLC
|
|
204
|
+
*
|
|
205
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
206
|
+
* you may not use this file except in compliance with the License.
|
|
207
|
+
* You may obtain a copy of the License at
|
|
208
|
+
*
|
|
209
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
210
|
+
*
|
|
211
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
212
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
213
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
214
|
+
* See the License for the specific language governing permissions and
|
|
215
|
+
* limitations under the License.
|
|
216
|
+
*/const Cs="[DEFAULT]";/**
|
|
217
|
+
* @license
|
|
218
|
+
* Copyright 2019 Google LLC
|
|
219
|
+
*
|
|
220
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
221
|
+
* you may not use this file except in compliance with the License.
|
|
222
|
+
* You may obtain a copy of the License at
|
|
223
|
+
*
|
|
224
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
225
|
+
*
|
|
226
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
227
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
228
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
229
|
+
* See the License for the specific language governing permissions and
|
|
230
|
+
* limitations under the License.
|
|
231
|
+
*/class pI{constructor(t,n){this.name=t,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const n=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(n)){const r=new XS;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(t){const n=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),r=(t==null?void 0:t.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(gI(t))try{this.getOrInitializeService({instanceIdentifier:Cs})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const o=this.getOrInitializeService({instanceIdentifier:s});r.resolve(o)}catch{}}}}clearInstance(t=Cs){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...t.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=Cs){return this.instances.has(t)}getOptions(t=Cs){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:n={}}=t,r=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[o,i]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(o);r===a&&i.resolve(s)}return s}onInit(t,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(t),this.onInitCallbacks.set(r,s);const o=this.instances.get(r);return o&&t(o,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(t,n)}catch{}}getOrInitializeService({instanceIdentifier:t,options:n={}}){let r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:mI(t),options:n}),this.instances.set(t,r),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(r,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,r)}catch{}return r||null}normalizeInstanceIdentifier(t=Cs){return this.component?this.component.multipleInstances?t:Cs:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function mI(e){return e===Cs?void 0:e}function gI(e){return e.instantiationMode==="EAGER"}/**
|
|
232
|
+
* @license
|
|
233
|
+
* Copyright 2019 Google LLC
|
|
234
|
+
*
|
|
235
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
236
|
+
* you may not use this file except in compliance with the License.
|
|
237
|
+
* You may obtain a copy of the License at
|
|
238
|
+
*
|
|
239
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
240
|
+
*
|
|
241
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
242
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
243
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
244
|
+
* See the License for the specific language governing permissions and
|
|
245
|
+
* limitations under the License.
|
|
246
|
+
*/class vI{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const n=this.getProvider(t.name);if(n.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);n.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const n=new pI(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
|
|
247
|
+
* @license
|
|
248
|
+
* Copyright 2017 Google LLC
|
|
249
|
+
*
|
|
250
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
251
|
+
* you may not use this file except in compliance with the License.
|
|
252
|
+
* You may obtain a copy of the License at
|
|
253
|
+
*
|
|
254
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
255
|
+
*
|
|
256
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
257
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
258
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
259
|
+
* See the License for the specific language governing permissions and
|
|
260
|
+
* limitations under the License.
|
|
261
|
+
*/var Nt;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(Nt||(Nt={}));const yI={debug:Nt.DEBUG,verbose:Nt.VERBOSE,info:Nt.INFO,warn:Nt.WARN,error:Nt.ERROR,silent:Nt.SILENT},wI=Nt.INFO,bI={[Nt.DEBUG]:"log",[Nt.VERBOSE]:"log",[Nt.INFO]:"info",[Nt.WARN]:"warn",[Nt.ERROR]:"error"},_I=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=bI[t];if(s)console[s](`[${r}] ${e.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class nh{constructor(t){this.name=t,this._logLevel=wI,this._logHandler=_I,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Nt))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?yI[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if(typeof t!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,Nt.DEBUG,...t),this._logHandler(this,Nt.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Nt.VERBOSE,...t),this._logHandler(this,Nt.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Nt.INFO,...t),this._logHandler(this,Nt.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Nt.WARN,...t),this._logHandler(this,Nt.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Nt.ERROR,...t),this._logHandler(this,Nt.ERROR,...t)}}const kI=(e,t)=>t.some(n=>e instanceof n);let Pu,Mu;function TI(){return Pu||(Pu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function SI(){return Mu||(Mu=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const rh=new WeakMap,ol=new WeakMap,sh=new WeakMap,Sa=new WeakMap,ql=new WeakMap;function II(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(us(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&rh.set(n,e)}).catch(()=>{}),ql.set(t,e),t}function EI(e){if(ol.has(e))return;const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",i),e.removeEventListener("abort",i)},o=()=>{n(),s()},i=()=>{r(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",o),e.addEventListener("error",i),e.addEventListener("abort",i)});ol.set(e,t)}let il={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return ol.get(e);if(t==="objectStoreNames")return e.objectStoreNames||sh.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return us(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function CI(e){il=e(il)}function AI(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Ia(this),t,...n);return sh.set(r,t.sort?t.sort():[t]),us(r)}:SI().includes(e)?function(...t){return e.apply(Ia(this),t),us(rh.get(this))}:function(...t){return us(e.apply(Ia(this),t))}}function xI(e){return typeof e=="function"?AI(e):(e instanceof IDBTransaction&&EI(e),kI(e,TI())?new Proxy(e,il):e)}function us(e){if(e instanceof IDBRequest)return II(e);if(Sa.has(e))return Sa.get(e);const t=xI(e);return t!==e&&(Sa.set(e,t),ql.set(t,e)),t}const Ia=e=>ql.get(e);function RI(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=us(i);return r&&i.addEventListener("upgradeneeded",l=>{r(us(i.result),l.oldVersion,l.newVersion,us(i.transaction),l)}),n&&i.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{o&&l.addEventListener("close",()=>o()),s&&l.addEventListener("versionchange",f=>s(f.oldVersion,f.newVersion,f))}).catch(()=>{}),a}const PI=["get","getKey","getAll","getAllKeys","count"],MI=["put","add","delete","clear"],Ea=new Map;function $u(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Ea.get(t))return Ea.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=MI.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||PI.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let f=l.store;return r&&(f=f.index(a.shift())),(await Promise.all([f[n](...a),s&&l.done]))[0]};return Ea.set(t,o),o}CI(e=>({...e,get:(t,n,r)=>$u(t,n)||e.get(t,n,r),has:(t,n)=>!!$u(t,n)||e.has(t,n)}));/**
|
|
262
|
+
* @license
|
|
263
|
+
* Copyright 2019 Google LLC
|
|
264
|
+
*
|
|
265
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
266
|
+
* you may not use this file except in compliance with the License.
|
|
267
|
+
* You may obtain a copy of the License at
|
|
268
|
+
*
|
|
269
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
270
|
+
*
|
|
271
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
272
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
273
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
274
|
+
* See the License for the specific language governing permissions and
|
|
275
|
+
* limitations under the License.
|
|
276
|
+
*/class $I{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(OI(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function OI(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const al="@firebase/app",Ou="0.14.10";/**
|
|
277
|
+
* @license
|
|
278
|
+
* Copyright 2019 Google LLC
|
|
279
|
+
*
|
|
280
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
281
|
+
* you may not use this file except in compliance with the License.
|
|
282
|
+
* You may obtain a copy of the License at
|
|
283
|
+
*
|
|
284
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
285
|
+
*
|
|
286
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
287
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
288
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
289
|
+
* See the License for the specific language governing permissions and
|
|
290
|
+
* limitations under the License.
|
|
291
|
+
*/const Vr=new nh("@firebase/app"),NI="@firebase/app-compat",LI="@firebase/analytics-compat",DI="@firebase/analytics",jI="@firebase/app-check-compat",FI="@firebase/app-check",BI="@firebase/auth",UI="@firebase/auth-compat",HI="@firebase/database",WI="@firebase/data-connect",VI="@firebase/database-compat",zI="@firebase/functions",qI="@firebase/functions-compat",GI="@firebase/installations",KI="@firebase/installations-compat",JI="@firebase/messaging",YI="@firebase/messaging-compat",QI="@firebase/performance",XI="@firebase/performance-compat",ZI="@firebase/remote-config",eE="@firebase/remote-config-compat",tE="@firebase/storage",nE="@firebase/storage-compat",rE="@firebase/firestore",sE="@firebase/ai",oE="@firebase/firestore-compat",iE="firebase",aE="12.11.0";/**
|
|
292
|
+
* @license
|
|
293
|
+
* Copyright 2019 Google LLC
|
|
294
|
+
*
|
|
295
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
296
|
+
* you may not use this file except in compliance with the License.
|
|
297
|
+
* You may obtain a copy of the License at
|
|
298
|
+
*
|
|
299
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
300
|
+
*
|
|
301
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
302
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
303
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
304
|
+
* See the License for the specific language governing permissions and
|
|
305
|
+
* limitations under the License.
|
|
306
|
+
*/const ll="[DEFAULT]",lE={[al]:"fire-core",[NI]:"fire-core-compat",[DI]:"fire-analytics",[LI]:"fire-analytics-compat",[FI]:"fire-app-check",[jI]:"fire-app-check-compat",[BI]:"fire-auth",[UI]:"fire-auth-compat",[HI]:"fire-rtdb",[WI]:"fire-data-connect",[VI]:"fire-rtdb-compat",[zI]:"fire-fn",[qI]:"fire-fn-compat",[GI]:"fire-iid",[KI]:"fire-iid-compat",[JI]:"fire-fcm",[YI]:"fire-fcm-compat",[QI]:"fire-perf",[XI]:"fire-perf-compat",[ZI]:"fire-rc",[eE]:"fire-rc-compat",[tE]:"fire-gcs",[nE]:"fire-gcs-compat",[rE]:"fire-fst",[oE]:"fire-fst-compat",[sE]:"fire-vertex","fire-js":"fire-js",[iE]:"fire-js-all"};/**
|
|
307
|
+
* @license
|
|
308
|
+
* Copyright 2019 Google LLC
|
|
309
|
+
*
|
|
310
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
311
|
+
* you may not use this file except in compliance with the License.
|
|
312
|
+
* You may obtain a copy of the License at
|
|
313
|
+
*
|
|
314
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
315
|
+
*
|
|
316
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
317
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
318
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
319
|
+
* See the License for the specific language governing permissions and
|
|
320
|
+
* limitations under the License.
|
|
321
|
+
*/const Bo=new Map,cE=new Map,cl=new Map;function Nu(e,t){try{e.container.addComponent(t)}catch(n){Vr.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Uo(e){const t=e.name;if(cl.has(t))return Vr.debug(`There were multiple attempts to register component ${t}.`),!1;cl.set(t,e);for(const n of Bo.values())Nu(n,e);for(const n of cE.values())Nu(n,e);return!0}function oh(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function _r(e){return e==null?!1:e.settings!==void 0}/**
|
|
322
|
+
* @license
|
|
323
|
+
* Copyright 2019 Google LLC
|
|
324
|
+
*
|
|
325
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
326
|
+
* you may not use this file except in compliance with the License.
|
|
327
|
+
* You may obtain a copy of the License at
|
|
328
|
+
*
|
|
329
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
330
|
+
*
|
|
331
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
332
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
333
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
334
|
+
* See the License for the specific language governing permissions and
|
|
335
|
+
* limitations under the License.
|
|
336
|
+
*/const uE={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},ds=new Go("app","Firebase",uE);/**
|
|
337
|
+
* @license
|
|
338
|
+
* Copyright 2019 Google LLC
|
|
339
|
+
*
|
|
340
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
341
|
+
* you may not use this file except in compliance with the License.
|
|
342
|
+
* You may obtain a copy of the License at
|
|
343
|
+
*
|
|
344
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
345
|
+
*
|
|
346
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
347
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
348
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
349
|
+
* See the License for the specific language governing permissions and
|
|
350
|
+
* limitations under the License.
|
|
351
|
+
*/class dE{constructor(t,n,r){this._isDeleted=!1,this._options={...t},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new oo("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw ds.create("app-deleted",{appName:this._name})}}/**
|
|
352
|
+
* @license
|
|
353
|
+
* Copyright 2019 Google LLC
|
|
354
|
+
*
|
|
355
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
356
|
+
* you may not use this file except in compliance with the License.
|
|
357
|
+
* You may obtain a copy of the License at
|
|
358
|
+
*
|
|
359
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
360
|
+
*
|
|
361
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
362
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
363
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
364
|
+
* See the License for the specific language governing permissions and
|
|
365
|
+
* limitations under the License.
|
|
366
|
+
*/const Jo=aE;function ih(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:ll,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw ds.create("bad-app-name",{appName:String(s)});if(n||(n=eh()),!n)throw ds.create("no-options");const o=Bo.get(s);if(o){if(so(n,o.options)&&so(r,o.config))return o;throw ds.create("duplicate-app",{appName:s})}const i=new vI(s);for(const l of cl.values())i.addComponent(l);const a=new dE(n,r,i);return Bo.set(s,a),a}function ah(e=ll){const t=Bo.get(e);if(!t&&e===ll&&eh())return ih();if(!t)throw ds.create("no-app",{appName:e});return t}function fE(){return Array.from(Bo.values())}function Qs(e,t,n){let r=lE[e]??e;n&&(r+=`-${n}`);const s=r.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const i=[`Unable to register library "${r}" with version "${t}":`];s&&i.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&i.push("and"),o&&i.push(`version name "${t}" contains illegal characters (whitespace or "/")`),Vr.warn(i.join(" "));return}Uo(new oo(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
|
|
367
|
+
* @license
|
|
368
|
+
* Copyright 2021 Google LLC
|
|
369
|
+
*
|
|
370
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
371
|
+
* you may not use this file except in compliance with the License.
|
|
372
|
+
* You may obtain a copy of the License at
|
|
373
|
+
*
|
|
374
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
375
|
+
*
|
|
376
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
377
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
378
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
379
|
+
* See the License for the specific language governing permissions and
|
|
380
|
+
* limitations under the License.
|
|
381
|
+
*/const hE="firebase-heartbeat-database",pE=1,Ho="firebase-heartbeat-store";let Ca=null;function lh(){return Ca||(Ca=RI(hE,pE,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(Ho)}catch(n){console.warn(n)}}}}).catch(e=>{throw ds.create("idb-open",{originalErrorMessage:e.message})})),Ca}async function mE(e){try{const n=(await lh()).transaction(Ho),r=await n.objectStore(Ho).get(ch(e));return await n.done,r}catch(t){if(t instanceof ps)Vr.warn(t.message);else{const n=ds.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});Vr.warn(n.message)}}}async function Lu(e,t){try{const r=(await lh()).transaction(Ho,"readwrite");await r.objectStore(Ho).put(t,ch(e)),await r.done}catch(n){if(n instanceof ps)Vr.warn(n.message);else{const r=ds.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Vr.warn(r.message)}}}function ch(e){return`${e.name}!${e.options.appId}`}/**
|
|
382
|
+
* @license
|
|
383
|
+
* Copyright 2021 Google LLC
|
|
384
|
+
*
|
|
385
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
386
|
+
* you may not use this file except in compliance with the License.
|
|
387
|
+
* You may obtain a copy of the License at
|
|
388
|
+
*
|
|
389
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
390
|
+
*
|
|
391
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
392
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
393
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
394
|
+
* See the License for the specific language governing permissions and
|
|
395
|
+
* limitations under the License.
|
|
396
|
+
*/const gE=1024,vE=30;class yE{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new bE(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var t,n;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=Du();if(((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===o||this._heartbeatsCache.heartbeats.some(i=>i.date===o))return;if(this._heartbeatsCache.heartbeats.push({date:o,agent:s}),this._heartbeatsCache.heartbeats.length>vE){const i=_E(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Vr.warn(r)}}async getHeartbeatsHeader(){var t;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=Du(),{heartbeatsToSend:r,unsentEntries:s}=wE(this._heartbeatsCache.heartbeats),o=Xf(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(n){return Vr.warn(n),""}}}function Du(){return new Date().toISOString().substring(0,10)}function wE(e,t=gE){const n=[];let r=e.slice();for(const s of e){const o=n.find(i=>i.agent===s.agent);if(o){if(o.dates.push(s.date),ju(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),ju(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class bE{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return sI()?oI().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await mE(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const r=await this.read();return Lu(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){if(await this._canUseIndexedDBPromise){const r=await this.read();return Lu(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function ju(e){return Xf(JSON.stringify({version:2,heartbeats:e})).length}function _E(e){if(e.length===0)return-1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}/**
|
|
397
|
+
* @license
|
|
398
|
+
* Copyright 2019 Google LLC
|
|
399
|
+
*
|
|
400
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
401
|
+
* you may not use this file except in compliance with the License.
|
|
402
|
+
* You may obtain a copy of the License at
|
|
403
|
+
*
|
|
404
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
405
|
+
*
|
|
406
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
407
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
408
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
409
|
+
* See the License for the specific language governing permissions and
|
|
410
|
+
* limitations under the License.
|
|
411
|
+
*/function kE(e){Uo(new oo("platform-logger",t=>new $I(t),"PRIVATE")),Uo(new oo("heartbeat",t=>new yE(t),"PRIVATE")),Qs(al,Ou,e),Qs(al,Ou,"esm2020"),Qs("fire-js","")}kE("");var TE="firebase",SE="12.11.0";/**
|
|
412
|
+
* @license
|
|
413
|
+
* Copyright 2020 Google LLC
|
|
414
|
+
*
|
|
415
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
416
|
+
* you may not use this file except in compliance with the License.
|
|
417
|
+
* You may obtain a copy of the License at
|
|
418
|
+
*
|
|
419
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
420
|
+
*
|
|
421
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
422
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
423
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
424
|
+
* See the License for the specific language governing permissions and
|
|
425
|
+
* limitations under the License.
|
|
426
|
+
*/Qs(TE,SE,"app");function uh(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const IE=uh,dh=new Go("auth","Firebase",uh());/**
|
|
427
|
+
* @license
|
|
428
|
+
* Copyright 2020 Google LLC
|
|
429
|
+
*
|
|
430
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
431
|
+
* you may not use this file except in compliance with the License.
|
|
432
|
+
* You may obtain a copy of the License at
|
|
433
|
+
*
|
|
434
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
435
|
+
*
|
|
436
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
437
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
438
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
439
|
+
* See the License for the specific language governing permissions and
|
|
440
|
+
* limitations under the License.
|
|
441
|
+
*/const Ai=new nh("@firebase/auth");function EE(e,...t){Ai.logLevel<=Nt.WARN&&Ai.warn(`Auth (${Jo}): ${e}`,...t)}function mi(e,...t){Ai.logLevel<=Nt.ERROR&&Ai.error(`Auth (${Jo}): ${e}`,...t)}/**
|
|
442
|
+
* @license
|
|
443
|
+
* Copyright 2020 Google LLC
|
|
444
|
+
*
|
|
445
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
446
|
+
* you may not use this file except in compliance with the License.
|
|
447
|
+
* You may obtain a copy of the License at
|
|
448
|
+
*
|
|
449
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
450
|
+
*
|
|
451
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
452
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
453
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
454
|
+
* See the License for the specific language governing permissions and
|
|
455
|
+
* limitations under the License.
|
|
456
|
+
*/function Er(e,...t){throw Kl(e,...t)}function ar(e,...t){return Kl(e,...t)}function Gl(e,t,n){const r={...IE(),[t]:n};return new Go("auth","Firebase",r).create(t,{appName:e.name})}function Os(e){return Gl(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function CE(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&Er(e,"argument-error"),Gl(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Kl(e,...t){if(typeof e!="string"){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return dh.create(e,...t)}function et(e,t,...n){if(!e)throw Kl(t,...n)}function Lr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw mi(t),new Error(t)}function zr(e,t){e||Lr(t)}/**
|
|
457
|
+
* @license
|
|
458
|
+
* Copyright 2020 Google LLC
|
|
459
|
+
*
|
|
460
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
461
|
+
* you may not use this file except in compliance with the License.
|
|
462
|
+
* You may obtain a copy of the License at
|
|
463
|
+
*
|
|
464
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
465
|
+
*
|
|
466
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
467
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
468
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
469
|
+
* See the License for the specific language governing permissions and
|
|
470
|
+
* limitations under the License.
|
|
471
|
+
*/function ul(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function AE(){return Fu()==="http:"||Fu()==="https:"}function Fu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
|
|
472
|
+
* @license
|
|
473
|
+
* Copyright 2020 Google LLC
|
|
474
|
+
*
|
|
475
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
476
|
+
* you may not use this file except in compliance with the License.
|
|
477
|
+
* You may obtain a copy of the License at
|
|
478
|
+
*
|
|
479
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
480
|
+
*
|
|
481
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
482
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
483
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
484
|
+
* See the License for the specific language governing permissions and
|
|
485
|
+
* limitations under the License.
|
|
486
|
+
*/function xE(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(AE()||tI()||"connection"in navigator)?navigator.onLine:!0}function RE(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
|
|
487
|
+
* @license
|
|
488
|
+
* Copyright 2020 Google LLC
|
|
489
|
+
*
|
|
490
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
491
|
+
* you may not use this file except in compliance with the License.
|
|
492
|
+
* You may obtain a copy of the License at
|
|
493
|
+
*
|
|
494
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
495
|
+
*
|
|
496
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
497
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
498
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
499
|
+
* See the License for the specific language governing permissions and
|
|
500
|
+
* limitations under the License.
|
|
501
|
+
*/class Yo{constructor(t,n){this.shortDelay=t,this.longDelay=n,zr(n>t,"Short delay should be less than long delay!"),this.isMobile=ZS()||nI()}get(){return xE()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
502
|
+
* @license
|
|
503
|
+
* Copyright 2020 Google LLC
|
|
504
|
+
*
|
|
505
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
506
|
+
* you may not use this file except in compliance with the License.
|
|
507
|
+
* You may obtain a copy of the License at
|
|
508
|
+
*
|
|
509
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
510
|
+
*
|
|
511
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
512
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
513
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
514
|
+
* See the License for the specific language governing permissions and
|
|
515
|
+
* limitations under the License.
|
|
516
|
+
*/function Jl(e,t){zr(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
|
|
517
|
+
* @license
|
|
518
|
+
* Copyright 2020 Google LLC
|
|
519
|
+
*
|
|
520
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
521
|
+
* you may not use this file except in compliance with the License.
|
|
522
|
+
* You may obtain a copy of the License at
|
|
523
|
+
*
|
|
524
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
525
|
+
*
|
|
526
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
527
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
528
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
529
|
+
* See the License for the specific language governing permissions and
|
|
530
|
+
* limitations under the License.
|
|
531
|
+
*/class fh{static initialize(t,n,r){this.fetchImpl=t,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Lr("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Lr("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Lr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
532
|
+
* @license
|
|
533
|
+
* Copyright 2020 Google LLC
|
|
534
|
+
*
|
|
535
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
536
|
+
* you may not use this file except in compliance with the License.
|
|
537
|
+
* You may obtain a copy of the License at
|
|
538
|
+
*
|
|
539
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
540
|
+
*
|
|
541
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
542
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
543
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
544
|
+
* See the License for the specific language governing permissions and
|
|
545
|
+
* limitations under the License.
|
|
546
|
+
*/const PE={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
|
|
547
|
+
* @license
|
|
548
|
+
* Copyright 2020 Google LLC
|
|
549
|
+
*
|
|
550
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
551
|
+
* you may not use this file except in compliance with the License.
|
|
552
|
+
* You may obtain a copy of the License at
|
|
553
|
+
*
|
|
554
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
555
|
+
*
|
|
556
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
557
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
558
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
559
|
+
* See the License for the specific language governing permissions and
|
|
560
|
+
* limitations under the License.
|
|
561
|
+
*/const ME=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],$E=new Yo(3e4,6e4);function Yl(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function lo(e,t,n,r,s={}){return hh(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=Ko({key:e.config.apiKey,...i}).slice(1),l=await e._getAdditionalHeaders();l["Content-Type"]="application/json",e.languageCode&&(l["X-Firebase-Locale"]=e.languageCode);const f={method:t,headers:l,...o};return eI()||(f.referrerPolicy="no-referrer"),e.emulatorConfig&&zl(e.emulatorConfig.host)&&(f.credentials="include"),fh.fetch()(await ph(e,e.config.apiHost,n,a),f)})}async function hh(e,t,n){e._canInitEmulator=!1;const r={...PE,...t};try{const s=new NE(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw si(e,"account-exists-with-different-credential",i);if(o.ok&&!("errorMessage"in i))return i;{const a=o.ok?i.errorMessage:i.error.message,[l,f]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw si(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw si(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw si(e,"user-disabled",i);const u=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(f)throw Gl(e,u,f);Er(e,u)}}catch(s){if(s instanceof ps)throw s;Er(e,"network-request-failed",{message:String(s)})}}async function OE(e,t,n,r,s={}){const o=await lo(e,t,n,r,s);return"mfaPendingCredential"in o&&Er(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function ph(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?Jl(e.config,s):`${e.config.apiScheme}://${s}`;return ME.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class NE{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(ar(this.auth,"network-request-failed")),$E.get())})}}function si(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=ar(e,t,r);return s.customData._tokenResponse=n,s}/**
|
|
562
|
+
* @license
|
|
563
|
+
* Copyright 2020 Google LLC
|
|
564
|
+
*
|
|
565
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
566
|
+
* you may not use this file except in compliance with the License.
|
|
567
|
+
* You may obtain a copy of the License at
|
|
568
|
+
*
|
|
569
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
570
|
+
*
|
|
571
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
572
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
573
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
574
|
+
* See the License for the specific language governing permissions and
|
|
575
|
+
* limitations under the License.
|
|
576
|
+
*/async function LE(e,t){return lo(e,"POST","/v1/accounts:delete",t)}async function xi(e,t){return lo(e,"POST","/v1/accounts:lookup",t)}/**
|
|
577
|
+
* @license
|
|
578
|
+
* Copyright 2020 Google LLC
|
|
579
|
+
*
|
|
580
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
581
|
+
* you may not use this file except in compliance with the License.
|
|
582
|
+
* You may obtain a copy of the License at
|
|
583
|
+
*
|
|
584
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
585
|
+
*
|
|
586
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
587
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
588
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
589
|
+
* See the License for the specific language governing permissions and
|
|
590
|
+
* limitations under the License.
|
|
591
|
+
*/function Ao(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function DE(e,t=!1){const n=ao(e),r=await n.getIdToken(t),s=Ql(r);et(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const o=typeof s.firebase=="object"?s.firebase:void 0,i=o==null?void 0:o.sign_in_provider;return{claims:s,token:r,authTime:Ao(Aa(s.auth_time)),issuedAtTime:Ao(Aa(s.iat)),expirationTime:Ao(Aa(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function Aa(e){return Number(e)*1e3}function Ql(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return mi("JWT malformed, contained fewer than 3 sections"),null;try{const s=Zf(n);return s?JSON.parse(s):(mi("Failed to decode base64 JWT payload"),null)}catch(s){return mi("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Bu(e){const t=Ql(e);return et(t,"internal-error"),et(typeof t.exp<"u","internal-error"),et(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
|
|
592
|
+
* @license
|
|
593
|
+
* Copyright 2020 Google LLC
|
|
594
|
+
*
|
|
595
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
596
|
+
* you may not use this file except in compliance with the License.
|
|
597
|
+
* You may obtain a copy of the License at
|
|
598
|
+
*
|
|
599
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
600
|
+
*
|
|
601
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
602
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
603
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
604
|
+
* See the License for the specific language governing permissions and
|
|
605
|
+
* limitations under the License.
|
|
606
|
+
*/async function Wo(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof ps&&jE(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function jE({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
|
|
607
|
+
* @license
|
|
608
|
+
* Copyright 2020 Google LLC
|
|
609
|
+
*
|
|
610
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
611
|
+
* you may not use this file except in compliance with the License.
|
|
612
|
+
* You may obtain a copy of the License at
|
|
613
|
+
*
|
|
614
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
615
|
+
*
|
|
616
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
617
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
618
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
619
|
+
* See the License for the specific language governing permissions and
|
|
620
|
+
* limitations under the License.
|
|
621
|
+
*/class FE{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(t){if(t){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(t=!1){if(!this.isRunning)return;const n=this.getInterval(t);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){(t==null?void 0:t.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
|
|
622
|
+
* @license
|
|
623
|
+
* Copyright 2020 Google LLC
|
|
624
|
+
*
|
|
625
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
626
|
+
* you may not use this file except in compliance with the License.
|
|
627
|
+
* You may obtain a copy of the License at
|
|
628
|
+
*
|
|
629
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
630
|
+
*
|
|
631
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
632
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
633
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
634
|
+
* See the License for the specific language governing permissions and
|
|
635
|
+
* limitations under the License.
|
|
636
|
+
*/class dl{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ao(this.lastLoginAt),this.creationTime=Ao(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
637
|
+
* @license
|
|
638
|
+
* Copyright 2019 Google LLC
|
|
639
|
+
*
|
|
640
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
641
|
+
* you may not use this file except in compliance with the License.
|
|
642
|
+
* You may obtain a copy of the License at
|
|
643
|
+
*
|
|
644
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
645
|
+
*
|
|
646
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
647
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
648
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
649
|
+
* See the License for the specific language governing permissions and
|
|
650
|
+
* limitations under the License.
|
|
651
|
+
*/async function Ri(e){var g;const t=e.auth,n=await e.getIdToken(),r=await Wo(e,xi(t,{idToken:n}));et(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(g=s.providerUserInfo)!=null&&g.length?mh(s.providerUserInfo):[],i=UE(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),f=a?l:!1,u={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new dl(s.createdAt,s.lastLoginAt),isAnonymous:f};Object.assign(e,u)}async function BE(e){const t=ao(e);await Ri(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function UE(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function mh(e){return e.map(({providerId:t,...n})=>({providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/**
|
|
652
|
+
* @license
|
|
653
|
+
* Copyright 2020 Google LLC
|
|
654
|
+
*
|
|
655
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
656
|
+
* you may not use this file except in compliance with the License.
|
|
657
|
+
* You may obtain a copy of the License at
|
|
658
|
+
*
|
|
659
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
660
|
+
*
|
|
661
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
662
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
663
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
664
|
+
* See the License for the specific language governing permissions and
|
|
665
|
+
* limitations under the License.
|
|
666
|
+
*/async function HE(e,t){const n=await hh(e,{},async()=>{const r=Ko({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await ph(e,s,"/v1/token",`key=${o}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const l={method:"POST",headers:a,body:r};return e.emulatorConfig&&zl(e.emulatorConfig.host)&&(l.credentials="include"),fh.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function WE(e,t){return lo(e,"POST","/v2/accounts:revokeToken",Yl(e,t))}/**
|
|
667
|
+
* @license
|
|
668
|
+
* Copyright 2020 Google LLC
|
|
669
|
+
*
|
|
670
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
671
|
+
* you may not use this file except in compliance with the License.
|
|
672
|
+
* You may obtain a copy of the License at
|
|
673
|
+
*
|
|
674
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
675
|
+
*
|
|
676
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
677
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
678
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
679
|
+
* See the License for the specific language governing permissions and
|
|
680
|
+
* limitations under the License.
|
|
681
|
+
*/class Xs{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){et(t.idToken,"internal-error"),et(typeof t.idToken<"u","internal-error"),et(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):Bu(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){et(t.length!==0,"internal-error");const n=Bu(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(et(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(t,n){const{accessToken:r,refreshToken:s,expiresIn:o}=await HE(t,n);this.updateTokensAndExpiration(r,s,Number(o))}updateTokensAndExpiration(t,n,r){this.refreshToken=n||null,this.accessToken=t||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(t,n){const{refreshToken:r,accessToken:s,expirationTime:o}=n,i=new Xs;return r&&(et(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(et(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(et(typeof o=="number","internal-error",{appName:t}),i.expirationTime=o),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new Xs,this.toJSON())}_performRefresh(){return Lr("not implemented")}}/**
|
|
682
|
+
* @license
|
|
683
|
+
* Copyright 2020 Google LLC
|
|
684
|
+
*
|
|
685
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
686
|
+
* you may not use this file except in compliance with the License.
|
|
687
|
+
* You may obtain a copy of the License at
|
|
688
|
+
*
|
|
689
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
690
|
+
*
|
|
691
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
692
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
693
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
694
|
+
* See the License for the specific language governing permissions and
|
|
695
|
+
* limitations under the License.
|
|
696
|
+
*/function ts(e,t){et(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class sr{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new FE(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new dl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await Wo(this,this.stsTokenManager.getToken(this.auth,t));return et(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return DE(this,t)}reload(){return BE(this)}_assign(t){this!==t&&(et(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map(n=>({...n})),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const n=new sr({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){et(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,n=!1){let r=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),r=!0),n&&await Ri(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(_r(this.auth.app))return Promise.reject(Os(this.auth));const t=await this.getIdToken();return await Wo(this,LE(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(t=>({...t})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,n){const r=n.displayName??void 0,s=n.email??void 0,o=n.phoneNumber??void 0,i=n.photoURL??void 0,a=n.tenantId??void 0,l=n._redirectEventId??void 0,f=n.createdAt??void 0,u=n.lastLoginAt??void 0,{uid:g,emailVerified:_,isAnonymous:I,providerData:F,stsTokenManager:$}=n;et(g&&$,t,"internal-error");const Q=Xs.fromJSON(this.name,$);et(typeof g=="string",t,"internal-error"),ts(r,t.name),ts(s,t.name),et(typeof _=="boolean",t,"internal-error"),et(typeof I=="boolean",t,"internal-error"),ts(o,t.name),ts(i,t.name),ts(a,t.name),ts(l,t.name),ts(f,t.name),ts(u,t.name);const ae=new sr({uid:g,auth:t,email:s,emailVerified:_,displayName:r,isAnonymous:I,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:Q,createdAt:f,lastLoginAt:u});return F&&Array.isArray(F)&&(ae.providerData=F.map(q=>({...q}))),l&&(ae._redirectEventId=l),ae}static async _fromIdTokenResponse(t,n,r=!1){const s=new Xs;s.updateFromServerResponse(n);const o=new sr({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await Ri(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];et(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?mh(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new Xs;a.updateFromIdToken(r);const l=new sr({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),f={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new dl(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,f),l}}/**
|
|
697
|
+
* @license
|
|
698
|
+
* Copyright 2020 Google LLC
|
|
699
|
+
*
|
|
700
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
701
|
+
* you may not use this file except in compliance with the License.
|
|
702
|
+
* You may obtain a copy of the License at
|
|
703
|
+
*
|
|
704
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
705
|
+
*
|
|
706
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
707
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
708
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
709
|
+
* See the License for the specific language governing permissions and
|
|
710
|
+
* limitations under the License.
|
|
711
|
+
*/const Uu=new Map;function Dr(e){zr(e instanceof Function,"Expected a class definition");let t=Uu.get(e);return t?(zr(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Uu.set(e,t),t)}/**
|
|
712
|
+
* @license
|
|
713
|
+
* Copyright 2019 Google LLC
|
|
714
|
+
*
|
|
715
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
716
|
+
* you may not use this file except in compliance with the License.
|
|
717
|
+
* You may obtain a copy of the License at
|
|
718
|
+
*
|
|
719
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
720
|
+
*
|
|
721
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
722
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
723
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
724
|
+
* See the License for the specific language governing permissions and
|
|
725
|
+
* limitations under the License.
|
|
726
|
+
*/class gh{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,n){this.storage[t]=n}async _get(t){const n=this.storage[t];return n===void 0?null:n}async _remove(t){delete this.storage[t]}_addListener(t,n){}_removeListener(t,n){}}gh.type="NONE";const Hu=gh;/**
|
|
727
|
+
* @license
|
|
728
|
+
* Copyright 2019 Google LLC
|
|
729
|
+
*
|
|
730
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
731
|
+
* you may not use this file except in compliance with the License.
|
|
732
|
+
* You may obtain a copy of the License at
|
|
733
|
+
*
|
|
734
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
735
|
+
*
|
|
736
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
737
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
738
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
739
|
+
* See the License for the specific language governing permissions and
|
|
740
|
+
* limitations under the License.
|
|
741
|
+
*/function gi(e,t,n){return`firebase:${e}:${t}:${n}`}class Zs{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=gi(this.userKey,s.apiKey,o),this.fullPersistenceKey=gi("persistence",s.apiKey,o),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);if(!t)return null;if(typeof t=="string"){const n=await xi(this.auth,{idToken:t}).catch(()=>{});return n?sr._fromGetAccountInfoResponse(this.auth,n,t):null}return sr._fromJSON(this.auth,t)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=t,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,n,r="authUser"){if(!n.length)return new Zs(Dr(Hu),t,r);const s=(await Promise.all(n.map(async f=>{if(await f._isAvailable())return f}))).filter(f=>f);let o=s[0]||Dr(Hu);const i=gi(r,t.config.apiKey,t.name);let a=null;for(const f of n)try{const u=await f._get(i);if(u){let g;if(typeof u=="string"){const _=await xi(t,{idToken:u}).catch(()=>{});if(!_)break;g=await sr._fromGetAccountInfoResponse(t,_,u)}else g=sr._fromJSON(t,u);f!==o&&(a=g),o=f;break}}catch{}const l=s.filter(f=>f._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new Zs(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async f=>{if(f!==o)try{await f._remove(i)}catch{}})),new Zs(o,t,r))}}/**
|
|
742
|
+
* @license
|
|
743
|
+
* Copyright 2020 Google LLC
|
|
744
|
+
*
|
|
745
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
746
|
+
* you may not use this file except in compliance with the License.
|
|
747
|
+
* You may obtain a copy of the License at
|
|
748
|
+
*
|
|
749
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
750
|
+
*
|
|
751
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
752
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
753
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
754
|
+
* See the License for the specific language governing permissions and
|
|
755
|
+
* limitations under the License.
|
|
756
|
+
*/function Wu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(bh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(vh(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(kh(t))return"Blackberry";if(Th(t))return"Webos";if(yh(t))return"Safari";if((t.includes("chrome/")||wh(t))&&!t.includes("edge/"))return"Chrome";if(_h(t))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=e.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function vh(e=Pn()){return/firefox\//i.test(e)}function yh(e=Pn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function wh(e=Pn()){return/crios\//i.test(e)}function bh(e=Pn()){return/iemobile/i.test(e)}function _h(e=Pn()){return/android/i.test(e)}function kh(e=Pn()){return/blackberry/i.test(e)}function Th(e=Pn()){return/webos/i.test(e)}function Xl(e=Pn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function VE(e=Pn()){var t;return Xl(e)&&!!((t=window.navigator)!=null&&t.standalone)}function zE(){return rI()&&document.documentMode===10}function Sh(e=Pn()){return Xl(e)||_h(e)||Th(e)||kh(e)||/windows phone/i.test(e)||bh(e)}/**
|
|
757
|
+
* @license
|
|
758
|
+
* Copyright 2020 Google LLC
|
|
759
|
+
*
|
|
760
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
761
|
+
* you may not use this file except in compliance with the License.
|
|
762
|
+
* You may obtain a copy of the License at
|
|
763
|
+
*
|
|
764
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
765
|
+
*
|
|
766
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
767
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
768
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
769
|
+
* See the License for the specific language governing permissions and
|
|
770
|
+
* limitations under the License.
|
|
771
|
+
*/function Ih(e,t=[]){let n;switch(e){case"Browser":n=Wu(Pn());break;case"Worker":n=`${Wu(Pn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${Jo}/${r}`}/**
|
|
772
|
+
* @license
|
|
773
|
+
* Copyright 2022 Google LLC
|
|
774
|
+
*
|
|
775
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
776
|
+
* you may not use this file except in compliance with the License.
|
|
777
|
+
* You may obtain a copy of the License at
|
|
778
|
+
*
|
|
779
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
780
|
+
*
|
|
781
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
782
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
783
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
784
|
+
* See the License for the specific language governing permissions and
|
|
785
|
+
* limitations under the License.
|
|
786
|
+
*/class qE{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,n){const r=o=>new Promise((i,a)=>{try{const l=t(o);i(l)}catch(l){a(l)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const n=[];try{for(const r of this.queue)await r(t),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
|
|
787
|
+
* @license
|
|
788
|
+
* Copyright 2023 Google LLC
|
|
789
|
+
*
|
|
790
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
791
|
+
* you may not use this file except in compliance with the License.
|
|
792
|
+
* You may obtain a copy of the License at
|
|
793
|
+
*
|
|
794
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
795
|
+
*
|
|
796
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
797
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
798
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
799
|
+
* See the License for the specific language governing permissions and
|
|
800
|
+
* limitations under the License.
|
|
801
|
+
*/async function GE(e,t={}){return lo(e,"GET","/v2/passwordPolicy",Yl(e,t))}/**
|
|
802
|
+
* @license
|
|
803
|
+
* Copyright 2023 Google LLC
|
|
804
|
+
*
|
|
805
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
806
|
+
* you may not use this file except in compliance with the License.
|
|
807
|
+
* You may obtain a copy of the License at
|
|
808
|
+
*
|
|
809
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
810
|
+
*
|
|
811
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
812
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
813
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
814
|
+
* See the License for the specific language governing permissions and
|
|
815
|
+
* limitations under the License.
|
|
816
|
+
*/const KE=6;class JE{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??KE,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=t.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=t.forceUpgradeOnSignin??!1,this.schemaVersion=t.schemaVersion}validatePassword(t){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,n),this.validatePasswordCharacterOptions(t,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(t,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=t.length>=r),s&&(n.meetsMaxPasswordLength=t.length<=s)}validatePasswordCharacterOptions(t,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s<t.length;s++)r=t.charAt(s),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(t,n,r,s,o){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=o))}}/**
|
|
817
|
+
* @license
|
|
818
|
+
* Copyright 2020 Google LLC
|
|
819
|
+
*
|
|
820
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
821
|
+
* you may not use this file except in compliance with the License.
|
|
822
|
+
* You may obtain a copy of the License at
|
|
823
|
+
*
|
|
824
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
825
|
+
*
|
|
826
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
827
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
828
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
829
|
+
* See the License for the specific language governing permissions and
|
|
830
|
+
* limitations under the License.
|
|
831
|
+
*/class YE{constructor(t,n,r,s){this.app=t,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Vu(this),this.idTokenSubscription=new Vu(this),this.beforeStateQueue=new qE(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=dh,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(o=>this._resolvePersistenceManagerAvailable=o)}_initializeWithPersistence(t,n){return n&&(this._popupRedirectResolver=Dr(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await Zs.create(this,t),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((o=this.currentUser)==null?void 0:o.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!t)){if(this.currentUser&&t&&this.currentUser.uid===t.uid){this._currentUser._assign(t),await this.currentUser.getIdToken();return}await this._updateCurrentUser(t,!0)}}async initializeCurrentUserFromIdToken(t){try{const n=await xi(this,{idToken:t}),r=await sr._fromGetAccountInfoResponse(this,n,t);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var o;if(_r(this.app)){const i=this.app.settings.authIdToken;return i?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const i=(o=this.redirectUser)==null?void 0:o._redirectEventId,a=r==null?void 0:r._redirectEventId,l=await this.tryRedirectSignIn(t);(!i||i===a)&&(l!=null&&l.user)&&(r=l.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(i){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return et(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(t){try{await Ri(t)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=RE()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(_r(this.app))return Promise.reject(Os(this));const n=t?ao(t):null;return n&&et(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(t,n=!1){if(!this._deleted)return t&&et(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(t),this.queue(async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()})}async signOut(){return _r(this.app)?Promise.reject(Os(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return _r(this.app)?Promise.reject(Os(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Dr(t))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(t)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await GE(this),n=new JE(t);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new Go("auth","Firebase",t())}onAuthStateChanged(t,n,r){return this.registerStateListener(this.authStateSubscription,t,n,r)}beforeAuthStateChanged(t,n){return this.beforeStateQueue.pushCallback(t,n)}onIdTokenChanged(t,n,r){return this.registerStateListener(this.idTokenSubscription,t,n,r)}authStateReady(){return new Promise((t,n)=>{if(this.currentUser)t();else{const r=this.onAuthStateChanged(()=>{r(),t()},n)}})}async revokeAccessToken(t){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await WE(this,r)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(t=this._currentUser)==null?void 0:t.toJSON()}}async _setRedirectUser(t,n){const r=await this.getOrInitRedirectPersistenceManager(n);return t===null?r.removeCurrentUser():r.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const n=t&&Dr(t)||this._popupRedirectResolver;et(n,this,"argument-error"),this.redirectPersistenceManager=await Zs.create(this,[Dr(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===t?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(t))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const t=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,n,r,s){if(this._deleted)return()=>{};const o=typeof n=="function"?n:n.next.bind(n);let i=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(et(a,this,"internal-error"),a.then(()=>{i||o(this.currentUser)}),typeof n=="function"){const l=t.addObserver(n,r,s);return()=>{i=!0,l()}}else{const l=t.addObserver(n);return()=>{i=!0,l()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return et(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Ih(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var n;if(_r(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return t!=null&&t.error&&EE(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Yi(e){return ao(e)}class Vu{constructor(t){this.auth=t,this.observer=null,this.addObserver=uI(n=>this.observer=n)}get next(){return et(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
|
832
|
+
* @license
|
|
833
|
+
* Copyright 2020 Google LLC
|
|
834
|
+
*
|
|
835
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
836
|
+
* you may not use this file except in compliance with the License.
|
|
837
|
+
* You may obtain a copy of the License at
|
|
838
|
+
*
|
|
839
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
840
|
+
*
|
|
841
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
842
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
843
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
844
|
+
* See the License for the specific language governing permissions and
|
|
845
|
+
* limitations under the License.
|
|
846
|
+
*/let Zl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function QE(e){Zl=e}function XE(e){return Zl.loadJS(e)}function ZE(){return Zl.gapiScript}function eC(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
|
|
847
|
+
* @license
|
|
848
|
+
* Copyright 2020 Google LLC
|
|
849
|
+
*
|
|
850
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
851
|
+
* you may not use this file except in compliance with the License.
|
|
852
|
+
* You may obtain a copy of the License at
|
|
853
|
+
*
|
|
854
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
855
|
+
*
|
|
856
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
857
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
858
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
859
|
+
* See the License for the specific language governing permissions and
|
|
860
|
+
* limitations under the License.
|
|
861
|
+
*/function tC(e,t){const n=oh(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(so(o,t??{}))return s;Er(s,"already-initialized")}return n.initialize({options:t})}function nC(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Dr);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function rC(e,t,n){const r=Yi(e);et(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=Eh(t),{host:i,port:a}=sC(t),l=a===null?"":`:${a}`,f={url:`${o}//${i}${l}/`},u=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){et(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),et(so(f,r.config.emulator)&&so(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=f,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,zl(i)?hI(`${o}//${i}${l}`):oC()}function Eh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function sC(e){const t=Eh(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const o=s[1];return{host:o,port:zu(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:zu(i)}}}function zu(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function oC(){function e(){const t=document.createElement("p"),n=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",e):e())}/**
|
|
862
|
+
* @license
|
|
863
|
+
* Copyright 2020 Google LLC
|
|
864
|
+
*
|
|
865
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
866
|
+
* you may not use this file except in compliance with the License.
|
|
867
|
+
* You may obtain a copy of the License at
|
|
868
|
+
*
|
|
869
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
870
|
+
*
|
|
871
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
872
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
873
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
874
|
+
* See the License for the specific language governing permissions and
|
|
875
|
+
* limitations under the License.
|
|
876
|
+
*/class Ch{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return Lr("not implemented")}_getIdTokenResponse(t){return Lr("not implemented")}_linkToIdToken(t,n){return Lr("not implemented")}_getReauthenticationResolver(t){return Lr("not implemented")}}/**
|
|
877
|
+
* @license
|
|
878
|
+
* Copyright 2020 Google LLC
|
|
879
|
+
*
|
|
880
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
881
|
+
* you may not use this file except in compliance with the License.
|
|
882
|
+
* You may obtain a copy of the License at
|
|
883
|
+
*
|
|
884
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
885
|
+
*
|
|
886
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
887
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
888
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
889
|
+
* See the License for the specific language governing permissions and
|
|
890
|
+
* limitations under the License.
|
|
891
|
+
*/async function eo(e,t){return OE(e,"POST","/v1/accounts:signInWithIdp",Yl(e,t))}/**
|
|
892
|
+
* @license
|
|
893
|
+
* Copyright 2020 Google LLC
|
|
894
|
+
*
|
|
895
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
896
|
+
* you may not use this file except in compliance with the License.
|
|
897
|
+
* You may obtain a copy of the License at
|
|
898
|
+
*
|
|
899
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
900
|
+
*
|
|
901
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
902
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
903
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
904
|
+
* See the License for the specific language governing permissions and
|
|
905
|
+
* limitations under the License.
|
|
906
|
+
*/const iC="http://localhost";class Ns extends Ch{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new Ns(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(n.idToken=t.idToken),t.accessToken&&(n.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(n.nonce=t.nonce),t.pendingToken&&(n.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(n.accessToken=t.oauthToken,n.secret=t.oauthTokenSecret):Er("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const n=typeof t=="string"?JSON.parse(t):t,{providerId:r,signInMethod:s,...o}=n;if(!r||!s)return null;const i=new Ns(r,s);return i.idToken=o.idToken||void 0,i.accessToken=o.accessToken||void 0,i.secret=o.secret,i.nonce=o.nonce,i.pendingToken=o.pendingToken||null,i}_getIdTokenResponse(t){const n=this.buildRequest();return eo(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,eo(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,eo(t,n)}buildRequest(){const t={requestUri:iC,returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),t.postBody=Ko(n)}return t}}/**
|
|
907
|
+
* @license
|
|
908
|
+
* Copyright 2020 Google LLC
|
|
909
|
+
*
|
|
910
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
911
|
+
* you may not use this file except in compliance with the License.
|
|
912
|
+
* You may obtain a copy of the License at
|
|
913
|
+
*
|
|
914
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
915
|
+
*
|
|
916
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
917
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
918
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
919
|
+
* See the License for the specific language governing permissions and
|
|
920
|
+
* limitations under the License.
|
|
921
|
+
*/class ec{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}/**
|
|
922
|
+
* @license
|
|
923
|
+
* Copyright 2019 Google LLC
|
|
924
|
+
*
|
|
925
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
926
|
+
* you may not use this file except in compliance with the License.
|
|
927
|
+
* You may obtain a copy of the License at
|
|
928
|
+
*
|
|
929
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
930
|
+
*
|
|
931
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
932
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
933
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
934
|
+
* See the License for the specific language governing permissions and
|
|
935
|
+
* limitations under the License.
|
|
936
|
+
*/class Qo extends ec{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
|
|
937
|
+
* @license
|
|
938
|
+
* Copyright 2020 Google LLC
|
|
939
|
+
*
|
|
940
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
941
|
+
* you may not use this file except in compliance with the License.
|
|
942
|
+
* You may obtain a copy of the License at
|
|
943
|
+
*
|
|
944
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
945
|
+
*
|
|
946
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
947
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
948
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
949
|
+
* See the License for the specific language governing permissions and
|
|
950
|
+
* limitations under the License.
|
|
951
|
+
*/class is extends Qo{constructor(){super("facebook.com")}static credential(t){return Ns._fromParams({providerId:is.PROVIDER_ID,signInMethod:is.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return is.credentialFromTaggedObject(t)}static credentialFromError(t){return is.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return is.credential(t.oauthAccessToken)}catch{return null}}}is.FACEBOOK_SIGN_IN_METHOD="facebook.com";is.PROVIDER_ID="facebook.com";/**
|
|
952
|
+
* @license
|
|
953
|
+
* Copyright 2020 Google LLC
|
|
954
|
+
*
|
|
955
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
956
|
+
* you may not use this file except in compliance with the License.
|
|
957
|
+
* You may obtain a copy of the License at
|
|
958
|
+
*
|
|
959
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
960
|
+
*
|
|
961
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
962
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
963
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
964
|
+
* See the License for the specific language governing permissions and
|
|
965
|
+
* limitations under the License.
|
|
966
|
+
*/class as extends Qo{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return Ns._fromParams({providerId:as.PROVIDER_ID,signInMethod:as.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return as.credentialFromTaggedObject(t)}static credentialFromError(t){return as.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return as.credential(n,r)}catch{return null}}}as.GOOGLE_SIGN_IN_METHOD="google.com";as.PROVIDER_ID="google.com";/**
|
|
967
|
+
* @license
|
|
968
|
+
* Copyright 2020 Google LLC
|
|
969
|
+
*
|
|
970
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
971
|
+
* you may not use this file except in compliance with the License.
|
|
972
|
+
* You may obtain a copy of the License at
|
|
973
|
+
*
|
|
974
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
975
|
+
*
|
|
976
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
977
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
978
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
979
|
+
* See the License for the specific language governing permissions and
|
|
980
|
+
* limitations under the License.
|
|
981
|
+
*/class kr extends Qo{constructor(){super("github.com")}static credential(t){return Ns._fromParams({providerId:kr.PROVIDER_ID,signInMethod:kr.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return kr.credentialFromTaggedObject(t)}static credentialFromError(t){return kr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return kr.credential(t.oauthAccessToken)}catch{return null}}}kr.GITHUB_SIGN_IN_METHOD="github.com";kr.PROVIDER_ID="github.com";/**
|
|
982
|
+
* @license
|
|
983
|
+
* Copyright 2020 Google LLC
|
|
984
|
+
*
|
|
985
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
986
|
+
* you may not use this file except in compliance with the License.
|
|
987
|
+
* You may obtain a copy of the License at
|
|
988
|
+
*
|
|
989
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
990
|
+
*
|
|
991
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
992
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
993
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
994
|
+
* See the License for the specific language governing permissions and
|
|
995
|
+
* limitations under the License.
|
|
996
|
+
*/class ls extends Qo{constructor(){super("twitter.com")}static credential(t,n){return Ns._fromParams({providerId:ls.PROVIDER_ID,signInMethod:ls.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return ls.credentialFromTaggedObject(t)}static credentialFromError(t){return ls.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return ls.credential(n,r)}catch{return null}}}ls.TWITTER_SIGN_IN_METHOD="twitter.com";ls.PROVIDER_ID="twitter.com";/**
|
|
997
|
+
* @license
|
|
998
|
+
* Copyright 2020 Google LLC
|
|
999
|
+
*
|
|
1000
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1001
|
+
* you may not use this file except in compliance with the License.
|
|
1002
|
+
* You may obtain a copy of the License at
|
|
1003
|
+
*
|
|
1004
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1005
|
+
*
|
|
1006
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1007
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1008
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1009
|
+
* See the License for the specific language governing permissions and
|
|
1010
|
+
* limitations under the License.
|
|
1011
|
+
*/class io{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,n,r,s=!1){const o=await sr._fromIdTokenResponse(t,r,s),i=qu(r);return new io({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=qu(r);return new io({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function qu(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
|
|
1012
|
+
* @license
|
|
1013
|
+
* Copyright 2020 Google LLC
|
|
1014
|
+
*
|
|
1015
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1016
|
+
* you may not use this file except in compliance with the License.
|
|
1017
|
+
* You may obtain a copy of the License at
|
|
1018
|
+
*
|
|
1019
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1020
|
+
*
|
|
1021
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1022
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1023
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1024
|
+
* See the License for the specific language governing permissions and
|
|
1025
|
+
* limitations under the License.
|
|
1026
|
+
*/class Pi extends ps{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Pi.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(t,n,r,s){return new Pi(t,n,r,s)}}function Ah(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?Pi._fromErrorAndOperation(e,o,t,r):o})}async function aC(e,t,n=!1){const r=await Wo(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return io._forOperation(e,"link",r)}/**
|
|
1027
|
+
* @license
|
|
1028
|
+
* Copyright 2019 Google LLC
|
|
1029
|
+
*
|
|
1030
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1031
|
+
* you may not use this file except in compliance with the License.
|
|
1032
|
+
* You may obtain a copy of the License at
|
|
1033
|
+
*
|
|
1034
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1035
|
+
*
|
|
1036
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1037
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1038
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1039
|
+
* See the License for the specific language governing permissions and
|
|
1040
|
+
* limitations under the License.
|
|
1041
|
+
*/async function lC(e,t,n=!1){const{auth:r}=e;if(_r(r.app))return Promise.reject(Os(r));const s="reauthenticate";try{const o=await Wo(e,Ah(r,s,t,e),n);et(o.idToken,r,"internal-error");const i=Ql(o.idToken);et(i,r,"internal-error");const{sub:a}=i;return et(e.uid===a,r,"user-mismatch"),io._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Er(r,"user-mismatch"),o}}/**
|
|
1042
|
+
* @license
|
|
1043
|
+
* Copyright 2020 Google LLC
|
|
1044
|
+
*
|
|
1045
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1046
|
+
* you may not use this file except in compliance with the License.
|
|
1047
|
+
* You may obtain a copy of the License at
|
|
1048
|
+
*
|
|
1049
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1050
|
+
*
|
|
1051
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1052
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1053
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1054
|
+
* See the License for the specific language governing permissions and
|
|
1055
|
+
* limitations under the License.
|
|
1056
|
+
*/async function cC(e,t,n=!1){if(_r(e.app))return Promise.reject(Os(e));const r="signIn",s=await Ah(e,r,t),o=await io._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function uC(e,t,n,r){return ao(e).onIdTokenChanged(t,n,r)}function dC(e,t,n){return ao(e).beforeAuthStateChanged(t,n)}const Mi="__sak";/**
|
|
1057
|
+
* @license
|
|
1058
|
+
* Copyright 2019 Google LLC
|
|
1059
|
+
*
|
|
1060
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1061
|
+
* you may not use this file except in compliance with the License.
|
|
1062
|
+
* You may obtain a copy of the License at
|
|
1063
|
+
*
|
|
1064
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1065
|
+
*
|
|
1066
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1067
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1068
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1069
|
+
* See the License for the specific language governing permissions and
|
|
1070
|
+
* limitations under the License.
|
|
1071
|
+
*/class xh{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Mi,"1"),this.storage.removeItem(Mi),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,n){return this.storage.setItem(t,JSON.stringify(n)),Promise.resolve()}_get(t){const n=this.storage.getItem(t);return Promise.resolve(n?JSON.parse(n):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
|
|
1072
|
+
* @license
|
|
1073
|
+
* Copyright 2020 Google LLC
|
|
1074
|
+
*
|
|
1075
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1076
|
+
* you may not use this file except in compliance with the License.
|
|
1077
|
+
* You may obtain a copy of the License at
|
|
1078
|
+
*
|
|
1079
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1080
|
+
*
|
|
1081
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1082
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1083
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1084
|
+
* See the License for the specific language governing permissions and
|
|
1085
|
+
* limitations under the License.
|
|
1086
|
+
*/const fC=1e3,hC=10;class Rh extends xh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Sh(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&t(n,s,r)}}onStorageEvent(t,n=!1){if(!t.key){this.forAllChangedKeys((i,a,l)=>{this.notifyListeners(i,l)});return}const r=t.key;n?this.detachListener():this.stopPolling();const s=()=>{const i=this.storage.getItem(r);!n&&this.localCache[r]===i||this.notifyListeners(r,i)},o=this.storage.getItem(r);zE()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,hC):s()}notifyListeners(t,n){this.localCache[t]=n;const r=this.listeners[t];if(r)for(const s of Array.from(r))s(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((t,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:n,newValue:r}),!0)})},fC)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(n)}_removeListener(t,n){this.listeners[t]&&(this.listeners[t].delete(n),this.listeners[t].size===0&&delete this.listeners[t]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(t,n){await super._set(t,n),this.localCache[t]=JSON.stringify(n)}async _get(t){const n=await super._get(t);return this.localCache[t]=JSON.stringify(n),n}async _remove(t){await super._remove(t),delete this.localCache[t]}}Rh.type="LOCAL";const pC=Rh;/**
|
|
1087
|
+
* @license
|
|
1088
|
+
* Copyright 2020 Google LLC
|
|
1089
|
+
*
|
|
1090
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1091
|
+
* you may not use this file except in compliance with the License.
|
|
1092
|
+
* You may obtain a copy of the License at
|
|
1093
|
+
*
|
|
1094
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1095
|
+
*
|
|
1096
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1097
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1098
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1099
|
+
* See the License for the specific language governing permissions and
|
|
1100
|
+
* limitations under the License.
|
|
1101
|
+
*/class Ph extends xh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}Ph.type="SESSION";const Mh=Ph;/**
|
|
1102
|
+
* @license
|
|
1103
|
+
* Copyright 2019 Google LLC
|
|
1104
|
+
*
|
|
1105
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1106
|
+
* you may not use this file except in compliance with the License.
|
|
1107
|
+
* You may obtain a copy of the License at
|
|
1108
|
+
*
|
|
1109
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1110
|
+
*
|
|
1111
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1112
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1113
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1114
|
+
* See the License for the specific language governing permissions and
|
|
1115
|
+
* limitations under the License.
|
|
1116
|
+
*/function mC(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
|
|
1117
|
+
* @license
|
|
1118
|
+
* Copyright 2019 Google LLC
|
|
1119
|
+
*
|
|
1120
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1121
|
+
* you may not use this file except in compliance with the License.
|
|
1122
|
+
* You may obtain a copy of the License at
|
|
1123
|
+
*
|
|
1124
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1125
|
+
*
|
|
1126
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1127
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1128
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1129
|
+
* See the License for the specific language governing permissions and
|
|
1130
|
+
* limitations under the License.
|
|
1131
|
+
*/class Qi{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const n=this.receivers.find(s=>s.isListeningto(t));if(n)return n;const r=new Qi(t);return this.receivers.push(r),r}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const n=t,{eventId:r,eventType:s,data:o}=n.data,i=this.handlersMap[s];if(!(i!=null&&i.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const a=Array.from(i).map(async f=>f(n.origin,o)),l=await mC(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_subscribe(t,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(n)}_unsubscribe(t,n){this.handlersMap[t]&&n&&this.handlersMap[t].delete(n),(!n||this.handlersMap[t].size===0)&&delete this.handlersMap[t],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Qi.receivers=[];/**
|
|
1132
|
+
* @license
|
|
1133
|
+
* Copyright 2020 Google LLC
|
|
1134
|
+
*
|
|
1135
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1136
|
+
* you may not use this file except in compliance with the License.
|
|
1137
|
+
* You may obtain a copy of the License at
|
|
1138
|
+
*
|
|
1139
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1140
|
+
*
|
|
1141
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1142
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1143
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1144
|
+
* See the License for the specific language governing permissions and
|
|
1145
|
+
* limitations under the License.
|
|
1146
|
+
*/function tc(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
|
|
1147
|
+
* @license
|
|
1148
|
+
* Copyright 2019 Google LLC
|
|
1149
|
+
*
|
|
1150
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1151
|
+
* you may not use this file except in compliance with the License.
|
|
1152
|
+
* You may obtain a copy of the License at
|
|
1153
|
+
*
|
|
1154
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1155
|
+
*
|
|
1156
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1157
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1158
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1159
|
+
* See the License for the specific language governing permissions and
|
|
1160
|
+
* limitations under the License.
|
|
1161
|
+
*/class gC{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,n,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let o,i;return new Promise((a,l)=>{const f=tc("",20);s.port1.start();const u=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(g){const _=g;if(_.data.eventId===f)switch(_.data.status){case"ack":clearTimeout(u),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(_.data.response);break;default:clearTimeout(u),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:f,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
|
|
1162
|
+
* @license
|
|
1163
|
+
* Copyright 2020 Google LLC
|
|
1164
|
+
*
|
|
1165
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1166
|
+
* you may not use this file except in compliance with the License.
|
|
1167
|
+
* You may obtain a copy of the License at
|
|
1168
|
+
*
|
|
1169
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1170
|
+
*
|
|
1171
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1172
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1173
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1174
|
+
* See the License for the specific language governing permissions and
|
|
1175
|
+
* limitations under the License.
|
|
1176
|
+
*/function Ir(){return window}function vC(e){Ir().location.href=e}/**
|
|
1177
|
+
* @license
|
|
1178
|
+
* Copyright 2020 Google LLC.
|
|
1179
|
+
*
|
|
1180
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1181
|
+
* you may not use this file except in compliance with the License.
|
|
1182
|
+
* You may obtain a copy of the License at
|
|
1183
|
+
*
|
|
1184
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1185
|
+
*
|
|
1186
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1187
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1188
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1189
|
+
* See the License for the specific language governing permissions and
|
|
1190
|
+
* limitations under the License.
|
|
1191
|
+
*/function $h(){return typeof Ir().WorkerGlobalScope<"u"&&typeof Ir().importScripts=="function"}async function yC(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function wC(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function bC(){return $h()?self:null}/**
|
|
1192
|
+
* @license
|
|
1193
|
+
* Copyright 2019 Google LLC
|
|
1194
|
+
*
|
|
1195
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1196
|
+
* you may not use this file except in compliance with the License.
|
|
1197
|
+
* You may obtain a copy of the License at
|
|
1198
|
+
*
|
|
1199
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1200
|
+
*
|
|
1201
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1202
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1203
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1204
|
+
* See the License for the specific language governing permissions and
|
|
1205
|
+
* limitations under the License.
|
|
1206
|
+
*/const Oh="firebaseLocalStorageDb",_C=1,$i="firebaseLocalStorage",Nh="fbase_key";class Xo{constructor(t){this.request=t}toPromise(){return new Promise((t,n)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Xi(e,t){return e.transaction([$i],t?"readwrite":"readonly").objectStore($i)}function kC(){const e=indexedDB.deleteDatabase(Oh);return new Xo(e).toPromise()}function fl(){const e=indexedDB.open(Oh,_C);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore($i,{keyPath:Nh})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains($i)?t(r):(r.close(),await kC(),t(await fl()))})})}async function Gu(e,t,n){const r=Xi(e,!0).put({[Nh]:t,value:n});return new Xo(r).toPromise()}async function TC(e,t){const n=Xi(e,!1).get(t),r=await new Xo(n).toPromise();return r===void 0?null:r.value}function Ku(e,t){const n=Xi(e,!0).delete(t);return new Xo(n).toPromise()}const SC=800,IC=3;class Lh{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await fl(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>IC)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return $h()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Qi._getInstance(bC()),this.receiver._subscribe("keyChanged",async(t,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(t,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await yC(),!this.activeServiceWorker)return;this.sender=new gC(this.activeServiceWorker);const t=await this.sender._send("ping",{},800);t&&(n=t[0])!=null&&n.fulfilled&&(r=t[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(!(!this.sender||!this.activeServiceWorker||wC()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await fl();return await Gu(t,Mi,"1"),await Ku(t,Mi),!0}catch{}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>Gu(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>TC(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Ku(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=Xi(s,!1).getAll();return new Xo(o).toPromise()});if(!t)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(t.length!==0)for(const{fbase_key:s,value:o}of t)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(o)&&(this.notifyListeners(s,o),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(t,n){this.localCache[t]=n;const r=this.listeners[t];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),SC)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(n)}_removeListener(t,n){this.listeners[t]&&(this.listeners[t].delete(n),this.listeners[t].size===0&&delete this.listeners[t]),Object.keys(this.listeners).length===0&&this.stopPolling()}}Lh.type="LOCAL";const EC=Lh;new Yo(3e4,6e4);/**
|
|
1207
|
+
* @license
|
|
1208
|
+
* Copyright 2021 Google LLC
|
|
1209
|
+
*
|
|
1210
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1211
|
+
* you may not use this file except in compliance with the License.
|
|
1212
|
+
* You may obtain a copy of the License at
|
|
1213
|
+
*
|
|
1214
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1215
|
+
*
|
|
1216
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1217
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1218
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1219
|
+
* See the License for the specific language governing permissions and
|
|
1220
|
+
* limitations under the License.
|
|
1221
|
+
*/function Dh(e,t){return t?Dr(t):(et(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
|
|
1222
|
+
* @license
|
|
1223
|
+
* Copyright 2019 Google LLC
|
|
1224
|
+
*
|
|
1225
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1226
|
+
* you may not use this file except in compliance with the License.
|
|
1227
|
+
* You may obtain a copy of the License at
|
|
1228
|
+
*
|
|
1229
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1230
|
+
*
|
|
1231
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1232
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1233
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1234
|
+
* See the License for the specific language governing permissions and
|
|
1235
|
+
* limitations under the License.
|
|
1236
|
+
*/class nc extends Ch{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return eo(t,this._buildIdpRequest())}_linkToIdToken(t,n){return eo(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return eo(t,this._buildIdpRequest())}_buildIdpRequest(t){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(n.idToken=t),n}}function CC(e){return cC(e.auth,new nc(e),e.bypassAuthState)}function AC(e){const{auth:t,user:n}=e;return et(n,t,"internal-error"),lC(n,new nc(e),e.bypassAuthState)}async function xC(e){const{auth:t,user:n}=e;return et(n,t,"internal-error"),aC(n,new nc(e),e.bypassAuthState)}/**
|
|
1237
|
+
* @license
|
|
1238
|
+
* Copyright 2020 Google LLC
|
|
1239
|
+
*
|
|
1240
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1241
|
+
* you may not use this file except in compliance with the License.
|
|
1242
|
+
* You may obtain a copy of the License at
|
|
1243
|
+
*
|
|
1244
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1245
|
+
*
|
|
1246
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1247
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1248
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1249
|
+
* See the License for the specific language governing permissions and
|
|
1250
|
+
* limitations under the License.
|
|
1251
|
+
*/class jh{constructor(t,n,r,s,o=!1){this.auth=t,this.resolver=r,this.user=s,this.bypassAuthState=o,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(t,n)=>{this.pendingPromise={resolve:t,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(t){const{urlResponse:n,sessionId:r,postBody:s,tenantId:o,error:i,type:a}=t;if(i){this.reject(i);return}const l={auth:this.auth,requestUri:n,sessionId:r,tenantId:o||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(f){this.reject(f)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return CC;case"linkViaPopup":case"linkViaRedirect":return xC;case"reauthViaPopup":case"reauthViaRedirect":return AC;default:Er(this.auth,"internal-error")}}resolve(t){zr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){zr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
|
|
1252
|
+
* @license
|
|
1253
|
+
* Copyright 2020 Google LLC
|
|
1254
|
+
*
|
|
1255
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1256
|
+
* you may not use this file except in compliance with the License.
|
|
1257
|
+
* You may obtain a copy of the License at
|
|
1258
|
+
*
|
|
1259
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1260
|
+
*
|
|
1261
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1262
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1263
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1264
|
+
* See the License for the specific language governing permissions and
|
|
1265
|
+
* limitations under the License.
|
|
1266
|
+
*/const RC=new Yo(2e3,1e4);async function PC(e,t,n){if(_r(e.app))return Promise.reject(ar(e,"operation-not-supported-in-this-environment"));const r=Yi(e);CE(e,t,ec);const s=Dh(r,n);return new Ps(r,"signInViaPopup",t,s).executeNotNull()}class Ps extends jh{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,Ps.currentPopupAction&&Ps.currentPopupAction.cancel(),Ps.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return et(t,this.auth,"internal-error"),t}async onExecution(){zr(this.filter.length===1,"Popup operations only handle one event");const t=tc();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(ar(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(ar(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ps.currentPopupAction=null}pollUserCancellation(){const t=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(ar(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,RC.get())};t()}}Ps.currentPopupAction=null;/**
|
|
1267
|
+
* @license
|
|
1268
|
+
* Copyright 2020 Google LLC
|
|
1269
|
+
*
|
|
1270
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1271
|
+
* you may not use this file except in compliance with the License.
|
|
1272
|
+
* You may obtain a copy of the License at
|
|
1273
|
+
*
|
|
1274
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1275
|
+
*
|
|
1276
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1277
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1278
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1279
|
+
* See the License for the specific language governing permissions and
|
|
1280
|
+
* limitations under the License.
|
|
1281
|
+
*/const MC="pendingRedirect",vi=new Map;class $C extends jh{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=vi.get(this.auth._key());if(!t){try{const r=await OC(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}vi.set(this.auth._key(),t)}return this.bypassAuthState||vi.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(t){if(t.type==="signInViaRedirect")return super.onAuthEvent(t);if(t.type==="unknown"){this.resolve(null);return}if(t.eventId){const n=await this.auth._redirectUserForId(t.eventId);if(n)return this.user=n,super.onAuthEvent(t);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function OC(e,t){const n=DC(t),r=LC(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function NC(e,t){vi.set(e._key(),t)}function LC(e){return Dr(e._redirectPersistence)}function DC(e){return gi(MC,e.config.apiKey,e.name)}async function jC(e,t,n=!1){if(_r(e.app))return Promise.reject(Os(e));const r=Yi(e),s=Dh(r,t),i=await new $C(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
|
|
1282
|
+
* @license
|
|
1283
|
+
* Copyright 2020 Google LLC
|
|
1284
|
+
*
|
|
1285
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1286
|
+
* you may not use this file except in compliance with the License.
|
|
1287
|
+
* You may obtain a copy of the License at
|
|
1288
|
+
*
|
|
1289
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1290
|
+
*
|
|
1291
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1292
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1293
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1294
|
+
* See the License for the specific language governing permissions and
|
|
1295
|
+
* limitations under the License.
|
|
1296
|
+
*/const FC=600*1e3;class BC{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(t,r)&&(n=!0,this.sendToConsumer(t,r),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!UC(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!Fh(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(ar(this.auth,s))}else n.onAuthEvent(t)}isEventForConsumer(t,n){const r=n.eventId===null||!!t.eventId&&t.eventId===n.eventId;return n.filter.includes(t.type)&&r}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=FC&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ju(t))}saveEventToCache(t){this.cachedEventUids.add(Ju(t)),this.lastProcessedEventTime=Date.now()}}function Ju(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function Fh({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function UC(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Fh(e);default:return!1}}/**
|
|
1297
|
+
* @license
|
|
1298
|
+
* Copyright 2020 Google LLC
|
|
1299
|
+
*
|
|
1300
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1301
|
+
* you may not use this file except in compliance with the License.
|
|
1302
|
+
* You may obtain a copy of the License at
|
|
1303
|
+
*
|
|
1304
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1305
|
+
*
|
|
1306
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1307
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1308
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1309
|
+
* See the License for the specific language governing permissions and
|
|
1310
|
+
* limitations under the License.
|
|
1311
|
+
*/async function HC(e,t={}){return lo(e,"GET","/v1/projects",t)}/**
|
|
1312
|
+
* @license
|
|
1313
|
+
* Copyright 2020 Google LLC
|
|
1314
|
+
*
|
|
1315
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1316
|
+
* you may not use this file except in compliance with the License.
|
|
1317
|
+
* You may obtain a copy of the License at
|
|
1318
|
+
*
|
|
1319
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1320
|
+
*
|
|
1321
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1322
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1323
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1324
|
+
* See the License for the specific language governing permissions and
|
|
1325
|
+
* limitations under the License.
|
|
1326
|
+
*/const WC=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,VC=/^https?/;async function zC(e){if(e.config.emulator)return;const{authorizedDomains:t}=await HC(e);for(const n of t)try{if(qC(n))return}catch{}Er(e,"unauthorized-domain")}function qC(e){const t=ul(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const i=new URL(e);return i.hostname===""&&r===""?n==="chrome-extension:"&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):n==="chrome-extension:"&&i.hostname===r}if(!VC.test(n))return!1;if(WC.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
|
|
1327
|
+
* @license
|
|
1328
|
+
* Copyright 2020 Google LLC.
|
|
1329
|
+
*
|
|
1330
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1331
|
+
* you may not use this file except in compliance with the License.
|
|
1332
|
+
* You may obtain a copy of the License at
|
|
1333
|
+
*
|
|
1334
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1335
|
+
*
|
|
1336
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1337
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1338
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1339
|
+
* See the License for the specific language governing permissions and
|
|
1340
|
+
* limitations under the License.
|
|
1341
|
+
*/const GC=new Yo(3e4,6e4);function Yu(){const e=Ir().___jsl;if(e!=null&&e.H){for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let n=0;n<e.CP.length;n++)e.CP[n]=null}}function KC(e){return new Promise((t,n)=>{var s,o,i;function r(){Yu(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Yu(),n(ar(e,"network-request-failed"))},timeout:GC.get()})}if((o=(s=Ir().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=Ir().gapi)!=null&&i.load)r();else{const a=eC("iframefcb");return Ir()[a]=()=>{gapi.load?r():n(ar(e,"network-request-failed"))},XE(`${ZE()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw yi=null,t})}let yi=null;function JC(e){return yi=yi||KC(e),yi}/**
|
|
1342
|
+
* @license
|
|
1343
|
+
* Copyright 2020 Google LLC.
|
|
1344
|
+
*
|
|
1345
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1346
|
+
* you may not use this file except in compliance with the License.
|
|
1347
|
+
* You may obtain a copy of the License at
|
|
1348
|
+
*
|
|
1349
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1350
|
+
*
|
|
1351
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1352
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1353
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1354
|
+
* See the License for the specific language governing permissions and
|
|
1355
|
+
* limitations under the License.
|
|
1356
|
+
*/const YC=new Yo(5e3,15e3),QC="__/auth/iframe",XC="emulator/auth/iframe",ZC={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},e1=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function t1(e){const t=e.config;et(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Jl(t,XC):`https://${e.config.authDomain}/${QC}`,r={apiKey:t.apiKey,appName:e.name,v:Jo},s=e1.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${Ko(r).slice(1)}`}async function n1(e){const t=await JC(e),n=Ir().gapi;return et(n,e,"internal-error"),t.open({where:document.body,url:t1(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:ZC,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=ar(e,"network-request-failed"),a=Ir().setTimeout(()=>{o(i)},YC.get());function l(){Ir().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
|
|
1357
|
+
* @license
|
|
1358
|
+
* Copyright 2020 Google LLC.
|
|
1359
|
+
*
|
|
1360
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1361
|
+
* you may not use this file except in compliance with the License.
|
|
1362
|
+
* You may obtain a copy of the License at
|
|
1363
|
+
*
|
|
1364
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1365
|
+
*
|
|
1366
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1367
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1368
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1369
|
+
* See the License for the specific language governing permissions and
|
|
1370
|
+
* limitations under the License.
|
|
1371
|
+
*/const r1={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},s1=500,o1=600,i1="_blank",a1="http://localhost";class Qu{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function l1(e,t,n,r=s1,s=o1){const o=Math.max((window.screen.availHeight-s)/2,0).toString(),i=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l={...r1,width:r.toString(),height:s.toString(),top:o,left:i},f=Pn().toLowerCase();n&&(a=wh(f)?i1:n),vh(f)&&(t=t||a1,l.scrollbars="yes");const u=Object.entries(l).reduce((_,[I,F])=>`${_}${I}=${F},`,"");if(VE(f)&&a!=="_self")return c1(t||"",a),new Qu(null);const g=window.open(t||"",a,u);et(g,e,"popup-blocked");try{g.focus()}catch{}return new Qu(g)}function c1(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/**
|
|
1372
|
+
* @license
|
|
1373
|
+
* Copyright 2021 Google LLC
|
|
1374
|
+
*
|
|
1375
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1376
|
+
* you may not use this file except in compliance with the License.
|
|
1377
|
+
* You may obtain a copy of the License at
|
|
1378
|
+
*
|
|
1379
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1380
|
+
*
|
|
1381
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1382
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1383
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1384
|
+
* See the License for the specific language governing permissions and
|
|
1385
|
+
* limitations under the License.
|
|
1386
|
+
*/const u1="__/auth/handler",d1="emulator/auth/handler",f1=encodeURIComponent("fac");async function Xu(e,t,n,r,s,o){et(e.config.authDomain,e,"auth-domain-config-required"),et(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:Jo,eventId:s};if(t instanceof ec){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",cI(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[u,g]of Object.entries({}))i[u]=g}if(t instanceof Qo){const u=t.getScopes().filter(g=>g!=="");u.length>0&&(i.scopes=u.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const u of Object.keys(a))a[u]===void 0&&delete a[u];const l=await e._getAppCheckToken(),f=l?`#${f1}=${encodeURIComponent(l)}`:"";return`${h1(e)}?${Ko(a).slice(1)}${f}`}function h1({config:e}){return e.emulator?Jl(e,d1):`https://${e.authDomain}/${u1}`}/**
|
|
1387
|
+
* @license
|
|
1388
|
+
* Copyright 2020 Google LLC
|
|
1389
|
+
*
|
|
1390
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1391
|
+
* you may not use this file except in compliance with the License.
|
|
1392
|
+
* You may obtain a copy of the License at
|
|
1393
|
+
*
|
|
1394
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1395
|
+
*
|
|
1396
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1397
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1398
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1399
|
+
* See the License for the specific language governing permissions and
|
|
1400
|
+
* limitations under the License.
|
|
1401
|
+
*/const xa="webStorageSupport";class p1{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Mh,this._completeRedirectFn=jC,this._overrideRedirectResult=NC}async _openPopup(t,n,r,s){var i;zr((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Xu(t,n,r,ul(),s);return l1(t,o,tc())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await Xu(t,n,r,ul(),s);return vC(o),new Promise(()=>{})}_initialize(t){const n=t._key();if(this.eventManagers[n]){const{manager:s,promise:o}=this.eventManagers[n];return s?Promise.resolve(s):(zr(o,"If manager is not set, promise should be"),o)}const r=this.initAndGetManager(t);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(t){const n=await n1(t),r=new BC(t);return n.register("authEvent",s=>(et(s==null?void 0:s.authEvent,t,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:r},this.iframes[t._key()]=n,r}_isIframeWebStorageSupported(t,n){this.iframes[t._key()].send(xa,{type:xa},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[xa];o!==void 0&&n(!!o),Er(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=zC(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return Sh()||yh()||Xl()}}const m1=p1;var Zu="@firebase/auth",ed="1.12.2";/**
|
|
1402
|
+
* @license
|
|
1403
|
+
* Copyright 2020 Google LLC
|
|
1404
|
+
*
|
|
1405
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1406
|
+
* you may not use this file except in compliance with the License.
|
|
1407
|
+
* You may obtain a copy of the License at
|
|
1408
|
+
*
|
|
1409
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1410
|
+
*
|
|
1411
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1412
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1413
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1414
|
+
* See the License for the specific language governing permissions and
|
|
1415
|
+
* limitations under the License.
|
|
1416
|
+
*/class g1{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),((t=this.auth.currentUser)==null?void 0:t.uid)||null}async getToken(t){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(t)}:null}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const n=this.auth.onIdTokenChanged(r=>{t((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(t,n),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const n=this.internalListeners.get(t);n&&(this.internalListeners.delete(t),n(),this.updateProactiveRefresh())}assertAuthConfigured(){et(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
1417
|
+
* @license
|
|
1418
|
+
* Copyright 2020 Google LLC
|
|
1419
|
+
*
|
|
1420
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1421
|
+
* you may not use this file except in compliance with the License.
|
|
1422
|
+
* You may obtain a copy of the License at
|
|
1423
|
+
*
|
|
1424
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1425
|
+
*
|
|
1426
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1427
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1428
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1429
|
+
* See the License for the specific language governing permissions and
|
|
1430
|
+
* limitations under the License.
|
|
1431
|
+
*/function v1(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function y1(e){Uo(new oo("auth",(t,{options:n})=>{const r=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),o=t.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=r.options;et(i&&!i.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:i,authDomain:a,clientPlatform:e,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ih(e)},f=new YE(r,s,o,l);return nC(f,n),f},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),Uo(new oo("auth-internal",t=>{const n=Yi(t.getProvider("auth").getImmediate());return(r=>new g1(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Qs(Zu,ed,v1(e)),Qs(Zu,ed,"esm2020")}/**
|
|
1432
|
+
* @license
|
|
1433
|
+
* Copyright 2021 Google LLC
|
|
1434
|
+
*
|
|
1435
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1436
|
+
* you may not use this file except in compliance with the License.
|
|
1437
|
+
* You may obtain a copy of the License at
|
|
1438
|
+
*
|
|
1439
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1440
|
+
*
|
|
1441
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1442
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1443
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1444
|
+
* See the License for the specific language governing permissions and
|
|
1445
|
+
* limitations under the License.
|
|
1446
|
+
*/const w1=300,b1=th("authIdTokenMaxAge")||w1;let td=null;const _1=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>b1)return;const s=n==null?void 0:n.token;td!==s&&(td=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function k1(e=ah()){const t=oh(e,"auth");if(t.isInitialized())return t.getImmediate();const n=tC(e,{popupRedirectResolver:m1,persistence:[EC,pC,Mh]}),r=th("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=_1(o.toString());dC(n,i,()=>i(n.currentUser)),uC(n,a=>i(a))}}const s=QS("auth");return s&&rC(n,`http://${s}`),n}function T1(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}QE({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=ar("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",T1().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});y1("Browser");const S1={apiKey:"AIzaSyAf0CIHBZ-wEQJ8CCUUWo1Wl9P7typ_ZPI",authDomain:"gptcall-416910.firebaseapp.com",projectId:"gptcall-416910",storageBucket:"gptcall-416910.appspot.com",messagingSenderId:"99275526699",appId:"1:99275526699:web:3b623e1e2996108b52106e"};function I1(e){const t=D(null),n=D(""),r=D(""),s=D(""),o=D({loggedIn:!1,githubUsername:"",repoOwner:"",repoName:"",configured:!1,startup:{inProgress:!1,mode:"idle",branch:"main",lastAction:"not-started",lastRunAtIso:"",lastSuccessAtIso:"",lastError:""}}),i=de(()=>s.value==="pull"),a=de(()=>s.value==="push"),l=de(()=>s.value!=="");async function f(){try{const $=await fetch("/codex-api/skills-sync/status");if(!$.ok)return;const Q=await $.json();Q.data&&(o.value=Q.data)}catch{}}async function u(){try{const $=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),Q=await $.json();if(!$.ok||!Q.data)throw new Error("Failed to start GitHub login");t.value=Q.data;const ae=30,q=Math.max((Q.data.interval??5)*1e3,3e3);let ee=!1;for(let te=0;te<ae;te++){await new Promise(ye=>setTimeout(ye,q));const Te=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:Q.data.device_code})}),ve=await Te.json();if(!Te.ok)throw new Error(ve.error||"Failed to complete GitHub login");if(ve.ok){ee=!0;break}if(!ve.pending)throw new Error(ve.error||"Failed to complete GitHub login")}if(!ee)throw new Error("GitHub login timed out. Please retry.");t.value=null,await f(),e.showToast("GitHub login successful")}catch($){e.showToast($ instanceof Error?$.message:"Failed GitHub login","error")}}async function g(){try{const $=fE().length>0?ah():ih(S1),Q=k1($),ae=new kr;ae.addScope("repo");const q=await PC(Q,ae),ee=kr.credentialFromResult(q),te=(ee==null?void 0:ee.accessToken)??"";if(!te)throw new Error("GitHub access token missing from Firebase login");const Te=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:te})}),ve=await Te.json();if(!Te.ok||!ve.ok)throw new Error(ve.error||"Failed to login with GitHub token");await f(),e.showToast("GitHub login successful")}catch($){const Q=$ instanceof Error?$.message:"Failed Firebase GitHub login";e.showToast(Q,"error")}}async function _(){r.value="",n.value="pull-started",s.value="pull";try{const $=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),Q=await $.json();if(!$.ok||!Q.ok)throw new Error(Q.error||"Failed to pull synced skills");await e.onPulled(),n.value="pull-success",e.showToast(o.value.loggedIn?"Pulled skills from private sync repo":"Pulled skills from upstream repo")}catch($){const Q=$ instanceof Error?$.message:"Failed to pull sync";r.value=Q,n.value="pull-failed",e.showToast(Q,"error")}finally{s.value=""}}async function I(){r.value="",n.value="push-started",s.value="push";try{const $=await fetch("/codex-api/skills-sync/push",{method:"POST"}),Q=await $.json();if(!$.ok||!Q.ok)throw new Error(Q.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch($){const Q=$ instanceof Error?$.message:"Failed to push sync";r.value=Q,n.value="push-failed",e.showToast(Q,"error")}finally{s.value=""}}async function F(){try{const $=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),Q=await $.json();if(!$.ok||!Q.ok)throw new Error(Q.error||"Failed to logout GitHub");await f(),e.showToast("Logged out from GitHub")}catch($){e.showToast($ instanceof Error?$.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:f,logoutGithub:F,pullSkillsSync:_,pushSkillsSync:I,startGithubFirebaseLogin:g,startGithubLogin:u,syncActionError:r,syncActionStatus:n,syncStatus:o}}const E1={class:"skills-hub"},C1={class:"skills-sync-panel"},A1={class:"skills-sync-header"},x1={key:0,class:"skills-sync-badge"},R1={key:1,class:"skills-sync-badge"},P1={key:2,class:"skills-sync-badge"},M1={class:"skills-sync-meta"},$1={key:0,class:"skills-sync-error"},O1={key:1,class:"skills-sync-meta"},N1={key:2,class:"skills-sync-error"},L1={key:3,class:"skills-sync-device"},D1=["href"],j1={class:"skills-sync-actions"},F1=["disabled"],B1=["disabled"],U1=["disabled"],H1={key:1,class:"skills-hub-section"},W1={class:"skills-hub-section-title"},V1={key:0,class:"skills-hub-grid"},z1={class:"skills-hub-toolbar"},q1={class:"skills-hub-search-wrap"},G1={key:0,class:"skills-hub-count"},K1={class:"skills-hub-section"},J1={key:0,class:"skills-hub-loading"},Y1={key:1,class:"skills-hub-error"},Q1={key:0,class:"skills-hub-grid"},X1={key:1,class:"skills-hub-empty"},oi="codex-web-local.skills-hub.cache.v1",Z1=cn({__name:"SkillsHub",emits:["skills-changed"],setup(e,{emit:t}){const n={name:"",owner:"",description:"",url:"",installed:!1},r=D(null),s=D(""),o=D("date"),i=D([]),a=D([]),l=D(0),f=D(!1),u=D(""),g=D(!0),_=D(!1),I=D(n),F=D(null),$=D(""),Q=D(!1),ae=D(!1);let q=null,ee=null;const te=t,Te=de(()=>o.value==="date"?"Newest":"A-Z"),ve=de(()=>{var N;return((N=F.value)==null?void 0:N.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),ye=de(()=>`${I.value.owner}/${I.value.name}`),Le=de(()=>Q.value&&$.value===ye.value),le=de(()=>ae.value&&$.value===ye.value),re=de(()=>{const N=s.value.toLowerCase().trim();return N?a.value.filter(B=>B.name.toLowerCase().includes(N)||B.owner.toLowerCase().includes(N)||(B.displayName??"").toLowerCase().includes(N)):a.value});function ce(N,B="success"){F.value={text:N,type:B},ee&&clearTimeout(ee),ee=setTimeout(()=>{F.value=null},3e3)}function ne(){o.value=o.value==="date"?"name":"date",Re(s.value)}function Pe(N){return`${o.value}::${N.trim().toLowerCase()}`}function Ye(N){var B;if(typeof window>"u")return null;try{const H=window.localStorage.getItem(oi);return H?((B=JSON.parse(H).byKey)==null?void 0:B[N])??null:null}catch{return null}}function Ge(N,B){if(!(typeof window>"u"))try{const H=window.localStorage.getItem(oi),Z=(H?JSON.parse(H):{}).byKey??{};Z[N]=B,window.localStorage.setItem(oi,JSON.stringify({byKey:Z}))}catch{}}function Ve(){if(!(typeof window>"u"))try{window.localStorage.removeItem(oi)}catch{}}function Ue(N){const B=N.installed??[];a.value=B;const H=new Set(B.map(X=>X.name));i.value=N.data.map(X=>{if(X.installed||H.has(X.name)){const Z=B.find(Ee=>Ee.name===X.name);return{...X,installed:!0,path:(Z==null?void 0:Z.path)??X.path,enabled:(Z==null?void 0:Z.enabled)??X.enabled}}return X}).filter(X=>!X.installed),l.value=N.total}async function Re(N){const B=Pe(N),H=Ye(B);H&&Ue(H),f.value=!H,u.value="";try{const X=new URLSearchParams;N.trim()&&X.set("q",N.trim()),X.set("limit","100"),X.set("sort",o.value);const Z=await fetch(`/codex-api/skills-hub?${X}`);if(!Z.ok)throw new Error(`HTTP ${Z.status}`);const Ee=await Z.json();Ue(Ee),Ge(B,Ee)}catch(X){u.value=X instanceof Error?X.message:"Failed to load skills"}finally{f.value=!1}}function rt(){q&&clearTimeout(q),q=setTimeout(()=>Re(s.value),300)}function Ae(N){I.value=N,_.value=!0}async function Be(N){$.value=`${N.owner}/${N.name}`,Q.value=!0;try{const H=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:N.owner,name:N.name})})).json();if(!H.ok)throw new Error(H.error||"Install failed");const X={...N,installed:!0,path:H.path,enabled:!0};a.value=[...a.value,X],i.value=i.value.filter(Z=>Z.name!==N.name),I.value=X,ce(`${N.displayName||N.name} skill installed`),_.value=!1,Ve(),te("skills-changed")}catch(B){ce(B instanceof Error?B.message:"Failed to install skill","error")}finally{Q.value=!1}}async function lt(N){$.value=`${N.owner}/${N.name}`,ae.value=!0;try{const H=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:N.name,path:N.path})})).json();if(!H.ok)throw new Error(H.error||"Uninstall failed");a.value=a.value.filter(X=>X.name!==N.name),N.owner!=="local"&&(i.value=[...i.value,{...N,installed:!1,path:void 0,enabled:void 0}]),ce(`${N.displayName||N.name} skill uninstalled`),_.value=!1,Ve(),te("skills-changed")}catch(B){ce(B instanceof Error?B.message:"Failed to uninstall skill","error")}finally{ae.value=!1}}async function Ht(N,B){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:N.path,enabled:B}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),ce(`${N.displayName||N.name} skill ${B?"enabled":"disabled"}`),await Re(s.value)}catch(H){ce(H instanceof Error?H.message:"Failed to update skill","error")}}const{deviceLogin:mt,isPullInFlight:ct,isPushInFlight:He,isSyncActionInFlight:V,loadSyncStatus:_e,logoutGithub:he,pullSkillsSync:ge,pushSkillsSync:Ce,startGithubFirebaseLogin:T,startGithubLogin:E,syncActionError:O,syncActionStatus:z,syncStatus:Y}=I1({showToast:ce,onPulled:async()=>{await Re(s.value),te("skills-changed")}});return Gr(()=>{Re(""),_e()}),(N,B)=>(y(),k("div",E1,[B[11]||(B[11]=v("div",{class:"skills-hub-header"},[v("h2",{class:"skills-hub-title"},"Skills Hub"),v("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),v("div",C1,[v("div",A1,[B[8]||(B[8]=v("strong",null,"Skills Sync (GitHub)",-1)),be(Y).configured?(y(),k("span",x1,"Connected: "+G(be(Y).repoOwner)+"/"+G(be(Y).repoName),1)):be(Y).loggedIn?(y(),k("span",R1,"Logged in as "+G(be(Y).githubUsername),1)):(y(),k("span",P1,"Not connected"))]),v("div",M1,[v("span",null,"Startup: "+G(be(Y).startup.mode),1),v("span",null,"Branch: "+G(be(Y).startup.branch),1),v("span",null,"Action: "+G(be(Y).startup.lastAction),1)]),be(Y).startup.lastError?(y(),k("div",$1,G(be(Y).startup.lastError),1)):fe("",!0),be(z)?(y(),k("div",O1,[v("span",null,"Manual sync: "+G(be(z)),1)])):fe("",!0),be(O)?(y(),k("div",N1,G(be(O)),1)):fe("",!0),be(mt)?(y(),k("div",L1,[v("span",null,[B[9]||(B[9]=Lo("Open ",-1)),v("a",{href:be(mt).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,D1),B[10]||(B[10]=Lo(" and enter code:",-1))]),v("code",null,G(be(mt).user_code),1)])):fe("",!0),v("div",j1,[be(Y).loggedIn?fe("",!0):(y(),k("button",{key:0,class:"skills-hub-sort",type:"button",onClick:B[0]||(B[0]=(...H)=>be(T)&&be(T)(...H))},"Login with GitHub")),be(Y).loggedIn?fe("",!0):(y(),k("button",{key:1,class:"skills-hub-sort",type:"button",onClick:B[1]||(B[1]=(...H)=>be(E)&&be(E)(...H))},"Device Login")),be(Y).loggedIn?(y(),k("button",{key:2,class:"skills-hub-sort",type:"button",onClick:B[2]||(B[2]=(...H)=>be(he)&&be(he)(...H)),disabled:be(V)},"Logout GitHub",8,F1)):fe("",!0),v("button",{class:"skills-hub-sort",type:"button",onClick:B[3]||(B[3]=(...H)=>be(ge)&&be(ge)(...H)),disabled:be(V)},G(be(ct)?"Pulling...":"Pull"),9,B1),be(Y).loggedIn?(y(),k("button",{key:3,class:"skills-hub-sort",type:"button",onClick:B[4]||(B[4]=(...H)=>be(Ce)&&be(Ce)(...H)),disabled:!be(Y).configured||be(V)},G(be(He)?"Pushing...":"Push"),9,U1)):fe("",!0)])]),F.value?(y(),k("div",{key:0,class:tt(["skills-hub-toast",ve.value])},G(F.value.text),3)):fe("",!0),re.value.length>0?(y(),k("div",H1,[v("button",{class:"skills-hub-section-toggle",type:"button",onClick:B[5]||(B[5]=H=>g.value=!g.value)},[v("span",W1,"Installed ("+G(re.value.length)+")",1),De(Uf,{class:tt(["skills-hub-section-chevron",{"is-open":g.value}])},null,8,["class"])]),g.value?(y(),k("div",V1,[(y(!0),k(Ne,null,vt(re.value,H=>(y(),wt(Au,{key:H.name,skill:H,onSelect:X=>Ae(X)},null,8,["skill","onSelect"]))),128))])):fe("",!0)])):fe("",!0),v("div",z1,[v("div",q1,[De(sl,{class:"skills-hub-search-icon"}),Hr(v("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":B[6]||(B[6]=H=>s.value=H),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:rt},null,544),[[Wr,s.value]]),l.value>0?(y(),k("span",G1,G(l.value)+" skills",1)):fe("",!0)]),v("button",{class:"skills-hub-sort",type:"button",onClick:ne},G(Te.value),1)]),v("div",K1,[f.value?(y(),k("div",J1,"Loading skills...")):u.value?(y(),k("div",Y1,G(u.value),1)):(y(),k(Ne,{key:2},[i.value.length>0?(y(),k("div",Q1,[(y(!0),k(Ne,null,vt(i.value,H=>(y(),wt(Au,{key:H.url,skill:H,onSelect:X=>Ae(X)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(y(),k("div",X1,'No skills found for "'+G(s.value)+'"',1)):fe("",!0)],64))]),De(HS,{skill:I.value,visible:_.value,"is-installing":Le.value,"is-uninstalling":le.value,onClose:B[7]||(B[7]=H=>_.value=!1),onInstall:Be,onUninstall:lt,onToggleEnabled:Ht},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),eA=yt(Z1,[["__scopeId","data-v-2f6920be"]]),tA={},nA={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 rA(e,t){return y(),k("svg",nA,[...t[0]||(t[0]=[v("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),v("path",{d:"M9 4l0 16"},null,-1)])])}const sA=yt(tA,[["render",rA]]),oA={},iA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function aA(e,t){return y(),k("svg",iA,[...t[0]||(t[0]=[v("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 lA=yt(oA,[["render",aA]]),cA={class:"sidebar-thread-controls"},uA=["aria-label","title"],dA=cn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(y(),k("div",cA,[v("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?"Expand sidebar":"Collapse sidebar",title:e.isSidebarCollapsed?"Expand sidebar":"Collapse sidebar",onClick:n[0]||(n[0]=r=>t.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(y(),wt(lA,{key:0,class:"sidebar-thread-controls-icon"})):(y(),wt(sA,{key:1,class:"sidebar-thread-controls-icon"}))],8,uA),Tr(t.$slots,"default",{},void 0),e.showNewThreadButton?(y(),k("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":"Start new thread",title:"Start new thread",onClick:n[1]||(n[1]=r=>t.$emit("start-new-thread"))},[De(Ci,{class:"sidebar-thread-controls-icon"})])):fe("",!0)]))}}),nd=yt(dA,[["__scopeId","data-v-46a10052"]]),fA={},hA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function pA(e,t){return y(),k("svg",hA,[...t[0]||(t[0]=[v("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[v("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"}),v("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const mA=yt(fA,[["render",pA]]);function os(e){return e.flatMap(t=>t.threads)}const Bh="codex-web-local.thread-read-state.v1",Uh="codex-web-local.thread-scroll-state.v1",hl="codex-web-local.selected-thread-id.v1",Hh="codex-web-local.project-order.v1",Wh="codex-web-local.project-display-name.v1",pl="codex-web-local.collaboration-mode-by-context.v1",Vh="codex-web-local.collaboration-mode.v1",zh="__new-thread__",Ra=220,rd=["none","minimal","low","medium","high","xhigh"],Bs="__global__",Qn="gpt-5.2-codex";function gA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Bh);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function sd(e){typeof window>"u"||window.localStorage.setItem(Bh,JSON.stringify(e))}function ml(e){return e==="plan"?"plan":"default"}function qh(e){return e.trim()||zh}function vA(){if(typeof window>"u")return{};try{const t=window.localStorage.getItem(pl);if(t){const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return{};const r={};for(const[s,o]of Object.entries(n)){if(typeof s!="string"||s.length===0)continue;const i=ml(o);i==="plan"&&(r[s]=i)}return r}}catch{}return ml(window.localStorage.getItem(Vh))==="plan"?{[zh]:"plan"}:{}}function Pa(e,t){const n=qh(t);return ml(e[n])}function yA(e){typeof window>"u"||(Object.keys(e).length===0?window.localStorage.removeItem(pl):window.localStorage.setItem(pl,JSON.stringify(e)),window.localStorage.removeItem(Vh))}function Gh(e,t,n){return Math.min(Math.max(e,t),n)}function wA(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(typeof t.scrollTop!="number"||!Number.isFinite(t.scrollTop)||typeof t.isAtBottom!="boolean")return null;const n={scrollTop:Math.max(0,t.scrollTop),isAtBottom:t.isAtBottom};return typeof t.scrollRatio=="number"&&Number.isFinite(t.scrollRatio)&&(n.scrollRatio=Gh(t.scrollRatio,0,1)),n}function bA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Uh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t)){if(!r)continue;const o=wA(s);o&&(n[r]=o)}return n}catch{return{}}}function od(e){typeof window>"u"||window.localStorage.setItem(Uh,JSON.stringify(e))}function _A(){return typeof window>"u"?"":window.localStorage.getItem(hl)??""}function kA(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(hl);return}window.localStorage.setItem(hl,e)}}function TA(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Hh);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t)typeof r=="string"&&r.length>0&&!n.includes(r)&&n.push(r);return n}catch{return[]}}function Us(e){typeof window>"u"||window.localStorage.setItem(Hh,JSON.stringify(e))}function SA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Wh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t))typeof r=="string"&&r.length>0&&typeof s=="string"&&(n[r]=s);return n}catch{return{}}}function Ma(e){typeof window>"u"||window.localStorage.setItem(Wh,JSON.stringify(e))}function ii(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 xs(e,n)?e:n}function $a(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??{projectName:s,threads:[]});for(const s of e)t.includes(s.projectName)||r.push(s);return r}function xs(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let s=0;s<n.length;s+=1)if(n[s]!==r[s])return!1;return!0}function IA(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[s]=r.splice(t,1);return r.splice(n,0,s),r}function EA(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function CA(e=[],t=[]){var n,r,s,o;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i+=1)if(((n=e[i])==null?void 0:n.step)!==((r=t[i])==null?void 0:r.step)||((s=e[i])==null?void 0:s.status)!==((o=t[i])==null?void 0:o.status))return!1;return!0}function AA(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&CA(e.steps,t.steps)}function ai(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")}function gl(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&xs(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&EA(e.commandExecution,t.commandExecution)&&AA(e.plan,t.plan)&&e.turnIndex===t.turnIndex}function xo(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 xA(e,t,n={}){const r=new Map(e.map(u=>[u.id,u])),s=new Map(t.map(u=>[u.id,u])),o=t.map(u=>{const g=r.get(u.id);return g&&gl(g,u)?g:u});if(n.preserveMissing!==!0)return xo(e,o)?e:o;const i=e.map(u=>{const g=s.get(u.id);return!g||gl(u,g)?u:g}),a=new Set(e.map(u=>u.id)),l=o.filter(u=>!a.has(u.id)),f=[...i,...l];return xo(e,f)?e:f}function vl(e){return e.replace(/\s+/gu," ").trim()}function RA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>vl(s.text)).filter(s=>s.length>0));if(n.size===0)return e;const r=e.filter(s=>{if(s.messageType!=="agentMessage.live")return!0;const o=vl(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function Oa(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(gl(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Kh="worked";function ns(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function PA(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),s=t%60,o=[];n>0&&o.push(`${n}h`),(r>0||n>0)&&o.push(`${r}m`);const i=s>0||o.length===0?s:0;return o.push(`${i}s`),o.join(" ")}function MA(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function $A(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 OA(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${PA(e.durationMs)}`,messageType:Kh}}function NA(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function LA(e,t){const n=OA(t),r=e.filter(i=>i.messageType!==Kh),s=NA(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function ln(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function DA(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[s,o]of Object.entries(e)){if(t.has(s)){n=!0;continue}r[s]=o}return n?r:e}function jA(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}function FA(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 BA(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 gn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function li(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>{const o=n.get(s.projectName),i=new Map((o==null?void 0:o.threads.map(l=>[l.id,l]))??[]),a=s.threads.map(l=>{const f=i.get(l.id);return f&&jA(f,l)?f:l});return o&&o.projectName===s.projectName&&FA(o.threads,a)?o:{projectName:s.projectName,threads:a}});return BA(e,r)?e:r}function UA(e,t,n){const r=new Set(os(t).map(a=>a.id)),s=os(e).filter(a=>n[a.id]===!0&&!r.has(a.id));if(s.length===0)return t;const o=new Map(t.map(a=>[a.projectName,a])),i=t.map(a=>({projectName:a.projectName,threads:[...a.threads]}));for(const a of s){if(o.get(a.projectName)){const f=i.findIndex(u=>u.projectName===a.projectName);f>=0&&(i[f]={projectName:i[f].projectName,threads:[a,...i[f].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function HA(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Hs(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function WA(e){const t=e.split(`
|
|
1447
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function VA(){const e=D([]),t=D([]),n=D(_A()),r=D({}),s=D({}),o=D({}),i=D({}),a=D({}),l=D({}),f=D({}),u=D({}),g=D([]),_=D([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),I=D(vA()),F=D(Pa(I.value,n.value)),$=D(""),Q=D("medium"),ae=D(gA()),q=D(bA()),ee=D(TA()),te=D(SA()),Te=D({}),ve=D({}),ye=D({}),Le=D({}),le=D({}),re=D({}),ce=D({}),ne=D({}),Pe=D({}),Ye=D(null),Ge=D({}),Ve=D([]),Ue=D(!1),Re=D(!1),rt=D(!1),Ae=D(!1),Be=D(""),lt=D(!1),Ht=D(!1);let mt=null,ct=null,He=!1;const V=new Set;let _e=!1,he=!1;const ge=new Map,Ce=new Set,T=de(()=>os(e.value)),E=de(()=>T.value.find(c=>c.id===n.value)??null),O=de(()=>q.value[n.value]??null),z=de(()=>{const c=[],p=n.value;return p&&Array.isArray(ne.value[p])&&c.push(...ne.value[p]),Array.isArray(ne.value[Bs])&&c.push(...ne.value[Bs]),c.sort((w,C)=>w.receivedAtIso.localeCompare(C.receivedAtIso))}),Y=de(()=>{var K;const c=n.value;if(!c)return null;const p=le.value[c],w=(i.value[c]??"").trim(),C=(((K=re.value[c])==null?void 0:K.message)??"").trim();return!p&&!w&&!C?null:{activityLabel:(p==null?void 0:p.label)||"Thinking",activityDetails:(p==null?void 0:p.details)??[],reasoningText:w,errorText:C}}),N=de(()=>Ye.value),B=de(()=>{const c=n.value;if(!c)return[];const p=r.value[c]??[],w=s.value[c]??[],C=o.value[c]??[],K=a.value[c]??[],oe=[...p,...w,...K,...C],ue=Le.value[c];return ue?LA(oe,ue):oe});function H(c){n.value!==c&&(n.value=c,kA(c),F.value=Pa(I.value,c),he=!1)}function X(c){$.value=c.trim()}function Z(c){const p=c==="plan"?"plan":"default",w=qh(n.value);Pa(I.value,n.value)===p&&F.value===p||(F.value=p,I.value=p==="plan"?{...I.value,[w]:p}:ln(I.value,w),yA(I.value))}function Ee(c){Ye.value=c}async function we(){$.value=Qn,g.value.includes(Qn)||(g.value=[...g.value,Qn]);try{await i0(Qn)}catch{}}function ke(c,p){Pe.value={...Pe.value,[c]:p}}function xe(c){Pe.value[c]&&(Pe.value=ln(Pe.value,c))}async function ze(c){if(Ce.has(c))return;const p=Pe.value[c];if(!(!p||p.fallbackRetried)){Ce.add(c),ke(c,{...p,fallbackRetried:!0});try{await we();try{const w=await t0(c,1);$n(c,w),dn(c),Mt(c,[]),Bn(c),a.value[c]&&(a.value=ln(a.value,c))}catch{}Rt(c,null),Be.value="",_t(c,null),xt(c,{label:"Thinking",details:pt(Qn,p.effort,p.collaborationMode)}),gt(c,!0),ye.value[c]!==!0&&await ba(c),await _a(c,p.text,p.imageUrls,Qn,p.effort||void 0,p.skills.length>0?p.skills:void 0,p.fileAttachments,p.collaborationMode),ye.value={...ye.value,[c]:!0},V.add(c),He=!0,await A()}catch(w){const C=w instanceof Error?w.message:"Unknown application error";Rt(c,C),Be.value=C,gt(c,!1),xt(c,null)}finally{Ce.delete(c)}}}function it(c){c&&!rd.includes(c)||(Q.value=c)}async function We(){try{const c=await l0();_.value=c,c.some(p=>p.value===F.value)||Z("default")}catch{}}function pt(c,p,w=F.value){const C=c.trim()||"default",K=p||"default";return[`Mode: ${w==="plan"?"Plan":"Default"}`,`Model: ${C}`,`Thinking: ${K}`]}async function bt(){try{const[c,p]=await Promise.all([Kf(),Jf()]);g.value=c,$.value.length>0&&c.includes($.value)||(p.model&&c.includes(p.model)?$.value=p.model:c.length>0?$.value=c[0]:$.value=""),p.reasoningEffort&&rd.includes(p.reasoningEffort)&&(Q.value=p.reasoningEffort)}catch{}}function Pt(c){const p=Ge.value;return Object.keys(p).length===0?c:c.map(w=>({projectName:w.projectName,threads:w.threads.map(C=>{const K=p[C.id];return K?{...C,title:K}:C})}))}function Ke(){const p=Pt(t.value).map(w=>({projectName:w.projectName,threads:w.threads.map(C=>{const K=l.value[C.id]===!0,oe=n.value===C.id,ue=ae.value[C.id],Ie=u.value[C.id]===!0,me=!oe&&!K&&(Ie||ue!==C.updatedAtIso);return{...C,inProgress:K,unread:me}})}));e.value=li(e.value,p)}function Bt(c,p,w){const C=new Date().toISOString(),K=p.trim(),oe=HA(K),ue={id:c,title:WA(w),projectName:oe,cwd:K,hasWorktree:K.includes("/.codex/worktrees/")||K.includes("/.git/worktrees/"),createdAtIso:C,updatedAtIso:C,preview:w,unread:!1,inProgress:!1},Ie=t.value.findIndex(st=>st.projectName===oe);if(Ie>=0){const jt=t.value[Ie].threads.filter(pr=>pr.id!==c),Xt={projectName:oe,threads:[ue,...jt]},zn=[...t.value];zn.splice(Ie,1,Xt),t.value=zn}else t.value=[{projectName:oe,threads:[ue]},...t.value];const me=ii(ee.value,t.value);xs(ee.value,me)||(ee.value=me,Us(ee.value)),Ke()}function zt(c){const p=new Set(c.map(oe=>oe.id)),w=gn(ae.value,p);w!==ae.value&&(ae.value=w,sd(w));const C=gn(q.value,p);C!==q.value&&(q.value=C,od(C)),ve.value=gn(ve.value,p),Te.value=gn(Te.value,p),ye.value=gn(ye.value,p),r.value=gn(r.value,p),o.value=gn(o.value,p),i.value=gn(i.value,p),a.value=gn(a.value,p),Le.value=gn(Le.value,p),le.value=gn(le.value,p),re.value=gn(re.value,p),ce.value=gn(ce.value,p),u.value=gn(u.value,p),l.value=gn(l.value,p);const K={};for(const[oe,ue]of Object.entries(ne.value))(oe===Bs||p.has(oe))&&(K[oe]=ue);ne.value=K}function dt(c){const p=os(t.value).find(w=>w.id===c);p&&(ae.value={...ae.value,[c]:p.updatedAtIso},sd(ae.value),u.value[c]&&(u.value=ln(u.value,c)),Ke())}function _t(c,p){if(!c)return;const w=Le.value[c];if(p){if(MA(w,p))return;Le.value={...Le.value,[c]:p}}else w&&(Le.value=ln(Le.value,c))}function gt(c,p){!c||l.value[c]===!0===p||(p?l.value={...l.value,[c]:!0}:l.value=ln(l.value,c),Ke())}function nn(c){c&&c!==n.value&&u.value[c]!==!0&&(u.value={...u.value,[c]:!0},Ke())}function xt(c,p){if(!c)return;const w=le.value[c];if(!p){w&&(le.value=ln(le.value,c));return}const C=sn(p.label)||"Thinking",K=p.details.map(Ie=>sn(Ie)).filter(Ie=>Ie.length>0&&Ie!==C),oe=Array.from(new Set([...(w==null?void 0:w.details)??[],...K])).slice(-3),ue={label:C,details:oe};$A(w,ue)||(le.value={...le.value,[c]:ue})}function Rt(c,p){if(!c)return;const w=re.value[c],C=p?vl(p):"";if(!C){w&&(re.value=ln(re.value,c));return}(w==null?void 0:w.message)!==C&&(re.value={...re.value,[c]:{message:C}})}function Mn(c){const p=os(t.value).find(w=>w.id===c);return(p==null?void 0:p.updatedAtIso)??""}function Wt(c,p){if(!c)return;const w={scrollTop:Math.max(0,p.scrollTop),isAtBottom:p.isAtBottom===!0};typeof p.scrollRatio=="number"&&Number.isFinite(p.scrollRatio)&&(w.scrollRatio=Gh(p.scrollRatio,0,1));const C=q.value[c];C&&C.scrollTop===w.scrollTop&&C.isAtBottom===w.isAtBottom&&C.scrollRatio===w.scrollRatio||(q.value={...q.value,[c]:w},od(q.value))}function $n(c,p){const w=r.value[c]??[];xo(w,p)||(r.value={...r.value,[c]:p})}function Mt(c,p){const w=o.value[c]??[];xo(w,p)||(o.value={...o.value,[c]:p})}function Kt(c,p){const w=s.value[c]??[];xo(w,p)||(s.value={...s.value,[c]:p})}function Dt(c,p){const w=s.value[c]??[],C=Oa(w,p);Kt(c,C)}function rn(c,p){const w=o.value[c]??[],C=Oa(w,p);Mt(c,C)}function Tn(c,p){if(!c)return;const w=p.trim(),C=i.value[c]??"";if(w.length===0){if(!C)return;i.value=ln(i.value,c);return}C!==w&&(i.value={...i.value,[c]:w})}function un(c,p){if(!c)return;const w=i.value[c]??"";Tn(c,`${w}${p}`)}function Bn(c){c&&c in i.value&&(i.value=ln(i.value,c))}function dn(c){c&&c in s.value&&(s.value=ln(s.value,c))}function Un(c){return c==="completed"?"completed":c==="inProgress"||c==="in_progress"?"inProgress":"pending"}function Gn(c){var w;const p=[];(w=c.explanation)!=null&&w.trim()&&p.push(c.explanation.trim());for(const C of c.steps){const K=C.status==="completed"?"x":C.status==="inProgress"?"~":" ";p.push(`- [${K}] ${C.step}`)}return p.join(`
|
|
1448
|
+
`).trim()}function er(c){if(c.method!=="turn/plan/updated")return null;const p=Me(c.params),w=Yt(c),C=$e(p==null?void 0:p.turnId)||$e(p==null?void 0:p.turn_id),oe=(Array.isArray(p==null?void 0:p.plan)?p==null?void 0:p.plan:[]).map(me=>Me(me)).map(me=>({step:$e(me==null?void 0:me.step),status:Un(me==null?void 0:me.status)})).filter(me=>me.step.length>0);if(!w||!C)return null;const Ie={explanation:$e(p==null?void 0:p.explanation).trim()||void 0,steps:oe,isStreaming:!0};return{threadId:w,message:{id:`${C}:plan`,role:"assistant",text:Gn(Ie),messageType:"plan.live",plan:Ie}}}function Hn(c){if(c.method!=="item/plan/delta")return null;const p=Me(c.params),w=Yt(c),C=$e(p==null?void 0:p.turnId)||$e(p==null?void 0:p.turn_id),K=$e(p==null?void 0:p.delta);if(!w||!C||!K)return null;const oe=`${C}:plan`,ue=(s.value[w]??[]).find(st=>st.id===oe),Ie=`${(ue==null?void 0:ue.text)??""}${K}`,me=ue!=null&&ue.plan?{...ue.plan,isStreaming:!0}:void 0;return{threadId:w,message:{id:oe,role:"assistant",text:Ie,messageType:"plan.live",plan:me}}}function Me(c){return c!==null&&typeof c=="object"&&!Array.isArray(c)?c:null}function $e(c){return typeof c=="string"?c:""}function On(c){return typeof c=="number"&&Number.isFinite(c)?c:null}function Yt(c){const p=Me(c.params);if(!p)return"";const w=$e(p.threadId);if(w)return w;const C=$e(p.thread_id);if(C)return C;const K=$e(p.conversationId);if(K)return K;const oe=$e(p.conversation_id);if(oe)return oe;const ue=Me(p.thread),Ie=$e(ue==null?void 0:ue.id);if(Ie)return Ie;const me=Me(p.turn),st=$e(me==null?void 0:me.threadId);if(st)return st;const jt=$e(me==null?void 0:me.thread_id);return jt||""}function Wn(c){if(c.method!=="turn/completed")return"";const p=Me(c.params),w=Me(p==null?void 0:p.turn);if(!w||w.status!=="failed")return"";const C=Me(w.error);return $e(C==null?void 0:C.message)}function Nn(c){var w;if(c.method!=="error")return"";const p=Me(c.params);return $e(p==null?void 0:p.message)||$e((w=Me(p==null?void 0:p.error))==null?void 0:w.message)}function mn(c){const p=Me(c);if(!p)return null;const w=p.id,C=$e(p.method),K=p.params;if(typeof w!="number"||!Number.isInteger(w)||!C)return null;const oe=Me(K),ue=$e(oe==null?void 0:oe.threadId)||Bs,Ie=$e(oe==null?void 0:oe.turnId),me=$e(oe==null?void 0:oe.itemId),st=$e(p.receivedAtIso)||new Date().toISOString();return{id:w,method:C,threadId:ue,turnId:Ie,itemId:me,receivedAtIso:st,params:K??null}}function tr(c){if(c.method!=="item/tool/requestUserInput")return[];const p=Me(c.params),w=Array.isArray(p==null?void 0:p.questions)?p.questions:[],C=[];for(const K of w){const oe=Me(K),ue=$e(oe==null?void 0:oe.id).trim();ue&&C.push(ue)}return C}function Kn(c){const p=c.threadId||Bs,w=ne.value[p]??[],C=w.findIndex(oe=>oe.id===c.id),K=[...w];C>=0?K.splice(C,1,c):K.push(c),ne.value={...ne.value,[p]:K.sort((oe,ue)=>oe.receivedAtIso.localeCompare(ue.receivedAtIso))}}function Ut(c){const p={};for(const[w,C]of Object.entries(ne.value)){const K=C.filter(oe=>oe.id!==c);K.length>0&&(p[w]=K)}ne.value=p}function fn(c){const p={};for(const w of c){const C=w.threadId||Bs,K=p[C]??[];K.push(w),p[C]=K}for(const w of Object.values(p))w.sort((C,K)=>C.receivedAtIso.localeCompare(K.receivedAtIso));ne.value=p}function nr(c){if(c.method==="server/request"){const p=mn(c.params);return p&&Kn(p),!0}if(c.method==="server/request/resolved"){const p=Me(c.params),w=p==null?void 0:p.id;return typeof w=="number"&&Number.isInteger(w)&&Ut(w),!0}return!1}function sn(c){return c.replace(/\s+/gu," ").trim()}function x(c){const p=Yt(c);if(!p)return null;if(c.method==="turn/started")return{threadId:p,activity:{label:"Thinking",details:[]}};if(c.method==="item/started"){const w=Me(c.params),C=Me(w==null?void 0:w.item),K=$e(C==null?void 0:C.type).toLowerCase();if(K==="reasoning")return{threadId:p,activity:{label:"Thinking",details:[]}};if(K==="agentmessage")return{threadId:p,activity:{label:"Writing response",details:[]}};if(K==="commandexecution"){const oe=$e(C==null?void 0:C.command);return{threadId:p,activity:{label:"Running command",details:oe?[oe]:[]}}}}return c.method==="item/commandExecution/outputDelta"?{threadId:p,activity:{label:"Running command",details:[]}}:c.method==="item/reasoning/summaryTextDelta"||c.method==="item/reasoning/summaryPartAdded"?{threadId:p,activity:{label:"Thinking",details:[]}}:c.method==="item/agentMessage/delta"?{threadId:p,activity:{label:"Writing response",details:[]}}:null}function U(c){if(c.method!=="turn/started")return null;const p=Me(c.params);if(!p)return null;const w=Yt(c);if(!w)return null;const C=Me(p.turn),K=$e(C==null?void 0:C.id)||$e(p.turnId)||`${w}:unknown`;if(!K)return null;const oe=ns($e(C==null?void 0:C.startedAt))??ns($e(p.startedAt))??ns(c.atIso)??Date.now();return{threadId:w,turnId:K,startedAtMs:oe}}function se(c){if(c.method!=="turn/completed")return null;const p=Me(c.params);if(!p)return null;const w=Yt(c);if(!w)return null;const C=Me(p.turn),K=$e(C==null?void 0:C.id)||$e(p.turnId)||`${w}:unknown`;if(!K)return null;const oe=ns($e(C==null?void 0:C.completedAt))??ns($e(p.completedAt))??ns(c.atIso)??Date.now(),ue=ns($e(C==null?void 0:C.startedAt))??ns($e(p.startedAt))??void 0;return{threadId:w,turnId:K,completedAtMs:oe,startedAtMs:ue}}function je(c){return`${c}:live-reasoning`}function ot(c){const p=Me(c.params);if(!p)return"";if(c.method==="item/started"){const w=Me(p.item);return!w||w.type!=="reasoning"?"":$e(w.id)}return""}function ut(c){const p=Me(c.params);if(!p)return null;if(c.method==="item/reasoning/summaryTextDelta"){const w=$e(p.itemId),C=$e(p.delta);return!w||!C?null:{messageId:je(w),delta:C}}return null}function ft(c){const p=Me(c.params);if(!p)return"";if(c.method==="item/reasoning/summaryPartAdded"){const w=$e(p.itemId);return w?je(w):""}return""}function Ot(c){const p=Me(c.params);if(!p)return"";if(c.method==="item/completed"){const w=Me(p.item);return!w||w.type!=="reasoning"?"":je($e(w.id))}return""}function Sn(c){const p=Me(c.params);if(!p)return"";if(c.method==="item/started"){const w=Me(p.item);return!w||w.type!=="agentMessage"?"":$e(w.id)}return""}function Vn(c){const p=Me(c.params);if(!p)return null;if(c.method==="item/agentMessage/delta"){const w=$e(p.itemId),C=$e(p.delta);return!w||!C?null:{messageId:w,delta:C}}return null}function Jr(c){const p=Me(c.params);if(!p)return null;if(c.method==="item/completed"){const w=Me(p.item);if(!w||w.type!=="agentMessage")return null;const C=$e(w.id),K=$e(w.text);return!C||!K?null:{id:C,role:"assistant",text:K,messageType:"agentMessage.live"}}return null}function ms(c){if(c.method!=="item/started")return null;const p=Me(c.params),w=Me(p==null?void 0:p.item);if(!w||w.type!=="commandExecution")return null;const C=$e(w.id),K=$e(w.command);if(!C)return null;const oe=typeof w.cwd=="string"?w.cwd:null;return{id:C,role:"system",text:K,messageType:"commandExecution",commandExecution:{command:K,cwd:oe,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function Yr(c){if(c.method!=="item/commandExecution/outputDelta")return null;const p=Me(c.params);if(!p)return null;const w=$e(p.itemId),C=$e(p.delta);return!w||!C?null:{itemId:w,delta:C}}function Ln(c){if(c.method!=="item/completed")return null;const p=Me(c.params),w=Me(p==null?void 0:p.item);if(!w||w.type!=="commandExecution")return null;const C=$e(w.id),K=$e(w.command);if(!C)return null;const oe=typeof w.cwd=="string"?w.cwd:null,ue=$e(w.status),Ie=ue==="failed"?"failed":ue==="declined"?"declined":ue==="interrupted"?"interrupted":"completed",me=typeof w.aggregatedOutput=="string"?w.aggregatedOutput:"",st=typeof w.exitCode=="number"?w.exitCode:null;return{id:C,role:"system",text:K,messageType:"commandExecution",commandExecution:{command:K,cwd:oe,status:Ie,aggregatedOutput:me,exitCode:st}}}function Jn(c,p){const w=a.value[c]??[],C=Oa(w,p);C!==w&&(a.value={...a.value,[c]:C})}function Qr(c,p){const w=a.value[c];if(!w||w.length===0)return;const C=new Set(p.map(oe=>oe.id)),K=w.filter(oe=>!C.has(oe.id));K.length!==w.length&&(K.length===0?a.value=ln(a.value,c):a.value={...a.value,[c]:K})}function gs(c){if(c.method==="item/agentMessage/delta")return!0;const p=Me(c.params);if(!p)return!1;if(c.method==="item/completed"){const w=Me(p.item);return(w==null?void 0:w.type)==="agentMessage"}return!1}function vs(c){var ie,qe,at,Je,Qt;if(nr(c))return;if(c.method==="thread/name/updated"){const Ze=Me(c.params),jn=$e(Ze==null?void 0:Ze.threadId),bs=$e(Ze==null?void 0:Ze.threadName);jn&&bs&&(Ge.value={...Ge.value,[jn]:bs},Ke(),ka(jn,bs))}if(c.method==="account/rateLimits/updated"){Ee(Gf(c.params));return}const p=x(c);p&&xt(p.threadId,p.activity);const w=U(c);w&&(ge.set(w.turnId,w),ce.value={...ce.value,[w.threadId]:w.turnId},dn(w.threadId),_t(w.threadId,null),Rt(w.threadId,null),gt(w.threadId,!0),u.value[w.threadId]&&(u.value=ln(u.value,w.threadId)));const C=se(c),K=Wn(c),ue=!!((C==null?void 0:C.threadId)??Yt(c))&&!!K&&$.value!==Qn&&ai(new Error(K));if(C){const Ze=ge.get(C.turnId);Ze&&ge.delete(C.turnId);const jn=On((ie=Me(c.params))==null?void 0:ie.durationMs)??On((at=Me((qe=Me(c.params))==null?void 0:qe.turn))==null?void 0:at.durationMs)??(typeof C.startedAtMs=="number"?C.completedAtMs-C.startedAtMs:null)??(Ze?C.completedAtMs-Ze.startedAtMs:null),bs=typeof jn=="number"?Math.max(0,jn):0;_t(C.threadId,{turnId:C.turnId,durationMs:bs}),ce.value[C.threadId]&&(ce.value=ln(ce.value,C.threadId)),gt(C.threadId,!1),xt(C.threadId,null),nn(C.threadId),ue||(xe(C.threadId),hr(C.threadId))}if(K){const Ze=(C==null?void 0:C.threadId)||Yt(c);Ze&&Rt(Ze,K),Be.value=K,Ze&&ue&&ze(Ze)}else C&&Rt(C.threadId,null);const Ie=Nn(c);if(Ie){const Ze=Yt(c);Ze&&Rt(Ze,Ie),Be.value=Ie,$.value!==Qn&&ai(new Error(Ie))&&(Ze?ze(Ze):we())}const me=Yt(c),st=er(c);st&&(Dt(st.threadId,st.message),xt(st.threadId,{label:"Planning",details:((Je=st.message.plan)==null?void 0:Je.steps.map(Ze=>Ze.step).slice(0,2))??[]}));const jt=Hn(c);if(jt&&(Dt(jt.threadId,jt.message),xt(jt.threadId,{label:"Planning",details:[]})),!me||me!==n.value)return;Sn(c);const Xt=Vn(c);if(Xt){const Ze=(o.value[me]??[]).find(bs=>bs.id===Xt.messageId),jn=`${(Ze==null?void 0:Ze.text)??""}${Xt.delta}`;rn(me,{id:Xt.messageId,role:"assistant",text:jn,messageType:"agentMessage.live"})}const zn=Jr(c);zn&&rn(me,zn),ot(c);const pr=ut(c);if(pr&&un(me,pr.delta),ft(c)){const Ze=i.value[me]??"";Ze.trim().length>0&&!Ze.endsWith(`
|
|
1449
|
+
|
|
1450
|
+
`)&&Tn(me,`${Ze}
|
|
1451
|
+
|
|
1452
|
+
`)}Ot(c);const uo=ms(c);uo&&(Jn(me,uo),xt(me,{label:"Running command",details:[((Qt=uo.commandExecution)==null?void 0:Qt.command)??""]}));const b=Yr(c);if(b){const Ze=(a.value[me]??[]).find(jn=>jn.id===b.itemId);Ze!=null&&Ze.commandExecution&&Jn(me,{...Ze,commandExecution:{...Ze.commandExecution,aggregatedOutput:`${Ze.commandExecution.aggregatedOutput}${b.delta}`}})}const j=Ln(c);if(j&&Jn(me,j),gs(c)&&(he&&n.value&&Wt(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),Bn(me)),c.method==="turn/completed"){he=!1,Bn(me),a.value[me]&&(a.value=ln(a.value,me));const Ze=Yt(c);Ze&&(gt(Ze,!1),xt(Ze,null),nn(Ze),ue||(xe(Ze),hr(Ze)))}}function Cr(c){const p=Yt(c);p&&V.add(p);const w=c.method;(w.startsWith("thread/")||w.startsWith("turn/")||w.startsWith("item/"))&&(He=!0),!(ct!==null||typeof window>"u")&&(ct=window.setTimeout(()=>{ct=null,A()},Ra))}async function ys(c){if(!_e){_e=!0;try{const p=await yo(),w=[];for(const C of p.order){const K=Hs(C);w.includes(K)||w.push(K)}if(w.length>0){const C=ii(w,c);xs(ee.value,C)||(ee.value=C,Us(ee.value))}if(Object.keys(p.labels).length>0){const C={...te.value};let K=!1;for(const[oe,ue]of Object.entries(p.labels)){const Ie=Hs(oe);C[Ie]!==ue&&(C[Ie]=ue,K=!0)}K&&(te.value=C,Ma(C))}}catch{}}}async function S(){if(!(Object.keys(Ge.value).length>0))try{const c=await p0();Object.keys(c.titles).length>0&&(Ge.value=c.titles)}catch{}}async function R(c,p,w){if(Ge.value[c])return;const C=p.trim();if(!C)return;const K=C.length>300?C.slice(0,300):C;try{const oe=await m0(K,w);if(!oe||Ge.value[c])return;Ge.value={...Ge.value,[c]:oe},Ke(),ka(c,oe)}catch{}}async function P(){var c;Ht.value||(Ue.value=!0);try{const[p]=await Promise.all([Wk(),S()]);await ys(p);const w=ii(ee.value,p);xs(ee.value,w)||(ee.value=w,Us(ee.value));const C=$a(p,ee.value),K=UA(t.value,C,l.value);t.value=li(t.value,K),l.value=gn(l.value,new Set(os(t.value).map(Ie=>Ie.id))),Ke(),Ht.value=!0;const oe=os(e.value);zt(oe),oe.some(Ie=>Ie.id===n.value)||H(((c=oe[0])==null?void 0:c.id)??"")}finally{Ue.value=!1}}async function J(c,p={}){if(!c)return;const w=ve.value[c]===!0,C=p.silent!==!0&&!w;C&&(Re.value=!0);try{ye.value[c]!==!0&&(await ba(c),ye.value={...ye.value,[c]:!0});const{messages:K,inProgress:oe}=await Vk(c),ue=r.value[c]??[],Ie=xA(ue,K,{preserveMissing:p.silent===!0});$n(c,Ie);const me=o.value[c]??[],st=RA(me,K);Mt(c,st),Qr(c,K),ve.value={...ve.value,[c]:!0};const jt=Mn(c);jt&&(Te.value={...Te.value,[c]:jt}),gt(c,oe),oe||dn(c),dt(c)}finally{C&&(Re.value=!1)}}async function Fe(c,p={}){c&&ve.value[c]!==!0&&await J(c,p)}async function St(){try{const c=t.value.flatMap(p=>p.threads.map(w=>w.cwd)).filter(Boolean);Ve.value=await g0(c.length>0?[...new Set(c)]:void 0)}catch{}}async function qt(){try{Ee(await Kk())}catch{}}async function In(c={}){Be.value="";const p=c.includeSelectedThreadMessages!==!1,w=c.awaitAncillaryRefreshes===!0;try{await P();const C=Promise.allSettled([bt(),We(),St(),qt()]).then(()=>{});p&&await J(n.value),w&&await C}catch(C){Be.value=C instanceof Error?C.message:"Unknown application error"}}async function on(c){H(c);try{await J(c)}catch(p){Be.value=p instanceof Error?p.message:"Unknown application error"}}async function an(c){try{await Zk(c),await P(),n.value===c&&await J(n.value)}catch(p){Be.value=p instanceof Error?p.message:"Unknown application error"}}async function Dn(c,p){const w=p.trim();if(!(!c||!w))try{await e0(c,w),Ge.value={...Ge.value,[c]:w},Ke(),ka(c,w)}catch(C){Be.value=C instanceof Error?C.message:"Unknown application error"}}async function fr(c,p,w=[],C=[],K=[]){if(!c||!p.trim()||w.length>0||C.length>0||K.length>0)return!1;const ue=(ne.value[c]??[]).filter(st=>st.method==="item/tool/requestUserInput");if(ue.length!==1)return!1;const[Ie]=ue,me=tr(Ie);return me.length!==1?!1:W({id:Ie.id,result:{answers:{[me[0]]:{answers:[p.trim()]}}}})}async function rr(c,p=[],w=[],C="steer",K=[]){const oe=n.value,ue=c.trim();if(!oe||!ue&&p.length===0&&K.length===0||await fr(oe,ue,p,w,K))return;const Ie=l.value[oe]===!0;if(Ie&&C==="queue"){const me=f.value[oe]??[],st=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;f.value={...f.value,[oe]:[...me,{id:st,text:ue,imageUrls:p,skills:w,fileAttachments:K,collaborationMode:F.value}]};return}if(Ie){he=!0,Xr(oe,ue,p,w,K).catch(me=>{const st=me instanceof Error?me.message:"Unknown application error";Rt(oe,st),Be.value=st});return}Be.value="",he=!0,_t(oe,null),xt(oe,{label:"Thinking",details:pt($.value,Q.value,F.value)}),Rt(oe,null),gt(oe,!0);try{await Xr(oe,ue,p,w,K)}catch(me){he=!1,gt(oe,!1),xt(oe,null);const st=me instanceof Error?me.message:"Unknown application error";throw Rt(oe,st),Be.value=st,me}}async function js(c,p,w=[],C=[],K=[]){const oe=c.trim(),ue=p.trim(),Ie=$.value.trim();if(!oe&&w.length===0&&K.length===0)return"";rt.value=!0,Be.value="";let me="";try{try{me=await _u(ue||void 0,Ie||void 0)}catch(zn){if(Ie&&Ie!==Qn&&ai(zn))await we(),me=await _u(ue||void 0,Qn);else throw zn}if(!me)return"";Bt(me,ue,oe||"[Image]"),ye.value={...ye.value,[me]:!0},H(me),he=!0,_t(me,null),xt(me,{label:"Thinking",details:pt($.value,Q.value,F.value)}),Rt(me,null),gt(me,!0);const st=me,jt=ue||null,Xt=oe;return Xr(me,oe,w,C,K).catch(zn=>{he=!1,gt(me,!1),xt(me,null);const pr=zn instanceof Error?zn.message:"Unknown application error";Rt(me,pr),Be.value=pr}).finally(()=>{rt.value=!1}),R(st,Xt,jt),me}catch(st){he=!1,me&&(gt(me,!1),xt(me,null));const jt=st instanceof Error?st.message:"Unknown application error";throw me&&Rt(me,jt),Be.value=jt,rt.value=!1,st}}async function Xr(c,p,w=[],C=[],K=[]){const oe=$.value.trim(),ue=Q.value,Ie=F.value,me=p.trim(),st=C.map(Xt=>({name:Xt.name,path:Xt.path})),jt=K.map(Xt=>({...Xt}));ke(c,{text:me,imageUrls:[...w],skills:st,fileAttachments:jt,effort:ue,collaborationMode:Ie,fallbackRetried:!1});try{ye.value[c]!==!0&&await ba(c);try{await _a(c,p,w,oe||void 0,ue||void 0,C.length>0?C:void 0,K,Ie)}catch(Xt){if(oe&&oe!==Qn&&ai(Xt))await we(),ke(c,{text:me,imageUrls:[...w],skills:st,fileAttachments:jt,effort:ue,collaborationMode:Ie,fallbackRetried:!0}),await _a(c,p,w,Qn,ue||void 0,C.length>0?C:void 0,K,Ie);else throw Xt}ye.value={...ye.value,[c]:!0},V.add(c),He=!0,await A()}catch(Xt){throw Xt}}async function hr(c){const p=f.value[c];if(!p||p.length===0)return;const[w,...C]=p;f.value=C.length>0?{...f.value,[c]:C}:ln(f.value,c),rt.value=!0,Be.value="",he=!0,_t(c,null),xt(c,{label:"Thinking",details:pt($.value,Q.value,w.collaborationMode)}),Rt(c,null),gt(c,!0);try{Z(w.collaborationMode),await Xr(c,w.text,w.imageUrls,w.skills,w.fileAttachments)}catch{gt(c,!1),xt(c,null)}finally{rt.value=!1}}async function ws(){const c=n.value;if(!c||l.value[c]!==!0)return;const p=ce.value[c];Ae.value=!0,Be.value="";try{await o0(c,p),gt(c,!1),xt(c,null),Rt(c,null),ce.value[c]&&(ce.value=ln(ce.value,c)),V.add(c),He=!0,await A()}catch(w){const C=w instanceof Error?w.message:"Failed to interrupt active turn";Rt(c,C),Be.value=C}finally{Ae.value=!1}}function co(c,p){c.length===0||(te.value[c]??"")===p||(te.value={...te.value,[c]:p},Ma(te.value))}async function Ar(c){var oe;if(c.length===0)return;const p=ee.value.filter(ue=>ue!==c);if(xs(ee.value,p)||(ee.value=p,Us(ee.value)),t.value=t.value.filter(ue=>ue.projectName!==c),te.value[c]!==void 0){const ue={...te.value};delete ue[c],te.value=ue,Ma(ue)}Ke();const w=os(e.value);zt(w),w.some(ue=>ue.id===n.value)||H(((oe=w[0])==null?void 0:oe.id)??"");const K=new Set;try{const ue=await yo();for(const Ie of ue.order)Hs(Ie)===c&&K.add(Ie);for(const Ie of ue.active)Hs(Ie)===c&&K.add(Ie);for(const Ie of Object.keys(ue.labels))Hs(Ie)===c&&K.add(Ie)}catch{}if(K.size>0)try{const ue=await yo(),Ie=ue.order.filter(jt=>!K.has(jt)),me=ue.active.filter(jt=>!K.has(jt)),st=me.length===0&&Ie.length>0?[Ie[0]]:me;await Tu({order:Ie,labels:DA(ue.labels,K),active:st});return}catch{}await h()}function d(c,p){if(c.length===0||t.value.length===0)return;const w=t.value.map(me=>me.projectName),C=w.indexOf(c);if(C===-1)return;const K=Math.max(0,Math.min(p,w.length-1)),oe=IA(w,C,K);if(oe===w)return;const ue=ii(oe,t.value);ee.value=ue,Us(ee.value);const Ie=$a(t.value,ee.value);t.value=li(t.value,Ie),Ke(),h()}function m(c){const p=c.trim();if(!p)return;const w=[p,...ee.value.filter(K=>K!==p)];if(xs(ee.value,w))return;ee.value=w,Us(ee.value);const C=$a(t.value,ee.value);t.value=li(t.value,C),Ke(),h()}async function h(){var c,p;try{const w=await yo(),C=new Map;for(const ue of w.order){const Ie=Hs(ue);C.has(Ie)||C.set(Ie,ue)}for(const ue of t.value){const Ie=((p=(c=ue.threads[0])==null?void 0:c.cwd)==null?void 0:p.trim())??"";Ie&&C.set(ue.projectName,Ie)}const K=[];for(const ue of ee.value){const Ie=C.get(ue);Ie&&!K.includes(Ie)&&K.push(Ie)}for(const ue of w.order)K.includes(ue)||K.push(ue);const oe=w.active.filter(ue=>K.includes(ue));oe.length===0&&K.length>0&&oe.push(K[0]),await Tu({order:K,labels:w.labels,active:oe})}catch{}}async function A(){if(lt.value){typeof window<"u"&&ct===null&&(ct=window.setTimeout(()=>{ct=null,A()},Ra));return}lt.value=!0;const c=He,p=new Set(V);He=!1,V.clear();try{c&&await P();const w=n.value;if(!w)return;const C=p.has(w),K=l.value[w]===!0,oe=Mn(w),ue=Te.value[w]??"",Ie=oe.length>0&&oe!==ue;(C||K||Ie||c)&&await J(w,{silent:!0})}catch{}finally{lt.value=!1,(He||V.size>0)&&typeof window<"u"&&ct===null&&(ct=window.setTimeout(()=>{ct=null,A()},Ra))}}async function L(){await pe(),He=!0,n.value&&V.add(n.value),await A()}function M(){typeof window>"u"||mt||(pe(),mt=zk(c=>{if(c.method==="ready"){L();return}vs(c),Cr(c)}))}async function pe(){try{const p=(await Gk()).map(w=>mn(w)).filter(w=>w!==null);fn(p)}catch{}}async function W(c){try{return await qk(c.id,{result:c.result,error:c.error}),Ut(c.id),!0}catch(p){return Be.value=p instanceof Error?p.message:"Failed to reply to server request",!1}}function Se(){mt&&(mt(),mt=null),He=!1,V.clear(),ge.clear(),ct!==null&&typeof window<"u"&&(window.clearTimeout(ct),ct=null),he=!1,r.value={},s.value={},o.value={},i.value={},a.value={},le.value={},Le.value={},re.value={},ce.value={},f.value={},Ye.value=null}const Oe=de(()=>{const c=n.value;return c?f.value[c]??[]:[]});function Qe(c){const p=n.value;if(!p)return;const w=f.value[p];if(!w)return;const C=w.filter(K=>K.id!==c);f.value=C.length>0?{...f.value,[p]:C}:ln(f.value,p)}function $t(c){const p=n.value;if(!p)return;const w=f.value[p];if(!w)return;const C=w.find(K=>K.id===c);C&&(Qe(c),Z(C.collaborationMode),rr(C.text,C.imageUrls,C.skills,"steer",C.fileAttachments))}function Vt(c){H(c)}return{projectGroups:e,projectDisplayNameById:te,selectedThread:E,selectedThreadScrollState:O,selectedThreadServerRequests:z,selectedLiveOverlay:Y,codexQuota:N,selectedThreadId:n,availableCollaborationModes:_,availableModelIds:g,selectedCollaborationMode:F,selectedModelId:$,selectedReasoningEffort:Q,installedSkills:Ve,messages:B,isLoadingThreads:Ue,isLoadingMessages:Re,isSendingMessage:rt,isInterruptingTurn:Ae,error:Be,refreshAll:In,refreshSkills:St,selectThread:on,loadMessages:J,ensureThreadMessagesLoaded:Fe,setThreadScrollState:Wt,archiveThreadById:an,renameThreadById:Dn,sendMessageToSelectedThread:rr,sendMessageToNewThread:js,interruptSelectedThreadTurn:ws,selectedThreadQueuedMessages:Oe,removeQueuedMessage:Qe,steerQueuedMessage:$t,setSelectedCollaborationMode:Z,setSelectedModelId:X,setSelectedReasoningEffort:it,respondToPendingServerRequest:W,renameProject:co,removeProject:Ar,reorderProject:d,pinProjectToTop:m,startPolling:M,stopPolling:Se,primeSelectedThread:Vt}}const zA={class:"sidebar-root"},qA={class:"sidebar-scrollable"},GA=["aria-pressed"],KA={key:1,class:"sidebar-search-bar"},JA={key:0,class:"sidebar-settings-area"},YA={key:0,class:"sidebar-settings-panel"},QA={class:"sidebar-settings-account-section"},XA={class:"sidebar-settings-account-header"},ZA={class:"sidebar-settings-account-header-main"},ex={class:"sidebar-settings-account-count"},tx=["disabled"],nx={key:0,class:"sidebar-settings-account-error"},rx={key:1,class:"sidebar-settings-account-empty"},sx={key:2,class:"sidebar-settings-account-list"},ox=["title","onMouseenter","onMouseleave"],ix={class:"sidebar-settings-account-main"},ax={class:"sidebar-settings-account-email"},lx={class:"sidebar-settings-account-meta"},cx={class:"sidebar-settings-account-quota"},ux={class:"sidebar-settings-account-id"},dx={class:"sidebar-settings-account-actions"},fx=["disabled","onClick"],hx=["disabled","onClick"],px={class:"sidebar-settings-value"},mx={class:"sidebar-settings-value"},gx={class:"content-root"},vx={class:"content-body"},yx={key:1,class:"content-grid"},wx={class:"new-thread-empty"},bx={class:"worktree-init-status-title"},_x={class:"worktree-init-status-message"},kx={key:2,class:"content-grid"},Tx={class:"content-thread"},Sx={class:"composer-with-queue"},Ix={class:"build-badge","aria-label":"Author name, worktree name, and version"},id="codex-web-local.sidebar-collapsed.v1",Na="codex-web-local.last-active-thread-route.v1",ad="codex-web-local.send-with-enter.v1",ld="codex-web-local.in-progress-send-mode.v1",cd="codex-web-local.dark-mode.v1",ud="codex-web-local.dictation-click-to-toggle.v1",Ex=400,Cx=cn({__name:"App",setup(e){const t="codexui",n="1.0.5",{projectGroups:r,projectDisplayNameById:s,selectedThread:o,selectedThreadScrollState:i,selectedThreadServerRequests:a,selectedLiveOverlay:l,codexQuota:f,selectedThreadId:u,availableCollaborationModes:g,availableModelIds:_,selectedCollaborationMode:I,selectedModelId:F,selectedReasoningEffort:$,installedSkills:Q,messages:ae,isLoadingThreads:q,isLoadingMessages:ee,isSendingMessage:te,isInterruptingTurn:Te,refreshAll:ve,refreshSkills:ye,selectThread:Le,ensureThreadMessagesLoaded:le,setThreadScrollState:re,archiveThreadById:ce,renameThreadById:ne,sendMessageToSelectedThread:Pe,sendMessageToNewThread:Ye,interruptSelectedThreadTurn:Ge,selectedThreadQueuedMessages:Ve,removeQueuedMessage:Ue,steerQueuedMessage:Re,setSelectedCollaborationMode:rt,setSelectedModelId:Ae,setSelectedReasoningEffort:Be,respondToPendingServerRequest:lt,renameProject:Ht,removeProject:mt,reorderProject:ct,pinProjectToTop:He,startPolling:V,stopPolling:_e,primeSelectedThread:he}=VA(),ge=Pv(),Ce=Rv(),{isMobile:T}=Bf(),E=D(!1),O=D(!1),z=D(""),Y=D("local"),N=D({order:[],labels:{}}),B=D({phase:"idle",title:"",message:""}),H=D(oe()),X=D(""),Z=D(!1),Ee=D(null),we=D(null);let ke=null;const xe=D("New Project (1)"),ze=D(""),it=D(!1),We=D([]),pt=D(!1),bt=D(!1),Pt=D(""),Ke=D(""),Bt=D(""),zt=D(""),dt=D(Qe(ad,!0)),_t=D(Vt()),gt=D($t()),nn=D(Qe(ud,!1)),xt=D(null),Rt=D(!1),Mn=D(!1);let Wt=null,$n=!1;const Mt=de(()=>{const b=ge.params.threadId;return typeof b=="string"?b:""}),Kt=de(()=>{const b=new Set;for(const j of r.value)for(const ie of j.threads)b.add(ie.id);return b}),Dt=de(()=>ge.name==="home"),rn=de(()=>ge.name==="skills"),Tn=de(()=>{var b;return rn.value?"Skills":Dt.value?"New thread":((b=o.value)==null?void 0:b.title)??"Choose a thread"}),un=de(()=>ae.value.filter(b=>{const j=Ie(b.messageType,b.role);return j==="worked"?!0:!(j==="turnActivity.live"||j==="turnError.live"||j==="agentReasoning.live")})),Bn=de(()=>l.value),dn=de(()=>Dt.value?"__new-thread__":u.value),Un=de(()=>{var b,j;return Dt.value?z.value.trim():((j=(b=o.value)==null?void 0:b.cwd)==null?void 0:j.trim())??""}),Gn=de(()=>{var b;return!Dt.value&&((b=o.value)==null?void 0:b.inProgress)===!0}),er=de(()=>te.value||Te.value||Gn.value||a.value.length>0),Hn=de(()=>{var qe,at;const b=[],j=new Set;for(const Je of N.value.order){const Qt=Je.trim();!Qt||j.has(Qt)||(j.add(Qt),b.push({value:Qt,label:N.value.labels[Qt]||m(Qt)}))}for(const Je of r.value){const Qt=((at=(qe=Je.threads[0])==null?void 0:qe.cwd)==null?void 0:at.trim())??"";!Qt||j.has(Qt)||(j.add(Qt),b.push({value:Qt,label:s.value[Je.projectName]??Je.projectName}))}const ie=z.value.trim();return ie&&!j.has(ie)&&b.unshift({value:ie,label:m(ie)}),b}),Me=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;Gr(()=>{window.addEventListener("keydown",J),document.addEventListener("visibilitychange",Fe),window.addEventListener("pageshow",St),window.addEventListener("focus",qt),K(),Me==null||Me.addEventListener("change",K),st(),rr(),co(),Ar(),hr()}),Wi(()=>{window.removeEventListener("keydown",J),document.removeEventListener("visibilitychange",Fe),window.removeEventListener("pageshow",St),window.removeEventListener("focus",qt),Me==null||Me.removeEventListener("change",K),Wt!==null&&(window.clearInterval(Wt),Wt=null),ke&&(clearTimeout(ke),ke=null),_e()}),ht(X,b=>{const j=b.trim();if(ke&&(clearTimeout(ke),ke=null),!j){we.value=null;return}ke=setTimeout(()=>{h0(j,1e3).then(ie=>{X.value.trim()===j&&(we.value=ie.threadIds)}).catch(()=>{X.value.trim()===j&&(we.value=null)})},220)}),ht(We,()=>{if(typeof window>"u")return;if(!We.value.some(j=>j.quotaStatus==="loading")){Wt!==null&&(window.clearInterval(Wt),Wt=null);return}Wt===null&&(Wt=window.setInterval(()=>{$n||($n=!0,Sn({silent:!0}).finally(()=>{$n=!1}))},1500))},{deep:!0});function $e(){ye()}function On(){Z.value=!Z.value,Z.value?en(()=>{var b;return(b=Ee.value)==null?void 0:b.focus()}):X.value=""}function Yt(){var b;X.value="",(b=Ee.value)==null||b.focus()}function Wn(b){b.key==="Escape"&&(Z.value=!1,X.value="")}function Nn(b){b&&(ge.name==="thread"&&Mt.value===b||(Ce.push({name:"thread",params:{threadId:b}}),T.value&&P(!0)))}async function mn(b){b&&(u.value!==b&&(await Le(b),await Ce.push({name:"thread",params:{threadId:b}})),await en(),pe())}function tr(b){return b.length>8?b.slice(-8):b}function Kn(b){const j=[b.planType||"unknown"];return b.authMode&&j.unshift(b.authMode),j.join(" · ")}function Ut(b){if(!b)return!1;const j=b.toLowerCase();return j.includes("payment required")||/\b402\b/.test(j)}function fn(b){return b.unavailableReason==="payment_required"||Ut(b.quotaError)}function nr(b){return pt.value||bt.value||Pt.value.length>0||b.isActive&&Pt.value!==b.accountId&&er.value}function sn(b){return Ke.value===b.accountId}function x(b){return Bt.value===b.accountId||sn(b)}function U(b){return fn(b)?"Unavailable":b.isActive?"Active":bt.value?"Switching…":"Switch"}function se(b){return Pt.value===b.accountId?"Removing…":sn(b)?"Click again to remove":"Remove"}function je(b){Bt.value=b}function ot(b){Bt.value===b&&(Bt.value=""),Pt.value!==b&&Ke.value===b&&(Ke.value="")}function ut(b){const j=b.quotaSnapshot;if(!j)return null;const ie=[j==null?void 0:j.primary,j==null?void 0:j.secondary].filter(Je=>Je!==null),qe=ie.find(Je=>Je.windowMinutes===10080);if(qe)return qe;const at=ie.filter(Je=>typeof Je.windowMinutes=="number"&&Je.windowMinutes>=10080).sort((Je,Qt)=>(Je.windowMinutes??0)-(Qt.windowMinutes??0))[0]??null;return at||(j.secondary??null)}function ft(b){var qe,at;if(fn(b))return b.quotaError||"402 Payment Required";const j=b.quotaSnapshot,ie=ut(b);return ie?`${Math.max(0,Math.min(100,100-Math.round(ie.usedPercent)))}% weekly remaining`:(qe=j==null?void 0:j.credits)!=null&&qe.unlimited?"Unlimited credits":(at=j==null?void 0:j.credits)!=null&&at.hasCredits&&j.credits.balance?`${j.credits.balance} credits`:b.quotaStatus==="loading"?"Loading quota…":b.quotaStatus==="error"?b.quotaError||"Quota unavailable":"Fetching account details…"}function Ot(b){return[b.email||"Account",Kn(b),fn(b)?"Unavailable account":null,ft(b),`Workspace ${b.accountId}`].filter(Boolean).join(`
|
|
1453
|
+
`)}async function Sn(b={}){try{const j=await Jk();We.value=j.accounts,j.accounts.some(ie=>ie.accountId===Bt.value)||(Bt.value=""),j.accounts.some(ie=>ie.accountId===Ke.value)||(Ke.value="")}catch(j){if(b.silent===!0)return;zt.value=j instanceof Error?j.message:"Failed to load accounts"}}async function Vn(){if(!(pt.value||bt.value)){zt.value="",Bt.value="",Ke.value="",pt.value=!0;try{const b=await Yk();We.value=b.accounts,_e(),V(),ve({includeSelectedThreadMessages:!0})}catch(b){zt.value=b instanceof Error?b.message:"Failed to refresh accounts"}finally{pt.value=!1}}}async function Jr(b){if(!(bt.value||pt.value)){if(er.value){zt.value="Finish the current turn and pending requests before switching accounts.";return}zt.value="",Bt.value="",Ke.value="",bt.value=!0;try{const j=await Qk(b);We.value=We.value.map(ie=>ie.accountId===b?j:{...ie,isActive:!1}),_e(),V(),ve({includeSelectedThreadMessages:!0}),Sn({silent:!0})}catch(j){zt.value=j instanceof Error?j.message:"Failed to switch account"}finally{bt.value=!1}}}async function ms(b){if(pt.value||bt.value||Pt.value.length>0)return;const j=We.value.find(qe=>qe.accountId===b)??null;if(!j)return;if(Ke.value!==b){Ke.value=b;return}if(j.isActive&&er.value){zt.value="Finish the current turn and pending requests before removing the active account.";return}const ie=j.isActive;zt.value="",Ke.value="",Pt.value=b;try{const qe=await Xk(b);We.value=qe.accounts,_e(),V(),ie&&ve({includeSelectedThreadMessages:!0}),Sn({silent:!0})}catch(qe){zt.value=qe instanceof Error?qe.message:"Failed to remove account"}finally{Pt.value=""}}function Yr(b){ce(b)}function Ln(b){var qe,at;const j=r.value.find(Je=>Je.projectName===b),ie=((at=(qe=j==null?void 0:j.threads[0])==null?void 0:qe.cwd)==null?void 0:at.trim())??"";ie&&(z.value=ie),T.value&&P(!0),!Dt.value&&Ce.push({name:"home"})}function Jn(b){var qe,at;const j=r.value.find(Je=>Je.projectName===b),ie=((at=(qe=j==null?void 0:j.threads[0])==null?void 0:qe.cwd)==null?void 0:at.trim())??"";!ie||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(ie)}`,"_blank","noopener,noreferrer")}function Qr(){var j,ie;const b=((ie=(j=o.value)==null?void 0:j.cwd)==null?void 0:ie.trim())??"";b&&(z.value=b),T.value&&P(!0),!Dt.value&&Ce.push({name:"home"})}function gs(b){Ht(b.projectName,b.displayName)}function vs(b){ne(b.threadId,b.title)}async function Cr(b){await mt(b),await Ar(),hr()}function ys(b){ct(b.projectName,b.toIndex)}function S(b){re(b.threadId,b.state)}function R(b){lt(b)}function P(b){H.value!==b&&(H.value=b,ue(b))}function J(b){b.defaultPrevented||!b.ctrlKey&&!b.metaKey||b.shiftKey||b.altKey||b.key.toLowerCase()==="b"&&(b.preventDefault(),P(!H.value))}function Fe(){if(!(typeof document>"u")&&T.value){if(document.visibilityState==="hidden"){xt.value=Date.now(),Rt.value=!1;return}In()}}function St(b){b.persisted&&In()}function qt(){In()}function In(){typeof window>"u"||typeof document>"u"||!T.value||document.visibilityState!=="visible"||Rt.value||xt.value===null||Date.now()-xt.value<Ex||(Rt.value=!0,xt.value=null,on())}async function on(){if(!Mn.value){Mn.value=!0;try{await ve({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await pr(),await Zo()}finally{Mn.value=!1}}}function an(b){const j=b.text;if(Dt.value){uo(j,b.imageUrls,b.skills,b.fileAttachments);return}Pe(j,b.imageUrls,b.skills,b.mode,b.fileAttachments)}function Dn(b){z.value=b.trim()}async function fr(b){const j=b.trim();if(!j)return;const ie=Xr(j),qe=await js(),at=ie?j:h(qe,j);if(at)try{const Je=await Su(at,{createIfMissing:!ie,label:ie?"":j});Je&&(z.value=Je,He(m(Je)),Ar(),hr())}catch{}}async function rr(){var j;if(typeof window>"u")return;const b=((j=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:j.trim())??"";if(b)try{const ie=await Su(b,{createIfMissing:!1,label:""});if(!ie)return;z.value=ie,He(m(ie)),await Ce.replace({name:"home"}),await Ar();const qe=new URL(window.location.href);qe.searchParams.delete("openProjectPath"),window.history.replaceState({},"",qe.toString())}catch{}}async function js(){const b=ws();if(b)return b;try{const j=await ku();if(j)return ze.value=j,j}catch{}return""}function Xr(b){return b?b.startsWith("~/")||b.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(b):!1}async function hr(){const b=ws();if(!b){xe.value="New Project (1)";return}try{const j=await d0(b);xe.value=j.name||"New Project (1)"}catch{xe.value="New Project (1)"}}function ws(){var ie,qe;const b=z.value.trim();if(b)return d(b);const j=((qe=(ie=Hn.value[0])==null?void 0:ie.value)==null?void 0:qe.trim())??"";return j?d(j):ze.value.trim()}async function co(){try{ze.value=await ku()}catch{ze.value=""}}async function Ar(){try{const b=await yo();N.value={order:[...b.order],labels:{...b.labels}}}catch{N.value={order:[],labels:{}}}}function d(b){const j=b.trim().replace(/\/+$/,"");if(!j)return"";const ie=j.lastIndexOf("/");return ie<=0?"":j.slice(0,ie)}function m(b){const j=b.trim().replace(/\/+$/,"");if(!j)return"";const ie=j.lastIndexOf("/");return ie<0?j:j.slice(ie+1)}function h(b,j){const ie=b.trim().replace(/\/+$/,""),qe=j.trim().replace(/^\/+/,"");return!ie||!qe?"":`${ie}/${qe}`}function A(b){Ae(b)}function L(b){Be(b)}function M(){Ge()}function pe(){if(Dt.value||rn.value||typeof document>"u"||!o.value||un.value.length===0)return;const b=W(),j=Se(),ie=new Blob([b],{type:"text/markdown;charset=utf-8"}),qe=URL.createObjectURL(ie),at=document.createElement("a");at.href=qe,at.download=j,document.body.appendChild(at),at.click(),document.body.removeChild(at),window.setTimeout(()=>URL.revokeObjectURL(qe),0)}function W(){var ie,qe,at;const b=[],j=((qe=(ie=o.value)==null?void 0:ie.title)==null?void 0:qe.trim())||"Untitled thread";b.push(`# ${Oe(j)}`),b.push(""),b.push(`- Exported: ${new Date().toISOString()}`),b.push(`- Thread ID: ${((at=o.value)==null?void 0:at.id)??""}`),b.push(""),b.push("---"),b.push("");for(const Je of un.value){const Qt=Je.role?Je.role.toUpperCase():"MESSAGE";b.push(`## ${Qt}`),b.push("");const Ze=Je.text.trim();if(Ze&&(b.push(Ze),b.push("")),Je.commandExecution&&(b.push("```text"),b.push(`command: ${Je.commandExecution.command}`),b.push(`status: ${Je.commandExecution.status}`),Je.commandExecution.cwd&&b.push(`cwd: ${Je.commandExecution.cwd}`),Je.commandExecution.exitCode!==null&&b.push(`exitCode: ${Je.commandExecution.exitCode}`),b.push(Je.commandExecution.aggregatedOutput||"(no output)"),b.push("```"),b.push("")),Je.fileAttachments&&Je.fileAttachments.length>0){b.push("Attachments:");for(const jn of Je.fileAttachments)b.push(`- ${jn.path}`);b.push("")}if(Je.images&&Je.images.length>0){b.push("Images:");for(const jn of Je.images)b.push(`- ${jn}`);b.push("")}}return`${b.join(`
|
|
1454
|
+
`).trimEnd()}
|
|
1455
|
+
`}function Se(){var at,Je;const ie=(((Je=(at=o.value)==null?void 0:at.title)==null?void 0:Je.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",qe=new Date().toISOString().replace(/[:.]/g,"-");return`${ie}-${qe}.md`}function Oe(b){return b.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Qe(b,j){if(typeof window>"u")return j;const ie=window.localStorage.getItem(b);return ie===null?j:ie==="1"}function $t(){if(typeof window>"u")return"system";const b=window.localStorage.getItem(cd);return b==="light"||b==="dark"?b:"system"}function Vt(){return typeof window>"u"?"queue":window.localStorage.getItem(ld)==="steer"?"steer":"queue"}function c(){dt.value=!dt.value,window.localStorage.setItem(ad,dt.value?"1":"0")}function p(){_t.value=_t.value==="steer"?"queue":"steer",window.localStorage.setItem(ld,_t.value)}function w(){const b=["system","light","dark"],j=b.indexOf(gt.value);gt.value=b[(j+1)%b.length],window.localStorage.setItem(cd,gt.value),K()}function C(){nn.value=!nn.value,window.localStorage.setItem(ud,nn.value?"1":"0")}function K(){const b=document.documentElement;if(gt.value==="dark")b.classList.add("dark");else if(gt.value==="light")b.classList.remove("dark");else{const j=window.matchMedia("(prefers-color-scheme: dark)").matches;b.classList.toggle("dark",j)}}function oe(){return typeof window>"u"?!1:window.localStorage.getItem(id)==="1"}function ue(b){typeof window>"u"||window.localStorage.setItem(id,b?"1":"0")}function Ie(b,j){const ie=(b??"").trim();return ie.length>0?ie:j.trim()||"message"}function me(b){rt(b)}async function st(){await Ce.isReady(),ge.name==="thread"&&Mt.value&&he(Mt.value),V(),await ve({includeSelectedThreadMessages:!0}),Sn({silent:!0}),await pr(),O.value=!0,await Zo()}function jt(){if(typeof window>"u")return null;try{const b=window.localStorage.getItem(Na);if(!b)return null;const j=JSON.parse(b);return!j||j.routeName!=="thread"||typeof j.threadId!="string"||j.threadId.trim().length===0||typeof j.updatedAtIso!="string"||j.updatedAtIso.trim().length===0?null:{routeName:"thread",threadId:j.threadId.trim(),updatedAtIso:j.updatedAtIso}}catch{return null}}function Xt(b){if(typeof window>"u")return;const j=b.trim();if(!j)return;const ie={routeName:"thread",threadId:j,updatedAtIso:new Date().toISOString()};window.localStorage.setItem(Na,JSON.stringify(ie))}function zn(){typeof window>"u"||window.localStorage.removeItem(Na)}async function pr(){if(ge.name!=="home")return!1;const b=jt(),j=u.value.trim(),ie=(b==null?void 0:b.threadId)??j;return ie?Kt.value.has(ie)?(await Ce.replace({name:"thread",params:{threadId:ie}}),!0):((b==null?void 0:b.threadId)===ie&&zn(),!1):!1}async function Zo(){if(!E.value){E.value=!0;try{if(ge.name==="home"||ge.name==="skills"){u.value!==""&&await Le("");return}if(ge.name==="thread"){const b=Mt.value;if(!b)return;if(!Kt.value.has(b)){await Ce.replace({name:"home"});return}u.value!==b?await Le(b):le(b,{silent:!0});return}}finally{E.value=!1}}}ht(()=>[ge.name,Mt.value,u.value,O.value],([b,j,ie,qe])=>{if(!qe||b!=="thread")return;const at=(j||ie).trim();at&&Kt.value.has(at)&&Xt(at)}),ht(()=>[ge.name,Mt.value,q.value,Kt.value.has(Mt.value),u.value],async()=>{O.value&&await Zo()}),ht(()=>u.value,async b=>{if(O.value&&!E.value&&!(Dt.value||rn.value)){if(!b){ge.name!=="home"&&await Ce.replace({name:"home"});return}ge.name==="thread"&&Mt.value===b||await Ce.replace({name:"thread",params:{threadId:b}})}}),ht(()=>[O.value,ge.name,u.value],([b,j,ie])=>{b&&j==="thread"&&ie&&le(ie,{silent:!0})}),ht(()=>Hn.value,b=>{if(b.length===0){z.value="";return}b.some(ie=>ie.value===z.value)||(z.value=b[0].value),hr()},{immediate:!0}),ht(()=>z.value,()=>{B.value={phase:"idle",title:"",message:""},hr()}),ht(()=>Y.value,b=>{b==="local"&&(B.value={phase:"idle",title:"",message:""})}),ht(()=>ge.name,b=>{b!=="home"&&(B.value={phase:"idle",title:"",message:""})}),ht(()=>u.value,()=>{B.value={phase:"idle",title:"",message:""}}),ht(T,b=>{b&&!H.value&&P(!0)});async function uo(b,j=[],ie=[],qe=[]){try{B.value={phase:"idle",title:"",message:""};let at=z.value;if(Y.value==="worktree"){B.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const Qt=await u0(z.value);at=Qt.cwd,z.value=Qt.cwd,B.value={phase:"idle",title:"",message:""}}catch{B.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const Je=await Ye(b,at,j,ie,qe);if(!Je)return;await Ce.replace({name:"thread",params:{threadId:Je}})}catch{}}return(b,j)=>(y(),k(Ne,null,[De(Dv,{"is-sidebar-collapsed":H.value,onCloseSidebar:j[6]||(j[6]=ie=>P(!0))},{sidebar:It(()=>[v("section",zA,[v("div",qA,[H.value?fe("",!0):(y(),wt(nd,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":H.value,"show-new-thread-button":!0,onToggleSidebar:j[0]||(j[0]=ie=>P(!H.value)),onStartNewThread:Qr},{default:It(()=>[v("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Z.value,"aria-label":"Search threads",title:"Search threads",onClick:On},[De(sl,{class:"sidebar-search-toggle-icon"})],8,GA)]),_:1},8,["is-sidebar-collapsed"])),!H.value&&Z.value?(y(),k("div",KA,[De(sl,{class:"sidebar-search-bar-icon"}),Hr(v("input",{ref_key:"sidebarSearchInputRef",ref:Ee,"onUpdate:modelValue":j[1]||(j[1]=ie=>X.value=ie),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:Wn},null,544),[[Wr,X.value]]),X.value.length>0?(y(),k("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:Yt},[De(Ul,{class:"sidebar-search-clear-icon"})])):fe("",!0)])):fe("",!0),H.value?fe("",!0):(y(),k("button",{key:2,class:tt(["sidebar-skills-link",{"is-active":rn.value}]),type:"button",onClick:j[2]||(j[2]=ie=>{be(Ce).push({name:"skills"}),be(T)&&P(!0)})}," Skills Hub ",2)),H.value?fe("",!0):(y(),wt(kw,{key:3,groups:be(r),"project-display-name-by-id":be(s),"selected-thread-id":be(u),"is-loading":be(q),"search-query":X.value,"search-matched-thread-ids":we.value,onSelect:Nn,onArchive:Yr,onStartNewThread:Ln,onRenameProject:gs,onBrowseProjectFiles:Jn,onRenameThread:vs,onRemoveProject:Cr,onReorderProject:ys,onExportThread:mn},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),H.value?fe("",!0):(y(),k("div",JA,[De(Cf,{name:"settings-panel"},{default:It(()=>[it.value?(y(),k("div",YA,[v("div",QA,[v("div",XA,[v("div",ZA,[j[7]||(j[7]=v("span",{class:"sidebar-settings-account-title"},"Accounts",-1)),v("span",ex,G(We.value.length),1)]),v("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:pt.value||bt.value,onClick:Vn},G(pt.value?"Reloading…":"Reload"),9,tx)]),zt.value?(y(),k("p",nx,G(zt.value),1)):fe("",!0),We.value.length===0?(y(),k("p",rx," Run `codex login`, then click reload. ")):(y(),k("div",sx,[(y(!0),k(Ne,null,vt(We.value,ie=>(y(),k("article",{key:ie.accountId,class:tt(["sidebar-settings-account-item",{"is-active":ie.isActive,"is-unavailable":fn(ie),"is-confirming-remove":sn(ie),"is-remove-visible":x(ie)}]),title:Ot(ie),onMouseenter:qe=>je(ie.accountId),onMouseleave:qe=>ot(ie.accountId)},[v("div",ix,[v("p",ax,G(ie.email||"Account"),1),v("p",lx,G(Kn(ie)),1),v("p",cx,G(ft(ie)),1),v("p",ux," Workspace "+G(tr(ie.accountId)),1)]),v("div",dx,[v("button",{class:"sidebar-settings-account-switch",type:"button",disabled:nr(ie)||ie.isActive||fn(ie),onClick:qe=>Jr(ie.accountId)},G(U(ie)),9,fx),v("button",{class:tt(["sidebar-settings-account-remove",{"is-visible":x(ie),"is-confirming":sn(ie)}]),type:"button",disabled:nr(ie),onClick:qe=>ms(ie.accountId)},G(se(ie)),11,hx)])],42,ox))),128))]))]),v("button",{class:"sidebar-settings-row",type:"button",onClick:c},[j[8]||(j[8]=v("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),v("span",{class:tt(["sidebar-settings-toggle",{"is-on":!dt.value}])},null,2)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:p},[j[9]||(j[9]=v("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),v("span",px,G(_t.value==="steer"?"Steer":"Queue"),1)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:w},[j[10]||(j[10]=v("span",{class:"sidebar-settings-label"},"Appearance",-1)),v("span",mx,G(gt.value==="system"?"System":gt.value==="dark"?"Dark":"Light"),1)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:C},[j[11]||(j[11]=v("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),v("span",{class:tt(["sidebar-settings-toggle",{"is-on":nn.value}])},null,2)])])):fe("",!0)]),_:1}),v("button",{class:"sidebar-settings-button",type:"button",onClick:j[3]||(j[3]=ie=>it.value=!it.value)},[De(mA,{class:"sidebar-settings-icon"}),j[12]||(j[12]=v("span",null,"Settings",-1))])]))])]),content:It(()=>[v("section",gx,[De(Aw,{title:Tn.value},{leading:It(()=>[H.value||be(T)?(y(),wt(nd,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":H.value,"show-new-thread-button":!0,onToggleSidebar:j[4]||(j[4]=ie=>P(!H.value)),onStartNewThread:Qr},null,8,["is-sidebar-collapsed"])):fe("",!0)]),_:1},8,["title"]),v("section",vx,[rn.value?(y(),wt(eA,{key:0,onSkillsChanged:$e})):Dt.value?(y(),k("div",yx,[v("div",wx,[j[13]||(j[13]=v("p",{class:"new-thread-hero"},"Let's build",-1)),De(rl,{class:"new-thread-folder-dropdown","model-value":z.value,options:Hn.value,placeholder:"Choose folder","enable-search":!0,"search-placeholder":"Quick search project","show-add-action":!0,"add-action-label":"+ Add new project","default-add-value":xe.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":Dn,onAdd:fr},null,8,["model-value","options","default-add-value"]),De(iS,{class:"new-thread-runtime-dropdown",modelValue:Y.value,"onUpdate:modelValue":j[5]||(j[5]=ie=>Y.value=ie)},null,8,["modelValue"]),B.value.phase!=="idle"?(y(),k("div",{key:0,class:tt(["worktree-init-status",{"is-running":B.value.phase==="running","is-error":B.value.phase==="error"}])},[v("strong",bx,G(B.value.title),1),v("span",_x,G(B.value.message),1)],2)):fe("",!0)]),De(Cu,{"active-thread-id":dn.value,cwd:Un.value,"collaboration-modes":be(g),"selected-collaboration-mode":be(I),models:be(_),"selected-model":be(F),"selected-reasoning-effort":be($),skills:be(Q),"codex-quota":be(f),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":dt.value,"in-progress-submit-mode":_t.value,"dictation-click-to-toggle":nn.value,onSubmit:an,"onUpdate:selectedCollaborationMode":me,"onUpdate:selectedModel":A,"onUpdate:selectedReasoningEffort":L},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","skills","codex-quota","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle"])])):(y(),k("div",kx,[v("div",Tx,[De(fk,{messages:un.value,"is-loading":be(ee),"active-thread-id":dn.value,cwd:Un.value,"scroll-state":be(i),"live-overlay":Bn.value,"pending-requests":be(a),onUpdateScrollState:S,onRespondServerRequest:R},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests"])]),v("div",Sx,[De(XT,{messages:be(Ve),onSteer:be(Re),onDelete:be(Ue)},null,8,["messages","onSteer","onDelete"]),De(Cu,{"active-thread-id":dn.value,cwd:Un.value,"collaboration-modes":be(g),"selected-collaboration-mode":be(I),models:be(_),"selected-model":be(F),"selected-reasoning-effort":be($),skills:be(Q),"codex-quota":be(f),"is-turn-in-progress":Gn.value,"is-interrupting-turn":be(Te),"has-queue-above":be(Ve).length>0,"send-with-enter":dt.value,"in-progress-submit-mode":_t.value,"dictation-click-to-toggle":nn.value,"onUpdate:selectedCollaborationMode":me,onSubmit:an,"onUpdate:selectedModel":A,"onUpdate:selectedReasoningEffort":L,onInterrupt:M},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","skills","codex-quota","is-turn-in-progress","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle"])])]))])])]),_:1},8,["is-sidebar-collapsed"]),v("div",Ix," nervmor "+G(be(t))+" · v"+G(be(n)),1)],64))}}),Ax=yt(Cx,[["__scopeId","data-v-53c48853"]]),La={render:()=>null},xx=xv({history:av(),routes:[{path:"/",name:"home",component:La},{path:"/thread/:threadId",name:"thread",component:La},{path:"/skills",name:"skills",component:La},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. npm: https://www.npmjs.com/package/@nervmor/codexui");bg(Ax).use(xx).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error("Service worker registration failed.",e)})});
|