@iebh/tera-fy 2.3.9 → 2.3.10
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/CHANGELOG.md +7 -0
- package/dist/lib/syncro/entities.d.ts +3 -3
- package/dist/lib/syncro/entities.js +42 -38
- package/dist/lib/syncro/entities.js.map +1 -1
- package/dist/lib/syncro/keyed (Rhino's conflicted copy 2026-05-10).js +287 -0
- package/dist/lib/syncro/keyed.js (Rhino's conflicted copy 2026-05-10).map +1 -0
- package/dist/lib/syncro/syncro (Rhino's conflicted copy 2026-05-10).js +765 -0
- package/dist/lib/syncro/syncro.d (Rhino's conflicted copy 2026-05-10).ts +336 -0
- package/dist/lib/syncro/syncro.js (Rhino's conflicted copy 2026-05-10).map +1 -0
- package/dist/plugin.vue2.es2019 (Rhino's conflicted copy 2026-05-10).js +1271 -0
- package/lib/syncro/entities.ts +51 -47
- package/package.json +1 -1
|
@@ -0,0 +1,1271 @@
|
|
|
1
|
+
var cv=Object.defineProperty;var lv=(r,e,t)=>e in r?cv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var se=(r,e,t)=>lv(r,typeof e!="symbol"?e+"":e,t);var hv=typeof global=="object"&&global&&global.Object===Object&&global,eo=hv;var dv=typeof self=="object"&&self&&self.Object===Object&&self,fv=eo||dv||Function("return this")(),de=fv;var pv=de.Symbol,Me=pv;var Ud=Object.prototype,mv=Ud.hasOwnProperty,gv=Ud.toString,Ns=Me?Me.toStringTag:void 0;function yv(r){var e=mv.call(r,Ns),t=r[Ns];try{r[Ns]=void 0;var n=!0}catch{}var s=gv.call(r);return n&&(e?r[Ns]=t:delete r[Ns]),s}var Bd=yv;var _v=Object.prototype,wv=_v.toString;function vv(r){return wv.call(r)}var $d=vv;var bv="[object Null]",Ev="[object Undefined]",qd=Me?Me.toStringTag:void 0;function Tv(r){return r==null?r===void 0?Ev:bv:qd&&qd in Object(r)?Bd(r):$d(r)}var Xe=Tv;function Iv(r){return r!=null&&typeof r=="object"}var je=Iv;var Av="[object Symbol]";function Sv(r){return typeof r=="symbol"||je(r)&&Xe(r)==Av}var Qt=Sv;function xv(r,e){for(var t=-1,n=r==null?0:r.length,s=Array(n);++t<n;)s[t]=e(r[t],t,r);return s}var zd=xv;var Rv=Array.isArray,ge=Rv;var Pv=1/0,Kd=Me?Me.prototype:void 0,Gd=Kd?Kd.toString:void 0;function Wd(r){if(typeof r=="string")return r;if(ge(r))return zd(r,Wd)+"";if(Qt(r))return Gd?Gd.call(r):"";var e=r+"";return e=="0"&&1/r==-Pv?"-0":e}var Hd=Wd;var Cv=/\s/;function kv(r){for(var e=r.length;e--&&Cv.test(r.charAt(e)););return e}var Jd=kv;var Ov=/^\s+/;function Dv(r){return r&&r.slice(0,Jd(r)+1).replace(Ov,"")}var Qd=Dv;function Nv(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var ee=Nv;var Yd=NaN,Vv=/^[-+]0x[0-9a-f]+$/i,Lv=/^0b[01]+$/i,Fv=/^0o[0-7]+$/i,Mv=parseInt;function jv(r){if(typeof r=="number")return r;if(Qt(r))return Yd;if(ee(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=ee(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=Qd(r);var t=Lv.test(r);return t||Fv.test(r)?Mv(r.slice(2),t?2:8):Vv.test(r)?Yd:+r}var xu=jv;function Uv(r){return r}var cn=Uv;var Bv="[object AsyncFunction]",$v="[object Function]",qv="[object GeneratorFunction]",zv="[object Proxy]";function Kv(r){if(!ee(r))return!1;var e=Xe(r);return e==$v||e==qv||e==Bv||e==zv}var to=Kv;var Gv=de["__core-js_shared__"],ro=Gv;var Xd=(function(){var r=/[^.]+$/.exec(ro&&ro.keys&&ro.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function Wv(r){return!!Xd&&Xd in r}var Zd=Wv;var Hv=Function.prototype,Jv=Hv.toString;function Qv(r){if(r!=null){try{return Jv.call(r)}catch{}try{return r+""}catch{}}return""}var Tt=Qv;var Yv=/[\\^$.*+?()[\]{}|]/g,Xv=/^\[object .+?Constructor\]$/,Zv=Function.prototype,eb=Object.prototype,tb=Zv.toString,rb=eb.hasOwnProperty,nb=RegExp("^"+tb.call(rb).replace(Yv,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function sb(r){if(!ee(r)||Zd(r))return!1;var e=to(r)?nb:Xv;return e.test(Tt(r))}var ef=sb;function ib(r,e){return r==null?void 0:r[e]}var tf=ib;function ob(r,e){var t=tf(r,e);return ef(t)?t:void 0}var Be=ob;var ab=Be(de,"WeakMap"),no=ab;var rf=Object.create,ub=(function(){function r(){}return function(e){if(!ee(e))return{};if(rf)return rf(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}})(),nf=ub;function cb(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}var sf=cb;function lb(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}var of=lb;var hb=800,db=16,fb=Date.now;function pb(r){var e=0,t=0;return function(){var n=fb(),s=db-(n-t);if(t=n,s>0){if(++e>=hb)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var af=pb;function mb(r){return function(){return r}}var uf=mb;var gb=(function(){try{var r=Be(Object,"defineProperty");return r({},"",{}),r}catch{}})(),ln=gb;var yb=ln?function(r,e){return ln(r,"toString",{configurable:!0,enumerable:!1,value:uf(e),writable:!0})}:cn,cf=yb;var _b=af(cf),lf=_b;function wb(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var hf=wb;var vb=9007199254740991,bb=/^(?:0|[1-9]\d*)$/;function Eb(r,e){var t=typeof r;return e=e==null?vb:e,!!e&&(t=="number"||t!="symbol"&&bb.test(r))&&r>-1&&r%1==0&&r<e}var Yt=Eb;function Tb(r,e,t){e=="__proto__"&&ln?ln(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var hn=Tb;function Ib(r,e){return r===e||r!==r&&e!==e}var at=Ib;var Ab=Object.prototype,Sb=Ab.hasOwnProperty;function xb(r,e,t){var n=r[e];(!(Sb.call(r,e)&&at(n,t))||t===void 0&&!(e in r))&&hn(r,e,t)}var dn=xb;function Rb(r,e,t,n){var s=!t;t||(t={});for(var i=-1,o=e.length;++i<o;){var u=e[i],c=n?n(t[u],r[u],u,t,r):void 0;c===void 0&&(c=r[u]),s?hn(t,u,c):dn(t,u,c)}return t}var Xt=Rb;var df=Math.max;function Pb(r,e,t){return e=df(e===void 0?r.length-1:e,0),function(){for(var n=arguments,s=-1,i=df(n.length-e,0),o=Array(i);++s<i;)o[s]=n[e+s];s=-1;for(var u=Array(e+1);++s<e;)u[s]=n[s];return u[e]=t(o),sf(r,this,u)}}var ff=Pb;function Cb(r,e){return lf(ff(r,e,cn),r+"")}var pf=Cb;var kb=9007199254740991;function Ob(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=kb}var fn=Ob;function Db(r){return r!=null&&fn(r.length)&&!to(r)}var Zt=Db;function Nb(r,e,t){if(!ee(t))return!1;var n=typeof e;return(n=="number"?Zt(t)&&Yt(e,t.length):n=="string"&&e in t)?at(t[e],r):!1}var mf=Nb;var Vb=Object.prototype;function Lb(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Vb;return r===t}var er=Lb;function Fb(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var gf=Fb;var Mb="[object Arguments]";function jb(r){return je(r)&&Xe(r)==Mb}var Ru=jb;var yf=Object.prototype,Ub=yf.hasOwnProperty,Bb=yf.propertyIsEnumerable,$b=Ru((function(){return arguments})())?Ru:function(r){return je(r)&&Ub.call(r,"callee")&&!Bb.call(r,"callee")},pn=$b;function qb(){return!1}var _f=qb;var bf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,wf=bf&&typeof module=="object"&&module&&!module.nodeType&&module,zb=wf&&wf.exports===bf,vf=zb?de.Buffer:void 0,Kb=vf?vf.isBuffer:void 0,Gb=Kb||_f,It=Gb;var Wb="[object Arguments]",Hb="[object Array]",Jb="[object Boolean]",Qb="[object Date]",Yb="[object Error]",Xb="[object Function]",Zb="[object Map]",eE="[object Number]",tE="[object Object]",rE="[object RegExp]",nE="[object Set]",sE="[object String]",iE="[object WeakMap]",oE="[object ArrayBuffer]",aE="[object DataView]",uE="[object Float32Array]",cE="[object Float64Array]",lE="[object Int8Array]",hE="[object Int16Array]",dE="[object Int32Array]",fE="[object Uint8Array]",pE="[object Uint8ClampedArray]",mE="[object Uint16Array]",gE="[object Uint32Array]",ue={};ue[uE]=ue[cE]=ue[lE]=ue[hE]=ue[dE]=ue[fE]=ue[pE]=ue[mE]=ue[gE]=!0;ue[Wb]=ue[Hb]=ue[oE]=ue[Jb]=ue[aE]=ue[Qb]=ue[Yb]=ue[Xb]=ue[Zb]=ue[eE]=ue[tE]=ue[rE]=ue[nE]=ue[sE]=ue[iE]=!1;function yE(r){return je(r)&&fn(r.length)&&!!ue[Xe(r)]}var Ef=yE;function _E(r){return function(e){return r(e)}}var mn=_E;var Tf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Vs=Tf&&typeof module=="object"&&module&&!module.nodeType&&module,wE=Vs&&Vs.exports===Tf,Pu=wE&&eo.process,vE=(function(){try{var r=Vs&&Vs.require&&Vs.require("util").types;return r||Pu&&Pu.binding&&Pu.binding("util")}catch{}})(),At=vE;var If=At&&At.isTypedArray,bE=If?mn(If):Ef,gn=bE;var EE=Object.prototype,TE=EE.hasOwnProperty;function IE(r,e){var t=ge(r),n=!t&&pn(r),s=!t&&!n&&It(r),i=!t&&!n&&!s&&gn(r),o=t||n||s||i,u=o?gf(r.length,String):[],c=u.length;for(var l in r)(e||TE.call(r,l))&&!(o&&(l=="length"||s&&(l=="offset"||l=="parent")||i&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Yt(l,c)))&&u.push(l);return u}var so=IE;function AE(r,e){return function(t){return r(e(t))}}var io=AE;var SE=io(Object.keys,Object),Af=SE;var xE=Object.prototype,RE=xE.hasOwnProperty;function PE(r){if(!er(r))return Af(r);var e=[];for(var t in Object(r))RE.call(r,t)&&t!="constructor"&&e.push(t);return e}var oo=PE;function CE(r){return Zt(r)?so(r):oo(r)}var Ne=CE;function kE(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var Sf=kE;var OE=Object.prototype,DE=OE.hasOwnProperty;function NE(r){if(!ee(r))return Sf(r);var e=er(r),t=[];for(var n in r)n=="constructor"&&(e||!DE.call(r,n))||t.push(n);return t}var xf=NE;function VE(r){return Zt(r)?so(r,!0):xf(r)}var tr=VE;var LE=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,FE=/^\w*$/;function ME(r,e){if(ge(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||Qt(r)?!0:FE.test(r)||!LE.test(r)||e!=null&&r in Object(e)}var yn=ME;var jE=Be(Object,"create"),St=jE;function UE(){this.__data__=St?St(null):{},this.size=0}var Rf=UE;function BE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Pf=BE;var $E="__lodash_hash_undefined__",qE=Object.prototype,zE=qE.hasOwnProperty;function KE(r){var e=this.__data__;if(St){var t=e[r];return t===$E?void 0:t}return zE.call(e,r)?e[r]:void 0}var Cf=KE;var GE=Object.prototype,WE=GE.hasOwnProperty;function HE(r){var e=this.__data__;return St?e[r]!==void 0:WE.call(e,r)}var kf=HE;var JE="__lodash_hash_undefined__";function QE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=St&&e===void 0?JE:e,this}var Of=QE;function _n(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}_n.prototype.clear=Rf;_n.prototype.delete=Pf;_n.prototype.get=Cf;_n.prototype.has=kf;_n.prototype.set=Of;var Cu=_n;function YE(){this.__data__=[],this.size=0}var Df=YE;function XE(r,e){for(var t=r.length;t--;)if(at(r[t][0],e))return t;return-1}var rr=XE;var ZE=Array.prototype,eT=ZE.splice;function tT(r){var e=this.__data__,t=rr(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():eT.call(e,t,1),--this.size,!0}var Nf=tT;function rT(r){var e=this.__data__,t=rr(e,r);return t<0?void 0:e[t][1]}var Vf=rT;function nT(r){return rr(this.__data__,r)>-1}var Lf=nT;function sT(r,e){var t=this.__data__,n=rr(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var Ff=sT;function wn(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}wn.prototype.clear=Df;wn.prototype.delete=Nf;wn.prototype.get=Vf;wn.prototype.has=Lf;wn.prototype.set=Ff;var nr=wn;var iT=Be(de,"Map"),sr=iT;function oT(){this.size=0,this.__data__={hash:new Cu,map:new(sr||nr),string:new Cu}}var Mf=oT;function aT(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var jf=aT;function uT(r,e){var t=r.__data__;return jf(e)?t[typeof e=="string"?"string":"hash"]:t.map}var ir=uT;function cT(r){var e=ir(this,r).delete(r);return this.size-=e?1:0,e}var Uf=cT;function lT(r){return ir(this,r).get(r)}var Bf=lT;function hT(r){return ir(this,r).has(r)}var $f=hT;function dT(r,e){var t=ir(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var qf=dT;function vn(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}vn.prototype.clear=Mf;vn.prototype.delete=Uf;vn.prototype.get=Bf;vn.prototype.has=$f;vn.prototype.set=qf;var Ir=vn;var fT="Expected a function";function ku(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(fT);var t=function(){var n=arguments,s=e?e.apply(this,n):n[0],i=t.cache;if(i.has(s))return i.get(s);var o=r.apply(this,n);return t.cache=i.set(s,o)||i,o};return t.cache=new(ku.Cache||Ir),t}ku.Cache=Ir;var zf=ku;var pT=500;function mT(r){var e=zf(r,function(n){return t.size===pT&&t.clear(),n}),t=e.cache;return e}var Kf=mT;var gT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yT=/\\(\\)?/g,_T=Kf(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(gT,function(t,n,s,i){e.push(s?i.replace(yT,"$1"):n||t)}),e}),Gf=_T;function wT(r){return r==null?"":Hd(r)}var Wf=wT;function vT(r,e){return ge(r)?r:yn(r,e)?[r]:Gf(Wf(r))}var bn=vT;var bT=1/0;function ET(r){if(typeof r=="string"||Qt(r))return r;var e=r+"";return e=="0"&&1/r==-bT?"-0":e}var ut=ET;function TT(r,e){e=bn(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[ut(e[t++])];return t&&t==n?r:void 0}var ao=TT;function IT(r,e,t){var n=r==null?void 0:ao(r,e);return n===void 0?t:n}var Ls=IT;function AT(r,e){for(var t=-1,n=e.length,s=r.length;++t<n;)r[s+t]=e[t];return r}var uo=AT;var ST=io(Object.getPrototypeOf,Object),co=ST;function xT(){this.__data__=new nr,this.size=0}var Hf=xT;function RT(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var Jf=RT;function PT(r){return this.__data__.get(r)}var Qf=PT;function CT(r){return this.__data__.has(r)}var Yf=CT;var kT=200;function OT(r,e){var t=this.__data__;if(t instanceof nr){var n=t.__data__;if(!sr||n.length<kT-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Ir(n)}return t.set(r,e),this.size=t.size,this}var Xf=OT;function En(r){var e=this.__data__=new nr(r);this.size=e.size}En.prototype.clear=Hf;En.prototype.delete=Jf;En.prototype.get=Qf;En.prototype.has=Yf;En.prototype.set=Xf;var or=En;function DT(r,e){return r&&Xt(e,Ne(e),r)}var Zf=DT;function NT(r,e){return r&&Xt(e,tr(e),r)}var ep=NT;var sp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,tp=sp&&typeof module=="object"&&module&&!module.nodeType&&module,VT=tp&&tp.exports===sp,rp=VT?de.Buffer:void 0,np=rp?rp.allocUnsafe:void 0;function LT(r,e){if(e)return r.slice();var t=r.length,n=np?np(t):new r.constructor(t);return r.copy(n),n}var ip=LT;function FT(r,e){for(var t=-1,n=r==null?0:r.length,s=0,i=[];++t<n;){var o=r[t];e(o,t,r)&&(i[s++]=o)}return i}var op=FT;function MT(){return[]}var lo=MT;var jT=Object.prototype,UT=jT.propertyIsEnumerable,ap=Object.getOwnPropertySymbols,BT=ap?function(r){return r==null?[]:(r=Object(r),op(ap(r),function(e){return UT.call(r,e)}))}:lo,Tn=BT;function $T(r,e){return Xt(r,Tn(r),e)}var up=$T;var qT=Object.getOwnPropertySymbols,zT=qT?function(r){for(var e=[];r;)uo(e,Tn(r)),r=co(r);return e}:lo,ho=zT;function KT(r,e){return Xt(r,ho(r),e)}var cp=KT;function GT(r,e,t){var n=e(r);return ge(r)?n:uo(n,t(r))}var fo=GT;function WT(r){return fo(r,Ne,Tn)}var Fs=WT;function HT(r){return fo(r,tr,ho)}var lp=HT;var JT=Be(de,"DataView"),po=JT;var QT=Be(de,"Promise"),mo=QT;var YT=Be(de,"Set"),go=YT;var hp="[object Map]",XT="[object Object]",dp="[object Promise]",fp="[object Set]",pp="[object WeakMap]",mp="[object DataView]",ZT=Tt(po),e0=Tt(sr),t0=Tt(mo),r0=Tt(go),n0=Tt(no),Ar=Xe;(po&&Ar(new po(new ArrayBuffer(1)))!=mp||sr&&Ar(new sr)!=hp||mo&&Ar(mo.resolve())!=dp||go&&Ar(new go)!=fp||no&&Ar(new no)!=pp)&&(Ar=function(r){var e=Xe(r),t=e==XT?r.constructor:void 0,n=t?Tt(t):"";if(n)switch(n){case ZT:return mp;case e0:return hp;case t0:return dp;case r0:return fp;case n0:return pp}return e});var Ze=Ar;var s0=Object.prototype,i0=s0.hasOwnProperty;function o0(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&i0.call(r,"index")&&(t.index=r.index,t.input=r.input),t}var gp=o0;var a0=de.Uint8Array,In=a0;function u0(r){var e=new r.constructor(r.byteLength);return new In(e).set(new In(r)),e}var An=u0;function c0(r,e){var t=e?An(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}var yp=c0;var l0=/\w*$/;function h0(r){var e=new r.constructor(r.source,l0.exec(r));return e.lastIndex=r.lastIndex,e}var _p=h0;var wp=Me?Me.prototype:void 0,vp=wp?wp.valueOf:void 0;function d0(r){return vp?Object(vp.call(r)):{}}var bp=d0;function f0(r,e){var t=e?An(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}var Ep=f0;var p0="[object Boolean]",m0="[object Date]",g0="[object Map]",y0="[object Number]",_0="[object RegExp]",w0="[object Set]",v0="[object String]",b0="[object Symbol]",E0="[object ArrayBuffer]",T0="[object DataView]",I0="[object Float32Array]",A0="[object Float64Array]",S0="[object Int8Array]",x0="[object Int16Array]",R0="[object Int32Array]",P0="[object Uint8Array]",C0="[object Uint8ClampedArray]",k0="[object Uint16Array]",O0="[object Uint32Array]";function D0(r,e,t){var n=r.constructor;switch(e){case E0:return An(r);case p0:case m0:return new n(+r);case T0:return yp(r,t);case I0:case A0:case S0:case x0:case R0:case P0:case C0:case k0:case O0:return Ep(r,t);case g0:return new n;case y0:case v0:return new n(r);case _0:return _p(r);case w0:return new n;case b0:return bp(r)}}var Tp=D0;function N0(r){return typeof r.constructor=="function"&&!er(r)?nf(co(r)):{}}var Ip=N0;var V0="[object Map]";function L0(r){return je(r)&&Ze(r)==V0}var Ap=L0;var Sp=At&&At.isMap,F0=Sp?mn(Sp):Ap,xp=F0;var M0="[object Set]";function j0(r){return je(r)&&Ze(r)==M0}var Rp=j0;var Pp=At&&At.isSet,U0=Pp?mn(Pp):Rp,Cp=U0;var B0=1,$0=2,q0=4,kp="[object Arguments]",z0="[object Array]",K0="[object Boolean]",G0="[object Date]",W0="[object Error]",Op="[object Function]",H0="[object GeneratorFunction]",J0="[object Map]",Q0="[object Number]",Dp="[object Object]",Y0="[object RegExp]",X0="[object Set]",Z0="[object String]",eI="[object Symbol]",tI="[object WeakMap]",rI="[object ArrayBuffer]",nI="[object DataView]",sI="[object Float32Array]",iI="[object Float64Array]",oI="[object Int8Array]",aI="[object Int16Array]",uI="[object Int32Array]",cI="[object Uint8Array]",lI="[object Uint8ClampedArray]",hI="[object Uint16Array]",dI="[object Uint32Array]",ie={};ie[kp]=ie[z0]=ie[rI]=ie[nI]=ie[K0]=ie[G0]=ie[sI]=ie[iI]=ie[oI]=ie[aI]=ie[uI]=ie[J0]=ie[Q0]=ie[Dp]=ie[Y0]=ie[X0]=ie[Z0]=ie[eI]=ie[cI]=ie[lI]=ie[hI]=ie[dI]=!0;ie[W0]=ie[Op]=ie[tI]=!1;function yo(r,e,t,n,s,i){var o,u=e&B0,c=e&$0,l=e&q0;if(t&&(o=s?t(r,n,s,i):t(r)),o!==void 0)return o;if(!ee(r))return r;var f=ge(r);if(f){if(o=gp(r),!u)return of(r,o)}else{var p=Ze(r),m=p==Op||p==H0;if(It(r))return ip(r,u);if(p==Dp||p==kp||m&&!s){if(o=c||m?{}:Ip(r),!u)return c?cp(r,ep(o,r)):up(r,Zf(o,r))}else{if(!ie[p])return s?r:{};o=Tp(r,p,u)}}i||(i=new or);var y=i.get(r);if(y)return y;i.set(r,o),Cp(r)?r.forEach(function(I){o.add(yo(I,e,t,I,r,i))}):xp(r)&&r.forEach(function(I,k){o.set(k,yo(I,e,t,k,r,i))});var T=l?c?lp:Fs:c?tr:Ne,x=f?void 0:T(r);return hf(x||r,function(I,k){x&&(k=I,I=r[k]),dn(o,k,yo(I,e,t,k,r,i))}),o}var Np=yo;var fI=1,pI=4;function mI(r){return Np(r,fI|pI)}var ar=mI;var gI="__lodash_hash_undefined__";function yI(r){return this.__data__.set(r,gI),this}var Vp=yI;function _I(r){return this.__data__.has(r)}var Lp=_I;function _o(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Ir;++e<t;)this.add(r[e])}_o.prototype.add=_o.prototype.push=Vp;_o.prototype.has=Lp;var Fp=_o;function wI(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(e(r[t],t,r))return!0;return!1}var Mp=wI;function vI(r,e){return r.has(e)}var jp=vI;var bI=1,EI=2;function TI(r,e,t,n,s,i){var o=t&bI,u=r.length,c=e.length;if(u!=c&&!(o&&c>u))return!1;var l=i.get(r),f=i.get(e);if(l&&f)return l==e&&f==r;var p=-1,m=!0,y=t&EI?new Fp:void 0;for(i.set(r,e),i.set(e,r);++p<u;){var T=r[p],x=e[p];if(n)var I=o?n(x,T,p,e,r,i):n(T,x,p,r,e,i);if(I!==void 0){if(I)continue;m=!1;break}if(y){if(!Mp(e,function(k,O){if(!jp(y,O)&&(T===k||s(T,k,t,n,i)))return y.push(O)})){m=!1;break}}else if(!(T===x||s(T,x,t,n,i))){m=!1;break}}return i.delete(r),i.delete(e),m}var wo=TI;function II(r){var e=-1,t=Array(r.size);return r.forEach(function(n,s){t[++e]=[s,n]}),t}var Up=II;function AI(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var Bp=AI;var SI=1,xI=2,RI="[object Boolean]",PI="[object Date]",CI="[object Error]",kI="[object Map]",OI="[object Number]",DI="[object RegExp]",NI="[object Set]",VI="[object String]",LI="[object Symbol]",FI="[object ArrayBuffer]",MI="[object DataView]",$p=Me?Me.prototype:void 0,Ou=$p?$p.valueOf:void 0;function jI(r,e,t,n,s,i,o){switch(t){case MI:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case FI:return!(r.byteLength!=e.byteLength||!i(new In(r),new In(e)));case RI:case PI:case OI:return at(+r,+e);case CI:return r.name==e.name&&r.message==e.message;case DI:case VI:return r==e+"";case kI:var u=Up;case NI:var c=n&SI;if(u||(u=Bp),r.size!=e.size&&!c)return!1;var l=o.get(r);if(l)return l==e;n|=xI,o.set(r,e);var f=wo(u(r),u(e),n,s,i,o);return o.delete(r),f;case LI:if(Ou)return Ou.call(r)==Ou.call(e)}return!1}var qp=jI;var UI=1,BI=Object.prototype,$I=BI.hasOwnProperty;function qI(r,e,t,n,s,i){var o=t&UI,u=Fs(r),c=u.length,l=Fs(e),f=l.length;if(c!=f&&!o)return!1;for(var p=c;p--;){var m=u[p];if(!(o?m in e:$I.call(e,m)))return!1}var y=i.get(r),T=i.get(e);if(y&&T)return y==e&&T==r;var x=!0;i.set(r,e),i.set(e,r);for(var I=o;++p<c;){m=u[p];var k=r[m],O=e[m];if(n)var D=o?n(O,k,m,e,r,i):n(k,O,m,r,e,i);if(!(D===void 0?k===O||s(k,O,t,n,i):D)){x=!1;break}I||(I=m=="constructor")}if(x&&!I){var M=r.constructor,B=e.constructor;M!=B&&"constructor"in r&&"constructor"in e&&!(typeof M=="function"&&M instanceof M&&typeof B=="function"&&B instanceof B)&&(x=!1)}return i.delete(r),i.delete(e),x}var zp=qI;var zI=1,Kp="[object Arguments]",Gp="[object Array]",vo="[object Object]",KI=Object.prototype,Wp=KI.hasOwnProperty;function GI(r,e,t,n,s,i){var o=ge(r),u=ge(e),c=o?Gp:Ze(r),l=u?Gp:Ze(e);c=c==Kp?vo:c,l=l==Kp?vo:l;var f=c==vo,p=l==vo,m=c==l;if(m&&It(r)){if(!It(e))return!1;o=!0,f=!1}if(m&&!f)return i||(i=new or),o||gn(r)?wo(r,e,t,n,s,i):qp(r,e,c,t,n,s,i);if(!(t&zI)){var y=f&&Wp.call(r,"__wrapped__"),T=p&&Wp.call(e,"__wrapped__");if(y||T){var x=y?r.value():r,I=T?e.value():e;return i||(i=new or),s(x,I,t,n,i)}}return m?(i||(i=new or),zp(r,e,t,n,s,i)):!1}var Hp=GI;function Jp(r,e,t,n,s){return r===e?!0:r==null||e==null||!je(r)&&!je(e)?r!==r&&e!==e:Hp(r,e,t,n,Jp,s)}var Sn=Jp;var WI=1,HI=2;function JI(r,e,t,n){var s=t.length,i=s,o=!n;if(r==null)return!i;for(r=Object(r);s--;){var u=t[s];if(o&&u[2]?u[1]!==r[u[0]]:!(u[0]in r))return!1}for(;++s<i;){u=t[s];var c=u[0],l=r[c],f=u[1];if(o&&u[2]){if(l===void 0&&!(c in r))return!1}else{var p=new or;if(n)var m=n(l,f,c,r,e,p);if(!(m===void 0?Sn(f,l,WI|HI,n,p):m))return!1}}return!0}var Qp=JI;function QI(r){return r===r&&!ee(r)}var bo=QI;function YI(r){for(var e=Ne(r),t=e.length;t--;){var n=e[t],s=r[n];e[t]=[n,s,bo(s)]}return e}var Yp=YI;function XI(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var Eo=XI;function ZI(r){var e=Yp(r);return e.length==1&&e[0][2]?Eo(e[0][0],e[0][1]):function(t){return t===r||Qp(t,r,e)}}var Xp=ZI;function eA(r,e){return r!=null&&e in Object(r)}var Zp=eA;function tA(r,e,t){e=bn(e,r);for(var n=-1,s=e.length,i=!1;++n<s;){var o=ut(e[n]);if(!(i=r!=null&&t(r,o)))break;r=r[o]}return i||++n!=s?i:(s=r==null?0:r.length,!!s&&fn(s)&&Yt(o,s)&&(ge(r)||pn(r)))}var em=tA;function rA(r,e){return r!=null&&em(r,e,Zp)}var tm=rA;var nA=1,sA=2;function iA(r,e){return yn(r)&&bo(e)?Eo(ut(r),e):function(t){var n=Ls(t,r);return n===void 0&&n===e?tm(t,r):Sn(e,n,nA|sA)}}var rm=iA;function oA(r){return function(e){return e==null?void 0:e[r]}}var nm=oA;function aA(r){return function(e){return ao(e,r)}}var sm=aA;function uA(r){return yn(r)?nm(ut(r)):sm(r)}var im=uA;function cA(r){return typeof r=="function"?r:r==null?cn:typeof r=="object"?ge(r)?rm(r[0],r[1]):Xp(r):im(r)}var om=cA;function lA(r){return function(e,t,n){for(var s=-1,i=Object(e),o=n(e),u=o.length;u--;){var c=o[r?u:++s];if(t(i[c],c,i)===!1)break}return e}}var am=lA;var hA=am(),um=hA;function dA(r,e){return r&&um(r,e,Ne)}var cm=dA;var fA=function(){return de.Date.now()},To=fA;var pA="Expected a function",mA=Math.max,gA=Math.min;function yA(r,e,t){var n,s,i,o,u,c,l=0,f=!1,p=!1,m=!0;if(typeof r!="function")throw new TypeError(pA);e=xu(e)||0,ee(t)&&(f=!!t.leading,p="maxWait"in t,i=p?mA(xu(t.maxWait)||0,e):i,m="trailing"in t?!!t.trailing:m);function y(F){var w=n,_=s;return n=s=void 0,l=F,o=r.apply(_,w),o}function T(F){return l=F,u=setTimeout(k,e),f?y(F):o}function x(F){var w=F-c,_=F-l,b=e-w;return p?gA(b,i-_):b}function I(F){var w=F-c,_=F-l;return c===void 0||w>=e||w<0||p&&_>=i}function k(){var F=To();if(I(F))return O(F);u=setTimeout(k,x(F))}function O(F){return u=void 0,m&&n?y(F):(n=s=void 0,o)}function D(){u!==void 0&&clearTimeout(u),l=0,n=c=s=u=void 0}function M(){return u===void 0?o:O(To())}function B(){var F=To(),w=I(F);if(n=arguments,s=this,c=F,w){if(u===void 0)return T(c);if(p)return clearTimeout(u),u=setTimeout(k,e),y(c)}return u===void 0&&(u=setTimeout(k,e)),o}return B.cancel=D,B.flush=M,B}var lm=yA;var hm=Object.prototype,_A=hm.hasOwnProperty,wA=pf(function(r,e){r=Object(r);var t=-1,n=e.length,s=n>2?e[2]:void 0;for(s&&mf(e[0],e[1],s)&&(n=1);++t<n;)for(var i=e[t],o=tr(i),u=-1,c=o.length;++u<c;){var l=o[u],f=r[l];(f===void 0||at(f,hm[l])&&!_A.call(r,l))&&(r[l]=i[l])}return r}),Io=wA;var vA="[object Map]",bA="[object Set]",EA=Object.prototype,TA=EA.hasOwnProperty;function IA(r){if(r==null)return!0;if(Zt(r)&&(ge(r)||typeof r=="string"||typeof r.splice=="function"||It(r)||gn(r)||pn(r)))return!r.length;var e=Ze(r);if(e==vA||e==bA)return!r.size;if(er(r))return!oo(r).length;for(var t in r)if(TA.call(r,t))return!1;return!0}var Ao=IA;function AA(r,e){return Sn(r,e)}var Ms=AA;function SA(r,e){var t={};return e=om(e,3),cm(r,function(n,s,i){hn(t,e(n,s,i),n)}),t}var Du=SA;function xA(r,e,t,n){if(!ee(r))return r;e=bn(e,r);for(var s=-1,i=e.length,o=i-1,u=r;u!=null&&++s<i;){var c=ut(e[s]),l=t;if(c==="__proto__"||c==="constructor"||c==="prototype")return r;if(s!=o){var f=u[c];l=n?n(f,c,u):void 0,l===void 0&&(l=ee(f)?f:Yt(e[s+1])?[]:{})}dn(u,c,l),u=u[c]}return r}var dm=xA;function RA(r,e,t){return r==null?r:dm(r,e,t)}var ur=RA;var PA="Expected a function";function CA(r,e,t){var n=!0,s=!0;if(typeof r!="function")throw new TypeError(PA);return ee(t)&&(n="leading"in t?!!t.leading:n,s="trailing"in t?!!t.trailing:s),lm(r,e,{leading:n,maxWait:e,trailing:s})}var Nu=CA;var fm=()=>{};var mm=function(r){let e=[],t=0;for(let n=0;n<r.length;n++){let s=r.charCodeAt(n);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&n+1<r.length&&(r.charCodeAt(n+1)&64512)===56320?(s=65536+((s&1023)<<10)+(r.charCodeAt(++n)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},kA=function(r){let e=[],t=0,n=0;for(;t<r.length;){let s=r[t++];if(s<128)e[n++]=String.fromCharCode(s);else if(s>191&&s<224){let i=r[t++];e[n++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){let i=r[t++],o=r[t++],u=r[t++],c=((s&7)<<18|(i&63)<<12|(o&63)<<6|u&63)-65536;e[n++]=String.fromCharCode(55296+(c>>10)),e[n++]=String.fromCharCode(56320+(c&1023))}else{let i=r[t++],o=r[t++];e[n++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},gm={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(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();let t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let s=0;s<r.length;s+=3){let i=r[s],o=s+1<r.length,u=o?r[s+1]:0,c=s+2<r.length,l=c?r[s+2]:0,f=i>>2,p=(i&3)<<4|u>>4,m=(u&15)<<2|l>>6,y=l&63;c||(y=64,o||(m=64)),n.push(t[f],t[p],t[m],t[y])}return n.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(mm(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):kA(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let t=e?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let s=0;s<r.length;){let i=t[r.charAt(s++)],u=s<r.length?t[r.charAt(s)]:0;++s;let l=s<r.length?t[r.charAt(s)]:64;++s;let p=s<r.length?t[r.charAt(s)]:64;if(++s,i==null||u==null||l==null||p==null)throw new Vu;let m=i<<2|u>>4;if(n.push(m),l!==64){let y=u<<4&240|l>>2;if(n.push(y),p!==64){let T=l<<6&192|p;n.push(T)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r<this.ENCODED_VALS.length;r++)this.byteToCharMap_[r]=this.ENCODED_VALS.charAt(r),this.charToByteMap_[this.byteToCharMap_[r]]=r,this.byteToCharMapWebSafe_[r]=this.ENCODED_VALS_WEBSAFE.charAt(r),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[r]]=r,r>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}},Vu=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},OA=function(r){let e=mm(r);return gm.encodeByteArray(e,!0)},js=function(r){return OA(r).replace(/\./g,"")},ym=function(r){try{return gm.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function _m(){if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;throw new Error("Unable to locate global object.")}var DA=()=>_m().__FIREBASE_DEFAULTS__,NA=()=>{if(typeof process=="undefined"||typeof process.env=="undefined")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},VA=()=>{if(typeof document=="undefined")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&ym(r[1]);return e&&JSON.parse(e)},Lu=()=>{try{return fm()||DA()||NA()||VA()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},LA=r=>{var e,t;return(t=(e=Lu())==null?void 0:e.emulatorHosts)==null?void 0:t[r]},wm=r=>{let e=LA(r);if(!e)return;let t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);let n=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),n]:[e.substring(0,t),n]},Fu=()=>{var r;return(r=Lu())==null?void 0:r.config};var So=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,n))}}};function vm(r,e){if(r.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let t={alg:"none",type:"JWT"},n=e||"demo-project",s=r.iat||0,i=r.sub||r.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");let o={iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...r};return[js(JSON.stringify(t)),js(JSON.stringify(o)),""].join(".")}function bm(){return typeof navigator!="undefined"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function FA(){var e;let r=(e=Lu())==null?void 0:e.forceEnvironment;if(r==="node")return!0;if(r==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function Em(){return!FA()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Mu(){try{return typeof indexedDB=="object"}catch{return!1}}function Tm(){return new Promise((r,e)=>{try{let t=!0,n="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(n);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(n),r(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{var i;e(((i=s.error)==null?void 0:i.message)||"")}}catch(t){e(t)}})}var MA="FirebaseError",et=class r extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name=MA,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Us.prototype.create)}},Us=class{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){let n=t[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?jA(i,n):"Error",u=`${this.serviceName}: ${o} (${s}).`;return new et(s,u,n)}};function jA(r,e){return r.replace(UA,(t,n)=>{let s=e[n];return s!=null?String(s):`<${n}?>`})}var UA=/\{\$([^}]+)}/g;function Sr(r,e){if(r===e)return!0;let t=Object.keys(r),n=Object.keys(e);for(let s of t){if(!n.includes(s))return!1;let i=r[s],o=e[s];if(pm(i)&&pm(o)){if(!Sr(i,o))return!1}else if(i!==o)return!1}for(let s of n)if(!t.includes(s))return!1;return!0}function pm(r){return r!==null&&typeof r=="object"}var qM=14400*1e3;function ct(r){return r&&r._delegate?r._delegate:r}function ju(r){try{return(r.startsWith("http://")||r.startsWith("https://")?new URL(r).hostname:r).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Im(r){return(await fetch(r,{credentials:"include"})).ok}var xt=class{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var xr="[DEFAULT]";var Uu=class{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let n=new So;if(this.instancesDeferred.set(t,n),this.isInitialized(t)||this.shouldAutoInitialize())try{let s=this.getOrInitializeService({instanceIdentifier:t});s&&n.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var s;let t=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),n=(s=e==null?void 0:e.optional)!=null?s:!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(i){if(n)return null;throw i}else{if(n)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if($A(e))try{this.getOrInitializeService({instanceIdentifier:xr})}catch{}for(let[t,n]of this.instancesDeferred.entries()){let s=this.normalizeInstanceIdentifier(t);try{let i=this.getOrInitializeService({instanceIdentifier:s});n.resolve(i)}catch{}}}}clearInstance(e=xr){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=xr){return this.instances.has(e)}getOptions(e=xr){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let s=this.getOrInitializeService({instanceIdentifier:n,options:t});for(let[i,o]of this.instancesDeferred.entries()){let u=this.normalizeInstanceIdentifier(i);n===u&&o.resolve(s)}return s}onInit(e,t){var o;let n=this.normalizeInstanceIdentifier(t),s=(o=this.onInitCallbacks.get(n))!=null?o:new Set;s.add(e),this.onInitCallbacks.set(n,s);let i=this.instances.get(n);return i&&e(i,n),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){let n=this.onInitCallbacks.get(t);if(n)for(let s of n)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:BA(e),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch{}return n||null}normalizeInstanceIdentifier(e=xr){return this.component?this.component.multipleInstances?e:xr:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function BA(r){return r===xr?void 0:r}function $A(r){return r.instantiationMode==="EAGER"}var xo=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new Uu(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}};var qA=[],X;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(X||(X={}));var zA={debug:X.DEBUG,verbose:X.VERBOSE,info:X.INFO,warn:X.WARN,error:X.ERROR,silent:X.SILENT},KA=X.INFO,GA={[X.DEBUG]:"log",[X.VERBOSE]:"log",[X.INFO]:"info",[X.WARN]:"warn",[X.ERROR]:"error"},WA=(r,e,...t)=>{if(e<r.logLevel)return;let n=new Date().toISOString(),s=GA[e];if(s)console[s](`[${n}] ${r.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},xn=class{constructor(e){this.name=e,this._logLevel=KA,this._logHandler=WA,this._userLogHandler=null,qA.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in X))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?zA[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,X.DEBUG,...e),this._logHandler(this,X.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,X.VERBOSE,...e),this._logHandler(this,X.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,X.INFO,...e),this._logHandler(this,X.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,X.WARN,...e),this._logHandler(this,X.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,X.ERROR,...e),this._logHandler(this,X.ERROR,...e)}};var HA=(r,e)=>e.some(t=>r instanceof t),Am,Sm;function JA(){return Am||(Am=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function QA(){return Sm||(Sm=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var xm=new WeakMap,$u=new WeakMap,Rm=new WeakMap,Bu=new WeakMap,zu=new WeakMap;function YA(r){let e=new Promise((t,n)=>{let s=()=>{r.removeEventListener("success",i),r.removeEventListener("error",o)},i=()=>{t(lt(r.result)),s()},o=()=>{n(r.error),s()};r.addEventListener("success",i),r.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&xm.set(t,r)}).catch(()=>{}),zu.set(e,r),e}function XA(r){if($u.has(r))return;let e=new Promise((t,n)=>{let s=()=>{r.removeEventListener("complete",i),r.removeEventListener("error",o),r.removeEventListener("abort",o)},i=()=>{t(),s()},o=()=>{n(r.error||new DOMException("AbortError","AbortError")),s()};r.addEventListener("complete",i),r.addEventListener("error",o),r.addEventListener("abort",o)});$u.set(r,e)}var qu={get(r,e,t){if(r instanceof IDBTransaction){if(e==="done")return $u.get(r);if(e==="objectStoreNames")return r.objectStoreNames||Rm.get(r);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return lt(r[e])},set(r,e,t){return r[e]=t,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Pm(r){qu=r(qu)}function ZA(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let n=r.call(Ro(this),e,...t);return Rm.set(n,e.sort?e.sort():[e]),lt(n)}:QA().includes(r)?function(...e){return r.apply(Ro(this),e),lt(xm.get(this))}:function(...e){return lt(r.apply(Ro(this),e))}}function eS(r){return typeof r=="function"?ZA(r):(r instanceof IDBTransaction&&XA(r),HA(r,JA())?new Proxy(r,qu):r)}function lt(r){if(r instanceof IDBRequest)return YA(r);if(Bu.has(r))return Bu.get(r);let e=eS(r);return e!==r&&(Bu.set(r,e),zu.set(e,r)),e}var Ro=r=>zu.get(r);function km(r,e,{blocked:t,upgrade:n,blocking:s,terminated:i}={}){let o=indexedDB.open(r,e),u=lt(o);return n&&o.addEventListener("upgradeneeded",c=>{n(lt(o.result),c.oldVersion,c.newVersion,lt(o.transaction),c)}),t&&o.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),u.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",l=>s(l.oldVersion,l.newVersion,l))}).catch(()=>{}),u}var tS=["get","getKey","getAll","getAllKeys","count"],rS=["put","add","delete","clear"],Ku=new Map;function Cm(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(Ku.get(e))return Ku.get(e);let t=e.replace(/FromIndex$/,""),n=e!==t,s=rS.includes(t);if(!(t in(n?IDBIndex:IDBObjectStore).prototype)||!(s||tS.includes(t)))return;let i=async function(o,...u){let c=this.transaction(o,s?"readwrite":"readonly"),l=c.store;return n&&(l=l.index(u.shift())),(await Promise.all([l[t](...u),s&&c.done]))[0]};return Ku.set(e,i),i}Pm(r=>({...r,get:(e,t,n)=>Cm(e,t)||r.get(e,t,n),has:(e,t)=>!!Cm(e,t)||r.has(e,t)}));var Wu=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(nS(t)){let n=t.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(t=>t).join(" ")}};function nS(r){let e=r.getComponent();return(e==null?void 0:e.type)==="VERSION"}var Hu="@firebase/app",Om="0.14.10";var Rt=new xn("@firebase/app"),sS="@firebase/app-compat",iS="@firebase/analytics-compat",oS="@firebase/analytics",aS="@firebase/app-check-compat",uS="@firebase/app-check",cS="@firebase/auth",lS="@firebase/auth-compat",hS="@firebase/database",dS="@firebase/data-connect",fS="@firebase/database-compat",pS="@firebase/functions",mS="@firebase/functions-compat",gS="@firebase/installations",yS="@firebase/installations-compat",_S="@firebase/messaging",wS="@firebase/messaging-compat",vS="@firebase/performance",bS="@firebase/performance-compat",ES="@firebase/remote-config",TS="@firebase/remote-config-compat",IS="@firebase/storage",AS="@firebase/storage-compat",SS="@firebase/firestore",xS="@firebase/ai",RS="@firebase/firestore-compat",PS="firebase",CS="12.11.0";var Ju="[DEFAULT]",kS={[Hu]:"fire-core",[sS]:"fire-core-compat",[oS]:"fire-analytics",[iS]:"fire-analytics-compat",[uS]:"fire-app-check",[aS]:"fire-app-check-compat",[cS]:"fire-auth",[lS]:"fire-auth-compat",[hS]:"fire-rtdb",[dS]:"fire-data-connect",[fS]:"fire-rtdb-compat",[pS]:"fire-fn",[mS]:"fire-fn-compat",[gS]:"fire-iid",[yS]:"fire-iid-compat",[_S]:"fire-fcm",[wS]:"fire-fcm-compat",[vS]:"fire-perf",[bS]:"fire-perf-compat",[ES]:"fire-rc",[TS]:"fire-rc-compat",[IS]:"fire-gcs",[AS]:"fire-gcs-compat",[SS]:"fire-fst",[RS]:"fire-fst-compat",[xS]:"fire-vertex","fire-js":"fire-js",[PS]:"fire-js-all"};var Po=new Map,OS=new Map,Qu=new Map;function Dm(r,e){try{r.container.addComponent(e)}catch(t){Rt.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,t)}}function Bs(r){let e=r.name;if(Qu.has(e))return Rt.debug(`There were multiple attempts to register component ${e}.`),!1;Qu.set(e,r);for(let t of Po.values())Dm(t,r);for(let t of OS.values())Dm(t,r);return!0}function Fm(r,e){let t=r.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),r.container.getProvider(e)}function Mm(r){return r==null?!1:r.settings!==void 0}var DS={"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."},cr=new Us("app","Firebase",DS);var Yu=class{constructor(e,t,n){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new xt("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}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(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw cr.create("app-deleted",{appName:this._name})}};var jm=CS;function ec(r,e={}){let t=r;typeof e!="object"&&(e={name:e});let n={name:Ju,automaticDataCollectionEnabled:!0,...e},s=n.name;if(typeof s!="string"||!s)throw cr.create("bad-app-name",{appName:String(s)});if(t||(t=Fu()),!t)throw cr.create("no-options");let i=Po.get(s);if(i){if(Sr(t,i.options)&&Sr(n,i.config))return i;throw cr.create("duplicate-app",{appName:s})}let o=new xo(s);for(let c of Qu.values())o.addComponent(c);let u=new Yu(t,n,o);return Po.set(s,u),u}function Um(r=Ju){let e=Po.get(r);if(!e&&r===Ju&&Fu())return ec();if(!e)throw cr.create("no-app",{appName:r});return e}function lr(r,e,t){var o;let n=(o=kS[r])!=null?o:r;t&&(n+=`-${t}`);let s=n.match(/\s|\//),i=e.match(/\s|\//);if(s||i){let u=[`Unable to register library "${n}" with version "${e}":`];s&&u.push(`library name "${n}" contains illegal characters (whitespace or "/")`),s&&i&&u.push("and"),i&&u.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Rt.warn(u.join(" "));return}Bs(new xt(`${n}-version`,()=>({library:n,version:e}),"VERSION"))}var NS="firebase-heartbeat-database",VS=1,$s="firebase-heartbeat-store",Gu=null;function Bm(){return Gu||(Gu=km(NS,VS,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore($s)}catch(t){console.warn(t)}}}}).catch(r=>{throw cr.create("idb-open",{originalErrorMessage:r.message})})),Gu}async function LS(r){try{let t=(await Bm()).transaction($s),n=await t.objectStore($s).get($m(r));return await t.done,n}catch(e){if(e instanceof et)Rt.warn(e.message);else{let t=cr.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Rt.warn(t.message)}}}async function Nm(r,e){try{let n=(await Bm()).transaction($s,"readwrite");await n.objectStore($s).put(e,$m(r)),await n.done}catch(t){if(t instanceof et)Rt.warn(t.message);else{let n=cr.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});Rt.warn(n.message)}}}function $m(r){return`${r.name}!${r.options.appId}`}var FS=1024,MS=30,Xu=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new Zu(t),this._heartbeatsCachePromise=this._storage.read().then(n=>(this._heartbeatsCache=n,n))}async triggerHeartbeat(){var e,t;try{let s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Vm();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>MS){let o=US(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(n){Rt.warn(n)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let t=Vm(),{heartbeatsToSend:n,unsentEntries:s}=jS(this._heartbeatsCache.heartbeats),i=js(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(t){return Rt.warn(t),""}}};function Vm(){return new Date().toISOString().substring(0,10)}function jS(r,e=FS){let t=[],n=r.slice();for(let s of r){let i=t.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),Lm(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),Lm(t)>e){t.pop();break}n=n.slice(1)}return{heartbeatsToSend:t,unsentEntries:n}}var Zu=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Mu()?Tm().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let t=await LS(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){let s=await this.read();return Nm(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!=null?n:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){let s=await this.read();return Nm(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!=null?n:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}};function Lm(r){return js(JSON.stringify({version:2,heartbeats:r})).length}function US(r){if(r.length===0)return-1;let e=0,t=r[0].date;for(let n=1;n<r.length;n++)r[n].date<t&&(t=r[n].date,e=n);return e}function BS(r){Bs(new xt("platform-logger",e=>new Wu(e),"PRIVATE")),Bs(new xt("heartbeat",e=>new Xu(e),"PRIVATE")),lr(Hu,Om,r),lr(Hu,Om,"esm2020"),lr("fire-js","")}BS("");var $S="firebase",qS="12.11.0";lr($S,qS,"app");var qm=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},zm={};var Pt,tc;(function(){var r;function e(w,_){function b(){}b.prototype=_.prototype,w.F=_.prototype,w.prototype=new b,w.prototype.constructor=w,w.D=function(S,A,P){for(var E=Array(arguments.length-2),Ue=2;Ue<arguments.length;Ue++)E[Ue-2]=arguments[Ue];return _.prototype[A].apply(S,E)}}function t(){this.blockSize=-1}function n(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}e(n,t),n.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(w,_,b){b||(b=0);let S=Array(16);if(typeof _=="string")for(var A=0;A<16;++A)S[A]=_.charCodeAt(b++)|_.charCodeAt(b++)<<8|_.charCodeAt(b++)<<16|_.charCodeAt(b++)<<24;else for(A=0;A<16;++A)S[A]=_[b++]|_[b++]<<8|_[b++]<<16|_[b++]<<24;_=w.g[0],b=w.g[1],A=w.g[2];let P=w.g[3],E;E=_+(P^b&(A^P))+S[0]+3614090360&4294967295,_=b+(E<<7&4294967295|E>>>25),E=P+(A^_&(b^A))+S[1]+3905402710&4294967295,P=_+(E<<12&4294967295|E>>>20),E=A+(b^P&(_^b))+S[2]+606105819&4294967295,A=P+(E<<17&4294967295|E>>>15),E=b+(_^A&(P^_))+S[3]+3250441966&4294967295,b=A+(E<<22&4294967295|E>>>10),E=_+(P^b&(A^P))+S[4]+4118548399&4294967295,_=b+(E<<7&4294967295|E>>>25),E=P+(A^_&(b^A))+S[5]+1200080426&4294967295,P=_+(E<<12&4294967295|E>>>20),E=A+(b^P&(_^b))+S[6]+2821735955&4294967295,A=P+(E<<17&4294967295|E>>>15),E=b+(_^A&(P^_))+S[7]+4249261313&4294967295,b=A+(E<<22&4294967295|E>>>10),E=_+(P^b&(A^P))+S[8]+1770035416&4294967295,_=b+(E<<7&4294967295|E>>>25),E=P+(A^_&(b^A))+S[9]+2336552879&4294967295,P=_+(E<<12&4294967295|E>>>20),E=A+(b^P&(_^b))+S[10]+4294925233&4294967295,A=P+(E<<17&4294967295|E>>>15),E=b+(_^A&(P^_))+S[11]+2304563134&4294967295,b=A+(E<<22&4294967295|E>>>10),E=_+(P^b&(A^P))+S[12]+1804603682&4294967295,_=b+(E<<7&4294967295|E>>>25),E=P+(A^_&(b^A))+S[13]+4254626195&4294967295,P=_+(E<<12&4294967295|E>>>20),E=A+(b^P&(_^b))+S[14]+2792965006&4294967295,A=P+(E<<17&4294967295|E>>>15),E=b+(_^A&(P^_))+S[15]+1236535329&4294967295,b=A+(E<<22&4294967295|E>>>10),E=_+(A^P&(b^A))+S[1]+4129170786&4294967295,_=b+(E<<5&4294967295|E>>>27),E=P+(b^A&(_^b))+S[6]+3225465664&4294967295,P=_+(E<<9&4294967295|E>>>23),E=A+(_^b&(P^_))+S[11]+643717713&4294967295,A=P+(E<<14&4294967295|E>>>18),E=b+(P^_&(A^P))+S[0]+3921069994&4294967295,b=A+(E<<20&4294967295|E>>>12),E=_+(A^P&(b^A))+S[5]+3593408605&4294967295,_=b+(E<<5&4294967295|E>>>27),E=P+(b^A&(_^b))+S[10]+38016083&4294967295,P=_+(E<<9&4294967295|E>>>23),E=A+(_^b&(P^_))+S[15]+3634488961&4294967295,A=P+(E<<14&4294967295|E>>>18),E=b+(P^_&(A^P))+S[4]+3889429448&4294967295,b=A+(E<<20&4294967295|E>>>12),E=_+(A^P&(b^A))+S[9]+568446438&4294967295,_=b+(E<<5&4294967295|E>>>27),E=P+(b^A&(_^b))+S[14]+3275163606&4294967295,P=_+(E<<9&4294967295|E>>>23),E=A+(_^b&(P^_))+S[3]+4107603335&4294967295,A=P+(E<<14&4294967295|E>>>18),E=b+(P^_&(A^P))+S[8]+1163531501&4294967295,b=A+(E<<20&4294967295|E>>>12),E=_+(A^P&(b^A))+S[13]+2850285829&4294967295,_=b+(E<<5&4294967295|E>>>27),E=P+(b^A&(_^b))+S[2]+4243563512&4294967295,P=_+(E<<9&4294967295|E>>>23),E=A+(_^b&(P^_))+S[7]+1735328473&4294967295,A=P+(E<<14&4294967295|E>>>18),E=b+(P^_&(A^P))+S[12]+2368359562&4294967295,b=A+(E<<20&4294967295|E>>>12),E=_+(b^A^P)+S[5]+4294588738&4294967295,_=b+(E<<4&4294967295|E>>>28),E=P+(_^b^A)+S[8]+2272392833&4294967295,P=_+(E<<11&4294967295|E>>>21),E=A+(P^_^b)+S[11]+1839030562&4294967295,A=P+(E<<16&4294967295|E>>>16),E=b+(A^P^_)+S[14]+4259657740&4294967295,b=A+(E<<23&4294967295|E>>>9),E=_+(b^A^P)+S[1]+2763975236&4294967295,_=b+(E<<4&4294967295|E>>>28),E=P+(_^b^A)+S[4]+1272893353&4294967295,P=_+(E<<11&4294967295|E>>>21),E=A+(P^_^b)+S[7]+4139469664&4294967295,A=P+(E<<16&4294967295|E>>>16),E=b+(A^P^_)+S[10]+3200236656&4294967295,b=A+(E<<23&4294967295|E>>>9),E=_+(b^A^P)+S[13]+681279174&4294967295,_=b+(E<<4&4294967295|E>>>28),E=P+(_^b^A)+S[0]+3936430074&4294967295,P=_+(E<<11&4294967295|E>>>21),E=A+(P^_^b)+S[3]+3572445317&4294967295,A=P+(E<<16&4294967295|E>>>16),E=b+(A^P^_)+S[6]+76029189&4294967295,b=A+(E<<23&4294967295|E>>>9),E=_+(b^A^P)+S[9]+3654602809&4294967295,_=b+(E<<4&4294967295|E>>>28),E=P+(_^b^A)+S[12]+3873151461&4294967295,P=_+(E<<11&4294967295|E>>>21),E=A+(P^_^b)+S[15]+530742520&4294967295,A=P+(E<<16&4294967295|E>>>16),E=b+(A^P^_)+S[2]+3299628645&4294967295,b=A+(E<<23&4294967295|E>>>9),E=_+(A^(b|~P))+S[0]+4096336452&4294967295,_=b+(E<<6&4294967295|E>>>26),E=P+(b^(_|~A))+S[7]+1126891415&4294967295,P=_+(E<<10&4294967295|E>>>22),E=A+(_^(P|~b))+S[14]+2878612391&4294967295,A=P+(E<<15&4294967295|E>>>17),E=b+(P^(A|~_))+S[5]+4237533241&4294967295,b=A+(E<<21&4294967295|E>>>11),E=_+(A^(b|~P))+S[12]+1700485571&4294967295,_=b+(E<<6&4294967295|E>>>26),E=P+(b^(_|~A))+S[3]+2399980690&4294967295,P=_+(E<<10&4294967295|E>>>22),E=A+(_^(P|~b))+S[10]+4293915773&4294967295,A=P+(E<<15&4294967295|E>>>17),E=b+(P^(A|~_))+S[1]+2240044497&4294967295,b=A+(E<<21&4294967295|E>>>11),E=_+(A^(b|~P))+S[8]+1873313359&4294967295,_=b+(E<<6&4294967295|E>>>26),E=P+(b^(_|~A))+S[15]+4264355552&4294967295,P=_+(E<<10&4294967295|E>>>22),E=A+(_^(P|~b))+S[6]+2734768916&4294967295,A=P+(E<<15&4294967295|E>>>17),E=b+(P^(A|~_))+S[13]+1309151649&4294967295,b=A+(E<<21&4294967295|E>>>11),E=_+(A^(b|~P))+S[4]+4149444226&4294967295,_=b+(E<<6&4294967295|E>>>26),E=P+(b^(_|~A))+S[11]+3174756917&4294967295,P=_+(E<<10&4294967295|E>>>22),E=A+(_^(P|~b))+S[2]+718787259&4294967295,A=P+(E<<15&4294967295|E>>>17),E=b+(P^(A|~_))+S[9]+3951481745&4294967295,w.g[0]=w.g[0]+_&4294967295,w.g[1]=w.g[1]+(A+(E<<21&4294967295|E>>>11))&4294967295,w.g[2]=w.g[2]+A&4294967295,w.g[3]=w.g[3]+P&4294967295}n.prototype.v=function(w,_){_===void 0&&(_=w.length);let b=_-this.blockSize,S=this.C,A=this.h,P=0;for(;P<_;){if(A==0)for(;P<=b;)s(this,w,P),P+=this.blockSize;if(typeof w=="string"){for(;P<_;)if(S[A++]=w.charCodeAt(P++),A==this.blockSize){s(this,S),A=0;break}}else for(;P<_;)if(S[A++]=w[P++],A==this.blockSize){s(this,S),A=0;break}}this.h=A,this.o+=_},n.prototype.A=function(){var w=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);w[0]=128;for(var _=1;_<w.length-8;++_)w[_]=0;_=this.o*8;for(var b=w.length-8;b<w.length;++b)w[b]=_&255,_/=256;for(this.v(w),w=Array(16),_=0,b=0;b<4;++b)for(let S=0;S<32;S+=8)w[_++]=this.g[b]>>>S&255;return w};function i(w,_){var b=u;return Object.prototype.hasOwnProperty.call(b,w)?b[w]:b[w]=_(w)}function o(w,_){this.h=_;let b=[],S=!0;for(let A=w.length-1;A>=0;A--){let P=w[A]|0;S&&P==_||(b[A]=P,S=!1)}this.g=b}var u={};function c(w){return-128<=w&&w<128?i(w,function(_){return new o([_|0],_<0?-1:0)}):new o([w|0],w<0?-1:0)}function l(w){if(isNaN(w)||!isFinite(w))return p;if(w<0)return I(l(-w));let _=[],b=1;for(let S=0;w>=b;S++)_[S]=w/b|0,b*=4294967296;return new o(_,0)}function f(w,_){if(w.length==0)throw Error("number format error: empty string");if(_=_||10,_<2||36<_)throw Error("radix out of range: "+_);if(w.charAt(0)=="-")return I(f(w.substring(1),_));if(w.indexOf("-")>=0)throw Error('number format error: interior "-" character');let b=l(Math.pow(_,8)),S=p;for(let P=0;P<w.length;P+=8){var A=Math.min(8,w.length-P);let E=parseInt(w.substring(P,P+A),_);A<8?(A=l(Math.pow(_,A)),S=S.j(A).add(l(E))):(S=S.j(b),S=S.add(l(E)))}return S}var p=c(0),m=c(1),y=c(16777216);r=o.prototype,r.m=function(){if(x(this))return-I(this).m();let w=0,_=1;for(let b=0;b<this.g.length;b++){let S=this.i(b);w+=(S>=0?S:4294967296+S)*_,_*=4294967296}return w},r.toString=function(w){if(w=w||10,w<2||36<w)throw Error("radix out of range: "+w);if(T(this))return"0";if(x(this))return"-"+I(this).toString(w);let _=l(Math.pow(w,6));var b=this;let S="";for(;;){let A=M(b,_).g;b=k(b,A.j(_));let P=((b.g.length>0?b.g[0]:b.h)>>>0).toString(w);if(b=A,T(b))return P+S;for(;P.length<6;)P="0"+P;S=P+S}},r.i=function(w){return w<0?0:w<this.g.length?this.g[w]:this.h};function T(w){if(w.h!=0)return!1;for(let _=0;_<w.g.length;_++)if(w.g[_]!=0)return!1;return!0}function x(w){return w.h==-1}r.l=function(w){return w=k(this,w),x(w)?-1:T(w)?0:1};function I(w){let _=w.g.length,b=[];for(let S=0;S<_;S++)b[S]=~w.g[S];return new o(b,~w.h).add(m)}r.abs=function(){return x(this)?I(this):this},r.add=function(w){let _=Math.max(this.g.length,w.g.length),b=[],S=0;for(let A=0;A<=_;A++){let P=S+(this.i(A)&65535)+(w.i(A)&65535),E=(P>>>16)+(this.i(A)>>>16)+(w.i(A)>>>16);S=E>>>16,P&=65535,E&=65535,b[A]=E<<16|P}return new o(b,b[b.length-1]&-2147483648?-1:0)};function k(w,_){return w.add(I(_))}r.j=function(w){if(T(this)||T(w))return p;if(x(this))return x(w)?I(this).j(I(w)):I(I(this).j(w));if(x(w))return I(this.j(I(w)));if(this.l(y)<0&&w.l(y)<0)return l(this.m()*w.m());let _=this.g.length+w.g.length,b=[];for(var S=0;S<2*_;S++)b[S]=0;for(S=0;S<this.g.length;S++)for(let A=0;A<w.g.length;A++){let P=this.i(S)>>>16,E=this.i(S)&65535,Ue=w.i(A)>>>16,qt=w.i(A)&65535;b[2*S+2*A]+=E*qt,O(b,2*S+2*A),b[2*S+2*A+1]+=P*qt,O(b,2*S+2*A+1),b[2*S+2*A+1]+=E*Ue,O(b,2*S+2*A+1),b[2*S+2*A+2]+=P*Ue,O(b,2*S+2*A+2)}for(w=0;w<_;w++)b[w]=b[2*w+1]<<16|b[2*w];for(w=_;w<2*_;w++)b[w]=0;return new o(b,0)};function O(w,_){for(;(w[_]&65535)!=w[_];)w[_+1]+=w[_]>>>16,w[_]&=65535,_++}function D(w,_){this.g=w,this.h=_}function M(w,_){if(T(_))throw Error("division by zero");if(T(w))return new D(p,p);if(x(w))return _=M(I(w),_),new D(I(_.g),I(_.h));if(x(_))return _=M(w,I(_)),new D(I(_.g),_.h);if(w.g.length>30){if(x(w)||x(_))throw Error("slowDivide_ only works with positive integers.");for(var b=m,S=_;S.l(w)<=0;)b=B(b),S=B(S);var A=F(b,1),P=F(S,1);for(S=F(S,2),b=F(b,2);!T(S);){var E=P.add(S);E.l(w)<=0&&(A=A.add(b),P=E),S=F(S,1),b=F(b,1)}return _=k(w,A.j(_)),new D(A,_)}for(A=p;w.l(_)>=0;){for(b=Math.max(1,Math.floor(w.m()/_.m())),S=Math.ceil(Math.log(b)/Math.LN2),S=S<=48?1:Math.pow(2,S-48),P=l(b),E=P.j(_);x(E)||E.l(w)>0;)b-=S,P=l(b),E=P.j(_);T(P)&&(P=m),A=A.add(P),w=k(w,E)}return new D(A,w)}r.B=function(w){return M(this,w).h},r.and=function(w){let _=Math.max(this.g.length,w.g.length),b=[];for(let S=0;S<_;S++)b[S]=this.i(S)&w.i(S);return new o(b,this.h&w.h)},r.or=function(w){let _=Math.max(this.g.length,w.g.length),b=[];for(let S=0;S<_;S++)b[S]=this.i(S)|w.i(S);return new o(b,this.h|w.h)},r.xor=function(w){let _=Math.max(this.g.length,w.g.length),b=[];for(let S=0;S<_;S++)b[S]=this.i(S)^w.i(S);return new o(b,this.h^w.h)};function B(w){let _=w.g.length+1,b=[];for(let S=0;S<_;S++)b[S]=w.i(S)<<1|w.i(S-1)>>>31;return new o(b,w.h)}function F(w,_){let b=_>>5;_%=32;let S=w.g.length-b,A=[];for(let P=0;P<S;P++)A[P]=_>0?w.i(P+b)>>>_|w.i(P+b+1)<<32-_:w.i(P+b);return new o(A,w.h)}n.prototype.digest=n.prototype.A,n.prototype.reset=n.prototype.u,n.prototype.update=n.prototype.v,tc=zm.Md5=n,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=l,o.fromString=f,Pt=zm.Integer=o}).apply(typeof qm!="undefined"?qm:typeof self!="undefined"?self:typeof window!="undefined"?window:{});var Co=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Ct={};var rc,zS,Rn,nc,qs,ko,sc,ic,oc;(function(){var r,e=Object.defineProperty;function t(a){a=[typeof globalThis=="object"&&globalThis,a,typeof window=="object"&&window,typeof self=="object"&&self,typeof Co=="object"&&Co];for(var h=0;h<a.length;++h){var d=a[h];if(d&&d.Math==Math)return d}throw Error("Cannot find global object")}var n=t(this);function s(a,h){if(h)e:{var d=n;a=a.split(".");for(var g=0;g<a.length-1;g++){var R=a[g];if(!(R in d))break e;d=d[R]}a=a[a.length-1],g=d[a],h=h(g),h!=g&&h!=null&&e(d,a,{configurable:!0,writable:!0,value:h})}}s("Symbol.dispose",function(a){return a||Symbol("Symbol.dispose")}),s("Array.prototype.values",function(a){return a||function(){return this[Symbol.iterator]()}}),s("Object.entries",function(a){return a||function(h){var d=[],g;for(g in h)Object.prototype.hasOwnProperty.call(h,g)&&d.push([g,h[g]]);return d}});var i=i||{},o=this||self;function u(a){var h=typeof a;return h=="object"&&a!=null||h=="function"}function c(a,h,d){return a.call.apply(a.bind,arguments)}function l(a,h,d){return l=c,l.apply(null,arguments)}function f(a,h){var d=Array.prototype.slice.call(arguments,1);return function(){var g=d.slice();return g.push.apply(g,arguments),a.apply(this,g)}}function p(a,h){function d(){}d.prototype=h.prototype,a.Z=h.prototype,a.prototype=new d,a.prototype.constructor=a,a.Ob=function(g,R,C){for(var L=Array(arguments.length-2),J=2;J<arguments.length;J++)L[J-2]=arguments[J];return h.prototype[R].apply(g,L)}}var m=typeof AsyncContext!="undefined"&&typeof AsyncContext.Snapshot=="function"?a=>a&&AsyncContext.Snapshot.wrap(a):a=>a;function y(a){let h=a.length;if(h>0){let d=Array(h);for(let g=0;g<h;g++)d[g]=a[g];return d}return[]}function T(a,h){for(let g=1;g<arguments.length;g++){let R=arguments[g];var d=typeof R;if(d=d!="object"?d:R?Array.isArray(R)?"array":d:"null",d=="array"||d=="object"&&typeof R.length=="number"){d=a.length||0;let C=R.length||0;a.length=d+C;for(let L=0;L<C;L++)a[d+L]=R[L]}else a.push(R)}}class x{constructor(h,d){this.i=h,this.j=d,this.h=0,this.g=null}get(){let h;return this.h>0?(this.h--,h=this.g,this.g=h.next,h.next=null):h=this.i(),h}}function I(a){o.setTimeout(()=>{throw a},0)}function k(){var a=w;let h=null;return a.g&&(h=a.g,a.g=a.g.next,a.g||(a.h=null),h.next=null),h}class O{constructor(){this.h=this.g=null}add(h,d){let g=D.get();g.set(h,d),this.h?this.h.next=g:this.g=g,this.h=g}}var D=new x(()=>new M,a=>a.reset());class M{constructor(){this.next=this.g=this.h=null}set(h,d){this.h=h,this.g=d,this.next=null}reset(){this.next=this.g=this.h=null}}let B,F=!1,w=new O,_=()=>{let a=Promise.resolve(void 0);B=()=>{a.then(b)}};function b(){for(var a;a=k();){try{a.h.call(a.g)}catch(d){I(d)}var h=D;h.j(a),h.h<100&&(h.h++,a.next=h.g,h.g=a)}F=!1}function S(){this.u=this.u,this.C=this.C}S.prototype.u=!1,S.prototype.dispose=function(){this.u||(this.u=!0,this.N())},S.prototype[Symbol.dispose]=function(){this.dispose()},S.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function A(a,h){this.type=a,this.g=this.target=h,this.defaultPrevented=!1}A.prototype.h=function(){this.defaultPrevented=!0};var P=(function(){if(!o.addEventListener||!Object.defineProperty)return!1;var a=!1,h=Object.defineProperty({},"passive",{get:function(){a=!0}});try{let d=()=>{};o.addEventListener("test",d,h),o.removeEventListener("test",d,h)}catch{}return a})();function E(a){return/^[\s\xa0]*$/.test(a)}function Ue(a,h){A.call(this,a?a.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,a&&this.init(a,h)}p(Ue,A),Ue.prototype.init=function(a,h){let d=this.type=a.type,g=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement,this.g=h,h=a.relatedTarget,h||(d=="mouseover"?h=a.fromElement:d=="mouseout"&&(h=a.toElement)),this.relatedTarget=h,g?(this.clientX=g.clientX!==void 0?g.clientX:g.pageX,this.clientY=g.clientY!==void 0?g.clientY:g.pageY,this.screenX=g.screenX||0,this.screenY=g.screenY||0):(this.clientX=a.clientX!==void 0?a.clientX:a.pageX,this.clientY=a.clientY!==void 0?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0),this.button=a.button,this.key=a.key||"",this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.pointerId=a.pointerId||0,this.pointerType=a.pointerType,this.state=a.state,this.i=a,a.defaultPrevented&&Ue.Z.h.call(this)},Ue.prototype.h=function(){Ue.Z.h.call(this);let a=this.i;a.preventDefault?a.preventDefault():a.returnValue=!1};var qt="closure_listenable_"+(Math.random()*1e6|0),Ow=0;function Dw(a,h,d,g,R){this.listener=a,this.proxy=null,this.src=h,this.type=d,this.capture=!!g,this.ha=R,this.key=++Ow,this.da=this.fa=!1}function Mi(a){a.da=!0,a.listener=null,a.proxy=null,a.src=null,a.ha=null}function ji(a,h,d){for(let g in a)h.call(d,a[g],g,a)}function Nw(a,h){for(let d in a)h.call(void 0,a[d],d,a)}function Mh(a){let h={};for(let d in a)h[d]=a[d];return h}let jh="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Uh(a,h){let d,g;for(let R=1;R<arguments.length;R++){g=arguments[R];for(d in g)a[d]=g[d];for(let C=0;C<jh.length;C++)d=jh[C],Object.prototype.hasOwnProperty.call(g,d)&&(a[d]=g[d])}}function Ui(a){this.src=a,this.g={},this.h=0}Ui.prototype.add=function(a,h,d,g,R){let C=a.toString();a=this.g[C],a||(a=this.g[C]=[],this.h++);let L=su(a,h,g,R);return L>-1?(h=a[L],d||(h.fa=!1)):(h=new Dw(h,this.src,C,!!g,R),h.fa=d,a.push(h)),h};function nu(a,h){let d=h.type;if(d in a.g){var g=a.g[d],R=Array.prototype.indexOf.call(g,h,void 0),C;(C=R>=0)&&Array.prototype.splice.call(g,R,1),C&&(Mi(h),a.g[d].length==0&&(delete a.g[d],a.h--))}}function su(a,h,d,g){for(let R=0;R<a.length;++R){let C=a[R];if(!C.da&&C.listener==h&&C.capture==!!d&&C.ha==g)return R}return-1}var iu="closure_lm_"+(Math.random()*1e6|0),ou={};function Bh(a,h,d,g,R){if(g&&g.once)return qh(a,h,d,g,R);if(Array.isArray(h)){for(let C=0;C<h.length;C++)Bh(a,h[C],d,g,R);return null}return d=lu(d),a&&a[qt]?a.J(h,d,u(g)?!!g.capture:!!g,R):$h(a,h,d,!1,g,R)}function $h(a,h,d,g,R,C){if(!h)throw Error("Invalid event type");let L=u(R)?!!R.capture:!!R,J=uu(a);if(J||(a[iu]=J=new Ui(a)),d=J.add(h,d,g,L,C),d.proxy)return d;if(g=Vw(),d.proxy=g,g.src=a,g.listener=d,a.addEventListener)P||(R=L),R===void 0&&(R=!1),a.addEventListener(h.toString(),g,R);else if(a.attachEvent)a.attachEvent(Kh(h.toString()),g);else if(a.addListener&&a.removeListener)a.addListener(g);else throw Error("addEventListener and attachEvent are unavailable.");return d}function Vw(){function a(d){return h.call(a.src,a.listener,d)}let h=Lw;return a}function qh(a,h,d,g,R){if(Array.isArray(h)){for(let C=0;C<h.length;C++)qh(a,h[C],d,g,R);return null}return d=lu(d),a&&a[qt]?a.K(h,d,u(g)?!!g.capture:!!g,R):$h(a,h,d,!0,g,R)}function zh(a,h,d,g,R){if(Array.isArray(h))for(var C=0;C<h.length;C++)zh(a,h[C],d,g,R);else g=u(g)?!!g.capture:!!g,d=lu(d),a&&a[qt]?(a=a.i,C=String(h).toString(),C in a.g&&(h=a.g[C],d=su(h,d,g,R),d>-1&&(Mi(h[d]),Array.prototype.splice.call(h,d,1),h.length==0&&(delete a.g[C],a.h--)))):a&&(a=uu(a))&&(h=a.g[h.toString()],a=-1,h&&(a=su(h,d,g,R)),(d=a>-1?h[a]:null)&&au(d))}function au(a){if(typeof a!="number"&&a&&!a.da){var h=a.src;if(h&&h[qt])nu(h.i,a);else{var d=a.type,g=a.proxy;h.removeEventListener?h.removeEventListener(d,g,a.capture):h.detachEvent?h.detachEvent(Kh(d),g):h.addListener&&h.removeListener&&h.removeListener(g),(d=uu(h))?(nu(d,a),d.h==0&&(d.src=null,h[iu]=null)):Mi(a)}}}function Kh(a){return a in ou?ou[a]:ou[a]="on"+a}function Lw(a,h){if(a.da)a=!0;else{h=new Ue(h,this);let d=a.listener,g=a.ha||a.src;a.fa&&au(a),a=d.call(g,h)}return a}function uu(a){return a=a[iu],a instanceof Ui?a:null}var cu="__closure_events_fn_"+(Math.random()*1e9>>>0);function lu(a){return typeof a=="function"?a:(a[cu]||(a[cu]=function(h){return a.handleEvent(h)}),a[cu])}function De(){S.call(this),this.i=new Ui(this),this.M=this,this.G=null}p(De,S),De.prototype[qt]=!0,De.prototype.removeEventListener=function(a,h,d,g){zh(this,a,h,d,g)};function Le(a,h){var d,g=a.G;if(g)for(d=[];g;g=g.G)d.push(g);if(a=a.M,g=h.type||h,typeof h=="string")h=new A(h,a);else if(h instanceof A)h.target=h.target||a;else{var R=h;h=new A(g,a),Uh(h,R)}R=!0;let C,L;if(d)for(L=d.length-1;L>=0;L--)C=h.g=d[L],R=Bi(C,g,!0,h)&&R;if(C=h.g=a,R=Bi(C,g,!0,h)&&R,R=Bi(C,g,!1,h)&&R,d)for(L=0;L<d.length;L++)C=h.g=d[L],R=Bi(C,g,!1,h)&&R}De.prototype.N=function(){if(De.Z.N.call(this),this.i){var a=this.i;for(let h in a.g){let d=a.g[h];for(let g=0;g<d.length;g++)Mi(d[g]);delete a.g[h],a.h--}}this.G=null},De.prototype.J=function(a,h,d,g){return this.i.add(String(a),h,!1,d,g)},De.prototype.K=function(a,h,d,g){return this.i.add(String(a),h,!0,d,g)};function Bi(a,h,d,g){if(h=a.i.g[String(h)],!h)return!0;h=h.concat();let R=!0;for(let C=0;C<h.length;++C){let L=h[C];if(L&&!L.da&&L.capture==d){let J=L.listener,Te=L.ha||L.src;L.fa&&nu(a.i,L),R=J.call(Te,g)!==!1&&R}}return R&&!g.defaultPrevented}function Fw(a,h){if(typeof a!="function")if(a&&typeof a.handleEvent=="function")a=l(a.handleEvent,a);else throw Error("Invalid listener argument");return Number(h)>2147483647?-1:o.setTimeout(a,h||0)}function Gh(a){a.g=Fw(()=>{a.g=null,a.i&&(a.i=!1,Gh(a))},a.l);let h=a.h;a.h=null,a.m.apply(null,h)}class Mw extends S{constructor(h,d){super(),this.m=h,this.l=d,this.h=null,this.i=!1,this.g=null}j(h){this.h=arguments,this.g?this.i=!0:Gh(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function _s(a){S.call(this),this.h=a,this.g={}}p(_s,S);var Wh=[];function Hh(a){ji(a.g,function(h,d){this.g.hasOwnProperty(d)&&au(h)},a),a.g={}}_s.prototype.N=function(){_s.Z.N.call(this),Hh(this)},_s.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var hu=o.JSON.stringify,jw=o.JSON.parse,Uw=class{stringify(a){return o.JSON.stringify(a,void 0)}parse(a){return o.JSON.parse(a,void 0)}};function Jh(){}function Qh(){}var ws={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function du(){A.call(this,"d")}p(du,A);function fu(){A.call(this,"c")}p(fu,A);var wr={},Yh=null;function $i(){return Yh=Yh||new De}wr.Ia="serverreachability";function Xh(a){A.call(this,wr.Ia,a)}p(Xh,A);function vs(a){let h=$i();Le(h,new Xh(h))}wr.STAT_EVENT="statevent";function Zh(a,h){A.call(this,wr.STAT_EVENT,a),this.stat=h}p(Zh,A);function Fe(a){let h=$i();Le(h,new Zh(h,a))}wr.Ja="timingevent";function ed(a,h){A.call(this,wr.Ja,a),this.size=h}p(ed,A);function bs(a,h){if(typeof a!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){a()},h)}function Es(){this.g=!0}Es.prototype.ua=function(){this.g=!1};function Bw(a,h,d,g,R,C){a.info(function(){if(a.g)if(C){var L="",J=C.split("&");for(let ne=0;ne<J.length;ne++){var Te=J[ne].split("=");if(Te.length>1){let xe=Te[0];Te=Te[1];let ot=xe.split("_");L=ot.length>=2&&ot[1]=="type"?L+(xe+"="+Te+"&"):L+(xe+"=redacted&")}}}else L=null;else L=C;return"XMLHTTP REQ ("+g+") [attempt "+R+"]: "+h+`
|
|
2
|
+
`+d+`
|
|
3
|
+
`+L})}function $w(a,h,d,g,R,C,L){a.info(function(){return"XMLHTTP RESP ("+g+") [ attempt "+R+"]: "+h+`
|
|
4
|
+
`+d+`
|
|
5
|
+
`+C+" "+L})}function on(a,h,d,g){a.info(function(){return"XMLHTTP TEXT ("+h+"): "+zw(a,d)+(g?" "+g:"")})}function qw(a,h){a.info(function(){return"TIMEOUT: "+h})}Es.prototype.info=function(){};function zw(a,h){if(!a.g)return h;if(!h)return null;try{let C=JSON.parse(h);if(C){for(a=0;a<C.length;a++)if(Array.isArray(C[a])){var d=C[a];if(!(d.length<2)){var g=d[1];if(Array.isArray(g)&&!(g.length<1)){var R=g[0];if(R!="noop"&&R!="stop"&&R!="close")for(let L=1;L<g.length;L++)g[L]=""}}}}return hu(C)}catch{return h}}var qi={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},td={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"},rd;function pu(){}p(pu,Jh),pu.prototype.g=function(){return new XMLHttpRequest},rd=new pu;function Ts(a){return encodeURIComponent(String(a))}function Kw(a){var h=1;a=a.split(":");let d=[];for(;h>0&&a.length;)d.push(a.shift()),h--;return a.length&&d.push(a.join(":")),d}function zt(a,h,d,g){this.j=a,this.i=h,this.l=d,this.S=g||1,this.V=new _s(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new nd}function nd(){this.i=null,this.g="",this.h=!1}var sd={},mu={};function gu(a,h,d){a.M=1,a.A=Ki(it(h)),a.u=d,a.R=!0,id(a,null)}function id(a,h){a.F=Date.now(),zi(a),a.B=it(a.A);var d=a.B,g=a.S;Array.isArray(g)||(g=[String(g)]),_d(d.i,"t",g),a.C=0,d=a.j.L,a.h=new nd,a.g=Ld(a.j,d?h:null,!a.u),a.P>0&&(a.O=new Mw(l(a.Y,a,a.g),a.P)),h=a.V,d=a.g,g=a.ba;var R="readystatechange";Array.isArray(R)||(R&&(Wh[0]=R.toString()),R=Wh);for(let C=0;C<R.length;C++){let L=Bh(d,R[C],g||h.handleEvent,!1,h.h||h);if(!L)break;h.g[L.key]=L}h=a.J?Mh(a.J):{},a.u?(a.v||(a.v="POST"),h["Content-Type"]="application/x-www-form-urlencoded",a.g.ea(a.B,a.v,a.u,h)):(a.v="GET",a.g.ea(a.B,a.v,null,h)),vs(),Bw(a.i,a.v,a.B,a.l,a.S,a.u)}zt.prototype.ba=function(a){a=a.target;let h=this.O;h&&Wt(a)==3?h.j():this.Y(a)},zt.prototype.Y=function(a){try{if(a==this.g)e:{let J=Wt(this.g),Te=this.g.ya(),ne=this.g.ca();if(!(J<3)&&(J!=3||this.g&&(this.h.h||this.g.la()||Ad(this.g)))){this.K||J!=4||Te==7||(Te==8||ne<=0?vs(3):vs(2)),yu(this);var h=this.g.ca();this.X=h;var d=Gw(this);if(this.o=h==200,$w(this.i,this.v,this.B,this.l,this.S,J,h),this.o){if(this.U&&!this.L){t:{if(this.g){var g,R=this.g;if((g=R.g?R.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!E(g)){var C=g;break t}}C=null}if(a=C)on(this.i,this.l,a,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,_u(this,a);else{this.o=!1,this.m=3,Fe(12),vr(this),Is(this);break e}}if(this.R){a=!0;let xe;for(;!this.K&&this.C<d.length;)if(xe=Ww(this,d),xe==mu){J==4&&(this.m=4,Fe(14),a=!1),on(this.i,this.l,null,"[Incomplete Response]");break}else if(xe==sd){this.m=4,Fe(15),on(this.i,this.l,d,"[Invalid Chunk]"),a=!1;break}else on(this.i,this.l,xe,null),_u(this,xe);if(od(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),J!=4||d.length!=0||this.h.h||(this.m=1,Fe(16),a=!1),this.o=this.o&&a,!a)on(this.i,this.l,d,"[Invalid Chunked Response]"),vr(this),Is(this);else if(d.length>0&&!this.W){this.W=!0;var L=this.j;L.g==this&&L.aa&&!L.P&&(L.j.info("Great, no buffering proxy detected. Bytes received: "+d.length),Au(L),L.P=!0,Fe(11))}}else on(this.i,this.l,d,null),_u(this,d);J==4&&vr(this),this.o&&!this.K&&(J==4?Od(this.j,this):(this.o=!1,zi(this)))}else av(this.g),h==400&&d.indexOf("Unknown SID")>0?(this.m=3,Fe(12)):(this.m=0,Fe(13)),vr(this),Is(this)}}}catch{}};function Gw(a){if(!od(a))return a.g.la();let h=Ad(a.g);if(h==="")return"";let d="",g=h.length,R=Wt(a.g)==4;if(!a.h.i){if(typeof TextDecoder=="undefined")return vr(a),Is(a),"";a.h.i=new o.TextDecoder}for(let C=0;C<g;C++)a.h.h=!0,d+=a.h.i.decode(h[C],{stream:!(R&&C==g-1)});return h.length=0,a.h.g+=d,a.C=0,a.h.g}function od(a){return a.g?a.v=="GET"&&a.M!=2&&a.j.Aa:!1}function Ww(a,h){var d=a.C,g=h.indexOf(`
|
|
6
|
+
`,d);return g==-1?mu:(d=Number(h.substring(d,g)),isNaN(d)?sd:(g+=1,g+d>h.length?mu:(h=h.slice(g,g+d),a.C=g+d,h)))}zt.prototype.cancel=function(){this.K=!0,vr(this)};function zi(a){a.T=Date.now()+a.H,ad(a,a.H)}function ad(a,h){if(a.D!=null)throw Error("WatchDog timer not null");a.D=bs(l(a.aa,a),h)}function yu(a){a.D&&(o.clearTimeout(a.D),a.D=null)}zt.prototype.aa=function(){this.D=null;let a=Date.now();a-this.T>=0?(qw(this.i,this.B),this.M!=2&&(vs(),Fe(17)),vr(this),this.m=2,Is(this)):ad(this,this.T-a)};function Is(a){a.j.I==0||a.K||Od(a.j,a)}function vr(a){yu(a);var h=a.O;h&&typeof h.dispose=="function"&&h.dispose(),a.O=null,Hh(a.V),a.g&&(h=a.g,a.g=null,h.abort(),h.dispose())}function _u(a,h){try{var d=a.j;if(d.I!=0&&(d.g==a||wu(d.h,a))){if(!a.L&&wu(d.h,a)&&d.I==3){try{var g=d.Ba.g.parse(h)}catch{g=null}if(Array.isArray(g)&&g.length==3){var R=g;if(R[0]==0){e:if(!d.v){if(d.g)if(d.g.F+3e3<a.F)Yi(d),Ji(d);else break e;Iu(d),Fe(18)}}else d.xa=R[1],0<d.xa-d.K&&R[2]<37500&&d.F&&d.A==0&&!d.C&&(d.C=bs(l(d.Va,d),6e3));ld(d.h)<=1&&d.ta&&(d.ta=void 0)}else Er(d,11)}else if((a.L||d.g==a)&&Yi(d),!E(h))for(R=d.Ba.g.parse(h),h=0;h<R.length;h++){let ne=R[h],xe=ne[0];if(!(xe<=d.K))if(d.K=xe,ne=ne[1],d.I==2)if(ne[0]=="c"){d.M=ne[1],d.ba=ne[2];let ot=ne[3];ot!=null&&(d.ka=ot,d.j.info("VER="+d.ka));let Tr=ne[4];Tr!=null&&(d.za=Tr,d.j.info("SVER="+d.za));let Ht=ne[5];Ht!=null&&typeof Ht=="number"&&Ht>0&&(g=1.5*Ht,d.O=g,d.j.info("backChannelRequestTimeoutMs_="+g)),g=d;let Jt=a.g;if(Jt){let Zi=Jt.g?Jt.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Zi){var C=g.h;C.g||Zi.indexOf("spdy")==-1&&Zi.indexOf("quic")==-1&&Zi.indexOf("h2")==-1||(C.j=C.l,C.g=new Set,C.h&&(vu(C,C.h),C.h=null))}if(g.G){let Su=Jt.g?Jt.g.getResponseHeader("X-HTTP-Session-Id"):null;Su&&(g.wa=Su,ae(g.J,g.G,Su))}}d.I=3,d.l&&d.l.ra(),d.aa&&(d.T=Date.now()-a.F,d.j.info("Handshake RTT: "+d.T+"ms")),g=d;var L=a;if(g.na=Vd(g,g.L?g.ba:null,g.W),L.L){hd(g.h,L);var J=L,Te=g.O;Te&&(J.H=Te),J.D&&(yu(J),zi(J)),g.g=L}else Cd(g);d.i.length>0&&Qi(d)}else ne[0]!="stop"&&ne[0]!="close"||Er(d,7);else d.I==3&&(ne[0]=="stop"||ne[0]=="close"?ne[0]=="stop"?Er(d,7):Tu(d):ne[0]!="noop"&&d.l&&d.l.qa(ne),d.A=0)}}vs(4)}catch{}}var Hw=class{constructor(a,h){this.g=a,this.map=h}};function ud(a){this.l=a||10,o.PerformanceNavigationTiming?(a=o.performance.getEntriesByType("navigation"),a=a.length>0&&(a[0].nextHopProtocol=="hq"||a[0].nextHopProtocol=="h2")):a=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=a?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function cd(a){return a.h?!0:a.g?a.g.size>=a.j:!1}function ld(a){return a.h?1:a.g?a.g.size:0}function wu(a,h){return a.h?a.h==h:a.g?a.g.has(h):!1}function vu(a,h){a.g?a.g.add(h):a.h=h}function hd(a,h){a.h&&a.h==h?a.h=null:a.g&&a.g.has(h)&&a.g.delete(h)}ud.prototype.cancel=function(){if(this.i=dd(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let a of this.g.values())a.cancel();this.g.clear()}};function dd(a){if(a.h!=null)return a.i.concat(a.h.G);if(a.g!=null&&a.g.size!==0){let h=a.i;for(let d of a.g.values())h=h.concat(d.G);return h}return y(a.i)}var fd=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Jw(a,h){if(a){a=a.split("&");for(let d=0;d<a.length;d++){let g=a[d].indexOf("="),R,C=null;g>=0?(R=a[d].substring(0,g),C=a[d].substring(g+1)):R=a[d],h(R,C?decodeURIComponent(C.replace(/\+/g," ")):"")}}}function Kt(a){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let h;a instanceof Kt?(this.l=a.l,As(this,a.j),this.o=a.o,this.g=a.g,Ss(this,a.u),this.h=a.h,bu(this,wd(a.i)),this.m=a.m):a&&(h=String(a).match(fd))?(this.l=!1,As(this,h[1]||"",!0),this.o=xs(h[2]||""),this.g=xs(h[3]||"",!0),Ss(this,h[4]),this.h=xs(h[5]||"",!0),bu(this,h[6]||"",!0),this.m=xs(h[7]||"")):(this.l=!1,this.i=new Ps(null,this.l))}Kt.prototype.toString=function(){let a=[];var h=this.j;h&&a.push(Rs(h,pd,!0),":");var d=this.g;return(d||h=="file")&&(a.push("//"),(h=this.o)&&a.push(Rs(h,pd,!0),"@"),a.push(Ts(d).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),d=this.u,d!=null&&a.push(":",String(d))),(d=this.h)&&(this.g&&d.charAt(0)!="/"&&a.push("/"),a.push(Rs(d,d.charAt(0)=="/"?Xw:Yw,!0))),(d=this.i.toString())&&a.push("?",d),(d=this.m)&&a.push("#",Rs(d,ev)),a.join("")},Kt.prototype.resolve=function(a){let h=it(this),d=!!a.j;d?As(h,a.j):d=!!a.o,d?h.o=a.o:d=!!a.g,d?h.g=a.g:d=a.u!=null;var g=a.h;if(d)Ss(h,a.u);else if(d=!!a.h){if(g.charAt(0)!="/")if(this.g&&!this.h)g="/"+g;else{var R=h.h.lastIndexOf("/");R!=-1&&(g=h.h.slice(0,R+1)+g)}if(R=g,R==".."||R==".")g="";else if(R.indexOf("./")!=-1||R.indexOf("/.")!=-1){g=R.lastIndexOf("/",0)==0,R=R.split("/");let C=[];for(let L=0;L<R.length;){let J=R[L++];J=="."?g&&L==R.length&&C.push(""):J==".."?((C.length>1||C.length==1&&C[0]!="")&&C.pop(),g&&L==R.length&&C.push("")):(C.push(J),g=!0)}g=C.join("/")}else g=R}return d?h.h=g:d=a.i.toString()!=="",d?bu(h,wd(a.i)):d=!!a.m,d&&(h.m=a.m),h};function it(a){return new Kt(a)}function As(a,h,d){a.j=d?xs(h,!0):h,a.j&&(a.j=a.j.replace(/:$/,""))}function Ss(a,h){if(h){if(h=Number(h),isNaN(h)||h<0)throw Error("Bad port number "+h);a.u=h}else a.u=null}function bu(a,h,d){h instanceof Ps?(a.i=h,tv(a.i,a.l)):(d||(h=Rs(h,Zw)),a.i=new Ps(h,a.l))}function ae(a,h,d){a.i.set(h,d)}function Ki(a){return ae(a,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),a}function xs(a,h){return a?h?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function Rs(a,h,d){return typeof a=="string"?(a=encodeURI(a).replace(h,Qw),d&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function Qw(a){return a=a.charCodeAt(0),"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var pd=/[#\/\?@]/g,Yw=/[#\?:]/g,Xw=/[#\?]/g,Zw=/[#\?@]/g,ev=/#/g;function Ps(a,h){this.h=this.g=null,this.i=a||null,this.j=!!h}function br(a){a.g||(a.g=new Map,a.h=0,a.i&&Jw(a.i,function(h,d){a.add(decodeURIComponent(h.replace(/\+/g," ")),d)}))}r=Ps.prototype,r.add=function(a,h){br(this),this.i=null,a=an(this,a);let d=this.g.get(a);return d||this.g.set(a,d=[]),d.push(h),this.h+=1,this};function md(a,h){br(a),h=an(a,h),a.g.has(h)&&(a.i=null,a.h-=a.g.get(h).length,a.g.delete(h))}function gd(a,h){return br(a),h=an(a,h),a.g.has(h)}r.forEach=function(a,h){br(this),this.g.forEach(function(d,g){d.forEach(function(R){a.call(h,R,g,this)},this)},this)};function yd(a,h){br(a);let d=[];if(typeof h=="string")gd(a,h)&&(d=d.concat(a.g.get(an(a,h))));else for(a=Array.from(a.g.values()),h=0;h<a.length;h++)d=d.concat(a[h]);return d}r.set=function(a,h){return br(this),this.i=null,a=an(this,a),gd(this,a)&&(this.h-=this.g.get(a).length),this.g.set(a,[h]),this.h+=1,this},r.get=function(a,h){return a?(a=yd(this,a),a.length>0?String(a[0]):h):h};function _d(a,h,d){md(a,h),d.length>0&&(a.i=null,a.g.set(an(a,h),y(d)),a.h+=d.length)}r.toString=function(){if(this.i)return this.i;if(!this.g)return"";let a=[],h=Array.from(this.g.keys());for(let g=0;g<h.length;g++){var d=h[g];let R=Ts(d);d=yd(this,d);for(let C=0;C<d.length;C++){let L=R;d[C]!==""&&(L+="="+Ts(d[C])),a.push(L)}}return this.i=a.join("&")};function wd(a){let h=new Ps;return h.i=a.i,a.g&&(h.g=new Map(a.g),h.h=a.h),h}function an(a,h){return h=String(h),a.j&&(h=h.toLowerCase()),h}function tv(a,h){h&&!a.j&&(br(a),a.i=null,a.g.forEach(function(d,g){let R=g.toLowerCase();g!=R&&(md(this,g),_d(this,R,d))},a)),a.j=h}function rv(a,h){let d=new Es;if(o.Image){let g=new Image;g.onload=f(Gt,d,"TestLoadImage: loaded",!0,h,g),g.onerror=f(Gt,d,"TestLoadImage: error",!1,h,g),g.onabort=f(Gt,d,"TestLoadImage: abort",!1,h,g),g.ontimeout=f(Gt,d,"TestLoadImage: timeout",!1,h,g),o.setTimeout(function(){g.ontimeout&&g.ontimeout()},1e4),g.src=a}else h(!1)}function nv(a,h){let d=new Es,g=new AbortController,R=setTimeout(()=>{g.abort(),Gt(d,"TestPingServer: timeout",!1,h)},1e4);fetch(a,{signal:g.signal}).then(C=>{clearTimeout(R),C.ok?Gt(d,"TestPingServer: ok",!0,h):Gt(d,"TestPingServer: server error",!1,h)}).catch(()=>{clearTimeout(R),Gt(d,"TestPingServer: error",!1,h)})}function Gt(a,h,d,g,R){try{R&&(R.onload=null,R.onerror=null,R.onabort=null,R.ontimeout=null),g(d)}catch{}}function sv(){this.g=new Uw}function Gi(a){this.i=a.Sb||null,this.h=a.ab||!1}p(Gi,Jh),Gi.prototype.g=function(){return new Wi(this.i,this.h)};function Wi(a,h){De.call(this),this.H=a,this.o=h,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}p(Wi,De),r=Wi.prototype,r.open=function(a,h){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=a,this.D=h,this.readyState=1,ks(this)},r.send=function(a){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;let h={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};a&&(h.body=a),(this.H||o).fetch(new Request(this.D,h)).then(this.Pa.bind(this),this.ga.bind(this))},r.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,Cs(this)),this.readyState=0},r.Pa=function(a){if(this.g&&(this.l=a,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=a.headers,this.readyState=2,ks(this)),this.g&&(this.readyState=3,ks(this),this.g)))if(this.responseType==="arraybuffer")a.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream!="undefined"&&"body"in a){if(this.j=a.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;vd(this)}else a.text().then(this.Oa.bind(this),this.ga.bind(this))};function vd(a){a.j.read().then(a.Ma.bind(a)).catch(a.ga.bind(a))}r.Ma=function(a){if(this.g){if(this.o&&a.value)this.response.push(a.value);else if(!this.o){var h=a.value?a.value:new Uint8Array(0);(h=this.B.decode(h,{stream:!a.done}))&&(this.response=this.responseText+=h)}a.done?Cs(this):ks(this),this.readyState==3&&vd(this)}},r.Oa=function(a){this.g&&(this.response=this.responseText=a,Cs(this))},r.Na=function(a){this.g&&(this.response=a,Cs(this))},r.ga=function(){this.g&&Cs(this)};function Cs(a){a.readyState=4,a.l=null,a.j=null,a.B=null,ks(a)}r.setRequestHeader=function(a,h){this.A.append(a,h)},r.getResponseHeader=function(a){return this.h&&this.h.get(a.toLowerCase())||""},r.getAllResponseHeaders=function(){if(!this.h)return"";let a=[],h=this.h.entries();for(var d=h.next();!d.done;)d=d.value,a.push(d[0]+": "+d[1]),d=h.next();return a.join(`\r
|
|
7
|
+
`)};function ks(a){a.onreadystatechange&&a.onreadystatechange.call(a)}Object.defineProperty(Wi.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(a){this.m=a?"include":"same-origin"}});function bd(a){let h="";return ji(a,function(d,g){h+=g,h+=":",h+=d,h+=`\r
|
|
8
|
+
`}),h}function Eu(a,h,d){e:{for(g in d){var g=!1;break e}g=!0}g||(d=bd(d),typeof a=="string"?d!=null&&Ts(d):ae(a,h,d))}function he(a){De.call(this),this.headers=new Map,this.L=a||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}p(he,De);var iv=/^https?$/i,ov=["POST","PUT"];r=he.prototype,r.Fa=function(a){this.H=a},r.ea=function(a,h,d,g){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+a);h=h?h.toUpperCase():"GET",this.D=a,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():rd.g(),this.g.onreadystatechange=m(l(this.Ca,this));try{this.B=!0,this.g.open(h,String(a),!0),this.B=!1}catch(C){Ed(this,C);return}if(a=d||"",d=new Map(this.headers),g)if(Object.getPrototypeOf(g)===Object.prototype)for(var R in g)d.set(R,g[R]);else if(typeof g.keys=="function"&&typeof g.get=="function")for(let C of g.keys())d.set(C,g.get(C));else throw Error("Unknown input type for opt_headers: "+String(g));g=Array.from(d.keys()).find(C=>C.toLowerCase()=="content-type"),R=o.FormData&&a instanceof o.FormData,!(Array.prototype.indexOf.call(ov,h,void 0)>=0)||g||R||d.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(let[C,L]of d)this.g.setRequestHeader(C,L);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(a),this.v=!1}catch(C){Ed(this,C)}};function Ed(a,h){a.h=!1,a.g&&(a.j=!0,a.g.abort(),a.j=!1),a.l=h,a.o=5,Td(a),Hi(a)}function Td(a){a.A||(a.A=!0,Le(a,"complete"),Le(a,"error"))}r.abort=function(a){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=a||7,Le(this,"complete"),Le(this,"abort"),Hi(this))},r.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Hi(this,!0)),he.Z.N.call(this)},r.Ca=function(){this.u||(this.B||this.v||this.j?Id(this):this.Xa())},r.Xa=function(){Id(this)};function Id(a){if(a.h&&typeof i!="undefined"){if(a.v&&Wt(a)==4)setTimeout(a.Ca.bind(a),0);else if(Le(a,"readystatechange"),Wt(a)==4){a.h=!1;try{let C=a.ca();e:switch(C){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var h=!0;break e;default:h=!1}var d;if(!(d=h)){var g;if(g=C===0){let L=String(a.D).match(fd)[1]||null;!L&&o.self&&o.self.location&&(L=o.self.location.protocol.slice(0,-1)),g=!iv.test(L?L.toLowerCase():"")}d=g}if(d)Le(a,"complete"),Le(a,"success");else{a.o=6;try{var R=Wt(a)>2?a.g.statusText:""}catch{R=""}a.l=R+" ["+a.ca()+"]",Td(a)}}finally{Hi(a)}}}}function Hi(a,h){if(a.g){a.m&&(clearTimeout(a.m),a.m=null);let d=a.g;a.g=null,h||Le(a,"ready");try{d.onreadystatechange=null}catch{}}}r.isActive=function(){return!!this.g};function Wt(a){return a.g?a.g.readyState:0}r.ca=function(){try{return Wt(this)>2?this.g.status:-1}catch{return-1}},r.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},r.La=function(a){if(this.g){var h=this.g.responseText;return a&&h.indexOf(a)==0&&(h=h.substring(a.length)),jw(h)}};function Ad(a){try{if(!a.g)return null;if("response"in a.g)return a.g.response;switch(a.F){case"":case"text":return a.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in a.g)return a.g.mozResponseArrayBuffer}return null}catch{return null}}function av(a){let h={};a=(a.g&&Wt(a)>=2&&a.g.getAllResponseHeaders()||"").split(`\r
|
|
9
|
+
`);for(let g=0;g<a.length;g++){if(E(a[g]))continue;var d=Kw(a[g]);let R=d[0];if(d=d[1],typeof d!="string")continue;d=d.trim();let C=h[R]||[];h[R]=C,C.push(d)}Nw(h,function(g){return g.join(", ")})}r.ya=function(){return this.o},r.Ha=function(){return typeof this.l=="string"?this.l:String(this.l)};function Os(a,h,d){return d&&d.internalChannelParams&&d.internalChannelParams[a]||h}function Sd(a){this.za=0,this.i=[],this.j=new Es,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Os("failFast",!1,a),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Os("baseRetryDelayMs",5e3,a),this.Za=Os("retryDelaySeedMs",1e4,a),this.Ta=Os("forwardChannelMaxRetries",2,a),this.va=Os("forwardChannelRequestTimeoutMs",2e4,a),this.ma=a&&a.xmlHttpFactory||void 0,this.Ua=a&&a.Rb||void 0,this.Aa=a&&a.useFetchStreams||!1,this.O=void 0,this.L=a&&a.supportsCrossDomainXhr||!1,this.M="",this.h=new ud(a&&a.concurrentRequestLimit),this.Ba=new sv,this.S=a&&a.fastHandshake||!1,this.R=a&&a.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=a&&a.Pb||!1,a&&a.ua&&this.j.ua(),a&&a.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&a&&a.detectBufferingProxy||!1,this.ia=void 0,a&&a.longPollingTimeout&&a.longPollingTimeout>0&&(this.ia=a.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}r=Sd.prototype,r.ka=8,r.I=1,r.connect=function(a,h,d,g){Fe(0),this.W=a,this.H=h||{},d&&g!==void 0&&(this.H.OSID=d,this.H.OAID=g),this.F=this.X,this.J=Vd(this,null,this.W),Qi(this)};function Tu(a){if(xd(a),a.I==3){var h=a.V++,d=it(a.J);if(ae(d,"SID",a.M),ae(d,"RID",h),ae(d,"TYPE","terminate"),Ds(a,d),h=new zt(a,a.j,h),h.M=2,h.A=Ki(it(d)),d=!1,o.navigator&&o.navigator.sendBeacon)try{d=o.navigator.sendBeacon(h.A.toString(),"")}catch{}!d&&o.Image&&(new Image().src=h.A,d=!0),d||(h.g=Ld(h.j,null),h.g.ea(h.A)),h.F=Date.now(),zi(h)}Nd(a)}function Ji(a){a.g&&(Au(a),a.g.cancel(),a.g=null)}function xd(a){Ji(a),a.v&&(o.clearTimeout(a.v),a.v=null),Yi(a),a.h.cancel(),a.m&&(typeof a.m=="number"&&o.clearTimeout(a.m),a.m=null)}function Qi(a){if(!cd(a.h)&&!a.m){a.m=!0;var h=a.Ea;B||_(),F||(B(),F=!0),w.add(h,a),a.D=0}}function uv(a,h){return ld(a.h)>=a.h.j-(a.m?1:0)?!1:a.m?(a.i=h.G.concat(a.i),!0):a.I==1||a.I==2||a.D>=(a.Sa?0:a.Ta)?!1:(a.m=bs(l(a.Ea,a,h),Dd(a,a.D)),a.D++,!0)}r.Ea=function(a){if(this.m)if(this.m=null,this.I==1){if(!a){this.V=Math.floor(Math.random()*1e5),a=this.V++;let R=new zt(this,this.j,a),C=this.o;if(this.U&&(C?(C=Mh(C),Uh(C,this.U)):C=this.U),this.u!==null||this.R||(R.J=C,C=null),this.S)e:{for(var h=0,d=0;d<this.i.length;d++){t:{var g=this.i[d];if("__data__"in g.map&&(g=g.map.__data__,typeof g=="string")){g=g.length;break t}g=void 0}if(g===void 0)break;if(h+=g,h>4096){h=d;break e}if(h===4096||d===this.i.length-1){h=d+1;break e}}h=1e3}else h=1e3;h=Pd(this,R,h),d=it(this.J),ae(d,"RID",a),ae(d,"CVER",22),this.G&&ae(d,"X-HTTP-Session-Id",this.G),Ds(this,d),C&&(this.R?h="headers="+Ts(bd(C))+"&"+h:this.u&&Eu(d,this.u,C)),vu(this.h,R),this.Ra&&ae(d,"TYPE","init"),this.S?(ae(d,"$req",h),ae(d,"SID","null"),R.U=!0,gu(R,d,null)):gu(R,d,h),this.I=2}}else this.I==3&&(a?Rd(this,a):this.i.length==0||cd(this.h)||Rd(this))};function Rd(a,h){var d;h?d=h.l:d=a.V++;let g=it(a.J);ae(g,"SID",a.M),ae(g,"RID",d),ae(g,"AID",a.K),Ds(a,g),a.u&&a.o&&Eu(g,a.u,a.o),d=new zt(a,a.j,d,a.D+1),a.u===null&&(d.J=a.o),h&&(a.i=h.G.concat(a.i)),h=Pd(a,d,1e3),d.H=Math.round(a.va*.5)+Math.round(a.va*.5*Math.random()),vu(a.h,d),gu(d,g,h)}function Ds(a,h){a.H&&ji(a.H,function(d,g){ae(h,g,d)}),a.l&&ji({},function(d,g){ae(h,g,d)})}function Pd(a,h,d){d=Math.min(a.i.length,d);let g=a.l?l(a.l.Ka,a.l,a):null;e:{var R=a.i;let J=-1;for(;;){let Te=["count="+d];J==-1?d>0?(J=R[0].g,Te.push("ofs="+J)):J=0:Te.push("ofs="+J);let ne=!0;for(let xe=0;xe<d;xe++){var C=R[xe].g;let ot=R[xe].map;if(C-=J,C<0)J=Math.max(0,R[xe].g-100),ne=!1;else try{C="req"+C+"_"||"";try{var L=ot instanceof Map?ot:Object.entries(ot);for(let[Tr,Ht]of L){let Jt=Ht;u(Ht)&&(Jt=hu(Ht)),Te.push(C+Tr+"="+encodeURIComponent(Jt))}}catch(Tr){throw Te.push(C+"type="+encodeURIComponent("_badmap")),Tr}}catch{g&&g(ot)}}if(ne){L=Te.join("&");break e}}L=void 0}return a=a.i.splice(0,d),h.G=a,L}function Cd(a){if(!a.g&&!a.v){a.Y=1;var h=a.Da;B||_(),F||(B(),F=!0),w.add(h,a),a.A=0}}function Iu(a){return a.g||a.v||a.A>=3?!1:(a.Y++,a.v=bs(l(a.Da,a),Dd(a,a.A)),a.A++,!0)}r.Da=function(){if(this.v=null,kd(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var a=4*this.T;this.j.info("BP detection timer enabled: "+a),this.B=bs(l(this.Wa,this),a)}},r.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,Fe(10),Ji(this),kd(this))};function Au(a){a.B!=null&&(o.clearTimeout(a.B),a.B=null)}function kd(a){a.g=new zt(a,a.j,"rpc",a.Y),a.u===null&&(a.g.J=a.o),a.g.P=0;var h=it(a.na);ae(h,"RID","rpc"),ae(h,"SID",a.M),ae(h,"AID",a.K),ae(h,"CI",a.F?"0":"1"),!a.F&&a.ia&&ae(h,"TO",a.ia),ae(h,"TYPE","xmlhttp"),Ds(a,h),a.u&&a.o&&Eu(h,a.u,a.o),a.O&&(a.g.H=a.O);var d=a.g;a=a.ba,d.M=1,d.A=Ki(it(h)),d.u=null,d.R=!0,id(d,a)}r.Va=function(){this.C!=null&&(this.C=null,Ji(this),Iu(this),Fe(19))};function Yi(a){a.C!=null&&(o.clearTimeout(a.C),a.C=null)}function Od(a,h){var d=null;if(a.g==h){Yi(a),Au(a),a.g=null;var g=2}else if(wu(a.h,h))d=h.G,hd(a.h,h),g=1;else return;if(a.I!=0){if(h.o)if(g==1){d=h.u?h.u.length:0,h=Date.now()-h.F;var R=a.D;g=$i(),Le(g,new ed(g,d)),Qi(a)}else Cd(a);else if(R=h.m,R==3||R==0&&h.X>0||!(g==1&&uv(a,h)||g==2&&Iu(a)))switch(d&&d.length>0&&(h=a.h,h.i=h.i.concat(d)),R){case 1:Er(a,5);break;case 4:Er(a,10);break;case 3:Er(a,6);break;default:Er(a,2)}}}function Dd(a,h){let d=a.Qa+Math.floor(Math.random()*a.Za);return a.isActive()||(d*=2),d*h}function Er(a,h){if(a.j.info("Error code "+h),h==2){var d=l(a.bb,a),g=a.Ua;let R=!g;g=new Kt(g||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||As(g,"https"),Ki(g),R?rv(g.toString(),d):nv(g.toString(),d)}else Fe(2);a.I=0,a.l&&a.l.pa(h),Nd(a),xd(a)}r.bb=function(a){a?(this.j.info("Successfully pinged google.com"),Fe(2)):(this.j.info("Failed to ping google.com"),Fe(1))};function Nd(a){if(a.I=0,a.ja=[],a.l){let h=dd(a.h);(h.length!=0||a.i.length!=0)&&(T(a.ja,h),T(a.ja,a.i),a.h.i.length=0,y(a.i),a.i.length=0),a.l.oa()}}function Vd(a,h,d){var g=d instanceof Kt?it(d):new Kt(d);if(g.g!="")h&&(g.g=h+"."+g.g),Ss(g,g.u);else{var R=o.location;g=R.protocol,h=h?h+"."+R.hostname:R.hostname,R=+R.port;let C=new Kt(null);g&&As(C,g),h&&(C.g=h),R&&Ss(C,R),d&&(C.h=d),g=C}return d=a.G,h=a.wa,d&&h&&ae(g,d,h),ae(g,"VER",a.ka),Ds(a,g),g}function Ld(a,h,d){if(h&&!a.L)throw Error("Can't create secondary domain capable XhrIo object.");return h=a.Aa&&!a.ma?new he(new Gi({ab:d})):new he(a.ma),h.Fa(a.L),h}r.isActive=function(){return!!this.l&&this.l.isActive(this)};function Fd(){}r=Fd.prototype,r.ra=function(){},r.qa=function(){},r.pa=function(){},r.oa=function(){},r.isActive=function(){return!0},r.Ka=function(){};function Xi(){}Xi.prototype.g=function(a,h){return new ze(a,h)};function ze(a,h){De.call(this),this.g=new Sd(h),this.l=a,this.h=h&&h.messageUrlParams||null,a=h&&h.messageHeaders||null,h&&h.clientProtocolHeaderRequired&&(a?a["X-Client-Protocol"]="webchannel":a={"X-Client-Protocol":"webchannel"}),this.g.o=a,a=h&&h.initMessageHeaders||null,h&&h.messageContentType&&(a?a["X-WebChannel-Content-Type"]=h.messageContentType:a={"X-WebChannel-Content-Type":h.messageContentType}),h&&h.sa&&(a?a["X-WebChannel-Client-Profile"]=h.sa:a={"X-WebChannel-Client-Profile":h.sa}),this.g.U=a,(a=h&&h.Qb)&&!E(a)&&(this.g.u=a),this.A=h&&h.supportsCrossDomainXhr||!1,this.v=h&&h.sendRawJson||!1,(h=h&&h.httpSessionIdParam)&&!E(h)&&(this.g.G=h,a=this.h,a!==null&&h in a&&(a=this.h,h in a&&delete a[h])),this.j=new un(this)}p(ze,De),ze.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},ze.prototype.close=function(){Tu(this.g)},ze.prototype.o=function(a){var h=this.g;if(typeof a=="string"){var d={};d.__data__=a,a=d}else this.v&&(d={},d.__data__=hu(a),a=d);h.i.push(new Hw(h.Ya++,a)),h.I==3&&Qi(h)},ze.prototype.N=function(){this.g.l=null,delete this.j,Tu(this.g),delete this.g,ze.Z.N.call(this)};function Md(a){du.call(this),a.__headers__&&(this.headers=a.__headers__,this.statusCode=a.__status__,delete a.__headers__,delete a.__status__);var h=a.__sm__;if(h){e:{for(let d in h){a=d;break e}a=void 0}(this.i=a)&&(a=this.i,h=h!==null&&a in h?h[a]:void 0),this.data=h}else this.data=a}p(Md,du);function jd(){fu.call(this),this.status=1}p(jd,fu);function un(a){this.g=a}p(un,Fd),un.prototype.ra=function(){Le(this.g,"a")},un.prototype.qa=function(a){Le(this.g,new Md(a))},un.prototype.pa=function(a){Le(this.g,new jd)},un.prototype.oa=function(){Le(this.g,"b")},Xi.prototype.createWebChannel=Xi.prototype.g,ze.prototype.send=ze.prototype.o,ze.prototype.open=ze.prototype.m,ze.prototype.close=ze.prototype.close,oc=Ct.createWebChannelTransport=function(){return new Xi},ic=Ct.getStatEventTarget=function(){return $i()},sc=Ct.Event=wr,ko=Ct.Stat={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},qi.NO_ERROR=0,qi.TIMEOUT=8,qi.HTTP_ERROR=6,qs=Ct.ErrorCode=qi,td.COMPLETE="complete",nc=Ct.EventType=td,Qh.EventType=ws,ws.OPEN="a",ws.CLOSE="b",ws.ERROR="c",ws.MESSAGE="d",De.prototype.listen=De.prototype.J,Rn=Ct.WebChannel=Qh,zS=Ct.FetchXmlHttpFactory=Gi,he.prototype.listenOnce=he.prototype.K,he.prototype.getLastError=he.prototype.Ha,he.prototype.getLastErrorCode=he.prototype.ya,he.prototype.getStatus=he.prototype.ca,he.prototype.getResponseJson=he.prototype.La,he.prototype.getResponseText=he.prototype.la,he.prototype.send=he.prototype.ea,he.prototype.setWithCredentials=he.prototype.Fa,rc=Ct.XhrIo=he}).apply(typeof Co!="undefined"?Co:typeof self!="undefined"?self:typeof window!="undefined"?window:{});var Re=class{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}};Re.UNAUTHENTICATED=new Re(null),Re.GOOGLE_CREDENTIALS=new Re("google-credentials-uid"),Re.FIRST_PARTY=new Re("first-party-uid"),Re.MOCK_USER=new Re("mock-user");var Yn="12.11.0";function Pg(r){Yn=r}var Cr=new xn("@firebase/firestore");function Pn(){return Cr.logLevel}function j(r,...e){if(Cr.logLevel<=X.DEBUG){let t=e.map(Ml);Cr.debug(`Firestore (${Yn}): ${r}`,...t)}}function Dt(r,...e){if(Cr.logLevel<=X.ERROR){let t=e.map(Ml);Cr.error(`Firestore (${Yn}): ${r}`,...t)}}function Nt(r,...e){if(Cr.logLevel<=X.WARN){let t=e.map(Ml);Cr.warn(`Firestore (${Yn}): ${r}`,...t)}}function Ml(r){if(typeof r=="string")return r;try{return(function(t){return JSON.stringify(t)})(r)}catch{return r}}function K(r,e,t){let n="Unexpected state";typeof e=="string"?n=e:t=e,Cg(r,n,t)}function Cg(r,e,t){let n=`FIRESTORE (${Yn}) INTERNAL ASSERTION FAILED: ${e} (ID: ${r.toString(16)})`;if(t!==void 0)try{n+=" CONTEXT: "+JSON.stringify(t)}catch{n+=" CONTEXT: "+t}throw Dt(n),new Error(n)}function te(r,e,t,n){let s="Unexpected state";typeof t=="string"?s=t:n=t,r||Cg(e,s,n)}function W(r,e){return r}var N={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},$=class extends et{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};var ht=class{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}};var Mo=class{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}},jo=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(Re.UNAUTHENTICATED)))}shutdown(){}},fc=class{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable((()=>t(this.token.user)))}shutdown(){this.changeListener=null}},Uo=class{constructor(e){this.t=e,this.currentUser=Re.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){te(this.o===void 0,42304);let n=this.i,s=c=>this.i!==n?(n=this.i,t(c)):Promise.resolve(),i=new ht;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new ht,e.enqueueRetryable((()=>s(this.currentUser)))};let o=()=>{let c=i;e.enqueueRetryable((async()=>{await c.promise,await s(this.currentUser)}))},u=c=>{j("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit((c=>u(c))),setTimeout((()=>{if(!this.auth){let c=this.t.getImmediate({optional:!0});c?u(c):(j("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new ht)}}),0),o()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((n=>this.i!==e?(j("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):n?(te(typeof n.accessToken=="string",31837,{l:n}),new Mo(n.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){let e=this.auth&&this.auth.getUid();return te(e===null||typeof e=="string",2055,{h:e}),new Re(e)}},pc=class{constructor(e,t,n){this.P=e,this.T=t,this.I=n,this.type="FirstParty",this.user=Re.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);let e=this.A();return e&&this.R.set("Authorization",e),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}},mc=class{constructor(e,t,n){this.P=e,this.T=t,this.I=n}getToken(){return Promise.resolve(new pc(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable((()=>t(Re.FIRST_PARTY)))}shutdown(){}invalidateToken(){}},Bo=class{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}},$o=class{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Mm(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){te(this.o===void 0,3512);let n=i=>{i.error!=null&&j("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);let o=i.token!==this.m;return this.m=i.token,j("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?t(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable((()=>n(i)))};let s=i=>{j("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((i=>s(i))),setTimeout((()=>{if(!this.appCheck){let i=this.V.getImmediate({optional:!0});i?s(i):j("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new Bo(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((t=>t?(te(typeof t.token=="string",44558,{tokenResult:t}),this.m=t.token,new Bo(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function KS(r){let e=typeof self!="undefined"&&(self.crypto||self.msCrypto),t=new Uint8Array(r);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let n=0;n<r;n++)t[n]=Math.floor(256*Math.random());return t}var kr=class{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(4.129032258064516),n="";for(;n.length<20;){let s=KS(40);for(let i=0;i<s.length;++i)n.length<20&&s[i]<t&&(n+=e.charAt(s[i]%62))}return n}};function Y(r,e){return r<e?-1:r>e?1:0}function gc(r,e){let t=Math.min(r.length,e.length);for(let n=0;n<t;n++){let s=r.charAt(n),i=e.charAt(n);if(s!==i)return ac(s)===ac(i)?Y(s,i):ac(s)?1:-1}return Y(r.length,e.length)}var GS=55296,WS=57343;function ac(r){let e=r.charCodeAt(0);return e>=GS&&e<=WS}function Ln(r,e,t){return r.length===e.length&&r.every(((n,s)=>t(n,e[s])))}var Km="__name__",qo=class r{constructor(e,t,n){t===void 0?t=0:t>e.length&&K(637,{offset:t,range:e.length}),n===void 0?n=e.length-t:n>e.length-t&&K(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return r.comparator(this,e)===0}child(e){let t=this.segments.slice(this.offset,this.limit());return e instanceof r?e.forEach((n=>{t.push(n)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){let n=Math.min(e.length,t.length);for(let s=0;s<n;s++){let i=r.compareSegments(e.get(s),t.get(s));if(i!==0)return i}return Y(e.length,t.length)}static compareSegments(e,t){let n=r.isNumericId(e),s=r.isNumericId(t);return n&&!s?-1:!n&&s?1:n&&s?r.extractNumericId(e).compare(r.extractNumericId(t)):gc(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Pt.fromString(e.substring(4,e.length-2))}},fe=class r extends qo{construct(e,t,n){return new r(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let t=[];for(let n of e){if(n.indexOf("//")>=0)throw new $(N.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter((s=>s.length>0)))}return new r(t)}static emptyPath(){return new r([])}},HS=/^[_a-zA-Z][_a-zA-Z0-9]*$/,qe=class r extends qo{construct(e,t,n){return new r(e,t,n)}static isValidIdentifier(e){return HS.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),r.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Km}static keyField(){return new r([Km])}static fromServerFormat(e){let t=[],n="",s=0,i=()=>{if(n.length===0)throw new $(N.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""},o=!1;for(;s<e.length;){let u=e[s];if(u==="\\"){if(s+1===e.length)throw new $(N.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let c=e[s+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new $(N.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=c,s+=2}else u==="`"?(o=!o,s++):u!=="."||o?(n+=u,s++):(i(),s++)}if(i(),o)throw new $(N.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new r(t)}static emptyPath(){return new r([])}};var z=class r{constructor(e){this.path=e}static fromPath(e){return new r(fe.fromString(e))}static fromName(e){return new r(fe.fromString(e).popFirst(5))}static empty(){return new r(fe.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&fe.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return fe.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new r(new fe(e.slice()))}};function JS(r,e,t){if(!t)throw new $(N.INVALID_ARGUMENT,`Function ${r}() cannot be called with an empty ${e}.`)}function kg(r,e,t,n){if(e===!0&&n===!0)throw new $(N.INVALID_ARGUMENT,`${r} and ${t} cannot be used together.`)}function Gm(r){if(!z.isDocumentKey(r))throw new $(N.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${r} has ${r.length}.`)}function Og(r){return typeof r=="object"&&r!==null&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function ba(r){if(r===void 0)return"undefined";if(r===null)return"null";if(typeof r=="string")return r.length>20&&(r=`${r.substring(0,20)}...`),JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean")return""+r;if(typeof r=="object"){if(r instanceof Array)return"an array";{let e=(function(n){return n.constructor?n.constructor.name:null})(r);return e?`a custom ${e} object`:"an object"}}return typeof r=="function"?"a function":K(12329,{type:typeof r})}function Je(r,e){if("_delegate"in r&&(r=r._delegate),!(r instanceof e)){if(e.name===r.constructor.name)throw new $(N.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let t=ba(r);throw new $(N.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return r}function ye(r,e){let t={typeString:r};return e&&(t.value=e),t}function Xn(r,e){if(!Og(r))throw new $(N.INVALID_ARGUMENT,"JSON must be an object");let t;for(let n in e)if(e[n]){let s=e[n].typeString,i="value"in e[n]?{value:e[n].value}:void 0;if(!(n in r)){t=`JSON missing required field: '${n}'`;break}let o=r[n];if(s&&typeof o!==s){t=`JSON field '${n}' must be a ${s}.`;break}if(i!==void 0&&o!==i.value){t=`Expected '${n}' field to equal '${i.value}'`;break}}if(t)throw new $(N.INVALID_ARGUMENT,t);return!0}var Wm=-62135596800,Hm=1e6,_e=class r{static now(){return r.fromMillis(Date.now())}static fromDate(e){return r.fromMillis(e.getTime())}static fromMillis(e){let t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*Hm);return new r(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new $(N.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new $(N.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<Wm)throw new $(N.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new $(N.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Hm}_compareTo(e){return this.seconds===e.seconds?Y(this.nanoseconds,e.nanoseconds):Y(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:r._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Xn(e,r._jsonSchema))return new r(e.seconds,e.nanoseconds)}valueOf(){let e=this.seconds-Wm;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};_e._jsonSchemaVersion="firestore/timestamp/1.0",_e._jsonSchema={type:ye("string",_e._jsonSchemaVersion),seconds:ye("number"),nanoseconds:ye("number")};var H=class r{static fromTimestamp(e){return new r(e)}static min(){return new r(new _e(0,0))}static max(){return new r(new _e(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}};var Js=-1,zo=class{constructor(e,t,n,s){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=s}};zo.UNKNOWN_ID=-1;function QS(r,e){let t=r.toTimestamp().seconds,n=r.toTimestamp().nanoseconds+1,s=H.fromTimestamp(n===1e9?new _e(t+1,0):new _e(t,n));return new Or(s,z.empty(),e)}function YS(r){return new Or(r.readTime,r.key,Js)}var Or=class r{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new r(H.min(),z.empty(),Js)}static max(){return new r(H.max(),z.empty(),Js)}};function XS(r,e){let t=r.readTime.compareTo(e.readTime);return t!==0?t:(t=z.comparator(r.documentKey,e.documentKey),t!==0?t:Y(r.largestBatchId,e.largestBatchId))}var ZS="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",yc=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}};async function Zn(r){if(r.code!==N.FAILED_PRECONDITION||r.message!==ZS)throw r;j("LocalStore","Unexpectedly lost primary lease")}var V=class r{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&K(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new r(((n,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(n,s)},this.catchCallback=i=>{this.wrapFailure(t,i).next(n,s)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{let t=e();return t instanceof r?t:r.resolve(t)}catch(t){return r.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):r.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):r.reject(t)}static resolve(e){return new r(((t,n)=>{t(e)}))}static reject(e){return new r(((t,n)=>{n(e)}))}static waitFor(e){return new r(((t,n)=>{let s=0,i=0,o=!1;e.forEach((u=>{++s,u.next((()=>{++i,o&&i===s&&t()}),(c=>n(c)))})),o=!0,i===s&&t()}))}static or(e){let t=r.resolve(!1);for(let n of e)t=t.next((s=>s?r.resolve(s):n()));return t}static forEach(e,t){let n=[];return e.forEach(((s,i)=>{n.push(t.call(this,s,i))})),this.waitFor(n)}static mapArray(e,t){return new r(((n,s)=>{let i=e.length,o=new Array(i),u=0;for(let c=0;c<i;c++){let l=c;t(e[l]).next((f=>{o[l]=f,++u,u===i&&n(o)}),(f=>s(f)))}}))}static doWhile(e,t){return new r(((n,s)=>{let i=()=>{e()===!0?t().next((()=>{i()}),s):n()};i()}))}};function ex(r){let e=r.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function es(r){return r.name==="IndexedDbTransactionError"}var Fn=class{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=n=>this.ae(n),this.ue=n=>t.writeSequenceNumber(n))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ue&&this.ue(e),e}};Fn.ce=-1;var jl=-1;function Ea(r){return r==null}function Qs(r){return r===0&&1/r==-1/0}function tx(r){return typeof r=="number"&&Number.isInteger(r)&&!Qs(r)&&r<=Number.MAX_SAFE_INTEGER&&r>=Number.MIN_SAFE_INTEGER}var Dg="";function rx(r){let e="";for(let t=0;t<r.length;t++)e.length>0&&(e=Jm(e)),e=nx(r.get(t),e);return Jm(e)}function nx(r,e){let t=e,n=r.length;for(let s=0;s<n;s++){let i=r.charAt(s);switch(i){case"\0":t+="";break;case Dg:t+="";break;default:t+=i}}return t}function Jm(r){return r+Dg+""}var sx="remoteDocuments",Ng="owner";var Vg="mutationQueues";var Lg="mutations";var Fg="documentMutations",ix="remoteDocumentsV14";var Mg="remoteDocumentGlobal";var jg="targets";var Ug="targetDocuments";var Bg="targetGlobal",$g="collectionParents";var qg="clientMetadata";var zg="bundles";var Kg="namedQueries";var ox="indexConfiguration";var ax="indexState";var ux="indexEntries";var Gg="documentOverlays";var cx="globals";var lx=[Vg,Lg,Fg,sx,jg,Ng,Bg,Ug,qg,Mg,$g,zg,Kg],Ej=[...lx,Gg],hx=[Vg,Lg,Fg,ix,jg,Ng,Bg,Ug,qg,Mg,$g,zg,Kg,Gg],dx=hx,fx=[...dx,ox,ax,ux];var Tj=[...fx,cx];function Qm(r){let e=0;for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e++;return e}function pr(r,e){for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e(t,r[t])}function Wg(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}var pe=class r{constructor(e,t){this.comparator=e,this.root=t||dt.EMPTY}insert(e,t){return new r(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,dt.BLACK,null,null))}remove(e){return new r(this.comparator,this.root.remove(e,this.comparator).copy(null,null,dt.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){let n=this.comparator(e,t.key);if(n===0)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){let s=this.comparator(e,n.key);if(s===0)return t+n.left.size;s<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,n)=>(e(t,n),!1)))}toString(){let e=[];return this.inorderTraversal(((t,n)=>(e.push(`${t}:${n}`),!1))),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new Dn(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Dn(this.root,e,this.comparator,!1)}getReverseIterator(){return new Dn(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Dn(this.root,e,this.comparator,!0)}},Dn=class{constructor(e,t,n,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?n(e.key,t):1,t&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}},dt=class r{constructor(e,t,n,s,i){this.key=e,this.value=t,this.color=n!=null?n:r.RED,this.left=s!=null?s:r.EMPTY,this.right=i!=null?i:r.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,s,i){return new r(e!=null?e:this.key,t!=null?t:this.value,n!=null?n:this.color,s!=null?s:this.left,i!=null?i:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let s=this,i=n(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,t,n),null):i===0?s.copy(null,t,null,null,null):s.copy(null,null,null,null,s.right.insert(e,t,n)),s.fixUp()}removeMin(){if(this.left.isEmpty())return r.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let n,s=this;if(t(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,t),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),t(e,s.key)===0){if(s.right.isEmpty())return r.EMPTY;n=s.right.min(),s=s.copy(n.key,n.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,t))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){let e=this.copy(null,null,r.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,r.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){let e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw K(43730,{key:this.key,value:this.value});if(this.right.isRed())throw K(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw K(27949);return e+(this.isRed()?0:1)}};dt.EMPTY=null,dt.RED=!0,dt.BLACK=!1;dt.EMPTY=new class{constructor(){this.size=0}get key(){throw K(57766)}get value(){throw K(16141)}get color(){throw K(16727)}get left(){throw K(29726)}get right(){throw K(36894)}copy(e,t,n,s,i){return this}insert(e,t,n){return new dt(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};var Pe=class r{constructor(e){this.comparator=e,this.data=new pe(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,n)=>(e(t),!1)))}forEachInRange(e,t){let n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){let s=n.getNext();if(this.comparator(s.key,e[1])>=0)return;t(s.key)}}forEachWhile(e,t){let n;for(n=t!==void 0?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Ko(this.data.getIterator())}getIteratorFrom(e){return new Ko(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach((n=>{t=t.add(n)})),t}isEqual(e){if(!(e instanceof r)||this.size!==e.size)return!1;let t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){let s=t.getNext().key,i=n.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){let e=[];return this.forEach((t=>{e.push(t)})),e}toString(){let e=[];return this.forEach((t=>e.push(t))),"SortedSet("+e.toString()+")"}copy(e){let t=new r(this.comparator);return t.data=e,t}},Ko=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};var He=class r{constructor(e){this.fields=e,e.sort(qe.comparator)}static empty(){return new r([])}unionWith(e){let t=new Pe(qe.comparator);for(let n of this.fields)t=t.add(n);for(let n of e)t=t.add(n);return new r(t.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Ln(this.fields,e.fields,((t,n)=>t.isEqual(n)))}};var Go=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};var ke=class r{constructor(e){this.binaryString=e}static fromBase64String(e){let t=(function(s){try{return atob(s)}catch(i){throw typeof DOMException!="undefined"&&i instanceof DOMException?new Go("Invalid base64 string: "+i):i}})(e);return new r(t)}static fromUint8Array(e){let t=(function(s){let i="";for(let o=0;o<s.length;++o)i+=String.fromCharCode(s[o]);return i})(e);return new r(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return(function(t){return btoa(t)})(this.binaryString)}toUint8Array(){return(function(t){let n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Y(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};ke.EMPTY_BYTE_STRING=new ke("");var px=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Vt(r){if(te(!!r,39018),typeof r=="string"){let e=0,t=px.exec(r);if(te(!!t,46558,{timestamp:r}),t[1]){let s=t[1];s=(s+"000000000").substr(0,9),e=Number(s)}let n=new Date(r);return{seconds:Math.floor(n.getTime()/1e3),nanos:e}}return{seconds:ce(r.seconds),nanos:ce(r.nanos)}}function ce(r){return typeof r=="number"?r:typeof r=="string"?Number(r):0}function Lt(r){return typeof r=="string"?ke.fromBase64String(r):ke.fromUint8Array(r)}var Hg="server_timestamp",Jg="__type__",Qg="__previous_value__",Yg="__local_write_time__";function Ta(r){var t,n;return((n=(((t=r==null?void 0:r.mapValue)==null?void 0:t.fields)||{})[Jg])==null?void 0:n.stringValue)===Hg}function Ia(r){let e=r.mapValue.fields[Qg];return Ta(e)?Ia(e):e}function Ys(r){let e=Vt(r.mapValue.fields[Yg].timestampValue);return new _e(e.seconds,e.nanos)}var _c=class{constructor(e,t,n,s,i,o,u,c,l,f,p){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=s,this.ssl=i,this.forceLongPolling=o,this.autoDetectLongPolling=u,this.longPollingOptions=c,this.useFetchStreams=l,this.isUsingEmulator=f,this.apiKey=p}},Wo="(default)",Xs=class r{constructor(e,t){this.projectId=e,this.database=t||Wo}static empty(){return new r("","")}get isDefaultDatabase(){return this.database===Wo}isEqual(e){return e instanceof r&&e.projectId===this.projectId&&e.database===this.database}};function Xg(r,e){if(!Object.prototype.hasOwnProperty.apply(r.options,["projectId"]))throw new $(N.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Xs(r.options.projectId,e)}var Ul="__type__",Zg="__max__",Oo={mapValue:{fields:{__type__:{stringValue:Zg}}}},Bl="__vector__",Mn="value";function hr(r){return"nullValue"in r?0:"booleanValue"in r?1:"integerValue"in r||"doubleValue"in r?2:"timestampValue"in r?3:"stringValue"in r?5:"bytesValue"in r?6:"referenceValue"in r?7:"geoPointValue"in r?8:"arrayValue"in r?9:"mapValue"in r?Ta(r)?4:ty(r)?9007199254740991:ey(r)?10:11:K(28295,{value:r})}function yt(r,e){if(r===e)return!0;let t=hr(r);if(t!==hr(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return r.booleanValue===e.booleanValue;case 4:return Ys(r).isEqual(Ys(e));case 3:return(function(s,i){if(typeof s.timestampValue=="string"&&typeof i.timestampValue=="string"&&s.timestampValue.length===i.timestampValue.length)return s.timestampValue===i.timestampValue;let o=Vt(s.timestampValue),u=Vt(i.timestampValue);return o.seconds===u.seconds&&o.nanos===u.nanos})(r,e);case 5:return r.stringValue===e.stringValue;case 6:return(function(s,i){return Lt(s.bytesValue).isEqual(Lt(i.bytesValue))})(r,e);case 7:return r.referenceValue===e.referenceValue;case 8:return(function(s,i){return ce(s.geoPointValue.latitude)===ce(i.geoPointValue.latitude)&&ce(s.geoPointValue.longitude)===ce(i.geoPointValue.longitude)})(r,e);case 2:return(function(s,i){if("integerValue"in s&&"integerValue"in i)return ce(s.integerValue)===ce(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){let o=ce(s.doubleValue),u=ce(i.doubleValue);return o===u?Qs(o)===Qs(u):isNaN(o)&&isNaN(u)}return!1})(r,e);case 9:return Ln(r.arrayValue.values||[],e.arrayValue.values||[],yt);case 10:case 11:return(function(s,i){let o=s.mapValue.fields||{},u=i.mapValue.fields||{};if(Qm(o)!==Qm(u))return!1;for(let c in o)if(o.hasOwnProperty(c)&&(u[c]===void 0||!yt(o[c],u[c])))return!1;return!0})(r,e);default:return K(52216,{left:r})}}function Zs(r,e){return(r.values||[]).find((t=>yt(t,e)))!==void 0}function jn(r,e){if(r===e)return 0;let t=hr(r),n=hr(e);if(t!==n)return Y(t,n);switch(t){case 0:case 9007199254740991:return 0;case 1:return Y(r.booleanValue,e.booleanValue);case 2:return(function(i,o){let u=ce(i.integerValue||i.doubleValue),c=ce(o.integerValue||o.doubleValue);return u<c?-1:u>c?1:u===c?0:isNaN(u)?isNaN(c)?0:-1:1})(r,e);case 3:return Ym(r.timestampValue,e.timestampValue);case 4:return Ym(Ys(r),Ys(e));case 5:return gc(r.stringValue,e.stringValue);case 6:return(function(i,o){let u=Lt(i),c=Lt(o);return u.compareTo(c)})(r.bytesValue,e.bytesValue);case 7:return(function(i,o){let u=i.split("/"),c=o.split("/");for(let l=0;l<u.length&&l<c.length;l++){let f=Y(u[l],c[l]);if(f!==0)return f}return Y(u.length,c.length)})(r.referenceValue,e.referenceValue);case 8:return(function(i,o){let u=Y(ce(i.latitude),ce(o.latitude));return u!==0?u:Y(ce(i.longitude),ce(o.longitude))})(r.geoPointValue,e.geoPointValue);case 9:return Xm(r.arrayValue,e.arrayValue);case 10:return(function(i,o){var m,y,T,x;let u=i.fields||{},c=o.fields||{},l=(m=u[Mn])==null?void 0:m.arrayValue,f=(y=c[Mn])==null?void 0:y.arrayValue,p=Y(((T=l==null?void 0:l.values)==null?void 0:T.length)||0,((x=f==null?void 0:f.values)==null?void 0:x.length)||0);return p!==0?p:Xm(l,f)})(r.mapValue,e.mapValue);case 11:return(function(i,o){if(i===Oo.mapValue&&o===Oo.mapValue)return 0;if(i===Oo.mapValue)return 1;if(o===Oo.mapValue)return-1;let u=i.fields||{},c=Object.keys(u),l=o.fields||{},f=Object.keys(l);c.sort(),f.sort();for(let p=0;p<c.length&&p<f.length;++p){let m=gc(c[p],f[p]);if(m!==0)return m;let y=jn(u[c[p]],l[f[p]]);if(y!==0)return y}return Y(c.length,f.length)})(r.mapValue,e.mapValue);default:throw K(23264,{he:t})}}function Ym(r,e){if(typeof r=="string"&&typeof e=="string"&&r.length===e.length)return Y(r,e);let t=Vt(r),n=Vt(e),s=Y(t.seconds,n.seconds);return s!==0?s:Y(t.nanos,n.nanos)}function Xm(r,e){let t=r.values||[],n=e.values||[];for(let s=0;s<t.length&&s<n.length;++s){let i=jn(t[s],n[s]);if(i)return i}return Y(t.length,n.length)}function Un(r){return wc(r)}function wc(r){return"nullValue"in r?"null":"booleanValue"in r?""+r.booleanValue:"integerValue"in r?""+r.integerValue:"doubleValue"in r?""+r.doubleValue:"timestampValue"in r?(function(t){let n=Vt(t);return`time(${n.seconds},${n.nanos})`})(r.timestampValue):"stringValue"in r?r.stringValue:"bytesValue"in r?(function(t){return Lt(t).toBase64()})(r.bytesValue):"referenceValue"in r?(function(t){return z.fromName(t).toString()})(r.referenceValue):"geoPointValue"in r?(function(t){return`geo(${t.latitude},${t.longitude})`})(r.geoPointValue):"arrayValue"in r?(function(t){let n="[",s=!0;for(let i of t.values||[])s?s=!1:n+=",",n+=wc(i);return n+"]"})(r.arrayValue):"mapValue"in r?(function(t){let n=Object.keys(t.fields||{}).sort(),s="{",i=!0;for(let o of n)i?i=!1:s+=",",s+=`${o}:${wc(t.fields[o])}`;return s+"}"})(r.mapValue):K(61005,{value:r})}function Vo(r){switch(hr(r)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let e=Ia(r);return e?16+Vo(e):16;case 5:return 2*r.stringValue.length;case 6:return Lt(r.bytesValue).approximateByteSize();case 7:return r.referenceValue.length;case 9:return(function(n){return(n.values||[]).reduce(((s,i)=>s+Vo(i)),0)})(r.arrayValue);case 10:case 11:return(function(n){let s=0;return pr(n.fields,((i,o)=>{s+=i.length+Vo(o)})),s})(r.mapValue);default:throw K(13486,{value:r})}}function vc(r){return!!r&&"integerValue"in r}function $l(r){return!!r&&"arrayValue"in r}function Zm(r){return!!r&&"nullValue"in r}function eg(r){return!!r&&"doubleValue"in r&&isNaN(Number(r.doubleValue))}function Lo(r){return!!r&&"mapValue"in r}function ey(r){var t,n;return((n=(((t=r==null?void 0:r.mapValue)==null?void 0:t.fields)||{})[Ul])==null?void 0:n.stringValue)===Bl}function Gs(r){if(r.geoPointValue)return{geoPointValue:{...r.geoPointValue}};if(r.timestampValue&&typeof r.timestampValue=="object")return{timestampValue:{...r.timestampValue}};if(r.mapValue){let e={mapValue:{fields:{}}};return pr(r.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Gs(n))),e}if(r.arrayValue){let e={arrayValue:{values:[]}};for(let t=0;t<(r.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=Gs(r.arrayValue.values[t]);return e}return{...r}}function ty(r){return(((r.mapValue||{}).fields||{}).__type__||{}).stringValue===Zg}var Aj={mapValue:{fields:{[Ul]:{stringValue:Bl},[Mn]:{arrayValue:{}}}}};var $e=class r{constructor(e){this.value=e}static empty(){return new r({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!Lo(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Gs(t)}setAll(e){let t=qe.emptyPath(),n={},s=[];e.forEach(((o,u)=>{if(!t.isImmediateParentOf(u)){let c=this.getFieldsMap(t);this.applyChanges(c,n,s),n={},s=[],t=u.popLast()}o?n[u.lastSegment()]=Gs(o):s.push(u.lastSegment())}));let i=this.getFieldsMap(t);this.applyChanges(i,n,s)}delete(e){let t=this.field(e.popLast());Lo(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return yt(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let s=t.mapValue.fields[e.get(n)];Lo(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,n){pr(t,((s,i)=>e[s]=i));for(let s of n)delete e[s]}clone(){return new r(Gs(this.value))}};function ry(r){let e=[];return pr(r.fields,((t,n)=>{let s=new qe([t]);if(Lo(n)){let i=ry(n.mapValue).fields;if(i.length===0)e.push(s);else for(let o of i)e.push(s.child(o))}else e.push(s)})),new He(e)}var tt=class r{constructor(e,t,n,s,i,o,u){this.key=e,this.documentType=t,this.version=n,this.readTime=s,this.createTime=i,this.data=o,this.documentState=u}static newInvalidDocument(e){return new r(e,0,H.min(),H.min(),H.min(),$e.empty(),0)}static newFoundDocument(e,t,n,s){return new r(e,1,t,H.min(),n,s,0)}static newNoDocument(e,t){return new r(e,2,t,H.min(),H.min(),$e.empty(),0)}static newUnknownDocument(e,t){return new r(e,3,t,H.min(),H.min(),$e.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(H.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=$e.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=$e.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=H.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof r&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new r(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}};var Dr=class{constructor(e,t){this.position=e,this.inclusive=t}};function tg(r,e,t){let n=0;for(let s=0;s<r.position.length;s++){let i=e[s],o=r.position[s];if(i.field.isKeyField()?n=z.comparator(z.fromName(o.referenceValue),t.key):n=jn(o,t.data.field(i.field)),i.dir==="desc"&&(n*=-1),n!==0)break}return n}function rg(r,e){if(r===null)return e===null;if(e===null||r.inclusive!==e.inclusive||r.position.length!==e.position.length)return!1;for(let t=0;t<r.position.length;t++)if(!yt(r.position[t],e.position[t]))return!1;return!0}var Nr=class{constructor(e,t="asc"){this.field=e,this.dir=t}};function mx(r,e){return r.dir===e.dir&&r.field.isEqual(e.field)}var Ho=class{},be=class r extends Ho{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?t==="in"||t==="not-in"?this.createKeyFieldInFilter(e,t,n):new Ec(e,t,n):t==="array-contains"?new Ac(e,n):t==="in"?new Sc(e,n):t==="not-in"?new xc(e,n):t==="array-contains-any"?new Rc(e,n):new r(e,t,n)}static createKeyFieldInFilter(e,t,n){return t==="in"?new Tc(e,n):new Ic(e,n)}matches(e){let t=e.data.field(this.field);return this.op==="!="?t!==null&&t.nullValue===void 0&&this.matchesComparison(jn(t,this.value)):t!==null&&hr(this.value)===hr(t)&&this.matchesComparison(jn(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return K(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},rt=class r extends Ho{constructor(e,t){super(),this.filters=e,this.op=t,this.Pe=null}static create(e,t){return new r(e,t)}matches(e){return ny(this)?this.filters.find((t=>!t.matches(e)))===void 0:this.filters.find((t=>t.matches(e)))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}};function ny(r){return r.op==="and"}function sy(r){return gx(r)&&ny(r)}function gx(r){for(let e of r.filters)if(e instanceof rt)return!1;return!0}function bc(r){if(r instanceof be)return r.field.canonicalString()+r.op.toString()+Un(r.value);if(sy(r))return r.filters.map((e=>bc(e))).join(",");{let e=r.filters.map((t=>bc(t))).join(",");return`${r.op}(${e})`}}function iy(r,e){return r instanceof be?(function(n,s){return s instanceof be&&n.op===s.op&&n.field.isEqual(s.field)&&yt(n.value,s.value)})(r,e):r instanceof rt?(function(n,s){return s instanceof rt&&n.op===s.op&&n.filters.length===s.filters.length?n.filters.reduce(((i,o,u)=>i&&iy(o,s.filters[u])),!0):!1})(r,e):void K(19439)}function oy(r){return r instanceof be?(function(t){return`${t.field.canonicalString()} ${t.op} ${Un(t.value)}`})(r):r instanceof rt?(function(t){return t.op.toString()+" {"+t.getFilters().map(oy).join(" ,")+"}"})(r):"Filter"}var Ec=class extends be{constructor(e,t,n){super(e,t,n),this.key=z.fromName(n.referenceValue)}matches(e){let t=z.comparator(e.key,this.key);return this.matchesComparison(t)}},Tc=class extends be{constructor(e,t){super(e,"in",t),this.keys=ay("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}},Ic=class extends be{constructor(e,t){super(e,"not-in",t),this.keys=ay("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}};function ay(r,e){var t;return(((t=e.arrayValue)==null?void 0:t.values)||[]).map((n=>z.fromName(n.referenceValue)))}var Ac=class extends be{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return $l(t)&&Zs(t.arrayValue,this.value)}},Sc=class extends be{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return t!==null&&Zs(this.value.arrayValue,t)}},xc=class extends be{constructor(e,t){super(e,"not-in",t)}matches(e){if(Zs(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return t!==null&&t.nullValue===void 0&&!Zs(this.value.arrayValue,t)}},Rc=class extends be{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!$l(t)||!t.arrayValue.values)&&t.arrayValue.values.some((n=>Zs(this.value.arrayValue,n)))}};var Pc=class{constructor(e,t=null,n=[],s=[],i=null,o=null,u=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=s,this.limit=i,this.startAt=o,this.endAt=u,this.Te=null}};function ng(r,e=null,t=[],n=[],s=null,i=null,o=null){return new Pc(r,e,t,n,s,i,o)}function ql(r){let e=W(r);if(e.Te===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((n=>bc(n))).join(","),t+="|ob:",t+=e.orderBy.map((n=>(function(i){return i.field.canonicalString()+i.dir})(n))).join(","),Ea(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((n=>Un(n))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((n=>Un(n))).join(",")),e.Te=t}return e.Te}function zl(r,e){if(r.limit!==e.limit||r.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<r.orderBy.length;t++)if(!mx(r.orderBy[t],e.orderBy[t]))return!1;if(r.filters.length!==e.filters.length)return!1;for(let t=0;t<r.filters.length;t++)if(!iy(r.filters[t],e.filters[t]))return!1;return r.collectionGroup===e.collectionGroup&&!!r.path.isEqual(e.path)&&!!rg(r.startAt,e.startAt)&&rg(r.endAt,e.endAt)}function Cc(r){return z.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}var Bn=class{constructor(e,t=null,n=[],s=[],i=null,o="F",u=null,c=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=s,this.limit=i,this.limitType=o,this.startAt=u,this.endAt=c,this.Ee=null,this.Ie=null,this.Re=null,this.startAt,this.endAt}};function yx(r,e,t,n,s,i,o,u){return new Bn(r,e,t,n,s,i,o,u)}function ci(r){return new Bn(r)}function sg(r){return r.filters.length===0&&r.limit===null&&r.startAt==null&&r.endAt==null&&(r.explicitOrderBy.length===0||r.explicitOrderBy.length===1&&r.explicitOrderBy[0].field.isKeyField())}function _x(r){return z.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}function uy(r){return r.collectionGroup!==null}function Nn(r){let e=W(r);if(e.Ee===null){e.Ee=[];let t=new Set;for(let i of e.explicitOrderBy)e.Ee.push(i),t.add(i.field.canonicalString());let n=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let u=new Pe(qe.comparator);return o.filters.forEach((c=>{c.getFlattenedFilters().forEach((l=>{l.isInequality()&&(u=u.add(l.field))}))})),u})(e).forEach((i=>{t.has(i.canonicalString())||i.isKeyField()||e.Ee.push(new Nr(i,n))})),t.has(qe.keyField().canonicalString())||e.Ee.push(new Nr(qe.keyField(),n))}return e.Ee}function ft(r){let e=W(r);return e.Ie||(e.Ie=wx(e,Nn(r))),e.Ie}function wx(r,e){if(r.limitType==="F")return ng(r.path,r.collectionGroup,e,r.filters,r.limit,r.startAt,r.endAt);{e=e.map((s=>{let i=s.dir==="desc"?"asc":"desc";return new Nr(s.field,i)}));let t=r.endAt?new Dr(r.endAt.position,r.endAt.inclusive):null,n=r.startAt?new Dr(r.startAt.position,r.startAt.inclusive):null;return ng(r.path,r.collectionGroup,e,r.filters,r.limit,t,n)}}function Jo(r,e,t){return new Bn(r.path,r.collectionGroup,r.explicitOrderBy.slice(),r.filters.slice(),e,t,r.startAt,r.endAt)}function Aa(r,e){return zl(ft(r),ft(e))&&r.limitType===e.limitType}function cy(r){return`${ql(ft(r))}|lt:${r.limitType}`}function Cn(r){return`Query(target=${(function(t){let n=t.path.canonicalString();return t.collectionGroup!==null&&(n+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(n+=`, filters: [${t.filters.map((s=>oy(s))).join(", ")}]`),Ea(t.limit)||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=`, orderBy: [${t.orderBy.map((s=>(function(o){return`${o.field.canonicalString()} (${o.dir})`})(s))).join(", ")}]`),t.startAt&&(n+=", startAt: ",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map((s=>Un(s))).join(",")),t.endAt&&(n+=", endAt: ",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map((s=>Un(s))).join(",")),`Target(${n})`})(ft(r))}; limitType=${r.limitType})`}function Sa(r,e){return e.isFoundDocument()&&(function(n,s){let i=s.key.path;return n.collectionGroup!==null?s.key.hasCollectionId(n.collectionGroup)&&n.path.isPrefixOf(i):z.isDocumentKey(n.path)?n.path.isEqual(i):n.path.isImmediateParentOf(i)})(r,e)&&(function(n,s){for(let i of Nn(n))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0})(r,e)&&(function(n,s){for(let i of n.filters)if(!i.matches(s))return!1;return!0})(r,e)&&(function(n,s){return!(n.startAt&&!(function(o,u,c){let l=tg(o,u,c);return o.inclusive?l<=0:l<0})(n.startAt,Nn(n),s)||n.endAt&&!(function(o,u,c){let l=tg(o,u,c);return o.inclusive?l>=0:l>0})(n.endAt,Nn(n),s))})(r,e)}function vx(r){return r.collectionGroup||(r.path.length%2==1?r.path.lastSegment():r.path.get(r.path.length-2))}function ly(r){return(e,t)=>{let n=!1;for(let s of Nn(r)){let i=bx(s,e,t);if(i!==0)return i;n=n||s.field.isKeyField()}return 0}}function bx(r,e,t){let n=r.field.isKeyField()?z.comparator(e.key,t.key):(function(i,o,u){let c=o.data.field(i),l=u.data.field(i);return c!==null&&l!==null?jn(c,l):K(42886)})(r.field,e,t);switch(r.dir){case"asc":return n;case"desc":return-1*n;default:return K(19790,{direction:r.dir})}}var Ft=class{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n!==void 0){for(let[s,i]of n)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,t){let n=this.mapKeyFn(e),s=this.inner[n];if(s===void 0)return this.inner[n]=[[e,t]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,t]);s.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n===void 0)return!1;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],e))return n.length===1?delete this.inner[t]:n.splice(s,1),this.innerSize--,!0;return!1}forEach(e){pr(this.inner,((t,n)=>{for(let[s,i]of n)e(s,i)}))}isEmpty(){return Wg(this.inner)}size(){return this.innerSize}};var Ex=new pe(z.comparator);function Mt(){return Ex}var hy=new pe(z.comparator);function Ks(...r){let e=hy;for(let t of r)e=e.insert(t.key,t);return e}function dy(r){let e=hy;return r.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Rr(){return Ws()}function fy(){return Ws()}function Ws(){return new Ft((r=>r.toString()),((r,e)=>r.isEqual(e)))}var Tx=new pe(z.comparator),Ix=new Pe(z.comparator);function Q(...r){let e=Ix;for(let t of r)e=e.add(t);return e}var Ax=new Pe(Y);function Sx(){return Ax}function Kl(r,e){if(r.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Qs(e)?"-0":e}}function py(r){return{integerValue:""+r}}function xx(r,e){return tx(e)?py(e):Kl(r,e)}var $n=class{constructor(){this._=void 0}};function Rx(r,e,t){return r instanceof qn?(function(s,i){let o={fields:{[Jg]:{stringValue:Hg},[Yg]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&Ta(i)&&(i=Ia(i)),i&&(o.fields[Qg]=i),{mapValue:o}})(t,e):r instanceof Vr?gy(r,e):r instanceof Lr?yy(r,e):(function(s,i){let o=my(s,i),u=ig(o)+ig(s.Ae);return vc(o)&&vc(s.Ae)?py(u):Kl(s.serializer,u)})(r,e)}function Px(r,e,t){return r instanceof Vr?gy(r,e):r instanceof Lr?yy(r,e):t}function my(r,e){return r instanceof zn?(function(n){return vc(n)||(function(i){return!!i&&"doubleValue"in i})(n)})(e)?e:{integerValue:0}:null}var qn=class extends $n{},Vr=class extends $n{constructor(e){super(),this.elements=e}};function gy(r,e){let t=_y(e);for(let n of r.elements)t.some((s=>yt(s,n)))||t.push(n);return{arrayValue:{values:t}}}var Lr=class extends $n{constructor(e){super(),this.elements=e}};function yy(r,e){let t=_y(e);for(let n of r.elements)t=t.filter((s=>!yt(s,n)));return{arrayValue:{values:t}}}var zn=class extends $n{constructor(e,t){super(),this.serializer=e,this.Ae=t}};function ig(r){return ce(r.integerValue||r.doubleValue)}function _y(r){return $l(r)&&r.arrayValue.values?r.arrayValue.values.slice():[]}function Cx(r,e){return r.field.isEqual(e.field)&&(function(n,s){return n instanceof Vr&&s instanceof Vr||n instanceof Lr&&s instanceof Lr?Ln(n.elements,s.elements,yt):n instanceof zn&&s instanceof zn?yt(n.Ae,s.Ae):n instanceof qn&&s instanceof qn})(r.transform,e.transform)}var kc=class{constructor(e,t){this.version=e,this.transformResults=t}},kt=class r{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new r}static exists(e){return new r(void 0,e)}static updateTime(e){return new r(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}};function Fo(r,e){return r.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(r.updateTime):r.exists===void 0||r.exists===e.isFoundDocument()}var Kn=class{};function wy(r,e){if(!r.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return r.isNoDocument()?new ei(r.key,kt.none()):new Fr(r.key,r.data,kt.none());{let t=r.data,n=$e.empty(),s=new Pe(qe.comparator);for(let i of e.fields)if(!s.has(i)){let o=t.field(i);o===null&&i.length>1&&(i=i.popLast(),o=t.field(i)),o===null?n.delete(i):n.set(i,o),s=s.add(i)}return new _t(r.key,n,new He(s.toArray()),kt.none())}}function kx(r,e,t){r instanceof Fr?(function(s,i,o){let u=s.value.clone(),c=ag(s.fieldTransforms,i,o.transformResults);u.setAll(c),i.convertToFoundDocument(o.version,u).setHasCommittedMutations()})(r,e,t):r instanceof _t?(function(s,i,o){if(!Fo(s.precondition,i))return void i.convertToUnknownDocument(o.version);let u=ag(s.fieldTransforms,i,o.transformResults),c=i.data;c.setAll(vy(s)),c.setAll(u),i.convertToFoundDocument(o.version,c).setHasCommittedMutations()})(r,e,t):(function(s,i,o){i.convertToNoDocument(o.version).setHasCommittedMutations()})(0,e,t)}function Hs(r,e,t,n){return r instanceof Fr?(function(i,o,u,c){if(!Fo(i.precondition,o))return u;let l=i.value.clone(),f=ug(i.fieldTransforms,c,o);return l.setAll(f),o.convertToFoundDocument(o.version,l).setHasLocalMutations(),null})(r,e,t,n):r instanceof _t?(function(i,o,u,c){if(!Fo(i.precondition,o))return u;let l=ug(i.fieldTransforms,c,o),f=o.data;return f.setAll(vy(i)),f.setAll(l),o.convertToFoundDocument(o.version,f).setHasLocalMutations(),u===null?null:u.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map((p=>p.field)))})(r,e,t,n):(function(i,o,u){return Fo(i.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):u})(r,e,t)}function Ox(r,e){let t=null;for(let n of r.fieldTransforms){let s=e.data.field(n.field),i=my(n.transform,s||null);i!=null&&(t===null&&(t=$e.empty()),t.set(n.field,i))}return t||null}function og(r,e){return r.type===e.type&&!!r.key.isEqual(e.key)&&!!r.precondition.isEqual(e.precondition)&&!!(function(n,s){return n===void 0&&s===void 0||!(!n||!s)&&Ln(n,s,((i,o)=>Cx(i,o)))})(r.fieldTransforms,e.fieldTransforms)&&(r.type===0?r.value.isEqual(e.value):r.type!==1||r.data.isEqual(e.data)&&r.fieldMask.isEqual(e.fieldMask))}var Fr=class extends Kn{constructor(e,t,n,s=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}},_t=class extends Kn{constructor(e,t,n,s,i=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}};function vy(r){let e=new Map;return r.fieldMask.fields.forEach((t=>{if(!t.isEmpty()){let n=r.data.field(t);e.set(t,n)}})),e}function ag(r,e,t){let n=new Map;te(r.length===t.length,32656,{Ve:t.length,de:r.length});for(let s=0;s<t.length;s++){let i=r[s],o=i.transform,u=e.data.field(i.field);n.set(i.field,Px(o,u,t[s]))}return n}function ug(r,e,t){let n=new Map;for(let s of r){let i=s.transform,o=t.data.field(s.field);n.set(s.field,Rx(i,o,e))}return n}var ei=class extends Kn{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},Oc=class extends Kn{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};var Dc=class{constructor(e,t,n,s){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=s}applyToRemoteDocument(e,t){let n=t.mutationResults;for(let s=0;s<this.mutations.length;s++){let i=this.mutations[s];i.key.isEqual(e.key)&&kx(i,e,n[s])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=Hs(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=Hs(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=fy();return this.mutations.forEach((s=>{let i=e.get(s.key),o=i.overlayedDocument,u=this.applyToLocalView(o,i.mutatedFields);u=t.has(s.key)?null:u;let c=wy(o,u);c!==null&&n.set(s.key,c),o.isValidDocument()||o.convertToNoDocument(H.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),Q())}isEqual(e){return this.batchId===e.batchId&&Ln(this.mutations,e.mutations,((t,n)=>og(t,n)))&&Ln(this.baseMutations,e.baseMutations,((t,n)=>og(t,n)))}},Nc=class r{constructor(e,t,n,s){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=s}static from(e,t,n){te(e.mutations.length===n.length,58842,{me:e.mutations.length,fe:n.length});let s=(function(){return Tx})(),i=e.mutations;for(let o=0;o<i.length;o++)s=s.insert(i[o].key,n[o].version);return new r(e,t,n,s)}};var Vc=class{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
|
|
10
|
+
largestBatchId: ${this.largestBatchId},
|
|
11
|
+
mutation: ${this.mutation.toString()}
|
|
12
|
+
}`}};var Lc=class{constructor(e,t){this.count=e,this.unchangedNames=t}};var we,Z;function Dx(r){switch(r){case N.OK:return K(64938);case N.CANCELLED:case N.UNKNOWN:case N.DEADLINE_EXCEEDED:case N.RESOURCE_EXHAUSTED:case N.INTERNAL:case N.UNAVAILABLE:case N.UNAUTHENTICATED:return!1;case N.INVALID_ARGUMENT:case N.NOT_FOUND:case N.ALREADY_EXISTS:case N.PERMISSION_DENIED:case N.FAILED_PRECONDITION:case N.ABORTED:case N.OUT_OF_RANGE:case N.UNIMPLEMENTED:case N.DATA_LOSS:return!0;default:return K(15467,{code:r})}}function by(r){if(r===void 0)return Dt("GRPC error has no .code"),N.UNKNOWN;switch(r){case we.OK:return N.OK;case we.CANCELLED:return N.CANCELLED;case we.UNKNOWN:return N.UNKNOWN;case we.DEADLINE_EXCEEDED:return N.DEADLINE_EXCEEDED;case we.RESOURCE_EXHAUSTED:return N.RESOURCE_EXHAUSTED;case we.INTERNAL:return N.INTERNAL;case we.UNAVAILABLE:return N.UNAVAILABLE;case we.UNAUTHENTICATED:return N.UNAUTHENTICATED;case we.INVALID_ARGUMENT:return N.INVALID_ARGUMENT;case we.NOT_FOUND:return N.NOT_FOUND;case we.ALREADY_EXISTS:return N.ALREADY_EXISTS;case we.PERMISSION_DENIED:return N.PERMISSION_DENIED;case we.FAILED_PRECONDITION:return N.FAILED_PRECONDITION;case we.ABORTED:return N.ABORTED;case we.OUT_OF_RANGE:return N.OUT_OF_RANGE;case we.UNIMPLEMENTED:return N.UNIMPLEMENTED;case we.DATA_LOSS:return N.DATA_LOSS;default:return K(39323,{code:r})}}(Z=we||(we={}))[Z.OK=0]="OK",Z[Z.CANCELLED=1]="CANCELLED",Z[Z.UNKNOWN=2]="UNKNOWN",Z[Z.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Z[Z.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Z[Z.NOT_FOUND=5]="NOT_FOUND",Z[Z.ALREADY_EXISTS=6]="ALREADY_EXISTS",Z[Z.PERMISSION_DENIED=7]="PERMISSION_DENIED",Z[Z.UNAUTHENTICATED=16]="UNAUTHENTICATED",Z[Z.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Z[Z.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Z[Z.ABORTED=10]="ABORTED",Z[Z.OUT_OF_RANGE=11]="OUT_OF_RANGE",Z[Z.UNIMPLEMENTED=12]="UNIMPLEMENTED",Z[Z.INTERNAL=13]="INTERNAL",Z[Z.UNAVAILABLE=14]="UNAVAILABLE",Z[Z.DATA_LOSS=15]="DATA_LOSS";var uc=null;function Nx(){return new TextEncoder}var Vx=new Pt([4294967295,4294967295],0);function cg(r){let e=Nx().encode(r),t=new tc;return t.update(e),new Uint8Array(t.digest())}function lg(r){let e=new DataView(r.buffer),t=e.getUint32(0,!0),n=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);return[new Pt([t,n],0),new Pt([s,i],0)]}var Fc=class r{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new Pr(`Invalid padding: ${t}`);if(n<0)throw new Pr(`Invalid hash count: ${n}`);if(e.length>0&&this.hashCount===0)throw new Pr(`Invalid hash count: ${n}`);if(e.length===0&&t!==0)throw new Pr(`Invalid padding when bitmap length is 0: ${t}`);this.ge=8*e.length-t,this.pe=Pt.fromNumber(this.ge)}ye(e,t,n){let s=e.add(t.multiply(Pt.fromNumber(n)));return s.compare(Vx)===1&&(s=new Pt([s.getBits(0),s.getBits(1)],0)),s.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;let t=cg(e),[n,s]=lg(t);for(let i=0;i<this.hashCount;i++){let o=this.ye(n,s,i);if(!this.we(o))return!1}return!0}static create(e,t,n){let s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),o=new r(i,s,t);return n.forEach((u=>o.insert(u))),o}insert(e){if(this.ge===0)return;let t=cg(e),[n,s]=lg(t);for(let i=0;i<this.hashCount;i++){let o=this.ye(n,s,i);this.Se(o)}}Se(e){let t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}},Pr=class extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}};var Qo=class r{constructor(e,t,n,s,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,n){let s=new Map;return s.set(e,ti.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new r(H.min(),s,new pe(Y),Mt(),Q())}},ti=class r{constructor(e,t,n,s,i){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new r(n,t,Q(),Q(),Q())}};var Vn=class{constructor(e,t,n,s){this.be=e,this.removedTargetIds=t,this.key=n,this.De=s}},Yo=class{constructor(e,t){this.targetId=e,this.Ce=t}},Xo=class{constructor(e,t,n=ke.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=s}},Zo=class{constructor(){this.ve=0,this.Fe=hg(),this.Me=ke.EMPTY_BYTE_STRING,this.xe=!1,this.Oe=!0}get current(){return this.xe}get resumeToken(){return this.Me}get Ne(){return this.ve!==0}get Be(){return this.Oe}Le(e){e.approximateByteSize()>0&&(this.Oe=!0,this.Me=e)}ke(){let e=Q(),t=Q(),n=Q();return this.Fe.forEach(((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:t=t.add(s);break;case 1:n=n.add(s);break;default:K(38017,{changeType:i})}})),new ti(this.Me,this.xe,e,t,n)}qe(){this.Oe=!1,this.Fe=hg()}Ke(e,t){this.Oe=!0,this.Fe=this.Fe.insert(e,t)}Ue(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}$e(){this.ve+=1}We(){this.ve-=1,te(this.ve>=0,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}},Mc=class{constructor(e){this.Ge=e,this.ze=new Map,this.je=Mt(),this.Je=Do(),this.He=Do(),this.Ze=new pe(Y)}Xe(e){for(let t of e.be)e.De&&e.De.isFoundDocument()?this.Ye(t,e.De):this.et(t,e.key,e.De);for(let t of e.removedTargetIds)this.et(t,e.key,e.De)}tt(e){this.forEachTarget(e,(t=>{let n=this.nt(t);switch(e.state){case 0:this.rt(t)&&n.Le(e.resumeToken);break;case 1:n.We(),n.Ne||n.qe(),n.Le(e.resumeToken);break;case 2:n.We(),n.Ne||this.removeTarget(t);break;case 3:this.rt(t)&&(n.Qe(),n.Le(e.resumeToken));break;case 4:this.rt(t)&&(this.it(t),n.Le(e.resumeToken));break;default:K(56790,{state:e.state})}}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.ze.forEach(((n,s)=>{this.rt(s)&&t(s)}))}st(e){let t=e.targetId,n=e.Ce.count,s=this.ot(t);if(s){let i=s.target;if(Cc(i))if(n===0){let o=new z(i.path);this.et(t,o,tt.newNoDocument(o,H.min()))}else te(n===1,20013,{expectedCount:n});else{let o=this._t(t);if(o!==n){let u=this.ut(e),c=u?this.ct(u,e,o):1;if(c!==0){this.it(t);let l=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(t,l)}uc==null||uc.o((function(f,p,m,y,T){var k,O,D,M,B,F;let x={localCacheCount:f,existenceFilterCount:p.count,databaseId:m.database,projectId:m.projectId},I=p.unchangedNames;return I&&(x.bloomFilter={applied:T===0,hashCount:(k=I==null?void 0:I.hashCount)!=null?k:0,bitmapLength:(M=(D=(O=I==null?void 0:I.bits)==null?void 0:O.bitmap)==null?void 0:D.length)!=null?M:0,padding:(F=(B=I==null?void 0:I.bits)==null?void 0:B.padding)!=null?F:0,mightContain:w=>{var _;return(_=y==null?void 0:y.mightContain(w))!=null?_:!1}}),x})(o,e.Ce,this.Ge.ht(),u,c))}}}}ut(e){let t=e.Ce.unchangedNames;if(!t||!t.bits)return null;let{bits:{bitmap:n="",padding:s=0},hashCount:i=0}=t,o,u;try{o=Lt(n).toUint8Array()}catch(c){if(c instanceof Go)return Nt("Decoding the base64 bloom filter in existence filter failed ("+c.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw c}try{u=new Fc(o,s,i)}catch(c){return Nt(c instanceof Pr?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return u.ge===0?null:u}ct(e,t,n){return t.Ce.count===n-this.Pt(e,t.targetId)?0:2}Pt(e,t){let n=this.Ge.getRemoteKeysForTarget(t),s=0;return n.forEach((i=>{let o=this.Ge.ht(),u=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(u)||(this.et(t,i,null),s++)})),s}Tt(e){let t=new Map;this.ze.forEach(((i,o)=>{let u=this.ot(o);if(u){if(i.current&&Cc(u.target)){let c=new z(u.target.path);this.Et(c).has(o)||this.It(o,c)||this.et(o,c,tt.newNoDocument(c,e))}i.Be&&(t.set(o,i.ke()),i.qe())}}));let n=Q();this.He.forEach(((i,o)=>{let u=!0;o.forEachWhile((c=>{let l=this.ot(c);return!l||l.purpose==="TargetPurposeLimboResolution"||(u=!1,!1)})),u&&(n=n.add(i))})),this.je.forEach(((i,o)=>o.setReadTime(e)));let s=new Qo(e,t,this.Ze,this.je,n);return this.je=Mt(),this.Je=Do(),this.He=Do(),this.Ze=new pe(Y),s}Ye(e,t){if(!this.rt(e))return;let n=this.It(e,t.key)?2:0;this.nt(e).Ke(t.key,n),this.je=this.je.insert(t.key,t),this.Je=this.Je.insert(t.key,this.Et(t.key).add(e)),this.He=this.He.insert(t.key,this.Rt(t.key).add(e))}et(e,t,n){if(!this.rt(e))return;let s=this.nt(e);this.It(e,t)?s.Ke(t,1):s.Ue(t),this.He=this.He.insert(t,this.Rt(t).delete(e)),this.He=this.He.insert(t,this.Rt(t).add(e)),n&&(this.je=this.je.insert(t,n))}removeTarget(e){this.ze.delete(e)}_t(e){let t=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}$e(e){this.nt(e).$e()}nt(e){let t=this.ze.get(e);return t||(t=new Zo,this.ze.set(e,t)),t}Rt(e){let t=this.He.get(e);return t||(t=new Pe(Y),this.He=this.He.insert(e,t)),t}Et(e){let t=this.Je.get(e);return t||(t=new Pe(Y),this.Je=this.Je.insert(e,t)),t}rt(e){let t=this.ot(e)!==null;return t||j("WatchChangeAggregator","Detected inactive target",e),t}ot(e){let t=this.ze.get(e);return t&&t.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new Zo),this.Ge.getRemoteKeysForTarget(e).forEach((t=>{this.et(e,t,null)}))}It(e,t){return this.Ge.getRemoteKeysForTarget(e).has(t)}};function Do(){return new pe(z.comparator)}function hg(){return new pe(z.comparator)}var Lx={asc:"ASCENDING",desc:"DESCENDING"},Fx={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Mx={and:"AND",or:"OR"},jc=class{constructor(e,t){this.databaseId=e,this.useProto3Json=t}};function Uc(r,e){return r.useProto3Json||Ea(e)?e:{value:e}}function ea(r,e){return r.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Ey(r,e){return r.useProto3Json?e.toBase64():e.toUint8Array()}function jx(r,e){return ea(r,e.toTimestamp())}function pt(r){return te(!!r,49232),H.fromTimestamp((function(t){let n=Vt(t);return new _e(n.seconds,n.nanos)})(r))}function Gl(r,e){return Bc(r,e).canonicalString()}function Bc(r,e){let t=(function(s){return new fe(["projects",s.projectId,"databases",s.database])})(r).child("documents");return e===void 0?t:t.child(e)}function Ty(r){let e=fe.fromString(r);return te(Ry(e),10190,{key:e.toString()}),e}function $c(r,e){return Gl(r.databaseId,e.path)}function cc(r,e){let t=Ty(e);if(t.get(1)!==r.databaseId.projectId)throw new $(N.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+r.databaseId.projectId);if(t.get(3)!==r.databaseId.database)throw new $(N.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+r.databaseId.database);return new z(Ay(t))}function Iy(r,e){return Gl(r.databaseId,e)}function Ux(r){let e=Ty(r);return e.length===4?fe.emptyPath():Ay(e)}function qc(r){return new fe(["projects",r.databaseId.projectId,"databases",r.databaseId.database]).canonicalString()}function Ay(r){return te(r.length>4&&r.get(4)==="documents",29091,{key:r.toString()}),r.popFirst(5)}function dg(r,e,t){return{name:$c(r,e),fields:t.value.mapValue.fields}}function Bx(r,e){let t;if("targetChange"in e){e.targetChange;let n=(function(l){return l==="NO_CHANGE"?0:l==="ADD"?1:l==="REMOVE"?2:l==="CURRENT"?3:l==="RESET"?4:K(39313,{state:l})})(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=(function(l,f){return l.useProto3Json?(te(f===void 0||typeof f=="string",58123),ke.fromBase64String(f||"")):(te(f===void 0||f instanceof Buffer||f instanceof Uint8Array,16193),ke.fromUint8Array(f||new Uint8Array))})(r,e.targetChange.resumeToken),o=e.targetChange.cause,u=o&&(function(l){let f=l.code===void 0?N.UNKNOWN:by(l.code);return new $(f,l.message||"")})(o);t=new Xo(n,s,i,u||null)}else if("documentChange"in e){e.documentChange;let n=e.documentChange;n.document,n.document.name,n.document.updateTime;let s=cc(r,n.document.name),i=pt(n.document.updateTime),o=n.document.createTime?pt(n.document.createTime):H.min(),u=new $e({mapValue:{fields:n.document.fields}}),c=tt.newFoundDocument(s,i,o,u),l=n.targetIds||[],f=n.removedTargetIds||[];t=new Vn(l,f,c.key,c)}else if("documentDelete"in e){e.documentDelete;let n=e.documentDelete;n.document;let s=cc(r,n.document),i=n.readTime?pt(n.readTime):H.min(),o=tt.newNoDocument(s,i),u=n.removedTargetIds||[];t=new Vn([],u,o.key,o)}else if("documentRemove"in e){e.documentRemove;let n=e.documentRemove;n.document;let s=cc(r,n.document),i=n.removedTargetIds||[];t=new Vn([],i,s,null)}else{if(!("filter"in e))return K(11601,{Vt:e});{e.filter;let n=e.filter;n.targetId;let{count:s=0,unchangedNames:i}=n,o=new Lc(s,i),u=n.targetId;t=new Yo(u,o)}}return t}function $x(r,e){let t;if(e instanceof Fr)t={update:dg(r,e.key,e.value)};else if(e instanceof ei)t={delete:$c(r,e.key)};else if(e instanceof _t)t={update:dg(r,e.key,e.data),updateMask:Yx(e.fieldMask)};else{if(!(e instanceof Oc))return K(16599,{dt:e.type});t={verify:$c(r,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map((n=>(function(i,o){let u=o.transform;if(u instanceof qn)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(u instanceof Vr)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:u.elements}};if(u instanceof Lr)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:u.elements}};if(u instanceof zn)return{fieldPath:o.field.canonicalString(),increment:u.Ae};throw K(20930,{transform:o.transform})})(0,n)))),e.precondition.isNone||(t.currentDocument=(function(s,i){return i.updateTime!==void 0?{updateTime:jx(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:K(27497)})(r,e.precondition)),t}function qx(r,e){return r&&r.length>0?(te(e!==void 0,14353),r.map((t=>(function(s,i){let o=s.updateTime?pt(s.updateTime):pt(i);return o.isEqual(H.min())&&(o=pt(i)),new kc(o,s.transformResults||[])})(t,e)))):[]}function zx(r,e){return{documents:[Iy(r,e.path)]}}function Kx(r,e){let t={structuredQuery:{}},n=e.path,s;e.collectionGroup!==null?(s=n,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=n.popLast(),t.structuredQuery.from=[{collectionId:n.lastSegment()}]),t.parent=Iy(r,s);let i=(function(l){if(l.length!==0)return xy(rt.create(l,"and"))})(e.filters);i&&(t.structuredQuery.where=i);let o=(function(l){if(l.length!==0)return l.map((f=>(function(m){return{field:kn(m.field),direction:Hx(m.dir)}})(f)))})(e.orderBy);o&&(t.structuredQuery.orderBy=o);let u=Uc(r,e.limit);return u!==null&&(t.structuredQuery.limit=u),e.startAt&&(t.structuredQuery.startAt=(function(l){return{before:l.inclusive,values:l.position}})(e.startAt)),e.endAt&&(t.structuredQuery.endAt=(function(l){return{before:!l.inclusive,values:l.position}})(e.endAt)),{ft:t,parent:s}}function Gx(r){let e=Ux(r.parent),t=r.structuredQuery,n=t.from?t.from.length:0,s=null;if(n>0){te(n===1,65062);let f=t.from[0];f.allDescendants?s=f.collectionId:e=e.child(f.collectionId)}let i=[];t.where&&(i=(function(p){let m=Sy(p);return m instanceof rt&&sy(m)?m.getFilters():[m]})(t.where));let o=[];t.orderBy&&(o=(function(p){return p.map((m=>(function(T){return new Nr(On(T.field),(function(I){switch(I){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(T.direction))})(m)))})(t.orderBy));let u=null;t.limit&&(u=(function(p){let m;return m=typeof p=="object"?p.value:p,Ea(m)?null:m})(t.limit));let c=null;t.startAt&&(c=(function(p){let m=!!p.before,y=p.values||[];return new Dr(y,m)})(t.startAt));let l=null;return t.endAt&&(l=(function(p){let m=!p.before,y=p.values||[];return new Dr(y,m)})(t.endAt)),yx(e,s,o,i,u,"F",c,l)}function Wx(r,e){let t=(function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return K(28987,{purpose:s})}})(e.purpose);return t==null?null:{"goog-listen-tags":t}}function Sy(r){return r.unaryFilter!==void 0?(function(t){switch(t.unaryFilter.op){case"IS_NAN":let n=On(t.unaryFilter.field);return be.create(n,"==",{doubleValue:NaN});case"IS_NULL":let s=On(t.unaryFilter.field);return be.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let i=On(t.unaryFilter.field);return be.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let o=On(t.unaryFilter.field);return be.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return K(61313);default:return K(60726)}})(r):r.fieldFilter!==void 0?(function(t){return be.create(On(t.fieldFilter.field),(function(s){switch(s){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return K(58110);default:return K(50506)}})(t.fieldFilter.op),t.fieldFilter.value)})(r):r.compositeFilter!==void 0?(function(t){return rt.create(t.compositeFilter.filters.map((n=>Sy(n))),(function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return K(1026)}})(t.compositeFilter.op))})(r):K(30097,{filter:r})}function Hx(r){return Lx[r]}function Jx(r){return Fx[r]}function Qx(r){return Mx[r]}function kn(r){return{fieldPath:r.canonicalString()}}function On(r){return qe.fromServerFormat(r.fieldPath)}function xy(r){return r instanceof be?(function(t){if(t.op==="=="){if(eg(t.value))return{unaryFilter:{field:kn(t.field),op:"IS_NAN"}};if(Zm(t.value))return{unaryFilter:{field:kn(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(eg(t.value))return{unaryFilter:{field:kn(t.field),op:"IS_NOT_NAN"}};if(Zm(t.value))return{unaryFilter:{field:kn(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:kn(t.field),op:Jx(t.op),value:t.value}}})(r):r instanceof rt?(function(t){let n=t.getFilters().map((s=>xy(s)));return n.length===1?n[0]:{compositeFilter:{op:Qx(t.op),filters:n}}})(r):K(54877,{filter:r})}function Yx(r){let e=[];return r.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function Ry(r){return r.length>=4&&r.get(0)==="projects"&&r.get(2)==="databases"}function Py(r){return!!r&&typeof r._toProto=="function"&&r._protoValueType==="ProtoValue"}var ri=class r{constructor(e,t,n,s,i=H.min(),o=H.min(),u=ke.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=u,this.expectedCount=c}withSequenceNumber(e){return new r(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new r(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new r(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new r(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}};var zc=class{constructor(e){this.yt=e}};function Cy(r){let e=Gx({parent:r.parent,structuredQuery:r.structuredQuery});return r.limitType==="LAST"?Jo(e,e.limit,"L"):e}var ta=class{constructor(){}Dt(e,t){this.Ct(e,t),t.vt()}Ct(e,t){if("nullValue"in e)this.Ft(t,5);else if("booleanValue"in e)this.Ft(t,10),t.Mt(e.booleanValue?1:0);else if("integerValue"in e)this.Ft(t,15),t.Mt(ce(e.integerValue));else if("doubleValue"in e){let n=ce(e.doubleValue);isNaN(n)?this.Ft(t,13):(this.Ft(t,15),Qs(n)?t.Mt(0):t.Mt(n))}else if("timestampValue"in e){let n=e.timestampValue;this.Ft(t,20),typeof n=="string"&&(n=Vt(n)),t.xt(`${n.seconds||""}`),t.Mt(n.nanos||0)}else if("stringValue"in e)this.Ot(e.stringValue,t),this.Nt(t);else if("bytesValue"in e)this.Ft(t,30),t.Bt(Lt(e.bytesValue)),this.Nt(t);else if("referenceValue"in e)this.Lt(e.referenceValue,t);else if("geoPointValue"in e){let n=e.geoPointValue;this.Ft(t,45),t.Mt(n.latitude||0),t.Mt(n.longitude||0)}else"mapValue"in e?ty(e)?this.Ft(t,Number.MAX_SAFE_INTEGER):ey(e)?this.kt(e.mapValue,t):(this.qt(e.mapValue,t),this.Nt(t)):"arrayValue"in e?(this.Kt(e.arrayValue,t),this.Nt(t)):K(19022,{Ut:e})}Ot(e,t){this.Ft(t,25),this.$t(e,t)}$t(e,t){t.xt(e)}qt(e,t){let n=e.fields||{};this.Ft(t,55);for(let s of Object.keys(n))this.Ot(s,t),this.Ct(n[s],t)}kt(e,t){var o,u;let n=e.fields||{};this.Ft(t,53);let s=Mn,i=((u=(o=n[s].arrayValue)==null?void 0:o.values)==null?void 0:u.length)||0;this.Ft(t,15),t.Mt(ce(i)),this.Ot(s,t),this.Ct(n[s],t)}Kt(e,t){let n=e.values||[];this.Ft(t,50);for(let s of n)this.Ct(s,t)}Lt(e,t){this.Ft(t,37),z.fromName(e).path.forEach((n=>{this.Ft(t,60),this.$t(n,t)}))}Ft(e,t){e.Mt(t)}Nt(e){e.Mt(2)}};ta.Wt=new ta;var Kc=class{constructor(){this.bn=new Gc}addToCollectionParentIndex(e,t){return this.bn.add(t),V.resolve()}getCollectionParents(e,t){return V.resolve(this.bn.getEntries(t))}addFieldIndex(e,t){return V.resolve()}deleteFieldIndex(e,t){return V.resolve()}deleteAllFieldIndexes(e){return V.resolve()}createTargetIndexes(e,t){return V.resolve()}getDocumentsMatchingTarget(e,t){return V.resolve(null)}getIndexType(e,t){return V.resolve(0)}getFieldIndexes(e,t){return V.resolve([])}getNextCollectionGroupToUpdate(e){return V.resolve(null)}getMinOffset(e,t){return V.resolve(Or.min())}getMinOffsetFromCollectionGroup(e,t){return V.resolve(Or.min())}updateCollectionGroup(e,t,n){return V.resolve()}updateIndexEntries(e,t){return V.resolve()}},Gc=class{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),s=this.index[t]||new Pe(fe.comparator),i=!s.has(n);return this.index[t]=s.add(n),i}has(e){let t=e.lastSegment(),n=e.popLast(),s=this.index[t];return s&&s.has(n)}getEntries(e){return(this.index[e]||new Pe(fe.comparator)).toArray()}};var Sj=new Uint8Array(0);var fg={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},ky=41943040,We=class r{static withCacheSize(e){return new r(e,r.DEFAULT_COLLECTION_PERCENTILE,r.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}};We.DEFAULT_COLLECTION_PERCENTILE=10,We.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,We.DEFAULT=new We(ky,We.DEFAULT_COLLECTION_PERCENTILE,We.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),We.DISABLED=new We(-1,0,0);var ni=class r{constructor(e){this.sr=e}next(){return this.sr+=2,this.sr}static _r(){return new r(0)}static ar(){return new r(-1)}};var pg="LruGarbageCollector",Xx=1048576;function mg([r,e],[t,n]){let s=Y(r,t);return s===0?Y(e,n):s}var Wc=class{constructor(e){this.Pr=e,this.buffer=new Pe(mg),this.Tr=0}Er(){return++this.Tr}Ir(e){let t=[e,this.Er()];if(this.buffer.size<this.Pr)this.buffer=this.buffer.add(t);else{let n=this.buffer.last();mg(t,n)<0&&(this.buffer=this.buffer.delete(n).add(t))}}get maxValue(){return this.buffer.last()[0]}},Hc=class{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.Rr=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Ar(6e4)}stop(){this.Rr&&(this.Rr.cancel(),this.Rr=null)}get started(){return this.Rr!==null}Ar(e){j(pg,`Garbage collection scheduled in ${e}ms`),this.Rr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,(async()=>{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){es(t)?j(pg,"Ignoring IndexedDB error during garbage collection: ",t):await Zn(t)}await this.Ar(3e5)}))}},Jc=class{constructor(e,t){this.Vr=e,this.params=t}calculateTargetCount(e,t){return this.Vr.dr(e).next((n=>Math.floor(t/100*n)))}nthSequenceNumber(e,t){if(t===0)return V.resolve(Fn.ce);let n=new Wc(t);return this.Vr.forEachTarget(e,(s=>n.Ir(s.sequenceNumber))).next((()=>this.Vr.mr(e,(s=>n.Ir(s))))).next((()=>n.maxValue))}removeTargets(e,t,n){return this.Vr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.Vr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(j("LruGarbageCollector","Garbage collection skipped; disabled"),V.resolve(fg)):this.getCacheSize(e).next((n=>n<this.params.cacheSizeCollectionThreshold?(j("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),fg):this.gr(e,t)))}getCacheSize(e){return this.Vr.getCacheSize(e)}gr(e,t){let n,s,i,o,u,c,l,f=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((p=>(p>this.params.maximumSequenceNumbersToCollect?(j("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${p}`),s=this.params.maximumSequenceNumbersToCollect):s=p,o=Date.now(),this.nthSequenceNumber(e,s)))).next((p=>(n=p,u=Date.now(),this.removeTargets(e,n,t)))).next((p=>(i=p,c=Date.now(),this.removeOrphanedDocuments(e,n)))).next((p=>(l=Date.now(),Pn()<=X.DEBUG&&j("LruGarbageCollector",`LRU Garbage Collection
|
|
13
|
+
Counted targets in ${o-f}ms
|
|
14
|
+
Determined least recently used ${s} in `+(u-o)+`ms
|
|
15
|
+
Removed ${i} targets in `+(c-u)+`ms
|
|
16
|
+
Removed ${p} documents in `+(l-c)+`ms
|
|
17
|
+
Total Duration: ${l-f}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:p}))))}};function Zx(r,e){return new Jc(r,e)}var Qc=class{constructor(){this.changes=new Ft((e=>e.toString()),((e,t)=>e.isEqual(t))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,tt.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return n!==void 0?V.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}};var Yc=class{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}};var Xc=class{constructor(e,t,n,s){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=s}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((s=>(n=s,this.remoteDocumentCache.getEntry(e,t)))).next((s=>(n!==null&&Hs(n.mutation,s,He.empty(),_e.now()),s)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((n=>this.getLocalViewOfDocuments(e,n,Q()).next((()=>n))))}getLocalViewOfDocuments(e,t,n=Q()){let s=Rr();return this.populateOverlays(e,s,t).next((()=>this.computeViews(e,t,s,n).next((i=>{let o=Ks();return i.forEach(((u,c)=>{o=o.insert(u,c.overlayedDocument)})),o}))))}getOverlayedDocuments(e,t){let n=Rr();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,Q())))}populateOverlays(e,t,n){let s=[];return n.forEach((i=>{t.has(i)||s.push(i)})),this.documentOverlayCache.getOverlays(e,s).next((i=>{i.forEach(((o,u)=>{t.set(o,u)}))}))}computeViews(e,t,n,s){let i=Mt(),o=Ws(),u=(function(){return Ws()})();return t.forEach(((c,l)=>{let f=n.get(l.key);s.has(l.key)&&(f===void 0||f.mutation instanceof _t)?i=i.insert(l.key,l):f!==void 0?(o.set(l.key,f.mutation.getFieldMask()),Hs(f.mutation,l,f.mutation.getFieldMask(),_e.now())):o.set(l.key,He.empty())})),this.recalculateAndSaveOverlays(e,i).next((c=>(c.forEach(((l,f)=>o.set(l,f))),t.forEach(((l,f)=>{var p;return u.set(l,new Yc(f,(p=o.get(l))!=null?p:null))})),u)))}recalculateAndSaveOverlays(e,t){let n=Ws(),s=new pe(((o,u)=>o-u)),i=Q();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((o=>{for(let u of o)u.keys().forEach((c=>{let l=t.get(c);if(l===null)return;let f=n.get(c)||He.empty();f=u.applyToLocalView(l,f),n.set(c,f);let p=(s.get(u.batchId)||Q()).add(c);s=s.insert(u.batchId,p)}))})).next((()=>{let o=[],u=s.getReverseIterator();for(;u.hasNext();){let c=u.getNext(),l=c.key,f=c.value,p=fy();f.forEach((m=>{if(!i.has(m)){let y=wy(t.get(m),n.get(m));y!==null&&p.set(m,y),i=i.add(m)}})),o.push(this.documentOverlayCache.saveOverlays(e,l,p))}return V.waitFor(o)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((n=>this.recalculateAndSaveOverlays(e,n)))}getDocumentsMatchingQuery(e,t,n,s){return _x(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):uy(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,s):this.getDocumentsMatchingCollectionQuery(e,t,n,s)}getNextDocuments(e,t,n,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,s).next((i=>{let o=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,s-i.size):V.resolve(Rr()),u=Js,c=i;return o.next((l=>V.forEach(l,((f,p)=>(u<p.largestBatchId&&(u=p.largestBatchId),i.get(f)?V.resolve():this.remoteDocumentCache.getEntry(e,f).next((m=>{c=c.insert(f,m)}))))).next((()=>this.populateOverlays(e,l,i))).next((()=>this.computeViews(e,c,l,Q()))).next((f=>({batchId:u,changes:dy(f)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new z(t)).next((n=>{let s=Ks();return n.isFoundDocument()&&(s=s.insert(n.key,n)),s}))}getDocumentsMatchingCollectionGroupQuery(e,t,n,s){let i=t.collectionGroup,o=Ks();return this.indexManager.getCollectionParents(e,i).next((u=>V.forEach(u,(c=>{let l=(function(p,m){return new Bn(m,null,p.explicitOrderBy.slice(),p.filters.slice(),p.limit,p.limitType,p.startAt,p.endAt)})(t,c.child(i));return this.getDocumentsMatchingCollectionQuery(e,l,n,s).next((f=>{f.forEach(((p,m)=>{o=o.insert(p,m)}))}))})).next((()=>o))))}getDocumentsMatchingCollectionQuery(e,t,n,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,s)))).next((o=>{i.forEach(((c,l)=>{let f=l.getKey();o.get(f)===null&&(o=o.insert(f,tt.newInvalidDocument(f)))}));let u=Ks();return o.forEach(((c,l)=>{let f=i.get(c);f!==void 0&&Hs(f.mutation,l,He.empty(),_e.now()),Sa(t,l)&&(u=u.insert(c,l))})),u}))}};var Zc=class{constructor(e){this.serializer=e,this.Nr=new Map,this.Br=new Map}getBundleMetadata(e,t){return V.resolve(this.Nr.get(t))}saveBundleMetadata(e,t){return this.Nr.set(t.id,(function(s){return{id:s.id,version:s.version,createTime:pt(s.createTime)}})(t)),V.resolve()}getNamedQuery(e,t){return V.resolve(this.Br.get(t))}saveNamedQuery(e,t){return this.Br.set(t.name,(function(s){return{name:s.name,query:Cy(s.bundledQuery),readTime:pt(s.readTime)}})(t)),V.resolve()}};var el=class{constructor(){this.overlays=new pe(z.comparator),this.Lr=new Map}getOverlay(e,t){return V.resolve(this.overlays.get(t))}getOverlays(e,t){let n=Rr();return V.forEach(t,(s=>this.getOverlay(e,s).next((i=>{i!==null&&n.set(s,i)})))).next((()=>n))}saveOverlays(e,t,n){return n.forEach(((s,i)=>{this.St(e,t,i)})),V.resolve()}removeOverlaysForBatchId(e,t,n){let s=this.Lr.get(n);return s!==void 0&&(s.forEach((i=>this.overlays=this.overlays.remove(i))),this.Lr.delete(n)),V.resolve()}getOverlaysForCollection(e,t,n){let s=Rr(),i=t.length+1,o=new z(t.child("")),u=this.overlays.getIteratorFrom(o);for(;u.hasNext();){let c=u.getNext().value,l=c.getKey();if(!t.isPrefixOf(l.path))break;l.path.length===i&&c.largestBatchId>n&&s.set(c.getKey(),c)}return V.resolve(s)}getOverlaysForCollectionGroup(e,t,n,s){let i=new pe(((l,f)=>l-f)),o=this.overlays.getIterator();for(;o.hasNext();){let l=o.getNext().value;if(l.getKey().getCollectionGroup()===t&&l.largestBatchId>n){let f=i.get(l.largestBatchId);f===null&&(f=Rr(),i=i.insert(l.largestBatchId,f)),f.set(l.getKey(),l)}}let u=Rr(),c=i.getIterator();for(;c.hasNext()&&(c.getNext().value.forEach(((l,f)=>u.set(l,f))),!(u.size()>=s)););return V.resolve(u)}St(e,t,n){let s=this.overlays.get(n.key);if(s!==null){let o=this.Lr.get(s.largestBatchId).delete(n.key);this.Lr.set(s.largestBatchId,o)}this.overlays=this.overlays.insert(n.key,new Vc(t,n));let i=this.Lr.get(t);i===void 0&&(i=Q(),this.Lr.set(t,i)),this.Lr.set(t,i.add(n.key))}};var tl=class{constructor(){this.sessionToken=ke.EMPTY_BYTE_STRING}getSessionToken(e){return V.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,V.resolve()}};var si=class{constructor(){this.kr=new Pe(ve.qr),this.Kr=new Pe(ve.Ur)}isEmpty(){return this.kr.isEmpty()}addReference(e,t){let n=new ve(e,t);this.kr=this.kr.add(n),this.Kr=this.Kr.add(n)}$r(e,t){e.forEach((n=>this.addReference(n,t)))}removeReference(e,t){this.Wr(new ve(e,t))}Qr(e,t){e.forEach((n=>this.removeReference(n,t)))}Gr(e){let t=new z(new fe([])),n=new ve(t,e),s=new ve(t,e+1),i=[];return this.Kr.forEachInRange([n,s],(o=>{this.Wr(o),i.push(o.key)})),i}zr(){this.kr.forEach((e=>this.Wr(e)))}Wr(e){this.kr=this.kr.delete(e),this.Kr=this.Kr.delete(e)}jr(e){let t=new z(new fe([])),n=new ve(t,e),s=new ve(t,e+1),i=Q();return this.Kr.forEachInRange([n,s],(o=>{i=i.add(o.key)})),i}containsKey(e){let t=new ve(e,0),n=this.kr.firstAfterOrEqual(t);return n!==null&&e.isEqual(n.key)}},ve=class{constructor(e,t){this.key=e,this.Jr=t}static qr(e,t){return z.comparator(e.key,t.key)||Y(e.Jr,t.Jr)}static Ur(e,t){return Y(e.Jr,t.Jr)||z.comparator(e.key,t.key)}};var rl=class{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Yn=1,this.Hr=new Pe(ve.qr)}checkEmpty(e){return V.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,n,s){let i=this.Yn;this.Yn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let o=new Dc(i,t,n,s);this.mutationQueue.push(o);for(let u of s)this.Hr=this.Hr.add(new ve(u.key,i)),this.indexManager.addToCollectionParentIndex(e,u.key.path.popLast());return V.resolve(o)}lookupMutationBatch(e,t){return V.resolve(this.Zr(t))}getNextMutationBatchAfterBatchId(e,t){let n=t+1,s=this.Xr(n),i=s<0?0:s;return V.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return V.resolve(this.mutationQueue.length===0?jl:this.Yn-1)}getAllMutationBatches(e){return V.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new ve(t,0),s=new ve(t,Number.POSITIVE_INFINITY),i=[];return this.Hr.forEachInRange([n,s],(o=>{let u=this.Zr(o.Jr);i.push(u)})),V.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new Pe(Y);return t.forEach((s=>{let i=new ve(s,0),o=new ve(s,Number.POSITIVE_INFINITY);this.Hr.forEachInRange([i,o],(u=>{n=n.add(u.Jr)}))})),V.resolve(this.Yr(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,s=n.length+1,i=n;z.isDocumentKey(i)||(i=i.child(""));let o=new ve(new z(i),0),u=new Pe(Y);return this.Hr.forEachWhile((c=>{let l=c.key.path;return!!n.isPrefixOf(l)&&(l.length===s&&(u=u.add(c.Jr)),!0)}),o),V.resolve(this.Yr(u))}Yr(e){let t=[];return e.forEach((n=>{let s=this.Zr(n);s!==null&&t.push(s)})),t}removeMutationBatch(e,t){te(this.ei(t.batchId,"removed")===0,55003),this.mutationQueue.shift();let n=this.Hr;return V.forEach(t.mutations,(s=>{let i=new ve(s.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)})).next((()=>{this.Hr=n}))}nr(e){}containsKey(e,t){let n=new ve(t,0),s=this.Hr.firstAfterOrEqual(n);return V.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,V.resolve()}ei(e,t){return this.Xr(e)}Xr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Zr(e){let t=this.Xr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}};var nl=class{constructor(e){this.ti=e,this.docs=(function(){return new pe(z.comparator)})(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let n=t.key,s=this.docs.get(n),i=s?s.size:0,o=this.ti(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){let t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){let n=this.docs.get(t);return V.resolve(n?n.document.mutableCopy():tt.newInvalidDocument(t))}getEntries(e,t){let n=Mt();return t.forEach((s=>{let i=this.docs.get(s);n=n.insert(s,i?i.document.mutableCopy():tt.newInvalidDocument(s))})),V.resolve(n)}getDocumentsMatchingQuery(e,t,n,s){let i=Mt(),o=t.path,u=new z(o.child("__id-9223372036854775808__")),c=this.docs.getIteratorFrom(u);for(;c.hasNext();){let{key:l,value:{document:f}}=c.getNext();if(!o.isPrefixOf(l.path))break;l.path.length>o.length+1||XS(YS(f),n)<=0||(s.has(f.key)||Sa(t,f))&&(i=i.insert(f.key,f.mutableCopy()))}return V.resolve(i)}getAllFromCollectionGroup(e,t,n,s){K(9500)}ni(e,t){return V.forEach(this.docs,(n=>t(n)))}newChangeBuffer(e){return new sl(this)}getSize(e){return V.resolve(this.size)}},sl=class extends Qc{constructor(e){super(),this.Mr=e}applyChanges(e){let t=[];return this.changes.forEach(((n,s)=>{s.isValidDocument()?t.push(this.Mr.addEntry(e,s)):this.Mr.removeEntry(n)})),V.waitFor(t)}getFromCache(e,t){return this.Mr.getEntry(e,t)}getAllFromCache(e,t){return this.Mr.getEntries(e,t)}};var il=class{constructor(e){this.persistence=e,this.ri=new Ft((t=>ql(t)),zl),this.lastRemoteSnapshotVersion=H.min(),this.highestTargetId=0,this.ii=0,this.si=new si,this.targetCount=0,this.oi=ni._r()}forEachTarget(e,t){return this.ri.forEach(((n,s)=>t(s))),V.resolve()}getLastRemoteSnapshotVersion(e){return V.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return V.resolve(this.ii)}allocateTargetId(e){return this.highestTargetId=this.oi.next(),V.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.ii&&(this.ii=t),V.resolve()}lr(e){this.ri.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.oi=new ni(t),this.highestTargetId=t),e.sequenceNumber>this.ii&&(this.ii=e.sequenceNumber)}addTargetData(e,t){return this.lr(t),this.targetCount+=1,V.resolve()}updateTargetData(e,t){return this.lr(t),V.resolve()}removeTargetData(e,t){return this.ri.delete(t.target),this.si.Gr(t.targetId),this.targetCount-=1,V.resolve()}removeTargets(e,t,n){let s=0,i=[];return this.ri.forEach(((o,u)=>{u.sequenceNumber<=t&&n.get(u.targetId)===null&&(this.ri.delete(o),i.push(this.removeMatchingKeysForTargetId(e,u.targetId)),s++)})),V.waitFor(i).next((()=>s))}getTargetCount(e){return V.resolve(this.targetCount)}getTargetData(e,t){let n=this.ri.get(t)||null;return V.resolve(n)}addMatchingKeys(e,t,n){return this.si.$r(t,n),V.resolve()}removeMatchingKeys(e,t,n){this.si.Qr(t,n);let s=this.persistence.referenceDelegate,i=[];return s&&t.forEach((o=>{i.push(s.markPotentiallyOrphaned(e,o))})),V.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.si.Gr(t),V.resolve()}getMatchingKeysForTargetId(e,t){let n=this.si.jr(t);return V.resolve(n)}containsKey(e,t){return V.resolve(this.si.containsKey(t))}};var ra=class{constructor(e,t){this._i={},this.overlays={},this.ai=new Fn(0),this.ui=!1,this.ui=!0,this.ci=new tl,this.referenceDelegate=e(this),this.li=new il(this),this.indexManager=new Kc,this.remoteDocumentCache=(function(s){return new nl(s)})((n=>this.referenceDelegate.hi(n))),this.serializer=new zc(t),this.Pi=new Zc(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ui=!1,Promise.resolve()}get started(){return this.ui}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new el,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this._i[e.toKey()];return n||(n=new rl(t,this.referenceDelegate),this._i[e.toKey()]=n),n}getGlobalsCache(){return this.ci}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Pi}runTransaction(e,t,n){j("MemoryPersistence","Starting transaction:",e);let s=new ol(this.ai.next());return this.referenceDelegate.Ti(),n(s).next((i=>this.referenceDelegate.Ei(s).next((()=>i)))).toPromise().then((i=>(s.raiseOnCommittedEvent(),i)))}Ii(e,t){return V.or(Object.values(this._i).map((n=>()=>n.containsKey(e,t))))}},ol=class extends yc{constructor(e){super(),this.currentSequenceNumber=e}},al=class r{constructor(e){this.persistence=e,this.Ri=new si,this.Ai=null}static Vi(e){return new r(e)}get di(){if(this.Ai)return this.Ai;throw K(60996)}addReference(e,t,n){return this.Ri.addReference(n,t),this.di.delete(n.toString()),V.resolve()}removeReference(e,t,n){return this.Ri.removeReference(n,t),this.di.add(n.toString()),V.resolve()}markPotentiallyOrphaned(e,t){return this.di.add(t.toString()),V.resolve()}removeTarget(e,t){this.Ri.Gr(t.targetId).forEach((s=>this.di.add(s.toString())));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((s=>{s.forEach((i=>this.di.add(i.toString())))})).next((()=>n.removeTargetData(e,t)))}Ti(){this.Ai=new Set}Ei(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return V.forEach(this.di,(n=>{let s=z.fromPath(n);return this.mi(e,s).next((i=>{i||t.removeEntry(s,H.min())}))})).next((()=>(this.Ai=null,t.apply(e))))}updateLimboDocument(e,t){return this.mi(e,t).next((n=>{n?this.di.delete(t.toString()):this.di.add(t.toString())}))}hi(e){return 0}mi(e,t){return V.or([()=>V.resolve(this.Ri.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ii(e,t)])}},na=class r{constructor(e,t){this.persistence=e,this.fi=new Ft((n=>rx(n.path)),((n,s)=>n.isEqual(s))),this.garbageCollector=Zx(this,t)}static Vi(e,t){return new r(e,t)}Ti(){}Ei(e){return V.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}dr(e){let t=this.pr(e);return this.persistence.getTargetCache().getTargetCount(e).next((n=>t.next((s=>n+s))))}pr(e){let t=0;return this.mr(e,(n=>{t++})).next((()=>t))}mr(e,t){return V.forEach(this.fi,((n,s)=>this.wr(e,n,s).next((i=>i?V.resolve():t(s)))))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0,s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.ni(e,(o=>this.wr(e,o,t).next((u=>{u||(n++,i.removeEntry(o,H.min()))})))).next((()=>i.apply(e))).next((()=>n))}markPotentiallyOrphaned(e,t){return this.fi.set(t,e.currentSequenceNumber),V.resolve()}removeTarget(e,t){let n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.fi.set(n,e.currentSequenceNumber),V.resolve()}removeReference(e,t,n){return this.fi.set(n,e.currentSequenceNumber),V.resolve()}updateLimboDocument(e,t){return this.fi.set(t,e.currentSequenceNumber),V.resolve()}hi(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=Vo(e.data.value)),t}wr(e,t,n){return V.or([()=>this.persistence.Ii(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{let s=this.fi.get(t);return V.resolve(s!==void 0&&s>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}};var ul=class r{constructor(e,t,n,s){this.targetId=e,this.fromCache=t,this.Ts=n,this.Es=s}static Is(e,t){let n=Q(),s=Q();for(let i of t.docChanges)switch(i.type){case 0:n=n.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new r(e,t.fromCache,n,s)}};var cl=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}};var ll=class{constructor(){this.Rs=!1,this.As=!1,this.Vs=100,this.ds=(function(){return Em()?8:ex(bm())>0?6:4})()}initialize(e,t){this.fs=e,this.indexManager=t,this.Rs=!0}getDocumentsMatchingQuery(e,t,n,s){let i={result:null};return this.gs(e,t).next((o=>{i.result=o})).next((()=>{if(!i.result)return this.ps(e,t,s,n).next((o=>{i.result=o}))})).next((()=>{if(i.result)return;let o=new cl;return this.ys(e,t,o).next((u=>{if(i.result=u,this.As)return this.ws(e,t,o,u.size)}))})).next((()=>i.result))}ws(e,t,n,s){return n.documentReadCount<this.Vs?(Pn()<=X.DEBUG&&j("QueryEngine","SDK will not create cache indexes for query:",Cn(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),V.resolve()):(Pn()<=X.DEBUG&&j("QueryEngine","Query:",Cn(t),"scans",n.documentReadCount,"local documents and returns",s,"documents as results."),n.documentReadCount>this.ds*s?(Pn()<=X.DEBUG&&j("QueryEngine","The SDK decides to create cache indexes for query:",Cn(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,ft(t))):V.resolve())}gs(e,t){if(sg(t))return V.resolve(null);let n=ft(t);return this.indexManager.getIndexType(e,n).next((s=>s===0?null:(t.limit!==null&&s===1&&(t=Jo(t,null,"F"),n=ft(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next((i=>{let o=Q(...i);return this.fs.getDocuments(e,o).next((u=>this.indexManager.getMinOffset(e,n).next((c=>{let l=this.Ss(t,u);return this.bs(t,l,o,c.readTime)?this.gs(e,Jo(t,null,"F")):this.Ds(e,l,t,c)}))))})))))}ps(e,t,n,s){return sg(t)||s.isEqual(H.min())?V.resolve(null):this.fs.getDocuments(e,n).next((i=>{let o=this.Ss(t,i);return this.bs(t,o,n,s)?V.resolve(null):(Pn()<=X.DEBUG&&j("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),Cn(t)),this.Ds(e,o,t,QS(s,Js)).next((u=>u)))}))}Ss(e,t){let n=new Pe(ly(e));return t.forEach(((s,i)=>{Sa(e,i)&&(n=n.add(i))})),n}bs(e,t,n,s){if(e.limit===null)return!1;if(n.size!==t.size)return!0;let i=e.limitType==="F"?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}ys(e,t,n){return Pn()<=X.DEBUG&&j("QueryEngine","Using full collection scan to execute query:",Cn(t)),this.fs.getDocumentsMatchingQuery(e,t,Or.min(),n)}Ds(e,t,n,s){return this.fs.getDocumentsMatchingQuery(e,n,s).next((i=>(t.forEach((o=>{i=i.insert(o.key,o)})),i)))}};var Wl="LocalStore",eR=3e8,hl=class{constructor(e,t,n,s){this.persistence=e,this.Cs=t,this.serializer=s,this.vs=new pe(Y),this.Fs=new Ft((i=>ql(i)),zl),this.Ms=new Map,this.xs=e.getRemoteDocumentCache(),this.li=e.getTargetCache(),this.Pi=e.getBundleCache(),this.Os(n)}Os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Xc(this.xs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.xs.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.vs)))}};function tR(r,e,t,n){return new hl(r,e,t,n)}async function Oy(r,e){let t=W(r);return await t.persistence.runTransaction("Handle user change","readonly",(n=>{let s;return t.mutationQueue.getAllMutationBatches(n).next((i=>(s=i,t.Os(e),t.mutationQueue.getAllMutationBatches(n)))).next((i=>{let o=[],u=[],c=Q();for(let l of s){o.push(l.batchId);for(let f of l.mutations)c=c.add(f.key)}for(let l of i){u.push(l.batchId);for(let f of l.mutations)c=c.add(f.key)}return t.localDocuments.getDocuments(n,c).next((l=>({Ns:l,removedBatchIds:o,addedBatchIds:u})))}))}))}function rR(r,e){let t=W(r);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",(n=>{let s=e.batch.keys(),i=t.xs.newChangeBuffer({trackRemovals:!0});return(function(u,c,l,f){let p=l.batch,m=p.keys(),y=V.resolve();return m.forEach((T=>{y=y.next((()=>f.getEntry(c,T))).next((x=>{let I=l.docVersions.get(T);te(I!==null,48541),x.version.compareTo(I)<0&&(p.applyToRemoteDocument(x,l),x.isValidDocument()&&(x.setReadTime(l.commitVersion),f.addEntry(x)))}))})),y.next((()=>u.mutationQueue.removeMutationBatch(c,p)))})(t,n,e,i).next((()=>i.apply(n))).next((()=>t.mutationQueue.performConsistencyCheck(n))).next((()=>t.documentOverlayCache.removeOverlaysForBatchId(n,s,e.batch.batchId))).next((()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(n,(function(u){let c=Q();for(let l=0;l<u.mutationResults.length;++l)u.mutationResults[l].transformResults.length>0&&(c=c.add(u.batch.mutations[l].key));return c})(e)))).next((()=>t.localDocuments.getDocuments(n,s)))}))}function Dy(r){let e=W(r);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.li.getLastRemoteSnapshotVersion(t)))}function nR(r,e){let t=W(r),n=e.snapshotVersion,s=t.vs;return t.persistence.runTransaction("Apply remote event","readwrite-primary",(i=>{let o=t.xs.newChangeBuffer({trackRemovals:!0});s=t.vs;let u=[];e.targetChanges.forEach(((f,p)=>{let m=s.get(p);if(!m)return;u.push(t.li.removeMatchingKeys(i,f.removedDocuments,p).next((()=>t.li.addMatchingKeys(i,f.addedDocuments,p))));let y=m.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(p)!==null?y=y.withResumeToken(ke.EMPTY_BYTE_STRING,H.min()).withLastLimboFreeSnapshotVersion(H.min()):f.resumeToken.approximateByteSize()>0&&(y=y.withResumeToken(f.resumeToken,n)),s=s.insert(p,y),(function(x,I,k){return x.resumeToken.approximateByteSize()===0||I.snapshotVersion.toMicroseconds()-x.snapshotVersion.toMicroseconds()>=eR?!0:k.addedDocuments.size+k.modifiedDocuments.size+k.removedDocuments.size>0})(m,y,f)&&u.push(t.li.updateTargetData(i,y))}));let c=Mt(),l=Q();if(e.documentUpdates.forEach((f=>{e.resolvedLimboDocuments.has(f)&&u.push(t.persistence.referenceDelegate.updateLimboDocument(i,f))})),u.push(sR(i,o,e.documentUpdates).next((f=>{c=f.Bs,l=f.Ls}))),!n.isEqual(H.min())){let f=t.li.getLastRemoteSnapshotVersion(i).next((p=>t.li.setTargetsMetadata(i,i.currentSequenceNumber,n)));u.push(f)}return V.waitFor(u).next((()=>o.apply(i))).next((()=>t.localDocuments.getLocalViewOfDocuments(i,c,l))).next((()=>c))})).then((i=>(t.vs=s,i)))}function sR(r,e,t){let n=Q(),s=Q();return t.forEach((i=>n=n.add(i))),e.getEntries(r,n).next((i=>{let o=Mt();return t.forEach(((u,c)=>{let l=i.get(u);c.isFoundDocument()!==l.isFoundDocument()&&(s=s.add(u)),c.isNoDocument()&&c.version.isEqual(H.min())?(e.removeEntry(u,c.readTime),o=o.insert(u,c)):!l.isValidDocument()||c.version.compareTo(l.version)>0||c.version.compareTo(l.version)===0&&l.hasPendingWrites?(e.addEntry(c),o=o.insert(u,c)):j(Wl,"Ignoring outdated watch update for ",u,". Current version:",l.version," Watch version:",c.version)})),{Bs:o,Ls:s}}))}function iR(r,e){let t=W(r);return t.persistence.runTransaction("Get next mutation batch","readonly",(n=>(e===void 0&&(e=jl),t.mutationQueue.getNextMutationBatchAfterBatchId(n,e))))}function oR(r,e){let t=W(r);return t.persistence.runTransaction("Allocate target","readwrite",(n=>{let s;return t.li.getTargetData(n,e).next((i=>i?(s=i,V.resolve(s)):t.li.allocateTargetId(n).next((o=>(s=new ri(e,o,"TargetPurposeListen",n.currentSequenceNumber),t.li.addTargetData(n,s).next((()=>s)))))))})).then((n=>{let s=t.vs.get(n.targetId);return(s===null||n.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.vs=t.vs.insert(n.targetId,n),t.Fs.set(e,n.targetId)),n}))}async function dl(r,e,t){let n=W(r),s=n.vs.get(e),i=t?"readwrite":"readwrite-primary";try{t||await n.persistence.runTransaction("Release target",i,(o=>n.persistence.referenceDelegate.removeTarget(o,s)))}catch(o){if(!es(o))throw o;j(Wl,`Failed to update sequence numbers for target ${e}: ${o}`)}n.vs=n.vs.remove(e),n.Fs.delete(s.target)}function gg(r,e,t){let n=W(r),s=H.min(),i=Q();return n.persistence.runTransaction("Execute query","readwrite",(o=>(function(c,l,f){let p=W(c),m=p.Fs.get(f);return m!==void 0?V.resolve(p.vs.get(m)):p.li.getTargetData(l,f)})(n,o,ft(e)).next((u=>{if(u)return s=u.lastLimboFreeSnapshotVersion,n.li.getMatchingKeysForTargetId(o,u.targetId).next((c=>{i=c}))})).next((()=>n.Cs.getDocumentsMatchingQuery(o,e,t?s:H.min(),t?i:Q()))).next((u=>(aR(n,vx(e),u),{documents:u,ks:i})))))}function aR(r,e,t){let n=r.Ms.get(e)||H.min();t.forEach(((s,i)=>{i.readTime.compareTo(n)>0&&(n=i.readTime)})),r.Ms.set(e,n)}var sa=class{constructor(){this.activeTargetIds=Sx()}Qs(e){this.activeTargetIds=this.activeTargetIds.add(e)}Gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}};var fl=class{constructor(){this.vo=new sa,this.Fo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.vo.Qs(e),this.Fo[e]||"not-current"}updateQueryState(e,t,n){this.Fo[e]=t}removeLocalQueryTarget(e){this.vo.Gs(e)}isLocalQueryTarget(e){return this.vo.activeTargetIds.has(e)}clearQueryState(e){delete this.Fo[e]}getAllActiveQueryTargets(){return this.vo.activeTargetIds}isActiveQueryTarget(e){return this.vo.activeTargetIds.has(e)}start(){return this.vo=new sa,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};var pl=class{Mo(e){}shutdown(){}};var yg="ConnectivityMonitor",ia=class{constructor(){this.xo=()=>this.Oo(),this.No=()=>this.Bo(),this.Lo=[],this.ko()}Mo(e){this.Lo.push(e)}shutdown(){window.removeEventListener("online",this.xo),window.removeEventListener("offline",this.No)}ko(){window.addEventListener("online",this.xo),window.addEventListener("offline",this.No)}Oo(){j(yg,"Network connectivity changed: AVAILABLE");for(let e of this.Lo)e(0)}Bo(){j(yg,"Network connectivity changed: UNAVAILABLE");for(let e of this.Lo)e(1)}static v(){return typeof window!="undefined"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}};var No=null;function ml(){return No===null?No=(function(){return 268435456+Math.round(2147483648*Math.random())})():No++,"0x"+No.toString(16)}var lc="RestConnection",uR={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"},gl=class{get qo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Ko=t+"://"+e.host,this.Uo=`projects/${n}/databases/${s}`,this.$o=this.databaseId.database===Wo?`project_id=${n}`:`project_id=${n}&database_id=${s}`}Wo(e,t,n,s,i){let o=ml(),u=this.Qo(e,t.toUriEncodedString());j(lc,`Sending RPC '${e}' ${o}:`,u,n);let c={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.$o};this.Go(c,s,i);let{host:l}=new URL(u),f=ju(l);return this.zo(e,u,c,n,f).then((p=>(j(lc,`Received RPC '${e}' ${o}: `,p),p)),(p=>{throw Nt(lc,`RPC '${e}' ${o} failed with error: `,p,"url: ",u,"request:",n),p}))}jo(e,t,n,s,i,o){return this.Wo(e,t,n,s,i)}Go(e,t,n){e["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+Yn})(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach(((s,i)=>e[i]=s)),n&&n.headers.forEach(((s,i)=>e[i]=s))}Qo(e,t){let n=uR[e],s=`${this.Ko}/v1/${t}:${n}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}};var yl=class{constructor(e){this.Jo=e.Jo,this.Ho=e.Ho}Zo(e){this.Xo=e}Yo(e){this.e_=e}t_(e){this.n_=e}onMessage(e){this.r_=e}close(){this.Ho()}send(e){this.Jo(e)}i_(){this.Xo()}s_(){this.e_()}o_(e){this.n_(e)}__(e){this.r_(e)}};var Ve="WebChannelConnection",zs=(r,e,t)=>{r.listen(e,(n=>{try{t(n)}catch(s){setTimeout((()=>{throw s}),0)}}))},oa=class r extends gl{constructor(e){super(e),this.a_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static u_(){if(!r.c_){let e=ic();zs(e,sc.STAT_EVENT,(t=>{t.stat===ko.PROXY?j(Ve,"STAT_EVENT: detected buffering proxy"):t.stat===ko.NOPROXY&&j(Ve,"STAT_EVENT: detected no buffering proxy")})),r.c_=!0}}zo(e,t,n,s,i){let o=ml();return new Promise(((u,c)=>{let l=new rc;l.setWithCredentials(!0),l.listenOnce(nc.COMPLETE,(()=>{try{switch(l.getLastErrorCode()){case qs.NO_ERROR:let p=l.getResponseJson();j(Ve,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(p)),u(p);break;case qs.TIMEOUT:j(Ve,`RPC '${e}' ${o} timed out`),c(new $(N.DEADLINE_EXCEEDED,"Request time out"));break;case qs.HTTP_ERROR:let m=l.getStatus();if(j(Ve,`RPC '${e}' ${o} failed with status:`,m,"response text:",l.getResponseText()),m>0){let y=l.getResponseJson();Array.isArray(y)&&(y=y[0]);let T=y==null?void 0:y.error;if(T&&T.status&&T.message){let x=(function(k){let O=k.toLowerCase().replace(/_/g,"-");return Object.values(N).indexOf(O)>=0?O:N.UNKNOWN})(T.status);c(new $(x,T.message))}else c(new $(N.UNKNOWN,"Server responded with status "+l.getStatus()))}else c(new $(N.UNAVAILABLE,"Connection failed."));break;default:K(9055,{l_:e,streamId:o,h_:l.getLastErrorCode(),P_:l.getLastError()})}}finally{j(Ve,`RPC '${e}' ${o} completed.`)}}));let f=JSON.stringify(s);j(Ve,`RPC '${e}' ${o} sending request:`,s),l.send(t,"POST",f,n,15)}))}T_(e,t,n){let s=ml(),i=[this.Ko,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=this.createWebChannelTransport(),u={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(u.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(u.useFetchStreams=!0),this.Go(u.initMessageHeaders,t,n),u.encodeInitMessageHeaders=!0;let l=i.join("");j(Ve,`Creating RPC '${e}' stream ${s}: ${l}`,u);let f=o.createWebChannel(l,u);this.E_(f);let p=!1,m=!1,y=new yl({Jo:T=>{m?j(Ve,`Not sending because RPC '${e}' stream ${s} is closed:`,T):(p||(j(Ve,`Opening RPC '${e}' stream ${s} transport.`),f.open(),p=!0),j(Ve,`RPC '${e}' stream ${s} sending:`,T),f.send(T))},Ho:()=>f.close()});return zs(f,Rn.EventType.OPEN,(()=>{m||(j(Ve,`RPC '${e}' stream ${s} transport opened.`),y.i_())})),zs(f,Rn.EventType.CLOSE,(()=>{m||(m=!0,j(Ve,`RPC '${e}' stream ${s} transport closed`),y.o_(),this.I_(f))})),zs(f,Rn.EventType.ERROR,(T=>{m||(m=!0,Nt(Ve,`RPC '${e}' stream ${s} transport errored. Name:`,T.name,"Message:",T.message),y.o_(new $(N.UNAVAILABLE,"The operation could not be completed")))})),zs(f,Rn.EventType.MESSAGE,(T=>{var x;if(!m){let I=T.data[0];te(!!I,16349);let k=I,O=(k==null?void 0:k.error)||((x=k[0])==null?void 0:x.error);if(O){j(Ve,`RPC '${e}' stream ${s} received error:`,O);let D=O.status,M=(function(w){let _=we[w];if(_!==void 0)return by(_)})(D),B=O.message;D==="NOT_FOUND"&&B.includes("database")&&B.includes("does not exist")&&B.includes(this.databaseId.database)&&Nt(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),M===void 0&&(M=N.INTERNAL,B="Unknown error status: "+D+" with message "+O.message),m=!0,y.o_(new $(M,B)),f.close()}else j(Ve,`RPC '${e}' stream ${s} received:`,I),y.__(I)}})),r.u_(),setTimeout((()=>{y.s_()}),0),y}terminate(){this.a_.forEach((e=>e.close())),this.a_=[]}E_(e){this.a_.push(e)}I_(e){this.a_=this.a_.filter((t=>t===e))}Go(e,t,n){super.Go(e,t,n),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return oc()}};function cR(r){return new oa(r)}function hc(){return typeof document!="undefined"?document:null}function li(r){return new jc(r,!0)}oa.c_=!1;var aa=class{constructor(e,t,n=1e3,s=1.5,i=6e4){this.Ci=e,this.timerId=t,this.R_=n,this.A_=s,this.V_=i,this.d_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.d_=0}g_(){this.d_=this.V_}p_(e){this.cancel();let t=Math.floor(this.d_+this.y_()),n=Math.max(0,Date.now()-this.f_),s=Math.max(0,t-n);s>0&&j("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.d_} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.m_=this.Ci.enqueueAfterDelay(this.timerId,s,(()=>(this.f_=Date.now(),e()))),this.d_*=this.A_,this.d_<this.R_&&(this.d_=this.R_),this.d_>this.V_&&(this.d_=this.V_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.d_}};var _g="PersistentStream",ua=class{constructor(e,t,n,s,i,o,u,c){this.Ci=e,this.S_=n,this.b_=s,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=u,this.listener=c,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new aa(e,t)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Ci.enqueueAfterDelay(this.S_,6e4,(()=>this.k_())))}q_(e){this.K_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}K_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,t){this.K_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():t&&t.code===N.RESOURCE_EXHAUSTED?(Dt(t.toString()),Dt("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):t&&t.code===N.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.W_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.t_(t)}W_(){}auth(){this.state=1;let e=this.Q_(this.D_),t=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([n,s])=>{this.D_===t&&this.G_(n,s)}),(n=>{e((()=>{let s=new $(N.UNKNOWN,"Fetching auth token failed: "+n.message);return this.z_(s)}))}))}G_(e,t){let n=this.Q_(this.D_);this.stream=this.j_(e,t),this.stream.Zo((()=>{n((()=>this.listener.Zo()))})),this.stream.Yo((()=>{n((()=>(this.state=2,this.v_=this.Ci.enqueueAfterDelay(this.b_,1e4,(()=>(this.O_()&&(this.state=3),Promise.resolve()))),this.listener.Yo())))})),this.stream.t_((s=>{n((()=>this.z_(s)))})),this.stream.onMessage((s=>{n((()=>++this.F_==1?this.J_(s):this.onNext(s)))}))}N_(){this.state=5,this.M_.p_((async()=>{this.state=0,this.start()}))}z_(e){return j(_g,`close with error: ${e}`),this.stream=null,this.close(4,e)}Q_(e){return t=>{this.Ci.enqueueAndForget((()=>this.D_===e?t():(j(_g,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}},_l=class extends ua{constructor(e,t,n,s,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,s,o),this.serializer=i}j_(e,t){return this.connection.T_("Listen",e,t)}J_(e){return this.onNext(e)}onNext(e){this.M_.reset();let t=Bx(this.serializer,e),n=(function(i){if(!("targetChange"in i))return H.min();let o=i.targetChange;return o.targetIds&&o.targetIds.length?H.min():o.readTime?pt(o.readTime):H.min()})(e);return this.listener.H_(t,n)}Z_(e){let t={};t.database=qc(this.serializer),t.addTarget=(function(i,o){let u,c=o.target;if(u=Cc(c)?{documents:zx(i,c)}:{query:Kx(i,c).ft},u.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){u.resumeToken=Ey(i,o.resumeToken);let l=Uc(i,o.expectedCount);l!==null&&(u.expectedCount=l)}else if(o.snapshotVersion.compareTo(H.min())>0){u.readTime=ea(i,o.snapshotVersion.toTimestamp());let l=Uc(i,o.expectedCount);l!==null&&(u.expectedCount=l)}return u})(this.serializer,e);let n=Wx(this.serializer,e);n&&(t.labels=n),this.q_(t)}X_(e){let t={};t.database=qc(this.serializer),t.removeTarget=e,this.q_(t)}},wl=class extends ua{constructor(e,t,n,s,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,s,o),this.serializer=i}get Y_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}W_(){this.Y_&&this.ea([])}j_(e,t){return this.connection.T_("Write",e,t)}J_(e){return te(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,te(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){te(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();let t=qx(e.writeResults,e.commitTime),n=pt(e.commitTime);return this.listener.na(n,t)}ra(){let e={};e.database=qc(this.serializer),this.q_(e)}ea(e){let t={streamToken:this.lastStreamToken,writes:e.map((n=>$x(this.serializer,n)))};this.q_(t)}};var vl=class{},bl=class extends vl{constructor(e,t,n,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=s,this.ia=!1}sa(){if(this.ia)throw new $(N.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,t,n,s){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,o])=>this.connection.Wo(e,Bc(t,n),s,i,o))).catch((i=>{throw i.name==="FirebaseError"?(i.code===N.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new $(N.UNKNOWN,i.toString())}))}jo(e,t,n,s,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([o,u])=>this.connection.jo(e,Bc(t,n),s,o,u,i))).catch((o=>{throw o.name==="FirebaseError"?(o.code===N.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new $(N.UNKNOWN,o.toString())}))}terminate(){this.ia=!0,this.connection.terminate()}};function lR(r,e,t,n){return new bl(r,e,t,n)}var El=class{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve()))))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){let t=`Could not reach Cloud Firestore backend. ${e}
|
|
18
|
+
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(Dt(t),this.aa=!1):j("OnlineStateTracker",t)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}};var Mr="RemoteStore",Tl=class{constructor(e,t,n,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Ta=[],this.Ea=new Map,this.Ia=new Set,this.Ra=[],this.Aa=i,this.Aa.Mo((o=>{n.enqueueAndForget((async()=>{$r(this)&&(j(Mr,"Restarting streams for network reachability change."),await(async function(c){let l=W(c);l.Ia.add(4),await hi(l),l.Va.set("Unknown"),l.Ia.delete(4),await xa(l)})(this))}))})),this.Va=new El(n,s)}};async function xa(r){if($r(r))for(let e of r.Ra)await e(!0)}async function hi(r){for(let e of r.Ra)await e(!1)}function Ny(r,e){let t=W(r);t.Ea.has(e.targetId)||(t.Ea.set(e.targetId,e),Yl(t)?Ql(t):ts(t).O_()&&Jl(t,e))}function Hl(r,e){let t=W(r),n=ts(t);t.Ea.delete(e),n.O_()&&Vy(t,e),t.Ea.size===0&&(n.O_()?n.L_():$r(t)&&t.Va.set("Unknown"))}function Jl(r,e){if(r.da.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(H.min())>0){let t=r.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}ts(r).Z_(e)}function Vy(r,e){r.da.$e(e),ts(r).X_(e)}function Ql(r){r.da=new Mc({getRemoteKeysForTarget:e=>r.remoteSyncer.getRemoteKeysForTarget(e),At:e=>r.Ea.get(e)||null,ht:()=>r.datastore.serializer.databaseId}),ts(r).start(),r.Va.ua()}function Yl(r){return $r(r)&&!ts(r).x_()&&r.Ea.size>0}function $r(r){return W(r).Ia.size===0}function Ly(r){r.da=void 0}async function hR(r){r.Va.set("Online")}async function dR(r){r.Ea.forEach(((e,t)=>{Jl(r,e)}))}async function fR(r,e){Ly(r),Yl(r)?(r.Va.ha(e),Ql(r)):r.Va.set("Unknown")}async function pR(r,e,t){if(r.Va.set("Online"),e instanceof Xo&&e.state===2&&e.cause)try{await(async function(s,i){let o=i.cause;for(let u of i.targetIds)s.Ea.has(u)&&(await s.remoteSyncer.rejectListen(u,o),s.Ea.delete(u),s.da.removeTarget(u))})(r,e)}catch(n){j(Mr,"Failed to remove targets %s: %s ",e.targetIds.join(","),n),await ca(r,n)}else if(e instanceof Vn?r.da.Xe(e):e instanceof Yo?r.da.st(e):r.da.tt(e),!t.isEqual(H.min()))try{let n=await Dy(r.localStore);t.compareTo(n)>=0&&await(function(i,o){let u=i.da.Tt(o);return u.targetChanges.forEach(((c,l)=>{if(c.resumeToken.approximateByteSize()>0){let f=i.Ea.get(l);f&&i.Ea.set(l,f.withResumeToken(c.resumeToken,o))}})),u.targetMismatches.forEach(((c,l)=>{let f=i.Ea.get(c);if(!f)return;i.Ea.set(c,f.withResumeToken(ke.EMPTY_BYTE_STRING,f.snapshotVersion)),Vy(i,c);let p=new ri(f.target,c,l,f.sequenceNumber);Jl(i,p)})),i.remoteSyncer.applyRemoteEvent(u)})(r,t)}catch(n){j(Mr,"Failed to raise snapshot:",n),await ca(r,n)}}async function ca(r,e,t){if(!es(e))throw e;r.Ia.add(1),await hi(r),r.Va.set("Offline"),t||(t=()=>Dy(r.localStore)),r.asyncQueue.enqueueRetryable((async()=>{j(Mr,"Retrying IndexedDB access"),await t(),r.Ia.delete(1),await xa(r)}))}function Fy(r,e){return e().catch((t=>ca(r,t,e)))}async function Ra(r){let e=W(r),t=dr(e),n=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:jl;for(;mR(e);)try{let s=await iR(e.localStore,n);if(s===null){e.Ta.length===0&&t.L_();break}n=s.batchId,gR(e,s)}catch(s){await ca(e,s)}My(e)&&jy(e)}function mR(r){return $r(r)&&r.Ta.length<10}function gR(r,e){r.Ta.push(e);let t=dr(r);t.O_()&&t.Y_&&t.ea(e.mutations)}function My(r){return $r(r)&&!dr(r).x_()&&r.Ta.length>0}function jy(r){dr(r).start()}async function yR(r){dr(r).ra()}async function _R(r){let e=dr(r);for(let t of r.Ta)e.ea(t.mutations)}async function wR(r,e,t){let n=r.Ta.shift(),s=Nc.from(n,e,t);await Fy(r,(()=>r.remoteSyncer.applySuccessfulWrite(s))),await Ra(r)}async function vR(r,e){e&&dr(r).Y_&&await(async function(n,s){if((function(o){return Dx(o)&&o!==N.ABORTED})(s.code)){let i=n.Ta.shift();dr(n).B_(),await Fy(n,(()=>n.remoteSyncer.rejectFailedWrite(i.batchId,s))),await Ra(n)}})(r,e),My(r)&&jy(r)}async function wg(r,e){let t=W(r);t.asyncQueue.verifyOperationInProgress(),j(Mr,"RemoteStore received new credentials");let n=$r(t);t.Ia.add(3),await hi(t),n&&t.Va.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.Ia.delete(3),await xa(t)}async function bR(r,e){let t=W(r);e?(t.Ia.delete(2),await xa(t)):e||(t.Ia.add(2),await hi(t),t.Va.set("Unknown"))}function ts(r){return r.ma||(r.ma=(function(t,n,s){let i=W(t);return i.sa(),new _l(n,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)})(r.datastore,r.asyncQueue,{Zo:hR.bind(null,r),Yo:dR.bind(null,r),t_:fR.bind(null,r),H_:pR.bind(null,r)}),r.Ra.push((async e=>{e?(r.ma.B_(),Yl(r)?Ql(r):r.Va.set("Unknown")):(await r.ma.stop(),Ly(r))}))),r.ma}function dr(r){return r.fa||(r.fa=(function(t,n,s){let i=W(t);return i.sa(),new wl(n,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)})(r.datastore,r.asyncQueue,{Zo:()=>Promise.resolve(),Yo:yR.bind(null,r),t_:vR.bind(null,r),ta:_R.bind(null,r),na:wR.bind(null,r)}),r.Ra.push((async e=>{e?(r.fa.B_(),await Ra(r)):(await r.fa.stop(),r.Ta.length>0&&(j(Mr,`Stopping write stream with ${r.Ta.length} pending writes`),r.Ta=[]))}))),r.fa}var Il=class r{constructor(e,t,n,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=s,this.removalCallback=i,this.deferred=new ht,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((o=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,s,i){let o=Date.now()+n,u=new r(e,t,o,s,i);return u.start(n),u}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new $(N.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function Xl(r,e){if(Dt("AsyncQueue",`${e}: ${r}`),es(r))return new $(N.UNAVAILABLE,`${e}: ${r}`);throw r}var ii=class r{static emptySet(e){return new r(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||z.comparator(t.key,n.key):(t,n)=>z.comparator(t.key,n.key),this.keyedMap=Ks(),this.sortedSet=new pe(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((t,n)=>(e(t),!1)))}add(e){let t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){let t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof r)||this.size!==e.size)return!1;let t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){let s=t.getNext().key,i=n.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){let e=[];return this.forEach((t=>{e.push(t.toString())})),e.length===0?"DocumentSet ()":`DocumentSet (
|
|
19
|
+
`+e.join(`
|
|
20
|
+
`)+`
|
|
21
|
+
)`}copy(e,t){let n=new r;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}};var la=class{constructor(){this.ga=new pe(z.comparator)}track(e){let t=e.doc.key,n=this.ga.get(t);n?e.type!==0&&n.type===3?this.ga=this.ga.insert(t,e):e.type===3&&n.type!==1?this.ga=this.ga.insert(t,{type:n.type,doc:e.doc}):e.type===2&&n.type===2?this.ga=this.ga.insert(t,{type:2,doc:e.doc}):e.type===2&&n.type===0?this.ga=this.ga.insert(t,{type:0,doc:e.doc}):e.type===1&&n.type===0?this.ga=this.ga.remove(t):e.type===1&&n.type===2?this.ga=this.ga.insert(t,{type:1,doc:n.doc}):e.type===0&&n.type===1?this.ga=this.ga.insert(t,{type:2,doc:e.doc}):K(63341,{Vt:e,pa:n}):this.ga=this.ga.insert(t,e)}ya(){let e=[];return this.ga.inorderTraversal(((t,n)=>{e.push(n)})),e}},jr=class r{constructor(e,t,n,s,i,o,u,c,l){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=s,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=u,this.excludesMetadataChanges=c,this.hasCachedResults=l}static fromInitialDocuments(e,t,n,s,i){let o=[];return t.forEach((u=>{o.push({type:0,doc:u})})),new r(e,t,ii.emptySet(t),o,n,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Aa(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++)if(t[s].type!==n[s].type||!t[s].doc.isEqual(n[s].doc))return!1;return!0}};var Al=class{constructor(){this.wa=void 0,this.Sa=[]}ba(){return this.Sa.some((e=>e.Da()))}},Sl=class{constructor(){this.queries=vg(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(t,n){let s=W(t),i=s.queries;s.queries=vg(),i.forEach(((o,u)=>{for(let c of u.Sa)c.onError(n)}))})(this,new $(N.ABORTED,"Firestore shutting down"))}};function vg(){return new Ft((r=>cy(r)),Aa)}async function Uy(r,e){let t=W(r),n=3,s=e.query,i=t.queries.get(s);i?!i.ba()&&e.Da()&&(n=2):(i=new Al,n=e.Da()?0:1);try{switch(n){case 0:i.wa=await t.onListen(s,!0);break;case 1:i.wa=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(o){let u=Xl(o,`Initialization of query '${Cn(e.query)}' failed`);return void e.onError(u)}t.queries.set(s,i),i.Sa.push(e),e.va(t.onlineState),i.wa&&e.Fa(i.wa)&&Zl(t)}async function By(r,e){let t=W(r),n=e.query,s=3,i=t.queries.get(n);if(i){let o=i.Sa.indexOf(e);o>=0&&(i.Sa.splice(o,1),i.Sa.length===0?s=e.Da()?0:1:!i.ba()&&e.Da()&&(s=2))}switch(s){case 0:return t.queries.delete(n),t.onUnlisten(n,!0);case 1:return t.queries.delete(n),t.onUnlisten(n,!1);case 2:return t.onLastRemoteStoreUnlisten(n);default:return}}function ER(r,e){let t=W(r),n=!1;for(let s of e){let i=s.query,o=t.queries.get(i);if(o){for(let u of o.Sa)u.Fa(s)&&(n=!0);o.wa=s}}n&&Zl(t)}function TR(r,e,t){let n=W(r),s=n.queries.get(e);if(s)for(let i of s.Sa)i.onError(t);n.queries.delete(e)}function Zl(r){r.Ca.forEach((e=>{e.next()}))}var xl,bg;(bg=xl||(xl={})).Ma="default",bg.Cache="cache";var ha=class{constructor(e,t,n){this.query=e,this.xa=t,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=n||{}}Fa(e){if(!this.options.includeMetadataChanges){let n=[];for(let s of e.docChanges)s.type!==3&&n.push(s);e=new jr(e.query,e.docs,e.oldDocs,n,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),t=!0):this.La(e,this.onlineState)&&(this.ka(e),t=!0),this.Na=e,t}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let t=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),t=!0),t}La(e,t){if(!e.fromCache||!this.Da())return!0;let n=t!=="Offline";return(!this.options.qa||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;let t=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}ka(e){e=jr.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==xl.Cache}};var da=class{constructor(e){this.key=e}},fa=class{constructor(e){this.key=e}},Rl=class{constructor(e,t){this.query=e,this.Za=t,this.Xa=null,this.hasCachedResults=!1,this.current=!1,this.Ya=Q(),this.mutatedKeys=Q(),this.eu=ly(e),this.tu=new ii(this.eu)}get nu(){return this.Za}ru(e,t){let n=t?t.iu:new la,s=t?t.tu:this.tu,i=t?t.mutatedKeys:this.mutatedKeys,o=s,u=!1,c=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,l=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal(((f,p)=>{let m=s.get(f),y=Sa(this.query,p)?p:null,T=!!m&&this.mutatedKeys.has(m.key),x=!!y&&(y.hasLocalMutations||this.mutatedKeys.has(y.key)&&y.hasCommittedMutations),I=!1;m&&y?m.data.isEqual(y.data)?T!==x&&(n.track({type:3,doc:y}),I=!0):this.su(m,y)||(n.track({type:2,doc:y}),I=!0,(c&&this.eu(y,c)>0||l&&this.eu(y,l)<0)&&(u=!0)):!m&&y?(n.track({type:0,doc:y}),I=!0):m&&!y&&(n.track({type:1,doc:m}),I=!0,(c||l)&&(u=!0)),I&&(y?(o=o.add(y),i=x?i.add(f):i.delete(f)):(o=o.delete(f),i=i.delete(f)))})),this.query.limit!==null)for(;o.size>this.query.limit;){let f=this.query.limitType==="F"?o.last():o.first();o=o.delete(f.key),i=i.delete(f.key),n.track({type:1,doc:f})}return{tu:o,iu:n,bs:u,mutatedKeys:i}}su(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,s){let i=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;let o=e.iu.ya();o.sort(((f,p)=>(function(y,T){let x=I=>{switch(I){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return K(20277,{Vt:I})}};return x(y)-x(T)})(f.type,p.type)||this.eu(f.doc,p.doc))),this.ou(n),s=s!=null?s:!1;let u=t&&!s?this._u():[],c=this.Ya.size===0&&this.current&&!s?1:0,l=c!==this.Xa;return this.Xa=c,o.length!==0||l?{snapshot:new jr(this.query,e.tu,i,o,e.mutatedKeys,c===0,l,!1,!!n&&n.resumeToken.approximateByteSize()>0),au:u}:{au:u}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new la,mutatedKeys:this.mutatedKeys,bs:!1},!1)):{au:[]}}uu(e){return!this.Za.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach((t=>this.Za=this.Za.add(t))),e.modifiedDocuments.forEach((t=>{})),e.removedDocuments.forEach((t=>this.Za=this.Za.delete(t))),this.current=e.current)}_u(){if(!this.current)return[];let e=this.Ya;this.Ya=Q(),this.tu.forEach((n=>{this.uu(n.key)&&(this.Ya=this.Ya.add(n.key))}));let t=[];return e.forEach((n=>{this.Ya.has(n)||t.push(new fa(n))})),this.Ya.forEach((n=>{e.has(n)||t.push(new da(n))})),t}cu(e){this.Za=e.ks,this.Ya=Q();let t=this.ru(e.documents);return this.applyChanges(t,!0)}lu(){return jr.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Xa===0,this.hasCachedResults)}},eh="SyncEngine",Pl=class{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}},Cl=class{constructor(e){this.key=e,this.hu=!1}},kl=class{constructor(e,t,n,s,i,o){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.Pu={},this.Tu=new Ft((u=>cy(u)),Aa),this.Eu=new Map,this.Iu=new Set,this.Ru=new pe(z.comparator),this.Au=new Map,this.Vu=new si,this.du={},this.mu=new Map,this.fu=ni.ar(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}};async function IR(r,e,t=!0){let n=Wy(r),s,i=n.Tu.get(e);return i?(n.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.lu()):s=await $y(n,e,t,!0),s}async function AR(r,e){let t=Wy(r);await $y(t,e,!0,!1)}async function $y(r,e,t,n){let s=await oR(r.localStore,ft(e)),i=s.targetId,o=r.sharedClientState.addLocalQueryTarget(i,t),u;return n&&(u=await SR(r,e,i,o==="current",s.resumeToken)),r.isPrimaryClient&&t&&Ny(r.remoteStore,s),u}async function SR(r,e,t,n,s){r.pu=(p,m,y)=>(async function(x,I,k,O){let D=I.view.ru(k);D.bs&&(D=await gg(x.localStore,I.query,!1).then((({documents:w})=>I.view.ru(w,D))));let M=O&&O.targetChanges.get(I.targetId),B=O&&O.targetMismatches.get(I.targetId)!=null,F=I.view.applyChanges(D,x.isPrimaryClient,M,B);return Tg(x,I.targetId,F.au),F.snapshot})(r,p,m,y);let i=await gg(r.localStore,e,!0),o=new Rl(e,i.ks),u=o.ru(i.documents),c=ti.createSynthesizedTargetChangeForCurrentChange(t,n&&r.onlineState!=="Offline",s),l=o.applyChanges(u,r.isPrimaryClient,c);Tg(r,t,l.au);let f=new Pl(e,t,o);return r.Tu.set(e,f),r.Eu.has(t)?r.Eu.get(t).push(e):r.Eu.set(t,[e]),l.snapshot}async function xR(r,e,t){let n=W(r),s=n.Tu.get(e),i=n.Eu.get(s.targetId);if(i.length>1)return n.Eu.set(s.targetId,i.filter((o=>!Aa(o,e)))),void n.Tu.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(s.targetId),n.sharedClientState.isActiveQueryTarget(s.targetId)||await dl(n.localStore,s.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(s.targetId),t&&Hl(n.remoteStore,s.targetId),Ol(n,s.targetId)})).catch(Zn)):(Ol(n,s.targetId),await dl(n.localStore,s.targetId,!0))}async function RR(r,e){let t=W(r),n=t.Tu.get(e),s=t.Eu.get(n.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(n.targetId),Hl(t.remoteStore,n.targetId))}async function PR(r,e,t){let n=LR(r);try{let s=await(function(o,u){let c=W(o),l=_e.now(),f=u.reduce(((y,T)=>y.add(T.key)),Q()),p,m;return c.persistence.runTransaction("Locally write mutations","readwrite",(y=>{let T=Mt(),x=Q();return c.xs.getEntries(y,f).next((I=>{T=I,T.forEach(((k,O)=>{O.isValidDocument()||(x=x.add(k))}))})).next((()=>c.localDocuments.getOverlayedDocuments(y,T))).next((I=>{p=I;let k=[];for(let O of u){let D=Ox(O,p.get(O.key).overlayedDocument);D!=null&&k.push(new _t(O.key,D,ry(D.value.mapValue),kt.exists(!0)))}return c.mutationQueue.addMutationBatch(y,l,k,u)})).next((I=>{m=I;let k=I.applyToLocalDocumentSet(p,x);return c.documentOverlayCache.saveOverlays(y,I.batchId,k)}))})).then((()=>({batchId:m.batchId,changes:dy(p)})))})(n.localStore,e);n.sharedClientState.addPendingMutation(s.batchId),(function(o,u,c){let l=o.du[o.currentUser.toKey()];l||(l=new pe(Y)),l=l.insert(u,c),o.du[o.currentUser.toKey()]=l})(n,s.batchId,t),await di(n,s.changes),await Ra(n.remoteStore)}catch(s){let i=Xl(s,"Failed to persist write");t.reject(i)}}async function qy(r,e){let t=W(r);try{let n=await nR(t.localStore,e);e.targetChanges.forEach(((s,i)=>{let o=t.Au.get(i);o&&(te(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?o.hu=!0:s.modifiedDocuments.size>0?te(o.hu,14607):s.removedDocuments.size>0&&(te(o.hu,42227),o.hu=!1))})),await di(t,n,e)}catch(n){await Zn(n)}}function Eg(r,e,t){let n=W(r);if(n.isPrimaryClient&&t===0||!n.isPrimaryClient&&t===1){let s=[];n.Tu.forEach(((i,o)=>{let u=o.view.va(e);u.snapshot&&s.push(u.snapshot)})),(function(o,u){let c=W(o);c.onlineState=u;let l=!1;c.queries.forEach(((f,p)=>{for(let m of p.Sa)m.va(u)&&(l=!0)})),l&&Zl(c)})(n.eventManager,e),s.length&&n.Pu.H_(s),n.onlineState=e,n.isPrimaryClient&&n.sharedClientState.setOnlineState(e)}}async function CR(r,e,t){let n=W(r);n.sharedClientState.updateQueryState(e,"rejected",t);let s=n.Au.get(e),i=s&&s.key;if(i){let o=new pe(z.comparator);o=o.insert(i,tt.newNoDocument(i,H.min()));let u=Q().add(i),c=new Qo(H.min(),new Map,new pe(Y),o,u);await qy(n,c),n.Ru=n.Ru.remove(i),n.Au.delete(e),th(n)}else await dl(n.localStore,e,!1).then((()=>Ol(n,e,t))).catch(Zn)}async function kR(r,e){let t=W(r),n=e.batch.batchId;try{let s=await rR(t.localStore,e);Ky(t,n,null),zy(t,n),t.sharedClientState.updateMutationState(n,"acknowledged"),await di(t,s)}catch(s){await Zn(s)}}async function OR(r,e,t){let n=W(r);try{let s=await(function(o,u){let c=W(o);return c.persistence.runTransaction("Reject batch","readwrite-primary",(l=>{let f;return c.mutationQueue.lookupMutationBatch(l,u).next((p=>(te(p!==null,37113),f=p.keys(),c.mutationQueue.removeMutationBatch(l,p)))).next((()=>c.mutationQueue.performConsistencyCheck(l))).next((()=>c.documentOverlayCache.removeOverlaysForBatchId(l,f,u))).next((()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(l,f))).next((()=>c.localDocuments.getDocuments(l,f)))}))})(n.localStore,e);Ky(n,e,t),zy(n,e),n.sharedClientState.updateMutationState(e,"rejected",t),await di(n,s)}catch(s){await Zn(s)}}function zy(r,e){(r.mu.get(e)||[]).forEach((t=>{t.resolve()})),r.mu.delete(e)}function Ky(r,e,t){let n=W(r),s=n.du[n.currentUser.toKey()];if(s){let i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),n.du[n.currentUser.toKey()]=s}}function Ol(r,e,t=null){r.sharedClientState.removeLocalQueryTarget(e);for(let n of r.Eu.get(e))r.Tu.delete(n),t&&r.Pu.yu(n,t);r.Eu.delete(e),r.isPrimaryClient&&r.Vu.Gr(e).forEach((n=>{r.Vu.containsKey(n)||Gy(r,n)}))}function Gy(r,e){r.Iu.delete(e.path.canonicalString());let t=r.Ru.get(e);t!==null&&(Hl(r.remoteStore,t),r.Ru=r.Ru.remove(e),r.Au.delete(t),th(r))}function Tg(r,e,t){for(let n of t)n instanceof da?(r.Vu.addReference(n.key,e),DR(r,n)):n instanceof fa?(j(eh,"Document no longer in limbo: "+n.key),r.Vu.removeReference(n.key,e),r.Vu.containsKey(n.key)||Gy(r,n.key)):K(19791,{wu:n})}function DR(r,e){let t=e.key,n=t.path.canonicalString();r.Ru.get(t)||r.Iu.has(n)||(j(eh,"New document in limbo: "+t),r.Iu.add(n),th(r))}function th(r){for(;r.Iu.size>0&&r.Ru.size<r.maxConcurrentLimboResolutions;){let e=r.Iu.values().next().value;r.Iu.delete(e);let t=new z(fe.fromString(e)),n=r.fu.next();r.Au.set(n,new Cl(t)),r.Ru=r.Ru.insert(t,n),Ny(r.remoteStore,new ri(ft(ci(t.path)),n,"TargetPurposeLimboResolution",Fn.ce))}}async function di(r,e,t){let n=W(r),s=[],i=[],o=[];n.Tu.isEmpty()||(n.Tu.forEach(((u,c)=>{o.push(n.pu(c,e,t).then((l=>{var f;if((l||t)&&n.isPrimaryClient){let p=l?!l.fromCache:(f=t==null?void 0:t.targetChanges.get(c.targetId))==null?void 0:f.current;n.sharedClientState.updateQueryState(c.targetId,p?"current":"not-current")}if(l){s.push(l);let p=ul.Is(c.targetId,l);i.push(p)}})))})),await Promise.all(o),n.Pu.H_(s),await(async function(c,l){let f=W(c);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",(p=>V.forEach(l,(m=>V.forEach(m.Ts,(y=>f.persistence.referenceDelegate.addReference(p,m.targetId,y))).next((()=>V.forEach(m.Es,(y=>f.persistence.referenceDelegate.removeReference(p,m.targetId,y)))))))))}catch(p){if(!es(p))throw p;j(Wl,"Failed to update sequence numbers: "+p)}for(let p of l){let m=p.targetId;if(!p.fromCache){let y=f.vs.get(m),T=y.snapshotVersion,x=y.withLastLimboFreeSnapshotVersion(T);f.vs=f.vs.insert(m,x)}}})(n.localStore,i))}async function NR(r,e){let t=W(r);if(!t.currentUser.isEqual(e)){j(eh,"User change. New user:",e.toKey());let n=await Oy(t.localStore,e);t.currentUser=e,(function(i,o){i.mu.forEach((u=>{u.forEach((c=>{c.reject(new $(N.CANCELLED,o))}))})),i.mu.clear()})(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,n.removedBatchIds,n.addedBatchIds),await di(t,n.Ns)}}function VR(r,e){let t=W(r),n=t.Au.get(e);if(n&&n.hu)return Q().add(n.key);{let s=Q(),i=t.Eu.get(e);if(!i)return s;for(let o of i){let u=t.Tu.get(o);s=s.unionWith(u.view.nu)}return s}}function Wy(r){let e=W(r);return e.remoteStore.remoteSyncer.applyRemoteEvent=qy.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=VR.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=CR.bind(null,e),e.Pu.H_=ER.bind(null,e.eventManager),e.Pu.yu=TR.bind(null,e.eventManager),e}function LR(r){let e=W(r);return e.remoteStore.remoteSyncer.applySuccessfulWrite=kR.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=OR.bind(null,e),e}var Ur=class{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=li(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,t){return null}Mu(e,t){return null}vu(e){return tR(this.persistence,new ll,e.initialUser,this.serializer)}Cu(e){return new ra(al.Vi,this.serializer)}Du(e){return new fl}async terminate(){var e,t;(e=this.gcScheduler)==null||e.stop(),(t=this.indexBackfillerScheduler)==null||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}};Ur.provider={build:()=>new Ur};var pa=class extends Ur{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,t){te(this.persistence.referenceDelegate instanceof na,46915);let n=this.persistence.referenceDelegate.garbageCollector;return new Hc(n,e.asyncQueue,t)}Cu(e){let t=this.cacheSizeBytes!==void 0?We.withCacheSize(this.cacheSizeBytes):We.DEFAULT;return new ra((n=>na.Vi(n,t)),this.serializer)}};var Gn=class{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=n=>Eg(this.syncEngine,n,1),this.remoteStore.remoteSyncer.handleCredentialChange=NR.bind(null,this.syncEngine),await bR(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return(function(){return new Sl})()}createDatastore(e){let t=li(e.databaseInfo.databaseId),n=cR(e.databaseInfo);return lR(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return(function(n,s,i,o,u){return new Tl(n,s,i,o,u)})(this.localStore,this.datastore,e.asyncQueue,(t=>Eg(this.syncEngine,t,0)),(function(){return ia.v()?new ia:new pl})())}createSyncEngine(e,t){return(function(s,i,o,u,c,l,f){let p=new kl(s,i,o,u,c,l);return f&&(p.gu=!0),p})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await(async function(s){let i=W(s);j(Mr,"RemoteStore shutting down."),i.Ia.add(5),await hi(i),i.Aa.shutdown(),i.Va.set("Unknown")})(this.remoteStore),(e=this.datastore)==null||e.terminate(),(t=this.eventManager)==null||t.terminate()}};Gn.provider={build:()=>new Gn};var ma=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):Dt("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,t){setTimeout((()=>{this.muted||e(t)}),0)}};var fr="FirestoreClient",Dl=class{constructor(e,t,n,s,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this._databaseInfo=s,this.user=Re.UNAUTHENTICATED,this.clientId=kr.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(n,(async o=>{j(fr,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o})),this.appCheckCredentials.start(n,(o=>(j(fr,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();let e=new ht;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){let n=Xl(t,"Failed to shutdown persistence");e.reject(n)}})),e.promise}};async function dc(r,e){r.asyncQueue.verifyOperationInProgress(),j(fr,"Initializing OfflineComponentProvider");let t=r.configuration;await e.initialize(t);let n=t.initialUser;r.setCredentialChangeListener((async s=>{n.isEqual(s)||(await Oy(e.localStore,s),n=s)})),e.persistence.setDatabaseDeletedListener((()=>r.terminate())),r._offlineComponents=e}async function Ig(r,e){r.asyncQueue.verifyOperationInProgress();let t=await FR(r);j(fr,"Initializing OnlineComponentProvider"),await e.initialize(t,r.configuration),r.setCredentialChangeListener((n=>wg(e.remoteStore,n))),r.setAppCheckTokenChangeListener(((n,s)=>wg(e.remoteStore,s))),r._onlineComponents=e}async function FR(r){if(!r._offlineComponents)if(r._uninitializedComponentsProvider){j(fr,"Using user provided OfflineComponentProvider");try{await dc(r,r._uninitializedComponentsProvider._offline)}catch(e){let t=e;if(!(function(s){return s.name==="FirebaseError"?s.code===N.FAILED_PRECONDITION||s.code===N.UNIMPLEMENTED:!(typeof DOMException!="undefined"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11})(t))throw t;Nt("Error using user provided cache. Falling back to memory cache: "+t),await dc(r,new Ur)}}else j(fr,"Using default OfflineComponentProvider"),await dc(r,new pa(void 0));return r._offlineComponents}async function Hy(r){return r._onlineComponents||(r._uninitializedComponentsProvider?(j(fr,"Using user provided OnlineComponentProvider"),await Ig(r,r._uninitializedComponentsProvider._online)):(j(fr,"Using default OnlineComponentProvider"),await Ig(r,new Gn))),r._onlineComponents}function MR(r){return Hy(r).then((e=>e.syncEngine))}async function Nl(r){let e=await Hy(r),t=e.eventManager;return t.onListen=IR.bind(null,e.syncEngine),t.onUnlisten=xR.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=AR.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=RR.bind(null,e.syncEngine),t}function Jy(r,e,t,n){let s=new ma(n),i=new ha(e,s,t);return r.asyncQueue.enqueueAndForget((async()=>Uy(await Nl(r),i))),()=>{s.Nu(),r.asyncQueue.enqueueAndForget((async()=>By(await Nl(r),i)))}}function Qy(r,e,t={}){let n=new ht;return r.asyncQueue.enqueueAndForget((async()=>(function(i,o,u,c,l){let f=new ma({next:m=>{f.Nu(),o.enqueueAndForget((()=>By(i,p)));let y=m.docs.has(u);!y&&m.fromCache?l.reject(new $(N.UNAVAILABLE,"Failed to get document because the client is offline.")):y&&m.fromCache&&c&&c.source==="server"?l.reject(new $(N.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):l.resolve(m)},error:m=>l.reject(m)}),p=new ha(ci(u.path),f,{includeMetadataChanges:!0,qa:!0});return Uy(i,p)})(await Nl(r),r.asyncQueue,e,t,n))),n.promise}function Yy(r,e){let t=new ht;return r.asyncQueue.enqueueAndForget((async()=>PR(await MR(r),e,t))),t.promise}function Xy(r){let e={};return r.timeoutSeconds!==void 0&&(e.timeoutSeconds=r.timeoutSeconds),e}var jR="ComponentProvider",Ag=new Map;function UR(r,e,t,n,s){return new _c(r,e,t,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,Xy(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,n)}var Zy="firestore.googleapis.com",Sg=!0,ga=class{constructor(e){var t,n;if(e.host===void 0){if(e.ssl!==void 0)throw new $(N.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Zy,this.ssl=Sg}else this.host=e.host,this.ssl=(t=e.ssl)!=null?t:Sg;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=ky;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<Xx)throw new $(N.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}kg("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Xy((n=e.experimentalLongPollingOptions)!=null?n:{}),(function(i){if(i.timeoutSeconds!==void 0){if(isNaN(i.timeoutSeconds))throw new $(N.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (must not be NaN)`);if(i.timeoutSeconds<5)throw new $(N.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (minimum allowed value is 5)`);if(i.timeoutSeconds>30)throw new $(N.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(function(n,s){return n.timeoutSeconds===s.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},oi=class{constructor(e,t,n,s){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new ga({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new $(N.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new $(N.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new ga(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(n){if(!n)return new jo;switch(n.type){case"firstParty":return new mc(n.sessionIndex||"0",n.iamToken||null,n.authTokenFactory||null);case"provider":return n.client;default:throw new $(N.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}})(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(t){let n=Ag.get(t);n&&(j(jR,"Removing Datastore"),Ag.delete(t),n.terminate())})(this),Promise.resolve()}};function e_(r,e,t,n={}){var l;r=Je(r,oi);let s=ju(e),i=r._getSettings(),o={...i,emulatorOptions:r._getEmulatorOptions()},u=`${e}:${t}`;s&&Im(`https://${u}`),i.host!==Zy&&i.host!==u&&Nt("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");let c={...i,host:u,ssl:s,emulatorOptions:n};if(!Sr(c,o)&&(r._setSettings(c),n.mockUserToken)){let f,p;if(typeof n.mockUserToken=="string")f=n.mockUserToken,p=Re.MOCK_USER;else{f=vm(n.mockUserToken,(l=r._app)==null?void 0:l.options.projectId);let m=n.mockUserToken.sub||n.mockUserToken.user_id;if(!m)throw new $(N.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");p=new Re(m)}r._authCredentials=new fc(new Mo(f,p))}}var Wn=class r{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new r(this.firestore,e,this._query)}},Ie=class r{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Hn(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new r(this.firestore,e,this._key)}toJSON(){return{type:r._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(Xn(t,r._jsonSchema))return new r(e,n||null,new z(fe.fromString(t.referencePath)))}};Ie._jsonSchemaVersion="firestore/documentReference/1.0",Ie._jsonSchema={type:ye("string",Ie._jsonSchemaVersion),referencePath:ye("string")};var Hn=class r extends Wn{constructor(e,t,n){super(e,t,ci(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){let e=this._path.popLast();return e.isEmpty()?null:new Ie(this.firestore,null,new z(e))}withConverter(e){return new r(this.firestore,e,this._path)}};function rs(r,e,...t){if(r=ct(r),arguments.length===1&&(e=kr.newId()),JS("doc","path",e),r instanceof oi){let n=fe.fromString(e,...t);return Gm(n),new Ie(r,null,new z(n))}{if(!(r instanceof Ie||r instanceof Hn))throw new $(N.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let n=r._path.child(fe.fromString(e,...t));return Gm(n),new Ie(r.firestore,r instanceof Hn?r.converter:null,new z(n))}}var xg="AsyncQueue",ya=class{constructor(e=Promise.resolve()){this.Yu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new aa(this,"async_queue_retry"),this._c=()=>{let n=hc();n&&j(xg,"Visibility state changed to "+n.visibilityState),this.M_.w_()},this.ac=e;let t=hc();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;let t=hc();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise((()=>{}));let t=new ht;return this.cc((()=>this.ec&&this.sc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Yu.push(e),this.lc())))}async lc(){if(this.Yu.length!==0){try{await this.Yu[0](),this.Yu.shift(),this.M_.reset()}catch(e){if(!es(e))throw e;j(xg,"Operation failed with retryable error: "+e)}this.Yu.length>0&&this.M_.p_((()=>this.lc()))}}cc(e){let t=this.ac.then((()=>(this.rc=!0,e().catch((n=>{throw this.nc=n,this.rc=!1,Dt("INTERNAL UNHANDLED ERROR: ",Rg(n)),n})).then((n=>(this.rc=!1,n))))));return this.ac=t,t}enqueueAfterDelay(e,t,n){this.uc(),this.oc.indexOf(e)>-1&&(t=0);let s=Il.createAndSchedule(this,e,t,n,(i=>this.hc(i)));return this.tc.push(s),s}uc(){this.nc&&K(47125,{Pc:Rg(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ec(e){for(let t of this.tc)if(t.timerId===e)return!0;return!1}Ic(e){return this.Tc().then((()=>{this.tc.sort(((t,n)=>t.targetTimeMs-n.targetTimeMs));for(let t of this.tc)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.Tc()}))}Rc(e){this.oc.push(e)}hc(e){let t=this.tc.indexOf(e);this.tc.splice(t,1)}};function Rg(r){let e=r.message||"";return r.stack&&(e=r.stack.includes(r.message)?r.stack:r.message+`
|
|
22
|
+
`+r.stack),e}var wt=class extends oi{constructor(e,t,n,s){super(e,t,n,s),this.type="firestore",this._queue=new ya,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new ya(e),this._firestoreClient=void 0,await e}}};function rh(r,e){let t=typeof r=="object"?r:Um(),n=typeof r=="string"?r:e||Wo,s=Fm(t,"firestore").getImmediate({identifier:n});if(!s._initialized){let i=wm("firestore");i&&e_(s,...i)}return s}function fi(r){if(r._terminated)throw new $(N.FAILED_PRECONDITION,"The client has already been terminated.");return r._firestoreClient||BR(r),r._firestoreClient}function BR(r){var n,s,i,o;let e=r._freezeSettings(),t=UR(r._databaseId,((n=r._app)==null?void 0:n.options.appId)||"",r._persistenceKey,(s=r._app)==null?void 0:s.options.apiKey,e);r._componentsProvider||(i=e.localCache)!=null&&i._offlineComponentProvider&&((o=e.localCache)!=null&&o._onlineComponentProvider)&&(r._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),r._firestoreClient=new Dl(r._authCredentials,r._appCheckCredentials,r._queue,t,r._componentsProvider&&(function(c){let l=c==null?void 0:c._online.build();return{_offline:c==null?void 0:c._offline.build(l),_online:l}})(r._componentsProvider))}var mt=class r{constructor(e){this._byteString=e}static fromBase64String(e){try{return new r(ke.fromBase64String(e))}catch(t){throw new $(N.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new r(ke.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:r._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Xn(e,r._jsonSchema))return r.fromBase64String(e.bytes)}};mt._jsonSchemaVersion="firestore/bytes/1.0",mt._jsonSchema={type:ye("string",mt._jsonSchemaVersion),bytes:ye("string")};var Br=class{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new $(N.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new qe(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};var Jn=class{constructor(e){this._methodName=e}};var Ot=class r{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new $(N.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new $(N.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Y(this._lat,e._lat)||Y(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:r._jsonSchemaVersion}}static fromJSON(e){if(Xn(e,r._jsonSchema))return new r(e.latitude,e.longitude)}};Ot._jsonSchemaVersion="firestore/geoPoint/1.0",Ot._jsonSchema={type:ye("string",Ot._jsonSchemaVersion),latitude:ye("number"),longitude:ye("number")};var gt=class r{constructor(e){this._values=(e||[]).map((t=>t))}toArray(){return this._values.map((e=>e))}isEqual(e){return(function(n,s){if(n.length!==s.length)return!1;for(let i=0;i<n.length;++i)if(n[i]!==s[i])return!1;return!0})(this._values,e._values)}toJSON(){return{type:r._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Xn(e,r._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every((t=>typeof t=="number")))return new r(e.vectorValues);throw new $(N.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}};gt._jsonSchemaVersion="firestore/vectorValue/1.0",gt._jsonSchema={type:ye("string",gt._jsonSchemaVersion),vectorValues:ye("object")};var $R=/^__.*__$/,Vl=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return this.fieldMask!==null?new _t(e,this.data,this.fieldMask,t,this.fieldTransforms):new Fr(e,this.data,t,this.fieldTransforms)}},_a=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new _t(e,this.data,this.fieldMask,t,this.fieldTransforms)}};function t_(r){switch(r){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw K(40011,{dataSource:r})}}var Ll=class r{constructor(e,t,n,s,i,o){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=s,i===void 0&&this.Ac(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}i(e){return new r({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}dc(e){var s;let t=(s=this.path)==null?void 0:s.child(e),n=this.i({path:t,arrayElement:!1});return n.mc(e),n}fc(e){var s;let t=(s=this.path)==null?void 0:s.child(e),n=this.i({path:t,arrayElement:!1});return n.Ac(),n}gc(e){return this.i({path:void 0,arrayElement:!0})}yc(e){return va(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find((t=>e.isPrefixOf(t)))!==void 0||this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))!==void 0}Ac(){if(this.path)for(let e=0;e<this.path.length;e++)this.mc(this.path.get(e))}mc(e){if(e.length===0)throw this.yc("Document fields must not be empty");if(t_(this.dataSource)&&$R.test(e))throw this.yc('Document fields cannot begin and end with "__"')}},Fl=class{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||li(e)}A(e,t,n,s=!1){return new Ll({dataSource:e,methodName:t,targetDoc:n,path:qe.emptyPath(),arrayElement:!1,hasConverter:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function nh(r){let e=r._freezeSettings(),t=li(r._databaseId);return new Fl(r._databaseId,!!e.ignoreUndefinedProperties,t)}function r_(r,e,t,n,s,i={}){let o=r.A(i.merge||i.mergeFields?2:0,e,t,s);sh("Data must be an object, but it was:",o,n);let u=i_(n,o),c,l;if(i.merge)c=new He(o.fieldMask),l=o.fieldTransforms;else if(i.mergeFields){let f=[];for(let p of i.mergeFields){let m=Qn(e,p,t);if(!o.contains(m))throw new $(N.INVALID_ARGUMENT,`Field '${m}' is specified in your field mask but missing from your input data.`);a_(f,m)||f.push(m)}c=new He(f),l=o.fieldTransforms.filter((p=>c.covers(p.field)))}else c=null,l=o.fieldTransforms;return new Vl(new $e(u),c,l)}var wa=class r extends Jn{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.yc(`${this._methodName}() can only appear at the top level of your update data`):e.yc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof r}};function n_(r,e,t,n){let s=r.A(1,e,t);sh("Data must be an object, but it was:",s,n);let i=[],o=$e.empty();pr(n,((c,l)=>{let f=ih(e,c,t);l=ct(l);let p=s.fc(f);if(l instanceof wa)i.push(f);else{let m=Pa(l,p);m!=null&&(i.push(f),o.set(f,m))}}));let u=new He(i);return new _a(o,u,s.fieldTransforms)}function s_(r,e,t,n,s,i){let o=r.A(1,e,t),u=[Qn(e,n,t)],c=[s];if(i.length%2!=0)throw new $(N.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let m=0;m<i.length;m+=2)u.push(Qn(e,i[m])),c.push(i[m+1]);let l=[],f=$e.empty();for(let m=u.length-1;m>=0;--m)if(!a_(l,u[m])){let y=u[m],T=c[m];T=ct(T);let x=o.fc(y);if(T instanceof wa)l.push(y);else{let I=Pa(T,x);I!=null&&(l.push(y),f.set(y,I))}}let p=new He(l);return new _a(f,p,o.fieldTransforms)}function Pa(r,e){if(o_(r=ct(r)))return sh("Unsupported field value:",e,r),i_(r,e);if(r instanceof Jn)return(function(n,s){if(!t_(s.dataSource))throw s.yc(`${n._methodName}() can only be used with update() and set()`);if(!s.path)throw s.yc(`${n._methodName}() is not currently supported inside arrays`);let i=n._toFieldTransform(s);i&&s.fieldTransforms.push(i)})(r,e),null;if(r===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),r instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.yc("Nested arrays are not supported");return(function(n,s){let i=[],o=0;for(let u of n){let c=Pa(u,s.gc(o));c==null&&(c={nullValue:"NULL_VALUE"}),i.push(c),o++}return{arrayValue:{values:i}}})(r,e)}return(function(n,s){if((n=ct(n))===null)return{nullValue:"NULL_VALUE"};if(typeof n=="number")return xx(s.serializer,n);if(typeof n=="boolean")return{booleanValue:n};if(typeof n=="string")return{stringValue:n};if(n instanceof Date){let i=_e.fromDate(n);return{timestampValue:ea(s.serializer,i)}}if(n instanceof _e){let i=new _e(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:ea(s.serializer,i)}}if(n instanceof Ot)return{geoPointValue:{latitude:n.latitude,longitude:n.longitude}};if(n instanceof mt)return{bytesValue:Ey(s.serializer,n._byteString)};if(n instanceof Ie){let i=s.databaseId,o=n.firestore._databaseId;if(!o.isEqual(i))throw s.yc(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Gl(n.firestore._databaseId||s.databaseId,n._key.path)}}if(n instanceof gt)return(function(o,u){let c=o instanceof gt?o.toArray():o;return{mapValue:{fields:{[Ul]:{stringValue:Bl},[Mn]:{arrayValue:{values:c.map((f=>{if(typeof f!="number")throw u.yc("VectorValues must only contain numeric values.");return Kl(u.serializer,f)}))}}}}}})(n,s);if(Py(n))return n._toProto(s.serializer);throw s.yc(`Unsupported field value: ${ba(n)}`)})(r,e)}function i_(r,e){let t={};return Wg(r)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):pr(r,((n,s)=>{let i=Pa(s,e.dc(n));i!=null&&(t[n]=i)})),{mapValue:{fields:t}}}function o_(r){return!(typeof r!="object"||r===null||r instanceof Array||r instanceof Date||r instanceof _e||r instanceof Ot||r instanceof mt||r instanceof Ie||r instanceof Jn||r instanceof gt||Py(r))}function sh(r,e,t){if(!o_(t)||!Og(t)){let n=ba(t);throw n==="an object"?e.yc(r+" a custom object"):e.yc(r+" "+n)}}function Qn(r,e,t){if((e=ct(e))instanceof Br)return e._internalPath;if(typeof e=="string")return ih(r,e);throw va("Field path arguments must be of type string or ",r,!1,void 0,t)}var qR=new RegExp("[~\\*/\\[\\]]");function ih(r,e,t){if(e.search(qR)>=0)throw va(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,r,!1,void 0,t);try{return new Br(...e.split("."))._internalPath}catch{throw va(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,r,!1,void 0,t)}}function va(r,e,t,n,s){let i=n&&!n.isEmpty(),o=s!==void 0,u=`Function ${e}() called with invalid data`;t&&(u+=" (via `toFirestore()`)"),u+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${n}`),o&&(c+=` in document ${s}`),c+=")"),new $(N.INVALID_ARGUMENT,u+r+c)}function a_(r,e){return r.some((t=>t.isEqual(e)))}var ai=class{convertValue(e,t="none"){switch(hr(e)){case 0:return null;case 1:return e.booleanValue;case 2:return ce(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Lt(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw K(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){let n={};return pr(e,((s,i)=>{n[s]=this.convertValue(i,t)})),n}convertVectorValue(e){var n,s,i;let t=(i=(s=(n=e.fields)==null?void 0:n[Mn].arrayValue)==null?void 0:s.values)==null?void 0:i.map((o=>ce(o.doubleValue)));return new gt(t)}convertGeoPoint(e){return new Ot(ce(e.latitude),ce(e.longitude))}convertArray(e,t){return(e.values||[]).map((n=>this.convertValue(n,t)))}convertServerTimestamp(e,t){switch(t){case"previous":let n=Ia(e);return n==null?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Ys(e));default:return null}}convertTimestamp(e){let t=Vt(e);return new _e(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=fe.fromString(e);te(Ry(n),9688,{name:e});let s=new Xs(n.get(1),n.get(3)),i=new z(n.popFirst(5));return s.isEqual(t)||Dt(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}};var ui=class extends ai{constructor(e){super(),this.firestore=e}convertBytes(e){return new mt(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);return new Ie(this.firestore,null,t)}};var u_="@firebase/firestore",c_="4.13.0";function l_(r){return(function(t,n){if(typeof t!="object"||t===null)return!1;let s=t;for(let i of n)if(i in s&&typeof s[i]=="function")return!0;return!1})(r,["next","error","complete"])}var Ca=class{constructor(e,t,n,s,i){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Ie(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new oh(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){var e,t;return(t=(e=this._document)==null?void 0:e.data.clone().value.mapValue.fields)!=null?t:void 0}get(e){if(this._document){let t=this._document.data.field(Qn("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}},oh=class extends Ca{data(){return super.data()}};function WR(r){if(r.limitType==="L"&&r.explicitOrderBy.length===0)throw new $(N.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}function HR(r,e,t){let n;return n=r?t&&(t.merge||t.mergeFields)?r.toFirestore(e,t):r.toFirestore(e):e,n}var qr=class{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},zr=class r extends Ca{constructor(e,t,n,s,i,o){super(e,t,n,s,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new ns(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){let n=this._document.data.field(Qn("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new $(N.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e=this._document,t={};return t.type=r._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?t:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t)}};zr._jsonSchemaVersion="firestore/documentSnapshot/1.0",zr._jsonSchema={type:ye("string",zr._jsonSchemaVersion),bundleSource:ye("string","DocumentSnapshot"),bundleName:ye("string"),bundle:ye("string")};var ns=class extends zr{data(e={}){return super.data(e)}},ss=class r{constructor(e,t,n,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new qr(s.hasPendingWrites,s.fromCache),this.query=n}get docs(){let e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new ns(this._firestore,this._userDataWriter,n.key,n,new qr(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){let t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new $(N.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=(function(s,i){if(s._snapshot.oldDocs.isEmpty()){let o=0;return s._snapshot.docChanges.map((u=>{let c=new ns(s._firestore,s._userDataWriter,u.doc.key,u.doc,new qr(s._snapshot.mutatedKeys.has(u.doc.key),s._snapshot.fromCache),s.query.converter);return u.doc,{type:"added",doc:c,oldIndex:-1,newIndex:o++}}))}{let o=s._snapshot.oldDocs;return s._snapshot.docChanges.filter((u=>i||u.type!==3)).map((u=>{let c=new ns(s._firestore,s._userDataWriter,u.doc.key,u.doc,new qr(s._snapshot.mutatedKeys.has(u.doc.key),s._snapshot.fromCache),s.query.converter),l=-1,f=-1;return u.type!==0&&(l=o.indexOf(u.doc.key),o=o.delete(u.doc.key)),u.type!==1&&(o=o.add(u.doc),f=o.indexOf(u.doc.key)),{type:JR(u.type),doc:c,oldIndex:l,newIndex:f}}))}})(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new $(N.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e={};e.type=r._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=kr.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let t=[],n=[],s=[];return this.docs.forEach((i=>{i._document!==null&&(t.push(i._document),n.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),s.push(i.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}};function JR(r){switch(r){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return K(61501,{type:r})}}ss._jsonSchemaVersion="firestore/querySnapshot/1.0",ss._jsonSchema={type:ye("string",ss._jsonSchemaVersion),bundleSource:ye("string","QuerySnapshot"),bundleName:ye("string"),bundle:ye("string")};function ah(r){r=Je(r,Ie);let e=Je(r.firestore,wt),t=fi(e);return Qy(t,r._key).then((n=>f_(e,r,n)))}function uh(r,e,t){r=Je(r,Ie);let n=Je(r.firestore,wt),s=HR(r.converter,e,t),i=nh(n);return d_(n,[r_(i,"setDoc",r._key,s,r.converter!==null,t).toMutation(r._key,kt.none())])}function ch(r,e,t,...n){r=Je(r,Ie);let s=Je(r.firestore,wt),i=nh(s),o;return o=typeof(e=ct(e))=="string"||e instanceof Br?s_(i,"updateDoc",r._key,e,t,n):n_(i,"updateDoc",r._key,e),d_(s,[o.toMutation(r._key,kt.exists(!0))])}function h_(r,...e){var l,f,p;r=ct(r);let t={includeMetadataChanges:!1,source:"default"},n=0;typeof e[n]!="object"||l_(e[n])||(t=e[n++]);let s={includeMetadataChanges:t.includeMetadataChanges,source:t.source};if(l_(e[n])){let m=e[n];e[n]=(l=m.next)==null?void 0:l.bind(m),e[n+1]=(f=m.error)==null?void 0:f.bind(m),e[n+2]=(p=m.complete)==null?void 0:p.bind(m)}let i,o,u;if(r instanceof Ie)o=Je(r.firestore,wt),u=ci(r._key.path),i={next:m=>{e[n]&&e[n](f_(o,r,m))},error:e[n+1],complete:e[n+2]};else{let m=Je(r,Wn);o=Je(m.firestore,wt),u=m._query;let y=new ui(o);i={next:T=>{e[n]&&e[n](new ss(o,y,m,T))},error:e[n+1],complete:e[n+2]},WR(r._query)}let c=fi(o);return Jy(c,u,s,i)}function d_(r,e){let t=fi(r);return Yy(t,e)}function f_(r,e,t){let n=t.docs.get(e._key),s=new ui(r);return new zr(r,s,e._key,n,new qr(t.hasPendingWrites,t.fromCache),e.converter)}(function(e,t=!0){Pg(jm),Bs(new xt("firestore",((n,{instanceIdentifier:s,options:i})=>{let o=n.getProvider("app").getImmediate(),u=new wt(new Uo(n.getProvider("auth-internal")),new $o(o,n.getProvider("app-check-internal")),Xg(o,s),o);return i={useFetchStreams:t,...i},u._setSettings(i),u}),"PUBLIC").setMultipleInstances(!0)),lr(u_,c_,e),lr(u_,c_,"esm2020")})();function Kr(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t}function p_(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function u(f){try{l(n.next(f))}catch(p){o(p)}}function c(f){try{l(n.throw(f))}catch(p){o(p)}}function l(f){f.done?i(f.value):s(f.value).then(u,c)}l((n=n.apply(r,e||[])).next())})}var m_=r=>r?(...e)=>r(...e):(...e)=>fetch(...e);var is=class extends Error{constructor(e,t="FunctionsError",n){super(e),this.name=t,this.context=n}},pi=class extends is{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}},os=class extends is{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}},as=class extends is{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}},mi;(function(r){r.Any="any",r.ApNortheast1="ap-northeast-1",r.ApNortheast2="ap-northeast-2",r.ApSouth1="ap-south-1",r.ApSoutheast1="ap-southeast-1",r.ApSoutheast2="ap-southeast-2",r.CaCentral1="ca-central-1",r.EuCentral1="eu-central-1",r.EuWest1="eu-west-1",r.EuWest2="eu-west-2",r.EuWest3="eu-west-3",r.SaEast1="sa-east-1",r.UsEast1="us-east-1",r.UsWest1="us-west-1",r.UsWest2="us-west-2"})(mi||(mi={}));var gi=class{constructor(e,{headers:t={},customFetch:n,region:s=mi.Any}={}){this.url=e,this.headers=t,this.region=s,this.fetch=m_(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return p_(this,arguments,void 0,function*(t,n={}){var s;let i,o;try{let{headers:u,method:c,body:l,signal:f,timeout:p}=n,m={},{region:y}=n;y||(y=this.region);let T=new URL(`${this.url}/${t}`);y&&y!=="any"&&(m["x-region"]=y,T.searchParams.set("forceFunctionRegion",y));let x;l&&(u&&!Object.prototype.hasOwnProperty.call(u,"Content-Type")||!u)?typeof Blob!="undefined"&&l instanceof Blob||l instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",x=l):typeof l=="string"?(m["Content-Type"]="text/plain",x=l):typeof FormData!="undefined"&&l instanceof FormData?x=l:(m["Content-Type"]="application/json",x=JSON.stringify(l)):l&&typeof l!="string"&&!(typeof Blob!="undefined"&&l instanceof Blob)&&!(l instanceof ArrayBuffer)&&!(typeof FormData!="undefined"&&l instanceof FormData)?x=JSON.stringify(l):x=l;let I=f;p&&(o=new AbortController,i=setTimeout(()=>o.abort(),p),f?(I=o.signal,f.addEventListener("abort",()=>o.abort())):I=o.signal);let k=yield this.fetch(T.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),u),body:x,signal:I}).catch(B=>{throw new pi(B)}),O=k.headers.get("x-relay-error");if(O&&O==="true")throw new os(k);if(!k.ok)throw new as(k);let D=((s=k.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),M;return D==="application/json"?M=yield k.json():D==="application/octet-stream"||D==="application/pdf"?M=yield k.blob():D==="text/event-stream"?M=k:D==="multipart/form-data"?M=yield k.formData():M=yield k.text(),{data:M,error:null,response:k}}catch(u){return{data:null,error:u,response:u instanceof as||u instanceof os?u.context:void 0}}finally{i&&clearTimeout(i)}})}};var __=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}},QR=class{constructor(r){var e,t,n;this.shouldThrowOnError=!1,this.method=r.method,this.url=r.url,this.headers=new Headers(r.headers),this.schema=r.schema,this.body=r.body,this.shouldThrowOnError=(e=r.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=r.signal,this.isMaybeSingle=(t=r.isMaybeSingle)!==null&&t!==void 0?t:!1,this.urlLengthLimit=(n=r.urlLengthLimit)!==null&&n!==void 0?n:8e3,r.fetch?this.fetch=r.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(r,e){return this.headers=new Headers(this.headers),this.headers.set(r,e),this}then(r,e){var t=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let n=this.fetch,s=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{let o=null,u=null,c=null,l=i.status,f=i.statusText;if(i.ok){var p,m;if(t.method!=="HEAD"){var y;let k=await i.text();k===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((y=t.headers.get("Accept"))===null||y===void 0)&&y.includes("application/vnd.pgrst.plan+text"))?u=k:u=JSON.parse(k))}let x=(p=t.headers.get("Prefer"))===null||p===void 0?void 0:p.match(/count=(exact|planned|estimated)/),I=(m=i.headers.get("content-range"))===null||m===void 0?void 0:m.split("/");x&&I&&I.length>1&&(c=parseInt(I[1])),t.isMaybeSingle&&t.method==="GET"&&Array.isArray(u)&&(u.length>1?(o={code:"PGRST116",details:`Results contain ${u.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},u=null,c=null,l=406,f="Not Acceptable"):u.length===1?u=u[0]:u=null)}else{var T;let x=await i.text();try{o=JSON.parse(x),Array.isArray(o)&&i.status===404&&(u=[],o=null,l=200,f="OK")}catch{i.status===404&&x===""?(l=204,f="No Content"):o={message:x}}if(o&&t.isMaybeSingle&&(!(o==null||(T=o.details)===null||T===void 0)&&T.includes("0 rows"))&&(o=null,l=200,f="OK"),o&&t.shouldThrowOnError)throw new __(o)}return{error:o,data:u,count:c,status:l,statusText:f}});return this.shouldThrowOnError||(s=s.catch(i=>{var o;let u="",c="",l="",f=i==null?void 0:i.cause;if(f){var p,m,y,T;let k=(p=f==null?void 0:f.message)!==null&&p!==void 0?p:"",O=(m=f==null?void 0:f.code)!==null&&m!==void 0?m:"";u=`${(y=i==null?void 0:i.name)!==null&&y!==void 0?y:"FetchError"}: ${i==null?void 0:i.message}`,u+=`
|
|
23
|
+
|
|
24
|
+
Caused by: ${(T=f==null?void 0:f.name)!==null&&T!==void 0?T:"Error"}: ${k}`,O&&(u+=` (${O})`),f!=null&&f.stack&&(u+=`
|
|
25
|
+
${f.stack}`)}else{var x;u=(x=i==null?void 0:i.stack)!==null&&x!==void 0?x:""}let I=this.url.toString().length;return(i==null?void 0:i.name)==="AbortError"||(i==null?void 0:i.code)==="ABORT_ERR"?(l="",c="Request was aborted (timeout or manual cancellation)",I>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${I} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((f==null?void 0:f.name)==="HeadersOverflowError"||(f==null?void 0:f.code)==="UND_ERR_HEADERS_OVERFLOW")&&(l="",c="HTTP headers exceeded server limits (typically 16KB)",I>this.urlLengthLimit&&(c+=`. Your request URL is ${I} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:u,hint:c,code:l},data:null,count:null,status:0,statusText:""}})),s.then(r,e)}returns(){return this}overrideTypes(){return this}},YR=class extends QR{select(r){let e=!1,t=(r!=null?r:"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",t),this.headers.append("Prefer","return=representation"),this}order(r,{ascending:e=!0,nullsFirst:t,foreignTable:n,referencedTable:s=n}={}){let i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${r}.${e?"asc":"desc"}${t===void 0?"":t?".nullsfirst":".nullslast"}`),this}limit(r,{foreignTable:e,referencedTable:t=e}={}){let n=typeof t=="undefined"?"limit":`${t}.limit`;return this.url.searchParams.set(n,`${r}`),this}range(r,e,{foreignTable:t,referencedTable:n=t}={}){let s=typeof n=="undefined"?"offset":`${n}.offset`,i=typeof n=="undefined"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${r}`),this.url.searchParams.set(i,`${e-r+1}`),this}abortSignal(r){return this.signal=r,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:r=!1,verbose:e=!1,settings:t=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var o;let u=[r?"analyze":null,e?"verbose":null,t?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${c}"; options=${u};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(r){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${r}`),this}},g_=new RegExp("[,()]"),us=class extends YR{eq(r,e){return this.url.searchParams.append(r,`eq.${e}`),this}neq(r,e){return this.url.searchParams.append(r,`neq.${e}`),this}gt(r,e){return this.url.searchParams.append(r,`gt.${e}`),this}gte(r,e){return this.url.searchParams.append(r,`gte.${e}`),this}lt(r,e){return this.url.searchParams.append(r,`lt.${e}`),this}lte(r,e){return this.url.searchParams.append(r,`lte.${e}`),this}like(r,e){return this.url.searchParams.append(r,`like.${e}`),this}likeAllOf(r,e){return this.url.searchParams.append(r,`like(all).{${e.join(",")}}`),this}likeAnyOf(r,e){return this.url.searchParams.append(r,`like(any).{${e.join(",")}}`),this}ilike(r,e){return this.url.searchParams.append(r,`ilike.${e}`),this}ilikeAllOf(r,e){return this.url.searchParams.append(r,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(r,e){return this.url.searchParams.append(r,`ilike(any).{${e.join(",")}}`),this}regexMatch(r,e){return this.url.searchParams.append(r,`match.${e}`),this}regexIMatch(r,e){return this.url.searchParams.append(r,`imatch.${e}`),this}is(r,e){return this.url.searchParams.append(r,`is.${e}`),this}isDistinct(r,e){return this.url.searchParams.append(r,`isdistinct.${e}`),this}in(r,e){let t=Array.from(new Set(e)).map(n=>typeof n=="string"&&g_.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(r,`in.(${t})`),this}notIn(r,e){let t=Array.from(new Set(e)).map(n=>typeof n=="string"&&g_.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(r,`not.in.(${t})`),this}contains(r,e){return typeof e=="string"?this.url.searchParams.append(r,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(r,`cs.{${e.join(",")}}`):this.url.searchParams.append(r,`cs.${JSON.stringify(e)}`),this}containedBy(r,e){return typeof e=="string"?this.url.searchParams.append(r,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(r,`cd.{${e.join(",")}}`):this.url.searchParams.append(r,`cd.${JSON.stringify(e)}`),this}rangeGt(r,e){return this.url.searchParams.append(r,`sr.${e}`),this}rangeGte(r,e){return this.url.searchParams.append(r,`nxl.${e}`),this}rangeLt(r,e){return this.url.searchParams.append(r,`sl.${e}`),this}rangeLte(r,e){return this.url.searchParams.append(r,`nxr.${e}`),this}rangeAdjacent(r,e){return this.url.searchParams.append(r,`adj.${e}`),this}overlaps(r,e){return typeof e=="string"?this.url.searchParams.append(r,`ov.${e}`):this.url.searchParams.append(r,`ov.{${e.join(",")}}`),this}textSearch(r,e,{config:t,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");let i=t===void 0?"":`(${t})`;return this.url.searchParams.append(r,`${s}fts${i}.${e}`),this}match(r){return Object.entries(r).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(r,e,t){return this.url.searchParams.append(r,`not.${e}.${t}`),this}or(r,{foreignTable:e,referencedTable:t=e}={}){let n=t?`${t}.or`:"or";return this.url.searchParams.append(n,`(${r})`),this}filter(r,e,t){return this.url.searchParams.append(r,`${e}.${t}`),this}},XR=class{constructor(r,{headers:e={},schema:t,fetch:n,urlLengthLimit:s=8e3}){this.url=r,this.headers=new Headers(e),this.schema=t,this.fetch=n,this.urlLengthLimit=s}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(r,e){let{head:t=!1,count:n}=e!=null?e:{},s=t?"HEAD":"GET",i=!1,o=(r!=null?r:"*").split("").map(l=>/\s/.test(l)&&!i?"":(l==='"'&&(i=!i),l)).join(""),{url:u,headers:c}=this.cloneRequestState();return u.searchParams.set("select",o),n&&c.append("Prefer",`count=${n}`),new us({method:s,url:u,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(r,{count:e,defaultToNull:t=!0}={}){var n;let s="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),t||o.append("Prefer","missing=default"),Array.isArray(r)){let u=r.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);i.searchParams.set("columns",c.join(","))}}return new us({method:s,url:i,headers:o,schema:this.schema,body:r,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(r,{onConflict:e,ignoreDuplicates:t=!1,count:n,defaultToNull:s=!0}={}){var i;let o="POST",{url:u,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${t?"ignore":"merge"}-duplicates`),e!==void 0&&u.searchParams.set("on_conflict",e),n&&c.append("Prefer",`count=${n}`),s||c.append("Prefer","missing=default"),Array.isArray(r)){let l=r.reduce((f,p)=>f.concat(Object.keys(p)),[]);if(l.length>0){let f=[...new Set(l)].map(p=>`"${p}"`);u.searchParams.set("columns",f.join(","))}}return new us({method:o,url:u,headers:c,schema:this.schema,body:r,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit})}update(r,{count:e}={}){var t;let n="PATCH",{url:s,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new us({method:n,url:s,headers:i,schema:this.schema,body:r,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:r}={}){var e;let t="DELETE",{url:n,headers:s}=this.cloneRequestState();return r&&s.append("Prefer",`count=${r}`),new us({method:t,url:n,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit})}};function yi(r){"@babel/helpers - typeof";return yi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yi(r)}function ZR(r,e){if(yi(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(yi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function eP(r){var e=ZR(r,"string");return yi(e)=="symbol"?e:e+""}function tP(r,e,t){return(e=eP(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function y_(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,n)}return t}function ka(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?y_(Object(t),!0).forEach(function(n){tP(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):y_(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var w_=class v_{constructor(e,{headers:t={},schema:n,fetch:s,timeout:i,urlLengthLimit:o=8e3}={}){this.url=e,this.headers=new Headers(t),this.schemaName=n,this.urlLengthLimit=o;let u=s!=null?s:globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,l)=>{let f=new AbortController,p=setTimeout(()=>f.abort(),i),m=l==null?void 0:l.signal;if(m){if(m.aborted)return clearTimeout(p),u(c,l);let y=()=>{clearTimeout(p),f.abort()};return m.addEventListener("abort",y,{once:!0}),u(c,ka(ka({},l),{},{signal:f.signal})).finally(()=>{clearTimeout(p),m.removeEventListener("abort",y)})}return u(c,ka(ka({},l),{},{signal:f.signal})).finally(()=>clearTimeout(p))}:this.fetch=u}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new XR(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(e){return new v_(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(e,t={},{head:n=!1,get:s=!1,count:i}={}){var o;let u,c=new URL(`${this.url}/rpc/${e}`),l,f=y=>y!==null&&typeof y=="object"&&(!Array.isArray(y)||y.some(f)),p=n&&Object.values(t).some(f);p?(u="POST",l=t):n||s?(u=n?"HEAD":"GET",Object.entries(t).filter(([y,T])=>T!==void 0).map(([y,T])=>[y,Array.isArray(T)?`{${T.join(",")}}`:`${T}`]).forEach(([y,T])=>{c.searchParams.append(y,T)})):(u="POST",l=t);let m=new Headers(this.headers);return p?m.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&m.set("Prefer",`count=${i}`),new us({method:u,url:c,headers:m,schema:this.schemaName,body:l,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit})}};var lh=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket!="undefined")return{type:"native",constructor:WebSocket};if(typeof globalThis!="undefined"&&typeof globalThis.WebSocket!="undefined")return{type:"native",constructor:globalThis.WebSocket};if(typeof global!="undefined"&&typeof global.WebSocket!="undefined")return{type:"native",constructor:global.WebSocket};if(typeof globalThis!="undefined"&&typeof globalThis.WebSocketPair!="undefined"&&typeof globalThis.WebSocket=="undefined")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis!="undefined"&&globalThis.EdgeRuntime||typeof navigator!="undefined"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};let t=globalThis.process;if(t){let n=t.versions;if(n&&n.node){let s=n.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket!="undefined"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
26
|
+
import ws from "ws"
|
|
27
|
+
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`
|
|
28
|
+
|
|
29
|
+
Suggested solution: ${e.workaround}`),new Error(t)}static createWebSocket(e,t){let n=this.getWebSocketConstructor();return new n(e,t)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}},hh=lh;var b_="2.99.1";var E_=`realtime-js/${b_}`,T_="1.0.0",dh="2.0.0",fh=dh;var _i=1e4,I_=1e3,A_=100,jt;(function(r){r[r.connecting=0]="connecting",r[r.open=1]="open",r[r.closing=2]="closing",r[r.closed=3]="closed"})(jt||(jt={}));var Ee;(function(r){r.closed="closed",r.errored="errored",r.joined="joined",r.joining="joining",r.leaving="leaving"})(Ee||(Ee={}));var Ke;(function(r){r.close="phx_close",r.error="phx_error",r.join="phx_join",r.reply="phx_reply",r.leave="phx_leave",r.access_token="access_token"})(Ke||(Ke={}));var Oa;(function(r){r.websocket="websocket"})(Oa||(Oa={}));var mr;(function(r){r.Connecting="connecting",r.Open="open",r.Closing="closing",r.Closed="closed"})(mr||(mr={}));var wi=class{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e!=null?e:[]}encode(e,t){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return t(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var t;return this._isArrayBuffer((t=e.payload)===null||t===void 0?void 0:t.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var t,n;let s=(n=(t=e.payload)===null||t===void 0?void 0:t.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var t,n;let s=(n=(t=e.payload)===null||t===void 0?void 0:t.payload)!==null&&n!==void 0?n:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,t,n){var s,i;let o=e.topic,u=(s=e.ref)!==null&&s!==void 0?s:"",c=(i=e.join_ref)!==null&&i!==void 0?i:"",l=e.payload.event,f=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},p=Object.keys(f).length===0?"":JSON.stringify(f);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`ref length ${u.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`userEvent length ${l.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`metadata length ${p.length} exceeds maximum of 255`);let m=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+u.length+o.length+l.length+p.length,y=new ArrayBuffer(this.HEADER_LENGTH+m),T=new DataView(y),x=0;T.setUint8(x++,this.KINDS.userBroadcastPush),T.setUint8(x++,c.length),T.setUint8(x++,u.length),T.setUint8(x++,o.length),T.setUint8(x++,l.length),T.setUint8(x++,p.length),T.setUint8(x++,t),Array.from(c,k=>T.setUint8(x++,k.charCodeAt(0))),Array.from(u,k=>T.setUint8(x++,k.charCodeAt(0))),Array.from(o,k=>T.setUint8(x++,k.charCodeAt(0))),Array.from(l,k=>T.setUint8(x++,k.charCodeAt(0))),Array.from(p,k=>T.setUint8(x++,k.charCodeAt(0)));var I=new Uint8Array(y.byteLength+n.byteLength);return I.set(new Uint8Array(y),0),I.set(new Uint8Array(n),y.byteLength),I.buffer}decode(e,t){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return t(n)}if(typeof e=="string"){let n=JSON.parse(e),[s,i,o,u,c]=n;return t({join_ref:s,ref:i,topic:o,event:u,payload:c})}return t({})}_binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),s=new TextDecoder;if(n===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,t,s)}_decodeUserBroadcast(e,t,n){let s=t.getUint8(1),i=t.getUint8(2),o=t.getUint8(3),u=t.getUint8(4),c=this.HEADER_LENGTH+4,l=n.decode(e.slice(c,c+s));c=c+s;let f=n.decode(e.slice(c,c+i));c=c+i;let p=n.decode(e.slice(c,c+o));c=c+o;let m=e.slice(c,e.byteLength),y=u===this.JSON_ENCODING?JSON.parse(n.decode(m)):m,T={type:this.BROADCAST_EVENT,event:f,payload:y};return o>0&&(T.meta=JSON.parse(p)),{join_ref:null,ref:null,topic:l,event:this.BROADCAST_EVENT,payload:T}}_isArrayBuffer(e){var t;return e instanceof ArrayBuffer||((t=e==null?void 0:e.constructor)===null||t===void 0?void 0:t.name)==="ArrayBuffer"}_pick(e,t){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>t.includes(n)))}};var Gr=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};var oe;(function(r){r.abstime="abstime",r.bool="bool",r.date="date",r.daterange="daterange",r.float4="float4",r.float8="float8",r.int2="int2",r.int4="int4",r.int4range="int4range",r.int8="int8",r.int8range="int8range",r.json="json",r.jsonb="jsonb",r.money="money",r.numeric="numeric",r.oid="oid",r.reltime="reltime",r.text="text",r.time="time",r.timestamp="timestamp",r.timestamptz="timestamptz",r.timetz="timetz",r.tsrange="tsrange",r.tstzrange="tstzrange"})(oe||(oe={}));var mh=(r,e,t={})=>{var n;let s=(n=t.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=rP(o,r,e,s),i),{}):{}},rP=(r,e,t,n)=>{let s=e.find(u=>u.name===r),i=s==null?void 0:s.type,o=t[r];return i&&!n.includes(i)?S_(i,o):ph(o)},S_=(r,e)=>{if(r.charAt(0)==="_"){let t=r.slice(1,r.length);return oP(e,t)}switch(r){case oe.bool:return nP(e);case oe.float4:case oe.float8:case oe.int2:case oe.int4:case oe.int8:case oe.numeric:case oe.oid:return sP(e);case oe.json:case oe.jsonb:return iP(e);case oe.timestamp:return aP(e);case oe.abstime:case oe.date:case oe.daterange:case oe.int4range:case oe.int8range:case oe.money:case oe.reltime:case oe.text:case oe.time:case oe.timestamptz:case oe.timetz:case oe.tsrange:case oe.tstzrange:return ph(e);default:return ph(e)}},ph=r=>r,nP=r=>{switch(r){case"t":return!0;case"f":return!1;default:return r}},sP=r=>{if(typeof r=="string"){let e=parseFloat(r);if(!Number.isNaN(e))return e}return r},iP=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch{return r}return r},oP=(r,e)=>{if(typeof r!="string")return r;let t=r.length-1,n=r[t];if(r[0]==="{"&&n==="}"){let i,o=r.slice(1,t);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(u=>S_(e,u))}return r},aP=r=>typeof r=="string"?r.replace(" ","T"):r,Da=r=>{let e=new URL(r);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var Wr=class{constructor(e,t,n={},s=_i){this.channel=e,this.event=t,this.payload=n,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var n;return this._hasReceived(e)&&t((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}};var gh;(function(r){r.SYNC="sync",r.JOIN="join",r.LEAVE="leave"})(gh||(gh={}));var cs=class r{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let n=(t==null?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},s=>{let{onJoin:i,onLeave:o,onSync:u}=this.caller;this.joinRef=this.channel._joinRef(),this.state=r.syncState(this.state,s,i,o),this.pendingDiffs.forEach(c=>{this.state=r.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],u()}),this.channel._on(n.diff,{},s=>{let{onJoin:i,onLeave:o,onSync:u}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=r.syncDiff(this.state,s,i,o),u())}),this.onJoin((s,i,o)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:o})}),this.onLeave((s,i,o)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,n,s){let i=this.cloneDeep(e),o=this.transformState(t),u={},c={};return this.map(i,(l,f)=>{o[l]||(c[l]=f)}),this.map(o,(l,f)=>{let p=i[l];if(p){let m=f.map(I=>I.presence_ref),y=p.map(I=>I.presence_ref),T=f.filter(I=>y.indexOf(I.presence_ref)<0),x=p.filter(I=>m.indexOf(I.presence_ref)<0);T.length>0&&(u[l]=T),x.length>0&&(c[l]=x)}else u[l]=f}),this.syncDiff(i,{joins:u,leaves:c},n,s)}static syncDiff(e,t,n,s){let{joins:i,leaves:o}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return n||(n=()=>{}),s||(s=()=>{}),this.map(i,(u,c)=>{var l;let f=(l=e[u])!==null&&l!==void 0?l:[];if(e[u]=this.cloneDeep(c),f.length>0){let p=e[u].map(y=>y.presence_ref),m=f.filter(y=>p.indexOf(y.presence_ref)<0);e[u].unshift(...m)}n(u,f,c)}),this.map(o,(u,c)=>{let l=e[u];if(!l)return;let f=c.map(p=>p.presence_ref);l=l.filter(p=>f.indexOf(p.presence_ref)<0),e[u]=l,s(u,l,c),l.length===0&&delete e[u]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(n=>t(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,n)=>{let s=e[n];return"metas"in s?t[n]=s.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):t[n]=s,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}};var yh;(function(r){r.ALL="*",r.INSERT="INSERT",r.UPDATE="UPDATE",r.DELETE="DELETE"})(yh||(yh={}));var ls;(function(r){r.BROADCAST="broadcast",r.PRESENCE="presence",r.POSTGRES_CHANGES="postgres_changes",r.SYSTEM="system"})(ls||(ls={}));var vt;(function(r){r.SUBSCRIBED="SUBSCRIBED",r.TIMED_OUT="TIMED_OUT",r.CLOSED="CLOSED",r.CHANNEL_ERROR="CHANNEL_ERROR"})(vt||(vt={}));var hs=class r{constructor(e,t={config:{}},n){var s,i;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.state=Ee.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new Wr(this,Ke.join,this.params,this.timeout),this.rejoinTimer=new Gr(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ee.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ee.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ee.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ee.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ee.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ke.reply,{},(o,u)=>{this._trigger(this._replyEventName(u),o)}),this.presence=new cs(this),this.broadcastEndpointURL=Da(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,t=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.state==Ee.closed){let{config:{broadcast:o,presence:u,private:c}}=this.params,l=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(y=>y.filter))!==null&&s!==void 0?s:[],f=!!this.bindings[ls.PRESENCE]&&this.bindings[ls.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,p={},m={broadcast:o,presence:Object.assign(Object.assign({},u),{enabled:f}),postgres_changes:l,private:c};this.socket.accessTokenValue&&(p.access_token=this.socket.accessTokenValue),this._onError(y=>e==null?void 0:e(vt.CHANNEL_ERROR,y)),this._onClose(()=>e==null?void 0:e(vt.CLOSED)),this.updateJoinPayload(Object.assign({config:m},p)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:y})=>{var T;if(this.socket._isManualToken()||this.socket.setAuth(),y===void 0){e==null||e(vt.SUBSCRIBED);return}else{let x=this.bindings.postgres_changes,I=(T=x==null?void 0:x.length)!==null&&T!==void 0?T:0,k=[];for(let O=0;O<I;O++){let D=x[O],{filter:{event:M,schema:B,table:F,filter:w}}=D,_=y&&y[O];if(_&&_.event===M&&r.isFilterValueEqual(_.schema,B)&&r.isFilterValueEqual(_.table,F)&&r.isFilterValueEqual(_.filter,w))k.push(Object.assign(Object.assign({},D),{id:_.id}));else{this.unsubscribe(),this.state=Ee.errored,e==null||e(vt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=k,e&&e(vt.SUBSCRIBED);return}}).receive("error",y=>{this.state=Ee.errored,e==null||e(vt.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(y).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(vt.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,n){return this.state===Ee.joined&&e===ls.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,t,n)}async httpSend(e,t,n={}){var s;if(t==null)return Promise.reject("Payload is required for httpSend()");let i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);let o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},u=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(u.status===202)return{success:!0};let c=u.statusText;try{let l=await u.json();c=l.error||l.message||c}catch{}return Promise.reject(new Error(c))}async send(e,t={}){var n,s;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");let{event:i,payload:o}=e,u={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(u.Authorization=`Bearer ${this.socket.accessTokenValue}`);let c={method:"POST",headers:u,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{let l=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=t.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=l.body)===null||s===void 0?void 0:s.cancel()),l.ok?"ok":"error"}catch(l){return l.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,u,c;let l=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(u=(o=this.params)===null||o===void 0?void 0:o.config)===null||u===void 0?void 0:u.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),l.receive("ok",()=>i("ok")),l.receive("error",()=>i("error")),l.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ee.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ke.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(s=>{n=new Wr(this,Ke.leave,{},e),n.receive("ok",()=>{t(),s("ok")}).receive("timeout",()=>{t(),s("timed out")}).receive("error",()=>{s("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ee.closed,this.bindings={}}async _fetchWithTimeout(e,t,n){let s=new AbortController,i=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:s.signal}));return clearTimeout(i),o}_push(e,t,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new Wr(this,e,t,n);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>A_){let t=this.pushBuffer.shift();t&&(t.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${t.event}`,t.payload))}}_onMessage(e,t,n){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,n){var s,i;let o=e.toLocaleLowerCase(),{close:u,error:c,leave:l,join:f}=Ke;if(n&&[u,c,l,f].indexOf(o)>=0&&n!==this._joinRef())return;let m=this._onMessage(o,t,n);if(t&&!m)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(y=>{var T,x,I;return((T=y.filter)===null||T===void 0?void 0:T.event)==="*"||((I=(x=y.filter)===null||x===void 0?void 0:x.event)===null||I===void 0?void 0:I.toLocaleLowerCase())===o}).map(y=>y.callback(m,n)):(i=this.bindings[o])===null||i===void 0||i.filter(y=>{var T,x,I,k,O,D;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in y){let M=y.id,B=(T=y.filter)===null||T===void 0?void 0:T.event;return M&&((x=t.ids)===null||x===void 0?void 0:x.includes(M))&&(B==="*"||(B==null?void 0:B.toLocaleLowerCase())===((I=t.data)===null||I===void 0?void 0:I.type.toLocaleLowerCase()))}else{let M=(O=(k=y==null?void 0:y.filter)===null||k===void 0?void 0:k.event)===null||O===void 0?void 0:O.toLocaleLowerCase();return M==="*"||M===((D=t==null?void 0:t.event)===null||D===void 0?void 0:D.toLocaleLowerCase())}else return y.type.toLocaleLowerCase()===o}).map(y=>{if(typeof m=="object"&&"ids"in m){let T=m.data,{schema:x,table:I,commit_timestamp:k,type:O,errors:D}=T;m=Object.assign(Object.assign({},{schema:x,table:I,commit_timestamp:k,eventType:O,new:{},old:{},errors:D}),this._getPayloadRecords(T))}y.callback(m,n)})}_isClosed(){return this.state===Ee.closed}_isJoined(){return this.state===Ee.joined}_isJoining(){return this.state===Ee.joining}_isLeaving(){return this.state===Ee.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,n){let s=e.toLocaleLowerCase(),i={type:s,filter:t,callback:n};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,t){let n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(s=>{var i;return!(((i=s.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===n&&r.isEqual(s.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}static isFilterValueEqual(e,t){let n=e!=null?e:void 0,s=t!=null?t:void 0;return n===s}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Ke.close,{},e)}_onError(e){this._on(Ke.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ee.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=mh(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=mh(e.columns,e.old_record)),t}};var _h=()=>{},Na={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},cP=[1e3,2e3,5e3,1e4],lP=1e4,hP=`
|
|
30
|
+
addEventListener("message", (e) => {
|
|
31
|
+
if (e.data.event === "start") {
|
|
32
|
+
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
33
|
+
}
|
|
34
|
+
});`,ds=class{constructor(e,t){var n;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=_i,this.transport=null,this.heartbeatIntervalMs=Na.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=_h,this.ref=0,this.reconnectTimer=null,this.vsn=fh,this.logger=_h,this.conn=null,this.sendBuffer=[],this.serializer=new wi,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=s=>s?(...i)=>s(...i):(...i)=>fetch(...i),!(!((n=t==null?void 0:t.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${Oa.websocket}`,this.httpEndpoint=Da(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(t==null?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=hh.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");let t=e.message;throw t.includes("Node.js")?new Error(`${t}
|
|
35
|
+
|
|
36
|
+
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
37
|
+
|
|
38
|
+
Option 1: Use Node.js 22+ which has native WebSocket support
|
|
39
|
+
Option 2: Install and provide the "ws" package:
|
|
40
|
+
|
|
41
|
+
npm install ws
|
|
42
|
+
|
|
43
|
+
import ws from "ws"
|
|
44
|
+
const client = new RealtimeClient(url, {
|
|
45
|
+
...options,
|
|
46
|
+
transport: ws
|
|
47
|
+
})`):new Error(`WebSocket not available: ${t}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){let n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,t!=null?t:""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),t}async removeAllChannels(){let e=await Promise.all(this.channels.map(t=>t.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,n){this.logger(e,t,n)}connectionState(){switch(this.conn&&this.conn.readyState){case jt.connecting:return mr.Connecting;case jt.open:return mr.Open;case jt.closing:return mr.Closing;default:return mr.Closed}}isConnected(){return this.connectionState()===mr.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,t={config:{}}){let n=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{let i=new hs(`realtime:${e}`,t,this);return this.channels.push(i),i}}push(e){let{topic:t,event:n,payload:s,ref:i}=e,o=()=>{this.encode(e,u=>{var c;(c=this.conn)===null||c===void 0||c.send(u)})};this.log("push",`${t} ${n} (${i})`,s),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(I_,"heartbeat timeout"),setTimeout(()=>{var t;this.isConnected()||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout()},Na.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,t=>{if(t.topic==="phoenix"&&t.event==="phx_reply"&&t.ref&&t.ref===this.pendingHeartbeatRef){let l=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(t.payload.status==="ok"?"ok":"error",l)}catch(f){this.log("error","error in heartbeat callback",f)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}let{topic:n,event:s,payload:i,ref:o}=t,u=o?`(${o})`:"",c=i.status||"";this.log("receive",`${c} ${n} ${s} ${u}`.trim(),i),this.channels.filter(l=>l._isMember(n)).forEach(l=>l._trigger(s,i,o)),this._triggerStateCallbacks("message",t)})}_clearTimer(e){var t;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((t=this.reconnectTimer)===null||t===void 0||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===jt.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===jt.open||this.conn.readyState===jt.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.accessTokenValue&&(this.channels.forEach(t=>{t.updateJoinPayload({access_token:this.accessTokenValue})}),this.sendBuffer=[],this.channels.forEach(t=>{t._isJoining()&&(t.joinPush.sent=!1,t.joinPush.send())})),this.flushSendBuffer()}).catch(t=>{this.log("error","error waiting for auth on connect",t),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=t=>{this.log("worker","worker error",t.message),this._terminateWorker()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e);try{this.heartbeatCallback("error")}catch(t){this.log("error","error in heartbeat callback",t)}}_triggerChanError(){this.channels.forEach(e=>e._trigger(Ke.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?",s=new URLSearchParams(t);return`${e}${n}${s}`}_workerObjectUrl(e){let t;if(e)t=e;else{let n=new Blob([hP],{type:"application/javascript"});t=URL.createObjectURL(n)}return t}_setConnectionState(e,t=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t,n=!1;if(e)t=e,n=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),t=this.accessTokenValue}else t=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(s=>{let i={access_token:t,version:E_};t&&s.updateJoinPayload(i),s.joinedOnce&&s._isJoined()&&s._push(Ke.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log("error",`Error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new Gr(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Na.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,n,s,i,o,u,c,l,f,p,m,y;switch(this.transport=(t=e==null?void 0:e.transport)!==null&&t!==void 0?t:null,this.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:_i,this.heartbeatIntervalMs=(s=e==null?void 0:e.heartbeatIntervalMs)!==null&&s!==void 0?s:Na.HEARTBEAT_INTERVAL,this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=e==null?void 0:e.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(u=e==null?void 0:e.heartbeatCallback)!==null&&u!==void 0?u:_h,this.vsn=(c=e==null?void 0:e.vsn)!==null&&c!==void 0?c:fh,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(l=e==null?void 0:e.reconnectAfterMs)!==null&&l!==void 0?l:(T=>cP[T-1]||lP),this.vsn){case T_:this.encode=(f=e==null?void 0:e.encode)!==null&&f!==void 0?f:((T,x)=>x(JSON.stringify(T))),this.decode=(p=e==null?void 0:e.decode)!==null&&p!==void 0?p:((T,x)=>x(JSON.parse(T)));break;case dh:this.encode=(m=e==null?void 0:e.encode)!==null&&m!==void 0?m:this.serializer.encode.bind(this.serializer),this.decode=(y=e==null?void 0:e.decode)!==null&&y!==void 0?y:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window!="undefined"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}};var vi=class extends Error{constructor(r,e){var t;super(r),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((t=e.icebergType)==null?void 0:t.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function dP(r,e,t){let n=new URL(e,r);if(t)for(let[s,i]of Object.entries(t))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function fP(r){return!r||r.type==="none"?{}:r.type==="bearer"?{Authorization:`Bearer ${r.token}`}:r.type==="header"?{[r.name]:r.value}:r.type==="custom"?await r.getHeaders():{}}function pP(r){var t;let e=(t=r.fetchImpl)!=null?t:globalThis.fetch;return{async request({method:n,path:s,query:i,body:o,headers:u}){var T;let c=dP(r.baseUrl,s,i),l=await fP(r.auth),f=await e(c,{method:n,headers:{...o?{"Content-Type":"application/json"}:{},...l,...u},body:o?JSON.stringify(o):void 0}),p=await f.text(),m=(f.headers.get("content-type")||"").includes("application/json"),y=m&&p?JSON.parse(p):p;if(!f.ok){let x=m?y:void 0,I=x==null?void 0:x.error;throw new vi((T=I==null?void 0:I.message)!=null?T:`Request failed with status ${f.status}`,{status:f.status,icebergType:I==null?void 0:I.type,icebergCode:I==null?void 0:I.code,details:x})}return{status:f.status,headers:f.headers,data:y}}}}function Va(r){return r.join("")}var mP=class{constructor(r,e=""){this.client=r,this.prefix=e}async listNamespaces(r){let e=r?{parent:Va(r.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(r,e){let t={namespace:r.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:t})).data}async dropNamespace(r){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Va(r.namespace)}`})}async loadNamespaceMetadata(r){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Va(r.namespace)}`})).data.properties}}async namespaceExists(r){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Va(r.namespace)}`}),!0}catch(e){if(e instanceof vi&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(r,e){try{return await this.createNamespace(r,e)}catch(t){if(t instanceof vi&&t.status===409)return;throw t}}};function fs(r){return r.join("")}var gP=class{constructor(r,e="",t){this.client=r,this.prefix=e,this.accessDelegation=t}async listTables(r){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${fs(r.namespace)}/tables`})).data.identifiers}async createTable(r,e){let t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${fs(r.namespace)}/tables`,body:e,headers:t})).data.metadata}async updateTable(r,e){let t=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${fs(r.namespace)}/tables/${r.name}`,body:e});return{"metadata-location":t.data["metadata-location"],metadata:t.data.metadata}}async dropTable(r,e){var t;await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${fs(r.namespace)}/tables/${r.name}`,query:{purgeRequested:String((t=e==null?void 0:e.purge)!=null?t:!1)}})}async loadTable(r){let e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${fs(r.namespace)}/tables/${r.name}`,headers:e})).data.metadata}async tableExists(r){let e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${fs(r.namespace)}/tables/${r.name}`,headers:e}),!0}catch(t){if(t instanceof vi&&t.status===404)return!1;throw t}}async createTableIfNotExists(r,e){try{return await this.createTable(r,e)}catch(t){if(t instanceof vi&&t.status===409)return await this.loadTable({namespace:r.namespace,name:e.name});throw t}}},x_=class{constructor(r){var n;let e="v1";r.catalogName&&(e+=`/${r.catalogName}`);let t=r.baseUrl.endsWith("/")?r.baseUrl:`${r.baseUrl}/`;this.client=pP({baseUrl:t,auth:r.auth,fetchImpl:r.fetch}),this.accessDelegation=(n=r.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new mP(this.client,e),this.tableOps=new gP(this.client,e,this.accessDelegation)}async listNamespaces(r){return this.namespaceOps.listNamespaces(r)}async createNamespace(r,e){return this.namespaceOps.createNamespace(r,e)}async dropNamespace(r){await this.namespaceOps.dropNamespace(r)}async loadNamespaceMetadata(r){return this.namespaceOps.loadNamespaceMetadata(r)}async listTables(r){return this.tableOps.listTables(r)}async createTable(r,e){return this.tableOps.createTable(r,e)}async updateTable(r,e){return this.tableOps.updateTable(r,e)}async dropTable(r,e){await this.tableOps.dropTable(r,e)}async loadTable(r){return this.tableOps.loadTable(r)}async namespaceExists(r){return this.namespaceOps.namespaceExists(r)}async tableExists(r){return this.tableOps.tableExists(r)}async createNamespaceIfNotExists(r,e){return this.namespaceOps.createNamespaceIfNotExists(r,e)}async createTableIfNotExists(r,e){return this.tableOps.createTableIfNotExists(r,e)}};var La=class extends Error{constructor(r,e="storage",t,n){super(r),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=t,this.statusCode=n}};function Fa(r){return typeof r=="object"&&r!==null&&"__isStorageError"in r}var Ei=class extends La{constructor(r,e,t,n="storage"){super(r,n,e,t),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=t}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},k_=class extends La{constructor(r,e,t="storage"){super(r,t),this.name=t==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};var yP=r=>r?(...e)=>r(...e):(...e)=>fetch(...e),_P=r=>{if(typeof r!="object"||r===null)return!1;let e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},wh=r=>{if(Array.isArray(r))return r.map(t=>wh(t));if(typeof r=="function"||r!==Object(r))return r;let e={};return Object.entries(r).forEach(([t,n])=>{let s=t.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=wh(n)}),e},wP=r=>!r||typeof r!="string"||r.length===0||r.length>100||r.trim()!==r||r.includes("/")||r.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(r);function Ti(r){"@babel/helpers - typeof";return Ti=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ti(r)}function vP(r,e){if(Ti(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(Ti(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function bP(r){var e=vP(r,"string");return Ti(e)=="symbol"?e:e+""}function EP(r,e,t){return(e=bP(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function R_(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,n)}return t}function G(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?R_(Object(t),!0).forEach(function(n){EP(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):R_(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var P_=r=>{var e;return r.msg||r.message||r.error_description||(typeof r.error=="string"?r.error:(e=r.error)===null||e===void 0?void 0:e.message)||JSON.stringify(r)},TP=async(r,e,t,n)=>{if(r&&typeof r=="object"&&"status"in r&&"ok"in r&&typeof r.status=="number"){let s=r,i=s.status||500;if(typeof s.json=="function")s.json().then(o=>{let u=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";e(new Ei(P_(o),i,u,n))}).catch(()=>{if(n==="vectors"){let o=i+"";e(new Ei(s.statusText||`HTTP ${i} error`,i,o,n))}else{let o=i+"";e(new Ei(s.statusText||`HTTP ${i} error`,i,o,n))}});else{let o=i+"";e(new Ei(s.statusText||`HTTP ${i} error`,i,o,n))}}else e(new k_(P_(r),r,n))},IP=(r,e,t,n)=>{let s={method:r,headers:(e==null?void 0:e.headers)||{}};return r==="GET"||r==="HEAD"||!n?G(G({},s),t):(_P(n)?(s.headers=G({"Content-Type":"application/json"},e==null?void 0:e.headers),s.body=JSON.stringify(n)):s.body=n,e!=null&&e.duplex&&(s.duplex=e.duplex),G(G({},s),t))};async function bi(r,e,t,n,s,i,o){return new Promise((u,c)=>{r(t,IP(e,n,s,i)).then(l=>{if(!l.ok)throw l;if(n!=null&&n.noResolveJson)return l;if(o==="vectors"){let f=l.headers.get("content-type");if(l.headers.get("content-length")==="0"||l.status===204)return{};if(!f||!f.includes("application/json"))return{}}return l.json()}).then(l=>u(l)).catch(l=>TP(l,c,n,o))})}function O_(r="storage"){return{get:async(e,t,n,s)=>bi(e,"GET",t,n,s,void 0,r),post:async(e,t,n,s,i)=>bi(e,"POST",t,s,i,n,r),put:async(e,t,n,s,i)=>bi(e,"PUT",t,s,i,n,r),head:async(e,t,n,s)=>bi(e,"HEAD",t,G(G({},n),{},{noResolveJson:!0}),s,void 0,r),remove:async(e,t,n,s,i)=>bi(e,"DELETE",t,s,i,n,r)}}var AP=O_("storage"),{get:Ii,post:nt,put:vh,head:SP,remove:bh}=AP,Ge=O_("vectors"),ps=class{constructor(r,e={},t,n="storage"){this.shouldThrowOnError=!1,this.url=r,this.headers=e,this.fetch=yP(t),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(r,e){return this.headers=G(G({},this.headers),{},{[r]:e}),this}async handleOperation(r){var e=this;try{return{data:await r(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Fa(t))return{data:null,error:t};throw t}}},xP=class{constructor(r,e){this.downloadFn=r,this.shouldThrowOnError=e}then(r,e){return this.execute().then(r,e)}async execute(){var r=this;try{return{data:(await r.downloadFn()).body,error:null}}catch(e){if(r.shouldThrowOnError)throw e;if(Fa(e))return{data:null,error:e};throw e}}},D_;D_=Symbol.toStringTag;var RP=class{constructor(r,e){this.downloadFn=r,this.shouldThrowOnError=e,this[D_]="BlobDownloadBuilder",this.promise=null}asStream(){return new xP(this.downloadFn,this.shouldThrowOnError)}then(r,e){return this.getPromise().then(r,e)}catch(r){return this.getPromise().catch(r)}finally(r){return this.getPromise().finally(r)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var r=this;try{return{data:await(await r.downloadFn()).blob(),error:null}}catch(e){if(r.shouldThrowOnError)throw e;if(Fa(e))return{data:null,error:e};throw e}}},PP={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},C_={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},CP=class extends ps{constructor(r,e={},t,n){super(r,e,n,"storage"),this.bucketId=t}async uploadOrUpdate(r,e,t,n){var s=this;return s.handleOperation(async()=>{let i,o=G(G({},C_),n),u=G(G({},s.headers),r==="POST"&&{"x-upsert":String(o.upsert)}),c=o.metadata;typeof Blob!="undefined"&&t instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",s.encodeMetadata(c)),i.append("",t)):typeof FormData!="undefined"&&t instanceof FormData?(i=t,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),c&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(c))):(i=t,u["cache-control"]=`max-age=${o.cacheControl}`,u["content-type"]=o.contentType,c&&(u["x-metadata"]=s.toBase64(s.encodeMetadata(c))),(typeof ReadableStream!="undefined"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),n!=null&&n.headers&&(u=G(G({},u),n.headers));let l=s._removeEmptyFolders(e),f=s._getFinalPath(l),p=await(r=="PUT"?vh:nt)(s.fetch,`${s.url}/object/${f}`,i,G({headers:u},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:l,id:p.Id,fullPath:p.Key}})}async upload(r,e,t){return this.uploadOrUpdate("POST",r,e,t)}async uploadToSignedUrl(r,e,t,n){var s=this;let i=s._removeEmptyFolders(r),o=s._getFinalPath(i),u=new URL(s.url+`/object/upload/sign/${o}`);return u.searchParams.set("token",e),s.handleOperation(async()=>{let c,l=G({upsert:C_.upsert},n),f=G(G({},s.headers),{"x-upsert":String(l.upsert)});return typeof Blob!="undefined"&&t instanceof Blob?(c=new FormData,c.append("cacheControl",l.cacheControl),c.append("",t)):typeof FormData!="undefined"&&t instanceof FormData?(c=t,c.append("cacheControl",l.cacheControl)):(c=t,f["cache-control"]=`max-age=${l.cacheControl}`,f["content-type"]=l.contentType),{path:i,fullPath:(await vh(s.fetch,u.toString(),c,{headers:f})).Key}})}async createSignedUploadUrl(r,e){var t=this;return t.handleOperation(async()=>{let n=t._getFinalPath(r),s=G({},t.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");let i=await nt(t.fetch,`${t.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(t.url+i.url),u=o.searchParams.get("token");if(!u)throw new La("No token returned by API");return{signedUrl:o.toString(),path:r,token:u}})}async update(r,e,t){return this.uploadOrUpdate("PUT",r,e,t)}async move(r,e,t){var n=this;return n.handleOperation(async()=>await nt(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:r,destinationKey:e,destinationBucket:t==null?void 0:t.destinationBucket},{headers:n.headers}))}async copy(r,e,t){var n=this;return n.handleOperation(async()=>({path:(await nt(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:r,destinationKey:e,destinationBucket:t==null?void 0:t.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(r,e,t){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(r),i=await nt(n.fetch,`${n.url}/object/sign/${s}`,G({expiresIn:e},t!=null&&t.transform?{transform:t.transform}:{}),{headers:n.headers}),o=t!=null&&t.download?`&download=${t.download===!0?"":t.download}`:"",u=t!=null&&t.transform&&i.signedURL.includes("/object/sign/")?i.signedURL.replace("/object/sign/","/render/image/sign/"):i.signedURL;return{signedUrl:encodeURI(`${n.url}${u}${o}`)}})}async createSignedUrls(r,e,t){var n=this;return n.handleOperation(async()=>{let s=await nt(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:r},{headers:n.headers}),i=t!=null&&t.download?`&download=${t.download===!0?"":t.download}`:"";return s.map(o=>G(G({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${i}`):null}))})}download(r,e,t){let n=typeof(e==null?void 0:e.transform)!="undefined"?"render/image/authenticated":"object",s=this.transformOptsToQueryString((e==null?void 0:e.transform)||{}),i=s?`?${s}`:"",o=this._getFinalPath(r),u=()=>Ii(this.fetch,`${this.url}/${n}/${o}${i}`,{headers:this.headers,noResolveJson:!0},t);return new RP(u,this.shouldThrowOnError)}async info(r){var e=this;let t=e._getFinalPath(r);return e.handleOperation(async()=>wh(await Ii(e.fetch,`${e.url}/object/info/${t}`,{headers:e.headers})))}async exists(r){var e=this;let t=e._getFinalPath(r);try{return await SP(e.fetch,`${e.url}/object/${t}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(Fa(s)){var n;let i=s instanceof Ei?s.status:s instanceof k_?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(r,e){let t=this._getFinalPath(r),n=[],s=e!=null&&e.download?`download=${e.download===!0?"":e.download}`:"";s!==""&&n.push(s);let i=typeof(e==null?void 0:e.transform)!="undefined"?"render/image":"object",o=this.transformOptsToQueryString((e==null?void 0:e.transform)||{});o!==""&&n.push(o);let u=n.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${t}${u}`)}}}async remove(r){var e=this;return e.handleOperation(async()=>await bh(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:r},{headers:e.headers}))}async list(r,e,t){var n=this;return n.handleOperation(async()=>{let s=G(G(G({},PP),e),{},{prefix:r||""});return await nt(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},t)})}async listV2(r,e){var t=this;return t.handleOperation(async()=>{let n=G({},r);return await nt(t.fetch,`${t.url}/object/list-v2/${t.bucketId}`,n,{headers:t.headers},e)})}encodeMetadata(r){return JSON.stringify(r)}toBase64(r){return typeof Buffer!="undefined"?Buffer.from(r).toString("base64"):btoa(r)}_getFinalPath(r){return`${this.bucketId}/${r.replace(/^\/+/,"")}`}_removeEmptyFolders(r){return r.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(r){let e=[];return r.width&&e.push(`width=${r.width}`),r.height&&e.push(`height=${r.height}`),r.resize&&e.push(`resize=${r.resize}`),r.format&&e.push(`format=${r.format}`),r.quality&&e.push(`quality=${r.quality}`),e.join("&")}},kP="2.99.1",Ai={"X-Client-Info":`storage-js/${kP}`},OP=class extends ps{constructor(r,e={},t,n){let s=new URL(r);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));let i=s.href.replace(/\/$/,""),o=G(G({},Ai),e);super(i,o,t,"storage")}async listBuckets(r){var e=this;return e.handleOperation(async()=>{let t=e.listBucketOptionsToQueryString(r);return await Ii(e.fetch,`${e.url}/bucket${t}`,{headers:e.headers})})}async getBucket(r){var e=this;return e.handleOperation(async()=>await Ii(e.fetch,`${e.url}/bucket/${r}`,{headers:e.headers}))}async createBucket(r,e={public:!1}){var t=this;return t.handleOperation(async()=>await nt(t.fetch,`${t.url}/bucket`,{id:r,name:r,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:t.headers}))}async updateBucket(r,e){var t=this;return t.handleOperation(async()=>await vh(t.fetch,`${t.url}/bucket/${r}`,{id:r,name:r,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:t.headers}))}async emptyBucket(r){var e=this;return e.handleOperation(async()=>await nt(e.fetch,`${e.url}/bucket/${r}/empty`,{},{headers:e.headers}))}async deleteBucket(r){var e=this;return e.handleOperation(async()=>await bh(e.fetch,`${e.url}/bucket/${r}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(r){let e={};return r&&("limit"in r&&(e.limit=String(r.limit)),"offset"in r&&(e.offset=String(r.offset)),r.search&&(e.search=r.search),r.sortColumn&&(e.sortColumn=r.sortColumn),r.sortOrder&&(e.sortOrder=r.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},DP=class extends ps{constructor(r,e={},t){let n=r.replace(/\/$/,""),s=G(G({},Ai),e);super(n,s,t,"storage")}async createBucket(r){var e=this;return e.handleOperation(async()=>await nt(e.fetch,`${e.url}/bucket`,{name:r},{headers:e.headers}))}async listBuckets(r){var e=this;return e.handleOperation(async()=>{let t=new URLSearchParams;(r==null?void 0:r.limit)!==void 0&&t.set("limit",r.limit.toString()),(r==null?void 0:r.offset)!==void 0&&t.set("offset",r.offset.toString()),r!=null&&r.sortColumn&&t.set("sortColumn",r.sortColumn),r!=null&&r.sortOrder&&t.set("sortOrder",r.sortOrder),r!=null&&r.search&&t.set("search",r.search);let n=t.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await Ii(e.fetch,s,{headers:e.headers})})}async deleteBucket(r){var e=this;return e.handleOperation(async()=>await bh(e.fetch,`${e.url}/bucket/${r}`,{},{headers:e.headers}))}from(r){var e=this;if(!wP(r))throw new La("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");let t=new x_({baseUrl:this.url,catalogName:r,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(t,{get(s,i){let o=s[i];return typeof o!="function"?o:async(...u)=>{try{return{data:await o.apply(s,u),error:null}}catch(c){if(n)throw c;return{data:null,error:c}}}}})}},NP=class extends ps{constructor(r,e={},t){let n=r.replace(/\/$/,""),s=G(G({},Ai),{},{"Content-Type":"application/json"},e);super(n,s,t,"vectors")}async createIndex(r){var e=this;return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/CreateIndex`,r,{headers:e.headers})||{})}async getIndex(r,e){var t=this;return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/GetIndex`,{vectorBucketName:r,indexName:e},{headers:t.headers}))}async listIndexes(r){var e=this;return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/ListIndexes`,r,{headers:e.headers}))}async deleteIndex(r,e){var t=this;return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/DeleteIndex`,{vectorBucketName:r,indexName:e},{headers:t.headers})||{})}},VP=class extends ps{constructor(r,e={},t){let n=r.replace(/\/$/,""),s=G(G({},Ai),{},{"Content-Type":"application/json"},e);super(n,s,t,"vectors")}async putVectors(r){var e=this;if(r.vectors.length<1||r.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/PutVectors`,r,{headers:e.headers})||{})}async getVectors(r){var e=this;return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/GetVectors`,r,{headers:e.headers}))}async listVectors(r){var e=this;if(r.segmentCount!==void 0){if(r.segmentCount<1||r.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(r.segmentIndex!==void 0&&(r.segmentIndex<0||r.segmentIndex>=r.segmentCount))throw new Error(`segmentIndex must be between 0 and ${r.segmentCount-1}`)}return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/ListVectors`,r,{headers:e.headers}))}async queryVectors(r){var e=this;return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/QueryVectors`,r,{headers:e.headers}))}async deleteVectors(r){var e=this;if(r.keys.length<1||r.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/DeleteVectors`,r,{headers:e.headers})||{})}},LP=class extends ps{constructor(r,e={},t){let n=r.replace(/\/$/,""),s=G(G({},Ai),{},{"Content-Type":"application/json"},e);super(n,s,t,"vectors")}async createBucket(r){var e=this;return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:r},{headers:e.headers})||{})}async getBucket(r){var e=this;return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:r},{headers:e.headers}))}async listBuckets(r={}){var e=this;return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/ListVectorBuckets`,r,{headers:e.headers}))}async deleteBucket(r){var e=this;return e.handleOperation(async()=>await Ge.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:r},{headers:e.headers})||{})}},FP=class extends LP{constructor(r,e={}){super(r,e.headers||{},e.fetch)}from(r){return new MP(this.url,this.headers,r,this.fetch)}async createBucket(r){var e=()=>super.createBucket,t=this;return e().call(t,r)}async getBucket(r){var e=()=>super.getBucket,t=this;return e().call(t,r)}async listBuckets(r={}){var e=()=>super.listBuckets,t=this;return e().call(t,r)}async deleteBucket(r){var e=()=>super.deleteBucket,t=this;return e().call(t,r)}},MP=class extends NP{constructor(r,e,t,n){super(r,e,n),this.vectorBucketName=t}async createIndex(r){var e=()=>super.createIndex,t=this;return e().call(t,G(G({},r),{},{vectorBucketName:t.vectorBucketName}))}async listIndexes(r={}){var e=()=>super.listIndexes,t=this;return e().call(t,G(G({},r),{},{vectorBucketName:t.vectorBucketName}))}async getIndex(r){var e=()=>super.getIndex,t=this;return e().call(t,t.vectorBucketName,r)}async deleteIndex(r){var e=()=>super.deleteIndex,t=this;return e().call(t,t.vectorBucketName,r)}index(r){return new jP(this.url,this.headers,this.vectorBucketName,r,this.fetch)}},jP=class extends VP{constructor(r,e,t,n,s){super(r,e,s),this.vectorBucketName=t,this.indexName=n}async putVectors(r){var e=()=>super.putVectors,t=this;return e().call(t,G(G({},r),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(r){var e=()=>super.getVectors,t=this;return e().call(t,G(G({},r),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(r={}){var e=()=>super.listVectors,t=this;return e().call(t,G(G({},r),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(r){var e=()=>super.queryVectors,t=this;return e().call(t,G(G({},r),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(r){var e=()=>super.deleteVectors,t=this;return e().call(t,G(G({},r),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},N_=class extends OP{constructor(r,e={},t,n){super(r,e,t,n)}from(r){return new CP(this.url,this.headers,r,this.fetch)}get vectors(){return new FP(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new DP(this.url+"/iceberg",this.headers,this.fetch)}};var Ma="2.99.1";var Hr=30*1e3,ja=3,Ua=ja*Hr,V_="http://localhost:9999",L_="supabase.auth.token";var F_={"X-Client-Info":`gotrue-js/${Ma}`};var Si="X-Supabase-Api-Version",Eh={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},M_=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,j_=600*1e3;var gr=class extends Error{constructor(e,t,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=n}};function U(r){return typeof r=="object"&&r!==null&&"__isAuthError"in r}var Ba=class extends gr{constructor(e,t,n){super(e,t,n),this.name="AuthApiError",this.status=t,this.code=n}};function U_(r){return U(r)&&r.name==="AuthApiError"}var Qe=class extends gr{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}},st=class extends gr{constructor(e,t,n,s){super(e,n,s),this.name=t,this.status=n}},Oe=class extends st{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};function qa(r){return U(r)&&r.name==="AuthSessionMissingError"}var Ut=class extends st{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}},Jr=class extends st{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}},Qr=class extends st{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};function B_(r){return U(r)&&r.name==="AuthImplicitGrantRedirectError"}var xi=class extends st{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}},$a=class extends st{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}};var ms=class extends st{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}};function za(r){return U(r)&&r.name==="AuthRetryableFetchError"}var Ri=class extends st{constructor(e,t,n){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=n}};var Yr=class extends st{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}};var Ka="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),$_=`
|
|
48
|
+
\r=`.split(""),UP=(()=>{let r=new Array(128);for(let e=0;e<r.length;e+=1)r[e]=-1;for(let e=0;e<$_.length;e+=1)r[$_[e].charCodeAt(0)]=-2;for(let e=0;e<Ka.length;e+=1)r[Ka[e].charCodeAt(0)]=e;return r})();function q_(r,e,t){if(r!==null)for(e.queue=e.queue<<8|r,e.queuedBits+=8;e.queuedBits>=6;){let n=e.queue>>e.queuedBits-6&63;t(Ka[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){let n=e.queue>>e.queuedBits-6&63;t(Ka[n]),e.queuedBits-=6}}function z_(r,e,t){let n=UP[r];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)t(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(r)}"`)}}function Th(r){let e=[],t=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{qP(o,n,t)};for(let o=0;o<r.length;o+=1)z_(r.charCodeAt(o),s,i);return e.join("")}function BP(r,e){if(r<=127){e(r);return}else if(r<=2047){e(192|r>>6),e(128|r&63);return}else if(r<=65535){e(224|r>>12),e(128|r>>6&63),e(128|r&63);return}else if(r<=1114111){e(240|r>>18),e(128|r>>12&63),e(128|r>>6&63),e(128|r&63);return}throw new Error(`Unrecognized Unicode codepoint: ${r.toString(16)}`)}function $P(r,e){for(let t=0;t<r.length;t+=1){let n=r.charCodeAt(t);if(n>55295&&n<=56319){let s=(n-55296)*1024&65535;n=(r.charCodeAt(t+1)-56320&65535|s)+65536,t+=1}BP(n,e)}}function qP(r,e,t){if(e.utf8seq===0){if(r<=127){t(r);return}for(let n=1;n<6;n+=1)if((r>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=r&31;else if(e.utf8seq===3)e.codepoint=r&15;else if(e.utf8seq===4)e.codepoint=r&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(r<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|r&63,e.utf8seq-=1,e.utf8seq===0&&t(e.codepoint)}}function yr(r){let e=[],t={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<r.length;s+=1)z_(r.charCodeAt(s),t,n);return new Uint8Array(e)}function K_(r){let e=[];return $P(r,t=>e.push(t)),new Uint8Array(e)}function Bt(r){let e=[],t={queue:0,queuedBits:0},n=s=>{e.push(s)};return r.forEach(s=>q_(s,t,n)),q_(null,t,n),e.join("")}function G_(r){return Math.round(Date.now()/1e3)+r}function W_(){return Symbol("auth-callback")}var Ae=()=>typeof window!="undefined"&&typeof document!="undefined",Xr={tested:!1,writable:!1},Ga=()=>{if(!Ae())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Xr.tested)return Xr.writable;let r=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(r,r),globalThis.localStorage.removeItem(r),Xr.tested=!0,Xr.writable=!0}catch{Xr.tested=!0,Xr.writable=!1}return Xr.writable};function H_(r){let e={},t=new URL(r);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return t.searchParams.forEach((n,s)=>{e[s]=n}),e}var Wa=r=>r?(...e)=>r(...e):(...e)=>fetch(...e),J_=r=>typeof r=="object"&&r!==null&&"status"in r&&"ok"in r&&"json"in r&&typeof r.json=="function",Zr=async(r,e,t)=>{await r.setItem(e,JSON.stringify(t))},_r=async(r,e)=>{let t=await r.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},Ce=async(r,e)=>{await r.removeItem(e)},Pi=class r{constructor(){this.promise=new r.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}};Pi.promiseConstructor=Promise;function Ci(r){let e=r.split(".");if(e.length!==3)throw new Yr("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!M_.test(e[n]))throw new Yr("JWT not in base64url format");return{header:JSON.parse(Th(e[0])),payload:JSON.parse(Th(e[1])),signature:yr(e[2]),raw:{header:e[0],payload:e[1]}}}async function Q_(r){return await new Promise(e=>{setTimeout(()=>e(null),r)})}function Y_(r,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{let o=await r(i);if(!e(i,null,o)){n(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function zP(r){return("0"+r.toString(16)).substr(-2)}function KP(){let e=new Uint32Array(56);if(typeof crypto=="undefined"){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=t.length,s="";for(let i=0;i<56;i++)s+=t.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,zP).join("")}async function GP(r){let t=new TextEncoder().encode(r),n=await crypto.subtle.digest("SHA-256",t),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function WP(r){if(!(typeof crypto!="undefined"&&typeof crypto.subtle!="undefined"&&typeof TextEncoder!="undefined"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),r;let t=await GP(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function en(r,e,t=!1){let n=KP(),s=n;t&&(s+="/PASSWORD_RECOVERY"),await Zr(r,`${e}-code-verifier`,s);let i=await WP(n);return[i,n===i?"plain":"s256"]}var HP=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function X_(r){let e=r.headers.get(Si);if(!e||!e.match(HP))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Z_(r){if(!r)throw new Error("Missing exp claim");let e=Math.floor(Date.now()/1e3);if(r<=e)throw new Error("JWT has expired")}function ew(r){switch(r){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}var JP=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function tn(r){if(!JP.test(r))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Ha(){let r={};return new Proxy(r,{get:(e,t)=>{if(t==="__isUserNotAvailableProxy")return!0;if(typeof t=="symbol"){let n=t.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function tw(r,e){return new Proxy(r,{get:(t,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){let i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(t,n,s)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(t,n,s)}})}function Ih(r){return JSON.parse(JSON.stringify(r))}var rn=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),QP=[502,503,504];async function rw(r){var e;if(!J_(r))throw new ms(rn(r),0);if(QP.includes(r.status))throw new ms(rn(r),r.status);let t;try{t=await r.json()}catch(i){throw new Qe(rn(i),i)}let n,s=X_(r);if(s&&s.getTime()>=Eh["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?n=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(n=t.error_code),n){if(n==="weak_password")throw new Ri(rn(t),r.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Oe}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new Ri(rn(t),r.status,t.weak_password.reasons);throw new Ba(rn(t),r.status||500,n)}var YP=(r,e,t,n)=>{let s={method:r,headers:(e==null?void 0:e.headers)||{}};return r==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),t))};async function q(r,e,t,n){var s;let i=Object.assign({},n==null?void 0:n.headers);i[Si]||(i[Si]=Eh["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);let o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);let u=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await XP(r,e,t+u,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(c):{data:Object.assign({},c),error:null}}async function XP(r,e,t,n,s,i){let o=YP(e,n,s,i),u;try{u=await r(t,Object.assign({},o))}catch(c){throw console.error(c),new ms(rn(c),0)}if(u.ok||await rw(u),n!=null&&n.noResolveJson)return u;try{return await u.json()}catch(c){await rw(c)}}function Ye(r){var e;let t=null;ZP(r)&&(t=Object.assign({},r),r.expires_at||(t.expires_at=G_(r.expires_in)));let n=(e=r.user)!==null&&e!==void 0?e:r;return{data:{session:t,user:n},error:null}}function Ah(r){let e=Ye(r);return!e.error&&r.weak_password&&typeof r.weak_password=="object"&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.message&&typeof r.weak_password.message=="string"&&r.weak_password.reasons.reduce((t,n)=>t&&typeof n=="string",!0)&&(e.data.weak_password=r.weak_password),e}function bt(r){var e;return{data:{user:(e=r.user)!==null&&e!==void 0?e:r},error:null}}function nw(r){return{data:r,error:null}}function sw(r){let{action_link:e,email_otp:t,hashed_token:n,redirect_to:s,verification_type:i}=r,o=Kr(r,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),u={action_link:e,email_otp:t,hashed_token:n,redirect_to:s,verification_type:i},c=Object.assign({},o);return{data:{properties:u,user:c},error:null}}function Sh(r){return r}function ZP(r){return r.access_token&&r.refresh_token&&r.expires_in}var Ja=["global","local","others"];var nn=class{constructor({url:e="",headers:t={},fetch:n}){this.url=e,this.headers=t,this.fetch=Wa(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)}}async signOut(e,t=Ja[0]){if(Ja.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ja.join(", ")}`);try{return await q(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(U(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,t={}){try{return await q(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:bt})}catch(n){if(U(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{let{options:t}=e,n=Kr(e,["options"]),s=Object.assign(Object.assign({},n),t);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await q(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:sw,redirectTo:t==null?void 0:t.redirectTo})}catch(t){if(U(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await q(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:bt})}catch(t){if(U(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,n,s,i,o,u,c;try{let l={nextPage:null,lastPage:0,total:0},f=await q(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:Sh});if(f.error)throw f.error;let p=await f.json(),m=(o=f.headers.get("x-total-count"))!==null&&o!==void 0?o:0,y=(c=(u=f.headers.get("link"))===null||u===void 0?void 0:u.split(","))!==null&&c!==void 0?c:[];return y.length>0&&(y.forEach(T=>{let x=parseInt(T.split(";")[0].split("=")[1].substring(0,1)),I=JSON.parse(T.split(";")[1].split("=")[1]);l[`${I}Page`]=x}),l.total=parseInt(m)),{data:Object.assign(Object.assign({},p),l),error:null}}catch(l){if(U(l))return{data:{users:[]},error:l};throw l}}async getUserById(e){tn(e);try{return await q(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:bt})}catch(t){if(U(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){tn(e);try{return await q(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:bt})}catch(n){if(U(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,t=!1){tn(e);try{return await q(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:bt})}catch(n){if(U(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){tn(e.userId);try{let{data:t,error:n}=await q(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:t,error:n}}catch(t){if(U(t))return{data:null,error:t};throw t}}async _deleteFactor(e){tn(e.userId),tn(e.id);try{return{data:await q(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(U(t))return{data:null,error:t};throw t}}async _listOAuthClients(e){var t,n,s,i,o,u,c;try{let l={nextPage:null,lastPage:0,total:0},f=await q(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:Sh});if(f.error)throw f.error;let p=await f.json(),m=(o=f.headers.get("x-total-count"))!==null&&o!==void 0?o:0,y=(c=(u=f.headers.get("link"))===null||u===void 0?void 0:u.split(","))!==null&&c!==void 0?c:[];return y.length>0&&(y.forEach(T=>{let x=parseInt(T.split(";")[0].split("=")[1].substring(0,1)),I=JSON.parse(T.split(";")[1].split("=")[1]);l[`${I}Page`]=x}),l.total=parseInt(m)),{data:Object.assign(Object.assign({},p),l),error:null}}catch(l){if(U(l))return{data:{clients:[]},error:l};throw l}}async _createOAuthClient(e){try{return await q(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(U(t))return{data:null,error:t};throw t}}async _getOAuthClient(e){try{return await q(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(U(t))return{data:null,error:t};throw t}}async _updateOAuthClient(e,t){try{return await q(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(U(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await q(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if(U(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(e){try{return await q(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(U(t))return{data:null,error:t};throw t}}async _listCustomProviders(e){try{let t={};return e!=null&&e.type&&(t.type=e.type),await q(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:t,xform:n=>{var s;return{data:{providers:(s=n==null?void 0:n.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(t){if(U(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(e){try{return await q(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(U(t))return{data:null,error:t};throw t}}async _getCustomProvider(e){try{return await q(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(U(t))return{data:null,error:t};throw t}}async _updateCustomProvider(e,t){try{return await q(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(U(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{return await q(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if(U(t))return{data:null,error:t};throw t}}};function xh(r={}){return{getItem:e=>r[e]||null,setItem:(e,t)=>{r[e]=t},removeItem:e=>{delete r[e]}}}var Et={debug:!!(globalThis&&Ga()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")},ki=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}},Qa=class extends ki{};async function Rh(r,e,t){Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",r,e);let n=new globalThis.AbortController;e>0&&setTimeout(()=>{n.abort(),Et.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",r)},e),await Promise.resolve();try{return await globalThis.navigator.locks.request(r,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async s=>{if(s){Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",r,s.name);try{return await t()}finally{Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",r,s.name)}}else{if(e===0)throw Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",r),new Qa(`Acquiring an exclusive Navigator LockManager lock "${r}" immediately failed`);if(Et.debug)try{let i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null," "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await t()}})}catch(s){if((s==null?void 0:s.name)==="AbortError"&&e>0)return Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",r),console.warn(`@supabase/gotrue-js: Lock "${r}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(r,{mode:"exclusive",steal:!0},async i=>{if(i){Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",r,i.name);try{return await t()}finally{Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",r,i.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await t()}));throw s}}function iw(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self!="undefined"&&(self.globalThis=self)}}function Ph(r){if(!/^0x[a-fA-F0-9]{40}$/.test(r))throw new Error(`@supabase/auth-js: Address "${r}" is invalid.`);return r.toLowerCase()}function ow(r){return parseInt(r,16)}function aw(r){let e=new TextEncoder().encode(r);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function uw(r){var e;let{chainId:t,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:u,requestId:c,resources:l,scheme:f,uri:p,version:m}=r;{if(!Number.isInteger(t))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${t}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!p)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(m!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${m}`);if(!((e=r.statement)===null||e===void 0)&&e.includes(`
|
|
49
|
+
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${r.statement}`)}let y=Ph(r.address),T=f?`${f}://${n}`:n,x=r.statement?`${r.statement}
|
|
50
|
+
`:"",I=`${T} wants you to sign in with your Ethereum account:
|
|
51
|
+
${y}
|
|
52
|
+
|
|
53
|
+
${x}`,k=`URI: ${p}
|
|
54
|
+
Version: ${m}
|
|
55
|
+
Chain ID: ${t}${o?`
|
|
56
|
+
Nonce: ${o}`:""}
|
|
57
|
+
Issued At: ${i.toISOString()}`;if(s&&(k+=`
|
|
58
|
+
Expiration Time: ${s.toISOString()}`),u&&(k+=`
|
|
59
|
+
Not Before: ${u.toISOString()}`),c&&(k+=`
|
|
60
|
+
Request ID: ${c}`),l){let O=`
|
|
61
|
+
Resources:`;for(let D of l){if(!D||typeof D!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${D}`);O+=`
|
|
62
|
+
- ${D}`}k+=O}return`${I}
|
|
63
|
+
${k}`}var le=class extends Error{constructor({message:e,code:t,cause:n,name:s}){var i;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=s!=null?s:n instanceof Error?n.name:void 0)!==null&&i!==void 0?i:"Unknown Error",this.code=t}},sn=class extends le{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}};function cw({error:r,options:e}){var t,n,s;let{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(r.name==="AbortError"){if(e.signal instanceof AbortSignal)return new le({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:r})}else if(r.name==="ConstraintError"){if(((t=i.authenticatorSelection)===null||t===void 0?void 0:t.requireResidentKey)===!0)return new le({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:r});if(e.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new le({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:r});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new le({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:r})}else{if(r.name==="InvalidStateError")return new le({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:r});if(r.name==="NotAllowedError")return new le({message:r.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r});if(r.name==="NotSupportedError")return i.pubKeyCredParams.filter(u=>u.type==="public-key").length===0?new le({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:r}):new le({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:r});if(r.name==="SecurityError"){let o=window.location.hostname;if(Ch(o)){if(i.rp.id!==o)return new le({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:r})}else return new le({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:r})}else if(r.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new le({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:r})}else if(r.name==="UnknownError")return new le({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:r})}return new le({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r})}function lw({error:r,options:e}){let{publicKey:t}=e;if(!t)throw Error("options was missing required publicKey property");if(r.name==="AbortError"){if(e.signal instanceof AbortSignal)return new le({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:r})}else{if(r.name==="NotAllowedError")return new le({message:r.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r});if(r.name==="SecurityError"){let n=window.location.hostname;if(Ch(n)){if(t.rpId!==n)return new le({message:`The RP ID "${t.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:r})}else return new le({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:r})}else if(r.name==="UnknownError")return new le({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:r})}return new le({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r})}var kh=class{createNewAbortSignal(){if(this.controller){let t=new Error("Cancelling existing WebAuthn API call for new one");t.name="AbortError",this.controller.abort(t)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}},eC=new kh;function dw(r){if(!r)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential!="undefined"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(r);let{challenge:e,user:t,excludeCredentials:n}=r,s=Kr(r,["challenge","user","excludeCredentials"]),i=yr(e).buffer,o=Object.assign(Object.assign({},t),{id:yr(t.id).buffer}),u=Object.assign(Object.assign({},s),{challenge:i,user:o});if(n&&n.length>0){u.excludeCredentials=new Array(n.length);for(let c=0;c<n.length;c++){let l=n[c];u.excludeCredentials[c]=Object.assign(Object.assign({},l),{id:yr(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return u}function fw(r){if(!r)throw new Error("Credential request options are required");if(typeof PublicKeyCredential!="undefined"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(r);let{challenge:e,allowCredentials:t}=r,n=Kr(r,["challenge","allowCredentials"]),s=yr(e).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(t&&t.length>0){i.allowCredentials=new Array(t.length);for(let o=0;o<t.length;o++){let u=t[o];i.allowCredentials[o]=Object.assign(Object.assign({},u),{id:yr(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return i}function pw(r){var e;if("toJSON"in r&&typeof r.toJSON=="function")return r.toJSON();let t=r;return{id:r.id,rawId:r.id,response:{attestationObject:Bt(new Uint8Array(r.response.attestationObject)),clientDataJSON:Bt(new Uint8Array(r.response.clientDataJSON))},type:"public-key",clientExtensionResults:r.getClientExtensionResults(),authenticatorAttachment:(e=t.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function mw(r){var e;if("toJSON"in r&&typeof r.toJSON=="function")return r.toJSON();let t=r,n=r.getClientExtensionResults(),s=r.response;return{id:r.id,rawId:r.id,response:{authenticatorData:Bt(new Uint8Array(s.authenticatorData)),clientDataJSON:Bt(new Uint8Array(s.clientDataJSON)),signature:Bt(new Uint8Array(s.signature)),userHandle:s.userHandle?Bt(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=t.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Ch(r){return r==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(r)}function hw(){var r,e;return!!(Ae()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((r=navigator==null?void 0:navigator.credentials)===null||r===void 0?void 0:r.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function tC(r){try{let e=await navigator.credentials.create(r);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new sn("Browser returned unexpected credential type",e)}:{data:null,error:new sn("Empty credential response",e)}}catch(e){return{data:null,error:cw({error:e,options:r})}}}async function rC(r){try{let e=await navigator.credentials.get(r);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new sn("Browser returned unexpected credential type",e)}:{data:null,error:new sn("Empty credential response",e)}}catch(e){return{data:null,error:lw({error:e,options:r})}}}var nC={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},sC={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ya(...r){let e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),t=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(let s of r)if(s)for(let i in s){let o=s[i];if(o!==void 0)if(Array.isArray(o))n[i]=o;else if(t(o))n[i]=o;else if(e(o)){let u=n[i];e(u)?n[i]=Ya(u,o):n[i]=Ya(o)}else n[i]=o}return n}function iC(r,e){return Ya(nC,r,e||{})}function oC(r,e){return Ya(sC,r,e||{})}var Xa=class{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:n,signal:s},i){var o;try{let{data:u,error:c}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!u)return{data:null,error:c};let l=s!=null?s:eC.createNewAbortSignal();if(u.webauthn.type==="create"){let{user:f}=u.webauthn.credential_options.publicKey;if(!f.name){let p=n;if(p)f.name=`${f.id}:${p}`;else{let y=(await this.client.getUser()).data.user,T=((o=y==null?void 0:y.user_metadata)===null||o===void 0?void 0:o.name)||(y==null?void 0:y.email)||(y==null?void 0:y.id)||"User";f.name=`${f.id}:${T}`}}f.displayName||(f.displayName=f.name)}switch(u.webauthn.type){case"create":{let f=iC(u.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:p,error:m}=await tC({publicKey:f,signal:l});return p?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:p}},error:null}:{data:null,error:m}}case"request":{let f=oC(u.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:p,error:m}=await rC(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:f,signal:l}));return p?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:p}},error:null}:{data:null,error:m}}}}catch(u){return U(u)?{data:null,error:u}:{data:null,error:new Qe("Unexpected error in challenge",u)}}}async _verify({challengeId:e,factorId:t,webauthn:n}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:t=typeof window!="undefined"?window.location.hostname:void 0,rpOrigins:n=typeof window!="undefined"?[window.location.origin]:void 0,signal:s}={}},i){if(!t)return{data:null,error:new gr("rpId is required for WebAuthn authentication")};try{if(!hw())return{data:null,error:new Qe("Browser does not support WebAuthn",null)};let{data:o,error:u}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:n},signal:s},{request:i});if(!o)return{data:null,error:u};let{webauthn:c}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:c.type,rpId:t,rpOrigins:n,credential_response:c.credential_response}})}catch(o){return U(o)?{data:null,error:o}:{data:null,error:new Qe("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:t=typeof window!="undefined"?window.location.hostname:void 0,rpOrigins:n=typeof window!="undefined"?[window.location.origin]:void 0,signal:s}={}},i){if(!t)return{data:null,error:new gr("rpId is required for WebAuthn registration")};try{if(!hw())return{data:null,error:new Qe("Browser does not support WebAuthn",null)};let{data:o,error:u}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(f=>{var p;return(p=f.data)===null||p===void 0?void 0:p.all.find(m=>m.factor_type==="webauthn"&&m.friendly_name===e&&m.status!=="unverified")}).then(f=>f?this.client.mfa.unenroll({factorId:f==null?void 0:f.id}):void 0),{data:null,error:u};let{data:c,error:l}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:t,rpOrigins:n},signal:s},{create:i});return c?this._verify({factorId:o.id,challengeId:c.challengeId,webauthn:{rpId:t,rpOrigins:n,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:l}}catch(o){return U(o)?{data:null,error:o}:{data:null,error:new Qe("Unexpected error in register",o)}}}};iw();var aC={url:V_,storageKey:L_,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:F_,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1};async function gw(r,e,t){return await t()}var gs={},Za=class r{get jwks(){var e,t;return(t=(e=gs[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&t!==void 0?t:{keys:[]}}set jwks(e){gs[this.storageKey]=Object.assign(Object.assign({},gs[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return(t=(e=gs[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&t!==void 0?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){gs[this.storageKey]=Object.assign(Object.assign({},gs[this.storageKey]),{cachedAt:e})}constructor(e){var t,n,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;let i=Object.assign(Object.assign({},aC),e);if(this.storageKey=i.storageKey,this.instanceID=(t=r.nextInstanceID[this.storageKey])!==null&&t!==void 0?t:0,r.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&Ae()){let o=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.admin=new nn({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=Wa(i.fetch),this.lock=i.lock||gw,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock?this.lock=i.lock:this.persistSession&&Ae()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=Rh:this.lock=gw,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new Xa(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:Ga()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=xh(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=xh(this.memoryStorage)),Ae()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(u){this._debug("#broadcastChannel","error",u)}})}i.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Ma}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let t={},n="none";if(Ae()&&(t=H_(window.location.href),this._isImplicitGrantCallback(t)?n="implicit":await this._isPKCECallback(t)&&(n="pkce")),Ae()&&this.detectSessionInUrl&&n!=="none"){let{data:s,error:i}=await this._getSessionFromURL(t,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),B_(i)){let c=(e=i.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return{error:i}}let{session:o,redirectType:u}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",u),await this._saveSession(o),setTimeout(async()=>{u==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return U(t)?this._returnResult({error:t}):this._returnResult({error:new Qe("Unexpected error during initialization",t)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,n,s;try{let i=await q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:Ye}),{data:o,error:u}=i;if(u||!o)return this._returnResult({data:{user:null,session:null},error:u});let c=o.session,l=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:l,session:c},error:null})}catch(i){if(U(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var t,n,s;try{let i;if("email"in e){let{email:f,password:p,options:m}=e,y=null,T=null;this.flowType==="pkce"&&([y,T]=await en(this.storage,this.storageKey)),i=await q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m==null?void 0:m.emailRedirectTo,body:{email:f,password:p,data:(t=m==null?void 0:m.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:y,code_challenge_method:T},xform:Ye})}else if("phone"in e){let{phone:f,password:p,options:m}=e;i=await q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:f,password:p,data:(n=m==null?void 0:m.data)!==null&&n!==void 0?n:{},channel:(s=m==null?void 0:m.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken}},xform:Ye})}else throw new Jr("You must provide either an email or phone number and a password");let{data:o,error:u}=i;if(u||!o)return await Ce(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:u});let c=o.session,l=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:l,session:c},error:null})}catch(i){if(await Ce(this.storage,`${this.storageKey}-code-verifier`),U(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let t;if("email"in e){let{email:i,password:o,options:u}=e;t=await q(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}},xform:Ah})}else if("phone"in e){let{phone:i,password:o,options:u}=e;t=await q(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}},xform:Ah})}else throw new Jr("You must provide either an email or phone number and a password");let{data:n,error:s}=t;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){let i=new Ut;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(t){if(U(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOAuth(e){var t,n,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,n,s,i,o,u,c,l,f,p,m;let y,T;if("message"in e)y=e.message,T=e.signature;else{let{chain:x,wallet:I,statement:k,options:O}=e,D;if(Ae())if(typeof I=="object")D=I;else{let b=window;if("ethereum"in b&&typeof b.ethereum=="object"&&"request"in b.ethereum&&typeof b.ethereum.request=="function")D=b.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof I!="object"||!(O!=null&&O.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=I}let M=new URL((t=O==null?void 0:O.url)!==null&&t!==void 0?t:window.location.href),B=await D.request({method:"eth_requestAccounts"}).then(b=>b).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!B||B.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let F=Ph(B[0]),w=(n=O==null?void 0:O.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!w){let b=await D.request({method:"eth_chainId"});w=ow(b)}let _={domain:M.host,address:F,statement:k,uri:M.href,version:"1",chainId:w,nonce:(s=O==null?void 0:O.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=O==null?void 0:O.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(u=O==null?void 0:O.signInWithEthereum)===null||u===void 0?void 0:u.expirationTime,notBefore:(c=O==null?void 0:O.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(l=O==null?void 0:O.signInWithEthereum)===null||l===void 0?void 0:l.requestId,resources:(f=O==null?void 0:O.signInWithEthereum)===null||f===void 0?void 0:f.resources};y=uw(_),T=await D.request({method:"personal_sign",params:[aw(y),F]})}try{let{data:x,error:I}=await q(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:y,signature:T},!((p=e.options)===null||p===void 0)&&p.captchaToken?{gotrue_meta_security:{captcha_token:(m=e.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:Ye});if(I)throw I;if(!x||!x.session||!x.user){let k=new Ut;return this._returnResult({data:{user:null,session:null},error:k})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:I})}catch(x){if(U(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async signInWithSolana(e){var t,n,s,i,o,u,c,l,f,p,m,y;let T,x;if("message"in e)T=e.message,x=e.signature;else{let{chain:I,wallet:k,statement:O,options:D}=e,M;if(Ae())if(typeof k=="object")M=k;else{let F=window;if("solana"in F&&typeof F.solana=="object"&&("signIn"in F.solana&&typeof F.solana.signIn=="function"||"signMessage"in F.solana&&typeof F.solana.signMessage=="function"))M=F.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!(D!=null&&D.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");M=k}let B=new URL((t=D==null?void 0:D.url)!==null&&t!==void 0?t:window.location.href);if("signIn"in M&&M.signIn){let F=await M.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},D==null?void 0:D.signInWithSolana),{version:"1",domain:B.host,uri:B.href}),O?{statement:O}:null)),w;if(Array.isArray(F)&&F[0]&&typeof F[0]=="object")w=F[0];else if(F&&typeof F=="object"&&"signedMessage"in F&&"signature"in F)w=F;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in w&&"signature"in w&&(typeof w.signedMessage=="string"||w.signedMessage instanceof Uint8Array)&&w.signature instanceof Uint8Array)T=typeof w.signedMessage=="string"?w.signedMessage:new TextDecoder().decode(w.signedMessage),x=w.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in M)||typeof M.signMessage!="function"||!("publicKey"in M)||typeof M!="object"||!M.publicKey||!("toBase58"in M.publicKey)||typeof M.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");T=[`${B.host} wants you to sign in with your Solana account:`,M.publicKey.toBase58(),...O?["",O,""]:[""],"Version: 1",`URI: ${B.href}`,`Issued At: ${(s=(n=D==null?void 0:D.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=D==null?void 0:D.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${D.signInWithSolana.notBefore}`]:[],...!((o=D==null?void 0:D.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${D.signInWithSolana.expirationTime}`]:[],...!((u=D==null?void 0:D.signInWithSolana)===null||u===void 0)&&u.chainId?[`Chain ID: ${D.signInWithSolana.chainId}`]:[],...!((c=D==null?void 0:D.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${D.signInWithSolana.nonce}`]:[],...!((l=D==null?void 0:D.signInWithSolana)===null||l===void 0)&&l.requestId?[`Request ID: ${D.signInWithSolana.requestId}`]:[],...!((p=(f=D==null?void 0:D.signInWithSolana)===null||f===void 0?void 0:f.resources)===null||p===void 0)&&p.length?["Resources",...D.signInWithSolana.resources.map(w=>`- ${w}`)]:[]].join(`
|
|
64
|
+
`);let F=await M.signMessage(new TextEncoder().encode(T),"utf8");if(!F||!(F instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");x=F}}try{let{data:I,error:k}=await q(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:T,signature:Bt(x)},!((m=e.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(y=e.options)===null||y===void 0?void 0:y.captchaToken}}:null),xform:Ye});if(k)throw k;if(!I||!I.session||!I.user){let O=new Ut;return this._returnResult({data:{user:null,session:null},error:O})}return I.session&&(await this._saveSession(I.session),await this._notifyAllSubscribers("SIGNED_IN",I.session)),this._returnResult({data:Object.assign({},I),error:k})}catch(I){if(U(I))return this._returnResult({data:{user:null,session:null},error:I});throw I}}async _exchangeCodeForSession(e){let t=await _r(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(t!=null?t:"").split("/");try{if(!n&&this.flowType==="pkce")throw new $a;let{data:i,error:o}=await q(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:Ye});if(await Ce(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){let u=new Ut;return this._returnResult({data:{user:null,session:null,redirectType:null},error:u})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s!=null?s:null}),error:o})}catch(i){if(await Ce(this.storage,`${this.storageKey}-code-verifier`),U(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{let{options:t,provider:n,token:s,access_token:i,nonce:o}=e,u=await q(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:Ye}),{data:c,error:l}=u;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!c||!c.session||!c.user){let f=new Ut;return this._returnResult({data:{user:null,session:null},error:f})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:l})}catch(t){if(U(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOtp(e){var t,n,s,i,o;try{if("email"in e){let{email:u,options:c}=e,l=null,f=null;this.flowType==="pkce"&&([l,f]=await en(this.storage,this.storageKey));let{error:p}=await q(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:u,data:(t=c==null?void 0:c.data)!==null&&t!==void 0?t:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:l,code_challenge_method:f},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:p})}if("phone"in e){let{phone:u,options:c}=e,{data:l,error:f}=await q(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:u,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:l==null?void 0:l.message_id},error:f})}throw new Jr("You must provide either an email or phone number.")}catch(u){if(await Ce(this.storage,`${this.storageKey}-code-verifier`),U(u))return this._returnResult({data:{user:null,session:null},error:u});throw u}}async verifyOtp(e){var t,n;try{let s,i;"options"in e&&(s=(t=e.options)===null||t===void 0?void 0:t.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);let{data:o,error:u}=await q(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Ye});if(u)throw u;if(!o)throw new Error("An error occurred on token verification.");let c=o.session,l=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:l,session:c},error:null})}catch(s){if(U(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var t,n,s,i,o;try{let u=null,c=null;this.flowType==="pkce"&&([u,c]=await en(this.storage,this.storageKey));let l=await q(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:u,code_challenge_method:c}),headers:this.headers,xform:nw});return!((i=l.data)===null||i===void 0)&&i.url&&Ae()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(u){if(await Ce(this.storage,`${this.storageKey}-code-verifier`),U(u))return this._returnResult({data:null,error:u});throw u}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;if(n)throw n;if(!t)throw new Oe;let{error:s}=await q(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(U(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let t=`${this.url}/resend`;if("email"in e){let{email:n,type:s,options:i}=e,{error:o}=await q(this.fetch,"POST",t,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){let{phone:n,type:s,options:i}=e,{data:o,error:u}=await q(this.fetch,"POST",t,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:u})}throw new Jr("You must provide either an email or phone number and a type")}catch(t){if(U(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async t=>t))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let n=t();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){let s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null,t=await _r(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};let n=e.expires_at?e.expires_at*1e3-Date.now()<Ua:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){let o=await _r(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Ha()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){let o={value:this.suppressGetSessionWarning};e.user=tw(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}let{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let t=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await q(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:bt}):await this._useSession(async t=>{var n,s,i;let{data:o,error:u}=t;if(u)throw u;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Oe}:await q(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:bt})})}catch(t){if(U(t))return qa(t)&&(await this._removeSession(),await Ce(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:t});throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async n=>{let{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new Oe;let o=s.session,u=null,c=null;this.flowType==="pkce"&&e.email!=null&&([u,c]=await en(this.storage,this.storageKey));let{data:l,error:f}=await q(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t==null?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:u,code_challenge_method:c}),jwt:o.access_token,xform:bt});if(f)throw f;return o.user=l.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if(await Ce(this.storage,`${this.storageKey}-code-verifier`),U(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Oe;let t=Date.now()/1e3,n=t,s=!0,i=null,{payload:o}=Ci(e.access_token);if(o.exp&&(n=o.exp,s=n<=t),s){let{data:u,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!u)return{data:{user:null,session:null},error:null};i=u}else{let{data:u,error:c}=await this._getUser(e.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});i={access_token:e.access_token,refresh_token:e.refresh_token,user:u.user,token_type:"bearer",expires_in:n-t,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(t){if(U(t))return this._returnResult({data:{session:null,user:null},error:t});throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var n;if(!e){let{data:o,error:u}=t;if(u)throw u;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new Oe;let{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(t){if(U(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async _getSessionFromURL(e,t){try{if(!Ae())throw new Qr("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Qr(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if(this.flowType==="pkce")throw new xi("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Qr("Not a valid implicit grant flow url.");break;default:}if(t==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new xi("No code detected.");let{data:O,error:D}=await this._exchangeCodeForSession(e.code);if(D)throw D;let M=new URL(window.location.href);return M.searchParams.delete("code"),window.history.replaceState(window.history.state,"",M.toString()),{data:{session:O.session,redirectType:null},error:null}}let{provider_token:n,provider_refresh_token:s,access_token:i,refresh_token:o,expires_in:u,expires_at:c,token_type:l}=e;if(!i||!u||!o||!l)throw new Qr("No session defined in URL");let f=Math.round(Date.now()/1e3),p=parseInt(u),m=f+p;c&&(m=parseInt(c));let y=m-f;y*1e3<=Hr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${p}s`);let T=m-p;f-T>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",T,m,f):f-T<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",T,m,f);let{data:x,error:I}=await this._getUser(i);if(I)throw I;let k={provider_token:n,provider_refresh_token:s,access_token:i,expires_in:p,expires_at:m,refresh_token:o,token_type:l,user:x.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:k,redirectType:e.type},error:null})}catch(n){if(U(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await _r(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var n;let{data:s,error:i}=t;if(i&&!qa(i))return this._returnResult({error:i});let o=(n=s.session)===null||n===void 0?void 0:n.access_token;if(o){let{error:u}=await this.admin.signOut(o,e);if(u&&!(U_(u)&&(u.status===404||u.status===401||u.status===403)||qa(u)))return this._returnResult({error:u})}return e!=="others"&&(await this._removeSession(),await Ce(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let t=W_(),n={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async t=>{var n,s;try{let{data:{session:i},error:o}=t;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),console.error(i)}})}async resetPasswordForEmail(e,t={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await en(this.storage,this.storageKey,!0));try{return await q(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(i){if(await Ce(this.storage,`${this.storageKey}-code-verifier`),U(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{let{data:t,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(t){if(U(t))return this._returnResult({data:null,error:t});throw t}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{let{data:n,error:s}=await this._useSession(async i=>{var o,u,c,l,f;let{data:p,error:m}=i;if(m)throw m;let y=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(u=e.options)===null||u===void 0?void 0:u.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await q(this.fetch,"GET",y,{headers:this.headers,jwt:(f=(l=p.session)===null||l===void 0?void 0:l.access_token)!==null&&f!==void 0?f:void 0})});if(s)throw s;return Ae()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(U(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var n;try{let{error:s,data:{session:i}}=t;if(s)throw s;let{options:o,provider:u,token:c,access_token:l,nonce:f}=e,p=await q(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:u,id_token:c,access_token:l,nonce:f,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:Ye}),{data:m,error:y}=p;return y?this._returnResult({data:{user:null,session:null},error:y}):!m||!m.session||!m.user?this._returnResult({data:{user:null,session:null},error:new Ut}):(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),this._returnResult({data:m,error:y}))}catch(s){if(await Ce(this.storage,`${this.storageKey}-code-verifier`),U(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var n,s;let{data:i,error:o}=t;if(o)throw o;return await q(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(t){if(U(t))return this._returnResult({data:null,error:t});throw t}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{let n=Date.now();return await Y_(async s=>(s>0&&await Q_(200*Math.pow(2,s-1)),this._debug(t,"refreshing attempt",s),await q(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Ye})),(s,i)=>{let o=200*Math.pow(2,s);return i&&za(i)&&Date.now()+o-n<Hr})}catch(n){if(this._debug(t,"error",n),U(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(t,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){let n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",n),Ae()&&!t.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,t;let n="#_recoverAndRefresh()";this._debug(n,"begin");try{let s=await _r(this.storage,this.storageKey);if(s&&this.userStorage){let o=await _r(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Zr(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Ha()}else if(s&&!s.user&&!s.user){let o=await _r(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await Ce(this.storage,this.storageKey+"-user"),await Zr(this.storage,this.storageKey,s)):s.user=Ha()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}let i=((t=s.expires_at)!==null&&t!==void 0?t:1/0)*1e3-Date.now()<Ua;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Ua}s`),i){if(this.autoRefreshToken&&s.refresh_token){let{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),za(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{let{data:o,error:u}=await this._getUser(s.access_token);!u&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var t,n;if(!e)throw new Oe;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new Pi;let{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Oe;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);let u={data:i.session,error:null};return this.refreshingDeferred.resolve(u),u}catch(i){if(this._debug(s,"error",i),U(i)){let o={data:null,error:i};return za(i)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,t,n=!0){let s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",t,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:t});let i=[],o=Array.from(this.stateChangeEmitters.values()).map(async u=>{try{await u.callback(e,t)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let u=0;u<i.length;u+=1)console.error(i[u]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Ce(this.storage,`${this.storageKey}-code-verifier`);let t=Object.assign({},e),n=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&t.user&&await Zr(this.userStorage,this.storageKey+"-user",{user:t.user});let s=Object.assign({},t);delete s.user;let i=Ih(s);await Zr(this.storage,this.storageKey,i)}else{let s=Ih(t);await Zr(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ce(this.storage,this.storageKey),await Ce(this.storage,this.storageKey+"-code-verifier"),await Ce(this.storage,this.storageKey+"-user"),this.userStorage&&await Ce(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Ae()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),Hr);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno!="undefined"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);let t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno!="undefined"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);let t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:n}}=t;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let s=Math.floor((n.expires_at*1e3-e)/Hr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Hr}ms, refresh threshold is ${ja} ticks`),s<=ja&&await this._callRefreshToken(n.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof ki)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ae()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,n){let s=[`provider=${encodeURIComponent(t)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){let[i,o]=await en(this.storage,this.storageKey),u=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(u.toString())}if(n!=null&&n.queryParams){let i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var n;let{data:s,error:i}=t;return i?this._returnResult({data:null,error:i}):await q(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(t){if(U(t))return this._returnResult({data:null,error:t});throw t}}async _enroll(e){try{return await this._useSession(async t=>{var n,s;let{data:i,error:o}=t;if(o)return this._returnResult({data:null,error:o});let u=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:c,error:l}=await q(this.fetch,"POST",`${this.url}/factors`,{body:u,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(e.factorType==="totp"&&c.type==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(t){if(U(t))return this._returnResult({data:null,error:t});throw t}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var n;let{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?pw(e.webauthn.credential_response):mw(e.webauthn.credential_response)})}:{code:e.code}),{data:u,error:c}=await q(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+u.expires_in},u)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",u),this._returnResult({data:u,error:c}))})}catch(t){if(U(t))return this._returnResult({data:null,error:t});throw t}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var n;let{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});let o=await q(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;let{data:u}=o;if(u.type!=="webauthn")return{data:u,error:null};switch(u.webauthn.type){case"create":return{data:Object.assign(Object.assign({},u),{webauthn:Object.assign(Object.assign({},u.webauthn),{credential_options:Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:dw(u.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},u),{webauthn:Object.assign(Object.assign({},u.webauthn),{credential_options:Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:fw(u.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(t){if(U(t))return this._returnResult({data:null,error:t});throw t}})}async _challengeAndVerify(e){let{data:t,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;let{data:{user:t},error:n}=await this.getUser();if(n)return{data:null,error:n};let s={all:[],phone:[],totp:[],webauthn:[]};for(let i of(e=t==null?void 0:t.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,n,s,i;if(e)try{let{payload:y}=Ci(e),T=null;y.aal&&(T=y.aal);let x=T,{data:{user:I},error:k}=await this.getUser(e);if(k)return this._returnResult({data:null,error:k});((n=(t=I==null?void 0:I.factors)===null||t===void 0?void 0:t.filter(M=>M.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(x="aal2");let D=y.amr||[];return{data:{currentLevel:T,nextLevel:x,currentAuthenticationMethods:D},error:null}}catch(y){if(U(y))return this._returnResult({data:null,error:y});throw y}let{data:{session:o},error:u}=await this.getSession();if(u)return this._returnResult({data:null,error:u});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:c}=Ci(o.access_token),l=null;c.aal&&(l=c.aal);let f=l;((i=(s=o.user.factors)===null||s===void 0?void 0:s.filter(y=>y.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(f="aal2");let m=c.amr||[];return{data:{currentLevel:l,nextLevel:f,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{let{data:{session:n},error:s}=t;return s?this._returnResult({data:null,error:s}):n?await q(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Oe})})}catch(t){if(U(t))return this._returnResult({data:null,error:t});throw t}}async _approveAuthorization(e,t){try{return await this._useSession(async n=>{let{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Oe});let o=await q(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:u=>({data:u,error:null})});return o.data&&o.data.redirect_url&&Ae()&&!(t!=null&&t.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(U(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,t){try{return await this._useSession(async n=>{let{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Oe});let o=await q(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:u=>({data:u,error:null})});return o.data&&o.data.redirect_url&&Ae()&&!(t!=null&&t.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(U(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;return n?this._returnResult({data:null,error:n}):t?await q(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Oe})})}catch(e){if(U(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{let{data:{session:n},error:s}=t;return s?this._returnResult({data:null,error:s}):n?(await q(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Oe})})}catch(t){if(U(t))return this._returnResult({data:null,error:t});throw t}}async fetchJwk(e,t={keys:[]}){let n=t.keys.find(u=>u.kid===e);if(n)return n;let s=Date.now();if(n=this.jwks.keys.find(u=>u.kid===e),n&&this.jwks_cached_at+j_>s)return n;let{data:i,error:o}=await q(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,n=i.keys.find(u=>u.kid===e),!n)?null:n}async getClaims(e,t={}){try{let n=e;if(!n){let{data:y,error:T}=await this.getSession();if(T||!y.session)return this._returnResult({data:null,error:T});n=y.session.access_token}let{header:s,payload:i,signature:o,raw:{header:u,payload:c}}=Ci(n);t!=null&&t.allowExpired||Z_(i.exp);let l=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,t!=null&&t.keys?{keys:t.keys}:t==null?void 0:t.jwks);if(!l){let{error:y}=await this.getUser(n);if(y)throw y;return{data:{claims:i,header:s,signature:o},error:null}}let f=ew(s.alg),p=await crypto.subtle.importKey("jwk",l,f,!0,["verify"]);if(!await crypto.subtle.verify(f,p,o,K_(`${u}.${c}`)))throw new Yr("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(U(n))return this._returnResult({data:null,error:n});throw n}}};Za.nextInstanceID={};var Oh=Za;var uC=Oh,Dh=uC;var cC="2.99.1",Oi="";typeof Deno!="undefined"?Oi="deno":typeof document!="undefined"?Oi="web":typeof navigator!="undefined"&&navigator.product==="ReactNative"?Oi="react-native":Oi="node";var lC={"X-Client-Info":`supabase-js-${Oi}/${cC}`},hC={headers:lC},dC={schema:"public"},fC={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},pC={};function Di(r){"@babel/helpers - typeof";return Di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Di(r)}function mC(r,e){if(Di(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(Di(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function gC(r){var e=mC(r,"string");return Di(e)=="symbol"?e:e+""}function yC(r,e,t){return(e=gC(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yw(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,n)}return t}function me(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yw(Object(t),!0).forEach(function(n){yC(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):yw(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var _C=r=>r?(...e)=>r(...e):(...e)=>fetch(...e),wC=()=>Headers,vC=(r,e,t)=>{let n=_C(t),s=wC();return async(i,o)=>{var u;let c=(u=await e())!==null&&u!==void 0?u:r,l=new s(o==null?void 0:o.headers);return l.has("apikey")||l.set("apikey",r),l.has("Authorization")||l.set("Authorization",`Bearer ${c}`),n(i,me(me({},o),{},{headers:l}))}};function bC(r){return r.endsWith("/")?r:r+"/"}function EC(r,e){var t,n;let{db:s,auth:i,realtime:o,global:u}=r,{db:c,auth:l,realtime:f,global:p}=e,m={db:me(me({},c),s),auth:me(me({},l),i),realtime:me(me({},f),o),storage:{},global:me(me(me({},p),u),{},{headers:me(me({},(t=p==null?void 0:p.headers)!==null&&t!==void 0?t:{}),(n=u==null?void 0:u.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return r.accessToken?m.accessToken=r.accessToken:delete m.accessToken,m}function TC(r){let e=r==null?void 0:r.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(bC(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var IC=class extends Dh{constructor(r){super(r)}},AC=class{constructor(r,e,t){var n,s;this.supabaseUrl=r,this.supabaseKey=e;let i=TC(r);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);let o=`sb-${i.hostname.split(".")[0]}-auth-token`,u={db:dC,realtime:pC,auth:me(me({},fC),{},{storageKey:o}),global:hC},c=EC(t!=null?t:{},u);if(this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(f,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}});else{var l;this.auth=this._initSupabaseAuthClient((l=c.auth)!==null&&l!==void 0?l:{},this.headers,c.global.fetch)}this.fetch=vC(e,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(me({headers:this.headers,accessToken:this._getAccessToken.bind(this)},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(f=>this.realtime.setAuth(f)).catch(f=>console.warn("Failed to set initial Realtime auth token:",f)),this.rest=new w_(new URL("rest/v1",i).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new N_(this.storageUrl.href,this.headers,this.fetch,t==null?void 0:t.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new gi(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(r){return this.rest.from(r)}schema(r){return this.rest.schema(r)}rpc(r,e={},t={head:!1,get:!1,count:void 0}){return this.rest.rpc(r,e,t)}channel(r,e={config:{}}){return this.realtime.channel(r,e)}getChannels(){return this.realtime.getChannels()}removeChannel(r){return this.realtime.removeChannel(r)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var r=this,e,t;if(r.accessToken)return await r.accessToken();let{data:n}=await r.auth.getSession();return(e=(t=n.session)===null||t===void 0?void 0:t.access_token)!==null&&e!==void 0?e:r.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:r,persistSession:e,detectSessionInUrl:t,storage:n,userStorage:s,storageKey:i,flowType:o,lock:u,debug:c,throwOnError:l},f,p){let m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new IC({url:this.authUrl.href,headers:me(me({},m),f),storageKey:i,autoRefreshToken:r,persistSession:e,detectSessionInUrl:t,storage:n,userStorage:s,flowType:o,lock:u,debug:c,throwOnError:l,fetch:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(y=>y.toLowerCase()==="authorization")})}_initRealtimeClient(r){return new ds(this.realtimeUrl.href,me(me({},r),{},{params:me(me({},{apikey:this.supabaseKey}),r==null?void 0:r.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,e)=>{this._handleTokenChanged(r,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(r,e,t){(r==="TOKEN_REFRESHED"||r==="SIGNED_IN")&&this.changedAccessToken!==t?(this.changedAccessToken=t,this.realtime.setAuth(t)):r==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}},_w=(r,e,t)=>new AC(r,e,t);function SC(){if(typeof window!="undefined")return!1;let r=globalThis.process;if(!r)return!1;let e=r.version;if(e==null)return!1;let t=e.match(/^v(\d+)\./);return t?parseInt(t[1],10)<=18:!1}SC()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var xC=Object.prototype.toString,RC=r=>xC.call(r)==="[object Error]",PC=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function Nh(r){if(!(r&&RC(r)&&r.name==="TypeError"&&typeof r.message=="string"))return!1;let{message:t,stack:n}=r;return t==="Load failed"?n===void 0||"__sentry_captured__"in r:t.startsWith("error sending request for url")||t==="Failed to fetch"||t.startsWith("Failed to fetch (")&&t.endsWith(")")?!0:PC.has(t)}function CC(r){if(typeof r=="number"){if(r<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(r))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(r!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function eu(r,e,{min:t=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${r}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${r}\` to be a finite number.`);if(e<t)throw new TypeError(`Expected \`${r}\` to be \u2265 ${t}.`)}}var Vh=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}};function kC(r,e){let t=Math.max(1,r+1),n=e.randomize?Math.random()+1:1,s=Math.round(n*e.minTimeout*e.factor**(t-1));return s=Math.min(s,e.maxTimeout),s}function ww(r,e){return Number.isFinite(e)?e-(performance.now()-r):e}async function OC({error:r,attemptNumber:e,retriesConsumed:t,startTime:n,options:s}){var y,T,x,I,k;let i=r instanceof Error?r:new TypeError(`Non-error was thrown: "${r}". You should only throw errors.`);if(i instanceof Vh)throw i.originalError;let o=Number.isFinite(s.retries)?Math.max(0,s.retries-t):s.retries,u=(y=s.maxRetryTime)!=null?y:Number.POSITIVE_INFINITY,c=Object.freeze({error:i,attemptNumber:e,retriesLeft:o,retriesConsumed:t});if(await s.onFailedAttempt(c),ww(n,u)<=0)throw i;let l=await s.shouldConsumeRetry(c),f=ww(n,u);if(f<=0||o<=0)throw i;if(i instanceof TypeError&&!Nh(i)){if(l)throw i;return(T=s.signal)==null||T.throwIfAborted(),!1}if(!await s.shouldRetry(c))throw i;if(!l)return(x=s.signal)==null||x.throwIfAborted(),!1;let p=kC(t,s),m=Math.min(p,f);return(I=s.signal)==null||I.throwIfAborted(),m>0&&await new Promise((O,D)=>{var F,w;let M=()=>{var _;clearTimeout(B),(_=s.signal)==null||_.removeEventListener("abort",M),D(s.signal.reason)},B=setTimeout(()=>{var _;(_=s.signal)==null||_.removeEventListener("abort",M),O()},m);s.unref&&((F=B.unref)==null||F.call(B)),(w=s.signal)==null||w.addEventListener("abort",M,{once:!0})}),(k=s.signal)==null||k.throwIfAborted(),!0}async function Ni(r,e={}){var i,o,u,c,l,f,p,m,y,T,x,I;if(e={...e},CC(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");(i=e.retries)!=null||(e.retries=10),(o=e.factor)!=null||(e.factor=2),(u=e.minTimeout)!=null||(e.minTimeout=1e3),(c=e.maxTimeout)!=null||(e.maxTimeout=Number.POSITIVE_INFINITY),(l=e.maxRetryTime)!=null||(e.maxRetryTime=Number.POSITIVE_INFINITY),(f=e.randomize)!=null||(e.randomize=!1),(p=e.onFailedAttempt)!=null||(e.onFailedAttempt=()=>{}),(m=e.shouldRetry)!=null||(e.shouldRetry=()=>!0),(y=e.shouldConsumeRetry)!=null||(e.shouldConsumeRetry=()=>!0),eu("factor",e.factor,{min:0,allowInfinity:!1}),eu("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),eu("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),eu("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),(T=e.signal)==null||T.throwIfAborted();let t=0,n=0,s=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){t++;try{(x=e.signal)==null||x.throwIfAborted();let k=await r(t);return(I=e.signal)==null||I.throwIfAborted(),k}catch(k){await OC({error:k,attemptNumber:t,retriesConsumed:n,startTime:s,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var DC=function(e,t){if(typeof e!="function")throw new Error("First argument to supabasey() must be a callback function");let n={session:null,retries:3,retry:{minTimeout:100,factor:2,randomize:!0,onFailedAttempt:i=>console.info(`[Attempt ${i.attemptNumber}/${i.attemptNumber+i.retriesLeft-1}] failed to run Supabase query`),shouldRetry:i=>(console.log("QUERY SHOULD-RETRY",i),!0)},...t},s=n.session?typeof n.session=="string"?Se.sessions[n.session]:typeof n.session=="object"?n.session:(()=>{throw new Error(`Unknown session type for supabasey(cb, {session}) - expected Object|String got ${typeof n.session}`)})():(()=>{throw new Error("supabasey(cb, {session}) cannot be empty - specify a session or use bindSession() first")})();return Promise.resolve().then(()=>Ni(()=>e.call(s,s),{...n.retries&&{retries:n.retries},...t.retry})).then(i=>{if(i!=null&&i.error)Se.throw(i.error);else if(i.data)return i.data}).catch(i=>{throw console.log("Supabasey error:",i),i})},Se=DC;Se.bindSession=function(e){if(typeof e=="string"&&!Se.sessions[e])throw new Error(`Unable to bind to non-existant session "${e}"`);let t=(n,s)=>Se(n,{session:e,...s});return t.rpc=(n,s,i)=>Se.rpc(n,s,{session:e,...i}),t};Se.init=function(e){let t={env:{},init:!0,login:!1,session:"auto",...e},n=t.env,s=t.session=="auto"&&n.SUPABASE_URL?n.SUPABASE_URL:t.session?t.session:(()=>{throw new Error("Sesison should be truthy if using @iebh/supabasey.middleware({session:String})")})(),i=Se.sessions[s];return Promise.resolve().then(()=>{if(!i)if(t.init){if(!n.SUPABASE_URL||!n.SUPABASE_KEY)throw new Error("Both env.SUPABASE_URL + env.SUPABASE_KEY should be specified to use @iebh/supabasey.middleware(), otherwise disable with {init:false}");i=Se.sessions[s]=_w(n.SUPABASE_URL,n.SUPABASE_KEY)}else throw new Error("No Supabase session for middleware to work with!")}).then(()=>{if(t.login){if(i.supabaseyIsLoggedIn)return;if(!n.SUPABASE_USER||!n.SUPABASE_PASS)throw new Error("User credentials missing when using @iebh/supabasey.middleware(), provide in env.SUPABASE_USER + ..._PASS");return Se(o=>o.auth.signInWithPassword({email:n.SUPABASE_USER,password:n.SUPABASE_PASS}),{session:i}).then(()=>i.supabaseyIsLoggedIn=!0)}else return}).then(()=>Se.bindSession(i))};Se.middleware=function(e){let t={env:{},injectEnv:!0,...e};return async(n,s,i,o)=>Se.init({...e,env:i}).then(u=>{t.injectEnv&&(i.supabasey=u)}).catch(u=>Se.throw(u))};Se.throw=function(r){throw typeof r=="string"?new Error(r):r instanceof Error?r:/JSON object requested, multiple \(or no\) rows returned$/.test(r.message)?(console.warn("Supabase query resulted in NOT-FOUND:",r.message),console.warn("Supabase raw error",r),new Error("NOT-FOUND")):(console.warn("Supabase query threw",r.message||r||"Unknown error"),new Error(`${(r==null?void 0:r.code)||"UnknownError"}: ${(r==null?void 0:r.message)||"Unknown Supabase error"}`))};Se.rpc=function(r,e,t){return Se(async n=>await n.rpc(r,e),t)};Se.sessions={};var vw=Se;function NC(r,e){return Object.fromEntries(Object.entries(r).sort(e||void 0).map(([t,n])=>[t,n]))}function tu(r,e){return Array.isArray(r)?r.map(t=>tu(t,e)):typeof r=="object"?r==null?null:Object.fromEntries(Object.entries(NC(r,e)).map(([t,n])=>[t,tu(n,e)])):r}var bw={id:"~date",test:r=>r instanceof Date,serialize:r=>({_:"~date",v:r.toISOString()}),deserialize:r=>new Date(r.v)};var Ew={id:"~function",test:r=>typeof r=="function",serialize:r=>({_:"~function",v:r.toString()}),deserialize:v=>eval(v.v.toString())};var Tw={id:"~infinity",test:r=>r===1/0||r===-1/0,serialize:r=>({_:"~infinity",v:r===1/0?1:0}),deserialize:r=>r.v==1?1/0:-1/0};var Iw={id:"~nan",test:r=>Number.isNaN(r),serialize:r=>({_:"~nan"}),deserialize:r=>NaN};var Aw={id:"~regexp",test:r=>r instanceof RegExp,serialize:r=>({_:"~regexp",v:r.source,f:r.flags}),deserialize:r=>new RegExp(r.v,r.f)};var Sw={id:"~set",test:r=>r instanceof Set,serialize:r=>({_:"~set",v:Array.from(r)}),deserialize:r=>new Set(r.v)};var xw={id:"~undefined",test:r=>r===void 0,serialize:r=>({_:"~undefined"}),deserialize:r=>{}};var ys={settings:{stringify:!0,destringify:!0,clone:!1,depth:0,modules:[bw,Ew,Tw,Iw,Aw,Sw,xw],circular:!0,symetric:!1},loadedModules:{},loadModules(r){return r.map(e=>{if(ee(e)){if(!e.id)throw new Error("Provided custom module does not expose an `id` property");return ys.loadedModules[e.id]=e}else throw new Error("Unknown module type")})},serialize(r,e){let t=Io(e,ys.settings),n=ys.loadModules(t.modules),s=t.symetric?tu(r):t.clone?ar(r):r,i=new Map,o=(u,c)=>{let l=ee(u);if(l&&t.circular){let m=i.get(u);if(m)return ur(s,c,{_:"~circular",p:m.join(".")});i.set(u,c)}let f=n.find(m=>m.test(u,c)),p=(!t.depth||c.length<t.depth)&&l;if(f){let m=f.serialize(u,c);if(f.recursive&&p){let y=Ne(u);t.symetric&&y.sort(),ur(s,c,m),y.forEach(T=>o(u[T],c.concat(T)))}else c.length?ur(s,c,m):s=m}else if(p){let m=Ne(u);t.symetric&&m.sort(),m.forEach(y=>o(u[y],c.concat(y)))}};return o(s,[]),t.stringify?JSON.stringify(s):s},deserialize(r,e){let t=Io(e,ys.settings),n=ys.loadModules(t.modules),s=Du(n,"id"),i=t.destringify?JSON.parse(r):t.clone?ar(r):r,o=(u,c)=>{if(ee(u)&&u._&&typeof u._=="string"&&u._.startsWith("~")&&s[u._]){let l=s[u._].deserialize(u,c);c.length?s[u._].recursive&&ee(l)?(ur(i,c,l),Ne(l).forEach(f=>o(u[f],[...c,f]))):ur(i,c,l):i=l}else t.circular&&ee(u)&&u._&&u._=="~circular"?ur(i,c,Ls(i,u.p)):(!t.depth||c.length<t.depth)&&ee(u)&&Ne(u).forEach(l=>o(u[l],c.concat(l)))};return o(i,[]),i}},ru=ys;var Rw="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Pw=(r=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(r|=0));for(;r--;)e+=Rw[t[r]&63];return e};var Cw=new WeakMap,Vi=new WeakMap,VC=new FinalizationRegistry(({signalWeakRef:r,weakReference:e})=>{let t=r.deref();if(!t)return;let n=Vi.get(t);n&&(n.throttleds.delete(e),n.throttleds.size===0&&(t.removeEventListener("abort",n.listener),Vi.delete(t)))});function Lh({limit:r,interval:e,strict:t,signal:n,onDelay:s,weight:i}){if(!Number.isFinite(r))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(e))throw new TypeError("Expected `interval` to be a finite number");if(r<0)throw new TypeError("Expected `limit` to be >= 0");if(e<0)throw new TypeError("Expected `interval` to be >= 0");if(i!==void 0&&typeof i!="function")throw new TypeError("Expected `weight` to be a function");if(i&&e===0)throw new TypeError("The `weight` option cannot be used with `interval` of 0");let o={queue:new Map,strictTicks:[],currentTick:0,activeWeight:0},u=Math.max(r,1),c=m=>{if(o.strictTicks.length===0||m.time>=o.strictTicks.at(-1).time)o.strictTicks.push(m);else{let y=o.strictTicks.findIndex(T=>T.time>m.time);o.strictTicks.splice(y,0,m)}};function l(m){let y=Date.now();return y-o.currentTick>e?(o.activeWeight=m,o.currentTick=y,0):(o.activeWeight+m<=r?o.activeWeight+=m:(o.currentTick+=e,o.activeWeight=m),o.currentTick-y)}function f(m){let y=Date.now();if(o.strictTicks.length>0&&y-o.strictTicks.at(-1).time>e&&(o.strictTicks.length=0),i){for(;o.strictTicks.length>0&&y-o.strictTicks[0].time>=e;)o.strictTicks.shift();let M=w=>{let _=0;for(let b of o.strictTicks)b.time<=w&&w-b.time<e&&(_+=b.weight);return _};if(M(y)+m<=r)return c({time:y,weight:m}),{delay:0};let B=y;for(;M(B)+m>r;){let w=o.strictTicks.find(_=>_.time<=B&&B-_.time<e);if(!w)break;B=w.time+e}let F={time:B,weight:m};return c(F),{delay:Math.max(0,B-y),tickRecord:F}}if(o.strictTicks.length<u)return o.strictTicks.push({time:y,weight:m}),{delay:0};let T=o.strictTicks[0].time,x=o.strictTicks.at(-1).time,I=T+e,k=e>0?Math.ceil(e/u):0,O=I<=x?x+k:I;o.strictTicks.shift();let D={time:O,weight:m};return o.strictTicks.push(D),{delay:Math.max(0,O-y),tickRecord:D}}let p=t?f:l;return m=>{let y=function(...T){if(!y.isEnabled)return(async()=>m.apply(this,T))();let x;return new Promise((I,k)=>{let O=1;if(i){try{O=i(...T)}catch(w){k(w);return}if(!Number.isFinite(O)||O<0){k(new TypeError("Expected `weight` to be a finite non-negative number"));return}if(O>r){k(new TypeError(`Expected \`weight\` (${O}) to be <= \`limit\` (${r})`));return}}let D=p(O),M=t?D.delay:D,B=t?D.tickRecord:void 0,F=()=>{if(B){let w=Date.now();if(i&&B.time!==w){B.time=w;let _=o.strictTicks.indexOf(B);o.strictTicks.splice(_,1),c(B)}else B.time=w}try{I(m.apply(this,T))}catch(w){k(w)}o.queue.delete(x)};if(M>0){x=setTimeout(F,M),o.queue.set(x,k);try{s==null||s(...T)}catch{}}else F()})};if(n==null||n.throwIfAborted(),n){let T=Vi.get(n);T||(T={throttleds:new Set,listener:null},T.listener=()=>{for(let I of T.throttleds){let k=I.deref();if(!k)continue;let O=Cw.get(k);if(O){for(let D of O.queue.keys())clearTimeout(D),O.queue.get(D)(n.reason);O.queue.clear(),O.strictTicks.length=0,O.currentTick=0,O.activeWeight=0}}Vi.delete(n)},Vi.set(n,T),n.addEventListener("abort",T.listener,{once:!0}));let x=new WeakRef(y);T.throttleds.add(x),VC.register(y,{signalWeakRef:new WeakRef(n),weakReference:x})}return y.isEnabled=!0,Object.defineProperty(y,"queueSize",{get(){return o.queue.size}}),Cw.set(y,o),y}}var re=class re{constructor(e,t){se(this,"path");se(this,"docRef");se(this,"value");se(this,"throttle",250);se(this,"config",{heartbeatInterval:12e4,syncroRegistryUrl:"https://tera-tools.com/api/sync",context:{}});se(this,"isDirty",!1);se(this,"_destroyActions",[]);se(this,"_heartbeatTimer");this.path=e,Object.assign(this,{...t,config:{...this.config,...t==null?void 0:t.config}}),re.session||(re.session=`syncro_${Pw()}`)}debug(...e){}debugError(...e){console.warn(`[Syncro ${this.path}]`,...e)}destroy(){return this.debug("Destroy!"),Promise.resolve().then(()=>Promise.all(this._destroyActions.map(e=>e()))).then(()=>this._destroyActions=[])}getReactive(e){console.warn("Syncro.getReactive has not been subclassed, assuming a POJO response");let t={...e};return{doc:t,setState(n){Object.entries(n||{}).forEach(([s,i])=>t[s]=i)},getState(){return ar(t)},watch(n){}}}static pathSplit(e,t){var o;let n={allowAsterisk:!1,...t},i={...(o=new RegExp("^(?<entity>\\w+?)::(?<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:::(?<relation>[\\w\\-"+(n.allowAsterisk?"\\*":"")+"]+?))?$").exec(e))==null?void 0:o.groups};if(!i||!i.entity||!i.id)throw new Error(`Invalid session path syntax "${e}"`);if(re.SyncroEntities&&!(i.entity in re.SyncroEntities))throw new Error(`Unsupported entity "${e}" -> Entity="${i.entity}"`);return{entity:i.entity,id:i.id,relation:i.relation,fsCollection:i.entity,fsId:i.relation?`${i.id}::${i.relation}`:i.id}}static toFirestore(e={}){return ru.serialize(e,{...kw,stringify:!1})}static fromFirestore(e={}){return ru.deserialize(e,{...kw,destringify:!1})}static toFirestoreFields(e){let t={};for(let[n,s]of Object.entries(e)){let i=typeof s;i==="string"?t[n]={stringValue:s}:i==="number"?t[n]={doubleValue:s}:i==="boolean"?t[n]={booleanValue:s}:s===null?t[n]={nullValue:null}:Array.isArray(s)?t[n]={arrayValue:{values:s.map(o=>re.toFirestoreFields({item:o}).item)}}:i==="object"&&(t[n]={mapValue:{fields:re.toFirestoreFields(s)}})}return t}static fromFirestoreFields(e={}){let t={};for(let n in e){let s=e[n],i=["stringValue","booleanValue","doubleValue","integerValue","timestampValue","mapValue","arrayValue","nullValue"].find(o=>o===Object.keys(s)[0]);if(i)switch(i){case"mapValue":t[n]=re.fromFirestoreFields(s.mapValue.fields||{});break;case"arrayValue":{let o=s.arrayValue.values;t[n]=o?o.map(u=>re.fromFirestoreFields(u)):[];break}case"nullValue":t[n]=null;break;default:t[n]=s[i]}else t[n]=re.fromFirestoreFields(s)}return t}static getSnapshot(e){let{fsCollection:t,fsId:n}=re.pathSplit(e);return Promise.resolve().then(async()=>ah(rs(re.firestore,t,n))).then(s=>s.exists()?re.fromFirestore(s.data()):null)}static setSnapshot(e,t,n){let s={method:"merge",...n},{fsCollection:i,fsId:o}=re.pathSplit(e),u=rs(re.firestore,i,o),c=re.toFirestore(t);return Promise.resolve().then(()=>s.method==="merge"?ch(u,c):uh(u,c)).then(()=>t)}mount(e){let t={initialState:null,retries:5,retryMinTime:250,...e},{fsCollection:n,fsId:s,entity:i}=re.pathSplit(this.path),o,u;return Ni(async()=>{await this.setHeartbeat(!1),this.docRef=rs(re.firestore,n,s);let c=await this.getFirestoreState();if(this.path.startsWith("projects::")&&c&&!Ao(c)&&c.users&&!c.type&&!c.name&&!c.created){this.debugError("Zombie state detected (Partial document). Forcing repair...");let f=await fetch(`${this.config.syncroRegistryUrl}/${this.path}?drop=1&force=1`);f.ok?(this.debug("Repair signal sent successfully. Reloading local state..."),c=await this.getFirestoreState()):console.error("[Syncro] Self-healing failed",f.statusText)}if(o=this.getReactive(c),!o.doc||!o.setState||!o.getState||!o.watch)throw new Error("Syncro.getReactive() requires a returned `doc`, `setState()`, `getState()` + `watch()`");if(o.throttle){let f={limit:2,interval:100,strict:!1,...typeof o.throttle=="object"&&o.throttle},p=o.setState;o.setState=Lh({limit:f.limit,interval:f.interval,onDelay:()=>this.debug("Throttling excessive Syncro.setState() writes")})(p)}this.value=u=o.doc,this.debug("Initial state",{doc:u});let l=h_(this.docRef,f=>{let p=re.fromFirestore(f.data());this.debug("Incoming snapshot",{snapshotData:p}),o.setState(p)});if(this._destroyActions.push(l),Ao(u))if(t.initialState)this.debug("Populate initial Syncro state (from provided initialState)"),await this.setFirestoreState(t.initialState,{method:"set"});else{this.debug(`Populate initial Syncro state (from "${i}" Syncro worker)`);let f=await fetch(`${this.config.syncroRegistryUrl}/${this.path}`);if(!f.ok)throw new Error(`Failed to check Syncro "${n}::${s}" status - ${f.statusText}`)}return o.watch(Nu(f=>{this.debug("Local change",{newState:f}),this.markDirty(),this.setFirestoreState(f,{method:"merge"})},this.throttle)),await this.setHeartbeat(!0,{immediate:!0}),this},{retries:t.retries,minTimeout:t.retryMinTime,randomize:!0,factor:3,onFailedAttempt:async c=>{this.debugError(`[Attempt ${c.attemptNumber}/${c.attemptNumber+c.retriesLeft-1}] to mount syncro`,c),await this.destroy()}})}async set(e,t,n){let s;if(typeof e=="string")s[e]=t;else if(typeof e=="object")[s,n]=[e,t];else throw new Error("Unknown call signature for set() - call with string+value or object");let i={delta:!0,flush:!0,forceFlush:!1,flushDestroy:!1,...n},o=!1;return i.delta?Object.entries(s).filter(([u,c])=>!Ms(this.value[u],c)).forEach(([u,c])=>{o=!0,this.value[u]=c}):(o=!0,Object.assign(this.value,s)),(i.forceFlush||o)&&i.flush&&await this.flush({destroy:i.flushDestroy}),this}setHeartbeat(e=!0,t){let n={immediate:!0,...t};if(clearTimeout(this._heartbeatTimer),e){let s=async()=>{await this.heartbeat(),e&&this.setHeartbeat(!0)};if(this._heartbeatTimer=setTimeout(s,this.config.heartbeatInterval),n.immediate)return this.heartbeat()}}async heartbeat(){this.debug("heartbeat!");try{let e=await fetch(`${this.config.syncroRegistryUrl}/${this.path}/heartbeat`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:re.session,...this.isDirty&&{dirty:!0}})});e.ok||console.warn(this.path,`Heartbeat failed - ${e.statusText}`,{response:e}),this.isDirty=!1}catch(e){console.warn(this.path,"Heartbeat fetch error",e)}}async setFirestoreState(e,t,n=0){let s={method:"merge",...t};if(!this.docRef)throw new Error("mount() must be called before setting Firestore state");let i=re.toFirestore(e);try{return s.method==="merge"?await ch(this.docRef,i):await uh(this.docRef,i)}catch(o){if(o instanceof et&&o.code==="not-found"){if(n<3)return console.warn("Firebase syncro document does not exist during document update, reinitializing..."),(await fetch(`${this.config.syncroRegistryUrl}/${this.path}?force=1`)).ok||console.error("Failed to reinitialize Syncro"),await this.setFirestoreState(e,t,n+1);console.warn("Max retries exceeded while trying to recover firestore syncro document, throwing error")}throw console.error(`Error during Firestore operation (${s.method}) on doc: ${this.docRef.path}`,o),o}}getFirestoreState(){if(!this.docRef)throw new Error("mount() must be called before getting Firestore state");return ah(this.docRef).then(e=>{var t;return re.fromFirestore((t=e.data())!=null?t:{})})}markDirty(){return this.isDirty=!0,this}flush(e){let t={destroy:!1,...e};return fetch(`${this.config.syncroRegistryUrl}/${this.path}/flush`+(t.destroy?"?destroy=1":"")).then(n=>n.ok?null:Promise.reject(n.statusText||"An error occurred"))}};se(re,"firebase"),se(re,"firestore"),se(re,"supabasey"),se(re,"session"),se(re,"SyncroEntities");var $t=re;var kw={circular:!1,clone:!0,modules:[{id:"~array",recursive:!0,test:r=>Array.isArray(r),serialize:r=>({_:"~array",...r}),deserialize:r=>{let e=Array.from({length:Object.keys(r).length-1});return Object.entries(r).filter(([t])=>t!=="_").forEach(([t,n])=>e[+t]=n),e}},{id:"~function",test:r=>typeof r=="function",serialize:(r,e)=>{throw console.warn("Marshal Warning: Stripping function from path",e.join(".")),new Error("Function serializing is forbidden")},deserialize:(r,e)=>{console.warn("Marshal Warning: Stripping function from path",e.join("."))}},...ru.settings.modules.filter(r=>r.id!="~function")]};var Li=class{init(){}constructor(e,t){}};var Fi=class extends Li{constructor(){super(...arguments);se(this,"syncros",{});se(this,"namespaces",{});se(this,"getCredentials");se(this,"requireProject");se(this,"debug");se(this,"getReactive")}async init(t){let n={firebaseApiKey:null,firebaseAuthDomain:null,firebaseProjectId:null,firebaseAppId:null,supabaseUrl:null,supabaseKey:null,...await this.getCredentials(),...t},s=Object.keys(n).filter(i=>i===null);if(s.length>0)throw new Error("Firebase plugin requires mandatory options: "+s.join(", "));$t.firebase=ec({apiKey:n.firebaseApiKey,authDomain:n.firebaseAuthDomain,projectId:n.firebaseProjectId,appId:n.firebaseAppId}),$t.firestore=rh($t.firebase),$t.supabasey=await vw.init({env:{SUPABASE_URL:n.supabaseUrl,SUPABASE_KEY:n.supabaseKey}})}_mountNamespace(t){let n;return Promise.resolve().then(()=>this.requireProject()).then(s=>{let i=t=="_PROJECT"?`projects::${s.id}`:`project_namespaces::${s.id}::${t}`;return n=this.syncros[t]=new $t(i,{debug:(...o)=>this.debug(`SYNCRO://${i}`,...o),getReactive:this.getReactive}),n.mount()}).then(()=>{this.namespaces[t]=n.value})}_unmountNamespace(t){let n=this.syncros[t];return delete this.namespaces[t],delete this.syncros[t],n?n.destroy():Promise.resolve()}};var Fh=class extends Fi{constructor(){super(...arguments);se(this,"Vue");se(this,"app");se(this,"project",null);se(this,"reactiveId",1001)}async init(t){let n={app:null,Vue:null,globalName:"$tera",...t};if(!n.Vue)throw new Error("Vue instance to use must be specified in init options as `Vue`");if(this.Vue=n.Vue,!n.app)throw new Error("Vue Root / App instance to use must be specified in init options as `app`");this.app=n.app,n.globalName&&(this.Vue.prototype[n.globalName]=this),await super.init(n),this.project=await this.mountNamespace("_PROJECT")}getReactive(t){let n=this.Vue.observable(t),s=`_teraFy_${this.reactiveId++}`;return this.app[s]=n,{doc:n,setState:i=>{Object.entries(i||{}).filter(([o])=>!Ms(n[o],i[o])).forEach(([o,u])=>n[o]=u)},getState:()=>ar(n),watch:i=>{this.app.$watch(s,i,{deep:!0})}}}};export{Fh as default};
|
|
65
|
+
/*! Bundled license information:
|
|
66
|
+
|
|
67
|
+
lodash-es/lodash.js:
|
|
68
|
+
(**
|
|
69
|
+
* @license
|
|
70
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
71
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
72
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
73
|
+
* Released under MIT license <https://lodash.com/license>
|
|
74
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
75
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
76
|
+
*)
|
|
77
|
+
|
|
78
|
+
@firebase/util/dist/index.esm.js:
|
|
79
|
+
@firebase/util/dist/index.esm.js:
|
|
80
|
+
@firebase/util/dist/index.esm.js:
|
|
81
|
+
@firebase/util/dist/index.esm.js:
|
|
82
|
+
@firebase/util/dist/index.esm.js:
|
|
83
|
+
@firebase/util/dist/index.esm.js:
|
|
84
|
+
@firebase/util/dist/index.esm.js:
|
|
85
|
+
@firebase/util/dist/index.esm.js:
|
|
86
|
+
@firebase/util/dist/index.esm.js:
|
|
87
|
+
@firebase/util/dist/index.esm.js:
|
|
88
|
+
@firebase/logger/dist/esm/index.esm.js:
|
|
89
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
90
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
91
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
92
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
93
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
94
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
95
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
96
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
97
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
98
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
99
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
100
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
101
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
102
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
103
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
104
|
+
(**
|
|
105
|
+
* @license
|
|
106
|
+
* Copyright 2017 Google LLC
|
|
107
|
+
*
|
|
108
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
109
|
+
* you may not use this file except in compliance with the License.
|
|
110
|
+
* You may obtain a copy of the License at
|
|
111
|
+
*
|
|
112
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
113
|
+
*
|
|
114
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
115
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
116
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
117
|
+
* See the License for the specific language governing permissions and
|
|
118
|
+
* limitations under the License.
|
|
119
|
+
*)
|
|
120
|
+
|
|
121
|
+
@firebase/util/dist/index.esm.js:
|
|
122
|
+
@firebase/util/dist/index.esm.js:
|
|
123
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
124
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
125
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
126
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
127
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
128
|
+
@firebase/firestore/dist/index.esm.js:
|
|
129
|
+
@firebase/firestore/dist/index.esm.js:
|
|
130
|
+
@firebase/firestore/dist/index.esm.js:
|
|
131
|
+
(**
|
|
132
|
+
* @license
|
|
133
|
+
* Copyright 2022 Google LLC
|
|
134
|
+
*
|
|
135
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
136
|
+
* you may not use this file except in compliance with the License.
|
|
137
|
+
* You may obtain a copy of the License at
|
|
138
|
+
*
|
|
139
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
140
|
+
*
|
|
141
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
142
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
143
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
144
|
+
* See the License for the specific language governing permissions and
|
|
145
|
+
* limitations under the License.
|
|
146
|
+
*)
|
|
147
|
+
|
|
148
|
+
@firebase/util/dist/index.esm.js:
|
|
149
|
+
(**
|
|
150
|
+
* @license
|
|
151
|
+
* Copyright 2017 Google LLC
|
|
152
|
+
*
|
|
153
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
154
|
+
* you may not use this file except in compliance with the License.
|
|
155
|
+
* You may obtain a copy of the License at
|
|
156
|
+
*
|
|
157
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
158
|
+
*
|
|
159
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
160
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
161
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
162
|
+
* See the License for the specific language governing permissions and
|
|
163
|
+
* limitations under the License.
|
|
164
|
+
*)
|
|
165
|
+
(**
|
|
166
|
+
* @license
|
|
167
|
+
* Copyright 2021 Google LLC
|
|
168
|
+
*
|
|
169
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
170
|
+
* you may not use this file except in compliance with the License.
|
|
171
|
+
* You may obtain a copy of the License at
|
|
172
|
+
*
|
|
173
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
174
|
+
*
|
|
175
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
176
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
177
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
178
|
+
* See the License for the specific language governing permissions and
|
|
179
|
+
* limitations under the License.
|
|
180
|
+
*)
|
|
181
|
+
|
|
182
|
+
@firebase/util/dist/index.esm.js:
|
|
183
|
+
@firebase/component/dist/esm/index.esm.js:
|
|
184
|
+
@firebase/app/dist/esm/index.esm.js:
|
|
185
|
+
@firebase/app/dist/esm/index.esm.js:
|
|
186
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
187
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
188
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
189
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
190
|
+
(**
|
|
191
|
+
* @license
|
|
192
|
+
* Copyright 2019 Google LLC
|
|
193
|
+
*
|
|
194
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
195
|
+
* you may not use this file except in compliance with the License.
|
|
196
|
+
* You may obtain a copy of the License at
|
|
197
|
+
*
|
|
198
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
199
|
+
*
|
|
200
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
201
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
202
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
203
|
+
* See the License for the specific language governing permissions and
|
|
204
|
+
* limitations under the License.
|
|
205
|
+
*)
|
|
206
|
+
|
|
207
|
+
@firebase/util/dist/index.esm.js:
|
|
208
|
+
firebase/app/dist/esm/index.esm.js:
|
|
209
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
210
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
211
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
212
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
213
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
214
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
215
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
216
|
+
@firebase/firestore/dist/index.esm.js:
|
|
217
|
+
@firebase/firestore/dist/index.esm.js:
|
|
218
|
+
@firebase/firestore/dist/index.esm.js:
|
|
219
|
+
@firebase/firestore/dist/index.esm.js:
|
|
220
|
+
@firebase/firestore/dist/index.esm.js:
|
|
221
|
+
(**
|
|
222
|
+
* @license
|
|
223
|
+
* Copyright 2020 Google LLC
|
|
224
|
+
*
|
|
225
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
226
|
+
* you may not use this file except in compliance with the License.
|
|
227
|
+
* You may obtain a copy of the License at
|
|
228
|
+
*
|
|
229
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
230
|
+
*
|
|
231
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
232
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
233
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
234
|
+
* See the License for the specific language governing permissions and
|
|
235
|
+
* limitations under the License.
|
|
236
|
+
*)
|
|
237
|
+
|
|
238
|
+
@firebase/util/dist/index.esm.js:
|
|
239
|
+
(**
|
|
240
|
+
* @license
|
|
241
|
+
* Copyright 2021 Google LLC
|
|
242
|
+
*
|
|
243
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
244
|
+
* you may not use this file except in compliance with the License.
|
|
245
|
+
* You may obtain a copy of the License at
|
|
246
|
+
*
|
|
247
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
248
|
+
*
|
|
249
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
250
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
251
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
252
|
+
* See the License for the specific language governing permissions and
|
|
253
|
+
* limitations under the License.
|
|
254
|
+
*)
|
|
255
|
+
(**
|
|
256
|
+
* @license
|
|
257
|
+
* Copyright 2025 Google LLC
|
|
258
|
+
*
|
|
259
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
260
|
+
* you may not use this file except in compliance with the License.
|
|
261
|
+
* You may obtain a copy of the License at
|
|
262
|
+
*
|
|
263
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
264
|
+
*
|
|
265
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
266
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
267
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
268
|
+
* See the License for the specific language governing permissions and
|
|
269
|
+
* limitations under the License.
|
|
270
|
+
*)
|
|
271
|
+
|
|
272
|
+
@firebase/app/dist/esm/index.esm.js:
|
|
273
|
+
(**
|
|
274
|
+
* @license
|
|
275
|
+
* Copyright 2019 Google LLC
|
|
276
|
+
*
|
|
277
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
278
|
+
* you may not use this file except in compliance with the License.
|
|
279
|
+
* You may obtain a copy of the License at
|
|
280
|
+
*
|
|
281
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
282
|
+
*
|
|
283
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
284
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
285
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
286
|
+
* See the License for the specific language governing permissions and
|
|
287
|
+
* limitations under the License.
|
|
288
|
+
*)
|
|
289
|
+
(**
|
|
290
|
+
* @license
|
|
291
|
+
* Copyright 2023 Google LLC
|
|
292
|
+
*
|
|
293
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
294
|
+
* you may not use this file except in compliance with the License.
|
|
295
|
+
* You may obtain a copy of the License at
|
|
296
|
+
*
|
|
297
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
298
|
+
*
|
|
299
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
300
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
301
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
302
|
+
* See the License for the specific language governing permissions and
|
|
303
|
+
* limitations under the License.
|
|
304
|
+
*)
|
|
305
|
+
|
|
306
|
+
@firebase/app/dist/esm/index.esm.js:
|
|
307
|
+
(**
|
|
308
|
+
* @license
|
|
309
|
+
* Copyright 2021 Google LLC
|
|
310
|
+
*
|
|
311
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
312
|
+
* you may not use this file except in compliance with the License.
|
|
313
|
+
* You may obtain a copy of the License at
|
|
314
|
+
*
|
|
315
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
316
|
+
*
|
|
317
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
318
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
319
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
320
|
+
* See the License for the specific language governing permissions and
|
|
321
|
+
* limitations under the License.
|
|
322
|
+
*)
|
|
323
|
+
(**
|
|
324
|
+
* @license
|
|
325
|
+
* Copyright 2019 Google LLC
|
|
326
|
+
*
|
|
327
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
328
|
+
* you may not use this file except in compliance with the License.
|
|
329
|
+
* You may obtain a copy of the License at
|
|
330
|
+
*
|
|
331
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
332
|
+
*
|
|
333
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
334
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
335
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
336
|
+
* See the License for the specific language governing permissions and
|
|
337
|
+
* limitations under the License.
|
|
338
|
+
*)
|
|
339
|
+
|
|
340
|
+
@firebase/webchannel-wrapper/dist/bloom-blob/esm/bloom_blob_es2018.js:
|
|
341
|
+
@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:
|
|
342
|
+
(** @license
|
|
343
|
+
Copyright The Closure Library Authors.
|
|
344
|
+
SPDX-License-Identifier: Apache-2.0
|
|
345
|
+
*)
|
|
346
|
+
(** @license
|
|
347
|
+
|
|
348
|
+
Copyright The Closure Library Authors.
|
|
349
|
+
SPDX-License-Identifier: Apache-2.0
|
|
350
|
+
*)
|
|
351
|
+
|
|
352
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
353
|
+
(**
|
|
354
|
+
* @license
|
|
355
|
+
* Copyright 2017 Google LLC
|
|
356
|
+
*
|
|
357
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
358
|
+
* you may not use this file except in compliance with the License.
|
|
359
|
+
* You may obtain a copy of the License at
|
|
360
|
+
*
|
|
361
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
362
|
+
*
|
|
363
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
364
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
365
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
366
|
+
* See the License for the specific language governing permissions and
|
|
367
|
+
* limitations under the License.
|
|
368
|
+
*)
|
|
369
|
+
(**
|
|
370
|
+
* @license
|
|
371
|
+
* Copyright 2020 Google LLC
|
|
372
|
+
*
|
|
373
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
374
|
+
* you may not use this file except in compliance with the License.
|
|
375
|
+
* You may obtain a copy of the License at
|
|
376
|
+
*
|
|
377
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
378
|
+
*
|
|
379
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
380
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
381
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
382
|
+
* See the License for the specific language governing permissions and
|
|
383
|
+
* limitations under the License.
|
|
384
|
+
*)
|
|
385
|
+
|
|
386
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
387
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
388
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
389
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
390
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
391
|
+
(**
|
|
392
|
+
* @license
|
|
393
|
+
* Copyright 2020 Google LLC
|
|
394
|
+
*
|
|
395
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
396
|
+
* you may not use this file except in compliance with the License.
|
|
397
|
+
* You may obtain a copy of the License at
|
|
398
|
+
*
|
|
399
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
400
|
+
*
|
|
401
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
402
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
403
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
404
|
+
* See the License for the specific language governing permissions and
|
|
405
|
+
* limitations under the License.
|
|
406
|
+
*)
|
|
407
|
+
(**
|
|
408
|
+
* @license
|
|
409
|
+
* Copyright 2017 Google LLC
|
|
410
|
+
*
|
|
411
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
412
|
+
* you may not use this file except in compliance with the License.
|
|
413
|
+
* You may obtain a copy of the License at
|
|
414
|
+
*
|
|
415
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
416
|
+
*
|
|
417
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
418
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
419
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
420
|
+
* See the License for the specific language governing permissions and
|
|
421
|
+
* limitations under the License.
|
|
422
|
+
*)
|
|
423
|
+
|
|
424
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
425
|
+
(**
|
|
426
|
+
* @license
|
|
427
|
+
* Copyright 2025 Google LLC
|
|
428
|
+
*
|
|
429
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
430
|
+
* you may not use this file except in compliance with the License.
|
|
431
|
+
* You may obtain a copy of the License at
|
|
432
|
+
*
|
|
433
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
434
|
+
*
|
|
435
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
436
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
437
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
438
|
+
* See the License for the specific language governing permissions and
|
|
439
|
+
* limitations under the License.
|
|
440
|
+
*)
|
|
441
|
+
(**
|
|
442
|
+
* @license
|
|
443
|
+
* Copyright 2017 Google LLC
|
|
444
|
+
*
|
|
445
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
446
|
+
* you may not use this file except in compliance with the License.
|
|
447
|
+
* You may obtain a copy of the License at
|
|
448
|
+
*
|
|
449
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
450
|
+
*
|
|
451
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
452
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
453
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
454
|
+
* See the License for the specific language governing permissions and
|
|
455
|
+
* limitations under the License.
|
|
456
|
+
*)
|
|
457
|
+
(**
|
|
458
|
+
* @license
|
|
459
|
+
* Copyright 2021 Google LLC
|
|
460
|
+
*
|
|
461
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
462
|
+
* you may not use this file except in compliance with the License.
|
|
463
|
+
* You may obtain a copy of the License at
|
|
464
|
+
*
|
|
465
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
466
|
+
*
|
|
467
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
468
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
469
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
470
|
+
* See the License for the specific language governing permissions and
|
|
471
|
+
* limitations under the License.
|
|
472
|
+
*)
|
|
473
|
+
|
|
474
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
475
|
+
(**
|
|
476
|
+
* @license
|
|
477
|
+
* Copyright 2018 Google LLC
|
|
478
|
+
*
|
|
479
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
480
|
+
* you may not use this file except in compliance with the License.
|
|
481
|
+
* You may obtain a copy of the License at
|
|
482
|
+
*
|
|
483
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
484
|
+
*
|
|
485
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
486
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
487
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
488
|
+
* See the License for the specific language governing permissions and
|
|
489
|
+
* limitations under the License.
|
|
490
|
+
*)
|
|
491
|
+
(**
|
|
492
|
+
* @license
|
|
493
|
+
* Copyright 2017 Google LLC
|
|
494
|
+
*
|
|
495
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
496
|
+
* you may not use this file except in compliance with the License.
|
|
497
|
+
* You may obtain a copy of the License at
|
|
498
|
+
*
|
|
499
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
500
|
+
*
|
|
501
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
502
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
503
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
504
|
+
* See the License for the specific language governing permissions and
|
|
505
|
+
* limitations under the License.
|
|
506
|
+
*)
|
|
507
|
+
|
|
508
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
509
|
+
(**
|
|
510
|
+
* @license
|
|
511
|
+
* Copyright 2020 Google LLC
|
|
512
|
+
*
|
|
513
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
514
|
+
* you may not use this file except in compliance with the License.
|
|
515
|
+
* You may obtain a copy of the License at
|
|
516
|
+
*
|
|
517
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
518
|
+
*
|
|
519
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
520
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
521
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
522
|
+
* See the License for the specific language governing permissions and
|
|
523
|
+
* limitations under the License.
|
|
524
|
+
*)
|
|
525
|
+
(**
|
|
526
|
+
* @license
|
|
527
|
+
* Copyright 2023 Google LLC
|
|
528
|
+
*
|
|
529
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
530
|
+
* you may not use this file except in compliance with the License.
|
|
531
|
+
* You may obtain a copy of the License at
|
|
532
|
+
*
|
|
533
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
534
|
+
*
|
|
535
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
536
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
537
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
538
|
+
* See the License for the specific language governing permissions and
|
|
539
|
+
* limitations under the License.
|
|
540
|
+
*)
|
|
541
|
+
|
|
542
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
543
|
+
@firebase/firestore/dist/index.esm.js:
|
|
544
|
+
(**
|
|
545
|
+
* @license
|
|
546
|
+
* Copyright 2017 Google LLC
|
|
547
|
+
*
|
|
548
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
549
|
+
* you may not use this file except in compliance with the License.
|
|
550
|
+
* You may obtain a copy of the License at
|
|
551
|
+
*
|
|
552
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
553
|
+
*
|
|
554
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
555
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
556
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
557
|
+
* See the License for the specific language governing permissions and
|
|
558
|
+
* limitations under the License.
|
|
559
|
+
*)
|
|
560
|
+
(**
|
|
561
|
+
* @license
|
|
562
|
+
* Copyright 2022 Google LLC
|
|
563
|
+
*
|
|
564
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
565
|
+
* you may not use this file except in compliance with the License.
|
|
566
|
+
* You may obtain a copy of the License at
|
|
567
|
+
*
|
|
568
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
569
|
+
*
|
|
570
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
571
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
572
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
573
|
+
* See the License for the specific language governing permissions and
|
|
574
|
+
* limitations under the License.
|
|
575
|
+
*)
|
|
576
|
+
|
|
577
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
578
|
+
(**
|
|
579
|
+
* @license
|
|
580
|
+
* Copyright 2017 Google LLC
|
|
581
|
+
*
|
|
582
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
583
|
+
* you may not use this file except in compliance with the License.
|
|
584
|
+
* You may obtain a copy of the License at
|
|
585
|
+
*
|
|
586
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
587
|
+
*
|
|
588
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
589
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
590
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
591
|
+
* See the License for the specific language governing permissions and
|
|
592
|
+
* limitations under the License.
|
|
593
|
+
*)
|
|
594
|
+
(**
|
|
595
|
+
* @license
|
|
596
|
+
* Copyright 2020 Google LLC
|
|
597
|
+
*
|
|
598
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
599
|
+
* you may not use this file except in compliance with the License.
|
|
600
|
+
* You may obtain a copy of the License at
|
|
601
|
+
*
|
|
602
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
603
|
+
*
|
|
604
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
605
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
606
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
607
|
+
* See the License for the specific language governing permissions and
|
|
608
|
+
* limitations under the License.
|
|
609
|
+
*)
|
|
610
|
+
(**
|
|
611
|
+
* @license
|
|
612
|
+
* Copyright 2018 Google LLC
|
|
613
|
+
*
|
|
614
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
615
|
+
* you may not use this file except in compliance with the License.
|
|
616
|
+
* You may obtain a copy of the License at
|
|
617
|
+
*
|
|
618
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
619
|
+
*
|
|
620
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
621
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
622
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
623
|
+
* See the License for the specific language governing permissions and
|
|
624
|
+
* limitations under the License.
|
|
625
|
+
*)
|
|
626
|
+
|
|
627
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
628
|
+
(**
|
|
629
|
+
* @license
|
|
630
|
+
* Copyright 2017 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
|
+
*)
|
|
644
|
+
(**
|
|
645
|
+
* @license
|
|
646
|
+
* Copyright 2022 Google LLC
|
|
647
|
+
*
|
|
648
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
649
|
+
* you may not use this file except in compliance with the License.
|
|
650
|
+
* You may obtain a copy of the License at
|
|
651
|
+
*
|
|
652
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
653
|
+
*
|
|
654
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
655
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
656
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
657
|
+
* See the License for the specific language governing permissions and
|
|
658
|
+
* limitations under the License.
|
|
659
|
+
*)
|
|
660
|
+
(**
|
|
661
|
+
* @license
|
|
662
|
+
* Copyright 2023 Google LLC
|
|
663
|
+
*
|
|
664
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
665
|
+
* you may not use this file except in compliance with the License.
|
|
666
|
+
* You may obtain a copy of the License at
|
|
667
|
+
*
|
|
668
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
669
|
+
*
|
|
670
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
671
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
672
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
673
|
+
* See the License for the specific language governing permissions and
|
|
674
|
+
* limitations under the License.
|
|
675
|
+
*)
|
|
676
|
+
|
|
677
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
678
|
+
(**
|
|
679
|
+
* @license
|
|
680
|
+
* Copyright 2017 Google LLC
|
|
681
|
+
*
|
|
682
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
683
|
+
* you may not use this file except in compliance with the License.
|
|
684
|
+
* You may obtain a copy of the License at
|
|
685
|
+
*
|
|
686
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
687
|
+
*
|
|
688
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
689
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
690
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
691
|
+
* See the License for the specific language governing permissions and
|
|
692
|
+
* limitations under the License.
|
|
693
|
+
*)
|
|
694
|
+
(**
|
|
695
|
+
* @license
|
|
696
|
+
* Copyright 2023 Google LLC
|
|
697
|
+
*
|
|
698
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
699
|
+
* you may not use this file except in compliance with the License.
|
|
700
|
+
* You may obtain a copy of the License at
|
|
701
|
+
*
|
|
702
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
703
|
+
*
|
|
704
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
705
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
706
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
707
|
+
* See the License for the specific language governing permissions and
|
|
708
|
+
* limitations under the License.
|
|
709
|
+
*)
|
|
710
|
+
|
|
711
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
712
|
+
(**
|
|
713
|
+
* @license
|
|
714
|
+
* Copyright 2023 Google LLC
|
|
715
|
+
*
|
|
716
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
717
|
+
* you may not use this file except in compliance with the License.
|
|
718
|
+
* You may obtain a copy of the License at
|
|
719
|
+
*
|
|
720
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
721
|
+
*
|
|
722
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
723
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
724
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
725
|
+
* See the License for the specific language governing permissions and
|
|
726
|
+
* limitations under the License.
|
|
727
|
+
*)
|
|
728
|
+
(**
|
|
729
|
+
* @license
|
|
730
|
+
* Copyright 2022 Google LLC
|
|
731
|
+
*
|
|
732
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
733
|
+
* you may not use this file except in compliance with the License.
|
|
734
|
+
* You may obtain a copy of the License at
|
|
735
|
+
*
|
|
736
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
737
|
+
*
|
|
738
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
739
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
740
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
741
|
+
* See the License for the specific language governing permissions and
|
|
742
|
+
* limitations under the License.
|
|
743
|
+
*)
|
|
744
|
+
(**
|
|
745
|
+
* @license
|
|
746
|
+
* Copyright 2017 Google LLC
|
|
747
|
+
*
|
|
748
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
749
|
+
* you may not use this file except in compliance with the License.
|
|
750
|
+
* You may obtain a copy of the License at
|
|
751
|
+
*
|
|
752
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
753
|
+
*
|
|
754
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
755
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
756
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
757
|
+
* See the License for the specific language governing permissions and
|
|
758
|
+
* limitations under the License.
|
|
759
|
+
*)
|
|
760
|
+
|
|
761
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
762
|
+
(**
|
|
763
|
+
* @license
|
|
764
|
+
* Copyright 2024 Google LLC
|
|
765
|
+
*
|
|
766
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
767
|
+
* you may not use this file except in compliance with the License.
|
|
768
|
+
* You may obtain a copy of the License at
|
|
769
|
+
*
|
|
770
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
771
|
+
*
|
|
772
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
773
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
774
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
775
|
+
* See the License for the specific language governing permissions and
|
|
776
|
+
* limitations under the License.
|
|
777
|
+
*)
|
|
778
|
+
|
|
779
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
780
|
+
(**
|
|
781
|
+
* @license
|
|
782
|
+
* Copyright 2021 Google LLC
|
|
783
|
+
*
|
|
784
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
785
|
+
* you may not use this file except in compliance with the License.
|
|
786
|
+
* You may obtain a copy of the License at
|
|
787
|
+
*
|
|
788
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
789
|
+
*
|
|
790
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
791
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
792
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
793
|
+
* See the License for the specific language governing permissions and
|
|
794
|
+
* limitations under the License.
|
|
795
|
+
*)
|
|
796
|
+
(**
|
|
797
|
+
* @license
|
|
798
|
+
* Copyright 2021 Google LLC
|
|
799
|
+
*
|
|
800
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
801
|
+
* you may not use this file except in compliance with the License.
|
|
802
|
+
* You may obtain a copy of the License at
|
|
803
|
+
*
|
|
804
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
805
|
+
*
|
|
806
|
+
* Unless required by applicable law | agreed to in writing, software
|
|
807
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
808
|
+
* WITHOUT WARRANTIES | CONDITIONS OF ANY KIND, either express | implied.
|
|
809
|
+
* See the License for the specific language governing permissions and
|
|
810
|
+
* limitations under the License.
|
|
811
|
+
*)
|
|
812
|
+
|
|
813
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
814
|
+
(**
|
|
815
|
+
* @license
|
|
816
|
+
* Copyright 2018 Google LLC
|
|
817
|
+
*
|
|
818
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
819
|
+
* you may not use this file except in compliance with the License.
|
|
820
|
+
* You may obtain a copy of the License at
|
|
821
|
+
*
|
|
822
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
823
|
+
*
|
|
824
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
825
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
826
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
827
|
+
* See the License for the specific language governing permissions and
|
|
828
|
+
* limitations under the License.
|
|
829
|
+
*)
|
|
830
|
+
(**
|
|
831
|
+
* @license
|
|
832
|
+
* Copyright 2020 Google LLC
|
|
833
|
+
*
|
|
834
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
835
|
+
* you may not use this file except in compliance with the License.
|
|
836
|
+
* You may obtain a copy of the License at
|
|
837
|
+
*
|
|
838
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
839
|
+
*
|
|
840
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
841
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
842
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
843
|
+
* See the License for the specific language governing permissions and
|
|
844
|
+
* limitations under the License.
|
|
845
|
+
*)
|
|
846
|
+
|
|
847
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
848
|
+
(**
|
|
849
|
+
* @license
|
|
850
|
+
* Copyright 2017 Google LLC
|
|
851
|
+
*
|
|
852
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
853
|
+
* you may not use this file except in compliance with the License.
|
|
854
|
+
* You may obtain a copy of the License at
|
|
855
|
+
*
|
|
856
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
857
|
+
*
|
|
858
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
859
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
860
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
861
|
+
* See the License for the specific language governing permissions and
|
|
862
|
+
* limitations under the License.
|
|
863
|
+
*)
|
|
864
|
+
(**
|
|
865
|
+
* @license
|
|
866
|
+
* Copyright 2022 Google LLC
|
|
867
|
+
*
|
|
868
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
869
|
+
* you may not use this file except in compliance with the License.
|
|
870
|
+
* You may obtain a copy of the License at
|
|
871
|
+
*
|
|
872
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
873
|
+
*
|
|
874
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
875
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
876
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
877
|
+
* See the License for the specific language governing permissions and
|
|
878
|
+
* limitations under the License.
|
|
879
|
+
*)
|
|
880
|
+
(**
|
|
881
|
+
* @license
|
|
882
|
+
* Copyright 2020 Google LLC
|
|
883
|
+
*
|
|
884
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
885
|
+
* you may not use this file except in compliance with the License.
|
|
886
|
+
* You may obtain a copy of the License at
|
|
887
|
+
*
|
|
888
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
889
|
+
*
|
|
890
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
891
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
892
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
893
|
+
* See the License for the specific language governing permissions and
|
|
894
|
+
* limitations under the License.
|
|
895
|
+
*)
|
|
896
|
+
(**
|
|
897
|
+
* @license
|
|
898
|
+
* Copyright 2024 Google LLC
|
|
899
|
+
*
|
|
900
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
901
|
+
* you may not use this file except in compliance with the License.
|
|
902
|
+
* You may obtain a copy of the License at
|
|
903
|
+
*
|
|
904
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
905
|
+
*
|
|
906
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
907
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
908
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
909
|
+
* See the License for the specific language governing permissions and
|
|
910
|
+
* limitations under the License.
|
|
911
|
+
*)
|
|
912
|
+
|
|
913
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
914
|
+
(**
|
|
915
|
+
* @license
|
|
916
|
+
* Copyright 2017 Google LLC
|
|
917
|
+
*
|
|
918
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
919
|
+
* you may not use this file except in compliance with the License.
|
|
920
|
+
* You may obtain a copy of the License at
|
|
921
|
+
*
|
|
922
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
923
|
+
*
|
|
924
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
925
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
926
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
927
|
+
* See the License for the specific language governing permissions and
|
|
928
|
+
* limitations under the License.
|
|
929
|
+
*)
|
|
930
|
+
(**
|
|
931
|
+
* @license
|
|
932
|
+
* Copyright 2023 Google LLC
|
|
933
|
+
*
|
|
934
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
935
|
+
* you may not use this file except in compliance with the License.
|
|
936
|
+
* You may obtain a copy of the License at
|
|
937
|
+
*
|
|
938
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
939
|
+
*
|
|
940
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
941
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
942
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
943
|
+
* See the License for the specific language governing permissions and
|
|
944
|
+
* limitations under the License.
|
|
945
|
+
*)
|
|
946
|
+
(**
|
|
947
|
+
* @license
|
|
948
|
+
* Copyright 2019 Google LLC
|
|
949
|
+
*
|
|
950
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
951
|
+
* you may not use this file except in compliance with the License.
|
|
952
|
+
* You may obtain a copy of the License at
|
|
953
|
+
*
|
|
954
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
955
|
+
*
|
|
956
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
957
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
958
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
959
|
+
* See the License for the specific language governing permissions and
|
|
960
|
+
* limitations under the License.
|
|
961
|
+
*)
|
|
962
|
+
(**
|
|
963
|
+
* @license
|
|
964
|
+
* Copyright 2020 Google LLC
|
|
965
|
+
*
|
|
966
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
967
|
+
* you may not use this file except in compliance with the License.
|
|
968
|
+
* You may obtain a copy of the License at
|
|
969
|
+
*
|
|
970
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
971
|
+
*
|
|
972
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
973
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
974
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
975
|
+
* See the License for the specific language governing permissions and
|
|
976
|
+
* limitations under the License.
|
|
977
|
+
*)
|
|
978
|
+
|
|
979
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
980
|
+
(**
|
|
981
|
+
* @license
|
|
982
|
+
* Copyright 2018 Google LLC
|
|
983
|
+
*
|
|
984
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
985
|
+
* you may not use this file except in compliance with the License.
|
|
986
|
+
* You may obtain a copy of the License at
|
|
987
|
+
*
|
|
988
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
989
|
+
*
|
|
990
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
991
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
992
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
993
|
+
* See the License for the specific language governing permissions and
|
|
994
|
+
* limitations under the License.
|
|
995
|
+
*)
|
|
996
|
+
|
|
997
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
998
|
+
(**
|
|
999
|
+
* @license
|
|
1000
|
+
* Copyright 2019 Google LLC
|
|
1001
|
+
*
|
|
1002
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1003
|
+
* you may not use this file except in compliance with the License.
|
|
1004
|
+
* You may obtain a copy of the License at
|
|
1005
|
+
*
|
|
1006
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1007
|
+
*
|
|
1008
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1009
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1010
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1011
|
+
* See the License for the specific language governing permissions and
|
|
1012
|
+
* limitations under the License.
|
|
1013
|
+
*)
|
|
1014
|
+
(**
|
|
1015
|
+
* @license
|
|
1016
|
+
* Copyright 2023 Google LLC
|
|
1017
|
+
*
|
|
1018
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1019
|
+
* you may not use this file except in compliance with the License.
|
|
1020
|
+
* You may obtain a copy of the License at
|
|
1021
|
+
*
|
|
1022
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1023
|
+
*
|
|
1024
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1025
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1026
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1027
|
+
* See the License for the specific language governing permissions and
|
|
1028
|
+
* limitations under the License.
|
|
1029
|
+
*)
|
|
1030
|
+
(**
|
|
1031
|
+
* @license
|
|
1032
|
+
* Copyright 2020 Google LLC
|
|
1033
|
+
*
|
|
1034
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1035
|
+
* you may not use this file except in compliance with the License.
|
|
1036
|
+
* You may obtain a copy of the License at
|
|
1037
|
+
*
|
|
1038
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1039
|
+
*
|
|
1040
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1041
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1042
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1043
|
+
* See the License for the specific language governing permissions and
|
|
1044
|
+
* limitations under the License.
|
|
1045
|
+
*)
|
|
1046
|
+
(**
|
|
1047
|
+
* @license
|
|
1048
|
+
* Copyright 2017 Google LLC
|
|
1049
|
+
*
|
|
1050
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1051
|
+
* you may not use this file except in compliance with the License.
|
|
1052
|
+
* You may obtain a copy of the License at
|
|
1053
|
+
*
|
|
1054
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1055
|
+
*
|
|
1056
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1057
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1058
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1059
|
+
* See the License for the specific language governing permissions and
|
|
1060
|
+
* limitations under the License.
|
|
1061
|
+
*)
|
|
1062
|
+
|
|
1063
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
1064
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
1065
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
1066
|
+
(**
|
|
1067
|
+
* @license
|
|
1068
|
+
* Copyright 2025 Google LLC
|
|
1069
|
+
*
|
|
1070
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1071
|
+
* you may not use this file except in compliance with the License.
|
|
1072
|
+
* You may obtain a copy of the License at
|
|
1073
|
+
*
|
|
1074
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1075
|
+
*
|
|
1076
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1077
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1078
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1079
|
+
* See the License for the specific language governing permissions and
|
|
1080
|
+
* limitations under the License.
|
|
1081
|
+
*)
|
|
1082
|
+
|
|
1083
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
1084
|
+
(**
|
|
1085
|
+
* @license
|
|
1086
|
+
* Copyright 2023 Google LLC
|
|
1087
|
+
*
|
|
1088
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1089
|
+
* you may not use this file except in compliance with the License.
|
|
1090
|
+
* You may obtain a copy of the License at
|
|
1091
|
+
*
|
|
1092
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1093
|
+
*
|
|
1094
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1095
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1096
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1097
|
+
* See the License for the specific language governing permissions and
|
|
1098
|
+
* limitations under the License.
|
|
1099
|
+
*)
|
|
1100
|
+
(**
|
|
1101
|
+
* @license
|
|
1102
|
+
* Copyright 2020 Google LLC
|
|
1103
|
+
*
|
|
1104
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1105
|
+
* you may not use this file except in compliance with the License.
|
|
1106
|
+
* You may obtain a copy of the License at
|
|
1107
|
+
*
|
|
1108
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1109
|
+
*
|
|
1110
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1111
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1112
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1113
|
+
* See the License for the specific language governing permissions and
|
|
1114
|
+
* limitations under the License.
|
|
1115
|
+
*)
|
|
1116
|
+
|
|
1117
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
1118
|
+
(**
|
|
1119
|
+
* @license
|
|
1120
|
+
* Copyright 2020 Google LLC
|
|
1121
|
+
*
|
|
1122
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1123
|
+
* you may not use this file except in compliance with the License.
|
|
1124
|
+
* You may obtain a copy of the License at
|
|
1125
|
+
*
|
|
1126
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1127
|
+
*
|
|
1128
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1129
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1130
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1131
|
+
* See the License for the specific language governing permissions and
|
|
1132
|
+
* limitations under the License.
|
|
1133
|
+
*)
|
|
1134
|
+
(**
|
|
1135
|
+
* @license
|
|
1136
|
+
* Copyright 2017 Google LLC
|
|
1137
|
+
*
|
|
1138
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1139
|
+
* you may not use this file except in compliance with the License.
|
|
1140
|
+
* You may obtain a copy of the License at
|
|
1141
|
+
*
|
|
1142
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1143
|
+
*
|
|
1144
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1145
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1146
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1147
|
+
* See the License for the specific language governing permissions and
|
|
1148
|
+
* limitations under the License.
|
|
1149
|
+
*)
|
|
1150
|
+
(**
|
|
1151
|
+
* @license
|
|
1152
|
+
* Copyright 2024 Google LLC
|
|
1153
|
+
*
|
|
1154
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1155
|
+
* you may not use this file except in compliance with the License.
|
|
1156
|
+
* You may obtain a copy of the License at
|
|
1157
|
+
*
|
|
1158
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1159
|
+
*
|
|
1160
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1161
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1162
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1163
|
+
* See the License for the specific language governing permissions and
|
|
1164
|
+
* limitations under the License.
|
|
1165
|
+
*)
|
|
1166
|
+
|
|
1167
|
+
@firebase/firestore/dist/common-edb5d170.esm.js:
|
|
1168
|
+
(**
|
|
1169
|
+
* @license
|
|
1170
|
+
* Copyright 2020 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
|
+
*)
|
|
1184
|
+
(**
|
|
1185
|
+
* @license
|
|
1186
|
+
* Copyright 2024 Google LLC
|
|
1187
|
+
*
|
|
1188
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1189
|
+
* you may not use this file except in compliance with the License.
|
|
1190
|
+
* You may obtain a copy of the License at
|
|
1191
|
+
*
|
|
1192
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1193
|
+
*
|
|
1194
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1195
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1196
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1197
|
+
* See the License for the specific language governing permissions and
|
|
1198
|
+
* limitations under the License.
|
|
1199
|
+
*)
|
|
1200
|
+
|
|
1201
|
+
@firebase/firestore/dist/index.esm.js:
|
|
1202
|
+
(**
|
|
1203
|
+
* @license
|
|
1204
|
+
* Copyright 2025 Google LLC
|
|
1205
|
+
*
|
|
1206
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1207
|
+
* you may not use this file except in compliance with the License.
|
|
1208
|
+
* You may obtain a copy of the License at
|
|
1209
|
+
*
|
|
1210
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1211
|
+
*
|
|
1212
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1213
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1214
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1215
|
+
* See the License for the specific language governing permissions and
|
|
1216
|
+
* limitations under the License.
|
|
1217
|
+
*)
|
|
1218
|
+
(**
|
|
1219
|
+
* @license
|
|
1220
|
+
* Copyright 2020 Google LLC
|
|
1221
|
+
*
|
|
1222
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1223
|
+
* you may not use this file except in compliance with the License.
|
|
1224
|
+
* You may obtain a copy of the License at
|
|
1225
|
+
*
|
|
1226
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1227
|
+
*
|
|
1228
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1229
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1230
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1231
|
+
* See the License for the specific language governing permissions and
|
|
1232
|
+
* limitations under the License.
|
|
1233
|
+
*)
|
|
1234
|
+
|
|
1235
|
+
@firebase/firestore/dist/index.esm.js:
|
|
1236
|
+
(**
|
|
1237
|
+
* @license
|
|
1238
|
+
* Copyright 2021 Google LLC
|
|
1239
|
+
*
|
|
1240
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1241
|
+
* you may not use this file except in compliance with the License.
|
|
1242
|
+
* You may obtain a copy of the License at
|
|
1243
|
+
*
|
|
1244
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1245
|
+
*
|
|
1246
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1247
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1248
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1249
|
+
* See the License for the specific language governing permissions and
|
|
1250
|
+
* limitations under the License.
|
|
1251
|
+
*)
|
|
1252
|
+
|
|
1253
|
+
@firebase/firestore/dist/index.esm.js:
|
|
1254
|
+
@firebase/firestore/dist/index.esm.js:
|
|
1255
|
+
(**
|
|
1256
|
+
* @license
|
|
1257
|
+
* Copyright 2023 Google LLC
|
|
1258
|
+
*
|
|
1259
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1260
|
+
* you may not use this file except in compliance with the License.
|
|
1261
|
+
* You may obtain a copy of the License at
|
|
1262
|
+
*
|
|
1263
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1264
|
+
*
|
|
1265
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1266
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1267
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1268
|
+
* See the License for the specific language governing permissions and
|
|
1269
|
+
* limitations under the License.
|
|
1270
|
+
*)
|
|
1271
|
+
*/
|