PageSourceSearch

https://kanto.co/chunk-AKJBBQZ5.js

js kanto.co collected 2026-10-08 21:36:06 UTC 526,857 bytes, 41 lines download raw bytes

1import{a as ur,b as $r}from"./chunk-ORFBU6TE.js";import{a as rc,e as gp,i as _p,j as yp,k as Le,l as zt}from"./chunk-T7JB4KWH.js";import{b as ko}from"./chunk-QW7RWYYF.js";import{$ as P,$b as To,Ab as Eo,Ba as or,Bb as ip,E as Yf,G as Jf,H as Xf,I as _o,J as Ju,K as Zf,L as yo,M as Me,N as Xu,Nb as sp,Ob as On,P as vo,Pb as op,Q as pe,R as Zu,Sb as ap,T as ep,Y as $,Z as Nn,_ as We,a as Gf,ac as up,b as Cn,c as xn,ca as Vn,d as et,e as go,f as Wf,h as Br,i as Rn,j as ir,ja as tp,k as Z,l as De,la as wo,ma as sr,o as Dn,p as se,sa as Io,tb as rp,ub as np,v as Hf,w as zi,x as $t,xb as ec}from"./chunk-M67X4TBK.js";import{P as me,Q as jr,T as St,U as Ao,W as Ki,X as pp,Y as mp,Z as ar,_ as Qe,c as cp,k as tc,l as lp,m as bo,s as hp,t as So,v as dp,w as fp}from"./chunk-AIVC3O6L.js";import{b as vp}from"./chunk-YWAMULJU.js";import{b as zr,c as Po,d as wp,e as Co,f as Fn,g as Ep,h as Ln,i as Fp,j as Mp}from"./chunk-ONKAP2XS.js";import{c as xp,d as Rp,e as Dp,f as Op,g as No,i as Vo}from"./chunk-KL2776WL.js";import{a as nc,b as Ip,c as xo,d as ic,e as Ro,f as Mn,g as Do,h as Tp,i as bp,j as Sp,k as Ap,l as kp,m as Pp,n as Cp,o as cr,q as Np,r as Vp}from"./chunk-AMCUGSEE.js";import{a as bt,b as j,c as Qf,d as L,e as q,f as at}from"./chunk-WD7UZH4L.js";import{a as U,b as nt,f as Kf,h as ww,j as Yu,k as S}from"./chunk-XU43R4EC.js";var d0=Kf((l0,h0)=>{"use strict";(function(r){if(typeof l0=="object")h0.exports=r();else if(typeof define=="function"&&define.amd)define(r);else{var e;try{e=window}catch{e=self}e.SparkMD5=r()}})(function(r){"use strict";var e=function(I,v){return I+v&4294967295},t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(I,v,p,g,_,y){return v=e(e(v,I),e(g,y)),e(v<<_|v>>>32-_,p)}function i(I,v){var p=I[0],g=I[1],_=I[2],y=I[3];p+=(g&_|~g&y)+v[0]-680876936|0,p=(p<<7|p>>>25)+g|0,y+=(p&g|~p&_)+v[1]-389564586|0,y=(y<<12|y>>>20)+p|0,_+=(y&p|~y&g)+v[2]+606105819|0,_=(_<<17|_>>>15)+y|0,g+=(_&y|~_&p)+v[3]-1044525330|0,g=(g<<22|g>>>10)+_|0,p+=(g&_|~g&y)+v[4]-176418897|0,p=(p<<7|p>>>25)+g|0,y+=(p&g|~p&_)+v[5]+1200080426|0,y=(y<<12|y>>>20)+p|0,_+=(y&p|~y&g)+v[6]-1473231341|0,_=(_<<17|_>>>15)+y|0,g+=(_&y|~_&p)+v[7]-45705983|0,g=(g<<22|g>>>10)+_|0,p+=(g&_|~g&y)+v[8]+1770035416|0,p=(p<<7|p>>>25)+g|0,y+=(p&g|~p&_)+v[9]-1958414417|0,y=(y<<12|y>>>20)+p|0,_+=(y&p|~y&g)+v[10]-42063|0,_=(_<<17|_>>>15)+y|0,g+=(_&y|~_&p)+v[11]-1990404162|0,g=(g<<22|g>>>10)+_|0,p+=(g&_|~g&y)+v[12]+1804603682|0,p=(p<<7|p>>>25)+g|0,y+=(p&g|~p&_)+v[13]-40341101|0,y=(y<<12|y>>>20)+p|0,_+=(y&p|~y&g)+v[14]-1502002290|0,_=(_<<17|_>>>15)+y|0,g+=(_&y|~_&p)+v[15]+1236535329|0,g=(g<<22|g>>>10)+_|0,p+=(g&y|_&~y)+v[1]-165796510|0,p=(p<<5|p>>>27)+g|0,y+=(p&_|g&~_)+v[6]-1069501632|0,y=(y<<9|y>>>23)+p|0,_+=(y&g|p&~g)+v[11]+643717713|0,_=(_<<14|_>>>18)+y|0,g+=(_&p|y&~p)+v[0]-373897302|0,g=(g<<20|g>>>12)+_|0,p+=(g&y|_&~y)+v[5]-701558691|0,p=(p<<5|p>>>27)+g|0,y+=(p&_|g&~_)+v[10]+38016083|0,y=(y<<9|y>>>23)+p|0,_+=(y&g|p&~g)+v[15]-660478335|0,_=(_<<14|_>>>18)+y|0,g+=(_&p|y&~p)+v[4]-405537848|0,g=(g<<20|g>>>12)+_|0,p+=(g&y|_&~y)+v[9]+568446438|0,p=(p<<5|p>>>27)+g|0,y+=(p&_|g&~_)+v[14]-1019803690|0,y=(y<<9|y>>>23)+p|0,_+=(y&g|p&~g)+v[3]-187363961|0,_=(_<<14|_>>>18)+y|0,g+=(_&p|y&~p)+v[8]+1163531501|0,g=(g<<20|g>>>12)+_|0,p+=(g&y|_&~y)+v[13]-1444681467|0,p=(p<<5|p>>>27)+g|0,y+=(p&_|g&~_)+v[2]-51403784|0,y=(y<<9|y>>>23)+p|0,_+=(y&g|p&~g)+v[7]+1735328473|0,_=(_<<14|_>>>18)+y|0,g+=(_&p|y&~p)+v[12]-1926607734|0,g=(g<<20|g>>>12)+_|0,p+=(g^_^y)+v[5]-378558|0,p=(p<<4|p>>>28)+g|0,y+=(p^g^_)+v[8]-2022574463|0,y=(y<<11|y>>>21)+p|0,_+=(y^p^g)+v[11]+1839030562|0,_=(_<<16|_>>>16)+y|0,g+=(_^y^p)+v[14]-35309556|0,g=(g<<23|g>>>9)+_|0,p+=(g^_^y)+v[1]-1530992060|0,p=(p<<4|p>>>28)+g|0,y+=(p^g^_)+v[4]+1272893353|0,y=(y<<11|y>>>21)+p|0,_+=(y^p^g)+v[7]-155497632|0,_=(_<<16|_>>>16)+y|0,g+=(_^y^p)+v[10]-1094730640|0,g=(g<<23|g>>>9)+_|0,p+=(g^_^y)+v[13]+681279174|0,p=(p<<4|p>>>28)+g|0,y+=(p^g^_)+v[0]-358537222|0,y=(y<<11|y>>>21)+p|0,_+=(y^p^g)+v[3]-722521979|0,_=(_<<16|_>>>16)+y|0,g+=(_^y^p)+v[6]+76029189|0,g=(g<<23|g>>>9)+_|0,p+=(g^_^y)+v[9]-640364487|0,p=(p<<4|p>>>28)+g|0,y+=(p^g^_)+v[12]-421815835|0,y=(y<<11|y>>>21)+p|0,_+=(y^p^g)+v[15]+530742520|0,_=(_<<16|_>>>16)+y|0,g+=(_^y^p)+v[2]-995338651|0,g=(g<<23|g>>>
19)+_|0,p+=(_^(g|~y))+v[0]-198630844|0,p=(p<<6|p>>>26)+g|0,y+=(g^(p|~_))+v[7]+1126891415|0,y=(y<<10|y>>>22)+p|0,_+=(p^(y|~g))+v[14]-1416354905|0,_=(_<<15|_>>>17)+y|0,g+=(y^(_|~p))+v[5]-57434055|0,g=(g<<21|g>>>11)+_|0,p+=(_^(g|~y))+v[12]+1700485571|0,p=(p<<6|p>>>26)+g|0,y+=(g^(p|~_))+v[3]-1894986606|0,y=(y<<10|y>>>22)+p|0,_+=(p^(y|~g))+v[10]-1051523|0,_=(_<<15|_>>>17)+y|0,g+=(y^(_|~p))+v[1]-2054922799|0,g=(g<<21|g>>>11)+_|0,p+=(_^(g|~y))+v[8]+1873313359|0,p=(p<<6|p>>>26)+g|0,y+=(g^(p|~_))+v[15]-30611744|0,y=(y<<10|y>>>22)+p|0,_+=(p^(y|~g))+v[6]-1560198380|0,_=(_<<15|_>>>17)+y|0,g+=(y^(_|~p))+v[13]+1309151649|0,g=(g<<21|g>>>11)+_|0,p+=(_^(g|~y))+v[4]-145523070|0,p=(p<<6|p>>>26)+g|0,y+=(g^(p|~_))+v[11]-1120210379|0,y=(y<<10|y>>>22)+p|0,_+=(p^(y|~g))+v[2]+718787259|0,_=(_<<15|_>>>17)+y|0,g+=(y^(_|~p))+v[9]-343485551|0,g=(g<<21|g>>>11)+_|0,I[0]=p+I[0]|0,I[1]=g+I[1]|0,I[2]=_+I[2]|0,I[3]=y+I[3]|0}function s(I){var v=[],p;for(p=0;p<64;p+=4)v[p>>2]=I.charCodeAt(p)+(I.charCodeAt(p+1)<<8)+(I.charCodeAt(p+2)<<16)+(I.charCodeAt(p+3)<<24);return v}function o(I){var v=[],p;for(p=0;p<64;p+=4)v[p>>2]=I[p]+(I[p+1]<<8)+(I[p+2]<<16)+(I[p+3]<<24);return v}function a(I){var v=I.length,p=[1732584193,-271733879,-1732584194,271733878],g,_,y,M,B,W;for(g=64;g<=v;g+=64)i(p,s(I.substring(g-64,g)));for(I=I.substring(g-64),_=I.length,y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=0;g<_;g+=1)y[g>>2]|=I.charCodeAt(g)<<(g%4<<3);if(y[g>>2]|=128<<(g%4<<3),g>55)for(i(p,y),g=0;g<16;g+=1)y[g]=0;return M=v*8,M=M.toString(16).match(/(.*?)(.{0,8})$/),B=parseInt(M[2],16),W=parseInt(M[1],16)||0,y[14]=B,y[15]=W,i(p,y),p}function u(I){var v=I.length,p=[1732584193,-271733879,-1732584194,271733878],g,_,y,M,B,W;for(g=64;g<=v;g+=64)i(p,o(I.subarray(g-64,g)));for(I=g-64<v?I.subarray(g-64):new Uint8Array(0),_=I.length,y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=0;g<_;g+=1)y[g>>2]|=I[g]<<(g%4<<3);if(y[g>>2]|=128<<(g%4<<3),g>55)for(i(p,y),g=0;g<16;g+=1)y[g]=0;return M=v*8,M=M.toString(16).match(/(.*?)(.{0,8})$/),B=parseInt(M[2],16),W=parseInt(M[1],16)||0,y[14]=B,y[15]=W,i(p,y),p}function c(I){var v="",p;for(p=0;p<4;p+=1)v+=t[I>>p*8+4&15]+t[I>>p*8&15];return v}function l(I){var v;for(v=0;v<I.length;v+=1)I[v]=c(I[v]);return I.join("")}l(a("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(e=function(I,v){var p=(I&65535)+(v&65535),g=(I>>16)+(v>>16)+(p>>16);return g<<16|p&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function I(v,p){return v=v|0||0,v<0?Math.max(v+p,0):Math.min(v,p)}ArrayBuffer.prototype.slice=function(v,p){var g=this.byteLength,_=I(v,g),y=g,M,B,W,te;return p!==r&&(y=I(p,g)),_>y?new ArrayBuffer(0):(M=y-_,B=new ArrayBuffer(M),W=new Uint8Array(B),te=new Uint8Array(this,_,M),W.set(te),B)}}();function h(I){return/[\u0080-\uFFFF]/.test(I)&&(I=unescape(encodeURIComponent(I))),I}function d(I,v){var p=I.length,g=new ArrayBuffer(p),_=new Uint8Array(g),y;for(y=0;y<p;y+=1)_[y]=I.charCodeAt(y);return v?_:g}function m(I){return String.fromCharCode.apply(null,new Uint8Array(I))}function w(I,v,p){var g=new Uint8Array(I.byteLength+v.byteLength);return g.set(new Uint8Array(I)),g.set(new Uint8Array(v),I.byteLength),p?g:g.buffer}function T(I){var v=[],p=I.length,g;for(g=0;g<p-1;g+=2)v.push(parseInt(I.substr(g,2),16));return String.fromCharCode.apply(String,v)}function E(){this.reset()}return E.prototype.append=function(I){return this.appendBinary(h(I)),this},E.prototype.appendBinary=function(I){this._buff+=I,this._length+=I.length;var v=this._buff.length,p;for(p=64;p<=v;p+=64)i(this._hash,s(this._buff.substring(p-64,p)));return this._buff=this._buff.substring(p-64),this},E.prototype.end=function(I){var v=this._buff,p=v.length,g,_=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],y;for(g=0;g<p;g+=1)_[g>>2]|=v.charCodeAt(g)<<(g%4<<3);return this._finish(_,p),y=l(this._hash),I&&(y=T(y)),this.reset(),y},E.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},E.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},E.prototype.setState=function(I){return this._buff=I.buff,this._length=I.length,this._hash=I.hash,this},E.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},E.prototype._finish=function(I,v){var p=v,g,_,y;if(I[p>>2]|=128<<(p%4<<3),p>55)for(i(this._hash,I),p=0;p<16;
1p+=1)I[p]=0;g=this._length*8,g=g.toString(16).match(/(.*?)(.{0,8})$/),_=parseInt(g[2],16),y=parseInt(g[1],16)||0,I[14]=_,I[15]=y,i(this._hash,I)},E.hash=function(I,v){return E.hashBinary(h(I),v)},E.hashBinary=function(I,v){var p=a(I),g=l(p);return v?T(g):g},E.ArrayBuffer=function(){this.reset()},E.ArrayBuffer.prototype.append=function(I){var v=w(this._buff.buffer,I,!0),p=v.length,g;for(this._length+=I.byteLength,g=64;g<=p;g+=64)i(this._hash,o(v.subarray(g-64,g)));return this._buff=g-64<p?new Uint8Array(v.buffer.slice(g-64)):new Uint8Array(0),this},E.ArrayBuffer.prototype.end=function(I){var v=this._buff,p=v.length,g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_,y;for(_=0;_<p;_+=1)g[_>>2]|=v[_]<<(_%4<<3);return this._finish(g,p),y=l(this._hash),I&&(y=T(y)),this.reset(),y},E.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},E.ArrayBuffer.prototype.getState=function(){var I=E.prototype.getState.call(this);return I.buff=m(I.buff),I},E.ArrayBuffer.prototype.setState=function(I){return I.buff=d(I.buff,!0),E.prototype.setState.call(this,I)},E.ArrayBuffer.prototype.destroy=E.prototype.destroy,E.ArrayBuffer.prototype._finish=E.prototype._finish,E.ArrayBuffer.hash=function(I,v){var p=u(new Uint8Array(I)),g=l(p);return v?T(g):g},E})});var lw=Kf((oC,cw)=>{"use strict";var tr={DEBUG:!1,LIB_VERSION:"2.48.1"},_e;typeof window>"u"?(yf={hostname:""},_e={navigator:{userAgent:""},document:{location:yf,referrer:""},screen:{width:0,height:0},location:yf}):_e=window;var yf,Ku=Array.prototype,Ub=Function.prototype,J0=Object.prototype,Or=Ku.slice,po=J0.toString,Gu=J0.hasOwnProperty,xe=_e.console,Fr=_e.navigator,ae=_e.document,Lu=_e.opera,qu=_e.screen,Ut=Fr.userAgent,vf=Ub.bind,j0=Ku.forEach,$0=Ku.indexOf,z0=Ku.map,Bb=Array.isArray,Ef={},f={trim:function(r){return r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},ie={log:function(){if(tr.DEBUG&&!f.isUndefined(xe)&&xe)try{xe.log.apply(xe,arguments)}catch{f.each(arguments,function(e){xe.log(e)})}},warn:function(){if(tr.DEBUG&&!f.isUndefined(xe)&&xe){var r=["Mixpanel warning:"].concat(f.toArray(arguments));try{xe.warn.apply(xe,r)}catch{f.each(r,function(t){xe.warn(t)})}}},error:function(){if(tr.DEBUG&&!f.isUndefined(xe)&&xe){var r=["Mixpanel error:"].concat(f.toArray(arguments));try{xe.error.apply(xe,r)}catch{f.each(r,function(t){xe.error(t)})}}},critical:function(){if(!f.isUndefined(xe)&&xe){var r=["Mixpanel error:"].concat(f.toArray(arguments));try{xe.error.apply(xe,r)}catch{f.each(r,function(t){xe.error(t)})}}}},wf=function(r,e){return function(){return arguments[0]="["+e+"] "+arguments[0],r.apply(ie,arguments)}},bf=function(r){return{log:wf(ie.log,r),error:wf(ie.error,r),critical:wf(ie.critical,r)}};f.bind=function(r,e){var t,n;if(vf&&r.bind===vf)return vf.apply(r,Or.call(arguments,1));if(!f.isFunction(r))throw new TypeError;return t=Or.call(arguments,2),n=function(){if(!(this instanceof n))return r.apply(e,t.concat(Or.call(arguments)));var i={};i.prototype=r.prototype;var s=new i;i.prototype=null;var o=r.apply(s,t.concat(Or.call(arguments)));return Object(o)===o?o:s},n};f.each=function(r,e,t){if(r!=null){if(j0&&r.forEach===j0)r.forEach(e,t);else if(r.length===+r.length){for(var n=0,i=r.length;n<i;n++)if(n in r&&e.call(t,r[n],n,r)===Ef)return}else for(var s in r)if(Gu.call(r,s)&&e.call(t,r[s],s,r)===Ef)return}};f.extend=function(r){return f.each(Or.call(arguments,1),function(e){for(var t in e)e[t]!==void 0&&(r[t]=e[t])}),r};f.isArray=Bb||function(r){return po.call(r)==="[object Array]"};f.isFunction=function(r){try{return/^\s*\bfunction\b/.test(r)}catch{return!1}};f.isArguments=function(r){return!!(r&&Gu.call(r,"callee"))};f.toArray=function(r){return r?r.toArray?r.toArray():f.isArray(r)||f.isArguments(r)?Or.call(r):f.values(r):[]};f.map=function(r,e,t){if(z0&&r.map===z0)return r.map(e,t);var n=[];return f.each(r,function(i){n.push(e.call(t,i))}),n};f.keys=function(r){var e=[];return r===null||f.each(r,function(t,n){e[e.length]=n}),e};f.values=function(r){var e=[];return r===null||f.each(r,function(t){e[e.length]=t}),e};f.include=function(r,e){var t=!1;return r===null?t:$0&&r.indexOf===$0?r.indexOf(e)!=-1:(f.each(r,function(n){if(t||(t=n===e))return Ef}),t)};f.includes=function(r,e){return r.indexOf(e)!==-1};f.inherit=function(r,e){return r.prototype=new e,r.prototype.constructor=r,r.superclass=e.prototype,r};f.isObject=function(r){return r===Object(r)&&!f.isArray(r)};f.isEmptyObject=function(r){if(f.isObject(r)){for(var e in r)if(Gu.call(r,e))return!1;return!0}return!1};f.isUndefined=function(r){return r===void 0};f.isString=function(r){return po.call(r)=="[object String]"};f.isDate=function(r){return po.call(r)=="[object Date]"};f.isNumber=function(r){return po.call(r)=="[object Number]"};f.isElement=function(r){return!!(r&&r.nodeType===1)};f.encodeDates=function(r){return f.each(r,function(e,t){f.isDate(e)?r[t]=f.formatDate(e):f.isObject(e)&&(r[t]=f.encodeDates(e))}),r};f.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()};f.formatDate=function(r){function e(t){return t<10?"0"+t:t}return r.getUTCFullYear()+"-"+e(r.getUTCMonth()+1)+"-"+e(r.getUTCDate())+"T"+e(r.getUTCHours())+":"+e(r.getUTCMinutes())+":"+e(r.getUTCSeconds())};f.strip_empty_properties=function(r){var e={};return f.each(r,function(t,n){f.isString(t)&&t.length>0&&(e[n]=t)}),e};f.truncate=function(r,e){var t;return typeof r=="string"?t=r.slice(0,e):f.isArray(r)?(t=[],f.each(r,function(n){t.push(f.truncate(n,e))})):f.isObject(r)?(t={},f.each(r,function(n,i){t[i]=f.truncate(n,e)})):t=r,t};f.JSONEncode=function(){return function(r){var e=r,t=function(i){var s=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o={"\b":"\\b","	":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return s.lastIndex=0,s.test(i)?'"'+i.replace(s,function(a){var u=o[a];
vendor: 12,508 bytes, lines 1-7
1return typeof u=="string"?u:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'},n=function(i,s){var o="",a="    ",u=0,c="",l="",h=0,d=o,m=[],w=s[i];switch(w&&typeof w=="object"&&typeof w.toJSON=="function"&&(w=w.toJSON(i)),typeof w){case"string":return t(w);case"number":return isFinite(w)?String(w):"null";case"boolean":case"null":return String(w);case"object":if(!w)return"null";if(o+=a,m=[],po.apply(w)==="[object Array]"){for(h=w.length,u=0;u<h;u+=1)m[u]=n(u,w)||"null";return l=m.length===0?"[]":o?`[
2`+o+m.join(`,
3`+o)+`
4`+d+"]":"["+m.join(",")+"]",o=d,l}for(c in w)Gu.call(w,c)&&(l=n(c,w),l&&m.push(t(c)+(o?": ":":")+l));return l=m.length===0?"{}":o?"{"+m.join(",")+d+"}":"{"+m.join(",")+"}",o=d,l}};return n("",{"":e})}}();f.JSONDecode=function(){var r,e,t={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
5`,r:"\r",t:"	"},n,i=function(m){var w=new SyntaxError(m);throw w.at=r,w.text=n,w},s=function(m){return m&&m!==e&&i("Expected '"+m+"' instead of '"+e+"'"),e=n.charAt(r),r+=1,e},o=function(){var m,w="";for(e==="-"&&(w="-",s("-"));e>="0"&&e<="9";)w+=e,s();if(e===".")for(w+=".";s()&&e>="0"&&e<="9";)w+=e;if(e==="e"||e==="E")for(w+=e,s(),(e==="-"||e==="+")&&(w+=e,s());e>="0"&&e<="9";)w+=e,s();if(m=+w,!isFinite(m))i("Bad number");else return m},a=function(){var m,w,T="",E;if(e==='"')for(;s();){if(e==='"')return s(),T;if(e==="\\")if(s(),e==="u"){for(E=0,w=0;w<4&&(m=parseInt(s(),16),!!isFinite(m));w+=1)E=E*16+m;T+=String.fromCharCode(E)}else if(typeof t[e]=="string")T+=t[e];else break;else T+=e}i("Bad string")},u=function(){for(;e&&e<=" ";)s()},c=function(){switch(e){case"t":return s("t"),s("r"),s("u"),s("e"),!0;case"f":return s("f"),s("a"),s("l"),s("s"),s("e"),!1;case"n":return s("n"),s("u"),s("l"),s("l"),null}i('Unexpected "'+e+'"')},l,h=function(){var m=[];if(e==="["){if(s("["),u(),e==="]")return s("]"),m;for(;e;){if(m.push(l()),u(),e==="]")return s("]"),m;s(","),u()}}i("Bad array")},d=function(){var m,w={};if(e==="{"){if(s("{"),u(),e==="}")return s("}"),w;for(;e;){if(m=a(),u(),s(":"),Object.hasOwnProperty.call(w,m)&&i('Duplicate key "'+m+'"'),w[m]=l(),u(),e==="}")return s("}"),w;s(","),u()}}i("Bad object")};return l=function(){switch(u(),e){case"{":return d();case"[":return h();case'"':return a();case"-":return o();default:return e>="0"&&e<="9"?o():c()}},function(m){var w;return n=m,r=0,e=" ",w=l(),u(),e&&i("Syntax error"),w}}();f.base64Encode=function(r){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",t,n,i,s,o,a,u,c,l=0,h=0,d="",m=[];if(!r)return r;r=f.utf8Encode(r);do t=r.charCodeAt(l++),n=r.charCodeAt(l++),i=r.charCodeAt(l++),c=t<<16|n<<8|i,s=c>>18&63,o=c>>12&63,a=c>>6&63,u=c&63,m[h++]=e.charAt(s)+e.charAt(o)+e.charAt(a)+e.charAt(u);while(l<r.length);switch(d=m.join(""),r.length%3){case 1:d=d.slice(0,-2)+"==";break;case 2:d=d.slice(0,-1)+"=";break}return d};f.utf8Encode=function(r){r=(r+"").replace(/\r\n/g,`
6`).replace(/\r/g,`
7`);var e="",t,n,i=0,s;for(t=n=0,i=r.length,s=0;s<i;s++){var o=r.charCodeAt(s),a=null;o<128?n++:o>127&&o<2048?a=String.fromCharCode(o>>6|192,o&63|128):a=String.fromCharCode(o>>12|224,o>>6&63|128,o&63|128),a!==null&&(n>t&&(e+=r.substring(t,n)),e+=a,t=n=s+1)}return n>t&&(e+=r.substring(t,r.length)),e};f.UUID=function(){var r=function(){var n=1*new Date,i;if(_e.performance&&_e.performance.now)i=_e.performance.now();else for(i=0;n==1*new Date;)i++;return n.toString(16)+Math.floor(i).toString(16)},e=function(){return Math.random().toString(16).replace(".","")},t=function(){var n=Ut,i,s,o=[],a=0;function u(c,l){var h,d=0;for(h=0;h<l.length;h++)d|=o[h]<<h*8;return c^d}for(i=0;i<n.length;i++)s=n.charCodeAt(i),o.unshift(s&255),o.length>=4&&(a=u(a,o),o=[]);return o.length>0&&(a=u(a,o)),a.toString(16)};return function(){var n=(qu.height*qu.width).toString(16);return r()+"-"+e()+"-"+t()+"-"+n+"-"+r()}}();var K0=["ahrefsbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];f.isBlockedUA=function(r){var e;for(r=r.toLowerCase(),e=0;e<K0.length;e++)if(r.indexOf(K0[e])!==-1)return!0;return!1};f.HTTPBuildQuery=function(r,e){var t,n,i=[];return f.isUndefined(e)&&(e="&"),f.each(r,function(s,o){t=encodeURIComponent(s.toString()),n=encodeURIComponent(o),i[i.length]=n+"="+t}),i.join(e)};f.getQueryParam=function(r,e){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var t="[\\?&]"+e+"=([^&#]*)",n=new RegExp(t),i=n.exec(r);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var s=i[1];try{s=decodeURIComponent(s)}catch{ie.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")};f.cookie={get:function(r){for(var e=r+"=",t=ae.cookie.split(";"),n=0;n<t.length;n++){for(var i=t[n];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}return null},parse:function(r){var e;try{e=f.JSONDecode(f.cookie.get(r))||{}}catch{}return e},set_seconds:function(r,e,t,n,i,s,o){var a="",u="",c="";if(o)a="; domain="+o;else if(n){var l=G0(ae.location.hostname);a=l?"; domain=."+l:""}if(t){var h=new Date;h.setTime(h.getTime()+t*1e3),u="; expires="+h.toGMTString()}s&&(i=!0,c="; SameSite=None"),i&&(c+="; secure"),ae.cookie=r+"="+encodeURIComponent(e)+u+"; path=/"+a+c},set:function(r,e,t,n,i,s,o){var a="",u="",c="";if(o)a="; domain="+o;else if(n){var l=G0(ae.location.hostname);a=l?"; domain=."+l:""}if(t){var h=new Date;h.setTime(h.getTime()+t*24*60*60*1e3),u="; expires="+h.toGMTString()}s&&(i=!0,c="; SameSite=None"),i&&(c+="; secure");var d=r+"="+encodeURIComponent(e)+u+"; path=/"+a+c;return ae.cookie=d,d},remove:function(r,e,t){f.cookie.set(r,"",-1,e,!1,!1,t)}};var If=null,Uu=function(r,e){if(If!==null&&!e)return If;var t=!0;try{r=r||window.localStorage;var n="__mplss_"+Sf(8),i="xyz";r.setItem(n,i),r.getItem(n)!==i&&(t=!1),r.removeItem(n)}catch{t=!1}return If=t,t};f.localStorage={is_supported:function(r){var e=Uu(null,r);return e||ie.error("localStorage unsupported; falling back to cookie store"),e},error:function(r){ie.error("localStorage error: "+r)},get:function(r){try{return window.localStorage.getItem(r)}catch(e){f.localStorage.error(e)}return null},parse:function(r){try{return f.JSONDecode(f.localStorage.get(r))||{}}catch{}return null},set:function(r,e){try{window.localStorage.setItem(r,e)}catch(t){f.localStorage.error(t)}},remove:function(r){try{window.localStorage.removeItem(r)}catch(e){f.localStorage.error(e)}}};f.register_event=function(){var r=function(n,i,s,o,a){if(!n){ie.error("No valid element provided to register_event");return}if(n.addEventListener&&!o)n.addEventListener(i,s,!!a);else{var u="on"+i,c=n[u];n[u]=e(n,s,c)}};function e(n,i,s){var o=function(a){if(a=a||t(window.event),!!a){var u=!0,c,l;return f.isFunction(s)&&(c=s(a)),l=i.call(n,a),(c===!1||l===!1)&&(u=!1),u}};return o}function t(n){return n&&(n.preventDefault=t.preventDefault,n.stopPropagation=t.stopPropagation),n}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},r}();var jb=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');f.dom_query=function(){function r(i){return i.all?i.all:i.getElementsByTagName("*")}var e=/[\t\r\n]/g;function t(i,s){var o=" "+s+" ";return(" "+i.className+" ").replace(e," ").indexOf(o)>=0}function n(i){if(!ae.getElementsByTagName)return[];var s=i.split(" "),o,a,u,c,l,h,d,m,w,T,E=[ae];for(h=0;h<s.length;h++){if(o=s[h].replace(/^\s+/,"").replace(/\s+$/,""),o.indexOf("#")>-1){a=o.split("#"),u=a[0];var I=a[1],v=ae.getElementById(I);if(!v||u&&v.nodeName.toLowerCase()!=u)return[];E=[v];continue}if(o.indexOf(".")>-1){a=o.split("."),u=a[0];var p=a[1];for(u||(u="*"),c=[],l=0,d=0;d<E.length;d++)for(u=="*"?w=r(E[d]):w=E[d].getElementsByTagName(u),m=0;m<w.length;m++)c[l++]=w[m];for(E=[],T=0,d=0;d<c.length;d++)c[d].className&&f.isString(c[d].className)&&t(c[d],p)&&(E[T++]=c[d]);continue}var g=o.match(jb);if(g){u=g[1];var _=g[2],y=g[3],M=g[4];for(u||(u="*"),c=[],l=0,d=0;d<E.length;d++)for(u=="*"?w=r(E[d]):w=E[d].getElementsByTagName(u),m=0;m<w.length;m++)c[l++]=w[m];E=[],T=0;var B;switch(y){case"=":B=function(W){return W.getAttribute(_)==M};break;case"~":B=function(W){return W.getAttribute(_).match(new RegExp("\\b"+M+"\\b"))};break;case"|":B=function(W){return W.getAttribute(_).match(new RegExp("^"+M+"-?"))};break;case"^":B=function(W){return W.getAttribute(_).indexOf(M)===0};break;case"$":B=function(W){return W.getAttribute(_).lastIndexOf(M)==W.getAttribute(_).length-M.length};break;case"*":B=function(W){return W.getAttribute(_).indexOf(M)>-1};break;default:B=function(W){return W.getAttribute(_)}}for(E=[],T=0,d=0;d<c.length;d++)B(c[d])&&(E[T++]=c[d]);continue}for(u=o,c=[],l=0,d=0;d<E.length;d++)for(w=E[d].getElementsByTagName(u),m=0;m<w.length;m++)c[l++]=w[m];E=c}return E}return function(i){return f.isElement(i)?[i]:f.isObject(i)&&!f.isUndefined(i.length)?i:n.call(this,i)}}();var $b=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],zb=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","ttclid","twclid","wbraid"];f.info={campaignParams:function(r){var e="",t={};return f.each($b,function(n){e=f.getQueryParam(ae.URL,n),e.length?t[n]=e:r!==void 0&&(t[n]=r)}),t},clickParams:function(){var r="",e={};return f.each(zb,function(t){r=f.getQueryParam(ae.URL,t),r.length&&(e[t]=r)}),e},marketingParams:function(){return f.extend(f.info.campaignParams(),f.info.clickParams())},searchEngine:function(r){return r.search("https?://(.*)google.([^/?]*)")===0?"google":r.search("https?://(.*)bing.com")===0?"bing":r.search("https?://(.*)yahoo.com")===0?"yahoo":r.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(r){var e=f.info.searchEngine(r),t=e!="yahoo"?"q":"p",n={};if(e!==null){n.$search_engine=e;var i=f.getQueryParam(r,t);i.length&&(n.mp_keyword=i)}return n},browser:function(r,e,t){return e=e||"",t||f.includes(r," OPR/")?f.includes(r,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(r)?"BlackBerry":f.includes(r,"IEMobile")||f.includes(r,"WPDesktop")?"Internet Explorer Mobile":f.includes(r,"SamsungBrowser/")?"Samsung Internet":f.includes(r,"Edge")||f.includes(r,"Edg/")?"Microsoft Edge":f.includes(r,"FBIOS")?"Facebook Mobile":f.includes(r,"Chrome")?"Chrome":f.includes(r,"CriOS")?"Chrome iOS":f.includes(r,"UCWEB")||f.includes(r,"UCBrowser")?"UC Browser":f.includes(r,"FxiOS")?"Firefox iOS":f.includes(e,"Apple")?f.includes(r,"Mobile")?"Mobile Safari":"Safari":f.includes(r,"Android")?"Android Mobile":f.includes(r,"Konqueror")?"Konqueror":f.includes(r,"Firefox")?"Firefox":f.includes(r,"MSIE")||f.includes(r,"Trident/")?"Internet Explorer":f.includes(r,"Gecko")?"Mozilla":""},browserVersion:function(r,e,t){var n=f.info.browser(r,e,t),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},s=i[n];if(s===void 0)return null;var o=r.match(s);return o?parseFloat(o[o.length-2]):null},os:function(){var r=Ut;return/Windows/i.test(r)?/Phone/.test(r)||/WPDesktop/.test(r)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(r)?"iOS":/Android/.test(r)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(r)?"BlackBerry":/Mac/i.test(r)?"Mac OS X":/Linux/.test(r)?"Linux":/CrOS/.test(r)?"Chrome OS":""},device:function(r){return/Windows Phone/i.test(r)||/WPDesktop/.test(r)?"Windows Phone":/iPad/.test(r)?"iPad":/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(r)?"BlackBerry":/Android/.test(r)?"Android":""},referringDomain:function(r){var e=r.split("/");return e.length>=3?e[2]:""},properties:function(){return f.extend(f.strip_empty_properties({$os:f.info.os(),$browser:f.info.browser(Ut,Fr.vendor,Lu),$referrer:ae.referrer,$referring_domain:f.info.referringDomain(ae.referrer),$device:f.info.device(Ut)}
7),{$current_url:_e.location.href,$browser_version:f.info.browserVersion(Ut,Fr.vendor,Lu),$screen_height:qu.height,$screen_width:qu.width,mp_lib:"web",$lib_version:tr.LIB_VERSION,$insert_id:Sf(),time:f.timestamp()/1e3})},people_properties:function(){return f.extend(f.strip_empty_properties({$os:f.info.os(),$browser:f.info.browser(Ut,Fr.vendor,Lu)}),{$browser_version:f.info.browserVersion(Ut,Fr.vendor,Lu)})},mpPageViewProperties:function(){return f.strip_empty_properties({current_page_title:ae.title,current_domain:_e.location.hostname,current_url_path:_e.location.pathname,current_url_protocol:_e.location.protocol,current_url_search:_e.location.search})}};var Sf=function(r){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return r?e.substring(0,r):e},Kb=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Gb=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,G0=function(r){var e=Gb,t=r.split("."),n=t[t.length-1];(n.length>4||n==="com"||n==="org")&&(e=Kb);var i=r.match(e);return i?i[0]:""},Bu=null,ju=null;typeof JSON<"u"&&(Bu=JSON.stringify,ju=JSON.parse);Bu=Bu||f.JSONEncode;ju=ju||f.JSONDecode;f.toArray=f.toArray;f.isObject=f.isObject;f.JSONEncode=f.JSONEncode;f.JSONDecode=f.JSONDecode;f.isBlockedUA=f.isBlockedUA;f.isEmptyObject=f.isEmptyObject;f.info=f.info;f.info.device=f.info.device;f.info.browser=f.info.browser;f.info.browserVersion=f.info.browserVersion;f.info.properties=f.info.properties;var nr=function(){};nr.prototype.create_properties=function(){};nr.prototype.event_handler=function(){};nr.prototype.after_track_handler=function(){};nr.prototype.init=function(r){return this.mp=r,this};nr.prototype.track=function(r,e,t,n){var i=this,s=f.dom_query(r);if(s.length===0){ie.error("The DOM query ("+r+") returned 0 elements");return}return f.each(s,function(o){f.register_event(o,this.override_event,function(a){var u={},c=i.create_properties(t,this),l=i.mp.get_config("track_links_timeout");i.event_handler(a,this,u),window.setTimeout(i.track_callback(n,c,u,!0),l),i.mp.track(e,c,i.track_callback(n,c,u))})},this),!0};nr.prototype.track_callback=function(r,e,t,n){n=n||!1;var i=this;return function(){t.callback_fired||(t.callback_fired=!0,!(r&&r(n,e)===!1)&&i.after_track_handler(e,t,n))}};nr.prototype.create_properties=function(r,e){var t;return typeof r=="function"?t=r(e):t=f.extend({},r),t};var Fi=function(){this.override_event="click"};f.inherit(Fi,nr);Fi.prototype.create_properties=function(r,e){var t=Fi.superclass.create_properties.apply(this,arguments);return e.href&&(t.url=e.href),t};Fi.prototype.event_handler=function(r,e,t){t.new_tab=r.which===2||r.metaKey||r.ctrlKey||e.target==="_blank",t.href=e.href,t.new_tab||r.preventDefault()};Fi.prototype.after_track_handler=function(r,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Wu=function(){this.override_event="submit"};f.inherit(Wu,nr);Wu.prototype.event_handler=function(r,e,t){t.element=e,r.preventDefault()};Wu.prototype.after_track_handler=function(r,e){setTimeout(function(){e.element.submit()},0)};var Wb=bf("lock"),X0=function(r,e){e=e||{},this.storageKey=r,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};X0.prototype.withLock=function(r,e,t){!t&&typeof e!="function"&&(t=e,e=null);var n=t||new Date().getTime()+"|"+Math.random(),i=new Date().getTime(),s=this.storageKey,o=this.pollIntervalMS,a=this.timeoutMS,u=this.storage,c=s+":X",l=s+":Y",h=s+":Z",d=function(v){e&&e(v)},m=function(v){if(new Date().getTime()-i>a){Wb.error("Timeout waiting for mutex on "+s+"; clearing lock. ["+n+"]"),u.removeItem(h),u.removeItem(l),E();return}setTimeout(function(){try{v()}catch(p){d(p)}},o*(Math.random()+.1))},w=function(v,p){v()?p():m(function(){w(v,p)})},T=function(){var v=u.getItem(l);if(v&&v!==n)return!1;if(u.setItem(l,n),u.getItem(l)===n)return!0;if(!Uu(u,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},E=function(){u.setItem(c,n),w(T,function(){if(u.getItem(c)===n){I();return}m(function(){if(u.getItem(l)!==n){E();return}w(function(){return!u.getItem(h)},I)})})},I=function(){u.setItem(h,"1");try{r()}finally{u.removeItem(h),u.getItem(l)===n&&u.removeItem(l),u.getItem(c)===n&&u.removeItem(c)}};try{if(Uu(u,!0))E();else throw new Error("localStorage support check failed")}catch(v){d(v)}};var W0=bf("batch"),Lr=function(r,e){e=e||{},this.storageKey=r,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||f.bind(W0.error,W0),this.lock=new X0(r,{storage:this.storage}),this.pid=e.pid||null,this.memQueue=[]};Lr.prototype.enqueue=function(r,e,t){var n={id:Sf(),flushAfter:new Date().getTime()+e*2,payload:r};this.lock.withLock(f.bind(function(){var s;try{var o=this.readFromStorage();o.push(n),s=this.saveToStorage(o),s&&this.memQueue.push(n)}catch{this.reportError("Error enqueueing item",r),s=!1}t&&t(s)},this),f.bind(function(s){this.reportError("Error acquiring storage lock",s),t&&t(!1)},this),this.pid)};Lr.prototype.fillBatch=function(r){var e=this.memQueue.slice(0,r);if(e.length<r){var t=this.readFromStorage();if(t.length){var n={};f.each(e,function(o){n[o.id]=!0});for(var i=0;i<t.length;i++){var s=t[i];if(new Date().getTime()>s.flushAfter&&!n[s.id]&&(s.orphaned=!0,e.push(s),e.length>=r))break}}}return e};var Q0=function(r,e){var t=[];return f.each(r,function(n){n.id&&!e[n.id]&&t.push(n)}),t};Lr.prototype.removeItemsByID=function(r,e){var t={};f.each(r,function(i){t[i]=!0}),this.memQueue=Q0(this.memQueue,t);var n=f.bind(function(){var i;try{var s=this.readFromStorage();if(s=Q0(s,t),i=this.saveToStorage(s),i){s=this.readFromStorage();for(var o=0;o<s.length;o++){var a=s[o];if(a.id&&t[a.id])return this.reportError("Item not removed from storage"),!1}}}catch{this.reportError("Error removing items",r),i=!1}return i},this);this.lock.withLock(function(){var s=n();e&&e(s)},f.bind(function(s){var o=!1;if(this.reportError("Error acquiring storage lock",s),!Uu(this.storage,!0)&&(o=n(),!o))try{this.storage.removeItem(this.storageKey)}catch(a){this.reportError("Error clearing queue",a)}e&&e(o)},this),this.pid)};var H0=function(r,e){var t=[];return f.each(r,function(n){var i=n.id;if(i in e){var s=e[i];
7s!==null&&(n.payload=s,t.push(n))}else t.push(n)}),t};Lr.prototype.updatePayloads=function(r,e){this.memQueue=H0(this.memQueue,r),this.lock.withLock(f.bind(function(){var n;try{var i=this.readFromStorage();i=H0(i,r),n=this.saveToStorage(i)}catch{this.reportError("Error updating items",r),n=!1}e&&e(n)},this),f.bind(function(n){this.reportError("Error acquiring storage lock",n),e&&e(!1)},this),this.pid)};Lr.prototype.readFromStorage=function(){var r;try{r=this.storage.getItem(this.storageKey),r&&(r=ju(r),f.isArray(r)||(this.reportError("Invalid storage entry:",r),r=null))}catch(e){this.reportError("Error retrieving queue",e),r=null}return r||[]};Lr.prototype.saveToStorage=function(r){try{return this.storage.setItem(this.storageKey,Bu(r)),!0}catch(e){return this.reportError("Error saving queue",e),!1}};Lr.prototype.clear=function(){this.memQueue=[],this.storage.removeItem(this.storageKey)};var Qb=10*60*1e3,lo=bf("batch"),jt=function(r,e){this.errorReporter=e.errorReporter,this.queue=new Lr(r,{errorReporter:f.bind(this.reportError,this),storage:e.storage}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={}};jt.prototype.enqueue=function(r,e){this.queue.enqueue(r,this.flushInterval,e)};jt.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()};jt.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)};jt.prototype.clear=function(){this.queue.clear()};jt.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size};jt.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)};jt.prototype.scheduleFlush=function(r){this.flushInterval=r,this.stopped||(this.timeoutID=setTimeout(f.bind(this.flush,this),this.flushInterval))};jt.prototype.flush=function(r){try{if(this.requestInProgress){lo.log("Flush: Request already in progress");return}r=r||{};var e=this.libConfig.batch_request_timeout_ms,t=new Date().getTime(),n=this.batchSize,i=this.queue.fillBatch(n),s=[],o={};if(f.each(i,function(c){var l=c.payload;if(this.beforeSendHook&&!c.orphaned&&(l=this.beforeSendHook(l)),l){l.event&&l.properties&&(l.properties=f.extend({},l.properties,{mp_sent_by_lib_version:tr.LIB_VERSION}));var h=!0,d=c.id;d?(this.itemIdsSentSuccessfully[d]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:c,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[d]}),h=!1):this.reportError("[dupe] found item with no ID",{item:c}),h&&s.push(l)}o[c.id]=l},this),s.length<1){this.resetFlush();return}this.requestInProgress=!0;var a=f.bind(function(c){this.requestInProgress=!1;try{var l=!1;if(r.unloading)this.queue.updatePayloads(o);else if(f.isObject(c)&&c.error==="timeout"&&new Date().getTime()-t>=e)this.reportError("Network timeout; retrying"),this.flush();else if(f.isObject(c)&&c.xhr_req&&(c.xhr_req.status>=500||c.xhr_req.status===429||c.error==="timeout")){var h=this.flushInterval*2,d=c.xhr_req.responseHeaders;if(d){var m=d["Retry-After"];m&&(h=parseInt(m,10)*1e3||h)}h=Math.min(Qb,h),this.reportError("Error; retry in "+h+" ms"),this.scheduleFlush(h)}
vendor: 4,773 bytes, line 7
7else if(f.isObject(c)&&c.xhr_req&&c.xhr_req.status===413)if(i.length>1){var w=Math.max(1,Math.floor(n/2));this.batchSize=Math.min(this.batchSize,w,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),l=!0;else l=!0;l&&(this.queue.removeItemsByID(f.map(i,function(T){return T.id}),f.bind(function(T){T?(this.consecutiveRemovalFailures=0,this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())},this)),f.each(i,f.bind(function(T){var E=T.id;E?(this.itemIdsSentSuccessfully[E]=this.itemIdsSentSuccessfully[E]||0,this.itemIdsSentSuccessfully[E]++,this.itemIdsSentSuccessfully[E]>5&&this.reportError("[dupe] item ID sent too many times",{item:T,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[E]})):this.reportError("[dupe] found item with no ID while removing",{item:T})},this)))}catch(T){this.reportError("Error handling API response",T),this.resetFlush()}},this),u={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};r.unloading&&(u.transport="sendBeacon"),lo.log("MIXPANEL REQUEST:",s),this.sendRequest(s,u,a)}catch(c){this.reportError("Error flushing request queue",c),this.resetFlush()}};jt.prototype.reportError=function(r,e){if(lo.error.apply(lo.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(r)),this.errorReporter(r,e)}catch(t){lo.error(t)}};var Hb="__mp_opt_in_out_";function Yb(r,e){tw(!0,r,e)}function Jb(r,e){tw(!1,r,e)}function Xb(r,e){return ew(r,e)==="1"}function Z0(r,e){if(eS(e))return ie.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var t=ew(r,e)==="0";return t&&ie.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),t}function Li(r){return Pf(r,function(e){return this.get_config(e)})}function qr(r){return Pf(r,function(e){return this._get_config(e)})}function qi(r){return Pf(r,function(e){return this._get_config(e)})}function Zb(r,e){e=e||{},Af(e).remove(kf(r,e),!!e.crossSubdomainCookie,e.cookieDomain)}function Af(r){return r=r||{},r.persistenceType==="localStorage"?f.localStorage:f.cookie}function kf(r,e){return e=e||{},(e.persistencePrefix||Hb)+r}function ew(r,e){return Af(e).get(kf(r,e))}function eS(r){if(r&&r.ignoreDnt)return!1;var e=r&&r.window||_e,t=e.navigator||{},n=!1;return f.each([t.doNotTrack,t.msDoNotTrack,e.doNotTrack],function(i){f.includes([!0,1,"1","yes"],i)&&(n=!0)}),n}function tw(r,e,t){if(!f.isString(e)||!e.length){ie.error("gdpr."+(r?"optIn":"optOut")+" called with an invalid token");return}t=t||{},Af(t).set(kf(e,t),r?1:0,f.isNumber(t.cookieExpiration)?t.cookieExpiration:null,!!t.crossSubdomainCookie,!!t.secureCookie,!!t.crossSiteCookie,t.cookieDomain),t.track&&r&&t.track(t.trackEventName||"$opt_in",t.trackProperties,{send_immediately:!0})}function Pf(r,e){return function(){var t=!1;try{var n=e.call(this,"token"),i=e.call(this,"ignore_dnt"),s=e.call(this,"opt_out_tracking_persistence_type"),o=e.call(this,"opt_out_tracking_cookie_prefix"),a=e.call(this,"window");n&&(t=Z0(n,{ignoreDnt:i,persistenceType:s,persistencePrefix:o,window:a}))}catch(c){ie.error("Unexpected error when checking tracking opt-out status: "+c)}if(!t)return r.apply(this,arguments);var u=arguments[arguments.length-1];typeof u=="function"&&u(0)}}var Mr="$set",Mi="$set_once",Tt="$unset",kn="$add",Bt="$append",Pn="$union",rr="$remove",tS="$delete",rw={set_action:function(r,e){var t={},n={};return f.isObject(r)?f.each(r,function(i,s){this._is_reserved_property(s)||(n[s]=i)},this):n[r]=e,t[Mr]=n,t},unset_action:function(r){var e={},t=[];return f.isArray(r)||(r=[r]),f.each(r,function(n){this._is_reserved_property(n)||t.push(n)},this),e[Tt]=t,e},set_once_action:function(r,e){var t={},n={};return f.isObject(r)?f.each(r,function(i,s){this._is_reserved_property(s)||(n[s]=i)},this):n[r]=e,t[Mi]=n,t},union_action:function(r,e){var t={},n={};return f.isObject(r)?f.each(r,function(i,s){this._is_reserved_property(s)||(n[s]=f.isArray(i)?i:[i])},this):n[r]=f.isArray(e)?e:[e],t[Pn]=n,t},append_action:function(r,e){var t={},n={};return f.isObject(r)?f.each(r,function(i,s){this._is_reserved_property(s)||(n[s]=i)},this):n[r]=e,t[Bt]=n,t},remove_action:function(r,e){var t={},n={};return f.isObject(r)?f.each(r,function(i,s){this._is_reserved_property(s)||(n[s]=i)},this):n[r]=e,t[rr]=n,t},delete_action:function(){var r={};return r[tS]="",r}},he=function(){};
vendor: 33,817 bytes, line 7
7f.extend(he.prototype,rw);he.prototype._init=function(r,e,t){this._mixpanel=r,this._group_key=e,this._group_id=t};he.prototype.set=qi(function(r,e,t){var n=this.set_action(r,e);return f.isObject(r)&&(t=e),this._send_request(n,t)});he.prototype.set_once=qi(function(r,e,t){var n=this.set_once_action(r,e);return f.isObject(r)&&(t=e),this._send_request(n,t)});he.prototype.unset=qi(function(r,e){var t=this.unset_action(r);return this._send_request(t,e)});he.prototype.union=qi(function(r,e,t){f.isObject(r)&&(t=e);var n=this.union_action(r,e);return this._send_request(n,t)});he.prototype.delete=qi(function(r){var e=this.delete_action();return this._send_request(e,r)});he.prototype.remove=qi(function(r,e,t){var n=this.remove_action(r,e);return this._send_request(n,t)});he.prototype._send_request=function(r,e){r.$group_key=this._group_key,r.$group_id=this._group_id,r.$token=this._get_config("token");var t=f.encodeDates(r);return this._mixpanel._track_or_batch({type:"groups",data:t,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)};he.prototype._is_reserved_property=function(r){return r==="$group_key"||r==="$group_id"};he.prototype._get_config=function(r){return this._mixpanel.get_config(r)};he.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id};he.prototype.remove=he.prototype.remove;he.prototype.set=he.prototype.set;he.prototype.set_once=he.prototype.set_once;he.prototype.union=he.prototype.union;he.prototype.unset=he.prototype.unset;he.prototype.toString=he.prototype.toString;var G=function(){};f.extend(G.prototype,rw);G.prototype._init=function(r){this._mixpanel=r};G.prototype.set=qr(function(r,e,t){var n=this.set_action(r,e);return f.isObject(r)&&(t=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),n[Mr]=f.extend({},f.info.people_properties(),this._mixpanel.persistence.get_referrer_info(),n[Mr]),this._send_request(n,t)});G.prototype.set_once=qr(function(r,e,t){var n=this.set_once_action(r,e);return f.isObject(r)&&(t=e),this._send_request(n,t)});G.prototype.unset=qr(function(r,e){var t=this.unset_action(r);return this._send_request(t,e)});G.prototype.increment=qr(function(r,e,t){var n={},i={};return f.isObject(r)?(f.each(r,function(s,o){if(!this._is_reserved_property(o))if(isNaN(parseFloat(s))){ie.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[o]=s},this),t=e):(f.isUndefined(e)&&(e=1),i[r]=e),n[kn]=i,this._send_request(n,t)});G.prototype.append=qr(function(r,e,t){f.isObject(r)&&(t=e);var n=this.append_action(r,e);return this._send_request(n,t)});G.prototype.remove=qr(function(r,e,t){f.isObject(r)&&(t=e);var n=this.remove_action(r,e);return this._send_request(n,t)});G.prototype.union=qr(function(r,e,t){f.isObject(r)&&(t=e);var n=this.union_action(r,e);return this._send_request(n,t)});G.prototype.track_charge=qr(function(r,e,t){if(!f.isNumber(r)&&(r=parseFloat(r),isNaN(r))){ie.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",f.extend({$amount:r},e),t)});G.prototype.clear_charges=function(r){return this.set("$transactions",[],r)};G.prototype.delete_user=function(){if(!this._identify_called()){ie.error("mixpanel.people.delete_user() requires you to call identify() first");return}var r={$delete:this._mixpanel.get_distinct_id()};return this._send_request(r)};G.prototype.toString=function(){return this._mixpanel.toString()+".people"};G.prototype._send_request=function(r,e){r.$token=this._get_config("token"),r.$distinct_id=this._mixpanel.get_distinct_id();var t=this._mixpanel.get_property("$device_id"),n=this._mixpanel.get_property("$user_id"),i=this._mixpanel.get_property("$had_persisted_distinct_id");t&&(r.$device_id=t),n&&(r.$user_id=n),i&&(r.$had_persisted_distinct_id=i);var s=f.encodeDates(r);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:s,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(r),f.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),f.truncate(s,255))};G.prototype._get_config=function(r){return this._mixpanel.get_config(r)};G.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0};G.prototype._enqueue=function(r){Mr in r?this._mixpanel.persistence._add_to_people_queue(Mr,r):Mi in r?this._mixpanel.persistence._add_to_people_queue(Mi,r):Tt in r?this._mixpanel.persistence._add_to_people_queue(Tt,r):kn in r?this._mixpanel.persistence._add_to_people_queue(kn,r):Bt in r?this._mixpanel.persistence._add_to_people_queue(Bt,r):rr in r?this._mixpanel.persistence._add_to_people_queue(rr,r):Pn in r?this._mixpanel.persistence._add_to_people_queue(Pn,r):ie.error("Invalid call to _enqueue():",r)};G.prototype._flush_one_queue=function(r,e,t,n){var i=this,s=f.extend({},this._mixpanel.persistence.load_queue(r)),o=s;!f.isUndefined(s)&&f.isObject(s)&&!f.isEmptyObject(s)&&(i._mixpanel.persistence._pop_from_people_queue(r,s),i._mixpanel.persistence.save(),n&&(o=n(s)),e.call(i,o,function(a,u){a===0&&i._mixpanel.persistence._add_to_people_queue(r,s),f.isUndefined(t)||t(a,u)}))};G.prototype._flush=function(r,e,t,n,i,s,o){var a=this;this._flush_one_queue(Mr,this.set,r),this._flush_one_queue(Mi,this.set_once,n),this._flush_one_queue(Tt,this.unset,s,function(E){return f.keys(E)}),this._flush_one_queue(kn,this.increment,e),this._flush_one_queue(Pn,this.union,i);var u=this._mixpanel.persistence.load_queue(Bt);if(!f.isUndefined(u)&&f.isArray(u)&&u.length)for(var c,l=function(E,I){E===0&&a._mixpanel.persistence._add_to_people_queue(Bt,c),f.isUndefined(t)||t(E,I)},h=u.length-1;h>=0;h--)u=this._mixpanel.persistence.load_queue(Bt),c=u.pop(),a._mixpanel.persistence.save(),f.isEmptyObject(c)||a.append(c,l);var d=this._mixpanel.persistence.load_queue(rr);if(!f.isUndefined(d)&&f.isArray(d)&&d.length)for(var m,w=function(E,I){E===0&&a._mixpanel.persistence._add_to_people_queue(rr,m),f.isUndefined(o)||o(E,I)},T=d.length-1;T>=0;T--)d=this._mixpanel.persistence.load_queue(rr),m=d.pop(),a._mixpanel.persistence.save(),f.isEmptyObject(m)||a.remove(m,w)};G.prototype._is_reserved_property=function(r){return r==="$distinct_id"||r==="$token"||r==="$device_id"||r==="$user_id"||r==="$had_persisted_distinct_id"};G.prototype.set=G.prototype.set;G.prototype.set_once=G.prototype.set_once;G.prototype.unset=G.prototype.unset;G.prototype.increment=G.prototype.increment;G.prototype.append=G.prototype.append;G.prototype.remove=G.prototype.remove;G.prototype.union=G.prototype.union;G.prototype.track_charge=G.prototype.track_charge;G.prototype.clear_charges=G.prototype.clear_charges;G.prototype.delete_user=G.prototype.delete_user;G.prototype.toString=G.prototype.toString;var Cf="__mps",xf="__mpso",Rf="__mpus",Df="__mpa",Nf="__mpap",Vf="__mpr",Of="__mpu",nw="$people_distinct_id",$u="__alias",ho="__timers",rS=[Cf,xf,Rf,Df,Nf,Vf,Of,nw,$u,ho],H=function(r){this.props={},this.campaign_params_saved=!1,r.persistence_name?this.name="mp_"+r.persistence_name:this.name="mp_"+r.token+"_mixpanel";var e=r.persistence;e!=="cookie"&&e!=="localStorage"&&(ie.critical("Unknown persistence type "+e+"; falling back to cookie"),e=r.persistence="cookie"),e==="localStorage"&&f.localStorage.is_supported()?this.storage=f.localStorage:this.storage=f.cookie,this.load(),this.update_config(r),this.upgrade(r),this.save()};H.prototype.properties=function(){var r={};return this.load(),f.each(this.props,function(e,t){f.include(rS,t)||(r[t]=e)}),r};H.prototype.load=function(){if(!this.disabled){var r=this.storage.parse(this.name);r&&(this.props=f.extend({},r))}};H.prototype.upgrade=function(r){var e=r.upgrade,t,n;e&&(t="mp_super_properties",typeof e=="string"&&(t=e),n=this.storage.parse(t),this.storage.remove(t),this.storage.remove(t,!0),n&&(this.props=f.extend(this.props,n.all,n.events))),!r.cookie_name&&r.name!=="mixpanel"&&(t="mp_"+r.token+"_"+r.name,n=this.storage.parse(t),n&&(this.storage.remove(t),this.storage.remove(t,!0),this.register_once(n))),this.storage===f.localStorage&&(n=f.cookie.parse(this.name),f.cookie.remove(this.name),f.cookie.remove(this.name,!0),n&&this.register_once(n))};H.prototype.save=function(){this.disabled||this.storage.set(this.name,f.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)};H.prototype.load_prop=function(r){return this.load(),this.props[r]};H.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)};H.prototype.clear=function(){this.remove(),this.props={}};H.prototype.register_once=function(r,e,t){return f.isObject(r)?(typeof e>"u"&&(e="None"),this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),f.each(r,function(n,i){(!this.props.hasOwnProperty(i)||this.props[i]===e)&&(this.props[i]=n)},this),this.save(),!0):!1};H.prototype.register=function(r,e){return f.isObject(r)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),f.extend(this.props,r),this.save(),!0):!1};H.prototype.unregister=function(r){this.load(),r in this.props&&(delete this.props[r],this.save())};H.prototype.update_search_keyword=function(r){this.register(f.info.searchInfo(r))};H.prototype.update_referrer_info=function(r){this.register_once({$initial_referrer:r||"$direct",$initial_referring_domain:f.info.referringDomain(r)||"$direct"},"")};H.prototype.get_referrer_info=function(){return f.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})};H.prototype.update_config=function(r){this.default_expiry=this.expire_days=r.cookie_expiration,this.set_disabled(r.disable_persistence),this.set_cookie_domain(r.cookie_domain),this.set_cross_site(r.cross_site_cookie),this.set_cross_subdomain(r.cross_subdomain_cookie),this.set_secure(r.secure_cookie)};H.prototype.set_disabled=function(r){this.disabled=r,this.disabled?this.remove():this.save()};H.prototype.set_cookie_domain=function(r){r!==this.cookie_domain&&(this.remove(),this.cookie_domain=r,this.save())};H.prototype.set_cross_site=function(r){r!==this.cross_site&&(this.cross_site=r,this.remove(),this.save())};H.prototype.set_cross_subdomain=function(r){r!==this.cross_subdomain&&(this.cross_subdomain=r,this.remove(),this.save())};H.prototype.get_cross_subdomain=function(){return this.cross_subdomain};H.prototype.set_secure=function(r){r!==this.secure&&(this.secure=!!r,this.remove(),this.save())};H.prototype._add_to_people_queue=function(r,e){var t=this._get_queue_key(r),n=e[r],i=this._get_or_create_queue(Mr),s=this._get_or_create_queue(Mi),o=this._get_or_create_queue(Tt),a=this._get_or_create_queue(kn),u=this._get_or_create_queue(Pn),c=this._get_or_create_queue(rr,[]),l=this._get_or_create_queue(Bt,[]);t===Cf?(f.extend(i,n),this._pop_from_people_queue(kn,n),this._pop_from_people_queue(Pn,n),this._pop_from_people_queue(Tt,n)):t===xf?(f.each(n,function(h,d){d in s||(s[d]=h)}),this._pop_from_people_queue(Tt,n)):t===Rf?f.each(n,function(h){f.each([i,s,a,u],function(d){h in d&&delete d[h]}),f.each(l,function(d){h in d&&delete d[h]}),o[h]=!0}):t===Df?(f.each(n,function(h,d){d in i?i[d]+=h:(d in a||(a[d]=0),a[d]+=h)},this),this._pop_from_people_queue(Tt,n)):t===Of?(f.each(n,function(h,d){f.isArray(h)&&(d in u||(u[d]=[]),u[d]=u[d].concat(h))}),this._pop_from_people_queue(Tt,n)):t===Vf?(c.push(n),this._pop_from_people_queue(Bt,n)):t===Nf&&(l.push(n),this._pop_from_people_queue(Tt,n)),ie.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),ie.log(e),this.save()};H.prototype._pop_from_people_queue=function(r,e){var t=this.props[this._get_queue_key(r)];f.isUndefined(t)||f.each(e,function(n,i){r===Bt||r===rr?f.each(t,function(s){s[i]===n&&delete s[i]}):delete t[i]},this)};H.prototype.load_queue=function(r){return this.load_prop(this._get_queue_key(r))};H.prototype._get_queue_key=function(r){if(r===Mr)return Cf;if(r===Mi)return xf;if(r===Tt)return Rf;if(r===kn)return Df;if(r===Bt)return Nf;if(r===rr)return Vf;if(r===Pn)return Of;ie.error("Invalid queue:",r)};H.prototype._get_or_create_queue=function(r,e){var t=this._get_queue_key(r);return e=f.isUndefined(e)?{}:e,this.props[t]||(this.props[t]=e)};H.prototype.set_event_timer=function(r,e){var t=this.load_prop(ho)||{};t[r]=e,this.props[ho]=t,this.save()};H.prototype.remove_event_timer=function(r){var e=this.load_prop(ho)||{},t=e[r];return f.isUndefined(t)||(delete this.props[ho][r],this.save()),t};var Ff,Ge,iw=0,nS=1,iS=function(r){return r},fo=function(){},ft="mixpanel",sw="base64",sS="json",Mf="$device:",Oi=_e.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,ow=!Oi&&Ut.indexOf("MSIE")===-1&&Ut.indexOf("Mozilla")===-1,zu=null;Fr.sendBeacon&&(zu=function(){return Fr.sendBeacon.apply(Fr,arguments)});var aw={track:"track/",engage:"engage/",groups:"groups/"},Y0={api_host:"https://api-js.mixpanel.com",api_routes:aw,api_method:"POST",api_transport:"XHR",api_payload_format:sw,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:fo,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:fo,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{}},uw=!1,k=function(){},Tf=function(r,e,t){var n,i=t===ft?Ge:Ge[t];if(i&&Ff===iw)n=i;else{if(i&&!f.isArray(i)){ie.error("You have already initialized "+t);return}n=new k}if(n._cached_groups={},n._init(r,e,t),n.people=new G,n.people._init(n),!n.get_config("skip_first_touch_marketing")){var s=f.info.campaignParams(null),o={},a=!1;f.each(s,function(u,c){o["initial_"+c]=u,u&&(a=!0)}),a&&n.people.set_once(o)}return tr.DEBUG=tr.DEBUG||n.get_config("debug"),!f.isUndefined(i)&&f.isArray(i)&&(n._execute_array.call(n.people,i.people),n._execute_array(i)),n};k.prototype.init=function(r,e,t){if(f.isUndefined(t)){this.report_error("You must name your new library: init(token, config, name)");return}if(t===ft){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var n=Tf(r,e,t);return Ge[t]=n,n._loaded(),n};k.prototype._init=function(r,e,t){e=e||{},this.__loaded=!0,this.config={};var n={};if(!("api_payload_format"in e)){var i=e.api_host||Y0.api_host;i.match(/\.mixpanel\.com/)&&(n.api_payload_format=sS)}if(this.set_config(f.extend({},Y0,n,e,{name:t,token:r,callback_fn:(t===ft?t:ft+"."+t)+"._jsc"})),this._jsc=fo,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!f.localStorage.is_supported(!0)||!Oi)this._batch_requests=!1,ie.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),f.each(this.get_batcher_configs(),function(a){ie.log("Clearing batch queue "+a.queue_key),f.localStorage.remove(a.queue_key)});else if(this.init_batchers(),zu&&_e.addEventListener){var s=f.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);_e.addEventListener("pagehide",function(a){a.persisted&&s()}),_e.addEventListener("visibilitychange",function(){ae.visibilityState==="hidden"&&s()})}}this.persistence=this.cookie=new H(this.config),this.unpersisted_superprops={},this._gdpr_init();var o=f.UUID();this.get_distinct_id()||this.register_once({distinct_id:Mf+o,$device_id:o},""),this.get_config("track_pageview")&&this.track_pageview()};k.prototype._loaded=function(){this.get_config("loaded")(this),this._set_default_superprops()};k.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(ae.referrer),this.get_config("store_google")&&this.register(f.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(ae.referrer)};k.prototype._dom_loaded=function(){f.each(this.__dom_loaded_queue,function(r){this._track_dom.apply(this,r)},this),this.has_opted_out_tracking()||f.each(this.__request_queue,function(r){this._send_request.apply(this,r)},this),delete this.__dom_loaded_queue,delete this.__request_queue};k.prototype._track_dom=function(r,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!uw)return this.__dom_loaded_queue.push([r,e]),!1;var t=new r().init(this);return t.track.apply(t,e)};k.prototype._prepare_callback=function(r,e){if(f.isUndefined(r))return null;if(Oi){var t=function(o){r(o,e)};return t}else{var n=this._jsc,i=""+Math.floor(Math.random()*1e8),s=this.get_config("callback_fn")+"["+i+"]";return n[i]=function(o){delete n[i],r(o,e)},s}};k.prototype._send_request=function(r,e,t,n){var i=!0;if(ow)return this.__request_queue.push(arguments),i;var s={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},o=null;!n&&(f.isFunction(t)||typeof t=="string")&&(n=t,t=null),t=f.extend(s,t||{}),Oi||(t.method="GET");var a=t.method==="POST",u=zu&&a&&t.transport.toLowerCase()==="sendbeacon",c=t.verbose;e.verbose&&(c=!0),this.get_config("test")&&(e.test=1),c&&(e.verbose=1),this.get_config("img")&&(e.img=1),Oi||(n?e.callback=n:(c||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),a&&(o="data="+encodeURIComponent(e.data),delete e.data),r+="?"+f.HTTPBuildQuery(e);var l=this;if("img"in e){var h=ae.createElement("img");h.src=r,ae.body.appendChild(h)}else if(u){try{i=zu(r,o)}catch(I){l.report_error(I),i=!1}try{n&&n(i?1:0)}catch(I){l.report_error(I)}}else if(Oi)try{var d=new XMLHttpRequest;d.open(t.method,r,!0);var m=this.get_config("xhr_headers");if(a&&(m["Content-Type"]="application/x-www-form-urlencoded"),f.each(m,function(I,v){d.setRequestHeader(v,I)}),t.timeout_ms&&typeof d.timeout<"u"){d.timeout=t.timeout_ms;var w=new Date().getTime()}d.withCredentials=!0,d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200){if(n)if(c){var I;try{I=f.JSONDecode(d.responseText)}catch(p){if(l.report_error(p),t.ignore_json_errors)I=d.responseText;else return}n(I)}else n(Number(d.responseText))}else{var v;d.timeout&&!d.status&&new Date().getTime()-w>=d.timeout?v="timeout":v="Bad HTTP status: "+d.status+" "+d.statusText,l.report_error(v),n&&n(c?{status:0,error:v,xhr_req:d}:0)}},d.send(o)}catch(I){l.report_error(I),i=!1}else{var T=ae.createElement("script");T.type="text/javascript",T.async=!0,T.defer=!0,T.src=r;var E=ae.getElementsByTagName("script")[0];E.parentNode.insertBefore(T,E)}return i};k.prototype._execute_array=function(r){var e,t=[],n=[],i=[];f.each(r,function(o){o&&(e=o[0],f.isArray(e)?i.push(o):typeof o=="function"?o.call(this):f.isArray(o)&&e==="alias"?t.push(o):f.isArray(o)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?i.push(o):n.push(o))},this);var s=function(o,a){f.each(o,function(u){if(f.isArray(u[0])){var c=a;f.each(u,function(l){c=c[l[0]].apply(c,l.slice(1))})}else this[u[0]].apply(this,u.slice(1))},a)};s(t,this),s(n,this),s(i,this)};k.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events};k.prototype.get_batcher_configs=function(){var r="__mpq_"+this.get_config("token"),e=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+e.track,queue_key:r+"_ev"},people:{type:"people",endpoint:"/"+e.engage,queue_key:r+"_pp"},groups:{type:"groups",endpoint:"/"+e.groups,queue_key:r+"_gr"}},this._batcher_configs};k.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var r=f.bind(function(t){return new jt(t.queue_key,{libConfig:this.config,sendRequestFunc:f.bind(function(n,i,s){this._send_request(this.get_config("api_host")+t.endpoint,this._encode_data_for_request(n),i,this._prepare_callback(s,n))},this),beforeSendHook:f.bind(function(n){return this._run_hook("before_send_"+t.type,n)},this),errorReporter:this.get_config("error_reporter"),stopAllBatchingFunc:f.bind(this.stop_batch_senders,this)})},this),e=this.get_batcher_configs();this.request_batchers={events:r(e.events),people:r(e.people),groups:r(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()};k.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,f.each(this.request_batchers,function(r){r.start()}))};k.prototype.stop_batch_senders=function(){this._batch_requests=!1,f.each(this.request_batchers,function(r){r.stop(),r.clear()})};k.prototype.push=function(r){this._execute_array([r])};k.prototype.disable=function(r){typeof r>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(r)};k.prototype._encode_data_for_request=function(r){var e=f.JSONEncode(r);return this.get_config("api_payload_format")===sw&&(e=f.base64Encode(e)),{data:e}};k.prototype._track_or_batch=function(r,e){var t=f.truncate(r.data,255),n=r.endpoint,i=r.batcher,s=r.should_send_immediately,o=r.send_request_options||{};e=e||fo;var a=!0,u=f.bind(function(){return o.skip_hooks||(t=this._run_hook("before_send_"+r.type,t)),t?(ie.log("MIXPANEL REQUEST:"),ie.log(t),this._send_request(n,this._encode_data_for_request(t),o,this._prepare_callback(e,t))):null},this);return this._batch_requests&&!s?i.enqueue(t,function(c){c?e(1,t):u()}):a=u(),a&&t};k.prototype.track=Li(function(r,e,t,n){!n&&typeof t=="function"&&(n=t,t=null),t=t||{};var i=t.transport;i&&(t.transport=i);var s=t.send_immediately;if(typeof n!="function"&&(n=fo),f.isUndefined(r)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(r)){n(0);return}e=f.extend({},e),e.token=this.get_config("token");var o=this.persistence.remove_event_timer(r);if(!f.isUndefined(o)){var a=new Date().getTime()-o;e.$duration=parseFloat((a/1e3).toFixed(3))}this._set_default_superprops();var u=this.get_config("track_marketing")?f.info.marketingParams():{};e=f.extend({},f.info.properties(),u,this.persistence.properties(),this.unpersisted_superprops,e);var c=this.get_config("property_blacklist");f.isArray(c)?f.each(c,function(d){delete e[d]}):this.report_error("Invalid value for property_blacklist config: "+c);var l={event:r,properties:e},h=this._track_or_batch({type:"events",data:l,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:s,send_request_options:t},n);return h});k.prototype.set_group=Li(function(r,e,t){f.isArray(e)||(e=[e]);var n={};return n[r]=e,this.register(n),this.people.set(r,e,t)});k.prototype.add_group=Li(function(r,e,t){var n=this.get_property(r),i={};return n===void 0?(i[r]=[e],this.register(i)):n.indexOf(e)===-1&&(n.push(e),i[r]=n,this.register(i)),this.people.union(r,e,t)});k.prototype.remove_group=Li(function(r,e,t){var n=this.get_property(r);if(n!==void 0){var i=n.indexOf(e);i>-1&&(n.splice(i,1),this.register({group_key:n})),n.length===0&&this.unregister(r)}return this.people.remove(r,e,t)});k.prototype.track_with_groups=Li(function(r,e,t,n){var i=f.extend({},e||{});return f.each(t,function(s,o){s!=null&&(i[o]=s)}),this.track(r,i,n)});k.prototype._create_map_key=function(r,e){return r+"_"+JSON.stringify(e)};k.prototype._remove_group_from_cache=function(r,e){delete this._cached_groups[this._create_map_key(r,e)]};k.prototype.get_group=function(r,e){var t=this._create_map_key(r,e),n=this._cached_groups[t];return(n===void 0||n._group_key!==r||n._group_id!==e)&&(n=new he,n._init(this,r,e),this._cached_groups[t]=n),n};k.prototype.track_pageview=Li(function(r,e){typeof r!="object"&&(r={}),e=e||{};var t=e.event_name||"$mp_web_page_view",n=f.extend(f.info.mpPageViewProperties(),f.info.campaignParams(),f.info.clickParams()),i=f.extend({},n,r);return this.track(t,i)});k.prototype.track_links=function(){return this._track_dom.call(this,Fi,arguments)};k.prototype.track_forms=function(){return this._track_dom.call(this,Wu,arguments)};k.prototype.time_event=function(r){if(f.isUndefined(r)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(r)||this.persistence.set_event_timer(r,new Date().getTime())};var oS={persistent:!0},Lf=function(r){var e;return f.isObject(r)?e=r:f.isUndefined(r)?e={}:e={days:r},f.extend({},oS,e)};k.prototype.register=function(r,e){var t=Lf(e);t.persistent?this.persistence.register(r,t.days):f.extend(this.unpersisted_superprops,r)};k.prototype.register_once=function(r,e,t){var n=Lf(t);n.persistent?this.persistence.register_once(r,e,n.days):(typeof e>"u"&&(e="None"),f.each(r,function(i,s){(!this.unpersisted_superprops.hasOwnProperty(s)||this.unpersisted_superprops[s]===e)&&(this.unpersisted_superprops[s]=i)},this))};k.prototype.unregister=function(r,e){e=Lf(e),e.persistent?this.persistence.unregister(r):delete this.unpersisted_superprops[r]};k.prototype._register_single=function(r,e){var t={};t[r]=e,this.register(t)};k.prototype.identify=function(r,e,t,n,i,s,o,a){var u=this.get_distinct_id();if(r&&u!==r){if(typeof r=="string"&&r.indexOf(Mf)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:r})}if(!this.get_property("$device_id")){var c=u;this.register_once({$had_persisted_distinct_id:!0,$device_id:c},"")}r!==u&&r!==this.get_property($u)&&(this.unregister($u),this.register({distinct_id:r})),this._flags.identify_called=!0,this.people._flush(e,t,n,i,s,o,a),r!==u&&this.track("$identify",{distinct_id:r,$anon_distinct_id:u},{skip_hooks:!0})};k.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var r=f.UUID();this.register_once({distinct_id:Mf+r,$device_id:r},"")};k.prototype.get_distinct_id=function(){return this.get_property("distinct_id")};k.prototype.alias=function(r,e){if(r===this.get_property(nw))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var t=this;return f.isUndefined(e)&&(e=this.get_distinct_id()),r!==e?(this._register_single($u,r),this.track("$create_alias",{alias:r,distinct_id:e},{skip_hooks:!0},function(){t.identify(r)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(r),-1)};k.prototype.name_tag=function(r){this._register_single("mp_name_tag",r)};k.prototype.set_config=function(r){if(f.isObject(r)){f.extend(this.config,r);var e=r.batch_size;e&&f.each(this.request_batchers,function(t){t.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),tr.DEBUG=tr.DEBUG||this.get_config("debug")}};k.prototype.get_config=function(r){return this.config[r]};k.prototype._run_hook=function(r){var e=(this.config.hooks[r]||iS).apply(this,Or.call(arguments,1));return typeof e>"u"&&(this.report_error(r+" hook did not return a value"),e=null),e};k.prototype.get_property=function(r){return this.persistence.load_prop([r])};k.prototype.toString=function(){var r=this.get_config("name");return r!==ft&&(r=ft+"."+r),r};k.prototype._event_is_disabled=function(r){return f.isBlockedUA(Ut)||this._flags.disable_all_events||f.include(this.__disabled_events,r)};k.prototype._gdpr_init=function(){var r=this.get_config("opt_out_tracking_persistence_type")==="localStorage";r&&f.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||f.cookie.get("mp_optout"))&&(f.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))};k.prototype._gdpr_update_persistence=function(r){var e;if(r&&r.clear_persistence)e=!0;else if(r&&r.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()};k.prototype._gdpr_call_func=function(r,e){return e=f.extend({track:f.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),f.localStorage.is_supported()||(e.persistence_type="cookie"),r(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})};k.prototype.opt_in_tracking=function(r){r=f.extend({enable_persistence:!0},r),this._gdpr_call_func(Yb,r),this._gdpr_update_persistence(r)};k.prototype.opt_out_tracking=function(r){r=f.extend({clear_persistence:!0,delete_user:!0},r),r.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(Jb,r),this._gdpr_update_persistence(r)};k.prototype.has_opted_in_tracking=function(r){return this._gdpr_call_func(Xb,r)};k.prototype.has_opted_out_tracking=function(r){return this._gdpr_call_func(Z0,r)};k.prototype.clear_opt_in_out_tracking=function(r){r=f.extend({enable_persistence:!0},r),this._gdpr_call_func(Zb,r),this._gdpr_update_persistence(r)};k.prototype.report_error=function(r,e){ie.error.apply(ie.error,arguments);try{!e&&!(r instanceof Error)&&(r=new Error(r)),this.get_config("error_reporter")(r,e)}catch(t){ie.error(t)}};k.prototype.init=k.prototype.init;k.prototype.reset=k.prototype.reset;k.prototype.disable=k.prototype.disable;k.prototype.time_event=k.prototype.time_event;k.prototype.track=k.prototype.track;k.prototype.track_links=k.prototype.track_links;k.prototype.track_forms=k.prototype.track_forms;k.prototype.track_pageview=k.prototype.track_pageview;k.prototype.register=k.prototype.register;k.prototype.register_once=k.prototype.register_once;k.prototype.unregister=k.prototype.unregister;k.prototype.identify=k.prototype.identify;k.prototype.alias=k.prototype.alias;k.prototype.name_tag=k.prototype.name_tag;k.prototype.set_config=k.prototype.set_config;k.prototype.get_config=k.prototype.get_config;k.prototype.get_property=k.prototype.get_property;k.prototype.get_distinct_id=k.prototype.get_distinct_id;k.prototype.toString=k.prototype.toString;k.prototype.opt_out_tracking=k.prototype.opt_out_tracking;k.prototype.opt_in_tracking=k.prototype.opt_in_tracking;k.prototype.has_opted_out_tracking=k.prototype.has_opted_out_tracking;k.prototype.has_opted_in_tracking=k.prototype.has_opted_in_tracking;k.prototype.clear_opt_in_out_tracking=k.prototype.clear_opt_in_out_tracking;k.prototype.get_group=k.prototype.get_group;k.prototype.set_group=k.prototype.set_group;k.prototype.add_group=k.prototype.add_group;k.prototype.remove_group=k.prototype.remove_group;k.prototype.track_with_groups=k.prototype.track_with_groups;k.prototype.start_batch_senders=k.prototype.start_batch_senders;k.prototype.stop_batch_senders=k.prototype.stop_batch_senders;k.prototype.DEFAULT_API_ROUTES=aw;H.prototype.properties=H.prototype.properties;H.prototype.update_search_keyword=H.prototype.update_search_keyword;H.prototype.update_referrer_info=H.prototype.update_referrer_info;H.prototype.get_cross_subdomain=H.prototype.get_cross_subdomain;H.prototype.clear=H.prototype.clear;var Vi={},aS=function(){f.each(Vi,function(r,e){e!==ft&&(Ge[e]=r)}),Ge._=f},uS=function(){Ge.init=function(r,e,t){if(t)return Ge[t]||(Ge[t]=Vi[t]=Tf(r,e,t),Ge[t]._loaded()),Ge[t];var n=Ge;Vi[ft]?n=Vi[ft]:r&&(n=Tf(r,e,ft),n._loaded(),Vi[ft]=n),Ge=n,Ff===nS&&(_e[ft]=Ge),aS()}},cS=function(){function r(){r.done||(r.done=!0,uw=!0,ow=!1,f.each(Vi,function(n){n._dom_loaded()}))}function e(){try{ae.documentElement.doScroll("left")}catch{setTimeout(e,1);return}r()}if(ae.addEventListener)ae.readyState==="complete"?r():ae.addEventListener("DOMContentLoaded",r,!1);else if(ae.attachEvent){ae.attachEvent("onreadystatechange",r);var t=!1;try{t=_e.frameElement===null}catch{}ae.documentElement.doScroll&&t&&e()}f.register_event(_e,"load",r,!0)};function lS(){return Ff=iw,Ge=new k,uS(),Ge.init(),cS(),Ge}var hS=lS();cw.exports=hS});var Iw=(()=>{let e=class e{constructor(n){this.api=n}getRecord(n){let i="record/"+n;return isNaN(parseInt(n,10))&&(i="record?code="+n),this.api.get(i,null,
7null,"v3").pipe(pe(s=>s.success?Z(s.data):De(s)),Me())}getRecords(n){return new Promise(s=>{!n&&this.records?s(this.records):this.api.get("records/top",null,null,"v3").subscribe(o=>{this.records=o.data,s(this.records)},o=>{console.log("error en consulta",o),this.records=[],s(this.records)})})}getSiteMapRecords(){return this.api.get("record/list").pipe(se(n=>n.data))}};e.\u0275fac=function(i){return new(i||e)(P(zt))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var ye=(()=>{let e=class e{constructor(n){this.platformId=n,this.distinct_id=new xn}isBrowser(){return sp(this.platformId)}isServer(){return On(this.platformId)}};e.\u0275fac=function(i){return new(i||e)(P(sr))},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Lp=(()=>{let e=class e{constructor(n,i,s,o){this.injector=n,this.platform=i,this.request=s,this.response=o,this.cookies={},this.documentIsAccessible=this.platform.isBrowser()||this.platform.isServer(),this.platform.isServer()?this.document={cookie:this.request.headers.cookie||""}:this.platform.isBrowser()&&(this.document=this.injector.get(Eo)),this.documentIsAccessible&&(this.cookies=this.getAll())}check(n){return this.documentIsAccessible?(n=encodeURIComponent(n),this.getCookieRegExp(n).test(this.document.cookie)):!1}get(n){if(this.documentIsAccessible&&this.check(n)){n=encodeURIComponent(n);let s=this.getCookieRegExp(n).exec(this.document.cookie);return s?decodeURIComponent(s[1]):""}else return""}getAll(){if(!this.documentIsAccessible)return{};let n={},i=this.document;if(i.cookie&&i.cookie!==""){let s=i.cookie.split(";");for(let o of s){let a=o.split("=");a[0]=a[0].replace(/^ /,""),n[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}}return n}set(n,i,s,o,a,u,c){if(!this.documentIsAccessible)return;let l=encodeURIComponent(n)+"="+encodeURIComponent(i)+";";if(s)if(typeof s=="number"){let h=new Date(new Date().getTime()+s*1e3*60*60*24);l+="expires="+h.toUTCString()+";"}else l+="expires="+s.toUTCString()+";";if(o&&(l+="path="+o+";"),a&&(l+="domain="+a+";"),u&&(l+="secure;"),c&&(l+="sameSite="+c+";"),this.cookies[n]=i,this.platform.isBrowser())this.document.cookie=l;else if(this.platform.isServer()){let h=new RegExp(`${n}[=].{1,}?([;]|$)`);this.document.cookie.search(h)!==-1?this.document.cookie=this.document.cookie.replace(h,l):this.document.cookie+=l,this.response&&this.response.cookie(n,i)}else this.document.cookie=l}delete(n,i,s){this.documentIsAccessible&&this.set(n,"",new Date("Thu, 01 Jan 1970 00:00:01 GMT"),i,s)}deleteAll(n,i){if(!this.documentIsAccessible)return;let s=this.getAll();for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&this.delete(o,n,i)}getCookieRegExp(n){let i=n.replace(/([[\]{}()|=;+?,.*^$])/gi,"\\$1");return new RegExp("(?:^"+i+"|;\\s*"+i+")=(.*?)(?:;|$)","g")}};e.\u0275fac=function(i){return new(i||e)(P(wo),P(ye),P(ur,8),P($r,8))},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var He=(()=>{let e=class e{constructor(n,i){this.platform=n,this.cookies=i,this.prefix="ngStorage-"}get country(){return this.getItem("country")}set country(n){this.setItem("country",n)}get lastAccess(){return this.getItem("lastAccess")}set lastAccess(n){this.setItem("lastAccess",n)}get guestSongs(){return this.getItem("guestSongs")}set guestSongs(n){this.setItem("guestSongs",n)}get loggedSongs(){return this.getItem("loggedSongs")}set loggedSongs(n){this.setItem("loggedSongs",n)}get mailSended(){return this.getItem("mailSended")}set mailSended(n){this.setItem("mailSended",n)}get userSelectCountry(){return this.getItem("userSelectCountry")}set userSelectCountry(n){this.setItem("userSelectCountry",n)}get CFI(){return this.getItem("CFI")}set CFI(n){this.setItem("CFI",n)}get tokenUser(){return this.getItem("tokenUser")}set tokenUser(n){this.setItem("tokenUser",n)}get tokenTv(){return this.getItem("tokenTv")}set tokenTv(n){this.setItem("tokenTv",n)}get user_id(){return this.getItem("user_id")}set user_id(n){this.setItem("user_id",n)}get session(){let n=this.getItem("session");try{if(typeof n=="string")return JSON.parse(n)}catch{n=void 0}return n}set session(n){this.setItem("session",n)}get finnishTimer(){return this.getItem("finnishTimer")}set finnishTimer(n){this.setItem("finnishTimer",n)}get emailUsed(){return this.getItem("emailUsed")}set emailUsed(n){this.setItem("emailUsed",n)}get songsPlayed(){return this.getItem("songsPlayed")}set songsPlayed(n){this.setItem("songsPlayed",n)}get sungSongs(){return this.getItem("sungSongs")}set sungSongs(n){this.setItem("sungSongs",n)}get songsWithTones(){return this.getItem("songsWithTones")}set songsWithTones(n){this.setItem("songsWithTones",n)}get sendedEmail(){return this.getItem("sendedEmail")}set sendedEmail(n){this.setItem("sendedEmail",n)}get firtsPreRoll(){return this.getItem("firtsPreRoll")}set firtsPreRoll(n){this.setItem("firtsPreRoll",n)}get preRollSeen(){return this.getItem("preRollSeen")}set preRollSeen(n){this.setItem("preRollSeen",n)}get daysWhenSendedMail(){let n=Array.from(JSON.parse(this.getItem("daysWhenSendedMail")));return n?(n.originalPush=n.push,n.push=(...i)=>(n.originalPush(...i),this.daysWhenSendedMail=n,n.length),n):[]}set daysWhenSendedMail(n){this.setItem("daysWhenSendedMail",JSON.stringify(n))}get surveysViews(){return this.getItem("surveysViews")}set surveysViews(n){this.setItem("surveysViews",n)}get planPaylinkModal(){return this.getItem("planPaylinkModal")}set planPaylinkModal(n){this.setItem("planPaylinkModal",n)}getItem(n){if(this.platform.isBrowser())try{return JSON.parse(this.cookies.get(n))||localStorage.getItem(n)}catch{return this.cookies.get(n)||localStorage.getItem(n)||void 0}else try{return JSON.parse(this.cookies.get(n))}catch{return this.cookies.get(n)||void 0}}setItem(n,i){return this.platform.isBrowser()?(localStorage.setItem(n,i),this.cookies.set(n,i,void 0,"/")):this.cookies.set(n,i,void 0,"/")}removeItem(n){this.platform.isBrowser()?(this.cookies.delete(n,"/"),localStorage.removeItem(n),localStorage.removeItem(this.prefix+n)):this.cookies.delete(n,"/")}removeAll(){this.platform.isBrowser()?(this.cookies.deleteAll("/"),localStorage.clear()):this.cookies.deleteAll("/")}};e.\u0275fac=function(i){return new(i||e)(P(ye),P(Lp))},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var qp=To("ip"),Up=To("country"),Gi=(()=>{let e=class e{constructor(n,i,s,o,a,u){this.api=n,this.http=i,this.state=s,this.localStorage=o,this.platform=a,this.request=u,this.countrySub=new Gf,this.ip="",this.country=new et(""),this.clientCountry$=new et(""),this.allowedCountries=["BR","MX","PE","CO","AR","EC","CL","ES","US","NL"]}get currentCountry(){return this.country.value||this.localStorage.getItem("country")}get clientCountry(){return this.clientCountry$.value}set clientCountry(n){this.clientCountry$.next(n)}isAllowedCountry(n){return this.allowedCountries.includes(n.toLocaleUpperCase())}setIp(n){this.ip=n,n&&this.state.set(qp,n)}getIp(){return this.state.get(qp,void 0)}isValidCountry(n){return n&&n.length<=3}
7setCountry(n){n&&(this.localStorage.setItem("country",n),this.country.next(n),this.state.set(Up,n),this.countrySub&&this.countrySub.unsubscribe())}getCountryKS(n){return this.api.get("country",n?{ip:n}:void 0).pipe(Dn(1e4),pe(i=>i.success?Z(i.data):De({name:"DataSendedError",message:i.message||"Ocurrio un error inesperado"})))}getCountry(n){let i=this.state.get(To(Up),null);if(i)return Z(i).pipe(Me());{let s=this.request?.headers?this.request?.headers["cf-ipcountry"]:null;if(s)return Z(s);let o={};return this.platform.isServer()&&(o["x-api-key"]=Le.firebase.apiKey),this.http.get(Le.firebase.functionsURL+"/getCountry"+(n?`?ip=${n}`:""),{headers:o}).pipe(Dn(5e3),pe(a=>a.country?Z(a.country):this.getCountryKS(n)),Ju(2),Me())}}getCountryFirebase(n){return this.http.get(Le.firebase.functionsURL+"/getCountry"+(n?`?ip=${n}`:"")).pipe(Dn(1e4),pe(i=>Z(i.country)),Ju(2),Me())}getLocalIP(){return new Promise((n,i)=>{let s=window.webkitRTCPeerConnection;s||i("Your browser does not support this API");let o=new s({iceServers:[]}),a={};a["0.0.0.0"]=!1;let u=c=>{let l="";return c.split(`\r
8`).forEach(h=>{if(~h.indexOf("a=candidate")){let d=h.split(" "),m=d[4];d[7]==="host"&&(l=m)}else~h.indexOf("c=")&&(l=h.split(" ")[2])}),l};o.createDataChannel("",{reliable:!1}),o.onicecandidate=c=>{if(c.candidate){let l=u("a="+c.candidate.candidate);n(l)}},o.createOffer(c=>{o.setLocalDescription(c)},c=>{console.warn("offer failed",c)})})}callCountryApi(n){let i=this.getCountry(n);return this.countrySub=i.subscribe({next:this.setCountry.bind(this),error:s=>{}}),i}getClientCountry(){this.getCountry().subscribe(this.clientCountry$)}onErrorOnGetCountry(){console.log("ocurrio un error en obtener pais")}onReady(n){return this.country.subscribe(s=>{s&&n()})}};e.\u0275fac=function(i){return new(i||e)(P(zt),P(ap),P(up),P(He),P(ye),P(ur,8))},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var oc=(()=>{let e=class e{constructor(n,i){this.country=n,this.localStorage=i,this.kantoCountries=["PE","CL","AR","EC","CO","BR","MX"],this.countriesFreemium=["CO"],(this.localStorage.songsPlayed===void 0||this.localStorage.songsPlayed===null)&&(this.localStorage.songsPlayed=0 .toString()),(this.localStorage.sungSongs===void 0||this.localStorage.sungSongs===null)&&(this.localStorage.sungSongs=0 .toString())}isAFremiumCountry(){return this.countriesFreemium.indexOf(this.country.currentCountry)!==-1}isAvailableFreemium(){return this.isAFremiumCountry()}};e.countriesConfig={BR:{lang:"pt"},MX:{lang:"es"},PE:{lang:"es"},CO:{lang:"es"},AR:{lang:"es"},EC:{lang:"es"},CL:{lang:"es"},ES:{lang:"es-es"},US:{lang:"en"}},e.\u0275fac=function(i){return new(i||e)(P(Gi),P(He))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var Tw="firebase",bw="10.7.1";ar(Tw,bw,"app");var Gr=new rp("ANGULARFIRE2_VERSION");var Sw=(r,e)=>{let t=e?[e]:mp(),n=[];return t.forEach(i=>{i.container.getProvider(r).instances.forEach(o=>{n.includes(o)||n.push(o)})}),n},Kr=class{constructor(){return Sw(Aw)}},Aw="app-check";function ac(){}var Oo=class{zone;delegate;constructor(e,t=Wf){this.zone=e,this.delegate=t}now(){return this.delegate.now()}schedule(e,t,n){let i=this.zone,s=function(o){i.runGuarded(()=>{e.apply(this,[o])})};return this.delegate.schedule(s,t,n)}},uc=class{zone;task=null;constructor(e){this.zone=e}call(e,t){let n=this.unscheduleTask.bind(this);return this.task=this.zone.run(()=>Zone.current.scheduleMacroTask("firebaseZoneBlock",ac,{},ac,ac)),t.pipe(ep({next:n,complete:n,error:n})).subscribe(e).add(n)}unscheduleTask(){setTimeout(()=>{this.task!=null&&this.task.state==="scheduled"&&(this.task.invoke(),this.task=null)},10)}},Fo=(()=>{class r{ngZone;outsideAngular;insideAngular;constructor(t){this.ngZone=t,this.outsideAngular=t.runOutsideAngular(()=>new Oo(Zone.current)),this.insideAngular=t.run(()=>new Oo(Zone.current,go)),globalThis.\u0275AngularFireScheduler||=this}static \u0275fac=function(n){return new(n||r)(P(or))};static \u0275prov=$({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function kw(){let r=globalThis.\u0275AngularFireScheduler;if(!r)throw new Error(`Either AngularFireModule has not been provided in your Ap
8pModule (this can be done manually or implictly using
9provideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);return r}function tt(r){return Pw(kw())(r)}function Pw(r){return function(t){return t=t.lift(new uc(r.ngZone)),t.pipe(Rn(r.outsideAngular),Br(r.insideAngular))}}var Rw=new Map,Dw={activated:!1,tokenObservers:[]},Nw={initialized:!1,enabled:!1};function mt(r){return Rw.get(r)||Object.assign({},Dw)}function Wp(){return Nw}var Vw="https://content-firebaseappcheck.googleapis.com/v1";var Ow="exchangeDebugToken",$p={OFFSET_DURATION:5*60*1e3,RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:16*60*1e3},bA=24*60*60*1e3;var lc=class{constructor(e,t,n,i,s){if(this.operation=e,this.retryPolicy=t,this.getWaitDuration=n,this.lowerBound=i,this.upperBound=s,this.pending=null,this.nextErrorWaitInterval=i,i>s)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}process(e){return S(this,null,function*(){this.stop();try{this.pending=new tc,this.pending.promise.catch(t=>{}),yield Fw(this.getNextRun(e)),this.pending.resolve(),yield this.pending.promise,this.pending=new tc,this.pending.promise.catch(t=>{}),yield this.operation(),this.pending.resolve(),yield this.pending.promise,this.process(!0).catch(()=>{})}catch(t){this.retryPolicy(t)?this.process(!1).catch(()=>{}):this.stop()}})}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t}}};function Fw(r){return new Promise(e=>{setTimeout(e,r)})}var Mw={"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.",throttled:"Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}"},lr=new fp("appCheck","AppCheck",Mw);function Qp(r){if(!mt(r).activated)throw lr.create("use-before-activation",{appName:r.name})}function Hp(n,i){return S(this,arguments,function*({url:r,body:e},t){let s={"Content-Type":"application/json"},o=t.getImmediate({optional:!0});if(o){let m=yield o.getHeartbeatsHeader();m&&(s["X-Firebase-Client"]=m)}let a={method:"POST",body:JSON.stringify(e),headers:s},u;try{u=yield fetch(r,a)}catch(m){throw lr.create("fetch-network-error",{originalErrorMessage:m?.message})}if(u.status!==200)throw lr.create("fetch-status-error",{httpStatus:u.status});let c;try{c=yield u.json()}catch(m){throw lr.create("fetch-parse-error",{originalErrorMessage:m?.message})}let l=c.ttl.match(/^([\d.]+)(s)$/);if(!l||!l[2]||isNaN(Number(l[1])))throw lr.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${c.ttl}`});let h=Number(l[1])*1e3,d=Date.now();return{token:c.token,expireTimeMillis:d+h,issuedAtTimeMillis:d}})}function Yp(r,e){let{projectId:t,appId:n,apiKey:i}=r.options;return{url:`${Vw}/projects/${t}/apps/${n}:${Ow}?key=${i}`,body:{debug_token:e}}}var Lw="firebase-app-check-database",qw=1,hc="firebase-app-check-store";var Mo=null;function Uw(){return Mo||(Mo=new Promise((r,e)=>{try{let t=indexedDB.open(Lw,qw);t.onsuccess=n=>{r(n.target.result)},t.onerror=n=>{var i;e(lr.create("storage-open",{originalErrorMessage:(i=n.target.error)===null||i===void 0?void 0:i.message}))},t.onupgradeneeded=n=>{let i=n.target.result;switch(n.oldVersion){case 0:i.createObjectStore(hc,{keyPath:"compositeKey"})}}}catch(t){e(lr.create("storage-open",{originalErrorMessage:t?.message}))}}),Mo)}function Bw(r,e){return jw($w(r),e)}function jw(r,e){return S(this,null,function*(){let n=(yield Uw()).transaction(hc,"readwrite"),s=n.objectStore(hc).put({compositeKey:r,value:e});return new Promise((o,a)=>{s.onsuccess=u=>{o()},n.onerror=u=>{var c;a(lr.create("storage-set",{originalErrorMessage:(c=u.target.error)===null||c===void 0?void 0:c.message}))}})})}function $w(r){return`${r.options.appId}-${r.name}`}var dc=new Ao("@firebase/app-check");function cc(r,e){return So()?Bw(r,e).catch(t=>{dc.warn(`Failed to write token to IndexedDB. Error: ${t}`)}):Promise.resolve()}function Jp(){return Wp().enabled}function Xp(){return S(this,null,function*(){let r=Wp();if(r.enabled&&r.token)return r.token.promise;throw Error(`
10            Can't get debug token in production mode.
11        `)})}var zw={error:"UNKNOWN_ERROR"};function Kw(r){return cp.encodeString(JSON.stringify(r),!1)}function fc(r,e=!1){return S(this,null,function*(){let t=r.app;Qp(t);let n=mt(t),i=n.token,s;
11if(i&&!Wi(i)&&(n.token=void 0,i=void 0),!i){let u=yield n.cachedTokenPromise;u&&(Wi(u)?i=u:yield cc(t,void 0))}if(!e&&i&&Wi(i))return{token:i.token};let o=!1;if(Jp()){n.exchangeTokenPromise||(n.exchangeTokenPromise=Hp(Yp(t,yield Xp()),r.heartbeatServiceProvider).finally(()=>{n.exchangeTokenPromise=void 0}),o=!0);let u=yield n.exchangeTokenPromise;return yield cc(t,u),n.token=u,{token:u.token}}try{n.exchangeTokenPromise||(n.exchangeTokenPromise=n.provider.getToken().finally(()=>{n.exchangeTokenPromise=void 0}),o=!0),i=yield mt(t).exchangeTokenPromise}catch(u){u.code==="appCheck/throttled"?dc.warn(u.message):dc.error(u),s=u}let a;return i?s?Wi(i)?a={token:i.token,internalError:s}:a=Kp(s):(a={token:i.token},n.token=i,yield cc(t,i)):a=Kp(s),o&&Hw(t,a),a})}function Gw(r){return S(this,null,function*(){let e=r.app;Qp(e);let{provider:t}=mt(e);if(Jp()){let n=yield Xp(),{token:i}=yield Hp(Yp(e,n),r.heartbeatServiceProvider);return{token:i}}else{let{token:n}=yield t.getToken();return{token:n}}})}function Ww(r,e,t,n){let{app:i}=r,s=mt(i),o={next:t,error:n,type:e};if(s.tokenObservers=[...s.tokenObservers,o],s.token&&Wi(s.token)){let a=s.token;Promise.resolve().then(()=>{t({token:a.token}),zp(r)}).catch(()=>{})}s.cachedTokenPromise.then(()=>zp(r))}function Zp(r,e){let t=mt(r),n=t.tokenObservers.filter(i=>i.next!==e);n.length===0&&t.tokenRefresher&&t.tokenRefresher.isRunning()&&t.tokenRefresher.stop(),t.tokenObservers=n}function zp(r){let{app:e}=r,t=mt(e),n=t.tokenRefresher;n||(n=Qw(r),t.tokenRefresher=n),!n.isRunning()&&t.isTokenAutoRefreshEnabled&&n.start()}function Qw(r){let{app:e}=r;return new lc(()=>S(this,null,function*(){let t=mt(e),n;if(t.token?n=yield fc(r,!0):n=yield fc(r),n.error)throw n.error;if(n.internalError)throw n.internalError}),()=>!0,()=>{let t=mt(e);if(t.token){let n=t.token.issuedAtTimeMillis+(t.token.expireTimeMillis-t.token.issuedAtTimeMillis)*.5+3e5,i=t.token.expireTimeMillis-5*60*1e3;return n=Math.min(n,i),Math.max(0,n-Date.now())}else return 0},$p.RETRIAL_MIN_WAIT,$p.RETRIAL_MAX_WAIT)}function Hw(r,e){let t=mt(r).tokenObservers;for(let n of t)try{n.type==="EXTERNAL"&&e.error!=null?n.error(e.error):n.next(e)}catch{}}function Wi(r){return r.expireTimeMillis-Date.now()>0}function Kp(r){return{token:Kw(zw),error:r}}var pc=class{constructor(e,t){this.app=e,this.heartbeatServiceProvider=t}_delete(){let{tokenObservers:e}=mt(this.app);for(let t of e)Zp(this.app,t.next);return Promise.resolve()}};function Yw(r,e){return new pc(r,e)}function Jw(r){return{getToken:e=>fc(r,e),getLimitedUseToken:()=>Gw(r),addTokenListener:e=>Ww(r,"INTERNAL",e),removeTokenListener:e=>Zp(r.app,e)}}var Xw="@firebase/app-check",Zw="0.8.1";var eI="app-check",Gp="app-check-internal";function tI(){Ki(new jr(eI,r=>{let e=r.getProvider("app").getImmediate(),t=r.getProvider("heartbeat");return Yw(e,t)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((r,e,t)=>{r.getProvider(Gp).initialize()})),Ki(new jr(Gp,r=>{let e=r.getProvider("app-check").getImmediate();return Jw(e)},"PUBLIC").setInstantiationMode("EXPLICIT")),ar(Xw,Zw)}tI();var rI=["localhost","0.0.0.0","127.0.0.1"],FA=typeof window<"u"&&rI.includes(window.location.hostname);var nI="firebase",iI="10.7.1";Qe.registerVersion(nI,iI,"app-compat");var sI=["ngOnDestroy"],rm=(r,e,t,n={})=>new Proxy(r,{get:(i,s)=>t.runOutsideAngular(()=>{if(r[s])return n?.spy?.get&&n.spy.get(s,r[s]),r[s];if(sI.indexOf(s)>-1)return()=>{};let o=e.toPromise().then(a=>{let u=a?.[s];return typeof u=="function"?u.bind(a):u?.then?u.then(c=>t.run(()=>c)):t.run(()=>u)});return new Proxy(()=>{},{get:(a,u)=>o[u],apply:(a,u,c)=>o.then(l=>{let h=l?.(...c);return n?.spy?.apply&&n.spy.apply(s,c,h),h})})})});var Lo=class{constructor(e){return e}},Un=new We("angularfire2.app.options"),Bn=new We("angularfire2.app.name");function Qi(r,e,t){let n=typeof t=="string"&&t||"[DEFAULT]",i=typeof t=="object"&&t||{};i.name=i.name||n;let o=Qe.apps.filter(a=>a&&a.name===i.name)[0]||e.runOutsideAngular(()=>Qe.initializeApp(r,i));try{if(JSON.stringify(r)!==JSON.stringify(o.options)){let a=!!module.hot;oI("error",`${o.name} Firebase App already initialized with different options${a?", you may 
11need to reload as Firebase is not HMR aware.":"."}`)}}catch{}return new Lo(o)}var oI=(r,...e)=>{ec()&&typeof console<"u"&&console[r](...e)},aI={provide:Lo,useFactory:Qi,deps:[Un,or,[new tp,Bn]]},WA=(()=>{class r{static initializeApp(t,n){return{ngModule:r,providers:[{provide:Un,useValue:t},{provide:Bn,useValue:n}]}}constructor(t){Qe.registerVersion("angularfire",Gr.full,"core"),Qe.registerVersion("angularfire",Gr.full,"app-compat"),Qe.registerVersion("angular",np.full,t.toString())}static \u0275fac=function(n){return new(n||r)(P(sr))};static \u0275mod=Vn({type:r});static \u0275inj=Nn({providers:[aI]})}return r})();function qo(r,e,t,n,i){let[,s,o]=globalThis.\u0275AngularfireInstanceCache.find(a=>a[0]===r)||[];if(s)return uI(i,o)||(tm("error",`${e} was already initialized on the ${t} Firebase App with different settings.${cI?" You may need to reload as Firebase is not HMR aware.":""}`),tm("warn",{is:i,was:o})),s;{let a=n();return globalThis.\u0275AngularfireInstanceCache.push([r,a,i]),a}}function uI(r,e){try{return r.toString()===e.toString()}catch{return r===e}}var cI=typeof module<"u"&&!!module.hot,tm=(r,...e)=>{ec()&&typeof console<"u"&&console[r](...e)};globalThis.\u0275AngularfireInstanceCache||=[];var mc=new We("angularfire2.auth.use-emulator"),gc=new We("angularfire2.auth.settings"),_c=new We("angularfire2.auth.tenant-id"),yc=new We("angularfire2.auth.langugage-code"),vc=new We("angularfire2.auth.use-device-language"),wc=new We("angularfire.auth.persistence"),Ic=(r,e,t,n,i,s,o,a)=>qo(`${r.name}.auth`,"AngularFireAuth",r.name,()=>{let u=e.runOutsideAngular(()=>r.auth());if(t&&u.useEmulator(...t),n&&(u.tenantId=n),u.languageCode=i,s&&u.useDeviceLanguage(),o)for(let[c,l]of Object.entries(o))u.settings[c]=l;return a&&u.setPersistence(a),u},[t,n,i,s,o,a]),Ec=(()=>{class r{authState;idToken;user;idTokenResult;credential;constructor(t,n,i,s,o,a,u,c,l,h,d,m){let w=new xn,T=Z(void 0).pipe(Br(o.outsideAngular),pe(()=>s.runOutsideAngular(()=>import("./chunk-K6B6MLIJ.js"))),se(()=>Qi(t,s,n)),se(E=>Ic(E,s,a,c,l,h,u,d)),Xu({bufferSize:1,refCount:!1}));if(On(i))this.authState=this.user=this.idToken=this.idTokenResult=this.credential=Z(null);else{T.pipe(Jf()).subscribe();let E=T.pipe(pe(p=>p.getRedirectResult().then(g=>g,()=>null)),tt,Xu({bufferSize:1,refCount:!1})),I=T.pipe(pe(p=>new Cn(g=>({unsubscribe:s.runOutsideAngular(()=>p.onAuthStateChanged(_=>g.next(_),_=>g.error(_),()=>g.complete()))})))),v=T.pipe(pe(p=>new Cn(g=>({unsubscribe:s.runOutsideAngular(()=>p.onIdTokenChanged(_=>g.next(_),_=>g.error(_),()=>g.complete()))}))));this.authState=E.pipe(Zu(I),Rn(o.outsideAngular),Br(o.insideAngular)),this.user=E.pipe(Zu(v),Rn(o.outsideAngular),Br(o.insideAngular)),this.idToken=this.user.pipe(pe(p=>p?ir(p.getIdToken()):Z(null))),this.idTokenResult=this.user.pipe(pe(p=>p?ir(p.getIdTokenResult()):Z(null))),this.credential=Hf(E,w,this.authState.pipe(zi(p=>!p))).pipe(se(p=>p?.user?p:null),Rn(o.outsideAngular),Br(o.insideAngular))}return rm(this,T,s,{spy:{apply:(E,I,v)=>{(E.startsWith("signIn")||E.startsWith("createUser"))&&v.then(p=>w.next(p))}}})}static \u0275fac=function(n){return new(n||r)(P(Un),P(Bn,8),P(sr),P(or),P(Fo),P(mc,8),P(gc,8),P(_c,8),P(yc,8),P(vc,8),P(wc,8),P(Kr,8))};static \u0275prov=$({token:r,factory:r.\u0275fac,providedIn:"any"})}return r})(),u1=(()=>{class r{constructor(){Qe.registerVersion("angularfire",Gr.full,"auth-compat")}static \u0275fac=function(n){return new(n||r)};static \u0275mod=Vn({type:r});static \u0275inj=Nn({providers:[Ec]})}return r})();var hI=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},_t={},D,zc=zc||{},z=hI||self;function Zo(r){var e=typeof r;return e=e!="object"?e:r?Array.isArray(r)?"array":e:"null",e=="array"||e=="object"&&typeof r.length=="number"}function us(r){var e=typeof r;return e=="object"&&r!=null||e=="function"}function dI(r){return Object.prototype.hasOwnProperty.call(r,Tc)&&r[Tc]||(r[Tc]=++fI)}var Tc="closure_uid_"+(1e9*Math.random()>>>0),fI=0;function pI(r,e,t){return r.call.apply(r.bind,arguments)}function mI(r,e,t){if(!r)throw Error();if(2<arguments.length){var n=Array.prototype.slice.call(arguments,2);return function(){var i=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(i,n),r.apply(e,i)}}return function(){return r.apply(e,arguments)}}function je(r,e,t){return Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?je=pI:je=mI,je.apply(null,arguments)}
11function Uo(r,e){var t=Array.prototype.slice.call(arguments,1);return function(){var n=t.slice();return n.push.apply(n,arguments),r.apply(this,n)}}function Ve(r,e){function t(){}t.prototype=e.prototype,r.$=e.prototype,r.prototype=new t,r.prototype.constructor=r,r.ac=function(n,i,s){for(var o=Array(arguments.length-2),a=2;a<arguments.length;a++)o[a-2]=arguments[a];return e.prototype[i].apply(n,o)}}function hr(){this.s=this.s,this.o=this.o}var gI=0;hr.prototype.s=!1;hr.prototype.sa=function(){!this.s&&(this.s=!0,this.N(),gI!=0)&&dI(this)};hr.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var mm=Array.prototype.indexOf?function(r,e){return Array.prototype.indexOf.call(r,e,void 0)}:function(r,e){if(typeof r=="string")return typeof e!="string"||e.length!=1?-1:r.indexOf(e,0);for(let t=0;t<r.length;t++)if(t in r&&r[t]===e)return t;return-1};function Kc(r){let e=r.length;if(0<e){let t=Array(e);for(let n=0;n<e;n++)t[n]=r[n];return t}return[]}function nm(r,e){for(let t=1;t<arguments.length;t++){let n=arguments[t];if(Zo(n)){let i=r.length||0,s=n.length||0;r.length=i+s;for(let o=0;o<s;o++)r[i+o]=n[o]}else r.push(n)}}function $e(r,e){this.type=r,this.g=this.target=e,this.defaultPrevented=!1}$e.prototype.h=function(){this.defaultPrevented=!0};var _I=function(){if(!z.addEventListener||!Object.defineProperty)return!1;var r=!1,e=Object.defineProperty({},"passive",{get:function(){r=!0}});try{let t=()=>{};z.addEventListener("test",t,e),z.removeEventListener("test",t,e)}catch{}return r}();function es(r){return/^[\s\xa0]*$/.test(r)}function ea(){var r=z.navigator;return r&&(r=r.userAgent)?r:""}function At(r){return ea().indexOf(r)!=-1}function Gc(r){return Gc[" "](r),r}Gc[" "]=function(){};function yI(r,e){var t=oE;return Object.prototype.hasOwnProperty.call(t,r)?t[r]:t[r]=e(r)}var vI=At("Opera"),Kn=At("Trident")||At("MSIE"),gm=At("Edge"),Pc=gm||Kn,_m=At("Gecko")&&!(ea().toLowerCase().indexOf("webkit")!=-1&&!At("Edge"))&&!(At("Trident")||At("MSIE"))&&!At("Edge"),wI=ea().toLowerCase().indexOf("webkit")!=-1&&!At("Edge");function ym(){var r=z.document;return r?r.documentMode:void 0}var Cc;e:{if(Bo="",jo=function(){var r=ea();if(_m)return/rv:([^\);]+)(\)|;)/.exec(r);if(gm)return/Edge\/([\d\.]+)/.exec(r);if(Kn)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(r);if(wI)return/WebKit\/(\S+)/.exec(r);if(vI)return/(?:Version)[ \/]?(\S+)/.exec(r)}(),jo&&(Bo=jo?jo[1]:""),Kn&&($o=ym(),$o!=null&&$o>parseFloat(Bo))){Cc=String($o);break e}Cc=Bo}var Bo,jo,$o,xc;z.document&&Kn?(bc=ym(),xc=bc||parseInt(Cc,10)||void 0):xc=void 0;var bc,II=xc;function ts(r,e){if($e.call(this,r?r.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,r){var t=this.type=r.type,n=r.changedTouches&&r.changedTouches.length?r.changedTouches[0]:null;if(this.target=r.target||r.srcElement,this.g=e,e=r.relatedTarget){if(_m){e:{try{Gc(e.nodeName);var i=!0;break e}catch{}i=!1}i||(e=null)}}else t=="mouseover"?e=r.fromElement:t=="mouseout"&&(e=r.toElement);this.relatedTarget=e,n?(this.clientX=n.clientX!==void 0?n.clientX:n.pageX,this.clientY=n.clientY!==void 0?n.clientY:n.pageY,this.screenX=n.screenX||0,this.screenY=n.screenY||0):(this.clientX=r.clientX!==void 0?r.clientX:r.pageX,this.clientY=r.clientY!==void 0?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0),this.button=r.button,this.key=r.key||"",this.ctrlKey=r.ctrlKey,this.altKey=r.altKey,this.shiftKey=r.shiftKey,this.metaKey=r.metaKey,this.pointerId=r.pointerId||0,this.pointerType=typeof r.pointerType=="string"?r.pointerType:EI[r.pointerType]||"",this.state=r.state,this.i=r,r.defaultPrevented&&ts.$.h.call(this)}}Ve(ts,$e);var EI={2:"touch",3:"pen",4:"mouse"};ts.prototype.h=function(){ts.$.h.call(this);var r=this.i;r.preventDefault?r.preventDefault():r.returnValue=!1};var cs="closure_listenable_"+(1e6*Math.random()|0),TI=0;function bI(r,e,t,n,i){this.listener=r,this.proxy=null,this.src=e,this.type=t,this.capture=!!n,this.la=i,this.key=++TI,this.fa=this.ia=!1}function ta(r){r.fa=!0,r.listener=null,r.proxy=null,r.src=null,r.la=null}function Wc(r,e,t){for(let n in r)e.call(t,r[n],n,r)}function SI(r,e){for(let t in r)e.call(void 0,r[t],t,r)}function vm(r){let e={};for(let t in r)e[t]=r[t];return e}var im="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
11ing toString valueOf".split(" ");function wm(r,e){let t,n;for(let i=1;i<arguments.length;i++){n=arguments[i];for(t in n)r[t]=n[t];for(let s=0;s<im.length;s++)t=im[s],Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}}function ra(r){this.src=r,this.g={},this.h=0}ra.prototype.add=function(r,e,t,n,i){var s=r.toString();r=this.g[s],r||(r=this.g[s]=[],this.h++);var o=Dc(r,e,n,i);return-1<o?(e=r[o],t||(e.ia=!1)):(e=new bI(e,this.src,s,!!n,i),e.ia=t,r.push(e)),e};function Rc(r,e){var t=e.type;if(t in r.g){var n=r.g[t],i=mm(n,e),s;(s=0<=i)&&Array.prototype.splice.call(n,i,1),s&&(ta(e),r.g[t].length==0&&(delete r.g[t],r.h--))}}function Dc(r,e,t,n){for(var i=0;i<r.length;++i){var s=r[i];if(!s.fa&&s.listener==e&&s.capture==!!t&&s.la==n)return i}return-1}var Qc="closure_lm_"+(1e6*Math.random()|0),Sc={};function Im(r,e,t,n,i){if(n&&n.once)return Tm(r,e,t,n,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)Im(r,e[s],t,n,i);return null}return t=Jc(t),r&&r[cs]?r.O(e,t,us(n)?!!n.capture:!!n,i):Em(r,e,t,!1,n,i)}function Em(r,e,t,n,i,s){if(!e)throw Error("Invalid event type");var o=us(i)?!!i.capture:!!i,a=Yc(r);if(a||(r[Qc]=a=new ra(r)),t=a.add(e,t,n,o,s),t.proxy)return t;if(n=AI(),t.proxy=n,n.src=r,n.listener=t,r.addEventListener)_I||(i=o),i===void 0&&(i=!1),r.addEventListener(e.toString(),n,i);else if(r.attachEvent)r.attachEvent(Sm(e.toString()),n);else if(r.addListener&&r.removeListener)r.addListener(n);else throw Error("addEventListener and attachEvent are unavailable.");return t}function AI(){function r(t){return e.call(r.src,r.listener,t)}let e=kI;return r}function Tm(r,e,t,n,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)Tm(r,e[s],t,n,i);return null}return t=Jc(t),r&&r[cs]?r.P(e,t,us(n)?!!n.capture:!!n,i):Em(r,e,t,!0,n,i)}function bm(r,e,t,n,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)bm(r,e[s],t,n,i);else n=us(n)?!!n.capture:!!n,t=Jc(t),r&&r[cs]?(r=r.i,e=String(e).toString(),e in r.g&&(s=r.g[e],t=Dc(s,t,n,i),-1<t&&(ta(s[t]),Array.prototype.splice.call(s,t,1),s.length==0&&(delete r.g[e],r.h--)))):r&&(r=Yc(r))&&(e=r.g[e.toString()],r=-1,e&&(r=Dc(e,t,n,i)),(t=-1<r?e[r]:null)&&Hc(t))}function Hc(r){if(typeof r!="number"&&r&&!r.fa){var e=r.src;if(e&&e[cs])Rc(e.i,r);else{var t=r.type,n=r.proxy;e.removeEventListener?e.removeEventListener(t,n,r.capture):e.detachEvent?e.detachEvent(Sm(t),n):e.addListener&&e.removeListener&&e.removeListener(n),(t=Yc(e))?(Rc(t,r),t.h==0&&(t.src=null,e[Qc]=null)):ta(r)}}}function Sm(r){return r in Sc?Sc[r]:Sc[r]="on"+r}function kI(r,e){if(r.fa)r=!0;else{e=new ts(e,this);var t=r.listener,n=r.la||r.src;r.ia&&Hc(r),r=t.call(n,e)}return r}function Yc(r){return r=r[Qc],r instanceof ra?r:null}var Ac="__closure_events_fn_"+(1e9*Math.random()>>>0);function Jc(r){return typeof r=="function"?r:(r[Ac]||(r[Ac]=function(e){return r.handleEvent(e)}),r[Ac])}function Ne(){hr.call(this),this.i=new ra(this),this.S=this,this.J=null}Ve(Ne,hr);Ne.prototype[cs]=!0;Ne.prototype.removeEventListener=function(r,e,t,n){bm(this,r,e,t,n)};function Ue(r,e){var t,n=r.J;if(n)for(t=[];n;n=n.J)t.push(n);if(r=r.S,n=e.type||e,typeof e=="string")e=new $e(e,r);else if(e instanceof $e)e.target=e.target||r;else{var i=e;e=new $e(n,r),wm(e,i)}if(i=!0,t)for(var s=t.length-1;0<=s;s--){var o=e.g=t[s];i=zo(o,n,!0,e)&&i}if(o=e.g=r,i=zo(o,n,!0,e)&&i,i=zo(o,n,!1,e)&&i,t)for(s=0;s<t.length;s++)o=e.g=t[s],i=zo(o,n,!1,e)&&i}Ne.prototype.N=function(){if(Ne.$.N.call(this),this.i){var r=this.i,e;for(e in r.g){for(var t=r.g[e],n=0;n<t.length;n++)ta(t[n]);delete r.g[e],r.h--}}this.J=null};Ne.prototype.O=function(r,e,t,n){return this.i.add(String(r),e,!1,t,n)};Ne.prototype.P=function(r,e,t,n){return this.i.add(String(r),e,!0,t,n)};function zo(r,e,t,n){if(e=r.i.g[String(e)],!e)return!0;e=e.concat();for(var i=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.fa&&o.capture==t){var a=o.listener,u=o.la||o.src;o.ia&&Rc(r.i,o),i=a.call(u,n)!==!1&&i}}return i&&!n.defaultPrevented}var Xc=z.JSON.stringify,Nc=class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}};function PI(){var r=Zc;let e=null;return r.g&&(e=r.g,r.g=r.g.next,r.g||(r.h=null),e.next=null),e}var Vc=class{constructor(){this.h=this.g=null}add(e,t){let n=Am.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},Am=new Nc(()=>new Oc,r=>r.reset()),Oc=class{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}};function CI(r){var e=1;r=r.split(":");let t=[];for(;0<e&&r.length;)t.push(r.shift()),e--;return r.length&&t.push(r.join(":")),t}function xI(r){z.setTimeout(()=>{throw r},0)}
11var rs,ns=!1,Zc=new Vc,km=()=>{let r=z.Promise.resolve(void 0);rs=()=>{r.then(RI)}},RI=()=>{for(var r;r=PI();){try{r.h.call(r.g)}catch(t){xI(t)}var e=Am;e.j(r),100>e.h&&(e.h++,r.next=e.g,e.g=r)}ns=!1};function na(r,e){Ne.call(this),this.h=r||1,this.g=e||z,this.j=je(this.qb,this),this.l=Date.now()}Ve(na,Ne);D=na.prototype;D.ga=!1;D.T=null;D.qb=function(){if(this.ga){var r=Date.now()-this.l;0<r&&r<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-r):(this.T&&(this.g.clearTimeout(this.T),this.T=null),Ue(this,"tick"),this.ga&&(el(this),this.start()))}};D.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())};function el(r){r.ga=!1,r.T&&(r.g.clearTimeout(r.T),r.T=null)}D.N=function(){na.$.N.call(this),el(this),delete this.g};function tl(r,e,t){if(typeof r=="function")t&&(r=je(r,t));else if(r&&typeof r.handleEvent=="function")r=je(r.handleEvent,r);else throw Error("Invalid listener argument");return 2147483647<Number(e)?-1:z.setTimeout(r,e||0)}function Pm(r){r.g=tl(()=>{r.g=null,r.i&&(r.i=!1,Pm(r))},r.j);let e=r.h;r.h=null,r.m.apply(null,e)}var Fc=class extends hr{constructor(e,t){super(),this.m=e,this.j=t,this.h=null,this.i=!1,this.g=null}l(e){this.h=arguments,this.g?this.i=!0:Pm(this)}N(){super.N(),this.g&&(z.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}};function is(r){hr.call(this),this.h=r,this.g={}}Ve(is,hr);var sm=[];function Cm(r,e,t,n){Array.isArray(t)||(t&&(sm[0]=t.toString()),t=sm);for(var i=0;i<t.length;i++){var s=Im(e,t[i],n||r.handleEvent,!1,r.h||r);if(!s)break;r.g[s.key]=s}}function xm(r){Wc(r.g,function(e,t){this.g.hasOwnProperty(t)&&Hc(e)},r),r.g={}}is.prototype.N=function(){is.$.N.call(this),xm(this)};is.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};function ia(){this.g=!0}ia.prototype.Ea=function(){this.g=!1};function DI(r,e,t,n,i,s){r.info(function(){if(r.g)if(s)for(var o="",a=s.split("&"),u=0;u<a.length;u++){var c=a[u].split("=");if(1<c.length){var l=c[0];c=c[1];var h=l.split("_");o=2<=h.length&&h[1]=="type"?o+(l+"="+c+"&"):o+(l+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+n+") [attempt "+i+"]: "+e+`
12`+t+`
13`+o})}function NI(r,e,t,n,i,s,o){r.info(function(){return"XMLHTTP RESP ("+n+") [ attempt "+i+"]: "+e+`
14`+t+`
15`+s+" "+o})}function $n(r,e,t,n){r.info(function(){return"XMLHTTP TEXT ("+e+"): "+OI(r,t)+(n?" "+n:"")})}function VI(r,e){r.info(function(){return"TIMEOUT: "+e})}ia.prototype.info=function(){};function OI(r,e){if(!r.g)return e;if(!e)return null;try{var t=JSON.parse(e);if(t){for(r=0;r<t.length;r++)if(Array.isArray(t[r])){var n=t[r];if(!(2>n.length)){var i=n[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if(s!="noop"&&s!="stop"&&s!="close")for(var o=1;o<i.length;o++)i[o]=""}}}}return Xc(t)}catch{return e}}var Yr={},om=null;function sa(){return om=om||new Ne}Yr.Ta="serverreachability";function Rm(r){$e.call(this,Yr.Ta,r)}Ve(Rm,$e);function ss(r){let e=sa();Ue(e,new Rm(e))}Yr.STAT_EVENT="statevent";function Dm(r,e){$e.call(this,Yr.STAT_EVENT,r),this.stat=e}Ve(Dm,$e);function Ye(r){let e=sa();Ue(e,new Dm(e,r))}Yr.Ua="timingevent";function Nm(r,e){$e.call(this,Yr.Ua,r),this.size=e}Ve(Nm,$e);function ls(r,e){if(typeof r!="function")throw Error("Fn must not be null and must be a function");return z.setTimeout(function(){r()},e)}var oa={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9},Vm={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function rl(){}rl.prototype.h=null;function am(r){return r.h||(r.h=r.i())}function Om(){}var hs={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function nl(){$e.call(this,"d")}Ve(nl,$e);function il(){$e.call(this,"c")}Ve(il,$e);var Mc;function aa(){}Ve(aa,rl);aa.prototype.g=function(){return new XMLHttpRequest};aa.prototype.i=function(){return{}};Mc=new aa;function ds(r,e,t,n){this.l=r,this.j=e,this.m=t,this.W=n||1,this.U=new is(this),this.P=FI,r=Pc?125:void 0,this.V=new na(r),this.I=null,this.i=!1,this.u=this.B=this.A=this.L=this.G=this.Y=this.C=null,this.F=[],this.g=null,this.o=0,this.s=this.v=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new Fm}function Fm(){this.i=null,this.g="",this.h=!1}var FI=45e3,Mm={},Lc={};D=ds.prototype;D.setTimeout=function(r){this.P=r};function qc(r,e,t){r.L=1,r.A=ca(Gt(e)),r.u=t,r.S=!0,Lm(r,null)}function Lm(r,e){r.G=Date.now(),fs(r),r.B=Gt(r.A);var t=r.B,n=r.W;Array.isArray(n)||(n=[String(n)]),Gm(t.i,"t",n),r.o=0,t=r.l.J,r.h=new Fm,r.g=fg(r.l,t?e:null,!r.u),0<r.O&&(r.M=new Fc(je(r.Pa,r,r.g),r.O)),Cm(r.U,r.g,"readystatechange",r.nb),e=r.I?vm(r.I):{},r.u?(r.v||(r.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",r.g.ha(r.B,r.v,r.u,e)):(r.v="GET",r.g.ha(r.B,r.v,null,e)),ss(),DI(r.j,r.v,r.B,r.m,r.W,r.u)}D.nb=function(r){r=r.target;let e=this.M;e&&kt(r)==3?e.l():this.Pa(r)};D.Pa=function(r){try{if(r==this.g)e:{let l=kt(this.g);var e=this.g.Ia();let h=this.g.da();if(!(3>l)&&(l!=3||Pc||this.g&&(this.h.h||this.g.ja()||hm(this.g)))){this.J||l!=4||e==7||(e==8||0>=h?ss(3):ss(2)),ua(this);var t=this.g.da();this.ca=t;t:if(qm(this)){var n=hm(this.g);r="";var i=n.length,s=kt(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){Wr(this),Zi(this);var o="";break t}this.h.i=new z.TextDecoder}for(e=0;e<i;e++)this.h.h=!0,r+=this.h.i.decode(n[e],{stream:s&&e==i-1});n.length=0,this.h.g+=r,this.o=0,o=this.h.g}else o=this.g.ja();if(this.i=t==200,NI(this.j,this.v,this.B,this.m,this.W,l,t),this.i){if(this.aa&&
15!this.K){t:{if(this.g){var a,u=this.g;if((a=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!es(a)){var c=a;break t}}c=null}if(t=c)$n(this.j,this.m,t,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Uc(this,t);else{this.i=!1,this.s=3,Ye(12),Wr(this),Zi(this);break e}}this.S?(Um(this,l,o),Pc&&this.i&&l==3&&(Cm(this.U,this.V,"tick",this.mb),this.V.start())):($n(this.j,this.m,o,null),Uc(this,o)),l==4&&Wr(this),this.i&&!this.J&&(l==4?cg(this.l,this):(this.i=!1,fs(this)))}else nE(this.g),t==400&&0<o.indexOf("Unknown SID")?(this.s=3,Ye(12)):(this.s=0,Ye(13)),Wr(this),Zi(this)}}}catch{}finally{}};function qm(r){return r.g?r.v=="GET"&&r.L!=2&&r.l.Ha:!1}function Um(r,e,t){let n=!0,i;for(;!r.J&&r.o<t.length;)if(i=MI(r,t),i==Lc){e==4&&(r.s=4,Ye(14),n=!1),$n(r.j,r.m,null,"[Incomplete Response]");break}else if(i==Mm){r.s=4,Ye(15),$n(r.j,r.m,t,"[Invalid Chunk]"),n=!1;break}else $n(r.j,r.m,i,null),Uc(r,i);qm(r)&&r.o!=0&&(r.h.g=r.h.g.slice(r.o),r.o=0),e!=4||t.length!=0||r.h.h||(r.s=1,Ye(16),n=!1),r.i=r.i&&n,n?0<t.length&&!r.ba&&(r.ba=!0,e=r.l,e.g==r&&e.ca&&!e.M&&(e.l.info("Great, no buffering proxy detected. Bytes received: "+t.length),ll(e),e.M=!0,Ye(11))):($n(r.j,r.m,t,"[Invalid Chunked Response]"),Wr(r),Zi(r))}D.mb=function(){if(this.g){var r=kt(this.g),e=this.g.ja();this.o<e.length&&(ua(this),Um(this,r,e),this.i&&r!=4&&fs(this))}};function MI(r,e){var t=r.o,n=e.indexOf(`
16`,t);return n==-1?Lc:(t=Number(e.substring(t,n)),isNaN(t)?Mm:(n+=1,n+t>e.length?Lc:(e=e.slice(n,n+t),r.o=n+t,e)))}D.cancel=function(){this.J=!0,Wr(this)};function fs(r){r.Y=Date.now()+r.P,Bm(r,r.P)}function Bm(r,e){if(r.C!=null)throw Error("WatchDog timer not null");r.C=ls(je(r.lb,r),e)}function ua(r){r.C&&(z.clearTimeout(r.C),r.C=null)}D.lb=function(){this.C=null;let r=Date.now();0<=r-this.Y?(VI(this.j,this.B),this.L!=2&&(ss(),Ye(17)),Wr(this),this.s=2,Zi(this)):Bm(this,this.Y-r)};function Zi(r){r.l.H==0||r.J||cg(r.l,r)}function Wr(r){ua(r);var e=r.M;e&&typeof e.sa=="function"&&e.sa(),r.M=null,el(r.V),xm(r.U),r.g&&(e=r.g,r.g=null,e.abort(),e.sa())}function Uc(r,e){try{var t=r.l;if(t.H!=0&&(t.g==r||Bc(t.i,r))){if(!r.K&&Bc(t.i,r)&&t.H==3){try{var n=t.Ja.g.parse(e)}catch{n=null}if(Array.isArray(n)&&n.length==3){var i=n;if(i[0]==0){e:if(!t.u){if(t.g)if(t.g.G+3e3<r.G)Ho(t),da(t);else break e;cl(t),Ye(18)}}else t.Fa=i[1],0<t.Fa-t.V&&37500>i[2]&&t.G&&t.A==0&&!t.v&&(t.v=ls(je(t.ib,t),6e3));if(1>=Hm(t.i)&&t.oa){try{t.oa()}catch{}t.oa=void 0}}else Qr(t,11)}else if((r.K||t.g==r)&&Ho(t),!es(e))for(i=t.Ja.g.parse(e),e=0;e<i.length;e++){let c=i[e];if(t.V=c[0],c=c[1],t.H==2)if(c[0]=="c"){t.K=c[1],t.pa=c[2];let l=c[3];l!=null&&(t.ra=l,t.l.info("VER="+t.ra));let h=c[4];h!=null&&(t.Ga=h,t.l.info("SVER="+t.Ga));let d=c[5];d!=null&&typeof d=="number"&&0<d&&(n=1.5*d,t.L=n,t.l.info("backChannelRequestTimeoutMs_="+n)),n=t;let m=r.g;if(m){let w=m.g?m.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(w){var s=n.i;s.g||w.indexOf("spdy")==-1&&w.indexOf("quic")==-1&&w.indexOf("h2")==-1||(s.j=s.l,s.g=new Set,s.h&&(sl(s,s.h),s.h=null))}if(n.F){let T=m.g?m.g.getResponseHeader("X-HTTP-Session-Id"):null;T&&(n.Da=T,ce(n.I,n.F,T))}}t.H=3,t.h&&t.h.Ba(),t.ca&&(t.S=Date.now()-r.G,t.l.info("Handshake RTT: "+t.S+"ms")),n=t;var o=r;if(n.wa=dg(n,n.J?n.pa:null,n.Y),o.K){Ym(n.i,o);var a=o,u=n.L;u&&a.setTimeout(u),a.C&&(ua(a),fs(a)),n.g=o}else ag(n);0<t.j.length&&fa(t)}else c[0]!="stop"&&c[0]!="close"||Qr(t,7);else t.H==3&&(c[0]=="stop"||c[0]=="close"?c[0]=="stop"?Qr(t,7):ul(t):c[0]!="noop"&&t.h&&t.h.Aa(c),t.A=0)}}ss(4)}catch{}}function LI(r){if(r.Z&&typeof r.Z=="function")return r.Z();if(typeof Map<"u"&&r instanceof Map||typeof Set<"u"&&r instanceof Set)return Array.from(r.values());if(typeof r=="string")return r.split("");if(Zo(r)){for(var e=[],t=r.length,n=0;n<t;n++)e.push(r[n]);return e}e=[],t=0;for(n in r)e[t++]=r[n];return e}function qI(r){if(r.ta&&typeof r.ta=="function")return r.ta();if(!r.Z||typeof r.Z!="function"){if(typeof Map<"u"&&r instanceof Map)return Array.from(r.keys());if(!(typeof Set<"u"&&r instanceof Set)){if(Zo(r)||typeof r=="string"){var e=[];r=r.length;for(var t=0;t<r;t++)e.push(t);return e}e=[],t=0;for(let n in r)e[t++]=n;return e}}}function jm(r,e){if(r.forEach&&typeof r.forEach=="function")r.forEach(e,void 0);else if(Zo(r)||typeof r=="string")Array.prototype.forEach.call(r,e,void 0);else for(var t=qI(r),n=LI(r),i=n.length,s=0;s<i;
vendor: 18,893 bytes, lines 16-19
16s++)e.call(void 0,n[s],t&&t[s],r)}var $m=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function UI(r,e){if(r){r=r.split("&");for(var t=0;t<r.length;t++){var n=r[t].indexOf("="),i=null;if(0<=n){var s=r[t].substring(0,n);i=r[t].substring(n+1)}else s=r[t];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}function Hr(r){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,r instanceof Hr){this.h=r.h,Wo(this,r.j),this.s=r.s,this.g=r.g,Qo(this,r.m),this.l=r.l;var e=r.i,t=new os;t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),um(this,t),this.o=r.o}else r&&(e=String(r).match($m))?(this.h=!1,Wo(this,e[1]||"",!0),this.s=Ji(e[2]||""),this.g=Ji(e[3]||"",!0),Qo(this,e[4]),this.l=Ji(e[5]||"",!0),um(this,e[6]||"",!0),this.o=Ji(e[7]||"")):(this.h=!1,this.i=new os(null,this.h))}Hr.prototype.toString=function(){var r=[],e=this.j;e&&r.push(Xi(e,cm,!0),":");var t=this.g;return(t||e=="file")&&(r.push("//"),(e=this.s)&&r.push(Xi(e,cm,!0),"@"),r.push(encodeURIComponent(String(t)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t=this.m,t!=null&&r.push(":",String(t))),(t=this.l)&&(this.g&&t.charAt(0)!="/"&&r.push("/"),r.push(Xi(t,t.charAt(0)=="/"?$I:jI,!0))),(t=this.i.toString())&&r.push("?",t),(t=this.o)&&r.push("#",Xi(t,KI)),r.join("")};function Gt(r){return new Hr(r)}function Wo(r,e,t){r.j=t?Ji(e,!0):e,r.j&&(r.j=r.j.replace(/:$/,""))}function Qo(r,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);r.m=e}else r.m=null}function um(r,e,t){e instanceof os?(r.i=e,GI(r.i,r.h)):(t||(e=Xi(e,zI)),r.i=new os(e,r.h))}function ce(r,e,t){r.i.set(e,t)}function ca(r){return ce(r,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),r}function Ji(r,e){return r?e?decodeURI(r.replace(/%25/g,"%2525")):decodeURIComponent(r):""}function Xi(r,e,t){return typeof r=="string"?(r=encodeURI(r).replace(e,BI),t&&(r=r.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),r):null}function BI(r){return r=r.charCodeAt(0),"%"+(r>>4&15).toString(16)+(r&15).toString(16)}var cm=/[#\/\?@]/g,jI=/[#\?:]/g,$I=/[#\?]/g,zI=/[#\?@]/g,KI=/#/g;function os(r,e){this.h=this.g=null,this.i=r||null,this.j=!!e}function dr(r){r.g||(r.g=new Map,r.h=0,r.i&&UI(r.i,function(e,t){r.add(decodeURIComponent(e.replace(/\+/g," ")),t)}))}D=os.prototype;D.add=function(r,e){dr(this),this.i=null,r=Gn(this,r);var t=this.g.get(r);return t||this.g.set(r,t=[]),t.push(e),this.h+=1,this};function zm(r,e){dr(r),e=Gn(r,e),r.g.has(e)&&(r.i=null,r.h-=r.g.get(e).length,r.g.delete(e))}function Km(r,e){return dr(r),e=Gn(r,e),r.g.has(e)}D.forEach=function(r,e){dr(this),this.g.forEach(function(t,n){t.forEach(function(i){r.call(e,i,n,this)},this)},this)};D.ta=function(){dr(this);let r=Array.from(this.g.values()),e=Array.from(this.g.keys()),t=[];for(let n=0;n<e.length;n++){let i=r[n];for(let s=0;s<i.length;s++)t.push(e[n])}return t};D.Z=function(r){dr(this);let e=[];if(typeof r=="string")Km(this,r)&&(e=e.concat(this.g.get(Gn(this,r))));else{r=Array.from(this.g.values());for(let t=0;t<r.length;t++)e=e.concat(r[t])}return e};D.set=function(r,e){return dr(this),this.i=null,r=Gn(this,r),Km(this,r)&&(this.h-=this.g.get(r).length),this.g.set(r,[e]),this.h+=1,this};D.get=function(r,e){return r?(r=this.Z(r),0<r.length?String(r[0]):e):e};function Gm(r,e,t){zm(r,e),0<t.length&&(r.i=null,r.g.set(Gn(r,e),Kc(t)),r.h+=t.length)}D.toString=function(){if(this.i)return this.i;if(!this.g)return"";let r=[],e=Array.from(this.g.keys());for(var t=0;t<e.length;t++){var n=e[t];let s=encodeURIComponent(String(n)),o=this.Z(n);for(n=0;n<o.length;n++){var i=s;o[n]!==""&&(i+="="+encodeURIComponent(String(o[n]))),r.push(i)}}return this.i=r.join("&")};function Gn(r,e){return e=String(e),r.j&&(e=e.toLowerCase()),e}function GI(r,e){e&&!r.j&&(dr(r),r.i=null,r.g.forEach(function(t,n){var i=n.toLowerCase();n!=i&&(zm(this,n),Gm(this,i,t))},r)),r.j=e}var WI=class{constructor(r,e){this.g=r,this.map=e}};function Wm(r){this.l=r||QI,z.PerformanceNavigationTiming?(r=z.performance.getEntriesByType("navigation"),r=0<r.length&&(r[0].nextHopProtocol=="hq"||r[0].nextHopProtocol=="h2")):r=!!(z.g&&z.g.Ka&&z.g.Ka()&&z.g.Ka().dc),this.j=r?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var QI=10;function Qm(r){return r.h?!0:r.g?r.g.size>=r.j:!1}function Hm(r){return r.h?1:r.g?r.g.size:0}function Bc(r,e){return r.h?r.h==e:r.g?r.g.has(e):!1}function sl(r,e){r.g?r.g.add(e):r.h=e}function Ym(r,e){r.h&&r.h==e?r.h=null:r.g&&r.g.has(e)&&r.g.delete(e)}Wm.prototype.cancel=function(){if(this.i=Jm(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let r of this.g.values())r.cancel();this.g.clear()}};function Jm(r){if(r.h!=null)return r.i.concat(r.h.F);if(r.g!=null&&r.g.size!==0){let e=r.i;for(let t of r.g.values())e=e.concat(t.F);return e}return Kc(r.i)}var HI=class{stringify(r){return z.JSON.stringify(r,void 0)}parse(r){return z.JSON.parse(r,void 0)}};function YI(){this.g=new HI}function JI(r,e,t){let n=t||"";try{jm(r,function(i,s){let o=i;us(i)&&(o=Xc(i)),e.push(n+s+"="+encodeURIComponent(o))})}catch(i){throw e.push(n+"type="+encodeURIComponent("_badmap")),i}}function XI(r,e){let t=new ia;if(z.Image){let n=new Image;n.onload=Uo(Ko,t,n,"TestLoadImage: loaded",!0,e),n.onerror=Uo(Ko,t,n,"TestLoadImage: error",!1,e),n.onabort=Uo(Ko,t,n,"TestLoadImage: abort",!1,e),n.ontimeout=Uo(Ko,t,n,"TestLoadImage: timeout",!1,e),z.setTimeout(function(){n.ontimeout&&n.ontimeout()},1e4),n.src=r}else e(!1)}function Ko(r,e,t,n,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(n)}catch{}}function ps(r){this.l=r.ec||null,this.j=r.ob||!1}Ve(ps,rl);ps.prototype.g=function(){return new la(this.l,this.j)};ps.prototype.i=function(r){return function(){return r}}({});function la(r,e){Ne.call(this),this.F=r,this.u=e,this.m=void 0,this.readyState=ol,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}Ve(la,Ne);var ol=0;D=la.prototype;D.open=function(r,e){if(this.readyState!=ol)throw this.abort(),Error("Error reopening a connection");this.C=r,this.B=e,this.readyState=1,as(this)};D.send=function(r){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;let e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};r&&(e.body=r),(this.F||z).fetch(new Request(this.B,e)).then(this.$a.bind(this),this.ka.bind(this))};D.abort=function(){this.response=this.responseText="",this.v=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,ms(this)),this.readyState=ol};D.$a=function(r){if(this.g&&(this.l=r,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=r.headers,this.readyState=2,as(this)),this.g&&(this.readyState=3,as(this),this.g)))if(this.responseType==="arraybuffer")r.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(typeof z.ReadableStream<"u"&&"body"in r){if(this.j=r.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Xm(this)}else r.text().then(this.Za.bind(this),this.ka.bind(this))};function Xm(r){r.j.read().then(r.Xa.bind(r)).catch(r.ka.bind(r))}D.Xa=function(r){if(this.g){if(this.u&&r.value)this.response.push(r.value);else if(!this.u){var e=r.value?r.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!r.done}))&&(this.response=this.responseText+=e)}r.done?ms(this):as(this),this.readyState==3&&Xm(this)}};D.Za=function(r){this.g&&(this.response=this.responseText=r,ms(this))};D.Ya=function(r){this.g&&(this.response=r,ms(this))};D.ka=function(){this.g&&ms(this)};function ms(r){r.readyState=4,r.l=null,r.j=null,r.A=null,as(r)}D.setRequestHeader=function(r,e){this.v.append(r,e)};D.getResponseHeader=function(r){return this.h&&this.h.get(r.toLowerCase())||""};D.getAllResponseHeaders=function(){if(!this.h)return"";let r=[],e=this.h.entries();for(var t=e.next();!t.done;)t=t.value,r.push(t[0]+": "+t[1]),t=e.next();return r.join(`\r
17`)};function as(r){r.onreadystatechange&&r.onreadystatechange.call(r)}Object.defineProperty(la.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(r){this.m=r?"include":"same-origin"}});var ZI=z.JSON.parse;function ve(r){Ne.call(this),this.headers=new Map,this.u=r||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=Zm,this.L=this.M=!1}Ve(ve,Ne);var Zm="",eE=/^https?$/i,tE=["POST","PUT"];D=ve.prototype;D.Oa=function(r){this.M=r};D.ha=function(r,e,t,n){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+r);e=e?e.toUpperCase():"GET",this.I=r,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():Mc.g(),this.C=this.u?am(this.u):am(Mc),this.g.onreadystatechange=je(this.La,this);try{this.G=!0,this.g.open(e,String(r),!0),this.G=!1}catch(s){lm(this,s);return}if(r=t||"",t=new Map(this.headers),n)if(Object.getPrototypeOf(n)===Object.prototype)for(var i in n)t.set(i,n[i]);else if(typeof n.keys=="function"&&typeof n.get=="function")for(let s of n.keys())t.set(s,n.get(s));else throw Error("Unknown input type for opt_headers: "+String(n));n=Array.from(t.keys()).find(s=>s.toLowerCase()=="content-type"),i=z.FormData&&r instanceof z.FormData,!(0<=mm(tE,e))||n||i||t.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(let[s,o]of t)this.g.setRequestHeader(s,o);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{rg(this),0<this.B&&((this.L=rE(this.g))?(this.g.timeout=this.B,this.g.ontimeout=je(this.ua,this)):this.A=tl(this.ua,this.B,this)),this.v=!0,this.g.send(r),this.v=!1}catch(s){lm(this,s)}};function rE(r){return Kn&&typeof r.timeout=="number"&&r.ontimeout!==void 0}D.ua=function(){typeof zc<"u"&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Ue(this,"timeout"),this.abort(8))};function lm(r,e){r.h=!1,r.g&&(r.l=!0,r.g.abort(),r.l=!1),r.j=e,r.m=5,eg(r),ha(r)}function eg(r){r.F||(r.F=!0,Ue(r,"complete"),Ue(r,"error"))}D.abort=function(r){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=r||7,Ue(this,"complete"),Ue(this,"abort"),ha(this))};D.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),ha(this,!0)),ve.$.N.call(this)};D.La=function(){this.s||(this.G||this.v||this.l?tg(this):this.kb())};D.kb=function(){tg(this)};function tg(r){if(r.h&&typeof zc<"u"&&(!r.C[1]||kt(r)!=4||r.da()!=2)){if(r.v&&kt(r)==4)tl(r.La,0,r);else if(Ue(r,"readystatechange"),kt(r)==4){r.h=!1;try{let o=r.da();e:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break e;default:e=!1}var t;if(!(t=e)){var n;if(n=o===0){var i=String(r.I).match($m)[1]||null;!i&&z.self&&z.self.location&&(i=z.self.location.protocol.slice(0,-1)),n=!eE.test(i?i.toLowerCase():"")}t=n}if(t)Ue(r,"complete"),Ue(r,"success");else{r.m=6;try{var s=2<kt(r)?r.g.statusText:""}catch{s=""}r.j=s+" ["+r.da()+"]",eg(r)}}finally{ha(r)}}}}function ha(r,e){if(r.g){rg(r);let t=r.g,n=r.C[0]?()=>{}:null;r.g=null,r.C=null,e||Ue(r,"ready");try{t.onreadystatechange=n}catch{}}}function rg(r){r.g&&r.L&&(r.g.ontimeout=null),r.A&&(z.clearTimeout(r.A),r.A=null)}D.isActive=function(){return!!this.g};function kt(r){return r.g?r.g.readyState:0}D.da=function(){try{return 2<kt(this)?this.g.status:-1}catch{return-1}};D.ja=function(){try{return this.g?this.g.responseText:""}catch{return""}};D.Wa=function(r){if(this.g){var e=this.g.responseText;return r&&e.indexOf(r)==0&&(e=e.substring(r.length)),ZI(e)}};function hm(r){try{if(!r.g)return null;if("response"in r.g)return r.g.response;switch(r.K){case Zm:case"text":return r.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in r.g)return r.g.mozResponseArrayBuffer}return null}catch{return null}}function nE(r){let e={};r=(r.g&&2<=kt(r)&&r.g.getAllResponseHeaders()||"").split(`\r
18`);for(let n=0;n<r.length;n++){if(es(r[n]))continue;var t=CI(r[n]);let i=t[0];if(t=t[1],typeof t!="string")continue;t=t.trim();let s=e[i]||[];e[i]=s,s.push(t)}SI(e,function(n){return n.join(", ")})}D.Ia=function(){return this.m};D.Sa=function(){return typeof this.j=="string"?this.j:String(this.j)};function ng(r){let e="";return Wc(r,function(t,n){e+=n,e+=":",e+=t,e+=`\r
19`}),e}function al(r,e,t){e:{for(n in t){var n=!1;break e}n=!0}n||(t=ng(t),typeof r=="string"?t!=null&&encodeURIComponent(String(t)):ce(r,e,t))}function Hi(r,e,t){return t&&t.internalChannelParams&&t.internalChannelParams[r]||e}function ig(r){this.Ga=0,this.j=[],this.l=new ia,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=Hi("failFast",!1,r),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=Hi("baseRetryDelayMs",5e3,r),this.hb=Hi("retryDelaySeedMs",1e4,r),this.eb=Hi("forwardChannelMaxRetries",2,r),this.xa=Hi("forwardChannelRequestTimeoutMs",2e4,r),this.va=r&&r.xmlHttpFactory||void 0,this.Ha=r&&r.useFetchStreams||!1,this.L=void 0,this.J=r&&r.supportsCrossDomainXhr||!1,this.K="",this.i=new Wm(r&&r.concurrentRequestLimit),this.Ja=new YI,this.P=r&&r.fastHandshake||!1,this.O=r&&r.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=r&&r.bc||!1,r&&r.Ea&&this.l.Ea(),r&&r.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&r&&r.detectBufferingProxy||!1,this.qa=void 0,r&&r.longPollingTimeout&&0<r.longPollingTimeout&&(this.qa=r.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}D=ig.prototype;D.ra=8;D.H=1;function ul(r){if(sg(r),r.H==3){var e=r.W++,t=Gt(r.I);if(ce(t,"SID",r.K),ce(t,"RID",e),ce(t,"TYPE","terminate"),gs(r,t),e=new ds(r,r.l,e),e.L=2,e.A=ca(Gt(t)),t=!1,z.navigator&&z.navigator.sendBeacon)try{t=z.navigator.sendBeacon(e.A.toString(),"")}catch{}!t&&z.Image&&(new Image().src=e.A,t=!0),t||(e.g=fg(e.l,null),e.g.ha(e.A)),e.G=Date.now(),fs(e)}hg(r)}function da(r){r.g&&(ll(r),r.g.cancel(),r.g=null)}function sg(r){da(r),r.u&&(z.clearTimeout(r.u),r.u=null),Ho(r),r.i.cancel(),r.m&&(typeof r.m=="number"&&z.clearTimeout(r.m),r.m=null)}function fa(r){if(!Qm(r.i)&&!r.m){r.m=!0;var e=r.Na;rs||km(),ns||(rs(),ns=!0),Zc.add(e,r),r.C=0}}function iE(r,e){return Hm(r.i)>=r.i.j-(r.m?1:0)?!1:r.m?(r.j=e.F.concat(r.j),!0):r.H==1||r.H==2||r.C>=(r.cb?0:r.eb)?!1:(r.m=ls(je(r.Na,r,e),lg(r,r.C)),r.C++,!0)}D.Na=function(r){if(this.m)if(this.m=null,this.H==1){if(!r){this.W=Math.floor(1e5*Math.random()),r=this.W++;let i=new ds(this,this.l,r),s=this.s;if(this.U&&(s?(s=vm(s),wm(s,this.U)):s=this.U),this.o!==null||this.O||(i.I=s,s=null),this.P)e:{for(var e=0,t=0;t<this.j.length;t++){t:{var n=this.j[t];if("__data__"in n.map&&(n=n.map.__data__,typeof n=="string")){n=n.length;break t}n=void 0}if(n===void 0)break;if(e+=n,4096<e){e=t;break e}if(e===4096||t===this.j.length-1){e=t+1;break e}}e=1e3}else e=1e3;e=og(this,i,e),t=Gt(this.I),ce(t,"RID",r),ce(t,"CVER",22),this.F&&ce(t,"X-HTTP-Session-Id",this.F),gs(this,t),s&&(this.O?e="headers="+encodeURIComponent(String(ng(s)))+"&"+e:this.o&&al(t,this.o,s)),sl(this.i,i),this.bb&&ce(t,"TYPE","init"),this.P?(ce(t,"$req",e),ce(t,"SID","null"),i.aa=!0,qc(i,t,null)):qc(i,t,e),this.H=2}}else this.H==3&&(r?dm(this,r):this.j.length==0||Qm(this.i)||dm(this))};function dm(r,e){var t;e?t=e.m:t=r.W++;let n=Gt(r.I);ce(n,"SID",r.K),ce(n,"RID",t),ce(n,"AID",r.V),gs(r,n),r.o&&r.s&&al(n,r.o,r.s),t=new ds(r,r.l,t,r.C+1),r.o===null&&(t.I=r.s),e&&(r.j=e.F.concat(r.j)),e=og(r,t,1e3),t.setTimeout(Math.round(.5*r.xa)+Math.round(.5*r.xa*Math.random())),sl(r.i,t),qc(t,n,e)}function gs(r,e){r.na&&Wc(r.na,function(t,n){ce(e,n,t)}),r.h&&jm({},function(t,n){ce(e,n,t)})}function og(r,e,t){t=Math.min(r.j.length,t);var n=r.h?je(r.h.Va,r.h,r):null;e:{var i=r.j;let s=-1;for(;;){let o=["count="+t];s==-1?0<t?(s=i[0].g,o.push("ofs="+s)):s=0:o.push("ofs="+s);let a=!0;for(let u=0;u<t;u++){let c=i[u].g,l=i[u].map;if(c-=s,0>c)s=Math.max(0,i[u].g-100),a=!1;else try{JI(l,o,"req"+c+"_")}catch{n&&n(l)}}if(a){n=o.join("&");break e}}}return r=r.j.splice(0,t),e.F=r,n}function ag(r){if(!r.g&&!r.u){r.ba=1;var e=r.Ma;rs||km(),ns||(rs(),ns=!0),Zc.add(e,r),r.A=0}}function cl(r){return r.g||r.u||3<=r.A?!1:(r.ba++,r.u=ls(je(r.Ma,r),lg(r,r.A)),r.A++,!0)}D.Ma=function(){if(this.u=null,ug(this),this.ca&&!(this.M||this.g==null||0>=this.S)){var r=2*this.S;this.l.info("BP detection timer enabled: "+r),this.B=ls(je(this.jb,this),r)}};D.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,Ye(10),da(this),ug(this))};function ll(r){r.B!=null&&(z.clearTimeout(r.B),r.B=null)}function ug(r){r.g=new ds(r,r.l,"rpc",r.ba),r.o===null&&(r.g.I=r.s),r.g.O=0;var e=Gt(r.wa);ce(e,"RID","rpc"),ce(e,"SID",r.K),ce(e,"AID",r.V),ce(e,"CI",r.G?"0":"1"),!r.G&&r.qa&&ce(e,"TO",r.qa),ce(e,"TYPE","xmlhttp"),gs(r,e),r.o&&r.s&&al(e,r.o,r.s),r.L&&r.g.setTimeout(r.L);var t=r.g;r=r.pa,t.L=1,t.A=ca(Gt(e)),t.u=null,t.S=!0,Lm(t,r)}D.ib=function(){this.v!=null&&(this.v=null,da(this),cl(this),Ye(19))};function Ho(r){r.v!=null&&(z.clearTimeout(r.v),r.v=null)}function cg(r,e){var t=null;if(r.g==e){Ho(r),ll(r),r.g=null;var n=2}else if(Bc(r.i,e))t=e.F,Ym(r.i,e),n=1;else return;if(r.H!=0){if(e.i)if(n==1){t=e.u?e.u.length:0,e=Date.now()-e.G;var i=r.C;n=sa(),Ue(n,new Nm(n,t)),fa(r)}else ag(r);else if(i=e.s,i==3||i==0&&0<e.ca||!(n==1&&iE(r,e)||n==2&&cl(r)))switch(t&&0<t.length&&(e=r.i,e.i=e.i.concat(t)),i){case 1:Qr(r,5);break;case 4:Qr(r,10);break;case 3:Qr(r,6);break;default:Qr(r,2)}}}function lg(r,e){let t=r.ab+Math.floor(Math.random()*r.hb);return r.isActive()||(t*=2),t*e}function Qr(r,e){if(r.l.info("Error code "+e),e==2){var t=null;r.h&&(t=null);var n=je(r.pb,r);t||(t=new Hr("//www.google.com/images/cleardot.gif"),z.location&&z.location.protocol=="http"||Wo(t,"https"),ca(t)),XI(t.toString(),n)}else Ye(2);r.H=0,r.h&&r.h.za(e),hg(r),sg(r)}D.pb=function(r){r?(this.l.info("Successfully pinged google.com"),Ye(2)):(this.l.info("Failed to ping google.com"),Ye(1))};function hg(r){if(r.H=0,r.ma=[],r.h){let e=Jm(r.i);(e.length!=0||r.j.length!=0)&&(nm(r.ma,e),nm(r.ma,r.j),r.i.i.length=0,Kc(r.j),r.j.length=0),r.h.ya()}}function dg(r,e,t){var n=t instanceof Hr?Gt(t):new Hr(t);if(n.g!="")e&&(n.g=e+"."+n.g),Qo(n,n.m);else{var i=z.location;n=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Hr(null);n&&Wo(s,n),e&&(s.g=e),i&&Qo(s,i),t&&(s.l=t),n=s}return t=r.F,e=r.Da,t&&e&&ce(n,t,e),ce(n,"VER",r.ra),gs(r,n),n}function fg(r,e,t){if(e&&!r.J)throw Error("Can't create secondary domain capable XhrIo object.");
19return e=r.Ha&&!r.va?new ve(new ps({ob:t})):new ve(r.va),e.Oa(r.J),e}D.isActive=function(){return!!this.h&&this.h.isActive(this)};function pg(){}D=pg.prototype;D.Ba=function(){};D.Aa=function(){};D.za=function(){};D.ya=function(){};D.isActive=function(){return!0};D.Va=function(){};function Yo(){if(Kn&&!(10<=Number(II)))throw Error("Environmental error: no available transport.")}Yo.prototype.g=function(r,e){return new it(r,e)};function it(r,e){Ne.call(this),this.g=new ig(e),this.l=r,this.h=e&&e.messageUrlParams||null,r=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(r?r["X-Client-Protocol"]="webchannel":r={"X-Client-Protocol":"webchannel"}),this.g.s=r,r=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(r?r["X-WebChannel-Content-Type"]=e.messageContentType:r={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.Ca&&(r?r["X-WebChannel-Client-Profile"]=e.Ca:r={"X-WebChannel-Client-Profile":e.Ca}),this.g.U=r,(r=e&&e.cc)&&!es(r)&&(this.g.o=r),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!es(e)&&(this.g.F=e,r=this.h,r!==null&&e in r&&(r=this.h,e in r&&delete r[e])),this.j=new Wn(this)}Ve(it,Ne);it.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var r=this.g,e=this.l,t=this.h||void 0;Ye(0),r.Y=e,r.na=t||{},r.G=r.aa,r.I=dg(r,null,r.Y),fa(r)};it.prototype.close=function(){ul(this.g)};it.prototype.u=function(r){var e=this.g;if(typeof r=="string"){var t={};t.__data__=r,r=t}else this.v&&(t={},t.__data__=Xc(r),r=t);e.j.push(new WI(e.fb++,r)),e.H==3&&fa(e)};it.prototype.N=function(){this.g.h=null,delete this.j,ul(this.g),delete this.g,it.$.N.call(this)};function mg(r){nl.call(this),r.__headers__&&(this.headers=r.__headers__,this.statusCode=r.__status__,delete r.__headers__,delete r.__status__);var e=r.__sm__;if(e){e:{for(let t in e){r=t;break e}r=void 0}(this.i=r)&&(r=this.i,e=e!==null&&r in e?e[r]:void 0),this.data=e}else this.data=r}Ve(mg,nl);function gg(){il.call(this),this.status=1}Ve(gg,il);function Wn(r){this.g=r}Ve(Wn,pg);Wn.prototype.Ba=function(){Ue(this.g,"a")};Wn.prototype.Aa=function(r){Ue(this.g,new mg(r))};Wn.prototype.za=function(r){Ue(this.g,new gg)};Wn.prototype.ya=function(){Ue(this.g,"b")};function sE(){this.blockSize=-1}function gt(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}Ve(gt,sE);gt.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0};function kc(r,e,t){t||(t=0);var n=Array(16);if(typeof e=="string")for(var i=0;16>i;++i)n[i]=e.charCodeAt(t++)|e.charCodeAt(t++)<<8|e.charCodeAt(t++)<<16|e.charCodeAt(t++)<<24;else for(i=0;16>i;++i)n[i]=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;e=r.g[0],t=r.g[1],i=r.g[2];var s=r.g[3],o=e+(s^t&(i^s))+n[0]+3614090360&4294967295;e=t+(o<<7&4294967295|o>>>25),o=s+(i^e&(t^i))+n[1]+3905402710&4294967295,s=e+(o<<12&4294967295|o>>>20),o=i+(t^s&(e^t))+n[2]+606105819&4294967295,i=s+(o<<17&4294967295|o>>>15),o=t+(e^i&(s^e))+n[3]+3250441966&4294967295,t=i+(o<<22&4294967295|o>>>10),o=e+(s^t&(i^s))+n[4]+4118548399&4294967295,e=t+(o<<7&4294967295|o>>>25),o=s+(i^e&(t^i))+n[5]+1200080426&4294967295,s=e+(o<<12&4294967295|o>>>20),o=i+(t^s&(e^t))+n[6]+2821735955&4294967295,i=s+(o<<17&4294967295|o>>>15),o=t+(e^i&(s^e))+n[7]+4249261313&4294967295,t=i+(o<<22&4294967295|o>>>10),o=e+(s^t&(i^s))+n[8]+1770035416&4294967295,e=t+(o<<7&4294967295|o>>>25),o=s+(i^e&(t^i))+n[9]+2336552879&4294967295,s=e+(o<<12&4294967295|o>>>20),o=i+(t^s&(e^t))+n[10]+4294925233&4294967295,i=s+(o<<17&4294967295|o>>>15),o=t+(e^i&(s^e))+n[11]+2304563134&4294967295,t=i+(o<<22&4294967295|o>>>10),o=e+(s^t&(i^s))+n[12]+1804603682&4294967295,e=t+(o<<7&4294967295|o>>>25),o=s+(i^e&(t^i))+n[13]+4254626195&4294967295,s=e+(o<<12&4294967295|o>>>20),o=i+(t^s&(e^t))+n[14]+2792965006&4294967295,i=s+(o<<17&4294967295|o>>>15),o=t+(e^i&(s^e))+n[15]+1236535329&4294967295,t=i+(o<<22&4294967295|o>>>10),o=e+(i^s&(t^i))+n[1]+4129170786&4294967295,e=t+(o<<5&4294967295|o>>>27),o=s+(t^i&(e^t))+n[6]+3225465664&4294967295,s=e+(o<<9&4294967295|o>>>23),o=i+(e^t&(s^e))+n[11]+643717713&4294967295,i=s+(o<<14&4294967295|o>>>18),o=t+(s^e&(i^s))+n[0]+3921069994&4294967295,t=i+(o<<20&4294967295|o>>>12),o=e+(i^s&(t^i))+n[5]+3593408605&4294967295,e=t+(o<<5&4294967295|o>>>27),o=s+(t^i&(e^t))+n[10]+38016083&4294967295,s=e+(o<<9&4294967295|o>>>23),o=i+(e^t&(s^e))+n[15]+3634488961&4294967295,i=s+(o<<14&4294967295|o>>>18),o=t+(s^e&(i^s))+n[4]+3889429448&4294967295,t=i+(o<<20&4294967295|o>>>12),o=e+(i^s&(t^i))+n[9]+568446438&4294967295,e=t+(o<<5&4294967295|o>>>27),o=s+(t^i&(e^t))+n[14]+3275163606&4294967295,s=e+(o<<9&4294967295|o>>>23),o=i+(e^t&(s^e))+n[3]+4107603335&4294967295,i=s+(o<<14&4294967295|o>>>18),o=t+(s^e&(i^s))+n[8]+1163531501&4294967295,t=i+(o<<20&4294967295|o>>>12),o=e+(i^s&(t^i))+n[13]+2850285829&4294967295,e=t+(o<<5&4294967295|o>>>27),o=s+(t^i&(e^t))+n[2]+4243563512&4294967295,s=e+(o<<9&4294967295|o>>>23),o=i+(e^t&(s^e))+n[7]+1735328473&4294967295,i=s+(o<<14&4294967295|o>>>18),o=t+(s^e&(i^s))+n[12]+2368359562&4294967295,t=i+(o<<20&4294967295|o>>>
vendor: 18,805 bytes, line 19
1912),o=e+(t^i^s)+n[5]+4294588738&4294967295,e=t+(o<<4&4294967295|o>>>28),o=s+(e^t^i)+n[8]+2272392833&4294967295,s=e+(o<<11&4294967295|o>>>21),o=i+(s^e^t)+n[11]+1839030562&4294967295,i=s+(o<<16&4294967295|o>>>16),o=t+(i^s^e)+n[14]+4259657740&4294967295,t=i+(o<<23&4294967295|o>>>9),o=e+(t^i^s)+n[1]+2763975236&4294967295,e=t+(o<<4&4294967295|o>>>28),o=s+(e^t^i)+n[4]+1272893353&4294967295,s=e+(o<<11&4294967295|o>>>21),o=i+(s^e^t)+n[7]+4139469664&4294967295,i=s+(o<<16&4294967295|o>>>16),o=t+(i^s^e)+n[10]+3200236656&4294967295,t=i+(o<<23&4294967295|o>>>9),o=e+(t^i^s)+n[13]+681279174&4294967295,e=t+(o<<4&4294967295|o>>>28),o=s+(e^t^i)+n[0]+3936430074&4294967295,s=e+(o<<11&4294967295|o>>>21),o=i+(s^e^t)+n[3]+3572445317&4294967295,i=s+(o<<16&4294967295|o>>>16),o=t+(i^s^e)+n[6]+76029189&4294967295,t=i+(o<<23&4294967295|o>>>9),o=e+(t^i^s)+n[9]+3654602809&4294967295,e=t+(o<<4&4294967295|o>>>28),o=s+(e^t^i)+n[12]+3873151461&4294967295,s=e+(o<<11&4294967295|o>>>21),o=i+(s^e^t)+n[15]+530742520&4294967295,i=s+(o<<16&4294967295|o>>>16),o=t+(i^s^e)+n[2]+3299628645&4294967295,t=i+(o<<23&4294967295|o>>>9),o=e+(i^(t|~s))+n[0]+4096336452&4294967295,e=t+(o<<6&4294967295|o>>>26),o=s+(t^(e|~i))+n[7]+1126891415&4294967295,s=e+(o<<10&4294967295|o>>>22),o=i+(e^(s|~t))+n[14]+2878612391&4294967295,i=s+(o<<15&4294967295|o>>>17),o=t+(s^(i|~e))+n[5]+4237533241&4294967295,t=i+(o<<21&4294967295|o>>>11),o=e+(i^(t|~s))+n[12]+1700485571&4294967295,e=t+(o<<6&4294967295|o>>>26),o=s+(t^(e|~i))+n[3]+2399980690&4294967295,s=e+(o<<10&4294967295|o>>>22),o=i+(e^(s|~t))+n[10]+4293915773&4294967295,i=s+(o<<15&4294967295|o>>>17),o=t+(s^(i|~e))+n[1]+2240044497&4294967295,t=i+(o<<21&4294967295|o>>>11),o=e+(i^(t|~s))+n[8]+1873313359&4294967295,e=t+(o<<6&4294967295|o>>>26),o=s+(t^(e|~i))+n[15]+4264355552&4294967295,s=e+(o<<10&4294967295|o>>>22),o=i+(e^(s|~t))+n[6]+2734768916&4294967295,i=s+(o<<15&4294967295|o>>>17),o=t+(s^(i|~e))+n[13]+1309151649&4294967295,t=i+(o<<21&4294967295|o>>>11),o=e+(i^(t|~s))+n[4]+4149444226&4294967295,e=t+(o<<6&4294967295|o>>>26),o=s+(t^(e|~i))+n[11]+3174756917&4294967295,s=e+(o<<10&4294967295|o>>>22),o=i+(e^(s|~t))+n[2]+718787259&4294967295,i=s+(o<<15&4294967295|o>>>17),o=t+(s^(i|~e))+n[9]+3951481745&4294967295,r.g[0]=r.g[0]+e&4294967295,r.g[1]=r.g[1]+(i+(o<<21&4294967295|o>>>11))&4294967295,r.g[2]=r.g[2]+i&4294967295,r.g[3]=r.g[3]+s&4294967295}gt.prototype.j=function(r,e){e===void 0&&(e=r.length);for(var t=e-this.blockSize,n=this.m,i=this.h,s=0;s<e;){if(i==0)for(;s<=t;)kc(this,r,s),s+=this.blockSize;if(typeof r=="string"){for(;s<e;)if(n[i++]=r.charCodeAt(s++),i==this.blockSize){kc(this,n),i=0;break}}else for(;s<e;)if(n[i++]=r[s++],i==this.blockSize){kc(this,n),i=0;break}}this.h=i,this.i+=e};gt.prototype.l=function(){var r=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);r[0]=128;for(var e=1;e<r.length-8;++e)r[e]=0;var t=8*this.i;for(e=r.length-8;e<r.length;++e)r[e]=t&255,t/=256;for(this.j(r),r=Array(16),e=t=0;4>e;++e)for(var n=0;32>n;n+=8)r[t++]=this.g[e]>>>n&255;return r};function re(r,e){this.h=e;for(var t=[],n=!0,i=r.length-1;0<=i;i--){var s=r[i]|0;n&&s==e||(t[i]=s,n=!1)}this.g=t}var oE={};function hl(r){return-128<=r&&128>r?yI(r,function(e){return new re([e|0],0>e?-1:0)}):new re([r|0],0>r?-1:0)}function Pt(r){if(isNaN(r)||!isFinite(r))return zn;if(0>r)return qe(Pt(-r));for(var e=[],t=1,n=0;r>=t;n++)e[n]=r/t|0,t*=jc;return new re(e,0)}function _g(r,e){if(r.length==0)throw Error("number format error: empty string");if(e=e||10,2>e||36<e)throw Error("radix out of range: "+e);if(r.charAt(0)=="-")return qe(_g(r.substring(1),e));if(0<=r.indexOf("-"))throw Error('number format error: interior "-" character');for(var t=Pt(Math.pow(e,8)),n=zn,i=0;i<r.length;i+=8){var s=Math.min(8,r.length-i),o=parseInt(r.substring(i,i+s),e);8>s?(s=Pt(Math.pow(e,s)),n=n.R(s).add(Pt(o))):(n=n.R(t),n=n.add(Pt(o)))}return n}var jc=4294967296,zn=hl(0),$c=hl(1),fm=hl(16777216);D=re.prototype;D.ea=function(){if(ut(this))return-qe(this).ea();for(var r=0,e=1,t=0;t<this.g.length;t++){var n=this.D(t);r+=(0<=n?n:jc+n)*e,e*=jc}return r};D.toString=function(r){if(r=r||10,2>r||36<r)throw Error("radix out of range: "+r);if(Kt(this))return"0";if(ut(this))return"-"+qe(this).toString(r);for(var e=Pt(Math.pow(r,6)),t=this,n="";;){var i=Xo(t,e).g;t=Jo(t,i.R(e));var s=((0<t.g.length?t.g[0]:t.h)>>>0).toString(r);if(t=i,Kt(t))return s+n;for(;6>s.length;)s="0"+s;n=s+n}};D.D=function(r){return 0>r?0:r<this.g.length?this.g[r]:this.h};function Kt(r){if(r.h!=0)return!1;for(var e=0;e<r.g.length;e++)if(r.g[e]!=0)return!1;return!0}function ut(r){return r.h==-1}D.X=function(r){return r=Jo(this,r),ut(r)?-1:Kt(r)?0:1};function qe(r){for(var e=r.g.length,t=[],n=0;n<e;n++)t[n]=~r.g[n];return new re(t,~r.h).add($c)}D.abs=function(){return ut(this)?qe(this):this};D.add=function(r){for(var e=Math.max(this.g.length,r.g.length),t=[],n=0,i=0;i<=e;i++){var s=n+(this.D(i)&65535)+(r.D(i)&65535),o=(s>>>16)+(this.D(i)>>>16)+(r.D(i)>>>16);n=o>>>16,s&=65535,o&=65535,t[i]=o<<16|s}return new re(t,t[t.length-1]&-2147483648?-1:0)};function Jo(r,e){return r.add(qe(e))}D.R=function(r){if(Kt(this)||Kt(r))return zn;if(ut(this))return ut(r)?qe(this).R(qe(r)):qe(qe(this).R(r));if(ut(r))return qe(this.R(qe(r)));if(0>this.X(fm)&&0>r.X(fm))return Pt(this.ea()*r.ea());for(var e=this.g.length+r.g.length,t=[],n=0;n<2*e;n++)t[n]=0;for(n=0;n<this.g.length;n++)for(var i=0;i<r.g.length;i++){var s=this.D(n)>>>16,o=this.D(n)&65535,a=r.D(i)>>>16,u=r.D(i)&65535;t[2*n+2*i]+=o*u,Go(t,2*n+2*i),t[2*n+2*i+1]+=s*u,Go(t,2*n+2*i+1),t[2*n+2*i+1]+=o*a,Go(t,2*n+2*i+1),t[2*n+2*i+2]+=s*a,Go(t,2*n+2*i+2)}for(n=0;n<e;n++)t[n]=t[2*n+1]<<16|t[2*n];for(n=e;n<2*e;n++)t[n]=0;return new re(t,0)};function Go(r,e){for(;(r[e]&65535)!=r[e];)r[e+1]+=r[e]>>>16,r[e]&=65535,e++}function Yi(r,e){this.g=r,this.h=e}function Xo(r,e){if(Kt(e))throw Error("division by zero");if(Kt(r))return new Yi(zn,zn);if(ut(r))return e=Xo(qe(r),e),new Yi(qe(e.g),qe(e.h));if(ut(e))return e=Xo(r,qe(e)),new Yi(qe(e.g),e.h);if(30<r.g.length){if(ut(r)||ut(e))throw Error("slowDivide_ only works with positive integers.");for(var t=$c,n=e;0>=n.X(r);)t=pm(t),n=pm(n);var i=jn(t,1),s=jn(n,1);for(n=jn(n,2),t=jn(t,2);!Kt(n);){var o=s.add(n);0>=o.X(r)&&(i=i.add(t),s=o),n=jn(n,1),t=jn(t,1)}return e=Jo(r,i.R(e)),new Yi(i,e)}for(i=zn;0<=r.X(e);){for(t=Math.max(1,Math.floor(r.ea()/e.ea())),n=Math.ceil(Math.log(t)/Math.LN2),n=48>=n?1:Math.pow(2,n-48),s=Pt(t),o=s.R(e);ut(o)||0<o.X(r);)t-=n,s=Pt(t),o=s.R(e);Kt(s)&&(s=$c),i=i.add(s),r=Jo(r,o)}return new Yi(i,r)}D.gb=function(r){return Xo(this,r).h};D.and=function(r){for(var e=Math.max(this.g.length,r.g.length),t=[],n=0;n<e;n++)t[n]=this.D(n)&r.D(n);return new re(t,this.h&r.h)};D.or=function(r){for(var e=Math.max(this.g.length,r.g.length),t=[],n=0;n<e;n++)t[n]=this.D(n)|r.D(n);return new re(t,this.h|r.h)};D.xor=function(r){for(var e=Math.max(this.g.length,r.g.length),t=[],n=0;n<e;n++)t[n]=this.D(n)^r.D(n);return new re(t,this.h^r.h)};function pm(r){for(var e=r.g.length+1,t=[],n=0;n<e;n++)t[n]=r.D(n)<<1|r.D(n-1)>>>31;return new re(t,r.h)}function jn(r,e){var t=e>>5;e%=32;for(var n=r.g.length-t,i=[],s=0;s<n;s++)i[s]=0<e?r.D(s+t)>>>e|r.D(s+t+1)<<32-e:r.D(s+t);return new re(i,r.h)}Yo.prototype.createWebChannel=Yo.prototype.g;it.prototype.send=it.prototype.u;it.prototype.open=it.prototype.m;it.prototype.close=it.prototype.close;oa.NO_ERROR=0;oa.TIMEOUT=8;oa.HTTP_ERROR=6;Vm.COMPLETE="complete";Om.EventType=hs;hs.OPEN="a";hs.CLOSE="b";hs.ERROR="c";hs.MESSAGE="d";Ne.prototype.listen=Ne.prototype.O;ve.prototype.listenOnce=ve.prototype.P;ve.prototype.getLastError=ve.prototype.Sa;ve.prototype.getLastErrorCode=ve.prototype.Ia;ve.prototype.getStatus=ve.prototype.da;ve.prototype.getResponseJson=ve.prototype.Wa;ve.prototype.getResponseText=ve.prototype.ja;ve.prototype.send=ve.prototype.ha;ve.prototype.setWithCredentials=ve.prototype.Oa;gt.prototype.digest=gt.prototype.l;gt.prototype.reset=gt.prototype.reset;gt.prototype.update=gt.prototype.j;re.prototype.add=re.prototype.add;re.prototype.multiply=re.prototype.R;re.prototype.modulo=re.prototype.gb;re.prototype.compare=re.prototype.X;re.prototype.toNumber=re.prototype.ea;re.prototype.toString=re.prototype.toString;re.prototype.getBits=re.prototype.D;re.fromNumber=Pt;re.fromString=_g;var yg=_t.createWebChannelTransport=function(){return new Yo},vg=_t.getStatEventTarget=function(){return sa()},pa=_t.ErrorCode=oa,wg=_t.EventType=Vm,Ig=_t.Event=Yr,dl=_t.Stat={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},c1=_t.FetchXmlHttpFactory=ps,_s=_t.WebChannel=Om,Eg=_t.XhrIo=ve,Tg=_t.Md5=gt,Jr=_t.Integer=re;var bg="@firebase/firestore";var ke=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}};ke.UNAUTHENTICATED=new ke(null),ke.GOOGLE_CREDENTIALS=new ke("google-credentials-uid"),ke.FIRST_PARTY=new ke("first-party-uid"),ke.MOCK_USER=new ke("mock-user");var Ti="10.7.0";var vr=new Ao("@firebase/firestore");function Xn(){return vr.logLevel}function T_(r){vr.setLogLevel(r)}function x(r,...e){if(vr.logLevel<=St.DEBUG){let t=e.map(fd);vr.debug(`Firestore (${Ti}): ${r}`,...t)}}function Ee(r,...e){if(vr.logLevel<=St.ERROR){let t=e.map(fd);vr.error(`Firestore (${Ti}): ${r}`,...t)}}function lt(r,...e){if(vr.logLevel<=St.WARN){let t=e.map(fd);vr.warn(`Firestore (${Ti}): ${r}`,...t)}}function fd(r){if(typeof r=="string")return r;try{return function(t){return JSON.stringify(t)}(r)}catch{return r}}function V(r="Unexpected state"){let e=`FIRESTORE (${Ti}) INTERNAL ASSERTION FAILED: `+r;throw Ee(e),new Error(e)}function O(r,e){r||V()}function b_(r,e){r||V()}function N(r,e){return r}var A={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"},C=class extends dp{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};var Pe=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}};var Sa=class{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}},_l=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(ke.UNAUTHENTICATED))}shutdown(){}},yl=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}},vl=class{constructor(e){this.t=e,this.currentUser=ke.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let n=this.i,i=u=>this.i!==n?(n=this.i,t(u)):Promise.resolve(),s=new Pe;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Pe,e.enqueueRetryable(()=>i(this.currentUser))};let o=()=>{let u=s;e.enqueueRetryable(()=>S(this,null,function*(){yield u.promise,yield i(this.currentUser)}))},a=u=>{x("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=u,this.auth.addAuthTokenListener(this.o),o()};this.t.onInit(u=>a(u)),setTimeout(()=>{if(!this.auth){let u=this.t.getImmediate({optional:!0});u?a(u):(x("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Pe)}},0),o()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(n=>this.i!==e?(x("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):n?(O(typeof n.accessToken=="string"),new Sa(n.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){let e=this.auth&&this.auth.getUid();return O(e===null||typeof e=="string"),new ke(e)}},wl=class{constructor(e,t,n){this.l=e,this.h=t,this.P=n,this.type="FirstParty",this.user=ke.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);let e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}},Il=class{constructor(e,t,n){this.l=e,this.h=t,this.P=n}getToken(){return Promise.resolve(new wl(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(ke.FIRST_PARTY))}shutdown(){}invalidateToken(){}},El=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)}},Tl=class{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){let n=s=>{s.error!=null&&x("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);let o=s.token!==this.R;return this.R=s.token,x("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?t(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>n(s))};let i=s=>{x("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,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):x("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(O(typeof t.token=="string"),this.R=t.token,new El(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}};function aE(r){let e=typeof self<"u"&&(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 Aa=class{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length,n="";for(;n.length<20;){let i=aE(40);for(let s=0;s<i.length;++s)n.length<20&&i[s]<t&&(n+=e.charAt(i[s]%e.length))}return n}};function K(r,e){return r<e?-1:r>e?1:0}function ai(r,e,t){return r.length===e.length&&r.every((n,i)=>t(n,e[i]))}function S_(r){return r+"\0"}var ge=class r{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new C(A.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new C(A.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new C(A.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new C(A.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}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(1e6*(e-1e3*t));return new r(t,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?K(this.nanoseconds,e.nanoseconds):K(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- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};var F=class r{constructor(e){this.timestamp=e}static fromTimestamp(e){return new r(e)}static min(){return new r(new ge(0,0))}static max(){return new r(new ge(253402300799,999999999))}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 ka=class r{constructor(e,t,n){t===void 0?t=0:t>e.length&&V(),n===void 0?n=e.length-t:n>e.length-t&&V(),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=e.get(i),o=t.get(i);if(s<o)return-1;if(s>o)return 1}return e.length<t.length?-1:e.length>t.length?1:0}},ee=class r extends ka{construct(e,t,n){return new r(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...e){let t=[];for(let n of e){if(n.indexOf("//")>=0)throw new C(A.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([])}},uE=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Te=class r extends ka{construct(e,t,n){return new r(e,t,n)}static isValidIdentifier(e){return uE.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)==="__name__"}static keyField(){return new r(["__name__"])}static fromServerFormat(e){let t=[],n="",i=0,s=()=>{if(n.length===0)throw new C(A.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""},o=!1;for(;i<e.length;){let a=e[i];if(a==="\\"){if(i+1===e.length)throw new C(A.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let u=e[i+1];if(u!=="\\"&&u!=="."&&u!=="`")throw new C(A.INVALID_ARGUMENT,"Path has invali
19d escape sequence: "+e);n+=u,i+=2}else a==="`"?(o=!o,i++):a!=="."||o?(n+=a,i++):(s(),i++)}if(s(),o)throw new C(A.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new r(t)}static emptyPath(){return new r([])}};var R=class r{constructor(e){this.path=e}static fromPath(e){return new r(ee.fromString(e))}static fromName(e){return new r(ee.fromString(e).popFirst(5))}static empty(){return new r(ee.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&&ee.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return ee.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new r(new ee(e.slice()))}};var ui=class{constructor(e,t,n,i){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=i}};function bl(r){return r.fields.find(e=>e.kind===2)}function Zr(r){return r.fields.filter(e=>e.kind!==2)}ui.UNKNOWN_ID=-1;var ii=class{constructor(e,t){this.fieldPath=e,this.kind=t}};var Cs=class r{constructor(e,t){this.sequenceNumber=e,this.offset=t}static empty(){return new r(0,ht.min())}};function A_(r,e){let t=r.toTimestamp().seconds,n=r.toTimestamp().nanoseconds+1,i=F.fromTimestamp(n===1e9?new ge(t+1,0):new ge(t,n));return new ht(i,R.empty(),e)}function k_(r){return new ht(r.readTime,r.key,-1)}var ht=class r{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new r(F.min(),R.empty(),-1)}static max(){return new r(F.max(),R.empty(),-1)}};function pd(r,e){let t=r.readTime.compareTo(e.readTime);return t!==0?t:(t=R.comparator(r.documentKey,e.documentKey),t!==0?t:K(r.largestBatchId,e.largestBatchId))}var P_="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Pa=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}};function xr(r){return S(this,null,function*(){if(r.code!==A.FAILED_PRECONDITION||r.message!==P_)throw r;x("LocalStore","Unexpectedly lost primary lease")})}var b=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&&V(),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,o=!1;e.forEach(a=>{++i,a.next(()=>{++s,o&&s===i&&t()},u=>n(u))}),o=!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,o=new Array(s),a=0;for(let u=0;u<s;u++){let c=u;t(e[c]).next(l=>{o[c]=l,++a,a===s&&n(o)},l=>i(l))}})}static doWhile(e,t){return new r((n,i)=>{let s=()=>{e()===!0?t().next(()=>{s()},i):n()};s()})}};var Ca=class r{constructor(e,t){this.action=e,this.transaction=t,this.aborted=!1,this.V=new Pe,this.transaction.oncomplete=()=>{this.V.resolve()},this.transaction.onabort=()=>{t.error?this.V.reject(new on(e,t.error)):this.V.resolve()},this.transaction.onerror=n=>{let i=md(n.target.error);this.V.reject(new on(e,i))}}static open(e,t,n,i){try{return new r(t,e.transaction(i,n))}catch(s){throw new on(t,s)}}get m(){return this.V.promise}abort(e){e&&this.V.reject(e),this.aborted||(x("SimpleDb","Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}g(){let e=this.transaction;this.aborted||typeof e.commit!="function"||e.commit()}store(e){let t=this.transaction.objectStore(e);return new Al(t)}}
19,wr=class r{constructor(e,t,n){this.name=e,this.version=t,this.p=n,r.S(bo())===12.2&&Ee("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}static delete(e){return x("SimpleDb","Removing database:",e),en(window.indexedDB.deleteDatabase(e)).toPromise()}static D(){if(!So())return!1;if(r.C())return!0;let e=bo(),t=r.S(e),n=0<t&&t<10,i=r.v(e),s=0<i&&i<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||n||s)}static C(){var e;return typeof process<"u"&&((e=process.env)===null||e===void 0?void 0:e.F)==="YES"}static M(e,t){return e.store(t)}static S(e){let t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(n)}static v(e){let t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}O(e){return S(this,null,function*(){return this.db||(x("SimpleDb","Opening database:",this.name),this.db=yield new Promise((t,n)=>{let i=indexedDB.open(this.name,this.version);i.onsuccess=s=>{let o=s.target.result;t(o)},i.onblocked=()=>{n(new on(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=s=>{let o=s.target.error;o.name==="VersionError"?n(new C(A.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):o.name==="InvalidStateError"?n(new C(A.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+o)):n(new on(e,o))},i.onupgradeneeded=s=>{x("SimpleDb",'Database "'+this.name+'" requires upgrade from version:',s.oldVersion);let o=s.target.result;this.p.N(o,i.transaction,s.oldVersion,this.version).next(()=>{x("SimpleDb","Database upgrade to version "+this.version+" complete")})}})),this.B&&(this.db.onversionchange=t=>this.B(t)),this.db})}L(e){this.B=e,this.db&&(this.db.onversionchange=t=>e(t))}runTransaction(e,t,n,i){return S(this,null,function*(){let s=t==="readonly",o=0;for(;;){++o;try{this.db=yield this.O(e);let a=Ca.open(this.db,e,s?"readonly":"readwrite",n),u=i(a).next(c=>(a.g(),c)).catch(c=>(a.abort(c),b.reject(c))).toPromise();return u.catch(()=>{}),yield a.m,u}catch(a){let u=a,c=u.name!=="FirebaseError"&&o<3;if(x("SimpleDb","Transaction failed with error:",u.message,"Retrying:",c),this.close(),!c)return Promise.reject(u)}}})}close(){this.db&&this.db.close(),this.db=void 0}},Sl=class{constructor(e){this.k=e,this.q=!1,this.K=null}get isDone(){return this.q}get $(){return this.K}set cursor(e){this.k=e}done(){this.q=!0}U(e){this.K=e}delete(){return en(this.k.delete())}},on=class extends C{constructor(e,t){super(A.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${t}`),this.name="IndexedDbTransactionError"}};function Rr(r){return r.name==="IndexedDbTransactionError"}var Al=class{constructor(e){this.store=e}put(e,t){let n;return t!==void 0?(x("SimpleDb","PUT",this.store.name,e,t),n=this.store.put(t,e)):(x("SimpleDb","PUT",this.store.name,"<auto-key>",e),n=this.store.put(e)),en(n)}add(e){return x("SimpleDb","ADD",this.store.name,e,e),en(this.store.add(e))}get(e){return en(this.store.get(e)).next(t=>(t===void 0&&(t=null),x("SimpleDb","GET",this.store.name,e,t),t))}delete(e){return x("SimpleDb","DELETE",this.store.name,e),en(this.store.delete(e))}count(){return x("SimpleDb","COUNT",this.store.name),en(this.store.count())}W(e,t){let n=this.options(e,t);if(n.index||typeof this.store.getAll!="function"){let i=this.cursor(n),s=[];return this.G(i,(o,a)=>{s.push(a)}).next(()=>s)}{let i=this.store.getAll(n.range);return new b((s,o)=>{i.onerror=a=>{o(a.target.error)},i.onsuccess=a=>{s(a.target.result)}})}}j(e,t){let n=this.store.getAll(e,t===null?void 0:t);return new b((i,s)=>{n.onerror=o=>{s(o.target.error)},n.onsuccess=o=>{i(o.target.result)}})}H(e,t){x("SimpleDb","DELETE ALL",this.store.name);let n=this.options(e,t);n.J=!1;let i=this.cursor(n);return this.G(i,(s,o,a)=>a.delete())}Y(e,t){let n;t?n=e:(n={},t=e);let i=this.cursor(n);return this.G(i,t)}Z(e){let t=this.cursor({});return new b((n,i)=>{t.onerror=s=>{let o=md(s.target.error);i(o)},t.onsuccess=s=>{let o=s.target.result;o?e(o.primaryKey,o.value).next(a=>{a?o.continue():n()}):n()}})}G(e,t){let n=[];return new b((i,s)=>{e.onerror=o=>{s(o.target.error)},e.onsuccess=o=>{let a=o.target.result;if(!a)return void i();let u=new Sl(a),c=t(a.primaryKey,a.value,u);if(c instanceof b){let l=c.catch(h=>(u.done(),b.reject(h)));n.push(l)}u.isDone?i():u.$===null?a.continue():a.continue(u.$)}}).next(()=>b.waitFor(n))}options(e,t){let n;return e!==void 0&&(typeof e=="string"?n=e:t=e),{index:n,range:t}}cursor(e){let t="next";if(e.reverse&&(t="prev"),e.index){let n=this.store.index(e.index);return e.J?n.openKeyCursor(e.range,t):n.openCursor(e.range,t)}return this.store.openCursor(e.range,t)}};function en(r){return new b((e,t)=>
vendor: 11,398 bytes, line 19
19{r.onsuccess=n=>{let i=n.target.result;e(i)},r.onerror=n=>{let i=md(n.target.error);t(i)}})}var Sg=!1;function md(r){let e=wr.S(bo());if(e>=12.2&&e<13){let t="An internal error was encountered in the Indexed Database server";if(r.message.indexOf(t)>=0){let n=new C("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${t}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return Sg||(Sg=!0,setTimeout(()=>{throw n},0)),n}}return r}var kl=class{constructor(e,t){this.asyncQueue=e,this.X=t,this.task=null}start(){this.ee(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return this.task!==null}ee(e){x("IndexBackiller",`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,()=>S(this,null,function*(){this.task=null;try{x("IndexBackiller",`Documents written: ${yield this.X.te()}`)}catch(t){Rr(t)?x("IndexBackiller","Ignoring IndexedDB error during index backfill: ",t):yield xr(t)}yield this.ee(6e4)}))}},Pl=class{constructor(e,t){this.localStore=e,this.persistence=t}te(e=50){return S(this,null,function*(){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",t=>this.ne(t,e))})}ne(e,t){let n=new Set,i=t,s=!0;return b.doWhile(()=>s===!0&&i>0,()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next(o=>{if(o!==null&&!n.has(o))return x("IndexBackiller",`Processing collection: ${o}`),this.re(e,o,i).next(a=>{i-=a,n.add(o)});s=!1})).next(()=>t-i)}re(e,t,n){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(e,t).next(i=>this.localStore.localDocuments.getNextDocuments(e,t,i,n).next(s=>{let o=s.changes;return this.localStore.indexManager.updateIndexEntries(e,o).next(()=>this.ie(i,s)).next(a=>(x("IndexBackiller",`Updating offset: ${a}`),this.localStore.indexManager.updateCollectionGroup(e,t,a))).next(()=>o.size)}))}ie(e,t){let n=e;return t.changes.forEach((i,s)=>{let o=k_(s);pd(o,n)>0&&(n=o)}),new ht(n.readTime,n.documentKey,Math.max(t.batchId,e.largestBatchId))}};var st=(()=>{class r{constructor(t,n){this.previousValue=t,n&&(n.sequenceNumberHandler=i=>this.se(i),this.oe=i=>n.writeSequenceNumber(i))}se(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){let t=++this.previousValue;return this.oe&&this.oe(t),t}}return r._e=-1,r})();function Zs(r){return r==null}function xs(r){return r===0&&1/r==-1/0}function C_(r){return typeof r=="number"&&Number.isInteger(r)&&!xs(r)&&r<=Number.MAX_SAFE_INTEGER&&r>=Number.MIN_SAFE_INTEGER}function Je(r){let e="";for(let t=0;t<r.length;t++)e.length>0&&(e=Ag(e)),e=cE(r.get(t),e);return Ag(e)}function cE(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"�":t+="��";break;default:t+=s}}return t}function Ag(r){return r+"��"}function Ct(r){let e=r.length;if(O(e>=2),e===2)return O(r.charAt(0)==="�"&&r.charAt(1)==="�"),ee.emptyPath();let t=e-2,n=[],i="";for(let s=0;s<e;){let o=r.indexOf("�",s);switch((o<0||o>t)&&V(),r.charAt(o+1)){case"�":let a=r.substring(s,o),u;i.length===0?u=a:(i+=a,u=i,i=""),n.push(u);break;case"�":i+=r.substring(s,o),i+="\0";break;case"�":i+=r.substring(s,o+1);break;default:V()}s=o+2}return new ee(n)}var kg=["userId","batchId"];function va(r,e){return[r,Je(e)]}function x_(r,e,t){return[r,Je(e),t]}var lE={},hE=["prefixPath","collectionGroup","readTime","documentId"],dE=["prefixPath","collectionGroup","documentId"],fE=["collectionGroup","readTime","prefixPath","documentId"],pE=["canonicalId","targetId"],mE=["targetId","path"],gE=["path","targetId"],_E=["collectionId","parent"],yE=["indexId","uid"],vE=["uid","sequenceNumber"],wE=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],IE=["indexId","uid","orderedDocumentKey"],EE=["userId","collectionPath","documentId"],TE=["userId","collectionPath","largestBatchId"],bE=["userId","collectionGroup","largestBatchId"],R_=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries"],SE=[...R_,"documentOverlays"],D_=["mutationQueues","mutations","documentMutations","remoteDocumentsV14","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries","documentOverlays"],N_=D_,AE=[...N_,"indexConfiguration","indexState","indexEntries"];var Rs=class extends Pa{constructor(e,t){super(),this.ae=e,this.currentSequenceNumber=t}};function Fe(r,e){let t=N(r);return wr.M(t.ae,e)}function Pg(r){let e=0;for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e++;return e}function yn(r,e){for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e(t,r[t])}function V_(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||Rt.EMPTY}insert(e,t){return new r(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,Rt.BLACK,null,null))}remove(e){return new r(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Rt.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 ni(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new ni(this.root,e,this.comparator,!1)}getReverseIterator(){return new ni(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new ni(this.root,e,this.comparator,!0)}},ni=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}}},Rt=class r{constructor(e,t,n,i,s){this.key=e,this.value=t,this.color=n??r.RED,this.left=i??r.EMPTY,this.right=s??r.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,i,s){return new r(e??this.key,t??this.value,n??this.color,i??this.left,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 V();let e=this.left.check();if(e!==this.right.check())throw V();return e+(this.isRed()?0:1)}};Rt.EMPTY=null,Rt.RED=!0,Rt.BLACK=!1;Rt.EMPTY=new class{constructor(){this.size=0}get key(){throw V()}get value(){throw V()}get color(){throw V()}get left(){throw V()}get right(){throw V()}copy(e,t,n,i,s){return this}insert(e,t,n){return new Rt(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 oe=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 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 xa(this.data.getIterator())}getIteratorFrom(e){return new xa(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}}
19,xa=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};function Qn(r){return r.hasNext()?r.getNext():void 0}var ot=class r{constructor(e){this.fields=e,e.sort(Te.comparator)}static empty(){return new r([])}unionWith(e){let t=new oe(Te.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 ai(this.fields,e.fields,(t,n)=>t.isEqual(n))}};var Ra=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};function O_(){return typeof atob<"u"}var Oe=class r{constructor(e){this.binaryString=e}static fromBase64String(e){let t=function(i){try{return atob(i)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new Ra("Invalid base64 string: "+s):s}}(e);return new r(t)}static fromUint8Array(e){let t=function(i){let s="";for(let o=0;o<i.length;++o)s+=String.fromCharCode(i[o]);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 K(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};Oe.EMPTY_BYTE_STRING=new Oe("");var kE=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Ir(r){if(O(!!r),typeof r=="string"){let e=0,t=kE.exec(r);if(O(!!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:we(r.seconds),nanos:we(r.nanos)}}function we(r){return typeof r=="number"?r:typeof r=="string"?Number(r):0}function Er(r){return typeof r=="string"?Oe.fromBase64String(r):Oe.fromUint8Array(r)}function Iu(r){var e,t;return((t=(((e=r?.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="server_timestamp"}function gd(r){let e=r.mapValue.fields.__previous_value__;return Iu(e)?gd(e):e}function Ds(r){let e=Ir(r.mapValue.fields.__local_write_time__.timestampValue);return new ge(e.seconds,e.nanos)}var Cl=class{constructor(e,t,n,i,s,o,a,u,c){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=i,this.ssl=s,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=u,this.useFetchStreams=c}},Tr=class r{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new r("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof r&&e.projectId===this.projectId&&e.database===this.database}};var _r={mapValue:{fields:{__type__:{stringValue:"__max__"}}}},wa={nullValue:"NULL_VALUE"};function an(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?Iu(r)?4:F_(r)?9007199254740991:10:V()}function Vt(r,e){if(r===e)return!0;let t=an(r);if(t!==an(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 o=Ir(i.timestampValue),a=Ir(s.timestampValue);return o.seconds===a.seconds&&o.nanos===a.nanos}(r,e);case 5:return r.stringValue===e.stringValue;case 6:return function(i,s){return Er(i.bytesValue).isEqual(Er(s.bytesValue))}(r,e);case 7:return r.referenceValue===e.referenceValue;case 8:return function(i,s){return we(i.geoPointValue.latitude)===we(s.geoPointValue.latitude)&&we(i.geoPointValue.longitude)===we(s.geoPointValue.longitude)}(r,e);case 2:return function(i,s){if("integerValue"in i&&"integerValue"in s)return we(i.integerValue)===we(s.integerValue);if("doubleValue"in i&&"doubleValue"in s){let o=we(i.doubleValue),a=we(s.doubleValue);return o===a?xs(o)===xs(a):isNaN(o)&&isNaN(a)}return!1}(r,e);case 9:return ai(r.arrayValue.values||[],e.arrayValue.values||[],Vt);case 10:return function(i,s){let o=i.mapValue.fields||{},a=s.mapValue.fields||{};if(Pg(o)!==Pg(a))return!1;for(let u in o)if(o.hasOwnProperty(u)&&(a[u]===void 0||!Vt(o[u],a[u])))return!1;return!0}(r,e);default:return V()}}function Ns(r,e){return(r.values||[]).find(t=>Vt(t,e))!==void 0}function br(r,e){if(r===e)return 0;let t=an(r),n=an(e);if(t!==n)return K(t,n);switch(t){case 0:case 9007199254740991:return 0;case 1:return K(r.booleanValue,e.booleanValue);case 2:return function(s,o){let a=we(s.integerValue||s.doubleValue),u=we(o.integerValue||o.doubleValue);return a<u?-1:a>u?1:a===u?0:isNaN(a)?isNaN(u)?0:-1:1}(r,e);case 3:return Cg(r.timestampValue,e.timestampValue);case 4:return Cg(Ds(r),Ds(e));case 5:return K(r.stringValue,e.stringValue);case 6:return function(s,o){let a=Er(s),u=Er(o);return a.compareTo(u)}(r.bytesValue,e.bytesValue);case 7:return function(s,o){let a=s.split("/"),u=o.split("/");for(let c=0;c<a.length&&c<u.length;c++){let l=K(a[c],u[c]);if(l!==0)return l}return K(a.length,u.length)}(r.referenceValue,e.referenceValue);case 8:return function(s,o){let a=K(we(s.latitude),we(o.latitude));return a!==0?a:K(we(s.longitude),we(o.longitude))}(r.geoPointValue,e.geoPointValue);case 9:return function(s,o){let a=s.values||[],u=o.values||[];for(let c=0;c<a.length&&c<u.length;++c){let l=br(a[c],u[c]);if(l)return l}return K(a.length,u.length)}(r.arrayValue,e.arrayValue);case 10:return function(s,o){if(s===_r.mapValue&&o===_r.mapValue)return 0;if(s===_r.mapValue)return 1;if(o===_r.mapValue)return-1;let a=s.fields||{},u=Object.keys(a),c=o.fields||{},l=Object.keys(c);u.sort(),l.sort();for(let h=0;h<u.length&&h<l.length;++h){let d=K(u[h],l[h]);if(d!==0)return d;let m=br(a[u[h]],c[l[h]]);if(m!==0)return m}return K(u.length,l.length)}(r.mapValue,e.mapValue);default:throw V()}}function Cg(r,e){if(typeof r=="string"&&typeof e=="string"&&r.length===e.length)return K(r,e);let t=Ir(r),n=Ir(e),i=K(t.seconds,n.seconds);return i!==0?i:K(t.nanos,n.nanos)}function ci(r){return xl(r)}function xl(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=Ir(t);return`time(${n.seconds},${n.nanos})`}(r.timestampValue):"stringValue"in r?r.stringValue:"bytesValue"in r?function(t){return Er(t).toBase64()}
vendor: 20,733 bytes, line 19
19(r.bytesValue):"referenceValue"in r?function(t){return R.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+=xl(s);return n+"]"}(r.arrayValue):"mapValue"in r?function(t){let n=Object.keys(t.fields||{}).sort(),i="{",s=!0;for(let o of n)s?s=!1:i+=",",i+=`${o}:${xl(t.fields[o])}`;return i+"}"}(r.mapValue):V()}function un(r,e){return{referenceValue:`projects/${r.projectId}/databases/${r.database}/documents/${e.path.canonicalString()}`}}function Rl(r){return!!r&&"integerValue"in r}function Vs(r){return!!r&&"arrayValue"in r}function xg(r){return!!r&&"nullValue"in r}function Rg(r){return!!r&&"doubleValue"in r&&isNaN(Number(r.doubleValue))}function Ia(r){return!!r&&"mapValue"in r}function bs(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 yn(r.mapValue.fields,(t,n)=>e.mapValue.fields[t]=bs(n)),e}if(r.arrayValue){let e={arrayValue:{values:[]}};for(let t=0;t<(r.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=bs(r.arrayValue.values[t]);return e}return Object.assign({},r)}function F_(r){return(((r.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}function PE(r){return"nullValue"in r?wa:"booleanValue"in r?{booleanValue:!1}:"integerValue"in r||"doubleValue"in r?{doubleValue:NaN}:"timestampValue"in r?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in r?{stringValue:""}:"bytesValue"in r?{bytesValue:""}:"referenceValue"in r?un(Tr.empty(),R.empty()):"geoPointValue"in r?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in r?{arrayValue:{}}:"mapValue"in r?{mapValue:{}}:V()}function CE(r){return"nullValue"in r?{booleanValue:!1}:"booleanValue"in r?{doubleValue:NaN}:"integerValue"in r||"doubleValue"in r?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in r?{stringValue:""}:"stringValue"in r?{bytesValue:""}:"bytesValue"in r?un(Tr.empty(),R.empty()):"referenceValue"in r?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in r?{arrayValue:{}}:"arrayValue"in r?{mapValue:{}}:"mapValue"in r?_r:V()}function Dg(r,e){let t=br(r.value,e.value);return t!==0?t:r.inclusive&&!e.inclusive?-1:!r.inclusive&&e.inclusive?1:0}function Ng(r,e){let t=br(r.value,e.value);return t!==0?t:r.inclusive&&!e.inclusive?1:!r.inclusive&&e.inclusive?-1:0}var 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)],!Ia(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=bs(t)}setAll(e){let t=Te.emptyPath(),n={},i=[];e.forEach((o,a)=>{if(!t.isImmediateParentOf(a)){let u=this.getFieldsMap(t);this.applyChanges(u,n,i),n={},i=[],t=a.popLast()}o?n[a.lastSegment()]=bs(o):i.push(a.lastSegment())});let s=this.getFieldsMap(t);this.applyChanges(s,n,i)}delete(e){let t=this.field(e.popLast());Ia(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Vt(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)];Ia(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=i),t=i}return t.mapValue.fields}applyChanges(e,t,n){yn(t,(i,s)=>e[i]=s);for(let i of n)delete e[i]}clone(){return new r(bs(this.value))}};function M_(r){let e=[];return yn(r.fields,(t,n)=>{let i=new Te([t]);if(Ia(n)){let s=M_(n.mapValue).fields;if(s.length===0)e.push(i);else for(let o of s)e.push(i.child(o))}else e.push(i)}),new ot(e)}var Ce=class r{constructor(e,t,n,i,s,o,a){this.key=e,this.documentType=t,this.version=n,this.readTime=i,this.createTime=s,this.data=o,this.documentState=a}static newInvalidDocument(e){return new r(e,0,F.min(),F.min(),F.min(),Ke.empty(),0)}static newFoundDocument(e,t,n,i){return new r(e,1,t,F.min(),n,i,0)}static newNoDocument(e,t){return new r(e,2,t,F.min(),F.min(),Ke.empty(),0)}static newUnknownDocument(e,t){return new r(e,3,t,F.min(),F.min(),Ke.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(F.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=F.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 Ot=class{constructor(e,t){this.position=e,this.inclusive=t}};function Vg(r,e,t){let n=0;for(let i=0;i<r.position.length;i++){let s=e[i],o=r.position[i];if(s.field.isKeyField()?n=R.comparator(R.fromName(o.referenceValue),t.key):n=br(o,t.data.field(s.field)),s.dir==="desc"&&(n*=-1),n!==0)break}return n}function Og(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(!Vt(r.position[t],e.position[t]))return!1;return!0}var cn=class{constructor(e,t="asc"){this.field=e,this.dir=t}};function xE(r,e){return r.dir===e.dir&&r.field.isEqual(e.field)}var Da=class{},Y=class r extends Da{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 Vl(e,t,n):t==="array-contains"?new Ml(e,n):t==="in"?new Na(e,n):t==="not-in"?new Ll(e,n):t==="array-contains-any"?new ql(e,n):new r(e,t,n)}static createKeyFieldInFilter(e,t,n){return t==="in"?new Ol(e,n):new Fl(e,n)}matches(e){let t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(br(t,this.value)):t!==null&&an(this.value)===an(t)&&this.matchesComparison(br(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 V()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},ne=class r extends Da{constructor(e,t){super(),this.filters=e,this.op=t,this.ue=null}static create(e,t){return new r(e,t)}matches(e){return li(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.ue!==null||(this.ue=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ue}getFilters(){return Object.assign([],this.filters)}};function li(r){return r.op==="and"}function Dl(r){return r.op==="or"}function _d(r){return L_(r)&&li(r)}function L_(r){for(let e of r.filters)if(e instanceof ne)return!1;return!0}function Nl(r){if(r instanceof Y)return r.field.canonicalString()+r.op.toString()+ci(r.value);if(_d(r))return r.filters.map(e=>Nl(e)).join(",");{let e=r.filters.map(t=>Nl(t)).join(",");return`${r.op}(${e})`}}function q_(r,e){return r instanceof Y?function(n,i){return i instanceof Y&&n.op===i.op&&n.field.isEqual(i.field)&&Vt(n.value,i.value)}(r,e):r instanceof ne?function(n,i){return i instanceof ne&&n.op===i.op&&n.filters.length===i.filters.length?n.filters.reduce((s,o,a)=>s&&q_(o,i.filters[a]),!0):!1}(r,e):void V()}function U_(r,e){let t=r.filters.concat(e);return ne.create(t,r.op)}function B_(r){return r instanceof Y?function(t){return`${t.field.canonicalString()} ${t.op} ${ci(t.value)}`}(r):r instanceof ne?function(t){return t.op.toString()+" {"+t.getFilters().map(B_).join(" ,")+"}"}(r):"Filter"}var Vl=class extends Y{constructor(e,t,n){super(e,t,n),this.key=R.fromName(n.referenceValue)}matches(e){let t=R.comparator(e.key,this.key);return this.matchesComparison(t)}},Ol=class extends Y{constructor(e,t){super(e,"in",t),this.keys=j_("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}},Fl=class extends Y{constructor(e,t){super(e,"not-in",t),this.keys=j_("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}};function j_(r,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(n=>R.fromName(n.referenceValue))}var Ml=class extends Y{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return Vs(t)&&Ns(t.arrayValue,this.value)}},Na=class extends Y{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return t!==null&&Ns(this.value.arrayValue,t)}},Ll=class extends Y{constructor(e,t){super(e,"not-in",t)}matches(e){if(Ns(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return t!==null&&!Ns(this.value.arrayValue,t)}},ql=class extends Y{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!Vs(t)||!t.arrayValue.values)&&t.arrayValue.values.some(n=>Ns(this.value.arrayValue,n))}};var Ul=class{constructor(e,t=null,n=[],i=[],s=null,o=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=i,this.limit=s,this.startAt=o,this.endAt=a,this.ce=null}};function Bl(r,e=null,t=[],n=[],i=null,s=null,o=null){return new Ul(r,e,t,n,i,s,o)}function ln(r){let e=N(r);if(e.ce===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(n=>Nl(n)).join(","),t+="|ob:",t+=e.orderBy.map(n=>function(s){return s.field.canonicalString()+s.dir}(n)).join(","),Zs(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(n=>ci(n)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(n=>ci(n)).join(",")),e.ce=t}return e.ce}function eo(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(!xE(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(!q_(r.filters[t],e.filters[t]))return!1;return r.collectionGroup===e.collectionGroup&&!!r.path.isEqual(e.path)&&!!Og(r.startAt,e.startAt)&&Og(r.endAt,e.endAt)}function Va(r){return R.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}function Oa(r,e){return r.filters.filter(t=>t instanceof Y&&t.field.isEqual(e))}function Fg(r,e,t){let n=wa,i=!0;for(let s of Oa(r,e)){let o=wa,a=!0;switch(s.op){case"<":case"<=":o=PE(s.value);break;case"==":case"in":case">=":o=s.value;break;case">":o=s.value,a=!1;break;case"!=":case"not-in":o=wa}Dg({value:n,inclusive:i},{value:o,inclusive:a})<0&&(n=o,i=a)}if(t!==null){for(let s=0;s<r.orderBy.length;++s)if(r.orderBy[s].field.isEqual(e)){let o=t.position[s];Dg({value:n,inclusive:i},{value:o,inclusive:t.inclusive})<0&&(n=o,i=t.inclusive);break}}return{value:n,inclusive:i}}function Mg(r,e,t){let n=_r,i=!0;for(let s of Oa(r,e)){let o=_r,a=!0;switch(s.op){case">=":case">":o=CE(s.value),a=!1;break;case"==":case"in":case"<=":o=s.value;break;case"<":o=s.value,a=!1;break;case"!=":case"not-in":o=_r}Ng({value:n,inclusive:i},{value:o,inclusive:a})>0&&(n=o,i=a)}if(t!==null){for(let s=0;s<r.orderBy.length;++s)if(r.orderBy[s].field.isEqual(e)){let o=t.position[s];Ng({value:n,inclusive:i},{value:o,inclusive:t.inclusive})>0&&(n=o,i=t.inclusive);break}}return{value:n,inclusive:i}}var yt=class{constructor(e,t=null,n=[],i=[],s=null,o="F",a=null,u=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=i,this.limit=s,this.limitType=o,this.startAt=a,this.endAt=u,this.le=null,this.he=null,this.Pe=null,this.startAt,this.endAt}};function $_(r,e,t,n,i,s,o,a){return new yt(r,e,t,n,i,s,o,a)}function bi(r){return new yt(r)}function Lg(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 yd(r){return r.collectionGroup!==null}function si(r){let e=N(r);if(e.le===null){e.le=[];let t=new Set;for(let s of e.explicitOrderBy)e.le.push(s),t.add(s.field.canonicalString());let n=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new oe(Te.comparator);return o.filters.forEach(u=>{u.getFlattenedFilters().forEach(c=>{c.isInequality()&&(a=a.add(c.field))})}),a})(e).forEach(s=>{t.has(s.canonicalString())||s.isKeyField()||e.le.push(new cn(s,n))}),t.has(Te.keyField().canonicalString())||e.le.push(new cn(Te.keyField(),n))}return e.le}function Xe(r){let e=N(r);return e.he||(e.he=RE(e,si(r))),e.he}function RE(r,e){if(r.limitType==="F")return Bl(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 cn(i.field,s)});let t=r.endAt?new Ot(r.endAt.position,r.endAt.inclusive):null,n=r.startAt?new Ot(r.startAt.position,r.startAt.inclusive):null;return Bl(r.path,r.collectionGroup,e,r.filters,r.limit,t,n)}}function jl(r,e){let t=r.filters.concat([e]);return new yt(r.path,r.collectionGroup,r.explicitOrderBy.slice(),t,r.limit,r.limitType,r.startAt,r.endAt)}function Fa(r,e,t){return new yt(r.path,r.collectionGroup,r.explicitOrderBy.slice(),r.filters.slice(),e,t,r.startAt,r.endAt)}function to(r,e){return eo(Xe(r),Xe(e))&&r.limitType===e.limitType}function z_(r){return`${ln(Xe(r))}|lt:${r.limitType}`}function Zn(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=>B_(i)).join(", ")}]`),Zs(t.limit)||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=`, orderBy: [${t.orderBy.map(i=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(i)).join(", ")}]`),t.startAt&&(n+=", startAt: ",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map(i=>ci(i)).join(",")),t.endAt&&(n+=", endAt: ",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map(i=>ci(i)).join(",")),`Target(${n})`}(Xe(r))}; limitType=${r.limitType})`}function ro(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):R.isDocumentKey(n.path)?n.path.isEqual(s):n.path.isImmediateParentOf(s)}(r,e)&&function(n,i){for(let s of si(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(o,a,u){let c=Vg(o,a,u);return o.inclusive?c<=0:c<0}(n.startAt,si(n),i)||n.endAt&&!function(o,a,u){let c=Vg(o,a,u);return o.inclusive?c>=0:c>0}(n.endAt,si(n),i))}(r,e)}function K_(r){return r.collectionGroup||(r.path.length%2==1?r.path.lastSegment():r.path.get(r.path.length-2))}function G_(r){return(e,t)=>{let n=!1;for(let i of si(r)){let s=DE(i,e,t);if(s!==0)return s;n=n||i.field.isKeyField()}return 0}}function DE(r,e,t){let n=r.field.isKeyField()?R.comparator(e.key,t.key):function(s,o,a){let u=o.data.field(s),c=a.data.field(s);return u!==null&&c!==null?br(u,c):V()}(r.field,e,t);switch(r.dir){case"asc":return n;case"desc":return-1*n;default:return V()}}var Ft=class{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n!==void 0){for(let[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){yn(this.inner,(t,n)=>{for(let[i,s]of n)e(i,s)})}isEmpty(){return V_(this.inner)}size(){return this.innerSize}};var NE=new le(R.comparator);function rt(){return NE}var W_=new le(R.comparator);function Es(...r){let e=W_;for(let t of r)e=e.insert(t.key,t);return e}function Q_(r){let e=W_;return r.forEach((t,n)=>e=e.insert(t,n.overlayedDocument)),e}function xt(){return Ss()}function H_(){return Ss()}function Ss(){return new Ft(r=>r.toString(),(r,e)=>r.isEqual(e))}var VE=new le(R.comparator),OE=new oe(R.comparator);function Q(...r){let e=OE;for(let t of r)e=e.add(t);return e}var FE=new oe(K);function vd(){return FE}function Y_(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:xs(e)?"-0":e}}function J_(r){return{integerValue:""+r}}function X_(r,e){return C_(e)?J_(e):Y_(r,e)}var hi=class{constructor(){this._=void 0}};function ME(r,e,t){return r instanceof Sr?function(i,s){let o={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&Iu(s)&&(s=gd(s)),s&&(o.fields.__previous_value__=s),{mapValue:o}}(t,e):r instanceof Ht?ey(r,e):r instanceof Yt?ty(r,e):function(i,s){let o=Z_(i,s),a=qg(o)+qg(i.Ie);return Rl(o)&&Rl(i.Ie)?J_(a):Y_(i.serializer,a)}(r,e)}function LE(r,e,t){return r instanceof Ht?ey(r,e):r instanceof Yt?ty(r,e):t}function Z_(r,e){return r instanceof Ar?function(n){return Rl(n)||function(s){return!!s&&"doubleValue"in s}(n)}(e)?e:{integerValue:0}:null}var Sr=class extends hi{},Ht=class extends hi{constructor(e){super(),this.elements=e}};function ey(r,e){let t=ry(e);for(let n of r.elements)t.some(i=>Vt(i,n))||t.push(n);return{arrayValue:{values:t}}}var Yt=class extends hi{constructor(e){super(),this.elements=e}};function ty(r,e){let t=ry(e);for(let n of r.elements)t=t.filter(i=>!Vt(i,n));return{arrayValue:{values:t}}}var Ar=class extends hi{constructor(e,t){super(),this.serializer=e,this.Ie=t}};function qg(r){return we(r.integerValue||r.doubleValue)}function ry(r){return Vs(r)&&r.arrayValue.values?r.arrayValue.values.slice():[]}var hn=class{constructor(e,t){this.field=e,this.transform=t}};function qE(r,e){return r.field.isEqual(e.field)&&function(n,i){return n instanceof Ht&&i instanceof Ht||n instanceof Yt&&i instanceof Yt?ai(n.elements,i.elements,Vt):n instanceof Ar&&i instanceof Ar?Vt(n.Ie,i.Ie):n instanceof Sr&&i instanceof Sr}(r.transform,e.transform)}var $l=class{constructor(e,t){this.version=e,this.transformResults=t}},Ie=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 Ea(r,e){return r.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(r.updateTime):r.exists===void 0||r.exists===e.isFoundDocument()}var di=class{};function ny(r,e){if(!r.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return r.isNoDocument()?new Pr(r.key,Ie.none()):new kr(r.key,r.data,Ie.none());{let t=r.data,n=Ke.empty(),i=new oe(Te.comparator);for(let s of e.fields)if(!i.has(s)){let o=t.field(s);o===null&&s.length>1&&(s=s.popLast(),o=t.field(s)),o===null?n.delete(s):n.set(s,o),i=i.add(s)}return new vt(r.key,n,new ot(i.toArray()),Ie.none())}}function UE(r,e,t){r instanceof kr?function(i,s,o){let a=i.value.clone(),u=Bg(i.fieldTransforms,s,o.transformResults);a.setAll(u),s.convertToFoundDocument(o.version,a).setHasCommittedMutations()}
19(r,e,t):r instanceof vt?function(i,s,o){if(!Ea(i.precondition,s))return void s.convertToUnknownDocument(o.version);let a=Bg(i.fieldTransforms,s,o.transformResults),u=s.data;u.setAll(iy(i)),u.setAll(a),s.convertToFoundDocument(o.version,u).setHasCommittedMutations()}(r,e,t):function(i,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,t)}function As(r,e,t,n){return r instanceof kr?function(s,o,a,u){if(!Ea(s.precondition,o))return a;let c=s.value.clone(),l=jg(s.fieldTransforms,u,o);return c.setAll(l),o.convertToFoundDocument(o.version,c).setHasLocalMutations(),null}(r,e,t,n):r instanceof vt?function(s,o,a,u){if(!Ea(s.precondition,o))return a;let c=jg(s.fieldTransforms,u,o),l=o.data;return l.setAll(iy(s)),l.setAll(c),o.convertToFoundDocument(o.version,l).setHasLocalMutations(),a===null?null:a.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(h=>h.field))}(r,e,t,n):function(s,o,a){return Ea(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(r,e,t)}function BE(r,e){let t=null;for(let n of r.fieldTransforms){let i=e.data.field(n.field),s=Z_(n.transform,i||null);s!=null&&(t===null&&(t=Ke.empty()),t.set(n.field,s))}return t||null}function Ug(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)&&ai(n,i,(s,o)=>qE(s,o))}(r.fieldTransforms,e.fieldTransforms)&&(r.type===0?r.value.isEqual(e.value):r.type!==1||r.data.isEqual(e.data)&&r.fieldMask.isEqual(e.fieldMask))}var kr=class extends di{constructor(e,t,n,i=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}},vt=class extends di{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}};function iy(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 Bg(r,e,t){let n=new Map;O(r.length===t.length);for(let i=0;i<t.length;i++){let s=r[i],o=s.transform,a=e.data.field(s.field);n.set(s.field,LE(o,a,t[i]))}return n}function jg(r,e,t){let n=new Map;for(let i of r){let s=i.transform,o=t.data.field(i.field);n.set(i.field,ME(s,o,e))}return n}var Pr=class extends di{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},Os=class extends di{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};var Fs=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)&&UE(s,e,n[i])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=As(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=As(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=H_();return this.mutations.forEach(i=>{let s=e.get(i.key),o=s.overlayedDocument,a=this.applyToLocalView(o,s.mutatedFields);a=t.has(i.key)?null:a;let u=ny(o,a);u!==null&&n.set(i.key,u),o.isValidDocument()||o.convertToNoDocument(F.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),Q())}isEqual(e){return this.batchId===e.batchId&&ai(this.mutations,e.mutations,(t,n)=>Ug(t,n))&&ai(this.baseMutations,e.baseMutations,(t,n)=>Ug(t,n))}}
19,zl=class r{constructor(e,t,n,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=i}static from(e,t,n){O(e.mutations.length===n.length);let i=function(){return VE}(),s=e.mutations;for(let o=0;o<s.length;o++)i=i.insert(s[o].key,n[o].version);return new r(e,t,n,i)}};var Ms=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{
20      largestBatchId: ${this.largestBatchId},
21      mutation: ${this.mutation.toString()}
22    }`}};var Kl=class{constructor(e,t){this.count=e,this.unchangedNames=t}};var Se,J;function sy(r){switch(r){default:return V();case A.CANCELLED:case A.UNKNOWN:case A.DEADLINE_EXCEEDED:case A.RESOURCE_EXHAUSTED:case A.INTERNAL:case A.UNAVAILABLE:case A.UNAUTHENTICATED:return!1;case A.INVALID_ARGUMENT:case A.NOT_FOUND:case A.ALREADY_EXISTS:case A.PERMISSION_DENIED:case A.FAILED_PRECONDITION:case A.ABORTED:case A.OUT_OF_RANGE:case A.UNIMPLEMENTED:case A.DATA_LOSS:return!0}}function oy(r){if(r===void 0)return Ee("GRPC error has no .code"),A.UNKNOWN;switch(r){case Se.OK:return A.OK;case Se.CANCELLED:return A.CANCELLED;case Se.UNKNOWN:return A.UNKNOWN;case Se.DEADLINE_EXCEEDED:return A.DEADLINE_EXCEEDED;case Se.RESOURCE_EXHAUSTED:return A.RESOURCE_EXHAUSTED;case Se.INTERNAL:return A.INTERNAL;case Se.UNAVAILABLE:return A.UNAVAILABLE;case Se.UNAUTHENTICATED:return A.UNAUTHENTICATED;case Se.INVALID_ARGUMENT:return A.INVALID_ARGUMENT;case Se.NOT_FOUND:return A.NOT_FOUND;case Se.ALREADY_EXISTS:return A.ALREADY_EXISTS;case Se.PERMISSION_DENIED:return A.PERMISSION_DENIED;case Se.FAILED_PRECONDITION:return A.FAILED_PRECONDITION;case Se.ABORTED:return A.ABORTED;case Se.OUT_OF_RANGE:return A.OUT_OF_RANGE;case Se.UNIMPLEMENTED:return A.UNIMPLEMENTED;case Se.DATA_LOSS:return A.DATA_LOSS;default:return V()}}(J=Se||(Se={}))[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 $g=null;function ay(){return new TextEncoder}var jE=new Jr([4294967295,4294967295],0);function zg(r){let e=ay().encode(r),t=new Tg;return t.update(e),new Uint8Array(t.digest())}function Kg(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 Jr([t,n],0),new Jr([i,s],0)]}
vendor: 4,835 bytes, line 22
22var Gl=class r{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new sn(`Invalid padding: ${t}`);if(n<0)throw new sn(`Invalid hash count: ${n}`);if(e.length>0&&this.hashCount===0)throw new sn(`Invalid hash count: ${n}`);if(e.length===0&&t!==0)throw new sn(`Invalid padding when bitmap length is 0: ${t}`);this.Te=8*e.length-t,this.Ee=Jr.fromNumber(this.Te)}de(e,t,n){let i=e.add(t.multiply(Jr.fromNumber(n)));return i.compare(jE)===1&&(i=new Jr([i.getBits(0),i.getBits(1)],0)),i.modulo(this.Ee).toNumber()}Ae(e){return(this.bitmap[Math.floor(e/8)]&1<<e%8)!=0}mightContain(e){if(this.Te===0)return!1;let t=zg(e),[n,i]=Kg(t);for(let s=0;s<this.hashCount;s++){let o=this.de(n,i,s);if(!this.Ae(o))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)),o=new r(s,i,t);return n.forEach(a=>o.insert(a)),o}insert(e){if(this.Te===0)return;let t=zg(e),[n,i]=Kg(t);for(let s=0;s<this.hashCount;s++){let o=this.de(n,i,s);this.Re(o)}}Re(e){let t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}},sn=class extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}};var Ls=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,qs.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new r(F.min(),i,new le(K),rt(),Q())}},qs=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,Q(),Q(),Q())}};var oi=class{constructor(e,t,n,i){this.Ve=e,this.removedTargetIds=t,this.key=n,this.me=i}},Ma=class{constructor(e,t){this.targetId=e,this.fe=t}},La=class{constructor(e,t,n=Oe.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=i}},qa=class{constructor(){this.ge=0,this.pe=Wg(),this.ye=Oe.EMPTY_BYTE_STRING,this.we=!1,this.Se=!0}get current(){return this.we}get resumeToken(){return this.ye}get be(){return this.ge!==0}get De(){return this.Se}Ce(e){e.approximateByteSize()>0&&(this.Se=!0,this.ye=e)}ve(){let e=Q(),t=Q(),n=Q();return this.pe.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:V()}}),new qs(this.ye,this.we,e,t,n)}Fe(){this.Se=!1,this.pe=Wg()}Me(e,t){this.Se=!0,this.pe=this.pe.insert(e,t)}xe(e){this.Se=!0,this.pe=this.pe.remove(e)}Oe(){this.ge+=1}Ne(){this.ge-=1,O(this.ge>=0)}Be(){this.Se=!0,this.we=!0}},Wl=class{constructor(e){this.Le=e,this.ke=new Map,this.qe=rt(),this.Qe=Gg(),this.Ke=new le(K)}$e(e){for(let t of e.Ve)e.me&&e.me.isFoundDocument()?this.Ue(t,e.me):this.We(t,e.key,e.me);for(let t of e.removedTargetIds)this.We(t,e.key,e.me)}Ge(e){this.forEachTarget(e,t=>{let n=this.ze(t);switch(e.state){case 0:this.je(t)&&n.Ce(e.resumeToken);break;case 1:n.Ne(),n.be||n.Fe(),n.Ce(e.resumeToken);break;case 2:n.Ne(),n.be||this.removeTarget(t);break;case 3:this.je(t)&&(n.Be(),n.Ce(e.resumeToken));break;case 4:this.je(t)&&(this.He(t),n.Ce(e.resumeToken));break;default:V()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.ke.forEach((n,i)=>{this.je(i)&&t(i)})}Je(e){let t=e.targetId,n=e.fe.count,i=this.Ye(t);if(i){let s=i.target;if(Va(s))if(n===0){let o=new R(s.path);this.We(t,o,Ce.newNoDocument(o,F.min()))}else O(n===1);else{let o=this.Ze(t);if(o!==n){let a=this.Xe(e),u=a?this.et(a,e,o):1;if(u!==0){this.He(t);let c=u===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(t,c)}$g?.tt(function(l,h,d,m,w){var T,E,I,v,p,g;let _={localCacheCount:l,existenceFilterCount:h.count,databaseId:d.database,projectId:d.projectId},y=h.unchangedNames;return y&&(_.bloomFilter={applied:w===0,hashCount:(T=y?.hashCount)!==null&&T!==void 0?T:0,bitmapLength:(v=(I=(E=y?.bits)===null||E===void 0?void 0:E.bitmap)===null||I===void 0?void 0:I.length)!==null&&v!==void 0?v:0,padding:(g=(p=y?.bits)===null||p===void 0?void 0:p.padding)!==null&&g!==void 0?g:0,mightContain:M=>{var B;return(B=m?.mightContain(M))!==null&&B!==void 0&&B}}),_}(o,e.fe,this.Le.nt(),a,u))}}}}Xe(e){let t=e.fe.unchangedNames;if(!t||!t.bits)return null;let{bits:{bitmap:n="",padding:i=0},hashCount:s=0}=t,o,a;try{o=Er(n).toUint8Array()}catch(u){if(u instanceof Ra)return lt("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{a=new Gl(o,i,s)}catch(u){return lt(u instanceof sn?"BloomFilter error: ":"Applying bloom filter failed: ",u),null}return a.Te===0?null:a}et(e,t,n){return t.fe.count===n-this.rt(e,t.targetId)?0:2}rt(e,t){let n=this.Le.getRemoteKeysForTarget(t),i=0;
22return n.forEach(s=>{let o=this.Le.nt(),a=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;e.mightContain(a)||(this.We(t,s,null),i++)}),i}it(e){let t=new Map;this.ke.forEach((s,o)=>{let a=this.Ye(o);if(a){if(s.current&&Va(a.target)){let u=new R(a.target.path);this.qe.get(u)!==null||this.st(o,u)||this.We(o,u,Ce.newNoDocument(u,e))}s.De&&(t.set(o,s.ve()),s.Fe())}});let n=Q();this.Qe.forEach((s,o)=>{let a=!0;o.forEachWhile(u=>{let c=this.Ye(u);return!c||c.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(n=n.add(s))}),this.qe.forEach((s,o)=>o.setReadTime(e));let i=new Ls(e,t,this.Ke,this.qe,n);return this.qe=rt(),this.Qe=Gg(),this.Ke=new le(K),i}Ue(e,t){if(!this.je(e))return;let n=this.st(e,t.key)?2:0;this.ze(e).Me(t.key,n),this.qe=this.qe.insert(t.key,t),this.Qe=this.Qe.insert(t.key,this.ot(t.key).add(e))}We(e,t,n){if(!this.je(e))return;let i=this.ze(e);this.st(e,t)?i.Me(t,1):i.xe(t),this.Qe=this.Qe.insert(t,this.ot(t).delete(e)),n&&(this.qe=this.qe.insert(t,n))}removeTarget(e){this.ke.delete(e)}Ze(e){let t=this.ze(e).ve();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Oe(e){this.ze(e).Oe()}ze(e){let t=this.ke.get(e);return t||(t=new qa,this.ke.set(e,t)),t}ot(e){let t=this.Qe.get(e);return t||(t=new oe(K),this.Qe=this.Qe.insert(e,t)),t}je(e){let t=this.Ye(e)!==null;return t||x("WatchChangeAggregator","Detected inactive target",e),t}Ye(e){let t=this.ke.get(e);return t&&t.be?null:this.Le._t(e)}He(e){this.ke.set(e,new qa),this.Le.getRemoteKeysForTarget(e).forEach(t=>{this.We(e,t,null)})}st(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}};function Gg(){return new le(R.comparator)}function Wg(){return new le(R.comparator)}var $E=(()=>({asc:"ASCENDING",desc:"DESCENDING"}))(),zE=(()=>({"<":"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"}))(),KE=(()=>({and:"AND",or:"OR"}))(),Ql=class{constructor(e,t){this.databaseId=e,this.useProto3Json=t}};function Hl(r,e){return r.useProto3Json||Zs(e)?e:{value:e}}function fi(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 uy(r,e){return r.useProto3Json?e.toBase64():e.toUint8Array()}function GE(r,e){return fi(r,e.toTimestamp())}function be(r){return O(!!r),F.fromTimestamp(function(t){let n=Ir(t);return new ge(n.seconds,n.nanos)}(r))}function wd(r,e){return function(n){return new ee(["projects",n.projectId,"databases",n.database])}(r).child("documents").child(e).canonicalString()}function cy(r){let e=ee.fromString(r);return O(yy(e)),e}function Us(r,e){return wd(r.databaseId,e.path)}function Dt(r,e){let t=cy(e);if(t.get(1)!==r.databaseId.projectId)throw new C(A.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 C(A.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+r.databaseId.database);return new R(hy(t))}function Yl(r,e){return wd(r.databaseId,e)}function ly(r){let e=cy(r);return e.length===4?ee.emptyPath():hy(e)}function Bs(r){return new ee(["projects",r.databaseId.projectId,"databases",r.databaseId.database]).canonicalString()}function hy(r){return O(r.length>4&&r.get(4)==="documents"),r.popFirst(5)}function Qg(r,e,t){return{name:Us(r,e),fields:t.value.mapValue.fields}}function dy(r,e,t){let n=Dt(r,e.name),i=be(e.updateTime),s=e.createTime?be(e.createTime):F.min(),o=new Ke({mapValue:{fields:e.fields}}),a=Ce.newFoundDocument(n,i,s,o);return t&&a.setHasCommittedMutations(),t?a.setHasCommittedMutations():a}function WE(r,e){return"found"in e?function(n,i){O(!!i.found),i.found.name,i.found.updateTime;let s=Dt(n,i.found.name),o=be(i.found.updateTime),a=i.found.createTime?be(i.found.createTime):F.min(),u=new Ke({mapValue:{fields:i.found.fields}});return Ce.newFoundDocument(s,o,a,u)}(r,e):"missing"in e?function(n,i){O(!!i.missing),O(!!i.readTime);let s=Dt(n,i.missing),o=be(i.readTime);return Ce.newNoDocument(s,o)}(r,e):V()}function QE(r,e){let t;if("targetChange"in e){e.targetChange;let n=function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:V()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(c,l){return c.useProto3Json?(O(l===void 0||typeof l=="string"),Oe.fromBase64String(l||"")):(O(l===void 0||l instanceof Uint8Array),Oe.fromUint8Array(l||new Uint8Array))}(r,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(c){let l=c.code===void 0?A.UNKNOWN:oy(c.code);return new C(l,c.message||"")}(o);t=new La(n,i,s,a||null)}else if("documentChange"in e){e.documentChange;let n=e.documentChange;n.document,n.document.name,n.document.updateTime;let i=Dt(r,n.document.name),s=be(n.document.updateTime),o=n.document.createTime?be(n.document.createTime):F.min(),a=new Ke({mapValue:{fields:n.document.fields}}),u=Ce.newFoundDocument(i,s,o,a),c=n.targetIds||[],l=n.removedTargetIds||[];t=new oi(c,l,u.key,u)}else if("documentDelete"in e){e.documentDelete;let n=e.documentDelete;n.document;let i=Dt(r,n.document),s=n.readTime?be(n.readTime):F.min(),o=Ce.newNoDocument(i,s),a=n.removedTargetIds||[];t=new oi([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;let n=e.documentRemove;n.document;let i=Dt(r,n.document),s=n.removedTargetIds||[];t=new oi([],s,i,null)}else{if(!("filter"in e))return V();{e.filter;let n=e.filter;n.targetId;
22let{count:i=0,unchangedNames:s}=n,o=new Kl(i,s),a=n.targetId;t=new Ma(a,o)}}return t}function js(r,e){let t;if(e instanceof kr)t={update:Qg(r,e.key,e.value)};else if(e instanceof Pr)t={delete:Us(r,e.key)};else if(e instanceof vt)t={update:Qg(r,e.key,e.data),updateMask:eT(e.fieldMask)};else{if(!(e instanceof Os))return V();t={verify:Us(r,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(n=>function(s,o){let a=o.transform;if(a instanceof Sr)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Ht)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof Yt)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof Ar)return{fieldPath:o.field.canonicalString(),increment:a.Ie};throw V()}(0,n))),e.precondition.isNone||(t.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:GE(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:V()}(r,e.precondition)),t}function Jl(r,e){let t=e.currentDocument?function(s){return s.updateTime!==void 0?Ie.updateTime(be(s.updateTime)):s.exists!==void 0?Ie.exists(s.exists):Ie.none()}(e.currentDocument):Ie.none(),n=e.updateTransforms?e.updateTransforms.map(i=>function(o,a){let u=null;if("setToServerValue"in a)O(a.setToServerValue==="REQUEST_TIME"),u=new Sr;else if("appendMissingElements"in a){let l=a.appendMissingElements.values||[];u=new Ht(l)}else if("removeAllFromArray"in a){let l=a.removeAllFromArray.values||[];u=new Yt(l)}else"increment"in a?u=new Ar(o,a.increment):V();let c=Te.fromServerFormat(a.fieldPath);return new hn(c,u)}(r,i)):[];if(e.update){e.update.name;let i=Dt(r,e.update.name),s=new Ke({mapValue:{fields:e.update.fields}});if(e.updateMask){let o=function(u){let c=u.fieldPaths||[];return new ot(c.map(l=>Te.fromServerFormat(l)))}(e.updateMask);return new vt(i,s,o,t,n)}return new kr(i,s,t,n)}if(e.delete){let i=Dt(r,e.delete);return new Pr(i,t)}if(e.verify){let i=Dt(r,e.verify);return new Os(i,t)}return V()}function HE(r,e){return r&&r.length>0?(O(e!==void 0),r.map(t=>function(i,s){let o=i.updateTime?be(i.updateTime):be(s);return o.isEqual(F.min())&&(o=be(s)),new $l(o,i.transformResults||[])}(t,e))):[]}function fy(r,e){return{documents:[Yl(r,e.path)]}}function py(r,e){let t={structuredQuery:{}},n=e.path;e.collectionGroup!==null?(t.parent=Yl(r,n),t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(t.parent=Yl(r,n.popLast()),t.structuredQuery.from=[{collectionId:n.lastSegment()}]);let i=function(u){if(u.length!==0)return _y(ne.create(u,"and"))}(e.filters);i&&(t.structuredQuery.where=i);let s=function(u){if(u.length!==0)return u.map(c=>function(h){return{field:ei(h.field),direction:JE(h.dir)}}(c))}(e.orderBy);s&&(t.structuredQuery.orderBy=s);let o=Hl(r,e.limit);return o!==null&&(t.structuredQuery.limit=o),e.startAt&&(t.structuredQuery.startAt=function(u){return{before:u.inclusive,values:u.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(u){return{before:!u.inclusive,values:u.position}}(e.endAt)),t}function my(r){let e=ly(r.parent),t=r.structuredQuery,n=t.from?t.from.length:0,i=null;if(n>0){O(n===1);let l=t.from[0];l.allDescendants?i=l.collectionId:e=e.child(l.collectionId)}let s=[];t.where&&(s=function(h){let d=gy(h);return d instanceof ne&&_d(d)?d.getFilters():[d]}(t.where));let o=[];t.orderBy&&(o=function(h){return h.map(d=>function(w){return new cn(ti(w.field),function(E){switch(E){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(w.direction))}(d))}(t.orderBy));let a=null;t.limit&&(a=function(h){let d;return d=typeof h=="object"?h.value:h,Zs(d)?null:d}(t.limit));let u=null;t.startAt&&(u=function(h){let d=!!h.before,m=h.values||[];return new Ot(m,d)}(t.startAt));let c=null;return t.endAt&&(c=function(h){let d=!h.before,m=h.values||[];return new Ot(m,d)}(t.endAt)),$_(e,i,o,s,a,"F",u,c)}function YE(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 V()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function gy(r){return r.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":let n=ti(t.unaryFilter.field);return Y.create(n,"==",{doubleValue:NaN});case"IS_NULL":let i=ti(t.unaryFilter.field);return Y.create(i,"==",{nullValue:"NULL_VALUE"});
22case"IS_NOT_NAN":let s=ti(t.unaryFilter.field);return Y.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let o=ti(t.unaryFilter.field);return Y.create(o,"!=",{nullValue:"NULL_VALUE"});default:return V()}}(r):r.fieldFilter!==void 0?function(t){return Y.create(ti(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 V()}}(t.fieldFilter.op),t.fieldFilter.value)}(r):r.compositeFilter!==void 0?function(t){return ne.create(t.compositeFilter.filters.map(n=>gy(n)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return V()}}(t.compositeFilter.op))}(r):V()}function JE(r){return $E[r]}function XE(r){return zE[r]}function ZE(r){return KE[r]}function ei(r){return{fieldPath:r.canonicalString()}}function ti(r){return Te.fromServerFormat(r.fieldPath)}function _y(r){return r instanceof Y?function(t){if(t.op==="=="){if(Rg(t.value))return{unaryFilter:{field:ei(t.field),op:"IS_NAN"}};if(xg(t.value))return{unaryFilter:{field:ei(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(Rg(t.value))return{unaryFilter:{field:ei(t.field),op:"IS_NOT_NAN"}};if(xg(t.value))return{unaryFilter:{field:ei(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:ei(t.field),op:XE(t.op),value:t.value}}}(r):r instanceof ne?function(t){let n=t.getFilters().map(i=>_y(i));return n.length===1?n[0]:{compositeFilter:{op:ZE(t.op),filters:n}}}(r):V()}function eT(r){let e=[];return r.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function yy(r){return r.length>=4&&r.get(0)==="projects"&&r.get(2)==="databases"}var pi=class r{constructor(e,t,n,i,s=F.min(),o=F.min(),a=Oe.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,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)}};var Ua=class{constructor(e){this.ut=e}};function tT(r,e){let t;if(e.document)t=dy(r.ut,e.document,!!e.hasCommittedMutations);else if(e.noDocument){let n=R.fromSegments(e.noDocument.path),i=fn(e.noDocument.readTime);t=Ce.newNoDocument(n,i),e.hasCommittedMutations&&t.setHasCommittedMutations()}else{if(!e.unknownDocument)return V();{let n=R.fromSegments(e.unknownDocument.path),i=fn(e.unknownDocument.version);t=Ce.newUnknownDocument(n,i)}}return e.readTime&&t.setReadTime(function(i){let s=new ge(i[0],i[1]);return F.fromTimestamp(s)}(e.readTime)),t}function Hg(r,e){let t=e.key,n={prefixPath:t.getCollectionPath().popLast().toArray(),collectionGroup:t.collectionGroup,documentId:t.path.lastSegment(),readTime:Ba(e.readTime),hasCommittedMutations:e.hasCommittedMutations};if(e.isFoundDocument())n.document=function(s,o){return{name:Us(s,o.key),fields:o.data.value.mapValue.fields,updateTime:fi(s,o.version.toTimestamp()),createTime:fi(s,o.createTime.toTimestamp())}}(r.ut,e);else if(e.isNoDocument())n.noDocument={path:t.path.toArray(),readTime:dn(e.version)};else{if(!e.isUnknownDocument())return V();n.unknownDocument={path:t.path.toArray(),version:dn(e.version)}}return n}function Ba(r){let e=r.toTimestamp();return[e.seconds,e.nanoseconds]}function dn(r){let e=r.toTimestamp();return{seconds:e.seconds,nanoseconds:e.nanoseconds}}function fn(r){let e=new ge(r.seconds,r.nanoseconds);return F.fromTimestamp(e)}function tn(r,e){let t=(e.baseMutations||[]).map(s=>Jl(r.ut,s));for(let s=0;s<e.mutations.length-1;++s){let o=e.mutations[s];if(s+1<e.mutations.length&&e.mutations[s+1].transform!==void 0){let a=e.mutations[s+1];o.updateTransforms=a.transform.fieldTransforms,e.mutations.splice(s+1,1),++s}}let n=e.mutations.map(s=>Jl(r.ut,s)),i=ge.fromMillis(e.localWriteTimeMs);return new Fs(e.batchId,i,t,n)}function Ts(r){let e=fn(r.readTime),t=r.lastLimboFreeSnapshotVersion!==void 0?fn(r.lastLimboFreeSnapshotVersion):F.min(),n;return n=function(s){return s.documents!==void 0}(r.query)?function(s){return O(s.documents.length===1),Xe(bi(ly(s.documents[0])))}(r.query):function(s){return Xe(my(s))}(r.query),new pi(n,r.targetId,"TargetPurposeListen",r.lastListenSequenceNumber,e,t,Oe.fromBase64String(r.resumeToken))}function vy(r,e){let t=dn(e.snapshotVersion),n=dn(e.lastLimboFreeSnapshotVersion),i;i=Va(e.target)?fy(r.ut,e.target):py(r.ut,e.target);let s=e.resumeToken.toBase64();return{targetId:e.targetId,canonicalId:ln(e.target),readTime:t,resumeToken:s,lastListenSequenceNumber:e.sequenceNumber,lastLimboFreeSnapshotVersion:n,query:i}}function Id(r){let e=my({parent:r.parent,structuredQuery:r.structuredQuery});return r.limitType==="LAST"?Fa(e,e.limit,"L"):e}function fl(r,e){return new Ms(e.largestBatchId,Jl(r.ut,e.overlayMutation))}function Yg(r,e){let t=e.path.lastSegment();return[r,Je(e.path.popLast()),t]}function Jg(r,e,t,n){return{indexId:r,uid:e.uid||"",sequenceNumber:t,readTime:dn(n.readTime),documentKey:Je(n.documentKey.path),largestBatchId:n.largestBatchId}}var Xl=class{getBundleMetadata(e,t){return Xg(e).get(t).next(n=>{if(n)return function(s){return{id:s.bundleId,createTime:fn(s.createTime),version:s.version}}(n)})}saveBundleMetadata(e,t){return Xg(e).put(function(i){return{bundleId:i.id,createTime:dn(be(i.createTime)),version:i.version}}(t))}getNamedQuery(e,t){return Zg(e).get(t).next(n=>{if(n)return function(s){return{name:s.name,query:Id(s.bundledQuery),readTime:fn(s.readTime)}}(n)})}saveNamedQuery(e,t){return Zg(e).put(function(i){return{name:i.name,readTime:dn(be(i.readTime)),bundledQuery:i.bundledQuery}}(t))}};function Xg(r){return Fe(r,"bundles")}function Zg(r){return Fe(r,"namedQueries")}
vendor: 14,514 bytes, line 22
22var ja=class r{constructor(e,t){this.serializer=e,this.userId=t}static ct(e,t){let n=t.uid||"";return new r(e,n)}getOverlay(e,t){return ys(e).get(Yg(this.userId,t)).next(n=>n?fl(this.serializer,n):null)}getOverlays(e,t){let n=xt();return b.forEach(t,i=>this.getOverlay(e,i).next(s=>{s!==null&&n.set(i,s)})).next(()=>n)}saveOverlays(e,t,n){let i=[];return n.forEach((s,o)=>{let a=new Ms(t,o);i.push(this.lt(e,a))}),b.waitFor(i)}removeOverlaysForBatchId(e,t,n){let i=new Set;t.forEach(o=>i.add(Je(o.getCollectionPath())));let s=[];return i.forEach(o=>{let a=IDBKeyRange.bound([this.userId,o,n],[this.userId,o,n+1],!1,!0);s.push(ys(e).H("collectionPathOverlayIndex",a))}),b.waitFor(s)}getOverlaysForCollection(e,t,n){let i=xt(),s=Je(t),o=IDBKeyRange.bound([this.userId,s,n],[this.userId,s,Number.POSITIVE_INFINITY],!0);return ys(e).W("collectionPathOverlayIndex",o).next(a=>{for(let u of a){let c=fl(this.serializer,u);i.set(c.getKey(),c)}return i})}getOverlaysForCollectionGroup(e,t,n,i){let s=xt(),o,a=IDBKeyRange.bound([this.userId,t,n],[this.userId,t,Number.POSITIVE_INFINITY],!0);return ys(e).Y({index:"collectionGroupOverlayIndex",range:a},(u,c,l)=>{let h=fl(this.serializer,c);s.size()<i||h.largestBatchId===o?(s.set(h.getKey(),h),o=h.largestBatchId):l.done()}).next(()=>s)}lt(e,t){return ys(e).put(function(i,s,o){let[a,u,c]=Yg(s,o.mutation.key);return{userId:s,collectionPath:u,documentId:c,collectionGroup:o.mutation.key.getCollectionGroup(),largestBatchId:o.largestBatchId,overlayMutation:js(i.ut,o.mutation)}}(this.serializer,this.userId,t))}};function ys(r){return Fe(r,"documentOverlays")}var Wt=class{constructor(){}ht(e,t){this.Pt(e,t),t.It()}Pt(e,t){if("nullValue"in e)this.Tt(t,5);else if("booleanValue"in e)this.Tt(t,10),t.Et(e.booleanValue?1:0);else if("integerValue"in e)this.Tt(t,15),t.Et(we(e.integerValue));else if("doubleValue"in e){let n=we(e.doubleValue);isNaN(n)?this.Tt(t,13):(this.Tt(t,15),xs(n)?t.Et(0):t.Et(n))}else if("timestampValue"in e){let n=e.timestampValue;this.Tt(t,20),typeof n=="string"?t.dt(n):(t.dt(`${n.seconds||""}`),t.Et(n.nanos||0))}else if("stringValue"in e)this.At(e.stringValue,t),this.Rt(t);else if("bytesValue"in e)this.Tt(t,30),t.Vt(Er(e.bytesValue)),this.Rt(t);else if("referenceValue"in e)this.ft(e.referenceValue,t);else if("geoPointValue"in e){let n=e.geoPointValue;this.Tt(t,45),t.Et(n.latitude||0),t.Et(n.longitude||0)}else"mapValue"in e?F_(e)?this.Tt(t,Number.MAX_SAFE_INTEGER):(this.gt(e.mapValue,t),this.Rt(t)):"arrayValue"in e?(this.yt(e.arrayValue,t),this.Rt(t)):V()}At(e,t){this.Tt(t,25),this.wt(e,t)}wt(e,t){t.dt(e)}gt(e,t){let n=e.fields||{};this.Tt(t,55);for(let i of Object.keys(n))this.At(i,t),this.Pt(n[i],t)}yt(e,t){let n=e.values||[];this.Tt(t,50);for(let i of n)this.Pt(i,t)}ft(e,t){this.Tt(t,37),R.fromName(e).path.forEach(n=>{this.Tt(t,60),this.wt(n,t)})}Tt(e,t){e.Et(t)}Rt(e){e.Et(2)}};Wt.St=new Wt;function rT(r){if(r===0)return 8;let e=0;return!(r>>4)&&(e+=4,r<<=4),!(r>>6)&&(e+=2,r<<=2),!(r>>7)&&(e+=1),e}function e_(r){let e=64-function(n){let i=0;for(let s=0;s<8;++s){let o=rT(255&n[s]);if(i+=o,o!==8)break}return i}(r);return Math.ceil(e/8)}var Zl=class{constructor(){this.buffer=new Uint8Array(1024),this.position=0}bt(e){let t=e[Symbol.iterator](),n=t.next();for(;!n.done;)this.Dt(n.value),n=t.next();this.Ct()}vt(e){let t=e[Symbol.iterator](),n=t.next();for(;!n.done;)this.Ft(n.value),n=t.next();this.Mt()}xt(e){for(let t of e){let n=t.charCodeAt(0);if(n<128)this.Dt(n);else if(n<2048)this.Dt(960|n>>>6),this.Dt(128|63&n);else if(t<"\uD800"||"\uDBFF"<t)this.Dt(480|n>>>12),this.Dt(128|63&n>>>6),this.Dt(128|63&n);else{let i=t.codePointAt(0);this.Dt(240|i>>>18),this.Dt(128|63&i>>>12),this.Dt(128|63&i>>>6),this.Dt(128|63&i)}}this.Ct()}Ot(e){for(let t of e){let n=t.charCodeAt(0);if(n<128)this.Ft(n);else if(n<2048)this.Ft(960|n>>>6),this.Ft(128|63&n);else if(t<"\uD800"||"\uDBFF"<t)this.Ft(480|n>>>12),this.Ft(128|63&n>>>6),this.Ft(128|63&n);else{let i=t.codePointAt(0);this.Ft(240|i>>>18),this.Ft(128|63&i>>>12),this.Ft(128|63&i>>>6),this.Ft(128|63&i)}}this.Mt()}Nt(e){let t=this.Bt(e),n=e_(t);this.Lt(1+n),this.buffer[this.position++]=255&n;for(let i=t.length-n;i<t.length;++i)this.buffer[this.position++]=255&t[i]}kt(e){let t=this.Bt(e),n=e_(t);this.Lt(1+n),this.buffer[this.position++]=~(255&n);for(let i=t.length-n;i<t.length;++i)this.buffer[this.position++]=~(255&t[i])}qt(){this.Qt(255),this.Qt(255)}Kt(){this.$t(255),this.$t(255)}reset(){this.position=0}seed(e){this.Lt(e.length),this.buffer.set(e,this.position),this.position+=e.length}Ut(){return this.buffer.slice(0,this.position)}Bt(e){let t=function(s){let o=new DataView(new ArrayBuffer(8));return o.setFloat64(0,s,!1),new Uint8Array(o.buffer)}(e),n=(128&t[0])!=0;t[0]^=n?255:128;for(let i=1;i<t.length;++i)t[i]^=n?255:0;return t}Dt(e){let t=255&e;t===0?(this.Qt(0),this.Qt(255)):t===255?(this.Qt(255),this.Qt(0)):this.Qt(t)}Ft(e){let t=255&e;t===0?(this.$t(0),this.$t(255)):t===255?(this.$t(255),this.$t(0)):this.$t(e)}Ct(){this.Qt(0),this.Qt(1)}Mt(){this.$t(0),this.$t(1)}Qt(e){this.Lt(1),this.buffer[this.position++]=e}$t(e){this.Lt(1),this.buffer[this.position++]=~e}Lt(e){let t=e+this.position;if(t<=this.buffer.length)return;let n=2*this.buffer.length;n<t&&(n=t);let i=new Uint8Array(n);i.set(this.buffer),this.buffer=i}},eh=class{constructor(e){this.Wt=e}Vt(e){this.Wt.bt(e)}dt(e){this.Wt.xt(e)}Et(e){this.Wt.Nt(e)}It(){this.Wt.qt()}},th=class{constructor(e){this.Wt=e}Vt(e){this.Wt.vt(e)}dt(e){this.Wt.Ot(e)}Et(e){this.Wt.kt(e)}It(){this.Wt.Kt()}},rn=class{constructor(){this.Wt=new Zl,this.Gt=new eh(this.Wt),this.zt=new th(this.Wt)}seed(e){this.Wt.seed(e)}jt(e){return e===0?this.Gt:this.zt}Ut(){return this.Wt.Ut()}reset(){this.Wt.reset()}};var nn=class r{constructor(e,t,n,i){this.indexId=e,this.documentKey=t,this.arrayValue=n,this.directionalValue=i}Ht(){let e=this.directionalValue.length,t=e===0||this.directionalValue[e-1]===255?e+1:e,n=new Uint8Array(t);return n.set(this.directionalValue,0),t!==e?n.set([0],this.directionalValue.length):++n[n.length-1],new r(this.indexId,this.documentKey,this.arrayValue,n)}};function fr(r,e){let t=r.indexId-e.indexId;return t!==0?t:(t=t_(r.arrayValue,e.arrayValue),t!==0?t:(t=t_(r.directionalValue,e.directionalValue),t!==0?t:R.comparator(r.documentKey,e.documentKey)))}function t_(r,e){for(let t=0;t<r.length&&t<e.length;++t){let n=r[t]-e[t];if(n!==0)return n}return r.length-e.length}var $a=class{constructor(e){this.Jt=new oe((t,n)=>Te.comparator(t.field,n.field)),this.collectionId=e.collectionGroup!=null?e.collectionGroup:e.path.lastSegment(),this.Yt=e.orderBy,this.Zt=[];for(let t of e.filters){let n=t;n.isInequality()?this.Jt=this.Jt.add(n):this.Zt.push(n)}}get Xt(){return this.Jt.size>1}en(e){if(O(e.collectionGroup===this.collectionId),this.Xt)return!1;let t=bl(e);if(t!==void 0&&!this.tn(t))return!1;let n=Zr(e),i=new Set,s=0,o=0;for(;s<n.length&&this.tn(n[s]);++s)i=i.add(n[s].fieldPath.canonicalString());if(s===n.length)return!0;if(this.Jt.size>0){let a=this.Jt.getIterator().getNext();if(!i.has(a.field.canonicalString())){let u=n[s];if(!this.nn(a,u)||!this.rn(this.Yt[o++],u))return!1}++s}for(;s<n.length;++s){let a=n[s];if(o>=this.Yt.length||!this.rn(this.Yt[o++],a))return!1}return!0}sn(){if(this.Xt)return null;let e=new oe(Te.comparator),t=[];for(let n of this.Zt)if(!n.field.isKeyField())if(n.op==="array-contains"||n.op==="array-contains-any")t.push(new ii(n.field,2));else{if(e.has(n.field))continue;e=e.add(n.field),t.push(new ii(n.field,0))}for(let n of this.Yt)n.field.isKeyField()||e.has(n.field)||(e=e.add(n.field),t.push(new ii(n.field,n.dir==="asc"?0:1)));return new ui(ui.UNKNOWN_ID,this.collectionId,t,Cs.empty())}tn(e){for(let t of this.Zt)if(this.nn(t,e))return!0;return!1}nn(e,t){if(e===void 0||!e.field.isEqual(t.fieldPath))return!1;let n=e.op==="array-contains"||e.op==="array-contains-any";return t.kind===2===n}rn(e,t){return!!e.field.isEqual(t.fieldPath)&&(t.kind===0&&e.dir==="asc"||t.kind===1&&e.dir==="desc")}};function wy(r){var e,t;if(O(r instanceof Y||r instanceof ne),r instanceof Y){if(r instanceof Na){let i=((t=(e=r.value.arrayValue)===null||e===void 0?void 0:e.values)===null||t===void 0?void 0:t.map(s=>Y.create(r.field,"==",s)))||[];return ne.create(i,"or")}return r}let n=r.filters.map(i=>wy(i));return ne.create(n,r.op)}function nT(r){if(r.getFilters().length===0)return[];let e=ih(wy(r));return O(Iy(e)),rh(e)||nh(e)?[e]:e.getFilters()}function rh(r){return r instanceof Y}function nh(r){return r instanceof ne&&_d(r)}function Iy(r){return rh(r)||nh(r)||function(t){if(t instanceof ne&&Dl(t)){for(let n of t.getFilters())if(!rh(n)&&!nh(n))return!1;return!0}return!1}(r)}function ih(r){if(O(r instanceof Y||r instanceof ne),r instanceof Y)return r;if(r.filters.length===1)return ih(r.filters[0]);let e=r.filters.map(n=>ih(n)),t=ne.create(e,r.op);return t=za(t),Iy(t)?t:(O(t instanceof ne),O(li(t)),O(t.filters.length>1),t.filters.reduce((n,i)=>Ed(n,i)))}function Ed(r,e){let t;return O(r instanceof Y||r instanceof ne),O(e instanceof Y||e instanceof ne),t=r instanceof Y?e instanceof Y?function(i,s){return ne.create([i,s],"and")}(r,e):r_(r,e):e instanceof Y?r_(e,r):function(i,s){if(O(i.filters.length>0&&s.filters.length>0),li(i)&&li(s))return U_(i,s.getFilters());let o=Dl(i)?i:s,a=Dl(i)?s:i,u=o.filters.map(c=>Ed(c,a));return ne.create(u,"or")}(r,e),za(t)}function r_(r,e){if(li(e))return U_(e,r.getFilters());{let t=e.filters.map(n=>Ed(r,n));return ne.create(t,"or")}}function za(r){if(O(r instanceof Y||r instanceof ne),r instanceof Y)return r;let e=r.getFilters();if(e.length===1)return za(e[0]);if(L_(r))return r;let t=e.map(i=>za(i)),n=[];return t.forEach(i=>{i instanceof Y?n.push(i):i instanceof ne&&(i.op===r.op?n.push(...i.filters):n.push(i))}),n.length===1?n[0]:ne.create(n,r.op)}var sh=class{constructor(){this.on=new $s}addToCollectionParentIndex(e,t){return this.on.add(t),b.resolve()}getCollectionParents(e,t){return b.resolve(this.on.getEntries(t))}addFieldIndex(e,t){return b.resolve()}deleteFieldIndex(e,t){return b.resolve()}deleteAllFieldIndexes(e){return b.resolve()}createTargetIndexes(e,t){return b.resolve()}getDocumentsMatchingTarget(e,t){return b.resolve(null)}getIndexType(e,t){return b.resolve(0)}getFieldIndexes(e,t){return b.resolve([])}getNextCollectionGroupToUpdate(e){return b.resolve(null)}getMinOffset(e,t){return b.resolve(ht.min())}getMinOffsetFromCollectionGroup(e,t){return b.resolve(ht.min())}updateCollectionGroup(e,t,n){return b.resolve()}updateIndexEntries(e,t){return b.resolve()}},$s=class{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),i=this.index[t]||new oe(ee.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 oe(ee.comparator)).toArray()}};var ma=new Uint8Array(0),oh=class{constructor(e,t){this.user=e,this.databaseId=t,this._n=new $s,this.an=new Ft(n=>ln(n),(n,i)=>eo(n,i)),this.uid=e.uid||""}addToCollectionParentIndex(e,t){if(!this._n.has(t)){let n=t.lastSegment(),i=t.popLast();e.addOnCommittedListener(()=>{this._n.add(t)});let s={collectionId:n,parent:Je(i)};return n_(e).put(s)}return b.resolve()}getCollectionParents(e,t){let n=[],i=IDBKeyRange.bound([t,""],[S_(t),""],!1,!0);return n_(e).W(i).next(s=>{for(let o of s){if(o.collectionId!==t)break;n.push(Ct(o.parent))}return n})}addFieldIndex(e,t){let n=vs(e),i=function(a){return{indexId:a.indexId,collectionGroup:a.collectionGroup,fields:a.fields.map(u=>[u.fieldPath.canonicalString(),u.kind])}}(t);delete i.indexId;let s=n.add(i);if(t.indexState){let o=Yn(e);return s.next(a=>{o.put(Jg(a,this.user,t.indexState.sequenceNumber,t.indexState.offset))})}return s.next()}deleteFieldIndex(e,t){let n=vs(e),i=Yn(e),s=Hn(e);return n.delete(t.indexId).next(()=>i.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0))).next(()=>s.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0)))}deleteAllFieldIndexes(e){let t=vs(e),n=Hn(e),i=Yn(e);return t.H().next(()=>n.H()).next(()=>i.H())}createTargetIndexes(e,t){return b.forEach(this.un(t),n=>this.getIndexType(e,n).next(i=>{if(i===0||i===1){let s=new $a(n).sn();if(s!=null)return this.addFieldIndex(e,s)}}))}getDocumentsMatchingTarget(e,t){let n=Hn(e),i=!0,s=new Map;return b.forEach(this.un(t),o=>this.cn(e,o).next(a=>{i&&(i=!!a),s.set(o,a)})).next(()=>{if(i){let o=Q(),a=[];return b.forEach(s,(u,c)=>{x("IndexedDbIndexManager",`Using index ${function(p){return`id=${p.indexId}|cg=${p.collectionGroup}|f=${p.fields.map(g=>`${g.fieldPath}:${g.kind}`).join(",")}`}(u)} to execute ${ln(t)}`);let l=function(p,g){let _=bl(g);if(_===void 0)return null;for(let y of Oa(p,_.fieldPath))switch(y.op){case"array-contains-any":return y.value.arrayValue.values||[];case"array-contains":return[y.value]}return null}(c,u),h=function(p,g){let _=new Map;for(let y of Zr(g))for(let M of Oa(p,y.fieldPath))switch(M.op){case"==":case"in":_.set(y.fieldPath.canonicalString(),M.value);break;case"not-in":case"!=":return _.set(y.fieldPath.canonicalString(),M.value),Array.from(_.values())}return null}(c,u),d=function(p,g){let _=[],y=!0;for(let M of Zr(g)){let B=M.kind===0?Fg(p,M.fieldPath,p.startAt):Mg(p,M.fieldPath,p.startAt);_.push(B.value),y&&(y=B.inclusive)}return new Ot(_,y)}(c,u),m=function(p,g){let _=[],y=!0;for(let M of Zr(g)){let B=M.kind===0?Mg(p,M.fieldPath,p.endAt):Fg(p,M.fieldPath,p.endAt);_.push(B.value),y&&(y=B.inclusive)}return new Ot(_,y)}(c,u),w=this.ln(u,c,d),T=this.ln(u,c,m),E=this.hn(u,c,h),I=this.Pn(u.indexId,l,w,d.inclusive,T,m.inclusive,E);return b.forEach(I,v=>n.j(v,t.limit).next(p=>{p.forEach(g=>{let _=R.fromSegments(g.documentKey);o.has(_)||(o=o.add(_),a.push(_))})}))}).next(()=>a)}return b.resolve(null)})}un(e){let t=this.an.get(e);return t||(e.filters.length===0?t=[e]:t=nT(ne.create(e.filters,"and")).map(n=>Bl(e.path,e.collectionGroup,e.orderBy,n.getFilters(),e.limit,e.startAt,e.endAt)),this.an.set(e,t),t)}Pn(e,t,n,i,s,o,a){let u=(t!=null?t.length:1)*Math.max(n.length,s.length),c=u/(t!=null?t.length:1),l=[];for(let h=0;h<u;++h){let d=t?this.In(t[h/c]):ma,m=this.Tn(e,d,n[h%c],i),w=this.En(e,d,s[h%c],o),T=a.map(E=>this.Tn(e,d,E,!0));l.push(...this.createRange(m,w,T))}return l}Tn(e,t,n,i){let s=new nn(e,R.empty(),t,n);return i?s:s.Ht()}En(e,t,n,i){let s=new nn(e,R.empty(),t,n);return i?s.Ht():s}cn(e,t){let n=new $a(t),i=t.collectionGroup!=null?t.collectionGroup:t.path.lastSegment();return this.getFieldIndexes(e,i).next(s=>{let o=null;for(let a of s)n.en(a)&&(!o||a.fields.length>o.fields.length)&&(o=a);return o}
22)}getIndexType(e,t){let n=2,i=this.un(t);return b.forEach(i,s=>this.cn(e,s).next(o=>{o?n!==0&&o.fields.length<function(u){let c=new oe(Te.comparator),l=!1;for(let h of u.filters)for(let d of h.getFlattenedFilters())d.field.isKeyField()||(d.op==="array-contains"||d.op==="array-contains-any"?l=!0:c=c.add(d.field));for(let h of u.orderBy)h.field.isKeyField()||(c=c.add(h.field));return c.size+(l?1:0)}(s)&&(n=1):n=0})).next(()=>function(o){return o.limit!==null}(t)&&i.length>1&&n===2?1:n)}dn(e,t){let n=new rn;for(let i of Zr(e)){let s=t.data.field(i.fieldPath);if(s==null)return null;let o=n.jt(i.kind);Wt.St.ht(s,o)}return n.Ut()}In(e){let t=new rn;return Wt.St.ht(e,t.jt(0)),t.Ut()}An(e,t){let n=new rn;return Wt.St.ht(un(this.databaseId,t),n.jt(function(s){let o=Zr(s);return o.length===0?0:o[o.length-1].kind}(e))),n.Ut()}hn(e,t,n){if(n===null)return[];let i=[];i.push(new rn);let s=0;for(let o of Zr(e)){let a=n[s++];for(let u of i)if(this.Rn(t,o.fieldPath)&&Vs(a))i=this.Vn(i,o,a);else{let c=u.jt(o.kind);Wt.St.ht(a,c)}}return this.mn(i)}ln(e,t,n){return this.hn(e,t,n.position)}mn(e){let t=[];for(let n=0;n<e.length;++n)t[n]=e[n].Ut();return t}Vn(e,t,n){let i=[...e],s=[];for(let o of n.arrayValue.values||[])for(let a of i){let u=new rn;u.seed(a.Ut()),Wt.St.ht(o,u.jt(t.kind)),s.push(u)}return s}Rn(e,t){return!!e.filters.find(n=>n instanceof Y&&n.field.isEqual(t)&&(n.op==="in"||n.op==="not-in"))}getFieldIndexes(e,t){let n=vs(e),i=Yn(e);return(t?n.W("collectionGroupIndex",IDBKeyRange.bound(t,t)):n.W()).next(s=>{let o=[];return b.forEach(s,a=>i.get([a.indexId,this.uid]).next(u=>{o.push(function(l,h){let d=h?new Cs(h.sequenceNumber,new ht(fn(h.readTime),new R(Ct(h.documentKey)),h.largestBatchId)):Cs.empty(),m=l.fields.map(([w,T])=>new ii(Te.fromServerFormat(w),T));return new ui(l.indexId,l.collectionGroup,m,d)}(a,u))})).next(()=>o)})}getNextCollectionGroupToUpdate(e){return this.getFieldIndexes(e).next(t=>t.length===0?null:(t.sort((n,i)=>{let s=n.indexState.sequenceNumber-i.indexState.sequenceNumber;return s!==0?s:K(n.collectionGroup,i.collectionGroup)}),t[0].collectionGroup))}updateCollectionGroup(e,t,n){let i=vs(e),s=Yn(e);return this.fn(e).next(o=>i.W("collectionGroupIndex",IDBKeyRange.bound(t,t)).next(a=>b.forEach(a,u=>s.put(Jg(u.indexId,this.user,o,n)))))}updateIndexEntries(e,t){let n=new Map;return b.forEach(t,(i,s)=>{let o=n.get(i.collectionGroup);return(o?b.resolve(o):this.getFieldIndexes(e,i.collectionGroup)).next(a=>(n.set(i.collectionGroup,a),b.forEach(a,u=>this.gn(e,i,u).next(c=>{let l=this.pn(s,u);return c.isEqual(l)?b.resolve():this.yn(e,s,u,c,l)}))))})}wn(e,t,n,i){return Hn(e).put({indexId:i.indexId,uid:this.uid,arrayValue:i.arrayValue,directionalValue:i.directionalValue,orderedDocumentKey:this.An(n,t.key),documentKey:t.key.path.toArray()})}Sn(e,t,n,i){return Hn(e).delete([i.indexId,this.uid,i.arrayValue,i.directionalValue,this.An(n,t.key),t.key.path.toArray()])}gn(e,t,n){let i=Hn(e),s=new oe(fr);return i.Y({index:"documentKeyIndex",range:IDBKeyRange.only([n.indexId,this.uid,this.An(n,t)])},(o,a)=>{s=s.add(new nn(n.indexId,t,a.arrayValue,a.directionalValue))}).next(()=>s)}pn(e,t){let n=new oe(fr),i=this.dn(t,e);if(i==null)return n;let s=bl(t);if(s!=null){let o=e.data.field(s.fieldPath);if(Vs(o))for(let a of o.arrayValue.values||[])n=n.add(new nn(t.indexId,e.key,this.In(a),i))}else n=n.add(new nn(t.indexId,e.key,ma,i));return n}yn(e,t,n,i,s){x("IndexedDbIndexManager","Updating index entries for document '%s'",t.key);let o=[];return function(u,c,l,h,d){let m=u.getIterator(),w=c.getIterator(),T=Qn(m),E=Qn(w);for(;T||E;){let I=!1,v=!1;if(T&&E){let p=l(T,E);p<0?v=!0:p>0&&(I=!0)}else T!=null?v=!0:I=!0;I?(h(E),E=Qn(w)):v?(d(T),T=Qn(m)):(T=Qn(m),E=Qn(w))}}(i,s,fr,a=>{o.push(this.wn(e,t,n,a))},a=>{o.push(this.Sn(e,t,n,a))}),b.waitFor(o)}fn(e){let t=1;return Yn(e).Y({index:"sequenceNumberIndex",reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},(n,i,s)=>{s.done(),t=i.sequenceNumber+1}).next(()=>t)}createRange(e,t,n){n=n.sort((o,a)=>fr(o,a)).filter((o,a,u)=>!a||fr(o,u[a-1])!==0);let i=[];i.push(e);for(let o of n){let a=fr(o,e),u=fr(o,t);if(a===0)i[0]=e.Ht();else if(a>0&&u<0)i.push(o),i.push(o.Ht());else if(u>0)break}i.push(t);let s=[];for(let o=0;o<i.length;o+=2){if(this.bn(i[o],i[o+1]))return[];let a=[i[o].indexId,this.uid,i[o].arrayValue,i[o].directionalValue,ma,[]],u=[i[o+1].indexId,this.uid,i[o+1].arrayValue,i[o+1].directionalValue,ma,[]];s.push(IDBKeyRange.bound(a,u))}return s}bn(e,t){return fr(e,t)>0}getMinOffsetFromCollectionGroup(e,t){return this.getFieldIndexes(e,t).next(i_)}getMinOffset(e,t){return b.mapArray(this.un(t),n=>this.cn(e,n).next(i=>i||V())).next(i_)}};function n_(r){return Fe(r,"collectionParents")}function Hn(r){return Fe(r,"indexEntries")}function vs(r){return Fe(r,"indexConfiguration")}function Yn(r){return Fe(r,"indexState")}function i_(r){O(r.length!==0);let e=r[0].indexState.offset,t=e.largestBatchId;for(let n=1;n<r.length;n++){let i=r[n].indexState.offset;pd(i,e)<0&&(e=i),t<i.largestBatchId&&(t=i.largestBatchId)}return new ht(e.readTime,e.documentKey,t)}var s_={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0}
22,ct=class r{constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}static withCacheSize(e){return new r(e,r.DEFAULT_COLLECTION_PERCENTILE,r.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}};function Ey(r,e,t){let n=r.store("mutations"),i=r.store("documentMutations"),s=[],o=IDBKeyRange.only(t.batchId),a=0,u=n.Y({range:o},(l,h,d)=>(a++,d.delete()));s.push(u.next(()=>{O(a===1)}));let c=[];for(let l of t.mutations){let h=x_(e,l.key.path,t.batchId);s.push(i.delete(h)),c.push(l.key)}return b.waitFor(s).next(()=>c)}function Ka(r){if(!r)return 0;let e;if(r.document)e=r.document;else if(r.unknownDocument)e=r.unknownDocument;else{if(!r.noDocument)throw V();e=r.noDocument}return JSON.stringify(e).length}ct.DEFAULT_COLLECTION_PERCENTILE=10,ct.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,ct.DEFAULT=new ct(41943040,ct.DEFAULT_COLLECTION_PERCENTILE,ct.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),ct.DISABLED=new ct(-1,0,0);var Ga=class r{constructor(e,t,n,i){this.userId=e,this.serializer=t,this.indexManager=n,this.referenceDelegate=i,this.Dn={}}static ct(e,t,n,i){O(e.uid!=="");let s=e.isAuthenticated()?e.uid:"";return new r(s,t,n,i)}checkEmpty(e){let t=!0,n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return pr(e).Y({index:"userMutationsIndex",range:n},(i,s,o)=>{t=!1,o.done()}).next(()=>t)}addMutationBatch(e,t,n,i){let s=ri(e),o=pr(e);return o.add({}).next(a=>{O(typeof a=="number");let u=new Fs(a,t,n,i),c=function(m,w,T){let E=T.baseMutations.map(v=>js(m.ut,v)),I=T.mutations.map(v=>js(m.ut,v));return{userId:w,batchId:T.batchId,localWriteTimeMs:T.localWriteTime.toMillis(),baseMutations:E,mutations:I}}(this.serializer,this.userId,u),l=[],h=new oe((d,m)=>K(d.canonicalString(),m.canonicalString()));for(let d of i){let m=x_(this.userId,d.key.path,a);h=h.add(d.key.path.popLast()),l.push(o.put(c)),l.push(s.put(m,lE))}return h.forEach(d=>{l.push(this.indexManager.addToCollectionParentIndex(e,d))}),e.addOnCommittedListener(()=>{this.Dn[a]=u.keys()}),b.waitFor(l).next(()=>u)})}lookupMutationBatch(e,t){return pr(e).get(t).next(n=>n?(O(n.userId===this.userId),tn(this.serializer,n)):null)}Cn(e,t){return this.Dn[t]?b.resolve(this.Dn[t]):this.lookupMutationBatch(e,t).next(n=>{if(n){let i=n.keys();return this.Dn[t]=i,i}return null})}getNextMutationBatchAfterBatchId(e,t){let n=t+1,i=IDBKeyRange.lowerBound([this.userId,n]),s=null;return pr(e).Y({index:"userMutationsIndex",range:i},(o,a,u)=>{a.userId===this.userId&&(O(a.batchId>=n),s=tn(this.serializer,a)),u.done()}).next(()=>s)}getHighestUnacknowledgedBatchId(e){let t=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),n=-1;return pr(e).Y({index:"userMutationsIndex",range:t,reverse:!0},(i,s,o)=>{n=s.batchId,o.done()}).next(()=>n)}getAllMutationBatches(e){let t=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return pr(e).W("userMutationsIndex",t).next(n=>n.map(i=>tn(this.serializer,i)))}getAllMutationBatchesAffectingDocumentKey(e,t){let n=va(this.userId,t.path),i=IDBKeyRange.lowerBound(n),s=[];return ri(e).Y({range:i},(o,a,u)=>{let[c,l,h]=o,d=Ct(l);if(c===this.userId&&t.path.isEqual(d))return pr(e).get(h).next(m=>{if(!m)throw V();O(m.userId===this.userId),s.push(tn(this.serializer,m))});u.done()}).next(()=>s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new oe(K),i=[];return t.forEach(s=>{let o=va(this.userId,s.path),a=IDBKeyRange.lowerBound(o),u=ri(e).Y({range:a},(c,l,h)=>{let[d,m,w]=c,T=Ct(m);d===this.userId&&s.path.isEqual(T)?n=n.add(w):h.done()});i.push(u)}),b.waitFor(i).next(()=>this.vn(e,n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,i=n.length+1,s=va(this.userId,n),o=IDBKeyRange.lowerBound(s),a=new oe(K);return ri(e).Y({range:o},(u,c,l)=>{let[h,d,m]=u,w=Ct(d);h===this.userId&&n.isPrefixOf(w)?w.length===i&&(a=a.add(m)):l.done()}).next(()=>this.vn(e,a))}vn(e,t){let n=[],i=[];return t.forEach(s=>{i.push(pr(e).get(s).next(o=>{if(o===null)throw V();O(o.userId===this.userId),n.push(tn(this.serializer,o))}))}),b.waitFor(i).next(()=>n)}removeMutationBatch(e,t){return Ey(e.ae,this.userId,t).next(n=>(e.addOnCommittedListener(()=>{this.Fn(t.batchId)}),b.forEach(n,i=>this.referenceDelegate.markPotentiallyOrphaned(e,i))))}Fn(e){delete this.Dn[e]}performConsistencyCheck(e){return this.checkEmpty(e).next(t=>
vendor: 27,866 bytes, lines 22-27
22{if(!t)return b.resolve();let n=IDBKeyRange.lowerBound(function(o){return[o]}(this.userId)),i=[];return ri(e).Y({range:n},(s,o,a)=>{if(s[0]===this.userId){let u=Ct(s[1]);i.push(u)}else a.done()}).next(()=>{O(i.length===0)})})}containsKey(e,t){return Ty(e,this.userId,t)}Mn(e){return by(e).get(this.userId).next(t=>t||{userId:this.userId,lastAcknowledgedBatchId:-1,lastStreamToken:""})}};function Ty(r,e,t){let n=va(e,t.path),i=n[1],s=IDBKeyRange.lowerBound(n),o=!1;return ri(r).Y({range:s,J:!0},(a,u,c)=>{let[l,h,d]=a;l===e&&h===i&&(o=!0),c.done()}).next(()=>o)}function pr(r){return Fe(r,"mutations")}function ri(r){return Fe(r,"documentMutations")}function by(r){return Fe(r,"mutationQueues")}var mi=class r{constructor(e){this.xn=e}next(){return this.xn+=2,this.xn}static On(){return new r(0)}static Nn(){return new r(-1)}};var ah=class{constructor(e,t){this.referenceDelegate=e,this.serializer=t}allocateTargetId(e){return this.Bn(e).next(t=>{let n=new mi(t.highestTargetId);return t.highestTargetId=n.next(),this.Ln(e,t).next(()=>t.highestTargetId)})}getLastRemoteSnapshotVersion(e){return this.Bn(e).next(t=>F.fromTimestamp(new ge(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds)))}getHighestSequenceNumber(e){return this.Bn(e).next(t=>t.highestListenSequenceNumber)}setTargetsMetadata(e,t,n){return this.Bn(e).next(i=>(i.highestListenSequenceNumber=t,n&&(i.lastRemoteSnapshotVersion=n.toTimestamp()),t>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=t),this.Ln(e,i)))}addTargetData(e,t){return this.kn(e,t).next(()=>this.Bn(e).next(n=>(n.targetCount+=1,this.qn(t,n),this.Ln(e,n))))}updateTargetData(e,t){return this.kn(e,t)}removeTargetData(e,t){return this.removeMatchingKeysForTargetId(e,t.targetId).next(()=>Jn(e).delete(t.targetId)).next(()=>this.Bn(e)).next(n=>(O(n.targetCount>0),n.targetCount-=1,this.Ln(e,n)))}removeTargets(e,t,n){let i=0,s=[];return Jn(e).Y((o,a)=>{let u=Ts(a);u.sequenceNumber<=t&&n.get(u.targetId)===null&&(i++,s.push(this.removeTargetData(e,u)))}).next(()=>b.waitFor(s)).next(()=>i)}forEachTarget(e,t){return Jn(e).Y((n,i)=>{let s=Ts(i);t(s)})}Bn(e){return o_(e).get("targetGlobalKey").next(t=>(O(t!==null),t))}Ln(e,t){return o_(e).put("targetGlobalKey",t)}kn(e,t){return Jn(e).put(vy(this.serializer,t))}qn(e,t){let n=!1;return e.targetId>t.highestTargetId&&(t.highestTargetId=e.targetId,n=!0),e.sequenceNumber>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=e.sequenceNumber,n=!0),n}getTargetCount(e){return this.Bn(e).next(t=>t.targetCount)}getTargetData(e,t){let n=ln(t),i=IDBKeyRange.bound([n,Number.NEGATIVE_INFINITY],[n,Number.POSITIVE_INFINITY]),s=null;return Jn(e).Y({range:i,index:"queryTargetsIndex"},(o,a,u)=>{let c=Ts(a);eo(t,c.target)&&(s=c,u.done())}).next(()=>s)}addMatchingKeys(e,t,n){let i=[],s=mr(e);return t.forEach(o=>{let a=Je(o.path);i.push(s.put({targetId:n,path:a})),i.push(this.referenceDelegate.addReference(e,n,o))}),b.waitFor(i)}removeMatchingKeys(e,t,n){let i=mr(e);return b.forEach(t,s=>{let o=Je(s.path);return b.waitFor([i.delete([n,o]),this.referenceDelegate.removeReference(e,n,s)])})}removeMatchingKeysForTargetId(e,t){let n=mr(e),i=IDBKeyRange.bound([t],[t+1],!1,!0);return n.delete(i)}getMatchingKeysForTargetId(e,t){let n=IDBKeyRange.bound([t],[t+1],!1,!0),i=mr(e),s=Q();return i.Y({range:n,J:!0},(o,a,u)=>{let c=Ct(o[1]),l=new R(c);s=s.add(l)}).next(()=>s)}containsKey(e,t){let n=Je(t.path),i=IDBKeyRange.bound([n],[S_(n)],!1,!0),s=0;return mr(e).Y({index:"documentTargetsIndex",J:!0,range:i},([o,a],u,c)=>{o!==0&&(s++,c.done())}).next(()=>s>0)}_t(e,t){return Jn(e).get(t).next(n=>n?Ts(n):null)}};function Jn(r){return Fe(r,"targets")}function o_(r){return Fe(r,"targetGlobal")}function mr(r){return Fe(r,"targetDocuments")}function a_([r,e],[t,n]){let i=K(r,t);return i===0?K(e,n):i}var uh=class{constructor(e){this.Qn=e,this.buffer=new oe(a_),this.Kn=0}$n(){return++this.Kn}Un(e){let t=[e,this.$n()];if(this.buffer.size<this.Qn)this.buffer=this.buffer.add(t);else{let n=this.buffer.last();a_(t,n)<0&&(this.buffer=this.buffer.delete(n).add(t))}}get maxValue(){return this.buffer.last()[0]}},ch=class{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.Wn=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Gn(6e4)}stop(){this.Wn&&(this.Wn.cancel(),this.Wn=null)}get started(){return this.Wn!==null}Gn(e){x("LruGarbageCollector",`Garbage collection scheduled in ${e}ms`),this.Wn=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,()=>S(this,null,function*(){this.Wn=null;try{yield this.localStore.collectGarbage(this.garbageCollector)}catch(t){Rr(t)?x("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",t):yield xr(t)}yield this.Gn(3e5)}))}},lh=class{constructor(e,t){this.zn=e,this.params=t}calculateTargetCount(e,t){return this.zn.jn(e).next(n=>Math.floor(t/100*n))}nthSequenceNumber(e,t){if(t===0)return b.resolve(st._e);let n=new uh(t);return this.zn.forEachTarget(e,i=>n.Un(i.sequenceNumber)).next(()=>this.zn.Hn(e,i=>n.Un(i))).next(()=>n.maxValue)}removeTargets(e,t,n){return this.zn.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.zn.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(x("LruGarbageCollector","Garbage collection skipped; disabled"),b.resolve(s_)):this.getCacheSize(e).next(n=>n<this.params.cacheSizeCollectionThreshold?(x("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),s_):this.Jn(e,t))}getCacheSize(e){return this.zn.getCacheSize(e)}Jn(e,t){let n,i,s,o,a,u,c,l=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(h=>(h>this.params.maximumSequenceNumbersToCollect?(x("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${h}`),i=this.params.maximumSequenceNumbersToCollect):i=h,o=Date.now(),this.nthSequenceNumber(e,i))).next(h=>(n=h,a=Date.now(),this.removeTargets(e,n,t))).next(h=>(s=h,u=Date.now(),this.removeOrphanedDocuments(e,n))).next(h=>(c=Date.now(),Xn()<=St.DEBUG&&x("LruGarbageCollector",`LRU Garbage Collection
23	Counted targets in ${o-l}ms
24	Determined least recently used ${i} in `+(a-o)+`ms
25	Removed ${s} targets in `+(u-a)+`ms
26	Removed ${h} documents in `+(c-u)+`ms
27Total Duration: ${c-l}ms`),b.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:s,documentsRemoved:h})))}};function iT(r,e){return new lh(r,e)}var hh=class{constructor(e,t){this.db=e,this.garbageCollector=iT(this,t)}jn(e){let t=this.Yn(e);return this.db.getTargetCache().getTargetCount(e).next(n=>t.next(i=>n+i))}Yn(e){let t=0;return this.Hn(e,n=>{t++}).next(()=>t)}forEachTarget(e,t){return this.db.getTargetCache().forEachTarget(e,t)}Hn(e,t){return this.Zn(e,(n,i)=>t(i))}addReference(e,t,n){return ga(e,n)}removeReference(e,t,n){return ga(e,n)}removeTargets(e,t,n){return this.db.getTargetCache().removeTargets(e,t,n)}markPotentiallyOrphaned(e,t){return ga(e,t)}Xn(e,t){return function(i,s){let o=!1;return by(i).Z(a=>Ty(i,a,s).next(u=>(u&&(o=!0),b.resolve(!u)))).next(()=>o)}(e,t)}removeOrphanedDocuments(e,t){let n=this.db.getRemoteDocumentCache().newChangeBuffer(),i=[],s=0;return this.Zn(e,(o,a)=>{if(a<=t){let u=this.Xn(e,o).next(c=>{if(!c)return s++,n.getEntry(e,o).next(()=>(n.removeEntry(o,F.min()),mr(e).delete(function(h){return[0,Je(h.path)]}(o))))});i.push(u)}}).next(()=>b.waitFor(i)).next(()=>n.apply(e)).next(()=>s)}removeTarget(e,t){let n=t.withSequenceNumber(e.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(e,n)}updateLimboDocument(e,t){return ga(e,t)}Zn(e,t){let n=mr(e),i,s=st._e;return n.Y({index:"documentTargetsIndex"},([o,a],{path:u,sequenceNumber:c})=>{o===0?(s!==st._e&&t(new R(Ct(i)),s),s=c,i=u):s=st._e}).next(()=>{s!==st._e&&t(new R(Ct(i)),s)})}getCacheSize(e){return this.db.getRemoteDocumentCache().getSize(e)}};function ga(r,e){return mr(r).put(function(n,i){return{targetId:0,path:Je(n.path),sequenceNumber:i}}(e,r.currentSequenceNumber))}var Wa=class{constructor(){this.changes=new Ft(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Ce.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return n!==void 0?b.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 dh=class{constructor(e){this.serializer=e}setIndexManager(e){this.indexManager=e}addEntry(e,t,n){return Xr(e).put(n)}removeEntry(e,t,n){return Xr(e).delete(function(s,o){let a=s.path.toArray();return[a.slice(0,a.length-2),a[a.length-2],Ba(o),a[a.length-1]]}(t,n))}updateMetadata(e,t){return this.getMetadata(e).next(n=>(n.byteSize+=t,this.er(e,n)))}getEntry(e,t){let n=Ce.newInvalidDocument(t);return Xr(e).Y({index:"documentKeyIndex",range:IDBKeyRange.only(ws(t))},(i,s)=>{n=this.tr(t,s)}).next(()=>n)}nr(e,t){let n={size:0,document:Ce.newInvalidDocument(t)};return Xr(e).Y({index:"documentKeyIndex",range:IDBKeyRange.only(ws(t))},(i,s)=>{n={document:this.tr(t,s),size:Ka(s)}}).next(()=>n)}getEntries(e,t){let n=rt();return this.rr(e,t,(i,s)=>{let o=this.tr(i,s);n=n.insert(i,o)}).next(()=>n)}ir(e,t){let n=rt(),i=new le(R.comparator);return this.rr(e,t,(s,o)=>{let a=this.tr(s,o);n=n.insert(s,a),i=i.insert(s,Ka(o))}).next(()=>({documents:n,sr:i}))}rr(e,t,n){if(t.isEmpty())return b.resolve();let i=new oe(l_);t.forEach(u=>i=i.add(u));let s=IDBKeyRange.bound(ws(i.first()),ws(i.last())),o=i.getIterator(),a=o.getNext();return Xr(e).Y({index:"documentKeyIndex",range:s},(u,c,l)=>{let h=R.fromSegments([...c.prefixPath,c.collectionGroup,c.documentId]);for(;a&&l_(a,h)<0;)n(a,null),a=o.getNext();a&&a.isEqual(h)&&(n(a,c),a=o.hasNext()?o.getNext():null),a?l.U(ws(a)):l.done()}).next(()=>{for(;a;)n(a,null),a=o.hasNext()?o.getNext():null})}getDocumentsMatchingQuery(e,t,n,i,s){let o=t.path,a=[o.popLast().toArray(),o.lastSegment(),Ba(n.readTime),n.documentKey.path.isEmpty()?"":n.documentKey.path.lastSegment()],u=[o.popLast().toArray(),o.lastSegment(),[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],""];return Xr(e).W(IDBKeyRange.bound(a,u,!0)).next(c=>{s?.incrementDocumentReadCount(c.length);let l=rt();for(let h of c){let d=this.tr(R.fromSegments(h.prefixPath.concat(h.collectionGroup,h.documentId)),h);d.isFoundDocument()&&(ro(t,d)||i.has(d.key))&&(l=l.insert(d.key,d))}return l})}getAllFromCollectionGroup(e,t,n,i){let s=rt(),o=c_(t,n),a=c_(t,ht.max());return Xr(e).Y({index:"collectionGroupIndex",range:IDBKeyRange.bound(o,a,!0)},(u,c,l)=>{let h=this.tr(R.fromSegments(c.prefixPath.concat(c.collectionGroup,c.documentId)),c);s=s.insert(h.key,h),s.size===i&&l.done()}).next(()=>s)}newChangeBuffer(e){return new fh(this,!!e&&e.trackRemovals)}getSize(e){return this.getMetadata(e).next(t=>t.byteSize)}getMetadata(e){return u_(e).get("remoteDocumentGlobalKey").next(t=>(O(!!t),t))}er(e,t){return u_(e).put("remoteDocumentGlobalKey",t)}tr(e,t){if(t){let n=tT(this.serializer,t);if(!(n.isNoDocument()&&n.version.isEqual(F.min())))return n}return Ce.newInvalidDocument(e)}};function Sy(r){return new dh(r)}var fh=class extends Wa{constructor(e,t){super(),this._r=e,this.trackRemovals=t,this.ar=new Ft(n=>n.toString(),(n,i)=>n.isEqual(i))}applyChanges(e){let t=[],n=0,i=new oe((s,o)=>K(s.canonicalString(),o.canonicalString()));return this.changes.forEach((s,o)=>{let a=this.ar.get(s);if(t.push(this._r.removeEntry(e,s,a.readTime)),o.isValidDocument()){let u=Hg(this._r.serializer,o);i=i.add(s.path.popLast());let c=Ka(u);n+=c-a.size,t.push(this._r.addEntry(e,s,u))}else if(n-=a.size,this.trackRemovals){let u=Hg(this._r.serializer,o.convertToNoDocument(F.min()));t.push(this._r.addEntry(e,s,u))}}),i.forEach(s=>{t.push(this._r.indexManager.addToCollectionParentIndex(e,s))}),t.push(this._r.updateMetadata(e,n)),b.waitFor(t)}getFromCache(e,t){return this._r.nr(e,t).next(n=>(this.ar.set(t,{size:n.size,readTime:n.document.readTime}),n.document))}getAllFromCache(e,t){return this._r.ir(e,t).next(({documents:n,sr:i})=>(i.forEach((s,o)=>{this.ar.set(s,{size:o,readTime:n.get(s).readTime})}),n))}};function u_(r){return Fe(r,"remoteDocumentGlobal")}function Xr(r){return Fe(r,"remoteDocumentsV14")}function ws(r){let e=r.path.toArray();return[e.slice(0,e.length-2),e[e.length-2],e[e.length-1]]}function c_(r,e){let t=e.documentKey.path.toArray();return[r,Ba(e.readTime),t.slice(0,t.length-2),t.length>0?t[t.length-1]:""]}function l_(r,e){let t=r.path.toArray(),n=e.path.toArray(),i=0;for(let s=0;s<t.length-2&&s<n.length-2;++s)if(i=K(t[s],n[s]),i)return i;return i=K(t.length,n.length),i||(i=K(t[t.length-2],n[n.length-2]),i||K(t[t.length-1],n[n.length-1]))}var ph=class{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}};var Qa=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&&As(n.mutation,i,ot.empty(),ge.now()),i))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(n=>this.getLocalViewOfDocuments(e,n,Q()).next(()=>n))}getLocalViewOfDocuments(e,t,n=Q()){let i=xt();return this.populateOverlays(e,i,t).next(()=>this.computeViews(e,t,i,n).next(s=>{let o=Es();return s.forEach((a,u)=>{o=o.insert(a,u.overlayedDocument)}),o}))}getOverlayedDocuments(e,t){let n=xt();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,Q()))}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((o,a)=>{t.set(o,a)})})}computeViews(e,t,n,i){let s=rt(),o=Ss(),a=function(){return Ss()}();return t.forEach((u,c)=>{let l=n.get(c.key);i.has(c.key)&&(l===void 0||l.mutation instanceof vt)?s=s.insert(c.key,c):l!==void 0?(o.set(c.key,l.mutation.getFieldMask()),As(l.mutation,c,l.mutation.getFieldMask(),ge.now())):o.set(c.key,ot.empty())}),this.recalculateAndSaveOverlays(e,s).next(u=>(u.forEach((c,l)=>o.set(c,l)),t.forEach((c,l)=>{var h;return a.set(c,new ph(l,(h=o.get(c))!==null&&h!==void 0?h:null))}),a))}recalculateAndSaveOverlays(e,t){let n=Ss(),i=new le((o,a)=>o-a),s=Q();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(o=>{for(let a of o)a.keys().forEach(u=>{let c=t.get(u);if(c===null)return;let l=n.get(u)||ot.empty();l=a.applyToLocalView(c,l),n.set(u,l);let h=(i.get(a.batchId)||Q()).add(u);i=i.insert(a.batchId,h)})}).next(()=>{let o=[],a=i.getReverseIterator();for(;a.hasNext();){let u=a.getNext(),c=u.key,l=u.value,h=H_();l.forEach(d=>{if(!s.has(d)){let m=ny(t.get(d),n.get(d));m!==null&&h.set(d,m),s=s.add(d)}}),o.push(this.documentOverlayCache.saveOverlays(e,c,h))}return b.waitFor(o)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(n=>this.recalculateAndSaveOverlays(e,n))}getDocumentsMatchingQuery(e,t,n,i){return function(o){return R.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):yd(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 o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,i-s.size):b.resolve(xt()),a=-1,u=s;return o.next(c=>b.forEach(c,(l,h)=>(a<h.largestBatchId&&(a=h.largestBatchId),s.get(l)?b.resolve():this.remoteDocumentCache.getEntry(e,l).next(d=>{u=u.insert(l,d)}))).next(()=>this.populateOverlays(e,c,s)).next(()=>this.computeViews(e,u,c,Q())).next(l=>({batchId:a,changes:Q_(l)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new R(t)).next(n=>{let i=Es();return n.isFoundDocument()&&(i=i.insert(n.key,n)),i})}getDocumentsMatchingCollectionGroupQuery(e,t,n,i){let s=t.collectionGroup,o=Es();return this.indexManager.getCollectionParents(e,s).next(a=>b.forEach(a,u=>{let c=function(h,d){return new yt(d,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(t,u.child(s));return this.getDocumentsMatchingCollectionQuery(e,c,n,i).next(l=>{l.forEach((h,d)=>{o=o.insert(h,d)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,t,n,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s,i))).next(o=>{s.forEach((u,c)=>{let l=c.getKey();o.get(l)===null&&(o=o.insert(l,Ce.newInvalidDocument(l)))});let a=Es();return o.forEach((u,c)=>{let l=s.get(u);l!==void 0&&As(l.mutation,c,ot.empty(),ge.now()),ro(t,c)&&(a=a.insert(u,c))}),a})}};var mh=class{constructor(e){this.serializer=e,this.ur=new Map,this.cr=new Map}getBundleMetadata(e,t){return b.resolve(this.ur.get(t))}saveBundleMetadata(e,t){return this.ur.set(t.id,function(i){return{id:i.id,version:i.version,createTime:be(i.createTime)}}(t)),b.resolve()}getNamedQuery(e,t){return b.resolve(this.cr.get(t))}saveNamedQuery(e,t){return this.cr.set(t.name,function(i){return{name:i.name,query:Id(i.bundledQuery),readTime:be(i.readTime)}}(t)),b.resolve()}};var gh=class{constructor(){this.overlays=new le(R.comparator),this.lr=new Map}getOverlay(e,t){return b.resolve(this.overlays.get(t))}getOverlays(e,t){let n=xt();return b.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.lt(e,t,s)}),b.resolve()}removeOverlaysForBatchId(e,t,n){let i=this.lr.get(n);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.lr.delete(n)),b.resolve()}getOverlaysForCollection(e,t,n){let i=xt(),s=t.length+1,o=new R(t.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){let u=a.getNext().value,c=u.getKey();if(!t.isPrefixOf(c.path))break;c.path.length===s&&u.largestBatchId>n&&i.set(u.getKey(),u)}return b.resolve(i)}getOverlaysForCollectionGroup(e,t,n,i){let s=new le((c,l)=>c-l),o=this.overlays.getIterator();for(;o.hasNext();){let c=o.getNext().value;if(c.getKey().getCollectionGroup()===t&&c.largestBatchId>n){let l=s.get(c.largestBatchId);l===null&&(l=xt(),s=s.insert(c.largestBatchId,l)),l.set(c.getKey(),c)}}let a=xt(),u=s.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach((c,l)=>a.set(c,l)),!(a.size()>=i)););return b.resolve(a)}lt(e,t,n){let i=this.overlays.get(n.key);if(i!==null){let o=this.lr.get(i.largestBatchId).delete(n.key);this.lr.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(n.key,new Ms(t,n));let s=this.lr.get(t);s===void 0&&(s=Q(),this.lr.set(t,s)),this.lr.set(t,s.add(n.key))}};var zs=class{constructor(){this.hr=new oe(Ae.Pr),this.Ir=new oe(Ae.Tr)}isEmpty(){return this.hr.isEmpty()}addReference(e,t){let n=new Ae(e,t);this.hr=this.hr.add(n),this.Ir=this.Ir.add(n)}Er(e,t){e.forEach(n=>this.addReference(n,t))}removeReference(e,t){this.dr(new Ae(e,t))}Ar(e,t){e.forEach(n=>this.removeReference(n,t))}Rr(e){let t=new R(new ee([])),n=new Ae(t,e),i=new Ae(t,e+1),s=[];return this.Ir.forEachInRange([n,i],o=>{this.dr(o),s.push(o.key)}),s}Vr(){this.hr.forEach(e=>this.dr(e))}dr(e){this.hr=this.hr.delete(e),this.Ir=this.Ir.delete(e)}mr(e){let t=new R(new ee([])),n=new Ae(t,e),i=new Ae(t,e+1),s=Q();return this.Ir.forEachInRange([n,i],o=>{s=s.add(o.key)}),s}containsKey(e){let t=new Ae(e,0),n=this.hr.firstAfterOrEqual(t);return n!==null&&e.isEqual(n.key)}},Ae=class{constructor(e,t){this.key=e,this.gr=t}static Pr(e,t){return R.comparator(e.key,t.key)||K(e.gr,t.gr)}static Tr(e,t){return K(e.gr,t.gr)||R.comparator(e.key,t.key)}};var _h=class{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.pr=1,this.yr=new oe(Ae.Pr)}checkEmpty(e){return b.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,n,i){let s=this.pr;this.pr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let o=new Fs(s,t,n,i);this.mutationQueue.push(o);for(let a of i)this.yr=this.yr.add(new Ae(a.key,s)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return b.resolve(o)}lookupMutationBatch(e,t){return b.resolve(this.wr(t))}getNextMutationBatchAfterBatchId(e,t){let n=t+1,i=this.Sr(n),s=i<0?0:i;return b.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return b.resolve(this.mutationQueue.length===0?-1:this.pr-1)}getAllMutationBatches(e){return b.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new Ae(t,0),i=new Ae(t,Number.POSITIVE_INFINITY),s=[];return this.yr.forEachInRange([n,i],o=>{let a=this.wr(o.gr);s.push(a)}),b.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new oe(K);return t.forEach(i=>{let s=new Ae(i,0),o=new Ae(i,Number.POSITIVE_INFINITY);this.yr.forEachInRange([s,o],a=>{n=n.add(a.gr)})}),b.resolve(this.br(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,i=n.length+1,s=n;R.isDocumentKey(s)||(s=s.child(""));let o=new Ae(new R(s),0),a=new oe(K);return this.yr.forEachWhile(u=>{let c=u.key.path;return!!n.isPrefixOf(c)&&(c.length===i&&(a=a.add(u.gr)),!0)},o),b.resolve(this.br(a))}br(e){let t=[];return e.forEach(n=>{let i=this.wr(n);i!==null&&t.push(i)}),t}removeMutationBatch(e,t){O(this.Dr(t.batchId,"removed")===0),this.mutationQueue.shift();let n=this.yr;return b.forEach(t.mutations,i=>{let s=new Ae(i.key,t.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.yr=n})}Fn(e){}containsKey(e,t){let n=new Ae(t,0),i=this.yr.firstAfterOrEqual(n);return b.resolve(t.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,b.resolve()}Dr(e,t){return this.Sr(e)}Sr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}wr(e){let t=this.Sr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}};var yh=class{constructor(e){this.Cr=e,this.docs=function(){return new le(R.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,o=this.Cr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:o}),this.size+=o-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 b.resolve(n?n.document.mutableCopy():Ce.newInvalidDocument(t))}getEntries(e,t){let n=rt();return t.forEach(i=>{let s=this.docs.get(i);n=n.insert(i,s?s.document.mutableCopy():Ce.newInvalidDocument(i))}),b.resolve(n)}getDocumentsMatchingQuery(e,t,n,i){let s=rt(),o=t.path,a=new R(o.child("")),u=this.docs.getIteratorFrom(a);for(;u.hasNext();){let{key:c,value:{document:l}}=u.getNext();if(!o.isPrefixOf(c.path))break;c.path.length>o.length+1||pd(k_(l),n)<=0||(i.has(l.key)||ro(t,l))&&(s=s.insert(l.key,l.mutableCopy()))}return b.resolve(s)}getAllFromCollectionGroup(e,t,n,i){V()}vr(e,t){return b.forEach(this.docs,n=>t(n))}newChangeBuffer(e){return new vh(this)}getSize(e){return b.resolve(this.size)}},vh=class extends Wa{constructor(e){super(),this._r=e}applyChanges(e){let t=[];return this.changes.forEach((n,i)=>{i.isValidDocument()?t.push(this._r.addEntry(e,i)):this._r.removeEntry(n)}),b.waitFor(t)}getFromCache(e,t){return this._r.getEntry(e,t)}getAllFromCache(e,t){return this._r.getEntries(e,t)}};var wh=class{constructor(e){this.persistence=e,this.Fr=new Ft(t=>ln(t),eo),this.lastRemoteSnapshotVersion=F.min(),this.highestTargetId=0,this.Mr=0,this.Or=new zs,this.targetCount=0,this.Nr=mi.On()}forEachTarget(e,t){return this.Fr.forEach((n,i)=>t(i)),b.resolve()}getLastRemoteSnapshotVersion(e){return b.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return b.resolve(this.Mr)}allocateTargetId(e){return this.highestTargetId=this.Nr.next(),b.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Mr&&(this.Mr=t),b.resolve()}kn(e){this.Fr.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.Nr=new mi(t),this.highestTargetId=t),e.sequenceNumber>this.Mr&&(this.Mr=e.sequenceNumber)}addTargetData(e,t){return this.kn(t),this.targetCount+=1,b.resolve()}updateTargetData(e,t){return this.kn(t),b.resolve()}removeTargetData(e,t){return this.Fr.delete(t.target),this.Or.Rr(t.targetId),this.targetCount-=1,b.resolve()}removeTargets(e,t,n){let i=0,s=[];return this.Fr.forEach((o,a)=>{a.sequenceNumber<=t&&n.get(a.targetId)===null&&(this.Fr.delete(o),s.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),b.waitFor(s).next(()=>i)}getTargetCount(e){return b.resolve(this.targetCount)}getTargetData(e,t){let n=this.Fr.get(t)||null;return b.resolve(n)}addMatchingKeys(e,t,n){return this.Or.Er(t,n),b.resolve()}removeMatchingKeys(e,t,n){this.Or.Ar(t,n);let i=this.persistence.referenceDelegate,s=[];return i&&t.forEach(o=>{s.push(i.markPotentiallyOrphaned(e,o))}),b.waitFor(s)}removeMatchingKeysForTargetId(e,t){return this.Or.Rr(t),b.resolve()}getMatchingKeysForTargetId(e,t){let n=this.Or.mr(t);return b.resolve(n)}containsKey(e,t){return b.resolve(this.Or.containsKey(t))}};var Ha=class{constructor(e,t){this.Br={},this.overlays={},this.Lr=new st(0),this.kr=!1,this.kr=!0,this.referenceDelegate=e(this),this.qr=new wh(this),this.indexManager=new sh,this.remoteDocumentCache=function(i){return new yh(i)}(n=>this.referenceDelegate.Qr(n)),this.serializer=new Ua(t),this.Kr=new mh(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.kr=!1,Promise.resolve()}get started(){return this.kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new gh,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.Br[e.toKey()];return n||(n=new _h(t,this.referenceDelegate),this.Br[e.toKey()]=n),n}getTargetCache(){return this.qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Kr}runTransaction(e,t,n){x("MemoryPersistence","Starting transaction:",e);let i=new Ih(this.Lr.next());return this.referenceDelegate.$r(),n(i).next(s=>this.referenceDelegate.Ur(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}Wr(e,t){return b.or(Object.values(this.Br).map(n=>()=>n.containsKey(e,t)))}},Ih=class extends Pa{constructor(e){super(),this.currentSequenceNumber=e}},Ya=class r{constructor(e){this.persistence=e,this.Gr=new zs,this.zr=null}static jr(e){return new r(e)}get Hr(){if(this.zr)return this.zr;throw V()}addReference(e,t,n){return this.Gr.addReference(n,t),this.Hr.delete(n.toString()),b.resolve()}removeReference(e,t,n){return this.Gr.removeReference(n,t),this.Hr.add(n.toString()),b.resolve()}markPotentiallyOrphaned(e,t){return this.Hr.add(t.toString()),b.resolve()}removeTarget(e,t){this.Gr.Rr(t.targetId).forEach(i=>this.Hr.add(i.toString()));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(i=>{i.forEach(s=>this.Hr.add(s.toString()))}).next(()=>n.removeTargetData(e,t))}$r(){this.zr=new Set}Ur(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return b.forEach(this.Hr,n=>{let i=R.fromPath(n);return this.Jr(e,i).next(s=>{s||t.removeEntry(i,F.min())})}).next(()=>(this.zr=null,t.apply(e)))}updateLimboDocument(e,t){return this.Jr(e,t).next(n=>{n?this.Hr.delete(t.toString()):this.Hr.add(t.toString())})}Qr(e){return 0}Jr(e,t){return b.or([()=>b.resolve(this.Gr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Wr(e,t)])}};
27var Eh=class{constructor(e){this.serializer=e}N(e,t,n,i){let s=new Ca("createOrUpgrade",t);n<1&&i>=1&&(function(u){u.createObjectStore("owner")}(e),function(u){u.createObjectStore("mutationQueues",{keyPath:"userId"}),u.createObjectStore("mutations",{keyPath:"batchId",autoIncrement:!0}).createIndex("userMutationsIndex",kg,{unique:!0}),u.createObjectStore("documentMutations")}(e),h_(e),function(u){u.createObjectStore("remoteDocuments")}(e));let o=b.resolve();return n<3&&i>=3&&(n!==0&&(function(u){u.deleteObjectStore("targetDocuments"),u.deleteObjectStore("targets"),u.deleteObjectStore("targetGlobal")}(e),h_(e)),o=o.next(()=>function(u){let c=u.store("targetGlobal"),l={highestTargetId:0,highestListenSequenceNumber:0,lastRemoteSnapshotVersion:F.min().toTimestamp(),targetCount:0};return c.put("targetGlobalKey",l)}(s))),n<4&&i>=4&&(n!==0&&(o=o.next(()=>function(u,c){return c.store("mutations").W().next(l=>{u.deleteObjectStore("mutations"),u.createObjectStore("mutations",{keyPath:"batchId",autoIncrement:!0}).createIndex("userMutationsIndex",kg,{unique:!0});let h=c.store("mutations"),d=l.map(m=>h.put(m));return b.waitFor(d)})}(e,s))),o=o.next(()=>{(function(u){u.createObjectStore("clientMetadata",{keyPath:"clientId"})})(e)})),n<5&&i>=5&&(o=o.next(()=>this.Zr(s))),n<6&&i>=6&&(o=o.next(()=>(function(u){u.createObjectStore("remoteDocumentGlobal")}(e),this.Xr(s)))),n<7&&i>=7&&(o=o.next(()=>this.ei(s))),n<8&&i>=8&&(o=o.next(()=>this.ti(e,s))),n<9&&i>=9&&(o=o.next(()=>{(function(u){u.objectStoreNames.contains("remoteDocumentChanges")&&u.deleteObjectStore("remoteDocumentChanges")})(e)})),n<10&&i>=10&&(o=o.next(()=>this.ni(s))),n<11&&i>=11&&(o=o.next(()=>{(function(u){u.createObjectStore("bundles",{keyPath:"bundleId"})})(e),function(u){u.createObjectStore("namedQueries",{keyPath:"name"})}(e)})),n<12&&i>=12&&(o=o.next(()=>{(function(u){let c=u.createObjectStore("documentOverlays",{keyPath:EE});c.createIndex("collectionPathOverlayIndex",TE,{unique:!1}),c.createIndex("collectionGroupOverlayIndex",bE,{unique:!1})})(e)})),n<13&&i>=13&&(o=o.next(()=>function(u){let c=u.createObjectStore("remoteDocumentsV14",{keyPath:hE});c.createIndex("documentKeyIndex",dE),c.createIndex("collectionGroupIndex",fE)}(e)).next(()=>this.ri(e,s)).next(()=>e.deleteObjectStore("remoteDocuments"))),n<14&&i>=14&&(o=o.next(()=>this.ii(e,s))),n<15&&i>=15&&(o=o.next(()=>function(u){u.createObjectStore("indexConfiguration",{keyPath:"indexId",autoIncrement:!0}).createIndex("collectionGroupIndex","collectionGroup",{unique:!1}),u.createObjectStore("indexState",{keyPath:yE}).createIndex("sequenceNumberIndex",vE,{unique:!1}),u.createObjectStore("indexEntries",{keyPath:wE}).createIndex("documentKeyIndex",IE,{unique:!1})}(e))),o}Xr(e){let t=0;return e.store("remoteDocuments").Y((n,i)=>{t+=Ka(i)}).next(()=>{let n={byteSize:t};return e.store("remoteDocumentGlobal").put("remoteDocumentGlobalKey",n)})}Zr(e){let t=e.store("mutationQueues"),n=e.store("mutations");return t.W().next(i=>b.forEach(i,s=>{let o=IDBKeyRange.bound([s.userId,-1],[s.userId,s.lastAcknowledgedBatchId]);return n.W("userMutationsIndex",o).next(a=>b.forEach(a,u=>{O(u.userId===s.userId);let c=tn(this.serializer,u);return Ey(e,s.userId,c).next(()=>{})}))}))}ei(e){let t=e.store("targetDocuments"),n=e.store("remoteDocuments");return e.store("targetGlobal").get("targetGlobalKey").next(i=>{let s=[];return n.Y((o,a)=>{let u=new ee(o),c=function(h){return[0,Je(h)]}(u);s.push(t.get(c).next(l=>l?b.resolve():(h=>t.put({targetId:0,path:Je(h),sequenceNumber:i.highestListenSequenceNumber}))(u)))}).next(()=>b.waitFor(s))})}ti(e,t){e.createObjectStore("collectionParents",{keyPath:_E});let n=t.store("collectionParents"),i=new $s,s=o=>{if(i.add(o)){let a=o.lastSegment(),u=o.popLast();return n.put({collectionId:a,parent:Je(u)})}};return t.store("remoteDocuments").Y({J:!0},(o,a)=>{let u=new ee(o);return s(u.popLast())}).next(()=>t.store("documentMutations").Y({J:!0},([o,a,u],c)=>{let l=Ct(a);return s(l.popLast())}))}ni(e){let t=e.store("targets");return t.Y((n,i)=>{let s=Ts(i),o=vy(this.serializer,s);return t.put(o)})}ri(e,t){let n=t.store("remoteDocuments"),i=[];return n.Y((s,o)=>{let a=t.store("remoteDocumentsV14"),u=function(h){return h.document?new R(ee.fromString(h.document.name).popFirst(5)):h.noDocument?R.fromSegments(h.noDocument.path):h.unknownDocument?R.fromSegments(h.unknownDocument.path):V()}(o).path.toArray(),c={prefixPath:u.slice(0,u.length-2),collectionGroup:u[u.length-2],documentId:u[u.length-1],readTime:o.readTime||[0,0],unknownDocument:o.unknownDocument,noDocument:o.noDocument,document:o.document,hasCommittedMutations:!!o.hasCommittedMutations};i.push(a.put(c))}).next(()=>b.waitFor(i))}ii(e,t){let n=t.store("mutations"),i=Sy(this.serializer),s=new Ha(Ya.jr,this.serializer.ut);return n.W().next(o=>{let a=new Map;return o.forEach(u=>{var c;
vendor: 17,554 bytes, line 27
27let l=(c=a.get(u.userId))!==null&&c!==void 0?c:Q();tn(this.serializer,u).keys().forEach(h=>l=l.add(h)),a.set(u.userId,l)}),b.forEach(a,(u,c)=>{let l=new ke(c),h=ja.ct(this.serializer,l),d=s.getIndexManager(l),m=Ga.ct(l,this.serializer,d,s.referenceDelegate);return new Qa(i,m,h,d).recalculateAndSaveOverlaysForDocumentKeys(new Rs(t,st._e),u).next()})})}};function h_(r){r.createObjectStore("targetDocuments",{keyPath:mE}).createIndex("documentTargetsIndex",gE,{unique:!0}),r.createObjectStore("targets",{keyPath:"targetId"}).createIndex("queryTargetsIndex",pE,{unique:!0}),r.createObjectStore("targetGlobal")}var pl="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",Th=class r{constructor(e,t,n,i,s,o,a,u,c,l,h=15){if(this.allowTabSynchronization=e,this.persistenceKey=t,this.clientId=n,this.si=s,this.window=o,this.document=a,this.oi=c,this._i=l,this.ai=h,this.Lr=null,this.kr=!1,this.isPrimary=!1,this.networkEnabled=!0,this.ui=null,this.inForeground=!1,this.ci=null,this.li=null,this.hi=Number.NEGATIVE_INFINITY,this.Pi=d=>Promise.resolve(),!r.D())throw new C(A.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new hh(this,i),this.Ii=t+"main",this.serializer=new Ua(u),this.Ti=new wr(this.Ii,this.ai,new Eh(this.serializer)),this.qr=new ah(this.referenceDelegate,this.serializer),this.remoteDocumentCache=Sy(this.serializer),this.Kr=new Xl,this.window&&this.window.localStorage?this.Ei=this.window.localStorage:(this.Ei=null,l===!1&&Ee("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}start(){return this.di().then(()=>{if(!this.isPrimary&&!this.allowTabSynchronization)throw new C(A.FAILED_PRECONDITION,pl);return this.Ai(),this.Ri(),this.Vi(),this.runTransaction("getHighestListenSequenceNumber","readonly",e=>this.qr.getHighestSequenceNumber(e))}).then(e=>{this.Lr=new st(e,this.oi)}).then(()=>{this.kr=!0}).catch(e=>(this.Ti&&this.Ti.close(),Promise.reject(e)))}mi(e){return this.Pi=t=>S(this,null,function*(){if(this.started)return e(t)}),e(this.isPrimary)}setDatabaseDeletedListener(e){this.Ti.L(t=>S(this,null,function*(){t.newVersion===null&&(yield e())}))}setNetworkEnabled(e){this.networkEnabled!==e&&(this.networkEnabled=e,this.si.enqueueAndForget(()=>S(this,null,function*(){this.started&&(yield this.di())})))}di(){return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",e=>_a(e).put({clientId:this.clientId,updateTimeMs:Date.now(),networkEnabled:this.networkEnabled,inForeground:this.inForeground}).next(()=>{if(this.isPrimary)return this.fi(e).next(t=>{t||(this.isPrimary=!1,this.si.enqueueRetryable(()=>this.Pi(!1)))})}).next(()=>this.gi(e)).next(t=>this.isPrimary&&!t?this.pi(e).next(()=>!1):!!t&&this.yi(e).next(()=>!0))).catch(e=>{if(Rr(e))return x("IndexedDbPersistence","Failed to extend owner lease: ",e),this.isPrimary;if(!this.allowTabSynchronization)throw e;return x("IndexedDbPersistence","Releasing owner lease after error during lease refresh",e),!1}).then(e=>{this.isPrimary!==e&&this.si.enqueueRetryable(()=>this.Pi(e)),this.isPrimary=e})}fi(e){return Is(e).get("owner").next(t=>b.resolve(this.wi(t)))}Si(e){return _a(e).delete(this.clientId)}bi(){return S(this,null,function*(){if(this.isPrimary&&!this.Di(this.hi,18e5)){this.hi=Date.now();let e=yield this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",t=>{let n=Fe(t,"clientMetadata");return n.W().next(i=>{let s=this.Ci(i,18e5),o=i.filter(a=>s.indexOf(a)===-1);return b.forEach(o,a=>n.delete(a.clientId)).next(()=>o)})}).catch(()=>[]);if(this.Ei)for(let t of e)this.Ei.removeItem(this.vi(t.clientId))}})}Vi(){this.li=this.si.enqueueAfterDelay("client_metadata_refresh",4e3,()=>this.di().then(()=>this.bi()).then(()=>this.Vi()))}wi(e){return!!e&&e.ownerId===this.clientId}gi(e){return this._i?b.resolve(!0):Is(e).get("owner").next(t=>{if(t!==null&&this.Di(t.leaseTimestampMs,5e3)&&!this.Fi(t.ownerId)){if(this.wi(t)&&this.networkEnabled)return!0;if(!this.wi(t)){if(!t.allowTabSynchronization)throw new C(A.FAILED_PRECONDITION,pl);return!1}}return!(!this.networkEnabled||!this.inForeground)||_a(e).W().next(n=>this.Ci(n,5e3).find(i=>{if(this.clientId!==i.clientId){let s=!this.networkEnabled&&i.networkEnabled,o=!this.inForeground&&i.inForeground,a=this.networkEnabled===i.networkEnabled;if(s||o&&a)return!0}return!1})===void 0)}).next(t=>(this.isPrimary!==t&&x("IndexedDbPersistence",`Client ${t?"is":"is not"} eligible for a primary lease.`),t))}shutdown(){return S(this,null,function*(){this.kr=!1,this.Mi(),this.li&&(this.li.cancel(),this.li=null),this.xi(),this.Oi(),yield this.Ti.runTransaction("shutdown","readwrite",["owner","clientMetadata"],e=>{let t=new Rs(e,st._e);return this.pi(t).next(()=>this.Si(t))}),this.Ti.close(),this.Ni()})}Ci(e,t){return e.filter(n=>this.Di(n.updateTimeMs,t)&&!this.Fi(n.clientId))}Bi(){return this.runTransaction("getActiveClients","readonly",e=>_a(e).W().next(t=>this.Ci(t,18e5).map(n=>n.clientId)))}get started(){return this.kr}getMutationQueue(e,t){return Ga.ct(e,this.serializer,t,this.referenceDelegate)}getTargetCache(){return this.qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getIndexManager(e){return new oh(e,this.serializer.ut.databaseId)}getDocumentOverlayCache(e){return ja.ct(this.serializer,e)}getBundleCache(){return this.Kr}runTransaction(e,t,n){x("IndexedDbPersistence","Starting transaction:",e);let i=t==="readonly"?"readonly":"readwrite",s=function(u){return u===15?AE:u===14?N_:u===13?D_:u===12?SE:u===11?R_:void V()}(this.ai),o;return this.Ti.runTransaction(e,i,s,a=>(o=new Rs(a,this.Lr?this.Lr.next():st._e),t==="readwrite-primary"?this.fi(o).next(u=>!!u||this.gi(o)).next(u=>{if(!u)throw Ee(`Failed to obtain primary lease for action '${e}'.`),this.isPrimary=!1,this.si.enqueueRetryable(()=>this.Pi(!1)),new C(A.FAILED_PRECONDITION,P_);return n(o)}).next(u=>this.yi(o).next(()=>u)):this.Li(o).next(()=>n(o)))).then(a=>(o.raiseOnCommittedEvent(),a))}Li(e){return Is(e).get("owner").next(t=>{if(t!==null&&this.Di(t.leaseTimestampMs,5e3)&&!this.Fi(t.ownerId)&&!this.wi(t)&&!(this._i||this.allowTabSynchronization&&t.allowTabSynchronization))throw new C(A.FAILED_PRECONDITION,pl)})}yi(e){let t={ownerId:this.clientId,allowTabSynchronization:this.allowTabSynchronization,leaseTimestampMs:Date.now()};return Is(e).put("owner",t)}static D(){return wr.D()}pi(e){let t=Is(e);return t.get("owner").next(n=>this.wi(n)?(x("IndexedDbPersistence","Releasing primary lease."),t.delete("owner")):b.resolve())}Di(e,t){let n=Date.now();return!(e<n-t)&&(!(e>n)||(Ee(`Detected an update time that is in the future: ${e} > ${n}`),!1))}Ai(){this.document!==null&&typeof this.document.addEventListener=="function"&&(this.ci=()=>{this.si.enqueueAndForget(()=>(this.inForeground=this.document.visibilityState==="visible",this.di()))},this.document.addEventListener("visibilitychange",this.ci),this.inForeground=this.document.visibilityState==="visible")}xi(){this.ci&&(this.document.removeEventListener("visibilitychange",this.ci),this.ci=null)}Ri(){var e;typeof((e=this.window)===null||e===void 0?void 0:e.addEventListener)=="function"&&(this.ui=()=>{this.Mi();let t=/(?:Version|Mobile)\/1[456]/;hp()&&(navigator.appVersion.match(t)||navigator.userAgent.match(t))&&this.si.enterRestrictedMode(!0),this.si.enqueueAndForget(()=>this.shutdown())},this.window.addEventListener("pagehide",this.ui))}Oi(){this.ui&&(this.window.removeEventListener("pagehide",this.ui),this.ui=null)}Fi(e){var t;try{let n=((t=this.Ei)===null||t===void 0?void 0:t.getItem(this.vi(e)))!==null;return x("IndexedDbPersistence",`Client '${e}' ${n?"is":"is not"} zombied in LocalStorage`),n}catch(n){return Ee("IndexedDbPersistence","Failed to get zombied client id.",n),!1}}Mi(){if(this.Ei)try{this.Ei.setItem(this.vi(this.clientId),String(Date.now()))}catch(e){Ee("Failed to set zombie client id.",e)}}Ni(){if(this.Ei)try{this.Ei.removeItem(this.vi(this.clientId))}catch{}}vi(e){return`firestore_zombie_${this.persistenceKey}_${e}`}};function Is(r){return Fe(r,"owner")}function _a(r){return Fe(r,"clientMetadata")}function Td(r,e){let t=r.projectId;return r.isDefaultDatabase||(t+="."+r.database),"firestore/"+e+"/"+t+"/"}var bh=class r{constructor(e,t,n,i){this.targetId=e,this.fromCache=t,this.ki=n,this.qi=i}static Qi(e,t){let n=Q(),i=Q();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)}};var Sh=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}};var Ja=class{constructor(){this.Ki=!1,this.$i=!1,this.Ui=100,this.Wi=8}initialize(e,t){this.Gi=e,this.indexManager=t,this.Ki=!0}getDocumentsMatchingQuery(e,t,n,i){let s={result:null};return this.zi(e,t).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.ji(e,t,i,n).next(o=>{s.result=o})}).next(()=>{if(s.result)return;let o=new Sh;return this.Hi(e,t,o).next(a=>{if(s.result=a,this.$i)return this.Ji(e,t,o,a.size)})}).next(()=>s.result)}Ji(e,t,n,i){return n.documentReadCount<this.Ui?(Xn()<=St.DEBUG&&x("QueryEngine","SDK will not create cache indexes for query:",Zn(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Ui,"documents"),b.resolve()):(Xn()<=St.DEBUG&&x("QueryEngine","Query:",Zn(t),"scans",n.documentReadCount,"local documents and returns",i,"documents as results."),n.documentReadCount>this.Wi*i?(Xn()<=St.DEBUG&&x("QueryEngine","The SDK decides to create cache indexes for query:",Zn(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Xe(t))):b.resolve())}zi(e,t){if(Lg(t))return b.resolve(null);let n=Xe(t);return this.indexManager.getIndexType(e,n).next(i=>i===0?null:(t.limit!==null&&i===1&&(t=Fa(t,null,"F"),n=Xe(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next(s=>{let o=Q(...s);return this.Gi.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,n).next(u=>{let c=this.Yi(t,a);return this.Zi(t,c,o,u.readTime)?this.zi(e,Fa(t,null,"F")):this.Xi(e,c,t,u)}))})))}ji(e,t,n,i){return Lg(t)||i.isEqual(F.min())?b.resolve(null):this.Gi.getDocuments(e,n).next(s=>{let o=this.Yi(t,s);return this.Zi(t,o,n,i)?b.resolve(null):(Xn()<=St.DEBUG&&x("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),Zn(t)),this.Xi(e,o,t,A_(i,-1)).next(a=>a))})}Yi(e,t){let n=new oe(G_(e));return t.forEach((i,s)=>{ro(e,s)&&(n=n.add(s))}),n}Zi(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)}Hi(e,t,n){return Xn()<=St.DEBUG&&x("QueryEngine","Using full collection scan to execute query:",Zn(t)),this.Gi.getDocumentsMatchingQuery(e,t,ht.min(),n)}Xi(e,t,n,i){return this.Gi.getDocumentsMatchingQuery(e,n,i).next(s=>(t.forEach(o=>{s=s.insert(o.key,o)}),s))}};var Ah=class{constructor(e,t,n,i){this.persistence=e,this.es=t,this.serializer=i,this.ts=new le(K),this.ns=new Ft(s=>ln(s),eo),this.rs=new Map,this.ss=e.getRemoteDocumentCache(),this.qr=e.getTargetCache(),this.Kr=e.getBundleCache(),this.os(n)}os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Qa(this.ss,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ss.setIndexManager(this.indexManager),this.es.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.ts))}};function Ay(r,e,t,n){return new Ah(r,e,t,n)}function ky(r,e){return S(this,null,function*(){let t=N(r);return yield t.persistence.runTransaction("Handle user change","readonly",n=>{let i;return t.mutationQueue.getAllMutationBatches(n).next(s=>(i=s,t.os(e),t.mutationQueue.getAllMutationBatches(n))).next(s=>{let o=[],a=[],u=Q();for(let c of i){o.push(c.batchId);for(let l of c.mutations)u=u.add(l.key)}for(let c of s){a.push(c.batchId);for(let l of c.mutations)u=u.add(l.key)}return t.localDocuments.getDocuments(n,u).next(c=>({_s:c,removedBatchIds:o,addedBatchIds:a}))})})})}function sT(r,e){let t=N(r);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",n=>{let i=e.batch.keys(),s=t.ss.newChangeBuffer({trackRemovals:!0});return function(a,u,c,l){let h=c.batch,d=h.keys(),m=b.resolve();return d.forEach(w=>{m=m.next(()=>l.getEntry(u,w)).next(T=>{let E=c.docVersions.get(w);O(E!==null),T.version.compareTo(E)<0&&(h.applyToRemoteDocument(T,c),T.isValidDocument()&&(T.setReadTime(c.commitVersion),l.addEntry(T)))})}),m.next(()=>a.mutationQueue.removeMutationBatch(u,h))}(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(a){let u=Q();for(let c=0;c<a.mutationResults.length;++c)a.mutationResults[c].transformResults.length>0&&(u=u.add(a.batch.mutations[c].key));return u}(e))).next(()=>t.localDocuments.getDocuments(n,i))})}function Py(r){let e=N(r);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.qr.getLastRemoteSnapshotVersion(t))}function oT(r,e){let t=N(r),n=e.snapshotVersion,i=t.ts;return t.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{let o=t.ss.newChangeBuffer({trackRemovals:!0});i=t.ts;let a=[];e.targetChanges.forEach((l,h)=>{let d=i.get(h);if(!d)return;a.push(t.qr.removeMatchingKeys(s,l.removedDocuments,h).next(()=>t.qr.addMatchingKeys(s,l.addedDocuments,h)));let m=d.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(h)!==null?m=m.withResumeToken(Oe.EMPTY_BYTE_STRING,F.min()).withLastLimboFreeSnapshotVersion(F.min()):l.resumeToken.approximateByteSize()>0&&(m=m.withResumeToken(l.resumeToken,n)),i=i.insert(h,m),function(T,E,I){return T.resumeToken.approximateByteSize()===0||E.snapshotVersion.toMicroseconds()-T.snapshotVersion.toMicroseconds()>=3e8?!0:I.addedDocuments.size+I.modifiedDocuments.size+I.removedDocuments.size>0}(d,m,l)&&a.push(t.qr.updateTargetData(s,m))});let u=rt(),c=Q();if(e.documentUpdates.forEach(l=>{e.resolvedLimboDocuments.has(l)&&a.push(t.persistence.referenceDelegate.updateLimboDocument(s,l))}),a.push(Cy(s,o,e.documentUpdates).next(l=>{u=l.us,c=l.cs})),!n.isEqual(F.min())){let l=t.qr.getLastRemoteSnapshotVersion(s).next(h=>t.qr.setTargetsMetadata(s,s.currentSequenceNumber,n));a.push(l)}return b.waitFor(a).next(()=>o.apply(s)).next(()=>t.localDocuments.getLocalViewOfDocuments(s,u,c)).next(()=>u)}).then(s=>(t.ts=i,s))}function Cy(r,e,t){let n=Q(),i=Q();return t.forEach(s=>n=n.add(s)),e.getEntries(r,n).next(s=>{let o=rt();return t.forEach((a,u)=>{let c=s.get(a);u.isFoundDocument()!==c.isFoundDocument()&&(i=i.add(a)),u.isNoDocument()&&u.version.isEqual(F.min())?(e.removeEntry(a,u.readTime),o=o.insert(a,u)):!c.isValidDocument()||u.version.compareTo(c.version)>0||u.version.compareTo(c.version)===0&&c.hasPendingWrites?(e.addEntry(u),o=o.insert(a,u)):x("LocalStore","Ignoring outdated watch update for ",a,". Current version:",c.version," Watch version:",u.version)}),{us:o,cs:i}})}function aT(r,e){let t=N(r);return t.persistence.runTransaction("Get next mutation batch","readonly",n=>(e===void 0&&(e=-1),t.mutationQueue.getNextMutationBatchAfterBatchId(n,e)))}function gi(r,e){let t=N(r);return t.persistence.runTransaction("Allocate target","readwrite",n=>{let i;return t.qr.getTargetData(n,e).next(s=>s?(i=s,b.resolve(i)):t.qr.allocateTargetId(n).next(o=>(i=new pi(e,o,"TargetPurposeListen",n.currentSequenceNumber),t.qr.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.ns.set(e,n.targetId)),n})}function _i(r,e,t){return S(this,null,function*(){let n=N(r),i=n.ts.get(e),s=t?"readwrite":"readwrite-primary";try{t||(yield n.persistence.runTransaction("Release target",s,o=>n.persistence.referenceDelegate.removeTarget(o,i)))}catch(o){if(!Rr(o))throw o;x("LocalStore",`Failed to update sequence numbers for target ${e}: ${o}`)}n.ts=n.ts.remove(e),n.ns.delete(i.target)})}function Xa(r,e,t){let n=N(r),i=F.min(),s=Q();return n.persistence.runTransaction("Execute query","readwrite",o=>function(u,c,l){let h=N(u),d=h.ns.get(l);return d!==void 0?b.resolve(h.ts.get(d)):h.qr.getTargetData(c,l)}(n,o,Xe(e)).next(a=>{if(a)return i=a.lastLimboFreeSnapshotVersion,n.qr.getMatchingKeysForTargetId(o,a.targetId).next(u=>{s=u})}).next(()=>n.es.getDocumentsMatchingQuery(o,e,t?i:F.min(),t?s:Q())).next(a=>(Dy(n,K_(e),a),{documents:a,ls:s})))}function xy(r,e){let t=N(r),n=N(t.qr),i=t.ts.get(e);return i?Promise.resolve(i.target):t.persistence.runTransaction("Get target data","readonly",s=>n._t(s,e).next(o=>o?o.target:null))}function Ry(r,e){let t=N(r),n=t.rs.get(e)||F.min();return t.persistence.runTransaction("Get new document changes","readonly",i=>t.ss.getAllFromCollectionGroup(i,e,A_(n,-1),Number.MAX_SAFE_INTEGER)).then(i=>
27(Dy(t,e,i),i))}function Dy(r,e,t){let n=r.rs.get(e)||F.min();t.forEach((i,s)=>{s.readTime.compareTo(n)>0&&(n=s.readTime)}),r.rs.set(e,n)}function uT(r,e,t,n){return S(this,null,function*(){let i=N(r),s=Q(),o=rt();for(let c of t){let l=e.hs(c.metadata.name);c.document&&(s=s.add(l));let h=e.Ps(c);h.setReadTime(e.Is(c.metadata.readTime)),o=o.insert(l,h)}let a=i.ss.newChangeBuffer({trackRemovals:!0}),u=yield gi(i,function(l){return Xe(bi(ee.fromString(`__bundle__/docs/${l}`)))}(n));return i.persistence.runTransaction("Apply bundle documents","readwrite",c=>Cy(c,a,o).next(l=>(a.apply(c),l)).next(l=>i.qr.removeMatchingKeysForTargetId(c,u.targetId).next(()=>i.qr.addMatchingKeys(c,s,u.targetId)).next(()=>i.localDocuments.getLocalViewOfDocuments(c,l.us,l.cs)).next(()=>l.us)))})}function cT(n,i){return S(this,arguments,function*(r,e,t=Q()){let s=yield gi(r,Xe(Id(e.bundledQuery))),o=N(r);return o.persistence.runTransaction("Save named query","readwrite",a=>{let u=be(e.readTime);if(s.snapshotVersion.compareTo(u)>=0)return o.Kr.saveNamedQuery(a,e);let c=s.withResumeToken(Oe.EMPTY_BYTE_STRING,u);return o.ts=o.ts.insert(c.targetId,c),o.qr.updateTargetData(a,c).next(()=>o.qr.removeMatchingKeysForTargetId(a,s.targetId)).next(()=>o.qr.addMatchingKeys(a,t,s.targetId)).next(()=>o.Kr.saveNamedQuery(a,e))})})}function d_(r,e){return`firestore_clients_${r}_${e}`}function f_(r,e,t){let n=`firestore_mutations_${r}_${t}`;return e.isAuthenticated()&&(n+=`_${e.uid}`),n}function ml(r,e){return`firestore_targets_${r}_${e}`}var Za=class r{constructor(e,t,n,i){this.user=e,this.batchId=t,this.state=n,this.error=i}static Ts(e,t,n){let i=JSON.parse(n),s,o=typeof i=="object"&&["pending","acknowledged","rejected"].indexOf(i.state)!==-1&&(i.error===void 0||typeof i.error=="object");return o&&i.error&&(o=typeof i.error.message=="string"&&typeof i.error.code=="string",o&&(s=new C(i.error.code,i.error.message))),o?new r(e,t,i.state,s):(Ee("SharedClientState",`Failed to parse mutation state for ID '${t}': ${n}`),null)}Es(){let e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}},ks=class r{constructor(e,t,n){this.targetId=e,this.state=t,this.error=n}static Ts(e,t){let n=JSON.parse(t),i,s=typeof n=="object"&&["not-current","current","rejected"].indexOf(n.state)!==-1&&(n.error===void 0||typeof n.error=="object");return s&&n.error&&(s=typeof n.error.message=="string"&&typeof n.error.code=="string",s&&(i=new C(n.error.code,n.error.message))),s?new r(e,n.state,i):(Ee("SharedClientState",`Failed to parse target state for ID '${e}': ${t}`),null)}Es(){let e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}},eu=class r{constructor(e,t){this.clientId=e,this.activeTargetIds=t}static Ts(e,t){let n=JSON.parse(t),i=typeof n=="object"&&n.activeTargetIds instanceof Array,s=vd();for(let o=0;i&&o<n.activeTargetIds.length;++o)i=C_(n.activeTargetIds[o]),s=s.add(n.activeTargetIds[o]);return i?new r(e,s):(Ee("SharedClientState",`Failed to parse client data for instance '${e}': ${t}`),null)}},kh=class r{constructor(e,t){this.clientId=e,this.onlineState=t}static Ts(e){let t=JSON.parse(e);return typeof t=="object"&&["Unknown","Online","Offline"].indexOf(t.onlineState)!==-1&&typeof t.clientId=="string"?new r(t.clientId,t.onlineState):(Ee("SharedClientState",`Failed to parse online state: ${e}`),null)}},Ks=class{constructor(){this.activeTargetIds=vd()}ds(e){this.activeTargetIds=this.activeTargetIds.add(e)}As(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Es(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}},Ps=class{constructor(e,t,n,i,s){this.window=e,this.si=t,this.persistenceKey=n,this.Rs=i,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.Vs=this.fs.bind(this),this.gs=new le(K),this.started=!1,this.ps=[];let o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=s,this.ys=d_(this.persistenceKey,this.Rs),this.ws=function(u){return`firestore_sequence_number_${u}`}(this.persistenceKey),this.gs=this.gs.insert(this.Rs,new Ks),this.Ss=new RegExp(`^firestore_clients_${o}_([^_]*)$`),this.bs=new RegExp(`^firestore_mutations_${o}_(\\d+)(?:_(.*))?$`),this.Ds=new RegExp(`^firestore_targets_${o}_(\\d+)$`),this.Cs=function(u){return`firestore_online_state_${u}`}(this.persistenceKey),this.vs=function(u){return`firestore_bundle_loaded_v2_${u}`}(this.persistenceKey),this.window.addEventListener("storage",this.Vs)}static D(e){return!(!e||!e.localStorage)}start(){return S(this,null,function*(){let e=yield this.syncEngine.Bi();for(let n of e){if(n===this.Rs)continue;let i=this.getItem(d_(this.persistenceKey,n));if(i){let s=eu.Ts(n,i);s&&(this.gs=this.gs.insert(s.clientId,s))}}this.Fs();let t=this.storage.getItem(this.Cs);if(t){let n=this.Ms(t);n&&this.xs(n)}for(let n of this.ps)this.fs(n);this.ps=[],this.window.addEventListener("pagehide",()=>this.shutdown()),this.started=!0})}writeSequenceNumber(e){this.setItem(this.ws,JSON.stringify(e))}getAllActiveQueryTargets(){return this.Os(this.gs)}isActiveQueryTarget(e){let t=!1;
vendor: 5,281 bytes, line 27
27return this.gs.forEach((n,i)=>{i.activeTargetIds.has(e)&&(t=!0)}),t}addPendingMutation(e){this.Ns(e,"pending")}updateMutationState(e,t,n){this.Ns(e,t,n),this.Bs(e)}addLocalQueryTarget(e){let t="not-current";if(this.isActiveQueryTarget(e)){let n=this.storage.getItem(ml(this.persistenceKey,e));if(n){let i=ks.Ts(e,n);i&&(t=i.state)}}return this.Ls.ds(e),this.Fs(),t}removeLocalQueryTarget(e){this.Ls.As(e),this.Fs()}isLocalQueryTarget(e){return this.Ls.activeTargetIds.has(e)}clearQueryState(e){this.removeItem(ml(this.persistenceKey,e))}updateQueryState(e,t,n){this.ks(e,t,n)}handleUserChange(e,t,n){t.forEach(i=>{this.Bs(i)}),this.currentUser=e,n.forEach(i=>{this.addPendingMutation(i)})}setOnlineState(e){this.qs(e)}notifyBundleLoaded(e){this.Qs(e)}shutdown(){this.started&&(this.window.removeEventListener("storage",this.Vs),this.removeItem(this.ys),this.started=!1)}getItem(e){let t=this.storage.getItem(e);return x("SharedClientState","READ",e,t),t}setItem(e,t){x("SharedClientState","SET",e,t),this.storage.setItem(e,t)}removeItem(e){x("SharedClientState","REMOVE",e),this.storage.removeItem(e)}fs(e){let t=e;if(t.storageArea===this.storage){if(x("SharedClientState","EVENT",t.key,t.newValue),t.key===this.ys)return void Ee("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.si.enqueueRetryable(()=>S(this,null,function*(){if(this.started){if(t.key!==null){if(this.Ss.test(t.key)){if(t.newValue==null){let n=this.Ks(t.key);return this.$s(n,null)}{let n=this.Us(t.key,t.newValue);if(n)return this.$s(n.clientId,n)}}else if(this.bs.test(t.key)){if(t.newValue!==null){let n=this.Ws(t.key,t.newValue);if(n)return this.Gs(n)}}else if(this.Ds.test(t.key)){if(t.newValue!==null){let n=this.zs(t.key,t.newValue);if(n)return this.js(n)}}else if(t.key===this.Cs){if(t.newValue!==null){let n=this.Ms(t.newValue);if(n)return this.xs(n)}}else if(t.key===this.ws){let n=function(s){let o=st._e;if(s!=null)try{let a=JSON.parse(s);O(typeof a=="number"),o=a}catch(a){Ee("SharedClientState","Failed to read sequence number from WebStorage",a)}return o}(t.newValue);n!==st._e&&this.sequenceNumberHandler(n)}else if(t.key===this.vs){let n=this.Hs(t.newValue);yield Promise.all(n.map(i=>this.syncEngine.Js(i)))}}}else this.ps.push(t)}))}}get Ls(){return this.gs.get(this.Rs)}Fs(){this.setItem(this.ys,this.Ls.Es())}Ns(e,t,n){let i=new Za(this.currentUser,e,t,n),s=f_(this.persistenceKey,this.currentUser,e);this.setItem(s,i.Es())}Bs(e){let t=f_(this.persistenceKey,this.currentUser,e);this.removeItem(t)}qs(e){let t={clientId:this.Rs,onlineState:e};this.storage.setItem(this.Cs,JSON.stringify(t))}ks(e,t,n){let i=ml(this.persistenceKey,e),s=new ks(e,t,n);this.setItem(i,s.Es())}Qs(e){let t=JSON.stringify(Array.from(e));this.setItem(this.vs,t)}Ks(e){let t=this.Ss.exec(e);return t?t[1]:null}Us(e,t){let n=this.Ks(e);return eu.Ts(n,t)}Ws(e,t){let n=this.bs.exec(e),i=Number(n[1]),s=n[2]!==void 0?n[2]:null;return Za.Ts(new ke(s),i,t)}zs(e,t){let n=this.Ds.exec(e),i=Number(n[1]);return ks.Ts(i,t)}Ms(e){return kh.Ts(e)}Hs(e){return JSON.parse(e)}Gs(e){return S(this,null,function*(){if(e.user.uid===this.currentUser.uid)return this.syncEngine.Ys(e.batchId,e.state,e.error);x("SharedClientState",`Ignoring mutation for non-active user ${e.user.uid}`)})}js(e){return this.syncEngine.Zs(e.targetId,e.state,e.error)}$s(e,t){let n=t?this.gs.insert(e,t):this.gs.remove(e),i=this.Os(this.gs),s=this.Os(n),o=[],a=[];return s.forEach(u=>{i.has(u)||o.push(u)}),i.forEach(u=>{s.has(u)||a.push(u)}),this.syncEngine.Xs(o,a).then(()=>{this.gs=n})}xs(e){this.gs.get(e.clientId)&&this.onlineStateHandler(e.onlineState)}Os(e){let t=vd();return e.forEach((n,i)=>{t=t.unionWith(i.activeTargetIds)}),t}},tu=class{constructor(){this.eo=new Ks,this.no={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){return this.eo.ds(e),this.no[e]||"not-current"}updateQueryState(e,t,n){this.no[e]=t}removeLocalQueryTarget(e){this.eo.As(e)}isLocalQueryTarget(e){return this.eo.activeTargetIds.has(e)}clearQueryState(e){delete this.no[e]}getAllActiveQueryTargets(){return this.eo.activeTargetIds}isActiveQueryTarget(e){return this.eo.activeTargetIds.has(e)}start(){return this.eo=new Ks,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};var Ph=class{ro(e){}shutdown(){}};var ru=class{constructor(){this.io=()=>this.so(),this.oo=()=>this._o(),this.ao=[],this.uo()}ro(e){this.ao.push(e)}shutdown(){window.removeEventListener("online",this.io),window.removeEventListener("offline",this.oo)}uo(){window.addEventListener("online",this.io),window.addEventListener("offline",this.oo)}so(){x("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(let e of this.ao)e(0)}_o(){x("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(let e of this.ao)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}};var ya=null;function gl(){return ya===null?ya=function(){return 268435456+Math.round(2147483648*Math.random())}():ya++,"0x"+ya.toString(16)}var lT={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregation
27Query:"runAggregationQuery"};var Ch=class{constructor(e){this.co=e.co,this.lo=e.lo}ho(e){this.Po=e}Io(e){this.To=e}onMessage(e){this.Eo=e}close(){this.lo()}send(e){this.co(e)}Ao(){this.Po()}Ro(e){this.To(e)}Vo(e){this.Eo(e)}};var ze="WebChannelConnection",xh=class extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;let n=t.ssl?"https":"http",i=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.mo=n+"://"+t.host,this.fo=`projects/${i}/databases/${s}`,this.po=this.databaseId.database==="(default)"?`project_id=${i}`:`project_id=${i}&database_id=${s}`}get yo(){return!1}wo(t,n,i,s,o){let a=gl(),u=this.So(t,n);x("RestConnection",`Sending RPC '${t}' ${a}:`,u,i);let c={"google-cloud-resource-prefix":this.fo,"x-goog-request-params":this.po};return this.bo(c,s,o),this.Do(t,u,c,i).then(l=>(x("RestConnection",`Received RPC '${t}' ${a}: `,l),l),l=>{throw lt("RestConnection",`RPC '${t}' ${a} failed with error: `,l,"url: ",u,"request:",i),l})}Co(t,n,i,s,o,a){return this.wo(t,n,i,s,o)}bo(t,n,i){t["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Ti}(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEach((s,o)=>t[o]=s),i&&i.headers.forEach((s,o)=>t[o]=s)}So(t,n){let i=lT[t];return`${this.mo}/v1/${n}:${i}`}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Do(e,t,n,i){let s=gl();return new Promise((o,a)=>{let u=new Eg;u.setWithCredentials(!0),u.listenOnce(wg.COMPLETE,()=>{try{switch(u.getLastErrorCode()){case pa.NO_ERROR:let l=u.getResponseJson();x(ze,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(l)),o(l);break;case pa.TIMEOUT:x(ze,`RPC '${e}' ${s} timed out`),a(new C(A.DEADLINE_EXCEEDED,"Request time out"));break;case pa.HTTP_ERROR:let h=u.getStatus();if(x(ze,`RPC '${e}' ${s} failed with status:`,h,"response text:",u.getResponseText()),h>0){let d=u.getResponseJson();Array.isArray(d)&&(d=d[0]);let m=d?.error;if(m&&m.status&&m.message){let w=function(E){let I=E.toLowerCase().replace(/_/g,"-");return Object.values(A).indexOf(I)>=0?I:A.UNKNOWN}(m.status);a(new C(w,m.message))}else a(new C(A.UNKNOWN,"Server responded with status "+u.getStatus()))}else a(new C(A.UNAVAILABLE,"Connection failed."));break;default:V()}}finally{x(ze,`RPC '${e}' ${s} completed.`)}});let c=JSON.stringify(i);x(ze,`RPC '${e}' ${s} sending request:`,i),u.send(t,"POST",c,n,15)})}vo(e,t,n){let i=gl(),s=[this.mo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=yg(),a=vg(),u={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(u.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(u.useFetchStreams=!0),this.bo(u.initMessageHeaders,t,n),u.encodeInitMessageHeaders=!0;let l=s.join("");x(ze,`Creating RPC '${e}' stream ${i}: ${l}`,u);let h=o.createWebChannel(l,u),d=!1,m=!1,w=new Ch({co:E=>{m?x(ze,`Not sending because RPC '${e}' stream ${i} is closed:`,E):(d||(x(ze,`Opening RPC '${e}' stream ${i} transport.`),h.open(),d=!0),x(ze,`RPC '${e}' stream ${i} sending:`,E),h.send(E))},lo:()=>h.close()}),T=(E,I,v)=>{E.listen(I,p=>{try{v(p)}catch(g){setTimeout(()=>{throw g},0)}})};return T(h,_s.EventType.OPEN,()=>{m||x(ze,`RPC '${e}' stream ${i} transport opened.`)}),T(h,_s.EventType.CLOSE,()=>{m||(m=!0,x(ze,`RPC '${e}' stream ${i} transport closed`),w.Ro())}),T(h,_s.EventType.ERROR,E=>{m||(m=!0,lt(ze,`RPC '${e}' stream ${i} transport errored:`,E),w.Ro(new C(A.UNAVAILABLE,"The operation could not be completed")))}),T(h,_s.EventType.MESSAGE,E=>{var I;if(!m){let v=E.data[0];O(!!v);let p=v,g=p.error||((I=p[0])===null||I===void 0?void 0:I.error);if(g){x(ze,`RPC '${e}' stream ${i} received error:`,g);let _=g.status,y=function(W){let te=Se[W];if(te!==void 0)return oy(te)}(_),M=g.message;y===void 0&&(y=A.INTERNAL,M="Unknown error status: "+_+" with message "+g.message),m=!0,w.Ro(new C(y,M)),h.close()}else x(ze,`RPC '${e}' stream ${i} received:`,v),w.Vo(v)}}),T(a,Ig.STAT_EVENT,E=>{E.stat===dl.PROXY?x(ze,`RPC '${e}' stream ${i}
27 detected buffering proxy`):E.stat===dl.NOPROXY&&x(ze,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{w.Ao()},0),w}};function Ny(){return typeof window<"u"?window:null}function Ta(){return typeof document<"u"?document:null}function no(r){return new Ql(r,!0)}var Gs=class{constructor(e,t,n=1e3,i=1.5,s=6e4){this.si=e,this.timerId=t,this.Fo=n,this.Mo=i,this.xo=s,this.Oo=0,this.No=null,this.Bo=Date.now(),this.reset()}reset(){this.Oo=0}Lo(){this.Oo=this.xo}ko(e){this.cancel();let t=Math.floor(this.Oo+this.qo()),n=Math.max(0,Date.now()-this.Bo),i=Math.max(0,t-n);i>0&&x("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.Oo} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.No=this.si.enqueueAfterDelay(this.timerId,i,()=>(this.Bo=Date.now(),e())),this.Oo*=this.Mo,this.Oo<this.Fo&&(this.Oo=this.Fo),this.Oo>this.xo&&(this.Oo=this.xo)}Qo(){this.No!==null&&(this.No.skipDelay(),this.No=null)}cancel(){this.No!==null&&(this.No.cancel(),this.No=null)}qo(){return(Math.random()-.5)*this.Oo}};var nu=class{constructor(e,t,n,i,s,o,a,u){this.si=e,this.Ko=n,this.$o=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=u,this.state=0,this.Uo=0,this.Wo=null,this.Go=null,this.stream=null,this.zo=new Gs(e,t)}jo(){return this.state===1||this.state===5||this.Ho()}Ho(){return this.state===2||this.state===3}start(){this.state!==4?this.auth():this.Jo()}stop(){return S(this,null,function*(){this.jo()&&(yield this.close(0))})}Yo(){this.state=0,this.zo.reset()}Zo(){this.Ho()&&this.Wo===null&&(this.Wo=this.si.enqueueAfterDelay(this.Ko,6e4,()=>this.Xo()))}e_(e){this.t_(),this.stream.send(e)}Xo(){return S(this,null,function*(){if(this.Ho())return this.close(0)})}t_(){this.Wo&&(this.Wo.cancel(),this.Wo=null)}
vendor: 5,581 bytes, lines 27-28
27n_(){this.Go&&(this.Go.cancel(),this.Go=null)}close(e,t){return S(this,null,function*(){this.t_(),this.n_(),this.zo.cancel(),this.Uo++,e!==4?this.zo.reset():t&&t.code===A.RESOURCE_EXHAUSTED?(Ee(t.toString()),Ee("Using maximum backoff delay to prevent overloading the backend."),this.zo.Lo()):t&&t.code===A.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.r_(),this.stream.close(),this.stream=null),this.state=e,yield this.listener.Io(t)})}r_(){}auth(){this.state=1;let e=this.i_(this.Uo),t=this.Uo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([n,i])=>{this.Uo===t&&this.s_(n,i)},n=>{e(()=>{let i=new C(A.UNKNOWN,"Fetching auth token failed: "+n.message);return this.o_(i)})})}s_(e,t){let n=this.i_(this.Uo);this.stream=this.__(e,t),this.stream.ho(()=>{n(()=>(this.state=2,this.Go=this.si.enqueueAfterDelay(this.$o,1e4,()=>(this.Ho()&&(this.state=3),Promise.resolve())),this.listener.ho()))}),this.stream.Io(i=>{n(()=>this.o_(i))}),this.stream.onMessage(i=>{n(()=>this.onMessage(i))})}Jo(){this.state=5,this.zo.ko(()=>S(this,null,function*(){this.state=0,this.start()}))}o_(e){return x("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}i_(e){return t=>{this.si.enqueueAndForget(()=>this.Uo===e?t():(x("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}},Rh=class extends nu{constructor(e,t,n,i,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,i,o),this.serializer=s}__(e,t){return this.connection.vo("Listen",e,t)}onMessage(e){this.zo.reset();let t=QE(this.serializer,e),n=function(s){if(!("targetChange"in s))return F.min();let o=s.targetChange;return o.targetIds&&o.targetIds.length?F.min():o.readTime?be(o.readTime):F.min()}(e);return this.listener.a_(t,n)}u_(e){let t={};t.database=Bs(this.serializer),t.addTarget=function(s,o){let a,u=o.target;if(a=Va(u)?{documents:fy(s,u)}:{query:py(s,u)},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=uy(s,o.resumeToken);let c=Hl(s,o.expectedCount);c!==null&&(a.expectedCount=c)}else if(o.snapshotVersion.compareTo(F.min())>0){a.readTime=fi(s,o.snapshotVersion.toTimestamp());let c=Hl(s,o.expectedCount);c!==null&&(a.expectedCount=c)}return a}(this.serializer,e);let n=YE(this.serializer,e);n&&(t.labels=n),this.e_(t)}c_(e){let t={};t.database=Bs(this.serializer),t.removeTarget=e,this.e_(t)}},Dh=class extends nu{constructor(e,t,n,i,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,i,o),this.serializer=s,this.l_=!1}get h_(){return this.l_}start(){this.l_=!1,this.lastStreamToken=void 0,super.start()}r_(){this.l_&&this.P_([])}__(e,t){return this.connection.vo("Write",e,t)}onMessage(e){if(O(!!e.streamToken),this.lastStreamToken=e.streamToken,this.l_){this.zo.reset();let t=HE(e.writeResults,e.commitTime),n=be(e.commitTime);return this.listener.I_(n,t)}return O(!e.writeResults||e.writeResults.length===0),this.l_=!0,this.listener.T_()}E_(){let e={};e.database=Bs(this.serializer),this.e_(e)}P_(e){let t={streamToken:this.lastStreamToken,writes:e.map(n=>js(this.serializer,n))};this.e_(t)}};var Nh=class extends class{}{constructor(e,t,n,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=i,this.d_=!1}A_(){if(this.d_)throw new C(A.FAILED_PRECONDITION,"The client has already been terminated.")}wo(e,t,n){return this.A_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,s])=>this.connection.wo(e,t,n,i,s)).catch(i=>{throw i.name==="FirebaseError"?(i.code===A.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new C(A.UNKNOWN,i.toString())})}Co(e,t,n,i){return this.A_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Co(e,t,n,s,o,i)).catch(s=>{throw s.name==="FirebaseError"?(s.code===A.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new C(A.UNKNOWN,s.toString())})}terminate(){this.d_=!0}};var Vh=class{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.V_=0,this.m_=null,this.f_=!0}g_(){this.V_===0&&(this.p_("Unknown"),this.m_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.m_=null,this.y_("Backend didn't respond within 10 seconds."),this.p_("Offline"),Promise.resolve())))}w_(e){this.state==="Online"?this.p_("Unknown"):(this.V_++,this.V_>=1&&(this.S_(),this.y_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.p_("Offline")))}set(e){this.S_(),this.V_=0,e==="Online"&&(this.f_=!1),this.p_(e)}p_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}y_(e){let t=`Could not reach Cloud Firestore backend. ${e}
28This 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.f_?(Ee(t),this.f_=!1):x("OnlineStateTracker",t)}S_(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}};var Oh=class{constructor(e,t,n,i,s){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.b_=[],this.D_=new Map,this.C_=new Set,this.v_=[],this.F_=s,this.F_.ro(o=>{n.enqueueAndForget(()=>S(this,null,function*(){Dr(this)&&(x("RemoteStore","Restarting streams for network reach
28ability change."),yield function(u){return S(this,null,function*(){let c=N(u);c.C_.add(4),yield Si(c),c.M_.set("Unknown"),c.C_.delete(4),yield io(c)})}(this))}))}),this.M_=new Vh(n,i)}};function io(r){return S(this,null,function*(){if(Dr(r))for(let e of r.v_)yield e(!0)})}function Si(r){return S(this,null,function*(){for(let e of r.v_)yield e(!1)})}function Eu(r,e){let t=N(r);t.D_.has(e.targetId)||(t.D_.set(e.targetId,e),Ad(t)?Sd(t):ki(t).Ho()&&bd(t,e))}function Ws(r,e){let t=N(r),n=ki(t);t.D_.delete(e),n.Ho()&&Vy(t,e),t.D_.size===0&&(n.Ho()?n.Zo():Dr(t)&&t.M_.set("Unknown"))}function bd(r,e){if(r.x_.Oe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(F.min())>0){let t=r.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}ki(r).u_(e)}function Vy(r,e){r.x_.Oe(e),ki(r).c_(e)}function Sd(r){r.x_=new Wl({getRemoteKeysForTarget:e=>r.remoteSyncer.getRemoteKeysForTarget(e),_t:e=>r.D_.get(e)||null,nt:()=>r.datastore.serializer.databaseId}),ki(r).start(),r.M_.g_()}function Ad(r){return Dr(r)&&!ki(r).jo()&&r.D_.size>0}function Dr(r){return N(r).C_.size===0}function Oy(r){r.x_=void 0}function hT(r){return S(this,null,function*(){r.D_.forEach((e,t)=>{bd(r,e)})})}function dT(r,e){return S(this,null,function*(){Oy(r),Ad(r)?(r.M_.w_(e),Sd(r)):r.M_.set("Unknown")})}function fT(r,e,t){return S(this,null,function*(){if(r.M_.set("Online"),e instanceof La&&e.state===2&&e.cause)try{yield function(i,s){return S(this,null,function*(){let o=s.cause;for(let a of s.targetIds)i.D_.has(a)&&(yield i.remoteSyncer.rejectListen(a,o),i.D_.delete(a),i.x_.removeTarget(a))})}(r,e)}catch(n){x("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),yield iu(r,n)}else if(e instanceof oi?r.x_.$e(e):e instanceof Ma?r.x_.Je(e):r.x_.Ge(e),!t.isEqual(F.min()))try{let n=yield Py(r.localStore);t.compareTo(n)>=0&&(yield function(s,o){let a=s.x_.it(o);
vendor: 9,004 bytes, lines 28-31
28return a.targetChanges.forEach((u,c)=>{if(u.resumeToken.approximateByteSize()>0){let l=s.D_.get(c);l&&s.D_.set(c,l.withResumeToken(u.resumeToken,o))}}),a.targetMismatches.forEach((u,c)=>{let l=s.D_.get(u);if(!l)return;s.D_.set(u,l.withResumeToken(Oe.EMPTY_BYTE_STRING,l.snapshotVersion)),Vy(s,u);let h=new pi(l.target,u,c,l.sequenceNumber);bd(s,h)}),s.remoteSyncer.applyRemoteEvent(a)}(r,t))}catch(n){x("RemoteStore","Failed to raise snapshot:",n),yield iu(r,n)}})}function iu(r,e,t){return S(this,null,function*(){if(!Rr(e))throw e;r.C_.add(1),yield Si(r),r.M_.set("Offline"),t||(t=()=>Py(r.localStore)),r.asyncQueue.enqueueRetryable(()=>S(this,null,function*(){x("RemoteStore","Retrying IndexedDB access"),yield t(),r.C_.delete(1),yield io(r)}))})}function Fy(r,e){return e().catch(t=>iu(r,t,e))}function Ai(r){return S(this,null,function*(){let e=N(r),t=Cr(e),n=e.b_.length>0?e.b_[e.b_.length-1].batchId:-1;for(;pT(e);)try{let i=yield aT(e.localStore,n);if(i===null){e.b_.length===0&&t.Zo();break}n=i.batchId,mT(e,i)}catch(i){yield iu(e,i)}My(e)&&Ly(e)})}function pT(r){return Dr(r)&&r.b_.length<10}function mT(r,e){r.b_.push(e);let t=Cr(r);t.Ho()&&t.h_&&t.P_(e.mutations)}function My(r){return Dr(r)&&!Cr(r).jo()&&r.b_.length>0}function Ly(r){Cr(r).start()}function gT(r){return S(this,null,function*(){Cr(r).E_()})}function _T(r){return S(this,null,function*(){let e=Cr(r);for(let t of r.b_)e.P_(t.mutations)})}function yT(r,e,t){return S(this,null,function*(){let n=r.b_.shift(),i=zl.from(n,e,t);yield Fy(r,()=>r.remoteSyncer.applySuccessfulWrite(i)),yield Ai(r)})}function vT(r,e){return S(this,null,function*(){e&&Cr(r).h_&&(yield function(n,i){return S(this,null,function*(){if(function(o){return sy(o)&&o!==A.ABORTED}(i.code)){let s=n.b_.shift();Cr(n).Yo(),yield Fy(n,()=>n.remoteSyncer.rejectFailedWrite(s.batchId,i)),yield Ai(n)}})}(r,e)),My(r)&&Ly(r)})}function p_(r,e){return S(this,null,function*(){let t=N(r);t.asyncQueue.verifyOperationInProgress(),x("RemoteStore","RemoteStore received new credentials");let n=Dr(t);t.C_.add(3),yield Si(t),n&&t.M_.set("Unknown"),yield t.remoteSyncer.handleCredentialChange(e),t.C_.delete(3),yield io(t)})}function Fh(r,e){return S(this,null,function*(){let t=N(r);e?(t.C_.delete(2),yield io(t)):e||(t.C_.add(2),yield Si(t),t.M_.set("Unknown"))})}function ki(r){return r.O_||(r.O_=function(t,n,i){let s=N(t);return s.A_(),new Rh(n,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(r.datastore,r.asyncQueue,{ho:hT.bind(null,r),Io:dT.bind(null,r),a_:fT.bind(null,r)}),r.v_.push(e=>S(this,null,function*(){e?(r.O_.Yo(),Ad(r)?Sd(r):r.M_.set("Unknown")):(yield r.O_.stop(),Oy(r))}))),r.O_}function Cr(r){return r.N_||(r.N_=function(t,n,i){let s=N(t);return s.A_(),new Dh(n,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(r.datastore,r.asyncQueue,{ho:gT.bind(null,r),Io:vT.bind(null,r),T_:_T.bind(null,r),I_:yT.bind(null,r)}),r.v_.push(e=>S(this,null,function*(){e?(r.N_.Yo(),yield Ai(r)):(yield r.N_.stop(),r.b_.length>0&&(x("RemoteStore",`Stopping write stream with ${r.b_.length} pending writes`),r.b_=[]))}))),r.N_}var Mh=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 Pe,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,i,s){let o=Date.now()+n,a=new r(e,t,o,i,s);return a.start(n),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new C(A.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function Pi(r,e){if(Ee("AsyncQueue",`${e}: ${r}`),Rr(r))return new C(A.UNAVAILABLE,`${e}: ${r}`);throw r}var su=class r{constructor(e){this.comparator=e?(t,n)=>e(t,n)||R.comparator(t.key,n.key):(t,n)=>R.comparator(t.key,n.key),this.keyedMap=Es(),this.sortedSet=new le(this.comparator)}static emptySet(e){return new r(e.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 (
29  `+e.join(`  
30`)+`
31)`}copy(e,t){let n=new r;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}};var ou=class{constructor(){this.B_=new le(R.comparator)}track(e){let t=e.doc.key,n=this.B_.get(t);n?e.type!==0&&n.type===3?this.B_=this.B_.insert(t,e):e.type===3&&n.type!==1?this.B_=this.B_.insert(t,{type:n.type,doc:e.doc}):e.type===2&&n.type===2?this.B_=this.B_.insert(t,{type:2,doc:e.doc}):e.type===2&&n.type===0?this.B_=this.B_.insert(t,{type:0,doc:e.doc}):e.type===1&&n.type===0?this.B_=this.B_.remove(t):e.type===1&&n.type===2?this.B_=this.B_.insert(t,{type:1,doc:n.doc}):e.type===0&&n.type===1?this.B_=this.B_.insert(t,{type:2,doc:e.doc}):V():this.B_=this.B_.insert(t,e)}L_(){let e=[];return this.B_.inorderTraversal((t,n)=>{e.push(n)}),e}},yi=class r{constructor(e,t,n,i,s,o,a,u,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=u,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,i,s){let o=[];return t.forEach(a=>{o.push({type:0,doc:a})}),new r(e,t,su.emptySet(t),o,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)&&to(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}};var Lh=class{constructor(){this.k_=void 0,this.listeners=[]}},qh=class{constructor(){this.queries=new Ft(e=>z_(e),to),this.onlineState="Unknown",this.q_=new Set}};function kd(r,e){return S(this,null,function*(){let t=N(r),n=e.query,i=!1,s=t.queries.get(n);if(s||(i=!0,s=new Lh),i)try{s.k_=yield t.onListen(n)}catch(o){let a=Pi(o,`Initialization of query '${Zn(e.query)}' failed`);return void e.onError(a)}t.queries.set(n,s),s.listeners.push(e),e.Q_(t.onlineState),s.k_&&e.K_(s.k_)&&Cd(t)})}function Pd(r,e){return S(this,null,function*(){let t=N(r),n=e.query,i=!1,s=t.queries.get(n);if(s){let o=s.listeners.indexOf(e);o>=0&&(s.listeners.splice(o,1),i=s.listeners.length===0)}if(i)return t.queries.delete(n),t.onUnlisten(n)})}function wT(r,e){let t=N(r),n=!1;for(let i of e){let s=i.query,o=t.queries.get(s);if(o){for(let a of o.listeners)a.K_(i)&&(n=!0);o.k_=i}}n&&Cd(t)}function IT(r,e,t){let n=N(r),i=n.queries.get(e);if(i)for(let s of i.listeners)s.onError(t);n.queries.delete(e)}function Cd(r){r.q_.forEach(e=>{e.next()})}var Qs=class{constructor(e,t,n){this.query=e,this.U_=t,this.W_=!1,this.G_=null,this.onlineState="Unknown",this.options=n||{}}K_(e){if(!this.options.includeMetadataChanges){let n=[];for(let i of e.docChanges)i.type!==3&&n.push(i);e=new yi(e.query,e.docs,e.oldDocs,n,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.W_?this.z_(e)&&(this.U_.next(e),t=!0):this.j_(e,this.onlineState)&&(this.H_(e),t=!0),this.G_=e,t}onError(e){this.U_.error(e)}Q_(e){this.onlineState=e;let t=!1;return this.G_&&!this.W_&&this.j_(this.G_,e)&&(this.H_(this.G_),t=!0),t}j_(e,t){if(!e.fromCache)return!0;let n=t!=="Offline";return(!this.options.J_||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}z_(e){if(e.docChanges.length>0)return!0;let t=this.G_&&this.G_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}H_(e){e=yi.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.W_=!0,this.U_.next(e)}};var Uh=class{constructor(e,t){this.Y_=e,this.byteLength=t}Z_(){return"metadata"in this.Y_}};
31var au=class{constructor(e){this.serializer=e}hs(e){return Dt(this.serializer,e)}Ps(e){return e.metadata.exists?dy(this.serializer,e.document,!1):Ce.newNoDocument(this.hs(e.metadata.name),this.Is(e.metadata.readTime))}Is(e){return be(e)}},Bh=class{constructor(e,t,n){this.X_=e,this.localStore=t,this.serializer=n,this.queries=[],this.documents=[],this.collectionGroups=new Set,this.progress=qy(e)}ea(e){this.progress.bytesLoaded+=e.byteLength;let t=this.progress.documentsLoaded;if(e.Y_.namedQuery)this.queries.push(e.Y_.namedQuery);else if(e.Y_.documentMetadata){this.documents.push({metadata:e.Y_.documentMetadata}),e.Y_.documentMetadata.exists||++t;let n=ee.fromString(e.Y_.documentMetadata.name);this.collectionGroups.add(n.get(n.length-2))}else e.Y_.document&&(this.documents[this.documents.length-1].document=e.Y_.document,++t);return t!==this.progress.documentsLoaded?(this.progress.documentsLoaded=t,Object.assign({},this.progress)):null}ta(e){let t=new Map,n=new au(this.serializer);for(let i of e)if(i.metadata.queries){let s=n.hs(i.metadata.name);for(let o of i.metadata.queries){let a=(t.get(o)||Q()).add(s);t.set(o,a)}}return t}complete(){return S(this,null,function*(){let e=yield uT(this.localStore,new au(this.serializer),this.documents,this.X_.id),t=this.ta(this.documents);for(let n of this.queries)yield cT(this.localStore,n,t.get(n.name));return this.progress.taskState="Success",{progress:this.progress,na:this.collectionGroups,ra:e}})}};function qy(r){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:r.totalDocuments,totalBytes:r.totalBytes}}var uu=class{constructor(e){this.key=e}},cu=class{constructor(e){this.key=e}},lu=class{constructor(e,t){this.query=e,this.ia=t,this.sa=null,this.hasCachedResults=!1,this.current=!1,this.oa=Q(),this.mutatedKeys=Q(),this._a=G_(e),this.aa=new su(this._a)}get ua(){return this.ia}ca(e,t){let n=t?t.la:new ou,i=t?t.aa:this.aa,s=t?t.mutatedKeys:this.mutatedKeys,o=i,a=!1,u=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,c=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((l,h)=>{let d=i.get(l),m=ro(this.query,h)?h:null,w=!!d&&this.mutatedKeys.has(d.key),T=!!m&&(m.hasLocalMutations||this.mutatedKeys.has(m.key)&&m.hasCommittedMutations),E=!1;d&&m?d.data.isEqual(m.data)?w!==T&&(n.track({type:3,doc:m}),E=!0):this.ha(d,m)||(n.track({type:2,doc:m}),E=!0,(u&&this._a(m,u)>0||c&&this._a(m,c)<0)&&(a=!0)):!d&&m?(n.track({type:0,doc:m}),E=!0):d&&!m&&(n.track({type:1,doc:d}),E=!0,(u||c)&&(a=!0)),E&&(m?(o=o.add(m),s=T?s.add(l):s.delete(l)):(o=o.delete(l),s=s.delete(l)))}),this.query.limit!==null)for(;o.size>this.query.limit;){let l=this.query.limitType==="F"?o.last():o.first();o=o.delete(l.key),s=s.delete(l.key),n.track({type:1,doc:l})}return{aa:o,la:n,Zi:a,mutatedKeys:s}}ha(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,i){let s=this.aa;this.aa=e.aa,this.mutatedKeys=e.mutatedKeys;let o=e.la.L_();o.sort((l,h)=>function(m,w){let T=E=>{switch(E){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return V()}};return T(m)-T(w)}(l.type,h.type)||this._a(l.doc,h.doc)),this.Pa(n),i=i!=null&&i;let a=t&&!i?this.Ia():[],u=this.oa.size===0&&this.current&&!i?1:0,c=u!==this.sa;return this.sa=u,o.length!==0||c?{snapshot:new yi(this.query,e.aa,s,o,e.mutatedKeys,u===0,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),Ta:a}:{Ta:a}}Q_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({aa:this.aa,la:new ou,mutatedKeys:this.mutatedKeys,Zi:!1},!1)):{Ta:[]}}Ea(e){return!this.ia.has(e)&&!!this.aa.has(e)&&!this.aa.get(e).hasLocalMutations}Pa(e){e&&(e.addedDocuments.forEach(t=>this.ia=this.ia.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.ia=this.ia.delete(t)),this.current=e.current)}
vendor: 3,739 bytes, line 31
31Ia(){if(!this.current)return[];let e=this.oa;this.oa=Q(),this.aa.forEach(n=>{this.Ea(n.key)&&(this.oa=this.oa.add(n.key))});let t=[];return e.forEach(n=>{this.oa.has(n)||t.push(new cu(n))}),this.oa.forEach(n=>{e.has(n)||t.push(new uu(n))}),t}da(e){this.ia=e.ls,this.oa=Q();let t=this.ca(e.documents);return this.applyChanges(t,!0)}Aa(){return yi.fromInitialDocuments(this.query,this.aa,this.mutatedKeys,this.sa===0,this.hasCachedResults)}},jh=class{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}},$h=class{constructor(e){this.key=e,this.Ra=!1}},zh=class{constructor(e,t,n,i,s,o){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.Va={},this.ma=new Ft(a=>z_(a),to),this.fa=new Map,this.ga=new Set,this.pa=new le(R.comparator),this.ya=new Map,this.wa=new zs,this.Sa={},this.ba=new Map,this.Da=mi.Nn(),this.onlineState="Unknown",this.Ca=void 0}get isPrimaryClient(){return this.Ca===!0}};function ET(r,e){return S(this,null,function*(){let t=Vd(r),n,i,s=t.ma.get(e);if(s)n=s.targetId,t.sharedClientState.addLocalQueryTarget(n),i=s.view.Aa();else{let o=yield gi(t.localStore,Xe(e)),a=t.sharedClientState.addLocalQueryTarget(o.targetId);n=o.targetId,i=yield xd(t,e,n,a==="current",o.resumeToken),t.isPrimaryClient&&Eu(t.remoteStore,o)}return i})}function xd(r,e,t,n,i){return S(this,null,function*(){r.va=(h,d,m)=>function(T,E,I,v){return S(this,null,function*(){let p=E.view.ca(I);p.Zi&&(p=yield Xa(T.localStore,E.query,!1).then(({documents:M})=>E.view.ca(M,p)));let g=v&&v.targetChanges.get(E.targetId),_=v&&v.targetMismatches.get(E.targetId)!=null,y=E.view.applyChanges(p,T.isPrimaryClient,g,_);return Kh(T,E.targetId,y.Ta),y.snapshot})}(r,h,d,m);let s=yield Xa(r.localStore,e,!0),o=new lu(e,s.ls),a=o.ca(s.documents),u=qs.createSynthesizedTargetChangeForCurrentChange(t,n&&r.onlineState!=="Offline",i),c=o.applyChanges(a,r.isPrimaryClient,u);Kh(r,t,c.Ta);let l=new jh(e,t,o);return r.ma.set(e,l),r.fa.has(t)?r.fa.get(t).push(e):r.fa.set(t,[e]),c.snapshot})}function TT(r,e){return S(this,null,function*(){let t=N(r),n=t.ma.get(e),i=t.fa.get(n.targetId);if(i.length>1)return t.fa.set(n.targetId,i.filter(s=>!to(s,e))),void t.ma.delete(e);t.isPrimaryClient?(t.sharedClientState.removeLocalQueryTarget(n.targetId),t.sharedClientState.isActiveQueryTarget(n.targetId)||(yield _i(t.localStore,n.targetId,!1).then(()=>{t.sharedClientState.clearQueryState(n.targetId),Ws(t.remoteStore,n.targetId),vi(t,n.targetId)}).catch(xr))):(vi(t,n.targetId),yield _i(t.localStore,n.targetId,!0))})}function bT(r,e,t){return S(this,null,function*(){let n=Od(r);try{let i=yield function(o,a){let u=N(o),c=ge.now(),l=a.reduce((m,w)=>m.add(w.key),Q()),h,d;return u.persistence.runTransaction("Locally write mutations","readwrite",m=>{let w=rt(),T=Q();return u.ss.getEntries(m,l).next(E=>{w=E,w.forEach((I,v)=>{v.isValidDocument()||(T=T.add(I))})}).next(()=>u.localDocuments.getOverlayedDocuments(m,w)).next(E=>{h=E;let I=[];for(let v of a){let p=BE(v,h.get(v.key).overlayedDocument);p!=null&&I.push(new vt(v.key,p,M_(p.value.mapValue),Ie.exists(!0)))}return u.mutationQueue.addMutationBatch(m,c,I,a)}).next(E=>{d=E;let I=E.applyToLocalDocumentSet(h,T);return u.documentOverlayCache.saveOverlays(m,E.batchId,I)})}).then(()=>({batchId:d.batchId,changes:Q_(h)}))}(n.localStore,e);n.sharedClientState.addPendingMutation(i.batchId),function(o,a,u){let c=o.Sa[o.currentUser.toKey()];c||(c=new le(K)),c=c.insert(a,u),o.Sa[o.currentUser.toKey()]=c}(n,i.batchId,t),yield Zt(n,i.changes),yield Ai(n.remoteStore)}catch(i){let s=Pi(i,"Failed to persist write");t.reject(s)}})}function Uy(r,e){return S(this,null,function*(){let t=N(r);try{let n=yield oT(t.localStore,e);
31e.targetChanges.forEach((i,s)=>{let o=t.ya.get(s);o&&(O(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1),i.addedDocuments.size>0?o.Ra=!0:i.modifiedDocuments.size>0?O(o.Ra):i.removedDocuments.size>0&&(O(o.Ra),o.Ra=!1))}),yield Zt(t,n,e)}catch(n){yield xr(n)}})}function m_(r,e,t){let n=N(r);if(n.isPrimaryClient&&t===0||!n.isPrimaryClient&&t===1){let i=[];n.ma.forEach((s,o)=>{let a=o.view.Q_(e);a.snapshot&&i.push(a.snapshot)}),function(o,a){let u=N(o);u.onlineState=a;let c=!1;u.queries.forEach((l,h)=>{for(let d of h.listeners)d.Q_(a)&&(c=!0)}),c&&Cd(u)}(n.eventManager,e),i.length&&n.Va.a_(i),n.onlineState=e,n.isPrimaryClient&&n.sharedClientState.setOnlineState(e)}}function ST(r,e,t){return S(this,null,function*(){let n=N(r);n.sharedClientState.updateQueryState(e,"rejected",t);let i=n.ya.get(e),s=i&&i.key;if(s){let o=new le(R.comparator);o=o.insert(s,Ce.newNoDocument(s,F.min()));let a=Q().add(s),u=new Ls(F.min(),new Map,new le(K),o,a);yield Uy(n,u),n.pa=n.pa.remove(s),n.ya.delete(e),Nd(n)}else yield _i(n.localStore,e,!1).then(()=>vi(n,e,t)).catch(xr)})}function AT(r,e){return S(this,null,function*(){let t=N(r),n=e.batch.batchId;try{let i=yield sT(t.localStore,e);Dd(t,n,null),Rd(t,n),t.sharedClientState.updateMutationState(n,"acknowledged"),yield Zt(t,i)}catch(i){yield xr(i)}})}function kT(r,e,t){return S(this,null,function*(){let n=N(r);try{let i=yield function(o,a){let u=N(o);return u.persistence.runTransaction("Reject batch","readwrite-primary",c=>{let l;return u.mutationQueue.lookupMutationBatch(c,a).next(h=>(O(h!==null),l=h.keys(),u.mutationQueue.removeMutationBatch(c,h))).next(()=>u.mutationQueue.performConsistencyCheck(c)).next(()=>u.documentOverlayCache.removeOverlaysForBatchId(c,l,a)).next(()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(c,l)).next(()=>u.localDocuments.getDocuments(c,l))})}(n.localStore,e);Dd(n,e,t),Rd(n,e),n.sharedClientState.updateMutationState(e,"rejected",t),yield Zt(n,i)}catch(i){yield xr(i)}})}function PT(r,e){return S(this,null,function*(){let t=N(r);Dr(t.remoteStore)||x("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");try{let n=yield function(o){let a=N(o);return a.persistence.runTransaction("Get highest unacknowledged batch id","readonly",u=>
31a.mutationQueue.getHighestUnacknowledgedBatchId(u))}(t.localStore);if(n===-1)return void e.resolve();let i=t.ba.get(n)||[];i.push(e),t.ba.set(n,i)}catch(n){let i=Pi(n,"Initialization of waitForPendingWrites() operation failed");e.reject(i)}})}function Rd(r,e){(r.ba.get(e)||[]).forEach(t=>{t.resolve()}),r.ba.delete(e)}function Dd(r,e,t){let n=N(r),i=n.Sa[n.currentUser.toKey()];if(i){let s=i.get(e);s&&(t?s.reject(t):s.resolve(),i=i.remove(e)),n.Sa[n.currentUser.toKey()]=i}}function vi(r,e,t=null){r.sharedClientState.removeLocalQueryTarget(e);for(let n of r.fa.get(e))r.ma.delete(n),t&&r.Va.Fa(n,t);r.fa.delete(e),r.isPrimaryClient&&r.wa.Rr(e).forEach(n=>{r.wa.containsKey(n)||By(r,n)})}function By(r,e){r.ga.delete(e.path.canonicalString());let t=r.pa.get(e);t!==null&&(Ws(r.remoteStore,t),r.pa=r.pa.remove(e),r.ya.delete(t),Nd(r))}function Kh(r,e,t){for(let n of t)n instanceof uu?(r.wa.addReference(n.key,e),CT(r,n)):n instanceof cu?(x("SyncEngine","Document no longer in limbo: "+n.key),r.wa.removeReference(n.key,e),r.wa.containsKey(n.key)||By(r,n.key)):V()}function CT(r,e){let t=e.key,n=t.path.canonicalString();r.pa.get(t)||r.ga.has(n)||(x("SyncEngine","New document in limbo: "+t),r.ga.add(n),Nd(r))}function Nd(r){for(;r.ga.size>0&&r.pa.size<r.maxConcurrentLimboResolutions;){let e=r.ga.values().next().value;r.ga.delete(e);let t=new R(ee.fromString(e)),n=r.Da.next();r.ya.set(n,new $h(t)),r.pa=r.pa.insert(t,n),Eu(r.remoteStore,new pi(Xe(bi(t.path)),n,"TargetPurposeLimboResolution",st._e))}}function Zt(r,e,t){return S(this,null,function*(){let n=N(r),i=[],s=[],o=[];n.ma.isEmpty()||(n.ma.forEach((a,u)=>{o.push(n.va(u,e,t).then(c=>{if((c||t)&&n.isPrimaryClient&&n.sharedClientState.updateQueryState(u.targetId,c?.fromCache?"not-current":"current"),c){i.push(c);let l=bh.Qi(u.targetId,c);s.push(l)}}))}),yield Promise.all(o),n.Va.a_(i),yield function(u,c){return S(this,null,function*(){let l=N(u);try{yield l.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>b.forEach(c,d=>b.forEach(d.ki,m=>l.persistence.referenceDelegate.addReference(h,d.targetId,m)).next(()=>b.forEach(d.qi,m=>l.persistence.referenceDelegate.removeReference(h,d.targetId,m)))))}catch(h){if(!Rr(h))throw h;x("LocalStore","Failed to update sequence numbers: "+h)}for(let h of c){let d=h.targetId;if(!h.fromCache){let m=l.ts.get(d),w=m.snapshotVersion,T=m.withLastLimboFreeSnapshotVersion(w);l.ts=l.ts.insert(d,T)}}})}(n.localStore,s))})}function xT(r,e){return S(this,null,function*(){let t=N(r);if(!t.currentUser.isEqual(e)){x("SyncEngine","User change. New user:",e.toKey());let n=yield ky(t.localStore,e);t.currentUser=e,function(s,o){s.ba.forEach(a=>{a.forEach(u=>{u.reject(new C(A.CANCELLED,o))})}),s.ba.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,n.removedBatchIds,n.addedBatchIds),yield Zt(t,n._s)}})}function RT(r,e){let t=N(r),n=t.ya.get(e);if(n&&n.Ra)return Q().add(n.key);{let i=Q(),s=t.fa.get(e);if(!s)return i;for(let o of s){let a=t.ma.get(o);i=i.unionWith(a.view.ua)}return i}}function DT(r,e){return S(this,null,function*(){let t=N(r),n=yield Xa(t.localStore,e.query,!0),i=e.view.da(n);return t.isPrimaryClient&&Kh(t,e.targetId,i.Ta),i})}function NT(r,e){return S(this,null,function*(){let t=N(r);return Ry(t.localStore,e).then(n=>Zt(t,n))})}function VT(r,e,t,n){return S(this,null,function*(){let i=N(r),s=yield function(a,u){let c=N(a),l=N(c.mutationQueue);return c.persistence.runTransaction("Lookup mutation documents","readonly",h=>l.Cn(h,u).next(d=>d?c.localDocuments.getDocuments(h,d):b.resolve(null)))}(i.localStore,e);s!==null?(t==="pending"?yield Ai(i.remoteStore):t==="acknowledged"||t==="rejected"?(Dd(i,e,n||null),Rd(i,e),function(a,u){N(N(a).mutation
31Queue).Fn(u)}(i.localStore,e)):V(),yield Zt(i,s)):x("SyncEngine","Cannot apply mutation batch with id: "+e)})}function OT(r,e){return S(this,null,function*(){let t=N(r);if(Vd(t),Od(t),e===!0&&t.Ca!==!0){let n=t.sharedClientState.getAllActiveQueryTargets(),i=yield g_(t,n.toArray());t.Ca=!0,yield Fh(t.remoteStore,!0);for(let s of i)Eu(t.remoteStore,s)}else if(e===!1&&t.Ca!==!1){let n=[],i=Promise.resolve();t.fa.forEach((s,o)=>{t.sharedClientState.isLocalQueryTarget(o)?n.push(o):i=i.then(()=>(vi(t,o),_i(t.localStore,o,!0))),Ws(t.remoteStore,o)}),yield i,yield g_(t,n),function(o){let a=N(o);a.ya.forEach((u,c)=>{Ws(a.remoteStore,c)}),a.wa.Vr(),a.ya=new Map,a.pa=new le(R.comparator)}(t),t.Ca=!1,yield Fh(t.remoteStore,!1)}})}function g_(r,e,t){return S(this,null,function*(){let n=N(r),i=[],s=[];for(let o of e){let a,u=n.fa.get(o);if(u&&u.length!==0){a=yield gi(n.localStore,Xe(u[0]));for(let c of u){let l=n.ma.get(c),h=yield DT(n,l);h.snapshot&&s.push(h.snapshot)}}else{let c=yield xy(n.localStore,o);a=yield gi(n.localStore,c),yield xd(n,jy(c),o,!1,a.resumeToken)}i.push(a)}return n.Va.a_(s),i})}function jy(r){return $_(r.path,r.collectionGroup,r.orderBy,r.filters,r.limit,"F",r.startAt,r.endAt)}function FT(r){return function(t){return N(N(t).persistence).Bi()}(N(r).localStore)}function MT(r,e,t,n){return S(this,null,function*(){let i=N(r);if(i.Ca)return void x("SyncEngine","Ignoring unexpected query state notification.");let s=i.fa.get(e);if(s&&s.length>0)switch(t){case"current":case"not-current":{let o=yield Ry(i.localStore,K_(s[0])),a=Ls.createSynthesizedRemoteEventForCurrentChange(e,t==="current",Oe.EMPTY_BYTE_STRING);yield Zt(i,o,a);break}case"rejected":yield _i(i.localStore,e,!0),vi(i,e,n);break;default:V()}})}function LT(r,e,t){return S(this,null,function*(){let n=Vd(r);if(n.Ca){for(let i of e){if(n.fa.has(i)){x("SyncEngine","Adding an already active target "+i);continue}let s=yield xy(n.localStore,i),o=yield gi(n.localStore,s);yield xd(n,jy(s),o.targetId,!1,o.resumeToken),Eu(n.remoteStore,o)}for(let i of t)n.fa.has(i)&&(yield _i(n.localStore,i,!1).then(()=>{Ws(n.remoteStore,i),vi(n,i)}).catch(xr))}})}function Vd(r){let e=N(r);return e.remoteStore.remoteSyncer.applyRemoteEvent=Uy.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=RT.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=ST.bind(null,e),e.Va.a_=wT.bind(null,e.eventManager),e.Va.Fa=IT.bind(null,e.eventManager),e}function Od(r){let e=N(r);return e.remoteStore.remoteSyncer.applySuccessfulWrite=AT.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=kT.bind(null,e),e}function qT(r,e,t){let n=N(r);(function(s,o,a){return S(this,null,function*(){try{let u=yield o.getMetadata();if(yield function(m,w){let T=N(m),E=be(w.createTime);return T.persistence.runTransaction("hasNewerBundle","readonly",I=>T.Kr.getBundleMetadata(I,w.id)).then(I=>!!I&&I.createTime.compareTo(E)>=0)}(s.localStore,u))return yield o.close(),a._completeWith(function(m){return{taskState:"Success",documentsLoaded:m.totalDocuments,bytesLoaded:m.totalBytes,totalDocuments:m.totalDocuments,totalBytes:m.totalBytes}}(u)),Promise.resolve(new Set);a._updateProgress(qy(u));let c=new Bh(u,s.localStore,o.serializer),l=yield o.Ma();for(;l;){let d=yield c.ea(l);d&&a._updateProgress(d),l=yield o.Ma()}let h=yield c.complete();return yield Zt(s,h.ra,void 0),yield function(m,w){let T=N(m);return T.persistence.runTransaction("Save bundle","readwrite",E=>T.Kr.saveBundleMetadata(E,w))}(s.localStore,u),a._completeWith(h.progress),Promise.resolve(h.na)}catch(u){return lt("SyncEngine",`Loading bundle failed with ${u}`),a._failWith(u),Promise.resolve(new Set)}})})(n,e,t).then(i=>{n.sharedClientState.notifyBundleLoaded(i)})}var Hs=class{constructor(){this.synchronizeTabs=!1}initialize(e){return S(this,null,function*(){this.serializer=no(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),yield this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler
31=this.createIndexBackfillerScheduler(e,this.localStore)})}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){return Ay(this.persistence,new Ja,e.initialUser,this.serializer)}createPersistence(e){return new Ha(Ya.jr,this.serializer)}createSharedClientState(e){return new tu}terminate(){return S(this,null,function*(){this.gcScheduler&&this.gcScheduler.stop(),yield this.sharedClientState.shutdown(),yield this.persistence.shutdown()})}};var hu=class r extends Hs{constructor(e,t,n){super(),this.xa=e,this.cacheSizeBytes=t,this.forceOwnership=n,this.synchronizeTabs=!1}initialize(e){return S(this,null,function*(){yield Yu(r.prototype,this,"initialize").call(this,e),yield this.xa.initialize(this,e),yield Od(this.xa.syncEngine),yield Ai(this.xa.remoteStore),yield this.persistence.mi(()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve()))})}createLocalStore(e){return Ay(this.persistence,new Ja,e.initialUser,this.serializer)}createGarbageCollectionScheduler(e,t){let n=this.persistence.referenceDelegate.garbageCollector;return new ch(n,e.asyncQueue,t)}createIndexBackfillerScheduler(e,t){let n=new Pl(t,this.persistence);return new kl(e.asyncQueue,n)}createPersistence(e){let t=Td(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),n=this.cacheSizeBytes!==void 0?ct.withCacheSize(this.cacheSizeBytes):ct.DEFAULT;return new Th(this.synchronizeTabs,t,e.clientId,n,e.asyncQueue,Ny(),Ta(),this.serializer,this.sharedClientState,!!this.forceOwnership)}createSharedClientState(e){return new tu}},Gh=class r extends hu{constructor(e,t){super(e,t,!1),this.xa=e,this.cacheSizeBytes=t,this.synchronizeTabs=!0}initialize(e){return S(this,null,function*(){yield Yu(r.prototype,this,"initialize").call(this,e);let t=this.xa.syncEngine;this.sharedClientState instanceof Ps&&(this.sharedClientState.syncEngine={Ys:VT.bind(null,t),Zs:MT.bind(null,t),Xs:LT.bind(null,t),Bi:FT.bind(null,t),Js:NT.bind(null,t)},yield this.sharedClientState.start()),yield this.persistence.mi(n=>S(this,null,function*(){yield OT(this.xa.syncEngine,n),this.gcScheduler&&(n&&!this.gcScheduler.started?this.gcScheduler.start():n||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(n&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():n||this.indexBackfillerScheduler.stop())}))})}createSharedClientState(e){let t=Ny();if(!Ps.D(t))throw new C(A.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");let n=Td(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new Ps(t,e.asyncQueue,n,e.clientId,e.initialUser)}},Ys=class{initialize(e,t){return S(this,null,function*(){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=>m_(this.syncEngine,n,1),this.remoteStore.remoteSyncer.handleCredentialChange=xT.bind(null,this.syncEngine),yield Fh(this.remoteStore,this.syncEngine.isPrimaryClient))})}createEventManager(e){return function(){return new qh}()}createDatastore(e){let t=no(e.databaseInfo.databaseId),n=function(s){return new xh(s)}(e.databaseInfo);return function(s,o,a,u){return new Nh(s,o,a,u)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(n,i,s,o,a){return new Oh(n,i,s,o,a)}(this.localStore,this.datastore,e.asyncQueue,t=>m_(this.syncEngine,t,0),function(){return ru.D()?new ru:new Ph}())}createSyncEngine(e,t){return function(i,s,o,a,u,c,l){let h=new zh(i,s,o,a,u,c);return l&&(h.Ca=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}terminate(){return function(t){return S(this,null,function*(){let n=N(t);x("RemoteStore","RemoteStore shutting down."),n.C_.add(5),yield Si(n),n.F_.shutdown(),n.M_.set("Unknown")})}(this.remoteStore)}};function __(r,e=10240){let t=0;return{read(){return S(this,null,function*(){if(t<r.byteLength){let i={value:r.slice(t,t+e),done:!1};return t+=e,i}return{done:!0}})},cancel(){return S(this,null,function*(){})},releaseLock(){},closed:Promise.resolve()}}var wi=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Oa(this.observer.next,e)}error(e){this.observer.error?this.Oa(this.observer.error,e):Ee("Uncaught Error in snapshot listener:",e.toString())}Na(){this.muted=!0}
31Oa(e,t){this.muted||setTimeout(()=>{this.muted||e(t)},0)}};var Wh=class{constructor(e,t){this.Ba=e,this.serializer=t,this.metadata=new Pe,this.buffer=new Uint8Array,this.La=function(){return new TextDecoder("utf-8")}(),this.ka().then(n=>{n&&n.Z_()?this.metadata.resolve(n.Y_.metadata):this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is
32             ${JSON.stringify(n?.Y_)}`))},n=>this.metadata.reject(n))}close(){return this.Ba.cancel()}getMetadata(){return S(this,null,function*(){return this.metadata.promise})}Ma(){return S(this,null,function*(){return yield this.getMetadata(),this.ka()})}ka(){return S(this,null,function*(){let e=yield this.qa();if(e===null)return null;let t=this.La.decode(e),n=Number(t);isNaN(n)&&this.Qa(`length string (${t}) is not valid number`);let i=yield this.Ka(n);return new Uh(JSON.parse(i),e.length+n)})}$a(){return this.buffer.findIndex(e=>e==="{".charCodeAt(0))}qa(){return S(this,null,function*(){for(;this.$a()<0&&!(yield this.Ua()););if(this.buffer.length===0)return null;let e=this.$a();e<0&&this.Qa("Reached the end of bundle when a length string is expected.");let t=this.buffer.slice(0,e);return this.buffer=this.buffer.slice(e),t})}Ka(e){return S(this,null,function*(){for(;this.buffer.length<e;)(yield this.Ua())&&this.Qa("Reached the end of bundle when more is expected.");let t=this.La.decode(this.buffer.slice(0,e));return this.buffer=this.buffer.slice(e),t})}Qa(e){throw this.Ba.cancel(),new Error(`Invalid bundle format: ${e}`)}Ua(){return S(this,null,function*(){let e=yield this.Ba.read();if(!e.done){let t=new Uint8Array(this.buffer.length+e.value.length);t.set(this.buffer),t.set(e.value,this.buffer.length),this.buffer=t}return e.done})}};var Qh=class{constructor(e){this.datastore=e,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastWriteError=null,this.writtenDocs=new Set}lookup(e){return S(this,null,function*(){if(this.ensureCommitNotCalled(),this.mutations.length>0)throw new C(A.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");let t=yield function(i,s){return S(this,null,function*(){let o=N(i),a=Bs(o.serializer)+"/documents",u={documents:s.map(d=>Us(o.serializer,d))},c=yield o.Co("BatchGetDocuments",a,u,s.length),l=new Map;c.forEach(d=>{let m=WE(o.serializer,d);l.set(m.key.toString(),m)});let h=[];return s.forEach(d=>{let m=l.get(d.toString());O(!!m),h.push(m)}),h})}(this.datastore,e);return t.forEach(n=>this.recordVersion(n)),t})}set(e,t){this.write(t.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,t){try{this.write(t.toMutation(e,this.preconditionForUpdate(e)))}catch(n){this.lastWriteError=n}this.writtenDocs.add(e.toString())}delete(e){this.write(new Pr(e,this.precondition(e))),this.writtenDocs.add(e.toString())}commit(){return S(this,null,function*(){if(this.ensureCommitNotCalled(),this.lastWriteError)throw this.lastWriteError;let e=this.readVersions;this.mutations.forEach(t=>{e.delete(t.key.toString())}),e.forEach((t,n)=>{let i=R.fromPath(n);this.mutations.push(new Os(i,this.precondition(i)))}),yield function(n,i){return S(this,null,function*(){let s=N(n),o=Bs(s.serializer)+"/documents",a={writes:i.map(u=>js(s.serializer,u))};yield s.wo("Commit",o,a)})}(this.datastore,this.mutations),this.committed=!0})}recordVersion(e){let t;if(e.isFoundDocument())t=e.version;else{if(!e.isNoDocument())throw V();t=F.min()}let n=this.readVersions.get(e.key.toString());if(n){if(!t.isEqual(n))throw new C(A.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),t)}precondition(e){let t=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&t?t.isEqual(F.min())?Ie.exists(!1):Ie.updateTime(t):Ie.none()}preconditionForUpdate(e){let t=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&t){if(t.isEqual(F.min()))throw new C(A.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Ie.updateTime(t)}return Ie.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}};var Hh=class{constructor(e,t,n,i,s){this.asyncQueue=e,this.datastore=t,this.options=n,this.updateFunction=i,this.deferred=s,this.Wa=n.maxAttempts,this.zo=new Gs(this.asyncQueue,"transaction_retry")}run(){this.Wa-=1,this.Ga()}Ga(){this.zo.ko(()=>S(this,null,function*(){let e=new Qh(this.datastore),t=this.za(e);t&&t.then(n=>{this.asyncQueue.enqueueAndForget(()=>e.commit().then(()=>{this.deferred.resolve(n)}).catch(i=>{this.ja(i)}))}).catch(n=>{this.ja(n)})}))}za(e){try{let t=this.updateFunction(e);return!Zs(t)&&t.catch&&t.then?t:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.deferred.reject(t),null}}ja(e){this.Wa>0&&this.Ha(e)?(this.Wa-=1,this.asyncQueue.enqueueAndForget(()=>(this.Ga(),Promise.resolve()))):this.deferred.reject(e)}Ha(e){if(e.name==="FirebaseError"){let t=e.code;return t==="aborted"||t==="failed-precondition"||t==="already-exists"||!sy(t)}return!1}};var Yh=class{constructor(e,t,n,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=i,this.user=ke.UNAUTHENTICATED,this.clientId=Aa.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,s=>S(this,null,function*(){x("FirestoreClient","Received user=",s.uid),yield this.authCredentialListener(s),this.user=s})),this.appCheckCredentials.start(n,s=>
32(x("FirestoreClient","Received new app check token=",s),this.appCheckCredentialListener(s,this.user)))}getConfiguration(){return S(this,null,function*(){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}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new C(A.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();let e=new Pe;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(()=>S(this,null,function*(){try{this._onlineComponents&&(yield this._onlineComponents.terminate()),this._offlineComponents&&(yield this._offlineComponents.terminate()),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){let n=Pi(t,"Failed to shutdown persistence");e.reject(n)}})),e.promise}};function ba(r,e){return S(this,null,function*(){r.asyncQueue.verifyOperationInProgress(),x("FirestoreClient","Initializing OfflineComponentProvider");let t=yield r.getConfiguration();yield e.initialize(t);let n=t.initialUser;r.setCredentialChangeListener(i=>S(this,null,function*(){n.isEqual(i)||(yield ky(e.localStore,i),n=i)})),e.persistence.setDatabaseDeletedListener(()=>r.terminate()),r._offlineComponents=e})}function Jh(r,e){return S(this,null,function*(){r.asyncQueue.verifyOperationInProgress();let t=yield Fd(r);x("FirestoreClient","Initializing OnlineComponentProvider");let n=yield r.getConfiguration();yield e.initialize(t,n),r.setCredentialChangeListener(i=>p_(e.remoteStore,i)),r.setAppCheckTokenChangeListener((i,s)=>p_(e.remoteStore,s)),r._onlineComponents=e})}function $y(r){return r.name==="FirebaseError"?r.code===A.FAILED_PRECONDITION||r.code===A.UNIMPLEMENTED:!(typeof DOMException<"u"&&r instanceof DOMException)||r.code===22||r.code===20||r.code===11}function Fd(r){return S(this,null,function*(){if(!r._offlineComponents)if(r._uninitializedComponentsProvider){x("FirestoreClient","Using user provided OfflineComponentProvider");try{yield ba(r,r._uninitializedComponentsProvider._offline)}catch(e){let t=e;if(!$y(t))throw t;lt("Error using user provided cache. Falling back to memory cache: "+t),yield ba(r,new Hs)}}else x("FirestoreClient","Using default OfflineComponentProvider"),yield ba(r,new Hs);return r._offlineComponents})}function Tu(r){return S(this,null,function*(){return r._onlineComponents||(r._uninitializedComponentsProvider?(x("FirestoreClient","Using user provided OnlineComponentProvider"),yield Jh(r,r._uninitializedComponentsProvider._online)):(x("FirestoreClient","Using default OnlineComponentProvider"),yield Jh(r,new Ys))),r._onlineComponents})}function zy(r){return Fd(r).then(e=>e.persistence)}function Md(r){return Fd(r).then(e=>e.localStore)}function Ky(r){return Tu(r).then(e=>e.remoteStore)}function Ld(r){return Tu(r).then(e=>e.syncEngine)}function UT(r){return Tu(r).then(e=>e.datastore)}function Ii(r){return S(this,null,function*(){let e=yield Tu(r),t=e.eventManager;return t.onListen=ET.bind(null,e.syncEngine),t.onUnlisten=TT.bind(null,e.syncEngine),t})}function BT(r){return r.asyncQueue.enqueue(()=>S(this,null,function*(){let e=yield zy(r),t=yield Ky(r);return e.setNetworkEnabled(!0),function(i){let s=N(i);return s.C_.delete(0),io(s)}(t)}))}function jT(r){return r.asyncQueue.enqueue(()=>S(this,null,function*(){let e=yield zy(r),t=yield Ky(r);return e.setNetworkEnabled(!1),function(i){return S(this,null,function*(){let s=N(i);s.C_.add(0),yield Si(s),s.M_.set("Offline")})}(t)}))}function $T(r,e){let t=new Pe;return r.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){return function(i,s,o){return S(this,null,function*(){try{let a=yield function(c,l){let h=N(c);return h.persistence.runTransaction("read document","readonly",d=>h.localDocuments.getDocument(d,l))}(i,s);a.isFoundDocument()?o.resolve(a):a.isNoDocument()?o.resolve(null):o.reject(new C(A.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)"))}catch(a){let u=Pi(a,`Failed to get document '${s} from cache`);o.reject(u)}})}(yield Md(r),e,t)})),t.promise}function Gy(r,e,t={}){let n=new Pe;return r.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){return function(s,o,a,u,c){let l=new wi({next:d=>{o.enqueueAndForget(()=>Pd(s,h));let m=d.docs.has(a);!m&&d.fromCache?c.reject(new C(A.UNAVAILABLE,"Failed to get document because the client is offline.")):m&&d.fromCache&&u&&u.source==="server"?c.reject(new C(A.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.)')):c.resolve(d)},error:d=>c.reject(d)}),h=new Qs(bi(a.path),l,{includeMetadataChanges:!0,J_:!0});return kd(s,h)}(yield Ii(r),r.asyncQueue,e,t,n)})),n.promise}function zT(r,e){let t=new Pe;return r.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){return function(i,s,o){return S(this,null,function*(){try{let a=yield Xa(i,s,!0),u=new lu(s,a.ls),c=u.ca(a.documents),l=u.applyChanges(c,!1);o.resolve(l.snapshot)}catch(a){let u=Pi(a,`Failed to execute query '${s} against cache`);o.reject(u)}})}(yield Md(r),e,t)})),t.promise}function Wy(r,e,t={}){let n=new Pe;return r.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){return function(s,o,a,u,c){let l=new wi({next:d=>{o.enqueueAndForget(()=>Pd(s,h)),d.fromCache&&u.source==="server"?c.reject(new C(A.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):c.resolve(d)},error:d=>c.reject(d)}),h=new Qs(a,l,{includeMetadataChanges:!0,J_:!0});return kd(s,h)}(yield Ii(r),r.asyncQueue,e,t,n)})),n.promise}function KT(r,e){let t=new wi(e);return r.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){return function(i,s){N(i).q_.add(s),s.next()}(yield Ii(r),t)})),()=>{t.Na(),r.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){return function(i,s){N(i).q_.delete(s)}(yield Ii(r),t)}))}}function GT(r,e,t,n){let i=function(o,a){let u;
32return u=typeof o=="string"?ay().encode(o):o,function(l,h){return new Wh(l,h)}(function(l,h){if(l instanceof Uint8Array)return __(l,h);if(l instanceof ArrayBuffer)return __(new Uint8Array(l),h);if(l instanceof ReadableStream)return l.getReader();throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream")}(u),a)}(t,no(e));r.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){qT(yield Ld(r),i,n)}))}function WT(r,e){return r.asyncQueue.enqueue(()=>S(this,null,function*(){return function(n,i){let s=N(n);return s.persistence.runTransaction("Get named query","readonly",o=>s.Kr.getNamedQuery(o,i))}(yield Md(r),e)}))}function Qy(r){let e={};return r.timeoutSeconds!==void 0&&(e.timeoutSeconds=r.timeoutSeconds),e}var y_=new Map;function qd(r,e,t){if(!t)throw new C(A.INVALID_ARGUMENT,`Function ${r}() cannot be called with an empty ${e}.`)}function Ud(r,e,t,n){if(e===!0&&n===!0)throw new C(A.INVALID_ARGUMENT,`${r} and ${t} cannot be used together.`)}function v_(r){if(!R.isDocumentKey(r))throw new C(A.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${r} has ${r.length}.`)}function w_(r){if(R.isDocumentKey(r))throw new C(A.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${r} has ${r.length}.`)}function bu(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":V()}function X(r,e){if("_delegate"in r&&(r=r._delegate),!(r instanceof e)){if(e.name===r.constructor.name)throw new C(A.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let t=bu(r);throw new C(A.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return r}function Hy(r,e){if(e<=0)throw new C(A.INVALID_ARGUMENT,`Function ${r}() requires a positive number, but it was: ${e}.`)}var du=class{constructor(e){var t,n;if(e.host===void 0){if(e.ssl!==void 0)throw new C(A.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=(t=e.ssl)===null||t===void 0||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new C(A.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}Ud("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=Qy((n=e.experimentalLongPollingOptions)!==null&&n!==void 0?n:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new C(A.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new C(A.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new C(A.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}},pn=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 du({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new C(A.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!==void 0}_setSettings(e){if(this._settingsFrozen)throw new C(A.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 du(e),e.credentials!==void 0&&(this._authCredentials=function(n){if(!n)return new _l;switch(n.type){case"firstParty":return new Il(n.sessionIndex||"0",n.iamToken||null,n.authTokenFactory||null);case"provider":return n.client;default:throw new C(A.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
32d credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){let n=y_.get(t);n&&(x("ComponentProvider","Removing Datastore"),y_.delete(t),n.terminate())}(this),Promise.resolve()}};function Yy(r,e,t,n={}){var i;let s=(r=X(r,pn))._getSettings(),o=`${e}:${t}`;if(s.host!=="firestore.googleapis.com"&&s.host!==o&&lt("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),r._setSettings(Object.assign(Object.assign({},s),{host:o,ssl:!1})),n.mockUserToken){let a,u;if(typeof n.mockUserToken=="string")a=n.mockUserToken,u=ke.MOCK_USER;else{a=lp(n.mockUserToken,(i=r._app)===null||i===void 0?void 0:i.options.projectId);let c=n.mockUserToken.sub||n.mockUserToken.user_id;if(!c)throw new C(A.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");u=new ke(c)}r._authCredentials=new yl(new Sa(a,u))}}var Be=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 Nt(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new r(this.firestore,e,this._key)}},Nt=class r extends Be{constructor(e,t,n){super(e,t,bi(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 R(e))}withConverter(e){return new r(this.firestore,e,this._path)}};function Bd(r,e,...t){if(r=me(r),qd("collection","path",e),r instanceof pn){let n=ee.fromString(e,...t);return w_(n),new Nt(r,null,n)}{if(!(r instanceof ue||r instanceof Nt))throw new C(A.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let n=r._path.child(ee.fromString(e,...t));return w_(n),new Nt(r.firestore,null,n)}}function Jy(r,e){if(r=X(r,pn),qd("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new C(A.INVALID_ARGUMENT,`Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new Be(r,null,function(n){return new yt(ee.emptyPath(),n)}(e))}function so(r,e,...t){if(r=me(r),arguments.length===1&&(e=Aa.newId()),qd("doc","path",e),r instanceof pn){let n=ee.fromString(e,...t);return v_(n),new ue(r,null,new R(n))}{if(!(r instanceof ue||r instanceof Nt))throw new C(A.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let n=r._path.child(ee.fromString(e,...t));return v_(n),new ue(r.firestore,r instanceof Nt?r.converter:null,new R(n))}}function jd(r,e){return r=me(r),e=me(e),(r instanceof ue||r instanceof Nt)&&(e instanceof ue||e instanceof Nt)&&r.firestore===e.firestore&&r.path===e.path&&r.converter===e.converter}function $d(r,e){return r=me(r),e=me(e),r instanceof Be&&e instanceof Be&&r.firestore===e.firestore&&to(r._query,e._query)&&r.converter===e.converter}var Xh=class{constructor(){this.Ja=Promise.resolve(),this.Ya=[],this.Za=!1,this.Xa=[],this.eu=null,this.tu=!1,this.nu=!1,this.ru=[],this.zo=new Gs(this,"async_queue_retry"),this.iu=()=>{let t=Ta();t&&x("AsyncQueue","Visibility state changed to "+t.visibilityState),this.zo.Qo()};let e=Ta();e&&typeof e.addEventListener=="function"&&e.addEventListener("visibilitychange",this.iu)}get isShuttingDown(){return this.Za}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.su(),this.ou(e)}enterRestrictedMode(e){if(!this.Za){this.Za=!0,this.nu=e||!1;let t=Ta();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.iu)}}enqueue(e){if(this.su(),this.Za)return new Promise(()=>{});let t=new Pe;return this.ou(()=>this.Za&&this.nu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Ya.push(e),this._u()))}_u(){return S(this,null,function*(){if(this.Ya.length!==0){try{yield this.Ya[0](),this.Ya.shift(),this.zo.reset()}catch(e){if(!Rr(e))throw e;x("AsyncQueue","Operation failed with retryable error: "+e)}this.Ya.length>0&&this.zo.ko(()=>this._u())}})}ou(e){let t=this.Ja.then(()=>(this.tu=!0,e().catch(n=>{this.eu=n,this.tu=!1;let i=function(o){let a=o.message||"";return o.stack&&(a=o.stack.includes(o.message)?o.stack:o.message+`
33`+o.stack),a}(n);throw Ee("INTERNAL UNHANDLED ERROR: ",i),n}).then(n=>(this.tu=!1,n))));return this.Ja=t,t}enqueueAfterDelay(e,t,n){this.su(),this.ru.indexOf(e)>-1&&(t=0);let i=Mh.createAndSchedule(this,e,t,n,s=>this.au(s));return this.Xa.push(i),i}su(){this.eu&&V()}verifyOperationInProgress(){}uu(){return S(this,null,function*(){let e;do e=this.Ja,yield e;while(e!==this.Ja)})}cu(e){for(let t of this.Xa)if(t.timerId===e)return!0;return!1}lu(e){return this.uu().then(()=>{this.Xa.sort((t,n)=>t.targetTimeMs-n.targetTimeMs);for(let t of this.Xa)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.uu()})}hu(e){this.ru.push(e)}au(e){let t=this.Xa.indexOf(e);this.Xa.splice(t,1)}};function Zh(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"])}var ed=class{constructor(){this._progressObserver={},this._taskCompletionResolver=new Pe,this._lastProgress={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}onProgress(e,t,n){this._progressObserver={next:e,error:t,complete:n}}catch(e){return this._taskCompletionResolver.promise.catch(e)}then(e,t){return this._taskCompletionResolver.promise.then(e,t)}_completeWith(e){this._updateProgress(e),this._progressObserver.complete&&this._progressObserver.complete(),this._taskCompletionResolver.resolve(e)}_failWith(e){this._lastProgress.taskState="Error",this._progressObserver.next&&this._progressObserver.next(this._lastProgress),this._progressObserver.error&&this._progressObserver.error(e),this._taskCompletionResolver.reject(e)}_updateProgress(e){this._lastProgress=e,this._progressObserver.next&&this._progressObserver.next(e)}};var Xy=-1,fe=class extends pn{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=function(){return new Xh}(),this._persistenceKey=i?.name||"[DEFAULT]"}_terminate(){return this._firestoreClient||Zy(this),this._firestoreClient.terminate()}};function Re(r){return r._firestoreClient||Zy(r),r._firestoreClient.verifyNotTerminated(),r._firestoreClient}function Zy(r){var e,t,n;let i=r._freezeSettings(),s=function(a,u,c,l){return new Cl(a,u,c,l.host,l.ssl,l.experimentalForceLongPolling,l.experimentalAutoDetectLongPolling,Qy(l.experimentalLongPollingOptions),l.useFetchStreams)}(r._databaseId,((e=r._app)===null||e===void 0?void 0:e.options.appId)||"",r._persistenceKey,i);r._firestoreClient=new Yh(r._authCredentials,r._appCheckCredentials,r._queue,s),!((t=i.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((n=i.localCache)===null||n===void 0)&&n._onlineComponentProvider)&&(r._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.localCache.kind,_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider})}function ev(r,e){cv(r=X(r,fe));let t=Re(r);if(t._uninitializedComponentsProvider)throw new C(A.FAILED_PRECONDITION,"SDK cache is already specified.");
33lt("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");let n=r._freezeSettings(),i=new Ys;return rv(t,i,new hu(i,n.cacheSizeBytes,e?.forceOwnership))}function tv(r){cv(r=X(r,fe));let e=Re(r);if(e._uninitializedComponentsProvider)throw new C(A.FAILED_PRECONDITION,"SDK cache is already specified.");lt("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");let t=r._freezeSettings(),n=new Ys;return rv(e,n,new Gh(n,t.cacheSizeBytes))}function rv(r,e,t){let n=new Pe;return r.asyncQueue.enqueue(()=>S(this,null,function*(){try{yield ba(r,t),yield Jh(r,e),n.resolve()}catch(i){let s=i;if(!$y(s))throw s;lt("Error enabling indexeddb cache. Falling back to memory cache: "+s),n.reject(s)}})).then(()=>n.promise)}function nv(r){if(r._initialized&&!r._terminated)throw new C(A.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");let e=new Pe;return r._queue.enqueueAndForgetEvenWhileRestricted(()=>S(this,null,function*(){try{yield function(n){return S(this,null,function*(){if(!wr.D())return Promise.resolve();let i=n+"main";yield wr.delete(i)})}(Td(r._databaseId,r._persistenceKey)),e.resolve()}catch(t){e.reject(t)}})),e.promise}function iv(r){return function(t){let n=new Pe;return t.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){return PT(yield Ld(t),n)})),n.promise}(Re(r=X(r,fe)))}function sv(r){return BT(Re(r=X(r,fe)))}function ov(r){return jT(Re(r=X(r,fe)))}function av(r,e){let t=Re(r=X(r,fe)),n=new ed;return GT(t,r._databaseId,e,n),n}function uv(r,e){return WT(Re(r=X(r,fe)),e).then(t=>t?new Be(r,null,t.query):null)}function cv(r){if(r._initialized||r._terminated)throw new C(A.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.")}var Mt=class r{constructor(e){this._byteString=e}static fromBase64String(e){try{return new r(Oe.fromBase64String(e))}catch(t){throw new C(A.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new r(Oe.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 wt=class{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new C(A.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Te(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};var Jt=class{constructor(e){this._methodName=e}};var mn=class{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new C(A.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new C(A.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 K(this._lat,e._lat)||K(this._long,e._long)}};var QT=/^__.*__$/,td=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return this.fieldMask!==null?new vt(e,this.data,this.fieldMask,t,this.fieldTransforms):new kr(e,this.data,t,this.fieldTransforms)}},fu=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new vt(e,this.data,this.fieldMask,t,this.fieldTransforms)}};function lv(r){switch(r){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw V()}}var pu=class r{constructor(e,t,n,i,s,o){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=i,s===void 0&&this.Pu(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Iu(){return this.settings.Iu}Tu(e){return new r(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Eu(e){var t;let n=(t=this.path)===null||t===void 0?void 0:t.child(e),i=this.Tu({path:n,du:!1});return i.Au(e),i}Ru(e){var t;let n=(t=this.path)===null||t===void 0?void 0:t.child(e),i=this.Tu({path:n,du:!1});return i.Pu(),i}Vu(e){return this.Tu({path:void 0,du:!0})}mu(e){return mu(e,this.settings.methodName,this.settings.fu||!1,this.path,this.settings.gu)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}Pu(){if(this.path)for(let e=0;e<this.path.length;e++)this.Au(this.path.get(e))}Au(e){if(e.length===0)throw this.mu("Document fields must not be empty");if(lv(this.Iu)&&QT.test(e))throw this.mu('Document fields cannot begin and end with "__"')}},rd=class{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer
33=n||no(e)}pu(e,t,n,i=!1){return new pu({Iu:e,methodName:t,gu:n,path:Te.emptyPath(),du:!1,fu:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function vn(r){let e=r._freezeSettings(),t=no(r._databaseId);return new rd(r._databaseId,!!e.ignoreUndefinedProperties,t)}function Su(r,e,t,n,i,s={}){let o=r.pu(s.merge||s.mergeFields?2:0,e,t,i);Gd("Data must be an object, but it was:",o,n);let a=fv(n,o),u,c;if(s.merge)u=new ot(o.fieldMask),c=o.fieldTransforms;else if(s.mergeFields){let l=[];for(let h of s.mergeFields){let d=ad(e,h,t);if(!o.contains(d))throw new C(A.INVALID_ARGUMENT,`Field '${d}' is specified in your field mask but missing from your input data.`);mv(l,d)||l.push(d)}u=new ot(l),c=o.fieldTransforms.filter(h=>u.covers(h.field))}else u=null,c=o.fieldTransforms;return new td(new Ke(a),u,c)}var Js=class r extends Jt{_toFieldTransform(e){if(e.Iu!==2)throw e.Iu===1?e.mu(`${this._methodName}() can only appear at the top level of your update data`):e.mu(`${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 hv(r,e,t){return new pu({Iu:3,gu:e.settings.gu,methodName:r._methodName,du:t},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}var nd=class r extends Jt{_toFieldTransform(e){return new hn(e.path,new Sr)}isEqual(e){return e instanceof r}},id=class extends Jt{constructor(e,t){super(e),this.yu=t}_toFieldTransform(e){let t=hv(this,e,!0),n=this.yu.map(s=>wn(s,t)),i=new Ht(n);return new hn(e.path,i)}isEqual(e){return this===e}},sd=class extends Jt{constructor(e,t){super(e),this.yu=t}_toFieldTransform(e){let t=hv(this,e,!0),n=this.yu.map(s=>wn(s,t)),i=new Yt(n);return new hn(e.path,i)}isEqual(e){return this===e}},od=class extends Jt{constructor(e,t){super(e),this.wu=t}_toFieldTransform(e){let t=new Ar(e.serializer,X_(e.serializer,this.wu));return new hn(e.path,t)}isEqual(e){return this===e}};function zd(r,e,t,n){let i=r.pu(1,e,t);Gd("Data must be an object, but it was:",i,n);let s=[],o=Ke.empty();yn(n,(u,c)=>{let l=Wd(e,u,t);c=me(c);let h=i.Ru(l);if(c instanceof Js)s.push(l);else{let d=wn(c,h);d!=null&&(s.push(l),o.set(l,d))}});let a=new ot(s);return new fu(o,a,i.fieldTransforms)}function Kd(r,e,t,n,i,s){let o=r.pu(1,e,t),a=[ad(e,n,t)],u=[i];if(s.length%2!=0)throw new C(A.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let d=0;d<s.length;d+=2)a.push(ad(e,s[d])),u.push(s[d+1]);let c=[],l=Ke.empty();for(let d=a.length-1;d>=0;--d)if(!mv(c,a[d])){let m=a[d],w=u[d];w=me(w);let T=o.Ru(m);if(w instanceof Js)c.push(m);else{let E=wn(w,T);E!=null&&(c.push(m),l.set(m,E))}}let h=new ot(c);return new fu(l,h,o.fieldTransforms)}function dv(r,e,t,n=!1){return wn(t,r.pu(n?4:3,e))}function wn(r,e){if(pv(r=me(r)))return Gd("Unsupported field value:",e,r),fv(r,e);if(r instanceof Jt)return function(n,i){if(!lv(i.Iu))throw i.mu(`${n._methodName}() can only be used with update() and set()`);if(!i.path)throw i.mu(`${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.du&&e.Iu!==4)throw e.mu("Nested arrays are not supported");return function(n,i){let s=[],o=0;for(let a of n){let u=wn(a,i.Vu(o));u==null&&(u={nullValue:"NULL_VALUE"}),s.push(u),o++}return{arrayValue:{values:s}}}(r,e)}return function(n,i){if((n=me(n))===null)return{nullValue:"NULL_VALUE"};if(typeof n=="number")return X_(i.serializer,n);if(typeof n=="boolean")return{booleanValue:n};if(typeof n=="string")return{stringValue:n};if(n instanceof Date){let s=ge.fromDate(n);return{timestampValue:fi(i.serializer,s)}}if(n instanceof ge){let s=new ge(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:fi(i.serializer,s)}}if(n instanceof mn)return{geoPointValue:{latitude:n.latitude,longitude:n.longitude}};if(n instanceof Mt)return{bytesValue:uy(i.serializer,n._byteString)};if(n instanceof ue){let s=i.databaseId,o=n.firestore._databaseId;if(!o.isEqual(s))throw i.mu(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:wd(n.firestore._databaseId||i.databaseId,n._key.path)}}throw i.mu(`Unsupported field value: ${bu(n)}`)}(r,e)}function fv(r,e){let t={};return V_(r)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):yn(r,(n,i)=>{let s=wn(i,e.Eu(n));s!=null&&(t[n]=s)}),{mapValue:{fields:t}}}function pv(r){return!(typeof r!="object"||r===null||r instanceof Array||r instanceof Date||r instanceof ge||r instanceof mn||r instanceof Mt||r instanceof ue||r instanceof Jt)}function Gd(r,e,t){if(!pv(t)||!function(i){return typeof i=="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Ob
vendor: 11,484 bytes, line 33
33ject.getPrototypeOf(i)===null)}(t)){let n=bu(t);throw n==="an object"?e.mu(r+" a custom object"):e.mu(r+" "+n)}}function ad(r,e,t){if((e=me(e))instanceof wt)return e._internalPath;if(typeof e=="string")return Wd(r,e);throw mu("Field path arguments must be of type string or ",r,!1,void 0,t)}var HT=new RegExp("[~\\*/\\[\\]]");function Wd(r,e,t){if(e.search(HT)>=0)throw mu(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,r,!1,void 0,t);try{return new wt(...e.split("."))._internalPath}catch{throw mu(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,r,!1,void 0,t)}}function mu(r,e,t,n,i){let s=n&&!n.isEmpty(),o=i!==void 0,a=`Function ${e}() called with invalid data`;t&&(a+=" (via `toFirestore()`)"),a+=". ";let u="";return(s||o)&&(u+=" (found",s&&(u+=` in field ${n}`),o&&(u+=` in document ${i}`),u+=")"),new C(A.INVALID_ARGUMENT,a+r+u)}function mv(r,e){return r.some(t=>t.isEqual(e))}var gn=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 ud(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(Au("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}},ud=class extends gn{data(){return super.data()}};function Au(r,e){return typeof e=="string"?Wd(r,e):e instanceof wt?e._internalPath:e._delegate._internalPath}function gv(r){if(r.limitType==="L"&&r.explicitOrderBy.length===0)throw new C(A.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var Xs=class{},_n=class extends Xs{};function er(r,e,...t){let n=[];e instanceof Xs&&n.push(e),n=n.concat(t),function(s){let o=s.filter(u=>u instanceof cd).length,a=s.filter(u=>u instanceof gu).length;if(o>1||o>0&&a>0)throw new C(A.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(n);for(let i of n)r=i._apply(r);return r}var gu=class r extends _n{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new r(e,t,n)}_apply(e){let t=this._parse(e);return Av(e._query,t),new Be(e.firestore,e.converter,jl(e._query,t))}_parse(e){let t=vn(e.firestore);return function(s,o,a,u,c,l,h){let d;if(c.isKeyField()){if(l==="array-contains"||l==="array-contains-any")throw new C(A.INVALID_ARGUMENT,`Invalid Query. You can't perform '${l}' queries on documentId().`);if(l==="in"||l==="not-in"){E_(h,l);let m=[];for(let w of h)m.push(I_(u,s,w));d={arrayValue:{values:m}}}else d=I_(u,s,h)}else l!=="in"&&l!=="not-in"&&l!=="array-contains-any"||E_(h,l),d=dv(a,o,h,l==="in"||l==="not-in");return Y.create(c,l,d)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}};function _v(r,e,t){let n=e,i=Au("where",r);return gu._create(i,n,t)}var cd=class r extends Xs{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new r(e,t)}_parse(e){let t=this._queryConstraints.map(n=>n._parse(e)).filter(n=>n.getFilters().length>0);return t.length===1?t[0]:ne.create(t,this._getOperator())}_apply(e){let t=this._parse(e);return t.getFilters().length===0?e:(function(i,s){let o=i,a=s.getFlattenedFilters();for(let u of a)Av(o,u),o=jl(o,u)}(e._query,t),new Be(e.firestore,e.converter,jl(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}};var ld=class r extends _n{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new r(e,t)}_apply(e){let t=function(i,s,o){if(i.startAt!==null)throw new C(A.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new C(A.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new cn(s,o)}(e._query,this._field,this._direction);return new Be(e.firestore,e.converter,function(i,s){let o=i.explicitOrderBy.concat([s]);return new yt(i.path,i.collectionGroup,o,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)}(e._query,t))}};function yv(r,e="asc"){let t=e,n=Au("orderBy",r);return ld._create(n,t)}var _u=class r extends _n{constructor(e,t,n){super(),this.type=e,this._limit=t,this._limitType=n}static _create(e,t,n){return new r(e,t,n)}_apply(e){return new Be(e.firestore,e.converter,Fa(e._query,this._limit,this._limitType))}};function vv(r){return Hy("limit",r),_u._create("limit",r,"F")}function wv(r){return Hy("limitToLast",r),_u._create("limitToLast",r,"L")}var yu=class r extends _n{constructor(e,t,n){super(),this.type=e,this._docOrFields=t,this._inclusive=n}static _create(e,t,n){return new r(e,t,n)}_apply(e){let t=Sv(e,this.type,this._docOrFields,this._inclusive);return new Be(e.firestore,e.converter,function(i,s){return new yt(i.path,i.collectionGroup,i.explicitOrderBy.slice(),i.filters.slice(),i.limit,i.limitType,s,i.endAt)}(e._query,t))}};function Iv(...r){return yu._create("startAt",r,!0)}function Ev(...r){return yu._create("startAfter",r,!1)}var vu=class r extends _n{constructor(e,t,n){super(),this.type=e,this._docOrFields=t,this._inclusive=n}static _create(e,t,n){return new r(e,t,n)}_apply(e){let t=Sv(e,this.type,this._docOrFields,this._inclusive);return new Be(e.firestore,e.converter,function(i,s){return new yt(i.path,i.collectionGroup,i.explicitOrderBy.slice(),i.filters.slice(),i.limit,i.limitType,i.startAt,s)}(e._query,t))}};function Tv(...r){return vu._create("endBefore",r,!1)}function bv(...r){return vu._create("endAt",r,!0)}function Sv(r,e,t,n){if(t[0]=me(t[0]),t[0]instanceof gn)return function(s,o,a,u,c){if(!u)throw new C(A.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${a}().`);let l=[];for(let h of si(s))if(h.field.isKeyField())l.push(un(o,u.key));else{let d=u.data.field(h.field);if(Iu(d))throw new C(A.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+h.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(d===null){let m=h.field.canonicalString();throw new C(A.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${m}' (used as the orderBy) does not exist.`)}l.push(d)}return new Ot(l,c)}(r._query,r.firestore._databaseId,e,t[0]._document,n);{let i=vn(r.firestore);return function(o,a,u,c,l,h){let d=o.explicitOrderBy;if(l.length>d.length)throw new C(A.INVALID_ARGUMENT,`Too many arguments provided to ${c}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);let m=[];for(let w=0;w<l.length;w++){let T=l[w];if(d[w].field.isKeyField()){if(typeof T!="string")throw new C(A.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${c}(), but got a ${typeof T}`);if(!yd(o)&&T.indexOf("/")!==-1)throw new C(A.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${c}() must be a plain document ID, but '${T}' contains a slash.`);let E=o.path.child(ee.fromString(T));if(!R.isDocumentKey(E))throw new C(A.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${c}() must result in a valid document path, but '${E}' is not because it contains an odd number of segments.`);let I=new R(E);m.push(un(a,I))}else{let E=dv(u,c,T);m.push(E)}}return new Ot(m,h)}(r._query,r.firestore._databaseId,i,e,t,n)}}function I_(r,e,t){if(typeof(t=me(t))=="string"){if(t==="")throw new C(A.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!yd(e)&&t.indexOf("/")!==-1)throw new C(A.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);let n=e.path.child(ee.fromString(t));if(!R.isDocumentKey(n))throw new C(A.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${n}' is not because it has an odd number of segments (${n.length}).`);return un(r,new R(n))}if(t instanceof ue)return un(r,t._key);throw new C(A.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${bu(t)}.`)}function E_(r,e){if(!Array.isArray(r)||r.length===0)throw new C(A.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function Av(r,e){let t=function(i,s){for(let o of i)for(let a of o.getFlattenedFilters())if(s.indexOf(a.op)>=0)return a.op;return null}(r.filters,function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(t!==null)throw t===e.op?new C(A.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new C(A.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}var Ei=class{convertValue(e,t="none"){switch(an(e)){case 0:return null;case 1:return e.booleanValue;case 2:return we(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(Er(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 10:return this.convertObject(e.mapValue,t);default:throw V()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){let n={};return yn(e,(i,s)=>{n[i]=this.convertValue(s,t)}),n}convertGeoPoint(e){return new mn(we(e.latitude),we(e.longitude))}convertArray(e,t){return(e.values||[]).map(n=>this.convertValue(n,t))}convertServerTimestamp(e,t){switch(t){case"previous":let n=gd(e);return n==null?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Ds(e));default:return null}}convertTimestamp(e){let t=Ir(e);return new ge(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=ee.fromString(e);O(yy(n));let i=new Tr(n.get(1),n.get(3)),s=new R(n.popFirst(5));return i.isEqual(t)||Ee(`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}};function ku(r,e,t){let n;return n=r?t&&(t.merge||t.mergeFields)?r.toFirestore(e,t):r.toFirestore(e):e,n}var hd=class extends Ei{constructor(e){super(),this.firestore=e}convertBytes(e){return new Mt(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);
33return new ue(this.firestore,null,t)}};var Qt=class{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},dt=class extends gn{constructor(e,t,n,i,s,o){super(e,t,n,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new yr(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(Au("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}},yr=class extends dt{data(e={}){return super.data(e)}},It=class{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new Qt(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 yr(this._firestore,this._userDataWriter,n.key,n,new Qt(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 C(A.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 o=0;return i._snapshot.docChanges.map(a=>{let u=new yr(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Qt(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);return a.doc,{type:"added",doc:u,oldIndex:-1,newIndex:o++}})}{let o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(a=>s||a.type!==3).map(a=>{let u=new yr(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Qt(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter),c=-1,l=-1;return a.type!==0&&(c=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),l=o.indexOf(a.doc.key)),{type:YT(a.type),doc:u,oldIndex:c,newIndex:l}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}};function YT(r){switch(r){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return V()}}function Qd(r,e){return r instanceof dt&&e instanceof dt?r._firestore===e._firestore&&r._key.isEqual(e._key)&&(r._document===null?e._document===null:r._document.isEqual(e._document))&&r._converter===e._converter:r instanceof It&&e instanceof It&&r._firestore===e._firestore&&$d(r.query,e.query)&&r.metadata.isEqual(e.metadata)&&r._snapshot.isEqual(e._snapshot)}function kv(r){r=X(r,ue);let e=X(r.firestore,fe);return Gy(Re(e),r._key).then(t=>Xd(e,r,t))}var Xt=class extends Ei{constructor(e){super(),this.firestore=e}convertBytes(e){return new Mt(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);return new ue(this.firestore,null,t)}};function Pv(r){r=X(r,ue);let e=X(r.firestore,fe),t=Re(e),n=new Xt(e);return $T(t,r._key).then(i=>new dt(e,n,r._key,i,new Qt(i!==null&&i.hasLocalMutations,!0),r.converter))}function Cv(r){r=X(r,ue);let e=X(r.firestore,fe);return Gy(Re(e),r._key,{source:"server"}).then(t=>Xd(e,r,t))}function xv(r){r=X(r,Be);let e=X(r.firestore,fe),t=Re(e),n=new Xt(e);return gv(r._query),Wy(t,r._query).then(i=>new It(e,n,r,i))}function Rv(r){r=X(r,Be);let e=X(r.firestore,fe),t=Re(e),n=new Xt(e);return zT(t,r._query).then(i=>new It(e,n,r,i))}function Dv(r){r=X(r,Be);let e=X(r.firestore,fe),t=Re(e),n=new Xt(e);return Wy(t,r._query,{source:"server"}).then(i=>new It(e,n,r,i))}function Hd(r,e,t){r=X(r,ue);let n=X(r.firestore,fe),i=ku(r.converter,e,t);return Ci(n,[Su(vn(n),"setDoc",r._key,i,r.converter!==null,t).toMutation(r._key,Ie.none())])}function Yd(r,e,t,...n){r=X(r,ue);let i=X(r.firestore,fe),s=vn(i),o;return o=typeof(e=me(e))=="string"||e instanceof wt?Kd(s,"updateDoc",r._key,e,t,n):zd(s,"updateDoc",r._key,e),Ci(i,[o.toMutation(r._key,Ie.exists(!0))])}function Nv(r){return Ci(X(r.firestore,fe),[new Pr(r._key,Ie.none())])}function Vv(r,e){let t=X(r.firestore,fe),n=so(r),i=ku(r.converter,e);return Ci(t,[Su(vn(r.firestore),"addDoc",n._key,i,r.converter!==null,{}).toMutation(n._key,Ie.exists(!1))]).then(()=>n)}function Jd(r,...e){var t,n,i;r=me(r);let s={includeMetadataChanges:!1},o=0;typeof e[o]!="object"||Zh(e[o])||(s=e[o],o++);let a={includeMetadataChanges:s.includeMetadataChanges};if(Zh(e[o])){let h=e[o];e[o]=(t=h.next)===null||t===void 0?void 0:t.bind(h),e[o+1]=(n=h.error)===null||n===void 0?void 0:n.bind(h),e[o+2]=(i=h.complete)===null||i===void 0?void 0:i.bind(h)}let u,c,l;if(r instanceof ue)c=X(r.firestore,fe),l=bi(r._key.path),u={next:h=>{e[o]&&e[o](Xd(c,r,h))},error:e[o+1],complete:e[o+2]};else{let h=X(r,Be);c=X(h.firestore,fe),l=h._query;let d=new Xt(c);u={next:m=>{e[o]&&e[o](new It(c,d,h,m))},error:e[o+1],complete:e[o+2]},gv(r._query)}return function(d,m,w,T){let E=new wi(T),I=new Qs(m,E,w);return d.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){return kd(yield Ii(d),I)})),()=>{E.Na(),d.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){return Pd(yield Ii(d),I)}))}}(Re(c),l,a,u)}function Ov(r,e){return KT(Re(r=X(r,fe)),Zh(e)?e:{next:e})}function Ci(r,e){return function(n,i){let s=new Pe;return n.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){return bT(yield Ld(n),i,s)})),s.promise}(Re(r),e)}function Xd(r,e,t){let n=t.docs.get(e._key),i=new Xt(r);return new dt(r,i,e._key,n,new Qt(t.hasPendingWrites,t.fromCache),e.converter)}var JT={maxAttempts:5};var wu=class{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=vn(e)}set(e,t,n){this._verifyNotCommitted();let i=gr(e,this._firestore),s=ku(i.converter,t,n),o=Su(this._dataReader,"WriteBatch.set",i._key,s,i.converter!==null,n);return this._mutations.push(o.toMutation(i._key,Ie.none())),this}update(e,t,n,...i){this._verifyNotCommitted();let s=gr(e,this._firestore),o;return o=typeof(t=me(t))=="string"||t instanceof wt?Kd(this._dataReader,"WriteBatch.update",s._key,t,n,i):zd(this._dataReader,"WriteBatch.update",s._key,t),this._mutations.push(o.toMutation(s._key,Ie.exists(!0))),this}delete(e){this._verifyNotCommitted();let t=gr(e,this._firestore);return this._mutations=this._mutations.concat(new Pr(t._key,Ie.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new C(A.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}};function gr(r,e){if((r=me(r)).firestore!==e)throw new C(A.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return r}var dd=class extends class{constructor(t,n){this._firestore=t,this._transaction=n,this._dataReader=vn(t)}get(t){let n=gr(t,this._firestore),i=new hd(this._firestore);return this._transaction.lookup([n._key]).then(s=>{if(!s||s.length!==1)return V();let o=s[0];if(o.isFoundDocument())return new gn(this._firestore,i,o.key,o,n.converter);if(o.isNoDocument())return new gn(this._firestore,i,n._key,null,n.converter);throw V()})}set(t,n,i){let s=gr(t,this._firestore),o=ku(s.converter,n,i),a=Su(this._dataReader,"Transaction.set",s._key,o,s.c
33onverter!==null,i);return this._transaction.set(s._key,a),this}update(t,n,i,...s){let o=gr(t,this._firestore),a;return a=typeof(n=me(n))=="string"||n instanceof wt?Kd(this._dataReader,"Transaction.update",o._key,n,i,s):zd(this._dataReader,"Transaction.update",o._key,n),this._transaction.update(o._key,a),this}delete(t){let n=gr(t,this._firestore);return this._transaction.delete(n._key),this}}{constructor(e,t){super(e,t),this._firestore=e}get(e){let t=gr(e,this._firestore),n=new Xt(this._firestore);return super.get(e).then(i=>new dt(this._firestore,n,t._key,i._document,new Qt(!1,!1),t.converter))}};function Fv(r,e,t){r=X(r,fe);let n=Object.assign(Object.assign({},JT),t);return function(s){if(s.maxAttempts<1)throw new C(A.INVALID_ARGUMENT,"Max attempts must be at least 1")}(n),function(s,o,a){let u=new Pe;return s.asyncQueue.enqueueAndForget(()=>S(this,null,function*(){let c=yield UT(s);new Hh(s.asyncQueue,c,a,o,u).run()})),u.promise}(Re(r),i=>e(new dd(r,i)),n)}function Mv(){return new Js("deleteField")}function Lv(){return new nd("serverTimestamp")}function qv(...r){return new id("arrayUnion",r)}function Uv(...r){return new sd("arrayRemove",r)}function Bv(r){return new od("increment",r)}(function(e,t=!0){(function(i){Ti=i})(pp),Ki(new jr("firestore",(n,{instanceIdentifier:i,options:s})=>{let o=n.getProvider("app").getImmediate(),a=new fe(new vl(n.getProvider("auth-internal")),new Tl(n.getProvider("app-check-internal")),function(c,l){if(!Object.prototype.hasOwnProperty.apply(c.options,["projectId"]))throw new C(A.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Tr(c.options.projectId,l)}(o,i),o);return s=Object.assign({useFetchStreams:t},s),a._setSettings(s),a},"PUBLIC").setMultipleInstances(!0)),ar(bg,"4.4.0",e),ar(bg,"4.4.0","esm2017")})();var XT="@firebase/firestore-compat",ZT="0.3.23";function sf(r,e){if(e===void 0)return{merge:!1};if(e.mergeFields!==void 0&&e.merge!==void 0)throw new C("invalid-argument",`Invalid options passed to function ${r}(): You cannot specify both "merge" and "mergeFields".`);return e}function jv(){if(typeof Uint8Array>"u")throw new C("unimplemented","Uint8Arrays are not available in this environment.")}function $v(){if(!O_())throw new C("unimplemented","Blobs are unavailable in Firestore in this environment.")}
33var Pu=class r{constructor(e){this._delegate=e}static fromBase64String(e){return $v(),new r(Mt.fromBase64String(e))}static fromUint8Array(e){return jv(),new r(Mt.fromUint8Array(e))}toBase64(){return $v(),this._delegate.toBase64()}toUint8Array(){return jv(),this._delegate.toUint8Array()}isEqual(e){return this._delegate.isEqual(e._delegate)}toString(){return"Blob(base64: "+this.toBase64()+")"}};function Zd(r){return eb(r,["next","error","complete"])}function eb(r,e){if(typeof r!="object"||r===null)return!1;let t=r;for(let n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}var ef=class{enableIndexedDbPersistence(e,t){return ev(e._delegate,{forceOwnership:t})}enableMultiTabIndexedDbPersistence(e){return tv(e._delegate)}clearIndexedDbPersistence(e){return nv(e._delegate)}},Cu=class{constructor(e,t,n){this._delegate=t,this._persistenceProvider=n,this.INTERNAL={delete:()=>this.terminate()},e instanceof Tr||(this._appCompat=e)}get _databaseId(){return this._delegate._databaseId}settings(e){let t=this._delegate._getSettings();!e.merge&&t.host!==e.host&&lt("You are overriding the original host. If you did not intend to override your settings, use {merge: true}."),e.merge&&(e=Object.assign(Object.assign({},t),e),delete e.merge),this._delegate._setSettings(e)}useEmulator(e,t,n={}){Yy(this._delegate,e,t,n)}enableNetwork(){return sv(this._delegate)}disableNetwork(){return ov(this._delegate)}enablePersistence(e){let t=!1,n=!1;return e&&(t=!!e.synchronizeTabs,n=!!e.experimentalForceOwningTab,Ud("synchronizeTabs",t,"experimentalForceOwningTab",n)),t?this._persistenceProvider.enableMultiTabIndexedDbPersistence(this):this._persistenceProvider.enableIndexedDbPersistence(this,n)}clearPersistence(){return this._persistenceProvider.clearIndexedDbPersistence(this)}terminate(){return this._appCompat&&(this._appCompat._removeServiceInstance("firestore-compat"),this._appCompat._removeServiceInstance("firestore")),this._delegate._delete()}waitForPendingWrites(){return iv(this._delegate)}onSnapshotsInSync(e){return Ov(this._delegate,e)}get app(){if(!this._appCompat)throw new C("failed-precondition","Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._appCompat}collection(e){try{return new Di(this,Bd(this._delegate,e))}catch(t){throw Ze(t,"collection()","Firestore.collection()")}}doc(e){try{return new Lt(this,so(this._delegate,e))}catch(t){throw Ze(t,"doc()","Firestore.doc()")}}collectionGroup(e){try{return new bn(this,Jy(this._delegate,e))}catch(t){throw Ze(t,"collectionGroup()","Firestore.collectionGroup()")}}runTransaction(e){return Fv(this._delegate,t=>e(new xu(this,t)))}batch(){return Re(this._delegate),new Ru(new wu(this._delegate,e=>Ci(this._delegate,e)))}loadBundle(e){return av(this._delegate,e)}namedQuery(e){return uv(this._delegate,e).then(t=>t?new bn(this,t):null)}},xi=class extends Ei{constructor(e){super(),this.firestore=e}convertBytes(e){return new Pu(new Mt(e))}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);return Lt.forKey(t,this.firestore,null)}};function tb(r){T_(r)}var xu=class{constructor(e,t){this._firestore=e,this._delegate=t,this._userDataWriter=new xi(e)}get(e){let t=In(e);return this._delegate.get(t).then(n=>new En(this._firestore,new dt(this._firestore._delegate,this._userDataWriter,n._key,n._document,n.metadata,t.converter)))}set(e,t,n){let i=In(e);return n?(sf("Transaction.set",n),this._delegate.set(i,t,n)):this._delegate.set(i,t),this}update(e,t,n,...i){let s=In(e);return arguments.length===2?this._delegate.update(s,t):this._delegate.update(s,t,n,...i),this}delete(e){let t=In(e);return this._delegate.delete(t),this}},Ru=class{constructor(e){this._delegate=e}set(e,t,n){let i=In(e);return n?(sf("WriteBatch.set",n),this._delegate.set(i,t,n)):this._delegate.set(i,t),this}update(e,t,n,...i){let s=In(e);return arguments.length===2?this._delegate.update(s,t):this._delegate.update(s,t,n,...i),this}delete(e){let t=In(e);return this._delegate.delete(t),this}commit(){return this._delegate.commit()}},Ri=class r{constructor(e,t,n){this._firestore=e,this._userDataWriter=t,this._delegate=n}fromFirestore(e,t){let n=new yr(this._firestore._delegate,this._userDataWriter,e._key,e._document,e.metadata,null);
33return this._delegate.fromFirestore(new Tn(this._firestore,n),t??{})}toFirestore(e,t){return t?this._delegate.toFirestore(e,t):this._delegate.toFirestore(e)}static getInstance(e,t){let n=r.INSTANCES,i=n.get(e);i||(i=new WeakMap,n.set(e,i));let s=i.get(t);return s||(s=new r(e,new xi(e),t),i.set(t,s)),s}};Ri.INSTANCES=new WeakMap;var Lt=class r{constructor(e,t){this.firestore=e,this._delegate=t,this._userDataWriter=new xi(e)}static forPath(e,t,n){if(e.length%2!==0)throw new C("invalid-argument",`Invalid document reference. Document references must have an even number of segments, but ${e.canonicalString()} has ${e.length}`);return new r(t,new ue(t._delegate,n,new R(e)))}static forKey(e,t,n){return new r(t,new ue(t._delegate,n,e))}get id(){return this._delegate.id}get parent(){return new Di(this.firestore,this._delegate.parent)}get path(){return this._delegate.path}collection(e){try{return new Di(this.firestore,Bd(this._delegate,e))}catch(t){throw Ze(t,"collection()","DocumentReference.collection()")}}isEqual(e){return e=me(e),e instanceof ue?jd(this._delegate,e):!1}set(e,t){t=sf("DocumentReference.set",t);try{return t?Hd(this._delegate,e,t):Hd(this._delegate,e)}catch(n){throw Ze(n,"setDoc()","DocumentReference.set()")}}update(e,t,...n){try{return arguments.length===1?Yd(this._delegate,e):Yd(this._delegate,e,t,...n)}catch(i){throw Ze(i,"updateDoc()","DocumentReference.update()")}}delete(){return Nv(this._delegate)}onSnapshot(...e){let t=zv(e),n=Kv(e,i=>new En(this.firestore,new dt(this.firestore._delegate,this._userDataWriter,i._key,i._document,i.metadata,this._delegate.converter)));return Jd(this._delegate,t,n)}get(e){let t;return e?.source==="cache"?t=Pv(this._delegate):e?.source==="server"?t=Cv(this._delegate):t=kv(this._delegate),t.then(n=>new En(this.firestore,new dt(this.firestore._delegate,this._userDataWriter,n._key,n._document,n.metadata,this._delegate.converter)))}withConverter(e){return new r(this.firestore,e?this._delegate.withConverter(Ri.getInstance(this.firestore,e)):this._delegate.withConverter(null))}};function Ze(r,e,t){return r.message=r.message.replace(e,t),r}function zv(r){for(let e of r)if(typeof e=="object"&&!Zd(e))return e;return{}}function Kv(r,e){var t,n;let i;return Zd(r[0])?i=r[0]:Zd(r[1])?i=r[1]:typeof r[0]=="function"?i={next:r[0],error:r[1],complete:r[2]}:i={next:r[1],error:r[2],complete:r[3]},{next:s=>{i.next&&i.next(e(s))},error:(t=i.error)===null||t===void 0?void 0:t.bind(i),complete:(n=i.complete)===null||n===void 0?void 0:n.bind(i)}}var En=class{constructor(e,t){this._firestore=e,this._delegate=t}get ref(){return new Lt(this._firestore,this._delegate.ref)}get id(){return this._delegate.id}get metadata(){return this._delegate.metadata}get exists(){return this._delegate.exists()}data(e){return this._delegate.data(e)}get(e,t){return this._delegate.get(e,t)}isEqual(e){return Qd(this._delegate,e._delegate)}},Tn=class extends En{data(e){let t=this._delegate.data(e);return this._delegate._converter||b_(t!==void 0,"Document in a QueryDocumentSnapshot should exist"),t}},bn=class r{constructor(e,t){this.firestore=e,this._delegate=t,this._userDataWriter=new xi(e)}where(e,t,n){try{return new r(this.firestore,er(this._delegate,_v(e,t,n)))}catch(i){throw Ze(i,/(orderBy|where)\(\)/,"Query.$1()")}}orderBy(e,t){try{return new r(this.firestore,er(this._delegate,yv(e,t)))}catch(n){throw Ze(n,/(orderBy|where)\(\)/,"Query.$1()")}}limit(e){try{return new r(this.firestore,er(this._delegate,vv(e)))}catch(t){throw Ze(t,"limit()","Query.limit()")}}limitToLast(e){try{return new r(this.firestore,er(this._delegate,wv(e)))}catch(t){throw Ze(t,"limitToLast()","Query.limitToLast()")}}startAt(...e){try{return new r(this.firestore,er(this._delegate,Iv(...e)))}catch(t){throw Ze(t,"startAt()","Query.startAt()")}}startAfter(...e){try{return new r(this.firestore,er(this._delegate,Ev(...e)))}catch(t){throw Ze(t,"startAfter()","Query.startAfter()")}}endBefore(...e){try{return new r(this.firestore,er(this._delegate,Tv(...e)))}catch(t){throw Ze(t,"endBefore()","Query.endBefore()")}}endAt(...e){try{return new r(this.firestore,er(this._delegate,bv(...e)))}catch(t){throw Ze(t,"endAt()","Query.endAt()")}}isEqual(e){return $d(this._delegate,e._delegate)}get(e){let t;return e?.source==="cache"?t=Rv(this._delegate):e?.source==="server"?t=Dv(this._delegate):t=xv(this._delegate),t.then(n=>
33new oo(this.firestore,new It(this.firestore._delegate,this._userDataWriter,this._delegate,n._snapshot)))}onSnapshot(...e){let t=zv(e),n=Kv(e,i=>new oo(this.firestore,new It(this.firestore._delegate,this._userDataWriter,this._delegate,i._snapshot)));return Jd(this._delegate,t,n)}withConverter(e){return new r(this.firestore,e?this._delegate.withConverter(Ri.getInstance(this.firestore,e)):this._delegate.withConverter(null))}},tf=class{constructor(e,t){this._firestore=e,this._delegate=t}get type(){return this._delegate.type}get doc(){return new Tn(this._firestore,this._delegate.doc)}get oldIndex(){return this._delegate.oldIndex}get newIndex(){return this._delegate.newIndex}},oo=class{constructor(e,t){this._firestore=e,this._delegate=t}get query(){return new bn(this._firestore,this._delegate.query)}get metadata(){return this._delegate.metadata}get size(){return this._delegate.size}get empty(){return this._delegate.empty}get docs(){return this._delegate.docs.map(e=>new Tn(this._firestore,e))}docChanges(e){return this._delegate.docChanges(e).map(t=>new tf(this._firestore,t))}forEach(e,t){this._delegate.forEach(n=>{e.call(t,new Tn(this._firestore,n))})}isEqual(e){return Qd(this._delegate,e._delegate)}},Di=class r extends bn{constructor(e,t){super(e,t),this.firestore=e,this._delegate=t}get id(){return this._delegate.id}get path(){return this._delegate.path}get parent(){let e=this._delegate.parent;return e?new Lt(this.firestore,e):null}doc(e){try{return e===void 0?new Lt(this.firestore,so(this._delegate)):new Lt(this.firestore,so(this._delegate,e))}catch(t){throw Ze(t,"doc()","CollectionReference.doc()")}}add(e){return Vv(this._delegate,e).then(t=>new Lt(this.firestore,t))}isEqual(e){return jd(this._delegate,e._delegate)}withConverter(e){return new r(this.firestore,e?this._delegate.withConverter(Ri.getInstance(this.firestore,e)):this._delegate.withConverter(null))}};function In(r){return X(r,ue)}var rf=class r{constructor(...e){this._delegate=new wt(...e)}static documentId(){return new r(Te.keyField().canonicalString())}isEqual(e){return e=me(e),e instanceof wt?this._delegate._internalPath.isEqual(e._internalPath):!1}};
33var nf=class r{constructor(e){this._delegate=e}static serverTimestamp(){let e=Lv();return e._methodName="FieldValue.serverTimestamp",new r(e)}static delete(){let e=Mv();return e._methodName="FieldValue.delete",new r(e)}static arrayUnion(...e){let t=qv(...e);return t._methodName="FieldValue.arrayUnion",new r(t)}static arrayRemove(...e){let t=Uv(...e);return t._methodName="FieldValue.arrayRemove",new r(t)}static increment(e){let t=Bv(e);return t._methodName="FieldValue.increment",new r(t)}isEqual(e){return this._delegate.isEqual(e._delegate)}};var rb={Firestore:Cu,GeoPoint:mn,Timestamp:ge,Blob:Pu,Transaction:xu,WriteBatch:Ru,DocumentReference:Lt,DocumentSnapshot:En,Query:bn,QueryDocumentSnapshot:Tn,QuerySnapshot:oo,CollectionReference:Di,FieldPath:rf,FieldValue:nf,setLogLevel:tb,CACHE_SIZE_UNLIMITED:Xy};function nb(r,e){r.INTERNAL.registerComponent(new jr("firestore-compat",t=>{let n=t.getProvider("app-compat").getImmediate(),i=t.getProvider("firestore").getImmediate();return e(n,i)},"PUBLIC").setServiceProps(Object.assign({},rb)))}function ib(r){nb(r,(e,t)=>new Cu(e,t,new ef)),r.registerVersion(XT,ZT)}ib(Qe);function sb(r,e=go){return new Cn(t=>{let n;return e!=null?e.schedule(()=>{n=r.onSnapshot({includeMetadataChanges:!0},t)}):n=r.onSnapshot({includeMetadataChanges:!0},t),()=>{n?.()}})}function Gv(r,e){return sb(r,e)}function ob(r,e){return Gv(r,e).pipe(vo(void 0),_o(),se(t=>{let[n,i]=t;return i.exists?n?.exists?{payload:i,type:"modified"}:{payload:i,type:"added"}:{payload:i,type:"removed"}}))}function uf(r,e){return Gv(r,e).pipe(se(t=>({payload:t,type:"query"})))}var Du=class{ref;afs;constructor(e,t){this.ref=e,this.afs=t}set(e,t){return this.ref.set(e,t)}update(e){return this.ref.update(e)}delete(){return this.ref.delete()}collection(e,t){let n=this.ref.collection(e),{ref:i,query:s}=Jv(n,t);return new Vu(i,s,this.afs)}snapshotChanges(){return ob(this.ref,this.afs.schedulers.outsideAngular).pipe(tt)}valueChanges(e={}){return this.snapshotChanges().pipe(se(({payload:t})=>e.idField?nt(U({},t.data()),{[e.idField]:t.id}):t.data()))}get(e){return ir(this.ref.get(e)).pipe(tt)}};function Nu(r,e){return uf(r,e).pipe(vo(void 0),_o(),se(t=>{let[n,i]=t,s=i.payload.docChanges(),o=s.map(a=>({type:a.type,payload:a}));return n&&JSON.stringify(n.payload.metadata)!==JSON.stringify(i.payload.metadata)&&i.payload.docs.forEach((a,u)=>{let c=s.find(h=>h.doc.ref.isEqual(a.ref)),l=n?.payload.docs.find(h=>h.ref.isEqual(a.ref));c&&JSON.stringify(c.doc.metadata)===JSON.stringify(a.metadata)||!c&&l&&JSON.stringify(l.metadata)===JSON.stringify(a.metadata)||o.push({type:"modified",payload:{oldIndex:u,newIndex:u,type:"modified",doc:a}})}),o}))}function Wv(r,e,t){return Nu(r,t).pipe(yo((n,i)=>ab(n,i.map(s=>s.payload),e),[]),Yf(),se(n=>n.map(i=>({type:i.type,payload:i}))))}function ab(r,e,t){return e.forEach(n=>{t.indexOf(n.type)>-1&&(r=ub(r,n))}),r}function of(r,e,t,...n){let i=r.slice();return i.splice(e,t,...n),i}function ub(r,e){switch(e.type){case"added":if(!(r[e.newIndex]&&r[e.newIndex].doc.ref.isEqual(e.doc.ref)))return of(r,e.newIndex,0,e);break;case"modified":if(r[e.oldIndex]==null||r[e.oldIndex].doc.ref.isEqual(e.doc.ref))if(e.oldIndex!==e.newIndex){let t=r.slice();return t.splice(e.oldIndex,1),t.splice(e.newIndex,0,e),t}else return of(r,e.newIndex,1,e);break;case"removed":if(r[e.oldIndex]&&r[e.oldIndex].doc.ref.isEqual(e.doc.ref))return of(r,e.oldIndex,1);break}return r}function Qv(r){return(!r||r.length===0)&&(r=["added","removed","modified"]),r}var Vu=class{ref;query;afs;constructor(e,t,n){this.ref=e,this.query=t,this.afs=n}stateChanges(e){let t=Nu(this.query,this.afs.schedulers.outsideAngular);return e&&e.length>0&&(t=t.pipe(se(n=>n.filter(i=>e.indexOf(i.type)>-1)))),t.pipe(vo(void 0),_o(),zi(([n,i])=>i.length>0||!n),se(([,n])=>n),tt)}auditTrail(e){return this.stateChanges(e).pipe(yo((t,n)=>[...t,...n],[]))}snapshotChanges(e){let t=Qv(e);return Wv(this.query,t,this.afs.schedulers.outsideAngular).pipe(tt)}valueChanges(e={}){return uf(this.query,this.afs.schedulers.outsideAngular).pipe(se(t=>t.payload.docs.map(n=>e.idField?nt(U({},n.data()),{[e.idField]:n.id}):n.data())),tt)}get(e){return ir(this.query.get(e)).pipe(tt)}add(e){return this.ref.add(e)}doc(e){return new Du(this.ref.doc(e),this.afs)}},af=class{query;afs;constructor(e,t){this.query=e,this.afs=t}stateChanges(e){return!e||e.length===0?Nu(this.query,this.afs.schedulers.outsideAngular).pipe(tt):Nu(this.query,this.afs.schedulers.outsideAngular).pipe(se(t=>t.filter(n=>e.indexOf(n.type)>-1)),zi(t=>t.length>0),tt)}auditTrail(e){return this.stateChanges(e).pipe(yo((t,n)=>[...t,...n],[]))}
33snapshotChanges(e){let t=Qv(e);return Wv(this.query,t,this.afs.schedulers.outsideAngular).pipe(tt)}valueChanges(e={}){return uf(this.query,this.afs.schedulers.outsideAngular).pipe(se(n=>n.payload.docs.map(i=>e.idField?U({[e.idField]:i.id},i.data()):i.data())),tt)}get(e){return ir(this.query.get(e)).pipe(tt)}},Hv=new We("angularfire2.enableFirestorePersistence"),Yv=new We("angularfire2.firestore.persistenceSettings"),cb=new We("angularfire2.firestore.settings"),lb=new We("angularfire2.firestore.use-emulator");function Jv(r,e=t=>t){return{query:e(r),ref:r}}var ao=(()=>{class r{schedulers;firestore;persistenceEnabled$;constructor(t,n,i,s,o,a,u,c,l,h,d,m,w,T,E,I,v){this.schedulers=u;let p=Qi(t,a,n),g=l;h&&Ic(p,a,d,w,T,E,m,I),[this.firestore,this.persistenceEnabled$]=qo(`${p.name}.firestore`,"AngularFirestore",p.name,()=>{let _=a.runOutsideAngular(()=>p.firestore());if(s&&_.settings(s),g&&_.useEmulator(...g),i&&!On(o)){let y=()=>{try{return ir(_.enablePersistence(c||void 0).then(()=>!0,()=>!1))}catch(M){return typeof console<"u"&&console.warn(M),Z(!1)}};return[_,a.runOutsideAngular(y)]}else return[_,Z(!1)]},[s,g,i])}collection(t,n){let i;typeof t=="string"?i=this.firestore.collection(t):i=t;let{ref:s,query:o}=Jv(i,n),a=this.schedulers.ngZone.run(()=>s);return new Vu(a,o,this)}collectionGroup(t,n){let i=n||(o=>o),s=this.firestore.collectionGroup(t);return new af(i(s),this)}doc(t){let n;typeof t=="string"?n=this.firestore.doc(t):n=t;let i=this.schedulers.ngZone.run(()=>n);return new Du(i,this)}createId(){return this.firestore.collection("_").doc().id}static \u0275fac=function(n){return new(n||r)(P(Un),P(Bn,8),P(Hv,8),P(cb,8),P(sr),P(or),P(Fo),P(Yv,8),P(lb,8),P(Ec,8),P(mc,8),P(gc,8),P(_c,8),P(yc,8),P(vc,8),P(wc,8),P(Kr,8))};static \u0275prov=$({token:r,factory:r.\u0275fac,providedIn:"any"})}return r})(),W1=(()=>{class r{constructor(){Qe.registerVersion("angularfire",Gr.full,"fst-compat")}static enablePersistence(t){return{ngModule:r,providers:[{provide:Hv,useValue:!0},{provide:Yv,useValue:t}]}}static \u0275fac=function(n){return new(n||r)};static \u0275mod=Vn({type:r});static \u0275inj=Nn({providers:[ao]})}return r})();var hb=(()=>{let e=class e{constructor(n){this.afs=n,this.ROUTE_FIRESTORE="blackListedTV"}checkIfBlackListed(n){return this.afs.collection(this.ROUTE_FIRESTORE).doc(n).snapshotChanges().pipe(se(o=>o.payload.exists))}deleteTVFromBlackList(n){return this.afs.collection(this.ROUTE_FIRESTORE).doc(n).delete().then(s=>s)}};e.\u0275fac=function(i){return new(i||e)(P(ao))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var Zv=[].indexOf||function(r){for(let e=0,t=this.length;e<t;e++)if(e in this&&this[e]===r)return e;return-1},db=(()=>{let e=class e{constructor(){this.defaultFormat=/(\d{1,4})/g,this.cards=[{type:"visa",patterns:[4],format:this.defaultFormat,length:[13,16,19],cvcLength:[3],luhn:!0},{type:"mastercard",patterns:[2221,2222,2223,2224,2225,2226,2227,2228,2229,223,224,225,226,227,228,229,23,24,25,26,27,51,52,53,54,55],format:this.defaultFormat,length:[16],cvcLength:[3],luhn:!0},{type:"amex",patterns:[34,37],format:/(\d{1,4})(\d{1,6})?(\d{1,5})?/,length:[15],cvcLength:[3,4],luhn:!0},{type:"elo",patterns:[4011,4312,4389,4514,4576,5041,5066,5067,5090,6277,6362,6363,6500,6504,6505,6509,6516,6550,636368,636369,636297,504175,451416,506699],format:this.defaultFormat,length:[16],cvcLength:[3],luhn:!0},{type:"hipercard",patterns:[384100,384140,384160,606282,637095,637568,637599,637609,637612],format:this.defaultFormat,length:[13,16,19],cvcLength:[3],luhn:!0},{type:"aura",patterns:[50],format:this.defaultFormat,length:[19],cvcLength:[3],luhn:!0},{type:"dinersclub",patterns:[36,300,301,302,303,304,305,3095,38,39],format:/(\d{1,4})(\d{1,6})?(\d{1,4})?/,length:[16,17,18,19],cvcLength:[3],luhn:!0},{type:"discover",patterns:[6011,644,645,646,647,648,649,65,622126,622127,622128,622129,622,623,624,625],format:this.defaultFormat,length:[16,17,18,19],cvcLength:[3],luhn:!0},{type:"jcb",patterns:[3528,3529,353,354,355,356,357,358],format:this.defaultFormat,length:[16,17,18,19],cvcLength:[3],luhn:!0},{type:"maestro",patterns:[5018,5020,5038,5893,6304,6759,6761,6762,6763,502,503,506,56,58,639,6220,67],format:this.defaultFormat,length:[12,13,14,15,16,17,18,19],cvcLength:[3],luhn:!0},{type:"unionpay",patterns:[62,88],format:this.defaultFormat,length:[16,17,18,19],cvcLength:[3],luhn:!1}
33,{type:"dankort",patterns:[5019,4571],format:this.defaultFormat,length:[16],cvcLength:[3],luhn:!0},{type:"forbrugsforeningen",patterns:[600],format:this.defaultFormat,length:[16],cvcLength:[3],luhn:!0}],this.cardFromNumber=n=>{let i,s,o,a,u,c,l,h;for(n=(n+"").replace(/\D/g,""),a=0,c=this.cards.length;a<c;a++)for(i=this.cards[a],h=i.patterns,u=0,l=h.length;u<l;u++)if(o=h[u],s=o+"",n.substr(0,s.length)===s)return i},this.cardFromType=n=>{let i,s,o;for(s=0,o=this.cards.length;s<o;s++)if(i=this.cards[s],i.type===n)return i},this.luhnCheck=n=>{let i,s=!0,o=0,a,u,c=(n+"").split("").reverse();for(a=0,u=c.length;a<u;a++)i=c[a],i=parseInt(i,10),(s=!s)&&(i*=2),i>9&&(i-=9),o+=i;return o%10===0},this.cardType=n=>{let i;return n&&((i=this.cardFromNumber(n))!==null?i?.type:void 0)||null},this.validateCardNumber=n=>{if(n=(n+"").replace(/\s+|-/g,""),!/^\d+$/.test(n))return!1;let i=this.cardFromNumber(n);if(!i)return!1;let s=n.length;return Zv.call(i.length,s)>=0&&(i.luhn===!1||this.luhnCheck(n))},this.validateCardCVC=(n,i)=>{let s;if(n=n.replace(/ /g,""),!/^\d+$/.test(n))return!1;let o=this.cardFromType(i);return o!==null?(s=n.length)&&Zv.call(o?.cvcLength,s)>=0:n.length>=3&&n.length<=4}}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();function Nr(r){return typeof r=="string"}function Ou(r){return typeof r=="number"}function Sn(r){return typeof r=="function"}function Et(r){return Object.prototype.toString.call(r).slice(8,-1).toLowerCase()==="object"}function fb(r){var e,t,n,i=(n=(t=(e=r.userId)!==null&&e!==void 0?e:r.anonymousId)!==null&&t!==void 0?t:r.groupId)!==null&&n!==void 0?n:r.previousId;return Nr(i)}var uo=function(r){bt(e,r);function e(t,n){var i=r.call(this,n)||this;return i.field=t,i}return e}(Error);function Ni(r){var e,t=r&&r.event&&r.event.type,n=r.event;if(n===void 0)throw new uo("event","Event is missing");if(!Nr(t))throw new uo("event","Event is not a string");if(t==="track"&&!Nr(n.event))throw new uo("event","Event is not a string");var i=(e=n.properties)!==null&&e!==void 0?e:n.traits;if(t!=="alias"&&!Et(i))throw new uo("properties","properties is not an object");if(!fb(n))throw new uo("userId","Missing userId or anonymousId");return r}var e0={name:"Event Validation",type:"before",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:Ni,identify:Ni,page:Ni,alias:Ni,group:Ni,screen:Ni};function t0(r,e,t,n){var i,s=[r,e,t,n],o=Et(r)?r.event:r;if(!o||!Nr(o))throw new Error("Event missing");var a=Et(r)?(i=r.properties)!==null&&i!==void 0?i:{}:Et(e)?e:{},u={};Sn(t)||(u=t??{}),Et(r)&&!Sn(e)&&(u=e??{});var c=s.find(Sn);return[o,a,u,c]}function cf(r,e,t,n,i){var s,o,a=null,u=null,c=[r,e,t,n,i],l=c.filter(Nr);l[0]!==void 0&&l[1]!==void 0&&(a=l[0],u=l[1]),l.length===1&&(a=null,u=l[0]);var h=c.find(Sn),d=c.filter(function(T){return u===null?Et(T):Et(T)||T===null}),m=(s=d[0])!==null&&s!==void 0?s:{},w=(o=d[1])!==null&&o!==void 0?o:{};return[a,u,m,w,h]}var lf=function(r){return function(){for(var e,t,n,i,s,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var u=null;u=(n=(e=o.find(Nr))!==null&&e!==void 0?e:(t=o.find(Ou))===null||t===void 0?void 0:t.toString())!==null&&n!==void 0?n:r.id();var c=o.filter(function(m){return u===null?Et(m):Et(m)||m===null}),l=(i=c[0])!==null&&i!==void 0?i:{},h=(s=c[1])!==null&&s!==void 0?s:{},d=o.find(Sn);return[u,l,h,d]}};function r0(r,e,t,n){Ou(r)&&(r=r.toString()),Ou(e)&&(e=e.toString());var i=[r,e,t,n],s=i.filter(Nr),o=s[0],a=o===void 0?r:o,u=s[1],c=u===void 0?null:u,l=i.filter(Et)[0],h=l===void 0?{}:l,d=i.find(Sn);return[a,c,h,d]}function n0(r,e){var t={};return r.forEach(function(n){var i,s=void 0;if(typeof e=="string"){var o=n[e];s=typeof o!="string"?JSON.stringify(o):o}else e instanceof Function&&(s=e(n));s!==void 0&&(t[s]=at(at([],(i=t[s])!==null&&i!==void 0?i:[],!0),[n],!1))}),t}var i0=function(r){return typeof r=="object"&&r!==null&&"then"in r&&typeof r.then=="function"};var s0=function(){var r,e,t=0;return{done:function(){return r},run:function(n){var i=n();return i0(i)&&(++t===1&&(r=new Promise(function(s){return e=s})),i.finally(function(){return--t===0&&e()})),i}}};function o0(){return typeof window<"u"}function pb(){return o0()?window.navigator.onLine:!0}function a0(){return!pb()}var u0=function(r){bt(e,r);function e(t){var n=r.call(this)||this;return n.criticalTasks=s0(),n.plugins=[],n.failedInitializations=[],n.flushing=!1,n.queue=t,n.queue.on(wp,function(){n.scheduleFlush(0)}),n}return e.prototype.register=function(t,n,i){return L(this,void 0,void 0,function(){var s=this;return q(this,function(o){switch(o.label){case 0:return[4,Promise.resolve(n.load(t,i)).then(function(){s.plugins.push(n)}
vendor: 4,090 bytes, line 33
33).catch(function(a){if(n.type==="destination"){s.failedInitializations.push(n.name),console.warn(n.name,a),t.log("warn","Failed to load destination",{plugin:n.name,error:a});return}throw a})];case 1:return o.sent(),[2]}})})},e.prototype.deregister=function(t,n,i){return L(this,void 0,void 0,function(){var s;return q(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),n.unload?[4,Promise.resolve(n.unload(t,i))]:[3,2];case 1:o.sent(),o.label=2;case 2:return this.plugins=this.plugins.filter(function(a){return a.name!==n.name}),[3,4];case 3:return s=o.sent(),t.log("warn","Failed to unload destination",{plugin:n.name,error:s}),[3,4];case 4:return[2]}})})},e.prototype.dispatch=function(t){return L(this,void 0,void 0,function(){var n;return q(this,function(i){return t.log("debug","Dispatching"),t.stats.increment("message_dispatched"),this.queue.push(t),n=this.subscribeToDelivery(t),this.scheduleFlush(0),[2,n]})})},e.prototype.subscribeToDelivery=function(t){return L(this,void 0,void 0,function(){var n=this;return q(this,function(i){return[2,new Promise(function(s){var o=function(a,u){a.isSame(t)&&(n.off("flush",o),s(a))};n.on("flush",o)})]})})},e.prototype.dispatchSingle=function(t){return L(this,void 0,void 0,function(){var n=this;return q(this,function(i){return t.log("debug","Dispatching"),t.stats.increment("message_dispatched"),this.queue.updateAttempts(t),t.attempts=1,[2,this.deliver(t).catch(function(s){var o=n.enqueuRetry(s,t);return o?n.subscribeToDelivery(t):(t.setFailedDelivery({reason:s}),t)})]})})},e.prototype.isEmpty=function(){return this.queue.length===0},e.prototype.scheduleFlush=function(t){var n=this;t===void 0&&(t=500),!this.flushing&&(this.flushing=!0,setTimeout(function(){n.flush().then(function(){setTimeout(function(){n.flushing=!1,n.queue.length&&n.scheduleFlush(0)},0)})},t))},e.prototype.deliver=function(t){return L(this,void 0,void 0,function(){var n,i,s,o;return q(this,function(a){switch(a.label){case 0:return[4,this.criticalTasks.done()];case 1:a.sent(),n=Date.now(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.flushOne(t)];case 3:return t=a.sent(),i=Date.now()-n,this.emit("delivery_success",t),t.stats.gauge("delivered",i),t.log("debug","Delivered",t.event),[2,t];case 4:throw s=a.sent(),o=s,t.log("error","Failed to deliver",o),this.emit("delivery_failure",t,o),t.stats.increment("delivery_failed"),s;case 5:return[2]}})})},e.prototype.enqueuRetry=function(t,n){var i=!(t instanceof xo)||t.retry;return i?this.queue.pushWithBackoff(n):!1},e.prototype.flush=function(){return L(this,void 0,void 0,function(){var t,n,i;return q(this,function(s){switch(s.label){case 0:if(this.queue.length===0||a0())return[2,[]];if(t=this.queue.pop(),!t)return[2,[]];t.attempts=this.queue.getAttempts(t),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.deliver(t)];case 2:return t=s.sent(),this.emit("flush",t,!0),[3,4];case 3:return n=s.sent(),i=this.enqueuRetry(n,t),i||(t.setFailedDelivery({reason:n}),this.emit("flush",t,!1)),[2,[]];case 4:return[2,[t]]}})})},e.prototype.isReady=function(){return!0},e.prototype.availableExtensions=function(t){var n=this.plugins.filter(function(m){var w,T,E;if(m.type!=="destination"&&m.name!=="Customer.io Data Pipelines")return!0;var I=void 0;return(w=m.alternativeNames)===null||w===void 0||w.forEach(function(v){t[v]!==void 0&&(I=t[v])}),(E=(T=t[m.name])!==null&&T!==void 0?T:I)!==null&&E!==void 0?E:(m.name==="Customer.io Data Pipelines"?!0:t.All)!==!1}),i=n0(n,"type"),s=i.before,o=s===void 0?[]:s,a=i.enrichment,u=a===void 0?[]:a,c=i.destination,l=c===void 0?[]:c,h=i.after,d=h===void 0?[]:h;return{before:o,enrichment:u,destinations:l,after:d}},e.prototype.flushOne=function(t){var n,i;return L(this,void 0,void 0,function(){var s,o,a,u,c,l,w,h,d,m,w,T,E,I,v;return q(this,function(p){switch(p.label){case 0:if(!this.isReady())throw new Error("Not ready");t.attempts>1&&this.emit("delivery_retry",t),s=this.availableExtensions((n=t.event.integrations)!==null&&n!==void 0?n:{}),o=s.before,a=s.enrichment,u=0,c=o,p.label=1;case 1:return u<c.length?(l=c[u],[4,Ep(t,l)]):[3,4];
33case 2:w=p.sent(),w instanceof ic&&(t=w),this.emit("message_enriched",t,l),p.label=3;case 3:return u++,[3,1];case 4:h=0,d=a,p.label=5;case 5:return h<d.length?(m=d[h],[4,Fn(t,m)]):[3,8];case 6:w=p.sent(),w instanceof ic&&(t=w),this.emit("message_enriched",t,m),p.label=7;case 7:return h++,[3,5];case 8:return T=this.availableExtensions((i=t.event.integrations)!==null&&i!==void 0?i:{}),E=T.destinations,I=T.after,[4,new Promise(function(g,_){setTimeout(function(){var y=E.map(function(M){return Fn(t,M)});Promise.all(y).then(g).catch(_)},0)})];case 9:return p.sent(),t.stats.increment("message_delivered"),this.emit("message_delivered",t),v=I.map(function(g){return Fn(t,g)}),[4,Promise.all(v)];case 10:return p.sent(),[2,t]}})})},e}(Po);var mb=function(r,e){var t=Date.now()-r;return Math.max((e??300)-t,0)};function c0(r,e,t,n){return L(this,void 0,void 0,function(){var i,s;return q(this,function(o){switch(o.label){case 0:return t.emit("dispatch_start",r),i=Date.now(),e.isEmpty()?[4,e.dispatchSingle(r)]:[3,2];case 1:return s=o.sent(),[3,4];case 2:return[4,e.dispatch(r)];case 3:s=o.sent(),o.label=4;case 4:return n?.callback?[4,vp(s,n.callback,mb(i,n.timeout))]:[3,6];case 5:s=o.sent(),o.label=6;case 6:return n?.debug&&s.flush(),[2,s]}})})}var f0=ww(d0()),p0=function(){function r(e){this.user=e}return r.prototype.track=function(e,t,n,i){return this.normalize(j(j({},this.baseEvent()),{event:e,type:"track",properties:t,options:j({},n),integrations:j({},i)}))},r.prototype.page=function(e,t,n,i,s){var o,a={type:"page",properties:j({},n),options:j({},i),integrations:j({},s)};return e!==null&&(a.category=e,a.properties=(o=a.properties)!==null&&o!==void 0?o:{},a.properties.category=e),t!==null&&(a.name=t),this.normalize(j(j({},this.baseEvent()),a))},r.prototype.screen=function(e,t,n,i,s){var o={type:"screen",properties:j({},n),options:j({},i),integrations:j({},s)};return e!==null&&(o.category=e),t!==null&&(o.name=t),this.normalize(j(j({},this.baseEvent()),o))},r.prototype.identify=function(e,t,n,i){return this.normalize(j(j({},this.baseEvent()),{type:"identify",userId:e,traits:t,options:j({},n),integrations:j({},i)}))},r.prototype.group=function(e,t,n,i){return this.normalize(j(j({},this.baseEvent()),{type:"group",traits:t,options:j({},n),integrations:j({},i),groupId:e}))},r.prototype.alias=function(e,t,n,i){var s={userId:e,type:"alias",options:j({},n),integrations:j({},i)};return t!==null&&(s.previousId=t),e===void 0?this.normalize(j(j({},s),this.baseEvent())):this.normalize(j(j({},this.baseEvent()),s))},r.prototype.baseEvent=function(){var e={integrations:{},options:{}},t=this.user;return t.id()&&(e.userId=t.id()),t.anonymousId()&&(e.anonymousId=t.anonymousId()),e},r.prototype.context=function(e){var t,n,i,s=["integrations","anonymousId","timestamp","userId"],o=(t=e.options)!==null&&t!==void 0?t:{};delete o.integrations;var a=Object.keys(o),u=(i=(n=e.options)===null||n===void 0?void 0:n.context)!==null&&i!==void 0?i:{},c={};return a.forEach(function(l){l!=="context"&&(s.includes(l)?nc(c,l,o[l]):nc(u,l,o[l]))}),[u,c]},r.prototype.normalize=function(e){var t,n,i;!((t=e.options)===null||t===void 0)&&t.anonymousId&&this.user.anonymousId(e.options.anonymousId);var s=Object.keys((n=e.integrations)!==null&&n!==void 0?n:{}).reduce(function(T,E){var I,v;return j(j({},T),(I={},I[E]=!!(!((v=e.integrations)===null||v===void 0)&&v[E]),I))},{}),o=j(j({},s),(i=e.options)===null||i===void 0?void 0:i.integrations),a=this.context(e),u=a[0],c=a[1],l=e.options,h=Qf(e,["options"]),d=j(j(j({timestamp:new Date},h),{context:u,integrations:o}),c),m="ajs-next-"+f0.default.hash(JSON.stringify(d)+Ip()),w=j(j({},d),{messageId:m});return w},r}();var m0=function(r){bt(e,r);function e(t){return r.call(this,t??new Ln(4,"event-queue"))||this}return e}(u0);var Vr="This is being deprecated and will be not be available in future releases of Analytics JS",hf=Ro(),df=hf?.analytics;function gb(r,e){r===void 0&&(r=!1),e===void 0&&(e=!1);var t=r?4:1,n=e?new Co(t,[]):new Ln(t,"event-queue");return new m0(n)}function qt(){console.warn(Vr)}var g0=function(r){bt(e,r);function e(t,n,i,s,o){var a=this,u,c,l;a=r.call(this)||this,a._debug=!1,a.initialized=!1,a.user=function(){return a._user},a.init=a.initialize.bind(a),a.log=qt,a.addIntegrationMiddleware=qt,a.listeners=qt,a.addEventListener=qt,a.removeAllListeners=qt,a.removeListener=qt,a.removeEventListener=qt,a.hasListeners=qt,a.add=qt,a.addIntegration=qt;var h=n?.cookie,d=(u=n?.disableClientPersistence)!==null&&u!==void 0?u:!1;return a.settings=t,a.settings.timeout=(c=a.settings.timeout)!==null&&c!==void 0?c:300,a.queue=i??gb(n?.retryQueue,d),a._universalStorage=new bp(d?["memory"]:["localStorage","cookie","memory"],Sp(h)),a._user=s??new Ap(d?j(j({},n?.user),{persist:!1}):n?.user,h).load(),a._group=o??new kp(d?j(j({},n?.group),{persist:!1}):n?.group,h).load(),a.eventFactory=new p0(a._user),a.integrations=(l=n?.integrations)!==null&&l!==void 0?l:{},a.options=n??{},Tp(a),a}return Object.defineProperty(e.prototype,"storage",{get:function(){return this._universalStorage}
vendor: 4,704 bytes, line 33
33,enumerable:!1,configurable:!0}),e.prototype.track=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s,o,a,u,c,l=this;return q(this,function(h){return i=t0.apply(void 0,t),s=i[0],o=i[1],a=i[2],u=i[3],c=this.eventFactory.track(s,o,a,this.integrations),[2,this._dispatch(c,u).then(function(d){return l.emit("track",s,d.event.properties,d.event.options),d})]})})},e.prototype.page=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s,o,a,u,c,l,h=this;return q(this,function(d){return i=cf.apply(void 0,t),s=i[0],o=i[1],a=i[2],u=i[3],c=i[4],l=this.eventFactory.page(s,o,a,u,this.integrations),[2,this._dispatch(l,c).then(function(m){return h.emit("page",s,o,m.event.properties,m.event.options),m})]})})},e.prototype.identify=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s,o,a,u,c,l=this;return q(this,function(h){return i=lf(this._user).apply(void 0,t),s=i[0],o=i[1],a=i[2],u=i[3],this._user.identify(s,o),c=this.eventFactory.identify(this._user.id(),this._user.traits(),a,this.integrations),[2,this._dispatch(c,u).then(function(d){return l.emit("identify",d.event.userId,d.event.traits,d.event.options),d})]})})},e.prototype.group=function(){for(var t=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(n.length===0)return this._group;var s=lf(this._group).apply(void 0,n),o=s[0],a=s[1],u=s[2],c=s[3];this._group.identify(o,a);var l=this._group.id(),h=this._group.traits(),d=this.eventFactory.group(l,h,u,this.integrations);return this._dispatch(d,c).then(function(m){return t.emit("group",m.event.groupId,m.event.traits,m.event.options),m})},e.prototype.alias=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s,o,a,u,c,l=this;return q(this,function(h){return i=r0.apply(void 0,t),s=i[0],o=i[1],a=i[2],u=i[3],c=this.eventFactory.alias(s,o,a,this.integrations),[2,this._dispatch(c,u).then(function(d){return l.emit("alias",s,o,d.event.options),d})]})})},e.prototype.screen=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s,o,a,u,c,l,h=this;return q(this,function(d){return i=cf.apply(void 0,t),s=i[0],o=i[1],a=i[2],u=i[3],c=i[4],l=this.eventFactory.screen(s,o,a,u,this.integrations),[2,this._dispatch(l,c).then(function(m){return h.emit("screen",s,o,m.event.properties,m.event.options),m})]})})},e.prototype.trackClick=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s;return q(this,function(o){switch(o.label){case 0:return[4,import("./chunk-EGMBTHY3.js")];case 1:return i=o.sent(),[2,(s=i.link).call.apply(s,at([this],t,!1))]}})})},e.prototype.trackLink=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s;return q(this,function(o){switch(o.label){case 0:return[4,import("./chunk-EGMBTHY3.js")];case 1:return i=o.sent(),[2,(s=i.link).call.apply(s,at([this],t,!1))]}})})},e.prototype.trackSubmit=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s;return q(this,function(o){switch(o.label){case 0:return[4,import("./chunk-EGMBTHY3.js")];case 1:return i=o.sent(),[2,(s=i.form).call.apply(s,at([this],t,!1))]}})})},e.prototype.trackForm=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s;return q(this,function(o){switch(o.label){case 0:return[4,import("./chunk-EGMBTHY3.js")];case 1:return i=o.sent(),[2,(s=i.form).call.apply(s,at([this],t,!1))]}})})},e.prototype.register=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s,o=this;return q(this,function(a){switch(a.label){case 0:return i=cr.system(),s=t.map(function(u){return o.queue.register(i,u,o)}),[4,Promise.all(s)];case 1:return a.sent(),[2,i]}})})},e.prototype.deregister=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return L(this,void 0,void 0,function(){var i,s,o=this;return q(this,function(a){switch(a.label){case 0:return i=cr.system(),s=t.map(function(u){var c=o.queue.plugins.find(function(l){return l.name===u});if(c)return o.queue.deregister(i,c,o);i.log("warn","plugin ".concat(u," not found"))}),[4,Promise.all(s)];case 1:return a.sent(),[2,i]}})})},e.prototype.debug=function(t){return t===!1&&localStorage.getItem("debug")&&localStorage.removeItem("debug"),this._debug=t,this},e.prototype.reset=function(){this._user.reset(),this._group.reset(),this.emit
33("reset")},e.prototype.timeout=function(t){this.settings.timeout=t},e.prototype._dispatch=function(t,n){return L(this,void 0,void 0,function(){var i;return q(this,function(s){return i=new cr(t),zr()&&!this.options.retryQueue?[2,i]:[2,c0(i,this.queue,this,{callback:n,debug:this._debug,timeout:this.settings.timeout})]})})},e.prototype.addSourceMiddleware=function(t){return L(this,void 0,void 0,function(){var n=this;return q(this,function(i){switch(i.label){case 0:return[4,this.queue.criticalTasks.run(function(){return L(n,void 0,void 0,function(){var s,o,a;return q(this,function(u){switch(u.label){case 0:return[4,import("./chunk-HAMEMJJK.js")];case 1:return s=u.sent().sourceMiddlewarePlugin,o={},this.queue.plugins.forEach(function(c){if(c.type==="destination")return o[c.name]=!0}),a=s(t,o),[4,this.register(a)];case 2:return u.sent(),[2]}})})})];case 1:return i.sent(),[2,this]}})})},e.prototype.addDestinationMiddleware=function(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var s=this.queue.plugins.filter(function(o){return o.name.toLowerCase()===t.toLowerCase()});return s.forEach(function(o){o.addMiddleware.apply(o,n)}),Promise.resolve(this)},e.prototype.setAnonymousId=function(t){return this._user.anonymousId(t)},e.prototype.queryString=function(t){return L(this,void 0,void 0,function(){var n;return q(this,function(i){switch(i.label){case 0:return this.options.useQueryString===!1?[2,[]]:[4,import("./chunk-537I2HCZ.js")];case 1:return n=i.sent().queryString,[2,n(this,t)]}})})},e.prototype.use=function(t){return t(this),this},e.prototype.ready=function(t){return t===void 0&&(t=function(n){return n}),L(this,void 0,void 0,function(){return q(this,function(n){return[2,Promise.all(this.queue.plugins.map(function(i){return i.ready?i.ready():Promise.resolve()})).then(function(i){return t(i),i})]})})},e.prototype.noConflict=function(){return console.warn(Vr),Dp(df??this),this},e.prototype.normalize=function(t){return console.warn(Vr),this.eventFactory.normalize(t)},Object.defineProperty(e.prototype,"failedInitializations",{get:function(){return console.warn(Vr),this.queue.failedInitializations},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"VERSION",{get:function(){return Do},enumerable:!1,configurable:!0}),e.prototype.initialize=function(t,n){return L(this,void 0,void 0,function(){return q(this,function(i){return console.warn(Vr),[2,Promise.resolve(this)]})})},e.prototype.pageview=function(t){return L(this,void 0,void 0,function(){return q(this,function(n){switch(n.label){case 0:return console.warn(Vr),[4,this.page({path:t})];case 1:return n.sent(),[2,this]}})})},Object.defineProperty(e.prototype,"plugins",{get:function(){var t;return console.warn(Vr),(t=this._plugins)!==null&&t!==void 0?t:{}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Integrations",{get:function(){console.warn(Vr);var t=this.queue.plugins.filter(function(n){return n.type==="destination"}).reduce(function(n,i){var s="".concat(i.name.toLowerCase().replace(".","").split(" ").join("-"),"Integration"),o=window[s];if(!o)return n;var a=o.Integration;return a?(n[i.name]=a,n):(n[i.name]=o,n)},{});return t},enumerable:!1,configurable:!0}),e.prototype.push=function(t){var n=this,i=t.shift();i&&!n[i]||n[i].apply(this,t)},e}(Po);function ff(){return typeof process>"u"||!process.env?{}:process.env}var _0=function(){var r,e,t=new Promise(function(n,i){r=n,e=i});return{resolve:r,reject:e,promise:t}};function y0(){var r=document.getElementsByTagName("link"),e="";return Array.prototype.slice.call(r).forEach(function(t){t.getAttribute("rel")==="canonical"&&(e=t.getAttribute("href"))}),e}function _b(){var r=y0();if(!r)return window.location.pathname;var e=document.createElement("a");e.href=r;var t=e.pathname.startsWith("/")?e.pathname:"/"+e.pathname;return t}function yb(r){r===void 0&&(r="");var e=y0();if(e)return e.includes("?")?e:"".concat(e).concat(r);var t=window.location.href,n=t.indexOf("#");return n===-1?t:t.slice(0,n)}function v0(){return{path:_b(),referrer:document.referrer,search:location.search,title:document.title,url:yb(location.search)}}function co(r){var e,t=r.event;t.context=t.context||{};var n=v0(),i=(e=t.properties)!==null&&e!==void 0?e:{};
vendor: 7,902 bytes, line 33
33return Object.keys(n).forEach(function(s){i[s]&&(n[s]=i[s])}),t.context.page&&(n=Object.assign({},n,t.context.page)),t.context=Object.assign({},t.context,{page:n}),r.event=t,r}var w0={name:"Page Enrichment",version:"0.1.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},type:"before",page:function(r){return r.event.properties=Object.assign({},v0(),r.event.properties),r.event.name&&(r.event.properties.name=r.event.name),co(r)},alias:co,track:co,identify:co,group:co};var vb=function(){function r(e,t){this.version="1.0.0",this.alternativeNames=[],this.middleware=[],this.alias=this._createMethod("alias"),this.group=this._createMethod("group"),this.identify=this._createMethod("identify"),this.page=this._createMethod("page"),this.screen=this._createMethod("screen"),this.track=this._createMethod("track"),this.action=t,this.name=e,this.type=t.type,this.alternativeNames.push(t.name)}return r.prototype.addMiddleware=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.type==="destination"&&(e=this.middleware).push.apply(e,t)},r.prototype.transform=function(e){return L(this,void 0,void 0,function(){var t;return q(this,function(n){switch(n.label){case 0:return[4,Vp(this.name,e.event,this.middleware)];case 1:return t=n.sent(),t===null&&e.cancel(new xo({retry:!1,reason:"dropped by destination middleware"})),[2,new cr(t)]}})})},r.prototype._createMethod=function(e){var t=this;return function(n){return L(t,void 0,void 0,function(){var i;return q(this,function(s){switch(s.label){case 0:return this.action[e]?(i=n,this.type!=="destination"?[3,2]:[4,this.transform(n)]):[2,n];case 1:i=s.sent(),s.label=2;case 2:return[4,this.action[e](i)];case 3:return s.sent(),[2,n]}})})}},r.prototype.isLoaded=function(){return this.action.isLoaded()},r.prototype.ready=function(){return this.action.ready?this.action.ready():Promise.resolve()},r.prototype.load=function(e,t){return this.action.load(e,t)},r.prototype.unload=function(e,t){var n,i;return(i=(n=this.action).unload)===null||i===void 0?void 0:i.call(n,e,t)},r}();function wb(r){if(!Array.isArray(r))throw new Error("Not a valid list of plugins");var e=["load","isLoaded","name","version","type"];return r.forEach(function(t){e.forEach(function(n){var i;if(t[n]===void 0)throw new Error("Plugin: ".concat((i=t.name)!==null&&i!==void 0?i:"unknown"," missing required function ").concat(n))})}),!0}function Ib(r,e){var t=r[e.creationName],n=r[e.name];return r.All===!1&&!t&&!n||t===!1||n===!1}function I0(r,e,t,n,i){var s,o,a;return L(this,void 0,void 0,function(){var u,c,l,h,d=this;return q(this,function(m){switch(m.label){case 0:return u=[],c=No(),l=(o=(s=r.middlewareSettings)===null||s===void 0?void 0:s.routingRules)!==null&&o!==void 0?o:[],h=((a=r.remotePlugins)!==null&&a!==void 0?a:[]).map(function(w){return L(d,void 0,void 0,function(){var T,E,I,v,p,g,_,y,M,B,W;return q(this,function(te){switch(te.label){case 0:if(Ib(e,w))return[2];te.label=1;case 1:if(te.trys.push([1,12,,13]),T=new RegExp("https://cdp.customer.io"),!n)return[3,7];E=w.url.split("/"),I=E[E.length-2],v=w.url.replace(I,btoa(I).replace(/=/g,"")),te.label=2;case 2:return te.trys.push([2,4,,6]),[4,Vo(v.replace(T,c))];case 3:return te.sent(),[3,6];case 4:return p=te.sent(),[4,Vo(w.url.replace(T,c))];case 5:return te.sent(),[3,6];case 6:return[3,9];case 7:return[4,Vo(w.url.replace(T,c))];case 8:te.sent(),te.label=9;case 9:return g=w.libraryName,typeof window[g]!="function"?[3,11]:(_=window[g],[4,_(j(j({},w.settings),t[w.name]))]);case 10:y=te.sent(),M=Array.isArray(y)?y:[y],wb(M),B=l.filter(function(Ur){return Ur.destinationName===w.creationName}),M.forEach(function(Ur){var $i=new vb(w.creationName,Ur);B.length&&i&&Ur.type==="destination"&&$i.addMiddleware(i),u.push($i)}),te.label=11;case 11:return[3,13];case 12:return W=te.sent(),console.warn("Failed to load Remote Plugin",W),[3,13];case 13:return[2]}})})}),[4,Promise.all(h)];case 1:return m.sent(),[2,u.filter(Boolean)]}})})}var E0=function(r){var e=!1;window.addEventListener("pagehide",function(){e||(e=!0,r())}),document.addEventListener("visibilitychange",function(){if(document.visibilityState=="hidden"){if(e)return;e=!0,r()}else e=!1})};var Eb=500;function T0(r){var e=encodeURI(JSON.stringify(r)).split(/%..|./).length-1;return e/1024}function Tb(r){return T0(r)>=Eb-50}function bb(r){var e=[],t=0;return r.forEach(function(n){var i=T0(e[t]);i>=64&&t++,e[t]?e[t].push(n):e[t]=[n]}),e}function pf(r,e){var t,n,i=[],s=!1,o=(t=e?.size)!==null&&t!==void 0?t:10,a=(n=e?.timeout)!==null&&n!==void 0?n:5e3;function u(m){var w;if(m.length!==0){var T=(w=m[0])===null||w===void 0?void 0:w.writeKey;return Mn("".concat(r,"/b"),{keepalive:s,headers:{"Content-Type":"text/plain"},method:"post",body:JSON.stringify({batch:m,writeKey:T})})}}function c(){return L(this,void 0,void 0,function(){var m;return q(this,function(w){return i.length?(m=i,i=[],[2,u(m)]):[2]})})}var l;function h(){l||(l=setTimeout(function(){l=void 0,c().catch(console.error)},a))}E0(function(){if(s=!0,i.length){var m=bb(i).map(u);Promise.all(m).catch(console.error)}});function d(m,w){return L(this,void 0,void 0,function(){var T;return q(this,function(E){return i.push(w),T=i.length>=o||Tb(i),[2,T||s?c():h()]})})}return{dispatch:d}}function b0(r){function e(t,n){return Mn(t,{keepalive:r?.keepalive,headers:{"Content-Type":"text/plain"},method:"post",body:JSON.stringify(n)})}return{dispatch:e}}function Sb(r,e){return L(this,void 0,void 0,function(){var t,n=this;return q(this,function(i){switch(i.label){case 0:return t=[],zr()?[2,e]:[4,Mp(function(){return e.length>0&&!zr()},function(){return L(n,void 0,void 0,function(){var s,o,a;return q(this,function(u){switch(u.label){case 0:return s=e.pop(),s?[4,Fn(s,r)]:[2];case 1:return o=u.sent(),a=o instanceof cr,a||t.push(s),[2]}})})})];case 1:return i.sent(),t.map(function(s){return e.pushWithBackoff(s)}),[2,e]}})})}function An(r,e,t,n){var i=this;r||setTimeout(function(){return L(i,void 0,void 0,function(){var s,o;return q(this,function(a){switch(a.label){case 0:return s=!0,[4,Sb(t,e)];case 1:return o=a.sent(),s=!1,e.todo>0&&n(s,o,t,n),[2]}})})},Math.random()*5e3)}function Ab(r,e){var t,n,i,s,o=r.user();return e.previousId=(i=(n=(t=e.previousId)!==null&&t!==void 0?t:e.from)!==null&&n!==void 0?n:o.id())!==null&&i!==void 0?i:o.anonymousId(),e.userId=(s=e.userId)!==null&&s!==void 0?s:e.to,delete e.from,delete e.to,e}function S0(r,e,t){var n,i;window.addEventListener("pagehide",function(){s.push.apply(s,Array.from(o)),o.clear()});var s=r.options.disableClientPersistence?new Co(r.queue.queue.maxAttempts,[]):new Ln(r.queue.queue.maxAttempts,"dest-Customer.io-Data-Pipelines"),o=new Set,a=!1,u=(n=e?.apiHost)!==null&&n!==void 0?n:"cdp.customer.io/v1",c=(i=e?.protocol)!==null&&i!==void 0?i:"https",l="".concat(c,"://").concat(u),h=e?.deliveryStrategy,d=h?.strategy==="batching"?pf(l,h.config):b0(h?.config);function m(T){return L(this,void 0,void 0,function(){var E,I;return q(this,function(v){return zr()?(s.push(T),An(a,s,w,An),[2,T]):(o.add(T),E=T.event.type.charAt(0),I=Np(T.event).json(),T.event.type==="track"&&delete I.traits,T.event.type==="alias"&&(I=Ab(r,I)),[2,d.dispatch("".concat(l,"/").concat(E),Pp(r,I,e,t)).then(function(){return T}).catch(function(){return s.pushWithBackoff(T),An(a,s,w,An),T}).finally(function(){o.delete(T)})])})})}var w={name:"Customer.io Data Pipelines",type:"after",version:"0.1.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:m,identify:m,page:m,alias:m,group:m,screen:m};return s.todo&&An(a,s,w,An),w}var A0=function(r){return typeof r=="object"&&r!==null&&"then"in r&&typeof r.then=="function"};var k0=function(r,e,t){t.getCalls(r).forEach(function(n){mf(e,n).catch(console.error)})},P0=function(r,e){return L(void 0,void 0,void 0,function(){var t,n,i;return q(this,function(s){switch(s.label){case 0:t=0,n=e.getCalls("addSourceMiddleware"),s.label=1;
33case 1:return t<n.length?(i=n[t],[4,mf(r,i).catch(console.error)]):[3,4];case 2:s.sent(),s.label=3;case 3:return t++,[3,1];case 4:return[2]}})})},C0=k0.bind(void 0,"on"),x0=k0.bind(void 0,"setAnonymousId"),R0=function(r,e){e.toArray().forEach(function(t){setTimeout(function(){mf(r,t).catch(console.error)},0)})},kb=function(){function r(){this._value={}}return r.prototype.toArray=function(){var e;return(e=[]).concat.apply(e,Object.values(this._value))},r.prototype.getCalls=function(e){var t;return(t=this._value[e])!==null&&t!==void 0?t:[]},r.prototype.push=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.forEach(function(i){e._value[i.method]?e._value[i.method].push(i):e._value[i.method]=[i]}),this},r.prototype.clear=function(){return this._value={},this},r}();function mf(r,e){return L(this,void 0,void 0,function(){var t,n;return q(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),e.called?[2,void 0]:(e.called=!0,t=r[e.method].apply(r,e.args),A0(t)?[4,t]:[3,2]);case 1:i.sent(),i.label=2;case 2:return e.resolve(t),[3,4];case 3:return n=i.sent(),e.reject(n),[3,4];case 4:return[2]}})})}var D0=function(){function r(e){var t=this;this._preInitBuffer=new kb,this.trackSubmit=this._createMethod("trackSubmit"),this.trackClick=this._createMethod("trackClick"),this.trackLink=this._createMethod("trackLink"),this.pageView=this._createMethod("pageview"),this.identify=this._createMethod("identify"),this.reset=this._createMethod("reset"),this.group=this._createMethod("group"),this.track=this._createMethod("track"),this.ready=this._createMethod("ready"),this.alias=this._createMethod("alias"),this.debug=this._createChainableMethod("debug"),this.page=this._createMethod("page"),this.once=this._createChainableMethod("once"),this.off=this._createChainableMethod("off"),this.on=this._createChainableMethod("on"),this.addSourceMiddleware=this._createMethod("addSourceMiddleware"),this.setAnonymousId=this._createMethod("setAnonymousId"),this.addDestinationMiddleware=this._createMethod("addDestinationMiddleware"),this.screen=this._createMethod("screen"),this.register=this._createMethod("register"),this.deregister=this._createMethod("deregister"),this.user=this._createMethod("user"),this.VERSION=Do,this._promise=e(this._preInitBuffer),this._promise.then(function(n){var i=n[0],s=n[1];t.instance=i,t.ctx=s}).catch(function(){})}return r.prototype.then=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).then.apply(e,t)},r.prototype.catch=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).catch.apply(e,t)},r.prototype.finally=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).finally.apply(e,t)},r.prototype._createMethod=function(e){var t=this;return function(){for(var n,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(t.instance){var o=(n=t.instance)[e].apply(n,i);return Promise.resolve(o)}return new Promise(function(a,u){t._preInitBuffer.push({method:e,args:i,resolve:a,reject:u,called:!1})})}},r.prototype._createChainableMethod=function(e){var t=this;return function(){for(var n,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return t.instance?((n=t.instance)[e].apply(n,i),t):(t._preInitBuffer.push({method:e,args:i,resolve:function(){},reject:console.error,called:!1}),t)}},r}();function Pb(r){var e=r[0],t=r.slice(1);return{method:e,resolve:function(){},reject:console.error,args:t,called:!1}}var Cb=function(r){return r.map(Pb)},Fu=function(r){r===void 0&&(r=xp());var e=r;if(!Array.isArray(e))return[];var t=e.splice(0,e.length);return Cb(t)};var gf,N0,xb=Ro(),V0=(gf=(N0=xb).__INSPECTOR__)!==null&&gf!==void 0?gf:N0.__INSPECTOR__={},O0=function(r){var e;return(e=V0.attach)===null||e===void 0?void 0:e.call(V0,r)};function Rb(r,e){var t=e??No();return Mn("".concat(t,"/v1/projects/").concat(r,"/settings")).then(function(n){return n.ok?n.json():n.text().then(function(i){throw new Error(i)})}).catch(function(n){throw console.error(n.message),n})}function Db(r){return ff().NODE_ENV!=="test"&&Object.keys(r.integrations).length>1}function Nb(r){var e,t,n;return ff().NODE_ENV!=="test"&&((n=(t=(e=r.middlewareSettings)===null||e===void 0?void 0:e.routingRules)===null||t===void 0?void 0:t.length)!==null&&n!==void 0?n:0)>0}function Vb(r,e){e.push.apply(e,Fu()),x0(r,e),C0(r,e)}function Ob(r,e){return L(this,void 0,void 0,function(){return q(this,function(t){switch(t.label){case 0:return e.push.apply(e,Fu()),[4,P0(r,e)];case 1:return t.sent(),e.push.apply(e,Fu()),R0(r,e),e.clear(),[2]}})})}function Fb(r,e,t,n,i,s){var o,a,u,c;return L(this,void 0,void 0,function(){var l,h,d,m,w,T,E,I,v,p,g,_,y,M=this;return q(this,function(B){switch(B.label){case 0:return Nb(r)?[4,import("./chunk-BNY23CO3.js").then(function(W){return W.tsubMiddleware(r.middlewareSettings.routingRules)})]:[3,2];case 1:return h=B.sent(),[3,3];case 2:h=void 0,B.label=3;case 3:return l=h,Db(r)||s.length>0?[4,import("./chunk-RCKJVOQR.js").then(function(W){return W.ajsDestinations(r,e.integrations,t,l,s)})]:[3,5];case 4:return m=B.sent(),[3,6];case 5:m=[],B.label=6;case 6:return d=m,r.legacyVideoPluginsEnabled?[4,import("./chunk-A577GFAO.js").then(function(W){return W.loadLegacyVideoPlugins(e)})]:[3,8];case 7:B.sent(),B.label=8;case 8:return!((o=t.plan)===null||o===void 0)&&o.track?[4,import("./chunk-HGLZD4XJ.js").then(function(W){var te;return W.schemaFilter((te=t.plan)===null||te===void 0?void 0:te.track,r)})]:[3,10];case 9:return T=B.sent(),[3,11];case 10:T=void 0,B.label=11;case 11:return w=T,E=Fp(r,n),[4,I0(r,e.integrations,E,n.obfuscate,l).catch(function(){return[]})];case 12:return I=B.sent(),!((a=n.integrations)===null||a===void 0)&&a["Customer.io In-App Plugin"]?[4,import("./chunk-5VGELBKZ.js").then(function(W){var te;return W.InAppPlugin((te=n.integrations)===null||te===void 0?void 0:te["Customer.io In-App Plugin"])})]:[3,14];case 13:return p=B.sent(),[3,15];case 14:p=void 0,B.label=15;case 15:return v=p,g=at(at(at([e0,w0],i,!0),d,!0),I,!0),w&&g.push(w),v&&g.push(v),_=((u=t.integrations)===null||u===void 0?void 0:u.All)===!1&&!t.integrations["Customer.io Data Pipelines"]||t.integrations&&t.integrations["Customer.io Data Pipelines"]===!1,_||g.push(S0(e,E["Customer.io Data Pipelines"],r.integrations)),[4,e.register.apply(e,g)];case 16:return y=B.sent(),Object.entries((c=r.enabledMiddleware)!==null&&c!==void 0?c:{}).some(function(W){var te=W[1];return te})?[4,import("./chunk-DLNQT4CE.js").then(function(W){var te=W.remoteMiddlewares;return L(M,void 0,void 0,function(){var Ur,$i;return q(this,function(zf){switch(zf.label){case 0:return[4,te(y,r,n.obfuscate)];case 1:return Ur=zf.sent(),$i=Ur.map(function(vw){return e.addSourceMiddleware(vw)}),[2,Promise.all($i)]}})})})]:[3,18];case 17:B.sent(),B.label=18;case 18:return[2,y]}})})}function Mb(r,e,t){var n,i,s,o,a,u,c;return e===void 0&&(e={}),L(this,void 0,void 0,function(){var l,h,d,m,w,T,E,I,v,p,g;return q(this,function(_){switch(_.label){case 0:return e.globalAnalyticsKey&&Rp(e.globalAnalyticsKey),r.cdnURL&&Op(r.cdnURL),(n=r.cdnSettings)!==null&&n!==void 0?(h=n,[3,3]):[3,1];case 1:return[4,Rb(r.writeKey,r.cdnURL)];case 2:h=_.sent(),_.label=3;case 3:return l=h,d=(s=(i=l.integrations["Customer.io Data Pipelines"])===null||i===void 0?void 0:i.retryQueue)!==null&&s!==void 0?s:!0,m=j({retryQueue:d},e),w=new g0(r,m),O0(w),T=(o=r.plugins)!==null&&o!==void 0?o:[],E=(a=r.classicIntegrations)!==null&&a!==void 0?a:[],Cp.initRemoteMetrics(l.metrics),Vb(w,t),[4,Fb(l,w,m,e,T,E)];case 4:return I=_.sent(),v=(u=window.location.search)!==null&&u!==void 0?u:"",p=(c=window.location.hash)!==null&&c!==void 0?c:"",g=v.length?v:p.replace(/(?=#).*(?=\?)/,""),g.includes("ajs_")?[4,w.queryString(g).catch(console.error)]:[3,6];case 5:_.sent(),_.label=6;case 6:return w.initialized=!0,w.emit("initialize",r,e),e.initialPageview&&w.page().catch(console.error),[4,Ob(w,t)];case 7:return _.sent(),[2,[w,I]]}})})}var F0=function(r){bt(e,r);function e(){var t=this,n=_0(),i=n.promise,s=n.resolve;return t=r.call(this,function(o){return i.then(function(a){var u=a[0],c=a[1];return Mb(u,c,o)})})||this,t._resolveLoadStart=function(o,a){return s([o,a])},t}return e.prototype.load=function(t,n){return n===void 0&&(n={}),this._resolveLoadStart(t,n),this},e.load=function(t,n){return n===void 0&&(n={}),new e().load(t,n)},e.standalone=function(t,n){return e.load({writeKey:t},n).then(function(i){return i[0]})},e}(D0);var Lb={abrioApp:"OpenApp",LoginAccount:"OpenSession",searched:"SearchPerformed",favorites:"AddToPlaylist",ClickPayment:"TryToPay",PaymentSuccess:"SuccessPayment",PaymentError:"ErrorPurchaseApp",PaymentView:"ViewPayment"},M0=r=>Lb[r]||r,Mu=(r,e)=>{let t=U({},e),n=e["Kanto Country"]||e["Kanto User Country"],i=U(U(U(U(U(U(U(U(U(U(U(U(U(U(U(U(U(U({},e["Kanto Country"]&&{Country:e["Kanto Country"]}),e["Kanto User Country"]&&{Country:e["Kanto User Country"]}),e.Membership&&{Premium:e.Membership!=="Free"}),e["Kanto Language"]&&n&&{language:`${e["Kanto Language"].toLowerCase()}-${n.toUpperCase()}`}),e.Email&&{Email:e.Email}),e.email&&{Email:e.email}),e["Kanto Email"]&&{Email:e["Kanto Email"]}),e.keywork&&{Content:e.keywork}
33),e.search_keyword&&{Content:e.search_keyword}),e.Premium&&{Premium:e.Premium}),e.idUser&&{UserId:e.idUser}),e["Where Session"]&&{How:e["Where Session"]}),e.artist&&{Artist:e.artist}),e.idSong&&{IdSong:e.idSong}),e.qr&&{SessionCode:e.qr}),e["Session QR Code"]&&{SessionCode:e["Session QR Code"]}),e["Plan ID"]&&{PlanId:e["Plan ID"]}),e["Token Session"]&&{SessionToken:e["Token Session"]});return delete t["Kanto Country"],delete t["Kanto User Country"],delete t.Membership,delete t["Kanto Language"],delete t.Email,delete t.email,delete t["Kanto Email"],delete t.keywork,delete t.Premium,delete t.idUser,delete t["Where Session"],delete t.artist,delete t.idSong,delete t.song,delete t.search_keyword,delete t.qr,delete t["Session QR Code"],delete t["Plan ID"],U(U({},t),i)};var _f=(()=>{let e=class e{constructor(){this.enabled=!0,this.ready=!1,this.analytics=null,this.writeKey=Le.customer_io.write_key,this.ready||(console.log("CustomerIOService Constructor"),this.analytics=this.load())}load(){return this.enabled?(this.ready=!0,F0.load({writeKey:this.writeKey},{initialPageview:!1,disableClientPersistence:!0})):null}sendEvent(n,i){return S(this,null,function*(){this.enabled&&(yield this.analytics?.track(M0(n),U({},Mu(n,i||{}))))})}identify(n,i){return S(this,null,function*(){if(this.enabled){if(!i){yield this.analytics?.identify(nt(U({},Mu("identify",n)),{email:n.Email}));return}yield this.analytics?.identify(i,nt(U({},Mu("identify",n)),{email:n.Email}))}})}reset(){return S(this,null,function*(){this.enabled&&(yield this.analytics?.reset())})}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var L0=(r,e)=>{r=r||"",e=e||60;let t=["#1abc9c","#2ecc71","#3498db","#9b59b6","#34495e","#16a085","#27ae60","#2980b9","#8e44ad","#2c3e50","#f1c40f","#e67e22","#e74c3c","#ecf0f1","#95a5a6","#f39c12","#d35400","#c0392b","#bdc3c7","#7f8c8d"],n=String(r).toUpperCase().split(" "),i,s;n.length===1?i=n[0]?n[0].charAt(0):"?":i=n[0].charAt(0)+n[1].charAt(0),window.devicePixelRatio&&(e=e*window.devicePixelRatio);let a=((i==="?"?72:i.charCodeAt(0))-64)%20;s=document.createElement("canvas"),s.width=e,s.height=e;let u=s.getContext("2d");u&&(u.fillStyle=t[a-1],u.fillRect(0,0,s.width,s.height),u.font=Math.round(s.width/2)+"px Arial",u.textAlign="center",u.fillStyle="#FFF",u.fillText(i,e/2,e/1.5));let c=s.toDataURL();return s=null,c};var q0=(r,e)=>r?`https://graph.facebook.com/${r}/picture?redirect=true&type=large&height=200&width=200`:L0(e,100);var U0=r=>{let e={};return yp(r,(t,n)=>{gp(t)||(e[n]=t)}),e};var B0=(r,e)=>{let t,n=null;return{debounced:(...o)=>(n&&(n("Debounced function was cancelled"),n=null),new Promise((a,u)=>{clearTimeout(t),n=u,t=setTimeout(()=>{n=null;try{let c=r(...o);c instanceof Promise?c.then(a).catch(u):a(c)}catch(c){u(c)}},e)})),cancel:()=>{clearTimeout(t),n&&(n("Debounced function was cancelled"),n=null)}}};var qf=(()=>{let e=class e{constructor(n,i){if(this.platform=n,this.localStorage=i,this.distinct_id=new et(""),this.mixpanelLocalStorage={},this.idProjectMixpanel=Le.mixpanel.token,this.versionApp=Le.version,this.mergeWithLogin=!1,this.platform.isBrowser()){let s=lw();s.init(this.idProjectMixpanel,{persistence:"localStorage",loaded:o=>{this.distinct_id.next(s.get_distinct_id().replace(/-/g,"")),this.isReady=!0,this.mixpanel=s,window.mixpanel=s,s.track("mixpanelReady")}}),window.versionApp=this.versionApp,window.buildNumber=Le.buildNumber,console.log("versionApp",this.versionApp)}}sendEvent(n,i){this.isReady&&(n?this.mixpanel.track(n,i):console.error("NO SE ENVIO NOMBRE DE EVENTO"))}register(n,i){if(this.isReady){let s;try{s=U0(n)}catch{s=n}this.mixpanel.register(s)}}identify(n,i){let s=nt(U({},n),{$name:n.first_name||n["First Name"],$email:n.email||n.Email||n["Kanto Email"]});delete s.Email,this.peopleSet(s),i?this.mixpanel.identify(i):console.error("no se envio userId")}peopleSet(n){this.mixpanel.people.set(n)}peopleIncrement(n,i){i=i===void 0?1:i,this.mixpanel.people.increment(n,i)}resetMxp(){this.mixpanel.reset()}unregister(n){this.isReady&&this.mixpanel.unregister(n)}setParametersDevices(n,i){return console.log("OCURRE EL LOAD PARAMETERS"),n.setDevice(),this.loadParameters(n,i)}loadParameters(n,i){console.log("OCURRE EL LOAD PARAMETERS"),this.mergeWithLogin||this.doMergeWithLogin(i)}doMergeWithLogin(n){let i=n.onReady(()=>
33{if(n.authenticated){let s,o=n.currentUser;o&&(s={idUser:o.id,Email:o.email,$email:o.email,Premium:o.premium,fullName:o.first_name+" "+o.last_name},this.identify(s,o.id)),this.mergeWithLogin=!0,this.register(s),i&&!i.closed&&i.unsubscribe()}})}};e.\u0275fac=function(i){return new(i||e)(P(ye),P(He))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var fS=500,mo=r=>{if(!r)return;let e=()=>{r&&r.parentNode&&r.parentNode.removeChild(r)};r.classList.remove("show"),r.classList.add("hide"),r.addEventListener("transitionend",e),setTimeout(e,fS)},hw=(()=>{let e=class e{constructor(n){this.version="1.0.12",this.defaultOkLabel="Ok",this.okLabel="Ok",this.defaultCancelLabel="Cancel",this.cancelLabel="Cancel",this.defaultMaxLogItems=2,this.maxLogItems=2,this.promptValue="",this.promptPlaceholder="",this.closeLogOnClick=!1,this.closeLogOnClickDefault=!1,this.delay=5e3,this.defaultDelay=5e3,this.logContainerClass="alertify-logs",this.logContainerDefaultClass="alertify-logs",this.dialogs={buttons:{holder:"<nav>{{buttons}}</nav>",ok:"<button class='ok' tabindex='1'>{{ok}}</button>",cancel:"<button class='cancel' tabindex='2'>{{cancel}}</button>"},input:"<input type='text'>",message:"<p class='msg'>{{message}}</p>",log:"<div class='{{class}}'>{{message}}</div>"},this.defaultDialogs={buttons:{holder:"<nav>{{buttons}}</nav>",ok:"<button class='ok' tabindex='1'>{{ok}}</button>",cancel:"<button class='cancel' tabindex='2'>{{cancel}}</button>"},input:"<input type='text'>",message:"<p class='msg'>{{message}}</p>",log:"<div class='{{class}}'>{{message}}</div>"},n.isBrowser()&&(this.parent=document.body,this.injectCSS())}build(n){let i=this.dialogs.buttons.ok,s="<div class='dialog'><div>"+this.dialogs.message.replace("{{message}}",n.message);return(n.type==="confirm"||n.type==="prompt")&&(i=this.dialogs.buttons.cancel+this.dialogs.buttons.ok),n.type==="prompt"&&(s+=this.dialogs.input),s=(s+this.dialogs.buttons.holder+"</div></div>").replace("{{buttons}}",i).replace("{{ok}}",this.okLabel).replace("{{cancel}}",this.cancelLabel),s}setCloseLogOnClick(n){this.closeLogOnClick=!!n}close(n,i){this.closeLogOnClick&&n.addEventListener("click",()=>{mo(n)}),i=i&&!isNaN(+i)?+i:this.delay,i<0?mo(n):i>0&&setTimeout(()=>{mo(n)},i)}dialog(n,i,s,o,a){return this.setup({message:n,type:i,onOkay:s,onCancel:o,isValid:a})}log(n,i,s){let o=document.querySelectorAll(".alertify-logs > div");if(o){let a=o.length-this.maxLogItems;if(a>=0)for(let u=0,c=a+1;u<c;u++)this.close(o[u],-1)}this.notify(n,i,s)}setLogPosition(n){this.logContainerClass="alertify-logs "+n}setupLogContainer(){let n=document.querySelector(".alertify-logs"),i=this.logContainerClass;return n||(n=document.createElement("div"),n.className=i,this.parent.appendChild(n)),n.className!==i&&(n.className=i),n}notify(n="",i,s){let o=this.setupLogContainer(),a=document.createElement("div");a.className=i||"default",this.logTemplateMethod?a.innerHTML=this.logTemplateMethod(n):a.innerHTML=n,typeof s=="function"&&a.addEventListener("click",s),o.appendChild(a),setTimeout(()=>{a.className+=" show"},10),this.close(a,this.delay)}setup(n){let i=document.createElement("div");i.className="alertify hide",i.innerHTML=this.build(n);let s=i.querySelector(".ok"),o=i.querySelector(".cancel"),a=i.querySelector("input"),u=i.querySelector("label"),c=m=>{m.which===27&&(o?o.click():s.click(),document.removeEventListener("keyup",c))};document.addEventListener("keyup",c),a&&(typeof this.promptPlaceholder=="string"&&(u?u.textContent=this.promptPlaceholder:a.placeholder=this.promptPlaceholder),typeof this.promptValue=="string"&&(a.value=this.promptValue));let l=()=>a&&n.type&&n.type==="prompt",h=m=>{typeof m!="function"&&(m=()=>{}),s&&s.addEventListener("click",w=>{if(l()&&n.isValid&&typeof n.isValid=="function"&&!n.isValid(a?.value)){a?.classList.add("invalid");return}n.onOkay&&typeof n.onOkay=="function"&&(a?n.onOkay(a.value,w):n.onOkay(w)),m(a?{buttonClicked:"ok",inputValue:a.value,event:w}:{buttonClicked:"ok",event:w}),mo(i)}),o&&o.addEventListener("click",w=>{n.onCancel&&typeof n.onCancel=="function"&&n.onCancel(w),m({buttonClicked:"c
33ancel",event:w}),mo(i)}),a&&a.addEventListener("keyup",w=>{w.which===13&&s.click()})},d;return typeof Promise=="function"?d=new Promise(h):h(),this.parent.appendChild(i),setTimeout(()=>{i.classList.remove("hide"),l()?(a?.select(),a?.focus()):s&&s.focus()},100),d}okBtn(n){return this.okLabel=n,this}setDelay(n){return n=n||0,this.delay=isNaN(n)?this.defaultDelay:parseInt(n,10),this}cancelBtn(n){return this.cancelLabel=n,this}setMaxLogItems(n){this.maxLogItems=parseInt(n||this.defaultMaxLogItems,10)}theme(n){switch(n.toLowerCase()){case"bootstrap":this.dialogs.buttons.ok="<button class='ok btn btn-primary' tabindex='1'>{{ok}}</button>",this.dialogs.buttons.cancel="<button class='cancel btn btn-default' tabindex='2'>{{cancel}}</button>",this.dialogs.input="<input type='text' class='form-control'>";break;case"purecss":this.dialogs.buttons.ok="<button class='ok pure-button' tabindex='1'>{{ok}}</button>",this.dialogs.buttons.cancel="<button class='cancel pure-button' tabindex='2'>{{cancel}}</button>";break;case"mdl":case"material-design-light":this.dialogs.buttons.ok="<button class='ok mdl-button mdl-js-button mdl-js-ripple-effect'  tabindex='1'>{{ok}}</button>",this.dialogs.buttons.cancel="<button class='cancel mdl-button mdl-js-button mdl-js-ripple-effect' tabindex='2'>{{cancel}}</button>",this.dialogs.input="<div class='mdl-textfield mdl-js-textfield'><input class='mdl-textfield__input'><label class='md-textfield__label'></label></div>";break;case"angular-material":this.dialogs.buttons.ok="<button class='ok md-primary md-button' tabindex='1'>{{ok}}</button>",this.dialogs.buttons.cancel="<button class='cancel md-button' tabindex='2'>{{cancel}}</button>",this.dialogs.input="<div layout='column'><md-input-container md-no-float><input type='text'></md-input-container></div>";break;case"default":default:this.dialogs.buttons.ok=this.defaultDialogs.buttons.ok,this.dialogs.buttons.cancel=this.defaultDialogs.buttons.cancel,this.dialogs.input=this.defaultDialogs.input;break}}reset(){this.parent=document.body,this.theme("default"),this.okBtn(this.defaultOkLabel),this.cancelBtn(this.defaultCancelLabel),this.setMaxLogItems(),this.promptValue="",this.promptPlaceholder="",this.delay=this.defaultDelay,this.setCloseLogOnClick(this.closeLogOnClickDefault),this.setLogPosition("bottom left"),this.logTemplateMethod=null}injectCSS(){if(!document.querySelector("#alertifyCSS")){let n=document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",i.id="alertifyCSS",i.innerHTML="/* style.css */",n.insertBefore(i,n.firstChild)}}removeCSS(){let n=document.querySelector("#alertifyCSS");n&&n.parentNode&&n.parentNode.removeChild(n)}};e.\u0275fac=function(i){return new(i||e)(P(ye))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var Uf=(()=>{let e=class e{constructor(n,i){this.alertify=n,this.translate=i,this.notificationMessages={},this.alertify.setDelay(5e3),this.alertify.setLogPosition("top left");let s=["NOTIFICATIONS"];this.translate.onLangChange.subscribe(()=>{this.translate.get(s).subscribe(o=>{this.notificationMessages=o})})}notify(n,i){this.alertify.setDelay(5e3),this.alertify.setLogPosition("top left");let s=this.getTextMessage(n,i);this.alertify.log(s)}notifyUserMessage(n,i,s){this.alertify.setDelay(8e3),this.alertify.setLogPosition("down left");let o=this.msgUserTemplate(n,i,s);this.alertify.log(o)}msgTemplate(n,i,s){return s=s===void 0?"":s,'<div class="notification"><div class="wrapicon"><span class="'+n+'"></span></div><p class="notification-text '+s+'">'+i+"</p></div>"}msgUserTemplate(n,i,s){return`<div class='notification-message'>
34                            <div class='user'>
35                                <img class='profile-picture' src="${n}" alt="${i[0]?i[0].toLocaleUpperCase():""}"/>
36                            </div>
37                            <div class='message-text'>
38                              <h2 class='username'>${i}</h2>
39                              <p>${s}</p>
40                            </div>
41                    </div>`}getTextMessage(n,i){let s,o;switch(n){case"addSmartList":if(!i)o=this.notificationMessages.NOTIFICATIONS.addSmartList;else{let a=i.user_name?`<strong>${i.user_name}</strong>`:null;a?o=`${a} ${this.notificationMessages.NOTIFICATIONS.addSong} <strong>${i.name}</strong>  ${this.notificationMessages.NOTIFICATIONS.of} <strong>${i.artist}</strong> ${this.notificationMessages.NOTIFICATIONS.toList}`:o=this.notificationMessages.NOTIFICATIONS.addSmartList}s=this.msgTemplate("smart-list-icon",o);break;case"addFriendList":o="\xA1<strong>"+(i.userNotification||i.name||"Una persona")+`</strong> ${this.notificationMessages.NOTIFICATIONS.intoParty}!`,s=this.msgTemplate("addfriend-icon",o);break;case"readyForStickers":o="\xA1Env\xEDen stickers desde el celular para calificar al cantante!",s=this.msgTemplate("check-icon",o);break;case"nowYouCanSing":o="\xA1Ahora todos pueden cantar sin l\xEDmites!",s=this.msgTemplate("check-icon",o);break;case"errorOnVideo":o="\xA1Ha ocurrido un error con el video, a continuaci\xF3n se reproducir\xE1 la siguiente canci\xF3n de la lista \xA1a cantar!",s=this.msgTemplate("exclamation-icon",o);break;case"errorCustom":o=i.message||i.error||"Ha ocurrido un error",s=this.msgTemplate("exclamation-icon",o);break;case"onlyPremium":o=this.notificationMessages.NOTIFICATIONS.onlyPremium,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"errorGateway":o=i.message,s=this.msgTemplate("exclamation-icon",o);break;case"redirectToGateway":o=this.notificationMessages.NOTIFICATIONS.redirectToGateway,s=this.msgTemplate("exclamation-icon",o);break;case"addFavorite":o=i.message,s=this.msgTemplate("addfavorite-icon",o);break;case"requestSong":o=this.notificationMessages.NOTIFICATIONS.requestSong,s=this.msgTemplate("check-icon",o,"two-line");break;case"promoTicketSingSong":o=this.notificationMessages.NOTIFICATIONS.promoTicketSingSong,s=this.msgTemplate("check-icon",o,"two-line");break;case"smsSended":o=this.notificationMessages.NOTIFICATIONS.sms_sended,s=this.msgTemplate("check-icon",o,"two-line");break;
41case"smsInvalidNumberError":o=this.notificationMessages.NOTIFICATIONS.sms_invalid_number_error,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"smsSendMessageError":o=this.notificationMessages.NOTIFICATIONS.sms_send_message_error,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"smsCodeVerificationError":o=this.notificationMessages.NOTIFICATIONS.sms_code_verification_error,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"smsFastPurchase":o=this.notificationMessages.NOTIFICATIONS.sms_fast_purchase,s=this.msgTemplate("check-icon",o,"two-line");break;case"tryConnectFail":o=this.notificationMessages.NOTIFICATIONS.tryAddFavorite,s=this.msgTemplate("check-icon",o,"two-line");break;case"tryAddFavorite":o=this.notificationMessages.NOTIFICATIONS.tryAddFavorite,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"onlyPremiumPlay":o=this.notificationMessages.NOTIFICATIONS.onlyPremiumPlay,s=this.msgTemplate("lock-icon",o,"two-line");break;case"onlyPremiumAdd":o=this.notificationMessages.NOTIFICATIONS.onlyPremiumAdd,s=this.msgTemplate("lock-icon",o,"two-line");break;case"onlyPremiumPlaylist":o=this.notificationMessages.NOTIFICATIONS.onlyPremiumPlaylist,s=this.msgTemplate("lock-icon",o,"two-line");break;case"winTickets":o=this.notificationMessages.NOTIFICATIONS.winTickets1+i.number+this.notificationMessages.NOTIFICATIONS.winTickets2,s=this.msgTemplate("concert-icon",o,"two-line");break;case"winTicketsWelcome":o=this.notificationMessages.NOTIFICATIONS.winTicketsWelcome,s=this.msgTemplate("concert-icon",o,"two-line");break;case"TicketsWelcome":o=this.notificationMessages.NOTIFICATIONS.TicketsWelcome,s=this.msgTemplate("concert-icon",o,"two-line");break;case"removeFriendList":o="<strong>"+(i.userNotification||i.nickname)+'</strong> abandon\xF3 la <span style="color: #f42434">FIESTA</span>.',s=this.msgTemplate("lessfriend-icon",o);break;case"afterWelcomeModal":o=this.notificationMessages.NOTIFICATIONS.afterWelcomeModal,s=this.msgTemplate("check-icon",o,"two-line");break;case"inviteFriends":o=this.notificationMessages.NOTIFICATIONS.inviteFriends,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"alertNoSongs":o=this.notificationMessages.NOTIFICATIONS.alert_No_Songs,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"favoritesVoid":o=this.notificationMessages.NOTIFICATIONS.favoritesVoid,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"otherListVoid":o=this.notificationMessages.NOTIFICATIONS.otherListVoid,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"welcomeExplorer":o=this.notificationMessages.NOTIFICATIONS.welcomeExplorer,s=this.msgTemplate("check-icon",o,"two-line"),setTimeout(()=>{this.notify("downloadApp")},2e4);break;case"downloadApp":o=this.notificationMessages.NOTIFICATIONS.downloadApp,s=this.msgTemplate("appmovil-icon",o,"two-line");break;case"registerPassMail":o=this.notificationMessages.NOTIFICATIONS.registerPassMail,s=this.msgTemplate("email-icon",o,"two-line");break;case"failPaymentMail":o=this.notificationMessages.NOTIFICATIONS.registerPassMail,s=this.msgTemplate("email-icon",o,"two-line");break;case"resetPassMail":o=this.notificationMessages.NOTIFICATIONS.resetPassMail,s=this.msgTemplate("email-icon",o,"two-line");break;case"failresetPassMail":o=this.notificationMessages.NOTIFICATIONS.failresetPassMail,s=this.msgTemplate("check-icon",o);break;case"slowNetwork":o=this.notificationMessages.NOTIFICATIONS.slowNetwork,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"notAvailableOnCountry":o=this.notificationMessages.NOTIFICATIONS.notAvailableOnCountry,s=this.msgTemplate("exclamation-icon",o,"two-line");break;case"errorCheck":o=i.message,s=this.msgTemplate("exclamation-icon",o);break;default:}return s}};e.\u0275fac=function(i){return new(i||e)(P(hw),P(ko))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var Ui=(()=>{let e=class e{constructor(n,i,s,o,a){this.injector=n,this.location=i,this.platform=s,this.request=o,this.response=a,this.doc=this.injector.get(Eo),this.host=this.platform.isServer()?this.request?.headers["x-forwarded-host"]||this.request?.headers.host||"":this.doc.location.hostname,this.port=this.platform.isServer()?this.request?.headers["x-forwarded-port"]||"":this.doc.location.port,this.host.indexOf("localhost")!==-1&&this.host.indexOf("localhost:")===-1&&(this.host=this.host+":"+this.port),this.protocol=this.platform.isServer()?this.request?.headers["x-forwarded-proto"]||this.request?.protocol||"":this.doc.location.protocol,this.protocol=this.protocol.toString().replace(":",""),this.useragent=this.platform.isServer()?(this.request?.headers["user-agent"]||"")?.toString():navigator.userAgent}
41get currentUrl(){return this.protocol+"://"+this.host+this.location.path()}get currentPath(){return this.location.path()}static getUrlParameterFromURL(n,i){i=i.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");let o=new RegExp("[\\?&]"+i+"=([^&#]*)").exec(n);return o===null?"":decodeURIComponent(o[1].replace(/\+/g," "))}getUrlParameter(n){return e.getUrlParameterFromURL(this.currentUrl,n)}removeUrlParameter(n,i){let s=new URL(this.currentUrl);return s.searchParams.delete(n),this.platform.isServer()&&!i?this.injector.get($r).redirect(s.toString()):this.doc.location.href=s.toString(),s.toString()}redirect(n){if(this.platform.isServer()){this.injector.get($r).redirect(n);return}this.doc.location.href=n}reload(){this.platform.isServer()?this.injector.get($r).redirect(this.currentUrl):this.doc.location.reload()}};e.\u0275fac=function(i){return new(i||e)(P(wo),P(ip),P(ye),P(ur,8),P($r,8))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var SC=r=>r.charAt(0).toUpperCase()+r.slice(1);var dw=(r,e)=>{let t=!1,n=r.split("?")[0].split("/"),i=[...e];if(n.length>=2){let[s,...o]=n;n=[...o]}for(let s of i){if(n.length>=1){if(n.includes(s)){t=!0;break}t=!1}t=!1}return t},AC=(r,e,t=!1)=>{let n=`pl${r}-${e.toLowerCase().replaceAll(" ","-")}`;return t?`${e.toLowerCase().replaceAll(" ","-")}`:n},kC=(r,e)=>e.every(t=>{let n=r.get(t.key);return!!n&&n===t.value});var fw=(()=>{let e=class e{constructor(){}sanitizePersonalData(n){let i={},s=["email","Email","first_name","last_name","name","id","picture","phone","address","body","payment_method","credit_card","last_name"];return n&&Object.keys(n).forEach(o=>{s.includes(o)||(i[o]=n[o])}),i}track(n,i){window.fbq("track",n,this.sanitizePersonalData(i))}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var pw=(()=>{let e=class e{constructor(n){this.platform=n,this.isGtagInitialized=!1}initializeGtag(){if(this.platform.isBrowser()){if(gtag){this.isGtagInitialized=!0,console.log("gtag is initailized?:",this.isGtagInitialized);return}this.isGtagInitialized=!1,console.log("gtag is initailized?:",this.isGtagInitialized)}}gEvent(n,i){if(this.isGtagInitialized)return gtag("event",n,i)}gtag(n,i,s){if(this.isGtagInitialized)return gtag(n,i,s)}sendDataLayerEvent(n,i){if(this.isGtagInitialized)return gtag("event",n,i)}};e.\u0275fac=function(i){return new(i||e)(P(ye))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var mw=(()=>{let e=class e{constructor(){}identify(n,i){hj("identify",i||null,n)}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var Bi=(()=>{let e=class e{constructor(n,i,s,o,a,u,c,l){this.googleAnalytics=n,this.mxp=i,this.hotjar=s,this.facebook=o,this.platform=a,this.localStorage=u,this.location=c,this.customerIo=l,this.enabledTracking={google:!1,mixpanel:!0,hotjar:!1,facebook:!0},this._registerMpxImitation={},this.identifyDebounce=B0(this.identifyFn,500)}sendEvent(n,i){this.platform.isBrowser()&&(this.sendCleanedEvent(n,i),this.enabledTracking.facebook&&this.facebook.track(n,i))}sendCleanedEvent(n,i){return S(this,null,function*(){let s=rc(i);s&&(s.time&&delete s.time,s.email&&!s.Email&&(s.Email=s.email,delete s.email,this.unregister("email")),s.token&&(s.tokenX=s.token,delete s.token)),this.mxp.sendEvent(n,s),yield this.customerIo.sendEvent(n,U(U({},this._registerMpxImitation),s))})}getDistinctId(){return this.mxp.distinct_id}setParametersDevices(n,i){i.authenticated&&this.hotjar.identify(U({},i.currentUser),i.currentUser?.id)}reset(){this.mxp.resetMxp(),this.customerIo.reset(),this._registerMpxImitation={}}abrioApp(n){if(this.platform.isBrowser()){let i=0,s=new Date,o=this.localStorage.getItem("lastVisitCount"),a=o?new Date(o):null;if(i=parseInt(this.localStorage.getItem("visitCount")||"0",10)||0,Number.isNaN(i)&&(i=0),!a||isNaN(a.getTime())?(this.localStorage.setItem("lastVisitCount",s.toISOString()),i++):(s.getTime()-a.getTime())/1e3>3600&&(this.localStorage.setItem("lastVisitCount",s.toISOString()),i++),!this.excludeRoutes()){let u=U({},n&&{"Serial Number":n});u["Current Local Storage"]={TVDUID:this.localStorage.getItem("TVDUID"),tokenTv:this.localStorage.tokenTv,user_id:this.localStorage.user_id,tokenUser:this.localStorage.tokenUser,country:this.localStorage.country,emailUsed:this.localStorage.emailUsed},u["Current Cookies"]=document.cookie,this.sendEvent("abrioApp",u)}this.localStorage.setItem("visitCount",i.toString())}}register(n,i){let s=rc(n);s.email&&!s.Email&&(s.Email=s.email,delete s.email,this.unregister("email")),this.mxp.register(s,i),this._registerMpxImitation=U(U({},this._registerMpxImitation),s)}peopleSet(n){this.mxp.peopleSet(n)}peopleIncrement(n,i){this.mxp.peopleIncrement(n,i)}unregister(n){this.mxp.unregister(n),delete this._registerMpxImitation[n]}ViewModals(n){n&&this.sendEvent("ViewModals-"+n)}viewClicked(n,i){i&&n==="btnPayment"&&i.from==="modal"||this.sendEvent(n,i)}errorVideo(n,i,s){let o=s.src;s.src||(o=s.sources&&s.sources.length?s.sources[0].src:s),this.sendEvent("error
41Video",{codeError:n,messageError:i,url:o,name:s.title,idSong:s.id,artist:s.artist})}unregisterUser(){this.unregister("idUser"),this.unregister("email"),this.unregister("phone"),this.unregister("Premium"),this.unregister("fullName")}identify(n,i){return S(this,null,function*(){if(!this.platform.isBrowser())return;this.identifyDebounce.cancel();let s=i||n.id||n.idUser,o=n.email||n.Email,a={"Personal ID":n.cfi,Email:o,kanto_id:s,"FB ID":n.fb_id,"First Name":n.first_name,"User ID":s,"Email Valid":n.is_valid,"Is Follow":n.is_follow,"Last Name":n.last_name,Username:n.user_name,Premium:n.premium,"User Token":n.token,"Profile Picture":n.img,"Phone Number":n.phone_number,Address:n.address};this._registerMpxImitation=U(U({},this._registerMpxImitation),a),yield this.identifyDebounce.debounced({hotjar:{identify:this.hotjar.identify.bind(this.hotjar),data:U(U({},this._registerMpxImitation),n)},mxp:{identify:this.mxp.identify.bind(this.mxp),data:U({},a)},customerIo:{identify:this.customerIo.identify.bind(this.customerIo),data:U({},this._registerMpxImitation)}},i).catch(u=>{console.error("this.metrics.identify  error",u)})})}activeTrackingGoogleAnalitics(n){}excludeRoutes(n=[]){let i=["lyrics",...n];return dw(this.location.currentPath,i)}sendGoogleDataLayerEvent(n,i){this.googleAnalytics.sendDataLayerEvent(n,i)}identifyFn(n,i){return S(this,null,function*(){n.hotjar.identify(n.hotjar.data,i),n.mxp.identify(n.mxp.data,i),yield n.customerIo.identify(n.customerIo.data,n.customerIo.data.Email)})}};e.\u0275fac=function(i){return new(i||e)(P(pw),P(qf),P(mw),P(fw),P(ye),P(He),P(Ui),P(_f))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var Qu=class extends Error{constructor(e){super(e),this.name="InvalidSessionCodeError"}};var gw="session",$f=(()=>{let e=class e{constructor(n,i,s,o,a,u,c,l){this.api=n,this.afs=i,this.localStorage=s,this.location=o,this.platform=a,this.state=u,this.metrics=c,this.notifications=l,this.session$=new et(null),this.sessionPremium=!1,this.showPayment=!0;let h=this.state.get(gw,null);h&&this.setSessionData(h)}get currentSession(){return this.session$.value}initSession(n){let i;(this.localStorage.tokenTv||this.localStorage.session)&&(this.localStorage.session?i=this.localStorage.session.token:i=this.localStorage.tokenTv);let s={tv_id:"TEMPORAL",token_tv:i,is_bar:!0,name_bar:"kanto"},o;return this.session$.value?(o=Z(this.currentSession).pipe(Me()),o.subscribe(a=>{this.metrics.register(a)},a=>{console.error("ERROR",a)})):(s.token_tv||delete s.token_tv,o=this.api.post("sessions/init",s,Le.apiExtraHeaders).pipe(Dn(1e4),pe(a=>a.success?Z(a.data):De({name:"DataSendedError",message:a.message||"Ocurrio un error inesperado"})),Zf(a=>a.pipe(Xf(u=>u.status===401||u.status===500?(console.log(new Date,"Ocurre error 401 o  500",s,u),s=_p(s,["user_id"]),this.localStorage.removeItem("tokenUser"),this.localStorage.removeItem("user_id"),this.platform.isBrowser()&&(console.log("estoy relogueandomeeeeeeee"),location.reload()),Z(u)):(console.log(new Date,"Ocurrio otro tipo de error en init session",u),De(u))))),se(a=>(a.is_anonymous=this.isSessionAnonymous(a),a)),Me()),o.subscribe(a=>{this.metrics.register(a)},a=>{console.error("ERROR",a)})),o.subscribe(a=>{a.is_anonymous=this.isSessionAnonymous(a),this.setSessionData(a)},a=>{this.metrics.sendEvent("errorOnInit",{name:a.name,message:a.message,body_request:s}),this.session$.error(a)}),o}isSessionAnonymous(n){return n.session_tv?!n.id:!0}setSessionData(n){n.is_anonymous=this.isSessionAnonymous(n),this.state.set(gw,n),n.is_anonymous?(this.localStorage.session=JSON.stringify(n),this.localStorage.tokenTv=n.token,this.loadFirebaseSession(n)):(this.localStorage.session=JSON.stringify(n.session_tv),this.localStorage.tokenTv=n.session_tv.token,this.loadFirebaseSession(n))}deleteSession(){this.session$.next(null)}getSessionInfoByCode(n,i){return this.api.get("session",{code:n},Le.apiExtraHeaders).pipe(pe(s=>s.success?Z(s.data):s.error_code==="session_invalid_code"?De(new Qu("Invalid session code")):De(s)))}logoutSession(n,i){let s={tv_id:n,is_bar:!0,name_bar:"Karaokesmart",token_tv:i},o={headers:new op({"Content-Type":"application/json"}),body:s},a=this.api.delete("sessions/init",o).pipe(pe(c=>c.success?Z(c.data):De(c.message?c:{message:"Ocurrio un error inesperado"})),se(c=>(this.sessionSub&&this.sessionSub.unsubscribe(),this.deleteSession(),c
41)),se(c=>(c.is_anonymous=this.isSessionAnonymous(c),c)),Me()),u=a.subscribe(c=>{c.is_anonymous=this.isSessionAnonymous(c),this.setSessionData(c),u&&u.unsubscribe()},c=>{this.metrics.sendEvent("errorOnLogout",{name:c.name,message:c.message,body_request:s}),this.session$.error(c),u&&u.unsubscribe()});return a}getQR(){return this.currentSession?this.currentSession.session_tv?this.currentSession.session_tv.qr:this.currentSession.qr:null}getSessionFireBase(n){return this.afs.doc("sessions/"+this.getSessionToken(n))}getSessionToken(n){return n?n&&n.session_tv?n.session_tv.token:n.token:null}loadFirebaseSession(n){this.platform.isBrowser()&&(this.sessionDoc=this.getSessionFireBase(n),this.session=this.sessionDoc.valueChanges().pipe(Me()),this.messagesCollection=this.sessionDoc.collection("messages"),this.photosCollection=this.sessionDoc.collection("photos"),this.sessionSub=this.session.subscribe(i=>{i&&(this.sessionPremium=i.is_premium)})),this.session$.next(n)}mapMessagesFunction(){return n=>n.map(i=>{let s=i.payload.doc.data(),o=i.payload.doc.id;return s.id=o,i.payload.type==="added"&&(s.picture=this.getPictureUrlFromFBID(s.fb_id,s.user),this.notifications.notifyUserMessage(s.picture,s.user,s.text)),s})}getPictureUrlFromFBID(n,i){return q0(n,i)}deletePhoto(n){this.photosCollection?.doc(n.id).delete()}sendRemoteAction(n,i,s){let u=this.afs.collection("sessions").doc(n).collection("actions").doc("currentAction"),c={action:i,data:s,createdAt:new Date,done:!1};return u.set(c).then(()=>c)}updateSessionData(n,i){return this.afs.collection("sessions").doc(n).update(i)}moveTvRouteTo(n){return S(this,null,function*(){let i=yield this.getSessionInfoByCode(n.code).toPromise();return this.afs.collection("sessions").doc(i?.token).update({moveTvRouteTo:n.path})})}verifyCodeAndSetupSessions(n,i,s){if(!n||n.length!==5)return Z({success:!1,error:{message:"C\xF3digo no proporcionado"}});let o=this.currentSession,a=i.currentUser;return this.getSessionInfoByCode(n).pipe(pe(u=>S(this,null,function*(){let c=u,l=c?.user;try{if(c?.user&&(c?.user?.session_tv||(c.user.session_tv={id:0,token:c.token,qr:n,is_active:!0,tv_id:"",is_anonymous:!1}),!a||a?.user_id!==l?.user_id))try{let d=yield i.loginWithCode(n).toPromise();this.setSessionData(nt(U({},d),{session_from_tv:!0}))}catch{console.error("error login tv to web")}if(o&&!o.session_from_tv)try{yield this.getSessionInfoByCode(n,o.token).toPromise(),this.setSessionData(nt(U({},o),{session_from_tv:!1}))}catch{console.error("error login web to tv")}c&&(this.showPayment=c.show_payment);let h=this.buildNavigationParams(s);return{success:!0,tvSession:c,navigationParams:h,code:n}}catch(h){return console.error("Error en verifyCode"),{success:!1,error:U({message:h?.message||"Error desconocido"},h),code:n}}})),$t(u=>(console.error("ERROR en verifyCodeAndSetupSessions"),Z({success:!1,error:{message:u?.message||"Error desconocido al verificar c\xF3digo"},code:n}))))}buildNavigationParams(n){let i={isRegisterOneWay:"active",showPayment:this.showPayment};return n&&Object.entries(n).forEach(([s,o])=>{i[s]=o}),i}};e.\u0275fac=function(i){return new(i||e)(P(zt),P(ao),P(He),P(Ui),P(ye),P(Io),P(Bi),P(Uf))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var _w="DDUID",yw=(()=>{let e=class e{constructor(n,i,s,o,a){if(this.localStorage=n,this.metrics=i,this.state=s,this.platform=o,this.request=a,this.DUID=new et(void 0),this.DUID.next(this.state.get(_w,void 0)),this.platform.isBrowser()){this.device=document.getElementById("device");try{typeof window.webapis<"u"&&(this.device=window.deviceB.device)}catch(u){console.log("error deviceks",u)}}else if(this.platform.isServer()){let u=this.localStorage.getItem("DUID");u||(u=this.generateRamdomDUID()),this.device={serialNumber:u},this.setDUID(u)}}get currentDUID(){return this.DUID.value||this.localStorage.getItem("DUID")}setDevice(){this.platform.isBrowser()&&(this.device=document.getElementById("device"))}generateRamdomDUID(){return Math.random().toString(36).replace("0.","")+Math.random().toString(36).replace("0.","")}setDUID(n){this.state.set(_w,n),this.localStorage.setItem("DUID",n),this.DUID.next(n)}getSerialNumber(){return S(this,null,function*(){if(this.platform.isServer())return Promise.resolve(this.currentDUID);let n=this.generateRamdomDUID(),i=this.device.serialNumber?this.device.serialNumber:n||"newTestWebLocalHost";return this.currentDUID||this.setDUID(i),this.setDUID(this.currentDUID),Promise.resolve(this.currentDUID)})}};e.\u0275fac=function(i){return new(i||e)(P(He),P(Bi),P(Io),P(ye),P(ur,8))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();var ji=()=>r=>r.pipe(pe(e=>e.success===!0?Z(e.data):De(e.message?e:{code:"unknown",message:"Ocurrio un error inesperado"})),$t(e=>e.status?De(e.message?e:{code:e.status,message:"Ocurrio un error inesperado"}):De(e.message?e:{code:"unknown",message:"Ocurrio un error inesperado"})));var Hu=(()=>{let e=class e{get currentLang(){return this.currentLang$.getValue()}constructor(){this.currentLang$=new et(e.DEFAULT_LANG)}setCurrentLang(n){this.currentLang$.next(n)}};e.DEFAULT_LANG="en",e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var bS=(()=>{let e=class e{constructor(n,i,s,o,a,u,c,l,h,d){this.country=n,this.device=i,this.api=s,this.metrics=o,this.translate=a,this.translateConfig=u,this.location=c,this.localStorage=l,this.platform=h,this.sessionService=d,this.user$=new et(void 0),this.readyState=new et(!1),this.newly=!1,this.userLoginOK=new xn,this.dataSubscriptionEmpty={card:{brand:null,last4:null,expiration:null}
41,subscription:{id:null,start:null,end:null,status:null,trial_days:null,next_payment:null},plan:{name:null,type:null,id:null,currency:null,price_recurrent:null,price:null}}}doReload(){document.write(""),location.reload()}onRetry(n){return n.keyCode===13?(window.doReload(),!1):(document.getElementById("retry-btn")?.focus(),!1)}setViewPayment(){this.api.post("send/notification/",{token:this.getLocalSession().token}).subscribe()}get authenticated(){return this._user!==null&&this._user!==void 0}get currentUser(){return this.authenticated?this._user:null}get premium(){return this.currentUser&&this.currentUser.premium}get isFreemium(){return this.authenticated&&!this.premium}login(n){let i=this.api.post("accounts/signin",n,Le.apiExtraHeaders).pipe(se(s=>(s.success===!0&&(s.data.created=s.created),s)),ji(),$t(this.handleError.bind(this))).pipe(Me());return i.subscribe(s=>{this.metrics.register(s),this._loggedIn(s)},s=>{console.log(s)}),i}loginWithCode(n){let i=this.api.get("session",{code:n,ramdom:Math.random()*10},Le.apiExtraHeaders).pipe(pe(s=>s.success?(s.data.created=s.data?.created||s.data?.is_register||s.data.signup,s.data&&s.data.user&&(s.data.user.created=s.data?.created||s.data?.is_register||s.data.signup),Z(s.data)):De(s)),se(s=>{let o={id:this.sessionService.currentSession?.session_tv?.id||this.sessionService.currentSession?.id,is_active:!0,qr:s.qr,token:s.token,tv_id:this.device.currentDUID,is_anonymous:!1,session_from_tv:this.sessionService.currentSession?.session_from_tv||!1};return nt(U({},s.user),{session_tv:o})}),$t(this.handleError.bind(this)));return i.subscribe(s=>{this.metrics.register(s),this._loggedIn(s)},s=>{console.log(s)}),i}signup(n){let i=this.api.post("accounts/signup",n,Le.apiExtraHeaders).pipe(se(s=>(s.success===!0&&(s.data.created=s.created),s)),ji(),$t(this.handleError.bind(this))).pipe(Me());return i.subscribe({next:s=>{this.metrics.register(s),this._loggedIn(s)},error:s=>{console.error("ERROR",s)}}),i}isEmailRegistered(n){return this.api.post("user/check",{email:n}).pipe(ji())}sendValidateEmail(n){return this.api.post("account/email",{email:n}).pipe(ji())}sendValidatePhone(n,i){return this.api.post("account/verify",{phone:n,token_captcha:i}).pipe(ji())}recovery(n){let i={email:n};return this.api.post("password/reset",i).pipe(se(o=>o)).pipe(Me())}updateToPremium(){if(this._user){this._user.premium=!0,this.currentUser&&(this.currentUser.payment=void 0);let n=this.getInfoComplety().pipe(Me());return n.subscribe(i=>{console.log(" *** updateToPremium ",i),i.success?this.setDataPaymentUser(i.data.payment):this.currentUser&&(this.currentUser.payment=void 0)}),this.metrics.register({Premium:this._user.premium}),n}return Z(!0)}logout(){let n=this.localStorage.tokenTv;return this.sessionService.logoutSession(this.device.currentDUID,n).toPromise().then(i=>{this.localSession=null,this.localStorage.removeItem("user_id"),this.localStorage.removeItem("tokenUser"),this.localStorage.removeItem("userSelectCountry"),this.metrics.reset(),this.user$.next(void 0),this.localSession=i,this._user=null})}initUser(n){n.is_anonymous?(this.localSession=n,this._user=null):(this.localSession=n.session_tv,this._loggedIn(n)),this.readyState.next(!0)}_loggedIn(n){this._user=n;let i=n.country;i&&this.country.currentCountry!==i&&this.country.setCountry(i),this.setLanguageForCountry(),this.user$.next(this._user),this._user.session_tv&&(this.localSession=this._user.session_tv,this.localStorage.setItem("session",JSON.stringify(this._user.session_tv)),this.localStorage.tokenTv=this._user.session_tv.token),this._user.token&&this._user.token!=="undefined"&&(this.localStorage.tokenUser=this._user.token,this.localStorage.user_id=this._user.id),this.platform.isBrowser()&&(this.callKeepalive(this.getSessionToken()),this.metrics.identify(n,n?.user_id))}setLanguageForCountry(){let n=Hu.DEFAULT_LANG,i=this.location.getUrlParameter("lang");this.translate.setDefaultLang(n);let s=oc.countriesConfig[this.country.currentCountry?.toUpperCase?.()]?.lang??n;i&&(s=i.toLowerCase()),s=s.slice(0,2),this.translateConfig.setCurrentLang(s),this.translate.use(s),this.metrics.register({language:s})}callKeepalive(n){let s=()=>{this.api.post("sessions/keepalive",{token:n}).subscribe(o=>{o.success===!1&&location.reload()})};clearInterval(this.keepAliveInterval),this.keepAliveInterval=setInterval(s,18e5)}selectPlanForPurchase(n){return S(this,null,function*(){return this.sessionService.sessionDoc?.update({selectedPlanForPurchase:n})})}getPlans(){return Z(this._user?this._user.plans:void 0)}getLocalSession(){return this.localSession}getSessionToken(){return!this._user&&!this.localSession?null:this._user&&this._user.session_tv?this._user.session_tv.token:this.localSession?this.localSession.token:null}getSessionQR(){return!this._user&&!this.localSession?null:this._user&&this._user.session_tv?this._user.session_tv.qr:this.localSession?this.localSession.qr:null}mapPhotosFunction(){return n=>n.map(i=>{let s=i.payload.doc.data(),o=i.payload.doc.id;return s.id=o,i.payload.type,s})}onReady(n){return this.readyState.subscribe(i=>{i&&n()})}setDataPaymentUser(n){this.currentUser&&(this.currentUser.payment=n,this.currentUser.payment&&(this.currentUser.payment.subscription.end=new Date(this.currentUser.payment?.subscription?.end),this.currentUser.payment.subscription.start=new Date(this.currentUser.payment?.subscription.start)))}setPlans(n){this._user&&(this._user.plans=n)}changePass(n){return this.api.post("accounts/"+this.currentUser?.id+"/password/change",n)}sendEmailToReset(n){return this.api.post("password/reset",n)}getInfoComplety(){return this.api.get("subscription")}updateUserData(){return this.getInfoComplety().pipe(pe(i=>i.success?(this.setDataPaymentUser(i.data),Z(i.data)):i.success?De(i):(this.setDataPaymentUser(this.dataSubscriptionEmpty),Z(this.dataSubscriptionEmpty))),Me(),$t(()=>Z(this.dataSubscriptionEmpty)))}handleError(n){let i=n.error||n||{};return i.message=i.message||"Error desconocido",De(i)}};e.\u0275fac=function(i){return new(i||e)(P(Gi),P(yw),P(zt),P(Bi),P(ko),P(Hu),P(Ui),P(He),P(ye),P($f))},e.\u0275prov=$({token:e,factory:e.\u0275fac});let r=e;return r})();export{Gr as a,Kr as b,Fo as c,tt as d,Lo as e,Un as f,Bn as g,Qi as h,WA as i,qo as j,mc as k,gc as l,_c as m,yc as n,vc as o,wc as p,Ic as q,Ec as r,u1 as s,W1 as t,ye as u,hw as v,Lp as w,He as x,Gi as y,oc as z,Ui as A,hb as B,SC as C,dw as D,AC as E,kC as F,db as G,_f as H,qf as I,Uf as J,Iw as K,$f as L,ji as M,Hu as N,bS as O,fw as P,pw as Q,mw as R,Bi as S,yw as T};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.