text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).firebase=e()}(this,function(){"use strict";!function(t){if(!t.fetch){var e="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,s="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),r="FormData"in t,i="ArrayBuffer"in t;if(i)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=function(t){return t&&DataView.prototype.isPrototypeOf(t)},u=ArrayBuffer.isView||function(t){return t&&-1<o.indexOf(Object.prototype.toString.call(t))};d.prototype.append=function(t,e){t=l(t),e=f(e);var n=this.map[t];this.map[t]=n?n+","+e:e},d.prototype.delete=function(t){delete this.map[l(t)]},d.prototype.get=function(t){return t=l(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(l(t))},d.prototype.set=function(t,e){this.map[l(t)]=f(e)},d.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},d.prototype.keys=function(){var n=[];return this.forEach(function(t,e){n.push(e)}),p(n)},d.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),p(e)},d.prototype.entries=function(){var n=[];return this.forEach(function(t,e){n.push([e,t])}),p(n)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var c=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},b.call(w.prototype),b.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:0,statusText:""});return t.type="error",t};var h=[301,302,303,307,308];E.redirect=function(t,e){if(-1===h.indexOf(e))throw new RangeError("Invalid status code");return new E(null,{status:e,headers:{location:t}})},t.Headers=d,t.Request=w,t.Response=E,t.fetch=function(n,i){return new Promise(function(r,t){var e=new w(n,i),o=new XMLHttpRequest;o.onload=function(){var t,i,e={status:o.status,statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",i=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var e=t.split(":"),n=e.shift().trim();if(n){var r=e.join(":").trim();i.append(n,r)}}),i)};e.url="responseURL"in o?o.responseURL:e.headers.get("X-Request-URL");var n="response"in o?o.response:o.responseText;r(new E(n,e))},o.onerror=function(){t(new TypeError("Network request failed"))},o.ontimeout=function(){t(new TypeError("Network request failed"))},o.open(e.method,e.url,!0),"include"===e.credentials?o.withCredentials=!0:"omit"===e.credentials&&(o.withCredentials=!1),"responseType"in o&&s&&(o.responseType="blob"),e.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.send(void 0===e._bodyInit?null:e._bodyInit)})},t.fetch.polyfill=!0}function l(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach(function(t,e){this.append(e,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function v(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function y(n){return new Promise(function(t,e){n.onload=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function g(t){var e=new FileReader,n=y(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t)if("string"==typeof t)this._bodyText=t;else if(s&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(r&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(i&&s&&a(t))this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!i||!ArrayBuffer.prototype.isPrototypeOf(t)&&!u(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=m(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var t=v(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?v(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var t,e,n,r=v(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=y(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}function w(t,e){var n,r,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(n=e.method||this.method||"GET",r=n.toUpperCase(),-1<c.indexOf(r)?r:n),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function _(t){var i=new FormData;return t.trim().split("&").forEach(function(t){if(t){var e=t.split("="),n=e.shift().replace(/\+/g," "),r=e.join("=").replace(/\+/g," ");i.append(decodeURIComponent(n),decodeURIComponent(r))}}),i}function E(t,e){e=e||{},this.type="default",this.status=void 0===e.status?200:e.status,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}}("undefined"!=typeof self?self:void 0);var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t,e){return t(e={exports:{}},e.exports),e.exports}function n(t){return t&&t.Math==Math&&t}function y(t){try{return!!t()}catch(t){return!0}}function g(t){return"object"==typeof t?null!==t:"function"==typeof t}function r(t){return l?u.createElement(t):{}}function d(t){if(!g(t))throw TypeError(String(t)+" is not an object");return t}function o(t,e){if(!g(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!g(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!g(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!g(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}function w(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}function h(e,n){try{_(m,e,n)}catch(t){m[e]=n}return n}function c(t,e){return S.call(t,e)}function a(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++C+N).toString(36)}function i(t){return c(O,t)||(A&&c(P,t)?O[t]=P[t]:O[t]=R("Symbol."+t)),O[t]}var m=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")(),s=!1,f=!y(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),u=m.document,l=g(u)&&g(u.createElement),p=!f&&!y(function(){return 7!=Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a}),v=Object.defineProperty,b={f:f?v:function(t,e,n){if(d(t),e=o(e,!0),d(n),p)try{return v(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},_=f?function(t,e,n){return b.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},E="__core-js_shared__",I=m[E]||h(E,{}),T=e(function(t){(t.exports=function(t,e){return I[t]||(I[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})}),S={}.hasOwnProperty,C=0,N=Math.random(),A=!!Object.getOwnPropertySymbols&&!y(function(){return!String(Symbol())}),k=A&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,O=T("wks"),P=m.Symbol,R=k?P:P&&P.withoutSetter||a,D={};D[i("toStringTag")]="z";var x="[object z]"===String(D),L=Function.toString;"function"!=typeof I.inspectSource&&(I.inspectSource=function(t){return L.call(t)});function M(t){return W[t]||(W[t]=a(t))}var F,U,j,V=I.inspectSource,q=m.WeakMap,B="function"==typeof q&&/native code/.test(V(q)),W=T("keys"),H={},K=m.WeakMap;if(B){var G=new K,z=G.get,Q=G.has,X=G.set;F=function(t,e){return X.call(G,t,e),e},U=function(t){return z.call(G,t)||{}},j=function(t){return Q.call(G,t)}}else{var Y=M("state");H[Y]=!0,F=function(t,e){return _(t,Y,e),e},U=function(t){return c(t,Y)?t[Y]:{}},j=function(t){return c(t,Y)}}function $(t){return tt.call(t).slice(8,-1)}var J={set:F,get:U,has:j,enforce:function(t){return j(t)?U(t):F(t,{})},getterFor:function(n){return function(t){var e;if(!g(t)||(e=U(t)).type!==n)throw TypeError("Incompatible receiver, "+n+" required");return e}}},Z=e(function(t){var e=J.get,a=J.enforce,u=String(String).split("String");(t.exports=function(t,e,n,r){var i=!!r&&!!r.unsafe,o=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet;"function"==typeof n&&("string"!=typeof e||c(n,"name")||_(n,"name",e),a(n).source=u.join("string"==typeof e?e:"")),t!==m?(i?!s&&t[e]&&(o=!0):delete t[e],o?t[e]=n:_(t,e,n)):o?t[e]=n:h(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||V(this)})}),tt={}.toString,et=i("toStringTag"),nt="Arguments"==$(function(){return arguments}()),rt=x?$:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),et))?n:nt?$(e):"Object"==(r=$(e))&&"function"==typeof e.callee?"Arguments":r},it=x?{}.toString:function(){return"[object "+rt(this)+"]"};x||Z(Object.prototype,"toString",it,{unsafe:!0});function ot(t){return isNaN(t=+t)?0:(0<t?Et:_t)(t)}function st(t){if(null==t)throw TypeError("Can't call method on "+t);return t}function at(a){return function(t,e){var n,r,i=String(st(t)),o=ot(e),s=i.length;return o<0||s<=o?a?"":void 0:(n=i.charCodeAt(o))<55296||56319<n||o+1===s||(r=i.charCodeAt(o+1))<56320||57343<r?a?i.charAt(o):n:a?i.slice(o,o+2):r-56320+(n-55296<<10)+65536}}function ut(t){return At(st(t))}function ct(t){return"function"==typeof t?t:void 0}function ht(t,e){return arguments.length<2?ct(Pt[t])||ct(m[t]):Pt[t]&&Pt[t][e]||m[t]&&m[t][e]}function lt(t){return 0<t?Rt(ot(t),9007199254740991):0}function ft(c){return function(t,e,n){var r,i,o,s=ut(t),a=lt(s.length),u=(r=a,(i=ot(n))<0?Dt(i+r,0):xt(i,r));if(c&&e!=e){for(;u<a;)if((o=s[u++])!=o)return!0}else for(;u<a;u++)if((c||u in s)&&s[u]===e)return c||u||0;return!c&&-1}}function pt(t,e){var n,r=ut(t),i=0,o=[];for(n in r)!c(H,n)&&c(r,n)&&o.push(n);for(;e.length>i;)c(r,n=e[i++])&&(~Lt(o,n)||o.push(n));return o}function dt(t,e){for(var n=Vt(e),r=b.f,i=Ot.f,o=0;o<n.length;o++){var s=n[o];c(t,s)||r(t,s,i(e,s))}}function vt(t,e){var n=Wt[Bt(t)];return n==Kt||n!=Ht&&("function"==typeof e?y(e):!!e)}function yt(t,e){var n,r,i,o,s,a=t.target,u=t.global,c=t.stat;if(n=u?m:c?m[a]||h(a,{}):(m[a]||{}).prototype)for(r in e){if(o=e[r],i=t.noTargetGet?(s=zt(n,r))&&s.value:n[r],!Gt(u?r:a+(c?".":"#")+r,t.forced)&&void 0!==i){if(typeof o==typeof i)continue;dt(o,i)}(t.sham||i&&i.sham)&&_(o,"sham",!0),Z(n,r,o,t)}}function gt(t){return Object(st(t))}var mt,bt,wt,_t=Math.ceil,Et=Math.floor,It={codeAt:at(!1),charAt:at(!0)},Tt={}.propertyIsEnumerable,St=Object.getOwnPropertyDescriptor,Ct={f:St&&!Tt.call({1:2},1)?function(t){var e=St(this,t);return!!e&&e.enumerable}:Tt},Nt="".split,At=y(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==$(t)?Nt.call(t,""):Object(t)}:Object,kt=Object.getOwnPropertyDescriptor,Ot={f:f?kt:function(t,e){if(t=ut(t),e=o(e,!0),p)try{return kt(t,e)}catch(t){}if(c(t,e))return w(!Ct.f.call(t,e),t[e])}},Pt=m,Rt=Math.min,Dt=Math.max,xt=Math.min,Lt={includes:ft(!0),indexOf:ft(!1)}.indexOf,Mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ft=Mt.concat("length","prototype"),Ut={f:Object.getOwnPropertyNames||function(t){return pt(t,Ft)}},jt={f:Object.getOwnPropertySymbols},Vt=ht("Reflect","ownKeys")||function(t){var e=Ut.f(d(t)),n=jt.f;return n?e.concat(n(t)):e},qt=/#|\.prototype\./,Bt=vt.normalize=function(t){return String(t).replace(qt,".").toLowerCase()},Wt=vt.data={},Ht=vt.NATIVE="N",Kt=vt.POLYFILL="P",Gt=vt,zt=Ot.f,Qt=!y(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Xt=M("IE_PROTO"),Yt=Object.prototype,$t=Qt?Object.getPrototypeOf:function(t){return t=gt(t),c(t,Xt)?t[Xt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Yt:null},Jt=i("iterator"),Zt=!1;[].keys&&("next"in(wt=[].keys())?(bt=$t($t(wt)))!==Object.prototype&&(mt=bt):Zt=!0),null==mt&&(mt={}),c(mt,Jt)||_(mt,Jt,function(){return this});function te(){}function ee(t){return"<script>"+t+"</"+ue+">"}var ne,re={IteratorPrototype:mt,BUGGY_SAFARI_ITERATORS:Zt},ie=Object.keys||function(t){return pt(t,Mt)},oe=f?Object.defineProperties:function(t,e){d(t);for(var n,r=ie(e),i=r.length,o=0;o<i;)b.f(t,n=r[o++],e[n]);return t},se=ht("document","documentElement"),ae="prototype",ue="script",ce=M("IE_PROTO"),he=function(){try{ne=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;he=ne?function(t){t.write(ee("")),t.close();var e=t.parentWindow.Object;return t=null,e}(ne):((e=r("iframe")).style.display="none",se.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(ee("document.F=Object")),t.close(),t.F);for(var n=Mt.length;n--;)delete he[ae][Mt[n]];return he()};H[ce]=!0;function le(t,e,n){t&&!c(t=n?t:t.prototype,ge)&&ye(t,ge,{configurable:!0,value:e})}function fe(){return this}function pe(){return this}function de(t,e,n,r,i,o,s){var a,u,c;function h(t){if(t===i&&m)return m;if(!Ee&&t in y)return y[t];switch(t){case"keys":case Te:case Se:return function(){return new n(this,t)}}return function(){return new n(this)}}u=r,c=e+" Iterator",(a=n).prototype=ve(be,{next:w(1,u)}),le(a,c,!1),me[c]=fe;var l,f,p,d=e+" Iterator",v=!1,y=t.prototype,g=y[Ie]||y["@@iterator"]||i&&y[i],m=!Ee&&g||h(i),b="Array"==e&&y.entries||g;if(b&&(l=$t(b.call(new t)),_e!==Object.prototype&&l.next&&($t(l)!==_e&&(we?we(l,_e):"function"!=typeof l[Ie]&&_(l,Ie,pe)),le(l,d,!0))),i==Te&&g&&g.name!==Te&&(v=!0,m=function(){return g.call(this)}),y[Ie]!==m&&_(y,Ie,m),me[e]=m,i)if(f={values:h(Te),keys:o?m:h("keys"),entries:h(Se)},s)for(p in f)!Ee&&!v&&p in y||Z(y,p,f[p]);else yt({target:e,proto:!0,forced:Ee||v},f);return f}var ve=Object.create||function(t,e){var n;return null!==t?(te[ae]=d(t),n=new te,te[ae]=null,n[ce]=t):n=he(),void 0===e?n:oe(n,e)},ye=b.f,ge=i("toStringTag"),me={},be=re.IteratorPrototype,we=Object.setPrototypeOf||("__proto__"in{}?function(){var n,r=!1,t={};try{(n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(t,[]),r=t instanceof Array}catch(t){}return function(t,e){return d(t),function(t){if(!g(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(e),r?n.call(t,e):t.__proto__=e,t}}():void 0),_e=re.IteratorPrototype,Ee=re.BUGGY_SAFARI_ITERATORS,Ie=i("iterator"),Te="values",Se="entries",Ce=It.charAt,Ne="String Iterator",Ae=J.set,ke=J.getterFor(Ne);de(String,"String",function(t){Ae(this,{type:Ne,string:String(t),index:0})},function(){var t,e=ke(this),n=e.string,r=e.index;return r>=n.length?{value:void 0,done:!0}:(t=Ce(n,r),e.index+=t.length,{value:t,done:!1})});var Oe={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Pe=i("unscopables"),Re=Array.prototype;null==Re[Pe]&&b.f(Re,Pe,{configurable:!0,value:ve(null)});function De(t){Re[Pe][t]=!0}var xe="Array Iterator",Le=J.set,Me=J.getterFor(xe),Fe=de(Array,"Array",function(t,e){Le(this,{type:xe,target:ut(t),index:0,kind:e})},function(){var t=Me(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?{value:t.target=void 0,done:!0}:"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}},"values");me.Arguments=me.Array,De("keys"),De("values"),De("entries");var Ue=i("iterator"),je=i("toStringTag"),Ve=Fe.values;for(var qe in Oe){var Be=m[qe],We=Be&&Be.prototype;if(We){if(We[Ue]!==Ve)try{_(We,Ue,Ve)}catch(hu){We[Ue]=Ve}if(We[je]||_(We,je,qe),Oe[qe])for(var He in Fe)if(We[He]!==Fe[He])try{_(We,He,Fe[He])}catch(hu){We[He]=Fe[He]}}}function Ke(t,e,n){for(var r in e)Z(t,r,e[r],n);return t}function Ge(t){var e=ht(t),n=b.f;f&&e&&!e[tn]&&n(e,tn,{configurable:!0,get:function(){return this}})}function ze(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}function Qe(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}function Xe(t){return void 0!==t&&(me.Array===t||nn[en]===t)}function Ye(r,i,t){if(ze(r),void 0===i)return r;switch(t){case 0:return function(){return r.call(i)};case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}}function $e(t){if(null!=t)return t[rn]||t["@@iterator"]||me[rt(t)]}function Je(e,t,n,r){try{return r?t(d(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&d(i.call(e)),t}}var Ze=m.Promise,tn=i("species"),en=i("iterator"),nn=Array.prototype,rn=i("iterator"),on=e(function(t){function p(t,e){this.stopped=t,this.result=e}(t.exports=function(t,e,n,r,i){var o,s,a,u,c,h,l,f=Ye(e,n,r?2:1);if(i)o=t;else{if("function"!=typeof(s=$e(t)))throw TypeError("Target is not iterable");if(Xe(s)){for(a=0,u=lt(t.length);a<u;a++)if((c=r?f(d(l=t[a])[0],l[1]):f(t[a]))&&c instanceof p)return c;return new p(!1)}o=s.call(t)}for(h=o.next;!(l=h.call(o)).done;)if("object"==typeof(c=Je(o,f,l.value,r))&&c&&c instanceof p)return c;return new p(!1)}).stop=function(t){return new p(!0,t)}}),sn=i("iterator"),an=!1;try{var un=0,cn={next:function(){return{done:!!un++}},return:function(){an=!0}};cn[sn]=function(){return this},Array.from(cn,function(){throw 2})}catch(hu){}function hn(t,e){if(!e&&!an)return!1;var n=!1;try{var r={};r[sn]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n}function ln(t,e){var n,r=d(t).constructor;return void 0===r||null==(n=d(r)[bn])?e:ze(n)}function fn(t){if(kn.hasOwnProperty(t)){var e=kn[t];delete kn[t],e()}}function pn(t){return function(){fn(t)}}function dn(t){fn(t.data)}function vn(t){m.postMessage(t+"",En.protocol+"//"+En.host)}var yn,gn,mn,bn=i("species"),wn=ht("navigator","userAgent")||"",_n=/(iphone|ipod|ipad).*applewebkit/i.test(wn),En=m.location,In=m.setImmediate,Tn=m.clearImmediate,Sn=m.process,Cn=m.MessageChannel,Nn=m.Dispatch,An=0,kn={},On="onreadystatechange";In&&Tn||(In=function(t){for(var e=[],n=1;n<arguments.length;)e.push(arguments[n++]);return kn[++An]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},yn(An),An},Tn=function(t){delete kn[t]},"process"==$(Sn)?yn=function(t){Sn.nextTick(pn(t))}:Nn&&Nn.now?yn=function(t){Nn.now(pn(t))}:Cn&&!_n?(mn=(gn=new Cn).port2,gn.port1.onmessage=dn,yn=Ye(mn.postMessage,mn,1)):!m.addEventListener||"function"!=typeof postMessage||m.importScripts||y(vn)||"file:"===En.protocol?yn=On in r("script")?function(t){se.appendChild(r("script"))[On]=function(){se.removeChild(this),fn(t)}}:function(t){setTimeout(pn(t),0)}:(yn=vn,m.addEventListener("message",dn,!1)));var Pn,Rn,Dn,xn,Ln,Mn,Fn,Un,jn={set:In,clear:Tn},Vn=Ot.f,qn=jn.set,Bn=m.MutationObserver||m.WebKitMutationObserver,Wn=m.process,Hn=m.Promise,Kn="process"==$(Wn),Gn=Vn(m,"queueMicrotask"),zn=Gn&&Gn.value;zn||(Pn=function(){var t,e;for(Kn&&(t=Wn.domain)&&t.exit();Rn;){e=Rn.fn,Rn=Rn.next;try{e()}catch(t){throw Rn?xn():Dn=void 0,t}}Dn=void 0,t&&t.enter()},xn=Kn?function(){Wn.nextTick(Pn)}:Bn&&!_n?(Ln=!0,Mn=document.createTextNode(""),new Bn(Pn).observe(Mn,{characterData:!0}),function(){Mn.data=Ln=!Ln}):Hn&&Hn.resolve?(Fn=Hn.resolve(void 0),Un=Fn.then,function(){Un.call(Fn,Pn)}):function(){qn.call(m,Pn)});function Qn(t){var n,r;this.promise=new t(function(t,e){if(void 0!==n||void 0!==r)throw TypeError("Bad Promise constructor");n=t,r=e}),this.resolve=ze(n),this.reject=ze(r)}function Xn(t,e){if(d(t),g(e)&&e.constructor===t)return e;var n=tr.f(t);return(0,n.resolve)(e),n.promise}function Yn(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}var $n,Jn,Zn=zn||function(t){var e={fn:t,next:void 0};Dn&&(Dn.next=e),Rn||(Rn=e,xn()),Dn=e},tr={f:function(t){return new Qn(t)}},er=m.process,nr=er&&er.versions,rr=nr&&nr.v8;rr?Jn=($n=rr.split("."))[0]+$n[1]:wn&&(!($n=wn.match(/Edge\/(\d+)/))||74<=$n[1])&&($n=wn.match(/Chrome\/(\d+)/))&&(Jn=$n[1]);function ir(t){var e;return!(!g(t)||"function"!=typeof(e=t.then))&&e}function or(l,f,p){if(!f.notified){f.notified=!0;var d=f.reactions;Zn(function(){for(var t=f.value,e=1==f.state,n=0;d.length>n;){var r,i,o,s=d[n++],a=e?s.ok:s.fail,u=s.resolve,c=s.reject,h=s.domain;try{a?(e||(2===f.rejection&&xr(l,f),f.rejection=1),!0===a?r=t:(h&&h.enter(),r=a(t),h&&(h.exit(),o=!0)),r===s.promise?c(_r("Promise-chain cycle")):(i=ir(r))?i.call(r,u,c):u(r)):c(t)}catch(t){h&&!o&&h.exit(),c(t)}}f.reactions=[],f.notified=!1,p&&!f.rejection&&Rr(l,f)})}}function sr(t,e,n){var r,i;Ar?((r=Er.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),m.dispatchEvent(r)):r={promise:e,reason:n},(i=m["on"+t])?i(r):t===kr&&function(t,e){var n=m.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,e))}("Unhandled promise rejection",n)}function ar(e,n,r,i){return function(t){e(n,r,t,i)}}function ur(t,e,n,r){e.done||(e.done=!0,r&&(e=r),e.value=n,e.state=2,or(t,e,!0))}var cr,hr,lr,fr,pr=Jn&&+Jn,dr=jn.set,vr=i("species"),yr="Promise",gr=J.get,mr=J.set,br=J.getterFor(yr),wr=Ze,_r=m.TypeError,Er=m.document,Ir=m.process,Tr=ht("fetch"),Sr=tr.f,Cr=Sr,Nr="process"==$(Ir),Ar=!!(Er&&Er.createEvent&&m.dispatchEvent),kr="unhandledrejection",Or=Gt(yr,function(){if(!(V(wr)!==String(wr))){if(66===pr)return!0;if(!Nr&&"function"!=typeof PromiseRejectionEvent)return!0}if(51<=pr&&/native code/.test(wr))return!1;function t(t){t(function(){},function(){})}var e=wr.resolve(1);return(e.constructor={})[vr]=t,!(e.then(function(){})instanceof t)}),Pr=Or||!hn(function(t){wr.all(t).catch(function(){})}),Rr=function(n,r){dr.call(m,function(){var t,e=r.value;if(Dr(r)&&(t=Yn(function(){Nr?Ir.emit("unhandledRejection",e,n):sr(kr,n,e)}),r.rejection=Nr||Dr(r)?2:1,t.error))throw t.value})},Dr=function(t){return 1!==t.rejection&&!t.parent},xr=function(t,e){dr.call(m,function(){Nr?Ir.emit("rejectionHandled",t):sr("rejectionhandled",t,e.value)})},Lr=function(n,r,t,e){if(!r.done){r.done=!0,e&&(r=e);try{if(n===t)throw _r("Promise can't be resolved itself");var i=ir(t);i?Zn(function(){var e={done:!1};try{i.call(t,ar(Lr,n,e,r),ar(ur,n,e,r))}catch(t){ur(n,e,t,r)}}):(r.value=t,r.state=1,or(n,r,!1))}catch(t){ur(n,{done:!1},t,r)}}};Or&&(wr=function(t){Qe(this,wr,yr),ze(t),cr.call(this);var e=gr(this);try{t(ar(Lr,this,e),ar(ur,this,e))}catch(t){ur(this,e,t)}},(cr=function(){mr(this,{type:yr,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Ke(wr.prototype,{then:function(t,e){var n=br(this),r=Sr(ln(this,wr));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=Nr?Ir.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&or(this,n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),hr=function(){var t=new cr,e=gr(t);this.promise=t,this.resolve=ar(Lr,t,e),this.reject=ar(ur,t,e)},tr.f=Sr=function(t){return t===wr||t===lr?new hr:Cr(t)},"function"==typeof Ze&&(fr=Ze.prototype.then,Z(Ze.prototype,"then",function(t,e){var n=this;return new wr(function(t,e){fr.call(n,t,e)}).then(t,e)},{unsafe:!0}),"function"==typeof Tr&&yt({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return Xn(wr,Tr.apply(m,arguments))}}))),yt({global:!0,wrap:!0,forced:Or},{Promise:wr}),le(wr,yr,!1),Ge(yr),lr=ht(yr),yt({target:yr,stat:!0,forced:Or},{reject:function(t){var e=Sr(this);return e.reject.call(void 0,t),e.promise}}),yt({target:yr,stat:!0,forced:Or},{resolve:function(t){return Xn(this,t)}}),yt({target:yr,stat:!0,forced:Pr},{all:function(t){var a=this,e=Sr(a),u=e.resolve,c=e.reject,n=Yn(function(){var r=ze(a.resolve),i=[],o=0,s=1;on(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(a,t).then(function(t){n||(n=!0,i[e]=t,--s||u(i))},c)}),--s||u(i)});return n.error&&c(n.value),e.promise},race:function(t){var n=this,r=Sr(n),i=r.reject,e=Yn(function(){var e=ze(n.resolve);on(t,function(t){e.call(n,t).then(r.resolve,i)})});return e.error&&i(e.value),r.promise}}),yt({target:"Promise",stat:!0},{allSettled:function(t){var a=this,e=tr.f(a),u=e.resolve,n=e.reject,r=Yn(function(){var r=ze(a.resolve),i=[],o=0,s=1;on(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(a,t).then(function(t){n||(n=!0,i[e]={status:"fulfilled",value:t},--s||u(i))},function(t){n||(n=!0,i[e]={status:"rejected",reason:t},--s||u(i))})}),--s||u(i)});return r.error&&n(r.value),e.promise}});var Mr=!!Ze&&y(function(){Ze.prototype.finally.call({then:function(){}},function(){})});yt({target:"Promise",proto:!0,real:!0,forced:Mr},{finally:function(e){var n=ln(this,ht("Promise")),t="function"==typeof e;return this.then(t?function(t){return Xn(n,e()).then(function(){return t})}:e,t?function(t){return Xn(n,e()).then(function(){throw t})}:e)}}),"function"!=typeof Ze||Ze.prototype.finally||Z(Ze.prototype,"finally",ht("Promise").prototype.finally);Pt.Promise;var Fr=J.set,Ur=J.getterFor("AggregateError"),jr=function(t,e){var n=this;if(!(n instanceof jr))return new jr(t,e);we&&(n=we(new Error(e),$t(n)));var r=[];return on(t,r.push,r),f?Fr(n,{errors:r,type:"AggregateError"}):n.errors=r,void 0!==e&&_(n,"message",String(e)),n};jr.prototype=ve(Error.prototype,{constructor:w(5,jr),message:w(5,""),name:w(5,"AggregateError")}),f&&b.f(jr.prototype,"errors",{get:function(){return Ur(this).errors},configurable:!0}),yt({global:!0},{AggregateError:jr}),yt({target:"Promise",stat:!0},{try:function(t){var e=tr.f(this),n=Yn(t);return(n.error?e.reject:e.resolve)(n.value),e.promise}});var Vr="No one promise resolved";yt({target:"Promise",stat:!0},{any:function(t){var u=this,e=tr.f(u),c=e.resolve,h=e.reject,n=Yn(function(){var r=ze(u.resolve),i=[],o=0,s=1,a=!1;on(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(u,t).then(function(t){n||a||(a=!0,c(t))},function(t){n||a||(n=!0,i[e]=t,--s||h(new(ht("AggregateError"))(i,Vr)))})}),--s||h(new(ht("AggregateError"))(i,Vr))});return n.error&&h(n.value),e.promise}});function qr(t,e){var n;return Kr(t)&&("function"==typeof(n=t.constructor)&&(n===Array||Kr(n.prototype))||g(n)&&null===(n=n[Gr]))&&(n=void 0),new(void 0===n?Array:n)(0===e?0:e)}function Br(p){var d=1==p,v=2==p,y=3==p,g=4==p,m=6==p,b=5==p||m;return function(t,e,n,r){for(var i,o,s=gt(t),a=At(s),u=Ye(e,n,3),c=lt(a.length),h=0,l=r||qr,f=d?l(t,c):v?l(t,0):void 0;h<c;h++)if((b||h in a)&&(o=u(i=a[h],h,s),p))if(d)f[h]=o;else if(o)switch(p){case 3:return!0;case 5:return i;case 6:return h;case 2:zr.call(f,i)}else if(g)return!1;return m?-1:y||g?g:f}}function Wr(t){throw t}function Hr(t,e){if(c(Yr,t))return Yr[t];var n=[][t],r=!!c(e=e||{},"ACCESSORS")&&e.ACCESSORS,i=c(e,0)?e[0]:Wr,o=c(e,1)?e[1]:void 0;return Yr[t]=!!n&&!y(function(){if(r&&!f)return 1;var t={length:-1};r?Xr(t,1,{enumerable:!0,get:Wr}):t[1]=1,n.call(t,i,o)})}var Kr=Array.isArray||function(t){return"Array"==$(t)},Gr=i("species"),zr=[].push,Qr={forEach:Br(0),map:Br(1),filter:Br(2),some:Br(3),every:Br(4),find:Br(5),findIndex:Br(6)},Xr=Object.defineProperty,Yr={},$r=Qr.find,Jr="find",Zr=!0,ti=Hr(Jr);Jr in[]&&Array(1)[Jr](function(){Zr=!1}),yt({target:"Array",proto:!0,forced:Zr||!ti},{find:function(t,e){return $r(this,t,1<arguments.length?e:void 0)}}),De(Jr);function ei(t,e,n){return Ye(ni,m[t].prototype[e],n)}var ni=Function.call,ri=(ei("Array","find"),Qr.findIndex),ii="findIndex",oi=!0,si=Hr(ii);ii in[]&&Array(1)[ii](function(){oi=!1}),yt({target:"Array",proto:!0,forced:oi||!si},{findIndex:function(t,e){return ri(this,t,1<arguments.length?e:void 0)}}),De(ii);function ai(t,e,n){var r=o(e);r in t?b.f(t,r,w(0,n)):t[r]=n}ei("Array","findIndex");var ui=!hn(function(t){Array.from(t)});yt({target:"Array",stat:!0,forced:ui},{from:function(t,e,n){var r,i,o,s,a,u,c=gt(t),h="function"==typeof this?this:Array,l=arguments.length,f=1<l?e:void 0,p=void 0!==f,d=$e(c),v=0;if(p&&(f=Ye(f,2<l?n:void 0,2)),null==d||h==Array&&Xe(d))for(i=new h(r=lt(c.length));v<r;v++)u=p?f(c[v],v):c[v],ai(i,v,u);else for(a=(s=d.call(c)).next,i=new h;!(o=a.call(s)).done;v++)u=p?Je(s,f,[o.value,v],!0):o.value,ai(i,v,u);return i.length=v,i}});Pt.Array.from;var ci,hi,li=Qr.some,fi=!!(hi=[]["some"])&&y(function(){hi.call(null,ci||function(){throw 1},1)}),pi=Hr("some");yt({target:"Array",proto:!0,forced:!fi||!pi},{some:function(t,e){return li(this,t,1<arguments.length?e:void 0)}});ei("Array","some");function di(t){return g(t)&&c(Ai,rt(t))}var vi,yi="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,gi=b.f,mi=m.Int8Array,bi=mi&&mi.prototype,wi=m.Uint8ClampedArray,_i=wi&&wi.prototype,Ei=mi&&$t(mi),Ii=bi&&$t(bi),Ti=Object.prototype,Si=(Ti.isPrototypeOf,i("toStringTag")),Ci=a("TYPED_ARRAY_TAG"),Ni=yi&&!!we&&"Opera"!==rt(m.opera),Ai={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8};for(vi in Ai)m[vi]||(Ni=!1);if((!Ni||"function"!=typeof Ei||Ei===Function.prototype)&&(Ei=function(){throw TypeError("Incorrect invocation")},Ni))for(vi in Ai)m[vi]&&we(m[vi],Ei);if((!Ni||!Ii||Ii===Ti)&&(Ii=Ei.prototype,Ni))for(vi in Ai)m[vi]&&we(m[vi].prototype,Ii);if(Ni&&$t(_i)!==Ii&&we(_i,Ii),f&&!c(Ii,Si))for(vi in gi(Ii,Si,{get:function(){return g(this)?this[Ci]:void 0}}),Ai)m[vi]&&_(m[vi],Ci,vi);function ki(){return xi.call(Fi(this))}var Oi=function(t){if(di(t))return t;throw TypeError("Target is not a typed array")},Pi=function(t,e,n){if(f){if(n)for(var r in Ai){var i=m[r];i&&c(i.prototype,t)&&delete i.prototype[t]}Ii[t]&&!n||Z(Ii,t,!n&&Ni&&bi[t]||e)}},Ri=i("iterator"),Di=m.Uint8Array,xi=Fe.values,Li=Fe.keys,Mi=Fe.entries,Fi=Oi,Ui=Pi,ji=Di&&Di.prototype[Ri],Vi=!!ji&&("values"==ji.name||null==ji.name);Ui("entries",function(){return Mi.call(Fi(this))}),Ui("keys",function(){return Li.call(Fi(this))}),Ui("values",ki,!Vi),Ui(Ri,ki,!Vi);var qi=Object.assign,Bi=Object.defineProperty,Wi=!qi||y(function(){if(f&&1!==qi({b:1},qi(Bi({},"a",{enumerable:!0,get:function(){Bi(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return 1;var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=qi({},t)[n]||ie(qi({},e)).join("")!=r})?function(t,e){for(var n=gt(t),r=arguments.length,i=1,o=jt.f,s=Ct.f;i<r;)for(var a,u=At(arguments[i++]),c=o?ie(u).concat(o(u)):ie(u),h=c.length,l=0;l<h;)a=c[l++],f&&!s.call(u,a)||(n[a]=u[a]);return n}:qi;yt({target:"Object",stat:!0,forced:Object.assign!==Wi},{assign:Wi});Pt.Object.assign;function Hi(a){return function(t){for(var e,n=ut(t),r=ie(n),i=r.length,o=0,s=[];o<i;)e=r[o++],f&&!Ki.call(n,e)||s.push(a?[e,n[e]]:n[e]);return s}}var Ki=Ct.f,Gi={entries:Hi(!0),values:Hi(!1)},zi=Gi.entries;yt({target:"Object",stat:!0},{entries:function(t){return zi(t)}});Pt.Object.entries;var Qi=Gi.values;yt({target:"Object",stat:!0},{values:function(t){return Qi(t)}});Pt.Object.values;function Xi(t){if(g(e=t)&&(void 0!==(n=e[$i])?n:"RegExp"==$(e)))throw TypeError("The method doesn't accept regular expressions");var e,n;return t}function Yi(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[Ji]=!1,"/./"[e](n)}catch(t){}}return!1}var $i=i("match"),Ji=i("match");yt({target:"String",proto:!0,forced:!Yi("includes")},{includes:function(t,e){return!!~String(st(this)).indexOf(Xi(t),1<arguments.length?e:void 0)}});ei("String","includes");var Zi,to=Ot.f,eo="".startsWith,no=Math.min,ro=Yi("startsWith"),io=!(ro||(!(Zi=to(String.prototype,"startsWith"))||Zi.writable));yt({target:"String",proto:!0,forced:!io&&!ro},{startsWith:function(t,e){var n=String(st(this));Xi(t);var r=lt(no(1<arguments.length?e:void 0,n.length)),i=String(t);return eo?eo.call(n,i,r):n.slice(r,r+i.length)===i}});ei("String","startsWith");yt({target:"String",proto:!0},{repeat:"".repeat||function(t){var e=String(st(this)),n="",r=ot(t);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;0<r;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n}});ei("String","repeat");function oo(t){if(g(t)){var e=t[uo];return void 0!==e?!!e:Kr(t)}}var so,ao=i("species"),uo=i("isConcatSpreadable"),co=9007199254740991,ho="Maximum allowed index exceeded",lo=51<=pr||!y(function(){var t=[];return t[uo]=!1,t.concat()[0]!==t}),fo=(so="concat",51<=pr||!y(function(){var t=[];return(t.constructor={})[ao]=function(){return{foo:1}},1!==t[so](Boolean).foo}));yt({target:"Array",proto:!0,forced:!lo||!fo},{concat:function(t){var e,n,r,i,o,s=gt(this),a=qr(s,0),u=0;for(e=-1,r=arguments.length;e<r;e++)if(oo(o=-1===e?s:arguments[e])){if(i=lt(o.length),co<u+i)throw TypeError(ho);for(n=0;n<i;n++,u++)n in o&&ai(a,u,o[n])}else{if(co<=u)throw TypeError(ho);ai(a,u++,o)}return a.length=u,a}});function po(t){var e=Pt.Symbol||(Pt.Symbol={});c(e,t)||To(e,t,{value:Io.f(t)})}function vo(t,e){var n=jo[t]=ve(Do[Ao]);return Oo(n,{type:No,tag:t,description:e}),f||(n.description=e),n}function yo(e,t){d(e);var n=ut(t),r=ie(n).concat(Yo(n));return So(r,function(t){f&&!Xo.call(n,t)||Qo(e,t,n[t])}),e}function go(t,e){var n=ut(t),r=o(e,!0);if(n!==Ro||!c(jo,r)||c(Vo,r)){var i=Lo(n,r);return!i||!c(jo,r)||c(n,Co)&&n[Co][r]||(i.enumerable=!0),i}}function mo(t){var e=Fo(ut(t)),n=[];return So(e,function(t){c(jo,t)||c(H,t)||n.push(t)}),n}var bo=Ut.f,wo={}.toString,_o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Eo={f:function(t){return _o&&"[object Window]"==wo.call(t)?function(t){try{return bo(t)}catch(t){return _o.slice()}}(t):bo(ut(t))}},Io={f:i},To=b.f,So=Qr.forEach,Co=M("hidden"),No="Symbol",Ao="prototype",ko=i("toPrimitive"),Oo=J.set,Po=J.getterFor(No),Ro=Object[Ao],Do=m.Symbol,xo=ht("JSON","stringify"),Lo=Ot.f,Mo=b.f,Fo=Eo.f,Uo=Ct.f,jo=T("symbols"),Vo=T("op-symbols"),qo=T("string-to-symbol-registry"),Bo=T("symbol-to-string-registry"),Wo=T("wks"),Ho=m.QObject,Ko=!Ho||!Ho[Ao]||!Ho[Ao].findChild,Go=f&&y(function(){return 7!=ve(Mo({},"a",{get:function(){return Mo(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=Lo(Ro,e);r&&delete Ro[e],Mo(t,e,n),r&&t!==Ro&&Mo(Ro,e,r)}:Mo,zo=k?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof Do},Qo=function(t,e,n){t===Ro&&Qo(Vo,e,n),d(t);var r=o(e,!0);return d(n),c(jo,r)?(n.enumerable?(c(t,Co)&&t[Co][r]&&(t[Co][r]=!1),n=ve(n,{enumerable:w(0,!1)})):(c(t,Co)||Mo(t,Co,w(1,{})),t[Co][r]=!0),Go(t,r,n)):Mo(t,r,n)},Xo=function(t){var e=o(t,!0),n=Uo.call(this,e);return!(this===Ro&&c(jo,e)&&!c(Vo,e))&&(!(n||!c(this,e)||!c(jo,e)||c(this,Co)&&this[Co][e])||n)},Yo=function(t){var e=t===Ro,n=Fo(e?Vo:ut(t)),r=[];return So(n,function(t){!c(jo,t)||e&&!c(Ro,t)||r.push(jo[t])}),r};if(A||(Z((Do=function(t){if(this instanceof Do)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==t?String(t):void 0,n=a(e),r=function(t){this===Ro&&r.call(Vo,t),c(this,Co)&&c(this[Co],n)&&(this[Co][n]=!1),Go(this,n,w(1,t))};return f&&Ko&&Go(Ro,n,{configurable:!0,set:r}),vo(n,e)})[Ao],"toString",function(){return Po(this).tag}),Z(Do,"withoutSetter",function(t){return vo(a(t),t)}),Ct.f=Xo,b.f=Qo,Ot.f=go,Ut.f=Eo.f=mo,jt.f=Yo,Io.f=function(t){return vo(i(t),t)},f&&(Mo(Do[Ao],"description",{configurable:!0,get:function(){return Po(this).description}}),Z(Ro,"propertyIsEnumerable",Xo,{unsafe:!0}))),yt({global:!0,wrap:!0,forced:!A,sham:!A},{Symbol:Do}),So(ie(Wo),function(t){po(t)}),yt({target:No,stat:!0,forced:!A},{for:function(t){var e=String(t);if(c(qo,e))return qo[e];var n=Do(e);return qo[e]=n,Bo[n]=e,n},keyFor:function(t){if(!zo(t))throw TypeError(t+" is not a symbol");if(c(Bo,t))return Bo[t]},useSetter:function(){Ko=!0},useSimple:function(){Ko=!1}}),yt({target:"Object",stat:!0,forced:!A,sham:!f},{create:function(t,e){return void 0===e?ve(t):yo(ve(t),e)},defineProperty:Qo,defineProperties:yo,getOwnPropertyDescriptor:go}),yt({target:"Object",stat:!0,forced:!A},{getOwnPropertyNames:mo,getOwnPropertySymbols:Yo}),yt({target:"Object",stat:!0,forced:y(function(){jt.f(1)})},{getOwnPropertySymbols:function(t){return jt.f(gt(t))}}),xo){var $o=!A||y(function(){var t=Do();return"[null]"!=xo([t])||"{}"!=xo({a:t})||"{}"!=xo(Object(t))});yt({target:"JSON",stat:!0,forced:$o},{stringify:function(t,e,n){for(var r,i=[t],o=1;o<arguments.length;)i.push(arguments[o++]);if((g(r=e)||void 0!==t)&&!zo(t))return Kr(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!zo(e))return e}),i[1]=e,xo.apply(null,i)}})}Do[Ao][ko]||_(Do[Ao],ko,Do[Ao].valueOf),le(Do,No),H[Co]=!0,po("asyncIterator");var Jo=b.f,Zo=m.Symbol;if(!(!f||"function"!=typeof Zo||"description"in Zo.prototype&&void 0===Zo().description)){var ts={},es=function(t){var e=arguments.length<1||void 0===t?void 0:String(t),n=this instanceof es?new Zo(e):void 0===e?Zo():Zo(e);return""===e&&(ts[n]=!0),n};dt(es,Zo);var ns=es.prototype=Zo.prototype;ns.constructor=es;var rs=ns.toString,is="Symbol(test)"==String(Zo("test")),os=/^Symbol\((.*)\)[^)]+$/;Jo(ns,"description",{configurable:!0,get:function(){var t=g(this)?this.valueOf():this,e=rs.call(t);if(c(ts,t))return"";var n=is?e.slice(7,-1):e.replace(os,"$1");return""===n?void 0:n}}),yt({global:!0,forced:!0},{Symbol:es})}po("hasInstance"),po("isConcatSpreadable"),po("iterator"),po("match"),po("matchAll"),po("replace"),po("search"),po("species"),po("split"),po("toPrimitive"),po("toStringTag"),po("unscopables"),le(Math,"Math",!0),le(m.JSON,"JSON",!0);Pt.Symbol;po("asyncDispose"),po("dispose"),po("observable"),po("patternMatch"),po("replaceAll");Io.f("iterator");function ss(u,t,e){function n(t){var n=i[t];Z(i,t,"add"==t?function(t){return n.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(r&&!g(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return r&&!g(t)?void 0:n.call(this,0===t?0:t)}:"has"==t?function(t){return!(r&&!g(t))&&n.call(this,0===t?0:t)}:function(t,e){return n.call(this,0===t?0:t,e),this})}var c=-1!==u.indexOf("Map"),r=-1!==u.indexOf("Weak"),h=c?"set":"add",l=m[u],i=l&&l.prototype,f=l,o={};if(Gt(u,"function"!=typeof l||!(r||i.forEach&&!y(function(){(new l).entries().next()}))))f=e.getConstructor(t,u,c,h),cs.REQUIRED=!0;else if(Gt(u,!0)){var s=new f,a=s[h](r?{}:-0,1)!=s,p=y(function(){s.has(1)}),d=hn(function(t){new l(t)}),v=!r&&y(function(){for(var t=new l,e=5;e--;)t[h](e,e);return!t.has(-0)});d||(((f=t(function(t,e){Qe(t,f,u);var n,r,i,o,s,a=(n=new l,r=t,i=f,we&&"function"==typeof(o=r.constructor)&&o!==i&&g(s=o.prototype)&&s!==i.prototype&&we(n,s),n);return null!=e&&on(e,a[h],a,c),a})).prototype=i).constructor=f),(p||v)&&(n("delete"),n("has"),c&&n("get")),(v||a)&&n(h),r&&i.clear&&delete i.clear}return o[u]=f,yt({global:!0,forced:f!=l},o),le(f,u),r||e.setStrong(f,u,c),f}function as(t,e,n){var r,i,o,s,a=arguments.length,u=1<a?e:void 0;return ze(this),(r=void 0!==u)&&ze(u),null==t?new this:(i=[],r?(o=0,s=Ye(u,2<a?n:void 0,2),on(t,function(t){i.push(s(t,o++))})):on(t,i.push,i),new this(i))}var us=!y(function(){return Object.isExtensible(Object.preventExtensions({}))}),cs=e(function(t){function n(t){e(t,r,{value:{objectID:"O"+ ++i,weakData:{}}})}var e=b.f,r=a("meta"),i=0,o=Object.isExtensible||function(){return!0},s=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!g(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!c(t,r)){if(!o(t))return"F";if(!e)return"E";n(t)}return t[r].objectID},getWeakData:function(t,e){if(!c(t,r)){if(!o(t))return!0;if(!e)return!1;n(t)}return t[r].weakData},onFreeze:function(t){return us&&s.REQUIRED&&o(t)&&!c(t,r)&&n(t),t}};H[r]=!0}),hs=(cs.REQUIRED,cs.fastKey,cs.getWeakData,cs.onFreeze,b.f),ls=cs.fastKey,fs=J.set,ps=J.getterFor,ds={getConstructor:function(t,n,r,i){function o(t,e,n){var r,i,o=a(t),s=u(t,e);return s?s.value=n:(o.last=s={index:i=ls(e,!0),key:e,value:n,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),f?o.size++:t.size++,"F"!==i&&(o.index[i]=s)),t}var s=t(function(t,e){Qe(t,s,n),fs(t,{type:n,index:ve(null),first:void 0,last:void 0,size:0}),f||(t.size=0),null!=e&&on(e,t[i],t,r)}),a=ps(n),u=function(t,e){var n,r=a(t),i=ls(e);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==e)return n};return Ke(s.prototype,{clear:function(){for(var t=a(this),e=t.index,n=t.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete e[n.index],n=n.next;t.first=t.last=void 0,f?t.size=0:this.size=0},delete:function(t){var e=a(this),n=u(this,t);if(n){var r=n.next,i=n.previous;delete e.index[n.index],n.removed=!0,i&&(i.next=r),r&&(r.previous=i),e.first==n&&(e.first=r),e.last==n&&(e.last=i),f?e.size--:this.size--}return!!n},forEach:function(t,e){for(var n,r=a(this),i=Ye(t,1<arguments.length?e:void 0,3);n=n?n.next:r.first;)for(i(n.value,n.key,this);n&&n.removed;)n=n.previous},has:function(t){return!!u(this,t)}}),Ke(s.prototype,r?{get:function(t){var e=u(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),f&&hs(s.prototype,"size",{get:function(){return a(this).size}}),s},setStrong:function(t,e,n){var r=e+" Iterator",i=ps(e),o=ps(r);de(t,e,function(t,e){fs(this,{type:r,target:t,state:i(t),kind:e,last:void 0})},function(){for(var t=o(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?"keys"==e?{value:n.key,done:!1}:"values"==e?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:{value:t.target=void 0,done:!0}},n?"entries":"values",!n,!0),Ge(e)}};ss("Map",function(e){return function(t){return e(this,arguments.length?t:void 0)}},ds),Pt.Map;yt({target:"Map",stat:!0},{from:as});function vs(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)}yt({target:"Map",stat:!0},{of:vs});function ys(){for(var t,e=d(this),n=ze(e.delete),r=!0,i=0,o=arguments.length;i<o;i++)t=n.call(e,arguments[i]),r=r&&t;return!!r}yt({target:"Map",proto:!0,real:!0,forced:s},{deleteAll:function(){return ys.apply(this,arguments)}});function gs(t){return Map.prototype.entries.call(t)}yt({target:"Map",proto:!0,real:!0,forced:s},{every:function(t,e){var n=d(this),r=gs(n),i=Ye(t,1<arguments.length?e:void 0,3);return!on(r,function(t,e){if(!i(e,t,n))return on.stop()},void 0,!0,!0).stopped}}),yt({target:"Map",proto:!0,real:!0,forced:s},{filter:function(t,e){var n=d(this),r=gs(n),i=Ye(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Map"))),s=ze(o.set);return on(r,function(t,e){i(e,t,n)&&s.call(o,t,e)},void 0,!0,!0),o}}),yt({target:"Map",proto:!0,real:!0,forced:s},{find:function(t,e){var n=d(this),r=gs(n),i=Ye(t,1<arguments.length?e:void 0,3);return on(r,function(t,e){if(i(e,t,n))return on.stop(e)},void 0,!0,!0).result}}),yt({target:"Map",proto:!0,real:!0,forced:s},{findKey:function(t,e){var n=d(this),r=gs(n),i=Ye(t,1<arguments.length?e:void 0,3);return on(r,function(t,e){if(i(e,t,n))return on.stop(t)},void 0,!0,!0).result}}),yt({target:"Map",stat:!0},{groupBy:function(t,n){var r=new this;ze(n);var i=ze(r.has),o=ze(r.get),s=ze(r.set);return on(t,function(t){var e=n(t);i.call(r,e)?o.call(r,e).push(t):s.call(r,e,[t])}),r}});yt({target:"Map",proto:!0,real:!0,forced:s},{includes:function(i){return on(gs(d(this)),function(t,e){if((n=e)===(r=i)||n!=n&&r!=r)return on.stop();var n,r},void 0,!0,!0).stopped}}),yt({target:"Map",stat:!0},{keyBy:function(t,e){var n=new this;ze(e);var r=ze(n.set);return on(t,function(t){r.call(n,e(t),t)}),n}}),yt({target:"Map",proto:!0,real:!0,forced:s},{keyOf:function(n){return on(gs(d(this)),function(t,e){if(e===n)return on.stop(t)},void 0,!0,!0).result}}),yt({target:"Map",proto:!0,real:!0,forced:s},{mapKeys:function(t,e){var n=d(this),r=gs(n),i=Ye(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Map"))),s=ze(o.set);return on(r,function(t,e){s.call(o,i(e,t,n),e)},void 0,!0,!0),o}}),yt({target:"Map",proto:!0,real:!0,forced:s},{mapValues:function(t,e){var n=d(this),r=gs(n),i=Ye(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Map"))),s=ze(o.set);return on(r,function(t,e){s.call(o,t,i(e,t,n))},void 0,!0,!0),o}}),yt({target:"Map",proto:!0,real:!0,forced:s},{merge:function(t){for(var e=d(this),n=ze(e.set),r=0;r<arguments.length;)on(arguments[r++],n,e,!0);return e}}),yt({target:"Map",proto:!0,real:!0,forced:s},{reduce:function(n,t){var r=d(this),e=gs(r),i=arguments.length<2,o=i?void 0:t;if(ze(n),on(e,function(t,e){o=i?(i=!1,e):n(o,e,t,r)},void 0,!0,!0),i)throw TypeError("Reduce of empty map with no initial value");return o}}),yt({target:"Map",proto:!0,real:!0,forced:s},{some:function(t,e){var n=d(this),r=gs(n),i=Ye(t,1<arguments.length?e:void 0,3);return on(r,function(t,e){if(i(e,t,n))return on.stop()},void 0,!0,!0).stopped}}),yt({target:"Map",proto:!0,real:!0,forced:s},{update:function(t,e,n){var r=d(this),i=arguments.length;ze(e);var o=r.has(t);if(!o&&i<3)throw TypeError("Updating absent value");var s=o?r.get(t):ze(2<i?n:void 0)(t,r);return r.set(t,e(s,t,r)),r}});function ms(t,e,n){var r,i=d(this),o=2<arguments.length?n:void 0;if("function"!=typeof e&&"function"!=typeof o)throw TypeError("At least one callback required");return i.has(t)?(r=i.get(t),"function"==typeof e&&(r=e(r),i.set(t,r))):"function"==typeof o&&(r=o(),i.set(t,r)),r}yt({target:"Map",proto:!0,real:!0,forced:s},{upsert:ms}),yt({target:"Map",proto:!0,real:!0,forced:s},{updateOrInsert:ms});ss("Set",function(e){return function(t){return e(this,arguments.length?t:void 0)}},ds),Pt.Set;yt({target:"Set",stat:!0},{from:as}),yt({target:"Set",stat:!0},{of:vs});yt({target:"Set",proto:!0,real:!0,forced:s},{addAll:function(){return function(){for(var t=d(this),e=ze(t.add),n=0,r=arguments.length;n<r;n++)e.call(t,arguments[n]);return t}.apply(this,arguments)}}),yt({target:"Set",proto:!0,real:!0,forced:s},{deleteAll:function(){return ys.apply(this,arguments)}});function bs(t){return Set.prototype.values.call(t)}yt({target:"Set",proto:!0,real:!0,forced:s},{every:function(t,e){var n=d(this),r=bs(n),i=Ye(t,1<arguments.length?e:void 0,3);return!on(r,function(t){if(!i(t,t,n))return on.stop()},void 0,!1,!0).stopped}}),yt({target:"Set",proto:!0,real:!0,forced:s},{difference:function(t){var e=d(this),n=new(ln(e,ht("Set")))(e),r=ze(n.delete);return on(t,function(t){r.call(n,t)}),n}}),yt({target:"Set",proto:!0,real:!0,forced:s},{filter:function(t,e){var n=d(this),r=bs(n),i=Ye(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Set"))),s=ze(o.add);return on(r,function(t){i(t,t,n)&&s.call(o,t)},void 0,!1,!0),o}}),yt({target:"Set",proto:!0,real:!0,forced:s},{find:function(t,e){var n=d(this),r=bs(n),i=Ye(t,1<arguments.length?e:void 0,3);return on(r,function(t){if(i(t,t,n))return on.stop(t)},void 0,!1,!0).result}}),yt({target:"Set",proto:!0,real:!0,forced:s},{intersection:function(t){var e=d(this),n=new(ln(e,ht("Set"))),r=ze(e.has),i=ze(n.add);return on(t,function(t){r.call(e,t)&&i.call(n,t)}),n}}),yt({target:"Set",proto:!0,real:!0,forced:s},{isDisjointFrom:function(t){var e=d(this),n=ze(e.has);return!on(t,function(t){if(!0===n.call(e,t))return on.stop()}).stopped}}),yt({target:"Set",proto:!0,real:!0,forced:s},{isSubsetOf:function(t){var e=function(t){var e=$e(t);if("function"!=typeof e)throw TypeError(String(t)+" is not iterable");return d(e.call(t))}(this),n=d(t),r=n.has;return"function"!=typeof r&&(n=new(ht("Set"))(t),r=ze(n.has)),!on(e,function(t){if(!1===r.call(n,t))return on.stop()},void 0,!1,!0).stopped}}),yt({target:"Set",proto:!0,real:!0,forced:s},{isSupersetOf:function(t){var e=d(this),n=ze(e.has);return!on(t,function(t){if(!1===n.call(e,t))return on.stop()}).stopped}}),yt({target:"Set",proto:!0,real:!0,forced:s},{join:function(t){var e=d(this),n=bs(e),r=void 0===t?",":String(t),i=[];return on(n,i.push,i,!1,!0),i.join(r)}}),yt({target:"Set",proto:!0,real:!0,forced:s},{map:function(t,e){var n=d(this),r=bs(n),i=Ye(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Set"))),s=ze(o.add);return on(r,function(t){s.call(o,i(t,t,n))},void 0,!1,!0),o}}),yt({target:"Set",proto:!0,real:!0,forced:s},{reduce:function(e,t){var n=d(this),r=bs(n),i=arguments.length<2,o=i?void 0:t;if(ze(e),on(r,function(t){o=i?(i=!1,t):e(o,t,t,n)},void 0,!1,!0),i)throw TypeError("Reduce of empty set with no initial value");return o}}),yt({target:"Set",proto:!0,real:!0,forced:s},{some:function(t,e){var n=d(this),r=bs(n),i=Ye(t,1<arguments.length?e:void 0,3);return on(r,function(t){if(i(t,t,n))return on.stop()},void 0,!1,!0).stopped}}),yt({target:"Set",proto:!0,real:!0,forced:s},{symmetricDifference:function(t){var e=d(this),n=new(ln(e,ht("Set")))(e),r=ze(n.delete),i=ze(n.add);return on(t,function(t){r.call(n,t)||i.call(n,t)}),n}}),yt({target:"Set",proto:!0,real:!0,forced:s},{union:function(t){var e=d(this),n=new(ln(e,ht("Set")))(e);return on(t,ze(n.add),n),n}});var ws=Math.floor;yt({target:"Number",stat:!0},{isInteger:function(t){return!g(t)&&isFinite(t)&&ws(t)===t}});Pt.Number.isInteger;yt({target:"Number",stat:!0},{isNaN:function(t){return t!=t}});Pt.Number.isNaN;var _s=function(t,e){return(_s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function Es(t,e){function n(){this.constructor=t}_s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Is=function(){return(Is=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function Ts(t,s,a,u){return new(a=a||Promise)(function(n,e){function r(t){try{o(u.next(t))}catch(t){e(t)}}function i(t){try{o(u.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(r,i)}o((u=u.apply(t,s||[])).next())})}function Ss(n,r){var i,o,s,t,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){a.label=e[1];break}if(6===e[0]&&a.label<s[1]){a.label=s[1],s=e;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(e);break}s[2]&&a.ops.pop(),a.trys.pop();continue}e=r.call(n,a)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function Cs(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ns(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function As(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ns(arguments[e]));return t}function ks(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function Os(t){for(var e=[],n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);i<128?e[n++]=i:(i<2048?e[n++]=i>>6|192:(55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128):e[n++]=i>>12|224,e[n++]=i>>6&63|128),e[n++]=63&i|128)}return e}function Ps(t){try{return Ls.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var Rs={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},Ds=function(t,e){if(!t)throw xs(e)},xs=function(t){return new Error("Firebase Database ("+Rs.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},Ls={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<t.length;i+=3){var o=t[i],s=i+1<t.length,a=s?t[i+1]:0,u=i+2<t.length,c=u?t[i+2]:0,h=o>>2,l=(3&o)<<4|a>>4,f=(15&a)<<2|c>>6,p=63&c;u||(p=64,s||(f=64)),r.push(n[h],n[l],n[f],n[p])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Os(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n<t.length;){var i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(191<i&&i<224){var o=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(239<i&&i<365){var s=((7&i)<<18|(63&(o=t[n++]))<<12|(63&(a=t[n++]))<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{o=t[n++];var a=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<t.length;){var o=n[t.charAt(i++)],s=i<t.length?n[t.charAt(i)]:0,a=++i<t.length?n[t.charAt(i)]:64,u=++i<t.length?n[t.charAt(i)]:64;if(++i,null==o||null==s||null==a||null==u)throw Error();var c=o<<2|s>>4;if(r.push(c),64!==a){var h=s<<4&240|a>>2;if(r.push(h),64!==u){var l=a<<6&192|u;r.push(l)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),(this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};function Ms(t){return Fs(void 0,t)}function Fs(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n in e)e.hasOwnProperty(n)&&(t[n]=Fs(t[n],e[n]));return t}var Us=(js.prototype.wrapCallback=function(n){var r=this;return function(t,e){t?r.reject(t):r.resolve(e),"function"==typeof n&&(r.promise.catch(function(){}),1===n.length?n(t):n(t,e))}},js);function js(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}function Vs(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function qs(){return"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Vs())}function Bs(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function Ws(){return!0===Rs.NODE_ADMIN}function Hs(){return"indexedDB"in window&&null!==indexedDB}function Ks(){return new Promise(function(t,e){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=window.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||window.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=function(){n=!1},i.onerror=function(){var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})}function Gs(){return!(!navigator||!navigator.cookieEnabled)}var zs,Qs=(Es(Xs,zs=Error),Xs);function Xs(t,e){var n=zs.call(this,e)||this;return n.code=t,n.name="FirebaseError",Object.setPrototypeOf(n,Xs.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,Ys.prototype.create),n}var Ys=($s.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r,i=e[0]||{},o=this.service+"/"+t,s=this.errors[t],a=s?(r=i,s.replace(Js,function(t,e){var n=r[e];return null!=n?String(n):"<"+e+"?>"})):"Error",u=this.serviceName+": "+a+" ("+o+").",c=new Qs(o,u),h=0,l=Object.keys(i);h<l.length;h++){var f=l[h];"_"!==f.slice(-1)&&(f in c&&console.warn('Overwriting FirebaseError base field "'+f+'" can cause unexpected behavior.'),c[f]=i[f])}return c},$s);function $s(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var Js=/\{\$([^}]+)}/g;function Zs(t){return JSON.parse(t)}function ta(t){return JSON.stringify(t)}function ea(t){var e={},n={},r={},i="";try{var o=t.split(".");e=Zs(Ps(o[0])||""),n=Zs(Ps(o[1])||""),i=o[2],r=n.d||{},delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}}function na(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ra(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function ia(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function oa(t,e,n){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=e.call(n,t[i],i,t));return r}var sa=(aa.prototype.reset=function(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0},aa.prototype.compress_=function(t,e){e=e||0;var n=this.W_;if("string"==typeof t)for(var r=0;r<16;r++)n[r]=t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|t.charCodeAt(e+3),e+=4;else for(r=0;r<16;r++)n[r]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],e+=4;for(r=16;r<80;r++){var i=n[r-3]^n[r-8]^n[r-14]^n[r-16];n[r]=4294967295&(i<<1|i>>>31)}var o,s,a=this.chain_[0],u=this.chain_[1],c=this.chain_[2],h=this.chain_[3],l=this.chain_[4];for(r=0;r<80;r++)s=r<40?r<20?(o=h^u&(c^h),1518500249):(o=u^c^h,1859775393):r<60?(o=u&c|h&(u|c),2400959708):(o=u^c^h,3395469782),i=(a<<5|a>>>27)+o+l+s+n[r]&4294967295,l=h,h=c,c=4294967295&(u<<30|u>>>2),u=a,a=i;this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+u&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+h&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295},aa.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r<e;){if(0===o)for(;r<=n;)this.compress_(t,r),r+=this.blockSize;if("string"==typeof t){for(;r<e;)if(i[o]=t.charCodeAt(r),++r,++o===this.blockSize){this.compress_(i),o=0;break}}else for(;r<e;)if(i[o]=t[r],++r,++o===this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,this.total_+=e}},aa.prototype.digest=function(){var t=[],e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(var n=this.blockSize-1;56<=n;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;0<=i;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t},aa);function aa(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(var t=1;t<this.blockSize;++t)this.pad_[t]=0;this.reset()}function ua(t,e){var n=new ca(t,e);return n.subscribe.bind(n)}var ca=(ha.prototype.next=function(e){this.forEachObserver(function(t){t.next(e)})},ha.prototype.error=function(e){this.forEachObserver(function(t){t.error(e)}),this.close(e)},ha.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},ha.prototype.subscribe=function(t,e,n){var r,i=this;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(t,e){if("object"==typeof t&&null!==t)for(var n=0,r=e;n<r.length;n++){var i=r[n];if(i in t&&"function"==typeof t[i])return 1}}(t,["next","error","complete"])?t:{next:t,error:e,complete:n}).next&&(r.next=la),void 0===r.error&&(r.error=la),void 0===r.complete&&(r.complete=la);var o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(t){}}),this.observers.push(r),o},ha.prototype.unsubscribeOne=function(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],--this.observerCount,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},ha.prototype.forEachObserver=function(t){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,t)},ha.prototype.sendOne=function(t,e){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[t])try{e(n.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}})},ha.prototype.close=function(t){var e=this;this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then(function(){e.observers=void 0,e.onNoObservers=void 0}))},ha);function ha(t,e){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(function(){t(n)}).catch(function(t){n.error(t)})}function la(){}function fa(t,e,n,r){var i;if(r<e?i="at least "+e:n<r&&(i=0===n?"none":"no more than "+n),i)throw new Error(t+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".")}function pa(t,e,n){var r="";switch(e){case 1:r=n?"first":"First";break;case 2:r=n?"second":"Second";break;case 3:r=n?"third":"Third";break;case 4:r=n?"fourth":"Fourth";break;default:throw new Error("errorPrefix called with argumentNumber > 4.  Need to update it?")}var i=t+" failed: ";return i+=r+" argument "}function da(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(pa(t,e,r)+"must be a valid function.")}function va(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(pa(t,e,r)+"must be a valid context object.")}function ya(t){for(var e=0,n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e++:r<2048?e+=2:55296<=r&&r<=56319?(e+=4,n++):e+=3}return e}var ga=(ma.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},ma.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},ma.prototype.setServiceProps=function(t){return this.serviceProps=t,this},ma);function ma(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var ba="[DEFAULT]",wa=(_a.prototype.get=function(t){void 0===t&&(t=ba);var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){var n=new Us;this.instancesDeferred.set(e,n);try{var r=this.getOrInitializeService(e);r&&n.resolve(r)}catch(t){}}return this.instancesDeferred.get(e).promise},_a.prototype.getImmediate=function(t){var e=Is({identifier:ba,optional:!1},t),n=e.identifier,r=e.optional,i=this.normalizeInstanceIdentifier(n);try{var o=this.getOrInitializeService(i);if(o)return o;if(r)return null;throw Error("Service "+this.name+" is not available")}catch(t){if(r)return null;throw t}},_a.prototype.getComponent=function(){return this.component},_a.prototype.setComponent=function(t){var e,n;if(t.name!==this.name)throw Error("Mismatching Component "+t.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if("EAGER"===(this.component=t).instantiationMode)try{this.getOrInitializeService(ba)}catch(t){}try{for(var r=Cs(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=Ns(i.value,2),s=o[0],a=o[1],u=this.normalizeInstanceIdentifier(s);try{var c=this.getOrInitializeService(u);a.resolve(c)}catch(t){}}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},_a.prototype.clearInstance=function(t){void 0===t&&(t=ba),this.instancesDeferred.delete(t),this.instances.delete(t)},_a.prototype.delete=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return e=Array.from(this.instances.values()),[4,Promise.all(e.filter(function(t){return"INTERNAL"in t}).map(function(t){return t.INTERNAL.delete()}))];case 1:return t.sent(),[2]}})})},_a.prototype.isComponentSet=function(){return null!=this.component},_a.prototype.getOrInitializeService=function(t){var e,n=this.instances.get(t);return!n&&this.component&&(n=this.component.instanceFactory(this.container,(e=t)===ba?void 0:e),this.instances.set(t,n)),n||null},_a.prototype.normalizeInstanceIdentifier=function(t){return!this.component||this.component.multipleInstances?t:ba},_a);function _a(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}var Ea,Ia=(Ta.prototype.addComponent=function(t){var e=this.getProvider(t.name);if(e.isComponentSet())throw new Error("Component "+t.name+" has already been registered with "+this.name);e.setComponent(t)},Ta.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)},Ta.prototype.getProvider=function(t){if(this.providers.has(t))return this.providers.get(t);var e=new wa(t,this);return this.providers.set(t,e),e},Ta.prototype.getProviders=function(){return Array.from(this.providers.values())},Ta);function Ta(t){this.name=t,this.providers=new Map}function Sa(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}var Ca,Na,Aa=[];(Na=Ca=Ca||{})[Na.DEBUG=0]="DEBUG",Na[Na.VERBOSE=1]="VERBOSE",Na[Na.INFO=2]="INFO",Na[Na.WARN=3]="WARN",Na[Na.ERROR=4]="ERROR",Na[Na.SILENT=5]="SILENT";function ka(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(e<t.logLevel)){var i=(new Date).toISOString(),o=Da[e];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+e+")");console[o].apply(console,Sa(["["+i+"]  "+t.name+":"],n))}}var Oa,Pa={debug:Ca.DEBUG,verbose:Ca.VERBOSE,info:Ca.INFO,warn:Ca.WARN,error:Ca.ERROR,silent:Ca.SILENT},Ra=Ca.INFO,Da=((Ea={})[Ca.DEBUG]="log",Ea[Ca.VERBOSE]="log",Ea[Ca.INFO]="info",Ea[Ca.WARN]="warn",Ea[Ca.ERROR]="error",Ea),xa=(Object.defineProperty(La.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in Ca))throw new TypeError('Invalid value "'+t+'" assigned to `logLevel`');this._logLevel=t},enumerable:!1,configurable:!0}),La.prototype.setLogLevel=function(t){this._logLevel="string"==typeof t?Pa[t]:t},Object.defineProperty(La.prototype,"logHandler",{get:function(){return this._logHandler},set:function(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t},enumerable:!1,configurable:!0}),Object.defineProperty(La.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!1,configurable:!0}),La.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Sa([this,Ca.DEBUG],t)),this._logHandler.apply(this,Sa([this,Ca.DEBUG],t))},La.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Sa([this,Ca.VERBOSE],t)),this._logHandler.apply(this,Sa([this,Ca.VERBOSE],t))},La.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Sa([this,Ca.INFO],t)),this._logHandler.apply(this,Sa([this,Ca.INFO],t))},La.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Sa([this,Ca.WARN],t)),this._logHandler.apply(this,Sa([this,Ca.WARN],t))},La.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Sa([this,Ca.ERROR],t)),this._logHandler.apply(this,Sa([this,Ca.ERROR],t))},La);function La(t){this.name=t,this._logLevel=Ra,this._logHandler=ka,this._userLogHandler=null,Aa.push(this)}function Ma(e){Aa.forEach(function(t){t.setLogLevel(e)})}var Fa,Ua=((Oa={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",Oa["bad-app-name"]="Illegal App name: '{$appName}",Oa["duplicate-app"]="Firebase App named '{$appName}' already exists",Oa["app-deleted"]="Firebase App named '{$appName}' already deleted",Oa["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",Oa["invalid-log-argument"]="First argument to `onLog` must be null or a function.",Oa),ja=new Ys("app","Firebase",Ua),Va="@firebase/app",qa="[DEFAULT]",Ba=((Fa={})[Va]="fire-core",Fa["@firebase/analytics"]="fire-analytics",Fa["@firebase/auth"]="fire-auth",Fa["@firebase/database"]="fire-rtdb",Fa["@firebase/functions"]="fire-fn",Fa["@firebase/installations"]="fire-iid",Fa["@firebase/messaging"]="fire-fcm",Fa["@firebase/performance"]="fire-perf",Fa["@firebase/remote-config"]="fire-rc",Fa["@firebase/storage"]="fire-gcs",Fa["@firebase/firestore"]="fire-fst",Fa["fire-js"]="fire-js",Fa["firebase-wrapper"]="fire-js-all",Fa),Wa=new xa("@firebase/app"),Ha=(Object.defineProperty(Ka.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!1,configurable:!0}),Object.defineProperty(Ka.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(Ka.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),Ka.prototype.delete=function(){var e=this;return new Promise(function(t){e.checkDestroyed_(),t()}).then(function(){return e.firebase_.INTERNAL.removeApp(e.name_),Promise.all(e.container.getProviders().map(function(t){return t.delete()}))}).then(function(){e.isDeleted_=!0})},Ka.prototype._getService=function(t,e){return void 0===e&&(e=qa),this.checkDestroyed_(),this.container.getProvider(t).getImmediate({identifier:e})},Ka.prototype._removeServiceInstance=function(t,e){void 0===e&&(e=qa),this.container.getProvider(t).clearInstance(e)},Ka.prototype._addComponent=function(e){try{this.container.addComponent(e)}catch(t){Wa.debug("Component "+e.name+" failed to register with FirebaseApp "+this.name,t)}},Ka.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},Ka.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw ja.create("app-deleted",{appName:this.name_})},Ka);function Ka(t,e,n){var r,i,o=this;this.firebase_=n,this.isDeleted_=!1,this.name_=e.name,this.automaticDataCollectionEnabled_=e.automaticDataCollectionEnabled||!1,this.options_=Ms(t),this.container=new Ia(e.name),this._addComponent(new ga("app",function(){return o},"PUBLIC"));try{for(var s=Cs(this.firebase_.INTERNAL.components.values()),a=s.next();!a.done;a=s.next()){var u=a.value;this._addComponent(u)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}Ha.prototype.name&&Ha.prototype.options||Ha.prototype.delete||console.log("dc");var Ga="7.17.1";function za(u){var c={},h=new Map,l={__esModule:!0,initializeApp:function(t,e){void 0===e&&(e={});if("object"!=typeof e||null===e){e={name:e}}var n=e;void 0===n.name&&(n.name=qa);var r=n.name;if("string"!=typeof r||!r)throw ja.create("bad-app-name",{appName:String(r)});if(na(c,r))throw ja.create("duplicate-app",{appName:r});var i=new u(t,n,l);return c[r]=i},app:f,registerVersion:function(t,e,n){var r,i=null!==(r=Ba[t])&&void 0!==r?r:t;n&&(i+="-"+n);var o=i.match(/\s|\//),s=e.match(/\s|\//);if(o||s){var a=['Unable to register library "'+i+'" with version "'+e+'":'];return o&&a.push('library name "'+i+'" contains illegal characters (whitespace or "/")'),o&&s&&a.push("and"),s&&a.push('version name "'+e+'" contains illegal characters (whitespace or "/")'),void Wa.warn(a.join(" "))}p(new ga(i+"-version",function(){return{library:i,version:e}},"VERSION"))},setLogLevel:Ma,onLog:function(t,e){if(null!==t&&"function"!=typeof t)throw ja.create("invalid-log-argument",{appName:name});!function(s,e){for(var t=function(t){var o=null;e&&e.level&&(o=Pa[e.level]),t.userLogHandler=null===s?null:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=n.map(function(t){if(null==t)return null;if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return t.toString();if(t instanceof Error)return t.message;try{return JSON.stringify(t)}catch(t){return null}}).filter(function(t){return t}).join(" ");e>=(null!=o?o:t.logLevel)&&s({level:Ca[e].toLowerCase(),message:i,args:n,type:t.name})}},n=0,r=Aa;n<r.length;n++){t(r[n])}}(t,e)},apps:null,SDK_VERSION:Ga,INTERNAL:{registerComponent:p,removeApp:function(t){delete c[t]},components:h,useAsService:function(t,e){return"serverAuth"!==e?e:null}}};function f(t){if(!na(c,t=t||qa))throw ja.create("no-app",{appName:t});return c[t]}function p(n){var e,t,r=n.name;if(h.has(r))return Wa.debug("There were multiple attempts to register component "+r+"."),"PUBLIC"===n.type?l[r]:null;if(h.set(r,n),"PUBLIC"===n.type){var i=function(t){if(void 0===t&&(t=f()),"function"!=typeof t[r])throw ja.create("invalid-app-argument",{appName:r});return t[r]()};void 0!==n.serviceProps&&Fs(i,n.serviceProps),l[r]=i,u.prototype[r]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._getService.bind(this,r).apply(this,n.multipleInstances?t:[])}}try{for(var o=Cs(Object.keys(c)),s=o.next();!s.done;s=o.next()){var a=s.value;c[a]._addComponent(n)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return"PUBLIC"===n.type?l[r]:null}return l.default=l,Object.defineProperty(l,"apps",{get:function(){return Object.keys(c).map(function(t){return c[t]})}}),f.App=u,l}var Qa=function t(){var e=za(Ha);return e.INTERNAL=Is(Is({},e.INTERNAL),{createFirebaseNamespace:t,extendNamespace:function(t){Fs(e,t)},createSubscribe:ua,ErrorFactory:Ys,deepExtend:Fs}),e}(),Xa=(Ya.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(t){if("VERSION"!==(null==(e=t.getComponent())?void 0:e.type))return null;var e,n=t.getImmediate();return n.library+"/"+n.version}).filter(function(t){return t}).join(" ")},Ya);function Ya(t){this.container=t}if("object"==typeof self&&self.self===self&&void 0!==self.firebase){Wa.warn("\n    Warning: Firebase is already defined in the global scope. Please make sure\n    Firebase library is only loaded once.\n  ");var $a=self.firebase.SDK_VERSION;$a&&0<=$a.indexOf("LITE")&&Wa.warn("\n    Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n    You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n    ")}var Ja=Qa.initializeApp;Qa.initializeApp=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(t){return}}()&&Wa.warn('\n      Warning: This is a browser-targeted Firebase bundle but it appears it is being\n      run in a Node environment.  If running in a Node environment, make sure you\n      are using the bundle specified by the "main" field in package.json.\n      \n      If you are using Webpack, you can specify "main" as the first item in\n      "resolve.mainFields":\n      https://webpack.js.org/configuration/resolve/#resolvemainfields\n      \n      If using Rollup, use the rollup-plugin-node-resolve plugin and specify "main"\n      as the first item in "mainFields", e.g. [\'main\', \'module\'].\n      https://github.com/rollup/rollup-plugin-node-resolve\n      '),Ja.apply(void 0,t)};var Za,tu,zl=Qa;(Za=zl).INTERNAL.registerComponent(new ga("platform-logger",function(t){return new Xa(t)},"PRIVATE")),Za.registerVersion(Va,"0.6.9",tu),Za.registerVersion("fire-js","");zl.registerVersion("firebase","7.17.1","app");(function(){var t,o="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)};var s=function(t){t=["object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global,t];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}return globalThis}(this);function c(t){var e,n,r="undefined"!=typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return r?r.call(t):{next:(e=t,n=0,function(){return n<e.length?{done:!1,value:e[n++]}:{done:!0}})}}!function(t,e){if(e){var n=s;t=t.split(".");for(var r=0;r<t.length-1;r++){var i=t[r];i in n||(n[i]={}),n=n[i]}(e=e(r=n[t=t[t.length-1]]))!=r&&null!=e&&o(n,t,{configurable:!0,writable:!0,value:e})}}("Promise",function(t){function a(t){this.b=0,this.c=void 0,this.a=[];var e=this.f();try{t(e.resolve,e.reject)}catch(t){e.reject(t)}}function e(){this.a=null}function u(e){return e instanceof a?e:new a(function(t){t(e)})}if(t)return t;e.prototype.b=function(t){if(null==this.a){this.a=[];var e=this;this.c(function(){e.g()})}this.a.push(t)};var n=s.setTimeout;e.prototype.c=function(t){n(t,0)},e.prototype.g=function(){for(;this.a&&this.a.length;){var t=this.a;this.a=[];for(var e=0;e<t.length;++e){var n=t[e];t[e]=null;try{n()}catch(t){this.f(t)}}}this.a=null},e.prototype.f=function(t){this.c(function(){throw t})},a.prototype.f=function(){function t(e){return function(t){r||(r=!0,e.call(n,t))}}var n=this,r=!1;return{resolve:t(this.m),reject:t(this.g)}},a.prototype.m=function(t){if(t===this)this.g(new TypeError("A Promise cannot resolve to itself"));else if(t instanceof a)this.s(t);else{t:switch(typeof t){case"object":var e=null!=t;break t;case"function":e=!0;break t;default:e=!1}e?this.u(t):this.h(t)}},a.prototype.u=function(t){var e=void 0;try{e=t.then}catch(t){return void this.g(t)}"function"==typeof e?this.w(e,t):this.h(t)},a.prototype.g=function(t){this.i(2,t)},a.prototype.h=function(t){this.i(1,t)},a.prototype.i=function(t,e){if(0!=this.b)throw Error("Cannot settle("+t+", "+e+"): Promise already settled in state"+this.b);this.b=t,this.c=e,this.l()},a.prototype.l=function(){if(null!=this.a){for(var t=0;t<this.a.length;++t)i.b(this.a[t]);this.a=null}};var i=new e;return a.prototype.s=function(t){var e=this.f();t.Oa(e.resolve,e.reject)},a.prototype.w=function(t,e){var n=this.f();try{t.call(e,n.resolve,n.reject)}catch(t){n.reject(t)}},a.prototype.then=function(t,e){function n(e,t){return"function"==typeof e?function(t){try{r(e(t))}catch(t){i(t)}}:t}var r,i,o=new a(function(t,e){r=t,i=e});return this.Oa(n(t,r),n(e,i)),o},a.prototype.catch=function(t){return this.then(void 0,t)},a.prototype.Oa=function(t,e){function n(){switch(r.b){case 1:t(r.c);break;case 2:e(r.c);break;default:throw Error("Unexpected state: "+r.b)}}var r=this;null==this.a?i.b(n):this.a.push(n)},a.resolve=u,a.reject=function(n){return new a(function(t,e){e(n)})},a.race=function(i){return new a(function(t,e){for(var n=c(i),r=n.next();!r.done;r=n.next())u(r.value).Oa(t,e)})},a.all=function(t){var o=c(t),s=o.next();return s.done?u([]):new a(function(n,t){function e(e){return function(t){r[e]=t,0==--i&&n(r)}}for(var r=[],i=0;r.push(void 0),i++,u(s.value).Oa(e(r.length-1),t),!(s=o.next()).done;);})},a});var u=u||{},l=this||self,f=/^[\w+/_-]+[=]{0,2}$/,p=null;function a(){}function n(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function h(t){var e=n(t);return"array"==e||"object"==e&&"number"==typeof t.length}function d(t){return"function"==n(t)}function v(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var r="closure_uid_"+(1e9*Math.random()>>>0),i=0;function y(t,e,n){return t.call.apply(t.bind,arguments)}function g(e,n,t){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,r),e.apply(n,t)}}return function(){return e.apply(n,arguments)}}function m(t,e,n){return(m=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?y:g).apply(null,arguments)}function b(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}var w=Date.now||function(){return+new Date};function e(t,e){function n(){}n.prototype=e.prototype,t.Za=e.prototype,t.prototype=new n,t.prototype.constructor=t}function _(t,e,n){this.code=T+t,this.message=e||S[t]||"",this.a=n||null}function E(t){var e=t&&t.code;return e?new _(e.substring(T.length),t.message,t.serverResponse):null}e(_,Error),_.prototype.v=function(){var t={code:this.code,message:this.message};return this.a&&(t.serverResponse=this.a),t},_.prototype.toJSON=function(){return this.v()};var I,T="auth/",S={"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal error has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registed for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal error has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal error has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network error (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal error has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted.  Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled."},C={hd:{Ra:"https://staging-identitytoolkit.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Xa:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Ua:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"b"},pd:{Ra:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",Xa:"https://securetoken.googleapis.com/v1/token",Ua:"https://identitytoolkit.googleapis.com/v2/",id:"p"},rd:{Ra:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Xa:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Ua:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"s"},sd:{Ra:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",Xa:"https://test-securetoken.sandbox.googleapis.com/v1/token",Ua:"https://test-identitytoolkit.sandbox.googleapis.com/v2/",id:"t"}};function N(t){for(var e in C)if(C[e].id===t)return{firebaseEndpoint:(t=C[e]).Ra,secureTokenEndpoint:t.Xa,identityPlatformEndpoint:t.Ua};return null}function A(t){if(t)try{return t.$goog_Thenable}catch(t){return}}function k(t){if(Error.captureStackTrace)Error.captureStackTrace(this,k);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t))}function O(t,e){for(var n="",r=(t=t.split("%s")).length-1,i=0;i<r;i++)n+=t[i]+(i<e.length?e[i]:"%s");k.call(this,n+t[r])}function P(t,e){throw new O("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))}function R(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function D(t,e){t.f(e),t.b<100&&(t.b++,e.next=t.a,t.a=e)}function x(){this.b=this.a=null}I=N("__EID__")?"__EID__":void 0,e(k,Error),k.prototype.name="CustomError",e(O,k),O.prototype.name="AssertionError",R.prototype.get=function(){if(0<this.b){this.b--;var t=this.a;this.a=t.next,t.next=null}else t=this.c();return t};var L=new R(function(){return new M},function(t){t.reset()});function M(){this.next=this.b=this.a=null}x.prototype.add=function(t,e){var n=L.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},M.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},M.prototype.reset=function(){this.next=this.b=this.a=null};var F=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},U=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i="string"==typeof t?t.split(""):t,o=0;o<r;o++)o in i&&e.call(n,i[o],o,t)};var j=Array.prototype.filter?function(t,e){return Array.prototype.filter.call(t,e,void 0)}:function(t,e){for(var n=t.length,r=[],i=0,o="string"==typeof t?t.split(""):t,s=0;s<n;s++)if(s in o){var a=o[s];e.call(void 0,a,s,t)&&(r[i++]=a)}return r},V=Array.prototype.map?function(t,e){return Array.prototype.map.call(t,e,void 0)}:function(t,e){for(var n=t.length,r=Array(n),i="string"==typeof t?t.split(""):t,o=0;o<n;o++)o in i&&(r[o]=e.call(void 0,i[o],o,t));return r},q=Array.prototype.some?function(t,e){return Array.prototype.some.call(t,e,void 0)}:function(t,e){for(var n=t.length,r="string"==typeof t?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t))return!0;return!1};function B(t,e){return 0<=F(t,e)}function W(t,e){var n;return(n=0<=(e=F(t,e)))&&Array.prototype.splice.call(t,e,1),n}function H(n,r){!function(t,e){for(var n="string"==typeof t?t.split(""):t,r=t.length-1;0<=r;--r)r in n&&e.call(void 0,n[r],r,t)}(n,function(t,e){r.call(void 0,t,e,n)&&1==Array.prototype.splice.call(n,e,1).length&&0})}function K(t){return Array.prototype.concat.apply([],arguments)}function G(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}var z,Q=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},X=/&/g,Y=/</g,$=/>/g,J=/"/g,Z=/'/g,tt=/\x00/g,et=/[\x00&<>"']/;function nt(t,e){return-1!=t.indexOf(e)}function rt(t,e){return t<e?-1:e<t?1:0}t:{var it=l.navigator;if(it){var ot=it.userAgent;if(ot){z=ot;break t}}z=""}function st(t){return nt(z,t)}function at(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function ut(t){for(var e in t)return;return 1}function ct(t){var e,n={};for(e in t)n[e]=t[e];return n}var ht="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function lt(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var o=0;o<ht.length;o++)n=ht[o],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function ft(t,e){t:{try{var n=t&&t.ownerDocument,r=n&&(n.defaultView||n.parentWindow);if((r=r||l).Element&&r.Location){var i=r;break t}}catch(t){}i=null}if(i&&void 0!==i[e]&&(!t||!(t instanceof i[e])&&(t instanceof i.Location||t instanceof i.Element))){if(v(t))try{var o=t.constructor.displayName||t.constructor.name||Object.prototype.toString.call(t)}catch(t){o="<object could not be stringified>"}else o=void 0===t?"undefined":null===t?"null":typeof t;P("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,o)}}function pt(t,e){this.a=t===yt&&e||"",this.b=vt}function dt(t){return t instanceof pt&&t.constructor===pt&&t.b===vt?t.a:(P("expected object of type Const, got '"+t+"'"),"type_error:Const")}pt.prototype.ra=!0,pt.prototype.qa=function(){return this.a},pt.prototype.toString=function(){return"Const{"+this.a+"}"};var vt={},yt={},gt=new pt(yt,"");function mt(t,e){this.a=t===Tt&&e||"",this.b=It}function bt(t){return t instanceof mt&&t.constructor===mt&&t.b===It?t.a:(P("expected object of type TrustedResourceUrl, got '"+t+"' of type "+n(t)),"type_error:TrustedResourceUrl")}function wt(t,n){var r=dt(t);if(!Et.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(_t,function(t,e){if(!Object.prototype.hasOwnProperty.call(n,e))throw Error('Found marker, "'+e+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(n));return(t=n[e])instanceof pt?dt(t):encodeURIComponent(String(t))}),new mt(Tt,t)}mt.prototype.ra=!0,mt.prototype.qa=function(){return this.a.toString()},mt.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var _t=/%{(\w+)}/g,Et=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,It={},Tt={};function St(t,e){this.a=t===Ot&&e||"",this.b=kt}function Ct(t){return t instanceof St&&t.constructor===St&&t.b===kt?t.a:(P("expected object of type SafeUrl, got '"+t+"' of type "+n(t)),"type_error:SafeUrl")}St.prototype.ra=!0,St.prototype.qa=function(){return this.a.toString()},St.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Nt=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function At(t){return t instanceof St?t:(t="object"==typeof t&&t.ra?t.qa():String(t),Nt.test(t)||(t="about:invalid#zClosurez"),new St(Ot,t))}var kt={},Ot={};function Pt(){this.a="",this.b=Dt}function Rt(t){return t instanceof Pt&&t.constructor===Pt&&t.b===Dt?t.a:(P("expected object of type SafeHtml, got '"+t+"' of type "+n(t)),"type_error:SafeHtml")}Pt.prototype.ra=!0,Pt.prototype.qa=function(){return this.a.toString()},Pt.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Dt={};function xt(t){var e=new Pt;return e.a=t,e}xt("<!DOCTYPE html>");var Lt=xt("");function Mt(t,e){for(var n=t.split("%s"),r="",i=Array.prototype.slice.call(arguments,1);i.length&&1<n.length;)r+=n.shift()+i.shift();return r+n.join("%s")}function Ft(t){return et.test(t)&&(-1!=t.indexOf("&")&&(t=t.replace(X,"&amp;")),-1!=t.indexOf("<")&&(t=t.replace(Y,"&lt;")),-1!=t.indexOf(">")&&(t=t.replace($,"&gt;")),-1!=t.indexOf('"')&&(t=t.replace(J,"&quot;")),-1!=t.indexOf("'")&&(t=t.replace(Z,"&#39;")),-1!=t.indexOf("\0")&&(t=t.replace(tt,"&#0;"))),t}function Ut(t){return Ut[" "](t),t}xt("<br>"),Ut[" "]=a;var jt,Vt,qt=st("Opera"),Bt=st("Trident")||st("MSIE"),Wt=st("Edge"),Ht=Wt||Bt,Kt=st("Gecko")&&!(nt(z.toLowerCase(),"webkit")&&!st("Edge"))&&!(st("Trident")||st("MSIE"))&&!st("Edge"),Gt=nt(z.toLowerCase(),"webkit")&&!st("Edge");function zt(){var t=l.document;return t?t.documentMode:void 0}t:{var Qt="",Xt=(Vt=z,Kt?/rv:([^\);]+)(\)|;)/.exec(Vt):Wt?/Edge\/([\d\.]+)/.exec(Vt):Bt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Vt):Gt?/WebKit\/(\S+)/.exec(Vt):qt?/(?:Version)[ \/]?(\S+)/.exec(Vt):void 0);if(Xt&&(Qt=Xt?Xt[1]:""),Bt){var Yt=zt();if(null!=Yt&&Yt>parseFloat(Qt)){jt=String(Yt);break t}}jt=Qt}var $t,Jt={};function Zt(a){return t=a,e=function(){for(var t=0,e=Q(String(jt)).split("."),n=Q(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var o=e[i]||"",s=n[i]||"";do{if(o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==o[0].length&&0==s[0].length)break;t=rt(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||rt(0==o[2].length,0==s[2].length)||rt(o[2],s[2]),o=o[3],s=s[3]}while(0==t)}return 0<=t},n=Jt,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}$t=l.document&&Bt?zt():void 0;try{new self.OffscreenCanvas(0,0).getContext("2d")}catch(t){}var te=!Bt||9<=Number($t);function ee(t){var e=document;return"string"==typeof t?e.getElementById(t):t}function ne(n,t){at(t,function(t,e){t&&"object"==typeof t&&t.ra&&(t=t.qa()),"style"==e?n.style.cssText=t:"class"==e?n.className=t:"for"==e?n.htmlFor=t:oe.hasOwnProperty(e)?n.setAttribute(oe[e],t):0==e.lastIndexOf("aria-",0)||0==e.lastIndexOf("data-",0)?n.setAttribute(e,t):n[e]=t})}var re,ie,oe={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function se(t,e,n){var r=arguments,i=document,o=String(r[0]),s=r[1];if(!te&&s&&(s.name||s.type)){if(o=["<",o],s.name&&o.push(' name="',Ft(s.name),'"'),s.type){o.push(' type="',Ft(s.type),'"');var a={};lt(a,s),delete a.type,s=a}o.push(">"),o=o.join("")}return o=ae(i,o),s&&("string"==typeof s?o.className=s:Array.isArray(s)?o.className=s.join(" "):ne(o,s)),2<r.length&&function(e,n,t){function r(t){t&&n.appendChild("string"==typeof t?e.createTextNode(t):t)}for(var i=2;i<t.length;i++){var o=t[i];!h(o)||v(o)&&0<o.nodeType?r(o):U(ue(o)?G(o):o,r)}}(i,o,r),o}function ae(t,e){return e=String(e),"application/xhtml+xml"===t.contentType&&(e=e.toLowerCase()),t.createElement(e)}function ue(t){if(t&&"number"==typeof t.length){if(v(t))return"function"==typeof t.item||"string"==typeof t.item;if(d(t))return"function"==typeof t.item}}function ce(t){l.setTimeout(function(){throw t},0)}function he(){var t=l.MessageChannel;if(void 0===t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!st("Presto")&&(t=function(){var t,e,n=ae(document,"IFRAME");n.style.display="none",t=n,e=new mt(Tt,dt(gt)),ft(t,"HTMLIFrameElement"),t.src=bt(e).toString(),document.documentElement.appendChild(n);var r=n.contentWindow;(n=r.document).open(),n.write(Rt(Lt)),n.close();var i="callImmediate"+Math.random(),o="file:"==r.location.protocol?"*":r.location.protocol+"//"+r.location.host;n=m(function(t){"*"!=o&&t.origin!=o||t.data!=i||this.port1.onmessage()},this),r.addEventListener("message",n,!1),this.port1={},this.port2={postMessage:function(){r.postMessage(i,o)}}}),void 0===t||st("Trident")||st("MSIE"))return function(t){l.setTimeout(t,0)};var e=new t,n={},r=n;return e.port1.onmessage=function(){if(void 0!==n.next){var t=(n=n.next).Db;n.Db=null,t()}},function(t){r.next={Db:t},r=r.next,e.port2.postMessage(0)}}function le(t,e){ie||function(){if(l.Promise&&l.Promise.resolve){var t=l.Promise.resolve(void 0);ie=function(){t.then(de)}}else ie=function(){var t=de;!d(l.setImmediate)||l.Window&&l.Window.prototype&&!st("Edge")&&l.Window.prototype.setImmediate==l.setImmediate?(re=re||he())(t):l.setImmediate(t)}}(),fe||(ie(),fe=!0),pe.add(t,e)}var fe=!1,pe=new x;function de(){for(var t;n=e=void 0,n=null,(e=pe).a&&(n=e.a,e.a=e.a.next,e.a||(e.b=null),n.next=null),t=n;){try{t.a.call(t.b)}catch(t){ce(t)}D(L,t)}var e,n;fe=!1}function ve(t,e){if(this.a=ye,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,t!=a)try{var n=this;t.call(e,function(t){Ae(n,ge,t)},function(t){if(!(t instanceof Le))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(t){}Ae(n,me,t)})}catch(t){Ae(this,me,t)}}var ye=0,ge=2,me=3;function be(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}be.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var we=new R(function(){return new be},function(t){t.reset()});function _e(t,e,n){var r=we.get();return r.g=t,r.b=e,r.f=n,r}function Ee(t){if(t instanceof ve)return t;var e=new ve(a);return Ae(e,ge,t),e}function Ie(n){return new ve(function(t,e){e(n)})}function Te(t,e,n){ke(t,e,n,null)||le(b(e,t))}function Se(n){return new ve(function(r){var i=n.length,o=[];if(i)for(var t=function(t,e,n){i--,o[t]=e?{Mb:!0,value:n}:{Mb:!1,reason:n},0==i&&r(o)},e=0;e<n.length;e++)Te(n[e],b(t,e,!0),b(t,e,!1));else r(o)})}function Ce(t,e){t.b||t.a!=ge&&t.a!=me||Oe(t),t.f?t.f.next=e:t.b=e,t.f=e}function Ne(t,i,o,s){var e=_e(null,null,null);return e.a=new ve(function(n,r){e.g=i?function(t){try{var e=i.call(s,t);n(e)}catch(t){r(t)}}:n,e.b=o?function(t){try{var e=o.call(s,t);void 0===e&&t instanceof Le?r(t):n(e)}catch(t){r(t)}}:r}),Ce(e.a.c=t,e),e.a}function Ae(t,e,n){var r,i;t.a==ye&&(t===n&&(e=me,n=new TypeError("Promise cannot resolve to itself")),t.a=1,ke(n,t.Yc,t.Zc,t)||(t.i=n,t.a=e,t.c=null,Oe(t),e!=me||n instanceof Le||(i=n,(r=t).g=!0,le(function(){r.g&&xe.call(null,i)}))))}function ke(t,e,n,r){if(t instanceof ve)return Ce(t,_e(e||a,n||null,r)),1;if(A(t))return t.then(e,n,r),1;if(v(t))try{var i=t.then;if(d(i))return function(t,e,n,r,i){function o(t){s||(s=!0,r.call(i,t))}var s=!1;try{e.call(t,function(t){s||(s=!0,n.call(i,t))},o)}catch(t){o(t)}}(t,i,e,n,r),1}catch(t){return n.call(r,t),1}}function Oe(t){t.h||(t.h=!0,le(t.ec,t))}function Pe(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.f=null),e}function Re(t,e,n,r){if(n==me&&e.b&&!e.c)for(;t&&t.g;t=t.c)t.g=!1;if(e.a)e.a.c=null,De(e,n,r);else try{e.c?e.g.call(e.f):De(e,n,r)}catch(t){xe.call(null,t)}D(we,e)}function De(t,e,n){e==ge?t.g.call(t.f,n):t.b&&t.b.call(t.f,n)}ve.prototype.then=function(t,e,n){return Ne(this,d(t)?t:null,d(e)?e:null,n)},ve.prototype.$goog_Thenable=!0,(t=ve.prototype).ma=function(t,e){return(t=_e(t,t,e)).c=!0,Ce(this,t),this},t.o=function(t,e){return Ne(this,null,t,e)},t.cancel=function(t){if(this.a==ye){var e=new Le(t);le(function(){!function t(e,n){if(e.a==ye)if(e.c){var r=e.c;if(r.b){for(var i=0,o=null,s=null,a=r.b;a&&(a.c||(i++,a.a==e&&(o=a),!(o&&1<i)));a=a.next)o||(s=a);o&&(r.a==ye&&1==i?t(r,n):(s?((i=s).next==r.f&&(r.f=i),i.next=i.next.next):Pe(r),Re(r,o,me,n)))}e.c=null}else Ae(e,me,n)}(this,e)},this)}},t.Yc=function(t){this.a=ye,Ae(this,ge,t)},t.Zc=function(t){this.a=ye,Ae(this,me,t)},t.ec=function(){for(var t;t=Pe(this);)Re(this,t,this.a,this.i);this.h=!1};var xe=ce;function Le(t){k.call(this,t)}function Me(){this.wa=this.wa,this.na=this.na}e(Le,k);var Fe=0;function Ue(t){if(!t.wa&&(t.wa=!0,t.Ba(),0!=Fe))e=t,Object.prototype.hasOwnProperty.call(e,r)&&e[r]||(e[r]=++i);var e}Me.prototype.wa=!(Le.prototype.name="cancel"),Me.prototype.Ba=function(){if(this.na)for(;this.na.length;)this.na.shift()()};var je=Object.freeze||function(t){return t},Ve=!Bt||9<=Number($t),qe=Bt&&!Zt("9"),Be=function(){if(!l.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{l.addEventListener("test",a,e),l.removeEventListener("test",a,e)}catch(t){}return t}();function We(t,e){this.type=t,this.b=this.target=e,this.defaultPrevented=!1}function He(t,e){if(We.call(this,t?t.type:""),this.relatedTarget=this.b=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.pointerId=0,this.pointerType="",this.a=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.b=e,e=t.relatedTarget){if(Kt){t:{try{Ut(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:Ke[t.pointerType]||"",(this.a=t).defaultPrevented&&this.preventDefault()}}We.prototype.preventDefault=function(){this.defaultPrevented=!0},e(He,We);var Ke=je({2:"touch",3:"pen",4:"mouse"});He.prototype.preventDefault=function(){He.Za.preventDefault.call(this);var t=this.a;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,qe)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}},He.prototype.f=function(){return this.a};var Ge="closure_listenable_"+(1e6*Math.random()|0),ze=0;function Qe(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.Ta=i,this.key=++ze,this.ua=this.Na=!1}function Xe(t){t.ua=!0,t.listener=null,t.proxy=null,t.src=null,t.Ta=null}function Ye(t){this.src=t,this.a={},this.b=0}function $e(t,e){var n=e.type;n in t.a&&W(t.a[n],e)&&(Xe(e),0==t.a[n].length&&(delete t.a[n],t.b--))}function Je(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.ua&&o.listener==e&&o.capture==!!n&&o.Ta==r)return i}return-1}Ye.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=Je(t,e,r,i);return-1<s?(e=t[s],n||(e.Na=!1)):((e=new Qe(e,this.src,o,!!r,i)).Na=n,t.push(e)),e};var Ze="closure_lm_"+(1e6*Math.random()|0),tn={};function en(t,e,n,r,i){if(r&&r.once)rn(t,e,n,r,i);else if(Array.isArray(e))for(var o=0;o<e.length;o++)en(t,e[o],n,r,i);else n=pn(n),t&&t[Ge]?vn(t,e,n,v(r)?!!r.capture:!!r,i):nn(t,e,n,!1,r,i)}function nn(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s,a,u=v(i)?!!i.capture:!!i,c=ln(t);if(c||(t[Ze]=c=new Ye(t)),!(n=c.add(e,n,r,u,o)).proxy)if(s=hn,r=a=Ve?function(t){return s.call(a.src,a.listener,t)}:function(t){if(!(t=s.call(a.src,a.listener,t)))return t},(n.proxy=r).src=t,r.listener=n,t.addEventListener)Be||(i=u),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(an(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}}function rn(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)rn(t,e[o],n,r,i);else n=pn(n),t&&t[Ge]?yn(t,e,n,v(r)?!!r.capture:!!r,i):nn(t,e,n,!0,r,i)}function on(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)on(t,e[o],n,r,i);else r=v(r)?!!r.capture:!!r,n=pn(n),t&&t[Ge]?(t=t.u,(e=String(e).toString())in t.a&&(-1<(n=Je(o=t.a[e],n,r,i))&&(Xe(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete t.a[e],t.b--)))):(t=t&&ln(t))&&(e=t.a[e.toString()],t=-1,e&&(t=Je(e,n,r,i)),(n=-1<t?e[t]:null)&&sn(n))}function sn(t){if("number"!=typeof t&&t&&!t.ua){var e=t.src;if(e&&e[Ge])$e(e.u,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(an(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=ln(e))?($e(n,t),0==n.b&&(n.src=null,e[Ze]=null)):Xe(t)}}}function an(t){return t in tn?tn[t]:tn[t]="on"+t}function un(t,e,n,r){var i=!0;if((t=ln(t))&&(e=t.a[e.toString()]))for(e=e.concat(),t=0;t<e.length;t++){var o=e[t];o&&o.capture==n&&!o.ua&&(o=cn(o,r),i=i&&!1!==o)}return i}function cn(t,e){var n=t.listener,r=t.Ta||t.src;return t.Na&&sn(t),n.call(r,e)}function hn(t,e){if(t.ua)return!0;if(Ve)return cn(t,new He(e,this));if(!e)t:{e=["window","event"];for(var n=l,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}if(e=new He(r=e,this),n=!0,!(r.keyCode<0||null!=r.returnValue)){t:{var i=!1;if(0==r.keyCode)try{r.keyCode=-1;break t}catch(t){i=!0}!i&&null!=r.returnValue||(r.returnValue=!0)}for(r=[],i=e.b;i;i=i.parentNode)r.push(i);for(t=t.type,i=r.length-1;0<=i;i--){e.b=r[i];var o=un(r[i],t,!0,e);n=n&&o}for(i=0;i<r.length;i++)e.b=r[i],o=un(r[i],t,!1,e),n=n&&o}return n}function ln(t){return(t=t[Ze])instanceof Ye?t:null}var fn="__closure_events_fn_"+(1e9*Math.random()>>>0);function pn(e){return d(e)?e:(e[fn]||(e[fn]=function(t){return e.handleEvent(t)}),e[fn])}function dn(){Me.call(this),this.u=new Ye(this),(this.Yb=this).eb=null}function vn(t,e,n,r,i){t.u.add(String(e),n,!1,r,i)}function yn(t,e,n,r,i){t.u.add(String(e),n,!0,r,i)}function gn(t,e,n,r){if(!(e=t.u.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var s=e[o];if(s&&!s.ua&&s.capture==n){var a=s.listener,u=s.Ta||s.src;s.Na&&$e(t.u,s),i=!1!==a.call(u,r)&&i}}return i&&!r.defaultPrevented}function mn(t,e,n){if(d(t))n&&(t=m(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=m(t.handleEvent,t)}return 2147483647<Number(e)?-1:l.setTimeout(t,e||0)}function bn(n){var r=null;return new ve(function(t,e){-1==(r=mn(function(){t(void 0)},n))&&e(Error("Failed to schedule timer."))}).o(function(t){throw l.clearTimeout(r),t})}function wn(t){if(t.V&&"function"==typeof t.V)return t.V();if("string"==typeof t)return t.split("");if(h(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}function _n(t){if(t.X&&"function"==typeof t.X)return t.X();if(!t.V||"function"!=typeof t.V){if(h(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}function En(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof En)for(n=t.X(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function In(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];Tn(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){var i={};for(n=e=0;e<t.a.length;)Tn(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function Tn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e(dn,Me),dn.prototype[Ge]=!0,dn.prototype.addEventListener=function(t,e,n,r){en(this,t,e,n,r)},dn.prototype.removeEventListener=function(t,e,n,r){on(this,t,e,n,r)},dn.prototype.dispatchEvent=function(t){var e,n=this.eb;if(n)for(e=[];n;n=n.eb)e.push(n);n=this.Yb;var r=t.type||t;if("string"==typeof t)t=new We(t,n);else if(t instanceof We)t.target=t.target||n;else{var i=t;lt(t=new We(r,n),i)}if(i=!0,e)for(var o=e.length-1;0<=o;o--){var s=t.b=e[o];i=gn(s,r,!0,t)&&i}if(i=gn(s=t.b=n,r,!0,t)&&i,i=gn(s,r,!1,t)&&i,e)for(o=0;o<e.length;o++)i=gn(s=t.b=e[o],r,!1,t)&&i;return i},dn.prototype.Ba=function(){if(dn.Za.Ba.call(this),this.u){var t,e=this.u;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)Xe(n[r]);delete e.a[t],e.b--}}this.eb=null},(t=En.prototype).V=function(){In(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},t.X=function(){return In(this),this.a.concat()},t.clear=function(){this.b={},this.c=this.a.length=0},t.get=function(t,e){return Tn(this.b,t)?this.b[t]:e},t.set=function(t,e){Tn(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},t.forEach=function(t,e){for(var n=this.X(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Sn=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/\\#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Cn(t,e){var n;this.b=this.i=this.f="",this.l=null,this.g=this.c="",this.h=!1,t instanceof Cn?(this.h=void 0!==e?e:t.h,Nn(this,t.f),this.i=t.i,this.b=t.b,An(this,t.l),this.c=t.c,kn(this,Qn(t.a)),this.g=t.g):t&&(n=String(t).match(Sn))?(this.h=!!e,Nn(this,n[1]||"",!0),this.i=xn(n[2]||""),this.b=xn(n[3]||"",!0),An(this,n[4]),this.c=xn(n[5]||"",!0),kn(this,n[6]||"",!0),this.g=xn(n[7]||"")):(this.h=!!e,this.a=new Bn(null,this.h))}function Nn(t,e,n){t.f=n?xn(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function An(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.l=e}else t.l=null}function kn(t,e,n){var r,i;e instanceof Bn?(t.a=e,r=t.a,(i=t.h)&&!r.f&&(Wn(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Kn(this,e),zn(this,n,t))},r)),r.f=i):(n||(e=Ln(e,Vn)),t.a=new Bn(e,t.h))}function On(t,e,n){t.a.set(e,n)}function Pn(t,e){return t.a.get(e)}function Rn(t){return t instanceof Cn?new Cn(t):new Cn(t,void 0)}function Dn(t,e){var n=new Cn(null,void 0);return Nn(n,"https"),t&&(n.b=t),e&&(n.c=e),n}function xn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Ln(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Mn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Mn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Cn.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Ln(e,Fn,!0),":");var n=this.b;return!n&&"file"!=e||(t.push("//"),(e=this.i)&&t.push(Ln(e,Fn,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.l)&&t.push(":",String(n))),(n=this.c)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(Ln(n,"/"==n.charAt(0)?jn:Un,!0))),(n=this.a.toString())&&t.push("?",n),(n=this.g)&&t.push("#",Ln(n,qn)),t.join("")},Cn.prototype.resolve=function(t){var e=new Cn(this),n=!!t.f;n?Nn(e,t.f):n=!!t.i,n?e.i=t.i:n=!!t.b,n?e.b=t.b:n=null!=t.l;var r=t.c;if(n)An(e,t.l);else if(n=!!t.c){if("/"!=r.charAt(0))if(this.b&&!this.c)r="/"+r;else{var i=e.c.lastIndexOf("/");-1!=i&&(r=e.c.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(nt(i,"./")||nt(i,"/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var o=[],s=0;s<i.length;){var a=i[s++];"."==a?r&&s==i.length&&o.push(""):".."==a?((1<o.length||1==o.length&&""!=o[0])&&o.pop(),r&&s==i.length&&o.push("")):(o.push(a),r=!0)}r=o.join("/")}else r=i}return n?e.c=r:n=""!==t.a.toString(),n?kn(e,Qn(t.a)):n=!!t.g,n&&(e.g=t.g),e};var Fn=/[#\/\?@]/g,Un=/[#\?:]/g,jn=/[#\?]/g,Vn=/[#\?@]/g,qn=/#/g;function Bn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Wn(n){n.a||(n.a=new En,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function Hn(t){var e=_n(t);if(void 0===e)throw Error("Keys are undefined");var n=new Bn(null,void 0);t=wn(t);for(var r=0;r<e.length;r++){var i=e[r],o=t[r];Array.isArray(o)?zn(n,i,o):n.add(i,o)}return n}function Kn(t,e){Wn(t),e=Xn(t,e),Tn(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,Tn((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&In(t)))}function Gn(t,e){return Wn(t),e=Xn(t,e),Tn(t.a.b,e)}function zn(t,e,n){Kn(t,e),0<n.length&&(t.c=null,t.a.set(Xn(t,e),G(n)),t.b+=n.length)}function Qn(t){var e=new Bn;return e.c=t.c,t.a&&(e.a=new En(t.a),e.b=t.b),e}function Xn(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function Yn(t){var e=[];return function t(e,n,r){if(null==n)r.push("null");else{if("object"==typeof n){if(Array.isArray(n)){var i=n;n=i.length,r.push("[");for(var o="",s=0;s<n;s++)r.push(o),t(e,i[s],r),o=",";return void r.push("]")}if(!(n instanceof String||n instanceof Number||n instanceof Boolean)){for(i in r.push("{"),o="",n)Object.prototype.hasOwnProperty.call(n,i)&&("function"!=typeof(s=n[i])&&(r.push(o),tr(i,r),r.push(":"),t(e,s,r),o=","));return void r.push("}")}n=n.valueOf()}switch(typeof n){case"string":tr(n,r);break;case"number":r.push(isFinite(n)&&!isNaN(n)?String(n):"null");break;case"boolean":r.push(String(n));break;case"function":r.push("null");break;default:throw Error("Unknown type: "+typeof n)}}}(new $n,t,e),e.join("")}function $n(){}(t=Bn.prototype).add=function(t,e){Wn(this),this.c=null,t=Xn(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},t.clear=function(){this.a=this.c=null,this.b=0},t.forEach=function(n,r){Wn(this),this.a.forEach(function(t,e){U(t,function(t){n.call(r,t,e,this)},this)},this)},t.X=function(){Wn(this);for(var t=this.a.V(),e=this.a.X(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},t.V=function(t){Wn(this);var e=[];if("string"==typeof t)Gn(this,t)&&(e=K(e,this.a.get(Xn(this,t))));else{t=this.a.V();for(var n=0;n<t.length;n++)e=K(e,t[n])}return e},t.set=function(t,e){return Wn(this),this.c=null,Gn(this,t=Xn(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},t.get=function(t,e){return t&&0<(t=this.V(t)).length?String(t[0]):e},t.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.X(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.V(r);for(var o=0;o<r.length;o++){var s=i;""!==r[o]&&(s+="="+encodeURIComponent(String(r[o]))),t.push(s)}}return this.c=t.join("&")};var Jn={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},Zn=/\uffff/.test("")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;function tr(t,e){e.push('"',t.replace(Zn,function(t){var e=Jn[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),Jn[t]=e),e}),'"')}function er(){var t=wr();return Bt&&$t&&11==$t||/Edge\/\d+/.test(t)}function nr(){return l.window&&l.window.location.href||self&&self.location&&self.location.href||""}function rr(t,e){e=e||l.window;var n="about:blank";t&&(n=Ct(At(t))),e.location.href=n}function ir(t){return!!((t=(t||wr()).toLowerCase()).match(/android/)||t.match(/webos/)||t.match(/iphone|ipad|ipod/)||t.match(/blackberry/)||t.match(/windows phone/)||t.match(/iemobile/))}function or(t){t=t||l.window;try{t.close()}catch(t){}}function sr(t,e,n){var r=Math.floor(1e9*Math.random()).toString();e=e||500,n=n||600;var i=(window.screen.availHeight-n)/2,o=(window.screen.availWidth-e)/2;for(s in e={width:e,height:n,top:0<i?i:0,left:0<o?o:0,location:!0,resizable:!0,statusbar:!0,toolbar:!1},n=wr().toLowerCase(),r&&(e.target=r,nt(n,"crios/")&&(e.target="_blank")),gr(wr())==vr&&(t=t||"http://localhost",e.scrollbars=!0),n=t||"",(t=e)||(t={}),r=window,e=n instanceof St?n:At(void 0!==n.href?n.href:String(n)),n=t.target||n.target,i=[],t)switch(s){case"width":case"height":case"top":case"left":i.push(s+"="+t[s]);break;case"target":case"noopener":case"noreferrer":break;default:i.push(s+"="+(t[s]?1:0))}var s=i.join(",");if((st("iPhone")&&!st("iPod")&&!st("iPad")||st("iPad")||st("iPod"))&&r.navigator&&r.navigator.standalone&&n&&"_self"!=n?(ft(s=ae(document,"A"),"HTMLAnchorElement"),e instanceof St||e instanceof St||(e="object"==typeof e&&e.ra?e.qa():String(e),Nt.test(e)||(e="about:invalid#zClosurez"),e=new St(Ot,e)),s.href=Ct(e),s.setAttribute("target",n),t.noreferrer&&s.setAttribute("rel","noreferrer"),(t=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,r,1),s.dispatchEvent(t),s={}):t.noreferrer?(s=r.open("",n,s),t=Ct(e),s&&(Ht&&nt(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),s.opener=null,t=xt('<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+Ft(t)+'">'),r=s.document)&&(r.write(Rt(t)),r.close())):(s=r.open(Ct(e),n,s))&&t.noopener&&(s.opener=null),s)try{s.focus()}catch(t){}return s}var ar=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ur=/^[^@]+@[^@]+$/;function cr(){var e=null;return new ve(function(t){"complete"==l.document.readyState?t():(e=function(){t()},rn(window,"load",e))}).o(function(t){throw on(window,"load",e),t})}function hr(t){return t=t||wr(),!("file:"!==Sr()&&"ionic:"!==Sr()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function lr(){var t=l.window;try{return t&&t!=t.top}catch(t){return}}function fr(){return void 0!==l.WorkerGlobalScope&&"function"==typeof l.importScripts}function pr(){return zl.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":zl.INTERNAL.hasOwnProperty("node")?"Node":fr()?"Worker":"Browser"}function dr(){var t=pr();return"ReactNative"===t||"Node"===t}var vr="Firefox",yr="Chrome";function gr(t){var e=t.toLowerCase();return nt(e,"opera/")||nt(e,"opr/")||nt(e,"opios/")?"Opera":nt(e,"iemobile")?"IEMobile":nt(e,"msie")||nt(e,"trident/")?"IE":nt(e,"edge/")?"Edge":nt(e,"firefox/")?vr:nt(e,"silk/")?"Silk":nt(e,"blackberry")?"Blackberry":nt(e,"webos")?"Webos":!nt(e,"safari/")||nt(e,"chrome/")||nt(e,"crios/")||nt(e,"android")?!nt(e,"chrome/")&&!nt(e,"crios/")||nt(e,"edge/")?nt(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":yr:"Safari"}var mr={jd:"FirebaseCore-web",ld:"FirebaseUI-web"};function br(t,e){e=e||[];var n,r=[],i={};for(n in mr)i[mr[n]]=!0;for(n=0;n<e.length;n++)void 0!==i[e[n]]&&(delete i[e[n]],r.push(e[n]));return r.sort(),(e=r).length||(e=["FirebaseCore-web"]),"Browser"===(r=pr())?r=gr(i=wr()):"Worker"===r&&(r=gr(i=wr())+"-"+r),r+"/JsCore/"+t+"/"+e.join(",")}function wr(){return l.navigator&&l.navigator.userAgent||""}function _r(t,e){t=t.split("."),e=e||l;for(var n=0;n<t.length&&"object"==typeof e&&null!=e;n++)e=e[t[n]];return n!=t.length&&(e=void 0),e}function Er(){try{var t=l.localStorage,e=Or();if(t)return t.setItem(e,"1"),t.removeItem(e),!er()||!!l.indexedDB}catch(t){return fr()&&!!l.indexedDB}return!1}function Ir(){return(Tr()||"chrome-extension:"===Sr()||hr())&&!dr()&&Er()&&!fr()}function Tr(){return"http:"===Sr()||"https:"===Sr()}function Sr(){return l.location&&l.location.protocol||null}function Cr(t){return!ir(t=t||wr())&&gr(t)!=vr}function Nr(t){return void 0===t?null:Yn(t)}function Ar(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&null!==t[e]&&void 0!==t[e]&&(n[e]=t[e]);return n}function kr(t){if(null!==t)return JSON.parse(t)}function Or(t){return t||Math.floor(1e9*Math.random()).toString()}function Pr(t){return"Safari"!=gr(t=t||wr())&&!t.toLowerCase().match(/iphone|ipad|ipod/)}function Rr(){var t=l.___jsl;if(t&&t.H)for(var e in t.H)if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=t.H[e].L.concat(),t.CP)for(var n=0;n<t.CP.length;n++)t.CP[n]=null}function Dr(t,e){if(e<t)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=wr(),e=pr(),this.b=ir(t)||"ReactNative"===e}function xr(){var t=l.document;return!t||void 0===t.visibilityState||"visible"==t.visibilityState}function Lr(t){try{var e=new Date(parseInt(t,10));if(!isNaN(e.getTime())&&!/[^0-9]/.test(t))return e.toUTCString()}catch(t){}return null}function Mr(){return _r("fireauth.oauthhelper",l)||_r("fireauth.iframe",l)}Dr.prototype.get=function(){var t=l.navigator;return!t||"boolean"!=typeof t.onLine||!Tr()&&"chrome-extension:"!==Sr()&&void 0===t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Fr,Ur={};function jr(t){Ur[t]||(Ur[t]=!0,"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(t))}try{var Vr={};Object.defineProperty(Vr,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Vr,"abcd",{configurable:!0,enumerable:!0,value:2}),Fr=2==Vr.abcd}catch(t){Fr=!1}function qr(t,e,n){Fr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function Br(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&qr(t,n,e[n])}function Wr(t){var e={};return Br(e,t),e}function Hr(t){var e=t;if("object"==typeof t&&null!=t)for(var n in e="length"in t?[]:{},t)qr(e,n,Hr(t[n]));return e}function Kr(t){var e=t&&(t[Yr]?"phone":null);if(!(e&&t&&t[Xr]))throw new _("internal-error","Internal assert: invalid MultiFactorInfo object");qr(this,"uid",t[Xr]),qr(this,"displayName",t[zr]||null);var n=null;t[Qr]&&(n=new Date(t[Qr]).toUTCString()),qr(this,"enrollmentTime",n),qr(this,"factorId",e)}function Gr(t){try{var e=new $r(t)}catch(t){e=null}return e}Kr.prototype.v=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};var zr="displayName",Qr="enrolledAt",Xr="mfaEnrollmentId",Yr="phoneInfo";function $r(t){Kr.call(this,t),qr(this,"phoneNumber",t[Yr])}function Jr(t){var e={},n=t[ni],r=t[ii],i=t[oi];if(t=Gr(t[ri]),!i||i!=ti&&i!=ei&&!n||i==ei&&!r||i==Zr&&!t)throw Error("Invalid checkActionCode response!");i==ei?(e[ai]=n||null,e[ci]=n||null,e[si]=r):(e[ai]=r||null,e[ci]=r||null,e[si]=n||null),e[ui]=t||null,qr(this,li,i),qr(this,hi,Hr(e))}e($r,Kr),$r.prototype.v=function(){var t=$r.Za.v.call(this);return t.phoneNumber=this.phoneNumber,t};var Zr="REVERT_SECOND_FACTOR_ADDITION",ti="EMAIL_SIGNIN",ei="VERIFY_AND_CHANGE_EMAIL",ni="email",ri="mfaInfo",ii="newEmail",oi="requestType",si="email",ai="fromEmail",ui="multiFactorInfo",ci="previousEmail",hi="data",li="operation";function fi(t){var e=Pn(t=Rn(t),pi)||null,n=Pn(t,di)||null,r=Pn(t,gi)||null;if(r=r&&bi[r]||null,!e||!n||!r)throw new _("argument-error",pi+", "+di+"and "+gi+" are required in a valid action code URL.");Br(this,{apiKey:e,operation:r,code:n,continueUrl:Pn(t,vi)||null,languageCode:Pn(t,yi)||null,tenantId:Pn(t,mi)||null})}var pi="apiKey",di="oobCode",vi="continueUrl",yi="languageCode",gi="mode",mi="tenantId",bi={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:Zr,signIn:ti,verifyAndChangeEmail:ei,verifyEmail:"VERIFY_EMAIL"};function wi(t){try{return new fi(t)}catch(t){return null}}function _i(t){var e=t[Ci];if(void 0===e)throw new _("missing-continue-uri");if("string"!=typeof e||"string"==typeof e&&!e.length)throw new _("invalid-continue-uri");this.h=e,this.b=this.a=null,this.g=!1;var n=t[Ei];if(n&&"object"==typeof n){e=n[ki];var r=n[Ni];if(n=n[Ai],"string"==typeof e&&e.length){if(this.a=e,void 0!==r&&"boolean"!=typeof r)throw new _("argument-error",Ni+" property must be a boolean when specified.");if(this.g=!!r,void 0!==n&&("string"!=typeof n||"string"==typeof n&&!n.length))throw new _("argument-error",Ai+" property must be a non empty string when specified.");this.b=n||null}else{if(void 0!==e)throw new _("argument-error",ki+" property must be a non empty string when specified.");if(void 0!==r||void 0!==n)throw new _("missing-android-pkg-name")}}else if(void 0!==n)throw new _("argument-error",Ei+" property must be a non null object when specified.");if(this.f=null,(e=t[Si])&&"object"==typeof e){if("string"==typeof(e=e[Oi])&&e.length)this.f=e;else if(void 0!==e)throw new _("argument-error",Oi+" property must be a non empty string when specified.")}else if(void 0!==e)throw new _("argument-error",Si+" property must be a non null object when specified.");if(void 0!==(e=t[Ti])&&"boolean"!=typeof e)throw new _("argument-error",Ti+" property must be a boolean when specified.");if(this.c=!!e,void 0!==(t=t[Ii])&&("string"!=typeof t||"string"==typeof t&&!t.length))throw new _("argument-error",Ii+" property must be a non empty string when specified.");this.i=t||null}var Ei="android",Ii="dynamicLinkDomain",Ti="handleCodeInApp",Si="iOS",Ci="url",Ni="installApp",Ai="minimumVersion",ki="packageName",Oi="bundleId";function Pi(t){var e={};for(var n in e.continueUrl=t.h,e.canHandleCodeInApp=t.c,(e.androidPackageName=t.a)&&(e.androidMinimumVersion=t.b,e.androidInstallApp=t.g),e.iOSBundleId=t.f,e.dynamicLinkDomain=t.i,e)null===e[n]&&delete e[n];return e}var Ri=null;function Di(t){var e="";return function(r,t){function e(t){for(;i<r.length;){var e=r.charAt(i++),n=Ri[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return t}!function(){if(!Ri){Ri={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;n<5;n++)for(var r=t.concat(e[n].split("")),i=0;i<r.length;i++){var o=r[i];void 0===Ri[o]&&(Ri[o]=i)}}}();for(var i=0;;){var n=e(-1),o=e(0),s=e(64),a=e(64);if(64===a&&-1===n)break;t(n<<2|o>>4),64!=s&&(t(o<<4&240|s>>2),64!=a&&t(s<<6&192|a))}}(t,function(t){e+=String.fromCharCode(t)}),e}function xi(t){var e=Mi(t);if(!(e&&e.sub&&e.iss&&e.aud&&e.exp))throw Error("Invalid JWT");this.g=t,this.c=e.exp,this.h=e.sub,this.a=e.provider_id||e.firebase&&e.firebase.sign_in_provider||null,this.f=e.firebase&&e.firebase.tenant||null,this.b=!!e.is_anonymous||"anonymous"==this.a}function Li(t){try{return new xi(t)}catch(t){return null}}function Mi(t){if(!t)return null;if(3!=(t=t.split(".")).length)return null;for(var e=(4-(t=t[1]).length%4)%4,n=0;n<e;n++)t+=".";try{return JSON.parse(Di(t))}catch(t){}return null}xi.prototype.S=function(){return this.f},xi.prototype.i=function(){return this.b},xi.prototype.toString=function(){return this.g};var Fi="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),Ui=["client_id","response_type","scope","redirect_uri","state"],ji={kd:{Ha:"locale",ta:700,sa:600,ea:"facebook.com",Va:Ui},md:{Ha:null,ta:500,sa:750,ea:"github.com",Va:Ui},nd:{Ha:"hl",ta:515,sa:680,ea:"google.com",Va:Ui},td:{Ha:"lang",ta:485,sa:705,ea:"twitter.com",Va:Fi},gd:{Ha:"locale",ta:640,sa:600,ea:"apple.com",Va:[]}};function Vi(t){for(var e in ji)if(ji[e].ea==t)return ji[e];return null}function qi(t){var e={};e["facebook.com"]=Gi,e["google.com"]=Qi,e["github.com"]=zi,e["twitter.com"]=Xi;var n=t&&t[Wi];try{if(n)return e[n]?new e[n](t):new Ki(t);if(void 0!==t[Bi])return new Hi(t)}catch(t){}return null}var Bi="idToken",Wi="providerId";function Hi(t){var e=t[Wi];if(!e&&t[Bi]){var n=Li(t[Bi]);n&&n.a&&(e=n.a)}if(!e)throw Error("Invalid additional user info!");"anonymous"!=e&&"custom"!=e||(e=null),n=!1,void 0!==t.isNewUser?n=!!t.isNewUser:"identitytoolkit#SignupNewUserResponse"===t.kind&&(n=!0),qr(this,"providerId",e),qr(this,"isNewUser",n)}function Ki(t){Hi.call(this,t),qr(this,"profile",Hr((t=kr(t.rawUserInfo||"{}"))||{}))}function Gi(t){if(Ki.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function zi(t){if(Ki.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");qr(this,"username",this.profile&&this.profile.login||null)}function Qi(t){if(Ki.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function Xi(t){if(Ki.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");qr(this,"username",t.screenName||null)}function Yi(t){var e=Rn(t),n=Pn(e,"link"),r=Pn(Rn(n),"link");return e=Pn(e,"deep_link_id"),Pn(Rn(e),"link")||e||r||n||t}function $i(t,e){if(!t&&!e)throw new _("internal-error","Internal assert: no raw session string available");if(t&&e)throw new _("internal-error","Internal assert: unable to determine the session type");this.a=t||null,this.b=e||null,this.type=this.a?Ji:Zi}e(Ki,Hi),e(Gi,Ki),e(zi,Ki),e(Qi,Ki),e(Xi,Ki);var Ji="enroll",Zi="signin";function to(){}function eo(t,n){return t.then(function(t){if(t[Hs]){var e=Li(t[Hs]);if(!e||n!=e.h)throw new _("user-mismatch");return t}throw new _("user-mismatch")}).o(function(t){throw t&&t.code&&t.code==T+"user-not-found"?new _("user-mismatch"):t})}function no(t,e){if(!e)throw new _("internal-error","failed to construct a credential");this.a=e,qr(this,"providerId",t),qr(this,"signInMethod",t)}function ro(t){return{pendingToken:t.a,requestUri:"http://localhost"}}function io(t){if(t&&t.providerId&&t.signInMethod&&0==t.providerId.indexOf("saml.")&&t.pendingToken)try{return new no(t.providerId,t.pendingToken)}catch(t){}return null}function oo(t,e,n){if(this.a=null,e.idToken||e.accessToken)e.idToken&&qr(this,"idToken",e.idToken),e.accessToken&&qr(this,"accessToken",e.accessToken),e.nonce&&!e.pendingToken&&qr(this,"nonce",e.nonce),e.pendingToken&&(this.a=e.pendingToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new _("internal-error","failed to construct a credential");qr(this,"accessToken",e.oauthToken),qr(this,"secret",e.oauthTokenSecret)}qr(this,"providerId",t),qr(this,"signInMethod",n)}function so(t){var e={};return t.idToken&&(e.id_token=t.idToken),t.accessToken&&(e.access_token=t.accessToken),t.secret&&(e.oauth_token_secret=t.secret),e.providerId=t.providerId,t.nonce&&!t.a&&(e.nonce=t.nonce),e={postBody:Hn(e).toString(),requestUri:"http://localhost"},t.a&&(delete e.postBody,e.pendingToken=t.a),e}function ao(t){if(t&&t.providerId&&t.signInMethod){var e={idToken:t.oauthIdToken,accessToken:t.oauthTokenSecret?null:t.oauthAccessToken,oauthTokenSecret:t.oauthTokenSecret,oauthToken:t.oauthTokenSecret&&t.oauthAccessToken,nonce:t.nonce,pendingToken:t.pendingToken};try{return new oo(t.providerId,e,t.signInMethod)}catch(t){}}return null}function uo(t,e){this.Oc=e||[],Br(this,{providerId:t,isOAuthProvider:!0}),this.Fb={},this.lb=(Vi(t)||{}).Ha||null,this.kb=null}function co(t){if("string"!=typeof t||0!=t.indexOf("saml."))throw new _("argument-error",'SAML provider IDs must be prefixed with "saml."');uo.call(this,t,[])}function ho(t){uo.call(this,t,Ui),this.a=[]}function lo(){ho.call(this,"facebook.com")}function fo(t){if(!t)throw new _("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return v(t)&&(e=t.accessToken),(new lo).credential({accessToken:e})}function po(){ho.call(this,"github.com")}function vo(t){if(!t)throw new _("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return v(t)&&(e=t.accessToken),(new po).credential({accessToken:e})}function yo(){ho.call(this,"google.com"),this.Aa("profile")}function go(t,e){var n=t;return v(t)&&(n=t.idToken,e=t.accessToken),(new yo).credential({idToken:n,accessToken:e})}function mo(){uo.call(this,"twitter.com",Fi)}function bo(t,e){var n=t;if(v(n)||(n={oauthToken:t,oauthTokenSecret:e}),!n.oauthToken||!n.oauthTokenSecret)throw new _("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new oo("twitter.com",n,"twitter.com")}function wo(t,e,n){this.a=t,this.f=e,qr(this,"providerId","password"),qr(this,"signInMethod",n===Eo.EMAIL_LINK_SIGN_IN_METHOD?Eo.EMAIL_LINK_SIGN_IN_METHOD:Eo.EMAIL_PASSWORD_SIGN_IN_METHOD)}function _o(t){return t&&t.email&&t.password?new wo(t.email,t.password,t.signInMethod):null}function Eo(){Br(this,{providerId:"password",isOAuthProvider:!1})}function Io(t,e){if(!(e=To(e)))throw new _("argument-error","Invalid email link!");return new wo(t,e.code,Eo.EMAIL_LINK_SIGN_IN_METHOD)}function To(t){return(t=wi(t=Yi(t)))&&t.operation===ti?t:null}function So(t){if(!(t.bb&&t.ab||t.Ja&&t.da))throw new _("internal-error");this.a=t,qr(this,"providerId","phone"),this.ea="phone",qr(this,"signInMethod","phone")}function Co(e){if(e&&"phone"===e.providerId&&(e.verificationId&&e.verificationCode||e.temporaryProof&&e.phoneNumber)){var n={};return U(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(t){e[t]&&(n[t]=e[t])}),new So(n)}return null}function No(t){return t.a.Ja&&t.a.da?{temporaryProof:t.a.Ja,phoneNumber:t.a.da}:{sessionInfo:t.a.bb,code:t.a.ab}}function Ao(t){try{this.a=t||zl.auth()}catch(t){throw new _("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}Br(this,{providerId:"phone",isOAuthProvider:!1})}function ko(t,e){if(!t)throw new _("missing-verification-id");if(!e)throw new _("missing-verification-code");return new So({bb:t,ab:e})}function Oo(t){if(t.temporaryProof&&t.phoneNumber)return new So({Ja:t.temporaryProof,da:t.phoneNumber});var e=t&&t.providerId;if(!e||"password"===e)return null;var n=t&&t.oauthAccessToken,r=t&&t.oauthTokenSecret,i=t&&t.nonce,o=t&&t.oauthIdToken,s=t&&t.pendingToken;try{switch(e){case"google.com":return go(o,n);case"facebook.com":return fo(n);case"github.com":return vo(n);case"twitter.com":return bo(n,r);default:return n||r||o||s?s?0==e.indexOf("saml.")?new no(e,s):new oo(e,{pendingToken:s,idToken:t.oauthIdToken,accessToken:t.oauthAccessToken},e):new ho(e).credential({idToken:o,accessToken:n,rawNonce:i}):null}}catch(t){return null}}function Po(t){if(!t.isOAuthProvider)throw new _("invalid-oauth-provider")}function Ro(t,e,n,r,i,o,s){if(this.c=t,this.b=e||null,this.g=n||null,this.f=r||null,this.i=o||null,this.h=s||null,this.a=i||null,!this.g&&!this.a)throw new _("invalid-auth-event");if(this.g&&this.a)throw new _("invalid-auth-event");if(this.g&&!this.f)throw new _("invalid-auth-event")}function Do(t){return(t=t||{}).type?new Ro(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&E(t.error),t.postBody,t.tenantId):null}function xo(){this.b=null,this.a=[]}$i.prototype.Fa=function(){return this.a?Ee(this.a):Ee(this.b)},$i.prototype.v=function(){return this.type==Ji?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}},to.prototype.ia=function(){},to.prototype.b=function(){},to.prototype.c=function(){},to.prototype.v=function(){},no.prototype.ia=function(t){return ha(t,ro(this))},no.prototype.b=function(t,e){var n=ro(this);return n.idToken=e,la(t,n)},no.prototype.c=function(t,e){return eo(fa(t,ro(this)),e)},no.prototype.v=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}},oo.prototype.ia=function(t){return ha(t,so(this))},oo.prototype.b=function(t,e){var n=so(this);return n.idToken=e,la(t,n)},oo.prototype.c=function(t,e){return eo(fa(t,so(this)),e)},oo.prototype.v=function(){var t={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(t.oauthIdToken=this.idToken),this.accessToken&&(t.oauthAccessToken=this.accessToken),this.secret&&(t.oauthTokenSecret=this.secret),this.nonce&&(t.nonce=this.nonce),this.a&&(t.pendingToken=this.a),t},uo.prototype.Ia=function(t){return this.Fb=ct(t),this},e(co,uo),e(ho,uo),ho.prototype.Aa=function(t){return B(this.a,t)||this.a.push(t),this},ho.prototype.Nb=function(){return G(this.a)},ho.prototype.credential=function(t,e){var n;if(!(n=v(t)?{idToken:t.idToken||null,accessToken:t.accessToken||null,nonce:t.rawNonce||null}:{idToken:t||null,accessToken:e||null}).idToken&&!n.accessToken)throw new _("argument-error","credential failed: must provide the ID token and/or the access token.");return new oo(this.providerId,n,this.providerId)},e(lo,ho),qr(lo,"PROVIDER_ID","facebook.com"),qr(lo,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),e(po,ho),qr(po,"PROVIDER_ID","github.com"),qr(po,"GITHUB_SIGN_IN_METHOD","github.com"),e(yo,ho),qr(yo,"PROVIDER_ID","google.com"),qr(yo,"GOOGLE_SIGN_IN_METHOD","google.com"),e(mo,uo),qr(mo,"PROVIDER_ID","twitter.com"),qr(mo,"TWITTER_SIGN_IN_METHOD","twitter.com"),wo.prototype.ia=function(t){return this.signInMethod==Eo.EMAIL_LINK_SIGN_IN_METHOD?za(t,wa,{email:this.a,oobCode:this.f}):za(t,Ba,{email:this.a,password:this.f})},wo.prototype.b=function(t,e){return this.signInMethod==Eo.EMAIL_LINK_SIGN_IN_METHOD?za(t,_a,{idToken:e,email:this.a,oobCode:this.f}):za(t,xa,{idToken:e,email:this.a,password:this.f})},wo.prototype.c=function(t,e){return eo(this.ia(t),e)},wo.prototype.v=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}},Br(Eo,{PROVIDER_ID:"password"}),Br(Eo,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Br(Eo,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),So.prototype.ia=function(t){return t.cb(No(this))},So.prototype.b=function(t,e){var n=No(this);return n.idToken=e,za(t,Ha,n)},So.prototype.c=function(t,e){var n=No(this);return n.operation="REAUTH",eo(t=za(t,Ka,n),e)},So.prototype.v=function(){var t={providerId:"phone"};return this.a.bb&&(t.verificationId=this.a.bb),this.a.ab&&(t.verificationCode=this.a.ab),this.a.Ja&&(t.temporaryProof=this.a.Ja),this.a.da&&(t.phoneNumber=this.a.da),t},Ao.prototype.cb=function(i,n){var o=this.a.b;return Ee(n.verify()).then(function(r){if("string"!=typeof r)throw new _("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(n.type){case"recaptcha":var t=v(i)?i.session:null,e=v(i)?i.phoneNumber:i;return(t&&t.type==Ji?t.Fa().then(function(t){return za(o,Ma,{idToken:t,phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:r}}).then(function(t){return t.phoneSessionInfo.sessionInfo})}):t&&t.type==Zi?t.Fa().then(function(t){return e=o,n={mfaPendingCredential:t,mfaEnrollmentId:i.multiFactorHint&&i.multiFactorHint.uid||i.multiFactorUid,phoneSignInInfo:{recaptchaToken:r}},za(e,Fa,n).then(function(t){return t.phoneResponseInfo.sessionInfo});var e,n}):za(o,Ra,{phoneNumber:e,recaptchaToken:r})).then(function(t){return"function"==typeof n.reset&&n.reset(),t},function(t){throw"function"==typeof n.reset&&n.reset(),t});default:throw new _("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})},Br(Ao,{PROVIDER_ID:"phone"}),Br(Ao,{PHONE_SIGN_IN_METHOD:"phone"}),Ro.prototype.getUid=function(){var t=[];return t.push(this.c),this.b&&t.push(this.b),this.f&&t.push(this.f),this.h&&t.push(this.h),t.join("-")},Ro.prototype.S=function(){return this.h},Ro.prototype.v=function(){return{type:this.c,eventId:this.b,urlResponse:this.g,sessionId:this.f,postBody:this.i,tenantId:this.h,error:this.a&&this.a.v()}};var Lo,Mo=null;function Fo(t){var e="unauthorized-domain",n=void 0,r=Rn(t);t=r.b,"chrome-extension"==(r=r.f)?n=Mt("This chrome extension ID (chrome-extension://%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):"http"==r||"https"==r?n=Mt("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):e="operation-not-supported-in-this-environment",_.call(this,e,n)}function Uo(t,e,n){_.call(this,t,n),(t=e||{}).Gb&&qr(this,"email",t.Gb),t.da&&qr(this,"phoneNumber",t.da),t.credential&&qr(this,"credential",t.credential),t.Wb&&qr(this,"tenantId",t.Wb)}function jo(t){if(t.code){var e=t.code||"";0==e.indexOf(T)&&(e=e.substring(T.length));var n={credential:Oo(t),Wb:t.tenantId};if(t.email)n.Gb=t.email;else if(t.phoneNumber)n.da=t.phoneNumber;else if(!n.credential)return new _(e,t.message||void 0);return new Uo(e,n,t.message)}return null}function Vo(){}function qo(t){return t.c||(t.c=t.b())}function Bo(){}function Wo(t){if(t.f||"undefined"!=typeof XMLHttpRequest||"undefined"==typeof ActiveXObject)return t.f;for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n<e.length;n++){var r=e[n];try{return new ActiveXObject(r),t.f=r}catch(t){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}function Ho(){}function Ko(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseType=this.responseText=this.response="",this.status=-1,this.statusText="",this.a.onload=m(this.oc,this),this.a.onerror=m(this.Pb,this),this.a.onprogress=m(this.pc,this),this.a.ontimeout=m(this.tc,this)}function Go(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function zo(t,e,n){this.reset(t,e,n,void 0,void 0)}function Qo(t){this.f=t,this.b=this.c=this.a=null}function Xo(t,e){this.name=t,this.value=e}e(Fo,_),e(Uo,_),Uo.prototype.v=function(){var t={code:this.code,message:this.message};this.email&&(t.email=this.email),this.phoneNumber&&(t.phoneNumber=this.phoneNumber),this.tenantId&&(t.tenantId=this.tenantId);var e=this.credential&&this.credential.v();return e&&lt(t,e),t},Uo.prototype.toJSON=function(){return this.v()},Vo.prototype.c=null,e(Bo,Vo),Bo.prototype.a=function(){var t=Wo(this);return t?new ActiveXObject(t):new XMLHttpRequest},Bo.prototype.b=function(){var t={};return Wo(this)&&(t[0]=!0,t[1]=!0),t},Lo=new Bo,e(Ho,Vo),Ho.prototype.a=function(){var t=new XMLHttpRequest;if("withCredentials"in t)return t;if("undefined"!=typeof XDomainRequest)return new Ko;throw Error("Unsupported browser")},Ho.prototype.b=function(){return{}},(t=Ko.prototype).open=function(t,e,n){if(null!=n&&!n)throw Error("Only async requests are supported.");this.a.open(t,e)},t.send=function(t){if(t){if("string"!=typeof t)throw Error("Only string data is supported");this.a.send(t)}else this.a.send()},t.abort=function(){this.a.abort()},t.setRequestHeader=function(){},t.getResponseHeader=function(t){return"content-type"==t.toLowerCase()?this.a.contentType:""},t.oc=function(){this.status=200,this.response=this.responseText=this.a.responseText,Go(this,4)},t.Pb=function(){this.status=500,this.response=this.responseText="",Go(this,4)},t.tc=function(){this.Pb()},t.pc=function(){this.status=200,Go(this,1)},t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},zo.prototype.a=null,zo.prototype.reset=function(t,e,n,r,i){delete this.a},Xo.prototype.toString=function(){return this.name};var Yo=new Xo("SEVERE",1e3),$o=new Xo("WARNING",900),Jo=new Xo("CONFIG",700),Zo=new Xo("FINE",500);Qo.prototype.log=function(t,e,n){if(t.value>=function t(e){return e.c?e.c:e.a?t(e.a):(P("Root logger has no level set."),null)}(this).value)for(d(e)&&(e=e()),t=new zo(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var ts,es={},ns=null;function rs(t){var e;if(ns||(ns=new Qo(""),(es[""]=ns).c=Jo),!(e=es[t])){e=new Qo(t);var n=t.lastIndexOf("."),r=t.substr(n+1);(n=rs(t.substr(0,n))).b||(n.b={}),(n.b[r]=e).a=n,es[t]=e}return e}function is(t,e){t&&t.log(Zo,e,void 0)}function os(t){this.f=t}function ss(t){dn.call(this),this.s=t,this.readyState=as,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.i=new Headers,this.b=null,this.m="GET",this.g="",this.a=!1,this.h=rs("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}e(os,Vo),os.prototype.a=function(){return new ss(this.f)},os.prototype.b=(ts={},function(){return ts}),e(ss,dn);var as=0;function us(t){t.c.read().then(t.nc.bind(t)).catch(t.Sa.bind(t))}function cs(t,e){e&&t.f&&(t.status=t.f.status,t.statusText=t.f.statusText),t.readyState=4,t.f=null,t.c=null,t.l=null,hs(t)}function hs(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function ls(t){dn.call(this),this.headers=new En,this.D=t||null,this.c=!1,this.B=this.a=null,this.h=this.P=this.l="",this.f=this.O=this.i=this.N=!1,this.g=0,this.s=null,this.m=fs,this.w=this.R=!1}(t=ss.prototype).open=function(t,e){if(this.readyState!=as)throw this.abort(),Error("Error reopening a connection");this.m=t,this.g=e,this.readyState=1,hs(this)},t.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var e={headers:this.i,method:this.m,credentials:void 0,cache:void 0};t&&(e.body=t),this.s.fetch(new Request(this.g,e)).then(this.sc.bind(this),this.Sa.bind(this))},t.abort=function(){this.response=this.responseText="",this.i=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,cs(this,!1)),this.readyState=as},t.sc=function(t){this.a&&(this.f=t,this.b||(this.b=t.headers,this.readyState=2,hs(this)),this.a&&(this.readyState=3,hs(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.qc.bind(this),this.Sa.bind(this)):void 0!==l.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.l=new TextDecoder,us(this)):t.text().then(this.rc.bind(this),this.Sa.bind(this)))))},t.nc=function(t){if(this.a){var e=this.l.decode(t.value?t.value:new Uint8Array(0),{stream:!t.done});e&&(this.response=this.responseText+=e),t.done?cs(this,!0):hs(this),3==this.readyState&&us(this)}},t.rc=function(t){this.a&&(this.response=this.responseText=t,cs(this,!0))},t.qc=function(t){this.a&&(this.response=t,cs(this,!0))},t.Sa=function(t){var e=this.h;e&&e.log($o,"Failed to fetch url "+this.g,t instanceof Error?t:Error(t)),this.a&&cs(this,!0)},t.setRequestHeader=function(t,e){this.i.append(t,e)},t.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.h)&&t.log($o,"Attempting to get response header but no headers have been received for url: "+this.g,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var t=this.h;return t&&t.log($o,"Attempting to get all response headers but no headers have been received for url: "+this.g,void 0),""}t=[];for(var e=this.b.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},e(ls,dn);var fs="";ls.prototype.b=rs("goog.net.XhrIo");var ps=/^https?$/i,ds=["POST","PUT"];function vs(e,t,n,r,i){if(e.a)throw Error("[goog.net.XhrIo] Object is active with another request="+e.l+"; newUri="+t);n=n?n.toUpperCase():"GET",e.l=t,e.h="",e.P=n,e.N=!1,e.c=!0,e.a=e.D?e.D.a():Lo.a(),e.B=e.D?qo(e.D):qo(Lo),e.a.onreadystatechange=m(e.Sb,e);try{is(e.b,Ts(e,"Opening Xhr")),e.O=!0,e.a.open(n,String(t),!0),e.O=!1}catch(t){return is(e.b,Ts(e,"Error opening Xhr: "+t.message)),void gs(e,t)}t=r||"";var o,s=new En(e.headers);i&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(h(t)||"string"==typeof t)U(t,e,void 0);else for(var n=_n(t),r=wn(t),i=r.length,o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}(i,function(t,e){s.set(e,t)}),i=function(t){t:{for(var e=ys,n=t.length,r="string"==typeof t?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return e<0?null:"string"==typeof t?t.charAt(e):t[e]}(s.X()),r=l.FormData&&t instanceof l.FormData,!B(ds,n)||i||r||s.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),s.forEach(function(t,e){this.a.setRequestHeader(e,t)},e),e.m&&(e.a.responseType=e.m),"withCredentials"in e.a&&e.a.withCredentials!==e.R&&(e.a.withCredentials=e.R);try{_s(e),0<e.g&&(e.w=(o=e.a,Bt&&Zt(9)&&"number"==typeof o.timeout&&void 0!==o.ontimeout),is(e.b,Ts(e,"Will abort after "+e.g+"ms if incomplete, xhr2 "+e.w)),e.w?(e.a.timeout=e.g,e.a.ontimeout=m(e.Ka,e)):e.s=mn(e.Ka,e.g,e)),is(e.b,Ts(e,"Sending request")),e.i=!0,e.a.send(t),e.i=!1}catch(t){is(e.b,Ts(e,"Send error: "+t.message)),gs(e,t)}}function ys(t){return"content-type"==t.toLowerCase()}function gs(t,e){t.c=!1,t.a&&(t.f=!0,t.a.abort(),t.f=!1),t.h=e,ms(t),ws(t)}function ms(t){t.N||(t.N=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function bs(e){if(e.c&&void 0!==u)if(e.B[1]&&4==Es(e)&&2==Is(e))is(e.b,Ts(e,"Local request error detected and ignored"));else if(e.i&&4==Es(e))mn(e.Sb,0,e);else if(e.dispatchEvent("readystatechange"),4==Es(e)){is(e.b,Ts(e,"Request complete")),e.c=!1;try{var t,n=Is(e);t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(t=r)){var i;if(i=0===n){var o=String(e.l).match(Sn)[1]||null;if(!o&&l.self&&l.self.location){var s=l.self.location.protocol;o=s.substr(0,s.length-1)}i=!ps.test(o?o.toLowerCase():"")}t=i}if(t)e.dispatchEvent("complete"),e.dispatchEvent("success");else{try{var a=2<Es(e)?e.a.statusText:""}catch(t){is(e.b,"Can not get status: "+t.message),a=""}e.h=a+" ["+Is(e)+"]",ms(e)}}finally{ws(e)}}}function ws(e,t){if(e.a){_s(e);var n=e.a,r=e.B[0]?a:null;e.a=null,e.B=null,t||e.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){(e=e.b)&&e.log(Yo,"Problem encountered resetting onreadystatechange: "+t.message,void 0)}}}function _s(t){t.a&&t.w&&(t.a.ontimeout=null),t.s&&(l.clearTimeout(t.s),t.s=null)}function Es(t){return t.a?t.a.readyState:0}function Is(t){try{return 2<Es(t)?t.a.status:-1}catch(t){return-1}}function Ts(t,e){return e+" ["+t.P+" "+t.l+" "+Is(t)+"]"}function Ss(t){var e=Ms;this.g=[],this.w=e,this.s=t||null,this.f=this.a=!1,this.c=void 0,this.u=this.B=this.i=!1,this.h=0,this.b=null,this.l=0}function Cs(t,e,n){t.a=!0,t.c=n,t.f=!e,Os(t)}function Ns(t){if(t.a){if(!t.u)throw new Ps;t.u=!1}}function As(t,e,n,r){t.g.push([e,n,r]),t.a&&Os(t)}function ks(t){return q(t.g,function(t){return d(t[1])})}function Os(e){if(e.h&&e.a&&ks(e)){var n=e.h,r=xs[n];r&&(l.clearTimeout(r.a),delete xs[n]),e.h=0}e.b&&(e.b.l--,delete e.b),n=e.c;for(var t=r=!1;e.g.length&&!e.i;){var i=e.g.shift(),o=i[0],s=i[1];if(i=i[2],o=e.f?s:o)try{var a=o.call(i||e.s,n);void 0!==a&&(e.f=e.f&&(a==n||a instanceof Error),e.c=n=a),(A(n)||"function"==typeof l.Promise&&n instanceof l.Promise)&&(t=!0,e.i=!0)}catch(t){n=t,e.f=!0,ks(e)||(r=!0)}}e.c=n,t&&(a=m(e.m,e,!0),t=m(e.m,e,!1),n instanceof Ss?(As(n,a,t),n.B=!0):n.then(a,t)),r&&(n=new Ds(n),xs[n.a]=n,e.h=n.a)}function Ps(){k.call(this)}function Rs(){k.call(this)}function Ds(t){this.a=l.setTimeout(m(this.c,this),0),this.b=t}(t=ls.prototype).Ka=function(){void 0!==u&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",is(this.b,Ts(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(){this.a&&this.c&&(is(this.b,Ts(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),ws(this))},t.Ba=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),ws(this,!0)),ls.Za.Ba.call(this)},t.Sb=function(){this.wa||(this.O||this.i||this.f?bs(this):this.Hc())},t.Hc=function(){bs(this)},t.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.m){case fs:case"text":return this.a.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in this.a)return this.a.mozResponseArrayBuffer}var t=this.b;return t&&t.log(Yo,"Response type "+this.m+" is not supported on this browser",void 0),null}catch(t){return is(this.b,"Can not get response: "+t.message),null}},Ss.prototype.cancel=function(t){if(this.a)this.c instanceof Ss&&this.c.cancel();else{if(this.b){var e=this.b;delete this.b,t?e.cancel(t):(e.l--,e.l<=0&&e.cancel())}this.w?this.w.call(this.s,this):this.u=!0,this.a||(t=new Rs,Ns(this),Cs(this,!1,t))}},Ss.prototype.m=function(t,e){this.i=!1,Cs(this,t,e)},Ss.prototype.then=function(t,e,n){var r,i,o=new ve(function(t,e){r=t,i=e});return As(this,r,function(t){t instanceof Rs?o.cancel():i(t)}),o.then(t,e,n)},Ss.prototype.$goog_Thenable=!0,e(Ps,k),Ps.prototype.message="Deferred has already fired",Ps.prototype.name="AlreadyCalledError",e(Rs,k),Rs.prototype.message="Deferred was canceled",Rs.prototype.name="CanceledError",Ds.prototype.c=function(){throw delete xs[this.a],this.b};var xs={};function Ls(t){var e,n,r,i,o,s=document,a=bt(t).toString(),u=ae(document,"SCRIPT"),c={Tb:u,Ka:void 0},h=new Ss(c);return e=window.setTimeout(function(){Fs(u,!0);var t=new Vs(js,"Timeout reached for loading script "+a);Ns(h),Cs(h,!1,t)},5e3),c.Ka=e,u.onload=u.onreadystatechange=function(){u.readyState&&"loaded"!=u.readyState&&"complete"!=u.readyState||(Fs(u,!1,e),Ns(h),Cs(h,!0,null))},u.onerror=function(){Fs(u,!0,e);var t=new Vs(Us,"Error while loading script "+a);Ns(h),Cs(h,!1,t)},lt(c={},{type:"text/javascript",charset:"UTF-8"}),ne(u,c),r=t,ft(n=u,"HTMLScriptElement"),n.src=bt(r),null===p&&(p=(r=(r=l.document).querySelector&&r.querySelector("script[nonce]"))&&(r=r.nonce||r.getAttribute("nonce"))&&f.test(r)?r:""),(r=p)&&n.setAttribute("nonce",r),((o=((i=s)||document).getElementsByTagName("HEAD"))&&0!=o.length?o[0]:i.documentElement).appendChild(u),h}function Ms(){if(this&&this.Tb){var t=this.Tb;t&&"SCRIPT"==t.tagName&&Fs(t,!0,this.Ka)}}function Fs(t,e,n){null!=n&&l.clearTimeout(n),t.onload=a,t.onerror=a,t.onreadystatechange=a,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)}var Us=0,js=1;function Vs(t,e){var n="Jsloader error (code #"+t+")";e&&(n+=": "+e),k.call(this,n),this.code=t}function qs(t){this.f=t}function Bs(t,e,n){if(this.c=t,t=e||{},this.u=t.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.m=t.secureTokenTimeout||Ks,this.g=ct(t.secureTokenHeaders||Gs),this.h=t.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.l=t.identityPlatformEndpoint||"https://identitytoolkit.googleapis.com/v2/",this.i=t.firebaseTimeout||zs,this.a=ct(t.firebaseHeaders||Qs),n&&(this.a["X-Client-Version"]=n,this.g["X-Client-Version"]=n),n="Node"==pr(),!(n=l.XMLHttpRequest||n&&zl.INTERNAL.node&&zl.INTERNAL.node.XMLHttpRequest)&&!fr())throw new _("internal-error","The XMLHttpRequest compatibility library was not found.");this.f=void 0,fr()?this.f=new os(self):dr()?this.f=new qs(n):this.f=new Ho,this.b=null}e(Vs,k),e(qs,Vo),qs.prototype.a=function(){return new this.f},qs.prototype.b=function(){return{}};var Ws,Hs="idToken",Ks=new Dr(3e4,6e4),Gs={"Content-Type":"application/x-www-form-urlencoded"},zs=new Dr(3e4,6e4),Qs={"Content-Type":"application/json"};function Xs(t,e){e?t.a["X-Firebase-Locale"]=e:delete t.a["X-Firebase-Locale"]}function Ys(t,e){e?(t.a["X-Client-Version"]=e,t.g["X-Client-Version"]=e):(delete t.a["X-Client-Version"],delete t.g["X-Client-Version"])}function $s(t,e,n,r,i,o,s){var a;(t=!((a=gr(a=wr())==yr&&(a=a.match(/\sChrome\/(\d+)/i))&&2==a.length?parseInt(a[1],10):null)&&a<30||Bt&&$t&&!(9<$t))||fr()?m(t.w,t):(Ws=Ws||new ve(function(t,e){!function(t,e){if(((window.gapi||{}).client||{}).request)t();else{l[Zs]=function(){((window.gapi||{}).client||{}).request?t():e(Error("CORS_UNSUPPORTED"))},function(t,e){As(t,null,e,void 0)}(Ls(wt(Js,{onload:Zs})),function(){e(Error("CORS_UNSUPPORTED"))})}}(t,e)}),m(t.s,t)))(e,n,r,i,o,s)}Bs.prototype.S=function(){return this.b},Bs.prototype.w=function(t,n,e,r,i,o){if(fr()&&(void 0===l.fetch||void 0===l.Headers||void 0===l.Request))throw new _("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var s=new ls(this.f);if(o){s.g=Math.max(0,o);var a=setTimeout(function(){s.dispatchEvent("timeout")},o)}vn(s,"complete",function(){a&&clearTimeout(a);var e=null;try{e=JSON.parse(function(e){try{return e.a?e.a.responseText:""}catch(t){return is(e.b,"Can not get responseText: "+t.message),""}}(this))||null}catch(t){e=null}n&&n(e)}),yn(s,"ready",function(){a&&clearTimeout(a),Ue(this)}),yn(s,"timeout",function(){a&&clearTimeout(a),Ue(this),n&&n(null)}),vs(s,t,e,r,i)};var Js=new pt(yt,"https://apis.google.com/js/client.js?onload=%{onload}"),Zs="__fcb"+Math.floor(1e6*Math.random()).toString();function ta(t,e,n,r,i,o,s){var a=Rn(e+n);On(a,"key",t.c),s&&On(a,"cb",w().toString());var u="GET"==r;if(u)for(var c in i)i.hasOwnProperty(c)&&On(a,c,i[c]);return new ve(function(e,n){$s(t,a.toString(),function(t){t?t.error?n(Xa(t,o||{})):e(t):n(new _("network-request-failed"))},r,u?void 0:Yn(Ar(i)),t.a,t.i.get())})}function ea(t){if("string"!=typeof(t=t.email)||!ur.test(t))throw new _("invalid-email")}function na(t){"email"in t&&ea(t)}function ra(t){if(!t[Hs]){if(t.mfaPendingCredential)throw new _("multi-factor-auth-required",null,ct(t));throw new _("internal-error")}}function ia(t){if(t.phoneNumber||t.temporaryProof){if(!t.phoneNumber||!t.temporaryProof)throw new _("internal-error")}else{if(!t.sessionInfo)throw new _("missing-verification-id");if(!t.code)throw new _("missing-verification-code")}}Bs.prototype.s=function(t,n,r,i,o){var s=this;Ws.then(function(){window.gapi.client.setApiKey(s.c);var e=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:t,method:r,body:i,headers:o,authType:"none",callback:function(t){window.gapi.auth.setToken(e),n&&n(t)}})}).o(function(t){n&&n({error:{message:t&&t.message||"CORS_UNSUPPORTED"}})})},Bs.prototype.vb=function(){return za(this,La,{})},Bs.prototype.xb=function(t,e){return za(this,Da,{idToken:t,email:e})},Bs.prototype.yb=function(t,e){return za(this,xa,{idToken:t,password:e})};var oa={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function sa(t){if(!t.phoneVerificationInfo)throw new _("internal-error");if(!t.phoneVerificationInfo.sessionInfo)throw new _("missing-verification-id");if(!t.phoneVerificationInfo.code)throw new _("missing-verification-code")}function aa(t){if(!t.requestUri||!t.sessionId&&!t.postBody&&!t.pendingToken)throw new _("internal-error")}function ua(t,e){return e.oauthIdToken&&e.providerId&&0==e.providerId.indexOf("oidc.")&&!e.pendingToken&&(t.sessionId?e.nonce=t.sessionId:t.postBody&&(Gn(t=new Bn(t.postBody),"nonce")&&(e.nonce=t.get("nonce")))),e}function ca(t){var e=null;if(t.needConfirmation?(t.code="account-exists-with-different-credential",e=jo(t)):"FEDERATED_USER_ID_ALREADY_LINKED"==t.errorMessage?(t.code="credential-already-in-use",e=jo(t)):"EMAIL_EXISTS"==t.errorMessage?(t.code="email-already-in-use",e=jo(t)):t.errorMessage&&(e=Qa(t.errorMessage)),e)throw e;ra(t)}function ha(t,e){return e.returnIdpCredential=!0,za(t,Ua,e)}function la(t,e){return e.returnIdpCredential=!0,za(t,Va,e)}function fa(t,e){return e.returnIdpCredential=!0,e.autoCreate=!1,za(t,ja,e)}function pa(t){if(!t.oobCode)throw new _("invalid-action-code")}(t=Bs.prototype).zb=function(t,r){var i={idToken:t},o=[];return at(oa,function(t,e){var n=r[e];null===n?o.push(t):e in r&&(i[e]=n)}),o.length&&(i.deleteAttribute=o),za(this,Da,i)},t.rb=function(t,e){return lt(t={requestType:"PASSWORD_RESET",email:t},e),za(this,Aa,t)},t.sb=function(t,e){return lt(t={requestType:"EMAIL_SIGNIN",email:t},e),za(this,Sa,t)},t.qb=function(t,e){return lt(t={requestType:"VERIFY_EMAIL",idToken:t},e),za(this,Ca,t)},t.Ab=function(t,e,n){return lt(t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:t,newEmail:e},n),za(this,Na,t)},t.cb=function(t){return za(this,Wa,t)},t.jb=function(t,e){return za(this,Pa,{oobCode:t,newPassword:e})},t.Pa=function(t){return za(this,va,{oobCode:t})},t.fb=function(t){return za(this,da,{oobCode:t})};var da={endpoint:"setAccountInfo",A:pa,Y:"email",C:!0},va={endpoint:"resetPassword",A:pa,G:function(t){var e=t.requestType;if(!e||!t.email&&"EMAIL_SIGNIN"!=e&&"VERIFY_AND_CHANGE_EMAIL"!=e)throw new _("internal-error")},C:!0},ya={endpoint:"signupNewUser",A:function(t){if(ea(t),!t.password)throw new _("weak-password")},G:ra,U:!0,C:!0},ga={endpoint:"createAuthUri",C:!0},ma={endpoint:"deleteAccount",M:["idToken"]},ba={endpoint:"setAccountInfo",M:["idToken","deleteProvider"],A:function(t){if("array"!=n(t.deleteProvider))throw new _("internal-error")}},wa={endpoint:"emailLinkSignin",M:["email","oobCode"],A:ea,G:ra,U:!0,C:!0},_a={endpoint:"emailLinkSignin",M:["idToken","email","oobCode"],A:ea,G:ra,U:!0},Ea={endpoint:"accounts/mfaEnrollment:finalize",M:["idToken","phoneVerificationInfo"],A:sa,G:ra,C:!0,La:!0},Ia={endpoint:"accounts/mfaSignIn:finalize",M:["mfaPendingCredential","phoneVerificationInfo"],A:sa,G:ra,C:!0,La:!0},Ta={endpoint:"getAccountInfo"},Sa={endpoint:"getOobConfirmationCode",M:["requestType"],A:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new _("internal-error");ea(t)},Y:"email",C:!0},Ca={endpoint:"getOobConfirmationCode",M:["idToken","requestType"],A:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new _("internal-error")},Y:"email",C:!0},Na={endpoint:"getOobConfirmationCode",M:["idToken","newEmail","requestType"],A:function(t){if("VERIFY_AND_CHANGE_EMAIL"!=t.requestType)throw new _("internal-error")},Y:"email",C:!0},Aa={endpoint:"getOobConfirmationCode",M:["requestType"],A:function(t){if("PASSWORD_RESET"!=t.requestType)throw new _("internal-error");ea(t)},Y:"email",C:!0},ka={hb:!0,endpoint:"getProjectConfig",Rb:"GET"},Oa={hb:!0,endpoint:"getRecaptchaParam",Rb:"GET",G:function(t){if(!t.recaptchaSiteKey)throw new _("internal-error")}},Pa={endpoint:"resetPassword",A:pa,Y:"email",C:!0},Ra={endpoint:"sendVerificationCode",M:["phoneNumber","recaptchaToken"],Y:"sessionInfo",C:!0},Da={endpoint:"setAccountInfo",M:["idToken"],A:na,U:!0},xa={endpoint:"setAccountInfo",M:["idToken"],A:function(t){if(na(t),!t.password)throw new _("weak-password")},G:ra,U:!0},La={endpoint:"signupNewUser",G:ra,U:!0,C:!0},Ma={endpoint:"accounts/mfaEnrollment:start",M:["idToken","phoneEnrollmentInfo"],A:function(t){if(!t.phoneEnrollmentInfo)throw new _("internal-error");if(!t.phoneEnrollmentInfo.phoneNumber)throw new _("missing-phone-number");if(!t.phoneEnrollmentInfo.recaptchaToken)throw new _("missing-app-credential")},G:function(t){if(!t.phoneSessionInfo||!t.phoneSessionInfo.sessionInfo)throw new _("internal-error")},C:!0,La:!0},Fa={endpoint:"accounts/mfaSignIn:start",M:["mfaPendingCredential","mfaEnrollmentId","phoneSignInInfo"],A:function(t){if(!t.phoneSignInInfo||!t.phoneSignInInfo.recaptchaToken)throw new _("missing-app-credential")},G:function(t){if(!t.phoneResponseInfo||!t.phoneResponseInfo.sessionInfo)throw new _("internal-error")},C:!0,La:!0},Ua={endpoint:"verifyAssertion",A:aa,Wa:ua,G:ca,U:!0,C:!0},ja={endpoint:"verifyAssertion",A:aa,Wa:ua,G:function(t){if(t.errorMessage&&"USER_NOT_FOUND"==t.errorMessage)throw new _("user-not-found");if(t.errorMessage)throw Qa(t.errorMessage);ra(t)},U:!0,C:!0},Va={endpoint:"verifyAssertion",A:function(t){if(aa(t),!t.idToken)throw new _("internal-error")},Wa:ua,G:ca,U:!0},qa={endpoint:"verifyCustomToken",A:function(t){if(!t.token)throw new _("invalid-custom-token")},G:ra,U:!0,C:!0},Ba={endpoint:"verifyPassword",A:function(t){if(ea(t),!t.password)throw new _("wrong-password")},G:ra,U:!0,C:!0},Wa={endpoint:"verifyPhoneNumber",A:ia,G:ra,C:!0},Ha={endpoint:"verifyPhoneNumber",A:function(t){if(!t.idToken)throw new _("internal-error");ia(t)},G:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",jo(t);ra(t)}},Ka={Eb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:ia,G:ra,C:!0},Ga={endpoint:"accounts/mfaEnrollment:withdraw",M:["idToken","mfaEnrollmentId"],G:function(t){if(!!t[Hs]^!!t.refreshToken)throw new _("internal-error")},C:!0,La:!0};function za(t,e,n){if(!function(t,e){if(!e||!e.length)return 1;if(t){for(var n=0;n<e.length;n++){var r=t[e[n]];if(null==r||""===r)return}return 1}}(n,e.M))return Ie(new _("internal-error"));var r,i=!!e.La,o=e.Rb||"POST";return Ee(n).then(e.A).then(function(){return e.U&&(n.returnSecureToken=!0),e.C&&t.b&&void 0===n.tenantId&&(n.tenantId=t.b),ta(t,i?t.l:t.h,e.endpoint,o,n,e.Eb,e.hb||!1)}).then(function(t){return r=t,e.Wa?e.Wa(n,r):r}).then(e.G).then(function(){if(!e.Y)return r;if(!(e.Y in r))throw new _("internal-error");return r[e.Y]})}function Qa(t){return Xa({error:{errors:[{message:t}],code:400,message:t}})}function Xa(t,e){var n=(t.error&&t.error.errors&&t.error.errors[0]||{}).reason||"",r={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(n=r[n]?new _(r[n]):null)return n;for(var i in n=t.error&&t.error.message||"",lt(r={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_OR_INVALID_NONCE:"missing-or-invalid-nonce",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",INVALID_PROVIDER_ID:"invalid-provider-id",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",REJECTED_CREDENTIAL:"rejected-credential",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_DYNAMIC_LINK_DOMAIN:"invalid-dynamic-link-domain",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash",UNSUPPORTED_TENANT_OPERATION:"unsupported-tenant-operation",INVALID_TENANT_ID:"invalid-tenant-id",TENANT_ID_MISMATCH:"tenant-id-mismatch",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",EMAIL_CHANGE_NEEDS_VERIFICATION:"email-change-needs-verification",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",UNSUPPORTED_FIRST_FACTOR:"unsupported-first-factor",UNVERIFIED_EMAIL:"unverified-email"},e||{}),e=(e=n.match(/^[^\s]+\s*:\s*([\s\S]*)$/))&&1<e.length?e[1]:void 0,r)if(0===n.indexOf(i))return new _(r[i],e);return!e&&t&&(e=Nr(t)),new _("internal-error",e)}function Ya(t){var o;this.b=t,this.a=null,this.nb=(o=this,(tu=tu||new ve(function(t,e){function n(){Rr(),_r("gapi.load")("gapi.iframes",{callback:t,ontimeout:function(){Rr(),e(Error("Network Error"))},timeout:Ja.get()})}if(_r("gapi.iframes.Iframe"))t();else if(_r("gapi.load"))n();else{var r="__iframefcb"+Math.floor(1e6*Math.random()).toString();l[r]=function(){_r("gapi.load")?n():e(Error("Network Error"))},Ee(Ls(r=wt($a,{onload:r}))).o(function(){e(Error("Network Error"))})}}).o(function(t){throw tu=null,t})).then(function(){return new ve(function(r,i){_r("gapi.iframes.getContext")().open({where:document.body,url:o.b,messageHandlersFilter:_r("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),attributes:{style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},dontclear:!0},function(t){function e(){clearTimeout(n),r()}o.a=t,o.a.restyle({setHideOnLeave:!1});var n=setTimeout(function(){i(Error("Network Error"))},Za.get());t.ping(e).then(e,function(){i(Error("Network Error"))})})})}))}var $a=new pt(yt,"https://apis.google.com/js/api.js?onload=%{onload}"),Ja=new Dr(3e4,6e4),Za=new Dr(5e3,15e3),tu=null;function eu(t,e,n){this.i=t,this.g=e,this.h=n,this.f=null,this.a=Dn(this.i,"/__/auth/iframe"),On(this.a,"apiKey",this.g),On(this.a,"appName",this.h),this.b=null,this.c=[]}function nu(t,e,n,r,i){this.s=t,this.m=e,this.c=n,this.u=r,this.i=this.g=this.l=null,this.a=i,this.h=this.f=null}function ru(t){try{return zl.app(t).auth().Ea()}catch(t){return[]}}function iu(t,e,n,r,i){this.u=t,this.f=e,this.b=n,this.c=r||null,this.h=i||null,this.m=this.s=this.w=null,this.g=[],this.l=this.a=null}function ou(t){var a=nr();return za(t,ka,{}).then(function(t){return t.authorizedDomains||[]}).then(function(t){t:{var e=Rn(a),n=e.f;e=e.b;for(var r=0;r<t.length;r++){var i=t[r],o=e,s=n;if(o=0==i.indexOf("chrome-extension://")?Rn(i).b==o&&"chrome-extension"==s:("http"==s||"https"==s)&&(ar.test(i)?o==i:(i=i.split(".").join("\\."),new RegExp("^(.+\\."+i+"|"+i+")$","i").test(o)))){t=!0;break t}}t=!1}if(!t)throw new Fo(nr())})}function su(i){return i.l||(i.l=cr().then(function(){if(!i.s){var t=i.c,e=i.h,n=ru(i.b),r=new eu(i.u,i.f,i.b);r.f=t,r.b=e,r.c=G(n||[]),i.s=r.toString()}i.i=new Ya(i.s),function(r){if(!r.i)throw Error("IfcHandler must be initialized!");!function(t,e){t.nb.then(function(){t.a.register("authEvent",e,_r("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}(r.i,function(t){var e={};if(t&&t.authEvent){var n=!1;for(t=Do(t.authEvent),e=0;e<r.g.length;e++)n=r.g[e](t)||n;return(e={}).status=n?"ACK":"ERROR",Ee(e)}return e.status="ERROR",Ee(e)})}(i)})),i.l}function au(t){return t.m||(t.w=t.c?br(t.c,ru(t.b)):null,t.m=new Bs(t.f,N(t.h),t.w)),t.m}function uu(t,e,n,r,i,o,s,a,u,c,h){return(t=new nu(t,e,n,r,i)).l=o,t.g=s,t.i=a,t.b=ct(u||null),t.f=c,t.ub(h).toString()}function cu(t){if(this.a=t||zl.INTERNAL.reactNative&&zl.INTERNAL.reactNative.AsyncStorage,!this.a)throw new _("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}function hu(t){this.b=t,this.a={},this.f=m(this.c,this)}eu.prototype.toString=function(){return this.f?On(this.a,"v",this.f):Kn(this.a.a,"v"),this.b?On(this.a,"eid",this.b):Kn(this.a.a,"eid"),this.c.length?On(this.a,"fw",this.c.join(",")):Kn(this.a.a,"fw"),this.a.toString()},nu.prototype.ub=function(t){return this.h=t,this},nu.prototype.toString=function(){var t=Dn(this.s,"/__/auth/handler");if(On(t,"apiKey",this.m),On(t,"appName",this.c),On(t,"authType",this.u),this.a.isOAuthProvider){var e=this.a;try{var n=zl.app(this.c).auth().ja()}catch(t){n=null}for(var r in e.kb=n,On(t,"providerId",this.a.providerId),n=Ar((e=this.a).Fb))n[r]=n[r].toString();r=e.Oc,n=ct(n);for(var i=0;i<r.length;i++){var o=r[i];o in n&&delete n[o]}e.lb&&e.kb&&!n[e.lb]&&(n[e.lb]=e.kb),ut(n)||On(t,"customParameters",Nr(n))}if("function"==typeof this.a.Nb&&((e=this.a.Nb()).length&&On(t,"scopes",e.join(","))),this.l?On(t,"redirectUrl",this.l):Kn(t.a,"redirectUrl"),this.g?On(t,"eventId",this.g):Kn(t.a,"eventId"),this.i?On(t,"v",this.i):Kn(t.a,"v"),this.b)for(var s in this.b)this.b.hasOwnProperty(s)&&!Pn(t,s)&&On(t,s,this.b[s]);return this.h?On(t,"tid",this.h):Kn(t.a,"tid"),this.f?On(t,"eid",this.f):Kn(t.a,"eid"),(s=ru(this.c)).length&&On(t,"fw",s.join(",")),t.toString()},(t=iu.prototype).Lb=function(e,n,t){var r=new _("popup-closed-by-user"),i=new _("web-storage-unsupported"),o=this,s=!1;return this.ka().then(function(){var t,r;r={type:"webStorageSupport"},su(t=o).then(function(){return e=t.i,n=r,e.nb.then(function(){return new ve(function(t){e.a.send(n.type,n,t,_r("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})});var e,n}).then(function(t){if(t&&t.length&&void 0!==t[0].webStorageSupport)return t[0].webStorageSupport;throw Error()}).then(function(t){t||(e&&or(e),n(i),s=!0)})}).o(function(){}).then(function(){if(!s)return n=e,new ve(function(e){return function t(){bn(2e3).then(function(){if(n&&!n.closed)return t();e()})}()});var n}).then(function(){if(!s)return bn(t).then(function(){n(r)})})},t.Ub=function(){var t=wr();return!Cr(t)&&!Pr(t)},t.Qb=function(){return!1},t.Jb=function(e,t,n,r,i,o,s,a){if(!e)return Ie(new _("popup-blocked"));if(s&&!Cr())return this.ka().o(function(t){or(e),i(t)}),r(),Ee();this.a||(this.a=ou(au(this)));var u=this;return this.a.then(function(){var t=u.ka().o(function(t){throw or(e),i(t),t});return r(),t}).then(function(){Po(n),s||rr(uu(u.u,u.f,u.b,t,n,null,o,u.c,void 0,u.h,a),e)}).o(function(t){throw"auth/network-request-failed"==t.code&&(u.a=null),t})},t.Kb=function(t,e,n,r){this.a||(this.a=ou(au(this)));var i=this;return this.a.then(function(){Po(e),rr(uu(i.u,i.f,i.b,t,e,nr(),n,i.c,void 0,i.h,r))}).o(function(t){throw"auth/network-request-failed"==t.code&&(i.a=null),t})},t.ka=function(){var t=this;return su(this).then(function(){return t.i.nb}).o(function(){throw t.a=null,new _("network-request-failed")})},t.Xb=function(){return!0},t.Ca=function(t){this.g.push(t)},t.Qa=function(e){H(this.g,function(t){return t==e})},(t=cu.prototype).get=function(t){return Ee(this.a.getItem(t)).then(function(t){return t&&kr(t)})},t.set=function(t,e){return Ee(this.a.setItem(t,Nr(e)))},t.T=function(t){return Ee(this.a.removeItem(t))},t.ba=function(){},t.ha=function(){};var lu,fu=[];function pu(t,e,n){ut(t.a)&&t.b.addEventListener("message",t.f),void 0===t.a[e]&&(t.a[e]=[]),t.a[e].push(n)}function du(t){this.a=t}function vu(t){this.c=t,this.b=!1,this.a=[]}function yu(r,t,e,n){var i,o,s,a,u=e||{},c=null;if(r.b)return Ie(Error("connection_unavailable"));var h=n?800:50,l="undefined"!=typeof MessageChannel?new MessageChannel:null;return new ve(function(e,n){l?(i=Math.floor(Math.random()*Math.pow(10,20)).toString(),l.port1.start(),s=setTimeout(function(){n(Error("unsupported_event"))},h),c={messageChannel:l,onMessage:o=function(t){t.data.eventId===i&&("ack"===t.data.status?(clearTimeout(s),a=setTimeout(function(){n(Error("timeout"))},3e3)):"done"===t.data.status?(clearTimeout(a),void 0!==t.data.response?e(t.data.response):n(Error("unknown_error"))):(clearTimeout(s),clearTimeout(a),n(Error("invalid_response"))))}},r.a.push(c),l.port1.addEventListener("message",o),r.c.postMessage({eventType:t,eventId:i,data:u},[l.port2])):n(Error("connection_unavailable"))}).then(function(t){return gu(r,c),t}).o(function(t){throw gu(r,c),t})}function gu(t,e){if(e){var n=e.messageChannel,r=e.onMessage;n&&(n.port1.removeEventListener("message",r),n.port1.close()),H(t.a,function(t){return t==e})}}function mu(){if(!_u())throw new _("web-storage-unsupported");this.c={},this.a=[],this.b=0,this.u=l.indexedDB,this.type="indexedDB",this.g=this.l=this.f=this.i=null,this.s=!1,this.h=null;var t,r=this;fr()&&self?(this.l=function(){var e=fr()?self:null;if(U(fu,function(t){t.b==e&&(n=t)}),!n){var n=new hu(e);fu.push(n)}return n}(),pu(this.l,"keyChanged",function(t,n){return Cu(r).then(function(e){return 0<e.length&&U(r.a,function(t){t(e)}),{keyProcessed:B(e,n.key)}})}),pu(this.l,"ping",function(){return Ee(["keyChanged"])})):((t=l.navigator)&&t.serviceWorker?Ee().then(function(){return t.serviceWorker.ready}).then(function(t){return t.active||null}).o(function(){return null}):Ee(null)).then(function(t){(r.h=t)&&(r.g=new vu(new du(t)),yu(r.g,"ping",null,!0).then(function(t){t[0].fulfilled&&B(t[0].value,"keyChanged")&&(r.s=!0)}).o(function(){}))})}function bu(i){return new ve(function(e,n){var t=i.u.open("firebaseLocalStorageDb",1);t.onerror=function(t){try{t.preventDefault()}catch(t){}n(Error(t.target.error))},t.onupgradeneeded=function(t){t=t.target.result;try{t.createObjectStore("firebaseLocalStorage",{keyPath:"fbase_key"})}catch(t){n(t)}},t.onsuccess=function(t){var r;(t=t.target.result).objectStoreNames.contains("firebaseLocalStorage")?e(t):(r=i,new ve(function(t,e){var n=r.u.deleteDatabase("firebaseLocalStorageDb");n.onsuccess=function(){t()},n.onerror=function(t){e(Error(t.target.error))}}).then(function(){return bu(i)}).then(function(t){e(t)}).o(function(t){n(t)}))}})}function wu(t){return t.m||(t.m=bu(t)),t.m}function _u(){try{return l.indexedDB}catch(t){return}}function Eu(t){return t.objectStore("firebaseLocalStorage")}function Iu(t,e){return t.transaction(["firebaseLocalStorage"],e?"readwrite":"readonly")}function Tu(t){return new ve(function(e,n){t.onsuccess=function(t){t&&t.target?e(t.target.result):e()},t.onerror=function(t){n(t.target.error)}})}function Su(t,e){return t.g&&t.h&&((n=l.navigator)&&n.serviceWorker&&n.serviceWorker.controller||null)===t.h?yu(t.g,"keyChanged",{key:e},t.s).then(function(){}).o(function(){}):Ee();var n}function Cu(r){return wu(r).then(function(t){var i=Eu(Iu(t,!1));return i.getAll?Tu(i.getAll()):new ve(function(e,n){var r=[],t=i.openCursor();t.onsuccess=function(t){(t=t.target.result)?(r.push(t.value),t.continue()):e(r)},t.onerror=function(t){n(t.target.error)}})}).then(function(t){var e={},n=[];if(0==r.b){for(n=0;n<t.length;n++)e[t[n].fbase_key]=t[n].value;n=function t(e,n){var r,i=[];for(r in e)r in n&&typeof e[r]==typeof n[r]?"object"==typeof e[r]&&null!=e[r]&&null!=n[r]?0<t(e[r],n[r]).length&&i.push(r):e[r]!==n[r]&&i.push(r):i.push(r);for(r in n)r in e||i.push(r);return i}(r.c,e),r.c=e}return n})}function Nu(t){t.i&&t.i.cancel("STOP_EVENT"),t.f&&(clearTimeout(t.f),t.f=null)}function Au(t){var r=this,i=null;this.a=[],this.type="indexedDB",this.c=t,this.b=Ee().then(function(){if(_u()){var e=Or(),n="__sak"+e;return lu=lu||new mu,(i=lu).set(n,e).then(function(){return i.get(n)}).then(function(t){if(t!==e)throw Error("indexedDB not supported!");return i.T(n)}).then(function(){return i}).o(function(){return r.c})}return r.c}).then(function(t){return r.type=t.type,t.ba(function(e){U(r.a,function(t){t(e)})}),t})}function ku(){this.a={},this.type="inMemory"}function Ou(){if(!function(){var t="Node"==pr();if(!(t=Pu()||t&&zl.INTERNAL.node&&zl.INTERNAL.node.localStorage))return;try{return t.setItem("__sak","1"),t.removeItem("__sak"),1}catch(t){return}}()){if("Node"==pr())throw new _("internal-error","The LocalStorage compatibility library was not found.");throw new _("web-storage-unsupported")}this.a=Pu()||zl.INTERNAL.node.localStorage,this.type="localStorage"}function Pu(){try{var t=l.localStorage,e=Or();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Ru(){this.type="nullStorage"}function Du(){if(!function(){var t="Node"==pr();if(!(t=xu()||t&&zl.INTERNAL.node&&zl.INTERNAL.node.sessionStorage))return;try{return t.setItem("__sak","1"),t.removeItem("__sak"),1}catch(t){return}}()){if("Node"==pr())throw new _("internal-error","The SessionStorage compatibility library was not found.");throw new _("web-storage-unsupported")}this.a=xu()||zl.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function xu(){try{var t=l.sessionStorage,e=Or();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Lu(){var t={};t.Browser=Uu,t.Node=ju,t.ReactNative=Vu,t.Worker=qu,this.a=t[pr()]}hu.prototype.c=function(n){var r=n.data.eventType,i=n.data.eventId,t=this.a[r];if(t&&0<t.length){n.ports[0].postMessage({status:"ack",eventId:i,eventType:r,response:null});var e=[];U(t,function(t){e.push(Ee().then(function(){return t(n.origin,n.data.data)}))}),Se(e).then(function(t){var e=[];U(t,function(t){e.push({fulfilled:t.Mb,value:t.value,reason:t.reason?t.reason.message:void 0})}),U(e,function(t){for(var e in t)void 0===t[e]&&delete t[e]}),n.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:e})})}},du.prototype.postMessage=function(t,e){this.a.postMessage(t,e)},vu.prototype.close=function(){for(;0<this.a.length;)gu(this,this.a[0]);this.b=!0},(t=mu.prototype).set=function(n,r){var i,o=!1,s=this;return wu(this).then(function(t){return Tu((t=Eu(Iu(i=t,!0))).get(n))}).then(function(t){var e=Eu(Iu(i,!0));return t?(t.value=r,Tu(e.put(t))):(s.b++,o=!0,(t={}).fbase_key=n,t.value=r,Tu(e.add(t)))}).then(function(){return s.c[n]=r,Su(s,n)}).ma(function(){o&&s.b--})},t.get=function(e){return wu(this).then(function(t){return Tu(Eu(Iu(t,!1)).get(e))}).then(function(t){return t&&t.value})},t.T=function(e){var n=!1,r=this;return wu(this).then(function(t){return n=!0,r.b++,Tu(Eu(Iu(t,!0)).delete(e))}).then(function(){return delete r.c[e],Su(r,e)}).ma(function(){n&&r.b--})},t.ba=function(t){var n;0==this.a.length&&(Nu(n=this),function e(){n.f=setTimeout(function(){n.i=Cu(n).then(function(e){0<e.length&&U(n.a,function(t){t(e)})}).then(function(){e()}).o(function(t){"STOP_EVENT"!=t.message&&e()})},800)}()),this.a.push(t)},t.ha=function(e){H(this.a,function(t){return t==e}),0==this.a.length&&Nu(this)},(t=Au.prototype).get=function(e){return this.b.then(function(t){return t.get(e)})},t.set=function(e,n){return this.b.then(function(t){return t.set(e,n)})},t.T=function(e){return this.b.then(function(t){return t.T(e)})},t.ba=function(t){this.a.push(t)},t.ha=function(e){H(this.a,function(t){return t==e})},(t=ku.prototype).get=function(t){return Ee(this.a[t])},t.set=function(t,e){return this.a[t]=e,Ee()},t.T=function(t){return delete this.a[t],Ee()},t.ba=function(){},t.ha=function(){},(t=Ou.prototype).get=function(t){var e=this;return Ee().then(function(){return kr(e.a.getItem(t))})},t.set=function(e,n){var r=this;return Ee().then(function(){var t=Nr(n);null===t?r.T(e):r.a.setItem(e,t)})},t.T=function(t){var e=this;return Ee().then(function(){e.a.removeItem(t)})},t.ba=function(t){l.window&&en(l.window,"storage",t)},t.ha=function(t){l.window&&on(l.window,"storage",t)},(t=Ru.prototype).get=function(){return Ee(null)},t.set=function(){return Ee()},t.T=function(){return Ee()},t.ba=function(){},t.ha=function(){},(t=Du.prototype).get=function(t){var e=this;return Ee().then(function(){return kr(e.a.getItem(t))})},t.set=function(e,n){var r=this;return Ee().then(function(){var t=Nr(n);null===t?r.T(e):r.a.setItem(e,t)})},t.T=function(t){var e=this;return Ee().then(function(){e.a.removeItem(t)})},t.ba=function(){},t.ha=function(){};var Mu,Fu,Uu={F:Ou,$a:Du},ju={F:Ou,$a:Du},Vu={F:cu,$a:Ru},qu={F:Ou,$a:Ru},Bu={od:"local",NONE:"none",qd:"session"};function Wu(){var t=!(Pr(wr())||!lr()),e=Cr(),n=Er();this.m=t,this.h=e,this.l=n,this.a={},t=Mu=Mu||new Lu;try{this.g=!er()&&Mr()||!l.indexedDB?new t.a.F:new Au(fr()?new ku:new t.a.F)}catch(t){this.g=new ku,this.h=!0}try{this.i=new t.a.$a}catch(t){this.i=new ku}this.u=new ku,this.f=m(this.Vb,this),this.b={}}function Hu(){return Fu=Fu||new Wu}function Ku(t,e){switch(e){case"session":return t.i;case"none":return t.u;default:return t.g}}function Gu(t,e){return"firebase:"+t.name+(e?":"+e:"")}function zu(t,e,n){return n=Gu(e,n),"local"==e.F&&(t.b[n]=null),Ku(t,e.F).T(n)}function Qu(t){t.c&&(clearInterval(t.c),t.c=null)}function Xu(t){this.a=t,this.b=Hu()}(t=Wu.prototype).get=function(t,e){return Ku(this,t.F).get(Gu(t,e))},t.set=function(e,t,n){var r=Gu(e,n),i=this,o=Ku(this,e.F);return o.set(r,t).then(function(){return o.get(r)}).then(function(t){"local"==e.F&&(i.b[r]=t)})},t.addListener=function(t,e,n){var r;t=Gu(t,e),this.l&&(this.b[t]=l.localStorage.getItem(t)),ut(this.a)&&(Ku(this,"local").ba(this.f),this.h||(er()||!Mr())&&l.indexedDB||!this.l||(Qu(r=this),r.c=setInterval(function(){for(var t in r.a){var e=l.localStorage.getItem(t),n=r.b[t];e!=n&&(r.b[t]=e,e=new He({type:"storage",key:t,target:window,oldValue:n,newValue:e,a:!0}),r.Vb(e))}},1e3))),this.a[t]||(this.a[t]=[]),this.a[t].push(n)},t.removeListener=function(t,e,n){t=Gu(t,e),this.a[t]&&(H(this.a[t],function(t){return t==n}),0==this.a[t].length&&delete this.a[t]),ut(this.a)&&(Ku(this,"local").ha(this.f),Qu(this))},t.Vb=function(t){if(t&&t.f){var e=t.a.key;if(null==e)for(var n in this.a){var r=this.b[n];void 0===r&&(r=null);var i=l.localStorage.getItem(n);i!==r&&(this.b[n]=i,this.ib(n))}else if(0==e.indexOf("firebase:")&&this.a[e]){if(void 0!==t.a.a?Ku(this,"local").ha(this.f):Qu(this),this.m)if(n=l.localStorage.getItem(e),(r=t.a.newValue)!==n)null!==r?l.localStorage.setItem(e,r):l.localStorage.removeItem(e);else if(this.b[e]===r&&void 0===t.a.a)return;var o=this;n=function(){void 0===t.a.a&&o.b[e]===l.localStorage.getItem(e)||(o.b[e]=l.localStorage.getItem(e),o.ib(e))},Bt&&$t&&10==$t&&l.localStorage.getItem(e)!==t.a.newValue&&t.a.newValue!==t.a.oldValue?setTimeout(n,10):n()}}else U(t,m(this.ib,this))},t.ib=function(t){this.a[t]&&U(this.a[t],function(t){t()})};var Yu,$u={name:"authEvent",F:"local"};function Ju(){this.a=Hu()}function Zu(t,e){this.b=tc,this.f=l.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=t,this.h=e,this.l=l.Int32Array?new Int32Array(64):Array(64),void 0===Yu&&(Yu=l.Int32Array?new Int32Array(ac):ac),this.reset()}e(Zu,function(){this.b=-1});for(var tc=64,ec=tc-1,nc=[],rc=0;rc<ec;rc++)nc[rc]=0;var ic=K(128,nc);function oc(t){for(var e=t.f,n=t.l,r=0,i=0;i<e.length;)n[r++]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3],i=4*r;for(e=16;e<64;e++){i=0|n[e-15],r=0|n[e-2];var o=(0|n[e-16])+((i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3)|0,s=(0|n[e-7])+((r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)|0;n[e]=o+s|0}r=0|t.a[0],i=0|t.a[1];var a=0|t.a[2],u=0|t.a[3],c=0|t.a[4],h=0|t.a[5],l=0|t.a[6];for(o=0|t.a[7],e=0;e<64;e++){var f=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&a^i&a)|0;s=(o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0)+((s=(s=c&h^~c&l)+(0|Yu[e])|0)+(0|n[e])|0)|0,o=l,l=h,h=c,c=u+s|0,u=a,a=i,i=r,r=s+f|0}t.a[0]=t.a[0]+r|0,t.a[1]=t.a[1]+i|0,t.a[2]=t.a[2]+a|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+h|0,t.a[6]=t.a[6]+l|0,t.a[7]=t.a[7]+o|0}function sc(t,e,n){void 0===n&&(n=e.length);var r=0,i=t.c;if("string"==typeof e)for(;r<n;)t.f[i++]=e.charCodeAt(r++),i==t.b&&(oc(t),i=0);else{if(!h(e))throw Error("message must be string or array");for(;r<n;){var o=e[r++];if(!("number"==typeof o&&0<=o&&o<=255&&o==(0|o)))throw Error("message must be a byte array");t.f[i++]=o,i==t.b&&(oc(t),i=0)}}t.c=i,t.g+=n}Zu.prototype.reset=function(){this.g=this.c=0,this.a=l.Int32Array?new Int32Array(this.h):G(this.h)};var ac=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function uc(){Zu.call(this,8,cc)}e(uc,Zu);var cc=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function hc(t,e,n,r,i){this.u=t,this.i=e,this.l=n,this.m=r||null,this.s=i||null,this.h=e+":"+n,this.w=new Ju,this.g=new Xu(this.h),this.f=null,this.b=[],this.a=this.c=null}function lc(t){return new _("invalid-cordova-configuration",t)}function fc(t){var e=new uc;sc(e,t),t=[];var n=8*e.g;e.c<56?sc(e,ic,56-e.c):sc(e,ic,e.b-(e.c-56));for(var r=63;56<=r;r--)e.f[r]=255&n,n/=256;for(oc(e),r=n=0;r<e.i;r++)for(var i=24;0<=i;i-=8)t[n++]=e.a[r]>>i&255;return V(t,function(t){return 1<(t=t.toString(16)).length?t:"0"+t}).join("")}function pc(t,e){for(var n=0;n<t.b.length;n++)try{t.b[n](e)}catch(t){}}function dc(a){return a.f||(a.f=a.ka().then(function(){return new ve(function(n){function e(r){t=!0,s&&s.cancel(),vc(i).then(function(t){var e=o;if(t&&r&&r.url){var n=null;-1!=(e=Yi(r.url)).indexOf("/__/auth/callback")&&(n=(n="object"==typeof(n=kr(Pn(n=Rn(e),"firebaseError")||null))?E(n):null)?new Ro(t.c,t.b,null,null,n,null,t.S()):new Ro(t.c,t.b,e,t.f,null,null,t.S())),e=n||o}pc(i,e)})}var i,o,t,s,r;a.Ca(function t(e){return n(e),a.Qa(t),!1}),i=a,o=new Ro("unknown",null,null,null,new _("no-auth-event")),t=!1,s=bn(500).then(function(){return vc(i).then(function(){t||pc(i,o)})}),r=l.handleOpenURL,l.handleOpenURL=function(t){if(0==t.toLowerCase().indexOf(_r("BuildInfo.packageName",l).toLowerCase()+"://")&&e({url:t}),"function"==typeof r)try{r(t)}catch(t){console.error(t)}},Mo=Mo||new xo,function(t){var n=Mo;n.a.push(t),n.b||(n.b=function(t){for(var e=0;e<n.a.length;e++)n.a[e](t)},"function"==typeof(t=_r("universalLinks.subscribe",l))&&t(null,n.b))}(e)})})),a.f}function vc(e){var t,n=null;return(t=e.g).b.get($u,t.a).then(function(t){return Do(t)}).then(function(t){return n=t,zu((t=e.g).b,$u,t.a)}).then(function(){return n})}function yc(t){this.a=t,this.b=Hu()}(t=hc.prototype).ka=function(){return this.Ga?this.Ga:this.Ga=(hr(void 0)?cr().then(function(){return new ve(function(t,e){var n=l.document,r=setTimeout(function(){e(Error("Cordova framework is not ready."))},1e3);n.addEventListener("deviceready",function(){clearTimeout(r),t()},!1)})}):Ie(Error("Cordova must run in an Android or iOS file scheme."))).then(function(){if("function"!=typeof _r("universalLinks.subscribe",l))throw lc("cordova-universal-links-plugin-fix is not installed");if(void 0===_r("BuildInfo.packageName",l))throw lc("cordova-plugin-buildinfo is not installed");if("function"!=typeof _r("cordova.plugins.browsertab.openUrl",l))throw lc("cordova-plugin-browsertab is not installed");if("function"!=typeof _r("cordova.InAppBrowser.open",l))throw lc("cordova-plugin-inappbrowser is not installed")},function(){throw new _("cordova-not-ready")})},t.Lb=function(t,e){return e(new _("operation-not-supported-in-this-environment")),Ee()},t.Jb=function(){return Ie(new _("operation-not-supported-in-this-environment"))},t.Xb=function(){return!1},t.Ub=function(){return!0},t.Qb=function(){return!0},t.Kb=function(t,e,n,r){if(this.c)return Ie(new _("redirect-operation-pending"));var i=this,o=l.document,s=null,a=null,u=null,c=null;return this.c=Ee().then(function(){return Po(e),dc(i)}).then(function(){return function(n,t,e,r,i){var o=function(){for(var t=20,e=[];0<t;)e.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),t--;return e.join("")}(),s=new Ro(t,r,null,o,new _("no-auth-event"),null,i),a=_r("BuildInfo.packageName",l);if("string"!=typeof a)throw new _("invalid-cordova-configuration");var u=_r("BuildInfo.displayName",l),c={};if(wr().toLowerCase().match(/iphone|ipad|ipod/))c.ibi=a;else{if(!wr().toLowerCase().match(/android/))return Ie(new _("operation-not-supported-in-this-environment"));c.apn=a}u&&(c.appDisplayName=u),o=fc(o),c.sessionId=o;var h=uu(n.u,n.i,n.l,t,e,null,r,n.m,c,n.s,i);return n.ka().then(function(){var t=n.h;return n.w.a.set($u,s.v(),t)}).then(function(){var t=_r("cordova.plugins.browsertab.isAvailable",l);if("function"!=typeof t)throw new _("invalid-cordova-configuration");var e=null;t(function(t){if(t){if("function"!=typeof(e=_r("cordova.plugins.browsertab.openUrl",l)))throw new _("invalid-cordova-configuration");e(h)}else{if("function"!=typeof(e=_r("cordova.InAppBrowser.open",l)))throw new _("invalid-cordova-configuration");t=wr(),n.a=e(h,t.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||t.match(/(iPad|iPhone|iPod).*OS 8_\d/i)?"_blank":"_system","location=yes")}})})}(i,t,e,n,r)}).then(function(){return new ve(function(e,t){a=function(){var t=_r("cordova.plugins.browsertab.close",l);return e(),"function"==typeof t&&t(),i.a&&"function"==typeof i.a.close&&(i.a.close(),i.a=null),!1},i.Ca(a),u=function(){s=s||bn(2e3).then(function(){t(new _("redirect-cancelled-by-user"))})},c=function(){xr()&&u()},o.addEventListener("resume",u,!1),wr().toLowerCase().match(/android/)||o.addEventListener("visibilitychange",c,!1)}).o(function(t){return vc(i).then(function(){throw t})})}).ma(function(){u&&o.removeEventListener("resume",u,!1),c&&o.removeEventListener("visibilitychange",c,!1),s&&s.cancel(),a&&i.Qa(a),i.c=null})},t.Ca=function(e){this.b.push(e),dc(this).o(function(t){"auth/invalid-cordova-configuration"===t.code&&(t=new Ro("unknown",null,null,null,new _("no-auth-event")),e(t))})},t.Qa=function(e){H(this.b,function(t){return t==e})};var gc={name:"pendingRedirect",F:"session"};function mc(t){return zu(t.b,gc,t.a)}function bc(t,e,n){this.i={},this.w=0,this.D=t,this.u=e,this.m=n,this.h=[],this.f=!1,this.l=m(this.s,this),this.b=new Dc,this.B=new Uc,this.g=new yc(this.u+":"+this.m),this.c={},this.c.unknown=this.b,this.c.signInViaRedirect=this.b,this.c.linkViaRedirect=this.b,this.c.reauthViaRedirect=this.b,this.c.signInViaPopup=this.B,this.c.linkViaPopup=this.B,this.c.reauthViaPopup=this.B,this.a=wc(this.D,this.u,this.m,I)}function wc(t,e,n,r){var i=zl.SDK_VERSION||null;return new(hr()?hc:iu)(t,e,n,i,r)}function _c(e){e.f||(e.f=!0,e.a.Ca(e.l));var n=e.a;return e.a.ka().o(function(t){throw e.a==n&&e.reset(),t})}function Ec(n){n.a.Ub()&&_c(n).o(function(t){var e=new Ro("unknown",null,null,null,new _("operation-not-supported-in-this-environment"));Ac(t)&&n.s(e)}),n.a.Qb()||xc(n.b)}function Ic(n,t){var e;B(n.h,t)||n.h.push(t),n.f||(e=n.g).b.get(gc,e.a).then(function(t){return"pending"==t}).then(function(t){t?mc(n.g).then(function(){_c(n).o(function(t){var e=new Ro("unknown",null,null,null,new _("operation-not-supported-in-this-environment"));Ac(t)&&n.s(e)})}):Ec(n)}).o(function(){Ec(n)})}function Tc(t,e){H(t.h,function(t){return t==e})}bc.prototype.reset=function(){this.f=!1,this.a.Qa(this.l),this.a=wc(this.D,this.u,this.m),this.i={}},bc.prototype.s=function(t){if(!t)throw new _("invalid-auth-event");if(6e5<=w()-this.w&&(this.i={},this.w=0),t&&t.getUid()&&this.i.hasOwnProperty(t.getUid()))return!1;for(var e=!1,n=0;n<this.h.length;n++){var r=this.h[n];if(r.Cb(t.c,t.b)){(e=this.c[t.c])&&(e.h(t,r),t&&(t.f||t.b)&&(this.i[t.getUid()]=!0,this.w=w())),e=!0;break}}return xc(this.b),e};var Sc=new Dr(2e3,1e4),Cc=new Dr(3e4,6e4);function Nc(t,e,n,r,i,o,s){return t.a.Jb(e,n,r,function(){t.f||(t.f=!0,t.a.Ca(t.l))},function(){t.reset()},i,o,s)}function Ac(t){return!(!t||"auth/cordova-not-ready"!=t.code)}function kc(e,t,n,r,i){var o,s;return(s=e.g).b.set(gc,"pending",s.a).then(function(){return e.a.Kb(t,n,r,i).o(function(t){if(Ac(t))throw new _("operation-not-supported-in-this-environment");return o=t,mc(e.g).then(function(){throw o})}).then(function(){return e.a.Xb()?new ve(function(){}):mc(e.g).then(function(){return e.pa()}).then(function(){}).o(function(){})})})}function Oc(t,e,n,r,i){return t.a.Lb(r,function(t){e.la(n,null,t,i)},Sc.get())}bc.prototype.pa=function(){return this.b.pa()};var Pc={};function Rc(t,e,n){var r=e+":"+n;return Pc[r]||(Pc[r]=new bc(t,e,n)),Pc[r]}function Dc(){this.b=null,this.f=[],this.c=[],this.a=null,this.i=this.g=!1}function xc(t){t.g||(t.g=!0,Fc(t,!1,null,null))}function Lc(t){t.g&&!t.i&&Fc(t,!1,null,null)}function Mc(t,e){if(t.b=function(){return Ee(e)},t.f.length)for(var n=0;n<t.f.length;n++)t.f[n](e)}function Fc(t,e,n,r){e?r?function(t,e){if(t.b=function(){return Ie(e)},t.c.length)for(var n=0;n<t.c.length;n++)t.c[n](e)}(t,r):Mc(t,n):Mc(t,{user:null}),t.f=[],t.c=[]}function Uc(){}function jc(){this.Bb=!1,Object.defineProperty(this,"appVerificationDisabled",{get:function(){return this.Bb},set:function(t){this.Bb=t},enumerable:!1})}function Vc(t,e){this.a=e,qr(this,"verificationId",t)}function qc(t,e,n,r){return new Ao(t).cb(e,n).then(function(t){return new Vc(t,r)})}function Bc(t){var e=Mi(t);if(!(e&&e.exp&&e.auth_time&&e.iat))throw new _("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");Br(this,{token:t,expirationTime:Lr(1e3*e.exp),authTime:Lr(1e3*e.auth_time),issuedAtTime:Lr(1e3*e.iat),signInProvider:e.firebase&&e.firebase.sign_in_provider?e.firebase.sign_in_provider:null,signInSecondFactor:e.firebase&&e.firebase.sign_in_second_factor?e.firebase.sign_in_second_factor:null,claims:e})}function Wc(t,e,n){var r=e&&e[Kc];if(!r)throw new _("argument-error","Internal assert: Invalid MultiFactorResolver");this.a=t,this.f=ct(e),this.g=n,this.c=new $i(null,r),this.b=[];var i=this;U(e[Hc]||[],function(t){(t=Gr(t))&&i.b.push(t)}),qr(this,"auth",this.a),qr(this,"session",this.c),qr(this,"hints",this.b)}Dc.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},Dc.prototype.h=function(t,e){if(t){this.reset(),this.g=!0;var n=t.c,r=t.b,i=t.a&&"auth/web-storage-unsupported"==t.a.code,o=t.a&&"auth/operation-not-supported-in-this-environment"==t.a.code;this.i=!(!i&&!o),"unknown"!=n||i||o?t.a?(Fc(this,!0,null,t.a),Ee()):e.Da(n,r)?function(e,t,n){n=n.Da(t.c,t.b);var r=t.g,i=t.f,o=t.i,s=t.S(),a=!!t.c.match(/Redirect$/);n(r,i,s,o).then(function(t){Fc(e,a,t,null)}).o(function(t){Fc(e,a,null,t)})}(this,t,e):Ie(new _("invalid-auth-event")):(Fc(this,!1,null,null),Ee())}else Ie(new _("invalid-auth-event"))},Dc.prototype.pa=function(){var i=this;return new ve(function(t,e){var n,r;i.b?i.b().then(t,e):(i.f.push(t),i.c.push(e),n=i,r=new _("timeout"),n.a&&n.a.cancel(),n.a=bn(Cc.get()).then(function(){n.b||(n.g=!0,Fc(n,!0,null,r))}))})},Uc.prototype.h=function(t,e){if(t){var n=t.c,r=t.b;t.a?(e.la(t.c,null,t.a,t.b),Ee()):e.Da(n,r)?(o=e,s=(i=t).b,a=i.c,o.Da(a,s)(i.g,i.f,i.S(),i.i).then(function(t){o.la(a,t,null,s)}).o(function(t){o.la(a,null,t,s)})):Ie(new _("invalid-auth-event"))}else Ie(new _("invalid-auth-event"));var i,o,s,a},Vc.prototype.confirm=function(t){return t=ko(this.verificationId,t),this.a(t)};var Hc="mfaInfo",Kc="mfaPendingCredential";function Gc(t,e,n,r){_.call(this,"multi-factor-auth-required",r,e),this.b=new Wc(t,e,n),qr(this,"resolver",this.b)}function zc(t,e,n){if(t&&v(t.serverResponse)&&"auth/multi-factor-auth-required"===t.code)try{return new Gc(e,t.serverResponse,n,t.message)}catch(t){}return null}function Qc(){}function Xc(t){qr(this,"factorId",t.ea),this.a=t}function Yc(t){if(Xc.call(this,t),this.a.ea!=Ao.PROVIDER_ID)throw new _("argument-error","firebase.auth.PhoneMultiFactorAssertion requires a valid firebase.auth.PhoneAuthCredential")}function $c(t,e){for(var n in We.call(this,t),e)this[n]=e[n]}function Jc(t,e){this.a=t,this.b=[],this.c=m(this.wc,this),en(this.a,"userReloaded",this.c);var r=[];e&&e.multiFactor&&e.multiFactor.enrolledFactors&&U(e.multiFactor.enrolledFactors,function(t){var e=null,n={};if(t){t.uid&&(n[Xr]=t.uid),t.displayName&&(n[zr]=t.displayName),t.enrollmentTime&&(n[Qr]=new Date(t.enrollmentTime).toISOString()),t.phoneNumber&&(n[Yr]=t.phoneNumber);try{e=new $r(n)}catch(t){}t=e}else t=null;t&&r.push(t)}),Zc(this,r)}function Zc(t,e){t.b=e,qr(t,"enrolledFactors",e)}function th(t,e,n){if(this.h=t,this.i=e,this.g=n,this.c=3e4,this.f=96e4,this.b=null,this.a=this.c,this.f<this.c)throw Error("Proactive refresh lower bound greater than upper bound!")}function eh(t,e){return e?(t.a=t.c,t.g()):(e=t.a,t.a*=2,t.a>t.f&&(t.a=t.f),e)}function nh(t){this.c=t,this.b=this.a=null}function rh(t){return t.b&&1e3*t.b.c||0}function ih(t,e){var n=e.refreshToken;t.b=Li(e[Hs]||""),t.a=n}function oh(e,t){return r=e.c,i=t,new ve(function(e,n){"refresh_token"==i.grant_type&&i.refresh_token||"authorization_code"==i.grant_type&&i.code?$s(r,r.u+"?key="+encodeURIComponent(r.c),function(t){t?t.error?n(Xa(t)):t.access_token&&t.refresh_token?e(t):n(new _("internal-error")):n(new _("network-request-failed"))},"POST",Hn(i).toString(),r.g,r.m.get()):n(new _("internal-error"))}).then(function(t){return e.b=Li(t.access_token),e.a=t.refresh_token,{accessToken:e.b.toString(),refreshToken:e.a}}).o(function(t){throw"auth/user-token-expired"==t.code&&(e.a=null),t});var r,i}function sh(t,e){this.a=t||null,this.b=e||null,Br(this,{lastSignInTime:Lr(e||null),creationTime:Lr(t||null)})}function ah(t,e,n,r,i,o){Br(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function uh(t,e,n){var r;this.N=[],this.l=t.apiKey,this.m=t.appName,this.s=t.authDomain||null,t=zl.SDK_VERSION?br(zl.SDK_VERSION):null,this.a=new Bs(this.l,N(I),t),this.b=new nh(this.a),vh(this,e[Hs]),ih(this.b,e),qr(this,"refreshToken",this.b.a),mh(this,n||{}),dn.call(this),this.P=!1,this.s&&Ir()&&(this.i=Rc(this.s,this.l,this.m)),this.R=[],this.h=null,this.B=(r=this,new th(function(){return r.I(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var t=rh(r.b)-w()-3e5;return 0<t?t:0})),this.Z=m(this.Ma,this);var i=this;this.oa=null,this.za=function(t){i.va(t.g)},this.aa=null,this.W=[],this.ya=function(t){hh(i,t.c)},this.$=null,this.O=new Jc(this,n),qr(this,"multiFactor",this.O)}function ch(t,e){t.aa&&on(t.aa,"languageCodeChanged",t.za),(t.aa=e)&&en(e,"languageCodeChanged",t.za)}function hh(t,e){t.W=e,Ys(t.a,zl.SDK_VERSION?br(zl.SDK_VERSION,t.W):null)}function lh(t,e){t.$&&on(t.$,"frameworkChanged",t.ya),(t.$=e)&&en(e,"frameworkChanged",t.ya)}function fh(e){try{return zl.app(e.m).auth()}catch(t){throw new _("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+e.m+"'!")}}function ph(t){t.D||t.B.b||(t.B.start(),on(t,"tokenChanged",t.Z),en(t,"tokenChanged",t.Z))}function dh(t){on(t,"tokenChanged",t.Z),t.B.stop()}function vh(t,e){t.xa=e,qr(t,"_lat",e)}function yh(t){for(var e=[],n=0;n<t.R.length;n++)e.push(t.R[n](t));return Se(e).then(function(){return t})}function gh(t){t.i&&!t.P&&(t.P=!0,Ic(t.i,t))}function mh(t,e){Br(t,{uid:e.uid,displayName:e.displayName||null,photoURL:e.photoURL||null,email:e.email||null,emailVerified:e.emailVerified||!1,phoneNumber:e.phoneNumber||null,isAnonymous:e.isAnonymous||!1,tenantId:e.tenantId||null,metadata:new sh(e.createdAt,e.lastLoginAt),providerData:[]}),t.a.b=t.tenantId}function bh(){}function wh(t){return Ee().then(function(){if(t.D)throw new _("app-deleted")})}function _h(t){return V(t.providerData,function(t){return t.providerId})}function Eh(t,e){e&&(Ih(t,e.providerId),t.providerData.push(e))}function Ih(t,e){H(t.providerData,function(t){return t.providerId==e})}function Th(t,e,n){("uid"!=e||n)&&t.hasOwnProperty(e)&&qr(t,e,n)}function Sh(e,t){var n,r,i;e!=t&&(Br(e,{uid:t.uid,displayName:t.displayName,photoURL:t.photoURL,email:t.email,emailVerified:t.emailVerified,phoneNumber:t.phoneNumber,isAnonymous:t.isAnonymous,tenantId:t.tenantId,providerData:[]}),t.metadata?qr(e,"metadata",new sh((i=t.metadata).a,i.b)):qr(e,"metadata",new sh),U(t.providerData,function(t){Eh(e,t)}),n=e.b,r=t.b,n.b=r.b,n.a=r.a,qr(e,"refreshToken",e.b.a),Zc(e.O,t.O.b))}function Ch(i){return i.I().then(function(t){var e,n,r=i.isAnonymous;return n=t,za((e=i).a,Ta,{idToken:n}).then(m(e.Ic,e)).then(function(){return r||Th(i,"isAnonymous",!1),t})})}function Nh(t,e){e[Hs]&&t.xa!=e[Hs]&&(ih(t.b,e),t.dispatchEvent(new $c("tokenChanged")),vh(t,e[Hs]),Th(t,"refreshToken",t.b.a))}function Ah(t,e){return Ch(t).then(function(){if(B(_h(t),e))return yh(t).then(function(){throw new _("provider-already-linked")})})}function kh(t,e,n){return Wr({user:t,credential:Oo(e),additionalUserInfo:e=qi(e),operationType:n})}function Oh(t,e){return Nh(t,e),t.reload().then(function(){return t})}function Ph(n,r,t,e,i){if(!Ir())return Ie(new _("operation-not-supported-in-this-environment"));if(n.h&&!i)return Ie(n.h);var o=Vi(t.providerId),s=Or(n.uid+":::"),a=null;(!Cr()||lr())&&n.s&&t.isOAuthProvider&&(a=uu(n.s,n.l,n.m,r,t,null,s,zl.SDK_VERSION||null,null,null,n.tenantId));var u=sr(a,o&&o.ta,o&&o.sa);return e=e().then(function(){if(Dh(n),!i)return n.I().then(function(){})}).then(function(){return Nc(n.i,u,r,t,s,!!a,n.tenantId)}).then(function(){return new ve(function(t,e){n.la(r,null,new _("cancelled-popup-request"),n.g||null),n.f=t,n.w=e,n.g=s,n.c=Oc(n.i,n,r,u,s)})}).then(function(t){return u&&or(u),t?Wr(t):null}).o(function(t){throw u&&or(u),t}),xh(n,e,i)}function Rh(e,t,n,r,i){if(!Ir())return Ie(new _("operation-not-supported-in-this-environment"));if(e.h&&!i)return Ie(e.h);var o=null,s=Or(e.uid+":::");return r=r().then(function(){if(Dh(e),!i)return e.I().then(function(){})}).then(function(){return e.fa=s,yh(e)}).then(function(t){return e.ga&&(t=(t=e.ga).b.set(Fh,e.v(),t.a)),t}).then(function(){return kc(e.i,t,n,s,e.tenantId)}).o(function(t){if(o=t,e.ga)return Uh(e.ga);throw o}).then(function(){if(o)throw o}),xh(e,r,i)}function Dh(t){if(!t.i||!t.P){if(t.i&&!t.P)throw new _("internal-error");throw new _("auth-domain-config-required")}}function xh(n,t,e){var r,i,o,s=(i=t,o=e,(r=n).h&&!o?(i.cancel(),Ie(r.h)):i.o(function(t){throw!t||"auth/user-disabled"!=t.code&&"auth/user-token-expired"!=t.code||(r.h||r.dispatchEvent(new $c("userInvalidated")),r.h=t),t}));return n.N.push(s),s.ma(function(){W(n.N,s)}),s.o(function(t){var e=null;throw t&&"auth/multi-factor-auth-required"===t.code&&(e=zc(t.v(),fh(n),m(n.hc,n))),e||t})}function Lh(t){if(!t.apiKey)return null;var e={apiKey:t.apiKey,authDomain:t.authDomain,appName:t.appName},n={};if(!t.stsTokenManager||!t.stsTokenManager.accessToken)return null;n[Hs]=t.stsTokenManager.accessToken,n.refreshToken=t.stsTokenManager.refreshToken||null;var r=new uh(e,n,t);return t.providerData&&U(t.providerData,function(t){t&&Eh(r,Wr(t))}),t.redirectEventId&&(r.fa=t.redirectEventId),r}function Mh(t){this.a=t,this.b=Hu()}Wc.prototype.Pc=function(t){var n=this;return t.ob(this.a.b,this.c).then(function(t){var e=ct(n.f);return delete e[Hc],delete e[Kc],lt(e,t),n.g(e)})},e(Gc,_),Qc.prototype.ob=function(t,e,n){return e.type==Ji?(o=this,s=t,a=n,e.Fa().then(function(t){return t={idToken:t},void 0!==a&&(t.displayName=a),lt(t,{phoneVerificationInfo:No(o.a)}),za(s,Ea,t)})):(r=this,i=t,e.Fa().then(function(t){return lt(t={mfaPendingCredential:t},{phoneVerificationInfo:No(r.a)}),za(i,Ia,t)}));var r,i,o,s,a},e(Xc,Qc),e(Yc,Xc),e($c,We),(t=Jc.prototype).wc=function(t){var e,n;Zc(this,(e=t.ed,n=[],U(e.mfaInfo||[],function(t){(t=Gr(t))&&n.push(t)}),n))},t.Ob=function(){return this.a.I().then(function(t){return new $i(t,null)})},t.dc=function(e,n){var r=this,i=this.a.a;return this.Ob().then(function(t){return e.ob(i,t,n)}).then(function(t){return Nh(r.a,t),r.a.reload()})},t.$c=function(t){var n=this,r="string"==typeof t?t:t.uid,e=this.a.a;return this.a.I().then(function(t){return za(e,Ga,{idToken:t,mfaEnrollmentId:r})}).then(function(t){var e=j(n.b,function(t){return t.uid!=r});return Zc(n,e),Nh(n.a,t),n.a.reload().o(function(t){if("auth/user-token-expired"!=t.code)throw t})})},t.v=function(){return{multiFactor:{enrolledFactors:V(this.b,function(t){return t.v()})}}},th.prototype.start=function(){this.a=this.c,function e(n,t){n.stop();n.b=bn(eh(n,t)).then(function(){return e=l.document,n=null,xr()||!e?Ee():new ve(function(t){n=function(){xr()&&(e.removeEventListener("visibilitychange",n,!1),t())},e.addEventListener("visibilitychange",n,!1)}).o(function(t){throw e.removeEventListener("visibilitychange",n,!1),t});var e,n}).then(function(){return n.h()}).then(function(){e(n,!0)}).o(function(t){n.i(t)&&e(n,!1)})}(this,!0)},th.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},nh.prototype.v=function(){return{apiKey:this.c.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:rh(this)}},nh.prototype.getToken=function(t){return t=!!t,this.b&&!this.a?Ie(new _("user-token-expired")):t||!this.b||w()>rh(this)-3e4?this.a?oh(this,{grant_type:"refresh_token",refresh_token:this.a}):Ee(null):Ee({accessToken:this.b.toString(),refreshToken:this.a})},sh.prototype.v=function(){return{lastLoginAt:this.b,createdAt:this.a}},e(uh,dn),uh.prototype.va=function(t){this.oa=t,Xs(this.a,t)},uh.prototype.ja=function(){return this.oa},uh.prototype.Ea=function(){return G(this.W)},uh.prototype.Ma=function(){this.B.b&&(this.B.stop(),this.B.start())},qr(uh.prototype,"providerId","firebase"),(t=uh.prototype).reload=function(){var t=this;return xh(this,wh(this).then(function(){return Ch(t).then(function(){return yh(t)}).then(bh)}))},t.mc=function(t){return this.I(t).then(function(t){return new Bc(t)})},t.I=function(t){var e=this;return xh(this,wh(this).then(function(){return e.b.getToken(t)}).then(function(t){if(!t)throw new _("internal-error");return t.accessToken!=e.xa&&(vh(e,t.accessToken),e.dispatchEvent(new $c("tokenChanged"))),Th(e,"refreshToken",t.refreshToken),t.accessToken}))},t.Ic=function(t){if(!(t=t.users)||!t.length)throw new _("internal-error");mh(this,{uid:(t=t[0]).localId,displayName:t.displayName,photoURL:t.photoUrl,email:t.email,emailVerified:!!t.emailVerified,phoneNumber:t.phoneNumber,lastLoginAt:t.lastLoginAt,createdAt:t.createdAt,tenantId:t.tenantId});for(var e=(r=(r=t).providerUserInfo)&&r.length?V(r,function(t){return new ah(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[],n=0;n<e.length;n++)Eh(this,e[n]);var r;Th(this,"isAnonymous",!(this.email&&t.passwordHash||this.providerData&&this.providerData.length)),this.dispatchEvent(new $c("userReloaded",{ed:t}))},t.Jc=function(t){return jr("firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.reauthenticateWithCredential instead."),this.pb(t)},t.pb=function(t){var e=this,n=null;return xh(this,t.c(this.a,this.uid).then(function(t){return Nh(e,t),n=kh(e,t,"reauthenticate"),e.h=null,e.reload()}).then(function(){return n}),!0)},t.Ac=function(t){return jr("firebase.User.prototype.linkAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.linkWithCredential instead."),this.mb(t)},t.mb=function(e){var n=this,r=null;return xh(this,Ah(this,e.providerId).then(function(){return n.I()}).then(function(t){return e.b(n.a,t)}).then(function(t){return r=kh(n,t,"link"),Oh(n,t)}).then(function(){return r}))},t.Bc=function(t,e){var n=this;return xh(this,Ah(this,"phone").then(function(){return qc(fh(n),t,e,m(n.mb,n))}))},t.Kc=function(t,e){var n=this;return xh(this,Ee().then(function(){return qc(fh(n),t,e,m(n.pb,n))}),!0)},t.xb=function(e){var n=this;return xh(this,this.I().then(function(t){return n.a.xb(t,e)}).then(function(t){return Nh(n,t),n.reload()}))},t.cd=function(e){var n=this;return xh(this,this.I().then(function(t){return e.b(n.a,t)}).then(function(t){return Nh(n,t),n.reload()}))},t.yb=function(e){var n=this;return xh(this,this.I().then(function(t){return n.a.yb(t,e)}).then(function(t){return Nh(n,t),n.reload()}))},t.zb=function(e){if(void 0===e.displayName&&void 0===e.photoURL)return wh(this);var n=this;return xh(this,this.I().then(function(t){return n.a.zb(t,{displayName:e.displayName,photoUrl:e.photoURL})}).then(function(t){return Nh(n,t),Th(n,"displayName",t.displayName||null),Th(n,"photoURL",t.photoUrl||null),U(n.providerData,function(t){"password"===t.providerId&&(qr(t,"displayName",n.displayName),qr(t,"photoURL",n.photoURL))}),yh(n)}).then(bh))},t.ad=function(e){var n=this;return xh(this,Ch(this).then(function(t){return B(_h(n),e)?za(n.a,ba,{idToken:t,deleteProvider:[e]}).then(function(t){var e={};return U(t.providerUserInfo||[],function(t){e[t.providerId]=!0}),U(_h(n),function(t){e[t]||Ih(n,t)}),e[Ao.PROVIDER_ID]||qr(n,"phoneNumber",null),yh(n)}):yh(n).then(function(){throw new _("no-such-provider")})}))},t.delete=function(){var e=this;return xh(this,this.I().then(function(t){return za(e.a,ma,{idToken:t})}).then(function(){e.dispatchEvent(new $c("userDeleted"))})).then(function(){for(var t=0;t<e.N.length;t++)e.N[t].cancel("app-deleted");ch(e,null),lh(e,null),e.N=[],e.D=!0,dh(e),qr(e,"refreshToken",null),e.i&&Tc(e.i,e)})},t.Cb=function(t,e){return!!("linkViaPopup"==t&&(this.g||null)==e&&this.f||"reauthViaPopup"==t&&(this.g||null)==e&&this.f||"linkViaRedirect"==t&&(this.fa||null)==e||"reauthViaRedirect"==t&&(this.fa||null)==e)},t.la=function(t,e,n,r){"linkViaPopup"!=t&&"reauthViaPopup"!=t||r!=(this.g||null)||(n&&this.w?this.w(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.w)},t.Da=function(t,e){return"linkViaPopup"==t&&e==(this.g||null)?m(this.Hb,this):"reauthViaPopup"==t&&e==(this.g||null)?m(this.Ib,this):"linkViaRedirect"==t&&(this.fa||null)==e?m(this.Hb,this):"reauthViaRedirect"==t&&(this.fa||null)==e?m(this.Ib,this):null},t.Cc=function(t){var e=this;return Ph(this,"linkViaPopup",t,function(){return Ah(e,t.providerId).then(function(){return yh(e)})},!1)},t.Lc=function(t){return Ph(this,"reauthViaPopup",t,function(){return Ee()},!0)},t.Dc=function(t){var e=this;return Rh(this,"linkViaRedirect",t,function(){return Ah(e,t.providerId)},!1)},t.Mc=function(t){return Rh(this,"reauthViaRedirect",t,function(){return Ee()},!0)},t.Hb=function(e,n,t,r){var i=this;this.c&&(this.c.cancel(),this.c=null);var o=null;return t=this.I().then(function(t){return la(i.a,{requestUri:e,postBody:r,sessionId:n,idToken:t})}).then(function(t){return o=kh(i,t,"link"),Oh(i,t)}).then(function(){return o}),xh(this,t)},t.Ib=function(t,e,n,r){var i=this;this.c&&(this.c.cancel(),this.c=null);var o=null;return xh(this,Ee().then(function(){return eo(fa(i.a,{requestUri:t,sessionId:e,postBody:r,tenantId:n}),i.uid)}).then(function(t){return o=kh(i,t,"reauthenticate"),Nh(i,t),i.h=null,i.reload()}).then(function(){return o}),!0)},t.qb=function(e){var n=this,r=null;return xh(this,this.I().then(function(t){return r=t,void 0===e||ut(e)?{}:Pi(new _i(e))}).then(function(t){return n.a.qb(r,t)}).then(function(t){if(n.email!=t)return n.reload()}).then(function(){}))},t.Ab=function(e,n){var r=this,i=null;return xh(this,this.I().then(function(t){return i=t,void 0===n||ut(n)?{}:Pi(new _i(n))}).then(function(t){return r.a.Ab(i,e,t)}).then(function(t){if(r.email!=t)return r.reload()}).then(function(){}))},t.hc=function(t){var e=null,n=this;return xh(this,t=eo(Ee(t),n.uid).then(function(t){return e=kh(n,t,"reauthenticate"),Nh(n,t),n.h=null,n.reload()}).then(function(){return e}),!0)},t.toJSON=function(){return this.v()},t.v=function(){var e={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,tenantId:this.tenantId,providerData:[],apiKey:this.l,appName:this.m,authDomain:this.s,stsTokenManager:this.b.v(),redirectEventId:this.fa||null};return this.metadata&&lt(e,this.metadata.v()),U(this.providerData,function(t){e.providerData.push(function(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}(t))}),lt(e,this.O.v()),e};var Fh={name:"redirectUser",F:"session"};function Uh(t){return zu(t.b,Fh,t.a)}function jh(t){var e,n,r,i;this.a=t,this.b=Hu(),this.c=null,this.f=(n=Bh("local"),r=Bh("session"),i=Bh("none"),function(n,r,i){var o=Gu(r,i),s=Ku(n,r.F);return n.get(r,i).then(function(t){var e=null;try{e=kr(l.localStorage.getItem(o))}catch(t){}if(e&&!t)return l.localStorage.removeItem(o),n.set(r,e,i);e&&t&&"localStorage"!=s.type&&l.localStorage.removeItem(o)})}((e=this).b,n,e.a).then(function(){return e.b.get(r,e.a)}).then(function(t){return t?r:e.b.get(i,e.a).then(function(t){return t?i:e.b.get(n,e.a).then(function(t){return t?n:e.b.get(qh,e.a).then(function(t){return t?Bh(t):n})})})}).then(function(t){return e.c=t,Vh(e,t.F)}).o(function(){e.c||(e.c=n)})),this.b.addListener(Bh("local"),this.a,m(this.g,this))}function Vh(t,e){var n,a,r=[];for(n in Bu)Bu[n]!==e&&r.push(zu(t.b,Bh(Bu[n]),t.a));return r.push(zu(t.b,qh,t.a)),a=r,new ve(function(n,e){var r=a.length,i=[];if(r)for(var t=function(t,e){r--,i[t]=e,0==r&&n(i)},o=function(t){e(t)},s=0;s<a.length;s++)Te(a[s],b(t,s),o);else n(i)})}jh.prototype.g=function(){var e=this,n=Bh("local");Gh(this,function(){return Ee().then(function(){return e.c&&"local"!=e.c.F?e.b.get(n,e.a):null}).then(function(t){if(t)return Vh(e,"local").then(function(){e.c=n})})})};var qh={name:"persistence",F:"session"};function Bh(t){return{name:"authUser",F:t}}function Wh(t,e){return Gh(t,function(){return t.b.set(t.c,e.v(),t.a)})}function Hh(t){return Gh(t,function(){return zu(t.b,t.c,t.a)})}function Kh(t,e){return Gh(t,function(){return t.b.get(t.c,t.a).then(function(t){return t&&e&&(t.authDomain=e),Lh(t||{})})})}function Gh(t,e){return t.f=t.f.then(e,e),t.f}function zh(t){if(this.l=!1,qr(this,"settings",new jc),qr(this,"app",t),!el(this).options||!el(this).options.apiKey)throw new _("invalid-api-key");var n,e,r,i,o,s,a,u;t=zl.SDK_VERSION?br(zl.SDK_VERSION):null,this.b=new Bs(el(this).options&&el(this).options.apiKey,N(I),t),this.P=[],this.m=[],this.O=[],this.$b=zl.INTERNAL.createSubscribe(m(this.xc,this)),this.W=void 0,this.ac=zl.INTERNAL.createSubscribe(m(this.yc,this)),Zh(this,null),this.i=new jh(el(this).options.apiKey+":"+el(this).name),this.B=new Mh(el(this).options.apiKey+":"+el(this).name),this.Z=ol(this,(e=el(n=this).options.authDomain,r=function(e){var t=function(t,e){return t.b.get(Fh,t.a).then(function(t){return t&&e&&(t.authDomain=e),Lh(t||{})})}(e.B,el(e).options.authDomain).then(function(t){return(e.D=t)&&(t.ga=e.B),Uh(e.B)});return ol(e,t)}(n).then(function(){return Kh(n.i,e)}).then(function(e){return e?(e.ga=n.B,n.D&&(n.D.fa||null)==(e.fa||null)?e:e.reload().then(function(){return Wh(n.i,e).then(function(){return e})}).o(function(t){return"auth/network-request-failed"==t.code?e:Hh(n.i)})):null}).then(function(t){Zh(n,t||null)}),ol(n,r))),this.h=ol(this,(i=this).Z.then(function(){return $h(i)}).o(function(){}).then(function(){if(!i.l)return i.oa()}).o(function(){}).then(function(){if(!i.l){i.aa=!0;var t=i.i;t.b.addListener(Bh("local"),t.a,i.oa)}})),this.aa=!1,this.oa=m(this.Xc,this),this.Ma=m(this.ca,this),this.xa=m(this.jc,this),this.ya=m(this.uc,this),this.za=m(this.vc,this),this.a=null,s=el(o=this).options.authDomain,a=el(o).options.apiKey,s&&Ir()&&(o.Zb=o.Z.then(function(){if(!o.l){if(o.a=Rc(s,a,el(o).name),Ic(o.a,o),nl(o)&&gh(nl(o)),o.D){gh(o.D);var t=o.D;t.va(o.ja()),ch(t,o),hh(t=o.D,o.N),lh(t,o),o.D=null}return o.a}})),this.INTERNAL={},this.INTERNAL.delete=m(this.delete,this),this.INTERNAL.logFramework=m(this.Ec,this),this.s=0,dn.call(this),u=this,Object.defineProperty(u,"lc",{get:function(){return this.ja()},set:function(t){this.va(t)},enumerable:!1}),u.$=null,Object.defineProperty(u,"ti",{get:function(){return this.S()},set:function(t){this.ub(t)},enumerable:!1}),u.R=null,this.N=[]}function Qh(t){We.call(this,"languageCodeChanged"),this.g=t}function Xh(t){We.call(this,"frameworkChanged"),this.c=t}function Yh(t){return t.Zb||Ie(new _("auth-domain-config-required"))}function $h(t){if(!Ir())return Ie(new _("operation-not-supported-in-this-environment"));var e=Yh(t).then(function(){return t.a.pa()}).then(function(t){return t?Wr(t):null});return ol(t,e)}function Jh(o,s){var a={};return a.apiKey=el(o).options.apiKey,a.authDomain=el(o).options.authDomain,a.appName=el(o).name,o.Z.then(function(){return t=a,e=s,n=o.B,r=o.Ea(),i=new uh(t,e),n&&(i.ga=n),r&&hh(i,r),i.reload().then(function(){return i});var t,e,n,r,i}).then(function(t){return nl(o)&&t.uid==nl(o).uid?Sh(nl(o),t):(Zh(o,t),gh(t)),o.ca(t)}).then(function(){il(o)})}function Zh(t,e){var n,r;nl(t)&&(n=nl(t),r=t.Ma,H(n.R,function(t){return t==r}),on(nl(t),"tokenChanged",t.xa),on(nl(t),"userDeleted",t.ya),on(nl(t),"userInvalidated",t.za),dh(nl(t))),e&&(e.R.push(t.Ma),en(e,"tokenChanged",t.xa),en(e,"userDeleted",t.ya),en(e,"userInvalidated",t.za),0<t.s&&ph(e)),qr(t,"currentUser",e),e&&(e.va(t.ja()),ch(e,t),hh(e,t.N),lh(e,t))}function tl(n,t){var e=null,r=null;return ol(n,t.then(function(t){return e=Oo(t),r=qi(t),Jh(n,t)},function(t){var e=null;throw t&&"auth/multi-factor-auth-required"===t.code&&(e=zc(t.v(),n,m(n.ic,n))),e||t}).then(function(){return Wr({user:nl(n),credential:e,additionalUserInfo:r,operationType:"signIn"})}))}function el(t){return t.app}function nl(t){return t.currentUser}function rl(t){return nl(t)&&nl(t)._lat||null}function il(t){if(t.aa){for(var e=0;e<t.m.length;e++)t.m[e]&&t.m[e](rl(t));if(t.W!==t.getUid()&&t.O.length)for(t.W=t.getUid(),e=0;e<t.O.length;e++)t.O[e]&&t.O[e](rl(t))}}function ol(t,e){return t.P.push(e),e.ma(function(){W(t.P,e)}),e}function sl(){}function al(){this.a={},this.b=1e12}jh.prototype.tb=function(e){var n=null,r=this;return function(t){var e=new _("invalid-persistence-type"),n=new _("unsupported-persistence-type");t:{for(r in Bu)if(Bu[r]==t){var r=!0;break t}r=!1}if(!r||"string"!=typeof t)throw e;switch(pr()){case"ReactNative":if("session"===t)throw n;break;case"Node":if("none"!==t)throw n;break;case"Worker":if("session"===t||!_u()&&"none"!==t)throw n;break;default:if(!Er()&&"none"!==t)throw n}}(e),Gh(this,function(){return e!=r.c.F?r.b.get(r.c,r.a).then(function(t){return n=t,Vh(r,e)}).then(function(){if(r.c=Bh(e),n)return r.b.set(r.c,n,r.a)}):Ee()})},e(zh,dn),e(Qh,We),e(Xh,We),(t=zh.prototype).tb=function(t){return t=this.i.tb(t),ol(this,t)},t.va=function(t){this.$===t||this.l||(this.$=t,Xs(this.b,this.$),this.dispatchEvent(new Qh(this.ja())))},t.ja=function(){return this.$},t.dd=function(){var t=l.navigator;this.va(t&&(t.languages&&t.languages[0]||t.language||t.userLanguage)||null)},t.Ec=function(t){this.N.push(t),Ys(this.b,zl.SDK_VERSION?br(zl.SDK_VERSION,this.N):null),this.dispatchEvent(new Xh(this.N))},t.Ea=function(){return G(this.N)},t.ub=function(t){this.R===t||this.l||(this.R=t,this.b.b=this.R)},t.S=function(){return this.R},t.toJSON=function(){return{apiKey:el(this).options.apiKey,authDomain:el(this).options.authDomain,appName:el(this).name,currentUser:nl(this)&&nl(this).v()}},t.Cb=function(t,e){switch(t){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==e&&!!this.f;default:return!1}},t.la=function(t,e,n,r){"signInViaPopup"==t&&this.g==r&&(n&&this.w?this.w(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.w)},t.Da=function(t,e){return"signInViaRedirect"==t||"signInViaPopup"==t&&this.g==e&&this.f?m(this.gc,this):null},t.gc=function(t,e,n,r){var i=this,o={requestUri:t,postBody:r,sessionId:e,tenantId:n};return this.c&&(this.c.cancel(),this.c=null),i.Z.then(function(){return tl(i,ha(i.b,o))})},t.Vc=function(e){if(!Ir())return Ie(new _("operation-not-supported-in-this-environment"));var n=this,t=Vi(e.providerId),r=Or(),i=null;(!Cr()||lr())&&el(this).options.authDomain&&e.isOAuthProvider&&(i=uu(el(this).options.authDomain,el(this).options.apiKey,el(this).name,"signInViaPopup",e,null,r,zl.SDK_VERSION||null,null,null,this.S()));var o=sr(i,t&&t.ta,t&&t.sa);return ol(this,t=Yh(this).then(function(t){return Nc(t,o,"signInViaPopup",e,r,!!i,n.S())}).then(function(){return new ve(function(t,e){n.la("signInViaPopup",null,new _("cancelled-popup-request"),n.g),n.f=t,n.w=e,n.g=r,n.c=Oc(n.a,n,"signInViaPopup",o,r)})}).then(function(t){return o&&or(o),t?Wr(t):null}).o(function(t){throw o&&or(o),t}))},t.Wc=function(t){if(!Ir())return Ie(new _("operation-not-supported-in-this-environment"));var e=this;return ol(this,Yh(this).then(function(){return Gh(t=e.i,function(){return t.b.set(qh,t.c.F,t.a)});var t}).then(function(){return kc(e.a,"signInViaRedirect",t,void 0,e.S())}))},t.pa=function(){var e=this;return $h(this).then(function(t){return e.a&&Lc(e.a.b),t}).o(function(t){throw e.a&&Lc(e.a.b),t})},t.bd=function(t){if(!t)return Ie(new _("null-user"));if(this.R!=t.tenantId)return Ie(new _("tenant-id-mismatch"));var e=this,n={};n.apiKey=el(this).options.apiKey,n.authDomain=el(this).options.authDomain,n.appName=el(this).name;var r,i,o,s,a,u,c=(r=t,i=n,o=e.B,s=e.Ea(),a=r.b,(u={})[Hs]=a.b&&a.b.toString(),u.refreshToken=a.a,i=new uh(i||{apiKey:r.l,authDomain:r.s,appName:r.m},u),o&&(i.ga=o),s&&hh(i,s),Sh(i,r),i);return ol(this,this.h.then(function(){if(el(e).options.apiKey!=t.l)return c.reload()}).then(function(){return nl(e)&&t.uid==nl(e).uid?(Sh(nl(e),t),e.ca(t)):(Zh(e,c),gh(c),e.ca(c))}).then(function(){il(e)}))},t.wb=function(){var t=this,e=this.h.then(function(){return t.a&&Lc(t.a.b),nl(t)?(Zh(t,null),Hh(t.i).then(function(){il(t)})):Ee()});return ol(this,e)},t.Xc=function(){var r=this;return Kh(this.i,el(this).options.authDomain).then(function(t){if(!r.l){var e;if(e=nl(r)&&t){e=nl(r).uid;var n=t.uid;e=null!=e&&""!==e&&null!=n&&""!==n&&e==n}if(e)return Sh(nl(r),t),nl(r).I();(nl(r)||t)&&(Zh(r,t),t&&(gh(t),t.ga=r.B),r.a&&Ic(r.a,r),il(r))}})},t.ca=function(t){return Wh(this.i,t)},t.jc=function(){il(this),this.ca(nl(this))},t.uc=function(){this.wb()},t.vc=function(){this.wb()},t.ic=function(t){var e=this;return this.h.then(function(){return tl(e,Ee(t))})},t.xc=function(t){var e=this;this.addAuthTokenListener(function(){t.next(nl(e))})},t.yc=function(t){var e,n,r=this;n=function(){t.next(nl(r))},(e=this).O.push(n),ol(e,e.h.then(function(){!e.l&&B(e.O,n)&&e.W!==e.getUid()&&(e.W=e.getUid(),n(rl(e)))}))},t.Gc=function(t,e,n){var r=this;return this.aa&&Promise.resolve().then(function(){"function"==typeof t?t(nl(r)):"function"==typeof t.next&&t.next(nl(r))}),this.$b(t,e,n)},t.Fc=function(t,e,n){var r=this;return this.aa&&Promise.resolve().then(function(){r.W=r.getUid(),"function"==typeof t?t(nl(r)):"function"==typeof t.next&&t.next(nl(r))}),this.ac(t,e,n)},t.kc=function(t){var e=this,n=this.h.then(function(){return nl(e)?nl(e).I(t).then(function(t){return{accessToken:t}}):null});return ol(this,n)},t.Rc=function(t){var n=this;return this.h.then(function(){return tl(n,za(n.b,qa,{token:t}))}).then(function(t){var e=t.user;return Th(e,"isAnonymous",!1),n.ca(e),t})},t.Sc=function(t,e){var n=this;return this.h.then(function(){return tl(n,za(n.b,Ba,{email:t,password:e}))})},t.cc=function(t,e){var n=this;return this.h.then(function(){return tl(n,za(n.b,ya,{email:t,password:e}))})},t.Ya=function(t){var e=this;return this.h.then(function(){return tl(e,t.ia(e.b))})},t.Qc=function(t){return jr("firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential is deprecated. Please use firebase.auth.Auth.prototype.signInWithCredential instead."),this.Ya(t)},t.vb=function(){var n=this;return this.h.then(function(){var t=nl(n);if(t&&t.isAnonymous){var e=Wr({providerId:null,isNewUser:!1});return Wr({user:t,credential:null,additionalUserInfo:e,operationType:"signIn"})}return tl(n,n.b.vb()).then(function(t){var e=t.user;return Th(e,"isAnonymous",!0),n.ca(e),t})})},t.getUid=function(){return nl(this)&&nl(this).uid||null},t.bc=function(t){this.addAuthTokenListener(t),this.s++,0<this.s&&nl(this)&&ph(nl(this))},t.Nc=function(e){var n=this;U(this.m,function(t){t==e&&n.s--}),this.s<0&&(this.s=0),0==this.s&&nl(this)&&dh(nl(this)),this.removeAuthTokenListener(e)},t.addAuthTokenListener=function(t){var e=this;this.m.push(t),ol(this,this.h.then(function(){e.l||B(e.m,t)&&t(rl(e))}))},t.removeAuthTokenListener=function(e){H(this.m,function(t){return t==e})},t.delete=function(){this.l=!0;for(var t=0;t<this.P.length;t++)this.P[t].cancel("app-deleted");return this.P=[],this.i&&(t=this.i).b.removeListener(Bh("local"),t.a,this.oa),this.a&&(Tc(this.a,this),Lc(this.a.b)),Promise.resolve()},t.fc=function(t){return ol(this,za(this.b,ga,{identifier:t,continueUri:Tr()?nr():"http://localhost"}).then(function(t){return t.signinMethods||[]}))},t.zc=function(t){return!!To(t)},t.sb=function(e,n){var r=this;return ol(this,Ee().then(function(){var t=new _i(n);if(!t.c)throw new _("argument-error",Ti+" must be true when sending sign in link to email");return Pi(t)}).then(function(t){return r.b.sb(e,t)}).then(function(){}))},t.fd=function(t){return this.Pa(t).then(function(t){return t.data.email})},t.jb=function(t,e){return ol(this,this.b.jb(t,e).then(function(){}))},t.Pa=function(t){return ol(this,this.b.Pa(t).then(function(t){return new Jr(t)}))},t.fb=function(t){return ol(this,this.b.fb(t).then(function(){}))},t.rb=function(e,t){var n=this;return ol(this,Ee().then(function(){return void 0===t||ut(t)?{}:Pi(new _i(t))}).then(function(t){return n.b.rb(e,t)}).then(function(){}))},t.Uc=function(t,e){return ol(this,qc(this,t,e,m(this.Ya,this)))},t.Tc=function(n,r){var i=this;return ol(this,Ee().then(function(){var t=r||nr(),e=Io(n,t);if(!(t=To(t)))throw new _("argument-error","Invalid email link!");if(t.tenantId!==i.S())throw new _("tenant-id-mismatch");return i.Ya(e)}))},sl.prototype.render=function(){},sl.prototype.reset=function(){},sl.prototype.getResponse=function(){},sl.prototype.execute=function(){};var ul=null;function cl(t,e){return(e=hl(e))&&t.a[e]||null}function hl(t){return(t=void 0===t?1e12:t)?t.toString():null}function ll(t,e){this.g=!1,this.c=e,this.a=this.b=null,this.h="invisible"!==this.c.size,this.f=ee(t);var n=this;this.i=function(){n.execute()},this.h?this.execute():en(this.f,"click",this.i)}function fl(t){if(t.g)throw Error("reCAPTCHA mock was already deleted!")}function pl(){}function dl(){}al.prototype.render=function(t,e){return this.a[this.b.toString()]=new ll(t,e),this.b++},al.prototype.reset=function(t){var e=cl(this,t);t=hl(t),e&&t&&(e.delete(),delete this.a[t])},al.prototype.getResponse=function(t){return(t=cl(this,t))?t.getResponse():null},al.prototype.execute=function(t){(t=cl(this,t))&&t.execute()},ll.prototype.getResponse=function(){return fl(this),this.b},ll.prototype.execute=function(){fl(this);var n=this;this.a||(this.a=setTimeout(function(){n.b=function(){for(var t=50,e=[];0<t;)e.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),t--;return e.join("")}();var t=n.c.callback,e=n.c["expired-callback"];if(t)try{t(n.b)}catch(t){}n.a=setTimeout(function(){if(n.a=null,n.b=null,e)try{e()}catch(t){}n.h&&n.execute()},6e4)},500))},ll.prototype.delete=function(){fl(this),this.g=!0,clearTimeout(this.a),this.a=null,on(this.f,"click",this.i)},qr(pl,"FACTOR_ID","phone"),dl.prototype.g=function(){return Ee(ul=ul||new al)},dl.prototype.c=function(){};var vl=null;function yl(){this.b=l.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var gl=new pt(yt,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),ml=new Dr(3e4,6e4);yl.prototype.g=function(i){var o=this;return new ve(function(t,e){var r=setTimeout(function(){e(new _("network-request-failed"))},ml.get());!l.grecaptcha||i!==o.f&&!o.b?(l[o.a]=function(){if(l.grecaptcha){o.f=i;var n=l.grecaptcha.render;l.grecaptcha.render=function(t,e){return t=n(t,e),o.b++,t},clearTimeout(r),t(l.grecaptcha)}else clearTimeout(r),e(new _("internal-error"));delete l[o.a]},Ee(Ls(wt(gl,{onload:o.a,hl:i||""}))).o(function(){clearTimeout(r),e(new _("internal-error","Unable to load external reCAPTCHA dependencies!"))})):(clearTimeout(r),t(l.grecaptcha))})},yl.prototype.c=function(){this.b--};var bl=null;function wl(t,e,n,r,i,o,s){if(qr(this,"type","recaptcha"),this.c=this.f=null,this.D=!1,this.u=e,this.g=null,s=s?vl=vl||new dl:bl=bl||new yl,this.m=s,this.a=n||{theme:"light",type:"image"},this.h=[],this.a[Il])throw new _("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i="invisible"===this.a[Tl],!l.document)throw new _("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!ee(e)||!this.i&&ee(e).hasChildNodes())throw new _("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.s=new Bs(t,o||null,i||null),this.w=r||function(){return null};var a=this;this.l=[];var u=this.a[_l];this.a[_l]=function(t){if(Sl(a,t),"function"==typeof u)u(t);else if("string"==typeof u){var e=_r(u,l);"function"==typeof e&&e(t)}};var c=this.a[El];this.a[El]=function(){if(Sl(a,null),"function"==typeof c)c();else if("string"==typeof c){var t=_r(c,l);"function"==typeof t&&t()}}}var _l="callback",El="expired-callback",Il="sitekey",Tl="size";function Sl(t,e){for(var n=0;n<t.l.length;n++)try{t.l[n](e)}catch(t){}}function Cl(t,e){return t.h.push(e),e.ma(function(){W(t.h,e)}),e}function Nl(t){if(t.D)throw new _("internal-error","RecaptchaVerifier instance has been destroyed.")}function Al(t,e,n){var r=!1;try{this.b=n||zl.app()}catch(t){throw new _("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.b.options||!this.b.options.apiKey)throw new _("invalid-api-key");n=this.b.options.apiKey;var i=this,o=null;try{o=this.b.auth().Ea()}catch(t){}try{r=this.b.auth().settings.appVerificationDisabledForTesting}catch(t){}o=zl.SDK_VERSION?br(zl.SDK_VERSION,o):null,wl.call(this,n,t,e,function(){try{var e=i.b.auth().ja()}catch(t){e=null}return e},o,N(I),r)}function kl(t,e,n,r){t:{n=Array.prototype.slice.call(n);for(var i=0,o=!1,s=0;s<e.length;s++)if(e[s].optional)o=!0;else{if(o)throw new _("internal-error","Argument validator encountered a required argument after an optional argument.");i++}if(o=e.length,n.length<i||o<n.length)r="Expected "+(i==o?1==i?"1 argument":i+" arguments":i+"-"+o+" arguments")+" but got "+n.length+".";else{for(i=0;i<n.length;i++)if(o=e[i].optional&&void 0===n[i],!e[i].K(n[i])&&!o){if(e=e[i],i<0||i>=Ol.length)throw new _("internal-error","Argument validator received an unsupported number of arguments.");n=Ol[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.J+".";break t}r=null}}if(r)throw new _("argument-error",t+" failed: "+r)}(t=wl.prototype).Ga=function(){var e=this;return this.f?this.f:this.f=Cl(this,Ee().then(function(){if(Tr()&&!fr())return cr();throw new _("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return e.m.g(e.w())}).then(function(t){return e.g=t,za(e.s,Oa,{})}).then(function(t){e.a[Il]=t.recaptchaSiteKey}).o(function(t){throw e.f=null,t}))},t.render=function(){Nl(this);var n=this;return Cl(this,this.Ga().then(function(){if(null===n.c){var t=n.u;if(!n.i){var e=ee(t);t=se("DIV"),e.appendChild(t)}n.c=n.g.render(t,n.a)}return n.c}))},t.verify=function(){Nl(this);var i=this;return Cl(this,this.render().then(function(e){return new ve(function(n){var t=i.g.getResponse(e);if(t)n(t);else{var r=function(t){var e;t&&(e=r,H(i.l,function(t){return t==e}),n(t))};i.l.push(r),i.i&&i.g.execute(i.c)}})}))},t.reset=function(){Nl(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){Nl(this),this.D=!0,this.m.c();for(var t=0;t<this.h.length;t++)this.h[t].cancel("RecaptchaVerifier instance has been destroyed.");if(!this.i){t=ee(this.u);for(var e;e=t.firstChild;)t.removeChild(e)}},e(Al,wl);var Ol="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Pl(t,e){return{name:t||"",J:"a valid string",optional:!!e,K:function(t){return"string"==typeof t}}}function Rl(t,e){return{name:t||"",J:"a boolean",optional:!!e,K:function(t){return"boolean"==typeof t}}}function Dl(t,e){return{name:t||"",J:"a valid object",optional:!!e,K:v}}function xl(t,e){return{name:t||"",J:"a function",optional:!!e,K:function(t){return"function"==typeof t}}}function Ll(t,e){return{name:t||"",J:"null",optional:!!e,K:function(t){return null===t}}}function Ml(n){return{name:n?n+"Credential":"credential",J:n?"a valid "+n+" credential":"a valid credential",optional:!1,K:function(t){if(!t)return!1;var e=!n||t.providerId===n;return!(!t.ia||!e)}}}function Fl(){return{name:"multiFactorAssertion",J:"a valid multiFactorAssertion",optional:!1,K:function(t){return!!t&&!!t.ob}}}function Ul(){return{name:"authProvider",J:"a valid Auth provider",optional:!1,K:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}}function jl(t,e){return v(t)&&"string"==typeof t.type&&t.type===e&&"function"==typeof t.Fa}function Vl(t){return v(t)&&"string"==typeof t.uid}function ql(){return{name:"applicationVerifier",J:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,K:function(t){return!(!t||"string"!=typeof t.type||"function"!=typeof t.verify)}}}function Bl(e,n,t,r){return{name:t||"",J:e.J+" or "+n.J,optional:!!r,K:function(t){return e.K(t)||n.K(t)}}}function Wl(t,e){for(var n in e){var r=e[n].name;t[r]=Gl(r,t[n],e[n].j)}}function Hl(t,e){for(var n in e){var r=e[n].name;r!==n&&Object.defineProperty(t,r,{get:b(function(t){return this[t]},n),set:b(function(t,e,n,r){kl(t,[n],[r],!0),this[e]=r},r,n,e[n].gb),enumerable:!0})}}function Kl(t,e,n,r){t[e]=Gl(e,n,r)}function Gl(t,e,n){function r(){var t=Array.prototype.slice.call(arguments);return kl(s,n,t),e.apply(this,t)}if(!n)return e;var i,o,s=(o=(o=t).split("."))[o.length-1];for(i in e)r[i]=e[i];for(i in e.prototype)r.prototype[i]=e.prototype[i];return r}Wl(zh.prototype,{fb:{name:"applyActionCode",j:[Pl("code")]},Pa:{name:"checkActionCode",j:[Pl("code")]},jb:{name:"confirmPasswordReset",j:[Pl("code"),Pl("newPassword")]},cc:{name:"createUserWithEmailAndPassword",j:[Pl("email"),Pl("password")]},fc:{name:"fetchSignInMethodsForEmail",j:[Pl("email")]},pa:{name:"getRedirectResult",j:[]},zc:{name:"isSignInWithEmailLink",j:[Pl("emailLink")]},Fc:{name:"onAuthStateChanged",j:[Bl(Dl(),xl(),"nextOrObserver"),xl("opt_error",!0),xl("opt_completed",!0)]},Gc:{name:"onIdTokenChanged",j:[Bl(Dl(),xl(),"nextOrObserver"),xl("opt_error",!0),xl("opt_completed",!0)]},rb:{name:"sendPasswordResetEmail",j:[Pl("email"),Bl(Dl("opt_actionCodeSettings",!0),Ll(null,!0),"opt_actionCodeSettings",!0)]},sb:{name:"sendSignInLinkToEmail",j:[Pl("email"),Dl("actionCodeSettings")]},tb:{name:"setPersistence",j:[Pl("persistence")]},Qc:{name:"signInAndRetrieveDataWithCredential",j:[Ml()]},vb:{name:"signInAnonymously",j:[]},Ya:{name:"signInWithCredential",j:[Ml()]},Rc:{name:"signInWithCustomToken",j:[Pl("token")]},Sc:{name:"signInWithEmailAndPassword",j:[Pl("email"),Pl("password")]},Tc:{name:"signInWithEmailLink",j:[Pl("email"),Pl("emailLink",!0)]},Uc:{name:"signInWithPhoneNumber",j:[Pl("phoneNumber"),ql()]},Vc:{name:"signInWithPopup",j:[Ul()]},Wc:{name:"signInWithRedirect",j:[Ul()]},bd:{name:"updateCurrentUser",j:[Bl({name:"user",J:"an instance of Firebase User",optional:!1,K:function(t){return!!(t&&t instanceof uh)}},Ll(),"user")]},wb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[Pl(null,!0)]},dd:{name:"useDeviceLanguage",j:[]},fd:{name:"verifyPasswordResetCode",j:[Pl("code")]}}),Hl(zh.prototype,{lc:{name:"languageCode",gb:Bl(Pl(),Ll(),"languageCode")},ti:{name:"tenantId",gb:Bl(Pl(),Ll(),"tenantId")}}),(zh.Persistence=Bu).LOCAL="local",zh.Persistence.SESSION="session",zh.Persistence.NONE="none",Wl(uh.prototype,{delete:{name:"delete",j:[]},mc:{name:"getIdTokenResult",j:[Rl("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[Rl("opt_forceRefresh",!0)]},Ac:{name:"linkAndRetrieveDataWithCredential",j:[Ml()]},mb:{name:"linkWithCredential",j:[Ml()]},Bc:{name:"linkWithPhoneNumber",j:[Pl("phoneNumber"),ql()]},Cc:{name:"linkWithPopup",j:[Ul()]},Dc:{name:"linkWithRedirect",j:[Ul()]},Jc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[Ml()]},pb:{name:"reauthenticateWithCredential",j:[Ml()]},Kc:{name:"reauthenticateWithPhoneNumber",j:[Pl("phoneNumber"),ql()]},Lc:{name:"reauthenticateWithPopup",j:[Ul()]},Mc:{name:"reauthenticateWithRedirect",j:[Ul()]},reload:{name:"reload",j:[]},qb:{name:"sendEmailVerification",j:[Bl(Dl("opt_actionCodeSettings",!0),Ll(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Pl(null,!0)]},ad:{name:"unlink",j:[Pl("provider")]},xb:{name:"updateEmail",j:[Pl("email")]},yb:{name:"updatePassword",j:[Pl("password")]},cd:{name:"updatePhoneNumber",j:[Ml("phone")]},zb:{name:"updateProfile",j:[Dl("profile")]},Ab:{name:"verifyBeforeUpdateEmail",j:[Pl("email"),Bl(Dl("opt_actionCodeSettings",!0),Ll(null,!0),"opt_actionCodeSettings",!0)]}}),Wl(al.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Wl(sl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Wl(ve.prototype,{ma:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),Hl(jc.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",gb:Rl("appVerificationDisabledForTesting")}}),Wl(Vc.prototype,{confirm:{name:"confirm",j:[Pl("verificationCode")]}}),Kl(to,"fromJSON",function(t){t="string"==typeof t?JSON.parse(t):t;for(var e,n=[ao,_o,Co,io],r=0;r<n.length;r++)if(e=n[r](t))return e;return null},[Bl(Pl(),Dl(),"json")]),Kl(Eo,"credential",function(t,e){return new wo(t,e)},[Pl("email"),Pl("password")]),Wl(wo.prototype,{v:{name:"toJSON",j:[Pl(null,!0)]}}),Wl(lo.prototype,{Aa:{name:"addScope",j:[Pl("scope")]},Ia:{name:"setCustomParameters",j:[Dl("customOAuthParameters")]}}),Kl(lo,"credential",fo,[Bl(Pl(),Dl(),"token")]),Kl(Eo,"credentialWithLink",Io,[Pl("email"),Pl("emailLink")]),Wl(po.prototype,{Aa:{name:"addScope",j:[Pl("scope")]},Ia:{name:"setCustomParameters",j:[Dl("customOAuthParameters")]}}),Kl(po,"credential",vo,[Bl(Pl(),Dl(),"token")]),Wl(yo.prototype,{Aa:{name:"addScope",j:[Pl("scope")]},Ia:{name:"setCustomParameters",j:[Dl("customOAuthParameters")]}}),Kl(yo,"credential",go,[Bl(Pl(),Bl(Dl(),Ll()),"idToken"),Bl(Pl(),Ll(),"accessToken",!0)]),Wl(mo.prototype,{Ia:{name:"setCustomParameters",j:[Dl("customOAuthParameters")]}}),Kl(mo,"credential",bo,[Bl(Pl(),Dl(),"token"),Pl("secret",!0)]),Wl(ho.prototype,{Aa:{name:"addScope",j:[Pl("scope")]},credential:{name:"credential",j:[Bl(Pl(),Bl(Dl(),Ll()),"optionsOrIdToken"),Bl(Pl(),Ll(),"accessToken",!0)]},Ia:{name:"setCustomParameters",j:[Dl("customOAuthParameters")]}}),Wl(oo.prototype,{v:{name:"toJSON",j:[Pl(null,!0)]}}),Wl(no.prototype,{v:{name:"toJSON",j:[Pl(null,!0)]}}),Kl(Ao,"credential",ko,[Pl("verificationId"),Pl("verificationCode")]),Wl(Ao.prototype,{cb:{name:"verifyPhoneNumber",j:[Bl(Pl(),{name:"phoneInfoOptions",J:"valid phone info options",optional:!1,K:function(t){return!!t&&(t.session&&t.phoneNumber?jl(t.session,Ji)&&"string"==typeof t.phoneNumber:t.session&&t.multiFactorHint?jl(t.session,Zi)&&Vl(t.multiFactorHint):t.session&&t.multiFactorUid?jl(t.session,Zi)&&"string"==typeof t.multiFactorUid:!!t.phoneNumber&&"string"==typeof t.phoneNumber)}},"phoneInfoOptions"),ql()]}}),Wl(So.prototype,{v:{name:"toJSON",j:[Pl(null,!0)]}}),Wl(_.prototype,{toJSON:{name:"toJSON",j:[Pl(null,!0)]}}),Wl(Uo.prototype,{toJSON:{name:"toJSON",j:[Pl(null,!0)]}}),Wl(Fo.prototype,{toJSON:{name:"toJSON",j:[Pl(null,!0)]}}),Wl(Gc.prototype,{toJSON:{name:"toJSON",j:[Pl(null,!0)]}}),Wl(Wc.prototype,{Pc:{name:"resolveSignIn",j:[Fl()]}}),Wl(Jc.prototype,{Ob:{name:"getSession",j:[]},dc:{name:"enroll",j:[Fl(),Pl("displayName",!0)]},$c:{name:"unenroll",j:[Bl({name:"multiFactorInfo",J:"a valid multiFactorInfo",optional:!1,K:Vl},Pl(),"multiFactorInfoIdentifier")]}}),Wl(Al.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),Kl(fi,"parseLink",wi,[Pl("link")]),Kl(pl,"assertion",function(t){return new Yc(t)},[Ml("phone")]),function(){if(void 0===zl||!zl.INTERNAL||!zl.INTERNAL.registerComponent)throw Error("Cannot find the firebase namespace; be sure to include firebase-app.js before this library.");var t={ActionCodeInfo:{Operation:{EMAIL_SIGNIN:ti,PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:Zr,VERIFY_AND_CHANGE_EMAIL:ei,VERIFY_EMAIL:"VERIFY_EMAIL"}},Auth:zh,AuthCredential:to,Error:_};Kl(t,"EmailAuthProvider",Eo,[]),Kl(t,"FacebookAuthProvider",lo,[]),Kl(t,"GithubAuthProvider",po,[]),Kl(t,"GoogleAuthProvider",yo,[]),Kl(t,"TwitterAuthProvider",mo,[]),Kl(t,"OAuthProvider",ho,[Pl("providerId")]),Kl(t,"SAMLAuthProvider",co,[Pl("providerId")]),Kl(t,"PhoneAuthProvider",Ao,[{name:"auth",J:"an instance of Firebase Auth",optional:!0,K:function(t){return!!(t&&t instanceof zh)}}]),Kl(t,"RecaptchaVerifier",Al,[Bl(Pl(),{name:"",J:"an HTML element",optional:!1,K:function(t){return!!(t&&t instanceof Element)}},"recaptchaContainer"),Dl("recaptchaParameters",!0),{name:"app",J:"an instance of Firebase App",optional:!0,K:function(t){return!!(t&&t instanceof zl.app.App)}}]),Kl(t,"ActionCodeURL",fi,[]),Kl(t,"PhoneMultiFactorGenerator",pl,[]),zl.INTERNAL.registerComponent({name:"auth",instanceFactory:function(t){return new zh(t=t.getProvider("app").getImmediate())},multipleInstances:!1,serviceProps:t,instantiationMode:"LAZY",type:"PUBLIC"}),zl.INTERNAL.registerComponent({name:"auth-internal",instanceFactory:function(t){return{getUid:m((t=t.getProvider("auth").getImmediate()).getUid,t),getToken:m(t.kc,t),addAuthTokenListener:m(t.bc,t),removeAuthTokenListener:m(t.Nc,t)}},multipleInstances:!1,instantiationMode:"LAZY",type:"PRIVATE"}),zl.registerVersion("@firebase/auth","0.14.9"),zl.INTERNAL.extendNamespace({User:uh})}()}).apply("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var eu=(nu.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),ta(e))},nu.prototype.get=function(t){var e=this.domStorage_.getItem(this.prefixedName_(t));return null==e?null:Zs(e)},nu.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},nu.prototype.prefixedName_=function(t){return this.prefix_+t},nu.prototype.toString=function(){return this.domStorage_.toString()},nu);function nu(t){this.domStorage_=t,this.prefix_="firebase:"}var ru=(iu.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},iu.prototype.get=function(t){return na(this.cache_,t)?this.cache_[t]:null},iu.prototype.remove=function(t){delete this.cache_[t]},iu);function iu(){this.cache_={},this.isInMemoryStorage=!0}function ou(t){try{if("undefined"!=typeof window&&void 0!==window[t]){var e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new eu(e)}}catch(t){}return new ru}function su(t){var e=function(t){for(var e=[],n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);if(55296<=i&&i<=56319){var o=i-55296;Ds(++r<t.length,"Surrogate pair missing trail surrogate."),i=65536+(o<<10)+(t.charCodeAt(r)-56320)}i<128?e[n++]=i:(i<2048?e[n++]=i>>6|192:(i<65536?e[n++]=i>>12|224:(e[n++]=i>>18|240,e[n++]=i>>12&63|128),e[n++]=i>>6&63|128),e[n++]=63&i|128)}return e}(t),n=new sa;n.update(e);var r=n.digest();return Ls.encodeByteArray(r)}function au(t,e){Ds(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(wu.logLevel=Ca.VERBOSE,Iu=wu.log.bind(wu),e&&bu.set("logging_enabled",!0)):"function"==typeof t?Iu=t:(Iu=null,bu.remove("logging_enabled"))}function uu(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!0===Tu&&(Tu=!1,null===Iu&&!0===bu.get("logging_enabled")&&au(!0)),Iu){var n=Eu.apply(null,t);Iu(n)}}function cu(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];uu.apply(void 0,As([n],t))}}function hu(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE INTERNAL ERROR: "+Eu.apply(void 0,As(t));wu.error(n)}function lu(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE FATAL ERROR: "+Eu.apply(void 0,As(t));throw wu.error(n),new Error(n)}function fu(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE WARNING: "+Eu.apply(void 0,As(t));wu.warn(n)}function pu(t){return"number"==typeof t&&(t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)}function du(t,e){return t===e?0:t<e?-1:1}function vu(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+ta(e))}function yu(t,e){var n=t.length;if(n<=e)return[t];for(var r=[],i=0;i<n;i+=e)n<i+e?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r}var gu,mu=ou("localStorage"),bu=ou("sessionStorage"),wu=new xa("@firebase/database"),_u=(gu=1,function(){return gu++}),Eu=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n="",r=0;r<t.length;r++){var i=t[r];Array.isArray(i)||i&&"object"==typeof i&&"number"==typeof i.length?n+=Eu.apply(null,i):n+="object"==typeof i?ta(i):i,n+=" "}return n},Iu=null,Tu=!0,Su="[MIN_NAME]",Cu="[MAX_NAME]",Nu=function(t,e){if(t===e)return 0;if(t===Su||e===Cu)return-1;if(e===Su||t===Cu)return 1;var n=xu(t),r=xu(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null===r&&t<e?-1:1},Au=function(t){if("object"!=typeof t||null===t)return ta(t);var e=[];for(var n in t)e.push(n);e.sort();for(var r="{",i=0;i<e.length;i++)0!==i&&(r+=","),r+=ta(e[i]),r+=":",r+=Au(t[e[i]]);return r+="}"};function ku(t,e){for(var n in t)t.hasOwnProperty(n)&&e(n,t[n])}function Ou(t){var e,n,r,i,o;Ds(!pu(t),"Invalid JSON number"),0===t?e=1/t==-1/(r=n=0)?1:0:(e=t<0,r=(t=Math.abs(t))>=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023))+1023,Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,Math.round(t/Math.pow(2,-1074))));var s=[];for(o=52;o;--o)s.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;--o)s.push(n%2?1:0),n=Math.floor(n/2);s.push(e?1:0),s.reverse();var a=s.join(""),u="";for(o=0;o<64;o+=8){var c=parseInt(a.substr(o,8),2).toString(16);1===c.length&&(c="0"+c),u+=c}return u.toLowerCase()}function Pu(t){try{t()}catch(e){setTimeout(function(){var t=e.stack||"";throw fu("Exception was thrown by user callback.",t),e},Math.floor(0))}}function Ru(t,e){var n=setTimeout(t,e);return"object"==typeof n&&n.unref&&n.unref(),n}var Du=new RegExp("^-?(0*)\\d{1,10}$"),xu=function(t){if(Du.test(t)){var e=Number(t);if(-2147483648<=e&&e<=2147483647)return e}return null},Lu=(Object.defineProperty(Mu,"Empty",{get:function(){return new Mu("")},enumerable:!1,configurable:!0}),Mu.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},Mu.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},Mu.prototype.popFront=function(){var t=this.pieceNum_;return t<this.pieces_.length&&t++,new Mu(this.pieces_,t)},Mu.prototype.getBack=function(){return this.pieceNum_<this.pieces_.length?this.pieces_[this.pieces_.length-1]:null},Mu.prototype.toString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"},Mu.prototype.toUrlEncodedString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+encodeURIComponent(String(this.pieces_[e])));return t||"/"},Mu.prototype.slice=function(t){return void 0===t&&(t=0),this.pieces_.slice(this.pieceNum_+t)},Mu.prototype.parent=function(){if(this.pieceNum_>=this.pieces_.length)return null;for(var t=[],e=this.pieceNum_;e<this.pieces_.length-1;e++)t.push(this.pieces_[e]);return new Mu(t,0)},Mu.prototype.child=function(t){for(var e=[],n=this.pieceNum_;n<this.pieces_.length;n++)e.push(this.pieces_[n]);if(t instanceof Mu)for(n=t.pieceNum_;n<t.pieces_.length;n++)e.push(t.pieces_[n]);else{var r=t.split("/");for(n=0;n<r.length;n++)0<r[n].length&&e.push(r[n])}return new Mu(e,0)},Mu.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},Mu.relativePath=function(t,e){var n=t.getFront(),r=e.getFront();if(null===n)return e;if(n===r)return Mu.relativePath(t.popFront(),e.popFront());throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")},Mu.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;i<n.length&&i<r.length;i++){var o=Nu(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length<r.length?-1:1},Mu.prototype.equals=function(t){if(this.getLength()!==t.getLength())return!1;for(var e=this.pieceNum_,n=t.pieceNum_;e<=this.pieces_.length;e++,n++)if(this.pieces_[e]!==t.pieces_[n])return!1;return!0},Mu.prototype.contains=function(t){var e=this.pieceNum_,n=t.pieceNum_;if(this.getLength()>t.getLength())return!1;for(;e<this.pieces_.length;){if(this.pieces_[e]!==t.pieces_[n])return!1;++e,++n}return!0},Mu);function Mu(t,e){if(void 0===e){this.pieces_=t.split("/");for(var n=0,r=0;r<this.pieces_.length;r++)0<this.pieces_[r].length&&(this.pieces_[n]=this.pieces_[r],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=e}var Fu=(Object.defineProperty(Uu,"MAX_PATH_DEPTH",{get:function(){return 32},enumerable:!1,configurable:!0}),Object.defineProperty(Uu,"MAX_PATH_LENGTH_BYTES",{get:function(){return 768},enumerable:!1,configurable:!0}),Uu.prototype.push=function(t){0<this.parts_.length&&(this.byteLength_+=1),this.parts_.push(t),this.byteLength_+=ya(t),this.checkValid_()},Uu.prototype.pop=function(){var t=this.parts_.pop();this.byteLength_-=ya(t),0<this.parts_.length&&--this.byteLength_},Uu.prototype.checkValid_=function(){if(this.byteLength_>Uu.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+Uu.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>Uu.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Uu.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},Uu.prototype.toErrorString=function(){return 0===this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},Uu);function Uu(t,e){this.errorPrefix_=e,this.parts_=t.slice(),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n<this.parts_.length;n++)this.byteLength_+=ya(this.parts_[n]);this.checkValid_()}var ju="firebaseio.com",Vu="websocket",qu="long_polling",Bu=(Wu.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()||this.includeNamespaceInQueryParams},Wu.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},Wu.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},Wu.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},Wu.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&mu.set("host:"+this.host,this.internalHost))},Wu.prototype.connectionURL=function(t,e){var n;if(Ds("string"==typeof t,"typeof type must == string"),Ds("object"==typeof e,"typeof params must == object"),t===Vu)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(t!==qu)throw new Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(e.ns=this.namespace);var r=[];return ku(e,function(t,e){r.push(t+"="+e)}),n+r.join("&")},Wu.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},Wu.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},Wu);function Wu(t,e,n,r,i,o){void 0===i&&(i=""),void 0===o&&(o=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.includeNamespaceInQueryParams=o,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=mu.get("host:"+t)||this.host}function Hu(t){var e=nc(t),n=e.namespace;"firebase.com"===e.domain&&lu(e.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),n&&"undefined"!==n||"localhost"===e.domain||lu("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),e.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&fu("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var r="ws"===e.scheme||"wss"===e.scheme;return{repoInfo:new Bu(e.host,e.secure,n,r,"",n!==e.subdomain),path:new Lu(e.pathString)}}function Ku(t){return"string"==typeof t&&0!==t.length&&!rc.test(t)}function Gu(t){return"string"==typeof t&&0!==t.length&&!ic.test(t)}function zu(t){return null===t||"string"==typeof t||"number"==typeof t&&!pu(t)||t&&"object"==typeof t&&na(t,".sv")}function Qu(t,e,n,r,i){i&&void 0===n||sc(pa(t,e,i),n,r)}function Xu(t,e,n,r,i){if(!i||void 0!==n){var o=pa(t,e,i);if(!n||"object"!=typeof n||Array.isArray(n))throw new Error(o+" must be an object containing the children to replace.");var s=[];ku(n,function(t,e){var n=new Lu(t);if(sc(o,e,r.child(n)),".priority"===n.getBack()&&!zu(e))throw new Error(o+"contains an invalid value for '"+n.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(n)}),function(t,e){var n,r;for(n=0;n<e.length;n++)for(var i=(r=e[n]).slice(),o=0;o<i.length;o++)if((".priority"!==i[o]||o!==i.length-1)&&!Ku(i[o]))throw new Error(t+"contains an invalid key ("+i[o]+") in path "+r.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');e.sort(Lu.comparePaths);var s=null;for(n=0;n<e.length;n++){if(r=e[n],null!==s&&s.contains(r))throw new Error(t+"contains a path "+s.toString()+" that is ancestor of another path "+r.toString());s=r}}(o,s)}}function Yu(t,e,n,r){if(!r||void 0!==n){if(pu(n))throw new Error(pa(t,e,r)+"is "+n.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!zu(n))throw new Error(pa(t,e,r)+"must be a valid Firebase priority (a string, finite number, server value, or null).")}}function $u(t,e,n,r){if(!r||void 0!==n)switch(n){case"value":case"child_added":case"child_removed":case"child_changed":case"child_moved":break;default:throw new Error(pa(t,e,r)+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}}function Ju(t,e,n,r){if(!(r&&void 0===n||Ku(n)))throw new Error(pa(t,e,r)+'was an invalid key = "'+n+'".  Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')}function Zu(t,e,n,r){if(!(r&&void 0===n||Gu(n)))throw new Error(pa(t,e,r)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')}function tc(t,e){if(".info"===e.getFront())throw new Error(t+" failed = Can't modify data under /.info/")}function ec(t,e,n){var r,i=n.path.toString();if("string"!=typeof n.repoInfo.host||0===n.repoInfo.host.length||!Ku(n.repoInfo.namespace)&&"localhost"!==n.repoInfo.host.split(":")[0]||0!==i.length&&(r=(r=i)&&r.replace(/^\/*\.info(\/|$)/,"/"),!Gu(r)))throw new Error(pa(t,e,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')}var nc=function(t){var e="",n="",r="",i="",o="",s=!0,a="https",u=443;if("string"==typeof t){var c=t.indexOf("//");0<=c&&(a=t.substring(0,c-1),t=t.substring(c+2));var h=t.indexOf("/");-1===h&&(h=t.length);var l=t.indexOf("?");-1===l&&(l=t.length),e=t.substring(0,Math.min(h,l)),h<l&&(i=function(t){for(var e="",n=t.split("/"),r=0;r<n.length;r++)if(0<n[r].length){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}e+="/"+i}return e}(t.substring(h,l)));var f=function(t){var e,n,r={};"?"===t.charAt(0)&&(t=t.substring(1));try{for(var i=Cs(t.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value;if(0!==s.length){var a=s.split("=");2===a.length?r[decodeURIComponent(a[0])]=decodeURIComponent(a[1]):fu("Invalid query segment '"+s+"' in query '"+t+"'")}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}(t.substring(Math.min(t.length,l)));0<=(c=e.indexOf(":"))?(s="https"===a||"wss"===a,u=parseInt(e.substring(c+1),10)):c=e.length;var p=e.slice(0,c);if("localhost"===p.toLowerCase())n="localhost";else if(p.split(".").length<=2)n=p;else{var d=e.indexOf(".");r=e.substring(0,d).toLowerCase(),n=e.substring(d+1),o=r}"ns"in f&&(o=f.ns)}return{host:e,port:u,domain:n,subdomain:r,secure:s,scheme:a,pathString:i,namespace:o}},rc=/[\[\].#$\/\u0000-\u001F\u007F]/,ic=/[\[\].#$\u0000-\u001F\u007F]/,oc=10485760,sc=function(n,t,e){var r=e instanceof Lu?new Fu(e,n):e;if(void 0===t)throw new Error(n+"contains undefined "+r.toErrorString());if("function"==typeof t)throw new Error(n+"contains a function "+r.toErrorString()+" with contents = "+t.toString());if(pu(t))throw new Error(n+"contains "+t.toString()+" "+r.toErrorString());if("string"==typeof t&&t.length>oc/3&&ya(t)>oc)throw new Error(n+"contains a string greater than "+oc+" utf8 bytes "+r.toErrorString()+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){var i=!1,o=!1;if(ku(t,function(t,e){if(".value"===t)i=!0;else if(".priority"!==t&&".sv"!==t&&(o=!0,!Ku(t)))throw new Error(n+" contains an invalid key ("+t+") "+r.toErrorString()+'.  Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.push(t),sc(n,e,r),r.pop()}),i&&o)throw new Error(n+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},ac=(uc.prototype.cancel=function(t){fa("OnDisconnect.cancel",0,1,arguments.length),da("OnDisconnect.cancel",1,t,!0);var e=new Us;return this.repo_.onDisconnectCancel(this.path_,e.wrapCallback(t)),e.promise},uc.prototype.remove=function(t){fa("OnDisconnect.remove",0,1,arguments.length),tc("OnDisconnect.remove",this.path_),da("OnDisconnect.remove",1,t,!0);var e=new Us;return this.repo_.onDisconnectSet(this.path_,null,e.wrapCallback(t)),e.promise},uc.prototype.set=function(t,e){fa("OnDisconnect.set",1,2,arguments.length),tc("OnDisconnect.set",this.path_),Qu("OnDisconnect.set",1,t,this.path_,!1),da("OnDisconnect.set",2,e,!0);var n=new Us;return this.repo_.onDisconnectSet(this.path_,t,n.wrapCallback(e)),n.promise},uc.prototype.setWithPriority=function(t,e,n){fa("OnDisconnect.setWithPriority",2,3,arguments.length),tc("OnDisconnect.setWithPriority",this.path_),Qu("OnDisconnect.setWithPriority",1,t,this.path_,!1),Yu("OnDisconnect.setWithPriority",2,e,!1),da("OnDisconnect.setWithPriority",3,n,!0);var r=new Us;return this.repo_.onDisconnectSetWithPriority(this.path_,t,e,r.wrapCallback(n)),r.promise},uc.prototype.update=function(t,e){if(fa("OnDisconnect.update",1,2,arguments.length),tc("OnDisconnect.update",this.path_),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,fu("Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}Xu("OnDisconnect.update",1,t,this.path_,!1),da("OnDisconnect.update",2,e,!0);var i=new Us;return this.repo_.onDisconnectUpdate(this.path_,t,i.wrapCallback(e)),i.promise},uc);function uc(t,e){this.repo_=t,this.path_=e}var cc=(hc.prototype.toJSON=function(){return fa("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},hc);function hc(t,e){this.committed=t,this.snapshot=e}var lc,fc,pc,dc=(lc="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",fc=0,pc=[],function(t){var e,n=t===fc;fc=t;var r=new Array(8);for(e=7;0<=e;e--)r[e]=lc.charAt(t%64),t=Math.floor(t/64);Ds(0===t,"Cannot push at time == 0");var i=r.join("");if(n){for(e=11;0<=e&&63===pc[e];e--)pc[e]=0;pc[e]++}else for(e=0;e<12;e++)pc[e]=Math.floor(64*Math.random());for(e=0;e<12;e++)i+=lc.charAt(pc[e]);return Ds(20===i.length,"nextPushId: Length should be 20."),i}),vc=(yc.Wrap=function(t,e){return new yc(t,e)},yc);function yc(t,e){this.name=t,this.node=e}var gc,mc=(bc.prototype.getCompare=function(){return this.compare.bind(this)},bc.prototype.indexedValueChanged=function(t,e){var n=new vc(Su,t),r=new vc(Su,e);return 0!==this.compare(n,r)},bc.prototype.minPost=function(){return vc.MIN},bc);function bc(){}var wc,_c=(Es(Ec,wc=mc),Object.defineProperty(Ec,"__EMPTY_NODE",{get:function(){return gc},set:function(t){gc=t},enumerable:!1,configurable:!0}),Ec.prototype.compare=function(t,e){return Nu(t.name,e.name)},Ec.prototype.isDefinedOn=function(t){throw xs("KeyIndex.isDefinedOn not expected to be called.")},Ec.prototype.indexedValueChanged=function(t,e){return!1},Ec.prototype.minPost=function(){return vc.MIN},Ec.prototype.maxPost=function(){return new vc(Cu,gc)},Ec.prototype.makePost=function(t,e){return Ds("string"==typeof t,"KeyIndex indexValue must always be a string."),new vc(t,gc)},Ec.prototype.toString=function(){return".key"},Ec);function Ec(){return null!==wc&&wc.apply(this,arguments)||this}var Ic,Tc=new _c;function Sc(t){return"number"==typeof t?"number:"+Ou(t):"string:"+t}function Cc(t){if(t.isLeafNode()){var e=t.val();Ds("string"==typeof e||"number"==typeof e||"object"==typeof e&&na(e,".sv"),"Priority must be a string or number.")}else Ds(t===Ic||t.isEmpty(),"priority of unexpected type.");Ds(t===Ic||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")}var Nc,Ac,kc,Oc,Pc=(Object.defineProperty(Rc,"__childrenNodeConstructor",{get:function(){return Nc},set:function(t){Nc=t},enumerable:!1,configurable:!0}),Rc.prototype.isLeafNode=function(){return!0},Rc.prototype.getPriority=function(){return this.priorityNode_},Rc.prototype.updatePriority=function(t){return new Rc(this.value_,t)},Rc.prototype.getImmediateChild=function(t){return".priority"===t?this.priorityNode_:Rc.__childrenNodeConstructor.EMPTY_NODE},Rc.prototype.getChild=function(t){return t.isEmpty()?this:".priority"===t.getFront()?this.priorityNode_:Rc.__childrenNodeConstructor.EMPTY_NODE},Rc.prototype.hasChild=function(){return!1},Rc.prototype.getPredecessorChildName=function(t,e){return null},Rc.prototype.updateImmediateChild=function(t,e){return".priority"===t?this.updatePriority(e):e.isEmpty()&&".priority"!==t?this:Rc.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,e).updatePriority(this.priorityNode_)},Rc.prototype.updateChild=function(t,e){var n=t.getFront();return null===n?e:e.isEmpty()&&".priority"!==n?this:(Ds(".priority"!==n||1===t.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(n,Rc.__childrenNodeConstructor.EMPTY_NODE.updateChild(t.popFront(),e)))},Rc.prototype.isEmpty=function(){return!1},Rc.prototype.numChildren=function(){return 0},Rc.prototype.forEachChild=function(t,e){return!1},Rc.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},Rc.prototype.hash=function(){if(null===this.lazyHash_){var t="";this.priorityNode_.isEmpty()||(t+="priority:"+Sc(this.priorityNode_.val())+":");var e=typeof this.value_;t+=e+":",t+="number"==e?Ou(this.value_):this.value_,this.lazyHash_=su(t)}return this.lazyHash_},Rc.prototype.getValue=function(){return this.value_},Rc.prototype.compareTo=function(t){return t===Rc.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof Rc.__childrenNodeConstructor?-1:(Ds(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))},Rc.prototype.compareToLeafNode_=function(t){var e=typeof t.value_,n=typeof this.value_,r=Rc.VALUE_TYPE_ORDER.indexOf(e),i=Rc.VALUE_TYPE_ORDER.indexOf(n);return Ds(0<=r,"Unknown leaf type: "+e),Ds(0<=i,"Unknown leaf type: "+n),r===i?"object"==n?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:i-r},Rc.prototype.withIndex=function(){return this},Rc.prototype.isIndexed=function(){return!0},Rc.prototype.equals=function(t){return t===this||!!t.isLeafNode()&&(this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_))},Rc.VALUE_TYPE_ORDER=["object","boolean","number","string"],Rc);function Rc(t,e){void 0===e&&(e=Rc.__childrenNodeConstructor.EMPTY_NODE),this.value_=t,this.priorityNode_=e,this.lazyHash_=null,Ds(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Cc(this.priorityNode_)}function Dc(){return null!==Oc&&Oc.apply(this,arguments)||this}var xc=new(Es(Dc,Oc=mc),Dc.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),i=n.compareTo(r);return 0===i?Nu(t.name,e.name):i},Dc.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},Dc.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},Dc.prototype.minPost=function(){return vc.MIN},Dc.prototype.maxPost=function(){return new vc(Cu,new Pc("[PRIORITY-POST]",kc))},Dc.prototype.makePost=function(t,e){var n=Ac(t);return new vc(e,new Pc("[PRIORITY-POST]",n))},Dc.prototype.toString=function(){return".priority"},Dc),Lc=(Mc.prototype.getNext=function(){if(0===this.nodeStack_.length)return null;var t,e=this.nodeStack_.pop();if(t=this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value},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},Mc.prototype.hasNext=function(){return 0<this.nodeStack_.length},Mc.prototype.peek=function(){if(0===this.nodeStack_.length)return null;var t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}},Mc);function Mc(t,e,n,r,i){void 0===i&&(i=null),this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];for(var o=1;!t.isEmpty();)if(t=t,o=e?n(t.key,e):1,r&&(o*=-1),o<0)t=this.isReverse_?t.left:t.right;else{if(0===o){this.nodeStack_.push(t);break}this.nodeStack_.push(t),t=this.isReverse_?t.right:t.left}}var Fc=(Uc.prototype.copy=function(t,e,n,r,i){return new Uc(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)},Uc.prototype.count=function(){return this.left.count()+1+this.right.count()},Uc.prototype.isEmpty=function(){return!1},Uc.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)},Uc.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},Uc.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},Uc.prototype.minKey=function(){return this.min_().key},Uc.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},Uc.prototype.insert=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n))).fixUp_()},Uc.prototype.removeMin_=function(){if(this.left.isEmpty())return qc.EMPTY_NODE;var t=this;return t.left.isRed_()||t.left.left.isRed_()||(t=t.moveRedLeft_()),(t=t.copy(null,null,null,t.left.removeMin_(),null)).fixUp_()},Uc.prototype.remove=function(t,e){var n,r;if(e(t,(n=this).key)<0)n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===e(t,n.key)){if(n.right.isEmpty())return qc.EMPTY_NODE;r=n.right.min_(),n=n.copy(r.key,r.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp_()},Uc.prototype.isRed_=function(){return this.color},Uc.prototype.fixUp_=function(){var t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t},Uc.prototype.moveRedLeft_=function(){var t=this.colorFlip_();return t.right.left.isRed_()&&(t=(t=(t=t.copy(null,null,null,null,t.right.rotateRight_())).rotateLeft_()).colorFlip_()),t},Uc.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t.left.left.isRed_()&&(t=(t=t.rotateRight_()).colorFlip_()),t},Uc.prototype.rotateLeft_=function(){var t=this.copy(null,null,Uc.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},Uc.prototype.rotateRight_=function(){var t=this.copy(null,null,Uc.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},Uc.prototype.colorFlip_=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},Uc.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},Uc.prototype.check_=function(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");var t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)},Uc.RED=!0,Uc.BLACK=!1,Uc);function Uc(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:Uc.RED,this.left=null!=r?r:qc.EMPTY_NODE,this.right=null!=i?i:qc.EMPTY_NODE}var jc=(Vc.prototype.copy=function(t,e,n,r,i){return this},Vc.prototype.insert=function(t,e,n){return new Fc(t,e,null)},Vc.prototype.remove=function(t,e){return this},Vc.prototype.count=function(){return 0},Vc.prototype.isEmpty=function(){return!0},Vc.prototype.inorderTraversal=function(t){return!1},Vc.prototype.reverseTraversal=function(t){return!1},Vc.prototype.minKey=function(){return null},Vc.prototype.maxKey=function(){return null},Vc.prototype.check_=function(){return 0},Vc.prototype.isRed_=function(){return!1},Vc);function Vc(){}var qc=(Bc.prototype.insert=function(t,e){return new Bc(this.comparator_,this.root_.insert(t,e,this.comparator_).copy(null,null,Fc.BLACK,null,null))},Bc.prototype.remove=function(t){return new Bc(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,Fc.BLACK,null,null))},Bc.prototype.get=function(t){for(var e,n=this.root_;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key)))return n.value;e<0?n=n.left:0<e&&(n=n.right)}return null},Bc.prototype.getPredecessorKey=function(t){for(var e,n=this.root_,r=null;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key))){if(n.left.isEmpty())return r?r.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}e<0?n=n.left:0<e&&(n=(r=n).right)}throw new Error("Attempted to find predecessor key for a nonexistent key.  What gives?")},Bc.prototype.isEmpty=function(){return this.root_.isEmpty()},Bc.prototype.count=function(){return this.root_.count()},Bc.prototype.minKey=function(){return this.root_.minKey()},Bc.prototype.maxKey=function(){return this.root_.maxKey()},Bc.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},Bc.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},Bc.prototype.getIterator=function(t){return new Lc(this.root_,null,this.comparator_,!1,t)},Bc.prototype.getIteratorFrom=function(t,e){return new Lc(this.root_,t,this.comparator_,!1,e)},Bc.prototype.getReverseIteratorFrom=function(t,e){return new Lc(this.root_,t,this.comparator_,!0,e)},Bc.prototype.getReverseIterator=function(t){return new Lc(this.root_,null,this.comparator_,!0,t)},Bc.EMPTY_NODE=new jc,Bc);function Bc(t,e){void 0===e&&(e=Bc.EMPTY_NODE),this.comparator_=t,this.root_=e}var Wc=Math.log(2),Hc=(Kc.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<<this.current_);return this.current_--,t},Kc);function Kc(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/Wc,10)),this.current_=this.count-1;var n,r=(n=this.count,parseInt(Array(n+1).join("1"),2));this.bits_=t+1&r}var Gc,zc,Qc=function(c,t,h,e){c.sort(t);var l=function(t,e){var n,r,i=e-t;if(0==i)return null;if(1==i)return n=c[t],r=h?h(n):n,new Fc(r,n.node,Fc.BLACK,null,null);var o=parseInt(i/2,10)+t,s=l(t,o),a=l(o+1,e);return n=c[o],r=h?h(n):n,new Fc(r,n.node,Fc.BLACK,s,a)},n=function(t){for(var e=null,n=null,a=c.length,r=function(t,e){var n=a-t,r=a;a-=t;var i=l(1+n,r),o=c[n],s=h?h(o):o;u(new Fc(s,o.node,e,null,i))},u=function(t){e=e?e.left=t:n=t},i=0;i<t.count;++i){var o=t.nextBitIsOne(),s=Math.pow(2,t.count-(i+1));o?r(s,Fc.BLACK):(r(s,Fc.BLACK),r(s,Fc.RED))}return n}(new Hc(c.length));return new qc(e||t,n)},Xc={},Yc=(Object.defineProperty($c,"Default",{get:function(){return Ds(xc,"ChildrenNode.ts has not been loaded"),Gc=Gc||new $c({".priority":Xc},{".priority":xc})},enumerable:!1,configurable:!0}),$c.prototype.get=function(t){var e=ra(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e instanceof qc?e:null},$c.prototype.hasIndex=function(t){return na(this.indexSet_,t.toString())},$c.prototype.addIndex=function(t,e){Ds(t!==Tc,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var n,r=[],i=!1,o=e.getIterator(vc.Wrap),s=o.getNext();s;)i=i||t.isDefinedOn(s.node),r.push(s),s=o.getNext();n=i?Qc(r,t.getCompare()):Xc;var a=t.toString(),u=Is({},this.indexSet_);u[a]=t;var c=Is({},this.indexes_);return c[a]=n,new $c(c,u)},$c.prototype.addToIndexes=function(u,c){var h=this;return new $c(oa(this.indexes_,function(t,e){var n=ra(h.indexSet_,e);if(Ds(n,"Missing index implementation for "+e),t===Xc){if(n.isDefinedOn(u.node)){for(var r=[],i=c.getIterator(vc.Wrap),o=i.getNext();o;)o.name!==u.name&&r.push(o),o=i.getNext();return r.push(u),Qc(r,n.getCompare())}return Xc}var s=c.get(u.name),a=t;return s&&(a=a.remove(new vc(u.name,s))),a.insert(u,u.node)}),this.indexSet_)},$c.prototype.removeFromIndexes=function(n,r){return new $c(oa(this.indexes_,function(t){if(t===Xc)return t;var e=r.get(n.name);return e?t.remove(new vc(n.name,e)):t}),this.indexSet_)},$c);function $c(t,e){this.indexes_=t,this.indexSet_=e}function Jc(t,e){return Nu(t.name,e.name)}function Zc(t,e){return Nu(t,e)}var th,eh=(Object.defineProperty(nh,"EMPTY_NODE",{get:function(){return zc=zc||new nh(new qc(Zc),null,Yc.Default)},enumerable:!1,configurable:!0}),nh.prototype.isLeafNode=function(){return!1},nh.prototype.getPriority=function(){return this.priorityNode_||zc},nh.prototype.updatePriority=function(t){return this.children_.isEmpty()?this:new nh(this.children_,t,this.indexMap_)},nh.prototype.getImmediateChild=function(t){if(".priority"===t)return this.getPriority();var e=this.children_.get(t);return null===e?zc:e},nh.prototype.getChild=function(t){var e=t.getFront();return null===e?this:this.getImmediateChild(e).getChild(t.popFront())},nh.prototype.hasChild=function(t){return null!==this.children_.get(t)},nh.prototype.updateImmediateChild=function(t,e){if(Ds(e,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(e);var n=new vc(t,e),r=void 0,i=void 0;i=e.isEmpty()?(r=this.children_.remove(t),this.indexMap_.removeFromIndexes(n,this.children_)):(r=this.children_.insert(t,e),this.indexMap_.addToIndexes(n,this.children_));var o=r.isEmpty()?zc:this.priorityNode_;return new nh(r,o,i)},nh.prototype.updateChild=function(t,e){var n=t.getFront();if(null===n)return e;Ds(".priority"!==t.getFront()||1===t.getLength(),".priority must be the last token in a path");var r=this.getImmediateChild(n).updateChild(t.popFront(),e);return this.updateImmediateChild(n,r)},nh.prototype.isEmpty=function(){return this.children_.isEmpty()},nh.prototype.numChildren=function(){return this.children_.count()},nh.prototype.val=function(n){if(this.isEmpty())return null;var r={},i=0,o=0,s=!0;if(this.forEachChild(xc,function(t,e){r[t]=e.val(n),i++,s&&nh.INTEGER_REGEXP_.test(t)?o=Math.max(o,Number(t)):s=!1}),!n&&s&&o<2*i){var t=[];for(var e in r)t[e]=r[e];return t}return n&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r},nh.prototype.hash=function(){if(null===this.lazyHash_){var r="";this.getPriority().isEmpty()||(r+="priority:"+Sc(this.getPriority().val())+":"),this.forEachChild(xc,function(t,e){var n=e.hash();""!==n&&(r+=":"+t+":"+n)}),this.lazyHash_=""===r?"":su(r)}return this.lazyHash_},nh.prototype.getPredecessorChildName=function(t,e,n){var r=this.resolveIndex_(n);if(r){var i=r.getPredecessorKey(new vc(t,e));return i?i.name:null}return this.children_.getPredecessorKey(t)},nh.prototype.getFirstChildName=function(t){var e=this.resolveIndex_(t);if(e){var n=e.minKey();return n&&n.name}return this.children_.minKey()},nh.prototype.getFirstChild=function(t){var e=this.getFirstChildName(t);return e?new vc(e,this.children_.get(e)):null},nh.prototype.getLastChildName=function(t){var e=this.resolveIndex_(t);if(e){var n=e.maxKey();return n&&n.name}return this.children_.maxKey()},nh.prototype.getLastChild=function(t){var e=this.getLastChildName(t);return e?new vc(e,this.children_.get(e)):null},nh.prototype.forEachChild=function(t,e){var n=this.resolveIndex_(t);return n?n.inorderTraversal(function(t){return e(t.name,t.node)}):this.children_.inorderTraversal(e)},nh.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},nh.prototype.getIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getIteratorFrom(t,function(t){return t});for(var r=this.children_.getIteratorFrom(t.name,vc.Wrap),i=r.peek();null!=i&&e.compare(i,t)<0;)r.getNext(),i=r.peek();return r},nh.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},nh.prototype.getReverseIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getReverseIteratorFrom(t,function(t){return t});for(var r=this.children_.getReverseIteratorFrom(t.name,vc.Wrap),i=r.peek();null!=i&&0<e.compare(i,t);)r.getNext(),i=r.peek();return r},nh.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===ih?-1:0},nh.prototype.withIndex=function(t){if(t===Tc||this.indexMap_.hasIndex(t))return this;var e=this.indexMap_.addIndex(t,this.children_);return new nh(this.children_,this.priorityNode_,e)},nh.prototype.isIndexed=function(t){return t===Tc||this.indexMap_.hasIndex(t)},nh.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;var e=t;if(this.getPriority().equals(e.getPriority())){if(this.children_.count()!==e.children_.count())return!1;for(var n=this.getIterator(xc),r=e.getIterator(xc),i=n.getNext(),o=r.getNext();i&&o;){if(i.name!==o.name||!i.node.equals(o.node))return!1;i=n.getNext(),o=r.getNext()}return null===i&&null===o}return!1},nh.prototype.resolveIndex_=function(t){return t===Tc?null:this.indexMap_.get(t.toString())},nh.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,nh);function nh(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&Cc(this.priorityNode_),this.children_.isEmpty()&&Ds(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}function rh(){return th.call(this,new qc(Zc),eh.EMPTY_NODE,Yc.Default)||this}var ih=new(Es(rh,th=eh),rh.prototype.compareTo=function(t){return t===this?0:1},rh.prototype.equals=function(t){return t===this},rh.prototype.getPriority=function(){return this},rh.prototype.getImmediateChild=function(t){return eh.EMPTY_NODE},rh.prototype.isEmpty=function(){return!1},rh);Object.defineProperties(vc,{MIN:{value:new vc(Su,eh.EMPTY_NODE)},MAX:{value:new vc(Cu,ih)}}),_c.__EMPTY_NODE=eh.EMPTY_NODE,Pc.__childrenNodeConstructor=eh,Ic=ih,kc=ih;var oh,sh=!0;function ah(r,t){if(void 0===t&&(t=null),null===r)return eh.EMPTY_NODE;if("object"==typeof r&&".priority"in r&&(t=r[".priority"]),Ds(null===t||"string"==typeof t||"number"==typeof t||"object"==typeof t&&".sv"in t,"Invalid priority type found: "+typeof t),"object"==typeof r&&".value"in r&&null!==r[".value"]&&(r=r[".value"]),"object"!=typeof r||".sv"in r)return new Pc(r,ah(t));if(r instanceof Array||!sh){var i=eh.EMPTY_NODE;return ku(r,function(t,e){if(na(r,t)&&"."!==t.substring(0,1)){var n=ah(e);!n.isLeafNode()&&n.isEmpty()||(i=i.updateImmediateChild(t,n))}}),i.updatePriority(ah(t))}var o=[],s=!1;if(ku(r,function(t,e){if("."!==t.substring(0,1)){var n=ah(e);n.isEmpty()||(s=s||!n.getPriority().isEmpty(),o.push(new vc(t,n)))}}),0===o.length)return eh.EMPTY_NODE;var e=Qc(o,Jc,function(t){return t.name},Zc);if(s){var n=Qc(o,xc.getCompare());return new eh(e,ah(t),new Yc({".priority":n},{".priority":xc}))}return new eh(e,ah(t),Yc.Default)}function uh(){return null!==oh&&oh.apply(this,arguments)||this}Ac=ah;var ch,hh=new(Es(uh,oh=mc),uh.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?Nu(t.name,e.name):n},uh.prototype.isDefinedOn=function(t){return!0},uh.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},uh.prototype.minPost=function(){return vc.MIN},uh.prototype.maxPost=function(){return vc.MAX},uh.prototype.makePost=function(t,e){var n=ah(t);return new vc(e,n)},uh.prototype.toString=function(){return".value"},uh),lh=(Es(fh,ch=mc),fh.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},fh.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},fh.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),i=n.compareTo(r);return 0===i?Nu(t.name,e.name):i},fh.prototype.makePost=function(t,e){var n=ah(t),r=eh.EMPTY_NODE.updateChild(this.indexPath_,n);return new vc(e,r)},fh.prototype.maxPost=function(){var t=eh.EMPTY_NODE.updateChild(this.indexPath_,ih);return new vc(Cu,t)},fh.prototype.toString=function(){return this.indexPath_.slice().join("/")},fh);function fh(t){var e=ch.call(this)||this;return e.indexPath_=t,Ds(!t.isEmpty()&&".priority"!==t.getFront(),"Can't create PathIndex with empty path or .priority key"),e}var ph=(dh.prototype.val=function(){return fa("DataSnapshot.val",0,0,arguments.length),this.node_.val()},dh.prototype.exportVal=function(){return fa("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},dh.prototype.toJSON=function(){return fa("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},dh.prototype.exists=function(){return fa("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},dh.prototype.child=function(t){fa("DataSnapshot.child",0,1,arguments.length),t=String(t),Zu("DataSnapshot.child",1,t,!1);var e=new Lu(t),n=this.ref_.child(e);return new dh(this.node_.getChild(e),n,xc)},dh.prototype.hasChild=function(t){fa("DataSnapshot.hasChild",1,1,arguments.length),Zu("DataSnapshot.hasChild",1,t,!1);var e=new Lu(t);return!this.node_.getChild(e).isEmpty()},dh.prototype.getPriority=function(){return fa("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},dh.prototype.forEach=function(n){var r=this;return fa("DataSnapshot.forEach",1,1,arguments.length),da("DataSnapshot.forEach",1,n,!1),!this.node_.isLeafNode()&&!!this.node_.forEachChild(this.index_,function(t,e){return n(new dh(e,r.ref_.child(t),xc))})},dh.prototype.hasChildren=function(){return fa("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(dh.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!1,configurable:!0}),dh.prototype.numChildren=function(){return fa("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},dh.prototype.getRef=function(){return fa("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(dh.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),dh);function dh(t,e,n){this.node_=t,this.ref_=e,this.index_=n}var vh=(yh.prototype.getPath=function(){var t=this.snapshot.getRef();return"value"===this.eventType?t.path:t.getParent().path},yh.prototype.getEventType=function(){return this.eventType},yh.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},yh.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+ta(this.snapshot.exportVal())},yh);function yh(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}var gh=(mh.prototype.getPath=function(){return this.path},mh.prototype.getEventType=function(){return"cancel"},mh.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},mh.prototype.toString=function(){return this.path.toString()+":cancel"},mh);function mh(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}var bh=(wh.prototype.respondsTo=function(t){return"value"===t},wh.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new vh("value",this,new ph(t.snapshotNode,e.getRef(),n))},wh.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){Ds(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callback_;return function(){r.call(e,t.snapshot)}},wh.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new gh(this,t,e):null},wh.prototype.matches=function(t){return t instanceof wh&&(!t.callback_||!this.callback_||t.callback_===this.callback_&&t.context_===this.context_)},wh.prototype.hasAnyCallback=function(){return null!==this.callback_},wh);function wh(t,e,n){this.callback_=t,this.cancelCallback_=e,this.context_=n}var _h,Eh=(Ih.prototype.respondsTo=function(t){var e="children_added"===t?"child_added":t;return e="children_removed"===e?"child_removed":e,na(this.callbacks_,e)},Ih.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new gh(this,t,e):null},Ih.prototype.createEvent=function(t,e){Ds(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),r=e.getQueryParams().getIndex();return new vh(t.type,this,new ph(t.snapshotNode,n,r),t.prevName)},Ih.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){Ds(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callbacks_[t.eventType];return function(){r.call(e,t.snapshot,t.prevName)}},Ih.prototype.matches=function(e){var n=this;if(e instanceof Ih){if(!this.callbacks_||!e.callbacks_)return!0;if(this.context_===e.context_){var t=Object.keys(e.callbacks_),r=Object.keys(this.callbacks_),i=t.length;if(i===r.length){if(1!==i)return r.every(function(t){return e.callbacks_[t]===n.callbacks_[t]});var o=t[0],s=r[0];return!(s!==o||e.callbacks_[o]&&this.callbacks_[s]&&e.callbacks_[o]!==this.callbacks_[s])}}}return!1},Ih.prototype.hasAnyCallback=function(){return null!==this.callbacks_},Ih);function Ih(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}var Th=(Object.defineProperty(Sh,"__referenceConstructor",{get:function(){return Ds(_h,"Reference.ts has not been loaded"),_h},set:function(t){_h=t},enumerable:!1,configurable:!0}),Sh.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===Tc){var r="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",i="Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!==Su)throw new Error(r);if("string"!=typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!==Cu)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===xc){if(null!=e&&!zu(e)||null!=n&&!zu(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(Ds(t.getIndex()instanceof lh||t.getIndex()===hh,"unknown index type."),null!=e&&"object"==typeof e||null!=n&&"object"==typeof n)throw new Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},Sh.validateLimit_=function(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},Sh.prototype.validateNoPreviousOrderByCall_=function(t){if(!0===this.orderByCalled_)throw new Error(t+": You can't combine multiple orderBy calls.")},Sh.prototype.getQueryParams=function(){return this.queryParams_},Sh.prototype.getRef=function(){return fa("Query.ref",0,0,arguments.length),new Sh.__referenceConstructor(this.repo,this.path)},Sh.prototype.on=function(t,e,n,r){fa("Query.on",2,4,arguments.length),$u("Query.on",1,t,!1),da("Query.on",2,e,!1);var i=Sh.getCancelAndContextArgs_("Query.on",n,r);if("value"===t)this.onValueEvent(e,i.cancel,i.context);else{var o={};o[t]=e,this.onChildEvent(o,i.cancel,i.context)}return e},Sh.prototype.onValueEvent=function(t,e,n){var r=new bh(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,r)},Sh.prototype.onChildEvent=function(t,e,n){var r=new Eh(t,e,n);this.repo.addEventCallbackForQuery(this,r)},Sh.prototype.off=function(t,e,n){fa("Query.off",0,3,arguments.length),$u("Query.off",1,t,!0),da("Query.off",2,e,!0),va("Query.off",3,n,!0);var r=null,i=null;"value"===t?r=new bh(e||null,null,n||null):t&&(e&&((i={})[t]=e),r=new Eh(i,null,n||null)),this.repo.removeEventCallbackForQuery(this,r)},Sh.prototype.once=function(e,n,t,r){var i=this;fa("Query.once",1,4,arguments.length),$u("Query.once",1,e,!1),da("Query.once",2,n,!0);var o=Sh.getCancelAndContextArgs_("Query.once",t,r),s=!0,a=new Us;a.promise.catch(function(){});var u=function(t){s&&(s=!1,i.off(e,u),n&&n.bind(o.context)(t),a.resolve(t))};return this.on(e,u,function(t){i.off(e,u),o.cancel&&o.cancel.bind(o.context)(t),a.reject(t)}),a.promise},Sh.prototype.limitToFirst=function(t){if(fa("Query.limitToFirst",1,1,arguments.length),"number"!=typeof t||Math.floor(t)!==t||t<=0)throw new Error("Query.limitToFirst: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new Sh(this.repo,this.path,this.queryParams_.limitToFirst(t),this.orderByCalled_)},Sh.prototype.limitToLast=function(t){if(fa("Query.limitToLast",1,1,arguments.length),"number"!=typeof t||Math.floor(t)!==t||t<=0)throw new Error("Query.limitToLast: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new Sh(this.repo,this.path,this.queryParams_.limitToLast(t),this.orderByCalled_)},Sh.prototype.orderByChild=function(t){if(fa("Query.orderByChild",1,1,arguments.length),"$key"===t)throw new Error('Query.orderByChild: "$key" is invalid.  Use Query.orderByKey() instead.');if("$priority"===t)throw new Error('Query.orderByChild: "$priority" is invalid.  Use Query.orderByPriority() instead.');if("$value"===t)throw new Error('Query.orderByChild: "$value" is invalid.  Use Query.orderByValue() instead.');Zu("Query.orderByChild",1,t,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var e=new Lu(t);if(e.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path.  Use Query.orderByValue() instead.");var n=new lh(e),r=this.queryParams_.orderBy(n);return Sh.validateQueryEndpoints_(r),new Sh(this.repo,this.path,r,!0)},Sh.prototype.orderByKey=function(){fa("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var t=this.queryParams_.orderBy(Tc);return Sh.validateQueryEndpoints_(t),new Sh(this.repo,this.path,t,!0)},Sh.prototype.orderByPriority=function(){fa("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var t=this.queryParams_.orderBy(xc);return Sh.validateQueryEndpoints_(t),new Sh(this.repo,this.path,t,!0)},Sh.prototype.orderByValue=function(){fa("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var t=this.queryParams_.orderBy(hh);return Sh.validateQueryEndpoints_(t),new Sh(this.repo,this.path,t,!0)},Sh.prototype.startAt=function(t,e){void 0===t&&(t=null),fa("Query.startAt",0,2,arguments.length),Qu("Query.startAt",1,t,this.path,!0),Ju("Query.startAt",2,e,!0);var n=this.queryParams_.startAt(t,e);if(Sh.validateLimit_(n),Sh.validateQueryEndpoints_(n),this.queryParams_.hasStart())throw new Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===t&&(e=t=null),new Sh(this.repo,this.path,n,this.orderByCalled_)},Sh.prototype.endAt=function(t,e){void 0===t&&(t=null),fa("Query.endAt",0,2,arguments.length),Qu("Query.endAt",1,t,this.path,!0),Ju("Query.endAt",2,e,!0);var n=this.queryParams_.endAt(t,e);if(Sh.validateLimit_(n),Sh.validateQueryEndpoints_(n),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new Sh(this.repo,this.path,n,this.orderByCalled_)},Sh.prototype.equalTo=function(t,e){if(fa("Query.equalTo",1,2,arguments.length),Qu("Query.equalTo",1,t,this.path,!1),Ju("Query.equalTo",2,e,!0),this.queryParams_.hasStart())throw new Error("Query.equalTo: Starting point was already set (by another call to startAt or equalTo).");if(this.queryParams_.hasEnd())throw new Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.startAt(t,e).endAt(t,e)},Sh.prototype.toString=function(){return fa("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},Sh.prototype.toJSON=function(){return fa("Query.toJSON",0,1,arguments.length),this.toString()},Sh.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},Sh.prototype.queryIdentifier=function(){var t=this.queryObject(),e=Au(t);return"{}"===e?"default":e},Sh.prototype.isEqual=function(t){if(fa("Query.isEqual",1,1,arguments.length),!(t instanceof Sh))throw new Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.");var e=this.repo===t.repo,n=this.path.equals(t.path),r=this.queryIdentifier()===t.queryIdentifier();return e&&n&&r},Sh.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,da(t,3,r.cancel,!0),r.context=n,va(t,4,r.context,!0);else if(e)if("object"==typeof e&&null!==e)r.context=e;else{if("function"!=typeof e)throw new Error(pa(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(Sh.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),Sh);function Sh(t,e,n,r){this.repo=t,this.path=e,this.queryParams_=n,this.orderByCalled_=r}var Ch=(Nh.prototype.getImmediateChild=function(t){return new Nh(this.node_.getImmediateChild(t))},Nh.prototype.node=function(){return this.node_},Nh);function Nh(t){this.node_=t}var Ah=(kh.prototype.getImmediateChild=function(t){var e=this.path_.child(t);return new kh(this.syncTree_,e)},kh.prototype.node=function(){return this.syncTree_.calcCompleteEventCache(this.path_)},kh);function kh(t,e){this.syncTree_=t,this.path_=e}function Oh(t,e,n,r){return Lh(e,new Ah(n,t),r)}function Ph(t,e,n){return Lh(t,new Ch(e),n)}var Rh=function(t,e,n){return t&&"object"==typeof t?(Ds(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?Dh(t[".sv"],e,n):"object"==typeof t[".sv"]?xh(t[".sv"],e):void Ds(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},Dh=function(t,e,n){switch(t){case"timestamp":return n.timestamp;default:Ds(!1,"Unexpected server value: "+t)}},xh=function(t,e,n){t.hasOwnProperty("increment")||Ds(!1,"Unexpected server value: "+JSON.stringify(t,null,2));var r=t.increment;"number"!=typeof r&&Ds(!1,"Unexpected increment value: "+r);var i=e.node();if(Ds(null!=i,"Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return r;var o=i.getValue();return"number"!=typeof o?r:o+r};function Lh(t,r,i){var o,e=t.getPriority().val(),n=Rh(e,r.getImmediateChild(".priority"),i);if(t.isLeafNode()){var s=t,a=Rh(s.getValue(),r,i);return a!==s.getValue()||n!==s.getPriority().val()?new Pc(a,ah(n)):t}var u=t;return n!==(o=u).getPriority().val()&&(o=o.updatePriority(new Pc(n))),u.forEachChild(xc,function(t,e){var n=Lh(e,r.getImmediateChild(t),i);n!==e&&(o=o.updateImmediateChild(t,n))}),o}var Mh,Fh,Uh=(jh.prototype.find=function(t){if(null!=this.value)return this.value.getChild(t);if(!t.isEmpty()&&0<this.children.size){var e=t.getFront();return t=t.popFront(),this.children.has(e)?this.children.get(e).find(t):null}return null},jh.prototype.remember=function(t,e){if(t.isEmpty())this.value=e,this.children.clear();else if(null!==this.value)this.value=this.value.updateChild(t,e);else{var n=t.getFront();this.children.has(n)||this.children.set(n,new jh);var r=this.children.get(n);t=t.popFront(),r.remember(t,e)}},jh.prototype.forget=function(t){if(t.isEmpty())return this.value=null,this.children.clear(),!0;if(null!==this.value){if(this.value.isLeafNode())return!1;var e=this.value;this.value=null;var n=this;return e.forEachChild(xc,function(t,e){n.remember(new Lu(t),e)}),this.forget(t)}if(0<this.children.size){var r=t.getFront();return t=t.popFront(),!this.children.has(r)||this.children.get(r).forget(t)&&this.children.delete(r),0===this.children.size}return!0},jh.prototype.forEachTree=function(r,i){null!==this.value?i(r,this.value):this.forEachChild(function(t,e){var n=new Lu(r.toString()+"/"+t);e.forEachTree(n,i)})},jh.prototype.forEachChild=function(n){this.children.forEach(function(t,e){n(e,t)})},jh);function jh(){this.value=null,this.children=new Map}(Fh=Mh=Mh||{})[Fh.OVERWRITE=0]="OVERWRITE",Fh[Fh.MERGE=1]="MERGE",Fh[Fh.ACK_USER_WRITE=2]="ACK_USER_WRITE",Fh[Fh.LISTEN_COMPLETE=3]="LISTEN_COMPLETE";var Vh=(qh.User=new qh(!0,!1,null,!1),qh.Server=new qh(!1,!0,null,!1),qh.forServerTaggedQuery=function(t){return new qh(!1,!0,t,!0)},qh);function qh(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,Ds(!r||e,"Tagged queries must be from server.")}var Bh,Wh=(Hh.prototype.operationForChild=function(t){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return Ds(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var e=this.affectedTree.subtree(new Lu(t));return new Hh(Lu.Empty,e,this.revert)}return Ds(this.path.getFront()===t,"operationForChild called for unrelated child."),new Hh(this.path.popFront(),this.affectedTree,this.revert)},Hh);function Hh(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=Mh.ACK_USER_WRITE,this.source=Vh.User}var Kh=(Gh.fromObject=function(t){var n=Gh.Empty;return ku(t,function(t,e){n=n.set(new Lu(t),e)}),n},Gh.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},Gh.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:Lu.Empty,value:this.value};if(t.isEmpty())return null;var n=t.getFront(),r=this.children.get(n);if(null===r)return null;var i=r.findRootMostMatchingPathAndValue(t.popFront(),e);return null==i?null:{path:new Lu(n).child(i.path),value:i.value}},Gh.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},Gh.prototype.subtree=function(t){if(t.isEmpty())return this;var e=t.getFront(),n=this.children.get(e);return null!==n?n.subtree(t.popFront()):Gh.Empty},Gh.prototype.set=function(t,e){if(t.isEmpty())return new Gh(e,this.children);var n=t.getFront(),r=(this.children.get(n)||Gh.Empty).set(t.popFront(),e),i=this.children.insert(n,r);return new Gh(this.value,i)},Gh.prototype.remove=function(t){if(t.isEmpty())return this.children.isEmpty()?Gh.Empty:new Gh(null,this.children);var e=t.getFront(),n=this.children.get(e);if(n){var r=n.remove(t.popFront()),i=void 0;return i=r.isEmpty()?this.children.remove(e):this.children.insert(e,r),null===this.value&&i.isEmpty()?Gh.Empty:new Gh(this.value,i)}return this},Gh.prototype.get=function(t){if(t.isEmpty())return this.value;var e=t.getFront(),n=this.children.get(e);return n?n.get(t.popFront()):null},Gh.prototype.setTree=function(t,e){if(t.isEmpty())return e;var n=t.getFront(),r=(this.children.get(n)||Gh.Empty).setTree(t.popFront(),e),i=void 0;return i=r.isEmpty()?this.children.remove(n):this.children.insert(n,r),new Gh(this.value,i)},Gh.prototype.fold=function(t){return this.fold_(Lu.Empty,t)},Gh.prototype.fold_=function(n,r){var i={};return this.children.inorderTraversal(function(t,e){i[t]=e.fold_(n.child(t),r)}),r(n,this.value,i)},Gh.prototype.findOnPath=function(t,e){return this.findOnPath_(t,Lu.Empty,e)},Gh.prototype.findOnPath_=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(t.isEmpty())return null;var i=t.getFront(),o=this.children.get(i);return o?o.findOnPath_(t.popFront(),e.child(i),n):null},Gh.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,Lu.Empty,e)},Gh.prototype.foreachOnPath_=function(t,e,n){if(t.isEmpty())return this;this.value&&n(e,this.value);var r=t.getFront(),i=this.children.get(r);return i?i.foreachOnPath_(t.popFront(),e.child(r),n):Gh.Empty},Gh.prototype.foreach=function(t){this.foreach_(Lu.Empty,t)},Gh.prototype.foreach_=function(n,r){this.children.inorderTraversal(function(t,e){e.foreach_(n.child(t),r)}),this.value&&r(n,this.value)},Gh.prototype.foreachChild=function(n){this.children.inorderTraversal(function(t,e){e.value&&n(t,e.value)})},Gh.Empty=new Gh(null),Gh);function Gh(t,e){void 0===e&&(e=Bh=Bh||new qc(du)),this.value=t,this.children=e}var zh=(Qh.prototype.operationForChild=function(t){return this.path.isEmpty()?new Qh(this.source,Lu.Empty):new Qh(this.source,this.path.popFront())},Qh);function Qh(t,e){this.source=t,this.path=e,this.type=Mh.LISTEN_COMPLETE}var Xh=(Yh.prototype.operationForChild=function(t){return this.path.isEmpty()?new Yh(this.source,Lu.Empty,this.snap.getImmediateChild(t)):new Yh(this.source,this.path.popFront(),this.snap)},Yh);function Yh(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=Mh.OVERWRITE}var $h=(Jh.prototype.operationForChild=function(t){if(this.path.isEmpty()){var e=this.children.subtree(new Lu(t));return e.isEmpty()?null:e.value?new Xh(this.source,Lu.Empty,e.value):new Jh(this.source,Lu.Empty,e)}return Ds(this.path.getFront()===t,"Can't get a merge for a child not on the path of the operation"),new Jh(this.source,this.path.popFront(),this.children)},Jh.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},Jh);function Jh(t,e,n){this.source=t,this.path=e,this.children=n,this.type=Mh.MERGE}var Zh=(tl.prototype.isFullyInitialized=function(){return this.fullyInitialized_},tl.prototype.isFiltered=function(){return this.filtered_},tl.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&&!this.filtered_;var e=t.getFront();return this.isCompleteForChild(e)},tl.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},tl.prototype.getNode=function(){return this.node_},tl);function tl(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}var el=(nl.prototype.updateEventSnap=function(t,e,n){return new nl(new Zh(t,e,n),this.serverCache_)},nl.prototype.updateServerSnap=function(t,e,n){return new nl(this.eventCache_,new Zh(t,e,n))},nl.prototype.getEventCache=function(){return this.eventCache_},nl.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},nl.prototype.getServerCache=function(){return this.serverCache_},nl.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},nl.Empty=new nl(new Zh(eh.EMPTY_NODE,!1,!1),new Zh(eh.EMPTY_NODE,!1,!1)),nl);function nl(t,e){this.eventCache_=t,this.serverCache_=e}var rl=(il.valueChange=function(t){return new il(il.VALUE,t)},il.childAddedChange=function(t,e){return new il(il.CHILD_ADDED,e,t)},il.childRemovedChange=function(t,e){return new il(il.CHILD_REMOVED,e,t)},il.childChangedChange=function(t,e,n){return new il(il.CHILD_CHANGED,e,t,n)},il.childMovedChange=function(t,e){return new il(il.CHILD_MOVED,e,t)},il.CHILD_ADDED="child_added",il.CHILD_REMOVED="child_removed",il.CHILD_CHANGED="child_changed",il.CHILD_MOVED="child_moved",il.VALUE="value",il);function il(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}var ol=(sl.prototype.updateChild=function(t,e,n,r,i,o){Ds(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");var s=t.getImmediateChild(e);return s.getChild(r).equals(n.getChild(r))&&s.isEmpty()===n.isEmpty()?t:(null!=o&&(n.isEmpty()?t.hasChild(e)?o.trackChildChange(rl.childRemovedChange(e,s)):Ds(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(rl.childAddedChange(e,n)):o.trackChildChange(rl.childChangedChange(e,n,s))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},sl.prototype.updateFullNode=function(r,n,i){return null!=i&&(r.isLeafNode()||r.forEachChild(xc,function(t,e){n.hasChild(t)||i.trackChildChange(rl.childRemovedChange(t,e))}),n.isLeafNode()||n.forEachChild(xc,function(t,e){if(r.hasChild(t)){var n=r.getImmediateChild(t);n.equals(e)||i.trackChildChange(rl.childChangedChange(t,e,n))}else i.trackChildChange(rl.childAddedChange(t,e))})),n.withIndex(this.index_)},sl.prototype.updatePriority=function(t,e){return t.isEmpty()?eh.EMPTY_NODE:t.updatePriority(e)},sl.prototype.filtersNodes=function(){return!1},sl.prototype.getIndexedFilter=function(){return this},sl.prototype.getIndex=function(){return this.index_},sl);function sl(t){this.index_=t}var al=(ul.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;Ds(e===rl.CHILD_ADDED||e===rl.CHILD_CHANGED||e===rl.CHILD_REMOVED,"Only child changes supported for tracking"),Ds(".priority"!==n,"Only non-priority child changes can be tracked.");var r=this.changeMap.get(n);if(r){var i=r.type;if(e===rl.CHILD_ADDED&&i===rl.CHILD_REMOVED)this.changeMap.set(n,rl.childChangedChange(n,t.snapshotNode,r.snapshotNode));else if(e===rl.CHILD_REMOVED&&i===rl.CHILD_ADDED)this.changeMap.delete(n);else if(e===rl.CHILD_REMOVED&&i===rl.CHILD_CHANGED)this.changeMap.set(n,rl.childRemovedChange(n,r.oldSnap));else if(e===rl.CHILD_CHANGED&&i===rl.CHILD_ADDED)this.changeMap.set(n,rl.childAddedChange(n,t.snapshotNode));else{if(e!==rl.CHILD_CHANGED||i!==rl.CHILD_CHANGED)throw xs("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,rl.childChangedChange(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},ul.prototype.getChanges=function(){return Array.from(this.changeMap.values())},ul);function ul(){this.changeMap=new Map}function cl(){}var hl=new(cl.prototype.getCompleteChild=function(t){return null},cl.prototype.getChildAfterChild=function(t,e,n){return null},cl),ll=(fl.prototype.getCompleteChild=function(t){var e=this.viewCache_.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);var n=null!=this.optCompleteServerCache_?new Zh(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(t,n)},fl.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),i=this.writes_.calcIndexedSlice(r,e,1,n,t);return 0===i.length?null:i[0]},fl);function fl(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}var pl=function(t,e){this.viewCache=t,this.changes=e},dl=(vl.prototype.assertIndexed=function(t){Ds(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),Ds(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},vl.prototype.applyOperation=function(t,e,n,r){var i,o,s=new al;if(e.type===Mh.OVERWRITE){var a=e;i=a.source.fromUser?this.applyUserOverwrite_(t,a.path,a.snap,n,r,s):(Ds(a.source.fromServer,"Unknown source."),o=a.source.tagged||t.getServerCache().isFiltered()&&!a.path.isEmpty(),this.applyServerOverwrite_(t,a.path,a.snap,n,r,o,s))}else if(e.type===Mh.MERGE){var u=e;i=u.source.fromUser?this.applyUserMerge_(t,u.path,u.children,n,r,s):(Ds(u.source.fromServer,"Unknown source."),o=u.source.tagged||t.getServerCache().isFiltered(),this.applyServerMerge_(t,u.path,u.children,n,r,o,s))}else if(e.type===Mh.ACK_USER_WRITE){var c=e;i=c.revert?this.revertUserWrite_(t,c.path,n,r,s):this.ackUserWrite_(t,c.path,c.affectedTree,n,r,s)}else{if(e.type!==Mh.LISTEN_COMPLETE)throw xs("Unknown operation type: "+e.type);i=this.listenComplete_(t,e.path,n,s)}var h=s.getChanges();return vl.maybeAddValueEvent_(t,i,h),new pl(i,h)},vl.maybeAddValueEvent_=function(t,e,n){var r=e.getEventCache();if(r.isFullyInitialized()){var i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=t.getCompleteEventSnap();(0<n.length||!t.getEventCache().isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(rl.valueChange(e.getCompleteEventSnap()))}},vl.prototype.generateEventCacheAfterServerEvent_=function(t,e,n,r,i){var o=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var s=void 0,a=void 0;if(e.isEmpty())if(Ds(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()){var u=t.getCompleteServerSnap(),c=u instanceof eh?u:eh.EMPTY_NODE,h=n.calcCompleteEventChildren(c);s=this.filter_.updateFullNode(t.getEventCache().getNode(),h,i)}else{var l=n.calcCompleteEventCache(t.getCompleteServerSnap());s=this.filter_.updateFullNode(t.getEventCache().getNode(),l,i)}else{var f=e.getFront();if(".priority"===f){Ds(1===e.getLength(),"Can't have a priority with additional path components");var p=o.getNode();a=t.getServerCache().getNode();var d=n.calcEventCacheAfterServerOverwrite(e,p,a);s=null!=d?this.filter_.updatePriority(p,d):o.getNode()}else{var v=e.popFront(),y=void 0;if(o.isCompleteForChild(f)){a=t.getServerCache().getNode();var g=n.calcEventCacheAfterServerOverwrite(e,o.getNode(),a);y=null!=g?o.getNode().getImmediateChild(f).updateChild(v,g):o.getNode().getImmediateChild(f)}else y=n.calcCompleteChild(f,t.getServerCache());s=null!=y?this.filter_.updateChild(o.getNode(),f,y,v,r,i):o.getNode()}}return t.updateEventSnap(s,o.isFullyInitialized()||e.isEmpty(),this.filter_.filtersNodes())},vl.prototype.applyServerOverwrite_=function(t,e,n,r,i,o,s){var a,u=t.getServerCache(),c=o?this.filter_:this.filter_.getIndexedFilter();if(e.isEmpty())a=c.updateFullNode(u.getNode(),n,null);else if(c.filtersNodes()&&!u.isFiltered()){var h=u.getNode().updateChild(e,n);a=c.updateFullNode(u.getNode(),h,null)}else{var l=e.getFront();if(!u.isCompleteForPath(e)&&1<e.getLength())return t;var f=e.popFront(),p=u.getNode().getImmediateChild(l).updateChild(f,n);a=".priority"===l?c.updatePriority(u.getNode(),p):c.updateChild(u.getNode(),l,p,f,hl,null)}var d=t.updateServerSnap(a,u.isFullyInitialized()||e.isEmpty(),c.filtersNodes()),v=new ll(r,d,i);return this.generateEventCacheAfterServerEvent_(d,e,r,v,s)},vl.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var s,a,u=t.getEventCache(),c=new ll(r,t,i);if(e.isEmpty())a=this.filter_.updateFullNode(t.getEventCache().getNode(),n,o),s=t.updateEventSnap(a,!0,this.filter_.filtersNodes());else{var h=e.getFront();if(".priority"===h)a=this.filter_.updatePriority(t.getEventCache().getNode(),n),s=t.updateEventSnap(a,u.isFullyInitialized(),u.isFiltered());else{var l=e.popFront(),f=u.getNode().getImmediateChild(h),p=void 0;if(l.isEmpty())p=n;else{var d=c.getCompleteChild(h);p=null!=d?".priority"===l.getBack()&&d.getChild(l.parent()).isEmpty()?d:d.updateChild(l,n):eh.EMPTY_NODE}if(f.equals(p))s=t;else{var v=this.filter_.updateChild(u.getNode(),h,p,l,c,o);s=t.updateEventSnap(v,u.isFullyInitialized(),this.filter_.filtersNodes())}}}return s},vl.cacheHasChild_=function(t,e){return t.getEventCache().isCompleteForChild(e)},vl.prototype.applyUserMerge_=function(r,i,t,o,s,a){var u=this,c=r;return t.foreach(function(t,e){var n=i.child(t);vl.cacheHasChild_(r,n.getFront())&&(c=u.applyUserOverwrite_(c,n,e,o,s,a))}),t.foreach(function(t,e){var n=i.child(t);vl.cacheHasChild_(r,n.getFront())||(c=u.applyUserOverwrite_(c,n,e,o,s,a))}),c},vl.prototype.applyMerge_=function(n,t){return t.foreach(function(t,e){n=n.updateChild(t,e)}),n},vl.prototype.applyServerMerge_=function(o,t,e,s,a,u,c){var h=this;if(o.getServerCache().getNode().isEmpty()&&!o.getServerCache().isFullyInitialized())return o;var n,l=o;n=t.isEmpty()?e:Kh.Empty.setTree(t,e);var f=o.getServerCache().getNode();return n.children.inorderTraversal(function(t,e){if(f.hasChild(t)){var n=o.getServerCache().getNode().getImmediateChild(t),r=h.applyMerge_(n,e);l=h.applyServerOverwrite_(l,new Lu(t),r,s,a,u,c)}}),n.children.inorderTraversal(function(t,e){var n=!o.getServerCache().isCompleteForChild(t)&&null==e.value;if(!f.hasChild(t)&&!n){var r=o.getServerCache().getNode().getImmediateChild(t),i=h.applyMerge_(r,e);l=h.applyServerOverwrite_(l,new Lu(t),i,s,a,u,c)}}),l},vl.prototype.ackUserWrite_=function(t,r,e,n,i,o){if(null!=n.shadowingWrite(r))return t;var s=t.getServerCache().isFiltered(),a=t.getServerCache();if(null!=e.value){if(r.isEmpty()&&a.isFullyInitialized()||a.isCompleteForPath(r))return this.applyServerOverwrite_(t,r,a.getNode().getChild(r),n,i,s,o);if(r.isEmpty()){var u=Kh.Empty;return a.getNode().forEachChild(Tc,function(t,e){u=u.set(new Lu(t),e)}),this.applyServerMerge_(t,r,u,n,i,s,o)}return t}var c=Kh.Empty;return e.foreach(function(t,e){var n=r.child(t);a.isCompleteForPath(n)&&(c=c.set(t,a.getNode().getChild(n)))}),this.applyServerMerge_(t,r,c,n,i,s,o)},vl.prototype.listenComplete_=function(t,e,n,r){var i=t.getServerCache(),o=t.updateServerSnap(i.getNode(),i.isFullyInitialized()||e.isEmpty(),i.isFiltered());return this.generateEventCacheAfterServerEvent_(o,e,n,hl,r)},vl.prototype.revertUserWrite_=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var s=new ll(n,t,r),a=t.getEventCache().getNode(),u=void 0;if(e.isEmpty()||".priority"===e.getFront()){var c=void 0;if(t.getServerCache().isFullyInitialized())c=n.calcCompleteEventCache(t.getCompleteServerSnap());else{var h=t.getServerCache().getNode();Ds(h instanceof eh,"serverChildren would be complete if leaf node"),c=n.calcCompleteEventChildren(h)}c=c,u=this.filter_.updateFullNode(a,c,i)}else{var l=e.getFront(),f=n.calcCompleteChild(l,t.getServerCache());null==f&&t.getServerCache().isCompleteForChild(l)&&(f=a.getImmediateChild(l)),(u=null!=f?this.filter_.updateChild(a,l,f,e.popFront(),s,i):t.getEventCache().getNode().hasChild(l)?this.filter_.updateChild(a,l,eh.EMPTY_NODE,e.popFront(),s,i):a).isEmpty()&&t.getServerCache().isFullyInitialized()&&(o=n.calcCompleteEventCache(t.getCompleteServerSnap())).isLeafNode()&&(u=this.filter_.updateFullNode(u,o,i))}return o=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(Lu.Empty),t.updateEventSnap(u,o,this.filter_.filtersNodes())},vl);function vl(t){this.filter_=t}var yl=(gl.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach(function(t){t.type===rl.CHILD_CHANGED&&r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(rl.childMovedChange(t.childName,t.snapshotNode))}),this.generateEventsForType_(i,rl.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,rl.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,rl.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,rl.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,rl.VALUE,t,n,e),i},gl.prototype.generateEventsForType_=function(r,e,t,i,o){var s=this,n=t.filter(function(t){return t.type===e});n.sort(this.compareChanges_.bind(this)),n.forEach(function(e){var n=s.materializeSingleChange_(e,o);i.forEach(function(t){t.respondsTo(e.type)&&r.push(t.createEvent(n,s.query_))})})},gl.prototype.materializeSingleChange_=function(t,e){return"value"===t.type||"child_removed"===t.type||(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_)),t},gl.prototype.compareChanges_=function(t,e){if(null==t.childName||null==e.childName)throw xs("Should only compare child_ events.");var n=new vc(t.childName,t.snapshotNode),r=new vc(e.childName,e.snapshotNode);return this.index_.compare(n,r)},gl);function gl(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()}var ml,bl=(wl.prototype.getQuery=function(){return this.query_},wl.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},wl.prototype.getCompleteServerCache=function(t){var e=this.viewCache_.getCompleteServerSnap();return e&&(this.query_.getQueryParams().loadsAllData()||!t.isEmpty()&&!e.getImmediateChild(t.getFront()).isEmpty())?e.getChild(t):null},wl.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},wl.prototype.addEventRegistration=function(t){this.eventRegistrations_.push(t)},wl.prototype.removeEventRegistration=function(t,n){var r=[];if(n){Ds(null==t,"A cancel should cancel all event registrations.");var i=this.query_.path;this.eventRegistrations_.forEach(function(t){n=n;var e=t.createCancelEvent(n,i);e&&r.push(e)})}if(t){for(var e=[],o=0;o<this.eventRegistrations_.length;++o){var s=this.eventRegistrations_[o];if(s.matches(t)){if(t.hasAnyCallback()){e=e.concat(this.eventRegistrations_.slice(o+1));break}}else e.push(s)}this.eventRegistrations_=e}else this.eventRegistrations_=[];return r},wl.prototype.applyOperation=function(t,e,n){t.type===Mh.MERGE&&null!==t.source.queryId&&(Ds(this.viewCache_.getCompleteServerSnap(),"We should always have a full cache before handling merges"),Ds(this.viewCache_.getCompleteEventSnap(),"Missing event cache, even though we have a server cache"));var r=this.viewCache_,i=this.processor_.applyOperation(r,t,e,n);return this.processor_.assertIndexed(i.viewCache),Ds(i.viewCache.getServerCache().isFullyInitialized()||!r.getServerCache().isFullyInitialized(),"Once a server snap is complete, it should never go back"),this.viewCache_=i.viewCache,this.generateEventsForChanges_(i.changes,i.viewCache.getEventCache().getNode(),null)},wl.prototype.getInitialEvents=function(t){var e=this.viewCache_.getEventCache(),n=[];return e.getNode().isLeafNode()||e.getNode().forEachChild(xc,function(t,e){n.push(rl.childAddedChange(t,e))}),e.isFullyInitialized()&&n.push(rl.valueChange(e.getNode())),this.generateEventsForChanges_(n,e.getNode(),t)},wl.prototype.generateEventsForChanges_=function(t,e,n){var r=n?[n]:this.eventRegistrations_;return this.eventGenerator_.generateEventsForChanges(t,e,r)},wl);function wl(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new ol(n.getIndex()),i=n.getNodeFilter();this.processor_=new dl(i);var o=e.getServerCache(),s=e.getEventCache(),a=r.updateFullNode(eh.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode(eh.EMPTY_NODE,s.getNode(),null),c=new Zh(a,o.isFullyInitialized(),r.filtersNodes()),h=new Zh(u,s.isFullyInitialized(),i.filtersNodes());this.viewCache_=new el(h,c),this.eventGenerator_=new yl(this.query_)}var _l=(Object.defineProperty(El,"__referenceConstructor",{get:function(){return Ds(ml,"Reference.ts has not been loaded"),ml},set:function(t){Ds(!ml,"__referenceConstructor has already been defined"),ml=t},enumerable:!1,configurable:!0}),El.prototype.isEmpty=function(){return 0===this.views.size},El.prototype.applyOperation=function(t,e,n){var r,i,o=t.source.queryId;if(null!==o){var s=this.views.get(o);return Ds(null!=s,"SyncTree gave us an op for an invalid query."),s.applyOperation(t,e,n)}var a=[];try{for(var u=Cs(this.views.values()),c=u.next();!c.done;c=u.next())s=c.value,a=a.concat(s.applyOperation(t,e,n))}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return a},El.prototype.addEventRegistration=function(t,e,n,r,i){var o=t.queryIdentifier(),s=this.views.get(o);if(!s){var a=n.calcCompleteEventCache(i?r:null),u=!1;u=!!a||(a=r instanceof eh?n.calcCompleteEventChildren(r):eh.EMPTY_NODE,!1);var c=new el(new Zh(a,u,!1),new Zh(r,i,!1));s=new bl(t,c),this.views.set(o,s)}return s.addEventRegistration(e),s.getInitialEvents(e)},El.prototype.removeEventRegistration=function(t,e,n){var r,i,o=t.queryIdentifier(),s=[],a=[],u=this.hasCompleteView();if("default"===o)try{for(var c=Cs(this.views.entries()),h=c.next();!h.done;h=c.next()){var l=Ns(h.value,2),f=l[0],p=l[1];a=a.concat(p.removeEventRegistration(e,n)),p.isEmpty()&&(this.views.delete(f),p.getQuery().getQueryParams().loadsAllData()||s.push(p.getQuery()))}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}else(p=this.views.get(o))&&(a=a.concat(p.removeEventRegistration(e,n)),p.isEmpty()&&(this.views.delete(o),p.getQuery().getQueryParams().loadsAllData()||s.push(p.getQuery())));return u&&!this.hasCompleteView()&&s.push(new El.__referenceConstructor(t.repo,t.path)),{removed:s,events:a}},El.prototype.getQueryViews=function(){var e,t,n=[];try{for(var r=Cs(this.views.values()),i=r.next();!i.done;i=r.next()){var o=i.value;o.getQuery().getQueryParams().loadsAllData()||n.push(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},El.prototype.getCompleteServerCache=function(t){var e,n,r=null;try{for(var i=Cs(this.views.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r||s.getCompleteServerCache(t)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},El.prototype.viewForQuery=function(t){if(t.getQueryParams().loadsAllData())return this.getCompleteView();var e=t.queryIdentifier();return this.views.get(e)},El.prototype.viewExistsForQuery=function(t){return null!=this.viewForQuery(t)},El.prototype.hasCompleteView=function(){return null!=this.getCompleteView()},El.prototype.getCompleteView=function(){var e,t;try{for(var n=Cs(this.views.values()),r=n.next();!r.done;r=n.next()){var i=r.value;if(i.getQuery().getQueryParams().loadsAllData())return i}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},El);function El(){this.views=new Map}var Il=(Tl.prototype.addWrite=function(t,e){if(t.isEmpty())return new Tl(new Kh(e));var n=this.writeTree_.findRootMostValueAndPath(t);if(null!=n){var r=n.path,i=n.value,o=Lu.relativePath(r,t);return i=i.updateChild(o,e),new Tl(this.writeTree_.set(r,i))}var s=new Kh(e);return new Tl(this.writeTree_.setTree(t,s))},Tl.prototype.addWrites=function(n,t){var r=this;return ku(t,function(t,e){r=r.addWrite(n.child(t),e)}),r},Tl.prototype.removeWrite=function(t){return t.isEmpty()?Tl.Empty:new Tl(this.writeTree_.setTree(t,Kh.Empty))},Tl.prototype.hasCompleteWrite=function(t){return null!=this.getCompleteNode(t)},Tl.prototype.getCompleteNode=function(t){var e=this.writeTree_.findRootMostValueAndPath(t);return null!=e?this.writeTree_.get(e.path).getChild(Lu.relativePath(e.path,t)):null},Tl.prototype.getCompleteChildren=function(){var n=[],t=this.writeTree_.value;return null!=t?t.isLeafNode()||t.forEachChild(xc,function(t,e){n.push(new vc(t,e))}):this.writeTree_.children.inorderTraversal(function(t,e){null!=e.value&&n.push(new vc(t,e.value))}),n},Tl.prototype.childCompoundWrite=function(t){if(t.isEmpty())return this;var e=this.getCompleteNode(t);return new Tl(null!=e?new Kh(e):this.writeTree_.subtree(t))},Tl.prototype.isEmpty=function(){return this.writeTree_.isEmpty()},Tl.prototype.apply=function(t){return function n(r,t,i){if(null!=t.value)return i.updateChild(r,t.value);var o=null;return t.children.inorderTraversal(function(t,e){".priority"===t?(Ds(null!==e.value,"Priority writes must always be leaf nodes"),o=e.value):i=n(r.child(t),e,i)}),i.getChild(r).isEmpty()||null===o||(i=i.updateChild(r.child(".priority"),o)),i}(Lu.Empty,this.writeTree_,t)},Tl.Empty=new Tl(new Kh(null)),Tl);function Tl(t){this.writeTree_=t}var Sl=(Cl.prototype.childWrites=function(t){return new Nl(t,this)},Cl.prototype.addOverwrite=function(t,e,n,r){Ds(n>this.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.allWrites_.push({path:t,snap:e,writeId:n,visible:r}),r&&(this.visibleWrites_=this.visibleWrites_.addWrite(t,e)),this.lastWriteId_=n},Cl.prototype.addMerge=function(t,e,n){Ds(n>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:t,children:e,writeId:n,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(t,e),this.lastWriteId_=n},Cl.prototype.getWrite=function(t){for(var e=0;e<this.allWrites_.length;e++){var n=this.allWrites_[e];if(n.writeId===t)return n}return null},Cl.prototype.removeWrite=function(e){var n=this,t=this.allWrites_.findIndex(function(t){return t.writeId===e});Ds(0<=t,"removeWrite called with nonexistent writeId.");var r=this.allWrites_[t];this.allWrites_.splice(t,1);for(var i=r.visible,o=!1,s=this.allWrites_.length-1;i&&0<=s;){var a=this.allWrites_[s];a.visible&&(t<=s&&this.recordContainsPath_(a,r.path)?i=!1:r.path.contains(a.path)&&(o=!0)),s--}return!!i&&(o?this.resetTree_():r.snap?this.visibleWrites_=this.visibleWrites_.removeWrite(r.path):ku(r.children,function(t){n.visibleWrites_=n.visibleWrites_.removeWrite(r.path.child(t))}),!0)},Cl.prototype.getCompleteWriteData=function(t){return this.visibleWrites_.getCompleteNode(t)},Cl.prototype.calcCompleteEventCache=function(e,t,n,r){if(n||r){var i=this.visibleWrites_.childCompoundWrite(e);if(!r&&i.isEmpty())return t;if(r||null!=t||i.hasCompleteWrite(Lu.Empty)){var o=Cl.layerTree_(this.allWrites_,function(t){return(t.visible||r)&&(!n||!~n.indexOf(t.writeId))&&(t.path.contains(e)||e.contains(t.path))},e);return u=t||eh.EMPTY_NODE,o.apply(u)}return null}var s=this.visibleWrites_.getCompleteNode(e);if(null!=s)return s;var a=this.visibleWrites_.childCompoundWrite(e);if(a.isEmpty())return t;if(null!=t||a.hasCompleteWrite(Lu.Empty)){var u=t||eh.EMPTY_NODE;return a.apply(u)}return null},Cl.prototype.calcCompleteEventChildren=function(t,e){var r=eh.EMPTY_NODE,n=this.visibleWrites_.getCompleteNode(t);if(n)return n.isLeafNode()||n.forEachChild(xc,function(t,e){r=r.updateImmediateChild(t,e)}),r;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(xc,function(t,e){var n=i.childCompoundWrite(new Lu(t)).apply(e);r=r.updateImmediateChild(t,n)}),i.getCompleteChildren().forEach(function(t){r=r.updateImmediateChild(t.name,t.node)}),r}return this.visibleWrites_.childCompoundWrite(t).getCompleteChildren().forEach(function(t){r=r.updateImmediateChild(t.name,t.node)}),r},Cl.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){Ds(n||r,"Either existingEventSnap or existingServerSnap must exist");var i=t.child(e);if(this.visibleWrites_.hasCompleteWrite(i))return null;var o=this.visibleWrites_.childCompoundWrite(i);return o.isEmpty()?r.getChild(e):o.apply(r.getChild(e))},Cl.prototype.calcCompleteChild=function(t,e,n){var r=t.child(e),i=this.visibleWrites_.getCompleteNode(r);return null!=i?i:n.isCompleteForChild(e)?this.visibleWrites_.childCompoundWrite(r).apply(n.getNode().getImmediateChild(e)):null},Cl.prototype.shadowingWrite=function(t){return this.visibleWrites_.getCompleteNode(t)},Cl.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var s,a=this.visibleWrites_.childCompoundWrite(t),u=a.getCompleteNode(Lu.Empty);if(null!=u)s=u;else{if(null==e)return[];s=a.apply(e)}if((s=s.withIndex(o)).isEmpty()||s.isLeafNode())return[];for(var c=[],h=o.getCompare(),l=i?s.getReverseIteratorFrom(n,o):s.getIteratorFrom(n,o),f=l.getNext();f&&c.length<r;)0!==h(f,n)&&c.push(f),f=l.getNext();return c},Cl.prototype.recordContainsPath_=function(t,e){if(t.snap)return t.path.contains(e);for(var n in t.children)if(t.children.hasOwnProperty(n)&&t.path.child(n).contains(e))return!0;return!1},Cl.prototype.resetTree_=function(){this.visibleWrites_=Cl.layerTree_(this.allWrites_,Cl.DefaultFilter_,Lu.Empty),0<this.allWrites_.length?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},Cl.DefaultFilter_=function(t){return t.visible},Cl.layerTree_=function(t,e,n){for(var r=Il.Empty,i=0;i<t.length;++i){var o=t[i];if(e(o)){var s=o.path,a=void 0;if(o.snap)n.contains(s)?(a=Lu.relativePath(n,s),r=r.addWrite(a,o.snap)):s.contains(n)&&(a=Lu.relativePath(s,n),r=r.addWrite(Lu.Empty,o.snap.getChild(a)));else{if(!o.children)throw xs("WriteRecord should have .snap or .children");if(n.contains(s))a=Lu.relativePath(n,s),r=r.addWrites(a,o.children);else if(s.contains(n))if((a=Lu.relativePath(s,n)).isEmpty())r=r.addWrites(Lu.Empty,o.children);else{var u=ra(o.children,a.getFront());if(u){var c=u.getChild(a.popFront());r=r.addWrite(Lu.Empty,c)}}}}}return r},Cl);function Cl(){this.visibleWrites_=Il.Empty,this.allWrites_=[],this.lastWriteId_=-1}var Nl=(Al.prototype.calcCompleteEventCache=function(t,e,n){return this.writeTree_.calcCompleteEventCache(this.treePath_,t,e,n)},Al.prototype.calcCompleteEventChildren=function(t){return this.writeTree_.calcCompleteEventChildren(this.treePath_,t)},Al.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n){return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_,t,e,n)},Al.prototype.shadowingWrite=function(t){return this.writeTree_.shadowingWrite(this.treePath_.child(t))},Al.prototype.calcIndexedSlice=function(t,e,n,r,i){return this.writeTree_.calcIndexedSlice(this.treePath_,t,e,n,r,i)},Al.prototype.calcCompleteChild=function(t,e){return this.writeTree_.calcCompleteChild(this.treePath_,t,e)},Al.prototype.child=function(t){return new Al(this.treePath_.child(t),this.writeTree_)},Al);function Al(t,e){this.treePath_=t,this.writeTree_=e}var kl=(Ol.prototype.applyUserOverwrite=function(t,e,n,r){return this.pendingWriteTree_.addOverwrite(t,e,n,r),r?this.applyOperationToSyncPoints_(new Xh(Vh.User,t,e)):[]},Ol.prototype.applyUserMerge=function(t,e,n){this.pendingWriteTree_.addMerge(t,e,n);var r=Kh.fromObject(e);return this.applyOperationToSyncPoints_(new $h(Vh.User,t,r))},Ol.prototype.ackUserWrite=function(t,e){void 0===e&&(e=!1);var n=this.pendingWriteTree_.getWrite(t);if(this.pendingWriteTree_.removeWrite(t)){var r=Kh.Empty;return null!=n.snap?r=r.set(Lu.Empty,!0):ku(n.children,function(t,e){r=r.set(new Lu(t),e)}),this.applyOperationToSyncPoints_(new Wh(n.path,r,e))}return[]},Ol.prototype.applyServerOverwrite=function(t,e){return this.applyOperationToSyncPoints_(new Xh(Vh.Server,t,e))},Ol.prototype.applyServerMerge=function(t,e){var n=Kh.fromObject(e);return this.applyOperationToSyncPoints_(new $h(Vh.Server,t,n))},Ol.prototype.applyListenComplete=function(t){return this.applyOperationToSyncPoints_(new zh(Vh.Server,t))},Ol.prototype.applyTaggedQueryOverwrite=function(t,e,n){var r=this.queryKeyForTag_(n);if(null==r)return[];var i=Ol.parseQueryKey_(r),o=i.path,s=i.queryId,a=Lu.relativePath(o,t),u=new Xh(Vh.forServerTaggedQuery(s),a,e);return this.applyTaggedOperation_(o,u)},Ol.prototype.applyTaggedQueryMerge=function(t,e,n){var r=this.queryKeyForTag_(n);if(r){var i=Ol.parseQueryKey_(r),o=i.path,s=i.queryId,a=Lu.relativePath(o,t),u=Kh.fromObject(e),c=new $h(Vh.forServerTaggedQuery(s),a,u);return this.applyTaggedOperation_(o,c)}return[]},Ol.prototype.applyTaggedListenComplete=function(t,e){var n=this.queryKeyForTag_(e);if(n){var r=Ol.parseQueryKey_(n),i=r.path,o=r.queryId,s=Lu.relativePath(i,t),a=new zh(Vh.forServerTaggedQuery(o),s);return this.applyTaggedOperation_(i,a)}return[]},Ol.prototype.addEventRegistration=function(t,e){var r=t.path,i=null,o=!1;this.syncPointTree_.foreachOnPath(r,function(t,e){var n=Lu.relativePath(t,r);i=i||e.getCompleteServerCache(n),o=o||e.hasCompleteView()});var n,s=this.syncPointTree_.get(r);s?(o=o||s.hasCompleteView(),i=i||s.getCompleteServerCache(Lu.Empty)):(s=new _l,this.syncPointTree_=this.syncPointTree_.set(r,s)),null!=i?n=!0:(n=!1,i=eh.EMPTY_NODE,this.syncPointTree_.subtree(r).foreachChild(function(t,e){var n=e.getCompleteServerCache(Lu.Empty);n&&(i=i.updateImmediateChild(t,n))}));var a=s.viewExistsForQuery(t);if(!a&&!t.getQueryParams().loadsAllData()){var u=Ol.makeQueryKey_(t);Ds(!this.queryToTagMap.has(u),"View does not exist, but we have a tag");var c=Ol.getNextQueryTag_();this.queryToTagMap.set(u,c),this.tagToQueryMap.set(c,u)}var h=this.pendingWriteTree_.childWrites(r),l=s.addEventRegistration(t,e,h,i,n);if(!a&&!o){var f=s.viewForQuery(t);l=l.concat(this.setupListener_(t,f))}return l},Ol.prototype.removeEventRegistration=function(t,e,n){var r=this,i=t.path,o=this.syncPointTree_.get(i),s=[];if(o&&("default"===t.queryIdentifier()||o.viewExistsForQuery(t))){var a=o.removeEventRegistration(t,e,n);o.isEmpty()&&(this.syncPointTree_=this.syncPointTree_.remove(i));var u=a.removed;s=a.events;var c=-1!==u.findIndex(function(t){return t.getQueryParams().loadsAllData()}),h=this.syncPointTree_.findOnPath(i,function(t,e){return e.hasCompleteView()});if(c&&!h){var l=this.syncPointTree_.subtree(i);if(!l.isEmpty())for(var f=this.collectDistinctViewsForSubTree_(l),p=0;p<f.length;++p){var d=f[p],v=d.getQuery(),y=this.createListenerForView_(d);this.listenProvider_.startListening(Ol.queryForListening_(v),this.tagForQuery_(v),y.hashFn,y.onComplete)}}!h&&0<u.length&&!n&&(c?this.listenProvider_.stopListening(Ol.queryForListening_(t),null):u.forEach(function(t){var e=r.queryToTagMap.get(Ol.makeQueryKey_(t));r.listenProvider_.stopListening(Ol.queryForListening_(t),e)})),this.removeTags_(u)}return s},Ol.prototype.calcCompleteEventCache=function(i,t){var e=this.pendingWriteTree_,n=this.syncPointTree_.findOnPath(i,function(t,e){var n=Lu.relativePath(t,i),r=e.getCompleteServerCache(n);if(r)return r});return e.calcCompleteEventCache(i,n,t,!0)},Ol.prototype.collectDistinctViewsForSubTree_=function(t){return t.fold(function(t,e,n){if(e&&e.hasCompleteView())return[e.getCompleteView()];var r=[];return e&&(r=e.getQueryViews()),ku(n,function(t,e){r=r.concat(e)}),r})},Ol.prototype.removeTags_=function(t){for(var e=0;e<t.length;++e){var n=t[e];if(!n.getQueryParams().loadsAllData()){var r=Ol.makeQueryKey_(n),i=this.queryToTagMap.get(r);this.queryToTagMap.delete(r),this.tagToQueryMap.delete(i)}}},Ol.queryForListening_=function(t){return t.getQueryParams().loadsAllData()&&!t.getQueryParams().isDefault()?t.getRef():t},Ol.prototype.setupListener_=function(t,e){var n=t.path,r=this.tagForQuery_(t),i=this.createListenerForView_(e),o=this.listenProvider_.startListening(Ol.queryForListening_(t),r,i.hashFn,i.onComplete),s=this.syncPointTree_.subtree(n);if(r)Ds(!s.value.hasCompleteView(),"If we're adding a query, it shouldn't be shadowed");else for(var a=s.fold(function(t,e,n){if(!t.isEmpty()&&e&&e.hasCompleteView())return[e.getCompleteView().getQuery()];var r=[];return e&&(r=r.concat(e.getQueryViews().map(function(t){return t.getQuery()}))),ku(n,function(t,e){r=r.concat(e)}),r}),u=0;u<a.length;++u){var c=a[u];this.listenProvider_.stopListening(Ol.queryForListening_(c),this.tagForQuery_(c))}return o},Ol.prototype.createListenerForView_=function(t){var n=this,r=t.getQuery(),i=this.tagForQuery_(r);return{hashFn:function(){return(t.getServerCache()||eh.EMPTY_NODE).hash()},onComplete:function(t){if("ok"===t)return i?n.applyTaggedListenComplete(r.path,i):n.applyListenComplete(r.path);var e=function(t,e){var n="Unknown Error";"too_big"===t?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"===t?n="Client doesn't have permission to access the desired data.":"unavailable"===t&&(n="The service is unavailable");var r=new Error(t+" at "+e.path.toString()+": "+n);return r.code=t.toUpperCase(),r}(t,r);return n.removeEventRegistration(r,null,e)}}},Ol.makeQueryKey_=function(t){return t.path.toString()+"$"+t.queryIdentifier()},Ol.parseQueryKey_=function(t){var e=t.indexOf("$");return Ds(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new Lu(t.substr(0,e))}},Ol.prototype.queryKeyForTag_=function(t){return this.tagToQueryMap.get(t)},Ol.prototype.tagForQuery_=function(t){var e=Ol.makeQueryKey_(t);return this.queryToTagMap.get(e)},Ol.getNextQueryTag_=function(){return Ol.nextQueryTag_++},Ol.prototype.applyTaggedOperation_=function(t,e){var n=this.syncPointTree_.get(t);Ds(n,"Missing sync point for query tag that we're tracking");var r=this.pendingWriteTree_.childWrites(t);return n.applyOperation(e,r,null)},Ol.prototype.applyOperationToSyncPoints_=function(t){return this.applyOperationHelper_(t,this.syncPointTree_,null,this.pendingWriteTree_.childWrites(Lu.Empty))},Ol.prototype.applyOperationHelper_=function(t,e,n,r){if(t.path.isEmpty())return this.applyOperationDescendantsHelper_(t,e,n,r);var i=e.get(Lu.Empty);null==n&&null!=i&&(n=i.getCompleteServerCache(Lu.Empty));var o=[],s=t.path.getFront(),a=t.operationForChild(s),u=e.children.get(s);if(u&&a){var c=n?n.getImmediateChild(s):null,h=r.child(s);o=o.concat(this.applyOperationHelper_(a,u,c,h))}return i&&(o=o.concat(i.applyOperation(t,r,n))),o},Ol.prototype.applyOperationDescendantsHelper_=function(o,t,s,a){var u=this,e=t.get(Lu.Empty);null==s&&null!=e&&(s=e.getCompleteServerCache(Lu.Empty));var c=[];return t.children.inorderTraversal(function(t,e){var n=s?s.getImmediateChild(t):null,r=a.child(t),i=o.operationForChild(t);i&&(c=c.concat(u.applyOperationDescendantsHelper_(i,e,n,r)))}),e&&(c=c.concat(e.applyOperation(o,a,s))),c},Ol.nextQueryTag_=1,Ol);function Ol(t){this.listenProvider_=t,this.syncPointTree_=Kh.Empty,this.pendingWriteTree_=new Sl,this.tagToQueryMap=new Map,this.queryToTagMap=new Map}var Pl=(Rl.prototype.getNode=function(t){return this.rootNode_.getChild(t)},Rl.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},Rl);function Rl(){this.rootNode_=eh.EMPTY_NODE}var Dl=(xl.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),na(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},xl.prototype.get=function(){return Ms(this.counters_)},xl);function xl(){this.counters_={}}var Ll=(Ml.getCollection=function(t){var e=t.toString();return this.collections_[e]||(this.collections_[e]=new Dl),this.collections_[e]},Ml.getOrCreateReporter=function(t,e){var n=t.toString();return this.reporters_[n]||(this.reporters_[n]=e()),this.reporters_[n]},Ml.collections_={},Ml.reporters_={},Ml);function Ml(){}var Fl=(Ul.prototype.get=function(){var t=this.collection_.get(),n=Is({},t);return this.last_&&ku(this.last_,function(t,e){n[t]=n[t]-e}),this.last_=t,n},Ul);function Ul(t){this.collection_=t,this.last_=null}var jl=(Vl.prototype.includeStat=function(t){this.statsToReport_[t]=!0},Vl.prototype.reportStats_=function(){var n=this,t=this.statsListener_.get(),r={},i=!1;ku(t,function(t,e){0<e&&na(n.statsToReport_,t)&&(r[t]=e,i=!0)}),i&&this.server_.reportStats(r),Ru(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},Vl);function Vl(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Fl(t);var n=1e4+2e4*Math.random();Ru(this.reportStats_.bind(this),Math.floor(n))}var ql=(Bl.prototype.queueEvents=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n],i=r.getPath();null===e||i.equals(e.getPath())||(this.eventLists_.push(e),e=null),null===e&&(e=new Wl(i)),e.add(r)}e&&this.eventLists_.push(e)},Bl.prototype.raiseEventsAtPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_(function(t){return t.equals(e)})},Bl.prototype.raiseEventsForChangedPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_(function(t){return t.contains(e)||e.contains(t)})},Bl.prototype.raiseQueuedEventsMatchingPredicate_=function(t){this.recursionDepth_++;for(var e=!0,n=0;n<this.eventLists_.length;n++){var r=this.eventLists_[n];r&&(t(r.getPath())?(this.eventLists_[n].raise(),this.eventLists_[n]=null):e=!1)}e&&(this.eventLists_=[]),this.recursionDepth_--},Bl);function Bl(){this.eventLists_=[],this.recursionDepth_=0}var Wl=(Hl.prototype.add=function(t){this.events_.push(t)},Hl.prototype.raise=function(){for(var t=0;t<this.events_.length;t++){var e=this.events_[t];if(null!==e){this.events_[t]=null;var n=e.getEventRunner();Iu&&uu("event: "+e.toString()),Pu(n)}}},Hl.prototype.getPath=function(){return this.path_},Hl);function Hl(t){this.path_=t,this.events_=[]}var Kl=(Gl.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(Array.isArray(this.listeners_[t]))for(var r=As(this.listeners_[t]),i=0;i<r.length;i++)r[i].callback.apply(r[i].context,e)},Gl.prototype.on=function(t,e,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:e,context:n});var r=this.getInitialEvent(t);r&&e.apply(n,r)},Gl.prototype.off=function(t,e,n){this.validateEventType_(t);for(var r=this.listeners_[t]||[],i=0;i<r.length;i++)if(r[i].callback===e&&(!n||n===r[i].context))return void r.splice(i,1)},Gl.prototype.validateEventType_=function(e){Ds(this.allowedEvents_.find(function(t){return t===e}),"Unknown event: "+e)},Gl);function Gl(t){this.allowedEvents_=t,this.listeners_={},Ds(Array.isArray(t)&&0<t.length,"Requires a non-empty array")}var Ql,Xl=(Es(Yl,Ql=Kl),Yl.getInstance=function(){return new Yl},Yl.prototype.getInitialEvent=function(t){return Ds("visible"===t,"Unknown event type: "+t),[this.visible_]},Yl);function Yl(){var e,t,n=Ql.call(this,["visible"])||this;return"undefined"!=typeof document&&void 0!==document.addEventListener&&(void 0!==document.hidden?(t="visibilitychange",e="hidden"):void 0!==document.mozHidden?(t="mozvisibilitychange",e="mozHidden"):void 0!==document.msHidden?(t="msvisibilitychange",e="msHidden"):void 0!==document.webkitHidden&&(t="webkitvisibilitychange",e="webkitHidden")),n.visible_=!0,t&&document.addEventListener(t,function(){var t=!document[e];t!==n.visible_&&(n.visible_=t,n.trigger("visible",t))},!1),n}var $l,Jl=(Es(Zl,$l=Kl),Zl.getInstance=function(){return new Zl},Zl.prototype.getInitialEvent=function(t){return Ds("online"===t,"Unknown event type: "+t),[this.online_]},Zl.prototype.currentlyOnline=function(){return this.online_},Zl);function Zl(){var t=$l.call(this,["online"])||this;return t.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||qs()||(window.addEventListener("online",function(){t.online_||(t.online_=!0,t.trigger("online",!0))},!1),window.addEventListener("offline",function(){t.online_&&(t.online_=!1,t.trigger("online",!1))},!1)),t}var tf=(ef.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},ef.prototype.handleResponse=function(t,e){var r=this;this.pendingResponses[t]=e;for(var n=function(){var e=i.pendingResponses[i.currentResponseNum];delete i.pendingResponses[i.currentResponseNum];for(var t=function(t){e[t]&&Pu(function(){r.onMessage_(e[t])})},n=0;n<e.length;++n)t(n);if(i.currentResponseNum===i.closeAfterResponse)return i.onClose&&(i.onClose(),i.onClose=null),"break";i.currentResponseNum++},i=this;this.pendingResponses[this.currentResponseNum]&&"break"!==n(););},ef);function ef(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}var nf=(rf.prototype.open=function(t,e){var s=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new tf(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(function(){s.log_("Timed out trying to connect."),s.onClosed_(),s.connectTimeoutTimer_=null},Math.floor(3e4)),function(t){if("complete"===document.readyState)t();else{var e=!1,n=function(){document.body?e||(e=!0,t()):setTimeout(n,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&n()}),window.attachEvent("onload",n))}}(function(){if(!s.isClosed_){s.scriptTagHolder=new of(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Ns(t,5),r=n[0],i=n[1],o=n[2];if(n[3],n[4],s.incrementIncomingBytes_(t),s.scriptTagHolder)if(s.connectTimeoutTimer_&&(clearTimeout(s.connectTimeoutTimer_),s.connectTimeoutTimer_=null),s.everConnected_=!0,"start"===r)s.id=i,s.password=o;else{if("close"!==r)throw new Error("Unrecognized command received: "+r);i?(s.scriptTagHolder.sendNewPolls=!1,s.myPacketOrderer.closeAfter(i,function(){s.onClosed_()})):s.onClosed_()}},function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Ns(t,2),r=n[0],i=n[1];s.incrementIncomingBytes_(t),s.myPacketOrderer.handleResponse(r,i)},function(){s.onClosed_()},s.urlFn);var t={start:"t"};t.ser=Math.floor(1e8*Math.random()),s.scriptTagHolder.uniqueCallbackIdentifier&&(t.cb=s.scriptTagHolder.uniqueCallbackIdentifier),t.v="5",s.transportSessionId&&(t.s=s.transportSessionId),s.lastSessionId&&(t.ls=s.lastSessionId),s.applicationId&&(t.p=s.applicationId),"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(ju)&&(t.r="f");var e=s.urlFn(t);s.log_("Connecting via long-poll to "+e),s.scriptTagHolder.addTag(e,function(){})}})},rf.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},rf.forceAllow=function(){rf.forceAllow_=!0},rf.forceDisallow=function(){rf.forceDisallow_=!0},rf.isAvailable=function(){return!!rf.forceAllow_||!(rf.forceDisallow_||"undefined"==typeof document||null==document.createElement||"object"==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href)||"object"==typeof Windows&&"object"==typeof Windows.UI)},rf.prototype.markConnectionHealthy=function(){},rf.prototype.shutdown_=function(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)},rf.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},rf.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},rf.prototype.send=function(t){var e=ta(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);for(var n,r=(n=Os(e),Ls.encodeByteArray(n,!0)),i=yu(r,1840),o=0;o<i.length;o++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,i.length,i[o]),this.curSegmentNum++},rf.prototype.addDisconnectPingFrame=function(t,e){this.myDisconnFrame=document.createElement("iframe");var n={dframe:"t"};n.id=t,n.pw=e,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)},rf.prototype.incrementIncomingBytes_=function(t){var e=ta(t).length;this.bytesReceived+=e,this.stats_.incrementCounter("bytes_received",e)},rf);function rf(t,e,n,r,i){this.connId=t,this.repoInfo=e,this.applicationId=n,this.transportSessionId=r,this.lastSessionId=i,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=cu(t),this.stats_=Ll.getCollection(e),this.urlFn=function(t){return e.connectionURL(qu,t)}}var of=(sf.createIFrame_=function(){var e=document.createElement("iframe");if(e.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(e);try{e.contentWindow.document||uu("No IE domain setting required")}catch(t){var n=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+n+"';document.close();})())"}return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e},sf.prototype.close=function(){var t=this;this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==t.myIFrame&&(document.body.removeChild(t.myIFrame),t.myIFrame=null)},Math.floor(0)));var e=this.onDisconnect;e&&(this.onDisconnect=null,e())},sf.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},sf.prototype.newRequest_=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(0<this.pendingSegs.length?2:1)){this.currentSerial++;var t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;for(var e=this.urlFn(t),n="",r=0;0<this.pendingSegs.length&&this.pendingSegs[0].d.length+30+n.length<=1870;){var i=this.pendingSegs.shift();n=n+"&seg"+r+"="+i.seg+"&ts"+r+"="+i.ts+"&d"+r+"="+i.d,r++}return e+=n,this.addLongPollTag_(e,this.currentSerial),!0}return!1},sf.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},sf.prototype.addLongPollTag_=function(t,e){var n=this;function r(){n.outstandingRequests.delete(e),n.newRequest_()}this.outstandingRequests.add(e);var i=setTimeout(r,Math.floor(25e3));this.addTag(t,function(){clearTimeout(i),r()})},sf.prototype.addTag=function(t,n){var r=this;setTimeout(function(){try{if(!r.sendNewPolls)return;var e=r.myIFrame.doc.createElement("script");e.type="text/javascript",e.async=!0,e.src=t,e.onload=e.onreadystatechange=function(){var t=e.readyState;t&&"loaded"!==t&&"complete"!==t||(e.onload=e.onreadystatechange=null,e.parentNode&&e.parentNode.removeChild(e),n())},e.onerror=function(){uu("Long-poll script failed to load: "+t),r.sendNewPolls=!1,r.close()},r.myIFrame.doc.body.appendChild(e)}catch(t){}},Math.floor(1))},sf);function sf(t,e,n,r){this.onDisconnect=n,this.urlFn=r,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0,this.uniqueCallbackIdentifier=_u(),window["pLPCommand"+this.uniqueCallbackIdentifier]=t,window["pRTLPCB"+this.uniqueCallbackIdentifier]=e,this.myIFrame=sf.createIFrame_();var i="";this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length)&&(i='<script>document.domain="'+document.domain+'";<\/script>');var o="<html><body>"+i+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(t){uu("frame writing exception"),t.stack&&uu(t.stack),uu(t)}}var af="";var uf=null;"undefined"!=typeof MozWebSocket?uf=MozWebSocket:"undefined"!=typeof WebSocket&&(uf=WebSocket);var cf=(hf.connectionURL_=function(t,e,n){var r={v:"5"};return"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(ju)&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),t.connectionURL(Vu,r)},hf.prototype.open=function(t,e){var n=this;this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,mu.set("previous_websocket_failure",!0);try{if(Ws()){var r=Rs.NODE_ADMIN?"AdminNode":"Node",i={headers:{"User-Agent":"Firebase/5/"+af+"/"+process.platform+"/"+r,"X-Firebase-GMPID":this.applicationId||""}},o=process.env,s=0===this.connURL.indexOf("wss://")?o.HTTPS_PROXY||o.https_proxy:o.HTTP_PROXY||o.http_proxy;s&&(i.proxy={origin:s}),this.mySock=new uf(this.connURL,[],i)}else i={headers:{"X-Firebase-GMPID":this.applicationId||""}},this.mySock=new uf(this.connURL,[],i)}catch(t){this.log_("Error instantiating WebSocket.");var a=t.message||t.data;return a&&this.log_(a),void this.onClosed_()}this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0},this.mySock.onclose=function(){n.log_("Websocket connection was disconnected."),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(t){n.handleIncomingFrame(t)},this.mySock.onerror=function(t){n.log_("WebSocket error.  Closing connection.");var e=t.message||t.data;e&&n.log_(e),n.onClosed_()}},hf.prototype.start=function(){},hf.forceDisallow=function(){hf.forceDisallow_=!0},hf.isAvailable=function(){var t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var e=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);e&&1<e.length&&parseFloat(e[1])<4.4&&(t=!0)}return!t&&null!==uf&&!hf.forceDisallow_},hf.previouslyFailed=function(){return mu.isInMemoryStorage||!0===mu.get("previous_websocket_failure")},hf.prototype.markConnectionHealthy=function(){mu.remove("previous_websocket_failure")},hf.prototype.appendFrame_=function(t){if(this.frames.push(t),this.frames.length===this.totalFrames){var e=this.frames.join("");this.frames=null;var n=Zs(e);this.onMessage(n)}},hf.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},hf.prototype.extractFrameCount_=function(t){if(Ds(null===this.frames,"We already have a frame buffer"),t.length<=6){var e=Number(t);if(!isNaN(e))return this.handleNewFrameCount_(e),null}return this.handleNewFrameCount_(1),t},hf.prototype.handleIncomingFrame=function(t){if(null!==this.mySock){var e=t.data;if(this.bytesReceived+=e.length,this.stats_.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(e);else{var n=this.extractFrameCount_(e);null!==n&&this.appendFrame_(n)}}},hf.prototype.send=function(t){this.resetKeepAlive();var e=ta(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);var n=yu(e,16384);1<n.length&&this.sendString_(String(n.length));for(var r=0;r<n.length;r++)this.sendString_(n[r])},hf.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},hf.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},hf.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},hf.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.sendString_("0"),t.resetKeepAlive()},Math.floor(45e3))},hf.prototype.sendString_=function(t){try{this.mySock.send(t)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}},hf.responsesRequiredToBeHealthy=2,hf.healthyTimeout=3e4,hf);function hf(t,e,n,r,i){this.connId=t,this.applicationId=n,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=cu(this.connId),this.stats_=Ll.getCollection(e),this.connURL=hf.connectionURL_(e,r,i)}var lf=(Object.defineProperty(ff,"ALL_TRANSPORTS",{get:function(){return[nf,cf]},enumerable:!1,configurable:!0}),ff.prototype.initTransports_=function(t){var e,n,r=cf&&cf.isAvailable(),i=r&&!cf.previouslyFailed();if(t.webSocketOnly&&(r||fu("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),i=!0),i)this.transports_=[cf];else{var o=this.transports_=[];try{for(var s=Cs(ff.ALL_TRANSPORTS),a=s.next();!a.done;a=s.next()){var u=a.value;u&&u.isAvailable()&&o.push(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}}},ff.prototype.initialTransport=function(){if(0<this.transports_.length)return this.transports_[0];throw new Error("No transports available")},ff.prototype.upgradeTransport=function(){return 1<this.transports_.length?this.transports_[1]:null},ff);function ff(t){this.initTransports_(t)}var pf=(df.prototype.start_=function(){var t=this,e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,void 0,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(function(){t.conn_&&t.conn_.open(n,r)},Math.floor(0));var i=e.healthyTimeout||0;0<i&&(this.healthyTimeout_=Ru(function(){t.healthyTimeout_=null,t.isHealthy_||(t.conn_&&102400<t.conn_.bytesReceived?(t.log_("Connection exceeded healthy timeout but has received "+t.conn_.bytesReceived+" bytes.  Marking connection healthy."),t.isHealthy_=!0,t.conn_.markConnectionHealthy()):t.conn_&&10240<t.conn_.bytesSent?t.log_("Connection exceeded healthy timeout but has sent "+t.conn_.bytesSent+" bytes.  Leaving connection alive."):(t.log_("Closing unhealthy connection after timeout."),t.close()))},Math.floor(i)))},df.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},df.prototype.disconnReceiver_=function(e){var n=this;return function(t){e===n.conn_?n.onConnectionLost_(t):e===n.secondaryConn_?(n.log_("Secondary connection lost."),n.onSecondaryConnectionLost_()):n.log_("closing an old connection")}},df.prototype.connReceiver_=function(e){var n=this;return function(t){2!==n.state_&&(e===n.rx_?n.onPrimaryMessageReceived_(t):e===n.secondaryConn_?n.onSecondaryMessageReceived_(t):n.log_("message on old connection"))}},df.prototype.sendRequest=function(t){var e={t:"d",d:t};this.sendData_(e)},df.prototype.tryCleanupConnection=function(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)},df.prototype.onSecondaryControl_=function(t){if("t"in t){var e=t.t;"a"===e?this.upgradeIfSecondaryHealthy_():"r"===e?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===e&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}},df.prototype.onSecondaryMessageReceived_=function(t){var e=vu("t",t),n=vu("d",t);if("c"===e)this.onSecondaryControl_(n);else{if("d"!==e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(n)}},df.prototype.upgradeIfSecondaryHealthy_=function(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:"p",d:{}}}))},df.prototype.proceedWithUpgrade_=function(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()},df.prototype.onPrimaryMessageReceived_=function(t){var e=vu("t",t),n=vu("d",t);"c"===e?this.onControl_(n):"d"===e&&this.onDataMessage_(n)},df.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},df.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},df.prototype.onControl_=function(t){var e=vu("t",t);if("d"in t){var n=t.d;if("h"===e)this.onHandshake_(n);else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var r=0;r<this.pendingDataMessages.length;++r)this.onDataMessage_(this.pendingDataMessages[r]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.onConnectionShutdown_(n):"r"===e?this.onReset_(n):"e"===e?hu("Server Error: "+n):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):hu("Unknown control packet command: "+e)}},df.prototype.onHandshake_=function(t){var e=t.ts,n=t.v,r=t.h;this.sessionId=t.s,this.repoInfo_.updateHost(r),0===this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,e),"5"!==n&&fu("Protocol version mismatch detected"),this.tryStartUpgrade_())},df.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)},df.prototype.startUpgrade_=function(t){var e=this;this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.secondaryConn_),r=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,r),Ru(function(){e.secondaryConn_&&(e.log_("Timed out trying to upgrade."),e.secondaryConn_.close())},Math.floor(6e4))},df.prototype.onReset_=function(t){this.log_("Reset packet received.  New host: "+t),this.repoInfo_.updateHost(t),1===this.state_?this.close():(this.closeConnections_(),this.start_())},df.prototype.onConnectionEstablished_=function(t,e){var n=this;this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(e,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):Ru(function(){n.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))},df.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},df.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()},df.prototype.onConnectionLost_=function(t){this.conn_=null,t||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(mu.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()},df.prototype.onConnectionShutdown_=function(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()},df.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},df.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},df.prototype.closeConnections_=function(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)},df);function df(t,e,n,r,i,o,s,a){this.id=t,this.repoInfo_=e,this.applicationId_=n,this.onMessage_=r,this.onReady_=i,this.onDisconnect_=o,this.onKill_=s,this.lastSessionId=a,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=cu("c:"+this.id+":"),this.transportManager_=new lf(e),this.log_("Connection created"),this.start_()}var vf=(yf.prototype.put=function(t,e,n,r){},yf.prototype.merge=function(t,e,n,r){},yf.prototype.refreshAuthToken=function(t){},yf.prototype.onDisconnectPut=function(t,e,n){},yf.prototype.onDisconnectMerge=function(t,e,n){},yf.prototype.onDisconnectCancel=function(t,e){},yf.prototype.reportStats=function(t){},yf);function yf(){}var gf,mf=(Es(bf,gf=vf),bf.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,i={r:r,a:t,b:e};this.log_(ta(i)),Ds(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[r]=n)},bf.prototype.listen=function(t,e,n,r){var i=t.queryIdentifier(),o=t.path.toString();this.log_("Listen called for "+o+" "+i),this.listens.has(o)||this.listens.set(o,new Map),Ds(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),Ds(!this.listens.get(o).has(i),"listen() called twice for same path/queryId.");var s={onComplete:r,hashFn:e,query:t,tag:n};this.listens.get(o).set(i,s),this.connected_&&this.sendListen_(s)},bf.prototype.sendListen_=function(r){var i=this,o=r.query,s=o.path.toString(),a=o.queryIdentifier();this.log_("Listen on "+s+" for "+a);var t={p:s};r.tag&&(t.q=o.queryObject(),t.t=r.tag),t.h=r.hashFn(),this.sendRequest("q",t,function(t){var e=t.d,n=t.s;bf.warnOnListenWarnings_(e,o),(i.listens.get(s)&&i.listens.get(s).get(a))===r&&(i.log_("listen response",t),"ok"!==n&&i.removeListen_(s,a),r.onComplete&&r.onComplete(n,e))})},bf.warnOnListenWarnings_=function(t,e){if(t&&"object"==typeof t&&na(t,"w")){var n=ra(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){var r='".indexOn": "'+e.getQueryParams().getIndex().toString()+'"',i=e.path.toString();fu("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding "+r+" at "+i+" to your security rules for better performance.")}}},bf.prototype.refreshAuthToken=function(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},function(){}),this.reduceReconnectDelayIfAdminCredential_(t)},bf.prototype.reduceReconnectDelayIfAdminCredential_=function(t){var e;(t&&40===t.length||"object"==typeof(e=ea(t).claims)&&!0===e.admin)&&(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},bf.prototype.tryAuth=function(){var t,r=this;if(this.connected_&&this.authToken_){var i=this.authToken_,e=(t=ea(i).claims)&&"object"==typeof t&&t.hasOwnProperty("iat")?"auth":"gauth",n={cred:i};null===this.authOverride_?n.noauth=!0:"object"==typeof this.authOverride_&&(n.authvar=this.authOverride_),this.sendRequest(e,n,function(t){var e=t.s,n=t.d||"error";r.authToken_===i&&("ok"===e?r.invalidAuthTokenCount_=0:r.onAuthRevoked_(e,n))})}},bf.prototype.unlisten=function(t,e){var n=t.path.toString(),r=t.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),Ds(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&&this.connected_&&this.sendUnlisten_(n,r,t.queryObject(),e)},bf.prototype.sendUnlisten_=function(t,e,n,r){this.log_("Unlisten on "+t+" for "+e);var i={p:t};r&&(i.q=n,i.t=r),this.sendRequest("n",i)},bf.prototype.onDisconnectPut=function(t,e,n){this.connected_?this.sendOnDisconnect_("o",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:e,onComplete:n})},bf.prototype.onDisconnectMerge=function(t,e,n){this.connected_?this.sendOnDisconnect_("om",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:e,onComplete:n})},bf.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},bf.prototype.sendOnDisconnect_=function(t,e,n,r){var i={p:e,d:n};this.log_("onDisconnect "+t,i),this.sendRequest(t,i,function(t){r&&setTimeout(function(){r(t.s,t.d)},Math.floor(0))})},bf.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},bf.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},bf.prototype.putInternal=function(t,e,n,r,i){var o={p:e,d:n};void 0!==i&&(o.h=i),this.outstandingPuts_.push({action:t,request:o,onComplete:r}),this.outstandingPutCount_++;var s=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(s):this.log_("Buffering put: "+e)},bf.prototype.sendPut_=function(e){var n=this,r=this.outstandingPuts_[e].action,t=this.outstandingPuts_[e].request,i=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(r,t,function(t){n.log_(r+" response",t),delete n.outstandingPuts_[e],n.outstandingPutCount_--,0===n.outstandingPutCount_&&(n.outstandingPuts_=[]),i&&i(t.s,t.d)})},bf.prototype.reportStats=function(t){var n=this;if(this.connected_){var e={c:t};this.log_("reportStats",e),this.sendRequest("s",e,function(t){if("ok"!==t.s){var e=t.d;n.log_("reportStats","Error sending stats: "+e)}})}},bf.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+ta(t));var e=t.r,n=this.requestCBHash_[e];n&&(delete this.requestCBHash_[e],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}},bf.prototype.onDataPush_=function(t,e){this.log_("handleServerMessage",t,e),"d"===t?this.onDataUpdate_(e.p,e.d,!1,e.t):"m"===t?this.onDataUpdate_(e.p,e.d,!0,e.t):"c"===t?this.onListenRevoked_(e.p,e.q):"ac"===t?this.onAuthRevoked_(e.s,e.d):"sd"===t?this.onSecurityDebugPacket_(e):hu("Unrecognized action received from server: "+ta(t)+"\nAre you using the latest client?")},bf.prototype.onReady_=function(t,e){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(t),this.lastSessionId=e,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)},bf.prototype.scheduleConnect_=function(t){var e=this;Ds(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(function(){e.establishConnectionTimer_=null,e.establishConnection_()},Math.floor(t))},bf.prototype.onVisible_=function(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible.  Reducing delay."),this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},bf.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline.  Killing connection."),this.realtime_&&this.realtime_.close())},bf.prototype.onRealtimeDisconnect_=function(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(3e4<(new Date).getTime()-this.lastConnectionEstablishedTime_&&(this.reconnectDelay_=1e3),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible.  Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime());var t=(new Date).getTime()-this.lastConnectionAttemptTime_,e=Math.max(0,this.reconnectDelay_-t);e=Math.random()*e,this.log_("Trying to reconnect in "+e+"ms"),this.scheduleConnect_(e),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)},bf.prototype.establishConnection_=function(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var e=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+bf.nextConnectionId_++,o=this,s=this.lastSessionId,a=!1,u=null,c=function(){u?u.close():(a=!0,r())};this.realtime_={close:c,sendRequest:function(t){Ds(u,"sendRequest call when we're not connected not allowed."),u.sendRequest(t)}};var t=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(t).then(function(t){a?uu("getToken() completed but was canceled"):(uu("getToken() completed. Creating connection."),o.authToken_=t&&t.accessToken,u=new pf(i,o.repoInfo_,o.applicationId_,e,n,r,function(t){fu(t+" ("+o.repoInfo_.toString()+")"),o.interrupt("server_kill")},s))}).then(null,function(t){o.log_("Failed to get token: "+t),a||c()})}},bf.prototype.interrupt=function(t){uu("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},bf.prototype.resume=function(t){uu("Resuming connection for reason: "+t),delete this.interruptReasons_[t],ia(this.interruptReasons_)&&(this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0))},bf.prototype.handleTimestamp_=function(t){var e=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:e})},bf.prototype.cancelSentTransactions_=function(){for(var t=0;t<this.outstandingPuts_.length;t++){var e=this.outstandingPuts_[t];e&&"h"in e.request&&e.queued&&(e.onComplete&&e.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])},bf.prototype.onListenRevoked_=function(t,e){var n;n=e?e.map(function(t){return Au(t)}).join("$"):"default";var r=this.removeListen_(t,n);r&&r.onComplete&&r.onComplete("permission_denied")},bf.prototype.removeListen_=function(t,e){var n,r=new Lu(t).toString();if(this.listens.has(r)){var i=this.listens.get(r);n=i.get(e),i.delete(e),0===i.size&&this.listens.delete(r)}else n=void 0;return n},bf.prototype.onAuthRevoked_=function(t,e){uu("Auth token revoked: "+t+"/"+e),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAuthTokenCount_++,3<=this.invalidAuthTokenCount_&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))},bf.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},bf.prototype.restoreState_=function(){var e,t,n,r;this.tryAuth();try{for(var i=Cs(this.listens.values()),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,Cs(s.values())),u=a.next();!u.done;u=a.next()){var c=u.value;this.sendListen_(c)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}for(var h=0;h<this.outstandingPuts_.length;h++)this.outstandingPuts_[h]&&this.sendPut_(h);for(;this.onDisconnectRequestQueue_.length;){var l=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(l.action,l.pathString,l.data,l.onComplete)}},bf.prototype.sendConnectStats_=function(){var t={};t["sdk.js."+af.replace(/\./g,"-")]=1,qs()?t["framework.cordova"]=1:Bs()&&(t["framework.reactnative"]=1),this.reportStats(t)},bf.prototype.shouldReconnect_=function(){var t=Jl.getInstance().currentlyOnline();return ia(this.interruptReasons_)&&t},bf.nextPersistentConnectionId_=0,bf.nextConnectionId_=0,bf);function bf(t,e,n,r,i,o,s){var a=gf.call(this)||this;if(a.repoInfo_=t,a.applicationId_=e,a.onDataUpdate_=n,a.onConnectStatus_=r,a.onServerInfoUpdate_=i,a.authTokenProvider_=o,a.authOverride_=s,a.id=bf.nextPersistentConnectionId_++,a.log_=cu("p:"+a.id+":"),a.interruptReasons_={},a.listens=new Map,a.outstandingPuts_=[],a.outstandingPutCount_=0,a.onDisconnectRequestQueue_=[],a.connected_=!1,a.reconnectDelay_=1e3,a.maxReconnectDelay_=3e5,a.securityDebugCallback_=null,a.lastSessionId=null,a.establishConnectionTimer_=null,a.visible_=!1,a.requestCBHash_={},a.requestNumber_=0,a.realtime_=null,a.authToken_=null,a.forceTokenRefresh_=!1,a.invalidAuthTokenCount_=0,a.firstConnection_=!0,a.lastConnectionAttemptTime_=null,a.lastConnectionEstablishedTime_=null,s&&!Ws())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return a.scheduleConnect_(0),Xl.getInstance().on("visible",a.onVisible_,a),-1===t.host.indexOf("fblocal")&&Jl.getInstance().on("online",a.onOnline_,a),a}var wf,_f=(Es(Ef,wf=vf),Ef.prototype.reportStats=function(t){throw new Error("Method not implemented.")},Ef.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(Ds(t.getQueryParams().isDefault(),"should have a tag if it's not a default query."),t.path.toString())},Ef.prototype.listen=function(t,e,r,i){var o=this,s=t.path.toString();this.log_("Listen called for "+s+" "+t.queryIdentifier());var a=Ef.getListenId_(t,r),u={};this.listens_[a]=u;var n=t.getQueryParams().toRestQueryStringParameters();this.restRequest_(s+".json",n,function(t,e){var n=e;404===t&&(t=n=null),null===t&&o.onDataUpdate_(s,n,!1,r),ra(o.listens_,a)===u&&i(t?401===t?"permission_denied":"rest_error:"+t:"ok",null)})},Ef.prototype.unlisten=function(t,e){var n=Ef.getListenId_(t,e);delete this.listens_[n]},Ef.prototype.refreshAuthToken=function(t){},Ef.prototype.restRequest_=function(i,o,s){var a=this;void 0===o&&(o={}),o.format="export",this.authTokenProvider_.getToken(!1).then(function(t){var e=t&&t.accessToken;e&&(o.auth=e);var n=(a.repoInfo_.secure?"https://":"http://")+a.repoInfo_.host+i+"?ns="+a.repoInfo_.namespace+function(t){for(var n=[],e=function(e,t){Array.isArray(t)?t.forEach(function(t){n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))}):n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},r=0,i=Object.entries(t);r<i.length;r++){var o=i[r];e(o[0],o[1])}return n.length?"&"+n.join("&"):""}(o);a.log_("Sending REST request for "+n);var r=new XMLHttpRequest;r.onreadystatechange=function(){if(s&&4===r.readyState){a.log_("REST Response for "+n+" received. status:",r.status,"response:",r.responseText);var t=null;if(200<=r.status&&r.status<300){try{t=Zs(r.responseText)}catch(t){fu("Failed to parse JSON response for "+n+": "+r.responseText)}s(null,t)}else 401!==r.status&&404!==r.status&&fu("Got unsuccessful REST response for "+n+" Status: "+r.status),s(r.status);s=null}},r.open("GET",n,!0),r.send()})},Ef);function Ef(t,e,n){var r=wf.call(this)||this;return r.repoInfo_=t,r.onDataUpdate_=e,r.authTokenProvider_=n,r.log_=cu("p:rest:"),r.listens_={},r}var If="repo_interrupt",Tf=(Sf.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},Sf.prototype.name=function(){return this.repoInfo_.namespace},Sf.prototype.serverTime=function(){var t=this.infoData_.getNode(new Lu(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t},Sf.prototype.generateServerValues=function(){return(t=t={timestamp:this.serverTime()}).timestamp=t.timestamp||(new Date).getTime(),t;var t},Sf.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new Lu(t);e=this.interceptServerDataCallback_?this.interceptServerDataCallback_(t,e):e;var o=[];if(r)if(n){var s=oa(e,function(t){return ah(t)});o=this.serverSyncTree_.applyTaggedQueryMerge(i,s,r)}else{var a=ah(e);o=this.serverSyncTree_.applyTaggedQueryOverwrite(i,a,r)}else if(n){var u=oa(e,function(t){return ah(t)});o=this.serverSyncTree_.applyServerMerge(i,u)}else{var c=ah(e);o=this.serverSyncTree_.applyServerOverwrite(i,c)}var h=i;0<o.length&&(h=this.rerunTransactions_(i)),this.eventQueue_.raiseEventsForChangedPath(h,o)},Sf.prototype.interceptServerData_=function(t){this.interceptServerDataCallback_=t},Sf.prototype.onConnectStatus_=function(t){this.updateInfo_("connected",t),!1===t&&this.runOnDisconnectEvents_()},Sf.prototype.onServerInfoUpdate_=function(t){var n=this;ku(t,function(t,e){n.updateInfo_(t,e)})},Sf.prototype.updateInfo_=function(t,e){var n=new Lu("/.info/"+t),r=ah(e);this.infoData_.updateSnapshot(n,r);var i=this.infoSyncTree_.applyServerOverwrite(n,r);this.eventQueue_.raiseEventsForChangedPath(n,i)},Sf.prototype.getNextWriteId_=function(){return this.nextWriteId_++},Sf.prototype.setWithPriority=function(i,t,e,o){var s=this;this.log_("set",{path:i.toString(),value:t,priority:e});var n=this.generateServerValues(),r=ah(t,e),a=this.serverSyncTree_.calcCompleteEventCache(i),u=Ph(r,a,n),c=this.getNextWriteId_(),h=this.serverSyncTree_.applyUserOverwrite(i,u,c,!0);this.eventQueue_.queueEvents(h),this.server_.put(i.toString(),r.val(!0),function(t,e){var n="ok"===t;n||fu("set at "+i+" failed: "+t);var r=s.serverSyncTree_.ackUserWrite(c,!n);s.eventQueue_.raiseEventsForChangedPath(i,r),s.callOnCompleteCallback(o,t,e)});var l=this.abortTransactions_(i);this.rerunTransactions_(l),this.eventQueue_.raiseEventsForChangedPath(l,[])},Sf.prototype.update=function(o,t,s){var a=this;this.log_("update",{path:o.toString(),value:t});var n=!0,r=this.generateServerValues(),i={};if(ku(t,function(t,e){n=!1,i[t]=Oh(o.child(t),ah(e),a.serverSyncTree_,r)}),n)uu("update() called with empty data.  Don't do anything."),this.callOnCompleteCallback(s,"ok");else{var u=this.getNextWriteId_(),e=this.serverSyncTree_.applyUserMerge(o,i,u);this.eventQueue_.queueEvents(e),this.server_.merge(o.toString(),t,function(t,e){var n="ok"===t;n||fu("update at "+o+" failed: "+t);var r=a.serverSyncTree_.ackUserWrite(u,!n),i=0<r.length?a.rerunTransactions_(o):o;a.eventQueue_.raiseEventsForChangedPath(i,r),a.callOnCompleteCallback(s,t,e)}),ku(t,function(t){var e=a.abortTransactions_(o.child(t));a.rerunTransactions_(e)}),this.eventQueue_.raiseEventsForChangedPath(o,[])}},Sf.prototype.runOnDisconnectEvents_=function(){var r=this;this.log_("onDisconnectEvents");var i=this.generateServerValues(),o=new Uh;this.onDisconnect_.forEachTree(Lu.Empty,function(t,e){var n=Oh(t,e,r.serverSyncTree_,i);o.remember(t,n)});var s=[];o.forEachTree(Lu.Empty,function(t,e){s=s.concat(r.serverSyncTree_.applyServerOverwrite(t,e));var n=r.abortTransactions_(t);r.rerunTransactions_(n)}),this.onDisconnect_=new Uh,this.eventQueue_.raiseEventsForChangedPath(Lu.Empty,s)},Sf.prototype.onDisconnectCancel=function(n,r){var i=this;this.server_.onDisconnectCancel(n.toString(),function(t,e){"ok"===t&&i.onDisconnect_.forget(n),i.callOnCompleteCallback(r,t,e)})},Sf.prototype.onDisconnectSet=function(n,t,r){var i=this,o=ah(t);this.server_.onDisconnectPut(n.toString(),o.val(!0),function(t,e){"ok"===t&&i.onDisconnect_.remember(n,o),i.callOnCompleteCallback(r,t,e)})},Sf.prototype.onDisconnectSetWithPriority=function(n,t,e,r){var i=this,o=ah(t,e);this.server_.onDisconnectPut(n.toString(),o.val(!0),function(t,e){"ok"===t&&i.onDisconnect_.remember(n,o),i.callOnCompleteCallback(r,t,e)})},Sf.prototype.onDisconnectUpdate=function(r,n,i){var o=this;if(ia(n))return uu("onDisconnect().update() called with empty data.  Don't do anything."),void this.callOnCompleteCallback(i,"ok");this.server_.onDisconnectMerge(r.toString(),n,function(t,e){"ok"===t&&ku(n,function(t,e){var n=ah(e);o.onDisconnect_.remember(r.child(t),n)}),o.callOnCompleteCallback(i,t,e)})},Sf.prototype.addEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.addEventRegistration(t,e):this.serverSyncTree_.addEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},Sf.prototype.removeEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.removeEventRegistration(t,e):this.serverSyncTree_.removeEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},Sf.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt(If)},Sf.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume(If)},Sf.prototype.stats=function(t){if(void 0===t&&(t=!1),"undefined"!=typeof console){var e;e=t?(this.statsListener_||(this.statsListener_=new Fl(this.stats_)),this.statsListener_.get()):this.stats_.get();var i=Object.keys(e).reduce(function(t,e){return Math.max(e.length,t)},0);ku(e,function(t,e){for(var n=t,r=t.length;r<i+2;r++)n+=" ";console.log(n+e)})}},Sf.prototype.statsIncrementCounter=function(t){this.stats_.incrementCounter(t),this.statsReporter_.includeStat(t)},Sf.prototype.log_=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="";this.persistentConnection_&&(n=this.persistentConnection_.id+":"),uu.apply(void 0,As([n],t))},Sf.prototype.callOnCompleteCallback=function(r,i,o){r&&Pu(function(){if("ok"===i)r(null);else{var t=(i||"error").toUpperCase(),e=t;o&&(e+=": "+o);var n=new Error(e);n.code=t,r(n)}})},Object.defineProperty(Sf.prototype,"database",{get:function(){return this.__database||(this.__database=new Gf(this))},enumerable:!1,configurable:!0}),Sf);function Sf(t,e,n,r){var s=this;if(this.repoInfo_=t,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new ql,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new Uh,this.persistentConnection_=null,this.stats_=Ll.getCollection(t),e||0<=("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i))this.server_=new _f(this.repoInfo_,this.onDataUpdate_.bind(this),r),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var i=n.options.databaseAuthVariableOverride;if(null!=i){if("object"!=typeof i)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{ta(i)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}this.persistentConnection_=new mf(this.repoInfo_,n.options.appId,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),r,i),this.server_=this.persistentConnection_}r.addTokenChangeListener(function(t){s.server_.refreshAuthToken(t)}),this.statsReporter_=Ll.getOrCreateReporter(t,function(){return new jl(s.stats_,s.server_)}),this.transactionsInit_(),this.infoData_=new Pl,this.infoSyncTree_=new kl({startListening:function(t,e,n,r){var i=[],o=s.infoData_.getNode(t.path);return o.isEmpty()||(i=s.infoSyncTree_.applyServerOverwrite(t.path,o),setTimeout(function(){r("ok")},0)),i},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new kl({startListening:function(r,t,e,i){return s.server_.listen(r,e,t,function(t,e){var n=i(t,e);s.eventQueue_.raiseEventsForChangedPath(r.path,n)}),[]},stopListening:function(t,e){s.server_.unlisten(t,e)}})}var Cf=(Nf.prototype.getStartPost=function(){return this.startPost_},Nf.prototype.getEndPost=function(){return this.endPost_},Nf.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)<=0&&this.index_.compare(t,this.getEndPost())<=0},Nf.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new vc(e,n))||(n=eh.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},Nf.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&&(e=eh.EMPTY_NODE);var r=e.withIndex(this.index_);r=r.updatePriority(eh.EMPTY_NODE);var i=this;return e.forEachChild(xc,function(t,e){i.matches(new vc(t,e))||(r=r.updateImmediateChild(t,eh.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,r,n)},Nf.prototype.updatePriority=function(t,e){return t},Nf.prototype.filtersNodes=function(){return!0},Nf.prototype.getIndexedFilter=function(){return this.indexedFilter_},Nf.prototype.getIndex=function(){return this.index_},Nf.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},Nf.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},Nf);function Nf(t){this.indexedFilter_=new ol(t.getIndex()),this.index_=t.getIndex(),this.startPost_=Nf.getStartPost_(t),this.endPost_=Nf.getEndPost_(t)}var Af=(kf.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new vc(e,n))||(n=eh.EMPTY_NODE),t.getImmediateChild(e).equals(n)?t:t.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(t,e,n,r,i,o):this.fullLimitUpdateChild_(t,e,n,i,o)},kf.prototype.updateFullNode=function(t,e,n){var r;if(e.isLeafNode()||e.isEmpty())r=eh.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){r=eh.EMPTY_NODE.withIndex(this.index_);var i=void 0;i=this.reverse_?e.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):e.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);for(var o=0;i.hasNext()&&o<this.limit_;){var s=i.getNext();if(!(this.reverse_?this.index_.compare(this.rangedFilter_.getStartPost(),s)<=0:this.index_.compare(s,this.rangedFilter_.getEndPost())<=0))break;r=r.updateImmediateChild(s.name,s.node),o++}}else{r=(r=e.withIndex(this.index_)).updatePriority(eh.EMPTY_NODE);var a=void 0,u=void 0,c=void 0;if(i=void 0,this.reverse_){i=r.getReverseIterator(this.index_),a=this.rangedFilter_.getEndPost(),u=this.rangedFilter_.getStartPost();var h=this.index_.getCompare();c=function(t,e){return h(e,t)}}else i=r.getIterator(this.index_),a=this.rangedFilter_.getStartPost(),u=this.rangedFilter_.getEndPost(),c=this.index_.getCompare();o=0;for(var l=!1;i.hasNext();)s=i.getNext(),!l&&c(a,s)<=0&&(l=!0),l&&o<this.limit_&&c(s,u)<=0?o++:r=r.updateImmediateChild(s.name,eh.EMPTY_NODE)}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},kf.prototype.updatePriority=function(t,e){return t},kf.prototype.filtersNodes=function(){return!0},kf.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},kf.prototype.getIndex=function(){return this.index_},kf.prototype.fullLimitUpdateChild_=function(t,e,n,r,i){var o;if(this.reverse_){var s=this.index_.getCompare();o=function(t,e){return s(e,t)}}else o=this.index_.getCompare();var a=t;Ds(a.numChildren()===this.limit_,"");var u=new vc(e,n),c=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),h=this.rangedFilter_.matches(u);if(a.hasChild(e)){for(var l=a.getImmediateChild(e),f=r.getChildAfterChild(this.index_,c,this.reverse_);null!=f&&(f.name===e||a.hasChild(f.name));)f=r.getChildAfterChild(this.index_,f,this.reverse_);var p=null==f?1:o(f,u);if(h&&!n.isEmpty()&&0<=p)return null!=i&&i.trackChildChange(rl.childChangedChange(e,n,l)),a.updateImmediateChild(e,n);null!=i&&i.trackChildChange(rl.childRemovedChange(e,l));var d=a.updateImmediateChild(e,eh.EMPTY_NODE);return null!=f&&this.rangedFilter_.matches(f)?(null!=i&&i.trackChildChange(rl.childAddedChange(f.name,f.node)),d.updateImmediateChild(f.name,f.node)):d}return!n.isEmpty()&&h&&0<=o(c,u)?(null!=i&&(i.trackChildChange(rl.childRemovedChange(c.name,c.node)),i.trackChildChange(rl.childAddedChange(e,n))),a.updateImmediateChild(e,n).updateImmediateChild(c.name,eh.EMPTY_NODE)):t},kf);function kf(t){this.rangedFilter_=new Cf(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}var Of=(Pf.prototype.hasStart=function(){return this.startSet_},Pf.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===Pf.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},Pf.prototype.getIndexStartValue=function(){return Ds(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},Pf.prototype.getIndexStartName=function(){return Ds(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Su},Pf.prototype.hasEnd=function(){return this.endSet_},Pf.prototype.getIndexEndValue=function(){return Ds(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},Pf.prototype.getIndexEndName=function(){return Ds(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Cu},Pf.prototype.hasLimit=function(){return this.limitSet_},Pf.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},Pf.prototype.getLimit=function(){return Ds(this.limitSet_,"Only valid if limit has been set"),this.limit_},Pf.prototype.getIndex=function(){return this.index_},Pf.prototype.copy_=function(){var t=new Pf;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_=this.index_,t.viewFrom_=this.viewFrom_,t},Pf.prototype.limit=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_="",e},Pf.prototype.limitToFirst=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_=Pf.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,e},Pf.prototype.limitToLast=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_=Pf.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,e},Pf.prototype.startAt=function(t,e){var n=this.copy_();return n.startSet_=!0,void 0===t&&(t=null),n.indexStartValue_=t,null!=e?(n.startNameSet_=!0,n.indexStartName_=e):(n.startNameSet_=!1,n.indexStartName_=""),n},Pf.prototype.endAt=function(t,e){var n=this.copy_();return n.endSet_=!0,void 0===t&&(t=null),n.indexEndValue_=t,void 0!==e?(n.endNameSet_=!0,n.indexEndName_=e):(n.endNameSet_=!1,n.indexEndName_=""),n},Pf.prototype.orderBy=function(t){var e=this.copy_();return e.index_=t,e},Pf.prototype.getQueryObject=function(){var t=Pf.WIRE_PROTOCOL_CONSTANTS_,e={};if(this.startSet_&&(e[t.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(e[t.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(e[t.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(e[t.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_){e[t.LIMIT]=this.limit_;var n=this.viewFrom_;""===n&&(n=this.isViewFromLeft()?t.VIEW_FROM_LEFT:t.VIEW_FROM_RIGHT),e[t.VIEW_FROM]=n}return this.index_!==xc&&(e[t.INDEX]=this.index_.toString()),e},Pf.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},Pf.prototype.isDefault=function(){return this.loadsAllData()&&this.index_===xc},Pf.prototype.getNodeFilter=function(){return this.loadsAllData()?new ol(this.getIndex()):new(this.hasLimit()?Af:Cf)(this)},Pf.prototype.toRestQueryStringParameters=function(){var t,e=Pf.REST_QUERY_CONSTANTS_,n={};return this.isDefault()||(t=this.index_===xc?e.PRIORITY_INDEX:this.index_===hh?e.VALUE_INDEX:this.index_===Tc?e.KEY_INDEX:(Ds(this.index_ instanceof lh,"Unrecognized index type!"),this.index_.toString()),n[e.ORDER_BY]=ta(t),this.startSet_&&(n[e.START_AT]=ta(this.indexStartValue_),this.startNameSet_&&(n[e.START_AT]+=","+ta(this.indexStartName_))),this.endSet_&&(n[e.END_AT]=ta(this.indexEndValue_),this.endNameSet_&&(n[e.END_AT]+=","+ta(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?n[e.LIMIT_TO_FIRST]=this.limit_:n[e.LIMIT_TO_LAST]=this.limit_)),n},Pf.WIRE_PROTOCOL_CONSTANTS_={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},Pf.REST_QUERY_CONSTANTS_={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},Pf.DEFAULT=new Pf,Pf);function Pf(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=xc}var Rf,Df=(Es(xf,Rf=Th),xf.prototype.getKey=function(){return fa("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},xf.prototype.child=function(t){var e,n,r,i;return fa("Reference.child",1,1,arguments.length),"number"==typeof t?t=String(t):t instanceof Lu||(null===this.path.getFront()?(e="Reference.child",i=!(n=1),r=(r=t)&&r.replace(/^\/*\.info(\/|$)/,"/"),Zu(e,n,r,i)):Zu("Reference.child",1,t,!1)),new xf(this.repo,this.path.child(t))},xf.prototype.getParent=function(){fa("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new xf(this.repo,t)},xf.prototype.getRoot=function(){fa("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},xf.prototype.databaseProp=function(){return this.repo.database},xf.prototype.set=function(t,e){fa("Reference.set",1,2,arguments.length),tc("Reference.set",this.path),Qu("Reference.set",1,t,this.path,!1),da("Reference.set",2,e,!0);var n=new Us;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},xf.prototype.update=function(t,e){if(fa("Reference.update",1,2,arguments.length),tc("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,fu("Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}Xu("Reference.update",1,t,this.path,!1),da("Reference.update",2,e,!0);var i=new Us;return this.repo.update(this.path,t,i.wrapCallback(e)),i.promise},xf.prototype.setWithPriority=function(t,e,n){if(fa("Reference.setWithPriority",2,3,arguments.length),tc("Reference.setWithPriority",this.path),Qu("Reference.setWithPriority",1,t,this.path,!1),Yu("Reference.setWithPriority",2,e,!1),da("Reference.setWithPriority",3,n,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.setWithPriority failed: "+this.getKey()+" is a read-only object.";var r=new Us;return this.repo.setWithPriority(this.path,t,e,r.wrapCallback(n)),r.promise},xf.prototype.remove=function(t){return fa("Reference.remove",0,1,arguments.length),tc("Reference.remove",this.path),da("Reference.remove",1,t,!0),this.set(null,t)},xf.prototype.transaction=function(t,r,e){if(fa("Reference.transaction",1,3,arguments.length),tc("Reference.transaction",this.path),da("Reference.transaction",1,t,!1),da("Reference.transaction",2,r,!0),function(t,e,n,r){if((!r||void 0!==n)&&"boolean"!=typeof n)throw new Error(pa(t,e,r)+"must be a boolean.")}("Reference.transaction",3,e,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.transaction failed: "+this.getKey()+" is a read-only object.";void 0===e&&(e=!0);var i=new Us;return"function"==typeof r&&i.promise.catch(function(){}),this.repo.startTransaction(this.path,t,function(t,e,n){t?i.reject(t):i.resolve(new cc(e,n)),"function"==typeof r&&r(t,e,n)},e),i.promise},xf.prototype.setPriority=function(t,e){fa("Reference.setPriority",1,2,arguments.length),tc("Reference.setPriority",this.path),Yu("Reference.setPriority",1,t,!1),da("Reference.setPriority",2,e,!0);var n=new Us;return this.repo.setWithPriority(this.path.child(".priority"),t,null,n.wrapCallback(e)),n.promise},xf.prototype.push=function(t,e){fa("Reference.push",0,2,arguments.length),tc("Reference.push",this.path),Qu("Reference.push",1,t,this.path,!0),da("Reference.push",2,e,!0);var n,r=this.repo.serverTime(),i=dc(r),o=this.child(i),s=this.child(i);return n=null!=t?o.set(t,e).then(function(){return s}):Promise.resolve(s),o.then=n.then.bind(n),o.catch=n.then.bind(n,void 0),"function"==typeof e&&n.catch(function(){}),o},xf.prototype.onDisconnect=function(){return tc("Reference.onDisconnect",this.path),new ac(this.repo,this.path)},Object.defineProperty(xf.prototype,"database",{get:function(){return this.databaseProp()},enumerable:!1,configurable:!0}),Object.defineProperty(xf.prototype,"key",{get:function(){return this.getKey()},enumerable:!1,configurable:!0}),Object.defineProperty(xf.prototype,"parent",{get:function(){return this.getParent()},enumerable:!1,configurable:!0}),Object.defineProperty(xf.prototype,"root",{get:function(){return this.getRoot()},enumerable:!1,configurable:!0}),xf);function xf(t,e){if(!(t instanceof Tf))throw new Error("new Reference() no longer supported - use app.database().");return Rf.call(this,t,e,Of.DEFAULT,!1)||this}Th.__referenceConstructor=Df,_l.__referenceConstructor=Df;var Lf,Mf,Ff=function(){this.children={},this.childCount=0,this.value=null},Uf=(jf.prototype.subTree=function(t){for(var e=t instanceof Lu?t:new Lu(t),n=this,r=e.getFront();null!==r;)n=new jf(r,n,ra(n.node_.children,r)||new Ff),r=(e=e.popFront()).getFront();return n},jf.prototype.getValue=function(){return this.node_.value},jf.prototype.setValue=function(t){Ds(void 0!==t,"Cannot set value to undefined"),this.node_.value=t,this.updateParents_()},jf.prototype.clear=function(){this.node_.value=null,this.node_.children={},this.node_.childCount=0,this.updateParents_()},jf.prototype.hasChildren=function(){return 0<this.node_.childCount},jf.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},jf.prototype.forEachChild=function(n){var r=this;ku(this.node_.children,function(t,e){n(new jf(t,r,e))})},jf.prototype.forEachDescendant=function(e,t,n){t&&!n&&e(this),this.forEachChild(function(t){t.forEachDescendant(e,!0,n)}),t&&n&&e(this)},jf.prototype.forEachAncestor=function(t,e){for(var n=e?this:this.parent();null!==n;){if(t(n))return!0;n=n.parent()}return!1},jf.prototype.forEachImmediateDescendantWithValue=function(e){this.forEachChild(function(t){null!==t.getValue()?e(t):t.forEachImmediateDescendantWithValue(e)})},jf.prototype.path=function(){return new Lu(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},jf.prototype.name=function(){return this.name_},jf.prototype.parent=function(){return this.parent_},jf.prototype.updateParents_=function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)},jf.prototype.updateChild_=function(t,e){var n=e.isEmpty(),r=na(this.node_.children,t);n&&r?(delete this.node_.children[t],this.node_.childCount--,this.updateParents_()):n||r||(this.node_.children[t]=e.node_,this.node_.childCount++,this.updateParents_())},jf);function jf(t,e,n){void 0===t&&(t=""),void 0===e&&(e=null),void 0===n&&(n=new Ff),this.name_=t,this.parent_=e,this.node_=n}(Mf=Lf=Lf||{})[Mf.RUN=0]="RUN",Mf[Mf.SENT=1]="SENT",Mf[Mf.COMPLETED=2]="COMPLETED",Mf[Mf.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",Mf[Mf.NEEDS_ABORT=4]="NEEDS_ABORT",Tf.MAX_TRANSACTION_RETRIES_=25,Tf.prototype.transactionsInit_=function(){this.transactionQueueTree_=new Uf},Tf.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);function i(){}var o=new Df(this,t);o.on("value",i);var s={path:t,update:e,onComplete:n,status:null,order:_u(),applyLocally:r,retryCount:0,unwatcher:function(){o.off("value",i)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},a=this.getLatestState_(t);s.currentInputSnapshot=a;var u=s.update(a.val());if(void 0===u){if(s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete){var c=new ph(s.currentInputSnapshot,new Df(this,s.path),xc);s.onComplete(null,!1,c)}}else{sc("transaction failed: Data returned ",u,s.path),s.status=Lf.RUN;var h=this.transactionQueueTree_.subTree(t),l=h.getValue()||[];l.push(s),h.setValue(l);var f=void 0;if("object"==typeof u&&null!==u&&na(u,".priority"))f=ra(u,".priority"),Ds(zu(f),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.");else f=(this.serverSyncTree_.calcCompleteEventCache(t)||eh.EMPTY_NODE).getPriority().val();f=f;var p=this.generateServerValues(),d=ah(u,f),v=Ph(d,a,p);s.currentOutputSnapshotRaw=d,s.currentOutputSnapshotResolved=v,s.currentWriteId=this.getNextWriteId_();var y=this.serverSyncTree_.applyUserOverwrite(t,v,s.currentWriteId,s.applyLocally);this.eventQueue_.raiseEventsForChangedPath(t,y),this.sendReadyTransactions_()}},Tf.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||eh.EMPTY_NODE},Tf.prototype.sendReadyTransactions_=function(t){var e=this;if(void 0===t&&(t=this.transactionQueueTree_),t||this.pruneCompletedTransactionsBelowNode_(t),null!==t.getValue()){var n=this.buildTransactionQueue_(t);Ds(0<n.length,"Sending zero length transaction queue"),n.every(function(t){return t.status===Lf.RUN})&&this.sendTransactionQueue_(t.path(),n)}else t.hasChildren()&&t.forEachChild(function(t){e.sendReadyTransactions_(t)})},Tf.prototype.sendTransactionQueue_=function(a,u){for(var c=this,t=u.map(function(t){return t.currentWriteId}),e=this.getLatestState_(a,t),n=e,r=e.hash(),i=0;i<u.length;i++){var o=u[i];Ds(o.status===Lf.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),o.status=Lf.SENT,o.retryCount++;var s=Lu.relativePath(a,o.path);n=n.updateChild(s,o.currentOutputSnapshotRaw)}var h=n.val(!0),l=a;this.server_.put(l.toString(),h,function(t){c.log_("transaction put response",{path:l.toString(),status:t});var e=[];if("ok"===t){for(var n=[],r=0;r<u.length;r++){if(u[r].status=Lf.COMPLETED,e=e.concat(c.serverSyncTree_.ackUserWrite(u[r].currentWriteId)),u[r].onComplete){var i=u[r].currentOutputSnapshotResolved,o=new Df(c,u[r].path),s=new ph(i,o,xc);n.push(u[r].onComplete.bind(null,null,!0,s))}u[r].unwatcher()}c.pruneCompletedTransactionsBelowNode_(c.transactionQueueTree_.subTree(a)),c.sendReadyTransactions_(),c.eventQueue_.raiseEventsForChangedPath(a,e);for(r=0;r<n.length;r++)Pu(n[r])}else{if("datastale"===t)for(r=0;r<u.length;r++)u[r].status===Lf.SENT_NEEDS_ABORT?u[r].status=Lf.NEEDS_ABORT:u[r].status=Lf.RUN;else{fu("transaction at "+l.toString()+" failed: "+t);for(r=0;r<u.length;r++)u[r].status=Lf.NEEDS_ABORT,u[r].abortReason=t}c.rerunTransactions_(a)}},r)},Tf.prototype.rerunTransactions_=function(t){var e=this.getAncestorTransactionNode_(t),n=e.path(),r=this.buildTransactionQueue_(e);return this.rerunTransactionQueue_(r,n),n},Tf.prototype.rerunTransactionQueue_=function(t,e){if(0!==t.length){for(var n,r=[],i=[],o=t.filter(function(t){return t.status===Lf.RUN}).map(function(t){return t.currentWriteId}),s=0;s<t.length;s++){var a=t[s],u=Lu.relativePath(e,a.path),c=!1,h=void 0;if(Ds(null!==u,"rerunTransactionsUnderNode_: relativePath should not be null."),a.status===Lf.NEEDS_ABORT)c=!0,h=a.abortReason,i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0));else if(a.status===Lf.RUN)if(a.retryCount>=Tf.MAX_TRANSACTION_RETRIES_)c=!0,h="maxretry",i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0));else{var l=this.getLatestState_(a.path,o);a.currentInputSnapshot=l;var f=t[s].update(l.val());if(void 0!==f){sc("transaction failed: Data returned ",f,a.path);var p=ah(f);"object"==typeof f&&null!=f&&na(f,".priority")||(p=p.updatePriority(l.getPriority()));var d=a.currentWriteId,v=this.generateServerValues(),y=Ph(p,l,v);a.currentOutputSnapshotRaw=p,a.currentOutputSnapshotResolved=y,a.currentWriteId=this.getNextWriteId_(),o.splice(o.indexOf(d),1),i=(i=i.concat(this.serverSyncTree_.applyUserOverwrite(a.path,y,a.currentWriteId,a.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(d,!0))}else c=!0,h="nodata",i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(e,i),i=[],c&&(t[s].status=Lf.COMPLETED,n=t[s].unwatcher,setTimeout(n,Math.floor(0)),t[s].onComplete))if("nodata"===h){var g=new Df(this,t[s].path),m=t[s].currentInputSnapshot,b=new ph(m,g,xc);r.push(t[s].onComplete.bind(null,null,!1,b))}else r.push(t[s].onComplete.bind(null,new Error(h),!1,null))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(s=0;s<r.length;s++)Pu(r[s]);this.sendReadyTransactions_()}},Tf.prototype.getAncestorTransactionNode_=function(t){var e,n=this.transactionQueueTree_;for(e=t.getFront();null!==e&&null===n.getValue();)n=n.subTree(e),e=(t=t.popFront()).getFront();return n},Tf.prototype.buildTransactionQueue_=function(t){var e=[];return this.aggregateTransactionQueuesForNode_(t,e),e.sort(function(t,e){return t.order-e.order}),e},Tf.prototype.aggregateTransactionQueuesForNode_=function(t,e){var n=this,r=t.getValue();if(null!==r)for(var i=0;i<r.length;i++)e.push(r[i]);t.forEachChild(function(t){n.aggregateTransactionQueuesForNode_(t,e)})},Tf.prototype.pruneCompletedTransactionsBelowNode_=function(t){var e=this,n=t.getValue();if(n){for(var r=0,i=0;i<n.length;i++)n[i].status!==Lf.COMPLETED&&(n[r]=n[i],r++);n.length=r,t.setValue(0<n.length?n:null)}t.forEachChild(function(t){e.pruneCompletedTransactionsBelowNode_(t)})},Tf.prototype.abortTransactions_=function(t){var e=this,n=this.getAncestorTransactionNode_(t).path(),r=this.transactionQueueTree_.subTree(t);return r.forEachAncestor(function(t){e.abortTransactionsOnNode_(t)}),this.abortTransactionsOnNode_(r),r.forEachDescendant(function(t){e.abortTransactionsOnNode_(t)}),n},Tf.prototype.abortTransactionsOnNode_=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,o=0;o<e.length;o++)if(e[o].status!==Lf.SENT_NEEDS_ABORT)if(e[o].status===Lf.SENT)Ds(i===o-1,"All SENT items should be at beginning of queue."),e[i=o].status=Lf.SENT_NEEDS_ABORT,e[o].abortReason="set";else if(Ds(e[o].status===Lf.RUN,"Unexpected transaction status in abort"),e[o].unwatcher(),r=r.concat(this.serverSyncTree_.ackUserWrite(e[o].currentWriteId,!0)),e[o].onComplete){n.push(e[o].onComplete.bind(null,new Error("set"),!1,null))}-1===i?t.setValue(null):e.length=i+1,this.eventQueue_.raiseEventsForChangedPath(t.path(),r);for(o=0;o<n.length;o++)Pu(n[o])}};var Vf=(qf.prototype.getToken=function(t){return this.auth_?this.auth_.getToken(t).catch(function(t){return t&&"auth/token-not-initialized"===t.code?(uu("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(t)}):Promise.resolve(null)},qf.prototype.addTokenChangeListener=function(e){this.auth_?this.auth_.addAuthTokenListener(e):(setTimeout(function(){return e(null)},0),this.authProvider_.get().then(function(t){return t.addAuthTokenListener(e)}))},qf.prototype.removeTokenChangeListener=function(e){this.authProvider_.get().then(function(t){return t.removeAuthTokenListener(e)})},qf.prototype.notifyForInvalidToken=function(){var t='Provided authentication credentials for the app named "'+this.app_.name+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.app_.options?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.app_.options?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',fu(t)},qf);function qf(t,e){var n=this;this.app_=t,this.authProvider_=e,this.auth_=null,this.auth_=e.getImmediate({optional:!0}),this.auth_||e.get().then(function(t){return n.auth_=t})}var Bf,Wf="databaseURL",Hf=(Kf.getInstance=function(){return Bf=Bf||new Kf},Kf.prototype.interrupt=function(){var e,t,n,r;try{for(var i=Cs(Object.keys(this.repos_)),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,Cs(Object.keys(this.repos_[s]))),u=a.next();!u.done;u=a.next()){var c=u.value;this.repos_[s][c].interrupt()}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},Kf.prototype.resume=function(){var e,t,n,r;try{for(var i=Cs(Object.keys(this.repos_)),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,Cs(Object.keys(this.repos_[s]))),u=a.next();!u.done;u=a.next()){var c=u.value;this.repos_[s][c].resume()}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},Kf.prototype.databaseFromApp=function(t,e,n){var r=n||t.options[Wf];void 0===r&&lu("Can't determine Firebase Database URL.  Be sure to include "+Wf+" option when calling firebase.initializeApp().");var i=Hu(r),o=i.repoInfo,s=void 0;"undefined"!=typeof process&&(s=process.env.FIREBASE_DATABASE_EMULATOR_HOST),s?(r="http://"+s+"?ns="+o.namespace,o=(i=Hu(r)).repoInfo):i.repoInfo.secure;var a=new Vf(t,e);return ec("Invalid Firebase Database URL",1,i),i.path.isEmpty()||lu("Database URL must point to the root of a Firebase Database (not including a child path)."),this.createRepo(o,t,a).database},Kf.prototype.deleteRepo=function(t){var e=ra(this.repos_,t.app.name);e&&ra(e,t.repoInfo_.toURLString())===t||lu("Database "+t.app.name+"("+t.repoInfo_+") has already been deleted."),t.interrupt(),delete e[t.repoInfo_.toURLString()]},Kf.prototype.createRepo=function(t,e,n){var r=ra(this.repos_,e.name);r||(r={},this.repos_[e.name]=r);var i=ra(r,t.toURLString());return i&&lu("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),i=new Tf(t,this.useRestClient_,e,n),r[t.toURLString()]=i},Kf.prototype.forceRestClient=function(t){this.useRestClient_=t},Kf);function Kf(){this.repos_={},this.useRestClient_=!1}var Gf=(Object.defineProperty(zf.prototype,"app",{get:function(){return this.repo_.app},enumerable:!1,configurable:!0}),zf.prototype.ref=function(t){return this.checkDeleted_("ref"),fa("database.ref",0,1,arguments.length),t instanceof Df?this.refFromURL(t.toString()):void 0!==t?this.root_.child(t):this.root_},zf.prototype.refFromURL=function(t){var e="database.refFromURL";this.checkDeleted_(e),fa(e,1,1,arguments.length);var n=Hu(t);ec(e,1,n);var r=n.repoInfo;return r.host!==this.repo_.repoInfo_.host&&lu(e+": Host name does not match the current database: (found "+r.host+" but expected "+this.repo_.repoInfo_.host+")"),this.ref(n.path.toString())},zf.prototype.checkDeleted_=function(t){null===this.repo_&&lu("Cannot call "+t+" on a deleted database.")},zf.prototype.goOffline=function(){fa("database.goOffline",0,0,arguments.length),this.checkDeleted_("goOffline"),this.repo_.interrupt()},zf.prototype.goOnline=function(){fa("database.goOnline",0,0,arguments.length),this.checkDeleted_("goOnline"),this.repo_.resume()},zf.ServerValue={TIMESTAMP:{".sv":"timestamp"},increment:function(t){return{".sv":{increment:t}}}},zf);function zf(t){(this.repo_=t)instanceof Tf||lu("Don't call new Database() directly - please use firebase.database()."),this.root_=new Df(t,Lu.Empty),this.INTERNAL=new Qf(this)}var Qf=(Xf.prototype.delete=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return this.database.checkDeleted_("delete"),Hf.getInstance().deleteRepo(this.database.repo_),this.database.repo_=null,this.database.root_=null,this.database.INTERNAL=null,this.database=null,[2]})})},Xf);function Xf(t){this.database=t}var Yf=Object.freeze({__proto__:null,forceLongPolling:function(){cf.forceDisallow(),nf.forceAllow()},forceWebSockets:function(){nf.forceDisallow()},isWebSocketsAvailable:function(){return cf.isAvailable()},setSecurityDebugCallback:function(t,e){t.repo.persistentConnection_.securityDebugCallback_=e},stats:function(t,e){t.repo.stats(e)},statsIncrementCounter:function(t,e){t.repo.statsIncrementCounter(e)},dataUpdateCount:function(t){return t.repo.dataUpdateCount},interceptServerData:function(t,e){return t.repo.interceptServerData_(e)}}),$f=mf;mf.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},mf.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var Jf,Zf,tp=pf,ep=Bu,np=Object.freeze({__proto__:null,DataConnection:$f,RealTimeConnection:tp,hijackHash:function(i){var o=mf.prototype.put;return mf.prototype.put=function(t,e,n,r){void 0!==r&&(r=i()),o.call(this,t,e,n,r)},function(){mf.prototype.put=o}},ConnectionTarget:ep,queryIdentifier:function(t){return t.queryIdentifier()},forceRestClient:function(t){Hf.getInstance().forceRestClient(t)}}),rp=Gf.ServerValue;function ip(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}Zf=(Jf=zl).SDK_VERSION,af=Zf,Jf.INTERNAL.registerComponent(new ga("database",function(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal");return Hf.getInstance().databaseFromApp(n,r,e)},"PUBLIC").setServiceProps({Reference:Df,Query:Th,Database:Gf,DataSnapshot:ph,enableLogging:au,INTERNAL:Yf,ServerValue:rp,TEST_ACCESS:np}).setMultipleInstances(!0)),Jf.registerVersion("@firebase/database","0.6.9");var op,sp="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ap=ap||{},up=sp||self;function cp(){}function hp(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function lp(t){var e=hp(t);return"array"==e||"object"==e&&"number"==typeof t.length}function fp(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var pp="closure_uid_"+(1e9*Math.random()>>>0),dp=0;function vp(t,e,n){return t.call.apply(t.bind,arguments)}function yp(e,n,t){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,r),e.apply(n,t)}}return function(){return e.apply(n,arguments)}}function gp(t,e,n){return(gp=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?vp:yp).apply(null,arguments)}function mp(e){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}var bp=Date.now||function(){return+new Date};function wp(t,e){function n(){}n.prototype=e.prototype,t.M=e.prototype,t.prototype=new n,t.prototype.constructor=t}function _p(){this.j=this.j,this.i=this.i}_p.prototype.j=!1,_p.prototype.da=function(){if(!this.j&&(this.j=!0,this.C(),0))t=this,Object.prototype.hasOwnProperty.call(t,pp)&&t[pp]||(t[pp]=++dp);var t},_p.prototype.C=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var Ep=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},Ip=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i="string"==typeof t?t.split(""):t,o=0;o<r;o++)o in i&&e.call(n,i[o],o,t)};function Tp(){return Array.prototype.concat.apply([],arguments)}function Sp(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function Cp(t){return/^[\s\xa0]*$/.test(t)}var Np,Ap=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function kp(t,e){return-1!=t.indexOf(e)}function Op(t,e){return t<e?-1:e<t?1:0}t:{var Pp=up.navigator;if(Pp){var Rp=Pp.userAgent;if(Rp){Np=Rp;break t}}Np=""}function Dp(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function xp(t){var e={};for(var n in t)e[n]=t[n];return e}var Lp="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Mp(t){for(var e,n,r=1;r<arguments.length;r++){for(e in n=arguments[r])t[e]=n[e];for(var i=0;i<Lp.length;i++)e=Lp[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function Fp(t){return Fp[" "](t),t}Fp[" "]=cp;var Up,jp,Vp=kp(Np,"Opera"),qp=kp(Np,"Trident")||kp(Np,"MSIE"),Bp=kp(Np,"Edge"),Wp=Bp||qp,Hp=kp(Np,"Gecko")&&!(kp(Np.toLowerCase(),"webkit")&&!kp(Np,"Edge"))&&!(kp(Np,"Trident")||kp(Np,"MSIE"))&&!kp(Np,"Edge"),Kp=kp(Np.toLowerCase(),"webkit")&&!kp(Np,"Edge");function Gp(){var t=up.document;return t?t.documentMode:void 0}t:{var zp="",Qp=(jp=Np,Hp?/rv:([^\);]+)(\)|;)/.exec(jp):Bp?/Edge\/([\d\.]+)/.exec(jp):qp?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(jp):Kp?/WebKit\/(\S+)/.exec(jp):Vp?/(?:Version)[ \/]?(\S+)/.exec(jp):void 0);if(Qp&&(zp=Qp?Qp[1]:""),qp){var Xp=Gp();if(null!=Xp&&Xp>parseFloat(zp)){Up=String(Xp);break t}}Up=zp}var Yp,$p={};function Jp(a){return t=a,e=function(){for(var t=0,e=Ap(String(Up)).split("."),n=Ap(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var o=e[i]||"",s=n[i]||"";do{if(o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==o[0].length&&0==s[0].length)break;t=Op(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||Op(0==o[2].length,0==s[2].length)||Op(o[2],s[2]),o=o[3],s=s[3]}while(0==t)}return 0<=t},n=$p,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}if(up.document&&qp){var Zp=Gp();Yp=Zp||(parseInt(Up,10)||void 0)}else Yp=void 0;var td=Yp,ed=!qp||9<=Number(td),nd=qp&&!Jp("9"),rd=function(){if(!up.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{up.addEventListener("test",cp,e),up.removeEventListener("test",cp,e)}catch(t){}return t}();function id(t,e){this.type=t,this.a=this.target=e,this.defaultPrevented=!1}function od(t,e){if(id.call(this,t?t.type:""),this.relatedTarget=this.a=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.pointerId=0,this.pointerType="",this.c=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.a=e,e=t.relatedTarget){if(Hp){t:{try{Fp(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:sd[t.pointerType]||"",(this.c=t).defaultPrevented&&this.b()}}id.prototype.b=function(){this.defaultPrevented=!0},wp(od,id);var sd={2:"touch",3:"pen",4:"mouse"};od.prototype.b=function(){od.M.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,nd)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}};var ad="closure_listenable_"+(1e6*Math.random()|0),ud=0;function cd(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.aa=i,this.key=++ud,this.V=this.X=!1}function hd(t){t.V=!0,t.listener=null,t.proxy=null,t.src=null,t.aa=null}function ld(t){this.src=t,this.a={},this.b=0}function fd(t,e){var n=e.type;if(n in t.a){var r,i=t.a[n],o=Ep(i,e);(r=0<=o)&&Array.prototype.splice.call(i,o,1),r&&(hd(e),0==t.a[n].length&&(delete t.a[n],t.b--))}}function pd(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.V&&o.listener==e&&o.capture==!!n&&o.aa==r)return i}return-1}ld.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=pd(t,e,r,i);return-1<s?(e=t[s],n||(e.X=!1)):((e=new cd(e,this.src,o,!!r,i)).X=n,t.push(e)),e};var dd="closure_lm_"+(1e6*Math.random()|0),vd={};function yd(t,e,n,r,i){if(r&&r.once)return function t(e,n,r,i,o){if(Array.isArray(n)){for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);return null}r=Td(r);return e&&e[ad]?e.sa(n,r,fp(i)?!!i.capture:!!i,o):gd(e,n,r,!0,i,o)}(t,e,n,r,i);if(Array.isArray(e)){for(var o=0;o<e.length;o++)yd(t,e[o],n,r,i);return null}return n=Td(n),t&&t[ad]?t.ra(e,n,fp(r)?!!r.capture:!!r,i):gd(t,e,n,!1,r,i)}function gd(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s=fp(i)?!!i.capture:!!i;if(s&&!ed)return null;var a,u,c=Ed(t);if(c||(t[dd]=c=new ld(t)),(n=c.add(e,n,r,s,o)).proxy)return n;if(a=_d,r=u=ed?function(t){return a.call(u.src,u.listener,t)}:function(t){if(!(t=a.call(u.src,u.listener,t)))return t},(n.proxy=r).src=t,r.listener=n,t.addEventListener)rd||(i=s),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(bd(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function md(t){if("number"!=typeof t&&t&&!t.V){var e=t.src;if(e&&e[ad])fd(e.c,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(bd(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Ed(e))?(fd(n,t),0==n.b&&(n.src=null,e[dd]=null)):hd(t)}}}function bd(t){return t in vd?vd[t]:vd[t]="on"+t}function wd(t,e){var n=t.listener,r=t.aa||t.src;return t.X&&md(t),n.call(r,e)}function _d(t,e){if(t.V)return!0;if(ed)return wd(t,new od(e,this));if(!e)t:{e=["window","event"];for(var n=up,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}return wd(t,e=new od(e,this))}function Ed(t){return(t=t[dd])instanceof ld?t:null}var Id="__closure_events_fn_"+(1e9*Math.random()>>>0);function Td(e){return"function"==hp(e)?e:(e[Id]||(e[Id]=function(t){return e.handleEvent(t)}),e[Id])}function Sd(){_p.call(this),this.c=new ld(this),(this.J=this).A=null}function Cd(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var s=e[o];if(s&&!s.V&&s.capture==n){var a=s.listener,u=s.aa||s.src;s.X&&fd(t.c,s),i=!1!==a.call(u,r)&&i}}return i&&!r.defaultPrevented}wp(Sd,_p),Sd.prototype[ad]=!0,(op=Sd.prototype).addEventListener=function(t,e,n,r){yd(this,t,e,n,r)},op.removeEventListener=function(t,e,n,r){!function t(e,n,r,i,o){if(Array.isArray(n))for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);else i=fp(i)?!!i.capture:!!i,r=Td(r),e&&e[ad]?(e=e.c,(n=String(n).toString())in e.a&&-1<(r=pd(s=e.a[n],r,i,o))&&(hd(s[r]),Array.prototype.splice.call(s,r,1),0==s.length&&(delete e.a[n],e.b--))):(e=e&&Ed(e))&&(n=e.a[n.toString()],e=-1,n&&(e=pd(n,r,i,o)),(r=-1<e?n[e]:null)&&md(r))}(this,t,e,n,r)},op.dispatchEvent=function(t){var e,n=this.A;if(n)for(e=[];n;n=n.A)e.push(n);n=this.J;var r=t.type||t;if("string"==typeof t)t=new id(t,n);else if(t instanceof id)t.target=t.target||n;else{var i=t;Mp(t=new id(r,n),i)}if(i=!0,e)for(var o=e.length-1;0<=o;o--){var s=t.a=e[o];i=Cd(s,r,!0,t)&&i}if(i=Cd(s=t.a=n,r,!0,t)&&i,i=Cd(s,r,!1,t)&&i,e)for(o=0;o<e.length;o++)i=Cd(s=t.a=e[o],r,!1,t)&&i;return i},op.C=function(){if(Sd.M.C.call(this),this.c){var t,e=this.c;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)hd(n[r]);delete e.a[t],e.b--}}this.A=null},op.ra=function(t,e,n,r){return this.c.add(String(t),e,!1,n,r)},op.sa=function(t,e,n,r){return this.c.add(String(t),e,!0,n,r)};var Nd=up.JSON.stringify;function Ad(){this.b=this.a=null}var kd,Od=(Pd.prototype.get=function(){var t;return 0<this.b?(this.b--,t=this.a,this.a=t.next,t.next=null):t=this.c(),t},new Pd(function(){return new Rd},function(t){t.reset()},100));function Pd(t,e,n){this.f=n,this.c=t,this.g=e,this.b=0,this.a=null}function Rd(){this.next=this.b=this.a=null}function Dd(t){up.setTimeout(function(){throw t},0)}function xd(t,e){var n;kd||(n=up.Promise.resolve(void 0),kd=function(){n.then(Fd)}),Ld||(kd(),Ld=!0),Md.add(t,e)}Ad.prototype.add=function(t,e){var n=Od.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},Rd.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null};var Ld=!(Rd.prototype.reset=function(){this.next=this.b=this.a=null}),Md=new Ad;function Fd(){for(var t;r=n=void 0,r=null,(n=Md).a&&(r=n.a,n.a=n.a.next,n.a||(n.b=null),r.next=null),t=r;){try{t.a.call(t.b)}catch(t){Dd(t)}var e=Od;e.g(t),e.b<e.f&&(e.b++,t.next=e.a,e.a=t)}var n,r;Ld=!1}function Ud(t,e){Sd.call(this),this.b=t||1,this.a=e||up,this.f=gp(this.Ua,this),this.g=bp()}function jd(t){t.Z=!1,t.L&&(t.a.clearTimeout(t.L),t.L=null)}function Vd(t,e,n){if("function"==hp(t))n&&(t=gp(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=gp(t.handleEvent,t)}return 2147483647<Number(e)?-1:up.setTimeout(t,e||0)}function qd(t,e,n){_p.call(this),this.f=null!=n?gp(t,n):t,this.c=e,this.b=gp(this.Pa,this),this.a=[]}function Bd(t){t.T=Vd(t.b,t.c),t.f.apply(null,t.a)}function Wd(t){_p.call(this),this.b=t,this.a={}}wp(Ud,Sd),(op=Ud.prototype).Z=!1,op.L=null,op.Ua=function(){if(this.Z){var t=bp()-this.g;0<t&&t<.8*this.b?this.L=this.a.setTimeout(this.f,this.b-t):(this.L&&(this.a.clearTimeout(this.L),this.L=null),this.dispatchEvent("tick"),this.Z&&(jd(this),this.start()))}},op.start=function(){this.Z=!0,this.L||(this.L=this.a.setTimeout(this.f,this.b),this.g=bp())},op.C=function(){Ud.M.C.call(this),jd(this),delete this.a},wp(qd,_p),(op=qd.prototype).ba=!1,op.T=null,op.Ia=function(t){this.a=arguments,this.T?this.ba=!0:Bd(this)},op.C=function(){qd.M.C.call(this),this.T&&(up.clearTimeout(this.T),this.T=null,this.ba=!1,this.a=[])},op.Pa=function(){this.T=null,this.ba&&(this.ba=!1,Bd(this))},wp(Wd,_p);var Hd=[];function Kd(t,e,n,r){Array.isArray(n)||(n&&(Hd[0]=n.toString()),n=Hd);for(var i=0;i<n.length;i++){var o=yd(e,n[i],r||t.handleEvent,!1,t.b||t);if(!o)break;t.a[o.key]=o}}function Gd(t){Dp(t.a,function(t,e){this.a.hasOwnProperty(e)&&md(t)},t),t.a={}}function zd(){}Wd.prototype.C=function(){Wd.M.C.call(this),Gd(this)},Wd.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Qd=null;function Xd(){return Qd=Qd||new Sd}function Yd(t){id.call(this,"serverreachability",t)}function $d(t){var e=Xd();e.dispatchEvent(new Yd(e))}function Jd(t){id.call(this,"statevent",t)}function Zd(t){var e=Xd();e.dispatchEvent(new Jd(e))}function tv(t){id.call(this,"timingevent",t)}function ev(t,e){if("function"!=hp(t))throw Error("Fn must not be null and must be a function");return up.setTimeout(function(){t()},e)}wp(Yd,id),wp(Jd,id),wp(tv,id);var nv={NO_ERROR:0,Va:1,bb:2,ab:3,Ya:4,$a:5,cb:6,za:7,TIMEOUT:8,gb:9},rv={Xa:"complete",kb:"success",Aa:"error",za:"abort",ib:"ready",jb:"readystatechange",TIMEOUT:"timeout",eb:"incrementaldata",hb:"progress",Za:"downloadprogress",lb:"uploadprogress"};function iv(){}function ov(t){var e;return(e=t.a)||(e=t.a={}),e}function sv(){}iv.prototype.a=null;var av,uv={OPEN:"a",Wa:"b",Aa:"c",fb:"d"};function cv(){id.call(this,"d")}function hv(){id.call(this,"c")}function lv(){}function fv(t,e,n){this.g=t,this.W=e,this.U=n||1,this.G=new Wd(this),this.N=pv,t=Wp?125:void 0,this.O=new Ud(t),this.m=null,this.b=!1,this.j=this.A=this.f=this.B=this.s=this.P=this.h=null,this.i=[],this.a=null,this.w=0,this.c=this.v=null,this.H=-1,this.l=!1,this.J=0,this.D=null,this.o=this.R=this.F=!1}wp(cv,id),wp(hv,id),wp(lv,iv),av=new lv;var pv=45e3,dv={},vv={};function yv(t,e,n){t.B=1,t.f=Uv(Rv(e)),t.j=n,t.F=!0,gv(t,null)}function gv(t,e){t.s=bp(),wv(t),t.A=Rv(t.f);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),$v(n.b,"t",r),t.w=0,t.a=By(t.g,t.g.w?e:null),0<t.J&&(t.D=new qd(gp(t.ya,t,t.a),t.J)),Kd(t.G,t.a,"readystatechange",t.Sa),e=t.m?xp(t.m):{},t.j?(t.v||(t.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.a.$(t.A,t.v,t.j,e)):(t.v="GET",t.a.$(t.A,t.v,null,e)),$d(1)}function mv(t,e,n){for(var r=!0;!t.l&&t.w<n.length;){var i=bv(t,n);if(i==vv){4==e&&(t.c=4,Zd(14),r=!1);break}if(i==dv){t.c=4,Zd(15),r=!1;break}Sv(t,i)}4==e&&0==n.length&&(t.c=1,Zd(16),r=!1),t.b=t.b&&r,r||(Tv(t),Iv(t))}function bv(t,e){var n=t.w,r=e.indexOf("\n",n);return-1==r?vv:(n=Number(e.substring(n,r)),isNaN(n)?dv:(r+=1)+n>e.length?vv:(e=e.substr(r,n),t.w=r+n,e))}function wv(t){t.P=bp()+t.N,_v(t,t.N)}function _v(t,e){if(null!=t.h)throw Error("WatchDog timer not null");t.h=ev(gp(t.Qa,t),e)}function Ev(t){t.h&&(up.clearTimeout(t.h),t.h=null)}function Iv(t){0==t.g.u||t.l||Fy(t.g,t)}function Tv(t){Ev(t);var e=t.D;e&&"function"==typeof e.da&&e.da(),t.D=null,jd(t.O),Gd(t.G),t.a&&(e=t.a,t.a=null,e.abort(),e.da())}function Sv(t,e){try{var n=t.g;if(0!=n.u&&(n.a==t||iy(n.b,t)))if(n.A=t.H,!t.o&&iy(n.b,t)&&3==n.u){try{var r=n.ja.a.parse(e)}catch(t){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.i){if(n.a){if(!(n.a.s+3e3<t.s))break t;My(n),n.a.cancel(),n.a=null}Ly(n),Zd(18)}}else n.ia=i[1],0<n.ia-n.G&&i[2]<37500&&n.U&&0==n.m&&!n.l&&(n.l=ev(gp(n.Na,n),6e3));if(ry(n.b)<=1&&n.O){try{n.O()}catch(t){}n.O=void 0}}else jy(n,11)}else if(!t.o&&n.a!=t||My(n),!Cp(e))for(e=r=n.ja.a.parse(e),r=0;r<e.length;r++)if(i=e[r],n.G=i[0],i=i[1],2==n.u)if("c"==i[0]){n.B=i[1],n.R=i[2];var o=i[3];null!=o&&(n.oa=o);var s=i[5];null!=s&&"number"==typeof s&&0<s&&(n.D=1.5*s);var a=n,u=t.a;if(u){var c=u.a?u.a.getResponseHeader("X-Client-Wire-Protocol"):null;if(c){var h=a.b;!h.a&&(kp(c,"spdy")||kp(c,"quic")||kp(c,"h2"))&&(h.f=h.g,h.a=new Set,h.b&&(oy(h,h.b),h.b=null))}if(a.s){var l=u.a?u.a.getResponseHeader("X-HTTP-Session-Id"):null;l&&(a.ha=l,Fv(a.v,a.s,l))}}n.u=3,n.c&&n.c.na();var f=t;if((a=n).ea=qy(a,a.w?a.R:null,a.P),f.o){sy(a.b,f);var p=f,d=a.D;d&&p.setTimeout(d),p.h&&(Ev(p),wv(p)),a.a=f}else xy(a);0<n.f.length&&Oy(n)}else"stop"!=i[0]&&"close"!=i[0]||jy(n,7);else 3==n.u&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?jy(n,7):Ny(n):"noop"!=i[0]&&n.c&&n.c.ma(i),n.m=0);$d(4)}catch(t){}}function Cv(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(lp(t)||"string"==typeof t)Ip(t,e,void 0);else{if(t.K&&"function"==typeof t.K)var n=t.K();else if(t.I&&"function"==typeof t.I)n=void 0;else if(lp(t)||"string"==typeof t){n=[];for(var r=t.length,i=0;i<r;i++)n.push(i)}else for(i in n=[],r=0,t)n[r++]=i;i=(r=function(t){if(t.I&&"function"==typeof t.I)return t.I();if("string"==typeof t)return t.split("");if(lp(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t)).length;for(var o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}}function Nv(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof Nv)for(n=t.K(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function Av(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];kv(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){var i={};for(n=e=0;e<t.a.length;)kv(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function kv(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(op=fv.prototype).setTimeout=function(t){this.N=t},op.Sa=function(t){t=t.target;var e=this.D;e&&3==Iy(t)?e.Ia():this.ya(t)},op.ya=function(t){try{if(t==this.a)t:{var e=Iy(this.a),n=this.a.qa(),r=this.a.S();if(!(e<3||3==e&&!Wp&&!this.a.Y())){this.l||4!=e||7==n||$d(8==n||r<=0?3:2),Ev(this);var i=this.a.S();this.H=i;var o=this.a.Y();if(this.b=200==i){if(this.R&&!this.o){e:{if(this.a){var s,a=this.a;if((s=a.a?a.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Cp(s)){var u=s;break e}}u=null}if(!u){this.b=!1,this.c=3,Zd(12),Tv(this),Iv(this);break t}this.o=!0,Sv(this,u)}this.F?(mv(this,e,o),Wp&&this.b&&3==e&&(Kd(this.G,this.O,"tick",this.Ra),this.O.start())):Sv(this,o),4==e&&Tv(this),this.b&&!this.l&&(4==e?Fy(this.g,this):(this.b=!1,wv(this)))}else 400==i&&0<o.indexOf("Unknown SID")?(this.c=3,Zd(12)):(this.c=0,Zd(13)),Tv(this),Iv(this)}}}catch(t){}},op.Ra=function(){if(this.a){var t=Iy(this.a),e=this.a.Y();this.w<e.length&&(Ev(this),mv(this,t,e),this.b&&4!=t&&wv(this))}},op.cancel=function(){this.l=!0,Tv(this)},op.Qa=function(){this.h=null;var t=bp();0<=t-this.P?(2!=this.B&&($d(3),Zd(17)),Tv(this),this.c=2,Iv(this)):_v(this,this.P-t)},(op=Nv.prototype).I=function(){Av(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},op.K=function(){return Av(this),this.a.concat()},op.get=function(t,e){return kv(this.b,t)?this.b[t]:e},op.set=function(t,e){kv(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},op.forEach=function(t,e){for(var n=this.K(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Ov=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Pv(t,e){if(this.c=this.j=this.f="",this.h=null,this.i=this.g="",this.a=!1,t instanceof Pv){this.a=void 0!==e?e:t.a,Dv(this,t.f),this.j=t.j,xv(this,t.c),Lv(this,t.h),this.g=t.g,e=t.b;var n=new zv;n.c=e.c,e.a&&(n.a=new Nv(e.a),n.b=e.b),Mv(this,n),this.i=t.i}else t&&(n=String(t).match(Ov))?(this.a=!!e,Dv(this,n[1]||"",!0),this.j=jv(n[2]||""),xv(this,n[3]||"",!0),Lv(this,n[4]),this.g=jv(n[5]||"",!0),Mv(this,n[6]||"",!0),this.i=jv(n[7]||"")):(this.a=!!e,this.b=new zv(null,this.a))}function Rv(t){return new Pv(t)}function Dv(t,e,n){t.f=n?jv(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function xv(t,e,n){t.c=n?jv(e,!0):e}function Lv(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.h=e}else t.h=null}function Mv(t,e,n){var r,i;e instanceof zv?(t.b=e,r=t.b,(i=t.a)&&!r.f&&(Qv(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Xv(this,e),$v(this,n,t))},r)),r.f=i):(n||(e=Vv(e,Kv)),t.b=new zv(e,t.a))}function Fv(t,e,n){t.b.set(e,n)}function Uv(t){return Fv(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^bp()).toString(36)),t}function jv(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Vv(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,qv),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function qv(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Pv.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Vv(e,Bv,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(Vv(e,Bv,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.h)&&t.push(":",String(n))),(n=this.g)&&(this.c&&"/"!=n.charAt(0)&&t.push("/"),t.push(Vv(n,"/"==n.charAt(0)?Hv:Wv,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",Vv(n,Gv)),t.join("")};var Bv=/[#\/\?@]/g,Wv=/[#\?:]/g,Hv=/[#\?]/g,Kv=/[#\?@]/g,Gv=/#/g;function zv(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Qv(n){n.a||(n.a=new Nv,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function Xv(t,e){Qv(t),e=Jv(t,e),kv(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,kv((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&Av(t)))}function Yv(t,e){return Qv(t),e=Jv(t,e),kv(t.a.b,e)}function $v(t,e,n){Xv(t,e),0<n.length&&(t.c=null,t.a.set(Jv(t,e),Sp(n)),t.b+=n.length)}function Jv(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function Zv(t,e){this.b=t,this.a=e}function ty(t){this.g=t||ey,t=up.PerformanceNavigationTiming?0<(t=up.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(up.ca&&up.ca.ua&&up.ca.ua()&&up.ca.ua().mb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Set),this.b=null,this.c=[]}(op=zv.prototype).add=function(t,e){Qv(this),this.c=null,t=Jv(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},op.forEach=function(n,r){Qv(this),this.a.forEach(function(t,e){Ip(t,function(t){n.call(r,t,e,this)},this)},this)},op.K=function(){Qv(this);for(var t=this.a.I(),e=this.a.K(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},op.I=function(t){Qv(this);var e=[];if("string"==typeof t)Yv(this,t)&&(e=Tp(e,this.a.get(Jv(this,t))));else{t=this.a.I();for(var n=0;n<t.length;n++)e=Tp(e,t[n])}return e},op.set=function(t,e){return Qv(this),this.c=null,Yv(this,t=Jv(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},op.get=function(t,e){return t&&0<(t=this.I(t)).length?String(t[0]):e},op.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.K(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.I(r);for(var o=0;o<r.length;o++){var s=i;""!==r[o]&&(s+="="+encodeURIComponent(String(r[o]))),t.push(s)}}return this.c=t.join("&")};var ey=10;function ny(t){return t.b||t.a&&t.a.size>=t.f}function ry(t){return t.b?1:t.a?t.a.size:0}function iy(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function oy(t,e){t.a?t.a.add(e):t.b=e}function sy(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function ay(t){var e,n;if(null!=t.b)return t.c.concat(t.b.i);if(null==t.a||0===t.a.size)return Sp(t.c);var r=t.c;try{for(var i=ip(t.a.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r.concat(s.i)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function uy(){}function cy(){this.a=new uy}function hy(t,r,e){var i=e||"";try{Cv(t,function(t,e){var n=t;fp(t)&&(n=Nd(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}function ly(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}ty.prototype.cancel=function(){var e,t;if(this.c=ay(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=ip(this.a.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.a.clear()}},uy.prototype.stringify=function(t){return up.JSON.stringify(t,void 0)},uy.prototype.parse=function(t){return up.JSON.parse(t,void 0)};var fy=up.JSON.parse;function py(t){Sd.call(this),this.headers=new Nv,this.G=t||null,this.b=!1,this.s=this.a=null,this.D="",this.h=0,this.f="",this.g=this.w=this.l=this.v=!1,this.o=0,this.m=null,this.H=dy,this.B=this.F=!1}wp(py,Sd);var dy="",vy=/^https?$/i,yy=["POST","PUT"];function gy(t){return"content-type"==t.toLowerCase()}function my(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,by(t),_y(t)}function by(t){t.v||(t.v=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function wy(t){if(t.b&&void 0!==ap&&(!t.s[1]||4!=Iy(t)||2!=t.S()))if(t.l&&4==Iy(t))Vd(t.va,0,t);else if(t.dispatchEvent("readystatechange"),4==Iy(t)){t.b=!1;try{var e,n=t.S();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var o=String(t.D).match(Ov)[1]||null;if(!o&&up.self&&up.self.location){var s=up.self.location.protocol;o=s.substr(0,s.length-1)}i=!vy.test(o?o.toLowerCase():"")}e=i}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var a=2<Iy(t)?t.a.statusText:""}catch(t){a=""}t.f=a+" ["+t.S()+"]",by(t)}}finally{_y(t)}}}function _y(t,e){if(t.a){Ey(t);var n=t.a,r=t.s[0]?cp:null;t.a=null,t.s=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){}}}function Ey(t){t.a&&t.B&&(t.a.ontimeout=null),t.m&&(up.clearTimeout(t.m),t.m=null)}function Iy(t){return t.a?t.a.readyState:0}function Ty(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}var i;r||(i="",Dp(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Fv(t,e,n))}function Sy(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Cy(t){this.f=[],this.R=this.ea=this.v=this.P=this.a=this.ha=this.s=this.N=this.h=this.F=this.j=null,this.Fa=this.H=0,this.Ca=Sy("failFast",!1,t),this.U=this.l=this.i=this.g=this.c=null,this.W=!0,this.A=this.ia=this.G=-1,this.J=this.m=this.o=0,this.Ba=Sy("baseRetryDelayMs",5e3,t),this.Ga=Sy("retryDelaySeedMs",1e4,t),this.Da=Sy("forwardChannelMaxRetries",2,t),this.ga=Sy("forwardChannelRequestTimeoutMs",2e4,t),this.Ea=t&&t.nb||void 0,this.D=void 0,this.w=t&&t.supportsCrossDomainXhr||!1,this.B="",this.b=new ty(t&&t.concurrentRequestLimit),this.ja=new cy,this.fa=t&&t.fastHandshake||!1,t&&t.forceLongPolling&&(this.W=!1),this.O=void 0}function Ny(t){if(Ay(t),3==t.u){var e=t.H++,n=Rv(t.v);Fv(n,"SID",t.B),Fv(n,"RID",e),Fv(n,"TYPE","terminate"),Ry(t,n),(e=new fv(t,e,void 0)).B=2,e.f=Uv(Rv(n)),n=!1,up.navigator&&up.navigator.sendBeacon&&(n=up.navigator.sendBeacon(e.f.toString(),"")),!n&&up.Image&&((new Image).src=e.f,n=!0),n||(e.a=By(e.g,null),e.a.$(e.f)),e.s=bp(),wv(e)}Vy(t)}function Ay(t){t.a&&(t.a.cancel(),t.a=null),t.i&&(up.clearTimeout(t.i),t.i=null),My(t),t.b.cancel(),t.g&&("number"==typeof t.g&&up.clearTimeout(t.g),t.g=null)}function ky(t,e){t.f.push(new Zv(t.Fa++,e)),3==t.u&&Oy(t)}function Oy(t){ny(t.b)||t.g||(t.g=!0,xd(t.xa,t),t.o=0)}function Py(t,e){var n;n=e?e.W:t.H++;var r=Rv(t.v);Fv(r,"SID",t.B),Fv(r,"RID",n),Fv(r,"AID",t.G),Ry(t,r),t.h&&t.j&&Ty(r,t.h,t.j),n=new fv(t,n,t.o+1),null===t.h&&(n.m=t.j),e&&(t.f=e.i.concat(t.f)),e=Dy(t,n,1e3),n.setTimeout(Math.round(.5*t.ga)+Math.round(.5*t.ga*Math.random())),oy(t.b,n),yv(n,r,e)}function Ry(t,n){t.c&&Cv({},function(t,e){Fv(n,e,t)})}function Dy(t,e,n){n=Math.min(t.f.length,n);var r=t.c?gp(t.c.Ha,t.c,t):null;t:for(var i=t.f,o=-1;;){var s=["count="+n];-1==o?0<n?(o=i[0].b,s.push("ofs="+o)):o=0:s.push("ofs="+o);for(var a=!0,u=0;u<n;u++){var c=i[u].b,h=i[u].a;if((c-=o)<0)o=Math.max(0,i[u].b-100),a=!1;else try{hy(h,s,"req"+c+"_")}catch(t){r&&r(h)}}if(a){r=s.join("&");break t}}return t=t.f.splice(0,n),e.i=t,r}function xy(t){t.a||t.i||(t.J=1,xd(t.wa,t),t.m=0)}function Ly(t){return!(t.a||t.i||3<=t.m)&&(t.J++,t.i=ev(gp(t.wa,t),Uy(t,t.m)),t.m++,1)}function My(t){null!=t.l&&(up.clearTimeout(t.l),t.l=null)}function Fy(t,e){var n=null;if(t.a==e){My(t),t.a=null;var r=2}else{if(!iy(t.b,e))return;n=e.i,sy(t.b,e),r=1}if(t.A=e.H,0!=t.u)if(e.b)if(1==r){n=e.j?e.j.length:0,e=bp()-e.s;var i=t.o;(r=Xd()).dispatchEvent(new tv(r)),Oy(t)}else xy(t);else if(3==(i=e.c)||0==i&&0<t.A||!(1==r&&function(t,e){if(!(ry(t.b)>=t.b.f-(t.g?1:0))){if(t.g)return t.f=e.i.concat(t.f),1;if(!(1==t.u||2==t.u||t.o>=(t.Ca?0:t.Da)))return t.g=ev(gp(t.xa,t,e),Uy(t,t.o)),t.o++,1}}(t,e)||2==r&&Ly(t)))switch(n&&0<n.length&&(e=t.b,e.c=e.c.concat(n)),i){case 1:jy(t,5);break;case 4:jy(t,10);break;case 3:jy(t,6);break;default:jy(t,2)}}function Uy(t,e){var n=t.Ba+Math.floor(Math.random()*t.Ga);return t.c||(n*=2),n*e}function jy(t,e){if(2==e){var n=null;t.c&&(n=null);var r=gp(t.Ta,t);n||(n=new Pv("//www.google.com/images/cleardot.gif"),up.location&&"http"==up.location.protocol||Dv(n,"https"),Uv(n)),function(t,e){var n=new zd;if(up.Image){var r=new Image;r.onload=mp(ly,n,r,"TestLoadImage: loaded",!0,e),r.onerror=mp(ly,n,r,"TestLoadImage: error",!1,e),r.onabort=mp(ly,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=mp(ly,n,r,"TestLoadImage: timeout",!1,e),up.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=t}else e(!1)}(n.toString(),r)}else Zd(2);t.u=0,t.c&&t.c.la(e),Vy(t),Ay(t)}function Vy(t){t.u=0,t.A=-1,t.c&&(0==ay(t.b).length&&0==t.f.length||(t.b.c.length=0,Sp(t.f),t.f.length=0),t.c.ka())}function qy(t,e,n){var r,i,o,s,a,u,c=(r=n)instanceof Pv?Rv(r):new Pv(r,void 0);if(""!=c.c)e&&xv(c,e+"."+c.c),Lv(c,c.h);else{var h=up.location;i=h.protocol,o=e?e+"."+h.hostname:h.hostname,s=+h.port,a=n,u=new Pv(null,void 0),i&&Dv(u,i),o&&xv(u,o),s&&Lv(u,s),a&&(u.g=a),c=u}return t.N&&Dp(t.N,function(t,e){Fv(c,e,t)}),e=t.s,n=t.ha,e&&n&&Fv(c,e,n),Fv(c,"VER",t.oa),Ry(t,c),c}function By(t,e){if(e&&!t.w)throw Error("Can't create secondary domain capable XhrIo object.");return(e=new py(t.Ea)).F=t.w,e}function Wy(){}function Hy(){if(qp&&!(10<=Number(td)))throw Error("Environmental error: no available transport.")}function Ky(t,e){Sd.call(this),this.a=new Cy(e),this.l=t,this.b=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.a.j=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.pa&&(t?t["X-WebChannel-Client-Profile"]=e.pa:t={"X-WebChannel-Client-Profile":e.pa}),this.a.F=t,(t=e&&e.httpHeadersOverwriteParam)&&!Cp(t)&&(this.a.h=t),this.h=e&&e.supportsCrossDomainXhr||!1,this.g=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Cp(e)&&(this.a.s=e,null!==(t=this.b)&&e in t&&(e in(t=this.b)&&delete t[e])),this.f=new Qy(this)}function Gy(t){cv.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.c=t)?(t=this.c,this.data=null!==e&&t in e?e[t]:void 0):this.data=e}else this.data=t}function zy(){hv.call(this),this.status=1}function Qy(t){this.a=t}(op=py.prototype).$=function(t,e,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+t);e=e?e.toUpperCase():"GET",this.D=t,this.f="",this.h=0,this.v=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.G?ov(this.G):ov(av),this.a.onreadystatechange=gp(this.va,this);try{this.w=!0,this.a.open(e,String(t),!0),this.w=!1}catch(t){return void my(this,t)}t=n||"";var i,o=new Nv(this.headers);r&&Cv(r,function(t,e){o.set(e,t)}),r=function(t){t:{for(var e=gy,n=t.length,r="string"==typeof t?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return e<0?null:"string"==typeof t?t.charAt(e):t[e]}(o.K()),n=up.FormData&&t instanceof up.FormData,0<=Ep(yy,e)&&!r&&!n&&o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(t,e){this.a.setRequestHeader(e,t)},this),this.H&&(this.a.responseType=this.H),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{Ey(this),0<this.o&&((this.B=(i=this.a,qp&&Jp(9)&&"number"==typeof i.timeout&&void 0!==i.ontimeout))?(this.a.timeout=this.o,this.a.ontimeout=gp(this.ta,this)):this.m=Vd(this.ta,this.o,this)),this.l=!0,this.a.send(t),this.l=!1}catch(t){my(this,t)}},op.ta=function(){void 0!==ap&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,this.dispatchEvent("timeout"),this.abort(8))},op.abort=function(t){this.a&&this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.h=t||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),_y(this))},op.C=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),_y(this,!0)),py.M.C.call(this)},op.va=function(){this.j||(this.w||this.l||this.g?wy(this):this.Oa())},op.Oa=function(){wy(this)},op.S=function(){try{return 2<Iy(this)?this.a.status:-1}catch(t){return-1}},op.Y=function(){try{return this.a?this.a.responseText:""}catch(t){return""}},op.Ja=function(t){if(this.a){var e=this.a.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),fy(e)}},op.qa=function(){return this.h},op.Ma=function(){return"string"==typeof this.f?this.f:String(this.f)},(op=Cy.prototype).oa=8,op.u=1,op.xa=function(t){if(this.g)if(this.g=null,1==this.u){if(!t){this.H=Math.floor(1e5*Math.random()),t=this.H++;var e,n=new fv(this,t,void 0),r=this.j;if(this.F&&(r?Mp(r=xp(r),this.F):r=this.F),null===this.h&&(n.m=r),this.fa)t:{for(var i=e=0;i<this.f.length;i++){var o=this.f[i];if("__data__"in o.a&&"string"==typeof(o=o.a.__data__)?o=o.length:o=void 0,void 0===o)break;if(4096<(e+=o)){e=i;break t}if(4096===e||i===this.f.length-1){e=i+1;break t}}e=1e3}else e=1e3;e=Dy(this,n,e),Fv(i=Rv(this.v),"RID",t),Fv(i,"CVER",22),this.s&&Fv(i,"X-HTTP-Session-Id",this.s),Ry(this,i),this.h&&r&&Ty(i,this.h,r),oy(this.b,n),this.fa?(Fv(i,"$req",e),Fv(i,"SID","null"),n.R=!0,yv(n,i,null)):yv(n,i,e),this.u=2}}else 3==this.u&&(t?Py(this,t):0==this.f.length||ny(this.b)||Py(this))},op.wa=function(){this.i=null,this.a=new fv(this,"rpc",this.J),null===this.h&&(this.a.m=this.j),this.a.J=0;var t=Rv(this.ea);Fv(t,"RID","rpc"),Fv(t,"SID",this.B),Fv(t,"CI",this.U?"0":"1"),Fv(t,"AID",this.G),Ry(this,t),Fv(t,"TYPE","xmlhttp"),this.h&&this.j&&Ty(t,this.h,this.j),this.D&&this.a.setTimeout(this.D);var e=this.a,n=this.R;e.B=1,e.f=Uv(Rv(t)),e.j=null,e.F=!0,gv(e,n)},op.Na=function(){null!=this.l&&(this.l=null,this.a.cancel(),this.a=null,Ly(this),Zd(19))},op.Ta=function(t){Zd(t?2:1)},(op=Wy.prototype).na=function(){},op.ma=function(){},op.la=function(){},op.ka=function(){},op.Ha=function(){},Hy.prototype.a=function(t,e){return new Ky(t,e)},wp(Ky,Sd),(op=Ky.prototype).addEventListener=function(t,e,n,r){Ky.M.addEventListener.call(this,t,e,n,r)},op.removeEventListener=function(t,e,n,r){Ky.M.removeEventListener.call(this,t,e,n,r)},op.Ka=function(){this.a.c=this.f,this.h&&(this.a.w=!0);var t=this.a,e=this.l,n=this.b||void 0;Zd(0),t.P=e,t.N=n||{},t.U=t.W,t.v=qy(t,null,t.P),Oy(t)},op.close=function(){Ny(this.a)},op.La=function(t){if("string"==typeof t){var e={};e.__data__=t,ky(this.a,e)}else this.g?((e={}).__data__=Nd(t),ky(this.a,e)):ky(this.a,t)},op.C=function(){this.a.c=null,delete this.f,Ny(this.a),delete this.a,Ky.M.C.call(this)},wp(Gy,cv),wp(zy,hv),wp(Qy,Wy),Qy.prototype.na=function(){this.a.dispatchEvent("a")},Qy.prototype.ma=function(t){this.a.dispatchEvent(new Gy(t))},Qy.prototype.la=function(t){this.a.dispatchEvent(new zy)},Qy.prototype.ka=function(){this.a.dispatchEvent("b")},Hy.prototype.createWebChannel=Hy.prototype.a,Ky.prototype.send=Ky.prototype.La,Ky.prototype.open=Ky.prototype.Ka,Ky.prototype.close=Ky.prototype.close,nv.NO_ERROR=0,nv.TIMEOUT=8,nv.HTTP_ERROR=6,rv.COMPLETE="complete",(sv.EventType=uv).OPEN="a",uv.CLOSE="b",uv.ERROR="c",uv.MESSAGE="d",Sd.prototype.listen=Sd.prototype.ra,py.prototype.listenOnce=py.prototype.sa,py.prototype.getLastError=py.prototype.Ma,py.prototype.getLastErrorCode=py.prototype.qa,py.prototype.getStatus=py.prototype.S,py.prototype.getResponseJson=py.prototype.Ja,py.prototype.getResponseText=py.prototype.Y,py.prototype.send=py.prototype.$;var Xy={createWebChannelTransport:function(){return new Hy},ErrorCode:nv,EventType:rv,WebChannel:sv,XhrIo:py},Yy=Xy.createWebChannelTransport,$y=Xy.ErrorCode,Jy=Xy.EventType,Zy=Xy.WebChannel,tg=Xy.XhrIo,eg=new xa("@firebase/firestore");function ng(){return eg.logLevel}function rg(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(eg.logLevel<=Ca.DEBUG){var r=e.map(og);eg.debug.apply(eg,ks(["Firestore (7.17.1): "+t],r))}}function ig(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(eg.logLevel<=Ca.ERROR){var r=e.map(og);eg.error.apply(eg,ks(["Firestore (7.17.1): "+t],r))}}function og(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function sg(t){void 0===t&&(t="Unexpected state");var e="FIRESTORE (7.17.1) INTERNAL ASSERTION FAILED: "+t;throw ig(e),new Error(e)}function ag(t){t||sg()}function ug(t){return t}function cg(t){var e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e)e.getRandomValues(n);else for(var r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n}var hg=(lg.t=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length,n="";n.length<20;)for(var r=cg(40),i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%t.length));return n},lg);function lg(){}function fg(t,e){return t<e?-1:e<t?1:0}function pg(t,n,r){return t.length===n.length&&t.every(function(t,e){return r(t,n[e])})}function dg(t){return t+"\0"}function vg(t,e,n,r,i){this.s=t,this.persistenceKey=e,this.host=n,this.ssl=r,this.forceLongPolling=i}var yg=(Object.defineProperty(gg.prototype,"i",{get:function(){return"(default)"===this.database},enumerable:!1,configurable:!0}),gg.prototype.isEqual=function(t){return t instanceof gg&&t.projectId===this.projectId&&t.database===this.database},gg.prototype.o=function(t){return fg(this.projectId,t.projectId)||fg(this.database,t.database)},gg);function gg(t,e){this.projectId=t,this.database=e||"(default)"}function mg(t){var e=0;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function bg(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function wg(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var _g,Eg,Ig,Tg=(qg.prototype.get=function(t){var e=this.h(t),n=this.l[e];if(void 0!==n)for(var r=0,i=n;r<i.length;r++){var o=i[r],s=o[0],a=o[1];if(this.u(s,t))return a}},qg.prototype.has=function(t){return void 0!==this.get(t)},qg.prototype.set=function(t,e){var n=this.h(t),r=this.l[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(this.u(r[i][0],t))return void(r[i]=[t,e]);r.push([t,e])}else this.l[n]=[[t,e]]},qg.prototype.delete=function(t){var e=this.h(t),n=this.l[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.u(n[r][0],t))return 1===n.length?delete this.l[e]:n.splice(r,1),!0;return!1},qg.prototype.forEach=function(a){bg(this.l,function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],s=i[1];a(o,s)}})},qg.prototype._=function(){return wg(this.l)},qg),Sg={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"},Cg=(Es(Vg,Ig=Error),Vg),Ng=(jg.now=function(){return jg.fromMillis(Date.now())},jg.fromDate=function(t){return jg.fromMillis(t.getTime())},jg.fromMillis=function(t){var e=Math.floor(t/1e3);return new jg(e,1e6*(t-1e3*e))},jg.prototype.toDate=function(){return new Date(this.toMillis())},jg.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},jg.prototype.T=function(t){return this.seconds===t.seconds?fg(this.nanoseconds,t.nanoseconds):fg(this.seconds,t.seconds)},jg.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},jg.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},jg.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},jg),Ag=(Ug.I=function(t){return new Ug(t)},Ug.min=function(){return new Ug(new Ng(0,0))},Ug.prototype.o=function(t){return this.timestamp.T(t.timestamp)},Ug.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},Ug.prototype.m=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},Ug.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},Ug.prototype.A=function(){return this.timestamp},Ug),kg=(Object.defineProperty(Fg.prototype,"length",{get:function(){return this.R},enumerable:!1,configurable:!0}),Fg.prototype.isEqual=function(t){return 0===Fg.P(this,t)},Fg.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof Fg?t.forEach(function(t){e.push(t)}):e.push(t),this.g(e)},Fg.prototype.limit=function(){return this.offset+this.length},Fg.prototype.V=function(t){return t=void 0===t?1:t,this.g(this.segments,this.offset+t,this.length-t)},Fg.prototype.p=function(){return this.g(this.segments,this.offset,this.length-1)},Fg.prototype.v=function(){return this.segments[this.offset]},Fg.prototype.S=function(){return this.get(this.length-1)},Fg.prototype.get=function(t){return this.segments[this.offset+t]},Fg.prototype._=function(){return 0===this.length},Fg.prototype.D=function(t){if(t.length<this.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},Fg.prototype.C=function(t){if(this.length+1!==t.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},Fg.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},Fg.prototype.F=function(){return this.segments.slice(this.offset,this.limit())},Fg.P=function(t,e){for(var n=Math.min(t.length,e.length),r=0;r<n;r++){var i=t.get(r),o=e.get(r);if(i<o)return-1;if(o<i)return 1}return t.length<e.length?-1:t.length>e.length?1:0},Fg),Og=(Es(Mg,Eg=kg),Mg.prototype.g=function(t,e,n){return new Mg(t,e,n)},Mg.prototype.$=function(){return this.F().join("/")},Mg.prototype.toString=function(){return this.$()},Mg.N=function(t){if(0<=t.indexOf("//"))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new Mg(t.split("/").filter(function(t){return 0<t.length}))},Mg.k=function(){return new Mg([])},Mg),Pg=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Rg=(Es(Lg,_g=kg),Lg.prototype.g=function(t,e,n){return new Lg(t,e,n)},Lg.M=function(t){return Pg.test(t)},Lg.prototype.$=function(){return this.F().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),Lg.M(t)||(t="`"+t+"`"),t}).join(".")},Lg.prototype.toString=function(){return this.$()},Lg.prototype.O=function(){return 1===this.length&&"__name__"===this.get(0)},Lg.L=function(){return new Lg(["__name__"])},Lg.q=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");e.push(n),n=""},o=!1;r<t.length;){var s=t[r];if("\\"===s){if(r+1===t.length)throw new Cg(Sg.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var a=t[r+1];if("\\"!==a&&"."!==a&&"`"!==a)throw new Cg(Sg.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=a,r+=2}else"`"===s?o=!o:"."!==s||o?n+=s:i(),r++}if(i(),o)throw new Cg(Sg.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Lg(e)},Lg.k=function(){return new Lg([])},Lg),Dg=(xg.B=function(t){return new xg(Og.N(t).V(5))},xg.prototype.U=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},xg.prototype.isEqual=function(t){return null!==t&&0===Og.P(this.path,t.path)},xg.prototype.toString=function(){return this.path.toString()},xg.P=function(t,e){return Og.P(t.path,e.path)},xg.W=function(t){return t.length%2==0},xg.j=function(t){return new xg(new Og(t.slice()))},xg);function xg(t){this.path=t}function Lg(){return null!==_g&&_g.apply(this,arguments)||this}function Mg(){return null!==Eg&&Eg.apply(this,arguments)||this}function Fg(t,e,n){void 0===e?e=0:e>t.length&&sg(),void 0===n?n=t.length-e:n>t.length-e&&sg(),this.segments=t,this.offset=e,this.R=n}function Ug(t){this.timestamp=t}function jg(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new Cg(Sg.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new Cg(Sg.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Cg(Sg.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new Cg(Sg.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function Vg(t,e){var n=this;return(n=Ig.call(this,e)||this).code=t,n.message=e,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}function qg(t,e){this.h=t,this.u=e,this.l={}}function Bg(t){return null==t}function Wg(t){return-0===t&&1/t==-1/0}function Hg(t){return"number"==typeof t&&Number.isInteger(t)&&!Wg(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var Kg=function(t,e,n,r,i,o,s){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=s,this.K=null};function Gg(t,e,n,r,i,o,s){return void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),new Kg(t,e,n,r,i,o,s)}function zg(t){var e=ug(t);if(null===e.K){var n=e.path.$();null!==e.collectionGroup&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(function(t){return(e=t).field.$()+e.op.toString()+Zm(e.value);var e}).join(","),n+="|ob:",n+=e.orderBy.map(function(t){return(e=t).field.$()+e.dir;var e}).join(","),Bg(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=C_(e.startAt)),e.endAt&&(n+="|ub:",n+=C_(e.endAt)),e.K=n}return e.K}function Qg(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(var n=0;n<t.orderBy.length;n++)if(r=t.orderBy[n],i=e.orderBy[n],r.dir!==i.dir||!r.field.isEqual(i.field))return!1;var r,i,o,s;if(t.filters.length!==e.filters.length)return!1;for(var a=0;a<t.filters.length;a++)if(o=t.filters[a],s=e.filters[a],!(o instanceof u_&&s instanceof u_&&o.op===s.op&&o.field.isEqual(s.field)&&Xm(o.value,s.value)))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!A_(t.startAt,e.startAt)&&A_(t.endAt,e.endAt)}function Xg(t){return Dg.W(t.path)&&null===t.collectionGroup&&0===t.filters.length}var Yg=($g.fromBase64String=function(t){return new $g(atob(t))},$g.fromUint8Array=function(t){return new $g(function(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t))},$g.prototype.toBase64=function(){return t=this.G,btoa(t);var t},$g.prototype.toUint8Array=function(){return function(t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(this.G)},$g.prototype.H=function(){return 2*this.G.length},$g.prototype.o=function(t){return fg(this.G,t.G)},$g.prototype.isEqual=function(t){return this.G===t.G},$g);function $g(t){this.G=t}Yg.Y=new Yg("");function Jg(t){this.count=t}var Zg,tm,em=(nm.prototype.Z=function(t){return new nm(this.target,this.targetId,this.J,t,this.X,this.lastLimboFreeSnapshotVersion,this.resumeToken)},nm.prototype.tt=function(t,e){return new nm(this.target,this.targetId,this.J,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)},nm.prototype.et=function(t){return new nm(this.target,this.targetId,this.J,this.sequenceNumber,this.X,t,this.resumeToken)},nm);function nm(t,e,n,r,i,o,s){void 0===i&&(i=Ag.min()),void 0===o&&(o=Ag.min()),void 0===s&&(s=Yg.Y),this.target=t,this.targetId=e,this.J=n,this.sequenceNumber=r,this.X=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s}function rm(t){switch(t){case Sg.OK:return sg();case Sg.CANCELLED:case Sg.UNKNOWN:case Sg.DEADLINE_EXCEEDED:case Sg.RESOURCE_EXHAUSTED:case Sg.INTERNAL:case Sg.UNAVAILABLE:case Sg.UNAUTHENTICATED:return;case Sg.INVALID_ARGUMENT:case Sg.NOT_FOUND:case Sg.ALREADY_EXISTS:case Sg.PERMISSION_DENIED:case Sg.FAILED_PRECONDITION:case Sg.ABORTED:case Sg.OUT_OF_RANGE:case Sg.UNIMPLEMENTED:case Sg.DATA_LOSS:return 1;default:return sg()}}function im(t){if(void 0===t)return ig("GRPC error has no .code"),Sg.UNKNOWN;switch(t){case Zg.OK:return Sg.OK;case Zg.CANCELLED:return Sg.CANCELLED;case Zg.UNKNOWN:return Sg.UNKNOWN;case Zg.DEADLINE_EXCEEDED:return Sg.DEADLINE_EXCEEDED;case Zg.RESOURCE_EXHAUSTED:return Sg.RESOURCE_EXHAUSTED;case Zg.INTERNAL:return Sg.INTERNAL;case Zg.UNAVAILABLE:return Sg.UNAVAILABLE;case Zg.UNAUTHENTICATED:return Sg.UNAUTHENTICATED;case Zg.INVALID_ARGUMENT:return Sg.INVALID_ARGUMENT;case Zg.NOT_FOUND:return Sg.NOT_FOUND;case Zg.ALREADY_EXISTS:return Sg.ALREADY_EXISTS;case Zg.PERMISSION_DENIED:return Sg.PERMISSION_DENIED;case Zg.FAILED_PRECONDITION:return Sg.FAILED_PRECONDITION;case Zg.ABORTED:return Sg.ABORTED;case Zg.OUT_OF_RANGE:return Sg.OUT_OF_RANGE;case Zg.UNIMPLEMENTED:return Sg.UNIMPLEMENTED;case Zg.DATA_LOSS:return Sg.DATA_LOSS;default:return sg()}}(tm=Zg=Zg||{})[tm.OK=0]="OK",tm[tm.CANCELLED=1]="CANCELLED",tm[tm.UNKNOWN=2]="UNKNOWN",tm[tm.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",tm[tm.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",tm[tm.NOT_FOUND=5]="NOT_FOUND",tm[tm.ALREADY_EXISTS=6]="ALREADY_EXISTS",tm[tm.PERMISSION_DENIED=7]="PERMISSION_DENIED",tm[tm.UNAUTHENTICATED=16]="UNAUTHENTICATED",tm[tm.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",tm[tm.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",tm[tm.ABORTED=10]="ABORTED",tm[tm.OUT_OF_RANGE=11]="OUT_OF_RANGE",tm[tm.UNIMPLEMENTED=12]="UNIMPLEMENTED",tm[tm.INTERNAL=13]="INTERNAL",tm[tm.UNAVAILABLE=14]="UNAVAILABLE",tm[tm.DATA_LOSS=15]="DATA_LOSS";var om=(hm.prototype.nt=function(t,e){return new hm(this.P,this.root.nt(t,e,this.P).copy(null,null,am.st,null,null))},hm.prototype.remove=function(t){return new hm(this.P,this.root.remove(t,this.P).copy(null,null,am.st,null,null))},hm.prototype.get=function(t){for(var e=this.root;!e._();){var n=this.P(t,e.key);if(0===n)return e.value;n<0?e=e.left:0<n&&(e=e.right)}return null},hm.prototype.indexOf=function(t){for(var e=0,n=this.root;!n._();){var r=this.P(t,n.key);if(0===r)return e+n.left.size;n=r<0?n.left:(e+=n.left.size+1,n.right)}return-1},hm.prototype._=function(){return this.root._()},Object.defineProperty(hm.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),hm.prototype.it=function(){return this.root.it()},hm.prototype.rt=function(){return this.root.rt()},hm.prototype.ot=function(t){return this.root.ot(t)},hm.prototype.forEach=function(n){this.ot(function(t,e){return n(t,e),!1})},hm.prototype.toString=function(){var n=[];return this.ot(function(t,e){return n.push(t+":"+e),!1}),"{"+n.join(", ")+"}"},hm.prototype.ht=function(t){return this.root.ht(t)},hm.prototype.at=function(){return new sm(this.root,null,this.P,!1)},hm.prototype.ut=function(t){return new sm(this.root,t,this.P,!1)},hm.prototype.ct=function(){return new sm(this.root,null,this.P,!0)},hm.prototype.lt=function(t){return new sm(this.root,t,this.P,!0)},hm),sm=(cm.prototype.dt=function(){var t=this.ft.pop(),e={key:t.key,value:t.value};if(this._t)for(t=t.left;!t._();)this.ft.push(t),t=t.right;else for(t=t.right;!t._();)this.ft.push(t),t=t.left;return e},cm.prototype.wt=function(){return 0<this.ft.length},cm.prototype.Tt=function(){if(0===this.ft.length)return null;var t=this.ft[this.ft.length-1];return{key:t.key,value:t.value}},cm),am=(um.prototype.copy=function(t,e,n,r,i){return new um(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)},um.prototype._=function(){return!1},um.prototype.ot=function(t){return this.left.ot(t)||t(this.key,this.value)||this.right.ot(t)},um.prototype.ht=function(t){return this.right.ht(t)||t(this.key,this.value)||this.left.ht(t)},um.prototype.min=function(){return this.left._()?this:this.left.min()},um.prototype.it=function(){return this.min().key},um.prototype.rt=function(){return this.right._()?this.key:this.right.rt()},um.prototype.nt=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.nt(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.nt(t,e,n))).Et()},um.prototype.It=function(){if(this.left._())return um.EMPTY;var t=this;return t.left.At()||t.left.left.At()||(t=t.Rt()),(t=t.copy(null,null,null,t.left.It(),null)).Et()},um.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r.left._()||r.left.At()||r.left.left.At()||(r=r.Rt()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.At()&&(r=r.Pt()),r.right._()||r.right.At()||r.right.left.At()||(r=r.gt()),0===e(t,r.key)){if(r.right._())return um.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.It())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.Et()},um.prototype.At=function(){return this.color},um.prototype.Et=function(){var t=this;return t.right.At()&&!t.left.At()&&(t=t.Vt()),t.left.At()&&t.left.left.At()&&(t=t.Pt()),t.left.At()&&t.right.At()&&(t=t.yt()),t},um.prototype.Rt=function(){var t=this.yt();return t.right.left.At()&&(t=(t=(t=t.copy(null,null,null,null,t.right.Pt())).Vt()).yt()),t},um.prototype.gt=function(){var t=this.yt();return t.left.left.At()&&(t=(t=t.Pt()).yt()),t},um.prototype.Vt=function(){var t=this.copy(null,null,um.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},um.prototype.Pt=function(){var t=this.copy(null,null,um.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},um.prototype.yt=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},um.prototype.pt=function(){var t=this.bt();return Math.pow(2,t)<=this.size+1},um.prototype.bt=function(){if(this.At()&&this.left.At())throw sg();if(this.right.At())throw sg();var t=this.left.bt();if(t!==this.right.bt())throw sg();return t+(this.At()?0:1)},um);function um(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:um.RED,this.left=null!=r?r:um.EMPTY,this.right=null!=i?i:um.EMPTY,this.size=this.left.size+1+this.right.size}function cm(t,e,n,r){this._t=r,this.ft=[];for(var i=1;!t._();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this._t?t.left:t.right;else{if(0===i){this.ft.push(t);break}this.ft.push(t),t=this._t?t.right:t.left}}function hm(t,e){this.P=t,this.root=e||am.EMPTY}function lm(){this.size=0}am.EMPTY=null,am.RED=!0,am.st=!1,am.EMPTY=(Object.defineProperty(lm.prototype,"key",{get:function(){throw sg()},enumerable:!1,configurable:!0}),Object.defineProperty(lm.prototype,"value",{get:function(){throw sg()},enumerable:!1,configurable:!0}),Object.defineProperty(lm.prototype,"color",{get:function(){throw sg()},enumerable:!1,configurable:!0}),Object.defineProperty(lm.prototype,"left",{get:function(){throw sg()},enumerable:!1,configurable:!0}),Object.defineProperty(lm.prototype,"right",{get:function(){throw sg()},enumerable:!1,configurable:!0}),lm.prototype.copy=function(t,e,n,r,i){return this},lm.prototype.nt=function(t,e,n){return new am(t,e)},lm.prototype.remove=function(t,e){return this},lm.prototype._=function(){return!0},lm.prototype.ot=function(t){return!1},lm.prototype.ht=function(t){return!1},lm.prototype.it=function(){return null},lm.prototype.rt=function(){return null},lm.prototype.At=function(){return!1},lm.prototype.pt=function(){return!0},lm.prototype.bt=function(){return 0},new lm);var fm=(ym.prototype.has=function(t){return null!==this.data.get(t)},ym.prototype.first=function(){return this.data.it()},ym.prototype.last=function(){return this.data.rt()},Object.defineProperty(ym.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),ym.prototype.indexOf=function(t){return this.data.indexOf(t)},ym.prototype.forEach=function(n){this.data.ot(function(t,e){return n(t),!1})},ym.prototype.vt=function(t,e){for(var n=this.data.ut(t[0]);n.wt();){var r=n.dt();if(0<=this.P(r.key,t[1]))return;e(r.key)}},ym.prototype.St=function(t,e){var n;for(n=void 0!==e?this.data.ut(e):this.data.at();n.wt();)if(!t(n.dt().key))return},ym.prototype.Dt=function(t){var e=this.data.ut(t);return e.wt()?e.dt().key:null},ym.prototype.at=function(){return new pm(this.data.at())},ym.prototype.ut=function(t){return new pm(this.data.ut(t))},ym.prototype.add=function(t){return this.copy(this.data.remove(t).nt(t,!0))},ym.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},ym.prototype._=function(){return this.data._()},ym.prototype.Ct=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach(function(t){e=e.add(t)}),e},ym.prototype.isEqual=function(t){if(!(t instanceof ym))return!1;if(this.size!==t.size)return!1;for(var e=this.data.at(),n=t.data.at();e.wt();){var r=e.dt().key,i=n.dt().key;if(0!==this.P(r,i))return!1}return!0},ym.prototype.F=function(){var e=[];return this.forEach(function(t){e.push(t)}),e},ym.prototype.toString=function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"},ym.prototype.copy=function(t){var e=new ym(this.P);return e.data=t,e},ym),pm=(vm.prototype.dt=function(){return this.Ft.dt().key},vm.prototype.wt=function(){return this.Ft.wt()},vm),dm=new om(Dg.P);function vm(t){this.Ft=t}function ym(t){this.P=t,this.data=new om(this.P)}function gm(){return dm}function mm(){return gm()}var bm=new om(Dg.P);function wm(){return bm}var _m=new om(Dg.P),Em=new fm(Dg.P);function Im(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=Em,r=0,i=t;r<i.length;r++){var o=i[r];n=n.add(o)}return n}var Tm=new fm(fg);function Sm(){return Tm}function Cm(t,e,n,r){this.Zt=t,this.removedTargetIds=e,this.key=n,this.te=r}function Nm(t,e){this.targetId=t,this.ee=e}function Am(t,e,n,r){void 0===n&&(n=Yg.Y),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}var km=(Bm.kt=function(t){return new Bm(t.P)},Bm.prototype.has=function(t){return null!=this.$t.get(t)},Bm.prototype.get=function(t){return this.$t.get(t)},Bm.prototype.first=function(){return this.Nt.it()},Bm.prototype.last=function(){return this.Nt.rt()},Bm.prototype._=function(){return this.Nt._()},Bm.prototype.indexOf=function(t){var e=this.$t.get(t);return e?this.Nt.indexOf(e):-1},Object.defineProperty(Bm.prototype,"size",{get:function(){return this.Nt.size},enumerable:!1,configurable:!0}),Bm.prototype.forEach=function(n){this.Nt.ot(function(t,e){return n(t),!1})},Bm.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.$t.nt(t.key,t),e.Nt.nt(t,null))},Bm.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.$t.remove(t),this.Nt.remove(e)):this},Bm.prototype.isEqual=function(t){if(!(t instanceof Bm))return!1;if(this.size!==t.size)return!1;for(var e=this.Nt.at(),n=t.Nt.at();e.wt();){var r=e.dt().key,i=n.dt().key;if(!r.isEqual(i))return!1}return!0},Bm.prototype.toString=function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n  "+e.join("  \n")+"\n)"},Bm.prototype.copy=function(t,e){var n=new Bm;return n.P=this.P,n.$t=t,n.Nt=e,n},Bm),Om=(qm.prototype.track=function(t){var e=t.doc.key,n=this.xt.get(e);!n||0!==t.type&&3===n.type?this.xt=this.xt.nt(e,t):3===t.type&&1!==n.type?this.xt=this.xt.nt(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.xt=this.xt.nt(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.xt=this.xt.nt(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.xt=this.xt.remove(e):1===t.type&&2===n.type?this.xt=this.xt.nt(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.xt=this.xt.nt(e,{type:2,doc:t.doc}):sg()},qm.prototype.Mt=function(){var n=[];return this.xt.ot(function(t,e){n.push(e)}),n},qm),Pm=(Vm.Ut=function(t,e,n,r){var i=[];return e.forEach(function(t){i.push({type:0,doc:t})}),new Vm(t,e,km.kt(e),i,n,r,!0,!1)},Object.defineProperty(Vm.prototype,"hasPendingWrites",{get:function(){return!this.Lt._()},enumerable:!1,configurable:!0}),Vm.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.qt===t.qt&&this.Lt.isEqual(t.Lt)&&n_(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.Ot.isEqual(t.Ot)))return!1;var e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(var r=0;r<e.length;r++)if(e[r].type!==n[r].type||!e[r].doc.isEqual(n[r].doc))return!1;return!0},Vm),Rm=(jm.Gt=function(t,e){var n=new Map;return n.set(t,Dm.zt(t,e)),new jm(Ag.min(),n,Sm(),gm(),Im())},jm),Dm=(Um.zt=function(t,e){return new Um(Yg.Y,e,Im(),Im(),Im())},Um),xm=(Object.defineProperty(Fm.prototype,"Ht",{get:function(){return this.re},enumerable:!1,configurable:!0}),Object.defineProperty(Fm.prototype,"resumeToken",{get:function(){return this.ie},enumerable:!1,configurable:!0}),Object.defineProperty(Fm.prototype,"he",{get:function(){return 0!==this.ne},enumerable:!1,configurable:!0}),Object.defineProperty(Fm.prototype,"ae",{get:function(){return this.oe},enumerable:!1,configurable:!0}),Fm.prototype.ue=function(t){0<t.H()&&(this.oe=!0,this.ie=t)},Fm.prototype.ce=function(){var n=Im(),r=Im(),i=Im();return this.se.forEach(function(t,e){switch(e){case 0:n=n.add(t);break;case 2:r=r.add(t);break;case 1:i=i.add(t);break;default:sg()}}),new Dm(this.ie,this.re,n,r,i)},Fm.prototype.le=function(){this.oe=!1,this.se=Hm()},Fm.prototype._e=function(t,e){this.oe=!0,this.se=this.se.nt(t,e)},Fm.prototype.fe=function(t){this.oe=!0,this.se=this.se.remove(t)},Fm.prototype.de=function(){this.ne+=1},Fm.prototype.we=function(){--this.ne},Fm.prototype.Te=function(){this.oe=!0,this.re=!0},Fm),Lm=(Mm.prototype.Pe=function(t){for(var e=0,n=t.Zt;e<n.length;e++){var r=n[e];t.te instanceof jw?this.ge(r,t.te):t.te instanceof Vw&&this.Ve(r,t.key,t.te)}for(var i=0,o=t.removedTargetIds;i<o.length;i++){var s=o[i];this.Ve(s,t.key,t.te)}},Mm.prototype.ye=function(n){var r=this;this.pe(n,function(t){var e=r.be(t);switch(n.state){case 0:r.ve(t)&&e.ue(n.resumeToken);break;case 1:e.we(),e.he||e.le(),e.ue(n.resumeToken);break;case 2:e.we(),e.he||r.removeTarget(t);break;case 3:r.ve(t)&&(e.Te(),e.ue(n.resumeToken));break;case 4:r.ve(t)&&(r.Se(t),e.ue(n.resumeToken));break;default:sg()}})},Mm.prototype.pe=function(t,n){var r=this;0<t.targetIds.length?t.targetIds.forEach(n):this.Ie.forEach(function(t,e){r.ve(e)&&n(e)})},Mm.prototype.De=function(t){var e=t.targetId,n=t.ee.count,r=this.Ce(e);if(r){var i=r.target;if(Xg(i))if(0===n){var o=new Dg(i.path);this.Ve(e,o,new Vw(o,Ag.min()))}else ag(1===n);else this.Fe(e)!==n&&(this.Se(e),this.Re=this.Re.add(e))}},Mm.prototype.$e=function(i){var o=this,s=new Map;this.Ie.forEach(function(t,e){var n=o.Ce(e);if(n){if(t.Ht&&Xg(n.target)){var r=new Dg(n.target.path);null!==o.me.get(r)||o.Ne(e,r)||o.Ve(e,r,new Vw(r,i))}t.ae&&(s.set(e,t.ce()),t.le())}});var r=Im();this.Ae.forEach(function(t,e){var n=!0;e.St(function(t){var e=o.Ce(t);return!e||2===e.J||(n=!1)}),n&&(r=r.add(t))});var t=new Rm(i,s,this.Re,this.me,r);return this.me=gm(),this.Ae=Wm(),this.Re=new fm(fg),t},Mm.prototype.ge=function(t,e){if(this.ve(t)){var n=this.Ne(t,e.key)?2:0;this.be(t)._e(e.key,n),this.me=this.me.nt(e.key,e),this.Ae=this.Ae.nt(e.key,this.ke(e.key).add(t))}},Mm.prototype.Ve=function(t,e,n){if(this.ve(t)){var r=this.be(t);this.Ne(t,e)?r._e(e,1):r.fe(e),this.Ae=this.Ae.nt(e,this.ke(e).delete(t)),n&&(this.me=this.me.nt(e,n))}},Mm.prototype.removeTarget=function(t){this.Ie.delete(t)},Mm.prototype.Fe=function(t){var e=this.be(t).ce();return this.Ee.xe(t).size+e.Yt.size-e.Xt.size},Mm.prototype.de=function(t){this.be(t).de()},Mm.prototype.be=function(t){var e=this.Ie.get(t);return e||(e=new xm,this.Ie.set(t,e)),e},Mm.prototype.ke=function(t){var e=this.Ae.get(t);return e||(e=new fm(fg),this.Ae=this.Ae.nt(t,e)),e},Mm.prototype.ve=function(t){var e=null!==this.Ce(t);return e||rg("WatchChangeAggregator","Detected inactive target",t),e},Mm.prototype.Ce=function(t){var e=this.Ie.get(t);return e&&e.he?null:this.Ee.Me(t)},Mm.prototype.Se=function(e){var n=this;this.Ie.set(e,new xm),this.Ee.xe(e).forEach(function(t){n.Ve(e,t,null)})},Mm.prototype.Ne=function(t,e){return this.Ee.xe(t).has(e)},Mm);function Mm(t){this.Ee=t,this.Ie=new Map,this.me=gm(),this.Ae=Wm(),this.Re=new fm(fg)}function Fm(){this.ne=0,this.se=Hm(),this.ie=Yg.Y,this.re=!1,this.oe=!0}function Um(t,e,n,r,i){this.resumeToken=t,this.Ht=e,this.Yt=n,this.Jt=r,this.Xt=i}function jm(t,e,n,r,i){this.X=t,this.Wt=e,this.Qt=n,this.jt=r,this.Kt=i}function Vm(t,e,n,r,i,o,s,a){this.query=t,this.docs=e,this.Ot=n,this.docChanges=r,this.Lt=i,this.fromCache=o,this.qt=s,this.Bt=a}function qm(){this.xt=new om(Dg.P)}function Bm(n){this.P=n?function(t,e){return n(t,e)||Dg.P(t.key,e.key)}:function(t,e){return Dg.P(t.key,e.key)},this.$t=wm(),this.Nt=new om(this.P)}function Wm(){return new om(Dg.P)}function Hm(){return new om(Dg.P)}function Km(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Gm(t){var e=tb(t.mapValue.fields.__local_write_time__.timestampValue);return new Ng(e.seconds,e.nanos)}var zm=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Qm(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?Km(t)?4:10:sg()}function Xm(i,t){var e,n,r,o=Qm(i);if(o!==Qm(t))return!1;switch(o){case 0:return!0;case 1:return i.booleanValue===t.booleanValue;case 4:return Gm(i).isEqual(Gm(t));case 3:return function(t){if("string"==typeof i.timestampValue&&"string"==typeof t.timestampValue&&i.timestampValue.length===t.timestampValue.length)return i.timestampValue===t.timestampValue;var e=tb(i.timestampValue),n=tb(t.timestampValue);return e.seconds===n.seconds&&e.nanos===n.nanos}(t);case 5:return i.stringValue===t.stringValue;case 6:return r=t,nb(i.bytesValue).isEqual(nb(r.bytesValue));case 7:return i.referenceValue===t.referenceValue;case 8:return n=t,eb((e=i).geoPointValue.latitude)===eb(n.geoPointValue.latitude)&&eb(e.geoPointValue.longitude)===eb(n.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return eb(t.integerValue)===eb(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=eb(t.doubleValue),r=eb(e.doubleValue);return n===r?Wg(n)===Wg(r):isNaN(n)&&isNaN(r)}return!1}(i,t);case 9:return pg(i.arrayValue.values||[],t.arrayValue.values||[],Xm);case 10:return function(t){var e=i.mapValue.fields||{},n=t.mapValue.fields||{};if(mg(e)!==mg(n))return!1;for(var r in e)if(e.hasOwnProperty(r)&&(void 0===n[r]||!Xm(e[r],n[r])))return!1;return!0}(t);default:return sg()}}function Ym(t,e){return void 0!==(t.values||[]).find(function(t){return Xm(t,e)})}function $m(t,e){var n,r,i,o,s,a,u,c,h,l,f=Qm(t),p=Qm(e);if(f!==p)return fg(f,p);switch(f){case 0:return 0;case 1:return fg(t.booleanValue,e.booleanValue);case 2:return c=e,h=eb(t.integerValue||t.doubleValue),l=eb(c.integerValue||c.doubleValue),h<l?-1:l<h?1:h===l?0:isNaN(h)?isNaN(l)?0:-1:1;case 3:return Jm(t.timestampValue,e.timestampValue);case 4:return Jm(Gm(t),Gm(e));case 5:return fg(t.stringValue,e.stringValue);case 6:return o=t.bytesValue,s=e.bytesValue,a=nb(o),u=nb(s),a.o(u);case 7:return function(t,e){for(var n=t.split("/"),r=e.split("/"),i=0;i<n.length&&i<r.length;i++){var o=fg(n[i],r[i]);if(0!==o)return o}return fg(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return n=t.geoPointValue,r=e.geoPointValue,0!==(i=fg(eb(n.latitude),eb(r.latitude)))?i:fg(eb(n.longitude),eb(r.longitude));case 9:return function(t,e){for(var n=t.values||[],r=e.values||[],i=0;i<n.length&&i<r.length;++i){var o=$m(n[i],r[i]);if(o)return o}return fg(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){var n=t.fields||{},r=Object.keys(n),i=e.fields||{},o=Object.keys(i);r.sort(),o.sort();for(var s=0;s<r.length&&s<o.length;++s){var a=fg(r[s],o[s]);if(0!==a)return a;var u=$m(n[r[s]],i[o[s]]);if(0!==u)return u}return fg(r.length,o.length)}(t.mapValue,e.mapValue);default:throw sg()}}function Jm(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return fg(t,e);var n=tb(t),r=tb(e),i=fg(n.seconds,r.seconds);return 0!==i?i:fg(n.nanos,r.nanos)}function Zm(t){return function s(i){return"nullValue"in i?"null":"booleanValue"in i?""+i.booleanValue:"integerValue"in i?""+i.integerValue:"doubleValue"in i?""+i.doubleValue:"timestampValue"in i?"time("+(t=tb(i.timestampValue)).seconds+","+t.nanos+")":"stringValue"in i?i.stringValue:"bytesValue"in i?nb(i.bytesValue).toBase64():"referenceValue"in i?(n=i.referenceValue,Dg.B(n).toString()):"geoPointValue"in i?"geo("+(e=i.geoPointValue).latitude+","+e.longitude+")":"arrayValue"in i?function(){for(var t="[",e=!0,n=0,r=i.arrayValue.values||[];n<r.length;n++){e?e=!1:t+=",",t+=s(r[n])}return t+"]"}():"mapValue"in i?function(t){for(var e="{",n=!0,r=0,i=Object.keys(t.fields||{}).sort();r<i.length;r++){var o=i[r];n?n=!1:e+=",",e+=o+":"+s(t.fields[o])}return e+"}"}(i.mapValue):sg();var t,e,n}(t)}function tb(t){if(ag(!!t),"string"!=typeof t)return{seconds:eb(t.seconds),nanos:eb(t.nanos)};var e=0,n=zm.exec(t);if(ag(!!n),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),e=Number(r)}var i=new Date(t);return{seconds:Math.floor(i.getTime()/1e3),nanos:e}}function eb(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function nb(t){return"string"==typeof t?Yg.fromBase64String(t):Yg.fromUint8Array(t)}function rb(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.$()}}function ib(t){return t&&"integerValue"in t}function ob(t){return!!t&&"arrayValue"in t}function sb(t){return t&&"nullValue"in t}function ab(t){return t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function ub(t){return t&&"mapValue"in t}var cb={asc:"ASCENDING",desc:"DESCENDING"},hb={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","array-contains-any":"ARRAY_CONTAINS_ANY"},lb=function(t,e){this.s=t,this.Oe=e};function fb(t){return{integerValue:""+t}}function pb(t,e){if(t.Oe){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Wg(e)?"-0":e}}function db(t,e){return Hg(e)?fb(e):pb(t,e)}function vb(t,e){return t.Oe?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function yb(t,e){return t.Oe?e.toBase64():e.toUint8Array()}function gb(t){return ag(!!t),Ag.I((e=tb(t),new Ng(e.seconds,e.nanos)));var e}function mb(t,e){return new Og(["projects",t.projectId,"databases",t.database]).child("documents").child(e).$()}function bb(t){var e=Og.N(t);return ag(Lb(e)),e}function wb(t,e){return mb(t.s,e.path)}function _b(t,e){var n=bb(e);return ag(n.get(1)===t.s.projectId),ag(!n.get(3)&&!t.s.database||n.get(3)===t.s.database),new Dg(Sb(n))}function Eb(t,e){return mb(t.s,e)}function Ib(t){var e=bb(t);return 4===e.length?Og.k():Sb(e)}function Tb(t){return new Og(["projects",t.s.projectId,"databases",t.s.database]).$()}function Sb(t){return ag(4<t.length&&"documents"===t.get(4)),t.V(5)}function Cb(t,e,n){return{name:wb(t,e),fields:n.proto.mapValue.fields}}function Nb(t,e){var n,r,i,o,s,a,u;if(e instanceof dw)n={update:Cb(t,e.key,e.value)};else if(e instanceof Cw)n={delete:wb(t,e.key)};else if(e instanceof vw)n={update:Cb(t,e.key,e.data),updateMask:(r=e.Le,i=[],r.fields.forEach(function(t){return i.push(t.$())}),{fieldPaths:i})};else if(e instanceof ww)n={transform:{document:wb(t,e.key),fieldTransforms:e.fieldTransforms.map(function(t){return function(t){var e=t.transform;if(e instanceof Vb)return{fieldPath:t.field.$(),setToServerValue:"REQUEST_TIME"};if(e instanceof qb)return{fieldPath:t.field.$(),appendMissingElements:{values:e.elements}};if(e instanceof Gb)return{fieldPath:t.field.$(),removeAllFromArray:{values:e.elements}};if(e instanceof Yb)return{fieldPath:t.field.$(),increment:e.qe};throw sg()}(t)})}};else{if(!(e instanceof Nw))return sg();n={verify:wb(t,e.key)}}return e.Ue.Be||(n.currentDocument=(o=t,void 0!==(s=e.Ue).updateTime?{updateTime:(a=o,u=s.updateTime,vb(a,u.A()))}:void 0!==s.exists?{exists:s.exists}:sg())),n}function Ab(e,t){var n,r,i=t.currentDocument?void 0!==(n=t.currentDocument).updateTime?iw.updateTime(gb(n.updateTime)):void 0!==n.exists?iw.exists(n.exists):iw.We():iw.We();if(t.update){t.update.name;var o=_b(e,t.update.name),s=new Aw({mapValue:{fields:t.update.fields}});if(t.updateMask){var a=(r=t.updateMask.fieldPaths||[],new tw(r.map(function(t){return Rg.q(t)})));return new vw(o,s,a,i)}return new dw(o,s,i)}if(t.delete){var u=_b(e,t.delete);return new Cw(u,i)}if(t.transform){var c=_b(e,t.transform.document),h=t.transform.fieldTransforms.map(function(t){return function(t,e){var n=null;if("setToServerValue"in e)ag("REQUEST_TIME"===e.setToServerValue),n=new Vb;else if("appendMissingElements"in e){var r=e.appendMissingElements.values||[];n=new qb(r)}else if("removeAllFromArray"in e){var i=e.removeAllFromArray.values||[];n=new Gb(i)}else"increment"in e?n=new Yb(t,e.increment):sg();var o=Rg.q(e.fieldPath);return new ew(o,n)}(e,t)});return ag(!0===i.exists),new ww(c,h)}if(t.verify){var l=_b(e,t.verify);return new Nw(l,i)}return sg()}function kb(t,e){return{documents:[Eb(t,e.path)]}}function Ob(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Eb(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Eb(t,r.p()),n.structuredQuery.from=[{collectionId:r.S()}]);var i=function(t){if(0!==t.length){var e=t.map(function(t){return t instanceof u_?function(t){if("=="===t.op){if(ab(t.value))return{unaryFilter:{field:Db(t.field),op:"IS_NAN"}};if(sb(t.value))return{unaryFilter:{field:Db(t.field),op:"IS_NULL"}}}return{fieldFilter:{field:Db(t.field),op:(e=t.op,hb[e]),value:t.value}};var e}(t):sg()});return 1===e.length?e[0]:{compositeFilter:{op:"AND",filters:e}}}}(e.filters);i&&(n.structuredQuery.where=i);var o=function(t){if(0!==t.length)return t.map(function(t){return{field:Db((e=t).field),direction:(n=e.dir,cb[n])};var e,n})}(e.orderBy);o&&(n.structuredQuery.orderBy=o);var s,a,u=(s=t,a=e.limit,s.Oe||Bg(a)?a:{value:a});return null!==u&&(n.structuredQuery.limit=u),e.startAt&&(n.structuredQuery.startAt=Pb(e.startAt)),e.endAt&&(n.structuredQuery.endAt=Pb(e.endAt)),n}function Pb(t){return{before:t.before,values:t.position}}function Rb(t){var e=!!t.before,n=t.values||[];return new w_(n,e)}function Db(t){return{fieldPath:t.$()}}function xb(t){return Rg.q(t.fieldPath)}function Lb(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}function Mb(){this.Qe=void 0}function Fb(t,e){return t instanceof Yb?ib(n=e)||n&&"doubleValue"in n?e:{integerValue:0}:null;var n}var Ub,jb,Vb=(Es(Wb,jb=Mb),Wb),qb=(Es(Bb,Ub=Mb),Bb);function Bb(t){var e=this;return(e=Ub.call(this)||this).elements=t,e}function Wb(){return null!==jb&&jb.apply(this,arguments)||this}function Hb(t,e){for(var n=Zb(e),r=function(e){n.some(function(t){return Xm(t,e)})||n.push(e)},i=0,o=t.elements;i<o.length;i++)r(o[i]);return{arrayValue:{values:n}}}var Kb,Gb=(Es(zb,Kb=Mb),zb);function zb(t){var e=this;return(e=Kb.call(this)||this).elements=t,e}function Qb(t,e){for(var n=Zb(e),r=function(e){n=n.filter(function(t){return!Xm(t,e)})},i=0,o=t.elements;i<o.length;i++)r(o[i]);return{arrayValue:{values:n}}}var Xb,Yb=(Es($b,Xb=Mb),$b);function $b(t,e){var n=this;return(n=Xb.call(this)||this).serializer=t,n.qe=e,n}function Jb(t){return eb(t.integerValue||t.doubleValue)}function Zb(t){return ob(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}var tw=(nw.prototype.je=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].D(t))return!0;return!1},nw.prototype.isEqual=function(t){return pg(this.fields,t.fields,function(t,e){return t.isEqual(e)})},nw),ew=function(t,e){this.field=t,this.transform=e};function nw(t){(this.fields=t).sort(Rg.P)}function rw(t,e){this.version=t,this.transformResults=e}var iw=(ow.We=function(){return new ow},ow.exists=function(t){return new ow(void 0,t)},ow.updateTime=function(t){return new ow(t)},Object.defineProperty(ow.prototype,"Be",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!1,configurable:!0}),ow.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},ow);function ow(t,e){this.updateTime=t,this.exists=e}function sw(t,e){return void 0!==t.updateTime?e instanceof jw&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e instanceof jw}function aw(){}function uw(t,e,n){return t instanceof dw?(i=n,new jw(t.key,i.version,t.value,{hasCommittedMutations:!0})):t instanceof vw?function(t,e,n){if(!sw(t.Ue,e))return new qw(t.key,n.version);var r=mw(t,e);return new jw(t.key,n.version,r,{hasCommittedMutations:!0})}(t,e,n):t instanceof ww?function(t,e,n){if(ag(null!=n.transformResults),!sw(t.Ue,e))return new qw(t.key,n.version);var r=Ew(0,e),i=function(t,e,n){var r,i,o,s=[];ag(t.length===n.length);for(var a=0;a<n.length;a++){var u=t[a],c=u.transform,h=null;e instanceof jw&&(h=e.field(u.field)),s.push((r=c,i=h,o=n[a],r instanceof qb?Hb(r,i):r instanceof Gb?Qb(r,i):o))}return s}(t.fieldTransforms,e,n.transformResults),o=n.version,s=Iw(t,r.data(),i);return new jw(t.key,o,s,{hasCommittedMutations:!0})}(t,e,n):(r=n,new Vw(t.key,r.version,{hasCommittedMutations:!0}));var r,i}function cw(t,e,n,r){return t instanceof dw?function(t,e){if(!sw(t.Ue,e))return e;var n=lw(e);return new jw(t.key,n,t.value,{Ke:!0})}(t,e):t instanceof vw?function(t,e){if(!sw(t.Ue,e))return e;var n=lw(e),r=mw(t,e);return new jw(t.key,n,r,{Ke:!0})}(t,e):t instanceof ww?function(t,e,n,r){if(!sw(t.Ue,e))return e;var i=Ew(0,e),o=function(t,e,n,r){for(var i=[],o=0,s=t;o<s.length;o++){var a=s[o],u=a.transform,c=null;n instanceof jw&&(c=n.field(a.field)),null===c&&r instanceof jw&&(c=r.field(a.field)),i.push((l=c,f=e,y=v=d=p=void 0,(h=u)instanceof Vb?(y={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:f.seconds,nanos:f.nanoseconds}}}},l&&(y.fields.__previous_value__=l),{mapValue:y}):h instanceof qb?Hb(h,l):h instanceof Gb?Qb(h,l):(d=Fb(p=h,l),v=Jb(d)+Jb(p.qe),ib(d)&&ib(p.qe)?fb(v):pb(p.serializer,v))))}var h,l,f,p,d,v,y;return i}(t.fieldTransforms,n,e,r),s=Iw(t,i.data(),o);return new jw(t.key,i.version,s,{Ke:!0})}(t,e,r,n):(o=e,sw((i=t).Ue,o)?new Vw(i.key,Ag.min()):o);var i,o}function hw(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.Ue.isEqual(e.Ue)&&(0===t.type?t.value.isEqual(e.value):1===t.type?t.data.isEqual(e.data)&&t.Le.isEqual(e.Le):2!==t.type||pg(t.fieldTransforms,t.fieldTransforms,function(t,e){return r=e,(n=t).field.isEqual(r.field)&&(i=n.transform,o=r.transform,i instanceof qb&&o instanceof qb||i instanceof Gb&&o instanceof Gb?pg(i.elements,o.elements,Xm):i instanceof Yb&&o instanceof Yb?Xm(i.qe,o.qe):i instanceof Vb&&o instanceof Vb);var n,r,i,o}))}function lw(t){return t instanceof jw?t.version:Ag.min()}var fw,pw,dw=(Es(gw,pw=aw),gw),vw=(Es(yw,fw=aw),yw);function yw(t,e,n,r){var i=this;return(i=fw.call(this)||this).key=t,i.data=e,i.Le=n,i.Ue=r,i.type=1,i}function gw(t,e,n){var r=this;return(r=pw.call(this)||this).key=t,r.value=e,r.Ue=n,r.type=0,r}function mw(t,e){return n=t,r=e instanceof jw?e.data():Aw.empty(),i=new kw(r),n.Le.fields.forEach(function(t){if(!t._()){var e=n.data.field(t);null!==e?i.set(t,e):i.delete(t)}}),i.Ge();var n,r,i}var bw,ww=(Es(_w,bw=aw),_w);function _w(t,e){var n=this;return(n=bw.call(this)||this).key=t,n.fieldTransforms=e,n.type=2,n.Ue=iw.exists(!0),n}function Ew(t,e){return e}function Iw(t,e,n){for(var r=new kw(e),i=0;i<t.fieldTransforms.length;i++){var o=t.fieldTransforms[i];r.set(o.field,n[i])}return r.Ge()}var Tw,Sw,Cw=(Es(Dw,Sw=aw),Dw),Nw=(Es(Rw,Tw=aw),Rw),Aw=(Pw.empty=function(){return new Pw({mapValue:{}})},Pw.prototype.field=function(t){if(t._())return this.proto;for(var e=this.proto,n=0;n<t.length-1;++n){if(!e.mapValue.fields)return null;if(!ub(e=e.mapValue.fields[t.get(n)]))return null}return(e=(e.mapValue.fields||{})[t.S()])||null},Pw.prototype.isEqual=function(t){return Xm(this.proto,t.proto)},Pw),kw=(Ow.prototype.set=function(t,e){return this.Ye(t,e),this},Ow.prototype.delete=function(t){return this.Ye(t,null),this},Ow.prototype.Ye=function(t,e){for(var n=this.He,r=0;r<t.length-1;++r){var i=t.get(r),o=n.get(i);o instanceof Map||(o=o&&10===Qm(o)?new Map(Object.entries(o.mapValue.fields||{})):new Map,n.set(i,o)),n=o}n.set(t.S(),e)},Ow.prototype.Ge=function(){var t=this.Je(Rg.k(),this.He);return null!=t?new Aw(t):this.ze},Ow.prototype.Je=function(r,t){var i=this,o=!1,e=this.ze.field(r),s=ub(e)?Object.assign({},e.mapValue.fields):{};return t.forEach(function(t,e){if(t instanceof Map){var n=i.Je(r.child(e),t);null!=n&&(s[e]=n,o=!0)}else null!==t?(s[e]=t,o=!0):s.hasOwnProperty(e)&&(delete s[e],o=!0)}),o?{mapValue:{fields:s}}:null},Ow);function Ow(t){void 0===t&&(t=Aw.empty()),this.ze=t,this.He=new Map}function Pw(t){this.proto=t}function Rw(t,e){var n=this;return(n=Tw.call(this)||this).key=t,n.Ue=e,n.type=4,n}function Dw(t,e){var n=this;return(n=Sw.call(this)||this).key=t,n.Ue=e,n.type=3,n}function xw(t){var a=[];return bg(t.fields||{},function(t,e){var n=new Rg([t]);if(ub(e)){var r=xw(e.mapValue).fields;if(0===r.length)a.push(n);else for(var i=0,o=r;i<o.length;i++){var s=o[i];a.push(n.child(s))}}else a.push(n)}),new tw(a)}function Lw(t,e){this.key=t,this.version=e}var Mw,Fw,Uw,jw=(Es(Hw,Uw=Lw),Hw.prototype.field=function(t){return this.Xe.field(t)},Hw.prototype.data=function(){return this.Xe},Hw.prototype.Ze=function(){return this.Xe.proto},Hw.prototype.isEqual=function(t){return t instanceof Hw&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.Ke===t.Ke&&this.hasCommittedMutations===t.hasCommittedMutations&&this.Xe.isEqual(t.Xe)},Hw.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.Xe.toString()+", {hasLocalMutations: "+this.Ke+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(Hw.prototype,"hasPendingWrites",{get:function(){return this.Ke||this.hasCommittedMutations},enumerable:!1,configurable:!0}),Hw),Vw=(Es(Ww,Fw=Lw),Ww.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(Ww.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!1,configurable:!0}),Ww.prototype.isEqual=function(t){return t instanceof Ww&&t.hasCommittedMutations===this.hasCommittedMutations&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Ww),qw=(Es(Bw,Mw=Lw),Bw.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(Bw.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!1,configurable:!0}),Bw.prototype.isEqual=function(t){return t instanceof Bw&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Bw);function Bw(){return null!==Mw&&Mw.apply(this,arguments)||this}function Ww(t,e,n){var r=this;return(r=Fw.call(this,t,e)||this).hasCommittedMutations=!(!n||!n.hasCommittedMutations),r}function Hw(t,e,n,r){var i=this;return(i=Uw.call(this,t,e)||this).Xe=n,i.Ke=!!r.Ke,i.hasCommittedMutations=!!r.hasCommittedMutations,i}function Kw(t,e){if(!(t instanceof e))throw e.name===t.constructor.name?new Cg(Sg.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass '"+e.name+"' from a different Firestore SDK?"):new Cg(Sg.INVALID_ARGUMENT,"Expected type '"+e.name+"', but was '"+t.constructor.name+"'");return t}var Gw=(zw.prototype.rn=function(t){return new zw(t,null,this.tn.slice(),this.filters.slice(),this.limit,this.en,this.startAt,this.endAt)},zw.prototype.on=function(){return 0===this.filters.length&&null===this.limit&&null==this.startAt&&null==this.endAt&&(0===this.tn.length||1===this.tn.length&&this.tn[0].field.O())},zw.prototype.hn=function(){return!Bg(this.limit)&&"F"===this.en},zw.prototype.an=function(){return!Bg(this.limit)&&"L"===this.en},zw.prototype.un=function(){return 0<this.tn.length?this.tn[0].field:null},zw.prototype.cn=function(){for(var t=0,e=this.filters;t<e.length;t++){var n=e[t];if(n.ln())return n.field}return null},zw.prototype._n=function(t){for(var e=0,n=this.filters;e<n.length;e++){var r=n[e];if(0<=t.indexOf(r.op))return r.op}return null},zw);function zw(t,e,n,r,i,o,s,a){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o="F"),void 0===s&&(s=null),void 0===a&&(a=null),this.path=t,this.collectionGroup=e,this.tn=n,this.filters=r,this.limit=i,this.en=o,this.startAt=s,this.endAt=a,this.nn=null,this.sn=null,this.startAt,this.endAt}function Qw(t,e,n,r,i,o,s,a){return new Gw(t,e,n,r,i,o,s,a)}function Xw(t){return new Gw(t)}function Yw(t){return null!==t.collectionGroup}function $w(t){var e=Kw(t,Gw);if(null===e.nn){e.nn=[];var n=e.cn(),r=e.un();if(null!==n&&null===r)n.O()||e.nn.push(new k_(n)),e.nn.push(new k_(Rg.L(),"asc"));else{for(var i=!1,o=0,s=e.tn;o<s.length;o++){var a=s[o];e.nn.push(a),a.field.O()&&(i=!0)}if(!i){var u=0<e.tn.length?e.tn[e.tn.length-1].dir:"asc";e.nn.push(new k_(Rg.L(),u))}}}return e.nn}function Jw(t){var e=Kw(t,Gw);if(!e.sn)if("F"===e.en)e.sn=Gg(e.path,e.collectionGroup,$w(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=$w(e);r<i.length;r++){var o=i[r],s="desc"===o.dir?"asc":"desc";n.push(new k_(o.field,s))}var a=e.endAt?new w_(e.endAt.position,!e.endAt.before):null,u=e.startAt?new w_(e.startAt.position,!e.startAt.before):null;e.sn=Gg(e.path,e.collectionGroup,n,e.filters,e.limit,a,u)}return e.sn}function Zw(t,e,n){return new Gw(t.path,t.collectionGroup,t.tn.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function t_(t,e){return new Gw(t.path,t.collectionGroup,t.tn.slice(),t.filters.slice(),t.limit,t.en,e,t.endAt)}function e_(t,e){return new Gw(t.path,t.collectionGroup,t.tn.slice(),t.filters.slice(),t.limit,t.en,t.startAt,e)}function n_(t,e){return Qg(Jw(t),Jw(e))&&t.en===e.en}function r_(t){return zg(Jw(t))+"|lt:"+t.en}function i_(t){return"Query(target="+(e=Jw(t),n=e.path.$(),null!==e.collectionGroup&&(n+=" collectionGroup="+e.collectionGroup),0<e.filters.length&&(n+=", filters: ["+e.filters.map(function(t){return(e=t).field.$()+" "+e.op+" "+Zm(e.value);var e}).join(", ")+"]"),Bg(e.limit)||(n+=", limit: "+e.limit),0<e.orderBy.length&&(n+=", orderBy: ["+e.orderBy.map(function(t){return(e=t).field.$()+" ("+e.dir+")";var e}).join(", ")+"]"),e.startAt&&(n+=", startAt: "+C_(e.startAt)),e.endAt&&(n+=", endAt: "+C_(e.endAt)),"Target("+n+")")+"; limitType="+t.en+")";var e,n}function o_(i,t){return r=i,o=t.key.path,(null!==r.collectionGroup?t.key.U(r.collectionGroup)&&r.path.D(o):Dg.W(r.path)?r.path.isEqual(o):r.path.C(o))&&function(t){for(var e=0,n=i.tn;e<n.length;e++){var r=n[e];if(!r.field.O()&&null===t.field(r.field))return}return 1}(t)&&function(t){for(var e=0,n=i.filters;e<n.length;e++)if(!n[e].matches(t))return;return 1}(t)&&(n=t,(!(e=i).startAt||N_(e.startAt,$w(e),n))&&(!e.endAt||!N_(e.endAt,$w(e),n)));var e,n,r,o}function s_(a){return function(t,e){for(var n=!1,r=0,i=$w(a);r<i.length;r++){var o=i[r],s=O_(o,t,e);if(0!==s)return s;n=n||o.field.O()}return 0}}var a_,u_=(Es(c_,a_=function(){}),c_.create=function(t,e,n){if(t.O())return"in"===e?new y_(t,n):new v_(t,e,n);if(sb(n)){if("=="!==e)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. Null supports only equality comparisons.");return new c_(t,e,n)}if(ab(n)){if("=="!==e)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. NaN supports only equality comparisons.");return new c_(t,e,n)}return"array-contains"===e?new g_(t,n):"in"===e?new m_(t,n):"array-contains-any"===e?new b_(t,n):new c_(t,e,n)},c_.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&Qm(this.value)===Qm(e)&&this.fn($m(e,this.value))},c_.prototype.fn=function(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case">":return 0<t;case">=":return 0<=t;default:return sg()}},c_.prototype.ln=function(){return 0<=["<","<=",">",">="].indexOf(this.op)},c_);function c_(t,e,n){var r=this;return(r=a_.call(this)||this).field=t,r.op=e,r.value=n,r}var h_,l_,f_,p_,d_,v_=(Es(S_,d_=u_),S_.prototype.matches=function(t){var e=Dg.P(t.key,this.key);return this.fn(e)},S_),y_=(Es(T_,p_=u_),T_.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},T_),g_=(Es(I_,f_=u_),I_.prototype.matches=function(t){var e=t.field(this.field);return ob(e)&&Ym(e.arrayValue,this.value)},I_),m_=(Es(E_,l_=u_),E_.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&Ym(this.value.arrayValue,e)},E_),b_=(Es(__,h_=u_),__.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!ob(n)||!n.arrayValue.values)&&n.arrayValue.values.some(function(t){return Ym(e.value.arrayValue,t)})},__),w_=function(t,e){this.position=t,this.before=e};function __(t,e){return h_.call(this,t,"array-contains-any",e)||this}function E_(t,e){return l_.call(this,t,"in",e)||this}function I_(t,e){return f_.call(this,t,"array-contains",e)||this}function T_(t,e){var n=this;return(n=p_.call(this,t,"in",e)||this).keys=(e.arrayValue.values||[]).map(function(t){return Dg.B(t.referenceValue)}),n}function S_(t,e,n){var r=this;return(r=d_.call(this,t,e,n)||this).key=Dg.B(n.referenceValue),r}function C_(t){return(t.before?"b":"a")+":"+t.position.map(function(t){return Zm(t)}).join(",")}function N_(t,e,n){for(var r=0,i=0;i<t.position.length;i++){var o=e[i],s=t.position[i];if(r=o.field.O()?Dg.P(Dg.B(s.referenceValue),n.key):$m(s,n.field(o.field)),"desc"===o.dir&&(r*=-1),0!==r)break}return t.before?r<=0:r<0}function A_(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.before!==e.before||t.position.length!==e.position.length)return!1;for(var n=0;n<t.position.length;n++)if(!Xm(t.position[n],e.position[n]))return!1;return!0}var k_=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function O_(t,e,n){var r,i,o,s,a=t.field.O()?Dg.P(e.key,n.key):(r=t.field,i=n,o=e.field(r),s=i.field(r),null!==o&&null!==s?$m(o,s):sg());switch(t.dir){case"asc":return a;case"desc":return-1*a;default:return sg()}}var P_=(z_.prototype.wn=function(t,e,n){for(var r=n.Tn,i=0;i<this.mutations.length;i++){var o=this.mutations[i];o.key.isEqual(t)&&(e=uw(o,e,r[i]))}return e},z_.prototype.En=function(t,e){for(var n=0,r=this.baseMutations;n<r.length;n++){var i=r[n];i.key.isEqual(t)&&(e=cw(i,e,e,this.dn))}for(var o=e,s=0,a=this.mutations;s<a.length;s++){var u=a[s];u.key.isEqual(t)&&(e=cw(u,e,o,this.dn))}return e},z_.prototype.In=function(n){var r=this,i=n;return this.mutations.forEach(function(t){var e=r.En(t.key,n.get(t.key));e&&(i=i.nt(t.key,e))}),i},z_.prototype.keys=function(){return this.mutations.reduce(function(t,e){return t.add(e.key)},Im())},z_.prototype.isEqual=function(t){return this.batchId===t.batchId&&pg(this.mutations,t.mutations,function(t,e){return hw(t,e)})&&pg(this.baseMutations,t.baseMutations,function(t,e){return hw(t,e)})},z_),R_=(G_.from=function(t,e,n){ag(t.mutations.length===n.length);for(var r=_m,i=t.mutations,o=0;o<i.length;o++)r=r.nt(i[o].key,n[o].version);return new G_(t,e,n,r)},G_),D_=(K_.prototype.catch=function(t){return this.next(void 0,t)},K_.prototype.next=function(r,i){var o=this;return this.Vn&&sg(),this.Vn=!0,this.gn?this.error?this.yn(i,this.error):this.pn(r,this.result):new K_(function(e,n){o.Rn=function(t){o.pn(r,t).next(e,n)},o.Pn=function(t){o.yn(i,t).next(e,n)}})},K_.prototype.bn=function(){var n=this;return new Promise(function(t,e){n.next(t,e)})},K_.prototype.vn=function(t){try{var e=t();return e instanceof K_?e:K_.resolve(e)}catch(t){return K_.reject(t)}},K_.prototype.pn=function(t,e){return t?this.vn(function(){return t(e)}):K_.resolve(e)},K_.prototype.yn=function(t,e){return t?this.vn(function(){return t(e)}):K_.reject(e)},K_.resolve=function(n){return new K_(function(t,e){t(n)})},K_.reject=function(n){return new K_(function(t,e){e(n)})},K_.Sn=function(t){return new K_(function(e,n){var r=0,i=0,o=!1;t.forEach(function(t){++r,t.next(function(){++i,o&&i===r&&e()},function(t){return n(t)})}),o=!0,i===r&&e()})},K_.Dn=function(t){for(var n=K_.resolve(!1),e=function(e){n=n.next(function(t){return t?K_.resolve(t):e()})},r=0,i=t;r<i.length;r++)e(i[r]);return n},K_.forEach=function(t,n){var r=this,i=[];return t.forEach(function(t,e){i.push(n.call(r,t,e))}),this.Sn(i)},K_),x_=(Object.defineProperty(H_.prototype,"readTime",{get:function(){return this.$n},set:function(t){this.$n=t},enumerable:!1,configurable:!0}),H_.prototype.Nn=function(t,e){this.kn(),this.readTime=e,this.Cn.set(t.key,t)},H_.prototype.xn=function(t,e){this.kn(),e&&(this.readTime=e),this.Cn.set(t,null)},H_.prototype.Mn=function(t,e){this.kn();var n=this.Cn.get(e);return void 0!==n?D_.resolve(n):this.On(t,e)},H_.prototype.getEntries=function(t,e){return this.Ln(t,e)},H_.prototype.apply=function(t){return this.kn(),this.Fn=!0,this.qn(t)},H_.prototype.kn=function(){},H_),L_="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",M_=(W_.prototype.Un=function(t){this.Bn.push(t)},W_.prototype.Wn=function(){this.Bn.forEach(function(t){return t()})},W_),F_=(B_.prototype.Gn=function(e,n){var r=this;return this.jn.zn(e,n).next(function(t){return r.Hn(e,n,t)})},B_.prototype.Hn=function(t,r,i){return this.Qn.Mn(t,r).next(function(t){for(var e=0,n=i;e<n.length;e++)t=n[e].En(r,t);return t})},B_.prototype.Yn=function(t,e,i){var o=mm();return e.forEach(function(t,e){for(var n=0,r=i;n<r.length;n++)e=r[n].En(t,e);o=o.nt(t,e)}),o},B_.prototype.Jn=function(e,t){var n=this;return this.Qn.getEntries(e,t).next(function(t){return n.Xn(e,t)})},B_.prototype.Xn=function(r,i){var o=this;return this.jn.Zn(r,i).next(function(t){var e=o.Yn(r,i,t),n=gm();return e.forEach(function(t,e){e=e||new Vw(t,Ag.min()),n=n.nt(t,e)}),n})},B_.prototype.ts=function(t,e,n){return r=e,Dg.W(r.path)&&null===r.collectionGroup&&0===r.filters.length?this.es(t,e.path):Yw(e)?this.ns(t,e,n):this.ss(t,e,n);var r},B_.prototype.es=function(t,e){return this.Gn(t,new Dg(e)).next(function(t){var e=wm();return t instanceof jw&&(e=e.nt(t.key,t)),e})},B_.prototype.ns=function(n,r,i){var o=this,s=r.collectionGroup,a=wm();return this.Kn.rs(n,s).next(function(t){return D_.forEach(t,function(t){var e=r.rn(t.child(s));return o.ss(n,e,i).next(function(t){t.forEach(function(t,e){a=a.nt(t,e)})})}).next(function(){return a})})},B_.prototype.ss=function(e,n,t){var h,l,r=this;return this.Qn.ts(e,n,t).next(function(t){return h=t,r.jn.os(e,n)}).next(function(t){return l=t,r.hs(e,l,h).next(function(t){h=t;for(var e=0,n=l;e<n.length;e++)for(var r=n[e],i=0,o=r.mutations;i<o.length;i++){var s=o[i],a=s.key,u=h.get(a),c=cw(s,u,u,r.dn);h=c instanceof jw?h.nt(a,c):h.remove(a)}})}).next(function(){return h.forEach(function(t,e){o_(n,e)||(h=h.remove(t))}),h})},B_.prototype.hs=function(t,e,n){for(var r=Im(),i=0,o=e;i<o.length;i++)for(var s=0,a=o[i].mutations;s<a.length;s++){var u=a[s];u instanceof vw&&null===n.get(u.key)&&(r=r.add(u.key))}var c=n;return this.Qn.getEntries(t,r).next(function(t){return t.forEach(function(t,e){null!==e&&e instanceof jw&&(c=c.nt(t,e))}),c})},B_),U_=(q_.cs=function(t,e){for(var n=Im(),r=Im(),i=0,o=e.docChanges;i<o.length;i++){var s=o[i];switch(s.type){case 0:n=n.add(s.doc.key);break;case 1:r=r.add(s.doc.key)}}return new q_(t,e.fromCache,n,r)},q_),j_=(V_.prototype._s=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},V_.prototype.next=function(){var t=++this.previousValue;return this.fs&&this.fs(t),t},V_);function V_(t,e){var n=this;this.previousValue=t,e&&(e.ls=function(t){return n._s(t)},this.fs=function(t){return e.ds(t)})}function q_(t,e,n,r){this.targetId=t,this.fromCache=e,this.as=n,this.us=r}function B_(t,e,n){this.Qn=t,this.jn=e,this.Kn=n}function W_(){this.Bn=[]}function H_(){this.Cn=new Tg(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),this.Fn=!1}function K_(t){var e=this;this.Rn=null,this.Pn=null,this.result=void 0,this.error=void 0,this.gn=!1,this.Vn=!1,t(function(t){e.gn=!0,e.result=t,e.Rn&&e.Rn(t)},function(t){e.gn=!0,e.error=t,e.Pn&&e.Pn(t)})}function G_(t,e,n,r){this.batch=t,this.mn=e,this.Tn=n,this.An=r}function z_(t,e,n,r){this.batchId=t,this.dn=e,this.baseMutations=n,this.mutations=r}j_.ws=-1;function Q_(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}var X_=(Y_.prototype.reset=function(){this.Rs=0},Y_.prototype.Vs=function(){this.Rs=this.As},Y_.prototype.ys=function(t){var e=this;this.cancel();var n=Math.floor(this.Rs+this.ps()),r=Math.max(0,Date.now()-this.gs),i=Math.max(0,n-r);0<i&&rg("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.Rs+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.Ps=this.Ts.bs(this.Es,i,function(){return e.gs=Date.now(),t()}),this.Rs*=this.ms,this.Rs<this.Is&&(this.Rs=this.Is),this.Rs>this.As&&(this.Rs=this.As)},Y_.prototype.vs=function(){null!==this.Ps&&(this.Ps.Ss(),this.Ps=null)},Y_.prototype.cancel=function(){null!==this.Ps&&(this.Ps.cancel(),this.Ps=null)},Y_.prototype.ps=function(){return(Math.random()-.5)*this.Rs},Y_);function Y_(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.Ts=t,this.Es=e,this.Is=n,this.ms=r,this.As=i,this.Rs=0,this.Ps=null,this.gs=Date.now(),this.reset()}function $_(t){for(var e="",n=0;n<t.length;n++)0<e.length&&(e=Z_(e)),e=J_(t.get(n),e);return Z_(e)}function J_(t,e){for(var n=e,r=t.length,i=0;i<r;i++){var o=t.charAt(i);switch(o){case"\0":n+="";break;case"":n+="";break;default:n+=o}}return n}function Z_(t){return t+""}function tE(t){var e=t.length;if(ag(2<=e),2===e)return ag(""===t.charAt(0)&&""===t.charAt(1)),Og.k();for(var n=e-2,r=[],i="",o=0;o<e;){var s=t.indexOf("",o);switch((s<0||n<s)&&sg(),t.charAt(s+1)){case"":var a=t.substring(o,s),u=void 0;0===i.length?u=a:(u=i+=a,i=""),r.push(u);break;case"":i+=t.substring(o,s),i+="\0";break;case"":i+=t.substring(o,s+1);break;default:sg()}o=s+2}return new Og(r)}var eE=(sE.prototype.Cs=function(t,e){return this.Ds.add(e),D_.resolve()},sE.prototype.rs=function(t,e){return D_.resolve(this.Ds.getEntries(e))},sE),nE=(oE.prototype.add=function(t){var e=t.S(),n=t.p(),r=this.index[e]||new fm(Og.P),i=!r.has(n);return this.index[e]=r.add(n),i},oE.prototype.has=function(t){var e=t.S(),n=t.p(),r=this.index[e];return r&&r.has(n)},oE.prototype.getEntries=function(t){return(this.index[t]||new fm(Og.P)).F()},oE),rE=(iE.prototype.Cs=function(t,e){var n=this;if(this.Fs.has(e))return D_.resolve();var r=e.S(),i=e.p();t.Un(function(){n.Fs.add(e)});var o={collectionId:r,parent:$_(i)};return aE(t).put(o)},iE.prototype.rs=function(t,i){var o=[],e=IDBKeyRange.bound([i,""],[dg(i),""],!1,!0);return aE(t).$s(e).next(function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];if(r.collectionId!==i)break;o.push(tE(r.parent))}return o})},iE);function iE(){this.Fs=new nE}function oE(){this.index={}}function sE(){this.Ds=new nE}function aE(t){return ME.Ns(t,dI.store)}function uE(t){this.ks=t}function cE(t,e){if(e.document)return n=t.ks,r=e.document,i=!!e.hasCommittedMutations,o=_b(n,r.name),s=gb(r.updateTime),a=new Aw({mapValue:{fields:r.fields}}),new jw(o,s,a,{hasCommittedMutations:!!i});var n,r,i,o,s,a;if(e.noDocument){var u=Dg.j(e.noDocument.path),c=dE(e.noDocument.readTime);return new Vw(u,c,{hasCommittedMutations:!!e.hasCommittedMutations})}if(e.unknownDocument){var h=Dg.j(e.unknownDocument.path),l=dE(e.unknownDocument.version);return new qw(h,l)}return sg()}function hE(t,e,n){var r,i,o=lE(n),s=e.key.path.p().F();if(e instanceof jw){var a={name:wb(r=t.ks,(i=e).key),fields:i.Ze().mapValue.fields,updateTime:vb(r,i.version.A())},u=e.hasCommittedMutations;return new cI(null,null,a,u,o,s)}if(e instanceof Vw){var c=e.key.path.F(),h=pE(e.version),l=e.hasCommittedMutations;return new cI(null,new aI(c,h),null,l,o,s)}if(e instanceof qw){var f=e.key.path.F(),p=pE(e.version);return new cI(new uI(f,p),null,null,!0,o,s)}return sg()}function lE(t){var e=t.A();return[e.seconds,e.nanoseconds]}function fE(t){var e=new Ng(t[0],t[1]);return Ag.I(e)}function pE(t){var e=t.A();return new tI(e.seconds,e.nanoseconds)}function dE(t){var e=new Ng(t.seconds,t.nanoseconds);return Ag.I(e)}function vE(e,t){var n=(t.baseMutations||[]).map(function(t){return Ab(e.ks,t)}),r=t.mutations.map(function(t){return Ab(e.ks,t)}),i=Ng.fromMillis(t.localWriteTimeMs);return new P_(t.batchId,i,n,r)}function yE(t){var e,n,r=dE(t.readTime),i=void 0!==t.lastLimboFreeSnapshotVersion?dE(t.lastLimboFreeSnapshotVersion):Ag.min();return e=void 0!==t.query.documents?(ag(1===(n=t.query).documents.length),Jw(Xw(Ib(n.documents[0])))):function(t){var e=Ib(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;if(0<r){ag(1===r);var o=n.from[0];o.allDescendants?i=o.collectionId:e=e.child(o.collectionId)}var s=[];n.where&&(s=function e(t){return t?void 0!==t.unaryFilter?[function(t){switch(t.unaryFilter.op){case"IS_NAN":var e=xb(t.unaryFilter.field);return u_.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=xb(t.unaryFilter.field);return u_.create(n,"==",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return sg()}}(t)]:void 0!==t.fieldFilter?[(n=t,u_.create(xb(n.fieldFilter.field),function(){switch(n.fieldFilter.op){case"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"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return sg()}}(),n.fieldFilter.value))]:void 0!==t.compositeFilter?t.compositeFilter.filters.map(function(t){return e(t)}).reduce(function(t,e){return t.concat(e)}):sg():[];var n}(n.where));var a=[];n.orderBy&&(a=n.orderBy.map(function(t){return new k_(xb((e=t).field),function(){switch(e.direction){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}());var e}));var u,c,h=null;n.limit&&(u=n.limit,h=Bg(c="object"==typeof u?u.value:u)?null:c);var l=null;n.startAt&&(l=Rb(n.startAt));var f=null;return n.endAt&&(f=Rb(n.endAt)),Jw(Qw(e,i,a,s,h,"F",l,f))}(t.query),new em(e,t.targetId,0,t.lastListenSequenceNumber,r,i,Yg.fromBase64String(t.resumeToken))}function gE(t,e){var n,r=pE(e.X),i=pE(e.lastLimboFreeSnapshotVersion);n=(Xg(e.target)?kb:Ob)(t.ks,e.target);var o=e.resumeToken.toBase64();return new lI(e.targetId,zg(e.target),r,o,e.sequenceNumber,i,n)}var mE,bE=(wE.prototype.Nn=function(t,e,n){return EE(t).put(IE(e),n)},wE.prototype.xn=function(t,e){var n=EE(t),r=IE(e);return n.delete(r)},wE.prototype.updateMetadata=function(e,n){var r=this;return this.getMetadata(e).next(function(t){return t.byteSize+=n,r.xs(e,t)})},wE.prototype.Mn=function(t,e){var n=this;return EE(t).get(IE(e)).next(function(t){return n.Ms(t)})},wE.prototype.Os=function(t,e){var n=this;return EE(t).get(IE(e)).next(function(t){var e=n.Ms(t);return e?{Ls:e,size:TE(t)}:null})},wE.prototype.getEntries=function(t,e){var r=this,i=mm();return this.qs(t,e,function(t,e){var n=r.Ms(e);i=i.nt(t,n)}).next(function(){return i})},wE.prototype.Bs=function(t,e){var r=this,i=mm(),o=new om(Dg.P);return this.qs(t,e,function(t,e){var n=r.Ms(e);o=n?(i=i.nt(t,n),o.nt(t,TE(e))):(i=i.nt(t,null),o.nt(t,0))}).next(function(){return{Us:i,Ws:o}})},wE.prototype.qs=function(t,e,i){if(e._())return D_.resolve();var n=IDBKeyRange.bound(e.first().path.F(),e.last().path.F()),o=e.at(),s=o.dt();return EE(t).Qs({range:n},function(t,e,n){for(var r=Dg.j(t);s&&Dg.P(s,r)<0;)i(s,null),s=o.dt();s&&s.isEqual(r)&&(i(s,e),s=o.wt()?o.dt():null),s?n.js(s.path.F()):n.done()}).next(function(){for(;s;)i(s,null),s=o.wt()?o.dt():null})},wE.prototype.ts=function(t,i,e){var o=this,s=wm(),a=i.path.length+1,n={};if(e.isEqual(Ag.min())){var r=i.path.F();n.range=IDBKeyRange.lowerBound(r)}else{var u=i.path.F(),c=lE(e);n.range=IDBKeyRange.lowerBound([u,c],!0),n.index=cI.collectionReadTimeIndex}return EE(t).Qs(n,function(t,e,n){if(t.length===a){var r=cE(o.serializer,e);i.path.D(r.key.path)?r instanceof jw&&o_(i,r)&&(s=s.nt(r.key,r)):n.done()}}).next(function(){return s})},wE.prototype.Ks=function(t,e){var r=this,i=gm(),o=lE(e),n=EE(t),s=IDBKeyRange.lowerBound(o,!0);return n.Qs({index:cI.readTimeIndex,range:s},function(t,e){var n=cE(r.serializer,e);i=i.nt(n.key,n),o=e.readTime}).next(function(){return{Gs:i,readTime:fE(o)}})},wE.prototype.zs=function(t){var e=EE(t),r=Ag.min();return e.Qs({index:cI.readTimeIndex,reverse:!0},function(t,e,n){e.readTime&&(r=fE(e.readTime)),n.done()}).next(function(){return r})},wE.prototype.Hs=function(t){return new wE.Ys(this,!!t&&t.Js)},wE.prototype.Xs=function(t){return this.getMetadata(t).next(function(t){return t.byteSize})},wE.prototype.getMetadata=function(t){return _E(t).get(hI.key).next(function(t){return ag(!!t),t})},wE.prototype.xs=function(t,e){return _E(t).put(hI.key,e)},wE.prototype.Ms=function(t){if(t){var e=cE(this.serializer,t);return e instanceof Vw&&e.version.isEqual(Ag.min())?null:e}return null},wE);function wE(t,e){this.serializer=t,this.Kn=e}function _E(t){return ME.Ns(t,hI.store)}function EE(t){return ME.Ns(t,cI.store)}function IE(t){return t.path.F()}function TE(t){var e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw sg();e=t.noDocument}return JSON.stringify(e).length}function SE(t,e){var n=this;return(n=mE.call(this)||this).Zs=t,n.Js=e,n.ti=new Tg(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),n}bE.Ys=(Es(SE,mE=x_),SE.prototype.qn=function(s){var a=this,u=[],c=0,h=new fm(function(t,e){return fg(t.$(),e.$())});return this.Cn.forEach(function(t,e){var n=a.ti.get(t);if(e){var r=hE(a.Zs.serializer,e,a.readTime);h=h.add(t.path.p());var i=TE(r);c+=i-n,u.push(a.Zs.Nn(s,t,r))}else if(c-=n,a.Js){var o=hE(a.Zs.serializer,new Vw(t,Ag.min()),a.readTime);u.push(a.Zs.Nn(s,t,o))}else u.push(a.Zs.xn(s,t))}),h.forEach(function(t){u.push(a.Zs.Kn.Cs(s,t))}),u.push(this.Zs.updateMetadata(s,c)),D_.Sn(u)},SE.prototype.On=function(t,e){var n=this;return this.Zs.Os(t,e).next(function(t){return null===t?(n.ti.set(e,0),null):(n.ti.set(e,t.size),t.Ls)})},SE.prototype.Ln=function(t,e){var n=this;return this.Zs.Bs(t,e).next(function(t){var e=t.Us;return t.Ws.forEach(function(t,e){n.ti.set(t,e)}),e})},SE);var CE=(kE.prototype.next=function(){return this.ei+=2,this.ei},kE.ni=function(){return new kE(0)},kE.si=function(){return new kE(-1)},kE),NE=(AE.prototype.ri=function(n){var r=this;return this.oi(n).next(function(t){var e=new CE(t.highestTargetId);return t.highestTargetId=e.next(),r.hi(n,t).next(function(){return t.highestTargetId})})},AE.prototype.ai=function(t){return this.oi(t).next(function(t){return Ag.I(new Ng(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},AE.prototype.ui=function(t){return this.oi(t).next(function(t){return t.highestListenSequenceNumber})},AE.prototype.ci=function(e,n,r){var i=this;return this.oi(e).next(function(t){return t.highestListenSequenceNumber=n,r&&(t.lastRemoteSnapshotVersion=r.A()),n>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.hi(e,t)})},AE.prototype.li=function(e,n){var r=this;return this._i(e,n).next(function(){return r.oi(e).next(function(t){return t.targetCount+=1,r.fi(n,t),r.hi(e,t)})})},AE.prototype.di=function(t,e){return this._i(t,e)},AE.prototype.wi=function(e,t){var n=this;return this.Ti(e,t.targetId).next(function(){return OE(e).delete(t.targetId)}).next(function(){return n.oi(e)}).next(function(t){return ag(0<t.targetCount),--t.targetCount,n.hi(e,t)})},AE.prototype.Ei=function(r,i,o){var s=this,a=0,u=[];return OE(r).Qs(function(t,e){var n=yE(e);n.sequenceNumber<=i&&null===o.get(n.targetId)&&(a++,u.push(s.wi(r,n)))}).next(function(){return D_.Sn(u)}).next(function(){return a})},AE.prototype.pe=function(t,r){return OE(t).Qs(function(t,e){var n=yE(e);r(n)})},AE.prototype.oi=function(t){return PE(t).get(pI.key).next(function(t){return ag(null!==t),t})},AE.prototype.hi=function(t,e){return PE(t).put(pI.key,e)},AE.prototype._i=function(t,e){return OE(t).put(gE(this.serializer,e))},AE.prototype.fi=function(t,e){var n=!1;return t.targetId>e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},AE.prototype.Ii=function(t){return this.oi(t).next(function(t){return t.targetCount})},AE.prototype.mi=function(t,i){var e=zg(i),n=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),o=null;return OE(t).Qs({range:n,index:lI.queryTargetsIndexName},function(t,e,n){var r=yE(e);Qg(i,r.target)&&(o=r,n.done())}).next(function(){return o})},AE.prototype.Ai=function(n,t,r){var i=this,o=[],s=RE(n);return t.forEach(function(t){var e=$_(t.path);o.push(s.put(new fI(r,e))),o.push(i.ii.Ri(n,r,t))}),D_.Sn(o)},AE.prototype.Pi=function(n,t,r){var i=this,o=RE(n);return D_.forEach(t,function(t){var e=$_(t.path);return D_.Sn([o.delete([r,e]),i.ii.gi(n,r,t)])})},AE.prototype.Ti=function(t,e){var n=RE(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},AE.prototype.Vi=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=RE(t),o=Im();return r.Qs({range:n,yi:!0},function(t,e,n){var r=tE(t[1]),i=new Dg(r);o=o.add(i)}).next(function(){return o})},AE.prototype.pi=function(t,e){var n=$_(e.path),r=IDBKeyRange.bound([n],[dg(n)],!1,!0),i=0;return RE(t).Qs({index:fI.documentTargetsIndex,yi:!0,range:r},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0<i})},AE.prototype.Me=function(t,e){return OE(t).get(e).next(function(t){return t?yE(t):null})},AE);function AE(t,e){this.ii=t,this.serializer=e}function kE(t){this.ei=t}function OE(t){return ME.Ns(t,lI.store)}function PE(t){return ME.Ns(t,pI.store)}function RE(t){return ME.Ns(t,fI.store)}var DE,xE="Failed to obtain exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `synchronizeTabs:true` in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",LE=(Es(UE,DE=M_),UE),ME=(FE.Ns=function(t,e){if(t instanceof LE)return bI.Ns(t.bi,e);throw sg()},FE.prototype.start=function(){var e=this;return bI.Ui(this.Li,JE,new ZE(this.serializer)).then(function(t){return e.Wi=t,e.Qi()}).then(function(){if(!e.isPrimary&&!e.allowTabSynchronization)throw new Cg(Sg.FAILED_PRECONDITION,xE);return e.ji(),e.Ki(),e.Gi(),e.runTransaction("getHighestListenSequenceNumber","readonly",function(t){return e.qi.ui(t)})}).then(function(t){e.Ci=new j_(t,e.Si)}).then(function(){e.Fi=!0}).catch(function(t){return e.Wi&&e.Wi.close(),Promise.reject(t)})},FE.prototype.zi=function(n){var t=this;return this.Mi=function(e){return Ts(t,void 0,void 0,function(){return Ss(this,function(t){return this.Hi?[2,n(e)]:[2]})})},n(this.isPrimary)},FE.prototype.Yi=function(n){var t=this;this.Wi.Ji(function(e){return Ts(t,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return null===e.newVersion?[4,n()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})},FE.prototype.Xi=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.Ts.Zi(function(){return Ts(e,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.Hi?[4,this.Qi()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},FE.prototype.Qi=function(){var n=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",function(e){return VE(e).put(new yI(n.clientId,Date.now(),n.networkEnabled,n.inForeground)).next(function(){if(n.isPrimary)return n.tr(e).next(function(t){t||(n.isPrimary=!1,n.Ts.er(function(){return n.Mi(!1)}))})}).next(function(){return n.nr(e)}).next(function(t){return n.isPrimary&&!t?n.sr(e).next(function(){return!1}):!!t&&n.ir(e).next(function(){return!0})})}).catch(function(t){if(SI(t))return rg("IndexedDbPersistence","Failed to extend owner lease: ",t),n.isPrimary;if(!n.allowTabSynchronization)throw t;return rg("IndexedDbPersistence","Releasing owner lease after error during lease refresh",t),!1}).then(function(t){n.isPrimary!==t&&n.Ts.er(function(){return n.Mi(t)}),n.isPrimary=t})},FE.prototype.tr=function(t){var e=this;return jE(t).get(eI.key).next(function(t){return D_.resolve(e.rr(t))})},FE.prototype.or=function(t){return VE(t).delete(this.clientId)},FE.prototype.hr=function(){return Ts(this,void 0,void 0,function(){var e,n,r,i,o=this;return Ss(this,function(t){switch(t.label){case 0:return!this.isPrimary||this.ar(this.xi,18e5)?[3,2]:(this.xi=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(t){var r=FE.Ns(t,yI.store);return r.$s().next(function(t){var e=o.ur(t,18e5),n=t.filter(function(t){return-1===e.indexOf(t)});return D_.forEach(n,function(t){return r.delete(t.clientId)}).next(function(){return n})})}).catch(function(){return[]})]);case 1:if(e=t.sent(),this.Bi)for(n=0,r=e;n<r.length;n++)i=r[n],this.Bi.removeItem(this.cr(i.clientId));t.label=2;case 2:return[2]}})})},FE.prototype.Gi=function(){var t=this;this.ki=this.Ts.bs("client_metadata_refresh",4e3,function(){return t.Qi().then(function(){return t.hr()}).then(function(){return t.Gi()})})},FE.prototype.rr=function(t){return!!t&&t.ownerId===this.clientId},FE.prototype.nr=function(e){var i=this;return this.Di?D_.resolve(!0):jE(e).get(eI.key).next(function(t){if(null!==t&&i.ar(t.leaseTimestampMs,5e3)&&!i.lr(t.ownerId)){if(i.rr(t)&&i.networkEnabled)return!0;if(!i.rr(t)){if(!t.allowTabSynchronization)throw new Cg(Sg.FAILED_PRECONDITION,xE);return!1}}return!(!i.networkEnabled||!i.inForeground)||VE(e).$s().next(function(t){return void 0===i.ur(t,5e3).find(function(t){if(i.clientId!==t.clientId){var e=!i.networkEnabled&&t.networkEnabled,n=!i.inForeground&&t.inForeground,r=i.networkEnabled===t.networkEnabled;if(e||n&&r)return!0}return!1})})}).next(function(t){return i.isPrimary!==t&&rg("IndexedDbPersistence","Client "+(t?"is":"is not")+" eligible for a primary lease."),t})},FE.prototype._r=function(){return Ts(this,void 0,void 0,function(){var e=this;return Ss(this,function(t){switch(t.label){case 0:return this.Fi=!1,this.dr(),this.ki&&(this.ki.cancel(),this.ki=null),this.wr(),this.Tr(),[4,this.runTransaction("shutdown","readwrite",function(t){return e.sr(t).next(function(){return e.or(t)})}).catch(function(t){rg("IndexedDbPersistence","Proceeding with shutdown despite failure: ",t)})];case 1:return t.sent(),this.Wi.close(),this.Er(),[2]}})})},FE.prototype.ur=function(t,e){var n=this;return t.filter(function(t){return n.ar(t.updateTimeMs,e)&&!n.lr(t.clientId)})},FE.prototype.Ir=function(){var e=this;return this.runTransaction("getActiveClients","readonly",function(t){return VE(t).$s().next(function(t){return e.ur(t,18e5).map(function(t){return t.clientId})})})},Object.defineProperty(FE.prototype,"Hi",{get:function(){return this.Fi},enumerable:!1,configurable:!0}),FE.prototype.mr=function(t){return KE.Ar(t,this.serializer,this.Kn,this.ii)},FE.prototype.Rr=function(){return this.qi},FE.prototype.Pr=function(){return this.Qn},FE.prototype.gr=function(){return this.Kn},FE.prototype.runTransaction=function(e,n,r){var i=this;rg("IndexedDbPersistence","Starting transaction:",e);var o,t="readonly"===n?"readonly":"readwrite";return this.Wi.runTransaction(t,mI,function(t){return o=new LE(t,i.Ci?i.Ci.next():j_.ws),"readwrite-primary"===n?i.tr(o).next(function(t){return!!t||i.nr(o)}).next(function(t){if(!t)throw ig("Failed to obtain primary lease for action '"+e+"'."),i.isPrimary=!1,i.Ts.er(function(){return i.Mi(!1)}),new Cg(Sg.FAILED_PRECONDITION,L_);return r(o)}).next(function(t){return i.ir(o).next(function(){return t})}):i.Vr(o).next(function(){return r(o)})}).then(function(t){return o.Wn(),t})},FE.prototype.Vr=function(t){var e=this;return jE(t).get(eI.key).next(function(t){if(null!==t&&e.ar(t.leaseTimestampMs,5e3)&&!e.lr(t.ownerId)&&!e.rr(t)&&!(e.Di||e.allowTabSynchronization&&t.allowTabSynchronization))throw new Cg(Sg.FAILED_PRECONDITION,xE)})},FE.prototype.ir=function(t){var e=new eI(this.clientId,this.allowTabSynchronization,Date.now());return jE(t).put(eI.key,e)},FE.Oi=function(){return bI.Oi()},FE.prototype.sr=function(t){var e=this,n=jE(t);return n.get(eI.key).next(function(t){return e.rr(t)?(rg("IndexedDbPersistence","Releasing primary lease."),n.delete(eI.key)):D_.resolve()})},FE.prototype.ar=function(t,e){var n=Date.now();return!(t<n-e||n<t&&(ig("Detected an update time that is in the future: "+t+" > "+n),1))},FE.prototype.ji=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.Ni=function(){t.Ts.Zi(function(){return t.inForeground="visible"===t.document.visibilityState,t.Qi()})},this.document.addEventListener("visibilitychange",this.Ni),this.inForeground="visible"===this.document.visibilityState)},FE.prototype.wr=function(){this.Ni&&(this.document.removeEventListener("visibilitychange",this.Ni),this.Ni=null)},FE.prototype.Ki=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.$i=function(){e.dr(),e.Ts.Zi(function(){return e._r()})},this.window.addEventListener("unload",this.$i))},FE.prototype.Tr=function(){this.$i&&(this.window.removeEventListener("unload",this.$i),this.$i=null)},FE.prototype.lr=function(t){var e;try{var n=null!==(null===(e=this.Bi)||void 0===e?void 0:e.getItem(this.cr(t)));return rg("IndexedDbPersistence","Client '"+t+"' "+(n?"is":"is not")+" zombied in LocalStorage"),n}catch(t){return ig("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},FE.prototype.dr=function(){if(this.Bi)try{this.Bi.setItem(this.cr(this.clientId),String(Date.now()))}catch(t){ig("Failed to set zombie client id.",t)}},FE.prototype.Er=function(){if(this.Bi)try{this.Bi.removeItem(this.cr(this.clientId))}catch(t){}},FE.prototype.cr=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},FE);function FE(t,e,n,r,i,o,s,a,u,c){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.Ts=i,this.window=o,this.document=s,this.Si=u,this.Di=c,this.Ci=null,this.Fi=!1,this.isPrimary=!1,this.networkEnabled=!0,this.$i=null,this.inForeground=!1,this.Ni=null,this.ki=null,this.xi=Number.NEGATIVE_INFINITY,this.Mi=function(t){return Promise.resolve()},!FE.Oi())throw new Cg(Sg.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.ii=new qE(this,r),this.Li=e+"main",this.serializer=new uE(a),this.qi=new NE(this.ii,this.serializer),this.Kn=new rE,this.Qn=new bE(this.serializer,this.Kn),this.window&&this.window.localStorage?this.Bi=this.window.localStorage:(this.Bi=null,!1===c&&ig("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}function UE(t,e){var n=this;return(n=DE.call(this)||this).bi=t,n.vi=e,n}function jE(t){return ME.Ns(t,eI.store)}function VE(t){return ME.Ns(t,yI.store)}var qE=(BE.prototype.pr=function(t){var n=this.br(t);return this.db.Rr().Ii(t).next(function(e){return n.next(function(t){return e+t})})},BE.prototype.br=function(t){var e=0;return this.vr(t,function(t){e++}).next(function(){return e})},BE.prototype.pe=function(t,e){return this.db.Rr().pe(t,e)},BE.prototype.vr=function(t,n){return this.Sr(t,function(t,e){return n(e)})},BE.prototype.Ri=function(t,e,n){return WE(t,n)},BE.prototype.gi=function(t,e,n){return WE(t,n)},BE.prototype.Ei=function(t,e,n){return this.db.Rr().Ei(t,e,n)},BE.prototype.Dr=function(t,e){return WE(t,e)},BE.prototype.Cr=function(t,e){return r=e,i=!1,$E(n=t).Fr(function(t){return zE(n,t,r).next(function(t){return t&&(i=!0),D_.resolve(!t)})}).next(function(){return i});var n,r,i},BE.prototype.$r=function(r,i){var o=this,s=this.db.Pr().Hs(),a=[],u=0;return this.Sr(r,function(e,t){if(t<=i){var n=o.Cr(r,e).next(function(t){if(!t)return u++,s.Mn(r,e).next(function(){return s.xn(e),RE(r).delete([0,$_(e.path)])})});a.push(n)}}).next(function(){return D_.Sn(a)}).next(function(){return s.apply(r)}).next(function(){return u})},BE.prototype.removeTarget=function(t,e){var n=e.Z(t.vi);return this.db.Rr().di(t,n)},BE.prototype.Nr=function(t,e){return WE(t,e)},BE.prototype.Sr=function(t,o){var s,e=RE(t),a=j_.ws;return e.Qs({index:fI.documentTargetsIndex},function(t,e){var n=t[0],r=(t[1],e.path),i=e.sequenceNumber;0===n?(a!==j_.ws&&o(new Dg(tE(s)),a),a=i,s=r):a=j_.ws}).next(function(){a!==j_.ws&&o(new Dg(tE(s)),a)})},BE.prototype.kr=function(t){return this.db.Pr().Xs(t)},BE);function BE(t,e){this.db=t,this.yr=new GI(this,e)}function WE(t,e){return RE(t).put((n=e,r=t.vi,new fI(0,$_(n.path),r)));var n,r}function HE(t,e){var n=t.projectId;return t.i||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}var KE=(GE.Ar=function(t,e,n,r){return ag(""!==t.uid),new GE(t.Mr()?t.uid:"",e,n,r)},GE.prototype.Or=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return XE(t).Qs({index:iI.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},GE.prototype.Lr=function(c,h,l,f){var p=this,d=YE(c),v=XE(c);return v.add({}).next(function(t){ag("number"==typeof t);for(var e=new P_(t,h,l,f),n=function(e,t,n){var r=n.baseMutations.map(function(t){return Nb(e.ks,t)}),i=n.mutations.map(function(t){return Nb(e.ks,t)});return new iI(t,n.batchId,n.dn.toMillis(),r,i)}(p.serializer,p.userId,e),r=[],i=new fm(function(t,e){return fg(t.$(),e.$())}),o=0,s=f;o<s.length;o++){var a=s[o],u=oI.key(p.userId,a.key.path,t);i=i.add(a.key.path.p()),r.push(v.put(n)),r.push(d.put(u,oI.PLACEHOLDER))}return i.forEach(function(t){r.push(p.Kn.Cs(c,t))}),c.Un(function(){p.xr[t]=e.keys()}),D_.Sn(r).next(function(){return e})})},GE.prototype.qr=function(t,e){var n=this;return XE(t).get(e).next(function(t){return t?(ag(t.userId===n.userId),vE(n.serializer,t)):null})},GE.prototype.Br=function(t,n){var r=this;return this.xr[n]?D_.resolve(this.xr[n]):this.qr(t,n).next(function(t){if(t){var e=t.keys();return r.xr[n]=e}return null})},GE.prototype.Ur=function(t,e){var r=this,i=e+1,n=IDBKeyRange.lowerBound([this.userId,i]),o=null;return XE(t).Qs({index:iI.userMutationsIndex,range:n},function(t,e,n){e.userId===r.userId&&(ag(e.batchId>=i),o=vE(r.serializer,e)),n.done()}).next(function(){return o})},GE.prototype.Wr=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return XE(t).Qs({index:iI.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},GE.prototype.Qr=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return XE(t).$s(iI.userMutationsIndex,n).next(function(t){return t.map(function(t){return vE(e.serializer,t)})})},GE.prototype.zn=function(a,u){var c=this,t=oI.prefixForPath(this.userId,u.path),e=IDBKeyRange.lowerBound(t),h=[];return YE(a).Qs({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=tE(i);if(r===c.userId&&u.path.isEqual(s))return XE(a).get(o).next(function(t){if(!t)throw sg();ag(t.userId===c.userId),h.push(vE(c.serializer,t))});n.done()}).next(function(){return h})},GE.prototype.Zn=function(r,t){var u=this,c=new fm(fg),i=[];return t.forEach(function(a){var t=oI.prefixForPath(u.userId,a.path),e=IDBKeyRange.lowerBound(t),n=YE(r).Qs({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=tE(i);r===u.userId&&a.path.isEqual(s)?c=c.add(o):n.done()});i.push(n)}),D_.Sn(i).next(function(){return u.jr(r,c)})},GE.prototype.os=function(t,e){var a=this,u=e.path,c=u.length+1,n=oI.prefixForPath(this.userId,u),r=IDBKeyRange.lowerBound(n),h=new fm(fg);return YE(t).Qs({range:r},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=tE(i);r===a.userId&&u.D(s)?s.length===c&&(h=h.add(o)):n.done()}).next(function(){return a.jr(t,h)})},GE.prototype.jr=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(XE(e).get(t).next(function(t){if(null===t)throw sg();ag(t.userId===n.userId),r.push(vE(n.serializer,t))}))}),D_.Sn(i).next(function(){return r})},GE.prototype.Kr=function(e,n){var r=this;return QE(e.bi,this.userId,n).next(function(t){return e.Un(function(){r.Gr(n.batchId)}),D_.forEach(t,function(t){return r.ii.Dr(e,t)})})},GE.prototype.Gr=function(t){delete this.xr[t]},GE.prototype.zr=function(n){var o=this;return this.Or(n).next(function(t){if(!t)return D_.resolve();var e=IDBKeyRange.lowerBound(oI.prefixForUser(o.userId)),i=[];return YE(n).Qs({range:e},function(t,e,n){if(t[0]===o.userId){var r=tE(t[1]);i.push(r)}else n.done()}).next(function(){ag(0===i.length)})})},GE.prototype.pi=function(t,e){return zE(t,this.userId,e)},GE.prototype.Hr=function(t){var e=this;return $E(t).get(this.userId).next(function(t){return t||new rI(e.userId,-1,"")})},GE);function GE(t,e,n,r){this.userId=t,this.serializer=e,this.Kn=n,this.ii=r,this.xr={}}function zE(t,o,e){var n=oI.prefixForPath(o,e.path),s=n[1],r=IDBKeyRange.lowerBound(n),a=!1;return YE(t).Qs({range:r,yi:!0},function(t,e,n){var r=t[0],i=t[1];t[2],r===o&&i===s&&(a=!0),n.done()}).next(function(){return a})}function QE(t,e,n){var r=t.store(iI.store),i=t.store(oI.store),o=[],s=IDBKeyRange.only(n.batchId),a=0,u=r.Qs({range:s},function(t,e,n){return a++,n.delete()});o.push(u.next(function(){ag(1===a)}));for(var c=[],h=0,l=n.mutations;h<l.length;h++){var f=l[h],p=oI.key(e,f.key.path,n.batchId);o.push(i.delete(p)),c.push(f.key)}return D_.Sn(o).next(function(){return c})}function XE(t){return ME.Ns(t,iI.store)}function YE(t){return ME.Ns(t,oI.store)}function $E(t){return ME.Ns(t,rI.store)}var JE=10,ZE=(nI.prototype.createOrUpgrade=function(n,r,t,e){var i=this;ag(t<e&&0<=t&&e<=JE);var o,s=new CI(r);t<1&&1<=e&&(n.createObjectStore(eI.store),(o=n).createObjectStore(rI.store,{keyPath:rI.keyPath}),o.createObjectStore(iI.store,{keyPath:iI.keyPath,autoIncrement:!0}).createIndex(iI.userMutationsIndex,iI.userMutationsKeyPath,{unique:!0}),o.createObjectStore(oI.store),vI(n),n.createObjectStore(cI.store));var a,u=D_.resolve();return t<3&&3<=e&&(0!==t&&((a=n).deleteObjectStore(fI.store),a.deleteObjectStore(lI.store),a.deleteObjectStore(pI.store),vI(n)),u=u.next(function(){return t=s.store(pI.store),e=new pI(0,0,Ag.min().A(),0),t.put(pI.key,e);var t,e})),t<4&&4<=e&&(0!==t&&(u=u.next(function(){return r=n,(i=s).store(iI.store).$s().next(function(t){r.deleteObjectStore(iI.store),r.createObjectStore(iI.store,{keyPath:iI.keyPath,autoIncrement:!0}).createIndex(iI.userMutationsIndex,iI.userMutationsKeyPath,{unique:!0});var e=i.store(iI.store),n=t.map(function(t){return e.put(t)});return D_.Sn(n)});var r,i})),u=u.next(function(){n.createObjectStore(yI.store,{keyPath:yI.keyPath})})),t<5&&5<=e&&(u=u.next(function(){return i.removeAcknowledgedMutations(s)})),t<6&&6<=e&&(u=u.next(function(){return n.createObjectStore(hI.store),i.addDocumentGlobal(s)})),t<7&&7<=e&&(u=u.next(function(){return i.ensureSequenceNumbers(s)})),t<8&&8<=e&&(u=u.next(function(){return i.createCollectionParentIndex(n,s)})),t<9&&9<=e&&(u=u.next(function(){var t,e;(e=n).objectStoreNames.contains("remoteDocumentChanges")&&e.deleteObjectStore("remoteDocumentChanges"),(t=r.objectStore(cI.store)).createIndex(cI.readTimeIndex,cI.readTimeIndexPath,{unique:!1}),t.createIndex(cI.collectionReadTimeIndex,cI.collectionReadTimeIndexPath,{unique:!1})})),t<10&&10<=e&&(u=u.next(function(){return i.rewriteCanonicalIds(s)})),u},nI.prototype.addDocumentGlobal=function(e){var n=0;return e.store(cI.store).Qs(function(t,e){n+=TE(e)}).next(function(){var t=new hI(n);return e.store(hI.store).put(hI.key,t)})},nI.prototype.removeAcknowledgedMutations=function(r){var i=this,t=r.store(rI.store),e=r.store(iI.store);return t.$s().next(function(t){return D_.forEach(t,function(n){var t=IDBKeyRange.bound([n.userId,-1],[n.userId,n.lastAcknowledgedBatchId]);return e.$s(iI.userMutationsIndex,t).next(function(t){return D_.forEach(t,function(t){ag(t.userId===n.userId);var e=vE(i.serializer,t);return QE(r,n.userId,e).next(function(){})})})})})},nI.prototype.ensureSequenceNumbers=function(t){var s=t.store(fI.store),e=t.store(cI.store);return t.store(pI.store).get(pI.key).next(function(i){var o=[];return e.Qs(function(t,e){var n=new Og(t),r=[0,$_(n)];o.push(s.get(r).next(function(t){return t?D_.resolve():(e=n,s.put(new fI(0,$_(e),i.highestListenSequenceNumber)));var e}))}).next(function(){return D_.Sn(o)})})},nI.prototype.createCollectionParentIndex=function(t,e){function i(t){if(o.add(t)){var e=t.S(),n=t.p();return r.put({collectionId:e,parent:$_(n)})}}t.createObjectStore(dI.store,{keyPath:dI.keyPath});var r=e.store(dI.store),o=new nE;return e.store(cI.store).Qs({yi:!0},function(t,e){var n=new Og(t);return i(n.p())}).next(function(){return e.store(oI.store).Qs({yi:!0},function(t,e){t[0];var n=t[1],r=(t[2],tE(n));return i(r.p())})})},nI.prototype.rewriteCanonicalIds=function(t){var i=this,o=t.store(lI.store);return o.Qs(function(t,e){var n=yE(e),r=gE(i.serializer,n);return o.put(r)})},nI),tI=function(t,e){this.seconds=t,this.nanoseconds=e},eI=function(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n};function nI(t){this.serializer=t}eI.store="owner",eI.key="owner";var rI=function(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n};rI.store="mutationQueues",rI.keyPath="userId";var iI=function(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i};iI.store="mutations",iI.keyPath="batchId",iI.userMutationsIndex="userMutationsIndex",iI.userMutationsKeyPath=["userId","batchId"];var oI=(sI.prefixForUser=function(t){return[t]},sI.prefixForPath=function(t,e){return[t,$_(e)]},sI.key=function(t,e,n){return[t,$_(e),n]},sI);function sI(){}oI.store="documentMutations",oI.PLACEHOLDER=new oI;var aI=function(t,e){this.path=t,this.readTime=e},uI=function(t,e){this.path=t,this.version=e},cI=function(t,e,n,r,i,o){this.unknownDocument=t,this.noDocument=e,this.document=n,this.hasCommittedMutations=r,this.readTime=i,this.parentPath=o};cI.store="remoteDocuments",cI.readTimeIndex="readTimeIndex",cI.readTimeIndexPath="readTime",cI.collectionReadTimeIndex="collectionReadTimeIndex",cI.collectionReadTimeIndexPath=["parentPath","readTime"];var hI=function(t){this.byteSize=t};hI.store="remoteDocumentGlobal",hI.key="remoteDocumentGlobalKey";var lI=function(t,e,n,r,i,o,s){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=o,this.query=s};lI.store="targets",lI.keyPath="targetId",lI.queryTargetsIndexName="queryTargetsIndex",lI.queryTargetsKeyPath=["canonicalId","targetId"];var fI=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};fI.store="targetDocuments",fI.keyPath=["targetId","path"],fI.documentTargetsIndex="documentTargetsIndex",fI.documentTargetsKeyPath=["path","targetId"];var pI=function(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r};pI.key="targetGlobalKey",pI.store="targetGlobal";var dI=function(t,e){this.collectionId=t,this.parent=e};function vI(t){t.createObjectStore(fI.store,{keyPath:fI.keyPath}).createIndex(fI.documentTargetsIndex,fI.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(lI.store,{keyPath:lI.keyPath}).createIndex(lI.queryTargetsIndexName,lI.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(pI.store)}dI.store="collectionParents",dI.keyPath=["collectionId","parent"];var yI=function(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r};yI.store="clientMetadata",yI.keyPath="clientId";var gI,mI=ks(ks(ks([rI.store,iI.store,oI.store,cI.store,lI.store,eI.store,pI.store,fI.store],[yI.store]),[hI.store]),[dI.store]),bI=(TI.Ui=function(o,t,s){return rg("SimpleDb","Opening database:",o),new D_(function(n,r){var i=indexedDB.open(o,t);i.onsuccess=function(t){var e=t.target.result;n(new TI(e))},i.onblocked=function(){r(new Cg(Sg.FAILED_PRECONDITION,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=function(t){var e=t.target.error;"VersionError"===e.name?r(new Cg(Sg.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.")):r(e)},i.onupgradeneeded=function(t){rg("SimpleDb",'Database "'+o+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;s.createOrUpgrade(e,i.transaction,t.oldVersion,JE).next(function(){rg("SimpleDb","Database upgrade to version "+JE+" complete")})}}).bn()},TI.delete=function(t){return rg("SimpleDb","Removing database:",t),OI(window.indexedDB.deleteDatabase(t)).bn()},TI.Oi=function(){if("undefined"==typeof indexedDB)return!1;if(TI.Jr())return!0;var t=Vs(),e=TI.Yr(t),n=0<e&&e<10,r=TI.Xr(t),i=0<r&&r<4.5;return!(0<t.indexOf("MSIE ")||0<t.indexOf("Trident/")||0<t.indexOf("Edge/")||n||i)},TI.Jr=function(){var t;return"undefined"!=typeof process&&"YES"===(null===(t=process.env)||void 0===t?void 0:t.Zr)},TI.Ns=function(t,e){return t.store(e)},TI.Yr=function(t){var e=t.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=e?e[1].split("_").slice(0,2).join("."):"-1";return Number(n)},TI.Xr=function(t){var e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)},TI.prototype.Ji=function(e){this.db.onversionchange=function(t){return e(t)}},TI.prototype.runTransaction=function(r,c,h){return Ts(this,void 0,void 0,function(){var s,a,e,u,n;return Ss(this,function(t){switch(t.label){case 0:s="readonly"===r,a=0,e=function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:++a,e=CI.open(u.db,s?"readonly":"readwrite",c),t.label=1;case 1:return t.trys.push([1,3,,4]),n=h(e).catch(function(t){return e.abort(t),D_.reject(t)}).bn(),r={},n.catch(function(){}),[4,e.to];case 2:return[2,(r.value=(t.sent(),n),r)];case 3:return i=t.sent(),o="FirebaseError"!==i.name&&a<3,rg("SimpleDb","Transaction failed with error: %s. Retrying: %s.",i.message,o),o?[3,4]:[2,{value:Promise.reject(i)}];case 4:return[2]}})},u=this,t.label=1;case 1:return[5,e()];case 2:if("object"==typeof(n=t.sent()))return[2,n.value];t.label=3;case 3:return[3,1];case 4:return[2]}})})},TI.prototype.close=function(){this.db.close()},TI),wI=(Object.defineProperty(II.prototype,"gn",{get:function(){return this.no},enumerable:!1,configurable:!0}),Object.defineProperty(II.prototype,"io",{get:function(){return this.so},enumerable:!1,configurable:!0}),Object.defineProperty(II.prototype,"cursor",{set:function(t){this.eo=t},enumerable:!1,configurable:!0}),II.prototype.done=function(){this.no=!0},II.prototype.js=function(t){this.so=t},II.prototype.delete=function(){return OI(this.eo.delete())},II),_I=(Es(EI,gI=Cg),EI);function EI(t){var e=this;return(e=gI.call(this,Sg.UNAVAILABLE,"IndexedDB transaction failed: "+t)||this).name="IndexedDbTransactionError",e}function II(t){this.eo=t,this.no=!1,this.so=null}function TI(t){this.db=t,12.2===TI.Yr(Vs())&&ig("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.")}function SI(t){return"IndexedDbTransactionError"===t.name}var CI=(kI.open=function(t,e,n){return new kI(t.transaction(n,e))},Object.defineProperty(kI.prototype,"to",{get:function(){return this.ro.promise},enumerable:!1,configurable:!0}),kI.prototype.abort=function(t){t&&this.ro.reject(t),this.aborted||(rg("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},kI.prototype.store=function(t){var e=this.transaction.objectStore(t);return new NI(e)},kI),NI=(AI.prototype.put=function(t,e){return OI(void 0!==e?(rg("SimpleDb","PUT",this.store.name,t,e),this.store.put(e,t)):(rg("SimpleDb","PUT",this.store.name,"<auto-key>",t),this.store.put(t)))},AI.prototype.add=function(t){return rg("SimpleDb","ADD",this.store.name,t,t),OI(this.store.add(t))},AI.prototype.get=function(e){var n=this;return OI(this.store.get(e)).next(function(t){return void 0===t&&(t=null),rg("SimpleDb","GET",n.store.name,e,t),t})},AI.prototype.delete=function(t){return rg("SimpleDb","DELETE",this.store.name,t),OI(this.store.delete(t))},AI.prototype.count=function(){return rg("SimpleDb","COUNT",this.store.name),OI(this.store.count())},AI.prototype.$s=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.oo(n,function(t,e){r.push(e)}).next(function(){return r})},AI.prototype.ho=function(t,e){rg("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.yi=!1;var r=this.cursor(n);return this.oo(r,function(t,e,n){return n.delete()})},AI.prototype.Qs=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.oo(r,e)},AI.prototype.Fr=function(i){var t=this.cursor({});return new D_(function(n,r){t.onerror=function(t){var e=RI(t.target.error);r(e)},t.onsuccess=function(t){var e=t.target.result;e?i(e.primaryKey,e.value).next(function(t){t?e.continue():n()}):n()}})},AI.prototype.oo=function(t,s){var a=[];return new D_(function(o,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e=t.target.result;if(e){var n=new wI(e),r=s(e.primaryKey,e.value,n);if(r instanceof D_){var i=r.catch(function(t){return n.done(),D_.reject(t)});a.push(i)}n.gn?o():null===n.io?e.continue():e.continue(n.io)}else o()}}).next(function(){return D_.Sn(a)})},AI.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},AI.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.yi?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},AI);function AI(t){this.store=t}function kI(t){var n=this;this.transaction=t,this.aborted=!1,this.ro=new Q_,this.transaction.oncomplete=function(){n.ro.resolve()},this.transaction.onabort=function(){t.error?n.ro.reject(new _I(t.error)):n.ro.resolve()},this.transaction.onerror=function(t){var e=RI(t.target.error);n.ro.reject(new _I(e))}}function OI(t){return new D_(function(n,r){t.onsuccess=function(t){var e=t.target.result;n(e)},t.onerror=function(t){var e=RI(t.target.error);r(e)}})}var PI=!1;function RI(t){var e=bI.Yr(Vs());if(12.2<=e&&e<13){var n="An internal error was encountered in the Indexed Database server";if(0<=t.message.indexOf(n)){var r=new Cg("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+n+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return PI||(PI=!0,setTimeout(function(){throw r},0)),r}}return t}function DI(){return"undefined"!=typeof window?window:null}var xI=(FI._o=function(t,e,n,r,i){var o=new FI(t,e,Date.now()+n,r,i);return o.start(n),o},FI.prototype.start=function(t){var e=this;this.fo=setTimeout(function(){return e.do()},t)},FI.prototype.Ss=function(){return this.do()},FI.prototype.cancel=function(t){null!==this.fo&&(this.clearTimeout(),this.lo.reject(new Cg(Sg.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},FI.prototype.do=function(){var e=this;this.ao.Zi(function(){return null!==e.fo?(e.clearTimeout(),e.op().then(function(t){return e.lo.resolve(t)})):Promise.resolve()})},FI.prototype.clearTimeout=function(){null!==this.fo&&(this.co(this),clearTimeout(this.fo),this.fo=null)},FI),LI=(Object.defineProperty(MI.prototype,"yo",{get:function(){return this.Eo},enumerable:!1,configurable:!0}),MI.prototype.Zi=function(t){this.enqueue(t)},MI.prototype.po=function(t){this.bo(),this.vo(t)},MI.prototype.So=function(t){return this.bo(),this.vo(t)},MI.prototype.Do=function(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.bo(),this.Eo?[3,2]:(this.Eo=!0,(e=DI())&&e.removeEventListener("visibilitychange",this.Vo),[4,this.So(n)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},MI.prototype.enqueue=function(t){return this.bo(),this.Eo?new Promise(function(t){}):this.vo(t)},MI.prototype.er=function(t){var e=this;this.To.push(t),this.Zi(function(){return e.Co()})},MI.prototype.Co=function(){return Ts(this,void 0,void 0,function(){var e,n=this;return Ss(this,function(t){switch(t.label){case 0:if(0===this.To.length)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.To[0]()];case 2:return t.sent(),this.To.shift(),this.Po.reset(),[3,4];case 3:if(!SI(e=t.sent()))throw e;return rg("AsyncQueue","Operation failed with retryable error: "+e),[3,4];case 4:0<this.To.length&&this.Po.ys(function(){return n.Co()}),t.label=5;case 5:return[2]}})})},MI.prototype.vo=function(t){var r=this,e=this.wo.then(function(){return r.Ao=!0,t().catch(function(t){throw r.mo=t,r.Ao=!1,ig("INTERNAL UNHANDLED ERROR: ",(n=(e=t).message||"",e.stack&&(n=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),n)),t;var e,n}).then(function(t){return r.Ao=!1,t})});return this.wo=e},MI.prototype.bs=function(t,e,n){var r=this;this.bo(),-1<this.Ro.indexOf(t)&&(e=0);var i=xI._o(this,t,e,n,function(t){return r.Fo(t)});return this.Io.push(i),i},MI.prototype.bo=function(){this.mo&&sg()},MI.prototype.$o=function(){},MI.prototype.No=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,e=this.wo];case 1:t.sent(),t.label=2;case 2:if(e!==this.wo)return[3,0];t.label=3;case 3:return[2]}})})},MI.prototype.ko=function(t){for(var e=0,n=this.Io;e<n.length;e++)if(n[e].Es===t)return!0;return!1},MI.prototype.xo=function(r){var i=this;return this.No().then(function(){i.Io.sort(function(t,e){return t.uo-e.uo});for(var t=0,e=i.Io;t<e.length;t++){var n=e[t];if(n.Ss(),"all"!==r&&n.Es===r)break}return i.No()})},MI.prototype.Mo=function(t){this.Ro.push(t)},MI.prototype.Fo=function(t){var e=this.Io.indexOf(t);this.Io.splice(e,1)},MI);function MI(){var t=this;this.wo=Promise.resolve(),this.To=[],this.Eo=!1,this.Io=[],this.mo=null,this.Ao=!1,this.Ro=[],this.Po=new X_(this,"async_queue_retry"),this.Vo=function(){return t.Po.vs()};var e=DI();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.Vo)}function FI(t,e,n,r,i){this.ao=t,this.Es=e,this.uo=n,this.op=r,this.co=i,this.lo=new Q_,this.then=this.lo.promise.then.bind(this.lo.promise),this.lo.promise.catch(function(t){})}function UI(t,e){if(ig("AsyncQueue",e+": "+t),SI(t))return new Cg(Sg.UNAVAILABLE,e+": "+t);throw t}function jI(t,e){var n=t[0],r=t[1],i=e[0],o=e[1],s=fg(n,i);return 0===s?fg(r,o):s}var VI=(HI.prototype.qo=function(){return++this.Lo},HI.prototype.Bo=function(t){var e=[t,this.qo()];if(this.buffer.size<this.Oo)this.buffer=this.buffer.add(e);else{var n=this.buffer.last();jI(e,n)<0&&(this.buffer=this.buffer.delete(n).add(e))}},Object.defineProperty(HI.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!1,configurable:!0}),HI),qI={Uo:!1,Wo:0,Qo:0,jo:0},BI=(WI.Ho=function(t){return new WI(t,WI.Yo,WI.Jo)},WI);function WI(t,e,n){this.Ko=t,this.Go=e,this.zo=n}function HI(t){this.Oo=t,this.buffer=new fm(jI),this.Lo=0}BI.Xo=-1,BI.Zo=1048576,BI.th=41943040,BI.Yo=10,BI.Jo=1e3,BI.eh=new BI(BI.th,BI.Yo,BI.Jo),BI.nh=new BI(BI.Xo,0,0);var KI=(YI.prototype.start=function(t){this.yr.params.Ko!==BI.Xo&&this.rh(t)},YI.prototype.stop=function(){this.ih&&(this.ih.cancel(),this.ih=null)},Object.defineProperty(YI.prototype,"Hi",{get:function(){return null!==this.ih},enumerable:!1,configurable:!0}),YI.prototype.rh=function(n){var t=this,e=this.sh?3e5:6e4;rg("LruGarbageCollector","Garbage collection scheduled in "+e+"ms"),this.ih=this.ao.bs("lru_garbage_collection",e,function(){return Ts(t,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:this.ih=null,this.sh=!0,t.label=1;case 1:return t.trys.push([1,3,,7]),[4,n.oh(this.yr)];case 2:return t.sent(),[3,7];case 3:return SI(e=t.sent())?(rg("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",e),[3,6]):[3,4];case 4:return[4,ZI(e)];case 5:t.sent(),t.label=6;case 6:return[3,7];case 7:return[4,this.rh(n)];case 8:return t.sent(),[2]}})})})},YI),GI=(XI.prototype.ah=function(t,e){return this.hh.pr(t).next(function(t){return Math.floor(e/100*t)})},XI.prototype.uh=function(t,e){var n=this;if(0===e)return D_.resolve(j_.ws);var r=new VI(e);return this.hh.pe(t,function(t){return r.Bo(t.sequenceNumber)}).next(function(){return n.hh.vr(t,function(t){return r.Bo(t)})}).next(function(){return r.maxValue})},XI.prototype.Ei=function(t,e,n){return this.hh.Ei(t,e,n)},XI.prototype.$r=function(t,e){return this.hh.$r(t,e)},XI.prototype.lh=function(e,n){var r=this;return this.params.Ko===BI.Xo?(rg("LruGarbageCollector","Garbage collection skipped; disabled"),D_.resolve(qI)):this.kr(e).next(function(t){return t<r.params.Ko?(rg("LruGarbageCollector","Garbage collection skipped; Cache size "+t+" is lower than threshold "+r.params.Ko),qI):r._h(e,n)})},XI.prototype.kr=function(t){return this.hh.kr(t)},XI.prototype._h=function(e,n){var r,i,o,s,a,u,c,h=this,l=Date.now();return this.ah(e,this.params.Go).next(function(t){return i=t>h.params.zo?(rg("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.zo+" from "+t),h.params.zo):t,s=Date.now(),h.uh(e,i)}).next(function(t){return r=t,a=Date.now(),h.Ei(e,r,n)}).next(function(t){return o=t,u=Date.now(),h.$r(e,r)}).next(function(t){return c=Date.now(),ng()<=Ca.DEBUG&&rg("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(s-l)+"ms\n\tDetermined least recently used "+i+" in "+(a-s)+"ms\n\tRemoved "+o+" targets in "+(u-a)+"ms\n\tRemoved "+t+" documents in "+(c-u)+"ms\nTotal Duration: "+(c-l)+"ms"),D_.resolve({Uo:!0,Wo:i,Qo:o,jo:t})})},XI),zI=(QI.prototype.Ah=function(i){return Ts(this,void 0,void 0,function(){var e,m,n,r=this;return Ss(this,function(t){switch(t.label){case 0:return e=this.jn,m=this.Ih,[4,this.persistence.runTransaction("Handle user change","readonly",function(y){var g;return r.jn.Qr(y).next(function(t){return g=t,e=r.persistence.mr(i),m=new F_(r.Eh,e,r.persistence.gr()),e.Qr(y)}).next(function(t){for(var e=[],n=[],r=Im(),i=0,o=g;i<o.length;i++){var s=o[i];e.push(s.batchId);for(var a=0,u=s.mutations;a<u.length;a++){var c=u[a];r=r.add(c.key)}}for(var h=0,l=t;h<l.length;h++){var f=l[h];n.push(f.batchId);for(var p=0,d=f.mutations;p<d.length;p++){var v=d[p];r=r.add(v.key)}}return m.Jn(y,r).next(function(t){return{Rh:t,Ph:e,gh:n}})})})];case 1:return n=t.sent(),[2,(this.jn=e,this.Ih=m,this.fh.mh(this.Ih),n)]}})})},QI.prototype.Vh=function(c){var h,l=this,f=Ng.now(),t=c.reduce(function(t,e){return t.add(e.key)},Im());return this.persistence.runTransaction("Locally write mutations","readwrite",function(u){return l.Ih.Jn(u,t).next(function(t){h=t;for(var e=[],n=0,r=c;n<r.length;n++){var i=r[n],o=(a=i,s=h.get(i.key),a instanceof ww?function(t){for(var e=null,n=0,r=a.fieldTransforms;n<r.length;n++){var i=r[n],o=t instanceof jw?t.field(i.field):void 0,s=Fb(i.transform,o||null);null!=s&&(e=null==e?(new kw).set(i.field,s):e.set(i.field,s))}return e?e.Ge():null}(s):null);null!=o&&e.push(new vw(i.key,o,xw(o.proto.mapValue),iw.exists(!0)))}var a,s;return l.jn.Lr(u,f,e,c)})}).then(function(t){var e=t.In(h);return{batchId:t.batchId,Cn:e}})},QI.prototype.yh=function(r){var i=this;return this.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(t){var e=r.batch.keys(),n=i.Eh.Hs({Js:!0});return i.ph(t,r,n).next(function(){return n.apply(t)}).next(function(){return i.jn.zr(t)}).next(function(){return i.Ih.Jn(t,e)})})},QI.prototype.bh=function(t){var r=this;return this.persistence.runTransaction("Reject batch","readwrite-primary",function(e){var n;return r.jn.qr(e,t).next(function(t){return ag(null!==t),n=t.keys(),r.jn.Kr(e,t)}).next(function(){return r.jn.zr(e)}).next(function(){return r.Ih.Jn(e,n)})})},QI.prototype.Wr=function(){var e=this;return this.persistence.runTransaction("Get highest unacknowledged batch id","readonly",function(t){return e.jn.Wr(t)})},QI.prototype.ai=function(){var e=this;return this.persistence.runTransaction("Get last remote snapshot version","readonly",function(t){return e.qi.ai(t)})},QI.prototype.vh=function(u){var c=this,h=u.X,l=this.dh;return this.persistence.runTransaction("Apply remote event","readwrite-primary",function(o){var i=c.Eh.Hs({Js:!0});l=c.dh;var s=[];u.Wt.forEach(function(t,e){var n=l.get(e);if(n){s.push(c.qi.Pi(o,t.Xt,e).next(function(){return c.qi.Ai(o,t.Yt,e)}));var r=t.resumeToken;if(0<r.H()){var i=n.tt(r,h).Z(o.vi);l=l.nt(e,i),QI.Sh(n,i,t)&&s.push(c.qi.di(o,i))}}});var a=gm(),n=Im();if(u.jt.forEach(function(t,e){n=n.add(t)}),s.push(i.getEntries(o,n).next(function(r){u.jt.forEach(function(t,e){var n=r.get(t);e instanceof Vw&&e.version.isEqual(Ag.min())?(i.xn(t,h),a=a.nt(t,e)):null==n||0<e.version.o(n.version)||0===e.version.o(n.version)&&n.hasPendingWrites?(i.Nn(e,h),a=a.nt(t,e)):rg("LocalStore","Ignoring outdated watch update for ",t,". Current version:",n.version," Watch version:",e.version),u.Kt.has(t)&&s.push(c.persistence.ii.Nr(o,t))})})),!h.isEqual(Ag.min())){var t=c.qi.ai(o).next(function(t){return c.qi.ci(o,o.vi,h)});s.push(t)}return D_.Sn(s).next(function(){return i.apply(o)}).next(function(){return c.Ih.Xn(o,a)})}).then(function(t){return c.dh=l,t})},QI.Sh=function(t,e,n){return ag(0<e.resumeToken.H()),0===t.resumeToken.H()||e.X.m()-t.X.m()>=this.Dh||0<n.Yt.size+n.Jt.size+n.Xt.size},QI.prototype.Ch=function(h){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c=this;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(n){return D_.forEach(h,function(e){return D_.forEach(e.as,function(t){return c.persistence.ii.Ri(n,e.targetId,t)}).next(function(){return D_.forEach(e.us,function(t){return c.persistence.ii.gi(n,e.targetId,t)})})})})];case 1:return t.sent(),[3,3];case 2:if(!SI(e=t.sent()))throw e;return rg("LocalStore","Failed to update sequence numbers: "+e),[3,3];case 3:for(n=0,r=h;n<r.length;n++)i=r[n],o=i.targetId,i.fromCache||(s=this.dh.get(o),a=s.X,u=s.et(a),this.dh=this.dh.nt(o,u));return[2]}})})},QI.prototype.Fh=function(e){var n=this;return this.persistence.runTransaction("Get next mutation batch","readonly",function(t){return void 0===e&&(e=-1),n.jn.Ur(t,e)})},QI.prototype.$h=function(e){var n=this;return this.persistence.runTransaction("read document","readonly",function(t){return n.Ih.Gn(t,e)})},QI.prototype.Nh=function(r){var i=this;return this.persistence.runTransaction("Allocate target","readwrite",function(e){var n;return i.qi.mi(e,r).next(function(t){return t?(n=t,D_.resolve(n)):i.qi.ri(e).next(function(t){return n=new em(r,t,0,e.vi),i.qi.li(e,n).next(function(){return n})})})}).then(function(t){var e=i.dh.get(t.targetId);return(null===e||0<t.X.o(e.X))&&(i.dh=i.dh.nt(t.targetId,t),i.wh.set(r,t.targetId)),t})},QI.prototype.mi=function(t,e){var n=this.wh.get(e);return void 0!==n?D_.resolve(this.dh.get(n)):this.qi.mi(t,e)},QI.prototype.kh=function(o,s){return Ts(this,void 0,void 0,function(){var e,n,r,i=this;return Ss(this,function(t){switch(t.label){case 0:e=this.dh.get(o),n=s?"readwrite":"readwrite-primary",t.label=1;case 1:return t.trys.push([1,4,,5]),s?[3,3]:[4,this.persistence.runTransaction("Release target",n,function(t){return i.persistence.ii.removeTarget(t,e)})];case 2:t.sent(),t.label=3;case 3:return[3,5];case 4:if(!SI(r=t.sent()))throw r;return rg("LocalStore","Failed to update sequence numbers for target "+o+": "+r),[3,5];case 5:return this.dh=this.dh.remove(o),this.wh.delete(e.target),[2]}})})},QI.prototype.xh=function(t,n){var r=this,i=Ag.min(),o=Im();return this.persistence.runTransaction("Execute query","readonly",function(e){return r.mi(e,Jw(t)).next(function(t){if(t)return i=t.lastLimboFreeSnapshotVersion,r.qi.Vi(e,t.targetId).next(function(t){o=t})}).next(function(){return r.fh.ts(e,t,n?i:Ag.min(),n?o:Im())}).next(function(t){return{documents:t,Mh:o}})})},QI.prototype.ph=function(t,i,o){var e=this,s=i.batch,n=s.keys(),a=D_.resolve();return n.forEach(function(r){a=a.next(function(){return o.Mn(t,r)}).next(function(t){var e=t,n=i.An.get(r);ag(null!==n),(!e||e.version.o(n)<0)&&(e=s.wn(r,e,i))&&o.Nn(e,i.mn)})}),a.next(function(){return e.jn.Kr(t,s)})},QI.prototype.oh=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(t){return e.lh(t,n.dh)})},QI);function QI(t,e,n){this.persistence=t,this.fh=e,this.dh=new om(fg),this.wh=new Tg(function(t){return zg(t)},Qg),this.Th=Ag.min(),this.jn=t.mr(n),this.Eh=t.Pr(),this.qi=t.Rr(),this.Ih=new F_(this.Eh,this.jn,this.persistence.gr()),this.fh.mh(this.Ih)}function XI(t,e){this.hh=t,this.params=e}function YI(t,e){this.yr=t,this.ao=e,this.sh=!1,this.ih=null}function $I(t,e,n){return new zI(t,e,n)}function JI(t,e){var n=ug(t),r=ug(n.qi),i=n.dh.get(e);return i?Promise.resolve(i.target):n.persistence.runTransaction("Get target data","readonly",function(t){return r.Me(t,e).next(function(t){return t?t.target:null})})}function ZI(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){if(e.code!==Sg.FAILED_PRECONDITION||e.message!==L_)throw e;return rg("LocalStore","Unexpectedly lost primary lease"),[2]})})}zI.Dh=3e8;var tT=(rT.prototype._=function(){return this.Oh._()},rT.prototype.Ri=function(t,e){var n=new eT(t,e);this.Oh=this.Oh.add(n),this.qh=this.qh.add(n)},rT.prototype.Uh=function(t,e){var n=this;t.forEach(function(t){return n.Ri(t,e)})},rT.prototype.gi=function(t,e){this.Wh(new eT(t,e))},rT.prototype.Qh=function(t,e){var n=this;t.forEach(function(t){return n.gi(t,e)})},rT.prototype.jh=function(t){var e=this,n=new Dg(new Og([])),r=new eT(n,t),i=new eT(n,t+1),o=[];return this.qh.vt([r,i],function(t){e.Wh(t),o.push(t.key)}),o},rT.prototype.Kh=function(){var e=this;this.Oh.forEach(function(t){return e.Wh(t)})},rT.prototype.Wh=function(t){this.Oh=this.Oh.delete(t),this.qh=this.qh.delete(t)},rT.prototype.Gh=function(t){var e=new Dg(new Og([])),n=new eT(e,t),r=new eT(e,t+1),i=Im();return this.qh.vt([n,r],function(t){i=i.add(t.key)}),i},rT.prototype.pi=function(t){var e=new eT(t,0),n=this.Oh.Dt(e);return null!==n&&t.isEqual(n.key)},rT),eT=(nT.Lh=function(t,e){return Dg.P(t.key,e.key)||fg(t.zh,e.zh)},nT.Bh=function(t,e){return fg(t.zh,e.zh)||Dg.P(t.key,e.key)},nT);function nT(t,e){this.key=t,this.zh=e}function rT(){this.Oh=new fm(eT.Lh),this.qh=new fm(eT.Bh)}function iT(t,e){if(0!==e.length)throw new Cg(Sg.INVALID_ARGUMENT,"Function "+t+"() does not support arguments, but was called with "+ET(e.length,"argument")+".")}function oT(t,e,n){if(e.length!==n)throw new Cg(Sg.INVALID_ARGUMENT,"Function "+t+"() requires "+ET(n,"argument")+", but was called with "+ET(e.length,"argument")+".")}function sT(t,e,n){if(e.length<n)throw new Cg(Sg.INVALID_ARGUMENT,"Function "+t+"() requires at least "+ET(n,"argument")+", but was called with "+ET(e.length,"argument")+".")}function aT(t,e,n,r){if(e.length<n||e.length>r)throw new Cg(Sg.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+ET(e.length,"argument")+".")}function uT(t,e,n,r){dT(t,e,_T(n)+" argument",r)}function cT(t,e,n,r){void 0!==r&&uT(t,e,n,r)}function hT(t,e,n,r){dT(t,e,n+" option",r)}function lT(t,e,n,r){void 0!==r&&hT(t,e,n,r)}function fT(t,e,n,r,u){void 0!==r&&function(t,e,n){for(var r=[],i=0,o=u;i<o.length;i++){var s=o[i];if(s===n)return;r.push(yT(s))}var a=yT(n);throw new Cg(Sg.INVALID_ARGUMENT,"Invalid value "+a+" provided to function "+t+'() for option "'+e+'". Acceptable values: '+r.join(", "))}(t,n,r)}function pT(t,e,n,r){if(!e.some(function(t){return t===r}))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid value "+yT(r)+" provided to function "+t+"() for its "+_T(n)+" argument. Acceptable values: "+e.join(", "));return r}function dT(t,e,n,r){if(!("object"===e?vT(r):"non-empty string"===e?"string"==typeof r&&""!==r:typeof r===e)){var i=yT(r);throw new Cg(Sg.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" to be of type "+e+", but it was: "+i)}}function vT(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function yT(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return 20<e.length&&(e=e.substring(0,20)+"..."),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"!=typeof e)return"function"==typeof e?"a function":sg();if(e instanceof Array)return"an array";var t=function(){if(e.constructor){var t=/function\s+([^\s(]+)\s*\(/.exec(e.constructor.toString());if(t&&1<t.length)return t[1]}return null}();return t?"a custom "+t+" object":"an object"}function gT(t,e,n){if(void 0===n)throw new Cg(Sg.INVALID_ARGUMENT,"Function "+t+"() requires a valid "+_T(e)+" argument, but it was undefined.")}function mT(n,t,r){bg(t,function(t,e){if(r.indexOf(t)<0)throw new Cg(Sg.INVALID_ARGUMENT,"Unknown option '"+t+"' passed to function "+n+"(). Available options: "+r.join(", "))})}function bT(t,e,n,r){var i=yT(r);return new Cg(Sg.INVALID_ARGUMENT,"Function "+t+"() requires its "+_T(n)+" argument to be a "+e+", but it was: "+i)}function wT(t,e,n){if(n<=0)throw new Cg(Sg.INVALID_ARGUMENT,"Function "+t+"() requires its "+_T(e)+" argument to be a positive number, but it was: "+n+".")}function _T(t){switch(t){case 1:return"first";case 2:return"second";case 3:return"third";default:return t+"th"}}function ET(t,e){return t+" "+e+(1===t?"":"s")}function IT(){if("undefined"==typeof Uint8Array)throw new Cg(Sg.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function TT(){if("undefined"==typeof atob)throw new Cg(Sg.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var ST,CT,NT=(LT.fromBase64String=function(t){oT("Blob.fromBase64String",arguments,1),uT("Blob.fromBase64String","string",1,t),TT();try{return new LT(Yg.fromBase64String(t))}catch(t){throw new Cg(Sg.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+t)}},LT.fromUint8Array=function(t){if(oT("Blob.fromUint8Array",arguments,1),IT(),!(t instanceof Uint8Array))throw bT("Blob.fromUint8Array","Uint8Array",1,t);return new LT(Yg.fromUint8Array(t))},LT.prototype.toBase64=function(){return oT("Blob.toBase64",arguments,0),TT(),this.Hh.toBase64()},LT.prototype.toUint8Array=function(){return oT("Blob.toUint8Array",arguments,0),IT(),this.Hh.toUint8Array()},LT.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},LT.prototype.isEqual=function(t){return this.Hh.isEqual(t.Hh)},LT),AT=function(t){!function(){if(!(t instanceof Array)||t.length<1)throw new Cg(Sg.INVALID_ARGUMENT,"Function FieldPath() requires its fieldNames argument to be an array with at least 1 element.")}();for(var e=0;e<t.length;++e)if(uT("FieldPath","string",e,t[e]),0===t[e].length)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.Yh=new Rg(t)},kT=(Es(xT,CT=AT),xT.documentId=function(){return new xT(Rg.L().$())},xT.prototype.isEqual=function(t){if(!(t instanceof xT))throw bT("isEqual","FieldPath",1,t);return this.Yh.isEqual(t.Yh)},xT),OT=new RegExp("[~\\*/\\[\\]]"),PT=function(){this.Jh=this},RT=(Es(DT,ST=PT),DT.prototype.Zh=function(t){if(2!==t.ta)throw 1===t.ta?t.ea(this.Xh+"() can only appear at the top level of your update data"):t.ea(this.Xh+"() cannot be used with set() unless you pass {merge:true}");return t.Le.push(t.path),null},DT.prototype.isEqual=function(t){return t instanceof DT},DT);function DT(t){var e=this;return(e=ST.call(this)||this).Xh=t,e}function xT(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return CT.call(this,t)||this}function LT(t){TT(),this.Hh=t}function MT(t,e,n){return new lS({ta:3,na:e.settings.na,methodName:t.Xh,sa:n},e.s,e.serializer,e.ignoreUndefinedProperties)}var FT,UT,jT,VT,qT,BT,WT=(Es(nS,BT=PT),nS.prototype.Zh=function(t){return new ew(t.path,new Vb)},nS.prototype.isEqual=function(t){return t instanceof nS},nS),HT=(Es(eS,qT=PT),eS.prototype.Zh=function(t){var e=MT(this,t,!0),n=this.ia.map(function(t){return bS(t,e)}),r=new qb(n);return new ew(t.path,r)},eS.prototype.isEqual=function(t){return this===t},eS),KT=(Es(tS,VT=PT),tS.prototype.Zh=function(t){var e=MT(this,t,!0),n=this.ia.map(function(t){return bS(t,e)}),r=new Gb(n);return new ew(t.path,r)},tS.prototype.isEqual=function(t){return this===t},tS),GT=(Es(ZT,jT=PT),ZT.prototype.Zh=function(t){var e=new Yb(t.serializer,db(t.serializer,this.ra));return new ew(t.path,e)},ZT.prototype.isEqual=function(t){return this===t},ZT),zT=(Es(JT,UT=PT),JT.delete=function(){return iT("FieldValue.delete",arguments),new QT(new RT("FieldValue.delete"))},JT.serverTimestamp=function(){return iT("FieldValue.serverTimestamp",arguments),new QT(new WT("FieldValue.serverTimestamp"))},JT.arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return sT("FieldValue.arrayUnion",arguments,1),new QT(new HT("FieldValue.arrayUnion",t))},JT.arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return sT("FieldValue.arrayRemove",arguments,1),new QT(new KT("FieldValue.arrayRemove",t))},JT.increment=function(t){return uT("FieldValue.increment","number",1,t),oT("FieldValue.increment",arguments,1),new QT(new GT("FieldValue.increment",t))},JT),QT=(Es($T,FT=zT),$T.prototype.Zh=function(t){return this.Jh.Zh(t)},$T.prototype.isEqual=function(t){return t instanceof $T&&this.Jh.isEqual(t.Jh)},$T),XT=(Object.defineProperty(YT.prototype,"latitude",{get:function(){return this.oa},enumerable:!1,configurable:!0}),Object.defineProperty(YT.prototype,"longitude",{get:function(){return this.ha},enumerable:!1,configurable:!0}),YT.prototype.isEqual=function(t){return this.oa===t.oa&&this.ha===t.ha},YT.prototype.T=function(t){return fg(this.oa,t.oa)||fg(this.ha,t.ha)},YT);function YT(t,e){if(oT("GeoPoint",arguments,2),uT("GeoPoint","number",1,t),uT("GeoPoint","number",2,e),!isFinite(t)||t<-90||90<t)throw new Cg(Sg.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||180<e)throw new Cg(Sg.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.oa=t,this.ha=e}function $T(t){var e=this;return(e=FT.call(this)||this).Jh=t,e.Xh=t.Xh,e}function JT(){return UT.call(this)||this}function ZT(t,e){var n=this;return(n=jT.call(this)||this).Xh=t,n.ra=e,n}function tS(t,e){var n=this;return(n=VT.call(this)||this).Xh=t,n.ia=e,n}function eS(t,e){var n=this;return(n=qT.call(this)||this).Xh=t,n.ia=e,n}function nS(t){var e=this;return(e=BT.call(this)||this).Xh=t,e}function rS(t){return new lb(t,!0)}var iS=/^__.*__$/,oS=function(t,e,n){this.aa=t,this.ua=e,this.ca=n},sS=(cS.prototype.la=function(t,e){var n=[];return null!==this.Le?n.push(new vw(t,this.data,this.Le,e)):n.push(new dw(t,this.data,e)),0<this.fieldTransforms.length&&n.push(new ww(t,this.fieldTransforms)),n},cS),aS=(uS.prototype.la=function(t,e){var n=[new vw(t,this.data,this.Le,e)];return 0<this.fieldTransforms.length&&n.push(new ww(t,this.fieldTransforms)),n},uS);function uS(t,e,n){this.data=t,this.Le=e,this.fieldTransforms=n}function cS(t,e,n){this.data=t,this.Le=e,this.fieldTransforms=n}function hS(t){switch(t){case 0:case 2:case 1:return 1;case 3:case 4:return;default:throw sg()}}var lS=(Object.defineProperty(dS.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(dS.prototype,"ta",{get:function(){return this.settings.ta},enumerable:!1,configurable:!0}),dS.prototype.fa=function(t){return new dS(Object.assign(Object.assign({},this.settings),t),this.s,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.Le)},dS.prototype.da=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.fa({path:n,sa:!1});return r.wa(t),r},dS.prototype.Ta=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.fa({path:n,sa:!1});return r._a(),r},dS.prototype.Ea=function(t){return this.fa({path:void 0,sa:!0})},dS.prototype.ea=function(t){return SS(t,this.settings.methodName,this.settings.Ia||!1,this.path,this.settings.na)},dS.prototype.contains=function(e){return void 0!==this.Le.find(function(t){return e.D(t)})||void 0!==this.fieldTransforms.find(function(t){return e.D(t.field)})},dS.prototype._a=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.wa(this.path.get(t))},dS.prototype.wa=function(t){if(0===t.length)throw this.ea("Document fields must not be empty");if(hS(this.ta)&&iS.test(t))throw this.ea('Document fields cannot begin and end with "__"')},dS),fS=(pS.prototype.ma=function(t,e,n,r){return void 0===r&&(r=!1),new lS({ta:t,methodName:e,na:n,path:Rg.k(),sa:!1,Ia:r},this.s,this.serializer,this.ignoreUndefinedProperties)},pS);function pS(t,e,n){this.s=t,this.ignoreUndefinedProperties=e,this.serializer=n||rS(t)}function dS(t,e,n,r,i,o){this.settings=t,this.s=e,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this._a(),this.fieldTransforms=i||[],this.Le=o||[]}function vS(t,e,n,r,i,o){void 0===o&&(o={});var s=t.ma(o.merge||o.mergeFields?2:0,e,n,i);ES("Data must be an object, but it was:",s,r);var a,u,c=wS(r,s);if(o.merge)a=new tw(s.Le),u=s.fieldTransforms;else if(o.mergeFields){for(var h=[],l=0,f=o.mergeFields;l<f.length;l++){var p=f[l],d=void 0;if(p instanceof AT)d=p.Yh;else{if("string"!=typeof p)throw sg();d=TS(e,p,n)}if(!s.contains(d))throw new Cg(Sg.INVALID_ARGUMENT,"Field '"+d+"' is specified in your field mask but missing from your input data.");CS(h,d)||h.push(d)}a=new tw(h),u=s.fieldTransforms.filter(function(t){return a.je(t.field)})}else a=null,u=s.fieldTransforms;return new sS(new Aw(c),a,u)}function yS(t,o,s,e){var a=t.ma(1,o,s);ES("Data must be an object, but it was:",a,e);var u=[],c=new kw;bg(e,function(t,e){var n=TS(o,t,s),r=a.Ta(n);if(e instanceof PT&&e.Jh instanceof RT)u.push(n);else{var i=bS(e,r);null!=i&&(u.push(n),c.set(n,i))}});var n=new tw(u);return new aS(c.Ge(),n,a.fieldTransforms)}function gS(t,e,n,r,i,o){var s=t.ma(1,e,n),a=[IS(e,r,n)],u=[i];if(o.length%2!=0)throw new Cg(Sg.INVALID_ARGUMENT,"Function "+e+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var c=0;c<o.length;c+=2)a.push(IS(e,o[c])),u.push(o[c+1]);for(var h=[],l=new kw,f=a.length-1;0<=f;--f)if(!CS(h,a[f])){var p=a[f],d=u[f],v=s.Ta(p);if(d instanceof PT&&d.Jh instanceof RT)h.push(p);else{var y=bS(d,v);null!=y&&(h.push(p),l.set(p,y))}}var g=new tw(h);return new aS(l.Ge(),g,s.fieldTransforms)}function mS(t,e,n,r){return void 0===r&&(r=!1),bS(n,t.ma(r?4:3,e))}function bS(s,t){if(_S(s))return ES("Unsupported field value:",t,s),wS(s,t);if(s instanceof PT)return function(t,e){if(!hS(e.ta))throw e.ea(t.Xh+"() can only be used with update() and set()");if(!e.path)throw e.ea(t.Xh+"() is not currently supported inside arrays");var n=t.Zh(e);n&&e.fieldTransforms.push(n)}(s,t),null;if(t.path&&t.Le.push(t.path),s instanceof Array){if(t.settings.sa&&4!==t.ta)throw t.ea("Nested arrays are not supported");return function(t){for(var e=[],n=0,r=0,i=s;r<i.length;r++){var o=bS(i[r],t.Ea(n));null==o&&(o={nullValue:"NULL_VALUE"}),e.push(o),n++}return{arrayValue:{values:e}}}(t)}return function(t,e){if(null===t)return{nullValue:"NULL_VALUE"};if("number"==typeof t)return db(e.serializer,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=Ng.fromDate(t);return{timestampValue:vb(e.serializer,n)}}if(t instanceof Ng){var r=new Ng(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:vb(e.serializer,r)}}if(t instanceof XT)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof NT)return{bytesValue:yb(e.serializer,t)};if(t instanceof oS){var i=e.s,o=t.aa;if(!o.isEqual(i))throw e.ea("Document reference is for database "+o.projectId+"/"+o.database+" but should be for database "+i.projectId+"/"+i.database);return{referenceValue:mb(t.aa||e.s,t.ua.path)}}if(void 0===t&&e.ignoreUndefinedProperties)return null;throw e.ea("Unsupported field value: "+yT(t))}(s,t)}function wS(t,r){var i={};return wg(t)?r.path&&0<r.path.length&&r.Le.push(r.path):bg(t,function(t,e){var n=bS(e,r.da(t));null!=n&&(i[t]=n)}),{mapValue:{fields:i}}}function _S(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ng||t instanceof XT||t instanceof NT||t instanceof oS||t instanceof PT)}function ES(t,e,n){if(!_S(n)||!vT(n)){var r=yT(n);throw"an object"===r?e.ea(t+" a custom object"):e.ea(t+" "+r)}}function IS(t,e,n){if(e instanceof AT)return e.Yh;if("string"==typeof e)return TS(t,e);throw SS("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}function TS(t,e,n){try{return function(e){if(0<=e.search(OT))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(kT.bind.apply(kT,ks([void 0],e.split("."))))}catch(t){throw new Cg(Sg.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(e).Yh}catch(e){throw SS(e instanceof Error?e.message:e.toString(),t,!1,void 0,n)}}function SS(t,e,n,r,i){var o=r&&!r._(),s=void 0!==i,a="Function "+e+"() called with invalid data";n&&(a+=" (via `toFirestore()`)");var u="";return(o||s)&&(u+=" (found",o&&(u+=" in field "+r),s&&(u+=" in document "+i),u+=")"),new Cg(Sg.INVALID_ARGUMENT,(a+=". ")+t+u)}function CS(t,e){return t.some(function(t){return t.isEqual(e)})}var NS=(AS.prototype.Mr=function(){return null!=this.uid},AS.prototype.Aa=function(){return this.Mr()?"uid:"+this.uid:"anonymous-user"},AS.prototype.isEqual=function(t){return t.uid===this.uid},AS);function AS(t){this.uid=t}NS.UNAUTHENTICATED=new NS(null),NS.Ra=new NS("google-credentials-uid"),NS.Pa=new NS("first-party-uid");function kS(t,e){this.user=e,this.type="OAuth",this.ga={},this.ga.Authorization="Bearer "+t}var OS,PS,RS,DS=(tC.prototype.getToken=function(){return Promise.resolve(null)},tC.prototype.ya=function(){},tC.prototype.pa=function(t){(this.Va=t)(NS.UNAUTHENTICATED)},tC.prototype.ba=function(){this.Va=null},tC),xS=(ZS.prototype.getToken=function(){var e=this,n=this.Da,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(function(t){return e.Da!==n?(rg("FirebaseCredentialsProvider","getToken aborted due to token change."),e.getToken()):t?(ag("string"==typeof t.accessToken),new kS(t.accessToken,e.currentUser)):null}):Promise.resolve(null)},ZS.prototype.ya=function(){this.forceRefresh=!0},ZS.prototype.pa=function(t){this.Va=t,this.Sa&&t(this.currentUser)},ZS.prototype.ba=function(){this.auth&&this.auth.removeAuthTokenListener(this.va),this.va=null,this.Va=null},ZS.prototype.Ca=function(){var t=this.auth&&this.auth.getUid();return ag(null===t||"string"==typeof t),new NS(t)},ZS),LS=(Object.defineProperty(JS.prototype,"ga",{get:function(){var t={"X-Goog-AuthUser":this.$a},e=this.Fa.auth.Na([]);return e&&(t.Authorization=e),t},enumerable:!1,configurable:!0}),JS),MS=($S.prototype.getToken=function(){return Promise.resolve(new LS(this.Fa,this.$a))},$S.prototype.pa=function(t){t(NS.Pa)},$S.prototype.ba=function(){},$S.prototype.ya=function(){},$S),FS=(YS.prototype.qa=function(){return 1===this.state||2===this.state||4===this.state},YS.prototype.Ba=function(){return 2===this.state},YS.prototype.start=function(){3!==this.state?this.auth():this.Ua()},YS.prototype.stop=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.qa()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},YS.prototype.Wa=function(){this.state=0,this.Po.reset()},YS.prototype.Qa=function(){var t=this;this.Ba()&&null===this.La&&(this.La=this.Ts.bs(this.ka,6e4,function(){return t.ja()}))},YS.prototype.Ka=function(t){this.Ga(),this.stream.send(t)},YS.prototype.ja=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return this.Ba()?[2,this.close(0)]:[2]})})},YS.prototype.Ga=function(){this.La&&(this.La.cancel(),this.La=null)},YS.prototype.close=function(e,n){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.Ga(),this.Po.cancel(),this.Oa++,3!==e?this.Po.reset():n&&n.code===Sg.RESOURCE_EXHAUSTED?(ig(n.toString()),ig("Using maximum backoff delay to prevent overloading the backend."),this.Po.Vs()):n&&n.code===Sg.UNAUTHENTICATED&&this.Ma.ya(),null!==this.stream&&(this.za(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.Ha(n)];case 1:return t.sent(),[2]}})})},YS.prototype.za=function(){},YS.prototype.auth=function(){var n=this;this.state=1;var t=this.Ya(this.Oa),e=this.Oa;this.Ma.getToken().then(function(t){n.Oa===e&&n.Ja(t)},function(e){t(function(){var t=new Cg(Sg.UNKNOWN,"Fetching auth token failed: "+e.message);return n.Xa(t)})})},YS.prototype.Ja=function(t){var e=this,n=this.Ya(this.Oa);this.stream=this.Za(t),this.stream.tu(function(){n(function(){return e.state=2,e.listener.tu()})}),this.stream.Ha(function(t){n(function(){return e.Xa(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},YS.prototype.Ua=function(){var t=this;this.state=4,this.Po.ys(function(){return Ts(t,void 0,void 0,function(){return Ss(this,function(t){return this.state=0,this.start(),[2]})})})},YS.prototype.Xa=function(t){return rg("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},YS.prototype.Ya=function(e){var n=this;return function(t){n.Ts.Zi(function(){return n.Oa===e?t():(rg("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},YS),US=(Es(XS,RS=FS),XS.prototype.Za=function(t){return this.xa.eu("Listen",t)},XS.prototype.onMessage=function(t){this.Po.reset();var e=function(t,e){var n,r,i,o,s,a;if("targetChange"in e){e.targetChange;var u="NO_CHANGE"===(a=e.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===a?1:"REMOVE"===a?2:"CURRENT"===a?3:"RESET"===a?4:sg(),c=e.targetChange.targetIds||[],h=(o=t,s=e.targetChange.resumeToken,o.Oe?(ag(void 0===s||"string"==typeof s),Yg.fromBase64String(s||"")):(ag(void 0===s||s instanceof Uint8Array),Yg.fromUint8Array(s||new Uint8Array))),l=e.targetChange.cause,f=l&&(i=void 0===(r=l).code?Sg.UNKNOWN:im(r.code),new Cg(i,r.message||""));n=new Am(u,c,h,f||null)}else if("documentChange"in e){e.documentChange;var p=e.documentChange;p.document,p.document.name,p.document.updateTime;var d=_b(t,p.document.name),v=gb(p.document.updateTime),y=new Aw({mapValue:{fields:p.document.fields}}),g=new jw(d,v,y,{}),m=p.targetIds||[],b=p.removedTargetIds||[];n=new Cm(m,b,g.key,g)}else if("documentDelete"in e){e.documentDelete;var w=e.documentDelete;w.document;var _=_b(t,w.document),E=w.readTime?gb(w.readTime):Ag.min(),I=new Vw(_,E),T=w.removedTargetIds||[];n=new Cm([],T,I.key,I)}else if("documentRemove"in e){e.documentRemove;var S=e.documentRemove;S.document;var C=_b(t,S.document),N=S.removedTargetIds||[];n=new Cm([],N,C,null)}else{if(!("filter"in e))return sg();e.filter;var A=e.filter;A.targetId;var k=A.count||0,O=new Jg(k),P=A.targetId;n=new Nm(P,O)}return n}(this.serializer,t),n=function(t){if(!("targetChange"in t))return Ag.min();var e=t.targetChange;return e.targetIds&&e.targetIds.length||!e.readTime?Ag.min():gb(e.readTime)}(t);return this.listener.nu(e,n)},XS.prototype.su=function(t){var e,n,r,i,o={};o.database=Tb(this.serializer),o.addTarget=(e=this.serializer,i=(n=t).target,(r=Xg(i)?{documents:kb(e,i)}:{query:Ob(e,i)}).targetId=n.targetId,0<n.resumeToken.H()&&(r.resumeToken=yb(e,n.resumeToken)),r);var s,a,u=(this.serializer,s=t,null==(a=function(){switch(s.J){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return sg()}}())?null:{"goog-listen-tags":a});u&&(o.labels=u),this.Ka(o)},XS.prototype.iu=function(t){var e={};e.database=Tb(this.serializer),e.removeTarget=t,this.Ka(e)},XS),jS=(Es(QS,PS=FS),Object.defineProperty(QS.prototype,"ou",{get:function(){return this.ru},enumerable:!1,configurable:!0}),QS.prototype.start=function(){this.ru=!1,this.lastStreamToken=void 0,PS.prototype.start.call(this)},QS.prototype.za=function(){this.ru&&this.hu([])},QS.prototype.Za=function(t){return this.xa.eu("Write",t)},QS.prototype.onMessage=function(t){if(ag(!!t.streamToken),this.lastStreamToken=t.streamToken,this.ru){this.Po.reset();var e=(r=t.writeResults,i=t.commitTime,r&&0<r.length?(ag(void 0!==i),r.map(function(t){return function(t,e){var n=t.updateTime?gb(t.updateTime):gb(e);n.isEqual(Ag.min())&&(n=gb(e));var r=null;return t.transformResults&&0<t.transformResults.length&&(r=t.transformResults),new rw(n,r)}(t,i)})):[]),n=gb(t.commitTime);return this.listener.au(n,e)}var r,i;return ag(!t.writeResults||0===t.writeResults.length),this.ru=!0,this.listener.uu()},QS.prototype.cu=function(){var t={};t.database=Tb(this.serializer),this.Ka(t)},QS.prototype.hu=function(t){var e=this,n={streamToken:this.lastStreamToken,writes:t.map(function(t){return Nb(e.serializer,t)})};this.Ka(n)},QS),VS=(Es(zS,OS=function(){}),zS.prototype._u=function(){if(this.lu)throw new Cg(Sg.FAILED_PRECONDITION,"The client has already been terminated.")},zS.prototype.start=function(t){this.xa=t},zS.prototype.fu=function(e,n){var r=this;return this._u(),this.credentials.getToken().then(function(t){return r.xa.fu(e,n,t)}).catch(function(t){throw t.code===Sg.UNAUTHENTICATED&&r.credentials.ya(),t})},zS.prototype.du=function(e,n){var r=this;return this._u(),this.credentials.getToken().then(function(t){return r.xa.du(e,n,t)}).catch(function(t){throw t.code===Sg.UNAUTHENTICATED&&r.credentials.ya(),t})},zS),qS=(GS.prototype.Au=function(r){return Ts(this,void 0,void 0,function(){var e,n=this;return Ss(this,function(t){switch(t.label){case 0:if(this.Ru(),0<this.mutations.length)throw new Cg(Sg.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(s,a){return Ts(this,void 0,void 0,function(){var i,e,n,o,r;return Ss(this,function(t){switch(t.label){case 0:return i=ug(s),e={database:Tb(i.serializer),documents:a.map(function(t){return wb(i.serializer,t)})},[4,i.du("BatchGetDocuments",e)];case 1:return n=t.sent(),o=new Map,n.forEach(function(t){var e,n,r=(e=i.serializer,"found"in(n=t)?function(t,e){ag(!!e.found),e.found.name,e.found.updateTime;var n=_b(t,e.found.name),r=gb(e.found.updateTime),i=new Aw({mapValue:{fields:e.found.fields}});return new jw(n,r,i,{})}(e,n):"missing"in n?function(t,e){ag(!!e.missing),ag(!!e.readTime);var n=_b(t,e.missing),r=gb(e.readTime);return new Vw(n,r)}(e,n):sg());o.set(r.key.toString(),r)}),r=[],[2,(a.forEach(function(t){var e=o.get(t.toString());ag(!!e),r.push(e)}),r)]}})})}(this.wu,r)];case 1:return[2,((e=t.sent()).forEach(function(t){t instanceof Vw||t instanceof jw?n.Pu(t):sg()}),e)]}})})},GS.prototype.set=function(t,e){this.write(e.la(t,this.Ue(t))),this.mu.add(t)},GS.prototype.update=function(t,e){try{this.write(e.la(t,this.gu(t)))}catch(t){this.Iu=t}this.mu.add(t)},GS.prototype.delete=function(t){this.write([new Cw(t,this.Ue(t))]),this.mu.add(t)},GS.prototype.commit=function(){return Ts(this,void 0,void 0,function(){var e,r=this;return Ss(this,function(t){switch(t.label){case 0:if(this.Ru(),this.Iu)throw this.Iu;return e=this.Tu,this.mutations.forEach(function(t){e.delete(t.key.toString())}),e.forEach(function(t,e){var n=new Dg(Og.N(e));r.mutations.push(new Nw(n,r.Ue(n)))}),[4,function(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return e=ug(r),n={database:Tb(e.serializer),writes:i.map(function(t){return Nb(e.serializer,t)})},[4,e.fu("Commit",n)];case 1:return t.sent(),[2]}})})}(this.wu,this.mutations)];case 1:return t.sent(),this.Eu=!0,[2]}})})},GS.prototype.Pu=function(t){var e;if(t instanceof jw)e=t.version;else{if(!(t instanceof Vw))throw sg();e=Ag.min()}var n=this.Tu.get(t.key.toString());if(n){if(!e.isEqual(n))throw new Cg(Sg.ABORTED,"Document version changed between two reads.")}else this.Tu.set(t.key.toString(),e)},GS.prototype.Ue=function(t){var e=this.Tu.get(t.toString());return!this.mu.has(t)&&e?iw.updateTime(e):iw.We()},GS.prototype.gu=function(t){var e=this.Tu.get(t.toString());if(this.mu.has(t)||!e)return iw.exists(!0);if(e.isEqual(Ag.min()))throw new Cg(Sg.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return iw.updateTime(e)},GS.prototype.write=function(t){this.Ru(),this.mutations=this.mutations.concat(t)},GS.prototype.Ru=function(){},GS),BS=(KS.prototype.vu=function(){var t=this;0===this.yu&&(this.Su("Unknown"),this.pu=this.ao.bs("online_state_timeout",1e4,function(){return t.pu=null,t.Du("Backend didn't respond within 10 seconds."),t.Su("Offline"),Promise.resolve()}))},KS.prototype.Cu=function(t){"Online"===this.state?this.Su("Unknown"):(this.yu++,1<=this.yu&&(this.Fu(),this.Du("Connection failed 1 times. Most recent error: "+t.toString()),this.Su("Offline")))},KS.prototype.set=function(t){this.Fu(),this.yu=0,"Online"===t&&(this.bu=!1),this.Su(t)},KS.prototype.Su=function(t){t!==this.state&&(this.state=t,this.Vu(t))},KS.prototype.Du=function(t){var e="Could not reach Cloud Firestore backend. "+t+"\nThis 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.bu?(ig(e),this.bu=!1):rg("OnlineStateTracker",e)},KS.prototype.Fu=function(){null!==this.pu&&(this.pu.cancel(),this.pu=null)},KS),WS=(HS.prototype.start=function(){return this.enableNetwork()},HS.prototype.enableNetwork=function(){return this.Mu.delete(0),this.Ju()},HS.prototype.Ju=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.qu()?(this.Xu()?this.Zu():this.Uu.set("Unknown"),[4,this.tc()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},HS.prototype.disableNetwork=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.Mu.add(0),[4,this.ec()];case 1:return t.sent(),this.Uu.set("Offline"),[2]}})})},HS.prototype.ec=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.Gu.stop()];case 1:return t.sent(),[4,this.Wu.stop()];case 2:return t.sent(),0<this.Nu.length&&(rg("RemoteStore","Stopping write stream with "+this.Nu.length+" pending writes"),this.Nu=[]),this.nc(),[2]}})})},HS.prototype._r=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return rg("RemoteStore","RemoteStore shutting down."),this.Mu.add(5),[4,this.ec()];case 1:return t.sent(),this.Ou._r(),this.Uu.set("Unknown"),[2]}})})},HS.prototype.listen=function(t){this.ku.has(t.targetId)||(this.ku.set(t.targetId,t),this.Xu()?this.Zu():this.Wu.Ba()&&this.sc(t))},HS.prototype.ic=function(t){this.ku.delete(t),this.Wu.Ba()&&this.rc(t),0===this.ku.size&&(this.Wu.Ba()?this.Wu.Qa():this.qu()&&this.Uu.set("Unknown"))},HS.prototype.Me=function(t){return this.ku.get(t)||null},HS.prototype.xe=function(t){return this.oc.xe(t)},HS.prototype.sc=function(t){this.xu.de(t.targetId),this.Wu.su(t)},HS.prototype.rc=function(t){this.xu.de(t),this.Wu.iu(t)},HS.prototype.Zu=function(){this.xu=new Lm(this),this.Wu.start(),this.Uu.vu()},HS.prototype.Xu=function(){return this.qu()&&!this.Wu.qa()&&0<this.ku.size},HS.prototype.qu=function(){return 0===this.Mu.size},HS.prototype.nc=function(){this.xu=null},HS.prototype.Qu=function(){return Ts(this,void 0,void 0,function(){var n=this;return Ss(this,function(t){return this.ku.forEach(function(t,e){n.sc(t)}),[2]})})},HS.prototype.ju=function(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return this.nc(),this.Xu()?(this.Uu.Cu(e),this.Zu()):this.Uu.set("Unknown"),[2]})})},HS.prototype.Ku=function(i,o){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:if(this.Uu.set("Online"),!(i instanceof Am&&2===i.state&&i.cause))return[3,6];t.label=1;case 1:return t.trys.push([1,3,,5]),[4,this.hc(i)];case 2:return t.sent(),[3,5];case 3:return e=t.sent(),rg("RemoteStore","Failed to remove targets %s: %s ",i.targetIds.join(","),e),[4,this.ac(e)];case 4:return t.sent(),[3,5];case 5:return[3,13];case 6:if(i instanceof Cm?this.xu.Pe(i):i instanceof Nm?this.xu.De(i):this.xu.ye(i),o.isEqual(Ag.min()))return[3,13];t.label=7;case 7:return t.trys.push([7,11,,13]),[4,this.$u.ai()];case 8:return n=t.sent(),0<=o.o(n)?[4,this.uc(o)]:[3,10];case 9:t.sent(),t.label=10;case 10:return[3,13];case 11:return rg("RemoteStore","Failed to raise snapshot:",r=t.sent()),[4,this.ac(r)];case 12:return t.sent(),[3,13];case 13:return[2]}})})},HS.prototype.ac=function(n,r){return Ts(this,void 0,void 0,function(){var e=this;return Ss(this,function(t){switch(t.label){case 0:if(!SI(n))throw n;return this.Mu.add(1),[4,this.ec()];case 1:return t.sent(),this.Uu.set("Offline"),r=r||function(){return e.$u.ai()},this.ao.er(function(){return Ts(e,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return rg("RemoteStore","Retrying IndexedDB access"),[4,r()];case 1:return t.sent(),this.Mu.delete(1),[4,this.Ju()];case 2:return t.sent(),[2]}})})}),[2]}})})},HS.prototype.cc=function(e){var n=this;return e().catch(function(t){return n.ac(t,e)})},HS.prototype.uc=function(r){var i=this,t=this.xu.$e(r);return t.Wt.forEach(function(t,e){if(0<t.resumeToken.H()){var n=i.ku.get(e);n&&i.ku.set(e,n.tt(t.resumeToken,r))}}),t.Qt.forEach(function(t){var e=i.ku.get(t);if(e){i.ku.set(t,e.tt(Yg.Y,e.X)),i.rc(t);var n=new em(e.target,t,1,e.sequenceNumber);i.sc(n)}}),this.oc.vh(t)},HS.prototype.hc=function(o){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:e=o.cause,n=0,r=o.targetIds,t.label=1;case 1:return n<r.length?(i=r[n],this.ku.has(i)?[4,this.oc.lc(i,e)]:[3,3]):[3,5];case 2:t.sent(),this.ku.delete(i),this.xu.removeTarget(i),t.label=3;case 3:t.label=4;case 4:return n++,[3,1];case 5:return[2]}})})},HS.prototype.tc=function(){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:e=0<this.Nu.length?this.Nu[this.Nu.length-1].batchId:-1,t.label=1;case 1:if(!this._c())return[3,7];t.label=2;case 2:return t.trys.push([2,4,,6]),[4,this.$u.Fh(e)];case 3:return null===(n=t.sent())?(0===this.Nu.length&&this.Gu.Qa(),[3,7]):(e=n.batchId,this.fc(n),[3,6]);case 4:return r=t.sent(),[4,this.ac(r)];case 5:return t.sent(),[3,6];case 6:return[3,1];case 7:return this.dc()&&this.wc(),[2]}})})},HS.prototype._c=function(){return this.qu()&&this.Nu.length<10},HS.prototype.Tc=function(){return this.Nu.length},HS.prototype.fc=function(t){this.Nu.push(t),this.Gu.Ba()&&this.Gu.ou&&this.Gu.hu(t.mutations)},HS.prototype.dc=function(){return this.qu()&&!this.Gu.qa()&&0<this.Nu.length},HS.prototype.wc=function(){this.Gu.start()},HS.prototype.zu=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return this.Gu.cu(),[2]})})},HS.prototype.Yu=function(){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){for(e=0,n=this.Nu;e<n.length;e++)r=n[e],this.Gu.hu(r.mutations);return[2]})})},HS.prototype.au=function(i,o){return Ts(this,void 0,void 0,function(){var e,n,r=this;return Ss(this,function(t){switch(t.label){case 0:return e=this.Nu.shift(),n=R_.from(e,i,o),[4,this.cc(function(){return r.oc.Ec(n)})];case 1:return t.sent(),[4,this.tc()];case 2:return t.sent(),[2]}})})},HS.prototype.Hu=function(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return e&&this.Gu.ou?[4,this.Ic(e)]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.dc()&&this.wc(),[2]}})})},HS.prototype.Ic=function(i){return Ts(this,void 0,void 0,function(){var e,n,r=this;return Ss(this,function(t){switch(t.label){case 0:return rm(n=i.code)&&n!==Sg.ABORTED?(e=this.Nu.shift(),this.Gu.Wa(),[4,this.cc(function(){return r.oc.mc(e.batchId,i)})]):[3,3];case 1:return t.sent(),[4,this.tc()];case 2:t.sent(),t.label=3;case 3:return[2]}})})},HS.prototype.Ac=function(){return new qS(this.wu)},HS.prototype.Bu=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.Mu.add(4),[4,this.ec()];case 1:return t.sent(),this.Uu.set("Unknown"),this.Gu.Wa(),this.Wu.Wa(),this.Mu.delete(4),[4,this.Ju()];case 2:return t.sent(),[2]}})})},HS.prototype.Rc=function(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.ao.$o(),rg("RemoteStore","RemoteStore received new credentials"),this.Mu.add(3),[4,this.ec()];case 1:return t.sent(),this.Uu.set("Unknown"),[4,this.oc.Rc(e)];case 2:return t.sent(),this.Mu.delete(3),[4,this.Ju()];case 3:return t.sent(),[2]}})})},HS.prototype.Pc=function(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return e?(this.Mu.delete(2),[4,this.Ju()]):[3,2];case 1:return t.sent(),[3,5];case 2:return e?[3,4]:(this.Mu.add(2),[4,this.ec()]);case 3:t.sent(),this.Uu.set("Unknown"),t.label=4;case 4:t.label=5;case 5:return[2]}})})},HS);function HS(t,e,n,r,i){var o,s,a,u,c,h,l,f,p=this;this.$u=t,this.wu=e,this.ao=n,this.Nu=[],this.ku=new Map,this.xu=null,this.Mu=new Set,this.Ou=i,this.Ou.Lu(function(t){n.Zi(function(){return Ts(p,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.qu()?(rg("RemoteStore","Restarting streams for network reachability change."),[4,this.Bu()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.Uu=new BS(n,r),this.Wu=(c=this.wu,h=n,l={tu:this.Qu.bind(this),Ha:this.ju.bind(this),nu:this.Ku.bind(this)},(f=ug(c))._u(),new US(h,f.xa,f.credentials,f.serializer,l)),this.Gu=(o=this.wu,s=n,a={tu:this.zu.bind(this),Ha:this.Hu.bind(this),uu:this.Yu.bind(this),au:this.au.bind(this)},(u=ug(o))._u(),new jS(s,u.xa,u.credentials,u.serializer,a))}function KS(t,e){this.ao=t,this.Vu=e,this.state="Unknown",this.yu=0,this.pu=null,this.bu=!0}function GS(t){this.wu=t,this.Tu=new Map,this.mutations=[],this.Eu=!1,this.Iu=null,this.mu=new Set}function zS(t,e){var n=this;return(n=OS.call(this)||this).credentials=t,n.serializer=e,n.lu=!1,n}function QS(t,e,n,r,i){var o=this;return(o=PS.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this).serializer=r,o.ru=!1,o}function XS(t,e,n,r,i){var o=this;return(o=RS.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this).serializer=r,o}function YS(t,e,n,r,i,o){this.Ts=t,this.ka=n,this.xa=r,this.Ma=i,this.listener=o,this.state=0,this.Oa=0,this.La=null,this.stream=null,this.Po=new X_(t,e)}function $S(t,e){this.Fa=t,this.$a=e}function JS(t,e){this.Fa=t,this.$a=e,this.type="FirstParty",this.user=NS.Pa}function ZS(t){var e=this;this.va=null,this.currentUser=NS.UNAUTHENTICATED,this.Sa=!1,this.Da=0,this.Va=null,this.forceRefresh=!1,this.va=function(){e.Da++,e.currentUser=e.Ca(),e.Sa=!0,e.Va&&e.Va(e.currentUser)},this.Da=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.va):(this.va(null),t.get().then(function(t){e.auth=t,e.va&&e.auth.addAuthTokenListener(e.va)},function(){}))}function tC(){this.Va=null}function eC(t,e){return"firestore_clients_"+t+"_"+e}function nC(t,e,n){var r="firestore_mutations_"+t+"_"+n;return e.Mr()&&(r+="_"+e.uid),r}function rC(t,e){return"firestore_targets_"+t+"_"+e}function iC(t){this.key=t}function oC(t){this.key=t}function sC(t,e,n){this.query=t,this.targetId=e,this.view=n}function aC(t){this.key=t,this.Ml=!1}var uC=(NC.gc=function(t,e,n){var r=JSON.parse(n),i="object"==typeof r&&-1!==["pending","acknowledged","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error),o=void 0;return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code)&&(o=new Cg(r.error.code,r.error.message)),i?new NC(t,e,r.state,o):(ig("SharedClientState","Failed to parse mutation state for ID '"+e+"': "+n),null)},NC.prototype.Vc=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},NC),cC=(CC.gc=function(t,e){var n=JSON.parse(e),r="object"==typeof n&&-1!==["not-current","current","rejected"].indexOf(n.state)&&(void 0===n.error||"object"==typeof n.error),i=void 0;return r&&n.error&&(r="string"==typeof n.error.message&&"string"==typeof n.error.code)&&(i=new Cg(n.error.code,n.error.message)),r?new CC(t,n.state,i):(ig("SharedClientState","Failed to parse target state for ID '"+t+"': "+e),null)},CC.prototype.Vc=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},CC),hC=(SC.gc=function(t,e){for(var n=JSON.parse(e),r="object"==typeof n&&n.activeTargetIds instanceof Array,i=Sm(),o=0;r&&o<n.activeTargetIds.length;++o)r=Hg(n.activeTargetIds[o]),i=i.add(n.activeTargetIds[o]);return r?new SC(t,i):(ig("SharedClientState","Failed to parse client data for instance '"+t+"': "+e),null)},SC),lC=(TC.gc=function(t){var e=JSON.parse(t);return"object"==typeof e&&-1!==["Unknown","Online","Offline"].indexOf(e.onlineState)&&"string"==typeof e.clientId?new TC(e.clientId,e.onlineState):(ig("SharedClientState","Failed to parse online state: "+t),null)},TC),fC=(IC.prototype.yc=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},IC.prototype.pc=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},IC.prototype.Vc=function(){var t={activeTargetIds:this.activeTargetIds.F(),updateTimeMs:Date.now()};return JSON.stringify(t)},IC),pC=(EC.Oi=function(t){return!(!t||!t.localStorage)},EC.prototype.start=function(){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l,f=this;return Ss(this,function(t){switch(t.label){case 0:return[4,this.oc.Ir()];case 1:for(e=t.sent(),n=0,r=e;n<r.length;n++)(i=r[n])!==this.bc&&(o=this.getItem(eC(this.persistenceKey,i)))&&(s=hC.gc(i,o))&&(this.Dc=this.Dc.nt(s.clientId,s));for(this.Oc(),(a=this.storage.getItem(this.Mc))&&(u=this.Lc(a))&&this.qc(u),c=0,h=this.Cc;c<h.length;c++)l=h[c],this.Sc(l);return this.Cc=[],this.window.addEventListener("unload",function(){return f._r()}),this.Hi=!0,[2]}})})},EC.prototype.ds=function(t){this.setItem(this.$c,JSON.stringify(t))},EC.prototype.Bc=function(){return this.Uc(this.Dc)},EC.prototype.Wc=function(n){var r=!1;return this.Dc.forEach(function(t,e){e.activeTargetIds.has(n)&&(r=!0)}),r},EC.prototype.Qc=function(t){this.jc(t,"pending")},EC.prototype.Kc=function(t,e,n){this.jc(t,e,n),this.Gc(t)},EC.prototype.zc=function(t){var e="not-current";if(this.Wc(t)){var n=this.storage.getItem(rC(this.persistenceKey,t));if(n){var r=cC.gc(t,n);r&&(e=r.state)}}return this.Hc.yc(t),this.Oc(),e},EC.prototype.Yc=function(t){this.Hc.pc(t),this.Oc()},EC.prototype.Jc=function(t){return this.Hc.activeTargetIds.has(t)},EC.prototype.Xc=function(t){this.removeItem(rC(this.persistenceKey,t))},EC.prototype.Zc=function(t,e,n){this.tl(t,e,n)},EC.prototype.Ah=function(t,e,n){var r=this;e.forEach(function(t){r.Gc(t)}),this.currentUser=t,n.forEach(function(t){r.Qc(t)})},EC.prototype.el=function(t){this.nl(t)},EC.prototype._r=function(){this.Hi&&(this.window.removeEventListener("storage",this.vc),this.removeItem(this.Fc),this.Hi=!1)},EC.prototype.getItem=function(t){var e=this.storage.getItem(t);return rg("SharedClientState","READ",t,e),e},EC.prototype.setItem=function(t,e){rg("SharedClientState","SET",t,e),this.storage.setItem(t,e)},EC.prototype.removeItem=function(t){rg("SharedClientState","REMOVE",t),this.storage.removeItem(t)},EC.prototype.Sc=function(t){var e=this,a=t;if(a.storageArea===this.storage){if(rg("SharedClientState","EVENT",a.key,a.newValue),a.key===this.Fc)return void ig("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.Ts.er(function(){return Ts(e,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){if(this.Hi){if(null!==a.key)if(this.Nc.test(a.key)){if(null==a.newValue)return e=this.sl(a.key),[2,this.il(e,null)];if(n=this.rl(a.key,a.newValue))return[2,this.il(n.clientId,n)]}else if(this.kc.test(a.key)){if(null!==a.newValue&&(r=this.ol(a.key,a.newValue)))return[2,this.hl(r)]}else if(this.xc.test(a.key)){if(null!==a.newValue&&(i=this.al(a.key,a.newValue)))return[2,this.ul(i)]}else if(a.key===this.Mc){if(null!==a.newValue&&(o=this.Lc(a.newValue)))return[2,this.qc(o)]}else a.key===this.$c&&(s=function(t){var e=j_.ws;if(null!=t)try{var n=JSON.parse(t);ag("number"==typeof n),e=n}catch(t){ig("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(a.newValue))!==j_.ws&&this.ls(s)}else this.Cc.push(a);return[2]})})})}},Object.defineProperty(EC.prototype,"Hc",{get:function(){return this.Dc.get(this.bc)},enumerable:!1,configurable:!0}),EC.prototype.Oc=function(){this.setItem(this.Fc,this.Hc.Vc())},EC.prototype.jc=function(t,e,n){var r=new uC(this.currentUser,t,e,n),i=nC(this.persistenceKey,this.currentUser,t);this.setItem(i,r.Vc())},EC.prototype.Gc=function(t){var e=nC(this.persistenceKey,this.currentUser,t);this.removeItem(e)},EC.prototype.nl=function(t){var e={clientId:this.bc,onlineState:t};this.storage.setItem(this.Mc,JSON.stringify(e))},EC.prototype.tl=function(t,e,n){var r=rC(this.persistenceKey,t),i=new cC(t,e,n);this.setItem(r,i.Vc())},EC.prototype.sl=function(t){var e=this.Nc.exec(t);return e?e[1]:null},EC.prototype.rl=function(t,e){var n=this.sl(t);return hC.gc(n,e)},EC.prototype.ol=function(t,e){var n=this.kc.exec(t),r=Number(n[1]),i=void 0!==n[2]?n[2]:null;return uC.gc(new NS(i),r,e)},EC.prototype.al=function(t,e){var n=this.xc.exec(t),r=Number(n[1]);return cC.gc(r,e)},EC.prototype.Lc=function(t){return lC.gc(t)},EC.prototype.hl=function(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return e.user.uid===this.currentUser.uid?[2,this.oc.cl(e.batchId,e.state,e.error)]:(rg("SharedClientState","Ignoring mutation for non-active user "+e.user.uid),[2])})})},EC.prototype.ul=function(t){return this.oc.ll(t.targetId,t.state,t.error)},EC.prototype.il=function(t,e){var n=this,r=e?this.Dc.nt(t,e):this.Dc.remove(t),i=this.Uc(this.Dc),o=this.Uc(r),s=[],a=[];return o.forEach(function(t){i.has(t)||s.push(t)}),i.forEach(function(t){o.has(t)||a.push(t)}),this.oc._l(s,a).then(function(){n.Dc=r})},EC.prototype.qc=function(t){this.Dc.get(t.clientId)&&this.Vu(t.onlineState)},EC.prototype.Uc=function(t){var n=Sm();return t.forEach(function(t,e){n=n.Ct(e.activeTargetIds)}),n},EC),dC=(_C.prototype.Qc=function(t){},_C.prototype.Kc=function(t,e,n){},_C.prototype.zc=function(t){return this.fl.yc(t),this.dl[t]||"not-current"},_C.prototype.Zc=function(t,e,n){this.dl[t]=e},_C.prototype.Yc=function(t){this.fl.pc(t)},_C.prototype.Jc=function(t){return this.fl.activeTargetIds.has(t)},_C.prototype.Xc=function(t){delete this.dl[t]},_C.prototype.Bc=function(){return this.fl.activeTargetIds},_C.prototype.Wc=function(t){return this.fl.activeTargetIds.has(t)},_C.prototype.start=function(){return this.fl=new fC,Promise.resolve()},_C.prototype.Ah=function(t,e,n){},_C.prototype.el=function(t){},_C.prototype._r=function(){},_C.prototype.ds=function(t){},_C),vC=(Object.defineProperty(wC.prototype,"Al",{get:function(){return this.wl},enumerable:!1,configurable:!0}),wC.prototype.Rl=function(t,e){var a=this,u=e?e.Pl:new Om,c=e?e.ml:this.ml,h=e?e.Lt:this.Lt,l=c,f=!1,p=this.query.hn()&&c.size===this.query.limit?c.last():null,d=this.query.an()&&c.size===this.query.limit?c.first():null;if(t.ot(function(t,e){var n=c.get(t),r=e instanceof jw?e:null;r=r&&(o_(a.query,r)?r:null);var i=!!n&&a.Lt.has(n.key),o=!!r&&(r.Ke||a.Lt.has(r.key)&&r.hasCommittedMutations),s=!1;n&&r?n.data().isEqual(r.data())?i!==o&&(u.track({type:3,doc:r}),s=!0):a.gl(n,r)||(u.track({type:2,doc:r}),s=!0,(p&&0<a.Il(r,p)||d&&a.Il(r,d)<0)&&(f=!0)):!n&&r?(u.track({type:0,doc:r}),s=!0):n&&!r&&(u.track({type:1,doc:n}),s=!0,(p||d)&&(f=!0)),s&&(h=r?(l=l.add(r),o?h.add(t):h.delete(t)):(l=l.delete(t),h.delete(t)))}),this.query.hn()||this.query.an())for(;l.size>this.query.limit;){var n=this.query.hn()?l.last():l.first();l=l.delete(n.key),h=h.delete(n.key),u.track({type:1,doc:n})}return{ml:l,Pl:u,Vl:f,Lt:h}},wC.prototype.gl=function(t,e){return t.Ke&&e.hasCommittedMutations&&!e.Ke},wC.prototype.qn=function(t,e,n){var o=this,r=this.ml;this.ml=t.ml,this.Lt=t.Lt;var i=t.Pl.Mt();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.Il(t.doc,e.doc);function n(t){switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return sg()}}var r,i}),this.yl(n);var s=e?this.pl():[],a=0===this.El.size&&this.Ht?1:0,u=a!==this.Tl;return this.Tl=a,0!==i.length||u?{snapshot:new Pm(this.query,t.ml,r,i,t.Lt,0==a,u,!1),bl:s}:{bl:s}},wC.prototype.vl=function(t){return this.Ht&&"Offline"===t?(this.Ht=!1,this.qn({ml:this.ml,Pl:new Om,Lt:this.Lt,Vl:!1},!1)):{bl:[]}},wC.prototype.Sl=function(t){return!this.wl.has(t)&&!!this.ml.has(t)&&!this.ml.get(t).Ke},wC.prototype.yl=function(t){var e=this;t&&(t.Yt.forEach(function(t){return e.wl=e.wl.add(t)}),t.Jt.forEach(function(t){}),t.Xt.forEach(function(t){return e.wl=e.wl.delete(t)}),this.Ht=t.Ht)},wC.prototype.pl=function(){var e=this;if(!this.Ht)return[];var n=this.El;this.El=Im(),this.ml.forEach(function(t){e.Sl(t.key)&&(e.El=e.El.add(t.key))});var r=[];return n.forEach(function(t){e.El.has(t)||r.push(new oC(t))}),this.El.forEach(function(t){n.has(t)||r.push(new iC(t))}),r},wC.prototype.Dl=function(t){this.wl=t.Mh,this.El=Im();var e=this.Rl(t.documents);return this.qn(e,!0)},wC.prototype.Cl=function(){return Pm.Ut(this.query,this.ml,this.Lt,0===this.Tl)},wC),yC=(bC.prototype.run=function(){this.$l()},bC.prototype.$l=function(){var t=this;this.Po.ys(function(){return Ts(t,void 0,void 0,function(){var e,n,r=this;return Ss(this,function(t){return e=new qS(this.wu),(n=this.Nl(e))&&n.then(function(t){r.ao.Zi(function(){return e.commit().then(function(){r.lo.resolve(t)}).catch(function(t){r.kl(t)})})}).catch(function(t){r.kl(t)}),[2]})})})},bC.prototype.Nl=function(t){try{var e=this.updateFunction(t);return!Bg(e)&&e.catch&&e.then?e:(this.lo.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.lo.reject(t),null}},bC.prototype.kl=function(t){var e=this;0<this.Fl&&this.xl(t)?(--this.Fl,this.ao.Zi(function(){return e.$l(),Promise.resolve()})):this.lo.reject(t)},bC.prototype.xl=function(t){if("FirebaseError"!==t.name)return!1;var e=t.code;return"aborted"===e||"failed-precondition"===e||!rm(e)},bC),gC=(Object.defineProperty(mC.prototype,"Xl",{get:function(){return!0===this.Jl},enumerable:!1,configurable:!0}),mC.prototype.subscribe=function(t){this.Bl=t},mC.prototype.listen=function(s){return Ts(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return this.Zl("listen()"),(r=this.Ul.get(s))?(e=r.targetId,this.Ll.zc(e),n=r.view.Cl(),[3,4]):[3,1];case 1:return[4,this.$u.Nh(Jw(s))];case 2:return i=t.sent(),o=this.Ll.zc(i.targetId),e=i.targetId,[4,this.t_(s,e,"current"===o)];case 3:n=t.sent(),this.Xl&&this.Ol.listen(i),t.label=4;case 4:return[2,n]}})})},mC.prototype.t_=function(a,u,c){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return[4,this.$u.xh(a,!0)];case 1:return e=t.sent(),n=new vC(a,e.Mh),r=n.Rl(e.documents),i=Dm.zt(u,c&&"Offline"!==this.onlineState),o=n.qn(r,this.Xl,i),this.e_(u,o.bl),s=new sC(a,u,n),[2,(this.Ul.set(a,s),this.Wl.has(u)?this.Wl.get(u).push(a):this.Wl.set(u,[a]),o.snapshot)]}})})},mC.prototype.ic=function(i){return Ts(this,void 0,void 0,function(){var e,n,r=this;return Ss(this,function(t){switch(t.label){case 0:return this.Zl("unlisten()"),e=this.Ul.get(i),1<(n=this.Wl.get(e.targetId)).length?[2,(this.Wl.set(e.targetId,n.filter(function(t){return!n_(t,i)})),void this.Ul.delete(i))]:this.Xl?(this.Ll.Yc(e.targetId),this.Ll.Wc(e.targetId)?[3,2]:[4,this.$u.kh(e.targetId,!1).then(function(){r.Ll.Xc(e.targetId),r.Ol.ic(e.targetId),r.n_(e.targetId)}).catch(ZI)]):[3,3];case 1:t.sent(),t.label=2;case 2:return[3,5];case 3:return this.n_(e.targetId),[4,this.$u.kh(e.targetId,!0)];case 4:t.sent(),t.label=5;case 5:return[2]}})})},mC.prototype.write=function(i,o){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:this.Zl("write()"),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.$u.Vh(i)];case 2:return e=t.sent(),this.Ll.Qc(e.batchId),this.s_(e.batchId,o),[4,this.i_(e.Cn)];case 3:return t.sent(),[4,this.Ol.tc()];case 4:return t.sent(),[3,6];case 5:return n=t.sent(),r=UI(n,"Failed to persist write"),o.reject(r),[3,6];case 6:return[2]}})})},mC.prototype.runTransaction=function(t,e,n){new yC(t,this.wu,e,n).run()},mC.prototype.vh=function(n){return Ts(this,void 0,void 0,function(){var e,r=this;return Ss(this,function(t){switch(t.label){case 0:this.Zl("applyRemoteEvent()"),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.$u.vh(n)];case 2:return e=t.sent(),n.Wt.forEach(function(t,e){var n=r.Kl.get(e);n&&(ag(t.Yt.size+t.Jt.size+t.Xt.size<=1),0<t.Yt.size?n.Ml=!0:0<t.Jt.size?ag(n.Ml):0<t.Xt.size&&(ag(n.Ml),n.Ml=!1))}),[4,this.i_(e,n)];case 3:return t.sent(),[3,6];case 4:return[4,ZI(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},mC.prototype.vl=function(r,t){if(this.Xl&&0===t||!this.Xl&&1===t){this.Zl("applyOnlineStateChange()");var i=[];this.Ul.forEach(function(t,e){var n=e.view.vl(r);n.snapshot&&i.push(n.snapshot)}),this.Bl.r_(r),this.Bl.nu(i),this.onlineState=r,this.Xl&&this.Ll.el(r)}},mC.prototype.lc=function(a,u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s=this;return Ss(this,function(t){switch(t.label){case 0:return this.Zl("rejectListens()"),this.Ll.Zc(a,"rejected",u),e=this.Kl.get(a),(n=e&&e.key)?(r=(r=new om(Dg.P)).nt(n,new Vw(n,Ag.min())),i=Im().add(n),o=new Rm(Ag.min(),new Map,new fm(fg),r,i),[4,this.vh(o)]):[3,2];case 1:return t.sent(),this.jl=this.jl.remove(n),this.Kl.delete(a),this.o_(),[3,4];case 2:return[4,this.$u.kh(a,!1).then(function(){return s.n_(a,u)}).catch(ZI)];case 3:t.sent(),t.label=4;case 4:return[2]}})})},mC.prototype.Ec=function(r){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:this.Zl("applySuccessfulWrite()"),e=r.batch.batchId,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.$u.yh(r)];case 2:return n=t.sent(),this.h_(e,null),this.a_(e),this.Ll.Kc(e,"acknowledged"),[4,this.i_(n)];case 3:return t.sent(),[3,6];case 4:return[4,ZI(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},mC.prototype.mc=function(n,r){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:this.Zl("rejectFailedWrite()"),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.$u.bh(n)];case 2:return e=t.sent(),this.h_(n,r),this.a_(n),this.Ll.Kc(n,"rejected",r),[4,this.i_(e)];case 3:return t.sent(),[3,6];case 4:return[4,ZI(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},mC.prototype.u_=function(o){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:this.Ol.qu()||rg("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.$u.Wr()];case 2:return-1===(e=t.sent())?[2,void o.resolve()]:((n=this.Hl.get(e)||[]).push(o),this.Hl.set(e,n),[3,4]);case 3:return r=t.sent(),i=UI(r,"Initialization of waitForPendingWrites() operation failed"),o.reject(i),[3,4];case 4:return[2]}})})},mC.prototype.a_=function(t){(this.Hl.get(t)||[]).forEach(function(t){t.resolve()}),this.Hl.delete(t)},mC.prototype.c_=function(e){this.Hl.forEach(function(t){t.forEach(function(t){t.reject(new Cg(Sg.CANCELLED,e))})}),this.Hl.clear()},mC.prototype.s_=function(t,e){var n=this.zl[this.currentUser.Aa()];n=(n=n||new om(fg)).nt(t,e),this.zl[this.currentUser.Aa()]=n},mC.prototype.h_=function(t,e){var n=this.zl[this.currentUser.Aa()];if(n){var r=n.get(t);r&&(e?r.reject(e):r.resolve(),n=n.remove(t)),this.zl[this.currentUser.Aa()]=n}},mC.prototype.n_=function(t,e){var n=this;void 0===e&&(e=null),this.Ll.Yc(t);for(var r=0,i=this.Wl.get(t);r<i.length;r++){var o=i[r];this.Ul.delete(o),e&&this.Bl.l_(o,e)}this.Wl.delete(t),this.Xl&&this.Gl.jh(t).forEach(function(t){n.Gl.pi(t)||n.__(t)})},mC.prototype.__=function(t){var e=this.jl.get(t);null!==e&&(this.Ol.ic(e),this.jl=this.jl.remove(t),this.Kl.delete(e),this.o_())},mC.prototype.e_=function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n];i instanceof iC?(this.Gl.Ri(i.key,t),this.f_(i)):i instanceof oC?(rg("SyncEngine","Document no longer in limbo: "+i.key),this.Gl.gi(i.key,t),this.Gl.pi(i.key)||this.__(i.key)):sg()}},mC.prototype.f_=function(t){var e=t.key;this.jl.get(e)||(rg("SyncEngine","New document in limbo: "+e),this.Ql.push(e),this.o_())},mC.prototype.o_=function(){for(;0<this.Ql.length&&this.jl.size<this.ql;){var t=this.Ql.shift(),e=this.Yl.next();this.Kl.set(e,new aC(t)),this.jl=this.jl.nt(t,e),this.Ol.listen(new em(Jw(Xw(t.path)),e,2,j_.ws))}},mC.prototype.d_=function(){return this.jl},mC.prototype.w_=function(){return this.Ql},mC.prototype.i_=function(r,u){return Ts(this,void 0,void 0,function(){var o,s,e,a=this;return Ss(this,function(t){switch(t.label){case 0:return o=[],s=[],e=[],this.Ul.forEach(function(t,i){e.push(Promise.resolve().then(function(){var n=i.view.Rl(r);return n.Vl?a.$u.xh(i.query,!1).then(function(t){var e=t.documents;return i.view.Rl(e,n)}):n}).then(function(t){var e=u&&u.Wt.get(i.targetId),n=i.view.qn(t,a.Xl,e);if(a.e_(i.targetId,n.bl),n.snapshot){a.Xl&&a.Ll.Zc(i.targetId,n.snapshot.fromCache?"not-current":"current"),o.push(n.snapshot);var r=U_.cs(i.targetId,n.snapshot);s.push(r)}}))}),[4,Promise.all(e)];case 1:return t.sent(),this.Bl.nu(o),[4,this.$u.Ch(s)];case 2:return t.sent(),[2]}})})},mC.prototype.Zl=function(t){},mC.prototype.Rc=function(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.currentUser.isEqual(n)?[3,3]:(rg("SyncEngine","User change. New user:",n.Aa()),[4,this.$u.Ah(n)]);case 1:return e=t.sent(),this.currentUser=n,this.c_("'waitForPendingWrites' promise is rejected due to a user change."),this.Ll.Ah(n,e.Ph,e.gh),[4,this.i_(e.Rh)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},mC.prototype.xe=function(t){var e=this.Kl.get(t);if(e&&e.Ml)return Im().add(e.key);var n=Im(),r=this.Wl.get(t);if(!r)return n;for(var i=0,o=r;i<o.length;i++){var s=o[i],a=this.Ul.get(s);n=n.Ct(a.view.Al)}return n},mC);function mC(t,e,n,r,i,o){this.$u=t,this.Ol=e,this.wu=n,this.Ll=r,this.currentUser=i,this.ql=o,this.Bl=null,this.Ul=new Tg(function(t){return r_(t)},n_),this.Wl=new Map,this.Ql=[],this.jl=new om(Dg.P),this.Kl=new Map,this.Gl=new tT,this.zl={},this.Hl=new Map,this.Yl=CE.si(),this.onlineState="Unknown",this.Jl=void 0}function bC(t,e,n,r){this.ao=t,this.wu=e,this.updateFunction=n,this.lo=r,this.Fl=5,this.Po=new X_(this.ao,"transaction_retry")}function wC(t,e){this.query=t,this.wl=e,this.Tl=null,this.Ht=!1,this.El=Im(),this.Lt=Im(),this.Il=s_(t),this.ml=new km(this.Il)}function _C(){this.fl=new fC,this.dl={},this.Vu=null,this.ls=null}function EC(t,e,n,r,i){this.window=t,this.Ts=e,this.persistenceKey=n,this.bc=r,this.oc=null,this.Vu=null,this.ls=null,this.vc=this.Sc.bind(this),this.Dc=new om(fg),this.Hi=!1,this.Cc=[];var o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=i,this.Fc=eC(this.persistenceKey,this.bc),this.$c="firestore_sequence_number_"+this.persistenceKey,this.Dc=this.Dc.nt(this.bc,new fC),this.Nc=new RegExp("^firestore_clients_"+o+"_([^_]*)$"),this.kc=new RegExp("^firestore_mutations_"+o+"_(\\d+)(?:_(.*))?$"),this.xc=new RegExp("^firestore_targets_"+o+"_(\\d+)$"),this.Mc="firestore_online_state_"+this.persistenceKey,this.window.addEventListener("storage",this.vc)}function IC(){this.activeTargetIds=Sm()}function TC(t,e){this.clientId=t,this.onlineState=e}function SC(t,e){this.clientId=t,this.activeTargetIds=e}function CC(t,e,n){this.targetId=t,this.state=e,this.error=n}function NC(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}function AC(t,e,n,r,i,o,s){var a=new gC(t,e,n,r,i,o);return s&&(a.Jl=!0),a}function kC(c,h,l,f){return Ts(this,void 0,void 0,function(){var a,u;return Ss(this,function(t){switch(t.label){case 0:return(a=ug(c)).Zl("applyBatchState()"),[4,(r=a.$u,i=h,o=ug(r),s=ug(o.jn),o.persistence.runTransaction("Lookup mutation documents","readonly",function(e){return s.Br(e,i).next(function(t){return t?o.Ih.Jn(e,t):D_.resolve(null)})}))];case 1:return null===(u=t.sent())?[3,6]:"pending"!==l?[3,3]:[4,a.Ol.tc()];case 2:return t.sent(),[3,4];case 3:"acknowledged"===l||"rejected"===l?(a.h_(h,f||null),e=a.$u,n=h,ug(ug(e).jn).Gr(n)):sg(),t.label=4;case 4:return[4,a.i_(u)];case 5:return t.sent(),[3,7];case 6:rg("SyncEngine","Cannot apply mutation batch with id: "+h),t.label=7;case 7:return[2]}var e,n,r,i,o,s})})}function OC(h,l){return Ts(this,void 0,void 0,function(){var r,e,i,o,s,a,u,c;return Ss(this,function(t){switch(t.label){case 0:return r=ug(h),!0!==l||!0===r.Jl?[3,3]:(e=r.Ll.Bc(),[4,PC(r,e.F())]);case 1:return i=t.sent(),r.Jl=!0,[4,r.Ol.Pc(!0)];case 2:for(t.sent(),o=0,s=i;o<s.length;o++)a=s[o],r.Ol.listen(a);return[3,7];case 3:return!1!==l||!1===r.Jl?[3,7]:(u=[],c=Promise.resolve(),r.Wl.forEach(function(t,e){r.Ll.Jc(e)?u.push(e):c=c.then(function(){return r.n_(e),r.$u.kh(e,!0)}),r.Ol.ic(e)}),[4,c]);case 4:return t.sent(),[4,PC(r,u)];case 5:return t.sent(),(n=ug(r)).Kl.forEach(function(t,e){n.Ol.ic(e)}),n.Gl.Kh(),n.Kl=new Map,n.jl=new om(Dg.P),r.Jl=!1,[4,r.Ol.Pc(!1)];case 6:t.sent(),t.label=7;case 7:return[2]}var n})})}function PC(v,y){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l,f,p,d;return Ss(this,function(t){switch(t.label){case 0:e=ug(v),n=[],r=[],i=0,o=y,t.label=1;case 1:return i<o.length?(s=o[i],a=void 0,(u=e.Wl.get(s))&&0!==u.length?[4,e.$u.Nh(Jw(u[0]))]:[3,7]):[3,13];case 2:a=t.sent(),c=0,h=u,t.label=3;case 3:return c<h.length?(l=h[c],f=e.Ul.get(l),[4,function(i,o){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return[4,(e=ug(i)).$u.xh(o.query,!0)];case 1:return n=t.sent(),r=o.view.Dl(n),[2,(e.Xl&&e.e_(o.targetId,r.bl),r)]}})})}(e,f)]):[3,6];case 4:(p=t.sent()).snapshot&&r.push(p.snapshot),t.label=5;case 5:return c++,[3,3];case 6:return[3,11];case 7:return[4,JI(e.$u,s)];case 8:return d=t.sent(),[4,e.$u.Nh(d)];case 9:return a=t.sent(),[4,e.t_(RC(d),s,!1)];case 10:t.sent(),t.label=11;case 11:n.push(a),t.label=12;case 12:return i++,[3,1];case 13:return[2,(e.Bl.nu(r),n)]}})})}function RC(t){return Qw(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)}function DC(s,a,u,c){return Ts(this,void 0,void 0,function(){var n,i,o;return Ss(this,function(t){switch(t.label){case 0:return(n=ug(s)).Jl?(rg("SyncEngine","Ignoring unexpected query state notification."),[3,8]):[3,1];case 1:if(!n.Wl.has(a))return[3,8];switch(u){case"current":case"not-current":return[3,2];case"rejected":return[3,5]}return[3,7];case 2:return[4,(r=ug(n.$u),e=ug(r.Eh),r.persistence.runTransaction("Get new document changes","readonly",function(t){return e.Ks(t,r.Th)}).then(function(t){var e=t.Gs,n=t.readTime;return r.Th=n,e}))];case 3:return i=t.sent(),o=Rm.Gt(a,"current"===u),[4,n.i_(i,o)];case 4:return t.sent(),[3,8];case 5:return[4,n.$u.kh(a,!0)];case 6:return t.sent(),n.n_(a,c),[3,8];case 7:sg(),t.label=8;case 8:return[2]}var r,e})})}function xC(){this.T_=void 0,this.listeners=[]}var LC,MC=(KC.prototype.listen=function(a){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:if(e=a.query,n=!1,(r=this.E_.get(e))||(n=!0,r=new xC),!n)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),i=r,[4,this.oc.listen(e)];case 2:return i.T_=t.sent(),[3,4];case 3:return o=t.sent(),s=UI(o,"Initialization of query '"+i_(a.query)+"' failed"),[2,void a.onError(s)];case 4:return this.E_.set(e,r),r.listeners.push(a),a.vl(this.onlineState),r.T_&&a.m_(r.T_)&&this.A_(),[2]}})})},KC.prototype.ic=function(o){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){return e=o.query,n=!1,(r=this.E_.get(e))&&0<=(i=r.listeners.indexOf(o))&&(r.listeners.splice(i,1),n=0===r.listeners.length),n?[2,(this.E_.delete(e),this.oc.ic(e))]:[2]})})},KC.prototype.nu=function(t){for(var e=!1,n=0,r=t;n<r.length;n++){var i=r[n],o=i.query,s=this.E_.get(o);if(s){for(var a=0,u=s.listeners;a<u.length;a++)u[a].m_(i)&&(e=!0);s.T_=i}}e&&this.A_()},KC.prototype.l_=function(t,e){var n=this.E_.get(t);if(n)for(var r=0,i=n.listeners;r<i.length;r++)i[r].onError(e);this.E_.delete(t)},KC.prototype.r_=function(i){this.onlineState=i;var o=!1;this.E_.forEach(function(t,e){for(var n=0,r=e.listeners;n<r.length;n++)r[n].vl(i)&&(o=!0)}),o&&this.A_()},KC.prototype.R_=function(t){this.I_.add(t),t.next()},KC.prototype.P_=function(t){this.I_.delete(t)},KC.prototype.A_=function(){this.I_.forEach(function(t){t.next()})},KC),FC=(HC.prototype.m_=function(t){if(!this.options.includeMetadataChanges){for(var e=[],n=0,r=t.docChanges;n<r.length;n++){var i=r[n];3!==i.type&&e.push(i)}t=new Pm(t.query,t.docs,t.Ot,e,t.Lt,t.fromCache,t.qt,!0)}var o=!1;return this.V_?this.p_(t)&&(this.g_.next(t),o=!0):this.b_(t,this.onlineState)&&(this.v_(t),o=!0),this.y_=t,o},HC.prototype.onError=function(t){this.g_.error(t)},HC.prototype.vl=function(t){this.onlineState=t;var e=!1;return this.y_&&!this.V_&&this.b_(this.y_,t)&&(this.v_(this.y_),e=!0),e},HC.prototype.b_=function(t,e){if(!t.fromCache)return!0;var n="Offline"!==e;return!(this.options.S_&&n||t.docs._()&&"Offline"!==e)},HC.prototype.p_=function(t){if(0<t.docChanges.length)return!0;var e=this.y_&&this.y_.hasPendingWrites!==t.hasPendingWrites;return!(!t.qt&&!e)&&!0===this.options.includeMetadataChanges},HC.prototype.v_=function(t){t=Pm.Ut(t.query,t.docs,t.Lt,t.fromCache),this.V_=!0,this.g_.next(t)},HC),UC=(WC.prototype.mh=function(t){this.D_=t},WC.prototype.ts=function(e,r,i,o){var s=this;return r.on()||i.isEqual(Ag.min())?this.C_(e,r):this.D_.Jn(e,o).next(function(t){var n=s.F_(r,t);return(r.hn()||r.an())&&s.Vl(r.en,n,o,i)?s.C_(e,r):(ng()<=Ca.DEBUG&&rg("IndexFreeQueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),i_(r)),s.D_.ts(e,r,i).next(function(e){return n.forEach(function(t){e=e.nt(t.key,t)}),e}))})},WC.prototype.F_=function(n,t){var r=new fm(s_(n));return t.forEach(function(t,e){e instanceof jw&&o_(n,e)&&(r=r.add(e))}),r},WC.prototype.Vl=function(t,e,n,r){if(n.size!==e.size)return!0;var i="F"===t?e.last():e.first();return!!i&&(i.hasPendingWrites||0<i.version.o(r))},WC.prototype.C_=function(t,e){return ng()<=Ca.DEBUG&&rg("IndexFreeQueryEngine","Using full collection scan to execute query:",i_(e)),this.D_.ts(t,e,Ag.min())},WC),jC=(BC.prototype.Or=function(t){return D_.resolve(0===this.jn.length)},BC.prototype.Lr=function(t,e,n,r){var i=this.N_;this.N_++,0<this.jn.length&&this.jn[this.jn.length-1];var o=new P_(i,e,n,r);this.jn.push(o);for(var s=0,a=r;s<a.length;s++){var u=a[s];this.k_=this.k_.add(new eT(u.key,i)),this.Kn.Cs(t,u.key.path.p())}return D_.resolve(o)},BC.prototype.qr=function(t,e){return D_.resolve(this.x_(e))},BC.prototype.Ur=function(t,e){var n=e+1,r=this.M_(n),i=r<0?0:r;return D_.resolve(this.jn.length>i?this.jn[i]:null)},BC.prototype.Wr=function(){return D_.resolve(0===this.jn.length?-1:this.N_-1)},BC.prototype.Qr=function(t){return D_.resolve(this.jn.slice())},BC.prototype.zn=function(t,e){var n=this,r=new eT(e,0),i=new eT(e,Number.POSITIVE_INFINITY),o=[];return this.k_.vt([r,i],function(t){var e=n.x_(t.zh);o.push(e)}),D_.resolve(o)},BC.prototype.Zn=function(t,e){var r=this,i=new fm(fg);return e.forEach(function(t){var e=new eT(t,0),n=new eT(t,Number.POSITIVE_INFINITY);r.k_.vt([e,n],function(t){i=i.add(t.zh)})}),D_.resolve(this.O_(i))},BC.prototype.os=function(t,e){var n=e.path,r=n.length+1,i=n;Dg.W(i)||(i=i.child(""));var o=new eT(new Dg(i),0),s=new fm(fg);return this.k_.St(function(t){var e=t.key.path;return!!n.D(e)&&(e.length===r&&(s=s.add(t.zh)),!0)},o),D_.resolve(this.O_(s))},BC.prototype.O_=function(t){var n=this,r=[];return t.forEach(function(t){var e=n.x_(t);null!==e&&r.push(e)}),r},BC.prototype.Kr=function(n,r){var i=this;ag(0===this.L_(r.batchId,"removed")),this.jn.shift();var o=this.k_;return D_.forEach(r.mutations,function(t){var e=new eT(t.key,r.batchId);return o=o.delete(e),i.ii.Dr(n,t.key)}).next(function(){i.k_=o})},BC.prototype.Gr=function(t){},BC.prototype.pi=function(t,e){var n=new eT(e,0),r=this.k_.Dt(n);return D_.resolve(e.isEqual(r&&r.key))},BC.prototype.zr=function(t){return this.jn.length,D_.resolve()},BC.prototype.L_=function(t,e){return this.M_(t)},BC.prototype.M_=function(t){return 0===this.jn.length?0:t-this.jn[0].batchId},BC.prototype.x_=function(t){var e=this.M_(t);return e<0||e>=this.jn.length?null:this.jn[e]},BC),VC=(qC.prototype.Nn=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,s=this.q_(e);return this.docs=this.docs.nt(r,{Ls:e,size:s,readTime:n}),this.size+=s-o,this.Kn.Cs(t,r.path.p())},qC.prototype.xn=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},qC.prototype.Mn=function(t,e){var n=this.docs.get(e);return D_.resolve(n?n.Ls:null)},qC.prototype.getEntries=function(t,e){var n=this,r=mm();return e.forEach(function(t){var e=n.docs.get(t);r=r.nt(t,e?e.Ls:null)}),D_.resolve(r)},qC.prototype.ts=function(t,e,n){for(var r=wm(),i=new Dg(e.path.child("")),o=this.docs.ut(i);o.wt();){var s=o.dt(),a=s.key,u=s.value,c=u.Ls,h=u.readTime;if(!e.path.D(a.path))break;h.o(n)<=0||c instanceof jw&&o_(e,c)&&(r=r.nt(c.key,c))}return D_.resolve(r)},qC.prototype.B_=function(t,e){return D_.forEach(this.docs,function(t){return e(t)})},qC.prototype.Hs=function(t){return new qC.Ys(this)},qC.prototype.Xs=function(t){return D_.resolve(this.size)},qC);function qC(t,e){this.Kn=t,this.q_=e,this.docs=new om(Dg.P),this.size=0}function BC(t,e){this.Kn=t,this.ii=e,this.jn=[],this.N_=1,this.k_=new fm(eT.Lh)}function WC(){}function HC(t,e,n){this.query=t,this.g_=e,this.V_=!1,this.y_=null,this.onlineState="Unknown",this.options=n||{}}function KC(t){this.oc=t,this.E_=new Tg(function(t){return r_(t)},n_),this.onlineState="Unknown",this.I_=new Set,this.oc.subscribe(this)}function GC(t){var e=this;return(e=LC.call(this)||this).Zs=t,e}VC.Ys=(Es(GC,LC=x_),GC.prototype.qn=function(n){var r=this,i=[];return this.Cn.forEach(function(t,e){e?i.push(r.Zs.Nn(n,e,r.readTime)):r.Zs.xn(t)}),D_.Sn(i)},GC.prototype.On=function(t,e){return this.Zs.Mn(t,e)},GC.prototype.Ln=function(t,e){return this.Zs.getEntries(t,e)},GC);var zC,QC,XC,YC=(EN.prototype.pe=function(t,n){return this.U_.forEach(function(t,e){return n(e)}),D_.resolve()},EN.prototype.ai=function(t){return D_.resolve(this.lastRemoteSnapshotVersion)},EN.prototype.ui=function(t){return D_.resolve(this.W_)},EN.prototype.ri=function(t){return this.highestTargetId=this.j_.next(),D_.resolve(this.highestTargetId)},EN.prototype.ci=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.W_&&(this.W_=e),D_.resolve()},EN.prototype._i=function(t){this.U_.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.j_=new CE(e),this.highestTargetId=e),t.sequenceNumber>this.W_&&(this.W_=t.sequenceNumber)},EN.prototype.li=function(t,e){return this._i(e),this.targetCount+=1,D_.resolve()},EN.prototype.di=function(t,e){return this._i(e),D_.resolve()},EN.prototype.wi=function(t,e){return this.U_.delete(e.target),this.Q_.jh(e.targetId),--this.targetCount,D_.resolve()},EN.prototype.Ei=function(n,r,i){var o=this,s=0,a=[];return this.U_.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.U_.delete(t),a.push(o.Ti(n,e.targetId)),s++)}),D_.Sn(a).next(function(){return s})},EN.prototype.Ii=function(t){return D_.resolve(this.targetCount)},EN.prototype.mi=function(t,e){var n=this.U_.get(e)||null;return D_.resolve(n)},EN.prototype.Ai=function(t,e,n){return this.Q_.Uh(e,n),D_.resolve()},EN.prototype.Pi=function(e,t,n){this.Q_.Qh(t,n);var r=this.persistence.ii,i=[];return r&&t.forEach(function(t){i.push(r.Dr(e,t))}),D_.Sn(i)},EN.prototype.Ti=function(t,e){return this.Q_.jh(e),D_.resolve()},EN.prototype.Vi=function(t,e){var n=this.Q_.Gh(e);return D_.resolve(n)},EN.prototype.pi=function(t,e){return D_.resolve(this.Q_.pi(e))},EN),$C=(_N.prototype.start=function(){return Promise.resolve()},_N.prototype._r=function(){return this.Fi=!1,Promise.resolve()},Object.defineProperty(_N.prototype,"Hi",{get:function(){return this.Fi},enumerable:!1,configurable:!0}),_N.prototype.Yi=function(){},_N.prototype.Xi=function(){},_N.prototype.gr=function(){return this.Kn},_N.prototype.mr=function(t){var e=this.K_[t.Aa()];return e||(e=new jC(this.Kn,this.ii),this.K_[t.Aa()]=e),e},_N.prototype.Rr=function(){return this.qi},_N.prototype.Pr=function(){return this.Qn},_N.prototype.runTransaction=function(t,e,n){var r=this;rg("MemoryPersistence","Starting transaction:",t);var i=new JC(this.Ci.next());return this.ii.z_(),n(i).next(function(t){return r.ii.H_(i).next(function(){return t})}).bn().then(function(t){return i.Wn(),t})},_N.prototype.Y_=function(e,n){return D_.Dn(Object.values(this.K_).map(function(t){return function(){return t.pi(e,n)}}))},_N),JC=(Es(wN,XC=M_),wN),ZC=(bN.Z_=function(t){return new bN(t)},Object.defineProperty(bN.prototype,"tf",{get:function(){if(this.X_)return this.X_;throw sg()},enumerable:!1,configurable:!0}),bN.prototype.Ri=function(t,e,n){return this.J_.Ri(n,e),this.tf.delete(n),D_.resolve()},bN.prototype.gi=function(t,e,n){return this.J_.gi(n,e),this.tf.add(n),D_.resolve()},bN.prototype.Dr=function(t,e){return this.tf.add(e),D_.resolve()},bN.prototype.removeTarget=function(t,e){var n=this;this.J_.jh(e.targetId).forEach(function(t){return n.tf.add(t)});var r=this.persistence.Rr();return r.Vi(t,e.targetId).next(function(t){t.forEach(function(t){return n.tf.add(t)})}).next(function(){return r.wi(t,e)})},bN.prototype.z_=function(){this.X_=new Set},bN.prototype.H_=function(t){var n=this,r=this.persistence.Pr().Hs();return D_.forEach(this.tf,function(e){return n.ef(t,e).next(function(t){t||r.xn(e)})}).next(function(){return n.X_=null,r.apply(t)})},bN.prototype.Nr=function(t,e){var n=this;return this.ef(t,e).next(function(t){t?n.tf.delete(e):n.tf.add(e)})},bN.prototype.G_=function(t){return 0},bN.prototype.ef=function(t,e){var n=this;return D_.Dn([function(){return D_.resolve(n.J_.pi(e))},function(){return n.persistence.Rr().pi(t,e)},function(){return n.persistence.Y_(t,e)}])},bN),tN=(mN.prototype.tu=function(t){this.if=t},mN.prototype.Ha=function(t){this.rf=t},mN.prototype.onMessage=function(t){this.hf=t},mN.prototype.close=function(){this.sf()},mN.prototype.send=function(t){this.nf(t)},mN.prototype.af=function(){this.if()},mN.prototype.uf=function(t){this.rf(t)},mN.prototype.cf=function(t){this.hf(t)},mN),eN={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},nN=(gN.prototype._f=function(t,e){if(e)for(var n in e.ga)e.ga.hasOwnProperty(n)&&(t[n]=e.ga[n]);t["X-Goog-Api-Client"]="gl-js/ fire/7.17.1"},gN.prototype.fu=function(u,r,i){var c=this,h=this.ff(u);return new Promise(function(o,s){var a=new tg;a.listenOnce(Jy.COMPLETE,function(){try{switch(a.getLastErrorCode()){case $y.NO_ERROR:var t=a.getResponseJson();rg("Connection","XHR received:",JSON.stringify(t)),o(t);break;case $y.TIMEOUT:rg("Connection",'RPC "'+u+'" timed out'),s(new Cg(Sg.DEADLINE_EXCEEDED,"Request time out"));break;case $y.HTTP_ERROR:var e=a.getStatus();if(rg("Connection",'RPC "'+u+'" failed with status:',e,"response text:",a.getResponseText()),0<e){var n=a.getResponseJson().error;if(n&&n.status&&n.message){var r=(i=n.status.toLowerCase().replace("_","-"),0<=Object.values(Sg).indexOf(i)?i:Sg.UNKNOWN);s(new Cg(r,n.message))}else s(new Cg(Sg.UNKNOWN,"Server responded with status "+a.getStatus()))}else rg("Connection",'RPC "'+u+'" failed'),s(new Cg(Sg.UNAVAILABLE,"Connection failed."));break;default:sg()}}finally{rg("Connection",'RPC "'+u+'" completed.')}var i});var t=Object.assign({},r);delete t.database;var e=JSON.stringify(t);rg("Connection","XHR sending: ",h+" "+e);var n={"Content-Type":"text/plain"};c._f(n,i),a.send(h,"POST",e,n,15)})},gN.prototype.du=function(t,e,n){return this.fu(t,e,n)},gN.prototype.eu=function(t,e){var n,r,i=[this.lf,"/","google.firestore.v1.Firestore","/",t,"/channel"],o=Yy(),s={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.s.projectId+"/databases/"+this.s.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling};this._f(s.initMessageHeaders,e),qs()||Bs()||0<=Vs().indexOf("Electron/")||0<=(r=Vs()).indexOf("MSIE ")||0<=r.indexOf("Trident/")||0<=Vs().indexOf("MSAppHost/")||"object"==typeof(n="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0)&&void 0!==n.id||(s.httpHeadersOverwriteParam="$httpHeaders");var a=i.join("");function u(t,e){c.listen(t,function(t){try{e(t)}catch(t){setTimeout(function(){throw t},0)}})}rg("Connection","Creating WebChannel: "+a+" "+s);var c=o.createWebChannel(a,s),h=!1,l=!1,f=new tN({nf:function(t){l?rg("Connection","Not sending because WebChannel is closed:",t):(h||(rg("Connection","Opening WebChannel transport."),c.open(),h=!0),rg("Connection","WebChannel sending:",t),c.send(t))},sf:function(){return c.close()}});return u(Zy.EventType.OPEN,function(){l||rg("Connection","WebChannel transport opened.")}),u(Zy.EventType.CLOSE,function(){l||(l=!0,rg("Connection","WebChannel transport closed"),f.uf())}),u(Zy.EventType.ERROR,function(t){l||(l=!0,function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(eg.logLevel<=Ca.WARN){var r=e.map(og);eg.warn.apply(eg,ks(["Firestore (7.17.1): Connection"],r))}}("Connection","WebChannel transport errored:",t),f.uf(new Cg(Sg.UNAVAILABLE,"The operation could not be completed")))}),u(Zy.EventType.MESSAGE,function(t){var e;if(!l){var n=t.data[0];ag(!!n);var r=n.error||(null===(e=n[0])||void 0===e?void 0:e.error);if(r){rg("Connection","WebChannel received error:",r);var i=r.status,o=function(){var t=Zg[i];if(void 0!==t)return im(t)}(),s=r.message;void 0===o&&(o=Sg.INTERNAL,s="Unknown error status: "+i+" with message "+r.message),l=!0,f.uf(new Cg(o,s)),c.close()}else rg("Connection","WebChannel received:",n),f.cf(n)}}),setTimeout(function(){f.af()},0),f},gN.prototype.ff=function(t){var e=eN[t];return this.lf+"/v1/projects/"+this.s.projectId+"/databases/"+this.s.database+"/documents:"+e},gN),rN=(yN.prototype.Lu=function(t){this.If.push(t)},yN.prototype._r=function(){window.removeEventListener("online",this.df),window.removeEventListener("offline",this.Tf)},yN.prototype.mf=function(){window.addEventListener("online",this.df),window.addEventListener("offline",this.Tf)},yN.prototype.wf=function(){rg("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.If;t<e.length;t++)(0,e[t])(0)},yN.prototype.Ef=function(){rg("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.If;t<e.length;t++)(0,e[t])(1)},yN.Oi=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},yN),iN=(vN.prototype.Lu=function(t){},vN.prototype._r=function(){},vN),oN="You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.",sN=(dN.prototype.initialize=function(r){return Ts(this,void 0,void 0,function(){var e,n=this;return Ss(this,function(t){switch(t.label){case 0:return this.Ll=this.Af(r),this.persistence=this.Rf(r),[4,this.persistence.start()];case 1:return t.sent(),this.Pf=this.gf(r),this.$u=this.Vf(r),this.wu=this.yf(r),[4,this.pf(r)];case 2:return e=t.sent(),this.wu.start(e),this.Ol=this.bf(r),this.oc=this.vf(r),this.Sf=this.Df(r),this.Ll.Vu=function(t){return n.oc.vl(t,1)},this.Ol.oc=this.oc,[4,this.Ll.start()];case 3:return t.sent(),[4,this.Ol.start()];case 4:return t.sent(),[4,this.Ol.Pc(this.oc.Xl)];case 5:return t.sent(),[2]}})})},dN.prototype.pf=function(t){return e=t.Cf,Promise.resolve(new nN(e));var e},dN.prototype.Df=function(t){return new MC(this.oc)},dN.prototype.gf=function(t){return null},dN.prototype.Vf=function(t){return $I(this.persistence,new UC,t.Ff)},dN.prototype.Rf=function(t){if(t.Nf.$f)throw new Cg(Sg.FAILED_PRECONDITION,oN);return new $C(ZC.Z_)},dN.prototype.yf=function(t){var e,n=rS(t.Cf.s);return e=t.credentials,new VS(e,n)},dN.prototype.bf=function(t){var e=this;return new WS(this.$u,this.wu,t.ao,function(t){return e.oc.vl(t,0)},new(rN.Oi()?rN:iN))},dN.prototype.Af=function(t){return new dC},dN.prototype.vf=function(t){return AC(this.$u,this.Ol,this.wu,this.Ll,t.Ff,t.ql,!0)},dN.prototype.clearPersistence=function(t,e){throw new Cg(Sg.FAILED_PRECONDITION,oN)},dN),aN=(Es(pN,QC=sN),pN.prototype.Vf=function(t){return $I(this.persistence,new UC,t.Ff)},pN.prototype.gf=function(t){var e=this.persistence.ii.yr;return new KI(e,t.ao)},pN.prototype.Rf=function(t){var e=HE(t.Cf.s,t.Cf.persistenceKey),n=rS(t.Cf.s);return new ME(t.Nf.synchronizeTabs,e,t.clientId,BI.Ho(t.Nf.cacheSizeBytes),t.ao,DI(),"undefined"!=typeof document?document:null,n,this.Ll,t.Nf.Di)},pN.prototype.Af=function(t){return new dC},pN.prototype.clearPersistence=function(t,e){return function(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return bI.Oi()?(e=n+"main",[4,bI.delete(e)]):[2,Promise.resolve()];case 1:return t.sent(),[2]}})})}(HE(t,e))},Es(fN,zC=pN),fN.prototype.initialize=function(e){return Ts(this,void 0,void 0,function(){var n=this;return Ss(this,function(t){switch(t.label){case 0:return[4,zC.prototype.initialize.call(this,e)];case 1:return t.sent(),[4,this.persistence.zi(function(e){return Ts(n,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,OC(this.oc,e)];case 1:return t.sent(),this.Pf&&(e&&!this.Pf.Hi?this.Pf.start(this.$u):e||this.Pf.stop()),[2]}})})})];case 2:return t.sent(),[4,function(r){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){return e=ug(r),n=ug(e.Eh),[2,e.persistence.runTransaction("Synchronize last document change read time","readonly",function(t){return n.zs(t)}).then(function(t){e.Th=t})]})})}(this.$u)];case 3:return t.sent(),[2]}})})},fN.prototype.vf=function(t){var e=!t.Nf.$f||!t.Nf.synchronizeTabs,n=AC(this.$u,this.Ol,this.wu,this.Ll,t.Ff,t.ql,e);return this.Ll instanceof pC&&(this.Ll.oc={cl:kC.bind(null,n),ll:DC.bind(null,n),_l:function(l,f,p){return Ts(this,void 0,void 0,function(){var n,e,r,i,o,s,a,u,c,h;return Ss(this,function(t){switch(t.label){case 0:if(!(n=ug(l)).Jl)return[3,10];e=0,r=f,t.label=1;case 1:return e<r.length?(i=r[e],n.Wl.has(i)?(rg("SyncEngine","Adding an already active target "+i),[3,5]):[4,JI(n.$u,i)]):[3,6];case 2:return o=t.sent(),[4,n.$u.Nh(o)];case 3:return s=t.sent(),[4,n.t_(RC(o),s.targetId,!1)];case 4:t.sent(),n.Ol.listen(s),t.label=5;case 5:return e++,[3,1];case 6:a=function(e){return Ss(this,function(t){switch(t.label){case 0:return n.Wl.has(e)?[4,n.$u.kh(e,!1).then(function(){n.Ol.ic(e),n.n_(e)}).catch(ZI)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})},u=0,c=p,t.label=7;case 7:return u<c.length?(h=c[u],[5,a(h)]):[3,10];case 8:t.sent(),t.label=9;case 9:return u++,[3,7];case 10:return[2]}})})}.bind(null,n),Ir:function(t){var e=ug(t);return ug(ug(e.$u).persistence).Ir()}.bind(null,n)}),n},fN.prototype.Af=function(t){if(t.Nf.$f&&t.Nf.synchronizeTabs){var e=DI();if(!pC.Oi(e))throw new Cg(Sg.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var n=HE(t.Cf.s,t.Cf.persistenceKey);return new pC(e,t.ao,n,t.clientId,t.Ff)}return new dC},fN),uN=(lN.prototype.start=function(t,e,n){var r=this;this.kf(),this.Cf=t;var i=new Q_,o=new Q_,s=!1;return this.credentials.pa(function(t){if(!s)return s=!0,rg("FirestoreClient","Initializing. user=",t.uid),r.xf(e,n,t,o).then(i.resolve,i.reject);r.ao.er(function(){return r.Ol.Rc(t)})}),this.ao.Zi(function(){return i.promise}),o.promise},lN.prototype.enableNetwork=function(){var t=this;return this.kf(),this.ao.enqueue(function(){return t.persistence.Xi(!0),t.Ol.enableNetwork()})},lN.prototype.xf=function(r,i,o,s){return Ts(this,void 0,void 0,function(){var e,n=this;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,r.initialize({ao:this.ao,Cf:this.Cf,clientId:this.clientId,credentials:this.credentials,Ff:o,ql:100,Nf:i})];case 1:return t.sent(),this.persistence=r.persistence,this.Ll=r.Ll,this.$u=r.$u,this.Ol=r.Ol,this.oc=r.oc,this.Pf=r.Pf,this.Mf=r.Sf,this.persistence.Yi(function(){return Ts(n,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}})})}),s.resolve(),[3,3];case 2:if(e=t.sent(),s.reject(e),!this.Of(e))throw e;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+e),this.xf(new sN,{$f:!1},o,s))];case 3:return[2]}})})},lN.prototype.Of=function(t){return"FirebaseError"===t.name?t.code===Sg.FAILED_PRECONDITION||t.code===Sg.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},lN.prototype.kf=function(){if(this.ao.yo)throw new Cg(Sg.FAILED_PRECONDITION,"The client has already been terminated.")},lN.prototype.disableNetwork=function(){var t=this;return this.kf(),this.ao.enqueue(function(){return t.persistence.Xi(!1),t.Ol.disableNetwork()})},lN.prototype.terminate=function(){var t=this;return this.ao.Do(function(){return Ts(t,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.Pf&&this.Pf.stop(),[4,this.Ol._r()];case 1:return t.sent(),[4,this.Ll._r()];case 2:return t.sent(),[4,this.persistence._r()];case 3:return t.sent(),this.credentials.ba(),[2]}})})})},lN.prototype.waitForPendingWrites=function(){var t=this;this.kf();var e=new Q_;return this.ao.Zi(function(){return t.oc.u_(e)}),e.promise},lN.prototype.listen=function(t,e,n){var r=this;this.kf();var i=new FC(t,e,n);return this.ao.Zi(function(){return r.Mf.listen(i)}),i},lN.prototype.ic=function(t){var e=this;this.Lf||this.ao.Zi(function(){return e.Mf.ic(t)})},lN.prototype.qf=function(o){return Ts(this,void 0,void 0,function(){var i,e=this;return Ss(this,function(t){switch(t.label){case 0:return this.kf(),i=new Q_,[4,this.ao.enqueue(function(){return Ts(e,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.$u.$h(o)];case 1:return(e=t.sent())instanceof jw?i.resolve(e):e instanceof Vw?i.resolve(null):i.reject(new Cg(Sg.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.)")),[3,3];case 2:return n=t.sent(),r=UI(n,"Failed to get document '"+o+" from cache"),i.reject(r),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),i.promise)]}})})},lN.prototype.Bf=function(u){return Ts(this,void 0,void 0,function(){var a,e=this;return Ss(this,function(t){switch(t.label){case 0:return this.kf(),a=new Q_,[4,this.ao.enqueue(function(){return Ts(e,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.$u.xh(u,!0)];case 1:return e=t.sent(),n=new vC(u,e.Mh),r=n.Rl(e.documents),i=n.qn(r,!1),a.resolve(i.snapshot),[3,3];case 2:return o=t.sent(),s=UI(o,"Failed to execute query '"+u+" against cache"),a.reject(s),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),a.promise)]}})})},lN.prototype.write=function(t){var e=this;this.kf();var n=new Q_;return this.ao.Zi(function(){return e.oc.write(t,n)}),n.promise},lN.prototype.s=function(){return this.Cf.s},lN.prototype.R_=function(t){var e=this;this.kf(),this.ao.Zi(function(){return e.Mf.R_(t),Promise.resolve()})},lN.prototype.P_=function(t){var e=this;this.Lf||this.ao.Zi(function(){return e.Mf.P_(t),Promise.resolve()})},Object.defineProperty(lN.prototype,"Lf",{get:function(){return this.ao.yo},enumerable:!1,configurable:!0}),lN.prototype.transaction=function(t){var e=this;this.kf();var n=new Q_;return this.ao.Zi(function(){return e.oc.runTransaction(e.ao,t,n),Promise.resolve()}),n.promise},lN),cN=(hN.prototype.next=function(t){this.Uf(this.observer.next,t)},hN.prototype.error=function(t){this.Uf(this.observer.error,t)},hN.prototype.Wf=function(){this.muted=!0},hN.prototype.Uf=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},hN);function hN(t){this.observer=t,this.muted=!1}function lN(t,e){this.credentials=t,this.ao=e,this.clientId=hg.t()}function fN(){return null!==zC&&zC.apply(this,arguments)||this}function pN(){return null!==QC&&QC.apply(this,arguments)||this}function dN(){}function vN(){}function yN(){var t=this;this.df=function(){return t.wf()},this.Tf=function(){return t.Ef()},this.If=[],this.mf()}function gN(t){this.s=t.s;var e=t.ssl?"https":"http";this.lf=e+"://"+t.host,this.forceLongPolling=t.forceLongPolling}function mN(t){this.nf=t.nf,this.sf=t.sf}function bN(t){this.persistence=t,this.J_=new tT,this.X_=null}function wN(t){var e=this;return(e=XC.call(this)||this).vi=t,e}function _N(t){var e=this;this.K_={},this.Ci=new j_(0),this.Fi=!1,this.Fi=!0,this.ii=t(this),this.qi=new YC(this),this.Kn=new eE,this.Qn=new VC(this.Kn,function(t){return e.ii.G_(t)})}function EN(t){this.persistence=t,this.U_=new Tg(function(t){return zg(t)},Qg),this.lastRemoteSnapshotVersion=Ag.min(),this.highestTargetId=0,this.W_=0,this.Q_=new tT,this.targetCount=0,this.j_=CE.ni()}function IN(i){return function(){if("object"==typeof i&&null!==i)for(var t=i,e=0,n=["next","error","complete"];e<n.length;e++){var r=n[e];if(r in t&&"function"==typeof t[r])return 1}}()}var TN=(ON.prototype.Kf=function(t){switch(Qm(t)){case 0:return null;case 1:return t.booleanValue;case 2:return eb(t.integerValue||t.doubleValue);case 3:return this.Gf(t.timestampValue);case 4:return this.zf(t);case 5:return t.stringValue;case 6:return new NT(nb(t.bytesValue));case 7:return this.Hf(t.referenceValue);case 8:return this.Yf(t.geoPointValue);case 9:return this.Jf(t.arrayValue);case 10:return this.Xf(t.mapValue);default:throw sg()}},ON.prototype.Xf=function(t){var n=this,r={};return bg(t.fields||{},function(t,e){r[t]=n.Kf(e)}),r},ON.prototype.Yf=function(t){return new XT(eb(t.latitude),eb(t.longitude))},ON.prototype.Jf=function(t){var e=this;return(t.values||[]).map(function(t){return e.Kf(t)})},ON.prototype.zf=function(t){switch(this.Qf){case"previous":var e=function t(e){var n=e.mapValue.fields.__previous_value__;return Km(n)?t(n):n}(t);return null==e?null:this.Kf(e);case"estimate":return this.Gf(Gm(t));default:return null}},ON.prototype.Gf=function(t){var e=tb(t),n=new Ng(e.seconds,e.nanos);return this.timestampsInSnapshots?n:n.toDate()},ON.prototype.Hf=function(t){var e=Og.N(t);ag(Lb(e));var n=new yg(e.get(1),e.get(3)),r=new Dg(e.V(5));return n.isEqual(this.s)||ig("Document "+r+" contains a document reference within a different database ("+n.projectId+"/"+n.database+") which is not supported. It will be treated as a reference in the current database ("+this.s.projectId+"/"+this.s.database+") instead."),this.jf(r)},ON),SN=BI.Xo,CN=(kN.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.timestampsInSnapshots===t.timestampsInSnapshots&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.forceLongPolling===t.forceLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},kN),NN=(Object.defineProperty(AN.prototype,"ud",{get:function(){return this.ld||(this.ld=new fS(this.aa,this.ad.ignoreUndefinedProperties)),this.ld},enumerable:!1,configurable:!0}),AN.prototype.settings=function(t){oT("Firestore.settings",arguments,1),uT("Firestore.settings","object",1,t);var e=new CN(t);if(this.nd&&!this.ad.isEqual(e))throw new Cg(Sg.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.");void 0!==(this.ad=e).credentials&&(this.od=function(t){if(!t)return new DS;switch(t.type){case"gapi":var e=t._d;return ag(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new MS(e,t.$a||"0");case"provider":return t._d;default:throw new Cg(Sg.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(e.credentials))},AN.prototype.enableNetwork=function(){return this.ed(),this.nd.enableNetwork()},AN.prototype.disableNetwork=function(){return this.ed(),this.nd.disableNetwork()},AN.prototype.enablePersistence=function(t){var e,n;if(this.nd)throw new Cg(Sg.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");var r=!1,i=!1;if(t&&(void 0!==t.experimentalTabSynchronization&&ig("The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."),r=null!==(n=null!==(e=t.synchronizeTabs)&&void 0!==e?e:t.experimentalTabSynchronization)&&void 0!==n&&n,i=!!t.experimentalForceOwningTab&&t.experimentalForceOwningTab,r&&i))throw new Cg(Sg.INVALID_ARGUMENT,"The 'experimentalForceOwningTab' setting cannot be used with 'synchronizeTabs'.");return this.fd(this.hd,{$f:!0,cacheSizeBytes:this.ad.cacheSizeBytes,synchronizeTabs:r,Di:i})},AN.prototype.clearPersistence=function(){return Ts(this,void 0,void 0,function(){var n,e=this;return Ss(this,function(t){if(void 0!==this.nd&&!this.nd.Lf)throw new Cg(Sg.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");return n=new Q_,[2,(this.td.po(function(){return Ts(e,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.hd.clearPersistence(this.aa,this.rd)];case 1:return t.sent(),n.resolve(),[3,3];case 2:return e=t.sent(),n.reject(e),[3,3];case 3:return[2]}})})}),n.promise)]})})},AN.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.INTERNAL.delete()},Object.defineProperty(AN.prototype,"dd",{get:function(){return this.ed(),this.nd.Lf},enumerable:!1,configurable:!0}),AN.prototype.waitForPendingWrites=function(){return this.ed(),this.nd.waitForPendingWrites()},AN.prototype.onSnapshotsInSync=function(t){if(this.ed(),IN(t))return PN(this.nd,t);uT("Firestore.onSnapshotsInSync","function",1,t);var e={next:t};return PN(this.nd,e)},AN.prototype.ed=function(){return this.nd||this.fd(new sN,{$f:!1}),this.nd},AN.prototype.wd=function(){return new vg(this.aa,this.rd,this.ad.host,this.ad.ssl,this.ad.forceLongPolling)},AN.prototype.fd=function(t,e){var n=this.wd();return this.nd=new uN(this.od,this.td),this.nd.start(n,t,e)},AN.sd=function(t){if(e=t.options,!Object.prototype.hasOwnProperty.call(e,"projectId"))throw new Cg(Sg.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var e,n=t.options.projectId;if(!n||"string"!=typeof n)throw new Cg(Sg.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new yg(n)},Object.defineProperty(AN.prototype,"app",{get:function(){if(!this.Zf)throw new Cg(Sg.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.Zf},enumerable:!1,configurable:!0}),AN.prototype.collection=function(t){return oT("Firestore.collection",arguments,1),uT("Firestore.collection","non-empty string",1,t),this.ed(),new nA(Og.N(t),this,null)},AN.prototype.doc=function(t){return oT("Firestore.doc",arguments,1),uT("Firestore.doc","non-empty string",1,t),this.ed(),LN.Td(Og.N(t),this,null)},AN.prototype.collectionGroup=function(t){if(oT("Firestore.collectionGroup",arguments,1),uT("Firestore.collectionGroup","non-empty string",1,t),0<=t.indexOf("/"))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid collection ID '"+t+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return this.ed(),new $N((e=t,new Gw(Og.k(),e)),this,null);var e},AN.prototype.runTransaction=function(e){var n=this;return oT("Firestore.runTransaction",arguments,1),uT("Firestore.runTransaction","function",1,e),this.ed().transaction(function(t){return e(new DN(n,t))})},AN.prototype.batch=function(){return this.ed(),new xN(this)},Object.defineProperty(AN,"logLevel",{get:function(){switch(ng()){case Ca.DEBUG:return"debug";case Ca.ERROR:return"error";case Ca.SILENT:return"silent";case Ca.WARN:return"warn";case Ca.INFO:return"info";case Ca.VERBOSE:return"verbose";default:return"error"}},enumerable:!1,configurable:!0}),AN.setLogLevel=function(t){oT("Firestore.setLogLevel",arguments,1),pT("setLogLevel",["debug","error","silent","warn","info","verbose"],1,t),eg.setLogLevel(t)},AN.prototype.Ed=function(){return this.ad.timestampsInSnapshots},AN);function AN(t,e,n){var r=this;if(void 0===n&&(n=new sN),this.Zf=null,this.td=new LI,this.INTERNAL={delete:function(){return Ts(r,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.ed(),[4,this.nd.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){var i=t;this.Zf=i,this.aa=AN.sd(i),this.rd=i.name,this.od=new xS(e)}else{var o=t;if(!o.projectId)throw new Cg(Sg.INVALID_ARGUMENT,"Must provide projectId");this.aa=new yg(o.projectId,o.database),this.rd="[DEFAULT]",this.od=new DS}this.hd=n,this.ad=new CN({})}function kN(t){var e,n,r,i;if(void 0===t.host){if(void 0!==t.ssl)throw new Cg(Sg.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else hT("settings","non-empty string","host",t.host),this.host=t.host,lT("settings","boolean","ssl",t.ssl),this.ssl=null===(e=t.ssl)||void 0===e||e;if(mT("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling","ignoreUndefinedProperties"]),lT("settings","object","credentials",t.credentials),this.credentials=t.credentials,lT("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),lT("settings","boolean","ignoreUndefinedProperties",t.ignoreUndefinedProperties),!0===t.timestampsInSnapshots?ig("The setting 'timestampsInSnapshots: true' is no longer required and should be removed."):!1===t.timestampsInSnapshots&&ig("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),this.timestampsInSnapshots=null===(n=t.timestampsInSnapshots)||void 0===n||n,this.ignoreUndefinedProperties=null!==(r=t.ignoreUndefinedProperties)&&void 0!==r&&r,lT("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=BI.th;else{if(t.cacheSizeBytes!==SN&&t.cacheSizeBytes<BI.Zo)throw new Cg(Sg.INVALID_ARGUMENT,"cacheSizeBytes must be at least "+BI.Zo);this.cacheSizeBytes=t.cacheSizeBytes}lT("settings","boolean","experimentalForceLongPolling",t.experimentalForceLongPolling),this.forceLongPolling=null!==(i=t.experimentalForceLongPolling)&&void 0!==i&&i}function ON(t,e,n,r){this.s=t,this.timestampsInSnapshots=e,this.Qf=n,this.jf=r}function PN(t,e){var n=new cN({next:function(){e.next&&e.next()},error:function(t){throw sg()}});return t.R_(n),function(){n.Wf(),t.P_(n)}}var RN,DN=(UN.prototype.get=function(t){var n=this;oT("Transaction.get",arguments,1);var r=uA("Transaction.get",t,this.Id);return this.md.Au([r.ua]).then(function(t){if(!t||1!==t.length)return sg();var e=t[0];if(e instanceof Vw)return new BN(n.Id,r.ua,null,!1,!1,r.ca);if(e instanceof jw)return new BN(n.Id,r.ua,e,!1,!1,r.ca);throw sg()})},UN.prototype.set=function(t,e,n){aT("Transaction.set",arguments,2,3);var r=uA("Transaction.set",t,this.Id);n=oA("Transaction.set",n);var i=cA(r.ca,e,n),o=vS(this.Id.ud,"Transaction.set",r.ua,i,null!==r.ca,n);return this.md.set(r.ua,o),this},UN.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return i="string"==typeof e||e instanceof kT?(sT("Transaction.update",arguments,3),r=uA("Transaction.update",t,this.Id),gS(this.Id.ud,"Transaction.update",r.ua,e,n,o)):(oT("Transaction.update",arguments,2),r=uA("Transaction.update",t,this.Id),yS(this.Id.ud,"Transaction.update",r.ua,e)),this.md.update(r.ua,i),this},UN.prototype.delete=function(t){oT("Transaction.delete",arguments,1);var e=uA("Transaction.delete",t,this.Id);return this.md.delete(e.ua),this},UN),xN=(FN.prototype.set=function(t,e,n){aT("WriteBatch.set",arguments,2,3),this.Pd();var r=uA("WriteBatch.set",t,this.Id);n=oA("WriteBatch.set",n);var i=cA(r.ca,e,n),o=vS(this.Id.ud,"WriteBatch.set",r.ua,i,null!==r.ca,n);return this.Ad=this.Ad.concat(o.la(r.ua,iw.We())),this},FN.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return this.Pd(),i="string"==typeof e||e instanceof kT?(sT("WriteBatch.update",arguments,3),r=uA("WriteBatch.update",t,this.Id),gS(this.Id.ud,"WriteBatch.update",r.ua,e,n,o)):(oT("WriteBatch.update",arguments,2),r=uA("WriteBatch.update",t,this.Id),yS(this.Id.ud,"WriteBatch.update",r.ua,e)),this.Ad=this.Ad.concat(i.la(r.ua,iw.exists(!0))),this},FN.prototype.delete=function(t){oT("WriteBatch.delete",arguments,1),this.Pd();var e=uA("WriteBatch.delete",t,this.Id);return this.Ad=this.Ad.concat(new Cw(e.ua,iw.We())),this},FN.prototype.commit=function(){return this.Pd(),this.Rd=!0,0<this.Ad.length?this.Id.ed().write(this.Ad):Promise.resolve()},FN.prototype.Pd=function(){if(this.Rd)throw new Cg(Sg.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},FN),LN=(Es(MN,RN=oS),MN.Td=function(t,e,n){if(t.length%2!=0)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.$()+" has "+t.length);return new MN(new Dg(t),e,n)},Object.defineProperty(MN.prototype,"id",{get:function(){return this.ua.path.S()},enumerable:!1,configurable:!0}),Object.defineProperty(MN.prototype,"parent",{get:function(){return new nA(this.ua.path.p(),this.firestore,this.ca)},enumerable:!1,configurable:!0}),Object.defineProperty(MN.prototype,"path",{get:function(){return this.ua.path.$()},enumerable:!1,configurable:!0}),MN.prototype.collection=function(t){if(oT("DocumentReference.collection",arguments,1),uT("DocumentReference.collection","non-empty string",1,t),!t)throw new Cg(Sg.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var e=Og.N(t);return new nA(this.ua.path.child(e),this.firestore,null)},MN.prototype.isEqual=function(t){if(!(t instanceof MN))throw bT("isEqual","DocumentReference",1,t);return this.firestore===t.firestore&&this.ua.isEqual(t.ua)&&this.ca===t.ca},MN.prototype.set=function(t,e){aT("DocumentReference.set",arguments,1,2),e=oA("DocumentReference.set",e);var n=cA(this.ca,t,e),r=vS(this.firestore.ud,"DocumentReference.set",this.ua,n,null!==this.ca,e);return this.nd.write(r.la(this.ua,iw.We()))},MN.prototype.update=function(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return n="string"==typeof t||t instanceof kT?(sT("DocumentReference.update",arguments,2),gS(this.firestore.ud,"DocumentReference.update",this.ua,t,e,r)):(oT("DocumentReference.update",arguments,1),yS(this.firestore.ud,"DocumentReference.update",this.ua,t)),this.nd.write(n.la(this.ua,iw.exists(!0)))},MN.prototype.delete=function(){return oT("DocumentReference.delete",arguments,0),this.nd.write([new Cw(this.ua,iw.We())])},MN.prototype.onSnapshot=function(){for(var t,e,n,r=this,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];aT("DocumentReference.onSnapshot",arguments,1,4);var s={includeMetadataChanges:!1},a=0;"object"!=typeof i[a]||IN(i[a])||(mT("DocumentReference.onSnapshot",s=i[a],["includeMetadataChanges"]),lT("DocumentReference.onSnapshot","boolean","includeMetadataChanges",s.includeMetadataChanges),a++);var u={includeMetadataChanges:s.includeMetadataChanges};if(IN(i[a])){var c=i[a];i[a]=null===(t=c.next)||void 0===t?void 0:t.bind(c),i[a+1]=null===(e=c.error)||void 0===e?void 0:e.bind(c),i[a+2]=null===(n=c.complete)||void 0===n?void 0:n.bind(c)}else uT("DocumentReference.onSnapshot","function",a,i[a]),cT("DocumentReference.onSnapshot","function",a+1,i[a+1]),cT("DocumentReference.onSnapshot","function",a+2,i[a+2]);var h={next:function(t){i[a]&&i[a](r.gd(t))},error:i[a+1],complete:i[a+2]};return jN(this.nd,this.ua,u,h)},MN.prototype.get=function(t){var e,n,r,i,o,s=this;return aT("DocumentReference.get",arguments,0,1),aA("DocumentReference.get",t),t&&"cache"===t.source?this.firestore.ed().qf(this.ua).then(function(t){return new BN(s.firestore,s.ua,t,!0,t instanceof jw&&t.Ke,s.ca)}):(e=this.nd,n=this.ua,r=t,i=new Q_,o=jN(e,n,{includeMetadataChanges:!0,S_:!0},{next:function(t){o();var e=t.docs.has(n);!e&&t.fromCache?i.reject(new Cg(Sg.UNAVAILABLE,"Failed to get document because the client is offline.")):e&&t.fromCache&&r&&"server"===r.source?i.reject(new Cg(Sg.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.)')):i.resolve(t)},error:function(t){return i.reject(t)}}),i.promise.then(function(t){return s.gd(t)}))},MN.prototype.withConverter=function(t){return new MN(this.ua,this.firestore,t)},MN.prototype.gd=function(t){var e=t.docs.get(this.ua);return new BN(this.firestore,this.ua,e,t.fromCache,t.hasPendingWrites,this.ca)},MN);function MN(t,e,n){var r=this;return(r=RN.call(this,e.aa,t,n)||this).ua=t,r.firestore=e,r.ca=n,r.nd=r.firestore.ed(),r}function FN(t){this.Id=t,this.Ad=[],this.Rd=!1}function UN(t,e){this.Id=t,this.md=e}function jN(t,e,n,r){var i=function(t){console.error("Uncaught Error in onSnapshot:",t)};r.error&&(i=r.error.bind(r));var o=new cN({next:function(t){r.next&&r.next(t)},error:i}),s=t.listen(Xw(e.path),o,n);return function(){o.Wf(),t.ic(s)}}var VN,qN=(GN.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},GN),BN=(KN.prototype.data=function(t){var e=this;if(aT("DocumentSnapshot.data",arguments,0,1),t=sA("DocumentSnapshot.data",t),this.Vd){if(this.ca){var n=new WN(this.Id,this.ua,this.Vd,this.yd,this.pd,null);return this.ca.fromFirestore(n,t)}return new TN(this.Id.aa,this.Id.Ed(),t.serverTimestamps||"none",function(t){return new LN(t,e.Id,null)}).Kf(this.Vd.Ze())}},KN.prototype.get=function(t,e){var n=this;if(aT("DocumentSnapshot.get",arguments,1,2),e=sA("DocumentSnapshot.get",e),this.Vd){var r=this.Vd.data().field(IS("DocumentSnapshot.get",t,this.ua));if(null!==r)return new TN(this.Id.aa,this.Id.Ed(),e.serverTimestamps||"none",function(t){return new LN(t,n.Id,n.ca)}).Kf(r)}},Object.defineProperty(KN.prototype,"id",{get:function(){return this.ua.path.S()},enumerable:!1,configurable:!0}),Object.defineProperty(KN.prototype,"ref",{get:function(){return new LN(this.ua,this.Id,this.ca)},enumerable:!1,configurable:!0}),Object.defineProperty(KN.prototype,"exists",{get:function(){return null!==this.Vd},enumerable:!1,configurable:!0}),Object.defineProperty(KN.prototype,"metadata",{get:function(){return new qN(this.pd,this.yd)},enumerable:!1,configurable:!0}),KN.prototype.isEqual=function(t){if(!(t instanceof KN))throw bT("isEqual","DocumentSnapshot",1,t);return this.Id===t.Id&&this.yd===t.yd&&this.ua.isEqual(t.ua)&&(null===this.Vd?null===t.Vd:this.Vd.isEqual(t.Vd))&&this.ca===t.ca},KN),WN=(Es(HN,VN=BN),HN.prototype.data=function(t){return VN.prototype.data.call(this,t)},HN);function HN(){return null!==VN&&VN.apply(this,arguments)||this}function KN(t,e,n,r,i,o){this.Id=t,this.ua=e,this.Vd=n,this.yd=r,this.pd=i,this.ca=o}function GN(t,e){this.hasPendingWrites=t,this.fromCache=e}function zN(t,e,n){if("string"==typeof n){if(""===n)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!Yw(e)&&-1!==n.indexOf("/"))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '"+n+"' contains a '/' character.");var r=e.path.child(Og.N(n));if(!Dg.W(r))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '"+r+"' is not because it has an odd number of segments ("+r.length+").");return rb(t,new Dg(r))}if(n instanceof oS)return rb(t,n.ua);throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+yT(n)+".")}function QN(t,e){if(!Array.isArray(t)||0===t.length)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(10<t.length)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.");if(0<=t.indexOf(null))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'null' in the value array.");if(0<t.filter(function(t){return Number.isNaN(t)}).length)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'NaN' in the value array.")}function XN(t,e,n){if(!n.isEqual(e))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}function YN(t){if(t.an()&&0===t.tn.length)throw new Cg(Sg.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var $N=(JN.prototype.where=function(t,e,n){oT("Query.where",arguments,3),gT("Query.where",3,n);var r,i,o,s=pT("Query.where",["<","<=","==",">=",">","array-contains","in","array-contains-any"],2,e),a=IS("Query.where",t),u=function(t,e,n,r,i,o,s){var a;if(i.O()){if("array-contains"===o||"array-contains-any"===o)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+o+"' queries on FieldPath.documentId().");if("in"===o){QN(s,o);for(var u=[],c=0,h=s;c<h.length;c++){var l=h[c];u.push(zN(r,t,l))}a={arrayValue:{values:u}}}else a=zN(r,t,s)}else"in"!==o&&"array-contains-any"!==o||QN(s,o),a=mS(n,e,s,"in"===o);var f=u_.create(i,o,a);return function(t,e){if(e instanceof u_){var n=["array-contains","array-contains-any"],r=["in","array-contains-any"],i=0<=n.indexOf(e.op),o=0<=r.indexOf(e.op);if(e.ln()){var s=t.cn();if(null!==s&&!s.isEqual(e.field))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+s.toString()+"' and '"+e.field.toString()+"'");var a=t.un();null!==a&&XN(0,e.field,a)}else if(o||i){var u=null;if(o&&(u=t._n(r)),null===u&&i&&(u=t._n(n)),null!==u)throw u===e.op?new Cg(Sg.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new Cg(Sg.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+u.toString()+"' filters.")}}}(t,f),f}(this.bd,"Query.where",this.firestore.ud,this.firestore.aa,a,s,n);return new JN((r=this.bd,i=u,o=r.filters.concat([i]),new Gw(r.path,r.collectionGroup,r.tn.slice(),o,r.limit,r.en,r.startAt,r.endAt)),this.firestore,this.ca)},JN.prototype.orderBy=function(t,e){var n;if(aT("Query.orderBy",arguments,1,2),cT("Query.orderBy","non-empty string",2,e),void 0===e||"asc"===e)n="asc";else{if("desc"!==e)throw new Cg(Sg.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+e+"', expected 'asc' or 'desc'.");n="desc"}var r,i,o,s=IS("Query.orderBy",t),a=function(t,e,n){if(null!==t.startAt)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r=new k_(e,n);return function(t,e){if(null===t.un()){var n=t.cn();null!==n&&XN(0,n,e.field)}}(t,r),r}(this.bd,s,n);return new JN((r=this.bd,i=a,o=r.tn.concat([i]),new Gw(r.path,r.collectionGroup,o,r.filters.slice(),r.limit,r.en,r.startAt,r.endAt)),this.firestore,this.ca)},JN.prototype.limit=function(t){return oT("Query.limit",arguments,1),uT("Query.limit","number",1,t),wT("Query.limit",1,t),new JN(Zw(this.bd,t,"F"),this.firestore,this.ca)},JN.prototype.limitToLast=function(t){return oT("Query.limitToLast",arguments,1),uT("Query.limitToLast","number",1,t),wT("Query.limitToLast",1,t),new JN(Zw(this.bd,t,"L"),this.firestore,this.ca)},JN.prototype.startAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];sT("Query.startAt",arguments,1);var r=this.vd("Query.startAt",t,e,!0);return new JN(t_(this.bd,r),this.firestore,this.ca)},JN.prototype.startAfter=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];sT("Query.startAfter",arguments,1);var r=this.vd("Query.startAfter",t,e,!1);return new JN(t_(this.bd,r),this.firestore,this.ca)},JN.prototype.endBefore=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];sT("Query.endBefore",arguments,1);var r=this.vd("Query.endBefore",t,e,!0);return new JN(e_(this.bd,r),this.firestore,this.ca)},JN.prototype.endAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];sT("Query.endAt",arguments,1);var r=this.vd("Query.endAt",t,e,!1);return new JN(e_(this.bd,r),this.firestore,this.ca)},JN.prototype.isEqual=function(t){if(!(t instanceof JN))throw bT("isEqual","Query",1,t);return this.firestore===t.firestore&&n_(this.bd,t.bd)&&this.ca===t.ca},JN.prototype.withConverter=function(t){return new JN(this.bd,this.firestore,t)},JN.prototype.vd=function(t,e,n,r){if(gT(t,1,e),e instanceof BN)return oT(t,ks([e],n),1),function(t,e,n,r,i){if(!r)throw new Cg(Sg.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+n+"().");for(var o=[],s=0,a=$w(t);s<a.length;s++){var u=a[s];if(u.field.O())o.push(rb(e,r.key));else{var c=r.field(u.field);if(Km(c))throw new Cg(Sg.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+u.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===c){var h=u.field.$();throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+h+"' (used as the orderBy) does not exist.")}o.push(c)}}return new w_(o,i)}(this.bd,this.firestore.aa,t,e.Vd,r);var i=[e].concat(n);return function(t,e,n,r,i,o){var s=t.tn;if(i.length>s.length)throw new Cg(Sg.INVALID_ARGUMENT,"Too many arguments provided to "+r+"(). The number of arguments must be less than or equal to the number of orderBy() clauses");for(var a=[],u=0;u<i.length;u++){var c=i[u];if(s[u].field.O()){if("string"!=typeof c)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+r+"(), but got a "+typeof c);if(!Yw(t)&&-1!==c.indexOf("/"))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to "+r+"() must be a plain document ID, but '"+c+"' contains a slash.");var h=t.path.child(Og.N(c));if(!Dg.W(h))throw new Cg(Sg.INVALID_ARGUMENT,"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to "+r+"() must result in a valid document path, but '"+h+"' is not because it contains an odd number of segments.");var l=new Dg(h);a.push(rb(e,l))}else{var f=mS(n,r,c);a.push(f)}}return new w_(a,o)}(this.bd,this.firestore.aa,this.firestore.ud,t,i,r)},JN.prototype.onSnapshot=function(){for(var t,e,n,r=this,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];aT("Query.onSnapshot",arguments,1,4);var s={},a=0;if("object"!=typeof i[a]||IN(i[a])||(mT("Query.onSnapshot",s=i[a],["includeMetadataChanges"]),lT("Query.onSnapshot","boolean","includeMetadataChanges",s.includeMetadataChanges),a++),IN(i[a])){var u=i[a];i[a]=null===(t=u.next)||void 0===t?void 0:t.bind(u),i[a+1]=null===(e=u.error)||void 0===e?void 0:e.bind(u),i[a+2]=null===(n=u.complete)||void 0===n?void 0:n.bind(u)}else uT("Query.onSnapshot","function",a,i[a]),cT("Query.onSnapshot","function",a+1,i[a+1]),cT("Query.onSnapshot","function",a+2,i[a+2]);var c={next:function(t){i[a]&&i[a](new eA(r.firestore,r.bd,t,r.ca))},error:i[a+1],complete:i[a+2]};return YN(this.bd),ZN(this.firestore.ed(),this.bd,s,c)},JN.prototype.get=function(t){var e=this;aT("Query.get",arguments,0,1),aA("Query.get",t),YN(this.bd);var n,r,i,o,s,a=this.firestore.ed();return(t&&"cache"===t.source?a.Bf(this.bd):(n=a,r=this.bd,i=t,o=new Q_,s=ZN(n,r,{includeMetadataChanges:!0,S_:!0},{next:function(t){s(),t.fromCache&&i&&"server"===i.source?o.reject(new Cg(Sg.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.)')):o.resolve(t)},error:function(t){return o.reject(t)}}),o.promise)).then(function(t){return new eA(e.firestore,e.bd,t,e.ca)})},JN);function JN(t,e,n){this.bd=t,this.firestore=e,this.ca=n}function ZN(t,e,n,r){var i=function(t){console.error("Uncaught Error in onSnapshot:",t)};r.error&&(i=r.error.bind(r));var o=new cN({next:function(t){r.next&&r.next(t)},error:i}),s=t.listen(e,o,n);return function(){o.Wf(),t.ic(s)}}var tA,eA=(Object.defineProperty(iA.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!1,configurable:!0}),Object.defineProperty(iA.prototype,"empty",{get:function(){return this.Dd.docs._()},enumerable:!1,configurable:!0}),Object.defineProperty(iA.prototype,"size",{get:function(){return this.Dd.docs.size},enumerable:!1,configurable:!0}),iA.prototype.forEach=function(e,n){var r=this;aT("QuerySnapshot.forEach",arguments,1,2),uT("QuerySnapshot.forEach","function",1,e),this.Dd.docs.forEach(function(t){e.call(n,r.$d(t,r.metadata.fromCache,r.Dd.Lt.has(t.key)))})},Object.defineProperty(iA.prototype,"query",{get:function(){return new $N(this.Sd,this.Id,this.ca)},enumerable:!1,configurable:!0}),iA.prototype.docChanges=function(t){t&&(mT("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),lT("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this.Dd.Bt)throw new Cg(Sg.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.Cd&&this.Fd===e||(this.Cd=function(i,e,o){if(i.Ot._()){var n=0;return i.docChanges.map(function(t){var e=o(t.doc,i.fromCache,i.Lt.has(t.doc.key));return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var s=i.Ot;return i.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=o(t.doc,i.fromCache,i.Lt.has(t.doc.key)),n=-1,r=-1;return 0!==t.type&&(n=s.indexOf(t.doc.key),s=s.delete(t.doc.key)),1!==t.type&&(r=(s=s.add(t.doc)).indexOf(t.doc.key)),{type:function(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return sg()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.Dd,e,this.$d.bind(this)),this.Fd=e),this.Cd},iA.prototype.isEqual=function(t){if(!(t instanceof iA))throw bT("isEqual","QuerySnapshot",1,t);return this.Id===t.Id&&n_(this.Sd,t.Sd)&&this.Dd.isEqual(t.Dd)&&this.ca===t.ca},iA.prototype.$d=function(t,e,n){return new WN(this.Id,t.key,t,e,n,this.ca)},iA),nA=(Es(rA,tA=$N),Object.defineProperty(rA.prototype,"id",{get:function(){return this.bd.path.S()},enumerable:!1,configurable:!0}),Object.defineProperty(rA.prototype,"parent",{get:function(){var t=this.bd.path.p();return t._()?null:new LN(new Dg(t),this.firestore,null)},enumerable:!1,configurable:!0}),Object.defineProperty(rA.prototype,"path",{get:function(){return this.bd.path.$()},enumerable:!1,configurable:!0}),rA.prototype.doc=function(t){aT("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=hg.t()),uT("CollectionReference.doc","non-empty string",1,t);var e=Og.N(t);return LN.Td(this.bd.path.child(e),this.firestore,this.ca)},rA.prototype.add=function(t){oT("CollectionReference.add",arguments,1),uT("CollectionReference.add","object",1,this.ca?this.ca.toFirestore(t):t);var e=this.doc();return e.set(t).then(function(){return e})},rA.prototype.withConverter=function(t){return new rA(this.Nd,this.firestore,t)},rA);function rA(t,e,n){var r=this;if(((r=tA.call(this,Xw(t),e,n)||this).Nd=t).length%2!=1)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.$()+" has "+t.length);return r}function iA(t,e,n,r){this.Id=t,this.Sd=e,this.Dd=n,this.ca=r,this.Cd=null,this.Fd=null,this.metadata=new qN(n.hasPendingWrites,n.fromCache)}function oA(t,e){if(void 0===e)return{merge:!1};if(mT(t,e,["merge","mergeFields"]),lT(t,"boolean","merge",e.merge),n=t,void 0!==(r=e.mergeFields)&&function(t,e,n,r){if(!(n instanceof Array))throw new Cg(Sg.INVALID_ARGUMENT,"Function "+t+"() requires its "+e+" option to be an array, but it was: "+yT(n));for(var i=0;i<n.length;++i)if(!r(n[i]))throw new Cg(Sg.INVALID_ARGUMENT,"Function "+t+"() requires all "+e+" elements to be a string or a FieldPath, but the value at index "+i+" was: "+yT(n[i]))}(n,"mergeFields",r,function(t){return"string"==typeof t||t instanceof kT}),void 0!==e.mergeFields&&void 0!==e.merge)throw new Cg(Sg.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');var n,r;return e}function sA(t,e){return void 0===e?{}:(mT(t,e,["serverTimestamps"]),fT(t,0,"serverTimestamps",e.serverTimestamps,["estimate","previous","none"]),e)}function aA(t,e){cT(t,"object",1,e),e&&(mT(t,e,["source"]),fT(t,0,"source",e.source,["default","server","cache"]))}function uA(t,e,n){if(e instanceof oS){if(e.firestore!==n)throw new Cg(Sg.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}throw bT(t,"DocumentReference",1,e)}function cA(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var hA,lA={Firestore:NN,GeoPoint:XT,Timestamp:Ng,Blob:NT,Transaction:DN,WriteBatch:xN,DocumentReference:LN,DocumentSnapshot:BN,Query:$N,QueryDocumentSnapshot:WN,QuerySnapshot:eA,CollectionReference:nA,FieldPath:kT,FieldValue:zT,setLogLevel:NN.setLogLevel,CACHE_SIZE_UNLIMITED:SN};(hA=zl).INTERNAL.registerComponent(new ga("firestore",function(t){return e=t.getProvider("app").getImmediate(),n=t.getProvider("auth-internal"),new NN(e,n,new aN);var e,n},"PUBLIC").setServiceProps(Object.assign({},lA))),hA.registerVersion("@firebase/firestore","1.16.2");var fA,pA={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"},dA=(Es(vA,fA=Error),vA);function vA(t,e,n){var r=fA.call(this,e)||this;return Object.setPrototypeOf(r,vA.prototype),r.code=t,r.details=n,r}function yA(t,e,n){var r=function(t){if(200<=t&&t<300)return"ok";switch(t){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}(t),i=r,o=void 0;try{var s=e&&e.error;if(s){var a=s.status;if("string"==typeof a){if(!pA[a])return new dA("internal","internal");r=pA[a],i=a}var u=s.message;"string"==typeof u&&(i=u),void 0!==(o=s.details)&&(o=n.decode(o))}}catch(t){}return"ok"===r?null:new dA(r,i,o)}var gA=(mA.prototype.getAuthToken=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:if(!this.auth)return[2,void 0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.auth.getToken()];case 2:return(e=t.sent())?[2,e.accessToken]:[2,void 0];case 3:return t.sent(),[2,void 0];case 4:return[2]}})})},mA.prototype.getInstanceIdToken=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){if(!(this.messaging&&"Notification"in self&&"granted"===Notification.permission))return[2,void 0];try{return[2,this.messaging.getToken()]}catch(t){return[2,void 0]}return[2]})})},mA.prototype.getContext=function(){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,this.getAuthToken()];case 1:return e=t.sent(),[4,this.getInstanceIdToken()];case 2:return n=t.sent(),[2,{authToken:e,instanceIdToken:n}]}})})},mA);function mA(t,e){var n=this;this.auth=null,this.messaging=null,this.auth=t.getImmediate({optional:!0}),this.messaging=e.getImmediate({optional:!0}),this.auth||t.get().then(function(t){return n.auth=t},function(){}),this.messaging||e.get().then(function(t){return n.messaging=t},function(){})}function bA(t,e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}var wA=(_A.prototype.encode=function(t){var e=this;if(null==t)return null;if(t instanceof Number&&(t=t.valueOf()),"number"==typeof t&&isFinite(t))return t;if(!0===t||!1===t)return t;if("[object String]"===Object.prototype.toString.call(t))return t;if(Array.isArray(t))return t.map(function(t){return e.encode(t)});if("function"==typeof t||"object"==typeof t)return bA(t,function(t){return e.encode(t)});throw new Error("Data cannot be encoded in JSON: "+t)},_A.prototype.decode=function(t){var e=this;if(null==t)return t;if(t["@type"])switch(t["@type"]){case"type.googleapis.com/google.protobuf.Int64Value":case"type.googleapis.com/google.protobuf.UInt64Value":var n=Number(t.value);if(isNaN(n))throw new Error("Data cannot be decoded from JSON: "+t);return n;default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map(function(t){return e.decode(t)}):"function"==typeof t||"object"==typeof t?bA(t,function(t){return e.decode(t)}):t},_A);function _A(){}var EA=(Object.defineProperty(IA.prototype,"app",{get:function(){return this.app_},enumerable:!1,configurable:!0}),IA.prototype._url=function(t){var e=this.app_.options.projectId,n=this.region_;return null===this.emulatorOrigin?"https://"+n+"-"+e+".cloudfunctions.net/"+t:this.emulatorOrigin+"/"+e+"/"+n+"/"+t},IA.prototype.useFunctionsEmulator=function(t){this.emulatorOrigin=t},IA.prototype.httpsCallable=function(e,n){var r=this;return function(t){return r.call(e,t,n||{})}},IA.prototype.postJSON=function(r,i,o){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:o.append("Content-Type","application/json"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,fetch(r,{method:"POST",body:JSON.stringify(i),headers:o})];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),[2,{status:0,json:null}];case 4:n=null,t.label=5;case 5:return t.trys.push([5,7,,8]),[4,e.json()];case 6:return n=t.sent(),[3,8];case 7:return t.sent(),[3,8];case 8:return[2,{status:e.status,json:n}]}})})},IA.prototype.call=function(v,y,g){return Ts(this,void 0,void 0,function(){var i,o,s,a,u,c,h,l,f,p,d;return Ss(this,function(t){switch(t.label){case 0:return i=this._url(v),y=this.serializer.encode(y),o={data:y},s=new Headers,[4,this.contextProvider.getContext()];case 1:return(a=t.sent()).authToken&&s.append("Authorization","Bearer "+a.authToken),a.instanceIdToken&&s.append("Firebase-Instance-ID-Token",a.instanceIdToken),u=g.timeout||7e4,n=u,e=new Promise(function(t,e){r=setTimeout(function(){e(new dA("deadline-exceeded","deadline-exceeded"))},n)}),h=(c={timer:r,promise:e}).timer,l=c.promise,[4,Promise.race([TA(h,this.postJSON(i,o,s)),l,TA(h,this.cancelAllRequests)])];case 2:if(!(f=t.sent()))throw new dA("cancelled","Firebase Functions instance was deleted.");if(p=yA(f.status,f.json,this.serializer))throw p;if(!f.json)throw new dA("internal","Response is not valid JSON object.");if(void 0===(d=f.json.data)&&(d=f.json.result),void 0===d)throw new dA("internal","Response is missing data field.");return[2,{data:this.serializer.decode(d)}]}var n,r,e})})},IA);function IA(t,e,n,r){var i=this;void 0===r&&(r="us-central1"),this.app_=t,this.region_=r,this.serializer=new wA,this.emulatorOrigin=null,this.INTERNAL={delete:function(){return i.deleteService()}},this.contextProvider=new gA(e,n),this.cancelAllRequests=new Promise(function(t){i.deleteService=function(){return t()}})}function TA(n,r){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,r];case 1:return e=t.sent(),clearTimeout(n),[2,e]}})})}function SA(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),i=t.getProvider("messaging");return new EA(n,r,i,e)}var CA;function NA(n){return new Promise(function(t,e){n.onsuccess=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function AA(n,r,i){var o,t=new Promise(function(t,e){NA(o=n[r].apply(n,i)).then(t,e)});return t.request=o,t}function kA(t,n,e){e.forEach(function(e){Object.defineProperty(t.prototype,e,{get:function(){return this[n][e]},set:function(t){this[n][e]=t}})})}function OA(e,n,r,t){t.forEach(function(t){t in r.prototype&&(e.prototype[t]=function(){return AA(this[n],t,arguments)})})}function PA(e,n,r,t){t.forEach(function(t){t in r.prototype&&(e.prototype[t]=function(){return this[n][t].apply(this[n],arguments)})})}function RA(t,r,e,n){n.forEach(function(n){n in e.prototype&&(t.prototype[n]=function(){return t=this[r],(e=AA(t,n,arguments)).then(function(t){if(t)return new xA(t,e.request)});var t,e})})}function DA(t){this._index=t}function xA(t,e){this._cursor=t,this._request=e}function LA(t){this._store=t}function MA(n){this._tx=n,this.complete=new Promise(function(t,e){n.oncomplete=function(){t()},n.onerror=function(){e(n.error)},n.onabort=function(){e(n.error)}})}function FA(t,e,n){this._db=t,this.oldVersion=e,this.transaction=new MA(n)}function UA(t){this._db=t}function jA(t,e,n){var r=AA(indexedDB,"open",[t,e]),i=r.request;return i&&(i.onupgradeneeded=function(t){n&&n(new FA(i.result,t.oldVersion,i.transaction))}),r.then(function(t){return new UA(t)})}function VA(t){return AA(indexedDB,"deleteDatabase",[t])}CA={Functions:EA},zl.INTERNAL.registerComponent(new ga("functions",SA,"PUBLIC").setServiceProps(CA).setMultipleInstances(!0)),zl.registerVersion("@firebase/functions","0.4.49"),kA(DA,"_index",["name","keyPath","multiEntry","unique"]),OA(DA,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),RA(DA,"_index",IDBIndex,["openCursor","openKeyCursor"]),kA(xA,"_cursor",["direction","key","primaryKey","value"]),OA(xA,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(xA.prototype[n]=function(){var e=this,t=arguments;return Promise.resolve().then(function(){return e._cursor[n].apply(e._cursor,t),NA(e._request).then(function(t){if(t)return new xA(t,e._request)})})})}),LA.prototype.createIndex=function(){return new DA(this._store.createIndex.apply(this._store,arguments))},LA.prototype.index=function(){return new DA(this._store.index.apply(this._store,arguments))},kA(LA,"_store",["name","keyPath","indexNames","autoIncrement"]),OA(LA,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),RA(LA,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),PA(LA,"_store",IDBObjectStore,["deleteIndex"]),MA.prototype.objectStore=function(){return new LA(this._tx.objectStore.apply(this._tx,arguments))},kA(MA,"_tx",["objectStoreNames","mode"]),PA(MA,"_tx",IDBTransaction,["abort"]),FA.prototype.createObjectStore=function(){return new LA(this._db.createObjectStore.apply(this._db,arguments))},kA(FA,"_db",["name","version","objectStoreNames"]),PA(FA,"_db",IDBDatabase,["deleteObjectStore","close"]),UA.prototype.transaction=function(){return new MA(this._db.transaction.apply(this._db,arguments))},kA(UA,"_db",["name","version","objectStoreNames"]),PA(UA,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(o){[LA,DA].forEach(function(t){o in t.prototype&&(t.prototype[o.replace("open","iterate")]=function(){var t,e=(t=arguments,Array.prototype.slice.call(t)),n=e[e.length-1],r=this._store||this._index,i=r[o].apply(r,e.slice(0,-1));i.onsuccess=function(){n(i.result)}})})}),[DA,LA].forEach(function(t){t.prototype.getAll||(t.prototype.getAll=function(t,n){var r=this,i=[];return new Promise(function(e){r.iterateCursor(t,function(t){t?(i.push(t.value),void 0===n||i.length!=n?t.continue():e(i)):e(i)})})})});var qA,BA=1e4,WA="w:0.4.15",HA="FIS_v2",KA="https://firebaseinstallations.googleapis.com/v1",GA=36e5,zA=((qA={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',qA["not-registered"]="Firebase Installation is not registered.",qA["installation-not-found"]="Firebase Installation not found.",qA["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',qA["app-offline"]="Could not process request. Application offline.",qA["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",qA),QA=new Ys("installations","Installations",zA);function XA(t){return t instanceof Qs&&t.code.includes("request-failed")}function YA(t){var e=t.projectId;return KA+"/projects/"+e+"/installations"}function $A(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}function JA(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,i.json()];case 1:return e=t.sent(),n=e.error,[2,QA.create("request-failed",{requestName:r,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})]}})})}function ZA(t){var e=t.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function tk(t,e){var n=e.refreshToken,r=ZA(t);return r.append("Authorization",HA+" "+n),r}function ek(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,n()];case 1:return 500<=(e=t.sent()).status&&e.status<600?[2,n()]:[2,e]}})})}function nk(e){return new Promise(function(t){setTimeout(t,e)})}var rk=/^[cdef][\w-]{21}$/,ik="";function ok(){try{var t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;var e=function(t){return btoa(String.fromCharCode.apply(String,As(t))).replace(/\+/g,"-").replace(/\//g,"_")}(t).substr(0,22);return rk.test(e)?e:ik}catch(t){return ik}}function sk(t){return t.appName+"!"+t.appId}var ak=new Map;function uk(t,e){var n=sk(t);ck(n,e),function(t,e){var n=lk();n&&n.postMessage({key:t,fid:e});fk()}(n,e)}function ck(t,e){var n,r,i=ak.get(t);if(i)try{for(var o=Cs(i),s=o.next();!s.done;s=o.next()){(0,s.value)(e)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}var hk=null;function lk(){return!hk&&"BroadcastChannel"in self&&((hk=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(t){ck(t.data.key,t.data.fid)}),hk}function fk(){0===ak.size&&hk&&(hk.close(),hk=null)}var pk,dk,vk="firebase-installations-database",yk=1,gk="firebase-installations-store",mk=null;function bk(){return mk=mk||jA(vk,yk,function(t){switch(t.oldVersion){case 0:t.createObjectStore(gk)}})}function wk(s,a){return Ts(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return e=sk(s),[4,bk()];case 1:return n=t.sent(),r=n.transaction(gk,"readwrite"),[4,(i=r.objectStore(gk)).get(e)];case 2:return o=t.sent(),[4,i.put(a,e)];case 3:return t.sent(),[4,r.complete];case 4:return t.sent(),o&&o.fid===a.fid||uk(s,a.fid),[2,a]}})})}function _k(i){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=sk(i),[4,bk()];case 1:return n=t.sent(),[4,(r=n.transaction(gk,"readwrite")).objectStore(gk).delete(e)];case 2:return t.sent(),[4,r.complete];case 3:return t.sent(),[2]}})})}function Ek(a,u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return e=sk(a),[4,bk()];case 1:return n=t.sent(),r=n.transaction(gk,"readwrite"),[4,(i=r.objectStore(gk)).get(e)];case 2:return o=t.sent(),void 0!==(s=u(o))?[3,4]:[4,i.delete(e)];case 3:return t.sent(),[3,6];case 4:return[4,i.put(s,e)];case 5:t.sent(),t.label=6;case 6:return[4,r.complete];case 7:return t.sent(),!s||o&&o.fid===s.fid||uk(a,s.fid),[2,s]}})})}function Ik(i){return Ts(this,void 0,void 0,function(){var r,e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,Ek(i,function(t){var e=Sk(t||{fid:ok(),registrationStatus:0}),n=function(t,e){{if(0!==e.registrationStatus)return 1===e.registrationStatus?{installationEntry:e,registrationPromise:function(o){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return[4,Tk(o)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.registrationStatus?[3,5]:[4,nk(100)];case 3:return t.sent(),[4,Tk(o)];case 4:return e=t.sent(),[3,2];case 5:return 0!==e.registrationStatus?[3,7]:[4,Ik(o)];case 6:return n=t.sent(),r=n.installationEntry,(i=n.registrationPromise)?[2,i]:[2,r];case 7:return[2,e]}})})}(t)}:{installationEntry:e};if(!navigator.onLine){var n=Promise.reject(QA.create("app-offline"));return{installationEntry:e,registrationPromise:n}}var r={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},i=function(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,function(a,t){var u=t.fid;return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return e=YA(a),n=ZA(a),r={fid:u,authVersion:HA,appId:a.appId,sdkVersion:WA},i={method:"POST",headers:n,body:JSON.stringify(r)},[4,ek(function(){return fetch(e,i)})];case 1:return(o=t.sent()).ok?[4,o.json()]:[3,3];case 2:return s=t.sent(),[2,{fid:s.fid||u,registrationStatus:2,refreshToken:s.refreshToken,authToken:$A(s.authToken)}];case 3:return[4,JA("Create Installation",o)];case 4:throw t.sent()}})})}(r,i)];case 1:return e=t.sent(),[2,wk(r,e)];case 2:return XA(n=t.sent())&&409===n.serverCode?[4,_k(r)]:[3,4];case 3:return t.sent(),[3,6];case 4:return[4,wk(r,{fid:i.fid,registrationStatus:0})];case 5:t.sent(),t.label=6;case 6:throw n;case 7:return[2]}})})}(t,r);return{installationEntry:r,registrationPromise:i}}}(i,e);return r=n.registrationPromise,n.installationEntry})];case 1:return(e=t.sent()).fid!==ik?[3,3]:(n={},[4,r]);case 2:return[2,(n.installationEntry=t.sent(),n)];case 3:return[2,{installationEntry:e,registrationPromise:r}]}})})}function Tk(t){return Ek(t,function(t){if(!t)throw QA.create("installation-not-found");return Sk(t)})}function Sk(t){return 1===(e=t).registrationStatus&&e.registrationTime+BA<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}function Ck(t,h){var l=t.appConfig,f=t.platformLoggerProvider;return Ts(this,void 0,void 0,function(){var r,i,o,s,a,u,c;return Ss(this,function(t){switch(t.label){case 0:return e=l,n=h.fid,r=YA(e)+"/"+n+"/authTokens:generate",i=tk(l,h),(o=f.getImmediate({optional:!0}))&&i.append("x-firebase-client",o.getPlatformInfoString()),s={installation:{sdkVersion:WA}},a={method:"POST",headers:i,body:JSON.stringify(s)},[4,ek(function(){return fetch(r,a)})];case 1:return(u=t.sent()).ok?[4,u.json()]:[3,3];case 2:return c=t.sent(),[2,$A(c)];case 3:return[4,JA("Generate Auth Token",u)];case 4:throw t.sent()}var e,n})})}function Nk(a,u){return void 0===u&&(u=!1),Ts(this,void 0,void 0,function(){var s,e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,Ek(a.appConfig,function(t){if(!kk(t))throw QA.create("not-registered");var e,n,r,i=t.authToken;if(u||2!==(r=i).requestStatus||function(t){var e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+GA}(r)){if(1===i.requestStatus)return s=function(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,Ak(r.appConfig)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.authToken.requestStatus?[3,5]:[4,nk(100)];case 3:return t.sent(),[4,Ak(r.appConfig)];case 4:return e=t.sent(),[3,2];case 5:return 0===(n=e.authToken).requestStatus?[2,Nk(r,i)]:[2,n]}})})}(a,u),t;if(!navigator.onLine)throw QA.create("app-offline");var o=(e=t,n={requestStatus:1,requestTime:Date.now()},Is(Is({},e),{authToken:n}));return s=function(i,o){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,8]),[4,Ck(i,o)];case 1:return e=t.sent(),r=Is(Is({},o),{authToken:e}),[4,wk(i.appConfig,r)];case 2:return t.sent(),[2,e];case 3:return!XA(n=t.sent())||401!==n.serverCode&&404!==n.serverCode?[3,5]:[4,_k(i.appConfig)];case 4:return t.sent(),[3,7];case 5:return r=Is(Is({},o),{authToken:{requestStatus:0}}),[4,wk(i.appConfig,r)];case 6:t.sent(),t.label=7;case 7:throw n;case 8:return[2]}})})}(a,o),o}return t})];case 1:return e=t.sent(),s?[4,s]:[3,3];case 2:return n=t.sent(),[3,4];case 3:n=e.authToken,t.label=4;case 4:return[2,n]}})})}function Ak(t){return Ek(t,function(t){if(!kk(t))throw QA.create("not-registered");var e,n=t.authToken;return 1===(e=n).requestStatus&&e.requestTime+BA<Date.now()?Is(Is({},t),{authToken:{requestStatus:0}}):t})}function kk(t){return void 0!==t&&2===t.registrationStatus}function Ok(e,n){return void 0===n&&(n=!1),Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,function(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,Ik(n)];case 1:return(e=t.sent().registrationPromise)?[4,e]:[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}})})}(e.appConfig)];case 1:return t.sent(),[4,Nk(e,n)];case 2:return[2,t.sent().token]}})})}function Pk(a,u){return Ts(this,void 0,void 0,function(){var r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return e=a,n=u.fid,r=YA(e)+"/"+n,i=tk(a,u),o={method:"DELETE",headers:i},[4,ek(function(){return fetch(r,o)})];case 1:return(s=t.sent()).ok?[3,3]:[4,JA("Delete Installation",s)];case 2:throw t.sent();case 3:return[2]}var e,n})})}function Rk(t,r){var i=t.appConfig;return function(t,e){lk();var n=sk(t),r=ak.get(n);r||(r=new Set,ak.set(n,r)),r.add(e)}(i,r),function(){var t,e,n;t=r,e=sk(i),(n=ak.get(e))&&(n.delete(t),0===n.size&&ak.delete(e),fk())}}function Dk(t){return QA.create("missing-app-config-values",{valueName:t})}(pk=zl).INTERNAL.registerComponent(new ga("installations",function(t){var e=t.getProvider("app").getImmediate(),n={appConfig:function(t){var e,n;if(!t||!t.options)throw Dk("App Configuration");if(!t.name)throw Dk("App Name");try{for(var r=Cs(["projectId","apiKey","appId"]),i=r.next();!i.done;i=r.next()){var o=i.value;if(!t.options[o])throw Dk(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(e),platformLoggerProvider:t.getProvider("platform-logger")};return{app:e,getId:function(){return function(i){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return[4,Ik(i.appConfig)];case 1:return e=t.sent(),n=e.installationEntry,(r=e.registrationPromise)?r.catch(console.error):Nk(i).catch(console.error),[2,n.fid]}})})}(n)},getToken:function(t){return Ok(n,t)},delete:function(){return function(r){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,Ek(e=r.appConfig,function(t){if(!t||0!==t.registrationStatus)return t})];case 1:if(!(n=t.sent()))return[3,6];if(1!==n.registrationStatus)return[3,2];throw QA.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw QA.create("app-offline");case 3:return[4,Pk(e,n)];case 4:return t.sent(),[4,_k(e)];case 5:t.sent(),t.label=6;case 6:return[2]}})})}(n)},onIdChange:function(t){return Rk(n,t)}}},"PUBLIC")),pk.registerVersion("@firebase/installations","0.4.15");var xk=((dk={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',dk["only-available-in-window"]="This method is available in a Window context.",dk["only-available-in-sw"]="This method is available in a service worker context.",dk["permission-default"]="The notification permission was not granted and dismissed instead.",dk["permission-blocked"]="The notification permission was not granted and blocked instead.",dk["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",dk["failed-service-worker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",dk["token-subscribe-failed"]="A problem occured while subscribing the user to FCM: {$errorInfo}",dk["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",dk["token-unsubscribe-failed"]="A problem occured while unsubscribing the user from FCM: {$errorInfo}",dk["token-update-failed"]="A problem occured while updating the user from FCM: {$errorInfo}",dk["token-update-no-token"]="FCM returned no token when updating the user to push.",dk["use-sw-after-get-token"]="The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.",dk["invalid-sw-registration"]="The input to useServiceWorker() must be a ServiceWorkerRegistration.",dk["invalid-bg-handler"]="The input to setBackgroundMessageHandler() must be a function.",dk["invalid-vapid-key"]="The public VAPID key must be a string.",dk["use-vapid-key-after-get-token"]="The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used.",dk),Lk=new Ys("messaging","Messaging",xk);function Mk(t){return Lk.create("missing-app-config-values",{valueName:t})}var Fk,Uk,jk="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",Vk="https://fcmregistrations.googleapis.com/v1",qk="FCM_MSG",Bk="google.c.a.c_id";function Wk(t){var e=new Uint8Array(t);return btoa(String.fromCharCode.apply(String,As(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(Uk=Fk=Fk||{}).PUSH_RECEIVED="push-received",Uk.NOTIFICATION_CLICKED="notification-clicked";var Hk="fcm_token_details_db",Kk=5,Gk="fcm_token_object_Store";function zk(a){return Ts(this,void 0,void 0,function(){var e,s,n=this;return Ss(this,function(t){switch(t.label){case 0:return"databases"in indexedDB?[4,indexedDB.databases()]:[3,2];case 1:if(e=t.sent(),!e.map(function(t){return t.name}).includes(Hk))return[2,null];t.label=2;case 2:return s=null,[4,jA(Hk,Kk,function(o){return Ts(n,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return o.oldVersion<2?[2]:o.objectStoreNames.contains(Gk)?[4,(e=o.transaction.objectStore(Gk)).index("fcmSenderId").get(a)]:[2];case 1:return n=t.sent(),[4,e.clear()];case 2:if(t.sent(),!n)return[2];if(2===o.oldVersion){if(!(r=n).auth||!r.p256dh||!r.endpoint)return[2];s={token:r.fcmToken,createTime:null!==(i=r.createTime)&&void 0!==i?i:Date.now(),subscriptionOptions:{auth:r.auth,p256dh:r.p256dh,endpoint:r.endpoint,swScope:r.swScope,vapidKey:"string"==typeof r.vapidKey?r.vapidKey:Wk(r.vapidKey)}}}else(3===o.oldVersion||4===o.oldVersion)&&(s={token:(r=n).fcmToken,createTime:r.createTime,subscriptionOptions:{auth:Wk(r.auth),p256dh:Wk(r.p256dh),endpoint:r.endpoint,swScope:r.swScope,vapidKey:Wk(r.vapidKey)}});return[2]}})})})];case 3:return t.sent().close(),[4,VA(Hk)];case 4:return t.sent(),[4,VA("fcm_vapid_details_db")];case 5:return t.sent(),[4,VA("undefined")];case 6:return t.sent(),[2,function(t){if(!t||!t.subscriptionOptions)return;var e=t.subscriptionOptions;return"number"==typeof t.createTime&&0<t.createTime&&"string"==typeof t.token&&0<t.token.length&&"string"==typeof e.auth&&0<e.auth.length&&"string"==typeof e.p256dh&&0<e.p256dh.length&&"string"==typeof e.endpoint&&0<e.endpoint.length&&"string"==typeof e.swScope&&0<e.swScope.length&&"string"==typeof e.vapidKey&&0<e.vapidKey.length}(s)?s:null]}})})}var Qk="firebase-messaging-database",Xk=1,Yk="firebase-messaging-store",$k=null;function Jk(){return $k=$k||jA(Qk,Xk,function(t){switch(t.oldVersion){case 0:t.createObjectStore(Yk)}})}function Zk(i){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=eO(i),[4,Jk()];case 1:return[4,t.sent().transaction(Yk).objectStore(Yk).get(e)];case 2:return(n=t.sent())?[2,n]:[3,3];case 3:return[4,zk(i.appConfig.senderId)];case 4:return(r=t.sent())?[4,tO(i,r)]:[3,6];case 5:return t.sent(),[2,r];case 6:return[2]}})})}function tO(i,o){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=eO(i),[4,Jk()];case 1:return n=t.sent(),[4,(r=n.transaction(Yk,"readwrite")).objectStore(Yk).put(o,e)];case 2:return t.sent(),[4,r.complete];case 3:return t.sent(),[2,o]}})})}function eO(t){return t.appConfig.appId}function nO(s,a){return Ts(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return[4,iO(s)];case 1:e=t.sent(),n={method:"DELETE",headers:e},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(rO(s.appConfig)+"/"+a,n)];case 3:return[4,t.sent().json()];case 4:if((r=t.sent()).error)throw i=r.error.message,Lk.create("token-unsubscribe-failed",{errorInfo:i});return[3,6];case 5:throw o=t.sent(),Lk.create("token-unsubscribe-failed",{errorInfo:o});case 6:return[2]}})})}function rO(t){var e=t.projectId;return Vk+"/projects/"+e+"/registrations"}function iO(t){var n=t.appConfig,r=t.installations;return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,r.getToken()];case 1:return e=t.sent(),[2,new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":n.apiKey,"x-goog-firebase-installations-auth":"FIS "+e})]}})})}function oO(t){var e=t.p256dh,n=t.auth,r=t.endpoint,i=t.vapidKey,o={web:{endpoint:r,auth:n,p256dh:e}};return i!==jk&&(o.web.applicationPubKey=i),o}function sO(l,f,p){return Ts(this,void 0,void 0,function(){var a,u,c,h;return Ss(this,function(t){switch(t.label){case 0:if("granted"!==Notification.permission)throw Lk.create("permission-blocked");return[4,function(n,r){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,n.pushManager.getSubscription()];case 1:return(e=t.sent())?[2,e]:[2,n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(t){for(var e=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(e),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}(r)})]}})})}(f,p)];case 1:return a=t.sent(),[4,Zk(l)];case 2:return u=t.sent(),c={vapidKey:p,swScope:f.scope,endpoint:a.endpoint,auth:Wk(a.getKey("auth")),p256dh:Wk(a.getKey("p256dh"))},u?[3,3]:[2,uO(l,c)];case 3:if(e=u.subscriptionOptions,r=(n=c).vapidKey===e.vapidKey,i=n.endpoint===e.endpoint,o=n.auth===e.auth,s=n.p256dh===e.p256dh,r&&i&&o&&s)return[3,8];t.label=4;case 4:return t.trys.push([4,6,,7]),[4,nO(l,u.token)];case 5:return t.sent(),[3,7];case 6:return h=t.sent(),console.warn(h),[3,7];case 7:return[2,uO(l,c)];case 8:return Date.now()>=u.createTime+6048e5?[2,function(i,o,s){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,5]),[4,function(a,u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return[4,iO(a)];case 1:e=t.sent(),n=oO(u.subscriptionOptions),r={method:"PATCH",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(rO(a.appConfig)+"/"+u.token,r)];case 3:return[4,t.sent().json()];case 4:return i=t.sent(),[3,6];case 5:throw o=t.sent(),Lk.create("token-update-failed",{errorInfo:o});case 6:if(i.error)throw s=i.error.message,Lk.create("token-update-failed",{errorInfo:s});if(!i.token)throw Lk.create("token-update-no-token");return[2,i.token]}})})}(o,i)];case 1:return e=t.sent(),n=Is(Is({},i),{token:e,createTime:Date.now()}),[4,tO(o,n)];case 2:return t.sent(),[2,e];case 3:return r=t.sent(),[4,aO(o,s)];case 4:throw t.sent(),r;case 5:return[2]}})})}({token:u.token,createTime:Date.now(),subscriptionOptions:c},l,f)]:[2,u.token];case 9:return[2]}var e,n,r,i,o,s})})}function aO(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,Zk(r)];case 1:return(e=t.sent())?[4,nO(r,e.token)]:[3,4];case 2:return t.sent(),[4,function(i){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=eO(i),[4,Jk()];case 1:return n=t.sent(),[4,(r=n.transaction(Yk,"readwrite")).objectStore(Yk).delete(e)];case 2:return t.sent(),[4,r.complete];case 3:return t.sent(),[2]}})})}(r)];case 3:t.sent(),t.label=4;case 4:return[4,i.pushManager.getSubscription()];case 5:return(n=t.sent())?[2,n.unsubscribe()]:[2,!0]}})})}function uO(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,function(a,u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return[4,iO(a)];case 1:e=t.sent(),n=oO(u),r={method:"POST",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(rO(a.appConfig),r)];case 3:return[4,t.sent().json()];case 4:return i=t.sent(),[3,6];case 5:throw o=t.sent(),Lk.create("token-subscribe-failed",{errorInfo:o});case 6:if(i.error)throw s=i.error.message,Lk.create("token-subscribe-failed",{errorInfo:s});if(!i.token)throw Lk.create("token-subscribe-no-token");return[2,i.token]}})})}(r,i)];case 1:return e=t.sent(),n={token:e,createTime:Date.now(),subscriptionOptions:i},[4,tO(r,n)];case 2:return t.sent(),[2,n.token]}})})}function cO(t){return"object"==typeof t&&t&&Bk in t}var hO=(Object.defineProperty(lO.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),lO.prototype.getToken=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.vapidKey||(this.vapidKey=jk),[4,this.getServiceWorkerRegistration()];case 1:return e=t.sent(),"default"!==Notification.permission?[3,3]:[4,Notification.requestPermission()];case 2:t.sent(),t.label=3;case 3:if("granted"!==Notification.permission)throw Lk.create("permission-blocked");return[2,sO(this.firebaseDependencies,e,this.vapidKey)]}})})},lO.prototype.deleteToken=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return e=t.sent(),[2,aO(this.firebaseDependencies,e)]}})})},lO.prototype.requestPermission=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return"granted"===Notification.permission?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(e=t.sent()))return[2];throw"denied"===e?Lk.create("permission-blocked"):Lk.create("permission-default")}})})},lO.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw Lk.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw Lk.create("invalid-vapid-key");this.vapidKey=t},lO.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw Lk.create("invalid-sw-registration");if(this.swRegistration)throw Lk.create("use-sw-after-get-token");this.swRegistration=t},lO.prototype.onMessage=function(t){var e=this;return this.onMessageCallback=t,function(){e.onMessageCallback=null}},lO.prototype.setBackgroundMessageHandler=function(){throw Lk.create("only-available-in-sw")},lO.prototype.onTokenRefresh=function(){return function(){}},lO.prototype.getServiceWorkerRegistration=function(){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:if(this.swRegistration)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),e=this,[4,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"})];case 2:return e.swRegistration=t.sent(),this.swRegistration.update().catch(function(){}),[3,4];case 3:throw n=t.sent(),Lk.create("failed-service-worker-registration",{browserErrorMessage:n.message});case 4:return[2,this.swRegistration]}})})},lO.prototype.messageEventListener=function(o){var s;return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return null!==(s=o.data)&&void 0!==s&&s.firebaseMessaging?(e=o.data.firebaseMessaging,n=e.type,r=e.payload,this.onMessageCallback&&n===Fk.PUSH_RECEIVED&&("function"==typeof this.onMessageCallback?this.onMessageCallback(r):this.onMessageCallback.next(r)),cO(i=r.data)&&"1"===i["google.c.a.e"]?[4,this.logEvent(n,i)]:[3,2]):[2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},lO.prototype.logEvent=function(n,r){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return e=function(t){switch(t){case Fk.NOTIFICATION_CLICKED:return"notification_open";case Fk.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(n),[4,this.firebaseDependencies.analyticsProvider.get()];case 1:return t.sent().logEvent(e,{message_id:r[Bk],message_name:r["google.c.a.c_l"],message_time:r["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}})})},lO);function lO(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",function(t){return e.messageEventListener(t)})}var fO=(Object.defineProperty(pO.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),pO.prototype.setBackgroundMessageHandler=function(t){if(!t||"function"!=typeof t)throw Lk.create("invalid-bg-handler");this.bgMessageHandler=t},pO.prototype.getToken=function(){var n,r;return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.vapidKey?[3,2]:[4,Zk(this.firebaseDependencies)];case 1:e=t.sent(),this.vapidKey=null!==(r=null===(n=null==e?void 0:e.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==r?r:jk,t.label=2;case 2:return[2,sO(this.firebaseDependencies,self.registration,this.vapidKey)]}})})},pO.prototype.deleteToken=function(){return aO(this.firebaseDependencies,self.registration)},pO.prototype.requestPermission=function(){throw Lk.create("only-available-in-window")},pO.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw Lk.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw Lk.create("invalid-vapid-key");this.vapidKey=t},pO.prototype.useServiceWorker=function(){throw Lk.create("only-available-in-window")},pO.prototype.onMessage=function(){throw Lk.create("only-available-in-window")},pO.prototype.onTokenRefresh=function(){throw Lk.create("only-available-in-window")},pO.prototype.onPush=function(i){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return(e=function(t){var e=t.data;if(!e)return null;try{return e.json()}catch(t){return null}}(i))?[4,dO()]:[2];case 1:return(n=t.sent()).some(function(t){return"visible"===t.visibilityState&&!t.url.startsWith("chrome-extension://")})?[2,function(t,e){var n,r,i=vO(Fk.PUSH_RECEIVED,e);try{for(var o=Cs(t),s=o.next();!s.done;s=o.next())s.value.postMessage(i)}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(n,e)]:(r=function(t){var e;if(t&&"object"==typeof t.notification){var n=Is({},t.notification);return n.data=Is(Is({},t.notification.data),((e={})[qk]=t,e)),n}}(e))?[4,function(t){var e,n=null!==(e=t.title)&&void 0!==e?e:"",r=t.actions,i=Notification.maxActions;return r&&i&&r.length>i&&console.warn("This browser only supports "+i+" actions. The remaining actions will not be displayed."),self.registration.showNotification(n,t)}(r)]:[3,3];case 2:return t.sent(),[3,5];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(e)]:[3,5];case 4:t.sent(),t.label=5;case 5:return[2]}})})},pO.prototype.onSubChange=function(n){var r,i;return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return n.newSubscription?[3,2]:[4,aO(this.firebaseDependencies,self.registration)];case 1:return t.sent(),[2];case 2:return[4,Zk(this.firebaseDependencies)];case 3:return e=t.sent(),[4,aO(this.firebaseDependencies,self.registration)];case 4:return t.sent(),[4,sO(this.firebaseDependencies,self.registration,null!==(i=null===(r=null==e?void 0:e.subscriptionOptions)||void 0===r?void 0:r.vapidKey)&&void 0!==i?i:jk)];case 5:return t.sent(),[2]}})})},pO.prototype.onNotificationClick=function(s){var a,u;return Ts(this,void 0,void 0,function(){var n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return!(n=null===(u=null===(a=s.notification)||void 0===a?void 0:a.data)||void 0===u?void 0:u[qk])||s.action?[2]:(s.stopImmediatePropagation(),s.notification.close(),(r=function(t){var e,n,r,i=null!==(n=null===(e=t.fcmOptions)||void 0===e?void 0:e.link)&&void 0!==n?n:null===(r=t.notification)||void 0===r?void 0:r.click_action;return i||(cO(t.data)?self.location.origin:null)}(n))?[4,function(u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a;return Ss(this,function(t){switch(t.label){case 0:return e=new URL(u,self.location.href),[4,dO()];case 1:n=t.sent();try{for(r=Cs(n),i=r.next();!i.done;i=r.next())if(o=i.value,new URL(o.url,self.location.href).host===e.host)return[2,o]}catch(t){s={error:t}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}}return[2,null]}})})}(r)]:[2]);case 1:return(i=t.sent())?[3,4]:[4,self.clients.openWindow(r)];case 2:return i=t.sent(),[4,(e=3e3,new Promise(function(t){setTimeout(t,e)}))];case 3:return t.sent(),[3,6];case 4:return[4,i.focus()];case 5:i=t.sent(),t.label=6;case 6:return i?(o=vO(Fk.NOTIFICATION_CLICKED,n),[2,i.postMessage(o)]):[2]}var e})})},pO);function pO(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.bgMessageHandler=null,self.addEventListener("push",function(t){t.waitUntil(e.onPush(t))}),self.addEventListener("pushsubscriptionchange",function(t){t.waitUntil(e.onSubChange(t))}),self.addEventListener("notificationclick",function(t){t.waitUntil(e.onNotificationClick(t))})}function dO(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function vO(t,e){return{firebaseMessaging:{type:t,payload:e}}}var yO={isSupported:gO};function gO(){return self&&"ServiceWorkerGlobalScope"in self?"indexedDB"in self&&null!==indexedDB&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey"):"indexedDB"in window&&null!==indexedDB&&navigator.cookieEnabled&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}zl.INTERNAL.registerComponent(new ga("messaging",function(t){var e=t.getProvider("app").getImmediate(),n={app:e,appConfig:function(t){var e,n;if(!t||!t.options)throw Mk("App Configuration Object");if(!t.name)throw Mk("App Name");var r=t.options;try{for(var i=Cs(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var s=o.value;if(!r[s])throw Mk(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return{appName:t.name,projectId:r.projectId,apiKey:r.apiKey,appId:r.appId,senderId:r.messagingSenderId}}(e),installations:t.getProvider("installations").getImmediate(),analyticsProvider:t.getProvider("analytics-internal")};if(!gO())throw Lk.create("unsupported-browser");return new(self&&"ServiceWorkerGlobalScope"in self?fO:hO)(n)},"PUBLIC").setServiceProps(yO));var mO="firebasestorage.googleapis.com",bO=(wO.prototype.codeProp=function(){return this.code},wO.prototype.codeEquals=function(t){return EO(t)===this.codeProp()},wO.prototype.serverResponseProp=function(){return this.serverResponse_},wO.prototype.setServerResponseProp=function(t){this.serverResponse_=t},Object.defineProperty(wO.prototype,"name",{get:function(){return this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(wO.prototype,"code",{get:function(){return this.code_},enumerable:!1,configurable:!0}),Object.defineProperty(wO.prototype,"message",{get:function(){return this.serverResponse_?this.message_+"\n"+this.serverResponse_:this.message_},enumerable:!1,configurable:!0}),Object.defineProperty(wO.prototype,"serverResponse",{get:function(){return this.serverResponse_},enumerable:!1,configurable:!0}),wO);function wO(t,e){this.code_=EO(t),this.message_="Firebase Storage: "+e,this.serverResponse_=null,this.name_="FirebaseError"}var _O={UNKNOWN:"unknown",OBJECT_NOT_FOUND:"object-not-found",BUCKET_NOT_FOUND:"bucket-not-found",PROJECT_NOT_FOUND:"project-not-found",QUOTA_EXCEEDED:"quota-exceeded",UNAUTHENTICATED:"unauthenticated",UNAUTHORIZED:"unauthorized",RETRY_LIMIT_EXCEEDED:"retry-limit-exceeded",INVALID_CHECKSUM:"invalid-checksum",CANCELED:"canceled",INVALID_EVENT_NAME:"invalid-event-name",INVALID_URL:"invalid-url",INVALID_DEFAULT_BUCKET:"invalid-default-bucket",NO_DEFAULT_BUCKET:"no-default-bucket",CANNOT_SLICE_BLOB:"cannot-slice-blob",SERVER_FILE_WRONG_SIZE:"server-file-wrong-size",NO_DOWNLOAD_URL:"no-download-url",INVALID_ARGUMENT:"invalid-argument",INVALID_ARGUMENT_COUNT:"invalid-argument-count",APP_DELETED:"app-deleted",INVALID_ROOT_OPERATION:"invalid-root-operation",INVALID_FORMAT:"invalid-format",INTERNAL_ERROR:"internal-error"};function EO(t){return"storage/"+t}function IO(){return new bO(_O.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function TO(){return new bO(_O.CANCELED,"User canceled the upload/download.")}function SO(){return new bO(_O.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function CO(t,e,n){return new bO(_O.INVALID_ARGUMENT,"Invalid argument in `"+e+"` at index "+t+": "+n)}function NO(){return new bO(_O.APP_DELETED,"The Firebase app was deleted.")}function AO(t,e){return new bO(_O.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function kO(t){throw new bO(_O.INTERNAL_ERROR,"Internal error: "+t)}var OO={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};function PO(t){switch(t){case OO.RAW:case OO.BASE64:case OO.BASE64URL:case OO.DATA_URL:return;default:throw"Expected one of the event types: ["+OO.RAW+", "+OO.BASE64+", "+OO.BASE64URL+", "+OO.DATA_URL+"]."}}var RO=function(t,e){this.data=t,this.contentType=e||null};function DO(t,e){switch(t){case OO.RAW:return new RO(xO(e));case OO.BASE64:case OO.BASE64URL:return new RO(LO(t,e));case OO.DATA_URL:return new RO((n=new MO(e)).base64?LO(OO.BASE64,n.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw AO(OO.DATA_URL,"Malformed data URL.")}return xO(e)}(n.rest),new MO(e).contentType)}var n;throw IO()}function xO(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|63&r);else if(55296==(64512&r))if(n<t.length-1&&56320==(64512&t.charCodeAt(n+1)))r=65536|(1023&r)<<10|1023&t.charCodeAt(++n),e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r);else e.push(239,191,189);else 56320==(64512&r)?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|63&r)}return new Uint8Array(e)}function LO(e,t){switch(e){case OO.BASE64:var n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r)throw AO(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case OO.BASE64URL:var i=-1!==t.indexOf("+"),o=-1!==t.indexOf("/");if(i||o)throw AO(e,"Invalid character '"+(i?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}var s;try{s=atob(t)}catch(t){throw AO(e,"Invalid character found")}for(var a=new Uint8Array(s.length),u=0;u<s.length;u++)a[u]=s.charCodeAt(u);return a}var MO=function(t){this.base64=!1,this.contentType=null;var e=t.match(/^data:([^,]+)?,/);if(null===e)throw AO(OO.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");var n,r,i=e[1]||null;null!=i&&(this.base64=(r=";base64",(n=i).length>=r.length&&n.substring(n.length-r.length)===r),this.contentType=this.base64?i.substring(0,i.length-";base64".length):i),this.rest=t.substring(t.indexOf(",")+1)};var FO,UO,jO={STATE_CHANGED:"state_changed"},VO="running",qO="pausing",BO="paused",WO="success",HO="canceling",KO="canceled",GO="error",zO={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function QO(t){switch(t){case VO:case qO:case HO:return zO.RUNNING;case BO:return zO.PAUSED;case WO:return zO.SUCCESS;case KO:return zO.CANCELED;case GO:default:return zO.ERROR}}function XO(t){return null!=t}function YO(t){return void 0!==t}function $O(t){return"function"==typeof t}function JO(t){return"object"==typeof t}function ZO(t){return"string"==typeof t||t instanceof String}function tP(t){return"number"==typeof t||t instanceof Number}function eP(t){return nP()&&t instanceof Blob}function nP(){return"undefined"!=typeof Blob}(UO=FO=FO||{})[UO.NO_ERROR=0]="NO_ERROR",UO[UO.NETWORK_ERROR=1]="NETWORK_ERROR",UO[UO.ABORT=2]="ABORT";var rP=(iP.prototype.send=function(t,e,n,r){if(this.sent_)throw kO("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),XO(r))for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return XO(n)?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},iP.prototype.getErrorCode=function(){if(!this.sent_)throw kO("cannot .getErrorCode() before sending");return this.errorCode_},iP.prototype.getStatus=function(){if(!this.sent_)throw kO("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},iP.prototype.getResponseText=function(){if(!this.sent_)throw kO("cannot .getResponseText() before sending");return this.xhr_.responseText},iP.prototype.abort=function(){this.xhr_.abort()},iP.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},iP.prototype.addUploadProgressListener=function(t){XO(this.xhr_.upload)&&this.xhr_.upload.addEventListener("progress",t)},iP.prototype.removeUploadProgressListener=function(t){XO(this.xhr_.upload)&&this.xhr_.upload.removeEventListener("progress",t)},iP);function iP(){var e=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=FO.NO_ERROR,this.sendPromise_=new Promise(function(t){e.xhr_.addEventListener("abort",function(){e.errorCode_=FO.ABORT,t(e)}),e.xhr_.addEventListener("error",function(){e.errorCode_=FO.NETWORK_ERROR,t(e)}),e.xhr_.addEventListener("load",function(){t(e)})})}var oP=(sP.prototype.createXhrIo=function(){return new rP},sP);function sP(){}function aP(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0;if(void 0!==n){for(var r=new n,i=0;i<t.length;i++)r.append(t[i]);return r.getBlob()}if(nP())return new Blob(t);throw Error("This browser doesn't seem to support creating Blobs")}var uP=(cP.prototype.size=function(){return this.size_},cP.prototype.type=function(){return this.type_},cP.prototype.slice=function(t,e){if(eP(this.data_)){var n=this.data_,r=(o=t,s=e,(i=n).webkitSlice?i.webkitSlice(o,s):i.mozSlice?i.mozSlice(o,s):i.slice?i.slice(o,s):null);return null===r?null:new cP(r)}var i,o,s;return new cP(new Uint8Array(this.data_.buffer,t,e-t),!0)},cP.getBlob=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(nP()){var n=t.map(function(t){return t instanceof cP?t.data_:t});return new cP(aP.apply(null,n))}var r=t.map(function(t){return ZO(t)?DO(OO.RAW,t).data:t.data_}),i=0;r.forEach(function(t){i+=t.byteLength});var o=new Uint8Array(i),s=0;return r.forEach(function(t){for(var e=0;e<t.length;e++)o[s++]=t[e]}),new cP(o,!0)},cP.prototype.uploadData=function(){return this.data_},cP);function cP(t,e){var n=0,r="";eP(t)?(n=(this.data_=t).size,r=t.type):t instanceof ArrayBuffer?(e?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),n=this.data_.length):t instanceof Uint8Array&&(e?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),n=t.length),this.size_=n,this.type_=r}var hP=(Object.defineProperty(lP.prototype,"path",{get:function(){return this.path_},enumerable:!1,configurable:!0}),Object.defineProperty(lP.prototype,"isRoot",{get:function(){return 0===this.path.length},enumerable:!1,configurable:!0}),lP.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},lP.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},lP.makeFromBucketSpec=function(e){var t,n;try{t=lP.makeFromUrl(e)}catch(t){return new lP(e,"")}if(""===t.path)return t;throw n=e,new bO(_O.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")},lP.makeFromUrl=function(t){var e=null,n="([A-Za-z0-9.\\-_]+)",r=new RegExp("^gs://"+n+"(/(.*))?$","i");function i(t){t.path_=decodeURIComponent(t.path)}for(var o,s=mO.replace(/[.]/g,"\\."),a=[{regex:r,indices:{bucket:1,path:3},postModify:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path_=t.path_.slice(0,-1))}},{regex:new RegExp("^https?://"+s+"/v[A-Za-z0-9_]+/b/"+n+"/o(/([^?#]*).*)?$","i"),indices:{bucket:1,path:3},postModify:i},{regex:new RegExp("^https?://(?:storage.googleapis.com|storage.cloud.google.com)/"+n+"/([^?#]*)","i"),indices:{bucket:1,path:2},postModify:i}],u=0;u<a.length;u++){var c=a[u],h=c.regex.exec(t);if(h){var l=h[c.indices.bucket],f=h[c.indices.path];e=new lP(l,f=f||""),c.postModify(e);break}}if(null==e)throw o=t,new bO(_O.INVALID_URL,"Invalid URL '"+o+"'.");return e},lP);function lP(t,e){this.bucket=t,this.path_=e}function fP(t){var e,n;try{e=JSON.parse(t)}catch(t){return null}return JO(n=e)&&!Array.isArray(n)?e:null}function pP(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function dP(t){return"https://"+mO+"/v0"+t}function vP(t){var e=encodeURIComponent,n="?";for(var r in t){if(t.hasOwnProperty(r))n=n+(e(r)+"="+e(t[r]))+"&"}return n=n.slice(0,-1)}function yP(t,e){return e}var gP=function(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||yP},mP=null;function bP(){if(mP)return mP;var t=[];t.push(new gP("bucket")),t.push(new gP("generation")),t.push(new gP("metageneration")),t.push(new gP("name","fullPath",!0));var e=new gP("name");e.xform=function(t,e){return!ZO(n=e)||n.length<2?n:pP(n);var n},t.push(e);var n=new gP("size");return n.xform=function(t,e){return XO(e)?Number(e):e},t.push(n),t.push(new gP("timeCreated")),t.push(new gP("updated")),t.push(new gP("md5Hash",null,!0)),t.push(new gP("cacheControl",null,!0)),t.push(new gP("contentDisposition",null,!0)),t.push(new gP("contentEncoding",null,!0)),t.push(new gP("contentLanguage",null,!0)),t.push(new gP("contentType",null,!0)),t.push(new gP("metadata","customMetadata",!0)),mP=t}function wP(r,i){Object.defineProperty(r,"ref",{get:function(){var t=r.bucket,e=r.fullPath,n=new hP(t,e);return i.makeStorageReference(n)}})}function _P(t,e,n){var r=fP(e);return null===r?null:function(t,e,n){for(var r={type:"file"},i=n.length,o=0;o<i;o++){var s=n[o];r[s.local]=s.xform(r,e[s.server])}return wP(r,t),r}(t,r,n)}function EP(t,e){for(var n={},r=e.length,i=0;i<r;i++){var o=e[i];o.writable&&(n[o.server]=t[o.local])}return JSON.stringify(n)}function IP(t){if(!JO(t)||!t)throw"Expected Metadata object.";for(var e in t)if(t.hasOwnProperty(e)){var n=t[e];if("customMetadata"===e){if(!JO(n))throw"Expected object for 'customMetadata' mapping."}else if(JO(r=n)&&null!==r)throw"Mapping for '"+e+"' cannot be an object."}var r}var TP="maxResults",SP=1e3,CP="pageToken",NP="prefixes",AP="items";function kP(t,e,n){var r=fP(n);return null===r?null:function(t,e,n){var r={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n[NP])for(var i=0,o=n[NP];i<o.length;i++){var s=o[i].replace(/\/$/,""),a=t.makeStorageReference(new hP(e,s));r.prefixes.push(a)}if(n[AP])for(var u=0,c=n[AP];u<c.length;u++){var h=c[u];a=t.makeStorageReference(new hP(e,h.name));r.items.push(a)}return r}(t,e,r)}function OP(t){if(!JO(t)||!t)throw"Expected ListOptions object.";for(var e in t)if(e===TP){if(!tP(n=t[TP])||!Number.isInteger(n)||t[TP]<=0)throw"Expected maxResults to be a positive number.";if(1e3<t[TP])throw"Expected maxResults to be less than or equal to "+SP+"."}else{if(e!==CP)throw"Unknown option: "+e;if(t[CP]&&!ZO(t[CP]))throw"Expected pageToken to be string."}var n}var PP=function(t,e,n,r){this.url=t,this.method=e,this.handler=n,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]};function RP(t){if(!t)throw IO()}function DP(r,i){return function(t,e){var n=_P(r,e,i);return RP(null!==n),n}}function xP(r,i){return function(t,e){var n=kP(r,i,e);return RP(null!==n),n}}function LP(r,i){return function(t,e){var n=_P(r,e,i);return RP(null!==n),function(r,t){var e=fP(t);if(null===e)return null;if(!ZO(e.downloadTokens))return null;var n=e.downloadTokens;if(0===n.length)return null;var i=encodeURIComponent;return n.split(",").map(function(t){var e=r.bucket,n=r.fullPath;return dP("/b/"+i(e)+"/o/"+i(n))+vP({alt:"media",token:t})})[0]}(n,e)}}function MP(o){return function(t,e){var n,r,i;return(n=401===t.getStatus()?new bO(_O.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(i=o.bucket,new bO(_O.QUOTA_EXCEEDED,"Quota for bucket '"+i+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=o.path,new bO(_O.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):e).setServerResponseProp(e.serverResponseProp()),n}}function FP(i){var o=MP(i);return function(t,e){var n,r=o(t,e);return 404===t.getStatus()&&(n=i.path,r=new bO(_O.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")),r.setServerResponseProp(e.serverResponseProp()),r}}function UP(t,e,n){var r=dP(e.fullServerUrl()),i=t.maxOperationRetryTime,o=new PP(r,"GET",DP(t,n),i);return o.errorHandler=FP(e),o}function jP(t,e,n){var r,i,o=Object.assign({},n);return o.fullPath=t.path,o.size=e.size(),o.contentType||(o.contentType=(i=e,(r=null)&&r.contentType||i&&i.type()||"application/octet-stream")),o}function VP(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),s={"X-Goog-Upload-Protocol":"multipart"};var a=function(){for(var t="",e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();s["Content-Type"]="multipart/related; boundary="+a;var u=jP(e,r,i),c="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+EP(u,n)+"\r\n--"+a+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",h="\r\n--"+a+"--",l=uP.getBlob(c,r,h);if(null===l)throw SO();var f={name:u.fullPath},p=dP(o),d=t.maxUploadRetryTime,v=new PP(p,"POST",DP(t,n),d);return v.urlParams=f,v.headers=s,v.body=l.uploadData(),v.errorHandler=MP(e),v}var qP=function(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null};function BP(t,e){var n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){RP(!1)}return RP(!!n&&-1!==(e||["active"]).indexOf(n)),n}function WP(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),s=jP(e,r,i),a={name:s.fullPath},u=dP(o),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":r.size(),"X-Goog-Upload-Header-Content-Type":s.contentType,"Content-Type":"application/json; charset=utf-8"},h=EP(s,n),l=t.maxUploadRetryTime;var f=new PP(u,"POST",function(t){var e;BP(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){RP(!1)}return RP(ZO(e)),e},l);return f.urlParams=a,f.headers=c,f.body=h,f.errorHandler=MP(e),f}function HP(t,e,n,i){var r=t.maxUploadRetryTime,o=new PP(n,"POST",function(t){var e=BP(t,["active","final"]),n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){RP(!1)}n||RP(!1);var r=Number(n);return RP(!isNaN(r)),new qP(r,i.size(),"final"===e)},r);return o.headers={"X-Goog-Upload-Command":"query"},o.errorHandler=MP(e),o}function KP(t,s,e,a,n,u,r,i){var c=new qP(0,0);if(r?(c.current=r.current,c.total=r.total):(c.current=0,c.total=a.size()),a.size()!==c.total)throw new bO(_O.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");var o=c.total-c.current,h=o;0<n&&(h=Math.min(h,n));var l=c.current,f=l+h,p={"X-Goog-Upload-Command":h===o?"upload, finalize":"upload","X-Goog-Upload-Offset":c.current},d=a.slice(l,f);if(null===d)throw SO();var v=s.maxUploadRetryTime,y=new PP(e,"POST",function(t,e){var n,r=BP(t,["active","final"]),i=c.current+h,o=a.size();return n="final"===r?DP(s,u)(t,e):null,new qP(i,o,"final"===r,n)},v);return y.headers=p,y.body=d.uploadData(),y.progressCallback=i||null,y.errorHandler=MP(t),y}var GP=function(t,e,n){if($O(t)||XO(e)||XO(n))this.next=t,this.error=e||null,this.complete=n||null;else{var r=t;this.next=r.next||null,this.error=r.error||null,this.complete=r.complete||null}},zP=function(t,e,n,r,i,o){this.bytesTransferred=t,this.totalBytes=e,this.state=n,this.metadata=r,this.task=i,this.ref=o};function QP(e,t,n){for(var r=t.length,i=t.length,o=0;o<t.length;o++)if(t[o].optional){r=o;break}var s,a,u,c,h,l;if(!(r<=n.length&&n.length<=i))throw s=r,a=i,u=e,c=n.length,l=s===a?1===(h=s)?"argument":"arguments":(h="between "+s+" and "+a,"arguments"),new bO(_O.INVALID_ARGUMENT_COUNT,"Invalid argument count in `"+u+"`: Expected "+h+" "+l+", received "+c+".");for(o=0;o<n.length;o++)try{t[o].validator(n[o])}catch(t){throw t instanceof Error?CO(o,e,t.message):CO(o,e,t)}}var XP=function(e,t){var n=this;this.validator=function(t){n.optional&&!YO(t)||e(t)},this.optional=!!t};function YP(t,e){function n(t){if(!ZO(t))throw"Expected string."}var r,i,o;return r=t?(i=n,o=t,function(t){i(t),o(t)}):n,new XP(r,e)}function $P(){return new XP(function(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer||nP()&&t instanceof Blob))throw"Expected Blob or File."})}function JP(t){return new XP(IP,t)}function ZP(){return new XP(function(t){if(!(tP(t)&&0<=t))throw"Expected a number 0 or greater."})}function tR(e,t){return new XP(function(t){if(!(null===t||XO(t)&&t instanceof Object))throw"Expected an Object.";null!=e&&e(t)},t)}function eR(t){return new XP(function(t){if(!(null===t||$O(t)))throw"Expected a Function."},t)}function nR(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Promise.resolve().then(function(){return n.apply(void 0,t)})}}var rR=(iR.prototype.makeProgressCallback_=function(){var e=this,n=this.transferred_;return function(t){return e.updateProgress_(n+t)}},iR.prototype.shouldDoResumable_=function(t){return 262144<t.size()},iR.prototype.start_=function(){this.state_===VO&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},iR.prototype.resolveToken_=function(e){var n=this;this.service_.getAuthToken().then(function(t){switch(n.state_){case VO:e(t);break;case HO:n.transition_(KO);break;case qO:n.transition_(BO)}})},iR.prototype.createResumable_=function(){var r=this;this.resolveToken_(function(t){var e=WP(r.service_,r.location_,r.mappings_,r.blob_,r.metadata_),n=r.service_.makeRequest(e,t);(r.request_=n).getPromise().then(function(t){r.request_=null,r.uploadUrl_=t,r.needToFetchStatus_=!1,r.completeTransitions_()},r.errorHandler_)})},iR.prototype.fetchStatus_=function(){var r=this,i=this.uploadUrl_;this.resolveToken_(function(t){var e=HP(r.service_,r.location_,i,r.blob_),n=r.service_.makeRequest(e,t);(r.request_=n).getPromise().then(function(t){t=t,r.request_=null,r.updateProgress_(t.current),r.needToFetchStatus_=!1,t.finalized&&(r.needToFetchMetadata_=!0),r.completeTransitions_()},r.errorHandler_)})},iR.prototype.continueUpload_=function(){var r=this,i=262144*this.chunkMultiplier_,o=new qP(this.transferred_,this.blob_.size()),s=this.uploadUrl_;this.resolveToken_(function(t){var e;try{e=KP(r.location_,r.service_,s,r.blob_,i,r.mappings_,o,r.makeProgressCallback_())}catch(t){return r.error_=t,void r.transition_(GO)}var n=r.service_.makeRequest(e,t);(r.request_=n).getPromise().then(function(t){r.increaseMultiplier_(),r.request_=null,r.updateProgress_(t.current),t.finalized?(r.metadata_=t.metadata,r.transition_(WO)):r.completeTransitions_()},r.errorHandler_)})},iR.prototype.increaseMultiplier_=function(){262144*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},iR.prototype.fetchMetadata_=function(){var r=this;this.resolveToken_(function(t){var e=UP(r.service_,r.location_,r.mappings_),n=r.service_.makeRequest(e,t);(r.request_=n).getPromise().then(function(t){r.request_=null,r.metadata_=t,r.transition_(WO)},r.metadataErrorHandler_)})},iR.prototype.oneShotUpload_=function(){var r=this;this.resolveToken_(function(t){var e=VP(r.service_,r.location_,r.mappings_,r.blob_,r.metadata_),n=r.service_.makeRequest(e,t);(r.request_=n).getPromise().then(function(t){r.request_=null,r.metadata_=t,r.updateProgress_(r.blob_.size()),r.transition_(WO)},r.errorHandler_)})},iR.prototype.updateProgress_=function(t){var e=this.transferred_;this.transferred_=t,this.transferred_!==e&&this.notifyObservers_()},iR.prototype.transition_=function(t){if(this.state_!==t)switch(t){case HO:case qO:this.state_=t,null!==this.request_&&this.request_.cancel();break;case VO:var e=this.state_===BO;this.state_=t,e&&(this.notifyObservers_(),this.start_());break;case BO:this.state_=t,this.notifyObservers_();break;case KO:this.error_=TO(),this.state_=t,this.notifyObservers_();break;case GO:case WO:this.state_=t,this.notifyObservers_()}},iR.prototype.completeTransitions_=function(){switch(this.state_){case qO:this.transition_(BO);break;case HO:this.transition_(KO);break;case VO:this.start_()}},Object.defineProperty(iR.prototype,"snapshot",{get:function(){var t=QO(this.state_);return new zP(this.transferred_,this.blob_.size(),t,this.metadata_,this,this.ref_)},enumerable:!1,configurable:!0}),iR.prototype.on=function(t,e,n,o){var r="Expected a function or an Object with one of `next`, `error`, `complete` properties.",i=eR(!0).validator,s=tR(null,!0).validator;function a(t){try{return void i(t)}catch(t){}try{if(s(t),!(YO(t.next)||YO(t.error)||YO(t.complete)))throw"";return}catch(t){throw r}}QP("on",[YP(function(){if(t!==jO.STATE_CHANGED)throw"Expected one of the event types: ["+jO.STATE_CHANGED+"]."}),tR(a,!0),eR(!0),eR(!0)],arguments);var u=this;function c(i){return function(t,e,n){null!==i&&QP("on",i,arguments);var r=new GP(t,e,o);return u.addObserver_(r),function(){u.removeObserver_(r)}}}var h=[tR(function(t){if(null===t)throw r;a(t)}),eR(!0),eR(!0)];return YO(e)||YO(n)||YO(o)?c(null)(e,n,o):c(h)},iR.prototype.then=function(t,e){return this.promise_.then(t,e)},iR.prototype.catch=function(t){return this.then(null,t)},iR.prototype.addObserver_=function(t){this.observers_.push(t),this.notifyObserver_(t)},iR.prototype.removeObserver_=function(t){var e=this.observers_.indexOf(t);-1!==e&&this.observers_.splice(e,1)},iR.prototype.notifyObservers_=function(){var e=this;this.finishPromise_(),this.observers_.slice().forEach(function(t){e.notifyObserver_(t)})},iR.prototype.finishPromise_=function(){if(null!==this.resolve_){var t=!0;switch(QO(this.state_)){case zO.SUCCESS:nR(this.resolve_.bind(null,this.snapshot))();break;case zO.CANCELED:case zO.ERROR:nR(this.reject_.bind(null,this.error_))();break;default:t=!1}t&&(this.resolve_=null,this.reject_=null)}},iR.prototype.notifyObserver_=function(t){switch(QO(this.state_)){case zO.RUNNING:case zO.PAUSED:t.next&&nR(t.next.bind(t,this.snapshot))();break;case zO.SUCCESS:t.complete&&nR(t.complete.bind(t))();break;case zO.CANCELED:case zO.ERROR:t.error&&nR(t.error.bind(t,this.error_))();break;default:t.error&&nR(t.error.bind(t,this.error_))()}},iR.prototype.resume=function(){QP("resume",[],arguments);var t=this.state_===BO||this.state_===qO;return t&&this.transition_(VO),t},iR.prototype.pause=function(){QP("pause",[],arguments);var t=this.state_===VO;return t&&this.transition_(qO),t},iR.prototype.cancel=function(){QP("cancel",[],arguments);var t=this.state_===VO||this.state_===qO;return t&&this.transition_(HO),t},iR);function iR(t,e,n,r,i,o){var s=this;void 0===o&&(o=null),this.transferred_=0,this.needToFetchStatus_=!1,this.needToFetchMetadata_=!1,this.observers_=[],this.error_=null,this.uploadUrl_=null,this.request_=null,this.chunkMultiplier_=1,this.resolve_=null,this.reject_=null,this.ref_=t,this.service_=e,this.location_=n,this.blob_=i,this.metadata_=o,this.mappings_=r,this.resumable_=this.shouldDoResumable_(this.blob_),this.state_=VO,this.errorHandler_=function(t){s.request_=null,s.chunkMultiplier_=1,t.codeEquals(_O.CANCELED)?(s.needToFetchStatus_=!0,s.completeTransitions_()):(s.error_=t,s.transition_(GO))},this.metadataErrorHandler_=function(t){s.request_=null,t.codeEquals(_O.CANCELED)?s.completeTransitions_():(s.error_=t,s.transition_(GO))},this.promise_=new Promise(function(t,e){s.resolve_=t,s.reject_=e,s.start_()}),this.promise_.then(null,function(){})}var oR=(sR.prototype.toString=function(){return QP("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},sR.prototype.newRef=function(t,e){return new sR(t,e)},sR.prototype.mappings=function(){return bP()},sR.prototype.child=function(t){QP("child",[YP()],arguments);var e,n,r=(e=this.location.path,n=t.split("/").filter(function(t){return 0<t.length}).join("/"),0===e.length?n:e+"/"+n),i=new hP(this.location.bucket,r);return this.newRef(this.service,i)},Object.defineProperty(sR.prototype,"parent",{get:function(){var t=function(t){if(0===t.length)return null;var e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}(this.location.path);if(null===t)return null;var e=new hP(this.location.bucket,t);return this.newRef(this.service,e)},enumerable:!1,configurable:!0}),Object.defineProperty(sR.prototype,"root",{get:function(){var t=new hP(this.location.bucket,"");return this.newRef(this.service,t)},enumerable:!1,configurable:!0}),Object.defineProperty(sR.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(sR.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!1,configurable:!0}),Object.defineProperty(sR.prototype,"name",{get:function(){return pP(this.location.path)},enumerable:!1,configurable:!0}),Object.defineProperty(sR.prototype,"storage",{get:function(){return this.service},enumerable:!1,configurable:!0}),sR.prototype.put=function(t,e){return void 0===e&&(e=null),QP("put",[$P(),JP(!0)],arguments),this.throwIfRoot_("put"),new rR(this,this.service,this.location,this.mappings(),new uP(t),e)},sR.prototype.putString=function(t,e,n){void 0===e&&(e=OO.RAW),QP("putString",[YP(),YP(PO,!0),JP(!0)],arguments),this.throwIfRoot_("putString");var r=DO(e,t),i=Object.assign({},n);return!XO(i.contentType)&&XO(r.contentType)&&(i.contentType=r.contentType),new rR(this,this.service,this.location,this.mappings(),new uP(r.data,!0),i)},sR.prototype.delete=function(){var a=this;return QP("delete",[],arguments),this.throwIfRoot_("delete"),this.service.getAuthToken().then(function(t){var e,n,r,i,o,s=(e=a.service,n=a.location,r=dP(n.fullServerUrl()),i=e.maxOperationRetryTime,(o=new PP(r,"DELETE",function(t,e){},i)).successCodes=[200,204],o.errorHandler=FP(n),o);return a.service.makeRequest(s,t).getPromise()})},sR.prototype.listAll=function(){QP("listAll",[],arguments);var t={prefixes:[],items:[]};return this.listAllHelper(t).then(function(){return t})},sR.prototype.listAllHelper=function(o,s){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return e={pageToken:s},[4,this.list(e)];case 1:return n=t.sent(),(r=o.prefixes).push.apply(r,n.prefixes),(i=o.items).push.apply(i,n.items),null==n.nextPageToken?[3,3]:[4,this.listAllHelper(o,n.nextPageToken)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},sR.prototype.list=function(r){QP("list",[new XP(OP,!0)],arguments);var i=this;return this.service.getAuthToken().then(function(t){var e=r||{},n=function(t,e,n,r,i){var o={};e.isRoot?o.prefix="":o.prefix=e.path+"/",n&&0<n.length&&(o.delimiter=n),r&&(o.pageToken=r),i&&(o.maxResults=i);var s=dP(e.bucketOnlyServerUrl()),a=t.maxOperationRetryTime,u=new PP(s,"GET",xP(t,e.bucket),a);return u.urlParams=o,u.errorHandler=MP(e),u}(i.service,i.location,"/",e.pageToken,e.maxResults);return i.service.makeRequest(n,t).getPromise()})},sR.prototype.getMetadata=function(){var n=this;return QP("getMetadata",[],arguments),this.throwIfRoot_("getMetadata"),this.service.getAuthToken().then(function(t){var e=UP(n.service,n.location,n.mappings());return n.service.makeRequest(e,t).getPromise()})},sR.prototype.updateMetadata=function(h){var l=this;return QP("updateMetadata",[JP()],arguments),this.throwIfRoot_("updateMetadata"),this.service.getAuthToken().then(function(t){var e,n,r,i,o,s,a,u,c=(e=l.service,n=l.location,r=h,i=l.mappings(),o=dP(n.fullServerUrl()),s=EP(r,i),a=e.maxOperationRetryTime,(u=new PP(o,"PATCH",DP(e,i),a)).headers={"Content-Type":"application/json; charset=utf-8"},u.body=s,u.errorHandler=FP(n),u);return l.service.makeRequest(c,t).getPromise()})},sR.prototype.getDownloadURL=function(){var u=this;return QP("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL"),this.service.getAuthToken().then(function(t){var e,n,r,i,o,s,a=(e=u.service,n=u.location,r=u.mappings(),i=dP(n.fullServerUrl()),o=e.maxOperationRetryTime,(s=new PP(i,"GET",LP(e,r),o)).errorHandler=FP(n),s);return u.service.makeRequest(a,t).getPromise().then(function(t){if(null===t)throw new bO(_O.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return t})})},sR.prototype.throwIfRoot_=function(t){if(""===this.location.path)throw e=t,new bO(_O.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').");var e},sR);function sR(t,e){this.service=t,this.location=e instanceof hP?e:hP.makeFromUrl(e)}var aR=(uR.prototype.getPromise=function(){return this.promise_},uR.prototype.cancel=function(t){},uR);function uR(t){this.promise_=Promise.reject(t)}var cR=(hR.prototype.start_=function(){var e,n,t,r,i,o,s,a,u,c=this;function h(t,e){var n,r=c.resolve_,i=c.reject_,o=e.xhr;if(e.wasSuccessCode)try{var s=c.callback_(o,o.getResponseText());YO(s)?r(s):r()}catch(t){i(t)}else null!==o?((n=IO()).setServerResponseProp(o.getResponseText()),c.errorCallback_?i(c.errorCallback_(o,n)):i(n)):e.canceled?i(n=(c.appDelete_?NO:TO)()):i(n=new bO(_O.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again."))}function l(){return 2===s}function f(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];a||(a=!0,n.apply(null,t))}function p(t){i=setTimeout(function(){i=null,e(d,l())},t)}function d(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];a||(t||l()||o?f.call.apply(f,ks([null,t],e)):(r<64&&(r*=2),p(1===s?(s=2,0):1e3*(r+Math.random()))))}function v(t){u||(u=!0,a||(null!==i?(t||(s=2),clearTimeout(i),p(0)):t||(s=1)))}this.canceled_?h(0,new lR(!1,null,!0)):this.backoffId_=(e=function(o,t){if(t)o(!1,new lR(!1,null,!0));else{var e=c.pool_.createXhrIo();c.pendingXhr_=e,null!==c.progressCallback_&&e.addUploadProgressListener(s),e.send(c.url_,c.method_,c.body_,c.headers_).then(function(t){null!==c.progressCallback_&&t.removeUploadProgressListener(s),c.pendingXhr_=null;var e=(t=t).getErrorCode()===FO.NO_ERROR,n=t.getStatus();if(e&&!c.isRetryStatusCode_(n)){var r=-1!==c.successCodes_.indexOf(n);o(!0,new lR(r,t))}else{var i=t.getErrorCode()===FO.ABORT;o(!1,new lR(!1,null,i))}})}function s(t){var e=t.loaded,n=t.lengthComputable?t.total:-1;null!==c.progressCallback_&&c.progressCallback_(e,n)}},n=h,t=this.timeout_,i=null,u=a=o=!(r=1),p(s=0),setTimeout(function(){v(o=!0)},t),v)},hR.prototype.getPromise=function(){return this.promise_},hR.prototype.cancel=function(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingXhr_&&this.pendingXhr_.abort()},hR.prototype.isRetryStatusCode_=function(t){var e=500<=t&&t<600,n=-1!==[408,429].indexOf(t),r=-1!==this.additionalRetryCodes_.indexOf(t);return e||n||r},hR);function hR(t,e,n,r,i,o,s,a,u,c,h){var l=this;this.pendingXhr_=null,this.backoffId_=null,this.resolve_=null,this.reject_=null,this.canceled_=!1,this.appDelete_=!1,this.url_=t,this.method_=e,this.headers_=n,this.body_=r,this.successCodes_=i.slice(),this.additionalRetryCodes_=o.slice(),this.callback_=s,this.errorCallback_=a,this.progressCallback_=c,this.timeout_=u,this.pool_=h,this.promise_=new Promise(function(t,e){l.resolve_=t,l.reject_=e,l.start_()})}var lR=function(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n};function fR(t,e,n,r){var i,o,s,a,u,c,h=vP(t.urlParams),l=t.url+h,f=Object.assign({},t.headers);return i=f,(o=e)&&(i["X-Firebase-GMPID"]=o),s=f,null!==(a=n)&&0<a.length&&(s.Authorization="Firebase "+a),u=f,c=void 0!==zl?zl.SDK_VERSION:"AppManager",u["X-Firebase-Storage-Version"]="webjs/"+c,new cR(l,t.method,f,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,r)}var pR=(dR.extractBucket_=function(t){var e=null==t?void 0:t.storageBucket;return null==e?null:hP.makeFromBucketSpec(e)},dR.prototype.getAuthToken=function(){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return(e=this.authProvider_.getImmediate({optional:!0}))?[4,e.getToken()]:[3,2];case 1:if(null!==(n=t.sent()))return[2,n.accessToken];t.label=2;case 2:return[2,null]}})})},dR.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requests_.forEach(function(t){return t.cancel()}),this.requests_.clear()},dR.prototype.makeStorageReference=function(t){return new oR(this,t)},dR.prototype.makeRequest=function(t,e){var n=this;if(this.deleted_)return new aR(NO());var r=fR(t,this.appId_,e,this.pool_);return this.requests_.add(r),r.getPromise().then(function(){return n.requests_.delete(r)},function(){return n.requests_.delete(r)}),r},dR.prototype.ref=function(t){if(QP("ref",[YP(function(t){if("string"!=typeof t)throw"Path is not a string.";if(/^[A-Za-z]+:\/\//.test(t))throw"Expected child path but got a URL, use refFromURL instead."},!0)],arguments),null==this.bucket_)throw new Error("No Storage Bucket defined in Firebase Options.");var e=new oR(this,this.bucket_);return null!=t?e.child(t):e},dR.prototype.refFromURL=function(t){return QP("refFromURL",[YP(function(t){if("string"!=typeof t)throw"Path is not a string.";if(!/^[A-Za-z]+:\/\//.test(t))throw"Expected full URL but got a child path, use ref instead.";try{hP.makeFromUrl(t)}catch(t){throw"Expected valid full URL but got an invalid one."}},!1)],arguments),new oR(this,t)},Object.defineProperty(dR.prototype,"maxUploadRetryTime",{get:function(){return this.maxUploadRetryTime_},enumerable:!1,configurable:!0}),dR.prototype.setMaxUploadRetryTime=function(t){QP("setMaxUploadRetryTime",[ZP()],arguments),this.maxUploadRetryTime_=t},Object.defineProperty(dR.prototype,"maxOperationRetryTime",{get:function(){return this.maxOperationRetryTime_},enumerable:!1,configurable:!0}),dR.prototype.setMaxOperationRetryTime=function(t){QP("setMaxOperationRetryTime",[ZP()],arguments),this.maxOperationRetryTime_=t},Object.defineProperty(dR.prototype,"app",{get:function(){return this.app_},enumerable:!1,configurable:!0}),Object.defineProperty(dR.prototype,"INTERNAL",{get:function(){return this.internals_},enumerable:!1,configurable:!0}),dR);function dR(t,e,n,r){var i;this.bucket_=null,this.appId_=null,this.deleted_=!1,this.app_=t,this.authProvider_=e,this.maxOperationRetryTime_=12e4,this.maxUploadRetryTime_=6e5,this.requests_=new Set,this.pool_=n,this.bucket_=null!=r?hP.makeFromBucketSpec(r):dR.extractBucket_(null===(i=this.app_)||void 0===i?void 0:i.options),this.internals_=new vR(this)}var vR=(yR.prototype.delete=function(){return this.service_.deleteApp(),Promise.resolve()},yR);function yR(t){this.service_=t}var gR,mR;function bR(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal");return new pR(n,r,new oP,e)}mR={TaskState:zO,TaskEvent:jO,StringFormat:OO,Storage:pR,Reference:oR},(gR=zl).INTERNAL.registerComponent(new ga("storage",bR,"PUBLIC").setServiceProps(mR).setMultipleInstances(!0)),gR.registerVersion("@firebase/storage","0.3.41");var wR,_R,ER,IR,TR="0.3.10",SR="FB-PERF-TRACE-MEASURE",CR="@firebase/performance/config",NR="@firebase/performance/configexpire",AR="Performance",kR=((wR={})["trace started"]="Trace {$traceName} was started before.",wR["trace stopped"]="Trace {$traceName} is not running.",wR["no window"]="Window is not available.",wR["no app id"]="App id is not available.",wR["no project id"]="Project id is not available.",wR["no api key"]="Api key is not available.",wR["invalid cc log"]="Attempted to queue invalid cc event",wR["FB not default"]="Performance can only start when Firebase app instance is the default one.",wR["RC response not ok"]="RC response is not ok",wR["invalid attribute name"]="Attribute name {$attributeName} is invalid.",wR["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",wR["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",wR["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",wR),OR=new Ys("performance",AR,kR),PR=(RR.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},RR.prototype.mark=function(t){this.performance&&this.performance.mark&&this.performance.mark(t)},RR.prototype.measure=function(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)},RR.prototype.getEntriesByType=function(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]},RR.prototype.getEntriesByName=function(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]},RR.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},RR.prototype.requiredApisAvailable=function(){return!!(fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled)},RR.prototype.setupObserver=function(t,i){this.PerformanceObserver&&new this.PerformanceObserver(function(t){for(var e=0,n=t.getEntries();e<n.length;e++){var r=n[e];i(r)}}).observe({entryTypes:[t]})},RR.getInstance=function(){return void 0===_R&&(_R=new RR(ER)),_R},RR);function RR(t){if(!(this.window=t))throw OR.create("no window");this.performance=t.performance,this.PerformanceObserver=t.PerformanceObserver,this.windowLocation=t.location,this.navigator=t.navigator,this.document=t.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=t.localStorage),t.perfMetrics&&t.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=t.perfMetrics.onFirstInputDelay)}function DR(t,e){var n=t.length-e.length;if(n<0||1<n)throw OR.create("invalid String merger input");for(var r=[],i=0;i<t.length;i++)r.push(t.charAt(i)),e.length>i&&r.push(e.charAt(i));return r.join("")}var xR,LR,MR,FR=(UR.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw OR.create("no app id");return t},UR.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw OR.create("no project id");return t},UR.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw OR.create("no api key");return t},UR.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},UR.getInstance=function(){return void 0===IR&&(IR=new UR),IR},UR);function UR(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.flTransportEndpointUrl=DR("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=DR("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}function jR(){return xR}(MR=LR=LR||{})[MR.UNKNOWN=0]="UNKNOWN",MR[MR.VISIBLE=1]="VISIBLE",MR[MR.HIDDEN=2]="HIDDEN";var VR=["firebase_","google_","ga_"],qR=new RegExp("^[a-zA-Z]\\w*$");function BR(){switch(PR.getInstance().document.visibilityState){case"visible":return LR.VISIBLE;case"hidden":return LR.HIDDEN;default:return LR.UNKNOWN}}var WR=new xa(AR);WR.logLevel=Ca.INFO;var HR="0.0.1",KR={loggingEnabled:!0},GR="FIREBASE_INSTALLATIONS_AUTH";function zR(t){var r,e=function(){var t=PR.getInstance().localStorage;if(!t)return;var e=t.getItem(NR);if(!e||!function(t){return Number(t)>Date.now()}(e))return;var n=t.getItem(CR);if(!n)return;try{return JSON.parse(n)}catch(t){return}}();return e?(XR(e),Promise.resolve()):(r=t,function(){var t=FR.getInstance().installationsService.getToken();return t.then(function(t){}),t}().then(function(t){var e="https://firebaseremoteconfig.googleapis.com/v1/projects/"+FR.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+FR.getInstance().getApiKey(),n=new Request(e,{method:"POST",headers:{Authorization:GR+" "+t},body:JSON.stringify({app_instance_id:r,app_instance_id_token:t,app_id:FR.getInstance().getAppId(),app_version:TR,sdk_version:HR})});return fetch(n).then(function(t){if(t.ok)return t.json();throw OR.create("RC response not ok")})}).catch(function(){WR.info(QR)}).then(XR).then(function(t){return function(t){var e=PR.getInstance().localStorage;if(!t||!e)return;e.setItem(CR,JSON.stringify(t)),e.setItem(NR,String(Date.now()+60*FR.getInstance().configTimeToLive*60*1e3))}(t)},function(){}))}var QR="Could not fetch config, will use default configs";function XR(t){if(!t)return t;var e=FR.getInstance(),n=t.entries||{};return e.loggingEnabled=void 0!==n.fpr_enabled?"true"===String(n.fpr_enabled):KR.loggingEnabled,n.fpr_log_source&&(e.logSource=Number(n.fpr_log_source)),n.fpr_log_endpoint_url&&(e.logEndPointUrl=n.fpr_log_endpoint_url),n.fpr_log_transport_key&&(e.transportKey=n.fpr_log_transport_key),void 0!==n.fpr_vc_network_request_sampling_rate&&(e.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate)),void 0!==n.fpr_vc_trace_sampling_rate&&(e.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate)),e.logTraceAfterSampling=YR(e.tracesSamplingRate),e.logNetworkAfterSampling=YR(e.networkRequestsSamplingRate),t}function YR(t){return Math.random()<=t}var $R,JR=1;function ZR(){return JR=2,$R=$R||function(){var n=PR.getInstance().document;return new Promise(function(t){if(n&&"complete"!==n.readyState){var e=function(){"complete"===n.readyState&&(n.removeEventListener("readystatechange",e),t())};n.addEventListener("readystatechange",e)}else t()})}().then(function(){return(t=FR.getInstance().installationsService.getId()).then(function(t){xR=t}),t;var t}).then(function(t){return zR(t)}).then(function(){return tD()},function(){return tD()})}function tD(){JR=3}var eD,nD=1e4,rD=5500,iD=3,oD=iD,sD=[],aD=!1;function uD(t){setTimeout(function(){if(0!==oD)return sD.length?void function(){var t=ks(sD);sD=[];var e=t.map(function(t){return{source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)}});(function(t,i){return function(t){var e=FR.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then(function(t){return t.ok||WR.info("Call to Firebase backend failed."),t.json()}).then(function(t){var e=Number(t.nextRequestWaitMillis),n=nD;isNaN(e)||(n=Math.max(e,n));var r=t.logResponseDetails;Array.isArray(r)&&0<r.length&&"RETRY_REQUEST_LATER"===r[0].responseAction&&(sD=ks(i,sD),WR.info("Retry transport request later.")),oD=iD,uD(n)})})({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:FR.getInstance().logSource,log_event:e},t).catch(function(){sD=ks(t,sD),oD--,WR.info("Tries left: "+oD+"."),uD(nD)})}():uD(nD)},t)}function cD(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(t){if(!t.eventTime||!t.message)throw OR.create("invalid cc log");sD=ks(sD,[t])}({message:n.apply(void 0,t),eventTime:Date.now()})}}function hD(t,e){(eD=eD||cD(pD))(t,e)}function lD(t){var e=FR.getInstance();!e.instrumentationEnabled&&t.isAuto||(e.dataCollectionEnabled||t.isAuto)&&PR.getInstance().requiredApisAvailable()&&(t.isAuto&&BR()!==LR.VISIBLE||e.loggingEnabled&&e.logTraceAfterSampling&&(3===JR?fD(t):ZR().then(function(){return fD(t)},function(){return fD(t)})))}function fD(t){jR()&&setTimeout(function(){return hD(t,1)},0)}function pD(t,e){return 0===e?(r={url:(n=t).url,http_method:n.httpMethod||0,http_response_code:200,response_payload_bytes:n.responsePayloadBytes,client_start_time_us:n.startTimeUs,time_to_response_initiated_us:n.timeToResponseInitiatedUs,time_to_response_completed_us:n.timeToResponseCompletedUs},i={application_info:dD(),network_request_metric:r},JSON.stringify(i)):function(t){var e={name:t.name,is_auto:t.isAuto,client_start_time_us:t.startTimeUs,duration_us:t.durationUs};0!==Object.keys(t.counters).length&&(e.counters=t.counters);var n=t.getAttributes();0!==Object.keys(n).length&&(e.custom_attributes=n);var r={application_info:dD(),trace_metric:e};return JSON.stringify(r)}(t);var n,r,i}function dD(){return{google_app_id:FR.getInstance().getAppId(),app_instance_id:jR(),web_app_info:{sdk_version:TR,page_url:PR.getInstance().getUrl(),service_worker_status:"serviceWorker"in(t=PR.getInstance().navigator)?t.serviceWorker.controller?2:3:1,visibility_state:BR(),effective_connection_type:function(){var t=PR.getInstance().navigator.connection;switch(t&&t.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}()},application_process_state:0};var t}var vD=["_fp","_fcp","_fid"];var yD=(gD.prototype.start=function(){if(1!==this.state)throw OR.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},gD.prototype.stop=function(){if(2!==this.state)throw OR.create("trace stopped",{traceName:this.name});this.state=3,this.api.mark(this.traceStopMark),this.api.measure(this.traceMeasure,this.traceStartMark,this.traceStopMark),this.calculateTraceMetrics(),lD(this)},gD.prototype.record=function(t,e,n){if(this.durationUs=Math.floor(1e3*e),this.startTimeUs=Math.floor(1e3*t),n&&n.attributes&&(this.customAttributes=Is({},n.attributes)),n&&n.metrics)for(var r=0,i=Object.keys(n.metrics);r<i.length;r++){var o=i[r];isNaN(Number(n.metrics[o]))||(this.counters[o]=Number(Math.floor(n.metrics[o])))}lD(this)},gD.prototype.incrementMetric=function(t,e){void 0===e&&(e=1),void 0===this.counters[t]&&this.putMetric(t,0),this.counters[t]+=e},gD.prototype.putMetric=function(t,e){if(n=t,r=this.name,0===n.length||100<n.length||!(r&&r.startsWith("_wt_")&&-1<vD.indexOf(n))&&n.startsWith("_"))throw OR.create("invalid custom metric name",{customMetricName:t});var n,r;this.counters[t]=e},gD.prototype.getMetric=function(t){return this.counters[t]||0},gD.prototype.putAttribute=function(t,e){var n,r,i=!(0===(n=t).length||40<n.length||VR.some(function(t){return n.startsWith(t)})||!n.match(qR)),o=0!==(r=e).length&&r.length<=100;if(i&&o)this.customAttributes[t]=e;else{if(!i)throw OR.create("invalid attribute name",{attributeName:t});if(!o)throw OR.create("invalid attribute value",{attributeValue:e})}},gD.prototype.getAttribute=function(t){return this.customAttributes[t]},gD.prototype.removeAttribute=function(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]},gD.prototype.getAttributes=function(){return Is({},this.customAttributes)},gD.prototype.setStartTime=function(t){this.startTimeUs=t},gD.prototype.setDuration=function(t){this.durationUs=t},gD.prototype.calculateTraceMetrics=function(){var t=this.api.getEntriesByName(this.traceMeasure),e=t&&t[0];e&&(this.durationUs=Math.floor(1e3*e.duration),this.startTimeUs=Math.floor(1e3*(e.startTime+this.api.getTimeOrigin())))},gD.createOobTrace=function(t,e,n){var r=PR.getInstance().getUrl();if(r){var i=new gD("_wt_"+r,!0),o=Math.floor(1e3*PR.getInstance().getTimeOrigin());if(i.setStartTime(o),t&&t[0]&&(i.setDuration(Math.floor(1e3*t[0].duration)),i.putMetric("domInteractive",Math.floor(1e3*t[0].domInteractive)),i.putMetric("domContentLoadedEventEnd",Math.floor(1e3*t[0].domContentLoadedEventEnd)),i.putMetric("loadEventEnd",Math.floor(1e3*t[0].loadEventEnd))),e){var s=e.find(function(t){return"first-paint"===t.name});s&&s.startTime&&i.putMetric("_fp",Math.floor(1e3*s.startTime));var a=e.find(function(t){return"first-contentful-paint"===t.name});a&&a.startTime&&i.putMetric("_fcp",Math.floor(1e3*a.startTime)),n&&i.putMetric("_fid",Math.floor(1e3*n))}lD(i)}},gD.createUserTimingTrace=function(t){lD(new gD(t,!1,t))},gD);function gD(t,e,n){void 0===e&&(e=!1),this.name=t,this.isAuto=e,this.state=1,this.customAttributes={},this.counters={},this.api=PR.getInstance(),this.randomId=Math.floor(1e6*Math.random()),this.isAuto||(this.traceStartMark="FB-PERF-TRACE-START-"+this.randomId+"-"+this.name,this.traceStopMark="FB-PERF-TRACE-STOP-"+this.randomId+"-"+this.name,this.traceMeasure=n||SR+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function mD(t){var e=t;if(e&&void 0!==e.responseStart){var n=PR.getInstance().getTimeOrigin(),r=Math.floor(1e3*(e.startTime+n)),i=e.responseStart?Math.floor(1e3*(e.responseStart-e.startTime)):void 0,o=Math.floor(1e3*(e.responseEnd-e.startTime));!function(t){var e=FR.getInstance();if(e.instrumentationEnabled){var n=t.url,r=e.logEndPointUrl.split("?")[0],i=e.flTransportEndpointUrl.split("?")[0];n!==r&&n!==i&&e.loggingEnabled&&e.logNetworkAfterSampling&&setTimeout(function(){return hD(t,0)},0)}}({url:e.name&&e.name.split("?")[0],responsePayloadBytes:e.transferSize,startTimeUs:r,timeToResponseInitiatedUs:i,timeToResponseCompletedUs:o})}}var bD=5e3;function wD(){jR()&&(setTimeout(function(){return function(){var t=PR.getInstance(),e=t.getEntriesByType("navigation"),n=t.getEntriesByType("paint");if(t.onFirstInputDelay){var r=setTimeout(function(){yD.createOobTrace(e,n),r=void 0},bD);t.onFirstInputDelay(function(t){r&&(clearTimeout(r),yD.createOobTrace(e,n,t))})}else yD.createOobTrace(e,n)}()},0),setTimeout(function(){return function(){for(var t=PR.getInstance(),e=t.getEntriesByType("resource"),n=0,r=e;n<r.length;n++){mD(r[n])}t.setupObserver("resource",mD)}()},0),setTimeout(function(){return function(){for(var t=PR.getInstance(),e=t.getEntriesByType("measure"),n=0,r=e;n<r.length;n++){_D(r[n])}t.setupObserver("measure",_D)}()},0))}function _D(t){var e=t.name;e.substring(0,SR.length)!==SR&&yD.createUserTimingTrace(e)}var ED=(ID.prototype.trace=function(t){return new yD(t)},Object.defineProperty(ID.prototype,"instrumentationEnabled",{get:function(){return FR.getInstance().instrumentationEnabled},set:function(t){FR.getInstance().instrumentationEnabled=t},enumerable:!1,configurable:!0}),Object.defineProperty(ID.prototype,"dataCollectionEnabled",{get:function(){return FR.getInstance().dataCollectionEnabled},set:function(t){FR.getInstance().dataCollectionEnabled=t},enumerable:!1,configurable:!0}),ID);function ID(t){this.app=t,PR.getInstance().requiredApisAvailable()?(aD||(uD(rD),aD=!0),ZR().then(wD,wD)):WR.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled.")}var TD;function SD(t,e){if("[DEFAULT]"!==t.name)throw OR.create("FB not default");if("undefined"==typeof window)throw OR.create("no window");return ER=window,FR.getInstance().firebaseAppInstance=t,FR.getInstance().installationsService=e,new ED(t)}(TD=zl).INTERNAL.registerComponent(new ga("performance",function(t){var e=t.getProvider("app").getImmediate(),n=t.getProvider("installations").getImmediate();return SD(e,n)},"PUBLIC")),TD.registerVersion("@firebase/performance","0.3.10");var CD,ND,AD,kD,OD="measurementId",PD="firebase_id",RD="origin",DD="https://www.googletagmanager.com/gtag/js";(ND=CD=CD||{}).EVENT="event",ND.SET="set",ND.CONFIG="config",(kD=AD=AD||{}).ADD_SHIPPING_INFO="add_shipping_info",kD.ADD_PAYMENT_INFO="add_payment_info",kD.ADD_TO_CART="add_to_cart",kD.ADD_TO_WISHLIST="add_to_wishlist",kD.BEGIN_CHECKOUT="begin_checkout",kD.CHECKOUT_PROGRESS="checkout_progress",kD.EXCEPTION="exception",kD.GENERATE_LEAD="generate_lead",kD.LOGIN="login",kD.PAGE_VIEW="page_view",kD.PURCHASE="purchase",kD.REFUND="refund",kD.REMOVE_FROM_CART="remove_from_cart",kD.SCREEN_VIEW="screen_view",kD.SEARCH="search",kD.SELECT_CONTENT="select_content",kD.SELECT_ITEM="select_item",kD.SELECT_PROMOTION="select_promotion",kD.SET_CHECKOUT_OPTION="set_checkout_option",kD.SHARE="share",kD.SIGN_UP="sign_up",kD.TIMING_COMPLETE="timing_complete",kD.VIEW_CART="view_cart",kD.VIEW_ITEM="view_item",kD.VIEW_ITEM_LIST="view_item_list",kD.VIEW_PROMOTION="view_promotion",kD.VIEW_SEARCH_RESULTS="view_search_results";var xD,LD=new xa("@firebase/analytics");function MD(t,n,e){var f,p,r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];window[n].push(arguments)};return window[e]&&"function"==typeof window[e]&&(r=window[e]),window[e]=(f=r,p=t,function(t,e,n){if(t===CD.EVENT){var r=[];if(n&&n.send_to){var i=n.send_to;Array.isArray(i)||(i=[i]);for(var o=0,s=i;o<s.length;o++){var a=s[o],u=p[a];if(!u){r=[];break}r.push(u)}}if(0===r.length)for(var c=0,h=Object.values(p);c<h.length;c++){var l=h[c];r.push(l)}Promise.all(r).then(function(){return f(CD.EVENT,e,n||{})}).catch(function(t){return LD.error(t)})}else t===CD.CONFIG?(p[e]||Promise.resolve()).then(function(){f(CD.CONFIG,e,n)}).catch(function(t){return LD.error(t)}):f(CD.SET,e)}),{gtagCore:r,wrappedGtag:window[e]}}var FD,UD,jD=((xD={})["no-ga-id"]='"'+OD+'" field is empty in Firebase config. Firebase Analytics requires this field to contain a valid measurement ID.',xD["already-exists"]="A Firebase Analytics instance with the measurement ID ${id}  already exists. Only one Firebase Analytics instance can be created for each measurement ID.",xD["already-initialized"]="Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.",xD["interop-component-reg-failed"]="Firebase Analytics Interop Component failed to instantiate",xD["indexedDB-unsupported"]="IndexedDB is not supported by current browswer",xD["invalid-indexedDB-context"]="Environment doesn't support IndexedDB: {$errorInfo}. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments",xD["cookies-not-enabled"]="Cookies are not enabled in this browser environment. Analytics requires cookies to be enabled.",xD),VD=new Ys("analytics","Analytics",jD),qD={},BD="dataLayer",WD="gtag",HD=!1;function KD(t){if(HD)throw VD.create("already-initialized");t.dataLayerName&&(BD=t.dataLayerName),t.gtagName&&(WD=t.gtagName)}function GD(t,e){if(!Gs())throw VD.create("cookies-not-enabled");if(!Hs())throw VD.create("indexedDB-unsupported");Ks().catch(function(t){throw VD.create("invalid-indexedDB-context",{errorInfo:t})});var n,r,i,o,c=t.options[OD];if(!c)throw VD.create("no-ga-id");if(null!=qD[c])throw VD.create("already-exists",{id:c});if(!HD){!function(){for(var t=window.document.getElementsByTagName("script"),e=0,n=Object.values(t);e<n.length;e++){var r=n[e];if(r.src&&r.src.includes(DD))return r}}()&&(i=BD,(o=document.createElement("script")).src=DD+"?l="+i,o.async=!0,document.head.appendChild(o)),n=BD,r=[],Array.isArray(window[n])?r=window[n]:window[n]=r;var s=MD(qD,BD,WD),a=s.wrappedGtag,u=s.gtagCore;UD=a,FD=u,HD=!0}return qD[c]=function(r,i,o){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,i.getId()];case 1:return e=t.sent(),o("js",new Date),o(CD.CONFIG,r.options[OD],((n={})[PD]=e,n[RD]="firebase",n.update=!0,n)),[2]}})})}(t,e,FD),{app:t,logEvent:function(t,e,n){return r=UD,i=c,o=t,u=(s=e)||{},(a=n)&&a.global||(u=Is(Is({},s),{send_to:i})),void r(CD.EVENT,o,u||{});var r,i,o,s,a,u},setCurrentScreen:function(t,e){return n=UD,r=c,i=t,void((o=e)&&o.global?n(CD.SET,{screen_name:i}):n(CD.CONFIG,r,{update:!0,screen_name:i}));var n,r,i,o},setUserId:function(t,e){return n=UD,r=c,i=t,void((o=e)&&o.global?n(CD.SET,{user_id:i}):n(CD.CONFIG,r,{update:!0,user_id:i}));var n,r,i,o},setUserProperties:function(t,e){return function(t,e,n,r){if(r&&r.global){for(var i={},o=0,s=Object.keys(n);o<s.length;o++){var a=s[o];i["user_properties."+a]=n[a]}t(CD.SET,i)}else t(CD.CONFIG,e,{update:!0,user_properties:n})}(UD,c,t,e)},setAnalyticsCollectionEnabled:function(t){return e=t,void(window["ga-disable-"+c]=!e);var e}}}var zD,QD="analytics";function XD(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:if(!Gs())return[2,!1];if(!Hs())return[2,!1];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Ks()];case 2:return[2,t.sent()];case 3:return t.sent(),[2,!1];case 4:return[2]}})})}(zD=zl).INTERNAL.registerComponent(new ga(QD,function(t){return GD(t.getProvider("app").getImmediate(),t.getProvider("installations").getImmediate())},"PUBLIC").setServiceProps({settings:KD,EventName:AD,isSupported:XD})),zD.INTERNAL.registerComponent(new ga("analytics-internal",function(t){try{return{logEvent:t.getProvider(QD).getImmediate().logEvent}}catch(t){throw VD.create("interop-component-reg-failed",{reason:t})}},"PRIVATE")),zD.registerVersion("@firebase/analytics","0.4.1");var YD,$D=(JD.prototype.isCachedDataFresh=function(t,e){if(!e)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;var n=Date.now()-e,r=n<=t;return this.logger.debug("Config fetch cache check. Cache age millis: "+n+". Cache max age millis (minimumFetchIntervalMillis setting): "+t+". Is cache hit: "+r+"."),r},JD.prototype.fetch=function(s){return Ts(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()])];case 1:return e=t.sent(),n=e[0],(r=e[1])&&this.isCachedDataFresh(s.cacheMaxAgeMillis,n)?[2,r]:(s.eTag=r&&r.eTag,[4,this.client.fetch(s)]);case 2:return i=t.sent(),o=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())],200===i.status&&o.push(this.storage.setLastSuccessfulFetchResponse(i)),[4,Promise.all(o)];case 3:return t.sent(),[2,i]}})})},JD);function JD(t,e,n,r){this.client=t,this.storage=e,this.storageCache=n,this.logger=r}var ZD=((YD={})["registration-window"]="Undefined window object. This SDK only supports usage in a browser environment.",YD["registration-project-id"]="Undefined project identifier. Check Firebase app initialization.",YD["registration-api-key"]="Undefined API key. Check Firebase app initialization.",YD["registration-app-id"]="Undefined app identifier. Check Firebase app initialization.",YD["storage-open"]="Error thrown when opening storage. Original error: {$originalErrorMessage}.",YD["storage-get"]="Error thrown when reading from storage. Original error: {$originalErrorMessage}.",YD["storage-set"]="Error thrown when writing to storage. Original error: {$originalErrorMessage}.",YD["storage-delete"]="Error thrown when deleting from storage. Original error: {$originalErrorMessage}.",YD["fetch-client-network"]="Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.",YD["fetch-timeout"]='The config fetch request timed out.  Configure timeout using "fetchTimeoutMillis" SDK setting.',YD["fetch-throttle"]='The config fetch request timed out while in an exponential backoff state. Configure timeout using "fetchTimeoutMillis" SDK setting. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',YD["fetch-client-parse"]="Fetch client could not parse response. Original error: {$originalErrorMessage}.",YD["fetch-status"]="Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.",YD),tx=new Ys("remoteconfig","Remote Config",ZD);var ex=(nx.prototype.fetch=function(_){return Ts(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,h,l,f,p,d,v,y,g,m,b,w;return Ss(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()])];case 1:n=t.sent(),r=n[0],i=n[1],o=window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com",s=o+"/v1/projects/"+this.projectId+"/namespaces/"+this.namespace+":fetch?key="+this.apiKey,a={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":_.eTag||"*"},u={sdk_version:this.sdkVersion,app_instance_id:r,app_instance_id_token:i,app_id:this.appId,language_code:(void 0===e&&(e=navigator),e.languages&&e.languages[0]||e.language)},c={method:"POST",headers:a,body:JSON.stringify(u)},h=fetch(s,c),l=new Promise(function(t,e){_.signal.addEventListener(function(){var t=new Error("The operation was aborted.");t.name="AbortError",e(t)})}),t.label=2;case 2:return t.trys.push([2,5,,6]),[4,Promise.race([h,l])];case 3:return t.sent(),[4,h];case 4:return f=t.sent(),[3,6];case 5:throw p=t.sent(),d="fetch-client-network","AbortError"===p.name&&(d="fetch-timeout"),tx.create(d,{originalErrorMessage:p.message});case 6:if(v=f.status,y=f.headers.get("ETag")||void 0,200!==f.status)return[3,11];b=void 0,t.label=7;case 7:return t.trys.push([7,9,,10]),[4,f.json()];case 8:return b=t.sent(),[3,10];case 9:throw w=t.sent(),tx.create("fetch-client-parse",{originalErrorMessage:w.message});case 10:g=b.entries,m=b.state,t.label=11;case 11:if("INSTANCE_STATE_UNSPECIFIED"===m?v=500:"NO_CHANGE"===m?v=304:"NO_TEMPLATE"!==m&&"EMPTY_CONFIG"!==m||(g={}),304!==v&&200!==v)throw tx.create("fetch-status",{httpStatus:v});return[2,{status:v,eTag:y,config:g}]}var e})})},nx);function nx(t,e,n,r,i,o){this.firebaseInstallations=t,this.sdkVersion=e,this.namespace=n,this.projectId=r,this.apiKey=i,this.appId=o}var rx=(ix.prototype.addEventListener=function(t){this.listeners.push(t)},ix.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},ix);function ix(){this.listeners=[]}var ox=["1","true","t","yes","y","on"],sx=(ax.prototype.asString=function(){return this._value},ax.prototype.asBoolean=function(){return"static"!==this._source&&0<=ox.indexOf(this._value.toLowerCase())},ax.prototype.asNumber=function(){if("static"===this._source)return 0;var t=Number(this._value);return isNaN(t)&&(t=0),t},ax.prototype.getSource=function(){return this._source},ax);function ax(t,e){void 0===e&&(e=""),this._source=t,this._value=e}var ux=(cx.prototype.setLogLevel=function(t){switch(t){case"debug":this._logger.logLevel=Ca.DEBUG;break;case"silent":this._logger.logLevel=Ca.SILENT;break;default:this._logger.logLevel=Ca.ERROR}},Object.defineProperty(cx.prototype,"fetchTimeMillis",{get:function(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1},enumerable:!1,configurable:!0}),Object.defineProperty(cx.prototype,"lastFetchStatus",{get:function(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"},enumerable:!1,configurable:!0}),cx.prototype.activate=function(){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return[4,Promise.all([this._storage.getLastSuccessfulFetchResponse(),this._storage.getActiveConfigEtag()])];case 1:return e=t.sent(),n=e[0],r=e[1],n&&n.config&&n.eTag&&n.eTag!==r?[4,Promise.all([this._storageCache.setActiveConfig(n.config),this._storage.setActiveConfigEtag(n.eTag)])]:[2,!1];case 2:return t.sent(),[2,!0]}})})},cx.prototype.ensureInitialized=function(){var t=this;return this._initializePromise||(this._initializePromise=this._storageCache.loadFromStorage().then(function(){t._isInitializationComplete=!0})),this._initializePromise},cx.prototype.fetch=function(){return Ts(this,void 0,void 0,function(){var r,i,o,s=this;return Ss(this,function(t){switch(t.label){case 0:r=new rx,setTimeout(function(){return Ts(s,void 0,void 0,function(){return Ss(this,function(t){return r.abort(),[2]})})},this.settings.fetchTimeoutMillis),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this._client.fetch({cacheMaxAgeMillis:this.settings.minimumFetchIntervalMillis,signal:r})];case 2:return t.sent(),[4,this._storageCache.setLastFetchStatus("success")];case 3:return t.sent(),[3,6];case 4:return i=t.sent(),n="fetch-throttle",o=(e=i)instanceof Qs&&-1!==e.code.indexOf(n)?"throttle":"failure",[4,this._storageCache.setLastFetchStatus(o)];case 5:throw t.sent(),i;case 6:return[2]}var e,n})})},cx.prototype.fetchAndActivate=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.fetch()];case 1:return t.sent(),[2,this.activate()]}})})},cx.prototype.getAll=function(){var n=this;return function(t,e){return void 0===t&&(t={}),void 0===e&&(e={}),Object.keys(Is(Is({},t),e))}(this._storageCache.getActiveConfig(),this.defaultConfig).reduce(function(t,e){return t[e]=n.getValue(e),t},{})},cx.prototype.getBoolean=function(t){return this.getValue(t).asBoolean()},cx.prototype.getNumber=function(t){return this.getValue(t).asNumber()},cx.prototype.getString=function(t){return this.getValue(t).asString()},cx.prototype.getValue=function(t){this._isInitializationComplete||this._logger.debug('A value was requested for key "'+t+'" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.');var e=this._storageCache.getActiveConfig();return e&&void 0!==e[t]?new sx("remote",e[t]):this.defaultConfig&&void 0!==this.defaultConfig[t]?new sx("default",String(this.defaultConfig[t])):(this._logger.debug('Returning static value for key "'+t+'". Define a default or remote value if this is unintentional.'),new sx("static"))},cx);function cx(t,e,n,r,i){this.app=t,this._client=e,this._storageCache=n,this._storage=r,this._logger=i,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:6e4,minimumFetchIntervalMillis:432e5},this.defaultConfig={}}function hx(t,e){var n=t.target.error||void 0;return tx.create(e,{originalErrorMessage:n&&n.message})}var lx="app_namespace_store",fx="firebase_remote_config",px=1;var dx=(vx.prototype.getLastFetchStatus=function(){return this.get("last_fetch_status")},vx.prototype.setLastFetchStatus=function(t){return this.set("last_fetch_status",t)},vx.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.get("last_successful_fetch_timestamp_millis")},vx.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.set("last_successful_fetch_timestamp_millis",t)},vx.prototype.getLastSuccessfulFetchResponse=function(){return this.get("last_successful_fetch_response")},vx.prototype.setLastSuccessfulFetchResponse=function(t){return this.set("last_successful_fetch_response",t)},vx.prototype.getActiveConfig=function(){return this.get("active_config")},vx.prototype.setActiveConfig=function(t){return this.set("active_config",t)},vx.prototype.getActiveConfigEtag=function(){return this.get("active_config_etag")},vx.prototype.setActiveConfigEtag=function(t){return this.set("active_config_etag",t)},vx.prototype.getThrottleMetadata=function(){return this.get("throttle_metadata")},vx.prototype.setThrottleMetadata=function(t){return this.set("throttle_metadata",t)},vx.prototype.deleteThrottleMetadata=function(){return this.delete("throttle_metadata")},vx.prototype.get=function(a){return Ts(this,void 0,void 0,function(){var o,s=this;return Ss(this,function(t){switch(t.label){case 0:return[4,this.openDbPromise];case 1:return o=t.sent(),[2,new Promise(function(n,e){var t=o.transaction([lx],"readonly").objectStore(lx),r=s.createCompositeKey(a);try{var i=t.get(r);i.onerror=function(t){e(hx(t,"storage-get"))},i.onsuccess=function(t){var e=t.target.result;n(e?e.value:void 0)}}catch(t){e(tx.create("storage-get",{originalErrorMessage:t&&t.message}))}})]}})})},vx.prototype.set=function(a,u){return Ts(this,void 0,void 0,function(){var o,s=this;return Ss(this,function(t){switch(t.label){case 0:return[4,this.openDbPromise];case 1:return o=t.sent(),[2,new Promise(function(t,e){var n=o.transaction([lx],"readwrite").objectStore(lx),r=s.createCompositeKey(a);try{var i=n.put({compositeKey:r,value:u});i.onerror=function(t){e(hx(t,"storage-set"))},i.onsuccess=function(){t()}}catch(t){e(tx.create("storage-set",{originalErrorMessage:t&&t.message}))}})]}})})},vx.prototype.delete=function(a){return Ts(this,void 0,void 0,function(){var o,s=this;return Ss(this,function(t){switch(t.label){case 0:return[4,this.openDbPromise];case 1:return o=t.sent(),[2,new Promise(function(t,e){var n=o.transaction([lx],"readwrite").objectStore(lx),r=s.createCompositeKey(a);try{var i=n.delete(r);i.onerror=function(t){e(hx(t,"storage-delete"))},i.onsuccess=function(){t()}}catch(t){e(tx.create("storage-delete",{originalErrorMessage:t&&t.message}))}})]}})})},vx.prototype.createCompositeKey=function(t){return[this.appId,this.appName,this.namespace,t].join()},vx);function vx(t,e,n,r){void 0===r&&(r=new Promise(function(e,n){var t=indexedDB.open(fx,px);t.onerror=function(t){n(hx(t,"storage-open"))},t.onsuccess=function(t){e(t.target.result)},t.onupgradeneeded=function(t){var e=t.target.result;switch(t.oldVersion){case 0:e.createObjectStore(lx,{keyPath:"compositeKey"})}}})),this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=r}var yx=(gx.prototype.getLastFetchStatus=function(){return this.lastFetchStatus},gx.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.lastSuccessfulFetchTimestampMillis},gx.prototype.getActiveConfig=function(){return this.activeConfig},gx.prototype.loadFromStorage=function(){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return e=this.storage.getLastFetchStatus(),n=this.storage.getLastSuccessfulFetchTimestampMillis(),r=this.storage.getActiveConfig(),[4,e];case 1:return(i=t.sent())&&(this.lastFetchStatus=i),[4,n];case 2:return(o=t.sent())&&(this.lastSuccessfulFetchTimestampMillis=o),[4,r];case 3:return(s=t.sent())&&(this.activeConfig=s),[2]}})})},gx.prototype.setLastFetchStatus=function(t){return this.lastFetchStatus=t,this.storage.setLastFetchStatus(t)},gx.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.lastSuccessfulFetchTimestampMillis=t,this.storage.setLastSuccessfulFetchTimestampMillis(t)},gx.prototype.setActiveConfig=function(t){return this.activeConfig=t,this.storage.setActiveConfig(t)},gx);function gx(t){this.storage=t}var mx=(bx.prototype.fetch=function(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,this.storage.getThrottleMetadata()];case 1:return e=t.sent()||{backoffCount:0,throttleEndTimeMillis:Date.now()},[2,this.attemptFetch(n,e)]}})})},bx.prototype.attemptFetch=function(c,t){var h=t.throttleEndTimeMillis,l=t.backoffCount;return Ts(this,void 0,void 0,function(){var s,a,u;return Ss(this,function(t){switch(t.label){case 0:return[4,(i=c.signal,o=h,new Promise(function(t,e){var n=Math.max(o-Date.now(),0),r=setTimeout(t,n);i.addEventListener(function(){clearTimeout(r),e(tx.create("fetch-throttle",{throttleEndTimeMillis:o}))})}))];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,5,,7]),[4,this.client.fetch(c)];case 3:return s=t.sent(),[4,this.storage.deleteThrottleMetadata()];case 4:return t.sent(),[2,s];case 5:if(!function(t){if(t instanceof Qs){var e=Number(t.httpStatus);return 429===e||500===e||503===e||504===e}}(a=t.sent()))throw a;return u={throttleEndTimeMillis:Date.now()+(e=l,n=1e3*Math.pow(2,e),r=Math.round(.5*n*(Math.random()-.5)*2),Math.min(144e5,n+r)),backoffCount:l+1},[4,this.storage.setThrottleMetadata(u)];case 6:return t.sent(),[2,this.attemptFetch(c,u)];case 7:return[2]}var e,n,r,i,o})})},bx);function bx(t,e){this.client=t,this.storage=e}var wx,_x="@firebase/remote-config";return(wx=zl).INTERNAL.registerComponent(new ga("remoteConfig",function(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("installations").getImmediate();if("undefined"==typeof window)throw tx.create("registration-window");var i=n.options,o=i.projectId,s=i.apiKey,a=i.appId;if(!o)throw tx.create("registration-project-id");if(!s)throw tx.create("registration-api-key");if(!a)throw tx.create("registration-app-id");e=e||"firebase";var u=new dx(a,n.name,e),c=new yx(u),h=new xa(_x);h.logLevel=Ca.ERROR;var l=new ex(r,wx.SDK_VERSION,e,o,s,a),f=new mx(l,u),p=new $D(f,u,c,h),d=new ux(n,p,c,u,h);return d.ensureInitialized(),d},"PUBLIC").setMultipleInstances(!0)),wx.registerVersion(_x,"0.1.26"),console.warn("\nIt looks like you're using the development build of the Firebase JS SDK.\nWhen deploying Firebase apps to production, it is advisable to only import\nthe individual SDK components you intend to use.\n\nFor the CDN builds, these are available in the following manner\n(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):\n\nhttps://www.gstatic.com/firebasejs/5.0.0/firebase-<PACKAGE>.js\n"),zl.registerVersion("firebase","7.17.1","cdn"),zl});
  //# sourceMappingURL=firebase.js.map
  