@iebh/tera-fy 2.0.7 → 2.0.8
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 +16 -0
- package/dist/plugin.vue2.es2019.js +77 -1938
- package/lib/syncro/entities.js +25 -31
- package/lib/syncro/keyed.js +4 -3
- package/lib/syncro/syncro.js +63 -11
- package/package.json +3 -3
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
var Vv=Object.create;var ds=Object.defineProperty;var Lv=Object.getOwnPropertyDescriptor;var Mv=Object.getOwnPropertyNames;var Fv=Object.getPrototypeOf,jv=Object.prototype.hasOwnProperty;var Uv=(r,e,t)=>e in r?ds(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Bv=(r,e)=>()=>(r&&(e=r(r=0)),e);var Je=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),$v=(r,e)=>{for(var t in e)ds(r,t,{get:e[t],enumerable:!0})},Id=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Mv(e))!jv.call(r,s)&&s!==t&&ds(r,s,{get:()=>e[s],enumerable:!(n=Lv(e,s))||n.enumerable});return r};var xd=(r,e,t)=>(t=r!=null?Vv(Fv(r)):{},Id(e||!r||!r.__esModule?ds(t,"default",{value:r,enumerable:!0}):t,r)),qv=r=>Id(ds({},"__esModule",{value:!0}),r);var ge=(r,e,t)=>Uv(r,typeof e!="symbol"?e+"":e,t);var Er={};$v(Er,{Headers:()=>Ql,Request:()=>CR,Response:()=>kR,default:()=>Wl,fetch:()=>PR});var RR,Vn,PR,Wl,Ql,CR,kR,rr=Bv(()=>{"use strict";RR=function(){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")},Vn=RR(),PR=Vn.fetch,Wl=Vn.fetch.bind(Vn),Ql=Vn.Headers,CR=Vn.Request,kR=Vn.Response});var Xl=Je(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});var Jl=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Yl.default=Jl});var eh=Je(Hs=>{"use strict";var $y=Hs&&Hs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Hs,"__esModule",{value:!0});var OR=$y((rr(),qv(Er))),NR=$y(Xl()),Zl=class{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:typeof fetch=="undefined"?this.fetch=OR.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Object.assign({},this.headers),this.headers[e]=t,this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["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=>{var a,u,c;let h=null,f=null,m=null,g=i.status,E=i.statusText;if(i.ok){if(this.method!=="HEAD"){let N=await i.text();N===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?f=N:f=JSON.parse(N))}let C=(a=this.headers.Prefer)===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),R=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");C&&R&&R.length>1&&(m=parseInt(R[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(f)&&(f.length>1?(h={code:"PGRST116",details:`Results contain ${f.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},f=null,m=null,g=406,E="Not Acceptable"):f.length===1?f=f[0]:f=null)}else{let C=await i.text();try{h=JSON.parse(C),Array.isArray(h)&&i.status===404&&(f=[],h=null,g=200,E="OK")}catch{i.status===404&&C===""?(g=204,E="No Content"):h={message:C}}if(h&&this.isMaybeSingle&&(!((c=h==null?void 0:h.details)===null||c===void 0)&&c.includes("0 rows"))&&(h=null,g=200,E="OK"),h&&this.shouldThrowOnError)throw new NR.default(h)}return{error:h,data:f,count:m,status:g,statusText:E}});return this.shouldThrowOnError||(s=s.catch(i=>{var a,u,c;return{error:{message:`${(a=i==null?void 0:i.name)!==null&&a!==void 0?a:"FetchError"}: ${i==null?void 0:i.message}`,details:`${(u=i==null?void 0:i.stack)!==null&&u!==void 0?u:""}`,hint:"",code:`${(c=i==null?void 0:i.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),s.then(e,t)}};Hs.default=Zl});var rh=Je(Ws=>{"use strict";var VR=Ws&&Ws.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ws,"__esModule",{value:!0});var LR=VR(eh()),th=class extends LR.default{select(e){let t=!1,n=(e!=null?e:"*").split("").map(s=>/\s/.test(s)&&!t?"":(s==='"'&&(t=!t),s)).join("");return this.url.searchParams.set("select",n),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:s,referencedTable:i=s}={}){let a=i?`${i}.order`:"order",u=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${u?`${u},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){let s=typeof n=="undefined"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:s=n}={}){let i=typeof s=="undefined"?"offset":`${s}.offset`,a=typeof s=="undefined"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(a,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:s=!1,wal:i=!1,format:a="text"}={}){var u;let c=[e?"analyze":null,t?"verbose":null,n?"settings":null,s?"buffers":null,i?"wal":null].filter(Boolean).join("|"),h=(u=this.headers.Accept)!==null&&u!==void 0?u:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${a}; for="${h}"; options=${c};`,a==="json"?this:this}rollback(){var e;return((e=this.headers.Prefer)!==null&&e!==void 0?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}};Ws.default=th});var ga=Je(Qs=>{"use strict";var MR=Qs&&Qs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Qs,"__esModule",{value:!0});var FR=MR(rh()),nh=class extends FR.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let n=Array.from(new Set(t)).map(s=>typeof s=="string"&&new RegExp("[,()]").test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:s}={}){let i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");let a=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${a}.${t}`),this}match(e){return Object.entries(e).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){let s=n?`${n}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}};Qs.default=nh});var ih=Je(Ys=>{"use strict";var jR=Ys&&Ys.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ys,"__esModule",{value:!0});var Js=jR(ga()),sh=class{constructor(e,{headers:t={},schema:n,fetch:s}){this.url=e,this.headers=t,this.schema=n,this.fetch=s}select(e,{head:t=!1,count:n}={}){let s=t?"HEAD":"GET",i=!1,a=(e!=null?e:"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join("");return this.url.searchParams.set("select",a),n&&(this.headers.Prefer=`count=${n}`),new Js.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:n=!0}={}){let s="POST",i=[];if(this.headers.Prefer&&i.push(this.headers.Prefer),t&&i.push(`count=${t}`),n||i.push("missing=default"),this.headers.Prefer=i.join(","),Array.isArray(e)){let a=e.reduce((u,c)=>u.concat(Object.keys(c)),[]);if(a.length>0){let u=[...new Set(a)].map(c=>`"${c}"`);this.url.searchParams.set("columns",u.join(","))}}return new Js.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:s,defaultToNull:i=!0}={}){let a="POST",u=[`resolution=${n?"ignore":"merge"}-duplicates`];if(t!==void 0&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&u.push(this.headers.Prefer),s&&u.push(`count=${s}`),i||u.push("missing=default"),this.headers.Prefer=u.join(","),Array.isArray(e)){let c=e.reduce((h,f)=>h.concat(Object.keys(f)),[]);if(c.length>0){let h=[...new Set(c)].map(f=>`"${f}"`);this.url.searchParams.set("columns",h.join(","))}}return new Js.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){let n="PATCH",s=[];return this.headers.Prefer&&s.push(this.headers.Prefer),t&&s.push(`count=${t}`),this.headers.Prefer=s.join(","),new Js.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){let t="DELETE",n=[];return e&&n.push(`count=${e}`),this.headers.Prefer&&n.unshift(this.headers.Prefer),this.headers.Prefer=n.join(","),new Js.default({method:t,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}};Ys.default=sh});var qy=Je(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.version=void 0;ya.version="0.0.0-automated"});var zy=Je(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.DEFAULT_HEADERS=void 0;var UR=qy();_a.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${UR.version}`}});var Ky=Je(Xs=>{"use strict";var Gy=Xs&&Xs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Xs,"__esModule",{value:!0});var BR=Gy(ih()),$R=Gy(ga()),qR=zy(),oh=class r{constructor(e,{headers:t={},schema:n,fetch:s}={}){this.url=e,this.headers=Object.assign(Object.assign({},qR.DEFAULT_HEADERS),t),this.schemaName=n,this.fetch=s}from(e){let t=new URL(`${this.url}/${e}`);return new BR.default(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new r(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:n=!1,get:s=!1,count:i}={}){let a,u=new URL(`${this.url}/rpc/${e}`),c;n||s?(a=n?"HEAD":"GET",Object.entries(t).filter(([f,m])=>m!==void 0).map(([f,m])=>[f,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([f,m])=>{u.searchParams.append(f,m)})):(a="POST",c=t);let h=Object.assign({},this.headers);return i&&(h.Prefer=`count=${i}`),new $R.default({method:a,url:u,headers:h,schema:this.schemaName,body:c,fetch:this.fetch,allowEmpty:!1})}};Xs.default=oh});var Zy=Je(Te=>{"use strict";var Ln=Te&&Te.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Te,"__esModule",{value:!0});Te.PostgrestError=Te.PostgrestBuilder=Te.PostgrestTransformBuilder=Te.PostgrestFilterBuilder=Te.PostgrestQueryBuilder=Te.PostgrestClient=void 0;var Hy=Ln(Ky());Te.PostgrestClient=Hy.default;var Wy=Ln(ih());Te.PostgrestQueryBuilder=Wy.default;var Qy=Ln(ga());Te.PostgrestFilterBuilder=Qy.default;var Jy=Ln(rh());Te.PostgrestTransformBuilder=Jy.default;var Yy=Ln(eh());Te.PostgrestBuilder=Yy.default;var Xy=Ln(Xl());Te.PostgrestError=Xy.default;Te.default={PostgrestClient:Hy.default,PostgrestQueryBuilder:Wy.default,PostgrestFilterBuilder:Qy.default,PostgrestTransformBuilder:Jy.default,PostgrestBuilder:Yy.default,PostgrestError:Xy.default}});var u_=Je((e2,a_)=>{"use strict";a_.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var zv=typeof global=="object"&&global&&global.Object===Object&&global,Vi=zv;var Gv=typeof self=="object"&&self&&self.Object===Object&&self,Kv=Vi||Gv||Function("return this")(),ce=Kv;var Hv=ce.Symbol,De=Hv;var Ad=Object.prototype,Wv=Ad.hasOwnProperty,Qv=Ad.toString,fs=De?De.toStringTag:void 0;function Jv(r){var e=Wv.call(r,fs),t=r[fs];try{r[fs]=void 0;var n=!0}catch{}var s=Qv.call(r);return n&&(e?r[fs]=t:delete r[fs]),s}var Sd=Jv;var Yv=Object.prototype,Xv=Yv.toString;function Zv(r){return Xv.call(r)}var Rd=Zv;var ew="[object Null]",tw="[object Undefined]",Pd=De?De.toStringTag:void 0;function rw(r){return r==null?r===void 0?tw:ew:Pd&&Pd in Object(r)?Sd(r):Rd(r)}var Ke=rw;function nw(r){return r!=null&&typeof r=="object"}var Oe=nw;var sw="[object Symbol]";function iw(r){return typeof r=="symbol"||Oe(r)&&Ke(r)==sw}var Vt=iw;function ow(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 Cd=ow;var aw=Array.isArray,he=aw;var uw=1/0,kd=De?De.prototype:void 0,Dd=kd?kd.toString:void 0;function Od(r){if(typeof r=="string")return r;if(he(r))return Cd(r,Od)+"";if(Vt(r))return Dd?Dd.call(r):"";var e=r+"";return e=="0"&&1/r==-uw?"-0":e}var Nd=Od;var cw=/\s/;function lw(r){for(var e=r.length;e--&&cw.test(r.charAt(e)););return e}var Vd=lw;var hw=/^\s+/;function dw(r){return r&&r.slice(0,Vd(r)+1).replace(hw,"")}var Ld=dw;function fw(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var Z=fw;var Md=NaN,pw=/^[-+]0x[0-9a-f]+$/i,mw=/^0b[01]+$/i,gw=/^0o[0-7]+$/i,yw=parseInt;function _w(r){if(typeof r=="number")return r;if(Vt(r))return Md;if(Z(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Z(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=Ld(r);var t=mw.test(r);return t||gw.test(r)?yw(r.slice(2),t?2:8):pw.test(r)?Md:+r}var su=_w;function vw(r){return r}var Br=vw;var ww="[object AsyncFunction]",bw="[object Function]",Tw="[object GeneratorFunction]",Ew="[object Proxy]";function Iw(r){if(!Z(r))return!1;var e=Ke(r);return e==bw||e==Tw||e==ww||e==Ew}var Li=Iw;var xw=ce["__core-js_shared__"],Mi=xw;var Fd=function(){var r=/[^.]+$/.exec(Mi&&Mi.keys&&Mi.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function Aw(r){return!!Fd&&Fd in r}var jd=Aw;var Sw=Function.prototype,Rw=Sw.toString;function Pw(r){if(r!=null){try{return Rw.call(r)}catch{}try{return r+""}catch{}}return""}var pt=Pw;var Cw=/[\\^$.*+?()[\]{}|]/g,kw=/^\[object .+?Constructor\]$/,Dw=Function.prototype,Ow=Object.prototype,Nw=Dw.toString,Vw=Ow.hasOwnProperty,Lw=RegExp("^"+Nw.call(Vw).replace(Cw,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Mw(r){if(!Z(r)||jd(r))return!1;var e=Li(r)?Lw:kw;return e.test(pt(r))}var Ud=Mw;function Fw(r,e){return r==null?void 0:r[e]}var Bd=Fw;function jw(r,e){var t=Bd(r,e);return Ud(t)?t:void 0}var Ne=jw;var Uw=Ne(ce,"WeakMap"),Fi=Uw;var $d=Object.create,Bw=function(){function r(){}return function(e){if(!Z(e))return{};if($d)return $d(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}}(),qd=Bw;function $w(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 zd=$w;function qw(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}var Gd=qw;var zw=800,Gw=16,Kw=Date.now;function Hw(r){var e=0,t=0;return function(){var n=Kw(),s=Gw-(n-t);if(t=n,s>0){if(++e>=zw)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var Kd=Hw;function Ww(r){return function(){return r}}var Hd=Ww;var Qw=function(){try{var r=Ne(Object,"defineProperty");return r({},"",{}),r}catch{}}(),$r=Qw;var Jw=$r?function(r,e){return $r(r,"toString",{configurable:!0,enumerable:!1,value:Hd(e),writable:!0})}:Br,Wd=Jw;var Yw=Kd(Wd),Qd=Yw;function Xw(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var Jd=Xw;var Zw=9007199254740991,eb=/^(?:0|[1-9]\d*)$/;function tb(r,e){var t=typeof r;return e=e==null?Zw:e,!!e&&(t=="number"||t!="symbol"&&eb.test(r))&&r>-1&&r%1==0&&r<e}var Lt=tb;function rb(r,e,t){e=="__proto__"&&$r?$r(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var qr=rb;function nb(r,e){return r===e||r!==r&&e!==e}var Ye=nb;var sb=Object.prototype,ib=sb.hasOwnProperty;function ob(r,e,t){var n=r[e];(!(ib.call(r,e)&&Ye(n,t))||t===void 0&&!(e in r))&&qr(r,e,t)}var zr=ob;function ab(r,e,t,n){var s=!t;t||(t={});for(var i=-1,a=e.length;++i<a;){var u=e[i],c=n?n(t[u],r[u],u,t,r):void 0;c===void 0&&(c=r[u]),s?qr(t,u,c):zr(t,u,c)}return t}var Mt=ab;var Yd=Math.max;function ub(r,e,t){return e=Yd(e===void 0?r.length-1:e,0),function(){for(var n=arguments,s=-1,i=Yd(n.length-e,0),a=Array(i);++s<i;)a[s]=n[e+s];s=-1;for(var u=Array(e+1);++s<e;)u[s]=n[s];return u[e]=t(a),zd(r,this,u)}}var Xd=ub;function cb(r,e){return Qd(Xd(r,e,Br),r+"")}var Zd=cb;var lb=9007199254740991;function hb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=lb}var Gr=hb;function db(r){return r!=null&&Gr(r.length)&&!Li(r)}var Ft=db;function fb(r,e,t){if(!Z(t))return!1;var n=typeof e;return(n=="number"?Ft(t)&&Lt(e,t.length):n=="string"&&e in t)?Ye(t[e],r):!1}var ef=fb;var pb=Object.prototype;function mb(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||pb;return r===t}var jt=mb;function gb(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var tf=gb;var yb="[object Arguments]";function _b(r){return Oe(r)&&Ke(r)==yb}var iu=_b;var rf=Object.prototype,vb=rf.hasOwnProperty,wb=rf.propertyIsEnumerable,bb=iu(function(){return arguments}())?iu:function(r){return Oe(r)&&vb.call(r,"callee")&&!wb.call(r,"callee")},Kr=bb;function Tb(){return!1}var nf=Tb;var af=typeof exports=="object"&&exports&&!exports.nodeType&&exports,sf=af&&typeof module=="object"&&module&&!module.nodeType&&module,Eb=sf&&sf.exports===af,of=Eb?ce.Buffer:void 0,Ib=of?of.isBuffer:void 0,xb=Ib||nf,mt=xb;var Ab="[object Arguments]",Sb="[object Array]",Rb="[object Boolean]",Pb="[object Date]",Cb="[object Error]",kb="[object Function]",Db="[object Map]",Ob="[object Number]",Nb="[object Object]",Vb="[object RegExp]",Lb="[object Set]",Mb="[object String]",Fb="[object WeakMap]",jb="[object ArrayBuffer]",Ub="[object DataView]",Bb="[object Float32Array]",$b="[object Float64Array]",qb="[object Int8Array]",zb="[object Int16Array]",Gb="[object Int32Array]",Kb="[object Uint8Array]",Hb="[object Uint8ClampedArray]",Wb="[object Uint16Array]",Qb="[object Uint32Array]",ie={};ie[Bb]=ie[$b]=ie[qb]=ie[zb]=ie[Gb]=ie[Kb]=ie[Hb]=ie[Wb]=ie[Qb]=!0;ie[Ab]=ie[Sb]=ie[jb]=ie[Rb]=ie[Ub]=ie[Pb]=ie[Cb]=ie[kb]=ie[Db]=ie[Ob]=ie[Nb]=ie[Vb]=ie[Lb]=ie[Mb]=ie[Fb]=!1;function Jb(r){return Oe(r)&&Gr(r.length)&&!!ie[Ke(r)]}var uf=Jb;function Yb(r){return function(e){return r(e)}}var Hr=Yb;var cf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ps=cf&&typeof module=="object"&&module&&!module.nodeType&&module,Xb=ps&&ps.exports===cf,ou=Xb&&Vi.process,Zb=function(){try{var r=ps&&ps.require&&ps.require("util").types;return r||ou&&ou.binding&&ou.binding("util")}catch{}}(),gt=Zb;var lf=gt&>.isTypedArray,eT=lf?Hr(lf):uf,Wr=eT;var tT=Object.prototype,rT=tT.hasOwnProperty;function nT(r,e){var t=he(r),n=!t&&Kr(r),s=!t&&!n&&mt(r),i=!t&&!n&&!s&&Wr(r),a=t||n||s||i,u=a?tf(r.length,String):[],c=u.length;for(var h in r)(e||rT.call(r,h))&&!(a&&(h=="length"||s&&(h=="offset"||h=="parent")||i&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Lt(h,c)))&&u.push(h);return u}var ji=nT;function sT(r,e){return function(t){return r(e(t))}}var Ui=sT;var iT=Ui(Object.keys,Object),hf=iT;var oT=Object.prototype,aT=oT.hasOwnProperty;function uT(r){if(!jt(r))return hf(r);var e=[];for(var t in Object(r))aT.call(r,t)&&t!="constructor"&&e.push(t);return e}var Bi=uT;function cT(r){return Ft(r)?ji(r):Bi(r)}var Se=cT;function lT(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var df=lT;var hT=Object.prototype,dT=hT.hasOwnProperty;function fT(r){if(!Z(r))return df(r);var e=jt(r),t=[];for(var n in r)n=="constructor"&&(e||!dT.call(r,n))||t.push(n);return t}var ff=fT;function pT(r){return Ft(r)?ji(r,!0):ff(r)}var Ut=pT;var mT=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gT=/^\w*$/;function yT(r,e){if(he(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||Vt(r)?!0:gT.test(r)||!mT.test(r)||e!=null&&r in Object(e)}var Qr=yT;var _T=Ne(Object,"create"),yt=_T;function vT(){this.__data__=yt?yt(null):{},this.size=0}var pf=vT;function wT(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var mf=wT;var bT="__lodash_hash_undefined__",TT=Object.prototype,ET=TT.hasOwnProperty;function IT(r){var e=this.__data__;if(yt){var t=e[r];return t===bT?void 0:t}return ET.call(e,r)?e[r]:void 0}var gf=IT;var xT=Object.prototype,AT=xT.hasOwnProperty;function ST(r){var e=this.__data__;return yt?e[r]!==void 0:AT.call(e,r)}var yf=ST;var RT="__lodash_hash_undefined__";function PT(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=yt&&e===void 0?RT:e,this}var _f=PT;function Jr(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])}}Jr.prototype.clear=pf;Jr.prototype.delete=mf;Jr.prototype.get=gf;Jr.prototype.has=yf;Jr.prototype.set=_f;var au=Jr;function CT(){this.__data__=[],this.size=0}var vf=CT;function kT(r,e){for(var t=r.length;t--;)if(Ye(r[t][0],e))return t;return-1}var Bt=kT;var DT=Array.prototype,OT=DT.splice;function NT(r){var e=this.__data__,t=Bt(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():OT.call(e,t,1),--this.size,!0}var wf=NT;function VT(r){var e=this.__data__,t=Bt(e,r);return t<0?void 0:e[t][1]}var bf=VT;function LT(r){return Bt(this.__data__,r)>-1}var Tf=LT;function MT(r,e){var t=this.__data__,n=Bt(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var Ef=MT;function Yr(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])}}Yr.prototype.clear=vf;Yr.prototype.delete=wf;Yr.prototype.get=bf;Yr.prototype.has=Tf;Yr.prototype.set=Ef;var $t=Yr;var FT=Ne(ce,"Map"),qt=FT;function jT(){this.size=0,this.__data__={hash:new au,map:new(qt||$t),string:new au}}var If=jT;function UT(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var xf=UT;function BT(r,e){var t=r.__data__;return xf(e)?t[typeof e=="string"?"string":"hash"]:t.map}var zt=BT;function $T(r){var e=zt(this,r).delete(r);return this.size-=e?1:0,e}var Af=$T;function qT(r){return zt(this,r).get(r)}var Sf=qT;function zT(r){return zt(this,r).has(r)}var Rf=zT;function GT(r,e){var t=zt(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var Pf=GT;function Xr(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])}}Xr.prototype.clear=If;Xr.prototype.delete=Af;Xr.prototype.get=Sf;Xr.prototype.has=Rf;Xr.prototype.set=Pf;var lr=Xr;var KT="Expected a function";function uu(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(KT);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 a=r.apply(this,n);return t.cache=i.set(s,a)||i,a};return t.cache=new(uu.Cache||lr),t}uu.Cache=lr;var Cf=uu;var HT=500;function WT(r){var e=Cf(r,function(n){return t.size===HT&&t.clear(),n}),t=e.cache;return e}var kf=WT;var QT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,JT=/\\(\\)?/g,YT=kf(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(QT,function(t,n,s,i){e.push(s?i.replace(JT,"$1"):n||t)}),e}),Df=YT;function XT(r){return r==null?"":Nd(r)}var Of=XT;function ZT(r,e){return he(r)?r:Qr(r,e)?[r]:Df(Of(r))}var Zr=ZT;var e0=1/0;function t0(r){if(typeof r=="string"||Vt(r))return r;var e=r+"";return e=="0"&&1/r==-e0?"-0":e}var Xe=t0;function r0(r,e){e=Zr(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[Xe(e[t++])];return t&&t==n?r:void 0}var $i=r0;function n0(r,e,t){var n=r==null?void 0:$i(r,e);return n===void 0?t:n}var ms=n0;function s0(r,e){for(var t=-1,n=e.length,s=r.length;++t<n;)r[s+t]=e[t];return r}var qi=s0;var i0=Ui(Object.getPrototypeOf,Object),zi=i0;function o0(){this.__data__=new $t,this.size=0}var Nf=o0;function a0(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var Vf=a0;function u0(r){return this.__data__.get(r)}var Lf=u0;function c0(r){return this.__data__.has(r)}var Mf=c0;var l0=200;function h0(r,e){var t=this.__data__;if(t instanceof $t){var n=t.__data__;if(!qt||n.length<l0-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new lr(n)}return t.set(r,e),this.size=t.size,this}var Ff=h0;function en(r){var e=this.__data__=new $t(r);this.size=e.size}en.prototype.clear=Nf;en.prototype.delete=Vf;en.prototype.get=Lf;en.prototype.has=Mf;en.prototype.set=Ff;var Gt=en;function d0(r,e){return r&&Mt(e,Se(e),r)}var jf=d0;function f0(r,e){return r&&Mt(e,Ut(e),r)}var Uf=f0;var zf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Bf=zf&&typeof module=="object"&&module&&!module.nodeType&&module,p0=Bf&&Bf.exports===zf,$f=p0?ce.Buffer:void 0,qf=$f?$f.allocUnsafe:void 0;function m0(r,e){if(e)return r.slice();var t=r.length,n=qf?qf(t):new r.constructor(t);return r.copy(n),n}var Gf=m0;function g0(r,e){for(var t=-1,n=r==null?0:r.length,s=0,i=[];++t<n;){var a=r[t];e(a,t,r)&&(i[s++]=a)}return i}var Kf=g0;function y0(){return[]}var Gi=y0;var _0=Object.prototype,v0=_0.propertyIsEnumerable,Hf=Object.getOwnPropertySymbols,w0=Hf?function(r){return r==null?[]:(r=Object(r),Kf(Hf(r),function(e){return v0.call(r,e)}))}:Gi,tn=w0;function b0(r,e){return Mt(r,tn(r),e)}var Wf=b0;var T0=Object.getOwnPropertySymbols,E0=T0?function(r){for(var e=[];r;)qi(e,tn(r)),r=zi(r);return e}:Gi,Ki=E0;function I0(r,e){return Mt(r,Ki(r),e)}var Qf=I0;function x0(r,e,t){var n=e(r);return he(r)?n:qi(n,t(r))}var Hi=x0;function A0(r){return Hi(r,Se,tn)}var gs=A0;function S0(r){return Hi(r,Ut,Ki)}var Jf=S0;var R0=Ne(ce,"DataView"),Wi=R0;var P0=Ne(ce,"Promise"),Qi=P0;var C0=Ne(ce,"Set"),Ji=C0;var Yf="[object Map]",k0="[object Object]",Xf="[object Promise]",Zf="[object Set]",ep="[object WeakMap]",tp="[object DataView]",D0=pt(Wi),O0=pt(qt),N0=pt(Qi),V0=pt(Ji),L0=pt(Fi),hr=Ke;(Wi&&hr(new Wi(new ArrayBuffer(1)))!=tp||qt&&hr(new qt)!=Yf||Qi&&hr(Qi.resolve())!=Xf||Ji&&hr(new Ji)!=Zf||Fi&&hr(new Fi)!=ep)&&(hr=function(r){var e=Ke(r),t=e==k0?r.constructor:void 0,n=t?pt(t):"";if(n)switch(n){case D0:return tp;case O0:return Yf;case N0:return Xf;case V0:return Zf;case L0:return ep}return e});var He=hr;var M0=Object.prototype,F0=M0.hasOwnProperty;function j0(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&F0.call(r,"index")&&(t.index=r.index,t.input=r.input),t}var rp=j0;var U0=ce.Uint8Array,rn=U0;function B0(r){var e=new r.constructor(r.byteLength);return new rn(e).set(new rn(r)),e}var nn=B0;function $0(r,e){var t=e?nn(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}var np=$0;var q0=/\w*$/;function z0(r){var e=new r.constructor(r.source,q0.exec(r));return e.lastIndex=r.lastIndex,e}var sp=z0;var ip=De?De.prototype:void 0,op=ip?ip.valueOf:void 0;function G0(r){return op?Object(op.call(r)):{}}var ap=G0;function K0(r,e){var t=e?nn(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}var up=K0;var H0="[object Boolean]",W0="[object Date]",Q0="[object Map]",J0="[object Number]",Y0="[object RegExp]",X0="[object Set]",Z0="[object String]",eE="[object Symbol]",tE="[object ArrayBuffer]",rE="[object DataView]",nE="[object Float32Array]",sE="[object Float64Array]",iE="[object Int8Array]",oE="[object Int16Array]",aE="[object Int32Array]",uE="[object Uint8Array]",cE="[object Uint8ClampedArray]",lE="[object Uint16Array]",hE="[object Uint32Array]";function dE(r,e,t){var n=r.constructor;switch(e){case tE:return nn(r);case H0:case W0:return new n(+r);case rE:return np(r,t);case nE:case sE:case iE:case oE:case aE:case uE:case cE:case lE:case hE:return up(r,t);case Q0:return new n;case J0:case Z0:return new n(r);case Y0:return sp(r);case X0:return new n;case eE:return ap(r)}}var cp=dE;function fE(r){return typeof r.constructor=="function"&&!jt(r)?qd(zi(r)):{}}var lp=fE;var pE="[object Map]";function mE(r){return Oe(r)&&He(r)==pE}var hp=mE;var dp=gt&>.isMap,gE=dp?Hr(dp):hp,fp=gE;var yE="[object Set]";function _E(r){return Oe(r)&&He(r)==yE}var pp=_E;var mp=gt&>.isSet,vE=mp?Hr(mp):pp,gp=vE;var wE=1,bE=2,TE=4,yp="[object Arguments]",EE="[object Array]",IE="[object Boolean]",xE="[object Date]",AE="[object Error]",_p="[object Function]",SE="[object GeneratorFunction]",RE="[object Map]",PE="[object Number]",vp="[object Object]",CE="[object RegExp]",kE="[object Set]",DE="[object String]",OE="[object Symbol]",NE="[object WeakMap]",VE="[object ArrayBuffer]",LE="[object DataView]",ME="[object Float32Array]",FE="[object Float64Array]",jE="[object Int8Array]",UE="[object Int16Array]",BE="[object Int32Array]",$E="[object Uint8Array]",qE="[object Uint8ClampedArray]",zE="[object Uint16Array]",GE="[object Uint32Array]",re={};re[yp]=re[EE]=re[VE]=re[LE]=re[IE]=re[xE]=re[ME]=re[FE]=re[jE]=re[UE]=re[BE]=re[RE]=re[PE]=re[vp]=re[CE]=re[kE]=re[DE]=re[OE]=re[$E]=re[qE]=re[zE]=re[GE]=!0;re[AE]=re[_p]=re[NE]=!1;function Yi(r,e,t,n,s,i){var a,u=e&wE,c=e&bE,h=e&TE;if(t&&(a=s?t(r,n,s,i):t(r)),a!==void 0)return a;if(!Z(r))return r;var f=he(r);if(f){if(a=rp(r),!u)return Gd(r,a)}else{var m=He(r),g=m==_p||m==SE;if(mt(r))return Gf(r,u);if(m==vp||m==yp||g&&!s){if(a=c||g?{}:lp(r),!u)return c?Qf(r,Uf(a,r)):Wf(r,jf(a,r))}else{if(!re[m])return s?r:{};a=cp(r,m,u)}}i||(i=new Gt);var E=i.get(r);if(E)return E;i.set(r,a),gp(r)?r.forEach(function(R){a.add(Yi(R,e,t,R,r,i))}):fp(r)&&r.forEach(function(R,N){a.set(N,Yi(R,e,t,N,r,i))});var P=h?c?Jf:gs:c?Ut:Se,C=f?void 0:P(r);return Jd(C||r,function(R,N){C&&(N=R,R=r[N]),zr(a,N,Yi(R,e,t,N,r,i))}),a}var wp=Yi;var KE=1,HE=4;function WE(r){return wp(r,KE|HE)}var Kt=WE;var QE="__lodash_hash_undefined__";function JE(r){return this.__data__.set(r,QE),this}var bp=JE;function YE(r){return this.__data__.has(r)}var Tp=YE;function Xi(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new lr;++e<t;)this.add(r[e])}Xi.prototype.add=Xi.prototype.push=bp;Xi.prototype.has=Tp;var Ep=Xi;function XE(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 Ip=XE;function ZE(r,e){return r.has(e)}var xp=ZE;var eI=1,tI=2;function rI(r,e,t,n,s,i){var a=t&eI,u=r.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var h=i.get(r),f=i.get(e);if(h&&f)return h==e&&f==r;var m=-1,g=!0,E=t&tI?new Ep:void 0;for(i.set(r,e),i.set(e,r);++m<u;){var P=r[m],C=e[m];if(n)var R=a?n(C,P,m,e,r,i):n(P,C,m,r,e,i);if(R!==void 0){if(R)continue;g=!1;break}if(E){if(!Ip(e,function(N,M){if(!xp(E,M)&&(P===N||s(P,N,t,n,i)))return E.push(M)})){g=!1;break}}else if(!(P===C||s(P,C,t,n,i))){g=!1;break}}return i.delete(r),i.delete(e),g}var Zi=rI;function nI(r){var e=-1,t=Array(r.size);return r.forEach(function(n,s){t[++e]=[s,n]}),t}var Ap=nI;function sI(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var Sp=sI;var iI=1,oI=2,aI="[object Boolean]",uI="[object Date]",cI="[object Error]",lI="[object Map]",hI="[object Number]",dI="[object RegExp]",fI="[object Set]",pI="[object String]",mI="[object Symbol]",gI="[object ArrayBuffer]",yI="[object DataView]",Rp=De?De.prototype:void 0,cu=Rp?Rp.valueOf:void 0;function _I(r,e,t,n,s,i,a){switch(t){case yI:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case gI:return!(r.byteLength!=e.byteLength||!i(new rn(r),new rn(e)));case aI:case uI:case hI:return Ye(+r,+e);case cI:return r.name==e.name&&r.message==e.message;case dI:case pI:return r==e+"";case lI:var u=Ap;case fI:var c=n&iI;if(u||(u=Sp),r.size!=e.size&&!c)return!1;var h=a.get(r);if(h)return h==e;n|=oI,a.set(r,e);var f=Zi(u(r),u(e),n,s,i,a);return a.delete(r),f;case mI:if(cu)return cu.call(r)==cu.call(e)}return!1}var Pp=_I;var vI=1,wI=Object.prototype,bI=wI.hasOwnProperty;function TI(r,e,t,n,s,i){var a=t&vI,u=gs(r),c=u.length,h=gs(e),f=h.length;if(c!=f&&!a)return!1;for(var m=c;m--;){var g=u[m];if(!(a?g in e:bI.call(e,g)))return!1}var E=i.get(r),P=i.get(e);if(E&&P)return E==e&&P==r;var C=!0;i.set(r,e),i.set(e,r);for(var R=a;++m<c;){g=u[m];var N=r[g],M=e[g];if(n)var U=a?n(M,N,g,e,r,i):n(N,M,g,r,e,i);if(!(U===void 0?N===M||s(N,M,t,n,i):U)){C=!1;break}R||(R=g=="constructor")}if(C&&!R){var G=r.constructor,Y=e.constructor;G!=Y&&"constructor"in r&&"constructor"in e&&!(typeof G=="function"&&G instanceof G&&typeof Y=="function"&&Y instanceof Y)&&(C=!1)}return i.delete(r),i.delete(e),C}var Cp=TI;var EI=1,kp="[object Arguments]",Dp="[object Array]",eo="[object Object]",II=Object.prototype,Op=II.hasOwnProperty;function xI(r,e,t,n,s,i){var a=he(r),u=he(e),c=a?Dp:He(r),h=u?Dp:He(e);c=c==kp?eo:c,h=h==kp?eo:h;var f=c==eo,m=h==eo,g=c==h;if(g&&mt(r)){if(!mt(e))return!1;a=!0,f=!1}if(g&&!f)return i||(i=new Gt),a||Wr(r)?Zi(r,e,t,n,s,i):Pp(r,e,c,t,n,s,i);if(!(t&EI)){var E=f&&Op.call(r,"__wrapped__"),P=m&&Op.call(e,"__wrapped__");if(E||P){var C=E?r.value():r,R=P?e.value():e;return i||(i=new Gt),s(C,R,t,n,i)}}return g?(i||(i=new Gt),Cp(r,e,t,n,s,i)):!1}var Np=xI;function Vp(r,e,t,n,s){return r===e?!0:r==null||e==null||!Oe(r)&&!Oe(e)?r!==r&&e!==e:Np(r,e,t,n,Vp,s)}var sn=Vp;var AI=1,SI=2;function RI(r,e,t,n){var s=t.length,i=s,a=!n;if(r==null)return!i;for(r=Object(r);s--;){var u=t[s];if(a&&u[2]?u[1]!==r[u[0]]:!(u[0]in r))return!1}for(;++s<i;){u=t[s];var c=u[0],h=r[c],f=u[1];if(a&&u[2]){if(h===void 0&&!(c in r))return!1}else{var m=new Gt;if(n)var g=n(h,f,c,r,e,m);if(!(g===void 0?sn(f,h,AI|SI,n,m):g))return!1}}return!0}var Lp=RI;function PI(r){return r===r&&!Z(r)}var to=PI;function CI(r){for(var e=Se(r),t=e.length;t--;){var n=e[t],s=r[n];e[t]=[n,s,to(s)]}return e}var Mp=CI;function kI(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var ro=kI;function DI(r){var e=Mp(r);return e.length==1&&e[0][2]?ro(e[0][0],e[0][1]):function(t){return t===r||Lp(t,r,e)}}var Fp=DI;function OI(r,e){return r!=null&&e in Object(r)}var jp=OI;function NI(r,e,t){e=Zr(e,r);for(var n=-1,s=e.length,i=!1;++n<s;){var a=Xe(e[n]);if(!(i=r!=null&&t(r,a)))break;r=r[a]}return i||++n!=s?i:(s=r==null?0:r.length,!!s&&Gr(s)&&Lt(a,s)&&(he(r)||Kr(r)))}var Up=NI;function VI(r,e){return r!=null&&Up(r,e,jp)}var Bp=VI;var LI=1,MI=2;function FI(r,e){return Qr(r)&&to(e)?ro(Xe(r),e):function(t){var n=ms(t,r);return n===void 0&&n===e?Bp(t,r):sn(e,n,LI|MI)}}var $p=FI;function jI(r){return function(e){return e==null?void 0:e[r]}}var qp=jI;function UI(r){return function(e){return $i(e,r)}}var zp=UI;function BI(r){return Qr(r)?qp(Xe(r)):zp(r)}var Gp=BI;function $I(r){return typeof r=="function"?r:r==null?Br:typeof r=="object"?he(r)?$p(r[0],r[1]):Fp(r):Gp(r)}var Kp=$I;function qI(r){return function(e,t,n){for(var s=-1,i=Object(e),a=n(e),u=a.length;u--;){var c=a[r?u:++s];if(t(i[c],c,i)===!1)break}return e}}var Hp=qI;var zI=Hp(),Wp=zI;function GI(r,e){return r&&Wp(r,e,Se)}var Qp=GI;var KI=function(){return ce.Date.now()},no=KI;var HI="Expected a function",WI=Math.max,QI=Math.min;function JI(r,e,t){var n,s,i,a,u,c,h=0,f=!1,m=!1,g=!0;if(typeof r!="function")throw new TypeError(HI);e=su(e)||0,Z(t)&&(f=!!t.leading,m="maxWait"in t,i=m?WI(su(t.maxWait)||0,e):i,g="trailing"in t?!!t.trailing:g);function E(B){var T=n,y=s;return n=s=void 0,h=B,a=r.apply(y,T),a}function P(B){return h=B,u=setTimeout(N,e),f?E(B):a}function C(B){var T=B-c,y=B-h,w=e-T;return m?QI(w,i-y):w}function R(B){var T=B-c,y=B-h;return c===void 0||T>=e||T<0||m&&y>=i}function N(){var B=no();if(R(B))return M(B);u=setTimeout(N,C(B))}function M(B){return u=void 0,g&&n?E(B):(n=s=void 0,a)}function U(){u!==void 0&&clearTimeout(u),h=0,n=c=s=u=void 0}function G(){return u===void 0?a:M(no())}function Y(){var B=no(),T=R(B);if(n=arguments,s=this,c=B,T){if(u===void 0)return P(c);if(m)return clearTimeout(u),u=setTimeout(N,e),E(c)}return u===void 0&&(u=setTimeout(N,e)),a}return Y.cancel=U,Y.flush=G,Y}var Jp=JI;var Yp=Object.prototype,YI=Yp.hasOwnProperty,XI=Zd(function(r,e){r=Object(r);var t=-1,n=e.length,s=n>2?e[2]:void 0;for(s&&ef(e[0],e[1],s)&&(n=1);++t<n;)for(var i=e[t],a=Ut(i),u=-1,c=a.length;++u<c;){var h=a[u],f=r[h];(f===void 0||Ye(f,Yp[h])&&!YI.call(r,h))&&(r[h]=i[h])}return r}),so=XI;var ZI="[object Map]",ex="[object Set]",tx=Object.prototype,rx=tx.hasOwnProperty;function nx(r){if(r==null)return!0;if(Ft(r)&&(he(r)||typeof r=="string"||typeof r.splice=="function"||mt(r)||Wr(r)||Kr(r)))return!r.length;var e=He(r);if(e==ZI||e==ex)return!r.size;if(jt(r))return!Bi(r).length;for(var t in r)if(rx.call(r,t))return!1;return!0}var lu=nx;function sx(r,e){return sn(r,e)}var hu=sx;function ix(r,e){var t={};return e=Kp(e,3),Qp(r,function(n,s,i){qr(t,e(n,s,i),n)}),t}var du=ix;function ox(r,e,t,n){if(!Z(r))return r;e=Zr(e,r);for(var s=-1,i=e.length,a=i-1,u=r;u!=null&&++s<i;){var c=Xe(e[s]),h=t;if(c==="__proto__"||c==="constructor"||c==="prototype")return r;if(s!=a){var f=u[c];h=n?n(f,c,u):void 0,h===void 0&&(h=Z(f)?f:Lt(e[s+1])?[]:{})}zr(u,c,h),u=u[c]}return r}var Xp=ox;function ax(r,e,t){return r==null?r:Xp(r,e,t)}var Ht=ax;var ux="Expected a function";function cx(r,e,t){var n=!0,s=!0;if(typeof r!="function")throw new TypeError(ux);return Z(t)&&(n="leading"in t?!!t.leading:n,s="trailing"in t?!!t.trailing:s),Jp(r,e,{leading:n,maxWait:e,trailing:s})}var fu=cx;var em=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},lx=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++],a=r[t++],u=r[t++],c=((s&7)<<18|(i&63)<<12|(a&63)<<6|u&63)-65536;e[n++]=String.fromCharCode(55296+(c>>10)),e[n++]=String.fromCharCode(56320+(c&1023))}else{let i=r[t++],a=r[t++];e[n++]=String.fromCharCode((s&15)<<12|(i&63)<<6|a&63)}}return e.join("")},tm={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],a=s+1<r.length,u=a?r[s+1]:0,c=s+2<r.length,h=c?r[s+2]:0,f=i>>2,m=(i&3)<<4|u>>4,g=(u&15)<<2|h>>6,E=h&63;c||(E=64,a||(g=64)),n.push(t[f],t[m],t[g],t[E])}return n.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(em(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):lx(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 h=s<r.length?t[r.charAt(s)]:64;++s;let m=s<r.length?t[r.charAt(s)]:64;if(++s,i==null||u==null||h==null||m==null)throw new pu;let g=i<<2|u>>4;if(n.push(g),h!==64){let E=u<<4&240|h>>2;if(n.push(E),m!==64){let P=h<<6&192|m;n.push(P)}}}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)}}},pu=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},hx=function(r){let e=em(r);return tm.encodeByteArray(e,!0)},ys=function(r){return hx(r).replace(/\./g,"")},rm=function(r){try{return tm.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function dx(){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 fx=()=>dx().__FIREBASE_DEFAULTS__,px=()=>{if(typeof process=="undefined"||typeof process.env=="undefined")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},mx=()=>{if(typeof document=="undefined")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&rm(r[1]);return e&&JSON.parse(e)},mu=()=>{try{return fx()||px()||mx()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},gx=r=>{var e,t;return(t=(e=mu())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[r]},nm=r=>{let e=gx(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]},gu=()=>{var r;return(r=mu())===null||r===void 0?void 0:r.config};var io=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 sm(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 a=Object.assign({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[ys(JSON.stringify(t)),ys(JSON.stringify(a)),""].join(".")}function im(){return typeof navigator!="undefined"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function yx(){var r;let e=(r=mu())===null||r===void 0?void 0:r.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function om(){return!yx()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function yu(){try{return typeof indexedDB=="object"}catch{return!1}}function am(){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||i===void 0?void 0:i.message)||"")}}catch(t){e(t)}})}var _x="FirebaseError",_t=class r extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name=_x,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,_s.prototype.create)}},_s=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],a=i?vx(i,n):"Error",u=`${this.serviceName}: ${a} (${s}).`;return new _t(s,u,n)}};function vx(r,e){return r.replace(wx,(t,n)=>{let s=e[n];return s!=null?String(s):`<${n}?>`})}var wx=/\{\$([^}]+)}/g;function vs(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],a=e[s];if(Zp(i)&&Zp(a)){if(!vs(i,a))return!1}else if(i!==a)return!1}for(let s of n)if(!t.includes(s))return!1;return!0}function Zp(r){return r!==null&&typeof r=="object"}var DM=4*60*60*1e3;function vt(r){return r&&r._delegate?r._delegate:r}var wt=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 dr="[DEFAULT]";var _u=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 io;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 t;let n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),s=(t=e==null?void 0:e.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(s)return null;throw i}else{if(s)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(Tx(e))try{this.getOrInitializeService({instanceIdentifier:dr})}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=dr){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=dr){return this.instances.has(e)}getOptions(e=dr){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,a]of this.instancesDeferred.entries()){let u=this.normalizeInstanceIdentifier(i);n===u&&a.resolve(s)}return s}onInit(e,t){var n;let s=this.normalizeInstanceIdentifier(t),i=(n=this.onInitCallbacks.get(s))!==null&&n!==void 0?n:new Set;i.add(e),this.onInitCallbacks.set(s,i);let a=this.instances.get(s);return a&&e(a,s),()=>{i.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:bx(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=dr){return this.component?this.component.multipleInstances?e:dr:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function bx(r){return r===dr?void 0:r}function Tx(r){return r.instantiationMode==="EAGER"}var oo=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 _u(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}};var Ex=[],W;(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"})(W||(W={}));var Ix={debug:W.DEBUG,verbose:W.VERBOSE,info:W.INFO,warn:W.WARN,error:W.ERROR,silent:W.SILENT},xx=W.INFO,Ax={[W.DEBUG]:"log",[W.VERBOSE]:"log",[W.INFO]:"info",[W.WARN]:"warn",[W.ERROR]:"error"},Sx=(r,e,...t)=>{if(e<r.logLevel)return;let n=new Date().toISOString(),s=Ax[e];if(s)console[s](`[${n}] ${r.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},on=class{constructor(e){this.name=e,this._logLevel=xx,this._logHandler=Sx,this._userLogHandler=null,Ex.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in W))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Ix[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,W.DEBUG,...e),this._logHandler(this,W.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,W.VERBOSE,...e),this._logHandler(this,W.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,W.INFO,...e),this._logHandler(this,W.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,W.WARN,...e),this._logHandler(this,W.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,W.ERROR,...e),this._logHandler(this,W.ERROR,...e)}};var Rx=(r,e)=>e.some(t=>r instanceof t),um,cm;function Px(){return um||(um=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Cx(){return cm||(cm=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var lm=new WeakMap,wu=new WeakMap,hm=new WeakMap,vu=new WeakMap,Tu=new WeakMap;function kx(r){let e=new Promise((t,n)=>{let s=()=>{r.removeEventListener("success",i),r.removeEventListener("error",a)},i=()=>{t(Ze(r.result)),s()},a=()=>{n(r.error),s()};r.addEventListener("success",i),r.addEventListener("error",a)});return e.then(t=>{t instanceof IDBCursor&&lm.set(t,r)}).catch(()=>{}),Tu.set(e,r),e}function Dx(r){if(wu.has(r))return;let e=new Promise((t,n)=>{let s=()=>{r.removeEventListener("complete",i),r.removeEventListener("error",a),r.removeEventListener("abort",a)},i=()=>{t(),s()},a=()=>{n(r.error||new DOMException("AbortError","AbortError")),s()};r.addEventListener("complete",i),r.addEventListener("error",a),r.addEventListener("abort",a)});wu.set(r,e)}var bu={get(r,e,t){if(r instanceof IDBTransaction){if(e==="done")return wu.get(r);if(e==="objectStoreNames")return r.objectStoreNames||hm.get(r);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return Ze(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 dm(r){bu=r(bu)}function Ox(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let n=r.call(ao(this),e,...t);return hm.set(n,e.sort?e.sort():[e]),Ze(n)}:Cx().includes(r)?function(...e){return r.apply(ao(this),e),Ze(lm.get(this))}:function(...e){return Ze(r.apply(ao(this),e))}}function Nx(r){return typeof r=="function"?Ox(r):(r instanceof IDBTransaction&&Dx(r),Rx(r,Px())?new Proxy(r,bu):r)}function Ze(r){if(r instanceof IDBRequest)return kx(r);if(vu.has(r))return vu.get(r);let e=Nx(r);return e!==r&&(vu.set(r,e),Tu.set(e,r)),e}var ao=r=>Tu.get(r);function pm(r,e,{blocked:t,upgrade:n,blocking:s,terminated:i}={}){let a=indexedDB.open(r,e),u=Ze(a);return n&&a.addEventListener("upgradeneeded",c=>{n(Ze(a.result),c.oldVersion,c.newVersion,Ze(a.transaction),c)}),t&&a.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),u.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",h=>s(h.oldVersion,h.newVersion,h))}).catch(()=>{}),u}var Vx=["get","getKey","getAll","getAllKeys","count"],Lx=["put","add","delete","clear"],Eu=new Map;function fm(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(Eu.get(e))return Eu.get(e);let t=e.replace(/FromIndex$/,""),n=e!==t,s=Lx.includes(t);if(!(t in(n?IDBIndex:IDBObjectStore).prototype)||!(s||Vx.includes(t)))return;let i=async function(a,...u){let c=this.transaction(a,s?"readwrite":"readonly"),h=c.store;return n&&(h=h.index(u.shift())),(await Promise.all([h[t](...u),s&&c.done]))[0]};return Eu.set(e,i),i}dm(r=>({...r,get:(e,t,n)=>fm(e,t)||r.get(e,t,n),has:(e,t)=>!!fm(e,t)||r.has(e,t)}));var xu=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Mx(t)){let n=t.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(t=>t).join(" ")}};function Mx(r){let e=r.getComponent();return(e==null?void 0:e.type)==="VERSION"}var Au="@firebase/app",mm="0.11.1";var bt=new on("@firebase/app"),Fx="@firebase/app-compat",jx="@firebase/analytics-compat",Ux="@firebase/analytics",Bx="@firebase/app-check-compat",$x="@firebase/app-check",qx="@firebase/auth",zx="@firebase/auth-compat",Gx="@firebase/database",Kx="@firebase/data-connect",Hx="@firebase/database-compat",Wx="@firebase/functions",Qx="@firebase/functions-compat",Jx="@firebase/installations",Yx="@firebase/installations-compat",Xx="@firebase/messaging",Zx="@firebase/messaging-compat",eA="@firebase/performance",tA="@firebase/performance-compat",rA="@firebase/remote-config",nA="@firebase/remote-config-compat",sA="@firebase/storage",iA="@firebase/storage-compat",oA="@firebase/firestore",aA="@firebase/vertexai",uA="@firebase/firestore-compat",cA="firebase",lA="11.3.1";var Su="[DEFAULT]",hA={[Au]:"fire-core",[Fx]:"fire-core-compat",[Ux]:"fire-analytics",[jx]:"fire-analytics-compat",[$x]:"fire-app-check",[Bx]:"fire-app-check-compat",[qx]:"fire-auth",[zx]:"fire-auth-compat",[Gx]:"fire-rtdb",[Kx]:"fire-data-connect",[Hx]:"fire-rtdb-compat",[Wx]:"fire-fn",[Qx]:"fire-fn-compat",[Jx]:"fire-iid",[Yx]:"fire-iid-compat",[Xx]:"fire-fcm",[Zx]:"fire-fcm-compat",[eA]:"fire-perf",[tA]:"fire-perf-compat",[rA]:"fire-rc",[nA]:"fire-rc-compat",[sA]:"fire-gcs",[iA]:"fire-gcs-compat",[oA]:"fire-fst",[uA]:"fire-fst-compat",[aA]:"fire-vertex","fire-js":"fire-js",[cA]:"fire-js-all"};var uo=new Map,dA=new Map,Ru=new Map;function gm(r,e){try{r.container.addComponent(e)}catch(t){bt.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,t)}}function ws(r){let e=r.name;if(Ru.has(e))return bt.debug(`There were multiple attempts to register component ${e}.`),!1;Ru.set(e,r);for(let t of uo.values())gm(t,r);for(let t of dA.values())gm(t,r);return!0}function wm(r,e){let t=r.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),r.container.getProvider(e)}function bm(r){return r==null?!1:r.settings!==void 0}var fA={"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."},Wt=new _s("app","Firebase",fA);var Pu=class{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new wt("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 Wt.create("app-deleted",{appName:this._name})}};var Tm=lA;function Du(r,e={}){let t=r;typeof e!="object"&&(e={name:e});let n=Object.assign({name:Su,automaticDataCollectionEnabled:!1},e),s=n.name;if(typeof s!="string"||!s)throw Wt.create("bad-app-name",{appName:String(s)});if(t||(t=gu()),!t)throw Wt.create("no-options");let i=uo.get(s);if(i){if(vs(t,i.options)&&vs(n,i.config))return i;throw Wt.create("duplicate-app",{appName:s})}let a=new oo(s);for(let c of Ru.values())a.addComponent(c);let u=new Pu(t,n,a);return uo.set(s,u),u}function Em(r=Su){let e=uo.get(r);if(!e&&r===Su&&gu())return Du();if(!e)throw Wt.create("no-app",{appName:r});return e}function Qt(r,e,t){var n;let s=(n=hA[r])!==null&&n!==void 0?n:r;t&&(s+=`-${t}`);let i=s.match(/\s|\//),a=e.match(/\s|\//);if(i||a){let u=[`Unable to register library "${s}" with version "${e}":`];i&&u.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&a&&u.push("and"),a&&u.push(`version name "${e}" contains illegal characters (whitespace or "/")`),bt.warn(u.join(" "));return}ws(new wt(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}var pA="firebase-heartbeat-database",mA=1,bs="firebase-heartbeat-store",Iu=null;function Im(){return Iu||(Iu=pm(pA,mA,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(bs)}catch(t){console.warn(t)}}}}).catch(r=>{throw Wt.create("idb-open",{originalErrorMessage:r.message})})),Iu}async function gA(r){try{let t=(await Im()).transaction(bs),n=await t.objectStore(bs).get(xm(r));return await t.done,n}catch(e){if(e instanceof _t)bt.warn(e.message);else{let t=Wt.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});bt.warn(t.message)}}}async function ym(r,e){try{let n=(await Im()).transaction(bs,"readwrite");await n.objectStore(bs).put(e,xm(r)),await n.done}catch(t){if(t instanceof _t)bt.warn(t.message);else{let n=Wt.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});bt.warn(n.message)}}}function xm(r){return`${r.name}!${r.options.appId}`}var yA=1024,_A=30,Cu=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new ku(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=_m();if(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(a=>a.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>_A){let a=wA(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(a,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(n){bt.warn(n)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let t=_m(),{heartbeatsToSend:n,unsentEntries:s}=vA(this._heartbeatsCache.heartbeats),i=ys(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 bt.warn(t),""}}};function _m(){return new Date().toISOString().substring(0,10)}function vA(r,e=yA){let t=[],n=r.slice();for(let s of r){let i=t.find(a=>a.agent===s.agent);if(i){if(i.dates.push(s.date),vm(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),vm(t)>e){t.pop();break}n=n.slice(1)}return{heartbeatsToSend:t,unsentEntries:n}}var ku=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return yu()?am().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let t=await gA(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){let s=await this.read();return ym(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){let s=await this.read();return ym(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}};function vm(r){return ys(JSON.stringify({version:2,heartbeats:r})).length}function wA(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 bA(r){ws(new wt("platform-logger",e=>new xu(e),"PRIVATE")),ws(new wt("heartbeat",e=>new Cu(e),"PRIVATE")),Qt(Au,mm,r),Qt(Au,mm,"esm2017"),Qt("fire-js","")}bA("");var TA="firebase",EA="11.3.1";Qt(TA,EA,"app");var Am=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Sm={};var Tt,Ou;(function(){var r;function e(T,y){function w(){}w.prototype=y.prototype,T.D=y.prototype,T.prototype=new w,T.prototype.constructor=T,T.C=function(b,I,A){for(var _=Array(arguments.length-2),ht=2;ht<arguments.length;ht++)_[ht-2]=arguments[ht];return y.prototype[I].apply(b,_)}}function t(){this.blockSize=-1}function n(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(n,t),n.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(T,y,w){w||(w=0);var b=Array(16);if(typeof y=="string")for(var I=0;16>I;++I)b[I]=y.charCodeAt(w++)|y.charCodeAt(w++)<<8|y.charCodeAt(w++)<<16|y.charCodeAt(w++)<<24;else for(I=0;16>I;++I)b[I]=y[w++]|y[w++]<<8|y[w++]<<16|y[w++]<<24;y=T.g[0],w=T.g[1],I=T.g[2];var A=T.g[3],_=y+(A^w&(I^A))+b[0]+3614090360&4294967295;y=w+(_<<7&4294967295|_>>>25),_=A+(I^y&(w^I))+b[1]+3905402710&4294967295,A=y+(_<<12&4294967295|_>>>20),_=I+(w^A&(y^w))+b[2]+606105819&4294967295,I=A+(_<<17&4294967295|_>>>15),_=w+(y^I&(A^y))+b[3]+3250441966&4294967295,w=I+(_<<22&4294967295|_>>>10),_=y+(A^w&(I^A))+b[4]+4118548399&4294967295,y=w+(_<<7&4294967295|_>>>25),_=A+(I^y&(w^I))+b[5]+1200080426&4294967295,A=y+(_<<12&4294967295|_>>>20),_=I+(w^A&(y^w))+b[6]+2821735955&4294967295,I=A+(_<<17&4294967295|_>>>15),_=w+(y^I&(A^y))+b[7]+4249261313&4294967295,w=I+(_<<22&4294967295|_>>>10),_=y+(A^w&(I^A))+b[8]+1770035416&4294967295,y=w+(_<<7&4294967295|_>>>25),_=A+(I^y&(w^I))+b[9]+2336552879&4294967295,A=y+(_<<12&4294967295|_>>>20),_=I+(w^A&(y^w))+b[10]+4294925233&4294967295,I=A+(_<<17&4294967295|_>>>15),_=w+(y^I&(A^y))+b[11]+2304563134&4294967295,w=I+(_<<22&4294967295|_>>>10),_=y+(A^w&(I^A))+b[12]+1804603682&4294967295,y=w+(_<<7&4294967295|_>>>25),_=A+(I^y&(w^I))+b[13]+4254626195&4294967295,A=y+(_<<12&4294967295|_>>>20),_=I+(w^A&(y^w))+b[14]+2792965006&4294967295,I=A+(_<<17&4294967295|_>>>15),_=w+(y^I&(A^y))+b[15]+1236535329&4294967295,w=I+(_<<22&4294967295|_>>>10),_=y+(I^A&(w^I))+b[1]+4129170786&4294967295,y=w+(_<<5&4294967295|_>>>27),_=A+(w^I&(y^w))+b[6]+3225465664&4294967295,A=y+(_<<9&4294967295|_>>>23),_=I+(y^w&(A^y))+b[11]+643717713&4294967295,I=A+(_<<14&4294967295|_>>>18),_=w+(A^y&(I^A))+b[0]+3921069994&4294967295,w=I+(_<<20&4294967295|_>>>12),_=y+(I^A&(w^I))+b[5]+3593408605&4294967295,y=w+(_<<5&4294967295|_>>>27),_=A+(w^I&(y^w))+b[10]+38016083&4294967295,A=y+(_<<9&4294967295|_>>>23),_=I+(y^w&(A^y))+b[15]+3634488961&4294967295,I=A+(_<<14&4294967295|_>>>18),_=w+(A^y&(I^A))+b[4]+3889429448&4294967295,w=I+(_<<20&4294967295|_>>>12),_=y+(I^A&(w^I))+b[9]+568446438&4294967295,y=w+(_<<5&4294967295|_>>>27),_=A+(w^I&(y^w))+b[14]+3275163606&4294967295,A=y+(_<<9&4294967295|_>>>23),_=I+(y^w&(A^y))+b[3]+4107603335&4294967295,I=A+(_<<14&4294967295|_>>>18),_=w+(A^y&(I^A))+b[8]+1163531501&4294967295,w=I+(_<<20&4294967295|_>>>12),_=y+(I^A&(w^I))+b[13]+2850285829&4294967295,y=w+(_<<5&4294967295|_>>>27),_=A+(w^I&(y^w))+b[2]+4243563512&4294967295,A=y+(_<<9&4294967295|_>>>23),_=I+(y^w&(A^y))+b[7]+1735328473&4294967295,I=A+(_<<14&4294967295|_>>>18),_=w+(A^y&(I^A))+b[12]+2368359562&4294967295,w=I+(_<<20&4294967295|_>>>12),_=y+(w^I^A)+b[5]+4294588738&4294967295,y=w+(_<<4&4294967295|_>>>28),_=A+(y^w^I)+b[8]+2272392833&4294967295,A=y+(_<<11&4294967295|_>>>21),_=I+(A^y^w)+b[11]+1839030562&4294967295,I=A+(_<<16&4294967295|_>>>16),_=w+(I^A^y)+b[14]+4259657740&4294967295,w=I+(_<<23&4294967295|_>>>9),_=y+(w^I^A)+b[1]+2763975236&4294967295,y=w+(_<<4&4294967295|_>>>28),_=A+(y^w^I)+b[4]+1272893353&4294967295,A=y+(_<<11&4294967295|_>>>21),_=I+(A^y^w)+b[7]+4139469664&4294967295,I=A+(_<<16&4294967295|_>>>16),_=w+(I^A^y)+b[10]+3200236656&4294967295,w=I+(_<<23&4294967295|_>>>9),_=y+(w^I^A)+b[13]+681279174&4294967295,y=w+(_<<4&4294967295|_>>>28),_=A+(y^w^I)+b[0]+3936430074&4294967295,A=y+(_<<11&4294967295|_>>>21),_=I+(A^y^w)+b[3]+3572445317&4294967295,I=A+(_<<16&4294967295|_>>>16),_=w+(I^A^y)+b[6]+76029189&4294967295,w=I+(_<<23&4294967295|_>>>9),_=y+(w^I^A)+b[9]+3654602809&4294967295,y=w+(_<<4&4294967295|_>>>28),_=A+(y^w^I)+b[12]+3873151461&4294967295,A=y+(_<<11&4294967295|_>>>21),_=I+(A^y^w)+b[15]+530742520&4294967295,I=A+(_<<16&4294967295|_>>>16),_=w+(I^A^y)+b[2]+3299628645&4294967295,w=I+(_<<23&4294967295|_>>>9),_=y+(I^(w|~A))+b[0]+4096336452&4294967295,y=w+(_<<6&4294967295|_>>>26),_=A+(w^(y|~I))+b[7]+1126891415&4294967295,A=y+(_<<10&4294967295|_>>>22),_=I+(y^(A|~w))+b[14]+2878612391&4294967295,I=A+(_<<15&4294967295|_>>>17),_=w+(A^(I|~y))+b[5]+4237533241&4294967295,w=I+(_<<21&4294967295|_>>>11),_=y+(I^(w|~A))+b[12]+1700485571&4294967295,y=w+(_<<6&4294967295|_>>>26),_=A+(w^(y|~I))+b[3]+2399980690&4294967295,A=y+(_<<10&4294967295|_>>>22),_=I+(y^(A|~w))+b[10]+4293915773&4294967295,I=A+(_<<15&4294967295|_>>>17),_=w+(A^(I|~y))+b[1]+2240044497&4294967295,w=I+(_<<21&4294967295|_>>>11),_=y+(I^(w|~A))+b[8]+1873313359&4294967295,y=w+(_<<6&4294967295|_>>>26),_=A+(w^(y|~I))+b[15]+4264355552&4294967295,A=y+(_<<10&4294967295|_>>>22),_=I+(y^(A|~w))+b[6]+2734768916&4294967295,I=A+(_<<15&4294967295|_>>>17),_=w+(A^(I|~y))+b[13]+1309151649&4294967295,w=I+(_<<21&4294967295|_>>>11),_=y+(I^(w|~A))+b[4]+4149444226&4294967295,y=w+(_<<6&4294967295|_>>>26),_=A+(w^(y|~I))+b[11]+3174756917&4294967295,A=y+(_<<10&4294967295|_>>>22),_=I+(y^(A|~w))+b[2]+718787259&4294967295,I=A+(_<<15&4294967295|_>>>17),_=w+(A^(I|~y))+b[9]+3951481745&4294967295,T.g[0]=T.g[0]+y&4294967295,T.g[1]=T.g[1]+(I+(_<<21&4294967295|_>>>11))&4294967295,T.g[2]=T.g[2]+I&4294967295,T.g[3]=T.g[3]+A&4294967295}n.prototype.u=function(T,y){y===void 0&&(y=T.length);for(var w=y-this.blockSize,b=this.B,I=this.h,A=0;A<y;){if(I==0)for(;A<=w;)s(this,T,A),A+=this.blockSize;if(typeof T=="string"){for(;A<y;)if(b[I++]=T.charCodeAt(A++),I==this.blockSize){s(this,b),I=0;break}}else for(;A<y;)if(b[I++]=T[A++],I==this.blockSize){s(this,b),I=0;break}}this.h=I,this.o+=y},n.prototype.v=function(){var T=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);T[0]=128;for(var y=1;y<T.length-8;++y)T[y]=0;var w=8*this.o;for(y=T.length-8;y<T.length;++y)T[y]=w&255,w/=256;for(this.u(T),T=Array(16),y=w=0;4>y;++y)for(var b=0;32>b;b+=8)T[w++]=this.g[y]>>>b&255;return T};function i(T,y){var w=u;return Object.prototype.hasOwnProperty.call(w,T)?w[T]:w[T]=y(T)}function a(T,y){this.h=y;for(var w=[],b=!0,I=T.length-1;0<=I;I--){var A=T[I]|0;b&&A==y||(w[I]=A,b=!1)}this.g=w}var u={};function c(T){return-128<=T&&128>T?i(T,function(y){return new a([y|0],0>y?-1:0)}):new a([T|0],0>T?-1:0)}function h(T){if(isNaN(T)||!isFinite(T))return m;if(0>T)return R(h(-T));for(var y=[],w=1,b=0;T>=w;b++)y[b]=T/w|0,w*=4294967296;return new a(y,0)}function f(T,y){if(T.length==0)throw Error("number format error: empty string");if(y=y||10,2>y||36<y)throw Error("radix out of range: "+y);if(T.charAt(0)=="-")return R(f(T.substring(1),y));if(0<=T.indexOf("-"))throw Error('number format error: interior "-" character');for(var w=h(Math.pow(y,8)),b=m,I=0;I<T.length;I+=8){var A=Math.min(8,T.length-I),_=parseInt(T.substring(I,I+A),y);8>A?(A=h(Math.pow(y,A)),b=b.j(A).add(h(_))):(b=b.j(w),b=b.add(h(_)))}return b}var m=c(0),g=c(1),E=c(16777216);r=a.prototype,r.m=function(){if(C(this))return-R(this).m();for(var T=0,y=1,w=0;w<this.g.length;w++){var b=this.i(w);T+=(0<=b?b:4294967296+b)*y,y*=4294967296}return T},r.toString=function(T){if(T=T||10,2>T||36<T)throw Error("radix out of range: "+T);if(P(this))return"0";if(C(this))return"-"+R(this).toString(T);for(var y=h(Math.pow(T,6)),w=this,b="";;){var I=G(w,y).g;w=N(w,I.j(y));var A=((0<w.g.length?w.g[0]:w.h)>>>0).toString(T);if(w=I,P(w))return A+b;for(;6>A.length;)A="0"+A;b=A+b}},r.i=function(T){return 0>T?0:T<this.g.length?this.g[T]:this.h};function P(T){if(T.h!=0)return!1;for(var y=0;y<T.g.length;y++)if(T.g[y]!=0)return!1;return!0}function C(T){return T.h==-1}r.l=function(T){return T=N(this,T),C(T)?-1:P(T)?0:1};function R(T){for(var y=T.g.length,w=[],b=0;b<y;b++)w[b]=~T.g[b];return new a(w,~T.h).add(g)}r.abs=function(){return C(this)?R(this):this},r.add=function(T){for(var y=Math.max(this.g.length,T.g.length),w=[],b=0,I=0;I<=y;I++){var A=b+(this.i(I)&65535)+(T.i(I)&65535),_=(A>>>16)+(this.i(I)>>>16)+(T.i(I)>>>16);b=_>>>16,A&=65535,_&=65535,w[I]=_<<16|A}return new a(w,w[w.length-1]&-2147483648?-1:0)};function N(T,y){return T.add(R(y))}r.j=function(T){if(P(this)||P(T))return m;if(C(this))return C(T)?R(this).j(R(T)):R(R(this).j(T));if(C(T))return R(this.j(R(T)));if(0>this.l(E)&&0>T.l(E))return h(this.m()*T.m());for(var y=this.g.length+T.g.length,w=[],b=0;b<2*y;b++)w[b]=0;for(b=0;b<this.g.length;b++)for(var I=0;I<T.g.length;I++){var A=this.i(b)>>>16,_=this.i(b)&65535,ht=T.i(I)>>>16,Hn=T.i(I)&65535;w[2*b+2*I]+=_*Hn,M(w,2*b+2*I),w[2*b+2*I+1]+=A*Hn,M(w,2*b+2*I+1),w[2*b+2*I+1]+=_*ht,M(w,2*b+2*I+1),w[2*b+2*I+2]+=A*ht,M(w,2*b+2*I+2)}for(b=0;b<y;b++)w[b]=w[2*b+1]<<16|w[2*b];for(b=y;b<2*y;b++)w[b]=0;return new a(w,0)};function M(T,y){for(;(T[y]&65535)!=T[y];)T[y+1]+=T[y]>>>16,T[y]&=65535,y++}function U(T,y){this.g=T,this.h=y}function G(T,y){if(P(y))throw Error("division by zero");if(P(T))return new U(m,m);if(C(T))return y=G(R(T),y),new U(R(y.g),R(y.h));if(C(y))return y=G(T,R(y)),new U(R(y.g),y.h);if(30<T.g.length){if(C(T)||C(y))throw Error("slowDivide_ only works with positive integers.");for(var w=g,b=y;0>=b.l(T);)w=Y(w),b=Y(b);var I=B(w,1),A=B(b,1);for(b=B(b,2),w=B(w,2);!P(b);){var _=A.add(b);0>=_.l(T)&&(I=I.add(w),A=_),b=B(b,1),w=B(w,1)}return y=N(T,I.j(y)),new U(I,y)}for(I=m;0<=T.l(y);){for(w=Math.max(1,Math.floor(T.m()/y.m())),b=Math.ceil(Math.log(w)/Math.LN2),b=48>=b?1:Math.pow(2,b-48),A=h(w),_=A.j(y);C(_)||0<_.l(T);)w-=b,A=h(w),_=A.j(y);P(A)&&(A=g),I=I.add(A),T=N(T,_)}return new U(I,T)}r.A=function(T){return G(this,T).h},r.and=function(T){for(var y=Math.max(this.g.length,T.g.length),w=[],b=0;b<y;b++)w[b]=this.i(b)&T.i(b);return new a(w,this.h&T.h)},r.or=function(T){for(var y=Math.max(this.g.length,T.g.length),w=[],b=0;b<y;b++)w[b]=this.i(b)|T.i(b);return new a(w,this.h|T.h)},r.xor=function(T){for(var y=Math.max(this.g.length,T.g.length),w=[],b=0;b<y;b++)w[b]=this.i(b)^T.i(b);return new a(w,this.h^T.h)};function Y(T){for(var y=T.g.length+1,w=[],b=0;b<y;b++)w[b]=T.i(b)<<1|T.i(b-1)>>>31;return new a(w,T.h)}function B(T,y){var w=y>>5;y%=32;for(var b=T.g.length-w,I=[],A=0;A<b;A++)I[A]=0<y?T.i(A+w)>>>y|T.i(A+w+1)<<32-y:T.i(A+w);return new a(I,T.h)}n.prototype.digest=n.prototype.v,n.prototype.reset=n.prototype.s,n.prototype.update=n.prototype.u,Ou=Sm.Md5=n,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.A,a.prototype.compare=a.prototype.l,a.prototype.toNumber=a.prototype.m,a.prototype.toString=a.prototype.toString,a.prototype.getBits=a.prototype.i,a.fromNumber=h,a.fromString=f,Tt=Sm.Integer=a}).apply(typeof Am!="undefined"?Am: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:{},Et={};var Nu,IA,an,Vu,Ts,lo,Lu,Mu,Fu;(function(){var r,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(o,l,d){return o==Array.prototype||o==Object.prototype||(o[l]=d.value),o};function t(o){o=[typeof globalThis=="object"&&globalThis,o,typeof window=="object"&&window,typeof self=="object"&&self,typeof co=="object"&&co];for(var l=0;l<o.length;++l){var d=o[l];if(d&&d.Math==Math)return d}throw Error("Cannot find global object")}var n=t(this);function s(o,l){if(l)e:{var d=n;o=o.split(".");for(var p=0;p<o.length-1;p++){var x=o[p];if(!(x in d))break e;d=d[x]}o=o[o.length-1],p=d[o],l=l(p),l!=p&&l!=null&&e(d,o,{configurable:!0,writable:!0,value:l})}}function i(o,l){o instanceof String&&(o+="");var d=0,p=!1,x={next:function(){if(!p&&d<o.length){var S=d++;return{value:l(S,o[S]),done:!1}}return p=!0,{done:!0,value:void 0}}};return x[Symbol.iterator]=function(){return x},x}s("Array.prototype.values",function(o){return o||function(){return i(this,function(l,d){return d})}});var a=a||{},u=this||self;function c(o){var l=typeof o;return l=l!="object"?l:o?Array.isArray(o)?"array":l:"null",l=="array"||l=="object"&&typeof o.length=="number"}function h(o){var l=typeof o;return l=="object"&&o!=null||l=="function"}function f(o,l,d){return o.call.apply(o.bind,arguments)}function m(o,l,d){if(!o)throw Error();if(2<arguments.length){var p=Array.prototype.slice.call(arguments,2);return function(){var x=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(x,p),o.apply(l,x)}}return function(){return o.apply(l,arguments)}}function g(o,l,d){return g=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?f:m,g.apply(null,arguments)}function E(o,l){var d=Array.prototype.slice.call(arguments,1);return function(){var p=d.slice();return p.push.apply(p,arguments),o.apply(this,p)}}function P(o,l){function d(){}d.prototype=l.prototype,o.aa=l.prototype,o.prototype=new d,o.prototype.constructor=o,o.Qb=function(p,x,S){for(var O=Array(arguments.length-2),te=2;te<arguments.length;te++)O[te-2]=arguments[te];return l.prototype[x].apply(p,O)}}function C(o){let l=o.length;if(0<l){let d=Array(l);for(let p=0;p<l;p++)d[p]=o[p];return d}return[]}function R(o,l){for(let d=1;d<arguments.length;d++){let p=arguments[d];if(c(p)){let x=o.length||0,S=p.length||0;o.length=x+S;for(let O=0;O<S;O++)o[x+O]=p[O]}else o.push(p)}}class N{constructor(l,d){this.i=l,this.j=d,this.h=0,this.g=null}get(){let l;return 0<this.h?(this.h--,l=this.g,this.g=l.next,l.next=null):l=this.i(),l}}function M(o){return/^[\s\xa0]*$/.test(o)}function U(){var o=u.navigator;return o&&(o=o.userAgent)?o:""}function G(o){return G[" "](o),o}G[" "]=function(){};var Y=U().indexOf("Gecko")!=-1&&!(U().toLowerCase().indexOf("webkit")!=-1&&U().indexOf("Edge")==-1)&&!(U().indexOf("Trident")!=-1||U().indexOf("MSIE")!=-1)&&U().indexOf("Edge")==-1;function B(o,l,d){for(let p in o)l.call(d,o[p],p,o)}function T(o,l){for(let d in o)l.call(void 0,o[d],d,o)}function y(o){let l={};for(let d in o)l[d]=o[d];return l}let w="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function b(o,l){let d,p;for(let x=1;x<arguments.length;x++){p=arguments[x];for(d in p)o[d]=p[d];for(let S=0;S<w.length;S++)d=w[S],Object.prototype.hasOwnProperty.call(p,d)&&(o[d]=p[d])}}function I(o){var l=1;o=o.split(":");let d=[];for(;0<l&&o.length;)d.push(o.shift()),l--;return o.length&&d.push(o.join(":")),d}function A(o){u.setTimeout(()=>{throw o},0)}function _(){var o=Oa;let l=null;return o.g&&(l=o.g,o.g=o.g.next,o.g||(o.h=null),l.next=null),l}class ht{constructor(){this.h=this.g=null}add(l,d){let p=Hn.get();p.set(l,d),this.h?this.h.next=p:this.g=p,this.h=p}}var Hn=new N(()=>new tv,o=>o.reset());class tv{constructor(){this.next=this.g=this.h=null}set(l,d){this.h=l,this.g=d,this.next=null}reset(){this.next=this.g=this.h=null}}let Wn,Qn=!1,Oa=new ht,Eh=()=>{let o=u.Promise.resolve(void 0);Wn=()=>{o.then(rv)}};var rv=()=>{for(var o;o=_();){try{o.h.call(o.g)}catch(d){A(d)}var l=Hn;l.j(o),100>l.h&&(l.h++,o.next=l.g,l.g=o)}Qn=!1};function kt(){this.s=this.s,this.C=this.C}kt.prototype.s=!1,kt.prototype.ma=function(){this.s||(this.s=!0,this.N())},kt.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function Ee(o,l){this.type=o,this.g=this.target=l,this.defaultPrevented=!1}Ee.prototype.h=function(){this.defaultPrevented=!0};var nv=function(){if(!u.addEventListener||!Object.defineProperty)return!1;var o=!1,l=Object.defineProperty({},"passive",{get:function(){o=!0}});try{let d=()=>{};u.addEventListener("test",d,l),u.removeEventListener("test",d,l)}catch{}return o}();function Jn(o,l){if(Ee.call(this,o?o.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,o){var d=this.type=o.type,p=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:null;if(this.target=o.target||o.srcElement,this.g=l,l=o.relatedTarget){if(Y){e:{try{G(l.nodeName);var x=!0;break e}catch{}x=!1}x||(l=null)}}else d=="mouseover"?l=o.fromElement:d=="mouseout"&&(l=o.toElement);this.relatedTarget=l,p?(this.clientX=p.clientX!==void 0?p.clientX:p.pageX,this.clientY=p.clientY!==void 0?p.clientY:p.pageY,this.screenX=p.screenX||0,this.screenY=p.screenY||0):(this.clientX=o.clientX!==void 0?o.clientX:o.pageX,this.clientY=o.clientY!==void 0?o.clientY:o.pageY,this.screenX=o.screenX||0,this.screenY=o.screenY||0),this.button=o.button,this.key=o.key||"",this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.pointerId=o.pointerId||0,this.pointerType=typeof o.pointerType=="string"?o.pointerType:sv[o.pointerType]||"",this.state=o.state,this.i=o,o.defaultPrevented&&Jn.aa.h.call(this)}}P(Jn,Ee);var sv={2:"touch",3:"pen",4:"mouse"};Jn.prototype.h=function(){Jn.aa.h.call(this);var o=this.i;o.preventDefault?o.preventDefault():o.returnValue=!1};var Yn="closure_listenable_"+(1e6*Math.random()|0),iv=0;function ov(o,l,d,p,x){this.listener=o,this.proxy=null,this.src=l,this.type=d,this.capture=!!p,this.ha=x,this.key=++iv,this.da=this.fa=!1}function _i(o){o.da=!0,o.listener=null,o.proxy=null,o.src=null,o.ha=null}function vi(o){this.src=o,this.g={},this.h=0}vi.prototype.add=function(o,l,d,p,x){var S=o.toString();o=this.g[S],o||(o=this.g[S]=[],this.h++);var O=Va(o,l,p,x);return-1<O?(l=o[O],d||(l.fa=!1)):(l=new ov(l,this.src,S,!!p,x),l.fa=d,o.push(l)),l};function Na(o,l){var d=l.type;if(d in o.g){var p=o.g[d],x=Array.prototype.indexOf.call(p,l,void 0),S;(S=0<=x)&&Array.prototype.splice.call(p,x,1),S&&(_i(l),o.g[d].length==0&&(delete o.g[d],o.h--))}}function Va(o,l,d,p){for(var x=0;x<o.length;++x){var S=o[x];if(!S.da&&S.listener==l&&S.capture==!!d&&S.ha==p)return x}return-1}var La="closure_lm_"+(1e6*Math.random()|0),Ma={};function Ih(o,l,d,p,x){if(p&&p.once)return Ah(o,l,d,p,x);if(Array.isArray(l)){for(var S=0;S<l.length;S++)Ih(o,l[S],d,p,x);return null}return d=Ba(d),o&&o[Yn]?o.K(l,d,h(p)?!!p.capture:!!p,x):xh(o,l,d,!1,p,x)}function xh(o,l,d,p,x,S){if(!l)throw Error("Invalid event type");var O=h(x)?!!x.capture:!!x,te=ja(o);if(te||(o[La]=te=new vi(o)),d=te.add(l,d,p,O,S),d.proxy)return d;if(p=av(),d.proxy=p,p.src=o,p.listener=d,o.addEventListener)nv||(x=O),x===void 0&&(x=!1),o.addEventListener(l.toString(),p,x);else if(o.attachEvent)o.attachEvent(Rh(l.toString()),p);else if(o.addListener&&o.removeListener)o.addListener(p);else throw Error("addEventListener and attachEvent are unavailable.");return d}function av(){function o(d){return l.call(o.src,o.listener,d)}let l=uv;return o}function Ah(o,l,d,p,x){if(Array.isArray(l)){for(var S=0;S<l.length;S++)Ah(o,l[S],d,p,x);return null}return d=Ba(d),o&&o[Yn]?o.L(l,d,h(p)?!!p.capture:!!p,x):xh(o,l,d,!0,p,x)}function Sh(o,l,d,p,x){if(Array.isArray(l))for(var S=0;S<l.length;S++)Sh(o,l[S],d,p,x);else p=h(p)?!!p.capture:!!p,d=Ba(d),o&&o[Yn]?(o=o.i,l=String(l).toString(),l in o.g&&(S=o.g[l],d=Va(S,d,p,x),-1<d&&(_i(S[d]),Array.prototype.splice.call(S,d,1),S.length==0&&(delete o.g[l],o.h--)))):o&&(o=ja(o))&&(l=o.g[l.toString()],o=-1,l&&(o=Va(l,d,p,x)),(d=-1<o?l[o]:null)&&Fa(d))}function Fa(o){if(typeof o!="number"&&o&&!o.da){var l=o.src;if(l&&l[Yn])Na(l.i,o);else{var d=o.type,p=o.proxy;l.removeEventListener?l.removeEventListener(d,p,o.capture):l.detachEvent?l.detachEvent(Rh(d),p):l.addListener&&l.removeListener&&l.removeListener(p),(d=ja(l))?(Na(d,o),d.h==0&&(d.src=null,l[La]=null)):_i(o)}}}function Rh(o){return o in Ma?Ma[o]:Ma[o]="on"+o}function uv(o,l){if(o.da)o=!0;else{l=new Jn(l,this);var d=o.listener,p=o.ha||o.src;o.fa&&Fa(o),o=d.call(p,l)}return o}function ja(o){return o=o[La],o instanceof vi?o:null}var Ua="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ba(o){return typeof o=="function"?o:(o[Ua]||(o[Ua]=function(l){return o.handleEvent(l)}),o[Ua])}function Ie(){kt.call(this),this.i=new vi(this),this.M=this,this.F=null}P(Ie,kt),Ie.prototype[Yn]=!0,Ie.prototype.removeEventListener=function(o,l,d,p){Sh(this,o,l,d,p)};function Ce(o,l){var d,p=o.F;if(p)for(d=[];p;p=p.F)d.push(p);if(o=o.M,p=l.type||l,typeof l=="string")l=new Ee(l,o);else if(l instanceof Ee)l.target=l.target||o;else{var x=l;l=new Ee(p,o),b(l,x)}if(x=!0,d)for(var S=d.length-1;0<=S;S--){var O=l.g=d[S];x=wi(O,p,!0,l)&&x}if(O=l.g=o,x=wi(O,p,!0,l)&&x,x=wi(O,p,!1,l)&&x,d)for(S=0;S<d.length;S++)O=l.g=d[S],x=wi(O,p,!1,l)&&x}Ie.prototype.N=function(){if(Ie.aa.N.call(this),this.i){var o=this.i,l;for(l in o.g){for(var d=o.g[l],p=0;p<d.length;p++)_i(d[p]);delete o.g[l],o.h--}}this.F=null},Ie.prototype.K=function(o,l,d,p){return this.i.add(String(o),l,!1,d,p)},Ie.prototype.L=function(o,l,d,p){return this.i.add(String(o),l,!0,d,p)};function wi(o,l,d,p){if(l=o.i.g[String(l)],!l)return!0;l=l.concat();for(var x=!0,S=0;S<l.length;++S){var O=l[S];if(O&&!O.da&&O.capture==d){var te=O.listener,we=O.ha||O.src;O.fa&&Na(o.i,O),x=te.call(we,p)!==!1&&x}}return x&&!p.defaultPrevented}function Ph(o,l,d){if(typeof o=="function")d&&(o=g(o,d));else if(o&&typeof o.handleEvent=="function")o=g(o.handleEvent,o);else throw Error("Invalid listener argument");return 2147483647<Number(l)?-1:u.setTimeout(o,l||0)}function Ch(o){o.g=Ph(()=>{o.g=null,o.i&&(o.i=!1,Ch(o))},o.l);let l=o.h;o.h=null,o.m.apply(null,l)}class cv extends kt{constructor(l,d){super(),this.m=l,this.l=d,this.h=null,this.i=!1,this.g=null}j(l){this.h=arguments,this.g?this.i=!0:Ch(this)}N(){super.N(),this.g&&(u.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Xn(o){kt.call(this),this.h=o,this.g={}}P(Xn,kt);var kh=[];function Dh(o){B(o.g,function(l,d){this.g.hasOwnProperty(d)&&Fa(l)},o),o.g={}}Xn.prototype.N=function(){Xn.aa.N.call(this),Dh(this)},Xn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var $a=u.JSON.stringify,lv=u.JSON.parse,hv=class{stringify(o){return u.JSON.stringify(o,void 0)}parse(o){return u.JSON.parse(o,void 0)}};function qa(){}qa.prototype.h=null;function Oh(o){return o.h||(o.h=o.i())}function Nh(){}var Zn={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function za(){Ee.call(this,"d")}P(za,Ee);function Ga(){Ee.call(this,"c")}P(Ga,Ee);var or={},Vh=null;function bi(){return Vh=Vh||new Ie}or.La="serverreachability";function Lh(o){Ee.call(this,or.La,o)}P(Lh,Ee);function es(o){let l=bi();Ce(l,new Lh(l))}or.STAT_EVENT="statevent";function Mh(o,l){Ee.call(this,or.STAT_EVENT,o),this.stat=l}P(Mh,Ee);function ke(o){let l=bi();Ce(l,new Mh(l,o))}or.Ma="timingevent";function Fh(o,l){Ee.call(this,or.Ma,o),this.size=l}P(Fh,Ee);function ts(o,l){if(typeof o!="function")throw Error("Fn must not be null and must be a function");return u.setTimeout(function(){o()},l)}function rs(){this.g=!0}rs.prototype.xa=function(){this.g=!1};function dv(o,l,d,p,x,S){o.info(function(){if(o.g)if(S)for(var O="",te=S.split("&"),we=0;we<te.length;we++){var X=te[we].split("=");if(1<X.length){var xe=X[0];X=X[1];var Ae=xe.split("_");O=2<=Ae.length&&Ae[1]=="type"?O+(xe+"="+X+"&"):O+(xe+"=redacted&")}}else O=null;else O=S;return"XMLHTTP REQ ("+p+") [attempt "+x+"]: "+l+`
|
|
1
|
+
var I0=Object.create;var Li=Object.defineProperty;var A0=Object.getOwnPropertyDescriptor;var x0=Object.getOwnPropertyNames;var S0=Object.getPrototypeOf,R0=Object.prototype.hasOwnProperty;var P0=(r,e,t)=>e in r?Li(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var _=(r,e)=>()=>(r&&(e=r(r=0)),e);var ot=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ir=(r,e)=>{for(var t in e)Li(r,t,{get:e[t],enumerable:!0})},wp=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of x0(e))!R0.call(r,i)&&i!==t&&Li(r,i,{get:()=>e[i],enumerable:!(n=A0(e,i))||n.enumerable});return r};var vp=(r,e,t)=>(t=r!=null?I0(S0(r)):{},wp(e||!r||!r.__esModule?Li(t,"default",{value:r,enumerable:!0}):t,r)),C0=r=>wp(Li({},"__esModule",{value:!0}),r);var ae=(r,e,t)=>P0(r,typeof e!="symbol"?e+"":e,t);var k0,bo,yu=_(()=>{k0=typeof global=="object"&&global&&global.Object===Object&&global,bo=k0});var D0,O0,he,Je=_(()=>{yu();D0=typeof self=="object"&&self&&self.Object===Object&&self,O0=bo||D0||Function("return this")(),he=O0});var N0,Ve,nn=_(()=>{Je();N0=he.Symbol,Ve=N0});function M0(r){var e=V0.call(r,Mi),t=r[Mi];try{r[Mi]=void 0;var n=!0}catch{}var i=L0.call(r);return n&&(e?r[Mi]=t:delete r[Mi]),i}var bp,V0,L0,Mi,Tp,Ep=_(()=>{nn();bp=Object.prototype,V0=bp.hasOwnProperty,L0=bp.toString,Mi=Ve?Ve.toStringTag:void 0;Tp=M0});function U0(r){return j0.call(r)}var F0,j0,Ip,Ap=_(()=>{F0=Object.prototype,j0=F0.toString;Ip=U0});function q0(r){return r==null?r===void 0?$0:B0:xp&&xp in Object(r)?Tp(r):Ip(r)}var B0,$0,xp,tt,sn=_(()=>{nn();Ep();Ap();B0="[object Null]",$0="[object Undefined]",xp=Ve?Ve.toStringTag:void 0;tt=q0});function z0(r){return r!=null&&typeof r=="object"}var Le,Kt=_(()=>{Le=z0});function K0(r){return typeof r=="symbol"||Le(r)&&tt(r)==G0}var G0,Ht,Fi=_(()=>{sn();Kt();G0="[object Symbol]";Ht=K0});function H0(r,e){for(var t=-1,n=r==null?0:r.length,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}var Sp,Rp=_(()=>{Sp=H0});var W0,fe,rt=_(()=>{W0=Array.isArray,fe=W0});function kp(r){if(typeof r=="string")return r;if(fe(r))return Sp(r,kp)+"";if(Ht(r))return Cp?Cp.call(r):"";var e=r+"";return e=="0"&&1/r==-Q0?"-0":e}var Q0,Pp,Cp,Dp,Op=_(()=>{nn();Rp();rt();Fi();Q0=1/0,Pp=Ve?Ve.prototype:void 0,Cp=Pp?Pp.toString:void 0;Dp=kp});function Y0(r){for(var e=r.length;e--&&J0.test(r.charAt(e)););return e}var J0,Np,Vp=_(()=>{J0=/\s/;Np=Y0});function Z0(r){return r&&r.slice(0,Np(r)+1).replace(X0,"")}var X0,Lp,Mp=_(()=>{Vp();X0=/^\s+/;Lp=Z0});function eI(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var ee,Ge=_(()=>{ee=eI});function sI(r){if(typeof r=="number")return r;if(Ht(r))return Fp;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=Lp(r);var t=rI.test(r);return t||nI.test(r)?iI(r.slice(2),t?2:8):tI.test(r)?Fp:+r}var Fp,tI,rI,nI,iI,_u,jp=_(()=>{Mp();Ge();Fi();Fp=NaN,tI=/^[-+]0x[0-9a-f]+$/i,rI=/^0b[01]+$/i,nI=/^0o[0-7]+$/i,iI=parseInt;_u=sI});function oI(r){return r}var on,To=_(()=>{on=oI});function hI(r){if(!ee(r))return!1;var e=tt(r);return e==lI||e==uI||e==aI||e==cI}var aI,lI,uI,cI,Eo,wu=_(()=>{sn();Ge();aI="[object AsyncFunction]",lI="[object Function]",uI="[object GeneratorFunction]",cI="[object Proxy]";Eo=hI});var dI,Io,Up=_(()=>{Je();dI=he["__core-js_shared__"],Io=dI});function fI(r){return!!Bp&&Bp in r}var Bp,$p,qp=_(()=>{Up();Bp=function(){var r=/[^.]+$/.exec(Io&&Io.keys&&Io.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();$p=fI});function gI(r){if(r!=null){try{return mI.call(r)}catch{}try{return r+""}catch{}}return""}var pI,mI,It,vu=_(()=>{pI=Function.prototype,mI=pI.toString;It=gI});function II(r){if(!ee(r)||$p(r))return!1;var e=Eo(r)?EI:_I;return e.test(It(r))}var yI,_I,wI,vI,bI,TI,EI,zp,Gp=_(()=>{wu();qp();Ge();vu();yI=/[\\^$.*+?()[\]{}|]/g,_I=/^\[object .+?Constructor\]$/,wI=Function.prototype,vI=Object.prototype,bI=wI.toString,TI=vI.hasOwnProperty,EI=RegExp("^"+bI.call(TI).replace(yI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");zp=II});function AI(r,e){return r==null?void 0:r[e]}var Kp,Hp=_(()=>{Kp=AI});function xI(r,e){var t=Kp(r,e);return zp(t)?t:void 0}var je,Wt=_(()=>{Gp();Hp();je=xI});var SI,Ao,Wp=_(()=>{Wt();Je();SI=je(he,"WeakMap"),Ao=SI});var Qp,RI,Jp,Yp=_(()=>{Ge();Qp=Object.create,RI=function(){function r(){}return function(e){if(!ee(e))return{};if(Qp)return Qp(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}}(),Jp=RI});function PI(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 Xp,Zp=_(()=>{Xp=PI});function CI(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}var em,tm=_(()=>{em=CI});function NI(r){var e=0,t=0;return function(){var n=OI(),i=DI-(n-t);if(t=n,i>0){if(++e>=kI)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var kI,DI,OI,rm,nm=_(()=>{kI=800,DI=16,OI=Date.now;rm=NI});function VI(r){return function(){return r}}var im,sm=_(()=>{im=VI});var LI,an,bu=_(()=>{Wt();LI=function(){try{var r=je(Object,"defineProperty");return r({},"",{}),r}catch{}}(),an=LI});var MI,om,am=_(()=>{sm();bu();To();MI=an?function(r,e){return an(r,"toString",{configurable:!0,enumerable:!1,value:im(e),writable:!0})}:on,om=MI});var FI,lm,um=_(()=>{am();nm();FI=rm(om),lm=FI});function jI(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var cm,hm=_(()=>{cm=jI});function $I(r,e){var t=typeof r;return e=e==null?UI:e,!!e&&(t=="number"||t!="symbol"&&BI.test(r))&&r>-1&&r%1==0&&r<e}var UI,BI,Qt,ji=_(()=>{UI=9007199254740991,BI=/^(?:0|[1-9]\d*)$/;Qt=$I});function qI(r,e,t){e=="__proto__"&&an?an(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var ln,xo=_(()=>{bu();ln=qI});function zI(r,e){return r===e||r!==r&&e!==e}var at,un=_(()=>{at=zI});function HI(r,e,t){var n=r[e];(!(KI.call(r,e)&&at(n,t))||t===void 0&&!(e in r))&&ln(r,e,t)}var GI,KI,cn,So=_(()=>{xo();un();GI=Object.prototype,KI=GI.hasOwnProperty;cn=HI});function WI(r,e,t,n){var i=!t;t||(t={});for(var s=-1,a=e.length;++s<a;){var l=e[s],u=n?n(t[l],r[l],l,t,r):void 0;u===void 0&&(u=r[l]),i?ln(t,l,u):cn(t,l,u)}return t}var Jt,Ui=_(()=>{So();xo();Jt=WI});function QI(r,e,t){return e=dm(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,s=dm(n.length-e,0),a=Array(s);++i<s;)a[i]=n[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=n[i];return l[e]=t(a),Xp(r,this,l)}}var dm,fm,pm=_(()=>{Zp();dm=Math.max;fm=QI});function JI(r,e){return lm(fm(r,e,on),r+"")}var mm,gm=_(()=>{To();pm();um();mm=JI});function XI(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=YI}var YI,hn,Ro=_(()=>{YI=9007199254740991;hn=XI});function ZI(r){return r!=null&&hn(r.length)&&!Eo(r)}var Yt,Bi=_(()=>{wu();Ro();Yt=ZI});function eA(r,e,t){if(!ee(t))return!1;var n=typeof e;return(n=="number"?Yt(t)&&Qt(e,t.length):n=="string"&&e in t)?at(t[e],r):!1}var ym,_m=_(()=>{un();Bi();ji();Ge();ym=eA});function rA(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||tA;return r===t}var tA,Xt,$i=_(()=>{tA=Object.prototype;Xt=rA});function nA(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var wm,vm=_(()=>{wm=nA});function sA(r){return Le(r)&&tt(r)==iA}var iA,Tu,bm=_(()=>{sn();Kt();iA="[object Arguments]";Tu=sA});var Tm,oA,aA,lA,dn,Po=_(()=>{bm();Kt();Tm=Object.prototype,oA=Tm.hasOwnProperty,aA=Tm.propertyIsEnumerable,lA=Tu(function(){return arguments}())?Tu:function(r){return Le(r)&&oA.call(r,"callee")&&!aA.call(r,"callee")},dn=lA});function uA(){return!1}var Em,Im=_(()=>{Em=uA});var Sm,Am,cA,xm,hA,dA,At,qi=_(()=>{Je();Im();Sm=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Am=Sm&&typeof module=="object"&&module&&!module.nodeType&&module,cA=Am&&Am.exports===Sm,xm=cA?he.Buffer:void 0,hA=xm?xm.isBuffer:void 0,dA=hA||Em,At=dA});function MA(r){return Le(r)&&hn(r.length)&&!!le[tt(r)]}var fA,pA,mA,gA,yA,_A,wA,vA,bA,TA,EA,IA,AA,xA,SA,RA,PA,CA,kA,DA,OA,NA,VA,LA,le,Rm,Pm=_(()=>{sn();Ro();Kt();fA="[object Arguments]",pA="[object Array]",mA="[object Boolean]",gA="[object Date]",yA="[object Error]",_A="[object Function]",wA="[object Map]",vA="[object Number]",bA="[object Object]",TA="[object RegExp]",EA="[object Set]",IA="[object String]",AA="[object WeakMap]",xA="[object ArrayBuffer]",SA="[object DataView]",RA="[object Float32Array]",PA="[object Float64Array]",CA="[object Int8Array]",kA="[object Int16Array]",DA="[object Int32Array]",OA="[object Uint8Array]",NA="[object Uint8ClampedArray]",VA="[object Uint16Array]",LA="[object Uint32Array]",le={};le[RA]=le[PA]=le[CA]=le[kA]=le[DA]=le[OA]=le[NA]=le[VA]=le[LA]=!0;le[fA]=le[pA]=le[xA]=le[mA]=le[SA]=le[gA]=le[yA]=le[_A]=le[wA]=le[vA]=le[bA]=le[TA]=le[EA]=le[IA]=le[AA]=!1;Rm=MA});function FA(r){return function(e){return r(e)}}var fn,Co=_(()=>{fn=FA});var Cm,zi,jA,Eu,UA,xt,ko=_(()=>{yu();Cm=typeof exports=="object"&&exports&&!exports.nodeType&&exports,zi=Cm&&typeof module=="object"&&module&&!module.nodeType&&module,jA=zi&&zi.exports===Cm,Eu=jA&&bo.process,UA=function(){try{var r=zi&&zi.require&&zi.require("util").types;return r||Eu&&Eu.binding&&Eu.binding("util")}catch{}}(),xt=UA});var km,BA,pn,Do=_(()=>{Pm();Co();ko();km=xt&&xt.isTypedArray,BA=km?fn(km):Rm,pn=BA});function zA(r,e){var t=fe(r),n=!t&&dn(r),i=!t&&!n&&At(r),s=!t&&!n&&!i&&pn(r),a=t||n||i||s,l=a?wm(r.length,String):[],u=l.length;for(var h in r)(e||qA.call(r,h))&&!(a&&(h=="length"||i&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Qt(h,u)))&&l.push(h);return l}var $A,qA,Oo,Iu=_(()=>{vm();Po();rt();qi();ji();Do();$A=Object.prototype,qA=$A.hasOwnProperty;Oo=zA});function GA(r,e){return function(t){return r(e(t))}}var No,Au=_(()=>{No=GA});var KA,Dm,Om=_(()=>{Au();KA=No(Object.keys,Object),Dm=KA});function QA(r){if(!Xt(r))return Dm(r);var e=[];for(var t in Object(r))WA.call(r,t)&&t!="constructor"&&e.push(t);return e}var HA,WA,Vo,xu=_(()=>{$i();Om();HA=Object.prototype,WA=HA.hasOwnProperty;Vo=QA});function JA(r){return Yt(r)?Oo(r):Vo(r)}var Ce,Ar=_(()=>{Iu();xu();Bi();Ce=JA});function YA(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var Nm,Vm=_(()=>{Nm=YA});function ex(r){if(!ee(r))return Nm(r);var e=Xt(r),t=[];for(var n in r)n=="constructor"&&(e||!ZA.call(r,n))||t.push(n);return t}var XA,ZA,Lm,Mm=_(()=>{Ge();$i();Vm();XA=Object.prototype,ZA=XA.hasOwnProperty;Lm=ex});function tx(r){return Yt(r)?Oo(r,!0):Lm(r)}var Zt,Gi=_(()=>{Iu();Mm();Bi();Zt=tx});function ix(r,e){if(fe(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||Ht(r)?!0:nx.test(r)||!rx.test(r)||e!=null&&r in Object(e)}var rx,nx,mn,Lo=_(()=>{rt();Fi();rx=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nx=/^\w*$/;mn=ix});var sx,St,Ki=_(()=>{Wt();sx=je(Object,"create"),St=sx});function ox(){this.__data__=St?St(null):{},this.size=0}var Fm,jm=_(()=>{Ki();Fm=ox});function ax(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Um,Bm=_(()=>{Um=ax});function hx(r){var e=this.__data__;if(St){var t=e[r];return t===lx?void 0:t}return cx.call(e,r)?e[r]:void 0}var lx,ux,cx,$m,qm=_(()=>{Ki();lx="__lodash_hash_undefined__",ux=Object.prototype,cx=ux.hasOwnProperty;$m=hx});function px(r){var e=this.__data__;return St?e[r]!==void 0:fx.call(e,r)}var dx,fx,zm,Gm=_(()=>{Ki();dx=Object.prototype,fx=dx.hasOwnProperty;zm=px});function gx(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=St&&e===void 0?mx:e,this}var mx,Km,Hm=_(()=>{Ki();mx="__lodash_hash_undefined__";Km=gx});function gn(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])}}var Su,Wm=_(()=>{jm();Bm();qm();Gm();Hm();gn.prototype.clear=Fm;gn.prototype.delete=Um;gn.prototype.get=$m;gn.prototype.has=zm;gn.prototype.set=Km;Su=gn});function yx(){this.__data__=[],this.size=0}var Qm,Jm=_(()=>{Qm=yx});function _x(r,e){for(var t=r.length;t--;)if(at(r[t][0],e))return t;return-1}var er,Hi=_(()=>{un();er=_x});function bx(r){var e=this.__data__,t=er(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():vx.call(e,t,1),--this.size,!0}var wx,vx,Ym,Xm=_(()=>{Hi();wx=Array.prototype,vx=wx.splice;Ym=bx});function Tx(r){var e=this.__data__,t=er(e,r);return t<0?void 0:e[t][1]}var Zm,eg=_(()=>{Hi();Zm=Tx});function Ex(r){return er(this.__data__,r)>-1}var tg,rg=_(()=>{Hi();tg=Ex});function Ix(r,e){var t=this.__data__,n=er(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var ng,ig=_(()=>{Hi();ng=Ix});function yn(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])}}var tr,Wi=_(()=>{Jm();Xm();eg();rg();ig();yn.prototype.clear=Qm;yn.prototype.delete=Ym;yn.prototype.get=Zm;yn.prototype.has=tg;yn.prototype.set=ng;tr=yn});var Ax,rr,Mo=_(()=>{Wt();Je();Ax=je(he,"Map"),rr=Ax});function xx(){this.size=0,this.__data__={hash:new Su,map:new(rr||tr),string:new Su}}var sg,og=_(()=>{Wm();Wi();Mo();sg=xx});function Sx(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var ag,lg=_(()=>{ag=Sx});function Rx(r,e){var t=r.__data__;return ag(e)?t[typeof e=="string"?"string":"hash"]:t.map}var nr,Qi=_(()=>{lg();nr=Rx});function Px(r){var e=nr(this,r).delete(r);return this.size-=e?1:0,e}var ug,cg=_(()=>{Qi();ug=Px});function Cx(r){return nr(this,r).get(r)}var hg,dg=_(()=>{Qi();hg=Cx});function kx(r){return nr(this,r).has(r)}var fg,pg=_(()=>{Qi();fg=kx});function Dx(r,e){var t=nr(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var mg,gg=_(()=>{Qi();mg=Dx});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])}}var xr,Fo=_(()=>{og();cg();dg();pg();gg();_n.prototype.clear=sg;_n.prototype.delete=ug;_n.prototype.get=hg;_n.prototype.has=fg;_n.prototype.set=mg;xr=_n});function Ru(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(Ox);var t=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=t.cache;if(s.has(i))return s.get(i);var a=r.apply(this,n);return t.cache=s.set(i,a)||s,a};return t.cache=new(Ru.Cache||xr),t}var Ox,yg,_g=_(()=>{Fo();Ox="Expected a function";Ru.Cache=xr;yg=Ru});function Vx(r){var e=yg(r,function(n){return t.size===Nx&&t.clear(),n}),t=e.cache;return e}var Nx,wg,vg=_(()=>{_g();Nx=500;wg=Vx});var Lx,Mx,Fx,bg,Tg=_(()=>{vg();Lx=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Mx=/\\(\\)?/g,Fx=wg(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(Lx,function(t,n,i,s){e.push(i?s.replace(Mx,"$1"):n||t)}),e}),bg=Fx});function jx(r){return r==null?"":Dp(r)}var Eg,Ig=_(()=>{Op();Eg=jx});function Ux(r,e){return fe(r)?r:mn(r,e)?[r]:bg(Eg(r))}var wn,jo=_(()=>{rt();Lo();Tg();Ig();wn=Ux});function $x(r){if(typeof r=="string"||Ht(r))return r;var e=r+"";return e=="0"&&1/r==-Bx?"-0":e}var Bx,lt,vn=_(()=>{Fi();Bx=1/0;lt=$x});function qx(r,e){e=wn(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[lt(e[t++])];return t&&t==n?r:void 0}var Uo,Pu=_(()=>{jo();vn();Uo=qx});function zx(r,e,t){var n=r==null?void 0:Uo(r,e);return n===void 0?t:n}var Ji,Cu=_(()=>{Pu();Ji=zx});function Gx(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var Bo,ku=_(()=>{Bo=Gx});var Kx,$o,Du=_(()=>{Au();Kx=No(Object.getPrototypeOf,Object),$o=Kx});function Hx(){this.__data__=new tr,this.size=0}var Ag,xg=_(()=>{Wi();Ag=Hx});function Wx(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var Sg,Rg=_(()=>{Sg=Wx});function Qx(r){return this.__data__.get(r)}var Pg,Cg=_(()=>{Pg=Qx});function Jx(r){return this.__data__.has(r)}var kg,Dg=_(()=>{kg=Jx});function Xx(r,e){var t=this.__data__;if(t instanceof tr){var n=t.__data__;if(!rr||n.length<Yx-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new xr(n)}return t.set(r,e),this.size=t.size,this}var Yx,Og,Ng=_(()=>{Wi();Mo();Fo();Yx=200;Og=Xx});function bn(r){var e=this.__data__=new tr(r);this.size=e.size}var ir,qo=_(()=>{Wi();xg();Rg();Cg();Dg();Ng();bn.prototype.clear=Ag;bn.prototype.delete=Sg;bn.prototype.get=Pg;bn.prototype.has=kg;bn.prototype.set=Og;ir=bn});function Zx(r,e){return r&&Jt(e,Ce(e),r)}var Vg,Lg=_(()=>{Ui();Ar();Vg=Zx});function eS(r,e){return r&&Jt(e,Zt(e),r)}var Mg,Fg=_(()=>{Ui();Gi();Mg=eS});function rS(r,e){if(e)return r.slice();var t=r.length,n=Bg?Bg(t):new r.constructor(t);return r.copy(n),n}var $g,jg,tS,Ug,Bg,qg,zg=_(()=>{Je();$g=typeof exports=="object"&&exports&&!exports.nodeType&&exports,jg=$g&&typeof module=="object"&&module&&!module.nodeType&&module,tS=jg&&jg.exports===$g,Ug=tS?he.Buffer:void 0,Bg=Ug?Ug.allocUnsafe:void 0;qg=rS});function nS(r,e){for(var t=-1,n=r==null?0:r.length,i=0,s=[];++t<n;){var a=r[t];e(a,t,r)&&(s[i++]=a)}return s}var Gg,Kg=_(()=>{Gg=nS});function iS(){return[]}var zo,Ou=_(()=>{zo=iS});var sS,oS,Hg,aS,Tn,Go=_(()=>{Kg();Ou();sS=Object.prototype,oS=sS.propertyIsEnumerable,Hg=Object.getOwnPropertySymbols,aS=Hg?function(r){return r==null?[]:(r=Object(r),Gg(Hg(r),function(e){return oS.call(r,e)}))}:zo,Tn=aS});function lS(r,e){return Jt(r,Tn(r),e)}var Wg,Qg=_(()=>{Ui();Go();Wg=lS});var uS,cS,Ko,Nu=_(()=>{ku();Du();Go();Ou();uS=Object.getOwnPropertySymbols,cS=uS?function(r){for(var e=[];r;)Bo(e,Tn(r)),r=$o(r);return e}:zo,Ko=cS});function hS(r,e){return Jt(r,Ko(r),e)}var Jg,Yg=_(()=>{Ui();Nu();Jg=hS});function dS(r,e,t){var n=e(r);return fe(r)?n:Bo(n,t(r))}var Ho,Vu=_(()=>{ku();rt();Ho=dS});function fS(r){return Ho(r,Ce,Tn)}var Yi,Lu=_(()=>{Vu();Go();Ar();Yi=fS});function pS(r){return Ho(r,Zt,Ko)}var Xg,Zg=_(()=>{Vu();Nu();Gi();Xg=pS});var mS,Wo,ey=_(()=>{Wt();Je();mS=je(he,"DataView"),Wo=mS});var gS,Qo,ty=_(()=>{Wt();Je();gS=je(he,"Promise"),Qo=gS});var yS,Jo,ry=_(()=>{Wt();Je();yS=je(he,"Set"),Jo=yS});var ny,_S,iy,sy,oy,ay,wS,vS,bS,TS,ES,Sr,nt,En=_(()=>{ey();Mo();ty();ry();Wp();sn();vu();ny="[object Map]",_S="[object Object]",iy="[object Promise]",sy="[object Set]",oy="[object WeakMap]",ay="[object DataView]",wS=It(Wo),vS=It(rr),bS=It(Qo),TS=It(Jo),ES=It(Ao),Sr=tt;(Wo&&Sr(new Wo(new ArrayBuffer(1)))!=ay||rr&&Sr(new rr)!=ny||Qo&&Sr(Qo.resolve())!=iy||Jo&&Sr(new Jo)!=sy||Ao&&Sr(new Ao)!=oy)&&(Sr=function(r){var e=tt(r),t=e==_S?r.constructor:void 0,n=t?It(t):"";if(n)switch(n){case wS:return ay;case vS:return ny;case bS:return iy;case TS:return sy;case ES:return oy}return e});nt=Sr});function xS(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&AS.call(r,"index")&&(t.index=r.index,t.input=r.input),t}var IS,AS,ly,uy=_(()=>{IS=Object.prototype,AS=IS.hasOwnProperty;ly=xS});var SS,In,Mu=_(()=>{Je();SS=he.Uint8Array,In=SS});function RS(r){var e=new r.constructor(r.byteLength);return new In(e).set(new In(r)),e}var An,Yo=_(()=>{Mu();An=RS});function PS(r,e){var t=e?An(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}var cy,hy=_(()=>{Yo();cy=PS});function kS(r){var e=new r.constructor(r.source,CS.exec(r));return e.lastIndex=r.lastIndex,e}var CS,dy,fy=_(()=>{CS=/\w*$/;dy=kS});function DS(r){return my?Object(my.call(r)):{}}var py,my,gy,yy=_(()=>{nn();py=Ve?Ve.prototype:void 0,my=py?py.valueOf:void 0;gy=DS});function OS(r,e){var t=e?An(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}var _y,wy=_(()=>{Yo();_y=OS});function ZS(r,e,t){var n=r.constructor;switch(e){case $S:return An(r);case NS:case VS:return new n(+r);case qS:return cy(r,t);case zS:case GS:case KS:case HS:case WS:case QS:case JS:case YS:case XS:return _y(r,t);case LS:return new n;case MS:case US:return new n(r);case FS:return dy(r);case jS:return new n;case BS:return gy(r)}}var NS,VS,LS,MS,FS,jS,US,BS,$S,qS,zS,GS,KS,HS,WS,QS,JS,YS,XS,vy,by=_(()=>{Yo();hy();fy();yy();wy();NS="[object Boolean]",VS="[object Date]",LS="[object Map]",MS="[object Number]",FS="[object RegExp]",jS="[object Set]",US="[object String]",BS="[object Symbol]",$S="[object ArrayBuffer]",qS="[object DataView]",zS="[object Float32Array]",GS="[object Float64Array]",KS="[object Int8Array]",HS="[object Int16Array]",WS="[object Int32Array]",QS="[object Uint8Array]",JS="[object Uint8ClampedArray]",YS="[object Uint16Array]",XS="[object Uint32Array]";vy=ZS});function eR(r){return typeof r.constructor=="function"&&!Xt(r)?Jp($o(r)):{}}var Ty,Ey=_(()=>{Yp();Du();$i();Ty=eR});function rR(r){return Le(r)&&nt(r)==tR}var tR,Iy,Ay=_(()=>{En();Kt();tR="[object Map]";Iy=rR});var xy,nR,Sy,Ry=_(()=>{Ay();Co();ko();xy=xt&&xt.isMap,nR=xy?fn(xy):Iy,Sy=nR});function sR(r){return Le(r)&&nt(r)==iR}var iR,Py,Cy=_(()=>{En();Kt();iR="[object Set]";Py=sR});var ky,oR,Dy,Oy=_(()=>{Cy();Co();ko();ky=xt&&xt.isSet,oR=ky?fn(ky):Py,Dy=oR});function Xo(r,e,t,n,i,s){var a,l=e&aR,u=e&lR,h=e&uR;if(t&&(a=i?t(r,n,i,s):t(r)),a!==void 0)return a;if(!ee(r))return r;var f=fe(r);if(f){if(a=ly(r),!l)return em(r,a)}else{var m=nt(r),g=m==Vy||m==pR;if(At(r))return qg(r,l);if(m==Ly||m==Ny||g&&!i){if(a=u||g?{}:Ty(r),!l)return u?Jg(r,Mg(a,r)):Wg(r,Vg(a,r))}else{if(!ie[m])return i?r:{};a=vy(r,m,l)}}s||(s=new ir);var I=s.get(r);if(I)return I;s.set(r,a),Dy(r)?r.forEach(function(P){a.add(Xo(P,e,t,P,r,s))}):Sy(r)&&r.forEach(function(P,V){a.set(V,Xo(P,e,t,V,r,s))});var C=h?u?Xg:Yi:u?Zt:Ce,k=f?void 0:C(r);return cm(k||r,function(P,V){k&&(V=P,P=r[V]),cn(a,V,Xo(P,e,t,V,r,s))}),a}var aR,lR,uR,Ny,cR,hR,dR,fR,Vy,pR,mR,gR,Ly,yR,_R,wR,vR,bR,TR,ER,IR,AR,xR,SR,RR,PR,CR,kR,DR,ie,My,Fy=_(()=>{qo();hm();So();Lg();Fg();zg();tm();Qg();Yg();Lu();Zg();En();uy();by();Ey();rt();qi();Ry();Ge();Oy();Ar();Gi();aR=1,lR=2,uR=4,Ny="[object Arguments]",cR="[object Array]",hR="[object Boolean]",dR="[object Date]",fR="[object Error]",Vy="[object Function]",pR="[object GeneratorFunction]",mR="[object Map]",gR="[object Number]",Ly="[object Object]",yR="[object RegExp]",_R="[object Set]",wR="[object String]",vR="[object Symbol]",bR="[object WeakMap]",TR="[object ArrayBuffer]",ER="[object DataView]",IR="[object Float32Array]",AR="[object Float64Array]",xR="[object Int8Array]",SR="[object Int16Array]",RR="[object Int32Array]",PR="[object Uint8Array]",CR="[object Uint8ClampedArray]",kR="[object Uint16Array]",DR="[object Uint32Array]",ie={};ie[Ny]=ie[cR]=ie[TR]=ie[ER]=ie[hR]=ie[dR]=ie[IR]=ie[AR]=ie[xR]=ie[SR]=ie[RR]=ie[mR]=ie[gR]=ie[Ly]=ie[yR]=ie[_R]=ie[wR]=ie[vR]=ie[PR]=ie[CR]=ie[kR]=ie[DR]=!0;ie[fR]=ie[Vy]=ie[bR]=!1;My=Xo});function VR(r){return My(r,OR|NR)}var OR,NR,sr,jy=_(()=>{Fy();OR=1,NR=4;sr=VR});function MR(r){return this.__data__.set(r,LR),this}var LR,Uy,By=_(()=>{LR="__lodash_hash_undefined__";Uy=MR});function FR(r){return this.__data__.has(r)}var $y,qy=_(()=>{$y=FR});function Zo(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new xr;++e<t;)this.add(r[e])}var zy,Gy=_(()=>{Fo();By();qy();Zo.prototype.add=Zo.prototype.push=Uy;Zo.prototype.has=$y;zy=Zo});function jR(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 Ky,Hy=_(()=>{Ky=jR});function UR(r,e){return r.has(e)}var Wy,Qy=_(()=>{Wy=UR});function qR(r,e,t,n,i,s){var a=t&BR,l=r.length,u=e.length;if(l!=u&&!(a&&u>l))return!1;var h=s.get(r),f=s.get(e);if(h&&f)return h==e&&f==r;var m=-1,g=!0,I=t&$R?new zy:void 0;for(s.set(r,e),s.set(e,r);++m<l;){var C=r[m],k=e[m];if(n)var P=a?n(k,C,m,e,r,s):n(C,k,m,r,e,s);if(P!==void 0){if(P)continue;g=!1;break}if(I){if(!Ky(e,function(V,F){if(!Wy(I,F)&&(C===V||i(C,V,t,n,s)))return I.push(F)})){g=!1;break}}else if(!(C===k||i(C,k,t,n,s))){g=!1;break}}return s.delete(r),s.delete(e),g}var BR,$R,ea,Fu=_(()=>{Gy();Hy();Qy();BR=1,$R=2;ea=qR});function zR(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var Jy,Yy=_(()=>{Jy=zR});function GR(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var Xy,Zy=_(()=>{Xy=GR});function sP(r,e,t,n,i,s,a){switch(t){case iP:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case nP:return!(r.byteLength!=e.byteLength||!s(new In(r),new In(e)));case WR:case QR:case XR:return at(+r,+e);case JR:return r.name==e.name&&r.message==e.message;case ZR:case tP:return r==e+"";case YR:var l=Jy;case eP:var u=n&KR;if(l||(l=Xy),r.size!=e.size&&!u)return!1;var h=a.get(r);if(h)return h==e;n|=HR,a.set(r,e);var f=ea(l(r),l(e),n,i,s,a);return a.delete(r),f;case rP:if(ju)return ju.call(r)==ju.call(e)}return!1}var KR,HR,WR,QR,JR,YR,XR,ZR,eP,tP,rP,nP,iP,e_,ju,t_,r_=_(()=>{nn();Mu();un();Fu();Yy();Zy();KR=1,HR=2,WR="[object Boolean]",QR="[object Date]",JR="[object Error]",YR="[object Map]",XR="[object Number]",ZR="[object RegExp]",eP="[object Set]",tP="[object String]",rP="[object Symbol]",nP="[object ArrayBuffer]",iP="[object DataView]",e_=Ve?Ve.prototype:void 0,ju=e_?e_.valueOf:void 0;t_=sP});function uP(r,e,t,n,i,s){var a=t&oP,l=Yi(r),u=l.length,h=Yi(e),f=h.length;if(u!=f&&!a)return!1;for(var m=u;m--;){var g=l[m];if(!(a?g in e:lP.call(e,g)))return!1}var I=s.get(r),C=s.get(e);if(I&&C)return I==e&&C==r;var k=!0;s.set(r,e),s.set(e,r);for(var P=a;++m<u;){g=l[m];var V=r[g],F=e[g];if(n)var B=a?n(F,V,g,e,r,s):n(V,F,g,r,e,s);if(!(B===void 0?V===F||i(V,F,t,n,s):B)){k=!1;break}P||(P=g=="constructor")}if(k&&!P){var K=r.constructor,X=e.constructor;K!=X&&"constructor"in r&&"constructor"in e&&!(typeof K=="function"&&K instanceof K&&typeof X=="function"&&X instanceof X)&&(k=!1)}return s.delete(r),s.delete(e),k}var oP,aP,lP,n_,i_=_(()=>{Lu();oP=1,aP=Object.prototype,lP=aP.hasOwnProperty;n_=uP});function dP(r,e,t,n,i,s){var a=fe(r),l=fe(e),u=a?o_:nt(r),h=l?o_:nt(e);u=u==s_?ta:u,h=h==s_?ta:h;var f=u==ta,m=h==ta,g=u==h;if(g&&At(r)){if(!At(e))return!1;a=!0,f=!1}if(g&&!f)return s||(s=new ir),a||pn(r)?ea(r,e,t,n,i,s):t_(r,e,u,t,n,i,s);if(!(t&cP)){var I=f&&a_.call(r,"__wrapped__"),C=m&&a_.call(e,"__wrapped__");if(I||C){var k=I?r.value():r,P=C?e.value():e;return s||(s=new ir),i(k,P,t,n,s)}}return g?(s||(s=new ir),n_(r,e,t,n,i,s)):!1}var cP,s_,o_,ta,hP,a_,l_,u_=_(()=>{qo();Fu();r_();i_();En();rt();qi();Do();cP=1,s_="[object Arguments]",o_="[object Array]",ta="[object Object]",hP=Object.prototype,a_=hP.hasOwnProperty;l_=dP});function c_(r,e,t,n,i){return r===e?!0:r==null||e==null||!Le(r)&&!Le(e)?r!==r&&e!==e:l_(r,e,t,n,c_,i)}var xn,ra=_(()=>{u_();Kt();xn=c_});function mP(r,e,t,n){var i=t.length,s=i,a=!n;if(r==null)return!s;for(r=Object(r);i--;){var l=t[i];if(a&&l[2]?l[1]!==r[l[0]]:!(l[0]in r))return!1}for(;++i<s;){l=t[i];var u=l[0],h=r[u],f=l[1];if(a&&l[2]){if(h===void 0&&!(u in r))return!1}else{var m=new ir;if(n)var g=n(h,f,u,r,e,m);if(!(g===void 0?xn(f,h,fP|pP,n,m):g))return!1}}return!0}var fP,pP,h_,d_=_(()=>{qo();ra();fP=1,pP=2;h_=mP});function gP(r){return r===r&&!ee(r)}var na,Uu=_(()=>{Ge();na=gP});function yP(r){for(var e=Ce(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,na(i)]}return e}var f_,p_=_(()=>{Uu();Ar();f_=yP});function _P(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var ia,Bu=_(()=>{ia=_P});function wP(r){var e=f_(r);return e.length==1&&e[0][2]?ia(e[0][0],e[0][1]):function(t){return t===r||h_(t,r,e)}}var m_,g_=_(()=>{d_();p_();Bu();m_=wP});function vP(r,e){return r!=null&&e in Object(r)}var y_,__=_(()=>{y_=vP});function bP(r,e,t){e=wn(e,r);for(var n=-1,i=e.length,s=!1;++n<i;){var a=lt(e[n]);if(!(s=r!=null&&t(r,a)))break;r=r[a]}return s||++n!=i?s:(i=r==null?0:r.length,!!i&&hn(i)&&Qt(a,i)&&(fe(r)||dn(r)))}var w_,v_=_(()=>{jo();Po();rt();ji();Ro();vn();w_=bP});function TP(r,e){return r!=null&&w_(r,e,y_)}var b_,T_=_(()=>{__();v_();b_=TP});function AP(r,e){return mn(r)&&na(e)?ia(lt(r),e):function(t){var n=Ji(t,r);return n===void 0&&n===e?b_(t,r):xn(e,n,EP|IP)}}var EP,IP,E_,I_=_(()=>{ra();Cu();T_();Lo();Uu();Bu();vn();EP=1,IP=2;E_=AP});function xP(r){return function(e){return e==null?void 0:e[r]}}var A_,x_=_(()=>{A_=xP});function SP(r){return function(e){return Uo(e,r)}}var S_,R_=_(()=>{Pu();S_=SP});function RP(r){return mn(r)?A_(lt(r)):S_(r)}var P_,C_=_(()=>{x_();R_();Lo();vn();P_=RP});function PP(r){return typeof r=="function"?r:r==null?on:typeof r=="object"?fe(r)?E_(r[0],r[1]):m_(r):P_(r)}var k_,D_=_(()=>{g_();I_();To();rt();C_();k_=PP});function CP(r){return function(e,t,n){for(var i=-1,s=Object(e),a=n(e),l=a.length;l--;){var u=a[r?l:++i];if(t(s[u],u,s)===!1)break}return e}}var O_,N_=_(()=>{O_=CP});var kP,V_,L_=_(()=>{N_();kP=O_(),V_=kP});function DP(r,e){return r&&V_(r,e,Ce)}var M_,F_=_(()=>{L_();Ar();M_=DP});var OP,sa,j_=_(()=>{Je();OP=function(){return he.Date.now()},sa=OP});function MP(r,e,t){var n,i,s,a,l,u,h=0,f=!1,m=!1,g=!0;if(typeof r!="function")throw new TypeError(NP);e=_u(e)||0,ee(t)&&(f=!!t.leading,m="maxWait"in t,s=m?VP(_u(t.maxWait)||0,e):s,g="trailing"in t?!!t.trailing:g);function I($){var E=n,y=i;return n=i=void 0,h=$,a=r.apply(y,E),a}function C($){return h=$,l=setTimeout(V,e),f?I($):a}function k($){var E=$-u,y=$-h,b=e-E;return m?LP(b,s-y):b}function P($){var E=$-u,y=$-h;return u===void 0||E>=e||E<0||m&&y>=s}function V(){var $=sa();if(P($))return F($);l=setTimeout(V,k($))}function F($){return l=void 0,g&&n?I($):(n=i=void 0,a)}function B(){l!==void 0&&clearTimeout(l),h=0,n=u=i=l=void 0}function K(){return l===void 0?a:F(sa())}function X(){var $=sa(),E=P($);if(n=arguments,i=this,u=$,E){if(l===void 0)return C(u);if(m)return clearTimeout(l),l=setTimeout(V,e),I(u)}return l===void 0&&(l=setTimeout(V,e)),a}return X.cancel=B,X.flush=K,X}var NP,VP,LP,U_,B_=_(()=>{Ge();j_();jp();NP="Expected a function",VP=Math.max,LP=Math.min;U_=MP});var $_,FP,jP,oa,q_=_(()=>{gm();un();_m();Gi();$_=Object.prototype,FP=$_.hasOwnProperty,jP=mm(function(r,e){r=Object(r);var t=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&ym(e[0],e[1],i)&&(n=1);++t<n;)for(var s=e[t],a=Zt(s),l=-1,u=a.length;++l<u;){var h=a[l],f=r[h];(f===void 0||at(f,$_[h])&&!FP.call(r,h))&&(r[h]=s[h])}return r}),oa=jP});function zP(r){if(r==null)return!0;if(Yt(r)&&(fe(r)||typeof r=="string"||typeof r.splice=="function"||At(r)||pn(r)||dn(r)))return!r.length;var e=nt(r);if(e==UP||e==BP)return!r.size;if(Xt(r))return!Vo(r).length;for(var t in r)if(qP.call(r,t))return!1;return!0}var UP,BP,$P,qP,$u,z_=_(()=>{xu();En();Po();rt();Bi();qi();$i();Do();UP="[object Map]",BP="[object Set]",$P=Object.prototype,qP=$P.hasOwnProperty;$u=zP});function GP(r,e){return xn(r,e)}var qu,G_=_(()=>{ra();qu=GP});function KP(r,e){var t={};return e=k_(e,3),M_(r,function(n,i,s){ln(t,e(n,i,s),n)}),t}var zu,K_=_(()=>{xo();F_();D_();zu=KP});function HP(r,e,t,n){if(!ee(r))return r;e=wn(e,r);for(var i=-1,s=e.length,a=s-1,l=r;l!=null&&++i<s;){var u=lt(e[i]),h=t;if(u==="__proto__"||u==="constructor"||u==="prototype")return r;if(i!=a){var f=l[u];h=n?n(f,u,l):void 0,h===void 0&&(h=ee(f)?f:Qt(e[i+1])?[]:{})}cn(l,u,h),l=l[u]}return r}var H_,W_=_(()=>{So();jo();ji();Ge();vn();H_=HP});function WP(r,e,t){return r==null?r:H_(r,e,t)}var or,Q_=_(()=>{W_();or=WP});function JP(r,e,t){var n=!0,i=!0;if(typeof r!="function")throw new TypeError(QP);return ee(t)&&(n="leading"in t?!!t.leading:n,i="trailing"in t?!!t.trailing:i),U_(r,e,{leading:n,maxWait:e,trailing:i})}var QP,Gu,J_=_(()=>{B_();Ge();QP="Expected a function";Gu=JP});var aa=_(()=>{jy();q_();Cu();z_();G_();Ge();Ar();K_();Q_();J_();});function ZP(){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.")}function rw(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",i=r.iat||0,s=r.sub||r.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");let a=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},r);return[Xi(JSON.stringify(t)),Xi(JSON.stringify(a)),""].join(".")}function nw(){return typeof navigator!="undefined"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function iC(){var r;let e=(r=Hu())===null||r===void 0?void 0:r.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function iw(){return!iC()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Qu(){try{return typeof indexedDB=="object"}catch{return!1}}function sw(){return new Promise((r,e)=>{try{let t=!0,n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=()=>{i.result.close(),t||self.indexedDB.deleteDatabase(n),r(!0)},i.onupgradeneeded=()=>{t=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(t){e(t)}})}function oC(r,e){return r.replace(aC,(t,n)=>{let i=e[n];return i!=null?String(i):`<${n}?>`})}function es(r,e){if(r===e)return!0;let t=Object.keys(r),n=Object.keys(e);for(let i of t){if(!n.includes(i))return!1;let s=r[i],a=e[i];if(Y_(s)&&Y_(a)){if(!es(s,a))return!1}else if(s!==a)return!1}for(let i of n)if(!t.includes(i))return!1;return!0}function Y_(r){return r!==null&&typeof r=="object"}function Pt(r){return r&&r._delegate?r._delegate:r}var X_,YP,Z_,Ku,XP,Xi,ew,eC,tC,rC,Hu,nC,tw,Wu,la,sC,Rt,Zi,aC,NB,ts=_(()=>{X_=function(r){let e=[],t=0;for(let n=0;n<r.length;n++){let i=r.charCodeAt(n);i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&n+1<r.length&&(r.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(r.charCodeAt(++n)&1023),e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128)}return e},YP=function(r){let e=[],t=0,n=0;for(;t<r.length;){let i=r[t++];if(i<128)e[n++]=String.fromCharCode(i);else if(i>191&&i<224){let s=r[t++];e[n++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=r[t++],a=r[t++],l=r[t++],u=((i&7)<<18|(s&63)<<12|(a&63)<<6|l&63)-65536;e[n++]=String.fromCharCode(55296+(u>>10)),e[n++]=String.fromCharCode(56320+(u&1023))}else{let s=r[t++],a=r[t++];e[n++]=String.fromCharCode((i&15)<<12|(s&63)<<6|a&63)}}return e.join("")},Z_={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 i=0;i<r.length;i+=3){let s=r[i],a=i+1<r.length,l=a?r[i+1]:0,u=i+2<r.length,h=u?r[i+2]:0,f=s>>2,m=(s&3)<<4|l>>4,g=(l&15)<<2|h>>6,I=h&63;u||(I=64,a||(g=64)),n.push(t[f],t[m],t[g],t[I])}return n.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(X_(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):YP(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();let t=e?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let i=0;i<r.length;){let s=t[r.charAt(i++)],l=i<r.length?t[r.charAt(i)]:0;++i;let h=i<r.length?t[r.charAt(i)]:64;++i;let m=i<r.length?t[r.charAt(i)]:64;if(++i,s==null||l==null||h==null||m==null)throw new Ku;let g=s<<2|l>>4;if(n.push(g),h!==64){let I=l<<4&240|h>>2;if(n.push(I),m!==64){let C=h<<6&192|m;n.push(C)}}}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)}}},Ku=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},XP=function(r){let e=X_(r);return Z_.encodeByteArray(e,!0)},Xi=function(r){return XP(r).replace(/\./g,"")},ew=function(r){try{return Z_.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};eC=()=>ZP().__FIREBASE_DEFAULTS__,tC=()=>{if(typeof process=="undefined"||typeof process.env=="undefined")return;let r=process.env.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},rC=()=>{if(typeof document=="undefined")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=r&&ew(r[1]);return e&&JSON.parse(e)},Hu=()=>{try{return eC()||tC()||rC()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},nC=r=>{var e,t;return(t=(e=Hu())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[r]},tw=r=>{let e=nC(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]},Wu=()=>{var r;return(r=Hu())===null||r===void 0?void 0:r.config};la=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))}}};sC="FirebaseError",Rt=class r extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name=sC,Object.setPrototypeOf(this,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Zi.prototype.create)}},Zi=class{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){let n=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],a=s?oC(s,n):"Error",l=`${this.serviceName}: ${a} (${i}).`;return new Rt(i,l,n)}};aC=/\{\$([^}]+)}/g;NB=4*60*60*1e3;});function lC(r){return r===Rr?void 0:r}function uC(r){return r.instantiationMode==="EAGER"}var Ct,Rr,Ju,ua,Yu=_(()=>{ts();Ct=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}};Rr="[DEFAULT]";Ju=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 la;if(this.instancesDeferred.set(t,n),this.isInitialized(t)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:t});i&&n.resolve(i)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;let n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),i=(t=e==null?void 0:e.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(s){if(i)return null;throw s}else{if(i)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(uC(e))try{this.getOrInitializeService({instanceIdentifier:Rr})}catch{}for(let[t,n]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(t);try{let s=this.getOrInitializeService({instanceIdentifier:i});n.resolve(s)}catch{}}}}clearInstance(e=Rr){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=Rr){return this.instances.has(e)}getOptions(e=Rr){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 i=this.getOrInitializeService({instanceIdentifier:n,options:t});for(let[s,a]of this.instancesDeferred.entries()){let l=this.normalizeInstanceIdentifier(s);n===l&&a.resolve(i)}return i}onInit(e,t){var n;let i=this.normalizeInstanceIdentifier(t),s=(n=this.onInitCallbacks.get(i))!==null&&n!==void 0?n:new Set;s.add(e),this.onInitCallbacks.set(i,s);let a=this.instances.get(i);return a&&e(a,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){let n=this.onInitCallbacks.get(t);if(n)for(let i of n)try{i(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:lC(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=Rr){return this.component?this.component.multipleInstances?e:Rr:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};ua=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 Ju(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}});var cC,Q,hC,dC,fC,pC,Sn,Xu=_(()=>{cC=[];(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"})(Q||(Q={}));hC={debug:Q.DEBUG,verbose:Q.VERBOSE,info:Q.INFO,warn:Q.WARN,error:Q.ERROR,silent:Q.SILENT},dC=Q.INFO,fC={[Q.DEBUG]:"log",[Q.VERBOSE]:"log",[Q.INFO]:"info",[Q.WARN]:"warn",[Q.ERROR]:"error"},pC=(r,e,...t)=>{if(e<r.logLevel)return;let n=new Date().toISOString(),i=fC[e];if(i)console[i](`[${n}] ${r.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},Sn=class{constructor(e){this.name=e,this._logLevel=dC,this._logHandler=pC,this._userLogHandler=null,cC.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Q))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?hC[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,Q.DEBUG,...e),this._logHandler(this,Q.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Q.VERBOSE,...e),this._logHandler(this,Q.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Q.INFO,...e),this._logHandler(this,Q.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,Q.WARN,...e),this._logHandler(this,Q.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Q.ERROR,...e),this._logHandler(this,Q.ERROR,...e)}}});function gC(){return ow||(ow=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function yC(){return aw||(aw=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}function _C(r){let e=new Promise((t,n)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",a)},s=()=>{t(ut(r.result)),i()},a=()=>{n(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",a)});return e.then(t=>{t instanceof IDBCursor&&lw.set(t,r)}).catch(()=>{}),rc.set(e,r),e}function wC(r){if(ec.has(r))return;let e=new Promise((t,n)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",a),r.removeEventListener("abort",a)},s=()=>{t(),i()},a=()=>{n(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",a),r.addEventListener("abort",a)});ec.set(r,e)}function cw(r){tc=r(tc)}function vC(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let n=r.call(ca(this),e,...t);return uw.set(n,e.sort?e.sort():[e]),ut(n)}:yC().includes(r)?function(...e){return r.apply(ca(this),e),ut(lw.get(this))}:function(...e){return ut(r.apply(ca(this),e))}}function bC(r){return typeof r=="function"?vC(r):(r instanceof IDBTransaction&&wC(r),mC(r,gC())?new Proxy(r,tc):r)}function ut(r){if(r instanceof IDBRequest)return _C(r);if(Zu.has(r))return Zu.get(r);let e=bC(r);return e!==r&&(Zu.set(r,e),rc.set(e,r)),e}var mC,ow,aw,lw,ec,uw,Zu,rc,tc,ca,nc=_(()=>{mC=(r,e)=>e.some(t=>r instanceof t);lw=new WeakMap,ec=new WeakMap,uw=new WeakMap,Zu=new WeakMap,rc=new WeakMap;tc={get(r,e,t){if(r instanceof IDBTransaction){if(e==="done")return ec.get(r);if(e==="objectStoreNames")return r.objectStoreNames||uw.get(r);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return ut(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}};ca=r=>rc.get(r)});function dw(r,e,{blocked:t,upgrade:n,blocking:i,terminated:s}={}){let a=indexedDB.open(r,e),l=ut(a);return n&&a.addEventListener("upgradeneeded",u=>{n(ut(a.result),u.oldVersion,u.newVersion,ut(a.transaction),u)}),t&&a.addEventListener("blocked",u=>t(u.oldVersion,u.newVersion,u)),l.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",h=>i(h.oldVersion,h.newVersion,h))}).catch(()=>{}),l}function hw(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(ic.get(e))return ic.get(e);let t=e.replace(/FromIndex$/,""),n=e!==t,i=EC.includes(t);if(!(t in(n?IDBIndex:IDBObjectStore).prototype)||!(i||TC.includes(t)))return;let s=async function(a,...l){let u=this.transaction(a,i?"readwrite":"readonly"),h=u.store;return n&&(h=h.index(l.shift())),(await Promise.all([h[t](...l),i&&u.done]))[0]};return ic.set(e,s),s}var TC,EC,ic,fw=_(()=>{nc();nc();TC=["get","getKey","getAll","getAllKeys","count"],EC=["put","add","delete","clear"],ic=new Map;cw(r=>({...r,get:(e,t,n)=>hw(e,t)||r.get(e,t,n),has:(e,t)=>!!hw(e,t)||r.has(e,t)}))});function IC(r){let e=r.getComponent();return(e==null?void 0:e.type)==="VERSION"}function mw(r,e){try{r.container.addComponent(e)}catch(t){kt.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,t)}}function rs(r){let e=r.name;if(uc.has(e))return kt.debug(`There were multiple attempts to register component ${e}.`),!1;uc.set(e,r);for(let t of ha.values())mw(t,r);for(let t of ZC.values())mw(t,r);return!0}function ww(r,e){let t=r.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),r.container.getProvider(e)}function vw(r){return r==null?!1:r.settings!==void 0}function fc(r,e={}){let t=r;typeof e!="object"&&(e={name:e});let n=Object.assign({name:lc,automaticDataCollectionEnabled:!1},e),i=n.name;if(typeof i!="string"||!i)throw ar.create("bad-app-name",{appName:String(i)});if(t||(t=Wu()),!t)throw ar.create("no-options");let s=ha.get(i);if(s){if(es(t,s.options)&&es(n,s.config))return s;throw ar.create("duplicate-app",{appName:i})}let a=new ua(i);for(let u of uc.values())a.addComponent(u);let l=new cc(t,n,a);return ha.set(i,l),l}function Tw(r=lc){let e=ha.get(r);if(!e&&r===lc&&Wu())return fc();if(!e)throw ar.create("no-app",{appName:r});return e}function lr(r,e,t){var n;let i=(n=XC[r])!==null&&n!==void 0?n:r;t&&(i+=`-${t}`);let s=i.match(/\s|\//),a=e.match(/\s|\//);if(s||a){let l=[`Unable to register library "${i}" with version "${e}":`];s&&l.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&a&&l.push("and"),a&&l.push(`version name "${e}" contains illegal characters (whitespace or "/")`),kt.warn(l.join(" "));return}rs(new Ct(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}function Ew(){return sc||(sc=dw(tk,rk,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(ns)}catch(t){console.warn(t)}}}}).catch(r=>{throw ar.create("idb-open",{originalErrorMessage:r.message})})),sc}async function nk(r){try{let t=(await Ew()).transaction(ns),n=await t.objectStore(ns).get(Iw(r));return await t.done,n}catch(e){if(e instanceof Rt)kt.warn(e.message);else{let t=ar.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});kt.warn(t.message)}}}async function gw(r,e){try{let n=(await Ew()).transaction(ns,"readwrite");await n.objectStore(ns).put(e,Iw(r)),await n.done}catch(t){if(t instanceof Rt)kt.warn(t.message);else{let n=ar.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});kt.warn(n.message)}}}function Iw(r){return`${r.name}!${r.options.appId}`}function yw(){return new Date().toISOString().substring(0,10)}function ok(r,e=ik){let t=[],n=r.slice();for(let i of r){let s=t.find(a=>a.agent===i.agent);if(s){if(s.dates.push(i.date),_w(t)>e){s.dates.pop();break}}else if(t.push({agent:i.agent,dates:[i.date]}),_w(t)>e){t.pop();break}n=n.slice(1)}return{heartbeatsToSend:t,unsentEntries:n}}function _w(r){return Xi(JSON.stringify({version:2,heartbeats:r})).length}function ak(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 lk(r){rs(new Ct("platform-logger",e=>new oc(e),"PRIVATE")),rs(new Ct("heartbeat",e=>new hc(e),"PRIVATE")),lr(ac,pw,r),lr(ac,pw,"esm2017"),lr("fire-js","")}var oc,ac,pw,kt,AC,xC,SC,RC,PC,CC,kC,DC,OC,NC,VC,LC,MC,FC,jC,UC,BC,$C,qC,zC,GC,KC,HC,WC,QC,JC,YC,lc,XC,ha,ZC,uc,ek,ar,cc,bw,tk,rk,ns,sc,ik,sk,hc,dc,da=_(()=>{Yu();Xu();ts();ts();fw();oc=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(IC(t)){let n=t.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(t=>t).join(" ")}};ac="@firebase/app",pw="0.11.1";kt=new Sn("@firebase/app"),AC="@firebase/app-compat",xC="@firebase/analytics-compat",SC="@firebase/analytics",RC="@firebase/app-check-compat",PC="@firebase/app-check",CC="@firebase/auth",kC="@firebase/auth-compat",DC="@firebase/database",OC="@firebase/data-connect",NC="@firebase/database-compat",VC="@firebase/functions",LC="@firebase/functions-compat",MC="@firebase/installations",FC="@firebase/installations-compat",jC="@firebase/messaging",UC="@firebase/messaging-compat",BC="@firebase/performance",$C="@firebase/performance-compat",qC="@firebase/remote-config",zC="@firebase/remote-config-compat",GC="@firebase/storage",KC="@firebase/storage-compat",HC="@firebase/firestore",WC="@firebase/vertexai",QC="@firebase/firestore-compat",JC="firebase",YC="11.3.1";lc="[DEFAULT]",XC={[ac]:"fire-core",[AC]:"fire-core-compat",[SC]:"fire-analytics",[xC]:"fire-analytics-compat",[PC]:"fire-app-check",[RC]:"fire-app-check-compat",[CC]:"fire-auth",[kC]:"fire-auth-compat",[DC]:"fire-rtdb",[OC]:"fire-data-connect",[NC]:"fire-rtdb-compat",[VC]:"fire-fn",[LC]:"fire-fn-compat",[MC]:"fire-iid",[FC]:"fire-iid-compat",[jC]:"fire-fcm",[UC]:"fire-fcm-compat",[BC]:"fire-perf",[$C]:"fire-perf-compat",[qC]:"fire-rc",[zC]:"fire-rc-compat",[GC]:"fire-gcs",[KC]:"fire-gcs-compat",[HC]:"fire-fst",[QC]:"fire-fst-compat",[WC]:"fire-vertex","fire-js":"fire-js",[JC]:"fire-js-all"};ha=new Map,ZC=new Map,uc=new Map;ek={"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."},ar=new Zi("app","Firebase",ek);cc=class{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new Ct("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 ar.create("app-deleted",{appName:this._name})}};bw=YC;tk="firebase-heartbeat-database",rk=1,ns="firebase-heartbeat-store",sc=null;ik=1024,sk=30,hc=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new dc(t),this._heartbeatsCachePromise=this._storage.read().then(n=>(this._heartbeatsCache=n,n))}async triggerHeartbeat(){var e,t;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=yw();if(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(a=>a.date===s))return;if(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats.length>sk){let a=ak(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(a,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(n){kt.warn(n)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let t=yw(),{heartbeatsToSend:n,unsentEntries:i}=ok(this._heartbeatsCache.heartbeats),s=Xi(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return kt.warn(t),""}}};dc=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Qu()?sw().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let t=await nk(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){let i=await this.read();return gw(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){let i=await this.read();return gw(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};lk("")});var Aw,xw,Dt,pc,Sw=_(()=>{Aw=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},xw={};(function(){var r;function e(E,y){function b(){}b.prototype=y.prototype,E.D=y.prototype,E.prototype=new b,E.prototype.constructor=E,E.C=function(T,A,S){for(var w=Array(arguments.length-2),bt=2;bt<arguments.length;bt++)w[bt-2]=arguments[bt];return y.prototype[A].apply(T,w)}}function t(){this.blockSize=-1}function n(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(n,t),n.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function i(E,y,b){b||(b=0);var T=Array(16);if(typeof y=="string")for(var A=0;16>A;++A)T[A]=y.charCodeAt(b++)|y.charCodeAt(b++)<<8|y.charCodeAt(b++)<<16|y.charCodeAt(b++)<<24;else for(A=0;16>A;++A)T[A]=y[b++]|y[b++]<<8|y[b++]<<16|y[b++]<<24;y=E.g[0],b=E.g[1],A=E.g[2];var S=E.g[3],w=y+(S^b&(A^S))+T[0]+3614090360&4294967295;y=b+(w<<7&4294967295|w>>>25),w=S+(A^y&(b^A))+T[1]+3905402710&4294967295,S=y+(w<<12&4294967295|w>>>20),w=A+(b^S&(y^b))+T[2]+606105819&4294967295,A=S+(w<<17&4294967295|w>>>15),w=b+(y^A&(S^y))+T[3]+3250441966&4294967295,b=A+(w<<22&4294967295|w>>>10),w=y+(S^b&(A^S))+T[4]+4118548399&4294967295,y=b+(w<<7&4294967295|w>>>25),w=S+(A^y&(b^A))+T[5]+1200080426&4294967295,S=y+(w<<12&4294967295|w>>>20),w=A+(b^S&(y^b))+T[6]+2821735955&4294967295,A=S+(w<<17&4294967295|w>>>15),w=b+(y^A&(S^y))+T[7]+4249261313&4294967295,b=A+(w<<22&4294967295|w>>>10),w=y+(S^b&(A^S))+T[8]+1770035416&4294967295,y=b+(w<<7&4294967295|w>>>25),w=S+(A^y&(b^A))+T[9]+2336552879&4294967295,S=y+(w<<12&4294967295|w>>>20),w=A+(b^S&(y^b))+T[10]+4294925233&4294967295,A=S+(w<<17&4294967295|w>>>15),w=b+(y^A&(S^y))+T[11]+2304563134&4294967295,b=A+(w<<22&4294967295|w>>>10),w=y+(S^b&(A^S))+T[12]+1804603682&4294967295,y=b+(w<<7&4294967295|w>>>25),w=S+(A^y&(b^A))+T[13]+4254626195&4294967295,S=y+(w<<12&4294967295|w>>>20),w=A+(b^S&(y^b))+T[14]+2792965006&4294967295,A=S+(w<<17&4294967295|w>>>15),w=b+(y^A&(S^y))+T[15]+1236535329&4294967295,b=A+(w<<22&4294967295|w>>>10),w=y+(A^S&(b^A))+T[1]+4129170786&4294967295,y=b+(w<<5&4294967295|w>>>27),w=S+(b^A&(y^b))+T[6]+3225465664&4294967295,S=y+(w<<9&4294967295|w>>>23),w=A+(y^b&(S^y))+T[11]+643717713&4294967295,A=S+(w<<14&4294967295|w>>>18),w=b+(S^y&(A^S))+T[0]+3921069994&4294967295,b=A+(w<<20&4294967295|w>>>12),w=y+(A^S&(b^A))+T[5]+3593408605&4294967295,y=b+(w<<5&4294967295|w>>>27),w=S+(b^A&(y^b))+T[10]+38016083&4294967295,S=y+(w<<9&4294967295|w>>>23),w=A+(y^b&(S^y))+T[15]+3634488961&4294967295,A=S+(w<<14&4294967295|w>>>18),w=b+(S^y&(A^S))+T[4]+3889429448&4294967295,b=A+(w<<20&4294967295|w>>>12),w=y+(A^S&(b^A))+T[9]+568446438&4294967295,y=b+(w<<5&4294967295|w>>>27),w=S+(b^A&(y^b))+T[14]+3275163606&4294967295,S=y+(w<<9&4294967295|w>>>23),w=A+(y^b&(S^y))+T[3]+4107603335&4294967295,A=S+(w<<14&4294967295|w>>>18),w=b+(S^y&(A^S))+T[8]+1163531501&4294967295,b=A+(w<<20&4294967295|w>>>12),w=y+(A^S&(b^A))+T[13]+2850285829&4294967295,y=b+(w<<5&4294967295|w>>>27),w=S+(b^A&(y^b))+T[2]+4243563512&4294967295,S=y+(w<<9&4294967295|w>>>23),w=A+(y^b&(S^y))+T[7]+1735328473&4294967295,A=S+(w<<14&4294967295|w>>>18),w=b+(S^y&(A^S))+T[12]+2368359562&4294967295,b=A+(w<<20&4294967295|w>>>12),w=y+(b^A^S)+T[5]+4294588738&4294967295,y=b+(w<<4&4294967295|w>>>28),w=S+(y^b^A)+T[8]+2272392833&4294967295,S=y+(w<<11&4294967295|w>>>21),w=A+(S^y^b)+T[11]+1839030562&4294967295,A=S+(w<<16&4294967295|w>>>16),w=b+(A^S^y)+T[14]+4259657740&4294967295,b=A+(w<<23&4294967295|w>>>9),w=y+(b^A^S)+T[1]+2763975236&4294967295,y=b+(w<<4&4294967295|w>>>28),w=S+(y^b^A)+T[4]+1272893353&4294967295,S=y+(w<<11&4294967295|w>>>21),w=A+(S^y^b)+T[7]+4139469664&4294967295,A=S+(w<<16&4294967295|w>>>16),w=b+(A^S^y)+T[10]+3200236656&4294967295,b=A+(w<<23&4294967295|w>>>9),w=y+(b^A^S)+T[13]+681279174&4294967295,y=b+(w<<4&4294967295|w>>>28),w=S+(y^b^A)+T[0]+3936430074&4294967295,S=y+(w<<11&4294967295|w>>>21),w=A+(S^y^b)+T[3]+3572445317&4294967295,A=S+(w<<16&4294967295|w>>>16),w=b+(A^S^y)+T[6]+76029189&4294967295,b=A+(w<<23&4294967295|w>>>9),w=y+(b^A^S)+T[9]+3654602809&4294967295,y=b+(w<<4&4294967295|w>>>28),w=S+(y^b^A)+T[12]+3873151461&4294967295,S=y+(w<<11&4294967295|w>>>21),w=A+(S^y^b)+T[15]+530742520&4294967295,A=S+(w<<16&4294967295|w>>>16),w=b+(A^S^y)+T[2]+3299628645&4294967295,b=A+(w<<23&4294967295|w>>>9),w=y+(A^(b|~S))+T[0]+4096336452&4294967295,y=b+(w<<6&4294967295|w>>>26),w=S+(b^(y|~A))+T[7]+1126891415&4294967295,S=y+(w<<10&4294967295|w>>>22),w=A+(y^(S|~b))+T[14]+2878612391&4294967295,A=S+(w<<15&4294967295|w>>>17),w=b+(S^(A|~y))+T[5]+4237533241&4294967295,b=A+(w<<21&4294967295|w>>>11),w=y+(A^(b|~S))+T[12]+1700485571&4294967295,y=b+(w<<6&4294967295|w>>>26),w=S+(b^(y|~A))+T[3]+2399980690&4294967295,S=y+(w<<10&4294967295|w>>>22),w=A+(y^(S|~b))+T[10]+4293915773&4294967295,A=S+(w<<15&4294967295|w>>>17),w=b+(S^(A|~y))+T[1]+2240044497&4294967295,b=A+(w<<21&4294967295|w>>>11),w=y+(A^(b|~S))+T[8]+1873313359&4294967295,y=b+(w<<6&4294967295|w>>>26),w=S+(b^(y|~A))+T[15]+4264355552&4294967295,S=y+(w<<10&4294967295|w>>>22),w=A+(y^(S|~b))+T[6]+2734768916&4294967295,A=S+(w<<15&4294967295|w>>>17),w=b+(S^(A|~y))+T[13]+1309151649&4294967295,b=A+(w<<21&4294967295|w>>>11),w=y+(A^(b|~S))+T[4]+4149444226&4294967295,y=b+(w<<6&4294967295|w>>>26),w=S+(b^(y|~A))+T[11]+3174756917&4294967295,S=y+(w<<10&4294967295|w>>>22),w=A+(y^(S|~b))+T[2]+718787259&4294967295,A=S+(w<<15&4294967295|w>>>17),w=b+(S^(A|~y))+T[9]+3951481745&4294967295,E.g[0]=E.g[0]+y&4294967295,E.g[1]=E.g[1]+(A+(w<<21&4294967295|w>>>11))&4294967295,E.g[2]=E.g[2]+A&4294967295,E.g[3]=E.g[3]+S&4294967295}n.prototype.u=function(E,y){y===void 0&&(y=E.length);for(var b=y-this.blockSize,T=this.B,A=this.h,S=0;S<y;){if(A==0)for(;S<=b;)i(this,E,S),S+=this.blockSize;if(typeof E=="string"){for(;S<y;)if(T[A++]=E.charCodeAt(S++),A==this.blockSize){i(this,T),A=0;break}}else for(;S<y;)if(T[A++]=E[S++],A==this.blockSize){i(this,T),A=0;break}}this.h=A,this.o+=y},n.prototype.v=function(){var E=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);E[0]=128;for(var y=1;y<E.length-8;++y)E[y]=0;var b=8*this.o;for(y=E.length-8;y<E.length;++y)E[y]=b&255,b/=256;for(this.u(E),E=Array(16),y=b=0;4>y;++y)for(var T=0;32>T;T+=8)E[b++]=this.g[y]>>>T&255;return E};function s(E,y){var b=l;return Object.prototype.hasOwnProperty.call(b,E)?b[E]:b[E]=y(E)}function a(E,y){this.h=y;for(var b=[],T=!0,A=E.length-1;0<=A;A--){var S=E[A]|0;T&&S==y||(b[A]=S,T=!1)}this.g=b}var l={};function u(E){return-128<=E&&128>E?s(E,function(y){return new a([y|0],0>y?-1:0)}):new a([E|0],0>E?-1:0)}function h(E){if(isNaN(E)||!isFinite(E))return m;if(0>E)return P(h(-E));for(var y=[],b=1,T=0;E>=b;T++)y[T]=E/b|0,b*=4294967296;return new a(y,0)}function f(E,y){if(E.length==0)throw Error("number format error: empty string");if(y=y||10,2>y||36<y)throw Error("radix out of range: "+y);if(E.charAt(0)=="-")return P(f(E.substring(1),y));if(0<=E.indexOf("-"))throw Error('number format error: interior "-" character');for(var b=h(Math.pow(y,8)),T=m,A=0;A<E.length;A+=8){var S=Math.min(8,E.length-A),w=parseInt(E.substring(A,A+S),y);8>S?(S=h(Math.pow(y,S)),T=T.j(S).add(h(w))):(T=T.j(b),T=T.add(h(w)))}return T}var m=u(0),g=u(1),I=u(16777216);r=a.prototype,r.m=function(){if(k(this))return-P(this).m();for(var E=0,y=1,b=0;b<this.g.length;b++){var T=this.i(b);E+=(0<=T?T:4294967296+T)*y,y*=4294967296}return E},r.toString=function(E){if(E=E||10,2>E||36<E)throw Error("radix out of range: "+E);if(C(this))return"0";if(k(this))return"-"+P(this).toString(E);for(var y=h(Math.pow(E,6)),b=this,T="";;){var A=K(b,y).g;b=V(b,A.j(y));var S=((0<b.g.length?b.g[0]:b.h)>>>0).toString(E);if(b=A,C(b))return S+T;for(;6>S.length;)S="0"+S;T=S+T}},r.i=function(E){return 0>E?0:E<this.g.length?this.g[E]:this.h};function C(E){if(E.h!=0)return!1;for(var y=0;y<E.g.length;y++)if(E.g[y]!=0)return!1;return!0}function k(E){return E.h==-1}r.l=function(E){return E=V(this,E),k(E)?-1:C(E)?0:1};function P(E){for(var y=E.g.length,b=[],T=0;T<y;T++)b[T]=~E.g[T];return new a(b,~E.h).add(g)}r.abs=function(){return k(this)?P(this):this},r.add=function(E){for(var y=Math.max(this.g.length,E.g.length),b=[],T=0,A=0;A<=y;A++){var S=T+(this.i(A)&65535)+(E.i(A)&65535),w=(S>>>16)+(this.i(A)>>>16)+(E.i(A)>>>16);T=w>>>16,S&=65535,w&=65535,b[A]=w<<16|S}return new a(b,b[b.length-1]&-2147483648?-1:0)};function V(E,y){return E.add(P(y))}r.j=function(E){if(C(this)||C(E))return m;if(k(this))return k(E)?P(this).j(P(E)):P(P(this).j(E));if(k(E))return P(this.j(P(E)));if(0>this.l(I)&&0>E.l(I))return h(this.m()*E.m());for(var y=this.g.length+E.g.length,b=[],T=0;T<2*y;T++)b[T]=0;for(T=0;T<this.g.length;T++)for(var A=0;A<E.g.length;A++){var S=this.i(T)>>>16,w=this.i(T)&65535,bt=E.i(A)>>>16,yi=E.i(A)&65535;b[2*T+2*A]+=w*yi,F(b,2*T+2*A),b[2*T+2*A+1]+=S*yi,F(b,2*T+2*A+1),b[2*T+2*A+1]+=w*bt,F(b,2*T+2*A+1),b[2*T+2*A+2]+=S*bt,F(b,2*T+2*A+2)}for(T=0;T<y;T++)b[T]=b[2*T+1]<<16|b[2*T];for(T=y;T<2*y;T++)b[T]=0;return new a(b,0)};function F(E,y){for(;(E[y]&65535)!=E[y];)E[y+1]+=E[y]>>>16,E[y]&=65535,y++}function B(E,y){this.g=E,this.h=y}function K(E,y){if(C(y))throw Error("division by zero");if(C(E))return new B(m,m);if(k(E))return y=K(P(E),y),new B(P(y.g),P(y.h));if(k(y))return y=K(E,P(y)),new B(P(y.g),y.h);if(30<E.g.length){if(k(E)||k(y))throw Error("slowDivide_ only works with positive integers.");for(var b=g,T=y;0>=T.l(E);)b=X(b),T=X(T);var A=$(b,1),S=$(T,1);for(T=$(T,2),b=$(b,2);!C(T);){var w=S.add(T);0>=w.l(E)&&(A=A.add(b),S=w),T=$(T,1),b=$(b,1)}return y=V(E,A.j(y)),new B(A,y)}for(A=m;0<=E.l(y);){for(b=Math.max(1,Math.floor(E.m()/y.m())),T=Math.ceil(Math.log(b)/Math.LN2),T=48>=T?1:Math.pow(2,T-48),S=h(b),w=S.j(y);k(w)||0<w.l(E);)b-=T,S=h(b),w=S.j(y);C(S)&&(S=g),A=A.add(S),E=V(E,w)}return new B(A,E)}r.A=function(E){return K(this,E).h},r.and=function(E){for(var y=Math.max(this.g.length,E.g.length),b=[],T=0;T<y;T++)b[T]=this.i(T)&E.i(T);return new a(b,this.h&E.h)},r.or=function(E){for(var y=Math.max(this.g.length,E.g.length),b=[],T=0;T<y;T++)b[T]=this.i(T)|E.i(T);return new a(b,this.h|E.h)},r.xor=function(E){for(var y=Math.max(this.g.length,E.g.length),b=[],T=0;T<y;T++)b[T]=this.i(T)^E.i(T);return new a(b,this.h^E.h)};function X(E){for(var y=E.g.length+1,b=[],T=0;T<y;T++)b[T]=E.i(T)<<1|E.i(T-1)>>>31;return new a(b,E.h)}function $(E,y){var b=y>>5;y%=32;for(var T=E.g.length-b,A=[],S=0;S<T;S++)A[S]=0<y?E.i(S+b)>>>y|E.i(S+b+1)<<32-y:E.i(S+b);return new a(A,E.h)}n.prototype.digest=n.prototype.v,n.prototype.reset=n.prototype.s,n.prototype.update=n.prototype.u,pc=xw.Md5=n,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.A,a.prototype.compare=a.prototype.l,a.prototype.toNumber=a.prototype.m,a.prototype.toString=a.prototype.toString,a.prototype.getBits=a.prototype.i,a.fromNumber=h,a.fromString=f,Dt=xw.Integer=a}).apply(typeof Aw!="undefined"?Aw:typeof self!="undefined"?self:typeof window!="undefined"?window:{})});var fa,Ot,mc,hk,Rn,gc,is,pa,yc,_c,wc,Rw=_(()=>{fa=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Ot={};(function(){var r,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(o,c,d){return o==Array.prototype||o==Object.prototype||(o[c]=d.value),o};function t(o){o=[typeof globalThis=="object"&&globalThis,o,typeof window=="object"&&window,typeof self=="object"&&self,typeof fa=="object"&&fa];for(var c=0;c<o.length;++c){var d=o[c];if(d&&d.Math==Math)return d}throw Error("Cannot find global object")}var n=t(this);function i(o,c){if(c)e:{var d=n;o=o.split(".");for(var p=0;p<o.length-1;p++){var x=o[p];if(!(x in d))break e;d=d[x]}o=o[o.length-1],p=d[o],c=c(p),c!=p&&c!=null&&e(d,o,{configurable:!0,writable:!0,value:c})}}function s(o,c){o instanceof String&&(o+="");var d=0,p=!1,x={next:function(){if(!p&&d<o.length){var R=d++;return{value:c(R,o[R]),done:!1}}return p=!0,{done:!0,value:void 0}}};return x[Symbol.iterator]=function(){return x},x}i("Array.prototype.values",function(o){return o||function(){return s(this,function(c,d){return d})}});var a=a||{},l=this||self;function u(o){var c=typeof o;return c=c!="object"?c:o?Array.isArray(o)?"array":c:"null",c=="array"||c=="object"&&typeof o.length=="number"}function h(o){var c=typeof o;return c=="object"&&o!=null||c=="function"}function f(o,c,d){return o.call.apply(o.bind,arguments)}function m(o,c,d){if(!o)throw Error();if(2<arguments.length){var p=Array.prototype.slice.call(arguments,2);return function(){var x=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(x,p),o.apply(c,x)}}return function(){return o.apply(c,arguments)}}function g(o,c,d){return g=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?f:m,g.apply(null,arguments)}function I(o,c){var d=Array.prototype.slice.call(arguments,1);return function(){var p=d.slice();return p.push.apply(p,arguments),o.apply(this,p)}}function C(o,c){function d(){}d.prototype=c.prototype,o.aa=c.prototype,o.prototype=new d,o.prototype.constructor=o,o.Qb=function(p,x,R){for(var N=Array(arguments.length-2),ne=2;ne<arguments.length;ne++)N[ne-2]=arguments[ne];return c.prototype[x].apply(p,N)}}function k(o){let c=o.length;if(0<c){let d=Array(c);for(let p=0;p<c;p++)d[p]=o[p];return d}return[]}function P(o,c){for(let d=1;d<arguments.length;d++){let p=arguments[d];if(u(p)){let x=o.length||0,R=p.length||0;o.length=x+R;for(let N=0;N<R;N++)o[x+N]=p[N]}else o.push(p)}}class V{constructor(c,d){this.i=c,this.j=d,this.h=0,this.g=null}get(){let c;return 0<this.h?(this.h--,c=this.g,this.g=c.next,c.next=null):c=this.i(),c}}function F(o){return/^[\s\xa0]*$/.test(o)}function B(){var o=l.navigator;return o&&(o=o.userAgent)?o:""}function K(o){return K[" "](o),o}K[" "]=function(){};var X=B().indexOf("Gecko")!=-1&&!(B().toLowerCase().indexOf("webkit")!=-1&&B().indexOf("Edge")==-1)&&!(B().indexOf("Trident")!=-1||B().indexOf("MSIE")!=-1)&&B().indexOf("Edge")==-1;function $(o,c,d){for(let p in o)c.call(d,o[p],p,o)}function E(o,c){for(let d in o)c.call(void 0,o[d],d,o)}function y(o){let c={};for(let d in o)c[d]=o[d];return c}let b="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function T(o,c){let d,p;for(let x=1;x<arguments.length;x++){p=arguments[x];for(d in p)o[d]=p[d];for(let R=0;R<b.length;R++)d=b[R],Object.prototype.hasOwnProperty.call(p,d)&&(o[d]=p[d])}}function A(o){var c=1;o=o.split(":");let d=[];for(;0<c&&o.length;)d.push(o.shift()),c--;return o.length&&d.push(o.join(":")),d}function S(o){l.setTimeout(()=>{throw o},0)}function w(){var o=Kl;let c=null;return o.g&&(c=o.g,o.g=o.g.next,o.g||(o.h=null),c.next=null),c}class bt{constructor(){this.h=this.g=null}add(c,d){let p=yi.get();p.set(c,d),this.h?this.h.next=p:this.g=p,this.h=p}}var yi=new V(()=>new zE,o=>o.reset());class zE{constructor(){this.next=this.g=this.h=null}set(c,d){this.h=c,this.g=d,this.next=null}reset(){this.next=this.g=this.h=null}}let _i,wi=!1,Kl=new bt,_f=()=>{let o=l.Promise.resolve(void 0);_i=()=>{o.then(GE)}};var GE=()=>{for(var o;o=w();){try{o.h.call(o.g)}catch(d){S(d)}var c=yi;c.j(o),100>c.h&&(c.h++,o.next=c.g,c.g=o)}wi=!1};function $t(){this.s=this.s,this.C=this.C}$t.prototype.s=!1,$t.prototype.ma=function(){this.s||(this.s=!0,this.N())},$t.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function xe(o,c){this.type=o,this.g=this.target=c,this.defaultPrevented=!1}xe.prototype.h=function(){this.defaultPrevented=!0};var KE=function(){if(!l.addEventListener||!Object.defineProperty)return!1;var o=!1,c=Object.defineProperty({},"passive",{get:function(){o=!0}});try{let d=()=>{};l.addEventListener("test",d,c),l.removeEventListener("test",d,c)}catch{}return o}();function vi(o,c){if(xe.call(this,o?o.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,o){var d=this.type=o.type,p=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:null;if(this.target=o.target||o.srcElement,this.g=c,c=o.relatedTarget){if(X){e:{try{K(c.nodeName);var x=!0;break e}catch{}x=!1}x||(c=null)}}else d=="mouseover"?c=o.fromElement:d=="mouseout"&&(c=o.toElement);this.relatedTarget=c,p?(this.clientX=p.clientX!==void 0?p.clientX:p.pageX,this.clientY=p.clientY!==void 0?p.clientY:p.pageY,this.screenX=p.screenX||0,this.screenY=p.screenY||0):(this.clientX=o.clientX!==void 0?o.clientX:o.pageX,this.clientY=o.clientY!==void 0?o.clientY:o.pageY,this.screenX=o.screenX||0,this.screenY=o.screenY||0),this.button=o.button,this.key=o.key||"",this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.pointerId=o.pointerId||0,this.pointerType=typeof o.pointerType=="string"?o.pointerType:HE[o.pointerType]||"",this.state=o.state,this.i=o,o.defaultPrevented&&vi.aa.h.call(this)}}C(vi,xe);var HE={2:"touch",3:"pen",4:"mouse"};vi.prototype.h=function(){vi.aa.h.call(this);var o=this.i;o.preventDefault?o.preventDefault():o.returnValue=!1};var bi="closure_listenable_"+(1e6*Math.random()|0),WE=0;function QE(o,c,d,p,x){this.listener=o,this.proxy=null,this.src=c,this.type=d,this.capture=!!p,this.ha=x,this.key=++WE,this.da=this.fa=!1}function no(o){o.da=!0,o.listener=null,o.proxy=null,o.src=null,o.ha=null}function io(o){this.src=o,this.g={},this.h=0}io.prototype.add=function(o,c,d,p,x){var R=o.toString();o=this.g[R],o||(o=this.g[R]=[],this.h++);var N=Wl(o,c,p,x);return-1<N?(c=o[N],d||(c.fa=!1)):(c=new QE(c,this.src,R,!!p,x),c.fa=d,o.push(c)),c};function Hl(o,c){var d=c.type;if(d in o.g){var p=o.g[d],x=Array.prototype.indexOf.call(p,c,void 0),R;(R=0<=x)&&Array.prototype.splice.call(p,x,1),R&&(no(c),o.g[d].length==0&&(delete o.g[d],o.h--))}}function Wl(o,c,d,p){for(var x=0;x<o.length;++x){var R=o[x];if(!R.da&&R.listener==c&&R.capture==!!d&&R.ha==p)return x}return-1}var Ql="closure_lm_"+(1e6*Math.random()|0),Jl={};function wf(o,c,d,p,x){if(p&&p.once)return bf(o,c,d,p,x);if(Array.isArray(c)){for(var R=0;R<c.length;R++)wf(o,c[R],d,p,x);return null}return d=eu(d),o&&o[bi]?o.K(c,d,h(p)?!!p.capture:!!p,x):vf(o,c,d,!1,p,x)}function vf(o,c,d,p,x,R){if(!c)throw Error("Invalid event type");var N=h(x)?!!x.capture:!!x,ne=Xl(o);if(ne||(o[Ql]=ne=new io(o)),d=ne.add(c,d,p,N,R),d.proxy)return d;if(p=JE(),d.proxy=p,p.src=o,p.listener=d,o.addEventListener)KE||(x=N),x===void 0&&(x=!1),o.addEventListener(c.toString(),p,x);else if(o.attachEvent)o.attachEvent(Ef(c.toString()),p);else if(o.addListener&&o.removeListener)o.addListener(p);else throw Error("addEventListener and attachEvent are unavailable.");return d}function JE(){function o(d){return c.call(o.src,o.listener,d)}let c=YE;return o}function bf(o,c,d,p,x){if(Array.isArray(c)){for(var R=0;R<c.length;R++)bf(o,c[R],d,p,x);return null}return d=eu(d),o&&o[bi]?o.L(c,d,h(p)?!!p.capture:!!p,x):vf(o,c,d,!0,p,x)}function Tf(o,c,d,p,x){if(Array.isArray(c))for(var R=0;R<c.length;R++)Tf(o,c[R],d,p,x);else p=h(p)?!!p.capture:!!p,d=eu(d),o&&o[bi]?(o=o.i,c=String(c).toString(),c in o.g&&(R=o.g[c],d=Wl(R,d,p,x),-1<d&&(no(R[d]),Array.prototype.splice.call(R,d,1),R.length==0&&(delete o.g[c],o.h--)))):o&&(o=Xl(o))&&(c=o.g[c.toString()],o=-1,c&&(o=Wl(c,d,p,x)),(d=-1<o?c[o]:null)&&Yl(d))}function Yl(o){if(typeof o!="number"&&o&&!o.da){var c=o.src;if(c&&c[bi])Hl(c.i,o);else{var d=o.type,p=o.proxy;c.removeEventListener?c.removeEventListener(d,p,o.capture):c.detachEvent?c.detachEvent(Ef(d),p):c.addListener&&c.removeListener&&c.removeListener(p),(d=Xl(c))?(Hl(d,o),d.h==0&&(d.src=null,c[Ql]=null)):no(o)}}}function Ef(o){return o in Jl?Jl[o]:Jl[o]="on"+o}function YE(o,c){if(o.da)o=!0;else{c=new vi(c,this);var d=o.listener,p=o.ha||o.src;o.fa&&Yl(o),o=d.call(p,c)}return o}function Xl(o){return o=o[Ql],o instanceof io?o:null}var Zl="__closure_events_fn_"+(1e9*Math.random()>>>0);function eu(o){return typeof o=="function"?o:(o[Zl]||(o[Zl]=function(c){return o.handleEvent(c)}),o[Zl])}function Se(){$t.call(this),this.i=new io(this),this.M=this,this.F=null}C(Se,$t),Se.prototype[bi]=!0,Se.prototype.removeEventListener=function(o,c,d,p){Tf(this,o,c,d,p)};function Oe(o,c){var d,p=o.F;if(p)for(d=[];p;p=p.F)d.push(p);if(o=o.M,p=c.type||c,typeof c=="string")c=new xe(c,o);else if(c instanceof xe)c.target=c.target||o;else{var x=c;c=new xe(p,o),T(c,x)}if(x=!0,d)for(var R=d.length-1;0<=R;R--){var N=c.g=d[R];x=so(N,p,!0,c)&&x}if(N=c.g=o,x=so(N,p,!0,c)&&x,x=so(N,p,!1,c)&&x,d)for(R=0;R<d.length;R++)N=c.g=d[R],x=so(N,p,!1,c)&&x}Se.prototype.N=function(){if(Se.aa.N.call(this),this.i){var o=this.i,c;for(c in o.g){for(var d=o.g[c],p=0;p<d.length;p++)no(d[p]);delete o.g[c],o.h--}}this.F=null},Se.prototype.K=function(o,c,d,p){return this.i.add(String(o),c,!1,d,p)},Se.prototype.L=function(o,c,d,p){return this.i.add(String(o),c,!0,d,p)};function so(o,c,d,p){if(c=o.i.g[String(c)],!c)return!0;c=c.concat();for(var x=!0,R=0;R<c.length;++R){var N=c[R];if(N&&!N.da&&N.capture==d){var ne=N.listener,Te=N.ha||N.src;N.fa&&Hl(o.i,N),x=ne.call(Te,p)!==!1&&x}}return x&&!p.defaultPrevented}function If(o,c,d){if(typeof o=="function")d&&(o=g(o,d));else if(o&&typeof o.handleEvent=="function")o=g(o.handleEvent,o);else throw Error("Invalid listener argument");return 2147483647<Number(c)?-1:l.setTimeout(o,c||0)}function Af(o){o.g=If(()=>{o.g=null,o.i&&(o.i=!1,Af(o))},o.l);let c=o.h;o.h=null,o.m.apply(null,c)}class XE extends $t{constructor(c,d){super(),this.m=c,this.l=d,this.h=null,this.i=!1,this.g=null}j(c){this.h=arguments,this.g?this.i=!0:Af(this)}N(){super.N(),this.g&&(l.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Ti(o){$t.call(this),this.h=o,this.g={}}C(Ti,$t);var xf=[];function Sf(o){$(o.g,function(c,d){this.g.hasOwnProperty(d)&&Yl(c)},o),o.g={}}Ti.prototype.N=function(){Ti.aa.N.call(this),Sf(this)},Ti.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var tu=l.JSON.stringify,ZE=l.JSON.parse,e0=class{stringify(o){return l.JSON.stringify(o,void 0)}parse(o){return l.JSON.parse(o,void 0)}};function ru(){}ru.prototype.h=null;function Rf(o){return o.h||(o.h=o.i())}function Pf(){}var Ei={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function nu(){xe.call(this,"d")}C(nu,xe);function iu(){xe.call(this,"c")}C(iu,xe);var vr={},Cf=null;function oo(){return Cf=Cf||new Se}vr.La="serverreachability";function kf(o){xe.call(this,vr.La,o)}C(kf,xe);function Ii(o){let c=oo();Oe(c,new kf(c))}vr.STAT_EVENT="statevent";function Df(o,c){xe.call(this,vr.STAT_EVENT,o),this.stat=c}C(Df,xe);function Ne(o){let c=oo();Oe(c,new Df(c,o))}vr.Ma="timingevent";function Of(o,c){xe.call(this,vr.Ma,o),this.size=c}C(Of,xe);function Ai(o,c){if(typeof o!="function")throw Error("Fn must not be null and must be a function");return l.setTimeout(function(){o()},c)}function xi(){this.g=!0}xi.prototype.xa=function(){this.g=!1};function t0(o,c,d,p,x,R){o.info(function(){if(o.g)if(R)for(var N="",ne=R.split("&"),Te=0;Te<ne.length;Te++){var Z=ne[Te].split("=");if(1<Z.length){var Re=Z[0];Z=Z[1];var Pe=Re.split("_");N=2<=Pe.length&&Pe[1]=="type"?N+(Re+"="+Z+"&"):N+(Re+"=redacted&")}}else N=null;else N=R;return"XMLHTTP REQ ("+p+") [attempt "+x+"]: "+c+`
|
|
2
2
|
`+d+`
|
|
3
|
-
`+
|
|
3
|
+
`+N})}function r0(o,c,d,p,x,R,N){o.info(function(){return"XMLHTTP RESP ("+p+") [ attempt "+x+"]: "+c+`
|
|
4
4
|
`+d+`
|
|
5
|
-
`+
|
|
6
|
-
`,d);return p==-1?Ha:(d=Number(l.substring(d,p)),isNaN(d)?Bh:(p+=1,p+d>l.length?Ha:(l=l.slice(p,p+d),o.C=p+d,l)))}Dt.prototype.cancel=function(){this.J=!0,ar(this)};function Ii(o){o.S=Date.now()+o.I,zh(o,o.I)}function zh(o,l){if(o.B!=null)throw Error("WatchDog timer not null");o.B=ts(g(o.ba,o),l)}function Qa(o){o.B&&(u.clearTimeout(o.B),o.B=null)}Dt.prototype.ba=function(){this.B=null;let o=Date.now();0<=o-this.S?(pv(this.i,this.A),this.L!=2&&(es(),ke(17)),ar(this),this.s=2,ns(this)):zh(this,this.S-o)};function ns(o){o.j.G==0||o.J||gd(o.j,o)}function ar(o){Qa(o);var l=o.M;l&&typeof l.ma=="function"&&l.ma(),o.M=null,Dh(o.U),o.g&&(l=o.g,o.g=null,l.abort(),l.ma())}function Ja(o,l){try{var d=o.j;if(d.G!=0&&(d.g==o||Ya(d.h,o))){if(!o.K&&Ya(d.h,o)&&d.G==3){try{var p=d.Da.g.parse(l)}catch{p=null}if(Array.isArray(p)&&p.length==3){var x=p;if(x[0]==0){e:if(!d.u){if(d.g)if(d.g.F+3e3<o.F)Di(d),Ci(d);else break e;tu(d),ke(18)}}else d.za=x[1],0<d.za-d.T&&37500>x[2]&&d.F&&d.v==0&&!d.C&&(d.C=ts(g(d.Za,d),6e3));if(1>=Hh(d.h)&&d.ca){try{d.ca()}catch{}d.ca=void 0}}else cr(d,11)}else if((o.K||d.g==o)&&Di(d),!M(l))for(x=d.Da.g.parse(l),l=0;l<x.length;l++){let X=x[l];if(d.T=X[0],X=X[1],d.G==2)if(X[0]=="c"){d.K=X[1],d.ia=X[2];let xe=X[3];xe!=null&&(d.la=xe,d.j.info("VER="+d.la));let Ae=X[4];Ae!=null&&(d.Aa=Ae,d.j.info("SVER="+d.Aa));let Ur=X[5];Ur!=null&&typeof Ur=="number"&&0<Ur&&(p=1.5*Ur,d.L=p,d.j.info("backChannelRequestTimeoutMs_="+p)),p=d;let Ge=o.g;if(Ge){let Ni=Ge.g?Ge.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Ni){var S=p.h;S.g||Ni.indexOf("spdy")==-1&&Ni.indexOf("quic")==-1&&Ni.indexOf("h2")==-1||(S.j=S.l,S.g=new Set,S.h&&(Xa(S,S.h),S.h=null))}if(p.D){let nu=Ge.g?Ge.g.getResponseHeader("X-HTTP-Session-Id"):null;nu&&(p.ya=nu,se(p.I,p.D,nu))}}d.G=3,d.l&&d.l.ua(),d.ba&&(d.R=Date.now()-o.F,d.j.info("Handshake RTT: "+d.R+"ms")),p=d;var O=o;if(p.qa=vd(p,p.J?p.ia:null,p.W),O.K){Wh(p.h,O);var te=O,we=p.L;we&&(te.I=we),te.B&&(Qa(te),Ii(te)),p.g=O}else pd(p);0<d.i.length&&ki(d)}else X[0]!="stop"&&X[0]!="close"||cr(d,7);else d.G==3&&(X[0]=="stop"||X[0]=="close"?X[0]=="stop"?cr(d,7):eu(d):X[0]!="noop"&&d.l&&d.l.ta(X),d.v=0)}}es(4)}catch{}}var yv=class{constructor(o,l){this.g=o,this.map=l}};function Gh(o){this.l=o||10,u.PerformanceNavigationTiming?(o=u.performance.getEntriesByType("navigation"),o=0<o.length&&(o[0].nextHopProtocol=="hq"||o[0].nextHopProtocol=="h2")):o=!!(u.chrome&&u.chrome.loadTimes&&u.chrome.loadTimes()&&u.chrome.loadTimes().wasFetchedViaSpdy),this.j=o?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Kh(o){return o.h?!0:o.g?o.g.size>=o.j:!1}function Hh(o){return o.h?1:o.g?o.g.size:0}function Ya(o,l){return o.h?o.h==l:o.g?o.g.has(l):!1}function Xa(o,l){o.g?o.g.add(l):o.h=l}function Wh(o,l){o.h&&o.h==l?o.h=null:o.g&&o.g.has(l)&&o.g.delete(l)}Gh.prototype.cancel=function(){if(this.i=Qh(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let o of this.g.values())o.cancel();this.g.clear()}};function Qh(o){if(o.h!=null)return o.i.concat(o.h.D);if(o.g!=null&&o.g.size!==0){let l=o.i;for(let d of o.g.values())l=l.concat(d.D);return l}return C(o.i)}function _v(o){if(o.V&&typeof o.V=="function")return o.V();if(typeof Map!="undefined"&&o instanceof Map||typeof Set!="undefined"&&o instanceof Set)return Array.from(o.values());if(typeof o=="string")return o.split("");if(c(o)){for(var l=[],d=o.length,p=0;p<d;p++)l.push(o[p]);return l}l=[],d=0;for(p in o)l[d++]=o[p];return l}function vv(o){if(o.na&&typeof o.na=="function")return o.na();if(!o.V||typeof o.V!="function"){if(typeof Map!="undefined"&&o instanceof Map)return Array.from(o.keys());if(!(typeof Set!="undefined"&&o instanceof Set)){if(c(o)||typeof o=="string"){var l=[];o=o.length;for(var d=0;d<o;d++)l.push(d);return l}l=[],d=0;for(let p in o)l[d++]=p;return l}}}function Jh(o,l){if(o.forEach&&typeof o.forEach=="function")o.forEach(l,void 0);else if(c(o)||typeof o=="string")Array.prototype.forEach.call(o,l,void 0);else for(var d=vv(o),p=_v(o),x=p.length,S=0;S<x;S++)l.call(void 0,p[S],d&&d[S],o)}var Yh=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function wv(o,l){if(o){o=o.split("&");for(var d=0;d<o.length;d++){var p=o[d].indexOf("="),x=null;if(0<=p){var S=o[d].substring(0,p);x=o[d].substring(p+1)}else S=o[d];l(S,x?decodeURIComponent(x.replace(/\+/g," ")):"")}}}function ur(o){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,o instanceof ur){this.h=o.h,xi(this,o.j),this.o=o.o,this.g=o.g,Ai(this,o.s),this.l=o.l;var l=o.i,d=new os;d.i=l.i,l.g&&(d.g=new Map(l.g),d.h=l.h),Xh(this,d),this.m=o.m}else o&&(l=String(o).match(Yh))?(this.h=!1,xi(this,l[1]||"",!0),this.o=ss(l[2]||""),this.g=ss(l[3]||"",!0),Ai(this,l[4]),this.l=ss(l[5]||"",!0),Xh(this,l[6]||"",!0),this.m=ss(l[7]||"")):(this.h=!1,this.i=new os(null,this.h))}ur.prototype.toString=function(){var o=[],l=this.j;l&&o.push(is(l,Zh,!0),":");var d=this.g;return(d||l=="file")&&(o.push("//"),(l=this.o)&&o.push(is(l,Zh,!0),"@"),o.push(encodeURIComponent(String(d)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),d=this.s,d!=null&&o.push(":",String(d))),(d=this.l)&&(this.g&&d.charAt(0)!="/"&&o.push("/"),o.push(is(d,d.charAt(0)=="/"?Ev:Tv,!0))),(d=this.i.toString())&&o.push("?",d),(d=this.m)&&o.push("#",is(d,xv)),o.join("")};function dt(o){return new ur(o)}function xi(o,l,d){o.j=d?ss(l,!0):l,o.j&&(o.j=o.j.replace(/:$/,""))}function Ai(o,l){if(l){if(l=Number(l),isNaN(l)||0>l)throw Error("Bad port number "+l);o.s=l}else o.s=null}function Xh(o,l,d){l instanceof os?(o.i=l,Av(o.i,o.h)):(d||(l=is(l,Iv)),o.i=new os(l,o.h))}function se(o,l,d){o.i.set(l,d)}function Si(o){return se(o,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),o}function ss(o,l){return o?l?decodeURI(o.replace(/%25/g,"%2525")):decodeURIComponent(o):""}function is(o,l,d){return typeof o=="string"?(o=encodeURI(o).replace(l,bv),d&&(o=o.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),o):null}function bv(o){return o=o.charCodeAt(0),"%"+(o>>4&15).toString(16)+(o&15).toString(16)}var Zh=/[#\/\?@]/g,Tv=/[#\?:]/g,Ev=/[#\?]/g,Iv=/[#\?@]/g,xv=/#/g;function os(o,l){this.h=this.g=null,this.i=o||null,this.j=!!l}function Ot(o){o.g||(o.g=new Map,o.h=0,o.i&&wv(o.i,function(l,d){o.add(decodeURIComponent(l.replace(/\+/g," ")),d)}))}r=os.prototype,r.add=function(o,l){Ot(this),this.i=null,o=Fr(this,o);var d=this.g.get(o);return d||this.g.set(o,d=[]),d.push(l),this.h+=1,this};function ed(o,l){Ot(o),l=Fr(o,l),o.g.has(l)&&(o.i=null,o.h-=o.g.get(l).length,o.g.delete(l))}function td(o,l){return Ot(o),l=Fr(o,l),o.g.has(l)}r.forEach=function(o,l){Ot(this),this.g.forEach(function(d,p){d.forEach(function(x){o.call(l,x,p,this)},this)},this)},r.na=function(){Ot(this);let o=Array.from(this.g.values()),l=Array.from(this.g.keys()),d=[];for(let p=0;p<l.length;p++){let x=o[p];for(let S=0;S<x.length;S++)d.push(l[p])}return d},r.V=function(o){Ot(this);let l=[];if(typeof o=="string")td(this,o)&&(l=l.concat(this.g.get(Fr(this,o))));else{o=Array.from(this.g.values());for(let d=0;d<o.length;d++)l=l.concat(o[d])}return l},r.set=function(o,l){return Ot(this),this.i=null,o=Fr(this,o),td(this,o)&&(this.h-=this.g.get(o).length),this.g.set(o,[l]),this.h+=1,this},r.get=function(o,l){return o?(o=this.V(o),0<o.length?String(o[0]):l):l};function rd(o,l,d){ed(o,l),0<d.length&&(o.i=null,o.g.set(Fr(o,l),C(d)),o.h+=d.length)}r.toString=function(){if(this.i)return this.i;if(!this.g)return"";let o=[],l=Array.from(this.g.keys());for(var d=0;d<l.length;d++){var p=l[d];let S=encodeURIComponent(String(p)),O=this.V(p);for(p=0;p<O.length;p++){var x=S;O[p]!==""&&(x+="="+encodeURIComponent(String(O[p]))),o.push(x)}}return this.i=o.join("&")};function Fr(o,l){return l=String(l),o.j&&(l=l.toLowerCase()),l}function Av(o,l){l&&!o.j&&(Ot(o),o.i=null,o.g.forEach(function(d,p){var x=p.toLowerCase();p!=x&&(ed(this,p),rd(this,x,d))},o)),o.j=l}function Sv(o,l){let d=new rs;if(u.Image){let p=new Image;p.onload=E(Nt,d,"TestLoadImage: loaded",!0,l,p),p.onerror=E(Nt,d,"TestLoadImage: error",!1,l,p),p.onabort=E(Nt,d,"TestLoadImage: abort",!1,l,p),p.ontimeout=E(Nt,d,"TestLoadImage: timeout",!1,l,p),u.setTimeout(function(){p.ontimeout&&p.ontimeout()},1e4),p.src=o}else l(!1)}function Rv(o,l){let d=new rs,p=new AbortController,x=setTimeout(()=>{p.abort(),Nt(d,"TestPingServer: timeout",!1,l)},1e4);fetch(o,{signal:p.signal}).then(S=>{clearTimeout(x),S.ok?Nt(d,"TestPingServer: ok",!0,l):Nt(d,"TestPingServer: server error",!1,l)}).catch(()=>{clearTimeout(x),Nt(d,"TestPingServer: error",!1,l)})}function Nt(o,l,d,p,x){try{x&&(x.onload=null,x.onerror=null,x.onabort=null,x.ontimeout=null),p(d)}catch{}}function Pv(){this.g=new hv}function Cv(o,l,d){let p=d||"";try{Jh(o,function(x,S){let O=x;h(x)&&(O=$a(x)),l.push(p+S+"="+encodeURIComponent(O))})}catch(x){throw l.push(p+"type="+encodeURIComponent("_badmap")),x}}function as(o){this.l=o.Ub||null,this.j=o.eb||!1}P(as,qa),as.prototype.g=function(){return new Ri(this.l,this.j)},as.prototype.i=function(o){return function(){return o}}({});function Ri(o,l){Ie.call(this),this.D=o,this.o=l,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}P(Ri,Ie),r=Ri.prototype,r.open=function(o,l){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=o,this.A=l,this.readyState=1,cs(this)},r.send=function(o){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;let l={headers:this.u,method:this.B,credentials:this.m,cache:void 0};o&&(l.body=o),(this.D||u).fetch(new Request(this.A,l)).then(this.Sa.bind(this),this.ga.bind(this))},r.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,us(this)),this.readyState=0},r.Sa=function(o){if(this.g&&(this.l=o,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=o.headers,this.readyState=2,cs(this)),this.g&&(this.readyState=3,cs(this),this.g)))if(this.responseType==="arraybuffer")o.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof u.ReadableStream!="undefined"&&"body"in o){if(this.j=o.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.v=new TextDecoder;nd(this)}else o.text().then(this.Ra.bind(this),this.ga.bind(this))};function nd(o){o.j.read().then(o.Pa.bind(o)).catch(o.ga.bind(o))}r.Pa=function(o){if(this.g){if(this.o&&o.value)this.response.push(o.value);else if(!this.o){var l=o.value?o.value:new Uint8Array(0);(l=this.v.decode(l,{stream:!o.done}))&&(this.response=this.responseText+=l)}o.done?us(this):cs(this),this.readyState==3&&nd(this)}},r.Ra=function(o){this.g&&(this.response=this.responseText=o,us(this))},r.Qa=function(o){this.g&&(this.response=o,us(this))},r.ga=function(){this.g&&us(this)};function us(o){o.readyState=4,o.l=null,o.j=null,o.v=null,cs(o)}r.setRequestHeader=function(o,l){this.u.append(o,l)},r.getResponseHeader=function(o){return this.h&&this.h.get(o.toLowerCase())||""},r.getAllResponseHeaders=function(){if(!this.h)return"";let o=[],l=this.h.entries();for(var d=l.next();!d.done;)d=d.value,o.push(d[0]+": "+d[1]),d=l.next();return o.join(`\r
|
|
7
|
-
`)};function
|
|
8
|
-
`}),
|
|
9
|
-
`);for(let p=0;p<o.length;p++){if(M(o[p]))continue;var d=I(o[p]);let x=d[0];if(d=d[1],typeof d!="string")continue;d=d.trim();let S=l[x]||[];l[x]=S,S.push(d)}T(l,function(p){return p.join(", ")})}r.Ba=function(){return this.m},r.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function ls(o,l,d){return d&&d.internalChannelParams&&d.internalChannelParams[o]||l}function ld(o){this.Aa=0,this.i=[],this.j=new rs,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=ls("failFast",!1,o),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=ls("baseRetryDelayMs",5e3,o),this.cb=ls("retryDelaySeedMs",1e4,o),this.Wa=ls("forwardChannelMaxRetries",2,o),this.wa=ls("forwardChannelRequestTimeoutMs",2e4,o),this.pa=o&&o.xmlHttpFactory||void 0,this.Xa=o&&o.Tb||void 0,this.Ca=o&&o.useFetchStreams||!1,this.L=void 0,this.J=o&&o.supportsCrossDomainXhr||!1,this.K="",this.h=new Gh(o&&o.concurrentRequestLimit),this.Da=new Pv,this.P=o&&o.fastHandshake||!1,this.O=o&&o.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=o&&o.Rb||!1,o&&o.xa&&this.j.xa(),o&&o.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&o&&o.detectBufferingProxy||!1,this.ja=void 0,o&&o.longPollingTimeout&&0<o.longPollingTimeout&&(this.ja=o.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}r=ld.prototype,r.la=8,r.G=1,r.connect=function(o,l,d,p){ke(0),this.W=o,this.H=l||{},d&&p!==void 0&&(this.H.OSID=d,this.H.OAID=p),this.F=this.X,this.I=vd(this,null,this.W),ki(this)};function eu(o){if(hd(o),o.G==3){var l=o.U++,d=dt(o.I);if(se(d,"SID",o.K),se(d,"RID",l),se(d,"TYPE","terminate"),hs(o,d),l=new Dt(o,o.j,l),l.L=2,l.v=Si(dt(d)),d=!1,u.navigator&&u.navigator.sendBeacon)try{d=u.navigator.sendBeacon(l.v.toString(),"")}catch{}!d&&u.Image&&(new Image().src=l.v,d=!0),d||(l.g=wd(l.j,null),l.g.ea(l.v)),l.F=Date.now(),Ii(l)}_d(o)}function Ci(o){o.g&&(ru(o),o.g.cancel(),o.g=null)}function hd(o){Ci(o),o.u&&(u.clearTimeout(o.u),o.u=null),Di(o),o.h.cancel(),o.s&&(typeof o.s=="number"&&u.clearTimeout(o.s),o.s=null)}function ki(o){if(!Kh(o.h)&&!o.s){o.s=!0;var l=o.Ga;Wn||Eh(),Qn||(Wn(),Qn=!0),Oa.add(l,o),o.B=0}}function Nv(o,l){return Hh(o.h)>=o.h.j-(o.s?1:0)?!1:o.s?(o.i=l.D.concat(o.i),!0):o.G==1||o.G==2||o.B>=(o.Va?0:o.Wa)?!1:(o.s=ts(g(o.Ga,o,l),yd(o,o.B)),o.B++,!0)}r.Ga=function(o){if(this.s)if(this.s=null,this.G==1){if(!o){this.U=Math.floor(1e5*Math.random()),o=this.U++;let x=new Dt(this,this.j,o),S=this.o;if(this.S&&(S?(S=y(S),b(S,this.S)):S=this.S),this.m!==null||this.O||(x.H=S,S=null),this.P)e:{for(var l=0,d=0;d<this.i.length;d++){t:{var p=this.i[d];if("__data__"in p.map&&(p=p.map.__data__,typeof p=="string")){p=p.length;break t}p=void 0}if(p===void 0)break;if(l+=p,4096<l){l=d;break e}if(l===4096||d===this.i.length-1){l=d+1;break e}}l=1e3}else l=1e3;l=fd(this,x,l),d=dt(this.I),se(d,"RID",o),se(d,"CVER",22),this.D&&se(d,"X-HTTP-Session-Id",this.D),hs(this,d),S&&(this.O?l="headers="+encodeURIComponent(String(sd(S)))+"&"+l:this.m&&Za(d,this.m,S)),Xa(this.h,x),this.Ua&&se(d,"TYPE","init"),this.P?(se(d,"$req",l),se(d,"SID","null"),x.T=!0,Wa(x,d,null)):Wa(x,d,l),this.G=2}}else this.G==3&&(o?dd(this,o):this.i.length==0||Kh(this.h)||dd(this))};function dd(o,l){var d;l?d=l.l:d=o.U++;let p=dt(o.I);se(p,"SID",o.K),se(p,"RID",d),se(p,"AID",o.T),hs(o,p),o.m&&o.o&&Za(p,o.m,o.o),d=new Dt(o,o.j,d,o.B+1),o.m===null&&(d.H=o.o),l&&(o.i=l.D.concat(o.i)),l=fd(o,d,1e3),d.I=Math.round(.5*o.wa)+Math.round(.5*o.wa*Math.random()),Xa(o.h,d),Wa(d,p,l)}function hs(o,l){o.H&&B(o.H,function(d,p){se(l,p,d)}),o.l&&Jh({},function(d,p){se(l,p,d)})}function fd(o,l,d){d=Math.min(o.i.length,d);var p=o.l?g(o.l.Na,o.l,o):null;e:{var x=o.i;let S=-1;for(;;){let O=["count="+d];S==-1?0<d?(S=x[0].g,O.push("ofs="+S)):S=0:O.push("ofs="+S);let te=!0;for(let we=0;we<d;we++){let X=x[we].g,xe=x[we].map;if(X-=S,0>X)S=Math.max(0,x[we].g-100),te=!1;else try{Cv(xe,O,"req"+X+"_")}catch{p&&p(xe)}}if(te){p=O.join("&");break e}}}return o=o.i.splice(0,d),l.D=o,p}function pd(o){if(!o.g&&!o.u){o.Y=1;var l=o.Fa;Wn||Eh(),Qn||(Wn(),Qn=!0),Oa.add(l,o),o.v=0}}function tu(o){return o.g||o.u||3<=o.v?!1:(o.Y++,o.u=ts(g(o.Fa,o),yd(o,o.v)),o.v++,!0)}r.Fa=function(){if(this.u=null,md(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var o=2*this.R;this.j.info("BP detection timer enabled: "+o),this.A=ts(g(this.ab,this),o)}},r.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,ke(10),Ci(this),md(this))};function ru(o){o.A!=null&&(u.clearTimeout(o.A),o.A=null)}function md(o){o.g=new Dt(o,o.j,"rpc",o.Y),o.m===null&&(o.g.H=o.o),o.g.O=0;var l=dt(o.qa);se(l,"RID","rpc"),se(l,"SID",o.K),se(l,"AID",o.T),se(l,"CI",o.F?"0":"1"),!o.F&&o.ja&&se(l,"TO",o.ja),se(l,"TYPE","xmlhttp"),hs(o,l),o.m&&o.o&&Za(l,o.m,o.o),o.L&&(o.g.I=o.L);var d=o.g;o=o.ia,d.L=1,d.v=Si(dt(l)),d.m=null,d.P=!0,$h(d,o)}r.Za=function(){this.C!=null&&(this.C=null,Ci(this),tu(this),ke(19))};function Di(o){o.C!=null&&(u.clearTimeout(o.C),o.C=null)}function gd(o,l){var d=null;if(o.g==l){Di(o),ru(o),o.g=null;var p=2}else if(Ya(o.h,l))d=l.D,Wh(o.h,l),p=1;else return;if(o.G!=0){if(l.o)if(p==1){d=l.m?l.m.length:0,l=Date.now()-l.F;var x=o.B;p=bi(),Ce(p,new Fh(p,d)),ki(o)}else pd(o);else if(x=l.s,x==3||x==0&&0<l.X||!(p==1&&Nv(o,l)||p==2&&tu(o)))switch(d&&0<d.length&&(l=o.h,l.i=l.i.concat(d)),x){case 1:cr(o,5);break;case 4:cr(o,10);break;case 3:cr(o,6);break;default:cr(o,2)}}}function yd(o,l){let d=o.Ta+Math.floor(Math.random()*o.cb);return o.isActive()||(d*=2),d*l}function cr(o,l){if(o.j.info("Error code "+l),l==2){var d=g(o.fb,o),p=o.Xa;let x=!p;p=new ur(p||"//www.google.com/images/cleardot.gif"),u.location&&u.location.protocol=="http"||xi(p,"https"),Si(p),x?Sv(p.toString(),d):Rv(p.toString(),d)}else ke(2);o.G=0,o.l&&o.l.sa(l),_d(o),hd(o)}r.fb=function(o){o?(this.j.info("Successfully pinged google.com"),ke(2)):(this.j.info("Failed to ping google.com"),ke(1))};function _d(o){if(o.G=0,o.ka=[],o.l){let l=Qh(o.h);(l.length!=0||o.i.length!=0)&&(R(o.ka,l),R(o.ka,o.i),o.h.i.length=0,C(o.i),o.i.length=0),o.l.ra()}}function vd(o,l,d){var p=d instanceof ur?dt(d):new ur(d);if(p.g!="")l&&(p.g=l+"."+p.g),Ai(p,p.s);else{var x=u.location;p=x.protocol,l=l?l+"."+x.hostname:x.hostname,x=+x.port;var S=new ur(null);p&&xi(S,p),l&&(S.g=l),x&&Ai(S,x),d&&(S.l=d),p=S}return d=o.D,l=o.ya,d&&l&&se(p,d,l),se(p,"VER",o.la),hs(o,p),p}function wd(o,l,d){if(l&&!o.J)throw Error("Can't create secondary domain capable XhrIo object.");return l=o.Ca&&!o.pa?new ue(new as({eb:d})):new ue(o.pa),l.Ha(o.J),l}r.isActive=function(){return!!this.l&&this.l.isActive(this)};function bd(){}r=bd.prototype,r.ua=function(){},r.ta=function(){},r.sa=function(){},r.ra=function(){},r.isActive=function(){return!0},r.Na=function(){};function Oi(){}Oi.prototype.g=function(o,l){return new Fe(o,l)};function Fe(o,l){Ie.call(this),this.g=new ld(l),this.l=o,this.h=l&&l.messageUrlParams||null,o=l&&l.messageHeaders||null,l&&l.clientProtocolHeaderRequired&&(o?o["X-Client-Protocol"]="webchannel":o={"X-Client-Protocol":"webchannel"}),this.g.o=o,o=l&&l.initMessageHeaders||null,l&&l.messageContentType&&(o?o["X-WebChannel-Content-Type"]=l.messageContentType:o={"X-WebChannel-Content-Type":l.messageContentType}),l&&l.va&&(o?o["X-WebChannel-Client-Profile"]=l.va:o={"X-WebChannel-Client-Profile":l.va}),this.g.S=o,(o=l&&l.Sb)&&!M(o)&&(this.g.m=o),this.v=l&&l.supportsCrossDomainXhr||!1,this.u=l&&l.sendRawJson||!1,(l=l&&l.httpSessionIdParam)&&!M(l)&&(this.g.D=l,o=this.h,o!==null&&l in o&&(o=this.h,l in o&&delete o[l])),this.j=new jr(this)}P(Fe,Ie),Fe.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Fe.prototype.close=function(){eu(this.g)},Fe.prototype.o=function(o){var l=this.g;if(typeof o=="string"){var d={};d.__data__=o,o=d}else this.u&&(d={},d.__data__=$a(o),o=d);l.i.push(new yv(l.Ya++,o)),l.G==3&&ki(l)},Fe.prototype.N=function(){this.g.l=null,delete this.j,eu(this.g),delete this.g,Fe.aa.N.call(this)};function Td(o){za.call(this),o.__headers__&&(this.headers=o.__headers__,this.statusCode=o.__status__,delete o.__headers__,delete o.__status__);var l=o.__sm__;if(l){e:{for(let d in l){o=d;break e}o=void 0}(this.i=o)&&(o=this.i,l=l!==null&&o in l?l[o]:void 0),this.data=l}else this.data=o}P(Td,za);function Ed(){Ga.call(this),this.status=1}P(Ed,Ga);function jr(o){this.g=o}P(jr,bd),jr.prototype.ua=function(){Ce(this.g,"a")},jr.prototype.ta=function(o){Ce(this.g,new Td(o))},jr.prototype.sa=function(o){Ce(this.g,new Ed)},jr.prototype.ra=function(){Ce(this.g,"b")},Oi.prototype.createWebChannel=Oi.prototype.g,Fe.prototype.send=Fe.prototype.o,Fe.prototype.open=Fe.prototype.m,Fe.prototype.close=Fe.prototype.close,Fu=Et.createWebChannelTransport=function(){return new Oi},Mu=Et.getStatEventTarget=function(){return bi()},Lu=Et.Event=or,lo=Et.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Ti.NO_ERROR=0,Ti.TIMEOUT=8,Ti.HTTP_ERROR=6,Ts=Et.ErrorCode=Ti,jh.COMPLETE="complete",Vu=Et.EventType=jh,Nh.EventType=Zn,Zn.OPEN="a",Zn.CLOSE="b",Zn.ERROR="c",Zn.MESSAGE="d",Ie.prototype.listen=Ie.prototype.K,an=Et.WebChannel=Nh,IA=Et.FetchXmlHttpFactory=as,ue.prototype.listenOnce=ue.prototype.L,ue.prototype.getLastError=ue.prototype.Ka,ue.prototype.getLastErrorCode=ue.prototype.Ba,ue.prototype.getStatus=ue.prototype.Z,ue.prototype.getResponseJson=ue.prototype.Oa,ue.prototype.getResponseText=ue.prototype.oa,ue.prototype.send=ue.prototype.ea,ue.prototype.setWithCredentials=ue.prototype.Ha,Nu=Et.XhrIo=ue}).apply(typeof co!="undefined"?co:typeof self!="undefined"?self:typeof window!="undefined"?window:{});var Rm="@firebase/firestore",Pm="4.7.8";var _e=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}};_e.UNAUTHENTICATED=new _e(null),_e.GOOGLE_CREDENTIALS=new _e("google-credentials-uid"),_e.FIRST_PARTY=new _e("first-party-uid"),_e.MOCK_USER=new _e("mock-user");var kn="11.3.1";var gr=new on("@firebase/firestore");function un(){return gr.logLevel}function V(r,...e){if(gr.logLevel<=W.DEBUG){let t=e.map(Il);gr.debug(`Firestore (${kn}): ${r}`,...t)}}function It(r,...e){if(gr.logLevel<=W.ERROR){let t=e.map(Il);gr.error(`Firestore (${kn}): ${r}`,...t)}}function mn(r,...e){if(gr.logLevel<=W.WARN){let t=e.map(Il);gr.warn(`Firestore (${kn}): ${r}`,...t)}}function Il(r){if(typeof r=="string")return r;try{return function(t){return JSON.stringify(t)}(r)}catch{return r}}function F(r="Unexpected state"){let e=`FIRESTORE (${kn}) INTERNAL ASSERTION FAILED: `+r;throw It(e),new Error(e)}function ee(r,e){r||F()}function $(r,e){return r}var D={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"},L=class extends _t{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};var et=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}};var _o=class{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}},qu=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(_e.UNAUTHENTICATED))}shutdown(){}},zu=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}},Gu=class{constructor(e){this.t=e,this.currentUser=_e.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){ee(this.o===void 0);let n=this.i,s=c=>this.i!==n?(n=this.i,t(c)):Promise.resolve(),i=new et;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new et,e.enqueueRetryable(()=>s(this.currentUser))};let a=()=>{let c=i;e.enqueueRetryable(async()=>{await c.promise,await s(this.currentUser)})},u=c=>{V("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit(c=>u(c)),setTimeout(()=>{if(!this.auth){let c=this.t.getImmediate({optional:!0});c?u(c):(V("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new et)}},0),a()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(n=>this.i!==e?(V("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):n?(ee(typeof n.accessToken=="string"),new _o(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 ee(e===null||typeof e=="string"),new _e(e)}},Ku=class{constructor(e,t,n){this.l=e,this.h=t,this.P=n,this.type="FirstParty",this.user=_e.FIRST_PARTY,this.T=new Map}I(){return this.P?this.P():null}get headers(){this.T.set("X-Goog-AuthUser",this.l);let e=this.I();return e&&this.T.set("Authorization",e),this.h&&this.T.set("X-Goog-Iam-Authorization-Token",this.h),this.T}},Hu=class{constructor(e,t,n){this.l=e,this.h=t,this.P=n}getToken(){return Promise.resolve(new Ku(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(_e.FIRST_PARTY))}shutdown(){}invalidateToken(){}},vo=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)}},Wu=class{constructor(e,t){this.A=t,this.forceRefresh=!1,this.appCheck=null,this.R=null,this.V=null,bm(e)&&e.settings.appCheckToken&&(this.V=e.settings.appCheckToken)}start(e,t){ee(this.o===void 0);let n=i=>{i.error!=null&&V("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);let a=i.token!==this.R;return this.R=i.token,V("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?t(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>n(i))};let s=i=>{V("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){let i=this.A.getImmediate({optional:!0});i?s(i):V("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.V)return Promise.resolve(new vo(this.V));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(ee(typeof t.token=="string"),this.R=t.token,new vo(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 xA(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 wo=class{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(4.129032258064516),n="";for(;n.length<20;){let s=xA(40);for(let i=0;i<s.length;++i)n.length<20&&s[i]<t&&(n+=e.charAt(s[i]%62))}return n}};function Q(r,e){return r<e?-1:r>e?1:0}function gn(r,e,t){return r.length===e.length&&r.every((n,s)=>t(n,e[s]))}var Cm=-62135596800,km=1e6,be=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)*km);return new r(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new L(D.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new L(D.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<Cm)throw new L(D.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new L(D.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/km}_compareTo(e){return this.seconds===e.seconds?Q(this.nanoseconds,e.nanoseconds):Q(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{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){let e=this.seconds-Cm;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};var q=class r{static fromTimestamp(e){return new r(e)}static min(){return new r(new be(0,0))}static max(){return new r(new be(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 Dm="__name__",bo=class r{constructor(e,t,n){t===void 0?t=0:t>e.length&&F(),n===void 0?n=e.length-t:n>e.length-t&&F(),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 Math.sign(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)):e<t?-1:e>t?1:0}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Tt.fromString(e.substring(4,e.length-2))}},pe=class r extends bo{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 L(D.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([])}},AA=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Ue=class r extends bo{construct(e,t,n){return new r(e,t,n)}static isValidIdentifier(e){return AA.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)===Dm}static keyField(){return new r([Dm])}static fromServerFormat(e){let t=[],n="",s=0,i=()=>{if(n.length===0)throw new L(D.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""},a=!1;for(;s<e.length;){let u=e[s];if(u==="\\"){if(s+1===e.length)throw new L(D.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let c=e[s+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new L(D.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=c,s+=2}else u==="`"?(a=!a,s++):u!=="."||a?(n+=u,s++):(i(),s++)}if(i(),a)throw new L(D.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new r(t)}static emptyPath(){return new r([])}};var j=class r{constructor(e){this.path=e}static fromPath(e){return new r(pe.fromString(e))}static fromName(e){return new r(pe.fromString(e).popFirst(5))}static empty(){return new r(pe.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&&pe.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return pe.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new r(new pe(e.slice()))}};var Rs=-1,Qu=class{constructor(e,t,n,s){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=s}};Qu.UNKNOWN_ID=-1;function SA(r,e){let t=r.toTimestamp().seconds,n=r.toTimestamp().nanoseconds+1,s=q.fromTimestamp(n===1e9?new be(t+1,0):new be(t,n));return new yr(s,j.empty(),e)}function RA(r){return new yr(r.readTime,r.key,Rs)}var yr=class r{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new r(q.min(),j.empty(),Rs)}static max(){return new r(q.max(),j.empty(),Rs)}};function PA(r,e){let t=r.readTime.compareTo(e.readTime);return t!==0?t:(t=j.comparator(r.documentKey,e.documentKey),t!==0?t:Q(r.largestBatchId,e.largestBatchId))}var CA="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Ju=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}};async function Dn(r){if(r.code!==D.FAILED_PRECONDITION||r.message!==CA)throw r;V("LocalStore","Unexpectedly lost primary lease")}var k=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&&F(),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,a=!1;e.forEach(u=>{++s,u.next(()=>{++i,a&&i===s&&t()},c=>n(c))}),a=!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,a=new Array(i),u=0;for(let c=0;c<i;c++){let h=c;t(e[h]).next(f=>{a[h]=f,++u,u===i&&n(a)},f=>s(f))}})}static doWhile(e,t){return new r((n,s)=>{let i=()=>{e()===!0?t().next(()=>{i()},s):n()};i()})}};function kA(r){let e=r.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function On(r){return r.name==="IndexedDbTransactionError"}var yn=class{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=n=>this.oe(n),this._e=n=>t.writeSequenceNumber(n))}oe(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this._e&&this._e(e),e}};yn.ae=-1;var xl=-1;function ra(r){return r==null}function Ps(r){return r===0&&1/r==-1/0}function DA(r){return typeof r=="number"&&Number.isInteger(r)&&!Ps(r)&&r<=Number.MAX_SAFE_INTEGER&&r>=Number.MIN_SAFE_INTEGER}var mg="";function OA(r){let e="";for(let t=0;t<r.length;t++)e.length>0&&(e=Om(e)),e=NA(r.get(t),e);return Om(e)}function NA(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 mg:t+="";break;default:t+=i}}return t}function Om(r){return r+mg+""}var VA="remoteDocuments",gg="owner";var yg="mutationQueues";var _g="mutations";var vg="documentMutations",LA="remoteDocumentsV14";var wg="remoteDocumentGlobal";var bg="targets";var Tg="targetDocuments";var Eg="targetGlobal",Ig="collectionParents";var xg="clientMetadata";var Ag="bundles";var Sg="namedQueries";var MA="indexConfiguration";var FA="indexState";var jA="indexEntries";var Rg="documentOverlays";var UA="globals";var BA=[yg,_g,vg,VA,bg,gg,Eg,Tg,xg,wg,Ig,Ag,Sg],hF=[...BA,Rg],$A=[yg,_g,vg,LA,bg,gg,Eg,Tg,xg,wg,Ig,Ag,Sg,Rg],qA=$A,zA=[...qA,MA,FA,jA];var dF=[...zA,UA];function Nm(r){let e=0;for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e++;return e}function tr(r,e){for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e(t,r[t])}function Pg(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}var le=class r{constructor(e,t){this.comparator=e,this.root=t||tt.EMPTY}insert(e,t){return new r(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,tt.BLACK,null,null))}remove(e){return new r(this.comparator,this.root.remove(e,this.comparator).copy(null,null,tt.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}}},tt=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()||this.right.isRed())throw F();let e=this.left.check();if(e!==this.right.check())throw F();return e+(this.isRed()?0:1)}};tt.EMPTY=null,tt.RED=!0,tt.BLACK=!1;tt.EMPTY=new class{constructor(){this.size=0}get key(){throw F()}get value(){throw F()}get color(){throw F()}get left(){throw F()}get right(){throw F()}copy(e,t,n,s,i){return this}insert(e,t,n){return new tt(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 ve=class r{constructor(e){this.comparator=e,this.data=new le(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 To(this.data.getIterator())}getIteratorFrom(e){return new To(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}},To=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};var qe=class r{constructor(e){this.fields=e,e.sort(Ue.comparator)}static empty(){return new r([])}unionWith(e){let t=new ve(Ue.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 gn(this.fields,e.fields,(t,n)=>t.isEqual(n))}};var Eo=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};var Pe=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 Eo("Invalid base64 string: "+i):i}}(e);return new r(t)}static fromUint8Array(e){let t=function(s){let i="";for(let a=0;a<s.length;++a)i+=String.fromCharCode(s[a]);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 Q(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};Pe.EMPTY_BYTE_STRING=new Pe("");var GA=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function xt(r){if(ee(!!r),typeof r=="string"){let e=0,t=GA.exec(r);if(ee(!!t),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:oe(r.seconds),nanos:oe(r.nanos)}}function oe(r){return typeof r=="number"?r:typeof r=="string"?Number(r):0}function At(r){return typeof r=="string"?Pe.fromBase64String(r):Pe.fromUint8Array(r)}var Cg="server_timestamp",kg="__type__",Dg="__previous_value__",Og="__local_write_time__";function Al(r){var e,t;return((t=(((e=r==null?void 0:r.mapValue)===null||e===void 0?void 0:e.fields)||{})[kg])===null||t===void 0?void 0:t.stringValue)===Cg}function na(r){let e=r.mapValue.fields[Dg];return Al(e)?na(e):e}function Cs(r){let e=xt(r.mapValue.fields[Og].timestampValue);return new be(e.seconds,e.nanos)}var Yu=class{constructor(e,t,n,s,i,a,u,c,h){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=s,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=u,this.longPollingOptions=c,this.useFetchStreams=h}},Io="(default)",xo=class r{constructor(e,t){this.projectId=e,this.database=t||Io}static empty(){return new r("","")}get isDefaultDatabase(){return this.database===Io}isEqual(e){return e instanceof r&&e.projectId===this.projectId&&e.database===this.database}};var Sl="__type__",Ng="__max__",ho={mapValue:{fields:{__type__:{stringValue:Ng}}}},Rl="__vector__",_n="value";function Yt(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?Al(r)?4:Lg(r)?9007199254740991:Vg(r)?10:11:F()}function it(r,e){if(r===e)return!0;let t=Yt(r);if(t!==Yt(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return r.booleanValue===e.booleanValue;case 4:return Cs(r).isEqual(Cs(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 a=xt(s.timestampValue),u=xt(i.timestampValue);return a.seconds===u.seconds&&a.nanos===u.nanos}(r,e);case 5:return r.stringValue===e.stringValue;case 6:return function(s,i){return At(s.bytesValue).isEqual(At(i.bytesValue))}(r,e);case 7:return r.referenceValue===e.referenceValue;case 8:return function(s,i){return oe(s.geoPointValue.latitude)===oe(i.geoPointValue.latitude)&&oe(s.geoPointValue.longitude)===oe(i.geoPointValue.longitude)}(r,e);case 2:return function(s,i){if("integerValue"in s&&"integerValue"in i)return oe(s.integerValue)===oe(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){let a=oe(s.doubleValue),u=oe(i.doubleValue);return a===u?Ps(a)===Ps(u):isNaN(a)&&isNaN(u)}return!1}(r,e);case 9:return gn(r.arrayValue.values||[],e.arrayValue.values||[],it);case 10:case 11:return function(s,i){let a=s.mapValue.fields||{},u=i.mapValue.fields||{};if(Nm(a)!==Nm(u))return!1;for(let c in a)if(a.hasOwnProperty(c)&&(u[c]===void 0||!it(a[c],u[c])))return!1;return!0}(r,e);default:return F()}}function ks(r,e){return(r.values||[]).find(t=>it(t,e))!==void 0}function vn(r,e){if(r===e)return 0;let t=Yt(r),n=Yt(e);if(t!==n)return Q(t,n);switch(t){case 0:case 9007199254740991:return 0;case 1:return Q(r.booleanValue,e.booleanValue);case 2:return function(i,a){let u=oe(i.integerValue||i.doubleValue),c=oe(a.integerValue||a.doubleValue);return u<c?-1:u>c?1:u===c?0:isNaN(u)?isNaN(c)?0:-1:1}(r,e);case 3:return Vm(r.timestampValue,e.timestampValue);case 4:return Vm(Cs(r),Cs(e));case 5:return Q(r.stringValue,e.stringValue);case 6:return function(i,a){let u=At(i),c=At(a);return u.compareTo(c)}(r.bytesValue,e.bytesValue);case 7:return function(i,a){let u=i.split("/"),c=a.split("/");for(let h=0;h<u.length&&h<c.length;h++){let f=Q(u[h],c[h]);if(f!==0)return f}return Q(u.length,c.length)}(r.referenceValue,e.referenceValue);case 8:return function(i,a){let u=Q(oe(i.latitude),oe(a.latitude));return u!==0?u:Q(oe(i.longitude),oe(a.longitude))}(r.geoPointValue,e.geoPointValue);case 9:return Lm(r.arrayValue,e.arrayValue);case 10:return function(i,a){var u,c,h,f;let m=i.fields||{},g=a.fields||{},E=(u=m[_n])===null||u===void 0?void 0:u.arrayValue,P=(c=g[_n])===null||c===void 0?void 0:c.arrayValue,C=Q(((h=E==null?void 0:E.values)===null||h===void 0?void 0:h.length)||0,((f=P==null?void 0:P.values)===null||f===void 0?void 0:f.length)||0);return C!==0?C:Lm(E,P)}(r.mapValue,e.mapValue);case 11:return function(i,a){if(i===ho.mapValue&&a===ho.mapValue)return 0;if(i===ho.mapValue)return 1;if(a===ho.mapValue)return-1;let u=i.fields||{},c=Object.keys(u),h=a.fields||{},f=Object.keys(h);c.sort(),f.sort();for(let m=0;m<c.length&&m<f.length;++m){let g=Q(c[m],f[m]);if(g!==0)return g;let E=vn(u[c[m]],h[f[m]]);if(E!==0)return E}return Q(c.length,f.length)}(r.mapValue,e.mapValue);default:throw F()}}function Vm(r,e){if(typeof r=="string"&&typeof e=="string"&&r.length===e.length)return Q(r,e);let t=xt(r),n=xt(e),s=Q(t.seconds,n.seconds);return s!==0?s:Q(t.nanos,n.nanos)}function Lm(r,e){let t=r.values||[],n=e.values||[];for(let s=0;s<t.length&&s<n.length;++s){let i=vn(t[s],n[s]);if(i)return i}return Q(t.length,n.length)}function wn(r){return Xu(r)}function Xu(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=xt(t);return`time(${n.seconds},${n.nanos})`}(r.timestampValue):"stringValue"in r?r.stringValue:"bytesValue"in r?function(t){return At(t).toBase64()}(r.bytesValue):"referenceValue"in r?function(t){return j.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+=Xu(i);return n+"]"}(r.arrayValue):"mapValue"in r?function(t){let n=Object.keys(t.fields||{}).sort(),s="{",i=!0;for(let a of n)i?i=!1:s+=",",s+=`${a}:${Xu(t.fields[a])}`;return s+"}"}(r.mapValue):F()}function mo(r){switch(Yt(r)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let e=na(r);return e?16+mo(e):16;case 5:return 2*r.stringValue.length;case 6:return At(r.bytesValue).approximateByteSize();case 7:return r.referenceValue.length;case 9:return function(n){return(n.values||[]).reduce((s,i)=>s+mo(i),0)}(r.arrayValue);case 10:case 11:return function(n){let s=0;return tr(n.fields,(i,a)=>{s+=i.length+mo(a)}),s}(r.mapValue);default:throw F()}}function Zu(r){return!!r&&"integerValue"in r}function Pl(r){return!!r&&"arrayValue"in r}function Mm(r){return!!r&&"nullValue"in r}function Fm(r){return!!r&&"doubleValue"in r&&isNaN(Number(r.doubleValue))}function go(r){return!!r&&"mapValue"in r}function Vg(r){var e,t;return((t=(((e=r==null?void 0:r.mapValue)===null||e===void 0?void 0:e.fields)||{})[Sl])===null||t===void 0?void 0:t.stringValue)===Rl}function Is(r){if(r.geoPointValue)return{geoPointValue:Object.assign({},r.geoPointValue)};if(r.timestampValue&&typeof r.timestampValue=="object")return{timestampValue:Object.assign({},r.timestampValue)};if(r.mapValue){let e={mapValue:{fields:{}}};return tr(r.mapValue.fields,(t,n)=>e.mapValue.fields[t]=Is(n)),e}if(r.arrayValue){let e={arrayValue:{values:[]}};for(let t=0;t<(r.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=Is(r.arrayValue.values[t]);return e}return Object.assign({},r)}function Lg(r){return(((r.mapValue||{}).fields||{}).__type__||{}).stringValue===Ng}var pF={mapValue:{fields:{[Sl]:{stringValue:Rl},[_n]:{arrayValue:{}}}}};var je=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)],!go(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Is(t)}setAll(e){let t=Ue.emptyPath(),n={},s=[];e.forEach((a,u)=>{if(!t.isImmediateParentOf(u)){let c=this.getFieldsMap(t);this.applyChanges(c,n,s),n={},s=[],t=u.popLast()}a?n[u.lastSegment()]=Is(a):s.push(u.lastSegment())});let i=this.getFieldsMap(t);this.applyChanges(i,n,s)}delete(e){let t=this.field(e.popLast());go(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return it(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)];go(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,n){tr(t,(s,i)=>e[s]=i);for(let s of n)delete e[s]}clone(){return new r(Is(this.value))}};function Mg(r){let e=[];return tr(r.fields,(t,n)=>{let s=new Ue([t]);if(go(n)){let i=Mg(n.mapValue).fields;if(i.length===0)e.push(s);else for(let a of i)e.push(s.child(a))}else e.push(s)}),new qe(e)}var We=class r{constructor(e,t,n,s,i,a,u){this.key=e,this.documentType=t,this.version=n,this.readTime=s,this.createTime=i,this.data=a,this.documentState=u}static newInvalidDocument(e){return new r(e,0,q.min(),q.min(),q.min(),je.empty(),0)}static newFoundDocument(e,t,n,s){return new r(e,1,t,q.min(),n,s,0)}static newNoDocument(e,t){return new r(e,2,t,q.min(),q.min(),je.empty(),0)}static newUnknownDocument(e,t){return new r(e,3,t,q.min(),q.min(),je.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(q.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=je.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=je.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=q.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 bn=class{constructor(e,t){this.position=e,this.inclusive=t}};function jm(r,e,t){let n=0;for(let s=0;s<r.position.length;s++){let i=e[s],a=r.position[s];if(i.field.isKeyField()?n=j.comparator(j.fromName(a.referenceValue),t.key):n=vn(a,t.data.field(i.field)),i.dir==="desc"&&(n*=-1),n!==0)break}return n}function Um(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(!it(r.position[t],e.position[t]))return!1;return!0}var Tn=class{constructor(e,t="asc"){this.field=e,this.dir=t}};function KA(r,e){return r.dir===e.dir&&r.field.isEqual(e.field)}var Ao=class{},ye=class r extends Ao{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 tc(e,t,n):t==="array-contains"?new sc(e,n):t==="in"?new ic(e,n):t==="not-in"?new oc(e,n):t==="array-contains-any"?new ac(e,n):new r(e,t,n)}static createKeyFieldInFilter(e,t,n){return t==="in"?new rc(e,n):new nc(e,n)}matches(e){let t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(vn(t,this.value)):t!==null&&Yt(this.value)===Yt(t)&&this.matchesComparison(vn(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 F()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},ot=class r extends Ao{constructor(e,t){super(),this.filters=e,this.op=t,this.ce=null}static create(e,t){return new r(e,t)}matches(e){return Fg(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.ce!==null||(this.ce=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ce}getFilters(){return Object.assign([],this.filters)}};function Fg(r){return r.op==="and"}function jg(r){return HA(r)&&Fg(r)}function HA(r){for(let e of r.filters)if(e instanceof ot)return!1;return!0}function ec(r){if(r instanceof ye)return r.field.canonicalString()+r.op.toString()+wn(r.value);if(jg(r))return r.filters.map(e=>ec(e)).join(",");{let e=r.filters.map(t=>ec(t)).join(",");return`${r.op}(${e})`}}function Ug(r,e){return r instanceof ye?function(n,s){return s instanceof ye&&n.op===s.op&&n.field.isEqual(s.field)&&it(n.value,s.value)}(r,e):r instanceof ot?function(n,s){return s instanceof ot&&n.op===s.op&&n.filters.length===s.filters.length?n.filters.reduce((i,a,u)=>i&&Ug(a,s.filters[u]),!0):!1}(r,e):void F()}function Bg(r){return r instanceof ye?function(t){return`${t.field.canonicalString()} ${t.op} ${wn(t.value)}`}(r):r instanceof ot?function(t){return t.op.toString()+" {"+t.getFilters().map(Bg).join(" ,")+"}"}(r):"Filter"}var tc=class extends ye{constructor(e,t,n){super(e,t,n),this.key=j.fromName(n.referenceValue)}matches(e){let t=j.comparator(e.key,this.key);return this.matchesComparison(t)}},rc=class extends ye{constructor(e,t){super(e,"in",t),this.keys=$g("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}},nc=class extends ye{constructor(e,t){super(e,"not-in",t),this.keys=$g("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}};function $g(r,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(n=>j.fromName(n.referenceValue))}var sc=class extends ye{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return Pl(t)&&ks(t.arrayValue,this.value)}},ic=class extends ye{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return t!==null&&ks(this.value.arrayValue,t)}},oc=class extends ye{constructor(e,t){super(e,"not-in",t)}matches(e){if(ks(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return t!==null&&!ks(this.value.arrayValue,t)}},ac=class extends ye{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!Pl(t)||!t.arrayValue.values)&&t.arrayValue.values.some(n=>ks(this.value.arrayValue,n))}};var uc=class{constructor(e,t=null,n=[],s=[],i=null,a=null,u=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=s,this.limit=i,this.startAt=a,this.endAt=u,this.le=null}};function Bm(r,e=null,t=[],n=[],s=null,i=null,a=null){return new uc(r,e,t,n,s,i,a)}function Cl(r){let e=$(r);if(e.le===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(n=>ec(n)).join(","),t+="|ob:",t+=e.orderBy.map(n=>function(i){return i.field.canonicalString()+i.dir}(n)).join(","),ra(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(n=>wn(n)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(n=>wn(n)).join(",")),e.le=t}return e.le}function kl(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(!KA(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(!Ug(r.filters[t],e.filters[t]))return!1;return r.collectionGroup===e.collectionGroup&&!!r.path.isEqual(e.path)&&!!Um(r.startAt,e.startAt)&&Um(r.endAt,e.endAt)}function cc(r){return j.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}var En=class{constructor(e,t=null,n=[],s=[],i=null,a="F",u=null,c=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=s,this.limit=i,this.limitType=a,this.startAt=u,this.endAt=c,this.he=null,this.Pe=null,this.Te=null,this.startAt,this.endAt}};function WA(r,e,t,n,s,i,a,u){return new En(r,e,t,n,s,i,a,u)}function sa(r){return new En(r)}function $m(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 QA(r){return r.collectionGroup!==null}function xs(r){let e=$(r);if(e.he===null){e.he=[];let t=new Set;for(let i of e.explicitOrderBy)e.he.push(i),t.add(i.field.canonicalString());let n=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let u=new ve(Ue.comparator);return a.filters.forEach(c=>{c.getFlattenedFilters().forEach(h=>{h.isInequality()&&(u=u.add(h.field))})}),u})(e).forEach(i=>{t.has(i.canonicalString())||i.isKeyField()||e.he.push(new Tn(i,n))}),t.has(Ue.keyField().canonicalString())||e.he.push(new Tn(Ue.keyField(),n))}return e.he}function rt(r){let e=$(r);return e.Pe||(e.Pe=JA(e,xs(r))),e.Pe}function JA(r,e){if(r.limitType==="F")return Bm(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 Tn(s.field,i)});let t=r.endAt?new bn(r.endAt.position,r.endAt.inclusive):null,n=r.startAt?new bn(r.startAt.position,r.startAt.inclusive):null;return Bm(r.path,r.collectionGroup,e,r.filters,r.limit,t,n)}}function lc(r,e,t){return new En(r.path,r.collectionGroup,r.explicitOrderBy.slice(),r.filters.slice(),e,t,r.startAt,r.endAt)}function ia(r,e){return kl(rt(r),rt(e))&&r.limitType===e.limitType}function qg(r){return`${Cl(rt(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=>Bg(s)).join(", ")}]`),ra(t.limit)||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=`, orderBy: [${t.orderBy.map(s=>function(a){return`${a.field.canonicalString()} (${a.dir})`}(s)).join(", ")}]`),t.startAt&&(n+=", startAt: ",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map(s=>wn(s)).join(",")),t.endAt&&(n+=", endAt: ",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map(s=>wn(s)).join(",")),`Target(${n})`}(rt(r))}; limitType=${r.limitType})`}function oa(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):j.isDocumentKey(n.path)?n.path.isEqual(i):n.path.isImmediateParentOf(i)}(r,e)&&function(n,s){for(let i of xs(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(a,u,c){let h=jm(a,u,c);return a.inclusive?h<=0:h<0}(n.startAt,xs(n),s)||n.endAt&&!function(a,u,c){let h=jm(a,u,c);return a.inclusive?h>=0:h>0}(n.endAt,xs(n),s))}(r,e)}function YA(r){return r.collectionGroup||(r.path.length%2==1?r.path.lastSegment():r.path.get(r.path.length-2))}function zg(r){return(e,t)=>{let n=!1;for(let s of xs(r)){let i=XA(s,e,t);if(i!==0)return i;n=n||s.field.isKeyField()}return 0}}function XA(r,e,t){let n=r.field.isKeyField()?j.comparator(e.key,t.key):function(i,a,u){let c=a.data.field(i),h=u.data.field(i);return c!==null&&h!==null?vn(c,h):F()}(r.field,e,t);switch(r.dir){case"asc":return n;case"desc":return-1*n;default:return F()}}var St=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){tr(this.inner,(t,n)=>{for(let[s,i]of n)e(s,i)})}isEmpty(){return Pg(this.inner)}size(){return this.innerSize}};var ZA=new le(j.comparator);function Rt(){return ZA}var Gg=new le(j.comparator);function Es(...r){let e=Gg;for(let t of r)e=e.insert(t.key,t);return e}function Kg(r){let e=Gg;return r.forEach((t,n)=>e=e.insert(t,n.overlayedDocument)),e}function fr(){return As()}function Hg(){return As()}function As(){return new St(r=>r.toString(),(r,e)=>r.isEqual(e))}var eS=new le(j.comparator),tS=new ve(j.comparator);function H(...r){let e=tS;for(let t of r)e=e.add(t);return e}var rS=new ve(Q);function nS(){return rS}function Dl(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:Ps(e)?"-0":e}}function Wg(r){return{integerValue:""+r}}function sS(r,e){return DA(e)?Wg(e):Dl(r,e)}var In=class{constructor(){this._=void 0}};function iS(r,e,t){return r instanceof xn?function(s,i){let a={fields:{[kg]:{stringValue:Cg},[Og]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&Al(i)&&(i=na(i)),i&&(a.fields[Dg]=i),{mapValue:a}}(t,e):r instanceof _r?Jg(r,e):r instanceof vr?Yg(r,e):function(s,i){let a=Qg(s,i),u=qm(a)+qm(s.Ie);return Zu(a)&&Zu(s.Ie)?Wg(u):Dl(s.serializer,u)}(r,e)}function oS(r,e,t){return r instanceof _r?Jg(r,e):r instanceof vr?Yg(r,e):t}function Qg(r,e){return r instanceof An?function(n){return Zu(n)||function(i){return!!i&&"doubleValue"in i}(n)}(e)?e:{integerValue:0}:null}var xn=class extends In{},_r=class extends In{constructor(e){super(),this.elements=e}};function Jg(r,e){let t=Xg(e);for(let n of r.elements)t.some(s=>it(s,n))||t.push(n);return{arrayValue:{values:t}}}var vr=class extends In{constructor(e){super(),this.elements=e}};function Yg(r,e){let t=Xg(e);for(let n of r.elements)t=t.filter(s=>!it(s,n));return{arrayValue:{values:t}}}var An=class extends In{constructor(e,t){super(),this.serializer=e,this.Ie=t}};function qm(r){return oe(r.integerValue||r.doubleValue)}function Xg(r){return Pl(r)&&r.arrayValue.values?r.arrayValue.values.slice():[]}function aS(r,e){return r.field.isEqual(e.field)&&function(n,s){return n instanceof _r&&s instanceof _r||n instanceof vr&&s instanceof vr?gn(n.elements,s.elements,it):n instanceof An&&s instanceof An?it(n.Ie,s.Ie):n instanceof xn&&s instanceof xn}(r.transform,e.transform)}var hc=class{constructor(e,t){this.version=e,this.transformResults=t}},Jt=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 yo(r,e){return r.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(r.updateTime):r.exists===void 0||r.exists===e.isFoundDocument()}var Sn=class{};function Zg(r,e){if(!r.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return r.isNoDocument()?new So(r.key,Jt.none()):new wr(r.key,r.data,Jt.none());{let t=r.data,n=je.empty(),s=new ve(Ue.comparator);for(let i of e.fields)if(!s.has(i)){let a=t.field(i);a===null&&i.length>1&&(i=i.popLast(),a=t.field(i)),a===null?n.delete(i):n.set(i,a),s=s.add(i)}return new at(r.key,n,new qe(s.toArray()),Jt.none())}}function uS(r,e,t){r instanceof wr?function(s,i,a){let u=s.value.clone(),c=Gm(s.fieldTransforms,i,a.transformResults);u.setAll(c),i.convertToFoundDocument(a.version,u).setHasCommittedMutations()}(r,e,t):r instanceof at?function(s,i,a){if(!yo(s.precondition,i))return void i.convertToUnknownDocument(a.version);let u=Gm(s.fieldTransforms,i,a.transformResults),c=i.data;c.setAll(ey(s)),c.setAll(u),i.convertToFoundDocument(a.version,c).setHasCommittedMutations()}(r,e,t):function(s,i,a){i.convertToNoDocument(a.version).setHasCommittedMutations()}(0,e,t)}function Ss(r,e,t,n){return r instanceof wr?function(i,a,u,c){if(!yo(i.precondition,a))return u;let h=i.value.clone(),f=Km(i.fieldTransforms,c,a);return h.setAll(f),a.convertToFoundDocument(a.version,h).setHasLocalMutations(),null}(r,e,t,n):r instanceof at?function(i,a,u,c){if(!yo(i.precondition,a))return u;let h=Km(i.fieldTransforms,c,a),f=a.data;return f.setAll(ey(i)),f.setAll(h),a.convertToFoundDocument(a.version,f).setHasLocalMutations(),u===null?null:u.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(m=>m.field))}(r,e,t,n):function(i,a,u){return yo(i.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):u}(r,e,t)}function cS(r,e){let t=null;for(let n of r.fieldTransforms){let s=e.data.field(n.field),i=Qg(n.transform,s||null);i!=null&&(t===null&&(t=je.empty()),t.set(n.field,i))}return t||null}function zm(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)&&gn(n,s,(i,a)=>aS(i,a))}(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 wr=class extends Sn{constructor(e,t,n,s=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}},at=class extends Sn{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 ey(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 Gm(r,e,t){let n=new Map;ee(r.length===t.length);for(let s=0;s<t.length;s++){let i=r[s],a=i.transform,u=e.data.field(i.field);n.set(i.field,oS(a,u,t[s]))}return n}function Km(r,e,t){let n=new Map;for(let s of r){let i=s.transform,a=t.data.field(s.field);n.set(s.field,iS(i,a,e))}return n}var So=class extends Sn{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},dc=class extends Sn{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};var fc=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)&&uS(i,e,n[s])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=Ss(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=Ss(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=Hg();return this.mutations.forEach(s=>{let i=e.get(s.key),a=i.overlayedDocument,u=this.applyToLocalView(a,i.mutatedFields);u=t.has(s.key)?null:u;let c=Zg(a,u);c!==null&&n.set(s.key,c),a.isValidDocument()||a.convertToNoDocument(q.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),H())}isEqual(e){return this.batchId===e.batchId&&gn(this.mutations,e.mutations,(t,n)=>zm(t,n))&&gn(this.baseMutations,e.baseMutations,(t,n)=>zm(t,n))}},pc=class r{constructor(e,t,n,s){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=s}static from(e,t,n){ee(e.mutations.length===n.length);let s=function(){return eS}(),i=e.mutations;for(let a=0;a<i.length;a++)s=s.insert(i[a].key,n[a].version);return new r(e,t,n,s)}};var mc=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{
|
|
5
|
+
`+R+" "+N})}function Zr(o,c,d,p){o.info(function(){return"XMLHTTP TEXT ("+c+"): "+i0(o,d)+(p?" "+p:"")})}function n0(o,c){o.info(function(){return"TIMEOUT: "+c})}xi.prototype.info=function(){};function i0(o,c){if(!o.g)return c;if(!c)return null;try{var d=JSON.parse(c);if(d){for(o=0;o<d.length;o++)if(Array.isArray(d[o])){var p=d[o];if(!(2>p.length)){var x=p[1];if(Array.isArray(x)&&!(1>x.length)){var R=x[0];if(R!="noop"&&R!="stop"&&R!="close")for(var N=1;N<x.length;N++)x[N]=""}}}}return tu(d)}catch{return c}}var ao={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Nf={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},su;function lo(){}C(lo,ru),lo.prototype.g=function(){return new XMLHttpRequest},lo.prototype.i=function(){return{}},su=new lo;function qt(o,c,d,p){this.j=o,this.i=c,this.l=d,this.R=p||1,this.U=new Ti(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Vf}function Vf(){this.i=null,this.g="",this.h=!1}var Lf={},ou={};function au(o,c,d){o.L=1,o.v=fo(Tt(c)),o.m=d,o.P=!0,Mf(o,null)}function Mf(o,c){o.F=Date.now(),uo(o),o.A=Tt(o.v);var d=o.A,p=o.R;Array.isArray(p)||(p=[String(p)]),Yf(d.i,"t",p),o.C=0,d=o.j.J,o.h=new Vf,o.g=mp(o.j,d?c:null,!o.m),0<o.O&&(o.M=new XE(g(o.Y,o,o.g),o.O)),c=o.U,d=o.g,p=o.ca;var x="readystatechange";Array.isArray(x)||(x&&(xf[0]=x.toString()),x=xf);for(var R=0;R<x.length;R++){var N=wf(d,x[R],p||c.handleEvent,!1,c.h||c);if(!N)break;c.g[N.key]=N}c=o.H?y(o.H):{},o.m?(o.u||(o.u="POST"),c["Content-Type"]="application/x-www-form-urlencoded",o.g.ea(o.A,o.u,o.m,c)):(o.u="GET",o.g.ea(o.A,o.u,null,c)),Ii(),t0(o.i,o.u,o.A,o.l,o.R,o.m)}qt.prototype.ca=function(o){o=o.target;let c=this.M;c&&Et(o)==3?c.j():this.Y(o)},qt.prototype.Y=function(o){try{if(o==this.g)e:{let Pe=Et(this.g);var c=this.g.Ba();let rn=this.g.Z();if(!(3>Pe)&&(Pe!=3||this.g&&(this.h.h||this.g.oa()||ip(this.g)))){this.J||Pe!=4||c==7||(c==8||0>=rn?Ii(3):Ii(2)),lu(this);var d=this.g.Z();this.X=d;t:if(Ff(this)){var p=ip(this.g);o="";var x=p.length,R=Et(this.g)==4;if(!this.h.i){if(typeof TextDecoder=="undefined"){br(this),Si(this);var N="";break t}this.h.i=new l.TextDecoder}for(c=0;c<x;c++)this.h.h=!0,o+=this.h.i.decode(p[c],{stream:!(R&&c==x-1)});p.length=0,this.h.g+=o,this.C=0,N=this.h.g}else N=this.g.oa();if(this.o=d==200,r0(this.i,this.u,this.A,this.l,this.R,Pe,d),this.o){if(this.T&&!this.K){t:{if(this.g){var ne,Te=this.g;if((ne=Te.g?Te.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!F(ne)){var Z=ne;break t}}Z=null}if(d=Z)Zr(this.i,this.l,d,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,uu(this,d);else{this.o=!1,this.s=3,Ne(12),br(this),Si(this);break e}}if(this.P){d=!0;let et;for(;!this.J&&this.C<N.length;)if(et=s0(this,N),et==ou){Pe==4&&(this.s=4,Ne(14),d=!1),Zr(this.i,this.l,null,"[Incomplete Response]");break}else if(et==Lf){this.s=4,Ne(15),Zr(this.i,this.l,N,"[Invalid Chunk]"),d=!1;break}else Zr(this.i,this.l,et,null),uu(this,et);if(Ff(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Pe!=4||N.length!=0||this.h.h||(this.s=1,Ne(16),d=!1),this.o=this.o&&d,!d)Zr(this.i,this.l,N,"[Invalid Chunked Response]"),br(this),Si(this);else if(0<N.length&&!this.W){this.W=!0;var Re=this.j;Re.g==this&&Re.ba&&!Re.M&&(Re.j.info("Great, no buffering proxy detected. Bytes received: "+N.length),mu(Re),Re.M=!0,Ne(11))}}else Zr(this.i,this.l,N,null),uu(this,N);Pe==4&&br(this),this.o&&!this.J&&(Pe==4?hp(this.j,this):(this.o=!1,uo(this)))}else T0(this.g),d==400&&0<N.indexOf("Unknown SID")?(this.s=3,Ne(12)):(this.s=0,Ne(13)),br(this),Si(this)}}}catch{}finally{}};function Ff(o){return o.g?o.u=="GET"&&o.L!=2&&o.j.Ca:!1}function s0(o,c){var d=o.C,p=c.indexOf(`
|
|
6
|
+
`,d);return p==-1?ou:(d=Number(c.substring(d,p)),isNaN(d)?Lf:(p+=1,p+d>c.length?ou:(c=c.slice(p,p+d),o.C=p+d,c)))}qt.prototype.cancel=function(){this.J=!0,br(this)};function uo(o){o.S=Date.now()+o.I,jf(o,o.I)}function jf(o,c){if(o.B!=null)throw Error("WatchDog timer not null");o.B=Ai(g(o.ba,o),c)}function lu(o){o.B&&(l.clearTimeout(o.B),o.B=null)}qt.prototype.ba=function(){this.B=null;let o=Date.now();0<=o-this.S?(n0(this.i,this.A),this.L!=2&&(Ii(),Ne(17)),br(this),this.s=2,Si(this)):jf(this,this.S-o)};function Si(o){o.j.G==0||o.J||hp(o.j,o)}function br(o){lu(o);var c=o.M;c&&typeof c.ma=="function"&&c.ma(),o.M=null,Sf(o.U),o.g&&(c=o.g,o.g=null,c.abort(),c.ma())}function uu(o,c){try{var d=o.j;if(d.G!=0&&(d.g==o||cu(d.h,o))){if(!o.K&&cu(d.h,o)&&d.G==3){try{var p=d.Da.g.parse(c)}catch{p=null}if(Array.isArray(p)&&p.length==3){var x=p;if(x[0]==0){e:if(!d.u){if(d.g)if(d.g.F+3e3<o.F)_o(d),go(d);else break e;pu(d),Ne(18)}}else d.za=x[1],0<d.za-d.T&&37500>x[2]&&d.F&&d.v==0&&!d.C&&(d.C=Ai(g(d.Za,d),6e3));if(1>=$f(d.h)&&d.ca){try{d.ca()}catch{}d.ca=void 0}}else Er(d,11)}else if((o.K||d.g==o)&&_o(d),!F(c))for(x=d.Da.g.parse(c),c=0;c<x.length;c++){let Z=x[c];if(d.T=Z[0],Z=Z[1],d.G==2)if(Z[0]=="c"){d.K=Z[1],d.ia=Z[2];let Re=Z[3];Re!=null&&(d.la=Re,d.j.info("VER="+d.la));let Pe=Z[4];Pe!=null&&(d.Aa=Pe,d.j.info("SVER="+d.Aa));let rn=Z[5];rn!=null&&typeof rn=="number"&&0<rn&&(p=1.5*rn,d.L=p,d.j.info("backChannelRequestTimeoutMs_="+p)),p=d;let et=o.g;if(et){let vo=et.g?et.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(vo){var R=p.h;R.g||vo.indexOf("spdy")==-1&&vo.indexOf("quic")==-1&&vo.indexOf("h2")==-1||(R.j=R.l,R.g=new Set,R.h&&(hu(R,R.h),R.h=null))}if(p.D){let gu=et.g?et.g.getResponseHeader("X-HTTP-Session-Id"):null;gu&&(p.ya=gu,oe(p.I,p.D,gu))}}d.G=3,d.l&&d.l.ua(),d.ba&&(d.R=Date.now()-o.F,d.j.info("Handshake RTT: "+d.R+"ms")),p=d;var N=o;if(p.qa=pp(p,p.J?p.ia:null,p.W),N.K){qf(p.h,N);var ne=N,Te=p.L;Te&&(ne.I=Te),ne.B&&(lu(ne),uo(ne)),p.g=N}else up(p);0<d.i.length&&yo(d)}else Z[0]!="stop"&&Z[0]!="close"||Er(d,7);else d.G==3&&(Z[0]=="stop"||Z[0]=="close"?Z[0]=="stop"?Er(d,7):fu(d):Z[0]!="noop"&&d.l&&d.l.ta(Z),d.v=0)}}Ii(4)}catch{}}var o0=class{constructor(o,c){this.g=o,this.map=c}};function Uf(o){this.l=o||10,l.PerformanceNavigationTiming?(o=l.performance.getEntriesByType("navigation"),o=0<o.length&&(o[0].nextHopProtocol=="hq"||o[0].nextHopProtocol=="h2")):o=!!(l.chrome&&l.chrome.loadTimes&&l.chrome.loadTimes()&&l.chrome.loadTimes().wasFetchedViaSpdy),this.j=o?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Bf(o){return o.h?!0:o.g?o.g.size>=o.j:!1}function $f(o){return o.h?1:o.g?o.g.size:0}function cu(o,c){return o.h?o.h==c:o.g?o.g.has(c):!1}function hu(o,c){o.g?o.g.add(c):o.h=c}function qf(o,c){o.h&&o.h==c?o.h=null:o.g&&o.g.has(c)&&o.g.delete(c)}Uf.prototype.cancel=function(){if(this.i=zf(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let o of this.g.values())o.cancel();this.g.clear()}};function zf(o){if(o.h!=null)return o.i.concat(o.h.D);if(o.g!=null&&o.g.size!==0){let c=o.i;for(let d of o.g.values())c=c.concat(d.D);return c}return k(o.i)}function a0(o){if(o.V&&typeof o.V=="function")return o.V();if(typeof Map!="undefined"&&o instanceof Map||typeof Set!="undefined"&&o instanceof Set)return Array.from(o.values());if(typeof o=="string")return o.split("");if(u(o)){for(var c=[],d=o.length,p=0;p<d;p++)c.push(o[p]);return c}c=[],d=0;for(p in o)c[d++]=o[p];return c}function l0(o){if(o.na&&typeof o.na=="function")return o.na();if(!o.V||typeof o.V!="function"){if(typeof Map!="undefined"&&o instanceof Map)return Array.from(o.keys());if(!(typeof Set!="undefined"&&o instanceof Set)){if(u(o)||typeof o=="string"){var c=[];o=o.length;for(var d=0;d<o;d++)c.push(d);return c}c=[],d=0;for(let p in o)c[d++]=p;return c}}}function Gf(o,c){if(o.forEach&&typeof o.forEach=="function")o.forEach(c,void 0);else if(u(o)||typeof o=="string")Array.prototype.forEach.call(o,c,void 0);else for(var d=l0(o),p=a0(o),x=p.length,R=0;R<x;R++)c.call(void 0,p[R],d&&d[R],o)}var Kf=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function u0(o,c){if(o){o=o.split("&");for(var d=0;d<o.length;d++){var p=o[d].indexOf("="),x=null;if(0<=p){var R=o[d].substring(0,p);x=o[d].substring(p+1)}else R=o[d];c(R,x?decodeURIComponent(x.replace(/\+/g," ")):"")}}}function Tr(o){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,o instanceof Tr){this.h=o.h,co(this,o.j),this.o=o.o,this.g=o.g,ho(this,o.s),this.l=o.l;var c=o.i,d=new Ci;d.i=c.i,c.g&&(d.g=new Map(c.g),d.h=c.h),Hf(this,d),this.m=o.m}else o&&(c=String(o).match(Kf))?(this.h=!1,co(this,c[1]||"",!0),this.o=Ri(c[2]||""),this.g=Ri(c[3]||"",!0),ho(this,c[4]),this.l=Ri(c[5]||"",!0),Hf(this,c[6]||"",!0),this.m=Ri(c[7]||"")):(this.h=!1,this.i=new Ci(null,this.h))}Tr.prototype.toString=function(){var o=[],c=this.j;c&&o.push(Pi(c,Wf,!0),":");var d=this.g;return(d||c=="file")&&(o.push("//"),(c=this.o)&&o.push(Pi(c,Wf,!0),"@"),o.push(encodeURIComponent(String(d)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),d=this.s,d!=null&&o.push(":",String(d))),(d=this.l)&&(this.g&&d.charAt(0)!="/"&&o.push("/"),o.push(Pi(d,d.charAt(0)=="/"?d0:h0,!0))),(d=this.i.toString())&&o.push("?",d),(d=this.m)&&o.push("#",Pi(d,p0)),o.join("")};function Tt(o){return new Tr(o)}function co(o,c,d){o.j=d?Ri(c,!0):c,o.j&&(o.j=o.j.replace(/:$/,""))}function ho(o,c){if(c){if(c=Number(c),isNaN(c)||0>c)throw Error("Bad port number "+c);o.s=c}else o.s=null}function Hf(o,c,d){c instanceof Ci?(o.i=c,m0(o.i,o.h)):(d||(c=Pi(c,f0)),o.i=new Ci(c,o.h))}function oe(o,c,d){o.i.set(c,d)}function fo(o){return oe(o,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),o}function Ri(o,c){return o?c?decodeURI(o.replace(/%25/g,"%2525")):decodeURIComponent(o):""}function Pi(o,c,d){return typeof o=="string"?(o=encodeURI(o).replace(c,c0),d&&(o=o.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),o):null}function c0(o){return o=o.charCodeAt(0),"%"+(o>>4&15).toString(16)+(o&15).toString(16)}var Wf=/[#\/\?@]/g,h0=/[#\?:]/g,d0=/[#\?]/g,f0=/[#\?@]/g,p0=/#/g;function Ci(o,c){this.h=this.g=null,this.i=o||null,this.j=!!c}function zt(o){o.g||(o.g=new Map,o.h=0,o.i&&u0(o.i,function(c,d){o.add(decodeURIComponent(c.replace(/\+/g," ")),d)}))}r=Ci.prototype,r.add=function(o,c){zt(this),this.i=null,o=en(this,o);var d=this.g.get(o);return d||this.g.set(o,d=[]),d.push(c),this.h+=1,this};function Qf(o,c){zt(o),c=en(o,c),o.g.has(c)&&(o.i=null,o.h-=o.g.get(c).length,o.g.delete(c))}function Jf(o,c){return zt(o),c=en(o,c),o.g.has(c)}r.forEach=function(o,c){zt(this),this.g.forEach(function(d,p){d.forEach(function(x){o.call(c,x,p,this)},this)},this)},r.na=function(){zt(this);let o=Array.from(this.g.values()),c=Array.from(this.g.keys()),d=[];for(let p=0;p<c.length;p++){let x=o[p];for(let R=0;R<x.length;R++)d.push(c[p])}return d},r.V=function(o){zt(this);let c=[];if(typeof o=="string")Jf(this,o)&&(c=c.concat(this.g.get(en(this,o))));else{o=Array.from(this.g.values());for(let d=0;d<o.length;d++)c=c.concat(o[d])}return c},r.set=function(o,c){return zt(this),this.i=null,o=en(this,o),Jf(this,o)&&(this.h-=this.g.get(o).length),this.g.set(o,[c]),this.h+=1,this},r.get=function(o,c){return o?(o=this.V(o),0<o.length?String(o[0]):c):c};function Yf(o,c,d){Qf(o,c),0<d.length&&(o.i=null,o.g.set(en(o,c),k(d)),o.h+=d.length)}r.toString=function(){if(this.i)return this.i;if(!this.g)return"";let o=[],c=Array.from(this.g.keys());for(var d=0;d<c.length;d++){var p=c[d];let R=encodeURIComponent(String(p)),N=this.V(p);for(p=0;p<N.length;p++){var x=R;N[p]!==""&&(x+="="+encodeURIComponent(String(N[p]))),o.push(x)}}return this.i=o.join("&")};function en(o,c){return c=String(c),o.j&&(c=c.toLowerCase()),c}function m0(o,c){c&&!o.j&&(zt(o),o.i=null,o.g.forEach(function(d,p){var x=p.toLowerCase();p!=x&&(Qf(this,p),Yf(this,x,d))},o)),o.j=c}function g0(o,c){let d=new xi;if(l.Image){let p=new Image;p.onload=I(Gt,d,"TestLoadImage: loaded",!0,c,p),p.onerror=I(Gt,d,"TestLoadImage: error",!1,c,p),p.onabort=I(Gt,d,"TestLoadImage: abort",!1,c,p),p.ontimeout=I(Gt,d,"TestLoadImage: timeout",!1,c,p),l.setTimeout(function(){p.ontimeout&&p.ontimeout()},1e4),p.src=o}else c(!1)}function y0(o,c){let d=new xi,p=new AbortController,x=setTimeout(()=>{p.abort(),Gt(d,"TestPingServer: timeout",!1,c)},1e4);fetch(o,{signal:p.signal}).then(R=>{clearTimeout(x),R.ok?Gt(d,"TestPingServer: ok",!0,c):Gt(d,"TestPingServer: server error",!1,c)}).catch(()=>{clearTimeout(x),Gt(d,"TestPingServer: error",!1,c)})}function Gt(o,c,d,p,x){try{x&&(x.onload=null,x.onerror=null,x.onabort=null,x.ontimeout=null),p(d)}catch{}}function _0(){this.g=new e0}function w0(o,c,d){let p=d||"";try{Gf(o,function(x,R){let N=x;h(x)&&(N=tu(x)),c.push(p+R+"="+encodeURIComponent(N))})}catch(x){throw c.push(p+"type="+encodeURIComponent("_badmap")),x}}function ki(o){this.l=o.Ub||null,this.j=o.eb||!1}C(ki,ru),ki.prototype.g=function(){return new po(this.l,this.j)},ki.prototype.i=function(o){return function(){return o}}({});function po(o,c){Se.call(this),this.D=o,this.o=c,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}C(po,Se),r=po.prototype,r.open=function(o,c){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=o,this.A=c,this.readyState=1,Oi(this)},r.send=function(o){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;let c={headers:this.u,method:this.B,credentials:this.m,cache:void 0};o&&(c.body=o),(this.D||l).fetch(new Request(this.A,c)).then(this.Sa.bind(this),this.ga.bind(this))},r.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,Di(this)),this.readyState=0},r.Sa=function(o){if(this.g&&(this.l=o,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=o.headers,this.readyState=2,Oi(this)),this.g&&(this.readyState=3,Oi(this),this.g)))if(this.responseType==="arraybuffer")o.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof l.ReadableStream!="undefined"&&"body"in o){if(this.j=o.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.v=new TextDecoder;Xf(this)}else o.text().then(this.Ra.bind(this),this.ga.bind(this))};function Xf(o){o.j.read().then(o.Pa.bind(o)).catch(o.ga.bind(o))}r.Pa=function(o){if(this.g){if(this.o&&o.value)this.response.push(o.value);else if(!this.o){var c=o.value?o.value:new Uint8Array(0);(c=this.v.decode(c,{stream:!o.done}))&&(this.response=this.responseText+=c)}o.done?Di(this):Oi(this),this.readyState==3&&Xf(this)}},r.Ra=function(o){this.g&&(this.response=this.responseText=o,Di(this))},r.Qa=function(o){this.g&&(this.response=o,Di(this))},r.ga=function(){this.g&&Di(this)};function Di(o){o.readyState=4,o.l=null,o.j=null,o.v=null,Oi(o)}r.setRequestHeader=function(o,c){this.u.append(o,c)},r.getResponseHeader=function(o){return this.h&&this.h.get(o.toLowerCase())||""},r.getAllResponseHeaders=function(){if(!this.h)return"";let o=[],c=this.h.entries();for(var d=c.next();!d.done;)d=d.value,o.push(d[0]+": "+d[1]),d=c.next();return o.join(`\r
|
|
7
|
+
`)};function Oi(o){o.onreadystatechange&&o.onreadystatechange.call(o)}Object.defineProperty(po.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(o){this.m=o?"include":"same-origin"}});function Zf(o){let c="";return $(o,function(d,p){c+=p,c+=":",c+=d,c+=`\r
|
|
8
|
+
`}),c}function du(o,c,d){e:{for(p in d){var p=!1;break e}p=!0}p||(d=Zf(d),typeof o=="string"?d!=null&&encodeURIComponent(String(d)):oe(o,c,d))}function ce(o){Se.call(this),this.headers=new Map,this.o=o||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}C(ce,Se);var v0=/^https?$/i,b0=["POST","PUT"];r=ce.prototype,r.Ha=function(o){this.J=o},r.ea=function(o,c,d,p){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+o);c=c?c.toUpperCase():"GET",this.D=o,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():su.g(),this.v=this.o?Rf(this.o):Rf(su),this.g.onreadystatechange=g(this.Ea,this);try{this.B=!0,this.g.open(c,String(o),!0),this.B=!1}catch(R){ep(this,R);return}if(o=d||"",d=new Map(this.headers),p)if(Object.getPrototypeOf(p)===Object.prototype)for(var x in p)d.set(x,p[x]);else if(typeof p.keys=="function"&&typeof p.get=="function")for(let R of p.keys())d.set(R,p.get(R));else throw Error("Unknown input type for opt_headers: "+String(p));p=Array.from(d.keys()).find(R=>R.toLowerCase()=="content-type"),x=l.FormData&&o instanceof l.FormData,!(0<=Array.prototype.indexOf.call(b0,c,void 0))||p||x||d.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(let[R,N]of d)this.g.setRequestHeader(R,N);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{np(this),this.u=!0,this.g.send(o),this.u=!1}catch(R){ep(this,R)}};function ep(o,c){o.h=!1,o.g&&(o.j=!0,o.g.abort(),o.j=!1),o.l=c,o.m=5,tp(o),mo(o)}function tp(o){o.A||(o.A=!0,Oe(o,"complete"),Oe(o,"error"))}r.abort=function(o){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=o||7,Oe(this,"complete"),Oe(this,"abort"),mo(this))},r.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),mo(this,!0)),ce.aa.N.call(this)},r.Ea=function(){this.s||(this.B||this.u||this.j?rp(this):this.bb())},r.bb=function(){rp(this)};function rp(o){if(o.h&&typeof a!="undefined"&&(!o.v[1]||Et(o)!=4||o.Z()!=2)){if(o.u&&Et(o)==4)If(o.Ea,0,o);else if(Oe(o,"readystatechange"),Et(o)==4){o.h=!1;try{let N=o.Z();e:switch(N){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break e;default:c=!1}var d;if(!(d=c)){var p;if(p=N===0){var x=String(o.D).match(Kf)[1]||null;!x&&l.self&&l.self.location&&(x=l.self.location.protocol.slice(0,-1)),p=!v0.test(x?x.toLowerCase():"")}d=p}if(d)Oe(o,"complete"),Oe(o,"success");else{o.m=6;try{var R=2<Et(o)?o.g.statusText:""}catch{R=""}o.l=R+" ["+o.Z()+"]",tp(o)}}finally{mo(o)}}}}function mo(o,c){if(o.g){np(o);let d=o.g,p=o.v[0]?()=>{}:null;o.g=null,o.v=null,c||Oe(o,"ready");try{d.onreadystatechange=p}catch{}}}function np(o){o.I&&(l.clearTimeout(o.I),o.I=null)}r.isActive=function(){return!!this.g};function Et(o){return o.g?o.g.readyState:0}r.Z=function(){try{return 2<Et(this)?this.g.status:-1}catch{return-1}},r.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},r.Oa=function(o){if(this.g){var c=this.g.responseText;return o&&c.indexOf(o)==0&&(c=c.substring(o.length)),ZE(c)}};function ip(o){try{if(!o.g)return null;if("response"in o.g)return o.g.response;switch(o.H){case"":case"text":return o.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in o.g)return o.g.mozResponseArrayBuffer}return null}catch{return null}}function T0(o){let c={};o=(o.g&&2<=Et(o)&&o.g.getAllResponseHeaders()||"").split(`\r
|
|
9
|
+
`);for(let p=0;p<o.length;p++){if(F(o[p]))continue;var d=A(o[p]);let x=d[0];if(d=d[1],typeof d!="string")continue;d=d.trim();let R=c[x]||[];c[x]=R,R.push(d)}E(c,function(p){return p.join(", ")})}r.Ba=function(){return this.m},r.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function Ni(o,c,d){return d&&d.internalChannelParams&&d.internalChannelParams[o]||c}function sp(o){this.Aa=0,this.i=[],this.j=new xi,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=Ni("failFast",!1,o),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=Ni("baseRetryDelayMs",5e3,o),this.cb=Ni("retryDelaySeedMs",1e4,o),this.Wa=Ni("forwardChannelMaxRetries",2,o),this.wa=Ni("forwardChannelRequestTimeoutMs",2e4,o),this.pa=o&&o.xmlHttpFactory||void 0,this.Xa=o&&o.Tb||void 0,this.Ca=o&&o.useFetchStreams||!1,this.L=void 0,this.J=o&&o.supportsCrossDomainXhr||!1,this.K="",this.h=new Uf(o&&o.concurrentRequestLimit),this.Da=new _0,this.P=o&&o.fastHandshake||!1,this.O=o&&o.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=o&&o.Rb||!1,o&&o.xa&&this.j.xa(),o&&o.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&o&&o.detectBufferingProxy||!1,this.ja=void 0,o&&o.longPollingTimeout&&0<o.longPollingTimeout&&(this.ja=o.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}r=sp.prototype,r.la=8,r.G=1,r.connect=function(o,c,d,p){Ne(0),this.W=o,this.H=c||{},d&&p!==void 0&&(this.H.OSID=d,this.H.OAID=p),this.F=this.X,this.I=pp(this,null,this.W),yo(this)};function fu(o){if(op(o),o.G==3){var c=o.U++,d=Tt(o.I);if(oe(d,"SID",o.K),oe(d,"RID",c),oe(d,"TYPE","terminate"),Vi(o,d),c=new qt(o,o.j,c),c.L=2,c.v=fo(Tt(d)),d=!1,l.navigator&&l.navigator.sendBeacon)try{d=l.navigator.sendBeacon(c.v.toString(),"")}catch{}!d&&l.Image&&(new Image().src=c.v,d=!0),d||(c.g=mp(c.j,null),c.g.ea(c.v)),c.F=Date.now(),uo(c)}fp(o)}function go(o){o.g&&(mu(o),o.g.cancel(),o.g=null)}function op(o){go(o),o.u&&(l.clearTimeout(o.u),o.u=null),_o(o),o.h.cancel(),o.s&&(typeof o.s=="number"&&l.clearTimeout(o.s),o.s=null)}function yo(o){if(!Bf(o.h)&&!o.s){o.s=!0;var c=o.Ga;_i||_f(),wi||(_i(),wi=!0),Kl.add(c,o),o.B=0}}function E0(o,c){return $f(o.h)>=o.h.j-(o.s?1:0)?!1:o.s?(o.i=c.D.concat(o.i),!0):o.G==1||o.G==2||o.B>=(o.Va?0:o.Wa)?!1:(o.s=Ai(g(o.Ga,o,c),dp(o,o.B)),o.B++,!0)}r.Ga=function(o){if(this.s)if(this.s=null,this.G==1){if(!o){this.U=Math.floor(1e5*Math.random()),o=this.U++;let x=new qt(this,this.j,o),R=this.o;if(this.S&&(R?(R=y(R),T(R,this.S)):R=this.S),this.m!==null||this.O||(x.H=R,R=null),this.P)e:{for(var c=0,d=0;d<this.i.length;d++){t:{var p=this.i[d];if("__data__"in p.map&&(p=p.map.__data__,typeof p=="string")){p=p.length;break t}p=void 0}if(p===void 0)break;if(c+=p,4096<c){c=d;break e}if(c===4096||d===this.i.length-1){c=d+1;break e}}c=1e3}else c=1e3;c=lp(this,x,c),d=Tt(this.I),oe(d,"RID",o),oe(d,"CVER",22),this.D&&oe(d,"X-HTTP-Session-Id",this.D),Vi(this,d),R&&(this.O?c="headers="+encodeURIComponent(String(Zf(R)))+"&"+c:this.m&&du(d,this.m,R)),hu(this.h,x),this.Ua&&oe(d,"TYPE","init"),this.P?(oe(d,"$req",c),oe(d,"SID","null"),x.T=!0,au(x,d,null)):au(x,d,c),this.G=2}}else this.G==3&&(o?ap(this,o):this.i.length==0||Bf(this.h)||ap(this))};function ap(o,c){var d;c?d=c.l:d=o.U++;let p=Tt(o.I);oe(p,"SID",o.K),oe(p,"RID",d),oe(p,"AID",o.T),Vi(o,p),o.m&&o.o&&du(p,o.m,o.o),d=new qt(o,o.j,d,o.B+1),o.m===null&&(d.H=o.o),c&&(o.i=c.D.concat(o.i)),c=lp(o,d,1e3),d.I=Math.round(.5*o.wa)+Math.round(.5*o.wa*Math.random()),hu(o.h,d),au(d,p,c)}function Vi(o,c){o.H&&$(o.H,function(d,p){oe(c,p,d)}),o.l&&Gf({},function(d,p){oe(c,p,d)})}function lp(o,c,d){d=Math.min(o.i.length,d);var p=o.l?g(o.l.Na,o.l,o):null;e:{var x=o.i;let R=-1;for(;;){let N=["count="+d];R==-1?0<d?(R=x[0].g,N.push("ofs="+R)):R=0:N.push("ofs="+R);let ne=!0;for(let Te=0;Te<d;Te++){let Z=x[Te].g,Re=x[Te].map;if(Z-=R,0>Z)R=Math.max(0,x[Te].g-100),ne=!1;else try{w0(Re,N,"req"+Z+"_")}catch{p&&p(Re)}}if(ne){p=N.join("&");break e}}}return o=o.i.splice(0,d),c.D=o,p}function up(o){if(!o.g&&!o.u){o.Y=1;var c=o.Fa;_i||_f(),wi||(_i(),wi=!0),Kl.add(c,o),o.v=0}}function pu(o){return o.g||o.u||3<=o.v?!1:(o.Y++,o.u=Ai(g(o.Fa,o),dp(o,o.v)),o.v++,!0)}r.Fa=function(){if(this.u=null,cp(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var o=2*this.R;this.j.info("BP detection timer enabled: "+o),this.A=Ai(g(this.ab,this),o)}},r.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Ne(10),go(this),cp(this))};function mu(o){o.A!=null&&(l.clearTimeout(o.A),o.A=null)}function cp(o){o.g=new qt(o,o.j,"rpc",o.Y),o.m===null&&(o.g.H=o.o),o.g.O=0;var c=Tt(o.qa);oe(c,"RID","rpc"),oe(c,"SID",o.K),oe(c,"AID",o.T),oe(c,"CI",o.F?"0":"1"),!o.F&&o.ja&&oe(c,"TO",o.ja),oe(c,"TYPE","xmlhttp"),Vi(o,c),o.m&&o.o&&du(c,o.m,o.o),o.L&&(o.g.I=o.L);var d=o.g;o=o.ia,d.L=1,d.v=fo(Tt(c)),d.m=null,d.P=!0,Mf(d,o)}r.Za=function(){this.C!=null&&(this.C=null,go(this),pu(this),Ne(19))};function _o(o){o.C!=null&&(l.clearTimeout(o.C),o.C=null)}function hp(o,c){var d=null;if(o.g==c){_o(o),mu(o),o.g=null;var p=2}else if(cu(o.h,c))d=c.D,qf(o.h,c),p=1;else return;if(o.G!=0){if(c.o)if(p==1){d=c.m?c.m.length:0,c=Date.now()-c.F;var x=o.B;p=oo(),Oe(p,new Of(p,d)),yo(o)}else up(o);else if(x=c.s,x==3||x==0&&0<c.X||!(p==1&&E0(o,c)||p==2&&pu(o)))switch(d&&0<d.length&&(c=o.h,c.i=c.i.concat(d)),x){case 1:Er(o,5);break;case 4:Er(o,10);break;case 3:Er(o,6);break;default:Er(o,2)}}}function dp(o,c){let d=o.Ta+Math.floor(Math.random()*o.cb);return o.isActive()||(d*=2),d*c}function Er(o,c){if(o.j.info("Error code "+c),c==2){var d=g(o.fb,o),p=o.Xa;let x=!p;p=new Tr(p||"//www.google.com/images/cleardot.gif"),l.location&&l.location.protocol=="http"||co(p,"https"),fo(p),x?g0(p.toString(),d):y0(p.toString(),d)}else Ne(2);o.G=0,o.l&&o.l.sa(c),fp(o),op(o)}r.fb=function(o){o?(this.j.info("Successfully pinged google.com"),Ne(2)):(this.j.info("Failed to ping google.com"),Ne(1))};function fp(o){if(o.G=0,o.ka=[],o.l){let c=zf(o.h);(c.length!=0||o.i.length!=0)&&(P(o.ka,c),P(o.ka,o.i),o.h.i.length=0,k(o.i),o.i.length=0),o.l.ra()}}function pp(o,c,d){var p=d instanceof Tr?Tt(d):new Tr(d);if(p.g!="")c&&(p.g=c+"."+p.g),ho(p,p.s);else{var x=l.location;p=x.protocol,c=c?c+"."+x.hostname:x.hostname,x=+x.port;var R=new Tr(null);p&&co(R,p),c&&(R.g=c),x&&ho(R,x),d&&(R.l=d),p=R}return d=o.D,c=o.ya,d&&c&&oe(p,d,c),oe(p,"VER",o.la),Vi(o,p),p}function mp(o,c,d){if(c&&!o.J)throw Error("Can't create secondary domain capable XhrIo object.");return c=o.Ca&&!o.pa?new ce(new ki({eb:d})):new ce(o.pa),c.Ha(o.J),c}r.isActive=function(){return!!this.l&&this.l.isActive(this)};function gp(){}r=gp.prototype,r.ua=function(){},r.ta=function(){},r.sa=function(){},r.ra=function(){},r.isActive=function(){return!0},r.Na=function(){};function wo(){}wo.prototype.g=function(o,c){return new ze(o,c)};function ze(o,c){Se.call(this),this.g=new sp(c),this.l=o,this.h=c&&c.messageUrlParams||null,o=c&&c.messageHeaders||null,c&&c.clientProtocolHeaderRequired&&(o?o["X-Client-Protocol"]="webchannel":o={"X-Client-Protocol":"webchannel"}),this.g.o=o,o=c&&c.initMessageHeaders||null,c&&c.messageContentType&&(o?o["X-WebChannel-Content-Type"]=c.messageContentType:o={"X-WebChannel-Content-Type":c.messageContentType}),c&&c.va&&(o?o["X-WebChannel-Client-Profile"]=c.va:o={"X-WebChannel-Client-Profile":c.va}),this.g.S=o,(o=c&&c.Sb)&&!F(o)&&(this.g.m=o),this.v=c&&c.supportsCrossDomainXhr||!1,this.u=c&&c.sendRawJson||!1,(c=c&&c.httpSessionIdParam)&&!F(c)&&(this.g.D=c,o=this.h,o!==null&&c in o&&(o=this.h,c in o&&delete o[c])),this.j=new tn(this)}C(ze,Se),ze.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},ze.prototype.close=function(){fu(this.g)},ze.prototype.o=function(o){var c=this.g;if(typeof o=="string"){var d={};d.__data__=o,o=d}else this.u&&(d={},d.__data__=tu(o),o=d);c.i.push(new o0(c.Ya++,o)),c.G==3&&yo(c)},ze.prototype.N=function(){this.g.l=null,delete this.j,fu(this.g),delete this.g,ze.aa.N.call(this)};function yp(o){nu.call(this),o.__headers__&&(this.headers=o.__headers__,this.statusCode=o.__status__,delete o.__headers__,delete o.__status__);var c=o.__sm__;if(c){e:{for(let d in c){o=d;break e}o=void 0}(this.i=o)&&(o=this.i,c=c!==null&&o in c?c[o]:void 0),this.data=c}else this.data=o}C(yp,nu);function _p(){iu.call(this),this.status=1}C(_p,iu);function tn(o){this.g=o}C(tn,gp),tn.prototype.ua=function(){Oe(this.g,"a")},tn.prototype.ta=function(o){Oe(this.g,new yp(o))},tn.prototype.sa=function(o){Oe(this.g,new _p)},tn.prototype.ra=function(){Oe(this.g,"b")},wo.prototype.createWebChannel=wo.prototype.g,ze.prototype.send=ze.prototype.o,ze.prototype.open=ze.prototype.m,ze.prototype.close=ze.prototype.close,wc=Ot.createWebChannelTransport=function(){return new wo},_c=Ot.getStatEventTarget=function(){return oo()},yc=Ot.Event=vr,pa=Ot.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},ao.NO_ERROR=0,ao.TIMEOUT=8,ao.HTTP_ERROR=6,is=Ot.ErrorCode=ao,Nf.COMPLETE="complete",gc=Ot.EventType=Nf,Pf.EventType=Ei,Ei.OPEN="a",Ei.CLOSE="b",Ei.ERROR="c",Ei.MESSAGE="d",Se.prototype.listen=Se.prototype.K,Rn=Ot.WebChannel=Pf,hk=Ot.FetchXmlHttpFactory=ki,ce.prototype.listenOnce=ce.prototype.L,ce.prototype.getLastError=ce.prototype.Ka,ce.prototype.getLastErrorCode=ce.prototype.Ba,ce.prototype.getStatus=ce.prototype.Z,ce.prototype.getResponseJson=ce.prototype.Oa,ce.prototype.getResponseText=ce.prototype.oa,ce.prototype.send=ce.prototype.ea,ce.prototype.setWithCredentials=ce.prototype.Ha,mc=Ot.XhrIo=ce}).apply(typeof fa!="undefined"?fa:typeof self!="undefined"?self:typeof window!="undefined"?window:{})});function Pn(){return Dr.logLevel}function L(r,...e){if(Dr.logLevel<=Q.DEBUG){let t=e.map(sd);Dr.debug(`Firestore (${Xn}): ${r}`,...t)}}function Nt(r,...e){if(Dr.logLevel<=Q.ERROR){let t=e.map(sd);Dr.error(`Firestore (${Xn}): ${r}`,...t)}}function Ln(r,...e){if(Dr.logLevel<=Q.WARN){let t=e.map(sd);Dr.warn(`Firestore (${Xn}): ${r}`,...t)}}function sd(r){if(typeof r=="string")return r;try{return function(t){return JSON.stringify(t)}(r)}catch{return r}}function j(r="Unexpected state"){let e=`FIRESTORE (${Xn}) INTERNAL ASSERTION FAILED: `+r;throw Nt(e),new Error(e)}function re(r,e){r||j()}function q(r,e){return r}function dk(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}function J(r,e){return r<e?-1:r>e?1:0}function Mn(r,e,t){return r.length===e.length&&r.every((n,i)=>t(n,e[i]))}function pk(r,e){let t=r.toTimestamp().seconds,n=r.toTimestamp().nanoseconds+1,i=z.fromTimestamp(n===1e9?new Ee(t+1,0):new Ee(t,n));return new Or(i,U.empty(),e)}function mk(r){return new Or(r.readTime,r.key,cs)}function gk(r,e){let t=r.readTime.compareTo(e.readTime);return t!==0?t:(t=U.comparator(r.documentKey,e.documentKey),t!==0?t:J(r.largestBatchId,e.largestBatchId))}async function Zn(r){if(r.code!==O.FAILED_PRECONDITION||r.message!==yk)throw r;L("LocalStore","Unexpectedly lost primary lease")}function _k(r){let e=r.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function ei(r){return r.name==="IndexedDbTransactionError"}function sl(r){return r==null}function hs(r){return r===0&&1/r==-1/0}function wk(r){return typeof r=="number"&&Number.isInteger(r)&&!hs(r)&&r<=Number.MAX_SAFE_INTEGER&&r>=Number.MIN_SAFE_INTEGER}function vk(r){let e="";for(let t=0;t<r.length;t++)e.length>0&&(e=Nw(e)),e=bk(r.get(t),e);return Nw(e)}function bk(r,e){let t=e,n=r.length;for(let i=0;i<n;i++){let s=r.charAt(i);switch(s){case"\0":t+="";break;case gv:t+="";break;default:t+=s}}return t}function Nw(r){return r+gv+""}function Vw(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 Cv(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Vt(r){if(re(!!r),typeof r=="string"){let e=0,t=Dk.exec(r);if(re(!!t),t[1]){let i=t[1];i=(i+"000000000").substr(0,9),e=Number(i)}let n=new Date(r);return{seconds:Math.floor(n.getTime()/1e3),nanos:e}}return{seconds:ue(r.seconds),nanos:ue(r.nanos)}}function ue(r){return typeof r=="number"?r:typeof r=="string"?Number(r):0}function Lt(r){return typeof r=="string"?De.fromBase64String(r):De.fromUint8Array(r)}function ad(r){var e,t;return((t=(((e=r==null?void 0:r.mapValue)===null||e===void 0?void 0:e.fields)||{})[Dv])===null||t===void 0?void 0:t.stringValue)===kv}function ol(r){let e=r.mapValue.fields[Ov];return ad(e)?ol(e):e}function ds(r){let e=Vt(r.mapValue.fields[Nv].timestampValue);return new Ee(e.seconds,e.nanos)}function cr(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?ad(r)?4:Mv(r)?9007199254740991:Lv(r)?10:11:j()}function mt(r,e){if(r===e)return!0;let t=cr(r);if(t!==cr(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return r.booleanValue===e.booleanValue;case 4:return ds(r).isEqual(ds(e));case 3:return function(i,s){if(typeof i.timestampValue=="string"&&typeof s.timestampValue=="string"&&i.timestampValue.length===s.timestampValue.length)return i.timestampValue===s.timestampValue;let a=Vt(i.timestampValue),l=Vt(s.timestampValue);return a.seconds===l.seconds&&a.nanos===l.nanos}(r,e);case 5:return r.stringValue===e.stringValue;case 6:return function(i,s){return Lt(i.bytesValue).isEqual(Lt(s.bytesValue))}(r,e);case 7:return r.referenceValue===e.referenceValue;case 8:return function(i,s){return ue(i.geoPointValue.latitude)===ue(s.geoPointValue.latitude)&&ue(i.geoPointValue.longitude)===ue(s.geoPointValue.longitude)}(r,e);case 2:return function(i,s){if("integerValue"in i&&"integerValue"in s)return ue(i.integerValue)===ue(s.integerValue);if("doubleValue"in i&&"doubleValue"in s){let a=ue(i.doubleValue),l=ue(s.doubleValue);return a===l?hs(a)===hs(l):isNaN(a)&&isNaN(l)}return!1}(r,e);case 9:return Mn(r.arrayValue.values||[],e.arrayValue.values||[],mt);case 10:case 11:return function(i,s){let a=i.mapValue.fields||{},l=s.mapValue.fields||{};if(Vw(a)!==Vw(l))return!1;for(let u in a)if(a.hasOwnProperty(u)&&(l[u]===void 0||!mt(a[u],l[u])))return!1;return!0}(r,e);default:return j()}}function fs(r,e){return(r.values||[]).find(t=>mt(t,e))!==void 0}function Un(r,e){if(r===e)return 0;let t=cr(r),n=cr(e);if(t!==n)return J(t,n);switch(t){case 0:case 9007199254740991:return 0;case 1:return J(r.booleanValue,e.booleanValue);case 2:return function(s,a){let l=ue(s.integerValue||s.doubleValue),u=ue(a.integerValue||a.doubleValue);return l<u?-1:l>u?1:l===u?0:isNaN(l)?isNaN(u)?0:-1:1}(r,e);case 3:return Lw(r.timestampValue,e.timestampValue);case 4:return Lw(ds(r),ds(e));case 5:return J(r.stringValue,e.stringValue);case 6:return function(s,a){let l=Lt(s),u=Lt(a);return l.compareTo(u)}(r.bytesValue,e.bytesValue);case 7:return function(s,a){let l=s.split("/"),u=a.split("/");for(let h=0;h<l.length&&h<u.length;h++){let f=J(l[h],u[h]);if(f!==0)return f}return J(l.length,u.length)}(r.referenceValue,e.referenceValue);case 8:return function(s,a){let l=J(ue(s.latitude),ue(a.latitude));return l!==0?l:J(ue(s.longitude),ue(a.longitude))}(r.geoPointValue,e.geoPointValue);case 9:return Mw(r.arrayValue,e.arrayValue);case 10:return function(s,a){var l,u,h,f;let m=s.fields||{},g=a.fields||{},I=(l=m[jn])===null||l===void 0?void 0:l.arrayValue,C=(u=g[jn])===null||u===void 0?void 0:u.arrayValue,k=J(((h=I==null?void 0:I.values)===null||h===void 0?void 0:h.length)||0,((f=C==null?void 0:C.values)===null||f===void 0?void 0:f.length)||0);return k!==0?k:Mw(I,C)}(r.mapValue,e.mapValue);case 11:return function(s,a){if(s===ma.mapValue&&a===ma.mapValue)return 0;if(s===ma.mapValue)return 1;if(a===ma.mapValue)return-1;let l=s.fields||{},u=Object.keys(l),h=a.fields||{},f=Object.keys(h);u.sort(),f.sort();for(let m=0;m<u.length&&m<f.length;++m){let g=J(u[m],f[m]);if(g!==0)return g;let I=Un(l[u[m]],h[f[m]]);if(I!==0)return I}return J(u.length,f.length)}(r.mapValue,e.mapValue);default:throw j()}}function Lw(r,e){if(typeof r=="string"&&typeof e=="string"&&r.length===e.length)return J(r,e);let t=Vt(r),n=Vt(e),i=J(t.seconds,n.seconds);return i!==0?i:J(t.nanos,n.nanos)}function Mw(r,e){let t=r.values||[],n=e.values||[];for(let i=0;i<t.length&&i<n.length;++i){let s=Un(t[i],n[i]);if(s)return s}return J(t.length,n.length)}function Bn(r){return Oc(r)}function Oc(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 U.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="[",i=!0;for(let s of t.values||[])i?i=!1:n+=",",n+=Oc(s);return n+"]"}(r.arrayValue):"mapValue"in r?function(t){let n=Object.keys(t.fields||{}).sort(),i="{",s=!0;for(let a of n)s?s=!1:i+=",",i+=`${a}:${Oc(t.fields[a])}`;return i+"}"}(r.mapValue):j()}function _a(r){switch(cr(r)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let e=ol(r);return e?16+_a(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((i,s)=>i+_a(s),0)}(r.arrayValue);case 10:case 11:return function(n){let i=0;return pr(n.fields,(s,a)=>{i+=s.length+_a(a)}),i}(r.mapValue);default:throw j()}}function Nc(r){return!!r&&"integerValue"in r}function cd(r){return!!r&&"arrayValue"in r}function Fw(r){return!!r&&"nullValue"in r}function jw(r){return!!r&&"doubleValue"in r&&isNaN(Number(r.doubleValue))}function wa(r){return!!r&&"mapValue"in r}function Lv(r){var e,t;return((t=(((e=r==null?void 0:r.mapValue)===null||e===void 0?void 0:e.fields)||{})[ld])===null||t===void 0?void 0:t.stringValue)===ud}function os(r){if(r.geoPointValue)return{geoPointValue:Object.assign({},r.geoPointValue)};if(r.timestampValue&&typeof r.timestampValue=="object")return{timestampValue:Object.assign({},r.timestampValue)};if(r.mapValue){let e={mapValue:{fields:{}}};return pr(r.mapValue.fields,(t,n)=>e.mapValue.fields[t]=os(n)),e}if(r.arrayValue){let e={arrayValue:{values:[]}};for(let t=0;t<(r.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=os(r.arrayValue.values[t]);return e}return Object.assign({},r)}function Mv(r){return(((r.mapValue||{}).fields||{}).__type__||{}).stringValue===Vv}function Fv(r){let e=[];return pr(r.fields,(t,n)=>{let i=new He([t]);if(wa(n)){let s=Fv(n.mapValue).fields;if(s.length===0)e.push(i);else for(let a of s)e.push(i.child(a))}else e.push(i)}),new Xe(e)}function Uw(r,e,t){let n=0;for(let i=0;i<r.position.length;i++){let s=e[i],a=r.position[i];if(s.field.isKeyField()?n=U.comparator(U.fromName(a.referenceValue),t.key):n=Un(a,t.data.field(s.field)),s.dir==="desc"&&(n*=-1),n!==0)break}return n}function Bw(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(!mt(r.position[t],e.position[t]))return!1;return!0}function Ok(r,e){return r.dir===e.dir&&r.field.isEqual(e.field)}function jv(r){return r.op==="and"}function Uv(r){return Nk(r)&&jv(r)}function Nk(r){for(let e of r.filters)if(e instanceof gt)return!1;return!0}function Vc(r){if(r instanceof we)return r.field.canonicalString()+r.op.toString()+Bn(r.value);if(Uv(r))return r.filters.map(e=>Vc(e)).join(",");{let e=r.filters.map(t=>Vc(t)).join(",");return`${r.op}(${e})`}}function Bv(r,e){return r instanceof we?function(n,i){return i instanceof we&&n.op===i.op&&n.field.isEqual(i.field)&&mt(n.value,i.value)}(r,e):r instanceof gt?function(n,i){return i instanceof gt&&n.op===i.op&&n.filters.length===i.filters.length?n.filters.reduce((s,a,l)=>s&&Bv(a,i.filters[l]),!0):!1}(r,e):void j()}function $v(r){return r instanceof we?function(t){return`${t.field.canonicalString()} ${t.op} ${Bn(t.value)}`}(r):r instanceof gt?function(t){return t.op.toString()+" {"+t.getFilters().map($v).join(" ,")+"}"}(r):"Filter"}function qv(r,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(n=>U.fromName(n.referenceValue))}function $w(r,e=null,t=[],n=[],i=null,s=null,a=null){return new qc(r,e,t,n,i,s,a)}function hd(r){let e=q(r);if(e.le===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(n=>Vc(n)).join(","),t+="|ob:",t+=e.orderBy.map(n=>function(s){return s.field.canonicalString()+s.dir}(n)).join(","),sl(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(n=>Bn(n)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(n=>Bn(n)).join(",")),e.le=t}return e.le}function dd(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(!Ok(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(!Bv(r.filters[t],e.filters[t]))return!1;return r.collectionGroup===e.collectionGroup&&!!r.path.isEqual(e.path)&&!!Bw(r.startAt,e.startAt)&&Bw(r.endAt,e.endAt)}function zc(r){return U.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}function Vk(r,e,t,n,i,s,a,l){return new zn(r,e,t,n,i,s,a,l)}function al(r){return new zn(r)}function qw(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 Lk(r){return r.collectionGroup!==null}function as(r){let e=q(r);if(e.he===null){e.he=[];let t=new Set;for(let s of e.explicitOrderBy)e.he.push(s),t.add(s.field.canonicalString());let n=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let l=new be(He.comparator);return a.filters.forEach(u=>{u.getFlattenedFilters().forEach(h=>{h.isInequality()&&(l=l.add(h.field))})}),l})(e).forEach(s=>{t.has(s.canonicalString())||s.isKeyField()||e.he.push(new qn(s,n))}),t.has(He.keyField().canonicalString())||e.he.push(new qn(He.keyField(),n))}return e.he}function dt(r){let e=q(r);return e.Pe||(e.Pe=Mk(e,as(r))),e.Pe}function Mk(r,e){if(r.limitType==="F")return $w(r.path,r.collectionGroup,e,r.filters,r.limit,r.startAt,r.endAt);{e=e.map(i=>{let s=i.dir==="desc"?"asc":"desc";return new qn(i.field,s)});let t=r.endAt?new $n(r.endAt.position,r.endAt.inclusive):null,n=r.startAt?new $n(r.startAt.position,r.startAt.inclusive):null;return $w(r.path,r.collectionGroup,e,r.filters,r.limit,t,n)}}function Gc(r,e,t){return new zn(r.path,r.collectionGroup,r.explicitOrderBy.slice(),r.filters.slice(),e,t,r.startAt,r.endAt)}function ll(r,e){return dd(dt(r),dt(e))&&r.limitType===e.limitType}function zv(r){return`${hd(dt(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(i=>$v(i)).join(", ")}]`),sl(t.limit)||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=`, orderBy: [${t.orderBy.map(i=>function(a){return`${a.field.canonicalString()} (${a.dir})`}(i)).join(", ")}]`),t.startAt&&(n+=", startAt: ",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map(i=>Bn(i)).join(",")),t.endAt&&(n+=", endAt: ",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map(i=>Bn(i)).join(",")),`Target(${n})`}(dt(r))}; limitType=${r.limitType})`}function ul(r,e){return e.isFoundDocument()&&function(n,i){let s=i.key.path;return n.collectionGroup!==null?i.key.hasCollectionId(n.collectionGroup)&&n.path.isPrefixOf(s):U.isDocumentKey(n.path)?n.path.isEqual(s):n.path.isImmediateParentOf(s)}(r,e)&&function(n,i){for(let s of as(n))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(r,e)&&function(n,i){for(let s of n.filters)if(!s.matches(i))return!1;return!0}(r,e)&&function(n,i){return!(n.startAt&&!function(a,l,u){let h=Uw(a,l,u);return a.inclusive?h<=0:h<0}(n.startAt,as(n),i)||n.endAt&&!function(a,l,u){let h=Uw(a,l,u);return a.inclusive?h>=0:h>0}(n.endAt,as(n),i))}(r,e)}function Fk(r){return r.collectionGroup||(r.path.length%2==1?r.path.lastSegment():r.path.get(r.path.length-2))}function Gv(r){return(e,t)=>{let n=!1;for(let i of as(r)){let s=jk(i,e,t);if(s!==0)return s;n=n||i.field.isKeyField()}return 0}}function jk(r,e,t){let n=r.field.isKeyField()?U.comparator(e.key,t.key):function(s,a,l){let u=a.data.field(s),h=l.data.field(s);return u!==null&&h!==null?Un(u,h):j()}(r.field,e,t);switch(r.dir){case"asc":return n;case"desc":return-1*n;default:return j()}}function Ft(){return Uk}function ss(...r){let e=Kv;for(let t of r)e=e.insert(t.key,t);return e}function Hv(r){let e=Kv;return r.forEach((t,n)=>e=e.insert(t,n.overlayedDocument)),e}function Pr(){return ls()}function Wv(){return ls()}function ls(){return new Mt(r=>r.toString(),(r,e)=>r.isEqual(e))}function W(...r){let e=$k;for(let t of r)e=e.add(t);return e}function zk(){return qk}function fd(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:hs(e)?"-0":e}}function Qv(r){return{integerValue:""+r}}function Gk(r,e){return wk(e)?Qv(e):fd(r,e)}function Kk(r,e,t){return r instanceof Kn?function(i,s){let a={fields:{[Dv]:{stringValue:kv},[Nv]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&ad(s)&&(s=ol(s)),s&&(a.fields[Ov]=s),{mapValue:a}}(t,e):r instanceof Nr?Yv(r,e):r instanceof Vr?Xv(r,e):function(i,s){let a=Jv(i,s),l=zw(a)+zw(i.Ie);return Nc(a)&&Nc(i.Ie)?Qv(l):fd(i.serializer,l)}(r,e)}function Hk(r,e,t){return r instanceof Nr?Yv(r,e):r instanceof Vr?Xv(r,e):t}function Jv(r,e){return r instanceof Hn?function(n){return Nc(n)||function(s){return!!s&&"doubleValue"in s}(n)}(e)?e:{integerValue:0}:null}function Yv(r,e){let t=Zv(e);for(let n of r.elements)t.some(i=>mt(i,n))||t.push(n);return{arrayValue:{values:t}}}function Xv(r,e){let t=Zv(e);for(let n of r.elements)t=t.filter(i=>!mt(i,n));return{arrayValue:{values:t}}}function zw(r){return ue(r.integerValue||r.doubleValue)}function Zv(r){return cd(r)&&r.arrayValue.values?r.arrayValue.values.slice():[]}function Wk(r,e){return r.field.isEqual(e.field)&&function(n,i){return n instanceof Nr&&i instanceof Nr||n instanceof Vr&&i instanceof Vr?Mn(n.elements,i.elements,mt):n instanceof Hn&&i instanceof Hn?mt(n.Ie,i.Ie):n instanceof Kn&&i instanceof Kn}(r.transform,e.transform)}function va(r,e){return r.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(r.updateTime):r.exists===void 0||r.exists===e.isFoundDocument()}function eb(r,e){if(!r.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return r.isNoDocument()?new Ca(r.key,ur.none()):new Lr(r.key,r.data,ur.none());{let t=r.data,n=Ke.empty(),i=new be(He.comparator);for(let s of e.fields)if(!i.has(s)){let a=t.field(s);a===null&&s.length>1&&(s=s.popLast(),a=t.field(s)),a===null?n.delete(s):n.set(s,a),i=i.add(s)}return new yt(r.key,n,new Xe(i.toArray()),ur.none())}}function Qk(r,e,t){r instanceof Lr?function(i,s,a){let l=i.value.clone(),u=Kw(i.fieldTransforms,s,a.transformResults);l.setAll(u),s.convertToFoundDocument(a.version,l).setHasCommittedMutations()}(r,e,t):r instanceof yt?function(i,s,a){if(!va(i.precondition,s))return void s.convertToUnknownDocument(a.version);let l=Kw(i.fieldTransforms,s,a.transformResults),u=s.data;u.setAll(tb(i)),u.setAll(l),s.convertToFoundDocument(a.version,u).setHasCommittedMutations()}(r,e,t):function(i,s,a){s.convertToNoDocument(a.version).setHasCommittedMutations()}(0,e,t)}function us(r,e,t,n){return r instanceof Lr?function(s,a,l,u){if(!va(s.precondition,a))return l;let h=s.value.clone(),f=Hw(s.fieldTransforms,u,a);return h.setAll(f),a.convertToFoundDocument(a.version,h).setHasLocalMutations(),null}(r,e,t,n):r instanceof yt?function(s,a,l,u){if(!va(s.precondition,a))return l;let h=Hw(s.fieldTransforms,u,a),f=a.data;return f.setAll(tb(s)),f.setAll(h),a.convertToFoundDocument(a.version,f).setHasLocalMutations(),l===null?null:l.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(m=>m.field))}(r,e,t,n):function(s,a,l){return va(s.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):l}(r,e,t)}function Jk(r,e){let t=null;for(let n of r.fieldTransforms){let i=e.data.field(n.field),s=Jv(n.transform,i||null);s!=null&&(t===null&&(t=Ke.empty()),t.set(n.field,s))}return t||null}function Gw(r,e){return r.type===e.type&&!!r.key.isEqual(e.key)&&!!r.precondition.isEqual(e.precondition)&&!!function(n,i){return n===void 0&&i===void 0||!(!n||!i)&&Mn(n,i,(s,a)=>Wk(s,a))}(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))}function tb(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 Kw(r,e,t){let n=new Map;re(r.length===t.length);for(let i=0;i<t.length;i++){let s=r[i],a=s.transform,l=e.data.field(s.field);n.set(s.field,Hk(a,l,t[i]))}return n}function Hw(r,e,t){let n=new Map;for(let i of r){let s=i.transform,a=t.data.field(i.field);n.set(i.field,Kk(s,a,e))}return n}function Yk(r){switch(r){case O.OK:return j();case O.CANCELLED:case O.UNKNOWN:case O.DEADLINE_EXCEEDED:case O.RESOURCE_EXHAUSTED:case O.INTERNAL:case O.UNAVAILABLE:case O.UNAUTHENTICATED:return!1;case O.INVALID_ARGUMENT:case O.NOT_FOUND:case O.ALREADY_EXISTS:case O.PERMISSION_DENIED:case O.FAILED_PRECONDITION:case O.ABORTED:case O.OUT_OF_RANGE:case O.UNIMPLEMENTED:case O.DATA_LOSS:return!0;default:return j()}}function rb(r){if(r===void 0)return Nt("GRPC error has no .code"),O.UNKNOWN;switch(r){case pe.OK:return O.OK;case pe.CANCELLED:return O.CANCELLED;case pe.UNKNOWN:return O.UNKNOWN;case pe.DEADLINE_EXCEEDED:return O.DEADLINE_EXCEEDED;case pe.RESOURCE_EXHAUSTED:return O.RESOURCE_EXHAUSTED;case pe.INTERNAL:return O.INTERNAL;case pe.UNAVAILABLE:return O.UNAVAILABLE;case pe.UNAUTHENTICATED:return O.UNAUTHENTICATED;case pe.INVALID_ARGUMENT:return O.INVALID_ARGUMENT;case pe.NOT_FOUND:return O.NOT_FOUND;case pe.ALREADY_EXISTS:return O.ALREADY_EXISTS;case pe.PERMISSION_DENIED:return O.PERMISSION_DENIED;case pe.FAILED_PRECONDITION:return O.FAILED_PRECONDITION;case pe.ABORTED:return O.ABORTED;case pe.OUT_OF_RANGE:return O.OUT_OF_RANGE;case pe.UNIMPLEMENTED:return O.UNIMPLEMENTED;case pe.DATA_LOSS:return O.DATA_LOSS;default:return j()}}function Xk(){return new TextEncoder}function Qw(r){let e=Xk().encode(r),t=new pc;return t.update(e),new Uint8Array(t.digest())}function Jw(r){let e=new DataView(r.buffer),t=e.getUint32(0,!0),n=e.getUint32(4,!0),i=e.getUint32(8,!0),s=e.getUint32(12,!0);return[new Dt([t,n],0),new Dt([i,s],0)]}function ga(){return new de(U.comparator)}function Yw(){return new de(U.comparator)}function th(r,e){return r.useProto3Json||sl(e)?e:{value:e}}function Va(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 nb(r,e){return r.useProto3Json?e.toBase64():e.toUint8Array()}function nD(r,e){return Va(r,e.toTimestamp())}function ft(r){return re(!!r),z.fromTimestamp(function(t){let n=Vt(t);return new Ee(n.seconds,n.nanos)}(r))}function pd(r,e){return rh(r,e).canonicalString()}function rh(r,e){let t=function(i){return new ge(["projects",i.projectId,"databases",i.database])}(r).child("documents");return e===void 0?t:t.child(e)}function ib(r){let e=ge.fromString(r);return re(ub(e)),e}function nh(r,e){return pd(r.databaseId,e.path)}function vc(r,e){let t=ib(e);if(t.get(1)!==r.databaseId.projectId)throw new M(O.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 M(O.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+r.databaseId.database);return new U(ob(t))}function sb(r,e){return pd(r.databaseId,e)}function iD(r){let e=ib(r);return e.length===4?ge.emptyPath():ob(e)}function ih(r){return new ge(["projects",r.databaseId.projectId,"databases",r.databaseId.database]).canonicalString()}function ob(r){return re(r.length>4&&r.get(4)==="documents"),r.popFirst(5)}function Xw(r,e,t){return{name:nh(r,e),fields:t.value.mapValue.fields}}function sD(r,e){let t;if("targetChange"in e){e.targetChange;let n=function(h){return h==="NO_CHANGE"?0:h==="ADD"?1:h==="REMOVE"?2:h==="CURRENT"?3:h==="RESET"?4:j()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(h,f){return h.useProto3Json?(re(f===void 0||typeof f=="string"),De.fromBase64String(f||"")):(re(f===void 0||f instanceof Buffer||f instanceof Uint8Array),De.fromUint8Array(f||new Uint8Array))}(r,e.targetChange.resumeToken),a=e.targetChange.cause,l=a&&function(h){let f=h.code===void 0?O.UNKNOWN:rb(h.code);return new M(f,h.message||"")}(a);t=new Oa(n,i,s,l||null)}else if("documentChange"in e){e.documentChange;let n=e.documentChange;n.document,n.document.name,n.document.updateTime;let i=vc(r,n.document.name),s=ft(n.document.updateTime),a=n.document.createTime?ft(n.document.createTime):z.min(),l=new Ke({mapValue:{fields:n.document.fields}}),u=it.newFoundDocument(i,s,a,l),h=n.targetIds||[],f=n.removedTargetIds||[];t=new Nn(h,f,u.key,u)}else if("documentDelete"in e){e.documentDelete;let n=e.documentDelete;n.document;let i=vc(r,n.document),s=n.readTime?ft(n.readTime):z.min(),a=it.newNoDocument(i,s),l=n.removedTargetIds||[];t=new Nn([],l,a.key,a)}else if("documentRemove"in e){e.documentRemove;let n=e.documentRemove;n.document;let i=vc(r,n.document),s=n.removedTargetIds||[];t=new Nn([],s,i,null)}else{if(!("filter"in e))return j();{e.filter;let n=e.filter;n.targetId;let{count:i=0,unchangedNames:s}=n,a=new Yc(i,s),l=n.targetId;t=new Da(l,a)}}return t}function oD(r,e){let t;if(e instanceof Lr)t={update:Xw(r,e.key,e.value)};else if(e instanceof Ca)t={delete:nh(r,e.key)};else if(e instanceof yt)t={update:Xw(r,e.key,e.data),updateMask:mD(e.fieldMask)};else{if(!(e instanceof Hc))return j();t={verify:nh(r,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(n=>function(s,a){let l=a.transform;if(l instanceof Kn)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(l instanceof Nr)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:l.elements}};if(l instanceof Vr)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:l.elements}};if(l instanceof Hn)return{fieldPath:a.field.canonicalString(),increment:l.Ie};throw j()}(0,n))),e.precondition.isNone||(t.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:nD(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:j()}(r,e.precondition)),t}function aD(r,e){return r&&r.length>0?(re(e!==void 0),r.map(t=>function(i,s){let a=i.updateTime?ft(i.updateTime):ft(s);return a.isEqual(z.min())&&(a=ft(s)),new Kc(a,i.transformResults||[])}(t,e))):[]}function lD(r,e){return{documents:[sb(r,e.path)]}}function uD(r,e){let t={structuredQuery:{}},n=e.path,i;e.collectionGroup!==null?(i=n,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=n.popLast(),t.structuredQuery.from=[{collectionId:n.lastSegment()}]),t.parent=sb(r,i);let s=function(h){if(h.length!==0)return lb(gt.create(h,"and"))}(e.filters);s&&(t.structuredQuery.where=s);let a=function(h){if(h.length!==0)return h.map(f=>function(g){return{field:kn(g.field),direction:dD(g.dir)}}(f))}(e.orderBy);a&&(t.structuredQuery.orderBy=a);let l=th(r,e.limit);return l!==null&&(t.structuredQuery.limit=l),e.startAt&&(t.structuredQuery.startAt=function(h){return{before:h.inclusive,values:h.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(h){return{before:!h.inclusive,values:h.position}}(e.endAt)),{ht:t,parent:i}}function cD(r){let e=iD(r.parent),t=r.structuredQuery,n=t.from?t.from.length:0,i=null;if(n>0){re(n===1);let f=t.from[0];f.allDescendants?i=f.collectionId:e=e.child(f.collectionId)}let s=[];t.where&&(s=function(m){let g=ab(m);return g instanceof gt&&Uv(g)?g.getFilters():[g]}(t.where));let a=[];t.orderBy&&(a=function(m){return m.map(g=>function(C){return new qn(Dn(C.field),function(P){switch(P){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(C.direction))}(g))}(t.orderBy));let l=null;t.limit&&(l=function(m){let g;return g=typeof m=="object"?m.value:m,sl(g)?null:g}(t.limit));let u=null;t.startAt&&(u=function(m){let g=!!m.before,I=m.values||[];return new $n(I,g)}(t.startAt));let h=null;return t.endAt&&(h=function(m){let g=!m.before,I=m.values||[];return new $n(I,g)}(t.endAt)),Vk(e,i,a,s,l,"F",u,h)}function hD(r,e){let t=function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return j()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function ab(r){return r.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":let n=Dn(t.unaryFilter.field);return we.create(n,"==",{doubleValue:NaN});case"IS_NULL":let i=Dn(t.unaryFilter.field);return we.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let s=Dn(t.unaryFilter.field);return we.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let a=Dn(t.unaryFilter.field);return we.create(a,"!=",{nullValue:"NULL_VALUE"});default:return j()}}(r):r.fieldFilter!==void 0?function(t){return we.create(Dn(t.fieldFilter.field),function(i){switch(i){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";default:return j()}}(t.fieldFilter.op),t.fieldFilter.value)}(r):r.compositeFilter!==void 0?function(t){return gt.create(t.compositeFilter.filters.map(n=>ab(n)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return j()}}(t.compositeFilter.op))}(r):j()}function dD(r){return eD[r]}function fD(r){return tD[r]}function pD(r){return rD[r]}function kn(r){return{fieldPath:r.canonicalString()}}function Dn(r){return He.fromServerFormat(r.fieldPath)}function lb(r){return r instanceof we?function(t){if(t.op==="=="){if(jw(t.value))return{unaryFilter:{field:kn(t.field),op:"IS_NAN"}};if(Fw(t.value))return{unaryFilter:{field:kn(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(jw(t.value))return{unaryFilter:{field:kn(t.field),op:"IS_NOT_NAN"}};if(Fw(t.value))return{unaryFilter:{field:kn(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:kn(t.field),op:fD(t.op),value:t.value}}}(r):r instanceof gt?function(t){let n=t.getFilters().map(i=>lb(i));return n.length===1?n[0]:{compositeFilter:{op:pD(t.op),filters:n}}}(r):j()}function mD(r){let e=[];return r.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function ub(r){return r.length>=4&&r.get(0)==="projects"&&r.get(2)==="databases"}function gD(r){let e=cD({parent:r.parent,structuredQuery:r.structuredQuery});return r.limitType==="LAST"?Gc(e,e.limit,"L"):e}function tv([r,e],[t,n]){let i=J(r,t);return i===0?J(e,n):i}function _D(r,e){return new ch(r,e)}function vD(r,e,t,n){return new xh(r,e,t,n)}async function hb(r,e){let t=q(r);return await t.persistence.runTransaction("Handle user change","readonly",n=>{let i;return t.mutationQueue.getAllMutationBatches(n).next(s=>(i=s,t.As(e),t.mutationQueue.getAllMutationBatches(n))).next(s=>{let a=[],l=[],u=W();for(let h of i){a.push(h.batchId);for(let f of h.mutations)u=u.add(f.key)}for(let h of s){l.push(h.batchId);for(let f of h.mutations)u=u.add(f.key)}return t.localDocuments.getDocuments(n,u).next(h=>({Rs:h,removedBatchIds:a,addedBatchIds:l}))})})}function bD(r,e){let t=q(r);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",n=>{let i=e.batch.keys(),s=t.ds.newChangeBuffer({trackRemovals:!0});return function(l,u,h,f){let m=h.batch,g=m.keys(),I=D.resolve();return g.forEach(C=>{I=I.next(()=>f.getEntry(u,C)).next(k=>{let P=h.docVersions.get(C);re(P!==null),k.version.compareTo(P)<0&&(m.applyToRemoteDocument(k,h),k.isValidDocument()&&(k.setReadTime(h.commitVersion),f.addEntry(k)))})}),I.next(()=>l.mutationQueue.removeMutationBatch(u,m))}(t,n,e,s).next(()=>s.apply(n)).next(()=>t.mutationQueue.performConsistencyCheck(n)).next(()=>t.documentOverlayCache.removeOverlaysForBatchId(n,i,e.batch.batchId)).next(()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(n,function(l){let u=W();for(let h=0;h<l.mutationResults.length;++h)l.mutationResults[h].transformResults.length>0&&(u=u.add(l.batch.mutations[h].key));return u}(e))).next(()=>t.localDocuments.getDocuments(n,i))})}function db(r){let e=q(r);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Hr.getLastRemoteSnapshotVersion(t))}function TD(r,e){let t=q(r),n=e.snapshotVersion,i=t.Ts;return t.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{let a=t.ds.newChangeBuffer({trackRemovals:!0});i=t.Ts;let l=[];e.targetChanges.forEach((f,m)=>{let g=i.get(m);if(!g)return;l.push(t.Hr.removeMatchingKeys(s,f.removedDocuments,m).next(()=>t.Hr.addMatchingKeys(s,f.addedDocuments,m)));let I=g.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(m)!==null?I=I.withResumeToken(De.EMPTY_BYTE_STRING,z.min()).withLastLimboFreeSnapshotVersion(z.min()):f.resumeToken.approximateByteSize()>0&&(I=I.withResumeToken(f.resumeToken,n)),i=i.insert(m,I),function(k,P,V){return k.resumeToken.approximateByteSize()===0||P.snapshotVersion.toMicroseconds()-k.snapshotVersion.toMicroseconds()>=wD?!0:V.addedDocuments.size+V.modifiedDocuments.size+V.removedDocuments.size>0}(g,I,f)&&l.push(t.Hr.updateTargetData(s,I))});let u=Ft(),h=W();if(e.documentUpdates.forEach(f=>{e.resolvedLimboDocuments.has(f)&&l.push(t.persistence.referenceDelegate.updateLimboDocument(s,f))}),l.push(ED(s,a,e.documentUpdates).next(f=>{u=f.Vs,h=f.fs})),!n.isEqual(z.min())){let f=t.Hr.getLastRemoteSnapshotVersion(s).next(m=>t.Hr.setTargetsMetadata(s,s.currentSequenceNumber,n));l.push(f)}return D.waitFor(l).next(()=>a.apply(s)).next(()=>t.localDocuments.getLocalViewOfDocuments(s,u,h)).next(()=>u)}).then(s=>(t.Ts=i,s))}function ED(r,e,t){let n=W(),i=W();return t.forEach(s=>n=n.add(s)),e.getEntries(r,n).next(s=>{let a=Ft();return t.forEach((l,u)=>{let h=s.get(l);u.isFoundDocument()!==h.isFoundDocument()&&(i=i.add(l)),u.isNoDocument()&&u.version.isEqual(z.min())?(e.removeEntry(l,u.readTime),a=a.insert(l,u)):!h.isValidDocument()||u.version.compareTo(h.version)>0||u.version.compareTo(h.version)===0&&h.hasPendingWrites?(e.addEntry(u),a=a.insert(l,u)):L(md,"Ignoring outdated watch update for ",l,". Current version:",h.version," Watch version:",u.version)}),{Vs:a,fs:i}})}function ID(r,e){let t=q(r);return t.persistence.runTransaction("Get next mutation batch","readonly",n=>(e===void 0&&(e=od),t.mutationQueue.getNextMutationBatchAfterBatchId(n,e)))}function AD(r,e){let t=q(r);return t.persistence.runTransaction("Allocate target","readwrite",n=>{let i;return t.Hr.getTargetData(n,e).next(s=>s?(i=s,D.resolve(i)):t.Hr.allocateTargetId(n).next(a=>(i=new ms(e,a,"TargetPurposeListen",n.currentSequenceNumber),t.Hr.addTargetData(n,i).next(()=>i))))}).then(n=>{let i=t.Ts.get(n.targetId);return(i===null||n.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(t.Ts=t.Ts.insert(n.targetId,n),t.Is.set(e,n.targetId)),n})}async function Sh(r,e,t){let n=q(r),i=n.Ts.get(e),s=t?"readwrite":"readwrite-primary";try{t||await n.persistence.runTransaction("Release target",s,a=>n.persistence.referenceDelegate.removeTarget(a,i))}catch(a){if(!ei(a))throw a;L(md,`Failed to update sequence numbers for target ${e}: ${a}`)}n.Ts=n.Ts.remove(e),n.Is.delete(i.target)}function rv(r,e,t){let n=q(r),i=z.min(),s=W();return n.persistence.runTransaction("Execute query","readwrite",a=>function(u,h,f){let m=q(u),g=m.Is.get(f);return g!==void 0?D.resolve(m.Ts.get(g)):m.Hr.getTargetData(h,f)}(n,a,dt(e)).next(l=>{if(l)return i=l.lastLimboFreeSnapshotVersion,n.Hr.getMatchingKeysForTargetId(a,l.targetId).next(u=>{s=u})}).next(()=>n.Ps.getDocumentsMatchingQuery(a,e,t?i:z.min(),t?s:W())).next(l=>(xD(n,Fk(e),l),{documents:l,gs:s})))}function xD(r,e,t){let n=r.Es.get(e)||z.min();t.forEach((i,s)=>{s.readTime.compareTo(n)>0&&(n=s.readTime)}),r.Es.set(e,n)}function Ch(){return ya===null?ya=function(){return 268435456+Math.round(2147483648*Math.random())}():ya++,"0x"+ya.toString(16)}function Tc(){return typeof document!="undefined"?document:null}function cl(r){return new eh(r,!0)}async function hl(r){if(Fr(r))for(let e of r.G_)await e(!0)}async function As(r){for(let e of r.G_)await e(!1)}function fb(r,e){let t=q(r);t.U_.has(e.targetId)||(t.U_.set(e.targetId,e),wd(t)?_d(t):ti(t).c_()&&yd(t,e))}function gd(r,e){let t=q(r),n=ti(t);t.U_.delete(e),n.c_()&&pb(t,e),t.U_.size===0&&(n.c_()?n.P_():Fr(t)&&t.j_.set("Unknown"))}function yd(r,e){if(r.H_.Ne(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(z.min())>0){let t=r.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}ti(r).y_(e)}function pb(r,e){r.H_.Ne(e),ti(r).w_(e)}function _d(r){r.H_=new Zc({getRemoteKeysForTarget:e=>r.remoteSyncer.getRemoteKeysForTarget(e),lt:e=>r.U_.get(e)||null,it:()=>r.datastore.serializer.databaseId}),ti(r).start(),r.j_.B_()}function wd(r){return Fr(r)&&!ti(r).u_()&&r.U_.size>0}function Fr(r){return q(r).W_.size===0}function mb(r){r.H_=void 0}async function RD(r){r.j_.set("Online")}async function PD(r){r.U_.forEach((e,t)=>{yd(r,e)})}async function CD(r,e){mb(r),wd(r)?(r.j_.q_(e),_d(r)):r.j_.set("Unknown")}async function kD(r,e,t){if(r.j_.set("Online"),e instanceof Oa&&e.state===2&&e.cause)try{await async function(i,s){let a=s.cause;for(let l of s.targetIds)i.U_.has(l)&&(await i.remoteSyncer.rejectListen(l,a),i.U_.delete(l),i.H_.removeTarget(l))}(r,e)}catch(n){L(Mr,"Failed to remove targets %s: %s ",e.targetIds.join(","),n),await qa(r,n)}else if(e instanceof Nn?r.H_.We(e):e instanceof Da?r.H_.Ze(e):r.H_.je(e),!t.isEqual(z.min()))try{let n=await db(r.localStore);t.compareTo(n)>=0&&await function(s,a){let l=s.H_.ot(a);return l.targetChanges.forEach((u,h)=>{if(u.resumeToken.approximateByteSize()>0){let f=s.U_.get(h);f&&s.U_.set(h,f.withResumeToken(u.resumeToken,a))}}),l.targetMismatches.forEach((u,h)=>{let f=s.U_.get(u);if(!f)return;s.U_.set(u,f.withResumeToken(De.EMPTY_BYTE_STRING,f.snapshotVersion)),pb(s,u);let m=new ms(f.target,u,h,f.sequenceNumber);yd(s,m)}),s.remoteSyncer.applyRemoteEvent(l)}(r,t)}catch(n){L(Mr,"Failed to raise snapshot:",n),await qa(r,n)}}async function qa(r,e,t){if(!ei(e))throw e;r.W_.add(1),await As(r),r.j_.set("Offline"),t||(t=()=>db(r.localStore)),r.asyncQueue.enqueueRetryable(async()=>{L(Mr,"Retrying IndexedDB access"),await t(),r.W_.delete(1),await hl(r)})}function gb(r,e){return e().catch(t=>qa(r,t,e))}async function dl(r){let e=q(r),t=hr(e),n=e.K_.length>0?e.K_[e.K_.length-1].batchId:od;for(;DD(e);)try{let i=await ID(e.localStore,n);if(i===null){e.K_.length===0&&t.P_();break}n=i.batchId,OD(e,i)}catch(i){await qa(e,i)}yb(e)&&_b(e)}function DD(r){return Fr(r)&&r.K_.length<10}function OD(r,e){r.K_.push(e);let t=hr(r);t.c_()&&t.S_&&t.b_(e.mutations)}function yb(r){return Fr(r)&&!hr(r).u_()&&r.K_.length>0}function _b(r){hr(r).start()}async function ND(r){hr(r).C_()}async function VD(r){let e=hr(r);for(let t of r.K_)e.b_(t.mutations)}async function LD(r,e,t){let n=r.K_.shift(),i=Qc.from(n,e,t);await gb(r,()=>r.remoteSyncer.applySuccessfulWrite(i)),await dl(r)}async function MD(r,e){e&&hr(r).S_&&await async function(n,i){if(function(a){return Yk(a)&&a!==O.ABORTED}(i.code)){let s=n.K_.shift();hr(n).h_(),await gb(n,()=>n.remoteSyncer.rejectFailedWrite(s.batchId,i)),await dl(n)}}(r,e),yb(r)&&_b(r)}async function sv(r,e){let t=q(r);t.asyncQueue.verifyOperationInProgress(),L(Mr,"RemoteStore received new credentials");let n=Fr(t);t.W_.add(3),await As(t),n&&t.j_.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.W_.delete(3),await hl(t)}async function FD(r,e){let t=q(r);e?(t.W_.delete(2),await hl(t)):e||(t.W_.add(2),await As(t),t.j_.set("Unknown"))}function ti(r){return r.J_||(r.J_=function(t,n,i){let s=q(t);return s.M_(),new Nh(n,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(r.datastore,r.asyncQueue,{xo:RD.bind(null,r),No:PD.bind(null,r),Lo:CD.bind(null,r),p_:kD.bind(null,r)}),r.G_.push(async e=>{e?(r.J_.h_(),wd(r)?_d(r):r.j_.set("Unknown")):(await r.J_.stop(),mb(r))})),r.J_}function hr(r){return r.Y_||(r.Y_=function(t,n,i){let s=q(t);return s.M_(),new Vh(n,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(r.datastore,r.asyncQueue,{xo:()=>Promise.resolve(),No:ND.bind(null,r),Lo:MD.bind(null,r),D_:VD.bind(null,r),v_:LD.bind(null,r)}),r.G_.push(async e=>{e?(r.Y_.h_(),await dl(r)):(await r.Y_.stop(),r.K_.length>0&&(L(Mr,`Stopping write stream with ${r.K_.length} pending writes`),r.K_=[]))})),r.Y_}function vd(r,e){if(Nt("AsyncQueue",`${e}: ${r}`),ei(r))return new M(O.UNAVAILABLE,`${e}: ${r}`);throw r}function ov(){return new Mt(r=>zv(r),ll)}async function wb(r,e){let t=q(r),n=3,i=e.query,s=t.queries.get(i);s?!s.na()&&e.ra()&&(n=2):(s=new Bh,n=e.ra()?0:1);try{switch(n){case 0:s.ea=await t.onListen(i,!0);break;case 1:s.ea=await t.onListen(i,!1);break;case 2:await t.onFirstRemoteStoreListen(i)}}catch(a){let l=vd(a,`Initialization of query '${Cn(e.query)}' failed`);return void e.onError(l)}t.queries.set(i,s),s.ta.push(e),e.sa(t.onlineState),s.ea&&e.oa(s.ea)&&bd(t)}async function vb(r,e){let t=q(r),n=e.query,i=3,s=t.queries.get(n);if(s){let a=s.ta.indexOf(e);a>=0&&(s.ta.splice(a,1),s.ta.length===0?i=e.ra()?0:1:!s.na()&&e.ra()&&(i=2))}switch(i){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 jD(r,e){let t=q(r),n=!1;for(let i of e){let s=i.query,a=t.queries.get(s);if(a){for(let l of a.ta)l.oa(i)&&(n=!0);a.ea=i}}n&&bd(t)}function UD(r,e,t){let n=q(r),i=n.queries.get(e);if(i)for(let s of i.ta)s.onError(t);n.queries.delete(e)}function bd(r){r.ia.forEach(e=>{e.next()})}async function BD(r,e,t=!0){let n=xb(r),i,s=n.ka.get(e);return s?(n.sharedClientState.addLocalQueryTarget(s.targetId),i=s.view.Na()):i=await bb(n,e,t,!0),i}async function $D(r,e){let t=xb(r);await bb(t,e,!0,!1)}async function bb(r,e,t,n){let i=await AD(r.localStore,dt(e)),s=i.targetId,a=r.sharedClientState.addLocalQueryTarget(s,t),l;return n&&(l=await qD(r,e,s,a==="current",i.resumeToken)),r.isPrimaryClient&&t&&fb(r.remoteStore,i),l}async function qD(r,e,t,n,i){r.Ha=(m,g,I)=>async function(k,P,V,F){let B=P.view.ba(V);B.ls&&(B=await rv(k.localStore,P.query,!1).then(({documents:E})=>P.view.ba(E,B)));let K=F&&F.targetChanges.get(P.targetId),X=F&&F.targetMismatches.get(P.targetId)!=null,$=P.view.applyChanges(B,k.isPrimaryClient,K,X);return uv(k,P.targetId,$.Ma),$.snapshot}(r,m,g,I);let s=await rv(r.localStore,e,!0),a=new zh(e,s.gs),l=a.ba(s.documents),u=ps.createSynthesizedTargetChangeForCurrentChange(t,n&&r.onlineState!=="Offline",i),h=a.applyChanges(l,r.isPrimaryClient,u);uv(r,t,h.Ma);let f=new Gh(e,t,a);return r.ka.set(e,f),r.qa.has(t)?r.qa.get(t).push(e):r.qa.set(t,[e]),h.snapshot}async function zD(r,e,t){let n=q(r),i=n.ka.get(e),s=n.qa.get(i.targetId);if(s.length>1)return n.qa.set(i.targetId,s.filter(a=>!ll(a,e))),void n.ka.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(i.targetId),n.sharedClientState.isActiveQueryTarget(i.targetId)||await Sh(n.localStore,i.targetId,!1).then(()=>{n.sharedClientState.clearQueryState(i.targetId),t&&gd(n.remoteStore,i.targetId),Wh(n,i.targetId)}).catch(Zn)):(Wh(n,i.targetId),await Sh(n.localStore,i.targetId,!0))}async function GD(r,e){let t=q(r),n=t.ka.get(e),i=t.qa.get(n.targetId);t.isPrimaryClient&&i.length===1&&(t.sharedClientState.removeLocalQueryTarget(n.targetId),gd(t.remoteStore,n.targetId))}async function KD(r,e,t){let n=ZD(r);try{let i=await function(a,l){let u=q(a),h=Ee.now(),f=l.reduce((I,C)=>I.add(C.key),W()),m,g;return u.persistence.runTransaction("Locally write mutations","readwrite",I=>{let C=Ft(),k=W();return u.ds.getEntries(I,f).next(P=>{C=P,C.forEach((V,F)=>{F.isValidDocument()||(k=k.add(V))})}).next(()=>u.localDocuments.getOverlayedDocuments(I,C)).next(P=>{m=P;let V=[];for(let F of l){let B=Jk(F,m.get(F.key).overlayedDocument);B!=null&&V.push(new yt(F.key,B,Fv(B.value.mapValue),ur.exists(!0)))}return u.mutationQueue.addMutationBatch(I,h,V,l)}).next(P=>{g=P;let V=P.applyToLocalDocumentSet(m,k);return u.documentOverlayCache.saveOverlays(I,P.batchId,V)})}).then(()=>({batchId:g.batchId,changes:Hv(m)}))}(n.localStore,e);n.sharedClientState.addPendingMutation(i.batchId),function(a,l,u){let h=a.Wa[a.currentUser.toKey()];h||(h=new de(J)),h=h.insert(l,u),a.Wa[a.currentUser.toKey()]=h}(n,i.batchId,t),await xs(n,i.changes),await dl(n.remoteStore)}catch(i){let s=vd(i,"Failed to persist write");t.reject(s)}}async function Tb(r,e){let t=q(r);try{let n=await TD(t.localStore,e);e.targetChanges.forEach((i,s)=>{let a=t.Ka.get(s);a&&(re(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1),i.addedDocuments.size>0?a.Ba=!0:i.modifiedDocuments.size>0?re(a.Ba):i.removedDocuments.size>0&&(re(a.Ba),a.Ba=!1))}),await xs(t,n,e)}catch(n){await Zn(n)}}function lv(r,e,t){let n=q(r);if(n.isPrimaryClient&&t===0||!n.isPrimaryClient&&t===1){let i=[];n.ka.forEach((s,a)=>{let l=a.view.sa(e);l.snapshot&&i.push(l.snapshot)}),function(a,l){let u=q(a);u.onlineState=l;let h=!1;u.queries.forEach((f,m)=>{for(let g of m.ta)g.sa(l)&&(h=!0)}),h&&bd(u)}(n.eventManager,e),i.length&&n.La.p_(i),n.onlineState=e,n.isPrimaryClient&&n.sharedClientState.setOnlineState(e)}}async function HD(r,e,t){let n=q(r);n.sharedClientState.updateQueryState(e,"rejected",t);let i=n.Ka.get(e),s=i&&i.key;if(s){let a=new de(U.comparator);a=a.insert(s,it.newNoDocument(s,z.min()));let l=W().add(s),u=new ka(z.min(),new Map,new de(J),a,l);await Tb(n,u),n.$a=n.$a.remove(s),n.Ka.delete(e),Ed(n)}else await Sh(n.localStore,e,!1).then(()=>Wh(n,e,t)).catch(Zn)}async function WD(r,e){let t=q(r),n=e.batch.batchId;try{let i=await bD(t.localStore,e);Ib(t,n,null),Eb(t,n),t.sharedClientState.updateMutationState(n,"acknowledged"),await xs(t,i)}catch(i){await Zn(i)}}async function QD(r,e,t){let n=q(r);try{let i=await function(a,l){let u=q(a);return u.persistence.runTransaction("Reject batch","readwrite-primary",h=>{let f;return u.mutationQueue.lookupMutationBatch(h,l).next(m=>(re(m!==null),f=m.keys(),u.mutationQueue.removeMutationBatch(h,m))).next(()=>u.mutationQueue.performConsistencyCheck(h)).next(()=>u.documentOverlayCache.removeOverlaysForBatchId(h,f,l)).next(()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(h,f)).next(()=>u.localDocuments.getDocuments(h,f))})}(n.localStore,e);Ib(n,e,t),Eb(n,e),n.sharedClientState.updateMutationState(e,"rejected",t),await xs(n,i)}catch(i){await Zn(i)}}function Eb(r,e){(r.Ga.get(e)||[]).forEach(t=>{t.resolve()}),r.Ga.delete(e)}function Ib(r,e,t){let n=q(r),i=n.Wa[n.currentUser.toKey()];if(i){let s=i.get(e);s&&(t?s.reject(t):s.resolve(),i=i.remove(e)),n.Wa[n.currentUser.toKey()]=i}}function Wh(r,e,t=null){r.sharedClientState.removeLocalQueryTarget(e);for(let n of r.qa.get(e))r.ka.delete(n),t&&r.La.Ja(n,t);r.qa.delete(e),r.isPrimaryClient&&r.Ua.br(e).forEach(n=>{r.Ua.containsKey(n)||Ab(r,n)})}function Ab(r,e){r.Qa.delete(e.path.canonicalString());let t=r.$a.get(e);t!==null&&(gd(r.remoteStore,t),r.$a=r.$a.remove(e),r.Ka.delete(t),Ed(r))}function uv(r,e,t){for(let n of t)n instanceof Ha?(r.Ua.addReference(n.key,e),JD(r,n)):n instanceof Wa?(L(Td,"Document no longer in limbo: "+n.key),r.Ua.removeReference(n.key,e),r.Ua.containsKey(n.key)||Ab(r,n.key)):j()}function JD(r,e){let t=e.key,n=t.path.canonicalString();r.$a.get(t)||r.Qa.has(n)||(L(Td,"New document in limbo: "+t),r.Qa.add(n),Ed(r))}function Ed(r){for(;r.Qa.size>0&&r.$a.size<r.maxConcurrentLimboResolutions;){let e=r.Qa.values().next().value;r.Qa.delete(e);let t=new U(ge.fromString(e)),n=r.za.next();r.Ka.set(n,new Kh(t)),r.$a=r.$a.insert(t,n),fb(r.remoteStore,new ms(dt(al(t.path)),n,"TargetPurposeLimboResolution",Fn.ae))}}async function xs(r,e,t){let n=q(r),i=[],s=[],a=[];n.ka.isEmpty()||(n.ka.forEach((l,u)=>{a.push(n.Ha(u,e,t).then(h=>{var f;if((h||t)&&n.isPrimaryClient){let m=h?!h.fromCache:(f=t==null?void 0:t.targetChanges.get(u.targetId))===null||f===void 0?void 0:f.current;n.sharedClientState.updateQueryState(u.targetId,m?"current":"not-current")}if(h){i.push(h);let m=Eh.Yi(u.targetId,h);s.push(m)}}))}),await Promise.all(a),n.La.p_(i),await async function(u,h){let f=q(u);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",m=>D.forEach(h,g=>D.forEach(g.Hi,I=>f.persistence.referenceDelegate.addReference(m,g.targetId,I)).next(()=>D.forEach(g.Ji,I=>f.persistence.referenceDelegate.removeReference(m,g.targetId,I)))))}catch(m){if(!ei(m))throw m;L(md,"Failed to update sequence numbers: "+m)}for(let m of h){let g=m.targetId;if(!m.fromCache){let I=f.Ts.get(g),C=I.snapshotVersion,k=I.withLastLimboFreeSnapshotVersion(C);f.Ts=f.Ts.insert(g,k)}}}(n.localStore,s))}async function YD(r,e){let t=q(r);if(!t.currentUser.isEqual(e)){L(Td,"User change. New user:",e.toKey());let n=await hb(t.localStore,e);t.currentUser=e,function(s,a){s.Ga.forEach(l=>{l.forEach(u=>{u.reject(new M(O.CANCELLED,a))})}),s.Ga.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,n.removedBatchIds,n.addedBatchIds),await xs(t,n.Rs)}}function XD(r,e){let t=q(r),n=t.Ka.get(e);if(n&&n.Ba)return W().add(n.key);{let i=W(),s=t.qa.get(e);if(!s)return i;for(let a of s){let l=t.ka.get(a);i=i.unionWith(l.view.Sa)}return i}}function xb(r){let e=q(r);return e.remoteStore.remoteSyncer.applyRemoteEvent=Tb.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=XD.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=HD.bind(null,e),e.La.p_=jD.bind(null,e.eventManager),e.La.Ja=UD.bind(null,e.eventManager),e}function ZD(r){let e=q(r);return e.remoteStore.remoteSyncer.applySuccessfulWrite=WD.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=QD.bind(null,e),e}async function Ec(r,e){r.asyncQueue.verifyOperationInProgress(),L(dr,"Initializing OfflineComponentProvider");let t=r.configuration;await e.initialize(t);let n=t.initialUser;r.setCredentialChangeListener(async i=>{n.isEqual(i)||(await hb(e.localStore,i),n=i)}),e.persistence.setDatabaseDeletedListener(()=>r.terminate()),r._offlineComponents=e}async function cv(r,e){r.asyncQueue.verifyOperationInProgress();let t=await e1(r);L(dr,"Initializing OnlineComponentProvider"),await e.initialize(t,r.configuration),r.setCredentialChangeListener(n=>sv(e.remoteStore,n)),r.setAppCheckTokenChangeListener((n,i)=>sv(e.remoteStore,i)),r._onlineComponents=e}async function e1(r){if(!r._offlineComponents)if(r._uninitializedComponentsProvider){L(dr,"Using user provided OfflineComponentProvider");try{await Ec(r,r._uninitializedComponentsProvider._offline)}catch(e){let t=e;if(!function(i){return i.name==="FirebaseError"?i.code===O.FAILED_PRECONDITION||i.code===O.UNIMPLEMENTED:!(typeof DOMException!="undefined"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11}(t))throw t;Ln("Error using user provided cache. Falling back to memory cache: "+t),await Ec(r,new Jn)}}else L(dr,"Using default OfflineComponentProvider"),await Ec(r,new Qh(void 0));return r._offlineComponents}async function Sb(r){return r._onlineComponents||(r._uninitializedComponentsProvider?(L(dr,"Using user provided OnlineComponentProvider"),await cv(r,r._uninitializedComponentsProvider._online)):(L(dr,"Using default OnlineComponentProvider"),await cv(r,new _s))),r._onlineComponents}function t1(r){return Sb(r).then(e=>e.syncEngine)}async function Yh(r){let e=await Sb(r),t=e.eventManager;return t.onListen=BD.bind(null,e.syncEngine),t.onUnlisten=zD.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=$D.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=GD.bind(null,e.syncEngine),t}function r1(r,e,t={}){let n=new ct;return r.asyncQueue.enqueueAndForget(async()=>function(s,a,l,u,h){let f=new Qa({next:g=>{f.su(),a.enqueueAndForget(()=>vb(s,m));let I=g.docs.has(l);!I&&g.fromCache?h.reject(new M(O.UNAVAILABLE,"Failed to get document because the client is offline.")):I&&g.fromCache&&u&&u.source==="server"?h.reject(new M(O.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.)')):h.resolve(g)},error:g=>h.reject(g)}),m=new Ka(al(l.path),f,{includeMetadataChanges:!0,Ta:!0});return wb(s,m)}(await Yh(r),r.asyncQueue,e,t,n)),n.promise}function Rb(r){let e={};return r.timeoutSeconds!==void 0&&(e.timeoutSeconds=r.timeoutSeconds),e}function n1(r,e,t){if(!t)throw new M(O.INVALID_ARGUMENT,`Function ${r}() cannot be called with an empty ${e}.`)}function i1(r,e,t,n){if(e===!0&&n===!0)throw new M(O.INVALID_ARGUMENT,`${r} and ${t} cannot be used together.`)}function dv(r){if(!U.isDocumentKey(r))throw new M(O.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${r} has ${r.length}.`)}function Id(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":j()}function pt(r,e){if("_delegate"in r&&(r=r._delegate),!(r instanceof e)){if(e.name===r.constructor.name)throw new M(O.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let t=Id(r);throw new M(O.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return r}function s1(r,e,t,n={}){var i;let s=(r=pt(r,ws))._getSettings(),a=`${e}:${t}`;if(s.host!==Pb&&s.host!==a&&Ln("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),r._setSettings(Object.assign(Object.assign({},s),{host:a,ssl:!1})),n.mockUserToken){let l,u;if(typeof n.mockUserToken=="string")l=n.mockUserToken,u=ve.MOCK_USER;else{l=rw(n.mockUserToken,(i=r._app)===null||i===void 0?void 0:i.options.projectId);let h=n.mockUserToken.sub||n.mockUserToken.user_id;if(!h)throw new M(O.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");u=new ve(h)}r._authCredentials=new Ac(new ba(l,u))}}function fl(r,e,...t){if(r=Pt(r),arguments.length===1&&(e=Ea.newId()),n1("doc","path",e),r instanceof ws){let n=ge.fromString(e,...t);return dv(n),new Ue(r,null,new U(n))}{if(!(r instanceof Ue||r instanceof vs))throw new M(O.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let n=r._path.child(ge.fromString(e,...t));return dv(n),new Ue(r.firestore,r instanceof vs?r.converter:null,new U(n))}}function mv(r){return function(t,n){if(typeof t!="object"||t===null)return!1;let i=t;for(let s of n)if(s in i&&typeof i[s]=="function")return!0;return!1}(r,["next","error","complete"])}function Cb(r,e){let t=typeof r=="object"?r:Tw(),n=typeof r=="string"?r:e||Sa,i=ww(t,"firestore").getImmediate({identifier:n});if(!i._initialized){let s=tw("firestore");s&&s1(i,...s)}return i}function Ad(r){if(r._terminated)throw new M(O.FAILED_PRECONDITION,"The client has already been terminated.");return r._firestoreClient||o1(r),r._firestoreClient}function o1(r){var e,t,n;let i=r._freezeSettings(),s=function(l,u,h,f){return new Dc(l,u,h,f.host,f.ssl,f.experimentalForceLongPolling,f.experimentalAutoDetectLongPolling,Rb(f.experimentalLongPollingOptions),f.useFetchStreams)}(r._databaseId,((e=r._app)===null||e===void 0?void 0:e.options.appId)||"",r._persistenceKey,i);r._componentsProvider||!((t=i.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((n=i.localCache)===null||n===void 0)&&n._onlineComponentProvider)&&(r._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),r._firestoreClient=new Jh(r._authCredentials,r._appCheckCredentials,r._queue,s,r._componentsProvider&&function(l){let u=l==null?void 0:l._online.build();return{_offline:l==null?void 0:l._offline.build(u),_online:u}}(r._componentsProvider))}function kb(r){switch(r){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw j()}}function Db(r){let e=r._freezeSettings(),t=cl(r._databaseId);return new ed(r._databaseId,!!e.ignoreUndefinedProperties,t)}function l1(r,e,t,n,i,s={}){let a=r.ju(s.merge||s.mergeFields?2:0,e,t,i);xd("Data must be an object, but it was:",a,n);let l=Ob(n,a),u,h;if(s.merge)u=new Xe(a.fieldMask),h=a.fieldTransforms;else if(s.mergeFields){let f=[];for(let m of s.mergeFields){let g=td(e,m,t);if(!a.contains(g))throw new M(O.INVALID_ARGUMENT,`Field '${g}' is specified in your field mask but missing from your input data.`);Vb(f,g)||f.push(g)}u=new Xe(f),h=a.fieldTransforms.filter(m=>u.covers(m.field))}else u=null,h=a.fieldTransforms;return new Xh(new Ke(l),u,h)}function u1(r,e,t,n){let i=r.ju(1,e,t);xd("Data must be an object, but it was:",i,n);let s=[],a=Ke.empty();pr(n,(u,h)=>{let f=Sd(e,u,t);h=Pt(h);let m=i.Ku(f);if(h instanceof el)s.push(f);else{let g=pl(h,m);g!=null&&(s.push(f),a.set(f,g))}});let l=new Xe(s);return new Za(a,l,i.fieldTransforms)}function c1(r,e,t,n,i,s){let a=r.ju(1,e,t),l=[td(e,n,t)],u=[i];if(s.length%2!=0)throw new M(O.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let g=0;g<s.length;g+=2)l.push(td(e,s[g])),u.push(s[g+1]);let h=[],f=Ke.empty();for(let g=l.length-1;g>=0;--g)if(!Vb(h,l[g])){let I=l[g],C=u[g];C=Pt(C);let k=a.Ku(I);if(C instanceof el)h.push(I);else{let P=pl(C,k);P!=null&&(h.push(I),f.set(I,P))}}let m=new Xe(h);return new Za(f,m,a.fieldTransforms)}function pl(r,e){if(Nb(r=Pt(r)))return xd("Unsupported field value:",e,r),Ob(r,e);if(r instanceof Ts)return function(n,i){if(!kb(i.Lu))throw i.Wu(`${n._methodName}() can only be used with update() and set()`);if(!i.path)throw i.Wu(`${n._methodName}() is not currently supported inside arrays`);let s=n._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(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.Qu&&e.Lu!==4)throw e.Wu("Nested arrays are not supported");return function(n,i){let s=[],a=0;for(let l of n){let u=pl(l,i.Uu(a));u==null&&(u={nullValue:"NULL_VALUE"}),s.push(u),a++}return{arrayValue:{values:s}}}(r,e)}return function(n,i){if((n=Pt(n))===null)return{nullValue:"NULL_VALUE"};if(typeof n=="number")return Gk(i.serializer,n);if(typeof n=="boolean")return{booleanValue:n};if(typeof n=="string")return{stringValue:n};if(n instanceof Date){let s=Ee.fromDate(n);return{timestampValue:Va(i.serializer,s)}}if(n instanceof Ee){let s=new Ee(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:Va(i.serializer,s)}}if(n instanceof Es)return{geoPointValue:{latitude:n.latitude,longitude:n.longitude}};if(n instanceof bs)return{bytesValue:nb(i.serializer,n._byteString)};if(n instanceof Ue){let s=i.databaseId,a=n.firestore._databaseId;if(!a.isEqual(s))throw i.Wu(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:pd(n.firestore._databaseId||i.databaseId,n._key.path)}}if(n instanceof Is)return function(a,l){return{mapValue:{fields:{[ld]:{stringValue:ud},[jn]:{arrayValue:{values:a.toArray().map(h=>{if(typeof h!="number")throw l.Wu("VectorValues must only contain numeric values.");return fd(l.serializer,h)})}}}}}}(n,i);throw i.Wu(`Unsupported field value: ${Id(n)}`)}(r,e)}function Ob(r,e){let t={};return Cv(r)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):pr(r,(n,i)=>{let s=pl(i,e.qu(n));s!=null&&(t[n]=s)}),{mapValue:{fields:t}}}function Nb(r){return!(typeof r!="object"||r===null||r instanceof Array||r instanceof Date||r instanceof Ee||r instanceof Es||r instanceof bs||r instanceof Ue||r instanceof Ts||r instanceof Is)}function xd(r,e,t){if(!Nb(t)||!function(i){return typeof i=="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Object.getPrototypeOf(i)===null)}(t)){let n=Id(t);throw n==="an object"?e.Wu(r+" a custom object"):e.Wu(r+" "+n)}}function td(r,e,t){if((e=Pt(e))instanceof Yn)return e._internalPath;if(typeof e=="string")return Sd(r,e);throw tl("Field path arguments must be of type string or ",r,!1,void 0,t)}function Sd(r,e,t){if(e.search(h1)>=0)throw tl(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,r,!1,void 0,t);try{return new Yn(...e.split("."))._internalPath}catch{throw tl(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,r,!1,void 0,t)}}function tl(r,e,t,n,i){let s=n&&!n.isEmpty(),a=i!==void 0,l=`Function ${e}() called with invalid data`;t&&(l+=" (via `toFirestore()`)"),l+=". ";let u="";return(s||a)&&(u+=" (found",s&&(u+=` in field ${n}`),a&&(u+=` in document ${i}`),u+=")"),new M(O.INVALID_ARGUMENT,l+r+u)}function Vb(r,e){return r.some(t=>t.isEqual(e))}function Lb(r,e){return typeof e=="string"?Sd(r,e):e instanceof Yn?e._internalPath:e._delegate._internalPath}function d1(r){if(r.limitType==="L"&&r.explicitOrderBy.length===0)throw new M(O.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}function f1(r,e,t){let n;return n=r?t&&(t.merge||t.mergeFields)?r.toFirestore(e,t):r.toFirestore(e):e,n}function p1(r){switch(r){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return j()}}function Rd(r){r=pt(r,Ue);let e=pt(r.firestore,fr);return r1(Ad(e),r._key).then(t=>Bb(e,r,t))}function Mb(r,e,t){r=pt(r,Ue);let n=pt(r.firestore,fr),i=f1(r.converter,e,t);return Ub(n,[l1(Db(n),"setDoc",r._key,i,r.converter!==null,t).toMutation(r._key,ur.none())])}function Fb(r,e,t,...n){r=pt(r,Ue);let i=pt(r.firestore,fr),s=Db(i),a;return a=typeof(e=Pt(e))=="string"||e instanceof Yn?c1(s,"updateDoc",r._key,e,t,n):u1(s,"updateDoc",r._key,e),Ub(i,[a.toMutation(r._key,ur.exists(!0))])}function jb(r,...e){var t,n,i;r=Pt(r);let s={includeMetadataChanges:!1,source:"default"},a=0;typeof e[a]!="object"||mv(e[a])||(s=e[a],a++);let l={includeMetadataChanges:s.includeMetadataChanges,source:s.source};if(mv(e[a])){let m=e[a];e[a]=(t=m.next)===null||t===void 0?void 0:t.bind(m),e[a+1]=(n=m.error)===null||n===void 0?void 0:n.bind(m),e[a+2]=(i=m.complete)===null||i===void 0?void 0:i.bind(m)}let u,h,f;if(r instanceof Ue)h=pt(r.firestore,fr),f=al(r._key.path),u={next:m=>{e[a]&&e[a](Bb(h,r,m))},error:e[a+1],complete:e[a+2]};else{let m=pt(r,Ya);h=pt(m.firestore,fr),f=m._query;let g=new il(h);u={next:I=>{e[a]&&e[a](new id(h,g,m,I))},error:e[a+1],complete:e[a+2]},d1(r._query)}return function(g,I,C,k){let P=new Qa(k),V=new Ka(I,P,C);return g.asyncQueue.enqueueAndForget(async()=>wb(await Yh(g),V)),()=>{P.su(),g.asyncQueue.enqueueAndForget(async()=>vb(await Yh(g),V))}}(Ad(h),f,l,u)}function Ub(r,e){return function(n,i){let s=new ct;return n.asyncQueue.enqueueAndForget(async()=>KD(await t1(n),i,s)),s.promise}(Ad(r),e)}function Bb(r,e,t){let n=t.docs.get(e._key),i=new il(r);return new nl(r,i,e._key,n,new kr(t.hasPendingWrites,t.fromCache),e.converter)}var Pw,Cw,ve,Xn,Dr,O,M,ct,ba,Ic,Ac,xc,Sc,Rc,Ta,Pc,Ea,kw,Dw,Ee,z,Ow,Ia,ge,fk,He,U,cs,Cc,Or,yk,kc,D,Fn,od,gv,Tk,yv,_v,wv,vv,Ek,bv,Tv,Ev,Iv,Av,xv,Sv,Rv,Ik,Ak,xk,Pv,Sk,Rk,f$,Pk,Ck,kk,p$,de,On,ht,be,Aa,Xe,xa,De,Dk,kv,Dv,Ov,Nv,Dc,Sa,Ra,ld,Vv,ma,ud,jn,g$,Ke,it,$n,qn,Pa,we,gt,Lc,Mc,Fc,jc,Uc,Bc,$c,qc,zn,Mt,Uk,Kv,Bk,$k,qk,Gn,Kn,Nr,Vr,Hn,Kc,ur,Wn,Lr,yt,Ca,Hc,Wc,Qc,Jc,Yc,pe,Y,Ww,Zk,Xc,Cr,ka,ps,Nn,Da,Oa,Na,Zc,eD,tD,rD,eh,ms,sh,La,oh,ah,y$,Zw,cb,Ye,gs,ev,yD,lh,uh,ch,hh,dh,fh,ph,mh,gh,ys,me,yh,_h,wh,vh,Ma,bh,Th,Fa,Eh,Ih,Ah,md,wD,xh,ja,Rh,Ph,nv,Ua,ya,bc,SD,kh,Dh,ke,Oh,Ba,iv,$a,Nh,Vh,Lh,Mh,Fh,Mr,jh,Uh,za,Ga,Qn,Bh,$h,qh,av,Ka,Ha,Wa,zh,Td,Gh,Kh,Hh,Jn,Qh,_s,Qa,dr,Jh,hv,Pb,fv,Ja,ws,Ya,Ue,vs,pv,Xa,fr,bs,Yn,Ts,Es,Is,a1,Xh,Za,Zh,ed,el,h1,rl,rd,nd,kr,nl,Vn,id,il,$b=_(()=>{da();Yu();Xu();ts();Sw();Rw();Pw="@firebase/firestore",Cw="4.7.8";ve=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}};ve.UNAUTHENTICATED=new ve(null),ve.GOOGLE_CREDENTIALS=new ve("google-credentials-uid"),ve.FIRST_PARTY=new ve("first-party-uid"),ve.MOCK_USER=new ve("mock-user");Xn="11.3.1";Dr=new Sn("@firebase/firestore");O={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"},M=class extends Rt{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};ct=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}};ba=class{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}},Ic=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(ve.UNAUTHENTICATED))}shutdown(){}},Ac=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}},xc=class{constructor(e){this.t=e,this.currentUser=ve.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){re(this.o===void 0);let n=this.i,i=u=>this.i!==n?(n=this.i,t(u)):Promise.resolve(),s=new ct;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new ct,e.enqueueRetryable(()=>i(this.currentUser))};let a=()=>{let u=s;e.enqueueRetryable(async()=>{await u.promise,await i(this.currentUser)})},l=u=>{L("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=u,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit(u=>l(u)),setTimeout(()=>{if(!this.auth){let u=this.t.getImmediate({optional:!0});u?l(u):(L("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new ct)}},0),a()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(n=>this.i!==e?(L("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):n?(re(typeof n.accessToken=="string"),new ba(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 re(e===null||typeof e=="string"),new ve(e)}},Sc=class{constructor(e,t,n){this.l=e,this.h=t,this.P=n,this.type="FirstParty",this.user=ve.FIRST_PARTY,this.T=new Map}I(){return this.P?this.P():null}get headers(){this.T.set("X-Goog-AuthUser",this.l);let e=this.I();return e&&this.T.set("Authorization",e),this.h&&this.T.set("X-Goog-Iam-Authorization-Token",this.h),this.T}},Rc=class{constructor(e,t,n){this.l=e,this.h=t,this.P=n}getToken(){return Promise.resolve(new Sc(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(ve.FIRST_PARTY))}shutdown(){}invalidateToken(){}},Ta=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)}},Pc=class{constructor(e,t){this.A=t,this.forceRefresh=!1,this.appCheck=null,this.R=null,this.V=null,vw(e)&&e.settings.appCheckToken&&(this.V=e.settings.appCheckToken)}start(e,t){re(this.o===void 0);let n=s=>{s.error!=null&&L("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);let a=s.token!==this.R;return this.R=s.token,L("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?t(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>n(s))};let i=s=>{L("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){let s=this.A.getImmediate({optional:!0});s?i(s):L("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.V)return Promise.resolve(new Ta(this.V));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(re(typeof t.token=="string"),this.R=t.token,new Ta(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};Ea=class{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(4.129032258064516),n="";for(;n.length<20;){let i=dk(40);for(let s=0;s<i.length;++s)n.length<20&&i[s]<t&&(n+=e.charAt(i[s]%62))}return n}};kw=-62135596800,Dw=1e6,Ee=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)*Dw);return new r(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new M(O.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new M(O.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<kw)throw new M(O.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new M(O.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Dw}_compareTo(e){return this.seconds===e.seconds?J(this.nanoseconds,e.nanoseconds):J(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{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){let e=this.seconds-kw;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};z=class r{static fromTimestamp(e){return new r(e)}static min(){return new r(new Ee(0,0))}static max(){return new r(new Ee(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}};Ow="__name__",Ia=class r{constructor(e,t,n){t===void 0?t=0:t>e.length&&j(),n===void 0?n=e.length-t:n>e.length-t&&j(),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 i=0;i<n;i++){let s=r.compareSegments(e.get(i),t.get(i));if(s!==0)return s}return Math.sign(e.length-t.length)}static compareSegments(e,t){let n=r.isNumericId(e),i=r.isNumericId(t);return n&&!i?-1:!n&&i?1:n&&i?r.extractNumericId(e).compare(r.extractNumericId(t)):e<t?-1:e>t?1:0}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Dt.fromString(e.substring(4,e.length-2))}},ge=class r extends Ia{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 M(O.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(i=>i.length>0))}return new r(t)}static emptyPath(){return new r([])}},fk=/^[_a-zA-Z][_a-zA-Z0-9]*$/,He=class r extends Ia{construct(e,t,n){return new r(e,t,n)}static isValidIdentifier(e){return fk.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)===Ow}static keyField(){return new r([Ow])}static fromServerFormat(e){let t=[],n="",i=0,s=()=>{if(n.length===0)throw new M(O.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""},a=!1;for(;i<e.length;){let l=e[i];if(l==="\\"){if(i+1===e.length)throw new M(O.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let u=e[i+1];if(u!=="\\"&&u!=="."&&u!=="`")throw new M(O.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=u,i+=2}else l==="`"?(a=!a,i++):l!=="."||a?(n+=l,i++):(s(),i++)}if(s(),a)throw new M(O.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new r(t)}static emptyPath(){return new r([])}};U=class r{constructor(e){this.path=e}static fromPath(e){return new r(ge.fromString(e))}static fromName(e){return new r(ge.fromString(e).popFirst(5))}static empty(){return new r(ge.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&&ge.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return ge.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new r(new ge(e.slice()))}};cs=-1,Cc=class{constructor(e,t,n,i){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=i}};Cc.UNKNOWN_ID=-1;Or=class r{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new r(z.min(),U.empty(),cs)}static max(){return new r(z.max(),U.empty(),cs)}};yk="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",kc=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}};D=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&&j(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new r((n,i)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(n,i)},this.catchCallback=s=>{this.wrapFailure(t,s).next(n,i)}})}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 i=0,s=0,a=!1;e.forEach(l=>{++i,l.next(()=>{++s,a&&s===i&&t()},u=>n(u))}),a=!0,s===i&&t()})}static or(e){let t=r.resolve(!1);for(let n of e)t=t.next(i=>i?r.resolve(i):n());return t}static forEach(e,t){let n=[];return e.forEach((i,s)=>{n.push(t.call(this,i,s))}),this.waitFor(n)}static mapArray(e,t){return new r((n,i)=>{let s=e.length,a=new Array(s),l=0;for(let u=0;u<s;u++){let h=u;t(e[h]).next(f=>{a[h]=f,++l,l===s&&n(a)},f=>i(f))}})}static doWhile(e,t){return new r((n,i)=>{let s=()=>{e()===!0?t().next(()=>{s()},i):n()};s()})}};Fn=class{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=n=>this.oe(n),this._e=n=>t.writeSequenceNumber(n))}oe(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this._e&&this._e(e),e}};Fn.ae=-1;od=-1;gv="";Tk="remoteDocuments",yv="owner",_v="mutationQueues",wv="mutations";vv="documentMutations",Ek="remoteDocumentsV14",bv="remoteDocumentGlobal",Tv="targets",Ev="targetDocuments",Iv="targetGlobal",Av="collectionParents",xv="clientMetadata",Sv="bundles",Rv="namedQueries",Ik="indexConfiguration",Ak="indexState",xk="indexEntries",Pv="documentOverlays",Sk="globals",Rk=[_v,wv,vv,Tk,Tv,yv,Iv,Ev,xv,bv,Av,Sv,Rv],f$=[...Rk,Pv],Pk=[_v,wv,vv,Ek,Tv,yv,Iv,Ev,xv,bv,Av,Sv,Rv,Pv],Ck=Pk,kk=[...Ck,Ik,Ak,xk],p$=[...kk,Sk];de=class r{constructor(e,t){this.comparator=e,this.root=t||ht.EMPTY}insert(e,t){return new r(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,ht.BLACK,null,null))}remove(e){return new r(this.comparator,this.root.remove(e,this.comparator).copy(null,null,ht.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 i=this.comparator(e,n.key);if(i===0)return t+n.left.size;i<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 On(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new On(this.root,e,this.comparator,!1)}getReverseIterator(){return new On(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new On(this.root,e,this.comparator,!0)}},On=class{constructor(e,t,n,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,t&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===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}}},ht=class r{constructor(e,t,n,i,s){this.key=e,this.value=t,this.color=n!=null?n:r.RED,this.left=i!=null?i:r.EMPTY,this.right=s!=null?s:r.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,i,s){return new r(e!=null?e:this.key,t!=null?t:this.value,n!=null?n:this.color,i!=null?i:this.left,s!=null?s: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 i=this,s=n(e,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(e,t,n),null):s===0?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,n)),i.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,i=this;if(t(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),t(e,i.key)===0){if(i.right.isEmpty())return r.EMPTY;n=i.right.min(),i=i.copy(n.key,n.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.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()||this.right.isRed())throw j();let e=this.left.check();if(e!==this.right.check())throw j();return e+(this.isRed()?0:1)}};ht.EMPTY=null,ht.RED=!0,ht.BLACK=!1;ht.EMPTY=new class{constructor(){this.size=0}get key(){throw j()}get value(){throw j()}get color(){throw j()}get left(){throw j()}get right(){throw j()}copy(e,t,n,i,s){return this}insert(e,t,n){return new ht(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}};be=class r{constructor(e){this.comparator=e,this.data=new de(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 i=n.getNext();if(this.comparator(i.key,e[1])>=0)return;t(i.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 Aa(this.data.getIterator())}getIteratorFrom(e){return new Aa(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 i=t.getNext().key,s=n.getNext().key;if(this.comparator(i,s)!==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}},Aa=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};Xe=class r{constructor(e){this.fields=e,e.sort(He.comparator)}static empty(){return new r([])}unionWith(e){let t=new be(He.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 Mn(this.fields,e.fields,(t,n)=>t.isEqual(n))}};xa=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};De=class r{constructor(e){this.binaryString=e}static fromBase64String(e){let t=function(i){try{return atob(i)}catch(s){throw typeof DOMException!="undefined"&&s instanceof DOMException?new xa("Invalid base64 string: "+s):s}}(e);return new r(t)}static fromUint8Array(e){let t=function(i){let s="";for(let a=0;a<i.length;++a)s+=String.fromCharCode(i[a]);return s}(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 i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return J(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};De.EMPTY_BYTE_STRING=new De("");Dk=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);kv="server_timestamp",Dv="__type__",Ov="__previous_value__",Nv="__local_write_time__";Dc=class{constructor(e,t,n,i,s,a,l,u,h){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=i,this.ssl=s,this.forceLongPolling=a,this.autoDetectLongPolling=l,this.longPollingOptions=u,this.useFetchStreams=h}},Sa="(default)",Ra=class r{constructor(e,t){this.projectId=e,this.database=t||Sa}static empty(){return new r("","")}get isDefaultDatabase(){return this.database===Sa}isEqual(e){return e instanceof r&&e.projectId===this.projectId&&e.database===this.database}};ld="__type__",Vv="__max__",ma={mapValue:{fields:{__type__:{stringValue:Vv}}}},ud="__vector__",jn="value";g$={mapValue:{fields:{[ld]:{stringValue:ud},[jn]:{arrayValue:{}}}}};Ke=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)],!wa(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=os(t)}setAll(e){let t=He.emptyPath(),n={},i=[];e.forEach((a,l)=>{if(!t.isImmediateParentOf(l)){let u=this.getFieldsMap(t);this.applyChanges(u,n,i),n={},i=[],t=l.popLast()}a?n[l.lastSegment()]=os(a):i.push(l.lastSegment())});let s=this.getFieldsMap(t);this.applyChanges(s,n,i)}delete(e){let t=this.field(e.popLast());wa(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return mt(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 i=t.mapValue.fields[e.get(n)];wa(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=i),t=i}return t.mapValue.fields}applyChanges(e,t,n){pr(t,(i,s)=>e[i]=s);for(let i of n)delete e[i]}clone(){return new r(os(this.value))}};it=class r{constructor(e,t,n,i,s,a,l){this.key=e,this.documentType=t,this.version=n,this.readTime=i,this.createTime=s,this.data=a,this.documentState=l}static newInvalidDocument(e){return new r(e,0,z.min(),z.min(),z.min(),Ke.empty(),0)}static newFoundDocument(e,t,n,i){return new r(e,1,t,z.min(),n,i,0)}static newNoDocument(e,t){return new r(e,2,t,z.min(),z.min(),Ke.empty(),0)}static newUnknownDocument(e,t){return new r(e,3,t,z.min(),z.min(),Ke.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(z.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=Ke.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Ke.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=z.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}})`}};$n=class{constructor(e,t){this.position=e,this.inclusive=t}};qn=class{constructor(e,t="asc"){this.field=e,this.dir=t}};Pa=class{},we=class r extends Pa{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 Lc(e,t,n):t==="array-contains"?new jc(e,n):t==="in"?new Uc(e,n):t==="not-in"?new Bc(e,n):t==="array-contains-any"?new $c(e,n):new r(e,t,n)}static createKeyFieldInFilter(e,t,n){return t==="in"?new Mc(e,n):new Fc(e,n)}matches(e){let t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(Un(t,this.value)):t!==null&&cr(this.value)===cr(t)&&this.matchesComparison(Un(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 j()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},gt=class r extends Pa{constructor(e,t){super(),this.filters=e,this.op=t,this.ce=null}static create(e,t){return new r(e,t)}matches(e){return jv(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.ce!==null||(this.ce=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ce}getFilters(){return Object.assign([],this.filters)}};Lc=class extends we{constructor(e,t,n){super(e,t,n),this.key=U.fromName(n.referenceValue)}matches(e){let t=U.comparator(e.key,this.key);return this.matchesComparison(t)}},Mc=class extends we{constructor(e,t){super(e,"in",t),this.keys=qv("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}},Fc=class extends we{constructor(e,t){super(e,"not-in",t),this.keys=qv("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}};jc=class extends we{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return cd(t)&&fs(t.arrayValue,this.value)}},Uc=class extends we{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return t!==null&&fs(this.value.arrayValue,t)}},Bc=class extends we{constructor(e,t){super(e,"not-in",t)}matches(e){if(fs(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return t!==null&&!fs(this.value.arrayValue,t)}},$c=class extends we{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!cd(t)||!t.arrayValue.values)&&t.arrayValue.values.some(n=>fs(this.value.arrayValue,n))}};qc=class{constructor(e,t=null,n=[],i=[],s=null,a=null,l=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=i,this.limit=s,this.startAt=a,this.endAt=l,this.le=null}};zn=class{constructor(e,t=null,n=[],i=[],s=null,a="F",l=null,u=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=i,this.limit=s,this.limitType=a,this.startAt=l,this.endAt=u,this.he=null,this.Pe=null,this.Te=null,this.startAt,this.endAt}};Mt=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[i,s]of n)if(this.equalsFn(i,e))return s}}has(e){return this.get(e)!==void 0}set(e,t){let n=this.mapKeyFn(e),i=this.inner[n];if(i===void 0)return this.inner[n]=[[e,t]],void this.innerSize++;for(let s=0;s<i.length;s++)if(this.equalsFn(i[s][0],e))return void(i[s]=[e,t]);i.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n===void 0)return!1;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],e))return n.length===1?delete this.inner[t]:n.splice(i,1),this.innerSize--,!0;return!1}forEach(e){pr(this.inner,(t,n)=>{for(let[i,s]of n)e(i,s)})}isEmpty(){return Cv(this.inner)}size(){return this.innerSize}};Uk=new de(U.comparator);Kv=new de(U.comparator);Bk=new de(U.comparator),$k=new be(U.comparator);qk=new be(J);Gn=class{constructor(){this._=void 0}};Kn=class extends Gn{},Nr=class extends Gn{constructor(e){super(),this.elements=e}};Vr=class extends Gn{constructor(e){super(),this.elements=e}};Hn=class extends Gn{constructor(e,t){super(),this.serializer=e,this.Ie=t}};Kc=class{constructor(e,t){this.version=e,this.transformResults=t}},ur=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)}};Wn=class{};Lr=class extends Wn{constructor(e,t,n,i=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}},yt=class extends Wn{constructor(e,t,n,i,s=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}};Ca=class extends Wn{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},Hc=class extends Wn{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};Wc=class{constructor(e,t,n,i){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=i}applyToRemoteDocument(e,t){let n=t.mutationResults;for(let i=0;i<this.mutations.length;i++){let s=this.mutations[i];s.key.isEqual(e.key)&&Qk(s,e,n[i])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=us(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=us(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=Wv();return this.mutations.forEach(i=>{let s=e.get(i.key),a=s.overlayedDocument,l=this.applyToLocalView(a,s.mutatedFields);l=t.has(i.key)?null:l;let u=eb(a,l);u!==null&&n.set(i.key,u),a.isValidDocument()||a.convertToNoDocument(z.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),W())}isEqual(e){return this.batchId===e.batchId&&Mn(this.mutations,e.mutations,(t,n)=>Gw(t,n))&&Mn(this.baseMutations,e.baseMutations,(t,n)=>Gw(t,n))}},Qc=class r{constructor(e,t,n,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=i}static from(e,t,n){re(e.mutations.length===n.length);let i=function(){return Bk}(),s=e.mutations;for(let a=0;a<s.length;a++)i=i.insert(s[a].key,n[a].version);return new r(e,t,n,i)}};Jc=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
10
|
largestBatchId: ${this.largestBatchId},
|
|
11
11
|
mutation: ${this.mutation.toString()}
|
|
12
|
-
}`}};var gc=class{constructor(e,t){this.count=e,this.unchangedNames=t}};var de,J;function lS(r){switch(r){case D.OK:return F();case D.CANCELLED:case D.UNKNOWN:case D.DEADLINE_EXCEEDED:case D.RESOURCE_EXHAUSTED:case D.INTERNAL:case D.UNAVAILABLE:case D.UNAUTHENTICATED:return!1;case D.INVALID_ARGUMENT:case D.NOT_FOUND:case D.ALREADY_EXISTS:case D.PERMISSION_DENIED:case D.FAILED_PRECONDITION:case D.ABORTED:case D.OUT_OF_RANGE:case D.UNIMPLEMENTED:case D.DATA_LOSS:return!0;default:return F()}}function ty(r){if(r===void 0)return It("GRPC error has no .code"),D.UNKNOWN;switch(r){case de.OK:return D.OK;case de.CANCELLED:return D.CANCELLED;case de.UNKNOWN:return D.UNKNOWN;case de.DEADLINE_EXCEEDED:return D.DEADLINE_EXCEEDED;case de.RESOURCE_EXHAUSTED:return D.RESOURCE_EXHAUSTED;case de.INTERNAL:return D.INTERNAL;case de.UNAVAILABLE:return D.UNAVAILABLE;case de.UNAUTHENTICATED:return D.UNAUTHENTICATED;case de.INVALID_ARGUMENT:return D.INVALID_ARGUMENT;case de.NOT_FOUND:return D.NOT_FOUND;case de.ALREADY_EXISTS:return D.ALREADY_EXISTS;case de.PERMISSION_DENIED:return D.PERMISSION_DENIED;case de.FAILED_PRECONDITION:return D.FAILED_PRECONDITION;case de.ABORTED:return D.ABORTED;case de.OUT_OF_RANGE:return D.OUT_OF_RANGE;case de.UNIMPLEMENTED:return D.UNIMPLEMENTED;case de.DATA_LOSS:return D.DATA_LOSS;default:return F()}}(J=de||(de={}))[J.OK=0]="OK",J[J.CANCELLED=1]="CANCELLED",J[J.UNKNOWN=2]="UNKNOWN",J[J.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",J[J.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",J[J.NOT_FOUND=5]="NOT_FOUND",J[J.ALREADY_EXISTS=6]="ALREADY_EXISTS",J[J.PERMISSION_DENIED=7]="PERMISSION_DENIED",J[J.UNAUTHENTICATED=16]="UNAUTHENTICATED",J[J.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",J[J.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",J[J.ABORTED=10]="ABORTED",J[J.OUT_OF_RANGE=11]="OUT_OF_RANGE",J[J.UNIMPLEMENTED=12]="UNIMPLEMENTED",J[J.INTERNAL=13]="INTERNAL",J[J.UNAVAILABLE=14]="UNAVAILABLE",J[J.DATA_LOSS=15]="DATA_LOSS";var Hm=null;function hS(){return new TextEncoder}var dS=new Tt([4294967295,4294967295],0);function Wm(r){let e=hS().encode(r),t=new Ou;return t.update(e),new Uint8Array(t.digest())}function Qm(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 Tt([t,n],0),new Tt([s,i],0)]}var yc=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.Ee=8*e.length-t,this.de=Tt.fromNumber(this.Ee)}Ae(e,t,n){let s=e.add(t.multiply(Tt.fromNumber(n)));return s.compare(dS)===1&&(s=new Tt([s.getBits(0),s.getBits(1)],0)),s.modulo(this.de).toNumber()}Re(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.Ee===0)return!1;let t=Wm(e),[n,s]=Qm(t);for(let i=0;i<this.hashCount;i++){let a=this.Ae(n,s,i);if(!this.Re(a))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)),a=new r(i,s,t);return n.forEach(u=>a.insert(u)),a}insert(e){if(this.Ee===0)return;let t=Wm(e),[n,s]=Qm(t);for(let i=0;i<this.hashCount;i++){let a=this.Ae(n,s,i);this.Ve(a)}}Ve(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 Ro=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,Ds.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new r(q.min(),s,new le(Q),Rt(),H())}},Ds=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,H(),H(),H())}};var fn=class{constructor(e,t,n,s){this.me=e,this.removedTargetIds=t,this.key=n,this.fe=s}},Po=class{constructor(e,t){this.targetId=e,this.ge=t}},Co=class{constructor(e,t,n=Pe.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=s}},ko=class{constructor(){this.pe=0,this.ye=Jm(),this.we=Pe.EMPTY_BYTE_STRING,this.Se=!1,this.be=!0}get current(){return this.Se}get resumeToken(){return this.we}get De(){return this.pe!==0}get ve(){return this.be}Ce(e){e.approximateByteSize()>0&&(this.be=!0,this.we=e)}Fe(){let e=H(),t=H(),n=H();return this.ye.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:F()}}),new Ds(this.we,this.Se,e,t,n)}Me(){this.be=!1,this.ye=Jm()}xe(e,t){this.be=!0,this.ye=this.ye.insert(e,t)}Oe(e){this.be=!0,this.ye=this.ye.remove(e)}Ne(){this.pe+=1}Be(){this.pe-=1,ee(this.pe>=0)}Le(){this.be=!0,this.Se=!0}},_c=class{constructor(e){this.ke=e,this.qe=new Map,this.Qe=Rt(),this.$e=fo(),this.Ke=fo(),this.Ue=new le(Q)}We(e){for(let t of e.me)e.fe&&e.fe.isFoundDocument()?this.Ge(t,e.fe):this.ze(t,e.key,e.fe);for(let t of e.removedTargetIds)this.ze(t,e.key,e.fe)}je(e){this.forEachTarget(e,t=>{let n=this.He(t);switch(e.state){case 0:this.Je(t)&&n.Ce(e.resumeToken);break;case 1:n.Be(),n.De||n.Me(),n.Ce(e.resumeToken);break;case 2:n.Be(),n.De||this.removeTarget(t);break;case 3:this.Je(t)&&(n.Le(),n.Ce(e.resumeToken));break;case 4:this.Je(t)&&(this.Ye(t),n.Ce(e.resumeToken));break;default:F()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.qe.forEach((n,s)=>{this.Je(s)&&t(s)})}Ze(e){let t=e.targetId,n=e.ge.count,s=this.Xe(t);if(s){let i=s.target;if(cc(i))if(n===0){let a=new j(i.path);this.ze(t,a,We.newNoDocument(a,q.min()))}else ee(n===1);else{let a=this.et(t);if(a!==n){let u=this.tt(e),c=u?this.nt(u,e,a):1;if(c!==0){this.Ye(t);let h=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ue=this.Ue.insert(t,h)}Hm==null||Hm.rt(function(f,m,g,E,P){var C,R,N,M,U,G;let Y={localCacheCount:f,existenceFilterCount:m.count,databaseId:g.database,projectId:g.projectId},B=m.unchangedNames;return B&&(Y.bloomFilter={applied:P===0,hashCount:(C=B==null?void 0:B.hashCount)!==null&&C!==void 0?C:0,bitmapLength:(M=(N=(R=B==null?void 0:B.bits)===null||R===void 0?void 0:R.bitmap)===null||N===void 0?void 0:N.length)!==null&&M!==void 0?M:0,padding:(G=(U=B==null?void 0:B.bits)===null||U===void 0?void 0:U.padding)!==null&&G!==void 0?G:0,mightContain:T=>{var y;return(y=E==null?void 0:E.mightContain(T))!==null&&y!==void 0&&y}}),Y}(a,e.ge,this.ke.it(),u,c))}}}}tt(e){let t=e.ge.unchangedNames;if(!t||!t.bits)return null;let{bits:{bitmap:n="",padding:s=0},hashCount:i=0}=t,a,u;try{a=At(n).toUint8Array()}catch(c){if(c instanceof Eo)return mn("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 yc(a,s,i)}catch(c){return mn(c instanceof pr?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return u.Ee===0?null:u}nt(e,t,n){return t.ge.count===n-this.st(e,t.targetId)?0:2}st(e,t){let n=this.ke.getRemoteKeysForTarget(t),s=0;return n.forEach(i=>{let a=this.ke.it(),u=`projects/${a.projectId}/databases/${a.database}/documents/${i.path.canonicalString()}`;e.mightContain(u)||(this.ze(t,i,null),s++)}),s}ot(e){let t=new Map;this.qe.forEach((i,a)=>{let u=this.Xe(a);if(u){if(i.current&&cc(u.target)){let c=new j(u.target.path);this._t(c).has(a)||this.ut(a,c)||this.ze(a,c,We.newNoDocument(c,e))}i.ve&&(t.set(a,i.Fe()),i.Me())}});let n=H();this.Ke.forEach((i,a)=>{let u=!0;a.forEachWhile(c=>{let h=this.Xe(c);return!h||h.purpose==="TargetPurposeLimboResolution"||(u=!1,!1)}),u&&(n=n.add(i))}),this.Qe.forEach((i,a)=>a.setReadTime(e));let s=new Ro(e,t,this.Ue,this.Qe,n);return this.Qe=Rt(),this.$e=fo(),this.Ke=fo(),this.Ue=new le(Q),s}Ge(e,t){if(!this.Je(e))return;let n=this.ut(e,t.key)?2:0;this.He(e).xe(t.key,n),this.Qe=this.Qe.insert(t.key,t),this.$e=this.$e.insert(t.key,this._t(t.key).add(e)),this.Ke=this.Ke.insert(t.key,this.ct(t.key).add(e))}ze(e,t,n){if(!this.Je(e))return;let s=this.He(e);this.ut(e,t)?s.xe(t,1):s.Oe(t),this.Ke=this.Ke.insert(t,this.ct(t).delete(e)),this.Ke=this.Ke.insert(t,this.ct(t).add(e)),n&&(this.Qe=this.Qe.insert(t,n))}removeTarget(e){this.qe.delete(e)}et(e){let t=this.He(e).Fe();return this.ke.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Ne(e){this.He(e).Ne()}He(e){let t=this.qe.get(e);return t||(t=new ko,this.qe.set(e,t)),t}ct(e){let t=this.Ke.get(e);return t||(t=new ve(Q),this.Ke=this.Ke.insert(e,t)),t}_t(e){let t=this.$e.get(e);return t||(t=new ve(Q),this.$e=this.$e.insert(e,t)),t}Je(e){let t=this.Xe(e)!==null;return t||V("WatchChangeAggregator","Detected inactive target",e),t}Xe(e){let t=this.qe.get(e);return t&&t.De?null:this.ke.lt(e)}Ye(e){this.qe.set(e,new ko),this.ke.getRemoteKeysForTarget(e).forEach(t=>{this.ze(e,t,null)})}ut(e,t){return this.ke.getRemoteKeysForTarget(e).has(t)}};function fo(){return new le(j.comparator)}function Jm(){return new le(j.comparator)}var fS={asc:"ASCENDING",desc:"DESCENDING"},pS={"<":"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"},mS={and:"AND",or:"OR"},vc=class{constructor(e,t){this.databaseId=e,this.useProto3Json=t}};function wc(r,e){return r.useProto3Json||ra(e)?e:{value:e}}function Do(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 ry(r,e){return r.useProto3Json?e.toBase64():e.toUint8Array()}function gS(r,e){return Do(r,e.toTimestamp())}function nt(r){return ee(!!r),q.fromTimestamp(function(t){let n=xt(t);return new be(n.seconds,n.nanos)}(r))}function Ol(r,e){return bc(r,e).canonicalString()}function bc(r,e){let t=function(s){return new pe(["projects",s.projectId,"databases",s.database])}(r).child("documents");return e===void 0?t:t.child(e)}function ny(r){let e=pe.fromString(r);return ee(uy(e)),e}function Tc(r,e){return Ol(r.databaseId,e.path)}function ju(r,e){let t=ny(e);if(t.get(1)!==r.databaseId.projectId)throw new L(D.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 L(D.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+r.databaseId.database);return new j(iy(t))}function sy(r,e){return Ol(r.databaseId,e)}function yS(r){let e=ny(r);return e.length===4?pe.emptyPath():iy(e)}function Ec(r){return new pe(["projects",r.databaseId.projectId,"databases",r.databaseId.database]).canonicalString()}function iy(r){return ee(r.length>4&&r.get(4)==="documents"),r.popFirst(5)}function Ym(r,e,t){return{name:Tc(r,e),fields:t.value.mapValue.fields}}function _S(r,e){let t;if("targetChange"in e){e.targetChange;let n=function(h){return h==="NO_CHANGE"?0:h==="ADD"?1:h==="REMOVE"?2:h==="CURRENT"?3:h==="RESET"?4:F()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(h,f){return h.useProto3Json?(ee(f===void 0||typeof f=="string"),Pe.fromBase64String(f||"")):(ee(f===void 0||f instanceof Buffer||f instanceof Uint8Array),Pe.fromUint8Array(f||new Uint8Array))}(r,e.targetChange.resumeToken),a=e.targetChange.cause,u=a&&function(h){let f=h.code===void 0?D.UNKNOWN:ty(h.code);return new L(f,h.message||"")}(a);t=new Co(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=ju(r,n.document.name),i=nt(n.document.updateTime),a=n.document.createTime?nt(n.document.createTime):q.min(),u=new je({mapValue:{fields:n.document.fields}}),c=We.newFoundDocument(s,i,a,u),h=n.targetIds||[],f=n.removedTargetIds||[];t=new fn(h,f,c.key,c)}else if("documentDelete"in e){e.documentDelete;let n=e.documentDelete;n.document;let s=ju(r,n.document),i=n.readTime?nt(n.readTime):q.min(),a=We.newNoDocument(s,i),u=n.removedTargetIds||[];t=new fn([],u,a.key,a)}else if("documentRemove"in e){e.documentRemove;let n=e.documentRemove;n.document;let s=ju(r,n.document),i=n.removedTargetIds||[];t=new fn([],i,s,null)}else{if(!("filter"in e))return F();{e.filter;let n=e.filter;n.targetId;let{count:s=0,unchangedNames:i}=n,a=new gc(s,i),u=n.targetId;t=new Po(u,a)}}return t}function vS(r,e){let t;if(e instanceof wr)t={update:Ym(r,e.key,e.value)};else if(e instanceof So)t={delete:Tc(r,e.key)};else if(e instanceof at)t={update:Ym(r,e.key,e.data),updateMask:RS(e.fieldMask)};else{if(!(e instanceof dc))return F();t={verify:Tc(r,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(n=>function(i,a){let u=a.transform;if(u instanceof xn)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(u instanceof _r)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:u.elements}};if(u instanceof vr)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:u.elements}};if(u instanceof An)return{fieldPath:a.field.canonicalString(),increment:u.Ie};throw F()}(0,n))),e.precondition.isNone||(t.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:gS(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:F()}(r,e.precondition)),t}function wS(r,e){return r&&r.length>0?(ee(e!==void 0),r.map(t=>function(s,i){let a=s.updateTime?nt(s.updateTime):nt(i);return a.isEqual(q.min())&&(a=nt(i)),new hc(a,s.transformResults||[])}(t,e))):[]}function bS(r,e){return{documents:[sy(r,e.path)]}}function TS(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=sy(r,s);let i=function(h){if(h.length!==0)return ay(ot.create(h,"and"))}(e.filters);i&&(t.structuredQuery.where=i);let a=function(h){if(h.length!==0)return h.map(f=>function(g){return{field:ln(g.field),direction:xS(g.dir)}}(f))}(e.orderBy);a&&(t.structuredQuery.orderBy=a);let u=wc(r,e.limit);return u!==null&&(t.structuredQuery.limit=u),e.startAt&&(t.structuredQuery.startAt=function(h){return{before:h.inclusive,values:h.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(h){return{before:!h.inclusive,values:h.position}}(e.endAt)),{ht:t,parent:s}}function ES(r){let e=yS(r.parent),t=r.structuredQuery,n=t.from?t.from.length:0,s=null;if(n>0){ee(n===1);let f=t.from[0];f.allDescendants?s=f.collectionId:e=e.child(f.collectionId)}let i=[];t.where&&(i=function(m){let g=oy(m);return g instanceof ot&&jg(g)?g.getFilters():[g]}(t.where));let a=[];t.orderBy&&(a=function(m){return m.map(g=>function(P){return new Tn(hn(P.field),function(R){switch(R){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(P.direction))}(g))}(t.orderBy));let u=null;t.limit&&(u=function(m){let g;return g=typeof m=="object"?m.value:m,ra(g)?null:g}(t.limit));let c=null;t.startAt&&(c=function(m){let g=!!m.before,E=m.values||[];return new bn(E,g)}(t.startAt));let h=null;return t.endAt&&(h=function(m){let g=!m.before,E=m.values||[];return new bn(E,g)}(t.endAt)),WA(e,s,a,i,u,"F",c,h)}function IS(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 F()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function oy(r){return r.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":let n=hn(t.unaryFilter.field);return ye.create(n,"==",{doubleValue:NaN});case"IS_NULL":let s=hn(t.unaryFilter.field);return ye.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let i=hn(t.unaryFilter.field);return ye.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let a=hn(t.unaryFilter.field);return ye.create(a,"!=",{nullValue:"NULL_VALUE"});default:return F()}}(r):r.fieldFilter!==void 0?function(t){return ye.create(hn(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";default:return F()}}(t.fieldFilter.op),t.fieldFilter.value)}(r):r.compositeFilter!==void 0?function(t){return ot.create(t.compositeFilter.filters.map(n=>oy(n)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return F()}}(t.compositeFilter.op))}(r):F()}function xS(r){return fS[r]}function AS(r){return pS[r]}function SS(r){return mS[r]}function ln(r){return{fieldPath:r.canonicalString()}}function hn(r){return Ue.fromServerFormat(r.fieldPath)}function ay(r){return r instanceof ye?function(t){if(t.op==="=="){if(Fm(t.value))return{unaryFilter:{field:ln(t.field),op:"IS_NAN"}};if(Mm(t.value))return{unaryFilter:{field:ln(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(Fm(t.value))return{unaryFilter:{field:ln(t.field),op:"IS_NOT_NAN"}};if(Mm(t.value))return{unaryFilter:{field:ln(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:ln(t.field),op:AS(t.op),value:t.value}}}(r):r instanceof ot?function(t){let n=t.getFilters().map(s=>ay(s));return n.length===1?n[0]:{compositeFilter:{op:SS(t.op),filters:n}}}(r):F()}function RS(r){let e=[];return r.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function uy(r){return r.length>=4&&r.get(0)==="projects"&&r.get(2)==="databases"}var Os=class r{constructor(e,t,n,s,i=q.min(),a=q.min(),u=Pe.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,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 Ic=class{constructor(e){this.Tt=e}};function PS(r){let e=ES({parent:r.parent,structuredQuery:r.structuredQuery});return r.limitType==="LAST"?lc(e,e.limit,"L"):e}var Oo=class{constructor(){}At(e,t){this.Rt(e,t),t.Vt()}Rt(e,t){if("nullValue"in e)this.ft(t,5);else if("booleanValue"in e)this.ft(t,10),t.gt(e.booleanValue?1:0);else if("integerValue"in e)this.ft(t,15),t.gt(oe(e.integerValue));else if("doubleValue"in e){let n=oe(e.doubleValue);isNaN(n)?this.ft(t,13):(this.ft(t,15),Ps(n)?t.gt(0):t.gt(n))}else if("timestampValue"in e){let n=e.timestampValue;this.ft(t,20),typeof n=="string"&&(n=xt(n)),t.yt(`${n.seconds||""}`),t.gt(n.nanos||0)}else if("stringValue"in e)this.wt(e.stringValue,t),this.St(t);else if("bytesValue"in e)this.ft(t,30),t.bt(At(e.bytesValue)),this.St(t);else if("referenceValue"in e)this.Dt(e.referenceValue,t);else if("geoPointValue"in e){let n=e.geoPointValue;this.ft(t,45),t.gt(n.latitude||0),t.gt(n.longitude||0)}else"mapValue"in e?Lg(e)?this.ft(t,Number.MAX_SAFE_INTEGER):Vg(e)?this.vt(e.mapValue,t):(this.Ct(e.mapValue,t),this.St(t)):"arrayValue"in e?(this.Ft(e.arrayValue,t),this.St(t)):F()}wt(e,t){this.ft(t,25),this.Mt(e,t)}Mt(e,t){t.yt(e)}Ct(e,t){let n=e.fields||{};this.ft(t,55);for(let s of Object.keys(n))this.wt(s,t),this.Rt(n[s],t)}vt(e,t){var n,s;let i=e.fields||{};this.ft(t,53);let a=_n,u=((s=(n=i[a].arrayValue)===null||n===void 0?void 0:n.values)===null||s===void 0?void 0:s.length)||0;this.ft(t,15),t.gt(oe(u)),this.wt(a,t),this.Rt(i[a],t)}Ft(e,t){let n=e.values||[];this.ft(t,50);for(let s of n)this.Rt(s,t)}Dt(e,t){this.ft(t,37),j.fromName(e).path.forEach(n=>{this.ft(t,60),this.Mt(n,t)})}ft(e,t){e.gt(t)}St(e){e.gt(2)}};Oo.xt=new Oo;var xc=class{constructor(){this.Tn=new Ac}addToCollectionParentIndex(e,t){return this.Tn.add(t),k.resolve()}getCollectionParents(e,t){return k.resolve(this.Tn.getEntries(t))}addFieldIndex(e,t){return k.resolve()}deleteFieldIndex(e,t){return k.resolve()}deleteAllFieldIndexes(e){return k.resolve()}createTargetIndexes(e,t){return k.resolve()}getDocumentsMatchingTarget(e,t){return k.resolve(null)}getIndexType(e,t){return k.resolve(0)}getFieldIndexes(e,t){return k.resolve([])}getNextCollectionGroupToUpdate(e){return k.resolve(null)}getMinOffset(e,t){return k.resolve(yr.min())}getMinOffsetFromCollectionGroup(e,t){return k.resolve(yr.min())}updateCollectionGroup(e,t,n){return k.resolve()}updateIndexEntries(e,t){return k.resolve()}},Ac=class{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),s=this.index[t]||new ve(pe.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 ve(pe.comparator)).toArray()}};var mF=new Uint8Array(0);var Xm={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},cy=41943040,$e=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}};$e.DEFAULT_COLLECTION_PERCENTILE=10,$e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,$e.DEFAULT=new $e(cy,$e.DEFAULT_COLLECTION_PERCENTILE,$e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),$e.DISABLED=new $e(-1,0,0);var Ns=class r{constructor(e){this.$n=e}next(){return this.$n+=2,this.$n}static Kn(){return new r(0)}static Un(){return new r(-1)}};var Zm="LruGarbageCollector",CS=1048576;function eg([r,e],[t,n]){let s=Q(r,t);return s===0?Q(e,n):s}var Sc=class{constructor(e){this.Hn=e,this.buffer=new ve(eg),this.Jn=0}Yn(){return++this.Jn}Zn(e){let t=[e,this.Yn()];if(this.buffer.size<this.Hn)this.buffer=this.buffer.add(t);else{let n=this.buffer.last();eg(t,n)<0&&(this.buffer=this.buffer.delete(n).add(t))}}get maxValue(){return this.buffer.last()[0]}},Rc=class{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.Xn=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.er(6e4)}stop(){this.Xn&&(this.Xn.cancel(),this.Xn=null)}get started(){return this.Xn!==null}er(e){V(Zm,`Garbage collection scheduled in ${e}ms`),this.Xn=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Xn=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){On(t)?V(Zm,"Ignoring IndexedDB error during garbage collection: ",t):await Dn(t)}await this.er(3e5)})}},Pc=class{constructor(e,t){this.tr=e,this.params=t}calculateTargetCount(e,t){return this.tr.nr(e).next(n=>Math.floor(t/100*n))}nthSequenceNumber(e,t){if(t===0)return k.resolve(yn.ae);let n=new Sc(t);return this.tr.forEachTarget(e,s=>n.Zn(s.sequenceNumber)).next(()=>this.tr.rr(e,s=>n.Zn(s))).next(()=>n.maxValue)}removeTargets(e,t,n){return this.tr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.tr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(V("LruGarbageCollector","Garbage collection skipped; disabled"),k.resolve(Xm)):this.getCacheSize(e).next(n=>n<this.params.cacheSizeCollectionThreshold?(V("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Xm):this.ir(e,t))}getCacheSize(e){return this.tr.getCacheSize(e)}ir(e,t){let n,s,i,a,u,c,h,f=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(m=>(m>this.params.maximumSequenceNumbersToCollect?(V("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${m}`),s=this.params.maximumSequenceNumbersToCollect):s=m,a=Date.now(),this.nthSequenceNumber(e,s))).next(m=>(n=m,u=Date.now(),this.removeTargets(e,n,t))).next(m=>(i=m,c=Date.now(),this.removeOrphanedDocuments(e,n))).next(m=>(h=Date.now(),un()<=W.DEBUG&&V("LruGarbageCollector",`LRU Garbage Collection
|
|
12
|
+
}`}};Yc=class{constructor(e,t){this.count=e,this.unchangedNames=t}};(Y=pe||(pe={}))[Y.OK=0]="OK",Y[Y.CANCELLED=1]="CANCELLED",Y[Y.UNKNOWN=2]="UNKNOWN",Y[Y.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Y[Y.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Y[Y.NOT_FOUND=5]="NOT_FOUND",Y[Y.ALREADY_EXISTS=6]="ALREADY_EXISTS",Y[Y.PERMISSION_DENIED=7]="PERMISSION_DENIED",Y[Y.UNAUTHENTICATED=16]="UNAUTHENTICATED",Y[Y.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Y[Y.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Y[Y.ABORTED=10]="ABORTED",Y[Y.OUT_OF_RANGE=11]="OUT_OF_RANGE",Y[Y.UNIMPLEMENTED=12]="UNIMPLEMENTED",Y[Y.INTERNAL=13]="INTERNAL",Y[Y.UNAVAILABLE=14]="UNAVAILABLE",Y[Y.DATA_LOSS=15]="DATA_LOSS";Ww=null;Zk=new Dt([4294967295,4294967295],0);Xc=class r{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new Cr(`Invalid padding: ${t}`);if(n<0)throw new Cr(`Invalid hash count: ${n}`);if(e.length>0&&this.hashCount===0)throw new Cr(`Invalid hash count: ${n}`);if(e.length===0&&t!==0)throw new Cr(`Invalid padding when bitmap length is 0: ${t}`);this.Ee=8*e.length-t,this.de=Dt.fromNumber(this.Ee)}Ae(e,t,n){let i=e.add(t.multiply(Dt.fromNumber(n)));return i.compare(Zk)===1&&(i=new Dt([i.getBits(0),i.getBits(1)],0)),i.modulo(this.de).toNumber()}Re(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.Ee===0)return!1;let t=Qw(e),[n,i]=Jw(t);for(let s=0;s<this.hashCount;s++){let a=this.Ae(n,i,s);if(!this.Re(a))return!1}return!0}static create(e,t,n){let i=e%8==0?0:8-e%8,s=new Uint8Array(Math.ceil(e/8)),a=new r(s,i,t);return n.forEach(l=>a.insert(l)),a}insert(e){if(this.Ee===0)return;let t=Qw(e),[n,i]=Jw(t);for(let s=0;s<this.hashCount;s++){let a=this.Ae(n,i,s);this.Ve(a)}}Ve(e){let t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}},Cr=class extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}};ka=class r{constructor(e,t,n,i,s){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=i,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,t,n){let i=new Map;return i.set(e,ps.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new r(z.min(),i,new de(J),Ft(),W())}},ps=class r{constructor(e,t,n,i,s){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=i,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new r(n,t,W(),W(),W())}};Nn=class{constructor(e,t,n,i){this.me=e,this.removedTargetIds=t,this.key=n,this.fe=i}},Da=class{constructor(e,t){this.targetId=e,this.ge=t}},Oa=class{constructor(e,t,n=De.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=i}},Na=class{constructor(){this.pe=0,this.ye=Yw(),this.we=De.EMPTY_BYTE_STRING,this.Se=!1,this.be=!0}get current(){return this.Se}get resumeToken(){return this.we}get De(){return this.pe!==0}get ve(){return this.be}Ce(e){e.approximateByteSize()>0&&(this.be=!0,this.we=e)}Fe(){let e=W(),t=W(),n=W();return this.ye.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:n=n.add(i);break;default:j()}}),new ps(this.we,this.Se,e,t,n)}Me(){this.be=!1,this.ye=Yw()}xe(e,t){this.be=!0,this.ye=this.ye.insert(e,t)}Oe(e){this.be=!0,this.ye=this.ye.remove(e)}Ne(){this.pe+=1}Be(){this.pe-=1,re(this.pe>=0)}Le(){this.be=!0,this.Se=!0}},Zc=class{constructor(e){this.ke=e,this.qe=new Map,this.Qe=Ft(),this.$e=ga(),this.Ke=ga(),this.Ue=new de(J)}We(e){for(let t of e.me)e.fe&&e.fe.isFoundDocument()?this.Ge(t,e.fe):this.ze(t,e.key,e.fe);for(let t of e.removedTargetIds)this.ze(t,e.key,e.fe)}je(e){this.forEachTarget(e,t=>{let n=this.He(t);switch(e.state){case 0:this.Je(t)&&n.Ce(e.resumeToken);break;case 1:n.Be(),n.De||n.Me(),n.Ce(e.resumeToken);break;case 2:n.Be(),n.De||this.removeTarget(t);break;case 3:this.Je(t)&&(n.Le(),n.Ce(e.resumeToken));break;case 4:this.Je(t)&&(this.Ye(t),n.Ce(e.resumeToken));break;default:j()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.qe.forEach((n,i)=>{this.Je(i)&&t(i)})}Ze(e){let t=e.targetId,n=e.ge.count,i=this.Xe(t);if(i){let s=i.target;if(zc(s))if(n===0){let a=new U(s.path);this.ze(t,a,it.newNoDocument(a,z.min()))}else re(n===1);else{let a=this.et(t);if(a!==n){let l=this.tt(e),u=l?this.nt(l,e,a):1;if(u!==0){this.Ye(t);let h=u===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ue=this.Ue.insert(t,h)}Ww==null||Ww.rt(function(f,m,g,I,C){var k,P,V,F,B,K;let X={localCacheCount:f,existenceFilterCount:m.count,databaseId:g.database,projectId:g.projectId},$=m.unchangedNames;return $&&(X.bloomFilter={applied:C===0,hashCount:(k=$==null?void 0:$.hashCount)!==null&&k!==void 0?k:0,bitmapLength:(F=(V=(P=$==null?void 0:$.bits)===null||P===void 0?void 0:P.bitmap)===null||V===void 0?void 0:V.length)!==null&&F!==void 0?F:0,padding:(K=(B=$==null?void 0:$.bits)===null||B===void 0?void 0:B.padding)!==null&&K!==void 0?K:0,mightContain:E=>{var y;return(y=I==null?void 0:I.mightContain(E))!==null&&y!==void 0&&y}}),X}(a,e.ge,this.ke.it(),l,u))}}}}tt(e){let t=e.ge.unchangedNames;if(!t||!t.bits)return null;let{bits:{bitmap:n="",padding:i=0},hashCount:s=0}=t,a,l;try{a=Lt(n).toUint8Array()}catch(u){if(u instanceof xa)return Ln("Decoding the base64 bloom filter in existence filter failed ("+u.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw u}try{l=new Xc(a,i,s)}catch(u){return Ln(u instanceof Cr?"BloomFilter error: ":"Applying bloom filter failed: ",u),null}return l.Ee===0?null:l}nt(e,t,n){return t.ge.count===n-this.st(e,t.targetId)?0:2}st(e,t){let n=this.ke.getRemoteKeysForTarget(t),i=0;return n.forEach(s=>{let a=this.ke.it(),l=`projects/${a.projectId}/databases/${a.database}/documents/${s.path.canonicalString()}`;e.mightContain(l)||(this.ze(t,s,null),i++)}),i}ot(e){let t=new Map;this.qe.forEach((s,a)=>{let l=this.Xe(a);if(l){if(s.current&&zc(l.target)){let u=new U(l.target.path);this._t(u).has(a)||this.ut(a,u)||this.ze(a,u,it.newNoDocument(u,e))}s.ve&&(t.set(a,s.Fe()),s.Me())}});let n=W();this.Ke.forEach((s,a)=>{let l=!0;a.forEachWhile(u=>{let h=this.Xe(u);return!h||h.purpose==="TargetPurposeLimboResolution"||(l=!1,!1)}),l&&(n=n.add(s))}),this.Qe.forEach((s,a)=>a.setReadTime(e));let i=new ka(e,t,this.Ue,this.Qe,n);return this.Qe=Ft(),this.$e=ga(),this.Ke=ga(),this.Ue=new de(J),i}Ge(e,t){if(!this.Je(e))return;let n=this.ut(e,t.key)?2:0;this.He(e).xe(t.key,n),this.Qe=this.Qe.insert(t.key,t),this.$e=this.$e.insert(t.key,this._t(t.key).add(e)),this.Ke=this.Ke.insert(t.key,this.ct(t.key).add(e))}ze(e,t,n){if(!this.Je(e))return;let i=this.He(e);this.ut(e,t)?i.xe(t,1):i.Oe(t),this.Ke=this.Ke.insert(t,this.ct(t).delete(e)),this.Ke=this.Ke.insert(t,this.ct(t).add(e)),n&&(this.Qe=this.Qe.insert(t,n))}removeTarget(e){this.qe.delete(e)}et(e){let t=this.He(e).Fe();return this.ke.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Ne(e){this.He(e).Ne()}He(e){let t=this.qe.get(e);return t||(t=new Na,this.qe.set(e,t)),t}ct(e){let t=this.Ke.get(e);return t||(t=new be(J),this.Ke=this.Ke.insert(e,t)),t}_t(e){let t=this.$e.get(e);return t||(t=new be(J),this.$e=this.$e.insert(e,t)),t}Je(e){let t=this.Xe(e)!==null;return t||L("WatchChangeAggregator","Detected inactive target",e),t}Xe(e){let t=this.qe.get(e);return t&&t.De?null:this.ke.lt(e)}Ye(e){this.qe.set(e,new Na),this.ke.getRemoteKeysForTarget(e).forEach(t=>{this.ze(e,t,null)})}ut(e,t){return this.ke.getRemoteKeysForTarget(e).has(t)}};eD={asc:"ASCENDING",desc:"DESCENDING"},tD={"<":"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"},rD={and:"AND",or:"OR"},eh=class{constructor(e,t){this.databaseId=e,this.useProto3Json=t}};ms=class r{constructor(e,t,n,i,s=z.min(),a=z.min(),l=De.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=l,this.expectedCount=u}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)}};sh=class{constructor(e){this.Tt=e}};La=class{constructor(){}At(e,t){this.Rt(e,t),t.Vt()}Rt(e,t){if("nullValue"in e)this.ft(t,5);else if("booleanValue"in e)this.ft(t,10),t.gt(e.booleanValue?1:0);else if("integerValue"in e)this.ft(t,15),t.gt(ue(e.integerValue));else if("doubleValue"in e){let n=ue(e.doubleValue);isNaN(n)?this.ft(t,13):(this.ft(t,15),hs(n)?t.gt(0):t.gt(n))}else if("timestampValue"in e){let n=e.timestampValue;this.ft(t,20),typeof n=="string"&&(n=Vt(n)),t.yt(`${n.seconds||""}`),t.gt(n.nanos||0)}else if("stringValue"in e)this.wt(e.stringValue,t),this.St(t);else if("bytesValue"in e)this.ft(t,30),t.bt(Lt(e.bytesValue)),this.St(t);else if("referenceValue"in e)this.Dt(e.referenceValue,t);else if("geoPointValue"in e){let n=e.geoPointValue;this.ft(t,45),t.gt(n.latitude||0),t.gt(n.longitude||0)}else"mapValue"in e?Mv(e)?this.ft(t,Number.MAX_SAFE_INTEGER):Lv(e)?this.vt(e.mapValue,t):(this.Ct(e.mapValue,t),this.St(t)):"arrayValue"in e?(this.Ft(e.arrayValue,t),this.St(t)):j()}wt(e,t){this.ft(t,25),this.Mt(e,t)}Mt(e,t){t.yt(e)}Ct(e,t){let n=e.fields||{};this.ft(t,55);for(let i of Object.keys(n))this.wt(i,t),this.Rt(n[i],t)}vt(e,t){var n,i;let s=e.fields||{};this.ft(t,53);let a=jn,l=((i=(n=s[a].arrayValue)===null||n===void 0?void 0:n.values)===null||i===void 0?void 0:i.length)||0;this.ft(t,15),t.gt(ue(l)),this.wt(a,t),this.Rt(s[a],t)}Ft(e,t){let n=e.values||[];this.ft(t,50);for(let i of n)this.Rt(i,t)}Dt(e,t){this.ft(t,37),U.fromName(e).path.forEach(n=>{this.ft(t,60),this.Mt(n,t)})}ft(e,t){e.gt(t)}St(e){e.gt(2)}};La.xt=new La;oh=class{constructor(){this.Tn=new ah}addToCollectionParentIndex(e,t){return this.Tn.add(t),D.resolve()}getCollectionParents(e,t){return D.resolve(this.Tn.getEntries(t))}addFieldIndex(e,t){return D.resolve()}deleteFieldIndex(e,t){return D.resolve()}deleteAllFieldIndexes(e){return D.resolve()}createTargetIndexes(e,t){return D.resolve()}getDocumentsMatchingTarget(e,t){return D.resolve(null)}getIndexType(e,t){return D.resolve(0)}getFieldIndexes(e,t){return D.resolve([])}getNextCollectionGroupToUpdate(e){return D.resolve(null)}getMinOffset(e,t){return D.resolve(Or.min())}getMinOffsetFromCollectionGroup(e,t){return D.resolve(Or.min())}updateCollectionGroup(e,t,n){return D.resolve()}updateIndexEntries(e,t){return D.resolve()}},ah=class{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),i=this.index[t]||new be(ge.comparator),s=!i.has(n);return this.index[t]=i.add(n),s}has(e){let t=e.lastSegment(),n=e.popLast(),i=this.index[t];return i&&i.has(n)}getEntries(e){return(this.index[e]||new be(ge.comparator)).toArray()}};y$=new Uint8Array(0);Zw={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},cb=41943040,Ye=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}};Ye.DEFAULT_COLLECTION_PERCENTILE=10,Ye.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Ye.DEFAULT=new Ye(cb,Ye.DEFAULT_COLLECTION_PERCENTILE,Ye.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Ye.DISABLED=new Ye(-1,0,0);gs=class r{constructor(e){this.$n=e}next(){return this.$n+=2,this.$n}static Kn(){return new r(0)}static Un(){return new r(-1)}};ev="LruGarbageCollector",yD=1048576;lh=class{constructor(e){this.Hn=e,this.buffer=new be(tv),this.Jn=0}Yn(){return++this.Jn}Zn(e){let t=[e,this.Yn()];if(this.buffer.size<this.Hn)this.buffer=this.buffer.add(t);else{let n=this.buffer.last();tv(t,n)<0&&(this.buffer=this.buffer.delete(n).add(t))}}get maxValue(){return this.buffer.last()[0]}},uh=class{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.Xn=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.er(6e4)}stop(){this.Xn&&(this.Xn.cancel(),this.Xn=null)}get started(){return this.Xn!==null}er(e){L(ev,`Garbage collection scheduled in ${e}ms`),this.Xn=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Xn=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){ei(t)?L(ev,"Ignoring IndexedDB error during garbage collection: ",t):await Zn(t)}await this.er(3e5)})}},ch=class{constructor(e,t){this.tr=e,this.params=t}calculateTargetCount(e,t){return this.tr.nr(e).next(n=>Math.floor(t/100*n))}nthSequenceNumber(e,t){if(t===0)return D.resolve(Fn.ae);let n=new lh(t);return this.tr.forEachTarget(e,i=>n.Zn(i.sequenceNumber)).next(()=>this.tr.rr(e,i=>n.Zn(i))).next(()=>n.maxValue)}removeTargets(e,t,n){return this.tr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.tr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(L("LruGarbageCollector","Garbage collection skipped; disabled"),D.resolve(Zw)):this.getCacheSize(e).next(n=>n<this.params.cacheSizeCollectionThreshold?(L("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Zw):this.ir(e,t))}getCacheSize(e){return this.tr.getCacheSize(e)}ir(e,t){let n,i,s,a,l,u,h,f=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(m=>(m>this.params.maximumSequenceNumbersToCollect?(L("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${m}`),i=this.params.maximumSequenceNumbersToCollect):i=m,a=Date.now(),this.nthSequenceNumber(e,i))).next(m=>(n=m,l=Date.now(),this.removeTargets(e,n,t))).next(m=>(s=m,u=Date.now(),this.removeOrphanedDocuments(e,n))).next(m=>(h=Date.now(),Pn()<=Q.DEBUG&&L("LruGarbageCollector",`LRU Garbage Collection
|
|
13
13
|
Counted targets in ${a-f}ms
|
|
14
|
-
Determined least recently used ${
|
|
15
|
-
Removed ${
|
|
16
|
-
Removed ${m} documents in `+(h-
|
|
17
|
-
Total Duration: ${h-f}ms`),k.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:m})))}};function kS(r,e){return new Pc(r,e)}var Cc=class{constructor(){this.changes=new St(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,We.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return n!==void 0?k.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 kc=class{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}};var Dc=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&&Ss(n.mutation,s,qe.empty(),be.now()),s))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(n=>this.getLocalViewOfDocuments(e,n,H()).next(()=>n))}getLocalViewOfDocuments(e,t,n=H()){let s=fr();return this.populateOverlays(e,s,t).next(()=>this.computeViews(e,t,s,n).next(i=>{let a=Es();return i.forEach((u,c)=>{a=a.insert(u,c.overlayedDocument)}),a}))}getOverlayedDocuments(e,t){let n=fr();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,H()))}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((a,u)=>{t.set(a,u)})})}computeViews(e,t,n,s){let i=Rt(),a=As(),u=function(){return As()}();return t.forEach((c,h)=>{let f=n.get(h.key);s.has(h.key)&&(f===void 0||f.mutation instanceof at)?i=i.insert(h.key,h):f!==void 0?(a.set(h.key,f.mutation.getFieldMask()),Ss(f.mutation,h,f.mutation.getFieldMask(),be.now())):a.set(h.key,qe.empty())}),this.recalculateAndSaveOverlays(e,i).next(c=>(c.forEach((h,f)=>a.set(h,f)),t.forEach((h,f)=>{var m;return u.set(h,new kc(f,(m=a.get(h))!==null&&m!==void 0?m:null))}),u))}recalculateAndSaveOverlays(e,t){let n=As(),s=new le((a,u)=>a-u),i=H();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(a=>{for(let u of a)u.keys().forEach(c=>{let h=t.get(c);if(h===null)return;let f=n.get(c)||qe.empty();f=u.applyToLocalView(h,f),n.set(c,f);let m=(s.get(u.batchId)||H()).add(c);s=s.insert(u.batchId,m)})}).next(()=>{let a=[],u=s.getReverseIterator();for(;u.hasNext();){let c=u.getNext(),h=c.key,f=c.value,m=Hg();f.forEach(g=>{if(!i.has(g)){let E=Zg(t.get(g),n.get(g));E!==null&&m.set(g,E),i=i.add(g)}}),a.push(this.documentOverlayCache.saveOverlays(e,h,m))}return k.waitFor(a)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(n=>this.recalculateAndSaveOverlays(e,n))}getDocumentsMatchingQuery(e,t,n,s){return function(a){return j.isDocumentKey(a.path)&&a.collectionGroup===null&&a.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):QA(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 a=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,s-i.size):k.resolve(fr()),u=Rs,c=i;return a.next(h=>k.forEach(h,(f,m)=>(u<m.largestBatchId&&(u=m.largestBatchId),i.get(f)?k.resolve():this.remoteDocumentCache.getEntry(e,f).next(g=>{c=c.insert(f,g)}))).next(()=>this.populateOverlays(e,h,i)).next(()=>this.computeViews(e,c,h,H())).next(f=>({batchId:u,changes:Kg(f)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new j(t)).next(n=>{let s=Es();return n.isFoundDocument()&&(s=s.insert(n.key,n)),s})}getDocumentsMatchingCollectionGroupQuery(e,t,n,s){let i=t.collectionGroup,a=Es();return this.indexManager.getCollectionParents(e,i).next(u=>k.forEach(u,c=>{let h=function(m,g){return new En(g,null,m.explicitOrderBy.slice(),m.filters.slice(),m.limit,m.limitType,m.startAt,m.endAt)}(t,c.child(i));return this.getDocumentsMatchingCollectionQuery(e,h,n,s).next(f=>{f.forEach((m,g)=>{a=a.insert(m,g)})})}).next(()=>a))}getDocumentsMatchingCollectionQuery(e,t,n,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,s))).next(a=>{i.forEach((c,h)=>{let f=h.getKey();a.get(f)===null&&(a=a.insert(f,We.newInvalidDocument(f)))});let u=Es();return a.forEach((c,h)=>{let f=i.get(c);f!==void 0&&Ss(f.mutation,h,qe.empty(),be.now()),oa(t,h)&&(u=u.insert(c,h))}),u})}};var Oc=class{constructor(e){this.serializer=e,this.dr=new Map,this.Ar=new Map}getBundleMetadata(e,t){return k.resolve(this.dr.get(t))}saveBundleMetadata(e,t){return this.dr.set(t.id,function(s){return{id:s.id,version:s.version,createTime:nt(s.createTime)}}(t)),k.resolve()}getNamedQuery(e,t){return k.resolve(this.Ar.get(t))}saveNamedQuery(e,t){return this.Ar.set(t.name,function(s){return{name:s.name,query:PS(s.bundledQuery),readTime:nt(s.readTime)}}(t)),k.resolve()}};var Nc=class{constructor(){this.overlays=new le(j.comparator),this.Rr=new Map}getOverlay(e,t){return k.resolve(this.overlays.get(t))}getOverlays(e,t){let n=fr();return k.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.Et(e,t,i)}),k.resolve()}removeOverlaysForBatchId(e,t,n){let s=this.Rr.get(n);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Rr.delete(n)),k.resolve()}getOverlaysForCollection(e,t,n){let s=fr(),i=t.length+1,a=new j(t.child("")),u=this.overlays.getIteratorFrom(a);for(;u.hasNext();){let c=u.getNext().value,h=c.getKey();if(!t.isPrefixOf(h.path))break;h.path.length===i&&c.largestBatchId>n&&s.set(c.getKey(),c)}return k.resolve(s)}getOverlaysForCollectionGroup(e,t,n,s){let i=new le((h,f)=>h-f),a=this.overlays.getIterator();for(;a.hasNext();){let h=a.getNext().value;if(h.getKey().getCollectionGroup()===t&&h.largestBatchId>n){let f=i.get(h.largestBatchId);f===null&&(f=fr(),i=i.insert(h.largestBatchId,f)),f.set(h.getKey(),h)}}let u=fr(),c=i.getIterator();for(;c.hasNext()&&(c.getNext().value.forEach((h,f)=>u.set(h,f)),!(u.size()>=s)););return k.resolve(u)}Et(e,t,n){let s=this.overlays.get(n.key);if(s!==null){let a=this.Rr.get(s.largestBatchId).delete(n.key);this.Rr.set(s.largestBatchId,a)}this.overlays=this.overlays.insert(n.key,new mc(t,n));let i=this.Rr.get(t);i===void 0&&(i=H(),this.Rr.set(t,i)),this.Rr.set(t,i.add(n.key))}};var Vc=class{constructor(){this.sessionToken=Pe.EMPTY_BYTE_STRING}getSessionToken(e){return k.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,k.resolve()}};var Vs=class{constructor(){this.Vr=new ve(fe.mr),this.gr=new ve(fe.pr)}isEmpty(){return this.Vr.isEmpty()}addReference(e,t){let n=new fe(e,t);this.Vr=this.Vr.add(n),this.gr=this.gr.add(n)}yr(e,t){e.forEach(n=>this.addReference(n,t))}removeReference(e,t){this.wr(new fe(e,t))}Sr(e,t){e.forEach(n=>this.removeReference(n,t))}br(e){let t=new j(new pe([])),n=new fe(t,e),s=new fe(t,e+1),i=[];return this.gr.forEachInRange([n,s],a=>{this.wr(a),i.push(a.key)}),i}Dr(){this.Vr.forEach(e=>this.wr(e))}wr(e){this.Vr=this.Vr.delete(e),this.gr=this.gr.delete(e)}vr(e){let t=new j(new pe([])),n=new fe(t,e),s=new fe(t,e+1),i=H();return this.gr.forEachInRange([n,s],a=>{i=i.add(a.key)}),i}containsKey(e){let t=new fe(e,0),n=this.Vr.firstAfterOrEqual(t);return n!==null&&e.isEqual(n.key)}},fe=class{constructor(e,t){this.key=e,this.Cr=t}static mr(e,t){return j.comparator(e.key,t.key)||Q(e.Cr,t.Cr)}static pr(e,t){return Q(e.Cr,t.Cr)||j.comparator(e.key,t.key)}};var Lc=class{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Fr=1,this.Mr=new ve(fe.mr)}checkEmpty(e){return k.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,n,s){let i=this.Fr;this.Fr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let a=new fc(i,t,n,s);this.mutationQueue.push(a);for(let u of s)this.Mr=this.Mr.add(new fe(u.key,i)),this.indexManager.addToCollectionParentIndex(e,u.key.path.popLast());return k.resolve(a)}lookupMutationBatch(e,t){return k.resolve(this.Or(t))}getNextMutationBatchAfterBatchId(e,t){let n=t+1,s=this.Nr(n),i=s<0?0:s;return k.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return k.resolve(this.mutationQueue.length===0?xl:this.Fr-1)}getAllMutationBatches(e){return k.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new fe(t,0),s=new fe(t,Number.POSITIVE_INFINITY),i=[];return this.Mr.forEachInRange([n,s],a=>{let u=this.Or(a.Cr);i.push(u)}),k.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new ve(Q);return t.forEach(s=>{let i=new fe(s,0),a=new fe(s,Number.POSITIVE_INFINITY);this.Mr.forEachInRange([i,a],u=>{n=n.add(u.Cr)})}),k.resolve(this.Br(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,s=n.length+1,i=n;j.isDocumentKey(i)||(i=i.child(""));let a=new fe(new j(i),0),u=new ve(Q);return this.Mr.forEachWhile(c=>{let h=c.key.path;return!!n.isPrefixOf(h)&&(h.length===s&&(u=u.add(c.Cr)),!0)},a),k.resolve(this.Br(u))}Br(e){let t=[];return e.forEach(n=>{let s=this.Or(n);s!==null&&t.push(s)}),t}removeMutationBatch(e,t){ee(this.Lr(t.batchId,"removed")===0),this.mutationQueue.shift();let n=this.Mr;return k.forEach(t.mutations,s=>{let i=new fe(s.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.Mr=n})}qn(e){}containsKey(e,t){let n=new fe(t,0),s=this.Mr.firstAfterOrEqual(n);return k.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,k.resolve()}Lr(e,t){return this.Nr(e)}Nr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Or(e){let t=this.Nr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}};var Mc=class{constructor(e){this.kr=e,this.docs=function(){return new le(j.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,a=this.kr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:a}),this.size+=a-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 k.resolve(n?n.document.mutableCopy():We.newInvalidDocument(t))}getEntries(e,t){let n=Rt();return t.forEach(s=>{let i=this.docs.get(s);n=n.insert(s,i?i.document.mutableCopy():We.newInvalidDocument(s))}),k.resolve(n)}getDocumentsMatchingQuery(e,t,n,s){let i=Rt(),a=t.path,u=new j(a.child("__id-9223372036854775808__")),c=this.docs.getIteratorFrom(u);for(;c.hasNext();){let{key:h,value:{document:f}}=c.getNext();if(!a.isPrefixOf(h.path))break;h.path.length>a.length+1||PA(RA(f),n)<=0||(s.has(f.key)||oa(t,f))&&(i=i.insert(f.key,f.mutableCopy()))}return k.resolve(i)}getAllFromCollectionGroup(e,t,n,s){F()}qr(e,t){return k.forEach(this.docs,n=>t(n))}newChangeBuffer(e){return new Fc(this)}getSize(e){return k.resolve(this.size)}},Fc=class extends Cc{constructor(e){super(),this.Ir=e}applyChanges(e){let t=[];return this.changes.forEach((n,s)=>{s.isValidDocument()?t.push(this.Ir.addEntry(e,s)):this.Ir.removeEntry(n)}),k.waitFor(t)}getFromCache(e,t){return this.Ir.getEntry(e,t)}getAllFromCache(e,t){return this.Ir.getEntries(e,t)}};var jc=class{constructor(e){this.persistence=e,this.Qr=new St(t=>Cl(t),kl),this.lastRemoteSnapshotVersion=q.min(),this.highestTargetId=0,this.$r=0,this.Kr=new Vs,this.targetCount=0,this.Ur=Ns.Kn()}forEachTarget(e,t){return this.Qr.forEach((n,s)=>t(s)),k.resolve()}getLastRemoteSnapshotVersion(e){return k.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return k.resolve(this.$r)}allocateTargetId(e){return this.highestTargetId=this.Ur.next(),k.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.$r&&(this.$r=t),k.resolve()}zn(e){this.Qr.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.Ur=new Ns(t),this.highestTargetId=t),e.sequenceNumber>this.$r&&(this.$r=e.sequenceNumber)}addTargetData(e,t){return this.zn(t),this.targetCount+=1,k.resolve()}updateTargetData(e,t){return this.zn(t),k.resolve()}removeTargetData(e,t){return this.Qr.delete(t.target),this.Kr.br(t.targetId),this.targetCount-=1,k.resolve()}removeTargets(e,t,n){let s=0,i=[];return this.Qr.forEach((a,u)=>{u.sequenceNumber<=t&&n.get(u.targetId)===null&&(this.Qr.delete(a),i.push(this.removeMatchingKeysForTargetId(e,u.targetId)),s++)}),k.waitFor(i).next(()=>s)}getTargetCount(e){return k.resolve(this.targetCount)}getTargetData(e,t){let n=this.Qr.get(t)||null;return k.resolve(n)}addMatchingKeys(e,t,n){return this.Kr.yr(t,n),k.resolve()}removeMatchingKeys(e,t,n){this.Kr.Sr(t,n);let s=this.persistence.referenceDelegate,i=[];return s&&t.forEach(a=>{i.push(s.markPotentiallyOrphaned(e,a))}),k.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.Kr.br(t),k.resolve()}getMatchingKeysForTargetId(e,t){let n=this.Kr.vr(t);return k.resolve(n)}containsKey(e,t){return k.resolve(this.Kr.containsKey(t))}};var No=class{constructor(e,t){this.Wr={},this.overlays={},this.Gr=new yn(0),this.zr=!1,this.zr=!0,this.jr=new Vc,this.referenceDelegate=e(this),this.Hr=new jc(this),this.indexManager=new xc,this.remoteDocumentCache=function(s){return new Mc(s)}(n=>this.referenceDelegate.Jr(n)),this.serializer=new Ic(t),this.Yr=new Oc(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.zr=!1,Promise.resolve()}get started(){return this.zr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Nc,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.Wr[e.toKey()];return n||(n=new Lc(t,this.referenceDelegate),this.Wr[e.toKey()]=n),n}getGlobalsCache(){return this.jr}getTargetCache(){return this.Hr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Yr}runTransaction(e,t,n){V("MemoryPersistence","Starting transaction:",e);let s=new Uc(this.Gr.next());return this.referenceDelegate.Zr(),n(s).next(i=>this.referenceDelegate.Xr(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}ei(e,t){return k.or(Object.values(this.Wr).map(n=>()=>n.containsKey(e,t)))}},Uc=class extends Ju{constructor(e){super(),this.currentSequenceNumber=e}},Bc=class r{constructor(e){this.persistence=e,this.ti=new Vs,this.ni=null}static ri(e){return new r(e)}get ii(){if(this.ni)return this.ni;throw F()}addReference(e,t,n){return this.ti.addReference(n,t),this.ii.delete(n.toString()),k.resolve()}removeReference(e,t,n){return this.ti.removeReference(n,t),this.ii.add(n.toString()),k.resolve()}markPotentiallyOrphaned(e,t){return this.ii.add(t.toString()),k.resolve()}removeTarget(e,t){this.ti.br(t.targetId).forEach(s=>this.ii.add(s.toString()));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(s=>{s.forEach(i=>this.ii.add(i.toString()))}).next(()=>n.removeTargetData(e,t))}Zr(){this.ni=new Set}Xr(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return k.forEach(this.ii,n=>{let s=j.fromPath(n);return this.si(e,s).next(i=>{i||t.removeEntry(s,q.min())})}).next(()=>(this.ni=null,t.apply(e)))}updateLimboDocument(e,t){return this.si(e,t).next(n=>{n?this.ii.delete(t.toString()):this.ii.add(t.toString())})}Jr(e){return 0}si(e,t){return k.or([()=>k.resolve(this.ti.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.ei(e,t)])}},Vo=class r{constructor(e,t){this.persistence=e,this.oi=new St(n=>OA(n.path),(n,s)=>n.isEqual(s)),this.garbageCollector=kS(this,t)}static ri(e,t){return new r(e,t)}Zr(){}Xr(e){return k.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}nr(e){let t=this.sr(e);return this.persistence.getTargetCache().getTargetCount(e).next(n=>t.next(s=>n+s))}sr(e){let t=0;return this.rr(e,n=>{t++}).next(()=>t)}rr(e,t){return k.forEach(this.oi,(n,s)=>this.ar(e,n,s).next(i=>i?k.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.qr(e,a=>this.ar(e,a,t).next(u=>{u||(n++,i.removeEntry(a,q.min()))})).next(()=>i.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.oi.set(t,e.currentSequenceNumber),k.resolve()}removeTarget(e,t){let n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.oi.set(n,e.currentSequenceNumber),k.resolve()}removeReference(e,t,n){return this.oi.set(n,e.currentSequenceNumber),k.resolve()}updateLimboDocument(e,t){return this.oi.set(t,e.currentSequenceNumber),k.resolve()}Jr(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=mo(e.data.value)),t}ar(e,t,n){return k.or([()=>this.persistence.ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{let s=this.oi.get(t);return k.resolve(s!==void 0&&s>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}};var $c=class r{constructor(e,t,n,s){this.targetId=e,this.fromCache=t,this.Hi=n,this.Ji=s}static Yi(e,t){let n=H(),s=H();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 qc=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}};var zc=class{constructor(){this.Zi=!1,this.Xi=!1,this.es=100,this.ts=function(){return om()?8:kA(im())>0?6:4}()}initialize(e,t){this.ns=e,this.indexManager=t,this.Zi=!0}getDocumentsMatchingQuery(e,t,n,s){let i={result:null};return this.rs(e,t).next(a=>{i.result=a}).next(()=>{if(!i.result)return this.ss(e,t,s,n).next(a=>{i.result=a})}).next(()=>{if(i.result)return;let a=new qc;return this._s(e,t,a).next(u=>{if(i.result=u,this.Xi)return this.us(e,t,a,u.size)})}).next(()=>i.result)}us(e,t,n,s){return n.documentReadCount<this.es?(un()<=W.DEBUG&&V("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.es,"documents"),k.resolve()):(un()<=W.DEBUG&&V("QueryEngine","Query:",cn(t),"scans",n.documentReadCount,"local documents and returns",s,"documents as results."),n.documentReadCount>this.ts*s?(un()<=W.DEBUG&&V("QueryEngine","The SDK decides to create cache indexes for query:",cn(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,rt(t))):k.resolve())}rs(e,t){if($m(t))return k.resolve(null);let n=rt(t);return this.indexManager.getIndexType(e,n).next(s=>s===0?null:(t.limit!==null&&s===1&&(t=lc(t,null,"F"),n=rt(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next(i=>{let a=H(...i);return this.ns.getDocuments(e,a).next(u=>this.indexManager.getMinOffset(e,n).next(c=>{let h=this.cs(t,u);return this.ls(t,h,a,c.readTime)?this.rs(e,lc(t,null,"F")):this.hs(e,h,t,c)}))})))}ss(e,t,n,s){return $m(t)||s.isEqual(q.min())?k.resolve(null):this.ns.getDocuments(e,n).next(i=>{let a=this.cs(t,i);return this.ls(t,a,n,s)?k.resolve(null):(un()<=W.DEBUG&&V("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),cn(t)),this.hs(e,a,t,SA(s,Rs)).next(u=>u))})}cs(e,t){let n=new ve(zg(e));return t.forEach((s,i)=>{oa(e,i)&&(n=n.add(i))}),n}ls(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)}_s(e,t,n){return un()<=W.DEBUG&&V("QueryEngine","Using full collection scan to execute query:",cn(t)),this.ns.getDocumentsMatchingQuery(e,t,yr.min(),n)}hs(e,t,n,s){return this.ns.getDocumentsMatchingQuery(e,n,s).next(i=>(t.forEach(a=>{i=i.insert(a.key,a)}),i))}};var Nl="LocalStore",DS=3e8,Gc=class{constructor(e,t,n,s){this.persistence=e,this.Ps=t,this.serializer=s,this.Ts=new le(Q),this.Is=new St(i=>Cl(i),kl),this.Es=new Map,this.ds=e.getRemoteDocumentCache(),this.Hr=e.getTargetCache(),this.Yr=e.getBundleCache(),this.As(n)}As(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Dc(this.ds,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ds.setIndexManager(this.indexManager),this.Ps.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Ts))}};function OS(r,e,t,n){return new Gc(r,e,t,n)}async function ly(r,e){let t=$(r);return await t.persistence.runTransaction("Handle user change","readonly",n=>{let s;return t.mutationQueue.getAllMutationBatches(n).next(i=>(s=i,t.As(e),t.mutationQueue.getAllMutationBatches(n))).next(i=>{let a=[],u=[],c=H();for(let h of s){a.push(h.batchId);for(let f of h.mutations)c=c.add(f.key)}for(let h of i){u.push(h.batchId);for(let f of h.mutations)c=c.add(f.key)}return t.localDocuments.getDocuments(n,c).next(h=>({Rs:h,removedBatchIds:a,addedBatchIds:u}))})})}function NS(r,e){let t=$(r);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",n=>{let s=e.batch.keys(),i=t.ds.newChangeBuffer({trackRemovals:!0});return function(u,c,h,f){let m=h.batch,g=m.keys(),E=k.resolve();return g.forEach(P=>{E=E.next(()=>f.getEntry(c,P)).next(C=>{let R=h.docVersions.get(P);ee(R!==null),C.version.compareTo(R)<0&&(m.applyToRemoteDocument(C,h),C.isValidDocument()&&(C.setReadTime(h.commitVersion),f.addEntry(C)))})}),E.next(()=>u.mutationQueue.removeMutationBatch(c,m))}(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=H();for(let h=0;h<u.mutationResults.length;++h)u.mutationResults[h].transformResults.length>0&&(c=c.add(u.batch.mutations[h].key));return c}(e))).next(()=>t.localDocuments.getDocuments(n,s))})}function hy(r){let e=$(r);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Hr.getLastRemoteSnapshotVersion(t))}function VS(r,e){let t=$(r),n=e.snapshotVersion,s=t.Ts;return t.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{let a=t.ds.newChangeBuffer({trackRemovals:!0});s=t.Ts;let u=[];e.targetChanges.forEach((f,m)=>{let g=s.get(m);if(!g)return;u.push(t.Hr.removeMatchingKeys(i,f.removedDocuments,m).next(()=>t.Hr.addMatchingKeys(i,f.addedDocuments,m)));let E=g.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(m)!==null?E=E.withResumeToken(Pe.EMPTY_BYTE_STRING,q.min()).withLastLimboFreeSnapshotVersion(q.min()):f.resumeToken.approximateByteSize()>0&&(E=E.withResumeToken(f.resumeToken,n)),s=s.insert(m,E),function(C,R,N){return C.resumeToken.approximateByteSize()===0||R.snapshotVersion.toMicroseconds()-C.snapshotVersion.toMicroseconds()>=DS?!0:N.addedDocuments.size+N.modifiedDocuments.size+N.removedDocuments.size>0}(g,E,f)&&u.push(t.Hr.updateTargetData(i,E))});let c=Rt(),h=H();if(e.documentUpdates.forEach(f=>{e.resolvedLimboDocuments.has(f)&&u.push(t.persistence.referenceDelegate.updateLimboDocument(i,f))}),u.push(LS(i,a,e.documentUpdates).next(f=>{c=f.Vs,h=f.fs})),!n.isEqual(q.min())){let f=t.Hr.getLastRemoteSnapshotVersion(i).next(m=>t.Hr.setTargetsMetadata(i,i.currentSequenceNumber,n));u.push(f)}return k.waitFor(u).next(()=>a.apply(i)).next(()=>t.localDocuments.getLocalViewOfDocuments(i,c,h)).next(()=>c)}).then(i=>(t.Ts=s,i))}function LS(r,e,t){let n=H(),s=H();return t.forEach(i=>n=n.add(i)),e.getEntries(r,n).next(i=>{let a=Rt();return t.forEach((u,c)=>{let h=i.get(u);c.isFoundDocument()!==h.isFoundDocument()&&(s=s.add(u)),c.isNoDocument()&&c.version.isEqual(q.min())?(e.removeEntry(u,c.readTime),a=a.insert(u,c)):!h.isValidDocument()||c.version.compareTo(h.version)>0||c.version.compareTo(h.version)===0&&h.hasPendingWrites?(e.addEntry(c),a=a.insert(u,c)):V(Nl,"Ignoring outdated watch update for ",u,". Current version:",h.version," Watch version:",c.version)}),{Vs:a,fs:s}})}function MS(r,e){let t=$(r);return t.persistence.runTransaction("Get next mutation batch","readonly",n=>(e===void 0&&(e=xl),t.mutationQueue.getNextMutationBatchAfterBatchId(n,e)))}function FS(r,e){let t=$(r);return t.persistence.runTransaction("Allocate target","readwrite",n=>{let s;return t.Hr.getTargetData(n,e).next(i=>i?(s=i,k.resolve(s)):t.Hr.allocateTargetId(n).next(a=>(s=new Os(e,a,"TargetPurposeListen",n.currentSequenceNumber),t.Hr.addTargetData(n,s).next(()=>s))))}).then(n=>{let s=t.Ts.get(n.targetId);return(s===null||n.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.Ts=t.Ts.insert(n.targetId,n),t.Is.set(e,n.targetId)),n})}async function Kc(r,e,t){let n=$(r),s=n.Ts.get(e),i=t?"readwrite":"readwrite-primary";try{t||await n.persistence.runTransaction("Release target",i,a=>n.persistence.referenceDelegate.removeTarget(a,s))}catch(a){if(!On(a))throw a;V(Nl,`Failed to update sequence numbers for target ${e}: ${a}`)}n.Ts=n.Ts.remove(e),n.Is.delete(s.target)}function tg(r,e,t){let n=$(r),s=q.min(),i=H();return n.persistence.runTransaction("Execute query","readwrite",a=>function(c,h,f){let m=$(c),g=m.Is.get(f);return g!==void 0?k.resolve(m.Ts.get(g)):m.Hr.getTargetData(h,f)}(n,a,rt(e)).next(u=>{if(u)return s=u.lastLimboFreeSnapshotVersion,n.Hr.getMatchingKeysForTargetId(a,u.targetId).next(c=>{i=c})}).next(()=>n.Ps.getDocumentsMatchingQuery(a,e,t?s:q.min(),t?i:H())).next(u=>(jS(n,YA(e),u),{documents:u,gs:i})))}function jS(r,e,t){let n=r.Es.get(e)||q.min();t.forEach((s,i)=>{i.readTime.compareTo(n)>0&&(n=i.readTime)}),r.Es.set(e,n)}var Lo=class{constructor(){this.activeTargetIds=nS()}Ds(e){this.activeTargetIds=this.activeTargetIds.add(e)}vs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}bs(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}};var Hc=class{constructor(){this.ho=new Lo,this.Po={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.ho.Ds(e),this.Po[e]||"not-current"}updateQueryState(e,t,n){this.Po[e]=t}removeLocalQueryTarget(e){this.ho.vs(e)}isLocalQueryTarget(e){return this.ho.activeTargetIds.has(e)}clearQueryState(e){delete this.Po[e]}getAllActiveQueryTargets(){return this.ho.activeTargetIds}isActiveQueryTarget(e){return this.ho.activeTargetIds.has(e)}start(){return this.ho=new Lo,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};var Wc=class{To(e){}shutdown(){}};var rg="ConnectivityMonitor",Mo=class{constructor(){this.Io=()=>this.Eo(),this.Ao=()=>this.Ro(),this.Vo=[],this.mo()}To(e){this.Vo.push(e)}shutdown(){window.removeEventListener("online",this.Io),window.removeEventListener("offline",this.Ao)}mo(){window.addEventListener("online",this.Io),window.addEventListener("offline",this.Ao)}Eo(){V(rg,"Network connectivity changed: AVAILABLE");for(let e of this.Vo)e(0)}Ro(){V(rg,"Network connectivity changed: UNAVAILABLE");for(let e of this.Vo)e(1)}static D(){return typeof window!="undefined"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}};var po=null;function Qc(){return po===null?po=function(){return 268435456+Math.round(2147483648*Math.random())}():po++,"0x"+po.toString(16)}var Uu="RestConnection",US={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"},Jc=class{get fo(){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.po=t+"://"+e.host,this.yo=`projects/${n}/databases/${s}`,this.wo=this.databaseId.database===Io?`project_id=${n}`:`project_id=${n}&database_id=${s}`}So(e,t,n,s,i){let a=Qc(),u=this.bo(e,t.toUriEncodedString());V(Uu,`Sending RPC '${e}' ${a}:`,u,n);let c={"google-cloud-resource-prefix":this.yo,"x-goog-request-params":this.wo};return this.Do(c,s,i),this.vo(e,u,c,n).then(h=>(V(Uu,`Received RPC '${e}' ${a}: `,h),h),h=>{throw mn(Uu,`RPC '${e}' ${a} failed with error: `,h,"url: ",u,"request:",n),h})}Co(e,t,n,s,i,a){return this.So(e,t,n,s,i)}Do(e,t,n){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+kn}(),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)}bo(e,t){let n=US[e];return`${this.po}/v1/${t}:${n}`}terminate(){}};var Yc=class{constructor(e){this.Fo=e.Fo,this.Mo=e.Mo}xo(e){this.Oo=e}No(e){this.Bo=e}Lo(e){this.ko=e}onMessage(e){this.qo=e}close(){this.Mo()}send(e){this.Fo(e)}Qo(){this.Oo()}$o(){this.Bo()}Ko(e){this.ko(e)}Uo(e){this.qo(e)}};var Re="WebChannelConnection",Xc=class extends Jc{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}vo(e,t,n,s){let i=Qc();return new Promise((a,u)=>{let c=new Nu;c.setWithCredentials(!0),c.listenOnce(Vu.COMPLETE,()=>{try{switch(c.getLastErrorCode()){case Ts.NO_ERROR:let f=c.getResponseJson();V(Re,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(f)),a(f);break;case Ts.TIMEOUT:V(Re,`RPC '${e}' ${i} timed out`),u(new L(D.DEADLINE_EXCEEDED,"Request time out"));break;case Ts.HTTP_ERROR:let m=c.getStatus();if(V(Re,`RPC '${e}' ${i} failed with status:`,m,"response text:",c.getResponseText()),m>0){let g=c.getResponseJson();Array.isArray(g)&&(g=g[0]);let E=g==null?void 0:g.error;if(E&&E.status&&E.message){let P=function(R){let N=R.toLowerCase().replace(/_/g,"-");return Object.values(D).indexOf(N)>=0?N:D.UNKNOWN}(E.status);u(new L(P,E.message))}else u(new L(D.UNKNOWN,"Server responded with status "+c.getStatus()))}else u(new L(D.UNAVAILABLE,"Connection failed."));break;default:F()}}finally{V(Re,`RPC '${e}' ${i} completed.`)}});let h=JSON.stringify(s);V(Re,`RPC '${e}' ${i} sending request:`,s),c.send(t,"POST",h,n,15)})}Wo(e,t,n){let s=Qc(),i=[this.po,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=Fu(),u=Mu(),c={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},h=this.longPollingOptions.timeoutSeconds;h!==void 0&&(c.longPollingTimeout=Math.round(1e3*h)),this.useFetchStreams&&(c.useFetchStreams=!0),this.Do(c.initMessageHeaders,t,n),c.encodeInitMessageHeaders=!0;let f=i.join("");V(Re,`Creating RPC '${e}' stream ${s}: ${f}`,c);let m=a.createWebChannel(f,c),g=!1,E=!1,P=new Yc({Fo:R=>{E?V(Re,`Not sending because RPC '${e}' stream ${s} is closed:`,R):(g||(V(Re,`Opening RPC '${e}' stream ${s} transport.`),m.open(),g=!0),V(Re,`RPC '${e}' stream ${s} sending:`,R),m.send(R))},Mo:()=>m.close()}),C=(R,N,M)=>{R.listen(N,U=>{try{M(U)}catch(G){setTimeout(()=>{throw G},0)}})};return C(m,an.EventType.OPEN,()=>{E||(V(Re,`RPC '${e}' stream ${s} transport opened.`),P.Qo())}),C(m,an.EventType.CLOSE,()=>{E||(E=!0,V(Re,`RPC '${e}' stream ${s} transport closed`),P.Ko())}),C(m,an.EventType.ERROR,R=>{E||(E=!0,mn(Re,`RPC '${e}' stream ${s} transport errored:`,R),P.Ko(new L(D.UNAVAILABLE,"The operation could not be completed")))}),C(m,an.EventType.MESSAGE,R=>{var N;if(!E){let M=R.data[0];ee(!!M);let U=M,G=(U==null?void 0:U.error)||((N=U[0])===null||N===void 0?void 0:N.error);if(G){V(Re,`RPC '${e}' stream ${s} received error:`,G);let Y=G.status,B=function(w){let b=de[w];if(b!==void 0)return ty(b)}(Y),T=G.message;B===void 0&&(B=D.INTERNAL,T="Unknown error status: "+Y+" with message "+G.message),E=!0,P.Ko(new L(B,T)),m.close()}else V(Re,`RPC '${e}' stream ${s} received:`,M),P.Uo(M)}}),C(u,Lu.STAT_EVENT,R=>{R.stat===lo.PROXY?V(Re,`RPC '${e}' stream ${s} detected buffering proxy`):R.stat===lo.NOPROXY&&V(Re,`RPC '${e}' stream ${s} detected no buffering proxy`)}),setTimeout(()=>{P.$o()},0),P}};function Bu(){return typeof document!="undefined"?document:null}function aa(r){return new vc(r,!0)}var Fo=class{constructor(e,t,n=1e3,s=1.5,i=6e4){this.Ti=e,this.timerId=t,this.Go=n,this.zo=s,this.jo=i,this.Ho=0,this.Jo=null,this.Yo=Date.now(),this.reset()}reset(){this.Ho=0}Zo(){this.Ho=this.jo}Xo(e){this.cancel();let t=Math.floor(this.Ho+this.e_()),n=Math.max(0,Date.now()-this.Yo),s=Math.max(0,t-n);s>0&&V("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Ho} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Jo=this.Ti.enqueueAfterDelay(this.timerId,s,()=>(this.Yo=Date.now(),e())),this.Ho*=this.zo,this.Ho<this.Go&&(this.Ho=this.Go),this.Ho>this.jo&&(this.Ho=this.jo)}t_(){this.Jo!==null&&(this.Jo.skipDelay(),this.Jo=null)}cancel(){this.Jo!==null&&(this.Jo.cancel(),this.Jo=null)}e_(){return(Math.random()-.5)*this.Ho}};var ng="PersistentStream",jo=class{constructor(e,t,n,s,i,a,u,c){this.Ti=e,this.n_=n,this.r_=s,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=u,this.listener=c,this.state=0,this.i_=0,this.s_=null,this.o_=null,this.stream=null,this.__=0,this.a_=new Fo(e,t)}u_(){return this.state===1||this.state===5||this.c_()}c_(){return this.state===2||this.state===3}start(){this.__=0,this.state!==4?this.auth():this.l_()}async stop(){this.u_()&&await this.close(0)}h_(){this.state=0,this.a_.reset()}P_(){this.c_()&&this.s_===null&&(this.s_=this.Ti.enqueueAfterDelay(this.n_,6e4,()=>this.T_()))}I_(e){this.E_(),this.stream.send(e)}async T_(){if(this.c_())return this.close(0)}E_(){this.s_&&(this.s_.cancel(),this.s_=null)}d_(){this.o_&&(this.o_.cancel(),this.o_=null)}async close(e,t){this.E_(),this.d_(),this.a_.cancel(),this.i_++,e!==4?this.a_.reset():t&&t.code===D.RESOURCE_EXHAUSTED?(It(t.toString()),It("Using maximum backoff delay to prevent overloading the backend."),this.a_.Zo()):t&&t.code===D.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.A_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Lo(t)}A_(){}auth(){this.state=1;let e=this.R_(this.i_),t=this.i_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([n,s])=>{this.i_===t&&this.V_(n,s)},n=>{e(()=>{let s=new L(D.UNKNOWN,"Fetching auth token failed: "+n.message);return this.m_(s)})})}V_(e,t){let n=this.R_(this.i_);this.stream=this.f_(e,t),this.stream.xo(()=>{n(()=>this.listener.xo())}),this.stream.No(()=>{n(()=>(this.state=2,this.o_=this.Ti.enqueueAfterDelay(this.r_,1e4,()=>(this.c_()&&(this.state=3),Promise.resolve())),this.listener.No()))}),this.stream.Lo(s=>{n(()=>this.m_(s))}),this.stream.onMessage(s=>{n(()=>++this.__==1?this.g_(s):this.onNext(s))})}l_(){this.state=5,this.a_.Xo(async()=>{this.state=0,this.start()})}m_(e){return V(ng,`close with error: ${e}`),this.stream=null,this.close(4,e)}R_(e){return t=>{this.Ti.enqueueAndForget(()=>this.i_===e?t():(V(ng,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}},Zc=class extends jo{constructor(e,t,n,s,i,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,s,a),this.serializer=i}f_(e,t){return this.connection.Wo("Listen",e,t)}g_(e){return this.onNext(e)}onNext(e){this.a_.reset();let t=_S(this.serializer,e),n=function(i){if(!("targetChange"in i))return q.min();let a=i.targetChange;return a.targetIds&&a.targetIds.length?q.min():a.readTime?nt(a.readTime):q.min()}(e);return this.listener.p_(t,n)}y_(e){let t={};t.database=Ec(this.serializer),t.addTarget=function(i,a){let u,c=a.target;if(u=cc(c)?{documents:bS(i,c)}:{query:TS(i,c).ht},u.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){u.resumeToken=ry(i,a.resumeToken);let h=wc(i,a.expectedCount);h!==null&&(u.expectedCount=h)}else if(a.snapshotVersion.compareTo(q.min())>0){u.readTime=Do(i,a.snapshotVersion.toTimestamp());let h=wc(i,a.expectedCount);h!==null&&(u.expectedCount=h)}return u}(this.serializer,e);let n=IS(this.serializer,e);n&&(t.labels=n),this.I_(t)}w_(e){let t={};t.database=Ec(this.serializer),t.removeTarget=e,this.I_(t)}},el=class extends jo{constructor(e,t,n,s,i,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,s,a),this.serializer=i}get S_(){return this.__>0}start(){this.lastStreamToken=void 0,super.start()}A_(){this.S_&&this.b_([])}f_(e,t){return this.connection.Wo("Write",e,t)}g_(e){return ee(!!e.streamToken),this.lastStreamToken=e.streamToken,ee(!e.writeResults||e.writeResults.length===0),this.listener.D_()}onNext(e){ee(!!e.streamToken),this.lastStreamToken=e.streamToken,this.a_.reset();let t=wS(e.writeResults,e.commitTime),n=nt(e.commitTime);return this.listener.v_(n,t)}C_(){let e={};e.database=Ec(this.serializer),this.I_(e)}b_(e){let t={streamToken:this.lastStreamToken,writes:e.map(n=>vS(this.serializer,n))};this.I_(t)}};var tl=class{},rl=class extends tl{constructor(e,t,n,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=s,this.F_=!1}M_(){if(this.F_)throw new L(D.FAILED_PRECONDITION,"The client has already been terminated.")}So(e,t,n,s){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,a])=>this.connection.So(e,bc(t,n),s,i,a)).catch(i=>{throw i.name==="FirebaseError"?(i.code===D.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new L(D.UNKNOWN,i.toString())})}Co(e,t,n,s,i){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([a,u])=>this.connection.Co(e,bc(t,n),s,a,u,i)).catch(a=>{throw a.name==="FirebaseError"?(a.code===D.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new L(D.UNKNOWN,a.toString())})}terminate(){this.F_=!0,this.connection.terminate()}},nl=class{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.x_=0,this.O_=null,this.N_=!0}B_(){this.x_===0&&(this.L_("Unknown"),this.O_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.O_=null,this.k_("Backend didn't respond within 10 seconds."),this.L_("Offline"),Promise.resolve())))}q_(e){this.state==="Online"?this.L_("Unknown"):(this.x_++,this.x_>=1&&(this.Q_(),this.k_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.L_("Offline")))}set(e){this.Q_(),this.x_=0,e==="Online"&&(this.N_=!1),this.L_(e)}L_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}k_(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.N_?(
|
|
14
|
+
Determined least recently used ${i} in `+(l-a)+`ms
|
|
15
|
+
Removed ${s} targets in `+(u-l)+`ms
|
|
16
|
+
Removed ${m} documents in `+(h-u)+`ms
|
|
17
|
+
Total Duration: ${h-f}ms`),D.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:s,documentsRemoved:m})))}};hh=class{constructor(){this.changes=new Mt(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,it.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return n!==void 0?D.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(){}};dh=class{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}};fh=class{constructor(e,t,n,i){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=i}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(i=>(n=i,this.remoteDocumentCache.getEntry(e,t))).next(i=>(n!==null&&us(n.mutation,i,Xe.empty(),Ee.now()),i))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(n=>this.getLocalViewOfDocuments(e,n,W()).next(()=>n))}getLocalViewOfDocuments(e,t,n=W()){let i=Pr();return this.populateOverlays(e,i,t).next(()=>this.computeViews(e,t,i,n).next(s=>{let a=ss();return s.forEach((l,u)=>{a=a.insert(l,u.overlayedDocument)}),a}))}getOverlayedDocuments(e,t){let n=Pr();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,W()))}populateOverlays(e,t,n){let i=[];return n.forEach(s=>{t.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(e,i).next(s=>{s.forEach((a,l)=>{t.set(a,l)})})}computeViews(e,t,n,i){let s=Ft(),a=ls(),l=function(){return ls()}();return t.forEach((u,h)=>{let f=n.get(h.key);i.has(h.key)&&(f===void 0||f.mutation instanceof yt)?s=s.insert(h.key,h):f!==void 0?(a.set(h.key,f.mutation.getFieldMask()),us(f.mutation,h,f.mutation.getFieldMask(),Ee.now())):a.set(h.key,Xe.empty())}),this.recalculateAndSaveOverlays(e,s).next(u=>(u.forEach((h,f)=>a.set(h,f)),t.forEach((h,f)=>{var m;return l.set(h,new dh(f,(m=a.get(h))!==null&&m!==void 0?m:null))}),l))}recalculateAndSaveOverlays(e,t){let n=ls(),i=new de((a,l)=>a-l),s=W();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(a=>{for(let l of a)l.keys().forEach(u=>{let h=t.get(u);if(h===null)return;let f=n.get(u)||Xe.empty();f=l.applyToLocalView(h,f),n.set(u,f);let m=(i.get(l.batchId)||W()).add(u);i=i.insert(l.batchId,m)})}).next(()=>{let a=[],l=i.getReverseIterator();for(;l.hasNext();){let u=l.getNext(),h=u.key,f=u.value,m=Wv();f.forEach(g=>{if(!s.has(g)){let I=eb(t.get(g),n.get(g));I!==null&&m.set(g,I),s=s.add(g)}}),a.push(this.documentOverlayCache.saveOverlays(e,h,m))}return D.waitFor(a)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(n=>this.recalculateAndSaveOverlays(e,n))}getDocumentsMatchingQuery(e,t,n,i){return function(a){return U.isDocumentKey(a.path)&&a.collectionGroup===null&&a.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Lk(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,i):this.getDocumentsMatchingCollectionQuery(e,t,n,i)}getNextDocuments(e,t,n,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,i).next(s=>{let a=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,i-s.size):D.resolve(Pr()),l=cs,u=s;return a.next(h=>D.forEach(h,(f,m)=>(l<m.largestBatchId&&(l=m.largestBatchId),s.get(f)?D.resolve():this.remoteDocumentCache.getEntry(e,f).next(g=>{u=u.insert(f,g)}))).next(()=>this.populateOverlays(e,h,s)).next(()=>this.computeViews(e,u,h,W())).next(f=>({batchId:l,changes:Hv(f)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new U(t)).next(n=>{let i=ss();return n.isFoundDocument()&&(i=i.insert(n.key,n)),i})}getDocumentsMatchingCollectionGroupQuery(e,t,n,i){let s=t.collectionGroup,a=ss();return this.indexManager.getCollectionParents(e,s).next(l=>D.forEach(l,u=>{let h=function(m,g){return new zn(g,null,m.explicitOrderBy.slice(),m.filters.slice(),m.limit,m.limitType,m.startAt,m.endAt)}(t,u.child(s));return this.getDocumentsMatchingCollectionQuery(e,h,n,i).next(f=>{f.forEach((m,g)=>{a=a.insert(m,g)})})}).next(()=>a))}getDocumentsMatchingCollectionQuery(e,t,n,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(a=>(s=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s,i))).next(a=>{s.forEach((u,h)=>{let f=h.getKey();a.get(f)===null&&(a=a.insert(f,it.newInvalidDocument(f)))});let l=ss();return a.forEach((u,h)=>{let f=s.get(u);f!==void 0&&us(f.mutation,h,Xe.empty(),Ee.now()),ul(t,h)&&(l=l.insert(u,h))}),l})}};ph=class{constructor(e){this.serializer=e,this.dr=new Map,this.Ar=new Map}getBundleMetadata(e,t){return D.resolve(this.dr.get(t))}saveBundleMetadata(e,t){return this.dr.set(t.id,function(i){return{id:i.id,version:i.version,createTime:ft(i.createTime)}}(t)),D.resolve()}getNamedQuery(e,t){return D.resolve(this.Ar.get(t))}saveNamedQuery(e,t){return this.Ar.set(t.name,function(i){return{name:i.name,query:gD(i.bundledQuery),readTime:ft(i.readTime)}}(t)),D.resolve()}};mh=class{constructor(){this.overlays=new de(U.comparator),this.Rr=new Map}getOverlay(e,t){return D.resolve(this.overlays.get(t))}getOverlays(e,t){let n=Pr();return D.forEach(t,i=>this.getOverlay(e,i).next(s=>{s!==null&&n.set(i,s)})).next(()=>n)}saveOverlays(e,t,n){return n.forEach((i,s)=>{this.Et(e,t,s)}),D.resolve()}removeOverlaysForBatchId(e,t,n){let i=this.Rr.get(n);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.Rr.delete(n)),D.resolve()}getOverlaysForCollection(e,t,n){let i=Pr(),s=t.length+1,a=new U(t.child("")),l=this.overlays.getIteratorFrom(a);for(;l.hasNext();){let u=l.getNext().value,h=u.getKey();if(!t.isPrefixOf(h.path))break;h.path.length===s&&u.largestBatchId>n&&i.set(u.getKey(),u)}return D.resolve(i)}getOverlaysForCollectionGroup(e,t,n,i){let s=new de((h,f)=>h-f),a=this.overlays.getIterator();for(;a.hasNext();){let h=a.getNext().value;if(h.getKey().getCollectionGroup()===t&&h.largestBatchId>n){let f=s.get(h.largestBatchId);f===null&&(f=Pr(),s=s.insert(h.largestBatchId,f)),f.set(h.getKey(),h)}}let l=Pr(),u=s.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach((h,f)=>l.set(h,f)),!(l.size()>=i)););return D.resolve(l)}Et(e,t,n){let i=this.overlays.get(n.key);if(i!==null){let a=this.Rr.get(i.largestBatchId).delete(n.key);this.Rr.set(i.largestBatchId,a)}this.overlays=this.overlays.insert(n.key,new Jc(t,n));let s=this.Rr.get(t);s===void 0&&(s=W(),this.Rr.set(t,s)),this.Rr.set(t,s.add(n.key))}};gh=class{constructor(){this.sessionToken=De.EMPTY_BYTE_STRING}getSessionToken(e){return D.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,D.resolve()}};ys=class{constructor(){this.Vr=new be(me.mr),this.gr=new be(me.pr)}isEmpty(){return this.Vr.isEmpty()}addReference(e,t){let n=new me(e,t);this.Vr=this.Vr.add(n),this.gr=this.gr.add(n)}yr(e,t){e.forEach(n=>this.addReference(n,t))}removeReference(e,t){this.wr(new me(e,t))}Sr(e,t){e.forEach(n=>this.removeReference(n,t))}br(e){let t=new U(new ge([])),n=new me(t,e),i=new me(t,e+1),s=[];return this.gr.forEachInRange([n,i],a=>{this.wr(a),s.push(a.key)}),s}Dr(){this.Vr.forEach(e=>this.wr(e))}wr(e){this.Vr=this.Vr.delete(e),this.gr=this.gr.delete(e)}vr(e){let t=new U(new ge([])),n=new me(t,e),i=new me(t,e+1),s=W();return this.gr.forEachInRange([n,i],a=>{s=s.add(a.key)}),s}containsKey(e){let t=new me(e,0),n=this.Vr.firstAfterOrEqual(t);return n!==null&&e.isEqual(n.key)}},me=class{constructor(e,t){this.key=e,this.Cr=t}static mr(e,t){return U.comparator(e.key,t.key)||J(e.Cr,t.Cr)}static pr(e,t){return J(e.Cr,t.Cr)||U.comparator(e.key,t.key)}};yh=class{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Fr=1,this.Mr=new be(me.mr)}checkEmpty(e){return D.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,n,i){let s=this.Fr;this.Fr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let a=new Wc(s,t,n,i);this.mutationQueue.push(a);for(let l of i)this.Mr=this.Mr.add(new me(l.key,s)),this.indexManager.addToCollectionParentIndex(e,l.key.path.popLast());return D.resolve(a)}lookupMutationBatch(e,t){return D.resolve(this.Or(t))}getNextMutationBatchAfterBatchId(e,t){let n=t+1,i=this.Nr(n),s=i<0?0:i;return D.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return D.resolve(this.mutationQueue.length===0?od:this.Fr-1)}getAllMutationBatches(e){return D.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new me(t,0),i=new me(t,Number.POSITIVE_INFINITY),s=[];return this.Mr.forEachInRange([n,i],a=>{let l=this.Or(a.Cr);s.push(l)}),D.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new be(J);return t.forEach(i=>{let s=new me(i,0),a=new me(i,Number.POSITIVE_INFINITY);this.Mr.forEachInRange([s,a],l=>{n=n.add(l.Cr)})}),D.resolve(this.Br(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,i=n.length+1,s=n;U.isDocumentKey(s)||(s=s.child(""));let a=new me(new U(s),0),l=new be(J);return this.Mr.forEachWhile(u=>{let h=u.key.path;return!!n.isPrefixOf(h)&&(h.length===i&&(l=l.add(u.Cr)),!0)},a),D.resolve(this.Br(l))}Br(e){let t=[];return e.forEach(n=>{let i=this.Or(n);i!==null&&t.push(i)}),t}removeMutationBatch(e,t){re(this.Lr(t.batchId,"removed")===0),this.mutationQueue.shift();let n=this.Mr;return D.forEach(t.mutations,i=>{let s=new me(i.key,t.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Mr=n})}qn(e){}containsKey(e,t){let n=new me(t,0),i=this.Mr.firstAfterOrEqual(n);return D.resolve(t.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,D.resolve()}Lr(e,t){return this.Nr(e)}Nr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Or(e){let t=this.Nr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}};_h=class{constructor(e){this.kr=e,this.docs=function(){return new de(U.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let n=t.key,i=this.docs.get(n),s=i?i.size:0,a=this.kr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:a}),this.size+=a-s,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 D.resolve(n?n.document.mutableCopy():it.newInvalidDocument(t))}getEntries(e,t){let n=Ft();return t.forEach(i=>{let s=this.docs.get(i);n=n.insert(i,s?s.document.mutableCopy():it.newInvalidDocument(i))}),D.resolve(n)}getDocumentsMatchingQuery(e,t,n,i){let s=Ft(),a=t.path,l=new U(a.child("__id-9223372036854775808__")),u=this.docs.getIteratorFrom(l);for(;u.hasNext();){let{key:h,value:{document:f}}=u.getNext();if(!a.isPrefixOf(h.path))break;h.path.length>a.length+1||gk(mk(f),n)<=0||(i.has(f.key)||ul(t,f))&&(s=s.insert(f.key,f.mutableCopy()))}return D.resolve(s)}getAllFromCollectionGroup(e,t,n,i){j()}qr(e,t){return D.forEach(this.docs,n=>t(n))}newChangeBuffer(e){return new wh(this)}getSize(e){return D.resolve(this.size)}},wh=class extends hh{constructor(e){super(),this.Ir=e}applyChanges(e){let t=[];return this.changes.forEach((n,i)=>{i.isValidDocument()?t.push(this.Ir.addEntry(e,i)):this.Ir.removeEntry(n)}),D.waitFor(t)}getFromCache(e,t){return this.Ir.getEntry(e,t)}getAllFromCache(e,t){return this.Ir.getEntries(e,t)}};vh=class{constructor(e){this.persistence=e,this.Qr=new Mt(t=>hd(t),dd),this.lastRemoteSnapshotVersion=z.min(),this.highestTargetId=0,this.$r=0,this.Kr=new ys,this.targetCount=0,this.Ur=gs.Kn()}forEachTarget(e,t){return this.Qr.forEach((n,i)=>t(i)),D.resolve()}getLastRemoteSnapshotVersion(e){return D.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return D.resolve(this.$r)}allocateTargetId(e){return this.highestTargetId=this.Ur.next(),D.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.$r&&(this.$r=t),D.resolve()}zn(e){this.Qr.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.Ur=new gs(t),this.highestTargetId=t),e.sequenceNumber>this.$r&&(this.$r=e.sequenceNumber)}addTargetData(e,t){return this.zn(t),this.targetCount+=1,D.resolve()}updateTargetData(e,t){return this.zn(t),D.resolve()}removeTargetData(e,t){return this.Qr.delete(t.target),this.Kr.br(t.targetId),this.targetCount-=1,D.resolve()}removeTargets(e,t,n){let i=0,s=[];return this.Qr.forEach((a,l)=>{l.sequenceNumber<=t&&n.get(l.targetId)===null&&(this.Qr.delete(a),s.push(this.removeMatchingKeysForTargetId(e,l.targetId)),i++)}),D.waitFor(s).next(()=>i)}getTargetCount(e){return D.resolve(this.targetCount)}getTargetData(e,t){let n=this.Qr.get(t)||null;return D.resolve(n)}addMatchingKeys(e,t,n){return this.Kr.yr(t,n),D.resolve()}removeMatchingKeys(e,t,n){this.Kr.Sr(t,n);let i=this.persistence.referenceDelegate,s=[];return i&&t.forEach(a=>{s.push(i.markPotentiallyOrphaned(e,a))}),D.waitFor(s)}removeMatchingKeysForTargetId(e,t){return this.Kr.br(t),D.resolve()}getMatchingKeysForTargetId(e,t){let n=this.Kr.vr(t);return D.resolve(n)}containsKey(e,t){return D.resolve(this.Kr.containsKey(t))}};Ma=class{constructor(e,t){this.Wr={},this.overlays={},this.Gr=new Fn(0),this.zr=!1,this.zr=!0,this.jr=new gh,this.referenceDelegate=e(this),this.Hr=new vh(this),this.indexManager=new oh,this.remoteDocumentCache=function(i){return new _h(i)}(n=>this.referenceDelegate.Jr(n)),this.serializer=new sh(t),this.Yr=new ph(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.zr=!1,Promise.resolve()}get started(){return this.zr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new mh,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.Wr[e.toKey()];return n||(n=new yh(t,this.referenceDelegate),this.Wr[e.toKey()]=n),n}getGlobalsCache(){return this.jr}getTargetCache(){return this.Hr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Yr}runTransaction(e,t,n){L("MemoryPersistence","Starting transaction:",e);let i=new bh(this.Gr.next());return this.referenceDelegate.Zr(),n(i).next(s=>this.referenceDelegate.Xr(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}ei(e,t){return D.or(Object.values(this.Wr).map(n=>()=>n.containsKey(e,t)))}},bh=class extends kc{constructor(e){super(),this.currentSequenceNumber=e}},Th=class r{constructor(e){this.persistence=e,this.ti=new ys,this.ni=null}static ri(e){return new r(e)}get ii(){if(this.ni)return this.ni;throw j()}addReference(e,t,n){return this.ti.addReference(n,t),this.ii.delete(n.toString()),D.resolve()}removeReference(e,t,n){return this.ti.removeReference(n,t),this.ii.add(n.toString()),D.resolve()}markPotentiallyOrphaned(e,t){return this.ii.add(t.toString()),D.resolve()}removeTarget(e,t){this.ti.br(t.targetId).forEach(i=>this.ii.add(i.toString()));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(i=>{i.forEach(s=>this.ii.add(s.toString()))}).next(()=>n.removeTargetData(e,t))}Zr(){this.ni=new Set}Xr(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return D.forEach(this.ii,n=>{let i=U.fromPath(n);return this.si(e,i).next(s=>{s||t.removeEntry(i,z.min())})}).next(()=>(this.ni=null,t.apply(e)))}updateLimboDocument(e,t){return this.si(e,t).next(n=>{n?this.ii.delete(t.toString()):this.ii.add(t.toString())})}Jr(e){return 0}si(e,t){return D.or([()=>D.resolve(this.ti.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.ei(e,t)])}},Fa=class r{constructor(e,t){this.persistence=e,this.oi=new Mt(n=>vk(n.path),(n,i)=>n.isEqual(i)),this.garbageCollector=_D(this,t)}static ri(e,t){return new r(e,t)}Zr(){}Xr(e){return D.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}nr(e){let t=this.sr(e);return this.persistence.getTargetCache().getTargetCount(e).next(n=>t.next(i=>n+i))}sr(e){let t=0;return this.rr(e,n=>{t++}).next(()=>t)}rr(e,t){return D.forEach(this.oi,(n,i)=>this.ar(e,n,i).next(s=>s?D.resolve():t(i)))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0,i=this.persistence.getRemoteDocumentCache(),s=i.newChangeBuffer();return i.qr(e,a=>this.ar(e,a,t).next(l=>{l||(n++,s.removeEntry(a,z.min()))})).next(()=>s.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.oi.set(t,e.currentSequenceNumber),D.resolve()}removeTarget(e,t){let n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.oi.set(n,e.currentSequenceNumber),D.resolve()}removeReference(e,t,n){return this.oi.set(n,e.currentSequenceNumber),D.resolve()}updateLimboDocument(e,t){return this.oi.set(t,e.currentSequenceNumber),D.resolve()}Jr(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=_a(e.data.value)),t}ar(e,t,n){return D.or([()=>this.persistence.ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{let i=this.oi.get(t);return D.resolve(i!==void 0&&i>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}};Eh=class r{constructor(e,t,n,i){this.targetId=e,this.fromCache=t,this.Hi=n,this.Ji=i}static Yi(e,t){let n=W(),i=W();for(let s of t.docChanges)switch(s.type){case 0:n=n.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new r(e,t.fromCache,n,i)}};Ih=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}};Ah=class{constructor(){this.Zi=!1,this.Xi=!1,this.es=100,this.ts=function(){return iw()?8:_k(nw())>0?6:4}()}initialize(e,t){this.ns=e,this.indexManager=t,this.Zi=!0}getDocumentsMatchingQuery(e,t,n,i){let s={result:null};return this.rs(e,t).next(a=>{s.result=a}).next(()=>{if(!s.result)return this.ss(e,t,i,n).next(a=>{s.result=a})}).next(()=>{if(s.result)return;let a=new Ih;return this._s(e,t,a).next(l=>{if(s.result=l,this.Xi)return this.us(e,t,a,l.size)})}).next(()=>s.result)}us(e,t,n,i){return n.documentReadCount<this.es?(Pn()<=Q.DEBUG&&L("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.es,"documents"),D.resolve()):(Pn()<=Q.DEBUG&&L("QueryEngine","Query:",Cn(t),"scans",n.documentReadCount,"local documents and returns",i,"documents as results."),n.documentReadCount>this.ts*i?(Pn()<=Q.DEBUG&&L("QueryEngine","The SDK decides to create cache indexes for query:",Cn(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,dt(t))):D.resolve())}rs(e,t){if(qw(t))return D.resolve(null);let n=dt(t);return this.indexManager.getIndexType(e,n).next(i=>i===0?null:(t.limit!==null&&i===1&&(t=Gc(t,null,"F"),n=dt(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next(s=>{let a=W(...s);return this.ns.getDocuments(e,a).next(l=>this.indexManager.getMinOffset(e,n).next(u=>{let h=this.cs(t,l);return this.ls(t,h,a,u.readTime)?this.rs(e,Gc(t,null,"F")):this.hs(e,h,t,u)}))})))}ss(e,t,n,i){return qw(t)||i.isEqual(z.min())?D.resolve(null):this.ns.getDocuments(e,n).next(s=>{let a=this.cs(t,s);return this.ls(t,a,n,i)?D.resolve(null):(Pn()<=Q.DEBUG&&L("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),Cn(t)),this.hs(e,a,t,pk(i,cs)).next(l=>l))})}cs(e,t){let n=new be(Gv(e));return t.forEach((i,s)=>{ul(e,s)&&(n=n.add(s))}),n}ls(e,t,n,i){if(e.limit===null)return!1;if(n.size!==t.size)return!0;let s=e.limitType==="F"?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}_s(e,t,n){return Pn()<=Q.DEBUG&&L("QueryEngine","Using full collection scan to execute query:",Cn(t)),this.ns.getDocumentsMatchingQuery(e,t,Or.min(),n)}hs(e,t,n,i){return this.ns.getDocumentsMatchingQuery(e,n,i).next(s=>(t.forEach(a=>{s=s.insert(a.key,a)}),s))}};md="LocalStore",wD=3e8,xh=class{constructor(e,t,n,i){this.persistence=e,this.Ps=t,this.serializer=i,this.Ts=new de(J),this.Is=new Mt(s=>hd(s),dd),this.Es=new Map,this.ds=e.getRemoteDocumentCache(),this.Hr=e.getTargetCache(),this.Yr=e.getBundleCache(),this.As(n)}As(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new fh(this.ds,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ds.setIndexManager(this.indexManager),this.Ps.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Ts))}};ja=class{constructor(){this.activeTargetIds=zk()}Ds(e){this.activeTargetIds=this.activeTargetIds.add(e)}vs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}bs(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}},Rh=class{constructor(){this.ho=new ja,this.Po={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.ho.Ds(e),this.Po[e]||"not-current"}updateQueryState(e,t,n){this.Po[e]=t}removeLocalQueryTarget(e){this.ho.vs(e)}isLocalQueryTarget(e){return this.ho.activeTargetIds.has(e)}clearQueryState(e){delete this.Po[e]}getAllActiveQueryTargets(){return this.ho.activeTargetIds}isActiveQueryTarget(e){return this.ho.activeTargetIds.has(e)}start(){return this.ho=new ja,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};Ph=class{To(e){}shutdown(){}};nv="ConnectivityMonitor",Ua=class{constructor(){this.Io=()=>this.Eo(),this.Ao=()=>this.Ro(),this.Vo=[],this.mo()}To(e){this.Vo.push(e)}shutdown(){window.removeEventListener("online",this.Io),window.removeEventListener("offline",this.Ao)}mo(){window.addEventListener("online",this.Io),window.addEventListener("offline",this.Ao)}Eo(){L(nv,"Network connectivity changed: AVAILABLE");for(let e of this.Vo)e(0)}Ro(){L(nv,"Network connectivity changed: UNAVAILABLE");for(let e of this.Vo)e(1)}static D(){return typeof window!="undefined"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}};ya=null;bc="RestConnection",SD={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"},kh=class{get fo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.po=t+"://"+e.host,this.yo=`projects/${n}/databases/${i}`,this.wo=this.databaseId.database===Sa?`project_id=${n}`:`project_id=${n}&database_id=${i}`}So(e,t,n,i,s){let a=Ch(),l=this.bo(e,t.toUriEncodedString());L(bc,`Sending RPC '${e}' ${a}:`,l,n);let u={"google-cloud-resource-prefix":this.yo,"x-goog-request-params":this.wo};return this.Do(u,i,s),this.vo(e,l,u,n).then(h=>(L(bc,`Received RPC '${e}' ${a}: `,h),h),h=>{throw Ln(bc,`RPC '${e}' ${a} failed with error: `,h,"url: ",l,"request:",n),h})}Co(e,t,n,i,s,a){return this.So(e,t,n,i,s)}Do(e,t,n){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Xn}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((i,s)=>e[s]=i),n&&n.headers.forEach((i,s)=>e[s]=i)}bo(e,t){let n=SD[e];return`${this.po}/v1/${t}:${n}`}terminate(){}};Dh=class{constructor(e){this.Fo=e.Fo,this.Mo=e.Mo}xo(e){this.Oo=e}No(e){this.Bo=e}Lo(e){this.ko=e}onMessage(e){this.qo=e}close(){this.Mo()}send(e){this.Fo(e)}Qo(){this.Oo()}$o(){this.Bo()}Ko(e){this.ko(e)}Uo(e){this.qo(e)}};ke="WebChannelConnection",Oh=class extends kh{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}vo(e,t,n,i){let s=Ch();return new Promise((a,l)=>{let u=new mc;u.setWithCredentials(!0),u.listenOnce(gc.COMPLETE,()=>{try{switch(u.getLastErrorCode()){case is.NO_ERROR:let f=u.getResponseJson();L(ke,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(f)),a(f);break;case is.TIMEOUT:L(ke,`RPC '${e}' ${s} timed out`),l(new M(O.DEADLINE_EXCEEDED,"Request time out"));break;case is.HTTP_ERROR:let m=u.getStatus();if(L(ke,`RPC '${e}' ${s} failed with status:`,m,"response text:",u.getResponseText()),m>0){let g=u.getResponseJson();Array.isArray(g)&&(g=g[0]);let I=g==null?void 0:g.error;if(I&&I.status&&I.message){let C=function(P){let V=P.toLowerCase().replace(/_/g,"-");return Object.values(O).indexOf(V)>=0?V:O.UNKNOWN}(I.status);l(new M(C,I.message))}else l(new M(O.UNKNOWN,"Server responded with status "+u.getStatus()))}else l(new M(O.UNAVAILABLE,"Connection failed."));break;default:j()}}finally{L(ke,`RPC '${e}' ${s} completed.`)}});let h=JSON.stringify(i);L(ke,`RPC '${e}' ${s} sending request:`,i),u.send(t,"POST",h,n,15)})}Wo(e,t,n){let i=Ch(),s=[this.po,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=wc(),l=_c(),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},h=this.longPollingOptions.timeoutSeconds;h!==void 0&&(u.longPollingTimeout=Math.round(1e3*h)),this.useFetchStreams&&(u.useFetchStreams=!0),this.Do(u.initMessageHeaders,t,n),u.encodeInitMessageHeaders=!0;let f=s.join("");L(ke,`Creating RPC '${e}' stream ${i}: ${f}`,u);let m=a.createWebChannel(f,u),g=!1,I=!1,C=new Dh({Fo:P=>{I?L(ke,`Not sending because RPC '${e}' stream ${i} is closed:`,P):(g||(L(ke,`Opening RPC '${e}' stream ${i} transport.`),m.open(),g=!0),L(ke,`RPC '${e}' stream ${i} sending:`,P),m.send(P))},Mo:()=>m.close()}),k=(P,V,F)=>{P.listen(V,B=>{try{F(B)}catch(K){setTimeout(()=>{throw K},0)}})};return k(m,Rn.EventType.OPEN,()=>{I||(L(ke,`RPC '${e}' stream ${i} transport opened.`),C.Qo())}),k(m,Rn.EventType.CLOSE,()=>{I||(I=!0,L(ke,`RPC '${e}' stream ${i} transport closed`),C.Ko())}),k(m,Rn.EventType.ERROR,P=>{I||(I=!0,Ln(ke,`RPC '${e}' stream ${i} transport errored:`,P),C.Ko(new M(O.UNAVAILABLE,"The operation could not be completed")))}),k(m,Rn.EventType.MESSAGE,P=>{var V;if(!I){let F=P.data[0];re(!!F);let B=F,K=(B==null?void 0:B.error)||((V=B[0])===null||V===void 0?void 0:V.error);if(K){L(ke,`RPC '${e}' stream ${i} received error:`,K);let X=K.status,$=function(b){let T=pe[b];if(T!==void 0)return rb(T)}(X),E=K.message;$===void 0&&($=O.INTERNAL,E="Unknown error status: "+X+" with message "+K.message),I=!0,C.Ko(new M($,E)),m.close()}else L(ke,`RPC '${e}' stream ${i} received:`,F),C.Uo(F)}}),k(l,yc.STAT_EVENT,P=>{P.stat===pa.PROXY?L(ke,`RPC '${e}' stream ${i} detected buffering proxy`):P.stat===pa.NOPROXY&&L(ke,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{C.$o()},0),C}};Ba=class{constructor(e,t,n=1e3,i=1.5,s=6e4){this.Ti=e,this.timerId=t,this.Go=n,this.zo=i,this.jo=s,this.Ho=0,this.Jo=null,this.Yo=Date.now(),this.reset()}reset(){this.Ho=0}Zo(){this.Ho=this.jo}Xo(e){this.cancel();let t=Math.floor(this.Ho+this.e_()),n=Math.max(0,Date.now()-this.Yo),i=Math.max(0,t-n);i>0&&L("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.Ho} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Jo=this.Ti.enqueueAfterDelay(this.timerId,i,()=>(this.Yo=Date.now(),e())),this.Ho*=this.zo,this.Ho<this.Go&&(this.Ho=this.Go),this.Ho>this.jo&&(this.Ho=this.jo)}t_(){this.Jo!==null&&(this.Jo.skipDelay(),this.Jo=null)}cancel(){this.Jo!==null&&(this.Jo.cancel(),this.Jo=null)}e_(){return(Math.random()-.5)*this.Ho}};iv="PersistentStream",$a=class{constructor(e,t,n,i,s,a,l,u){this.Ti=e,this.n_=n,this.r_=i,this.connection=s,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=l,this.listener=u,this.state=0,this.i_=0,this.s_=null,this.o_=null,this.stream=null,this.__=0,this.a_=new Ba(e,t)}u_(){return this.state===1||this.state===5||this.c_()}c_(){return this.state===2||this.state===3}start(){this.__=0,this.state!==4?this.auth():this.l_()}async stop(){this.u_()&&await this.close(0)}h_(){this.state=0,this.a_.reset()}P_(){this.c_()&&this.s_===null&&(this.s_=this.Ti.enqueueAfterDelay(this.n_,6e4,()=>this.T_()))}I_(e){this.E_(),this.stream.send(e)}async T_(){if(this.c_())return this.close(0)}E_(){this.s_&&(this.s_.cancel(),this.s_=null)}d_(){this.o_&&(this.o_.cancel(),this.o_=null)}async close(e,t){this.E_(),this.d_(),this.a_.cancel(),this.i_++,e!==4?this.a_.reset():t&&t.code===O.RESOURCE_EXHAUSTED?(Nt(t.toString()),Nt("Using maximum backoff delay to prevent overloading the backend."),this.a_.Zo()):t&&t.code===O.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.A_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Lo(t)}A_(){}auth(){this.state=1;let e=this.R_(this.i_),t=this.i_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([n,i])=>{this.i_===t&&this.V_(n,i)},n=>{e(()=>{let i=new M(O.UNKNOWN,"Fetching auth token failed: "+n.message);return this.m_(i)})})}V_(e,t){let n=this.R_(this.i_);this.stream=this.f_(e,t),this.stream.xo(()=>{n(()=>this.listener.xo())}),this.stream.No(()=>{n(()=>(this.state=2,this.o_=this.Ti.enqueueAfterDelay(this.r_,1e4,()=>(this.c_()&&(this.state=3),Promise.resolve())),this.listener.No()))}),this.stream.Lo(i=>{n(()=>this.m_(i))}),this.stream.onMessage(i=>{n(()=>++this.__==1?this.g_(i):this.onNext(i))})}l_(){this.state=5,this.a_.Xo(async()=>{this.state=0,this.start()})}m_(e){return L(iv,`close with error: ${e}`),this.stream=null,this.close(4,e)}R_(e){return t=>{this.Ti.enqueueAndForget(()=>this.i_===e?t():(L(iv,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}},Nh=class extends $a{constructor(e,t,n,i,s,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,i,a),this.serializer=s}f_(e,t){return this.connection.Wo("Listen",e,t)}g_(e){return this.onNext(e)}onNext(e){this.a_.reset();let t=sD(this.serializer,e),n=function(s){if(!("targetChange"in s))return z.min();let a=s.targetChange;return a.targetIds&&a.targetIds.length?z.min():a.readTime?ft(a.readTime):z.min()}(e);return this.listener.p_(t,n)}y_(e){let t={};t.database=ih(this.serializer),t.addTarget=function(s,a){let l,u=a.target;if(l=zc(u)?{documents:lD(s,u)}:{query:uD(s,u).ht},l.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){l.resumeToken=nb(s,a.resumeToken);let h=th(s,a.expectedCount);h!==null&&(l.expectedCount=h)}else if(a.snapshotVersion.compareTo(z.min())>0){l.readTime=Va(s,a.snapshotVersion.toTimestamp());let h=th(s,a.expectedCount);h!==null&&(l.expectedCount=h)}return l}(this.serializer,e);let n=hD(this.serializer,e);n&&(t.labels=n),this.I_(t)}w_(e){let t={};t.database=ih(this.serializer),t.removeTarget=e,this.I_(t)}},Vh=class extends $a{constructor(e,t,n,i,s,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,i,a),this.serializer=s}get S_(){return this.__>0}start(){this.lastStreamToken=void 0,super.start()}A_(){this.S_&&this.b_([])}f_(e,t){return this.connection.Wo("Write",e,t)}g_(e){return re(!!e.streamToken),this.lastStreamToken=e.streamToken,re(!e.writeResults||e.writeResults.length===0),this.listener.D_()}onNext(e){re(!!e.streamToken),this.lastStreamToken=e.streamToken,this.a_.reset();let t=aD(e.writeResults,e.commitTime),n=ft(e.commitTime);return this.listener.v_(n,t)}C_(){let e={};e.database=ih(this.serializer),this.I_(e)}b_(e){let t={streamToken:this.lastStreamToken,writes:e.map(n=>oD(this.serializer,n))};this.I_(t)}};Lh=class{},Mh=class extends Lh{constructor(e,t,n,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=i,this.F_=!1}M_(){if(this.F_)throw new M(O.FAILED_PRECONDITION,"The client has already been terminated.")}So(e,t,n,i){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,a])=>this.connection.So(e,rh(t,n),i,s,a)).catch(s=>{throw s.name==="FirebaseError"?(s.code===O.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new M(O.UNKNOWN,s.toString())})}Co(e,t,n,i,s){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([a,l])=>this.connection.Co(e,rh(t,n),i,a,l,s)).catch(a=>{throw a.name==="FirebaseError"?(a.code===O.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new M(O.UNKNOWN,a.toString())})}terminate(){this.F_=!0,this.connection.terminate()}},Fh=class{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.x_=0,this.O_=null,this.N_=!0}B_(){this.x_===0&&(this.L_("Unknown"),this.O_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.O_=null,this.k_("Backend didn't respond within 10 seconds."),this.L_("Offline"),Promise.resolve())))}q_(e){this.state==="Online"?this.L_("Unknown"):(this.x_++,this.x_>=1&&(this.Q_(),this.k_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.L_("Offline")))}set(e){this.Q_(),this.x_=0,e==="Online"&&(this.N_=!1),this.L_(e)}L_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}k_(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.N_?(Nt(t),this.N_=!1):L("OnlineStateTracker",t)}Q_(){this.O_!==null&&(this.O_.cancel(),this.O_=null)}};Mr="RemoteStore",jh=class{constructor(e,t,n,i,s){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.K_=[],this.U_=new Map,this.W_=new Set,this.G_=[],this.z_=s,this.z_.To(a=>{n.enqueueAndForget(async()=>{Fr(this)&&(L(Mr,"Restarting streams for network reachability change."),await async function(u){let h=q(u);h.W_.add(4),await As(h),h.j_.set("Unknown"),h.W_.delete(4),await hl(h)}(this))})}),this.j_=new Fh(n,i)}};Uh=class r{constructor(e,t,n,i,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=s,this.deferred=new ct,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(a=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,i,s){let a=Date.now()+n,l=new r(e,t,a,i,s);return l.start(n),l}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new M(O.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)}};za=class r{static emptySet(e){return new r(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||U.comparator(t.key,n.key):(t,n)=>U.comparator(t.key,n.key),this.keyedMap=ss(),this.sortedSet=new de(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 i=t.getNext().key,s=n.getNext().key;if(!i.isEqual(s))return!1}return!0}toString(){let e=[];return this.forEach(t=>{e.push(t.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
|
|
19
19
|
`+e.join(`
|
|
20
20
|
`)+`
|
|
21
|
-
)`}copy(e,t){let n=new r;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}};var $o=class{constructor(){this.Z_=new le(j.comparator)}track(e){let t=e.doc.key,n=this.Z_.get(t);n?e.type!==0&&n.type===3?this.Z_=this.Z_.insert(t,e):e.type===3&&n.type!==1?this.Z_=this.Z_.insert(t,{type:n.type,doc:e.doc}):e.type===2&&n.type===2?this.Z_=this.Z_.insert(t,{type:2,doc:e.doc}):e.type===2&&n.type===0?this.Z_=this.Z_.insert(t,{type:0,doc:e.doc}):e.type===1&&n.type===0?this.Z_=this.Z_.remove(t):e.type===1&&n.type===2?this.Z_=this.Z_.insert(t,{type:1,doc:n.doc}):e.type===0&&n.type===1?this.Z_=this.Z_.insert(t,{type:2,doc:e.doc}):F():this.Z_=this.Z_.insert(t,e)}X_(){let e=[];return this.Z_.inorderTraversal((t,n)=>{e.push(n)}),e}},Rn=class r{constructor(e,t,n,s,i,a,u,c,h){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=s,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=u,this.excludesMetadataChanges=c,this.hasCachedResults=h}static fromInitialDocuments(e,t,n,s,i){let a=[];return t.forEach(u=>{a.push({type:0,doc:u})}),new r(e,t,Bo.emptySet(t),a,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)&&ia(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 ol=class{constructor(){this.ea=void 0,this.ta=[]}na(){return this.ta.some(e=>e.ra())}},al=class{constructor(){this.queries=ig(),this.onlineState="Unknown",this.ia=new Set}terminate(){(function(t,n){let s=$(t),i=s.queries;s.queries=ig(),i.forEach((a,u)=>{for(let c of u.ta)c.onError(n)})})(this,new L(D.ABORTED,"Firestore shutting down"))}};function ig(){return new St(r=>qg(r),ia)}async function _y(r,e){let t=$(r),n=3,s=e.query,i=t.queries.get(s);i?!i.na()&&e.ra()&&(n=2):(i=new ol,n=e.ra()?0:1);try{switch(n){case 0:i.ea=await t.onListen(s,!0);break;case 1:i.ea=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(a){let u=jl(a,`Initialization of query '${cn(e.query)}' failed`);return void e.onError(u)}t.queries.set(s,i),i.ta.push(e),e.sa(t.onlineState),i.ea&&e.oa(i.ea)&&Ul(t)}async function vy(r,e){let t=$(r),n=e.query,s=3,i=t.queries.get(n);if(i){let a=i.ta.indexOf(e);a>=0&&(i.ta.splice(a,1),i.ta.length===0?s=e.ra()?0:1:!i.na()&&e.ra()&&(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 XS(r,e){let t=$(r),n=!1;for(let s of e){let i=s.query,a=t.queries.get(i);if(a){for(let u of a.ta)u.oa(s)&&(n=!0);a.ea=s}}n&&Ul(t)}function ZS(r,e,t){let n=$(r),s=n.queries.get(e);if(s)for(let i of s.ta)i.onError(t);n.queries.delete(e)}function Ul(r){r.ia.forEach(e=>{e.next()})}var ul,og;(og=ul||(ul={}))._a="default",og.Cache="cache";var qo=class{constructor(e,t,n){this.query=e,this.aa=t,this.ua=!1,this.ca=null,this.onlineState="Unknown",this.options=n||{}}oa(e){if(!this.options.includeMetadataChanges){let n=[];for(let s of e.docChanges)s.type!==3&&n.push(s);e=new Rn(e.query,e.docs,e.oldDocs,n,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.ua?this.la(e)&&(this.aa.next(e),t=!0):this.ha(e,this.onlineState)&&(this.Pa(e),t=!0),this.ca=e,t}onError(e){this.aa.error(e)}sa(e){this.onlineState=e;let t=!1;return this.ca&&!this.ua&&this.ha(this.ca,e)&&(this.Pa(this.ca),t=!0),t}ha(e,t){if(!e.fromCache||!this.ra())return!0;let n=t!=="Offline";return(!this.options.Ta||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}la(e){if(e.docChanges.length>0)return!0;let t=this.ca&&this.ca.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}Pa(e){e=Rn.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.ua=!0,this.aa.next(e)}ra(){return this.options.source!==ul.Cache}};var zo=class{constructor(e){this.key=e}},Go=class{constructor(e){this.key=e}},cl=class{constructor(e,t){this.query=e,this.fa=t,this.ga=null,this.hasCachedResults=!1,this.current=!1,this.pa=H(),this.mutatedKeys=H(),this.ya=zg(e),this.wa=new Bo(this.ya)}get Sa(){return this.fa}ba(e,t){let n=t?t.Da:new $o,s=t?t.wa:this.wa,i=t?t.mutatedKeys:this.mutatedKeys,a=s,u=!1,c=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,h=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((f,m)=>{let g=s.get(f),E=oa(this.query,m)?m:null,P=!!g&&this.mutatedKeys.has(g.key),C=!!E&&(E.hasLocalMutations||this.mutatedKeys.has(E.key)&&E.hasCommittedMutations),R=!1;g&&E?g.data.isEqual(E.data)?P!==C&&(n.track({type:3,doc:E}),R=!0):this.va(g,E)||(n.track({type:2,doc:E}),R=!0,(c&&this.ya(E,c)>0||h&&this.ya(E,h)<0)&&(u=!0)):!g&&E?(n.track({type:0,doc:E}),R=!0):g&&!E&&(n.track({type:1,doc:g}),R=!0,(c||h)&&(u=!0)),R&&(E?(a=a.add(E),i=C?i.add(f):i.delete(f)):(a=a.delete(f),i=i.delete(f)))}),this.query.limit!==null)for(;a.size>this.query.limit;){let f=this.query.limitType==="F"?a.last():a.first();a=a.delete(f.key),i=i.delete(f.key),n.track({type:1,doc:f})}return{wa:a,Da:n,ls:u,mutatedKeys:i}}va(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,s){let i=this.wa;this.wa=e.wa,this.mutatedKeys=e.mutatedKeys;let a=e.Da.X_();a.sort((f,m)=>function(E,P){let C=R=>{switch(R){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return F()}};return C(E)-C(P)}(f.type,m.type)||this.ya(f.doc,m.doc)),this.Ca(n),s=s!=null&&s;let u=t&&!s?this.Fa():[],c=this.pa.size===0&&this.current&&!s?1:0,h=c!==this.ga;return this.ga=c,a.length!==0||h?{snapshot:new Rn(this.query,e.wa,i,a,e.mutatedKeys,c===0,h,!1,!!n&&n.resumeToken.approximateByteSize()>0),Ma:u}:{Ma:u}}sa(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({wa:this.wa,Da:new $o,mutatedKeys:this.mutatedKeys,ls:!1},!1)):{Ma:[]}}xa(e){return!this.fa.has(e)&&!!this.wa.has(e)&&!this.wa.get(e).hasLocalMutations}Ca(e){e&&(e.addedDocuments.forEach(t=>this.fa=this.fa.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.fa=this.fa.delete(t)),this.current=e.current)}Fa(){if(!this.current)return[];let e=this.pa;this.pa=H(),this.wa.forEach(n=>{this.xa(n.key)&&(this.pa=this.pa.add(n.key))});let t=[];return e.forEach(n=>{this.pa.has(n)||t.push(new Go(n))}),this.pa.forEach(n=>{e.has(n)||t.push(new zo(n))}),t}Oa(e){this.fa=e.gs,this.pa=H();let t=this.ba(e.documents);return this.applyChanges(t,!0)}Na(){return Rn.fromInitialDocuments(this.query,this.wa,this.mutatedKeys,this.ga===0,this.hasCachedResults)}},Bl="SyncEngine",ll=class{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}},hl=class{constructor(e){this.key=e,this.Ba=!1}},dl=class{constructor(e,t,n,s,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.La={},this.ka=new St(u=>qg(u),ia),this.qa=new Map,this.Qa=new Set,this.$a=new le(j.comparator),this.Ka=new Map,this.Ua=new Vs,this.Wa={},this.Ga=new Map,this.za=Ns.Un(),this.onlineState="Unknown",this.ja=void 0}get isPrimaryClient(){return this.ja===!0}};async function eR(r,e,t=!0){let n=xy(r),s,i=n.ka.get(e);return i?(n.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.Na()):s=await wy(n,e,t,!0),s}async function tR(r,e){let t=xy(r);await wy(t,e,!0,!1)}async function wy(r,e,t,n){let s=await FS(r.localStore,rt(e)),i=s.targetId,a=r.sharedClientState.addLocalQueryTarget(i,t),u;return n&&(u=await rR(r,e,i,a==="current",s.resumeToken)),r.isPrimaryClient&&t&&dy(r.remoteStore,s),u}async function rR(r,e,t,n,s){r.Ha=(m,g,E)=>async function(C,R,N,M){let U=R.view.ba(N);U.ls&&(U=await tg(C.localStore,R.query,!1).then(({documents:T})=>R.view.ba(T,U)));let G=M&&M.targetChanges.get(R.targetId),Y=M&&M.targetMismatches.get(R.targetId)!=null,B=R.view.applyChanges(U,C.isPrimaryClient,G,Y);return ug(C,R.targetId,B.Ma),B.snapshot}(r,m,g,E);let i=await tg(r.localStore,e,!0),a=new cl(e,i.gs),u=a.ba(i.documents),c=Ds.createSynthesizedTargetChangeForCurrentChange(t,n&&r.onlineState!=="Offline",s),h=a.applyChanges(u,r.isPrimaryClient,c);ug(r,t,h.Ma);let f=new ll(e,t,a);return r.ka.set(e,f),r.qa.has(t)?r.qa.get(t).push(e):r.qa.set(t,[e]),h.snapshot}async function nR(r,e,t){let n=$(r),s=n.ka.get(e),i=n.qa.get(s.targetId);if(i.length>1)return n.qa.set(s.targetId,i.filter(a=>!ia(a,e))),void n.ka.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(s.targetId),n.sharedClientState.isActiveQueryTarget(s.targetId)||await Kc(n.localStore,s.targetId,!1).then(()=>{n.sharedClientState.clearQueryState(s.targetId),t&&Vl(n.remoteStore,s.targetId),fl(n,s.targetId)}).catch(Dn)):(fl(n,s.targetId),await Kc(n.localStore,s.targetId,!0))}async function sR(r,e){let t=$(r),n=t.ka.get(e),s=t.qa.get(n.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(n.targetId),Vl(t.remoteStore,n.targetId))}async function iR(r,e,t){let n=dR(r);try{let s=await function(a,u){let c=$(a),h=be.now(),f=u.reduce((E,P)=>E.add(P.key),H()),m,g;return c.persistence.runTransaction("Locally write mutations","readwrite",E=>{let P=Rt(),C=H();return c.ds.getEntries(E,f).next(R=>{P=R,P.forEach((N,M)=>{M.isValidDocument()||(C=C.add(N))})}).next(()=>c.localDocuments.getOverlayedDocuments(E,P)).next(R=>{m=R;let N=[];for(let M of u){let U=cS(M,m.get(M.key).overlayedDocument);U!=null&&N.push(new at(M.key,U,Mg(U.value.mapValue),Jt.exists(!0)))}return c.mutationQueue.addMutationBatch(E,h,N,u)}).next(R=>{g=R;let N=R.applyToLocalDocumentSet(m,C);return c.documentOverlayCache.saveOverlays(E,R.batchId,N)})}).then(()=>({batchId:g.batchId,changes:Kg(m)}))}(n.localStore,e);n.sharedClientState.addPendingMutation(s.batchId),function(a,u,c){let h=a.Wa[a.currentUser.toKey()];h||(h=new le(Q)),h=h.insert(u,c),a.Wa[a.currentUser.toKey()]=h}(n,s.batchId,t),await zs(n,s.changes),await ca(n.remoteStore)}catch(s){let i=jl(s,"Failed to persist write");t.reject(i)}}async function by(r,e){let t=$(r);try{let n=await VS(t.localStore,e);e.targetChanges.forEach((s,i)=>{let a=t.Ka.get(i);a&&(ee(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1),s.addedDocuments.size>0?a.Ba=!0:s.modifiedDocuments.size>0?ee(a.Ba):s.removedDocuments.size>0&&(ee(a.Ba),a.Ba=!1))}),await zs(t,n,e)}catch(n){await Dn(n)}}function ag(r,e,t){let n=$(r);if(n.isPrimaryClient&&t===0||!n.isPrimaryClient&&t===1){let s=[];n.ka.forEach((i,a)=>{let u=a.view.sa(e);u.snapshot&&s.push(u.snapshot)}),function(a,u){let c=$(a);c.onlineState=u;let h=!1;c.queries.forEach((f,m)=>{for(let g of m.ta)g.sa(u)&&(h=!0)}),h&&Ul(c)}(n.eventManager,e),s.length&&n.La.p_(s),n.onlineState=e,n.isPrimaryClient&&n.sharedClientState.setOnlineState(e)}}async function oR(r,e,t){let n=$(r);n.sharedClientState.updateQueryState(e,"rejected",t);let s=n.Ka.get(e),i=s&&s.key;if(i){let a=new le(j.comparator);a=a.insert(i,We.newNoDocument(i,q.min()));let u=H().add(i),c=new Ro(q.min(),new Map,new le(Q),a,u);await by(n,c),n.$a=n.$a.remove(i),n.Ka.delete(e),$l(n)}else await Kc(n.localStore,e,!1).then(()=>fl(n,e,t)).catch(Dn)}async function aR(r,e){let t=$(r),n=e.batch.batchId;try{let s=await NS(t.localStore,e);Ey(t,n,null),Ty(t,n),t.sharedClientState.updateMutationState(n,"acknowledged"),await zs(t,s)}catch(s){await Dn(s)}}async function uR(r,e,t){let n=$(r);try{let s=await function(a,u){let c=$(a);return c.persistence.runTransaction("Reject batch","readwrite-primary",h=>{let f;return c.mutationQueue.lookupMutationBatch(h,u).next(m=>(ee(m!==null),f=m.keys(),c.mutationQueue.removeMutationBatch(h,m))).next(()=>c.mutationQueue.performConsistencyCheck(h)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(h,f,u)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(h,f)).next(()=>c.localDocuments.getDocuments(h,f))})}(n.localStore,e);Ey(n,e,t),Ty(n,e),n.sharedClientState.updateMutationState(e,"rejected",t),await zs(n,s)}catch(s){await Dn(s)}}function Ty(r,e){(r.Ga.get(e)||[]).forEach(t=>{t.resolve()}),r.Ga.delete(e)}function Ey(r,e,t){let n=$(r),s=n.Wa[n.currentUser.toKey()];if(s){let i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),n.Wa[n.currentUser.toKey()]=s}}function fl(r,e,t=null){r.sharedClientState.removeLocalQueryTarget(e);for(let n of r.qa.get(e))r.ka.delete(n),t&&r.La.Ja(n,t);r.qa.delete(e),r.isPrimaryClient&&r.Ua.br(e).forEach(n=>{r.Ua.containsKey(n)||Iy(r,n)})}function Iy(r,e){r.Qa.delete(e.path.canonicalString());let t=r.$a.get(e);t!==null&&(Vl(r.remoteStore,t),r.$a=r.$a.remove(e),r.Ka.delete(t),$l(r))}function ug(r,e,t){for(let n of t)n instanceof zo?(r.Ua.addReference(n.key,e),cR(r,n)):n instanceof Go?(V(Bl,"Document no longer in limbo: "+n.key),r.Ua.removeReference(n.key,e),r.Ua.containsKey(n.key)||Iy(r,n.key)):F()}function cR(r,e){let t=e.key,n=t.path.canonicalString();r.$a.get(t)||r.Qa.has(n)||(V(Bl,"New document in limbo: "+t),r.Qa.add(n),$l(r))}function $l(r){for(;r.Qa.size>0&&r.$a.size<r.maxConcurrentLimboResolutions;){let e=r.Qa.values().next().value;r.Qa.delete(e);let t=new j(pe.fromString(e)),n=r.za.next();r.Ka.set(n,new hl(t)),r.$a=r.$a.insert(t,n),dy(r.remoteStore,new Os(rt(sa(t.path)),n,"TargetPurposeLimboResolution",yn.ae))}}async function zs(r,e,t){let n=$(r),s=[],i=[],a=[];n.ka.isEmpty()||(n.ka.forEach((u,c)=>{a.push(n.Ha(c,e,t).then(h=>{var f;if((h||t)&&n.isPrimaryClient){let m=h?!h.fromCache:(f=t==null?void 0:t.targetChanges.get(c.targetId))===null||f===void 0?void 0:f.current;n.sharedClientState.updateQueryState(c.targetId,m?"current":"not-current")}if(h){s.push(h);let m=$c.Yi(c.targetId,h);i.push(m)}}))}),await Promise.all(a),n.La.p_(s),await async function(c,h){let f=$(c);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",m=>k.forEach(h,g=>k.forEach(g.Hi,E=>f.persistence.referenceDelegate.addReference(m,g.targetId,E)).next(()=>k.forEach(g.Ji,E=>f.persistence.referenceDelegate.removeReference(m,g.targetId,E)))))}catch(m){if(!On(m))throw m;V(Nl,"Failed to update sequence numbers: "+m)}for(let m of h){let g=m.targetId;if(!m.fromCache){let E=f.Ts.get(g),P=E.snapshotVersion,C=E.withLastLimboFreeSnapshotVersion(P);f.Ts=f.Ts.insert(g,C)}}}(n.localStore,i))}async function lR(r,e){let t=$(r);if(!t.currentUser.isEqual(e)){V(Bl,"User change. New user:",e.toKey());let n=await ly(t.localStore,e);t.currentUser=e,function(i,a){i.Ga.forEach(u=>{u.forEach(c=>{c.reject(new L(D.CANCELLED,a))})}),i.Ga.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,n.removedBatchIds,n.addedBatchIds),await zs(t,n.Rs)}}function hR(r,e){let t=$(r),n=t.Ka.get(e);if(n&&n.Ba)return H().add(n.key);{let s=H(),i=t.qa.get(e);if(!i)return s;for(let a of i){let u=t.ka.get(a);s=s.unionWith(u.view.Sa)}return s}}function xy(r){let e=$(r);return e.remoteStore.remoteSyncer.applyRemoteEvent=by.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=hR.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=oR.bind(null,e),e.La.p_=XS.bind(null,e.eventManager),e.La.Ja=ZS.bind(null,e.eventManager),e}function dR(r){let e=$(r);return e.remoteStore.remoteSyncer.applySuccessfulWrite=aR.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=uR.bind(null,e),e}var Pn=class{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=aa(e.databaseInfo.databaseId),this.sharedClientState=this.Za(e),this.persistence=this.Xa(e),await this.persistence.start(),this.localStore=this.eu(e),this.gcScheduler=this.tu(e,this.localStore),this.indexBackfillerScheduler=this.nu(e,this.localStore)}tu(e,t){return null}nu(e,t){return null}eu(e){return OS(this.persistence,new zc,e.initialUser,this.serializer)}Xa(e){return new No(Bc.ri,this.serializer)}Za(e){return new Hc}async terminate(){var e,t;(e=this.gcScheduler)===null||e===void 0||e.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}};Pn.provider={build:()=>new Pn};var pl=class extends Pn{constructor(e){super(),this.cacheSizeBytes=e}tu(e,t){ee(this.persistence.referenceDelegate instanceof Vo);let n=this.persistence.referenceDelegate.garbageCollector;return new Rc(n,e.asyncQueue,t)}Xa(e){let t=this.cacheSizeBytes!==void 0?$e.withCacheSize(this.cacheSizeBytes):$e.DEFAULT;return new No(n=>Vo.ri(n,t),this.serializer)}};var Ls=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=>ag(this.syncEngine,n,1),this.remoteStore.remoteSyncer.handleCredentialChange=lR.bind(null,this.syncEngine),await YS(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new al}()}createDatastore(e){let t=aa(e.databaseInfo.databaseId),n=function(i){return new Xc(i)}(e.databaseInfo);return function(i,a,u,c){return new rl(i,a,u,c)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(n,s,i,a,u){return new sl(n,s,i,a,u)}(this.localStore,this.datastore,e.asyncQueue,t=>ag(this.syncEngine,t,0),function(){return Mo.D()?new Mo:new Wc}())}createSyncEngine(e,t){return function(s,i,a,u,c,h,f){let m=new dl(s,i,a,u,c,h);return f&&(m.ja=!0),m}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(s){let i=$(s);V(br,"RemoteStore shutting down."),i.W_.add(5),await qs(i),i.z_.shutdown(),i.j_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}};Ls.provider={build:()=>new Ls};var Ko=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.iu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.iu(this.observer.error,e):It("Uncaught Error in snapshot listener:",e.toString()))}su(){this.muted=!0}iu(e,t){setTimeout(()=>{this.muted||e(t)},0)}};var Zt="FirestoreClient",ml=class{constructor(e,t,n,s,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=s,this.user=_e.UNAUTHENTICATED,this.clientId=wo.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(n,async a=>{V(Zt,"Received user=",a.uid),await this.authCredentialListener(a),this.user=a}),this.appCheckCredentials.start(n,a=>(V(Zt,"Received new app check token=",a),this.appCheckCredentialListener(a,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 et;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=jl(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}};async function $u(r,e){r.asyncQueue.verifyOperationInProgress(),V(Zt,"Initializing OfflineComponentProvider");let t=r.configuration;await e.initialize(t);let n=t.initialUser;r.setCredentialChangeListener(async s=>{n.isEqual(s)||(await ly(e.localStore,s),n=s)}),e.persistence.setDatabaseDeletedListener(()=>r.terminate()),r._offlineComponents=e}async function cg(r,e){r.asyncQueue.verifyOperationInProgress();let t=await fR(r);V(Zt,"Initializing OnlineComponentProvider"),await e.initialize(t,r.configuration),r.setCredentialChangeListener(n=>sg(e.remoteStore,n)),r.setAppCheckTokenChangeListener((n,s)=>sg(e.remoteStore,s)),r._onlineComponents=e}async function fR(r){if(!r._offlineComponents)if(r._uninitializedComponentsProvider){V(Zt,"Using user provided OfflineComponentProvider");try{await $u(r,r._uninitializedComponentsProvider._offline)}catch(e){let t=e;if(!function(s){return s.name==="FirebaseError"?s.code===D.FAILED_PRECONDITION||s.code===D.UNIMPLEMENTED:!(typeof DOMException!="undefined"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11}(t))throw t;mn("Error using user provided cache. Falling back to memory cache: "+t),await $u(r,new Pn)}}else V(Zt,"Using default OfflineComponentProvider"),await $u(r,new pl(void 0));return r._offlineComponents}async function Ay(r){return r._onlineComponents||(r._uninitializedComponentsProvider?(V(Zt,"Using user provided OnlineComponentProvider"),await cg(r,r._uninitializedComponentsProvider._online)):(V(Zt,"Using default OnlineComponentProvider"),await cg(r,new Ls))),r._onlineComponents}function pR(r){return Ay(r).then(e=>e.syncEngine)}async function gl(r){let e=await Ay(r),t=e.eventManager;return t.onListen=eR.bind(null,e.syncEngine),t.onUnlisten=nR.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=tR.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=sR.bind(null,e.syncEngine),t}function mR(r,e,t={}){let n=new et;return r.asyncQueue.enqueueAndForget(async()=>function(i,a,u,c,h){let f=new Ko({next:g=>{f.su(),a.enqueueAndForget(()=>vy(i,m));let E=g.docs.has(u);!E&&g.fromCache?h.reject(new L(D.UNAVAILABLE,"Failed to get document because the client is offline.")):E&&g.fromCache&&c&&c.source==="server"?h.reject(new L(D.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.)')):h.resolve(g)},error:g=>h.reject(g)}),m=new qo(sa(u.path),f,{includeMetadataChanges:!0,Ta:!0});return _y(i,m)}(await gl(r),r.asyncQueue,e,t,n)),n.promise}function Sy(r){let e={};return r.timeoutSeconds!==void 0&&(e.timeoutSeconds=r.timeoutSeconds),e}var lg=new Map;function gR(r,e,t){if(!t)throw new L(D.INVALID_ARGUMENT,`Function ${r}() cannot be called with an empty ${e}.`)}function yR(r,e,t,n){if(e===!0&&n===!0)throw new L(D.INVALID_ARGUMENT,`${r} and ${t} cannot be used together.`)}function hg(r){if(!j.isDocumentKey(r))throw new L(D.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${r} has ${r.length}.`)}function ql(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":F()}function st(r,e){if("_delegate"in r&&(r=r._delegate),!(r instanceof e)){if(e.name===r.constructor.name)throw new L(D.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let t=ql(r);throw new L(D.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return r}var Ry="firestore.googleapis.com",dg=!0,Ho=class{constructor(e){var t,n;if(e.host===void 0){if(e.ssl!==void 0)throw new L(D.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Ry,this.ssl=dg}else this.host=e.host,this.ssl=(t=e.ssl)!==null&&t!==void 0?t:dg;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=cy;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<CS)throw new L(D.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}yR("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=Sy((n=e.experimentalLongPollingOptions)!==null&&n!==void 0?n:{}),function(i){if(i.timeoutSeconds!==void 0){if(isNaN(i.timeoutSeconds))throw new L(D.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (must not be NaN)`);if(i.timeoutSeconds<5)throw new L(D.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (minimum allowed value is 5)`);if(i.timeoutSeconds>30)throw new L(D.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}},Ms=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 Ho({}),this._settingsFrozen=!1,this._terminateTask="notTerminated"}get app(){if(!this._app)throw new L(D.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 L(D.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 Ho(e),e.credentials!==void 0&&(this._authCredentials=function(n){if(!n)return new qu;switch(n.type){case"firstParty":return new Hu(n.sessionIndex||"0",n.iamToken||null,n.authTokenFactory||null);case"provider":return n.client;default:throw new L(D.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_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=lg.get(t);n&&(V("ComponentProvider","Removing Datastore"),lg.delete(t),n.terminate())}(this),Promise.resolve()}};function _R(r,e,t,n={}){var s;let i=(r=st(r,Ms))._getSettings(),a=`${e}:${t}`;if(i.host!==Ry&&i.host!==a&&mn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),r._setSettings(Object.assign(Object.assign({},i),{host:a,ssl:!1})),n.mockUserToken){let u,c;if(typeof n.mockUserToken=="string")u=n.mockUserToken,c=_e.MOCK_USER;else{u=sm(n.mockUserToken,(s=r._app)===null||s===void 0?void 0:s.options.projectId);let h=n.mockUserToken.sub||n.mockUserToken.user_id;if(!h)throw new L(D.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");c=new _e(h)}r._authCredentials=new zu(new _o(u,c))}}var Wo=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)}},Ve=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 Fs(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new r(this.firestore,e,this._key)}},Fs=class r extends Wo{constructor(e,t,n){super(e,t,sa(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 Ve(this.firestore,null,new j(e))}withConverter(e){return new r(this.firestore,e,this._path)}};function la(r,e,...t){if(r=vt(r),arguments.length===1&&(e=wo.newId()),gR("doc","path",e),r instanceof Ms){let n=pe.fromString(e,...t);return hg(n),new Ve(r,null,new j(n))}{if(!(r instanceof Ve||r instanceof Fs))throw new L(D.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let n=r._path.child(pe.fromString(e,...t));return hg(n),new Ve(r.firestore,r instanceof Fs?r.converter:null,new j(n))}}var fg="AsyncQueue",Qo=class{constructor(e=Promise.resolve()){this.Vu=[],this.mu=!1,this.fu=[],this.gu=null,this.pu=!1,this.yu=!1,this.wu=[],this.a_=new Fo(this,"async_queue_retry"),this.Su=()=>{let n=Bu();n&&V(fg,"Visibility state changed to "+n.visibilityState),this.a_.t_()},this.bu=e;let t=Bu();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.Su)}get isShuttingDown(){return this.mu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Du(),this.vu(e)}enterRestrictedMode(e){if(!this.mu){this.mu=!0,this.yu=e||!1;let t=Bu();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Su)}}enqueue(e){if(this.Du(),this.mu)return new Promise(()=>{});let t=new et;return this.vu(()=>this.mu&&this.yu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Vu.push(e),this.Cu()))}async Cu(){if(this.Vu.length!==0){try{await this.Vu[0](),this.Vu.shift(),this.a_.reset()}catch(e){if(!On(e))throw e;V(fg,"Operation failed with retryable error: "+e)}this.Vu.length>0&&this.a_.Xo(()=>this.Cu())}}vu(e){let t=this.bu.then(()=>(this.pu=!0,e().catch(n=>{this.gu=n,this.pu=!1;let s=function(a){let u=a.message||"";return a.stack&&(u=a.stack.includes(a.message)?a.stack:a.message+`
|
|
22
|
-
`+a.stack),u}(n);throw It("INTERNAL UNHANDLED ERROR: ",s),n}).then(n=>(this.pu=!1,n))));return this.bu=t,t}enqueueAfterDelay(e,t,n){this.Du(),this.wu.indexOf(e)>-1&&(t=0);let s=il.createAndSchedule(this,e,t,n,i=>this.Fu(i));return this.fu.push(s),s}Du(){this.gu&&F()}verifyOperationInProgress(){}async Mu(){let e;do e=this.bu,await e;while(e!==this.bu)}xu(e){for(let t of this.fu)if(t.timerId===e)return!0;return!1}Ou(e){return this.Mu().then(()=>{this.fu.sort((t,n)=>t.targetTimeMs-n.targetTimeMs);for(let t of this.fu)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.Mu()})}Nu(e){this.wu.push(e)}Fu(e){let t=this.fu.indexOf(e);this.fu.splice(t,1)}};function pg(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 er=class extends Ms{constructor(e,t,n,s){super(e,t,n,s),this.type="firestore",this._queue=new Qo,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new Qo(e),this._firestoreClient=void 0,await e}}};function Py(r,e){let t=typeof r=="object"?r:Em(),n=typeof r=="string"?r:e||Io,s=wm(t,"firestore").getImmediate({identifier:n});if(!s._initialized){let i=nm("firestore");i&&_R(s,...i)}return s}function zl(r){if(r._terminated)throw new L(D.FAILED_PRECONDITION,"The client has already been terminated.");return r._firestoreClient||vR(r),r._firestoreClient}function vR(r){var e,t,n;let s=r._freezeSettings(),i=function(u,c,h,f){return new Yu(u,c,h,f.host,f.ssl,f.experimentalForceLongPolling,f.experimentalAutoDetectLongPolling,Sy(f.experimentalLongPollingOptions),f.useFetchStreams)}(r._databaseId,((e=r._app)===null||e===void 0?void 0:e.options.appId)||"",r._persistenceKey,s);r._componentsProvider||!((t=s.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((n=s.localCache)===null||n===void 0)&&n._onlineComponentProvider)&&(r._componentsProvider={_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider}),r._firestoreClient=new ml(r._authCredentials,r._appCheckCredentials,r._queue,i,r._componentsProvider&&function(u){let c=u==null?void 0:u._online.build();return{_offline:u==null?void 0:u._offline.build(c),_online:c}}(r._componentsProvider))}var js=class r{constructor(e){this._byteString=e}static fromBase64String(e){try{return new r(Pe.fromBase64String(e))}catch(t){throw new L(D.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new r(Pe.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)}};var Cn=class{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new L(D.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Ue(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};var Us=class{constructor(e){this._methodName=e}};var Bs=class{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new L(D.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new L(D.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}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return Q(this._lat,e._lat)||Q(this._long,e._long)}};var $s=class{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)}};var wR=/^__.*__$/,yl=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return this.fieldMask!==null?new at(e,this.data,this.fieldMask,t,this.fieldTransforms):new wr(e,this.data,t,this.fieldTransforms)}},Jo=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new at(e,this.data,this.fieldMask,t,this.fieldTransforms)}};function Cy(r){switch(r){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw F()}}var _l=class r{constructor(e,t,n,s,i,a){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=s,i===void 0&&this.Bu(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get Lu(){return this.settings.Lu}ku(e){return new r(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}qu(e){var t;let n=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.ku({path:n,Qu:!1});return s.$u(e),s}Ku(e){var t;let n=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.ku({path:n,Qu:!1});return s.Bu(),s}Uu(e){return this.ku({path:void 0,Qu:!0})}Wu(e){return Xo(e,this.settings.methodName,this.settings.Gu||!1,this.path,this.settings.zu)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}Bu(){if(this.path)for(let e=0;e<this.path.length;e++)this.$u(this.path.get(e))}$u(e){if(e.length===0)throw this.Wu("Document fields must not be empty");if(Cy(this.Lu)&&wR.test(e))throw this.Wu('Document fields cannot begin and end with "__"')}},vl=class{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||aa(e)}ju(e,t,n,s=!1){return new _l({Lu:e,methodName:t,zu:n,path:Ue.emptyPath(),Qu:!1,Gu:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function ky(r){let e=r._freezeSettings(),t=aa(r._databaseId);return new vl(r._databaseId,!!e.ignoreUndefinedProperties,t)}function bR(r,e,t,n,s,i={}){let a=r.ju(i.merge||i.mergeFields?2:0,e,t,s);Gl("Data must be an object, but it was:",a,n);let u=Dy(n,a),c,h;if(i.merge)c=new qe(a.fieldMask),h=a.fieldTransforms;else if(i.mergeFields){let f=[];for(let m of i.mergeFields){let g=wl(e,m,t);if(!a.contains(g))throw new L(D.INVALID_ARGUMENT,`Field '${g}' is specified in your field mask but missing from your input data.`);Ny(f,g)||f.push(g)}c=new qe(f),h=a.fieldTransforms.filter(m=>c.covers(m.field))}else c=null,h=a.fieldTransforms;return new yl(new je(u),c,h)}var Yo=class r extends Us{_toFieldTransform(e){if(e.Lu!==2)throw e.Lu===1?e.Wu(`${this._methodName}() can only appear at the top level of your update data`):e.Wu(`${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 TR(r,e,t,n){let s=r.ju(1,e,t);Gl("Data must be an object, but it was:",s,n);let i=[],a=je.empty();tr(n,(c,h)=>{let f=Kl(e,c,t);h=vt(h);let m=s.Ku(f);if(h instanceof Yo)i.push(f);else{let g=ha(h,m);g!=null&&(i.push(f),a.set(f,g))}});let u=new qe(i);return new Jo(a,u,s.fieldTransforms)}function ER(r,e,t,n,s,i){let a=r.ju(1,e,t),u=[wl(e,n,t)],c=[s];if(i.length%2!=0)throw new L(D.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let g=0;g<i.length;g+=2)u.push(wl(e,i[g])),c.push(i[g+1]);let h=[],f=je.empty();for(let g=u.length-1;g>=0;--g)if(!Ny(h,u[g])){let E=u[g],P=c[g];P=vt(P);let C=a.Ku(E);if(P instanceof Yo)h.push(E);else{let R=ha(P,C);R!=null&&(h.push(E),f.set(E,R))}}let m=new qe(h);return new Jo(f,m,a.fieldTransforms)}function ha(r,e){if(Oy(r=vt(r)))return Gl("Unsupported field value:",e,r),Dy(r,e);if(r instanceof Us)return function(n,s){if(!Cy(s.Lu))throw s.Wu(`${n._methodName}() can only be used with update() and set()`);if(!s.path)throw s.Wu(`${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.Qu&&e.Lu!==4)throw e.Wu("Nested arrays are not supported");return function(n,s){let i=[],a=0;for(let u of n){let c=ha(u,s.Uu(a));c==null&&(c={nullValue:"NULL_VALUE"}),i.push(c),a++}return{arrayValue:{values:i}}}(r,e)}return function(n,s){if((n=vt(n))===null)return{nullValue:"NULL_VALUE"};if(typeof n=="number")return sS(s.serializer,n);if(typeof n=="boolean")return{booleanValue:n};if(typeof n=="string")return{stringValue:n};if(n instanceof Date){let i=be.fromDate(n);return{timestampValue:Do(s.serializer,i)}}if(n instanceof be){let i=new be(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:Do(s.serializer,i)}}if(n instanceof Bs)return{geoPointValue:{latitude:n.latitude,longitude:n.longitude}};if(n instanceof js)return{bytesValue:ry(s.serializer,n._byteString)};if(n instanceof Ve){let i=s.databaseId,a=n.firestore._databaseId;if(!a.isEqual(i))throw s.Wu(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Ol(n.firestore._databaseId||s.databaseId,n._key.path)}}if(n instanceof $s)return function(a,u){return{mapValue:{fields:{[Sl]:{stringValue:Rl},[_n]:{arrayValue:{values:a.toArray().map(h=>{if(typeof h!="number")throw u.Wu("VectorValues must only contain numeric values.");return Dl(u.serializer,h)})}}}}}}(n,s);throw s.Wu(`Unsupported field value: ${ql(n)}`)}(r,e)}function Dy(r,e){let t={};return Pg(r)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):tr(r,(n,s)=>{let i=ha(s,e.qu(n));i!=null&&(t[n]=i)}),{mapValue:{fields:t}}}function Oy(r){return!(typeof r!="object"||r===null||r instanceof Array||r instanceof Date||r instanceof be||r instanceof Bs||r instanceof js||r instanceof Ve||r instanceof Us||r instanceof $s)}function Gl(r,e,t){if(!Oy(t)||!function(s){return typeof s=="object"&&s!==null&&(Object.getPrototypeOf(s)===Object.prototype||Object.getPrototypeOf(s)===null)}(t)){let n=ql(t);throw n==="an object"?e.Wu(r+" a custom object"):e.Wu(r+" "+n)}}function wl(r,e,t){if((e=vt(e))instanceof Cn)return e._internalPath;if(typeof e=="string")return Kl(r,e);throw Xo("Field path arguments must be of type string or ",r,!1,void 0,t)}var IR=new RegExp("[~\\*/\\[\\]]");function Kl(r,e,t){if(e.search(IR)>=0)throw Xo(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,r,!1,void 0,t);try{return new Cn(...e.split("."))._internalPath}catch{throw Xo(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,r,!1,void 0,t)}}function Xo(r,e,t,n,s){let i=n&&!n.isEmpty(),a=s!==void 0,u=`Function ${e}() called with invalid data`;t&&(u+=" (via `toFirestore()`)"),u+=". ";let c="";return(i||a)&&(c+=" (found",i&&(c+=` in field ${n}`),a&&(c+=` in document ${s}`),c+=")"),new L(D.INVALID_ARGUMENT,u+r+c)}function Ny(r,e){return r.some(t=>t.isEqual(e))}var Zo=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 Ve(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new bl(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let t=this._document.data.field(Vy("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}},bl=class extends Zo{data(){return super.data()}};function Vy(r,e){return typeof e=="string"?Kl(r,e):e instanceof Cn?e._internalPath:e._delegate._internalPath}function xR(r){if(r.limitType==="L"&&r.explicitOrderBy.length===0)throw new L(D.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var Tl=class{convertValue(e,t="none"){switch(Yt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return oe(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(At(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 F()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){let n={};return tr(e,(s,i)=>{n[s]=this.convertValue(i,t)}),n}convertVectorValue(e){var t,n,s;let i=(s=(n=(t=e.fields)===null||t===void 0?void 0:t[_n].arrayValue)===null||n===void 0?void 0:n.values)===null||s===void 0?void 0:s.map(a=>oe(a.doubleValue));return new $s(i)}convertGeoPoint(e){return new Bs(oe(e.latitude),oe(e.longitude))}convertArray(e,t){return(e.values||[]).map(n=>this.convertValue(n,t))}convertServerTimestamp(e,t){switch(t){case"previous":let n=na(e);return n==null?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Cs(e));default:return null}}convertTimestamp(e){let t=xt(e);return new be(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=pe.fromString(e);ee(uy(n));let s=new xo(n.get(1),n.get(3)),i=new j(n.popFirst(5));return s.isEqual(t)||It(`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}};function AR(r,e,t){let n;return n=r?t&&(t.merge||t.mergeFields)?r.toFirestore(e,t):r.toFirestore(e):e,n}var mr=class{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},ea=class extends Zo{constructor(e,t,n,s,i,a){super(e,t,n,s,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new pn(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(Vy("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}},pn=class extends ea{data(e={}){return super.data(e)}},El=class{constructor(e,t,n,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new mr(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 pn(this._firestore,this._userDataWriter,n.key,n,new mr(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 L(D.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 a=0;return s._snapshot.docChanges.map(u=>{let c=new pn(s._firestore,s._userDataWriter,u.doc.key,u.doc,new mr(s._snapshot.mutatedKeys.has(u.doc.key),s._snapshot.fromCache),s.query.converter);return u.doc,{type:"added",doc:c,oldIndex:-1,newIndex:a++}})}{let a=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(u=>i||u.type!==3).map(u=>{let c=new pn(s._firestore,s._userDataWriter,u.doc.key,u.doc,new mr(s._snapshot.mutatedKeys.has(u.doc.key),s._snapshot.fromCache),s.query.converter),h=-1,f=-1;return u.type!==0&&(h=a.indexOf(u.doc.key),a=a.delete(u.doc.key)),u.type!==1&&(a=a.add(u.doc),f=a.indexOf(u.doc.key)),{type:SR(u.type),doc:c,oldIndex:h,newIndex:f}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}};function SR(r){switch(r){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return F()}}function Hl(r){r=st(r,Ve);let e=st(r.firestore,er);return mR(zl(e),r._key).then(t=>Uy(e,r,t))}var ta=class extends Tl{constructor(e){super(),this.firestore=e}convertBytes(e){return new js(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);return new Ve(this.firestore,null,t)}};function Ly(r,e,t){r=st(r,Ve);let n=st(r.firestore,er),s=AR(r.converter,e,t);return jy(n,[bR(ky(n),"setDoc",r._key,s,r.converter!==null,t).toMutation(r._key,Jt.none())])}function My(r,e,t,...n){r=st(r,Ve);let s=st(r.firestore,er),i=ky(s),a;return a=typeof(e=vt(e))=="string"||e instanceof Cn?ER(i,"updateDoc",r._key,e,t,n):TR(i,"updateDoc",r._key,e),jy(s,[a.toMutation(r._key,Jt.exists(!0))])}function Fy(r,...e){var t,n,s;r=vt(r);let i={includeMetadataChanges:!1,source:"default"},a=0;typeof e[a]!="object"||pg(e[a])||(i=e[a],a++);let u={includeMetadataChanges:i.includeMetadataChanges,source:i.source};if(pg(e[a])){let m=e[a];e[a]=(t=m.next)===null||t===void 0?void 0:t.bind(m),e[a+1]=(n=m.error)===null||n===void 0?void 0:n.bind(m),e[a+2]=(s=m.complete)===null||s===void 0?void 0:s.bind(m)}let c,h,f;if(r instanceof Ve)h=st(r.firestore,er),f=sa(r._key.path),c={next:m=>{e[a]&&e[a](Uy(h,r,m))},error:e[a+1],complete:e[a+2]};else{let m=st(r,Wo);h=st(m.firestore,er),f=m._query;let g=new ta(h);c={next:E=>{e[a]&&e[a](new El(h,g,m,E))},error:e[a+1],complete:e[a+2]},xR(r._query)}return function(g,E,P,C){let R=new Ko(C),N=new qo(E,R,P);return g.asyncQueue.enqueueAndForget(async()=>_y(await gl(g),N)),()=>{R.su(),g.asyncQueue.enqueueAndForget(async()=>vy(await gl(g),N))}}(zl(h),f,u,c)}function jy(r,e){return function(n,s){let i=new et;return n.asyncQueue.enqueueAndForget(async()=>iR(await pR(n),s,i)),i.promise}(zl(r),e)}function Uy(r,e,t){let n=t.docs.get(e._key),s=new ta(r);return new ea(r,s,e._key,n,new mr(t.hasPendingWrites,t.fromCache),e.converter)}(function(e,t=!0){(function(s){kn=s})(Tm),ws(new wt("firestore",(n,{instanceIdentifier:s,options:i})=>{let a=n.getProvider("app").getImmediate(),u=new er(new Gu(n.getProvider("auth-internal")),new Wu(a,n.getProvider("app-check-internal")),function(h,f){if(!Object.prototype.hasOwnProperty.apply(h.options,["projectId"]))throw new L(D.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new xo(h.options.projectId,f)}(a,s),a);return i=Object.assign({useFetchStreams:t},i),u._setSettings(i),u},"PUBLIC").setMultipleInstances(!0)),Qt(Rm,Pm,e),Qt(Rm,Pm,"esm2017")})();var By=r=>{let e;return r?e=r:typeof fetch=="undefined"?e=(...t)=>Promise.resolve().then(()=>(rr(),Er)).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)};var Gs=class extends Error{constructor(e,t="FunctionsError",n){super(e),this.name=t,this.context=n}},da=class extends Gs{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}},fa=class extends Gs{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}},pa=class extends Gs{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}},ma;(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"})(ma||(ma={}));var DR=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(f){try{h(n.next(f))}catch(m){a(m)}}function c(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?i(f.value):s(f.value).then(u,c)}h((n=n.apply(r,e||[])).next())})},Ks=class{constructor(e,{headers:t={},customFetch:n,region:s=ma.Any}={}){this.url=e,this.headers=t,this.region=s,this.fetch=By(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var n;return DR(this,void 0,void 0,function*(){try{let{headers:s,method:i,body:a}=t,u={},{region:c}=t;c||(c=this.region),c&&c!=="any"&&(u["x-region"]=c);let h;a&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)&&(typeof Blob!="undefined"&&a instanceof Blob||a instanceof ArrayBuffer?(u["Content-Type"]="application/octet-stream",h=a):typeof a=="string"?(u["Content-Type"]="text/plain",h=a):typeof FormData!="undefined"&&a instanceof FormData?h=a:(u["Content-Type"]="application/json",h=JSON.stringify(a)));let f=yield this.fetch(`${this.url}/${e}`,{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},u),this.headers),s),body:h}).catch(P=>{throw new da(P)}),m=f.headers.get("x-relay-error");if(m&&m==="true")throw new fa(f);if(!f.ok)throw new pa(f);let g=((n=f.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),E;return g==="application/json"?E=yield f.json():g==="application/octet-stream"?E=yield f.blob():g==="text/event-stream"?E=f:g==="multipart/form-data"?E=yield f.formData():E=yield f.text(),{data:E,error:null}}catch(s){return{data:null,error:s}}})}};var e_=xd(Zy(),1),{PostgrestClient:t_,PostgrestQueryBuilder:VF,PostgrestFilterBuilder:LF,PostgrestTransformBuilder:MF,PostgrestBuilder:FF,PostgrestError:zR}=e_.default;var r_="2.11.2";var n_={"X-Client-Info":`realtime-js/${r_}`},s_="1.0.0",wa=1e4,i_=1e3,Ir;(function(r){r[r.connecting=0]="connecting",r[r.open=1]="open",r[r.closing=2]="closing",r[r.closed=3]="closed"})(Ir||(Ir={}));var Le;(function(r){r.closed="closed",r.errored="errored",r.joined="joined",r.joining="joining",r.leaving="leaving"})(Le||(Le={}));var Be;(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"})(Be||(Be={}));var va;(function(r){r.websocket="websocket"})(va||(va={}));var nr;(function(r){r.Connecting="connecting",r.Open="open",r.Closing="closing",r.Closed="closed"})(nr||(nr={}));var Zs=class{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){let t=new DataView(e),n=new TextDecoder;return this._decodeBroadcast(e,t,n)}_decodeBroadcast(e,t,n){let s=t.getUint8(1),i=t.getUint8(2),a=this.HEADER_LENGTH+2,u=n.decode(e.slice(a,a+s));a=a+s;let c=n.decode(e.slice(a,a+i));a=a+i;let h=JSON.parse(n.decode(e.slice(a,e.byteLength)));return{ref:null,topic:u,event:c,payload:h}}};var xr=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)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};var ne;(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"})(ne||(ne={}));var uh=(r,e,t={})=>{var n;let s=(n=t.skipTypes)!==null&&n!==void 0?n:[];return Object.keys(e).reduce((i,a)=>(i[a]=GR(a,r,e,s),i),{})},GR=(r,e,t,n)=>{let s=e.find(u=>u.name===r),i=s==null?void 0:s.type,a=t[r];return i&&!n.includes(i)?o_(i,a):ah(a)},o_=(r,e)=>{if(r.charAt(0)==="_"){let t=r.slice(1,r.length);return QR(e,t)}switch(r){case ne.bool:return KR(e);case ne.float4:case ne.float8:case ne.int2:case ne.int4:case ne.int8:case ne.numeric:case ne.oid:return HR(e);case ne.json:case ne.jsonb:return WR(e);case ne.timestamp:return JR(e);case ne.abstime:case ne.date:case ne.daterange:case ne.int4range:case ne.int8range:case ne.money:case ne.reltime:case ne.text:case ne.time:case ne.timestamptz:case ne.timetz:case ne.tsrange:case ne.tstzrange:return ah(e);default:return ah(e)}},ah=r=>r,KR=r=>{switch(r){case"t":return!0;case"f":return!1;default:return r}},HR=r=>{if(typeof r=="string"){let e=parseFloat(r);if(!Number.isNaN(e))return e}return r},WR=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch(e){return console.log(`JSON parse error: ${e}`),r}return r},QR=(r,e)=>{if(typeof r!="string")return r;let t=r.length-1,n=r[t];if(r[0]==="{"&&n==="}"){let i,a=r.slice(1,t);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(u=>o_(e,u))}return r},JR=r=>typeof r=="string"?r.replace(" ","T"):r,ba=r=>{let e=r;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")};var Ar=class{constructor(e,t,n={},s=wa){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 ch;(function(r){r.SYNC="sync",r.JOIN="join",r.LEAVE="leave"})(ch||(ch={}));var Mn=class r{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,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:a,onSync:u}=this.caller;this.joinRef=this.channel._joinRef(),this.state=r.syncState(this.state,s,i,a),this.pendingDiffs.forEach(c=>{this.state=r.syncDiff(this.state,c,i,a)}),this.pendingDiffs=[],u()}),this.channel._on(n.diff,{},s=>{let{onJoin:i,onLeave:a,onSync:u}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=r.syncDiff(this.state,s,i,a),u())}),this.onJoin((s,i,a)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:a})}),this.onLeave((s,i,a)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,n,s){let i=this.cloneDeep(e),a=this.transformState(t),u={},c={};return this.map(i,(h,f)=>{a[h]||(c[h]=f)}),this.map(a,(h,f)=>{let m=i[h];if(m){let g=f.map(R=>R.presence_ref),E=m.map(R=>R.presence_ref),P=f.filter(R=>E.indexOf(R.presence_ref)<0),C=m.filter(R=>g.indexOf(R.presence_ref)<0);P.length>0&&(u[h]=P),C.length>0&&(c[h]=C)}else u[h]=f}),this.syncDiff(i,{joins:u,leaves:c},n,s)}static syncDiff(e,t,n,s){let{joins:i,leaves:a}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return n||(n=()=>{}),s||(s=()=>{}),this.map(i,(u,c)=>{var h;let f=(h=e[u])!==null&&h!==void 0?h:[];if(e[u]=this.cloneDeep(c),f.length>0){let m=e[u].map(E=>E.presence_ref),g=f.filter(E=>m.indexOf(E.presence_ref)<0);e[u].unshift(...g)}n(u,f,c)}),this.map(a,(u,c)=>{let h=e[u];if(!h)return;let f=c.map(m=>m.presence_ref);h=h.filter(m=>f.indexOf(m.presence_ref)<0),e[u]=h,s(u,h,c),h.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 lh;(function(r){r.ALL="*",r.INSERT="INSERT",r.UPDATE="UPDATE",r.DELETE="DELETE"})(lh||(lh={}));var hh;(function(r){r.BROADCAST="broadcast",r.PRESENCE="presence",r.POSTGRES_CHANGES="postgres_changes",r.SYSTEM="system"})(hh||(hh={}));var ut;(function(r){r.SUBSCRIBED="SUBSCRIBED",r.TIMED_OUT="TIMED_OUT",r.CLOSED="CLOSED",r.CHANNEL_ERROR="CHANNEL_ERROR"})(ut||(ut={}));var Fn=class r{constructor(e,t={config:{}},n){this.topic=e,this.params=t,this.socket=n,this.bindings={},this.state=Le.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new Ar(this,Be.join,this.params,this.timeout),this.rejoinTimer=new xr(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Le.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Le.closed,this.socket._remove(this)}),this._onError(s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=Le.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Le.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Be.reply,{},(s,i)=>{this._trigger(this._replyEventName(i),s)}),this.presence=new Mn(this),this.broadcastEndpointURL=ba(this.socket.endPoint)+"/api/broadcast",this.private=this.params.config.private||!1}subscribe(e,t=this.timeout){var n,s;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{let{config:{broadcast:i,presence:a,private:u}}=this.params;this._onError(f=>e==null?void 0:e(ut.CHANNEL_ERROR,f)),this._onClose(()=>e==null?void 0:e(ut.CLOSED));let c={},h={broadcast:i,presence:a,postgres_changes:(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&s!==void 0?s:[],private:u};this.socket.accessTokenValue&&(c.access_token=this.socket.accessTokenValue),this.updateJoinPayload(Object.assign({config:h},c)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:f})=>{var m;if(this.socket.setAuth(),f===void 0){e==null||e(ut.SUBSCRIBED);return}else{let g=this.bindings.postgres_changes,E=(m=g==null?void 0:g.length)!==null&&m!==void 0?m:0,P=[];for(let C=0;C<E;C++){let R=g[C],{filter:{event:N,schema:M,table:U,filter:G}}=R,Y=f&&f[C];if(Y&&Y.event===N&&Y.schema===M&&Y.table===U&&Y.filter===G)P.push(Object.assign(Object.assign({},R),{id:Y.id}));else{this.unsubscribe(),e==null||e(ut.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=P,e&&e(ut.SUBSCRIBED);return}}).receive("error",f=>{e==null||e(ut.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(ut.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._on(e,t,n)}async send(e,t={}){var n,s;if(!this._canPush()&&e.type==="broadcast"){let{event:i,payload:a}=e,c={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{let h=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=t.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=h.body)===null||s===void 0?void 0:s.cancel()),h.ok?"ok":"error"}catch(h){return h.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,u,c;let h=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(u=(a=this.params)===null||a===void 0?void 0:a.config)===null||u===void 0?void 0:u.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),h.receive("ok",()=>i("ok")),h.receive("error",()=>i("error")),h.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Le.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Be.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(n=>{let s=new Ar(this,Be.leave,{},e);s.receive("ok",()=>{t(),n("ok")}).receive("timeout",()=>{t(),n("timed out")}).receive("error",()=>{n("error")}),s.send(),this._canPush()||s.trigger("ok",{})})}async _fetchWithTimeout(e,t,n){let s=new AbortController,i=setTimeout(()=>s.abort(),n),a=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:s.signal}));return clearTimeout(i),a}_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 Ar(this,e,t,n);return this._canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}_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 a=e.toLocaleLowerCase(),{close:u,error:c,leave:h,join:f}=Be;if(n&&[u,c,h,f].indexOf(a)>=0&&n!==this._joinRef())return;let g=this._onMessage(a,t,n);if(t&&!g)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(E=>{var P,C,R;return((P=E.filter)===null||P===void 0?void 0:P.event)==="*"||((R=(C=E.filter)===null||C===void 0?void 0:C.event)===null||R===void 0?void 0:R.toLocaleLowerCase())===a}).map(E=>E.callback(g,n)):(i=this.bindings[a])===null||i===void 0||i.filter(E=>{var P,C,R,N,M,U;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in E){let G=E.id,Y=(P=E.filter)===null||P===void 0?void 0:P.event;return G&&((C=t.ids)===null||C===void 0?void 0:C.includes(G))&&(Y==="*"||(Y==null?void 0:Y.toLocaleLowerCase())===((R=t.data)===null||R===void 0?void 0:R.type.toLocaleLowerCase()))}else{let G=(M=(N=E==null?void 0:E.filter)===null||N===void 0?void 0:N.event)===null||M===void 0?void 0:M.toLocaleLowerCase();return G==="*"||G===((U=t==null?void 0:t.event)===null||U===void 0?void 0:U.toLocaleLowerCase())}else return E.type.toLocaleLowerCase()===a}).map(E=>{if(typeof g=="object"&&"ids"in g){let P=g.data,{schema:C,table:R,commit_timestamp:N,type:M,errors:U}=P;g=Object.assign(Object.assign({},{schema:C,table:R,commit_timestamp:N,eventType:M,new:{},old:{},errors:U}),this._getPayloadRecords(P))}E.callback(g,n)})}_isClosed(){return this.state===Le.closed}_isJoined(){return this.state===Le.joined}_isJoining(){return this.state===Le.joining}_isLeaving(){return this.state===Le.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].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}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Be.close,{},e)}_onError(e){this._on(Be.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Le.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=uh(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=uh(e.columns,e.old_record)),t}};var XR=()=>{},ZR=typeof WebSocket!="undefined",eP=`
|
|
21
|
+
)`}copy(e,t){let n=new r;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}};Ga=class{constructor(){this.Z_=new de(U.comparator)}track(e){let t=e.doc.key,n=this.Z_.get(t);n?e.type!==0&&n.type===3?this.Z_=this.Z_.insert(t,e):e.type===3&&n.type!==1?this.Z_=this.Z_.insert(t,{type:n.type,doc:e.doc}):e.type===2&&n.type===2?this.Z_=this.Z_.insert(t,{type:2,doc:e.doc}):e.type===2&&n.type===0?this.Z_=this.Z_.insert(t,{type:0,doc:e.doc}):e.type===1&&n.type===0?this.Z_=this.Z_.remove(t):e.type===1&&n.type===2?this.Z_=this.Z_.insert(t,{type:1,doc:n.doc}):e.type===0&&n.type===1?this.Z_=this.Z_.insert(t,{type:2,doc:e.doc}):j():this.Z_=this.Z_.insert(t,e)}X_(){let e=[];return this.Z_.inorderTraversal((t,n)=>{e.push(n)}),e}},Qn=class r{constructor(e,t,n,i,s,a,l,u,h){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=s,this.fromCache=a,this.syncStateChanged=l,this.excludesMetadataChanges=u,this.hasCachedResults=h}static fromInitialDocuments(e,t,n,i,s){let a=[];return t.forEach(l=>{a.push({type:0,doc:l})}),new r(e,t,za.emptySet(t),a,n,i,!0,!1,s)}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)&&ll(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 i=0;i<t.length;i++)if(t[i].type!==n[i].type||!t[i].doc.isEqual(n[i].doc))return!1;return!0}};Bh=class{constructor(){this.ea=void 0,this.ta=[]}na(){return this.ta.some(e=>e.ra())}},$h=class{constructor(){this.queries=ov(),this.onlineState="Unknown",this.ia=new Set}terminate(){(function(t,n){let i=q(t),s=i.queries;i.queries=ov(),s.forEach((a,l)=>{for(let u of l.ta)u.onError(n)})})(this,new M(O.ABORTED,"Firestore shutting down"))}};(av=qh||(qh={}))._a="default",av.Cache="cache";Ka=class{constructor(e,t,n){this.query=e,this.aa=t,this.ua=!1,this.ca=null,this.onlineState="Unknown",this.options=n||{}}oa(e){if(!this.options.includeMetadataChanges){let n=[];for(let i of e.docChanges)i.type!==3&&n.push(i);e=new Qn(e.query,e.docs,e.oldDocs,n,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.ua?this.la(e)&&(this.aa.next(e),t=!0):this.ha(e,this.onlineState)&&(this.Pa(e),t=!0),this.ca=e,t}onError(e){this.aa.error(e)}sa(e){this.onlineState=e;let t=!1;return this.ca&&!this.ua&&this.ha(this.ca,e)&&(this.Pa(this.ca),t=!0),t}ha(e,t){if(!e.fromCache||!this.ra())return!0;let n=t!=="Offline";return(!this.options.Ta||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}la(e){if(e.docChanges.length>0)return!0;let t=this.ca&&this.ca.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}Pa(e){e=Qn.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.ua=!0,this.aa.next(e)}ra(){return this.options.source!==qh.Cache}};Ha=class{constructor(e){this.key=e}},Wa=class{constructor(e){this.key=e}},zh=class{constructor(e,t){this.query=e,this.fa=t,this.ga=null,this.hasCachedResults=!1,this.current=!1,this.pa=W(),this.mutatedKeys=W(),this.ya=Gv(e),this.wa=new za(this.ya)}get Sa(){return this.fa}ba(e,t){let n=t?t.Da:new Ga,i=t?t.wa:this.wa,s=t?t.mutatedKeys:this.mutatedKeys,a=i,l=!1,u=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,h=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((f,m)=>{let g=i.get(f),I=ul(this.query,m)?m:null,C=!!g&&this.mutatedKeys.has(g.key),k=!!I&&(I.hasLocalMutations||this.mutatedKeys.has(I.key)&&I.hasCommittedMutations),P=!1;g&&I?g.data.isEqual(I.data)?C!==k&&(n.track({type:3,doc:I}),P=!0):this.va(g,I)||(n.track({type:2,doc:I}),P=!0,(u&&this.ya(I,u)>0||h&&this.ya(I,h)<0)&&(l=!0)):!g&&I?(n.track({type:0,doc:I}),P=!0):g&&!I&&(n.track({type:1,doc:g}),P=!0,(u||h)&&(l=!0)),P&&(I?(a=a.add(I),s=k?s.add(f):s.delete(f)):(a=a.delete(f),s=s.delete(f)))}),this.query.limit!==null)for(;a.size>this.query.limit;){let f=this.query.limitType==="F"?a.last():a.first();a=a.delete(f.key),s=s.delete(f.key),n.track({type:1,doc:f})}return{wa:a,Da:n,ls:l,mutatedKeys:s}}va(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,i){let s=this.wa;this.wa=e.wa,this.mutatedKeys=e.mutatedKeys;let a=e.Da.X_();a.sort((f,m)=>function(I,C){let k=P=>{switch(P){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return j()}};return k(I)-k(C)}(f.type,m.type)||this.ya(f.doc,m.doc)),this.Ca(n),i=i!=null&&i;let l=t&&!i?this.Fa():[],u=this.pa.size===0&&this.current&&!i?1:0,h=u!==this.ga;return this.ga=u,a.length!==0||h?{snapshot:new Qn(this.query,e.wa,s,a,e.mutatedKeys,u===0,h,!1,!!n&&n.resumeToken.approximateByteSize()>0),Ma:l}:{Ma:l}}sa(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({wa:this.wa,Da:new Ga,mutatedKeys:this.mutatedKeys,ls:!1},!1)):{Ma:[]}}xa(e){return!this.fa.has(e)&&!!this.wa.has(e)&&!this.wa.get(e).hasLocalMutations}Ca(e){e&&(e.addedDocuments.forEach(t=>this.fa=this.fa.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.fa=this.fa.delete(t)),this.current=e.current)}Fa(){if(!this.current)return[];let e=this.pa;this.pa=W(),this.wa.forEach(n=>{this.xa(n.key)&&(this.pa=this.pa.add(n.key))});let t=[];return e.forEach(n=>{this.pa.has(n)||t.push(new Wa(n))}),this.pa.forEach(n=>{e.has(n)||t.push(new Ha(n))}),t}Oa(e){this.fa=e.gs,this.pa=W();let t=this.ba(e.documents);return this.applyChanges(t,!0)}Na(){return Qn.fromInitialDocuments(this.query,this.wa,this.mutatedKeys,this.ga===0,this.hasCachedResults)}},Td="SyncEngine",Gh=class{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}},Kh=class{constructor(e){this.key=e,this.Ba=!1}},Hh=class{constructor(e,t,n,i,s,a){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=a,this.La={},this.ka=new Mt(l=>zv(l),ll),this.qa=new Map,this.Qa=new Set,this.$a=new de(U.comparator),this.Ka=new Map,this.Ua=new ys,this.Wa={},this.Ga=new Map,this.za=gs.Un(),this.onlineState="Unknown",this.ja=void 0}get isPrimaryClient(){return this.ja===!0}};Jn=class{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=cl(e.databaseInfo.databaseId),this.sharedClientState=this.Za(e),this.persistence=this.Xa(e),await this.persistence.start(),this.localStore=this.eu(e),this.gcScheduler=this.tu(e,this.localStore),this.indexBackfillerScheduler=this.nu(e,this.localStore)}tu(e,t){return null}nu(e,t){return null}eu(e){return vD(this.persistence,new Ah,e.initialUser,this.serializer)}Xa(e){return new Ma(Th.ri,this.serializer)}Za(e){return new Rh}async terminate(){var e,t;(e=this.gcScheduler)===null||e===void 0||e.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}};Jn.provider={build:()=>new Jn};Qh=class extends Jn{constructor(e){super(),this.cacheSizeBytes=e}tu(e,t){re(this.persistence.referenceDelegate instanceof Fa);let n=this.persistence.referenceDelegate.garbageCollector;return new uh(n,e.asyncQueue,t)}Xa(e){let t=this.cacheSizeBytes!==void 0?Ye.withCacheSize(this.cacheSizeBytes):Ye.DEFAULT;return new Ma(n=>Fa.ri(n,t),this.serializer)}},_s=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=>lv(this.syncEngine,n,1),this.remoteStore.remoteSyncer.handleCredentialChange=YD.bind(null,this.syncEngine),await FD(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new $h}()}createDatastore(e){let t=cl(e.databaseInfo.databaseId),n=function(s){return new Oh(s)}(e.databaseInfo);return function(s,a,l,u){return new Mh(s,a,l,u)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(n,i,s,a,l){return new jh(n,i,s,a,l)}(this.localStore,this.datastore,e.asyncQueue,t=>lv(this.syncEngine,t,0),function(){return Ua.D()?new Ua:new Ph}())}createSyncEngine(e,t){return function(i,s,a,l,u,h,f){let m=new Hh(i,s,a,l,u,h);return f&&(m.ja=!0),m}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(i){let s=q(i);L(Mr,"RemoteStore shutting down."),s.W_.add(5),await As(s),s.z_.shutdown(),s.j_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}};_s.provider={build:()=>new _s};Qa=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.iu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.iu(this.observer.error,e):Nt("Uncaught Error in snapshot listener:",e.toString()))}su(){this.muted=!0}iu(e,t){setTimeout(()=>{this.muted||e(t)},0)}};dr="FirestoreClient",Jh=class{constructor(e,t,n,i,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=i,this.user=ve.UNAUTHENTICATED,this.clientId=Ea.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(n,async a=>{L(dr,"Received user=",a.uid),await this.authCredentialListener(a),this.user=a}),this.appCheckCredentials.start(n,a=>(L(dr,"Received new app check token=",a),this.appCheckCredentialListener(a,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 ct;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=vd(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}};hv=new Map;Pb="firestore.googleapis.com",fv=!0,Ja=class{constructor(e){var t,n;if(e.host===void 0){if(e.ssl!==void 0)throw new M(O.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Pb,this.ssl=fv}else this.host=e.host,this.ssl=(t=e.ssl)!==null&&t!==void 0?t:fv;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=cb;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<yD)throw new M(O.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}i1("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=Rb((n=e.experimentalLongPollingOptions)!==null&&n!==void 0?n:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new M(O.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new M(O.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new M(O.INVALID_ARGUMENT,`invalid long polling timeout: ${s.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,i){return n.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},ws=class{constructor(e,t,n,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Ja({}),this._settingsFrozen=!1,this._terminateTask="notTerminated"}get app(){if(!this._app)throw new M(O.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 M(O.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 Ja(e),e.credentials!==void 0&&(this._authCredentials=function(n){if(!n)return new Ic;switch(n.type){case"firstParty":return new Rc(n.sessionIndex||"0",n.iamToken||null,n.authTokenFactory||null);case"provider":return n.client;default:throw new M(O.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_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=hv.get(t);n&&(L("ComponentProvider","Removing Datastore"),hv.delete(t),n.terminate())}(this),Promise.resolve()}};Ya=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)}},Ue=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 vs(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new r(this.firestore,e,this._key)}},vs=class r extends Ya{constructor(e,t,n){super(e,t,al(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 Ue(this.firestore,null,new U(e))}withConverter(e){return new r(this.firestore,e,this._path)}};pv="AsyncQueue",Xa=class{constructor(e=Promise.resolve()){this.Vu=[],this.mu=!1,this.fu=[],this.gu=null,this.pu=!1,this.yu=!1,this.wu=[],this.a_=new Ba(this,"async_queue_retry"),this.Su=()=>{let n=Tc();n&&L(pv,"Visibility state changed to "+n.visibilityState),this.a_.t_()},this.bu=e;let t=Tc();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.Su)}get isShuttingDown(){return this.mu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Du(),this.vu(e)}enterRestrictedMode(e){if(!this.mu){this.mu=!0,this.yu=e||!1;let t=Tc();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Su)}}enqueue(e){if(this.Du(),this.mu)return new Promise(()=>{});let t=new ct;return this.vu(()=>this.mu&&this.yu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Vu.push(e),this.Cu()))}async Cu(){if(this.Vu.length!==0){try{await this.Vu[0](),this.Vu.shift(),this.a_.reset()}catch(e){if(!ei(e))throw e;L(pv,"Operation failed with retryable error: "+e)}this.Vu.length>0&&this.a_.Xo(()=>this.Cu())}}vu(e){let t=this.bu.then(()=>(this.pu=!0,e().catch(n=>{this.gu=n,this.pu=!1;let i=function(a){let l=a.message||"";return a.stack&&(l=a.stack.includes(a.message)?a.stack:a.message+`
|
|
22
|
+
`+a.stack),l}(n);throw Nt("INTERNAL UNHANDLED ERROR: ",i),n}).then(n=>(this.pu=!1,n))));return this.bu=t,t}enqueueAfterDelay(e,t,n){this.Du(),this.wu.indexOf(e)>-1&&(t=0);let i=Uh.createAndSchedule(this,e,t,n,s=>this.Fu(s));return this.fu.push(i),i}Du(){this.gu&&j()}verifyOperationInProgress(){}async Mu(){let e;do e=this.bu,await e;while(e!==this.bu)}xu(e){for(let t of this.fu)if(t.timerId===e)return!0;return!1}Ou(e){return this.Mu().then(()=>{this.fu.sort((t,n)=>t.targetTimeMs-n.targetTimeMs);for(let t of this.fu)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.Mu()})}Nu(e){this.wu.push(e)}Fu(e){let t=this.fu.indexOf(e);this.fu.splice(t,1)}};fr=class extends ws{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=new Xa,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new Xa(e),this._firestoreClient=void 0,await e}}};bs=class r{constructor(e){this._byteString=e}static fromBase64String(e){try{return new r(De.fromBase64String(e))}catch(t){throw new M(O.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new r(De.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)}};Yn=class{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new M(O.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new He(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};Ts=class{constructor(e){this._methodName=e}};Es=class{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new M(O.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new M(O.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}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return J(this._lat,e._lat)||J(this._long,e._long)}};Is=class{constructor(e){this._values=(e||[]).map(t=>t)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(n,i){if(n.length!==i.length)return!1;for(let s=0;s<n.length;++s)if(n[s]!==i[s])return!1;return!0}(this._values,e._values)}};a1=/^__.*__$/,Xh=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return this.fieldMask!==null?new yt(e,this.data,this.fieldMask,t,this.fieldTransforms):new Lr(e,this.data,t,this.fieldTransforms)}},Za=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new yt(e,this.data,this.fieldMask,t,this.fieldTransforms)}};Zh=class r{constructor(e,t,n,i,s,a){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=i,s===void 0&&this.Bu(),this.fieldTransforms=s||[],this.fieldMask=a||[]}get path(){return this.settings.path}get Lu(){return this.settings.Lu}ku(e){return new r(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}qu(e){var t;let n=(t=this.path)===null||t===void 0?void 0:t.child(e),i=this.ku({path:n,Qu:!1});return i.$u(e),i}Ku(e){var t;let n=(t=this.path)===null||t===void 0?void 0:t.child(e),i=this.ku({path:n,Qu:!1});return i.Bu(),i}Uu(e){return this.ku({path:void 0,Qu:!0})}Wu(e){return tl(e,this.settings.methodName,this.settings.Gu||!1,this.path,this.settings.zu)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}Bu(){if(this.path)for(let e=0;e<this.path.length;e++)this.$u(this.path.get(e))}$u(e){if(e.length===0)throw this.Wu("Document fields must not be empty");if(kb(this.Lu)&&a1.test(e))throw this.Wu('Document fields cannot begin and end with "__"')}},ed=class{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||cl(e)}ju(e,t,n,i=!1){return new Zh({Lu:e,methodName:t,zu:n,path:He.emptyPath(),Qu:!1,Gu:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};el=class r extends Ts{_toFieldTransform(e){if(e.Lu!==2)throw e.Lu===1?e.Wu(`${this._methodName}() can only appear at the top level of your update data`):e.Wu(`${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}};h1=new RegExp("[~\\*/\\[\\]]");rl=class{constructor(e,t,n,i,s){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Ue(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new rd(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let t=this._document.data.field(Lb("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}},rd=class extends rl{data(){return super.data()}};nd=class{convertValue(e,t="none"){switch(cr(e)){case 0:return null;case 1:return e.booleanValue;case 2:return ue(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 j()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){let n={};return pr(e,(i,s)=>{n[i]=this.convertValue(s,t)}),n}convertVectorValue(e){var t,n,i;let s=(i=(n=(t=e.fields)===null||t===void 0?void 0:t[jn].arrayValue)===null||n===void 0?void 0:n.values)===null||i===void 0?void 0:i.map(a=>ue(a.doubleValue));return new Is(s)}convertGeoPoint(e){return new Es(ue(e.latitude),ue(e.longitude))}convertArray(e,t){return(e.values||[]).map(n=>this.convertValue(n,t))}convertServerTimestamp(e,t){switch(t){case"previous":let n=ol(e);return n==null?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(ds(e));default:return null}}convertTimestamp(e){let t=Vt(e);return new Ee(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=ge.fromString(e);re(ub(n));let i=new Ra(n.get(1),n.get(3)),s=new U(n.popFirst(5));return i.isEqual(t)||Nt(`Document ${s} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),s}};kr=class{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},nl=class extends rl{constructor(e,t,n,i,s,a){super(e,t,n,i,a),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new Vn(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(Lb("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}},Vn=class extends nl{data(e={}){return super.data(e)}},id=class{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new kr(i.hasPendingWrites,i.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 Vn(this._firestore,this._userDataWriter,n.key,n,new kr(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 M(O.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(i,s){if(i._snapshot.oldDocs.isEmpty()){let a=0;return i._snapshot.docChanges.map(l=>{let u=new Vn(i._firestore,i._userDataWriter,l.doc.key,l.doc,new kr(i._snapshot.mutatedKeys.has(l.doc.key),i._snapshot.fromCache),i.query.converter);return l.doc,{type:"added",doc:u,oldIndex:-1,newIndex:a++}})}{let a=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(l=>s||l.type!==3).map(l=>{let u=new Vn(i._firestore,i._userDataWriter,l.doc.key,l.doc,new kr(i._snapshot.mutatedKeys.has(l.doc.key),i._snapshot.fromCache),i.query.converter),h=-1,f=-1;return l.type!==0&&(h=a.indexOf(l.doc.key),a=a.delete(l.doc.key)),l.type!==1&&(a=a.add(l.doc),f=a.indexOf(l.doc.key)),{type:p1(l.type),doc:u,oldIndex:h,newIndex:f}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}};il=class extends nd{constructor(e){super(),this.firestore=e}convertBytes(e){return new bs(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);return new Ue(this.firestore,null,t)}};(function(e,t=!0){(function(i){Xn=i})(bw),rs(new Ct("firestore",(n,{instanceIdentifier:i,options:s})=>{let a=n.getProvider("app").getImmediate(),l=new fr(new xc(n.getProvider("auth-internal")),new Pc(a,n.getProvider("app-check-internal")),function(h,f){if(!Object.prototype.hasOwnProperty.apply(h.options,["projectId"]))throw new M(O.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Ra(h.options.projectId,f)}(a,i),a);return s=Object.assign({useFetchStreams:t},s),l._setSettings(s),l},"PUBLIC").setMultipleInstances(!0)),lr(Pw,Cw,e),lr(Pw,Cw,"esm2017")})()});var Pd=_(()=>{$b()});var jr={};Ir(jr,{Headers:()=>kd,Request:()=>y1,Response:()=>_1,default:()=>Cd,fetch:()=>g1});var m1,ri,g1,Cd,kd,y1,_1,mr=_(()=>{"use strict";m1=function(){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")},ri=m1(),g1=ri.fetch,Cd=ri.fetch.bind(ri),kd=ri.Headers,y1=ri.Request,_1=ri.Response});var Nd=ot(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});var Dd=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Od.default=Dd});var Ld=ot(Ps=>{"use strict";var zb=Ps&&Ps.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ps,"__esModule",{value:!0});var v1=zb((mr(),C0(jr))),b1=zb(Nd()),Vd=class{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:typeof fetch=="undefined"?this.fetch=v1.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Object.assign({},this.headers),this.headers[e]=t,this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");let n=this.fetch,i=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{var a,l,u;let h=null,f=null,m=null,g=s.status,I=s.statusText;if(s.ok){if(this.method!=="HEAD"){let V=await s.text();V===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?f=V:f=JSON.parse(V))}let k=(a=this.headers.Prefer)===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),P=(l=s.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");k&&P&&P.length>1&&(m=parseInt(P[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(f)&&(f.length>1?(h={code:"PGRST116",details:`Results contain ${f.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},f=null,m=null,g=406,I="Not Acceptable"):f.length===1?f=f[0]:f=null)}else{let k=await s.text();try{h=JSON.parse(k),Array.isArray(h)&&s.status===404&&(f=[],h=null,g=200,I="OK")}catch{s.status===404&&k===""?(g=204,I="No Content"):h={message:k}}if(h&&this.isMaybeSingle&&(!((u=h==null?void 0:h.details)===null||u===void 0)&&u.includes("0 rows"))&&(h=null,g=200,I="OK"),h&&this.shouldThrowOnError)throw new b1.default(h)}return{error:h,data:f,count:m,status:g,statusText:I}});return this.shouldThrowOnError||(i=i.catch(s=>{var a,l,u;return{error:{message:`${(a=s==null?void 0:s.name)!==null&&a!==void 0?a:"FetchError"}: ${s==null?void 0:s.message}`,details:`${(l=s==null?void 0:s.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(u=s==null?void 0:s.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}};Ps.default=Vd});var Fd=ot(Cs=>{"use strict";var T1=Cs&&Cs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Cs,"__esModule",{value:!0});var E1=T1(Ld()),Md=class extends E1.default{select(e){let t=!1,n=(e!=null?e:"*").split("").map(i=>/\s/.test(i)&&!t?"":(i==='"'&&(t=!t),i)).join("");return this.url.searchParams.set("select",n),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:i,referencedTable:s=i}={}){let a=s?`${s}.order`:"order",l=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){let i=typeof n=="undefined"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:i=n}={}){let s=typeof i=="undefined"?"offset":`${i}.offset`,a=typeof i=="undefined"?"limit":`${i}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(a,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:i=!1,wal:s=!1,format:a="text"}={}){var l;let u=[e?"analyze":null,t?"verbose":null,n?"settings":null,i?"buffers":null,s?"wal":null].filter(Boolean).join("|"),h=(l=this.headers.Accept)!==null&&l!==void 0?l:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${a}; for="${h}"; options=${u};`,a==="json"?this:this}rollback(){var e;return((e=this.headers.Prefer)!==null&&e!==void 0?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}};Cs.default=Md});var wl=ot(ks=>{"use strict";var I1=ks&&ks.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ks,"__esModule",{value:!0});var A1=I1(Fd()),jd=class extends A1.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let n=Array.from(new Set(t)).map(i=>typeof i=="string"&&new RegExp("[,()]").test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:i}={}){let s="";i==="plain"?s="pl":i==="phrase"?s="ph":i==="websearch"&&(s="w");let a=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${a}.${t}`),this}match(e){return Object.entries(e).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){let i=n?`${n}.or`:"or";return this.url.searchParams.append(i,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}};ks.default=jd});var Bd=ot(Os=>{"use strict";var x1=Os&&Os.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Os,"__esModule",{value:!0});var Ds=x1(wl()),Ud=class{constructor(e,{headers:t={},schema:n,fetch:i}){this.url=e,this.headers=t,this.schema=n,this.fetch=i}select(e,{head:t=!1,count:n}={}){let i=t?"HEAD":"GET",s=!1,a=(e!=null?e:"*").split("").map(l=>/\s/.test(l)&&!s?"":(l==='"'&&(s=!s),l)).join("");return this.url.searchParams.set("select",a),n&&(this.headers.Prefer=`count=${n}`),new Ds.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:n=!0}={}){let i="POST",s=[];if(this.headers.Prefer&&s.push(this.headers.Prefer),t&&s.push(`count=${t}`),n||s.push("missing=default"),this.headers.Prefer=s.join(","),Array.isArray(e)){let a=e.reduce((l,u)=>l.concat(Object.keys(u)),[]);if(a.length>0){let l=[...new Set(a)].map(u=>`"${u}"`);this.url.searchParams.set("columns",l.join(","))}}return new Ds.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:i,defaultToNull:s=!0}={}){let a="POST",l=[`resolution=${n?"ignore":"merge"}-duplicates`];if(t!==void 0&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&l.push(this.headers.Prefer),i&&l.push(`count=${i}`),s||l.push("missing=default"),this.headers.Prefer=l.join(","),Array.isArray(e)){let u=e.reduce((h,f)=>h.concat(Object.keys(f)),[]);if(u.length>0){let h=[...new Set(u)].map(f=>`"${f}"`);this.url.searchParams.set("columns",h.join(","))}}return new Ds.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){let n="PATCH",i=[];return this.headers.Prefer&&i.push(this.headers.Prefer),t&&i.push(`count=${t}`),this.headers.Prefer=i.join(","),new Ds.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){let t="DELETE",n=[];return e&&n.push(`count=${e}`),this.headers.Prefer&&n.unshift(this.headers.Prefer),this.headers.Prefer=n.join(","),new Ds.default({method:t,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}};Os.default=Ud});var Gb=ot(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.version=void 0;vl.version="0.0.0-automated"});var Kb=ot(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.DEFAULT_HEADERS=void 0;var S1=Gb();bl.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${S1.version}`}});var Wb=ot(Ns=>{"use strict";var Hb=Ns&&Ns.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ns,"__esModule",{value:!0});var R1=Hb(Bd()),P1=Hb(wl()),C1=Kb(),$d=class r{constructor(e,{headers:t={},schema:n,fetch:i}={}){this.url=e,this.headers=Object.assign(Object.assign({},C1.DEFAULT_HEADERS),t),this.schemaName=n,this.fetch=i}from(e){let t=new URL(`${this.url}/${e}`);return new R1.default(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new r(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:n=!1,get:i=!1,count:s}={}){let a,l=new URL(`${this.url}/rpc/${e}`),u;n||i?(a=n?"HEAD":"GET",Object.entries(t).filter(([f,m])=>m!==void 0).map(([f,m])=>[f,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([f,m])=>{l.searchParams.append(f,m)})):(a="POST",u=t);let h=Object.assign({},this.headers);return s&&(h.Prefer=`count=${s}`),new P1.default({method:a,url:l,headers:h,schema:this.schemaName,body:u,fetch:this.fetch,allowEmpty:!1})}};Ns.default=$d});var tT=ot(Ie=>{"use strict";var ni=Ie&&Ie.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.PostgrestError=Ie.PostgrestBuilder=Ie.PostgrestTransformBuilder=Ie.PostgrestFilterBuilder=Ie.PostgrestQueryBuilder=Ie.PostgrestClient=void 0;var Qb=ni(Wb());Ie.PostgrestClient=Qb.default;var Jb=ni(Bd());Ie.PostgrestQueryBuilder=Jb.default;var Yb=ni(wl());Ie.PostgrestFilterBuilder=Yb.default;var Xb=ni(Fd());Ie.PostgrestTransformBuilder=Xb.default;var Zb=ni(Ld());Ie.PostgrestBuilder=Zb.default;var eT=ni(Nd());Ie.PostgrestError=eT.default;Ie.default={PostgrestClient:Qb.default,PostgrestQueryBuilder:Jb.default,PostgrestFilterBuilder:Yb.default,PostgrestTransformBuilder:Xb.default,PostgrestBuilder:Zb.default,PostgrestError:eT.default}});var cT=ot((rq,uT)=>{"use strict";uT.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});function fO(r,e){return Object.fromEntries(Object.entries(r).sort(e||void 0).map(([t,n])=>[t,n]))}function Vl(r,e){return Array.isArray(r)?r.map(t=>Vl(t,e)):typeof r=="object"?Object.fromEntries(Object.entries(fO(r,e)).map(([t,n])=>[t,Vl(n,e)])):r}var HT=_(()=>{});var WT,QT=_(()=>{WT={id:"~date",test:r=>r instanceof Date,serialize:r=>({_:"~date",v:r.toISOString()}),deserialize:r=>new Date(r.v)}});var JT,YT=_(()=>{JT={id:"~function",test:r=>typeof r=="function",serialize:r=>({_:"~function",v:r.toString()}),deserialize:v=>eval(v.v.toString())}});var XT,ZT=_(()=>{XT={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 eE,tE=_(()=>{eE={id:"~nan",test:r=>Number.isNaN(r),serialize:r=>({_:"~nan"}),deserialize:r=>NaN}});var rE,nE=_(()=>{rE={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 iE,sE=_(()=>{iE={id:"~set",test:r=>r instanceof Set,serialize:r=>({_:"~set",v:Array.from(r)}),deserialize:r=>new Set(r.v)}});var oE,aE=_(()=>{oE={id:"~undefined",test:r=>r===void 0,serialize:r=>({_:"~undefined"}),deserialize:r=>{}}});var fi,Ys,lE=_(()=>{aa();HT();QT();YT();ZT();tE();nE();sE();aE();fi={settings:{stringify:!0,destringify:!0,clone:!1,depth:0,modules:[WT,JT,XT,eE,rE,iE,oE],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 fi.loadedModules[e.id]=e}else throw new Error("Unknown module type")})},serialize(r,e){let t=oa(e,fi.settings),n=fi.loadModules(t.modules),i=t.symetric?Vl(r):t.clone?sr(r):r,s=new Map,a=(l,u)=>{let h=ee(l);if(h&&t.circular){let g=s.get(l);if(g)return or(i,u,{_:"~circular",p:g.join(".")});s.set(l,u)}let f=n.find(g=>g.test(l)),m=(!t.depth||u.length<t.depth)&&h;if(f){let g=f.serialize(l);if(f.recursive&&m){let I=Ce(l);t.symetric&&I.sort(),or(i,u,g),I.forEach(C=>a(l[C],u.concat(C)))}else u.length?or(i,u,g):i=g}else if(m){let g=Ce(l);t.symetric&&g.sort(),g.forEach(I=>a(l[I],u.concat(I)))}};return a(i,[]),t.stringify?JSON.stringify(i):i},deserialize(r,e){let t=oa(e,fi.settings),n=fi.loadModules(t.modules),i=zu(n,"id"),s=t.destringify?JSON.parse(r):t.clone?sr(r):r,a=(l,u)=>{if(ee(l)&&l._&&typeof l._=="string"&&l._.startsWith("~")&&i[l._]){let h=i[l._].deserialize(l);u.length?i[l._].recursive&&ee(h)?(or(s,u,h),Ce(h).forEach(f=>a(l[f],[...u,f]))):or(s,u,h):s=h}else t.circular&&ee(l)&&l._&&l._=="~circular"?or(s,u,Ji(s,l.p)):(!t.depth||u.length<t.depth)&&ee(l)&&Ce(l).forEach(h=>a(l[h],u.concat(h)))};return a(s,[]),s}},Ys=fi});var uE,cE=_(()=>{uE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"});var hE,dE=_(()=>{cE();hE=(r=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(r|=0));for(;r--;)e+=uE[t[r]&63];return e}});var pi,Ll=_(()=>{pi={csv:{id:"csv",title:"Comma Seperated Values",titleShort:"CSV",ext:[".csv"],canRead:!1,canWrite:!1},endnoteXml:{id:"endnoteXml",title:"EndNoteXML",titleShort:"EndNoteXML",ext:[".xml"],canRead:!0,canWrite:!0},json:{id:"json",title:"JSON",titleShort:"JSON",ext:[".json"],canRead:!0,canWrite:!0},medline:{id:"medline",title:"MEDLINE / PubMed",titleShort:"MEDLINE",ext:[".nbib"],canRead:!0,canWrite:!0},ris:{id:"ris",title:"RIS",titleShort:"RIS",ext:[".ris",".txt",".cgi"],canRead:!0,canWrite:!0},tsv:{id:"tsv",title:"Tab Seperated Values",titleShort:"TSV",ext:[".tsv"],canRead:!1,canWrite:!1}}});function mi(r){var t;let e=(t=/^.*(?<ext>\..+?)$/.exec(r))==null?void 0:t.groups.ext.toLowerCase();return e?Object.values(pi).find(n=>n.ext.includes(e)):null}var Ml=_(()=>{Ll()});function fE(r){return{all:r=r||new Map,on:function(e,t){var n=r.get(e);n?n.push(t):r.set(e,[t])},off:function(e,t){var n=r.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):r.set(e,[]))},emit:function(e,t){var n=r.get(e);n&&n.slice().map(function(i){i(t)}),(n=r.get("*"))&&n.slice().map(function(i){i(e,t)})}}}var pE=_(()=>{});function Me(){let r=fE();return r.mitt={},["on","off","emit"].forEach(e=>{r.mitt[e]=r[e],r[e]=(...t)=>(r.mitt[e](...t),r)}),r}var _r=_(()=>{pE()});var Xs,mE=_(()=>{_r();Xs=class r{constructor(){this.text="",this.emitter=Me(),this.recNumber=1}write(e){this.text+=e}end(){try{let e=JSON.parse(this.text);this.text="",Array.isArray(e)&&e.forEach(t=>{this.emitter.emit("data",t)}),this.emitter.emit("end")}catch(e){console.error("Error parsing final JSON:",e),this.emitter.emit("error",e)}}on(e,t){this.emitter.on(e,t)}static parse(){return new r}}});var Fl={};Ir(Fl,{readStream:()=>pO,writeStream:()=>mO});function pO(r){let e=1,t=Me();return setTimeout(()=>{if(r.on("data",()=>t.emit("progress",r.bytesRead)),typeof r.pipe=="function"){let n=Xs.parse("*");n.on("data",i=>t.emit("ref",{recNumber:e++,...i})),n.on("end",()=>t.emit("end")),n.on("error",t.emit.bind("error")),r.pipe(n)}else console.error('Error with stream, check "streamEmitter.js" if on browser')}),t}function mO(r,e){let t={lineSuffix:`
|
|
23
|
+
`,...e},n;return{start:()=>(r.write(`[
|
|
24
|
+
`),Promise.resolve()),write:i=>(n&&r.write(n+","+t.lineSuffix),n=JSON.stringify(i),Promise.resolve()),end:()=>(n&&r.write(n+t.lineSuffix),r.write("]"),new Promise((i,s)=>r.end(a=>a?s(a):i())))}}var gE=_(()=>{_r();mE()});function yE(r){return r.split(/[\s-]/).map((e,t)=>t==0?e.toLowerCase():e.substr(0,1).toUpperCase()+e.substr(1).toLowerCase()).join("")}var _E=_(()=>{});var Zs,eo,wE=_(()=>{Zs=(...r)=>{},eo=class{constructor(e){ae(this,"settings",{collect:!0,keyText:"text",keyAttrs:"attrs",keyChildren:"children",ignoreOrphanedPrefixes:!0,flattenText:!0,flattenChildren:!0,flattenChildrenSquish:!0,flattenAttrs:!0,reNextSegment:/(?<text>.*?)<(?<isClose>\/?)(?<tag>[a-z0-9-\.\_]+?)(?:\s+(?<attrs>.*?))?>/ig,reAttrSegment:/(?<key>[a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?<escape>["'])(?<val>.*?)\k<escape>)?/ig,onRoot:e=>Zs("> ROOT",e.tag),onAttr:(e,t,n)=>({[e]:isFinite(t)?+t:t==="true"||t===void 0?!0:t==="false"?!1:t}),onTagOpen:e=>Zs("> TAG OPEN",e.tag),onTagClose:e=>Zs("> TAG CLOSE",e.tag),onTagCloseMismatch:(e,t)=>Zs("TAG CLOSE",e,"(but expected",t,")")});ae(this,"buffer","");ae(this,"collected");ae(this,"stack",[]);e&&Object.assign(this.settings,e)}append(e){if(!e)throw new Error("No input to append");return this.buffer+=e.toString(),this}exec(){let e,t;for(;e=this.settings.reNextSegment.exec(this.buffer);){if(t=e.index+e[0].length,e.groups.text&&!(this.stack.length==0&&this.settings.ignoreOrphanedPrefixes)){if(this.stack.length==0)throw new Error("Attempt to set value on empty stack!");this.stack.at(-1)[this.settings.keyText]=(this.stack.at(-1)[this.settings.keyText]||"")+e.groups.text}let n=e.groups.attrs?this.parseAttrString(e.groups.attrs):null;if(e.groups.isClose==""){let i={tag:e.groups.tag,...n!==null&&{[this.settings.keyAttrs]:n}};this.stack.length==0?(this.settings.onRoot(i),this.settings.collect&&(this.collected=i)):this.stack.at(-1)[this.settings.keyChildren]?this.stack.at(-1)[this.settings.keyChildren].push(i):this.stack.at(-1)[this.settings.keyChildren]=[i],this.settings.onTagOpen(i),this.stack.push(i)}else if(e.groups.isClose=="/"){if(this.stack.length==0)throw new Error("Smashed stack!");this.settings.onTagClose(this.stack.at(-1)),this.stack.pop()}else Zs("OUT OF BAND",{match:e})}return t>0&&(this.buffer=this.buffer.slice(t)),this}parseAttrString(e){let t,n={};for(;t=this.settings.reAttrSegment.exec(e);)n={...n,...this.settings.onAttr(t.groups.key,t.groups.val,t.groups)};return n}flatten(e){let t=n=>{if(Array.isArray(n))return n.map(i=>t(i));if(typeof n=="object"&&n.tag){if(this.settings.flattenText&&n[this.settings.keyText]&&!n[this.settings.keyChildren]&&!n[this.settings.keyAttrs])return{[n.tag]:n[this.settings.keyText]};if(this.settings.flattenChildren&&n[this.settings.keyChildren]&&!n[this.settings.keyText]&&!n[this.settings.keyAttrs]){let i=t(n[this.settings.keyChildren]);return this.settings.flattenChildrenSquish&&i.length==1&&(i=i[0]),{[n.tag]:i}}else return this.settings.flattenAttrs&&n[this.settings.keyAttrs]&&!n[this.settings.keyChildren]&&!n[this.settings.keyText]?{[n.tag]:n[this.settings.keyAttrs]}:{[n.tag]:{...n[this.settings.keyText]&&{[this.settings.keyText]:n[this.settings.keyText]},...n[this.settings.keyAttrs]&&{[this.settings.keyAttrs]:n[this.settings.keyAttrs]},...n[this.settings.keyChildren]&&{[this.settings.keyChildren]:n[this.settings.keyChildren]}}}}};return e?t(e):(this.collected=t(this.collected),this)}value(){if(!this.settings.collect)throw new Error("Collect mode disabled, enable this if you want the final parsed output object");return this.settings.flatten&&this.flatten(),this.collected}}});var jl,vE=_(()=>{_r();wE();jl=class{constructor(e){this.emitter=Me(),this.parser=new eo({collect:!1,reAttrSegment:/(?<key>[a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?<escape>["'])(?<val>.*?)\k<escape>)?/ig,onTagOpen:t=>{let n=t.tag,i=t.attrs||{};this.emitter.emit("opentag",n,i)},onTagClose:t=>{let n=t.tag;t.text&&t.text.trim()&&this.emitter.emit("text",t.text.trim()),this.emitter.emit("closetag",n)},flattenText:!1,keyText:"text",keyAttrs:"attrs"}),this.emitter.on("opentag",e.onopentag),this.emitter.on("closetag",e.onclosetag),this.emitter.on("text",e.ontext),this.emitter.on("end",e.onend)}write(e){this.parser.append(e).exec()}end(){this.parser.exec();let e=this.parser.stack.at(-1);e&&e.text&&e.text.trim()&&this.emitter.emit("text",e.text.trim()),this.emitter.emit("end")}}});var Ul={};Ir(Ul,{readStream:()=>gO,setup:()=>_O,translateRawToRef:()=>bE,translations:()=>wr,writeStream:()=>yO,xmlEscape:()=>Fe,xmlUnescape:()=>Bt});function gO(r){let e=Me(),t={},n=[],i=!1,s={xmlMode:!0,decodeEntities:!1,onopentag(a,l){i=!1,n.push({name:yE(a),attrs:l})},onclosetag(a){a=="record"?(t.title&&(t.title=t.title.replace(/^.*<style.*>(.*)<\/style>.*$/m,"$1").replace(/^\s+/,"").replace(/\s+$/,"")),e.emit("ref",bE(t)),n=[],t={}):n.pop()},ontext(a){var h,f;let l=(h=n[n.length-1])==null?void 0:h.name,u=(f=n[n.length-2])==null?void 0:f.name;l=="title"?i?t.title+=a:t.title=a:l=="style"&&u=="author"?(t.authors||(t.authors=[]),i?t.authors[t.authors.length-1]+=Bt(a):t.authors.push(Bt(a))):l=="style"&&u=="keyword"?(t.keywords||(t.keywords=[]),i?t.keywords[t.keywords.length-1]+=Bt(a):t.keywords.push(Bt(a))):l=="style"?i||t[u]?t[u]+=Bt(a):t[u]=Bt(a):["recNumber","refType"].includes(l)&&(i||t[l]?t[l]+=Bt(a):t[l]=Bt(a)),i=!0},onend(){e.emit("end")}};return setTimeout(()=>{if(typeof r.pipe=="function"){let a=new jl(s);r.on("data",()=>e.emit("progress",r.bytesRead)),r.pipe(a);return}else console.error('Error with stream, check "streamEmitter.js" if on browser')}),e}function yO(r,e){let t={defaultType:"journalArticle",filePath:"c:\\",fileName:"EndNote.enl",formatDate:s=>s instanceof Date?s.toISOString().substr(0,10):s,...e},n=Fe(t.fileName),i=0;return{start:()=>(r.write('<?xml version="1.0" encoding="UTF-8" ?><xml><records>'),Promise.resolve()),write:s=>{let a=wr.types.rlMap.get(s.type||t.defaultType);a||(console.warn(`Invalid reference type: "${s.type}", defaulting to journal article`),a=wr.types.rlMap.get("journalArticle")),i++;let l=s.recNumber||i;return r.write(`<record><database name="${t.fileName}" path="${t.filePath}${t.fileName}">${n}</database><source-app name="EndNote" version="16.0">EndNote</source-app><rec-number>${l}</rec-number><foreign-keys><key app="EN" db-id="s55prpsswfsepue0xz25pxai2p909xtzszzv">${l}</key></foreign-keys><ref-type name="${a.rawText}">${a.rawId}</ref-type><contributors><authors>`+(s.authors||[]).map(u=>`<author><style face="normal" font="default" size="100%">${Fe(u)}</style></author>`)+"</authors></contributors><titles>"+(s.title?`<title><style face="normal" font="default" size="100%">${Fe(s.title)}</style></title>`:"")+(s.journal?`<secondary-title><style face="normal" font="default" size="100%">${Fe(s.journal)}</style></secondary-title>`:"")+(s.titleShort?`<short-title><style face="normal" font="default" size="100%">${Fe(s.titleShort)}</style></short-title>`:"")+(s.journalAlt?`<alt-title><style face="normal" font="default" size="100%">${Fe(s.journalAlt)}</style></alt-title>`:"")+"</titles>"+(s.periodical?`<periodical><full-title><style face="normal" font="default" size="100%">${Fe(s.periodical)}</style></full-title></periodical>`:"")+[["abstract","abstract"],["accessDate","access-date"],["accession","accession-num"],["address","auth-address"],["caption","caption"],["databaseProvider","remote-database-provider"],["database","remote-database-name"],["doi","electronic-resource-num"],["isbn","isbn"],["accessionNum","accession-num"],["label","label"],["language","language"],["notes","notes"],["number","number"],["pages","pages"],["researchNotes","research-notes"],["section","section"],["volume","volume"],["workType","work-type"],["custom1","custom1"],["custom2","custom2"],["custom3","custom3"],["custom4","custom4"],["custom5","custom5"],["custom6","custom6"],["custom7","custom7"]].filter(([u])=>s[u]).map(([u,h])=>`<${h}><style face="normal" font="default" size="100%">${Fe(s[u])}</style></${h}>`).join("")+(s.date&&s.year&&s.date instanceof Date?`<dates><year><style face="normal" font="default" size="100%">${Fe(s.year)}</style></year><pub-dates><date><style face="normal" font="default" size="100%">${t.formatDate(s.date)}</style></date></pub-dates></dates>`:s.date&&s.year?`<dates><year><style face="normal" font="default" size="100%">${Fe(s.year)}</style></year><pub-dates><date><style face="normal" font="default" size="100%">${s.date}</style></date></pub-dates></dates>`:s.date?`<dates><pub-dates><date><style face="normal" font="default" size="100%">${Fe(s.date)}</style></date></pub-dates></dates>`:s.year?`<dates><year><style face="normal" font="default" size="100%">${Fe(s.year)}</style></year></dates>`:"")+(s.urls?"<urls><related-urls>"+(s.urls||[]).map(u=>`<url><style face="normal" font="default" size="100%">${Fe(u)}</style></url>`).join("")+"</related-urls></urls>":"")+(s.keywords?"<keywords>"+(s.keywords||[]).map(u=>`<keyword><style face="normal" font="default" size="100%">${Fe(u)}</style></keyword>`).join("")+"</keywords>":"")+"</record>"),Promise.resolve()},end:()=>(r.write("</records></xml>"),new Promise((s,a)=>r.end(l=>l?a(l):s())))}}function bE(r){var t;return{...Object.fromEntries(wr.fields.collection.filter(n=>r[n.raw]).map(n=>[n.rl,r[n.raw]])),type:(t=wr.types.rawMap.get(+r.refType||17))==null?void 0:t.rl}}function Fe(r){return(""+r).replace(/&/g,"&").replace(/\r/g,"
").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Bt(r){return(""+r).replace(/&/g,"&").replace(/
/g,"\r").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function _O(){wr.types.collection.forEach(r=>{wr.types.rlMap.set(r.rl,r),wr.types.rawMap.set(r.rawId,r)})}var wr,TE=_(()=>{_E();_r();vE();wr={fields:{collection:[{rl:"recNumber",raw:"recNumber"},{rl:"title",raw:"title"},{rl:"journal",raw:"secondaryTitle"},{rl:"address",raw:"authAddress"},{rl:"researchNotes",raw:"researchNotes"},{rl:"type",raw:"FIXME"},{rl:"authors",raw:"authors"},{rl:"pages",raw:"pages"},{rl:"volume",raw:"volume"},{rl:"number",raw:"number"},{rl:"isbn",raw:"isbn"},{rl:"accessionNum",raw:"accessionNum"},{rl:"abstract",raw:"abstract"},{rl:"label",raw:"label"},{rl:"caption",raw:"caption"},{rl:"notes",raw:"notes"},{rl:"custom1",raw:"custom1"},{rl:"custom2",raw:"custom2"},{rl:"custom3",raw:"custom3"},{rl:"custom4",raw:"custom4"},{rl:"custom5",raw:"custom5"},{rl:"custom6",raw:"custom6"},{rl:"custom7",raw:"custom7"},{rl:"doi",raw:"electronicResourceNum"},{rl:"year",raw:"year"},{rl:"date",raw:"date"},{rl:"keywords",raw:"keywords"},{rl:"urls",raw:"urls"}]},types:{collection:[{rl:"aggregatedDatabase",rawText:"Aggregated Database",rawId:55},{rl:"ancientText",rawText:"Ancient Text",rawId:51},{rl:"artwork",rawText:"Artwork",rawId:2},{rl:"audioVisualMaterial",rawText:"Audiovisual Material",rawId:3},{rl:"bill",rawText:"Bill",rawId:4},{rl:"blog",rawText:"Blog",rawId:56},{rl:"book",rawText:"Book",rawId:6},{rl:"bookSection",rawText:"Book Section",rawId:5},{rl:"case",rawText:"Case",rawId:7},{rl:"catalog",rawText:"Catalog",rawId:8},{rl:"chartOrTable",rawText:"Chart or Table",rawId:38},{rl:"classicalWork",rawText:"Classical Work",rawId:49},{rl:"computerProgram",rawText:"Computer Program",rawId:9},{rl:"conferencePaper",rawText:"Conference Paper",rawId:47},{rl:"conferenceProceedings",rawText:"Conference Proceedings",rawId:10},{rl:"dataset",rawText:"Dataset",rawId:59},{rl:"dictionary",rawText:"Dictionary",rawId:52},{rl:"editedBook",rawText:"Edited Book",rawId:28},{rl:"electronicArticle",rawText:"Electronic Article",rawId:43},{rl:"electronicBook",rawText:"Electronic Book",rawId:44},{rl:"electronicBookSection",rawText:"Electronic Book Section",rawId:60},{rl:"encyclopedia",rawText:"Encyclopedia",rawId:53},{rl:"equation",rawText:"Equation",rawId:39},{rl:"figure",rawText:"Figure",rawId:37},{rl:"filmOrBroadcast",rawText:"Film or Broadcast",rawId:21},{rl:"generic",rawText:"Generic",rawId:13},{rl:"governmentDocument",rawText:"Government Document",rawId:46},{rl:"grant",rawText:"Grant",rawId:54},{rl:"hearing",rawText:"Hearing",rawId:14},{rl:"journalArticle",rawText:"Journal Article",rawId:17},{rl:"legalRuleOrRegulation",rawText:"Legal Rule or Regulation",rawId:50},{rl:"magazineArticle",rawText:"Magazine Article",rawId:19},{rl:"manuscript",rawText:"Manuscript",rawId:36},{rl:"map",rawText:"Map",rawId:20},{rl:"music",rawText:"Music",rawId:61},{rl:"newspaperArticle",rawText:"Newspaper Article",rawId:23},{rl:"onlineDatabase",rawText:"Online Database",rawId:45},{rl:"onlineMultimedia",rawText:"Online Multimedia",rawId:48},{rl:"pamphlet",rawText:"Pamphlet",rawId:24},{rl:"patent",rawText:"Patent",rawId:25},{rl:"personalCommunication",rawText:"Personal Communication",rawId:26},{rl:"report",rawText:"Report",rawId:27},{rl:"serial",rawText:"Serial",rawId:57},{rl:"standard",rawText:"Standard",rawId:58},{rl:"statute",rawText:"Statute",rawId:31},{rl:"thesis",rawText:"Thesis",rawId:32},{rl:"unpublished",rawText:"Unpublished Work",rawId:34},{rl:"web",rawText:"Web Page",rawId:12}],rlMap:new Map,rawMap:new Map}}});var Bl={};Ir(Bl,{parseRef:()=>sf,readStream:()=>wO,setup:()=>bO,translations:()=>qe,writeStream:()=>vO});function wO(r,e){let t={defaultType:"journalArticle",delimeter:"\r",reformatAuthors:!0,journal:"long",parseAddress:!0,parseDoi:!0,parseYear:!0,fieldsReplace:[],...e};t.fieldsReplace.push({from:"type",to:"type",delete:!1,reformat:s=>qe.types.rawMap[s]||t.defaultType}),t.fieldsReplace.push({to:"authors",reformat:(s,a)=>(a.medlineAuthorsShort||a.medlineAuthorsFull||[]).map(l=>l.replace(/^(?<last>[\w-]+?) (?<initials>\w+)$/,(u,h,f)=>h&&f?h+", "+f.split("").map(m=>`${m}.`).join(" "):h||u))}),t.fieldsReplace.push({to:"journal",reformat:t.journal.long?(s,a)=>a.medlineJournalFull||a.medlineJournalShort:(s,a)=>a.medlineJournalShort||a.medlineJournalLong}),t.parseAddress&&t.fieldsReplace.push({from:"medlineAuthorsAffiliation",to:"address",delete:!1,reformat:s=>s?s.join(t.delimeter):!1}),t.parseDoi&&t.fieldsReplace.push({from:"medlineArticleID",to:"doi",delete:!1,reformat:s=>{var a;return((a=/(?<doi>[\w\.\/_]+) \[doi\]/.exec(s))==null?void 0:a.groups.doi)||!1}}),t.parseYear&&t.fieldsReplace.push({from:"date",to:"year",delete:!1,reformat:s=>{var a;return((a=/(?<year>\d{4}\b)/.exec(s))==null?void 0:a.groups.year)||!1}});let n=Me(),i="";return setTimeout(()=>{r.on("data",s=>{n.emit("progress",r.bytesRead),i+=s.toString();let a=0,l=/(\r\n|\n){2,}/g,u;for(;u=l.exec(i);){let h=sf(i.substring(a,u.index),t);n.emit("ref",h),a=u.index+u[0].length}i=i.substring(a)}).on("error",s=>n.emit("error",s)).on("end",()=>{i.replace(/\s+/,"")&&n.emit("ref",sf(i,t)),n.emit("end")})}),n}function vO(r,e){let t={defaultType:"journalArticle",delimeter:"\r",...e};return{start(){return Promise.resolve()},write:n=>{let i={type:t.defaultType,title:"<NO TITLE>",...n};return r.write(qe.fields.collectionOutput.filter(s=>i[s.rl]).flatMap(s=>s.rl=="type"?"TY - "+(qe.types.rlMap.get(i.type)||qe.types.rlMap.get(t.defaultType)).raw:s.rl=="title"?["TI - "+i.title,...(i.authors||[]).flatMap((a,l)=>{var u,h,f,m;return[(u=i.medlineAuthorsFull)!=null&&u[l]?`FAU - ${i.medlineAuthorsFull[l]}`:`FAU - ${i.authors[l]}`,((h=i.medlineAuthorsShort)==null?void 0:h[l])&&`AU - ${i.medlineAuthorsShort[l]}`,((f=i.medlineAuthorsAffiliation)==null?void 0:f[l])&&`AD - ${i.medlineAuthorsAffiliation[l]}`,((m=i.medlineAuthorsId)==null?void 0:m[l])&&`AUID- ${i.medlineAuthorsId[l]}`].filter(Boolean)})]:s.outputSkip?[]:s.outputRepeat&&Array.isArray(i[s.rl])?i[s.rl].map(a=>s.raw.padEnd(4," ")+"- "+a):Array.isArray(i[s.rl])?s.raw.padEnd(4," ")+"- "+i[s.rl].join(t.delimeter):s.raw.padEnd(4," ")+"- "+i[s.rl]).concat([`
|
|
25
|
+
`]).join(`
|
|
26
|
+
`)),Promise.resolve()},end(){return new Promise((n,i)=>r.end(s=>s?i(s):n()))}}}function sf(r,e){var i;let t={},n;return r.split(/[\r\n|\n]/).forEach(s=>{var u;let a=(u=/^\s*(?<key>[A-Z]+?)\s*-\s+(?<value>.*)$/s.exec(s))==null?void 0:u.groups;if(!a){s=s.trimStart(),s.replace(/\s+/,"")&&n&&(n.inputArray?t[n.rl].push(s):t[n.rl]+=" "+s);return}let l=qe.fields.rawMap.get(a.key);if(n!=null&&n.trimDotSuffix&&(t[n.rl]=t[n.rl].replace(/\.$/,"")),l)l.inputArray?(t[l.rl]?t[l.rl].push(a.value):t[l.rl]=[a.value],n=l):(t[l.rl]=a.value,n=l);else{n=null;return}}),((i=e.fieldsReplace)==null?void 0:i.length)>0&&e.fieldsReplace.forEach(s=>{var l;let a=s.from?t[s.from]:null;s.reformat&&(a=s.reformat(a,t),a===!1)||(t[s.to]=a,s.from&&((l=s.delete)==null||l)&&delete t[s.from])}),t}function bO(){qe.fields.collectionOutput=qe.fields.collection.filter(r=>r.sort!==!1).sort((r,e)=>{var t,n,i,s;return((t=r.sort)!=null?t:1e3)==((n=e.sort)!=null?n:1e3)?0:((i=r.sort)!=null?i:1e3)<((s=e.sort)!=null?s:1e3)?-1:1}),qe.fields.collection.forEach(r=>{qe.fields.rlMap.set(r.rl,r),qe.fields.rawMap.set(r.raw,r)}),qe.types.collection.forEach(r=>{qe.types.rlMap.set(r.rl,r),qe.types.rawMap.set(r.raw,r)})}var qe,EE=_(()=>{_r();qe={fields:{collection:[{rl:"medlinePMID",raw:"PMID",sort:0},{rl:"medlineOwner",raw:"OWN",sort:1},{rl:"medlineStatus",raw:"STAT",sort:2},{rl:"medlineDateRevised",raw:"DR",sort:3},{rl:"medlineISSN",raw:"IS",outputRepeat:!0,inputArray:!0,sort:4},{rl:"date",raw:"DP",sort:5},{rl:"title",raw:"TI",sort:6,trimDotSuffix:!0},{rl:"doi",raw:"LID",sort:7},{rl:"abstract",raw:"AB",sort:8},{rl:"medlineCopyright",raw:"CI",sort:7},{rl:"medlineAuthorsFull",raw:"FAU",sort:10,outputSkip:!0,inputArray:!0},{rl:"medlineAuthorsShort",raw:"AU",sort:10,outputSkip:!0,inputArray:!0},{rl:"medlineAuthorsAffiliation",raw:"AD",sort:10,outputSkip:!0,inputArray:!0},{rl:"medlineAuthorsId",raw:"AUID",sort:10,outputSkip:!0,inputArray:!0},{rl:"language",raw:"LA",sort:11},{rl:"medlineGrantNumber",raw:"GR",sort:12},{rl:"type",raw:"PT",sort:14},{rl:"medlineTypeSecondary",raw:"PTX"},{rl:"medlineDateElectronicPublication",raw:"DEP",sort:15},{rl:"address",raw:"PL",sort:16},{rl:"medlineJournalShort",raw:"TA",sort:17},{rl:"medlineJournalFull",raw:"JT",sort:18},{rl:"medlineNLMID",raw:"JID",sort:19},{rl:"medlineSubset",raw:"SB",sort:20},{rl:"medlineOwnerOtherTerm",raw:"OTO",sort:21},{rl:"keywords",raw:"OT",outputRepeat:!0,inputArray:!0,sort:22},{rl:"medlineEntrezDate",raw:"EDAT",sort:23},{rl:"medlineDateMesh",raw:"MHDA",sort:24},{rl:"medlinePublicationHistoryStatus",raw:"PHST",outputRepeat:!0,inputArray:!0,sort:25},{rl:"medlineArticleID",raw:"AID",sort:26},{rl:"medlineStatusPublication",raw:"PST",sort:27},{rl:"medlineSource",raw:"SO",sort:27},{rl:"notes",raw:"GN",inputArray:!0,outputRepeat:!0,sort:28},{rl:"isbn",raw:"ISBN"},{rl:"volume",raw:"VI"},{rl:"medlineVolumeTitle",raw:"VTI"},{rl:"pages",raw:"PG"},{rl:"medlineInvestigatorAffiliation",raw:"IRAD"},{rl:"medlineInvestigatorName",raw:"IR"},{rl:"medlineInvestigatorNameFull",raw:"FIR"},{rl:"medlineTitleBook",raw:"BTI"},{rl:"medlineTitleCollection",raw:"CTI"},{rl:"medlineConflictOfInterestStatement",raw:"COIS"},{rl:"medlineCorporateAuthor",raw:"CN"},{rl:"medlineDateCreate",raw:"CRDT"},{rl:"medlineDateCreated",raw:"DA"},{rl:"medlineDateCompleted",raw:"DCOM"},{rl:"medlineEdition",raw:"EN"},{rl:"medlineEditor",raw:"ED"},{rl:"medlineEditorFull",raw:"FED"},{rl:"medlineGeneSymbol",raw:"GS"},{rl:"medlineISSN",raw:"IS"},{rl:"number",raw:"IP"},{rl:"medlineManuscriptID",raw:"MID"},{rl:"medlineMeshTerms",raw:"MH",outputRepeat:!0,inputArray:!0},{rl:"medlineReferenceCount",raw:"RF"},{rl:"medlineAbstractOther",raw:"OAB"},{rl:"medlineCopyrightOther",raw:"OCI"},{rl:"medlineIDOther",raw:"OID"},{rl:"medlinePersonalName",raw:"PS"},{rl:"medlinePersonalNameFull",raw:"FPS"},{rl:"medlinePublishingModel",raw:"PUBM"},{rl:"medlinePubMedCentralID",raw:"PMC"},{rl:"medlinePubMedCentralRelease",raw:"PMCR"},{rl:"medlineRegistryNumber",raw:"RN"},{rl:"medlineSubstanceName",raw:"NM"},{rl:"medlineSecondarySource",raw:"SI"},{rl:"medlineSpaceFlightMission",raw:"SFM"},{rl:"medlineSubset",raw:"SB"},{rl:"medlineTitleTransliterated",raw:"TT",sort:6}],collectionOutput:[],rawMap:new Map,rlMap:new Map},types:{collection:[{raw:"Blog",rl:"blog"},{raw:"Case Reports",rl:"case"},{raw:"Catalog",rl:"catalog"},{raw:"Chart",rl:"chartOrTable"},{raw:"Database",rl:"aggregatedDatabase"},{raw:"Dataset",rl:"dataset"},{raw:"Dictionary",rl:"dictionary"},{raw:"Encyclopedia",rl:"encyclopedia"},{raw:"Journal Article",rl:"journalArticle"},{raw:"Legal Case",rl:"legalRuleOrRegulation"},{raw:"Manuscript",rl:"manuscript"},{raw:"Map",rl:"map"},{raw:"Newspaper Article",rl:"newspaperArticle"},{raw:"Patent",rl:"patent"},{raw:"Preprint",rl:"unpublished"},{raw:"Tables",rl:"chartOrTable"},{raw:"Technical Report",rl:"report"},{raw:"unknown",rl:"unknown"},{raw:"Unpublished Work",rl:"unpublished"},{raw:"Video-Audio Media",rl:"audioVisualMaterial"},{raw:"Web Archive",rl:"web"},{raw:"Address",rl:"personalCommunication"},{raw:"Advertisement",rl:"audioVisualMaterial"},{raw:"Almanac",rl:"book"},{raw:"Anecdotes",rl:"blog"},{raw:"Animation",rl:"filmOrBroadcast"},{raw:"Annual Report",rl:"report"},{raw:"Aphorisms and Proverbs",rl:"pamphlet"},{raw:"Architectural Drawing",rl:"figure"},{raw:"Autobiography",rl:"book"},{raw:"Bibliography",rl:"catalog"},{raw:"Biobibliography",rl:"book"},{raw:"Biography",rl:"book"},{raw:"Book Illustrations",rl:"audioVisualMaterial"},{raw:"Book Review",rl:"magazineArticle"},{raw:"Caricature",rl:"artwork"},{raw:"Cartoon",rl:"audioVisualMaterial"},{raw:"Catalog, Bookseller",rl:"catalog"},{raw:"Catalog, Commercial",rl:"catalog"},{raw:"Catalog, Drug",rl:"catalog"},{raw:"Catalog, Publisher",rl:"catalog"},{raw:"Catalog, Union",rl:"catalog"},{raw:"Chronology",rl:"book"},{raw:"Classical Article",rl:"classicalWork"},{raw:"Clinical Conference",rl:"conferenceProceedings"},{raw:"Clinical Study",rl:"dataset"},{raw:"Clinical Trial, Phase III",rl:"dataset"},{raw:"Clinical Trial, Phase II",rl:"dataset"},{raw:"Clinical Trial, Phase I",rl:"dataset"},{raw:"Clinical Trial, Phase IV",rl:"dataset"},{raw:"Clinical Trial Protocol",rl:"dataset"},{raw:"Clinical Trial",rl:"dataset"},{raw:"Clinical Trial, Veterinary",rl:"dataset"},{raw:"Consensus Development Conference, NIH",rl:"conferenceProceedings"},{raw:"Consensus Development Conference",rl:"conferenceProceedings"},{raw:"Corrected and Republished Article",rl:"journalArticle"},{raw:"Database",rl:"onlineDatabase"},{raw:"Dictionary, Chemical",rl:"dictionary"},{raw:"Dictionary, Classical",rl:"dictionary"},{raw:"Dictionary, Dental",rl:"dictionary"},{raw:"Dictionary, Medical",rl:"dictionary"},{raw:"Dictionary, Pharmaceutic",rl:"dictionary"},{raw:"Dictionary, Polyglot",rl:"dictionary"},{raw:"Documentaries and Factual Films",rl:"filmOrBroadcast"},{raw:"Drawing",rl:"audioVisualMaterial"},{raw:"Ephemera",rl:"artwork"},{raw:"Eulogy",rl:"personalCommunication"},{raw:"Formulary, Dental",rl:"dataset"},{raw:"Formulary, Homeopathic",rl:"dataset"},{raw:"Formulary, Hospital",rl:"dataset"},{raw:"Formulary",rl:"dataset"},{raw:"Funeral Sermon",rl:"personalCommunication"},{raw:"Government Publication",rl:"governmentDocument"},{raw:"Graphic Novel",rl:"artwork"},{raw:"Historical Article",rl:"ancientText"},{raw:"Incunabula",rl:"ancientText"},{raw:"Incunabula",rl:"ancientText"},{raw:"Instructional Film and Video",rl:"filmOrBroadcast"},{raw:"Introductory Journal Article",rl:"journalArticle"},{raw:"Legislation",rl:"statute"},{raw:"Letter",rl:"personalCommunication"},{raw:"Manuscript, Medical",rl:"manuscript"},{raw:"Movable Books",rl:"books"},{raw:"News",rl:"newspaperArticle"},{raw:"Pharmacopoeia, Homeopathic",rl:"book"},{raw:"Pharmacopoeia",rl:"book"},{raw:"Photograph",rl:"audioVisualMaterial"},{raw:"Pictorial Work",rl:"audioVisualMaterial"},{raw:"Poetry",rl:"artwork"},{raw:"Portrait",rl:"artwork"},{raw:"Postcard",rl:"audioVisualMaterial"},{raw:"Poster",rl:"audioVisualMaterial"},{raw:"Public Service Announcement",rl:"governmentDocument"},{raw:"Research Support, N.I.H., Extramural",rl:"grant"},{raw:"Research Support, N.I.H., Intramural",rl:"grant"},{raw:"Research Support, Non-U.S. Gov't",rl:"grant"},{raw:"Research Support, U.S. Government",rl:"grant"},{raw:"Research Support, U.S. Gov't, Non-P.H.S.",rl:"grant"},{raw:"Research Support, U.S. Gov't, P.H.S.",rl:"grant"},{raw:"Resource Guide",rl:"standard"},{raw:"Retracted Publication",rl:"journalArticle"},{raw:"Retraction of Publication",rl:"journalArticle"},{raw:"Sermon",rl:"journalArticle"},{raw:"Statistics",rl:"chartOrTable"},{raw:"Study Guide",rl:"standard"},{raw:"Terminology",rl:"catalog"},{raw:"Textbook",rl:"book"},{raw:"Unedited Footage",rl:"audioVisualMaterial"},{raw:"Webcast",rl:"web"},{raw:"Wit and Humor",rl:"artwork"},{rl:"",raw:"Abbreviations"},{rl:"",raw:"Abstracts"},{rl:"",raw:"Academic Dissertation"},{rl:"",raw:"Account Book"},{rl:"",raw:"Adaptive Clinical Trial"},{rl:"",raw:"Atlas"},{rl:"",raw:"Bookplate"},{rl:"",raw:"Broadside"},{rl:"",raw:"Calendar"},{rl:"",raw:"Collected Correspondence"},{rl:"",raw:"Collected Work"},{rl:"",raw:"Collection"},{rl:"",raw:"Comment"},{rl:"",raw:"Comparative Study"},{rl:"",raw:"Congress"},{rl:"",raw:"Controlled Clinical Trial"},{rl:"",raw:"Cookbook"},{rl:"",raw:"Diary"},{rl:"",raw:"Directory"},{rl:"",raw:"Dispensatory"},{rl:"",raw:"Duplicate Publication"},{rl:"",raw:"Editorial"},{rl:"",raw:"Electronic Supplementary Materials"},{rl:"",raw:"English Abstract"},{rl:"",raw:"Equivalence Trial"},{rl:"",raw:"Essay"},{rl:"",raw:"Evaluation Study"},{rl:"",raw:"Examination Questions"},{rl:"",raw:"Exhibition"},{rl:"",raw:"Expression of Concern"},{rl:"",raw:"Festschrift"},{rl:"",raw:"Fictional Work"},{rl:"",raw:"Form"},{rl:"",raw:"legalRuleOrRegulation"},{rl:"",raw:"Guidebook"},{rl:"",raw:"Guideline"},{rl:"",raw:"Handbook"},{rl:"",raw:"Herbal"},{rl:"",raw:"Index"},{rl:"",raw:"Interactive Tutorial"},{rl:"",raw:"Interview"},{rl:"",raw:"Juvenile Literature"},{rl:"",raw:"Laboratory Manual"},{rl:"",raw:"Lecture Note"},{rl:"",raw:"Meeting Abstract"},{rl:"",raw:"Meta-Analysis"},{rl:"",raw:"Monograph"},{rl:"",raw:"Multicenter Study"},{rl:"",raw:"Nurses Instruction"},{rl:"",raw:"Observational Study"},{rl:"",raw:"Observational Study, Veterinary"},{rl:"",raw:"Outline"},{rl:"",raw:"Overall"},{rl:"",raw:"Patient Education Handout"},{rl:"",raw:"Periodical"},{rl:"",raw:"Periodical Index"},{rl:"",raw:"Personal Narrative"},{rl:"",raw:"Phrases"},{rl:"",raw:"Popular Work"},{rl:"",raw:"Practice Guideline"},{rl:"",raw:"Pragmatic Clinical Trial"},{rl:"",raw:"Price List"},{rl:"",raw:"Problems and Exercises"},{rl:"",raw:"Program"},{rl:"",raw:"Programmed Instruction"},{rl:"",raw:"Prospectus"},{rl:"",raw:"Publication Components"},{rl:"",raw:"Publication Formats"},{rl:"",raw:"Published Erratum"},{rl:"",raw:"Randomized Controlled Trial"},{rl:"",raw:"Randomized Controlled Trial, Veterinary"},{rl:"",raw:"Research Support, American Recovery and Reinvestment Act"},{rl:"",raw:"Review"},{rl:"",raw:"Scientific Integrity Review"},{rl:"",raw:"Study Characteristics"},{rl:"",raw:"Support of Research"},{rl:"",raw:"Systematic Review"},{rl:"",raw:"Twin Study"},{rl:"",raw:"Union List"},{rl:"",raw:"Validation Study"}],rawMap:new Map,rlMap:new Map}}});var $l={};Ir($l,{parseRef:()=>of,readStream:()=>TO,setup:()=>IO,translations:()=>Qe,writeStream:()=>EO});function TO(r,e){let t={defaultType:"journalArticle",delimeter:"\r",...e},n=Me(),i="";return setTimeout(()=>{r.on("data",s=>{n.emit("progress",r.bytesRead),i+=s.toString();let a=0,l=/(\r\n|\n)ER\s+-\s*(\r\n|\n)/g,u;for(;u=l.exec(i);){let h=of(i.substring(a,u.index),t);n.emit("ref",h),a=u.index+u[0].length}i=i.substring(a)}).on("error",s=>n.emit("error",s)).on("end",()=>{i.replace(/\s+/,"")&&n.emit("ref",of(i,t)),n.emit("end")})}),n}function EO(r,e){let t={defaultType:"journalArticle",delimeter:"\r",...e};return{start(){return Promise.resolve()},write:n=>{var a;let i={type:t.defaultType,title:"<NO TITLE>",...n};if(n.pages){var s=(a=/^(?<_pageStart>.+?)(-(?<_pageEnd>.+))?$/.exec(n.pages))==null?void 0:a.groups;Object.assign(i,s),delete i.pages}return r.write(Qe.fields.collectionOutput.filter(l=>i[l.rl]).flatMap(l=>l.rl=="type"?"TY - "+(Qe.types.rlMap[i.type]||"JOUR"):l.outputRepeat&&Array.isArray(i[l.rl])?i[l.rl].map(u=>`${l.raw} - ${u}`):Array.isArray(i[l.rl])?`${l.raw} - ${i[l.rl].join(t.delimeter)}`:`${l.raw} - ${i[l.rl]}`).concat([`ER -
|
|
27
|
+
|
|
28
|
+
`]).join(`
|
|
29
|
+
`)),Promise.resolve()},end(){return new Promise((n,i)=>r.end(s=>s?i(s):n()))}}}function of(r,e){let t={},n;return r.split(/[\r\n|\n]/).forEach(i=>{var l,u;let s=(l=/^\s*(?<key>[A-Z0-9]+?)\s+-\s+(?<value>.*)$/s.exec(i))==null?void 0:l.groups;if(!s){i.replace(/\s+/,"")&&n&&(n.inputArray?t[n.rl].push(i):t[n.rl]+=e.delimeter+i);return}if(s.key=="ER")return;let a=Qe.fields.rawMap.get(s.key);if(a)a.rl=="type"?(t[a.rl]=((u=Qe.types.rawMap.get(s.value))==null?void 0:u.rl)||e.defaultType,n=a):a.inputArray?(!t[a.rl]||!Array.isArray(t[a.rl])?t[a.rl]=[s.value]:t[a.rl].push(s.value),n=a):(t[a.rl]=s.value,n=a);else{n=null;return}}),(t._pageStart||t._pageEnd)&&(t.pages=[t._pageStart,t._pageEnd].filter(Boolean).join("-"),delete t._pageStart,delete t._pageEnd),t}function IO(){Qe.fields.collectionOutput=Qe.fields.collection.filter(r=>r.sort!==!1).sort((r,e)=>{var t,n,i,s;return((t=r.sort)!=null?t:1e3)==((n=e.sort)!=null?n:1e3)?0:((i=r.sort)!=null?i:1e3)<((s=e.sort)!=null?s:1e3)?-1:1}),Qe.fields.collection.forEach(r=>{Qe.fields.rlMap.set(r.rl,r),Qe.fields.rawMap.set(r.raw,r)}),Qe.types.collection.forEach(r=>{Qe.types.rlMap.set(r.rl,r),Qe.types.rawMap.set(r.raw,r)})}var Qe,IE=_(()=>{_r();Qe={fields:{collection:[{rl:"authors",raw:"A1",sort:!1,inputArray:!0},{rl:"authors",raw:"A2",sort:!1,inputArray:!0},{rl:"authors",raw:"A3",sort:!1,inputArray:!0},{rl:"authors",raw:"A4",sort:!1,inputArray:!0},{rl:"abstract",raw:"AB"},{rl:"address",raw:"AD"},{rl:"accessionNum",raw:"AN"},{rl:"authors",raw:"AU",sort:4,outputRepeat:!0,inputArray:!0},{rl:"custom1",raw:"C1"},{rl:"custom2",raw:"C2"},{rl:"custom3",raw:"C3"},{rl:"custom4",raw:"C4"},{rl:"custom5",raw:"C5"},{rl:"custom6",raw:"C6"},{rl:"custom7",raw:"C7"},{rl:"custom8",raw:"C8"},{rl:"caption",raw:"CA"},{rl:"fallbackCity",raw:"CY"},{rl:"date",raw:"DA"},{rl:"database",raw:"DB"},{rl:"doi",raw:"DO"},{rl:"databaseProvider",raw:"DP"},{rl:"_pageEnd",raw:"EP",sort:6},{rl:"edition",raw:"ET",sort:7},{rl:"number",raw:"IS",sort:8},{rl:"journal",raw:"J1",sort:!1},{rl:"journal",raw:"JF",sort:3},{rl:"keywords",raw:"KW",outputRepeat:!0,inputArray:!0},{rl:"urls",raw:"L1",sort:!1,inputArray:!0},{rl:"urls",raw:"L2",sort:!1,inputArray:!0},{rl:"urls",raw:"L3",sort:!1,inputArray:!0},{rl:"urls",raw:"L4",sort:!1,inputArray:!0},{rl:"language",raw:"LA"},{rl:"label",raw:"LB"},{rl:"urls",raw:"LK"},{rl:"notes",raw:"N1"},{rl:"fallbackAbstract",raw:"N2"},{rl:"publisher",raw:"PB"},{rl:"year",raw:"PY"},{rl:"isbn",raw:"SN"},{rl:"_pageStart",raw:"SP",sort:5},{rl:"title",raw:"T1",sort:!1},{rl:"journal",raw:"T2",sort:!1},{rl:"title",raw:"TI",sort:1},{rl:"type",raw:"TY",sort:0},{rl:"urls",raw:"UR",outputRepeat:!0,inputArray:!0},{rl:"volume",raw:"VL"},{rl:"date",raw:"Y1"},{rl:"accessDate",raw:"Y2"},{rl:"RISID",raw:"ID"},{rl:"RISShortTitle",raw:"ST"},{rl:"RISOriginalPublication",raw:"OP"}],collectionOutput:[],rawMap:new Map,rlMap:new Map},types:{collection:[{rl:"audioVisualMaterial",raw:"ADVS"},{rl:"journalArticle",raw:"JOUR"},{rl:"personalCommunication",raw:"PCOMM"},{rl:"filmOrBroadcast",raw:"VIDEO"},{rl:"unknown",raw:"ABST"},{rl:"aggregatedDatabase",raw:"AGGR"},{rl:"ancientText",raw:"ANCIENT"},{rl:"artwork",raw:"ART"},{rl:"bill",raw:"BILL"},{rl:"blog",raw:"BLOG"},{rl:"book",raw:"BOOK"},{rl:"case",raw:"CASE"},{rl:"bookSection",raw:"CHAP"},{rl:"chartOrTable",raw:"CHART"},{rl:"classicalWork",raw:"CLSWK"},{rl:"computerProgram",raw:"COMP"},{rl:"conferenceProceedings",raw:"CONF"},{rl:"conferencePaper",raw:"CPAPER"},{rl:"catalog",raw:"CTLG"},{rl:"dataset",raw:"DATA"},{rl:"onlineDatabase",raw:"DBASE"},{rl:"dictionary",raw:"DICT"},{rl:"electronicBook",raw:"EBOOK"},{rl:"electronicBookSection",raw:"ECHAP"},{rl:"editedBook",raw:"EDBOOK"},{rl:"electronicArticle",raw:"EJOUR"},{rl:"web",raw:"ELEC"},{rl:"encyclopedia",raw:"ENCYC"},{rl:"equation",raw:"EQUA"},{rl:"figure",raw:"FIGURE"},{rl:"generic",raw:"GEN"},{rl:"governmentDocument",raw:"GOVDOC"},{rl:"grant",raw:"GRANT"},{rl:"hearing",raw:"HEARING"},{rl:"personalCommunication",raw:"ICOMM"},{rl:"newspaperArticle",raw:"INPR"},{rl:"journalArticle",raw:"JFULL"},{rl:"legalRuleOrRegulation",raw:"LEGAL"},{rl:"manuscript",raw:"MANSCPT"},{rl:"map",raw:"MAP"},{rl:"magazineArticle",raw:"MGZN"},{rl:"filmOrBroadcast",raw:"MPCT"},{rl:"onlineMultimedia",raw:"MULTI"},{rl:"music",raw:"MUSIC"},{rl:"newspaperArticle",raw:"NEWS"},{rl:"pamphlet",raw:"PAMP"},{rl:"patent",raw:"PAT"},{rl:"report",raw:"RPRT"},{rl:"serial",raw:"SER"},{rl:"audioVisualMaterial",raw:"SLIDE"},{rl:"audioVisualMaterial",raw:"SOUND"},{rl:"standard",raw:"STAND"},{rl:"statute",raw:"STAT"},{rl:"thesis",raw:"THES"},{rl:"unpublished",raw:"UNPB"}],rawMap:new Map,rlMap:new Map}}});var af={};Ir(af,{endnoteXml:()=>Ul,json:()=>Fl,medline:()=>Bl,ris:()=>$l});var AE=_(()=>{gE();TE();EE();IE()});function gi(r,e){if(!r)throw new Error("No module provided");let t={setup:!0,...e},n=af[r];if(!n)throw new Error(`Unknown module "${r}"`);return n.setup&&t.setup&&!xE.has(r)&&(xE.add(r),n.setup()),n}var xE,ql=_(()=>{AE();xE=new Set});function zl(r,e,t){if(!r)throw new Error("No module provided to parse with");if(!e)throw new Error("No stream provided to parse");return gi(r).writeStream(e,t)}var lf=_(()=>{ql()});function SE(r,e){let t={filename:"References.xml",writeStreamOptions:{},promptDownload:!0,...e};return Promise.resolve().then(()=>{let n=mi(t.filename);if(!n)throw new Error(`Unsupported Reflib filename "${t.filename}"`);return n}).then(async n=>{let i=[],a=new WritableStream({write(u){i.push(u)}}).getWriter();a.end=async u=>{await a.close(),u()};let l=await zl(n.id,a,t.writeStreamOptions);return{blobData:i,streamer:l}}).then(async({blobData:n,streamer:i})=>(await i.start(),await r.reduce((s,a)=>s.then(()=>i.write(a)),Promise.resolve()),await i.end(),n)).then(n=>new Blob(n)).then(n=>{if(!t.promptDownload)return n;let i=URL.createObjectURL(n),s=document.createElement("a");s.href=i,s.download=t.filename,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)})}var RE=_(()=>{Ml();lf()});function Gl(r,e,t){if(!r)throw new Error("No module provided to parse with");if(!e)throw new Error("No stream provided to parse");return gi(r).readStream(e,t)}var uf=_(()=>{ql()});function cf(r){if(r.getReader){let e=new Me;return Object.assign(e,{isBrowser:!0,bytesRead:0,reader:r.getReader(),textDecoder:new TextDecoder("utf-8"),read(){this.reader.read().then(({done:t,value:n})=>{if(t)e.emit("end"),this.pipeTarget&&this.pipeTarget.end();else if(n){let i=this.textDecoder.decode(n);this.bytesRead+=i.length,e.emit("data",i),this.pipeTarget&&this.pipeTarget.write(i),setTimeout(this.read.bind(this))}}).catch(t=>this.emit("error",t))},pipeTarget:null,pipe(t){return this.pipeTarget=t,this}}),setTimeout(()=>e.read()),e}else return r}var PE=_(()=>{_r()});function hf(r){let e={...r};if(e.file){if(!(e.file instanceof File))throw new Error('Expected "file" setting to uploadFile() to be a File type');let t=mi(e.file.name);if(!t)throw new Error(`Unidenfified file format from filename "${e.file.name}"`);let n=[];return Promise.resolve().then(()=>e.onStart&&e.onStart(e.file)).then(()=>new Promise((i,s)=>{let a=Gl(t.id,cf(e.file.stream()),{...e,size:e.file.size}).on("end",()=>i(n)).on("error",l=>s(l)).on("ref",l=>n.push(l));e.onProgress&&a.on("progress",e.onProgress)})).then(()=>e.onEnd&&e.onEnd()).then(()=>n)}else return new Promise(t=>{let n=document.createElement("div");n.style.display="none",document.body.appendChild(n);let i=document.createElement("input");i.type="file",i.accept=Object.values(pi).flatMap(s=>s.ext).join(","),i.addEventListener("change",s=>{document.body.removeChild(n),t(hf({file:s.target.files[0],...r}))}),n.appendChild(i),i.dispatchEvent(new MouseEvent("click"))})}var CE=_(()=>{Ll();Ml();uf();PE()});function kE(r){if(r.doi){let e="https://dx.doi.org/";return r.doi.startsWith(e)&&(r.doi=r.doi.slice(e.length)),r.doi}return null}var DE=_(()=>{});var OE,NE=_(()=>{RE();Ll();ql();Ml();uf();CE();lf();DE();OE={downloadFile:SE,formats:pi,getModule:gi,identifyFormat:mi,readStream:Gl,uploadFile:hf,writeStream:zl,getRefDoi:kE}});function VE(r,e=0){return(Ae[r[e+0]]+Ae[r[e+1]]+Ae[r[e+2]]+Ae[r[e+3]]+"-"+Ae[r[e+4]]+Ae[r[e+5]]+"-"+Ae[r[e+6]]+Ae[r[e+7]]+"-"+Ae[r[e+8]]+Ae[r[e+9]]+"-"+Ae[r[e+10]]+Ae[r[e+11]]+Ae[r[e+12]]+Ae[r[e+13]]+Ae[r[e+14]]+Ae[r[e+15]]).toLowerCase()}var Ae,LE=_(()=>{Ae=[];for(let r=0;r<256;++r)Ae.push((r+256).toString(16).slice(1))});function ff(){if(!df){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");df=crypto.getRandomValues.bind(crypto)}return df(AO)}var df,AO,ME=_(()=>{AO=new Uint8Array(16)});var xO,pf,FE=_(()=>{xO=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),pf={randomUUID:xO}});function SO(r,e,t){var i,s,a;if(pf.randomUUID&&!e&&!r)return pf.randomUUID();r=r||{};let n=(a=(s=r.random)!=null?s:(i=r.rng)==null?void 0:i.call(r))!=null?a:ff();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let l=0;l<16;++l)e[t+l]=n[l];return e}return VE(n)}var mf,jE=_(()=>{FE();ME();LE();mf=SO});var UE=_(()=>{jE()});var BE={};Ir(BE,{default:()=>RO});var RO,$E=_(()=>{NE();UE();gf();RO={projects:{singular:"project",async initState({supabase:r,id:e}){let t=await _e.wrapSupabase(r.from("projects").select("data").limit(1).eq("id",e));if(t.length!==1)throw new Error(`Syncro project "${e}" not found`);let n=t[0].data;if(console.log("[MIGRATION] State of temp at start:",n.temp),!n.temp||Object.values(n.temp).every(i=>typeof i!="object"))return n;throw new Error("Project data version unsupported")},flushState({supabase:r,state:e,fsId:t}){return _e.wrapSupabase(r.rpc("syncro_merge_data",{table_name:"projects",entity_id:t,new_data:e}))}},project_libraries:{singular:"project library",initState({supabase:r,id:e,relation:t}){if(!t||!/_\*$/.test(t))throw new Error('Project library relation missing, path should resemble "project_library::${PROJECT}::${LIBRARY_FILE_ID}_*"');let n=t.replace(/_\*$/,"");return Promise.resolve().then(()=>_e.wrapSupabase(r.storage.from("projects").list(e))).then(i=>i.find(s=>s.id==n)).then(i=>i||Promise.reject(`Invalid file ID "${n}"`)).then(i=>_e.wrapSupabase(r.storage.from("projects").download(`${e}/${i.name}`)).then(s=>({blob:s,file:i}))).then(({blob:i,file:s})=>OE.uploadFile({file:new File([i],s.name.replace(/^.*[/\\]/,""))})).then(i=>Object.fromEntries(i.map(s=>[mf(),s])))},flushState({supabase:r,id:e,relation:t}){throw new Error("Flushing project_libraries::* namespace is not yet supported")}},project_namespaces:{singular:"project namespace",initState({supabase:r,id:e,relation:t}){if(!t)throw new Error('Project namespace relation missing, path should resemble "project_namespaces::${PROJECT}::${RELATION}"');return _e.wrapSupabase(r.from("project_namespaces").select("data").limit(1).eq("project",e).eq("name",t)).then(n=>n.length==1?n[0]:_e.wrapSupabase(r.from("project_namespaces").insert({project:e,name:t,data:{}}).select("data"))).then(n=>n.data)},flushState({supabase:r,state:e,id:t,relation:n}){return _e.wrapSupabase(r.from("project_namespaces").update({edited_at:new Date,data:e}).eq("project",t).eq("name",n))}},test:{singular:"test",initState({supabase:r,id:e}){return _e.wrapSupabase(r.from("test").select("data").limit(1).eq("id",e)).then(t=>t.length==1?t[0]:Promise.reject(`Syncro test item "${e}" not found`)).then(t=>t.data)},flushState({supabase:r,state:e,fsId:t}){return _e.wrapSupabase(r.rpc("syncro_merge_data",{table_name:"test",entity_id:t,new_data:e}))}},users:{singular:"user",initState({supabase:r,id:e}){return _e.wrapSupabase(r.from("users").select("data").limit(1).eq("id",e)).then(t=>t.length==1?t[0]:Promise.reject(`Syncro user "${e}" not found`)).then(t=>t.data)},flushState({supabase:r,state:e,fsId:t}){return _e.wrapSupabase(r.rpc("syncro_merge_data",{table_name:"users",entity_id:t,new_data:e}))}}}});var te,_e,qE,gf=_(()=>{aa();Pd();lE();dE();te=class te{constructor(e,t){ae(this,"path");ae(this,"docRef");ae(this,"value");ae(this,"throttle",250);ae(this,"config",{heartbeatInterval:5e4,syncroRegistryUrl:"https://tera-tools.com/api/sync",forceLocalInit:!1,context:{}});ae(this,"isDirty",!1);ae(this,"_destroyActions",[]);ae(this,"_heartbeatTimer");this.path=e,Object.assign(this,{...t,config:{...this.config,...t==null?void 0:t.config}}),te.session||(te.session=`syncro_${hE()}`)}debug(...e){}destroy(){return this.debug("Destroy!"),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(([i,s])=>t[i]=s)},getState(){return sr(t)},watch(n){}}}static pathSplit(e,t){var a;let n={allowAsterisk:!1,...t},s={...(a=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:a.groups};if(!s)throw new Error(`Invalid session path syntax "${e}"`);if(te.SyncroEntiries&&!(s.entity in SyncroEntities))throw new Error(`Unsupported entity "${e}" -> Entity="${s.entity}"`);return{...s,fsCollection:s.entity,fsId:s.relation?`${s.id}::${s.relation}`:s.id}}static toFirestore(e={}){return Ys.serialize(e,{circular:!1,clone:!0,modules:[qE,...Ys.settings.modules],stringify:!1})}static fromFirestore(e={}){return Ys.deserialize(e,{circular:!1,clone:!0,modules:[qE,...Ys.settings.modules],destringify:!1})}static toFirestoreFields(e){let t={};for(let[n,i]of Object.entries(e)){let s=typeof i;s==="string"?t[n]={stringValue:i}:s==="number"?t[n]={doubleValue:i}:s==="boolean"?t[n]={booleanValue:i}:i===null?t[n]={nullValue:null}:Array.isArray(i)?t[n]={arrayValue:{values:i.map(a=>te.toFirestoreFields({item:a}).item)}}:s==="object"&&(t[n]={mapValue:{fields:te.toFirestoreFields(i)}})}return t}static fromFirestoreFields(e={}){let t={};for(let n in e){let i=e[n];if(["stringValue","booleanValue","doubleValue","integerValue","timestampValue","mapValue","arrayValue"].find(a=>a===n)){if(["stringValue","booleanValue","doubleValue","integerValue","timestampValue"].find(l=>l===n))return i;if(n=="mapValue")return te.fromFirestoreFields(i.fields||{});if(n=="arrayValue"){let l=i.values;return l?l.map(u=>te.fromFirestoreFields(u)):[]}}else t[n]=te.fromFirestoreFields(i)}return t}static getSnapshot(e){let{fsCollection:t,fsId:n}=te.pathSplit(e);return Promise.resolve().then(async()=>Rd(fl(te.firestore,t,n))).then(i=>i?te.fromFirestore(i.data()):null)}static setSnapshot(e,t,n){let i={method:"merge",...n},{fsCollection:s,fsId:a}=te.pathSplit(e);return Promise.resolve().then(()=>(i.method=="merge"?"FirestoreUpdateDoc":"FirestoreSetDoc")(fl(te.firestore,s,a),te.toFirestore(t))).then(()=>t)}static wrapSupabase(e){return Promise.resolve(e).then(t=>{var n,i;if(t!=null&&t.error)throw/JSON object requested, multiple \(or no\) rows returned$/.test(t.error.message)?(console.warn("Supabase query threw record not found against query",e.url.search),console.warn("Supabase raw error",t),new Error("NOT-FOUND")):(console.warn("Supabase query threw",t.error.message),new Error(`${((n=t.error)==null?void 0:n.code)||"UnknownError"}: ${((i=t.error)==null?void 0:i.message)||"Unknown Supabase error"}`));if(t.data)return t.data})}mount(e){let t={initialState:null,...e},{fsCollection:n,fsId:i,entity:s,id:a,relation:l}=te.pathSplit(this.path),u,h;return Promise.resolve().then(()=>this.setHeartbeat(!1)).then(async()=>{this.docRef=fl(te.firestore,n,i);let f=await this.getFirestoreState();if(u=this.getReactive(f),!u.doc||!u.setState||!u.getState||!u.watch)throw new Error("Syncro.getReactive() requires a returned `doc`, `setState()`, `getState()` + `watch()`");this.value=h=u.doc,this.debug("Initial state",{doc:h}),this._destroyActions.push(jb(this.docRef,m=>{let g=te.fromFirestore(m.data());this.debug("Incoming snapshot",{snapshotData:g}),u.setState(g)}))}).then(()=>{if($u(h))return t.initialState?(this.debug("Populate initial Syncro state (from provided initialState)"),this.setFirestoreState(t.initialState,{method:"set"})):this.config.forceLocalInit?(this.debug(`Populate initial Syncro state (from "${s}" SyncroEntities)`),Promise.resolve().then(()=>te.SyncroEntities||Promise.resolve().then(()=>($E(),BE)).then(({default:f})=>te.SyncroEntities=f)).then(()=>te.SyncroEntities[s]||Promise.reject(`Unknown Sync entity "${s}"`)).then(()=>te.SyncroEntities[s].initState({supabase:te.supabase,fsCollection:n,fsId:i,entity:s,id:a,relation:l,...this.config.context}))):(this.debug(`Populate initial Syncro state (from "${s}" Syncro worker)`),fetch(`${this.config.syncroRegistryUrl}/${this.path}`).then(f=>f.ok||Promise.reject(`Failed to check Syncro "${path}" status - ${f.statusText}`)))}).then(()=>{u.watch(Gu(f=>{this.debug("Local change",{newState:f}),this.markDirty(),this.setFirestoreState(f,{method:"merge"})},this.throttle))}).then(()=>this.setHeartbeat(!0,{immediate:!0})).then(()=>this)}setHeartbeat(e=!0,t){let n={immediate:!0,...t};clearTimeout(this._heartbeatTimer),e&&(this._heartbeatTimer=setTimeout(async()=>{await this.heartbeat(),e&&this.setHeartbeat(!0)},this.config.heartbeatInterval),n.immediate&&this.heartbeat())}async heartbeat(){this.debug("heartbeat!"),await fetch(`${this.config.syncroRegistryUrl}/${this.path}/heartbeat`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:te.session,...this.isDirty&&{dirty:!0}})}).then(e=>e.ok?null:console.warn(this.path,`Heartbeat failed - ${e.statusText}`,{response:e})).then(()=>this.isDirty=!1)}setFirestoreState(e,t){let n={method:"merge",...t};if(!this.docRef)throw new Error("mount() must be called before setting Firestore state");return(n.method=="set"?Mb:Fb)(this.docRef,te.toFirestore(e))}getFirestoreState(){if(!this.docRef)throw new Error("mount() must be called before getting Firestore state");return Rd(this.docRef).then(e=>te.fromFirestore(e.data()))}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 occured"))}};ae(te,"firebase"),ae(te,"firestore"),ae(te,"supabase"),ae(te,"session"),ae(te,"SyncroEntities");_e=te,qE={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}}});aa();da();da();var uk="firebase",ck="11.3.1";lr(uk,ck,"app");Pd();var qb=r=>{let e;return r?e=r:typeof fetch=="undefined"?e=(...t)=>Promise.resolve().then(()=>(mr(),jr)).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)};var Ss=class extends Error{constructor(e,t="FunctionsError",n){super(e),this.name=t,this.context=n}},ml=class extends Ss{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}},gl=class extends Ss{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}},yl=class extends Ss{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}},_l;(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"})(_l||(_l={}));var w1=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function l(f){try{h(n.next(f))}catch(m){a(m)}}function u(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?s(f.value):i(f.value).then(l,u)}h((n=n.apply(r,e||[])).next())})},Rs=class{constructor(e,{headers:t={},customFetch:n,region:i=_l.Any}={}){this.url=e,this.headers=t,this.region=i,this.fetch=qb(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var n;return w1(this,void 0,void 0,function*(){try{let{headers:i,method:s,body:a}=t,l={},{region:u}=t;u||(u=this.region),u&&u!=="any"&&(l["x-region"]=u);let h;a&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&(typeof Blob!="undefined"&&a instanceof Blob||a instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",h=a):typeof a=="string"?(l["Content-Type"]="text/plain",h=a):typeof FormData!="undefined"&&a instanceof FormData?h=a:(l["Content-Type"]="application/json",h=JSON.stringify(a)));let f=yield this.fetch(`${this.url}/${e}`,{method:s||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),i),body:h}).catch(C=>{throw new ml(C)}),m=f.headers.get("x-relay-error");if(m&&m==="true")throw new gl(f);if(!f.ok)throw new yl(f);let g=((n=f.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),I;return g==="application/json"?I=yield f.json():g==="application/octet-stream"?I=yield f.blob():g==="text/event-stream"?I=f:g==="multipart/form-data"?I=yield f.formData():I=yield f.text(),{data:I,error:null}}catch(i){return{data:null,error:i}}})}};var rT=vp(tT(),1),{PostgrestClient:nT,PostgrestQueryBuilder:M$,PostgrestFilterBuilder:F$,PostgrestTransformBuilder:j$,PostgrestBuilder:U$,PostgrestError:k1}=rT.default;var iT="2.11.2";var sT={"X-Client-Info":`realtime-js/${iT}`},oT="1.0.0",El=1e4,aT=1e3,Ur;(function(r){r[r.connecting=0]="connecting",r[r.open=1]="open",r[r.closing=2]="closing",r[r.closed=3]="closed"})(Ur||(Ur={}));var Be;(function(r){r.closed="closed",r.errored="errored",r.joined="joined",r.joining="joining",r.leaving="leaving"})(Be||(Be={}));var We;(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"})(We||(We={}));var Tl;(function(r){r.websocket="websocket"})(Tl||(Tl={}));var gr;(function(r){r.Connecting="connecting",r.Open="open",r.Closing="closing",r.Closed="closed"})(gr||(gr={}));var Vs=class{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){let t=new DataView(e),n=new TextDecoder;return this._decodeBroadcast(e,t,n)}_decodeBroadcast(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),a=this.HEADER_LENGTH+2,l=n.decode(e.slice(a,a+i));a=a+i;let u=n.decode(e.slice(a,a+s));a=a+s;let h=JSON.parse(n.decode(e.slice(a,e.byteLength)));return{ref:null,topic:l,event:u,payload:h}}};var Br=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)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};var se;(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"})(se||(se={}));var zd=(r,e,t={})=>{var n;let i=(n=t.skipTypes)!==null&&n!==void 0?n:[];return Object.keys(e).reduce((s,a)=>(s[a]=D1(a,r,e,i),s),{})},D1=(r,e,t,n)=>{let i=e.find(l=>l.name===r),s=i==null?void 0:i.type,a=t[r];return s&&!n.includes(s)?lT(s,a):qd(a)},lT=(r,e)=>{if(r.charAt(0)==="_"){let t=r.slice(1,r.length);return L1(e,t)}switch(r){case se.bool:return O1(e);case se.float4:case se.float8:case se.int2:case se.int4:case se.int8:case se.numeric:case se.oid:return N1(e);case se.json:case se.jsonb:return V1(e);case se.timestamp:return M1(e);case se.abstime:case se.date:case se.daterange:case se.int4range:case se.int8range:case se.money:case se.reltime:case se.text:case se.time:case se.timestamptz:case se.timetz:case se.tsrange:case se.tstzrange:return qd(e);default:return qd(e)}},qd=r=>r,O1=r=>{switch(r){case"t":return!0;case"f":return!1;default:return r}},N1=r=>{if(typeof r=="string"){let e=parseFloat(r);if(!Number.isNaN(e))return e}return r},V1=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch(e){return console.log(`JSON parse error: ${e}`),r}return r},L1=(r,e)=>{if(typeof r!="string")return r;let t=r.length-1,n=r[t];if(r[0]==="{"&&n==="}"){let s,a=r.slice(1,t);try{s=JSON.parse("["+a+"]")}catch{s=a?a.split(","):[]}return s.map(l=>lT(e,l))}return r},M1=r=>typeof r=="string"?r.replace(" ","T"):r,Il=r=>{let e=r;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")};var $r=class{constructor(e,t,n={},i=El){this.channel=e,this.event=t,this.payload=n,this.timeout=i,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 Gd;(function(r){r.SYNC="sync",r.JOIN="join",r.LEAVE="leave"})(Gd||(Gd={}));var ii=class r{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let n=(t==null?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},i=>{let{onJoin:s,onLeave:a,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=r.syncState(this.state,i,s,a),this.pendingDiffs.forEach(u=>{this.state=r.syncDiff(this.state,u,s,a)}),this.pendingDiffs=[],l()}),this.channel._on(n.diff,{},i=>{let{onJoin:s,onLeave:a,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=r.syncDiff(this.state,i,s,a),l())}),this.onJoin((i,s,a)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:a})}),this.onLeave((i,s,a)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,n,i){let s=this.cloneDeep(e),a=this.transformState(t),l={},u={};return this.map(s,(h,f)=>{a[h]||(u[h]=f)}),this.map(a,(h,f)=>{let m=s[h];if(m){let g=f.map(P=>P.presence_ref),I=m.map(P=>P.presence_ref),C=f.filter(P=>I.indexOf(P.presence_ref)<0),k=m.filter(P=>g.indexOf(P.presence_ref)<0);C.length>0&&(l[h]=C),k.length>0&&(u[h]=k)}else l[h]=f}),this.syncDiff(s,{joins:l,leaves:u},n,i)}static syncDiff(e,t,n,i){let{joins:s,leaves:a}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return n||(n=()=>{}),i||(i=()=>{}),this.map(s,(l,u)=>{var h;let f=(h=e[l])!==null&&h!==void 0?h:[];if(e[l]=this.cloneDeep(u),f.length>0){let m=e[l].map(I=>I.presence_ref),g=f.filter(I=>m.indexOf(I.presence_ref)<0);e[l].unshift(...g)}n(l,f,u)}),this.map(a,(l,u)=>{let h=e[l];if(!h)return;let f=u.map(m=>m.presence_ref);h=h.filter(m=>f.indexOf(m.presence_ref)<0),e[l]=h,i(l,h,u),h.length===0&&delete e[l]}),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 i=e[n];return"metas"in i?t[n]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):t[n]=i,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 Kd;(function(r){r.ALL="*",r.INSERT="INSERT",r.UPDATE="UPDATE",r.DELETE="DELETE"})(Kd||(Kd={}));var Hd;(function(r){r.BROADCAST="broadcast",r.PRESENCE="presence",r.POSTGRES_CHANGES="postgres_changes",r.SYSTEM="system"})(Hd||(Hd={}));var _t;(function(r){r.SUBSCRIBED="SUBSCRIBED",r.TIMED_OUT="TIMED_OUT",r.CLOSED="CLOSED",r.CHANNEL_ERROR="CHANNEL_ERROR"})(_t||(_t={}));var si=class r{constructor(e,t={config:{}},n){this.topic=e,this.params=t,this.socket=n,this.bindings={},this.state=Be.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new $r(this,We.join,this.params,this.timeout),this.rejoinTimer=new Br(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Be.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>i.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Be.closed,this.socket._remove(this)}),this._onError(i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=Be.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Be.errored,this.rejoinTimer.scheduleTimeout())}),this._on(We.reply,{},(i,s)=>{this._trigger(this._replyEventName(s),i)}),this.presence=new ii(this),this.broadcastEndpointURL=Il(this.socket.endPoint)+"/api/broadcast",this.private=this.params.config.private||!1}subscribe(e,t=this.timeout){var n,i;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{let{config:{broadcast:s,presence:a,private:l}}=this.params;this._onError(f=>e==null?void 0:e(_t.CHANNEL_ERROR,f)),this._onClose(()=>e==null?void 0:e(_t.CLOSED));let u={},h={broadcast:s,presence:a,postgres_changes:(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&i!==void 0?i:[],private:l};this.socket.accessTokenValue&&(u.access_token=this.socket.accessTokenValue),this.updateJoinPayload(Object.assign({config:h},u)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:f})=>{var m;if(this.socket.setAuth(),f===void 0){e==null||e(_t.SUBSCRIBED);return}else{let g=this.bindings.postgres_changes,I=(m=g==null?void 0:g.length)!==null&&m!==void 0?m:0,C=[];for(let k=0;k<I;k++){let P=g[k],{filter:{event:V,schema:F,table:B,filter:K}}=P,X=f&&f[k];if(X&&X.event===V&&X.schema===F&&X.table===B&&X.filter===K)C.push(Object.assign(Object.assign({},P),{id:X.id}));else{this.unsubscribe(),e==null||e(_t.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=C,e&&e(_t.SUBSCRIBED);return}}).receive("error",f=>{e==null||e(_t.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(_t.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._on(e,t,n)}async send(e,t={}){var n,i;if(!this._canPush()&&e.type==="broadcast"){let{event:s,payload:a}=e,u={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:a,private:this.private}]})};try{let h=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=t.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=h.body)===null||i===void 0?void 0:i.cancel()),h.ok?"ok":"error"}catch(h){return h.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var a,l,u;let h=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(l=(a=this.params)===null||a===void 0?void 0:a.config)===null||l===void 0?void 0:l.broadcast)===null||u===void 0)&&u.ack)&&s("ok"),h.receive("ok",()=>s("ok")),h.receive("error",()=>s("error")),h.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Be.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(We.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(n=>{let i=new $r(this,We.leave,{},e);i.receive("ok",()=>{t(),n("ok")}).receive("timeout",()=>{t(),n("timed out")}).receive("error",()=>{n("error")}),i.send(),this._canPush()||i.trigger("ok",{})})}async _fetchWithTimeout(e,t,n){let i=new AbortController,s=setTimeout(()=>i.abort(),n),a=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),a}_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 i=new $r(this,e,t,n);return this._canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}_onMessage(e,t,n){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,n){var i,s;let a=e.toLocaleLowerCase(),{close:l,error:u,leave:h,join:f}=We;if(n&&[l,u,h,f].indexOf(a)>=0&&n!==this._joinRef())return;let g=this._onMessage(a,t,n);if(t&&!g)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(I=>{var C,k,P;return((C=I.filter)===null||C===void 0?void 0:C.event)==="*"||((P=(k=I.filter)===null||k===void 0?void 0:k.event)===null||P===void 0?void 0:P.toLocaleLowerCase())===a}).map(I=>I.callback(g,n)):(s=this.bindings[a])===null||s===void 0||s.filter(I=>{var C,k,P,V,F,B;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in I){let K=I.id,X=(C=I.filter)===null||C===void 0?void 0:C.event;return K&&((k=t.ids)===null||k===void 0?void 0:k.includes(K))&&(X==="*"||(X==null?void 0:X.toLocaleLowerCase())===((P=t.data)===null||P===void 0?void 0:P.type.toLocaleLowerCase()))}else{let K=(F=(V=I==null?void 0:I.filter)===null||V===void 0?void 0:V.event)===null||F===void 0?void 0:F.toLocaleLowerCase();return K==="*"||K===((B=t==null?void 0:t.event)===null||B===void 0?void 0:B.toLocaleLowerCase())}else return I.type.toLocaleLowerCase()===a}).map(I=>{if(typeof g=="object"&&"ids"in g){let C=g.data,{schema:k,table:P,commit_timestamp:V,type:F,errors:B}=C;g=Object.assign(Object.assign({},{schema:k,table:P,commit_timestamp:V,eventType:F,new:{},old:{},errors:B}),this._getPayloadRecords(C))}I.callback(g,n)})}_isClosed(){return this.state===Be.closed}_isJoined(){return this.state===Be.joined}_isJoining(){return this.state===Be.joining}_isLeaving(){return this.state===Be.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,n){let i=e.toLocaleLowerCase(),s={type:i,filter:t,callback:n};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,t){let n=e.toLocaleLowerCase();return this.bindings[n]=this.bindings[n].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===n&&r.isEqual(i.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}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(We.close,{},e)}_onError(e){this._on(We.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Be.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=zd(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=zd(e.columns,e.old_record)),t}};var j1=()=>{},U1=typeof WebSocket!="undefined",B1=`
|
|
23
30
|
addEventListener("message", (e) => {
|
|
24
31
|
if (e.data.event === "start") {
|
|
25
32
|
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
26
33
|
}
|
|
27
|
-
});`,jn=class{constructor(e,t){var n;this.accessTokenValue=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=n_,this.params={},this.timeout=wa,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=XR,this.conn=null,this.sendBuffer=[],this.serializer=new Zs,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._resolveFetch=i=>{let a;return i?a=i:typeof fetch=="undefined"?a=(...u)=>Promise.resolve().then(()=>(rr(),Er)).then(({default:c})=>c(...u)):a=fetch,(...u)=>a(...u)},this.endPoint=`${e}/${va.websocket}`,this.httpEndpoint=ba(e),t!=null&&t.transport?this.transport=t.transport:this.transport=null,t!=null&&t.params&&(this.params=t.params),t!=null&&t.headers&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),t!=null&&t.timeout&&(this.timeout=t.timeout),t!=null&&t.logger&&(this.logger=t.logger),t!=null&&t.heartbeatIntervalMs&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);let s=(n=t==null?void 0:t.params)===null||n===void 0?void 0:n.apikey;if(s&&(this.accessTokenValue=s,this.apiKey=s),this.reconnectAfterMs=t!=null&&t.reconnectAfterMs?t.reconnectAfterMs:i=>[1e3,2e3,5e3,1e4][i-1]||1e4,this.encode=t!=null&&t.encode?t.encode:(i,a)=>a(JSON.stringify(i)),this.decode=t!=null&&t.decode?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new xr(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(t==null?void 0:t.fetch),t!=null&&t.worker){if(typeof window!="undefined"&&!window.Worker)throw new Error("Web Worker is not supported");this.worker=(t==null?void 0:t.worker)||!1,this.workerUrl=t==null?void 0:t.workerUrl}this.accessToken=(t==null?void 0:t.accessToken)||null}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this.endpointURL(),void 0,{headers:this.headers});return}if(ZR){this.conn=new WebSocket(this.endpointURL()),this.setupConnection();return}this.conn=new dh(this.endpointURL(),void 0,{close:()=>{this.conn=null}}),Promise.resolve().then(()=>xd(u_())).then(({default:e})=>{this.conn=new e(this.endpointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:s_}))}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,t!=null?t:""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}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.disconnect(),e}log(e,t,n){this.logger(e,t,n)}connectionState(){switch(this.conn&&this.conn.readyState){case Ir.connecting:return nr.Connecting;case Ir.open:return nr.Open;case Ir.closing:return nr.Closing;default:return nr.Closed}}isConnected(){return this.connectionState()===nr.Open}channel(e,t={config:{}}){let n=new Fn(`realtime:${e}`,t,this);return this.channels.push(n),n}push(e){let{topic:t,event:n,payload:s,ref:i}=e,a=()=>{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()?a():this.sendBuffer.push(a)}async setAuth(e=null){let t=e||this.accessToken&&await this.accessToken()||this.accessTokenValue;if(t){let n=null;try{n=JSON.parse(atob(t.split(".")[1]))}catch{}if(n&&n.exp&&!(Math.floor(Date.now()/1e3)-n.exp<0))return this.log("auth",`InvalidJWTToken: Invalid value for JWT claim "exp" with value ${n.exp}`),Promise.reject(`InvalidJWTToken: Invalid value for JWT claim "exp" with value ${n.exp}`);this.accessTokenValue=t,this.channels.forEach(s=>{t&&s.updateJoinPayload({access_token:t}),s.joinedOnce&&s._isJoined()&&s._push(Be.access_token,{access_token:t})})}}async sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(e=this.conn)===null||e===void 0||e.close(i_,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth()}}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._joinRef()!==e._joinRef())}setupConnection(){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))}_onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:s,payload:i,ref:a}=t;a&&a===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null),this.log("receive",`${i.status||""} ${n} ${s} ${a&&"("+a+")"||""}`,i),this.channels.filter(u=>u._isMember(n)).forEach(u=>u._trigger(s,i,a)),this.stateChangeCallbacks.message.forEach(u=>u(t))})}async _onConnOpen(){if(this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this.reconnectTimer.reset(),!this.worker)this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs);else{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.workerRef.terminate()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}this.stateChangeCallbacks.open.forEach(e=>e())}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(t=>t(e))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(t=>t(e))}_triggerChanError(){this.channels.forEach(e=>e._trigger(Be.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([eP],{type:"application/javascript"});t=URL.createObjectURL(n)}return t}},dh=class{constructor(e,t,n){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=Ir.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=n.close}};var Un=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};function me(r){return typeof r=="object"&&r!==null&&"__isStorageError"in r}var Ta=class extends Un{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}},Sr=class extends Un{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}};var tP=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(f){try{h(n.next(f))}catch(m){a(m)}}function c(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?i(f.value):s(f.value).then(u,c)}h((n=n.apply(r,e||[])).next())})},Ia=r=>{let e;return r?e=r:typeof fetch=="undefined"?e=(...t)=>Promise.resolve().then(()=>(rr(),Er)).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)},c_=()=>tP(void 0,void 0,void 0,function*(){return typeof Response=="undefined"?(yield Promise.resolve().then(()=>(rr(),Er))).Response:Response}),Ea=r=>{if(Array.isArray(r))return r.map(t=>Ea(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]=Ea(n)}),e};var Rr=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(f){try{h(n.next(f))}catch(m){a(m)}}function c(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?i(f.value):s(f.value).then(u,c)}h((n=n.apply(r,e||[])).next())})},fh=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),rP=(r,e,t)=>Rr(void 0,void 0,void 0,function*(){let n=yield c_();r instanceof n&&!(t!=null&&t.noResolveJson)?r.json().then(s=>{e(new Ta(fh(s),r.status||500))}).catch(s=>{e(new Sr(fh(s),s))}):e(new Sr(fh(r),r))}),nP=(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"},e==null?void 0:e.headers),n&&(s.body=JSON.stringify(n)),Object.assign(Object.assign({},s),t))};function ei(r,e,t,n,s,i){return Rr(this,void 0,void 0,function*(){return new Promise((a,u)=>{r(t,nP(e,n,s,i)).then(c=>{if(!c.ok)throw c;return n!=null&&n.noResolveJson?c:c.json()}).then(c=>a(c)).catch(c=>rP(c,u,n))})})}function Bn(r,e,t,n){return Rr(this,void 0,void 0,function*(){return ei(r,"GET",e,t,n)})}function ct(r,e,t,n,s){return Rr(this,void 0,void 0,function*(){return ei(r,"POST",e,n,s,t)})}function l_(r,e,t,n,s){return Rr(this,void 0,void 0,function*(){return ei(r,"PUT",e,n,s,t)})}function h_(r,e,t,n){return Rr(this,void 0,void 0,function*(){return ei(r,"HEAD",e,Object.assign(Object.assign({},t),{noResolveJson:!0}),n)})}function xa(r,e,t,n,s){return Rr(this,void 0,void 0,function*(){return ei(r,"DELETE",e,n,s,t)})}var Me=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(f){try{h(n.next(f))}catch(m){a(m)}}function c(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?i(f.value):s(f.value).then(u,c)}h((n=n.apply(r,e||[])).next())})},sP={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},d_={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},ti=class{constructor(e,t={},n,s){this.url=e,this.headers=t,this.bucketId=n,this.fetch=Ia(s)}uploadOrUpdate(e,t,n,s){return Me(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},d_),s),u=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(a.upsert)}),c=a.metadata;typeof Blob!="undefined"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),c&&i.append("metadata",this.encodeMetadata(c)),i.append("",n)):typeof FormData!="undefined"&&n instanceof FormData?(i=n,i.append("cacheControl",a.cacheControl),c&&i.append("metadata",this.encodeMetadata(c))):(i=n,u["cache-control"]=`max-age=${a.cacheControl}`,u["content-type"]=a.contentType,c&&(u["x-metadata"]=this.toBase64(this.encodeMetadata(c)))),s!=null&&s.headers&&(u=Object.assign(Object.assign({},u),s.headers));let h=this._removeEmptyFolders(t),f=this._getFinalPath(h),m=yield this.fetch(`${this.url}/object/${f}`,Object.assign({method:e,body:i,headers:u},a!=null&&a.duplex?{duplex:a.duplex}:{})),g=yield m.json();return m.ok?{data:{path:h,id:g.Id,fullPath:g.Key},error:null}:{data:null,error:g}}catch(i){if(me(i))return{data:null,error:i};throw i}})}upload(e,t,n){return Me(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,n)})}uploadToSignedUrl(e,t,n,s){return Me(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),a=this._getFinalPath(i),u=new URL(this.url+`/object/upload/sign/${a}`);u.searchParams.set("token",t);try{let c,h=Object.assign({upsert:d_.upsert},s),f=Object.assign(Object.assign({},this.headers),{"x-upsert":String(h.upsert)});typeof Blob!="undefined"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",h.cacheControl),c.append("",n)):typeof FormData!="undefined"&&n instanceof FormData?(c=n,c.append("cacheControl",h.cacheControl)):(c=n,f["cache-control"]=`max-age=${h.cacheControl}`,f["content-type"]=h.contentType);let m=yield this.fetch(u.toString(),{method:"PUT",body:c,headers:f}),g=yield m.json();return m.ok?{data:{path:i,fullPath:g.Key},error:null}:{data:null,error:g}}catch(c){if(me(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(e,t){return Me(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),s=Object.assign({},this.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");let i=yield ct(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:s}),a=new URL(this.url+i.url),u=a.searchParams.get("token");if(!u)throw new Un("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:u},error:null}}catch(n){if(me(n))return{data:null,error:n};throw n}})}update(e,t,n){return Me(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,n)})}move(e,t,n){return Me(this,void 0,void 0,function*(){try{return{data:yield ct(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers}),error:null}}catch(s){if(me(s))return{data:null,error:s};throw s}})}copy(e,t,n){return Me(this,void 0,void 0,function*(){try{return{data:{path:(yield ct(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers})).Key},error:null}}catch(s){if(me(s))return{data:null,error:s};throw s}})}createSignedUrl(e,t,n){return Me(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e),i=yield ct(this.fetch,`${this.url}/object/sign/${s}`,Object.assign({expiresIn:t},n!=null&&n.transform?{transform:n.transform}:{}),{headers:this.headers}),a=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${a}`)},{data:i,error:null}}catch(s){if(me(s))return{data:null,error:s};throw s}})}createSignedUrls(e,t,n){return Me(this,void 0,void 0,function*(){try{let s=yield ct(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{data:s.map(a=>Object.assign(Object.assign({},a),{signedUrl:a.signedURL?encodeURI(`${this.url}${a.signedURL}${i}`):null})),error:null}}catch(s){if(me(s))return{data:null,error:s};throw s}})}download(e,t){return Me(this,void 0,void 0,function*(){let s=typeof(t==null?void 0:t.transform)!="undefined"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),a=i?`?${i}`:"";try{let u=this._getFinalPath(e);return{data:yield(yield Bn(this.fetch,`${this.url}/${s}/${u}${a}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(u){if(me(u))return{data:null,error:u};throw u}})}info(e){return Me(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{let n=yield Bn(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:Ea(n),error:null}}catch(n){if(me(n))return{data:null,error:n};throw n}})}exists(e){return Me(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{return yield h_(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(me(n)&&n instanceof Sr){let s=n.originalError;if([400,404].includes(s==null?void 0:s.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,t){let n=this._getFinalPath(e),s=[],i=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";i!==""&&s.push(i);let u=typeof(t==null?void 0:t.transform)!="undefined"?"render/image":"object",c=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});c!==""&&s.push(c);let h=s.join("&");return h!==""&&(h=`?${h}`),{data:{publicUrl:encodeURI(`${this.url}/${u}/public/${n}${h}`)}}}remove(e){return Me(this,void 0,void 0,function*(){try{return{data:yield xa(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(t){if(me(t))return{data:null,error:t};throw t}})}list(e,t,n){return Me(this,void 0,void 0,function*(){try{let s=Object.assign(Object.assign(Object.assign({},sP),t),{prefix:e||""});return{data:yield ct(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(me(s))return{data:null,error:s};throw s}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer!="undefined"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};var f_="2.7.1";var p_={"X-Client-Info":`storage-js/${f_}`};var $n=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(f){try{h(n.next(f))}catch(m){a(m)}}function c(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?i(f.value):s(f.value).then(u,c)}h((n=n.apply(r,e||[])).next())})},ri=class{constructor(e,t={},n){this.url=e,this.headers=Object.assign(Object.assign({},p_),t),this.fetch=Ia(n)}listBuckets(){return $n(this,void 0,void 0,function*(){try{return{data:yield Bn(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(me(e))return{data:null,error:e};throw e}})}getBucket(e){return $n(this,void 0,void 0,function*(){try{return{data:yield Bn(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(t){if(me(t))return{data:null,error:t};throw t}})}createBucket(e,t={public:!1}){return $n(this,void 0,void 0,function*(){try{return{data:yield ct(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(me(n))return{data:null,error:n};throw n}})}updateBucket(e,t){return $n(this,void 0,void 0,function*(){try{return{data:yield l_(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(me(n))return{data:null,error:n};throw n}})}emptyBucket(e){return $n(this,void 0,void 0,function*(){try{return{data:yield ct(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(t){if(me(t))return{data:null,error:t};throw t}})}deleteBucket(e){return $n(this,void 0,void 0,function*(){try{return{data:yield xa(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(t){if(me(t))return{data:null,error:t};throw t}})}};var ni=class extends ri{constructor(e,t={},n){super(e,t,n)}from(e){return new ti(this.url,this.headers,e,this.fetch)}};var m_="2.48.1";var si="";typeof Deno!="undefined"?si="deno":typeof document!="undefined"?si="web":typeof navigator!="undefined"&&navigator.product==="ReactNative"?si="react-native":si="node";var iP={"X-Client-Info":`supabase-js-${si}/${m_}`},g_={headers:iP},y_={schema:"public"},__={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},v_={};rr();var oP=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(f){try{h(n.next(f))}catch(m){a(m)}}function c(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?i(f.value):s(f.value).then(u,c)}h((n=n.apply(r,e||[])).next())})},aP=r=>{let e;return r?e=r:typeof fetch=="undefined"?e=Wl:e=fetch,(...t)=>e(...t)},uP=()=>typeof Headers=="undefined"?Ql:Headers,w_=(r,e,t)=>{let n=aP(t),s=uP();return(i,a)=>oP(void 0,void 0,void 0,function*(){var u;let c=(u=yield e())!==null&&u!==void 0?u:r,h=new s(a==null?void 0:a.headers);return h.has("apikey")||h.set("apikey",r),h.has("Authorization")||h.set("Authorization",`Bearer ${c}`),n(i,Object.assign(Object.assign({},a),{headers:h}))})};var cP=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(f){try{h(n.next(f))}catch(m){a(m)}}function c(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?i(f.value):s(f.value).then(u,c)}h((n=n.apply(r,e||[])).next())})};function b_(r){return r.replace(/\/$/,"")}function T_(r,e){let{db:t,auth:n,realtime:s,global:i}=r,{db:a,auth:u,realtime:c,global:h}=e,f={db:Object.assign(Object.assign({},a),t),auth:Object.assign(Object.assign({},u),n),realtime:Object.assign(Object.assign({},c),s),global:Object.assign(Object.assign({},h),i),accessToken:()=>cP(this,void 0,void 0,function*(){return""})};return r.accessToken?f.accessToken=r.accessToken:delete f.accessToken,f}var Aa="2.67.3";var E_="http://localhost:9999",I_="supabase.auth.token";var x_={"X-Client-Info":`gotrue-js/${Aa}`},ph=10;var ii="X-Supabase-Api-Version",mh={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};function A_(r){return Math.round(Date.now()/1e3)+r}function S_(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){let e=Math.random()*16|0;return(r=="x"?e:e&3|8).toString(16)})}var Qe=()=>typeof window!="undefined"&&typeof document!="undefined",Pr={tested:!1,writable:!1},sr=()=>{if(!Qe())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Pr.tested)return Pr.writable;let r=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(r,r),globalThis.localStorage.removeItem(r),Pr.tested=!0,Pr.writable=!0}catch{Pr.tested=!0,Pr.writable=!1}return Pr.writable};function R_(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 Sa=r=>{let e;return r?e=r:typeof fetch=="undefined"?e=(...t)=>Promise.resolve().then(()=>(rr(),Er)).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)},P_=r=>typeof r=="object"&&r!==null&&"status"in r&&"ok"in r&&"json"in r&&typeof r.json=="function",gh=async(r,e,t)=>{await r.setItem(e,JSON.stringify(t))},ai=async(r,e)=>{let t=await r.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},ui=async(r,e)=>{await r.removeItem(e)};function lP(r){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",t="",n,s,i,a,u,c,h,f=0;for(r=r.replace("-","+").replace("_","/");f<r.length;)a=e.indexOf(r.charAt(f++)),u=e.indexOf(r.charAt(f++)),c=e.indexOf(r.charAt(f++)),h=e.indexOf(r.charAt(f++)),n=a<<2|u>>4,s=(u&15)<<4|c>>2,i=(c&3)<<6|h,t=t+String.fromCharCode(n),c!=64&&s!=0&&(t=t+String.fromCharCode(s)),h!=64&&i!=0&&(t=t+String.fromCharCode(i));return t}var oi=class r{constructor(){this.promise=new r.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}};oi.promiseConstructor=Promise;function yh(r){let e=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,t=r.split(".");if(t.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!e.test(t[1]))throw new Error("JWT is not valid: payload is not in base64url format");let n=t[1];return JSON.parse(lP(n))}async function C_(r){return await new Promise(e=>{setTimeout(()=>e(null),r)})}function k_(r,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{let a=await r(i);if(!e(i,null,a)){n(a);return}}catch(a){if(!e(i,a)){s(a);return}}})()})}function hP(r){return("0"+r.toString(16)).substr(-2)}function dP(){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,hP).join("")}async function fP(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("")}function pP(r){return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function mP(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 fP(r);return pP(t)}async function Cr(r,e,t=!1){let n=dP(),s=n;t&&(s+="/PASSWORD_RECOVERY"),await gh(r,`${e}-code-verifier`,s);let i=await mP(n);return[i,n===i?"plain":"s256"]}var gP=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function D_(r){let e=r.headers.get(ii);if(!e||!e.match(gP))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}var ci=class extends Error{constructor(e,t,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=n}};function z(r){return typeof r=="object"&&r!==null&&"__isAuthError"in r}var Ra=class extends ci{constructor(e,t,n){super(e,t,n),this.name="AuthApiError",this.status=t,this.code=n}};function O_(r){return z(r)&&r.name==="AuthApiError"}var qn=class extends ci{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}},Pt=class extends ci{constructor(e,t,n,s){super(e,n,s),this.name=t,this.status=n}},ze=class extends Pt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};function N_(r){return z(r)&&r.name==="AuthSessionMissingError"}var zn=class extends Pt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}},kr=class extends Pt{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}},Dr=class extends Pt{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 V_(r){return z(r)&&r.name==="AuthImplicitGrantRedirectError"}var li=class extends Pt{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}}},Gn=class extends Pt{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}};function Pa(r){return z(r)&&r.name==="AuthRetryableFetchError"}var hi=class extends Pt{constructor(e,t,n){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=n}};var yP=function(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},Or=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),_P=[502,503,504];async function L_(r){var e;if(!P_(r))throw new Gn(Or(r),0);if(_P.includes(r.status))throw new Gn(Or(r),r.status);let t;try{t=await r.json()}catch(i){throw new qn(Or(i),i)}let n,s=D_(r);if(s&&s.getTime()>=mh["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 hi(Or(t),r.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new ze}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,a)=>i&&typeof a=="string",!0))throw new hi(Or(t),r.status,t.weak_password.reasons);throw new Ra(Or(t),r.status||500,n)}var vP=(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 K(r,e,t,n){var s;let i=Object.assign({},n==null?void 0:n.headers);i[ii]||(i[ii]=mh["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);let a=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);let u=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",c=await wP(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 wP(r,e,t,n,s,i){let a=vP(e,n,s,i),u;try{u=await r(t,Object.assign({},a))}catch(c){throw console.error(c),new Gn(Or(c),0)}if(u.ok||await L_(u),n!=null&&n.noResolveJson)return u;try{return await u.json()}catch(c){await L_(c)}}function Ct(r){var e;let t=null;bP(r)&&(t=Object.assign({},r),r.expires_at||(t.expires_at=A_(r.expires_in)));let n=(e=r.user)!==null&&e!==void 0?e:r;return{data:{session:t,user:n},error:null}}function _h(r){let e=Ct(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 lt(r){var e;return{data:{user:(e=r.user)!==null&&e!==void 0?e:r},error:null}}function M_(r){return{data:r,error:null}}function F_(r){let{action_link:e,email_otp:t,hashed_token:n,redirect_to:s,verification_type:i}=r,a=yP(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({},a);return{data:{properties:u,user:c},error:null}}function j_(r){return r}function bP(r){return r.access_token&&r.refresh_token&&r.expires_in}var TP=function(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},Nr=class{constructor({url:e="",headers:t={},fetch:n}){this.url=e,this.headers=t,this.fetch=Sa(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t="global"){try{return await K(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(z(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,t={}){try{return await K(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:lt})}catch(n){if(z(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{let{options:t}=e,n=TP(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 K(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:F_,redirectTo:t==null?void 0:t.redirectTo})}catch(t){if(z(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await K(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:lt})}catch(t){if(z(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,n,s,i,a,u,c;try{let h={nextPage:null,lastPage:0,total:0},f=await K(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:j_});if(f.error)throw f.error;let m=await f.json(),g=(a=f.headers.get("x-total-count"))!==null&&a!==void 0?a:0,E=(c=(u=f.headers.get("link"))===null||u===void 0?void 0:u.split(","))!==null&&c!==void 0?c:[];return E.length>0&&(E.forEach(P=>{let C=parseInt(P.split(";")[0].split("=")[1].substring(0,1)),R=JSON.parse(P.split(";")[1].split("=")[1]);h[`${R}Page`]=C}),h.total=parseInt(g)),{data:Object.assign(Object.assign({},m),h),error:null}}catch(h){if(z(h))return{data:{users:[]},error:h};throw h}}async getUserById(e){try{return await K(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:lt})}catch(t){if(z(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){try{return await K(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:lt})}catch(n){if(z(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,t=!1){try{return await K(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:lt})}catch(n){if(z(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){try{let{data:t,error:n}=await K(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(z(t))return{data:null,error:t};throw t}}async _deleteFactor(e){try{return{data:await K(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(z(t))return{data:null,error:t};throw t}}};var U_={getItem:r=>sr()?globalThis.localStorage.getItem(r):null,setItem:(r,e)=>{sr()&&globalThis.localStorage.setItem(r,e)},removeItem:r=>{sr()&&globalThis.localStorage.removeItem(r)}};function vh(r={}){return{getItem:e=>r[e]||null,setItem:(e,t)=>{r[e]=t},removeItem:e=>{delete r[e]}}}function B_(){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)}}var Vr={debug:!!(globalThis&&sr()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")},di=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}},Ca=class extends di{};async function wh(r,e,t){Vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",r,e);let n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),Vr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",r)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(r,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async s=>{if(s){Vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",r,s.name);try{return await t()}finally{Vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",r,s.name)}}else{if(e===0)throw Vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",r),new Ca(`Acquiring an exclusive Navigator LockManager lock "${r}" immediately failed`);if(Vr.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()}}))}B_();var EP={url:E_,storageKey:I_,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:x_,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},fi=30*1e3,$_=3;async function q_(r,e,t){return await t()}var Lr=class r{constructor(e){var t,n;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=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,this.instanceID=r.nextInstanceID,r.nextInstanceID+=1,this.instanceID>0&&Qe()&&console.warn("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.");let s=Object.assign(Object.assign({},EP),e);if(this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.persistSession=s.persistSession,this.storageKey=s.storageKey,this.autoRefreshToken=s.autoRefreshToken,this.admin=new Nr({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=Sa(s.fetch),this.lock=s.lock||q_,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,s.lock?this.lock=s.lock:Qe()&&(!((t=globalThis==null?void 0:globalThis.navigator)===null||t===void 0)&&t.locks)?this.lock=wh:this.lock=q_,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)},this.persistSession?s.storage?this.storage=s.storage:sr()?this.storage=U_:(this.memoryStorage={},this.storage=vh(this.memoryStorage)):(this.memoryStorage={},this.storage=vh(this.memoryStorage)),Qe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${Aa}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let t=R_(window.location.href),n="none";if(this._isImplicitGrantCallback(t)?n="implicit":await this._isPKCECallback(t)&&(n="pkce"),Qe()&&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),V_(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 await this._removeSession(),{error:i}}let{session:a,redirectType:u}=s;return this._debug("#_initialize()","detected session in URL",a,"redirect type",u),await this._saveSession(a),setTimeout(async()=>{u==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return z(t)?{error:t}:{error:new qn("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,n,s;try{let i=await K(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:Ct}),{data:a,error:u}=i;if(u||!a)return{data:{user:null,session:null},error:u};let c=a.session,h=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:h,session:c},error:null}}catch(i){if(z(i))return{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:m,options:g}=e,E=null,P=null;this.flowType==="pkce"&&([E,P]=await Cr(this.storage,this.storageKey)),i=await K(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:g==null?void 0:g.emailRedirectTo,body:{email:f,password:m,data:(t=g==null?void 0:g.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:g==null?void 0:g.captchaToken},code_challenge:E,code_challenge_method:P},xform:Ct})}else if("phone"in e){let{phone:f,password:m,options:g}=e;i=await K(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:f,password:m,data:(n=g==null?void 0:g.data)!==null&&n!==void 0?n:{},channel:(s=g==null?void 0:g.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:g==null?void 0:g.captchaToken}},xform:Ct})}else throw new kr("You must provide either an email or phone number and a password");let{data:a,error:u}=i;if(u||!a)return{data:{user:null,session:null},error:u};let c=a.session,h=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:h,session:c},error:null}}catch(i){if(z(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let t;if("email"in e){let{email:i,password:a,options:u}=e;t=await K(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}},xform:_h})}else if("phone"in e){let{phone:i,password:a,options:u}=e;t=await K(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}},xform:_h})}else throw new kr("You must provide either an email or phone number and a password");let{data:n,error:s}=t;return s?{data:{user:null,session:null},error:s}:!n||!n.session||!n.user?{data:{user:null,session:null},error:new zn}:(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),{data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(t){if(z(t))return{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(-1,async()=>this._exchangeCodeForSession(e))}async _exchangeCodeForSession(e){let t=await ai(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(t!=null?t:"").split("/");try{let{data:i,error:a}=await K(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:Ct});if(await ui(this.storage,`${this.storageKey}-code-verifier`),a)throw a;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new zn}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:s!=null?s:null}),error:a})}catch(i){if(z(i))return{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:a}=e,u=await K(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:Ct}),{data:c,error:h}=u;return h?{data:{user:null,session:null},error:h}:!c||!c.session||!c.user?{data:{user:null,session:null},error:new zn}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:h})}catch(t){if(z(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOtp(e){var t,n,s,i,a;try{if("email"in e){let{email:u,options:c}=e,h=null,f=null;this.flowType==="pkce"&&([h,f]=await Cr(this.storage,this.storageKey));let{error:m}=await K(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:h,code_challenge_method:f},redirectTo:c==null?void 0:c.emailRedirectTo});return{data:{user:null,session:null},error:m}}if("phone"in e){let{phone:u,options:c}=e,{data:h,error:f}=await K(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:(a=c==null?void 0:c.channel)!==null&&a!==void 0?a:"sms"}});return{data:{user:null,session:null,messageId:h==null?void 0:h.message_id},error:f}}throw new kr("You must provide either an email or phone number.")}catch(u){if(z(u))return{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:a,error:u}=await K(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Ct});if(u)throw u;if(!a)throw new Error("An error occurred on token verification.");let c=a.session,h=a.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),{data:{user:h,session:c},error:null}}catch(s){if(z(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithSSO(e){var t,n,s;try{let i=null,a=null;return this.flowType==="pkce"&&([i,a]=await Cr(this.storage,this.storageKey)),await K(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:i,code_challenge_method:a}),headers:this.headers,xform:M_})}catch(i){if(z(i))return{data:null,error:i};throw i}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,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 ze;let{error:s}=await K(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:s}})}catch(e){if(z(e))return{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:a}=await K(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{data:{user:null,session:null},error:a}}else if("phone"in e){let{phone:n,type:s,options:i}=e,{data:a,error:u}=await K(this.fetch,"POST",t,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:u}}throw new kr("You must provide either an email or phone number and a type")}catch(t){if(z(t))return{data:{user:null,session:null},error:t};throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,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 ai(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<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.storage.isServer){let a=this.suppressGetSessionWarning;e=new Proxy(e,{get:(c,h,f)=>(!a&&h==="user"&&(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."),a=!0,this.suppressGetSessionWarning=!0),Reflect.get(c,h,f))})}return{data:{session:e},error:null}}let{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:s},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await K(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:lt}):await this._useSession(async t=>{var n,s,i;let{data:a,error:u}=t;if(u)throw u;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ze}:await K(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=a.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:lt})})}catch(t){if(z(t))return N_(t)&&(await this._removeSession(),await ui(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:t};throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,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 ze;let a=s.session,u=null,c=null;this.flowType==="pkce"&&e.email!=null&&([u,c]=await Cr(this.storage,this.storageKey));let{data:h,error:f}=await K(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:a.access_token,xform:lt});if(f)throw f;return a.user=h.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),{data:{user:a.user},error:null}})}catch(n){if(z(n))return{data:{user:null},error:n};throw n}}_decodeJWT(e){return yh(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ze;let t=Date.now()/1e3,n=t,s=!0,i=null,a=yh(e.access_token);if(a.exp&&(n=a.exp,s=n<=t),s){let{session:u,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return{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)throw 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{data:{user:i.user,session:i},error:null}}catch(t){if(z(t))return{data:{session:null,user:null},error:t};throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var n;if(!e){let{data:a,error:u}=t;if(u)throw u;e=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new ze;let{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(t){if(z(t))return{data:{user:null,session:null},error:t};throw t}}async _getSessionFromURL(e,t){try{if(!Qe())throw new Dr("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Dr(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 li("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Dr("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 li("No code detected.");let{data:M,error:U}=await this._exchangeCodeForSession(e.code);if(U)throw U;let G=new URL(window.location.href);return G.searchParams.delete("code"),window.history.replaceState(window.history.state,"",G.toString()),{data:{session:M.session,redirectType:null},error:null}}let{provider_token:n,provider_refresh_token:s,access_token:i,refresh_token:a,expires_in:u,expires_at:c,token_type:h}=e;if(!i||!u||!a||!h)throw new Dr("No session defined in URL");let f=Math.round(Date.now()/1e3),m=parseInt(u),g=f+m;c&&(g=parseInt(c));let E=g-f;E*1e3<=fi&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${E}s, should have been closer to ${m}s`);let P=g-m;f-P>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",P,g,f):f-P<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",P,g,f);let{data:C,error:R}=await this._getUser(i);if(R)throw R;let N={provider_token:n,provider_refresh_token:s,access_token:i,expires_in:m,expires_at:g,refresh_token:a,token_type:h,user:C.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:N,redirectType:e.type},error:null}}catch(n){if(z(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await ai(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,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)return{error:i};let a=(n=s.session)===null||n===void 0?void 0:n.access_token;if(a){let{error:u}=await this.admin.signOut(a,e);if(u&&!(O_(u)&&(u.status===404||u.status===401||u.status===403)))return{error:u}}return e!=="others"&&(await this._removeSession(),await ui(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){let t=S_(),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(-1,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:a}=t;if(a)throw a;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 Cr(this.storage,this.storageKey,!0));try{return await K(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(z(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{let{data:t,error:n}=await this.getUser();if(n)throw n;return{data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(t){if(z(t))return{data:null,error:t};throw t}}async linkIdentity(e){var t;try{let{data:n,error:s}=await this._useSession(async i=>{var a,u,c,h,f;let{data:m,error:g}=i;if(g)throw g;let E=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.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 K(this.fetch,"GET",E,{headers:this.headers,jwt:(f=(h=m.session)===null||h===void 0?void 0:h.access_token)!==null&&f!==void 0?f:void 0})});if(s)throw s;return Qe()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),{data:{provider:e.provider,url:n==null?void 0:n.url},error:null}}catch(n){if(z(n))return{data:{provider:e.provider,url:null},error:n};throw n}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var n,s;let{data:i,error:a}=t;if(a)throw a;return await K(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(z(t))return{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 k_(async s=>(s>0&&await C_(200*Math.pow(2,s-1)),this._debug(t,"refreshing attempt",s),await K(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Ct})),(s,i)=>{let a=200*Math.pow(2,s);return i&&Pa(i)&&Date.now()+a-n<fi})}catch(n){if(this._debug(t,"error",n),z(n))return{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),Qe()&&!t.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e;let t="#_recoverAndRefresh()";this._debug(t,"begin");try{let n=await ai(this.storage,this.storageKey);if(this._debug(t,"session from storage",n),!this._isValidSession(n)){this._debug(t,"session is not valid"),n!==null&&await this._removeSession();return}let s=Math.round(Date.now()/1e3),i=((e=n.expires_at)!==null&&e!==void 0?e:1/0)<s+ph;if(this._debug(t,`session has${i?"":" not"} expired with margin of ${ph}s`),i){if(this.autoRefreshToken&&n.refresh_token){let{error:a}=await this._callRefreshToken(n.refresh_token);a&&(console.error(a),Pa(a)||(this._debug(t,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(t,"error",n),console.error(n);return}finally{this._debug(t,"end")}}async _callRefreshToken(e){var t,n;if(!e)throw new ze;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new oi;let{data:i,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!i.session)throw new ze;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);let u={session:i.session,error:null};return this.refreshingDeferred.resolve(u),u}catch(i){if(this._debug(s,"error",i),z(i)){let a={session:null,error:i};return Pa(i)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(a),a}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=[],a=Array.from(this.stateChangeEmitters.values()).map(async u=>{try{await u.callback(e,t)}catch(c){i.push(c)}});if(await Promise.all(a),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 gh(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),await ui(this.storage,this.storageKey),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Qe()&&(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(),fi);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno!="undefined"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}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)/fi);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${fi}ms, refresh threshold is ${$_} ticks`),s<=$_&&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 di)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Qe()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),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(-1,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,a]=await Cr(this.storage,this.storageKey),u=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});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?{data:null,error:i}:await K(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(z(t))return{data:null,error:t};throw t}}async _enroll(e){try{return await this._useSession(async t=>{var n,s;let{data:i,error:a}=t;if(a)return{data:null,error:a};let u=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:{issuer:e.issuer}),{data:c,error:h}=await K(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 h?{data:null,error:h}:(e.factorType==="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}`),{data:c,error:null})})}catch(t){if(z(t))return{data:null,error:t};throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var n;let{data:s,error:i}=t;if(i)return{data:null,error:i};let{data:a,error:u}=await K(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return u?{data:null,error:u}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:u})})}catch(t){if(z(t))return{data:null,error:t};throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var n;let{data:s,error:i}=t;return i?{data:null,error:i}:await K(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(t){if(z(t))return{data:null,error:t};throw t}})}async _challengeAndVerify(e){let{data:t,error:n}=await this._challenge({factorId:e.factorId});return n?{data:null,error:n}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){let{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};let n=(e==null?void 0:e.factors)||[],s=n.filter(a=>a.factor_type==="totp"&&a.status==="verified"),i=n.filter(a=>a.factor_type==="phone"&&a.status==="verified");return{data:{all:n,totp:s,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,n;let{data:{session:s},error:i}=e;if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let a=this._decodeJWT(s.access_token),u=null;a.aal&&(u=a.aal);let c=u;((n=(t=s.user.factors)===null||t===void 0?void 0:t.filter(m=>m.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(c="aal2");let f=a.amr||[];return{data:{currentLevel:u,nextLevel:c,currentAuthenticationMethods:f},error:null}}))}};Lr.nextInstanceID=0;var IP=Lr,bh=IP;var ka=class extends bh{constructor(e){super(e)}};var xP=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(f){try{h(n.next(f))}catch(m){a(m)}}function c(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?i(f.value):s(f.value).then(u,c)}h((n=n.apply(r,e||[])).next())})},pi=class{constructor(e,t,n){var s,i,a;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");let u=b_(e);this.realtimeUrl=`${u}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${u}/auth/v1`,this.storageUrl=`${u}/storage/v1`,this.functionsUrl=`${u}/functions/v1`;let c=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,h={db:y_,realtime:v_,auth:Object.assign(Object.assign({},__),{storageKey:c}),global:g_},f=T_(n!=null?n:{},h);this.storageKey=(s=f.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(i=f.global.headers)!==null&&i!==void 0?i:{},f.accessToken?(this.accessToken=f.accessToken,this.auth=new Proxy({},{get:(m,g)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(g)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=f.auth)!==null&&a!==void 0?a:{},this.headers,f.global.fetch),this.fetch=w_(t,this._getAccessToken.bind(this),f.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},f.realtime)),this.rest=new t_(`${u}/rest/v1`,{headers:this.headers,schema:f.db.schema,fetch:this.fetch}),f.accessToken||this._listenForAuthEvents()}get functions(){return new Ks(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new ni(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t;return xP(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();let{data:n}=yield this.auth.getSession();return(t=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:null})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:s,storageKey:i,flowType:a,lock:u,debug:c},h,f){let m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new ka({url:this.authUrl,headers:Object.assign(Object.assign({},m),h),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:s,flowType:a,lock:u,debug:c,fetch:f,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new jn(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,n)=>{this._handleTokenChanged(t,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?this.changedAccessToken=n:e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};var z_=(r,e,t)=>new pi(r,e,t);function AP(r,e){return Object.fromEntries(Object.entries(r).sort(e||void 0).map(([t,n])=>[t,n]))}function Da(r,e){return Array.isArray(r)?r.map(t=>Da(t,e)):typeof r=="object"?Object.fromEntries(Object.entries(AP(r,e)).map(([t,n])=>[t,Da(n,e)])):r}var G_={id:"~date",test:r=>r instanceof Date,serialize:r=>({_:"~date",v:r.toISOString()}),deserialize:r=>new Date(r.v)};var K_={id:"~function",test:r=>typeof r=="function",serialize:r=>({_:"~function",v:r.toString()}),deserialize:v=>eval(v.v.toString())};var H_={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 W_={id:"~nan",test:r=>Number.isNaN(r),serialize:r=>({_:"~nan"}),deserialize:r=>NaN};var Q_={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 J_={id:"~set",test:r=>r instanceof Set,serialize:r=>({_:"~set",v:Array.from(r)}),deserialize:r=>new Set(r.v)};var Y_={id:"~undefined",test:r=>r===void 0,serialize:r=>({_:"~undefined"}),deserialize:r=>{}};var Kn={settings:{stringify:!0,destringify:!0,clone:!1,depth:0,modules:[G_,K_,H_,W_,Q_,J_,Y_],circular:!0,symetric:!1},loadedModules:{},loadModules(r){return r.map(e=>{if(Z(e)){if(!e.id)throw new Error("Provided custom module does not expose an `id` property");return Kn.loadedModules[e.id]=e}else throw new Error("Unknown module type")})},serialize(r,e){let t=so(e,Kn.settings),n=Kn.loadModules(t.modules),s=t.symetric?Da(r):t.clone?Kt(r):r,i=new Map,a=(u,c)=>{let h=Z(u);if(h&&t.circular){let g=i.get(u);if(g)return Ht(s,c,{_:"~circular",p:g.join(".")});i.set(u,c)}let f=n.find(g=>g.test(u)),m=(!t.depth||c.length<t.depth)&&h;if(f){let g=f.serialize(u);if(f.recursive&&m){let E=Se(u);t.symetric&&E.sort(),Ht(s,c,g),E.forEach(P=>a(u[P],c.concat(P)))}else c.length?Ht(s,c,g):s=g}else if(m){let g=Se(u);t.symetric&&g.sort(),g.forEach(E=>a(u[E],c.concat(E)))}};return a(s,[]),t.stringify?JSON.stringify(s):s},deserialize(r,e){let t=so(e,Kn.settings),n=Kn.loadModules(t.modules),s=du(n,"id"),i=t.destringify?JSON.parse(r):t.clone?Kt(r):r,a=(u,c)=>{if(Z(u)&&u._&&typeof u._=="string"&&u._.startsWith("~")&&s[u._]){let h=s[u._].deserialize(u);c.length?s[u._].recursive&&Z(h)?(Ht(i,c,h),Se(h).forEach(f=>a(u[f],[...c,f]))):Ht(i,c,h):i=h}else t.circular&&Z(u)&&u._&&u._=="~circular"?Ht(i,c,ms(i,u.p)):(!t.depth||c.length<t.depth)&&Z(u)&&Se(u).forEach(h=>a(u[h],c.concat(h)))};return a(i,[]),i}},mi=Kn;var X_="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Z_=(r=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(r|=0));for(;r--;)e+=X_[t[r]&63];return e};var ae=class ae{constructor(e,t){ge(this,"path");ge(this,"docRef");ge(this,"value");ge(this,"throttle",250);ge(this,"config",{heartbeatInterval:5e4,syncWorkerUrl:"https://tera-tools.com/api/sync",context:{}});ge(this,"isDirty",!1);ge(this,"_destroyActions",[]);ge(this,"_heartbeatTimer");this.path=e,Object.assign(this,{...t,config:{...this.config,...t==null?void 0:t.config}}),ae.session||(ae.session=`syncro_${Z_()}`)}debug(...e){}destroy(){return this.debug("Destroy!"),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 Kt(t)},watch(n){}}}static pathSplit(e,t){var a;let n={allowAsterisk:!1,...t},i={...(a=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:a.groups};if(!i)throw new Error(`Invalid session path syntax "${e}"`);if(!(i.entity in syncEntities))throw new Error(`Unsupported entity "${e}" -> Entity="${i.entity}"`);return{...i,fsCollection:i.entity,fsId:i.relation?`${i.id}::${i.relation}`:i.id}}static toFirestore(e={}){return mi.serialize(e,{circular:!1,clone:!0,modules:[ev,...mi.settings.modules],stringify:!1})}static fromFirestore(e={}){return mi.deserialize(e,{circular:!1,clone:!0,modules:[ev,...mi.settings.modules],destringify:!1})}static fromFirestoreFields(e={}){let t={};for(let n in e){let s=e[n];if(["stringValue","booleanValue","doubleValue","integerValue","timestampValue","mapValue","arrayValue"].find(a=>a===n)){if(["stringValue","booleanValue","doubleValue","integerValue","timestampValue"].find(u=>u===n))return s;if(n=="mapValue")return ae.fromFirestoreFields(s.fields||{});if(n=="arrayValue"){let u=s.values;return u?u.map(c=>ae.fromFirestoreFields(c)):[]}}else t[n]=ae.fromFirestoreFields(s)}return t}static getSnapshot(e){let{fsCollection:t,fsId:n}=ae.pathSplit(e);return Promise.resolve().then(async()=>Hl(la(ae.firestore,t,n))).then(s=>s?ae.fromFirestore(s.data()):null)}static setSnapshot(e,t,n){let s={method:"merge",...n},{fsCollection:i,fsId:a}=ae.pathSplit(e);return Promise.resolve().then(()=>(s.method=="merge"?"FirestoreUpdateDoc":"FirestoreSetDoc")(la(ae.firestore,i,a),ae.toFirestore(t))).then(()=>t)}static wrapSupabase(e){return Promise.resolve(e).then(t=>{var n,s;if(t!=null&&t.error)throw/JSON object requested, multiple \(or no\) rows returned$/.test(t.error.message)?(console.warn("Supabase query threw record not found against query",e.url.search),console.warn("Supabase raw error",t),new Error("NOT-FOUND")):(console.warn("Supabase query threw",t.error.message),new Error(`${((n=t.error)==null?void 0:n.code)||"UnknownError"}: ${((s=t.error)==null?void 0:s.message)||"Unknown Supabase error"}`));if(t.data)return t.data})}mount(e){let t={initialState:null,...e},{fsCollection:n,fsId:s,entity:i,id:a,relation:u}=ae.pathSplit(this.path),c,h;return Promise.resolve().then(()=>this.setHeartbeat(!1)).then(async()=>{this.docRef=la(ae.firestore,n,s);let f=await this.getFirestoreState();if(c=this.getReactive(f),!c.doc||!c.setState||!c.getState||!c.watch)throw new Error("Syncro.getReactive() requires a returned `doc`, `setState()`, `getState()` + `watch()`");this.value=h=c.doc,this.debug("Initial state",{doc:h}),this._destroyActions.push(Fy(this.docRef,m=>{let g=ae.fromFirestore(m.data());this.debug("Incoming snapshot",{snapshotData:g}),c.setState(g)}))}).then(()=>{if(lu(h))return t.initialState?(this.debug("Populate initial Syncro state (from provided initialState)"),this.setFirestoreState(t.initialState,{method:"set"})):(this.debug(`Populate initial Syncro state (from "${i}" entity)`),Promise.resolve().then(()=>syncEntities[i]||Promise.reject(`Unknown Sync entity "${i}"`)).then(()=>syncEntities[i].initState({supabase:ae.supabase,fsCollection:n,fsId:s,entity:i,id:a,relation:u,...this.config.context})).then(f=>this.setFirestoreState(f,{method:"set"})))}).then(()=>{c.watch(fu(f=>{this.debug("Local change",{newState:f}),this.markDirty(),this.setFirestoreState(f,{method:"merge"})},this.throttle))}).then(()=>this.setHeartbeat(!0,{immediate:!0})).then(()=>this)}setHeartbeat(e=!0,t){let n={immediate:!0,...t};clearTimeout(this._heartbeatTimer),e&&(this._heartbeatTimer=setTimeout(async()=>{await this.heartbeat(),e&&this.setHeartbeat(!0)},this.config.heartbeatInterval),n.immediate&&this.heartbeat())}async heartbeat(){this.debug("heartbeat!"),await fetch(`${this.config.syncWorkerUrl}/${this.path}/heartbeat`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:ae.session,...this.isDirty&&{dirty:!0}})}).then(e=>e.ok?null:console.warn(this.path,`Heartbeat failed - ${e.statusText}`,{response:e})).then(()=>this.isDirty=!1)}setFirestoreState(e,t){let n={method:"merge",...t};if(!this.docRef)throw new Error("mount() must be called before setting Firestore state");return(n.method=="set"?Ly:My)(this.docRef,ae.toFirestore(e))}getFirestoreState(){if(!this.docRef)throw new Error("mount() must be called before getting Firestore state");return Hl(this.docRef).then(e=>ae.fromFirestore(e.data()))}markDirty(){return this.isDirty=!0,this}flush(e){let t={destroy:!1,...e};return fetch(`${this.config.syncWorkerUrl}/${this.path}/flush`+(t.destroy?"?destroy=1":"")).then(n=>n.ok?null:Promise.reject(n.statusText||"An error occured"))}};ge(ae,"firebase"),ge(ae,"firestore"),ge(ae,"supabase"),ge(ae,"session");var ir=ae;var ev={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}};var gi=class{init(){}constructor(e,t){}};var yi=class extends gi{constructor(){super(...arguments);ge(this,"syncros",{})}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(", "));ir.firebase=Du({apiKey:n.firebaseApiKey,authDomain:n.firebaseAuthDomain,projectId:n.firebaseProjectId,appId:n.firebaseAppId}),ir.firestore=Py(this.firebase),ir.supabase=z_(n.supabaseUrl,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 ir(i,{debug:(...a)=>this.debug(`SYNCRO://${i}`,...a),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.destroy()}};var Th=class extends yi{constructor(){super(...arguments);ge(this,"Vue");ge(this,"project",null);ge(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(([a])=>!hu(n[a],i[a])).forEach(([a,u])=>n[a]=u)},getState(){return Kt(n)},watch:i=>{this.app.$watch(s,i,{deep:!0})}}}};export{Th as default};
|
|
34
|
+
});`,oi=class{constructor(e,t){var n;this.accessTokenValue=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=sT,this.params={},this.timeout=El,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=j1,this.conn=null,this.sendBuffer=[],this.serializer=new Vs,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._resolveFetch=s=>{let a;return s?a=s:typeof fetch=="undefined"?a=(...l)=>Promise.resolve().then(()=>(mr(),jr)).then(({default:u})=>u(...l)):a=fetch,(...l)=>a(...l)},this.endPoint=`${e}/${Tl.websocket}`,this.httpEndpoint=Il(e),t!=null&&t.transport?this.transport=t.transport:this.transport=null,t!=null&&t.params&&(this.params=t.params),t!=null&&t.headers&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),t!=null&&t.timeout&&(this.timeout=t.timeout),t!=null&&t.logger&&(this.logger=t.logger),t!=null&&t.heartbeatIntervalMs&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);let i=(n=t==null?void 0:t.params)===null||n===void 0?void 0:n.apikey;if(i&&(this.accessTokenValue=i,this.apiKey=i),this.reconnectAfterMs=t!=null&&t.reconnectAfterMs?t.reconnectAfterMs:s=>[1e3,2e3,5e3,1e4][s-1]||1e4,this.encode=t!=null&&t.encode?t.encode:(s,a)=>a(JSON.stringify(s)),this.decode=t!=null&&t.decode?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new Br(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(t==null?void 0:t.fetch),t!=null&&t.worker){if(typeof window!="undefined"&&!window.Worker)throw new Error("Web Worker is not supported");this.worker=(t==null?void 0:t.worker)||!1,this.workerUrl=t==null?void 0:t.workerUrl}this.accessToken=(t==null?void 0:t.accessToken)||null}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this.endpointURL(),void 0,{headers:this.headers});return}if(U1){this.conn=new WebSocket(this.endpointURL()),this.setupConnection();return}this.conn=new Wd(this.endpointURL(),void 0,{close:()=>{this.conn=null}}),Promise.resolve().then(()=>vp(cT())).then(({default:e})=>{this.conn=new e(this.endpointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:oT}))}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,t!=null?t:""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}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.disconnect(),e}log(e,t,n){this.logger(e,t,n)}connectionState(){switch(this.conn&&this.conn.readyState){case Ur.connecting:return gr.Connecting;case Ur.open:return gr.Open;case Ur.closing:return gr.Closing;default:return gr.Closed}}isConnected(){return this.connectionState()===gr.Open}channel(e,t={config:{}}){let n=new si(`realtime:${e}`,t,this);return this.channels.push(n),n}push(e){let{topic:t,event:n,payload:i,ref:s}=e,a=()=>{this.encode(e,l=>{var u;(u=this.conn)===null||u===void 0||u.send(l)})};this.log("push",`${t} ${n} (${s})`,i),this.isConnected()?a():this.sendBuffer.push(a)}async setAuth(e=null){let t=e||this.accessToken&&await this.accessToken()||this.accessTokenValue;if(t){let n=null;try{n=JSON.parse(atob(t.split(".")[1]))}catch{}if(n&&n.exp&&!(Math.floor(Date.now()/1e3)-n.exp<0))return this.log("auth",`InvalidJWTToken: Invalid value for JWT claim "exp" with value ${n.exp}`),Promise.reject(`InvalidJWTToken: Invalid value for JWT claim "exp" with value ${n.exp}`);this.accessTokenValue=t,this.channels.forEach(i=>{t&&i.updateJoinPayload({access_token:t}),i.joinedOnce&&i._isJoined()&&i._push(We.access_token,{access_token:t})})}}async sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(e=this.conn)===null||e===void 0||e.close(aT,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth()}}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._joinRef()!==e._joinRef())}setupConnection(){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))}_onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:i,payload:s,ref:a}=t;a&&a===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null),this.log("receive",`${s.status||""} ${n} ${i} ${a&&"("+a+")"||""}`,s),this.channels.filter(l=>l._isMember(n)).forEach(l=>l._trigger(i,s,a)),this.stateChangeCallbacks.message.forEach(l=>l(t))})}async _onConnOpen(){if(this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this.reconnectTimer.reset(),!this.worker)this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs);else{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.workerRef.terminate()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}this.stateChangeCallbacks.open.forEach(e=>e())}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(t=>t(e))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(t=>t(e))}_triggerChanError(){this.channels.forEach(e=>e._trigger(We.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?",i=new URLSearchParams(t);return`${e}${n}${i}`}_workerObjectUrl(e){let t;if(e)t=e;else{let n=new Blob([B1],{type:"application/javascript"});t=URL.createObjectURL(n)}return t}},Wd=class{constructor(e,t,n){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=Ur.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=n.close}};var ai=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};function ye(r){return typeof r=="object"&&r!==null&&"__isStorageError"in r}var Al=class extends ai{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}},qr=class extends ai{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}};var $1=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function l(f){try{h(n.next(f))}catch(m){a(m)}}function u(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?s(f.value):i(f.value).then(l,u)}h((n=n.apply(r,e||[])).next())})},Sl=r=>{let e;return r?e=r:typeof fetch=="undefined"?e=(...t)=>Promise.resolve().then(()=>(mr(),jr)).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)},hT=()=>$1(void 0,void 0,void 0,function*(){return typeof Response=="undefined"?(yield Promise.resolve().then(()=>(mr(),jr))).Response:Response}),xl=r=>{if(Array.isArray(r))return r.map(t=>xl(t));if(typeof r=="function"||r!==Object(r))return r;let e={};return Object.entries(r).forEach(([t,n])=>{let i=t.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=xl(n)}),e};var zr=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function l(f){try{h(n.next(f))}catch(m){a(m)}}function u(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?s(f.value):i(f.value).then(l,u)}h((n=n.apply(r,e||[])).next())})},Qd=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),q1=(r,e,t)=>zr(void 0,void 0,void 0,function*(){let n=yield hT();r instanceof n&&!(t!=null&&t.noResolveJson)?r.json().then(i=>{e(new Al(Qd(i),r.status||500))}).catch(i=>{e(new qr(Qd(i),i))}):e(new qr(Qd(r),r))}),z1=(r,e,t,n)=>{let i={method:r,headers:(e==null?void 0:e.headers)||{}};return r==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),n&&(i.body=JSON.stringify(n)),Object.assign(Object.assign({},i),t))};function Ls(r,e,t,n,i,s){return zr(this,void 0,void 0,function*(){return new Promise((a,l)=>{r(t,z1(e,n,i,s)).then(u=>{if(!u.ok)throw u;return n!=null&&n.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>q1(u,l,n))})})}function li(r,e,t,n){return zr(this,void 0,void 0,function*(){return Ls(r,"GET",e,t,n)})}function wt(r,e,t,n,i){return zr(this,void 0,void 0,function*(){return Ls(r,"POST",e,n,i,t)})}function dT(r,e,t,n,i){return zr(this,void 0,void 0,function*(){return Ls(r,"PUT",e,n,i,t)})}function fT(r,e,t,n){return zr(this,void 0,void 0,function*(){return Ls(r,"HEAD",e,Object.assign(Object.assign({},t),{noResolveJson:!0}),n)})}function Rl(r,e,t,n,i){return zr(this,void 0,void 0,function*(){return Ls(r,"DELETE",e,n,i,t)})}var $e=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function l(f){try{h(n.next(f))}catch(m){a(m)}}function u(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?s(f.value):i(f.value).then(l,u)}h((n=n.apply(r,e||[])).next())})},G1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},pT={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Ms=class{constructor(e,t={},n,i){this.url=e,this.headers=t,this.bucketId=n,this.fetch=Sl(i)}uploadOrUpdate(e,t,n,i){return $e(this,void 0,void 0,function*(){try{let s,a=Object.assign(Object.assign({},pT),i),l=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(a.upsert)}),u=a.metadata;typeof Blob!="undefined"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",a.cacheControl),u&&s.append("metadata",this.encodeMetadata(u)),s.append("",n)):typeof FormData!="undefined"&&n instanceof FormData?(s=n,s.append("cacheControl",a.cacheControl),u&&s.append("metadata",this.encodeMetadata(u))):(s=n,l["cache-control"]=`max-age=${a.cacheControl}`,l["content-type"]=a.contentType,u&&(l["x-metadata"]=this.toBase64(this.encodeMetadata(u)))),i!=null&&i.headers&&(l=Object.assign(Object.assign({},l),i.headers));let h=this._removeEmptyFolders(t),f=this._getFinalPath(h),m=yield this.fetch(`${this.url}/object/${f}`,Object.assign({method:e,body:s,headers:l},a!=null&&a.duplex?{duplex:a.duplex}:{})),g=yield m.json();return m.ok?{data:{path:h,id:g.Id,fullPath:g.Key},error:null}:{data:null,error:g}}catch(s){if(ye(s))return{data:null,error:s};throw s}})}upload(e,t,n){return $e(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,n)})}uploadToSignedUrl(e,t,n,i){return $e(this,void 0,void 0,function*(){let s=this._removeEmptyFolders(e),a=this._getFinalPath(s),l=new URL(this.url+`/object/upload/sign/${a}`);l.searchParams.set("token",t);try{let u,h=Object.assign({upsert:pT.upsert},i),f=Object.assign(Object.assign({},this.headers),{"x-upsert":String(h.upsert)});typeof Blob!="undefined"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",h.cacheControl),u.append("",n)):typeof FormData!="undefined"&&n instanceof FormData?(u=n,u.append("cacheControl",h.cacheControl)):(u=n,f["cache-control"]=`max-age=${h.cacheControl}`,f["content-type"]=h.contentType);let m=yield this.fetch(l.toString(),{method:"PUT",body:u,headers:f}),g=yield m.json();return m.ok?{data:{path:s,fullPath:g.Key},error:null}:{data:null,error:g}}catch(u){if(ye(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,t){return $e(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=Object.assign({},this.headers);t!=null&&t.upsert&&(i["x-upsert"]="true");let s=yield wt(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:i}),a=new URL(this.url+s.url),l=a.searchParams.get("token");if(!l)throw new ai("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:l},error:null}}catch(n){if(ye(n))return{data:null,error:n};throw n}})}update(e,t,n){return $e(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,n)})}move(e,t,n){return $e(this,void 0,void 0,function*(){try{return{data:yield wt(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(ye(i))return{data:null,error:i};throw i}})}copy(e,t,n){return $e(this,void 0,void 0,function*(){try{return{data:{path:(yield wt(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(ye(i))return{data:null,error:i};throw i}})}createSignedUrl(e,t,n){return $e(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),s=yield wt(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:t},n!=null&&n.transform?{transform:n.transform}:{}),{headers:this.headers}),a=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return s={signedUrl:encodeURI(`${this.url}${s.signedURL}${a}`)},{data:s,error:null}}catch(i){if(ye(i))return{data:null,error:i};throw i}})}createSignedUrls(e,t,n){return $e(this,void 0,void 0,function*(){try{let i=yield wt(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),s=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{data:i.map(a=>Object.assign(Object.assign({},a),{signedUrl:a.signedURL?encodeURI(`${this.url}${a.signedURL}${s}`):null})),error:null}}catch(i){if(ye(i))return{data:null,error:i};throw i}})}download(e,t){return $e(this,void 0,void 0,function*(){let i=typeof(t==null?void 0:t.transform)!="undefined"?"render/image/authenticated":"object",s=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),a=s?`?${s}`:"";try{let l=this._getFinalPath(e);return{data:yield(yield li(this.fetch,`${this.url}/${i}/${l}${a}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(l){if(ye(l))return{data:null,error:l};throw l}})}info(e){return $e(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{let n=yield li(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:xl(n),error:null}}catch(n){if(ye(n))return{data:null,error:n};throw n}})}exists(e){return $e(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{return yield fT(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(ye(n)&&n instanceof qr){let i=n.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,t){let n=this._getFinalPath(e),i=[],s=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";s!==""&&i.push(s);let l=typeof(t==null?void 0:t.transform)!="undefined"?"render/image":"object",u=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});u!==""&&i.push(u);let h=i.join("&");return h!==""&&(h=`?${h}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${h}`)}}}remove(e){return $e(this,void 0,void 0,function*(){try{return{data:yield Rl(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(t){if(ye(t))return{data:null,error:t};throw t}})}list(e,t,n){return $e(this,void 0,void 0,function*(){try{let i=Object.assign(Object.assign(Object.assign({},G1),t),{prefix:e||""});return{data:yield wt(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},n),error:null}}catch(i){if(ye(i))return{data:null,error:i};throw i}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer!="undefined"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};var mT="2.7.1";var gT={"X-Client-Info":`storage-js/${mT}`};var ui=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function l(f){try{h(n.next(f))}catch(m){a(m)}}function u(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?s(f.value):i(f.value).then(l,u)}h((n=n.apply(r,e||[])).next())})},Fs=class{constructor(e,t={},n){this.url=e,this.headers=Object.assign(Object.assign({},gT),t),this.fetch=Sl(n)}listBuckets(){return ui(this,void 0,void 0,function*(){try{return{data:yield li(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(ye(e))return{data:null,error:e};throw e}})}getBucket(e){return ui(this,void 0,void 0,function*(){try{return{data:yield li(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(t){if(ye(t))return{data:null,error:t};throw t}})}createBucket(e,t={public:!1}){return ui(this,void 0,void 0,function*(){try{return{data:yield wt(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(ye(n))return{data:null,error:n};throw n}})}updateBucket(e,t){return ui(this,void 0,void 0,function*(){try{return{data:yield dT(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(ye(n))return{data:null,error:n};throw n}})}emptyBucket(e){return ui(this,void 0,void 0,function*(){try{return{data:yield wt(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(t){if(ye(t))return{data:null,error:t};throw t}})}deleteBucket(e){return ui(this,void 0,void 0,function*(){try{return{data:yield Rl(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(t){if(ye(t))return{data:null,error:t};throw t}})}};var js=class extends Fs{constructor(e,t={},n){super(e,t,n)}from(e){return new Ms(this.url,this.headers,e,this.fetch)}};var yT="2.48.1";var Us="";typeof Deno!="undefined"?Us="deno":typeof document!="undefined"?Us="web":typeof navigator!="undefined"&&navigator.product==="ReactNative"?Us="react-native":Us="node";var K1={"X-Client-Info":`supabase-js-${Us}/${yT}`},_T={headers:K1},wT={schema:"public"},vT={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},bT={};mr();var H1=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function l(f){try{h(n.next(f))}catch(m){a(m)}}function u(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?s(f.value):i(f.value).then(l,u)}h((n=n.apply(r,e||[])).next())})},W1=r=>{let e;return r?e=r:typeof fetch=="undefined"?e=Cd:e=fetch,(...t)=>e(...t)},Q1=()=>typeof Headers=="undefined"?kd:Headers,TT=(r,e,t)=>{let n=W1(t),i=Q1();return(s,a)=>H1(void 0,void 0,void 0,function*(){var l;let u=(l=yield e())!==null&&l!==void 0?l:r,h=new i(a==null?void 0:a.headers);return h.has("apikey")||h.set("apikey",r),h.has("Authorization")||h.set("Authorization",`Bearer ${u}`),n(s,Object.assign(Object.assign({},a),{headers:h}))})};var J1=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function l(f){try{h(n.next(f))}catch(m){a(m)}}function u(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?s(f.value):i(f.value).then(l,u)}h((n=n.apply(r,e||[])).next())})};function ET(r){return r.replace(/\/$/,"")}function IT(r,e){let{db:t,auth:n,realtime:i,global:s}=r,{db:a,auth:l,realtime:u,global:h}=e,f={db:Object.assign(Object.assign({},a),t),auth:Object.assign(Object.assign({},l),n),realtime:Object.assign(Object.assign({},u),i),global:Object.assign(Object.assign({},h),s),accessToken:()=>J1(this,void 0,void 0,function*(){return""})};return r.accessToken?f.accessToken=r.accessToken:delete f.accessToken,f}var Pl="2.67.3";var AT="http://localhost:9999",xT="supabase.auth.token";var ST={"X-Client-Info":`gotrue-js/${Pl}`},Jd=10;var Bs="X-Supabase-Api-Version",Yd={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};function RT(r){return Math.round(Date.now()/1e3)+r}function PT(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){let e=Math.random()*16|0;return(r=="x"?e:e&3|8).toString(16)})}var st=()=>typeof window!="undefined"&&typeof document!="undefined",Gr={tested:!1,writable:!1},yr=()=>{if(!st())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Gr.tested)return Gr.writable;let r=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(r,r),globalThis.localStorage.removeItem(r),Gr.tested=!0,Gr.writable=!0}catch{Gr.tested=!0,Gr.writable=!1}return Gr.writable};function CT(r){let e={},t=new URL(r);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((i,s)=>{e[s]=i})}catch{}return t.searchParams.forEach((n,i)=>{e[i]=n}),e}var Cl=r=>{let e;return r?e=r:typeof fetch=="undefined"?e=(...t)=>Promise.resolve().then(()=>(mr(),jr)).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)},kT=r=>typeof r=="object"&&r!==null&&"status"in r&&"ok"in r&&"json"in r&&typeof r.json=="function",Xd=async(r,e,t)=>{await r.setItem(e,JSON.stringify(t))},qs=async(r,e)=>{let t=await r.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},zs=async(r,e)=>{await r.removeItem(e)};function Y1(r){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",t="",n,i,s,a,l,u,h,f=0;for(r=r.replace("-","+").replace("_","/");f<r.length;)a=e.indexOf(r.charAt(f++)),l=e.indexOf(r.charAt(f++)),u=e.indexOf(r.charAt(f++)),h=e.indexOf(r.charAt(f++)),n=a<<2|l>>4,i=(l&15)<<4|u>>2,s=(u&3)<<6|h,t=t+String.fromCharCode(n),u!=64&&i!=0&&(t=t+String.fromCharCode(i)),h!=64&&s!=0&&(t=t+String.fromCharCode(s));return t}var $s=class r{constructor(){this.promise=new r.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}};$s.promiseConstructor=Promise;function Zd(r){let e=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,t=r.split(".");if(t.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!e.test(t[1]))throw new Error("JWT is not valid: payload is not in base64url format");let n=t[1];return JSON.parse(Y1(n))}async function DT(r){return await new Promise(e=>{setTimeout(()=>e(null),r)})}function OT(r,e){return new Promise((n,i)=>{(async()=>{for(let s=0;s<1/0;s++)try{let a=await r(s);if(!e(s,null,a)){n(a);return}}catch(a){if(!e(s,a)){i(a);return}}})()})}function X1(r){return("0"+r.toString(16)).substr(-2)}function Z1(){let e=new Uint32Array(56);if(typeof crypto=="undefined"){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=t.length,i="";for(let s=0;s<56;s++)i+=t.charAt(Math.floor(Math.random()*n));return i}return crypto.getRandomValues(e),Array.from(e,X1).join("")}async function eO(r){let t=new TextEncoder().encode(r),n=await crypto.subtle.digest("SHA-256",t),i=new Uint8Array(n);return Array.from(i).map(s=>String.fromCharCode(s)).join("")}function tO(r){return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function rO(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 eO(r);return tO(t)}async function Kr(r,e,t=!1){let n=Z1(),i=n;t&&(i+="/PASSWORD_RECOVERY"),await Xd(r,`${e}-code-verifier`,i);let s=await rO(n);return[s,n===s?"plain":"s256"]}var nO=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function NT(r){let e=r.headers.get(Bs);if(!e||!e.match(nO))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}var Gs=class extends Error{constructor(e,t,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=n}};function G(r){return typeof r=="object"&&r!==null&&"__isAuthError"in r}var kl=class extends Gs{constructor(e,t,n){super(e,t,n),this.name="AuthApiError",this.status=t,this.code=n}};function VT(r){return G(r)&&r.name==="AuthApiError"}var ci=class extends Gs{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}},jt=class extends Gs{constructor(e,t,n,i){super(e,n,i),this.name=t,this.status=n}},Ze=class extends jt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};function LT(r){return G(r)&&r.name==="AuthSessionMissingError"}var hi=class extends jt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}},Hr=class extends jt{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}},Wr=class extends jt{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 MT(r){return G(r)&&r.name==="AuthImplicitGrantRedirectError"}var Ks=class extends jt{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}}},di=class extends jt{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}};function Dl(r){return G(r)&&r.name==="AuthRetryableFetchError"}var Hs=class extends jt{constructor(e,t,n){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=n}};var iO=function(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 i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},Qr=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),sO=[502,503,504];async function FT(r){var e;if(!kT(r))throw new di(Qr(r),0);if(sO.includes(r.status))throw new di(Qr(r),r.status);let t;try{t=await r.json()}catch(s){throw new ci(Qr(s),s)}let n,i=NT(r);if(i&&i.getTime()>=Yd["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 Hs(Qr(t),r.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Ze}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((s,a)=>s&&typeof a=="string",!0))throw new Hs(Qr(t),r.status,t.weak_password.reasons);throw new kl(Qr(t),r.status||500,n)}var oO=(r,e,t,n)=>{let i={method:r,headers:(e==null?void 0:e.headers)||{}};return r==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),t))};async function H(r,e,t,n){var i;let s=Object.assign({},n==null?void 0:n.headers);s[Bs]||(s[Bs]=Yd["2024-01-01"].name),n!=null&&n.jwt&&(s.Authorization=`Bearer ${n.jwt}`);let a=(i=n==null?void 0:n.query)!==null&&i!==void 0?i:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);let l=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",u=await aO(r,e,t+l,{headers:s,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(u):{data:Object.assign({},u),error:null}}async function aO(r,e,t,n,i,s){let a=oO(e,n,i,s),l;try{l=await r(t,Object.assign({},a))}catch(u){throw console.error(u),new di(Qr(u),0)}if(l.ok||await FT(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(u){await FT(u)}}function Ut(r){var e;let t=null;lO(r)&&(t=Object.assign({},r),r.expires_at||(t.expires_at=RT(r.expires_in)));let n=(e=r.user)!==null&&e!==void 0?e:r;return{data:{session:t,user:n},error:null}}function ef(r){let e=Ut(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 vt(r){var e;return{data:{user:(e=r.user)!==null&&e!==void 0?e:r},error:null}}function jT(r){return{data:r,error:null}}function UT(r){let{action_link:e,email_otp:t,hashed_token:n,redirect_to:i,verification_type:s}=r,a=iO(r,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:t,hashed_token:n,redirect_to:i,verification_type:s},u=Object.assign({},a);return{data:{properties:l,user:u},error:null}}function BT(r){return r}function lO(r){return r.access_token&&r.refresh_token&&r.expires_in}var uO=function(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 i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},Jr=class{constructor({url:e="",headers:t={},fetch:n}){this.url=e,this.headers=t,this.fetch=Cl(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t="global"){try{return await H(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(G(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,t={}){try{return await H(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:vt})}catch(n){if(G(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{let{options:t}=e,n=uO(e,["options"]),i=Object.assign(Object.assign({},n),t);return"newEmail"in n&&(i.new_email=n==null?void 0:n.newEmail,delete i.newEmail),await H(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:UT,redirectTo:t==null?void 0:t.redirectTo})}catch(t){if(G(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await H(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:vt})}catch(t){if(G(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,n,i,s,a,l,u;try{let h={nextPage:null,lastPage:0,total:0},f=await H(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:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:BT});if(f.error)throw f.error;let m=await f.json(),g=(a=f.headers.get("x-total-count"))!==null&&a!==void 0?a:0,I=(u=(l=f.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&u!==void 0?u:[];return I.length>0&&(I.forEach(C=>{let k=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),P=JSON.parse(C.split(";")[1].split("=")[1]);h[`${P}Page`]=k}),h.total=parseInt(g)),{data:Object.assign(Object.assign({},m),h),error:null}}catch(h){if(G(h))return{data:{users:[]},error:h};throw h}}async getUserById(e){try{return await H(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:vt})}catch(t){if(G(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){try{return await H(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:vt})}catch(n){if(G(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,t=!1){try{return await H(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:vt})}catch(n){if(G(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){try{let{data:t,error:n}=await H(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:t,error:n}}catch(t){if(G(t))return{data:null,error:t};throw t}}async _deleteFactor(e){try{return{data:await H(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(G(t))return{data:null,error:t};throw t}}};var $T={getItem:r=>yr()?globalThis.localStorage.getItem(r):null,setItem:(r,e)=>{yr()&&globalThis.localStorage.setItem(r,e)},removeItem:r=>{yr()&&globalThis.localStorage.removeItem(r)}};function tf(r={}){return{getItem:e=>r[e]||null,setItem:(e,t)=>{r[e]=t},removeItem:e=>{delete r[e]}}}function qT(){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)}}var Yr={debug:!!(globalThis&&yr()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")},Ws=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}},Ol=class extends Ws{};async function rf(r,e,t){Yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",r,e);let n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),Yr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",r)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(r,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){Yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",r,i.name);try{return await t()}finally{Yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",r,i.name)}}else{if(e===0)throw Yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",r),new Ol(`Acquiring an exclusive Navigator LockManager lock "${r}" immediately failed`);if(Yr.debug)try{let s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null," "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}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()}}))}qT();var cO={url:AT,storageKey:xT,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ST,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},Qs=30*1e3,zT=3;async function GT(r,e,t){return await t()}var Xr=class r{constructor(e){var t,n;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=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,this.instanceID=r.nextInstanceID,r.nextInstanceID+=1,this.instanceID>0&&st()&&console.warn("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.");let i=Object.assign(Object.assign({},cO),e);if(this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new Jr({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=Cl(i.fetch),this.lock=i.lock||GT,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,i.lock?this.lock=i.lock:st()&&(!((t=globalThis==null?void 0:globalThis.navigator)===null||t===void 0)&&t.locks)?this.lock=rf:this.lock=GT,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)},this.persistSession?i.storage?this.storage=i.storage:yr()?this.storage=$T:(this.memoryStorage={},this.storage=tf(this.memoryStorage)):(this.memoryStorage={},this.storage=tf(this.memoryStorage)),st()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(s){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",s)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async s=>{this._debug("received broadcast notification from other tab or client",s),await this._notifyAllSubscribers(s.data.event,s.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${Pl}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let t=CT(window.location.href),n="none";if(this._isImplicitGrantCallback(t)?n="implicit":await this._isPKCECallback(t)&&(n="pkce"),st()&&this.detectSessionInUrl&&n!=="none"){let{data:i,error:s}=await this._getSessionFromURL(t,n);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),MT(s)){let u=(e=s.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:s}}return await this._removeSession(),{error:s}}let{session:a,redirectType:l}=i;return this._debug("#_initialize()","detected session in URL",a,"redirect type",l),await this._saveSession(a),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return G(t)?{error:t}:{error:new ci("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,n,i;try{let s=await H(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:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:Ut}),{data:a,error:l}=s;if(l||!a)return{data:{user:null,session:null},error:l};let u=a.session,h=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:h,session:u},error:null}}catch(s){if(G(s))return{data:{user:null,session:null},error:s};throw s}}async signUp(e){var t,n,i;try{let s;if("email"in e){let{email:f,password:m,options:g}=e,I=null,C=null;this.flowType==="pkce"&&([I,C]=await Kr(this.storage,this.storageKey)),s=await H(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:g==null?void 0:g.emailRedirectTo,body:{email:f,password:m,data:(t=g==null?void 0:g.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:g==null?void 0:g.captchaToken},code_challenge:I,code_challenge_method:C},xform:Ut})}else if("phone"in e){let{phone:f,password:m,options:g}=e;s=await H(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:f,password:m,data:(n=g==null?void 0:g.data)!==null&&n!==void 0?n:{},channel:(i=g==null?void 0:g.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:g==null?void 0:g.captchaToken}},xform:Ut})}else throw new Hr("You must provide either an email or phone number and a password");let{data:a,error:l}=s;if(l||!a)return{data:{user:null,session:null},error:l};let u=a.session,h=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:h,session:u},error:null}}catch(s){if(G(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithPassword(e){try{let t;if("email"in e){let{email:s,password:a,options:l}=e;t=await H(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:ef})}else if("phone"in e){let{phone:s,password:a,options:l}=e;t=await H(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:ef})}else throw new Hr("You must provide either an email or phone number and a password");let{data:n,error:i}=t;return i?{data:{user:null,session:null},error:i}:!n||!n.session||!n.user?{data:{user:null,session:null},error:new hi}:(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),{data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(t){if(G(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOAuth(e){var t,n,i,s;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:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async _exchangeCodeForSession(e){let t=await qs(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(t!=null?t:"").split("/");try{let{data:s,error:a}=await H(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:Ut});if(await zs(this.storage,`${this.storageKey}-code-verifier`),a)throw a;return!s||!s.session||!s.user?{data:{user:null,session:null,redirectType:null},error:new hi}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign(Object.assign({},s),{redirectType:i!=null?i:null}),error:a})}catch(s){if(G(s))return{data:{user:null,session:null,redirectType:null},error:s};throw s}}async signInWithIdToken(e){try{let{options:t,provider:n,token:i,access_token:s,nonce:a}=e,l=await H(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:s,nonce:a,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:Ut}),{data:u,error:h}=l;return h?{data:{user:null,session:null},error:h}:!u||!u.session||!u.user?{data:{user:null,session:null},error:new hi}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:h})}catch(t){if(G(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOtp(e){var t,n,i,s,a;try{if("email"in e){let{email:l,options:u}=e,h=null,f=null;this.flowType==="pkce"&&([h,f]=await Kr(this.storage,this.storageKey));let{error:m}=await H(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(t=u==null?void 0:u.data)!==null&&t!==void 0?t:{},create_user:(n=u==null?void 0:u.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:h,code_challenge_method:f},redirectTo:u==null?void 0:u.emailRedirectTo});return{data:{user:null,session:null},error:m}}if("phone"in e){let{phone:l,options:u}=e,{data:h,error:f}=await H(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(i=u==null?void 0:u.data)!==null&&i!==void 0?i:{},create_user:(s=u==null?void 0:u.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},channel:(a=u==null?void 0:u.channel)!==null&&a!==void 0?a:"sms"}});return{data:{user:null,session:null,messageId:h==null?void 0:h.message_id},error:f}}throw new Hr("You must provide either an email or phone number.")}catch(l){if(G(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(e){var t,n;try{let i,s;"options"in e&&(i=(t=e.options)===null||t===void 0?void 0:t.redirectTo,s=(n=e.options)===null||n===void 0?void 0:n.captchaToken);let{data:a,error:l}=await H(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:Ut});if(l)throw l;if(!a)throw new Error("An error occurred on token verification.");let u=a.session,h=a.user;return u!=null&&u.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),{data:{user:h,session:u},error:null}}catch(i){if(G(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithSSO(e){var t,n,i;try{let s=null,a=null;return this.flowType==="pkce"&&([s,a]=await Kr(this.storage,this.storageKey)),await H(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}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:a}),headers:this.headers,xform:jT})}catch(s){if(G(s))return{data:null,error:s};throw s}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,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 Ze;let{error:i}=await H(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:i}})}catch(e){if(G(e))return{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:i,options:s}=e,{error:a}=await H(this.fetch,"POST",t,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},redirectTo:s==null?void 0:s.emailRedirectTo});return{data:{user:null,session:null},error:a}}else if("phone"in e){let{phone:n,type:i,options:s}=e,{data:a,error:l}=await H(this.fetch,"POST",t,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}}});return{data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:l}}throw new Hr("You must provide either an email or phone number and a type")}catch(t){if(G(t))return{data:{user:null,session:null},error:t};throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,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(),i=(async()=>(await n,await t()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}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 i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.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 qs(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<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.storage.isServer){let a=this.suppressGetSessionWarning;e=new Proxy(e,{get:(u,h,f)=>(!a&&h==="user"&&(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."),a=!0,this.suppressGetSessionWarning=!0),Reflect.get(u,h,f))})}return{data:{session:e},error:null}}let{session:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?{data:{session:null},error:s}:{data:{session:i},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await H(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:vt}):await this._useSession(async t=>{var n,i,s;let{data:a,error:l}=t;if(l)throw l;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Ze}:await H(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=a.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:vt})})}catch(t){if(G(t))return LT(t)&&(await this._removeSession(),await zs(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:t};throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async n=>{let{data:i,error:s}=n;if(s)throw s;if(!i.session)throw new Ze;let a=i.session,l=null,u=null;this.flowType==="pkce"&&e.email!=null&&([l,u]=await Kr(this.storage,this.storageKey));let{data:h,error:f}=await H(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t==null?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:u}),jwt:a.access_token,xform:vt});if(f)throw f;return a.user=h.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),{data:{user:a.user},error:null}})}catch(n){if(G(n))return{data:{user:null},error:n};throw n}}_decodeJWT(e){return Zd(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Ze;let t=Date.now()/1e3,n=t,i=!0,s=null,a=Zd(e.access_token);if(a.exp&&(n=a.exp,i=n<=t),i){let{session:l,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return{data:{user:null,session:null},error:u};if(!l)return{data:{user:null,session:null},error:null};s=l}else{let{data:l,error:u}=await this._getUser(e.access_token);if(u)throw u;s={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:n-t,expires_at:n},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return{data:{user:s.user,session:s},error:null}}catch(t){if(G(t))return{data:{session:null,user:null},error:t};throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var n;if(!e){let{data:a,error:l}=t;if(l)throw l;e=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new Ze;let{session:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?{data:{user:null,session:null},error:s}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(t){if(G(t))return{data:{user:null,session:null},error:t};throw t}}async _getSessionFromURL(e,t){try{if(!st())throw new Wr("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Wr(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 Ks("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Wr("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 Ks("No code detected.");let{data:F,error:B}=await this._exchangeCodeForSession(e.code);if(B)throw B;let K=new URL(window.location.href);return K.searchParams.delete("code"),window.history.replaceState(window.history.state,"",K.toString()),{data:{session:F.session,redirectType:null},error:null}}let{provider_token:n,provider_refresh_token:i,access_token:s,refresh_token:a,expires_in:l,expires_at:u,token_type:h}=e;if(!s||!l||!a||!h)throw new Wr("No session defined in URL");let f=Math.round(Date.now()/1e3),m=parseInt(l),g=f+m;u&&(g=parseInt(u));let I=g-f;I*1e3<=Qs&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${I}s, should have been closer to ${m}s`);let C=g-m;f-C>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",C,g,f):f-C<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",C,g,f);let{data:k,error:P}=await this._getUser(s);if(P)throw P;let V={provider_token:n,provider_refresh_token:i,access_token:s,expires_in:m,expires_at:g,refresh_token:a,token_type:h,user:k.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:V,redirectType:e.type},error:null}}catch(n){if(G(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await qs(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var n;let{data:i,error:s}=t;if(s)return{error:s};let a=(n=i.session)===null||n===void 0?void 0:n.access_token;if(a){let{error:l}=await this.admin.signOut(a,e);if(l&&!(VT(l)&&(l.status===404||l.status===401||l.status===403)))return{error:l}}return e!=="others"&&(await this._removeSession(),await zs(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){let t=PT(),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(-1,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async t=>{var n,i;try{let{data:{session:s},error:a}=t;if(a)throw a;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,t={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await Kr(this.storage,this.storageKey,!0));try{return await H(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(s){if(G(s))return{data:null,error:s};throw s}}async getUserIdentities(){var e;try{let{data:t,error:n}=await this.getUser();if(n)throw n;return{data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(t){if(G(t))return{data:null,error:t};throw t}}async linkIdentity(e){var t;try{let{data:n,error:i}=await this._useSession(async s=>{var a,l,u,h,f;let{data:m,error:g}=s;if(g)throw g;let I=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await H(this.fetch,"GET",I,{headers:this.headers,jwt:(f=(h=m.session)===null||h===void 0?void 0:h.access_token)!==null&&f!==void 0?f:void 0})});if(i)throw i;return st()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),{data:{provider:e.provider,url:n==null?void 0:n.url},error:null}}catch(n){if(G(n))return{data:{provider:e.provider,url:null},error:n};throw n}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var n,i;let{data:s,error:a}=t;if(a)throw a;return await H(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(t){if(G(t))return{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 OT(async i=>(i>0&&await DT(200*Math.pow(2,i-1)),this._debug(t,"refreshing attempt",i),await H(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Ut})),(i,s)=>{let a=200*Math.pow(2,i);return s&&Dl(s)&&Date.now()+a-n<Qs})}catch(n){if(this._debug(t,"error",n),G(n))return{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),st()&&!t.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e;let t="#_recoverAndRefresh()";this._debug(t,"begin");try{let n=await qs(this.storage,this.storageKey);if(this._debug(t,"session from storage",n),!this._isValidSession(n)){this._debug(t,"session is not valid"),n!==null&&await this._removeSession();return}let i=Math.round(Date.now()/1e3),s=((e=n.expires_at)!==null&&e!==void 0?e:1/0)<i+Jd;if(this._debug(t,`session has${s?"":" not"} expired with margin of ${Jd}s`),s){if(this.autoRefreshToken&&n.refresh_token){let{error:a}=await this._callRefreshToken(n.refresh_token);a&&(console.error(a),Dl(a)||(this._debug(t,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(t,"error",n),console.error(n);return}finally{this._debug(t,"end")}}async _callRefreshToken(e){var t,n;if(!e)throw new Ze;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new $s;let{data:s,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!s.session)throw new Ze;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);let l={session:s.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(s){if(this._debug(i,"error",s),G(s)){let a={session:null,error:s};return Dl(s)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(a),a}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,t,n=!0){let i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",t,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:t});let s=[],a=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,t)}catch(u){s.push(u)}});if(await Promise.all(a),s.length>0){for(let l=0;l<s.length;l+=1)console.error(s[l]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Xd(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),await zs(this.storage,this.storageKey),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&st()&&(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(),Qs);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno!="undefined"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}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 i=Math.floor((n.expires_at*1e3-e)/Qs);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Qs}ms, refresh threshold is ${zT} ticks`),i<=zT&&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 Ws)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!st()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),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(-1,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 i=[`provider=${encodeURIComponent(t)}`];if(n!=null&&n.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){let[s,a]=await Kr(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(a)}`});i.push(l.toString())}if(n!=null&&n.queryParams){let s=new URLSearchParams(n.queryParams);i.push(s.toString())}return n!=null&&n.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var n;let{data:i,error:s}=t;return s?{data:null,error:s}:await H(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token})})}catch(t){if(G(t))return{data:null,error:t};throw t}}async _enroll(e){try{return await this._useSession(async t=>{var n,i;let{data:s,error:a}=t;if(a)return{data:null,error:a};let l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:{issuer:e.issuer}),{data:u,error:h}=await H(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return h?{data:null,error:h}:(e.factorType==="totp"&&(!((i=u==null?void 0:u.totp)===null||i===void 0)&&i.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),{data:u,error:null})})}catch(t){if(G(t))return{data:null,error:t};throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var n;let{data:i,error:s}=t;if(s)return{data:null,error:s};let{data:a,error:l}=await H(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:l})})}catch(t){if(G(t))return{data:null,error:t};throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var n;let{data:i,error:s}=t;return s?{data:null,error:s}:await H(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token})})}catch(t){if(G(t))return{data:null,error:t};throw t}})}async _challengeAndVerify(e){let{data:t,error:n}=await this._challenge({factorId:e.factorId});return n?{data:null,error:n}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){let{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};let n=(e==null?void 0:e.factors)||[],i=n.filter(a=>a.factor_type==="totp"&&a.status==="verified"),s=n.filter(a=>a.factor_type==="phone"&&a.status==="verified");return{data:{all:n,totp:i,phone:s},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,n;let{data:{session:i},error:s}=e;if(s)return{data:null,error:s};if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let a=this._decodeJWT(i.access_token),l=null;a.aal&&(l=a.aal);let u=l;((n=(t=i.user.factors)===null||t===void 0?void 0:t.filter(m=>m.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(u="aal2");let f=a.amr||[];return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:f},error:null}}))}};Xr.nextInstanceID=0;var hO=Xr,nf=hO;var Nl=class extends nf{constructor(e){super(e)}};var dO=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function l(f){try{h(n.next(f))}catch(m){a(m)}}function u(f){try{h(n.throw(f))}catch(m){a(m)}}function h(f){f.done?s(f.value):i(f.value).then(l,u)}h((n=n.apply(r,e||[])).next())})},Js=class{constructor(e,t,n){var i,s,a;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");let l=ET(e);this.realtimeUrl=`${l}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${l}/auth/v1`,this.storageUrl=`${l}/storage/v1`,this.functionsUrl=`${l}/functions/v1`;let u=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,h={db:wT,realtime:bT,auth:Object.assign(Object.assign({},vT),{storageKey:u}),global:_T},f=IT(n!=null?n:{},h);this.storageKey=(i=f.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(s=f.global.headers)!==null&&s!==void 0?s:{},f.accessToken?(this.accessToken=f.accessToken,this.auth=new Proxy({},{get:(m,g)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(g)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=f.auth)!==null&&a!==void 0?a:{},this.headers,f.global.fetch),this.fetch=TT(t,this._getAccessToken.bind(this),f.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},f.realtime)),this.rest=new nT(`${l}/rest/v1`,{headers:this.headers,schema:f.db.schema,fetch:this.fetch}),f.accessToken||this._listenForAuthEvents()}get functions(){return new Rs(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new js(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t;return dO(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();let{data:n}=yield this.auth.getSession();return(t=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:null})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:i,storageKey:s,flowType:a,lock:l,debug:u},h,f){let m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Nl({url:this.authUrl,headers:Object.assign(Object.assign({},m),h),storageKey:s,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:i,flowType:a,lock:l,debug:u,fetch:f,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new oi(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,n)=>{this._handleTokenChanged(t,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?this.changedAccessToken=n:e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};var KT=(r,e,t)=>new Js(r,e,t);gf();var to=class{init(){}constructor(e,t){}};var ro=class extends to{constructor(){super(...arguments);ae(this,"syncros",{})}async init(t){let n={firebaseApiKey:null,firebaseAuthDomain:null,firebaseProjectId:null,firebaseAppId:null,supabaseUrl:null,supabaseKey:null,...await this.getCredentials(),...t},i=Object.keys(n).filter(s=>s===null);if(i.length>0)throw new Error("Firebase plugin requires mandatory options: "+i.join(", "));_e.firebase=fc({apiKey:n.firebaseApiKey,authDomain:n.firebaseAuthDomain,projectId:n.firebaseProjectId,appId:n.firebaseAppId}),_e.firestore=Cb(this.firebase),_e.supabase=KT(n.supabaseUrl,n.supabaseKey)}_mountNamespace(t){let n;return Promise.resolve().then(()=>this.requireProject()).then(i=>{let s=t=="_PROJECT"?`projects::${i.id}`:`project_namespaces::${i.id}::${t}`;return n=this.syncros[t]=new _e(s,{debug:(...a)=>this.debug(`SYNCRO://${s}`,...a),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.destroy()}};var yf=class extends ro{constructor(){super(...arguments);ae(this,"Vue");ae(this,"project",null);ae(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),i=`_teraFy_${this.reactiveId++}`;return this.app[i]=n,{doc:n,setState(s){Object.entries(s||{}).filter(([a])=>!qu(n[a],s[a])).forEach(([a,l])=>n[a]=l)},getState(){return sr(n)},watch:s=>{this.app.$watch(i,s,{deep:!0})}}}};export{yf as default};
|
|
28
35
|
/*! Bundled license information:
|
|
29
36
|
|
|
30
37
|
lodash-es/lodash.js:
|
|
@@ -55,44 +62,6 @@ lodash-es/lodash.js:
|
|
|
55
62
|
* See the License for the specific language governing permissions and
|
|
56
63
|
* limitations under the License.
|
|
57
64
|
*)
|
|
58
|
-
|
|
59
|
-
@firebase/util/dist/index.esm2017.js:
|
|
60
|
-
(**
|
|
61
|
-
* @license
|
|
62
|
-
* Copyright 2017 Google LLC
|
|
63
|
-
*
|
|
64
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
65
|
-
* you may not use this file except in compliance with the License.
|
|
66
|
-
* You may obtain a copy of the License at
|
|
67
|
-
*
|
|
68
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
69
|
-
*
|
|
70
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
71
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
72
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
73
|
-
* See the License for the specific language governing permissions and
|
|
74
|
-
* limitations under the License.
|
|
75
|
-
*)
|
|
76
|
-
|
|
77
|
-
@firebase/util/dist/index.esm2017.js:
|
|
78
|
-
(**
|
|
79
|
-
* @license
|
|
80
|
-
* Copyright 2017 Google LLC
|
|
81
|
-
*
|
|
82
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
83
|
-
* you may not use this file except in compliance with the License.
|
|
84
|
-
* You may obtain a copy of the License at
|
|
85
|
-
*
|
|
86
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
87
|
-
*
|
|
88
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
89
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
90
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
91
|
-
* See the License for the specific language governing permissions and
|
|
92
|
-
* limitations under the License.
|
|
93
|
-
*)
|
|
94
|
-
|
|
95
|
-
@firebase/util/dist/index.esm2017.js:
|
|
96
65
|
(**
|
|
97
66
|
* @license
|
|
98
67
|
* Copyright 2022 Google LLC
|
|
@@ -109,11 +78,9 @@ lodash-es/lodash.js:
|
|
|
109
78
|
* See the License for the specific language governing permissions and
|
|
110
79
|
* limitations under the License.
|
|
111
80
|
*)
|
|
112
|
-
|
|
113
|
-
@firebase/util/dist/index.esm2017.js:
|
|
114
81
|
(**
|
|
115
82
|
* @license
|
|
116
|
-
* Copyright
|
|
83
|
+
* Copyright 2021 Google LLC
|
|
117
84
|
*
|
|
118
85
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
119
86
|
* you may not use this file except in compliance with the License.
|
|
@@ -129,7 +96,7 @@ lodash-es/lodash.js:
|
|
|
129
96
|
*)
|
|
130
97
|
(**
|
|
131
98
|
* @license
|
|
132
|
-
* Copyright
|
|
99
|
+
* Copyright 2019 Google LLC
|
|
133
100
|
*
|
|
134
101
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
135
102
|
* you may not use this file except in compliance with the License.
|
|
@@ -143,11 +110,9 @@ lodash-es/lodash.js:
|
|
|
143
110
|
* See the License for the specific language governing permissions and
|
|
144
111
|
* limitations under the License.
|
|
145
112
|
*)
|
|
146
|
-
|
|
147
|
-
@firebase/util/dist/index.esm2017.js:
|
|
148
113
|
(**
|
|
149
114
|
* @license
|
|
150
|
-
* Copyright
|
|
115
|
+
* Copyright 2020 Google LLC
|
|
151
116
|
*
|
|
152
117
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
153
118
|
* you may not use this file except in compliance with the License.
|
|
@@ -162,10 +127,10 @@ lodash-es/lodash.js:
|
|
|
162
127
|
* limitations under the License.
|
|
163
128
|
*)
|
|
164
129
|
|
|
165
|
-
@firebase/
|
|
130
|
+
@firebase/component/dist/esm/index.esm2017.js:
|
|
166
131
|
(**
|
|
167
132
|
* @license
|
|
168
|
-
* Copyright
|
|
133
|
+
* Copyright 2019 Google LLC
|
|
169
134
|
*
|
|
170
135
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
171
136
|
* you may not use this file except in compliance with the License.
|
|
@@ -180,7 +145,7 @@ lodash-es/lodash.js:
|
|
|
180
145
|
* limitations under the License.
|
|
181
146
|
*)
|
|
182
147
|
|
|
183
|
-
@firebase/
|
|
148
|
+
@firebase/logger/dist/esm/index.esm2017.js:
|
|
184
149
|
(**
|
|
185
150
|
* @license
|
|
186
151
|
* Copyright 2017 Google LLC
|
|
@@ -198,10 +163,10 @@ lodash-es/lodash.js:
|
|
|
198
163
|
* limitations under the License.
|
|
199
164
|
*)
|
|
200
165
|
|
|
201
|
-
@firebase/
|
|
166
|
+
@firebase/app/dist/esm/index.esm2017.js:
|
|
202
167
|
(**
|
|
203
168
|
* @license
|
|
204
|
-
* Copyright
|
|
169
|
+
* Copyright 2019 Google LLC
|
|
205
170
|
*
|
|
206
171
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
207
172
|
* you may not use this file except in compliance with the License.
|
|
@@ -215,11 +180,9 @@ lodash-es/lodash.js:
|
|
|
215
180
|
* See the License for the specific language governing permissions and
|
|
216
181
|
* limitations under the License.
|
|
217
182
|
*)
|
|
218
|
-
|
|
219
|
-
@firebase/util/dist/index.esm2017.js:
|
|
220
183
|
(**
|
|
221
184
|
* @license
|
|
222
|
-
* Copyright
|
|
185
|
+
* Copyright 2023 Google LLC
|
|
223
186
|
*
|
|
224
187
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
225
188
|
* you may not use this file except in compliance with the License.
|
|
@@ -233,11 +196,9 @@ lodash-es/lodash.js:
|
|
|
233
196
|
* See the License for the specific language governing permissions and
|
|
234
197
|
* limitations under the License.
|
|
235
198
|
*)
|
|
236
|
-
|
|
237
|
-
@firebase/util/dist/index.esm2017.js:
|
|
238
199
|
(**
|
|
239
200
|
* @license
|
|
240
|
-
* Copyright
|
|
201
|
+
* Copyright 2021 Google LLC
|
|
241
202
|
*
|
|
242
203
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
243
204
|
* you may not use this file except in compliance with the License.
|
|
@@ -252,46 +213,48 @@ lodash-es/lodash.js:
|
|
|
252
213
|
* limitations under the License.
|
|
253
214
|
*)
|
|
254
215
|
|
|
255
|
-
@firebase/
|
|
256
|
-
(**
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
*
|
|
266
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
267
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
268
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
269
|
-
* See the License for the specific language governing permissions and
|
|
270
|
-
* limitations under the License.
|
|
271
|
-
*)
|
|
216
|
+
@firebase/webchannel-wrapper/dist/bloom-blob/esm/bloom_blob_es2018.js:
|
|
217
|
+
(** @license
|
|
218
|
+
Copyright The Closure Library Authors.
|
|
219
|
+
SPDX-License-Identifier: Apache-2.0
|
|
220
|
+
*)
|
|
221
|
+
(** @license
|
|
222
|
+
|
|
223
|
+
Copyright The Closure Library Authors.
|
|
224
|
+
SPDX-License-Identifier: Apache-2.0
|
|
225
|
+
*)
|
|
272
226
|
|
|
273
|
-
@firebase/
|
|
274
|
-
(**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
*
|
|
284
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
285
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
286
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
287
|
-
* See the License for the specific language governing permissions and
|
|
288
|
-
* limitations under the License.
|
|
289
|
-
*)
|
|
227
|
+
@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:
|
|
228
|
+
(** @license
|
|
229
|
+
Copyright The Closure Library Authors.
|
|
230
|
+
SPDX-License-Identifier: Apache-2.0
|
|
231
|
+
*)
|
|
232
|
+
(** @license
|
|
233
|
+
|
|
234
|
+
Copyright The Closure Library Authors.
|
|
235
|
+
SPDX-License-Identifier: Apache-2.0
|
|
236
|
+
*)
|
|
290
237
|
|
|
291
|
-
@firebase/
|
|
238
|
+
@firebase/firestore/dist/index.esm2017.js:
|
|
239
|
+
(**
|
|
240
|
+
* @license
|
|
241
|
+
* Copyright 2020 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
|
+
*)
|
|
292
255
|
(**
|
|
293
256
|
* @license
|
|
294
|
-
* Copyright
|
|
257
|
+
* Copyright 2017 Google LLC
|
|
295
258
|
*
|
|
296
259
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
297
260
|
* you may not use this file except in compliance with the License.
|
|
@@ -305,8 +268,6 @@ lodash-es/lodash.js:
|
|
|
305
268
|
* See the License for the specific language governing permissions and
|
|
306
269
|
* limitations under the License.
|
|
307
270
|
*)
|
|
308
|
-
|
|
309
|
-
@firebase/util/dist/index.esm2017.js:
|
|
310
271
|
(**
|
|
311
272
|
* @license
|
|
312
273
|
* Copyright 2020 Google LLC
|
|
@@ -323,8 +284,6 @@ lodash-es/lodash.js:
|
|
|
323
284
|
* See the License for the specific language governing permissions and
|
|
324
285
|
* limitations under the License.
|
|
325
286
|
*)
|
|
326
|
-
|
|
327
|
-
@firebase/util/dist/index.esm2017.js:
|
|
328
287
|
(**
|
|
329
288
|
* @license
|
|
330
289
|
* Copyright 2021 Google LLC
|
|
@@ -341,47 +300,9 @@ lodash-es/lodash.js:
|
|
|
341
300
|
* See the License for the specific language governing permissions and
|
|
342
301
|
* limitations under the License.
|
|
343
302
|
*)
|
|
344
|
-
|
|
345
|
-
@firebase/component/dist/esm/index.esm2017.js:
|
|
346
|
-
(**
|
|
347
|
-
* @license
|
|
348
|
-
* Copyright 2019 Google LLC
|
|
349
|
-
*
|
|
350
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
351
|
-
* you may not use this file except in compliance with the License.
|
|
352
|
-
* You may obtain a copy of the License at
|
|
353
|
-
*
|
|
354
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
355
|
-
*
|
|
356
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
357
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
358
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
359
|
-
* See the License for the specific language governing permissions and
|
|
360
|
-
* limitations under the License.
|
|
361
|
-
*)
|
|
362
|
-
|
|
363
|
-
@firebase/logger/dist/esm/index.esm2017.js:
|
|
364
|
-
(**
|
|
365
|
-
* @license
|
|
366
|
-
* Copyright 2017 Google LLC
|
|
367
|
-
*
|
|
368
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
369
|
-
* you may not use this file except in compliance with the License.
|
|
370
|
-
* You may obtain a copy of the License at
|
|
371
|
-
*
|
|
372
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
373
|
-
*
|
|
374
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
375
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
376
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
377
|
-
* See the License for the specific language governing permissions and
|
|
378
|
-
* limitations under the License.
|
|
379
|
-
*)
|
|
380
|
-
|
|
381
|
-
@firebase/app/dist/esm/index.esm2017.js:
|
|
382
303
|
(**
|
|
383
304
|
* @license
|
|
384
|
-
* Copyright
|
|
305
|
+
* Copyright 2018 Google LLC
|
|
385
306
|
*
|
|
386
307
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
387
308
|
* you may not use this file except in compliance with the License.
|
|
@@ -395,11 +316,9 @@ lodash-es/lodash.js:
|
|
|
395
316
|
* See the License for the specific language governing permissions and
|
|
396
317
|
* limitations under the License.
|
|
397
318
|
*)
|
|
398
|
-
|
|
399
|
-
@firebase/app/dist/esm/index.esm2017.js:
|
|
400
319
|
(**
|
|
401
320
|
* @license
|
|
402
|
-
* Copyright
|
|
321
|
+
* Copyright 2022 Google LLC
|
|
403
322
|
*
|
|
404
323
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
405
324
|
* you may not use this file except in compliance with the License.
|
|
@@ -429,8 +348,6 @@ lodash-es/lodash.js:
|
|
|
429
348
|
* See the License for the specific language governing permissions and
|
|
430
349
|
* limitations under the License.
|
|
431
350
|
*)
|
|
432
|
-
|
|
433
|
-
@firebase/app/dist/esm/index.esm2017.js:
|
|
434
351
|
(**
|
|
435
352
|
* @license
|
|
436
353
|
* Copyright 2019 Google LLC
|
|
@@ -447,11 +364,9 @@ lodash-es/lodash.js:
|
|
|
447
364
|
* See the License for the specific language governing permissions and
|
|
448
365
|
* limitations under the License.
|
|
449
366
|
*)
|
|
450
|
-
|
|
451
|
-
@firebase/app/dist/esm/index.esm2017.js:
|
|
452
367
|
(**
|
|
453
368
|
* @license
|
|
454
|
-
* Copyright
|
|
369
|
+
* Copyright 2024 Google LLC
|
|
455
370
|
*
|
|
456
371
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
457
372
|
* you may not use this file except in compliance with the License.
|
|
@@ -467,7 +382,7 @@ lodash-es/lodash.js:
|
|
|
467
382
|
*)
|
|
468
383
|
(**
|
|
469
384
|
* @license
|
|
470
|
-
* Copyright
|
|
385
|
+
* Copyright 2021 Google LLC
|
|
471
386
|
*
|
|
472
387
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
473
388
|
* you may not use this file except in compliance with the License.
|
|
@@ -475,9 +390,9 @@ lodash-es/lodash.js:
|
|
|
475
390
|
*
|
|
476
391
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
477
392
|
*
|
|
478
|
-
* Unless required by applicable law
|
|
393
|
+
* Unless required by applicable law | agreed to in writing, software
|
|
479
394
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
480
|
-
* WITHOUT WARRANTIES
|
|
395
|
+
* WITHOUT WARRANTIES | CONDITIONS OF ANY KIND, either express | implied.
|
|
481
396
|
* See the License for the specific language governing permissions and
|
|
482
397
|
* limitations under the License.
|
|
483
398
|
*)
|
|
@@ -499,1780 +414,4 @@ firebase/app/dist/esm/index.esm.js:
|
|
|
499
414
|
* See the License for the specific language governing permissions and
|
|
500
415
|
* limitations under the License.
|
|
501
416
|
*)
|
|
502
|
-
|
|
503
|
-
@firebase/webchannel-wrapper/dist/bloom-blob/esm/bloom_blob_es2018.js:
|
|
504
|
-
(** @license
|
|
505
|
-
Copyright The Closure Library Authors.
|
|
506
|
-
SPDX-License-Identifier: Apache-2.0
|
|
507
|
-
*)
|
|
508
|
-
(** @license
|
|
509
|
-
|
|
510
|
-
Copyright The Closure Library Authors.
|
|
511
|
-
SPDX-License-Identifier: Apache-2.0
|
|
512
|
-
*)
|
|
513
|
-
|
|
514
|
-
@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js:
|
|
515
|
-
(** @license
|
|
516
|
-
Copyright The Closure Library Authors.
|
|
517
|
-
SPDX-License-Identifier: Apache-2.0
|
|
518
|
-
*)
|
|
519
|
-
(** @license
|
|
520
|
-
|
|
521
|
-
Copyright The Closure Library Authors.
|
|
522
|
-
SPDX-License-Identifier: Apache-2.0
|
|
523
|
-
*)
|
|
524
|
-
|
|
525
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
526
|
-
(**
|
|
527
|
-
* @license
|
|
528
|
-
* Copyright 2017 Google LLC
|
|
529
|
-
*
|
|
530
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
531
|
-
* you may not use this file except in compliance with the License.
|
|
532
|
-
* You may obtain a copy of the License at
|
|
533
|
-
*
|
|
534
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
535
|
-
*
|
|
536
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
537
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
538
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
539
|
-
* See the License for the specific language governing permissions and
|
|
540
|
-
* limitations under the License.
|
|
541
|
-
*)
|
|
542
|
-
|
|
543
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
544
|
-
(**
|
|
545
|
-
* @license
|
|
546
|
-
* Copyright 2020 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 2017 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/index.esm2017.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
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
596
|
-
(**
|
|
597
|
-
* @license
|
|
598
|
-
* Copyright 2020 Google LLC
|
|
599
|
-
*
|
|
600
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
601
|
-
* you may not use this file except in compliance with the License.
|
|
602
|
-
* You may obtain a copy of the License at
|
|
603
|
-
*
|
|
604
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
605
|
-
*
|
|
606
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
607
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
608
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
609
|
-
* See the License for the specific language governing permissions and
|
|
610
|
-
* limitations under the License.
|
|
611
|
-
*)
|
|
612
|
-
(**
|
|
613
|
-
* @license
|
|
614
|
-
* Copyright 2017 Google LLC
|
|
615
|
-
*
|
|
616
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
617
|
-
* you may not use this file except in compliance with the License.
|
|
618
|
-
* You may obtain a copy of the License at
|
|
619
|
-
*
|
|
620
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
621
|
-
*
|
|
622
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
623
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
624
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
625
|
-
* See the License for the specific language governing permissions and
|
|
626
|
-
* limitations under the License.
|
|
627
|
-
*)
|
|
628
|
-
|
|
629
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
630
|
-
(**
|
|
631
|
-
* @license
|
|
632
|
-
* Copyright 2017 Google LLC
|
|
633
|
-
*
|
|
634
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
635
|
-
* you may not use this file except in compliance with the License.
|
|
636
|
-
* You may obtain a copy of the License at
|
|
637
|
-
*
|
|
638
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
639
|
-
*
|
|
640
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
641
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
642
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
643
|
-
* See the License for the specific language governing permissions and
|
|
644
|
-
* limitations under the License.
|
|
645
|
-
*)
|
|
646
|
-
(**
|
|
647
|
-
* @license
|
|
648
|
-
* Copyright 2021 Google LLC
|
|
649
|
-
*
|
|
650
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
651
|
-
* you may not use this file except in compliance with the License.
|
|
652
|
-
* You may obtain a copy of the License at
|
|
653
|
-
*
|
|
654
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
655
|
-
*
|
|
656
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
657
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
658
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
659
|
-
* See the License for the specific language governing permissions and
|
|
660
|
-
* limitations under the License.
|
|
661
|
-
*)
|
|
662
|
-
|
|
663
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
664
|
-
(**
|
|
665
|
-
* @license
|
|
666
|
-
* Copyright 2020 Google LLC
|
|
667
|
-
*
|
|
668
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
669
|
-
* you may not use this file except in compliance with the License.
|
|
670
|
-
* You may obtain a copy of the License at
|
|
671
|
-
*
|
|
672
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
673
|
-
*
|
|
674
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
675
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
676
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
677
|
-
* See the License for the specific language governing permissions and
|
|
678
|
-
* limitations under the License.
|
|
679
|
-
*)
|
|
680
|
-
(**
|
|
681
|
-
* @license
|
|
682
|
-
* Copyright 2017 Google LLC
|
|
683
|
-
*
|
|
684
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
685
|
-
* you may not use this file except in compliance with the License.
|
|
686
|
-
* You may obtain a copy of the License at
|
|
687
|
-
*
|
|
688
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
689
|
-
*
|
|
690
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
691
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
692
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
693
|
-
* See the License for the specific language governing permissions and
|
|
694
|
-
* limitations under the License.
|
|
695
|
-
*)
|
|
696
|
-
|
|
697
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
698
|
-
(**
|
|
699
|
-
* @license
|
|
700
|
-
* Copyright 2018 Google LLC
|
|
701
|
-
*
|
|
702
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
703
|
-
* you may not use this file except in compliance with the License.
|
|
704
|
-
* You may obtain a copy of the License at
|
|
705
|
-
*
|
|
706
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
707
|
-
*
|
|
708
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
709
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
710
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
711
|
-
* See the License for the specific language governing permissions and
|
|
712
|
-
* limitations under the License.
|
|
713
|
-
*)
|
|
714
|
-
(**
|
|
715
|
-
* @license
|
|
716
|
-
* Copyright 2017 Google LLC
|
|
717
|
-
*
|
|
718
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
719
|
-
* you may not use this file except in compliance with the License.
|
|
720
|
-
* You may obtain a copy of the License at
|
|
721
|
-
*
|
|
722
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
723
|
-
*
|
|
724
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
725
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
726
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
727
|
-
* See the License for the specific language governing permissions and
|
|
728
|
-
* limitations under the License.
|
|
729
|
-
*)
|
|
730
|
-
|
|
731
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
732
|
-
(**
|
|
733
|
-
* @license
|
|
734
|
-
* Copyright 2022 Google LLC
|
|
735
|
-
*
|
|
736
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
737
|
-
* you may not use this file except in compliance with the License.
|
|
738
|
-
* You may obtain a copy of the License at
|
|
739
|
-
*
|
|
740
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
741
|
-
*
|
|
742
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
743
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
744
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
745
|
-
* See the License for the specific language governing permissions and
|
|
746
|
-
* limitations under the License.
|
|
747
|
-
*)
|
|
748
|
-
|
|
749
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
750
|
-
(**
|
|
751
|
-
* @license
|
|
752
|
-
* Copyright 2022 Google LLC
|
|
753
|
-
*
|
|
754
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
755
|
-
* you may not use this file except in compliance with the License.
|
|
756
|
-
* You may obtain a copy of the License at
|
|
757
|
-
*
|
|
758
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
759
|
-
*
|
|
760
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
761
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
762
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
763
|
-
* See the License for the specific language governing permissions and
|
|
764
|
-
* limitations under the License.
|
|
765
|
-
*)
|
|
766
|
-
|
|
767
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
768
|
-
(**
|
|
769
|
-
* @license
|
|
770
|
-
* Copyright 2020 Google LLC
|
|
771
|
-
*
|
|
772
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
773
|
-
* you may not use this file except in compliance with the License.
|
|
774
|
-
* You may obtain a copy of the License at
|
|
775
|
-
*
|
|
776
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
777
|
-
*
|
|
778
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
779
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
780
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
781
|
-
* See the License for the specific language governing permissions and
|
|
782
|
-
* limitations under the License.
|
|
783
|
-
*)
|
|
784
|
-
|
|
785
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
786
|
-
(**
|
|
787
|
-
* @license
|
|
788
|
-
* Copyright 2017 Google LLC
|
|
789
|
-
*
|
|
790
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
791
|
-
* you may not use this file except in compliance with the License.
|
|
792
|
-
* You may obtain a copy of the License at
|
|
793
|
-
*
|
|
794
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
795
|
-
*
|
|
796
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
797
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
798
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
799
|
-
* See the License for the specific language governing permissions and
|
|
800
|
-
* limitations under the License.
|
|
801
|
-
*)
|
|
802
|
-
|
|
803
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
804
|
-
(**
|
|
805
|
-
* @license
|
|
806
|
-
* Copyright 2017 Google LLC
|
|
807
|
-
*
|
|
808
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
809
|
-
* you may not use this file except in compliance with the License.
|
|
810
|
-
* You may obtain a copy of the License at
|
|
811
|
-
*
|
|
812
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
813
|
-
*
|
|
814
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
815
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
816
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
817
|
-
* See the License for the specific language governing permissions and
|
|
818
|
-
* limitations under the License.
|
|
819
|
-
*)
|
|
820
|
-
|
|
821
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
822
|
-
(**
|
|
823
|
-
* @license
|
|
824
|
-
* Copyright 2020 Google LLC
|
|
825
|
-
*
|
|
826
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
827
|
-
* you may not use this file except in compliance with the License.
|
|
828
|
-
* You may obtain a copy of the License at
|
|
829
|
-
*
|
|
830
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
831
|
-
*
|
|
832
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
833
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
834
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
835
|
-
* See the License for the specific language governing permissions and
|
|
836
|
-
* limitations under the License.
|
|
837
|
-
*)
|
|
838
|
-
(**
|
|
839
|
-
* @license
|
|
840
|
-
* Copyright 2023 Google LLC
|
|
841
|
-
*
|
|
842
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
843
|
-
* you may not use this file except in compliance with the License.
|
|
844
|
-
* You may obtain a copy of the License at
|
|
845
|
-
*
|
|
846
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
847
|
-
*
|
|
848
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
849
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
850
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
851
|
-
* See the License for the specific language governing permissions and
|
|
852
|
-
* limitations under the License.
|
|
853
|
-
*)
|
|
854
|
-
|
|
855
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
856
|
-
(**
|
|
857
|
-
* @license
|
|
858
|
-
* Copyright 2020 Google LLC
|
|
859
|
-
*
|
|
860
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
861
|
-
* you may not use this file except in compliance with the License.
|
|
862
|
-
* You may obtain a copy of the License at
|
|
863
|
-
*
|
|
864
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
865
|
-
*
|
|
866
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
867
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
868
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
869
|
-
* See the License for the specific language governing permissions and
|
|
870
|
-
* limitations under the License.
|
|
871
|
-
*)
|
|
872
|
-
(**
|
|
873
|
-
* @license
|
|
874
|
-
* Copyright 2017 Google LLC
|
|
875
|
-
*
|
|
876
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
877
|
-
* you may not use this file except in compliance with the License.
|
|
878
|
-
* You may obtain a copy of the License at
|
|
879
|
-
*
|
|
880
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
881
|
-
*
|
|
882
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
883
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
884
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
885
|
-
* See the License for the specific language governing permissions and
|
|
886
|
-
* limitations under the License.
|
|
887
|
-
*)
|
|
888
|
-
|
|
889
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
890
|
-
(**
|
|
891
|
-
* @license
|
|
892
|
-
* Copyright 2017 Google LLC
|
|
893
|
-
*
|
|
894
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
895
|
-
* you may not use this file except in compliance with the License.
|
|
896
|
-
* You may obtain a copy of the License at
|
|
897
|
-
*
|
|
898
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
899
|
-
*
|
|
900
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
901
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
902
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
903
|
-
* See the License for the specific language governing permissions and
|
|
904
|
-
* limitations under the License.
|
|
905
|
-
*)
|
|
906
|
-
(**
|
|
907
|
-
* @license
|
|
908
|
-
* Copyright 2022 Google LLC
|
|
909
|
-
*
|
|
910
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
911
|
-
* you may not use this file except in compliance with the License.
|
|
912
|
-
* You may obtain a copy of the License at
|
|
913
|
-
*
|
|
914
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
915
|
-
*
|
|
916
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
917
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
918
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
919
|
-
* See the License for the specific language governing permissions and
|
|
920
|
-
* limitations under the License.
|
|
921
|
-
*)
|
|
922
|
-
|
|
923
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
924
|
-
(**
|
|
925
|
-
* @license
|
|
926
|
-
* Copyright 2019 Google LLC
|
|
927
|
-
*
|
|
928
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
929
|
-
* you may not use this file except in compliance with the License.
|
|
930
|
-
* You may obtain a copy of the License at
|
|
931
|
-
*
|
|
932
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
933
|
-
*
|
|
934
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
935
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
936
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
937
|
-
* See the License for the specific language governing permissions and
|
|
938
|
-
* limitations under the License.
|
|
939
|
-
*)
|
|
940
|
-
|
|
941
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
942
|
-
(**
|
|
943
|
-
* @license
|
|
944
|
-
* Copyright 2017 Google LLC
|
|
945
|
-
*
|
|
946
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
947
|
-
* you may not use this file except in compliance with the License.
|
|
948
|
-
* You may obtain a copy of the License at
|
|
949
|
-
*
|
|
950
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
951
|
-
*
|
|
952
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
953
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
954
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
955
|
-
* See the License for the specific language governing permissions and
|
|
956
|
-
* limitations under the License.
|
|
957
|
-
*)
|
|
958
|
-
|
|
959
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
960
|
-
(**
|
|
961
|
-
* @license
|
|
962
|
-
* Copyright 2017 Google LLC
|
|
963
|
-
*
|
|
964
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
965
|
-
* you may not use this file except in compliance with the License.
|
|
966
|
-
* You may obtain a copy of the License at
|
|
967
|
-
*
|
|
968
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
969
|
-
*
|
|
970
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
971
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
972
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
973
|
-
* See the License for the specific language governing permissions and
|
|
974
|
-
* limitations under the License.
|
|
975
|
-
*)
|
|
976
|
-
(**
|
|
977
|
-
* @license
|
|
978
|
-
* Copyright 2020 Google LLC
|
|
979
|
-
*
|
|
980
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
981
|
-
* you may not use this file except in compliance with the License.
|
|
982
|
-
* You may obtain a copy of the License at
|
|
983
|
-
*
|
|
984
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
985
|
-
*
|
|
986
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
987
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
988
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
989
|
-
* See the License for the specific language governing permissions and
|
|
990
|
-
* limitations under the License.
|
|
991
|
-
*)
|
|
992
|
-
(**
|
|
993
|
-
* @license
|
|
994
|
-
* Copyright 2018 Google LLC
|
|
995
|
-
*
|
|
996
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
997
|
-
* you may not use this file except in compliance with the License.
|
|
998
|
-
* You may obtain a copy of the License at
|
|
999
|
-
*
|
|
1000
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1001
|
-
*
|
|
1002
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1003
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1004
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1005
|
-
* See the License for the specific language governing permissions and
|
|
1006
|
-
* limitations under the License.
|
|
1007
|
-
*)
|
|
1008
|
-
|
|
1009
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1010
|
-
(**
|
|
1011
|
-
* @license
|
|
1012
|
-
* Copyright 2017 Google LLC
|
|
1013
|
-
*
|
|
1014
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1015
|
-
* you may not use this file except in compliance with the License.
|
|
1016
|
-
* You may obtain a copy of the License at
|
|
1017
|
-
*
|
|
1018
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1019
|
-
*
|
|
1020
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1021
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1022
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1023
|
-
* See the License for the specific language governing permissions and
|
|
1024
|
-
* limitations under the License.
|
|
1025
|
-
*)
|
|
1026
|
-
(**
|
|
1027
|
-
* @license
|
|
1028
|
-
* Copyright 2022 Google LLC
|
|
1029
|
-
*
|
|
1030
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1031
|
-
* you may not use this file except in compliance with the License.
|
|
1032
|
-
* You may obtain a copy of the License at
|
|
1033
|
-
*
|
|
1034
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1035
|
-
*
|
|
1036
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1037
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1038
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1039
|
-
* See the License for the specific language governing permissions and
|
|
1040
|
-
* limitations under the License.
|
|
1041
|
-
*)
|
|
1042
|
-
(**
|
|
1043
|
-
* @license
|
|
1044
|
-
* Copyright 2023 Google LLC
|
|
1045
|
-
*
|
|
1046
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1047
|
-
* you may not use this file except in compliance with the License.
|
|
1048
|
-
* You may obtain a copy of the License at
|
|
1049
|
-
*
|
|
1050
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1051
|
-
*
|
|
1052
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1053
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1054
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1055
|
-
* See the License for the specific language governing permissions and
|
|
1056
|
-
* limitations under the License.
|
|
1057
|
-
*)
|
|
1058
|
-
|
|
1059
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1060
|
-
(**
|
|
1061
|
-
* @license
|
|
1062
|
-
* Copyright 2017 Google LLC
|
|
1063
|
-
*
|
|
1064
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1065
|
-
* you may not use this file except in compliance with the License.
|
|
1066
|
-
* You may obtain a copy of the License at
|
|
1067
|
-
*
|
|
1068
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1069
|
-
*
|
|
1070
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1071
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1072
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1073
|
-
* See the License for the specific language governing permissions and
|
|
1074
|
-
* limitations under the License.
|
|
1075
|
-
*)
|
|
1076
|
-
(**
|
|
1077
|
-
* @license
|
|
1078
|
-
* Copyright 2023 Google LLC
|
|
1079
|
-
*
|
|
1080
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1081
|
-
* you may not use this file except in compliance with the License.
|
|
1082
|
-
* You may obtain a copy of the License at
|
|
1083
|
-
*
|
|
1084
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1085
|
-
*
|
|
1086
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1087
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1088
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1089
|
-
* See the License for the specific language governing permissions and
|
|
1090
|
-
* limitations under the License.
|
|
1091
|
-
*)
|
|
1092
|
-
(**
|
|
1093
|
-
* @license
|
|
1094
|
-
* Copyright 2022 Google LLC
|
|
1095
|
-
*
|
|
1096
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1097
|
-
* you may not use this file except in compliance with the License.
|
|
1098
|
-
* You may obtain a copy of the License at
|
|
1099
|
-
*
|
|
1100
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1101
|
-
*
|
|
1102
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1103
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1104
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1105
|
-
* See the License for the specific language governing permissions and
|
|
1106
|
-
* limitations under the License.
|
|
1107
|
-
*)
|
|
1108
|
-
|
|
1109
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1110
|
-
(**
|
|
1111
|
-
* @license
|
|
1112
|
-
* Copyright 2017 Google LLC
|
|
1113
|
-
*
|
|
1114
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1115
|
-
* you may not use this file except in compliance with the License.
|
|
1116
|
-
* You may obtain a copy of the License at
|
|
1117
|
-
*
|
|
1118
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1119
|
-
*
|
|
1120
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1121
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1122
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1123
|
-
* See the License for the specific language governing permissions and
|
|
1124
|
-
* limitations under the License.
|
|
1125
|
-
*)
|
|
1126
|
-
|
|
1127
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1128
|
-
(**
|
|
1129
|
-
* @license
|
|
1130
|
-
* Copyright 2020 Google LLC
|
|
1131
|
-
*
|
|
1132
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1133
|
-
* you may not use this file except in compliance with the License.
|
|
1134
|
-
* You may obtain a copy of the License at
|
|
1135
|
-
*
|
|
1136
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1137
|
-
*
|
|
1138
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1139
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1140
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1141
|
-
* See the License for the specific language governing permissions and
|
|
1142
|
-
* limitations under the License.
|
|
1143
|
-
*)
|
|
1144
|
-
|
|
1145
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1146
|
-
(**
|
|
1147
|
-
* @license
|
|
1148
|
-
* Copyright 2022 Google LLC
|
|
1149
|
-
*
|
|
1150
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1151
|
-
* you may not use this file except in compliance with the License.
|
|
1152
|
-
* You may obtain a copy of the License at
|
|
1153
|
-
*
|
|
1154
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1155
|
-
*
|
|
1156
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1157
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1158
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1159
|
-
* See the License for the specific language governing permissions and
|
|
1160
|
-
* limitations under the License.
|
|
1161
|
-
*)
|
|
1162
|
-
|
|
1163
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1164
|
-
(**
|
|
1165
|
-
* @license
|
|
1166
|
-
* Copyright 2024 Google LLC
|
|
1167
|
-
*
|
|
1168
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1169
|
-
* you may not use this file except in compliance with the License.
|
|
1170
|
-
* You may obtain a copy of the License at
|
|
1171
|
-
*
|
|
1172
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1173
|
-
*
|
|
1174
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1175
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1176
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1177
|
-
* See the License for the specific language governing permissions and
|
|
1178
|
-
* limitations under the License.
|
|
1179
|
-
*)
|
|
1180
|
-
|
|
1181
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1182
|
-
(**
|
|
1183
|
-
* @license
|
|
1184
|
-
* Copyright 2021 Google LLC
|
|
1185
|
-
*
|
|
1186
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1187
|
-
* you may not use this file except in compliance with the License.
|
|
1188
|
-
* You may obtain a copy of the License at
|
|
1189
|
-
*
|
|
1190
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1191
|
-
*
|
|
1192
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1193
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1194
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1195
|
-
* See the License for the specific language governing permissions and
|
|
1196
|
-
* limitations under the License.
|
|
1197
|
-
*)
|
|
1198
|
-
(**
|
|
1199
|
-
* @license
|
|
1200
|
-
* Copyright 2021 Google LLC
|
|
1201
|
-
*
|
|
1202
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1203
|
-
* you may not use this file except in compliance with the License.
|
|
1204
|
-
* You may obtain a copy of the License at
|
|
1205
|
-
*
|
|
1206
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1207
|
-
*
|
|
1208
|
-
* Unless required by applicable law | agreed to in writing, software
|
|
1209
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1210
|
-
* WITHOUT WARRANTIES | CONDITIONS OF ANY KIND, either express | implied.
|
|
1211
|
-
* See the License for the specific language governing permissions and
|
|
1212
|
-
* limitations under the License.
|
|
1213
|
-
*)
|
|
1214
|
-
|
|
1215
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1216
|
-
(**
|
|
1217
|
-
* @license
|
|
1218
|
-
* Copyright 2022 Google LLC
|
|
1219
|
-
*
|
|
1220
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1221
|
-
* you may not use this file except in compliance with the License.
|
|
1222
|
-
* You may obtain a copy of the License at
|
|
1223
|
-
*
|
|
1224
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1225
|
-
*
|
|
1226
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1227
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1228
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1229
|
-
* See the License for the specific language governing permissions and
|
|
1230
|
-
* limitations under the License.
|
|
1231
|
-
*)
|
|
1232
|
-
|
|
1233
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1234
|
-
(**
|
|
1235
|
-
* @license
|
|
1236
|
-
* Copyright 2022 Google LLC
|
|
1237
|
-
*
|
|
1238
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1239
|
-
* you may not use this file except in compliance with the License.
|
|
1240
|
-
* You may obtain a copy of the License at
|
|
1241
|
-
*
|
|
1242
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1243
|
-
*
|
|
1244
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1245
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1246
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1247
|
-
* See the License for the specific language governing permissions and
|
|
1248
|
-
* limitations under the License.
|
|
1249
|
-
*)
|
|
1250
|
-
|
|
1251
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1252
|
-
(**
|
|
1253
|
-
* @license
|
|
1254
|
-
* Copyright 2022 Google LLC
|
|
1255
|
-
*
|
|
1256
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1257
|
-
* you may not use this file except in compliance with the License.
|
|
1258
|
-
* You may obtain a copy of the License at
|
|
1259
|
-
*
|
|
1260
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1261
|
-
*
|
|
1262
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1263
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1264
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1265
|
-
* See the License for the specific language governing permissions and
|
|
1266
|
-
* limitations under the License.
|
|
1267
|
-
*)
|
|
1268
|
-
|
|
1269
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1270
|
-
(**
|
|
1271
|
-
* @license
|
|
1272
|
-
* Copyright 2019 Google LLC
|
|
1273
|
-
*
|
|
1274
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1275
|
-
* you may not use this file except in compliance with the License.
|
|
1276
|
-
* You may obtain a copy of the License at
|
|
1277
|
-
*
|
|
1278
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1279
|
-
*
|
|
1280
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1281
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1282
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1283
|
-
* See the License for the specific language governing permissions and
|
|
1284
|
-
* limitations under the License.
|
|
1285
|
-
*)
|
|
1286
|
-
|
|
1287
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1288
|
-
(**
|
|
1289
|
-
* @license
|
|
1290
|
-
* Copyright 2018 Google LLC
|
|
1291
|
-
*
|
|
1292
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1293
|
-
* you may not use this file except in compliance with the License.
|
|
1294
|
-
* You may obtain a copy of the License at
|
|
1295
|
-
*
|
|
1296
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1297
|
-
*
|
|
1298
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1299
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1300
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1301
|
-
* See the License for the specific language governing permissions and
|
|
1302
|
-
* limitations under the License.
|
|
1303
|
-
*)
|
|
1304
|
-
(**
|
|
1305
|
-
* @license
|
|
1306
|
-
* Copyright 2020 Google LLC
|
|
1307
|
-
*
|
|
1308
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1309
|
-
* you may not use this file except in compliance with the License.
|
|
1310
|
-
* You may obtain a copy of the License at
|
|
1311
|
-
*
|
|
1312
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1313
|
-
*
|
|
1314
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1315
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1316
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1317
|
-
* See the License for the specific language governing permissions and
|
|
1318
|
-
* limitations under the License.
|
|
1319
|
-
*)
|
|
1320
|
-
|
|
1321
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1322
|
-
(**
|
|
1323
|
-
* @license
|
|
1324
|
-
* Copyright 2017 Google LLC
|
|
1325
|
-
*
|
|
1326
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1327
|
-
* you may not use this file except in compliance with the License.
|
|
1328
|
-
* You may obtain a copy of the License at
|
|
1329
|
-
*
|
|
1330
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1331
|
-
*
|
|
1332
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1333
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1334
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1335
|
-
* See the License for the specific language governing permissions and
|
|
1336
|
-
* limitations under the License.
|
|
1337
|
-
*)
|
|
1338
|
-
|
|
1339
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1340
|
-
(**
|
|
1341
|
-
* @license
|
|
1342
|
-
* Copyright 2017 Google LLC
|
|
1343
|
-
*
|
|
1344
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1345
|
-
* you may not use this file except in compliance with the License.
|
|
1346
|
-
* You may obtain a copy of the License at
|
|
1347
|
-
*
|
|
1348
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1349
|
-
*
|
|
1350
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1351
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1352
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1353
|
-
* See the License for the specific language governing permissions and
|
|
1354
|
-
* limitations under the License.
|
|
1355
|
-
*)
|
|
1356
|
-
|
|
1357
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1358
|
-
(**
|
|
1359
|
-
* @license
|
|
1360
|
-
* Copyright 2020 Google LLC
|
|
1361
|
-
*
|
|
1362
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1363
|
-
* you may not use this file except in compliance with the License.
|
|
1364
|
-
* You may obtain a copy of the License at
|
|
1365
|
-
*
|
|
1366
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1367
|
-
*
|
|
1368
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1369
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1370
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1371
|
-
* See the License for the specific language governing permissions and
|
|
1372
|
-
* limitations under the License.
|
|
1373
|
-
*)
|
|
1374
|
-
|
|
1375
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1376
|
-
(**
|
|
1377
|
-
* @license
|
|
1378
|
-
* Copyright 2017 Google LLC
|
|
1379
|
-
*
|
|
1380
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1381
|
-
* you may not use this file except in compliance with the License.
|
|
1382
|
-
* You may obtain a copy of the License at
|
|
1383
|
-
*
|
|
1384
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1385
|
-
*
|
|
1386
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1387
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1388
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1389
|
-
* See the License for the specific language governing permissions and
|
|
1390
|
-
* limitations under the License.
|
|
1391
|
-
*)
|
|
1392
|
-
|
|
1393
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1394
|
-
(**
|
|
1395
|
-
* @license
|
|
1396
|
-
* Copyright 2017 Google LLC
|
|
1397
|
-
*
|
|
1398
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1399
|
-
* you may not use this file except in compliance with the License.
|
|
1400
|
-
* You may obtain a copy of the License at
|
|
1401
|
-
*
|
|
1402
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1403
|
-
*
|
|
1404
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1405
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1406
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1407
|
-
* See the License for the specific language governing permissions and
|
|
1408
|
-
* limitations under the License.
|
|
1409
|
-
*)
|
|
1410
|
-
(**
|
|
1411
|
-
* @license
|
|
1412
|
-
* Copyright 2022 Google LLC
|
|
1413
|
-
*
|
|
1414
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1415
|
-
* you may not use this file except in compliance with the License.
|
|
1416
|
-
* You may obtain a copy of the License at
|
|
1417
|
-
*
|
|
1418
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1419
|
-
*
|
|
1420
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1421
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1422
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1423
|
-
* See the License for the specific language governing permissions and
|
|
1424
|
-
* limitations under the License.
|
|
1425
|
-
*)
|
|
1426
|
-
(**
|
|
1427
|
-
* @license
|
|
1428
|
-
* Copyright 2020 Google LLC
|
|
1429
|
-
*
|
|
1430
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1431
|
-
* you may not use this file except in compliance with the License.
|
|
1432
|
-
* You may obtain a copy of the License at
|
|
1433
|
-
*
|
|
1434
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1435
|
-
*
|
|
1436
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1437
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1438
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1439
|
-
* See the License for the specific language governing permissions and
|
|
1440
|
-
* limitations under the License.
|
|
1441
|
-
*)
|
|
1442
|
-
(**
|
|
1443
|
-
* @license
|
|
1444
|
-
* Copyright 2024 Google LLC
|
|
1445
|
-
*
|
|
1446
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1447
|
-
* you may not use this file except in compliance with the License.
|
|
1448
|
-
* You may obtain a copy of the License at
|
|
1449
|
-
*
|
|
1450
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1451
|
-
*
|
|
1452
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1453
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1454
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1455
|
-
* See the License for the specific language governing permissions and
|
|
1456
|
-
* limitations under the License.
|
|
1457
|
-
*)
|
|
1458
|
-
|
|
1459
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1460
|
-
(**
|
|
1461
|
-
* @license
|
|
1462
|
-
* Copyright 2017 Google LLC
|
|
1463
|
-
*
|
|
1464
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1465
|
-
* you may not use this file except in compliance with the License.
|
|
1466
|
-
* You may obtain a copy of the License at
|
|
1467
|
-
*
|
|
1468
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1469
|
-
*
|
|
1470
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1471
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1472
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1473
|
-
* See the License for the specific language governing permissions and
|
|
1474
|
-
* limitations under the License.
|
|
1475
|
-
*)
|
|
1476
|
-
(**
|
|
1477
|
-
* @license
|
|
1478
|
-
* Copyright 2023 Google LLC
|
|
1479
|
-
*
|
|
1480
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1481
|
-
* you may not use this file except in compliance with the License.
|
|
1482
|
-
* You may obtain a copy of the License at
|
|
1483
|
-
*
|
|
1484
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1485
|
-
*
|
|
1486
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1487
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1488
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1489
|
-
* See the License for the specific language governing permissions and
|
|
1490
|
-
* limitations under the License.
|
|
1491
|
-
*)
|
|
1492
|
-
(**
|
|
1493
|
-
* @license
|
|
1494
|
-
* Copyright 2019 Google LLC
|
|
1495
|
-
*
|
|
1496
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1497
|
-
* you may not use this file except in compliance with the License.
|
|
1498
|
-
* You may obtain a copy of the License at
|
|
1499
|
-
*
|
|
1500
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1501
|
-
*
|
|
1502
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1503
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1504
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1505
|
-
* See the License for the specific language governing permissions and
|
|
1506
|
-
* limitations under the License.
|
|
1507
|
-
*)
|
|
1508
|
-
(**
|
|
1509
|
-
* @license
|
|
1510
|
-
* Copyright 2020 Google LLC
|
|
1511
|
-
*
|
|
1512
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1513
|
-
* you may not use this file except in compliance with the License.
|
|
1514
|
-
* You may obtain a copy of the License at
|
|
1515
|
-
*
|
|
1516
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1517
|
-
*
|
|
1518
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1519
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1520
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1521
|
-
* See the License for the specific language governing permissions and
|
|
1522
|
-
* limitations under the License.
|
|
1523
|
-
*)
|
|
1524
|
-
|
|
1525
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1526
|
-
(**
|
|
1527
|
-
* @license
|
|
1528
|
-
* Copyright 2019 Google LLC
|
|
1529
|
-
*
|
|
1530
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1531
|
-
* you may not use this file except in compliance with the License.
|
|
1532
|
-
* You may obtain a copy of the License at
|
|
1533
|
-
*
|
|
1534
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1535
|
-
*
|
|
1536
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1537
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1538
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1539
|
-
* See the License for the specific language governing permissions and
|
|
1540
|
-
* limitations under the License.
|
|
1541
|
-
*)
|
|
1542
|
-
|
|
1543
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1544
|
-
(**
|
|
1545
|
-
* @license
|
|
1546
|
-
* Copyright 2018 Google LLC
|
|
1547
|
-
*
|
|
1548
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1549
|
-
* you may not use this file except in compliance with the License.
|
|
1550
|
-
* You may obtain a copy of the License at
|
|
1551
|
-
*
|
|
1552
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1553
|
-
*
|
|
1554
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1555
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1556
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1557
|
-
* See the License for the specific language governing permissions and
|
|
1558
|
-
* limitations under the License.
|
|
1559
|
-
*)
|
|
1560
|
-
|
|
1561
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1562
|
-
(**
|
|
1563
|
-
* @license
|
|
1564
|
-
* Copyright 2019 Google LLC
|
|
1565
|
-
*
|
|
1566
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1567
|
-
* you may not use this file except in compliance with the License.
|
|
1568
|
-
* You may obtain a copy of the License at
|
|
1569
|
-
*
|
|
1570
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1571
|
-
*
|
|
1572
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1573
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1574
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1575
|
-
* See the License for the specific language governing permissions and
|
|
1576
|
-
* limitations under the License.
|
|
1577
|
-
*)
|
|
1578
|
-
(**
|
|
1579
|
-
* @license
|
|
1580
|
-
* Copyright 2023 Google LLC
|
|
1581
|
-
*
|
|
1582
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1583
|
-
* you may not use this file except in compliance with the License.
|
|
1584
|
-
* You may obtain a copy of the License at
|
|
1585
|
-
*
|
|
1586
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1587
|
-
*
|
|
1588
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1589
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1590
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1591
|
-
* See the License for the specific language governing permissions and
|
|
1592
|
-
* limitations under the License.
|
|
1593
|
-
*)
|
|
1594
|
-
(**
|
|
1595
|
-
* @license
|
|
1596
|
-
* Copyright 2020 Google LLC
|
|
1597
|
-
*
|
|
1598
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1599
|
-
* you may not use this file except in compliance with the License.
|
|
1600
|
-
* You may obtain a copy of the License at
|
|
1601
|
-
*
|
|
1602
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1603
|
-
*
|
|
1604
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1605
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1606
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1607
|
-
* See the License for the specific language governing permissions and
|
|
1608
|
-
* limitations under the License.
|
|
1609
|
-
*)
|
|
1610
|
-
(**
|
|
1611
|
-
* @license
|
|
1612
|
-
* Copyright 2017 Google LLC
|
|
1613
|
-
*
|
|
1614
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1615
|
-
* you may not use this file except in compliance with the License.
|
|
1616
|
-
* You may obtain a copy of the License at
|
|
1617
|
-
*
|
|
1618
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1619
|
-
*
|
|
1620
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1621
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1622
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1623
|
-
* See the License for the specific language governing permissions and
|
|
1624
|
-
* limitations under the License.
|
|
1625
|
-
*)
|
|
1626
|
-
|
|
1627
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1628
|
-
(**
|
|
1629
|
-
* @license
|
|
1630
|
-
* Copyright 2020 Google LLC
|
|
1631
|
-
*
|
|
1632
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1633
|
-
* you may not use this file except in compliance with the License.
|
|
1634
|
-
* You may obtain a copy of the License at
|
|
1635
|
-
*
|
|
1636
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1637
|
-
*
|
|
1638
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1639
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1640
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1641
|
-
* See the License for the specific language governing permissions and
|
|
1642
|
-
* limitations under the License.
|
|
1643
|
-
*)
|
|
1644
|
-
(**
|
|
1645
|
-
* @license
|
|
1646
|
-
* Copyright 2017 Google LLC
|
|
1647
|
-
*
|
|
1648
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1649
|
-
* you may not use this file except in compliance with the License.
|
|
1650
|
-
* You may obtain a copy of the License at
|
|
1651
|
-
*
|
|
1652
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1653
|
-
*
|
|
1654
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1655
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1656
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1657
|
-
* See the License for the specific language governing permissions and
|
|
1658
|
-
* limitations under the License.
|
|
1659
|
-
*)
|
|
1660
|
-
|
|
1661
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1662
|
-
(**
|
|
1663
|
-
* @license
|
|
1664
|
-
* Copyright 2020 Google LLC
|
|
1665
|
-
*
|
|
1666
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1667
|
-
* you may not use this file except in compliance with the License.
|
|
1668
|
-
* You may obtain a copy of the License at
|
|
1669
|
-
*
|
|
1670
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1671
|
-
*
|
|
1672
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1673
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1674
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1675
|
-
* See the License for the specific language governing permissions and
|
|
1676
|
-
* limitations under the License.
|
|
1677
|
-
*)
|
|
1678
|
-
|
|
1679
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1680
|
-
(**
|
|
1681
|
-
* @license
|
|
1682
|
-
* Copyright 2017 Google LLC
|
|
1683
|
-
*
|
|
1684
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1685
|
-
* you may not use this file except in compliance with the License.
|
|
1686
|
-
* You may obtain a copy of the License at
|
|
1687
|
-
*
|
|
1688
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1689
|
-
*
|
|
1690
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1691
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1692
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1693
|
-
* See the License for the specific language governing permissions and
|
|
1694
|
-
* limitations under the License.
|
|
1695
|
-
*)
|
|
1696
|
-
|
|
1697
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1698
|
-
(**
|
|
1699
|
-
* @license
|
|
1700
|
-
* Copyright 2020 Google LLC
|
|
1701
|
-
*
|
|
1702
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1703
|
-
* you may not use this file except in compliance with the License.
|
|
1704
|
-
* You may obtain a copy of the License at
|
|
1705
|
-
*
|
|
1706
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1707
|
-
*
|
|
1708
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1709
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1710
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1711
|
-
* See the License for the specific language governing permissions and
|
|
1712
|
-
* limitations under the License.
|
|
1713
|
-
*)
|
|
1714
|
-
(**
|
|
1715
|
-
* @license
|
|
1716
|
-
* Copyright 2017 Google LLC
|
|
1717
|
-
*
|
|
1718
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1719
|
-
* you may not use this file except in compliance with the License.
|
|
1720
|
-
* You may obtain a copy of the License at
|
|
1721
|
-
*
|
|
1722
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1723
|
-
*
|
|
1724
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1725
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1726
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1727
|
-
* See the License for the specific language governing permissions and
|
|
1728
|
-
* limitations under the License.
|
|
1729
|
-
*)
|
|
1730
|
-
|
|
1731
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1732
|
-
(**
|
|
1733
|
-
* @license
|
|
1734
|
-
* Copyright 2017 Google LLC
|
|
1735
|
-
*
|
|
1736
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1737
|
-
* you may not use this file except in compliance with the License.
|
|
1738
|
-
* You may obtain a copy of the License at
|
|
1739
|
-
*
|
|
1740
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1741
|
-
*
|
|
1742
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1743
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1744
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1745
|
-
* See the License for the specific language governing permissions and
|
|
1746
|
-
* limitations under the License.
|
|
1747
|
-
*)
|
|
1748
|
-
|
|
1749
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1750
|
-
(**
|
|
1751
|
-
* @license
|
|
1752
|
-
* Copyright 2019 Google LLC
|
|
1753
|
-
*
|
|
1754
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1755
|
-
* you may not use this file except in compliance with the License.
|
|
1756
|
-
* You may obtain a copy of the License at
|
|
1757
|
-
*
|
|
1758
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1759
|
-
*
|
|
1760
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1761
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1762
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1763
|
-
* See the License for the specific language governing permissions and
|
|
1764
|
-
* limitations under the License.
|
|
1765
|
-
*)
|
|
1766
|
-
|
|
1767
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1768
|
-
(**
|
|
1769
|
-
* @license
|
|
1770
|
-
* Copyright 2017 Google LLC
|
|
1771
|
-
*
|
|
1772
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1773
|
-
* you may not use this file except in compliance with the License.
|
|
1774
|
-
* You may obtain a copy of the License at
|
|
1775
|
-
*
|
|
1776
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1777
|
-
*
|
|
1778
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1779
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1780
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1781
|
-
* See the License for the specific language governing permissions and
|
|
1782
|
-
* limitations under the License.
|
|
1783
|
-
*)
|
|
1784
|
-
|
|
1785
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1786
|
-
(**
|
|
1787
|
-
* @license
|
|
1788
|
-
* Copyright 2023 Google LLC
|
|
1789
|
-
*
|
|
1790
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1791
|
-
* you may not use this file except in compliance with the License.
|
|
1792
|
-
* You may obtain a copy of the License at
|
|
1793
|
-
*
|
|
1794
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1795
|
-
*
|
|
1796
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1797
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1798
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1799
|
-
* See the License for the specific language governing permissions and
|
|
1800
|
-
* limitations under the License.
|
|
1801
|
-
*)
|
|
1802
|
-
(**
|
|
1803
|
-
* @license
|
|
1804
|
-
* Copyright 2020 Google LLC
|
|
1805
|
-
*
|
|
1806
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1807
|
-
* you may not use this file except in compliance with the License.
|
|
1808
|
-
* You may obtain a copy of the License at
|
|
1809
|
-
*
|
|
1810
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1811
|
-
*
|
|
1812
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1813
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1814
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1815
|
-
* See the License for the specific language governing permissions and
|
|
1816
|
-
* limitations under the License.
|
|
1817
|
-
*)
|
|
1818
|
-
(**
|
|
1819
|
-
* @license
|
|
1820
|
-
* Copyright 2017 Google LLC
|
|
1821
|
-
*
|
|
1822
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1823
|
-
* you may not use this file except in compliance with the License.
|
|
1824
|
-
* You may obtain a copy of the License at
|
|
1825
|
-
*
|
|
1826
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1827
|
-
*
|
|
1828
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1829
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1830
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1831
|
-
* See the License for the specific language governing permissions and
|
|
1832
|
-
* limitations under the License.
|
|
1833
|
-
*)
|
|
1834
|
-
|
|
1835
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1836
|
-
(**
|
|
1837
|
-
* @license
|
|
1838
|
-
* Copyright 2020 Google LLC
|
|
1839
|
-
*
|
|
1840
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1841
|
-
* you may not use this file except in compliance with the License.
|
|
1842
|
-
* You may obtain a copy of the License at
|
|
1843
|
-
*
|
|
1844
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1845
|
-
*
|
|
1846
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1847
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1848
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1849
|
-
* See the License for the specific language governing permissions and
|
|
1850
|
-
* limitations under the License.
|
|
1851
|
-
*)
|
|
1852
|
-
|
|
1853
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1854
|
-
(**
|
|
1855
|
-
* @license
|
|
1856
|
-
* Copyright 2020 Google LLC
|
|
1857
|
-
*
|
|
1858
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1859
|
-
* you may not use this file except in compliance with the License.
|
|
1860
|
-
* You may obtain a copy of the License at
|
|
1861
|
-
*
|
|
1862
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1863
|
-
*
|
|
1864
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1865
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1866
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1867
|
-
* See the License for the specific language governing permissions and
|
|
1868
|
-
* limitations under the License.
|
|
1869
|
-
*)
|
|
1870
|
-
|
|
1871
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1872
|
-
(**
|
|
1873
|
-
* @license
|
|
1874
|
-
* Copyright 2020 Google LLC
|
|
1875
|
-
*
|
|
1876
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1877
|
-
* you may not use this file except in compliance with the License.
|
|
1878
|
-
* You may obtain a copy of the License at
|
|
1879
|
-
*
|
|
1880
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1881
|
-
*
|
|
1882
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1883
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1884
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1885
|
-
* See the License for the specific language governing permissions and
|
|
1886
|
-
* limitations under the License.
|
|
1887
|
-
*)
|
|
1888
|
-
|
|
1889
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1890
|
-
(**
|
|
1891
|
-
* @license
|
|
1892
|
-
* Copyright 2020 Google LLC
|
|
1893
|
-
*
|
|
1894
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1895
|
-
* you may not use this file except in compliance with the License.
|
|
1896
|
-
* You may obtain a copy of the License at
|
|
1897
|
-
*
|
|
1898
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1899
|
-
*
|
|
1900
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1901
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1902
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1903
|
-
* See the License for the specific language governing permissions and
|
|
1904
|
-
* limitations under the License.
|
|
1905
|
-
*)
|
|
1906
|
-
(**
|
|
1907
|
-
* @license
|
|
1908
|
-
* Copyright 2022 Google LLC
|
|
1909
|
-
*
|
|
1910
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1911
|
-
* you may not use this file except in compliance with the License.
|
|
1912
|
-
* You may obtain a copy of the License at
|
|
1913
|
-
*
|
|
1914
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1915
|
-
*
|
|
1916
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1917
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1918
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1919
|
-
* See the License for the specific language governing permissions and
|
|
1920
|
-
* limitations under the License.
|
|
1921
|
-
*)
|
|
1922
|
-
|
|
1923
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1924
|
-
(**
|
|
1925
|
-
* @license
|
|
1926
|
-
* Copyright 2020 Google LLC
|
|
1927
|
-
*
|
|
1928
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1929
|
-
* you may not use this file except in compliance with the License.
|
|
1930
|
-
* You may obtain a copy of the License at
|
|
1931
|
-
*
|
|
1932
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1933
|
-
*
|
|
1934
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1935
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1936
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1937
|
-
* See the License for the specific language governing permissions and
|
|
1938
|
-
* limitations under the License.
|
|
1939
|
-
*)
|
|
1940
|
-
|
|
1941
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1942
|
-
(**
|
|
1943
|
-
* @license
|
|
1944
|
-
* Copyright 2020 Google LLC
|
|
1945
|
-
*
|
|
1946
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1947
|
-
* you may not use this file except in compliance with the License.
|
|
1948
|
-
* You may obtain a copy of the License at
|
|
1949
|
-
*
|
|
1950
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1951
|
-
*
|
|
1952
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1953
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1954
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1955
|
-
* See the License for the specific language governing permissions and
|
|
1956
|
-
* limitations under the License.
|
|
1957
|
-
*)
|
|
1958
|
-
(**
|
|
1959
|
-
* @license
|
|
1960
|
-
* Copyright 2017 Google LLC
|
|
1961
|
-
*
|
|
1962
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1963
|
-
* you may not use this file except in compliance with the License.
|
|
1964
|
-
* You may obtain a copy of the License at
|
|
1965
|
-
*
|
|
1966
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1967
|
-
*
|
|
1968
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1969
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1970
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1971
|
-
* See the License for the specific language governing permissions and
|
|
1972
|
-
* limitations under the License.
|
|
1973
|
-
*)
|
|
1974
|
-
(**
|
|
1975
|
-
* @license
|
|
1976
|
-
* Copyright 2024 Google LLC
|
|
1977
|
-
*
|
|
1978
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1979
|
-
* you may not use this file except in compliance with the License.
|
|
1980
|
-
* You may obtain a copy of the License at
|
|
1981
|
-
*
|
|
1982
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1983
|
-
*
|
|
1984
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1985
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1986
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1987
|
-
* See the License for the specific language governing permissions and
|
|
1988
|
-
* limitations under the License.
|
|
1989
|
-
*)
|
|
1990
|
-
|
|
1991
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
1992
|
-
(**
|
|
1993
|
-
* @license
|
|
1994
|
-
* Copyright 2020 Google LLC
|
|
1995
|
-
*
|
|
1996
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1997
|
-
* you may not use this file except in compliance with the License.
|
|
1998
|
-
* You may obtain a copy of the License at
|
|
1999
|
-
*
|
|
2000
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2001
|
-
*
|
|
2002
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2003
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2004
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2005
|
-
* See the License for the specific language governing permissions and
|
|
2006
|
-
* limitations under the License.
|
|
2007
|
-
*)
|
|
2008
|
-
|
|
2009
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2010
|
-
(**
|
|
2011
|
-
* @license
|
|
2012
|
-
* Copyright 2020 Google LLC
|
|
2013
|
-
*
|
|
2014
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2015
|
-
* you may not use this file except in compliance with the License.
|
|
2016
|
-
* You may obtain a copy of the License at
|
|
2017
|
-
*
|
|
2018
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2019
|
-
*
|
|
2020
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2021
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2022
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2023
|
-
* See the License for the specific language governing permissions and
|
|
2024
|
-
* limitations under the License.
|
|
2025
|
-
*)
|
|
2026
|
-
|
|
2027
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2028
|
-
(**
|
|
2029
|
-
* @license
|
|
2030
|
-
* Copyright 2022 Google LLC
|
|
2031
|
-
*
|
|
2032
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2033
|
-
* you may not use this file except in compliance with the License.
|
|
2034
|
-
* You may obtain a copy of the License at
|
|
2035
|
-
*
|
|
2036
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2037
|
-
*
|
|
2038
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2039
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2040
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2041
|
-
* See the License for the specific language governing permissions and
|
|
2042
|
-
* limitations under the License.
|
|
2043
|
-
*)
|
|
2044
|
-
|
|
2045
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2046
|
-
(**
|
|
2047
|
-
* @license
|
|
2048
|
-
* Copyright 2020 Google LLC
|
|
2049
|
-
*
|
|
2050
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2051
|
-
* you may not use this file except in compliance with the License.
|
|
2052
|
-
* You may obtain a copy of the License at
|
|
2053
|
-
*
|
|
2054
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2055
|
-
*
|
|
2056
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2057
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2058
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2059
|
-
* See the License for the specific language governing permissions and
|
|
2060
|
-
* limitations under the License.
|
|
2061
|
-
*)
|
|
2062
|
-
|
|
2063
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2064
|
-
(**
|
|
2065
|
-
* @license
|
|
2066
|
-
* Copyright 2020 Google LLC
|
|
2067
|
-
*
|
|
2068
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2069
|
-
* you may not use this file except in compliance with the License.
|
|
2070
|
-
* You may obtain a copy of the License at
|
|
2071
|
-
*
|
|
2072
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2073
|
-
*
|
|
2074
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2075
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2076
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2077
|
-
* See the License for the specific language governing permissions and
|
|
2078
|
-
* limitations under the License.
|
|
2079
|
-
*)
|
|
2080
|
-
|
|
2081
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2082
|
-
(**
|
|
2083
|
-
* @license
|
|
2084
|
-
* Copyright 2022 Google LLC
|
|
2085
|
-
*
|
|
2086
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2087
|
-
* you may not use this file except in compliance with the License.
|
|
2088
|
-
* You may obtain a copy of the License at
|
|
2089
|
-
*
|
|
2090
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2091
|
-
*
|
|
2092
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2093
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2094
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2095
|
-
* See the License for the specific language governing permissions and
|
|
2096
|
-
* limitations under the License.
|
|
2097
|
-
*)
|
|
2098
|
-
|
|
2099
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2100
|
-
(**
|
|
2101
|
-
* @license
|
|
2102
|
-
* Copyright 2022 Google LLC
|
|
2103
|
-
*
|
|
2104
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2105
|
-
* you may not use this file except in compliance with the License.
|
|
2106
|
-
* You may obtain a copy of the License at
|
|
2107
|
-
*
|
|
2108
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2109
|
-
*
|
|
2110
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2111
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2112
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2113
|
-
* See the License for the specific language governing permissions and
|
|
2114
|
-
* limitations under the License.
|
|
2115
|
-
*)
|
|
2116
|
-
|
|
2117
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2118
|
-
(**
|
|
2119
|
-
* @license
|
|
2120
|
-
* Copyright 2020 Google LLC
|
|
2121
|
-
*
|
|
2122
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2123
|
-
* you may not use this file except in compliance with the License.
|
|
2124
|
-
* You may obtain a copy of the License at
|
|
2125
|
-
*
|
|
2126
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2127
|
-
*
|
|
2128
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2129
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2130
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2131
|
-
* See the License for the specific language governing permissions and
|
|
2132
|
-
* limitations under the License.
|
|
2133
|
-
*)
|
|
2134
|
-
|
|
2135
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2136
|
-
(**
|
|
2137
|
-
* @license
|
|
2138
|
-
* Copyright 2020 Google LLC
|
|
2139
|
-
*
|
|
2140
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2141
|
-
* you may not use this file except in compliance with the License.
|
|
2142
|
-
* You may obtain a copy of the License at
|
|
2143
|
-
*
|
|
2144
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2145
|
-
*
|
|
2146
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2147
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2148
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2149
|
-
* See the License for the specific language governing permissions and
|
|
2150
|
-
* limitations under the License.
|
|
2151
|
-
*)
|
|
2152
|
-
|
|
2153
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2154
|
-
(**
|
|
2155
|
-
* @license
|
|
2156
|
-
* Copyright 2020 Google LLC
|
|
2157
|
-
*
|
|
2158
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2159
|
-
* you may not use this file except in compliance with the License.
|
|
2160
|
-
* You may obtain a copy of the License at
|
|
2161
|
-
*
|
|
2162
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2163
|
-
*
|
|
2164
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2165
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2166
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2167
|
-
* See the License for the specific language governing permissions and
|
|
2168
|
-
* limitations under the License.
|
|
2169
|
-
*)
|
|
2170
|
-
|
|
2171
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2172
|
-
(**
|
|
2173
|
-
* @license
|
|
2174
|
-
* Copyright 2020 Google LLC
|
|
2175
|
-
*
|
|
2176
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2177
|
-
* you may not use this file except in compliance with the License.
|
|
2178
|
-
* You may obtain a copy of the License at
|
|
2179
|
-
*
|
|
2180
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2181
|
-
*
|
|
2182
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2183
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2184
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2185
|
-
* See the License for the specific language governing permissions and
|
|
2186
|
-
* limitations under the License.
|
|
2187
|
-
*)
|
|
2188
|
-
|
|
2189
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2190
|
-
(**
|
|
2191
|
-
* @license
|
|
2192
|
-
* Copyright 2020 Google LLC
|
|
2193
|
-
*
|
|
2194
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2195
|
-
* you may not use this file except in compliance with the License.
|
|
2196
|
-
* You may obtain a copy of the License at
|
|
2197
|
-
*
|
|
2198
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2199
|
-
*
|
|
2200
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2201
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2202
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2203
|
-
* See the License for the specific language governing permissions and
|
|
2204
|
-
* limitations under the License.
|
|
2205
|
-
*)
|
|
2206
|
-
|
|
2207
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2208
|
-
(**
|
|
2209
|
-
* @license
|
|
2210
|
-
* Copyright 2021 Google LLC
|
|
2211
|
-
*
|
|
2212
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2213
|
-
* you may not use this file except in compliance with the License.
|
|
2214
|
-
* You may obtain a copy of the License at
|
|
2215
|
-
*
|
|
2216
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2217
|
-
*
|
|
2218
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2219
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2220
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2221
|
-
* See the License for the specific language governing permissions and
|
|
2222
|
-
* limitations under the License.
|
|
2223
|
-
*)
|
|
2224
|
-
|
|
2225
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2226
|
-
(**
|
|
2227
|
-
* @license
|
|
2228
|
-
* Copyright 2023 Google LLC
|
|
2229
|
-
*
|
|
2230
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2231
|
-
* you may not use this file except in compliance with the License.
|
|
2232
|
-
* You may obtain a copy of the License at
|
|
2233
|
-
*
|
|
2234
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2235
|
-
*
|
|
2236
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2237
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2238
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2239
|
-
* See the License for the specific language governing permissions and
|
|
2240
|
-
* limitations under the License.
|
|
2241
|
-
*)
|
|
2242
|
-
|
|
2243
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2244
|
-
(**
|
|
2245
|
-
* @license
|
|
2246
|
-
* Copyright 2017 Google LLC
|
|
2247
|
-
*
|
|
2248
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2249
|
-
* you may not use this file except in compliance with the License.
|
|
2250
|
-
* You may obtain a copy of the License at
|
|
2251
|
-
*
|
|
2252
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2253
|
-
*
|
|
2254
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2255
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2256
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2257
|
-
* See the License for the specific language governing permissions and
|
|
2258
|
-
* limitations under the License.
|
|
2259
|
-
*)
|
|
2260
|
-
|
|
2261
|
-
@firebase/firestore/dist/index.esm2017.js:
|
|
2262
|
-
(**
|
|
2263
|
-
* @license
|
|
2264
|
-
* Copyright 2023 Google LLC
|
|
2265
|
-
*
|
|
2266
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2267
|
-
* you may not use this file except in compliance with the License.
|
|
2268
|
-
* You may obtain a copy of the License at
|
|
2269
|
-
*
|
|
2270
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2271
|
-
*
|
|
2272
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2273
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2274
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2275
|
-
* See the License for the specific language governing permissions and
|
|
2276
|
-
* limitations under the License.
|
|
2277
|
-
*)
|
|
2278
417
|
*/
|