codexapp 0.1.37 → 0.1.38
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-CjOdBzga.css +1 -0
- package/dist/assets/index-a31kfCUK.js +1430 -0
- package/dist/index.html +2 -2
- package/dist-cli/index.js +2 -14
- package/dist-cli/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/index-B09aWGYu.css +0 -1
- package/dist/assets/index-DYCVbzKq.js +0 -1430
|
@@ -0,0 +1,1430 @@
|
|
|
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 Aa(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const _t={},ss=[],$n=()=>{},_u=()=>!1,Jo=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Ra=e=>e.startsWith("onUpdate:"),Ft=Object.assign,Pa=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Xf=Object.prototype.hasOwnProperty,dt=(e,t)=>Xf.call(e,t),$e=Array.isArray,os=e=>ro(e)==="[object Map]",ku=e=>ro(e)==="[object Set]",wl=e=>ro(e)==="[object Date]",We=e=>typeof e=="function",At=e=>typeof e=="string",_n=e=>typeof e=="symbol",ft=e=>e!==null&&typeof e=="object",Tu=e=>(ft(e)||We(e))&&We(e.then)&&We(e.catch),Iu=Object.prototype.toString,ro=e=>Iu.call(e),Zf=e=>ro(e).slice(8,-1),Su=e=>ro(e)==="[object Object]",xa=e=>At(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ns=Aa(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Yo=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},eh=/-\w/g,sn=Yo(e=>e.replace(eh,t=>t.slice(1).toUpperCase())),th=/\B([A-Z])/g,Sr=Yo(e=>e.replace(th,"-$1").toLowerCase()),Qo=Yo(e=>e.charAt(0).toUpperCase()+e.slice(1)),gi=Yo(e=>e?`on${Qo(e)}`:""),xn=(e,t)=>!Object.is(e,t),To=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Eu=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Ma=e=>{const t=parseFloat(e);return isNaN(t)?e:t},nh=e=>{const t=At(e)?Number(e):NaN;return isNaN(t)?e:t};let bl;const Xo=()=>bl||(bl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function zr(e){if($e(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=At(r)?ih(r):zr(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(At(e)||ft(e))return e}const rh=/;(?![^(]*\))/g,sh=/:([^]+)/,oh=/\/\*[^]*?\*\//g;function ih(e){const t={};return e.replace(oh,"").split(rh).forEach(n=>{if(n){const r=n.split(sh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function gt(e){let t="";if(At(e))t=e;else if($e(e))for(let n=0;n<e.length;n++){const r=gt(e[n]);r&&(t+=r+" ")}else if(ft(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const ah="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",lh=Aa(ah);function Cu(e){return!!e||e===""}function ch(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Oa(e[r],t[r]);return n}function Oa(e,t){if(e===t)return!0;let n=wl(e),r=wl(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=_n(e),r=_n(t),n||r)return e===t;if(n=$e(e),r=$e(t),n||r)return n&&r?ch(e,t):!1;if(n=ft(e),r=ft(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||!Oa(e[i],t[i]))return!1}}return String(e)===String(t)}const Au=e=>!!(e&&e.__v_isRef===!0),se=e=>At(e)?e:e==null?"":$e(e)||ft(e)&&(e.toString===Iu||!We(e.toString))?Au(e)?se(e.value):JSON.stringify(e,Ru,2):String(e),Ru=(e,t)=>Au(t)?Ru(e,t.value):os(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[vi(r,o)+" =>"]=s,n),{})}:ku(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>vi(n))}:_n(t)?vi(t):ft(t)&&!$e(t)&&!Su(t)?String(t):t,vi=(e,t="")=>{var n;return _n(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 ln;class uh{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=ln,!t&&ln&&(this.index=(ln.scopes||(ln.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=ln;try{return ln=this,t()}finally{ln=n}}}on(){++this._on===1&&(this.prevScope=ln,ln=this)}off(){this._on>0&&--this._on===0&&(ln=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 dh(){return ln}let St;const yi=new WeakSet;class Pu{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,ln&&ln.active&&ln.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,yi.has(this)&&(yi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Mu(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,_l(this),Ou(this);const t=St,n=yn;St=this,yn=!0;try{return this.fn()}finally{Nu(this),St=t,yn=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Da(t);this.deps=this.depsTail=void 0,_l(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?yi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ji(this)&&this.run()}get dirty(){return Ji(this)}}let xu=0,$s,Ds;function Mu(e,t=!1){if(e.flags|=8,t){e.next=Ds,Ds=e;return}e.next=$s,$s=e}function Na(){xu++}function $a(){if(--xu>0)return;if(Ds){let t=Ds;for(Ds=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;$s;){let t=$s;for($s=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 Ou(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Nu(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),Da(r),fh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Ji(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&($u(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function $u(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Vs)||(e.globalVersion=Vs,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ji(e))))return;e.flags|=2;const t=e.dep,n=St,r=yn;St=e,yn=!0;try{Ou(e);const s=e.fn(e._value);(t.version===0||xn(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{St=n,yn=r,Nu(e),e.flags&=-3}}function Da(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)Da(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function fh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let yn=!0;const Du=[];function er(){Du.push(yn),yn=!1}function tr(){const e=Du.pop();yn=e===void 0?!0:e}function _l(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=St;St=void 0;try{t()}finally{St=n}}}let Vs=0;class hh{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 La{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(!St||!yn||St===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==St)n=this.activeLink=new hh(St,this),St.deps?(n.prevDep=St.depsTail,St.depsTail.nextDep=n,St.depsTail=n):St.deps=St.depsTail=n,Lu(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=St.depsTail,n.nextDep=void 0,St.depsTail.nextDep=n,St.depsTail=n,St.deps===n&&(St.deps=r)}return n}trigger(t){this.version++,Vs++,this.notify(t)}notify(t){Na();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{$a()}}}function Lu(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)Lu(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Yi=new WeakMap,Hr=Symbol(""),Qi=Symbol(""),Ws=Symbol("");function Kt(e,t,n){if(yn&&St){let r=Yi.get(e);r||Yi.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new La),s.map=r,s.key=n),s.track()}}function Jn(e,t,n,r,s,o){const i=Yi.get(e);if(!i){Vs++;return}const a=l=>{l&&l.trigger()};if(Na(),t==="clear")i.forEach(a);else{const l=$e(e),c=l&&xa(n);if(l&&n==="length"){const u=Number(r);i.forEach((f,m)=>{(m==="length"||m===Ws||!_n(m)&&m>=u)&&a(f)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),c&&a(i.get(Ws)),t){case"add":l?c&&a(i.get("length")):(a(i.get(Hr)),os(e)&&a(i.get(Qi)));break;case"delete":l||(a(i.get(Hr)),os(e)&&a(i.get(Qi)));break;case"set":os(e)&&a(i.get(Hr));break}}$a()}function Zr(e){const t=ct(e);return t===e?t:(Kt(t,"iterate",Ws),gn(e)?t:t.map(kn))}function Zo(e){return Kt(e=ct(e),"iterate",Ws),e}function Rn(e,t){return nr(e)?hs(Vr(e)?kn(t):t):kn(t)}const ph={__proto__:null,[Symbol.iterator](){return wi(this,Symbol.iterator,e=>Rn(this,e))},concat(...e){return Zr(this).concat(...e.map(t=>$e(t)?Zr(t):t))},entries(){return wi(this,"entries",e=>(e[1]=Rn(this,e[1]),e))},every(e,t){return Wn(this,"every",e,t,void 0,arguments)},filter(e,t){return Wn(this,"filter",e,t,n=>n.map(r=>Rn(this,r)),arguments)},find(e,t){return Wn(this,"find",e,t,n=>Rn(this,n),arguments)},findIndex(e,t){return Wn(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Wn(this,"findLast",e,t,n=>Rn(this,n),arguments)},findLastIndex(e,t){return Wn(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Wn(this,"forEach",e,t,void 0,arguments)},includes(...e){return bi(this,"includes",e)},indexOf(...e){return bi(this,"indexOf",e)},join(e){return Zr(this).join(e)},lastIndexOf(...e){return bi(this,"lastIndexOf",e)},map(e,t){return Wn(this,"map",e,t,void 0,arguments)},pop(){return Cs(this,"pop")},push(...e){return Cs(this,"push",e)},reduce(e,...t){return kl(this,"reduce",e,t)},reduceRight(e,...t){return kl(this,"reduceRight",e,t)},shift(){return Cs(this,"shift")},some(e,t){return Wn(this,"some",e,t,void 0,arguments)},splice(...e){return Cs(this,"splice",e)},toReversed(){return Zr(this).toReversed()},toSorted(e){return Zr(this).toSorted(e)},toSpliced(...e){return Zr(this).toSpliced(...e)},unshift(...e){return Cs(this,"unshift",e)},values(){return wi(this,"values",e=>Rn(this,e))}};function wi(e,t,n){const r=Zo(e),s=r[t]();return r!==e&&!gn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const mh=Array.prototype;function Wn(e,t,n,r,s,o){const i=Zo(e),a=i!==e&&!gn(e),l=i[t];if(l!==mh[t]){const f=l.apply(e,o);return a?kn(f):f}let c=n;i!==e&&(a?c=function(f,m){return n.call(this,Rn(e,f),m,e)}:n.length>2&&(c=function(f,m){return n.call(this,f,m,e)}));const u=l.call(i,c,r);return a&&s?s(u):u}function kl(e,t,n,r){const s=Zo(e),o=s!==e&&!gn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(c,u,f){return a&&(a=!1,c=Rn(e,c)),n.call(this,c,Rn(e,u),f,e)}):n.length>3&&(i=function(c,u,f){return n.call(this,c,u,f,e)}));const l=s[t](i,...r);return a?Rn(e,l):l}function bi(e,t,n){const r=ct(e);Kt(r,"iterate",Ws);const s=r[t](...n);return(s===-1||s===!1)&&Ba(n[0])?(n[0]=ct(n[0]),r[t](...n)):s}function Cs(e,t,n=[]){er(),Na();const r=ct(e)[t].apply(e,n);return $a(),tr(),r}const gh=Aa("__proto__,__v_isRef,__isVue"),ju=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(_n));function vh(e){_n(e)||(e=String(e));const t=ct(this);return Kt(t,"has",e),t.hasOwnProperty(e)}class Fu{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?Ch:Vu:o?Hu:Uu).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=$e(t);if(!s){let l;if(i&&(l=ph[n]))return l;if(n==="hasOwnProperty")return vh}const a=Reflect.get(t,n,Qt(t)?t:r);if((_n(n)?ju.has(n):gh(n))||(s||Kt(t,"get",n),o))return a;if(Qt(a)){const l=i&&xa(n)?a:a.value;return s&&ft(l)?Zi(l):l}return ft(a)?s?Zi(a):ei(a):a}}class Bu extends Fu{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=$e(t)&&xa(n);if(!this._isShallow){const c=nr(o);if(!gn(r)&&!nr(r)&&(o=ct(o),r=ct(r)),!i&&Qt(o)&&!Qt(r))return c||(o.value=r),!0}const a=i?Number(n)<t.length:dt(t,n),l=Reflect.set(t,n,r,Qt(t)?t:s);return t===ct(s)&&(a?xn(r,o)&&Jn(t,"set",n,r):Jn(t,"add",n,r)),l}deleteProperty(t,n){const r=dt(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Jn(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!_n(n)||!ju.has(n))&&Kt(t,"has",n),r}ownKeys(t){return Kt(t,"iterate",$e(t)?"length":Hr),Reflect.ownKeys(t)}}class yh extends Fu{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const wh=new Bu,bh=new yh,_h=new Bu(!0);const Xi=e=>e,po=e=>Reflect.getPrototypeOf(e);function kh(e,t,n){return function(...r){const s=this.__v_raw,o=ct(s),i=os(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,c=s[e](...r),u=n?Xi:t?hs:kn;return!t&&Kt(o,"iterate",l?Qi:Hr),Ft(Object.create(c),{next(){const{value:f,done:m}=c.next();return m?{value:f,done:m}:{value:a?[u(f[0]),u(f[1])]:u(f),done:m}}})}}function mo(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Th(e,t){const n={get(s){const o=this.__v_raw,i=ct(o),a=ct(s);e||(xn(s,a)&&Kt(i,"get",s),Kt(i,"get",a));const{has:l}=po(i),c=t?Xi:e?hs:kn;if(l.call(i,s))return c(o.get(s));if(l.call(i,a))return c(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&Kt(ct(s),"iterate",Hr),s.size},has(s){const o=this.__v_raw,i=ct(o),a=ct(s);return e||(xn(s,a)&&Kt(i,"has",s),Kt(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=ct(a),c=t?Xi:e?hs:kn;return!e&&Kt(l,"iterate",Hr),a.forEach((u,f)=>s.call(o,c(u),c(f),i))}};return Ft(n,e?{add:mo("add"),set:mo("set"),delete:mo("delete"),clear:mo("clear")}:{add(s){const o=ct(this),i=po(o),a=ct(s),l=!t&&!gn(s)&&!nr(s)?a:s;return i.has.call(o,l)||xn(s,l)&&i.has.call(o,s)||xn(a,l)&&i.has.call(o,a)||(o.add(l),Jn(o,"add",l,l)),this},set(s,o){!t&&!gn(o)&&!nr(o)&&(o=ct(o));const i=ct(this),{has:a,get:l}=po(i);let c=a.call(i,s);c||(s=ct(s),c=a.call(i,s));const u=l.call(i,s);return i.set(s,o),c?xn(o,u)&&Jn(i,"set",s,o):Jn(i,"add",s,o),this},delete(s){const o=ct(this),{has:i,get:a}=po(o);let l=i.call(o,s);l||(s=ct(s),l=i.call(o,s)),a&&a.call(o,s);const c=o.delete(s);return l&&Jn(o,"delete",s,void 0),c},clear(){const s=ct(this),o=s.size!==0,i=s.clear();return o&&Jn(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=kh(s,e,t)}),n}function ja(e,t){const n=Th(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(dt(n,s)&&s in r?n:r,s,o)}const Ih={get:ja(!1,!1)},Sh={get:ja(!1,!0)},Eh={get:ja(!0,!1)};const Uu=new WeakMap,Hu=new WeakMap,Vu=new WeakMap,Ch=new WeakMap;function Ah(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Rh(e){return e.__v_skip||!Object.isExtensible(e)?0:Ah(Zf(e))}function ei(e){return nr(e)?e:Fa(e,!1,wh,Ih,Uu)}function Wu(e){return Fa(e,!1,_h,Sh,Hu)}function Zi(e){return Fa(e,!0,bh,Eh,Vu)}function Fa(e,t,n,r,s){if(!ft(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Rh(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 Vr(e){return nr(e)?Vr(e.__v_raw):!!(e&&e.__v_isReactive)}function nr(e){return!!(e&&e.__v_isReadonly)}function gn(e){return!!(e&&e.__v_isShallow)}function Ba(e){return e?!!e.__v_raw:!1}function ct(e){const t=e&&e.__v_raw;return t?ct(t):e}function Ph(e){return!dt(e,"__v_skip")&&Object.isExtensible(e)&&Eu(e,"__v_skip",!0),e}const kn=e=>ft(e)?ei(e):e,hs=e=>ft(e)?Zi(e):e;function Qt(e){return e?e.__v_isRef===!0:!1}function D(e){return zu(e,!1)}function xh(e){return zu(e,!0)}function zu(e,t){return Qt(e)?e:new Mh(e,t)}class Mh{constructor(t,n){this.dep=new La,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:ct(t),this._value=n?t:kn(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||gn(t)||nr(t);t=r?t:ct(t),xn(t,n)&&(this._rawValue=t,this._value=r?t:kn(t),this.dep.trigger())}}function de(e){return Qt(e)?e.value:e}const Oh={get:(e,t,n)=>t==="__v_raw"?e:de(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return Qt(s)&&!Qt(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Gu(e){return Vr(e)?e:new Proxy(e,Oh)}class Nh{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new La(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Vs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&St!==this)return Mu(this,!0),!0}get value(){const t=this.dep.track();return $u(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function $h(e,t,n=!1){let r,s;return We(e)?r=e:(r=e.get,s=e.set),new Nh(r,s,n)}const go={},Oo=new WeakMap;let Dr;function Dh(e,t=!1,n=Dr){if(n){let r=Oo.get(n);r||Oo.set(n,r=[]),r.push(e)}}function Lh(e,t,n=_t){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,c=V=>s?V:gn(V)||s===!1||s===0?Yn(V,1):Yn(V);let u,f,m,_,$=!1,A=!1;if(Qt(e)?(f=()=>e.value,$=gn(e)):Vr(e)?(f=()=>c(e),$=!0):$e(e)?(A=!0,$=e.some(V=>Vr(V)||gn(V)),f=()=>e.map(V=>{if(Qt(V))return V.value;if(Vr(V))return c(V);if(We(V))return l?l(V,2):V()})):We(e)?t?f=l?()=>l(e,2):e:f=()=>{if(m){er();try{m()}finally{tr()}}const V=Dr;Dr=u;try{return l?l(e,3,[_]):e(_)}finally{Dr=V}}:f=$n,t&&s){const V=f,fe=s===!0?1/0:s;f=()=>Yn(V(),fe)}const L=dh(),X=()=>{u.stop(),L&&L.active&&Pa(L.effects,u)};if(o&&t){const V=t;t=(...fe)=>{V(...fe),X()}}let O=A?new Array(e.length).fill(go):go;const z=V=>{if(!(!(u.flags&1)||!u.dirty&&!V))if(t){const fe=u.run();if(s||$||(A?fe.some((ie,ye)=>xn(ie,O[ye])):xn(fe,O))){m&&m();const ie=Dr;Dr=u;try{const ye=[fe,O===go?void 0:A&&O[0]===go?[]:O,_];O=fe,l?l(t,3,ye):t(...ye)}finally{Dr=ie}}}else u.run()};return a&&a(z),u=new Pu(f),u.scheduler=i?()=>i(z,!1):z,_=V=>Dh(V,!1,u),m=u.onStop=()=>{const V=Oo.get(u);if(V){if(l)l(V,4);else for(const fe of V)fe();Oo.delete(u)}},t?r?z(!0):O=u.run():i?i(z.bind(null,!0),!0):u.run(),X.pause=u.pause.bind(u),X.resume=u.resume.bind(u),X.stop=X,X}function Yn(e,t=1/0,n){if(t<=0||!ft(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Qt(e))Yn(e.value,t,n);else if($e(e))for(let r=0;r<e.length;r++)Yn(e[r],t,n);else if(ku(e)||os(e))e.forEach(r=>{Yn(r,t,n)});else if(Su(e)){for(const r in e)Yn(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Yn(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 so(e,t,n,r){try{return r?e(...r):e()}catch(s){ti(s,t,n)}}function Tn(e,t,n,r){if(We(e)){const s=so(e,t,n,r);return s&&Tu(s)&&s.catch(o=>{ti(o,t,n)}),s}if($e(e)){const s=[];for(let o=0;o<e.length;o++)s.push(Tn(e[o],t,n,r));return s}}function ti(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||_t;if(t){let a=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let f=0;f<u.length;f++)if(u[f](e,l,c)===!1)return}a=a.parent}if(o){er(),so(o,null,10,[e,l,c]),tr();return}}jh(e,n,s,r,i)}function jh(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const nn=[];let Cn=-1;const is=[];let gr=null,ts=0;const qu=Promise.resolve();let No=null;function cn(e){const t=No||qu;return e?t.then(this?e.bind(this):e):t}function Fh(e){let t=Cn+1,n=nn.length;for(;t<n;){const r=t+n>>>1,s=nn[r],o=zs(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function Ua(e){if(!(e.flags&1)){const t=zs(e),n=nn[nn.length-1];!n||!(e.flags&2)&&t>=zs(n)?nn.push(e):nn.splice(Fh(t),0,e),e.flags|=1,Ku()}}function Ku(){No||(No=qu.then(Yu))}function Bh(e){$e(e)?is.push(...e):gr&&e.id===-1?gr.splice(ts+1,0,e):e.flags&1||(is.push(e),e.flags|=1),Ku()}function Tl(e,t,n=Cn+1){for(;n<nn.length;n++){const r=nn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;nn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Ju(e){if(is.length){const t=[...new Set(is)].sort((n,r)=>zs(n)-zs(r));if(is.length=0,gr){gr.push(...t);return}for(gr=t,ts=0;ts<gr.length;ts++){const n=gr[ts];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}gr=null,ts=0}}const zs=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Yu(e){try{for(Cn=0;Cn<nn.length;Cn++){const t=nn[Cn];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),so(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Cn<nn.length;Cn++){const t=nn[Cn];t&&(t.flags&=-2)}Cn=-1,nn.length=0,Ju(),No=null,(nn.length||is.length)&&Yu()}}let zt=null,Qu=null;function $o(e){const t=zt;return zt=e,Qu=e&&e.type.__scopeId||null,t}function pt(e,t=zt,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Fo(-1);const o=$o(t);let i;try{i=e(...s)}finally{$o(o),r._d&&Fo(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function rr(e,t){if(zt===null)return e;const n=ai(zt),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=_t]=t[s];o&&(We(o)&&(o={mounted:o,updated:o}),o.deep&&Yn(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function xr(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&&(er(),Tn(l,n,8,[e.el,a,e,t]),tr())}}function Io(e,t){if(Yt){let n=Yt.provides;const r=Yt.parent&&Yt.parent.provides;r===n&&(n=Yt.provides=Object.create(r)),n[e]=t}}function wn(e,t,n=!1){const r=Ga();if(r||ls){let s=ls?ls._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&&We(t)?t.call(r&&r.proxy):t}}const Uh=Symbol.for("v-scx"),Hh=()=>wn(Uh);function mt(e,t,n){return Xu(e,t,n)}function Xu(e,t,n=_t){const{immediate:r,deep:s,flush:o,once:i}=n,a=Ft({},n),l=t&&r||!t&&o!=="post";let c;if(Ys){if(o==="sync"){const _=Hh();c=_.__watcherHandles||(_.__watcherHandles=[])}else if(!l){const _=()=>{};return _.stop=$n,_.resume=$n,_.pause=$n,_}}const u=Yt;a.call=(_,$,A)=>Tn(_,u,$,A);let f=!1;o==="post"?a.scheduler=_=>{qt(_,u&&u.suspense)}:o!=="sync"&&(f=!0,a.scheduler=(_,$)=>{$?_():Ua(_)}),a.augmentJob=_=>{t&&(_.flags|=4),f&&(_.flags|=2,u&&(_.id=u.uid,_.i=u))};const m=Lh(e,t,a);return Ys&&(c?c.push(m):l&&m()),m}function Vh(e,t,n){const r=this.proxy,s=At(e)?e.includes(".")?Zu(r,e):()=>r[e]:e.bind(r,r);let o;We(t)?o=t:(o=t.handler,n=t);const i=oo(this),a=Xu(s,o.bind(r),n);return i(),a}function Zu(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 ed=Symbol("_vte"),td=e=>e.__isTeleport,Ls=e=>e&&(e.disabled||e.disabled===""),Il=e=>e&&(e.defer||e.defer===""),Sl=e=>typeof SVGElement<"u"&&e instanceof SVGElement,El=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,ea=(e,t)=>{const n=e&&e.to;return At(n)?t?t(n):null:n},nd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,c){const{mc:u,pc:f,pbc:m,o:{insert:_,querySelector:$,createText:A,createComment:L}}=c,X=Ls(t.props);let{shapeFlag:O,children:z,dynamicChildren:V}=t;if(e==null){const fe=t.el=A(""),ie=t.anchor=A("");_(fe,n,r),_(ie,n,r);const ye=(re,ee)=>{O&16&&u(z,re,ee,s,o,i,a,l)},Te=()=>{const re=t.target=ea(t.props,$),ee=ta(re,t,A,_);re&&(i!=="svg"&&Sl(re)?i="svg":i!=="mathml"&&El(re)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(re),X||(ye(re,ee),So(t,!1)))};X&&(ye(n,ie),So(t,!0)),Il(t.props)?(t.el.__isMounted=!1,qt(()=>{Te(),delete t.el.__isMounted},o)):Te()}else{if(Il(t.props)&&e.el.__isMounted===!1){qt(()=>{nd.process(e,t,n,r,s,o,i,a,l,c)},o);return}t.el=e.el,t.targetStart=e.targetStart;const fe=t.anchor=e.anchor,ie=t.target=e.target,ye=t.targetAnchor=e.targetAnchor,Te=Ls(e.props),re=Te?n:ie,ee=Te?fe:ye;if(i==="svg"||Sl(ie)?i="svg":(i==="mathml"||El(ie))&&(i="mathml"),V?(m(e.dynamicChildren,V,re,s,o,i,a),Wa(e,t,!0)):l||f(e,t,re,ee,s,o,i,a,!1),X)Te?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):vo(t,n,fe,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const we=t.target=ea(t.props,$);we&&vo(t,we,null,c,0)}else Te&&vo(t,ie,ye,c,1);So(t,X)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:c,targetAnchor:u,target:f,props:m}=e;if(f&&(s(c),s(u)),o&&s(l),i&16){const _=o||!Ls(m);for(let $=0;$<a.length;$++){const A=a[$];r(A,t,n,_,!!A.dynamicChildren)}}},move:vo,hydrate:Wh};function vo(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:c,props:u}=e,f=o===2;if(f&&r(i,t,n),(!f||Ls(u))&&l&16)for(let m=0;m<c.length;m++)s(c[m],t,n,2);f&&r(a,t,n)}function Wh(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:c,createText:u}},f){function m(L,X){let O=X;for(;O;){if(O&&O.nodeType===8){if(O.data==="teleport start anchor")t.targetStart=O;else if(O.data==="teleport anchor"){t.targetAnchor=O,L._lpa=t.targetAnchor&&i(t.targetAnchor);break}}O=i(O)}}function _(L,X){X.anchor=f(i(L),X,a(L),n,r,s,o)}const $=t.target=ea(t.props,l),A=Ls(t.props);if($){const L=$._lpa||$.firstChild;t.shapeFlag&16&&(A?(_(e,t),m($,L),t.targetAnchor||ta($,t,u,c,a(e)===$?e:null)):(t.anchor=i(e),m($,L),t.targetAnchor||ta($,t,u,c),f(L&&i(L),t,$,n,r,s,o))),So(t,A)}else A&&t.shapeFlag&16&&(_(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const Do=nd;function So(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 ta(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[ed]=i,e&&(r(o,e,s),r(i,e,s)),i}const An=Symbol("_leaveCb"),As=Symbol("_enterCb");function zh(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return lr(()=>{e.isMounted=!0}),cr(()=>{e.isUnmounting=!0}),e}const pn=[Function,Array],rd={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:pn,onEnter:pn,onAfterEnter:pn,onEnterCancelled:pn,onBeforeLeave:pn,onLeave:pn,onAfterLeave:pn,onLeaveCancelled:pn,onBeforeAppear:pn,onAppear:pn,onAfterAppear:pn,onAppearCancelled:pn},sd=e=>{const t=e.subTree;return t.component?sd(t.component):t},Gh={name:"BaseTransition",props:rd,setup(e,{slots:t}){const n=Ga(),r=zh();return()=>{const s=t.default&&ad(t.default(),!0);if(!s||!s.length)return;const o=od(s),i=ct(e),{mode:a}=i;if(r.isLeaving)return _i(o);const l=Cl(o);if(!l)return _i(o);let c=na(l,i,r,n,f=>c=f);l.type!==Jt&&Gs(l,c);let u=n.subTree&&Cl(n.subTree);if(u&&u.type!==Jt&&!jr(u,l)&&sd(n).type!==Jt){let f=na(u,i,r,n);if(Gs(u,f),a==="out-in"&&l.type!==Jt)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,u=void 0},_i(o);a==="in-out"&&l.type!==Jt?f.delayLeave=(m,_,$)=>{const A=id(r,u);A[String(u.key)]=u,m[An]=()=>{_(),m[An]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{$(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return o}}};function od(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Jt){t=n;break}}return t}const qh=Gh;function id(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 na(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:f,onBeforeLeave:m,onLeave:_,onAfterLeave:$,onLeaveCancelled:A,onBeforeAppear:L,onAppear:X,onAfterAppear:O,onAppearCancelled:z}=t,V=String(e.key),fe=id(n,e),ie=(re,ee)=>{re&&Tn(re,r,9,ee)},ye=(re,ee)=>{const we=ee[1];ie(re,ee),$e(re)?re.every(ne=>ne.length<=1)&&we():re.length<=1&&we()},Te={mode:i,persisted:a,beforeEnter(re){let ee=l;if(!n.isMounted)if(o)ee=L||l;else return;re[An]&&re[An](!0);const we=fe[V];we&&jr(e,we)&&we.el[An]&&we.el[An](),ie(ee,[re])},enter(re){if(fe[V]===e)return;let ee=c,we=u,ne=f;if(!n.isMounted)if(o)ee=X||c,we=O||u,ne=z||f;else return;let je=!1;re[As]=et=>{je||(je=!0,et?ie(ne,[re]):ie(we,[re]),Te.delayedLeave&&Te.delayedLeave(),re[As]=void 0)};const Fe=re[As].bind(null,!1);ee?ye(ee,[re,Fe]):Fe()},leave(re,ee){const we=String(e.key);if(re[As]&&re[As](!0),n.isUnmounting)return ee();ie(m,[re]);let ne=!1;re[An]=Fe=>{ne||(ne=!0,ee(),Fe?ie(A,[re]):ie($,[re]),re[An]=void 0,fe[we]===e&&delete fe[we])};const je=re[An].bind(null,!1);fe[we]=e,_?ye(_,[re,je]):je()},clone(re){const ee=na(re,t,n,r,s);return s&&s(ee),ee}};return Te}function _i(e){if(ni(e))return e=Ir(e),e.children=null,e}function Cl(e){if(!ni(e))return td(e.type)&&e.children?od(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&&We(n.default))return n.default()}}function Gs(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Gs(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 ad(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===Le?(i.patchFlag&128&&s++,r=r.concat(ad(i.children,t,a))):(t||i.type!==Jt)&&r.push(a!=null?Ir(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Ut(e,t){return We(e)?Ft({name:e.name},t,{setup:e}):e}function ld(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Al(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Lo=new WeakMap;function js(e,t,n,r,s=!1){if($e(e)){e.forEach((A,L)=>js(A,t&&($e(t)?t[L]:t),n,r,s));return}if(as(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&js(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?ai(r.component):r.el,i=s?null:o,{i:a,r:l}=e,c=t&&t.r,u=a.refs===_t?a.refs={}:a.refs,f=a.setupState,m=ct(f),_=f===_t?_u:A=>Al(u,A)?!1:dt(m,A),$=(A,L)=>!(L&&Al(u,L));if(c!=null&&c!==l){if(Rl(t),At(c))u[c]=null,_(c)&&(f[c]=null);else if(Qt(c)){const A=t;$(c,A.k)&&(c.value=null),A.k&&(u[A.k]=null)}}if(We(l))so(l,a,12,[i,u]);else{const A=At(l),L=Qt(l);if(A||L){const X=()=>{if(e.f){const O=A?_(l)?f[l]:u[l]:$()||!e.k?l.value:u[e.k];if(s)$e(O)&&Pa(O,o);else if($e(O))O.includes(o)||O.push(o);else if(A)u[l]=[o],_(l)&&(f[l]=u[l]);else{const z=[o];$(l,e.k)&&(l.value=z),e.k&&(u[e.k]=z)}}else A?(u[l]=i,_(l)&&(f[l]=i)):L&&($(l,e.k)&&(l.value=i),e.k&&(u[e.k]=i))};if(i){const O=()=>{X(),Lo.delete(e)};O.id=-1,Lo.set(e,O),qt(O,n)}else Rl(e),X()}}}function Rl(e){const t=Lo.get(e);t&&(t.flags|=8,Lo.delete(e))}Xo().requestIdleCallback;Xo().cancelIdleCallback;const as=e=>!!e.type.__asyncLoader,ni=e=>e.type.__isKeepAlive;function Kh(e,t){cd(e,"a",t)}function Jh(e,t){cd(e,"da",t)}function cd(e,t,n=Yt){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(ri(t,r,n),n){let s=n.parent;for(;s&&s.parent;)ni(s.parent.vnode)&&Yh(r,t,n,s),s=s.parent}}function Yh(e,t,n,r){const s=ri(t,e,r,!0);si(()=>{Pa(r[t],s)},n)}function ri(e,t,n=Yt,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{er();const a=oo(n),l=Tn(t,n,e,i);return a(),tr(),l});return r?s.unshift(o):s.push(o),o}}const ar=e=>(t,n=Yt)=>{(!Ys||e==="sp")&&ri(e,(...r)=>t(...r),n)},Qh=ar("bm"),lr=ar("m"),Xh=ar("bu"),Zh=ar("u"),cr=ar("bum"),si=ar("um"),ep=ar("sp"),tp=ar("rtg"),np=ar("rtc");function rp(e,t=Yt){ri("ec",e,t)}const sp="components",ud=Symbol.for("v-ndc");function ra(e){return At(e)?op(sp,e,!1)||e:e||ud}function op(e,t,n=!0,r=!1){const s=zt||Yt;if(s){const o=s.type;{const a=Vp(o,!1);if(a&&(a===t||a===sn(t)||a===Qo(sn(t))))return o}const i=Pl(s[e]||o[e],t)||Pl(s.appContext[e],t);return!i&&r?o:i}}function Pl(e,t){return e&&(e[t]||e[sn(t)]||e[Qo(sn(t))])}function Ct(e,t,n,r){let s;const o=n,i=$e(e);if(i||At(e)){const a=i&&Vr(e);let l=!1,c=!1;a&&(l=!gn(e),c=nr(e),e=Zo(e)),s=new Array(e.length);for(let u=0,f=e.length;u<f;u++)s[u]=t(l?c?hs(kn(e[u])):kn(e[u]):e[u],u,void 0,o)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,o)}else if(ft(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,c=a.length;l<c;l++){const u=a[l];s[l]=t(e[u],u,l,o)}}else s=[];return s}function Nn(e,t,n={},r,s){if(zt.ce||zt.parent&&as(zt.parent)&&zt.parent.ce){const c=Object.keys(n).length>0;return t!=="default"&&(n.name=t),w(),wt(Le,null,[Ae("slot",n,r)],c?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),w();const i=o&&dd(o(n)),a=n.key||i&&i.key,l=wt(Le,{key:(a&&!_n(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function dd(e){return e.some(t=>Ks(t)?!(t.type===Jt||t.type===Le&&!dd(t.children)):!0)?e:null}const sa=e=>e?xd(e)?ai(e):sa(e.parent):null,Fs=Ft(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=>sa(e.parent),$root:e=>sa(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>hd(e),$forceUpdate:e=>e.f||(e.f=()=>{Ua(e.update)}),$nextTick:e=>e.n||(e.n=cn.bind(e.proxy)),$watch:e=>Vh.bind(e)}),ki=(e,t)=>e!==_t&&!e.__isScriptSetup&&dt(e,t),ip={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(ki(r,t))return i[t]=1,r[t];if(s!==_t&&dt(s,t))return i[t]=2,s[t];if(dt(o,t))return i[t]=3,o[t];if(n!==_t&&dt(n,t))return i[t]=4,n[t];oa&&(i[t]=0)}}const c=Fs[t];let u,f;if(c)return t==="$attrs"&&Kt(e.attrs,"get",""),c(e);if((u=a.__cssModules)&&(u=u[t]))return u;if(n!==_t&&dt(n,t))return i[t]=4,n[t];if(f=l.config.globalProperties,dt(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return ki(s,t)?(s[t]=n,!0):r!==_t&&dt(r,t)?(r[t]=n,!0):dt(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!==_t&&a[0]!=="$"&&dt(e,a)||ki(t,a)||dt(o,a)||dt(r,a)||dt(Fs,a)||dt(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:dt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function ap(){return lp().slots}function lp(e){const t=Ga();return t.setupContext||(t.setupContext=Od(t))}function xl(e){return $e(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let oa=!0;function cp(e){const t=hd(e),n=e.proxy,r=e.ctx;oa=!1,t.beforeCreate&&Ml(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:m,beforeUpdate:_,updated:$,activated:A,deactivated:L,beforeDestroy:X,beforeUnmount:O,destroyed:z,unmounted:V,render:fe,renderTracked:ie,renderTriggered:ye,errorCaptured:Te,serverPrefetch:re,expose:ee,inheritAttrs:we,components:ne,directives:je,filters:Fe}=t;if(c&&up(c,r,null),i)for(const Ee in i){const Oe=i[Ee];We(Oe)&&(r[Ee]=Oe.bind(n))}if(s){const Ee=s.call(n,n);ft(Ee)&&(e.data=ei(Ee))}if(oa=!0,o)for(const Ee in o){const Oe=o[Ee],tt=We(Oe)?Oe.bind(n,n):We(Oe.get)?Oe.get.bind(n,n):$n,Qe=!We(Oe)&&We(Oe.set)?Oe.set.bind(n):$n,Ze=he({get:tt,set:Qe});Object.defineProperty(r,Ee,{enumerable:!0,configurable:!0,get:()=>Ze.value,set:Xe=>Ze.value=Xe})}if(a)for(const Ee in a)fd(a[Ee],r,n,Ee);if(l){const Ee=We(l)?l.call(n):l;Reflect.ownKeys(Ee).forEach(Oe=>{Io(Oe,Ee[Oe])})}u&&Ml(u,e,"c");function De(Ee,Oe){$e(Oe)?Oe.forEach(tt=>Ee(tt.bind(n))):Oe&&Ee(Oe.bind(n))}if(De(Qh,f),De(lr,m),De(Xh,_),De(Zh,$),De(Kh,A),De(Jh,L),De(rp,Te),De(np,ie),De(tp,ye),De(cr,O),De(si,V),De(ep,re),$e(ee))if(ee.length){const Ee=e.exposed||(e.exposed={});ee.forEach(Oe=>{Object.defineProperty(Ee,Oe,{get:()=>n[Oe],set:tt=>n[Oe]=tt,enumerable:!0})})}else e.exposed||(e.exposed={});fe&&e.render===$n&&(e.render=fe),we!=null&&(e.inheritAttrs=we),ne&&(e.components=ne),je&&(e.directives=je),re&&ld(e)}function up(e,t,n=$n){$e(e)&&(e=ia(e));for(const r in e){const s=e[r];let o;ft(s)?"default"in s?o=wn(s.from||r,s.default,!0):o=wn(s.from||r):o=wn(s),Qt(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function Ml(e,t,n){Tn($e(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function fd(e,t,n,r){let s=r.includes(".")?Zu(n,r):()=>n[r];if(At(e)){const o=t[e];We(o)&&mt(s,o)}else if(We(e))mt(s,e.bind(n));else if(ft(e))if($e(e))e.forEach(o=>fd(o,t,n,r));else{const o=We(e.handler)?e.handler.bind(n):t[e.handler];We(o)&&mt(s,o,e)}}function hd(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(c=>jo(l,c,i,!0)),jo(l,t,i)),ft(t)&&o.set(t,l),l}function jo(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&jo(e,o,n,!0),s&&s.forEach(i=>jo(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=dp[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const dp={data:Ol,props:Nl,emits:Nl,methods:Os,computed:Os,beforeCreate:en,created:en,beforeMount:en,mounted:en,beforeUpdate:en,updated:en,beforeDestroy:en,beforeUnmount:en,destroyed:en,unmounted:en,activated:en,deactivated:en,errorCaptured:en,serverPrefetch:en,components:Os,directives:Os,watch:hp,provide:Ol,inject:fp};function Ol(e,t){return t?e?function(){return Ft(We(e)?e.call(this,this):e,We(t)?t.call(this,this):t)}:t:e}function fp(e,t){return Os(ia(e),ia(t))}function ia(e){if($e(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function en(e,t){return e?[...new Set([].concat(e,t))]:t}function Os(e,t){return e?Ft(Object.create(null),e,t):t}function Nl(e,t){return e?$e(e)&&$e(t)?[...new Set([...e,...t])]:Ft(Object.create(null),xl(e),xl(t??{})):t}function hp(e,t){if(!e)return t;if(!t)return e;const n=Ft(Object.create(null),e);for(const r in t)n[r]=en(e[r],t[r]);return n}function pd(){return{app:null,config:{isNativeTag:_u,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 pp=0;function mp(e,t){return function(r,s=null){We(r)||(r=Ft({},r)),s!=null&&!ft(s)&&(s=null);const o=pd(),i=new WeakSet,a=[];let l=!1;const c=o.app={_uid:pp++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:zp,get config(){return o.config},set config(u){},use(u,...f){return i.has(u)||(u&&We(u.install)?(i.add(u),u.install(c,...f)):We(u)&&(i.add(u),u(c,...f))),c},mixin(u){return o.mixins.includes(u)||o.mixins.push(u),c},component(u,f){return f?(o.components[u]=f,c):o.components[u]},directive(u,f){return f?(o.directives[u]=f,c):o.directives[u]},mount(u,f,m){if(!l){const _=c._ceVNode||Ae(r,s);return _.appContext=o,m===!0?m="svg":m===!1&&(m=void 0),e(_,u,m),l=!0,c._container=u,u.__vue_app__=c,ai(_.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Tn(a,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(u,f){return o.provides[u]=f,c},runWithContext(u){const f=ls;ls=c;try{return u()}finally{ls=f}}};return c}}let ls=null;const gp=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${sn(t)}Modifiers`]||e[`${Sr(t)}Modifiers`];function vp(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||_t;let s=n;const o=t.startsWith("update:"),i=o&&gp(r,t.slice(7));i&&(i.trim&&(s=n.map(u=>At(u)?u.trim():u)),i.number&&(s=n.map(Ma)));let a,l=r[a=gi(t)]||r[a=gi(sn(t))];!l&&o&&(l=r[a=gi(Sr(t))]),l&&Tn(l,e,6,s);const c=r[a+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Tn(c,e,6,s)}}const yp=new WeakMap;function md(e,t,n=!1){const r=n?yp:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!We(e)){const l=c=>{const u=md(c,t,!0);u&&(a=!0,Ft(i,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(ft(e)&&r.set(e,null),null):($e(o)?o.forEach(l=>i[l]=null):Ft(i,o),ft(e)&&r.set(e,i),i)}function oi(e,t){return!e||!Jo(t)?!1:(t=t.slice(2).replace(/Once$/,""),dt(e,t[0].toLowerCase()+t.slice(1))||dt(e,Sr(t))||dt(e,t))}function $l(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:c,renderCache:u,props:f,data:m,setupState:_,ctx:$,inheritAttrs:A}=e,L=$o(e);let X,O;try{if(n.shapeFlag&4){const V=s||r,fe=V;X=Pn(c.call(fe,V,u,f,_,m,$)),O=a}else{const V=t;X=Pn(V.length>1?V(f,{attrs:a,slots:i,emit:l}):V(f,null)),O=t.props?a:wp(a)}}catch(V){Bs.length=0,ti(V,e,1),X=Ae(Jt)}let z=X;if(O&&A!==!1){const V=Object.keys(O),{shapeFlag:fe}=z;V.length&&fe&7&&(o&&V.some(Ra)&&(O=bp(O,o)),z=Ir(z,O,!1,!0))}return n.dirs&&(z=Ir(z,null,!1,!0),z.dirs=z.dirs?z.dirs.concat(n.dirs):n.dirs),n.transition&&Gs(z,n.transition),X=z,$o(L),X}const wp=e=>{let t;for(const n in e)(n==="class"||n==="style"||Jo(n))&&((t||(t={}))[n]=e[n]);return t},bp=(e,t)=>{const n={};for(const r in e)(!Ra(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function _p(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,c=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?Dl(r,i,c):!!i;if(l&8){const u=t.dynamicProps;for(let f=0;f<u.length;f++){const m=u[f];if(gd(i,r,m)&&!oi(c,m))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?Dl(r,i,c):!0:!!i;return!1}function Dl(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(gd(t,e,o)&&!oi(n,o))return!0}return!1}function gd(e,t,n){const r=e[n],s=t[n];return n==="style"&&ft(r)&&ft(s)?!Oa(r,s):r!==s}function kp({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 vd={},yd=()=>Object.create(vd),wd=e=>Object.getPrototypeOf(e)===vd;function Tp(e,t,n,r=!1){const s={},o=yd();e.propsDefaults=Object.create(null),bd(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Wu(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function Ip(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=ct(s),[l]=e.propsOptions;let c=!1;if((r||i>0)&&!(i&16)){if(i&8){const u=e.vnode.dynamicProps;for(let f=0;f<u.length;f++){let m=u[f];if(oi(e.emitsOptions,m))continue;const _=t[m];if(l)if(dt(o,m))_!==o[m]&&(o[m]=_,c=!0);else{const $=sn(m);s[$]=aa(l,a,$,_,e,!1)}else _!==o[m]&&(o[m]=_,c=!0)}}}else{bd(e,t,s,o)&&(c=!0);let u;for(const f in a)(!t||!dt(t,f)&&((u=Sr(f))===f||!dt(t,u)))&&(l?n&&(n[f]!==void 0||n[u]!==void 0)&&(s[f]=aa(l,a,f,void 0,e,!0)):delete s[f]);if(o!==a)for(const f in o)(!t||!dt(t,f))&&(delete o[f],c=!0)}c&&Jn(e.attrs,"set","")}function bd(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(Ns(l))continue;const c=t[l];let u;s&&dt(s,u=sn(l))?!o||!o.includes(u)?n[u]=c:(a||(a={}))[u]=c:oi(e.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,i=!0)}if(o){const l=ct(n),c=a||_t;for(let u=0;u<o.length;u++){const f=o[u];n[f]=aa(s,l,f,c[f],e,!dt(c,f))}}return i}function aa(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=dt(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&We(l)){const{propsDefaults:c}=s;if(n in c)r=c[n];else{const u=oo(s);r=c[n]=l.call(null,t),u()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===Sr(n))&&(r=!0))}return r}const Sp=new WeakMap;function _d(e,t,n=!1){const r=n?Sp:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!We(e)){const u=f=>{l=!0;const[m,_]=_d(f,t,!0);Ft(i,m),_&&a.push(..._)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!o&&!l)return ft(e)&&r.set(e,ss),ss;if($e(o))for(let u=0;u<o.length;u++){const f=sn(o[u]);Ll(f)&&(i[f]=_t)}else if(o)for(const u in o){const f=sn(u);if(Ll(f)){const m=o[u],_=i[f]=$e(m)||We(m)?{type:m}:Ft({},m),$=_.type;let A=!1,L=!0;if($e($))for(let X=0;X<$.length;++X){const O=$[X],z=We(O)&&O.name;if(z==="Boolean"){A=!0;break}else z==="String"&&(L=!1)}else A=We($)&&$.name==="Boolean";_[0]=A,_[1]=L,(A||dt(_,"default"))&&a.push(f)}}const c=[i,a];return ft(e)&&r.set(e,c),c}function Ll(e){return e[0]!=="$"&&!Ns(e)}const Ha=e=>e==="_"||e==="_ctx"||e==="$stable",Va=e=>$e(e)?e.map(Pn):[Pn(e)],Ep=(e,t,n)=>{if(t._n)return t;const r=pt((...s)=>Va(t(...s)),n);return r._c=!1,r},kd=(e,t,n)=>{const r=e._ctx;for(const s in e){if(Ha(s))continue;const o=e[s];if(We(o))t[s]=Ep(s,o,r);else if(o!=null){const i=Va(o);t[s]=()=>i}}},Td=(e,t)=>{const n=Va(t);e.slots.default=()=>n},Id=(e,t,n)=>{for(const r in t)(n||!Ha(r))&&(e[r]=t[r])},Cp=(e,t,n)=>{const r=e.slots=yd();if(e.vnode.shapeFlag&32){const s=t._;s?(Id(r,t,n),n&&Eu(r,"_",s,!0)):kd(t,r)}else t&&Td(e,t)},Ap=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=_t;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:Id(s,t,n):(o=!t.$stable,kd(t,s)),i=t}else t&&(Td(e,t),i={default:1});if(o)for(const a in s)!Ha(a)&&i[a]==null&&delete s[a]},qt=Op;function Rp(e){return Pp(e)}function Pp(e,t){const n=Xo();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:m,setScopeId:_=$n,insertStaticContent:$}=e,A=(g,v,C,B=null,F=null,P=null,U=void 0,j=null,K=!!v.dynamicChildren)=>{if(g===v)return;g&&!jr(g,v)&&(B=W(g),Xe(g,F,P,!0),g=null),v.patchFlag===-2&&(K=!1,v.dynamicChildren=null);const{type:H,ref:_e,shapeFlag:ue}=v;switch(H){case ii:L(g,v,C,B);break;case Jt:X(g,v,C,B);break;case Ii:g==null&&O(v,C,B,U);break;case Le:ne(g,v,C,B,F,P,U,j,K);break;default:ue&1?fe(g,v,C,B,F,P,U,j,K):ue&6?je(g,v,C,B,F,P,U,j,K):(ue&64||ue&128)&&H.process(g,v,C,B,F,P,U,j,K,pe)}_e!=null&&F?js(_e,g&&g.ref,P,v||g,!v):_e==null&&g&&g.ref!=null&&js(g.ref,null,P,g,!0)},L=(g,v,C,B)=>{if(g==null)r(v.el=a(v.children),C,B);else{const F=v.el=g.el;v.children!==g.children&&c(F,v.children)}},X=(g,v,C,B)=>{g==null?r(v.el=l(v.children||""),C,B):v.el=g.el},O=(g,v,C,B)=>{[g.el,g.anchor]=$(g.children,v,C,B,g.el,g.anchor)},z=({el:g,anchor:v},C,B)=>{let F;for(;g&&g!==v;)F=m(g),r(g,C,B),g=F;r(v,C,B)},V=({el:g,anchor:v})=>{let C;for(;g&&g!==v;)C=m(g),s(g),g=C;s(v)},fe=(g,v,C,B,F,P,U,j,K)=>{if(v.type==="svg"?U="svg":v.type==="math"&&(U="mathml"),g==null)ie(v,C,B,F,P,U,j,K);else{const H=g.el&&g.el._isVueCE?g.el:null;try{H&&H._beginPatch(),re(g,v,F,P,U,j,K)}finally{H&&H._endPatch()}}},ie=(g,v,C,B,F,P,U,j)=>{let K,H;const{props:_e,shapeFlag:ue,transition:ve,dirs:Se}=g;if(K=g.el=i(g.type,P,_e&&_e.is,_e),ue&8?u(K,g.children):ue&16&&Te(g.children,K,null,B,F,Ti(g,P),U,j),Se&&xr(g,null,B,"created"),ye(K,g,g.scopeId,U,B),_e){for(const Ke in _e)Ke!=="value"&&!Ns(Ke)&&o(K,Ke,null,_e[Ke],P,B);"value"in _e&&o(K,"value",null,_e.value,P),(H=_e.onVnodeBeforeMount)&&En(H,B,g)}Se&&xr(g,null,B,"beforeMount");const Pe=xp(F,ve);Pe&&ve.beforeEnter(K),r(K,v,C),((H=_e&&_e.onVnodeMounted)||Pe||Se)&&qt(()=>{H&&En(H,B,g),Pe&&ve.enter(K),Se&&xr(g,null,B,"mounted")},F)},ye=(g,v,C,B,F)=>{if(C&&_(g,C),B)for(let P=0;P<B.length;P++)_(g,B[P]);if(F){let P=F.subTree;if(v===P||Cd(P.type)&&(P.ssContent===v||P.ssFallback===v)){const U=F.vnode;ye(g,U,U.scopeId,U.slotScopeIds,F.parent)}}},Te=(g,v,C,B,F,P,U,j,K=0)=>{for(let H=K;H<g.length;H++){const _e=g[H]=j?Kn(g[H]):Pn(g[H]);A(null,_e,v,C,B,F,P,U,j)}},re=(g,v,C,B,F,P,U)=>{const j=v.el=g.el;let{patchFlag:K,dynamicChildren:H,dirs:_e}=v;K|=g.patchFlag&16;const ue=g.props||_t,ve=v.props||_t;let Se;if(C&&Mr(C,!1),(Se=ve.onVnodeBeforeUpdate)&&En(Se,C,v,g),_e&&xr(v,g,C,"beforeUpdate"),C&&Mr(C,!0),(ue.innerHTML&&ve.innerHTML==null||ue.textContent&&ve.textContent==null)&&u(j,""),H?ee(g.dynamicChildren,H,j,C,B,Ti(v,F),P):U||Oe(g,v,j,null,C,B,Ti(v,F),P,!1),K>0){if(K&16)we(j,ue,ve,C,F);else if(K&2&&ue.class!==ve.class&&o(j,"class",null,ve.class,F),K&4&&o(j,"style",ue.style,ve.style,F),K&8){const Pe=v.dynamicProps;for(let Ke=0;Ke<Pe.length;Ke++){const xe=Pe[Ke],He=ue[xe],kt=ve[xe];(kt!==He||xe==="value")&&o(j,xe,He,kt,F,C)}}K&1&&g.children!==v.children&&u(j,v.children)}else!U&&H==null&&we(j,ue,ve,C,F);((Se=ve.onVnodeUpdated)||_e)&&qt(()=>{Se&&En(Se,C,v,g),_e&&xr(v,g,C,"updated")},B)},ee=(g,v,C,B,F,P,U)=>{for(let j=0;j<v.length;j++){const K=g[j],H=v[j],_e=K.el&&(K.type===Le||!jr(K,H)||K.shapeFlag&198)?f(K.el):C;A(K,H,_e,null,B,F,P,U,!0)}},we=(g,v,C,B,F)=>{if(v!==C){if(v!==_t)for(const P in v)!Ns(P)&&!(P in C)&&o(g,P,v[P],null,F,B);for(const P in C){if(Ns(P))continue;const U=C[P],j=v[P];U!==j&&P!=="value"&&o(g,P,j,U,F,B)}"value"in C&&o(g,"value",v.value,C.value,F)}},ne=(g,v,C,B,F,P,U,j,K)=>{const H=v.el=g?g.el:a(""),_e=v.anchor=g?g.anchor:a("");let{patchFlag:ue,dynamicChildren:ve,slotScopeIds:Se}=v;Se&&(j=j?j.concat(Se):Se),g==null?(r(H,C,B),r(_e,C,B),Te(v.children||[],C,_e,F,P,U,j,K)):ue>0&&ue&64&&ve&&g.dynamicChildren&&g.dynamicChildren.length===ve.length?(ee(g.dynamicChildren,ve,C,F,P,U,j),(v.key!=null||F&&v===F.subTree)&&Wa(g,v,!0)):Oe(g,v,C,_e,F,P,U,j,K)},je=(g,v,C,B,F,P,U,j,K)=>{v.slotScopeIds=j,g==null?v.shapeFlag&512?F.ctx.activate(v,C,B,U,K):Fe(v,C,B,F,P,U,K):et(g,v,K)},Fe=(g,v,C,B,F,P,U)=>{const j=g.component=Fp(g,B,F);if(ni(g)&&(j.ctx.renderer=pe),Bp(j,!1,U),j.asyncDep){if(F&&F.registerDep(j,De,U),!g.el){const K=j.subTree=Ae(Jt);X(null,K,v,C),g.placeholder=K.el}}else De(j,g,v,C,F,P,U)},et=(g,v,C)=>{const B=v.component=g.component;if(_p(g,v,C))if(B.asyncDep&&!B.asyncResolved){Ee(B,v,C);return}else B.next=v,B.update();else v.el=g.el,B.vnode=v},De=(g,v,C,B,F,P,U)=>{const j=()=>{if(g.isMounted){let{next:ue,bu:ve,u:Se,parent:Pe,vnode:Ke}=g;{const Je=Sd(g);if(Je){ue&&(ue.el=Ke.el,Ee(g,ue,U)),Je.asyncDep.then(()=>{qt(()=>{g.isUnmounted||H()},F)});return}}let xe=ue,He;Mr(g,!1),ue?(ue.el=Ke.el,Ee(g,ue,U)):ue=Ke,ve&&To(ve),(He=ue.props&&ue.props.onVnodeBeforeUpdate)&&En(He,Pe,ue,Ke),Mr(g,!0);const kt=$l(g),ze=g.subTree;g.subTree=kt,A(ze,kt,f(ze.el),W(ze),g,F,P),ue.el=kt.el,xe===null&&kp(g,kt.el),Se&&qt(Se,F),(He=ue.props&&ue.props.onVnodeUpdated)&&qt(()=>En(He,Pe,ue,Ke),F)}else{let ue;const{el:ve,props:Se}=v,{bm:Pe,m:Ke,parent:xe,root:He,type:kt}=g,ze=as(v);Mr(g,!1),Pe&&To(Pe),!ze&&(ue=Se&&Se.onVnodeBeforeMount)&&En(ue,xe,v),Mr(g,!0);{He.ce&&He.ce._hasShadowRoot()&&He.ce._injectChildStyle(kt,g.parent?g.parent.type:void 0);const Je=g.subTree=$l(g);A(null,Je,C,B,g,F,P),v.el=Je.el}if(Ke&&qt(Ke,F),!ze&&(ue=Se&&Se.onVnodeMounted)){const Je=v;qt(()=>En(ue,xe,Je),F)}(v.shapeFlag&256||xe&&as(xe.vnode)&&xe.vnode.shapeFlag&256)&&g.a&&qt(g.a,F),g.isMounted=!0,v=C=B=null}};g.scope.on();const K=g.effect=new Pu(j);g.scope.off();const H=g.update=K.run.bind(K),_e=g.job=K.runIfDirty.bind(K);_e.i=g,_e.id=g.uid,K.scheduler=()=>Ua(_e),Mr(g,!0),H()},Ee=(g,v,C)=>{v.component=g;const B=g.vnode.props;g.vnode=v,g.next=null,Ip(g,v.props,B,C),Ap(g,v.children,C),er(),Tl(g),tr()},Oe=(g,v,C,B,F,P,U,j,K=!1)=>{const H=g&&g.children,_e=g?g.shapeFlag:0,ue=v.children,{patchFlag:ve,shapeFlag:Se}=v;if(ve>0){if(ve&128){Qe(H,ue,C,B,F,P,U,j,K);return}else if(ve&256){tt(H,ue,C,B,F,P,U,j,K);return}}Se&8?(_e&16&&nt(H,F,P),ue!==H&&u(C,ue)):_e&16?Se&16?Qe(H,ue,C,B,F,P,U,j,K):nt(H,F,P,!0):(_e&8&&u(C,""),Se&16&&Te(ue,C,B,F,P,U,j,K))},tt=(g,v,C,B,F,P,U,j,K)=>{g=g||ss,v=v||ss;const H=g.length,_e=v.length,ue=Math.min(H,_e);let ve;for(ve=0;ve<ue;ve++){const Se=v[ve]=K?Kn(v[ve]):Pn(v[ve]);A(g[ve],Se,C,null,F,P,U,j,K)}H>_e?nt(g,F,P,!0,!1,ue):Te(v,C,B,F,P,U,j,K,ue)},Qe=(g,v,C,B,F,P,U,j,K)=>{let H=0;const _e=v.length;let ue=g.length-1,ve=_e-1;for(;H<=ue&&H<=ve;){const Se=g[H],Pe=v[H]=K?Kn(v[H]):Pn(v[H]);if(jr(Se,Pe))A(Se,Pe,C,null,F,P,U,j,K);else break;H++}for(;H<=ue&&H<=ve;){const Se=g[ue],Pe=v[ve]=K?Kn(v[ve]):Pn(v[ve]);if(jr(Se,Pe))A(Se,Pe,C,null,F,P,U,j,K);else break;ue--,ve--}if(H>ue){if(H<=ve){const Se=ve+1,Pe=Se<_e?v[Se].el:B;for(;H<=ve;)A(null,v[H]=K?Kn(v[H]):Pn(v[H]),C,Pe,F,P,U,j,K),H++}}else if(H>ve)for(;H<=ue;)Xe(g[H],F,P,!0),H++;else{const Se=H,Pe=H,Ke=new Map;for(H=Pe;H<=ve;H++){const vt=v[H]=K?Kn(v[H]):Pn(v[H]);vt.key!=null&&Ke.set(vt.key,H)}let xe,He=0;const kt=ve-Pe+1;let ze=!1,Je=0;const Mt=new Array(kt);for(H=0;H<kt;H++)Mt[H]=0;for(H=Se;H<=ue;H++){const vt=g[H];if(He>=kt){Xe(vt,F,P,!0);continue}let Tt;if(vt.key!=null)Tt=Ke.get(vt.key);else for(xe=Pe;xe<=ve;xe++)if(Mt[xe-Pe]===0&&jr(vt,v[xe])){Tt=xe;break}Tt===void 0?Xe(vt,F,P,!0):(Mt[Tt-Pe]=H+1,Tt>=Je?Je=Tt:ze=!0,A(vt,v[Tt],C,null,F,P,U,j,K),He++)}const Ht=ze?Mp(Mt):ss;for(xe=Ht.length-1,H=kt-1;H>=0;H--){const vt=Pe+H,Tt=v[vt],Ot=v[vt+1],Xt=vt+1<_e?Ot.el||Ed(Ot):B;Mt[H]===0?A(null,Tt,C,Xt,F,P,U,j,K):ze&&(xe<0||H!==Ht[xe]?Ze(Tt,C,Xt,2):xe--)}}},Ze=(g,v,C,B,F=null)=>{const{el:P,type:U,transition:j,children:K,shapeFlag:H}=g;if(H&6){Ze(g.component.subTree,v,C,B);return}if(H&128){g.suspense.move(v,C,B);return}if(H&64){U.move(g,v,C,pe);return}if(U===Le){r(P,v,C);for(let ue=0;ue<K.length;ue++)Ze(K[ue],v,C,B);r(g.anchor,v,C);return}if(U===Ii){z(g,v,C);return}if(B!==2&&H&1&&j)if(B===0)j.beforeEnter(P),r(P,v,C),qt(()=>j.enter(P),F);else{const{leave:ue,delayLeave:ve,afterLeave:Se}=j,Pe=()=>{g.ctx.isUnmounted?s(P):r(P,v,C)},Ke=()=>{P._isLeaving&&P[An](!0),ue(P,()=>{Pe(),Se&&Se()})};ve?ve(P,Pe,Ke):Ke()}else r(P,v,C)},Xe=(g,v,C,B=!1,F=!1)=>{const{type:P,props:U,ref:j,children:K,dynamicChildren:H,shapeFlag:_e,patchFlag:ue,dirs:ve,cacheIndex:Se}=g;if(ue===-2&&(F=!1),j!=null&&(er(),js(j,null,C,g,!0),tr()),Se!=null&&(v.renderCache[Se]=void 0),_e&256){v.ctx.deactivate(g);return}const Pe=_e&1&&ve,Ke=!as(g);let xe;if(Ke&&(xe=U&&U.onVnodeBeforeUnmount)&&En(xe,v,g),_e&6)qe(g.component,C,B);else{if(_e&128){g.suspense.unmount(C,B);return}Pe&&xr(g,null,v,"beforeUnmount"),_e&64?g.type.remove(g,v,C,pe,B):H&&!H.hasOnce&&(P!==Le||ue>0&&ue&64)?nt(H,v,C,!1,!0):(P===Le&&ue&384||!F&&_e&16)&&nt(K,v,C),B&&ht(g)}(Ke&&(xe=U&&U.onVnodeUnmounted)||Pe)&&qt(()=>{xe&&En(xe,v,g),Pe&&xr(g,null,v,"unmounted")},C)},ht=g=>{const{type:v,el:C,anchor:B,transition:F}=g;if(v===Le){Pt(C,B);return}if(v===Ii){V(g);return}const P=()=>{s(C),F&&!F.persisted&&F.afterLeave&&F.afterLeave()};if(g.shapeFlag&1&&F&&!F.persisted){const{leave:U,delayLeave:j}=F,K=()=>U(C,P);j?j(g.el,P,K):K()}else P()},Pt=(g,v)=>{let C;for(;g!==v;)C=m(g),s(g),g=C;s(v)},qe=(g,v,C)=>{const{bum:B,scope:F,job:P,subTree:U,um:j,m:K,a:H}=g;jl(K),jl(H),B&&To(B),F.stop(),P&&(P.flags|=8,Xe(U,g,v,C)),j&&qt(j,v),qt(()=>{g.isUnmounted=!0},v)},nt=(g,v,C,B=!1,F=!1,P=0)=>{for(let U=P;U<g.length;U++)Xe(g[U],v,C,B,F)},W=g=>{if(g.shapeFlag&6)return W(g.component.subTree);if(g.shapeFlag&128)return g.suspense.next();const v=m(g.anchor||g.el),C=v&&v[ed];return C?m(C):v};let me=!1;const ae=(g,v,C)=>{let B;g==null?v._vnode&&(Xe(v._vnode,null,null,!0),B=v._vnode.component):A(v._vnode||null,g,v,null,null,null,C),v._vnode=g,me||(me=!0,Tl(B),Ju(),me=!1)},pe={p:A,um:Xe,m:Ze,r:ht,mt:Fe,mc:Te,pc:Oe,pbc:ee,n:W,o:e};return{render:ae,hydrate:void 0,createApp:mp(ae)}}function Ti({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 Mr({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function xp(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Wa(e,t,n=!1){const r=e.children,s=t.children;if($e(r)&&$e(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]=Kn(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&Wa(i,a)),a.type===ii&&(a.patchFlag===-1&&(a=s[o]=Kn(a)),a.el=i.el),a.type===Jt&&!a.el&&(a.el=i.el)}}function Mp(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const c=e[r];if(c!==0){if(s=n[n.length-1],e[s]<c){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<c?o=a+1:i=a;c<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 Sd(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Sd(t)}function jl(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Ed(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Ed(t.subTree):null}const Cd=e=>e.__isSuspense;function Op(e,t){t&&t.pendingBranch?$e(e)?t.effects.push(...e):t.effects.push(e):Bh(e)}const Le=Symbol.for("v-fgt"),ii=Symbol.for("v-txt"),Jt=Symbol.for("v-cmt"),Ii=Symbol.for("v-stc"),Bs=[];let hn=null;function w(e=!1){Bs.push(hn=e?null:[])}function Np(){Bs.pop(),hn=Bs[Bs.length-1]||null}let qs=1;function Fo(e,t=!1){qs+=e,e<0&&hn&&t&&(hn.hasOnce=!0)}function Ad(e){return e.dynamicChildren=qs>0?hn||ss:null,Np(),qs>0&&hn&&hn.push(e),e}function T(e,t,n,r,s,o){return Ad(p(e,t,n,r,s,o,!0))}function wt(e,t,n,r,s){return Ad(Ae(e,t,n,r,s,!0))}function Ks(e){return e?e.__v_isVNode===!0:!1}function jr(e,t){return e.type===t.type&&e.key===t.key}const Rd=({key:e})=>e??null,Eo=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?At(e)||Qt(e)||We(e)?{i:zt,r:e,k:t,f:!!n}:e:null);function p(e,t=null,n=null,r=0,s=null,o=e===Le?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Rd(t),ref:t&&Eo(t),scopeId:Qu,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:zt};return a?(za(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=At(n)?8:16),qs>0&&!i&&hn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&hn.push(l),l}const Ae=$p;function $p(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===ud)&&(e=Jt),Ks(e)){const a=Ir(e,t,!0);return n&&za(a,n),qs>0&&!o&&hn&&(a.shapeFlag&6?hn[hn.indexOf(e)]=a:hn.push(a)),a.patchFlag=-2,a}if(Wp(e)&&(e=e.__vccOpts),t){t=Dp(t);let{class:a,style:l}=t;a&&!At(a)&&(t.class=gt(a)),ft(l)&&(Ba(l)&&!$e(l)&&(l=Ft({},l)),t.style=zr(l))}const i=At(e)?1:Cd(e)?128:td(e)?64:ft(e)?4:We(e)?2:0;return p(e,t,n,r,s,i,o,!0)}function Dp(e){return e?Ba(e)||wd(e)?Ft({},e):e:null}function Ir(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,c=t?Pd(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Rd(c),ref:t&&t.ref?n&&o?$e(o)?o.concat(Eo(t)):[o,Eo(t)]:Eo(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!==Le?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&&Ir(e.ssContent),ssFallback:e.ssFallback&&Ir(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Gs(u,l.clone(u)),u}function Js(e=" ",t=0){return Ae(ii,null,e,t)}function oe(e="",t=!1){return t?(w(),wt(Jt,null,e)):Ae(Jt,null,e)}function Pn(e){return e==null||typeof e=="boolean"?Ae(Jt):$e(e)?Ae(Le,null,e.slice()):Ks(e)?Kn(e):Ae(ii,null,String(e))}function Kn(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ir(e)}function za(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if($e(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),za(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!wd(t)?t._ctx=zt:s===3&&zt&&(zt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else We(t)?(t={default:t,_ctx:zt},n=32):(t=String(t),r&64?(n=16,t=[Js(t)]):n=8);e.children=t,e.shapeFlag|=n}function Pd(...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=gt([t.class,r.class]));else if(s==="style")t.style=zr([t.style,r.style]);else if(Jo(s)){const o=t[s],i=r[s];i&&o!==i&&!($e(o)&&o.includes(i))&&(t[s]=o?[].concat(o,i):i)}else s!==""&&(t[s]=r[s])}return t}function En(e,t,n,r=null){Tn(e,t,7,[n,r])}const Lp=pd();let jp=0;function Fp(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Lp,o={uid:jp++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new uh(!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:_d(r,s),emitsOptions:md(r,s),emit:null,emitted:null,propsDefaults:_t,inheritAttrs:r.inheritAttrs,ctx:_t,data:_t,props:_t,attrs:_t,slots:_t,refs:_t,setupState:_t,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=vp.bind(null,o),e.ce&&e.ce(o),o}let Yt=null;const Ga=()=>Yt||zt;let Bo,la;{const e=Xo(),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)}};Bo=t("__VUE_INSTANCE_SETTERS__",n=>Yt=n),la=t("__VUE_SSR_SETTERS__",n=>Ys=n)}const oo=e=>{const t=Yt;return Bo(e),e.scope.on(),()=>{e.scope.off(),Bo(t)}},Fl=()=>{Yt&&Yt.scope.off(),Bo(null)};function xd(e){return e.vnode.shapeFlag&4}let Ys=!1;function Bp(e,t=!1,n=!1){t&&la(t);const{props:r,children:s}=e.vnode,o=xd(e);Tp(e,r,o,t),Cp(e,s,n||t);const i=o?Up(e,t):void 0;return t&&la(!1),i}function Up(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,ip);const{setup:r}=n;if(r){er();const s=e.setupContext=r.length>1?Od(e):null,o=oo(e),i=so(r,e,0,[e.props,s]),a=Tu(i);if(tr(),o(),(a||e.sp)&&!as(e)&&ld(e),a){if(i.then(Fl,Fl),t)return i.then(l=>{Bl(e,l)}).catch(l=>{ti(l,e,0)});e.asyncDep=i}else Bl(e,i)}else Md(e)}function Bl(e,t,n){We(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:ft(t)&&(e.setupState=Gu(t)),Md(e)}function Md(e,t,n){const r=e.type;e.render||(e.render=r.render||$n);{const s=oo(e);er();try{cp(e)}finally{tr(),s()}}}const Hp={get(e,t){return Kt(e,"get",""),e[t]}};function Od(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Hp),slots:e.slots,emit:e.emit,expose:t}}function ai(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Gu(Ph(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Fs)return Fs[n](e)},has(t,n){return n in t||n in Fs}})):e.proxy}function Vp(e,t=!0){return We(e)?e.displayName||e.name:e.name||t&&e.__name}function Wp(e){return We(e)&&"__vccOpts"in e}const he=(e,t)=>$h(e,t,Ys);function qa(e,t,n){try{Fo(-1);const r=arguments.length;return r===2?ft(t)&&!$e(t)?Ks(t)?Ae(e,null,[t]):Ae(e,t):Ae(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Ks(n)&&(n=[n]),Ae(e,t,n))}finally{Fo(1)}}const zp="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 ca;const Ul=typeof window<"u"&&window.trustedTypes;if(Ul)try{ca=Ul.createPolicy("vue",{createHTML:e=>e})}catch{}const Nd=ca?e=>ca.createHTML(e):e=>e,Gp="http://www.w3.org/2000/svg",qp="http://www.w3.org/1998/Math/MathML",qn=typeof document<"u"?document:null,Hl=qn&&qn.createElement("template"),Kp={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"?qn.createElementNS(Gp,e):t==="mathml"?qn.createElementNS(qp,e):n?qn.createElement(e,{is:n}):qn.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>qn.createTextNode(e),createComment:e=>qn.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>qn.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{Hl.innerHTML=Nd(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=Hl.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]}},fr="transition",Rs="animation",Qs=Symbol("_vtc"),$d={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},Jp=Ft({},rd,$d),Yp=e=>(e.displayName="Transition",e.props=Jp,e),Dd=Yp((e,{slots:t})=>qa(qh,Qp(e),t)),Or=(e,t=[])=>{$e(e)?e.forEach(n=>n(...t)):e&&e(...t)},Vl=e=>e?$e(e)?e.some(t=>t.length>1):e.length>1:!1;function Qp(e){const t={};for(const ne in e)ne in $d||(t[ne]=e[ne]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:c=i,appearToClass:u=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:m=`${n}-leave-active`,leaveToClass:_=`${n}-leave-to`}=e,$=Xp(s),A=$&&$[0],L=$&&$[1],{onBeforeEnter:X,onEnter:O,onEnterCancelled:z,onLeave:V,onLeaveCancelled:fe,onBeforeAppear:ie=X,onAppear:ye=O,onAppearCancelled:Te=z}=t,re=(ne,je,Fe,et)=>{ne._enterCancelled=et,Nr(ne,je?u:a),Nr(ne,je?c:i),Fe&&Fe()},ee=(ne,je)=>{ne._isLeaving=!1,Nr(ne,f),Nr(ne,_),Nr(ne,m),je&&je()},we=ne=>(je,Fe)=>{const et=ne?ye:O,De=()=>re(je,ne,Fe);Or(et,[je,De]),Wl(()=>{Nr(je,ne?l:o),zn(je,ne?u:a),Vl(et)||zl(je,r,A,De)})};return Ft(t,{onBeforeEnter(ne){Or(X,[ne]),zn(ne,o),zn(ne,i)},onBeforeAppear(ne){Or(ie,[ne]),zn(ne,l),zn(ne,c)},onEnter:we(!1),onAppear:we(!0),onLeave(ne,je){ne._isLeaving=!0;const Fe=()=>ee(ne,je);zn(ne,f),ne._enterCancelled?(zn(ne,m),Kl(ne)):(Kl(ne),zn(ne,m)),Wl(()=>{ne._isLeaving&&(Nr(ne,f),zn(ne,_),Vl(V)||zl(ne,r,L,Fe))}),Or(V,[ne,Fe])},onEnterCancelled(ne){re(ne,!1,void 0,!0),Or(z,[ne])},onAppearCancelled(ne){re(ne,!0,void 0,!0),Or(Te,[ne])},onLeaveCancelled(ne){ee(ne),Or(fe,[ne])}})}function Xp(e){if(e==null)return null;if(ft(e))return[Si(e.enter),Si(e.leave)];{const t=Si(e);return[t,t]}}function Si(e){return nh(e)}function zn(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Qs]||(e[Qs]=new Set)).add(t)}function Nr(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Qs];n&&(n.delete(t),n.size||(e[Qs]=void 0))}function Wl(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Zp=0;function zl(e,t,n,r){const s=e._endId=++Zp,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=em(e,t);if(!i)return r();const c=i+"end";let u=0;const f=()=>{e.removeEventListener(c,m),o()},m=_=>{_.target===e&&++u>=l&&f()};setTimeout(()=>{u<l&&f()},a+1),e.addEventListener(c,m)}function em(e,t){const n=window.getComputedStyle(e),r=$=>(n[$]||"").split(", "),s=r(`${fr}Delay`),o=r(`${fr}Duration`),i=Gl(s,o),a=r(`${Rs}Delay`),l=r(`${Rs}Duration`),c=Gl(a,l);let u=null,f=0,m=0;t===fr?i>0&&(u=fr,f=i,m=o.length):t===Rs?c>0&&(u=Rs,f=c,m=l.length):(f=Math.max(i,c),u=f>0?i>c?fr:Rs:null,m=u?u===fr?o.length:l.length:0);const _=u===fr&&/\b(?:transform|all)(?:,|$)/.test(r(`${fr}Property`).toString());return{type:u,timeout:f,propCount:m,hasTransform:_}}function Gl(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>ql(n)+ql(e[r])))}function ql(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Kl(e){return(e?e.ownerDocument:document).body.offsetHeight}function tm(e,t,n){const r=e[Qs];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Jl=Symbol("_vod"),nm=Symbol("_vsh"),rm=Symbol(""),sm=/(?:^|;)\s*display\s*:/;function om(e,t,n){const r=e.style,s=At(n);let o=!1;if(n&&!s){if(t)if(At(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&Co(r,a,"")}else for(const i in t)n[i]==null&&Co(r,i,"");for(const i in n)i==="display"&&(o=!0),Co(r,i,n[i])}else if(s){if(t!==n){const i=r[rm];i&&(n+=";"+i),r.cssText=n,o=sm.test(n)}}else t&&e.removeAttribute("style");Jl in e&&(e[Jl]=o?r.display:"",e[nm]&&(r.display="none"))}const Yl=/\s*!important$/;function Co(e,t,n){if($e(n))n.forEach(r=>Co(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=im(e,t);Yl.test(n)?e.setProperty(Sr(r),n.replace(Yl,""),"important"):e[r]=n}}const Ql=["Webkit","Moz","ms"],Ei={};function im(e,t){const n=Ei[t];if(n)return n;let r=sn(t);if(r!=="filter"&&r in e)return Ei[t]=r;r=Qo(r);for(let s=0;s<Ql.length;s++){const o=Ql[s]+r;if(o in e)return Ei[t]=o}return t}const Xl="http://www.w3.org/1999/xlink";function Zl(e,t,n,r,s,o=lh(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Xl,t.slice(6,t.length)):e.setAttributeNS(Xl,t,n):n==null||o&&!Cu(n)?e.removeAttribute(t):e.setAttribute(t,o?"":_n(n)?String(n):n)}function ec(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Nd(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=Cu(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 ns(e,t,n,r){e.addEventListener(t,n,r)}function am(e,t,n,r){e.removeEventListener(t,n,r)}const tc=Symbol("_vei");function lm(e,t,n,r,s=null){const o=e[tc]||(e[tc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=cm(t);if(r){const c=o[t]=fm(r,s);ns(e,a,c,l)}else i&&(am(e,a,i,l),o[t]=void 0)}}const nc=/(?:Once|Passive|Capture)$/;function cm(e){let t;if(nc.test(e)){t={};let r;for(;r=e.match(nc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Sr(e.slice(2)),t]}let Ci=0;const um=Promise.resolve(),dm=()=>Ci||(um.then(()=>Ci=0),Ci=Date.now());function fm(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Tn(hm(r,n.value),t,5,[r])};return n.value=e,n.attached=dm(),n}function hm(e,t){if($e(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 rc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,pm=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?tm(e,r,i):t==="style"?om(e,n,r):Jo(t)?Ra(t)||lm(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):mm(e,t,r,i))?(ec(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Zl(e,t,r,i,o,t!=="value")):e._isVueCE&&(gm(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!At(r)))?ec(e,sn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Zl(e,t,r,i))};function mm(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&rc(t)&&We(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 rc(t)&&At(n)?!1:t in e}function gm(e,t){const n=e._def.props;if(!n)return!1;const r=sn(t);return Array.isArray(n)?n.some(s=>sn(s)===r):Object.keys(n).some(s=>sn(s)===r)}const sc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return $e(t)?n=>To(t,n):t};function vm(e){e.target.composing=!0}function oc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Ai=Symbol("_assign");function ic(e,t,n){return t&&(e=e.trim()),n&&(e=Ma(e)),e}const sr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Ai]=sc(s);const o=r||s.props&&s.props.type==="number";ns(e,t?"change":"input",i=>{i.target.composing||e[Ai](ic(e.value,n,o))}),(n||o)&&ns(e,"change",()=>{e.value=ic(e.value,n,o)}),t||(ns(e,"compositionstart",vm),ns(e,"compositionend",oc),ns(e,"change",oc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[Ai]=sc(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?Ma(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))}},ym=["ctrl","shift","alt","meta"],wm={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)=>ym.some(n=>e[`${n}Key`]&&!t.includes(n))},rt=(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=wm[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},bm={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},rn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=Sr(s.key);if(t.some(i=>i===o||bm[i]===o))return e(s)}))},_m=Ft({patchProp:pm},Kp);let ac;function km(){return ac||(ac=Rp(_m))}const Tm=((...e)=>{const t=km().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=Sm(r);if(!s)return;const o=t._component;!We(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,Im(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function Im(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Sm(e){return At(e)?document.querySelector(e):e}/*!
|
|
18
|
+
* vue-router v4.6.4
|
|
19
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
20
|
+
* @license MIT
|
|
21
|
+
*/const rs=typeof document<"u";function Ld(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Em(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Ld(e.default)}const ut=Object.assign;function Ri(e,t){const n={};for(const r in t){const s=t[r];n[r]=In(s)?s.map(e):e(s)}return n}const Us=()=>{},In=Array.isArray;function lc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const jd=/#/g,Cm=/&/g,Am=/\//g,Rm=/=/g,Pm=/\?/g,Fd=/\+/g,xm=/%5B/g,Mm=/%5D/g,Bd=/%5E/g,Om=/%60/g,Ud=/%7B/g,Nm=/%7C/g,Hd=/%7D/g,$m=/%20/g;function Ka(e){return e==null?"":encodeURI(""+e).replace(Nm,"|").replace(xm,"[").replace(Mm,"]")}function Dm(e){return Ka(e).replace(Ud,"{").replace(Hd,"}").replace(Bd,"^")}function ua(e){return Ka(e).replace(Fd,"%2B").replace($m,"+").replace(jd,"%23").replace(Cm,"%26").replace(Om,"`").replace(Ud,"{").replace(Hd,"}").replace(Bd,"^")}function Lm(e){return ua(e).replace(Rm,"%3D")}function jm(e){return Ka(e).replace(jd,"%23").replace(Pm,"%3F")}function Fm(e){return jm(e).replace(Am,"%2F")}function Xs(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Bm=/\/$/,Um=e=>e.replace(Bm,"");function Pi(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=zm(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:Xs(i)}}function Hm(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function cc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Vm(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&ps(t.matched[r],n.matched[s])&&Vd(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ps(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Vd(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Wm(e[n],t[n]))return!1;return!0}function Wm(e,t){return In(e)?uc(e,t):In(t)?uc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function uc(e,t){return In(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function zm(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 hr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let da=(function(e){return e.pop="pop",e.push="push",e})({}),xi=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Gm(e){if(!e)if(rs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Um(e)}const qm=/^[^#]+#/;function Km(e,t){return e.replace(qm,"#")+t}function Jm(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 li=()=>({left:window.scrollX,top:window.scrollY});function Ym(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=Jm(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 dc(e,t){return(history.state?history.state.position-t:-1)+e}const fa=new Map;function Qm(e,t){fa.set(e,t)}function Xm(e){const t=fa.get(e);return fa.delete(e),t}function Zm(e){return typeof e=="string"||e&&typeof e=="object"}function Wd(e){return typeof e=="string"||typeof e=="symbol"}let Rt=(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 zd=Symbol("");Rt.MATCHER_NOT_FOUND+"",Rt.NAVIGATION_GUARD_REDIRECT+"",Rt.NAVIGATION_ABORTED+"",Rt.NAVIGATION_CANCELLED+"",Rt.NAVIGATION_DUPLICATED+"";function ms(e,t){return ut(new Error,{type:e,[zd]:!0},t)}function Gn(e,t){return e instanceof Error&&zd in e&&(t==null||!!(e.type&t))}const eg=["params","query","hash"];function tg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of eg)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function ng(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(Fd," "),o=s.indexOf("="),i=Xs(o<0?s:s.slice(0,o)),a=o<0?null:Xs(s.slice(o+1));if(i in t){let l=t[i];In(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function fc(e){let t="";for(let n in e){const r=e[n];if(n=Lm(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(In(r)?r.map(s=>s&&ua(s)):[r&&ua(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function rg(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=In(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const sg=Symbol(""),hc=Symbol(""),ci=Symbol(""),Ja=Symbol(""),ha=Symbol("");function Ps(){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 vr(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=m=>{m===!1?l(ms(Rt.NAVIGATION_ABORTED,{from:n,to:t})):m instanceof Error?l(m):Zm(m)?l(ms(Rt.NAVIGATION_GUARD_REDIRECT,{from:t,to:m})):(i&&r.enterCallbacks[s]===i&&typeof m=="function"&&i.push(m),a())},u=o(()=>e.call(r&&r.instances[s],t,n,c));let f=Promise.resolve(u);e.length<3&&(f=f.then(c)),f.catch(m=>l(m))})}function Mi(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(Ld(l)){const c=(l.__vccOpts||l)[t];c&&o.push(vr(c,n,r,i,a,s))}else{let c=l();o.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const f=Em(u)?u.default:u;i.mods[a]=u,i.components[a]=f;const m=(f.__vccOpts||f)[t];return m&&vr(m,n,r,i,a,s)()}))}}return o}function og(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(c=>ps(c,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(c=>ps(c,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 ig=()=>location.protocol+"//"+location.host;function Gd(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),cc(a,"")}return cc(n,e)+r+s}function ag(e,t,n,r){let s=[],o=[],i=null;const a=({state:m})=>{const _=Gd(e,location),$=n.value,A=t.value;let L=0;if(m){if(n.value=_,t.value=m,i&&i===$){i=null;return}L=A?m.position-A.position:0}else r(_);s.forEach(X=>{X(n.value,$,{delta:L,type:da.pop,direction:L?L>0?xi.forward:xi.back:xi.unknown})})};function l(){i=n.value}function c(m){s.push(m);const _=()=>{const $=s.indexOf(m);$>-1&&s.splice($,1)};return o.push(_),_}function u(){if(document.visibilityState==="hidden"){const{history:m}=window;if(!m.state)return;m.replaceState(ut({},m.state,{scroll:li()}),"")}}function f(){for(const m of o)m();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:f}}function pc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?li():null}}function lg(e){const{history:t,location:n}=window,r={value:Gd(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,c,u){const f=e.indexOf("#"),m=f>-1?(n.host&&document.querySelector("base")?e:e.slice(f))+l:ig()+e+l;try{t[u?"replaceState":"pushState"](c,"",m),s.value=c}catch(_){console.error(_),n[u?"replace":"assign"](m)}}function i(l,c){o(l,ut({},t.state,pc(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),r.value=l}function a(l,c){const u=ut({},s.value,t.state,{forward:l,scroll:li()});o(u.current,u,!0),o(l,ut({},pc(r.value,l,null),{position:u.position+1},c),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function cg(e){e=Gm(e);const t=lg(e),n=ag(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=ut({location:"",base:e,go:r,createHref:Km.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 ug(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),cg(e)}let Br=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var jt=(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})(jt||{});const dg={type:Br.Static,value:""},fg=/[a-zA-Z0-9_]/;function hg(e){if(!e)return[[]];if(e==="/")return[[dg]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(_){throw new Error(`ERR (${n})/"${c}": ${_}`)}let n=jt.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,c="",u="";function f(){c&&(n===jt.Static?o.push({type:Br.Static,value:c}):n===jt.Param||n===jt.ParamRegExp||n===jt.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),o.push({type:Br.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function m(){c+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==jt.ParamRegExp){r=n,n=jt.EscapeNext;continue}switch(n){case jt.Static:l==="/"?(c&&f(),i()):l===":"?(f(),n=jt.Param):m();break;case jt.EscapeNext:m(),n=r;break;case jt.Param:l==="("?n=jt.ParamRegExp:fg.test(l)?m():(f(),n=jt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case jt.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=jt.ParamRegExpEnd:u+=l;break;case jt.ParamRegExpEnd:f(),n=jt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===jt.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),f(),i(),s}const mc="[^/]+?",pg={sensitive:!1,strict:!1,start:!0,end:!0};var tn=(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})(tn||{});const mg=/[.+*?^${}()[\]/\\]/g;function gg(e,t){const n=ut({},pg,t),r=[];let s=n.start?"^":"";const o=[];for(const c of e){const u=c.length?[]:[tn.Root];n.strict&&!c.length&&(s+="/");for(let f=0;f<c.length;f++){const m=c[f];let _=tn.Segment+(n.sensitive?tn.BonusCaseSensitive:0);if(m.type===Br.Static)f||(s+="/"),s+=m.value.replace(mg,"\\$&"),_+=tn.Static;else if(m.type===Br.Param){const{value:$,repeatable:A,optional:L,regexp:X}=m;o.push({name:$,repeatable:A,optional:L});const O=X||mc;if(O!==mc){_+=tn.BonusCustomRegExp;try{`${O}`}catch(V){throw new Error(`Invalid custom RegExp for param "${$}" (${O}): `+V.message)}}let z=A?`((?:${O})(?:/(?:${O}))*)`:`(${O})`;f||(z=L&&c.length<2?`(?:/${z})`:"/"+z),L&&(z+="?"),s+=z,_+=tn.Dynamic,L&&(_+=tn.BonusOptional),A&&(_+=tn.BonusRepeatable),O===".*"&&(_+=tn.BonusWildcard)}u.push(_)}r.push(u)}if(n.strict&&n.end){const c=r.length-1;r[c][r[c].length-1]+=tn.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(c){const u=c.match(i),f={};if(!u)return null;for(let m=1;m<u.length;m++){const _=u[m]||"",$=o[m-1];f[$.name]=_&&$.repeatable?_.split("/"):_}return f}function l(c){let u="",f=!1;for(const m of e){(!f||!u.endsWith("/"))&&(u+="/"),f=!1;for(const _ of m)if(_.type===Br.Static)u+=_.value;else if(_.type===Br.Param){const{value:$,repeatable:A,optional:L}=_,X=$ in c?c[$]:"";if(In(X)&&!A)throw new Error(`Provided param "${$}" is an array but it is not repeatable (* or + modifiers)`);const O=In(X)?X.join("/"):X;if(!O)if(L)m.length<2&&(u.endsWith("/")?u=u.slice(0,-1):f=!0);else throw new Error(`Missing required param "${$}"`);u+=O}}return u||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function vg(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]===tn.Static+tn.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===tn.Static+tn.Segment?1:-1:0}function qd(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=vg(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(gc(r))return 1;if(gc(s))return-1}return s.length-r.length}function gc(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const yg={strict:!1,end:!0,sensitive:!1};function wg(e,t,n){const r=gg(hg(e.path),n),s=ut(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function bg(e,t){const n=[],r=new Map;t=lc(yg,t);function s(f){return r.get(f)}function o(f,m,_){const $=!_,A=yc(f);A.aliasOf=_&&_.record;const L=lc(t,f),X=[A];if("alias"in f){const V=typeof f.alias=="string"?[f.alias]:f.alias;for(const fe of V)X.push(yc(ut({},A,{components:_?_.record.components:A.components,path:fe,aliasOf:_?_.record:A})))}let O,z;for(const V of X){const{path:fe}=V;if(m&&fe[0]!=="/"){const ie=m.record.path,ye=ie[ie.length-1]==="/"?"":"/";V.path=m.record.path+(fe&&ye+fe)}if(O=wg(V,m,L),_?_.alias.push(O):(z=z||O,z!==O&&z.alias.push(O),$&&f.name&&!wc(O)&&i(f.name)),Kd(O)&&l(O),A.children){const ie=A.children;for(let ye=0;ye<ie.length;ye++)o(ie[ye],O,_&&_.children[ye])}_=_||O}return z?()=>{i(z)}:Us}function i(f){if(Wd(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=Tg(f,n);n.splice(m,0,f),f.record.name&&!wc(f)&&r.set(f.record.name,f)}function c(f,m){let _,$={},A,L;if("name"in f&&f.name){if(_=r.get(f.name),!_)throw ms(Rt.MATCHER_NOT_FOUND,{location:f});L=_.record.name,$=ut(vc(m.params,_.keys.filter(z=>!z.optional).concat(_.parent?_.parent.keys.filter(z=>z.optional):[]).map(z=>z.name)),f.params&&vc(f.params,_.keys.map(z=>z.name))),A=_.stringify($)}else if(f.path!=null)A=f.path,_=n.find(z=>z.re.test(A)),_&&($=_.parse(A),L=_.record.name);else{if(_=m.name?r.get(m.name):n.find(z=>z.re.test(m.path)),!_)throw ms(Rt.MATCHER_NOT_FOUND,{location:f,currentLocation:m});L=_.record.name,$=ut({},m.params,f.params),A=_.stringify($)}const X=[];let O=_;for(;O;)X.unshift(O.record),O=O.parent;return{name:L,path:A,params:$,matched:X,meta:kg(X)}}e.forEach(f=>o(f));function u(){n.length=0,r.clear()}return{addRoute:o,resolve:c,removeRoute:i,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function vc(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function yc(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:_g(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 _g(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 wc(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function kg(e){return e.reduce((t,n)=>ut(t,n.meta),{})}function Tg(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;qd(e,t[o])<0?r=o:n=o+1}const s=Ig(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function Ig(e){let t=e;for(;t=t.parent;)if(Kd(t)&&qd(e,t)===0)return t}function Kd({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function bc(e){const t=wn(ci),n=wn(Ja),r=he(()=>{const l=de(e.to);return t.resolve(l)}),s=he(()=>{const{matched:l}=r.value,{length:c}=l,u=l[c-1],f=n.matched;if(!u||!f.length)return-1;const m=f.findIndex(ps.bind(null,u));if(m>-1)return m;const _=_c(l[c-2]);return c>1&&_c(u)===_&&f[f.length-1].path!==_?f.findIndex(ps.bind(null,l[c-2])):m}),o=he(()=>s.value>-1&&Rg(n.params,r.value.params)),i=he(()=>s.value>-1&&s.value===n.matched.length-1&&Vd(n.params,r.value.params));function a(l={}){if(Ag(l)){const c=t[de(e.replace)?"replace":"push"](de(e.to)).catch(Us);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:he(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function Sg(e){return e.length===1?e[0]:e}const Eg=Ut({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:bc,setup(e,{slots:t}){const n=ei(bc(e)),{options:r}=wn(ci),s=he(()=>({[kc(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[kc(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&Sg(t.default(n));return e.custom?o:qa("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),Cg=Eg;function Ag(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 Rg(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(!In(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function _c(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const kc=(e,t,n)=>e??t??n,Pg=Ut({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=wn(ha),s=he(()=>e.route||r.value),o=wn(hc,0),i=he(()=>{let c=de(o);const{matched:u}=s.value;let f;for(;(f=u[c])&&!f.components;)c++;return c}),a=he(()=>s.value.matched[i.value]);Io(hc,he(()=>i.value+1)),Io(sg,a),Io(ha,s);const l=D();return mt(()=>[l.value,a.value,e.name],([c,u,f],[m,_,$])=>{u&&(u.instances[f]=c,_&&_!==u&&c&&c===m&&(u.leaveGuards.size||(u.leaveGuards=_.leaveGuards),u.updateGuards.size||(u.updateGuards=_.updateGuards))),c&&u&&(!_||!ps(u,_)||!m)&&(u.enterCallbacks[f]||[]).forEach(A=>A(c))},{flush:"post"}),()=>{const c=s.value,u=e.name,f=a.value,m=f&&f.components[u];if(!m)return Tc(n.default,{Component:m,route:c});const _=f.props[u],$=_?_===!0?c.params:typeof _=="function"?_(c):_:null,L=qa(m,ut({},$,t,{onVnodeUnmounted:X=>{X.component.isUnmounted&&(f.instances[u]=null)},ref:l}));return Tc(n.default,{Component:L,route:c})||L}}});function Tc(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const xg=Pg;function Mg(e){const t=bg(e.routes,e),n=e.parseQuery||ng,r=e.stringifyQuery||fc,s=e.history,o=Ps(),i=Ps(),a=Ps(),l=xh(hr);let c=hr;rs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Ri.bind(null,W=>""+W),f=Ri.bind(null,Fm),m=Ri.bind(null,Xs);function _(W,me){let ae,pe;return Wd(W)?(ae=t.getRecordMatcher(W),pe=me):pe=W,t.addRoute(pe,ae)}function $(W){const me=t.getRecordMatcher(W);me&&t.removeRoute(me)}function A(){return t.getRoutes().map(W=>W.record)}function L(W){return!!t.getRecordMatcher(W)}function X(W,me){if(me=ut({},me||l.value),typeof W=="string"){const C=Pi(n,W,me.path),B=t.resolve({path:C.path},me),F=s.createHref(C.fullPath);return ut(C,B,{params:m(B.params),hash:Xs(C.hash),redirectedFrom:void 0,href:F})}let ae;if(W.path!=null)ae=ut({},W,{path:Pi(n,W.path,me.path).path});else{const C=ut({},W.params);for(const B in C)C[B]==null&&delete C[B];ae=ut({},W,{params:f(C)}),me.params=f(me.params)}const pe=t.resolve(ae,me),Ne=W.hash||"";pe.params=u(m(pe.params));const g=Hm(r,ut({},W,{hash:Dm(Ne),path:pe.path})),v=s.createHref(g);return ut({fullPath:g,hash:Ne,query:r===fc?rg(W.query):W.query||{}},pe,{redirectedFrom:void 0,href:v})}function O(W){return typeof W=="string"?Pi(n,W,l.value.path):ut({},W)}function z(W,me){if(c!==W)return ms(Rt.NAVIGATION_CANCELLED,{from:me,to:W})}function V(W){return ye(W)}function fe(W){return V(ut(O(W),{replace:!0}))}function ie(W,me){const ae=W.matched[W.matched.length-1];if(ae&&ae.redirect){const{redirect:pe}=ae;let Ne=typeof pe=="function"?pe(W,me):pe;return typeof Ne=="string"&&(Ne=Ne.includes("?")||Ne.includes("#")?Ne=O(Ne):{path:Ne},Ne.params={}),ut({query:W.query,hash:W.hash,params:Ne.path!=null?{}:W.params},Ne)}}function ye(W,me){const ae=c=X(W),pe=l.value,Ne=W.state,g=W.force,v=W.replace===!0,C=ie(ae,pe);if(C)return ye(ut(O(C),{state:typeof C=="object"?ut({},Ne,C.state):Ne,force:g,replace:v}),me||ae);const B=ae;B.redirectedFrom=me;let F;return!g&&Vm(r,pe,ae)&&(F=ms(Rt.NAVIGATION_DUPLICATED,{to:B,from:pe}),Ze(pe,pe,!0,!1)),(F?Promise.resolve(F):ee(B,pe)).catch(P=>Gn(P)?Gn(P,Rt.NAVIGATION_GUARD_REDIRECT)?P:Qe(P):Oe(P,B,pe)).then(P=>{if(P){if(Gn(P,Rt.NAVIGATION_GUARD_REDIRECT))return ye(ut({replace:v},O(P.to),{state:typeof P.to=="object"?ut({},Ne,P.to.state):Ne,force:g}),me||B)}else P=ne(B,pe,!0,v,Ne);return we(B,pe,P),P})}function Te(W,me){const ae=z(W,me);return ae?Promise.reject(ae):Promise.resolve()}function re(W){const me=Pt.values().next().value;return me&&typeof me.runWithContext=="function"?me.runWithContext(W):W()}function ee(W,me){let ae;const[pe,Ne,g]=og(W,me);ae=Mi(pe.reverse(),"beforeRouteLeave",W,me);for(const C of pe)C.leaveGuards.forEach(B=>{ae.push(vr(B,W,me))});const v=Te.bind(null,W,me);return ae.push(v),nt(ae).then(()=>{ae=[];for(const C of o.list())ae.push(vr(C,W,me));return ae.push(v),nt(ae)}).then(()=>{ae=Mi(Ne,"beforeRouteUpdate",W,me);for(const C of Ne)C.updateGuards.forEach(B=>{ae.push(vr(B,W,me))});return ae.push(v),nt(ae)}).then(()=>{ae=[];for(const C of g)if(C.beforeEnter)if(In(C.beforeEnter))for(const B of C.beforeEnter)ae.push(vr(B,W,me));else ae.push(vr(C.beforeEnter,W,me));return ae.push(v),nt(ae)}).then(()=>(W.matched.forEach(C=>C.enterCallbacks={}),ae=Mi(g,"beforeRouteEnter",W,me,re),ae.push(v),nt(ae))).then(()=>{ae=[];for(const C of i.list())ae.push(vr(C,W,me));return ae.push(v),nt(ae)}).catch(C=>Gn(C,Rt.NAVIGATION_CANCELLED)?C:Promise.reject(C))}function we(W,me,ae){a.list().forEach(pe=>re(()=>pe(W,me,ae)))}function ne(W,me,ae,pe,Ne){const g=z(W,me);if(g)return g;const v=me===hr,C=rs?history.state:{};ae&&(pe||v?s.replace(W.fullPath,ut({scroll:v&&C&&C.scroll},Ne)):s.push(W.fullPath,Ne)),l.value=W,Ze(W,me,ae,v),Qe()}let je;function Fe(){je||(je=s.listen((W,me,ae)=>{if(!qe.listening)return;const pe=X(W),Ne=ie(pe,qe.currentRoute.value);if(Ne){ye(ut(Ne,{replace:!0,force:!0}),pe).catch(Us);return}c=pe;const g=l.value;rs&&Qm(dc(g.fullPath,ae.delta),li()),ee(pe,g).catch(v=>Gn(v,Rt.NAVIGATION_ABORTED|Rt.NAVIGATION_CANCELLED)?v:Gn(v,Rt.NAVIGATION_GUARD_REDIRECT)?(ye(ut(O(v.to),{force:!0}),pe).then(C=>{Gn(C,Rt.NAVIGATION_ABORTED|Rt.NAVIGATION_DUPLICATED)&&!ae.delta&&ae.type===da.pop&&s.go(-1,!1)}).catch(Us),Promise.reject()):(ae.delta&&s.go(-ae.delta,!1),Oe(v,pe,g))).then(v=>{v=v||ne(pe,g,!1),v&&(ae.delta&&!Gn(v,Rt.NAVIGATION_CANCELLED)?s.go(-ae.delta,!1):ae.type===da.pop&&Gn(v,Rt.NAVIGATION_ABORTED|Rt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),we(pe,g,v)}).catch(Us)}))}let et=Ps(),De=Ps(),Ee;function Oe(W,me,ae){Qe(W);const pe=De.list();return pe.length?pe.forEach(Ne=>Ne(W,me,ae)):console.error(W),Promise.reject(W)}function tt(){return Ee&&l.value!==hr?Promise.resolve():new Promise((W,me)=>{et.add([W,me])})}function Qe(W){return Ee||(Ee=!W,Fe(),et.list().forEach(([me,ae])=>W?ae(W):me()),et.reset()),W}function Ze(W,me,ae,pe){const{scrollBehavior:Ne}=e;if(!rs||!Ne)return Promise.resolve();const g=!ae&&Xm(dc(W.fullPath,0))||(pe||!ae)&&history.state&&history.state.scroll||null;return cn().then(()=>Ne(W,me,g)).then(v=>v&&Ym(v)).catch(v=>Oe(v,W,me))}const Xe=W=>s.go(W);let ht;const Pt=new Set,qe={currentRoute:l,listening:!0,addRoute:_,removeRoute:$,clearRoutes:t.clearRoutes,hasRoute:L,getRoutes:A,resolve:X,options:e,push:V,replace:fe,go:Xe,back:()=>Xe(-1),forward:()=>Xe(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:De.add,isReady:tt,install(W){W.component("RouterLink",Cg),W.component("RouterView",xg),W.config.globalProperties.$router=qe,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>de(l)}),rs&&!ht&&l.value===hr&&(ht=!0,V(s.location).catch(pe=>{}));const me={};for(const pe in hr)Object.defineProperty(me,pe,{get:()=>l.value[pe],enumerable:!0});W.provide(ci,qe),W.provide(Ja,Wu(me)),W.provide(ha,l);const ae=W.unmount;Pt.add(W),W.unmount=function(){Pt.delete(W),Pt.size<1&&(c=hr,je&&je(),je=null,l.value=hr,ht=!1,Ee=!1),ae()}}};function nt(W){return W.reduce((me,ae)=>me.then(()=>re(ae)),Promise.resolve())}return qe}function Og(){return wn(ci)}function Ng(e){return wn(Ja)}const Ic=768;function Jd(){const e=D(typeof window<"u"?window.innerWidth<Ic:!1);let t=null;function n(r){e.value=r.matches}return lr(()=>{t=window.matchMedia(`(max-width: ${Ic-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),si(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const $g={key:0,class:"desktop-sidebar"},Dg={class:"desktop-main"},Sc="codex-web-local.sidebar-width.v1",Lg=260,jg=620,Ec=320,Fg=Ut({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Jd();function r(c){return Math.min(jg,Math.max(Lg,c))}function s(){if(typeof window>"u")return Ec;const c=window.localStorage.getItem(Sc),u=Number(c);return Number.isFinite(u)?r(u):Ec}const o=D(s()),i=he(()=>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(c){typeof window>"u"||window.localStorage.setItem(Sc,String(c))}function l(c){c.preventDefault();const u=c.clientX,f=o.value,m=$=>{const A=$.clientX-u;o.value=r(f+A)},_=()=>{a(o.value),window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",_)};window.addEventListener("mousemove",m),window.addEventListener("mouseup",_)}return(c,u)=>(w(),T("div",{class:gt(["desktop-layout",{"is-mobile":de(n)}]),style:zr(i.value)},[de(n)?(w(),wt(Do,{key:0,to:"body"},[Ae(Dd,{name:"drawer"},{default:pt(()=>[e.isSidebarCollapsed?oe("",!0):(w(),T("div",{key:0,class:"mobile-drawer-backdrop",onClick:u[1]||(u[1]=f=>c.$emit("close-sidebar"))},[p("aside",{class:"mobile-drawer",onClick:u[0]||(u[0]=rt(()=>{},["stop"]))},[Nn(c.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):oe("",!0),de(n)?oe("",!0):(w(),T(Le,{key:1},[e.isSidebarCollapsed?oe("",!0):(w(),T("aside",$g,[Nn(c.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?oe("",!0):(w(),T("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),p("section",Dg,[Nn(c.$slots,"content",{},void 0)])],6))}}),ot=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},Bg=ot(Fg,[["__scopeId","data-v-df29c633"]]),Ug={},Hg={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Vg(e,t){return w(),T("svg",Hg,[...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 ui=ot(Ug,[["render",Vg]]),Wg={},zg={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Gg(e,t){return w(),T("svg",zg,[...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 Yd=ot(Wg,[["render",Gg]]),qg={},Kg={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Jg(e,t){return w(),T("svg",Kg,[...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 xs=ot(qg,[["render",Jg]]),Yg={},Qg={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Xg(e,t){return w(),T("svg",Qg,[...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 Uo=ot(Yg,[["render",Xg]]),Zg={},ev={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(),T("svg",ev,[...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 Ya=ot(Zg,[["render",tv]]),nv={},rv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function sv(e,t){return w(),T("svg",rv,[...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 ov=ot(nv,[["render",sv]]),iv={},av={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function lv(e,t){return w(),T("svg",av,[...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 Ao=ot(iv,[["render",lv]]),cv={},uv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function dv(e,t){return w(),T("svg",uv,[...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 Oi=ot(cv,[["render",dv]]),fv={key:0,class:"sidebar-menu-row-left"},hv={class:"sidebar-menu-row-main"},pv={key:1,class:"sidebar-menu-row-right"},mv={key:0,class:"sidebar-menu-row-right-default"},gv={key:1,class:"sidebar-menu-row-right-hover"},vv=Ut({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=ap(),r=he(()=>!!n.left),s=he(()=>!!n.right),o=he(()=>!!n["right-hover"]),i=he(()=>s.value||o.value);return(a,l)=>(w(),wt(ra(t.as),Pd({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:pt(()=>[r.value?(w(),T("span",fv,[Nn(a.$slots,"left",{},void 0,!0)])):oe("",!0),p("span",hv,[Nn(a.$slots,"default",{},void 0,!0)]),i.value?(w(),T("span",pv,[s.value?(w(),T("span",mv,[Nn(a.$slots,"right",{},void 0,!0)])):oe("",!0),o.value?(w(),T("span",gv,[Nn(a.$slots,"right-hover",{},void 0,!0)])):oe("",!0)])):oe("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),$r=ot(vv,[["__scopeId","data-v-daeca4df"]]),yv={class:"thread-tree-root"},wv={key:0,class:"pinned-section"},bv={class:"thread-list"},_v={class:"thread-left-stack"},kv=["data-state"],Tv=["onClick"],Iv=["onClick"],Sv={class:"thread-row-title-wrap"},Ev={class:"thread-row-title"},Cv={class:"thread-row-time"},Av=["onClick"],Rv=["onClick"],Pv=["onClick"],xv=["onClick"],Mv=["aria-expanded"],Ov=["data-active"],Nv={key:0},$v=["data-active"],Dv={key:0},Lv={key:1,class:"thread-tree-no-results"},jv={key:2,class:"thread-tree-loading"},Fv={key:3,class:"thread-list thread-list-global"},Bv={class:"thread-left-stack"},Uv=["data-state"],Hv=["onClick"],Vv=["onClick"],Wv={class:"thread-row-title-wrap"},zv={class:"thread-row-title"},Gv={class:"thread-row-time"},qv=["onClick"],Kv=["onClick"],Jv=["onClick"],Yv=["onClick"],Qv=["data-project-name","data-expanded","data-dragging"],Xv={class:"project-icon-stack"},Zv={class:"project-icon-folder"},ey={class:"project-icon-chevron"},ty=["data-dragging-handle","onMousedown"],ny={class:"project-title"},ry={class:"project-hover-controls"},sy=["onClick"],oy=["onClick"],iy=["onClick"],ay=["onClick"],ly=["onInput"],cy=["aria-label","title","onClick"],uy={key:0,class:"thread-list"},dy={class:"thread-left-stack"},fy=["data-state"],hy=["onClick"],py=["onClick"],my={class:"thread-row-title-wrap"},gy={class:"thread-row-title"},vy={class:"thread-row-time"},yy=["onClick"],wy=["onClick"],by=["onClick"],_y=["onClick"],ky=["onClick"],Ty={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},Iy=["onKeydown"],Sy={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},Ey={class:"rename-thread-subtitle"},Cy=4,Cc=6,Ac="codex-web-local.thread-view-mode.v1",Rc="codex-web-local.collapsed-projects.v1",Ay=Ut({__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(""),c=D("actions"),u=D(""),f=D(!1),m=D(""),_=D(""),$=D(null),A=D(!1),L=D(""),X=D(""),O=D(null),z=D(null),V=D(null);let fe=null,ie=null;const ye=D(""),Te=D({}),re=new Map,ee=new Map,we=new Map,ne=new WeakMap,je=D(null),Fe=D(!1),et=D(Oe()),De=typeof window<"u"?new ResizeObserver(k=>{for(const x of k){const M=x.target,Y=ne.get(M);Y&&Re(Y,M)}}):null;function Ee(){if(typeof window>"u")return{};try{const k=window.localStorage.getItem(Rc);if(!k)return{};const x=JSON.parse(k);return!x||typeof x!="object"||Array.isArray(x)?{}:x}catch{return{}}}function Oe(){return typeof window>"u"?"project":window.localStorage.getItem(Ac)==="chronological"?"chronological":"project"}o.value=Ee(),mt(o,k=>{typeof window>"u"||window.localStorage.setItem(Rc,JSON.stringify(k))},{deep:!0}),mt(et,k=>{typeof window>"u"||window.localStorage.setItem(Ac,k)});const tt=he(()=>n.searchQuery.trim().toLowerCase()),Qe=he(()=>tt.value.length>0),Ze=he(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function Xe(k){if(!Qe.value)return!0;if(Ze.value)return Ze.value.has(k.id);const x=tt.value;return k.title.toLowerCase().includes(x)||k.preview.toLowerCase().includes(x)}const ht=he(()=>Qe.value?n.groups.map(k=>({...k,threads:k.threads.filter(Xe)})).filter(k=>k.threads.length>0):n.groups),Pt=he(()=>et.value==="chronological"),qe=he(()=>{const k=ht.value,x=[];for(const M of k)for(const Y of M.threads)v(Y.id)||x.push(Y);return x.sort((M,Y)=>{const Be=new Date(M.updatedAtIso||M.createdAtIso).getTime();return new Date(Y.updatedAtIso||Y.createdAtIso).getTime()-Be})}),nt=he(()=>{const k=new Map;for(const x of n.groups)for(const M of x.threads)k.set(M.id,M);return k}),W=he(()=>i.value.map(k=>nt.value.get(k)??null).filter(k=>k!==null).filter(Xe)),me=he(()=>{const k=V.value;if(!k||k.dropTargetIndexFull===null||n.groups.length===0)return null;const x=Math.max(0,Math.min(k.dropTargetIndexFull,n.groups.length)),M=x>k.fromIndex?x-1:x,Y=Math.max(0,Math.min(M,n.groups.length-1));return Y===k.fromIndex?null:Y}),ae=he(()=>{const x=(Qe.value?ht.value:n.groups).map(an=>an.projectName),M=V.value,Y=me.value;if(!M||Y===null)return x;const Be=[...x],[Lt]=Be.splice(M.fromIndex,1);return Lt?(Be.splice(Y,0,Lt),Be):x}),pe=he(()=>{const k={};let x=0;for(const M of ae.value)k[M]=x,x+=It(M);return k}),Ne=he(()=>{let k=0;for(const x of ae.value)k+=It(x);return{height:`${Math.max(0,k)}px`}});function g(k){const x=new Date(k).getTime();if(Number.isNaN(x))return"n/a";const M=Math.abs(Date.now()-x);if(M<6e4)return"now";const Y=Math.floor(M/6e4);if(Y<60)return`${Y}m`;const Be=Math.floor(Y/60);return Be<24?`${Be}h`:`${Math.floor(Be/24)}d`}function v(k){return i.value.includes(k)}function C(k){if(v(k)){i.value=i.value.filter(x=>x!==k);return}i.value=[k,...i.value]}function B(k){r("select",k)}function F(k){r("export-thread",k),H()}function P(k){return`start new thread ${He(k)}`}function U(k){r("start-new-thread",k)}function j(k){l.value===k&&H()}function K(k){return l.value===k}function H(){l.value=""}function _e(k){if(l.value===k){H();return}l.value=k}function ue(k,x){m.value=k,_.value=x,f.value=!0,H(),cn(()=>{var M,Y;(M=$.value)==null||M.focus(),(Y=$.value)==null||Y.select()})}function ve(){f.value=!1,m.value="",_.value=""}function Se(){const k=m.value,x=_.value.trim();!k||!x||(r("rename-thread",{threadId:k,title:x}),ve())}function Pe(k,x){L.value=k,X.value=x,A.value=!0,H()}function Ke(){A.value=!1,L.value="",X.value=""}function xe(){const k=L.value;k&&(i.value=i.value.filter(x=>x!==k),r("archive",k),Ke())}function He(k){return n.projectDisplayNameById[k]??k}function kt(k){return a.value===k}function ze(){a.value="",c.value="actions",u.value=""}function Je(){Fe.value=!Fe.value}function Mt(k){et.value=k,Fe.value=!1}function Ht(k){if(a.value===k){ze();return}a.value=k,c.value="actions",u.value=He(k)}function vt(k){a.value=k,c.value="rename",u.value=He(k)}function Tt(k){r("rename-project",{projectName:k,displayName:u.value})}function Ot(k){r("remove-project",k),ze()}function Xt(k){r("browse-project-files",k),ze()}function G(k,x){if(!k.altKey||k.key!=="ArrowUp"&&k.key!=="ArrowDown")return;const M=n.groups.findIndex(Lt=>Lt.projectName===x);if(M<0)return;const Y=k.key==="ArrowUp"?-1:1,Be=Math.max(0,Math.min(M+Y,n.groups.length-1));Be!==M&&(k.preventDefault(),r("reorder-project",{projectName:x,toIndex:Be}))}function J(k){return s.value[k]===!0}function N(k){return o.value[k]===!0}function le(k){s.value={...s.value,[k]:!J(k)}}function Nt(k){if(ye.value===k){ye.value="";return}o.value={...o.value,[k]:!N(k)}}function It(k){const x=Te.value[k]??0,M=V.value,Be=((M==null?void 0:M.projectName)===k?M.groupHeight:null)??x,Lt=N(k)?0:Cc;return Math.max(0,Be+Lt)}function Vt(k,x){const M=x instanceof HTMLElement?x:x&&"$el"in x&&x.$el instanceof HTMLElement?x.$el:null;if(M){ee.set(k,M);return}ee.delete(k)}function xt(k,x){const M=x instanceof HTMLElement?x:x&&"$el"in x&&x.$el instanceof HTMLElement?x.$el:null;if(M){we.set(k,M);return}we.delete(k)}function Zt(k){const x=a.value;if(!x)return!1;const M=ee.get(x);if(!M)return!1;if((typeof k.composedPath=="function"?k.composedPath():[]).includes(M))return!0;const Be=k.target;return Be instanceof Node?M.contains(Be):!1}function b(k){const x=l.value;if(!x)return!1;const M=we.get(x);if(!M)return!1;if((typeof k.composedPath=="function"?k.composedPath():[]).includes(M))return!0;const Be=k.target;return Be instanceof Node?M.contains(Be):!1}function I(k){if(Fe.value){const x=je.value,M=typeof k.composedPath=="function"?k.composedPath():[];!!x&&(M.includes(x)||k.target instanceof Node&&x.contains(k.target))||(Fe.value=!1)}a.value&&(Zt(k)||ze(),l.value&&(b(k)||H()))}function S(k){a.value&&!Zt(k)&&ze(),l.value&&!b(k)&&H()}function q(){Fe.value&&(Fe.value=!1),a.value&&ze(),l.value&&H()}function ge(){window.addEventListener("pointerdown",I,{capture:!0}),window.addEventListener("focusin",S,{capture:!0}),window.addEventListener("blur",q)}function ce(){window.removeEventListener("pointerdown",I,{capture:!0}),window.removeEventListener("focusin",S,{capture:!0}),window.removeEventListener("blur",q)}function Re(k,x){const M=x.getBoundingClientRect().height;if(!Number.isFinite(M)||M<=0)return;const Y=Te.value[k];Y!==void 0&&Math.abs(Y-M)<.5||(Te.value={...Te.value,[k]:M})}function Ie(k,x){const M=re.get(k);M&&M!==x&&De&&De.unobserve(M);const Y=x instanceof HTMLElement?x:x&&"$el"in x&&x.$el instanceof HTMLElement?x.$el:null;if(Y){re.set(k,Y),ne.set(Y,k),Re(k,Y),De==null||De.observe(Y);return}M&&(De==null||De.unobserve(M)),re.delete(k)}function Ve(k,x){if(k.button!==0||z.value||V.value)return;const M=n.groups.findIndex(an=>an.projectName===x),Y=re.get(x);if(M<0||!Y)return;const Be=Y.getBoundingClientRect(),Lt=N(x)?0:Cc;z.value={projectName:x,fromIndex:M,startClientX:k.clientX,startClientY:k.clientY,pointerOffsetY:k.clientY-Be.top,groupLeft:Be.left,groupWidth:Be.width,groupHeight:Be.height,groupOuterHeight:Be.height+Lt},k.preventDefault(),at()}function at(){window.addEventListener("mousemove",$t),window.addEventListener("mouseup",Dt),window.addEventListener("keydown",dn)}function lt(){window.removeEventListener("mousemove",$t),window.removeEventListener("mouseup",Dt),window.removeEventListener("keydown",dn)}function $t(k){fe={clientX:k.clientX,clientY:k.clientY},ks()}function Dt(k){Cr({clientX:k.clientX,clientY:k.clientY});const x=V.value;if(x&&me.value!==null){const M=n.groups.findIndex(Y=>Y.projectName===x.projectName);if(M>=0){const Y=me.value;Y!==M&&r("reorder-project",{projectName:x.projectName,toIndex:Y})}}jn()}function dn(k){k.key==="Escape"&&(!z.value&&!V.value||(k.preventDefault(),jn()))}function jn(){ie!==null&&(window.cancelAnimationFrame(ie),ie=null),fe=null,z.value=null,V.value=null,ye.value="",lt()}function ks(){ie===null&&(ie=window.requestAnimationFrame(()=>{if(ie=null,!fe)return;const k=fe;fe=null,Cr(k)}))}function Cr(k){const x=z.value;if(!V.value&&x){const M=k.clientX-x.startClientX,Y=k.clientY-x.startClientY;if(Math.hypot(M,Y)<Cy)return;ze(),ye.value=x.projectName,V.value={projectName:x.projectName,fromIndex:x.fromIndex,pointerOffsetY:x.pointerOffsetY,groupLeft:x.groupLeft,groupWidth:x.groupWidth,groupHeight:x.groupHeight,groupOuterHeight:x.groupOuterHeight,ghostTop:k.clientY-x.pointerOffsetY,dropTargetIndexFull:null}}V.value&&qr(k)}function qr(k){const x=V.value;if(!x)return;if(x.ghostTop=k.clientY-x.pointerOffsetY,!Fn(k)){x.dropTargetIndexFull=null;return}const M=k.clientY,Y=O.value;if(!Y){x.dropTargetIndexFull=null;return}const Be=Y.getBoundingClientRect(),Lt=new Map(n.groups.map((fn,ur)=>[fn.projectName,ur])),an=n.groups.map(fn=>fn.projectName).filter(fn=>fn!==x.projectName);let Un=0,Hn=n.groups.length;for(const fn of an){const ur=Lt.get(fn);if(ur===void 0)continue;const Yr=It(fn),Qr=Be.top+Un+Yr/2;if(M<Qr){Hn=ur;break}Un+=Yr}x.dropTargetIndexFull=Hn}function Fn(k){const x=O.value;if(!x)return!1;const M=x.getBoundingClientRect(),Y=k.clientX>=M.left&&k.clientX<=M.right,Be=k.clientY>=M.top-32&&k.clientY<=M.bottom+32;return Y&&Be}function Kr(k){var x;return((x=V.value)==null?void 0:x.projectName)===k}function Jr(k){const x=V.value,M=pe.value[k]??0,Y=a.value===k;return!x||x.projectName!==k?{position:"absolute",top:"0",left:"0",right:"0",zIndex:Y?"40":"1",transform:`translate3d(0, ${M}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${x.groupLeft}px`,width:`${x.groupWidth}px`,height:`${x.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${x.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Bn(k){return k.threads.filter(x=>!v(x.id))}function Ts(k){if(Qe.value)return Bn(k);if(N(k.projectName))return[];const x=Bn(k);return J(k.projectName)?x:x.slice(0,10)}function Is(k){return Qe.value?!1:!N(k.projectName)&&Bn(k).length>10}function Ss(k){return Bn(k).length>0}function Ar(k){return k.inProgress?"working":k.unread?"unread":"idle"}mt(()=>n.groups.map(k=>k.projectName),k=>{var Be,Lt;const x=((Be=V.value)==null?void 0:Be.projectName)??((Lt=z.value)==null?void 0:Lt.projectName)??"";x&&!n.groups.some(an=>an.projectName===x)&&jn();const M=new Set(k),Y=Object.fromEntries(Object.entries(Te.value).filter(([an])=>M.has(an)));Object.keys(Y).length!==Object.keys(Te.value).length&&(Te.value=Y)});const Rr=he(()=>Fe.value||a.value!=="");return mt(Rr,k=>{if(k){ge();return}ce()}),cr(()=>{for(const k of re.values())De==null||De.unobserve(k);re.clear(),ee.clear(),ce(),jn()}),(k,x)=>(w(),T("section",yv,[W.value.length>0?(w(),T("section",wv,[p("ul",bv,[(w(!0),T(Le,null,Ct(W.value,M=>(w(),T("li",{key:M.id,class:"thread-row-item"},[Ae($r,{class:"thread-row","data-active":M.id===e.selectedThreadId,"data-pinned":v(M.id),onMouseleave:Y=>j(M.id)},{left:pt(()=>[p("span",_v,[M.inProgress||M.unread?(w(),T("span",{key:0,class:"thread-status-indicator","data-state":Ar(M)},null,8,kv)):oe("",!0),p("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Y=>C(M.id)},[Ae(Oi,{class:"thread-icon"})],8,Tv)])]),right:pt(()=>[p("span",Cv,se(g(M.createdAtIso||M.updatedAtIso)),1)]),"right-hover":pt(()=>[p("div",{ref_for:!0,ref:Y=>xt(M.id,Y),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:rt(Y=>_e(M.id),["stop"])},[Ae(xs,{class:"thread-icon"})],8,Av),K(M.id)?(w(),T("div",{key:0,class:"thread-menu-panel",onClick:x[0]||(x[0]=rt(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:Y=>F(M.id)}," Export chat ",8,Rv),p("button",{class:"thread-menu-item",type:"button",onClick:Y=>ue(M.id,M.title)}," Rename thread ",8,Pv),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Y=>Pe(M.id,M.title)}," Delete thread ",8,xv)])):oe("",!0)],512)]),default:pt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:Y=>B(M.id)},[p("span",Sv,[p("span",Ev,se(M.title),1),M.hasWorktree?(w(),wt(Ao,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):oe("",!0)])],8,Iv)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])])):oe("",!0),Ae($r,{as:"header",class:"thread-tree-header-row"},{right:pt(()=>[p("div",{ref_key:"organizeMenuWrapRef",ref:je,class:"organize-menu-wrap"},[p("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Fe.value,"aria-label":"Organize threads",title:"Organize threads",onClick:Je},[Ae(xs,{class:"thread-icon"})],8,Mv),Fe.value?(w(),T("div",{key:0,class:"organize-menu-panel",onClick:x[3]||(x[3]=rt(()=>{},["stop"]))},[x[11]||(x[11]=p("p",{class:"organize-menu-title"},"Organize",-1)),p("button",{class:"organize-menu-item","data-active":et.value==="project",type:"button",onClick:x[1]||(x[1]=M=>Mt("project"))},[x[9]||(x[9]=p("span",null,"By project",-1)),et.value==="project"?(w(),T("span",Nv,"✓")):oe("",!0)],8,Ov),p("button",{class:"organize-menu-item","data-active":et.value==="chronological",type:"button",onClick:x[2]||(x[2]=M=>Mt("chronological"))},[x[10]||(x[10]=p("span",null,"Chronological list",-1)),et.value==="chronological"?(w(),T("span",Dv,"✓")):oe("",!0)],8,$v)])):oe("",!0)],512)]),default:pt(()=>[x[12]||(x[12]=p("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),Qe.value&&ht.value.length===0?(w(),T("p",Lv,"No matching threads")):e.isLoading&&e.groups.length===0?(w(),T("p",jv,"Loading threads...")):Pt.value?(w(),T("ul",Fv,[(w(!0),T(Le,null,Ct(qe.value,M=>(w(),T("li",{key:M.id,class:"thread-row-item"},[Ae($r,{class:"thread-row","data-active":M.id===e.selectedThreadId,"data-pinned":v(M.id),onMouseleave:Y=>j(M.id)},{left:pt(()=>[p("span",Bv,[M.inProgress||M.unread?(w(),T("span",{key:0,class:"thread-status-indicator","data-state":Ar(M)},null,8,Uv)):oe("",!0),p("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Y=>C(M.id)},[Ae(Oi,{class:"thread-icon"})],8,Hv)])]),right:pt(()=>[p("span",Gv,se(g(M.createdAtIso||M.updatedAtIso)),1)]),"right-hover":pt(()=>[p("div",{ref_for:!0,ref:Y=>xt(M.id,Y),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:rt(Y=>_e(M.id),["stop"])},[Ae(xs,{class:"thread-icon"})],8,qv),K(M.id)?(w(),T("div",{key:0,class:"thread-menu-panel",onClick:x[4]||(x[4]=rt(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:Y=>F(M.id)}," Export chat ",8,Kv),p("button",{class:"thread-menu-item",type:"button",onClick:Y=>ue(M.id,M.title)}," Rename thread ",8,Jv),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Y=>Pe(M.id,M.title)}," Delete thread ",8,Yv)])):oe("",!0)],512)]),default:pt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:Y=>B(M.id)},[p("span",Wv,[p("span",zv,se(M.title),1),M.hasWorktree?(w(),wt(Ao,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):oe("",!0)])],8,Vv)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])):(w(),T("div",{key:4,ref_key:"groupsContainerRef",ref:O,class:"thread-tree-groups",style:zr(Ne.value)},[(w(!0),T(Le,null,Ct(ht.value,M=>(w(),T("article",{key:M.projectName,ref_for:!0,ref:Y=>Ie(M.projectName,Y),class:"project-group","data-project-name":M.projectName,"data-expanded":!N(M.projectName),"data-dragging":Kr(M.projectName),style:zr(Jr(M.projectName))},[Ae($r,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:Y=>Nt(M.projectName),onKeydown:[Y=>G(Y,M.projectName),rn(rt(Y=>Nt(M.projectName),["prevent"]),["enter"]),rn(rt(Y=>Nt(M.projectName),["prevent"]),["space"])]},{left:pt(()=>[p("span",Xv,[p("span",Zv,[N(M.projectName)?(w(),wt(Ya,{key:0,class:"thread-icon"})):(w(),wt(ov,{key:1,class:"thread-icon"}))]),p("span",ey,[N(M.projectName)?(w(),wt(Yd,{key:0,class:"thread-icon"})):(w(),wt(ui,{key:1,class:"thread-icon"}))])])]),right:pt(()=>[p("div",ry,[p("div",{ref_for:!0,ref:Y=>Vt(M.projectName,Y),class:"project-menu-wrap"},[p("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:rt(Y=>Ht(M.projectName),["stop"])},[Ae(xs,{class:"thread-icon"})],8,sy),kt(M.projectName)?(w(),T("div",{key:0,class:"project-menu-panel",onClick:x[6]||(x[6]=rt(()=>{},["stop"]))},[c.value==="actions"?(w(),T(Le,{key:0},[p("button",{class:"project-menu-item",type:"button",onClick:Y=>Xt(M.projectName)}," Browse files ",8,oy),p("button",{class:"project-menu-item",type:"button",onClick:Y=>vt(M.projectName)}," Edit name ",8,iy),p("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:Y=>Ot(M.projectName)}," Remove ",8,ay)],64)):(w(),T(Le,{key:1},[x[13]||(x[13]=p("label",{class:"project-menu-label"},"Project name",-1)),rr(p("input",{"onUpdate:modelValue":x[5]||(x[5]=Y=>u.value=Y),class:"project-menu-input",type:"text",onInput:Y=>Tt(M.projectName)},null,40,ly),[[sr,u.value]])],64))])):oe("",!0)],512),p("button",{class:"thread-start-button",type:"button","aria-label":P(M.projectName),title:P(M.projectName),onClick:rt(Y=>U(M.projectName),["stop"])},[Ae(Uo,{class:"thread-icon"})],8,cy)])]),default:pt(()=>[p("span",{class:"project-main-button","data-dragging-handle":Kr(M.projectName),onMousedown:rt(Y=>Ve(Y,M.projectName),["left"])},[p("span",ny,se(He(M.projectName)),1)],40,ty)]),_:2},1032,["onClick","onKeydown"]),Ss(M)?(w(),T("ul",uy,[(w(!0),T(Le,null,Ct(Ts(M),Y=>(w(),T("li",{key:Y.id,class:"thread-row-item"},[Ae($r,{class:"thread-row","data-active":Y.id===e.selectedThreadId,"data-pinned":v(Y.id),onMouseleave:Be=>j(Y.id)},{left:pt(()=>[p("span",dy,[Y.inProgress||Y.unread?(w(),T("span",{key:0,class:"thread-status-indicator","data-state":Ar(Y)},null,8,fy)):oe("",!0),p("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Be=>C(Y.id)},[Ae(Oi,{class:"thread-icon"})],8,hy)])]),right:pt(()=>[p("span",vy,se(g(Y.createdAtIso||Y.updatedAtIso)),1)]),"right-hover":pt(()=>[p("div",{ref_for:!0,ref:Be=>xt(Y.id,Be),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:rt(Be=>_e(Y.id),["stop"])},[Ae(xs,{class:"thread-icon"})],8,yy),K(Y.id)?(w(),T("div",{key:0,class:"thread-menu-panel",onClick:x[7]||(x[7]=rt(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:Be=>F(Y.id)}," Export chat ",8,wy),p("button",{class:"thread-menu-item",type:"button",onClick:Be=>ue(Y.id,Y.title)}," Rename thread ",8,by),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Be=>Pe(Y.id,Y.title)}," Delete thread ",8,_y)])):oe("",!0)],512)]),default:pt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:Be=>B(Y.id)},[p("span",my,[p("span",gy,se(Y.title),1),Y.hasWorktree?(w(),wt(Ao,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):oe("",!0)])],8,py)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])):(w(),wt($r,{key:1,as:"p",class:"project-empty-row"},{left:pt(()=>[...x[14]||(x[14]=[p("span",{class:"project-empty-spacer"},null,-1)])]),default:pt(()=>[x[15]||(x[15]=p("span",{class:"project-empty"},"No threads",-1))]),_:1})),Is(M)?(w(),wt($r,{key:2,class:"thread-show-more-row"},{left:pt(()=>[...x[16]||(x[16]=[p("span",{class:"thread-show-more-spacer"},null,-1)])]),default:pt(()=>[p("button",{class:"thread-show-more-button",type:"button",onClick:Y=>le(M.projectName)},se(J(M.projectName)?"Show less":"Show more"),9,ky)]),_:2},1024)):oe("",!0)],12,Qv))),128))],4)),(w(),wt(Do,{to:"body"},[f.value?(w(),T("div",{key:0,class:"rename-thread-overlay",onClick:rt(ve,["self"])},[p("div",Ty,[x[17]||(x[17]=p("h3",{class:"rename-thread-title"},"Rename thread",-1)),x[18]||(x[18]=p("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),rr(p("input",{ref_key:"renameThreadInputRef",ref:$,"onUpdate:modelValue":x[8]||(x[8]=M=>_.value=M),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[rn(rt(Se,["prevent"]),["enter"]),rn(rt(ve,["prevent"]),["esc"])]},null,40,Iy),[[sr,_.value]]),p("div",{class:"rename-thread-actions"},[p("button",{class:"rename-thread-button",type:"button",onClick:ve},"Cancel"),p("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Se},"Save")])])])):oe("",!0)])),(w(),wt(Do,{to:"body"},[A.value?(w(),T("div",{key:0,class:"rename-thread-overlay",onClick:rt(Ke,["self"])},[p("div",Sy,[x[19]||(x[19]=p("h3",{class:"rename-thread-title"},"Delete thread?",-1)),p("p",Ey,' This will archive the thread "'+se(X.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:Ke},"Cancel"),p("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:xe},"Delete")])])])):oe("",!0)]))]))}}),Ry=ot(Ay,[["__scopeId","data-v-e2f8a8e1"]]),Py={class:"content-header"},xy={class:"content-leading"},My={class:"content-title"},Oy={class:"content-actions"},Ny=Ut({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(w(),T("header",Py,[p("div",xy,[Nn(t.$slots,"leading",{},void 0)]),p("h1",My,se(e.title),1),p("div",Oy,[Nn(t.$slots,"actions",{},void 0)])]))}}),$y=ot(Ny,[["__scopeId","data-v-66ee223c"]]),Dy={},Ly={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function jy(e,t){return w(),T("svg",Ly,[...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 Qa=ot(Dy,[["render",jy]]),Fy={},By={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Uy(e,t){return w(),T("svg",By,[...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 Hy=ot(Fy,[["render",Uy]]),Vy={},Wy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function zy(e,t){return w(),T("svg",Wy,[...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 Gy=ot(Vy,[["render",zy]]),qy={class:"conversation-root"},Ky={key:0,class:"conversation-loading"},Jy={key:1,class:"conversation-empty"},Yy={class:"message-row"},Qy={class:"message-stack"},Xy={class:"request-card"},Zy={class:"request-title"},ew={class:"request-meta"},tw={key:0,class:"request-reason"},nw={key:1,class:"request-actions"},rw=["onClick"],sw=["onClick"],ow=["onClick"],iw=["onClick"],aw={key:2,class:"request-actions"},lw=["onClick"],cw=["onClick"],uw=["onClick"],dw=["onClick"],fw={key:3,class:"request-user-input"},hw={class:"request-question-title"},pw={key:0,class:"request-question-text"},mw=["value","onChange"],gw=["value"],vw=["value","onInput"],yw=["onClick"],ww={key:4,class:"request-actions"},bw=["onClick"],_w=["onClick"],kw={key:5,class:"request-actions"},Tw=["onClick"],Iw=["onClick"],Sw=["data-role","data-message-type"],Ew={key:0,class:"message-row","data-role":"system"},Cw={class:"message-stack","data-role":"system"},Aw=["onClick"],Rw={class:"cmd-label"},Pw={class:"cmd-status"},xw={class:"cmd-output-inner"},Mw={class:"cmd-output"},Ow=["data-role","data-message-type"],Nw=["data-role"],$w=["data-role"],Dw=["data-role"],Lw=["onClick"],jw=["src"],Fw={key:1,class:"message-file-attachments"},Bw=["href","title"],Uw=["data-role"],Hw={key:0,class:"worked-separator-wrap","aria-live":"polite"},Vw=["onClick"],Ww={class:"worked-separator-text"},zw={key:0,class:"worked-details"},Gw=["onClick"],qw={class:"cmd-label"},Kw={class:"cmd-status"},Jw={class:"cmd-output-inner"},Yw={class:"cmd-output"},Qw={key:1,class:"message-text-flow"},Xw={key:0,class:"message-text"},Zw={key:0},eb={key:1,class:"message-bold-text"},tb=["href","title"],nb=["href","title"],rb={key:4,class:"message-inline-code"},sb={key:1,class:"message-text"},ob=["onClick"],ib=["src","alt","onError"],ab={key:0,class:"message-actions"},lb=["onClick"],cb=["onClick"],ub={key:0,class:"conversation-item conversation-item-overlay"},db={class:"message-row"},fb={class:"message-stack"},hb={class:"live-overlay-inline","aria-live":"polite"},pb={class:"live-overlay-label"},mb={key:1,class:"live-overlay-error"},gb=["src"],vb=16,yb=Ut({__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(b){return b.messageType==="commandExecution"&&!!b.commandExecution}function a(b){var I;return((I=b.commandExecution)==null?void 0:I.status)==="inProgress"||r.value.has(b.id)?!0:n.value.has(b.id)}function l(b){return r.value.has(b.id)}function c(b){var S;if(((S=b.commandExecution)==null?void 0:S.status)==="inProgress")return;const I=new Set(n.value);I.has(b.id)?I.delete(b.id):I.add(b.id),n.value=I}function u(b){const I=new Set(s.value);I.has(b.id)?I.delete(b.id):I.add(b.id),s.value=I}function f(b){return s.value.has(b.id)}function m(b){const I=b.commandExecution;if(!I)return"";switch(I.status){case"inProgress":return"⟳ Running";case"completed":return I.exitCode===0?"✓ Completed":`✗ Exit ${I.exitCode??"?"}`;case"failed":return"✗ Failed";case"declined":return"⊘ Declined";case"interrupted":return"⊘ Interrupted";default:return""}}function _(b){var S,q;const I=(S=b.commandExecution)==null?void 0:S.status;return I==="inProgress"?"cmd-status-running":I==="completed"&&((q=b.commandExecution)==null?void 0:q.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function $(b){const I=new Set(r.value);I.add(b),r.value=I,setTimeout(()=>{const S=new Set(r.value);S.delete(b),r.value=S},1e3)}function A(b,I){const S=[];for(let q=I-1;q>=0;q--){const ge=b[q];if(ge.messageType==="commandExecution")S.unshift(ge);else if(ge.role==="user"||ge.messageType==="worked")break}return S}const L=e,X=t,O=D(null),z=D(null),V=D(null),fe=D(""),ie=D({}),ye=D({});let Te=0,re=0,ee=0;const we=new WeakSet,ne=D(new Set);function je(b){if(!b||/\s/u.test(b)||b.endsWith("/")||b.endsWith("\\"))return!1;if(b.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(b))return!1;const I=b.startsWith("/"),S=/^[A-Za-z]:[\\/]/u.test(b),q=b.startsWith("./")||b.startsWith("../")||b.startsWith("~/"),ge=b.includes("/")||b.includes("\\");return I||S||q||ge}function Fe(b){return b.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||b}function et(b){return b.replace(/\\/gu,"/")}function De(b){if(!b.startsWith("file://"))return b;let I=b.replace(/^file:\/\//u,"");try{I=decodeURIComponent(I)}catch{}return/^\/[A-Za-z]:\//u.test(I)&&(I=I.slice(1)),I}function Ee(b){const I=et(b),S=I.match(/^\/Users\/([^/]+)/u);if(S)return`/Users/${S[1]}`;const q=I.match(/^\/home\/([^/]+)/u);return q?`/home/${q[1]}`:""}function Oe(b){const I=et(b);if(!I)return I;let S="",q=I;const ge=q.match(/^([A-Za-z]:)(\/.*)?$/u);ge?(S=`${ge[1]}/`,q=(ge[2]??"").replace(/^\/+/u,"")):q.startsWith("/")&&(S="/",q=q.slice(1));const ce=q.split("/").filter(Boolean),Re=[];for(const Ve of ce)if(Ve!=="."){if(Ve===".."){Re.length>0&&Re.pop();continue}Re.push(Ve)}const Ie=Re.join("/");return S?`${S}${Ie}`.replace(/\/+$/u,"")||S:Ie||I}function tt(b,I){const S=et(De(b.trim()));if(!S)return"";if(S.startsWith("/")||/^[A-Za-z]:\//u.test(S))return Oe(S);if(S.startsWith("~/")){const ce=Ee(I);if(ce)return Oe(`${ce}/${S.slice(2)}`)}const ge=et(I.trim());return Oe(ge?`${ge.replace(/\/+$/u,"")}/${S}`:S)}function Qe(b){if(!b)return null;let I=b.trim();I=Ze(I).core.trim();let q=null;const ge=I.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(ge)I=ge[1],q=Number(ge[2]);else{const ce=I.match(/^(.*):(\d+)(?::\d+)?$/u);ce&&(I=ce[1],q=Number(ce[2]))}return I=De(I),je(I)?{path:I,line:q}:null}function Ze(b){let I=b,S="",q="";for(;/^[('"`[{<“‘]/u.test(I);)S+=I[0],I=I.slice(1);for(;/[)"'`\]}>”’]$/u.test(I);)q=I.slice(-1)+q,I=I.slice(0,-1);return{core:I,leading:S,trailing:q}}function Xe(b){const S=b.trim().match(/^\[([^\]\n]+)\]\(([^)\n]+)\)$/u);if(!S)return null;const q=(S[1]??"").trim(),ge=(S[2]??"").trim(),ce=Ze(q).core.trim()||q,Re=Ze(ge).core.trim();return Re?{label:ce,target:Re}:null}function ht(b){const I=[],S=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let q=0;for(const ge of b.matchAll(S)){if(typeof ge.index!="number")continue;const ce=ge.index,Re=ce+ge[0].length;ce>q&&I.push({kind:"text",value:b.slice(q,ce)});let Ie=ge[0],Ve="";for(;/[.,;:]$/u.test(Ie);)Ve=Ie.slice(-1)+Ve,Ie=Ie.slice(0,-1);const at=Ze(Ie);Ie=at.core;const lt=at.leading,$t=at.trailing+Ve;if(lt&&I.push({kind:"text",value:lt}),Ie.startsWith("**")&&Ie.endsWith("**")&&Ie.length>4)I.push({kind:"bold",value:Ie.slice(2,-2)}),$t&&I.push({kind:"text",value:$t});else if(/^https?:\/\//u.test(Ie))I.push({kind:"url",value:Ie,href:Ie}),$t&&I.push({kind:"text",value:$t});else{const Dt=Qe(Ie);Dt?(I.push({kind:"file",value:Ie,path:Dt.path,displayPath:Ie,downloadName:Fe(Dt.path)}),$t&&I.push({kind:"text",value:$t})):I.push({kind:"text",value:ge[0]})}q=Re}return q<b.length&&I.push({kind:"text",value:b.slice(q)}),Pt(I)}function Pt(b){const I=[];let S=!1,q="";const ge=ce=>{ce&&I.push({kind:"text",value:ce})};for(const ce of b){if(ce.kind!=="text"){S&&(ge(`**${q}`),S=!1,q=""),I.push(ce);continue}let Re=ce.value;for(;Re.length>0;){const Ie=Re.indexOf("**");if(Ie<0){S?q+=Re:ge(Re);break}const Ve=Re.slice(0,Ie);S?q+=Ve:ge(Ve),Re=Re.slice(Ie+2),S?(q.length>0?I.push({kind:"bold",value:q}):ge("****"),q="",S=!1):S=!0}}return S&&ge(`**${q}`),I}function qe(b){const I=/\[([^\]\n]+)\]\(([^)\n]+)\)/gu,S=[];let q=0;for(const ge of b.matchAll(I)){if(typeof ge.index!="number")continue;const[ce,Re,Ie]=ge,Ve=ge.index,at=Ve+ce.length;Ve>q&&S.push(...ht(b.slice(q,Ve)));const lt=Xe(`[${Re??""}](${Ie??""})`),$t=(lt==null?void 0:lt.label)??(Re??"").trim(),Dt=(lt==null?void 0:lt.target)??(Ie??"").trim();if(/^https?:\/\//u.test(Dt))S.push({kind:"url",value:$t||Dt,href:Dt});else{const dn=Qe(Dt);dn?S.push({kind:"file",value:Dt,path:dn.path,displayPath:$t||Dt,downloadName:Fe(dn.path)}):S.push({kind:"text",value:ce})}q=at}return q<b.length&&S.push(...ht(b.slice(q))),S}function nt(b){if(!b.includes("`"))return qe(b);const I=[];let S=0,q=0;for(;S<b.length;){if(b[S]!=="`"){S+=1;continue}let ge=1;for(;S+ge<b.length&&b[S+ge]==="`";)ge+=1;const ce="`".repeat(ge);let Re=S+ge,Ie=-1;for(;Re<b.length;){const at=b.indexOf(ce,Re);if(at<0)break;const lt=at>0&&b[at-1]==="`",$t=at+ge<b.length&&b[at+ge]==="`",Dt=b.slice(S+ge,at).includes(`
|
|
26
|
+
`);if(!lt&&!$t&&!Dt){Ie=at;break}Re=at+1}if(Ie<0){S+=ge;continue}S>q&&I.push(...qe(b.slice(q,S)));const Ve=b.slice(S+ge,Ie);if(Ve.length>0){const at=Xe(Ve);if(at)if(/^https?:\/\//u.test(at.target))I.push({kind:"url",value:at.label||at.target,href:at.target});else{const lt=Qe(at.target);lt?I.push({kind:"file",value:at.target,path:lt.path,displayPath:at.label||at.target,downloadName:Fe(lt.path)}):I.push({kind:"code",value:Ve})}else{const lt=Qe(Ve);if(lt){const $t=lt.line?`${lt.path}:${String(lt.line)}`:lt.path;I.push({kind:"file",value:Ve,path:lt.path,displayPath:$t,downloadName:Fe(lt.path)})}else I.push({kind:"code",value:Ve})}}else I.push({kind:"text",value:`${ce}${ce}`});S=Ie+ge,q=S}return q<b.length&&I.push(...qe(b.slice(q))),I}function W(b){const I=b.trim();if(!I)return"";if(I.startsWith("data:")||I.startsWith("blob:")||I.startsWith("http://")||I.startsWith("https://")||I.startsWith("/codex-local-image?"))return I;if(I.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(I)}`;const S=I.startsWith("/"),q=/^[A-Za-z]:[\\/]/u.test(I);return S||q?`/codex-local-image?path=${encodeURIComponent(I)}`:I}function me(b){const I=b.trim();if(!I)return"#";const S=Re=>Re.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(Re),q=Qe(I),ge=(q==null?void 0:q.path)??I,ce=tt(ge,L.cwd);if(S(ce)){const Re=ce.startsWith("/")?ce:`/${ce}`;return`/codex-local-browse${encodeURI(Re)}`}return"#"}function ae(b){if(!b.includes(")return[{kind:"text",value:b}];const I=[],S=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let q=0;for(const ge of b.matchAll(S)){const[ce,Re,Ie]=ge;if(typeof ge.index!="number")continue;const Ve=ge.index,at=Ve+ce.length,lt=W(Ie.trim());lt&&(Ve>q&&I.push({kind:"text",value:b.slice(q,Ve)}),I.push({kind:"image",url:lt,alt:Re.trim(),markdown:ce}),q=at)}return q<b.length&&I.push({kind:"text",value:b.slice(q)}),I.length>0?I:[{kind:"text",value:b}]}function pe(b){return b!==null&&typeof b=="object"&&!Array.isArray(b)?b:null}function Ne(b){const I=new Date(b);return Number.isNaN(I.getTime())?b:I.toLocaleTimeString()}function g(b){const I=pe(b.params),S=I==null?void 0:I.reason;return typeof S=="string"?S.trim():""}function v(b,I){return`${String(b)}:${I}`}function C(b){const I=pe(b.params),S=Array.isArray(I==null?void 0:I.questions)?I.questions:[],q=[];for(const ge of S){const ce=pe(ge);if(!ce)continue;const Re=typeof ce.id=="string"?ce.id:"";if(!Re)continue;const Ie=Array.isArray(ce.options)?ce.options.map(Ve=>pe(Ve)).map(Ve=>Ve==null?void 0:Ve.label).filter(Ve=>typeof Ve=="string"&&Ve.length>0):[];q.push({id:Re,header:typeof ce.header=="string"?ce.header:"",question:typeof ce.question=="string"?ce.question:"",isOther:ce.isOther===!0,options:Ie})}return q}function B(b,I,S){const q=v(b,I),ge=ie.value[q];return typeof ge=="string"&&ge.length>0?ge:S}function F(b,I){const S=v(b,I);return ye.value[S]??""}function P(b,I,S){const q=S.target;if(!(q instanceof HTMLSelectElement))return;const ge=v(b,I);ie.value={...ie.value,[ge]:q.value}}function U(b,I,S){const q=S.target;if(!(q instanceof HTMLInputElement))return;const ge=v(b,I);ye.value={...ye.value,[ge]:q.value}}function j(b,I){X("respondServerRequest",{id:b,result:{decision:I}})}function K(b){const I=C(b),S={};for(const q of I){const ge=B(b.id,q.id,q.options[0]||""),ce=F(b.id,q.id).trim(),Re=[ge,ce].map(Ie=>Ie.trim()).filter(Ie=>Ie.length>0);S[q.id]={answers:Re}}X("respondServerRequest",{id:b.id,result:{answers:S}})}function H(b){X("respondServerRequest",{id:b,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function _e(b){X("respondServerRequest",{id:b,result:{success:!0,contentItems:[]}})}function ue(b){X("respondServerRequest",{id:b,result:{}})}function ve(b){X("respondServerRequest",{id:b,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function Se(b){return!(b.role!=="user"&&b.role!=="assistant"||typeof b.turnIndex!="number"||L.isTurnInProgress||L.isRollingBack)}function Pe(b){return b.role!=="user"&&b.role!=="assistant"?!1:b.text.trim().length>0}function Ke(b){return Pe(b)||Se(b)}async function xe(b){if(!Pe(b))return;const I=b.text.trim();try{await navigator.clipboard.writeText(I)}catch{const S=document.createElement("textarea");S.value=I,S.setAttribute("readonly","true"),S.style.position="fixed",S.style.opacity="0",document.body.appendChild(S),S.select(),document.execCommand("copy"),document.body.removeChild(S)}}function He(b){Se(b)&&X("rollback",{turnIndex:b.turnIndex})}function kt(){const b=O.value,I=z.value;!b||!I||(b.scrollTop=b.scrollHeight,I.scrollIntoView({block:"end"}))}function ze(b){return b.scrollHeight-(b.scrollTop+b.clientHeight)<=vb}function Je(b){if(!L.activeThreadId)return;const I=Math.max(b.scrollHeight-b.clientHeight,0),S=I>0?Math.min(Math.max(b.scrollTop/I,0),1):1;X("updateScrollState",{threadId:L.activeThreadId,state:{scrollTop:b.scrollTop,isAtBottom:ze(b),scrollRatio:S}})}function Mt(){const b=O.value;if(!b)return;const I=L.scrollState;if(!I||I.isAtBottom){Ht();return}const S=Math.max(b.scrollHeight-b.clientHeight,0),q=typeof I.scrollRatio=="number"?I.scrollRatio*S:I.scrollTop;b.scrollTop=Math.min(Math.max(q,0),S),Je(b)}function Ht(){const b=O.value;b&&(kt(),Je(b))}function vt(){const b=L.scrollState;return!b||b.isAtBottom===!0}function Tt(){if(!vt()){ee=0,re=0;return}if(Ht(),ee-=1,ee<=0){re=0;return}re=requestAnimationFrame(Tt)}function Ot(b=6){vt()&&(re&&(cancelAnimationFrame(re),re=0),ee=Math.max(b,1),re=requestAnimationFrame(Tt))}function Xt(){Ot(3)}function G(){if(!vt())return;const b=O.value;if(!b)return;const I=b.querySelectorAll("img.message-image-preview");for(const S of I)S.complete||we.has(S)||(we.add(S),S.addEventListener("load",Xt,{once:!0}),S.addEventListener("error",Xt,{once:!0}))}async function J(){await cn(),Te&&cancelAnimationFrame(Te),Te=requestAnimationFrame(()=>{Te=0,Mt(),G(),Ot()})}mt(()=>L.messages,async b=>{if(!L.isLoading){for(const I of b){if(I.messageType!=="commandExecution"||!I.commandExecution)continue;const S=o.value[I.id],q=I.commandExecution.status;S==="inProgress"&&q!=="inProgress"&&$(I.id),o.value[I.id]=q}await J()}}),mt(()=>L.liveOverlay,async b=>{b&&(await cn(),Ht(),Ot(8))},{deep:!0}),mt(()=>L.isLoading,async b=>{b||await J()}),mt(()=>L.activeThreadId,()=>{fe.value="",ne.value=new Set},{flush:"post"});function N(){const b=O.value;!b||L.isLoading||Je(b)}function le(b){fe.value=W(b)}function Nt(b,I){return`${b}:${String(I)}`}function It(b,I){const S=new Set(ne.value);S.add(Nt(b,I)),ne.value=S}function Vt(b,I){return ne.value.has(Nt(b,I))}function xt(){fe.value=""}function Zt(){const b=V.value;b&&(b.scrollTop=b.scrollHeight)}return mt(()=>{var b;return(b=L.liveOverlay)==null?void 0:b.reasoningText},async b=>{b&&(await cn(),Zt())}),cr(()=>{Te&&cancelAnimationFrame(Te),re&&cancelAnimationFrame(re)}),(b,I)=>(w(),T("section",qy,[e.isLoading?(w(),T("p",Ky,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(w(),T("p",Jy," No messages in this thread yet. ")):(w(),T("ul",{key:2,ref_key:"conversationListRef",ref:O,class:"conversation-list",onScroll:N},[(w(!0),T(Le,null,Ct(e.pendingRequests,S=>(w(),T("li",{key:`server-request:${S.id}`,class:"conversation-item conversation-item-request"},[p("div",Yy,[p("div",Qy,[p("article",Xy,[p("p",Zy,se(S.method),1),p("p",ew,"Request #"+se(S.id)+" · "+se(Ne(S.receivedAtIso)),1),g(S)?(w(),T("p",tw,se(g(S)),1)):oe("",!0),S.method==="item/commandExecution/requestApproval"?(w(),T("section",nw,[p("button",{type:"button",class:"request-button request-button-primary",onClick:q=>j(S.id,"accept")},"Accept",8,rw),p("button",{type:"button",class:"request-button",onClick:q=>j(S.id,"acceptForSession")},"Accept for Session",8,sw),p("button",{type:"button",class:"request-button",onClick:q=>j(S.id,"decline")},"Decline",8,ow),p("button",{type:"button",class:"request-button",onClick:q=>j(S.id,"cancel")},"Cancel",8,iw)])):S.method==="item/fileChange/requestApproval"?(w(),T("section",aw,[p("button",{type:"button",class:"request-button request-button-primary",onClick:q=>j(S.id,"accept")},"Accept",8,lw),p("button",{type:"button",class:"request-button",onClick:q=>j(S.id,"acceptForSession")},"Accept for Session",8,cw),p("button",{type:"button",class:"request-button",onClick:q=>j(S.id,"decline")},"Decline",8,uw),p("button",{type:"button",class:"request-button",onClick:q=>j(S.id,"cancel")},"Cancel",8,dw)])):S.method==="item/tool/requestUserInput"?(w(),T("section",fw,[(w(!0),T(Le,null,Ct(C(S),q=>(w(),T("div",{key:`${S.id}:${q.id}`,class:"request-question"},[p("p",hw,se(q.header||q.question),1),q.header&&q.question?(w(),T("p",pw,se(q.question),1)):oe("",!0),p("select",{class:"request-select",value:B(S.id,q.id,q.options[0]||""),onChange:ge=>P(S.id,q.id,ge)},[(w(!0),T(Le,null,Ct(q.options,ge=>(w(),T("option",{key:`${S.id}:${q.id}:${ge}`,value:ge},se(ge),9,gw))),128))],40,mw),q.isOther?(w(),T("input",{key:1,class:"request-input",type:"text",value:F(S.id,q.id),placeholder:"Other answer",onInput:ge=>U(S.id,q.id,ge)},null,40,vw)):oe("",!0)]))),128)),p("button",{type:"button",class:"request-button request-button-primary",onClick:q=>K(S)}," Submit Answers ",8,yw)])):S.method==="item/tool/call"?(w(),T("section",ww,[p("button",{type:"button",class:"request-button request-button-primary",onClick:q=>H(S.id)},"Fail Tool Call",8,bw),p("button",{type:"button",class:"request-button",onClick:q=>_e(S.id)},"Success (Empty)",8,_w)])):(w(),T("section",kw,[p("button",{type:"button",class:"request-button request-button-primary",onClick:q=>ue(S.id)},"Return Empty Result",8,Tw),p("button",{type:"button",class:"request-button",onClick:q=>ve(S.id)},"Reject Request",8,Iw)]))])])])]))),128)),(w(!0),T(Le,null,Ct(e.messages,S=>{var q,ge;return w(),T("li",{key:S.id,class:gt(["conversation-item",{"conversation-item-actionable":Ke(S)}]),"data-role":S.role,"data-message-type":S.messageType||""},[i(S)?(w(),T("div",Ew,[p("div",Cw,[p("button",{type:"button",class:gt(["cmd-row",[_(S),{"cmd-expanded":a(S)}]]),onClick:ce=>c(S)},[p("span",{class:gt(["cmd-chevron",{"cmd-chevron-open":a(S)}])},"▶",2),p("code",Rw,se(((q=S.commandExecution)==null?void 0:q.command)||"(command)"),1),p("span",Pw,se(m(S)),1)],10,Aw),p("div",{class:gt(["cmd-output-wrap",{"cmd-output-visible":a(S),"cmd-output-collapsing":l(S)}])},[p("div",xw,[p("pre",Mw,se(((ge=S.commandExecution)==null?void 0:ge.aggregatedOutput)||"(no output)"),1)])],2)])])):(w(),T("div",{key:1,class:"message-row","data-role":S.role,"data-message-type":S.messageType||""},[p("div",{class:"message-stack","data-role":S.role},[p("article",{class:"message-body","data-role":S.role},[S.images&&S.images.length>0?(w(),T("ul",{key:0,class:"message-image-list","data-role":S.role},[(w(!0),T(Le,null,Ct(S.images,ce=>(w(),T("li",{key:ce,class:"message-image-item"},[p("button",{class:"message-image-button",type:"button",onClick:Re=>le(ce)},[p("img",{class:"message-image-preview",src:W(ce),alt:"Message image preview",loading:"lazy"},null,8,jw)],8,Lw)]))),128))],8,Dw)):oe("",!0),S.fileAttachments&&S.fileAttachments.length>0?(w(),T("div",Fw,[(w(!0),T(Le,null,Ct(S.fileAttachments,ce=>(w(),T("span",{key:ce.path,class:"message-file-chip"},[I[1]||(I[1]=p("span",{class:"message-file-chip-icon"},"📄",-1)),p("a",{class:"message-file-link message-file-chip-name",href:me(ce.path),target:"_blank",rel:"noopener noreferrer",title:ce.path},se(ce.path),9,Bw)]))),128))])):oe("",!0),S.text.length>0?(w(),T("article",{key:2,class:"message-card","data-role":S.role},[S.messageType==="worked"?(w(),T("div",Hw,[p("button",{type:"button",class:"worked-separator",onClick:ce=>u(S)},[I[2]||(I[2]=p("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),p("span",{class:gt(["worked-chevron",{"worked-chevron-open":f(S)}])},"▶",2),p("p",Ww,se(S.text),1),I[3]||(I[3]=p("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,Vw),f(S)?(w(),T("div",zw,[(w(!0),T(Le,null,Ct(A(e.messages,e.messages.indexOf(S)),ce=>{var Re,Ie;return w(),T("div",{key:`worked-cmd-${ce.id}`,class:"worked-cmd-item"},[p("button",{type:"button",class:gt(["cmd-row",[_(ce),{"cmd-expanded":a(ce)}]]),onClick:Ve=>c(ce)},[p("span",{class:gt(["cmd-chevron",{"cmd-chevron-open":a(ce)}])},"▶",2),p("code",qw,se(((Re=ce.commandExecution)==null?void 0:Re.command)||"(command)"),1),p("span",Kw,se(m(ce)),1)],10,Gw),p("div",{class:gt(["cmd-output-wrap",{"cmd-output-visible":a(ce),"cmd-output-collapsing":l(ce)}])},[p("div",Jw,[p("pre",Yw,se(((Ie=ce.commandExecution)==null?void 0:Ie.aggregatedOutput)||"(no output)"),1)])],2)])}),128))])):oe("",!0)])):(w(),T("div",Qw,[(w(!0),T(Le,null,Ct(ae(S.text),(ce,Re)=>(w(),T(Le,{key:`block-${Re}`},[ce.kind==="text"?(w(),T("p",Xw,[(w(!0),T(Le,null,Ct(nt(ce.value),(Ie,Ve)=>(w(),T(Le,{key:`seg-${Re}-${Ve}`},[Ie.kind==="text"?(w(),T("span",Zw,se(Ie.value),1)):Ie.kind==="bold"?(w(),T("strong",eb,se(Ie.value),1)):Ie.kind==="file"?(w(),T("a",{key:2,class:"message-file-link",href:me(Ie.path),target:"_blank",rel:"noopener noreferrer",title:Ie.path},se(Ie.displayPath),9,tb)):Ie.kind==="url"?(w(),T("a",{key:3,class:"message-file-link",href:Ie.href,target:"_blank",rel:"noopener noreferrer",title:Ie.href},se(Ie.value),9,nb)):(w(),T("code",rb,se(Ie.value),1))],64))),128))])):Vt(S.id,Re)?(w(),T("p",sb,se(ce.markdown),1)):(w(),T("button",{key:2,class:"message-image-button",type:"button",onClick:Ie=>le(ce.url)},[p("img",{class:"message-image-preview message-markdown-image",src:ce.url,alt:ce.alt||"Embedded message image",loading:"lazy",onError:Ie=>It(S.id,Re)},null,40,ib)],8,ob))],64))),128))]))],8,Uw)):oe("",!0)],8,$w),Ke(S)?(w(),T("div",ab,[Pe(S)?(w(),T("button",{key:0,class:"message-action-button",type:"button",title:"Copy message text",onClick:ce=>xe(S)},[Ae(Gy,{class:"message-action-icon"}),I[4]||(I[4]=p("span",{class:"message-action-label"},"Copy",-1))],8,lb)):oe("",!0),Se(S)?(w(),T("button",{key:1,class:"message-action-button",type:"button",title:"Rollback to this message (remove this turn and all after it)",onClick:ce=>He(S)},[Ae(Hy,{class:"message-action-icon"}),I[5]||(I[5]=p("span",{class:"message-action-label"},"Rollback",-1))],8,cb)):oe("",!0)])):oe("",!0)],8,Nw)],8,Ow))],10,Sw)}),128)),e.liveOverlay?(w(),T("li",ub,[p("div",db,[p("div",fb,[p("article",hb,[p("p",pb,se(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(w(),T("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:V},se(e.liveOverlay.reasoningText),513)):oe("",!0),e.liveOverlay.errorText?(w(),T("p",mb,se(e.liveOverlay.errorText),1)):oe("",!0)])])])])):oe("",!0),p("li",{ref_key:"bottomAnchorRef",ref:z,class:"conversation-bottom-anchor"},null,512)],544)),fe.value.length>0?(w(),T("div",{key:3,class:"image-modal-backdrop",onClick:xt},[p("div",{class:"image-modal-content",onClick:I[0]||(I[0]=rt(()=>{},["stop"]))},[p("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:xt},[Ae(Qa,{class:"icon-svg"})]),p("img",{class:"image-modal-image",src:fe.value,alt:"Expanded message image"},null,8,gb)])])):oe("",!0)]))}}),wb=ot(yb,[["__scopeId","data-v-b2208f01"]]);function bb(e){var u;const t=D("idle"),n=D(typeof navigator<"u"&&!!((u=navigator.mediaDevices)!=null&&u.getUserMedia));let r=null,s=null,o=[];async function i(){var f;if(!(t.value!=="idle"||!n.value))try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),o=[],r=new MediaRecorder(s),r.ondataavailable=m=>{m.data.size>0&&o.push(m.data)},r.onstop=()=>{var $;const m=o,_=(r==null?void 0:r.mimeType)||(($=m[0])==null?void 0:$.type)||"audio/webm";c(),t.value="idle",l(m,_)},r.start(),t.value="recording"}catch(m){c(),(f=e.onError)==null||f.call(e,m)}}function a(){t.value!=="recording"||!r||r.state!=="inactive"&&r.stop()}async function l(f,m){var $;if(f.length===0)return;const _=new Blob(f,{type:m});try{const A=m.split(/[/;]/)[1]??"webm",L=`----codex-transcribe-${crypto.randomUUID()}`,X=new Uint8Array(await _.arrayBuffer()),O=new TextEncoder,z=[];z.push(O.encode(`--${L}\r
|
|
27
|
+
`)),z.push(O.encode(`Content-Disposition: form-data; name="file"; filename="codex.${A}"\r
|
|
28
|
+
`)),z.push(O.encode(`Content-Type: ${m}\r
|
|
29
|
+
\r
|
|
30
|
+
`)),z.push(X),z.push(O.encode(`\r
|
|
31
|
+
--${L}--\r
|
|
32
|
+
`));let V=0;for(const ee of z)V+=ee.byteLength;const fe=new Uint8Array(V);let ie=0;for(const ee of z)fe.set(ee,ie),ie+=ee.byteLength;const ye=await fetch("/codex-api/transcribe",{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${L}`},body:fe});if(!ye.ok)throw new Error(`Transcription failed: ${ye.status}`);const re=((await ye.json()).text??"").trim();re.length>0&&e.onTranscript(re)}catch(A){($=e.onError)==null||$.call(e,A)}finally{t.value!=="recording"&&(t.value="idle")}}function c(){r&&(r.ondataavailable=null,r.onstop=null,r=null),s&&(s.getTracks().forEach(f=>f.stop()),s=null),o=[]}return cr(c),{state:t,isSupported:n,startRecording:i,stopRecording:a}}function Pc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Zn extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Xa(e,t){const n=Pc(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=Pc(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function ws(e,t,n){return e instanceof Zn?e:e instanceof Error?new Zn(e.message||t,{code:"unknown_error",method:n}):new Zn(t,{code:"unknown_error",method:n})}function Qd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function _b(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 Zn(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 Zn(Xa(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 Zn(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function xc(e){const t=Qd(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 kb(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=xc(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 c=JSON.parse(String(l.data)),u=xc(c);u&&e(u)}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 Tb(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 Zn(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 Zn(Xa(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function Ib(){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 Zn(Xa(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Qd(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function Mc(e){return new Date(e*1e3).toISOString()}function Sb(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Eb(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Cb=/^##\s+(.+?):\s+(.+?)\s*$/,Ab=/^#\s*files mentioned by the user\s*:?\s*$/i;function Rb(e){var s,o;const t=e.split(`
|
|
33
|
+
`).findIndex(i=>Ab.test(i.trim()));if(t<0)return[];const n=e.split(`
|
|
34
|
+
`).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(Cb);if(!l)break;const c=(s=l[1])==null?void 0:s.trim(),u=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");c&&u&&r.push({label:c,path:u})}return r}function Pb(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 xb(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:Eb(l),isUnhandled:!0});const o=n.join(`
|
|
35
|
+
`),i=Rb(o);return{text:Pb(o),images:r,fileAttachments:i,rawBlocks:s}}function Mb(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=xb(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=Ob(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 Ob(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Nb(e){const t=[e.preview];for(const n of t)if(typeof n=="string"&&n.trim().length>0)return n.trim();return""}function $b(e){const t=Nb(e);return t.length>0?t:"Untitled thread"}function Xd(e){return(e==null?void 0:e.status)==="inProgress"}function Db(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 Xd(r)}function Lb(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:$b(e),projectName:Sb(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:Mc(e.createdAt),updatedAtIso:Mc(e.updatedAt),preview:e.preview,unread:!1,inProgress:Db(e)}}function jb(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 Fb(e){const t=e.data.map(Lb);return jb(t)}function Zd(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 Mb(i))n.push({...a,turnIndex:r})}return n}function Bb(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Xd(t.at(-1))}async function un(e,t){try{return await _b(e,t)}catch(n){throw ws(n,`RPC ${e} failed`,e)}}function Ub(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}async function Hb(){const e=await un("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return Fb(e)}async function Vb(e){const t=await un("thread/read",{threadId:e,includeTurns:!0});return{messages:Zd(t),inProgress:Bb(t)}}async function Wb(){try{return await Hb()}catch(e){throw ws(e,"Failed to load thread groups","thread/list")}}async function zb(e){try{return await Vb(e)}catch(t){throw ws(t,`Failed to load thread ${e}`,"thread/read")}}function Gb(e){return kb(e)}async function qb(e,t){await Tb({id:e,...t})}async function Kb(){return Ib()}async function Ni(e){await un("thread/resume",{threadId:e})}async function Jb(e){await un("thread/archive",{threadId:e})}async function Yb(e,t){await un("thread/name/set",{threadId:e,name:t})}async function Oc(e,t){const n=await un("thread/rollback",{threadId:e,numTurns:t});return Zd(n)}function Qb(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 Nc(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 un("thread/start",n),s=Qb(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw ws(n,"Failed to start a new thread","thread/start")}}function Xb(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
36
|
+
`;for(const r of t)n+=`
|
|
37
|
+
## ${r.label}: ${r.path}
|
|
38
|
+
`;return`${n}
|
|
39
|
+
## My request for Codex:
|
|
40
|
+
|
|
41
|
+
${e}
|
|
42
|
+
`}async function $i(e,t,n=[],r,s,o,i=[]){try{const l=[{type:"text",text:Xb(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 c=i.map(f=>({label:f.label,path:f.path,fsPath:f.fsPath})),u={threadId:e,input:l};c.length>0&&(u.attachments=c),typeof r=="string"&&r.length>0&&(u.model=r),typeof s=="string"&&s.length>0&&(u.effort=s),await un("turn/start",u)}catch(a){throw ws(a,`Failed to start turn for thread ${e}`,"turn/start")}}async function Zb(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 un("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw ws(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function e_(e){await un("setDefaultModel",{model:e})}async function t_(){const e=await un("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 n_(){const e=await un("config/read",{}),t=e.config.model??"",n=Ub(e.config.model_reasoning_effort);return{model:t,reasoningEffort:n}}function r_(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 pa(){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 r_(n.data)}async function s_(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 $c(){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 o_(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 i_(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=Za(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 a_(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=Za(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 l_(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 c=Za(o,"Failed to search files");throw new Error(c)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const c of a){if(!c||typeof c!="object"||Array.isArray(c))continue;const f=c.path,m=typeof f=="string"?f.trim():"";m&&l.push({path:m})}return l}async function c_(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 Za(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 u_(){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 Di(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 d_(e,t){var n;try{return((n=(await un("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function f_(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await un("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 Dc(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 h_={},p_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function m_(e,t){return w(),T("svg",p_,[...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 g_=ot(h_,[["render",m_]]),v_={},y_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function w_(e,t){return w(),T("svg",y_,[...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 b_=ot(v_,[["render",w_]]),__={},k_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function T_(e,t){return w(),T("svg",k_,[...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 I_=ot(__,[["render",T_]]),S_=["disabled"],E_={class:"composer-dropdown-value"},C_={class:"composer-dropdown-menu"},A_={key:0,class:"composer-dropdown-search-wrap"},R_=["placeholder","onKeydown"],P_={class:"composer-dropdown-options",role:"listbox"},x_=["onClick"],M_={key:0,class:"composer-dropdown-empty"},O_={key:1,class:"composer-dropdown-add-wrap"},N_=["placeholder","onKeydown"],$_=Ut({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},showAddAction:{type:Boolean},addActionLabel:{},defaultAddValue:{},addPlaceholder:{}},emits:["update:modelValue","add"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(null),a=D(!1),l=D(""),c=D(!1),u=D(""),f=he(()=>{var we;const ee=n.options.find(ne=>ne.value===n.modelValue);return ee?ee.label:((we=n.placeholder)==null?void 0:we.trim())||""}),m=he(()=>n.openDirection??"down"),_=he(()=>n.enableSearch===!0),$=he(()=>n.showAddAction===!0),A=he(()=>{var ee;return((ee=n.searchPlaceholder)==null?void 0:ee.trim())||"Quick search projects"}),L=he(()=>{var ee;return((ee=n.addActionLabel)==null?void 0:ee.trim())||"Add new project"}),X=he(()=>{var ee;return((ee=n.addPlaceholder)==null?void 0:ee.trim())||"Project name or absolute path"}),O=he(()=>{const ee=l.value.trim().toLowerCase();return ee?n.options.filter(we=>we.label.toLowerCase().includes(ee)||we.value.toLowerCase().includes(ee)):n.options});function z(){n.disabled||(a.value=!a.value)}function V(ee){r("update:modelValue",ee),a.value=!1,l.value=""}function fe(){var ee;c.value=!0,u.value=((ee=n.defaultAddValue)==null?void 0:ee.trim())||"",cn(()=>{var we;return(we=i.value)==null?void 0:we.focus()})}function ie(){if(l.value.length>0){l.value="";return}a.value=!1}function ye(){const ee=u.value.trim();ee&&(r("add",ee),c.value=!1,u.value="",a.value=!1,l.value="")}function Te(){c.value=!1,u.value="",a.value=!1,l.value=""}function re(ee){if(!a.value)return;const we=s.value;if(!we)return;const ne=ee.target;ne instanceof Node&&(we.contains(ne)||(a.value=!1,l.value="",c.value=!1,u.value=""))}return mt(a,ee=>{if(!ee){c.value=!1,u.value="";return}_.value&&cn(()=>{var we;return(we=o.value)==null?void 0:we.focus()})}),lr(()=>{window.addEventListener("pointerdown",re)}),cr(()=>{window.removeEventListener("pointerdown",re)}),(ee,we)=>(w(),T("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[p("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:z},[p("span",E_,se(f.value),1),Ae(ui,{class:"composer-dropdown-chevron"})],8,S_),a.value?(w(),T("div",{key:0,class:gt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":m.value==="up","composer-dropdown-menu-wrap-down":m.value==="down"}])},[p("div",C_,[_.value?(w(),T("div",A_,[rr(p("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":we[0]||(we[0]=ne=>l.value=ne),class:"composer-dropdown-search-input",type:"text",placeholder:A.value,onKeydown:rn(rt(ie,["prevent"]),["esc"])},null,40,R_),[[sr,l.value]])])):oe("",!0),p("ul",P_,[(w(!0),T(Le,null,Ct(O.value,ne=>(w(),T("li",{key:ne.value},[p("button",{class:gt(["composer-dropdown-option",{"is-selected":ne.value===e.modelValue}]),type:"button",onClick:je=>V(ne.value)},se(ne.label),11,x_)]))),128)),O.value.length===0?(w(),T("li",M_," No matching projects ")):oe("",!0)]),$.value?(w(),T("div",O_,[c.value?(w(),T(Le,{key:0},[rr(p("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":we[1]||(we[1]=ne=>u.value=ne),class:"composer-dropdown-add-input",type:"text",placeholder:X.value,onKeydown:[rn(rt(ye,["prevent"]),["enter"]),rn(rt(Te,["prevent"]),["esc"])]},null,40,N_),[[sr,u.value]]),p("div",{class:"composer-dropdown-add-actions"},[p("button",{type:"button",class:"composer-dropdown-add-btn",onClick:ye},"Open"),p("button",{type:"button",class:"composer-dropdown-add-btn",onClick:Te},"Cancel")])],64)):(w(),T("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:fe},se(L.value),1))])):oe("",!0)])],2)):oe("",!0)],512))}}),ma=ot($_,[["__scopeId","data-v-7cfa2012"]]),D_=["disabled"],L_={class:"search-dropdown-value"},j_={class:"search-dropdown-search-wrap"},F_=["placeholder","onKeydown"],B_={key:0,class:"search-dropdown-list",role:"listbox"},U_=["onClick","onPointerenter"],H_={class:"search-dropdown-option-check"},V_={class:"search-dropdown-option-label"},W_={key:0,class:"search-dropdown-option-desc"},z_={key:1,class:"search-dropdown-empty"},G_=Ut({__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),c=he(()=>n.openDirection??"down"),u=he(()=>new Set(n.selectedValues)),f=he(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const O=n.options.find(z=>z.value===n.selectedValues[0]);return(O==null?void 0:O.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),m=he(()=>{const O=a.value.toLowerCase().trim();return O?n.options.filter(z=>{var V;return z.label.toLowerCase().includes(O)||(((V=z.description)==null?void 0:V.toLowerCase().includes(O))??!1)}):n.options});function _(){n.disabled||(i.value=!i.value,i.value&&(a.value="",l.value=0,cn(()=>{var O;return(O=o.value)==null?void 0:O.focus()})))}function $(O){r("toggle",O.value,!u.value.has(O.value))}function A(O){m.value.length!==0&&(l.value=(l.value+O+m.value.length)%m.value.length)}function L(){const O=m.value[l.value];O&&$(O)}function X(O){if(!i.value)return;const z=s.value;if(!z)return;const V=O.target;V instanceof Node&&(z.contains(V)||(i.value=!1))}return mt(a,()=>{l.value=0}),lr(()=>window.addEventListener("pointerdown",X)),cr(()=>window.removeEventListener("pointerdown",X)),(O,z)=>(w(),T("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[p("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:_},[p("span",L_,se(f.value),1),Ae(ui,{class:"search-dropdown-chevron"})],8,D_),i.value?(w(),T("div",{key:0,class:gt(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":c.value==="up","search-dropdown-menu-wrap-down":c.value==="down"}])},[p("div",j_,[rr(p("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":z[0]||(z[0]=V=>a.value=V),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[z[1]||(z[1]=rn(rt(V=>i.value=!1,["prevent"]),["escape"])),rn(rt(L,["prevent"]),["enter"]),z[2]||(z[2]=rn(rt(V=>A(1),["prevent"]),["arrow-down"])),z[3]||(z[3]=rn(rt(V=>A(-1),["prevent"]),["arrow-up"]))]},null,40,F_),[[sr,a.value]])]),m.value.length>0?(w(),T("ul",B_,[(w(!0),T(Le,null,Ct(m.value,(V,fe)=>(w(),T("li",{key:V.value},[p("button",{class:gt(["search-dropdown-option",{"is-selected":u.value.has(V.value),"is-highlighted":fe===l.value}]),type:"button",onClick:ie=>$(V),onPointerenter:ie=>l.value=fe},[p("span",H_,se(u.value.has(V.value)?"✓":""),1),p("span",V_,se(V.label),1),V.description?(w(),T("span",W_,se(V.description),1)):oe("",!0)],42,U_)]))),128))])):(w(),T("div",z_,"No results"))],2)):oe("",!0)],512))}}),q_=ot(G_,[["__scopeId","data-v-a0f2edd4"]]),K_={class:"skill-picker-header"},J_=["onKeydown"],Y_={key:0,class:"skill-picker-list",role:"listbox"},Q_=["onClick","onPointerenter"],X_={class:"skill-picker-name"},Z_={key:0,class:"skill-picker-desc"},ek={key:1,class:"skill-picker-empty"},tk=Ut({__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=he(()=>{const m=i.value.toLowerCase().trim();return m?n.skills.filter(_=>_.name.toLowerCase().includes(m)||_.description.toLowerCase().includes(m)):n.skills}),c=he(()=>{const m={};return n.anchorBottom!=null&&(m.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(m.left=`${n.anchorLeft}px`),m});function u(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 mt(()=>n.visible,m=>{m&&(i.value="",a.value=0,cn(()=>{var _;return(_=o.value)==null?void 0:_.focus()}))}),mt(i,()=>{a.value=0}),(m,_)=>e.visible?(w(),T("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:zr(c.value)},[p("div",K_,[rr(p("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":_[0]||(_[0]=$=>i.value=$),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[_[1]||(_[1]=rn(rt($=>m.$emit("close"),["prevent"]),["escape"])),rn(rt(f,["prevent"]),["enter"]),_[2]||(_[2]=rn(rt($=>u(1),["prevent"]),["arrow-down"])),_[3]||(_[3]=rn(rt($=>u(-1),["prevent"]),["arrow-up"]))]},null,40,J_),[[sr,i.value]])]),l.value.length>0?(w(),T("ul",Y_,[(w(!0),T(Le,null,Ct(l.value,($,A)=>(w(),T("li",{key:$.path},[p("button",{class:gt(["skill-picker-item",{"is-highlighted":A===a.value}]),type:"button",onClick:L=>m.$emit("select",$),onPointerenter:L=>a.value=A},[p("span",X_,se($.name),1),$.description?(w(),T("span",Z_,se($.description),1)):oe("",!0)],42,Q_)]))),128))])):(w(),T("div",ek,"No skills found"))],4)):oe("",!0)}}),nk=ot(tk,[["__scopeId","data-v-ff3fb7dc"]]),rk={key:0,class:"thread-composer-attachments"},sk=["src","alt"],ok=["aria-label","disabled","onClick"],ik={key:1,class:"thread-composer-folder-chips"},ak=["title"],lk={class:"thread-composer-folder-chip-meta"},ck=["aria-label","disabled","onClick"],uk={key:2,class:"thread-composer-file-chips"},dk=["title"],fk=["aria-label","disabled","onClick"],hk={key:3,class:"thread-composer-skill-chips"},pk={class:"thread-composer-skill-chip-name"},mk=["aria-label","onClick"],gk={class:"thread-composer-input-wrap"},vk={key:0,class:"thread-composer-file-mentions"},yk=["onMousedown"],wk={key:1,class:"thread-composer-file-mention-icon-markdown"},bk={class:"thread-composer-file-mention-text"},_k={class:"thread-composer-file-mention-name"},kk={key:0,class:"thread-composer-file-mention-dir"},Tk={key:1,class:"thread-composer-file-mention-empty"},Ik=["placeholder","disabled"],Sk={class:"thread-composer-controls"},Ek=["disabled"],Ck={key:0,class:"thread-composer-attach-menu"},Ak=["disabled"],Rk=["disabled"],Pk=["disabled"],xk={class:"thread-composer-actions"},Mk=["aria-label","title","disabled"],Ok=["disabled"],Nk=["aria-label","title","disabled"],$k=["disabled"],Dk=["disabled"],Lk=["disabled"],jk=Ut({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},models:{},selectedModel:{},selectedReasoningEffort:{},skills:{},isTurnInProgress:{type:Boolean},isInterruptingTurn:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{}},emits:["submit","interrupt","update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,r=t,s=D(""),o=D([]),i=D([]),a=D([]),l=D([]),{state:c,isSupported:u,startRecording:f,stopRecording:m}=bb({onTranscript:G=>{s.value=s.value?`${s.value}
|
|
43
|
+
${G}`:G}}),_=D(null),$=D(null),A=D(null),L=D(null),X=D(null),O=D(!1),z=D(!1),V=D(null),fe=D(""),ie=D([]),ye=D(!1),Te=D(0);let re=0,ee=null;const we=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"}],je=he(()=>n.models.map(G=>({value:G,label:G}))),Fe=he(()=>n.skills??[]),et=he(()=>i.value.map(G=>G.path)),De=he(()=>(n.skills??[]).map(G=>({value:G.path,label:G.name,description:G.description}))),Ee=he(()=>n.disabled||!n.activeThreadId?!1:s.value.trim().length>0||o.value.length>0||a.value.length>0),Oe=he(()=>{const G=new Set;for(const J of l.value)for(const N of J.filePaths)G.add(N);return a.value.filter(J=>!G.has(J.fsPath))}),tt=he(()=>n.disabled||!n.activeThreadId),Qe=he(()=>n.inProgressSubmitMode==="steer"?"steer":"queue"),Ze=he(()=>n.activeThreadId?"Type a message... (@ for files, / for skills)":"Select a thread to send a message");function Xe(G="steer"){var N;const J=s.value.trim();if(Ee.value){if(r("submit",{text:J,imageUrls:o.value.map(le=>le.url),fileAttachments:[...a.value],skills:i.value.map(le=>({name:le.name,path:le.path})),mode:G}),s.value="",o.value=[],i.value=[],a.value=[],l.value=[],O.value=!1,z.value=!1,Pe(),we){(N=X.value)==null||N.blur();return}cn(()=>{var le;return(le=X.value)==null?void 0:le.focus()})}}function ht(){r("interrupt")}function Pt(G){r("update:selected-model",G)}function qe(G){r("update:selected-reasoning-effort",G)}function nt(){tt.value||(O.value=!O.value)}function W(){var G;(G=$.value)==null||G.click()}function me(){var G;(G=A.value)==null||G.click()}function ae(){var G;(G=L.value)==null||G.click()}function pe(G){o.value=o.value.filter(J=>J.id!==G)}function Ne(G){i.value=i.value.filter(J=>J.path!==G)}function g(G){a.value=a.value.filter(J=>J.fsPath!==G)}function v(G){const J=l.value.find(le=>le.id===G);if(!J)return;const N=new Set(J.filePaths);a.value=a.value.filter(le=>!N.has(le.fsPath)),l.value=l.value.filter(le=>le.id!==G)}function C(G){return G.total<=0?0:Math.round(G.processed/G.total*100)}function B(G,J){const N=G.replace(/\\/g,"/");if(a.value.some(It=>It.fsPath===N))return;const le=N.split("/").filter(Boolean),Nt=(J==null?void 0:J.trim())||le[le.length-1]||N;a.value=[...a.value,{label:Nt,path:N,fsPath:N}]}function F(G){return G.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(G.name)}function P(G){if(!(!G||G.length===0))for(const J of Array.from(G))if(F(J)){const N=new FileReader;N.onload=()=>{typeof N.result=="string"&&o.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:J.name,url:N.result})},N.readAsDataURL(J)}else Dc(J).then(N=>{N&&B(N)}).catch(()=>{})}async function U(G){if(!G||G.length===0)return;const J=Array.from(G),le=(J[0].webkitRelativePath||J[0].name).split("/").filter(Boolean)[0]||"Folder",Nt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;l.value=[...l.value,{id:Nt,name:le,total:J.length,processed:0,filePaths:[],isUploading:!0}];const It=Vt=>{l.value=l.value.map(xt=>xt.id===Nt?Vt(xt):xt)};for(const Vt of J)try{const xt=await Dc(Vt);if(xt){const Zt=Vt.webkitRelativePath||Vt.name;B(xt,Zt),It(b=>({...b,processed:b.processed+1,filePaths:[...b.filePaths,xt]}));continue}It(Zt=>({...Zt,processed:Zt.processed+1}))}catch{It(xt=>({...xt,processed:xt.processed+1}))}It(Vt=>({...Vt,isUploading:!1}))}function j(G){G&&(G.value="")}function K(G){const J=G.target;P((J==null?void 0:J.files)??null),j(J),O.value=!1}function H(G){const J=G.target;P((J==null?void 0:J.files)??null),j(J),O.value=!1}function _e(G){const J=G.target;U((J==null?void 0:J.files)??null),j(J),O.value=!1}function ue(){const J=s.value.startsWith("/");J!==z.value&&(z.value=J),Ke()}function ve(G){if(ye.value){if(G.key==="Escape"){G.preventDefault(),Pe();return}if(G.key==="ArrowDown"){G.preventDefault(),ie.value.length>0&&(Te.value=(Te.value+1)%ie.value.length);return}if(G.key==="ArrowUp"){if(G.preventDefault(),ie.value.length>0){const N=ie.value.length;Te.value=(Te.value+N-1)%N}return}if(G.key==="Enter"||G.key==="Tab"){G.preventDefault();const N=ie.value[Te.value];N?He(N):Pe();return}}if(n.sendWithEnter!==!1?G.key==="Enter"&&!G.shiftKey:G.key==="Enter"&&(G.metaKey||G.ctrlKey)){G.preventDefault(),Xe(n.isTurnInProgress?Qe.value:"steer");return}if(z.value){if(G.key==="Escape"){G.preventDefault(),Se();return}if(G.key==="ArrowDown"||G.key==="ArrowUp"){G.preventDefault();return}}}function Se(){var G;z.value=!1,(G=X.value)==null||G.focus()}function Pe(){ye.value=!1,V.value=null,fe.value="",ie.value=[],Te.value=0}function Ke(){const G=X.value;if(!G){Pe();return}const J=G.selectionStart??s.value.length,le=s.value.slice(0,J).match(/(^|\s)(@[^\s@]*)$/);if(!le){Pe();return}const Nt=le[2]??"",It=Nt.length,Vt=J-It;V.value=Vt,fe.value=Nt.slice(1),ye.value=!0,xe()}async function xe(){if(!ye.value)return;const G=(n.cwd??"").trim();if(!G){ie.value=[];return}ee&&clearTimeout(ee);const J=++re;ee=setTimeout(async()=>{try{const N=await l_(G,fe.value,20);if(!ye.value||J!==re)return;ie.value=N,Te.value=0}catch{if(!ye.value||J!==re)return;ie.value=[]}},120)}function He(G){const J=X.value,N=V.value;if(N!==null&&J){const le=J.selectionStart??s.value.length;s.value=`${s.value.slice(0,N)}${s.value.slice(le)}`.trimEnd()}B(G.path),Pe(),cn(()=>J==null?void 0:J.focus())}function kt(G){const J=G.lastIndexOf("/");return J<0?G:G.slice(J+1)}function ze(G){const J=G.lastIndexOf("/");return J<=0?"":G.slice(0,J)}function Je(G){const J=kt(G),N=J.lastIndexOf(".");return N<=0?"":J.slice(N+1).toLowerCase()}function Mt(G){const J=Je(G);return J==="ts"?"TS":J==="tsx"?"TSX":J==="js"?"JS":J==="jsx"?"JSX":J==="json"?"{}":""}function Ht(G){const J=Je(G);return J.startsWith("ts")?"ts":J.startsWith("js")?"js":J==="json"?"json":"default"}function vt(G){const J=Je(G);return J==="md"||J==="mdx"}function Tt(G){var J;i.value.some(N=>N.path===G.path)||(i.value=[...i.value,G]),s.value=s.value.startsWith("/")?"":s.value,z.value=!1,(J=X.value)==null||J.focus()}function Ot(G,J){if(J){const N=(n.skills??[]).find(le=>le.path===G);N&&!i.value.some(le=>le.path===G)&&(i.value=[...i.value,N])}else i.value=i.value.filter(N=>N.path!==G)}function Xt(G){if(!O.value)return;const J=_.value;if(!J)return;const N=G.target;!N||J.contains(N)||(O.value=!1)}return lr(()=>{document.addEventListener("click",Xt)}),cr(()=>{document.removeEventListener("click",Xt),ee&&clearTimeout(ee)}),mt(()=>n.activeThreadId,()=>{s.value="",o.value=[],i.value=[],a.value=[],l.value=[],O.value=!1,z.value=!1,Pe()}),mt(()=>n.cwd,()=>{ye.value&&xe()}),(G,J)=>(w(),T("form",{class:"thread-composer",onSubmit:J[7]||(J[7]=rt(N=>Xe("steer"),["prevent"]))},[p("div",{class:gt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[o.value.length>0?(w(),T("div",rk,[(w(!0),T(Le,null,Ct(o.value,N=>(w(),T("div",{key:N.id,class:"thread-composer-attachment"},[p("img",{class:"thread-composer-attachment-image",src:N.url,alt:N.name||"Selected image"},null,8,sk),p("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${N.name||"image"}`,disabled:tt.value,onClick:le=>pe(N.id)}," x ",8,ok)]))),128))])):oe("",!0),l.value.length>0?(w(),T("div",ik,[(w(!0),T(Le,null,Ct(l.value,N=>(w(),T("span",{key:N.id,class:"thread-composer-folder-chip"},[Ae(Ya,{class:"thread-composer-folder-chip-icon"}),p("span",{class:"thread-composer-folder-chip-name",title:N.name},se(N.name),9,ak),p("span",lk,[N.isUploading?(w(),T(Le,{key:0},[Js(se(C(N))+"% uploading ("+se(N.processed)+"/"+se(N.total)+") ",1)],64)):(w(),T(Le,{key:1},[Js(se(N.filePaths.length)+" file"+se(N.filePaths.length===1?"":"s"),1)],64))]),p("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${N.name}`,disabled:tt.value,onClick:le=>v(N.id)},"×",8,ck)]))),128))])):oe("",!0),Oe.value.length>0?(w(),T("div",uk,[(w(!0),T(Le,null,Ct(Oe.value,N=>(w(),T("span",{key:N.fsPath,class:"thread-composer-file-chip"},[Ae(Uo,{class:"thread-composer-file-chip-icon"}),p("span",{class:"thread-composer-file-chip-name",title:N.fsPath},se(N.label),9,dk),p("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${N.label}`,disabled:tt.value,onClick:le=>g(N.fsPath)},"×",8,fk)]))),128))])):oe("",!0),i.value.length>0?(w(),T("div",hk,[(w(!0),T(Le,null,Ct(i.value,N=>(w(),T("span",{key:N.path,class:"thread-composer-skill-chip"},[p("span",pk,se(N.name),1),p("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${N.name}`,onClick:le=>Ne(N.path)},"×",8,mk)]))),128))])):oe("",!0),p("div",gk,[ye.value?(w(),T("div",vk,[ie.value.length>0?(w(!0),T(Le,{key:0},Ct(ie.value,(N,le)=>(w(),T("button",{key:N.path,class:gt(["thread-composer-file-mention-row",{"is-active":le===Te.value}]),type:"button",onMousedown:rt(Nt=>He(N),["prevent"])},[Mt(N.path)?(w(),T("span",{key:0,class:gt(["thread-composer-file-mention-icon-badge",`is-${Ht(N.path)}`])},se(Mt(N.path)),3)):vt(N.path)?(w(),T("span",wk,"↓")):(w(),wt(Uo,{key:2,class:"thread-composer-file-mention-icon-file"})),p("span",bk,[p("span",_k,se(kt(N.path)),1),ze(N.path)?(w(),T("span",kk,se(ze(N.path)),1)):oe("",!0)])],42,yk))),128)):(w(),T("div",Tk,"No matching files"))])):oe("",!0),rr(p("textarea",{ref_key:"inputRef",ref:X,"onUpdate:modelValue":J[0]||(J[0]=N=>s.value=N),class:"thread-composer-input",placeholder:Ze.value,disabled:tt.value,onInput:ue,onKeydown:ve},null,40,Ik),[[sr,s.value]]),Ae(nk,{skills:Fe.value,visible:z.value,"anchor-bottom":44,"anchor-left":0,onSelect:Tt,onClose:Se},null,8,["skills","visible"])]),p("div",Sk,[p("div",{ref_key:"attachMenuRootRef",ref:_,class:"thread-composer-attach"},[p("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:tt.value,onClick:nt}," + ",8,Ek),O.value?(w(),T("div",Ck,[p("button",{class:"thread-composer-attach-item",type:"button",disabled:tt.value,onClick:W}," Add photos & files ",8,Ak),p("button",{class:"thread-composer-attach-item",type:"button",disabled:tt.value,onClick:ae}," Add folder ",8,Rk),p("button",{class:"thread-composer-attach-item",type:"button",disabled:tt.value,onClick:me}," Take photo ",8,Pk)])):oe("",!0)],512),Ae(ma,{class:"thread-composer-control","model-value":e.selectedModel,options:je.value,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":Pt},null,8,["model-value","options","disabled"]),Ae(q_,{class:"thread-composer-control",options:De.value,"selected-values":et.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:Ot},null,8,["options","selected-values","disabled"]),Ae(ma,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:ne,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":qe},null,8,["model-value","disabled"]),p("div",xk,[de(u)&&!e.isTurnInProgress?(w(),T("button",{key:0,class:gt(["thread-composer-mic",{"thread-composer-mic--active":de(c)!=="idle"}]),type:"button","aria-label":de(c)==="recording"?"Stop dictation":"Hold to dictate",title:de(c)==="recording"?"Release to transcribe":"Hold to dictate",disabled:tt.value,onMousedown:J[1]||(J[1]=rt((...N)=>de(f)&&de(f)(...N),["prevent"])),onMouseup:J[2]||(J[2]=(...N)=>de(m)&&de(m)(...N)),onMouseleave:J[3]||(J[3]=N=>de(c)==="recording"&&de(m)()),onTouchstart:J[4]||(J[4]=rt((...N)=>de(f)&&de(f)(...N),["prevent"])),onTouchend:J[5]||(J[5]=(...N)=>de(m)&&de(m)(...N))},[Ae(b_,{class:"thread-composer-mic-icon"})],42,Mk)):oe("",!0),e.isTurnInProgress?(w(),T("button",{key:1,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:ht},[Ae(I_,{class:"thread-composer-stop-icon"})],8,Ok)):oe("",!0),p("button",{class:gt(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Qe.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&Qe.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${Qe.value}`:"Send",disabled:!Ee.value,onClick:J[6]||(J[6]=N=>Xe(e.isTurnInProgress?Qe.value:"steer"))},[Ae(g_,{class:"thread-composer-submit-icon"})],10,Nk)])])],2),p("input",{ref_key:"photoLibraryInputRef",ref:$,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:tt.value,onChange:K},null,40,$k),p("input",{ref_key:"cameraCaptureInputRef",ref:A,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:tt.value,onChange:H},null,40,Dk),p("input",{ref_key:"folderPickerInputRef",ref:L,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:tt.value,onChange:_e},null,40,Lk)],32))}}),Lc=ot(jk,[["__scopeId","data-v-82ab4b65"]]),Fk={key:0,class:"queued-messages"},Bk={class:"queued-messages-inner"},Uk={class:"queued-row-text"},Hk={class:"queued-row-actions"},Vk=["onClick"],Wk=["onClick"],zk=Ut({__name:"QueuedMessages",props:{messages:{}},emits:["steer","delete"],setup(e){return(t,n)=>e.messages.length>0?(w(),T("div",Fk,[p("div",Bk,[(w(!0),T(Le,null,Ct(e.messages,r=>(w(),T("div",{key:r.id,class:"queued-row"},[n[1]||(n[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",Uk,se(r.text),1),p("div",Hk,[p("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:s=>t.$emit("steer",r.id)},"Steer",8,Vk),p("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:s=>t.$emit("delete",r.id)},[...n[0]||(n[0]=[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,Wk)])]))),128))])])):oe("",!0)}}),Gk=ot(zk,[["__scopeId","data-v-ea583733"]]),qk={class:"runtime-dropdown-trigger-label"},Kk={key:0,class:"runtime-dropdown-menu-wrap"},Jk={class:"runtime-dropdown-menu"},Yk=["onClick"],Qk={class:"runtime-dropdown-option-label"},Xk={key:0,class:"runtime-dropdown-option-check"},Zk=Ut({__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:Ya},{value:"worktree",label:"New worktree",icon:Ao}],a=he(()=>i.find(u=>u.value===n.modelValue)??i[0]);function l(u){r("update:modelValue",u),o.value=!1}function c(u){if(!o.value)return;const f=s.value;if(!f)return;const m=u.target;m instanceof Node&&(f.contains(m)||(o.value=!1))}return lr(()=>{window.addEventListener("pointerdown",c)}),cr(()=>{window.removeEventListener("pointerdown",c)}),(u,f)=>(w(),T("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(),wt(ra(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),p("span",qk,se(a.value.label),1),Ae(ui,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(w(),T("div",Kk,[p("div",Jk,[f[1]||(f[1]=p("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(w(),T(Le,null,Ct(i,m=>p("button",{key:m.value,class:gt(["runtime-dropdown-option",{"is-selected":e.modelValue===m.value}]),type:"button",onClick:_=>l(m.value)},[(w(),wt(ra(m.icon),{class:"runtime-dropdown-option-icon"})),p("span",Qk,se(m.label),1),e.modelValue===m.value?(w(),T("span",Xk,"✓")):oe("",!0)],10,Yk)),64))])])):oe("",!0)],512))}}),e0=ot(Zk,[["__scopeId","data-v-9c9b71e5"]]),t0={},n0={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function r0(e,t){return w(),T("svg",n0,[...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 ga=ot(t0,[["render",r0]]),s0={class:"skill-card-top"},o0=["src","alt"],i0={key:1,class:"skill-card-avatar-fallback"},a0={class:"skill-card-info"},l0={class:"skill-card-header"},c0={class:"skill-card-name"},u0={key:0,class:"skill-card-badge-disabled"},d0={key:1,class:"skill-card-badge"},f0={class:"skill-card-owner"},h0={key:0,class:"skill-card-desc"},p0={key:1,class:"skill-card-date"},m0=Ut({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=he(()=>{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(),T("button",{class:gt(["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",s0,[e.skill.avatarUrl?(w(),T("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,o0)):(w(),T("div",i0,se(e.skill.owner.charAt(0)),1)),p("div",a0,[p("div",l0,[p("span",c0,se(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(w(),T("span",u0,"Disabled")):e.skill.installed?(w(),T("span",d0,"Installed")):oe("",!0)]),p("span",f0,se(e.skill.owner),1)])]),e.skill.description?(w(),T("p",h0,se(e.skill.description),1)):oe("",!0),n.value?(w(),T("span",p0,se(n.value),1)):oe("",!0)],2))}}),jc=ot(m0,[["__scopeId","data-v-2a1e8196"]]),g0={class:"sdm-panel"},v0={class:"sdm-header"},y0={class:"sdm-title-area"},w0=["src","alt"],b0={class:"sdm-title-col"},_0={class:"sdm-title-row"},k0={class:"sdm-title"},T0={key:0,class:"sdm-badge-disabled"},I0={class:"sdm-owner"},S0={class:"sdm-body"},E0={key:0,class:"sdm-desc"},C0={key:1,class:"sdm-readme-loading"},A0=["innerHTML"],R0=["href"],P0={class:"sdm-footer"},x0={class:"sdm-footer-actions"},M0=["disabled"],O0=["disabled"],N0=["disabled"],$0=Ut({__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=he(()=>s.value??n.skill.enabled??!0),l=he(()=>n.isInstalling===!0||n.isUninstalling===!0),c=he(()=>{const A=o.value;if(!A)return"";const L=A.replace(/^---[\s\S]*?---\s*/,"");return u(L)});function u(A){return A.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 A=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),L=await fetch(`/codex-api/skills-hub/readme?${A}`);if(!L.ok)return;const X=await L.json();o.value=X.content??""}catch{}finally{i.value=!1}}}mt(()=>n.visible,A=>{A&&(s.value=null,o.value="",f())});function m(){r("install",n.skill)}function _(){r("uninstall",n.skill)}function $(){const A=!a.value;s.value=A,r("toggle-enabled",n.skill,A)}return(A,L)=>(w(),wt(Do,{to:"body"},[e.visible?(w(),T("div",{key:0,class:"sdm-overlay",onClick:L[1]||(L[1]=rt(X=>A.$emit("close"),["self"]))},[p("div",g0,[p("div",v0,[p("div",y0,[e.skill.avatarUrl?(w(),T("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,w0)):oe("",!0),p("div",b0,[p("div",_0,[p("h3",k0,se(e.skill.displayName||e.skill.name),1),e.skill.installed&&!a.value?(w(),T("span",T0,"Disabled")):oe("",!0)]),p("span",I0,se(e.skill.owner),1)])]),p("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:L[0]||(L[0]=X=>A.$emit("close"))},[Ae(Qa,{class:"sdm-close-icon"})])]),p("div",S0,[e.skill.description?(w(),T("p",E0,se(e.skill.description),1)):oe("",!0),i.value?(w(),T("div",C0,"Loading skill contents...")):o.value?(w(),T("div",{key:2,class:"sdm-readme",innerHTML:c.value},null,8,A0)):oe("",!0),p("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,R0)]),p("div",P0,[p("div",x0,[e.skill.installed?(w(),T("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:l.value,onClick:_},se(n.isUninstalling?"Uninstalling...":"Uninstall"),9,M0)):(w(),T("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:l.value,onClick:m},se(n.isInstalling?"Installing...":"Install"),9,O0)),e.skill.installed?(w(),T("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:l.value,onClick:$},se(a.value?"Disable":"Enable"),9,N0)):oe("",!0)])])])])):oe("",!0)]))}}),D0=ot($0,[["__scopeId","data-v-19a385ca"]]),L0=()=>{};var Fc={};/**
|
|
44
|
+
* @license
|
|
45
|
+
* Copyright 2017 Google LLC
|
|
46
|
+
*
|
|
47
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
48
|
+
* you may not use this file except in compliance with the License.
|
|
49
|
+
* You may obtain a copy of the License at
|
|
50
|
+
*
|
|
51
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
52
|
+
*
|
|
53
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
54
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
55
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
56
|
+
* See the License for the specific language governing permissions and
|
|
57
|
+
* limitations under the License.
|
|
58
|
+
*/const ef=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},j0=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("")},tf={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,c=l?e[s+2]:0,u=o>>2,f=(o&3)<<4|a>>4;let m=(a&15)<<2|c>>6,_=c&63;l||(_=64,i||(m=64)),r.push(n[u],n[f],n[m],n[_])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(ef(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):j0(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 c=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||c==null||f==null)throw new F0;const m=o<<2|a>>4;if(r.push(m),c!==64){const _=a<<4&240|c>>2;if(r.push(_),f!==64){const $=c<<6&192|f;r.push($)}}}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 F0 extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const B0=function(e){const t=ef(e);return tf.encodeByteArray(t,!0)},nf=function(e){return B0(e).replace(/\./g,"")},rf=function(e){try{return tf.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
|
|
59
|
+
* @license
|
|
60
|
+
* Copyright 2022 Google LLC
|
|
61
|
+
*
|
|
62
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
63
|
+
* you may not use this file except in compliance with the License.
|
|
64
|
+
* You may obtain a copy of the License at
|
|
65
|
+
*
|
|
66
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
67
|
+
*
|
|
68
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
69
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
70
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
71
|
+
* See the License for the specific language governing permissions and
|
|
72
|
+
* limitations under the License.
|
|
73
|
+
*/function U0(){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.")}/**
|
|
74
|
+
* @license
|
|
75
|
+
* Copyright 2022 Google LLC
|
|
76
|
+
*
|
|
77
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
78
|
+
* you may not use this file except in compliance with the License.
|
|
79
|
+
* You may obtain a copy of the License at
|
|
80
|
+
*
|
|
81
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
82
|
+
*
|
|
83
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
84
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
85
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
86
|
+
* See the License for the specific language governing permissions and
|
|
87
|
+
* limitations under the License.
|
|
88
|
+
*/const H0=()=>U0().__FIREBASE_DEFAULTS__,V0=()=>{if(typeof process>"u"||typeof Fc>"u")return;const e=Fc.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},W0=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&rf(e[1]);return t&&JSON.parse(t)},el=()=>{try{return L0()||H0()||V0()||W0()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},z0=e=>{var t,n;return(n=(t=el())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},sf=()=>{var e;return(e=el())==null?void 0:e.config},of=e=>{var t;return(t=el())==null?void 0:t[`_${e}`]};/**
|
|
89
|
+
* @license
|
|
90
|
+
* Copyright 2017 Google LLC
|
|
91
|
+
*
|
|
92
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
93
|
+
* you may not use this file except in compliance with the License.
|
|
94
|
+
* You may obtain a copy of the License at
|
|
95
|
+
*
|
|
96
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
97
|
+
*
|
|
98
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
99
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
100
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
101
|
+
* See the License for the specific language governing permissions and
|
|
102
|
+
* limitations under the License.
|
|
103
|
+
*/class G0{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))}}}/**
|
|
104
|
+
* @license
|
|
105
|
+
* Copyright 2017 Google LLC
|
|
106
|
+
*
|
|
107
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
108
|
+
* you may not use this file except in compliance with the License.
|
|
109
|
+
* You may obtain a copy of the License at
|
|
110
|
+
*
|
|
111
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
112
|
+
*
|
|
113
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
114
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
115
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
116
|
+
* See the License for the specific language governing permissions and
|
|
117
|
+
* limitations under the License.
|
|
118
|
+
*/function on(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function q0(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(on())}function K0(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function J0(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function Y0(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Q0(){const e=on();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function X0(){try{return typeof indexedDB=="object"}catch{return!1}}function Z0(){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)}})}/**
|
|
119
|
+
* @license
|
|
120
|
+
* Copyright 2017 Google LLC
|
|
121
|
+
*
|
|
122
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
123
|
+
* you may not use this file except in compliance with the License.
|
|
124
|
+
* You may obtain a copy of the License at
|
|
125
|
+
*
|
|
126
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
127
|
+
*
|
|
128
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
129
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
130
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
131
|
+
* See the License for the specific language governing permissions and
|
|
132
|
+
* limitations under the License.
|
|
133
|
+
*/const eT="FirebaseError";class Er extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=eT,Object.setPrototypeOf(this,Er.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,io.prototype.create)}}class io{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?tT(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new Er(s,a,r)}}function tT(e,t){return e.replace(nT,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const nT=/\{\$([^}]+)}/g;function rT(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function gs(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(Bc(o)&&Bc(i)){if(!gs(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function Bc(e){return e!==null&&typeof e=="object"}/**
|
|
134
|
+
* @license
|
|
135
|
+
* Copyright 2017 Google LLC
|
|
136
|
+
*
|
|
137
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
138
|
+
* you may not use this file except in compliance with the License.
|
|
139
|
+
* You may obtain a copy of the License at
|
|
140
|
+
*
|
|
141
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
142
|
+
*
|
|
143
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
144
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
145
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
146
|
+
* See the License for the specific language governing permissions and
|
|
147
|
+
* limitations under the License.
|
|
148
|
+
*/function ao(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 sT(e,t){const n=new oT(e,t);return n.subscribe.bind(n)}class oT{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.");iT(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=Li),s.error===void 0&&(s.error=Li),s.complete===void 0&&(s.complete=Li);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 iT(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 Li(){}/**
|
|
149
|
+
* @license
|
|
150
|
+
* Copyright 2021 Google LLC
|
|
151
|
+
*
|
|
152
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
153
|
+
* you may not use this file except in compliance with the License.
|
|
154
|
+
* You may obtain a copy of the License at
|
|
155
|
+
*
|
|
156
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
157
|
+
*
|
|
158
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
159
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
160
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
161
|
+
* See the License for the specific language governing permissions and
|
|
162
|
+
* limitations under the License.
|
|
163
|
+
*/function bs(e){return e&&e._delegate?e._delegate:e}/**
|
|
164
|
+
* @license
|
|
165
|
+
* Copyright 2025 Google LLC
|
|
166
|
+
*
|
|
167
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
168
|
+
* you may not use this file except in compliance with the License.
|
|
169
|
+
* You may obtain a copy of the License at
|
|
170
|
+
*
|
|
171
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
172
|
+
*
|
|
173
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
174
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
175
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
176
|
+
* See the License for the specific language governing permissions and
|
|
177
|
+
* limitations under the License.
|
|
178
|
+
*/function tl(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function aT(e){return(await fetch(e,{credentials:"include"})).ok}class vs{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}}/**
|
|
179
|
+
* @license
|
|
180
|
+
* Copyright 2019 Google LLC
|
|
181
|
+
*
|
|
182
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
183
|
+
* you may not use this file except in compliance with the License.
|
|
184
|
+
* You may obtain a copy of the License at
|
|
185
|
+
*
|
|
186
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
187
|
+
*
|
|
188
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
189
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
190
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
191
|
+
* See the License for the specific language governing permissions and
|
|
192
|
+
* limitations under the License.
|
|
193
|
+
*/const Lr="[DEFAULT]";/**
|
|
194
|
+
* @license
|
|
195
|
+
* Copyright 2019 Google LLC
|
|
196
|
+
*
|
|
197
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
198
|
+
* you may not use this file except in compliance with the License.
|
|
199
|
+
* You may obtain a copy of the License at
|
|
200
|
+
*
|
|
201
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
202
|
+
*
|
|
203
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
204
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
205
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
206
|
+
* See the License for the specific language governing permissions and
|
|
207
|
+
* limitations under the License.
|
|
208
|
+
*/class lT{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 G0;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(uT(t))try{this.getOrInitializeService({instanceIdentifier:Lr})}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=Lr){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=Lr){return this.instances.has(t)}getOptions(t=Lr){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:cT(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=Lr){return this.component?this.component.multipleInstances?t:Lr:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function cT(e){return e===Lr?void 0:e}function uT(e){return e.instantiationMode==="EAGER"}/**
|
|
209
|
+
* @license
|
|
210
|
+
* Copyright 2019 Google LLC
|
|
211
|
+
*
|
|
212
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
213
|
+
* you may not use this file except in compliance with the License.
|
|
214
|
+
* You may obtain a copy of the License at
|
|
215
|
+
*
|
|
216
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
217
|
+
*
|
|
218
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
219
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
220
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
221
|
+
* See the License for the specific language governing permissions and
|
|
222
|
+
* limitations under the License.
|
|
223
|
+
*/class dT{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 lT(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
|
|
224
|
+
* @license
|
|
225
|
+
* Copyright 2017 Google LLC
|
|
226
|
+
*
|
|
227
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
228
|
+
* you may not use this file except in compliance with the License.
|
|
229
|
+
* You may obtain a copy of the License at
|
|
230
|
+
*
|
|
231
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
232
|
+
*
|
|
233
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
234
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
235
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
236
|
+
* See the License for the specific language governing permissions and
|
|
237
|
+
* limitations under the License.
|
|
238
|
+
*/var bt;(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"})(bt||(bt={}));const fT={debug:bt.DEBUG,verbose:bt.VERBOSE,info:bt.INFO,warn:bt.WARN,error:bt.ERROR,silent:bt.SILENT},hT=bt.INFO,pT={[bt.DEBUG]:"log",[bt.VERBOSE]:"log",[bt.INFO]:"info",[bt.WARN]:"warn",[bt.ERROR]:"error"},mT=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=pT[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 af{constructor(t){this.name=t,this._logLevel=hT,this._logHandler=mT,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in bt))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?fT[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,bt.DEBUG,...t),this._logHandler(this,bt.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,bt.VERBOSE,...t),this._logHandler(this,bt.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,bt.INFO,...t),this._logHandler(this,bt.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,bt.WARN,...t),this._logHandler(this,bt.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,bt.ERROR,...t),this._logHandler(this,bt.ERROR,...t)}}const gT=(e,t)=>t.some(n=>e instanceof n);let Uc,Hc;function vT(){return Uc||(Uc=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function yT(){return Hc||(Hc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const lf=new WeakMap,va=new WeakMap,cf=new WeakMap,ji=new WeakMap,nl=new WeakMap;function wT(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(kr(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&lf.set(n,e)}).catch(()=>{}),nl.set(t,e),t}function bT(e){if(va.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)});va.set(e,t)}let ya={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return va.get(e);if(t==="objectStoreNames")return e.objectStoreNames||cf.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return kr(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 _T(e){ya=e(ya)}function kT(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Fi(this),t,...n);return cf.set(r,t.sort?t.sort():[t]),kr(r)}:yT().includes(e)?function(...t){return e.apply(Fi(this),t),kr(lf.get(this))}:function(...t){return kr(e.apply(Fi(this),t))}}function TT(e){return typeof e=="function"?kT(e):(e instanceof IDBTransaction&&bT(e),gT(e,vT())?new Proxy(e,ya):e)}function kr(e){if(e instanceof IDBRequest)return wT(e);if(ji.has(e))return ji.get(e);const t=TT(e);return t!==e&&(ji.set(e,t),nl.set(t,e)),t}const Fi=e=>nl.get(e);function IT(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=kr(i);return r&&i.addEventListener("upgradeneeded",l=>{r(kr(i.result),l.oldVersion,l.newVersion,kr(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",c=>s(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const ST=["get","getKey","getAll","getAllKeys","count"],ET=["put","add","delete","clear"],Bi=new Map;function Vc(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Bi.get(t))return Bi.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=ET.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||ST.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let c=l.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),s&&l.done]))[0]};return Bi.set(t,o),o}_T(e=>({...e,get:(t,n,r)=>Vc(t,n)||e.get(t,n,r),has:(t,n)=>!!Vc(t,n)||e.has(t,n)}));/**
|
|
239
|
+
* @license
|
|
240
|
+
* Copyright 2019 Google LLC
|
|
241
|
+
*
|
|
242
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
243
|
+
* you may not use this file except in compliance with the License.
|
|
244
|
+
* You may obtain a copy of the License at
|
|
245
|
+
*
|
|
246
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
247
|
+
*
|
|
248
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
249
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
250
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
251
|
+
* See the License for the specific language governing permissions and
|
|
252
|
+
* limitations under the License.
|
|
253
|
+
*/class CT{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(AT(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function AT(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const wa="@firebase/app",Wc="0.14.10";/**
|
|
254
|
+
* @license
|
|
255
|
+
* Copyright 2019 Google LLC
|
|
256
|
+
*
|
|
257
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
258
|
+
* you may not use this file except in compliance with the License.
|
|
259
|
+
* You may obtain a copy of the License at
|
|
260
|
+
*
|
|
261
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
262
|
+
*
|
|
263
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
264
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
265
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
266
|
+
* See the License for the specific language governing permissions and
|
|
267
|
+
* limitations under the License.
|
|
268
|
+
*/const or=new af("@firebase/app"),RT="@firebase/app-compat",PT="@firebase/analytics-compat",xT="@firebase/analytics",MT="@firebase/app-check-compat",OT="@firebase/app-check",NT="@firebase/auth",$T="@firebase/auth-compat",DT="@firebase/database",LT="@firebase/data-connect",jT="@firebase/database-compat",FT="@firebase/functions",BT="@firebase/functions-compat",UT="@firebase/installations",HT="@firebase/installations-compat",VT="@firebase/messaging",WT="@firebase/messaging-compat",zT="@firebase/performance",GT="@firebase/performance-compat",qT="@firebase/remote-config",KT="@firebase/remote-config-compat",JT="@firebase/storage",YT="@firebase/storage-compat",QT="@firebase/firestore",XT="@firebase/ai",ZT="@firebase/firestore-compat",eI="firebase",tI="12.11.0";/**
|
|
269
|
+
* @license
|
|
270
|
+
* Copyright 2019 Google LLC
|
|
271
|
+
*
|
|
272
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
273
|
+
* you may not use this file except in compliance with the License.
|
|
274
|
+
* You may obtain a copy of the License at
|
|
275
|
+
*
|
|
276
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
277
|
+
*
|
|
278
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
279
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
280
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
281
|
+
* See the License for the specific language governing permissions and
|
|
282
|
+
* limitations under the License.
|
|
283
|
+
*/const ba="[DEFAULT]",nI={[wa]:"fire-core",[RT]:"fire-core-compat",[xT]:"fire-analytics",[PT]:"fire-analytics-compat",[OT]:"fire-app-check",[MT]:"fire-app-check-compat",[NT]:"fire-auth",[$T]:"fire-auth-compat",[DT]:"fire-rtdb",[LT]:"fire-data-connect",[jT]:"fire-rtdb-compat",[FT]:"fire-fn",[BT]:"fire-fn-compat",[UT]:"fire-iid",[HT]:"fire-iid-compat",[VT]:"fire-fcm",[WT]:"fire-fcm-compat",[zT]:"fire-perf",[GT]:"fire-perf-compat",[qT]:"fire-rc",[KT]:"fire-rc-compat",[JT]:"fire-gcs",[YT]:"fire-gcs-compat",[QT]:"fire-fst",[ZT]:"fire-fst-compat",[XT]:"fire-vertex","fire-js":"fire-js",[eI]:"fire-js-all"};/**
|
|
284
|
+
* @license
|
|
285
|
+
* Copyright 2019 Google LLC
|
|
286
|
+
*
|
|
287
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
288
|
+
* you may not use this file except in compliance with the License.
|
|
289
|
+
* You may obtain a copy of the License at
|
|
290
|
+
*
|
|
291
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
292
|
+
*
|
|
293
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
294
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
295
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
296
|
+
* See the License for the specific language governing permissions and
|
|
297
|
+
* limitations under the License.
|
|
298
|
+
*/const Zs=new Map,rI=new Map,_a=new Map;function zc(e,t){try{e.container.addComponent(t)}catch(n){or.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function eo(e){const t=e.name;if(_a.has(t))return or.debug(`There were multiple attempts to register component ${t}.`),!1;_a.set(t,e);for(const n of Zs.values())zc(n,e);for(const n of rI.values())zc(n,e);return!0}function uf(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function Mn(e){return e==null?!1:e.settings!==void 0}/**
|
|
299
|
+
* @license
|
|
300
|
+
* Copyright 2019 Google LLC
|
|
301
|
+
*
|
|
302
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
303
|
+
* you may not use this file except in compliance with the License.
|
|
304
|
+
* You may obtain a copy of the License at
|
|
305
|
+
*
|
|
306
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
307
|
+
*
|
|
308
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
309
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
310
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
311
|
+
* See the License for the specific language governing permissions and
|
|
312
|
+
* limitations under the License.
|
|
313
|
+
*/const sI={"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."},Tr=new io("app","Firebase",sI);/**
|
|
314
|
+
* @license
|
|
315
|
+
* Copyright 2019 Google LLC
|
|
316
|
+
*
|
|
317
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
318
|
+
* you may not use this file except in compliance with the License.
|
|
319
|
+
* You may obtain a copy of the License at
|
|
320
|
+
*
|
|
321
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
322
|
+
*
|
|
323
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
324
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
325
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
326
|
+
* See the License for the specific language governing permissions and
|
|
327
|
+
* limitations under the License.
|
|
328
|
+
*/class oI{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 vs("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 Tr.create("app-deleted",{appName:this._name})}}/**
|
|
329
|
+
* @license
|
|
330
|
+
* Copyright 2019 Google LLC
|
|
331
|
+
*
|
|
332
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
333
|
+
* you may not use this file except in compliance with the License.
|
|
334
|
+
* You may obtain a copy of the License at
|
|
335
|
+
*
|
|
336
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
337
|
+
*
|
|
338
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
339
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
340
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
341
|
+
* See the License for the specific language governing permissions and
|
|
342
|
+
* limitations under the License.
|
|
343
|
+
*/const lo=tI;function df(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:ba,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw Tr.create("bad-app-name",{appName:String(s)});if(n||(n=sf()),!n)throw Tr.create("no-options");const o=Zs.get(s);if(o){if(gs(n,o.options)&&gs(r,o.config))return o;throw Tr.create("duplicate-app",{appName:s})}const i=new dT(s);for(const l of _a.values())i.addComponent(l);const a=new oI(n,r,i);return Zs.set(s,a),a}function ff(e=ba){const t=Zs.get(e);if(!t&&e===ba&&sf())return df();if(!t)throw Tr.create("no-app",{appName:e});return t}function iI(){return Array.from(Zs.values())}function cs(e,t,n){let r=nI[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 "/")`),or.warn(i.join(" "));return}eo(new vs(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
|
|
344
|
+
* @license
|
|
345
|
+
* Copyright 2021 Google LLC
|
|
346
|
+
*
|
|
347
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
348
|
+
* you may not use this file except in compliance with the License.
|
|
349
|
+
* You may obtain a copy of the License at
|
|
350
|
+
*
|
|
351
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
352
|
+
*
|
|
353
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
354
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
355
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
356
|
+
* See the License for the specific language governing permissions and
|
|
357
|
+
* limitations under the License.
|
|
358
|
+
*/const aI="firebase-heartbeat-database",lI=1,to="firebase-heartbeat-store";let Ui=null;function hf(){return Ui||(Ui=IT(aI,lI,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(to)}catch(n){console.warn(n)}}}}).catch(e=>{throw Tr.create("idb-open",{originalErrorMessage:e.message})})),Ui}async function cI(e){try{const n=(await hf()).transaction(to),r=await n.objectStore(to).get(pf(e));return await n.done,r}catch(t){if(t instanceof Er)or.warn(t.message);else{const n=Tr.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});or.warn(n.message)}}}async function Gc(e,t){try{const r=(await hf()).transaction(to,"readwrite");await r.objectStore(to).put(t,pf(e)),await r.done}catch(n){if(n instanceof Er)or.warn(n.message);else{const r=Tr.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});or.warn(r.message)}}}function pf(e){return`${e.name}!${e.options.appId}`}/**
|
|
359
|
+
* @license
|
|
360
|
+
* Copyright 2021 Google LLC
|
|
361
|
+
*
|
|
362
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
363
|
+
* you may not use this file except in compliance with the License.
|
|
364
|
+
* You may obtain a copy of the License at
|
|
365
|
+
*
|
|
366
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
367
|
+
*
|
|
368
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
369
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
370
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
371
|
+
* See the License for the specific language governing permissions and
|
|
372
|
+
* limitations under the License.
|
|
373
|
+
*/const uI=1024,dI=30;class fI{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new pI(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=qc();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>dI){const i=mI(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){or.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=qc(),{heartbeatsToSend:r,unsentEntries:s}=hI(this._heartbeatsCache.heartbeats),o=nf(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 or.warn(n),""}}}function qc(){return new Date().toISOString().substring(0,10)}function hI(e,t=uI){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),Kc(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Kc(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class pI{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return X0()?Z0().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await cI(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 Gc(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 Gc(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function Kc(e){return nf(JSON.stringify({version:2,heartbeats:e})).length}function mI(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}/**
|
|
374
|
+
* @license
|
|
375
|
+
* Copyright 2019 Google LLC
|
|
376
|
+
*
|
|
377
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
378
|
+
* you may not use this file except in compliance with the License.
|
|
379
|
+
* You may obtain a copy of the License at
|
|
380
|
+
*
|
|
381
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
382
|
+
*
|
|
383
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
384
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
385
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
386
|
+
* See the License for the specific language governing permissions and
|
|
387
|
+
* limitations under the License.
|
|
388
|
+
*/function gI(e){eo(new vs("platform-logger",t=>new CT(t),"PRIVATE")),eo(new vs("heartbeat",t=>new fI(t),"PRIVATE")),cs(wa,Wc,e),cs(wa,Wc,"esm2020"),cs("fire-js","")}gI("");var vI="firebase",yI="12.11.0";/**
|
|
389
|
+
* @license
|
|
390
|
+
* Copyright 2020 Google LLC
|
|
391
|
+
*
|
|
392
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
393
|
+
* you may not use this file except in compliance with the License.
|
|
394
|
+
* You may obtain a copy of the License at
|
|
395
|
+
*
|
|
396
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
397
|
+
*
|
|
398
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
399
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
400
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
401
|
+
* See the License for the specific language governing permissions and
|
|
402
|
+
* limitations under the License.
|
|
403
|
+
*/cs(vI,yI,"app");function mf(){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 wI=mf,gf=new io("auth","Firebase",mf());/**
|
|
404
|
+
* @license
|
|
405
|
+
* Copyright 2020 Google LLC
|
|
406
|
+
*
|
|
407
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
408
|
+
* you may not use this file except in compliance with the License.
|
|
409
|
+
* You may obtain a copy of the License at
|
|
410
|
+
*
|
|
411
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
412
|
+
*
|
|
413
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
414
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
415
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
416
|
+
* See the License for the specific language governing permissions and
|
|
417
|
+
* limitations under the License.
|
|
418
|
+
*/const Ho=new af("@firebase/auth");function bI(e,...t){Ho.logLevel<=bt.WARN&&Ho.warn(`Auth (${lo}): ${e}`,...t)}function Ro(e,...t){Ho.logLevel<=bt.ERROR&&Ho.error(`Auth (${lo}): ${e}`,...t)}/**
|
|
419
|
+
* @license
|
|
420
|
+
* Copyright 2020 Google LLC
|
|
421
|
+
*
|
|
422
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
423
|
+
* you may not use this file except in compliance with the License.
|
|
424
|
+
* You may obtain a copy of the License at
|
|
425
|
+
*
|
|
426
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
427
|
+
*
|
|
428
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
429
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
430
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
431
|
+
* See the License for the specific language governing permissions and
|
|
432
|
+
* limitations under the License.
|
|
433
|
+
*/function Ln(e,...t){throw sl(e,...t)}function bn(e,...t){return sl(e,...t)}function rl(e,t,n){const r={...wI(),[t]:n};return new io("auth","Firebase",r).create(t,{appName:e.name})}function Wr(e){return rl(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function _I(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&Ln(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 sl(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 gf.create(e,...t)}function Ue(e,t,...n){if(!e)throw sl(t,...n)}function Qn(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Ro(t),new Error(t)}function ir(e,t){e||Qn(t)}/**
|
|
434
|
+
* @license
|
|
435
|
+
* Copyright 2020 Google LLC
|
|
436
|
+
*
|
|
437
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
438
|
+
* you may not use this file except in compliance with the License.
|
|
439
|
+
* You may obtain a copy of the License at
|
|
440
|
+
*
|
|
441
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
442
|
+
*
|
|
443
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
444
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
445
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
446
|
+
* See the License for the specific language governing permissions and
|
|
447
|
+
* limitations under the License.
|
|
448
|
+
*/function ka(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function kI(){return Jc()==="http:"||Jc()==="https:"}function Jc(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
|
|
449
|
+
* @license
|
|
450
|
+
* Copyright 2020 Google LLC
|
|
451
|
+
*
|
|
452
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
453
|
+
* you may not use this file except in compliance with the License.
|
|
454
|
+
* You may obtain a copy of the License at
|
|
455
|
+
*
|
|
456
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
457
|
+
*
|
|
458
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
459
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
460
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
461
|
+
* See the License for the specific language governing permissions and
|
|
462
|
+
* limitations under the License.
|
|
463
|
+
*/function TI(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(kI()||J0()||"connection"in navigator)?navigator.onLine:!0}function II(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
|
|
464
|
+
* @license
|
|
465
|
+
* Copyright 2020 Google LLC
|
|
466
|
+
*
|
|
467
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
468
|
+
* you may not use this file except in compliance with the License.
|
|
469
|
+
* You may obtain a copy of the License at
|
|
470
|
+
*
|
|
471
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
472
|
+
*
|
|
473
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
474
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
475
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
476
|
+
* See the License for the specific language governing permissions and
|
|
477
|
+
* limitations under the License.
|
|
478
|
+
*/class co{constructor(t,n){this.shortDelay=t,this.longDelay=n,ir(n>t,"Short delay should be less than long delay!"),this.isMobile=q0()||Y0()}get(){return TI()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
479
|
+
* @license
|
|
480
|
+
* Copyright 2020 Google LLC
|
|
481
|
+
*
|
|
482
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
483
|
+
* you may not use this file except in compliance with the License.
|
|
484
|
+
* You may obtain a copy of the License at
|
|
485
|
+
*
|
|
486
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
487
|
+
*
|
|
488
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
489
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
490
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
491
|
+
* See the License for the specific language governing permissions and
|
|
492
|
+
* limitations under the License.
|
|
493
|
+
*/function ol(e,t){ir(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
|
|
494
|
+
* @license
|
|
495
|
+
* Copyright 2020 Google LLC
|
|
496
|
+
*
|
|
497
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
498
|
+
* you may not use this file except in compliance with the License.
|
|
499
|
+
* You may obtain a copy of the License at
|
|
500
|
+
*
|
|
501
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
502
|
+
*
|
|
503
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
504
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
505
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
506
|
+
* See the License for the specific language governing permissions and
|
|
507
|
+
* limitations under the License.
|
|
508
|
+
*/class vf{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;Qn("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;Qn("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;Qn("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
509
|
+
* @license
|
|
510
|
+
* Copyright 2020 Google LLC
|
|
511
|
+
*
|
|
512
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
513
|
+
* you may not use this file except in compliance with the License.
|
|
514
|
+
* You may obtain a copy of the License at
|
|
515
|
+
*
|
|
516
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
517
|
+
*
|
|
518
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
519
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
520
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
521
|
+
* See the License for the specific language governing permissions and
|
|
522
|
+
* limitations under the License.
|
|
523
|
+
*/const SI={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"};/**
|
|
524
|
+
* @license
|
|
525
|
+
* Copyright 2020 Google LLC
|
|
526
|
+
*
|
|
527
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
528
|
+
* you may not use this file except in compliance with the License.
|
|
529
|
+
* You may obtain a copy of the License at
|
|
530
|
+
*
|
|
531
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
532
|
+
*
|
|
533
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
534
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
535
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
536
|
+
* See the License for the specific language governing permissions and
|
|
537
|
+
* limitations under the License.
|
|
538
|
+
*/const EI=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],CI=new co(3e4,6e4);function il(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function _s(e,t,n,r,s={}){return yf(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=ao({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 c={method:t,headers:l,...o};return K0()||(c.referrerPolicy="no-referrer"),e.emulatorConfig&&tl(e.emulatorConfig.host)&&(c.credentials="include"),vf.fetch()(await wf(e,e.config.apiHost,n,a),c)})}async function yf(e,t,n){e._canInitEmulator=!1;const r={...SI,...t};try{const s=new RI(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw yo(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,c]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw yo(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw yo(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw yo(e,"user-disabled",i);const u=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw rl(e,u,c);Ln(e,u)}}catch(s){if(s instanceof Er)throw s;Ln(e,"network-request-failed",{message:String(s)})}}async function AI(e,t,n,r,s={}){const o=await _s(e,t,n,r,s);return"mfaPendingCredential"in o&&Ln(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function wf(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?ol(e.config,s):`${e.config.apiScheme}://${s}`;return EI.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class RI{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(bn(this.auth,"network-request-failed")),CI.get())})}}function yo(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=bn(e,t,r);return s.customData._tokenResponse=n,s}/**
|
|
539
|
+
* @license
|
|
540
|
+
* Copyright 2020 Google LLC
|
|
541
|
+
*
|
|
542
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
543
|
+
* you may not use this file except in compliance with the License.
|
|
544
|
+
* You may obtain a copy of the License at
|
|
545
|
+
*
|
|
546
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
547
|
+
*
|
|
548
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
549
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
550
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
551
|
+
* See the License for the specific language governing permissions and
|
|
552
|
+
* limitations under the License.
|
|
553
|
+
*/async function PI(e,t){return _s(e,"POST","/v1/accounts:delete",t)}async function Vo(e,t){return _s(e,"POST","/v1/accounts:lookup",t)}/**
|
|
554
|
+
* @license
|
|
555
|
+
* Copyright 2020 Google LLC
|
|
556
|
+
*
|
|
557
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
558
|
+
* you may not use this file except in compliance with the License.
|
|
559
|
+
* You may obtain a copy of the License at
|
|
560
|
+
*
|
|
561
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
562
|
+
*
|
|
563
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
564
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
565
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
566
|
+
* See the License for the specific language governing permissions and
|
|
567
|
+
* limitations under the License.
|
|
568
|
+
*/function Hs(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function xI(e,t=!1){const n=bs(e),r=await n.getIdToken(t),s=al(r);Ue(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:Hs(Hi(s.auth_time)),issuedAtTime:Hs(Hi(s.iat)),expirationTime:Hs(Hi(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function Hi(e){return Number(e)*1e3}function al(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return Ro("JWT malformed, contained fewer than 3 sections"),null;try{const s=rf(n);return s?JSON.parse(s):(Ro("Failed to decode base64 JWT payload"),null)}catch(s){return Ro("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Yc(e){const t=al(e);return Ue(t,"internal-error"),Ue(typeof t.exp<"u","internal-error"),Ue(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
|
|
569
|
+
* @license
|
|
570
|
+
* Copyright 2020 Google LLC
|
|
571
|
+
*
|
|
572
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
573
|
+
* you may not use this file except in compliance with the License.
|
|
574
|
+
* You may obtain a copy of the License at
|
|
575
|
+
*
|
|
576
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
577
|
+
*
|
|
578
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
579
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
580
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
581
|
+
* See the License for the specific language governing permissions and
|
|
582
|
+
* limitations under the License.
|
|
583
|
+
*/async function no(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof Er&&MI(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function MI({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
|
|
584
|
+
* @license
|
|
585
|
+
* Copyright 2020 Google LLC
|
|
586
|
+
*
|
|
587
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
588
|
+
* you may not use this file except in compliance with the License.
|
|
589
|
+
* You may obtain a copy of the License at
|
|
590
|
+
*
|
|
591
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
592
|
+
*
|
|
593
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
594
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
595
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
596
|
+
* See the License for the specific language governing permissions and
|
|
597
|
+
* limitations under the License.
|
|
598
|
+
*/class OI{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()}}/**
|
|
599
|
+
* @license
|
|
600
|
+
* Copyright 2020 Google LLC
|
|
601
|
+
*
|
|
602
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
603
|
+
* you may not use this file except in compliance with the License.
|
|
604
|
+
* You may obtain a copy of the License at
|
|
605
|
+
*
|
|
606
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
607
|
+
*
|
|
608
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
609
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
610
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
611
|
+
* See the License for the specific language governing permissions and
|
|
612
|
+
* limitations under the License.
|
|
613
|
+
*/class Ta{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Hs(this.lastLoginAt),this.creationTime=Hs(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
614
|
+
* @license
|
|
615
|
+
* Copyright 2019 Google LLC
|
|
616
|
+
*
|
|
617
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
618
|
+
* you may not use this file except in compliance with the License.
|
|
619
|
+
* You may obtain a copy of the License at
|
|
620
|
+
*
|
|
621
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
622
|
+
*
|
|
623
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
624
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
625
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
626
|
+
* See the License for the specific language governing permissions and
|
|
627
|
+
* limitations under the License.
|
|
628
|
+
*/async function Wo(e){var f;const t=e.auth,n=await e.getIdToken(),r=await no(e,Vo(t,{idToken:n}));Ue(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?bf(s.providerUserInfo):[],i=$I(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),c=a?l:!1,u={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new Ta(s.createdAt,s.lastLoginAt),isAnonymous:c};Object.assign(e,u)}async function NI(e){const t=bs(e);await Wo(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function $I(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function bf(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}))}/**
|
|
629
|
+
* @license
|
|
630
|
+
* Copyright 2020 Google LLC
|
|
631
|
+
*
|
|
632
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
633
|
+
* you may not use this file except in compliance with the License.
|
|
634
|
+
* You may obtain a copy of the License at
|
|
635
|
+
*
|
|
636
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
637
|
+
*
|
|
638
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
639
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
640
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
641
|
+
* See the License for the specific language governing permissions and
|
|
642
|
+
* limitations under the License.
|
|
643
|
+
*/async function DI(e,t){const n=await yf(e,{},async()=>{const r=ao({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await wf(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&&tl(e.emulatorConfig.host)&&(l.credentials="include"),vf.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function LI(e,t){return _s(e,"POST","/v2/accounts:revokeToken",il(e,t))}/**
|
|
644
|
+
* @license
|
|
645
|
+
* Copyright 2020 Google LLC
|
|
646
|
+
*
|
|
647
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
648
|
+
* you may not use this file except in compliance with the License.
|
|
649
|
+
* You may obtain a copy of the License at
|
|
650
|
+
*
|
|
651
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
652
|
+
*
|
|
653
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
654
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
655
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
656
|
+
* See the License for the specific language governing permissions and
|
|
657
|
+
* limitations under the License.
|
|
658
|
+
*/class us{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Ue(t.idToken,"internal-error"),Ue(typeof t.idToken<"u","internal-error"),Ue(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):Yc(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){Ue(t.length!==0,"internal-error");const n=Yc(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Ue(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 DI(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 us;return r&&(Ue(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(Ue(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(Ue(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 us,this.toJSON())}_performRefresh(){return Qn("not implemented")}}/**
|
|
659
|
+
* @license
|
|
660
|
+
* Copyright 2020 Google LLC
|
|
661
|
+
*
|
|
662
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
663
|
+
* you may not use this file except in compliance with the License.
|
|
664
|
+
* You may obtain a copy of the License at
|
|
665
|
+
*
|
|
666
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
667
|
+
*
|
|
668
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
669
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
670
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
671
|
+
* See the License for the specific language governing permissions and
|
|
672
|
+
* limitations under the License.
|
|
673
|
+
*/function pr(e,t){Ue(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class vn{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new OI(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 Ta(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await no(this,this.stsTokenManager.getToken(this.auth,t));return Ue(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return xI(this,t)}reload(){return NI(this)}_assign(t){this!==t&&(Ue(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 vn({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){Ue(!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 Wo(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Mn(this.auth.app))return Promise.reject(Wr(this.auth));const t=await this.getIdToken();return await no(this,PI(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,c=n.createdAt??void 0,u=n.lastLoginAt??void 0,{uid:f,emailVerified:m,isAnonymous:_,providerData:$,stsTokenManager:A}=n;Ue(f&&A,t,"internal-error");const L=us.fromJSON(this.name,A);Ue(typeof f=="string",t,"internal-error"),pr(r,t.name),pr(s,t.name),Ue(typeof m=="boolean",t,"internal-error"),Ue(typeof _=="boolean",t,"internal-error"),pr(o,t.name),pr(i,t.name),pr(a,t.name),pr(l,t.name),pr(c,t.name),pr(u,t.name);const X=new vn({uid:f,auth:t,email:s,emailVerified:m,displayName:r,isAnonymous:_,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:L,createdAt:c,lastLoginAt:u});return $&&Array.isArray($)&&(X.providerData=$.map(O=>({...O}))),l&&(X._redirectEventId=l),X}static async _fromIdTokenResponse(t,n,r=!1){const s=new us;s.updateFromServerResponse(n);const o=new vn({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await Wo(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];Ue(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?bf(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new us;a.updateFromIdToken(r);const l=new vn({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),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:o,metadata:new Ta(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,c),l}}/**
|
|
674
|
+
* @license
|
|
675
|
+
* Copyright 2020 Google LLC
|
|
676
|
+
*
|
|
677
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
678
|
+
* you may not use this file except in compliance with the License.
|
|
679
|
+
* You may obtain a copy of the License at
|
|
680
|
+
*
|
|
681
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
682
|
+
*
|
|
683
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
684
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
685
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
686
|
+
* See the License for the specific language governing permissions and
|
|
687
|
+
* limitations under the License.
|
|
688
|
+
*/const Qc=new Map;function Xn(e){ir(e instanceof Function,"Expected a class definition");let t=Qc.get(e);return t?(ir(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Qc.set(e,t),t)}/**
|
|
689
|
+
* @license
|
|
690
|
+
* Copyright 2019 Google LLC
|
|
691
|
+
*
|
|
692
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
693
|
+
* you may not use this file except in compliance with the License.
|
|
694
|
+
* You may obtain a copy of the License at
|
|
695
|
+
*
|
|
696
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
697
|
+
*
|
|
698
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
699
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
700
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
701
|
+
* See the License for the specific language governing permissions and
|
|
702
|
+
* limitations under the License.
|
|
703
|
+
*/class _f{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){}}_f.type="NONE";const Xc=_f;/**
|
|
704
|
+
* @license
|
|
705
|
+
* Copyright 2019 Google LLC
|
|
706
|
+
*
|
|
707
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
708
|
+
* you may not use this file except in compliance with the License.
|
|
709
|
+
* You may obtain a copy of the License at
|
|
710
|
+
*
|
|
711
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
712
|
+
*
|
|
713
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
714
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
715
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
716
|
+
* See the License for the specific language governing permissions and
|
|
717
|
+
* limitations under the License.
|
|
718
|
+
*/function Po(e,t,n){return`firebase:${e}:${t}:${n}`}class ds{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=Po(this.userKey,s.apiKey,o),this.fullPersistenceKey=Po("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 Vo(this.auth,{idToken:t}).catch(()=>{});return n?vn._fromGetAccountInfoResponse(this.auth,n,t):null}return vn._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 ds(Xn(Xc),t,r);const s=(await Promise.all(n.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c);let o=s[0]||Xn(Xc);const i=Po(r,t.config.apiKey,t.name);let a=null;for(const c of n)try{const u=await c._get(i);if(u){let f;if(typeof u=="string"){const m=await Vo(t,{idToken:u}).catch(()=>{});if(!m)break;f=await vn._fromGetAccountInfoResponse(t,m,u)}else f=vn._fromJSON(t,u);c!==o&&(a=f),o=c;break}}catch{}const l=s.filter(c=>c._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new ds(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async c=>{if(c!==o)try{await c._remove(i)}catch{}})),new ds(o,t,r))}}/**
|
|
719
|
+
* @license
|
|
720
|
+
* Copyright 2020 Google LLC
|
|
721
|
+
*
|
|
722
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
723
|
+
* you may not use this file except in compliance with the License.
|
|
724
|
+
* You may obtain a copy of the License at
|
|
725
|
+
*
|
|
726
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
727
|
+
*
|
|
728
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
729
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
730
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
731
|
+
* See the License for the specific language governing permissions and
|
|
732
|
+
* limitations under the License.
|
|
733
|
+
*/function Zc(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Sf(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(kf(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Cf(t))return"Blackberry";if(Af(t))return"Webos";if(Tf(t))return"Safari";if((t.includes("chrome/")||If(t))&&!t.includes("edge/"))return"Chrome";if(Ef(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 kf(e=on()){return/firefox\//i.test(e)}function Tf(e=on()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function If(e=on()){return/crios\//i.test(e)}function Sf(e=on()){return/iemobile/i.test(e)}function Ef(e=on()){return/android/i.test(e)}function Cf(e=on()){return/blackberry/i.test(e)}function Af(e=on()){return/webos/i.test(e)}function ll(e=on()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function jI(e=on()){var t;return ll(e)&&!!((t=window.navigator)!=null&&t.standalone)}function FI(){return Q0()&&document.documentMode===10}function Rf(e=on()){return ll(e)||Ef(e)||Af(e)||Cf(e)||/windows phone/i.test(e)||Sf(e)}/**
|
|
734
|
+
* @license
|
|
735
|
+
* Copyright 2020 Google LLC
|
|
736
|
+
*
|
|
737
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
738
|
+
* you may not use this file except in compliance with the License.
|
|
739
|
+
* You may obtain a copy of the License at
|
|
740
|
+
*
|
|
741
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
742
|
+
*
|
|
743
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
744
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
745
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
746
|
+
* See the License for the specific language governing permissions and
|
|
747
|
+
* limitations under the License.
|
|
748
|
+
*/function Pf(e,t=[]){let n;switch(e){case"Browser":n=Zc(on());break;case"Worker":n=`${Zc(on())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${lo}/${r}`}/**
|
|
749
|
+
* @license
|
|
750
|
+
* Copyright 2022 Google LLC
|
|
751
|
+
*
|
|
752
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
753
|
+
* you may not use this file except in compliance with the License.
|
|
754
|
+
* You may obtain a copy of the License at
|
|
755
|
+
*
|
|
756
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
757
|
+
*
|
|
758
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
759
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
760
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
761
|
+
* See the License for the specific language governing permissions and
|
|
762
|
+
* limitations under the License.
|
|
763
|
+
*/class BI{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})}}}/**
|
|
764
|
+
* @license
|
|
765
|
+
* Copyright 2023 Google LLC
|
|
766
|
+
*
|
|
767
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
768
|
+
* you may not use this file except in compliance with the License.
|
|
769
|
+
* You may obtain a copy of the License at
|
|
770
|
+
*
|
|
771
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
772
|
+
*
|
|
773
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
774
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
775
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
776
|
+
* See the License for the specific language governing permissions and
|
|
777
|
+
* limitations under the License.
|
|
778
|
+
*/async function UI(e,t={}){return _s(e,"GET","/v2/passwordPolicy",il(e,t))}/**
|
|
779
|
+
* @license
|
|
780
|
+
* Copyright 2023 Google LLC
|
|
781
|
+
*
|
|
782
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
783
|
+
* you may not use this file except in compliance with the License.
|
|
784
|
+
* You may obtain a copy of the License at
|
|
785
|
+
*
|
|
786
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
787
|
+
*
|
|
788
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
789
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
790
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
791
|
+
* See the License for the specific language governing permissions and
|
|
792
|
+
* limitations under the License.
|
|
793
|
+
*/const HI=6;class VI{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??HI,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))}}/**
|
|
794
|
+
* @license
|
|
795
|
+
* Copyright 2020 Google LLC
|
|
796
|
+
*
|
|
797
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
798
|
+
* you may not use this file except in compliance with the License.
|
|
799
|
+
* You may obtain a copy of the License at
|
|
800
|
+
*
|
|
801
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
802
|
+
*
|
|
803
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
804
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
805
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
806
|
+
* See the License for the specific language governing permissions and
|
|
807
|
+
* limitations under the License.
|
|
808
|
+
*/class WI{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 eu(this),this.idTokenSubscription=new eu(this),this.beforeStateQueue=new BI(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=gf,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=Xn(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await ds.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 Vo(this,{idToken:t}),r=await vn._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(Mn(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 Ue(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 Wo(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=II()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Mn(this.app))return Promise.reject(Wr(this));const n=t?bs(t):null;return n&&Ue(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&&Ue(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 Mn(this.app)?Promise.reject(Wr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Mn(this.app)?Promise.reject(Wr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Xn(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 UI(this),n=new VI(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 io("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 LI(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&&Xn(t)||this._popupRedirectResolver;Ue(n,this,"argument-error"),this.redirectPersistenceManager=await ds.create(this,[Xn(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(Ue(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 Ue(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Pf(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(Mn(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&&bI(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function di(e){return bs(e)}class eu{constructor(t){this.auth=t,this.observer=null,this.addObserver=sT(n=>this.observer=n)}get next(){return Ue(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
|
809
|
+
* @license
|
|
810
|
+
* Copyright 2020 Google LLC
|
|
811
|
+
*
|
|
812
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
813
|
+
* you may not use this file except in compliance with the License.
|
|
814
|
+
* You may obtain a copy of the License at
|
|
815
|
+
*
|
|
816
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
817
|
+
*
|
|
818
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
819
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
820
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
821
|
+
* See the License for the specific language governing permissions and
|
|
822
|
+
* limitations under the License.
|
|
823
|
+
*/let cl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function zI(e){cl=e}function GI(e){return cl.loadJS(e)}function qI(){return cl.gapiScript}function KI(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
|
|
824
|
+
* @license
|
|
825
|
+
* Copyright 2020 Google LLC
|
|
826
|
+
*
|
|
827
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
828
|
+
* you may not use this file except in compliance with the License.
|
|
829
|
+
* You may obtain a copy of the License at
|
|
830
|
+
*
|
|
831
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
832
|
+
*
|
|
833
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
834
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
835
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
836
|
+
* See the License for the specific language governing permissions and
|
|
837
|
+
* limitations under the License.
|
|
838
|
+
*/function JI(e,t){const n=uf(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(gs(o,t??{}))return s;Ln(s,"already-initialized")}return n.initialize({options:t})}function YI(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Xn);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function QI(e,t,n){const r=di(e);Ue(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=xf(t),{host:i,port:a}=XI(t),l=a===null?"":`:${a}`,c={url:`${o}//${i}${l}/`},u=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Ue(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Ue(gs(c,r.config.emulator)&&gs(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=c,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,tl(i)?aT(`${o}//${i}${l}`):ZI()}function xf(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function XI(e){const t=xf(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:tu(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:tu(i)}}}function tu(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function ZI(){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())}/**
|
|
839
|
+
* @license
|
|
840
|
+
* Copyright 2020 Google LLC
|
|
841
|
+
*
|
|
842
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
843
|
+
* you may not use this file except in compliance with the License.
|
|
844
|
+
* You may obtain a copy of the License at
|
|
845
|
+
*
|
|
846
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
847
|
+
*
|
|
848
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
849
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
850
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
851
|
+
* See the License for the specific language governing permissions and
|
|
852
|
+
* limitations under the License.
|
|
853
|
+
*/class Mf{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return Qn("not implemented")}_getIdTokenResponse(t){return Qn("not implemented")}_linkToIdToken(t,n){return Qn("not implemented")}_getReauthenticationResolver(t){return Qn("not implemented")}}/**
|
|
854
|
+
* @license
|
|
855
|
+
* Copyright 2020 Google LLC
|
|
856
|
+
*
|
|
857
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
858
|
+
* you may not use this file except in compliance with the License.
|
|
859
|
+
* You may obtain a copy of the License at
|
|
860
|
+
*
|
|
861
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
862
|
+
*
|
|
863
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
864
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
865
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
866
|
+
* See the License for the specific language governing permissions and
|
|
867
|
+
* limitations under the License.
|
|
868
|
+
*/async function fs(e,t){return AI(e,"POST","/v1/accounts:signInWithIdp",il(e,t))}/**
|
|
869
|
+
* @license
|
|
870
|
+
* Copyright 2020 Google LLC
|
|
871
|
+
*
|
|
872
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
873
|
+
* you may not use this file except in compliance with the License.
|
|
874
|
+
* You may obtain a copy of the License at
|
|
875
|
+
*
|
|
876
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
877
|
+
*
|
|
878
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
879
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
880
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
881
|
+
* See the License for the specific language governing permissions and
|
|
882
|
+
* limitations under the License.
|
|
883
|
+
*/const eS="http://localhost";class Gr extends Mf{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new Gr(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):Ln("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 Gr(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 fs(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,fs(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,fs(t,n)}buildRequest(){const t={requestUri:eS,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=ao(n)}return t}}/**
|
|
884
|
+
* @license
|
|
885
|
+
* Copyright 2020 Google LLC
|
|
886
|
+
*
|
|
887
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
888
|
+
* you may not use this file except in compliance with the License.
|
|
889
|
+
* You may obtain a copy of the License at
|
|
890
|
+
*
|
|
891
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
892
|
+
*
|
|
893
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
894
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
895
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
896
|
+
* See the License for the specific language governing permissions and
|
|
897
|
+
* limitations under the License.
|
|
898
|
+
*/class ul{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}}/**
|
|
899
|
+
* @license
|
|
900
|
+
* Copyright 2019 Google LLC
|
|
901
|
+
*
|
|
902
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
903
|
+
* you may not use this file except in compliance with the License.
|
|
904
|
+
* You may obtain a copy of the License at
|
|
905
|
+
*
|
|
906
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
907
|
+
*
|
|
908
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
909
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
910
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
911
|
+
* See the License for the specific language governing permissions and
|
|
912
|
+
* limitations under the License.
|
|
913
|
+
*/class uo extends ul{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
|
|
914
|
+
* @license
|
|
915
|
+
* Copyright 2020 Google LLC
|
|
916
|
+
*
|
|
917
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
918
|
+
* you may not use this file except in compliance with the License.
|
|
919
|
+
* You may obtain a copy of the License at
|
|
920
|
+
*
|
|
921
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
922
|
+
*
|
|
923
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
924
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
925
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
926
|
+
* See the License for the specific language governing permissions and
|
|
927
|
+
* limitations under the License.
|
|
928
|
+
*/class wr extends uo{constructor(){super("facebook.com")}static credential(t){return Gr._fromParams({providerId:wr.PROVIDER_ID,signInMethod:wr.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return wr.credentialFromTaggedObject(t)}static credentialFromError(t){return wr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return wr.credential(t.oauthAccessToken)}catch{return null}}}wr.FACEBOOK_SIGN_IN_METHOD="facebook.com";wr.PROVIDER_ID="facebook.com";/**
|
|
929
|
+
* @license
|
|
930
|
+
* Copyright 2020 Google LLC
|
|
931
|
+
*
|
|
932
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
933
|
+
* you may not use this file except in compliance with the License.
|
|
934
|
+
* You may obtain a copy of the License at
|
|
935
|
+
*
|
|
936
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
937
|
+
*
|
|
938
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
939
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
940
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
941
|
+
* See the License for the specific language governing permissions and
|
|
942
|
+
* limitations under the License.
|
|
943
|
+
*/class br extends uo{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return Gr._fromParams({providerId:br.PROVIDER_ID,signInMethod:br.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return br.credentialFromTaggedObject(t)}static credentialFromError(t){return br.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return br.credential(n,r)}catch{return null}}}br.GOOGLE_SIGN_IN_METHOD="google.com";br.PROVIDER_ID="google.com";/**
|
|
944
|
+
* @license
|
|
945
|
+
* Copyright 2020 Google LLC
|
|
946
|
+
*
|
|
947
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
948
|
+
* you may not use this file except in compliance with the License.
|
|
949
|
+
* You may obtain a copy of the License at
|
|
950
|
+
*
|
|
951
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
952
|
+
*
|
|
953
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
954
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
955
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
956
|
+
* See the License for the specific language governing permissions and
|
|
957
|
+
* limitations under the License.
|
|
958
|
+
*/class On extends uo{constructor(){super("github.com")}static credential(t){return Gr._fromParams({providerId:On.PROVIDER_ID,signInMethod:On.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return On.credentialFromTaggedObject(t)}static credentialFromError(t){return On.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return On.credential(t.oauthAccessToken)}catch{return null}}}On.GITHUB_SIGN_IN_METHOD="github.com";On.PROVIDER_ID="github.com";/**
|
|
959
|
+
* @license
|
|
960
|
+
* Copyright 2020 Google LLC
|
|
961
|
+
*
|
|
962
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
963
|
+
* you may not use this file except in compliance with the License.
|
|
964
|
+
* You may obtain a copy of the License at
|
|
965
|
+
*
|
|
966
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
967
|
+
*
|
|
968
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
969
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
970
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
971
|
+
* See the License for the specific language governing permissions and
|
|
972
|
+
* limitations under the License.
|
|
973
|
+
*/class _r extends uo{constructor(){super("twitter.com")}static credential(t,n){return Gr._fromParams({providerId:_r.PROVIDER_ID,signInMethod:_r.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return _r.credentialFromTaggedObject(t)}static credentialFromError(t){return _r.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return _r.credential(n,r)}catch{return null}}}_r.TWITTER_SIGN_IN_METHOD="twitter.com";_r.PROVIDER_ID="twitter.com";/**
|
|
974
|
+
* @license
|
|
975
|
+
* Copyright 2020 Google LLC
|
|
976
|
+
*
|
|
977
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
978
|
+
* you may not use this file except in compliance with the License.
|
|
979
|
+
* You may obtain a copy of the License at
|
|
980
|
+
*
|
|
981
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
982
|
+
*
|
|
983
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
984
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
985
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
986
|
+
* See the License for the specific language governing permissions and
|
|
987
|
+
* limitations under the License.
|
|
988
|
+
*/class ys{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 vn._fromIdTokenResponse(t,r,s),i=nu(r);return new ys({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=nu(r);return new ys({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function nu(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
|
|
989
|
+
* @license
|
|
990
|
+
* Copyright 2020 Google LLC
|
|
991
|
+
*
|
|
992
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
993
|
+
* you may not use this file except in compliance with the License.
|
|
994
|
+
* You may obtain a copy of the License at
|
|
995
|
+
*
|
|
996
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
997
|
+
*
|
|
998
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
999
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1000
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1001
|
+
* See the License for the specific language governing permissions and
|
|
1002
|
+
* limitations under the License.
|
|
1003
|
+
*/class zo extends Er{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,zo.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 zo(t,n,r,s)}}function Of(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?zo._fromErrorAndOperation(e,o,t,r):o})}async function tS(e,t,n=!1){const r=await no(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return ys._forOperation(e,"link",r)}/**
|
|
1004
|
+
* @license
|
|
1005
|
+
* Copyright 2019 Google LLC
|
|
1006
|
+
*
|
|
1007
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1008
|
+
* you may not use this file except in compliance with the License.
|
|
1009
|
+
* You may obtain a copy of the License at
|
|
1010
|
+
*
|
|
1011
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1012
|
+
*
|
|
1013
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1014
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1015
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1016
|
+
* See the License for the specific language governing permissions and
|
|
1017
|
+
* limitations under the License.
|
|
1018
|
+
*/async function nS(e,t,n=!1){const{auth:r}=e;if(Mn(r.app))return Promise.reject(Wr(r));const s="reauthenticate";try{const o=await no(e,Of(r,s,t,e),n);Ue(o.idToken,r,"internal-error");const i=al(o.idToken);Ue(i,r,"internal-error");const{sub:a}=i;return Ue(e.uid===a,r,"user-mismatch"),ys._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Ln(r,"user-mismatch"),o}}/**
|
|
1019
|
+
* @license
|
|
1020
|
+
* Copyright 2020 Google LLC
|
|
1021
|
+
*
|
|
1022
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1023
|
+
* you may not use this file except in compliance with the License.
|
|
1024
|
+
* You may obtain a copy of the License at
|
|
1025
|
+
*
|
|
1026
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1027
|
+
*
|
|
1028
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1029
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1030
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1031
|
+
* See the License for the specific language governing permissions and
|
|
1032
|
+
* limitations under the License.
|
|
1033
|
+
*/async function rS(e,t,n=!1){if(Mn(e.app))return Promise.reject(Wr(e));const r="signIn",s=await Of(e,r,t),o=await ys._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function sS(e,t,n,r){return bs(e).onIdTokenChanged(t,n,r)}function oS(e,t,n){return bs(e).beforeAuthStateChanged(t,n)}const Go="__sak";/**
|
|
1034
|
+
* @license
|
|
1035
|
+
* Copyright 2019 Google LLC
|
|
1036
|
+
*
|
|
1037
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1038
|
+
* you may not use this file except in compliance with the License.
|
|
1039
|
+
* You may obtain a copy of the License at
|
|
1040
|
+
*
|
|
1041
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1042
|
+
*
|
|
1043
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1044
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1045
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1046
|
+
* See the License for the specific language governing permissions and
|
|
1047
|
+
* limitations under the License.
|
|
1048
|
+
*/class Nf{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Go,"1"),this.storage.removeItem(Go),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()}}/**
|
|
1049
|
+
* @license
|
|
1050
|
+
* Copyright 2020 Google LLC
|
|
1051
|
+
*
|
|
1052
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1053
|
+
* you may not use this file except in compliance with the License.
|
|
1054
|
+
* You may obtain a copy of the License at
|
|
1055
|
+
*
|
|
1056
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1057
|
+
*
|
|
1058
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1059
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1060
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1061
|
+
* See the License for the specific language governing permissions and
|
|
1062
|
+
* limitations under the License.
|
|
1063
|
+
*/const iS=1e3,aS=10;class $f extends Nf{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Rf(),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);FI()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,aS):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)})},iS)}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]}}$f.type="LOCAL";const lS=$f;/**
|
|
1064
|
+
* @license
|
|
1065
|
+
* Copyright 2020 Google LLC
|
|
1066
|
+
*
|
|
1067
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1068
|
+
* you may not use this file except in compliance with the License.
|
|
1069
|
+
* You may obtain a copy of the License at
|
|
1070
|
+
*
|
|
1071
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1072
|
+
*
|
|
1073
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1074
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1075
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1076
|
+
* See the License for the specific language governing permissions and
|
|
1077
|
+
* limitations under the License.
|
|
1078
|
+
*/class Df extends Nf{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}Df.type="SESSION";const Lf=Df;/**
|
|
1079
|
+
* @license
|
|
1080
|
+
* Copyright 2019 Google LLC
|
|
1081
|
+
*
|
|
1082
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1083
|
+
* you may not use this file except in compliance with the License.
|
|
1084
|
+
* You may obtain a copy of the License at
|
|
1085
|
+
*
|
|
1086
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1087
|
+
*
|
|
1088
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1089
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1090
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1091
|
+
* See the License for the specific language governing permissions and
|
|
1092
|
+
* limitations under the License.
|
|
1093
|
+
*/function cS(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
|
|
1094
|
+
* @license
|
|
1095
|
+
* Copyright 2019 Google LLC
|
|
1096
|
+
*
|
|
1097
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1098
|
+
* you may not use this file except in compliance with the License.
|
|
1099
|
+
* You may obtain a copy of the License at
|
|
1100
|
+
*
|
|
1101
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1102
|
+
*
|
|
1103
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1104
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1105
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1106
|
+
* See the License for the specific language governing permissions and
|
|
1107
|
+
* limitations under the License.
|
|
1108
|
+
*/class fi{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 fi(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 c=>c(n.origin,o)),l=await cS(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)}}fi.receivers=[];/**
|
|
1109
|
+
* @license
|
|
1110
|
+
* Copyright 2020 Google LLC
|
|
1111
|
+
*
|
|
1112
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1113
|
+
* you may not use this file except in compliance with the License.
|
|
1114
|
+
* You may obtain a copy of the License at
|
|
1115
|
+
*
|
|
1116
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1117
|
+
*
|
|
1118
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1119
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1120
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1121
|
+
* See the License for the specific language governing permissions and
|
|
1122
|
+
* limitations under the License.
|
|
1123
|
+
*/function dl(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
|
|
1124
|
+
* @license
|
|
1125
|
+
* Copyright 2019 Google LLC
|
|
1126
|
+
*
|
|
1127
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1128
|
+
* you may not use this file except in compliance with the License.
|
|
1129
|
+
* You may obtain a copy of the License at
|
|
1130
|
+
*
|
|
1131
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1132
|
+
*
|
|
1133
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1134
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1135
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1136
|
+
* See the License for the specific language governing permissions and
|
|
1137
|
+
* limitations under the License.
|
|
1138
|
+
*/class uS{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 c=dl("",20);s.port1.start();const u=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(f){const m=f;if(m.data.eventId===c)switch(m.data.status){case"ack":clearTimeout(u),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(m.data.response);break;default:clearTimeout(u),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
|
|
1139
|
+
* @license
|
|
1140
|
+
* Copyright 2020 Google LLC
|
|
1141
|
+
*
|
|
1142
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1143
|
+
* you may not use this file except in compliance with the License.
|
|
1144
|
+
* You may obtain a copy of the License at
|
|
1145
|
+
*
|
|
1146
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1147
|
+
*
|
|
1148
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1149
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1150
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1151
|
+
* See the License for the specific language governing permissions and
|
|
1152
|
+
* limitations under the License.
|
|
1153
|
+
*/function Dn(){return window}function dS(e){Dn().location.href=e}/**
|
|
1154
|
+
* @license
|
|
1155
|
+
* Copyright 2020 Google LLC.
|
|
1156
|
+
*
|
|
1157
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1158
|
+
* you may not use this file except in compliance with the License.
|
|
1159
|
+
* You may obtain a copy of the License at
|
|
1160
|
+
*
|
|
1161
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1162
|
+
*
|
|
1163
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1164
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1165
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1166
|
+
* See the License for the specific language governing permissions and
|
|
1167
|
+
* limitations under the License.
|
|
1168
|
+
*/function jf(){return typeof Dn().WorkerGlobalScope<"u"&&typeof Dn().importScripts=="function"}async function fS(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function hS(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function pS(){return jf()?self:null}/**
|
|
1169
|
+
* @license
|
|
1170
|
+
* Copyright 2019 Google LLC
|
|
1171
|
+
*
|
|
1172
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1173
|
+
* you may not use this file except in compliance with the License.
|
|
1174
|
+
* You may obtain a copy of the License at
|
|
1175
|
+
*
|
|
1176
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1177
|
+
*
|
|
1178
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1179
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1180
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1181
|
+
* See the License for the specific language governing permissions and
|
|
1182
|
+
* limitations under the License.
|
|
1183
|
+
*/const Ff="firebaseLocalStorageDb",mS=1,qo="firebaseLocalStorage",Bf="fbase_key";class fo{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 hi(e,t){return e.transaction([qo],t?"readwrite":"readonly").objectStore(qo)}function gS(){const e=indexedDB.deleteDatabase(Ff);return new fo(e).toPromise()}function Ia(){const e=indexedDB.open(Ff,mS);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(qo,{keyPath:Bf})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(qo)?t(r):(r.close(),await gS(),t(await Ia()))})})}async function ru(e,t,n){const r=hi(e,!0).put({[Bf]:t,value:n});return new fo(r).toPromise()}async function vS(e,t){const n=hi(e,!1).get(t),r=await new fo(n).toPromise();return r===void 0?null:r.value}function su(e,t){const n=hi(e,!0).delete(t);return new fo(n).toPromise()}const yS=800,wS=3;class Uf{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 Ia(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>wS)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return jf()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=fi._getInstance(pS()),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 fS(),!this.activeServiceWorker)return;this.sender=new uS(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||hS()!==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 Ia();return await ru(t,Go,"1"),await su(t,Go),!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=>ru(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>vS(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>su(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=hi(s,!1).getAll();return new fo(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(),yS)}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()}}Uf.type="LOCAL";const bS=Uf;new co(3e4,6e4);/**
|
|
1184
|
+
* @license
|
|
1185
|
+
* Copyright 2021 Google LLC
|
|
1186
|
+
*
|
|
1187
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1188
|
+
* you may not use this file except in compliance with the License.
|
|
1189
|
+
* You may obtain a copy of the License at
|
|
1190
|
+
*
|
|
1191
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1192
|
+
*
|
|
1193
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1194
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1195
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1196
|
+
* See the License for the specific language governing permissions and
|
|
1197
|
+
* limitations under the License.
|
|
1198
|
+
*/function Hf(e,t){return t?Xn(t):(Ue(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
|
|
1199
|
+
* @license
|
|
1200
|
+
* Copyright 2019 Google LLC
|
|
1201
|
+
*
|
|
1202
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1203
|
+
* you may not use this file except in compliance with the License.
|
|
1204
|
+
* You may obtain a copy of the License at
|
|
1205
|
+
*
|
|
1206
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1207
|
+
*
|
|
1208
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1209
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1210
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1211
|
+
* See the License for the specific language governing permissions and
|
|
1212
|
+
* limitations under the License.
|
|
1213
|
+
*/class fl extends Mf{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return fs(t,this._buildIdpRequest())}_linkToIdToken(t,n){return fs(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return fs(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 _S(e){return rS(e.auth,new fl(e),e.bypassAuthState)}function kS(e){const{auth:t,user:n}=e;return Ue(n,t,"internal-error"),nS(n,new fl(e),e.bypassAuthState)}async function TS(e){const{auth:t,user:n}=e;return Ue(n,t,"internal-error"),tS(n,new fl(e),e.bypassAuthState)}/**
|
|
1214
|
+
* @license
|
|
1215
|
+
* Copyright 2020 Google LLC
|
|
1216
|
+
*
|
|
1217
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1218
|
+
* you may not use this file except in compliance with the License.
|
|
1219
|
+
* You may obtain a copy of the License at
|
|
1220
|
+
*
|
|
1221
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1222
|
+
*
|
|
1223
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1224
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1225
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1226
|
+
* See the License for the specific language governing permissions and
|
|
1227
|
+
* limitations under the License.
|
|
1228
|
+
*/class Vf{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(c){this.reject(c)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return _S;case"linkViaPopup":case"linkViaRedirect":return TS;case"reauthViaPopup":case"reauthViaRedirect":return kS;default:Ln(this.auth,"internal-error")}}resolve(t){ir(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){ir(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()}}/**
|
|
1229
|
+
* @license
|
|
1230
|
+
* Copyright 2020 Google LLC
|
|
1231
|
+
*
|
|
1232
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1233
|
+
* you may not use this file except in compliance with the License.
|
|
1234
|
+
* You may obtain a copy of the License at
|
|
1235
|
+
*
|
|
1236
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1237
|
+
*
|
|
1238
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1239
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1240
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1241
|
+
* See the License for the specific language governing permissions and
|
|
1242
|
+
* limitations under the License.
|
|
1243
|
+
*/const IS=new co(2e3,1e4);async function SS(e,t,n){if(Mn(e.app))return Promise.reject(bn(e,"operation-not-supported-in-this-environment"));const r=di(e);_I(e,t,ul);const s=Hf(r,n);return new Ur(r,"signInViaPopup",t,s).executeNotNull()}class Ur extends Vf{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,Ur.currentPopupAction&&Ur.currentPopupAction.cancel(),Ur.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Ue(t,this.auth,"internal-error"),t}async onExecution(){ir(this.filter.length===1,"Popup operations only handle one event");const t=dl();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(bn(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(bn(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ur.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(bn(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,IS.get())};t()}}Ur.currentPopupAction=null;/**
|
|
1244
|
+
* @license
|
|
1245
|
+
* Copyright 2020 Google LLC
|
|
1246
|
+
*
|
|
1247
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1248
|
+
* you may not use this file except in compliance with the License.
|
|
1249
|
+
* You may obtain a copy of the License at
|
|
1250
|
+
*
|
|
1251
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1252
|
+
*
|
|
1253
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1254
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1255
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1256
|
+
* See the License for the specific language governing permissions and
|
|
1257
|
+
* limitations under the License.
|
|
1258
|
+
*/const ES="pendingRedirect",xo=new Map;class CS extends Vf{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=xo.get(this.auth._key());if(!t){try{const r=await AS(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}xo.set(this.auth._key(),t)}return this.bypassAuthState||xo.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 AS(e,t){const n=xS(t),r=PS(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function RS(e,t){xo.set(e._key(),t)}function PS(e){return Xn(e._redirectPersistence)}function xS(e){return Po(ES,e.config.apiKey,e.name)}async function MS(e,t,n=!1){if(Mn(e.app))return Promise.reject(Wr(e));const r=di(e),s=Hf(r,t),i=await new CS(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
|
|
1259
|
+
* @license
|
|
1260
|
+
* Copyright 2020 Google LLC
|
|
1261
|
+
*
|
|
1262
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1263
|
+
* you may not use this file except in compliance with the License.
|
|
1264
|
+
* You may obtain a copy of the License at
|
|
1265
|
+
*
|
|
1266
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1267
|
+
*
|
|
1268
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1269
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1270
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1271
|
+
* See the License for the specific language governing permissions and
|
|
1272
|
+
* limitations under the License.
|
|
1273
|
+
*/const OS=600*1e3;class NS{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||!$S(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!Wf(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(bn(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>=OS&&this.cachedEventUids.clear(),this.cachedEventUids.has(ou(t))}saveEventToCache(t){this.cachedEventUids.add(ou(t)),this.lastProcessedEventTime=Date.now()}}function ou(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function Wf({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function $S(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Wf(e);default:return!1}}/**
|
|
1274
|
+
* @license
|
|
1275
|
+
* Copyright 2020 Google LLC
|
|
1276
|
+
*
|
|
1277
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1278
|
+
* you may not use this file except in compliance with the License.
|
|
1279
|
+
* You may obtain a copy of the License at
|
|
1280
|
+
*
|
|
1281
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1282
|
+
*
|
|
1283
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1284
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1285
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1286
|
+
* See the License for the specific language governing permissions and
|
|
1287
|
+
* limitations under the License.
|
|
1288
|
+
*/async function DS(e,t={}){return _s(e,"GET","/v1/projects",t)}/**
|
|
1289
|
+
* @license
|
|
1290
|
+
* Copyright 2020 Google LLC
|
|
1291
|
+
*
|
|
1292
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1293
|
+
* you may not use this file except in compliance with the License.
|
|
1294
|
+
* You may obtain a copy of the License at
|
|
1295
|
+
*
|
|
1296
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1297
|
+
*
|
|
1298
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1299
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1300
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1301
|
+
* See the License for the specific language governing permissions and
|
|
1302
|
+
* limitations under the License.
|
|
1303
|
+
*/const LS=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,jS=/^https?/;async function FS(e){if(e.config.emulator)return;const{authorizedDomains:t}=await DS(e);for(const n of t)try{if(BS(n))return}catch{}Ln(e,"unauthorized-domain")}function BS(e){const t=ka(),{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(!jS.test(n))return!1;if(LS.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
|
|
1304
|
+
* @license
|
|
1305
|
+
* Copyright 2020 Google LLC.
|
|
1306
|
+
*
|
|
1307
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1308
|
+
* you may not use this file except in compliance with the License.
|
|
1309
|
+
* You may obtain a copy of the License at
|
|
1310
|
+
*
|
|
1311
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1312
|
+
*
|
|
1313
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1314
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1315
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1316
|
+
* See the License for the specific language governing permissions and
|
|
1317
|
+
* limitations under the License.
|
|
1318
|
+
*/const US=new co(3e4,6e4);function iu(){const e=Dn().___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 HS(e){return new Promise((t,n)=>{var s,o,i;function r(){iu(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{iu(),n(bn(e,"network-request-failed"))},timeout:US.get()})}if((o=(s=Dn().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=Dn().gapi)!=null&&i.load)r();else{const a=KI("iframefcb");return Dn()[a]=()=>{gapi.load?r():n(bn(e,"network-request-failed"))},GI(`${qI()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw Mo=null,t})}let Mo=null;function VS(e){return Mo=Mo||HS(e),Mo}/**
|
|
1319
|
+
* @license
|
|
1320
|
+
* Copyright 2020 Google LLC.
|
|
1321
|
+
*
|
|
1322
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1323
|
+
* you may not use this file except in compliance with the License.
|
|
1324
|
+
* You may obtain a copy of the License at
|
|
1325
|
+
*
|
|
1326
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1327
|
+
*
|
|
1328
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1329
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1330
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1331
|
+
* See the License for the specific language governing permissions and
|
|
1332
|
+
* limitations under the License.
|
|
1333
|
+
*/const WS=new co(5e3,15e3),zS="__/auth/iframe",GS="emulator/auth/iframe",qS={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},KS=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function JS(e){const t=e.config;Ue(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?ol(t,GS):`https://${e.config.authDomain}/${zS}`,r={apiKey:t.apiKey,appName:e.name,v:lo},s=KS.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${ao(r).slice(1)}`}async function YS(e){const t=await VS(e),n=Dn().gapi;return Ue(n,e,"internal-error"),t.open({where:document.body,url:JS(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:qS,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=bn(e,"network-request-failed"),a=Dn().setTimeout(()=>{o(i)},WS.get());function l(){Dn().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
|
|
1334
|
+
* @license
|
|
1335
|
+
* Copyright 2020 Google LLC.
|
|
1336
|
+
*
|
|
1337
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1338
|
+
* you may not use this file except in compliance with the License.
|
|
1339
|
+
* You may obtain a copy of the License at
|
|
1340
|
+
*
|
|
1341
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1342
|
+
*
|
|
1343
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1344
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1345
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1346
|
+
* See the License for the specific language governing permissions and
|
|
1347
|
+
* limitations under the License.
|
|
1348
|
+
*/const QS={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},XS=500,ZS=600,eE="_blank",tE="http://localhost";class au{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function nE(e,t,n,r=XS,s=ZS){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={...QS,width:r.toString(),height:s.toString(),top:o,left:i},c=on().toLowerCase();n&&(a=If(c)?eE:n),kf(c)&&(t=t||tE,l.scrollbars="yes");const u=Object.entries(l).reduce((m,[_,$])=>`${m}${_}=${$},`,"");if(jI(c)&&a!=="_self")return rE(t||"",a),new au(null);const f=window.open(t||"",a,u);Ue(f,e,"popup-blocked");try{f.focus()}catch{}return new au(f)}function rE(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)}/**
|
|
1349
|
+
* @license
|
|
1350
|
+
* Copyright 2021 Google LLC
|
|
1351
|
+
*
|
|
1352
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1353
|
+
* you may not use this file except in compliance with the License.
|
|
1354
|
+
* You may obtain a copy of the License at
|
|
1355
|
+
*
|
|
1356
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1357
|
+
*
|
|
1358
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1359
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1360
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1361
|
+
* See the License for the specific language governing permissions and
|
|
1362
|
+
* limitations under the License.
|
|
1363
|
+
*/const sE="__/auth/handler",oE="emulator/auth/handler",iE=encodeURIComponent("fac");async function lu(e,t,n,r,s,o){Ue(e.config.authDomain,e,"auth-domain-config-required"),Ue(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:lo,eventId:s};if(t instanceof ul){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",rT(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[u,f]of Object.entries({}))i[u]=f}if(t instanceof uo){const u=t.getScopes().filter(f=>f!=="");u.length>0&&(i.scopes=u.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const u of Object.keys(a))a[u]===void 0&&delete a[u];const l=await e._getAppCheckToken(),c=l?`#${iE}=${encodeURIComponent(l)}`:"";return`${aE(e)}?${ao(a).slice(1)}${c}`}function aE({config:e}){return e.emulator?ol(e,oE):`https://${e.authDomain}/${sE}`}/**
|
|
1364
|
+
* @license
|
|
1365
|
+
* Copyright 2020 Google LLC
|
|
1366
|
+
*
|
|
1367
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1368
|
+
* you may not use this file except in compliance with the License.
|
|
1369
|
+
* You may obtain a copy of the License at
|
|
1370
|
+
*
|
|
1371
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1372
|
+
*
|
|
1373
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1374
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1375
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1376
|
+
* See the License for the specific language governing permissions and
|
|
1377
|
+
* limitations under the License.
|
|
1378
|
+
*/const Vi="webStorageSupport";class lE{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Lf,this._completeRedirectFn=MS,this._overrideRedirectResult=RS}async _openPopup(t,n,r,s){var i;ir((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await lu(t,n,r,ka(),s);return nE(t,o,dl())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await lu(t,n,r,ka(),s);return dS(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):(ir(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 YS(t),r=new NS(t);return n.register("authEvent",s=>(Ue(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(Vi,{type:Vi},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[Vi];o!==void 0&&n(!!o),Ln(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=FS(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return Rf()||Tf()||ll()}}const cE=lE;var cu="@firebase/auth",uu="1.12.2";/**
|
|
1379
|
+
* @license
|
|
1380
|
+
* Copyright 2020 Google LLC
|
|
1381
|
+
*
|
|
1382
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1383
|
+
* you may not use this file except in compliance with the License.
|
|
1384
|
+
* You may obtain a copy of the License at
|
|
1385
|
+
*
|
|
1386
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1387
|
+
*
|
|
1388
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1389
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1390
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1391
|
+
* See the License for the specific language governing permissions and
|
|
1392
|
+
* limitations under the License.
|
|
1393
|
+
*/class uE{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(){Ue(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
1394
|
+
* @license
|
|
1395
|
+
* Copyright 2020 Google LLC
|
|
1396
|
+
*
|
|
1397
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1398
|
+
* you may not use this file except in compliance with the License.
|
|
1399
|
+
* You may obtain a copy of the License at
|
|
1400
|
+
*
|
|
1401
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1402
|
+
*
|
|
1403
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1404
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1405
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1406
|
+
* See the License for the specific language governing permissions and
|
|
1407
|
+
* limitations under the License.
|
|
1408
|
+
*/function dE(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 fE(e){eo(new vs("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;Ue(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:Pf(e)},c=new WI(r,s,o,l);return YI(c,n),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),eo(new vs("auth-internal",t=>{const n=di(t.getProvider("auth").getImmediate());return(r=>new uE(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),cs(cu,uu,dE(e)),cs(cu,uu,"esm2020")}/**
|
|
1409
|
+
* @license
|
|
1410
|
+
* Copyright 2021 Google LLC
|
|
1411
|
+
*
|
|
1412
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1413
|
+
* you may not use this file except in compliance with the License.
|
|
1414
|
+
* You may obtain a copy of the License at
|
|
1415
|
+
*
|
|
1416
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1417
|
+
*
|
|
1418
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1419
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1420
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1421
|
+
* See the License for the specific language governing permissions and
|
|
1422
|
+
* limitations under the License.
|
|
1423
|
+
*/const hE=300,pE=of("authIdTokenMaxAge")||hE;let du=null;const mE=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>pE)return;const s=n==null?void 0:n.token;du!==s&&(du=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function gE(e=ff()){const t=uf(e,"auth");if(t.isInitialized())return t.getImmediate();const n=JI(e,{popupRedirectResolver:cE,persistence:[bS,lS,Lf]}),r=of("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=mE(o.toString());oS(n,i,()=>i(n.currentUser)),sS(n,a=>i(a))}}const s=z0("auth");return s&&QI(n,`http://${s}`),n}function vE(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}zI({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=bn("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",vE().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="});fE("Browser");const yE={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 wE(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=he(()=>s.value==="pull"),a=he(()=>s.value==="push"),l=he(()=>s.value!=="");async function c(){try{const A=await fetch("/codex-api/skills-sync/status");if(!A.ok)return;const L=await A.json();L.data&&(o.value=L.data)}catch{}}async function u(){try{const A=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),L=await A.json();if(!A.ok||!L.data)throw new Error("Failed to start GitHub login");t.value=L.data;const X=30,O=Math.max((L.data.interval??5)*1e3,3e3);let z=!1;for(let V=0;V<X;V++){await new Promise(ye=>setTimeout(ye,O));const fe=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:L.data.device_code})}),ie=await fe.json();if(!fe.ok)throw new Error(ie.error||"Failed to complete GitHub login");if(ie.ok){z=!0;break}if(!ie.pending)throw new Error(ie.error||"Failed to complete GitHub login")}if(!z)throw new Error("GitHub login timed out. Please retry.");t.value=null,await c(),e.showToast("GitHub login successful")}catch(A){e.showToast(A instanceof Error?A.message:"Failed GitHub login","error")}}async function f(){try{const A=iI().length>0?ff():df(yE),L=gE(A),X=new On;X.addScope("repo");const O=await SS(L,X),z=On.credentialFromResult(O),V=(z==null?void 0:z.accessToken)??"";if(!V)throw new Error("GitHub access token missing from Firebase login");const fe=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:V})}),ie=await fe.json();if(!fe.ok||!ie.ok)throw new Error(ie.error||"Failed to login with GitHub token");await c(),e.showToast("GitHub login successful")}catch(A){const L=A instanceof Error?A.message:"Failed Firebase GitHub login";e.showToast(L,"error")}}async function m(){r.value="",n.value="pull-started",s.value="pull";try{const A=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),L=await A.json();if(!A.ok||!L.ok)throw new Error(L.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(A){const L=A instanceof Error?A.message:"Failed to pull sync";r.value=L,n.value="pull-failed",e.showToast(L,"error")}finally{s.value=""}}async function _(){r.value="",n.value="push-started",s.value="push";try{const A=await fetch("/codex-api/skills-sync/push",{method:"POST"}),L=await A.json();if(!A.ok||!L.ok)throw new Error(L.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch(A){const L=A instanceof Error?A.message:"Failed to push sync";r.value=L,n.value="push-failed",e.showToast(L,"error")}finally{s.value=""}}async function $(){try{const A=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),L=await A.json();if(!A.ok||!L.ok)throw new Error(L.error||"Failed to logout GitHub");await c(),e.showToast("Logged out from GitHub")}catch(A){e.showToast(A instanceof Error?A.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:c,logoutGithub:$,pullSkillsSync:m,pushSkillsSync:_,startGithubFirebaseLogin:f,startGithubLogin:u,syncActionError:r,syncActionStatus:n,syncStatus:o}}const bE={class:"skills-hub"},_E={class:"skills-sync-panel"},kE={class:"skills-sync-header"},TE={key:0,class:"skills-sync-badge"},IE={key:1,class:"skills-sync-badge"},SE={key:2,class:"skills-sync-badge"},EE={class:"skills-sync-meta"},CE={key:0,class:"skills-sync-error"},AE={key:1,class:"skills-sync-meta"},RE={key:2,class:"skills-sync-error"},PE={key:3,class:"skills-sync-device"},xE=["href"],ME={class:"skills-sync-actions"},OE=["disabled"],NE=["disabled"],$E=["disabled"],DE={key:1,class:"skills-hub-section"},LE={class:"skills-hub-section-title"},jE={key:0,class:"skills-hub-grid"},FE={class:"skills-hub-toolbar"},BE={class:"skills-hub-search-wrap"},UE={key:0,class:"skills-hub-count"},HE={class:"skills-hub-section"},VE={key:0,class:"skills-hub-loading"},WE={key:1,class:"skills-hub-error"},zE={key:0,class:"skills-hub-grid"},GE={key:1,class:"skills-hub-empty"},wo="codex-web-local.skills-hub.cache.v1",qE=Ut({__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),c=D(!1),u=D(""),f=D(!0),m=D(!1),_=D(n),$=D(null),A=D(""),L=D(!1),X=D(!1);let O=null,z=null;const V=t,fe=he(()=>o.value==="date"?"Newest":"A-Z"),ie=he(()=>{var P;return((P=$.value)==null?void 0:P.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),ye=he(()=>`${_.value.owner}/${_.value.name}`),Te=he(()=>L.value&&A.value===ye.value),re=he(()=>X.value&&A.value===ye.value),ee=he(()=>{const P=s.value.toLowerCase().trim();return P?a.value.filter(U=>U.name.toLowerCase().includes(P)||U.owner.toLowerCase().includes(P)||(U.displayName??"").toLowerCase().includes(P)):a.value});function we(P,U="success"){$.value={text:P,type:U},z&&clearTimeout(z),z=setTimeout(()=>{$.value=null},3e3)}function ne(){o.value=o.value==="date"?"name":"date",Oe(s.value)}function je(P){return`${o.value}::${P.trim().toLowerCase()}`}function Fe(P){var U;if(typeof window>"u")return null;try{const j=window.localStorage.getItem(wo);return j?((U=JSON.parse(j).byKey)==null?void 0:U[P])??null:null}catch{return null}}function et(P,U){if(!(typeof window>"u"))try{const j=window.localStorage.getItem(wo),H=(j?JSON.parse(j):{}).byKey??{};H[P]=U,window.localStorage.setItem(wo,JSON.stringify({byKey:H}))}catch{}}function De(){if(!(typeof window>"u"))try{window.localStorage.removeItem(wo)}catch{}}function Ee(P){const U=P.installed??[];a.value=U;const j=new Set(U.map(K=>K.name));i.value=P.data.map(K=>{if(K.installed||j.has(K.name)){const H=U.find(_e=>_e.name===K.name);return{...K,installed:!0,path:(H==null?void 0:H.path)??K.path,enabled:(H==null?void 0:H.enabled)??K.enabled}}return K}).filter(K=>!K.installed),l.value=P.total}async function Oe(P){const U=je(P),j=Fe(U);j&&Ee(j),c.value=!j,u.value="";try{const K=new URLSearchParams;P.trim()&&K.set("q",P.trim()),K.set("limit","100"),K.set("sort",o.value);const H=await fetch(`/codex-api/skills-hub?${K}`);if(!H.ok)throw new Error(`HTTP ${H.status}`);const _e=await H.json();Ee(_e),et(U,_e)}catch(K){u.value=K instanceof Error?K.message:"Failed to load skills"}finally{c.value=!1}}function tt(){O&&clearTimeout(O),O=setTimeout(()=>Oe(s.value),300)}function Qe(P){_.value=P,m.value=!0}async function Ze(P){A.value=`${P.owner}/${P.name}`,L.value=!0;try{const j=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:P.owner,name:P.name})})).json();if(!j.ok)throw new Error(j.error||"Install failed");const K={...P,installed:!0,path:j.path,enabled:!0};a.value=[...a.value,K],i.value=i.value.filter(H=>H.name!==P.name),_.value=K,we(`${P.displayName||P.name} skill installed`),m.value=!1,De(),V("skills-changed")}catch(U){we(U instanceof Error?U.message:"Failed to install skill","error")}finally{L.value=!1}}async function Xe(P){A.value=`${P.owner}/${P.name}`,X.value=!0;try{const j=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.name,path:P.path})})).json();if(!j.ok)throw new Error(j.error||"Uninstall failed");a.value=a.value.filter(K=>K.name!==P.name),P.owner!=="local"&&(i.value=[...i.value,{...P,installed:!1,path:void 0,enabled:void 0}]),we(`${P.displayName||P.name} skill uninstalled`),m.value=!1,De(),V("skills-changed")}catch(U){we(U instanceof Error?U.message:"Failed to uninstall skill","error")}finally{X.value=!1}}async function ht(P,U){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:P.path,enabled:U}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),we(`${P.displayName||P.name} skill ${U?"enabled":"disabled"}`),await Oe(s.value)}catch(j){we(j instanceof Error?j.message:"Failed to update skill","error")}}const{deviceLogin:Pt,isPullInFlight:qe,isPushInFlight:nt,isSyncActionInFlight:W,loadSyncStatus:me,logoutGithub:ae,pullSkillsSync:pe,pushSkillsSync:Ne,startGithubFirebaseLogin:g,startGithubLogin:v,syncActionError:C,syncActionStatus:B,syncStatus:F}=wE({showToast:we,onPulled:async()=>{await Oe(s.value),V("skills-changed")}});return lr(()=>{Oe(""),me()}),(P,U)=>(w(),T("div",bE,[U[11]||(U[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",_E,[p("div",kE,[U[8]||(U[8]=p("strong",null,"Skills Sync (GitHub)",-1)),de(F).configured?(w(),T("span",TE,"Connected: "+se(de(F).repoOwner)+"/"+se(de(F).repoName),1)):de(F).loggedIn?(w(),T("span",IE,"Logged in as "+se(de(F).githubUsername),1)):(w(),T("span",SE,"Not connected"))]),p("div",EE,[p("span",null,"Startup: "+se(de(F).startup.mode),1),p("span",null,"Branch: "+se(de(F).startup.branch),1),p("span",null,"Action: "+se(de(F).startup.lastAction),1)]),de(F).startup.lastError?(w(),T("div",CE,se(de(F).startup.lastError),1)):oe("",!0),de(B)?(w(),T("div",AE,[p("span",null,"Manual sync: "+se(de(B)),1)])):oe("",!0),de(C)?(w(),T("div",RE,se(de(C)),1)):oe("",!0),de(Pt)?(w(),T("div",PE,[p("span",null,[U[9]||(U[9]=Js("Open ",-1)),p("a",{href:de(Pt).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,xE),U[10]||(U[10]=Js(" and enter code:",-1))]),p("code",null,se(de(Pt).user_code),1)])):oe("",!0),p("div",ME,[de(F).loggedIn?oe("",!0):(w(),T("button",{key:0,class:"skills-hub-sort",type:"button",onClick:U[0]||(U[0]=(...j)=>de(g)&&de(g)(...j))},"Login with GitHub")),de(F).loggedIn?oe("",!0):(w(),T("button",{key:1,class:"skills-hub-sort",type:"button",onClick:U[1]||(U[1]=(...j)=>de(v)&&de(v)(...j))},"Device Login")),de(F).loggedIn?(w(),T("button",{key:2,class:"skills-hub-sort",type:"button",onClick:U[2]||(U[2]=(...j)=>de(ae)&&de(ae)(...j)),disabled:de(W)},"Logout GitHub",8,OE)):oe("",!0),p("button",{class:"skills-hub-sort",type:"button",onClick:U[3]||(U[3]=(...j)=>de(pe)&&de(pe)(...j)),disabled:de(W)},se(de(qe)?"Pulling...":"Pull"),9,NE),de(F).loggedIn?(w(),T("button",{key:3,class:"skills-hub-sort",type:"button",onClick:U[4]||(U[4]=(...j)=>de(Ne)&&de(Ne)(...j)),disabled:!de(F).configured||de(W)},se(de(nt)?"Pushing...":"Push"),9,$E)):oe("",!0)])]),$.value?(w(),T("div",{key:0,class:gt(["skills-hub-toast",ie.value])},se($.value.text),3)):oe("",!0),ee.value.length>0?(w(),T("div",DE,[p("button",{class:"skills-hub-section-toggle",type:"button",onClick:U[5]||(U[5]=j=>f.value=!f.value)},[p("span",LE,"Installed ("+se(ee.value.length)+")",1),Ae(Yd,{class:gt(["skills-hub-section-chevron",{"is-open":f.value}])},null,8,["class"])]),f.value?(w(),T("div",jE,[(w(!0),T(Le,null,Ct(ee.value,j=>(w(),wt(jc,{key:j.name,skill:j,onSelect:K=>Qe(K)},null,8,["skill","onSelect"]))),128))])):oe("",!0)])):oe("",!0),p("div",FE,[p("div",BE,[Ae(ga,{class:"skills-hub-search-icon"}),rr(p("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":U[6]||(U[6]=j=>s.value=j),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:tt},null,544),[[sr,s.value]]),l.value>0?(w(),T("span",UE,se(l.value)+" skills",1)):oe("",!0)]),p("button",{class:"skills-hub-sort",type:"button",onClick:ne},se(fe.value),1)]),p("div",HE,[c.value?(w(),T("div",VE,"Loading skills...")):u.value?(w(),T("div",WE,se(u.value),1)):(w(),T(Le,{key:2},[i.value.length>0?(w(),T("div",zE,[(w(!0),T(Le,null,Ct(i.value,j=>(w(),wt(jc,{key:j.url,skill:j,onSelect:K=>Qe(K)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(w(),T("div",GE,'No skills found for "'+se(s.value)+'"',1)):oe("",!0)],64))]),Ae(D0,{skill:_.value,visible:m.value,"is-installing":Te.value,"is-uninstalling":re.value,onClose:U[7]||(U[7]=j=>m.value=!1),onInstall:Ze,onUninstall:Xe,onToggleEnabled:ht},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),KE=ot(qE,[["__scopeId","data-v-2f6920be"]]),JE={},YE={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 QE(e,t){return w(),T("svg",YE,[...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 XE=ot(JE,[["render",QE]]),ZE={},eC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function tC(e,t){return w(),T("svg",eC,[...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 nC=ot(ZE,[["render",tC]]),rC={class:"sidebar-thread-controls"},sC=["aria-label","title"],oC=Ut({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(w(),T("div",rC,[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(),wt(nC,{key:0,class:"sidebar-thread-controls-icon"})):(w(),wt(XE,{key:1,class:"sidebar-thread-controls-icon"}))],8,sC),Nn(t.$slots,"default",{},void 0),e.showNewThreadButton?(w(),T("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"))},[Ae(Uo,{class:"sidebar-thread-controls-icon"})])):oe("",!0)]))}}),fu=ot(oC,[["__scopeId","data-v-46a10052"]]),iC={},aC={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function lC(e,t){return w(),T("svg",aC,[...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 cC=ot(iC,[["render",lC]]);function yr(e){return e.flatMap(t=>t.threads)}const zf="codex-web-local.thread-read-state.v1",Gf="codex-web-local.thread-scroll-state.v1",Sa="codex-web-local.selected-thread-id.v1",qf="codex-web-local.project-order.v1",Kf="codex-web-local.project-display-name.v1",Wi=220,hu=["none","minimal","low","medium","high","xhigh"],Ms="__global__",mn="gpt-5.2-codex";function uC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(zf);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function pu(e){typeof window>"u"||window.localStorage.setItem(zf,JSON.stringify(e))}function Jf(e,t,n){return Math.min(Math.max(e,t),n)}function dC(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=Jf(t.scrollRatio,0,1)),n}function fC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Gf);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=dC(s);o&&(n[r]=o)}return n}catch{return{}}}function mu(e){typeof window>"u"||window.localStorage.setItem(Gf,JSON.stringify(e))}function hC(){return typeof window>"u"?"":window.localStorage.getItem(Sa)??""}function pC(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Sa);return}window.localStorage.setItem(Sa,e)}}function mC(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(qf);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 es(e){typeof window>"u"||window.localStorage.setItem(qf,JSON.stringify(e))}function gC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Kf);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 zi(e){typeof window>"u"||window.localStorage.setItem(Kf,JSON.stringify(e))}function bo(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 Fr(e,n)?e:n}function Gi(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??{projectName:s,threads:[]});for(const s of e)t.includes(s.projectName)||r.push(s);return r}function Fr(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 vC(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 yC(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 Ea(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Fr(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&yC(e.commandExecution,t.commandExecution)&&e.turnIndex===t.turnIndex}function Ko(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 wC(e,t,n={}){const r=new Map(e.map(u=>[u.id,u])),s=new Map(t.map(u=>[u.id,u])),o=t.map(u=>{const f=r.get(u.id);return f&&Ea(f,u)?f:u});if(n.preserveMissing!==!0)return Ko(e,o)?e:o;const i=e.map(u=>{const f=s.get(u.id);return!f||Ea(u,f)?u:f}),a=new Set(e.map(u=>u.id)),l=o.filter(u=>!a.has(u.id)),c=[...i,...l];return Ko(e,c)?e:c}function Ca(e){return e.replace(/\s+/gu," ").trim()}function bC(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>Ca(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=Ca(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function gu(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(Ea(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Yf="worked";function mr(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function _C(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),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 kC(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function TC(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 IC(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${_C(e.durationMs)}`,messageType:Yf}}function SC(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function EC(e,t){const n=IC(t),r=e.filter(i=>i.messageType!==Yf),s=SC(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function Wt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function CC(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 AC(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 RC(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 Gt(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function ko(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 c=i.get(l.id);return c&&CC(c,l)?c:l});return o&&o.projectName===s.projectName&&AC(o.threads,a)?o:{projectName:s.projectName,threads:a}});return RC(e,r)?e:r}function PC(e,t,n){const r=new Set(yr(t).map(a=>a.id)),s=yr(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 c=i.findIndex(u=>u.projectName===a.projectName);c>=0&&(i[c]={projectName:i[c].projectName,threads:[a,...i[c].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function xC(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function qi(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function MC(e){const t=e.split(`
|
|
1424
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function OC(){const e=D([]),t=D([]),n=D(hC()),r=D({}),s=D({}),o=D({}),i=D({}),a=D({}),l=D({}),c=D({}),u=D([]),f=D(""),m=D("medium"),_=D(uC()),$=D(fC()),A=D(mC()),L=D(gC()),X=D({}),O=D({}),z=D({}),V=D({}),fe=D({}),ie=D({}),ye=D({}),Te=D({}),re=D({}),ee=D({}),we=D([]),ne=D(!1),je=D(!1),Fe=D(!1),et=D(!1),De=D(!1),Ee=D(""),Oe=D(!1),tt=D(!1);let Qe=null,Ze=null,Xe=!1;const ht=new Set;let Pt=!1,qe=!1;const nt=new Map,W=new Set,me=he(()=>yr(e.value)),ae=he(()=>me.value.find(d=>d.id===n.value)??null),pe=he(()=>$.value[n.value]??null),Ne=he(()=>{const d=[],h=n.value;return h&&Array.isArray(Te.value[h])&&d.push(...Te.value[h]),Array.isArray(Te.value[Ms])&&d.push(...Te.value[Ms]),d.sort((y,E)=>y.receivedAtIso.localeCompare(E.receivedAtIso))}),g=he(()=>{var Z;const d=n.value;if(!d)return null;const h=fe.value[d],y=(o.value[d]??"").trim(),E=(((Z=ie.value[d])==null?void 0:Z.message)??"").trim();return!h&&!y&&!E?null:{activityLabel:(h==null?void 0:h.label)||"Thinking",activityDetails:(h==null?void 0:h.details)??[],reasoningText:y,errorText:E}}),v=he(()=>{const d=n.value;if(!d)return[];const h=r.value[d]??[],y=s.value[d]??[],E=i.value[d]??[],Z=[...h,...E,...y],Q=V.value[d];return Q?EC(Z,Q):Z});function C(d){n.value!==d&&(n.value=d,pC(d),qe=!1)}function B(d){f.value=d.trim()}async function F(){f.value=mn,u.value.includes(mn)||(u.value=[...u.value,mn]);try{await e_(mn)}catch{}}function P(d,h){re.value={...re.value,[d]:h}}function U(d){re.value[d]&&(re.value=Wt(re.value,d))}async function j(d){if(W.has(d))return;const h=re.value[d];if(!(!h||h.fallbackRetried)){W.add(d),P(d,{...h,fallbackRetried:!0});try{await F();try{const y=await Oc(d,1);vt(d,y),Tt(d,[]),J(d),i.value[d]&&(i.value=Wt(i.value,d))}catch{}Je(d,null),Ee.value="",xe(d,null),ze(d,{label:"Thinking",details:H(mn,h.effort)}),He(d,!0),z.value[d]!==!0&&await Ni(d),await $i(d,h.text,h.imageUrls,mn,h.effort||void 0,h.skills.length>0?h.skills:void 0,h.fileAttachments),z.value={...z.value,[d]:!0},ht.add(d),Xe=!0,await st()}catch(y){const E=y instanceof Error?y.message:"Unknown application error";Je(d,E),Ee.value=E,He(d,!1),ze(d,null)}finally{W.delete(d)}}}function K(d){d&&!hu.includes(d)||(m.value=d)}function H(d,h){const y=d.trim()||"default",E=h||"default";return[`Model: ${y}`,`Thinking: ${E}`]}async function _e(){try{const[d,h]=await Promise.all([t_(),n_()]);u.value=d,f.value.length>0&&d.includes(f.value)||(h.model&&d.includes(h.model)?f.value=h.model:d.length>0?f.value=d[0]:f.value=""),h.reasoningEffort&&hu.includes(h.reasoningEffort)&&(m.value=h.reasoningEffort)}catch{}}function ue(d){const h=ee.value;return Object.keys(h).length===0?d:d.map(y=>({projectName:y.projectName,threads:y.threads.map(E=>{const Z=h[E.id];return Z?{...E,title:Z}:E})}))}function ve(){const h=ue(t.value).map(y=>({projectName:y.projectName,threads:y.threads.map(E=>{const Z=a.value[E.id]===!0,Q=n.value===E.id,ke=_.value[E.id],Me=c.value[E.id]===!0,be=!Q&&!Z&&(Me||ke!==E.updatedAtIso);return{...E,inProgress:Z,unread:be}})}));e.value=ko(e.value,h)}function Se(d,h,y){const E=new Date().toISOString(),Z=h.trim(),Q=xC(Z),ke={id:d,title:MC(y),projectName:Q,cwd:Z,hasWorktree:Z.includes("/.codex/worktrees/")||Z.includes("/.git/worktrees/"),createdAtIso:E,updatedAtIso:E,preview:y,unread:!1,inProgress:!1},Me=t.value.findIndex(it=>it.projectName===Q);if(Me>=0){const Et=t.value[Me].threads.filter(dr=>dr.id!==d),Xr={projectName:Q,threads:[ke,...Et]},Vn=[...t.value];Vn.splice(Me,1,Xr),t.value=Vn}else t.value=[{projectName:Q,threads:[ke]},...t.value];const be=bo(A.value,t.value);Fr(A.value,be)||(A.value=be,es(A.value)),ve()}function Pe(d){const h=new Set(d.map(Q=>Q.id)),y=Gt(_.value,h);y!==_.value&&(_.value=y,pu(y));const E=Gt($.value,h);E!==$.value&&($.value=E,mu(E)),O.value=Gt(O.value,h),X.value=Gt(X.value,h),z.value=Gt(z.value,h),r.value=Gt(r.value,h),s.value=Gt(s.value,h),o.value=Gt(o.value,h),i.value=Gt(i.value,h),V.value=Gt(V.value,h),fe.value=Gt(fe.value,h),ie.value=Gt(ie.value,h),ye.value=Gt(ye.value,h),c.value=Gt(c.value,h),a.value=Gt(a.value,h);const Z={};for(const[Q,ke]of Object.entries(Te.value))(Q===Ms||h.has(Q))&&(Z[Q]=ke);Te.value=Z}function Ke(d){const h=yr(t.value).find(y=>y.id===d);h&&(_.value={..._.value,[d]:h.updatedAtIso},pu(_.value),c.value[d]&&(c.value=Wt(c.value,d)),ve())}function xe(d,h){if(!d)return;const y=V.value[d];if(h){if(kC(y,h))return;V.value={...V.value,[d]:h}}else y&&(V.value=Wt(V.value,d))}function He(d,h){!d||a.value[d]===!0===h||(h?a.value={...a.value,[d]:!0}:a.value=Wt(a.value,d),ve())}function kt(d){d&&d!==n.value&&c.value[d]!==!0&&(c.value={...c.value,[d]:!0},ve())}function ze(d,h){if(!d)return;const y=fe.value[d];if(!h){y&&(fe.value=Wt(fe.value,d));return}const E=q(h.label)||"Thinking",Z=h.details.map(Me=>q(Me)).filter(Me=>Me.length>0&&Me!==E),Q=Array.from(new Set([...(y==null?void 0:y.details)??[],...Z])).slice(-3),ke={label:E,details:Q};TC(y,ke)||(fe.value={...fe.value,[d]:ke})}function Je(d,h){if(!d)return;const y=ie.value[d],E=h?Ca(h):"";if(!E){y&&(ie.value=Wt(ie.value,d));return}(y==null?void 0:y.message)!==E&&(ie.value={...ie.value,[d]:{message:E}})}function Mt(d){const h=yr(t.value).find(y=>y.id===d);return(h==null?void 0:h.updatedAtIso)??""}function Ht(d,h){if(!d)return;const y={scrollTop:Math.max(0,h.scrollTop),isAtBottom:h.isAtBottom===!0};typeof h.scrollRatio=="number"&&Number.isFinite(h.scrollRatio)&&(y.scrollRatio=Jf(h.scrollRatio,0,1));const E=$.value[d];E&&E.scrollTop===y.scrollTop&&E.isAtBottom===y.isAtBottom&&E.scrollRatio===y.scrollRatio||($.value={...$.value,[d]:y},mu($.value))}function vt(d,h){const y=r.value[d]??[];Ko(y,h)||(r.value={...r.value,[d]:h})}function Tt(d,h){const y=s.value[d]??[];Ko(y,h)||(s.value={...s.value,[d]:h})}function Ot(d,h){const y=s.value[d]??[],E=gu(y,h);Tt(d,E)}function Xt(d,h){if(!d)return;const y=h.trim(),E=o.value[d]??"";if(y.length===0){if(!E)return;o.value=Wt(o.value,d);return}E!==y&&(o.value={...o.value,[d]:y})}function G(d,h){if(!d)return;const y=o.value[d]??"";Xt(d,`${y}${h}`)}function J(d){d&&d in o.value&&(o.value=Wt(o.value,d))}function N(d){return d!==null&&typeof d=="object"&&!Array.isArray(d)?d:null}function le(d){return typeof d=="string"?d:""}function Nt(d){return typeof d=="number"&&Number.isFinite(d)?d:null}function It(d){const h=N(d.params);if(!h)return"";const y=le(h.threadId);if(y)return y;const E=le(h.thread_id);if(E)return E;const Z=le(h.conversationId);if(Z)return Z;const Q=le(h.conversation_id);if(Q)return Q;const ke=N(h.thread),Me=le(ke==null?void 0:ke.id);if(Me)return Me;const be=N(h.turn),it=le(be==null?void 0:be.threadId);if(it)return it;const Et=le(be==null?void 0:be.thread_id);return Et||""}function Vt(d){if(d.method!=="turn/completed")return"";const h=N(d.params),y=N(h==null?void 0:h.turn);if(!y||y.status!=="failed")return"";const E=N(y.error);return le(E==null?void 0:E.message)}function xt(d){var y;if(d.method!=="error")return"";const h=N(d.params);return le(h==null?void 0:h.message)||le((y=N(h==null?void 0:h.error))==null?void 0:y.message)}function Zt(d){const h=N(d);if(!h)return null;const y=h.id,E=le(h.method),Z=h.params;if(typeof y!="number"||!Number.isInteger(y)||!E)return null;const Q=N(Z),ke=le(Q==null?void 0:Q.threadId)||Ms,Me=le(Q==null?void 0:Q.turnId),be=le(Q==null?void 0:Q.itemId),it=le(h.receivedAtIso)||new Date().toISOString();return{id:y,method:E,threadId:ke,turnId:Me,itemId:be,receivedAtIso:it,params:Z??null}}function b(d){const h=d.threadId||Ms,y=Te.value[h]??[],E=y.findIndex(Q=>Q.id===d.id),Z=[...y];E>=0?Z.splice(E,1,d):Z.push(d),Te.value={...Te.value,[h]:Z.sort((Q,ke)=>Q.receivedAtIso.localeCompare(ke.receivedAtIso))}}function I(d){const h={};for(const[y,E]of Object.entries(Te.value)){const Z=E.filter(Q=>Q.id!==d);Z.length>0&&(h[y]=Z)}Te.value=h}function S(d){if(d.method==="server/request"){const h=Zt(d.params);return h&&b(h),!0}if(d.method==="server/request/resolved"){const h=N(d.params),y=h==null?void 0:h.id;return typeof y=="number"&&Number.isInteger(y)&&I(y),!0}return!1}function q(d){return d.replace(/\s+/gu," ").trim()}function ge(d){const h=It(d);if(!h)return null;if(d.method==="turn/started")return{threadId:h,activity:{label:"Thinking",details:[]}};if(d.method==="item/started"){const y=N(d.params),E=N(y==null?void 0:y.item),Z=le(E==null?void 0:E.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 Q=le(E==null?void 0:E.command);return{threadId:h,activity:{label:"Running command",details:Q?[Q]:[]}}}}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 ce(d){if(d.method!=="turn/started")return null;const h=N(d.params);if(!h)return null;const y=It(d);if(!y)return null;const E=N(h.turn),Z=le(E==null?void 0:E.id)||le(h.turnId)||`${y}:unknown`;if(!Z)return null;const Q=mr(le(E==null?void 0:E.startedAt))??mr(le(h.startedAt))??mr(d.atIso)??Date.now();return{threadId:y,turnId:Z,startedAtMs:Q}}function Re(d){if(d.method!=="turn/completed")return null;const h=N(d.params);if(!h)return null;const y=It(d);if(!y)return null;const E=N(h.turn),Z=le(E==null?void 0:E.id)||le(h.turnId)||`${y}:unknown`;if(!Z)return null;const Q=mr(le(E==null?void 0:E.completedAt))??mr(le(h.completedAt))??mr(d.atIso)??Date.now(),ke=mr(le(E==null?void 0:E.startedAt))??mr(le(h.startedAt))??void 0;return{threadId:y,turnId:Z,completedAtMs:Q,startedAtMs:ke}}function Ie(d){return`${d}:live-reasoning`}function Ve(d){const h=N(d.params);if(!h)return"";if(d.method==="item/started"){const y=N(h.item);return!y||y.type!=="reasoning"?"":le(y.id)}return""}function at(d){const h=N(d.params);if(!h)return null;if(d.method==="item/reasoning/summaryTextDelta"){const y=le(h.itemId),E=le(h.delta);return!y||!E?null:{messageId:Ie(y),delta:E}}return null}function lt(d){const h=N(d.params);if(!h)return"";if(d.method==="item/reasoning/summaryPartAdded"){const y=le(h.itemId);return y?Ie(y):""}return""}function $t(d){const h=N(d.params);if(!h)return"";if(d.method==="item/completed"){const y=N(h.item);return!y||y.type!=="reasoning"?"":Ie(le(y.id))}return""}function Dt(d){const h=N(d.params);if(!h)return"";if(d.method==="item/started"){const y=N(h.item);return!y||y.type!=="agentMessage"?"":le(y.id)}return""}function dn(d){const h=N(d.params);if(!h)return null;if(d.method==="item/agentMessage/delta"){const y=le(h.itemId),E=le(h.delta);return!y||!E?null:{messageId:y,delta:E}}return null}function jn(d){const h=N(d.params);if(!h)return null;if(d.method==="item/completed"){const y=N(h.item);if(!y||y.type!=="agentMessage")return null;const E=le(y.id),Z=le(y.text);return!E||!Z?null:{id:E,role:"assistant",text:Z,messageType:"agentMessage.live"}}return null}function ks(d){if(d.method!=="item/started")return null;const h=N(d.params),y=N(h==null?void 0:h.item);if(!y||y.type!=="commandExecution")return null;const E=le(y.id),Z=le(y.command);if(!E)return null;const Q=typeof y.cwd=="string"?y.cwd:null;return{id:E,role:"system",text:Z,messageType:"commandExecution",commandExecution:{command:Z,cwd:Q,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function Cr(d){if(d.method!=="item/commandExecution/outputDelta")return null;const h=N(d.params);if(!h)return null;const y=le(h.itemId),E=le(h.delta);return!y||!E?null:{itemId:y,delta:E}}function qr(d){if(d.method!=="item/completed")return null;const h=N(d.params),y=N(h==null?void 0:h.item);if(!y||y.type!=="commandExecution")return null;const E=le(y.id),Z=le(y.command);if(!E)return null;const Q=typeof y.cwd=="string"?y.cwd:null,ke=le(y.status),Me=ke==="failed"?"failed":ke==="declined"?"declined":ke==="interrupted"?"interrupted":"completed",be=typeof y.aggregatedOutput=="string"?y.aggregatedOutput:"",it=typeof y.exitCode=="number"?y.exitCode:null;return{id:E,role:"system",text:Z,messageType:"commandExecution",commandExecution:{command:Z,cwd:Q,status:Me,aggregatedOutput:be,exitCode:it}}}function Fn(d,h){const y=i.value[d]??[],E=gu(y,h);E!==y&&(i.value={...i.value,[d]:E})}function Kr(d,h){const y=i.value[d];if(!y||y.length===0)return;const E=new Set(h.map(Q=>Q.id)),Z=y.filter(Q=>!E.has(Q.id));Z.length!==y.length&&(Z.length===0?i.value=Wt(i.value,d):i.value={...i.value,[d]:Z})}function Jr(d){if(d.method==="item/agentMessage/delta")return!0;const h=N(d.params);if(!h)return!1;if(d.method==="item/completed"){const y=N(h.item);return(y==null?void 0:y.type)==="agentMessage"}return!1}function Bn(d){var ml,gl,vl,yl;if(S(d))return;if(d.method==="thread/name/updated"){const Ge=N(d.params),Sn=le(Ge==null?void 0:Ge.threadId),Pr=le(Ge==null?void 0:Ge.threadName);Sn&&Pr&&(ee.value={...ee.value,[Sn]:Pr},ve(),Di(Sn,Pr))}const h=ge(d);h&&ze(h.threadId,h.activity);const y=ce(d);y&&(nt.set(y.turnId,y),ye.value={...ye.value,[y.threadId]:y.turnId},xe(y.threadId,null),Je(y.threadId,null),He(y.threadId,!0),c.value[y.threadId]&&(c.value=Wt(c.value,y.threadId)));const E=Re(d),Z=Vt(d),ke=!!((E==null?void 0:E.threadId)??It(d))&&!!Z&&f.value!==mn&&_o(new Error(Z));if(E){const Ge=nt.get(E.turnId);Ge&&nt.delete(E.turnId);const Sn=Nt((ml=N(d.params))==null?void 0:ml.durationMs)??Nt((vl=N((gl=N(d.params))==null?void 0:gl.turn))==null?void 0:vl.durationMs)??(typeof E.startedAtMs=="number"?E.completedAtMs-E.startedAtMs:null)??(Ge?E.completedAtMs-Ge.startedAtMs:null),Pr=typeof Sn=="number"?Math.max(0,Sn):0;xe(E.threadId,{turnId:E.turnId,durationMs:Pr}),ye.value[E.threadId]&&(ye.value=Wt(ye.value,E.threadId)),He(E.threadId,!1),ze(E.threadId,null),kt(E.threadId),ke||(U(E.threadId),fn(E.threadId))}if(Z){const Ge=(E==null?void 0:E.threadId)||It(d);Ge&&Je(Ge,Z),Ee.value=Z,Ge&&ke&&j(Ge)}else E&&Je(E.threadId,null);const Me=xt(d);if(Me){const Ge=It(d);Ge&&Je(Ge,Me),Ee.value=Me,f.value!==mn&&_o(new Error(Me))&&(Ge?j(Ge):F())}const be=It(d);if(!be||be!==n.value)return;Dt(d);const it=dn(d);if(it){const Ge=(s.value[be]??[]).find(Pr=>Pr.id===it.messageId),Sn=`${(Ge==null?void 0:Ge.text)??""}${it.delta}`;Ot(be,{id:it.messageId,role:"assistant",text:Sn,messageType:"agentMessage.live"})}const Et=jn(d);Et&&Ot(be,Et),Ve(d);const Xr=at(d);if(Xr&&G(be,Xr.delta),lt(d)){const Ge=o.value[be]??"";Ge.trim().length>0&&!Ge.endsWith(`
|
|
1425
|
+
|
|
1426
|
+
`)&&Xt(be,`${Ge}
|
|
1427
|
+
|
|
1428
|
+
`)}$t(d);const dr=ks(d);dr&&(Fn(be,dr),ze(be,{label:"Running command",details:[((yl=dr.commandExecution)==null?void 0:yl.command)??""]}));const mi=Cr(d);if(mi){const Ge=(i.value[be]??[]).find(Sn=>Sn.id===mi.itemId);Ge!=null&&Ge.commandExecution&&Fn(be,{...Ge,commandExecution:{...Ge.commandExecution,aggregatedOutput:`${Ge.commandExecution.aggregatedOutput}${mi.delta}`}})}const pl=qr(d);if(pl&&Fn(be,pl),Jr(d)&&(qe&&n.value&&Ht(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),J(be)),d.method==="turn/completed"){qe=!1,J(be),i.value[be]&&(i.value=Wt(i.value,be));const Ge=It(d);Ge&&(He(Ge,!1),ze(Ge,null),kt(Ge),ke||(U(Ge),fn(Ge)))}}function Ts(d){const h=It(d);h&&ht.add(h);const y=d.method;(y.startsWith("thread/")||y.startsWith("turn/")||y.startsWith("item/"))&&(Xe=!0),!(Ze!==null||typeof window>"u")&&(Ze=window.setTimeout(()=>{Ze=null,st()},Wi))}async function Is(d){if(!Pt){Pt=!0;try{const h=await pa(),y=[];for(const E of h.order){const Z=qi(E);y.includes(Z)||y.push(Z)}if(y.length>0){const E=bo(y,d);Fr(A.value,E)||(A.value=E,es(A.value))}if(Object.keys(h.labels).length>0){const E={...L.value};let Z=!1;for(const[Q,ke]of Object.entries(h.labels)){const Me=qi(Q);E[Me]!==ke&&(E[Me]=ke,Z=!0)}Z&&(L.value=E,zi(E))}}catch{}}}async function Ss(){if(!(Object.keys(ee.value).length>0))try{const d=await u_();Object.keys(d.titles).length>0&&(ee.value=d.titles)}catch{}}async function Ar(d,h,y){if(ee.value[d])return;const E=h.trim();if(!E)return;const Z=E.length>300?E.slice(0,300):E;try{const Q=await d_(Z,y);if(!Q||ee.value[d])return;ee.value={...ee.value,[d]:Q},ve(),Di(d,Q)}catch{}}async function Rr(){var d;tt.value||(ne.value=!0);try{const[h]=await Promise.all([Wb(),Ss()]);await Is(h);const y=bo(A.value,h);Fr(A.value,y)||(A.value=y,es(A.value));const E=Gi(h,A.value),Z=PC(t.value,E,a.value);t.value=ko(t.value,Z),a.value=Gt(a.value,new Set(yr(t.value).map(Me=>Me.id))),ve(),tt.value=!0;const Q=yr(e.value);Pe(Q),Q.some(Me=>Me.id===n.value)||C(((d=Q[0])==null?void 0:d.id)??"")}finally{ne.value=!1}}async function k(d,h={}){if(!d)return;const y=O.value[d]===!0,E=h.silent!==!0&&!y;E&&(je.value=!0);try{z.value[d]!==!0&&(await Ni(d),z.value={...z.value,[d]:!0});const{messages:Z,inProgress:Q}=await zb(d),ke=r.value[d]??[],Me=wC(ke,Z,{preserveMissing:h.silent===!0});vt(d,Me);const be=s.value[d]??[],it=bC(be,Z);Tt(d,it),Kr(d,Z),O.value={...O.value,[d]:!0};const Et=Mt(d);Et&&(X.value={...X.value,[d]:Et}),He(d,Q),Ke(d)}finally{E&&(je.value=!1)}}async function x(){try{const d=t.value.flatMap(h=>h.threads.map(y=>y.cwd)).filter(Boolean);we.value=await f_(d.length>0?[...new Set(d)]:void 0)}catch{}}async function M(){Ee.value="";try{await Rr(),await Promise.all([_e(),x()]),await k(n.value)}catch(d){Ee.value=d instanceof Error?d.message:"Unknown application error"}}async function Y(d){C(d);try{await k(d)}catch(h){Ee.value=h instanceof Error?h.message:"Unknown application error"}}async function Be(d){try{await Jb(d),await Rr(),n.value===d&&await k(n.value)}catch(h){Ee.value=h instanceof Error?h.message:"Unknown application error"}}async function Lt(d,h){const y=h.trim();if(!(!d||!y))try{await Yb(d,y),ee.value={...ee.value,[d]:y},ve(),Di(d,y)}catch(E){Ee.value=E instanceof Error?E.message:"Unknown application error"}}async function an(d,h=[],y=[],E="steer",Z=[]){const Q=n.value,ke=d.trim();if(!Q||!ke&&h.length===0&&Z.length===0)return;const Me=a.value[Q]===!0;if(Me&&E==="queue"){const be=l.value[Q]??[],it=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;l.value={...l.value,[Q]:[...be,{id:it,text:ke,imageUrls:h,skills:y,fileAttachments:Z}]};return}if(Me){qe=!0,Hn(Q,ke,h,y,Z).catch(be=>{const it=be instanceof Error?be.message:"Unknown application error";Je(Q,it),Ee.value=it});return}Ee.value="",qe=!0,xe(Q,null),ze(Q,{label:"Thinking",details:H(f.value,m.value)}),Je(Q,null),He(Q,!0);try{await Hn(Q,ke,h,y,Z)}catch(be){qe=!1,He(Q,!1),ze(Q,null);const it=be instanceof Error?be.message:"Unknown application error";throw Je(Q,it),Ee.value=it,be}}async function Un(d,h,y=[],E=[],Z=[]){const Q=d.trim(),ke=h.trim(),Me=f.value.trim();if(!Q&&y.length===0&&Z.length===0)return"";Fe.value=!0,Ee.value="";let be="";try{try{be=await Nc(ke||void 0,Me||void 0)}catch(Vn){if(Me&&Me!==mn&&_o(Vn))await F(),be=await Nc(ke||void 0,mn);else throw Vn}if(!be)return"";Se(be,ke,Q||"[Image]"),z.value={...z.value,[be]:!0},C(be),qe=!0,xe(be,null),ze(be,{label:"Thinking",details:H(f.value,m.value)}),Je(be,null),He(be,!0);const it=be,Et=ke||null,Xr=Q;return Hn(be,Q,y,E,Z).catch(Vn=>{qe=!1,He(be,!1),ze(be,null);const dr=Vn instanceof Error?Vn.message:"Unknown application error";Je(be,dr),Ee.value=dr}).finally(()=>{Fe.value=!1}),Ar(it,Xr,Et),be}catch(it){qe=!1,be&&(He(be,!1),ze(be,null));const Et=it instanceof Error?it.message:"Unknown application error";throw be&&Je(be,Et),Ee.value=Et,Fe.value=!1,it}}async function Hn(d,h,y=[],E=[],Z=[]){const Q=f.value.trim(),ke=m.value,Me=h.trim(),be=E.map(Et=>({name:Et.name,path:Et.path})),it=Z.map(Et=>({...Et}));P(d,{text:Me,imageUrls:[...y],skills:be,fileAttachments:it,effort:ke,fallbackRetried:!1});try{z.value[d]!==!0&&await Ni(d);try{await $i(d,h,y,Q||void 0,ke||void 0,E.length>0?E:void 0,Z)}catch(Et){if(Q&&Q!==mn&&_o(Et))await F(),P(d,{text:Me,imageUrls:[...y],skills:be,fileAttachments:it,effort:ke,fallbackRetried:!0}),await $i(d,h,y,mn,ke||void 0,E.length>0?E:void 0,Z);else throw Et}z.value={...z.value,[d]:!0},ht.add(d),Xe=!0,await st()}catch(Et){throw Et}}async function fn(d){const h=l.value[d];if(!h||h.length===0)return;const[y,...E]=h;l.value=E.length>0?{...l.value,[d]:E}:Wt(l.value,d),Fe.value=!0,Ee.value="",qe=!0,xe(d,null),ze(d,{label:"Thinking",details:H(f.value,m.value)}),Je(d,null),He(d,!0);try{await Hn(d,y.text,y.imageUrls,y.skills,y.fileAttachments)}catch{He(d,!1),ze(d,null)}finally{Fe.value=!1}}async function ur(){const d=n.value;if(!d||a.value[d]!==!0)return;const h=ye.value[d];et.value=!0,Ee.value="";try{await Zb(d,h),He(d,!1),ze(d,null),Je(d,null),ye.value[d]&&(ye.value=Wt(ye.value,d)),ht.add(d),Xe=!0,await st()}catch(y){const E=y instanceof Error?y.message:"Failed to interrupt active turn";Je(d,E),Ee.value=E}finally{et.value=!1}}async function Yr(d){const h=n.value;if(!h||De.value)return;const E=(r.value[h]??[]).reduce((Q,ke)=>typeof ke.turnIndex=="number"&&ke.turnIndex>Q?ke.turnIndex:Q,-1);if(E<0||d>E)return;const Z=E-d+1;if(!(Z<1)){De.value=!0,Ee.value="";try{const Q=await Oc(h,Z);vt(h,Q),Tt(h,[]),J(h),i.value[h]&&(i.value=Wt(i.value,h)),xe(h,null),ze(h,null),Je(h,null),Xe=!0,await st()}catch(Q){Ee.value=Q instanceof Error?Q.message:"Failed to rollback thread"}finally{De.value=!1}}}function Qr(d,h){d.length===0||(L.value[d]??"")===h||(L.value={...L.value,[d]:h},zi(L.value))}function pi(d){var Z;if(d.length===0)return;const h=A.value.filter(Q=>Q!==d);if(Fr(A.value,h)||(A.value=h,es(A.value)),t.value=t.value.filter(Q=>Q.projectName!==d),L.value[d]!==void 0){const Q={...L.value};delete Q[d],L.value=Q,zi(Q)}ve();const y=yr(e.value);Pe(y),y.some(Q=>Q.id===n.value)||C(((Z=y[0])==null?void 0:Z.id)??""),Ce()}function R(d,h){if(d.length===0||t.value.length===0)return;const y=t.value.map(be=>be.projectName),E=y.indexOf(d);if(E===-1)return;const Z=Math.max(0,Math.min(h,y.length-1)),Q=vC(y,E,Z);if(Q===y)return;const ke=bo(Q,t.value);A.value=ke,es(A.value);const Me=Gi(t.value,A.value);t.value=ko(t.value,Me),ve(),Ce()}function te(d){const h=d.trim();if(!h)return;const y=[h,...A.value.filter(Z=>Z!==h)];if(Fr(A.value,y))return;A.value=y,es(A.value);const E=Gi(t.value,A.value);t.value=ko(t.value,E),ve(),Ce()}async function Ce(){var d,h;try{const y=await pa(),E=new Map;for(const ke of y.order){const Me=qi(ke);E.has(Me)||E.set(Me,ke)}for(const ke of t.value){const Me=((h=(d=ke.threads[0])==null?void 0:d.cwd)==null?void 0:h.trim())??"";Me&&E.set(ke.projectName,Me)}const Z=[];for(const ke of A.value){const Me=E.get(ke);Me&&!Z.includes(Me)&&Z.push(Me)}for(const ke of y.order)Z.includes(ke)||Z.push(ke);const Q=y.active.filter(ke=>Z.includes(ke));Q.length===0&&Z.length>0&&Q.push(Z[0]),await o_({order:Z,labels:y.labels,active:Q})}catch{}}async function st(){if(Oe.value){typeof window<"u"&&Ze===null&&(Ze=window.setTimeout(()=>{Ze=null,st()},Wi));return}Oe.value=!0;const d=Xe,h=new Set(ht);Xe=!1,ht.clear();try{d&&await Rr();const y=n.value;if(!y)return;const E=h.has(y),Z=a.value[y]===!0,Q=Mt(y),ke=X.value[y]??"",Me=Q.length>0&&Q!==ke;(E||Z||Me||d)&&await k(y,{silent:!0})}catch{}finally{Oe.value=!1,(Xe||ht.size>0)&&typeof window<"u"&&Ze===null&&(Ze=window.setTimeout(()=>{Ze=null,st()},Wi))}}function yt(){typeof window>"u"||Qe||(Ye(),Qe=Gb(d=>{Bn(d),Ts(d)}))}async function Ye(){try{const d=await Kb();for(const h of d){const y=Zt(h);y&&b(y)}}catch{}}async function Bt(d){try{await qb(d.id,{result:d.result,error:d.error}),I(d.id)}catch(h){Ee.value=h instanceof Error?h.message:"Failed to reply to server request"}}function ho(){Qe&&(Qe(),Qe=null),Xe=!1,ht.clear(),nt.clear(),Ze!==null&&typeof window<"u"&&(window.clearTimeout(Ze),Ze=null),qe=!1,r.value={},s.value={},o.value={},i.value={},fe.value={},V.value={},ie.value={},ye.value={},l.value={}}const Es=he(()=>{const d=n.value;return d?l.value[d]??[]:[]});function hl(d){const h=n.value;if(!h)return;const y=l.value[h];if(!y)return;const E=y.filter(Z=>Z.id!==d);l.value=E.length>0?{...l.value,[h]:E}:Wt(l.value,h)}function Qf(d){const h=n.value;if(!h)return;const y=l.value[h];if(!y)return;const E=y.find(Z=>Z.id===d);E&&(hl(d),an(E.text,E.imageUrls,E.skills,"steer",E.fileAttachments))}return{projectGroups:e,projectDisplayNameById:L,selectedThread:ae,selectedThreadScrollState:pe,selectedThreadServerRequests:Ne,selectedLiveOverlay:g,selectedThreadId:n,availableModelIds:u,selectedModelId:f,selectedReasoningEffort:m,installedSkills:we,messages:v,isLoadingThreads:ne,isLoadingMessages:je,isSendingMessage:Fe,isInterruptingTurn:et,error:Ee,refreshAll:M,refreshSkills:x,selectThread:Y,setThreadScrollState:Ht,archiveThreadById:Be,renameThreadById:Lt,sendMessageToSelectedThread:an,sendMessageToNewThread:Un,interruptSelectedThreadTurn:ur,rollbackSelectedThread:Yr,isRollingBack:De,selectedThreadQueuedMessages:Es,removeQueuedMessage:hl,steerQueuedMessage:Qf,setSelectedModelId:B,setSelectedReasoningEffort:K,respondToPendingServerRequest:Bt,renameProject:Qr,removeProject:pi,reorderProject:R,pinProjectToTop:te,startPolling:yt,stopPolling:ho}}const NC={class:"sidebar-root"},$C={class:"sidebar-scrollable"},DC=["aria-pressed"],LC={key:1,class:"sidebar-search-bar"},jC={key:0,class:"sidebar-settings-area"},FC={key:0,class:"sidebar-settings-panel"},BC={class:"sidebar-settings-value"},UC={class:"sidebar-settings-value"},HC={class:"content-root"},VC={class:"content-body"},WC={key:1,class:"content-grid"},zC={class:"new-thread-empty"},GC={class:"worktree-init-status-title"},qC={class:"worktree-init-status-message"},KC={key:2,class:"content-grid"},JC={class:"content-thread"},YC={class:"composer-with-queue"},QC={class:"build-badge","aria-label":"Worktree name and version"},vu="codex-web-local.sidebar-collapsed.v1",yu="codex-web-local.send-with-enter.v1",wu="codex-web-local.in-progress-send-mode.v1",bu="codex-web-local.dark-mode.v1",XC=Ut({__name:"App",setup(e){const t="b757",n="0.1.38",{projectGroups:r,projectDisplayNameById:s,selectedThread:o,selectedThreadScrollState:i,selectedThreadServerRequests:a,selectedLiveOverlay:l,selectedThreadId:c,availableModelIds:u,selectedModelId:f,selectedReasoningEffort:m,installedSkills:_,messages:$,isLoadingThreads:A,isLoadingMessages:L,isInterruptingTurn:X,refreshAll:O,refreshSkills:z,selectThread:V,setThreadScrollState:fe,archiveThreadById:ie,renameThreadById:ye,sendMessageToSelectedThread:Te,sendMessageToNewThread:re,interruptSelectedThreadTurn:ee,rollbackSelectedThread:we,isRollingBack:ne,selectedThreadQueuedMessages:je,removeQueuedMessage:Fe,steerQueuedMessage:et,setSelectedModelId:De,setSelectedReasoningEffort:Ee,respondToPendingServerRequest:Oe,renameProject:tt,removeProject:Qe,reorderProject:Ze,pinProjectToTop:Xe,startPolling:ht,stopPolling:Pt}=OC(),qe=Ng(),nt=Og(),{isMobile:W}=Jd(),me=D(!1),ae=D(!1),pe=D(""),Ne=D("local"),g=D({order:[],labels:{}}),v=D({phase:"idle",title:"",message:""}),C=D(Hn()),B=D(""),F=D(!1),P=D(null),U=D(null);let j=null;const K=D("New Project (1)"),H=D(""),_e=D(!1),ue=D(x(yu,!0)),ve=D(Y()),Se=D(M()),Pe=he(()=>{const R=qe.params.threadId;return typeof R=="string"?R:""}),Ke=he(()=>{const R=new Set;for(const te of r.value)for(const Ce of te.threads)R.add(Ce.id);return R}),xe=he(()=>qe.name==="home"),He=he(()=>qe.name==="skills"),kt=he(()=>{var R;return He.value?"Skills":xe.value?"New thread":((R=o.value)==null?void 0:R.title)??"Choose a thread"}),ze=he(()=>$.value.filter(R=>{const te=ur(R.messageType,R.role);return te==="worked"?!0:!(te==="turnActivity.live"||te==="turnError.live"||te==="agentReasoning.live")})),Je=he(()=>l.value),Mt=he(()=>xe.value?"__new-thread__":c.value),Ht=he(()=>{var R,te;return xe.value?pe.value.trim():((te=(R=o.value)==null?void 0:R.cwd)==null?void 0:te.trim())??""}),vt=he(()=>{var R;return!xe.value&&((R=o.value)==null?void 0:R.inProgress)===!0}),Tt=he(()=>{var st,yt;const R=[],te=new Set;for(const Ye of g.value.order){const Bt=Ye.trim();!Bt||te.has(Bt)||(te.add(Bt),R.push({value:Bt,label:g.value.labels[Bt]||Fn(Bt)}))}for(const Ye of r.value){const Bt=((yt=(st=Ye.threads[0])==null?void 0:st.cwd)==null?void 0:yt.trim())??"";!Bt||te.has(Bt)||(te.add(Bt),R.push({value:Bt,label:s.value[Ye.projectName]??Ye.projectName}))}const Ce=pe.value.trim();return Ce&&!te.has(Ce)&&R.unshift({value:Ce,label:Fn(Ce)}),R}),Ot=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;lr(()=>{window.addEventListener("keydown",Ie),Un(),Ot==null||Ot.addEventListener("change",Un),Yr(),ks(),Cr(),dn()}),si(()=>{window.removeEventListener("keydown",Ie),Ot==null||Ot.removeEventListener("change",Un),j&&(clearTimeout(j),j=null),Pt()}),mt(B,R=>{const te=R.trim();if(j&&(clearTimeout(j),j=null),!te){U.value=null;return}j=setTimeout(()=>{c_(te,1e3).then(Ce=>{B.value.trim()===te&&(U.value=Ce.threadIds)}).catch(()=>{B.value.trim()===te&&(U.value=null)})},220)});function Xt(){z()}function G(){F.value=!F.value,F.value?cn(()=>{var R;return(R=P.value)==null?void 0:R.focus()}):B.value=""}function J(){var R;B.value="",(R=P.value)==null||R.focus()}function N(R){R.key==="Escape"&&(F.value=!1,B.value="")}function le(R){R&&(qe.name==="thread"&&Pe.value===R||(nt.push({name:"thread",params:{threadId:R}}),W.value&&Re(!0)))}async function Nt(R){R&&(c.value!==R&&(await V(R),await nt.push({name:"thread",params:{threadId:R}})),await cn(),Ss())}function It(R){ie(R)}function Vt(R){var st,yt;const te=r.value.find(Ye=>Ye.projectName===R),Ce=((yt=(st=te==null?void 0:te.threads[0])==null?void 0:st.cwd)==null?void 0:yt.trim())??"";Ce&&(pe.value=Ce),W.value&&Re(!0),!xe.value&&nt.push({name:"home"})}function xt(R){var st,yt;const te=r.value.find(Ye=>Ye.projectName===R),Ce=((yt=(st=te==null?void 0:te.threads[0])==null?void 0:st.cwd)==null?void 0:yt.trim())??"";!Ce||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(Ce)}`,"_blank","noopener,noreferrer")}function Zt(){var te,Ce;const R=((Ce=(te=o.value)==null?void 0:te.cwd)==null?void 0:Ce.trim())??"";R&&(pe.value=R),W.value&&Re(!0),!xe.value&&nt.push({name:"home"})}function b(R){tt(R.projectName,R.displayName)}function I(R){ye(R.threadId,R.title)}function S(R){Qe(R)}function q(R){Ze(R.projectName,R.toIndex)}function ge(R){fe(R.threadId,R.state)}function ce(R){Oe(R)}function Re(R){C.value!==R&&(C.value=R,fn(R))}function Ie(R){R.defaultPrevented||!R.ctrlKey&&!R.metaKey||R.shiftKey||R.altKey||R.key.toLowerCase()==="b"&&(R.preventDefault(),Re(!C.value))}function Ve(R){const te=R.text;if(xe.value){pi(te,R.imageUrls,R.skills,R.fileAttachments);return}Te(te,R.imageUrls,R.skills,R.mode,R.fileAttachments)}function at(R){pe.value=R.trim()}async function lt(R){const te=R.trim();if(!te)return;const Ce=Dt(te),st=await $t(),yt=Ce?te:Kr(st,te);if(yt)try{const Ye=await i_(yt,{createIfMissing:!Ce,label:Ce?"":te});Ye&&(pe.value=Ye,Xe(Fn(Ye)),Cr(),dn())}catch{}}async function $t(){const R=jn();if(R)return R;try{const te=await $c();if(te)return H.value=te,te}catch{}return""}function Dt(R){return R?R.startsWith("~/")||R.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(R):!1}async function dn(){const R=jn();if(!R){K.value="New Project (1)";return}try{const te=await a_(R);K.value=te.name||"New Project (1)"}catch{K.value="New Project (1)"}}function jn(){var Ce,st;const R=pe.value.trim();if(R)return qr(R);const te=((st=(Ce=Tt.value[0])==null?void 0:Ce.value)==null?void 0:st.trim())??"";return te?qr(te):H.value.trim()}async function ks(){try{H.value=await $c()}catch{H.value=""}}async function Cr(){try{const R=await pa();g.value={order:[...R.order],labels:{...R.labels}}}catch{g.value={order:[],labels:{}}}}function qr(R){const te=R.trim().replace(/\/+$/,"");if(!te)return"";const Ce=te.lastIndexOf("/");return Ce<=0?"":te.slice(0,Ce)}function Fn(R){const te=R.trim().replace(/\/+$/,"");if(!te)return"";const Ce=te.lastIndexOf("/");return Ce<0?te:te.slice(Ce+1)}function Kr(R,te){const Ce=R.trim().replace(/\/+$/,""),st=te.trim().replace(/^\/+/,"");return!Ce||!st?"":`${Ce}/${st}`}function Jr(R){De(R)}function Bn(R){Ee(R)}function Ts(){ee()}function Is(R){we(R.turnIndex)}function Ss(){if(xe.value||He.value||typeof document>"u"||!o.value||ze.value.length===0)return;const R=Ar(),te=Rr(),Ce=new Blob([R],{type:"text/markdown;charset=utf-8"}),st=URL.createObjectURL(Ce),yt=document.createElement("a");yt.href=st,yt.download=te,document.body.appendChild(yt),yt.click(),document.body.removeChild(yt),window.setTimeout(()=>URL.revokeObjectURL(st),0)}function Ar(){var Ce,st,yt;const R=[],te=((st=(Ce=o.value)==null?void 0:Ce.title)==null?void 0:st.trim())||"Untitled thread";R.push(`# ${k(te)}`),R.push(""),R.push(`- Exported: ${new Date().toISOString()}`),R.push(`- Thread ID: ${((yt=o.value)==null?void 0:yt.id)??""}`),R.push(""),R.push("---"),R.push("");for(const Ye of ze.value){const Bt=Ye.role?Ye.role.toUpperCase():"MESSAGE";R.push(`## ${Bt}`),R.push("");const ho=Ye.text.trim();if(ho&&(R.push(ho),R.push("")),Ye.commandExecution&&(R.push("```text"),R.push(`command: ${Ye.commandExecution.command}`),R.push(`status: ${Ye.commandExecution.status}`),Ye.commandExecution.cwd&&R.push(`cwd: ${Ye.commandExecution.cwd}`),Ye.commandExecution.exitCode!==null&&R.push(`exitCode: ${Ye.commandExecution.exitCode}`),R.push(Ye.commandExecution.aggregatedOutput||"(no output)"),R.push("```"),R.push("")),Ye.fileAttachments&&Ye.fileAttachments.length>0){R.push("Attachments:");for(const Es of Ye.fileAttachments)R.push(`- ${Es.path}`);R.push("")}if(Ye.images&&Ye.images.length>0){R.push("Images:");for(const Es of Ye.images)R.push(`- ${Es}`);R.push("")}}return`${R.join(`
|
|
1429
|
+
`).trimEnd()}
|
|
1430
|
+
`}function Rr(){var yt,Ye;const Ce=(((Ye=(yt=o.value)==null?void 0:yt.title)==null?void 0:Ye.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",st=new Date().toISOString().replace(/[:.]/g,"-");return`${Ce}-${st}.md`}function k(R){return R.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function x(R,te){if(typeof window>"u")return te;const Ce=window.localStorage.getItem(R);return Ce===null?te:Ce==="1"}function M(){if(typeof window>"u")return"system";const R=window.localStorage.getItem(bu);return R==="light"||R==="dark"?R:"system"}function Y(){return typeof window>"u"?"queue":window.localStorage.getItem(wu)==="steer"?"steer":"queue"}function Be(){ue.value=!ue.value,window.localStorage.setItem(yu,ue.value?"1":"0")}function Lt(){ve.value=ve.value==="steer"?"queue":"steer",window.localStorage.setItem(wu,ve.value)}function an(){const R=["system","light","dark"],te=R.indexOf(Se.value);Se.value=R[(te+1)%R.length],window.localStorage.setItem(bu,Se.value),Un()}function Un(){const R=document.documentElement;if(Se.value==="dark")R.classList.add("dark");else if(Se.value==="light")R.classList.remove("dark");else{const te=window.matchMedia("(prefers-color-scheme: dark)").matches;R.classList.toggle("dark",te)}}function Hn(){return typeof window>"u"?!1:window.localStorage.getItem(vu)==="1"}function fn(R){typeof window>"u"||window.localStorage.setItem(vu,R?"1":"0")}function ur(R,te){const Ce=(R??"").trim();return Ce.length>0?Ce:te.trim()||"message"}async function Yr(){await O(),ae.value=!0,await Qr(),ht()}async function Qr(){if(!me.value){me.value=!0;try{if(qe.name==="home"||qe.name==="skills"){c.value!==""&&await V("");return}if(qe.name==="thread"){const R=Pe.value;if(!R)return;if(!Ke.value.has(R)){await nt.replace({name:"home"});return}c.value!==R&&await V(R);return}}finally{me.value=!1}}}mt(()=>[qe.name,Pe.value,A.value,Ke.value.has(Pe.value),c.value],async()=>{ae.value&&await Qr()}),mt(()=>c.value,async R=>{if(ae.value&&!me.value&&!(xe.value||He.value)){if(!R){qe.name!=="home"&&await nt.replace({name:"home"});return}qe.name==="thread"&&Pe.value===R||await nt.replace({name:"thread",params:{threadId:R}})}}),mt(()=>Tt.value,R=>{if(R.length===0){pe.value="";return}R.some(Ce=>Ce.value===pe.value)||(pe.value=R[0].value),dn()},{immediate:!0}),mt(()=>pe.value,()=>{v.value={phase:"idle",title:"",message:""},dn()}),mt(()=>Ne.value,R=>{R==="local"&&(v.value={phase:"idle",title:"",message:""})}),mt(()=>qe.name,R=>{R!=="home"&&(v.value={phase:"idle",title:"",message:""})}),mt(()=>c.value,()=>{v.value={phase:"idle",title:"",message:""}}),mt(W,R=>{R&&!C.value&&Re(!0)});async function pi(R,te=[],Ce=[],st=[]){try{v.value={phase:"idle",title:"",message:""};let yt=pe.value;if(Ne.value==="worktree"){v.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const Bt=await s_(pe.value);yt=Bt.cwd,pe.value=Bt.cwd,v.value={phase:"idle",title:"",message:""}}catch{v.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const Ye=await re(R,yt,te,Ce,st);if(!Ye)return;await nt.replace({name:"thread",params:{threadId:Ye}})}catch{}}return(R,te)=>(w(),T(Le,null,[Ae(Bg,{"is-sidebar-collapsed":C.value,onCloseSidebar:te[6]||(te[6]=Ce=>Re(!0))},{sidebar:pt(()=>[p("section",NC,[p("div",$C,[C.value?oe("",!0):(w(),wt(fu,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":C.value,"show-new-thread-button":!0,onToggleSidebar:te[0]||(te[0]=Ce=>Re(!C.value)),onStartNewThread:Zt},{default:pt(()=>[p("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":F.value,"aria-label":"Search threads",title:"Search threads",onClick:G},[Ae(ga,{class:"sidebar-search-toggle-icon"})],8,DC)]),_:1},8,["is-sidebar-collapsed"])),!C.value&&F.value?(w(),T("div",LC,[Ae(ga,{class:"sidebar-search-bar-icon"}),rr(p("input",{ref_key:"sidebarSearchInputRef",ref:P,"onUpdate:modelValue":te[1]||(te[1]=Ce=>B.value=Ce),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:N},null,544),[[sr,B.value]]),B.value.length>0?(w(),T("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:J},[Ae(Qa,{class:"sidebar-search-clear-icon"})])):oe("",!0)])):oe("",!0),C.value?oe("",!0):(w(),T("button",{key:2,class:gt(["sidebar-skills-link",{"is-active":He.value}]),type:"button",onClick:te[2]||(te[2]=Ce=>{de(nt).push({name:"skills"}),de(W)&&Re(!0)})}," Skills Hub ",2)),C.value?oe("",!0):(w(),wt(Ry,{key:3,groups:de(r),"project-display-name-by-id":de(s),"selected-thread-id":de(c),"is-loading":de(A),"search-query":B.value,"search-matched-thread-ids":U.value,onSelect:le,onArchive:It,onStartNewThread:Vt,onRenameProject:b,onBrowseProjectFiles:xt,onRenameThread:I,onRemoveProject:S,onReorderProject:q,onExportThread:Nt},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),C.value?oe("",!0):(w(),T("div",jC,[Ae(Dd,{name:"settings-panel"},{default:pt(()=>[_e.value?(w(),T("div",FC,[p("button",{class:"sidebar-settings-row",type:"button",onClick:Be},[te[7]||(te[7]=p("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),p("span",{class:gt(["sidebar-settings-toggle",{"is-on":!ue.value}])},null,2)]),p("button",{class:"sidebar-settings-row",type:"button",onClick:Lt},[te[8]||(te[8]=p("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),p("span",BC,se(ve.value==="steer"?"Steer":"Queue"),1)]),p("button",{class:"sidebar-settings-row",type:"button",onClick:an},[te[9]||(te[9]=p("span",{class:"sidebar-settings-label"},"Appearance",-1)),p("span",UC,se(Se.value==="system"?"System":Se.value==="dark"?"Dark":"Light"),1)])])):oe("",!0)]),_:1}),p("button",{class:"sidebar-settings-button",type:"button",onClick:te[3]||(te[3]=Ce=>_e.value=!_e.value)},[Ae(cC,{class:"sidebar-settings-icon"}),te[10]||(te[10]=p("span",null,"Settings",-1))])]))])]),content:pt(()=>[p("section",HC,[Ae($y,{title:kt.value},{leading:pt(()=>[C.value||de(W)?(w(),wt(fu,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":C.value,"show-new-thread-button":!0,onToggleSidebar:te[4]||(te[4]=Ce=>Re(!C.value)),onStartNewThread:Zt},null,8,["is-sidebar-collapsed"])):oe("",!0)]),_:1},8,["title"]),p("section",VC,[He.value?(w(),wt(KE,{key:0,onSkillsChanged:Xt})):xe.value?(w(),T("div",WC,[p("div",zC,[te[11]||(te[11]=p("p",{class:"new-thread-hero"},"Let's build",-1)),Ae(ma,{class:"new-thread-folder-dropdown","model-value":pe.value,options:Tt.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":K.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":at,onAdd:lt},null,8,["model-value","options","default-add-value"]),Ae(e0,{class:"new-thread-runtime-dropdown",modelValue:Ne.value,"onUpdate:modelValue":te[5]||(te[5]=Ce=>Ne.value=Ce)},null,8,["modelValue"]),v.value.phase!=="idle"?(w(),T("div",{key:0,class:gt(["worktree-init-status",{"is-running":v.value.phase==="running","is-error":v.value.phase==="error"}])},[p("strong",GC,se(v.value.title),1),p("span",qC,se(v.value.message),1)],2)):oe("",!0)]),Ae(Lc,{"active-thread-id":Mt.value,cwd:Ht.value,models:de(u),"selected-model":de(f),"selected-reasoning-effort":de(m),skills:de(_),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":ue.value,"in-progress-submit-mode":ve.value,onSubmit:Ve,"onUpdate:selectedModel":Jr,"onUpdate:selectedReasoningEffort":Bn},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","skills","send-with-enter","in-progress-submit-mode"])])):(w(),T("div",KC,[p("div",JC,[Ae(wb,{messages:ze.value,"is-loading":de(L),"active-thread-id":Mt.value,cwd:Ht.value,"scroll-state":de(i),"live-overlay":Je.value,"pending-requests":de(a),"is-turn-in-progress":vt.value,"is-rolling-back":de(ne),onUpdateScrollState:ge,onRespondServerRequest:ce,onRollback:Is},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests","is-turn-in-progress","is-rolling-back"])]),p("div",YC,[Ae(Gk,{messages:de(je),onSteer:de(et),onDelete:de(Fe)},null,8,["messages","onSteer","onDelete"]),Ae(Lc,{"active-thread-id":Mt.value,cwd:Ht.value,models:de(u),"selected-model":de(f),"selected-reasoning-effort":de(m),skills:de(_),"is-turn-in-progress":vt.value,"is-interrupting-turn":de(X),"has-queue-above":de(je).length>0,"send-with-enter":ue.value,"in-progress-submit-mode":ve.value,onSubmit:Ve,"onUpdate:selectedModel":Jr,"onUpdate:selectedReasoningEffort":Bn,onInterrupt:Ts},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","skills","is-turn-in-progress","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode"])])]))])])]),_:1},8,["is-sidebar-collapsed"]),p("div",QC," WT "+se(de(t))+" · v"+se(de(n)),1)],64))}}),ZC=ot(XC,[["__scopeId","data-v-f2b7f06b"]]),Ki={render:()=>null},eA=Mg({history:ug(),routes:[{path:"/",name:"home",component:Ki},{path:"/thread/:threadId",name:"thread",component:Ki},{path:"/skills",name:"skills",component:Ki},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexapp. GitHub: https://github.com/friuns2/codexui");Tm(ZC).use(eA).mount("#app");
|