codexapp 0.1.47 → 0.1.49
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-Batjlg_n.js +1428 -0
- package/dist/assets/index-uy5QW_sJ.css +1 -0
- package/dist/index.html +2 -2
- package/dist-cli/index.js +361 -71
- package/dist-cli/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/index-DGYijDgu.css +0 -1
- package/dist/assets/index-dkC99kKB.js +0 -1442
|
@@ -0,0 +1,1428 @@
|
|
|
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 tl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Ct={},cs=[],zn=()=>{},Qu=()=>!1,li=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),nl=e=>e.startsWith("onUpdate:"),Bt=Object.assign,rl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Rh=Object.prototype.hasOwnProperty,pt=(e,t)=>Rh.call(e,t),We=Array.isArray,us=e=>uo(e)==="[object Map]",Zu=e=>uo(e)==="[object Set]",Hl=e=>uo(e)==="[object Date]",Je=e=>typeof e=="function",Mt=e=>typeof e=="string",xn=e=>typeof e=="symbol",mt=e=>e!==null&&typeof e=="object",ed=e=>(mt(e)||Je(e))&&Je(e.then)&&Je(e.catch),td=Object.prototype.toString,uo=e=>td.call(e),Ph=e=>uo(e).slice(8,-1),nd=e=>uo(e)==="[object Object]",sl=e=>Mt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Fs=tl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ci=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},xh=/-\w/g,fn=ci(e=>e.replace(xh,t=>t.slice(1).toUpperCase())),Mh=/\B([A-Z])/g,$r=ci(e=>e.replace(Mh,"-$1").toLowerCase()),ui=ci(e=>e.charAt(0).toUpperCase()+e.slice(1)),Bi=ci(e=>e?`on${ui(e)}`:""),Hn=(e,t)=>!Object.is(e,t),No=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},rd=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ol=e=>{const t=parseFloat(e);return isNaN(t)?e:t},$h=e=>{const t=Mt(e)?Number(e):NaN;return isNaN(t)?e:t};let Wl;const di=()=>Wl||(Wl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Jr(e){if(We(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Mt(r)?Lh(r):Jr(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(Mt(e)||mt(e))return e}const Oh=/;(?![^(]*\))/g,Nh=/:([^]+)/,Dh=/\/\*[^]*?\*\//g;function Lh(e){const t={};return e.replace(Dh,"").split(Oh).forEach(n=>{if(n){const r=n.split(Nh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function it(e){let t="";if(Mt(e))t=e;else if(We(e))for(let n=0;n<e.length;n++){const r=it(e[n]);r&&(t+=r+" ")}else if(mt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const jh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Uh=tl(jh);function sd(e){return!!e||e===""}function Fh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=il(e[r],t[r]);return n}function il(e,t){if(e===t)return!0;let n=Hl(e),r=Hl(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=xn(e),r=xn(t),n||r)return e===t;if(n=We(e),r=We(t),n||r)return n&&r?Fh(e,t):!1;if(n=mt(e),r=mt(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||!il(e[i],t[i]))return!1}}return String(e)===String(t)}const od=e=>!!(e&&e.__v_isRef===!0),ie=e=>Mt(e)?e:e==null?"":We(e)||mt(e)&&(e.toString===td||!Je(e.toString))?od(e)?ie(e.value):JSON.stringify(e,id,2):String(e),id=(e,t)=>od(t)?id(e,t.value):us(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[Hi(r,o)+" =>"]=s,n),{})}:Zu(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Hi(n))}:xn(t)?Hi(t):mt(t)&&!We(t)&&!nd(t)?String(t):t,Hi=(e,t="")=>{var n;return xn(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 pn;class Bh{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=pn,!t&&pn&&(this.index=(pn.scopes||(pn.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=pn;try{return pn=this,t()}finally{pn=n}}}on(){++this._on===1&&(this.prevScope=pn,pn=this)}off(){this._on>0&&--this._on===0&&(pn=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 Hh(){return pn}let At;const Wi=new WeakSet;class ad{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,pn&&pn.active&&pn.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Wi.has(this)&&(Wi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||cd(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Vl(this),ud(this);const t=At,n=An;At=this,An=!0;try{return this.fn()}finally{dd(this),At=t,An=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)cl(t);this.deps=this.depsTail=void 0,Vl(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Wi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){ka(this)&&this.run()}get dirty(){return ka(this)}}let ld=0,Bs,Hs;function cd(e,t=!1){if(e.flags|=8,t){e.next=Hs,Hs=e;return}e.next=Bs,Bs=e}function al(){ld++}function ll(){if(--ld>0)return;if(Hs){let t=Hs;for(Hs=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Bs;){let t=Bs;for(Bs=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 ud(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function dd(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),cl(r),Wh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function ka(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(fd(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function fd(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ys)||(e.globalVersion=Ys,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ka(e))))return;e.flags|=2;const t=e.dep,n=At,r=An;At=e,An=!0;try{ud(e);const s=e.fn(e._value);(t.version===0||Hn(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{At=n,An=r,dd(e),e.flags&=-3}}function cl(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)cl(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Wh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let An=!0;const hd=[];function ir(){hd.push(An),An=!1}function ar(){const e=hd.pop();An=e===void 0?!0:e}function Vl(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=At;At=void 0;try{t()}finally{At=n}}}let Ys=0;class Vh{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 ul{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(!At||!An||At===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==At)n=this.activeLink=new Vh(At,this),At.deps?(n.prevDep=At.depsTail,At.depsTail.nextDep=n,At.depsTail=n):At.deps=At.depsTail=n,pd(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=At.depsTail,n.nextDep=void 0,At.depsTail.nextDep=n,At.depsTail=n,At.deps===n&&(At.deps=r)}return n}trigger(t){this.version++,Ys++,this.notify(t)}notify(t){al();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ll()}}}function pd(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)pd(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Ta=new WeakMap,zr=Symbol(""),Sa=Symbol(""),Xs=Symbol("");function tn(e,t,n){if(An&&At){let r=Ta.get(e);r||Ta.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new ul),s.map=r,s.key=n),s.track()}}function tr(e,t,n,r,s,o){const i=Ta.get(e);if(!i){Ys++;return}const a=l=>{l&&l.trigger()};if(al(),t==="clear")i.forEach(a);else{const l=We(e),u=l&&sl(n);if(l&&n==="length"){const c=Number(r);i.forEach((f,m)=>{(m==="length"||m===Xs||!xn(m)&&m>=c)&&a(f)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),u&&a(i.get(Xs)),t){case"add":l?u&&a(i.get("length")):(a(i.get(zr)),us(e)&&a(i.get(Sa)));break;case"delete":l||(a(i.get(zr)),us(e)&&a(i.get(Sa)));break;case"set":us(e)&&a(i.get(zr));break}}ll()}function ss(e){const t=dt(e);return t===e?t:(tn(t,"iterate",Xs),In(e)?t:t.map(Mn))}function fi(e){return tn(e=dt(e),"iterate",Xs),e}function Fn(e,t){return lr(e)?ys(qr(e)?Mn(t):t):Mn(t)}const Gh={__proto__:null,[Symbol.iterator](){return Vi(this,Symbol.iterator,e=>Fn(this,e))},concat(...e){return ss(this).concat(...e.map(t=>We(t)?ss(t):t))},entries(){return Vi(this,"entries",e=>(e[1]=Fn(this,e[1]),e))},every(e,t){return Yn(this,"every",e,t,void 0,arguments)},filter(e,t){return Yn(this,"filter",e,t,n=>n.map(r=>Fn(this,r)),arguments)},find(e,t){return Yn(this,"find",e,t,n=>Fn(this,n),arguments)},findIndex(e,t){return Yn(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Yn(this,"findLast",e,t,n=>Fn(this,n),arguments)},findLastIndex(e,t){return Yn(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Yn(this,"forEach",e,t,void 0,arguments)},includes(...e){return Gi(this,"includes",e)},indexOf(...e){return Gi(this,"indexOf",e)},join(e){return ss(this).join(e)},lastIndexOf(...e){return Gi(this,"lastIndexOf",e)},map(e,t){return Yn(this,"map",e,t,void 0,arguments)},pop(){return $s(this,"pop")},push(...e){return $s(this,"push",e)},reduce(e,...t){return Gl(this,"reduce",e,t)},reduceRight(e,...t){return Gl(this,"reduceRight",e,t)},shift(){return $s(this,"shift")},some(e,t){return Yn(this,"some",e,t,void 0,arguments)},splice(...e){return $s(this,"splice",e)},toReversed(){return ss(this).toReversed()},toSorted(e){return ss(this).toSorted(e)},toSpliced(...e){return ss(this).toSpliced(...e)},unshift(...e){return $s(this,"unshift",e)},values(){return Vi(this,"values",e=>Fn(this,e))}};function Vi(e,t,n){const r=fi(e),s=r[t]();return r!==e&&!In(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const zh=Array.prototype;function Yn(e,t,n,r,s,o){const i=fi(e),a=i!==e&&!In(e),l=i[t];if(l!==zh[t]){const f=l.apply(e,o);return a?Mn(f):f}let u=n;i!==e&&(a?u=function(f,m){return n.call(this,Fn(e,f),m,e)}:n.length>2&&(u=function(f,m){return n.call(this,f,m,e)}));const c=l.call(i,u,r);return a&&s?s(c):c}function Gl(e,t,n,r){const s=fi(e),o=s!==e&&!In(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(u,c,f){return a&&(a=!1,u=Fn(e,u)),n.call(this,u,Fn(e,c),f,e)}):n.length>3&&(i=function(u,c,f){return n.call(this,u,c,f,e)}));const l=s[t](i,...r);return a?Fn(e,l):l}function Gi(e,t,n){const r=dt(e);tn(r,"iterate",Xs);const s=r[t](...n);return(s===-1||s===!1)&&hl(n[0])?(n[0]=dt(n[0]),r[t](...n)):s}function $s(e,t,n=[]){ir(),al();const r=dt(e)[t].apply(e,n);return ll(),ar(),r}const qh=tl("__proto__,__v_isRef,__isVue"),md=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(xn));function Kh(e){xn(e)||(e=String(e));const t=dt(this);return tn(t,"has",e),t.hasOwnProperty(e)}class gd{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:bd:o?wd:yd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=We(t);if(!s){let l;if(i&&(l=Gh[n]))return l;if(n==="hasOwnProperty")return Kh}const a=Reflect.get(t,n,sn(t)?t:r);if((xn(n)?md.has(n):qh(n))||(s||tn(t,"get",n),o))return a;if(sn(a)){const l=i&&sl(n)?a:a.value;return s&&mt(l)?Ea(l):l}return mt(a)?s?Ea(a):hi(a):a}}class vd extends gd{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=We(t)&&sl(n);if(!this._isShallow){const u=lr(o);if(!In(r)&&!lr(r)&&(o=dt(o),r=dt(r)),!i&&sn(o)&&!sn(r))return u||(o.value=r),!0}const a=i?Number(n)<t.length:pt(t,n),l=Reflect.set(t,n,r,sn(t)?t:s);return t===dt(s)&&(a?Hn(r,o)&&tr(t,"set",n,r):tr(t,"add",n,r)),l}deleteProperty(t,n){const r=pt(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&tr(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!xn(n)||!md.has(n))&&tn(t,"has",n),r}ownKeys(t){return tn(t,"iterate",We(t)?"length":zr),Reflect.ownKeys(t)}}class Jh extends gd{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Yh=new vd,Xh=new Jh,Qh=new vd(!0);const Ia=e=>e,Eo=e=>Reflect.getPrototypeOf(e);function Zh(e,t,n){return function(...r){const s=this.__v_raw,o=dt(s),i=us(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,u=s[e](...r),c=n?Ia:t?ys:Mn;return!t&&tn(o,"iterate",l?Sa:zr),Bt(Object.create(u),{next(){const{value:f,done:m}=u.next();return m?{value:f,done:m}:{value:a?[c(f[0]),c(f[1])]:c(f),done:m}}})}}function Co(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function ep(e,t){const n={get(s){const o=this.__v_raw,i=dt(o),a=dt(s);e||(Hn(s,a)&&tn(i,"get",s),tn(i,"get",a));const{has:l}=Eo(i),u=t?Ia:e?ys:Mn;if(l.call(i,s))return u(o.get(s));if(l.call(i,a))return u(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&tn(dt(s),"iterate",zr),s.size},has(s){const o=this.__v_raw,i=dt(o),a=dt(s);return e||(Hn(s,a)&&tn(i,"has",s),tn(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=dt(a),u=t?Ia:e?ys:Mn;return!e&&tn(l,"iterate",zr),a.forEach((c,f)=>s.call(o,u(c),u(f),i))}};return Bt(n,e?{add:Co("add"),set:Co("set"),delete:Co("delete"),clear:Co("clear")}:{add(s){const o=dt(this),i=Eo(o),a=dt(s),l=!t&&!In(s)&&!lr(s)?a:s;return i.has.call(o,l)||Hn(s,l)&&i.has.call(o,s)||Hn(a,l)&&i.has.call(o,a)||(o.add(l),tr(o,"add",l,l)),this},set(s,o){!t&&!In(o)&&!lr(o)&&(o=dt(o));const i=dt(this),{has:a,get:l}=Eo(i);let u=a.call(i,s);u||(s=dt(s),u=a.call(i,s));const c=l.call(i,s);return i.set(s,o),u?Hn(o,c)&&tr(i,"set",s,o):tr(i,"add",s,o),this},delete(s){const o=dt(this),{has:i,get:a}=Eo(o);let l=i.call(o,s);l||(s=dt(s),l=i.call(o,s)),a&&a.call(o,s);const u=o.delete(s);return l&&tr(o,"delete",s,void 0),u},clear(){const s=dt(this),o=s.size!==0,i=s.clear();return o&&tr(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Zh(s,e,t)}),n}function dl(e,t){const n=ep(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(pt(n,s)&&s in r?n:r,s,o)}const tp={get:dl(!1,!1)},np={get:dl(!1,!0)},rp={get:dl(!0,!1)};const yd=new WeakMap,wd=new WeakMap,bd=new WeakMap,sp=new WeakMap;function op(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ip(e){return e.__v_skip||!Object.isExtensible(e)?0:op(Ph(e))}function hi(e){return lr(e)?e:fl(e,!1,Yh,tp,yd)}function _d(e){return fl(e,!1,Qh,np,wd)}function Ea(e){return fl(e,!0,Xh,rp,bd)}function fl(e,t,n,r,s){if(!mt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=ip(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 qr(e){return lr(e)?qr(e.__v_raw):!!(e&&e.__v_isReactive)}function lr(e){return!!(e&&e.__v_isReadonly)}function In(e){return!!(e&&e.__v_isShallow)}function hl(e){return e?!!e.__v_raw:!1}function dt(e){const t=e&&e.__v_raw;return t?dt(t):e}function ap(e){return!pt(e,"__v_skip")&&Object.isExtensible(e)&&rd(e,"__v_skip",!0),e}const Mn=e=>mt(e)?hi(e):e,ys=e=>mt(e)?Ea(e):e;function sn(e){return e?e.__v_isRef===!0:!1}function D(e){return kd(e,!1)}function lp(e){return kd(e,!0)}function kd(e,t){return sn(e)?e:new cp(e,t)}class cp{constructor(t,n){this.dep=new ul,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:dt(t),this._value=n?t:Mn(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||In(t)||lr(t);t=r?t:dt(t),Hn(t,n)&&(this._rawValue=t,this._value=r?t:Mn(t),this.dep.trigger())}}function ye(e){return sn(e)?e.value:e}const up={get:(e,t,n)=>t==="__v_raw"?e:ye(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return sn(s)&&!sn(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Td(e){return qr(e)?e:new Proxy(e,up)}class dp{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new ul(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ys-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&At!==this)return cd(this,!0),!0}get value(){const t=this.dep.track();return fd(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function fp(e,t,n=!1){let r,s;return Je(e)?r=e:(r=e.get,s=e.set),new dp(r,s,n)}const Ao={},Go=new WeakMap;let Fr;function hp(e,t=!1,n=Fr){if(n){let r=Go.get(n);r||Go.set(n,r=[]),r.push(e)}}function pp(e,t,n=Ct){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,u=W=>s?W:In(W)||s===!1||s===0?nr(W,1):nr(W);let c,f,m,T,U=!1,P=!1;if(sn(e)?(f=()=>e.value,U=In(e)):qr(e)?(f=()=>u(e),U=!0):We(e)?(P=!0,U=e.some(W=>qr(W)||In(W)),f=()=>e.map(W=>{if(sn(W))return W.value;if(qr(W))return u(W);if(Je(W))return l?l(W,2):W()})):Je(e)?t?f=l?()=>l(e,2):e:f=()=>{if(m){ir();try{m()}finally{ar()}}const W=Fr;Fr=c;try{return l?l(e,3,[T]):e(T)}finally{Fr=W}}:f=zn,t&&s){const W=f,ce=s===!0?1/0:s;f=()=>nr(W(),ce)}const F=Hh(),R=()=>{c.stop(),F&&F.active&&rl(F.effects,c)};if(o&&t){const W=t;t=(...ce)=>{W(...ce),R()}}let A=P?new Array(e.length).fill(Ao):Ao;const B=W=>{if(!(!(c.flags&1)||!c.dirty&&!W))if(t){const ce=c.run();if(s||U||(P?ce.some((me,ve)=>Hn(me,A[ve])):Hn(ce,A))){m&&m();const me=Fr;Fr=c;try{const ve=[ce,A===Ao?void 0:P&&A[0]===Ao?[]:A,T];A=ce,l?l(t,3,ve):t(...ve)}finally{Fr=me}}}else c.run()};return a&&a(B),c=new ad(f),c.scheduler=i?()=>i(B,!1):B,T=W=>hp(W,!1,c),m=c.onStop=()=>{const W=Go.get(c);if(W){if(l)l(W,4);else for(const ce of W)ce();Go.delete(c)}},t?r?B(!0):A=c.run():i?i(B.bind(null,!0),!0):c.run(),R.pause=c.pause.bind(c),R.resume=c.resume.bind(c),R.stop=R,R}function nr(e,t=1/0,n){if(t<=0||!mt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,sn(e))nr(e.value,t,n);else if(We(e))for(let r=0;r<e.length;r++)nr(e[r],t,n);else if(Zu(e)||us(e))e.forEach(r=>{nr(r,t,n)});else if(nd(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 fo(e,t,n,r){try{return r?e(...r):e()}catch(s){pi(s,t,n)}}function $n(e,t,n,r){if(Je(e)){const s=fo(e,t,n,r);return s&&ed(s)&&s.catch(o=>{pi(o,t,n)}),s}if(We(e)){const s=[];for(let o=0;o<e.length;o++)s.push($n(e[o],t,n,r));return s}}function pi(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Ct;if(t){let a=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let f=0;f<c.length;f++)if(c[f](e,l,u)===!1)return}a=a.parent}if(o){ir(),fo(o,null,10,[e,l,u]),ar();return}}mp(e,n,s,r,i)}function mp(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const un=[];let jn=-1;const ds=[];let Sr=null,is=0;const Sd=Promise.resolve();let zo=null;function Yt(e){const t=zo||Sd;return e?t.then(this?e.bind(this):e):t}function gp(e){let t=jn+1,n=un.length;for(;t<n;){const r=t+n>>>1,s=un[r],o=Qs(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function pl(e){if(!(e.flags&1)){const t=Qs(e),n=un[un.length-1];!n||!(e.flags&2)&&t>=Qs(n)?un.push(e):un.splice(gp(t),0,e),e.flags|=1,Id()}}function Id(){zo||(zo=Sd.then(Cd))}function vp(e){We(e)?ds.push(...e):Sr&&e.id===-1?Sr.splice(is+1,0,e):e.flags&1||(ds.push(e),e.flags|=1),Id()}function zl(e,t,n=jn+1){for(;n<un.length;n++){const r=un[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;un.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Ed(e){if(ds.length){const t=[...new Set(ds)].sort((n,r)=>Qs(n)-Qs(r));if(ds.length=0,Sr){Sr.push(...t);return}for(Sr=t,is=0;is<Sr.length;is++){const n=Sr[is];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Sr=null,is=0}}const Qs=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Cd(e){try{for(jn=0;jn<un.length;jn++){const t=un[jn];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),fo(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;jn<un.length;jn++){const t=un[jn];t&&(t.flags&=-2)}jn=-1,un.length=0,Ed(),zo=null,(un.length||ds.length)&&Cd()}}let Xt=null,Ad=null;function qo(e){const t=Xt;return Xt=e,Ad=e&&e.type.__scopeId||null,t}function _t(e,t=Xt,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Qo(-1);const o=qo(t);let i;try{i=e(...s)}finally{qo(o),r._d&&Qo(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function cr(e,t){if(Xt===null)return e;const n=bi(Xt),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=Ct]=t[s];o&&(Je(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 Nr(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&&(ir(),$n(l,n,8,[e.el,a,e,t]),ar())}}function Do(e,t){if(rn){let n=rn.provides;const r=rn.parent&&rn.parent.provides;r===n&&(n=rn.provides=Object.create(r)),n[e]=t}}function Rn(e,t,n=!1){const r=wl();if(r||hs){let s=hs?hs._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&&Je(t)?t.call(r&&r.proxy):t}}const yp=Symbol.for("v-scx"),wp=()=>Rn(yp);function ut(e,t,n){return Rd(e,t,n)}function Rd(e,t,n=Ct){const{immediate:r,deep:s,flush:o,once:i}=n,a=Bt({},n),l=t&&r||!t&&o!=="post";let u;if(ro){if(o==="sync"){const T=wp();u=T.__watcherHandles||(T.__watcherHandles=[])}else if(!l){const T=()=>{};return T.stop=zn,T.resume=zn,T.pause=zn,T}}const c=rn;a.call=(T,U,P)=>$n(T,c,U,P);let f=!1;o==="post"?a.scheduler=T=>{en(T,c&&c.suspense)}:o!=="sync"&&(f=!0,a.scheduler=(T,U)=>{U?T():pl(T)}),a.augmentJob=T=>{t&&(T.flags|=4),f&&(T.flags|=2,c&&(T.id=c.uid,T.i=c))};const m=pp(e,t,a);return ro&&(u?u.push(m):l&&m()),m}function bp(e,t,n){const r=this.proxy,s=Mt(e)?e.includes(".")?Pd(r,e):()=>r[e]:e.bind(r,r);let o;Je(t)?o=t:(o=t.handler,n=t);const i=ho(this),a=Rd(s,o.bind(r),n);return i(),a}function Pd(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 xd=Symbol("_vte"),Md=e=>e.__isTeleport,Ws=e=>e&&(e.disabled||e.disabled===""),ql=e=>e&&(e.defer||e.defer===""),Kl=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Jl=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Ca=(e,t)=>{const n=e&&e.to;return Mt(n)?t?t(n):null:n},$d={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,u){const{mc:c,pc:f,pbc:m,o:{insert:T,querySelector:U,createText:P,createComment:F}}=u,R=Ws(t.props);let{shapeFlag:A,children:B,dynamicChildren:W}=t;if(e==null){const ce=t.el=P(""),me=t.anchor=P("");T(ce,n,r),T(me,n,r);const ve=(re,le)=>{A&16&&c(B,re,le,s,o,i,a,l)},Ie=()=>{const re=t.target=Ca(t.props,U),le=Aa(re,t,P,T);re&&(i!=="svg"&&Kl(re)?i="svg":i!=="mathml"&&Jl(re)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(re),R||(ve(re,le),Lo(t,!1)))};R&&(ve(n,me),Lo(t,!0)),ql(t.props)?(t.el.__isMounted=!1,en(()=>{Ie(),delete t.el.__isMounted},o)):Ie()}else{if(ql(t.props)&&e.el.__isMounted===!1){en(()=>{$d.process(e,t,n,r,s,o,i,a,l,u)},o);return}t.el=e.el,t.targetStart=e.targetStart;const ce=t.anchor=e.anchor,me=t.target=e.target,ve=t.targetAnchor=e.targetAnchor,Ie=Ws(e.props),re=Ie?n:me,le=Ie?ce:ve;if(i==="svg"||Kl(me)?i="svg":(i==="mathml"||Jl(me))&&(i="mathml"),W?(m(e.dynamicChildren,W,re,s,o,i,a),vl(e,t,!0)):l||f(e,t,re,le,s,o,i,a,!1),R)Ie?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Ro(t,n,ce,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const we=t.target=Ca(t.props,U);we&&Ro(t,we,null,u,0)}else Ie&&Ro(t,me,ve,u,1);Lo(t,R)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:u,targetAnchor:c,target:f,props:m}=e;if(f&&(s(u),s(c)),o&&s(l),i&16){const T=o||!Ws(m);for(let U=0;U<a.length;U++){const P=a[U];r(P,t,n,T,!!P.dynamicChildren)}}},move:Ro,hydrate:_p};function Ro(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:u,props:c}=e,f=o===2;if(f&&r(i,t,n),(!f||Ws(c))&&l&16)for(let m=0;m<u.length;m++)s(u[m],t,n,2);f&&r(a,t,n)}function _p(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:u,createText:c}},f){function m(F,R){let A=R;for(;A;){if(A&&A.nodeType===8){if(A.data==="teleport start anchor")t.targetStart=A;else if(A.data==="teleport anchor"){t.targetAnchor=A,F._lpa=t.targetAnchor&&i(t.targetAnchor);break}}A=i(A)}}function T(F,R){R.anchor=f(i(F),R,a(F),n,r,s,o)}const U=t.target=Ca(t.props,l),P=Ws(t.props);if(U){const F=U._lpa||U.firstChild;t.shapeFlag&16&&(P?(T(e,t),m(U,F),t.targetAnchor||Aa(U,t,c,u,a(e)===U?e:null)):(t.anchor=i(e),m(U,F),t.targetAnchor||Aa(U,t,c,u),f(F&&i(F),t,U,n,r,s,o))),Lo(t,P)}else P&&t.shapeFlag&16&&(T(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const Ko=$d;function Lo(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 Aa(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[xd]=i,e&&(r(o,e,s),r(i,e,s)),i}const Un=Symbol("_leaveCb"),Os=Symbol("_enterCb");function kp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return pr(()=>{e.isMounted=!0}),mr(()=>{e.isUnmounting=!0}),e}const Tn=[Function,Array],Od={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Tn,onEnter:Tn,onAfterEnter:Tn,onEnterCancelled:Tn,onBeforeLeave:Tn,onLeave:Tn,onAfterLeave:Tn,onLeaveCancelled:Tn,onBeforeAppear:Tn,onAppear:Tn,onAfterAppear:Tn,onAppearCancelled:Tn},Nd=e=>{const t=e.subTree;return t.component?Nd(t.component):t},Tp={name:"BaseTransition",props:Od,setup(e,{slots:t}){const n=wl(),r=kp();return()=>{const s=t.default&&jd(t.default(),!0);if(!s||!s.length)return;const o=Dd(s),i=dt(e),{mode:a}=i;if(r.isLeaving)return zi(o);const l=Yl(o);if(!l)return zi(o);let u=Ra(l,i,r,n,f=>u=f);l.type!==nn&&Zs(l,u);let c=n.subTree&&Yl(n.subTree);if(c&&c.type!==nn&&!Hr(c,l)&&Nd(n).type!==nn){let f=Ra(c,i,r,n);if(Zs(c,f),a==="out-in"&&l.type!==nn)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,c=void 0},zi(o);a==="in-out"&&l.type!==nn?f.delayLeave=(m,T,U)=>{const P=Ld(r,c);P[String(c.key)]=c,m[Un]=()=>{T(),m[Un]=void 0,delete u.delayedLeave,c=void 0},u.delayedLeave=()=>{U(),delete u.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return o}}};function Dd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==nn){t=n;break}}return t}const Sp=Tp;function Ld(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 Ra(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:c,onEnterCancelled:f,onBeforeLeave:m,onLeave:T,onAfterLeave:U,onLeaveCancelled:P,onBeforeAppear:F,onAppear:R,onAfterAppear:A,onAppearCancelled:B}=t,W=String(e.key),ce=Ld(n,e),me=(re,le)=>{re&&$n(re,r,9,le)},ve=(re,le)=>{const we=le[1];me(re,le),We(re)?re.every(Y=>Y.length<=1)&&we():re.length<=1&&we()},Ie={mode:i,persisted:a,beforeEnter(re){let le=l;if(!n.isMounted)if(o)le=F||l;else return;re[Un]&&re[Un](!0);const we=ce[W];we&&Hr(e,we)&&we.el[Un]&&we.el[Un](),me(le,[re])},enter(re){if(ce[W]===e)return;let le=u,we=c,Y=f;if(!n.isMounted)if(o)le=R||u,we=A||c,Y=B||f;else return;let Te=!1;re[Os]=Le=>{Te||(Te=!0,Le?me(Y,[re]):me(we,[re]),Ie.delayedLeave&&Ie.delayedLeave(),re[Os]=void 0)};const xe=re[Os].bind(null,!1);le?ve(le,[re,xe]):xe()},leave(re,le){const we=String(e.key);if(re[Os]&&re[Os](!0),n.isUnmounting)return le();me(m,[re]);let Y=!1;re[Un]=xe=>{Y||(Y=!0,le(),xe?me(P,[re]):me(U,[re]),re[Un]=void 0,ce[we]===e&&delete ce[we])};const Te=re[Un].bind(null,!1);ce[we]=e,T?ve(T,[re,Te]):Te()},clone(re){const le=Ra(re,t,n,r,s);return s&&s(le),le}};return Ie}function zi(e){if(mi(e))return e=Mr(e),e.children=null,e}function Yl(e){if(!mi(e))return Md(e.type)&&e.children?Dd(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&&Je(n.default))return n.default()}}function Zs(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Zs(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 jd(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===Be?(i.patchFlag&128&&s++,r=r.concat(jd(i.children,t,a))):(t||i.type!==nn)&&r.push(a!=null?Mr(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Ht(e,t){return Je(e)?Bt({name:e.name},t,{setup:e}):e}function Ud(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Xl(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Jo=new WeakMap;function Vs(e,t,n,r,s=!1){if(We(e)){e.forEach((P,F)=>Vs(P,t&&(We(t)?t[F]:t),n,r,s));return}if(fs(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Vs(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?bi(r.component):r.el,i=s?null:o,{i:a,r:l}=e,u=t&&t.r,c=a.refs===Ct?a.refs={}:a.refs,f=a.setupState,m=dt(f),T=f===Ct?Qu:P=>Xl(c,P)?!1:pt(m,P),U=(P,F)=>!(F&&Xl(c,F));if(u!=null&&u!==l){if(Ql(t),Mt(u))c[u]=null,T(u)&&(f[u]=null);else if(sn(u)){const P=t;U(u,P.k)&&(u.value=null),P.k&&(c[P.k]=null)}}if(Je(l))fo(l,a,12,[i,c]);else{const P=Mt(l),F=sn(l);if(P||F){const R=()=>{if(e.f){const A=P?T(l)?f[l]:c[l]:U()||!e.k?l.value:c[e.k];if(s)We(A)&&rl(A,o);else if(We(A))A.includes(o)||A.push(o);else if(P)c[l]=[o],T(l)&&(f[l]=c[l]);else{const B=[o];U(l,e.k)&&(l.value=B),e.k&&(c[e.k]=B)}}else P?(c[l]=i,T(l)&&(f[l]=i)):F&&(U(l,e.k)&&(l.value=i),e.k&&(c[e.k]=i))};if(i){const A=()=>{R(),Jo.delete(e)};A.id=-1,Jo.set(e,A),en(A,n)}else Ql(e),R()}}}function Ql(e){const t=Jo.get(e);t&&(t.flags|=8,Jo.delete(e))}di().requestIdleCallback;di().cancelIdleCallback;const fs=e=>!!e.type.__asyncLoader,mi=e=>e.type.__isKeepAlive;function Ip(e,t){Fd(e,"a",t)}function Ep(e,t){Fd(e,"da",t)}function Fd(e,t,n=rn){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(gi(t,r,n),n){let s=n.parent;for(;s&&s.parent;)mi(s.parent.vnode)&&Cp(r,t,n,s),s=s.parent}}function Cp(e,t,n,r){const s=gi(t,e,r,!0);vi(()=>{rl(r[t],s)},n)}function gi(e,t,n=rn,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{ir();const a=ho(n),l=$n(t,n,e,i);return a(),ar(),l});return r?s.unshift(o):s.push(o),o}}const hr=e=>(t,n=rn)=>{(!ro||e==="sp")&&gi(e,(...r)=>t(...r),n)},Ap=hr("bm"),pr=hr("m"),Rp=hr("bu"),Pp=hr("u"),mr=hr("bum"),vi=hr("um"),xp=hr("sp"),Mp=hr("rtg"),$p=hr("rtc");function Op(e,t=rn){gi("ec",e,t)}const Np="components",Bd=Symbol.for("v-ndc");function Yo(e){return Mt(e)?Dp(Np,e,!1)||e:e||Bd}function Dp(e,t,n=!0,r=!1){const s=Xt||rn;if(s){const o=s.type;{const a=bm(o,!1);if(a&&(a===t||a===fn(t)||a===ui(fn(t))))return o}const i=Zl(s[e]||o[e],t)||Zl(s.appContext[e],t);return!i&&r?o:i}}function Zl(e,t){return e&&(e[t]||e[fn(t)]||e[ui(fn(t))])}function St(e,t,n,r){let s;const o=n,i=We(e);if(i||Mt(e)){const a=i&&qr(e);let l=!1,u=!1;a&&(l=!In(e),u=lr(e),e=fi(e)),s=new Array(e.length);for(let c=0,f=e.length;c<f;c++)s[c]=t(l?u?ys(Mn(e[c])):Mn(e[c]):e[c],c,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(mt(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,u=a.length;l<u;l++){const c=a[l];s[l]=t(e[c],c,l,o)}}else s=[];return s}function Gn(e,t,n={},r,s){if(Xt.ce||Xt.parent&&fs(Xt.parent)&&Xt.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),w(),ft(Be,null,[Re("slot",n,r)],u?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),w();const i=o&&Hd(o(n)),a=n.key||i&&i.key,l=ft(Be,{key:(a&&!xn(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function Hd(e){return e.some(t=>to(t)?!(t.type===nn||t.type===Be&&!Hd(t.children)):!0)?e:null}const Pa=e=>e?cf(e)?bi(e):Pa(e.parent):null,Gs=Bt(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=>Pa(e.parent),$root:e=>Pa(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Vd(e),$forceUpdate:e=>e.f||(e.f=()=>{pl(e.update)}),$nextTick:e=>e.n||(e.n=Yt.bind(e.proxy)),$watch:e=>bp.bind(e)}),qi=(e,t)=>e!==Ct&&!e.__isScriptSetup&&pt(e,t),Lp={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 m=i[t];if(m!==void 0)switch(m){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if(qi(r,t))return i[t]=1,r[t];if(s!==Ct&&pt(s,t))return i[t]=2,s[t];if(pt(o,t))return i[t]=3,o[t];if(n!==Ct&&pt(n,t))return i[t]=4,n[t];xa&&(i[t]=0)}}const u=Gs[t];let c,f;if(u)return t==="$attrs"&&tn(e.attrs,"get",""),u(e);if((c=a.__cssModules)&&(c=c[t]))return c;if(n!==Ct&&pt(n,t))return i[t]=4,n[t];if(f=l.config.globalProperties,pt(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return qi(s,t)?(s[t]=n,!0):r!==Ct&&pt(r,t)?(r[t]=n,!0):pt(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!==Ct&&a[0]!=="$"&&pt(e,a)||qi(t,a)||pt(o,a)||pt(r,a)||pt(Gs,a)||pt(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:pt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function jp(){return Up().slots}function Up(e){const t=wl();return t.setupContext||(t.setupContext=df(t))}function ec(e){return We(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let xa=!0;function Fp(e){const t=Vd(e),n=e.proxy,r=e.ctx;xa=!1,t.beforeCreate&&tc(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:u,created:c,beforeMount:f,mounted:m,beforeUpdate:T,updated:U,activated:P,deactivated:F,beforeDestroy:R,beforeUnmount:A,destroyed:B,unmounted:W,render:ce,renderTracked:me,renderTriggered:ve,errorCaptured:Ie,serverPrefetch:re,expose:le,inheritAttrs:we,components:Y,directives:Te,filters:xe}=t;if(u&&Bp(u,r,null),i)for(const Oe in i){const Ee=i[Oe];Je(Ee)&&(r[Oe]=Ee.bind(n))}if(s){const Oe=s.call(n,n);mt(Oe)&&(e.data=hi(Oe))}if(xa=!0,o)for(const Oe in o){const Ee=o[Oe],Ye=Je(Ee)?Ee.bind(n,n):Je(Ee.get)?Ee.get.bind(n,n):zn,Ze=!Je(Ee)&&Je(Ee.set)?Ee.set.bind(n):zn,Ne=fe({get:Ye,set:Ze});Object.defineProperty(r,Oe,{enumerable:!0,configurable:!0,get:()=>Ne.value,set:nt=>Ne.value=nt})}if(a)for(const Oe in a)Wd(a[Oe],r,n,Oe);if(l){const Oe=Je(l)?l.call(n):l;Reflect.ownKeys(Oe).forEach(Ee=>{Do(Ee,Oe[Ee])})}c&&tc(c,e,"c");function Pe(Oe,Ee){We(Ee)?Ee.forEach(Ye=>Oe(Ye.bind(n))):Ee&&Oe(Ee.bind(n))}if(Pe(Ap,f),Pe(pr,m),Pe(Rp,T),Pe(Pp,U),Pe(Ip,P),Pe(Ep,F),Pe(Op,Ie),Pe($p,me),Pe(Mp,ve),Pe(mr,A),Pe(vi,W),Pe(xp,re),We(le))if(le.length){const Oe=e.exposed||(e.exposed={});le.forEach(Ee=>{Object.defineProperty(Oe,Ee,{get:()=>n[Ee],set:Ye=>n[Ee]=Ye,enumerable:!0})})}else e.exposed||(e.exposed={});ce&&e.render===zn&&(e.render=ce),we!=null&&(e.inheritAttrs=we),Y&&(e.components=Y),Te&&(e.directives=Te),re&&Ud(e)}function Bp(e,t,n=zn){We(e)&&(e=Ma(e));for(const r in e){const s=e[r];let o;mt(s)?"default"in s?o=Rn(s.from||r,s.default,!0):o=Rn(s.from||r):o=Rn(s),sn(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function tc(e,t,n){$n(We(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Wd(e,t,n,r){let s=r.includes(".")?Pd(n,r):()=>n[r];if(Mt(e)){const o=t[e];Je(o)&&ut(s,o)}else if(Je(e))ut(s,e.bind(n));else if(mt(e))if(We(e))e.forEach(o=>Wd(o,t,n,r));else{const o=Je(e.handler)?e.handler.bind(n):t[e.handler];Je(o)&&ut(s,o,e)}}function Vd(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(u=>Xo(l,u,i,!0)),Xo(l,t,i)),mt(t)&&o.set(t,l),l}function Xo(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&Xo(e,o,n,!0),s&&s.forEach(i=>Xo(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=Hp[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const Hp={data:nc,props:rc,emits:rc,methods:Us,computed:Us,beforeCreate:ln,created:ln,beforeMount:ln,mounted:ln,beforeUpdate:ln,updated:ln,beforeDestroy:ln,beforeUnmount:ln,destroyed:ln,unmounted:ln,activated:ln,deactivated:ln,errorCaptured:ln,serverPrefetch:ln,components:Us,directives:Us,watch:Vp,provide:nc,inject:Wp};function nc(e,t){return t?e?function(){return Bt(Je(e)?e.call(this,this):e,Je(t)?t.call(this,this):t)}:t:e}function Wp(e,t){return Us(Ma(e),Ma(t))}function Ma(e){if(We(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function ln(e,t){return e?[...new Set([].concat(e,t))]:t}function Us(e,t){return e?Bt(Object.create(null),e,t):t}function rc(e,t){return e?We(e)&&We(t)?[...new Set([...e,...t])]:Bt(Object.create(null),ec(e),ec(t??{})):t}function Vp(e,t){if(!e)return t;if(!t)return e;const n=Bt(Object.create(null),e);for(const r in t)n[r]=ln(e[r],t[r]);return n}function Gd(){return{app:null,config:{isNativeTag:Qu,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 Gp=0;function zp(e,t){return function(r,s=null){Je(r)||(r=Bt({},r)),s!=null&&!mt(s)&&(s=null);const o=Gd(),i=new WeakSet,a=[];let l=!1;const u=o.app={_uid:Gp++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:km,get config(){return o.config},set config(c){},use(c,...f){return i.has(c)||(c&&Je(c.install)?(i.add(c),c.install(u,...f)):Je(c)&&(i.add(c),c(u,...f))),u},mixin(c){return o.mixins.includes(c)||o.mixins.push(c),u},component(c,f){return f?(o.components[c]=f,u):o.components[c]},directive(c,f){return f?(o.directives[c]=f,u):o.directives[c]},mount(c,f,m){if(!l){const T=u._ceVNode||Re(r,s);return T.appContext=o,m===!0?m="svg":m===!1&&(m=void 0),e(T,c,m),l=!0,u._container=c,c.__vue_app__=u,bi(T.component)}},onUnmount(c){a.push(c)},unmount(){l&&($n(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(c,f){return o.provides[c]=f,u},runWithContext(c){const f=hs;hs=u;try{return c()}finally{hs=f}}};return u}}let hs=null;const qp=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${fn(t)}Modifiers`]||e[`${$r(t)}Modifiers`];function Kp(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Ct;let s=n;const o=t.startsWith("update:"),i=o&&qp(r,t.slice(7));i&&(i.trim&&(s=n.map(c=>Mt(c)?c.trim():c)),i.number&&(s=n.map(ol)));let a,l=r[a=Bi(t)]||r[a=Bi(fn(t))];!l&&o&&(l=r[a=Bi($r(t))]),l&&$n(l,e,6,s);const u=r[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,$n(u,e,6,s)}}const Jp=new WeakMap;function zd(e,t,n=!1){const r=n?Jp:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!Je(e)){const l=u=>{const c=zd(u,t,!0);c&&(a=!0,Bt(i,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(mt(e)&&r.set(e,null),null):(We(o)?o.forEach(l=>i[l]=null):Bt(i,o),mt(e)&&r.set(e,i),i)}function yi(e,t){return!e||!li(t)?!1:(t=t.slice(2).replace(/Once$/,""),pt(e,t[0].toLowerCase()+t.slice(1))||pt(e,$r(t))||pt(e,t))}function sc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:u,renderCache:c,props:f,data:m,setupState:T,ctx:U,inheritAttrs:P}=e,F=qo(e);let R,A;try{if(n.shapeFlag&4){const W=s||r,ce=W;R=Bn(u.call(ce,W,c,f,T,m,U)),A=a}else{const W=t;R=Bn(W.length>1?W(f,{attrs:a,slots:i,emit:l}):W(f,null)),A=t.props?a:Yp(a)}}catch(W){zs.length=0,pi(W,e,1),R=Re(nn)}let B=R;if(A&&P!==!1){const W=Object.keys(A),{shapeFlag:ce}=B;W.length&&ce&7&&(o&&W.some(nl)&&(A=Xp(A,o)),B=Mr(B,A,!1,!0))}return n.dirs&&(B=Mr(B,null,!1,!0),B.dirs=B.dirs?B.dirs.concat(n.dirs):n.dirs),n.transition&&Zs(B,n.transition),R=B,qo(F),R}const Yp=e=>{let t;for(const n in e)(n==="class"||n==="style"||li(n))&&((t||(t={}))[n]=e[n]);return t},Xp=(e,t)=>{const n={};for(const r in e)(!nl(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Qp(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,u=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?oc(r,i,u):!!i;if(l&8){const c=t.dynamicProps;for(let f=0;f<c.length;f++){const m=c[f];if(qd(i,r,m)&&!yi(u,m))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?oc(r,i,u):!0:!!i;return!1}function oc(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(qd(t,e,o)&&!yi(n,o))return!0}return!1}function qd(e,t,n){const r=e[n],s=t[n];return n==="style"&&mt(r)&&mt(s)?!il(r,s):r!==s}function Zp({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 Kd={},Jd=()=>Object.create(Kd),Yd=e=>Object.getPrototypeOf(e)===Kd;function em(e,t,n,r=!1){const s={},o=Jd();e.propsDefaults=Object.create(null),Xd(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:_d(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function tm(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=dt(s),[l]=e.propsOptions;let u=!1;if((r||i>0)&&!(i&16)){if(i&8){const c=e.vnode.dynamicProps;for(let f=0;f<c.length;f++){let m=c[f];if(yi(e.emitsOptions,m))continue;const T=t[m];if(l)if(pt(o,m))T!==o[m]&&(o[m]=T,u=!0);else{const U=fn(m);s[U]=$a(l,a,U,T,e,!1)}else T!==o[m]&&(o[m]=T,u=!0)}}}else{Xd(e,t,s,o)&&(u=!0);let c;for(const f in a)(!t||!pt(t,f)&&((c=$r(f))===f||!pt(t,c)))&&(l?n&&(n[f]!==void 0||n[c]!==void 0)&&(s[f]=$a(l,a,f,void 0,e,!0)):delete s[f]);if(o!==a)for(const f in o)(!t||!pt(t,f))&&(delete o[f],u=!0)}u&&tr(e.attrs,"set","")}function Xd(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(Fs(l))continue;const u=t[l];let c;s&&pt(s,c=fn(l))?!o||!o.includes(c)?n[c]=u:(a||(a={}))[c]=u:yi(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,i=!0)}if(o){const l=dt(n),u=a||Ct;for(let c=0;c<o.length;c++){const f=o[c];n[f]=$a(s,l,f,u[f],e,!pt(u,f))}}return i}function $a(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=pt(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&Je(l)){const{propsDefaults:u}=s;if(n in u)r=u[n];else{const c=ho(s);r=u[n]=l.call(null,t),c()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===$r(n))&&(r=!0))}return r}const nm=new WeakMap;function Qd(e,t,n=!1){const r=n?nm:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!Je(e)){const c=f=>{l=!0;const[m,T]=Qd(f,t,!0);Bt(i,m),T&&a.push(...T)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!o&&!l)return mt(e)&&r.set(e,cs),cs;if(We(o))for(let c=0;c<o.length;c++){const f=fn(o[c]);ic(f)&&(i[f]=Ct)}else if(o)for(const c in o){const f=fn(c);if(ic(f)){const m=o[c],T=i[f]=We(m)||Je(m)?{type:m}:Bt({},m),U=T.type;let P=!1,F=!0;if(We(U))for(let R=0;R<U.length;++R){const A=U[R],B=Je(A)&&A.name;if(B==="Boolean"){P=!0;break}else B==="String"&&(F=!1)}else P=Je(U)&&U.name==="Boolean";T[0]=P,T[1]=F,(P||pt(T,"default"))&&a.push(f)}}const u=[i,a];return mt(e)&&r.set(e,u),u}function ic(e){return e[0]!=="$"&&!Fs(e)}const ml=e=>e==="_"||e==="_ctx"||e==="$stable",gl=e=>We(e)?e.map(Bn):[Bn(e)],rm=(e,t,n)=>{if(t._n)return t;const r=_t((...s)=>gl(t(...s)),n);return r._c=!1,r},Zd=(e,t,n)=>{const r=e._ctx;for(const s in e){if(ml(s))continue;const o=e[s];if(Je(o))t[s]=rm(s,o,r);else if(o!=null){const i=gl(o);t[s]=()=>i}}},ef=(e,t)=>{const n=gl(t);e.slots.default=()=>n},tf=(e,t,n)=>{for(const r in t)(n||!ml(r))&&(e[r]=t[r])},sm=(e,t,n)=>{const r=e.slots=Jd();if(e.vnode.shapeFlag&32){const s=t._;s?(tf(r,t,n),n&&rd(r,"_",s,!0)):Zd(t,r)}else t&&ef(e,t)},om=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=Ct;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:tf(s,t,n):(o=!t.$stable,Zd(t,s)),i=t}else t&&(ef(e,t),i={default:1});if(o)for(const a in s)!ml(a)&&i[a]==null&&delete s[a]},en=um;function im(e){return am(e)}function am(e,t){const n=di();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:u,setElementText:c,parentNode:f,nextSibling:m,setScopeId:T=zn,insertStaticContent:U}=e,P=(g,b,x,q=null,G=null,N=null,V=void 0,J=null,Q=!!b.dynamicChildren)=>{if(g===b)return;g&&!Hr(g,b)&&(q=K(g),nt(g,G,N,!0),g=null),b.patchFlag===-2&&(Q=!1,b.dynamicChildren=null);const{type:z,ref:_e,shapeFlag:de}=b;switch(z){case wi:F(g,b,x,q);break;case nn:R(g,b,x,q);break;case Ji:g==null&&A(b,x,q,V);break;case Be:Y(g,b,x,q,G,N,V,J,Q);break;default:de&1?ce(g,b,x,q,G,N,V,J,Q):de&6?Te(g,b,x,q,G,N,V,J,Q):(de&64||de&128)&&z.process(g,b,x,q,G,N,V,J,Q,be)}_e!=null&&G?Vs(_e,g&&g.ref,N,b||g,!b):_e==null&&g&&g.ref!=null&&Vs(g.ref,null,N,g,!0)},F=(g,b,x,q)=>{if(g==null)r(b.el=a(b.children),x,q);else{const G=b.el=g.el;b.children!==g.children&&u(G,b.children)}},R=(g,b,x,q)=>{g==null?r(b.el=l(b.children||""),x,q):b.el=g.el},A=(g,b,x,q)=>{[g.el,g.anchor]=U(g.children,b,x,q,g.el,g.anchor)},B=({el:g,anchor:b},x,q)=>{let G;for(;g&&g!==b;)G=m(g),r(g,x,q),g=G;r(b,x,q)},W=({el:g,anchor:b})=>{let x;for(;g&&g!==b;)x=m(g),s(g),g=x;s(b)},ce=(g,b,x,q,G,N,V,J,Q)=>{if(b.type==="svg"?V="svg":b.type==="math"&&(V="mathml"),g==null)me(b,x,q,G,N,V,J,Q);else{const z=g.el&&g.el._isVueCE?g.el:null;try{z&&z._beginPatch(),re(g,b,G,N,V,J,Q)}finally{z&&z._endPatch()}}},me=(g,b,x,q,G,N,V,J)=>{let Q,z;const{props:_e,shapeFlag:de,transition:Se,dirs:Me}=g;if(Q=g.el=i(g.type,N,_e&&_e.is,_e),de&8?c(Q,g.children):de&16&&Ie(g.children,Q,null,q,G,Ki(g,N),V,J),Me&&Nr(g,null,q,"created"),ve(Q,g,g.scopeId,V,q),_e){for(const Fe in _e)Fe!=="value"&&!Fs(Fe)&&o(Q,Fe,null,_e[Fe],N,q);"value"in _e&&o(Q,"value",null,_e.value,N),(z=_e.onVnodeBeforeMount)&&Ln(z,q,g)}Me&&Nr(g,null,q,"beforeMount");const De=lm(G,Se);De&&Se.beforeEnter(Q),r(Q,b,x),((z=_e&&_e.onVnodeMounted)||De||Me)&&en(()=>{z&&Ln(z,q,g),De&&Se.enter(Q),Me&&Nr(g,null,q,"mounted")},G)},ve=(g,b,x,q,G)=>{if(x&&T(g,x),q)for(let N=0;N<q.length;N++)T(g,q[N]);if(G){let N=G.subTree;if(b===N||sf(N.type)&&(N.ssContent===b||N.ssFallback===b)){const V=G.vnode;ve(g,V,V.scopeId,V.slotScopeIds,G.parent)}}},Ie=(g,b,x,q,G,N,V,J,Q=0)=>{for(let z=Q;z<g.length;z++){const _e=g[z]=J?er(g[z]):Bn(g[z]);P(null,_e,b,x,q,G,N,V,J)}},re=(g,b,x,q,G,N,V)=>{const J=b.el=g.el;let{patchFlag:Q,dynamicChildren:z,dirs:_e}=b;Q|=g.patchFlag&16;const de=g.props||Ct,Se=b.props||Ct;let Me;if(x&&Dr(x,!1),(Me=Se.onVnodeBeforeUpdate)&&Ln(Me,x,b,g),_e&&Nr(b,g,x,"beforeUpdate"),x&&Dr(x,!0),(de.innerHTML&&Se.innerHTML==null||de.textContent&&Se.textContent==null)&&c(J,""),z?le(g.dynamicChildren,z,J,x,q,Ki(b,G),N):V||Ee(g,b,J,null,x,q,Ki(b,G),N,!1),Q>0){if(Q&16)we(J,de,Se,x,G);else if(Q&2&&de.class!==Se.class&&o(J,"class",null,Se.class,G),Q&4&&o(J,"style",de.style,Se.style,G),Q&8){const De=b.dynamicProps;for(let Fe=0;Fe<De.length;Fe++){const He=De[Fe],ot=de[He],tt=Se[He];(tt!==ot||He==="value")&&o(J,He,ot,tt,G,x)}}Q&1&&g.children!==b.children&&c(J,b.children)}else!V&&z==null&&we(J,de,Se,x,G);((Me=Se.onVnodeUpdated)||_e)&&en(()=>{Me&&Ln(Me,x,b,g),_e&&Nr(b,g,x,"updated")},q)},le=(g,b,x,q,G,N,V)=>{for(let J=0;J<b.length;J++){const Q=g[J],z=b[J],_e=Q.el&&(Q.type===Be||!Hr(Q,z)||Q.shapeFlag&198)?f(Q.el):x;P(Q,z,_e,null,q,G,N,V,!0)}},we=(g,b,x,q,G)=>{if(b!==x){if(b!==Ct)for(const N in b)!Fs(N)&&!(N in x)&&o(g,N,b[N],null,G,q);for(const N in x){if(Fs(N))continue;const V=x[N],J=b[N];V!==J&&N!=="value"&&o(g,N,J,V,G,q)}"value"in x&&o(g,"value",b.value,x.value,G)}},Y=(g,b,x,q,G,N,V,J,Q)=>{const z=b.el=g?g.el:a(""),_e=b.anchor=g?g.anchor:a("");let{patchFlag:de,dynamicChildren:Se,slotScopeIds:Me}=b;Me&&(J=J?J.concat(Me):Me),g==null?(r(z,x,q),r(_e,x,q),Ie(b.children||[],x,_e,G,N,V,J,Q)):de>0&&de&64&&Se&&g.dynamicChildren&&g.dynamicChildren.length===Se.length?(le(g.dynamicChildren,Se,x,G,N,V,J),(b.key!=null||G&&b===G.subTree)&&vl(g,b,!0)):Ee(g,b,x,_e,G,N,V,J,Q)},Te=(g,b,x,q,G,N,V,J,Q)=>{b.slotScopeIds=J,g==null?b.shapeFlag&512?G.ctx.activate(b,x,q,V,Q):xe(b,x,q,G,N,V,Q):Le(g,b,Q)},xe=(g,b,x,q,G,N,V)=>{const J=g.component=gm(g,q,G);if(mi(g)&&(J.ctx.renderer=be),vm(J,!1,V),J.asyncDep){if(G&&G.registerDep(J,Pe,V),!g.el){const Q=J.subTree=Re(nn);R(null,Q,b,x),g.placeholder=Q.el}}else Pe(J,g,b,x,G,N,V)},Le=(g,b,x)=>{const q=b.component=g.component;if(Qp(g,b,x))if(q.asyncDep&&!q.asyncResolved){Oe(q,b,x);return}else q.next=b,q.update();else b.el=g.el,q.vnode=b},Pe=(g,b,x,q,G,N,V)=>{const J=()=>{if(g.isMounted){let{next:de,bu:Se,u:Me,parent:De,vnode:Fe}=g;{const yt=nf(g);if(yt){de&&(de.el=Fe.el,Oe(g,de,V)),yt.asyncDep.then(()=>{en(()=>{g.isUnmounted||z()},G)});return}}let He=de,ot;Dr(g,!1),de?(de.el=Fe.el,Oe(g,de,V)):de=Fe,Se&&No(Se),(ot=de.props&&de.props.onVnodeBeforeUpdate)&&Ln(ot,De,de,Fe),Dr(g,!0);const tt=sc(g),vt=g.subTree;g.subTree=tt,P(vt,tt,f(vt.el),K(vt),g,G,N),de.el=tt.el,He===null&&Zp(g,tt.el),Me&&en(Me,G),(ot=de.props&&de.props.onVnodeUpdated)&&en(()=>Ln(ot,De,de,Fe),G)}else{let de;const{el:Se,props:Me}=b,{bm:De,m:Fe,parent:He,root:ot,type:tt}=g,vt=fs(b);Dr(g,!1),De&&No(De),!vt&&(de=Me&&Me.onVnodeBeforeMount)&&Ln(de,He,b),Dr(g,!0);{ot.ce&&ot.ce._hasShadowRoot()&&ot.ce._injectChildStyle(tt,g.parent?g.parent.type:void 0);const yt=g.subTree=sc(g);P(null,yt,x,q,g,G,N),b.el=yt.el}if(Fe&&en(Fe,G),!vt&&(de=Me&&Me.onVnodeMounted)){const yt=b;en(()=>Ln(de,He,yt),G)}(b.shapeFlag&256||He&&fs(He.vnode)&&He.vnode.shapeFlag&256)&&g.a&&en(g.a,G),g.isMounted=!0,b=x=q=null}};g.scope.on();const Q=g.effect=new ad(J);g.scope.off();const z=g.update=Q.run.bind(Q),_e=g.job=Q.runIfDirty.bind(Q);_e.i=g,_e.id=g.uid,Q.scheduler=()=>pl(_e),Dr(g,!0),z()},Oe=(g,b,x)=>{b.component=g;const q=g.vnode.props;g.vnode=b,g.next=null,tm(g,b.props,q,x),om(g,b.children,x),ir(),zl(g),ar()},Ee=(g,b,x,q,G,N,V,J,Q=!1)=>{const z=g&&g.children,_e=g?g.shapeFlag:0,de=b.children,{patchFlag:Se,shapeFlag:Me}=b;if(Se>0){if(Se&128){Ze(z,de,x,q,G,N,V,J,Q);return}else if(Se&256){Ye(z,de,x,q,G,N,V,J,Q);return}}Me&8?(_e&16&&Xe(z,G,N),de!==z&&c(x,de)):_e&16?Me&16?Ze(z,de,x,q,G,N,V,J,Q):Xe(z,G,N,!0):(_e&8&&c(x,""),Me&16&&Ie(de,x,q,G,N,V,J,Q))},Ye=(g,b,x,q,G,N,V,J,Q)=>{g=g||cs,b=b||cs;const z=g.length,_e=b.length,de=Math.min(z,_e);let Se;for(Se=0;Se<de;Se++){const Me=b[Se]=Q?er(b[Se]):Bn(b[Se]);P(g[Se],Me,x,null,G,N,V,J,Q)}z>_e?Xe(g,G,N,!0,!1,de):Ie(b,x,q,G,N,V,J,Q,de)},Ze=(g,b,x,q,G,N,V,J,Q)=>{let z=0;const _e=b.length;let de=g.length-1,Se=_e-1;for(;z<=de&&z<=Se;){const Me=g[z],De=b[z]=Q?er(b[z]):Bn(b[z]);if(Hr(Me,De))P(Me,De,x,null,G,N,V,J,Q);else break;z++}for(;z<=de&&z<=Se;){const Me=g[de],De=b[Se]=Q?er(b[Se]):Bn(b[Se]);if(Hr(Me,De))P(Me,De,x,null,G,N,V,J,Q);else break;de--,Se--}if(z>de){if(z<=Se){const Me=Se+1,De=Me<_e?b[Me].el:q;for(;z<=Se;)P(null,b[z]=Q?er(b[z]):Bn(b[z]),x,De,G,N,V,J,Q),z++}}else if(z>Se)for(;z<=de;)nt(g[z],G,N,!0),z++;else{const Me=z,De=z,Fe=new Map;for(z=De;z<=Se;z++){const kt=b[z]=Q?er(b[z]):Bn(b[z]);kt.key!=null&&Fe.set(kt.key,z)}let He,ot=0;const tt=Se-De+1;let vt=!1,yt=0;const jt=new Array(tt);for(z=0;z<tt;z++)jt[z]=0;for(z=Me;z<=de;z++){const kt=g[z];if(ot>=tt){nt(kt,G,N,!0);continue}let Rt;if(kt.key!=null)Rt=Fe.get(kt.key);else for(He=De;He<=Se;He++)if(jt[He-De]===0&&Hr(kt,b[He])){Rt=He;break}Rt===void 0?nt(kt,G,N,!0):(jt[Rt-De]=z+1,Rt>=yt?yt=Rt:vt=!0,P(kt,b[Rt],x,null,G,N,V,J,Q),ot++)}const zt=vt?cm(jt):cs;for(He=zt.length-1,z=tt-1;z>=0;z--){const kt=De+z,Rt=b[kt],wt=b[kt+1],Dt=kt+1<_e?wt.el||rf(wt):q;jt[z]===0?P(null,Rt,x,Dt,G,N,V,J,Q):vt&&(He<0||z!==zt[He]?Ne(Rt,x,Dt,2):He--)}}},Ne=(g,b,x,q,G=null)=>{const{el:N,type:V,transition:J,children:Q,shapeFlag:z}=g;if(z&6){Ne(g.component.subTree,b,x,q);return}if(z&128){g.suspense.move(b,x,q);return}if(z&64){V.move(g,b,x,be);return}if(V===Be){r(N,b,x);for(let de=0;de<Q.length;de++)Ne(Q[de],b,x,q);r(g.anchor,b,x);return}if(V===Ji){B(g,b,x);return}if(q!==2&&z&1&&J)if(q===0)J.beforeEnter(N),r(N,b,x),en(()=>J.enter(N),G);else{const{leave:de,delayLeave:Se,afterLeave:Me}=J,De=()=>{g.ctx.isUnmounted?s(N):r(N,b,x)},Fe=()=>{N._isLeaving&&N[Un](!0),de(N,()=>{De(),Me&&Me()})};Se?Se(N,De,Fe):Fe()}else r(N,b,x)},nt=(g,b,x,q=!1,G=!1)=>{const{type:N,props:V,ref:J,children:Q,dynamicChildren:z,shapeFlag:_e,patchFlag:de,dirs:Se,cacheIndex:Me}=g;if(de===-2&&(G=!1),J!=null&&(ir(),Vs(J,null,x,g,!0),ar()),Me!=null&&(b.renderCache[Me]=void 0),_e&256){b.ctx.deactivate(g);return}const De=_e&1&&Se,Fe=!fs(g);let He;if(Fe&&(He=V&&V.onVnodeBeforeUnmount)&&Ln(He,b,g),_e&6)et(g.component,x,q);else{if(_e&128){g.suspense.unmount(x,q);return}De&&Nr(g,null,b,"beforeUnmount"),_e&64?g.type.remove(g,b,x,be,q):z&&!z.hasOnce&&(N!==Be||de>0&&de&64)?Xe(z,b,x,!1,!0):(N===Be&&de&384||!G&&_e&16)&&Xe(Q,b,x),q&>(g)}(Fe&&(He=V&&V.onVnodeUnmounted)||De)&&en(()=>{He&&Ln(He,b,g),De&&Nr(g,null,b,"unmounted")},x)},gt=g=>{const{type:b,el:x,anchor:q,transition:G}=g;if(b===Be){at(x,q);return}if(b===Ji){W(g);return}const N=()=>{s(x),G&&!G.persisted&&G.afterLeave&&G.afterLeave()};if(g.shapeFlag&1&&G&&!G.persisted){const{leave:V,delayLeave:J}=G,Q=()=>V(x,N);J?J(g.el,N,Q):Q()}else N()},at=(g,b)=>{let x;for(;g!==b;)x=m(g),s(g),g=x;s(b)},et=(g,b,x)=>{const{bum:q,scope:G,job:N,subTree:V,um:J,m:Q,a:z}=g;ac(Q),ac(z),q&&No(q),G.stop(),N&&(N.flags|=8,nt(V,g,b,x)),J&&en(J,b),en(()=>{g.isUnmounted=!0},b)},Xe=(g,b,x,q=!1,G=!1,N=0)=>{for(let V=N;V<g.length;V++)nt(g[V],b,x,q,G)},K=g=>{if(g.shapeFlag&6)return K(g.component.subTree);if(g.shapeFlag&128)return g.suspense.next();const b=m(g.anchor||g.el),x=b&&b[xd];return x?m(x):b};let he=!1;const ue=(g,b,x)=>{let q;g==null?b._vnode&&(nt(b._vnode,null,null,!0),q=b._vnode.component):P(b._vnode||null,g,b,null,null,null,x),b._vnode=g,he||(he=!0,zl(q),Ed(),he=!1)},be={p:P,um:nt,m:Ne,r:gt,mt:xe,mc:Ie,pc:Ee,pbc:le,n:K,o:e};return{render:ue,hydrate:void 0,createApp:zp(ue)}}function Ki({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 Dr({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function lm(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function vl(e,t,n=!1){const r=e.children,s=t.children;if(We(r)&&We(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]=er(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&vl(i,a)),a.type===wi&&(a.patchFlag===-1&&(a=s[o]=er(a)),a.el=i.el),a.type===nn&&!a.el&&(a.el=i.el)}}function cm(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(s=n[n.length-1],e[s]<u){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<u?o=a+1:i=a;u<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 nf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:nf(t)}function ac(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function rf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?rf(t.subTree):null}const sf=e=>e.__isSuspense;function um(e,t){t&&t.pendingBranch?We(e)?t.effects.push(...e):t.effects.push(e):vp(e)}const Be=Symbol.for("v-fgt"),wi=Symbol.for("v-txt"),nn=Symbol.for("v-cmt"),Ji=Symbol.for("v-stc"),zs=[];let vn=null;function w(e=!1){zs.push(vn=e?null:[])}function dm(){zs.pop(),vn=zs[zs.length-1]||null}let eo=1;function Qo(e,t=!1){eo+=e,e<0&&vn&&t&&(vn.hasOnce=!0)}function of(e){return e.dynamicChildren=eo>0?vn||cs:null,dm(),eo>0&&vn&&vn.push(e),e}function k(e,t,n,r,s,o){return of(p(e,t,n,r,s,o,!0))}function ft(e,t,n,r,s){return of(Re(e,t,n,r,s,!0))}function to(e){return e?e.__v_isVNode===!0:!1}function Hr(e,t){return e.type===t.type&&e.key===t.key}const af=({key:e})=>e??null,jo=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Mt(e)||sn(e)||Je(e)?{i:Xt,r:e,k:t,f:!!n}:e:null);function p(e,t=null,n=null,r=0,s=null,o=e===Be?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&af(t),ref:t&&jo(t),scopeId:Ad,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:Xt};return a?(yl(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=Mt(n)?8:16),eo>0&&!i&&vn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&vn.push(l),l}const Re=fm;function fm(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===Bd)&&(e=nn),to(e)){const a=Mr(e,t,!0);return n&&yl(a,n),eo>0&&!o&&vn&&(a.shapeFlag&6?vn[vn.indexOf(e)]=a:vn.push(a)),a.patchFlag=-2,a}if(_m(e)&&(e=e.__vccOpts),t){t=hm(t);let{class:a,style:l}=t;a&&!Mt(a)&&(t.class=it(a)),mt(l)&&(hl(l)&&!We(l)&&(l=Bt({},l)),t.style=Jr(l))}const i=Mt(e)?1:sf(e)?128:Md(e)?64:mt(e)?4:Je(e)?2:0;return p(e,t,n,r,s,i,o,!0)}function hm(e){return e?hl(e)||Yd(e)?Bt({},e):e:null}function Mr(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,u=t?lf(s||{},t):s,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&af(u),ref:t&&t.ref?n&&o?We(o)?o.concat(jo(t)):[o,jo(t)]:jo(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!==Be?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&&Mr(e.ssContent),ssFallback:e.ssFallback&&Mr(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Zs(c,l.clone(c)),c}function no(e=" ",t=0){return Re(wi,null,e,t)}function ae(e="",t=!1){return t?(w(),ft(nn,null,e)):Re(nn,null,e)}function Bn(e){return e==null||typeof e=="boolean"?Re(nn):We(e)?Re(Be,null,e.slice()):to(e)?er(e):Re(wi,null,String(e))}function er(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Mr(e)}function yl(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(We(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),yl(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!Yd(t)?t._ctx=Xt:s===3&&Xt&&(Xt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Je(t)?(t={default:t,_ctx:Xt},n=32):(t=String(t),r&64?(n=16,t=[no(t)]):n=8);e.children=t,e.shapeFlag|=n}function lf(...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=it([t.class,r.class]));else if(s==="style")t.style=Jr([t.style,r.style]);else if(li(s)){const o=t[s],i=r[s];i&&o!==i&&!(We(o)&&o.includes(i))&&(t[s]=o?[].concat(o,i):i)}else s!==""&&(t[s]=r[s])}return t}function Ln(e,t,n,r=null){$n(e,t,7,[n,r])}const pm=Gd();let mm=0;function gm(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||pm,o={uid:mm++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Bh(!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:Qd(r,s),emitsOptions:zd(r,s),emit:null,emitted:null,propsDefaults:Ct,inheritAttrs:r.inheritAttrs,ctx:Ct,data:Ct,props:Ct,attrs:Ct,slots:Ct,refs:Ct,setupState:Ct,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=Kp.bind(null,o),e.ce&&e.ce(o),o}let rn=null;const wl=()=>rn||Xt;let Zo,Oa;{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)}};Zo=t("__VUE_INSTANCE_SETTERS__",n=>rn=n),Oa=t("__VUE_SSR_SETTERS__",n=>ro=n)}const ho=e=>{const t=rn;return Zo(e),e.scope.on(),()=>{e.scope.off(),Zo(t)}},lc=()=>{rn&&rn.scope.off(),Zo(null)};function cf(e){return e.vnode.shapeFlag&4}let ro=!1;function vm(e,t=!1,n=!1){t&&Oa(t);const{props:r,children:s}=e.vnode,o=cf(e);em(e,r,o,t),sm(e,s,n||t);const i=o?ym(e,t):void 0;return t&&Oa(!1),i}function ym(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Lp);const{setup:r}=n;if(r){ir();const s=e.setupContext=r.length>1?df(e):null,o=ho(e),i=fo(r,e,0,[e.props,s]),a=ed(i);if(ar(),o(),(a||e.sp)&&!fs(e)&&Ud(e),a){if(i.then(lc,lc),t)return i.then(l=>{cc(e,l)}).catch(l=>{pi(l,e,0)});e.asyncDep=i}else cc(e,i)}else uf(e)}function cc(e,t,n){Je(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:mt(t)&&(e.setupState=Td(t)),uf(e)}function uf(e,t,n){const r=e.type;e.render||(e.render=r.render||zn);{const s=ho(e);ir();try{Fp(e)}finally{ar(),s()}}}const wm={get(e,t){return tn(e,"get",""),e[t]}};function df(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,wm),slots:e.slots,emit:e.emit,expose:t}}function bi(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Td(ap(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Gs)return Gs[n](e)},has(t,n){return n in t||n in Gs}})):e.proxy}function bm(e,t=!0){return Je(e)?e.displayName||e.name:e.name||t&&e.__name}function _m(e){return Je(e)&&"__vccOpts"in e}const fe=(e,t)=>fp(e,t,ro);function bl(e,t,n){try{Qo(-1);const r=arguments.length;return r===2?mt(t)&&!We(t)?to(t)?Re(e,null,[t]):Re(e,t):Re(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&to(n)&&(n=[n]),Re(e,t,n))}finally{Qo(1)}}const km="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 Na;const uc=typeof window<"u"&&window.trustedTypes;if(uc)try{Na=uc.createPolicy("vue",{createHTML:e=>e})}catch{}const ff=Na?e=>Na.createHTML(e):e=>e,Tm="http://www.w3.org/2000/svg",Sm="http://www.w3.org/1998/Math/MathML",Zn=typeof document<"u"?document:null,dc=Zn&&Zn.createElement("template"),Im={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"?Zn.createElementNS(Tm,e):t==="mathml"?Zn.createElementNS(Sm,e):n?Zn.createElement(e,{is:n}):Zn.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Zn.createTextNode(e),createComment:e=>Zn.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Zn.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{dc.innerHTML=ff(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=dc.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]}},br="transition",Ns="animation",so=Symbol("_vtc"),hf={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},Em=Bt({},Od,hf),Cm=e=>(e.displayName="Transition",e.props=Em,e),pf=Cm((e,{slots:t})=>bl(Sp,Am(e),t)),Lr=(e,t=[])=>{We(e)?e.forEach(n=>n(...t)):e&&e(...t)},fc=e=>e?We(e)?e.some(t=>t.length>1):e.length>1:!1;function Am(e){const t={};for(const Y in e)Y in hf||(t[Y]=e[Y]);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:u=i,appearToClass:c=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:m=`${n}-leave-active`,leaveToClass:T=`${n}-leave-to`}=e,U=Rm(s),P=U&&U[0],F=U&&U[1],{onBeforeEnter:R,onEnter:A,onEnterCancelled:B,onLeave:W,onLeaveCancelled:ce,onBeforeAppear:me=R,onAppear:ve=A,onAppearCancelled:Ie=B}=t,re=(Y,Te,xe,Le)=>{Y._enterCancelled=Le,jr(Y,Te?c:a),jr(Y,Te?u:i),xe&&xe()},le=(Y,Te)=>{Y._isLeaving=!1,jr(Y,f),jr(Y,T),jr(Y,m),Te&&Te()},we=Y=>(Te,xe)=>{const Le=Y?ve:A,Pe=()=>re(Te,Y,xe);Lr(Le,[Te,Pe]),hc(()=>{jr(Te,Y?l:o),Xn(Te,Y?c:a),fc(Le)||pc(Te,r,P,Pe)})};return Bt(t,{onBeforeEnter(Y){Lr(R,[Y]),Xn(Y,o),Xn(Y,i)},onBeforeAppear(Y){Lr(me,[Y]),Xn(Y,l),Xn(Y,u)},onEnter:we(!1),onAppear:we(!0),onLeave(Y,Te){Y._isLeaving=!0;const xe=()=>le(Y,Te);Xn(Y,f),Y._enterCancelled?(Xn(Y,m),vc(Y)):(vc(Y),Xn(Y,m)),hc(()=>{Y._isLeaving&&(jr(Y,f),Xn(Y,T),fc(W)||pc(Y,r,F,xe))}),Lr(W,[Y,xe])},onEnterCancelled(Y){re(Y,!1,void 0,!0),Lr(B,[Y])},onAppearCancelled(Y){re(Y,!0,void 0,!0),Lr(Ie,[Y])},onLeaveCancelled(Y){le(Y),Lr(ce,[Y])}})}function Rm(e){if(e==null)return null;if(mt(e))return[Yi(e.enter),Yi(e.leave)];{const t=Yi(e);return[t,t]}}function Yi(e){return $h(e)}function Xn(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[so]||(e[so]=new Set)).add(t)}function jr(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[so];n&&(n.delete(t),n.size||(e[so]=void 0))}function hc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Pm=0;function pc(e,t,n,r){const s=e._endId=++Pm,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=xm(e,t);if(!i)return r();const u=i+"end";let c=0;const f=()=>{e.removeEventListener(u,m),o()},m=T=>{T.target===e&&++c>=l&&f()};setTimeout(()=>{c<l&&f()},a+1),e.addEventListener(u,m)}function xm(e,t){const n=window.getComputedStyle(e),r=U=>(n[U]||"").split(", "),s=r(`${br}Delay`),o=r(`${br}Duration`),i=mc(s,o),a=r(`${Ns}Delay`),l=r(`${Ns}Duration`),u=mc(a,l);let c=null,f=0,m=0;t===br?i>0&&(c=br,f=i,m=o.length):t===Ns?u>0&&(c=Ns,f=u,m=l.length):(f=Math.max(i,u),c=f>0?i>u?br:Ns:null,m=c?c===br?o.length:l.length:0);const T=c===br&&/\b(?:transform|all)(?:,|$)/.test(r(`${br}Property`).toString());return{type:c,timeout:f,propCount:m,hasTransform:T}}function mc(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>gc(n)+gc(e[r])))}function gc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function vc(e){return(e?e.ownerDocument:document).body.offsetHeight}function Mm(e,t,n){const r=e[so];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const yc=Symbol("_vod"),$m=Symbol("_vsh"),Om=Symbol(""),Nm=/(?:^|;)\s*display\s*:/;function Dm(e,t,n){const r=e.style,s=Mt(n);let o=!1;if(n&&!s){if(t)if(Mt(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&Uo(r,a,"")}else for(const i in t)n[i]==null&&Uo(r,i,"");for(const i in n)i==="display"&&(o=!0),Uo(r,i,n[i])}else if(s){if(t!==n){const i=r[Om];i&&(n+=";"+i),r.cssText=n,o=Nm.test(n)}}else t&&e.removeAttribute("style");yc in e&&(e[yc]=o?r.display:"",e[$m]&&(r.display="none"))}const wc=/\s*!important$/;function Uo(e,t,n){if(We(n))n.forEach(r=>Uo(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Lm(e,t);wc.test(n)?e.setProperty($r(r),n.replace(wc,""),"important"):e[r]=n}}const bc=["Webkit","Moz","ms"],Xi={};function Lm(e,t){const n=Xi[t];if(n)return n;let r=fn(t);if(r!=="filter"&&r in e)return Xi[t]=r;r=ui(r);for(let s=0;s<bc.length;s++){const o=bc[s]+r;if(o in e)return Xi[t]=o}return t}const _c="http://www.w3.org/1999/xlink";function kc(e,t,n,r,s,o=Uh(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(_c,t.slice(6,t.length)):e.setAttributeNS(_c,t,n):n==null||o&&!sd(n)?e.removeAttribute(t):e.setAttribute(t,o?"":xn(n)?String(n):n)}function Tc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?ff(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=sd(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 as(e,t,n,r){e.addEventListener(t,n,r)}function jm(e,t,n,r){e.removeEventListener(t,n,r)}const Sc=Symbol("_vei");function Um(e,t,n,r,s=null){const o=e[Sc]||(e[Sc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=Fm(t);if(r){const u=o[t]=Wm(r,s);as(e,a,u,l)}else i&&(jm(e,a,i,l),o[t]=void 0)}}const Ic=/(?:Once|Passive|Capture)$/;function Fm(e){let t;if(Ic.test(e)){t={};let r;for(;r=e.match(Ic);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):$r(e.slice(2)),t]}let Qi=0;const Bm=Promise.resolve(),Hm=()=>Qi||(Bm.then(()=>Qi=0),Qi=Date.now());function Wm(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;$n(Vm(r,n.value),t,5,[r])};return n.value=e,n.attached=Hm(),n}function Vm(e,t){if(We(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 Ec=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Gm=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?Mm(e,r,i):t==="style"?Dm(e,n,r):li(t)?nl(t)||Um(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):zm(e,t,r,i))?(Tc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&kc(e,t,r,i,o,t!=="value")):e._isVueCE&&(qm(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Mt(r)))?Tc(e,fn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),kc(e,t,r,i))};function zm(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ec(t)&&Je(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 Ec(t)&&Mt(n)?!1:t in e}function qm(e,t){const n=e._def.props;if(!n)return!1;const r=fn(t);return Array.isArray(n)?n.some(s=>fn(s)===r):Object.keys(n).some(s=>fn(s)===r)}const Cc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return We(t)?n=>No(t,n):t};function Km(e){e.target.composing=!0}function Ac(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Zi=Symbol("_assign");function Rc(e,t,n){return t&&(e=e.trim()),n&&(e=ol(e)),e}const ur={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Zi]=Cc(s);const o=r||s.props&&s.props.type==="number";as(e,t?"change":"input",i=>{i.target.composing||e[Zi](Rc(e.value,n,o))}),(n||o)&&as(e,"change",()=>{e.value=Rc(e.value,n,o)}),t||(as(e,"compositionstart",Km),as(e,"compositionend",Ac),as(e,"change",Ac))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[Zi]=Cc(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?ol(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))}},Jm=["ctrl","shift","alt","meta"],Ym={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)=>Jm.some(n=>e[`${n}Key`]&&!t.includes(n))},ct=(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=Ym[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},Xm={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},dn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=$r(s.key);if(t.some(i=>i===o||Xm[i]===o))return e(s)}))},Qm=Bt({patchProp:Gm},Im);let Pc;function Zm(){return Pc||(Pc=im(Qm))}const eg=((...e)=>{const t=Zm().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=ng(r);if(!s)return;const o=t._component;!Je(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,tg(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function tg(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function ng(e){return Mt(e)?document.querySelector(e):e}/*!
|
|
18
|
+
* vue-router v4.6.4
|
|
19
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
20
|
+
* @license MIT
|
|
21
|
+
*/const ls=typeof document<"u";function mf(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function rg(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&mf(e.default)}const ht=Object.assign;function ea(e,t){const n={};for(const r in t){const s=t[r];n[r]=On(s)?s.map(e):e(s)}return n}const qs=()=>{},On=Array.isArray;function xc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const gf=/#/g,sg=/&/g,og=/\//g,ig=/=/g,ag=/\?/g,vf=/\+/g,lg=/%5B/g,cg=/%5D/g,yf=/%5E/g,ug=/%60/g,wf=/%7B/g,dg=/%7C/g,bf=/%7D/g,fg=/%20/g;function _l(e){return e==null?"":encodeURI(""+e).replace(dg,"|").replace(lg,"[").replace(cg,"]")}function hg(e){return _l(e).replace(wf,"{").replace(bf,"}").replace(yf,"^")}function Da(e){return _l(e).replace(vf,"%2B").replace(fg,"+").replace(gf,"%23").replace(sg,"%26").replace(ug,"`").replace(wf,"{").replace(bf,"}").replace(yf,"^")}function pg(e){return Da(e).replace(ig,"%3D")}function mg(e){return _l(e).replace(gf,"%23").replace(ag,"%3F")}function gg(e){return mg(e).replace(og,"%2F")}function oo(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const vg=/\/$/,yg=e=>e.replace(vg,"");function ta(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=kg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:oo(i)}}function wg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Mc(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&&ws(t.matched[r],n.matched[s])&&_f(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ws(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function _f(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!_g(e[n],t[n]))return!1;return!0}function _g(e,t){return On(e)?$c(e,t):On(t)?$c(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function $c(e,t){return On(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function kg(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 _r={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let La=(function(e){return e.pop="pop",e.push="push",e})({}),na=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Tg(e){if(!e)if(ls){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),yg(e)}const Sg=/^[^#]+#/;function Ig(e,t){return e.replace(Sg,"#")+t}function Eg(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 _i=()=>({left:window.scrollX,top:window.scrollY});function Cg(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=Eg(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 Oc(e,t){return(history.state?history.state.position-t:-1)+e}const ja=new Map;function Ag(e,t){ja.set(e,t)}function Rg(e){const t=ja.get(e);return ja.delete(e),t}function Pg(e){return typeof e=="string"||e&&typeof e=="object"}function kf(e){return typeof e=="string"||typeof e=="symbol"}let Ot=(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 Tf=Symbol("");Ot.MATCHER_NOT_FOUND+"",Ot.NAVIGATION_GUARD_REDIRECT+"",Ot.NAVIGATION_ABORTED+"",Ot.NAVIGATION_CANCELLED+"",Ot.NAVIGATION_DUPLICATED+"";function bs(e,t){return ht(new Error,{type:e,[Tf]:!0},t)}function Qn(e,t){return e instanceof Error&&Tf in e&&(t==null||!!(e.type&t))}const xg=["params","query","hash"];function Mg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of xg)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function $g(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(vf," "),o=s.indexOf("="),i=oo(o<0?s:s.slice(0,o)),a=o<0?null:oo(s.slice(o+1));if(i in t){let l=t[i];On(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Nc(e){let t="";for(let n in e){const r=e[n];if(n=pg(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(On(r)?r.map(s=>s&&Da(s)):[r&&Da(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Og(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=On(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const Ng=Symbol(""),Dc=Symbol(""),ki=Symbol(""),kl=Symbol(""),Ua=Symbol("");function Ds(){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 Ir(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const u=m=>{m===!1?l(bs(Ot.NAVIGATION_ABORTED,{from:n,to:t})):m instanceof Error?l(m):Pg(m)?l(bs(Ot.NAVIGATION_GUARD_REDIRECT,{from:t,to:m})):(i&&r.enterCallbacks[s]===i&&typeof m=="function"&&i.push(m),a())},c=o(()=>e.call(r&&r.instances[s],t,n,u));let f=Promise.resolve(c);e.length<3&&(f=f.then(u)),f.catch(m=>l(m))})}function ra(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(mf(l)){const u=(l.__vccOpts||l)[t];u&&o.push(Ir(u,n,r,i,a,s))}else{let u=l();o.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const f=rg(c)?c.default:c;i.mods[a]=c,i.components[a]=f;const m=(f.__vccOpts||f)[t];return m&&Ir(m,n,r,i,a,s)()}))}}return o}function Dg(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(u=>ws(u,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(u=>ws(u,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 Lg=()=>location.protocol+"//"+location.host;function Sf(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),Mc(a,"")}return Mc(n,e)+r+s}function jg(e,t,n,r){let s=[],o=[],i=null;const a=({state:m})=>{const T=Sf(e,location),U=n.value,P=t.value;let F=0;if(m){if(n.value=T,t.value=m,i&&i===U){i=null;return}F=P?m.position-P.position:0}else r(T);s.forEach(R=>{R(n.value,U,{delta:F,type:La.pop,direction:F?F>0?na.forward:na.back:na.unknown})})};function l(){i=n.value}function u(m){s.push(m);const T=()=>{const U=s.indexOf(m);U>-1&&s.splice(U,1)};return o.push(T),T}function c(){if(document.visibilityState==="hidden"){const{history:m}=window;if(!m.state)return;m.replaceState(ht({},m.state,{scroll:_i()}),"")}}function f(){for(const m of o)m();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:l,listen:u,destroy:f}}function Lc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?_i():null}}function Ug(e){const{history:t,location:n}=window,r={value:Sf(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,u,c){const f=e.indexOf("#"),m=f>-1?(n.host&&document.querySelector("base")?e:e.slice(f))+l:Lg()+e+l;try{t[c?"replaceState":"pushState"](u,"",m),s.value=u}catch(T){console.error(T),n[c?"replace":"assign"](m)}}function i(l,u){o(l,ht({},t.state,Lc(s.value.back,l,s.value.forward,!0),u,{position:s.value.position}),!0),r.value=l}function a(l,u){const c=ht({},s.value,t.state,{forward:l,scroll:_i()});o(c.current,c,!0),o(l,ht({},Lc(r.value,l,null),{position:c.position+1},u),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function Fg(e){e=Tg(e);const t=Ug(e),n=jg(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=ht({location:"",base:e,go:r,createHref:Ig.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 Bg(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),Fg(e)}let Vr=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Ft=(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})(Ft||{});const Hg={type:Vr.Static,value:""},Wg=/[a-zA-Z0-9_]/;function Vg(e){if(!e)return[[]];if(e==="/")return[[Hg]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(T){throw new Error(`ERR (${n})/"${u}": ${T}`)}let n=Ft.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,u="",c="";function f(){u&&(n===Ft.Static?o.push({type:Vr.Static,value:u}):n===Ft.Param||n===Ft.ParamRegExp||n===Ft.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),o.push({type:Vr.Param,value:u,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),u="")}function m(){u+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Ft.ParamRegExp){r=n,n=Ft.EscapeNext;continue}switch(n){case Ft.Static:l==="/"?(u&&f(),i()):l===":"?(f(),n=Ft.Param):m();break;case Ft.EscapeNext:m(),n=r;break;case Ft.Param:l==="("?n=Ft.ParamRegExp:Wg.test(l)?m():(f(),n=Ft.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Ft.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=Ft.ParamRegExpEnd:c+=l;break;case Ft.ParamRegExpEnd:f(),n=Ft.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,c="";break;default:t("Unknown state");break}}return n===Ft.ParamRegExp&&t(`Unfinished custom RegExp for param "${u}"`),f(),i(),s}const jc="[^/]+?",Gg={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 zg=/[.+*?^${}()[\]/\\]/g;function qg(e,t){const n=ht({},Gg,t),r=[];let s=n.start?"^":"";const o=[];for(const u of e){const c=u.length?[]:[cn.Root];n.strict&&!u.length&&(s+="/");for(let f=0;f<u.length;f++){const m=u[f];let T=cn.Segment+(n.sensitive?cn.BonusCaseSensitive:0);if(m.type===Vr.Static)f||(s+="/"),s+=m.value.replace(zg,"\\$&"),T+=cn.Static;else if(m.type===Vr.Param){const{value:U,repeatable:P,optional:F,regexp:R}=m;o.push({name:U,repeatable:P,optional:F});const A=R||jc;if(A!==jc){T+=cn.BonusCustomRegExp;try{`${A}`}catch(W){throw new Error(`Invalid custom RegExp for param "${U}" (${A}): `+W.message)}}let B=P?`((?:${A})(?:/(?:${A}))*)`:`(${A})`;f||(B=F&&u.length<2?`(?:/${B})`:"/"+B),F&&(B+="?"),s+=B,T+=cn.Dynamic,F&&(T+=cn.BonusOptional),P&&(T+=cn.BonusRepeatable),A===".*"&&(T+=cn.BonusWildcard)}c.push(T)}r.push(c)}if(n.strict&&n.end){const u=r.length-1;r[u][r[u].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(u){const c=u.match(i),f={};if(!c)return null;for(let m=1;m<c.length;m++){const T=c[m]||"",U=o[m-1];f[U.name]=T&&U.repeatable?T.split("/"):T}return f}function l(u){let c="",f=!1;for(const m of e){(!f||!c.endsWith("/"))&&(c+="/"),f=!1;for(const T of m)if(T.type===Vr.Static)c+=T.value;else if(T.type===Vr.Param){const{value:U,repeatable:P,optional:F}=T,R=U in u?u[U]:"";if(On(R)&&!P)throw new Error(`Provided param "${U}" is an array but it is not repeatable (* or + modifiers)`);const A=On(R)?R.join("/"):R;if(!A)if(F)m.length<2&&(c.endsWith("/")?c=c.slice(0,-1):f=!0);else throw new Error(`Missing required param "${U}"`);c+=A}}return c||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function Kg(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 If(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=Kg(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(Uc(r))return 1;if(Uc(s))return-1}return s.length-r.length}function Uc(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Jg={strict:!1,end:!0,sensitive:!1};function Yg(e,t,n){const r=qg(Vg(e.path),n),s=ht(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function Xg(e,t){const n=[],r=new Map;t=xc(Jg,t);function s(f){return r.get(f)}function o(f,m,T){const U=!T,P=Bc(f);P.aliasOf=T&&T.record;const F=xc(t,f),R=[P];if("alias"in f){const W=typeof f.alias=="string"?[f.alias]:f.alias;for(const ce of W)R.push(Bc(ht({},P,{components:T?T.record.components:P.components,path:ce,aliasOf:T?T.record:P})))}let A,B;for(const W of R){const{path:ce}=W;if(m&&ce[0]!=="/"){const me=m.record.path,ve=me[me.length-1]==="/"?"":"/";W.path=m.record.path+(ce&&ve+ce)}if(A=Yg(W,m,F),T?T.alias.push(A):(B=B||A,B!==A&&B.alias.push(A),U&&f.name&&!Hc(A)&&i(f.name)),Ef(A)&&l(A),P.children){const me=P.children;for(let ve=0;ve<me.length;ve++)o(me[ve],A,T&&T.children[ve])}T=T||A}return B?()=>{i(B)}:qs}function i(f){if(kf(f)){const m=r.get(f);m&&(r.delete(f),n.splice(n.indexOf(m),1),m.children.forEach(i),m.alias.forEach(i))}else{const m=n.indexOf(f);m>-1&&(n.splice(m,1),f.record.name&&r.delete(f.record.name),f.children.forEach(i),f.alias.forEach(i))}}function a(){return n}function l(f){const m=ev(f,n);n.splice(m,0,f),f.record.name&&!Hc(f)&&r.set(f.record.name,f)}function u(f,m){let T,U={},P,F;if("name"in f&&f.name){if(T=r.get(f.name),!T)throw bs(Ot.MATCHER_NOT_FOUND,{location:f});F=T.record.name,U=ht(Fc(m.params,T.keys.filter(B=>!B.optional).concat(T.parent?T.parent.keys.filter(B=>B.optional):[]).map(B=>B.name)),f.params&&Fc(f.params,T.keys.map(B=>B.name))),P=T.stringify(U)}else if(f.path!=null)P=f.path,T=n.find(B=>B.re.test(P)),T&&(U=T.parse(P),F=T.record.name);else{if(T=m.name?r.get(m.name):n.find(B=>B.re.test(m.path)),!T)throw bs(Ot.MATCHER_NOT_FOUND,{location:f,currentLocation:m});F=T.record.name,U=ht({},m.params,f.params),P=T.stringify(U)}const R=[];let A=T;for(;A;)R.unshift(A.record),A=A.parent;return{name:F,path:P,params:U,matched:R,meta:Zg(R)}}e.forEach(f=>o(f));function c(){n.length=0,r.clear()}return{addRoute:o,resolve:u,removeRoute:i,clearRoutes:c,getRoutes:a,getRecordMatcher:s}}function Fc(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Bc(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Qg(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 Qg(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 Hc(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Zg(e){return e.reduce((t,n)=>ht(t,n.meta),{})}function ev(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;If(e,t[o])<0?r=o:n=o+1}const s=tv(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function tv(e){let t=e;for(;t=t.parent;)if(Ef(t)&&If(e,t)===0)return t}function Ef({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Wc(e){const t=Rn(ki),n=Rn(kl),r=fe(()=>{const l=ye(e.to);return t.resolve(l)}),s=fe(()=>{const{matched:l}=r.value,{length:u}=l,c=l[u-1],f=n.matched;if(!c||!f.length)return-1;const m=f.findIndex(ws.bind(null,c));if(m>-1)return m;const T=Vc(l[u-2]);return u>1&&Vc(c)===T&&f[f.length-1].path!==T?f.findIndex(ws.bind(null,l[u-2])):m}),o=fe(()=>s.value>-1&&iv(n.params,r.value.params)),i=fe(()=>s.value>-1&&s.value===n.matched.length-1&&_f(n.params,r.value.params));function a(l={}){if(ov(l)){const u=t[ye(e.replace)?"replace":"push"](ye(e.to)).catch(qs);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:r,href:fe(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function nv(e){return e.length===1?e[0]:e}const rv=Ht({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:Wc,setup(e,{slots:t}){const n=hi(Wc(e)),{options:r}=Rn(ki),s=fe(()=>({[Gc(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Gc(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&nv(t.default(n));return e.custom?o:bl("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),sv=rv;function ov(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 iv(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(!On(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function Vc(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Gc=(e,t,n)=>e??t??n,av=Ht({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Rn(Ua),s=fe(()=>e.route||r.value),o=Rn(Dc,0),i=fe(()=>{let u=ye(o);const{matched:c}=s.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),a=fe(()=>s.value.matched[i.value]);Do(Dc,fe(()=>i.value+1)),Do(Ng,a),Do(Ua,s);const l=D();return ut(()=>[l.value,a.value,e.name],([u,c,f],[m,T,U])=>{c&&(c.instances[f]=u,T&&T!==c&&u&&u===m&&(c.leaveGuards.size||(c.leaveGuards=T.leaveGuards),c.updateGuards.size||(c.updateGuards=T.updateGuards))),u&&c&&(!T||!ws(c,T)||!m)&&(c.enterCallbacks[f]||[]).forEach(P=>P(u))},{flush:"post"}),()=>{const u=s.value,c=e.name,f=a.value,m=f&&f.components[c];if(!m)return zc(n.default,{Component:m,route:u});const T=f.props[c],U=T?T===!0?u.params:typeof T=="function"?T(u):T:null,F=bl(m,ht({},U,t,{onVnodeUnmounted:R=>{R.component.isUnmounted&&(f.instances[c]=null)},ref:l}));return zc(n.default,{Component:F,route:u})||F}}});function zc(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const lv=av;function cv(e){const t=Xg(e.routes,e),n=e.parseQuery||$g,r=e.stringifyQuery||Nc,s=e.history,o=Ds(),i=Ds(),a=Ds(),l=lp(_r);let u=_r;ls&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=ea.bind(null,K=>""+K),f=ea.bind(null,gg),m=ea.bind(null,oo);function T(K,he){let ue,be;return kf(K)?(ue=t.getRecordMatcher(K),be=he):be=K,t.addRoute(be,ue)}function U(K){const he=t.getRecordMatcher(K);he&&t.removeRoute(he)}function P(){return t.getRoutes().map(K=>K.record)}function F(K){return!!t.getRecordMatcher(K)}function R(K,he){if(he=ht({},he||l.value),typeof K=="string"){const x=ta(n,K,he.path),q=t.resolve({path:x.path},he),G=s.createHref(x.fullPath);return ht(x,q,{params:m(q.params),hash:oo(x.hash),redirectedFrom:void 0,href:G})}let ue;if(K.path!=null)ue=ht({},K,{path:ta(n,K.path,he.path).path});else{const x=ht({},K.params);for(const q in x)x[q]==null&&delete x[q];ue=ht({},K,{params:f(x)}),he.params=f(he.params)}const be=t.resolve(ue,he),$e=K.hash||"";be.params=c(m(be.params));const g=wg(r,ht({},K,{hash:hg($e),path:be.path})),b=s.createHref(g);return ht({fullPath:g,hash:$e,query:r===Nc?Og(K.query):K.query||{}},be,{redirectedFrom:void 0,href:b})}function A(K){return typeof K=="string"?ta(n,K,l.value.path):ht({},K)}function B(K,he){if(u!==K)return bs(Ot.NAVIGATION_CANCELLED,{from:he,to:K})}function W(K){return ve(K)}function ce(K){return W(ht(A(K),{replace:!0}))}function me(K,he){const ue=K.matched[K.matched.length-1];if(ue&&ue.redirect){const{redirect:be}=ue;let $e=typeof be=="function"?be(K,he):be;return typeof $e=="string"&&($e=$e.includes("?")||$e.includes("#")?$e=A($e):{path:$e},$e.params={}),ht({query:K.query,hash:K.hash,params:$e.path!=null?{}:K.params},$e)}}function ve(K,he){const ue=u=R(K),be=l.value,$e=K.state,g=K.force,b=K.replace===!0,x=me(ue,be);if(x)return ve(ht(A(x),{state:typeof x=="object"?ht({},$e,x.state):$e,force:g,replace:b}),he||ue);const q=ue;q.redirectedFrom=he;let G;return!g&&bg(r,be,ue)&&(G=bs(Ot.NAVIGATION_DUPLICATED,{to:q,from:be}),Ne(be,be,!0,!1)),(G?Promise.resolve(G):le(q,be)).catch(N=>Qn(N)?Qn(N,Ot.NAVIGATION_GUARD_REDIRECT)?N:Ze(N):Ee(N,q,be)).then(N=>{if(N){if(Qn(N,Ot.NAVIGATION_GUARD_REDIRECT))return ve(ht({replace:b},A(N.to),{state:typeof N.to=="object"?ht({},$e,N.to.state):$e,force:g}),he||q)}else N=Y(q,be,!0,b,$e);return we(q,be,N),N})}function Ie(K,he){const ue=B(K,he);return ue?Promise.reject(ue):Promise.resolve()}function re(K){const he=at.values().next().value;return he&&typeof he.runWithContext=="function"?he.runWithContext(K):K()}function le(K,he){let ue;const[be,$e,g]=Dg(K,he);ue=ra(be.reverse(),"beforeRouteLeave",K,he);for(const x of be)x.leaveGuards.forEach(q=>{ue.push(Ir(q,K,he))});const b=Ie.bind(null,K,he);return ue.push(b),Xe(ue).then(()=>{ue=[];for(const x of o.list())ue.push(Ir(x,K,he));return ue.push(b),Xe(ue)}).then(()=>{ue=ra($e,"beforeRouteUpdate",K,he);for(const x of $e)x.updateGuards.forEach(q=>{ue.push(Ir(q,K,he))});return ue.push(b),Xe(ue)}).then(()=>{ue=[];for(const x of g)if(x.beforeEnter)if(On(x.beforeEnter))for(const q of x.beforeEnter)ue.push(Ir(q,K,he));else ue.push(Ir(x.beforeEnter,K,he));return ue.push(b),Xe(ue)}).then(()=>(K.matched.forEach(x=>x.enterCallbacks={}),ue=ra(g,"beforeRouteEnter",K,he,re),ue.push(b),Xe(ue))).then(()=>{ue=[];for(const x of i.list())ue.push(Ir(x,K,he));return ue.push(b),Xe(ue)}).catch(x=>Qn(x,Ot.NAVIGATION_CANCELLED)?x:Promise.reject(x))}function we(K,he,ue){a.list().forEach(be=>re(()=>be(K,he,ue)))}function Y(K,he,ue,be,$e){const g=B(K,he);if(g)return g;const b=he===_r,x=ls?history.state:{};ue&&(be||b?s.replace(K.fullPath,ht({scroll:b&&x&&x.scroll},$e)):s.push(K.fullPath,$e)),l.value=K,Ne(K,he,ue,b),Ze()}let Te;function xe(){Te||(Te=s.listen((K,he,ue)=>{if(!et.listening)return;const be=R(K),$e=me(be,et.currentRoute.value);if($e){ve(ht($e,{replace:!0,force:!0}),be).catch(qs);return}u=be;const g=l.value;ls&&Ag(Oc(g.fullPath,ue.delta),_i()),le(be,g).catch(b=>Qn(b,Ot.NAVIGATION_ABORTED|Ot.NAVIGATION_CANCELLED)?b:Qn(b,Ot.NAVIGATION_GUARD_REDIRECT)?(ve(ht(A(b.to),{force:!0}),be).then(x=>{Qn(x,Ot.NAVIGATION_ABORTED|Ot.NAVIGATION_DUPLICATED)&&!ue.delta&&ue.type===La.pop&&s.go(-1,!1)}).catch(qs),Promise.reject()):(ue.delta&&s.go(-ue.delta,!1),Ee(b,be,g))).then(b=>{b=b||Y(be,g,!1),b&&(ue.delta&&!Qn(b,Ot.NAVIGATION_CANCELLED)?s.go(-ue.delta,!1):ue.type===La.pop&&Qn(b,Ot.NAVIGATION_ABORTED|Ot.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),we(be,g,b)}).catch(qs)}))}let Le=Ds(),Pe=Ds(),Oe;function Ee(K,he,ue){Ze(K);const be=Pe.list();return be.length?be.forEach($e=>$e(K,he,ue)):console.error(K),Promise.reject(K)}function Ye(){return Oe&&l.value!==_r?Promise.resolve():new Promise((K,he)=>{Le.add([K,he])})}function Ze(K){return Oe||(Oe=!K,xe(),Le.list().forEach(([he,ue])=>K?ue(K):he()),Le.reset()),K}function Ne(K,he,ue,be){const{scrollBehavior:$e}=e;if(!ls||!$e)return Promise.resolve();const g=!ue&&Rg(Oc(K.fullPath,0))||(be||!ue)&&history.state&&history.state.scroll||null;return Yt().then(()=>$e(K,he,g)).then(b=>b&&Cg(b)).catch(b=>Ee(b,K,he))}const nt=K=>s.go(K);let gt;const at=new Set,et={currentRoute:l,listening:!0,addRoute:T,removeRoute:U,clearRoutes:t.clearRoutes,hasRoute:F,getRoutes:P,resolve:R,options:e,push:W,replace:ce,go:nt,back:()=>nt(-1),forward:()=>nt(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:Pe.add,isReady:Ye,install(K){K.component("RouterLink",sv),K.component("RouterView",lv),K.config.globalProperties.$router=et,Object.defineProperty(K.config.globalProperties,"$route",{enumerable:!0,get:()=>ye(l)}),ls&&!gt&&l.value===_r&&(gt=!0,W(s.location).catch(be=>{}));const he={};for(const be in _r)Object.defineProperty(he,be,{get:()=>l.value[be],enumerable:!0});K.provide(ki,et),K.provide(kl,_d(he)),K.provide(Ua,l);const ue=K.unmount;at.add(K),K.unmount=function(){at.delete(K),at.size<1&&(u=_r,Te&&Te(),Te=null,l.value=_r,gt=!1,Oe=!1),ue()}}};function Xe(K){return K.reduce((he,ue)=>he.then(()=>re(ue)),Promise.resolve())}return et}function uv(){return Rn(ki)}function dv(e){return Rn(kl)}const qc=768;function Cf(){const e=D(typeof window<"u"?window.innerWidth<qc:!1);let t=null;function n(r){e.value=r.matches}return pr(()=>{t=window.matchMedia(`(max-width: ${qc-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),vi(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const fv={key:0,class:"desktop-sidebar"},hv={class:"desktop-main"},Kc="codex-web-local.sidebar-width.v1",pv=260,mv=620,Jc=320,gv=Ht({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Cf();function r(u){return Math.min(mv,Math.max(pv,u))}function s(){if(typeof window>"u")return Jc;const u=window.localStorage.getItem(Kc),c=Number(u);return Number.isFinite(c)?r(c):Jc}const o=D(s()),i=fe(()=>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(u){typeof window>"u"||window.localStorage.setItem(Kc,String(u))}function l(u){u.preventDefault();const c=u.clientX,f=o.value,m=U=>{const P=U.clientX-c;o.value=r(f+P)},T=()=>{a(o.value),window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",T)};window.addEventListener("mousemove",m),window.addEventListener("mouseup",T)}return(u,c)=>(w(),k("div",{class:it(["desktop-layout",{"is-mobile":ye(n)}]),style:Jr(i.value)},[ye(n)?(w(),ft(Ko,{key:0,to:"body"},[Re(pf,{name:"drawer"},{default:_t(()=>[e.isSidebarCollapsed?ae("",!0):(w(),k("div",{key:0,class:"mobile-drawer-backdrop",onClick:c[1]||(c[1]=f=>u.$emit("close-sidebar"))},[p("aside",{class:"mobile-drawer",onClick:c[0]||(c[0]=ct(()=>{},["stop"]))},[Gn(u.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ae("",!0),ye(n)?ae("",!0):(w(),k(Be,{key:1},[e.isSidebarCollapsed?ae("",!0):(w(),k("aside",fv,[Gn(u.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ae("",!0):(w(),k("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),p("section",hv,[Gn(u.$slots,"content",{},void 0)])],6))}}),st=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},vv=st(gv,[["__scopeId","data-v-df29c633"]]),yv={},wv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function bv(e,t){return w(),k("svg",wv,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Ti=st(yv,[["render",bv]]),_v={},kv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Tv(e,t){return w(),k("svg",kv,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const Af=st(_v,[["render",Tv]]),Sv={},Iv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Ev(e,t){return w(),k("svg",Iv,[...t[0]||(t[0]=[p("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 Ls=st(Sv,[["render",Ev]]),Cv={},Av={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Rv(e,t){return w(),k("svg",Av,[...t[0]||(t[0]=[p("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 ei=st(Cv,[["render",Rv]]),Pv={},xv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Mv(e,t){return w(),k("svg",xv,[...t[0]||(t[0]=[p("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 Tl=st(Pv,[["render",Mv]]),$v={},Ov={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Nv(e,t){return w(),k("svg",Ov,[...t[0]||(t[0]=[p("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 Dv=st($v,[["render",Nv]]),Lv={},jv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Uv(e,t){return w(),k("svg",jv,[...t[0]||(t[0]=[p("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 Fo=st(Lv,[["render",Uv]]),Fv={},Bv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Hv(e,t){return w(),k("svg",Bv,[...t[0]||(t[0]=[p("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 sa=st(Fv,[["render",Hv]]),Wv={key:0,class:"sidebar-menu-row-left"},Vv={class:"sidebar-menu-row-main"},Gv={key:1,class:"sidebar-menu-row-right"},zv={key:0,class:"sidebar-menu-row-right-default"},qv={key:1,class:"sidebar-menu-row-right-hover"},Kv=Ht({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=jp(),r=fe(()=>!!n.left),s=fe(()=>!!n.right),o=fe(()=>!!n["right-hover"]),i=fe(()=>s.value||o.value);return(a,l)=>(w(),ft(Yo(t.as),lf({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:_t(()=>[r.value?(w(),k("span",Wv,[Gn(a.$slots,"left",{},void 0,!0)])):ae("",!0),p("span",Vv,[Gn(a.$slots,"default",{},void 0,!0)]),i.value?(w(),k("span",Gv,[s.value?(w(),k("span",zv,[Gn(a.$slots,"right",{},void 0,!0)])):ae("",!0),o.value?(w(),k("span",qv,[Gn(a.$slots,"right-hover",{},void 0,!0)])):ae("",!0)])):ae("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Ur=st(Kv,[["__scopeId","data-v-daeca4df"]]),Jv={class:"thread-tree-root"},Yv={key:0,class:"pinned-section"},Xv={class:"thread-list"},Qv={class:"thread-left-stack"},Zv=["data-state"],ey=["onClick"],ty=["onClick"],ny={class:"thread-row-title-wrap"},ry={class:"thread-row-title"},sy={class:"thread-row-time"},oy=["onClick"],iy=["onClick"],ay=["onClick"],ly=["onClick"],cy=["aria-expanded"],uy=["data-active"],dy={key:0},fy=["data-active"],hy={key:0},py={key:1,class:"thread-tree-no-results"},my={key:2,class:"thread-tree-loading"},gy={key:3,class:"thread-list thread-list-global"},vy={class:"thread-left-stack"},yy=["data-state"],wy=["onClick"],by=["onClick"],_y={class:"thread-row-title-wrap"},ky={class:"thread-row-title"},Ty={class:"thread-row-time"},Sy=["onClick"],Iy=["onClick"],Ey=["onClick"],Cy=["onClick"],Ay=["data-project-name","data-expanded","data-dragging"],Ry={class:"project-icon-stack"},Py={class:"project-icon-folder"},xy={class:"project-icon-chevron"},My=["data-dragging-handle","onMousedown"],$y={class:"project-title"},Oy={class:"project-hover-controls"},Ny=["onClick"],Dy=["onClick"],Ly=["onClick"],jy=["onClick"],Uy=["onInput"],Fy=["aria-label","title","onClick"],By={key:0,class:"thread-list"},Hy={class:"thread-left-stack"},Wy=["data-state"],Vy=["onClick"],Gy=["onClick"],zy={class:"thread-row-title-wrap"},qy={class:"thread-row-title"},Ky={class:"thread-row-time"},Jy=["onClick"],Yy=["onClick"],Xy=["onClick"],Qy=["onClick"],Zy=["onClick"],ew={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},tw=["onKeydown"],nw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},rw={class:"rename-thread-subtitle"},sw=4,Yc=6,Xc="codex-web-local.thread-view-mode.v1",Qc="codex-web-local.collapsed-projects.v1",ow=Ht({__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(""),u=D("actions"),c=D(""),f=D(!1),m=D(""),T=D(""),U=D(null),P=D(!1),F=D(""),R=D(""),A=D(null),B=D(null),W=D(null);let ce=null,me=null;const ve=D(""),Ie=D({}),re=new Map,le=new Map,we=new Map,Y=new WeakMap,Te=D(null),xe=D(!1),Le=D(Ee()),Pe=typeof window<"u"?new ResizeObserver(I=>{for(const $ of I){const L=$.target,ee=Y.get(L);ee&&O(ee,L)}}):null;function Oe(){if(typeof window>"u")return{};try{const I=window.localStorage.getItem(Qc);if(!I)return{};const $=JSON.parse(I);return!$||typeof $!="object"||Array.isArray($)?{}:$}catch{return{}}}function Ee(){return typeof window>"u"?"project":window.localStorage.getItem(Xc)==="chronological"?"chronological":"project"}o.value=Oe(),ut(o,I=>{typeof window>"u"||window.localStorage.setItem(Qc,JSON.stringify(I))},{deep:!0}),ut(Le,I=>{typeof window>"u"||window.localStorage.setItem(Xc,I)});const Ye=fe(()=>n.searchQuery.trim().toLowerCase()),Ze=fe(()=>Ye.value.length>0),Ne=fe(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function nt(I){if(!Ze.value)return!0;if(Ne.value)return Ne.value.has(I.id);const $=Ye.value;return I.title.toLowerCase().includes($)||I.preview.toLowerCase().includes($)}const gt=fe(()=>Ze.value?n.groups.map(I=>({...I,threads:I.threads.filter(nt)})).filter(I=>I.threads.length>0):n.groups),at=fe(()=>Le.value==="chronological"),et=fe(()=>{const I=gt.value,$=[];for(const L of I)for(const ee of L.threads)b(ee.id)||$.push(ee);return $.sort((L,ee)=>{const Ge=new Date(L.updatedAtIso||L.createdAtIso).getTime();return new Date(ee.updatedAtIso||ee.createdAtIso).getTime()-Ge})}),Xe=fe(()=>{const I=new Map;for(const $ of n.groups)for(const L of $.threads)I.set(L.id,L);return I}),K=fe(()=>i.value.map(I=>Xe.value.get(I)??null).filter(I=>I!==null).filter(nt)),he=fe(()=>{const I=W.value;if(!I||I.dropTargetIndexFull===null||n.groups.length===0)return null;const $=Math.max(0,Math.min(I.dropTargetIndexFull,n.groups.length)),L=$>I.fromIndex?$-1:$,ee=Math.max(0,Math.min(L,n.groups.length-1));return ee===I.fromIndex?null:ee}),ue=fe(()=>{const $=(Ze.value?gt.value:n.groups).map(gn=>gn.projectName),L=W.value,ee=he.value;if(!L||ee===null)return $;const Ge=[...$],[Ut]=Ge.splice(L.fromIndex,1);return Ut?(Ge.splice(ee,0,Ut),Ge):$}),be=fe(()=>{const I={};let $=0;for(const L of ue.value)I[L]=$,$+=It(L);return I}),$e=fe(()=>{let I=0;for(const $ of ue.value)I+=It($);return{height:`${Math.max(0,I)}px`}});function g(I){const $=new Date(I).getTime();if(Number.isNaN($))return"n/a";const L=Math.abs(Date.now()-$);if(L<6e4)return"now";const ee=Math.floor(L/6e4);if(ee<60)return`${ee}m`;const Ge=Math.floor(ee/60);return Ge<24?`${Ge}h`:`${Math.floor(Ge/24)}d`}function b(I){return i.value.includes(I)}function x(I){if(b(I)){i.value=i.value.filter($=>$!==I);return}i.value=[I,...i.value]}function q(I){r("select",I)}function G(I){r("export-thread",I),z()}function N(I){return`start new thread ${ot(I)}`}function V(I){r("start-new-thread",I)}function J(I){l.value===I&&z()}function Q(I){return l.value===I}function z(){l.value=""}function _e(I){if(l.value===I){z();return}l.value=I}function de(I,$){m.value=I,T.value=$,f.value=!0,z(),Yt(()=>{var L,ee;(L=U.value)==null||L.focus(),(ee=U.value)==null||ee.select()})}function Se(){f.value=!1,m.value="",T.value=""}function Me(){const I=m.value,$=T.value.trim();!I||!$||(r("rename-thread",{threadId:I,title:$}),Se())}function De(I,$){F.value=I,R.value=$,P.value=!0,z()}function Fe(){P.value=!1,F.value="",R.value=""}function He(){const I=F.value;I&&(i.value=i.value.filter($=>$!==I),r("archive",I),Fe())}function ot(I){return n.projectDisplayNameById[I]??I}function tt(I){return a.value===I}function vt(){a.value="",u.value="actions",c.value=""}function yt(){xe.value=!xe.value}function jt(I){Le.value=I,xe.value=!1}function zt(I){if(a.value===I){vt();return}a.value=I,u.value="actions",c.value=ot(I)}function kt(I){a.value=I,u.value="rename",c.value=ot(I)}function Rt(I){r("rename-project",{projectName:I,displayName:c.value})}function wt(I){r("remove-project",I),vt()}function Dt(I){r("browse-project-files",I),vt()}function Qt(I,$){if(!I.altKey||I.key!=="ArrowUp"&&I.key!=="ArrowDown")return;const L=n.groups.findIndex(Ut=>Ut.projectName===$);if(L<0)return;const ee=I.key==="ArrowUp"?-1:1,Ge=Math.max(0,Math.min(L+ee,n.groups.length-1));Ge!==L&&(I.preventDefault(),r("reorder-project",{projectName:$,toIndex:Ge}))}function qt(I){return s.value[I]===!0}function xt(I){return o.value[I]===!0}function Tt(I){s.value={...s.value,[I]:!qt(I)}}function Kt(I){if(ve.value===I){ve.value="";return}o.value={...o.value,[I]:!xt(I)}}function It(I){const $=Ie.value[I]??0,L=W.value,Ge=((L==null?void 0:L.projectName)===I?L.groupHeight:null)??$,Ut=xt(I)?0:Yc;return Math.max(0,Ge+Ut)}function bt(I,$){const L=$ instanceof HTMLElement?$:$&&"$el"in $&&$.$el instanceof HTMLElement?$.$el:null;if(L){le.set(I,L);return}le.delete(I)}function Jt(I,$){const L=$ instanceof HTMLElement?$:$&&"$el"in $&&$.$el instanceof HTMLElement?$.$el:null;if(L){we.set(I,L);return}we.delete(I)}function yn(I){const $=a.value;if(!$)return!1;const L=le.get($);if(!L)return!1;if((typeof I.composedPath=="function"?I.composedPath():[]).includes(L))return!0;const Ge=I.target;return Ge instanceof Node?L.contains(Ge):!1}function $t(I){const $=l.value;if(!$)return!1;const L=we.get($);if(!L)return!1;if((typeof I.composedPath=="function"?I.composedPath():[]).includes(L))return!0;const Ge=I.target;return Ge instanceof Node?L.contains(Ge):!1}function Wt(I){if(xe.value){const $=Te.value,L=typeof I.composedPath=="function"?I.composedPath():[];!!$&&(L.includes($)||I.target instanceof Node&&$.contains(I.target))||(xe.value=!1)}a.value&&(yn(I)||vt(),l.value&&($t(I)||z()))}function wn(I){a.value&&!yn(I)&&vt(),l.value&&!$t(I)&&z()}function _(){xe.value&&(xe.value=!1),a.value&&vt(),l.value&&z()}function S(){window.addEventListener("pointerdown",Wt,{capture:!0}),window.addEventListener("focusin",wn,{capture:!0}),window.addEventListener("blur",_)}function E(){window.removeEventListener("pointerdown",Wt,{capture:!0}),window.removeEventListener("focusin",wn,{capture:!0}),window.removeEventListener("blur",_)}function O(I,$){const L=$.getBoundingClientRect().height;if(!Number.isFinite(L)||L<=0)return;const ee=Ie.value[I];ee!==void 0&&Math.abs(ee-L)<.5||(Ie.value={...Ie.value,[I]:L})}function H(I,$){const L=re.get(I);L&&L!==$&&Pe&&Pe.unobserve(L);const ee=$ instanceof HTMLElement?$:$&&"$el"in $&&$.$el instanceof HTMLElement?$.$el:null;if(ee){re.set(I,ee),Y.set(ee,I),O(I,ee),Pe==null||Pe.observe(ee);return}L&&(Pe==null||Pe.unobserve(L)),re.delete(I)}function oe(I,$){if(I.button!==0||B.value||W.value)return;const L=n.groups.findIndex(gn=>gn.projectName===$),ee=re.get($);if(L<0||!ee)return;const Ge=ee.getBoundingClientRect(),Ut=xt($)?0:Yc;B.value={projectName:$,fromIndex:L,startClientX:I.clientX,startClientY:I.clientY,pointerOffsetY:I.clientY-Ge.top,groupLeft:Ge.left,groupWidth:Ge.width,groupHeight:Ge.height,groupOuterHeight:Ge.height+Ut},I.preventDefault(),Ce()}function Ce(){window.addEventListener("mousemove",Ke),window.addEventListener("mouseup",lt),window.addEventListener("keydown",rt)}function ge(){window.removeEventListener("mousemove",Ke),window.removeEventListener("mouseup",lt),window.removeEventListener("keydown",rt)}function Ke(I){ce={clientX:I.clientX,clientY:I.clientY},mn()}function lt(I){Nn({clientX:I.clientX,clientY:I.clientY});const $=W.value;if($&&he.value!==null){const L=n.groups.findIndex(ee=>ee.projectName===$.projectName);if(L>=0){const ee=he.value;ee!==L&&r("reorder-project",{projectName:$.projectName,toIndex:ee})}}Nt()}function rt(I){I.key==="Escape"&&(!B.value&&!W.value||(I.preventDefault(),Nt()))}function Nt(){me!==null&&(window.cancelAnimationFrame(me),me=null),ce=null,B.value=null,W.value=null,ve.value="",ge()}function mn(){me===null&&(me=window.requestAnimationFrame(()=>{if(me=null,!ce)return;const I=ce;ce=null,Nn(I)}))}function Nn(I){const $=B.value;if(!W.value&&$){const L=I.clientX-$.startClientX,ee=I.clientY-$.startClientY;if(Math.hypot(L,ee)<sw)return;vt(),ve.value=$.projectName,W.value={projectName:$.projectName,fromIndex:$.fromIndex,pointerOffsetY:$.pointerOffsetY,groupLeft:$.groupLeft,groupWidth:$.groupWidth,groupHeight:$.groupHeight,groupOuterHeight:$.groupOuterHeight,ghostTop:I.clientY-$.pointerOffsetY,dropTargetIndexFull:null}}W.value&&j(I)}function j(I){const $=W.value;if(!$)return;if($.ghostTop=I.clientY-$.pointerOffsetY,!X(I)){$.dropTargetIndexFull=null;return}const L=I.clientY,ee=A.value;if(!ee){$.dropTargetIndexFull=null;return}const Ge=ee.getBoundingClientRect(),Ut=new Map(n.groups.map((kn,vr)=>[kn.projectName,vr])),gn=n.groups.map(kn=>kn.projectName).filter(kn=>kn!==$.projectName);let Xr=0,gr=n.groups.length;for(const kn of gn){const vr=Ut.get(kn);if(vr===void 0)continue;const Qr=It(kn),Cs=Ge.top+Xr+Qr/2;if(L<Cs){gr=vr;break}Xr+=Qr}$.dropTargetIndexFull=gr}function X(I){const $=A.value;if(!$)return!1;const L=$.getBoundingClientRect(),ee=I.clientX>=L.left&&I.clientX<=L.right,Ge=I.clientY>=L.top-32&&I.clientY<=L.bottom+32;return ee&&Ge}function se(I){var $;return(($=W.value)==null?void 0:$.projectName)===I}function qe(I){const $=W.value,L=be.value[I]??0,ee=a.value===I;return!$||$.projectName!==I?{position:"absolute",top:"0",left:"0",right:"0",zIndex:ee?"40":"1",transform:`translate3d(0, ${L}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${$.groupLeft}px`,width:`${$.groupWidth}px`,height:`${$.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${$.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Pt(I){return I.threads.filter($=>!b($.id))}function bn(I){if(Ze.value)return Pt(I);if(xt(I.projectName))return[];const $=Pt(I);return qt(I.projectName)?$:$.slice(0,10)}function _n(I){return Ze.value?!1:!xt(I.projectName)&&Pt(I).length>10}function an(I){return Pt(I).length>0}function Vt(I){return I.inProgress?"working":I.unread?"unread":"idle"}ut(()=>n.groups.map(I=>I.projectName),I=>{var Ge,Ut;const $=((Ge=W.value)==null?void 0:Ge.projectName)??((Ut=B.value)==null?void 0:Ut.projectName)??"";$&&!n.groups.some(gn=>gn.projectName===$)&&Nt();const L=new Set(I),ee=Object.fromEntries(Object.entries(Ie.value).filter(([gn])=>L.has(gn)));Object.keys(ee).length!==Object.keys(Ie.value).length&&(Ie.value=ee)});const Dn=fe(()=>xe.value||a.value!=="");return ut(Dn,I=>{if(I){S();return}E()}),mr(()=>{for(const I of re.values())Pe==null||Pe.unobserve(I);re.clear(),le.clear(),E(),Nt()}),(I,$)=>(w(),k("section",Jv,[K.value.length>0?(w(),k("section",Yv,[p("ul",Xv,[(w(!0),k(Be,null,St(K.value,L=>(w(),k("li",{key:L.id,class:"thread-row-item"},[Re(Ur,{class:"thread-row","data-active":L.id===e.selectedThreadId,"data-pinned":b(L.id),onMouseleave:ee=>J(L.id)},{left:_t(()=>[p("span",Qv,[L.inProgress||L.unread?(w(),k("span",{key:0,class:"thread-status-indicator","data-state":Vt(L)},null,8,Zv)):ae("",!0),p("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ee=>x(L.id)},[Re(sa,{class:"thread-icon"})],8,ey)])]),right:_t(()=>[p("span",sy,ie(g(L.createdAtIso||L.updatedAtIso)),1)]),"right-hover":_t(()=>[p("div",{ref_for:!0,ref:ee=>Jt(L.id,ee),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:ct(ee=>_e(L.id),["stop"])},[Re(Ls,{class:"thread-icon"})],8,oy),Q(L.id)?(w(),k("div",{key:0,class:"thread-menu-panel",onClick:$[0]||($[0]=ct(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:ee=>G(L.id)}," Export chat ",8,iy),p("button",{class:"thread-menu-item",type:"button",onClick:ee=>de(L.id,L.title)}," Rename thread ",8,ay),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:ee=>De(L.id,L.title)}," Delete thread ",8,ly)])):ae("",!0)],512)]),default:_t(()=>[p("button",{class:"thread-main-button",type:"button",onClick:ee=>q(L.id)},[p("span",ny,[p("span",ry,ie(L.title),1),L.hasWorktree?(w(),ft(Fo,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ae("",!0)])],8,ty)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])])):ae("",!0),Re(Ur,{as:"header",class:"thread-tree-header-row"},{right:_t(()=>[p("div",{ref_key:"organizeMenuWrapRef",ref:Te,class:"organize-menu-wrap"},[p("button",{class:"organize-menu-trigger",type:"button","aria-expanded":xe.value,"aria-label":"Organize threads",title:"Organize threads",onClick:yt},[Re(Ls,{class:"thread-icon"})],8,cy),xe.value?(w(),k("div",{key:0,class:"organize-menu-panel",onClick:$[3]||($[3]=ct(()=>{},["stop"]))},[$[11]||($[11]=p("p",{class:"organize-menu-title"},"Organize",-1)),p("button",{class:"organize-menu-item","data-active":Le.value==="project",type:"button",onClick:$[1]||($[1]=L=>jt("project"))},[$[9]||($[9]=p("span",null,"By project",-1)),Le.value==="project"?(w(),k("span",dy,"✓")):ae("",!0)],8,uy),p("button",{class:"organize-menu-item","data-active":Le.value==="chronological",type:"button",onClick:$[2]||($[2]=L=>jt("chronological"))},[$[10]||($[10]=p("span",null,"Chronological list",-1)),Le.value==="chronological"?(w(),k("span",hy,"✓")):ae("",!0)],8,fy)])):ae("",!0)],512)]),default:_t(()=>[$[12]||($[12]=p("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),Ze.value&>.value.length===0?(w(),k("p",py,"No matching threads")):e.isLoading&&e.groups.length===0?(w(),k("p",my,"Loading threads...")):at.value?(w(),k("ul",gy,[(w(!0),k(Be,null,St(et.value,L=>(w(),k("li",{key:L.id,class:"thread-row-item"},[Re(Ur,{class:"thread-row","data-active":L.id===e.selectedThreadId,"data-pinned":b(L.id),onMouseleave:ee=>J(L.id)},{left:_t(()=>[p("span",vy,[L.inProgress||L.unread?(w(),k("span",{key:0,class:"thread-status-indicator","data-state":Vt(L)},null,8,yy)):ae("",!0),p("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ee=>x(L.id)},[Re(sa,{class:"thread-icon"})],8,wy)])]),right:_t(()=>[p("span",Ty,ie(g(L.createdAtIso||L.updatedAtIso)),1)]),"right-hover":_t(()=>[p("div",{ref_for:!0,ref:ee=>Jt(L.id,ee),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:ct(ee=>_e(L.id),["stop"])},[Re(Ls,{class:"thread-icon"})],8,Sy),Q(L.id)?(w(),k("div",{key:0,class:"thread-menu-panel",onClick:$[4]||($[4]=ct(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:ee=>G(L.id)}," Export chat ",8,Iy),p("button",{class:"thread-menu-item",type:"button",onClick:ee=>de(L.id,L.title)}," Rename thread ",8,Ey),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:ee=>De(L.id,L.title)}," Delete thread ",8,Cy)])):ae("",!0)],512)]),default:_t(()=>[p("button",{class:"thread-main-button",type:"button",onClick:ee=>q(L.id)},[p("span",_y,[p("span",ky,ie(L.title),1),L.hasWorktree?(w(),ft(Fo,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ae("",!0)])],8,by)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])):(w(),k("div",{key:4,ref_key:"groupsContainerRef",ref:A,class:"thread-tree-groups",style:Jr($e.value)},[(w(!0),k(Be,null,St(gt.value,L=>(w(),k("article",{key:L.projectName,ref_for:!0,ref:ee=>H(L.projectName,ee),class:"project-group","data-project-name":L.projectName,"data-expanded":!xt(L.projectName),"data-dragging":se(L.projectName),style:Jr(qe(L.projectName))},[Re(Ur,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:ee=>Kt(L.projectName),onKeydown:[ee=>Qt(ee,L.projectName),dn(ct(ee=>Kt(L.projectName),["prevent"]),["enter"]),dn(ct(ee=>Kt(L.projectName),["prevent"]),["space"])]},{left:_t(()=>[p("span",Ry,[p("span",Py,[xt(L.projectName)?(w(),ft(Tl,{key:0,class:"thread-icon"})):(w(),ft(Dv,{key:1,class:"thread-icon"}))]),p("span",xy,[xt(L.projectName)?(w(),ft(Af,{key:0,class:"thread-icon"})):(w(),ft(Ti,{key:1,class:"thread-icon"}))])])]),right:_t(()=>[p("div",Oy,[p("div",{ref_for:!0,ref:ee=>bt(L.projectName,ee),class:"project-menu-wrap"},[p("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:ct(ee=>zt(L.projectName),["stop"])},[Re(Ls,{class:"thread-icon"})],8,Ny),tt(L.projectName)?(w(),k("div",{key:0,class:"project-menu-panel",onClick:$[6]||($[6]=ct(()=>{},["stop"]))},[u.value==="actions"?(w(),k(Be,{key:0},[p("button",{class:"project-menu-item",type:"button",onClick:ee=>Dt(L.projectName)}," Browse files ",8,Dy),p("button",{class:"project-menu-item",type:"button",onClick:ee=>kt(L.projectName)}," Edit name ",8,Ly),p("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:ee=>wt(L.projectName)}," Remove ",8,jy)],64)):(w(),k(Be,{key:1},[$[13]||($[13]=p("label",{class:"project-menu-label"},"Project name",-1)),cr(p("input",{"onUpdate:modelValue":$[5]||($[5]=ee=>c.value=ee),class:"project-menu-input",type:"text",onInput:ee=>Rt(L.projectName)},null,40,Uy),[[ur,c.value]])],64))])):ae("",!0)],512),p("button",{class:"thread-start-button",type:"button","aria-label":N(L.projectName),title:N(L.projectName),onClick:ct(ee=>V(L.projectName),["stop"])},[Re(ei,{class:"thread-icon"})],8,Fy)])]),default:_t(()=>[p("span",{class:"project-main-button","data-dragging-handle":se(L.projectName),onMousedown:ct(ee=>oe(ee,L.projectName),["left"])},[p("span",$y,ie(ot(L.projectName)),1)],40,My)]),_:2},1032,["onClick","onKeydown"]),an(L)?(w(),k("ul",By,[(w(!0),k(Be,null,St(bn(L),ee=>(w(),k("li",{key:ee.id,class:"thread-row-item"},[Re(Ur,{class:"thread-row","data-active":ee.id===e.selectedThreadId,"data-pinned":b(ee.id),onMouseleave:Ge=>J(ee.id)},{left:_t(()=>[p("span",Hy,[ee.inProgress||ee.unread?(w(),k("span",{key:0,class:"thread-status-indicator","data-state":Vt(ee)},null,8,Wy)):ae("",!0),p("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Ge=>x(ee.id)},[Re(sa,{class:"thread-icon"})],8,Vy)])]),right:_t(()=>[p("span",Ky,ie(g(ee.createdAtIso||ee.updatedAtIso)),1)]),"right-hover":_t(()=>[p("div",{ref_for:!0,ref:Ge=>Jt(ee.id,Ge),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:ct(Ge=>_e(ee.id),["stop"])},[Re(Ls,{class:"thread-icon"})],8,Jy),Q(ee.id)?(w(),k("div",{key:0,class:"thread-menu-panel",onClick:$[7]||($[7]=ct(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:Ge=>G(ee.id)}," Export chat ",8,Yy),p("button",{class:"thread-menu-item",type:"button",onClick:Ge=>de(ee.id,ee.title)}," Rename thread ",8,Xy),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Ge=>De(ee.id,ee.title)}," Delete thread ",8,Qy)])):ae("",!0)],512)]),default:_t(()=>[p("button",{class:"thread-main-button",type:"button",onClick:Ge=>q(ee.id)},[p("span",zy,[p("span",qy,ie(ee.title),1),ee.hasWorktree?(w(),ft(Fo,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ae("",!0)])],8,Gy)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])):(w(),ft(Ur,{key:1,as:"p",class:"project-empty-row"},{left:_t(()=>[...$[14]||($[14]=[p("span",{class:"project-empty-spacer"},null,-1)])]),default:_t(()=>[$[15]||($[15]=p("span",{class:"project-empty"},"No threads",-1))]),_:1})),_n(L)?(w(),ft(Ur,{key:2,class:"thread-show-more-row"},{left:_t(()=>[...$[16]||($[16]=[p("span",{class:"thread-show-more-spacer"},null,-1)])]),default:_t(()=>[p("button",{class:"thread-show-more-button",type:"button",onClick:ee=>Tt(L.projectName)},ie(qt(L.projectName)?"Show less":"Show more"),9,Zy)]),_:2},1024)):ae("",!0)],12,Ay))),128))],4)),(w(),ft(Ko,{to:"body"},[f.value?(w(),k("div",{key:0,class:"rename-thread-overlay",onClick:ct(Se,["self"])},[p("div",ew,[$[17]||($[17]=p("h3",{class:"rename-thread-title"},"Rename thread",-1)),$[18]||($[18]=p("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),cr(p("input",{ref_key:"renameThreadInputRef",ref:U,"onUpdate:modelValue":$[8]||($[8]=L=>T.value=L),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[dn(ct(Me,["prevent"]),["enter"]),dn(ct(Se,["prevent"]),["esc"])]},null,40,tw),[[ur,T.value]]),p("div",{class:"rename-thread-actions"},[p("button",{class:"rename-thread-button",type:"button",onClick:Se},"Cancel"),p("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Me},"Save")])])])):ae("",!0)])),(w(),ft(Ko,{to:"body"},[P.value?(w(),k("div",{key:0,class:"rename-thread-overlay",onClick:ct(Fe,["self"])},[p("div",nw,[$[19]||($[19]=p("h3",{class:"rename-thread-title"},"Delete thread?",-1)),p("p",rw,' This will archive the thread "'+ie(R.value)+'". You can find it later in archived threads. ',1),p("div",{class:"rename-thread-actions"},[p("button",{class:"rename-thread-button",type:"button",onClick:Fe},"Cancel"),p("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:He},"Delete")])])])):ae("",!0)]))]))}}),iw=st(ow,[["__scopeId","data-v-e2f8a8e1"]]),aw={class:"content-header"},lw={class:"content-leading"},cw={class:"content-title"},uw={class:"content-actions"},dw=Ht({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(w(),k("header",aw,[p("div",lw,[Gn(t.$slots,"leading",{},void 0)]),p("h1",cw,ie(e.title),1),p("div",uw,[Gn(t.$slots,"actions",{},void 0)])]))}}),fw=st(dw,[["__scopeId","data-v-66ee223c"]]),hw={},pw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function mw(e,t){return w(),k("svg",pw,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Sl=st(hw,[["render",mw]]),gw={},vw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function yw(e,t){return w(),k("svg",vw,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 14L4 9l5-5m-5 5h11a4 4 0 0 1 0 8H4"},null,-1)])])}const ww=st(gw,[["render",yw]]),bw={},_w={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function kw(e,t){return w(),k("svg",_w,[...t[0]||(t[0]=[p("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 Tw=st(bw,[["render",kw]]),Sw={class:"conversation-root"},Iw={key:0,class:"conversation-loading"},Ew={key:1,class:"conversation-empty"},Cw={class:"message-row"},Aw={class:"message-stack"},Rw={class:"request-card"},Pw={class:"request-title"},xw={class:"request-meta"},Mw={key:0,class:"request-reason"},$w={key:1,class:"request-actions"},Ow=["onClick"],Nw=["onClick"],Dw=["onClick"],Lw=["onClick"],jw={key:2,class:"request-actions"},Uw=["onClick"],Fw=["onClick"],Bw=["onClick"],Hw=["onClick"],Ww={key:3,class:"request-user-input"},Vw={class:"request-question-title"},Gw={key:0,class:"request-question-text"},zw=["value","onChange"],qw=["value"],Kw=["value","onInput"],Jw=["onClick"],Yw={key:4,class:"request-actions"},Xw=["onClick"],Qw=["onClick"],Zw={key:5,class:"request-actions"},eb=["onClick"],tb=["onClick"],nb=["data-role","data-message-type"],rb={key:0,class:"message-row","data-role":"system"},sb={class:"message-stack","data-role":"system"},ob=["onClick"],ib={class:"cmd-label"},ab={class:"cmd-status"},lb={class:"cmd-output-inner"},cb={class:"cmd-output"},ub=["data-role","data-message-type"],db=["data-role"],fb=["data-role"],hb=["data-role"],pb=["onClick"],mb=["src"],gb={key:1,class:"message-file-attachments"},vb={class:"message-file-link-wrap"},yb=["href","title"],wb=["href","title"],bb=["data-role"],_b={key:0,class:"worked-separator-wrap","aria-live":"polite"},kb=["onClick"],Tb={class:"worked-separator-text"},Sb={key:0,class:"worked-details"},Ib=["onClick"],Eb={class:"cmd-label"},Cb={class:"cmd-status"},Ab={class:"cmd-output-inner"},Rb={class:"cmd-output"},Pb={key:1,class:"message-text-flow"},xb={key:0,class:"message-text"},Mb={key:0},$b={key:1,class:"message-bold-text"},Ob={key:2,class:"message-file-link-wrap"},Nb=["href","title"],Db=["href","title"],Lb=["href","title"],jb={key:4,class:"message-inline-code"},Ub={key:1,class:"message-text"},Fb=["onClick"],Bb=["src","alt","onError"],Hb={key:0,class:"message-actions"},Wb=["onClick"],Vb=["onClick"],Gb={key:0,class:"conversation-item conversation-item-overlay"},zb={class:"message-row"},qb={class:"message-stack"},Kb={class:"live-overlay-inline","aria-live":"polite"},Jb={class:"live-overlay-label"},Yb={key:1,class:"live-overlay-error"},Xb=["src"],Qb=16,Zb=Ht({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{},isTurnInProgress:{type:Boolean},isRollingBack:{type:Boolean}},emits:["updateScrollState","respondServerRequest","rollback"],setup(e,{emit:t}){const n=D(new Set),r=D(new Set),s=D(new Set),o=D({});function i(_){return _.messageType==="commandExecution"&&!!_.commandExecution}function a(_){var S;return((S=_.commandExecution)==null?void 0:S.status)==="inProgress"||r.value.has(_.id)?!0:n.value.has(_.id)}function l(_){return r.value.has(_.id)}function u(_){var E;if(((E=_.commandExecution)==null?void 0:E.status)==="inProgress")return;const S=new Set(n.value);S.has(_.id)?S.delete(_.id):S.add(_.id),n.value=S}function c(_){const S=new Set(s.value);S.has(_.id)?S.delete(_.id):S.add(_.id),s.value=S}function f(_){return s.value.has(_.id)}function m(_){const S=_.commandExecution;if(!S)return"";switch(S.status){case"inProgress":return"⟳ Running";case"completed":return S.exitCode===0?"✓ Completed":`✗ Exit ${S.exitCode??"?"}`;case"failed":return"✗ Failed";case"declined":return"⊘ Declined";case"interrupted":return"⊘ Interrupted";default:return""}}function T(_){var E,O;const S=(E=_.commandExecution)==null?void 0:E.status;return S==="inProgress"?"cmd-status-running":S==="completed"&&((O=_.commandExecution)==null?void 0:O.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function U(_){const S=new Set(r.value);S.add(_),r.value=S,setTimeout(()=>{const E=new Set(r.value);E.delete(_),r.value=E},1e3)}function P(_,S){const E=[];for(let O=S-1;O>=0;O--){const H=_[O];if(H.messageType==="commandExecution")E.unshift(H);else if(H.role==="user"||H.messageType==="worked")break}return E}const F=e,R=t,A=D(null),B=D(null),W=D(null),ce=D(""),me=D({}),ve=D({});let Ie=0,re=0,le=0;const we=new WeakSet,Y=D(new Set);function Te(_){if(!_||_.endsWith("/")||_.endsWith("\\"))return!1;if(_.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(_))return!1;const S=_.startsWith("/"),E=/^[A-Za-z]:[\\/]/u.test(_),O=_.startsWith("./")||_.startsWith("../")||_.startsWith("~/"),H=_.includes("/")||_.includes("\\");return S||E||O||H}function xe(_){return _.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||_}function Le(_){return _.replace(/\\/gu,"/")}function Pe(_){if(!_.startsWith("file://"))return _;let S=_.replace(/^file:\/\//u,"");try{S=decodeURIComponent(S)}catch{}return/^\/[A-Za-z]:\//u.test(S)&&(S=S.slice(1)),S}function Oe(_){const S=Le(_),E=S.match(/^\/Users\/([^/]+)/u);if(E)return`/Users/${E[1]}`;const O=S.match(/^\/home\/([^/]+)/u);return O?`/home/${O[1]}`:""}function Ee(_){const S=Le(_);if(!S)return S;let E="",O=S;const H=O.match(/^([A-Za-z]:)(\/.*)?$/u);H?(E=`${H[1]}/`,O=(H[2]??"").replace(/^\/+/u,"")):O.startsWith("/")&&(E="/",O=O.slice(1));const oe=O.split("/").filter(Boolean),Ce=[];for(const Ke of oe)if(Ke!=="."){if(Ke===".."){Ce.length>0&&Ce.pop();continue}Ce.push(Ke)}const ge=Ce.join("/");return E?`${E}${ge}`.replace(/\/+$/u,"")||E:ge||S}function Ye(_,S){const E=Le(Pe(_.trim()));if(!E)return"";if(E.startsWith("/")||/^[A-Za-z]:\//u.test(E))return Ee(E);if(E.startsWith("~/")){const oe=Oe(S);if(oe)return Ee(`${oe}/${E.slice(2)}`)}const H=Le(S.trim());return Ee(H?`${H.replace(/\/+$/u,"")}/${E}`:E)}function Ze(_){if(!_)return null;let S=_.trim();S=Ne(S).core.trim();let O=null;const H=S.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(H)S=H[1],O=Number(H[2]);else{const oe=S.match(/^(.*):(\d+)(?::\d+)?$/u);oe&&(S=oe[1],O=Number(oe[2]))}return S=Pe(S),Te(S)?{path:S,line:O}:null}function Ne(_){let S=_,E="",O="";for(;/^['"`“‘]/u.test(S);)E+=S[0],S=S.slice(1);for(;/['"`”’]$/u.test(S);)O=S.slice(-1)+O,S=S.slice(0,-1);return{core:S,leading:E,trailing:O}}function nt(_){const S=_.trim(),E=gt(S,0);if(!E||E.end!==S.length)return null;const O=E.label.trim(),H=E.target.trim(),oe=Ne(O).core.trim()||O,Ce=Ne(H).core.trim();return Ce?{label:oe,target:Ce}:null}function gt(_,S){if(_[S]!=="[")return null;const E=_.indexOf("](",S+1);if(E<0)return null;const O=_.slice(S+1,E);if(!O||O.includes(`
|
|
26
|
+
`))return null;let H=E+2,oe=1;for(;H<_.length;){const Ce=_[H];if(Ce===`
|
|
27
|
+
`)return null;if(Ce==="(")oe+=1;else if(Ce===")"&&(oe-=1,oe===0)){const ge=_.slice(E+2,H);return ge.trim()?{label:O,target:ge,end:H+1}:null}H+=1}return null}function at(_){const S=[],E=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let O=0;for(const H of _.matchAll(E)){if(typeof H.index!="number")continue;const oe=H.index,Ce=oe+H[0].length;oe>O&&S.push({kind:"text",value:_.slice(O,oe)});let ge=H[0],Ke="";for(;/[.,;:]$/u.test(ge);)Ke=ge.slice(-1)+Ke,ge=ge.slice(0,-1);const lt=Ne(ge);ge=lt.core;const rt=lt.leading,Nt=lt.trailing+Ke;if(rt&&S.push({kind:"text",value:rt}),ge.startsWith("**")&&ge.endsWith("**")&&ge.length>4)S.push({kind:"bold",value:ge.slice(2,-2)}),Nt&&S.push({kind:"text",value:Nt});else if(/^https?:\/\//u.test(ge))S.push({kind:"url",value:ge,href:ge}),Nt&&S.push({kind:"text",value:Nt});else{const mn=Ze(ge);mn?(S.push({kind:"file",value:ge,path:mn.path,displayPath:ge,downloadName:xe(mn.path)}),Nt&&S.push({kind:"text",value:Nt})):S.push({kind:"text",value:H[0]})}O=Ce}return O<_.length&&S.push({kind:"text",value:_.slice(O)}),et(S)}function et(_){const S=[];let E=!1,O="";const H=oe=>{oe&&S.push({kind:"text",value:oe})};for(const oe of _){if(oe.kind!=="text"){E&&(H(`**${O}`),E=!1,O=""),S.push(oe);continue}let Ce=oe.value;for(;Ce.length>0;){const ge=Ce.indexOf("**");if(ge<0){E?O+=Ce:H(Ce);break}const Ke=Ce.slice(0,ge);E?O+=Ke:H(Ke),Ce=Ce.slice(ge+2),E?(O.length>0?S.push({kind:"bold",value:O}):H("****"),O="",E=!1):E=!0}}return E&&H(`**${O}`),S}function Xe(_){const S=[];let E=0;for(;E<_.length;){const O=_.indexOf("[",E);if(O<0)break;const H=gt(_,O);if(!H){E=O+1;continue}O>E&&S.push(...at(_.slice(E,O)));const oe=Ne(H.label.trim()).core.trim()||H.label.trim(),Ce=Ne(H.target.trim()).core.trim();if(/^https?:\/\//u.test(Ce))S.push({kind:"url",value:oe||Ce,href:Ce});else{const ge=Ze(Ce);ge?S.push({kind:"file",value:Ce,path:ge.path,displayPath:oe||Ce,downloadName:xe(ge.path)}):S.push({kind:"text",value:_.slice(O,H.end)})}E=H.end}return E<_.length&&S.push(...at(_.slice(E))),S}function K(_){if(!_.includes("`"))return Xe(_);const S=[];let E=0,O=0;for(;E<_.length;){if(_[E]!=="`"){E+=1;continue}let H=1;for(;E+H<_.length&&_[E+H]==="`";)H+=1;const oe="`".repeat(H);let Ce=E+H,ge=-1;for(;Ce<_.length;){const lt=_.indexOf(oe,Ce);if(lt<0)break;const rt=lt>0&&_[lt-1]==="`",Nt=lt+H<_.length&&_[lt+H]==="`",mn=_.slice(E+H,lt).includes(`
|
|
28
|
+
`);if(!rt&&!Nt&&!mn){ge=lt;break}Ce=lt+1}if(ge<0){E+=H;continue}E>O&&S.push(...Xe(_.slice(O,E)));const Ke=_.slice(E+H,ge);if(Ke.length>0){const lt=nt(Ke);if(lt)if(/^https?:\/\//u.test(lt.target))S.push({kind:"url",value:lt.label||lt.target,href:lt.target});else{const rt=Ze(lt.target);rt?S.push({kind:"file",value:lt.target,path:rt.path,displayPath:lt.label||lt.target,downloadName:xe(rt.path)}):S.push({kind:"code",value:Ke})}else{const rt=Ze(Ke);if(rt){const Nt=rt.line?`${rt.path}:${String(rt.line)}`:rt.path;S.push({kind:"file",value:Ke,path:rt.path,displayPath:Nt,downloadName:xe(rt.path)})}else S.push({kind:"code",value:Ke})}}else S.push({kind:"text",value:`${oe}${oe}`});E=ge+H,O=E}return O<_.length&&S.push(...Xe(_.slice(O))),S}function he(_){const S=_.trim();if(!S)return"";if(S.startsWith("data:")||S.startsWith("blob:")||S.startsWith("http://")||S.startsWith("https://")||S.startsWith("/codex-local-image?"))return S;if(S.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(S)}`;const E=S.startsWith("/"),O=/^[A-Za-z]:[\\/]/u.test(S);return E||O?`/codex-local-image?path=${encodeURIComponent(S)}`:S}function ue(_){const S=_.trim();if(!S)return"#";const E=Ce=>Ce.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(Ce),O=Ze(S),H=(O==null?void 0:O.path)??S,oe=Ye(H,F.cwd);if(E(oe)){const Ce=oe.startsWith("/")?oe:`/${oe}`;return`/codex-local-browse${encodeURI(Ce)}`}return"#"}function be(_){return $e(_)!=="#"}function $e(_){const S=_.trim();if(!S)return"#";const E=Ze(S),O=(E==null?void 0:E.path)??S,H=Ye(O,F.cwd);if(!(ge=>ge.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(ge))(H))return"#";const Ce=H.startsWith("/")?H:`/${H}`;return`/codex-local-edit${encodeURI(Ce)}`}function g(_){if(!_.includes(")return[{kind:"text",value:_}];const S=[],E=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let O=0;for(const H of _.matchAll(E)){const[oe,Ce,ge]=H;if(typeof H.index!="number")continue;const Ke=H.index,lt=Ke+oe.length,rt=he(ge.trim());rt&&(Ke>O&&S.push({kind:"text",value:_.slice(O,Ke)}),S.push({kind:"image",url:rt,alt:Ce.trim(),markdown:oe}),O=lt)}return O<_.length&&S.push({kind:"text",value:_.slice(O)}),S.length>0?S:[{kind:"text",value:_}]}function b(_){return _!==null&&typeof _=="object"&&!Array.isArray(_)?_:null}function x(_){const S=new Date(_);return Number.isNaN(S.getTime())?_:S.toLocaleTimeString()}function q(_){const S=b(_.params),E=S==null?void 0:S.reason;return typeof E=="string"?E.trim():""}function G(_,S){return`${String(_)}:${S}`}function N(_){const S=b(_.params),E=Array.isArray(S==null?void 0:S.questions)?S.questions:[],O=[];for(const H of E){const oe=b(H);if(!oe)continue;const Ce=typeof oe.id=="string"?oe.id:"";if(!Ce)continue;const ge=Array.isArray(oe.options)?oe.options.map(Ke=>b(Ke)).map(Ke=>Ke==null?void 0:Ke.label).filter(Ke=>typeof Ke=="string"&&Ke.length>0):[];O.push({id:Ce,header:typeof oe.header=="string"?oe.header:"",question:typeof oe.question=="string"?oe.question:"",isOther:oe.isOther===!0,options:ge})}return O}function V(_,S,E){const O=G(_,S),H=me.value[O];return typeof H=="string"&&H.length>0?H:E}function J(_,S){const E=G(_,S);return ve.value[E]??""}function Q(_,S,E){const O=E.target;if(!(O instanceof HTMLSelectElement))return;const H=G(_,S);me.value={...me.value,[H]:O.value}}function z(_,S,E){const O=E.target;if(!(O instanceof HTMLInputElement))return;const H=G(_,S);ve.value={...ve.value,[H]:O.value}}function _e(_,S){R("respondServerRequest",{id:_,result:{decision:S}})}function de(_){const S=N(_),E={};for(const O of S){const H=V(_.id,O.id,O.options[0]||""),oe=J(_.id,O.id).trim(),Ce=[H,oe].map(ge=>ge.trim()).filter(ge=>ge.length>0);E[O.id]={answers:Ce}}R("respondServerRequest",{id:_.id,result:{answers:E}})}function Se(_){R("respondServerRequest",{id:_,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function Me(_){R("respondServerRequest",{id:_,result:{success:!0,contentItems:[]}})}function De(_){R("respondServerRequest",{id:_,result:{}})}function Fe(_){R("respondServerRequest",{id:_,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function He(_){return!(_.role!=="user"&&_.role!=="assistant"||typeof _.turnIndex!="number"||F.isTurnInProgress||F.isRollingBack)}function ot(_){return _.role!=="user"&&_.role!=="assistant"?!1:_.text.trim().length>0}function tt(_){return ot(_)||He(_)}async function vt(_){if(!ot(_))return;const S=_.text.trim();try{await navigator.clipboard.writeText(S)}catch{const E=document.createElement("textarea");E.value=S,E.setAttribute("readonly","true"),E.style.position="fixed",E.style.opacity="0",document.body.appendChild(E),E.select(),document.execCommand("copy"),document.body.removeChild(E)}}function yt(_){if(!He(_))return;const S=_.role==="user"?_.text.trim():"";R("rollback",{turnIndex:_.turnIndex,prependText:S.length>0?S:void 0})}function jt(){const _=A.value,S=B.value;!_||!S||(_.scrollTop=_.scrollHeight,S.scrollIntoView({block:"end"}))}function zt(_){return _.scrollHeight-(_.scrollTop+_.clientHeight)<=Qb}function kt(_){if(!F.activeThreadId)return;const S=Math.max(_.scrollHeight-_.clientHeight,0),E=S>0?Math.min(Math.max(_.scrollTop/S,0),1):1;R("updateScrollState",{threadId:F.activeThreadId,state:{scrollTop:_.scrollTop,isAtBottom:zt(_),scrollRatio:E}})}function Rt(){const _=A.value;if(!_)return;const S=F.scrollState;if(!S||S.isAtBottom){wt();return}const E=Math.max(_.scrollHeight-_.clientHeight,0),O=typeof S.scrollRatio=="number"?S.scrollRatio*E:S.scrollTop;_.scrollTop=Math.min(Math.max(O,0),E),kt(_)}function wt(){const _=A.value;_&&(jt(),kt(_))}function Dt(){const _=F.scrollState;return!_||_.isAtBottom===!0}function Qt(){if(!Dt()){le=0,re=0;return}if(wt(),le-=1,le<=0){re=0;return}re=requestAnimationFrame(Qt)}function qt(_=6){Dt()&&(re&&(cancelAnimationFrame(re),re=0),le=Math.max(_,1),re=requestAnimationFrame(Qt))}function xt(){qt(3)}function Tt(){if(!Dt())return;const _=A.value;if(!_)return;const S=_.querySelectorAll("img.message-image-preview");for(const E of S)E.complete||we.has(E)||(we.add(E),E.addEventListener("load",xt,{once:!0}),E.addEventListener("error",xt,{once:!0}))}async function Kt(){await Yt(),Ie&&cancelAnimationFrame(Ie),Ie=requestAnimationFrame(()=>{Ie=0,Rt(),Tt(),qt()})}ut(()=>F.messages,async _=>{if(!F.isLoading){for(const S of _){if(S.messageType!=="commandExecution"||!S.commandExecution)continue;const E=o.value[S.id],O=S.commandExecution.status;E==="inProgress"&&O!=="inProgress"&&U(S.id),o.value[S.id]=O}await Kt()}}),ut(()=>F.liveOverlay,async _=>{_&&(await Yt(),wt(),qt(8))},{deep:!0}),ut(()=>F.isLoading,async _=>{_||await Kt()}),ut(()=>F.activeThreadId,()=>{ce.value="",Y.value=new Set},{flush:"post"});function It(){const _=A.value;!_||F.isLoading||kt(_)}function bt(_){ce.value=he(_)}function Jt(_,S){return`${_}:${String(S)}`}function yn(_,S){const E=new Set(Y.value);E.add(Jt(_,S)),Y.value=E}function $t(_,S){return Y.value.has(Jt(_,S))}function Wt(){ce.value=""}function wn(){const _=W.value;_&&(_.scrollTop=_.scrollHeight)}return ut(()=>{var _;return(_=F.liveOverlay)==null?void 0:_.reasoningText},async _=>{_&&(await Yt(),wn())}),mr(()=>{Ie&&cancelAnimationFrame(Ie),re&&cancelAnimationFrame(re)}),(_,S)=>(w(),k("section",Sw,[e.isLoading?(w(),k("p",Iw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(w(),k("p",Ew," No messages in this thread yet. ")):(w(),k("ul",{key:2,ref_key:"conversationListRef",ref:A,class:"conversation-list",onScroll:It},[(w(!0),k(Be,null,St(e.pendingRequests,E=>(w(),k("li",{key:`server-request:${E.id}`,class:"conversation-item conversation-item-request"},[p("div",Cw,[p("div",Aw,[p("article",Rw,[p("p",Pw,ie(E.method),1),p("p",xw,"Request #"+ie(E.id)+" · "+ie(x(E.receivedAtIso)),1),q(E)?(w(),k("p",Mw,ie(q(E)),1)):ae("",!0),E.method==="item/commandExecution/requestApproval"?(w(),k("section",$w,[p("button",{type:"button",class:"request-button request-button-primary",onClick:O=>_e(E.id,"accept")},"Accept",8,Ow),p("button",{type:"button",class:"request-button",onClick:O=>_e(E.id,"acceptForSession")},"Accept for Session",8,Nw),p("button",{type:"button",class:"request-button",onClick:O=>_e(E.id,"decline")},"Decline",8,Dw),p("button",{type:"button",class:"request-button",onClick:O=>_e(E.id,"cancel")},"Cancel",8,Lw)])):E.method==="item/fileChange/requestApproval"?(w(),k("section",jw,[p("button",{type:"button",class:"request-button request-button-primary",onClick:O=>_e(E.id,"accept")},"Accept",8,Uw),p("button",{type:"button",class:"request-button",onClick:O=>_e(E.id,"acceptForSession")},"Accept for Session",8,Fw),p("button",{type:"button",class:"request-button",onClick:O=>_e(E.id,"decline")},"Decline",8,Bw),p("button",{type:"button",class:"request-button",onClick:O=>_e(E.id,"cancel")},"Cancel",8,Hw)])):E.method==="item/tool/requestUserInput"?(w(),k("section",Ww,[(w(!0),k(Be,null,St(N(E),O=>(w(),k("div",{key:`${E.id}:${O.id}`,class:"request-question"},[p("p",Vw,ie(O.header||O.question),1),O.header&&O.question?(w(),k("p",Gw,ie(O.question),1)):ae("",!0),p("select",{class:"request-select",value:V(E.id,O.id,O.options[0]||""),onChange:H=>Q(E.id,O.id,H)},[(w(!0),k(Be,null,St(O.options,H=>(w(),k("option",{key:`${E.id}:${O.id}:${H}`,value:H},ie(H),9,qw))),128))],40,zw),O.isOther?(w(),k("input",{key:1,class:"request-input",type:"text",value:J(E.id,O.id),placeholder:"Other answer",onInput:H=>z(E.id,O.id,H)},null,40,Kw)):ae("",!0)]))),128)),p("button",{type:"button",class:"request-button request-button-primary",onClick:O=>de(E)}," Submit Answers ",8,Jw)])):E.method==="item/tool/call"?(w(),k("section",Yw,[p("button",{type:"button",class:"request-button request-button-primary",onClick:O=>Se(E.id)},"Fail Tool Call",8,Xw),p("button",{type:"button",class:"request-button",onClick:O=>Me(E.id)},"Success (Empty)",8,Qw)])):(w(),k("section",Zw,[p("button",{type:"button",class:"request-button request-button-primary",onClick:O=>De(E.id)},"Return Empty Result",8,eb),p("button",{type:"button",class:"request-button",onClick:O=>Fe(E.id)},"Reject Request",8,tb)]))])])])]))),128)),(w(!0),k(Be,null,St(e.messages,E=>{var O,H;return w(),k("li",{key:E.id,class:it(["conversation-item",{"conversation-item-actionable":tt(E)}]),"data-role":E.role,"data-message-type":E.messageType||""},[i(E)?(w(),k("div",rb,[p("div",sb,[p("button",{type:"button",class:it(["cmd-row",[T(E),{"cmd-expanded":a(E)}]]),onClick:oe=>u(E)},[p("span",{class:it(["cmd-chevron",{"cmd-chevron-open":a(E)}])},"▶",2),p("code",ib,ie(((O=E.commandExecution)==null?void 0:O.command)||"(command)"),1),p("span",ab,ie(m(E)),1)],10,ob),p("div",{class:it(["cmd-output-wrap",{"cmd-output-visible":a(E),"cmd-output-collapsing":l(E)}])},[p("div",lb,[p("pre",cb,ie(((H=E.commandExecution)==null?void 0:H.aggregatedOutput)||"(no output)"),1)])],2)])])):(w(),k("div",{key:1,class:"message-row","data-role":E.role,"data-message-type":E.messageType||""},[p("div",{class:"message-stack","data-role":E.role},[p("article",{class:"message-body","data-role":E.role},[E.images&&E.images.length>0?(w(),k("ul",{key:0,class:"message-image-list","data-role":E.role},[(w(!0),k(Be,null,St(E.images,oe=>(w(),k("li",{key:oe,class:"message-image-item"},[p("button",{class:"message-image-button",type:"button",onClick:Ce=>bt(oe)},[p("img",{class:"message-image-preview",src:he(oe),alt:"Message image preview",loading:"lazy"},null,8,mb)],8,pb)]))),128))],8,hb)):ae("",!0),E.fileAttachments&&E.fileAttachments.length>0?(w(),k("div",gb,[(w(!0),k(Be,null,St(E.fileAttachments,oe=>(w(),k("span",{key:oe.path,class:"message-file-chip"},[S[1]||(S[1]=p("span",{class:"message-file-chip-icon"},"📄",-1)),p("span",vb,[p("a",{class:"message-file-link message-file-chip-name",href:ue(oe.path),target:"_blank",rel:"noopener noreferrer",title:oe.path},ie(oe.path),9,yb),be(oe.path)?(w(),k("a",{key:0,class:"message-file-edit-link",href:$e(oe.path),target:"_blank",rel:"noopener noreferrer",title:`Edit ${oe.path}`,"aria-label":"Edit file"}," Edit ",8,wb)):ae("",!0)])]))),128))])):ae("",!0),E.text.length>0?(w(),k("article",{key:2,class:"message-card","data-role":E.role},[E.messageType==="worked"?(w(),k("div",_b,[p("button",{type:"button",class:"worked-separator",onClick:oe=>c(E)},[S[2]||(S[2]=p("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),p("span",{class:it(["worked-chevron",{"worked-chevron-open":f(E)}])},"▶",2),p("p",Tb,ie(E.text),1),S[3]||(S[3]=p("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,kb),f(E)?(w(),k("div",Sb,[(w(!0),k(Be,null,St(P(e.messages,e.messages.indexOf(E)),oe=>{var Ce,ge;return w(),k("div",{key:`worked-cmd-${oe.id}`,class:"worked-cmd-item"},[p("button",{type:"button",class:it(["cmd-row",[T(oe),{"cmd-expanded":a(oe)}]]),onClick:Ke=>u(oe)},[p("span",{class:it(["cmd-chevron",{"cmd-chevron-open":a(oe)}])},"▶",2),p("code",Eb,ie(((Ce=oe.commandExecution)==null?void 0:Ce.command)||"(command)"),1),p("span",Cb,ie(m(oe)),1)],10,Ib),p("div",{class:it(["cmd-output-wrap",{"cmd-output-visible":a(oe),"cmd-output-collapsing":l(oe)}])},[p("div",Ab,[p("pre",Rb,ie(((ge=oe.commandExecution)==null?void 0:ge.aggregatedOutput)||"(no output)"),1)])],2)])}),128))])):ae("",!0)])):(w(),k("div",Pb,[(w(!0),k(Be,null,St(g(E.text),(oe,Ce)=>(w(),k(Be,{key:`block-${Ce}`},[oe.kind==="text"?(w(),k("p",xb,[(w(!0),k(Be,null,St(K(oe.value),(ge,Ke)=>(w(),k(Be,{key:`seg-${Ce}-${Ke}`},[ge.kind==="text"?(w(),k("span",Mb,ie(ge.value),1)):ge.kind==="bold"?(w(),k("strong",$b,ie(ge.value),1)):ge.kind==="file"?(w(),k("span",Ob,[p("a",{class:"message-file-link",href:ue(ge.path),target:"_blank",rel:"noopener noreferrer",title:ge.path},ie(ge.displayPath),9,Nb),be(ge.path)?(w(),k("a",{key:0,class:"message-file-edit-link",href:$e(ge.path),target:"_blank",rel:"noopener noreferrer",title:`Edit ${ge.path}`,"aria-label":"Edit file"}," Edit ",8,Db)):ae("",!0)])):ge.kind==="url"?(w(),k("a",{key:3,class:"message-file-link",href:ge.href,target:"_blank",rel:"noopener noreferrer",title:ge.href},ie(ge.value),9,Lb)):(w(),k("code",jb,ie(ge.value),1))],64))),128))])):$t(E.id,Ce)?(w(),k("p",Ub,ie(oe.markdown),1)):(w(),k("button",{key:2,class:"message-image-button",type:"button",onClick:ge=>bt(oe.url)},[p("img",{class:"message-image-preview message-markdown-image",src:oe.url,alt:oe.alt||"Embedded message image",loading:"lazy",onError:ge=>yn(E.id,Ce)},null,40,Bb)],8,Fb))],64))),128))]))],8,bb)):ae("",!0)],8,fb),tt(E)?(w(),k("div",Hb,[ot(E)?(w(),k("button",{key:0,class:"message-action-button",type:"button",title:"Copy message text",onClick:oe=>vt(E)},[Re(Tw,{class:"message-action-icon"}),S[4]||(S[4]=p("span",{class:"message-action-label"},"Copy",-1))],8,Wb)):ae("",!0),He(E)?(w(),k("button",{key:1,class:"message-action-button",type:"button",title:"Rollback to this message (remove this turn and all after it)",onClick:oe=>yt(E)},[Re(ww,{class:"message-action-icon"}),S[5]||(S[5]=p("span",{class:"message-action-label"},"Rollback",-1))],8,Vb)):ae("",!0)])):ae("",!0)],8,db)],8,ub))],10,nb)}),128)),e.liveOverlay?(w(),k("li",Gb,[p("div",zb,[p("div",qb,[p("article",Kb,[p("p",Jb,ie(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(w(),k("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:W},ie(e.liveOverlay.reasoningText),513)):ae("",!0),e.liveOverlay.errorText?(w(),k("p",Yb,ie(e.liveOverlay.errorText),1)):ae("",!0)])])])])):ae("",!0),p("li",{ref_key:"bottomAnchorRef",ref:B,class:"conversation-bottom-anchor"},null,512)],544)),ce.value.length>0?(w(),k("div",{key:3,class:"image-modal-backdrop",onClick:Wt},[p("div",{class:"image-modal-content",onClick:S[0]||(S[0]=ct(()=>{},["stop"]))},[p("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:Wt},[Re(Sl,{class:"icon-svg"})]),p("img",{class:"image-modal-image",src:ce.value,alt:"Expanded message image"},null,8,Xb)])])):ae("",!0)]))}}),e_=st(Zb,[["__scopeId","data-v-bc40021f"]]),Zc=.0025,oa=3,eu=2,t_=256;function n_(e){var we;const t=D("idle"),n=D(typeof navigator<"u"&&!!((we=navigator.mediaDevices)!=null&&we.getUserMedia)),r=D(0),s=D(null);let o=null,i=null,a=[],l=null,u=null,c=null,f=null,m=[],T=!1,U=!1,P=null;function F(){P&&(P.abort(),P=null),t.value==="transcribing"&&(t.value="idle")}function R(){const Y=s.value;if(!Y||typeof window>"u")return;const Te=Y.getContext("2d");if(!Te)return;const xe=Math.max(1,Math.floor(Y.clientWidth)),Le=Math.max(1,Math.floor(Y.clientHeight||36)),Pe=window.devicePixelRatio||1,Oe=Math.max(1,Math.floor(xe*Pe)),Ee=Math.max(1,Math.floor(Le*Pe));(Y.width!==Oe||Y.height!==Ee)&&(Y.width=Oe,Y.height=Ee),Te.setTransform(Pe,0,0,Pe,0,0),Te.clearRect(0,0,xe,Le);const Ye=Math.max(12,Math.floor(xe/(oa+eu))),Ze=m.slice(-Ye),Ne=Math.max(0,Ye-Ze.length),nt=Le/2,gt=getComputedStyle(Y).color||"#000000";for(let at=0;at<Ye;at+=1){const et=Ze[at-Ne]??0,K=Math.max(.08,Math.min(1,et*18))*nt,he=at*(oa+eu);Te.globalAlpha=et<=Zc?.35:1,Te.fillStyle=gt,Te.fillRect(he,nt-K,oa,K*2)}Te.globalAlpha=1}function A(){m=[],r.value=0,R()}function B(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),u&&(u.disconnect(),u=null),l&&(l.close(),l=null),f=null}function W(Y){if(typeof window>"u")return;const Te=window.webkitAudioContext,xe=window.AudioContext??Te;xe&&(B(),A(),l=new xe,u=l.createMediaStreamSource(Y),c=l.createScriptProcessor(2048,1,1),f=performance.now(),c.onaudioprocess=Le=>{const Pe=Le.inputBuffer.getChannelData(0);let Oe=0;for(let Ee=0;Ee<Pe.length;Ee+=1){const Ye=Math.abs(Pe[Ee]??0);Oe+=Ye<Zc?0:Ye}m.push(Oe/Pe.length),m.length>t_&&m.shift(),f!==null&&(r.value=Math.max(0,performance.now()-f)),R()},u.connect(c),c.connect(l.destination),R())}async function ce(){var Y;if(t.value==="transcribing"&&F(),!(t.value!=="idle"||!n.value||T)){T=!0,U=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=Te=>{Te.data.size>0&&a.push(Te.data)},o.onstop=()=>{var Le;const Te=a,xe=(o==null?void 0:o.mimeType)||((Le=Te[0])==null?void 0:Le.type)||"audio/webm";re(),Ie(Te,xe)},W(i),o.start(250),t.value="recording",U&&me()}catch(Te){re(),t.value="idle",(Y=e.onError)==null||Y.call(e,Te)}finally{T=!1}}}function me(){if(T&&t.value==="idle"){U=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}function ve(){U=!1,F(),re(),t.value="idle"}async function Ie(Y,Te){var Pe,Oe,Ee,Ye,Ze;if(Y.length===0){(Pe=e.onEmpty)==null||Pe.call(e),t.value="idle";return}const xe=new Blob(Y,{type:Te});t.value="transcribing";let Le=null;try{const Ne=Te.split(/[/;]/)[1]??"webm",nt=new FormData;nt.append("file",xe,`codex.${Ne}`);const gt=((Oe=e.getLanguage)==null?void 0:Oe.call(e).trim())??"";gt&>.toLowerCase()!=="auto"&&nt.append("language",gt),Le=new AbortController,P=Le;const at=await fetch("/codex-api/transcribe",{method:"POST",body:nt,signal:Le.signal}),et=await at.text();let Xe=null;try{Xe=et.trim()?JSON.parse(et):null}catch{Xe=null}if(!at.ok){const he=(Ee=Xe==null?void 0:Xe.error)==null?void 0:Ee.trim(),ue=et.trim();throw new Error(he||ue||`Transcription failed: ${at.status}`)}const K=((Xe==null?void 0:Xe.text)??"").trim();K.length>0?e.onTranscript(K):(Ye=e.onEmpty)==null||Ye.call(e)}catch(Ne){if(Ne instanceof DOMException&&Ne.name==="AbortError")return;(Ze=e.onError)==null||Ze.call(e,Ne)}finally{Le&&P===Le&&(P=null),t.value==="transcribing"&&(t.value="idle")}}function re(){B(),A(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(Y=>Y.stop()),i=null),a=[]}mr(()=>{ve()});function le(){if(t.value==="recording"){me();return}(t.value==="idle"||t.value==="transcribing")&&ce()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:ce,stopRecording:me,toggleRecording:le,cancel:ve}}function tu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class or extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Il(e,t){const n=tu(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=tu(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function Ss(e,t,n){return e instanceof or?e:e instanceof Error?new or(e.message||t,{code:"unknown_error",method:n}):new or(t,{code:"unknown_error",method:n})}function Rf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function r_(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 or(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 or(Il(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 or(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function nu(e){const t=Rf(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 s_(e){if(typeof window>"u")return()=>{};let t=null,n=!1;const r=()=>{if(typeof EventSource>"u"||n)return;const s=new EventSource("/codex-api/events");s.onmessage=o=>{try{const i=JSON.parse(o.data),a=nu(i);a&&e(a)}catch{}},t=()=>s.close()};if(typeof WebSocket<"u"){const s=window.location.protocol==="https:"?"wss:":"ws:",o=new WebSocket(`${s}//${window.location.host}/codex-api/ws`);let i=!1,a=window.setTimeout(()=>{i||n||(o.close(),r())},2500);o.onopen=()=>{i=!0,a!==null&&(window.clearTimeout(a),a=null)},o.onmessage=l=>{try{const u=JSON.parse(String(l.data)),c=nu(u);c&&e(c)}catch{}},o.onerror=()=>{!i&&!n&&r()},o.onclose=()=>{a!==null&&(window.clearTimeout(a),a=null),!i&&!n&&r()},t=()=>o.close()}else r();return()=>{n=!0,t==null||t()}}async function o_(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 or(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 or(Il(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function i_(){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 or(Il(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Rf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function ru(e){return new Date(e*1e3).toISOString()}function a_(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function l_(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const c_=/^##\s+(.+?):\s+(.+?)\s*$/,u_=/^#\s*files mentioned by the user\s*:?\s*$/i;function d_(e){var s,o;const t=e.split(`
|
|
29
|
+
`).findIndex(i=>u_.test(i.trim()));if(t<0)return[];const n=e.split(`
|
|
30
|
+
`).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(c_);if(!l)break;const u=(s=l[1])==null?void 0:s.trim(),c=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");u&&c&&r.push({label:u,path:c})}return r}function f_(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 h_(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:l_(l),isUnhandled:!0});const o=n.join(`
|
|
31
|
+
`),i=d_(o);return{text:f_(o),images:r,fileAttachments:i,rawBlocks:s}}function p_(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=h_(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==="commandExecution"){const t=e,n=m_(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 m_(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function g_(e){const t=[e.preview];for(const n of t)if(typeof n=="string"&&n.trim().length>0)return n.trim();return""}function v_(e){const t=g_(e);return t.length>0?t:"Untitled thread"}function Pf(e){return(e==null?void 0:e.status)==="inProgress"}function y_(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 Pf(r)}function w_(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:v_(e),projectName:a_(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:ru(e.createdAt),updatedAtIso:ru(e.updatedAt),preview:e.preview,unread:!1,inProgress:y_(e)}}function b_(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 __(e){const t=e.data.map(w_);return b_(t)}function xf(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 p_(i))n.push({...a,turnIndex:r})}return n}function k_(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Pf(t.at(-1))}async function on(e,t){try{return await r_(e,t)}catch(n){throw Ss(n,`RPC ${e} failed`,e)}}function T_(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}function S_(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function I_(){const e=await on("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return __(e)}async function E_(e){const t=await on("thread/read",{threadId:e,includeTurns:!0});return{messages:xf(t),inProgress:k_(t)}}async function C_(){try{return await I_()}catch(e){throw Ss(e,"Failed to load thread groups","thread/list")}}async function A_(e){try{return await E_(e)}catch(t){throw Ss(t,`Failed to load thread ${e}`,"thread/read")}}function R_(e){return s_(e)}async function P_(e,t){await o_({id:e,...t})}async function x_(){return i_()}async function ia(e){await on("thread/resume",{threadId:e})}async function M_(e){await on("thread/archive",{threadId:e})}async function $_(e,t){await on("thread/name/set",{threadId:e,name:t})}async function su(e,t){const n=await on("thread/rollback",{threadId:e,numTurns:t});return xf(n)}function O_(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 ou(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 on("thread/start",n),s=O_(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw Ss(n,"Failed to start a new thread","thread/start")}}function N_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
32
|
+
`;for(const r of t)n+=`
|
|
33
|
+
## ${r.label}: ${r.path}
|
|
34
|
+
`;return`${n}
|
|
35
|
+
## My request for Codex:
|
|
36
|
+
|
|
37
|
+
${e}
|
|
38
|
+
`}async function aa(e,t,n=[],r,s,o,i=[]){try{const l=[{type:"text",text:N_(t,i)}];for(const f of n){const m=f.trim();m&&l.push({type:"image",url:m,image_url:m})}if(o)for(const f of o)l.push({type:"skill",name:f.name,path:f.path});const u=i.map(f=>({label:f.label,path:f.path,fsPath:f.fsPath})),c={threadId:e,input:l};u.length>0&&(c.attachments=u),typeof r=="string"&&r.length>0&&(c.model=r),typeof s=="string"&&s.length>0&&(c.effort=s),await on("turn/start",c)}catch(a){throw Ss(a,`Failed to start turn for thread ${e}`,"turn/start")}}async function D_(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 on("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw Ss(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function L_(e){await on("setDefaultModel",{model:e})}async function j_(e){const t=e==="fast"?"fast":"standard";await on("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function U_(){const e=await on("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 F_(){const e=await on("config/read",{}),t=e.config.model??"",n=T_(e.config.model_reasoning_effort),r=S_(e.config.service_tier);return{model:t,reasoningEffort:n,speedMode:r}}async function B_(){return await on("account/rateLimits/read")}function H_(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 Fa(){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 H_(n.data)}async function W_(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 V_(e,t){const n=await fetch("/codex-api/worktree/auto-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,message:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to auto-commit worktree changes");return r.data}async function G_(e,t){const n=await fetch("/codex-api/worktree/rollback-to-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,message:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to rollback worktree to message commit");return r.data}async function iu(){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 z_(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 au(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=Si(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 q_(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=Si(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 K_(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 u=Si(o,"Failed to search files");throw new Error(u)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const u of a){if(!u||typeof u!="object"||Array.isArray(u))continue;const f=u.path,m=typeof f=="string"?f.trim():"";m&&l.push({path:m})}return l}async function J_(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 Y_(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${r}`}async function X_(e,t=6){const n=Math.min(10,Math.max(1,Math.floor(t)));if(e.startsWith("search-")){const c=new Date;e==="search-daily"?c.setUTCDate(c.getUTCDate()-1):e==="search-weekly"?c.setUTCDate(c.getUTCDate()-7):c.setUTCDate(c.getUTCDate()-30);const f=new URLSearchParams({q:`created:>=${Y_(c)}`,sort:"stars",order:"desc",per_page:String(n)}),m=await fetch(`https://api.github.com/search/repositories?${f.toString()}`,{headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}});if(!m.ok)throw new Error(`Failed to fetch GitHub search projects (${m.status})`);const T=await m.json(),U=T&&typeof T=="object"&&!Array.isArray(T)?T:{},P=Array.isArray(U.items)?U.items:[],F=[];for(const R of P){if(!R||typeof R!="object"||Array.isArray(R))continue;const A=R,B=typeof A.id=="number"?A.id:0,W=typeof A.full_name=="string"?A.full_name.trim():"",ce=typeof A.html_url=="string"?A.html_url.trim():"";if(!B||!W||!ce)continue;const[me="",ve=""]=W.split("/",2);F.push({id:B,fullName:W,owner:me,repo:ve,url:ce,description:typeof A.description=="string"?A.description.trim():"",language:typeof A.language=="string"?A.language.trim():"",stars:typeof A.stargazers_count=="number"?A.stargazers_count:0})}return F}const r=e==="trending-daily"?"daily":e==="trending-weekly"?"weekly":"monthly",s=new URLSearchParams({since:r,limit:String(n)}),o=await fetch(`/codex-api/github-trending?${s.toString()}`),i=await o.json();if(!o.ok){const c=Si(i,"Failed to fetch GitHub trending projects");throw new Error(c)}const a=i&&typeof i=="object"&&!Array.isArray(i)?i:{},l=Array.isArray(a.data)?a.data:[],u=[];for(const c of l){if(!c||typeof c!="object"||Array.isArray(c))continue;const f=c,m=typeof f.id=="number"?f.id:0,T=typeof f.fullName=="string"?f.fullName.trim():"",U=typeof f.url=="string"?f.url.trim():"";if(!m||!T||!U)continue;const[P="",F=""]=T.split("/",2);u.push({id:m,fullName:T,owner:P,repo:F,url:U,description:typeof f.description=="string"?f.description.trim():"",language:typeof f.language=="string"?f.language.trim():"",stars:typeof f.stars=="number"?f.stars:0})}return u}function Si(e,t){const r=(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).error;return typeof r=="string"&&r.trim().length>0?r:t}async function Q_(){try{const e=await fetch("/codex-api/thread-titles");return e.ok?(await e.json()).data??{titles:{},order:[]}:{titles:{},order:[]}}catch{return{titles:{},order:[]}}}async function la(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 Z_(e,t){var n;try{return((n=(await on("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function ek(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await on("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 lu(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 tk={},nk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function rk(e,t){return w(),k("svg",nk,[...t[0]||(t[0]=[p("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 sk=st(tk,[["render",rk]]),ok={},ik={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ak(e,t){return w(),k("svg",ik,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 3L4 14h6l-1 7l9-11h-6z"},null,-1)])])}const lk=st(ok,[["render",ak]]),ck={},uk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function dk(e,t){return w(),k("svg",uk,[...t[0]||(t[0]=[p("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 fk=st(ck,[["render",dk]]),hk={},pk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function mk(e,t){return w(),k("svg",pk,[...t[0]||(t[0]=[p("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),p("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 cu=st(hk,[["render",mk]]),gk=["disabled"],vk={class:"composer-dropdown-value"},yk={class:"composer-dropdown-menu"},wk={key:0,class:"composer-dropdown-search-wrap"},bk=["placeholder","onKeydown"],_k={class:"composer-dropdown-options",role:"listbox"},kk=["onClick"],Tk={key:0,class:"composer-dropdown-empty"},Sk={key:1,class:"composer-dropdown-add-wrap"},Ik=["placeholder","onKeydown"],Ek=Ht({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},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(""),u=D(!1),c=D(""),f=fe(()=>{var we;const le=n.options.find(Y=>Y.value===n.modelValue);return le?le.label:((we=n.placeholder)==null?void 0:we.trim())||""}),m=fe(()=>n.openDirection??"down"),T=fe(()=>n.enableSearch===!0),U=fe(()=>n.showAddAction===!0),P=fe(()=>{var le;return((le=n.searchPlaceholder)==null?void 0:le.trim())||"Quick search projects"}),F=fe(()=>{var le;return((le=n.addActionLabel)==null?void 0:le.trim())||"Add new project"}),R=fe(()=>{var le;return((le=n.addPlaceholder)==null?void 0:le.trim())||"Project name or absolute path"}),A=fe(()=>{const le=l.value.trim().toLowerCase();return le?n.options.filter(we=>we.label.toLowerCase().includes(le)||we.value.toLowerCase().includes(le)):n.options});function B(){n.disabled||(a.value=!a.value)}function W(le){r("update:modelValue",le),a.value=!1,l.value=""}function ce(){var le;u.value=!0,c.value=((le=n.defaultAddValue)==null?void 0:le.trim())||"",Yt(()=>{var we;return(we=i.value)==null?void 0:we.focus()})}function me(){if(l.value.length>0){l.value="";return}a.value=!1}function ve(){const le=c.value.trim();le&&(r("add",le),u.value=!1,c.value="",a.value=!1,l.value="")}function Ie(){u.value=!1,c.value="",a.value=!1,l.value=""}function re(le){if(!a.value)return;const we=s.value;if(!we)return;const Y=le.target;Y instanceof Node&&(we.contains(Y)||(a.value=!1,l.value="",u.value=!1,c.value=""))}return ut(a,le=>{if(!le){u.value=!1,c.value="";return}T.value&&Yt(()=>{var we;return(we=o.value)==null?void 0:we.focus()})}),pr(()=>{window.addEventListener("pointerdown",re)}),mr(()=>{window.removeEventListener("pointerdown",re)}),(le,we)=>(w(),k("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[p("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:B},[e.selectedPrefixIcon?(w(),ft(Yo(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ae("",!0),p("span",vk,ie(f.value),1),Re(Ti,{class:"composer-dropdown-chevron"})],8,gk),a.value?(w(),k("div",{key:0,class:it(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":m.value==="up","composer-dropdown-menu-wrap-down":m.value==="down"}])},[p("div",yk,[T.value?(w(),k("div",wk,[cr(p("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":we[0]||(we[0]=Y=>l.value=Y),class:"composer-dropdown-search-input",type:"text",placeholder:P.value,onKeydown:dn(ct(me,["prevent"]),["esc"])},null,40,bk),[[ur,l.value]])])):ae("",!0),p("ul",_k,[(w(!0),k(Be,null,St(A.value,Y=>(w(),k("li",{key:Y.value},[p("button",{class:it(["composer-dropdown-option",{"is-selected":Y.value===e.modelValue}]),type:"button",onClick:Te=>W(Y.value)},ie(Y.label),11,kk)]))),128)),A.value.length===0?(w(),k("li",Tk," No matching projects ")):ae("",!0)]),U.value?(w(),k("div",Sk,[u.value?(w(),k(Be,{key:0},[cr(p("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":we[1]||(we[1]=Y=>c.value=Y),class:"composer-dropdown-add-input",type:"text",placeholder:R.value,onKeydown:[dn(ct(ve,["prevent"]),["enter"]),dn(ct(Ie,["prevent"]),["esc"])]},null,40,Ik),[[ur,c.value]]),p("div",{class:"composer-dropdown-add-actions"},[p("button",{type:"button",class:"composer-dropdown-add-btn",onClick:ve},"Open"),p("button",{type:"button",class:"composer-dropdown-add-btn",onClick:Ie},"Cancel")])],64)):(w(),k("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:ce},ie(F.value),1))])):ae("",!0)])],2)):ae("",!0)],512))}}),Ks=st(Ek,[["__scopeId","data-v-47426238"]]),Ck=["disabled"],Ak={class:"search-dropdown-value"},Rk={class:"search-dropdown-search-wrap"},Pk=["placeholder","onKeydown"],xk={key:0,class:"search-dropdown-list",role:"listbox"},Mk=["onClick","onPointerenter"],$k={class:"search-dropdown-option-check"},Ok={class:"search-dropdown-option-label"},Nk={key:0,class:"search-dropdown-option-desc"},Dk={key:1,class:"search-dropdown-empty"},Lk=Ht({__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),u=fe(()=>n.openDirection??"down"),c=fe(()=>new Set(n.selectedValues)),f=fe(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const A=n.options.find(B=>B.value===n.selectedValues[0]);return(A==null?void 0:A.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),m=fe(()=>{const A=a.value.toLowerCase().trim();return A?n.options.filter(B=>{var W;return B.label.toLowerCase().includes(A)||(((W=B.description)==null?void 0:W.toLowerCase().includes(A))??!1)}):n.options});function T(){n.disabled||(i.value=!i.value,i.value&&(a.value="",l.value=0,Yt(()=>{var A;return(A=o.value)==null?void 0:A.focus()})))}function U(A){r("toggle",A.value,!c.value.has(A.value))}function P(A){m.value.length!==0&&(l.value=(l.value+A+m.value.length)%m.value.length)}function F(){const A=m.value[l.value];A&&U(A)}function R(A){if(!i.value)return;const B=s.value;if(!B)return;const W=A.target;W instanceof Node&&(B.contains(W)||(i.value=!1))}return ut(a,()=>{l.value=0}),pr(()=>window.addEventListener("pointerdown",R)),mr(()=>window.removeEventListener("pointerdown",R)),(A,B)=>(w(),k("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[p("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:T},[p("span",Ak,ie(f.value),1),Re(Ti,{class:"search-dropdown-chevron"})],8,Ck),i.value?(w(),k("div",{key:0,class:it(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":u.value==="up","search-dropdown-menu-wrap-down":u.value==="down"}])},[p("div",Rk,[cr(p("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":B[0]||(B[0]=W=>a.value=W),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[B[1]||(B[1]=dn(ct(W=>i.value=!1,["prevent"]),["escape"])),dn(ct(F,["prevent"]),["enter"]),B[2]||(B[2]=dn(ct(W=>P(1),["prevent"]),["arrow-down"])),B[3]||(B[3]=dn(ct(W=>P(-1),["prevent"]),["arrow-up"]))]},null,40,Pk),[[ur,a.value]])]),m.value.length>0?(w(),k("ul",xk,[(w(!0),k(Be,null,St(m.value,(W,ce)=>(w(),k("li",{key:W.value},[p("button",{class:it(["search-dropdown-option",{"is-selected":c.value.has(W.value),"is-highlighted":ce===l.value}]),type:"button",onClick:me=>U(W),onPointerenter:me=>l.value=ce},[p("span",$k,ie(c.value.has(W.value)?"✓":""),1),p("span",Ok,ie(W.label),1),W.description?(w(),k("span",Nk,ie(W.description),1)):ae("",!0)],42,Mk)]))),128))])):(w(),k("div",Dk,"No results"))],2)):ae("",!0)],512))}}),jk=st(Lk,[["__scopeId","data-v-a0f2edd4"]]),Uk={class:"skill-picker-header"},Fk=["onKeydown"],Bk={key:0,class:"skill-picker-list",role:"listbox"},Hk=["onClick","onPointerenter"],Wk={class:"skill-picker-name"},Vk={key:0,class:"skill-picker-desc"},Gk={key:1,class:"skill-picker-empty"},zk=Ht({__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=fe(()=>{const m=i.value.toLowerCase().trim();return m?n.skills.filter(T=>T.name.toLowerCase().includes(m)||T.description.toLowerCase().includes(m)):n.skills}),u=fe(()=>{const m={};return n.anchorBottom!=null&&(m.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(m.left=`${n.anchorLeft}px`),m});function c(m){l.value.length!==0&&(a.value=(a.value+m+l.value.length)%l.value.length)}function f(){const m=l.value[a.value];m&&r("select",m)}return ut(()=>n.visible,m=>{m&&(i.value="",a.value=0,Yt(()=>{var T;return(T=o.value)==null?void 0:T.focus()}))}),ut(i,()=>{a.value=0}),(m,T)=>e.visible?(w(),k("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:Jr(u.value)},[p("div",Uk,[cr(p("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":T[0]||(T[0]=U=>i.value=U),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[T[1]||(T[1]=dn(ct(U=>m.$emit("close"),["prevent"]),["escape"])),dn(ct(f,["prevent"]),["enter"]),T[2]||(T[2]=dn(ct(U=>c(1),["prevent"]),["arrow-down"])),T[3]||(T[3]=dn(ct(U=>c(-1),["prevent"]),["arrow-up"]))]},null,40,Fk),[[ur,i.value]])]),l.value.length>0?(w(),k("ul",Bk,[(w(!0),k(Be,null,St(l.value,(U,P)=>(w(),k("li",{key:U.path},[p("button",{class:it(["skill-picker-item",{"is-highlighted":P===a.value}]),type:"button",onClick:F=>m.$emit("select",U),onPointerenter:F=>a.value=P},[p("span",Wk,ie(U.name),1),U.description?(w(),k("span",Vk,ie(U.description),1)):ae("",!0)],42,Hk)]))),128))])):(w(),k("div",Gk,"No skills found"))],4)):ae("",!0)}}),qk=st(zk,[["__scopeId","data-v-ff3fb7dc"]]),Kk={key:0,class:"thread-composer-dictation-error"},Jk={key:0,class:"thread-composer-attachments"},Yk=["src","alt"],Xk=["aria-label","disabled","onClick"],Qk={key:1,class:"thread-composer-folder-chips"},Zk=["title"],e0={class:"thread-composer-folder-chip-meta"},t0=["aria-label","disabled","onClick"],n0={key:2,class:"thread-composer-file-chips"},r0=["title"],s0=["aria-label","disabled","onClick"],o0={key:3,class:"thread-composer-skill-chips"},i0={class:"thread-composer-skill-chip-name"},a0=["aria-label","onClick"],l0={class:"thread-composer-input-wrap"},c0={key:0,class:"thread-composer-file-mentions"},u0=["onMousedown"],d0={key:1,class:"thread-composer-file-mention-icon-markdown"},f0={class:"thread-composer-file-mention-text"},h0={class:"thread-composer-file-mention-name"},p0={key:0,class:"thread-composer-file-mention-dir"},m0={key:1,class:"thread-composer-file-mention-empty"},g0=["placeholder","disabled"],v0=["disabled"],y0={key:0,class:"thread-composer-attach-menu"},w0=["disabled"],b0=["disabled"],_0=["disabled"],k0=["aria-checked","aria-label","disabled"],T0={class:"thread-composer-attach-setting-copy"},S0={class:"thread-composer-attach-setting-description"},I0={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},E0={key:1,class:"thread-composer-dictation-timer"},C0=["aria-label","title","disabled"],A0=["disabled"],R0=["aria-label","title","disabled"],P0=["disabled"],x0=["disabled"],M0=["disabled"],$0=Ht({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},models:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},isTurnInProgress:{type:Boolean},isInterruptingTurn:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},prependDraftRequest:{},dictationAutoSend:{type:Boolean},dictationLanguage:{}},emits:["submit","interrupt","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=D(""),i=D([]),a=D([]),l=D([]),u=D([]),c=D(""),{state:f,isSupported:m,recordingDurationMs:T,waveformCanvasRef:U,startRecording:P,stopRecording:F,toggleRecording:R,cancel:A}=n_({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:j=>{if(o.value=o.value?`${o.value}
|
|
39
|
+
${j}`:j,c.value="",r.dictationAutoSend!==!1){const X=r.isTurnInProgress?q.value:"steer";z(X,{rollbackLatestUserTurn:X==="steer"&&Ye}),Ye=!1;return}Yt(()=>{var X;return(X=ve.value)==null?void 0:X.focus()})},onEmpty:()=>{c.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:j=>{if(j instanceof DOMException&&j.name==="NotAllowedError"){c.value="Microphone access was denied.";return}c.value=j instanceof Error?j.message:"Dictation failed."}}),B=D(null),W=D(null),ce=D(null),me=D(null),ve=D(null),Ie=D(!1),re=D(!1),le=D(null),we=D(""),Y=D([]),Te=D(!1),xe=D(0),Le=D(0);let Pe=0,Oe=null,Ee=!1,Ye=!1;const Ze=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),Ne=[{value:"none",label:"None"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra high"}];function nt(j){return j.trim().replace(/^gpt/i,"GPT")}const gt=fe(()=>r.models.map(j=>({value:j,label:nt(j)}))),at=fe(()=>r.skills??[]),et=fe(()=>a.value.map(j=>j.path)),Xe=fe(()=>(r.skills??[]).map(j=>({value:j.path,label:j.name,description:j.description}))),K=fe(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId?!1:o.value.trim().length>0||i.value.length>0||l.value.length>0),he=fe(()=>o.value.trim().length>0||i.value.length>0||a.value.length>0||l.value.length>0||u.value.length>0),ue=fe(()=>{const j=new Set;for(const X of u.value)for(const se of X.filePaths)j.add(se);return l.value.filter(X=>!j.has(X.fsPath))}),be=fe(()=>r.disabled||!r.activeThreadId),$e=fe(()=>r.selectedModel.trim()==="gpt-5.4"),g=fe(()=>r.selectedSpeedMode==="fast"&&$e.value),b=fe(()=>be.value||r.isUpdatingSpeedMode===!0),x=fe(()=>r.isUpdatingSpeedMode?"Saving speed setting...":r.selectedSpeedMode==="fast"?"About 1.5x faster, with credits used at 2x":"Default speed with normal credit usage"),q=fe(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),G=fe(()=>f.value==="recording"),N=fe(()=>f.value==="recording"?"Stop dictation":r.dictationClickToToggle?"Click to dictate":"Hold to dictate"),V=fe(()=>f.value==="idle"?c.value.trim():""),J=fe(()=>{const j=Math.max(0,Math.floor(T.value/1e3)),X=Math.floor(j/60),se=j%60;return`${X}:${String(se).padStart(2,"0")}`}),Q=fe(()=>r.activeThreadId?"Type a message... (@ for files, / for skills)":"Select a thread to send a message");function z(j="steer",X){var qe;const se=o.value.trim();if(K.value){if(s("submit",{text:se,imageUrls:i.value.map(Pt=>Pt.url),fileAttachments:[...l.value],skills:a.value.map(Pt=>({name:Pt.name,path:Pt.path})),mode:j,rollbackLatestUserTurn:(X==null?void 0:X.rollbackLatestUserTurn)===!0}),de(),Ze){(qe=ve.value)==null||qe.blur();return}Yt(()=>{var Pt;return(Pt=ve.value)==null?void 0:Pt.focus()})}}function _e(j){Le.value+=1,o.value=j.text,i.value=j.imageUrls.map((X,se)=>({id:`queued-${Date.now()}-${se}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${se+1}`,url:X})),a.value=j.skills.map(X=>(r.skills??[]).find(se=>se.path===X.path)??{name:X.name,description:"",path:X.path}),l.value=j.fileAttachments.map(X=>({...X})),u.value=[],c.value="",Ie.value=!1,re.value=!1,_()}function de(){_e({text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Se(){s("interrupt")}function Me(j){s("update:selected-model",j)}function De(j){s("update:selected-reasoning-effort",j)}function Fe(){b.value||s("update:selected-speed-mode",r.selectedSpeedMode==="fast"?"standard":"fast")}function He(){r.dictationClickToToggle&&(c.value&&(c.value=""),f.value==="idle"&&(Ye=r.isTurnInProgress===!0&&r.inProgressSubmitMode==="steer"),R())}function ot(j){if(r.dictationClickToToggle||(j.preventDefault(),Ee))return;Ee=!0;const X=j.currentTarget;if(X)try{X.setPointerCapture(j.pointerId)}catch{}c.value&&(c.value=""),Ye=r.isTurnInProgress===!0&&r.inProgressSubmitMode==="steer",window.addEventListener("pointerup",tt),window.addEventListener("pointercancel",tt),window.addEventListener("blur",tt),P()}function tt(){r.dictationClickToToggle||Ee&&(Ee=!1,window.removeEventListener("pointerup",tt),window.removeEventListener("pointercancel",tt),window.removeEventListener("blur",tt),F())}function vt(){be.value||(Ie.value=!Ie.value)}function yt(){var j;(j=W.value)==null||j.click()}function jt(){var j;(j=ce.value)==null||j.click()}function zt(){var j;(j=me.value)==null||j.click()}function kt(j){i.value=i.value.filter(X=>X.id!==j)}function Rt(j){a.value=a.value.filter(X=>X.path!==j)}function wt(j){l.value=l.value.filter(X=>X.fsPath!==j)}function Dt(j){const X=u.value.find(qe=>qe.id===j);if(!X)return;const se=new Set(X.filePaths);l.value=l.value.filter(qe=>!se.has(qe.fsPath)),u.value=u.value.filter(qe=>qe.id!==j)}function Qt(j){return j.total<=0?0:Math.round(j.processed/j.total*100)}function qt(j,X){const se=j.replace(/\\/g,"/");if(l.value.some(bn=>bn.fsPath===se))return;const qe=se.split("/").filter(Boolean),Pt=(X==null?void 0:X.trim())||qe[qe.length-1]||se;l.value=[...l.value,{label:Pt,path:se,fsPath:se}]}function xt(j){return j.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(j.name)}function Tt(j){if(!j||j.length===0)return;const X=Le.value;for(const se of Array.from(j))if(xt(se)){const qe=new FileReader;qe.onload=()=>{X===Le.value&&typeof qe.result=="string"&&i.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:se.name,url:qe.result})},qe.readAsDataURL(se)}else lu(se).then(qe=>{X===Le.value&&qe&&qt(qe)}).catch(()=>{})}async function Kt(j){if(!j||j.length===0)return;const X=Le.value,se=Array.from(j),Pt=(se[0].webkitRelativePath||se[0].name).split("/").filter(Boolean)[0]||"Folder",bn=`${Date.now()}-${Math.random().toString(36).slice(2)}`;u.value=[...u.value,{id:bn,name:Pt,total:se.length,processed:0,filePaths:[],isUploading:!0}];const _n=an=>{X===Le.value&&(u.value=u.value.map(Vt=>Vt.id===bn?an(Vt):Vt))};for(const an of se)try{const Vt=await lu(an);if(X!==Le.value)return;if(Vt){const Dn=an.webkitRelativePath||an.name;qt(Vt,Dn),_n(I=>({...I,processed:I.processed+1,filePaths:[...I.filePaths,Vt]}));continue}_n(Dn=>({...Dn,processed:Dn.processed+1}))}catch{_n(Vt=>({...Vt,processed:Vt.processed+1}))}_n(an=>({...an,isUploading:!1}))}function It(j){j&&(j.value="")}function bt(j){const X=j.target;Tt((X==null?void 0:X.files)??null),It(X),Ie.value=!1}function Jt(j){const X=j.target;Tt((X==null?void 0:X.files)??null),It(X),Ie.value=!1}function yn(j){const X=j.target;Kt((X==null?void 0:X.files)??null),It(X),Ie.value=!1}function $t(){c.value&&(c.value="");const X=o.value.startsWith("/");X!==re.value&&(re.value=X),S()}function Wt(j){if(Te.value){if(j.key==="Escape"){j.preventDefault(),_();return}if(j.key==="ArrowDown"){j.preventDefault(),Y.value.length>0&&(xe.value=(xe.value+1)%Y.value.length);return}if(j.key==="ArrowUp"){if(j.preventDefault(),Y.value.length>0){const se=Y.value.length;xe.value=(xe.value+se-1)%se}return}if(j.key==="Enter"||j.key==="Tab"){j.preventDefault();const se=Y.value[xe.value];se?O(se):_();return}}if(r.sendWithEnter!==!1?j.key==="Enter"&&!j.shiftKey:j.key==="Enter"&&(j.metaKey||j.ctrlKey)){j.preventDefault(),z(r.isTurnInProgress?q.value:"steer");return}if(re.value){if(j.key==="Escape"){j.preventDefault(),wn();return}if(j.key==="ArrowDown"||j.key==="ArrowUp"){j.preventDefault();return}}}function wn(){var j;re.value=!1,(j=ve.value)==null||j.focus()}function _(){Te.value=!1,le.value=null,we.value="",Y.value=[],xe.value=0}function S(){const j=ve.value;if(!j){_();return}const X=j.selectionStart??o.value.length,qe=o.value.slice(0,X).match(/(^|\s)(@[^\s@]*)$/);if(!qe){_();return}const Pt=qe[2]??"",bn=Pt.length,_n=X-bn;le.value=_n,we.value=Pt.slice(1),Te.value=!0,E()}async function E(){if(!Te.value)return;const j=(r.cwd??"").trim();if(!j){Y.value=[];return}Oe&&clearTimeout(Oe);const X=++Pe;Oe=setTimeout(async()=>{try{const se=await K_(j,we.value,20);if(!Te.value||X!==Pe)return;Y.value=se,xe.value=0}catch{if(!Te.value||X!==Pe)return;Y.value=[]}},120)}function O(j){const X=ve.value,se=le.value;if(se!==null&&X){const qe=X.selectionStart??o.value.length;o.value=`${o.value.slice(0,se)}${o.value.slice(qe)}`.trimEnd()}qt(j.path),_(),Yt(()=>X==null?void 0:X.focus())}function H(j){A(),_e(j),Yt(()=>{var X;return(X=ve.value)==null?void 0:X.focus()})}function oe(j){const X=j.lastIndexOf("/");return X<0?j:j.slice(X+1)}function Ce(j){const X=j.lastIndexOf("/");return X<=0?"":j.slice(0,X)}function ge(j){const X=oe(j),se=X.lastIndexOf(".");return se<=0?"":X.slice(se+1).toLowerCase()}function Ke(j){const X=ge(j);return X==="ts"?"TS":X==="tsx"?"TSX":X==="js"?"JS":X==="jsx"?"JSX":X==="json"?"{}":""}function lt(j){const X=ge(j);return X.startsWith("ts")?"ts":X.startsWith("js")?"js":X==="json"?"json":"default"}function rt(j){const X=ge(j);return X==="md"||X==="mdx"}function Nt(j){var X;a.value.some(se=>se.path===j.path)||(a.value=[...a.value,j]),o.value=o.value.startsWith("/")?"":o.value,re.value=!1,(X=ve.value)==null||X.focus()}function mn(j,X){if(X){const se=(r.skills??[]).find(qe=>qe.path===j);se&&!a.value.some(qe=>qe.path===j)&&(a.value=[...a.value,se])}else a.value=a.value.filter(se=>se.path!==j)}function Nn(j){if(!Ie.value)return;const X=B.value;if(!X)return;const se=j.target;!se||X.contains(se)||(Ie.value=!1)}return pr(()=>{document.addEventListener("click",Nn)}),t({hydrateDraft:H,hasUnsavedDraft:()=>he.value}),mr(()=>{document.removeEventListener("click",Nn),window.removeEventListener("pointerup",tt),window.removeEventListener("pointercancel",tt),window.removeEventListener("blur",tt),Oe&&clearTimeout(Oe)}),ut(()=>r.activeThreadId,()=>{A(),de()}),ut(()=>r.cwd,()=>{Te.value&&E()}),ut(()=>{var j;return(j=r.prependDraftRequest)==null?void 0:j.id},()=>{var X,se;const j=((se=(X=r.prependDraftRequest)==null?void 0:X.text)==null?void 0:se.trim())??"";j&&(o.value=o.value?`${j}
|
|
40
|
+
${o.value}`:j,$t(),Yt(()=>{var qe;return(qe=ve.value)==null?void 0:qe.focus()}))}),(j,X)=>(w(),k("form",{class:"thread-composer",onSubmit:X[2]||(X[2]=ct(se=>z("steer"),["prevent"]))},[V.value?(w(),k("p",Kk,ie(V.value),1)):ae("",!0),p("div",{class:it(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[i.value.length>0?(w(),k("div",Jk,[(w(!0),k(Be,null,St(i.value,se=>(w(),k("div",{key:se.id,class:"thread-composer-attachment"},[p("img",{class:"thread-composer-attachment-image",src:se.url,alt:se.name||"Selected image"},null,8,Yk),p("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${se.name||"image"}`,disabled:be.value,onClick:qe=>kt(se.id)}," x ",8,Xk)]))),128))])):ae("",!0),u.value.length>0?(w(),k("div",Qk,[(w(!0),k(Be,null,St(u.value,se=>(w(),k("span",{key:se.id,class:"thread-composer-folder-chip"},[Re(Tl,{class:"thread-composer-folder-chip-icon"}),p("span",{class:"thread-composer-folder-chip-name",title:se.name},ie(se.name),9,Zk),p("span",e0,[se.isUploading?(w(),k(Be,{key:0},[no(ie(Qt(se))+"% uploading ("+ie(se.processed)+"/"+ie(se.total)+") ",1)],64)):(w(),k(Be,{key:1},[no(ie(se.filePaths.length)+" file"+ie(se.filePaths.length===1?"":"s"),1)],64))]),p("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${se.name}`,disabled:be.value,onClick:qe=>Dt(se.id)},"×",8,t0)]))),128))])):ae("",!0),ue.value.length>0?(w(),k("div",n0,[(w(!0),k(Be,null,St(ue.value,se=>(w(),k("span",{key:se.fsPath,class:"thread-composer-file-chip"},[Re(ei,{class:"thread-composer-file-chip-icon"}),p("span",{class:"thread-composer-file-chip-name",title:se.fsPath},ie(se.label),9,r0),p("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${se.label}`,disabled:be.value,onClick:qe=>wt(se.fsPath)},"×",8,s0)]))),128))])):ae("",!0),a.value.length>0?(w(),k("div",o0,[(w(!0),k(Be,null,St(a.value,se=>(w(),k("span",{key:se.path,class:"thread-composer-skill-chip"},[p("span",i0,ie(se.name),1),p("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${se.name}`,onClick:qe=>Rt(se.path)},"×",8,a0)]))),128))])):ae("",!0),p("div",l0,[Te.value?(w(),k("div",c0,[Y.value.length>0?(w(!0),k(Be,{key:0},St(Y.value,(se,qe)=>(w(),k("button",{key:se.path,class:it(["thread-composer-file-mention-row",{"is-active":qe===xe.value}]),type:"button",onMousedown:ct(Pt=>O(se),["prevent"])},[Ke(se.path)?(w(),k("span",{key:0,class:it(["thread-composer-file-mention-icon-badge",`is-${lt(se.path)}`])},ie(Ke(se.path)),3)):rt(se.path)?(w(),k("span",d0,"↓")):(w(),ft(ei,{key:2,class:"thread-composer-file-mention-icon-file"})),p("span",f0,[p("span",h0,ie(oe(se.path)),1),Ce(se.path)?(w(),k("span",p0,ie(Ce(se.path)),1)):ae("",!0)])],42,u0))),128)):(w(),k("div",m0,"No matching files"))])):ae("",!0),cr(p("textarea",{ref_key:"inputRef",ref:ve,"onUpdate:modelValue":X[0]||(X[0]=se=>o.value=se),class:"thread-composer-input",placeholder:Q.value,disabled:be.value,onInput:$t,onKeydown:Wt},null,40,g0),[[ur,o.value]]),Re(qk,{skills:at.value,visible:re.value,"anchor-bottom":44,"anchor-left":0,onSelect:Nt,onClose:wn},null,8,["skills","visible"])]),p("div",{class:it(["thread-composer-controls",{"thread-composer-controls--recording":G.value}])},[p("div",{ref_key:"attachMenuRootRef",ref:B,class:"thread-composer-attach"},[p("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:be.value,onClick:vt}," + ",8,v0),Ie.value?(w(),k("div",y0,[p("button",{class:"thread-composer-attach-item",type:"button",disabled:be.value,onClick:yt}," Add photos & files ",8,w0),p("button",{class:"thread-composer-attach-item",type:"button",disabled:be.value,onClick:zt}," Add folder ",8,b0),p("button",{class:"thread-composer-attach-item",type:"button",disabled:be.value,onClick:jt}," Take photo ",8,_0),X[4]||(X[4]=p("div",{class:"thread-composer-attach-separator"},null,-1)),$e.value?(w(),k("button",{key:0,class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":e.selectedSpeedMode==="fast","aria-label":`Fast mode ${e.selectedSpeedMode==="fast"?"enabled":"disabled"}`,disabled:b.value,onClick:Fe},[p("span",T0,[X[3]||(X[3]=p("span",{class:"thread-composer-attach-setting-label"},"Fast mode",-1)),p("span",S0,ie(x.value),1)]),p("span",{class:it(["thread-composer-attach-switch",{"is-on":e.selectedSpeedMode==="fast","is-busy":e.isUpdatingSpeedMode,"is-disabled":b.value}])},null,2)],8,k0)):ae("",!0)])):ae("",!0)],512),G.value?ae("",!0):(w(),k(Be,{key:0},[Re(Ks,{class:"thread-composer-control","model-value":e.selectedModel,options:gt.value,"selected-prefix-icon":g.value?lk:null,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":Me},null,8,["model-value","options","selected-prefix-icon","disabled"]),Re(jk,{class:"thread-composer-control",options:Xe.value,"selected-values":et.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:mn},null,8,["options","selected-values","disabled"]),Re(Ks,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Ne,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":De},null,8,["model-value","disabled"])],64)),p("div",{class:it(["thread-composer-actions",{"thread-composer-actions--recording":G.value}])},[ye(f)==="recording"?(w(),k("div",I0,[p("canvas",{ref_key:"dictationWaveformCanvasRef",ref:U,class:"thread-composer-dictation-waveform"},null,512)])):ae("",!0),ye(f)==="recording"?(w(),k("span",E0,ie(J.value),1)):ae("",!0),ye(m)?(w(),k("button",{key:2,class:it(["thread-composer-mic",{"thread-composer-mic--active":ye(f)==="recording"}]),type:"button","aria-label":N.value,title:N.value,disabled:be.value,onClick:He,onPointerdown:ot,onPointerup:tt,onPointercancel:tt},[ye(f)==="recording"?(w(),ft(cu,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(w(),ft(fk,{key:1,class:"thread-composer-mic-icon"}))],42,C0)):ae("",!0),e.isTurnInProgress?(w(),k("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:Se},[Re(cu,{class:"thread-composer-stop-icon"})],8,A0)):(w(),k("button",{key:4,class:it(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&q.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&q.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${q.value}`:"Send",disabled:!K.value,onClick:X[1]||(X[1]=se=>z(e.isTurnInProgress?q.value:"steer"))},[Re(sk,{class:"thread-composer-submit-icon"})],10,R0))],2)],2)],2),p("input",{ref_key:"photoLibraryInputRef",ref:W,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:be.value,onChange:bt},null,40,P0),p("input",{ref_key:"cameraCaptureInputRef",ref:ce,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:be.value,onChange:Jt},null,40,x0),p("input",{ref_key:"folderPickerInputRef",ref:me,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:be.value,onChange:yn},null,40,M0)],32))}}),uu=st($0,[["__scopeId","data-v-dab59279"]]),O0={key:0,class:"queued-messages"},N0={class:"queued-messages-inner"},D0={class:"queued-row-text"},L0={class:"queued-row-actions"},j0=["onClick"],U0=["onClick"],F0=["onClick"],B0=Ht({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete"],setup(e){function t(n){var l,u,c;const r=n.text.trim();if(r)return r;const s=[],o=((l=n.imageUrls)==null?void 0:l.length)??0,i=((u=n.fileAttachments)==null?void 0:u.length)??0,a=((c=n.skills)==null?void 0:c.length)??0;return o>0&&s.push(`${o} image${o===1?"":"s"}`),i>0&&s.push(`${i} file${i===1?"":"s"}`),a>0&&s.push(`${a} skill${a===1?"":"s"}`),s.join(", ")||"(empty queued message)"}return(n,r)=>e.messages.length>0?(w(),k("div",O0,[p("div",N0,[(w(!0),k(Be,null,St(e.messages,s=>(w(),k("div",{key:s.id,class:"queued-row"},[r[1]||(r[1]=p("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[p("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)),p("span",D0,ie(t(s)),1),p("div",L0,[p("button",{class:"queued-row-edit",type:"button",title:"Edit queued message",onClick:o=>n.$emit("edit",s.id)},"Edit",8,j0),p("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:o=>n.$emit("steer",s.id)},"Steer",8,U0),p("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:o=>n.$emit("delete",s.id)},[...r[0]||(r[0]=[p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[p("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,F0)])]))),128))])])):ae("",!0)}}),H0=st(B0,[["__scopeId","data-v-1394d0f8"]]),W0={key:0,class:"rate-limit-status","aria-live":"polite"},V0=["title"],G0={class:"rate-limit-card-header"},z0={class:"rate-limit-card-title"},q0={key:0,class:"rate-limit-card-plan"},K0={class:"rate-limit-card-metrics"},J0={key:0,class:"rate-limit-card-footer"},Y0=Ht({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(R){var A,B;return((A=R.limitId)==null?void 0:A.trim())||((B=R.limitName)==null?void 0:B.trim())||"__default__"}function n(R){var A,B;return((A=R.limitName)==null?void 0:A.trim())||((B=R.limitId)==null?void 0:B.trim())||"Rate limits"}function r(R){const A=R.trim();return A?A.replace(/[_-]+/g," ").replace(/\b\w/g,B=>B.toUpperCase()):""}function s(R){return!R||R<=0?"Window":R%1440===0?`${R/1440}d`:R%60===0?`${R/60}h`:R<60?`${R}m`:`${Math.round(R/60*10)/10}h`}function o(R){const A=Math.max(0,Math.min(100,100-R));return`${Math.round(A)}% left`}function i(R){return`${Math.round(R)}%`}function a(R,A){return{key:A,label:`${s(R.windowDurationMins)} ${o(R.usedPercent)}`}}function l(R){const A=[];return R.primary&&A.push(a(R.primary,"primary")),R.secondary&&A.push(a(R.secondary,"secondary")),A}function u(R){if(!R)return"";const A=new Date(R*1e3),B=A.getMonth()+1,W=String(A.getDate()).padStart(2,"0"),ce=String(A.getHours()).padStart(2,"0"),me=String(A.getMinutes()).padStart(2,"0");return`${B}.${W} ${ce}:${me}`}function c(R){if(!(R!=null&&R.resetsAt))return"";const A=R.resetsAt*1e3-Date.now();if(A<=0)return"Resetting now";const B=Math.round(A/6e4);if(B<60)return`Resets in ${B}m`;const W=Math.round(B/60);return W<24?`Resets in ${W}h`:`Resets in ${Math.round(W/24)}d`}function f(R){return[R.primary,R.secondary].filter(A=>A!==null)}function m(R){const A=f(R);return A.length===0?null:[...A].sort((B,W)=>{const ce=B.windowDurationMins??Number.MAX_SAFE_INTEGER,me=W.windowDurationMins??Number.MAX_SAFE_INTEGER;return ce!==me?ce-me:(B.resetsAt??Number.MAX_SAFE_INTEGER)-(W.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function T(R){const A=f(R);if(A.length===0)return"";const B=[...A].sort((ce,me)=>{const ve=ce.windowDurationMins??-1,Ie=me.windowDurationMins??-1;return ve!==Ie?Ie-ve:(me.resetsAt??-1)-(ce.resetsAt??-1)})[0],W=u(B.resetsAt);return W||""}function U(R){const A=R.credits;return A?A.unlimited?"Unlimited credits":A.balance?`Credits ${A.balance}`:A.hasCredits?"Credits available":"":""}function P(R){return[c(m(R)),T(R),U(R)].filter(A=>A.length>0)}function F(R){const A=[n(R)];for(const B of l(R))A.push(B.label);for(const B of f(R))A.push(`${s(B.windowDurationMins)} used ${i(B.usedPercent)}`);for(const B of P(R))A.push(B);return A.join(`
|
|
41
|
+
`)}return(R,A)=>e.snapshots.length>0?(w(),k("aside",W0,[(w(!0),k(Be,null,St(e.snapshots,B=>(w(),k("div",{key:t(B),class:"rate-limit-card",title:F(B)},[p("div",G0,[p("span",z0,ie(n(B)),1),B.planType?(w(),k("span",q0,ie(r(B.planType)),1)):ae("",!0)]),p("div",K0,[(w(!0),k(Be,null,St(l(B),W=>(w(),k("span",{key:W.key,class:"rate-limit-card-metric"},ie(W.label),1))),128))]),P(B).length>0?(w(),k("div",J0,ie(P(B).join(" | ")),1)):ae("",!0)],8,V0))),128))])):ae("",!0)}}),X0=st(Y0,[["__scopeId","data-v-df88906b"]]),Q0={class:"runtime-dropdown-trigger-label"},Z0={key:0,class:"runtime-dropdown-menu-wrap"},eT={class:"runtime-dropdown-menu"},tT=["onClick"],nT={class:"runtime-dropdown-option-label"},rT={key:0,class:"runtime-dropdown-option-check"},sT=Ht({__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:Tl},{value:"worktree",label:"New worktree",icon:Fo}],a=fe(()=>i.find(c=>c.value===n.modelValue)??i[0]);function l(c){r("update:modelValue",c),o.value=!1}function u(c){if(!o.value)return;const f=s.value;if(!f)return;const m=c.target;m instanceof Node&&(f.contains(m)||(o.value=!1))}return pr(()=>{window.addEventListener("pointerdown",u)}),mr(()=>{window.removeEventListener("pointerdown",u)}),(c,f)=>(w(),k("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[p("button",{class:"runtime-dropdown-trigger",type:"button",onClick:f[0]||(f[0]=m=>o.value=!o.value)},[(w(),ft(Yo(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),p("span",Q0,ie(a.value.label),1),Re(Ti,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(w(),k("div",Z0,[p("div",eT,[f[1]||(f[1]=p("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(w(),k(Be,null,St(i,m=>p("button",{key:m.value,class:it(["runtime-dropdown-option",{"is-selected":e.modelValue===m.value}]),type:"button",onClick:T=>l(m.value)},[(w(),ft(Yo(m.icon),{class:"runtime-dropdown-option-icon"})),p("span",nT,ie(m.label),1),e.modelValue===m.value?(w(),k("span",rT,"✓")):ae("",!0)],10,tT)),64))])])):ae("",!0)],512))}}),oT=st(sT,[["__scopeId","data-v-9c9b71e5"]]),iT={},aT={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function lT(e,t){return w(),k("svg",aT,[...t[0]||(t[0]=[p("circle",{cx:"11",cy:"11",r:"8"},null,-1),p("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Ba=st(iT,[["render",lT]]),cT={class:"skill-card-top"},uT=["src","alt"],dT={key:1,class:"skill-card-avatar-fallback"},fT={class:"skill-card-info"},hT={class:"skill-card-header"},pT={class:"skill-card-name"},mT={key:0,class:"skill-card-badge-disabled"},gT={key:1,class:"skill-card-badge"},vT={class:"skill-card-owner"},yT={key:0,class:"skill-card-desc"},wT={key:1,class:"skill-card-date"},bT=Ht({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=fe(()=>{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)=>(w(),k("button",{class:it(["skill-card",{"is-disabled":e.skill.installed&&e.skill.enabled===!1}]),type:"button",onClick:o[0]||(o[0]=i=>s.$emit("select",e.skill))},[p("div",cT,[e.skill.avatarUrl?(w(),k("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,uT)):(w(),k("div",dT,ie(e.skill.owner.charAt(0)),1)),p("div",fT,[p("div",hT,[p("span",pT,ie(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(w(),k("span",mT,"Disabled")):e.skill.installed?(w(),k("span",gT,"Installed")):ae("",!0)]),p("span",vT,ie(e.skill.owner),1)])]),e.skill.description?(w(),k("p",yT,ie(e.skill.description),1)):ae("",!0),n.value?(w(),k("span",wT,ie(n.value),1)):ae("",!0)],2))}}),du=st(bT,[["__scopeId","data-v-2a1e8196"]]),_T={class:"sdm-panel"},kT={class:"sdm-header"},TT={class:"sdm-title-area"},ST=["src","alt"],IT={class:"sdm-title-col"},ET={class:"sdm-title-row"},CT={class:"sdm-title"},AT={key:0,class:"sdm-badge-disabled"},RT={class:"sdm-owner"},PT={class:"sdm-body"},xT={key:0,class:"sdm-desc"},MT={key:1,class:"sdm-readme-loading"},$T=["innerHTML"],OT=["href"],NT={class:"sdm-footer"},DT={class:"sdm-footer-actions"},LT=["disabled"],jT=["disabled"],UT=["disabled"],FT=Ht({__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=fe(()=>s.value??n.skill.enabled??!0),l=fe(()=>n.isInstalling===!0||n.isUninstalling===!0),u=fe(()=>{const P=o.value;if(!P)return"";const F=P.replace(/^---[\s\S]*?---\s*/,"");return c(F)});function c(P){return P.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 f(){if(!(!n.skill.owner||!n.skill.name)){i.value=!0,o.value="";try{const P=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),F=await fetch(`/codex-api/skills-hub/readme?${P}`);if(!F.ok)return;const R=await F.json();o.value=R.content??""}catch{}finally{i.value=!1}}}ut(()=>n.visible,P=>{P&&(s.value=null,o.value="",f())});function m(){r("install",n.skill)}function T(){r("uninstall",n.skill)}function U(){const P=!a.value;s.value=P,r("toggle-enabled",n.skill,P)}return(P,F)=>(w(),ft(Ko,{to:"body"},[e.visible?(w(),k("div",{key:0,class:"sdm-overlay",onClick:F[1]||(F[1]=ct(R=>P.$emit("close"),["self"]))},[p("div",_T,[p("div",kT,[p("div",TT,[e.skill.avatarUrl?(w(),k("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,ST)):ae("",!0),p("div",IT,[p("div",ET,[p("h3",CT,ie(e.skill.displayName||e.skill.name),1),e.skill.installed&&!a.value?(w(),k("span",AT,"Disabled")):ae("",!0)]),p("span",RT,ie(e.skill.owner),1)])]),p("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:F[0]||(F[0]=R=>P.$emit("close"))},[Re(Sl,{class:"sdm-close-icon"})])]),p("div",PT,[e.skill.description?(w(),k("p",xT,ie(e.skill.description),1)):ae("",!0),i.value?(w(),k("div",MT,"Loading skill contents...")):o.value?(w(),k("div",{key:2,class:"sdm-readme",innerHTML:u.value},null,8,$T)):ae("",!0),p("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,OT)]),p("div",NT,[p("div",DT,[e.skill.installed?(w(),k("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:l.value,onClick:T},ie(n.isUninstalling?"Uninstalling...":"Uninstall"),9,LT)):(w(),k("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:l.value,onClick:m},ie(n.isInstalling?"Installing...":"Install"),9,jT)),e.skill.installed?(w(),k("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:l.value,onClick:U},ie(a.value?"Disable":"Enable"),9,UT)):ae("",!0)])])])])):ae("",!0)]))}}),BT=st(FT,[["__scopeId","data-v-19a385ca"]]),HT=()=>{};var fu={};/**
|
|
42
|
+
* @license
|
|
43
|
+
* Copyright 2017 Google LLC
|
|
44
|
+
*
|
|
45
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
46
|
+
* you may not use this file except in compliance with the License.
|
|
47
|
+
* You may obtain a copy of the License at
|
|
48
|
+
*
|
|
49
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
50
|
+
*
|
|
51
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
52
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
53
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
54
|
+
* See the License for the specific language governing permissions and
|
|
55
|
+
* limitations under the License.
|
|
56
|
+
*/const Mf=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},WT=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("")},$f={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,u=l?e[s+2]:0,c=o>>2,f=(o&3)<<4|a>>4;let m=(a&15)<<2|u>>6,T=u&63;l||(T=64,i||(m=64)),r.push(n[c],n[f],n[m],n[T])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Mf(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):WT(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 u=s<e.length?n[e.charAt(s)]:64;++s;const f=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||u==null||f==null)throw new VT;const m=o<<2|a>>4;if(r.push(m),u!==64){const T=a<<4&240|u>>2;if(r.push(T),f!==64){const U=u<<6&192|f;r.push(U)}}}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 VT extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const GT=function(e){const t=Mf(e);return $f.encodeByteArray(t,!0)},Of=function(e){return GT(e).replace(/\./g,"")},Nf=function(e){try{return $f.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
|
|
57
|
+
* @license
|
|
58
|
+
* Copyright 2022 Google LLC
|
|
59
|
+
*
|
|
60
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
61
|
+
* you may not use this file except in compliance with the License.
|
|
62
|
+
* You may obtain a copy of the License at
|
|
63
|
+
*
|
|
64
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
65
|
+
*
|
|
66
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
67
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
68
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
69
|
+
* See the License for the specific language governing permissions and
|
|
70
|
+
* limitations under the License.
|
|
71
|
+
*/function zT(){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.")}/**
|
|
72
|
+
* @license
|
|
73
|
+
* Copyright 2022 Google LLC
|
|
74
|
+
*
|
|
75
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
76
|
+
* you may not use this file except in compliance with the License.
|
|
77
|
+
* You may obtain a copy of the License at
|
|
78
|
+
*
|
|
79
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
80
|
+
*
|
|
81
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
82
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
83
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
84
|
+
* See the License for the specific language governing permissions and
|
|
85
|
+
* limitations under the License.
|
|
86
|
+
*/const qT=()=>zT().__FIREBASE_DEFAULTS__,KT=()=>{if(typeof process>"u"||typeof fu>"u")return;const e=fu.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},JT=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Nf(e[1]);return t&&JSON.parse(t)},El=()=>{try{return HT()||qT()||KT()||JT()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},YT=e=>{var t,n;return(n=(t=El())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},Df=()=>{var e;return(e=El())==null?void 0:e.config},Lf=e=>{var t;return(t=El())==null?void 0:t[`_${e}`]};/**
|
|
87
|
+
* @license
|
|
88
|
+
* Copyright 2017 Google LLC
|
|
89
|
+
*
|
|
90
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
91
|
+
* you may not use this file except in compliance with the License.
|
|
92
|
+
* You may obtain a copy of the License at
|
|
93
|
+
*
|
|
94
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
95
|
+
*
|
|
96
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
97
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
98
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
99
|
+
* See the License for the specific language governing permissions and
|
|
100
|
+
* limitations under the License.
|
|
101
|
+
*/class XT{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))}}}/**
|
|
102
|
+
* @license
|
|
103
|
+
* Copyright 2017 Google LLC
|
|
104
|
+
*
|
|
105
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
|
+
* you may not use this file except in compliance with the License.
|
|
107
|
+
* You may obtain a copy of the License at
|
|
108
|
+
*
|
|
109
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
+
*
|
|
111
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
112
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
113
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
114
|
+
* See the License for the specific language governing permissions and
|
|
115
|
+
* limitations under the License.
|
|
116
|
+
*/function hn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function QT(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(hn())}function ZT(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function eS(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function tS(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function nS(){const e=hn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function rS(){try{return typeof indexedDB=="object"}catch{return!1}}function sS(){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)}})}/**
|
|
117
|
+
* @license
|
|
118
|
+
* Copyright 2017 Google LLC
|
|
119
|
+
*
|
|
120
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
121
|
+
* you may not use this file except in compliance with the License.
|
|
122
|
+
* You may obtain a copy of the License at
|
|
123
|
+
*
|
|
124
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
125
|
+
*
|
|
126
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
127
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
128
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
129
|
+
* See the License for the specific language governing permissions and
|
|
130
|
+
* limitations under the License.
|
|
131
|
+
*/const oS="FirebaseError";class Or extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=oS,Object.setPrototypeOf(this,Or.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,po.prototype.create)}}class po{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?iS(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new Or(s,a,r)}}function iS(e,t){return e.replace(aS,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const aS=/\{\$([^}]+)}/g;function lS(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function _s(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(hu(o)&&hu(i)){if(!_s(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function hu(e){return e!==null&&typeof e=="object"}/**
|
|
132
|
+
* @license
|
|
133
|
+
* Copyright 2017 Google LLC
|
|
134
|
+
*
|
|
135
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
136
|
+
* you may not use this file except in compliance with the License.
|
|
137
|
+
* You may obtain a copy of the License at
|
|
138
|
+
*
|
|
139
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
140
|
+
*
|
|
141
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
142
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
143
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
144
|
+
* See the License for the specific language governing permissions and
|
|
145
|
+
* limitations under the License.
|
|
146
|
+
*/function mo(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 cS(e,t){const n=new uS(e,t);return n.subscribe.bind(n)}class uS{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.");dS(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=ca),s.error===void 0&&(s.error=ca),s.complete===void 0&&(s.complete=ca);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 dS(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 ca(){}/**
|
|
147
|
+
* @license
|
|
148
|
+
* Copyright 2021 Google LLC
|
|
149
|
+
*
|
|
150
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
151
|
+
* you may not use this file except in compliance with the License.
|
|
152
|
+
* You may obtain a copy of the License at
|
|
153
|
+
*
|
|
154
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
155
|
+
*
|
|
156
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
157
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
158
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
159
|
+
* See the License for the specific language governing permissions and
|
|
160
|
+
* limitations under the License.
|
|
161
|
+
*/function Is(e){return e&&e._delegate?e._delegate:e}/**
|
|
162
|
+
* @license
|
|
163
|
+
* Copyright 2025 Google LLC
|
|
164
|
+
*
|
|
165
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
166
|
+
* you may not use this file except in compliance with the License.
|
|
167
|
+
* You may obtain a copy of the License at
|
|
168
|
+
*
|
|
169
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
170
|
+
*
|
|
171
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
172
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
173
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
174
|
+
* See the License for the specific language governing permissions and
|
|
175
|
+
* limitations under the License.
|
|
176
|
+
*/function Cl(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function fS(e){return(await fetch(e,{credentials:"include"})).ok}class ks{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}}/**
|
|
177
|
+
* @license
|
|
178
|
+
* Copyright 2019 Google LLC
|
|
179
|
+
*
|
|
180
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
* you may not use this file except in compliance with the License.
|
|
182
|
+
* You may obtain a copy of the License at
|
|
183
|
+
*
|
|
184
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
*
|
|
186
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
* See the License for the specific language governing permissions and
|
|
190
|
+
* limitations under the License.
|
|
191
|
+
*/const Br="[DEFAULT]";/**
|
|
192
|
+
* @license
|
|
193
|
+
* Copyright 2019 Google LLC
|
|
194
|
+
*
|
|
195
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
196
|
+
* you may not use this file except in compliance with the License.
|
|
197
|
+
* You may obtain a copy of the License at
|
|
198
|
+
*
|
|
199
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
200
|
+
*
|
|
201
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
202
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
203
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
204
|
+
* See the License for the specific language governing permissions and
|
|
205
|
+
* limitations under the License.
|
|
206
|
+
*/class hS{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 XT;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(mS(t))try{this.getOrInitializeService({instanceIdentifier:Br})}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=Br){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=Br){return this.instances.has(t)}getOptions(t=Br){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:pS(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=Br){return this.component?this.component.multipleInstances?t:Br:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function pS(e){return e===Br?void 0:e}function mS(e){return e.instantiationMode==="EAGER"}/**
|
|
207
|
+
* @license
|
|
208
|
+
* Copyright 2019 Google LLC
|
|
209
|
+
*
|
|
210
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
211
|
+
* you may not use this file except in compliance with the License.
|
|
212
|
+
* You may obtain a copy of the License at
|
|
213
|
+
*
|
|
214
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
215
|
+
*
|
|
216
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
217
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
218
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
219
|
+
* See the License for the specific language governing permissions and
|
|
220
|
+
* limitations under the License.
|
|
221
|
+
*/class gS{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 hS(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
|
|
222
|
+
* @license
|
|
223
|
+
* Copyright 2017 Google LLC
|
|
224
|
+
*
|
|
225
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
226
|
+
* you may not use this file except in compliance with the License.
|
|
227
|
+
* You may obtain a copy of the License at
|
|
228
|
+
*
|
|
229
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
230
|
+
*
|
|
231
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
232
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
233
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
234
|
+
* See the License for the specific language governing permissions and
|
|
235
|
+
* limitations under the License.
|
|
236
|
+
*/var Et;(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"})(Et||(Et={}));const vS={debug:Et.DEBUG,verbose:Et.VERBOSE,info:Et.INFO,warn:Et.WARN,error:Et.ERROR,silent:Et.SILENT},yS=Et.INFO,wS={[Et.DEBUG]:"log",[Et.VERBOSE]:"log",[Et.INFO]:"info",[Et.WARN]:"warn",[Et.ERROR]:"error"},bS=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=wS[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 jf{constructor(t){this.name=t,this._logLevel=yS,this._logHandler=bS,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Et))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?vS[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,Et.DEBUG,...t),this._logHandler(this,Et.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Et.VERBOSE,...t),this._logHandler(this,Et.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Et.INFO,...t),this._logHandler(this,Et.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Et.WARN,...t),this._logHandler(this,Et.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Et.ERROR,...t),this._logHandler(this,Et.ERROR,...t)}}const _S=(e,t)=>t.some(n=>e instanceof n);let pu,mu;function kS(){return pu||(pu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function TS(){return mu||(mu=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Uf=new WeakMap,Ha=new WeakMap,Ff=new WeakMap,ua=new WeakMap,Al=new WeakMap;function SS(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(Pr(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&Uf.set(n,e)}).catch(()=>{}),Al.set(t,e),t}function IS(e){if(Ha.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)});Ha.set(e,t)}let Wa={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return Ha.get(e);if(t==="objectStoreNames")return e.objectStoreNames||Ff.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Pr(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 ES(e){Wa=e(Wa)}function CS(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(da(this),t,...n);return Ff.set(r,t.sort?t.sort():[t]),Pr(r)}:TS().includes(e)?function(...t){return e.apply(da(this),t),Pr(Uf.get(this))}:function(...t){return Pr(e.apply(da(this),t))}}function AS(e){return typeof e=="function"?CS(e):(e instanceof IDBTransaction&&IS(e),_S(e,kS())?new Proxy(e,Wa):e)}function Pr(e){if(e instanceof IDBRequest)return SS(e);if(ua.has(e))return ua.get(e);const t=AS(e);return t!==e&&(ua.set(e,t),Al.set(t,e)),t}const da=e=>Al.get(e);function RS(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=Pr(i);return r&&i.addEventListener("upgradeneeded",l=>{r(Pr(i.result),l.oldVersion,l.newVersion,Pr(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",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const PS=["get","getKey","getAll","getAllKeys","count"],xS=["put","add","delete","clear"],fa=new Map;function gu(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(fa.get(t))return fa.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=xS.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||PS.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let u=l.store;return r&&(u=u.index(a.shift())),(await Promise.all([u[n](...a),s&&l.done]))[0]};return fa.set(t,o),o}ES(e=>({...e,get:(t,n,r)=>gu(t,n)||e.get(t,n,r),has:(t,n)=>!!gu(t,n)||e.has(t,n)}));/**
|
|
237
|
+
* @license
|
|
238
|
+
* Copyright 2019 Google LLC
|
|
239
|
+
*
|
|
240
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
241
|
+
* you may not use this file except in compliance with the License.
|
|
242
|
+
* You may obtain a copy of the License at
|
|
243
|
+
*
|
|
244
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
245
|
+
*
|
|
246
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
247
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
248
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
249
|
+
* See the License for the specific language governing permissions and
|
|
250
|
+
* limitations under the License.
|
|
251
|
+
*/class MS{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if($S(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function $S(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const Va="@firebase/app",vu="0.14.10";/**
|
|
252
|
+
* @license
|
|
253
|
+
* Copyright 2019 Google LLC
|
|
254
|
+
*
|
|
255
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
256
|
+
* you may not use this file except in compliance with the License.
|
|
257
|
+
* You may obtain a copy of the License at
|
|
258
|
+
*
|
|
259
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
260
|
+
*
|
|
261
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
262
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
263
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
264
|
+
* See the License for the specific language governing permissions and
|
|
265
|
+
* limitations under the License.
|
|
266
|
+
*/const dr=new jf("@firebase/app"),OS="@firebase/app-compat",NS="@firebase/analytics-compat",DS="@firebase/analytics",LS="@firebase/app-check-compat",jS="@firebase/app-check",US="@firebase/auth",FS="@firebase/auth-compat",BS="@firebase/database",HS="@firebase/data-connect",WS="@firebase/database-compat",VS="@firebase/functions",GS="@firebase/functions-compat",zS="@firebase/installations",qS="@firebase/installations-compat",KS="@firebase/messaging",JS="@firebase/messaging-compat",YS="@firebase/performance",XS="@firebase/performance-compat",QS="@firebase/remote-config",ZS="@firebase/remote-config-compat",eI="@firebase/storage",tI="@firebase/storage-compat",nI="@firebase/firestore",rI="@firebase/ai",sI="@firebase/firestore-compat",oI="firebase",iI="12.11.0";/**
|
|
267
|
+
* @license
|
|
268
|
+
* Copyright 2019 Google LLC
|
|
269
|
+
*
|
|
270
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
271
|
+
* you may not use this file except in compliance with the License.
|
|
272
|
+
* You may obtain a copy of the License at
|
|
273
|
+
*
|
|
274
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
275
|
+
*
|
|
276
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
277
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
278
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
279
|
+
* See the License for the specific language governing permissions and
|
|
280
|
+
* limitations under the License.
|
|
281
|
+
*/const Ga="[DEFAULT]",aI={[Va]:"fire-core",[OS]:"fire-core-compat",[DS]:"fire-analytics",[NS]:"fire-analytics-compat",[jS]:"fire-app-check",[LS]:"fire-app-check-compat",[US]:"fire-auth",[FS]:"fire-auth-compat",[BS]:"fire-rtdb",[HS]:"fire-data-connect",[WS]:"fire-rtdb-compat",[VS]:"fire-fn",[GS]:"fire-fn-compat",[zS]:"fire-iid",[qS]:"fire-iid-compat",[KS]:"fire-fcm",[JS]:"fire-fcm-compat",[YS]:"fire-perf",[XS]:"fire-perf-compat",[QS]:"fire-rc",[ZS]:"fire-rc-compat",[eI]:"fire-gcs",[tI]:"fire-gcs-compat",[nI]:"fire-fst",[sI]:"fire-fst-compat",[rI]:"fire-vertex","fire-js":"fire-js",[oI]:"fire-js-all"};/**
|
|
282
|
+
* @license
|
|
283
|
+
* Copyright 2019 Google LLC
|
|
284
|
+
*
|
|
285
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
286
|
+
* you may not use this file except in compliance with the License.
|
|
287
|
+
* You may obtain a copy of the License at
|
|
288
|
+
*
|
|
289
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
290
|
+
*
|
|
291
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
292
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
293
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
294
|
+
* See the License for the specific language governing permissions and
|
|
295
|
+
* limitations under the License.
|
|
296
|
+
*/const io=new Map,lI=new Map,za=new Map;function yu(e,t){try{e.container.addComponent(t)}catch(n){dr.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function ao(e){const t=e.name;if(za.has(t))return dr.debug(`There were multiple attempts to register component ${t}.`),!1;za.set(t,e);for(const n of io.values())yu(n,e);for(const n of lI.values())yu(n,e);return!0}function Bf(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function Wn(e){return e==null?!1:e.settings!==void 0}/**
|
|
297
|
+
* @license
|
|
298
|
+
* Copyright 2019 Google LLC
|
|
299
|
+
*
|
|
300
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
301
|
+
* you may not use this file except in compliance with the License.
|
|
302
|
+
* You may obtain a copy of the License at
|
|
303
|
+
*
|
|
304
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
305
|
+
*
|
|
306
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
307
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
308
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
309
|
+
* See the License for the specific language governing permissions and
|
|
310
|
+
* limitations under the License.
|
|
311
|
+
*/const cI={"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."},xr=new po("app","Firebase",cI);/**
|
|
312
|
+
* @license
|
|
313
|
+
* Copyright 2019 Google LLC
|
|
314
|
+
*
|
|
315
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
316
|
+
* you may not use this file except in compliance with the License.
|
|
317
|
+
* You may obtain a copy of the License at
|
|
318
|
+
*
|
|
319
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
320
|
+
*
|
|
321
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
322
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
323
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
324
|
+
* See the License for the specific language governing permissions and
|
|
325
|
+
* limitations under the License.
|
|
326
|
+
*/class uI{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 ks("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 xr.create("app-deleted",{appName:this._name})}}/**
|
|
327
|
+
* @license
|
|
328
|
+
* Copyright 2019 Google LLC
|
|
329
|
+
*
|
|
330
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
331
|
+
* you may not use this file except in compliance with the License.
|
|
332
|
+
* You may obtain a copy of the License at
|
|
333
|
+
*
|
|
334
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
335
|
+
*
|
|
336
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
337
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
338
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
339
|
+
* See the License for the specific language governing permissions and
|
|
340
|
+
* limitations under the License.
|
|
341
|
+
*/const go=iI;function Hf(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:Ga,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw xr.create("bad-app-name",{appName:String(s)});if(n||(n=Df()),!n)throw xr.create("no-options");const o=io.get(s);if(o){if(_s(n,o.options)&&_s(r,o.config))return o;throw xr.create("duplicate-app",{appName:s})}const i=new gS(s);for(const l of za.values())i.addComponent(l);const a=new uI(n,r,i);return io.set(s,a),a}function Wf(e=Ga){const t=io.get(e);if(!t&&e===Ga&&Df())return Hf();if(!t)throw xr.create("no-app",{appName:e});return t}function dI(){return Array.from(io.values())}function ps(e,t,n){let r=aI[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 "/")`),dr.warn(i.join(" "));return}ao(new ks(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
|
|
342
|
+
* @license
|
|
343
|
+
* Copyright 2021 Google LLC
|
|
344
|
+
*
|
|
345
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
346
|
+
* you may not use this file except in compliance with the License.
|
|
347
|
+
* You may obtain a copy of the License at
|
|
348
|
+
*
|
|
349
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
350
|
+
*
|
|
351
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
352
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
353
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
354
|
+
* See the License for the specific language governing permissions and
|
|
355
|
+
* limitations under the License.
|
|
356
|
+
*/const fI="firebase-heartbeat-database",hI=1,lo="firebase-heartbeat-store";let ha=null;function Vf(){return ha||(ha=RS(fI,hI,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(lo)}catch(n){console.warn(n)}}}}).catch(e=>{throw xr.create("idb-open",{originalErrorMessage:e.message})})),ha}async function pI(e){try{const n=(await Vf()).transaction(lo),r=await n.objectStore(lo).get(Gf(e));return await n.done,r}catch(t){if(t instanceof Or)dr.warn(t.message);else{const n=xr.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});dr.warn(n.message)}}}async function wu(e,t){try{const r=(await Vf()).transaction(lo,"readwrite");await r.objectStore(lo).put(t,Gf(e)),await r.done}catch(n){if(n instanceof Or)dr.warn(n.message);else{const r=xr.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});dr.warn(r.message)}}}function Gf(e){return`${e.name}!${e.options.appId}`}/**
|
|
357
|
+
* @license
|
|
358
|
+
* Copyright 2021 Google LLC
|
|
359
|
+
*
|
|
360
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
361
|
+
* you may not use this file except in compliance with the License.
|
|
362
|
+
* You may obtain a copy of the License at
|
|
363
|
+
*
|
|
364
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
365
|
+
*
|
|
366
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
367
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
368
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
369
|
+
* See the License for the specific language governing permissions and
|
|
370
|
+
* limitations under the License.
|
|
371
|
+
*/const mI=1024,gI=30;class vI{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new wI(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=bu();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>gI){const i=bI(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){dr.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=bu(),{heartbeatsToSend:r,unsentEntries:s}=yI(this._heartbeatsCache.heartbeats),o=Of(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 dr.warn(n),""}}}function bu(){return new Date().toISOString().substring(0,10)}function yI(e,t=mI){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),_u(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),_u(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class wI{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return rS()?sS().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await pI(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 wu(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 wu(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function _u(e){return Of(JSON.stringify({version:2,heartbeats:e})).length}function bI(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}/**
|
|
372
|
+
* @license
|
|
373
|
+
* Copyright 2019 Google LLC
|
|
374
|
+
*
|
|
375
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
376
|
+
* you may not use this file except in compliance with the License.
|
|
377
|
+
* You may obtain a copy of the License at
|
|
378
|
+
*
|
|
379
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
380
|
+
*
|
|
381
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
382
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
383
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
384
|
+
* See the License for the specific language governing permissions and
|
|
385
|
+
* limitations under the License.
|
|
386
|
+
*/function _I(e){ao(new ks("platform-logger",t=>new MS(t),"PRIVATE")),ao(new ks("heartbeat",t=>new vI(t),"PRIVATE")),ps(Va,vu,e),ps(Va,vu,"esm2020"),ps("fire-js","")}_I("");var kI="firebase",TI="12.11.0";/**
|
|
387
|
+
* @license
|
|
388
|
+
* Copyright 2020 Google LLC
|
|
389
|
+
*
|
|
390
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
391
|
+
* you may not use this file except in compliance with the License.
|
|
392
|
+
* You may obtain a copy of the License at
|
|
393
|
+
*
|
|
394
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
395
|
+
*
|
|
396
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
397
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
398
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
399
|
+
* See the License for the specific language governing permissions and
|
|
400
|
+
* limitations under the License.
|
|
401
|
+
*/ps(kI,TI,"app");function zf(){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 SI=zf,qf=new po("auth","Firebase",zf());/**
|
|
402
|
+
* @license
|
|
403
|
+
* Copyright 2020 Google LLC
|
|
404
|
+
*
|
|
405
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
406
|
+
* you may not use this file except in compliance with the License.
|
|
407
|
+
* You may obtain a copy of the License at
|
|
408
|
+
*
|
|
409
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
410
|
+
*
|
|
411
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
412
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
413
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
414
|
+
* See the License for the specific language governing permissions and
|
|
415
|
+
* limitations under the License.
|
|
416
|
+
*/const ti=new jf("@firebase/auth");function II(e,...t){ti.logLevel<=Et.WARN&&ti.warn(`Auth (${go}): ${e}`,...t)}function Bo(e,...t){ti.logLevel<=Et.ERROR&&ti.error(`Auth (${go}): ${e}`,...t)}/**
|
|
417
|
+
* @license
|
|
418
|
+
* Copyright 2020 Google LLC
|
|
419
|
+
*
|
|
420
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
421
|
+
* you may not use this file except in compliance with the License.
|
|
422
|
+
* You may obtain a copy of the License at
|
|
423
|
+
*
|
|
424
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
425
|
+
*
|
|
426
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
427
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
428
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
429
|
+
* See the License for the specific language governing permissions and
|
|
430
|
+
* limitations under the License.
|
|
431
|
+
*/function Kn(e,...t){throw Pl(e,...t)}function Pn(e,...t){return Pl(e,...t)}function Rl(e,t,n){const r={...SI(),[t]:n};return new po("auth","Firebase",r).create(t,{appName:e.name})}function Kr(e){return Rl(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function EI(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&Kn(e,"argument-error"),Rl(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Pl(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 qf.create(e,...t)}function ze(e,t,...n){if(!e)throw Pl(t,...n)}function rr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Bo(t),new Error(t)}function fr(e,t){e||rr(t)}/**
|
|
432
|
+
* @license
|
|
433
|
+
* Copyright 2020 Google LLC
|
|
434
|
+
*
|
|
435
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
436
|
+
* you may not use this file except in compliance with the License.
|
|
437
|
+
* You may obtain a copy of the License at
|
|
438
|
+
*
|
|
439
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
440
|
+
*
|
|
441
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
442
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
443
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
444
|
+
* See the License for the specific language governing permissions and
|
|
445
|
+
* limitations under the License.
|
|
446
|
+
*/function qa(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function CI(){return ku()==="http:"||ku()==="https:"}function ku(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
|
|
447
|
+
* @license
|
|
448
|
+
* Copyright 2020 Google LLC
|
|
449
|
+
*
|
|
450
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
451
|
+
* you may not use this file except in compliance with the License.
|
|
452
|
+
* You may obtain a copy of the License at
|
|
453
|
+
*
|
|
454
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
455
|
+
*
|
|
456
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
457
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
458
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
459
|
+
* See the License for the specific language governing permissions and
|
|
460
|
+
* limitations under the License.
|
|
461
|
+
*/function AI(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(CI()||eS()||"connection"in navigator)?navigator.onLine:!0}function RI(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
|
|
462
|
+
* @license
|
|
463
|
+
* Copyright 2020 Google LLC
|
|
464
|
+
*
|
|
465
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
466
|
+
* you may not use this file except in compliance with the License.
|
|
467
|
+
* You may obtain a copy of the License at
|
|
468
|
+
*
|
|
469
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
470
|
+
*
|
|
471
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
472
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
473
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
474
|
+
* See the License for the specific language governing permissions and
|
|
475
|
+
* limitations under the License.
|
|
476
|
+
*/class vo{constructor(t,n){this.shortDelay=t,this.longDelay=n,fr(n>t,"Short delay should be less than long delay!"),this.isMobile=QT()||tS()}get(){return AI()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
477
|
+
* @license
|
|
478
|
+
* Copyright 2020 Google LLC
|
|
479
|
+
*
|
|
480
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
481
|
+
* you may not use this file except in compliance with the License.
|
|
482
|
+
* You may obtain a copy of the License at
|
|
483
|
+
*
|
|
484
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
485
|
+
*
|
|
486
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
487
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
488
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
489
|
+
* See the License for the specific language governing permissions and
|
|
490
|
+
* limitations under the License.
|
|
491
|
+
*/function xl(e,t){fr(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
|
|
492
|
+
* @license
|
|
493
|
+
* Copyright 2020 Google LLC
|
|
494
|
+
*
|
|
495
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
496
|
+
* you may not use this file except in compliance with the License.
|
|
497
|
+
* You may obtain a copy of the License at
|
|
498
|
+
*
|
|
499
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
500
|
+
*
|
|
501
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
502
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
503
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
504
|
+
* See the License for the specific language governing permissions and
|
|
505
|
+
* limitations under the License.
|
|
506
|
+
*/class Kf{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;rr("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;rr("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;rr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
507
|
+
* @license
|
|
508
|
+
* Copyright 2020 Google LLC
|
|
509
|
+
*
|
|
510
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
511
|
+
* you may not use this file except in compliance with the License.
|
|
512
|
+
* You may obtain a copy of the License at
|
|
513
|
+
*
|
|
514
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
515
|
+
*
|
|
516
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
517
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
518
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
519
|
+
* See the License for the specific language governing permissions and
|
|
520
|
+
* limitations under the License.
|
|
521
|
+
*/const PI={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"};/**
|
|
522
|
+
* @license
|
|
523
|
+
* Copyright 2020 Google LLC
|
|
524
|
+
*
|
|
525
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
526
|
+
* you may not use this file except in compliance with the License.
|
|
527
|
+
* You may obtain a copy of the License at
|
|
528
|
+
*
|
|
529
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
530
|
+
*
|
|
531
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
532
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
533
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
534
|
+
* See the License for the specific language governing permissions and
|
|
535
|
+
* limitations under the License.
|
|
536
|
+
*/const xI=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],MI=new vo(3e4,6e4);function Ml(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function Es(e,t,n,r,s={}){return Jf(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=mo({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 u={method:t,headers:l,...o};return ZT()||(u.referrerPolicy="no-referrer"),e.emulatorConfig&&Cl(e.emulatorConfig.host)&&(u.credentials="include"),Kf.fetch()(await Yf(e,e.config.apiHost,n,a),u)})}async function Jf(e,t,n){e._canInitEmulator=!1;const r={...PI,...t};try{const s=new OI(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw Po(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,u]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw Po(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw Po(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw Po(e,"user-disabled",i);const c=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw Rl(e,c,u);Kn(e,c)}}catch(s){if(s instanceof Or)throw s;Kn(e,"network-request-failed",{message:String(s)})}}async function $I(e,t,n,r,s={}){const o=await Es(e,t,n,r,s);return"mfaPendingCredential"in o&&Kn(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function Yf(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?xl(e.config,s):`${e.config.apiScheme}://${s}`;return xI.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class OI{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Pn(this.auth,"network-request-failed")),MI.get())})}}function Po(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Pn(e,t,r);return s.customData._tokenResponse=n,s}/**
|
|
537
|
+
* @license
|
|
538
|
+
* Copyright 2020 Google LLC
|
|
539
|
+
*
|
|
540
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
541
|
+
* you may not use this file except in compliance with the License.
|
|
542
|
+
* You may obtain a copy of the License at
|
|
543
|
+
*
|
|
544
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
545
|
+
*
|
|
546
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
547
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
548
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
549
|
+
* See the License for the specific language governing permissions and
|
|
550
|
+
* limitations under the License.
|
|
551
|
+
*/async function NI(e,t){return Es(e,"POST","/v1/accounts:delete",t)}async function ni(e,t){return Es(e,"POST","/v1/accounts:lookup",t)}/**
|
|
552
|
+
* @license
|
|
553
|
+
* Copyright 2020 Google LLC
|
|
554
|
+
*
|
|
555
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
556
|
+
* you may not use this file except in compliance with the License.
|
|
557
|
+
* You may obtain a copy of the License at
|
|
558
|
+
*
|
|
559
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
560
|
+
*
|
|
561
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
562
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
563
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
564
|
+
* See the License for the specific language governing permissions and
|
|
565
|
+
* limitations under the License.
|
|
566
|
+
*/function Js(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function DI(e,t=!1){const n=Is(e),r=await n.getIdToken(t),s=$l(r);ze(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:Js(pa(s.auth_time)),issuedAtTime:Js(pa(s.iat)),expirationTime:Js(pa(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function pa(e){return Number(e)*1e3}function $l(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return Bo("JWT malformed, contained fewer than 3 sections"),null;try{const s=Nf(n);return s?JSON.parse(s):(Bo("Failed to decode base64 JWT payload"),null)}catch(s){return Bo("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Tu(e){const t=$l(e);return ze(t,"internal-error"),ze(typeof t.exp<"u","internal-error"),ze(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
|
|
567
|
+
* @license
|
|
568
|
+
* Copyright 2020 Google LLC
|
|
569
|
+
*
|
|
570
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
571
|
+
* you may not use this file except in compliance with the License.
|
|
572
|
+
* You may obtain a copy of the License at
|
|
573
|
+
*
|
|
574
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
575
|
+
*
|
|
576
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
577
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
578
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
579
|
+
* See the License for the specific language governing permissions and
|
|
580
|
+
* limitations under the License.
|
|
581
|
+
*/async function co(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof Or&&LI(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function LI({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
|
|
582
|
+
* @license
|
|
583
|
+
* Copyright 2020 Google LLC
|
|
584
|
+
*
|
|
585
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
586
|
+
* you may not use this file except in compliance with the License.
|
|
587
|
+
* You may obtain a copy of the License at
|
|
588
|
+
*
|
|
589
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
590
|
+
*
|
|
591
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
592
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
593
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
594
|
+
* See the License for the specific language governing permissions and
|
|
595
|
+
* limitations under the License.
|
|
596
|
+
*/class jI{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()}}/**
|
|
597
|
+
* @license
|
|
598
|
+
* Copyright 2020 Google LLC
|
|
599
|
+
*
|
|
600
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
601
|
+
* you may not use this file except in compliance with the License.
|
|
602
|
+
* You may obtain a copy of the License at
|
|
603
|
+
*
|
|
604
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
605
|
+
*
|
|
606
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
607
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
608
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
609
|
+
* See the License for the specific language governing permissions and
|
|
610
|
+
* limitations under the License.
|
|
611
|
+
*/class Ka{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Js(this.lastLoginAt),this.creationTime=Js(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
612
|
+
* @license
|
|
613
|
+
* Copyright 2019 Google LLC
|
|
614
|
+
*
|
|
615
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
616
|
+
* you may not use this file except in compliance with the License.
|
|
617
|
+
* You may obtain a copy of the License at
|
|
618
|
+
*
|
|
619
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
620
|
+
*
|
|
621
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
622
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
623
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
624
|
+
* See the License for the specific language governing permissions and
|
|
625
|
+
* limitations under the License.
|
|
626
|
+
*/async function ri(e){var f;const t=e.auth,n=await e.getIdToken(),r=await co(e,ni(t,{idToken:n}));ze(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(f=s.providerUserInfo)!=null&&f.length?Xf(s.providerUserInfo):[],i=FI(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),u=a?l:!1,c={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 Ka(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(e,c)}async function UI(e){const t=Is(e);await ri(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function FI(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function Xf(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}))}/**
|
|
627
|
+
* @license
|
|
628
|
+
* Copyright 2020 Google LLC
|
|
629
|
+
*
|
|
630
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
631
|
+
* you may not use this file except in compliance with the License.
|
|
632
|
+
* You may obtain a copy of the License at
|
|
633
|
+
*
|
|
634
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
635
|
+
*
|
|
636
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
637
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
638
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
639
|
+
* See the License for the specific language governing permissions and
|
|
640
|
+
* limitations under the License.
|
|
641
|
+
*/async function BI(e,t){const n=await Jf(e,{},async()=>{const r=mo({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await Yf(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&&Cl(e.emulatorConfig.host)&&(l.credentials="include"),Kf.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function HI(e,t){return Es(e,"POST","/v2/accounts:revokeToken",Ml(e,t))}/**
|
|
642
|
+
* @license
|
|
643
|
+
* Copyright 2020 Google LLC
|
|
644
|
+
*
|
|
645
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
646
|
+
* you may not use this file except in compliance with the License.
|
|
647
|
+
* You may obtain a copy of the License at
|
|
648
|
+
*
|
|
649
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
650
|
+
*
|
|
651
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
652
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
653
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
654
|
+
* See the License for the specific language governing permissions and
|
|
655
|
+
* limitations under the License.
|
|
656
|
+
*/class ms{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){ze(t.idToken,"internal-error"),ze(typeof t.idToken<"u","internal-error"),ze(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):Tu(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){ze(t.length!==0,"internal-error");const n=Tu(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(ze(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 BI(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 ms;return r&&(ze(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(ze(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(ze(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 ms,this.toJSON())}_performRefresh(){return rr("not implemented")}}/**
|
|
657
|
+
* @license
|
|
658
|
+
* Copyright 2020 Google LLC
|
|
659
|
+
*
|
|
660
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
661
|
+
* you may not use this file except in compliance with the License.
|
|
662
|
+
* You may obtain a copy of the License at
|
|
663
|
+
*
|
|
664
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
665
|
+
*
|
|
666
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
667
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
668
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
669
|
+
* See the License for the specific language governing permissions and
|
|
670
|
+
* limitations under the License.
|
|
671
|
+
*/function kr(e,t){ze(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class Cn{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new jI(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 Ka(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await co(this,this.stsTokenManager.getToken(this.auth,t));return ze(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return DI(this,t)}reload(){return UI(this)}_assign(t){this!==t&&(ze(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 Cn({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){ze(!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(Wn(this.auth.app))return Promise.reject(Kr(this.auth));const t=await this.getIdToken();return await co(this,NI(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,u=n.createdAt??void 0,c=n.lastLoginAt??void 0,{uid:f,emailVerified:m,isAnonymous:T,providerData:U,stsTokenManager:P}=n;ze(f&&P,t,"internal-error");const F=ms.fromJSON(this.name,P);ze(typeof f=="string",t,"internal-error"),kr(r,t.name),kr(s,t.name),ze(typeof m=="boolean",t,"internal-error"),ze(typeof T=="boolean",t,"internal-error"),kr(o,t.name),kr(i,t.name),kr(a,t.name),kr(l,t.name),kr(u,t.name),kr(c,t.name);const R=new Cn({uid:f,auth:t,email:s,emailVerified:m,displayName:r,isAnonymous:T,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:F,createdAt:u,lastLoginAt:c});return U&&Array.isArray(U)&&(R.providerData=U.map(A=>({...A}))),l&&(R._redirectEventId=l),R}static async _fromIdTokenResponse(t,n,r=!1){const s=new ms;s.updateFromServerResponse(n);const o=new Cn({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];ze(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?Xf(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new ms;a.updateFromIdToken(r);const l=new Cn({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),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:o,metadata:new Ka(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,u),l}}/**
|
|
672
|
+
* @license
|
|
673
|
+
* Copyright 2020 Google LLC
|
|
674
|
+
*
|
|
675
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
676
|
+
* you may not use this file except in compliance with the License.
|
|
677
|
+
* You may obtain a copy of the License at
|
|
678
|
+
*
|
|
679
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
680
|
+
*
|
|
681
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
682
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
683
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
684
|
+
* See the License for the specific language governing permissions and
|
|
685
|
+
* limitations under the License.
|
|
686
|
+
*/const Su=new Map;function sr(e){fr(e instanceof Function,"Expected a class definition");let t=Su.get(e);return t?(fr(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Su.set(e,t),t)}/**
|
|
687
|
+
* @license
|
|
688
|
+
* Copyright 2019 Google LLC
|
|
689
|
+
*
|
|
690
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
691
|
+
* you may not use this file except in compliance with the License.
|
|
692
|
+
* You may obtain a copy of the License at
|
|
693
|
+
*
|
|
694
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
695
|
+
*
|
|
696
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
697
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
698
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
699
|
+
* See the License for the specific language governing permissions and
|
|
700
|
+
* limitations under the License.
|
|
701
|
+
*/class Qf{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){}}Qf.type="NONE";const Iu=Qf;/**
|
|
702
|
+
* @license
|
|
703
|
+
* Copyright 2019 Google LLC
|
|
704
|
+
*
|
|
705
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
706
|
+
* you may not use this file except in compliance with the License.
|
|
707
|
+
* You may obtain a copy of the License at
|
|
708
|
+
*
|
|
709
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
710
|
+
*
|
|
711
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
712
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
713
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
714
|
+
* See the License for the specific language governing permissions and
|
|
715
|
+
* limitations under the License.
|
|
716
|
+
*/function Ho(e,t,n){return`firebase:${e}:${t}:${n}`}class gs{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=Ho(this.userKey,s.apiKey,o),this.fullPersistenceKey=Ho("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 ni(this.auth,{idToken:t}).catch(()=>{});return n?Cn._fromGetAccountInfoResponse(this.auth,n,t):null}return Cn._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 gs(sr(Iu),t,r);const s=(await Promise.all(n.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let o=s[0]||sr(Iu);const i=Ho(r,t.config.apiKey,t.name);let a=null;for(const u of n)try{const c=await u._get(i);if(c){let f;if(typeof c=="string"){const m=await ni(t,{idToken:c}).catch(()=>{});if(!m)break;f=await Cn._fromGetAccountInfoResponse(t,m,c)}else f=Cn._fromJSON(t,c);u!==o&&(a=f),o=u;break}}catch{}const l=s.filter(u=>u._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new gs(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async u=>{if(u!==o)try{await u._remove(i)}catch{}})),new gs(o,t,r))}}/**
|
|
717
|
+
* @license
|
|
718
|
+
* Copyright 2020 Google LLC
|
|
719
|
+
*
|
|
720
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
721
|
+
* you may not use this file except in compliance with the License.
|
|
722
|
+
* You may obtain a copy of the License at
|
|
723
|
+
*
|
|
724
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
725
|
+
*
|
|
726
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
727
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
728
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
729
|
+
* See the License for the specific language governing permissions and
|
|
730
|
+
* limitations under the License.
|
|
731
|
+
*/function Eu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(nh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Zf(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(sh(t))return"Blackberry";if(oh(t))return"Webos";if(eh(t))return"Safari";if((t.includes("chrome/")||th(t))&&!t.includes("edge/"))return"Chrome";if(rh(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 Zf(e=hn()){return/firefox\//i.test(e)}function eh(e=hn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function th(e=hn()){return/crios\//i.test(e)}function nh(e=hn()){return/iemobile/i.test(e)}function rh(e=hn()){return/android/i.test(e)}function sh(e=hn()){return/blackberry/i.test(e)}function oh(e=hn()){return/webos/i.test(e)}function Ol(e=hn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function WI(e=hn()){var t;return Ol(e)&&!!((t=window.navigator)!=null&&t.standalone)}function VI(){return nS()&&document.documentMode===10}function ih(e=hn()){return Ol(e)||rh(e)||oh(e)||sh(e)||/windows phone/i.test(e)||nh(e)}/**
|
|
732
|
+
* @license
|
|
733
|
+
* Copyright 2020 Google LLC
|
|
734
|
+
*
|
|
735
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
736
|
+
* you may not use this file except in compliance with the License.
|
|
737
|
+
* You may obtain a copy of the License at
|
|
738
|
+
*
|
|
739
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
740
|
+
*
|
|
741
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
742
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
743
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
744
|
+
* See the License for the specific language governing permissions and
|
|
745
|
+
* limitations under the License.
|
|
746
|
+
*/function ah(e,t=[]){let n;switch(e){case"Browser":n=Eu(hn());break;case"Worker":n=`${Eu(hn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${go}/${r}`}/**
|
|
747
|
+
* @license
|
|
748
|
+
* Copyright 2022 Google LLC
|
|
749
|
+
*
|
|
750
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
751
|
+
* you may not use this file except in compliance with the License.
|
|
752
|
+
* You may obtain a copy of the License at
|
|
753
|
+
*
|
|
754
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
755
|
+
*
|
|
756
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
757
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
758
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
759
|
+
* See the License for the specific language governing permissions and
|
|
760
|
+
* limitations under the License.
|
|
761
|
+
*/class GI{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})}}}/**
|
|
762
|
+
* @license
|
|
763
|
+
* Copyright 2023 Google LLC
|
|
764
|
+
*
|
|
765
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
766
|
+
* you may not use this file except in compliance with the License.
|
|
767
|
+
* You may obtain a copy of the License at
|
|
768
|
+
*
|
|
769
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
770
|
+
*
|
|
771
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
772
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
773
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
774
|
+
* See the License for the specific language governing permissions and
|
|
775
|
+
* limitations under the License.
|
|
776
|
+
*/async function zI(e,t={}){return Es(e,"GET","/v2/passwordPolicy",Ml(e,t))}/**
|
|
777
|
+
* @license
|
|
778
|
+
* Copyright 2023 Google LLC
|
|
779
|
+
*
|
|
780
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
781
|
+
* you may not use this file except in compliance with the License.
|
|
782
|
+
* You may obtain a copy of the License at
|
|
783
|
+
*
|
|
784
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
785
|
+
*
|
|
786
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
787
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
788
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
789
|
+
* See the License for the specific language governing permissions and
|
|
790
|
+
* limitations under the License.
|
|
791
|
+
*/const qI=6;class KI{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??qI,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))}}/**
|
|
792
|
+
* @license
|
|
793
|
+
* Copyright 2020 Google LLC
|
|
794
|
+
*
|
|
795
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
796
|
+
* you may not use this file except in compliance with the License.
|
|
797
|
+
* You may obtain a copy of the License at
|
|
798
|
+
*
|
|
799
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
800
|
+
*
|
|
801
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
802
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
803
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
804
|
+
* See the License for the specific language governing permissions and
|
|
805
|
+
* limitations under the License.
|
|
806
|
+
*/class JI{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 Cu(this),this.idTokenSubscription=new Cu(this),this.beforeStateQueue=new GI(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=qf,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=sr(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await gs.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 ni(this,{idToken:t}),r=await Cn._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(Wn(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 ze(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=RI()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Wn(this.app))return Promise.reject(Kr(this));const n=t?Is(t):null;return n&&ze(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&&ze(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 Wn(this.app)?Promise.reject(Kr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Wn(this.app)?Promise.reject(Kr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(sr(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 zI(this),n=new KI(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 po("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 HI(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&&sr(t)||this._popupRedirectResolver;ze(n,this,"argument-error"),this.redirectPersistenceManager=await gs.create(this,[sr(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(ze(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 ze(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=ah(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(Wn(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&&II(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Ii(e){return Is(e)}class Cu{constructor(t){this.auth=t,this.observer=null,this.addObserver=cS(n=>this.observer=n)}get next(){return ze(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
|
807
|
+
* @license
|
|
808
|
+
* Copyright 2020 Google LLC
|
|
809
|
+
*
|
|
810
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
811
|
+
* you may not use this file except in compliance with the License.
|
|
812
|
+
* You may obtain a copy of the License at
|
|
813
|
+
*
|
|
814
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
815
|
+
*
|
|
816
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
817
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
818
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
819
|
+
* See the License for the specific language governing permissions and
|
|
820
|
+
* limitations under the License.
|
|
821
|
+
*/let Nl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function YI(e){Nl=e}function XI(e){return Nl.loadJS(e)}function QI(){return Nl.gapiScript}function ZI(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
|
|
822
|
+
* @license
|
|
823
|
+
* Copyright 2020 Google LLC
|
|
824
|
+
*
|
|
825
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
826
|
+
* you may not use this file except in compliance with the License.
|
|
827
|
+
* You may obtain a copy of the License at
|
|
828
|
+
*
|
|
829
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
830
|
+
*
|
|
831
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
832
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
833
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
834
|
+
* See the License for the specific language governing permissions and
|
|
835
|
+
* limitations under the License.
|
|
836
|
+
*/function eE(e,t){const n=Bf(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(_s(o,t??{}))return s;Kn(s,"already-initialized")}return n.initialize({options:t})}function tE(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(sr);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function nE(e,t,n){const r=Ii(e);ze(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=lh(t),{host:i,port:a}=rE(t),l=a===null?"":`:${a}`,u={url:`${o}//${i}${l}/`},c=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){ze(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),ze(_s(u,r.config.emulator)&&_s(c,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=u,r.emulatorConfig=c,r.settings.appVerificationDisabledForTesting=!0,Cl(i)?fS(`${o}//${i}${l}`):sE()}function lh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function rE(e){const t=lh(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:Au(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:Au(i)}}}function Au(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function sE(){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())}/**
|
|
837
|
+
* @license
|
|
838
|
+
* Copyright 2020 Google LLC
|
|
839
|
+
*
|
|
840
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
841
|
+
* you may not use this file except in compliance with the License.
|
|
842
|
+
* You may obtain a copy of the License at
|
|
843
|
+
*
|
|
844
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
845
|
+
*
|
|
846
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
847
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
848
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
849
|
+
* See the License for the specific language governing permissions and
|
|
850
|
+
* limitations under the License.
|
|
851
|
+
*/class ch{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return rr("not implemented")}_getIdTokenResponse(t){return rr("not implemented")}_linkToIdToken(t,n){return rr("not implemented")}_getReauthenticationResolver(t){return rr("not implemented")}}/**
|
|
852
|
+
* @license
|
|
853
|
+
* Copyright 2020 Google LLC
|
|
854
|
+
*
|
|
855
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
856
|
+
* you may not use this file except in compliance with the License.
|
|
857
|
+
* You may obtain a copy of the License at
|
|
858
|
+
*
|
|
859
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
860
|
+
*
|
|
861
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
862
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
863
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
864
|
+
* See the License for the specific language governing permissions and
|
|
865
|
+
* limitations under the License.
|
|
866
|
+
*/async function vs(e,t){return $I(e,"POST","/v1/accounts:signInWithIdp",Ml(e,t))}/**
|
|
867
|
+
* @license
|
|
868
|
+
* Copyright 2020 Google LLC
|
|
869
|
+
*
|
|
870
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
871
|
+
* you may not use this file except in compliance with the License.
|
|
872
|
+
* You may obtain a copy of the License at
|
|
873
|
+
*
|
|
874
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
875
|
+
*
|
|
876
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
877
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
878
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
879
|
+
* See the License for the specific language governing permissions and
|
|
880
|
+
* limitations under the License.
|
|
881
|
+
*/const oE="http://localhost";class Yr extends ch{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new Yr(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):Kn("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 Yr(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 vs(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,vs(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,vs(t,n)}buildRequest(){const t={requestUri:oE,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=mo(n)}return t}}/**
|
|
882
|
+
* @license
|
|
883
|
+
* Copyright 2020 Google LLC
|
|
884
|
+
*
|
|
885
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
886
|
+
* you may not use this file except in compliance with the License.
|
|
887
|
+
* You may obtain a copy of the License at
|
|
888
|
+
*
|
|
889
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
890
|
+
*
|
|
891
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
892
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
893
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
894
|
+
* See the License for the specific language governing permissions and
|
|
895
|
+
* limitations under the License.
|
|
896
|
+
*/class Dl{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}}/**
|
|
897
|
+
* @license
|
|
898
|
+
* Copyright 2019 Google LLC
|
|
899
|
+
*
|
|
900
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
901
|
+
* you may not use this file except in compliance with the License.
|
|
902
|
+
* You may obtain a copy of the License at
|
|
903
|
+
*
|
|
904
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
905
|
+
*
|
|
906
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
907
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
908
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
909
|
+
* See the License for the specific language governing permissions and
|
|
910
|
+
* limitations under the License.
|
|
911
|
+
*/class yo extends Dl{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
|
|
912
|
+
* @license
|
|
913
|
+
* Copyright 2020 Google LLC
|
|
914
|
+
*
|
|
915
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
916
|
+
* you may not use this file except in compliance with the License.
|
|
917
|
+
* You may obtain a copy of the License at
|
|
918
|
+
*
|
|
919
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
920
|
+
*
|
|
921
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
922
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
923
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
924
|
+
* See the License for the specific language governing permissions and
|
|
925
|
+
* limitations under the License.
|
|
926
|
+
*/class Cr extends yo{constructor(){super("facebook.com")}static credential(t){return Yr._fromParams({providerId:Cr.PROVIDER_ID,signInMethod:Cr.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Cr.credentialFromTaggedObject(t)}static credentialFromError(t){return Cr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return Cr.credential(t.oauthAccessToken)}catch{return null}}}Cr.FACEBOOK_SIGN_IN_METHOD="facebook.com";Cr.PROVIDER_ID="facebook.com";/**
|
|
927
|
+
* @license
|
|
928
|
+
* Copyright 2020 Google LLC
|
|
929
|
+
*
|
|
930
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
931
|
+
* you may not use this file except in compliance with the License.
|
|
932
|
+
* You may obtain a copy of the License at
|
|
933
|
+
*
|
|
934
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
935
|
+
*
|
|
936
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
937
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
938
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
939
|
+
* See the License for the specific language governing permissions and
|
|
940
|
+
* limitations under the License.
|
|
941
|
+
*/class Ar extends yo{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return Yr._fromParams({providerId:Ar.PROVIDER_ID,signInMethod:Ar.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return Ar.credentialFromTaggedObject(t)}static credentialFromError(t){return Ar.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return Ar.credential(n,r)}catch{return null}}}Ar.GOOGLE_SIGN_IN_METHOD="google.com";Ar.PROVIDER_ID="google.com";/**
|
|
942
|
+
* @license
|
|
943
|
+
* Copyright 2020 Google LLC
|
|
944
|
+
*
|
|
945
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
946
|
+
* you may not use this file except in compliance with the License.
|
|
947
|
+
* You may obtain a copy of the License at
|
|
948
|
+
*
|
|
949
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
950
|
+
*
|
|
951
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
952
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
953
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
954
|
+
* See the License for the specific language governing permissions and
|
|
955
|
+
* limitations under the License.
|
|
956
|
+
*/class Vn extends yo{constructor(){super("github.com")}static credential(t){return Yr._fromParams({providerId:Vn.PROVIDER_ID,signInMethod:Vn.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Vn.credentialFromTaggedObject(t)}static credentialFromError(t){return Vn.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return Vn.credential(t.oauthAccessToken)}catch{return null}}}Vn.GITHUB_SIGN_IN_METHOD="github.com";Vn.PROVIDER_ID="github.com";/**
|
|
957
|
+
* @license
|
|
958
|
+
* Copyright 2020 Google LLC
|
|
959
|
+
*
|
|
960
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
961
|
+
* you may not use this file except in compliance with the License.
|
|
962
|
+
* You may obtain a copy of the License at
|
|
963
|
+
*
|
|
964
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
965
|
+
*
|
|
966
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
967
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
968
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
969
|
+
* See the License for the specific language governing permissions and
|
|
970
|
+
* limitations under the License.
|
|
971
|
+
*/class Rr extends yo{constructor(){super("twitter.com")}static credential(t,n){return Yr._fromParams({providerId:Rr.PROVIDER_ID,signInMethod:Rr.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return Rr.credentialFromTaggedObject(t)}static credentialFromError(t){return Rr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return Rr.credential(n,r)}catch{return null}}}Rr.TWITTER_SIGN_IN_METHOD="twitter.com";Rr.PROVIDER_ID="twitter.com";/**
|
|
972
|
+
* @license
|
|
973
|
+
* Copyright 2020 Google LLC
|
|
974
|
+
*
|
|
975
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
976
|
+
* you may not use this file except in compliance with the License.
|
|
977
|
+
* You may obtain a copy of the License at
|
|
978
|
+
*
|
|
979
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
980
|
+
*
|
|
981
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
982
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
983
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
984
|
+
* See the License for the specific language governing permissions and
|
|
985
|
+
* limitations under the License.
|
|
986
|
+
*/class Ts{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 Cn._fromIdTokenResponse(t,r,s),i=Ru(r);return new Ts({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=Ru(r);return new Ts({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function Ru(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
|
|
987
|
+
* @license
|
|
988
|
+
* Copyright 2020 Google LLC
|
|
989
|
+
*
|
|
990
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
991
|
+
* you may not use this file except in compliance with the License.
|
|
992
|
+
* You may obtain a copy of the License at
|
|
993
|
+
*
|
|
994
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
995
|
+
*
|
|
996
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
997
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
998
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
999
|
+
* See the License for the specific language governing permissions and
|
|
1000
|
+
* limitations under the License.
|
|
1001
|
+
*/class si extends Or{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,si.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 si(t,n,r,s)}}function uh(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?si._fromErrorAndOperation(e,o,t,r):o})}async function iE(e,t,n=!1){const r=await co(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return Ts._forOperation(e,"link",r)}/**
|
|
1002
|
+
* @license
|
|
1003
|
+
* Copyright 2019 Google LLC
|
|
1004
|
+
*
|
|
1005
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1006
|
+
* you may not use this file except in compliance with the License.
|
|
1007
|
+
* You may obtain a copy of the License at
|
|
1008
|
+
*
|
|
1009
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1010
|
+
*
|
|
1011
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1012
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1013
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1014
|
+
* See the License for the specific language governing permissions and
|
|
1015
|
+
* limitations under the License.
|
|
1016
|
+
*/async function aE(e,t,n=!1){const{auth:r}=e;if(Wn(r.app))return Promise.reject(Kr(r));const s="reauthenticate";try{const o=await co(e,uh(r,s,t,e),n);ze(o.idToken,r,"internal-error");const i=$l(o.idToken);ze(i,r,"internal-error");const{sub:a}=i;return ze(e.uid===a,r,"user-mismatch"),Ts._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Kn(r,"user-mismatch"),o}}/**
|
|
1017
|
+
* @license
|
|
1018
|
+
* Copyright 2020 Google LLC
|
|
1019
|
+
*
|
|
1020
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1021
|
+
* you may not use this file except in compliance with the License.
|
|
1022
|
+
* You may obtain a copy of the License at
|
|
1023
|
+
*
|
|
1024
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1025
|
+
*
|
|
1026
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1027
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1028
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1029
|
+
* See the License for the specific language governing permissions and
|
|
1030
|
+
* limitations under the License.
|
|
1031
|
+
*/async function lE(e,t,n=!1){if(Wn(e.app))return Promise.reject(Kr(e));const r="signIn",s=await uh(e,r,t),o=await Ts._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function cE(e,t,n,r){return Is(e).onIdTokenChanged(t,n,r)}function uE(e,t,n){return Is(e).beforeAuthStateChanged(t,n)}const oi="__sak";/**
|
|
1032
|
+
* @license
|
|
1033
|
+
* Copyright 2019 Google LLC
|
|
1034
|
+
*
|
|
1035
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1036
|
+
* you may not use this file except in compliance with the License.
|
|
1037
|
+
* You may obtain a copy of the License at
|
|
1038
|
+
*
|
|
1039
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1040
|
+
*
|
|
1041
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1042
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1043
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1044
|
+
* See the License for the specific language governing permissions and
|
|
1045
|
+
* limitations under the License.
|
|
1046
|
+
*/class dh{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(oi,"1"),this.storage.removeItem(oi),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()}}/**
|
|
1047
|
+
* @license
|
|
1048
|
+
* Copyright 2020 Google LLC
|
|
1049
|
+
*
|
|
1050
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1051
|
+
* you may not use this file except in compliance with the License.
|
|
1052
|
+
* You may obtain a copy of the License at
|
|
1053
|
+
*
|
|
1054
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1055
|
+
*
|
|
1056
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1057
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1058
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1059
|
+
* See the License for the specific language governing permissions and
|
|
1060
|
+
* limitations under the License.
|
|
1061
|
+
*/const dE=1e3,fE=10;class fh extends dh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=ih(),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);VI()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,fE):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)})},dE)}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]}}fh.type="LOCAL";const hE=fh;/**
|
|
1062
|
+
* @license
|
|
1063
|
+
* Copyright 2020 Google LLC
|
|
1064
|
+
*
|
|
1065
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1066
|
+
* you may not use this file except in compliance with the License.
|
|
1067
|
+
* You may obtain a copy of the License at
|
|
1068
|
+
*
|
|
1069
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1070
|
+
*
|
|
1071
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1072
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1073
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1074
|
+
* See the License for the specific language governing permissions and
|
|
1075
|
+
* limitations under the License.
|
|
1076
|
+
*/class hh extends dh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}hh.type="SESSION";const ph=hh;/**
|
|
1077
|
+
* @license
|
|
1078
|
+
* Copyright 2019 Google LLC
|
|
1079
|
+
*
|
|
1080
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1081
|
+
* you may not use this file except in compliance with the License.
|
|
1082
|
+
* You may obtain a copy of the License at
|
|
1083
|
+
*
|
|
1084
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1085
|
+
*
|
|
1086
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1087
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1088
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1089
|
+
* See the License for the specific language governing permissions and
|
|
1090
|
+
* limitations under the License.
|
|
1091
|
+
*/function pE(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
|
|
1092
|
+
* @license
|
|
1093
|
+
* Copyright 2019 Google LLC
|
|
1094
|
+
*
|
|
1095
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1096
|
+
* you may not use this file except in compliance with the License.
|
|
1097
|
+
* You may obtain a copy of the License at
|
|
1098
|
+
*
|
|
1099
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1100
|
+
*
|
|
1101
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1102
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1103
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1104
|
+
* See the License for the specific language governing permissions and
|
|
1105
|
+
* limitations under the License.
|
|
1106
|
+
*/class Ei{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 Ei(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 u=>u(n.origin,o)),l=await pE(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)}}Ei.receivers=[];/**
|
|
1107
|
+
* @license
|
|
1108
|
+
* Copyright 2020 Google LLC
|
|
1109
|
+
*
|
|
1110
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1111
|
+
* you may not use this file except in compliance with the License.
|
|
1112
|
+
* You may obtain a copy of the License at
|
|
1113
|
+
*
|
|
1114
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1115
|
+
*
|
|
1116
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1117
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1118
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1119
|
+
* See the License for the specific language governing permissions and
|
|
1120
|
+
* limitations under the License.
|
|
1121
|
+
*/function Ll(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
|
|
1122
|
+
* @license
|
|
1123
|
+
* Copyright 2019 Google LLC
|
|
1124
|
+
*
|
|
1125
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1126
|
+
* you may not use this file except in compliance with the License.
|
|
1127
|
+
* You may obtain a copy of the License at
|
|
1128
|
+
*
|
|
1129
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1130
|
+
*
|
|
1131
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1132
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1133
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1134
|
+
* See the License for the specific language governing permissions and
|
|
1135
|
+
* limitations under the License.
|
|
1136
|
+
*/class mE{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 u=Ll("",20);s.port1.start();const c=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(f){const m=f;if(m.data.eventId===u)switch(m.data.status){case"ack":clearTimeout(c),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(m.data.response);break;default:clearTimeout(c),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:u,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
|
|
1137
|
+
* @license
|
|
1138
|
+
* Copyright 2020 Google LLC
|
|
1139
|
+
*
|
|
1140
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1141
|
+
* you may not use this file except in compliance with the License.
|
|
1142
|
+
* You may obtain a copy of the License at
|
|
1143
|
+
*
|
|
1144
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1145
|
+
*
|
|
1146
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1147
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1148
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1149
|
+
* See the License for the specific language governing permissions and
|
|
1150
|
+
* limitations under the License.
|
|
1151
|
+
*/function qn(){return window}function gE(e){qn().location.href=e}/**
|
|
1152
|
+
* @license
|
|
1153
|
+
* Copyright 2020 Google LLC.
|
|
1154
|
+
*
|
|
1155
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1156
|
+
* you may not use this file except in compliance with the License.
|
|
1157
|
+
* You may obtain a copy of the License at
|
|
1158
|
+
*
|
|
1159
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1160
|
+
*
|
|
1161
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1162
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1163
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1164
|
+
* See the License for the specific language governing permissions and
|
|
1165
|
+
* limitations under the License.
|
|
1166
|
+
*/function mh(){return typeof qn().WorkerGlobalScope<"u"&&typeof qn().importScripts=="function"}async function vE(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function yE(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function wE(){return mh()?self:null}/**
|
|
1167
|
+
* @license
|
|
1168
|
+
* Copyright 2019 Google LLC
|
|
1169
|
+
*
|
|
1170
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1171
|
+
* you may not use this file except in compliance with the License.
|
|
1172
|
+
* You may obtain a copy of the License at
|
|
1173
|
+
*
|
|
1174
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1175
|
+
*
|
|
1176
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1177
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1178
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1179
|
+
* See the License for the specific language governing permissions and
|
|
1180
|
+
* limitations under the License.
|
|
1181
|
+
*/const gh="firebaseLocalStorageDb",bE=1,ii="firebaseLocalStorage",vh="fbase_key";class wo{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 Ci(e,t){return e.transaction([ii],t?"readwrite":"readonly").objectStore(ii)}function _E(){const e=indexedDB.deleteDatabase(gh);return new wo(e).toPromise()}function Ja(){const e=indexedDB.open(gh,bE);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(ii,{keyPath:vh})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(ii)?t(r):(r.close(),await _E(),t(await Ja()))})})}async function Pu(e,t,n){const r=Ci(e,!0).put({[vh]:t,value:n});return new wo(r).toPromise()}async function kE(e,t){const n=Ci(e,!1).get(t),r=await new wo(n).toPromise();return r===void 0?null:r.value}function xu(e,t){const n=Ci(e,!0).delete(t);return new wo(n).toPromise()}const TE=800,SE=3;class yh{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 Ja(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>SE)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return mh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ei._getInstance(wE()),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 vE(),!this.activeServiceWorker)return;this.sender=new mE(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||yE()!==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 Ja();return await Pu(t,oi,"1"),await xu(t,oi),!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=>Pu(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>kE(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>xu(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=Ci(s,!1).getAll();return new wo(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(),TE)}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()}}yh.type="LOCAL";const IE=yh;new vo(3e4,6e4);/**
|
|
1182
|
+
* @license
|
|
1183
|
+
* Copyright 2021 Google LLC
|
|
1184
|
+
*
|
|
1185
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1186
|
+
* you may not use this file except in compliance with the License.
|
|
1187
|
+
* You may obtain a copy of the License at
|
|
1188
|
+
*
|
|
1189
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1190
|
+
*
|
|
1191
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1192
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1193
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1194
|
+
* See the License for the specific language governing permissions and
|
|
1195
|
+
* limitations under the License.
|
|
1196
|
+
*/function wh(e,t){return t?sr(t):(ze(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
|
|
1197
|
+
* @license
|
|
1198
|
+
* Copyright 2019 Google LLC
|
|
1199
|
+
*
|
|
1200
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1201
|
+
* you may not use this file except in compliance with the License.
|
|
1202
|
+
* You may obtain a copy of the License at
|
|
1203
|
+
*
|
|
1204
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1205
|
+
*
|
|
1206
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1207
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1208
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1209
|
+
* See the License for the specific language governing permissions and
|
|
1210
|
+
* limitations under the License.
|
|
1211
|
+
*/class jl extends ch{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return vs(t,this._buildIdpRequest())}_linkToIdToken(t,n){return vs(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return vs(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 EE(e){return lE(e.auth,new jl(e),e.bypassAuthState)}function CE(e){const{auth:t,user:n}=e;return ze(n,t,"internal-error"),aE(n,new jl(e),e.bypassAuthState)}async function AE(e){const{auth:t,user:n}=e;return ze(n,t,"internal-error"),iE(n,new jl(e),e.bypassAuthState)}/**
|
|
1212
|
+
* @license
|
|
1213
|
+
* Copyright 2020 Google LLC
|
|
1214
|
+
*
|
|
1215
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1216
|
+
* you may not use this file except in compliance with the License.
|
|
1217
|
+
* You may obtain a copy of the License at
|
|
1218
|
+
*
|
|
1219
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1220
|
+
*
|
|
1221
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1222
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1223
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1224
|
+
* See the License for the specific language governing permissions and
|
|
1225
|
+
* limitations under the License.
|
|
1226
|
+
*/class bh{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(u){this.reject(u)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return EE;case"linkViaPopup":case"linkViaRedirect":return AE;case"reauthViaPopup":case"reauthViaRedirect":return CE;default:Kn(this.auth,"internal-error")}}resolve(t){fr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){fr(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()}}/**
|
|
1227
|
+
* @license
|
|
1228
|
+
* Copyright 2020 Google LLC
|
|
1229
|
+
*
|
|
1230
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1231
|
+
* you may not use this file except in compliance with the License.
|
|
1232
|
+
* You may obtain a copy of the License at
|
|
1233
|
+
*
|
|
1234
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1235
|
+
*
|
|
1236
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1237
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1238
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1239
|
+
* See the License for the specific language governing permissions and
|
|
1240
|
+
* limitations under the License.
|
|
1241
|
+
*/const RE=new vo(2e3,1e4);async function PE(e,t,n){if(Wn(e.app))return Promise.reject(Pn(e,"operation-not-supported-in-this-environment"));const r=Ii(e);EI(e,t,Dl);const s=wh(r,n);return new Gr(r,"signInViaPopup",t,s).executeNotNull()}class Gr extends bh{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,Gr.currentPopupAction&&Gr.currentPopupAction.cancel(),Gr.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return ze(t,this.auth,"internal-error"),t}async onExecution(){fr(this.filter.length===1,"Popup operations only handle one event");const t=Ll();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(Pn(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(Pn(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Gr.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(Pn(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,RE.get())};t()}}Gr.currentPopupAction=null;/**
|
|
1242
|
+
* @license
|
|
1243
|
+
* Copyright 2020 Google LLC
|
|
1244
|
+
*
|
|
1245
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1246
|
+
* you may not use this file except in compliance with the License.
|
|
1247
|
+
* You may obtain a copy of the License at
|
|
1248
|
+
*
|
|
1249
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1250
|
+
*
|
|
1251
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1252
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1253
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1254
|
+
* See the License for the specific language governing permissions and
|
|
1255
|
+
* limitations under the License.
|
|
1256
|
+
*/const xE="pendingRedirect",Wo=new Map;class ME extends bh{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=Wo.get(this.auth._key());if(!t){try{const r=await $E(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}Wo.set(this.auth._key(),t)}return this.bypassAuthState||Wo.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 $E(e,t){const n=DE(t),r=NE(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function OE(e,t){Wo.set(e._key(),t)}function NE(e){return sr(e._redirectPersistence)}function DE(e){return Ho(xE,e.config.apiKey,e.name)}async function LE(e,t,n=!1){if(Wn(e.app))return Promise.reject(Kr(e));const r=Ii(e),s=wh(r,t),i=await new ME(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
|
|
1257
|
+
* @license
|
|
1258
|
+
* Copyright 2020 Google LLC
|
|
1259
|
+
*
|
|
1260
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1261
|
+
* you may not use this file except in compliance with the License.
|
|
1262
|
+
* You may obtain a copy of the License at
|
|
1263
|
+
*
|
|
1264
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1265
|
+
*
|
|
1266
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1267
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1268
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1269
|
+
* See the License for the specific language governing permissions and
|
|
1270
|
+
* limitations under the License.
|
|
1271
|
+
*/const jE=600*1e3;class UE{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||!FE(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!_h(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(Pn(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>=jE&&this.cachedEventUids.clear(),this.cachedEventUids.has(Mu(t))}saveEventToCache(t){this.cachedEventUids.add(Mu(t)),this.lastProcessedEventTime=Date.now()}}function Mu(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function _h({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function FE(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return _h(e);default:return!1}}/**
|
|
1272
|
+
* @license
|
|
1273
|
+
* Copyright 2020 Google LLC
|
|
1274
|
+
*
|
|
1275
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1276
|
+
* you may not use this file except in compliance with the License.
|
|
1277
|
+
* You may obtain a copy of the License at
|
|
1278
|
+
*
|
|
1279
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1280
|
+
*
|
|
1281
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1282
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1283
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1284
|
+
* See the License for the specific language governing permissions and
|
|
1285
|
+
* limitations under the License.
|
|
1286
|
+
*/async function BE(e,t={}){return Es(e,"GET","/v1/projects",t)}/**
|
|
1287
|
+
* @license
|
|
1288
|
+
* Copyright 2020 Google LLC
|
|
1289
|
+
*
|
|
1290
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1291
|
+
* you may not use this file except in compliance with the License.
|
|
1292
|
+
* You may obtain a copy of the License at
|
|
1293
|
+
*
|
|
1294
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1295
|
+
*
|
|
1296
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1297
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1298
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1299
|
+
* See the License for the specific language governing permissions and
|
|
1300
|
+
* limitations under the License.
|
|
1301
|
+
*/const HE=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,WE=/^https?/;async function VE(e){if(e.config.emulator)return;const{authorizedDomains:t}=await BE(e);for(const n of t)try{if(GE(n))return}catch{}Kn(e,"unauthorized-domain")}function GE(e){const t=qa(),{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(!WE.test(n))return!1;if(HE.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
|
|
1302
|
+
* @license
|
|
1303
|
+
* Copyright 2020 Google LLC.
|
|
1304
|
+
*
|
|
1305
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1306
|
+
* you may not use this file except in compliance with the License.
|
|
1307
|
+
* You may obtain a copy of the License at
|
|
1308
|
+
*
|
|
1309
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1310
|
+
*
|
|
1311
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1312
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1313
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1314
|
+
* See the License for the specific language governing permissions and
|
|
1315
|
+
* limitations under the License.
|
|
1316
|
+
*/const zE=new vo(3e4,6e4);function $u(){const e=qn().___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 qE(e){return new Promise((t,n)=>{var s,o,i;function r(){$u(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{$u(),n(Pn(e,"network-request-failed"))},timeout:zE.get()})}if((o=(s=qn().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=qn().gapi)!=null&&i.load)r();else{const a=ZI("iframefcb");return qn()[a]=()=>{gapi.load?r():n(Pn(e,"network-request-failed"))},XI(`${QI()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw Vo=null,t})}let Vo=null;function KE(e){return Vo=Vo||qE(e),Vo}/**
|
|
1317
|
+
* @license
|
|
1318
|
+
* Copyright 2020 Google LLC.
|
|
1319
|
+
*
|
|
1320
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1321
|
+
* you may not use this file except in compliance with the License.
|
|
1322
|
+
* You may obtain a copy of the License at
|
|
1323
|
+
*
|
|
1324
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1325
|
+
*
|
|
1326
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1327
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1328
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1329
|
+
* See the License for the specific language governing permissions and
|
|
1330
|
+
* limitations under the License.
|
|
1331
|
+
*/const JE=new vo(5e3,15e3),YE="__/auth/iframe",XE="emulator/auth/iframe",QE={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},ZE=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function eC(e){const t=e.config;ze(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?xl(t,XE):`https://${e.config.authDomain}/${YE}`,r={apiKey:t.apiKey,appName:e.name,v:go},s=ZE.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${mo(r).slice(1)}`}async function tC(e){const t=await KE(e),n=qn().gapi;return ze(n,e,"internal-error"),t.open({where:document.body,url:eC(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:QE,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=Pn(e,"network-request-failed"),a=qn().setTimeout(()=>{o(i)},JE.get());function l(){qn().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
|
|
1332
|
+
* @license
|
|
1333
|
+
* Copyright 2020 Google LLC.
|
|
1334
|
+
*
|
|
1335
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1336
|
+
* you may not use this file except in compliance with the License.
|
|
1337
|
+
* You may obtain a copy of the License at
|
|
1338
|
+
*
|
|
1339
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1340
|
+
*
|
|
1341
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1342
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1343
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1344
|
+
* See the License for the specific language governing permissions and
|
|
1345
|
+
* limitations under the License.
|
|
1346
|
+
*/const nC={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},rC=500,sC=600,oC="_blank",iC="http://localhost";class Ou{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function aC(e,t,n,r=rC,s=sC){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={...nC,width:r.toString(),height:s.toString(),top:o,left:i},u=hn().toLowerCase();n&&(a=th(u)?oC:n),Zf(u)&&(t=t||iC,l.scrollbars="yes");const c=Object.entries(l).reduce((m,[T,U])=>`${m}${T}=${U},`,"");if(WI(u)&&a!=="_self")return lC(t||"",a),new Ou(null);const f=window.open(t||"",a,c);ze(f,e,"popup-blocked");try{f.focus()}catch{}return new Ou(f)}function lC(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)}/**
|
|
1347
|
+
* @license
|
|
1348
|
+
* Copyright 2021 Google LLC
|
|
1349
|
+
*
|
|
1350
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1351
|
+
* you may not use this file except in compliance with the License.
|
|
1352
|
+
* You may obtain a copy of the License at
|
|
1353
|
+
*
|
|
1354
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1355
|
+
*
|
|
1356
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1357
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1358
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1359
|
+
* See the License for the specific language governing permissions and
|
|
1360
|
+
* limitations under the License.
|
|
1361
|
+
*/const cC="__/auth/handler",uC="emulator/auth/handler",dC=encodeURIComponent("fac");async function Nu(e,t,n,r,s,o){ze(e.config.authDomain,e,"auth-domain-config-required"),ze(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:go,eventId:s};if(t instanceof Dl){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",lS(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[c,f]of Object.entries({}))i[c]=f}if(t instanceof yo){const c=t.getScopes().filter(f=>f!=="");c.length>0&&(i.scopes=c.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const c of Object.keys(a))a[c]===void 0&&delete a[c];const l=await e._getAppCheckToken(),u=l?`#${dC}=${encodeURIComponent(l)}`:"";return`${fC(e)}?${mo(a).slice(1)}${u}`}function fC({config:e}){return e.emulator?xl(e,uC):`https://${e.authDomain}/${cC}`}/**
|
|
1362
|
+
* @license
|
|
1363
|
+
* Copyright 2020 Google LLC
|
|
1364
|
+
*
|
|
1365
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1366
|
+
* you may not use this file except in compliance with the License.
|
|
1367
|
+
* You may obtain a copy of the License at
|
|
1368
|
+
*
|
|
1369
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1370
|
+
*
|
|
1371
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1372
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1373
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1374
|
+
* See the License for the specific language governing permissions and
|
|
1375
|
+
* limitations under the License.
|
|
1376
|
+
*/const ma="webStorageSupport";class hC{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=ph,this._completeRedirectFn=LE,this._overrideRedirectResult=OE}async _openPopup(t,n,r,s){var i;fr((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Nu(t,n,r,qa(),s);return aC(t,o,Ll())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await Nu(t,n,r,qa(),s);return gE(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):(fr(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 tC(t),r=new UE(t);return n.register("authEvent",s=>(ze(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(ma,{type:ma},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[ma];o!==void 0&&n(!!o),Kn(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=VE(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return ih()||eh()||Ol()}}const pC=hC;var Du="@firebase/auth",Lu="1.12.2";/**
|
|
1377
|
+
* @license
|
|
1378
|
+
* Copyright 2020 Google LLC
|
|
1379
|
+
*
|
|
1380
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1381
|
+
* you may not use this file except in compliance with the License.
|
|
1382
|
+
* You may obtain a copy of the License at
|
|
1383
|
+
*
|
|
1384
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1385
|
+
*
|
|
1386
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1387
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1388
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1389
|
+
* See the License for the specific language governing permissions and
|
|
1390
|
+
* limitations under the License.
|
|
1391
|
+
*/class mC{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(){ze(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
1392
|
+
* @license
|
|
1393
|
+
* Copyright 2020 Google LLC
|
|
1394
|
+
*
|
|
1395
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1396
|
+
* you may not use this file except in compliance with the License.
|
|
1397
|
+
* You may obtain a copy of the License at
|
|
1398
|
+
*
|
|
1399
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1400
|
+
*
|
|
1401
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1402
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1403
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1404
|
+
* See the License for the specific language governing permissions and
|
|
1405
|
+
* limitations under the License.
|
|
1406
|
+
*/function gC(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 vC(e){ao(new ks("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;ze(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:ah(e)},u=new JI(r,s,o,l);return tE(u,n),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),ao(new ks("auth-internal",t=>{const n=Ii(t.getProvider("auth").getImmediate());return(r=>new mC(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),ps(Du,Lu,gC(e)),ps(Du,Lu,"esm2020")}/**
|
|
1407
|
+
* @license
|
|
1408
|
+
* Copyright 2021 Google LLC
|
|
1409
|
+
*
|
|
1410
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1411
|
+
* you may not use this file except in compliance with the License.
|
|
1412
|
+
* You may obtain a copy of the License at
|
|
1413
|
+
*
|
|
1414
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1415
|
+
*
|
|
1416
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1417
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1418
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1419
|
+
* See the License for the specific language governing permissions and
|
|
1420
|
+
* limitations under the License.
|
|
1421
|
+
*/const yC=300,wC=Lf("authIdTokenMaxAge")||yC;let ju=null;const bC=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>wC)return;const s=n==null?void 0:n.token;ju!==s&&(ju=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function _C(e=Wf()){const t=Bf(e,"auth");if(t.isInitialized())return t.getImmediate();const n=eE(e,{popupRedirectResolver:pC,persistence:[IE,hE,ph]}),r=Lf("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=bC(o.toString());uE(n,i,()=>i(n.currentUser)),cE(n,a=>i(a))}}const s=YT("auth");return s&&nE(n,`http://${s}`),n}function kC(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}YI({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=Pn("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",kC().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="});vC("Browser");const TC={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 SC(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=fe(()=>s.value==="pull"),a=fe(()=>s.value==="push"),l=fe(()=>s.value!=="");async function u(){try{const P=await fetch("/codex-api/skills-sync/status");if(!P.ok)return;const F=await P.json();F.data&&(o.value=F.data)}catch{}}async function c(){try{const P=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),F=await P.json();if(!P.ok||!F.data)throw new Error("Failed to start GitHub login");t.value=F.data;const R=30,A=Math.max((F.data.interval??5)*1e3,3e3);let B=!1;for(let W=0;W<R;W++){await new Promise(ve=>setTimeout(ve,A));const ce=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:F.data.device_code})}),me=await ce.json();if(!ce.ok)throw new Error(me.error||"Failed to complete GitHub login");if(me.ok){B=!0;break}if(!me.pending)throw new Error(me.error||"Failed to complete GitHub login")}if(!B)throw new Error("GitHub login timed out. Please retry.");t.value=null,await u(),e.showToast("GitHub login successful")}catch(P){e.showToast(P instanceof Error?P.message:"Failed GitHub login","error")}}async function f(){try{const P=dI().length>0?Wf():Hf(TC),F=_C(P),R=new Vn;R.addScope("repo");const A=await PE(F,R),B=Vn.credentialFromResult(A),W=(B==null?void 0:B.accessToken)??"";if(!W)throw new Error("GitHub access token missing from Firebase login");const ce=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:W})}),me=await ce.json();if(!ce.ok||!me.ok)throw new Error(me.error||"Failed to login with GitHub token");await u(),e.showToast("GitHub login successful")}catch(P){const F=P instanceof Error?P.message:"Failed Firebase GitHub login";e.showToast(F,"error")}}async function m(){r.value="",n.value="pull-started",s.value="pull";try{const P=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),F=await P.json();if(!P.ok||!F.ok)throw new Error(F.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(P){const F=P instanceof Error?P.message:"Failed to pull sync";r.value=F,n.value="pull-failed",e.showToast(F,"error")}finally{s.value=""}}async function T(){r.value="",n.value="push-started",s.value="push";try{const P=await fetch("/codex-api/skills-sync/push",{method:"POST"}),F=await P.json();if(!P.ok||!F.ok)throw new Error(F.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch(P){const F=P instanceof Error?P.message:"Failed to push sync";r.value=F,n.value="push-failed",e.showToast(F,"error")}finally{s.value=""}}async function U(){try{const P=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),F=await P.json();if(!P.ok||!F.ok)throw new Error(F.error||"Failed to logout GitHub");await u(),e.showToast("Logged out from GitHub")}catch(P){e.showToast(P instanceof Error?P.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:u,logoutGithub:U,pullSkillsSync:m,pushSkillsSync:T,startGithubFirebaseLogin:f,startGithubLogin:c,syncActionError:r,syncActionStatus:n,syncStatus:o}}const IC={class:"skills-hub"},EC={class:"skills-sync-panel"},CC={class:"skills-sync-header"},AC={key:0,class:"skills-sync-badge"},RC={key:1,class:"skills-sync-badge"},PC={key:2,class:"skills-sync-badge"},xC={class:"skills-sync-meta"},MC={key:0,class:"skills-sync-error"},$C={key:1,class:"skills-sync-meta"},OC={key:2,class:"skills-sync-error"},NC={key:3,class:"skills-sync-device"},DC=["href"],LC={class:"skills-sync-actions"},jC=["disabled"],UC=["disabled"],FC=["disabled"],BC={key:1,class:"skills-hub-section"},HC={class:"skills-hub-section-title"},WC={key:0,class:"skills-hub-grid"},VC={class:"skills-hub-toolbar"},GC={class:"skills-hub-search-wrap"},zC={key:0,class:"skills-hub-count"},qC={class:"skills-hub-section"},KC={key:0,class:"skills-hub-loading"},JC={key:1,class:"skills-hub-error"},YC={key:0,class:"skills-hub-grid"},XC={key:1,class:"skills-hub-empty"},xo="codex-web-local.skills-hub.cache.v1",QC=Ht({__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),u=D(!1),c=D(""),f=D(!0),m=D(!1),T=D(n),U=D(null),P=D(""),F=D(!1),R=D(!1);let A=null,B=null;const W=t,ce=fe(()=>o.value==="date"?"Newest":"A-Z"),me=fe(()=>{var N;return((N=U.value)==null?void 0:N.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),ve=fe(()=>`${T.value.owner}/${T.value.name}`),Ie=fe(()=>F.value&&P.value===ve.value),re=fe(()=>R.value&&P.value===ve.value),le=fe(()=>{const N=s.value.toLowerCase().trim();return N?a.value.filter(V=>V.name.toLowerCase().includes(N)||V.owner.toLowerCase().includes(N)||(V.displayName??"").toLowerCase().includes(N)):a.value});function we(N,V="success"){U.value={text:N,type:V},B&&clearTimeout(B),B=setTimeout(()=>{U.value=null},3e3)}function Y(){o.value=o.value==="date"?"name":"date",Ee(s.value)}function Te(N){return`${o.value}::${N.trim().toLowerCase()}`}function xe(N){var V;if(typeof window>"u")return null;try{const J=window.localStorage.getItem(xo);return J?((V=JSON.parse(J).byKey)==null?void 0:V[N])??null:null}catch{return null}}function Le(N,V){if(!(typeof window>"u"))try{const J=window.localStorage.getItem(xo),z=(J?JSON.parse(J):{}).byKey??{};z[N]=V,window.localStorage.setItem(xo,JSON.stringify({byKey:z}))}catch{}}function Pe(){if(!(typeof window>"u"))try{window.localStorage.removeItem(xo)}catch{}}function Oe(N){const V=N.installed??[];a.value=V;const J=new Set(V.map(Q=>Q.name));i.value=N.data.map(Q=>{if(Q.installed||J.has(Q.name)){const z=V.find(_e=>_e.name===Q.name);return{...Q,installed:!0,path:(z==null?void 0:z.path)??Q.path,enabled:(z==null?void 0:z.enabled)??Q.enabled}}return Q}).filter(Q=>!Q.installed),l.value=N.total}async function Ee(N){const V=Te(N),J=xe(V);J&&Oe(J),u.value=!J,c.value="";try{const Q=new URLSearchParams;N.trim()&&Q.set("q",N.trim()),Q.set("limit","100"),Q.set("sort",o.value);const z=await fetch(`/codex-api/skills-hub?${Q}`);if(!z.ok)throw new Error(`HTTP ${z.status}`);const _e=await z.json();Oe(_e),Le(V,_e)}catch(Q){c.value=Q instanceof Error?Q.message:"Failed to load skills"}finally{u.value=!1}}function Ye(){A&&clearTimeout(A),A=setTimeout(()=>Ee(s.value),300)}function Ze(N){T.value=N,m.value=!0}async function Ne(N){P.value=`${N.owner}/${N.name}`,F.value=!0;try{const J=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(!J.ok)throw new Error(J.error||"Install failed");const Q={...N,installed:!0,path:J.path,enabled:!0};a.value=[...a.value,Q],i.value=i.value.filter(z=>z.name!==N.name),T.value=Q,we(`${N.displayName||N.name} skill installed`),m.value=!1,Pe(),W("skills-changed")}catch(V){we(V instanceof Error?V.message:"Failed to install skill","error")}finally{F.value=!1}}async function nt(N){P.value=`${N.owner}/${N.name}`,R.value=!0;try{const J=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(!J.ok)throw new Error(J.error||"Uninstall failed");a.value=a.value.filter(Q=>Q.name!==N.name),N.owner!=="local"&&(i.value=[...i.value,{...N,installed:!1,path:void 0,enabled:void 0}]),we(`${N.displayName||N.name} skill uninstalled`),m.value=!1,Pe(),W("skills-changed")}catch(V){we(V instanceof Error?V.message:"Failed to uninstall skill","error")}finally{R.value=!1}}async function gt(N,V){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:V}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),we(`${N.displayName||N.name} skill ${V?"enabled":"disabled"}`),await Ee(s.value)}catch(J){we(J instanceof Error?J.message:"Failed to update skill","error")}}const{deviceLogin:at,isPullInFlight:et,isPushInFlight:Xe,isSyncActionInFlight:K,loadSyncStatus:he,logoutGithub:ue,pullSkillsSync:be,pushSkillsSync:$e,startGithubFirebaseLogin:g,startGithubLogin:b,syncActionError:x,syncActionStatus:q,syncStatus:G}=SC({showToast:we,onPulled:async()=>{await Ee(s.value),W("skills-changed")}});return pr(()=>{Ee(""),he()}),(N,V)=>(w(),k("div",IC,[V[11]||(V[11]=p("div",{class:"skills-hub-header"},[p("h2",{class:"skills-hub-title"},"Skills Hub"),p("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),p("div",EC,[p("div",CC,[V[8]||(V[8]=p("strong",null,"Skills Sync (GitHub)",-1)),ye(G).configured?(w(),k("span",AC,"Connected: "+ie(ye(G).repoOwner)+"/"+ie(ye(G).repoName),1)):ye(G).loggedIn?(w(),k("span",RC,"Logged in as "+ie(ye(G).githubUsername),1)):(w(),k("span",PC,"Not connected"))]),p("div",xC,[p("span",null,"Startup: "+ie(ye(G).startup.mode),1),p("span",null,"Branch: "+ie(ye(G).startup.branch),1),p("span",null,"Action: "+ie(ye(G).startup.lastAction),1)]),ye(G).startup.lastError?(w(),k("div",MC,ie(ye(G).startup.lastError),1)):ae("",!0),ye(q)?(w(),k("div",$C,[p("span",null,"Manual sync: "+ie(ye(q)),1)])):ae("",!0),ye(x)?(w(),k("div",OC,ie(ye(x)),1)):ae("",!0),ye(at)?(w(),k("div",NC,[p("span",null,[V[9]||(V[9]=no("Open ",-1)),p("a",{href:ye(at).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,DC),V[10]||(V[10]=no(" and enter code:",-1))]),p("code",null,ie(ye(at).user_code),1)])):ae("",!0),p("div",LC,[ye(G).loggedIn?ae("",!0):(w(),k("button",{key:0,class:"skills-hub-sort",type:"button",onClick:V[0]||(V[0]=(...J)=>ye(g)&&ye(g)(...J))},"Login with GitHub")),ye(G).loggedIn?ae("",!0):(w(),k("button",{key:1,class:"skills-hub-sort",type:"button",onClick:V[1]||(V[1]=(...J)=>ye(b)&&ye(b)(...J))},"Device Login")),ye(G).loggedIn?(w(),k("button",{key:2,class:"skills-hub-sort",type:"button",onClick:V[2]||(V[2]=(...J)=>ye(ue)&&ye(ue)(...J)),disabled:ye(K)},"Logout GitHub",8,jC)):ae("",!0),p("button",{class:"skills-hub-sort",type:"button",onClick:V[3]||(V[3]=(...J)=>ye(be)&&ye(be)(...J)),disabled:ye(K)},ie(ye(et)?"Pulling...":"Pull"),9,UC),ye(G).loggedIn?(w(),k("button",{key:3,class:"skills-hub-sort",type:"button",onClick:V[4]||(V[4]=(...J)=>ye($e)&&ye($e)(...J)),disabled:!ye(G).configured||ye(K)},ie(ye(Xe)?"Pushing...":"Push"),9,FC)):ae("",!0)])]),U.value?(w(),k("div",{key:0,class:it(["skills-hub-toast",me.value])},ie(U.value.text),3)):ae("",!0),le.value.length>0?(w(),k("div",BC,[p("button",{class:"skills-hub-section-toggle",type:"button",onClick:V[5]||(V[5]=J=>f.value=!f.value)},[p("span",HC,"Installed ("+ie(le.value.length)+")",1),Re(Af,{class:it(["skills-hub-section-chevron",{"is-open":f.value}])},null,8,["class"])]),f.value?(w(),k("div",WC,[(w(!0),k(Be,null,St(le.value,J=>(w(),ft(du,{key:J.name,skill:J,onSelect:Q=>Ze(Q)},null,8,["skill","onSelect"]))),128))])):ae("",!0)])):ae("",!0),p("div",VC,[p("div",GC,[Re(Ba,{class:"skills-hub-search-icon"}),cr(p("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":V[6]||(V[6]=J=>s.value=J),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:Ye},null,544),[[ur,s.value]]),l.value>0?(w(),k("span",zC,ie(l.value)+" skills",1)):ae("",!0)]),p("button",{class:"skills-hub-sort",type:"button",onClick:Y},ie(ce.value),1)]),p("div",qC,[u.value?(w(),k("div",KC,"Loading skills...")):c.value?(w(),k("div",JC,ie(c.value),1)):(w(),k(Be,{key:2},[i.value.length>0?(w(),k("div",YC,[(w(!0),k(Be,null,St(i.value,J=>(w(),ft(du,{key:J.url,skill:J,onSelect:Q=>Ze(Q)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(w(),k("div",XC,'No skills found for "'+ie(s.value)+'"',1)):ae("",!0)],64))]),Re(BT,{skill:T.value,visible:m.value,"is-installing":Ie.value,"is-uninstalling":re.value,onClose:V[7]||(V[7]=J=>m.value=!1),onInstall:Ne,onUninstall:nt,onToggleEnabled:gt},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),ZC=st(QC,[["__scopeId","data-v-2f6920be"]]),eA={},tA={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 nA(e,t){return w(),k("svg",tA,[...t[0]||(t[0]=[p("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),p("path",{d:"M9 4l0 16"},null,-1)])])}const rA=st(eA,[["render",nA]]),sA={},oA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function iA(e,t){return w(),k("svg",oA,[...t[0]||(t[0]=[p("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 aA=st(sA,[["render",iA]]),lA={class:"sidebar-thread-controls"},cA=["aria-label","title"],uA=Ht({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(w(),k("div",lA,[p("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?(w(),ft(aA,{key:0,class:"sidebar-thread-controls-icon"})):(w(),ft(rA,{key:1,class:"sidebar-thread-controls-icon"}))],8,cA),Gn(t.$slots,"default",{},void 0),e.showNewThreadButton?(w(),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"))},[Re(ei,{class:"sidebar-thread-controls-icon"})])):ae("",!0)]))}}),Uu=st(uA,[["__scopeId","data-v-46a10052"]]),dA={},fA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function hA(e,t){return w(),k("svg",fA,[...t[0]||(t[0]=[p("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[p("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"}),p("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const pA=st(dA,[["render",hA]]);function Er(e){return e.flatMap(t=>t.threads)}const kh="codex-web-local.thread-read-state.v1",Th="codex-web-local.thread-scroll-state.v1",Ya="codex-web-local.selected-thread-id.v1",Xa="codex-web-local.selected-model-id.v1",Sh="codex-web-local.project-order.v1",Ih="codex-web-local.project-display-name.v1",ga=220,mA=500,Fu=["none","minimal","low","medium","high","xhigh"],js="__global__",Sn="gpt-5.2-codex",gA="Auto-commit from Codex worktree chat turn";function vA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(kh);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Bu(e){typeof window>"u"||window.localStorage.setItem(kh,JSON.stringify(e))}function Qa(e,t,n){return Math.min(Math.max(e,t),n)}function yA(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=Qa(t.scrollRatio,0,1)),n}function wA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Th);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=yA(s);o&&(n[r]=o)}return n}catch{return{}}}function Hu(e){typeof window>"u"||window.localStorage.setItem(Th,JSON.stringify(e))}function bA(){return typeof window>"u"?"":window.localStorage.getItem(Ya)??""}function _A(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Ya);return}window.localStorage.setItem(Ya,e)}}function kA(){var e;return typeof window>"u"?"":((e=window.localStorage.getItem(Xa))==null?void 0:e.trim())??""}function va(e){if(typeof window>"u")return;const t=e.trim();if(!t){window.localStorage.removeItem(Xa);return}window.localStorage.setItem(Xa,t)}function TA(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Sh);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 os(e){typeof window>"u"||window.localStorage.setItem(Sh,JSON.stringify(e))}function SA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ih);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 ya(e){typeof window>"u"||window.localStorage.setItem(Ih,JSON.stringify(e))}function Mo(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 Wr(e,n)?e:n}function wa(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??null).filter(s=>s!==null&&s.threads.length>0);for(const s of e)t.includes(s.projectName)||r.push(s);return r}function Wr(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 $o(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 Za(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Wr(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&EA(e.commandExecution,t.commandExecution)&&e.turnIndex===t.turnIndex}function ai(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 CA(e,t,n={}){const r=new Map(e.map(c=>[c.id,c])),s=new Map(t.map(c=>[c.id,c])),o=t.map(c=>{const f=r.get(c.id);return f&&Za(f,c)?f:c});if(n.preserveMissing!==!0)return ai(e,o)?e:o;const i=e.map(c=>{const f=s.get(c.id);return!f||Za(c,f)?c:f}),a=new Set(e.map(c=>c.id)),l=o.filter(c=>!a.has(c.id)),u=[...i,...l];return ai(e,u)?e:u}function el(e){return e.replace(/\s+/gu," ").trim()}function AA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>el(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=el(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function Wu(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(Za(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Eh="worked";function Tr(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function RA(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 PA(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function xA(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 MA(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${RA(e.durationMs)}`,messageType:Eh}}function $A(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function OA(e,t){const n=MA(t),r=e.filter(i=>i.messageType!==Eh),s=$A(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function Gt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function NA(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 DA(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 LA(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Zt(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Oo(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 u=i.get(l.id);return u&&NA(u,l)?u:l});return o&&o.projectName===s.projectName&&DA(o.threads,a)?o:{projectName:s.projectName,threads:a}});return LA(e,r)?e:r}function jA(e,t,n){const r=new Set(Er(t).map(a=>a.id)),s=Er(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 u=i.findIndex(c=>c.projectName===a.projectName);u>=0&&(i[u]={projectName:i[u].projectName,threads:[a,...i[u].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function UA(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function ba(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function FA(e){const t=e.split(`
|
|
1422
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function BA(){const e=D([]),t=D([]),n=D(bA()),r=D({}),s=D({}),o=D({}),i=D({}),a=D({}),l=D({}),u=D({}),c=D({}),f=D([]),m=D(kA()),T=D("medium"),U=D("standard"),P=D(vA()),F=D(wA()),R=D(TA()),A=D(SA()),B=D({}),W=D({}),ce=D({}),me=D({}),ve=D({}),Ie=D({}),re=D({}),le=D({}),we=D({}),Y=D({}),Te=D([]),xe=D([]),Le=D(!1),Pe=D(!1),Oe=D(!1),Ee=D(!1),Ye=D(!1),Ze=D(!1),Ne=D(""),nt=D(!1),gt=D(!1);let at=null,et=null,Xe=null,K=null,he=!1;const ue=new Set;let be=!1,$e=!1;const g=new Map,b=new Set,x=D(!0),q=fe(()=>Er(e.value)),G=fe(()=>q.value.find(d=>d.id===n.value)??null),N=fe(()=>F.value[n.value]??null),V=fe(()=>{const d=[],h=n.value;return h&&Array.isArray(le.value[h])&&d.push(...le.value[h]),Array.isArray(le.value[js])&&d.push(...le.value[js]),d.sort((v,C)=>v.receivedAtIso.localeCompare(C.receivedAtIso))}),J=fe(()=>{var Z;const d=n.value;if(!d)return null;const h=ve.value[d],v=(o.value[d]??"").trim(),C=(((Z=Ie.value[d])==null?void 0:Z.message)??"").trim();return!h&&!v&&!C?null:{activityLabel:(h==null?void 0:h.label)||"Thinking",activityDetails:(h==null?void 0:h.details)??[],reasoningText:v,errorText:C}}),Q=fe(()=>{const d=n.value;if(!d)return[];const h=r.value[d]??[],v=s.value[d]??[],C=i.value[d]??[],Z=[...h,...C,...v],te=me.value[d];return te?OA(Z,te):Z});function z(d){n.value!==d&&(n.value=d,_A(d),$e=!1)}function _e(d){m.value=d.trim(),va(m.value)}function de(d){x.value=d}async function Se(){m.value=Sn,va(m.value),f.value.includes(Sn)||(f.value=[...f.value,Sn]);try{await L_(Sn)}catch{}}function Me(d,h){we.value={...we.value,[d]:h}}function De(d){we.value[d]&&(we.value=Gt(we.value,d))}async function Fe(d,h){if(!x.value)return;const v=h.trim();if(!v)return;const C=q.value.find(te=>te.id===d);if(!(C!=null&&C.hasWorktree))return;const Z=C.cwd.trim();Z&&(await V_(Z,v),he=!0)}async function He(d,h){var Ae;if(!x.value)return;const v=q.value.find(ke=>ke.id===d);if(!(v!=null&&v.hasWorktree))return;const C=v.cwd.trim();if(!C)return;const te=(r.value[d]??[]).find(ke=>ke.role==="user"&&ke.turnIndex===h),pe=((Ae=te==null?void 0:te.text)==null?void 0:Ae.trim())??"";if(pe){try{await G_(C,pe)}catch(ke){if((ke instanceof Error?ke.message:"").includes("No matching commit found"))return;throw ke}he=!0}}async function ot(d){if(b.has(d))return;const h=we.value[d];if(!(!h||h.fallbackRetried)){b.add(d),Me(d,{...h,fallbackRetried:!0});try{await Se();try{const v=await su(d,1);$t(d,v),Wt(d,[]),E(d),i.value[d]&&(i.value=Gt(i.value,d))}catch{}bt(d,null),Ne.value="",xt(d,null),It(d,{label:"Thinking",details:yt(Sn,h.effort)}),Tt(d,!0),ce.value[d]!==!0&&await ia(d),await aa(d,h.text,h.imageUrls,Sn,h.effort||void 0,h.skills.length>0?h.skills:void 0,h.fileAttachments),ce.value={...ce.value,[d]:!0},kt(),ue.add(d),he=!0,await Jn()}catch(v){const C=v instanceof Error?v.message:"Unknown application error";bt(d,C),Ne.value=C,Tt(d,!1),It(d,null)}finally{b.delete(d)}}}function tt(d){d&&!Fu.includes(d)||(T.value=d)}async function vt(d){const h=d==="fast"?"fast":"standard";if(Ye.value||U.value===h)return;const v=U.value;U.value=h,Ye.value=!0,Ne.value="";try{await j_(h)}catch(C){U.value=v,Ne.value=C instanceof Error?C.message:"Failed to update Fast mode"}finally{Ye.value=!1}}function yt(d,h){const v=d.trim()||"default",C=h||"default",Z=U.value==="fast"?"Fast":"Standard";return[`Model: ${v}`,`Thinking: ${C}`,`Speed: ${Z}`]}async function jt(){try{const[d,h]=await Promise.all([U_(),F_()]);f.value=d,m.value.length>0&&d.includes(m.value)||(h.model&&d.includes(h.model)?m.value=h.model:d.length>0?m.value=d[0]:m.value="",va(m.value)),h.reasoningEffort&&Fu.includes(h.reasoningEffort)&&(T.value=h.reasoningEffort),U.value=h.speedMode}catch{}}async function zt(){if(K){await K;return}K=(async()=>{try{xe.value=lt(await B_())}catch{}finally{K=null}})(),await K}function kt(){if(typeof window>"u"){zt();return}Xe!==null&&window.clearTimeout(Xe),Xe=window.setTimeout(()=>{Xe=null,zt()},mA)}function Rt(d){const h=Y.value;return Object.keys(h).length===0?d:d.map(v=>({projectName:v.projectName,threads:v.threads.map(C=>{const Z=h[C.id];return Z?{...C,title:Z}:C})}))}function wt(){const h=Rt(t.value).map(v=>({projectName:v.projectName,threads:v.threads.map(C=>{const Z=a.value[C.id]===!0,te=n.value===C.id,pe=P.value[C.id],Ae=c.value[C.id]===!0,ke=!te&&!Z&&(Ae||pe!==C.updatedAtIso);return{...C,inProgress:Z,unread:ke}})}));e.value=Oo(e.value,h)}function Dt(d,h,v){const C=new Date().toISOString(),Z=h.trim(),te=UA(Z),pe={id:d,title:FA(v),projectName:te,cwd:Z,hasWorktree:Z.includes("/.codex/worktrees/")||Z.includes("/.git/worktrees/"),createdAtIso:C,updatedAtIso:C,preview:v,unread:!1,inProgress:!1},Ae=t.value.findIndex(y=>y.projectName===te);if(Ae>=0){const M=t.value[Ae].threads.filter(Ve=>Ve.id!==d),ne={projectName:te,threads:[pe,...M]},Ue=[...t.value];Ue.splice(Ae,1,ne),t.value=Ue}else t.value=[{projectName:te,threads:[pe]},...t.value];const ke=Mo(R.value,t.value);Wr(R.value,ke)||(R.value=ke,os(R.value)),wt()}function Qt(d){const h=new Set(d.map(te=>te.id)),v=Zt(P.value,h);v!==P.value&&(P.value=v,Bu(v));const C=Zt(F.value,h);C!==F.value&&(F.value=C,Hu(C)),W.value=Zt(W.value,h),B.value=Zt(B.value,h),ce.value=Zt(ce.value,h),r.value=Zt(r.value,h),s.value=Zt(s.value,h),o.value=Zt(o.value,h),i.value=Zt(i.value,h),me.value=Zt(me.value,h),ve.value=Zt(ve.value,h),Ie.value=Zt(Ie.value,h),re.value=Zt(re.value,h),c.value=Zt(c.value,h),a.value=Zt(a.value,h);const Z={};for(const[te,pe]of Object.entries(le.value))(te===js||h.has(te))&&(Z[te]=pe);le.value=Z}function qt(d){const h=Er(t.value).find(v=>v.id===d);h&&(P.value={...P.value,[d]:h.updatedAtIso},Bu(P.value),c.value[d]&&(c.value=Gt(c.value,d)),wt())}function xt(d,h){if(!d)return;const v=me.value[d];if(h){if(PA(v,h))return;me.value={...me.value,[d]:h}}else v&&(me.value=Gt(me.value,d))}function Tt(d,h){!d||a.value[d]===!0===h||(h?a.value={...a.value,[d]:!0}:a.value=Gt(a.value,d),wt())}function Kt(d){d&&d!==n.value&&c.value[d]!==!0&&(c.value={...c.value,[d]:!0},wt())}function It(d,h){if(!d)return;const v=ve.value[d];if(!h){v&&(ve.value=Gt(ve.value,d));return}const C=qe(h.label)||"Thinking",Z=h.details.map(Ae=>qe(Ae)).filter(Ae=>Ae.length>0&&Ae!==C),te=Array.from(new Set([...(v==null?void 0:v.details)??[],...Z])).slice(-3),pe={label:C,details:te};xA(v,pe)||(ve.value={...ve.value,[d]:pe})}function bt(d,h){if(!d)return;const v=Ie.value[d],C=h?el(h):"";if(!C){v&&(Ie.value=Gt(Ie.value,d));return}(v==null?void 0:v.message)!==C&&(Ie.value={...Ie.value,[d]:{message:C}})}function Jt(d){const h=Er(t.value).find(v=>v.id===d);return(h==null?void 0:h.updatedAtIso)??""}function yn(d,h){if(!d)return;const v={scrollTop:Math.max(0,h.scrollTop),isAtBottom:h.isAtBottom===!0};typeof h.scrollRatio=="number"&&Number.isFinite(h.scrollRatio)&&(v.scrollRatio=Qa(h.scrollRatio,0,1));const C=F.value[d];C&&C.scrollTop===v.scrollTop&&C.isAtBottom===v.isAtBottom&&C.scrollRatio===v.scrollRatio||(F.value={...F.value,[d]:v},Hu(F.value))}function $t(d,h){const v=r.value[d]??[];ai(v,h)||(r.value={...r.value,[d]:h})}function Wt(d,h){const v=s.value[d]??[];ai(v,h)||(s.value={...s.value,[d]:h})}function wn(d,h){const v=s.value[d]??[],C=Wu(v,h);Wt(d,C)}function _(d,h){if(!d)return;const v=h.trim(),C=o.value[d]??"";if(v.length===0){if(!C)return;o.value=Gt(o.value,d);return}C!==v&&(o.value={...o.value,[d]:v})}function S(d,h){if(!d)return;const v=o.value[d]??"";_(d,`${v}${h}`)}function E(d){d&&d in o.value&&(o.value=Gt(o.value,d))}function O(d){return d!==null&&typeof d=="object"&&!Array.isArray(d)?d:null}function H(d){return typeof d=="string"?d:""}function oe(d){return typeof d=="number"&&Number.isFinite(d)?d:null}function Ce(d){var h,v;return((h=d.limitId)==null?void 0:h.trim())||((v=d.limitName)==null?void 0:v.trim())||"__default__"}function ge(d){const h=O(d);return h?{usedPercent:Qa(oe(h.usedPercent)??0,0,100),windowDurationMins:oe(h.windowDurationMins),resetsAt:oe(h.resetsAt)}:null}function Ke(d){const h=O(d);if(!h)return null;const v=O(h.credits);return{limitId:H(h.limitId)||null,limitName:H(h.limitName)||null,primary:ge(h.primary),secondary:ge(h.secondary),credits:v?{hasCredits:v.hasCredits===!0,unlimited:v.unlimited===!0,balance:H(v.balance)||null}:null,planType:H(h.planType)||null}}function lt(d){const h=O(d);if(!h)return[];const v=[],C=new Set,Z=pe=>{if(!pe)return;const Ae=Ce(pe);C.has(Ae)||(C.add(Ae),v.push(pe))};Z(Ke(h.rateLimits));const te=O(h.rateLimitsByLimitId);if(te)for(const pe of Object.values(te))Z(Ke(pe));return v}function rt(d){const h=O(d.params);if(!h)return"";const v=H(h.threadId);if(v)return v;const C=H(h.thread_id);if(C)return C;const Z=H(h.conversationId);if(Z)return Z;const te=H(h.conversation_id);if(te)return te;const pe=O(h.thread),Ae=H(pe==null?void 0:pe.id);if(Ae)return Ae;const ke=O(h.turn),y=H(ke==null?void 0:ke.threadId);if(y)return y;const M=H(ke==null?void 0:ke.thread_id);return M||""}function Nt(d){if(d.method!=="turn/completed")return"";const h=O(d.params),v=O(h==null?void 0:h.turn);if(!v||v.status!=="failed")return"";const C=O(v.error);return H(C==null?void 0:C.message)}function mn(d){var v;if(d.method!=="error")return"";const h=O(d.params);return H(h==null?void 0:h.message)||H((v=O(h==null?void 0:h.error))==null?void 0:v.message)}function Nn(d){const h=O(d);if(!h)return null;const v=h.id,C=H(h.method),Z=h.params;if(typeof v!="number"||!Number.isInteger(v)||!C)return null;const te=O(Z),pe=H(te==null?void 0:te.threadId)||js,Ae=H(te==null?void 0:te.turnId),ke=H(te==null?void 0:te.itemId),y=H(h.receivedAtIso)||new Date().toISOString();return{id:v,method:C,threadId:pe,turnId:Ae,itemId:ke,receivedAtIso:y,params:Z??null}}function j(d){const h=d.threadId||js,v=le.value[h]??[],C=v.findIndex(te=>te.id===d.id),Z=[...v];C>=0?Z.splice(C,1,d):Z.push(d),le.value={...le.value,[h]:Z.sort((te,pe)=>te.receivedAtIso.localeCompare(pe.receivedAtIso))}}function X(d){const h={};for(const[v,C]of Object.entries(le.value)){const Z=C.filter(te=>te.id!==d);Z.length>0&&(h[v]=Z)}le.value=h}function se(d){if(d.method==="server/request"){const h=Nn(d.params);return h&&j(h),!0}if(d.method==="server/request/resolved"){const h=O(d.params),v=h==null?void 0:h.id;return typeof v=="number"&&Number.isInteger(v)&&X(v),!0}return!1}function qe(d){return d.replace(/\s+/gu," ").trim()}function Pt(d){const h=rt(d);if(!h)return null;if(d.method==="turn/started")return{threadId:h,activity:{label:"Thinking",details:[]}};if(d.method==="item/started"){const v=O(d.params),C=O(v==null?void 0:v.item),Z=H(C==null?void 0:C.type).toLowerCase();if(Z==="reasoning")return{threadId:h,activity:{label:"Thinking",details:[]}};if(Z==="agentmessage")return{threadId:h,activity:{label:"Writing response",details:[]}};if(Z==="commandexecution"){const te=H(C==null?void 0:C.command);return{threadId:h,activity:{label:"Running command",details:te?[te]:[]}}}}return d.method==="item/commandExecution/outputDelta"?{threadId:h,activity:{label:"Running command",details:[]}}:d.method==="item/reasoning/summaryTextDelta"||d.method==="item/reasoning/summaryPartAdded"?{threadId:h,activity:{label:"Thinking",details:[]}}:d.method==="item/agentMessage/delta"?{threadId:h,activity:{label:"Writing response",details:[]}}:null}function bn(d){if(d.method!=="turn/started")return null;const h=O(d.params);if(!h)return null;const v=rt(d);if(!v)return null;const C=O(h.turn),Z=H(C==null?void 0:C.id)||H(h.turnId)||`${v}:unknown`;if(!Z)return null;const te=Tr(H(C==null?void 0:C.startedAt))??Tr(H(h.startedAt))??Tr(d.atIso)??Date.now();return{threadId:v,turnId:Z,startedAtMs:te}}function _n(d){if(d.method!=="turn/completed")return null;const h=O(d.params);if(!h)return null;const v=rt(d);if(!v)return null;const C=O(h.turn),Z=H(C==null?void 0:C.id)||H(h.turnId)||`${v}:unknown`;if(!Z)return null;const te=Tr(H(C==null?void 0:C.completedAt))??Tr(H(h.completedAt))??Tr(d.atIso)??Date.now(),pe=Tr(H(C==null?void 0:C.startedAt))??Tr(H(h.startedAt))??void 0;return{threadId:v,turnId:Z,completedAtMs:te,startedAtMs:pe}}function an(d){return`${d}:live-reasoning`}function Vt(d){const h=O(d.params);if(!h)return"";if(d.method==="item/started"){const v=O(h.item);return!v||v.type!=="reasoning"?"":H(v.id)}return""}function Dn(d){const h=O(d.params);if(!h)return null;if(d.method==="item/reasoning/summaryTextDelta"){const v=H(h.itemId),C=H(h.delta);return!v||!C?null:{messageId:an(v),delta:C}}return null}function I(d){const h=O(d.params);if(!h)return"";if(d.method==="item/reasoning/summaryPartAdded"){const v=H(h.itemId);return v?an(v):""}return""}function $(d){const h=O(d.params);if(!h)return"";if(d.method==="item/completed"){const v=O(h.item);return!v||v.type!=="reasoning"?"":an(H(v.id))}return""}function L(d){const h=O(d.params);if(!h)return"";if(d.method==="item/started"){const v=O(h.item);return!v||v.type!=="agentMessage"?"":H(v.id)}return""}function ee(d){const h=O(d.params);if(!h)return null;if(d.method==="item/agentMessage/delta"){const v=H(h.itemId),C=H(h.delta);return!v||!C?null:{messageId:v,delta:C}}return null}function Ge(d){const h=O(d.params);if(!h)return null;if(d.method==="item/completed"){const v=O(h.item);if(!v||v.type!=="agentMessage")return null;const C=H(v.id),Z=H(v.text);return!C||!Z?null:{id:C,role:"assistant",text:Z,messageType:"agentMessage.live"}}return null}function Ut(d){if(d.method!=="item/started")return null;const h=O(d.params),v=O(h==null?void 0:h.item);if(!v||v.type!=="commandExecution")return null;const C=H(v.id),Z=H(v.command);if(!C)return null;const te=typeof v.cwd=="string"?v.cwd:null;return{id:C,role:"system",text:Z,messageType:"commandExecution",commandExecution:{command:Z,cwd:te,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function gn(d){if(d.method!=="item/commandExecution/outputDelta")return null;const h=O(d.params);if(!h)return null;const v=H(h.itemId),C=H(h.delta);return!v||!C?null:{itemId:v,delta:C}}function Xr(d){if(d.method!=="item/completed")return null;const h=O(d.params),v=O(h==null?void 0:h.item);if(!v||v.type!=="commandExecution")return null;const C=H(v.id),Z=H(v.command);if(!C)return null;const te=typeof v.cwd=="string"?v.cwd:null,pe=H(v.status),Ae=pe==="failed"?"failed":pe==="declined"?"declined":pe==="interrupted"?"interrupted":"completed",ke=typeof v.aggregatedOutput=="string"?v.aggregatedOutput:"",y=typeof v.exitCode=="number"?v.exitCode:null;return{id:C,role:"system",text:Z,messageType:"commandExecution",commandExecution:{command:Z,cwd:te,status:Ae,aggregatedOutput:ke,exitCode:y}}}function gr(d,h){const v=i.value[d]??[],C=Wu(v,h);C!==v&&(i.value={...i.value,[d]:C})}function kn(d,h){const v=i.value[d];if(!v||v.length===0)return;const C=new Set(h.map(te=>te.id)),Z=v.filter(te=>!C.has(te.id));Z.length!==v.length&&(Z.length===0?i.value=Gt(i.value,d):i.value={...i.value,[d]:Z})}function vr(d){if(d.method==="item/agentMessage/delta")return!0;const h=O(d.params);if(!h)return!1;if(d.method==="item/completed"){const v=O(h.item);return(v==null?void 0:v.type)==="agentMessage"}return!1}function Qr(d){var Ms,rs,Ul,Fl,Bl;if(se(d))return;if(d.method==="account/rateLimits/updated"&&kt(),d.method==="thread/name/updated"){const Qe=O(d.params),En=H(Qe==null?void 0:Qe.threadId),wr=H(Qe==null?void 0:Qe.threadName);En&&wr&&(Y.value={...Y.value,[En]:wr},wt(),la(En,wr))}const h=Pt(d);h&&It(h.threadId,h.activity);const v=bn(d);v&&(g.set(v.turnId,v),re.value={...re.value,[v.threadId]:v.turnId},xt(v.threadId,null),bt(v.threadId,null),Tt(v.threadId,!0),c.value[v.threadId]&&(c.value=Gt(c.value,v.threadId)));const C=_n(d),Z=Nt(d),pe=!!((C==null?void 0:C.threadId)??rt(d))&&!!Z&&m.value!==Sn&&$o(new Error(Z));if(C){const Qe=we.value[C.threadId],En=g.get(C.turnId);En&&g.delete(C.turnId);const wr=oe((Ms=O(d.params))==null?void 0:Ms.durationMs)??oe((Ul=O((rs=O(d.params))==null?void 0:rs.turn))==null?void 0:Ul.durationMs)??(typeof C.startedAtMs=="number"?C.completedAtMs-C.startedAtMs:null)??(En?C.completedAtMs-En.startedAtMs:null),Ch=typeof wr=="number"?Math.max(0,wr):0;if(xt(C.threadId,{turnId:C.turnId,durationMs:Ch}),re.value[C.threadId]&&(re.value=Gt(re.value,C.threadId)),Tt(C.threadId,!1),It(C.threadId,null),Kt(C.threadId),pe||(De(C.threadId),So(C.threadId)),!Z&&!pe){const Ah=((Fl=Qe==null?void 0:Qe.text)==null?void 0:Fl.trim())||gA;Fe(C.threadId,Ah).catch(()=>{})}}if(Z){const Qe=(C==null?void 0:C.threadId)||rt(d);Qe&&bt(Qe,Z),Ne.value=Z,Qe&&pe&&ot(Qe)}else C&&bt(C.threadId,null);const Ae=mn(d);if(Ae){const Qe=rt(d);Qe&&bt(Qe,Ae),Ne.value=Ae,m.value!==Sn&&$o(new Error(Ae))&&(Qe?ot(Qe):Se())}const ke=rt(d);if(!ke||ke!==n.value)return;L(d);const y=ee(d);if(y){const Qe=(s.value[ke]??[]).find(wr=>wr.id===y.messageId),En=`${(Qe==null?void 0:Qe.text)??""}${y.delta}`;wn(ke,{id:y.messageId,role:"assistant",text:En,messageType:"agentMessage.live"})}const M=Ge(d);M&&wn(ke,M),Vt(d);const ne=Dn(d);if(ne&&S(ke,ne.delta),I(d)){const Qe=o.value[ke]??"";Qe.trim().length>0&&!Qe.endsWith(`
|
|
1423
|
+
|
|
1424
|
+
`)&&_(ke,`${Qe}
|
|
1425
|
+
|
|
1426
|
+
`)}$(d);const Ve=Ut(d);Ve&&(gr(ke,Ve),It(ke,{label:"Running command",details:[((Bl=Ve.commandExecution)==null?void 0:Bl.command)??""]}));const je=gn(d);if(je){const Qe=(i.value[ke]??[]).find(En=>En.id===je.itemId);Qe!=null&&Qe.commandExecution&&gr(ke,{...Qe,commandExecution:{...Qe.commandExecution,aggregatedOutput:`${Qe.commandExecution.aggregatedOutput}${je.delta}`}})}const Lt=Xr(d);if(Lt&&gr(ke,Lt),vr(d)&&($e&&n.value&&yn(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),E(ke)),d.method==="turn/completed"){$e=!1,E(ke),i.value[ke]&&(i.value=Gt(i.value,ke));const Qe=rt(d);Qe&&(Tt(Qe,!1),It(Qe,null),Kt(Qe),pe||(De(Qe),So(Qe)))}}function Cs(d){const h=rt(d);h&&ue.add(h);const v=d.method;(v.startsWith("thread/")||v.startsWith("turn/")||v.startsWith("item/"))&&(he=!0),!(et!==null||typeof window>"u")&&(et=window.setTimeout(()=>{et=null,Jn()},ga))}async function Ai(d){if(!be){be=!0;try{const h=await Fa(),v=[];for(const C of h.order){const Z=ba(C);v.includes(Z)||v.push(Z)}if(v.length>0){const C=Mo(v,d);Wr(R.value,C)||(R.value=C,os(R.value))}if(Object.keys(h.labels).length>0){const C={...A.value};let Z=!1;for(const[te,pe]of Object.entries(h.labels)){const Ae=ba(te);C[Ae]!==pe&&(C[Ae]=pe,Z=!0)}Z&&(A.value=C,ya(C))}}catch{}}}async function Zr(){if(!(Object.keys(Y.value).length>0))try{const d=await Q_();Object.keys(d.titles).length>0&&(Y.value=d.titles)}catch{}}async function bo(d,h,v){if(Y.value[d])return;const C=h.trim();if(!C)return;const Z=C.length>300?C.slice(0,300):C;try{const te=await Z_(Z,v);if(!te||Y.value[d])return;Y.value={...Y.value,[d]:te},wt(),la(d,te)}catch{}}async function As(){var d;gt.value||(Le.value=!0);try{const[h]=await Promise.all([C_(),Zr()]);await Ai(h);const v=Mo(R.value,h);Wr(R.value,v)||(R.value=v,os(R.value));const C=wa(h,R.value),Z=jA(t.value,C,a.value);t.value=Oo(t.value,Z),a.value=Zt(a.value,new Set(Er(t.value).map(Ae=>Ae.id))),wt(),gt.value=!0;const te=Er(e.value);Qt(te),te.some(Ae=>Ae.id===n.value)||z(((d=te[0])==null?void 0:d.id)??"")}finally{Le.value=!1}}async function yr(d,h={}){if(!d)return;const v=W.value[d]===!0,C=h.silent!==!0&&!v;C&&(Pe.value=!0);try{ce.value[d]!==!0&&(await ia(d),ce.value={...ce.value,[d]:!0});const{messages:Z,inProgress:te}=await A_(d),pe=r.value[d]??[],Ae=CA(pe,Z,{preserveMissing:h.silent===!0});$t(d,Ae);const ke=s.value[d]??[],y=AA(ke,Z);Wt(d,y),kn(d,Z),W.value={...W.value,[d]:!0};const M=Jt(d);M&&(B.value={...B.value,[d]:M}),Tt(d,te),qt(d)}finally{C&&(Pe.value=!1)}}async function Rs(){try{const d=t.value.flatMap(h=>h.threads.map(v=>v.cwd)).filter(Boolean);Te.value=await ek(d.length>0?[...new Set(d)]:void 0)}catch{}}async function _o(){Ne.value="";try{await As(),await Promise.all([jt(),zt(),Rs()]),await yr(n.value)}catch(d){Ne.value=d instanceof Error?d.message:"Unknown application error"}}async function es(d){z(d);try{await yr(d)}catch(h){Ne.value=h instanceof Error?h.message:"Unknown application error"}}async function Ri(d){try{await M_(d),await As(),n.value===d&&await yr(n.value)}catch(h){Ne.value=h instanceof Error?h.message:"Unknown application error"}}async function ko(d,h){const v=h.trim();if(!(!d||!v))try{await $_(d,v),Y.value={...Y.value,[d]:v},wt(),la(d,v)}catch(C){Ne.value=C instanceof Error?C.message:"Unknown application error"}}async function Ps(d,h=[],v=[],C="steer",Z=[],te){if(Ye.value)return;const pe=n.value,Ae=d.trim();if(!pe||!Ae&&h.length===0&&Z.length===0)return;const ke=a.value[pe]===!0;if(ke&&C==="queue"){const y=l.value[pe]??[],M=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,ne=[...y],Ue=typeof te=="number"?Math.max(0,Math.min(te,ne.length)):ne.length;ne.splice(Ue,0,{id:M,text:Ae,imageUrls:h,skills:v,fileAttachments:Z}),l.value={...l.value,[pe]:ne};return}if(ke){$e=!0,ts(pe,Ae,h,v,Z).catch(y=>{const M=y instanceof Error?y.message:"Unknown application error";bt(pe,M),Ne.value=M});return}Ne.value="",$e=!0,xt(pe,null),It(pe,{label:"Thinking",details:yt(m.value,T.value)}),bt(pe,null),Tt(pe,!0);try{await ts(pe,Ae,h,v,Z)}catch(y){$e=!1,Tt(pe,!1),It(pe,null);const M=y instanceof Error?y.message:"Unknown application error";throw bt(pe,M),Ne.value=M,y}}async function To(d,h,v=[],C=[],Z=[]){if(Ye.value)return"";const te=d.trim(),pe=h.trim(),Ae=m.value.trim();if(!te&&v.length===0&&Z.length===0)return"";Oe.value=!0,Ne.value="";let ke="";try{try{ke=await ou(pe||void 0,Ae||void 0)}catch(Ue){if(Ae&&Ae!==Sn&&$o(Ue))await Se(),ke=await ou(pe||void 0,Sn);else throw Ue}if(!ke)return"";Dt(ke,pe,te||"[Image]"),ce.value={...ce.value,[ke]:!0},z(ke),$e=!0,xt(ke,null),It(ke,{label:"Thinking",details:yt(m.value,T.value)}),bt(ke,null),Tt(ke,!0);const y=ke,M=pe||null,ne=te;return ts(ke,te,v,C,Z).catch(Ue=>{$e=!1,Tt(ke,!1),It(ke,null);const Ve=Ue instanceof Error?Ue.message:"Unknown application error";bt(ke,Ve),Ne.value=Ve}).finally(()=>{Oe.value=!1}),bo(y,ne,M),ke}catch(y){$e=!1,ke&&(Tt(ke,!1),It(ke,null));const M=y instanceof Error?y.message:"Unknown application error";throw ke&&bt(ke,M),Ne.value=M,Oe.value=!1,y}}async function ts(d,h,v=[],C=[],Z=[]){const te=m.value.trim(),pe=T.value,Ae=h.trim(),ke=C.map(M=>({name:M.name,path:M.path})),y=Z.map(M=>({...M}));Me(d,{text:Ae,imageUrls:[...v],skills:ke,fileAttachments:y,effort:pe,fallbackRetried:!1});try{ce.value[d]!==!0&&await ia(d);try{await aa(d,h,v,te||void 0,pe||void 0,C.length>0?C:void 0,Z)}catch(M){if(te&&te!==Sn&&$o(M))await Se(),Me(d,{text:Ae,imageUrls:[...v],skills:ke,fileAttachments:y,effort:pe,fallbackRetried:!0}),await aa(d,h,v,Sn,pe||void 0,C.length>0?C:void 0,Z);else throw M}ce.value={...ce.value,[d]:!0},ue.add(d),he=!0,await Jn()}catch(M){throw M}}async function So(d){if(u.value[d]===!0)return;const h=l.value[d];if(!h||h.length===0)return;u.value={...u.value,[d]:!0};const[v,...C]=h;l.value=C.length>0?{...l.value,[d]:C}:Gt(l.value,d),Oe.value=!0,Ne.value="",$e=!0,xt(d,null),It(d,{label:"Thinking",details:yt(m.value,T.value)}),bt(d,null),Tt(d,!0);try{await ts(d,v.text,v.imageUrls,v.skills,v.fileAttachments)}catch{Tt(d,!1),It(d,null)}finally{u.value=Gt(u.value,d),Oe.value=!1}}async function Pi(){const d=n.value;if(!d||a.value[d]!==!0)return;const h=re.value[d];Ee.value=!0,Ne.value="";try{await D_(d,h),Tt(d,!1),It(d,null),bt(d,null),re.value[d]&&(re.value=Gt(re.value,d)),ue.add(d),he=!0,await Jn()}catch(v){const C=v instanceof Error?v.message:"Failed to interrupt active turn";bt(d,C),Ne.value=C}finally{Ee.value=!1}}async function xi(d){const h=n.value;if(!h||Ze.value)return;const C=(r.value[h]??[]).reduce((te,pe)=>typeof pe.turnIndex=="number"&&pe.turnIndex>te?pe.turnIndex:te,-1);if(C<0||d>C)return;const Z=C-d+1;if(!(Z<1)){Ze.value=!0,Ne.value="";try{await He(h,d);const te=await su(h,Z);$t(h,te),Wt(h,[]),E(h),i.value[h]&&(i.value=Gt(i.value,h)),xt(h,null),It(h,null),bt(h,null),he=!0,await Jn()}catch(te){Ne.value=te instanceof Error?te.message:"Failed to rollback thread"}finally{Ze.value=!1}}}function Mi(d,h){d.length===0||(A.value[d]??"")===h||(A.value={...A.value,[d]:h},ya(A.value))}function $i(d){var Z;if(d.length===0)return;const h=R.value.filter(te=>te!==d);if(Wr(R.value,h)||(R.value=h,os(R.value)),t.value=t.value.filter(te=>te.projectName!==d),A.value[d]!==void 0){const te={...A.value};delete te[d],A.value=te,ya(te)}wt();const v=Er(e.value);Qt(v),v.some(te=>te.id===n.value)||z(((Z=v[0])==null?void 0:Z.id)??""),xs()}function ns(d,h){if(d.length===0||t.value.length===0)return;const v=t.value.map(ke=>ke.projectName),C=v.indexOf(d);if(C===-1)return;const Z=Math.max(0,Math.min(h,v.length-1)),te=IA(v,C,Z);if(te===v)return;const pe=Mo(te,t.value);R.value=pe,os(R.value);const Ae=wa(t.value,R.value);t.value=Oo(t.value,Ae),wt(),xs()}function Oi(d){const h=d.trim();if(!h)return;const v=[h,...R.value.filter(Z=>Z!==h)];if(Wr(R.value,v))return;R.value=v,os(R.value);const C=wa(t.value,R.value);t.value=Oo(t.value,C),wt(),xs()}async function xs(){var d,h;try{const v=await Fa(),C=new Map;for(const pe of v.order){const Ae=ba(pe);C.has(Ae)||C.set(Ae,pe)}for(const pe of t.value){const Ae=((h=(d=pe.threads[0])==null?void 0:d.cwd)==null?void 0:h.trim())??"";Ae&&C.set(pe.projectName,Ae)}const Z=[];for(const pe of R.value){const Ae=C.get(pe);Ae&&!Z.includes(Ae)&&Z.push(Ae)}for(const pe of v.order)Z.includes(pe)||Z.push(pe);const te=v.active.filter(pe=>Z.includes(pe));te.length===0&&Z.length>0&&te.push(Z[0]),await z_({order:Z,labels:v.labels,active:te})}catch{}}async function Jn(){if(nt.value){typeof window<"u"&&et===null&&(et=window.setTimeout(()=>{et=null,Jn()},ga));return}nt.value=!0;const d=he,h=new Set(ue);he=!1,ue.clear();try{d&&await As();const v=n.value;if(!v)return;const C=h.has(v),Z=a.value[v]===!0,te=Jt(v),pe=B.value[v]??"",Ae=te.length>0&&te!==pe;(C||Z||Ae||d)&&await yr(v,{silent:!0})}catch{}finally{nt.value=!1,(he||ue.size>0)&&typeof window<"u"&&et===null&&(et=window.setTimeout(()=>{et=null,Jn()},ga))}}function Ni(){typeof window>"u"||at||(Di(),at=R_(d=>{Qr(d),Cs(d)}))}async function Di(){try{const d=await x_();for(const h of d){const v=Nn(h);v&&j(v)}}catch{}}async function Li(d){try{await P_(d.id,{result:d.result,error:d.error}),X(d.id)}catch(h){Ne.value=h instanceof Error?h.message:"Failed to reply to server request"}}function ji(){at&&(at(),at=null),he=!1,ue.clear(),g.clear(),et!==null&&typeof window<"u"&&(window.clearTimeout(et),et=null),Xe!==null&&typeof window<"u"&&(window.clearTimeout(Xe),Xe=null),$e=!1,r.value={},s.value={},o.value={},i.value={},ve.value={},me.value={},Ie.value={},re.value={},l.value={},u.value={}}const Ui=fe(()=>{const d=n.value;return d?l.value[d]??[]:[]});function Io(d){const h=n.value;if(!h)return;const v=l.value[h];if(!v)return;const C=v.filter(Z=>Z.id!==d);l.value=C.length>0?{...l.value,[h]:C}:Gt(l.value,h)}function Fi(d){const h=n.value;if(!h)return;const v=l.value[h];if(!v)return;const C=v.find(Z=>Z.id===d);C&&(Io(d),Ps(C.text,C.imageUrls,C.skills,"steer",C.fileAttachments))}return{projectGroups:e,projectDisplayNameById:A,selectedThread:G,selectedThreadScrollState:N,selectedThreadServerRequests:V,selectedLiveOverlay:J,selectedThreadId:n,availableModelIds:f,selectedModelId:m,selectedReasoningEffort:T,selectedSpeedMode:U,installedSkills:Te,accountRateLimitSnapshots:xe,messages:Q,isLoadingThreads:Le,isLoadingMessages:Pe,isSendingMessage:Oe,isInterruptingTurn:Ee,isUpdatingSpeedMode:Ye,error:Ne,refreshAll:_o,refreshSkills:Rs,selectThread:es,setThreadScrollState:yn,archiveThreadById:Ri,renameThreadById:ko,sendMessageToSelectedThread:Ps,sendMessageToNewThread:To,interruptSelectedThreadTurn:Pi,rollbackSelectedThread:xi,isRollingBack:Ze,selectedThreadQueuedMessages:Ui,removeQueuedMessage:Io,steerQueuedMessage:Fi,setSelectedModelId:_e,setWorktreeGitAutomationEnabled:de,setSelectedReasoningEffort:tt,updateSelectedSpeedMode:vt,respondToPendingServerRequest:Li,renameProject:Mi,removeProject:$i,reorderProject:ns,pinProjectToTop:Oi,startPolling:Ni,stopPolling:ji}}const HA={class:"sidebar-root"},WA={class:"sidebar-scrollable"},VA=["aria-pressed"],GA={key:1,class:"sidebar-search-bar"},zA={key:0,class:"sidebar-settings-area"},qA={key:0,class:"sidebar-settings-panel"},KA=["title"],JA=["title"],YA={class:"sidebar-settings-value"},XA=["title"],QA={class:"sidebar-settings-value"},ZA=["title"],e1=["title"],t1=["title"],n1=["title"],r1={class:"sidebar-settings-rate-limits"},s1={class:"content-root"},o1={class:"content-body"},i1={key:1,class:"content-grid"},a1={class:"new-thread-empty"},l1={class:"worktree-init-status-title"},c1={class:"worktree-init-status-message"},u1={class:"new-thread-trending"},d1={class:"new-thread-trending-header"},f1={key:0,class:"new-thread-trending-empty"},h1={key:1,class:"new-thread-trending-empty"},p1={key:2,class:"new-thread-trending-list"},m1=["onClick"],g1={class:"new-thread-trending-tip-name"},v1={class:"new-thread-trending-tip-meta"},y1={class:"new-thread-trending-tip-description"},w1={key:2,class:"content-grid"},b1={class:"content-thread"},_1={class:"composer-with-queue"},k1={class:"build-badge","aria-label":"Worktree name and version"},Vu="codex-web-local.sidebar-collapsed.v1",Gu="codex-web-local.send-with-enter.v1",zu="codex-web-local.in-progress-send-mode.v1",qu="codex-web-local.dark-mode.v1",Ku="codex-web-local.dictation-click-to-toggle.v1",Ju="codex-web-local.dictation-auto-send.v1",Yu="codex-web-local.dictation-language.v1",Xu="codex-web-local.worktree-git-automation.v1",T1=Ht({__name:"App",setup(e){const t="86af",n="0.1.49",r={sendWithEnter:"When enabled, press Enter to send. When disabled, use Command+Enter to send.",inProgressSendMode:"If a turn is still running, choose whether a new prompt should steer the current turn or be queued.",appearance:"Switch between system theme, light mode, and dark mode.",dictationClickToToggle:"Use click-to-start and click-to-stop dictation instead of hold-to-talk.",dictationAutoSend:"Automatically send transcribed dictation when recording stops.",worktreeRollback:"When enabled, each message creates a Git commit. On rollback, it runs Git reset to the commit for that message.",dictationLanguage:"Choose transcription language or keep auto-detect."},s={en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese",yue:"cantonese"},{projectGroups:o,projectDisplayNameById:i,selectedThread:a,selectedThreadScrollState:l,selectedThreadServerRequests:u,selectedLiveOverlay:c,selectedThreadId:f,availableModelIds:m,selectedModelId:T,selectedReasoningEffort:U,selectedSpeedMode:P,installedSkills:F,accountRateLimitSnapshots:R,messages:A,isLoadingThreads:B,isLoadingMessages:W,isInterruptingTurn:ce,isUpdatingSpeedMode:me,refreshAll:ve,refreshSkills:Ie,selectThread:re,setThreadScrollState:le,archiveThreadById:we,renameThreadById:Y,sendMessageToSelectedThread:Te,sendMessageToNewThread:xe,interruptSelectedThreadTurn:Le,rollbackSelectedThread:Pe,isRollingBack:Oe,selectedThreadQueuedMessages:Ee,removeQueuedMessage:Ye,steerQueuedMessage:Ze,setSelectedModelId:Ne,setWorktreeGitAutomationEnabled:nt,setSelectedReasoningEffort:gt,updateSelectedSpeedMode:at,respondToPendingServerRequest:et,renameProject:Xe,removeProject:K,reorderProject:he,pinProjectToTop:ue,startPolling:be,stopPolling:$e}=BA(),g=dv(),b=uv(),{isMobile:x}=Cf(),q=D(null),G=D(null),N=D([]),V=D(!1),J=D("trending-daily"),Q=D(null),z=D(!1),_e=D(!1),de=D(""),Se=D("local"),Me=D({order:[],labels:{}}),De=D({phase:"idle",title:"",message:""}),Fe=D(C()),He=D(""),ot=D(!1),tt=D(null),vt=D(null);let yt=null;const jt=D("New Project (1)"),zt=D(""),kt=D(!1),Rt=D(ns(Gu,!0)),wt=D(xs()),Dt=D(Oi()),Qt=D(ns(Ku,!1)),qt=D(null);let xt=0;const Tt=D(ns(Ju,!0)),Kt=D(Fi()),It=fe(()=>d()),bt=D(ns(Xu,!0)),Jt=fe(()=>{const y=g.params.threadId;return typeof y=="string"?y:""}),yn=fe(()=>{const y=new Set;for(const M of o.value)for(const ne of M.threads)y.add(ne.id);return y}),$t=fe(()=>g.name==="home"),Wt=fe(()=>g.name==="skills"),wn=fe(()=>{var y;return Wt.value?"Skills":$t.value?"New thread":((y=a.value)==null?void 0:y.title)??"Choose a thread"}),_=fe(()=>A.value.filter(y=>{const M=te(y.messageType,y.role);return M==="worked"?!0:!(M==="turnActivity.live"||M==="turnError.live"||M==="agentReasoning.live")})),S=fe(()=>{let y=-1;for(const M of A.value)M.role==="user"&&typeof M.turnIndex=="number"&&M.turnIndex>y&&(y=M.turnIndex);return y}),E=fe(()=>c.value),O=fe(()=>$t.value?"__new-thread__":f.value),H=fe(()=>{var y,M;return $t.value?de.value.trim():((M=(y=a.value)==null?void 0:y.cwd)==null?void 0:M.trim())??""}),oe=fe(()=>{var y;return!$t.value&&((y=a.value)==null?void 0:y.inProgress)===!0}),Ce=fe(()=>{var Ue,Ve;const y=[],M=new Set;for(const je of Me.value.order){const Lt=je.trim();!Lt||M.has(Lt)||(M.add(Lt),y.push({value:Lt,label:Me.value.labels[Lt]||es(Lt)}))}for(const je of o.value){const Lt=((Ve=(Ue=je.threads[0])==null?void 0:Ue.cwd)==null?void 0:Ve.trim())??"";!Lt||M.has(Lt)||(M.add(Lt),y.push({value:Lt,label:i.value[je.projectName]??je.projectName}))}const ne=de.value.trim();return ne&&!M.has(ne)&&y.unshift({value:ne,label:es(ne)}),y}),ge=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Ke=fe(()=>[{value:"search-daily",label:"Search daily"},{value:"search-weekly",label:"Search weekly"},{value:"search-monthly",label:"Search monthly"},{value:"trending-daily",label:"Trending daily"},{value:"trending-weekly",label:"Trending weekly"},{value:"trending-monthly",label:"Trending monthly"}]);pr(()=>{window.addEventListener("keydown",L),v(),ge==null||ge.addEventListener("change",v),pe(),Qr(),As(),yr(),Zr(),Rs()}),vi(()=>{window.removeEventListener("keydown",L),ge==null||ge.removeEventListener("change",v),yt&&(clearTimeout(yt),yt=null),$e()}),ut(He,y=>{const M=y.trim();if(yt&&(clearTimeout(yt),yt=null),!M){vt.value=null;return}yt=setTimeout(()=>{J_(M,1e3).then(ne=>{He.value.trim()===M&&(vt.value=ne.threadIds)}).catch(()=>{He.value.trim()===M&&(vt.value=null)})},220)});function lt(){Ie()}function rt(){ot.value=!ot.value,ot.value?Yt(()=>{var y;return(y=tt.value)==null?void 0:y.focus()}):He.value=""}function Nt(){var y;He.value="",(y=tt.value)==null||y.focus()}function mn(y){y.key==="Escape"&&(ot.value=!1,He.value="")}function Nn(y){y&&(g.name==="thread"&&Jt.value===y||(b.push({name:"thread",params:{threadId:y}}),x.value&&$(!0)))}async function j(y){y&&(f.value!==y&&(await re(y),await b.push({name:"thread",params:{threadId:y}})),await Yt(),Pi())}function X(y){we(y)}function se(y){var Ue,Ve;const M=o.value.find(je=>je.projectName===y),ne=((Ve=(Ue=M==null?void 0:M.threads[0])==null?void 0:Ue.cwd)==null?void 0:Ve.trim())??"";ne&&(de.value=ne),x.value&&$(!0),!$t.value&&b.push({name:"home"})}function qe(y){var Ue,Ve;const M=o.value.find(je=>je.projectName===y),ne=((Ve=(Ue=M==null?void 0:M.threads[0])==null?void 0:Ue.cwd)==null?void 0:Ve.trim())??"";!ne||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(ne)}`,"_blank","noopener,noreferrer")}function Pt(){var M,ne;const y=((ne=(M=a.value)==null?void 0:M.cwd)==null?void 0:ne.trim())??"";y&&(de.value=y),x.value&&$(!0),!$t.value&&b.push({name:"home"})}function bn(y){Xe(y.projectName,y.displayName)}function _n(y){Y(y.threadId,y.title)}function an(y){K(y)}function Vt(y){he(y.projectName,y.toIndex)}function Dn(y){le(y.threadId,y.state)}function I(y){et(y)}function $(y){Fe.value!==y&&(Fe.value=y,Z(y))}function L(y){y.defaultPrevented||!y.ctrlKey&&!y.metaKey||y.shiftKey||y.altKey||y.key.toLowerCase()==="b"&&(y.preventDefault(),$(!Fe.value))}function ee(y){const M=y.text,ne=Q.value,Ue=y.mode==="queue"&&ne&&ne.threadId===f.value?ne.queueIndex:void 0;if(Q.value=null,$t.value){ke(M,y.imageUrls,y.skills,y.fileAttachments);return}if(y.rollbackLatestUserTurn===!0){gr(y);return}Te(M,y.imageUrls,y.skills,y.mode,y.fileAttachments,Ue)}function Ge(y){const M=new Intl.NumberFormat().format(y.stars);return y.language?`${y.language} · ★ ${M}`:`★ ${M}`}function Ut(y){const ne=new Set(["search-daily","search-weekly","search-monthly","trending-daily","trending-weekly","trending-monthly"]).has(y)?y:"trending-daily";J.value!==ne&&(J.value=ne)}function gn(y){const M=q.value;M&&M.hydrateDraft({text:`Clone and run github repo ${y.url}`,imageUrls:[],fileAttachments:[],skills:[]})}function Xr(y){const M=Ee.value.findIndex(je=>je.id===y),ne=M>=0?Ee.value[M]:void 0,Ue=G.value;if(!ne||!Ue||Ue.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Q.value=f.value?{threadId:f.value,queueIndex:M}:null;const Ve={text:ne.text,imageUrls:[...ne.imageUrls],fileAttachments:ne.fileAttachments.map(je=>({...je})),skills:ne.skills.map(je=>({...je}))};Ue.hydrateDraft(Ve),Ye(y)}async function gr(y){oe.value&&await Le();const M=S.value;M>=0&&await Pe(M),await Te(y.text,y.imageUrls,y.skills,"steer",y.fileAttachments)}function kn(y){de.value=y.trim()}async function vr(y){const M=y.trim();if(!M)return;const ne=Ai(M),Ue=await Cs(),Ve=ne?M:Ri(Ue,M);if(Ve)try{const je=await au(Ve,{createIfMissing:!ne,label:ne?"":M});je&&(de.value=je,ue(es(je)),yr(),Zr())}catch{}}async function Qr(){var M;if(typeof window>"u")return;const y=((M=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:M.trim())??"";if(y)try{const ne=await au(y,{createIfMissing:!1,label:""});if(!ne)return;de.value=ne,ue(es(ne)),await b.replace({name:"home"}),await yr();const Ue=new URL(window.location.href);Ue.searchParams.delete("openProjectPath"),window.history.replaceState({},"",Ue.toString())}catch{}}async function Cs(){const y=bo();if(y)return y;try{const M=await iu();if(M)return zt.value=M,M}catch{}return""}function Ai(y){return y?y.startsWith("~/")||y.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(y):!1}async function Zr(){const y=bo();if(!y){jt.value="New Project (1)";return}try{const M=await q_(y);jt.value=M.name||"New Project (1)"}catch{jt.value="New Project (1)"}}function bo(){var ne,Ue;const y=de.value.trim();if(y)return _o(y);const M=((Ue=(ne=Ce.value[0])==null?void 0:ne.value)==null?void 0:Ue.trim())??"";return M?_o(M):zt.value.trim()}async function As(){try{zt.value=await iu()}catch{zt.value=""}}async function yr(){try{const y=await Fa();Me.value={order:[...y.order],labels:{...y.labels}}}catch{Me.value={order:[],labels:{}}}}async function Rs(){V.value=!0;try{N.value=await X_(J.value,6)}catch{N.value=[]}finally{V.value=!1}}function _o(y){const M=y.trim().replace(/\/+$/,"");if(!M)return"";const ne=M.lastIndexOf("/");return ne<=0?"":M.slice(0,ne)}function es(y){const M=y.trim().replace(/\/+$/,"");if(!M)return"";const ne=M.lastIndexOf("/");return ne<0?M:M.slice(ne+1)}function Ri(y,M){const ne=y.trim().replace(/\/+$/,""),Ue=M.trim().replace(/^\/+/,"");return!ne||!Ue?"":`${ne}/${Ue}`}function ko(y){Ne(y)}function Ps(y){gt(y)}function To(y){at(y)}function ts(){Le()}function So(y){var ne;const M=((ne=y.prependText)==null?void 0:ne.trim())??"";M.length>0&&(xt+=1,qt.value={id:xt,text:M}),Pe(y.turnIndex)}function Pi(){if($t.value||Wt.value||typeof document>"u"||!a.value||_.value.length===0)return;const y=xi(),M=Mi(),ne=new Blob([y],{type:"text/markdown;charset=utf-8"}),Ue=URL.createObjectURL(ne),Ve=document.createElement("a");Ve.href=Ue,Ve.download=M,document.body.appendChild(Ve),Ve.click(),document.body.removeChild(Ve),window.setTimeout(()=>URL.revokeObjectURL(Ue),0)}function xi(){var ne,Ue,Ve;const y=[],M=((Ue=(ne=a.value)==null?void 0:ne.title)==null?void 0:Ue.trim())||"Untitled thread";y.push(`# ${$i(M)}`),y.push(""),y.push(`- Exported: ${new Date().toISOString()}`),y.push(`- Thread ID: ${((Ve=a.value)==null?void 0:Ve.id)??""}`),y.push(""),y.push("---"),y.push("");for(const je of _.value){const Lt=je.role?je.role.toUpperCase():"MESSAGE";y.push(`## ${Lt}`),y.push("");const Ms=je.text.trim();if(Ms&&(y.push(Ms),y.push("")),je.commandExecution&&(y.push("```text"),y.push(`command: ${je.commandExecution.command}`),y.push(`status: ${je.commandExecution.status}`),je.commandExecution.cwd&&y.push(`cwd: ${je.commandExecution.cwd}`),je.commandExecution.exitCode!==null&&y.push(`exitCode: ${je.commandExecution.exitCode}`),y.push(je.commandExecution.aggregatedOutput||"(no output)"),y.push("```"),y.push("")),je.fileAttachments&&je.fileAttachments.length>0){y.push("Attachments:");for(const rs of je.fileAttachments)y.push(`- ${rs.path}`);y.push("")}if(je.images&&je.images.length>0){y.push("Images:");for(const rs of je.images)y.push(`- ${rs}`);y.push("")}}return`${y.join(`
|
|
1427
|
+
`).trimEnd()}
|
|
1428
|
+
`}function Mi(){var Ve,je;const ne=(((je=(Ve=a.value)==null?void 0:Ve.title)==null?void 0:je.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",Ue=new Date().toISOString().replace(/[:.]/g,"-");return`${ne}-${Ue}.md`}function $i(y){return y.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function ns(y,M){if(typeof window>"u")return M;const ne=window.localStorage.getItem(y);return ne===null?M:ne==="1"}function Oi(){if(typeof window>"u")return"system";const y=window.localStorage.getItem(qu);return y==="light"||y==="dark"?y:"system"}function xs(){return typeof window>"u"?"steer":window.localStorage.getItem(zu)==="queue"?"queue":"steer"}function Jn(){Rt.value=!Rt.value,window.localStorage.setItem(Gu,Rt.value?"1":"0")}function Ni(){wt.value=wt.value==="steer"?"queue":"steer",window.localStorage.setItem(zu,wt.value)}function Di(){const y=["system","light","dark"],M=y.indexOf(Dt.value);Dt.value=y[(M+1)%y.length],window.localStorage.setItem(qu,Dt.value),v()}function Li(){Qt.value=!Qt.value,window.localStorage.setItem(Ku,Qt.value?"1":"0")}function ji(){Tt.value=!Tt.value,window.localStorage.setItem(Ju,Tt.value?"1":"0")}function Ui(){bt.value=!bt.value,window.localStorage.setItem(Xu,bt.value?"1":"0")}function Io(y){const ne=h(y.trim())||"auto";Kt.value=ne,window.localStorage.setItem(Yu,ne)}function Fi(){var ne;if(typeof window>"u")return"auto";const y=((ne=window.localStorage.getItem(Yu))==null?void 0:ne.trim())||"auto";return h(y)||"auto"}function d(){const y=[{value:"auto",label:"Auto-detect"}],M=new Set(["auto"]);function ne(Ve){const je=s[Ve]||Ve;return`${je.charAt(0).toUpperCase()+je.slice(1)} (${Ve})`}for(const Ve of typeof navigator<"u"?navigator.languages??[]:[]){const je=h(Ve);!je||M.has(je)||(M.add(je),y.push({value:je,label:`Preferred: ${ne(je)}`}))}for(const Ve of Object.keys(s))M.has(Ve)||(M.add(Ve),y.push({value:Ve,label:ne(Ve)}));const Ue=Kt.value.trim();return Ue&&!M.has(Ue)&&y.push({value:Ue,label:ne(Ue)}),y}function h(y){const M=y.trim().toLowerCase();if(!M||M==="auto")return"";if(M in s)return M;const ne=M.split("-")[0]??M;return ne in s?ne:""}function v(){const y=document.documentElement;if(Dt.value==="dark")y.classList.add("dark");else if(Dt.value==="light")y.classList.remove("dark");else{const M=window.matchMedia("(prefers-color-scheme: dark)").matches;y.classList.toggle("dark",M)}}function C(){return typeof window>"u"?!1:window.localStorage.getItem(Vu)==="1"}function Z(y){typeof window>"u"||window.localStorage.setItem(Vu,y?"1":"0")}function te(y,M){const ne=(y??"").trim();return ne.length>0?ne:M.trim()||"message"}async function pe(){await ve(),_e.value=!0,await Ae(),be()}async function Ae(){if(!z.value){z.value=!0;try{if(g.name==="home"||g.name==="skills"){f.value!==""&&await re("");return}if(g.name==="thread"){const y=Jt.value;if(!y)return;if(!yn.value.has(y)){await b.replace({name:"home"});return}f.value!==y&&await re(y);return}}finally{z.value=!1}}}ut(()=>[g.name,Jt.value,B.value,yn.value.has(Jt.value),f.value],async()=>{_e.value&&await Ae()}),ut(()=>f.value,async y=>{if(_e.value&&!z.value&&!($t.value||Wt.value)){if(!y){g.name!=="home"&&await b.replace({name:"home"});return}g.name==="thread"&&Jt.value===y||await b.replace({name:"thread",params:{threadId:y}})}}),ut(()=>J.value,()=>{Rs()}),ut(()=>Ce.value,y=>{if(y.length===0){de.value="";return}y.some(ne=>ne.value===de.value)||(de.value=y[0].value),Zr()},{immediate:!0}),ut(()=>de.value,()=>{De.value={phase:"idle",title:"",message:""},Zr()}),ut(()=>Se.value,y=>{y==="local"&&(De.value={phase:"idle",title:"",message:""})}),ut(()=>g.name,y=>{y!=="home"&&(De.value={phase:"idle",title:"",message:""})}),ut(()=>f.value,()=>{De.value={phase:"idle",title:"",message:""}}),ut(()=>bt.value,y=>{nt(y)},{immediate:!0}),ut(x,y=>{y&&!Fe.value&&$(!0)});async function ke(y,M=[],ne=[],Ue=[]){try{De.value={phase:"idle",title:"",message:""};let Ve=de.value;if(Se.value==="worktree"){De.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const Lt=await W_(de.value);Ve=Lt.cwd,de.value=Lt.cwd,De.value={phase:"idle",title:"",message:""}}catch{De.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const je=await xe(y,Ve,M,ne,Ue);if(!je)return;await b.replace({name:"thread",params:{threadId:je}})}catch{}}return(y,M)=>(w(),k(Be,null,[Re(vv,{"is-sidebar-collapsed":Fe.value,onCloseSidebar:M[6]||(M[6]=ne=>$(!0))},{sidebar:_t(()=>[p("section",HA,[p("div",WA,[Fe.value?ae("",!0):(w(),ft(Uu,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":Fe.value,"show-new-thread-button":!0,onToggleSidebar:M[0]||(M[0]=ne=>$(!Fe.value)),onStartNewThread:Pt},{default:_t(()=>[p("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":ot.value,"aria-label":"Search threads",title:"Search threads",onClick:rt},[Re(Ba,{class:"sidebar-search-toggle-icon"})],8,VA)]),_:1},8,["is-sidebar-collapsed"])),!Fe.value&&ot.value?(w(),k("div",GA,[Re(Ba,{class:"sidebar-search-bar-icon"}),cr(p("input",{ref_key:"sidebarSearchInputRef",ref:tt,"onUpdate:modelValue":M[1]||(M[1]=ne=>He.value=ne),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:mn},null,544),[[ur,He.value]]),He.value.length>0?(w(),k("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:Nt},[Re(Sl,{class:"sidebar-search-clear-icon"})])):ae("",!0)])):ae("",!0),Fe.value?ae("",!0):(w(),k("button",{key:2,class:it(["sidebar-skills-link",{"is-active":Wt.value}]),type:"button",onClick:M[2]||(M[2]=ne=>{ye(b).push({name:"skills"}),ye(x)&&$(!0)})}," Skills Hub ",2)),Fe.value?ae("",!0):(w(),ft(iw,{key:3,groups:ye(o),"project-display-name-by-id":ye(i),"selected-thread-id":ye(f),"is-loading":ye(B),"search-query":He.value,"search-matched-thread-ids":vt.value,onSelect:Nn,onArchive:X,onStartNewThread:se,onRenameProject:bn,onBrowseProjectFiles:qe,onRenameThread:_n,onRemoveProject:an,onReorderProject:Vt,onExportThread:j},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),Fe.value?ae("",!0):(w(),k("div",zA,[Re(pf,{name:"settings-panel"},{default:_t(()=>[kt.value?(w(),k("div",qA,[p("button",{class:"sidebar-settings-row",type:"button",title:r.sendWithEnter,onClick:Jn},[M[7]||(M[7]=p("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),p("span",{class:it(["sidebar-settings-toggle",{"is-on":!Rt.value}])},null,2)],8,KA),p("button",{class:"sidebar-settings-row",type:"button",title:r.inProgressSendMode,onClick:Ni},[M[8]||(M[8]=p("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),p("span",YA,ie(wt.value==="steer"?"Steer":"Queue"),1)],8,JA),p("button",{class:"sidebar-settings-row",type:"button",title:r.appearance,onClick:Di},[M[9]||(M[9]=p("span",{class:"sidebar-settings-label"},"Appearance",-1)),p("span",QA,ie(Dt.value==="system"?"System":Dt.value==="dark"?"Dark":"Light"),1)],8,XA),p("button",{class:"sidebar-settings-row",type:"button",title:r.dictationClickToToggle,onClick:Li},[M[10]||(M[10]=p("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),p("span",{class:it(["sidebar-settings-toggle",{"is-on":Qt.value}])},null,2)],8,ZA),p("button",{class:"sidebar-settings-row",type:"button",title:r.dictationAutoSend,onClick:ji},[M[11]||(M[11]=p("span",{class:"sidebar-settings-label"},"Auto send dictation",-1)),p("span",{class:it(["sidebar-settings-toggle",{"is-on":Tt.value}])},null,2)],8,e1),p("button",{class:"sidebar-settings-row",type:"button",title:r.worktreeRollback,onClick:Ui},[M[12]||(M[12]=p("span",{class:"sidebar-settings-label"},"Worktree rollback",-1)),p("span",{class:it(["sidebar-settings-toggle",{"is-on":bt.value}])},null,2)],8,t1),p("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:r.dictationLanguage},[M[13]||(M[13]=p("span",{class:"sidebar-settings-label"},"Dictation language",-1)),Re(Ks,{class:"sidebar-settings-language-dropdown","model-value":Kt.value,options:It.value,placeholder:"Auto-detect","open-direction":"up","enable-search":!0,"search-placeholder":"Search language...","onUpdate:modelValue":Io},null,8,["model-value","options"])],8,n1),p("div",r1,[Re(X0,{snapshots:ye(R)},null,8,["snapshots"])])])):ae("",!0)]),_:1}),p("button",{class:"sidebar-settings-button",type:"button",onClick:M[3]||(M[3]=ne=>kt.value=!kt.value)},[Re(pA,{class:"sidebar-settings-icon"}),M[14]||(M[14]=p("span",null,"Settings",-1))])]))])]),content:_t(()=>[p("section",s1,[Re(fw,{title:wn.value},{leading:_t(()=>[Fe.value||ye(x)?(w(),ft(Uu,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":Fe.value,"show-new-thread-button":!0,onToggleSidebar:M[4]||(M[4]=ne=>$(!Fe.value)),onStartNewThread:Pt},null,8,["is-sidebar-collapsed"])):ae("",!0)]),_:1},8,["title"]),p("section",o1,[Wt.value?(w(),ft(ZC,{key:0,onSkillsChanged:lt})):$t.value?(w(),k("div",i1,[p("div",a1,[M[16]||(M[16]=p("p",{class:"new-thread-hero"},"Let's build",-1)),Re(Ks,{class:"new-thread-folder-dropdown","model-value":de.value,options:Ce.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":jt.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":kn,onAdd:vr},null,8,["model-value","options","default-add-value"]),Re(oT,{class:"new-thread-runtime-dropdown",modelValue:Se.value,"onUpdate:modelValue":M[5]||(M[5]=ne=>Se.value=ne)},null,8,["modelValue"]),De.value.phase!=="idle"?(w(),k("div",{key:0,class:it(["worktree-init-status",{"is-running":De.value.phase==="running","is-error":De.value.phase==="error"}])},[p("strong",l1,ie(De.value.title),1),p("span",c1,ie(De.value.message),1)],2)):ae("",!0),p("div",u1,[p("div",d1,[M[15]||(M[15]=p("p",{class:"new-thread-trending-title"},"Trending GitHub tips",-1)),Re(Ks,{class:"new-thread-trending-scope-dropdown","model-value":J.value,options:Ke.value,"onUpdate:modelValue":Ut},null,8,["model-value","options"])]),V.value?(w(),k("p",f1,"Loading trending projects...")):N.value.length===0?(w(),k("p",h1," Trending tips are unavailable right now. ")):(w(),k("div",p1,[(w(!0),k(Be,null,St(N.value,ne=>(w(),k("button",{key:ne.id,type:"button",class:"new-thread-trending-tip",onClick:Ue=>gn(ne)},[p("span",g1,ie(ne.fullName),1),p("span",v1,ie(Ge(ne)),1),p("span",y1,ie(ne.description||"No description available."),1)],8,m1))),128))]))])]),Re(uu,{ref_key:"homeThreadComposerRef",ref:q,"active-thread-id":O.value,cwd:H.value,models:ye(m),"selected-model":ye(T),"selected-reasoning-effort":ye(U),"selected-speed-mode":ye(P),"is-updating-speed-mode":ye(me),skills:ye(F),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":Rt.value,"in-progress-submit-mode":wt.value,"dictation-click-to-toggle":Qt.value,"dictation-auto-send":Tt.value,"prepend-draft-request":qt.value,"dictation-language":Kt.value,onSubmit:ee,"onUpdate:selectedModel":ko,"onUpdate:selectedReasoningEffort":Ps,"onUpdate:selectedSpeedMode":To},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","prepend-draft-request","dictation-language"])])):(w(),k("div",w1,[p("div",b1,[Re(e_,{messages:_.value,"is-loading":ye(W),"active-thread-id":O.value,cwd:H.value,"scroll-state":ye(l),"live-overlay":E.value,"pending-requests":ye(u),"is-turn-in-progress":oe.value,"is-rolling-back":ye(Oe),onUpdateScrollState:Dn,onRespondServerRequest:I,onRollback:So},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests","is-turn-in-progress","is-rolling-back"])]),p("div",_1,[Re(H0,{messages:ye(Ee),onEdit:Xr,onSteer:ye(Ze),onDelete:ye(Ye)},null,8,["messages","onSteer","onDelete"]),Re(uu,{ref_key:"threadComposerRef",ref:G,"active-thread-id":O.value,cwd:H.value,models:ye(m),"selected-model":ye(T),"selected-reasoning-effort":ye(U),"selected-speed-mode":ye(P),"is-updating-speed-mode":ye(me),skills:ye(F),"is-turn-in-progress":oe.value,"is-interrupting-turn":ye(ce),"has-queue-above":ye(Ee).length>0,"send-with-enter":Rt.value,"in-progress-submit-mode":wt.value,"dictation-click-to-toggle":Qt.value,"dictation-auto-send":Tt.value,"prepend-draft-request":qt.value,"dictation-language":Kt.value,onSubmit:ee,"onUpdate:selectedModel":ko,"onUpdate:selectedReasoningEffort":Ps,"onUpdate:selectedSpeedMode":To,onInterrupt:ts},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","is-turn-in-progress","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","prepend-draft-request","dictation-language"])])]))])])]),_:1},8,["is-sidebar-collapsed"]),p("div",k1," WT "+ie(ye(t))+" · v"+ie(ye(n)),1)],64))}}),S1=st(T1,[["__scopeId","data-v-017ded9c"]]),_a={render:()=>null},I1=cv({history:Bg(),routes:[{path:"/",name:"home",component:_a},{path:"/thread/:threadId",name:"thread",component:_a},{path:"/skills",name:"skills",component:_a},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexapp. GitHub: https://github.com/friuns2/codexui");eg(S1).use(I1).mount("#app");
|