ok
Direktori : /home2/selectio/www/billingsoftwarenew/assets/global/js/firebase/ |
Current File : /home2/selectio/www/billingsoftwarenew/assets/global/js/firebase/firebase-8.3.2.js |
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).firebase=e()}(this,function(){"use strict";!function(t){var e,n,s,r,i,o,a,u,c,h;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 t="string"!=typeof 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 g(n){return new Promise(function(t,e){n.onload=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function y(t){var e=new FileReader,n=g(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(y)}),this.text=function(){var t,e,n=v(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=g(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=(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,r||null==t._bodyInit||(r=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",t=n.toUpperCase(),-1<c.indexOf(t)?t:n),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function _(t){var n=new FormData;return t.trim().split("&").forEach(function(t){var e;t&&(t=(e=t.split("=")).shift().replace(/\+/g," "),e=e.join("=").replace(/\+/g," "),n.append(decodeURIComponent(t),decodeURIComponent(e)))}),n}function I(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)}t.fetch||(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)&&(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),c=["DELETE","GET","HEAD","OPTIONS","POST","PUT"],w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},b.call(w.prototype),b.call(I.prototype),I.prototype.clone=function(){return new I(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},I.error=function(){var t=new I(null,{status:0,statusText:""});return t.type="error",t},h=[301,302,303,307,308],I.redirect=function(t,e){if(-1===h.indexOf(e))throw new RangeError("Invalid status code");return new I(null,{status:e,headers:{location:t}})},t.Headers=d,t.Request=w,t.Response=I,t.fetch=function(n,o){return new Promise(function(r,t){var e=new w(n,o),i=new XMLHttpRequest;i.onload=function(){var n,t={status:i.status,statusText:i.statusText,headers:(e=i.getAllResponseHeaders()||"",n=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var e=t.split(":"),t=e.shift().trim();t&&(e=e.join(":").trim(),n.append(t,e))}),n)};t.url="responseURL"in i?i.responseURL:t.headers.get("X-Request-URL");var e="response"in i?i.response:i.responseText;r(new I(e,t))},i.onerror=function(){t(new TypeError("Network request failed"))},i.ontimeout=function(){t(new TypeError("Network request failed"))},i.open(e.method,e.url,!0),"include"===e.credentials?i.withCredentials=!0:"omit"===e.credentials&&(i.withCredentials=!1),"responseType"in i&&s&&(i.responseType="blob"),e.headers.forEach(function(t,e){i.setRequestHeader(e,t)}),i.send(void 0===e._bodyInit?null:e._bodyInit)})},t.fetch.polyfill=!0)}("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){var e={exports:{}};return t(e,e.exports),e.exports}function g(t){try{return!!t()}catch(t){return!0}}function v(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}function r(t){return d.call(t).slice(8,-1)}function s(t){if(null==t)throw TypeError("Can't call method on "+t);return t}function u(t){return _(s(t))}function y(t){return"object"==typeof t?null!==t:"function"==typeof t}function i(t,e){if(!y(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!y(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!y(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!y(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}function c(t,e){return I.call(t,e)}function n(t){return E?T.createElement(t):{}}function m(t){if(!y(t))throw TypeError(String(t)+" is not an object");return t}function h(e,n){try{R(b,e,n)}catch(t){b[e]=n}return n}var o=function(t){return t&&t.Math==Math&&t},b=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof t&&t)||function(){return this}()||Function("return this")(),f=!g(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),a={}.propertyIsEnumerable,l=Object.getOwnPropertyDescriptor,p={f:l&&!a.call({1:2},1)?function(t){t=l(this,t);return!!t&&t.enumerable}:a},d={}.toString,w="".split,_=g(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==r(t)?w.call(t,""):Object(t)}:Object,I={}.hasOwnProperty,T=b.document,E=y(T)&&y(T.createElement),S=!f&&!g(function(){return 7!=Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}),C=Object.getOwnPropertyDescriptor,N={f:f?C:function(t,e){if(t=u(t),e=i(e,!0),S)try{return C(t,e)}catch(t){}if(c(t,e))return v(!p.f.call(t,e),t[e])}},A=Object.defineProperty,k={f:f?A:function(t,e,n){if(m(t),e=i(e,!0),m(n),S)try{return A(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}},R=f?function(t,e,n){return k.f(t,e,v(1,n))}:function(t,e,n){return t[e]=n,t},P="__core-js_shared__",O=b[P]||h(P,{}),D=Function.toString;"function"!=typeof O.inspectSource&&(O.inspectSource=function(t){return D.call(t)});function x(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++Q+Y).toString(36)}var L,M,F,U,j,q,V,B,K=O.inspectSource,W=b.WeakMap,H="function"==typeof W&&/native code/.test(K(W)),G=!1,z=e(function(t){(t.exports=function(t,e){return O[t]||(O[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.8.1",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})}),Q=0,Y=Math.random(),X=z("keys"),J=function(t){return X[t]||(X[t]=x(t))},$={},Z=b.WeakMap;V=H?(L=O.state||(O.state=new Z),M=L.get,F=L.has,U=L.set,j=function(t,e){return e.facade=t,U.call(L,t,e),e},q=function(t){return M.call(L,t)||{}},function(t){return F.call(L,t)}):(B=J("state"),$[B]=!0,j=function(t,e){return e.facade=t,R(t,B,e),e},q=function(t){return c(t,B)?t[B]:{}},function(t){return c(t,B)});function tt(t){return"function"==typeof t?t:void 0}function et(t,e){return arguments.length<2?tt(pt[t])||tt(b[t]):pt[t]&&pt[t][e]||b[t]&&b[t][e]}function nt(t){return isNaN(t=+t)?0:(0<t?vt:dt)(t)}function rt(t){return 0<t?gt(nt(t),9007199254740991):0}function it(t,e){var n,r=u(t),i=0,o=[];for(n in r)!c($,n)&&c(r,n)&&o.push(n);for(;e.length>i;)c(r,n=e[i++])&&(~wt(o,n)||o.push(n));return o}function ot(t,e){for(var n=St(e),r=k.f,i=N.f,o=0;o<n.length;o++){var s=n[o];c(t,s)||r(t,s,i(e,s))}}function st(t,e){var n,r,i,o=t.target,s=t.global,a=t.stat,u=s?b:a?b[o]||h(o,{}):(b[o]||{}).prototype;if(u)for(n in e){if(r=e[n],i=t.noTargetGet?(i=Ot(u,n))&&i.value:u[n],!Pt(s?n:o+(a?".":"#")+n,t.forced)&&void 0!==i){if(typeof r==typeof i)continue;ot(r,i)}(t.sham||i&&i.sham)&&R(r,"sham",!0),ft(u,n,r,t)}}function at(t){return Object(s(t))}function ut(){}function ct(t){return"<script>"+t+"</"+Vt+">"}var ht,lt={set:j,get:q,has:V,enforce:function(t){return V(t)?q(t):j(t,{})},getterFor:function(n){return function(t){var e;if(!y(t)||(e=q(t)).type!==n)throw TypeError("Incompatible receiver, "+n+" required");return e}}},ft=e(function(t){var e=lt.get,a=lt.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")||R(n,"name",e),(r=a(n)).source||(r.source=u.join("string"==typeof e?e:""))),t!==b?(i?!s&&t[e]&&(o=!0):delete t[e],o?t[e]=n:R(t,e,n)):o?t[e]=n:h(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||K(this)})}),pt=b,dt=Math.ceil,vt=Math.floor,gt=Math.min,yt=Math.max,mt=Math.min,bt=function(a){return function(t,e,n){var r,i=u(t),o=rt(i.length),s=function(t,e){t=nt(t);return t<0?yt(t+e,0):mt(t,e)}(n,o);if(a&&e!=e){for(;s<o;)if((r=i[s++])!=r)return!0}else for(;s<o;s++)if((a||s in i)&&i[s]===e)return a||s||0;return!a&&-1}},wt={includes:bt(!0),indexOf:bt(!1)}.indexOf,_t=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],It=_t.concat("length","prototype"),Tt={f:Object.getOwnPropertyNames||function(t){return it(t,It)}},Et={f:Object.getOwnPropertySymbols},St=et("Reflect","ownKeys")||function(t){var e=Tt.f(m(t)),n=Et.f;return n?e.concat(n(t)):e},Ct=/#|\.prototype\./,o=function(t,e){t=At[Nt(t)];return t==Rt||t!=kt&&("function"==typeof e?g(e):!!e)},Nt=o.normalize=function(t){return String(t).replace(Ct,".").toLowerCase()},At=o.data={},kt=o.NATIVE="N",Rt=o.POLYFILL="P",Pt=o,Ot=N.f,t=!g(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Dt=J("IE_PROTO"),xt=Object.prototype,Lt=t?Object.getPrototypeOf:function(t){return t=at(t),c(t,Dt)?t[Dt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?xt:null},Mt=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 m(t),function(t){if(!y(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),Ft=Object.keys||function(t){return it(t,_t)},Ut=f?Object.defineProperties:function(t,e){m(t);for(var n,r=Ft(e),i=r.length,o=0;o<i;)k.f(t,n=r[o++],e[n]);return t},jt=et("document","documentElement"),qt="prototype",Vt="script",Bt=J("IE_PROTO"),Kt=function(){try{ht=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t;Kt=ht?function(t){t.write(ct("")),t.close();var e=t.parentWindow.Object;return t=null,e}(ht):((t=n("iframe")).style.display="none",jt.appendChild(t),t.src=String("javascript:"),(t=t.contentWindow.document).open(),t.write(ct("document.F=Object")),t.close(),t.F);for(var e=_t.length;e--;)delete Kt[qt][_t[e]];return Kt()};$[Bt]=!0;function Wt(t){return c(Xt,t)||(Yt&&c(Jt,t)?Xt[t]=Jt[t]:Xt[t]=$t("Symbol."+t)),Xt[t]}function Ht(t){return void 0!==t&&(Zt.Array===t||ee[te]===t)}function Gt(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}function zt(r,i,t){if(Gt(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)}}var Qt=Object.create||function(t,e){var n;return null!==t?(ut[qt]=m(t),n=new ut,ut[qt]=null,n[Bt]=t):n=Kt(),void 0===e?n:Ut(n,e)},Yt=!!Object.getOwnPropertySymbols&&!g(function(){return!String(Symbol())}),a=Yt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Xt=z("wks"),Jt=b.Symbol,$t=a?Jt:Jt&&Jt.withoutSetter||x,Zt={},te=Wt("iterator"),ee=Array.prototype,P={};P[Wt("toStringTag")]="z";function ne(t){if(null!=t)return t[ce]||t["@@iterator"]||Zt[ue(t)]}function re(t){var e=t.return;return void 0!==e&&m(e.call(t)).value}function ie(t,e){this.stopped=t,this.result=e}function oe(t,e,n){function r(t){return o&&re(o),new ie(!0,t)}function i(t){return f?(m(t),d?v(t[0],t[1],r):v(t[0],t[1])):d?v(t,r):v(t)}var o,s,a,u,c,h,l=n&&n.that,f=!(!n||!n.AS_ENTRIES),p=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),v=zt(e,l,1+f+d);if(p)o=t;else{if("function"!=typeof(p=ne(t)))throw TypeError("Target is not iterable");if(Ht(p)){for(s=0,a=rt(t.length);s<a;s++)if((u=i(t[s]))&&u instanceof ie)return u;return new ie(!1)}o=p.call(t)}for(c=o.next;!(h=c.call(o)).done;){try{u=i(h.value)}catch(t){throw re(o),t}if("object"==typeof u&&u&&u instanceof ie)return u}return new ie(!1)}var W="[object z]"===String(P),se=Wt("toStringTag"),ae="Arguments"==r(function(){return arguments}()),ue=W?r:function(t){var e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(t=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),se))?t:ae?r(e):"Object"==(t=r(e))&&"function"==typeof e.callee?"Arguments":t},ce=Wt("iterator"),he=function(t,e){var n=this;if(!(n instanceof he))return new he(t,e);Mt&&(n=Mt(new Error(void 0),Lt(n))),void 0!==e&&R(n,"message",String(e));e=[];return oe(t,e.push,{that:e}),R(n,"errors",e),n};he.prototype=Qt(Error.prototype,{constructor:v(5,he),message:v(5,""),name:v(5,"AggregateError")}),st({global:!0},{AggregateError:he});H=W?{}.toString:function(){return"[object "+ue(this)+"]"};W||ft(Object.prototype,"toString",H,{unsafe:!0});function le(t,e,n){for(var r in e)ft(t,r,e[r],n);return t}function fe(t,e,n){t&&!c(t=n?t:t.prototype,ye)&&ge(t,ye,{configurable:!0,value:e})}function pe(t){var e=et(t),t=k.f;f&&e&&!e[me]&&t(e,me,{configurable:!0,get:function(){return this}})}function de(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}var ve=b.Promise,ge=k.f,ye=Wt("toStringTag"),me=Wt("species"),be=Wt("iterator"),we=!1;try{var _e=0,Ie={next:function(){return{done:!!_e++}},return:function(){we=!0}};Ie[be]=function(){return this},Array.from(Ie,function(){throw 2})}catch(Fs){}function Te(t,e){if(!e&&!we)return!1;var n=!1;try{var r={};r[be]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n}function Ee(t,e){var n;return void 0===(t=m(t).constructor)||null==(n=m(t)[Ae])?e:Gt(n)}function Se(t){var e;xe.hasOwnProperty(t)&&(e=xe[t],delete xe[t],e())}function Ce(t){return function(){Se(t)}}var Ne,Ae=Wt("species"),Z=et("navigator","userAgent")||"",bt=/(iphone|ipod|ipad).*applewebkit/i.test(Z),ke="process"==r(b.process),Re=b.location,o=b.setImmediate,t=b.clearImmediate,Pe=b.process,P=b.MessageChannel,Oe=b.Dispatch,De=0,xe={},Le="onreadystatechange",W=function(t){Se(t.data)},H=function(t){b.postMessage(t+"",Re.protocol+"//"+Re.host)};o&&t||(o=function(t){for(var e=[],n=1;n<arguments.length;)e.push(arguments[n++]);return xe[++De]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},Ne(De),De},t=function(t){delete xe[t]},ke?Ne=function(t){Pe.nextTick(Ce(t))}:Oe&&Oe.now?Ne=function(t){Oe.now(Ce(t))}:P&&!bt?(We=(P=new P).port2,P.port1.onmessage=W,Ne=zt(We.postMessage,We,1)):b.addEventListener&&"function"==typeof postMessage&&!b.importScripts&&Re&&"file:"!==Re.protocol&&!g(H)?(Ne=H,b.addEventListener("message",W,!1)):Ne=Le in n("script")?function(t){jt.appendChild(n("script"))[Le]=function(){jt.removeChild(this),Se(t)}}:function(t){setTimeout(Ce(t),0)});var Me,Fe,Ue,je,qe,Ve,Be,Ke,We={set:o,clear:t},H=N.f,He=We.set,W=b.MutationObserver||b.WebKitMutationObserver,o=b.document,Ge=b.process,t=b.Promise,H=H(b,"queueMicrotask"),H=H&&H.value;H||(Me=function(){var t,e;for(ke&&(t=Ge.domain)&&t.exit();Fe;){e=Fe.fn,Fe=Fe.next;try{e()}catch(t){throw Fe?je():Ue=void 0,t}}Ue=void 0,t&&t.enter()},je=!bt&&!ke&&W&&o?(qe=!0,Ve=o.createTextNode(""),new W(Me).observe(Ve,{characterData:!0}),function(){Ve.data=qe=!qe}):t&&t.resolve?(Be=t.resolve(void 0),Ke=Be.then,function(){Ke.call(Be,Me)}):ke?function(){Ge.nextTick(Me)}:function(){He.call(b,Me)});function ze(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=Gt(n),this.reject=Gt(r)}function Qe(t,e){return m(t),y(e)&&e.constructor===t?e:((0,(t=Je.f(t)).resolve)(e),t.promise)}function Ye(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}var Xe=H||function(t){t={fn:t,next:void 0};Ue&&(Ue.next=t),Fe||(Fe=t,je()),Ue=t},Je={f:function(t){return new ze(t)}},H=b.process,H=H&&H.versions,H=H&&H.v8;H?Pn=(Sn=H.split("."))[0]+Sn[1]:Z&&(!(Sn=Z.match(/Edge\/(\d+)/))||74<=Sn[1])&&(Sn=Z.match(/Chrome\/(\d+)/))&&(Pn=Sn[1]);function $e(t){var e;return!(!y(t)||"function"!=typeof(e=t.then))&&e}function Ze(l,f){var p;l.notified||(l.notified=!0,p=l.reactions,Xe(function(){for(var t=l.value,e=1==l.state,n=0;p.length>n;){var r,i,o,s=p[n++],a=e?s.ok:s.fail,u=s.resolve,c=s.reject,h=s.domain;try{a?(e||(2===l.rejection&&An(l),l.rejection=1),!0===a?r=t:(h&&h.enter(),r=a(t),h&&(h.exit(),o=!0)),r===s.promise?c(gn("Promise-chain cycle")):(i=$e(r))?i.call(r,u,c):u(r)):c(t)}catch(t){h&&!o&&h.exit(),c(t)}}l.reactions=[],l.notified=!1,f&&!l.rejection&&Cn(l)}))}function tn(t,e,n){var r,i;In?((r=yn.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),b.dispatchEvent(r)):r={promise:e,reason:n},!Tn&&(i=b["on"+t])?i(r):t===En&&function(t,e){var n=b.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,e))}("Unhandled promise rejection",n)}function en(e,n,r){return function(t){e(n,t,r)}}function nn(t,e,n){t.done||(t.done=!0,(t=n?n:t).value=e,t.state=2,Ze(t,!0))}var rn,on,sn,an,un=Pn&&+Pn,cn=We.set,hn=Wt("species"),ln="Promise",fn=lt.get,pn=lt.set,dn=lt.getterFor(ln),vn=ve,gn=b.TypeError,yn=b.document,mn=b.process,bn=et("fetch"),wn=Je.f,_n=wn,In=!!(yn&&yn.createEvent&&b.dispatchEvent),Tn="function"==typeof PromiseRejectionEvent,En="unhandledrejection",Z=Pt(ln,function(){if(!(K(vn)!==String(vn))){if(66===un)return!0;if(!ke&&!Tn)return!0}if(51<=un&&/native code/.test(vn))return!1;function t(t){t(function(){},function(){})}var e=vn.resolve(1);return(e.constructor={})[hn]=t,!(e.then(function(){})instanceof t)}),Sn=Z||!Te(function(t){vn.all(t).catch(function(){})}),Cn=function(i){cn.call(b,function(){var t,e=i.facade,n=i.value,r=Nn(i);if(r&&(t=Ye(function(){ke?mn.emit("unhandledRejection",n,e):tn(En,e,n)}),i.rejection=ke||Nn(i)?2:1,t.error))throw t.value})},Nn=function(t){return 1!==t.rejection&&!t.parent},An=function(e){cn.call(b,function(){var t=e.facade;ke?mn.emit("rejectionHandled",t):tn("rejectionhandled",t,e.value)})},kn=function(n,t,e){if(!n.done){n.done=!0,e&&(n=e);try{if(n.facade===t)throw gn("Promise can't be resolved itself");var r=$e(t);r?Xe(function(){var e={done:!1};try{r.call(t,en(kn,e,n),en(nn,e,n))}catch(t){nn(e,t,n)}}):(n.value=t,n.state=1,Ze(n,!1))}catch(t){nn({done:!1},t,n)}}};Z&&(vn=function(t){de(this,vn,ln),Gt(t),rn.call(this);var e=fn(this);try{t(en(kn,e),en(nn,e))}catch(t){nn(e,t)}},(rn=function(t){pn(this,{type:ln,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=le(vn.prototype,{then:function(t,e){var n=dn(this),r=wn(Ee(this,vn));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=ke?mn.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Ze(n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),on=function(){var t=new rn,e=fn(t);this.promise=t,this.resolve=en(kn,e),this.reject=en(nn,e)},Je.f=wn=function(t){return t===vn||t===sn?new on:_n(t)},"function"==typeof ve&&(an=ve.prototype.then,ft(ve.prototype,"then",function(t,e){var n=this;return new vn(function(t,e){an.call(n,t,e)}).then(t,e)},{unsafe:!0}),"function"==typeof bn&&st({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return Qe(vn,bn.apply(b,arguments))}}))),st({global:!0,wrap:!0,forced:Z},{Promise:vn}),fe(vn,ln,!1),pe(ln),sn=et(ln),st({target:ln,stat:!0,forced:Z},{reject:function(t){var e=wn(this);return e.reject.call(void 0,t),e.promise}}),st({target:ln,stat:!0,forced:Z},{resolve:function(t){return Qe(this,t)}}),st({target:ln,stat:!0,forced:Sn},{all:function(t){var a=this,e=wn(a),u=e.resolve,c=e.reject,n=Ye(function(){var r=Gt(a.resolve),i=[],o=0,s=1;oe(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=wn(n),i=r.reject,e=Ye(function(){var e=Gt(n.resolve);oe(t,function(t){e.call(n,t).then(r.resolve,i)})});return e.error&&i(e.value),r.promise}}),st({target:"Promise",stat:!0},{allSettled:function(t){var a=this,e=Je.f(a),u=e.resolve,n=e.reject,r=Ye(function(){var r=Gt(a.resolve),i=[],o=0,s=1;oe(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 Rn="No one promise resolved";st({target:"Promise",stat:!0},{any:function(t){var u=this,e=Je.f(u),c=e.resolve,h=e.reject,n=Ye(function(){var r=Gt(u.resolve),i=[],o=0,s=1,a=!1;oe(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(et("AggregateError"))(i,Rn)))})}),--s||h(new(et("AggregateError"))(i,Rn))});return n.error&&h(n.value),e.promise}});var Pn=!!ve&&g(function(){ve.prototype.finally.call({then:function(){}},function(){})});st({target:"Promise",proto:!0,real:!0,forced:Pn},{finally:function(e){var n=Ee(this,et("Promise")),t="function"==typeof e;return this.then(t?function(t){return Qe(n,e()).then(function(){return t})}:e,t?function(t){return Qe(n,e()).then(function(){throw t})}:e)}}),"function"!=typeof ve||ve.prototype.finally||ft(ve.prototype,"finally",et("Promise").prototype.finally);We=function(o){return function(t,e){var n,r=String(s(t)),i=nt(e),t=r.length;return i<0||t<=i?o?"":void 0:(e=r.charCodeAt(i))<55296||56319<e||i+1===t||(n=r.charCodeAt(i+1))<56320||57343<n?o?r.charAt(i):e:o?r.slice(i,i+2):n-56320+(e-55296<<10)+65536}},Z={codeAt:We(!1),charAt:We(!0)},Sn=Wt("iterator"),Pn=!1;[].keys&&("next"in(Qn=[].keys())?(lr=Lt(Lt(Qn)))!==Object.prototype&&(dr=lr):Pn=!0),c(dr=null==dr?{}:dr,Sn)||R(dr,Sn,function(){return this});function On(){return this}function Dn(){return this}function xn(t,e,n,r,i,o,s){function a(t){if(t===i&&d)return d;if(!Fn&&t in f)return f[t];switch(t){case"keys":case jn:case qn:return function(){return new n(this,t)}}return function(){return new n(this)}}!function(t,e,n){e+=" Iterator";t.prototype=Qt(Ln,{next:v(1,n)}),fe(t,e,!1),Zt[e]=On}(n,e,r);var u,c,h=e+" Iterator",l=!1,f=t.prototype,p=f[Un]||f["@@iterator"]||i&&f[i],d=!Fn&&p||a(i);if((r="Array"==e&&f.entries||p)&&(t=Lt(r.call(new t)),Mn!==Object.prototype&&t.next&&(Lt(t)!==Mn&&(Mt?Mt(t,Mn):"function"!=typeof t[Un]&&R(t,Un,Dn)),fe(t,h,!0))),i==jn&&p&&p.name!==jn&&(l=!0,d=function(){return p.call(this)}),f[Un]!==d&&R(f,Un,d),Zt[e]=d,i)if(u={values:a(jn),keys:o?d:a("keys"),entries:a(qn)},s)for(c in u)!Fn&&!l&&c in f||ft(f,c,u[c]);else st({target:e,proto:!0,forced:Fn||l},u);return u}var We={IteratorPrototype:dr,BUGGY_SAFARI_ITERATORS:Pn},Ln=We.IteratorPrototype,Mn=We.IteratorPrototype,Fn=We.BUGGY_SAFARI_ITERATORS,Un=Wt("iterator"),jn="values",qn="entries",Vn=Z.charAt,Bn="String Iterator",Kn=lt.set,Wn=lt.getterFor(Bn);xn(String,"String",function(t){Kn(this,{type:Bn,string:String(t),index:0})},function(){var t=Wn(this),e=t.string,n=t.index;return n>=e.length?{value:void 0,done:!0}:(n=Vn(e,n),t.index+=n.length,{value:n,done:!1})});var Hn={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},Gn=Wt("unscopables"),zn=Array.prototype;null==zn[Gn]&&k.f(zn,Gn,{configurable:!0,value:Qt(null)});var Qn=function(t){zn[Gn][t]=!0},Yn="Array Iterator",Xn=lt.set,Jn=lt.getterFor(Yn),$n=xn(Array,"Array",function(t,e){Xn(this,{type:Yn,target:u(t),index:0,kind:e})},function(){var t=Jn(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");Zt.Arguments=Zt.Array,Qn("keys"),Qn("values"),Qn("entries");var Zn,tr=Wt("iterator"),er=Wt("toStringTag"),nr=$n.values;for(Zn in Hn){var rr=b[Zn],ir=rr&&rr.prototype;if(ir){if(ir[tr]!==nr)try{R(ir,tr,nr)}catch(Fs){ir[tr]=nr}if(ir[er]||R(ir,er,Zn),Hn[Zn])for(var or in $n)if(ir[or]!==$n[or])try{R(ir,or,$n[or])}catch(Fs){ir[or]=$n[or]}}}pt.Promise;st({target:"Promise",stat:!0},{try:function(t){var e=Je.f(this),t=Ye(t);return(t.error?e.reject:e.resolve)(t.value),e.promise}});function sr(t,e){var n;return new(void 0===(n=ur(t)&&("function"==typeof(n=t.constructor)&&(n===Array||ur(n.prototype))||y(n)&&null===(n=n[cr]))?void 0:n)?Array:n)(0===e?0:e)}function ar(t){throw t}var ur=Array.isArray||function(t){return"Array"==r(t)},cr=Wt("species"),hr=[].push,lr=function(f){var p=1==f,d=2==f,v=3==f,g=4==f,y=6==f,m=7==f,b=5==f||y;return function(t,e,n,r){for(var i,o,s=at(t),a=_(s),u=zt(e,n,3),c=rt(a.length),h=0,r=r||sr,l=p?r(t,c):d||m?r(t,0):void 0;h<c;h++)if((b||h in a)&&(o=u(i=a[h],h,s),f))if(p)l[h]=o;else if(o)switch(f){case 3:return!0;case 5:return i;case 6:return h;case 2:hr.call(l,i)}else switch(f){case 4:return!1;case 7:hr.call(l,i)}return y?-1:v||g?g:l}},Sn={forEach:lr(0),map:lr(1),filter:lr(2),some:lr(3),every:lr(4),find:lr(5),findIndex:lr(6),filterOut:lr(7)},fr=Object.defineProperty,pr={},dr=function(t,e){if(c(pr,t))return pr[t];var n=[][t],r=!!c(e=e||{},"ACCESSORS")&&e.ACCESSORS,i=c(e,0)?e[0]:ar,o=c(e,1)?e[1]:void 0;return pr[t]=!!n&&!g(function(){if(r&&!f)return 1;var t={length:-1};r?fr(t,1,{enumerable:!0,get:ar}):t[1]=1,n.call(t,i,o)})},vr=Sn.find,Pn="find",gr=!0,We=dr(Pn);Pn in[]&&Array(1)[Pn](function(){gr=!1}),st({target:"Array",proto:!0,forced:gr||!We},{find:function(t){return vr(this,t,1<arguments.length?arguments[1]:void 0)}}),Qn(Pn);var yr=Function.call,Z=function(t,e,n){return zt(yr,b[t].prototype[e],n)},mr=(Z("Array","find"),Sn.findIndex),lr="findIndex",br=!0,We=dr(lr);lr in[]&&Array(1)[lr](function(){br=!1}),st({target:"Array",proto:!0,forced:br||!We},{findIndex:function(t){return mr(this,t,1<arguments.length?arguments[1]:void 0)}}),Qn(lr);function wr(t,e,n){(e=i(e))in t?k.f(t,e,v(0,n)):t[e]=n}Z("Array","findIndex");Pn=!Te(function(t){Array.from(t)});st({target:"Array",stat:!0,forced:Pn},{from:function(t){var e,n,r,i,o,s,a=at(t),u="function"==typeof this?this:Array,c=arguments.length,h=1<c?arguments[1]:void 0,l=void 0!==h,t=ne(a),f=0;if(l&&(h=zt(h,2<c?arguments[2]:void 0,2)),null==t||u==Array&&Ht(t))for(n=new u(e=rt(a.length));f<e;f++)s=l?h(a[f],f):a[f],wr(n,f,s);else for(o=(i=t.call(a)).next,n=new u;!(r=o.call(i)).done;f++)s=l?function(e,t,n,r){try{return r?t(m(n)[0],n[1]):t(n)}catch(t){throw re(e),t}}(i,h,[r.value,f],!0):r.value,wr(n,f,s);return n.length=f,n}});pt.Array.from;var _r,Ir,Tr=Sn.some,We=!!(Ir=[]["some"])&&g(function(){Ir.call(null,_r||function(){throw 1},1)}),Qn=dr("some");st({target:"Array",proto:!0,forced:!We||!Qn},{some:function(t){return Tr(this,t,1<arguments.length?arguments[1]:void 0)}});Z("Array","some");function Er(t){return!!y(t)&&(t=ue(t),c(Or,t)||c(Dr,t))}var Sr,lr="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,Pn=k.f,Cr=b.Int8Array,Nr=Cr&&Cr.prototype,dr=b.Uint8ClampedArray,We=dr&&dr.prototype,Ar=Cr&&Lt(Cr),kr=Nr&&Lt(Nr),Qn=Object.prototype,dr=(Qn.isPrototypeOf,Wt("toStringTag")),Rr=x("TYPED_ARRAY_TAG"),Pr=lr&&!!Mt&&"Opera"!==ue(b.opera),lr=!1,Or={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Dr={BigInt64Array:8,BigUint64Array:8};for(Sr in Or)b[Sr]||(Pr=!1);if((!Pr||"function"!=typeof Ar||Ar===Function.prototype)&&(Ar=function(){throw TypeError("Incorrect invocation")},Pr))for(Sr in Or)b[Sr]&&Mt(b[Sr],Ar);if((!Pr||!kr||kr===Qn)&&(kr=Ar.prototype,Pr))for(Sr in Or)b[Sr]&&Mt(b[Sr].prototype,kr);if(Pr&&Lt(We)!==kr&&Mt(We,kr),f&&!c(kr,dr))for(Sr in lr=!0,Pn(kr,dr,{get:function(){return y(this)?this[Rr]:void 0}}),Or)b[Sr]&&R(b[Sr],Rr,Sr);var We=function(t){if(Er(t))return t;throw TypeError("Target is not a typed array")},Pn=function(t,e,n){if(f){if(n)for(var r in Or){r=b[r];r&&c(r.prototype,t)&&delete r.prototype[t]}kr[t]&&!n||ft(kr,t,!n&&Pr&&Nr[t]||e)}},dr=Wt("iterator"),lr=b.Uint8Array,xr=$n.values,Lr=$n.keys,Mr=$n.entries,Fr=We,We=Pn,Pn=lr&&lr.prototype[dr],lr=!!Pn&&("values"==Pn.name||null==Pn.name),Pn=function(){return xr.call(Fr(this))};We("entries",function(){return Mr.call(Fr(this))}),We("keys",function(){return Lr.call(Fr(this))}),We("values",Pn,!lr),We(dr,Pn,!lr);var Ur=Object.assign,jr=Object.defineProperty,Pn=!Ur||g(function(){if(f&&1!==Ur({b:1},Ur(jr({},"a",{enumerable:!0,get:function(){jr(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!=Ur({},t)[n]||Ft(Ur({},e)).join("")!=r})?function(t,e){for(var n=at(t),r=arguments.length,i=1,o=Et.f,s=p.f;i<r;)for(var a,u=_(arguments[i++]),c=o?Ft(u).concat(o(u)):Ft(u),h=c.length,l=0;l<h;)a=c[l++],f&&!s.call(u,a)||(n[a]=u[a]);return n}:Ur;st({target:"Object",stat:!0,forced:Object.assign!==Pn},{assign:Pn});pt.Object.assign;var qr=p.f,lr=function(a){return function(t){for(var e,n=u(t),r=Ft(n),i=r.length,o=0,s=[];o<i;)e=r[o++],f&&!qr.call(n,e)||s.push(a?[e,n[e]]:n[e]);return s}},Pn={entries:lr(!0),values:lr(!1)},Vr=Pn.entries;st({target:"Object",stat:!0},{entries:function(t){return Vr(t)}});pt.Object.entries;var Br=Pn.values;st({target:"Object",stat:!0},{values:function(t){return Br(t)}});pt.Object.values;function Kr(t){if(y(e=t)&&(void 0!==(n=e[Wr])?!!n:"RegExp"==r(e)))throw TypeError("The method doesn't accept regular expressions");var e,n;return t}var Wr=Wt("match"),Hr=Wt("match"),lr=function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[Hr]=!1,"/./"[e](n)}catch(t){}}return!1};st({target:"String",proto:!0,forced:!lr("includes")},{includes:function(t){return!!~String(s(this)).indexOf(Kr(t),1<arguments.length?arguments[1]:void 0)}});Z("String","includes");var Gr,Pn=N.f,zr="".startsWith,Qr=Math.min,lr=lr("startsWith"),Gr=!(lr||(!(Gr=Pn(String.prototype,"startsWith"))||Gr.writable));st({target:"String",proto:!0,forced:!Gr&&!lr},{startsWith:function(t){var e=String(s(this));Kr(t);var n=rt(Qr(1<arguments.length?arguments[1]:void 0,e.length)),t=String(t);return zr?zr.call(e,t,n):e.slice(n,n+t.length)===t}});Z("String","startsWith");st({target:"String",proto:!0},{repeat:"".repeat||function(t){var e=String(s(this)),n="",r=nt(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}});Z("String","repeat");var Yr,Xr=Wt("species"),Jr=Wt("isConcatSpreadable"),$r=9007199254740991,Zr="Maximum allowed index exceeded",lr=51<=un||!g(function(){var t=[];return t[Jr]=!1,t.concat()[0]!==t}),Z=(Yr="concat",51<=un||!g(function(){var t=[];return(t.constructor={})[Xr]=function(){return{foo:1}},1!==t[Yr](Boolean).foo}));st({target:"Array",proto:!0,forced:!lr||!Z},{concat:function(t){for(var e,n,r,i=at(this),o=sr(i,0),s=0,a=-1,u=arguments.length;a<u;a++)if(function(t){if(!y(t))return!1;var e=t[Jr];return void 0!==e?!!e:ur(t)}(r=-1===a?i:arguments[a])){if(n=rt(r.length),$r<s+n)throw TypeError(Zr);for(e=0;e<n;e++,s++)e in r&&wr(o,s,r[e])}else{if($r<=s)throw TypeError(Zr);wr(o,s++,r)}return o.length=s,o}});function ti(t){var e=pt.Symbol||(pt.Symbol={});c(e,t)||ai(e,t,{value:si.f(t)})}function ei(t,e){var n=_i[t]=Qt(vi[li]);return fi(n,{type:hi,tag:t,description:e}),f||(n.description=e),n}function ni(e,t){m(e);var n=u(t),t=Ft(n).concat(Ri(n));return ui(t,function(t){f&&!ki.call(n,t)||Ai(e,t,n[t])}),e}var ri=Tt.f,ii={}.toString,oi="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Z={f:function(t){return oi&&"[object Window]"==ii.call(t)?function(t){try{return ri(t)}catch(t){return oi.slice()}}(t):ri(u(t))}},si={f:Wt},ai=k.f,ui=Sn.forEach,ci=J("hidden"),hi="Symbol",li="prototype",Sn=Wt("toPrimitive"),fi=lt.set,pi=lt.getterFor(hi),di=Object[li],vi=b.Symbol,gi=et("JSON","stringify"),yi=N.f,mi=k.f,bi=Z.f,wi=p.f,_i=z("symbols"),Ii=z("op-symbols"),Ti=z("string-to-symbol-registry"),Ei=z("symbol-to-string-registry"),J=z("wks"),z=b.QObject,Si=!z||!z[li]||!z[li].findChild,Ci=f&&g(function(){return 7!=Qt(mi({},"a",{get:function(){return mi(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=yi(di,e);r&&delete di[e],mi(t,e,n),r&&t!==di&&mi(di,e,r)}:mi,Ni=a?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof vi},Ai=function(t,e,n){t===di&&Ai(Ii,e,n),m(t);e=i(e,!0);return m(n),c(_i,e)?(n.enumerable?(c(t,ci)&&t[ci][e]&&(t[ci][e]=!1),n=Qt(n,{enumerable:v(0,!1)})):(c(t,ci)||mi(t,ci,v(1,{})),t[ci][e]=!0),Ci(t,e,n)):mi(t,e,n)},ki=function(t){var e=i(t,!0),t=wi.call(this,e);return!(this===di&&c(_i,e)&&!c(Ii,e))&&(!(t||!c(this,e)||!c(_i,e)||c(this,ci)&&this[ci][e])||t)},z=function(t,e){var n=u(t),t=i(e,!0);if(n!==di||!c(_i,t)||c(Ii,t)){e=yi(n,t);return!e||!c(_i,t)||c(n,ci)&&n[ci][t]||(e.enumerable=!0),e}},a=function(t){var t=bi(u(t)),e=[];return ui(t,function(t){c(_i,t)||c($,t)||e.push(t)}),e},Ri=function(t){var e=t===di,t=bi(e?Ii:u(t)),n=[];return ui(t,function(t){!c(_i,t)||e&&!c(di,t)||n.push(_i[t])}),n};Yt||(ft((vi=function(){if(this instanceof vi)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=x(t),n=function(t){this===di&&n.call(Ii,t),c(this,ci)&&c(this[ci],e)&&(this[ci][e]=!1),Ci(this,e,v(1,t))};return f&&Si&&Ci(di,e,{configurable:!0,set:n}),ei(e,t)})[li],"toString",function(){return pi(this).tag}),ft(vi,"withoutSetter",function(t){return ei(x(t),t)}),p.f=ki,k.f=Ai,N.f=z,Tt.f=Z.f=a,Et.f=Ri,si.f=function(t){return ei(Wt(t),t)},f&&(mi(vi[li],"description",{configurable:!0,get:function(){return pi(this).description}}),ft(di,"propertyIsEnumerable",ki,{unsafe:!0}))),st({global:!0,wrap:!0,forced:!Yt,sham:!Yt},{Symbol:vi}),ui(Ft(J),function(t){ti(t)}),st({target:hi,stat:!0,forced:!Yt},{for:function(t){var e=String(t);if(c(Ti,e))return Ti[e];t=vi(e);return Ti[e]=t,Ei[t]=e,t},keyFor:function(t){if(!Ni(t))throw TypeError(t+" is not a symbol");if(c(Ei,t))return Ei[t]},useSetter:function(){Si=!0},useSimple:function(){Si=!1}}),st({target:"Object",stat:!0,forced:!Yt,sham:!f},{create:function(t,e){return void 0===e?Qt(t):ni(Qt(t),e)},defineProperty:Ai,defineProperties:ni,getOwnPropertyDescriptor:z}),st({target:"Object",stat:!0,forced:!Yt},{getOwnPropertyNames:a,getOwnPropertySymbols:Ri}),st({target:"Object",stat:!0,forced:g(function(){Et.f(1)})},{getOwnPropertySymbols:function(t){return Et.f(at(t))}}),gi&&(Ki=!Yt||g(function(){var t=vi();return"[null]"!=gi([t])||"{}"!=gi({a:t})||"{}"!=gi(Object(t))}),st({target:"JSON",stat:!0,forced:Ki},{stringify:function(t,e,n){for(var r,i=[t],o=1;o<arguments.length;)i.push(arguments[o++]);if((y(r=e)||void 0!==t)&&!Ni(t))return ur(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!Ni(e))return e}),i[1]=e,gi.apply(null,i)}})),vi[li][Sn]||R(vi[li],Sn,vi[li].valueOf),fe(vi,hi),$[ci]=!0,ti("asyncIterator");var Pi,Oi,Di,xi,Li,z=k.f,Mi=b.Symbol;!f||"function"!=typeof Mi||"description"in Mi.prototype&&void 0===Mi().description||(Pi={},ot(Oi=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof Oi?new Mi(t):void 0===t?Mi():Mi(t);return""===t&&(Pi[e]=!0),e},Mi),(Gi=Oi.prototype=Mi.prototype).constructor=Oi,Di=Gi.toString,xi="Symbol(test)"==String(Mi("test")),Li=/^Symbol\((.*)\)[^)]+$/,z(Gi,"description",{configurable:!0,get:function(){var t=y(this)?this.valueOf():this,e=Di.call(t);if(c(Pi,t))return"";e=xi?e.slice(7,-1):e.replace(Li,"$1");return""===e?void 0:e}}),st({global:!0,forced:!0},{Symbol:Oi})),ti("hasInstance"),ti("isConcatSpreadable"),ti("iterator"),ti("match"),ti("matchAll"),ti("replace"),ti("search"),ti("species"),ti("split"),ti("toPrimitive"),ti("toStringTag"),ti("unscopables"),fe(b.JSON,"JSON",!0),fe(Math,"Math",!0),st({global:!0},{Reflect:{}}),fe(b.Reflect,"Reflect",!0);pt.Symbol;ti("asyncDispose"),ti("dispose"),ti("observable"),ti("patternMatch"),ti("replaceAll");si.f("iterator");var Fi=!g(function(){return Object.isExtensible(Object.preventExtensions({}))}),Ui=e(function(t){function n(t){e(t,r,{value:{objectID:"O"+ ++i,weakData:{}}})}var e=k.f,r=x("meta"),i=0,o=Object.isExtensible||function(){return!0},s=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!y(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 Fi&&s.REQUIRED&&o(t)&&!c(t,r)&&n(t),t}};$[r]=!0}),a=function(s,t,e){function n(t){var n=p[t];ft(p,t,"add"==t?function(t){return n.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(h&&!y(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return h&&!y(t)?void 0:n.call(this,0===t?0:t)}:"has"==t?function(t){return!(h&&!y(t))&&n.call(this,0===t?0:t)}:function(t,e){return n.call(this,0===t?0:t,e),this})}var r,i,o,a,u,c=-1!==s.indexOf("Map"),h=-1!==s.indexOf("Weak"),l=c?"set":"add",f=b[s],p=f&&f.prototype,d=f,v={};return Pt(s,"function"!=typeof f||!(h||p.forEach&&!g(function(){(new f).entries().next()})))?(d=e.getConstructor(t,s,c,l),Ui.REQUIRED=!0):Pt(s,!0)&&(i=(r=new d)[l](h?{}:-0,1)!=r,o=g(function(){r.has(1)}),a=Te(function(t){new f(t)}),u=!h&&g(function(){for(var t=new f,e=5;e--;)t[l](e,e);return!t.has(-0)}),a||(((d=t(function(t,e){de(t,d,s);var n,r,i,o,n=(n=new f,r=t,t=d,Mt&&"function"==typeof(i=r.constructor)&&i!==t&&y(o=i.prototype)&&o!==t.prototype&&Mt(n,o),n);return null!=e&&oe(e,n[l],{that:n,AS_ENTRIES:c}),n})).prototype=p).constructor=d),(o||u)&&(n("delete"),n("has"),c&&n("get")),(u||i)&&n(l),h&&p.clear&&delete p.clear),v[s]=d,st({global:!0,forced:d!=f},v),fe(d,s),h||e.setStrong(d,s,c),d},ji=k.f,qi=Ui.fastKey,Vi=lt.set,Bi=lt.getterFor,Ki={getConstructor:function(t,n,r,i){function o(t,e,n){var r,i=a(t),o=u(t,e);return o?o.value=n:(i.last=o={index:r=qi(e,!0),key:e,value:n,previous:n=i.last,next:void 0,removed:!1},i.first||(i.first=o),n&&(n.next=o),f?i.size++:t.size++,"F"!==r&&(i.index[r]=o)),t}var s=t(function(t,e){de(t,s,n),Vi(t,{type:n,index:Qt(null),first:void 0,last:void 0,size:0}),f||(t.size=0),null!=e&&oe(e,t[i],{that:t,AS_ENTRIES:r})}),a=Bi(n),u=function(t,e){var n,r=a(t),t=qi(e);if("F"!==t)return r.index[t];for(n=r.first;n;n=n.next)if(n.key==e)return n};return le(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,n=a(this),r=u(this,t);return r&&(e=r.next,t=r.previous,delete n.index[r.index],r.removed=!0,t&&(t.next=e),e&&(e.previous=t),n.first==r&&(n.first=e),n.last==r&&(n.last=t),f?n.size--:this.size--),!!r},forEach:function(t){for(var e,n=a(this),r=zt(t,1<arguments.length?arguments[1]:void 0,3);e=e?e.next:n.first;)for(r(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!u(this,t)}}),le(s.prototype,r?{get:function(t){t=u(this,t);return t&&t.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&&ji(s.prototype,"size",{get:function(){return a(this).size}}),s},setStrong:function(t,e,n){var r=e+" Iterator",i=Bi(e),o=Bi(r);xn(t,e,function(t,e){Vi(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),pe(e)}},Sn=(a("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Ki),pt.Map,function(t){var e,n,r,i,o=arguments.length,s=1<o?arguments[1]:void 0;return Gt(this),(e=void 0!==s)&&Gt(s),null==t?new this:(n=[],e?(r=0,i=zt(s,2<o?arguments[2]:void 0,2),oe(t,function(t){n.push(i(t,r++))})):oe(t,n.push,{that:n}),new this(n))});st({target:"Map",stat:!0},{from:Sn});z=function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)};st({target:"Map",stat:!0},{of:z});function Wi(){for(var t,e=m(this),n=Gt(e.delete),r=!0,i=0,o=arguments.length;i<o;i++)t=n.call(e,arguments[i]),r=r&&t;return!!r}st({target:"Map",proto:!0,real:!0,forced:G},{deleteAll:function(){return Wi.apply(this,arguments)}});st({target:"Map",proto:!0,real:!0,forced:G},{emplace:function(t,e){var n=m(this),e=n.has(t)&&"update"in e?e.update(n.get(t),t,n):e.insert(t,n);return n.set(t,e),e}});function Hi(t){return Map.prototype.entries.call(t)}st({target:"Map",proto:!0,real:!0,forced:G},{every:function(t){var r=m(this),e=Hi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return!oe(e,function(t,e,n){if(!i(e,t,r))return n()},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Map",proto:!0,real:!0,forced:G},{filter:function(t){var n=m(this),e=Hi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ee(n,et("Map"))),o=Gt(i.set);return oe(e,function(t,e){r(e,t,n)&&o.call(i,t,e)},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}}),st({target:"Map",proto:!0,real:!0,forced:G},{find:function(t){var r=m(this),e=Hi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return oe(e,function(t,e,n){if(i(e,t,r))return n(e)},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),st({target:"Map",proto:!0,real:!0,forced:G},{findKey:function(t){var r=m(this),e=Hi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return oe(e,function(t,e,n){if(i(e,t,r))return n(t)},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),st({target:"Map",stat:!0},{groupBy:function(t,n){var r=new this;Gt(n);var i=Gt(r.has),o=Gt(r.get),s=Gt(r.set);return oe(t,function(t){var e=n(t);i.call(r,e)?o.call(r,e).push(t):s.call(r,e,[t])}),r}});st({target:"Map",proto:!0,real:!0,forced:G},{includes:function(i){return oe(Hi(m(this)),function(t,e,n){if((r=e)===(e=i)||r!=r&&e!=e)return n();var r},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Map",stat:!0},{keyBy:function(t,e){var n=new this;Gt(e);var r=Gt(n.set);return oe(t,function(t){r.call(n,e(t),t)}),n}}),st({target:"Map",proto:!0,real:!0,forced:G},{keyOf:function(r){return oe(Hi(m(this)),function(t,e,n){if(e===r)return n(t)},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),st({target:"Map",proto:!0,real:!0,forced:G},{mapKeys:function(t){var n=m(this),e=Hi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ee(n,et("Map"))),o=Gt(i.set);return oe(e,function(t,e){o.call(i,r(e,t,n),e)},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}}),st({target:"Map",proto:!0,real:!0,forced:G},{mapValues:function(t){var n=m(this),e=Hi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ee(n,et("Map"))),o=Gt(i.set);return oe(e,function(t,e){o.call(i,t,r(e,t,n))},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}}),st({target:"Map",proto:!0,real:!0,forced:G},{merge:function(t){for(var e=m(this),n=Gt(e.set),r=0;r<arguments.length;)oe(arguments[r++],n,{that:e,AS_ENTRIES:!0});return e}}),st({target:"Map",proto:!0,real:!0,forced:G},{reduce:function(n){var r=m(this),t=Hi(r),i=arguments.length<2,o=i?void 0:arguments[1];if(Gt(n),oe(t,function(t,e){o=i?(i=!1,e):n(o,e,t,r)},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i)throw TypeError("Reduce of empty map with no initial value");return o}}),st({target:"Map",proto:!0,real:!0,forced:G},{some:function(t){var r=m(this),e=Hi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return oe(e,function(t,e,n){if(i(e,t,r))return n()},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Map",proto:!0,real:!0,forced:G},{update:function(t,e){var n=m(this),r=arguments.length;Gt(e);var i=n.has(t);if(!i&&r<3)throw TypeError("Updating absent value");r=i?n.get(t):Gt(2<r?arguments[2]:void 0)(t,n);return n.set(t,e(r,t,n)),n}});var Gi=function(t,e){var n,r=m(this),i=2<arguments.length?arguments[2]:void 0;if("function"!=typeof e&&"function"!=typeof i)throw TypeError("At least one callback required");return r.has(t)?(n=r.get(t),"function"==typeof e&&(n=e(n),r.set(t,n))):"function"==typeof i&&(n=i(),r.set(t,n)),n};st({target:"Map",proto:!0,real:!0,forced:G},{upsert:Gi}),st({target:"Map",proto:!0,real:!0,forced:G},{updateOrInsert:Gi});a("Set",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Ki),pt.Set;st({target:"Set",stat:!0},{from:Sn}),st({target:"Set",stat:!0},{of:z});st({target:"Set",proto:!0,real:!0,forced:G},{addAll:function(){return function(){for(var t=m(this),e=Gt(t.add),n=0,r=arguments.length;n<r;n++)e.call(t,arguments[n]);return t}.apply(this,arguments)}}),st({target:"Set",proto:!0,real:!0,forced:G},{deleteAll:function(){return Wi.apply(this,arguments)}});function zi(t){return Set.prototype.values.call(t)}st({target:"Set",proto:!0,real:!0,forced:G},{every:function(t){var n=m(this),e=zi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3);return!oe(e,function(t,e){if(!r(t,t,n))return e()},{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Set",proto:!0,real:!0,forced:G},{difference:function(t){var e=m(this),n=new(Ee(e,et("Set")))(e),r=Gt(n.delete);return oe(t,function(t){r.call(n,t)}),n}}),st({target:"Set",proto:!0,real:!0,forced:G},{filter:function(t){var e=m(this),n=zi(e),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ee(e,et("Set"))),o=Gt(i.add);return oe(n,function(t){r(t,t,e)&&o.call(i,t)},{IS_ITERATOR:!0}),i}}),st({target:"Set",proto:!0,real:!0,forced:G},{find:function(t){var n=m(this),e=zi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3);return oe(e,function(t,e){if(r(t,t,n))return e(t)},{IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),st({target:"Set",proto:!0,real:!0,forced:G},{intersection:function(t){var e=m(this),n=new(Ee(e,et("Set"))),r=Gt(e.has),i=Gt(n.add);return oe(t,function(t){r.call(e,t)&&i.call(n,t)}),n}}),st({target:"Set",proto:!0,real:!0,forced:G},{isDisjointFrom:function(t){var n=m(this),r=Gt(n.has);return!oe(t,function(t,e){if(!0===r.call(n,t))return e()},{INTERRUPTED:!0}).stopped}}),st({target:"Set",proto:!0,real:!0,forced:G},{isSubsetOf:function(t){var e=function(t){var e=ne(t);if("function"!=typeof e)throw TypeError(String(t)+" is not iterable");return m(e.call(t))}(this),n=m(t),r=n.has;return"function"!=typeof r&&(n=new(et("Set"))(t),r=Gt(n.has)),!oe(e,function(t,e){if(!1===r.call(n,t))return e()},{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Set",proto:!0,real:!0,forced:G},{isSupersetOf:function(t){var n=m(this),r=Gt(n.has);return!oe(t,function(t,e){if(!1===r.call(n,t))return e()},{INTERRUPTED:!0}).stopped}}),st({target:"Set",proto:!0,real:!0,forced:G},{join:function(t){var e=m(this),n=zi(e),e=void 0===t?",":String(t),t=[];return oe(n,t.push,{that:t,IS_ITERATOR:!0}),t.join(e)}}),st({target:"Set",proto:!0,real:!0,forced:G},{map:function(t){var e=m(this),n=zi(e),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ee(e,et("Set"))),o=Gt(i.add);return oe(n,function(t){o.call(i,r(t,t,e))},{IS_ITERATOR:!0}),i}}),st({target:"Set",proto:!0,real:!0,forced:G},{reduce:function(e){var n=m(this),t=zi(n),r=arguments.length<2,i=r?void 0:arguments[1];if(Gt(e),oe(t,function(t){i=r?(r=!1,t):e(i,t,t,n)},{IS_ITERATOR:!0}),r)throw TypeError("Reduce of empty set with no initial value");return i}}),st({target:"Set",proto:!0,real:!0,forced:G},{some:function(t){var n=m(this),e=zi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3);return oe(e,function(t,e){if(r(t,t,n))return e()},{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Set",proto:!0,real:!0,forced:G},{symmetricDifference:function(t){var e=m(this),n=new(Ee(e,et("Set")))(e),r=Gt(n.delete),i=Gt(n.add);return oe(t,function(t){r.call(n,t)||i.call(n,t)}),n}}),st({target:"Set",proto:!0,real:!0,forced:G},{union:function(t){var e=m(this),e=new(Ee(e,et("Set")))(e);return oe(t,Gt(e.add),{that:e}),e}});var Qi=Math.floor;st({target:"Number",stat:!0},{isInteger:function(t){return!y(t)&&isFinite(t)&&Qi(t)===t}});pt.Number.isInteger;st({target:"Number",stat:!0},{isNaN:function(t){return t!=t}});pt.Number.isNaN;var Yi=function(t,e){return(Yi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function Xi(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Yi(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Ji=function(){return(Ji=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 $i(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 Zi(n,r){var i,o,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"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,(e=s?[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 to(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{value:(t=t&&r>=t.length?void 0:t)&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function eo(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 no(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t}function ro(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 io(t){try{return uo.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var oo={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},so=function(t,e){if(!t)throw ao(e)},ao=function(t){return new Error("Firebase Database ("+oo.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},uo={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,o=(3&o)<<4|a>>4,a=(15&a)<<2|c>>6,c=63&c;u||(c=64,s||(a=64)),r.push(n[h],n[o],n[a],n[c])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(ro(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,o,s,a=t[n++];a<128?e[r++]=String.fromCharCode(a):191<a&&a<224?(o=t[n++],e[r++]=String.fromCharCode((31&a)<<6|63&o)):239<a&&a<365?(i=((7&a)<<18|(63&(o=t[n++]))<<12|(63&(s=t[n++]))<<6|63&t[n++])-65536,e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))):(o=t[n++],s=t[n++],e[r++]=String.fromCharCode((15&a)<<12|(63&o)<<6|63&s))}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();o=o<<2|s>>4;r.push(o),64!==a&&(s=s<<4&240|a>>2,r.push(s),64!==u&&(u=a<<6&192|u,r.push(u)))}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 co(t){return ho(void 0,t)}function ho(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)&&"__proto__"!==n&&(t[n]=ho(t[n],e[n]));return t}var lo=(fo.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))}},fo);function fo(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}function po(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function vo(){return"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(po())}function go(){var t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}function yo(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function mo(){return!0===oo.NODE_ADMIN}function bo(){return"indexedDB"in self&&null!=indexedDB}function wo(){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 _o(){return!(!navigator||!navigator.cookieEnabled)}var Io,To="FirebaseError",Eo=(Xi(So,Io=Error),So);function So(t,e,n){e=Io.call(this,e)||this;return e.code=t,e.customData=n,e.name=To,Object.setPrototypeOf(e,So.prototype),Error.captureStackTrace&&Error.captureStackTrace(e,Co.prototype.create),e}var Co=(No.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r,i=e[0]||{},o=this.service+"/"+t,t=this.errors[t],t=t?(r=i,t.replace(Ao,function(t,e){var n=r[e];return null!=n?String(n):"<"+e+"?>"})):"Error",t=this.serviceName+": "+t+" ("+o+").";return new Eo(o,t,i)},No);function No(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var Ao=/\{\$([^}]+)}/g;function ko(t){return JSON.parse(t)}function Ro(t){return JSON.stringify(t)}function Po(t){var e={},n={},r={},i="";try{var o=t.split("."),e=ko(io(o[0])||""),n=ko(io(o[1])||""),i=o[2],r=n.d||{};delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}}function Oo(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Do(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]}function xo(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Lo(t,e,n){var r,i={};for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=e.call(n,t[r],r,t));return i}function Mo(t){for(var n=[],e=0,r=Object.entries(t);e<r.length;e++){var i=r[e];!function(e,t){Array.isArray(t)?t.forEach(function(t){n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))}):n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))}(i[0],i[1])}return n.length?"&"+n.join("&"):""}var Fo=(Uo.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},Uo.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)}for(var o,s=this.chain_[0],a=this.chain_[1],u=this.chain_[2],c=this.chain_[3],h=this.chain_[4],r=0;r<80;r++)var l=r<40?r<20?(o=c^a&(u^c),1518500249):(o=a^u^c,1859775393):r<60?(o=a&u|c&(a|u),2400959708):(o=a^u^c,3395469782),i=(s<<5|s>>>27)+o+h+l+n[r]&4294967295,h=c,c=u,u=4294967295&(a<<30|a>>>2),a=s,s=i;this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+a&4294967295,this.chain_[2]=this.chain_[2]+u&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},Uo.prototype.update=function(t,e){if(null!=t){for(var n=(e=void 0===e?t.length: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}},Uo.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_);for(var r=0,n=0;n<5;n++)for(var i=24;0<=i;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t},Uo);function Uo(){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 jo(t,e){e=new qo(t,e);return e.subscribe.bind(e)}var qo=(Vo.prototype.next=function(e){this.forEachObserver(function(t){t.next(e)})},Vo.prototype.error=function(e){this.forEachObserver(function(t){t.error(e)}),this.close(e)},Vo.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},Vo.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)return!1;for(var n=0,r=e;n<r.length;n++){var i=r[n];if(i in t&&"function"==typeof t[i])return!0}return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n}).next&&(r.next=Bo),void 0===r.error&&(r.error=Bo),void 0===r.complete&&(r.complete=Bo);n=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),n},Vo.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))},Vo.prototype.forEachObserver=function(t){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,t)},Vo.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)}})},Vo.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}))},Vo);function Vo(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 Bo(){}function Ko(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 Wo(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?")}t+=" failed: ";return t+=r+" argument "}function Ho(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(Wo(t,e,r)+"must be a valid function.")}function Go(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(Wo(t,e,r)+"must be a valid context object.")}function zo(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 Qo=1e3,Yo=2,Xo=144e5,Jo=.5;function $o(t,e,n){void 0===n&&(n=Yo);n=(e=void 0===e?Qo:e)*Math.pow(n,t),t=Math.round(Jo*n*(Math.random()-.5)*2);return Math.min(Xo,n+t)}function Zo(t){return t&&t._delegate?t._delegate:t}var ts=(es.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},es.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},es.prototype.setServiceProps=function(t){return this.serviceProps=t,this},es);function es(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var ns="[DEFAULT]",rs=(is.prototype.get=function(t){void 0===t&&(t=ns);var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){var n=new lo;this.instancesDeferred.set(e,n);try{var r=this.getOrInitializeService({instanceIdentifier:e});r&&n.resolve(r)}catch(t){}}return this.instancesDeferred.get(e).promise},is.prototype.getImmediate=function(t){var e=Ji({identifier:ns,optional:!1},t),t=e.identifier,n=e.optional,r=this.normalizeInstanceIdentifier(t);try{var i=this.getOrInitializeService({instanceIdentifier:r});if(i)return i;if(n)return null;throw Error("Service "+this.name+" is not available")}catch(t){if(n)return null;throw t}},is.prototype.getComponent=function(){return this.component},is.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({instanceIdentifier:ns})}catch(t){}try{for(var r=to(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=eo(i.value,2),s=o[0],a=o[1],u=this.normalizeInstanceIdentifier(s);try{var c=this.getOrInitializeService({instanceIdentifier: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}}},is.prototype.clearInstance=function(t){void 0===t&&(t=ns),this.instancesDeferred.delete(t),this.instances.delete(t)},is.prototype.delete=function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=Array.from(this.instances.values()),[4,Promise.all(no(no([],eo(e.filter(function(t){return"INTERNAL"in t}).map(function(t){return t.INTERNAL.delete()}))),eo(e.filter(function(t){return"_delete"in t}).map(function(t){return t._delete()}))))];case 1:return t.sent(),[2]}})})},is.prototype.isComponentSet=function(){return null!=this.component},is.prototype.isInitialized=function(t){return void 0===t&&(t=ns),this.instances.has(t)},is.prototype.initialize=function(t){var e=(t=void 0===t?{}:t).instanceIdentifier,e=void 0===e?ns:e,t=t.options,t=void 0===t?{}:t,e=this.normalizeInstanceIdentifier(e);if(this.isInitialized(e))throw Error(this.name+"("+e+") has already been initialized");if(!this.isComponentSet())throw Error("Component "+this.name+" has not been registered yet");return this.getOrInitializeService({instanceIdentifier:e,options:t})},is.prototype.getOrInitializeService=function(t){var e=t.instanceIdentifier,n=t.options,r=void 0===n?{}:n,t=this.instances.get(e);return!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e)===ns?void 0:n,options:r}),this.instances.set(e,t)),t||null},is.prototype.normalizeInstanceIdentifier=function(t){return!this.component||this.component.multipleInstances?t:ns},is);function is(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}var os=(ss.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)},ss.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)},ss.prototype.getProvider=function(t){if(this.providers.has(t))return this.providers.get(t);var e=new rs(t,this);return this.providers.set(t,e),e},ss.prototype.getProviders=function(){return Array.from(this.providers.values())},ss);function ss(t){this.name=t,this.providers=new Map}var as,us=[];(Sn=as=as||{})[Sn.DEBUG=0]="DEBUG",Sn[Sn.VERBOSE=1]="VERBOSE",Sn[Sn.INFO=2]="INFO",Sn[Sn.WARN=3]="WARN",Sn[Sn.ERROR=4]="ERROR",Sn[Sn.SILENT=5]="SILENT";function cs(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=fs[e];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+e+")");console[o].apply(console,no(["["+i+"] "+t.name+":"],n))}}var hs={debug:as.DEBUG,verbose:as.VERBOSE,info:as.INFO,warn:as.WARN,error:as.ERROR,silent:as.SILENT},ls=as.INFO,fs=((z={})[as.DEBUG]="log",z[as.VERBOSE]="log",z[as.INFO]="info",z[as.WARN]="warn",z[as.ERROR]="error",z),ps=(Object.defineProperty(ds.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in as))throw new TypeError('Invalid value "'+t+'" assigned to `logLevel`');this._logLevel=t},enumerable:!1,configurable:!0}),ds.prototype.setLogLevel=function(t){this._logLevel="string"==typeof t?hs[t]:t},Object.defineProperty(ds.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(ds.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!1,configurable:!0}),ds.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,no([this,as.DEBUG],t)),this._logHandler.apply(this,no([this,as.DEBUG],t))},ds.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,no([this,as.VERBOSE],t)),this._logHandler.apply(this,no([this,as.VERBOSE],t))},ds.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,no([this,as.INFO],t)),this._logHandler.apply(this,no([this,as.INFO],t))},ds.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,no([this,as.WARN],t)),this._logHandler.apply(this,no([this,as.WARN],t))},ds.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,no([this,as.ERROR],t)),this._logHandler.apply(this,no([this,as.ERROR],t))},ds);function ds(t){this.name=t,this._logLevel=ls,this._logHandler=cs,this._userLogHandler=null,us.push(this)}function vs(e){us.forEach(function(t){t.setLogLevel(e)})}function gs(s,e){for(var t=0,n=us;t<n.length;t++)!function(t){var o=null;e&&e.level&&(o=hs[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:as[e].toLowerCase(),message:i,args:n,type:t.name})}}(n[t])}var Sn=((G={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",G["bad-app-name"]="Illegal App name: '{$appName}",G["duplicate-app"]="Firebase App named '{$appName}' already exists",G["app-deleted"]="Firebase App named '{$appName}' already deleted",G["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",G["invalid-log-argument"]="First argument to `onLog` must be null or a function.",G),ys=new Co("app","Firebase",Sn),ms="@firebase/app",bs="[DEFAULT]",ws=((z={})[ms]="fire-core",z["@firebase/analytics"]="fire-analytics",z["@firebase/auth"]="fire-auth",z["@firebase/database"]="fire-rtdb",z["@firebase/functions"]="fire-fn",z["@firebase/installations"]="fire-iid",z["@firebase/messaging"]="fire-fcm",z["@firebase/performance"]="fire-perf",z["@firebase/remote-config"]="fire-rc",z["@firebase/storage"]="fire-gcs",z["@firebase/firestore"]="fire-fst",z["fire-js"]="fire-js",z["firebase-wrapper"]="fire-js-all",z),_s=new ps("@firebase/app"),Is=(Object.defineProperty(Ts.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!1,configurable:!0}),Object.defineProperty(Ts.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(Ts.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),Ts.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})},Ts.prototype._getService=function(t,e){return void 0===e&&(e=bs),this.checkDestroyed_(),this.container.getProvider(t).getImmediate({identifier:e})},Ts.prototype._removeServiceInstance=function(t,e){void 0===e&&(e=bs),this.container.getProvider(t).clearInstance(e)},Ts.prototype._addComponent=function(e){try{this.container.addComponent(e)}catch(t){_s.debug("Component "+e.name+" failed to register with FirebaseApp "+this.name,t)}},Ts.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},Ts.prototype.toJSON=function(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}},Ts.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw ys.create("app-deleted",{appName:this.name_})},Ts);function Ts(t,e,n){var r=this;this.firebase_=n,this.isDeleted_=!1,this.name_=e.name,this.automaticDataCollectionEnabled_=e.automaticDataCollectionEnabled||!1,this.options_=co(t),this.container=new os(e.name),this._addComponent(new ts("app",function(){return r},"PUBLIC")),this.firebase_.INTERNAL.components.forEach(function(t){return r._addComponent(t)})}Is.prototype.name&&Is.prototype.options||Is.prototype.delete||console.log("dc");var Es="8.3.2";function Ss(s){var a={},u=new Map,c={__esModule:!0,initializeApp:function(t,e){void 0===e&&(e={});"object"==typeof e&&null!==e||(e={name:e});var n=e;void 0===n.name&&(n.name=bs);e=n.name;if("string"!=typeof e||!e)throw ys.create("bad-app-name",{appName:String(e)});if(Oo(a,e))throw ys.create("duplicate-app",{appName:e});n=new s(t,n,c);return a[e]=n},app:h,registerVersion:function(t,e,n){var r=null!==(i=ws[t])&&void 0!==i?i:t;n&&(r+="-"+n);var i=r.match(/\s|\//),t=e.match(/\s|\//);if(i||t){n=['Unable to register library "'+r+'" with version "'+e+'":'];return i&&n.push('library name "'+r+'" contains illegal characters (whitespace or "/")'),i&&t&&n.push("and"),t&&n.push('version name "'+e+'" contains illegal characters (whitespace or "/")'),void _s.warn(n.join(" "))}o(new ts(r+"-version",function(){return{library:r,version:e}},"VERSION"))},setLogLevel:vs,onLog:function(t,e){if(null!==t&&"function"!=typeof t)throw ys.create("invalid-log-argument");gs(t,e)},apps:null,SDK_VERSION:Es,INTERNAL:{registerComponent:o,removeApp:function(t){delete a[t]},components:u,useAsService:function(t,e){if("serverAuth"===e)return null;return e}}};function h(t){if(!Oo(a,t=t||bs))throw ys.create("no-app",{appName:t});return a[t]}function o(n){var t,r=n.name;if(u.has(r))return _s.debug("There were multiple attempts to register component "+r+"."),"PUBLIC"===n.type?c[r]:null;u.set(r,n),"PUBLIC"===n.type&&(t=function(t){if("function"!=typeof(t=void 0===t?h():t)[r])throw ys.create("invalid-app-argument",{appName:r});return t[r]()},void 0!==n.serviceProps&&ho(t,n.serviceProps),c[r]=t,s.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:[])});for(var e=0,i=Object.keys(a);e<i.length;e++){var o=i[e];a[o]._addComponent(n)}return"PUBLIC"===n.type?c[r]:null}return c.default=c,Object.defineProperty(c,"apps",{get:function(){return Object.keys(a).map(function(t){return a[t]})}}),h.App=s,c}var G=function t(){var e=Ss(Is);return e.INTERNAL=Ji(Ji({},e.INTERNAL),{createFirebaseNamespace:t,extendNamespace:function(t){ho(e,t)},createSubscribe:jo,ErrorFactory:Co,deepExtend:ho}),e}(),Cs=(Ns.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(t){if(function(t){t=t.getComponent();return"VERSION"===(null==t?void 0:t.type)}(t)){t=t.getImmediate();return t.library+"/"+t.version}return null}).filter(function(t){return t}).join(" ")},Ns);function Ns(t){this.container=t}"object"==typeof self&&self.self===self&&void 0!==self.firebase&&(_s.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n "),(Ga=self.firebase.SDK_VERSION)&&0<=Ga.indexOf("LITE")&&_s.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 As=G.initializeApp;G.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}}()&&_s.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 '),As.apply(void 0,t)};var ks,Rs,Xl=G;(ks=Xl).INTERNAL.registerComponent(new ts("platform-logger",function(t){return new Cs(t)},"PRIVATE")),ks.registerVersion(ms,"0.6.18",Rs),ks.registerVersion("fire-js","");Xl.registerVersion("firebase","8.3.2","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 u=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=u;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 s(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 a(e){return e instanceof s?e:new s(function(t){t(e)})}if(t)return t;e.prototype.b=function(t){var e;null==this.a&&(this.a=[],(e=this).c(function(){e.g()})),this.a.push(t)};var n=u.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})},s.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)}},s.prototype.m=function(t){if(t===this)this.g(new TypeError("A Promise cannot resolve to itself"));else if(t instanceof s)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.v(t):this.h(t)}},s.prototype.v=function(t){var e=void 0;try{e=t.then}catch(t){return void this.g(t)}"function"==typeof e?this.u(e,t):this.h(t)},s.prototype.g=function(t){this.i(2,t)},s.prototype.h=function(t){this.i(1,t)},s.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()},s.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 s.prototype.s=function(t){var e=this.f();t.Qa(e.resolve,e.reject)},s.prototype.u=function(t,e){var n=this.f();try{t.call(e,n.resolve,n.reject)}catch(t){n.reject(t)}},s.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 s(function(t,e){r=t,i=e});return this.Qa(n(t,r),n(e,i)),o},s.prototype.catch=function(t){return this.then(void 0,t)},s.prototype.Qa=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)},s.resolve=a,s.reject=function(n){return new s(function(t,e){e(n)})},s.race=function(i){return new s(function(t,e){for(var n=c(i),r=n.next();!r.done;r=n.next())a(r.value).Qa(t,e)})},s.all=function(t){var e=c(t),o=e.next();return o.done?a([]):new s(function(n,t){for(var r=[],i=0;r.push(void 0),i++,a(o.value).Qa(function(e){return function(t){r[e]=t,0==--i&&n(r)}}(r.length-1),t),o=e.next(),!o.done;);})},s});var h=h||{},l=this||self,e=/^[\w+/_-]+[=]{0,2}$/,a=null;function f(t){return(t=t.querySelector&&t.querySelector("script[nonce]"))&&(t=t.nonce||t.getAttribute("nonce"))&&e.test(t)?t:""}function s(){}function p(t){var e=typeof t;return"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}function d(t){var e=p(t);return"array"==e||"object"==e&&"number"==typeof t.length}function v(t){return"function"==p(t)}function g(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var n="closure_uid_"+(1e9*Math.random()>>>0),r=0;function i(t,e,n){return t.call.apply(t.bind,arguments)}function y(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")?i:y).apply(null,arguments)}function b(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)}}function w(t,e){function n(){}n.prototype=e.prototype,t.ab=e.prototype,t.prototype=new n,t.prototype.constructor=t}function _(t){return t}function I(t,e,n){this.code=S+t,this.message=e||C[t]||"",this.a=n||null}function T(t){var e=t&&t.code;return e?new I(e.substring(S.length),t.message,t.serverResponse):null}w(I,Error),I.prototype.w=function(){var t={code:this.code,message:this.message};return this.a&&(t.serverResponse=this.a),t},I.prototype.toJSON=function(){return this.w()};var E,S="auth/",C={"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."},N={ld:{Ta:"https://staging-identitytoolkit.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Za:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Wa:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"b"},sd:{Ta:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",Za:"https://securetoken.googleapis.com/v1/token",Wa:"https://identitytoolkit.googleapis.com/v2/",id:"p"},ud:{Ta:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Za:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Wa:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"s"},vd:{Ta:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",Za:"https://test-securetoken.sandbox.googleapis.com/v1/token",Wa:"https://test-identitytoolkit.sandbox.googleapis.com/v2/",id:"t"}};function A(t){for(var e in N)if(N[e].id===t)return t=N[e],{firebaseEndpoint:t.Ta,secureTokenEndpoint:t.Za,identityPlatformEndpoint:t.Wa};return null}function k(t){if(t)try{return t.$goog_Thenable}catch(t){return}}function R(t){var e;Error.captureStackTrace?Error.captureStackTrace(this,R):(e=Error().stack)&&(this.stack=e),t&&(this.message=String(t))}function P(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");R.call(this,n+t[r])}function O(t){throw new P("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))}function D(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function x(t,e){t.f(e),t.b<100&&(t.b++,e.next=t.a,t.a=e)}function L(){this.b=this.a=null}E=A("__EID__")?"__EID__":void 0,w(R,Error),R.prototype.name="CustomError",w(P,R),P.prototype.name="AssertionError",D.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};var M=new D(function(){return new F},function(t){t.reset()});function F(){this.next=this.b=this.a=null}L.prototype.add=function(t,e){var n=M.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},F.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},F.prototype.reset=function(){this.next=this.b=this.a=null};var U=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},j=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 q=Array.prototype.filter?function(t,e){return Array.prototype.filter.call(t,e,void 0)}:function(t,e){for(var n,r=t.length,i=[],o=0,s="string"==typeof t?t.split(""):t,a=0;a<r;a++)a in s&&(n=s[a],e.call(void 0,n,a,t)&&(i[o++]=n));return i},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},B=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 K(t,e){return 0<=U(t,e)}function W(t,e){var n;return(n=0<=(e=U(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 G(){return Array.prototype.concat.apply([],arguments)}function z(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 Q,Y=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},X=/&/g,J=/</g,$=/>/g,Z=/"/g,tt=/'/g,et=/\x00/g,nt=/[\x00&<>"']/;function rt(t,e){return-1!=t.indexOf(e)}function it(t,e){return t<e?-1:e<t?1:0}t:{var ot=l.navigator;if(ot){ot=ot.userAgent;if(ot){Q=ot;break t}}Q=""}function st(t){return rt(Q,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){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<ht.length;i++)e=ht[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function ft(t,e){t:{try{var n=t&&t.ownerDocument,n=n&&(n.defaultView||n.parentWindow);if((n=n||l).Element&&n.Location){var r=n;break t}}catch(t){}r=null}if(r&&void 0!==r[e]&&(!t||!(t instanceof r[e])&&(t instanceof r.Location||t instanceof r.Element))){if(g(t))try{var i=t.constructor.displayName||t.constructor.name||Object.prototype.toString.call(t)}catch(t){i="<object could not be stringified>"}else i=void 0===t?"undefined":null===t?"null":typeof t;O("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,i)}}function pt(t,e){this.a=t===yt&&e||"",this.b=gt}function dt(t){return t instanceof pt&&t.constructor===pt&&t.b===gt?t.a:(O("expected object of type Const, got '"+t+"'"),"type_error:Const")}pt.prototype.sa=!0,pt.prototype.ra=function(){return this.a},pt.prototype.toString=function(){return"Const{"+this.a+"}"};var vt,gt={},yt={};function mt(){if(void 0===vt){var t=null,e=l.trustedTypes;if(e&&e.createPolicy){try{t=e.createPolicy("goog#html",{createHTML:_,createScript:_,createScriptURL:_})}catch(t){l.console&&l.console.error(t.message)}vt=t}else vt=t}return vt}function bt(t,e){this.a=e===Et?t:""}function wt(t){return t instanceof bt&&t.constructor===bt?t.a:(O("expected object of type TrustedResourceUrl, got '"+t+"' of type "+p(t)),"type_error:TrustedResourceUrl")}function _t(t,n){var e,r=dt(t);if(!Tt.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(It,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))}),e=t,t=mt(),new bt(e=t?t.createScriptURL(e):e,Et)}bt.prototype.sa=!0,bt.prototype.ra=function(){return this.a.toString()},bt.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var It=/%{(\w+)}/g,Tt=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,Et={};function St(t,e){this.a=e===Ot?t:""}function Ct(t){return t instanceof St&&t.constructor===St?t.a:(O("expected object of type SafeUrl, got '"+t+"' of type "+p(t)),"type_error:SafeUrl")}St.prototype.sa=!0,St.prototype.ra=function(){return this.a.toString()},St.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Nt=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font\/\w+|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,At=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,kt=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function Rt(t){return t instanceof St?t:(t="object"==typeof t&&t.sa?t.ra():String(t),t=kt.test(t)||(e=(t=(t=String(t)).replace(/(%0A|%0D)/g,"")).match(At))&&Nt.test(e[1])?new St(t,Ot):null);var e}function Pt(t){return t instanceof St?t:(t="object"==typeof t&&t.sa?t.ra():String(t),new St(t=!kt.test(t)?"about:invalid#zClosurez":t,Ot))}var Ot={},Dt=new St("about:invalid#zClosurez",Ot);function xt(t,e,n){this.a=n===Lt?t:""}xt.prototype.sa=!0,xt.prototype.ra=function(){return this.a.toString()},xt.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Lt={};function Mt(t,e,n,r){return t=t instanceof St?t:Pt(t),e=e||l,n=n instanceof pt?dt(n):n||"",e.open(Ct(t),n,r,void 0)}function Ft(t){for(var e=t.split("%s"),n="",r=Array.prototype.slice.call(arguments,1);r.length&&1<e.length;)n+=e.shift()+r.shift();return n+e.join("%s")}function Ut(t){return nt.test(t)&&(-1!=(t=-1!=(t=-1!=(t=-1!=(t=-1!=(t=-1!=t.indexOf("&")?t.replace(X,"&"):t).indexOf("<")?t.replace(J,"<"):t).indexOf(">")?t.replace($,">"):t).indexOf('"')?t.replace(Z,"""):t).indexOf("'")?t.replace(tt,"'"):t).indexOf("\0")&&(t=t.replace(et,"�"))),t}function jt(t){return jt[" "](t),t}jt[" "]=s;var qt,Vt=st("Opera"),Bt=st("Trident")||st("MSIE"),Kt=st("Edge"),Wt=Kt||Bt,Ht=st("Gecko")&&!(rt(Q.toLowerCase(),"webkit")&&!st("Edge"))&&!(st("Trident")||st("MSIE"))&&!st("Edge"),Gt=rt(Q.toLowerCase(),"webkit")&&!st("Edge");function zt(){var t=l.document;return t?t.documentMode:void 0}t:{var Qt="",Yt=(Yt=Q,Ht?/rv:([^\);]+)(\)|;)/.exec(Yt):Kt?/Edge\/([\d\.]+)/.exec(Yt):Bt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Yt):Gt?/WebKit\/(\S+)/.exec(Yt):Vt?/(?:Version)[ \/]?(\S+)/.exec(Yt):void 0);if(Yt&&(Qt=Yt?Yt[1]:""),Bt){Yt=zt();if(null!=Yt&&Yt>parseFloat(Qt)){qt=String(Yt);break t}}qt=Qt}var Xt={};function Jt(a){return t=a,e=function(){for(var t=0,e=Y(String(qt)).split("."),n=Y(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++)for(var o=e[i]||"",s=n[i]||"";o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],(0!=o[0].length||0!=s[0].length)&&(t=it(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||it(0==o[2].length,0==s[2].length)||it(o[2],s[2]),o=o[3],s=s[3],0==t););return 0<=t},n=Xt,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}var $t=l.document&&Bt&&(zt()||parseInt(qt,10))||void 0;try{new self.OffscreenCanvas(0,0).getContext("2d")}catch(t){}var Zt=!Bt||9<=Number($t);function te(t){var e=document;return"string"==typeof t?e.getElementById(t):t}function ee(n,t){at(t,function(t,e){t&&"object"==typeof t&&t.sa&&(t=t.ra()),"style"==e?n.style.cssText=t:"class"==e?n.className=t:"for"==e?n.htmlFor=t:ie.hasOwnProperty(e)?n.setAttribute(ie[e],t):0==e.lastIndexOf("aria-",0)||0==e.lastIndexOf("data-",0)?n.setAttribute(e,t):n[e]=t})}var ne,re,ie={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 oe(){var t,e=arguments,n=document,r=String(e[0]),i=e[1];return!Zt&&i&&(i.name||i.type)&&(r=["<",r],i.name&&r.push(' name="',Ut(i.name),'"'),i.type&&(r.push(' type="',Ut(i.type),'"'),lt(t={},i),delete t.type,i=t),r.push(">"),r=r.join("")),r=se(n,r),i&&("string"==typeof i?r.className=i:Array.isArray(i)?r.className=i.join(" "):ee(r,i)),2<e.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];if(!d(o)||g(o)&&0<o.nodeType)r(o);else{t:{if(o&&"number"==typeof o.length){if(g(o)){var s="function"==typeof o.item||"string"==typeof o.item;break t}if(v(o)){s="function"==typeof o.item;break t}}s=!1}j(s?z(o):o,r)}}}(n,r,e),r}function se(t,e){return e=String(e),"application/xhtml+xml"===t.contentType&&(e=e.toLowerCase()),t.createElement(e)}function ae(t){l.setTimeout(function(){throw t},0)}function ue(t,e){re||function(){{var t;re=l.Promise&&l.Promise.resolve?(t=l.Promise.resolve(void 0),function(){t.then(le)}):function(){var t=le;!v(l.setImmediate)||l.Window&&l.Window.prototype&&!st("Edge")&&l.Window.prototype.setImmediate==l.setImmediate?(ne=ne||function(){var t=l.MessageChannel;if(void 0===(t=void 0===t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!st("Presto")?function(){var t=se(document,"IFRAME");t.style.display="none",document.documentElement.appendChild(t);var e=t.contentWindow;(t=e.document).open(),t.close();var n="callImmediate"+Math.random(),r="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host;t=m(function(t){"*"!=r&&t.origin!=r||t.data!=n||this.port1.onmessage()},this),e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,r)}}}:t)||st("Trident")||st("MSIE"))return function(t){l.setTimeout(t,0)};var e=new t,n={},r=n;return e.port1.onmessage=function(){var t;void 0!==n.next&&(t=(n=n.next).Gb,n.Gb=null,t())},function(t){r.next={Gb:t},r=r.next,e.port2.postMessage(0)}}())(t):l.setImmediate(t)}}}(),ce||(re(),ce=!0),he.add(t,e)}var ce=!1,he=new L;function le(){for(var t,e,n;n=e=void 0,n=null,(e=he).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){ae(t)}x(M,t)}ce=!1}function fe(t,e){if(this.a=pe,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,t!=s)try{var n=this;t.call(e,function(t){Se(n,de,t)},function(t){if(!(t instanceof Oe))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(t){}Se(n,ve,t)})}catch(t){Se(this,ve,t)}}var pe=0,de=2,ve=3;function ge(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}ge.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var ye=new D(function(){return new ge},function(t){t.reset()});function me(t,e,n){var r=ye.get();return r.g=t,r.b=e,r.f=n,r}function be(t){if(t instanceof fe)return t;var e=new fe(s);return Se(e,de,t),e}function we(n){return new fe(function(t,e){e(n)})}function _e(t,e,n){Ce(t,e,n,null)||ue(b(e,t))}function Ie(n){return new fe(function(r){var i=n.length,o=[];if(i)for(var t=function(t,e,n){i--,o[t]=e?{Pb:!0,value:n}:{Pb:!1,reason:n},0==i&&r(o)},e=0;e<n.length;e++)_e(n[e],b(t,e,!0),b(t,e,!1));else r(o)})}function Te(t,e){t.b||t.a!=de&&t.a!=ve||Ne(t),t.f?t.f.next=e:t.b=e,t.f=e}function Ee(t,i,o,s){var e=me(null,null,null);return e.a=new fe(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 Oe?r(t):n(e)}catch(t){r(t)}}:r}),Te(e.a.c=t,e),e.a}function Se(t,e,n){var r,i;t.a==pe&&(t===n&&(e=ve,n=new TypeError("Promise cannot resolve to itself")),t.a=1,Ce(n,t.$c,t.ad,t)||(t.i=n,t.a=e,t.c=null,Ne(t),e!=ve||n instanceof Oe||(i=n,(r=t).g=!0,ue(function(){r.g&&Pe.call(null,i)}))))}function Ce(t,e,n,r){if(t instanceof fe)return Te(t,me(e||s,n||null,r)),1;if(k(t))return t.then(e,n,r),1;if(g(t))try{var i=t.then;if(v(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 Ne(t){t.h||(t.h=!0,ue(t.gc,t))}function Ae(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.f=null),e}function ke(t,e,n,r){if(n==ve&&e.b&&!e.c)for(;t&&t.g;t=t.c)t.g=!1;if(e.a)e.a.c=null,Re(e,n,r);else try{e.c?e.g.call(e.f):Re(e,n,r)}catch(t){Pe.call(null,t)}x(ye,e)}function Re(t,e,n){e==de?t.g.call(t.f,n):t.b&&t.b.call(t.f,n)}fe.prototype.then=function(t,e,n){return Ee(this,v(t)?t:null,v(e)?e:null,n)},fe.prototype.$goog_Thenable=!0,(t=fe.prototype).oa=function(t,e){return(t=me(t,t,e)).c=!0,Te(this,t),this},t.o=function(t,e){return Ee(this,null,t,e)},t.cancel=function(t){var e;this.a==pe&&(e=new Oe(t),ue(function(){!function t(e,n){if(e.a==pe)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++,!((o=a.a==e?a:o)&&1<i)));a=a.next)o||(s=a);o&&(r.a==pe&&1==i?t(r,n):(s?((i=s).next==r.f&&(r.f=i),i.next=i.next.next):Ae(r),ke(r,o,ve,n)))}e.c=null}else Se(e,ve,n)}(this,e)},this))},t.$c=function(t){this.a=pe,Se(this,de,t)},t.ad=function(t){this.a=pe,Se(this,ve,t)},t.gc=function(){for(var t;t=Ae(this);)ke(this,t,this.a,this.i);this.h=!1};var Pe=ae;function Oe(t){R.call(this,t)}function De(){this.xa=this.xa,this.pa=this.pa}w(Oe,R);var xe=0;function Le(t){t.xa||(t.xa=!0,t.Da(),0==xe)||(t=t,Object.prototype.hasOwnProperty.call(t,n)&&t[n]||(t[n]=++r))}De.prototype.xa=!(Oe.prototype.name="cancel"),De.prototype.Da=function(){if(this.pa)for(;this.pa.length;)this.pa.shift()()};var Me=Object.freeze||function(t){return t},Fe=!Bt||9<=Number($t),Ue=Bt&&!Jt("9"),je=function(){if(!l.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{l.addEventListener("test",s,e),l.removeEventListener("test",s,e)}catch(t){}return t}();function qe(t,e){this.type=t,this.b=this.target=e,this.defaultPrevented=!1}function Ve(t,e){if(qe.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(Ht){t:{try{jt(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:Be[t.pointerType]||"",(this.a=t).defaultPrevented&&this.preventDefault()}}qe.prototype.preventDefault=function(){this.defaultPrevented=!0},w(Ve,qe);var Be=Me({2:"touch",3:"pen",4:"mouse"});Ve.prototype.preventDefault=function(){Ve.ab.preventDefault.call(this);var t=this.a;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,Ue)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}},Ve.prototype.g=function(){return this.a};var Ke="closure_listenable_"+(1e6*Math.random()|0),We=0;function He(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.Va=i,this.key=++We,this.va=this.Pa=!1}function Ge(t){t.va=!0,t.listener=null,t.proxy=null,t.src=null,t.Va=null}function ze(t){this.src=t,this.a={},this.b=0}function Qe(t,e){var n=e.type;n in t.a&&W(t.a[n],e)&&(Ge(e),0==t.a[n].length&&(delete t.a[n],t.b--))}function Ye(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.va&&o.listener==e&&o.capture==!!n&&o.Va==r)return i}return-1}ze.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=Ye(t,e,r,i);return-1<s?(e=t[s],n||(e.Pa=!1)):((e=new He(e,this.src,o,!!r,i)).Pa=n,t.push(e)),e};var Xe="closure_lm_"+(1e6*Math.random()|0),Je={};function $e(t,e,n,r,i){if(r&&r.once)tn(t,e,n,r,i);else if(Array.isArray(e))for(var o=0;o<e.length;o++)$e(t,e[o],n,r,i);else n=hn(n),t&&t[Ke]?fn(t,e,n,g(r)?!!r.capture:!!r,i):Ze(t,e,n,!1,r,i)}function Ze(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s,a,u=g(i)?!!i.capture:!!i,c=un(t);if(c||(t[Xe]=c=new ze(t)),!(n=c.add(e,n,r,u,o)).proxy)if(s=an,r=a=Fe?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)void 0===(i=!je?u:i)&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(rn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}}function tn(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)tn(t,e[o],n,r,i);else n=hn(n),t&&t[Ke]?pn(t,e,n,g(r)?!!r.capture:!!r,i):Ze(t,e,n,!0,r,i)}function en(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)en(t,e[o],n,r,i);else r=g(r)?!!r.capture:!!r,n=hn(n),t&&t[Ke]?(t=t.v,(e=String(e).toString())in t.a&&(-1<(n=Ye(o=t.a[e],n,r,i))&&(Ge(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete t.a[e],t.b--)))):(t=t&&un(t))&&(e=t.a[e.toString()],(n=(t=-1)<(t=e?Ye(e,n,r,i):t)?e[t]:null)&&nn(n))}function nn(t){var e,n,r;"number"!=typeof t&&t&&!t.va&&((e=t.src)&&e[Ke]?Qe(e.v,t):(n=t.type,r=t.proxy,e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(rn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=un(e))?(Qe(n,t),0==n.b&&(n.src=null,e[Xe]=null)):Ge(t)))}function rn(t){return t in Je?Je[t]:Je[t]="on"+t}function on(t,e,n,r){var i=!0;if((t=un(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.va&&(o=sn(o,r),i=i&&!1!==o)}return i}function sn(t,e){var n=t.listener,r=t.Va||t.src;return t.Pa&&nn(t),n.call(r,e)}function an(t,e){if(t.va)return!0;if(Fe)return sn(t,new Ve(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 Ve(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=on(r[i],t,!0,e),n=n&&o}for(i=0;i<r.length;i++)e.b=r[i],o=on(r[i],t,!1,e),n=n&&o}return n}function un(t){return(t=t[Xe])instanceof ze?t:null}var cn="__closure_events_fn_"+(1e9*Math.random()>>>0);function hn(e){return v(e)?e:(e[cn]||(e[cn]=function(t){return e.handleEvent(t)}),e[cn])}function ln(){De.call(this),this.v=new ze(this),(this.ac=this).gb=null}function fn(t,e,n,r,i){t.v.add(String(e),n,!1,r,i)}function pn(t,e,n,r,i){t.v.add(String(e),n,!0,r,i)}function dn(t,e,n,r){if(!(e=t.v.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var s,a,u=e[o];u&&!u.va&&u.capture==n&&(s=u.listener,a=u.Va||u.src,u.Pa&&Qe(t.v,u),i=!1!==s.call(a,r)&&i)}return i&&!r.defaultPrevented}function vn(t,e,n){if(v(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 gn(n){var r=null;return new fe(function(t,e){-1==(r=vn(function(){t(void 0)},n))&&e(Error("Failed to schedule timer."))}).o(function(t){throw l.clearTimeout(r),t})}function yn(t){if(t.W&&"function"==typeof t.W)return t.W();if("string"==typeof t)return t.split("");if(d(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 mn(t){if(t.Y&&"function"==typeof t.Y)return t.Y();if(!t.W||"function"!=typeof t.W){if(d(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 bn(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 bn)for(n=t.Y(),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 wn(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];_n(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){for(var i={},n=e=0;e<t.a.length;)_n(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function _n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}w(ln,De),ln.prototype[Ke]=!0,ln.prototype.addEventListener=function(t,e,n,r){$e(this,t,e,n,r)},ln.prototype.removeEventListener=function(t,e,n,r){en(this,t,e,n,r)},ln.prototype.dispatchEvent=function(t){var e;if(n=this.gb)for(e=[];n;n=n.gb)e.push(n);var n=this.ac,r=t.type||t;if("string"==typeof t?t=new qe(t,n):t instanceof qe?t.target=t.target||n:(s=t,lt(t=new qe(r,n),s)),s=!0,e)for(var i=e.length-1;0<=i;i--)var o=t.b=e[i],s=dn(o,r,!0,t)&&s;if(s=dn(o=t.b=n,r,!0,t)&&s,s=dn(o,r,!1,t)&&s,e)for(i=0;i<e.length;i++)s=dn(o=t.b=e[i],r,!1,t)&&s;return s},ln.prototype.Da=function(){if(ln.ab.Da.call(this),this.v){var t,e=this.v;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)Ge(n[r]);delete e.a[t],e.b--}}this.gb=null},(t=bn.prototype).W=function(){wn(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},t.Y=function(){return wn(this),this.a.concat()},t.clear=function(){this.b={},this.c=this.a.length=0},t.get=function(t,e){return _n(this.b,t)?this.b[t]:e},t.set=function(t,e){_n(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},t.forEach=function(t,e){for(var n=this.Y(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var In=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Tn(t,e){var n;this.a=this.l=this.c="",this.g=null,this.h=this.f="",this.i=!1,t instanceof Tn?(this.i=void 0!==e?e:t.i,En(this,t.c),this.l=t.l,this.a=t.a,Sn(this,t.g),this.f=t.f,Cn(this,Hn(t.b)),this.h=t.h):t&&(n=String(t).match(In))?(this.i=!!e,En(this,n[1]||"",!0),this.l=Pn(n[2]||""),this.a=Pn(n[3]||"",!0),Sn(this,n[4]),this.f=Pn(n[5]||"",!0),Cn(this,n[6]||"",!0),this.h=Pn(n[7]||"")):(this.i=!!e,this.b=new jn(null,this.i))}function En(t,e,n){t.c=n?Pn(e,!0):e,t.c&&(t.c=t.c.replace(/:$/,""))}function Sn(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.g=e}else t.g=null}function Cn(t,e,n){var r,i;e instanceof jn?(t.b=e,r=t.b,(i=t.i)&&!r.f&&(qn(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Bn(this,e),Wn(this,n,t))},r)),r.f=i):(n||(e=On(e,Fn)),t.b=new jn(e,t.i))}function Nn(t,e,n){t.b.set(e,n)}function An(t,e){return t.b.get(e)}function kn(t){return t instanceof Tn?new Tn(t):new Tn(t,void 0)}function Rn(t,e,n,r){var i=new Tn(null,void 0);return t&&En(i,t),e&&(i.a=e),n&&Sn(i,n),r&&(i.f=r),i}function Pn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function On(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Dn),t=n?t.replace(/%25([0-9a-fA-F]{2})/g,"%$1"):t):null}function Dn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Tn.prototype.toString=function(){var t=[],e=this.c;e&&t.push(On(e,xn,!0),":");var n=this.a;return!n&&"file"!=e||(t.push("//"),(e=this.l)&&t.push(On(e,xn,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.g)&&t.push(":",String(n))),(n=this.f)&&(this.a&&"/"!=n.charAt(0)&&t.push("/"),t.push(On(n,"/"==n.charAt(0)?Mn:Ln,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.h)&&t.push("#",On(n,Un)),t.join("")},Tn.prototype.resolve=function(t){var e=new Tn(this),n=!!t.c;n?En(e,t.c):n=!!t.l,n?e.l=t.l:n=!!t.a,n?e.a=t.a:n=null!=t.g;var r=t.f;if(n)Sn(e,t.g);else if(n=!!t.f)if("/"!=r.charAt(0)&&(this.a&&!this.f?r="/"+r:-1!=(i=e.f.lastIndexOf("/"))&&(r=e.f.substr(0,i+1)+r)),".."==(i=r)||"."==i)r="";else if(rt(i,"./")||rt(i,"/.")){for(var r=0==i.lastIndexOf("/",0),i=i.split("/"),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.f=r:n=""!==t.b.toString(),n?Cn(e,Hn(t.b)):n=!!t.h,n&&(e.h=t.h),e};var xn=/[#\/\?@]/g,Ln=/[#\?:]/g,Mn=/[#\?]/g,Fn=/[#\?@]/g,Un=/#/g;function jn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function qn(n){n.a||(n.a=new bn,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r,i=t[n].indexOf("="),o=null;0<=i?(r=t[n].substring(0,i),o=t[n].substring(i+1)):r=t[n],e(r,o?decodeURIComponent(o.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function Vn(t){var e=mn(t);if(void 0===e)throw Error("Keys are undefined");var n=new jn(null,void 0);t=yn(t);for(var r=0;r<e.length;r++){var i=e[r],o=t[r];Array.isArray(o)?Wn(n,i,o):n.add(i,o)}return n}function Bn(t,e){qn(t),e=Gn(t,e),_n(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,_n((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&wn(t)))}function Kn(t,e){return qn(t),e=Gn(t,e),_n(t.a.b,e)}function Wn(t,e,n){Bn(t,e),0<n.length&&(t.c=null,t.a.set(Gn(t,e),z(n)),t.b+=n.length)}function Hn(t){var e=new jn;return e.c=t.c,t.a&&(e.a=new bn(t.a),e.b=t.b),e}function Gn(t,e){return e=String(e),e=t.f?e.toLowerCase():e}function zn(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)&&(s=n[i],"function"!=typeof s&&(r.push(o),Jn(i,r),r.push(":"),t(e,s,r),o=","));return void r.push("}")}n=n.valueOf()}switch(typeof n){case"string":Jn(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 Qn,t,e),e.join("")}function Qn(){}(t=jn.prototype).add=function(t,e){qn(this),this.c=null,t=Gn(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){qn(this),this.a.forEach(function(t,e){j(t,function(t){n.call(r,t,e,this)},this)},this)},t.Y=function(){qn(this);for(var t=this.a.W(),e=this.a.Y(),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.W=function(t){qn(this);var e=[];if("string"==typeof t)Kn(this,t)&&(e=G(e,this.a.get(Gn(this,t))));else{t=this.a.W();for(var n=0;n<t.length;n++)e=G(e,t[n])}return e},t.set=function(t,e){return qn(this),this.c=null,Kn(this,t=Gn(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.W(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.Y(),n=0;n<e.length;n++)for(var r=e[n],i=encodeURIComponent(String(r)),r=this.W(r),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 Yn={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},Xn=/\uffff/.test("")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;function Jn(t,e){e.push('"',t.replace(Xn,function(t){var e=Yn[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),Yn[t]=e),e}),'"')}function $n(){var t=yr();return Bt&&$t&&11==$t||/Edge\/\d+/.test(t)}function Zn(){return l.window&&l.window.location.href||self&&self.location&&self.location.href||""}function tr(t,e){e=e||l.window;var n="about:blank";t&&(n=Ct(Rt(t)||Dt)),e.location.href=n}function er(t){return!!((t=(t||yr()).toLowerCase()).match(/android/)||t.match(/webos/)||t.match(/iphone|ipad|ipod/)||t.match(/blackberry/)||t.match(/windows phone/)||t.match(/iemobile/))}function nr(t){t=t||l.window;try{t.close()}catch(t){}}function rr(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=yr().toLowerCase(),r&&(e.target=r,rt(n,"crios/")&&(e.target="_blank")),dr(yr())==fr&&(t=t||"http://localhost",e.scrollbars=!0),n=t||"",(t=e)||(t={}),r=window,e=n instanceof St?n:Rt(void 0!==n.href?n.href:String(n))||Dt,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=se(document,"A"),"HTMLAnchorElement"),e=e instanceof St?e:Pt(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=Mt("",r,n,s),t=Ct(e),s&&(Wt&&rt(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),s.opener=null,t='<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+Ut(t)+'">',t=new xt(t=(r=mt())?r.createHTML(t):t,0,Lt),r=s.document)&&(r.write((o=t)instanceof xt&&o.constructor===xt?o.a:(O("expected object of type SafeHtml, got '"+o+"' of type "+p(o)),"type_error:SafeHtml")),r.close())):(s=Mt(e,r,n,s))&&t.noopener&&(s.opener=null),s)try{s.focus()}catch(t){}return s}var ir=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,or=/^[^@]+@[^@]+$/;function sr(){var e=null;return new fe(function(t){"complete"==l.document.readyState?t():(e=function(){t()},tn(window,"load",e))}).o(function(t){throw en(window,"load",e),t})}function ar(t){return t=t||yr(),!("file:"!==Ir()&&"ionic:"!==Ir()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function ur(){var t=l.window;try{return t&&t!=t.top}catch(t){return}}function cr(){return void 0!==l.WorkerGlobalScope&&"function"==typeof l.importScripts}function hr(){return Xl.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":Xl.INTERNAL.hasOwnProperty("node")?"Node":cr()?"Worker":"Browser"}function lr(){var t=hr();return"ReactNative"===t||"Node"===t}var fr="Firefox",pr="Chrome";function dr(t){var e=t.toLowerCase();return rt(e,"opera/")||rt(e,"opr/")||rt(e,"opios/")?"Opera":rt(e,"iemobile")?"IEMobile":rt(e,"msie")||rt(e,"trident/")?"IE":rt(e,"edge/")?"Edge":rt(e,"firefox/")?fr:rt(e,"silk/")?"Silk":rt(e,"blackberry")?"Blackberry":rt(e,"webos")?"Webos":!rt(e,"safari/")||rt(e,"chrome/")||rt(e,"crios/")||rt(e,"android")?!rt(e,"chrome/")&&!rt(e,"crios/")||rt(e,"edge/")?rt(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":pr:"Safari"}var vr={md:"FirebaseCore-web",od:"FirebaseUI-web"};function gr(t,e){e=e||[];var n,r=[],i={};for(n in vr)i[vr[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=hr())?r=dr(i=yr()):"Worker"===r&&(r=dr(i=yr())+"-"+r),r+"/JsCore/"+t+"/"+e.join(",")}function yr(){return l.navigator&&l.navigator.userAgent||""}function mr(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 e=n!=t.length?void 0:e}function br(){try{var t=l.localStorage,e=Nr();if(t)return t.setItem(e,"1"),t.removeItem(e),!$n()||!!l.indexedDB}catch(t){return cr()&&!!l.indexedDB}return!1}function wr(){return(_r()||"chrome-extension:"===Ir()||ar())&&!lr()&&br()&&!cr()}function _r(){return"http:"===Ir()||"https:"===Ir()}function Ir(){return l.location&&l.location.protocol||null}function Tr(t){return!er(t=t||yr())&&dr(t)!=fr}function Er(t){return void 0===t?null:zn(t)}function Sr(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 Cr(t){if(null!==t)return JSON.parse(t)}function Nr(t){return t||Math.floor(1e9*Math.random()).toString()}function Ar(t){return"Safari"!=dr(t=t||yr())&&!t.toLowerCase().match(/iphone|ipad|ipod/)}function kr(){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 Rr(t,e){if(e<t)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=yr(),e=hr(),this.b=er(t)||"ReactNative"===e}function Pr(){var t=l.document;return!t||void 0===t.visibilityState||"visible"==t.visibilityState}function Or(){var e=l.document,n=null;return Pr()||!e?be():new fe(function(t){n=function(){Pr()&&(e.removeEventListener("visibilitychange",n,!1),t())},e.addEventListener("visibilitychange",n,!1)}).o(function(t){throw e.removeEventListener("visibilitychange",n,!1),t})}function Dr(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 xr(){return mr("fireauth.oauthhelper",l)||mr("fireauth.iframe",l)}Rr.prototype.get=function(){var t=l.navigator;return!t||"boolean"!=typeof t.onLine||!_r()&&"chrome-extension:"!==Ir()&&void 0===t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Lr,Mr={};function Fr(t){Mr[t]||(Mr[t]=!0,"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(t))}try{var Ur={};Object.defineProperty(Ur,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Ur,"abcd",{configurable:!0,enumerable:!0,value:2}),Lr=2==Ur.abcd}catch(t){Lr=!1}function jr(t,e,n){Lr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function qr(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&jr(t,n,e[n])}function Vr(t){var e={};return qr(e,t),e}function Br(t){var e=t;if("object"==typeof t&&null!=t)for(var n in e="length"in t?[]:{},t)jr(e,n,Br(t[n]));return e}function Kr(t){var e=t&&(t[Qr]?"phone":null);if(!(e&&t&&t[zr]))throw new I("internal-error","Internal assert: invalid MultiFactorInfo object");jr(this,"uid",t[zr]),jr(this,"displayName",t[Hr]||null);var n=null;jr(this,"enrollmentTime",n=t[Gr]?new Date(t[Gr]).toUTCString():n),jr(this,"factorId",e)}function Wr(t){try{var e=new Yr(t)}catch(t){e=null}return e}Kr.prototype.w=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};var Hr="displayName",Gr="enrolledAt",zr="mfaEnrollmentId",Qr="phoneInfo";function Yr(t){Kr.call(this,t),jr(this,"phoneNumber",t[Qr])}function Xr(t){var e={},n=t[ti],r=t[ni],i=t[ri];if(t=Wr(t[ei]),!i||i!=$r&&i!=Zr&&!n||i==Zr&&!r||i==Jr&&!t)throw Error("Invalid checkActionCode response!");i==Zr?(e[oi]=n||null,e[ai]=n||null,e[ii]=r):(e[oi]=r||null,e[ai]=r||null,e[ii]=n||null),e[si]=t||null,jr(this,ci,i),jr(this,ui,Br(e))}w(Yr,Kr),Yr.prototype.w=function(){var t=Yr.ab.w.call(this);return t.phoneNumber=this.phoneNumber,t};var Jr="REVERT_SECOND_FACTOR_ADDITION",$r="EMAIL_SIGNIN",Zr="VERIFY_AND_CHANGE_EMAIL",ti="email",ei="mfaInfo",ni="newEmail",ri="requestType",ii="email",oi="fromEmail",si="multiFactorInfo",ai="previousEmail",ui="data",ci="operation";function hi(t){var e=An(t=kn(t),li)||null,n=An(t,fi)||null,r=(r=An(t,vi)||null)&&yi[r]||null;if(!e||!n||!r)throw new I("argument-error",li+", "+fi+"and "+vi+" are required in a valid action code URL.");qr(this,{apiKey:e,operation:r,code:n,continueUrl:An(t,pi)||null,languageCode:An(t,di)||null,tenantId:An(t,gi)||null})}var li="apiKey",fi="oobCode",pi="continueUrl",di="languageCode",vi="mode",gi="tenantId",yi={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:Jr,signIn:$r,verifyAndChangeEmail:Zr,verifyEmail:"VERIFY_EMAIL"};function mi(t){try{return new hi(t)}catch(t){return null}}function bi(t){if(void 0===(e=t[Ei]))throw new I("missing-continue-uri");if("string"!=typeof e||"string"==typeof e&&!e.length)throw new I("invalid-continue-uri");if(this.h=e,this.b=this.a=null,this.g=!1,(r=t[wi])&&"object"==typeof r){var e=r[Ni],n=r[Si],r=r[Ci];if("string"==typeof e&&e.length){if(this.a=e,void 0!==n&&"boolean"!=typeof n)throw new I("argument-error",Si+" property must be a boolean when specified.");if(this.g=!!n,void 0!==r&&("string"!=typeof r||"string"==typeof r&&!r.length))throw new I("argument-error",Ci+" property must be a non empty string when specified.");this.b=r||null}else{if(void 0!==e)throw new I("argument-error",Ni+" property must be a non empty string when specified.");if(void 0!==n||void 0!==r)throw new I("missing-android-pkg-name")}}else if(void 0!==r)throw new I("argument-error",wi+" property must be a non null object when specified.");if(this.f=null,(e=t[Ti])&&"object"==typeof e){if("string"==typeof(e=e[Ai])&&e.length)this.f=e;else if(void 0!==e)throw new I("argument-error",Ai+" property must be a non empty string when specified.")}else if(void 0!==e)throw new I("argument-error",Ti+" property must be a non null object when specified.");if(void 0!==(e=t[Ii])&&"boolean"!=typeof e)throw new I("argument-error",Ii+" property must be a boolean when specified.");if(this.c=!!e,void 0!==(t=t[_i])&&("string"!=typeof t||"string"==typeof t&&!t.length))throw new I("argument-error",_i+" property must be a non empty string when specified.");this.i=t||null}var wi="android",_i="dynamicLinkDomain",Ii="handleCodeInApp",Ti="iOS",Ei="url",Si="installApp",Ci="minimumVersion",Ni="packageName",Ai="bundleId";function ki(t){var e,n={};for(e in n.continueUrl=t.h,n.canHandleCodeInApp=t.c,(n.androidPackageName=t.a)&&(n.androidMinimumVersion=t.b,n.androidInstallApp=t.g),n.iOSBundleId=t.f,n.dynamicLinkDomain=t.i,n)null===n[e]&&delete n[e];return n}var Ri=null;function Pi(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.push(t)}),e}function Oi(t){var e=xi(t);if(!(e&&e.sub&&e.iss&&e.aud&&e.exp))throw Error("Invalid JWT");this.h=t,this.a=e.exp,this.i=e.sub,t=Date.now()/1e3,this.g=e.iat||(t>this.a?this.a:t),this.b=e.provider_id||e.firebase&&e.firebase.sign_in_provider||null,this.f=e.firebase&&e.firebase.tenant||null,this.c=!!e.is_anonymous||"anonymous"==this.b}function Di(t){try{return new Oi(t)}catch(t){return null}}function xi(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{var r=Pi(t);for(t=[],n=e=0;e<r.length;){var i,o,s,a=r[e++];a<128?t[n++]=String.fromCharCode(a):191<a&&a<224?(i=r[e++],t[n++]=String.fromCharCode((31&a)<<6|63&i)):239<a&&a<365?(s=((7&a)<<18|(63&(i=r[e++]))<<12|(63&(o=r[e++]))<<6|63&r[e++])-65536,t[n++]=String.fromCharCode(55296+(s>>10)),t[n++]=String.fromCharCode(56320+(1023&s))):(i=r[e++],o=r[e++],t[n++]=String.fromCharCode((15&a)<<12|(63&i)<<6|63&o))}return JSON.parse(t.join(""))}catch(t){}return null}Oi.prototype.T=function(){return this.f},Oi.prototype.l=function(){return this.c},Oi.prototype.toString=function(){return this.h};var Li="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),Mi=["client_id","response_type","scope","redirect_uri","state"],Fi={nd:{Ja:"locale",ua:700,ta:600,fa:"facebook.com",Xa:Mi},pd:{Ja:null,ua:500,ta:750,fa:"github.com",Xa:Mi},qd:{Ja:"hl",ua:515,ta:680,fa:"google.com",Xa:Mi},wd:{Ja:"lang",ua:485,ta:705,fa:"twitter.com",Xa:Li},kd:{Ja:"locale",ua:640,ta:600,fa:"apple.com",Xa:[]}};function Ui(t){for(var e in Fi)if(Fi[e].fa==t)return Fi[e];return null}function ji(t){var e={};e["facebook.com"]=Wi,e["google.com"]=Gi,e["github.com"]=Hi,e["twitter.com"]=zi;var n=t&&t[Vi];try{if(n)return new(e[n]||Ki)(t);if(void 0!==t[qi])return new Bi(t)}catch(t){}return null}var qi="idToken",Vi="providerId";function Bi(t){var e,n=t[Vi];if(n||!t[qi]||(e=Di(t[qi]))&&e.b&&(n=e.b),!n)throw Error("Invalid additional user info!");"anonymous"!=n&&"custom"!=n||(n=null),e=!1,void 0!==t.isNewUser?e=!!t.isNewUser:"identitytoolkit#SignupNewUserResponse"===t.kind&&(e=!0),jr(this,"providerId",n),jr(this,"isNewUser",e)}function Ki(t){Bi.call(this,t),jr(this,"profile",Br((t=Cr(t.rawUserInfo||"{}"))||{}))}function Wi(t){if(Ki.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function Hi(t){if(Ki.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");jr(this,"username",this.profile&&this.profile.login||null)}function Gi(t){if(Ki.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function zi(t){if(Ki.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");jr(this,"username",t.screenName||null)}function Qi(t){var e=An(r=kn(t),"link"),n=An(kn(e),"link"),r=An(r,"deep_link_id");return An(kn(r),"link")||r||n||e||t}function Yi(t,e){if(!t&&!e)throw new I("internal-error","Internal assert: no raw session string available");if(t&&e)throw new I("internal-error","Internal assert: unable to determine the session type");this.a=t||null,this.b=e||null,this.type=this.a?Xi:Ji}w(Ki,Bi),w(Wi,Ki),w(Hi,Ki),w(Gi,Ki),w(zi,Ki);var Xi="enroll",Ji="signin";function $i(){}function Zi(t,n){return t.then(function(t){if(t[Bs]){var e=Di(t[Bs]);if(!e||n!=e.i)throw new I("user-mismatch");return t}throw new I("user-mismatch")}).o(function(t){throw t&&t.code&&t.code==S+"user-not-found"?new I("user-mismatch"):t})}function to(t,e){if(!e)throw new I("internal-error","failed to construct a credential");this.a=e,jr(this,"providerId",t),jr(this,"signInMethod",t)}function eo(t){return{pendingToken:t.a,requestUri:"http://localhost"}}function no(t){if(t&&t.providerId&&t.signInMethod&&0==t.providerId.indexOf("saml.")&&t.pendingToken)try{return new to(t.providerId,t.pendingToken)}catch(t){}return null}function ro(t,e,n){if(this.a=null,e.idToken||e.accessToken)e.idToken&&jr(this,"idToken",e.idToken),e.accessToken&&jr(this,"accessToken",e.accessToken),e.nonce&&!e.pendingToken&&jr(this,"nonce",e.nonce),e.pendingToken&&(this.a=e.pendingToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new I("internal-error","failed to construct a credential");jr(this,"accessToken",e.oauthToken),jr(this,"secret",e.oauthTokenSecret)}jr(this,"providerId",t),jr(this,"signInMethod",n)}function io(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:Vn(e).toString(),requestUri:"http://localhost"},t.a&&(delete e.postBody,e.pendingToken=t.a),e}function oo(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 ro(t.providerId,e,t.signInMethod)}catch(t){}}return null}function so(t,e){this.Qc=e||[],qr(this,{providerId:t,isOAuthProvider:!0}),this.Ib={},this.pb=(Ui(t)||{}).Ja||null,this.ob=null}function ao(t){if("string"!=typeof t||0!=t.indexOf("saml."))throw new I("argument-error",'SAML provider IDs must be prefixed with "saml."');so.call(this,t,[])}function uo(t){so.call(this,t,Mi),this.a=[]}function co(){uo.call(this,"facebook.com")}function ho(t){if(!t)throw new I("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return g(t)&&(e=t.accessToken),(new co).credential({accessToken:e})}function lo(){uo.call(this,"github.com")}function fo(t){if(!t)throw new I("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return g(t)&&(e=t.accessToken),(new lo).credential({accessToken:e})}function po(){uo.call(this,"google.com"),this.Ca("profile")}function vo(t,e){var n=t;return g(t)&&(n=t.idToken,e=t.accessToken),(new po).credential({idToken:n,accessToken:e})}function go(){so.call(this,"twitter.com",Li)}function yo(t,e){var n=t;if(!(n=!g(n)?{oauthToken:t,oauthTokenSecret:e}:n).oauthToken||!n.oauthTokenSecret)throw new I("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new ro("twitter.com",n,"twitter.com")}function mo(t,e,n){this.a=t,this.f=e,jr(this,"providerId","password"),jr(this,"signInMethod",n===wo.EMAIL_LINK_SIGN_IN_METHOD?wo.EMAIL_LINK_SIGN_IN_METHOD:wo.EMAIL_PASSWORD_SIGN_IN_METHOD)}function bo(t){return t&&t.email&&t.password?new mo(t.email,t.password,t.signInMethod):null}function wo(){qr(this,{providerId:"password",isOAuthProvider:!1})}function _o(t,e){if(!(e=Io(e)))throw new I("argument-error","Invalid email link!");return new mo(t,e.code,wo.EMAIL_LINK_SIGN_IN_METHOD)}function Io(t){return(t=mi(t=Qi(t)))&&t.operation===$r?t:null}function To(t){if(!(t.eb&&t.cb||t.La&&t.ea))throw new I("internal-error");this.a=t,jr(this,"providerId","phone"),this.fa="phone",jr(this,"signInMethod","phone")}function Eo(e){if(e&&"phone"===e.providerId&&(e.verificationId&&e.verificationCode||e.temporaryProof&&e.phoneNumber)){var n={};return j(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(t){e[t]&&(n[t]=e[t])}),new To(n)}return null}function So(t){return t.a.La&&t.a.ea?{temporaryProof:t.a.La,phoneNumber:t.a.ea}:{sessionInfo:t.a.eb,code:t.a.cb}}function Co(t){try{this.a=t||Xl.auth()}catch(t){throw new I("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().")}qr(this,{providerId:"phone",isOAuthProvider:!1})}function No(t,e){if(!t)throw new I("missing-verification-id");if(!e)throw new I("missing-verification-code");return new To({eb:t,cb:e})}function Ao(t){if(t.temporaryProof&&t.phoneNumber)return new To({La:t.temporaryProof,ea: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 vo(o,n);case"facebook.com":return ho(n);case"github.com":return fo(n);case"twitter.com":return yo(n,r);default:return n||r||o||s?s?0==e.indexOf("saml.")?new to(e,s):new ro(e,{pendingToken:s,idToken:t.oauthIdToken,accessToken:t.oauthAccessToken},e):new uo(e).credential({idToken:o,accessToken:n,rawNonce:i}):null}}catch(t){return null}}function ko(t){if(!t.isOAuthProvider)throw new I("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 I("invalid-auth-event");if(this.g&&this.a)throw new I("invalid-auth-event");if(this.g&&!this.f)throw new I("invalid-auth-event")}function Po(t){return(t=t||{}).type?new Ro(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&T(t.error),t.postBody,t.tenantId):null}function Oo(){this.b=null,this.a=[]}Yi.prototype.Ha=function(){return this.a?be(this.a):be(this.b)},Yi.prototype.w=function(){return this.type==Xi?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}},$i.prototype.ka=function(){},$i.prototype.b=function(){},$i.prototype.c=function(){},$i.prototype.w=function(){},to.prototype.ka=function(t){return ha(t,eo(this))},to.prototype.b=function(t,e){var n=eo(this);return n.idToken=e,la(t,n)},to.prototype.c=function(t,e){return Zi(fa(t,eo(this)),e)},to.prototype.w=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}},ro.prototype.ka=function(t){return ha(t,io(this))},ro.prototype.b=function(t,e){var n=io(this);return n.idToken=e,la(t,n)},ro.prototype.c=function(t,e){return Zi(fa(t,io(this)),e)},ro.prototype.w=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},so.prototype.Ka=function(t){return this.Ib=ct(t),this},w(ao,so),w(uo,so),uo.prototype.Ca=function(t){return K(this.a,t)||this.a.push(t),this},uo.prototype.Qb=function(){return z(this.a)},uo.prototype.credential=function(t,e){e=g(t)?{idToken:t.idToken||null,accessToken:t.accessToken||null,nonce:t.rawNonce||null}:{idToken:t||null,accessToken:e||null};if(!e.idToken&&!e.accessToken)throw new I("argument-error","credential failed: must provide the ID token and/or the access token.");return new ro(this.providerId,e,this.providerId)},w(co,uo),jr(co,"PROVIDER_ID","facebook.com"),jr(co,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),w(lo,uo),jr(lo,"PROVIDER_ID","github.com"),jr(lo,"GITHUB_SIGN_IN_METHOD","github.com"),w(po,uo),jr(po,"PROVIDER_ID","google.com"),jr(po,"GOOGLE_SIGN_IN_METHOD","google.com"),w(go,so),jr(go,"PROVIDER_ID","twitter.com"),jr(go,"TWITTER_SIGN_IN_METHOD","twitter.com"),mo.prototype.ka=function(t){return this.signInMethod==wo.EMAIL_LINK_SIGN_IN_METHOD?za(t,wa,{email:this.a,oobCode:this.f}):za(t,Ba,{email:this.a,password:this.f})},mo.prototype.b=function(t,e){return this.signInMethod==wo.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})},mo.prototype.c=function(t,e){return Zi(this.ka(t),e)},mo.prototype.w=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}},qr(wo,{PROVIDER_ID:"password"}),qr(wo,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),qr(wo,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),To.prototype.ka=function(t){return t.fb(So(this))},To.prototype.b=function(t,e){var n=So(this);return n.idToken=e,za(t,Wa,n)},To.prototype.c=function(t,e){var n=So(this);return n.operation="REAUTH",Zi(t=za(t,Ha,n),e)},To.prototype.w=function(){var t={providerId:"phone"};return this.a.eb&&(t.verificationId=this.a.eb),this.a.cb&&(t.verificationCode=this.a.cb),this.a.La&&(t.temporaryProof=this.a.La),this.a.ea&&(t.phoneNumber=this.a.ea),t},Co.prototype.fb=function(r,i){var o=this.a.a;return be(i.verify()).then(function(n){if("string"!=typeof n)throw new I("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");if("recaptcha"!==i.type)throw new I("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.');var t=g(r)?r.session:null,e=g(r)?r.phoneNumber:r,t=t&&t.type==Xi?t.Ha().then(function(t){return za(o,Ma,{idToken:t,phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:n}}).then(function(t){return t.phoneSessionInfo.sessionInfo})}):t&&t.type==Ji?t.Ha().then(function(t){return e=o,t={mfaPendingCredential:t,mfaEnrollmentId:r.multiFactorHint&&r.multiFactorHint.uid||r.multiFactorUid,phoneSignInInfo:{recaptchaToken:n}},za(e,Fa,t).then(function(t){return t.phoneResponseInfo.sessionInfo});var e}):za(o,Oa,{phoneNumber:e,recaptchaToken:n});return t.then(function(t){return"function"==typeof i.reset&&i.reset(),t},function(t){throw"function"==typeof i.reset&&i.reset(),t})})},qr(Co,{PROVIDER_ID:"phone"}),qr(Co,{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.T=function(){return this.h},Ro.prototype.w=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.w()}};var Do,xo=null;function Lo(t){var e="unauthorized-domain",n=void 0,r=kn(t);t=r.a,"chrome-extension"==(r=r.c)?n=Ft("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=Ft("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",I.call(this,e,n)}function Mo(t,e,n){I.call(this,t,n),(t=e||{}).Jb&&jr(this,"email",t.Jb),t.ea&&jr(this,"phoneNumber",t.ea),t.credential&&jr(this,"credential",t.credential),t.Zb&&jr(this,"tenantId",t.Zb)}function Fo(t){if(t.code){var e=t.code||"";0==e.indexOf(S)&&(e=e.substring(S.length));var n={credential:Ao(t),Zb:t.tenantId};if(t.email)n.Jb=t.email;else if(t.phoneNumber)n.ea=t.phoneNumber;else if(!n.credential)return new I(e,t.message||void 0);return new Mo(e,n,t.message)}return null}function Uo(){}function jo(t){return t.c||(t.c=t.b())}function qo(){}function Vo(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 Bo(){}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.qc,this),this.a.onerror=m(this.Sb,this),this.a.onprogress=m(this.rc,this),this.a.ontimeout=m(this.vc,this)}function Wo(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function Ho(t,e,n){this.reset(t,e,n,void 0,void 0)}function Go(t){this.f=t,this.b=this.c=this.a=null}function zo(t,e){this.name=t,this.value=e}w(Lo,I),w(Mo,I),Mo.prototype.w=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.w();return e&<(t,e),t},Mo.prototype.toJSON=function(){return this.w()},Uo.prototype.c=null,w(qo,Uo),qo.prototype.a=function(){var t=Vo(this);return t?new ActiveXObject(t):new XMLHttpRequest},qo.prototype.b=function(){var t={};return Vo(this)&&(t[0]=!0,t[1]=!0),t},Do=new qo,w(Bo,Uo),Bo.prototype.a=function(){var t=new XMLHttpRequest;if("withCredentials"in t)return t;if("undefined"!=typeof XDomainRequest)return new Ko;throw Error("Unsupported browser")},Bo.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.qc=function(){this.status=200,this.response=this.responseText=this.a.responseText,Wo(this,4)},t.Sb=function(){this.status=500,this.response=this.responseText="",Wo(this,4)},t.vc=function(){this.Sb()},t.rc=function(){this.status=200,Wo(this,1)},t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},Ho.prototype.a=null,Ho.prototype.reset=function(t,e,n,r,i){delete this.a},zo.prototype.toString=function(){return this.name};var Qo=new zo("SEVERE",1e3),Yo=new zo("WARNING",900),Xo=new zo("CONFIG",700),Jo=new zo("FINE",500);Go.prototype.log=function(t,e,n){if(t.value>=function t(e){return e.c||(e.a?t(e.a):(O("Root logger has no level set."),null))}(this).value)for(v(e)&&(e=e()),t=new Ho(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var $o,Zo={},ts=null;function es(t){var e,n,r;return ts||(ts=new Go(""),(Zo[""]=ts).c=Xo),(e=Zo[t])||(e=new Go(t),r=t.lastIndexOf("."),n=t.substr(r+1),(r=es(t.substr(0,r))).b||(r.b={}),(r.b[n]=e).a=r,Zo[t]=e),e}function ns(t,e){t&&t.log(Jo,e,void 0)}function rs(t){this.f=t}function is(t){ln.call(this),this.u=t,this.h=void 0,this.readyState=os,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.l=new Headers,this.b=null,this.s="GET",this.f="",this.a=!1,this.i=es("goog.net.FetchXmlHttp"),this.m=this.c=this.g=null}w(rs,Uo),rs.prototype.a=function(){return new is(this.f)},rs.prototype.b=($o={},function(){return $o}),w(is,ln);var os=0;function ss(t){t.c.read().then(t.pc.bind(t)).catch(t.Ua.bind(t))}function as(t){t.readyState=4,t.g=null,t.c=null,t.m=null,us(t)}function us(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function cs(t){ln.call(this),this.headers=new bn,this.D=t||null,this.c=!1,this.C=this.a=null,this.h=this.R=this.l="",this.f=this.O=this.i=this.J=!1,this.g=0,this.s=null,this.m=hs,this.u=this.S=!1}(t=is.prototype).open=function(t,e){if(this.readyState!=os)throw this.abort(),Error("Error reopening a connection");this.s=t,this.f=e,this.readyState=1,us(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.l,method:this.s,credentials:this.h,cache:void 0};t&&(e.body=t),this.u.fetch(new Request(this.f,e)).then(this.uc.bind(this),this.Ua.bind(this))},t.abort=function(){this.response=this.responseText="",this.l=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,as(this)),this.readyState=os},t.uc=function(t){this.a&&(this.g=t,this.b||(this.status=this.g.status,this.statusText=this.g.statusText,this.b=t.headers,this.readyState=2,us(this)),this.a&&(this.readyState=3,us(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.sc.bind(this),this.Ua.bind(this)):void 0!==l.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.m=new TextDecoder,ss(this)):t.text().then(this.tc.bind(this),this.Ua.bind(this)))))},t.pc=function(t){var e;this.a&&((e=this.m.decode(t.value||new Uint8Array(0),{stream:!t.done}))&&(this.response=this.responseText+=e),(t.done?as:us)(this),3==this.readyState&&ss(this))},t.tc=function(t){this.a&&(this.response=this.responseText=t,as(this))},t.sc=function(t){this.a&&(this.response=t,as(this))},t.Ua=function(t){var e=this.i;e&&e.log(Yo,"Failed to fetch url "+this.f,t instanceof Error?t:Error(t)),this.a&&as(this)},t.setRequestHeader=function(t,e){this.l.append(t,e)},t.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.i)&&t.log(Yo,"Attempting to get response header but no headers have been received for url: "+this.f,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var t=this.i;return t&&t.log(Yo,"Attempting to get all response headers but no headers have been received for url: "+this.f,void 0),""}for(var t=[],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")},Object.defineProperty(is.prototype,"withCredentials",{get:function(){return"include"===this.h},set:function(t){this.h=t?"include":"same-origin"}}),w(cs,ln);var hs="";cs.prototype.b=es("goog.net.XhrIo");var ls=/^https?$/i,fs=["POST","PUT"];function ps(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.R=n,e.J=!1,e.c=!0,e.a=(e.D||Do).a(),e.C=e.D?jo(e.D):jo(Do),e.a.onreadystatechange=m(e.Vb,e);try{ns(e.b,Is(e,"Opening Xhr")),e.O=!0,e.a.open(n,String(t),!0),e.O=!1}catch(t){return ns(e.b,Is(e,"Error opening Xhr: "+t.message)),void vs(e,t)}t=r||"";var o,s=new bn(e.headers);i&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(d(t)||"string"==typeof t)j(t,e,void 0);else for(var n=mn(t),r=yn(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=ds,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.Y()),r=l.FormData&&t instanceof l.FormData,!K(fs,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.S&&(e.a.withCredentials=e.S);try{bs(e),0<e.g&&(e.u=(o=e.a,Bt&&Jt(9)&&"number"==typeof o.timeout&&void 0!==o.ontimeout),ns(e.b,Is(e,"Will abort after "+e.g+"ms if incomplete, xhr2 "+e.u)),e.u?(e.a.timeout=e.g,e.a.ontimeout=m(e.Ma,e)):e.s=vn(e.Ma,e.g,e)),ns(e.b,Is(e,"Sending request")),e.i=!0,e.a.send(t),e.i=!1}catch(t){ns(e.b,Is(e,"Send error: "+t.message)),vs(e,t)}}function ds(t){return"content-type"==t.toLowerCase()}function vs(t,e){t.c=!1,t.a&&(t.f=!0,t.a.abort(),t.f=!1),t.h=e,gs(t),ms(t)}function gs(t){t.J||(t.J=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function ys(e){if(e.c&&void 0!==h)if(e.C[1]&&4==ws(e)&&2==_s(e))ns(e.b,Is(e,"Local request error detected and ignored"));else if(e.i&&4==ws(e))vn(e.Vb,0,e);else if(e.dispatchEvent("readystatechange"),4==ws(e)){ns(e.b,Is(e,"Request complete")),e.c=!1;try{var t,n,r,i,o=_s(e);t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var s=!0;break t;default:s=!1}if((t=s)||((n=0===o)&&(!(i=String(e.l).match(In)[1]||null)&&l.self&&l.self.location&&(i=(r=l.self.location.protocol).substr(0,r.length-1)),n=!ls.test(i?i.toLowerCase():"")),t=n),t)e.dispatchEvent("complete"),e.dispatchEvent("success");else{try{var a=2<ws(e)?e.a.statusText:""}catch(t){ns(e.b,"Can not get status: "+t.message),a=""}e.h=a+" ["+_s(e)+"]",gs(e)}}finally{ms(e)}}}function ms(e,t){if(e.a){bs(e);var n=e.a,r=e.C[0]?s:null;e.a=null,e.C=null,t||e.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){(e=e.b)&&e.log(Qo,"Problem encountered resetting onreadystatechange: "+t.message,void 0)}}}function bs(t){t.a&&t.u&&(t.a.ontimeout=null),t.s&&(l.clearTimeout(t.s),t.s=null)}function ws(t){return t.a?t.a.readyState:0}function _s(t){try{return 2<ws(t)?t.a.status:-1}catch(t){return-1}}function Is(t,e){return e+" ["+t.R+" "+t.l+" "+_s(t)+"]"}function Ts(t){var e=xs;this.g=[],this.u=e,this.s=t||null,this.f=this.a=!1,this.c=void 0,this.v=this.C=this.i=!1,this.h=0,this.b=null,this.l=0}function Es(t,e,n){t.a=!0,t.c=n,t.f=!e,As(t)}function Ss(t){if(t.a){if(!t.v)throw new ks;t.v=!1}}function Cs(t,e,n,r){t.g.push([e,n,r]),t.a&&As(t)}function Ns(t){return B(t.g,function(t){return v(t[1])})}function As(e){var n;e.h&&e.a&&Ns(e)&&(r=e.h,(n=Os[r])&&(l.clearTimeout(n.a),delete Os[r]),e.h=0),e.b&&(e.b.l--,delete e.b);for(var r=e.c,t=n=!1;e.g.length&&!e.i;){var i=(s=e.g.shift())[0],o=s[1],s=s[2];if(i=e.f?o:i)try{var a=i.call(s||e.s,r);void 0!==a&&(e.f=e.f&&(a==r||a instanceof Error),e.c=r=a),(k(r)||"function"==typeof l.Promise&&r instanceof l.Promise)&&(t=!0,e.i=!0)}catch(t){r=t,e.f=!0,Ns(e)||(n=!0)}}e.c=r,t&&(a=m(e.m,e,!0),t=m(e.m,e,!1),r instanceof Ts?(Cs(r,a,t),r.C=!0):r.then(a,t)),n&&(r=new Ps(r),Os[r.a]=r,e.h=r.a)}function ks(){R.call(this)}function Rs(){R.call(this)}function Ps(t){this.a=l.setTimeout(m(this.c,this),0),this.b=t}(t=cs.prototype).Ma=function(){void 0!==h&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",ns(this.b,Is(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(){this.a&&this.c&&(ns(this.b,Is(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),ms(this))},t.Da=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),ms(this,!0)),cs.ab.Da.call(this)},t.Vb=function(){this.xa||(this.O||this.i||this.f?ys(this):this.Jc())},t.Jc=function(){ys(this)},t.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.m){case hs: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(Qo,"Response type "+this.m+" is not supported on this browser",void 0),null}catch(t){return ns(this.b,"Can not get response: "+t.message),null}},Ts.prototype.cancel=function(t){var e;this.a?this.c instanceof Ts&&this.c.cancel():(this.b&&(e=this.b,delete this.b,t?e.cancel(t):(e.l--,e.l<=0&&e.cancel())),this.u?this.u.call(this.s,this):this.v=!0,this.a||(t=new Rs,Ss(this),Es(this,!1,t)))},Ts.prototype.m=function(t,e){this.i=!1,Es(this,t,e)},Ts.prototype.then=function(t,e,n){var r,i,o=new fe(function(t,e){r=t,i=e});return Cs(this,r,function(t){t instanceof Rs?o.cancel():i(t)}),o.then(t,e,n)},Ts.prototype.$goog_Thenable=!0,w(ks,R),ks.prototype.message="Deferred has already fired",ks.prototype.name="AlreadyCalledError",w(Rs,R),Rs.prototype.message="Deferred was canceled",Rs.prototype.name="CanceledError",Ps.prototype.c=function(){throw delete Os[this.a],this.b};var Os={};function Ds(t){var e=document,n=wt(t).toString(),r=se(document,"SCRIPT"),i={Wb:r,Ma:void 0},o=new Ts(i),s=window.setTimeout(function(){Ls(r,!0);var t=new Us(Fs,"Timeout reached for loading script "+n);Ss(o),Es(o,!1,t)},5e3);return i.Ma=s,r.onload=r.onreadystatechange=function(){r.readyState&&"loaded"!=r.readyState&&"complete"!=r.readyState||(Ls(r,!1,s),Ss(o),Es(o,!0,null))},r.onerror=function(){Ls(r,!0,s);var t=new Us(Ms,"Error while loading script "+n);Ss(o),Es(o,!1,t)},lt(i={},{type:"text/javascript",charset:"UTF-8"}),ee(r,i),i=t,ft(t=r,"HTMLScriptElement"),t.src=wt(i),(i=(i=t.ownerDocument&&t.ownerDocument.defaultView)&&i!=l?f(i.document):a=null===a?f(l.document):a)&&t.setAttribute("nonce",i),((e=((i=e)||document).getElementsByTagName("HEAD"))&&0!=e.length?e[0]:i.documentElement).appendChild(r),o}function xs(){var t;this&&this.Wb&&((t=this.Wb)&&"SCRIPT"==t.tagName&&Ls(t,!0,this.Ma))}function Ls(t,e,n){null!=n&&l.clearTimeout(n),t.onload=s,t.onerror=s,t.onreadystatechange=s,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)}var Ms=0,Fs=1;function Us(t,e){var n="Jsloader error (code #"+t+")";e&&(n+=": "+e),R.call(this,n),this.code=t}function js(t){this.f=t}function qs(t,e,n){if(this.c=t,t=e||{},this.l=t.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.m=t.secureTokenTimeout||Ks,this.g=ct(t.secureTokenHeaders||Ws),this.h=t.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.i=t.identityPlatformEndpoint||"https://identitytoolkit.googleapis.com/v2/",this.v=t.firebaseTimeout||Hs,this.a=ct(t.firebaseHeaders||Gs),n&&(this.a["X-Client-Version"]=n,this.g["X-Client-Version"]=n),n="Node"==hr(),!(n=l.XMLHttpRequest||n&&Xl.INTERNAL.node&&Xl.INTERNAL.node.XMLHttpRequest)&&!cr())throw new I("internal-error","The XMLHttpRequest compatibility library was not found.");this.f=void 0,cr()?this.f=new rs(self):lr()?this.f=new js(n):this.f=new Bo,this.b=null}w(Us,R),w(js,Uo),js.prototype.a=function(){return new this.f},js.prototype.b=function(){return{}};var Vs,Bs="idToken",Ks=new Rr(3e4,6e4),Ws={"Content-Type":"application/x-www-form-urlencoded"},Hs=new Rr(3e4,6e4),Gs={"Content-Type":"application/json"};function zs(t,e){e?t.a["X-Firebase-Locale"]=e:delete t.a["X-Firebase-Locale"]}function Qs(t,e){e&&(t.l=Ys("https://securetoken.googleapis.com/v1/token",e),t.h=Ys("https://www.googleapis.com/identitytoolkit/v3/relyingparty/",e),t.i=Ys("https://identitytoolkit.googleapis.com/v2/",e))}function Ys(t,e){return t=kn(t),e=kn(e.url),t.f=t.a+t.f,En(t,e.c),t.a=e.a,Sn(t,e.g),t.toString()}function Xs(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 Js(t,e,n,r,i,o,s){var a;(t=((a=dr(a=yr())==pr&&(a=a.match(/\sChrome\/(\d+)/i))&&2==a.length?parseInt(a[1],10):null)&&a<30||Bt&&$t&&!(9<$t))&&!cr()?(Vs=Vs||new fe(function(t,e){var n,r;n=t,r=e,((window.gapi||{}).client||{}).request?n():(l[Zs]=function(){((window.gapi||{}).client||{}).request?n():r(Error("CORS_UNSUPPORTED"))},function(t,e){Cs(t,null,e,void 0)}(Ds(_t($s,{onload:Zs})),function(){r(Error("CORS_UNSUPPORTED"))}))}),m(t.s,t)):m(t.u,t))(e,n,r,i,o,s)}qs.prototype.T=function(){return this.b},qs.prototype.u=function(t,n,e,r,i,o){if(cr()&&(void 0===l.fetch||void 0===l.Headers||void 0===l.Request))throw new I("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,a=new cs(this.f);o&&(a.g=Math.max(0,o),s=setTimeout(function(){a.dispatchEvent("timeout")},o)),fn(a,"complete",function(){s&&clearTimeout(s);var e=null;try{e=JSON.parse(function(e){try{return e.a?e.a.responseText:""}catch(t){return ns(e.b,"Can not get responseText: "+t.message),""}}(this))||null}catch(t){e=null}n&&n(e)}),pn(a,"ready",function(){s&&clearTimeout(s),Le(this)}),pn(a,"timeout",function(){s&&clearTimeout(s),Le(this),n&&n(null)}),ps(a,t,e,r,i)};var $s=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=kn(e+n);Nn(a,"key",t.c),s&&Nn(a,"cb",Date.now().toString());var u="GET"==r;if(u)for(var c in i)i.hasOwnProperty(c)&&Nn(a,c,i[c]);return new fe(function(e,n){Js(t,a.toString(),function(t){t?t.error?n(Ya(t,o||{})):e(t):n(new I("network-request-failed"))},r,u?void 0:zn(Sr(i)),t.a,t.v.get())})}function ea(t){if("string"!=typeof(t=t.email)||!or.test(t))throw new I("invalid-email")}function na(t){"email"in t&&ea(t)}function ra(t){if(!t[Bs]){if(t.mfaPendingCredential)throw new I("multi-factor-auth-required",null,ct(t));throw new I("internal-error")}}function ia(t){if(t.phoneNumber||t.temporaryProof){if(!t.phoneNumber||!t.temporaryProof)throw new I("internal-error")}else{if(!t.sessionInfo)throw new I("missing-verification-id");if(!t.code)throw new I("missing-verification-code")}}qs.prototype.s=function(t,n,r,i,o){var s=this;Vs.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"}})})},qs.prototype.zb=function(){return za(this,La,{})},qs.prototype.Bb=function(t,e){return za(this,Da,{idToken:t,email:e})},qs.prototype.Cb=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 I("internal-error");if(!t.phoneVerificationInfo.sessionInfo)throw new I("missing-verification-id");if(!t.phoneVerificationInfo.code)throw new I("missing-verification-code")}function aa(t){if(!t.requestUri||!t.sessionId&&!t.postBody&&!t.pendingToken)throw new I("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&&(Kn(t=new jn(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=Fo(t)):"FEDERATED_USER_ID_ALREADY_LINKED"==t.errorMessage?(t.code="credential-already-in-use",e=Fo(t)):"EMAIL_EXISTS"==t.errorMessage?(t.code="email-already-in-use",e=Fo(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,qa,e)}function fa(t,e){return e.returnIdpCredential=!0,e.autoCreate=!1,za(t,ja,e)}function pa(t){if(!t.oobCode)throw new I("invalid-action-code")}(t=qs.prototype).Db=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.vb=function(t,e){return lt(t={requestType:"PASSWORD_RESET",email:t},e),za(this,Aa,t)},t.wb=function(t,e){return lt(t={requestType:"EMAIL_SIGNIN",email:t},e),za(this,Sa,t)},t.ub=function(t,e){return lt(t={requestType:"VERIFY_EMAIL",idToken:t},e),za(this,Ca,t)},t.Eb=function(t,e,n){return lt(t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:t,newEmail:e},n),za(this,Na,t)},t.fb=function(t){return za(this,Ka,t)},t.nb=function(t,e){return za(this,Pa,{oobCode:t,newPassword:e})},t.Ra=function(t){return za(this,va,{oobCode:t})},t.jb=function(t){return za(this,da,{oobCode:t})};var da={endpoint:"setAccountInfo",A:pa,Z:"email",B:!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 I("internal-error")},B:!0},ga={endpoint:"signupNewUser",A:function(t){if(ea(t),!t.password)throw new I("weak-password")},G:ra,V:!0,B:!0},ya={endpoint:"createAuthUri",B:!0},ma={endpoint:"deleteAccount",N:["idToken"]},ba={endpoint:"setAccountInfo",N:["idToken","deleteProvider"],A:function(t){if(!Array.isArray(t.deleteProvider))throw new I("internal-error")}},wa={endpoint:"emailLinkSignin",N:["email","oobCode"],A:ea,G:ra,V:!0,B:!0},_a={endpoint:"emailLinkSignin",N:["idToken","email","oobCode"],A:ea,G:ra,V:!0},Ia={endpoint:"accounts/mfaEnrollment:finalize",N:["idToken","phoneVerificationInfo"],A:sa,G:ra,B:!0,Na:!0},Ta={endpoint:"accounts/mfaSignIn:finalize",N:["mfaPendingCredential","phoneVerificationInfo"],A:sa,G:ra,B:!0,Na:!0},Ea={endpoint:"getAccountInfo"},Sa={endpoint:"getOobConfirmationCode",N:["requestType"],A:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new I("internal-error");ea(t)},Z:"email",B:!0},Ca={endpoint:"getOobConfirmationCode",N:["idToken","requestType"],A:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new I("internal-error")},Z:"email",B:!0},Na={endpoint:"getOobConfirmationCode",N:["idToken","newEmail","requestType"],A:function(t){if("VERIFY_AND_CHANGE_EMAIL"!=t.requestType)throw new I("internal-error")},Z:"email",B:!0},Aa={endpoint:"getOobConfirmationCode",N:["requestType"],A:function(t){if("PASSWORD_RESET"!=t.requestType)throw new I("internal-error");ea(t)},Z:"email",B:!0},ka={lb:!0,endpoint:"getProjectConfig",Ub:"GET"},Ra={lb:!0,endpoint:"getRecaptchaParam",Ub:"GET",G:function(t){if(!t.recaptchaSiteKey)throw new I("internal-error")}},Pa={endpoint:"resetPassword",A:pa,Z:"email",B:!0},Oa={endpoint:"sendVerificationCode",N:["phoneNumber","recaptchaToken"],Z:"sessionInfo",B:!0},Da={endpoint:"setAccountInfo",N:["idToken"],A:na,V:!0},xa={endpoint:"setAccountInfo",N:["idToken"],A:function(t){if(na(t),!t.password)throw new I("weak-password")},G:ra,V:!0},La={endpoint:"signupNewUser",G:ra,V:!0,B:!0},Ma={endpoint:"accounts/mfaEnrollment:start",N:["idToken","phoneEnrollmentInfo"],A:function(t){if(!t.phoneEnrollmentInfo)throw new I("internal-error");if(!t.phoneEnrollmentInfo.phoneNumber)throw new I("missing-phone-number");if(!t.phoneEnrollmentInfo.recaptchaToken)throw new I("missing-app-credential")},G:function(t){if(!t.phoneSessionInfo||!t.phoneSessionInfo.sessionInfo)throw new I("internal-error")},B:!0,Na:!0},Fa={endpoint:"accounts/mfaSignIn:start",N:["mfaPendingCredential","mfaEnrollmentId","phoneSignInInfo"],A:function(t){if(!t.phoneSignInInfo||!t.phoneSignInInfo.recaptchaToken)throw new I("missing-app-credential")},G:function(t){if(!t.phoneResponseInfo||!t.phoneResponseInfo.sessionInfo)throw new I("internal-error")},B:!0,Na:!0},Ua={endpoint:"verifyAssertion",A:aa,Ya:ua,G:ca,V:!0,B:!0},ja={endpoint:"verifyAssertion",A:aa,Ya:ua,G:function(t){if(t.errorMessage&&"USER_NOT_FOUND"==t.errorMessage)throw new I("user-not-found");if(t.errorMessage)throw Qa(t.errorMessage);ra(t)},V:!0,B:!0},qa={endpoint:"verifyAssertion",A:function(t){if(aa(t),!t.idToken)throw new I("internal-error")},Ya:ua,G:ca,V:!0},Va={endpoint:"verifyCustomToken",A:function(t){if(!t.token)throw new I("invalid-custom-token")},G:ra,V:!0,B:!0},Ba={endpoint:"verifyPassword",A:function(t){if(ea(t),!t.password)throw new I("wrong-password")},G:ra,V:!0,B:!0},Ka={endpoint:"verifyPhoneNumber",A:ia,G:ra,B:!0},Wa={endpoint:"verifyPhoneNumber",A:function(t){if(!t.idToken)throw new I("internal-error");ia(t)},G:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",Fo(t);ra(t)}},Ha={Hb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:ia,G:ra,B:!0},Ga={endpoint:"accounts/mfaEnrollment:withdraw",N:["idToken","mfaEnrollmentId"],G:function(t){if(!!t[Bs]^!!t.refreshToken)throw new I("internal-error")},B:!0,Na:!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.N))return we(new I("internal-error"));var r,i=!!e.Na,o=e.Ub||"POST";return be(n).then(e.A).then(function(){return e.V&&(n.returnSecureToken=!0),e.B&&t.b&&void 0===n.tenantId&&(n.tenantId=t.b),ta(t,i?t.i:t.h,e.endpoint,o,n,e.Hb,e.lb||!1)}).then(function(t){return r=t,e.Ya?e.Ya(n,r):r}).then(e.G).then(function(){if(!e.Z)return r;if(!(e.Z in r))throw new I("internal-error");return r[e.Z]})}function Qa(t){return Ya({error:{errors:[{message:t}],code:400,message:t}})}function Ya(t,e){var n,r=(t.error&&t.error.errors&&t.error.errors[0]||{}).reason||"",i={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(r=i[r]?new I(i[r]):null)return r;for(n in r=t.error&&t.error.message||"",lt(i={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=r.match(/^[^\s]+\s*:\s*([\s\S]*)$/))&&1<e.length?e[1]:void 0,i)if(0===r.indexOf(n))return new I(i[n],e);return new I("internal-error",e=!e&&t?Er(t):e)}function Xa(t){var o;this.b=t,this.a=null,this.rb=(o=this,(tu=tu||new fe(function(t,e){function n(){kr(),mr("gapi.load")("gapi.iframes",{callback:t,ontimeout:function(){kr(),e(Error("Network Error"))},timeout:$a.get()})}var r;mr("gapi.iframes.Iframe")?t():mr("gapi.load")?n():(r="__iframefcb"+Math.floor(1e6*Math.random()).toString(),l[r]=function(){mr("gapi.load")?n():e(Error("Network Error"))},be(Ds(r=_t(Ja,{onload:r}))).o(function(){e(Error("Network Error"))}))}).o(function(t){throw tu=null,t})).then(function(){return new fe(function(r,i){mr("gapi.iframes.getContext")().open({where:document.body,url:o.b,messageHandlersFilter:mr("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 Ja=new pt(yt,"https://apis.google.com/js/api.js?onload=%{onload}"),$a=new Rr(3e4,6e4),Za=new Rr(5e3,15e3),tu=null;function eu(t,e,n,r){this.l=t,this.h=e,this.i=n,this.g=r,this.f=null,t=this.g?Rn((t=kn(this.g.url)).c,t.a,t.g,"/emulator/auth/iframe"):Rn("https",this.l,null,"/__/auth/iframe"),this.a=t,Nn(this.a,"apiKey",this.h),Nn(this.a,"appName",this.i),this.b=null,this.c=[]}function nu(t,e,n,r,i,o){this.u=t,this.s=e,this.c=n,this.m=r,this.v=o,this.i=this.g=this.l=null,this.a=i,this.h=this.f=null}function ru(t){try{return Xl.app(t).auth().Ga()}catch(t){return[]}}function iu(t,e,n,r,i,o){this.s=t,this.g=e,this.b=n,this.f=o,this.c=r||null,this.i=i||null,this.l=this.u=this.C=null,this.h=[],this.m=this.a=null}function ou(t){var a=Zn();return za(t,ka,{}).then(function(t){return t.authorizedDomains||[]}).then(function(t){t:{for(var e=(n=kn(a)).c,n=n.a,r=0;r<t.length;r++){var i=t[r],o=n,s=e;if(o=0==i.indexOf("chrome-extension://")?kn(i).a==o&&"chrome-extension"==s:("http"==s||"https"==s)&&(ir.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 Lo(Zn())})}function su(i){return i.m||(i.m=sr().then(function(){var t,e,n,r;i.u||(t=i.c,e=i.i,n=ru(i.b),(r=new eu(i.s,i.g,i.b,i.f)).f=t,r.b=e,r.c=z(n||[]),i.u=r.toString()),i.v=new Xa(i.u),function(r){if(!r.v)throw Error("IfcHandler must be initialized!");!function(t,e){t.rb.then(function(){t.a.register("authEvent",e,mr("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}(r.v,function(t){var e={};if(t&&t.authEvent){var n=!1;for(t=Po(t.authEvent),e=0;e<r.h.length;e++)n=r.h[e](t)||n;return(e={}).status=n?"ACK":"ERROR",be(e)}return e.status="ERROR",be(e)})}(i)}),i.m)}function au(t){return t.l||(t.C=t.c?gr(t.c,ru(t.b)):null,t.l=new qs(t.g,A(t.i),t.C),t.f&&Qs(t.l,t.f)),t.l}function uu(t,e,n,r,i,o,s,a,u,c,h,l){return(t=new nu(t,e,n,r,i,l)).l=o,t.g=s,t.i=a,t.b=ct(u||null),t.f=c,t.yb(h).toString()}function cu(t){if(this.a=t||Xl.INTERNAL.reactNative&&Xl.INTERNAL.reactNative.AsyncStorage,!this.a)throw new I("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?Nn(this.a,"v",this.f):Bn(this.a.b,"v"),this.b?Nn(this.a,"eid",this.b):Bn(this.a.b,"eid"),this.c.length?Nn(this.a,"fw",this.c.join(",")):Bn(this.a.b,"fw"),this.a.toString()},nu.prototype.yb=function(t){return this.h=t,this},nu.prototype.toString=function(){var t;if(Nn(t=this.v?Rn((t=kn(this.v.url)).c,t.a,t.g,"/emulator/auth/handler"):Rn("https",this.u,null,"/__/auth/handler"),"apiKey",this.s),Nn(t,"appName",this.c),Nn(t,"authType",this.m),this.a.isOAuthProvider){var e=this.a;try{var n=Xl.app(this.c).auth().la()}catch(t){n=null}for(r in e.ob=n,Nn(t,"providerId",this.a.providerId),e=Sr((n=this.a).Ib))e[r]=e[r].toString();for(var r=n.Qc,e=ct(e),i=0;i<r.length;i++){var o=r[i];o in e&&delete e[o]}n.pb&&n.ob&&!e[n.pb]&&(e[n.pb]=n.ob),ut(e)||Nn(t,"customParameters",Er(e))}if("function"==typeof this.a.Qb&&((n=this.a.Qb()).length&&Nn(t,"scopes",n.join(","))),this.l?Nn(t,"redirectUrl",this.l):Bn(t.b,"redirectUrl"),this.g?Nn(t,"eventId",this.g):Bn(t.b,"eventId"),this.i?Nn(t,"v",this.i):Bn(t.b,"v"),this.b)for(var s in this.b)this.b.hasOwnProperty(s)&&!An(t,s)&&Nn(t,s,this.b[s]);return this.h?Nn(t,"tid",this.h):Bn(t.b,"tid"),this.f?Nn(t,"eid",this.f):Bn(t.b,"eid"),(s=ru(this.c)).length&&Nn(t,"fw",s.join(",")),t.toString()},(t=iu.prototype).Ob=function(e,n,t){var r=new I("popup-closed-by-user"),i=new I("web-storage-unsupported"),o=this,s=!1;return this.ma().then(function(){var t,r;r={type:"webStorageSupport"},su(t=o).then(function(){return e=t.v,n=r,e.rb.then(function(){return new fe(function(t){e.a.send(n.type,n,t,mr("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&&nr(e),n(i),s=!0)})}).o(function(){}).then(function(){if(!s)return n=e,new fe(function(e){return function t(){gn(2e3).then(function(){return n&&!n.closed?t():void e()})}()});var n}).then(function(){if(!s)return gn(t).then(function(){n(r)})})},t.Xb=function(){var t=yr();return!Tr(t)&&!Ar(t)},t.Tb=function(){return!1},t.Mb=function(e,t,n,r,i,o,s,a){if(!e)return we(new I("popup-blocked"));if(s&&!Tr())return this.ma().o(function(t){nr(e),i(t)}),r(),be();this.a||(this.a=ou(au(this)));var u=this;return this.a.then(function(){var t=u.ma().o(function(t){throw nr(e),i(t),t});return r(),t}).then(function(){ko(n),s||tr(uu(u.s,u.g,u.b,t,n,null,o,u.c,void 0,u.i,a,u.f),e)}).o(function(t){throw"auth/network-request-failed"==t.code&&(u.a=null),t})},t.Nb=function(t,e,n,r){this.a||(this.a=ou(au(this)));var i=this;return this.a.then(function(){ko(e),tr(uu(i.s,i.g,i.b,t,e,Zn(),n,i.c,void 0,i.i,r,i.f))}).o(function(t){throw"auth/network-request-failed"==t.code&&(i.a=null),t})},t.ma=function(){var t=this;return su(this).then(function(){return t.v.rb}).o(function(){throw t.a=null,new I("network-request-failed")})},t.$b=function(){return!0},t.Ea=function(t){this.h.push(t)},t.Sa=function(e){H(this.h,function(t){return t==e})},(t=cu.prototype).get=function(t){return be(this.a.getItem(t)).then(function(t){return t&&Cr(t)})},t.set=function(t,e){return be(this.a.setItem(t,Er(e)))},t.U=function(t){return be(this.a.removeItem(t))},t.ca=function(){},t.ia=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 gu(r,t,e,n){var i,o,s,a,u=e||{},c=null;if(r.b)return we(Error("connection_unavailable"));var h=n?800:50,l="undefined"!=typeof MessageChannel?new MessageChannel:null;return new fe(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 yu(r,c),t}).o(function(t){throw yu(r,c),t})}function yu(t,e){var n,r;e&&(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(!Iu())throw new I("web-storage-unsupported");this.c={},this.a=[],this.b=0,this.m=l.indexedDB,this.type="indexedDB",this.g=this.v=this.f=this.l=null,this.s=!1,this.h=null;var t,e,n,r=this;cr()&&self?(this.v=(n=cr()?self:null,j(fu,function(t){t.b==n&&(e=t)}),e||(e=new hu(n),fu.push(e)),e),pu(this.v,"keyChanged",function(t,n){return Nu(r).then(function(e){return 0<e.length&&j(r.a,function(t){t(e)}),{keyProcessed:K(e,n.key)}})}),pu(this.v,"ping",function(){return be(["keyChanged"])})):((t=l.navigator)&&t.serviceWorker?be().then(function(){return t.serviceWorker.ready}).then(function(t){return t.active||null}).o(function(){return null}):be(null)).then(function(t){(r.h=t)&&(r.g=new vu(new du(t)),gu(r.g,"ping",null,!0).then(function(t){t[0].fulfilled&&K(t[0].value,"keyChanged")&&(r.s=!0)}).o(function(){}))})}function bu(i){return new fe(function(e,n){var t=i.m.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 fe(function(t,e){var n=r.m.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.i||(t.i=bu(t)),t.i}function _u(i,t){var o=0;return new fe(function e(n,r){wu(i).then(t).then(n).o(function(t){return 3<++o?void r(t):wu(i).then(function(t){return t.close(),i.i=void 0,e(n,r)}).o(function(t){r(t)})})})}function Iu(){try{return l.indexedDB}catch(t){return}}function Tu(t){return t.objectStore("firebaseLocalStorage")}function Eu(t,e){return t.transaction(["firebaseLocalStorage"],e?"readwrite":"readonly")}function Su(t){return new fe(function(e,n){t.onsuccess=function(t){t&&t.target?e(t.target.result):e()},t.onerror=function(t){n(t.target.error)}})}function Cu(t,e){return t.g&&t.h&&((n=l.navigator)&&n.serviceWorker&&n.serviceWorker.controller||null)===t.h?gu(t.g,"keyChanged",{key:e},t.s).then(function(){}).o(function(){}):be();var n}function Nu(r){return wu(r).then(function(t){var i=Tu(Eu(t,!1));return i.getAll?Su(i.getAll()):new fe(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 Au(t){t.l&&t.l.cancel("STOP_EVENT"),t.f&&(clearTimeout(t.f),t.f=null)}function ku(t){var r=this,i=null;this.a=[],this.type="indexedDB",this.c=t,this.b=be().then(function(){if(Iu()){var e=Nr(),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.U(n)}).then(function(){return i}).o(function(){return r.c})}return r.c}).then(function(t){return r.type=t.type,t.ca(function(e){j(r.a,function(t){t(e)})}),t})}function Ru(){this.a={},this.type="inMemory"}function Pu(){if(!function(){var t="Node"==hr();if(!(t=Ou()||t&&Xl.INTERNAL.node&&Xl.INTERNAL.node.localStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==hr())throw new I("internal-error","The LocalStorage compatibility library was not found.");throw new I("web-storage-unsupported")}this.a=Ou()||Xl.INTERNAL.node.localStorage,this.type="localStorage"}function Ou(){try{var t=l.localStorage,e=Nr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Du(){this.type="nullStorage"}function xu(){if(!function(){var t="Node"==hr();if(!(t=Lu()||t&&Xl.INTERNAL.node&&Xl.INTERNAL.node.sessionStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==hr())throw new I("internal-error","The SessionStorage compatibility library was not found.");throw new I("web-storage-unsupported")}this.a=Lu()||Xl.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function Lu(){try{var t=l.sessionStorage,e=Nr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Mu(){var t={};t.Browser=ju,t.Node=qu,t.ReactNative=Vu,t.Worker=Bu,this.a=t[hr()]}hu.prototype.c=function(n){var e,r=n.data.eventType,i=n.data.eventId,t=this.a[r];t&&0<t.length&&(n.ports[0].postMessage({status:"ack",eventId:i,eventType:r,response:null}),e=[],j(t,function(t){e.push(be().then(function(){return t(n.origin,n.data.data)}))}),Ie(e).then(function(t){var e=[];j(t,function(t){e.push({fulfilled:t.Pb,value:t.value,reason:t.reason?t.reason.message:void 0})}),j(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;)yu(this,this.a[0]);this.b=!0},(t=mu.prototype).set=function(r,i){var o=this,s=!1;return _u(this,function(t){return Su((t=Tu(Eu(t,!0))).get(r))}).then(function(n){return _u(o,function(t){if(t=Tu(Eu(t,!0)),n)return n.value=i,Su(t.put(n));o.b++,s=!0;var e={};return e.fbase_key=r,e.value=i,Su(t.add(e))})}).then(function(){return o.c[r]=i,Cu(o,r)}).oa(function(){s&&o.b--})},t.get=function(e){return _u(this,function(t){return Su(Tu(Eu(t,!1)).get(e))}).then(function(t){return t&&t.value})},t.U=function(e){var n=this,r=!1;return _u(this,function(t){return r=!0,n.b++,Su(Tu(Eu(t,!0)).delete(e))}).then(function(){return delete n.c[e],Cu(n,e)}).oa(function(){r&&n.b--})},t.ca=function(t){var n;0==this.a.length&&(Au(n=this),function e(){n.f=setTimeout(function(){n.l=Nu(n).then(function(e){0<e.length&&j(n.a,function(t){t(e)})}).then(function(){e()}).o(function(t){"STOP_EVENT"!=t.message&&e()})},800)}()),this.a.push(t)},t.ia=function(e){H(this.a,function(t){return t==e}),0==this.a.length&&Au(this)},(t=ku.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.U=function(e){return this.b.then(function(t){return t.U(e)})},t.ca=function(t){this.a.push(t)},t.ia=function(e){H(this.a,function(t){return t==e})},(t=Ru.prototype).get=function(t){return be(this.a[t])},t.set=function(t,e){return this.a[t]=e,be()},t.U=function(t){return delete this.a[t],be()},t.ca=function(){},t.ia=function(){},(t=Pu.prototype).get=function(t){var e=this;return be().then(function(){return Cr(e.a.getItem(t))})},t.set=function(e,n){var r=this;return be().then(function(){var t=Er(n);null===t?r.U(e):r.a.setItem(e,t)})},t.U=function(t){var e=this;return be().then(function(){e.a.removeItem(t)})},t.ca=function(t){l.window&&$e(l.window,"storage",t)},t.ia=function(t){l.window&&en(l.window,"storage",t)},(t=Du.prototype).get=function(){return be(null)},t.set=function(){return be()},t.U=function(){return be()},t.ca=function(){},t.ia=function(){},(t=xu.prototype).get=function(t){var e=this;return be().then(function(){return Cr(e.a.getItem(t))})},t.set=function(e,n){var r=this;return be().then(function(){var t=Er(n);null===t?r.U(e):r.a.setItem(e,t)})},t.U=function(t){var e=this;return be().then(function(){e.a.removeItem(t)})},t.ca=function(){},t.ia=function(){};var Fu,Uu,ju={F:Pu,bb:xu},qu={F:Pu,bb:xu},Vu={F:cu,bb:Du},Bu={F:Pu,bb:Du},Ku={rd:"local",NONE:"none",td:"session"};function Wu(){var t=!(Ar(yr())||!ur()),e=Tr(),n=br();this.m=t,this.h=e,this.l=n,this.a={},t=Fu=Fu||new Mu;try{this.g=!$n()&&xr()||!l.indexedDB?new t.a.F:new ku(new(cr()?Ru:t.a.F))}catch(t){this.g=new Ru,this.h=!0}try{this.i=new t.a.bb}catch(t){this.i=new Ru}this.v=new Ru,this.f=m(this.Yb,this),this.b={}}function Hu(){return Uu=Uu||new Wu}function Gu(t,e){switch(e){case"session":return t.i;case"none":return t.v;default:return t.g}}function zu(t,e){return"firebase:"+t.name+(e?":"+e:"")}function Qu(t,e,n){return n=zu(e,n),"local"==e.F&&(t.b[n]=null),Gu(t,e.F).U(n)}function Yu(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 Gu(this,t.F).get(zu(t,e))},t.set=function(e,t,n){var r=zu(e,n),i=this,o=Gu(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=zu(t,e),this.l&&(this.b[t]=l.localStorage.getItem(t)),ut(this.a)&&(Gu(this,"local").ca(this.f),this.h||($n()||!xr())&&l.indexedDB||!this.l||(Yu(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 Ve({type:"storage",key:t,target:window,oldValue:n,newValue:e,a:!0}),r.Yb(e))}},1e3))),this.a[t]||(this.a[t]=[]),this.a[t].push(n)},t.removeListener=function(t,e,n){t=zu(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)&&(Gu(this,"local").ia(this.f),Yu(this))},t.Yb=function(t){if(t&&t.g){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.mb(n))}else if(0==e.indexOf("firebase:")&&this.a[e]){if(void 0!==t.a.a?Gu(this,"local").ia(this.f):Yu(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.mb(e))};Bt&&$t&&10==$t&&l.localStorage.getItem(e)!==t.a.newValue&&t.a.newValue!==t.a.oldValue?setTimeout(n,10):n()}}else j(t,m(this.mb,this))},t.mb=function(t){this.a[t]&&j(this.a[t],function(t){t()})};var Ju,$u={name:"authEvent",F:"local"};function Zu(){this.a=Hu()}function tc(t,e){this.b=ec,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===Ju&&(Ju=l.Int32Array?new Int32Array(uc):uc),this.reset()}w(tc,function(){this.b=-1});for(var ec=64,nc=ec-1,rc=[],ic=0;ic<nc;ic++)rc[ic]=0;var oc=G(128,rc);function sc(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++){var i=0|n[e-15],r=0|n[e-2],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|Ju[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 ac(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&&(sc(t),i=0);else{if(!d(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&&(sc(t),i=0)}}t.c=i,t.g+=n}tc.prototype.reset=function(){this.g=this.c=0,this.a=l.Int32Array?new Int32Array(this.h):z(this.h)};var uc=[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 cc(){tc.call(this,8,hc)}w(cc,tc);var hc=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function lc(t,e,n,r,i,o){this.v=t,this.i=e,this.l=n,this.m=r||null,this.u=i||null,this.s=o,this.h=e+":"+n,this.C=new Zu,this.g=new Xu(this.h),this.f=null,this.b=[],this.a=this.c=null}function fc(t){return new I("invalid-cordova-configuration",t)}function pc(t){var e=new cc;ac(e,t),t=[];var n=8*e.g;e.c<56?ac(e,oc,56-e.c):ac(e,oc,e.b-(e.c-56));for(var r=63;56<=r;r--)e.f[r]=255&n,n/=256;for(sc(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 dc(t,e){for(var n=0;n<t.b.length;n++)try{t.b[n](e)}catch(t){}}function vc(a){return a.f||(a.f=a.ma().then(function(){return new fe(function(n){function e(r){t=!0,s&&s.cancel(),gc(i).then(function(t){var e,n=o;t&&r&&r.url&&(e=null,n=(e=-1!=(n=Qi(r.url)).indexOf("/__/auth/callback")?(e="object"==typeof(e=Cr(An(e=kn(n),"firebaseError")||null))?T(e):null)?new Ro(t.c,t.b,null,null,e,null,t.T()):new Ro(t.c,t.b,n,t.f,null,null,t.T()):e)||o),dc(i,n)})}var i,o,t,s,r;a.Ea(function t(e){return n(e),a.Sa(t),!1}),i=a,o=new Ro("unknown",null,null,null,new I("no-auth-event")),t=!1,s=gn(500).then(function(){return gc(i).then(function(){t||dc(i,o)})}),r=l.handleOpenURL,l.handleOpenURL=function(t){if(0==t.toLowerCase().indexOf(mr("BuildInfo.packageName",l).toLowerCase()+"://")&&e({url:t}),"function"==typeof r)try{r(t)}catch(t){console.error(t)}},xo=xo||new Oo,function(t){var n=xo;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=mr("universalLinks.subscribe",l))&&t(null,n.b))}(e)})})),a.f}function gc(e){var t,n=null;return(t=e.g).b.get($u,t.a).then(Po).then(function(t){return n=t,Qu((t=e.g).b,$u,t.a)}).then(function(){return n})}function yc(t){this.a=t,this.b=Hu()}(t=lc.prototype).ma=function(){return this.Ia||(this.Ia=(ar(void 0)?sr().then(function(){return new fe(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)})}):we(Error("Cordova must run in an Android or iOS file scheme."))).then(function(){if("function"!=typeof mr("universalLinks.subscribe",l))throw fc("cordova-universal-links-plugin-fix is not installed");if(void 0===mr("BuildInfo.packageName",l))throw fc("cordova-plugin-buildinfo is not installed");if("function"!=typeof mr("cordova.plugins.browsertab.openUrl",l))throw fc("cordova-plugin-browsertab is not installed");if("function"!=typeof mr("cordova.InAppBrowser.open",l))throw fc("cordova-plugin-inappbrowser is not installed")},function(){throw new I("cordova-not-ready")}))},t.Ob=function(t,e){return e(new I("operation-not-supported-in-this-environment")),be()},t.Mb=function(){return we(new I("operation-not-supported-in-this-environment"))},t.$b=function(){return!1},t.Xb=function(){return!0},t.Tb=function(){return!0},t.Nb=function(t,e,n,r){if(this.c)return we(new I("redirect-operation-pending"));var i=this,o=l.document,s=null,a=null,u=null,c=null;return this.c=be().then(function(){return ko(e),vc(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 I("no-auth-event"),null,i),a=mr("BuildInfo.packageName",l);if("string"!=typeof a)throw new I("invalid-cordova-configuration");var u=mr("BuildInfo.displayName",l),c={};if(yr().toLowerCase().match(/iphone|ipad|ipod/))c.ibi=a;else{if(!yr().toLowerCase().match(/android/))return we(new I("operation-not-supported-in-this-environment"));c.apn=a}u&&(c.appDisplayName=u),o=pc(o),c.sessionId=o;var h=uu(n.v,n.i,n.l,t,e,null,r,n.m,c,n.u,i,n.s);return n.ma().then(function(){var t=n.h;return n.C.a.set($u,s.w(),t)}).then(function(){var t=mr("cordova.plugins.browsertab.isAvailable",l);if("function"!=typeof t)throw new I("invalid-cordova-configuration");var e=null;t(function(t){if(t){if("function"!=typeof(e=mr("cordova.plugins.browsertab.openUrl",l)))throw new I("invalid-cordova-configuration");e(h)}else{if("function"!=typeof(e=mr("cordova.InAppBrowser.open",l)))throw new I("invalid-cordova-configuration");t=yr(),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 fe(function(e,t){a=function(){var t=mr("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.Ea(a),u=function(){s=s||gn(2e3).then(function(){t(new I("redirect-cancelled-by-user"))})},c=function(){Pr()&&u()},o.addEventListener("resume",u,!1),yr().toLowerCase().match(/android/)||o.addEventListener("visibilitychange",c,!1)}).o(function(t){return gc(i).then(function(){throw t})})}).oa(function(){u&&o.removeEventListener("resume",u,!1),c&&o.removeEventListener("visibilitychange",c,!1),s&&s.cancel(),a&&i.Sa(a),i.c=null})},t.Ea=function(e){this.b.push(e),vc(this).o(function(t){"auth/invalid-cordova-configuration"===t.code&&(t=new Ro("unknown",null,null,null,new I("no-auth-event")),e(t))})},t.Sa=function(e){H(this.b,function(t){return t==e})};var mc={name:"pendingRedirect",F:"session"};function bc(t){return Qu(t.b,mc,t.a)}function wc(t,e,n,r){this.i={},this.u=0,this.D=t,this.v=e,this.m=n,this.J=r,this.h=[],this.f=!1,this.l=m(this.s,this),this.b=new Lc,this.C=new qc,this.g=new yc(Dc(this.v,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.C,this.c.linkViaPopup=this.C,this.c.reauthViaPopup=this.C,this.a=_c(this.D,this.v,this.m,E,this.J)}function _c(t,e,n,r,i){var o=Xl.SDK_VERSION||null;return new(ar()?lc:iu)(t,e,n,o,r,i)}function Ic(e){e.f||(e.f=!0,e.a.Ea(e.l));var n=e.a;return e.a.ma().o(function(t){throw e.a==n&&e.reset(),t})}function Tc(n){n.a.Xb()&&Ic(n).o(function(t){var e=new Ro("unknown",null,null,null,new I("operation-not-supported-in-this-environment"));kc(t)&&n.s(e)}),n.a.Tb()||Mc(n.b)}function Ec(n,t){K(n.h,t)||n.h.push(t),n.f||(t=n.g).b.get(mc,t.a).then(function(t){return"pending"==t}).then(function(t){t?bc(n.g).then(function(){Ic(n).o(function(t){var e=new Ro("unknown",null,null,null,new I("operation-not-supported-in-this-environment"));kc(t)&&n.s(e)})}):Tc(n)}).o(function(){Tc(n)})}function Sc(t,e){H(t.h,function(t){return t==e})}wc.prototype.reset=function(){this.f=!1,this.a.Sa(this.l),this.a=_c(this.D,this.v,this.m,null,this.J),this.i={}},wc.prototype.s=function(t){if(!t)throw new I("invalid-auth-event");if(6e5<=Date.now()-this.u&&(this.i={},this.u=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.Fb(t.c,t.b)){(e=this.c[t.c])&&(e.h(t,r),t&&(t.f||t.b)&&(this.i[t.getUid()]=!0,this.u=Date.now())),e=!0;break}}return Mc(this.b),e};var Cc=new Rr(2e3,1e4),Nc=new Rr(3e4,6e4);function Ac(t,e,n,r,i,o,s){return t.a.Mb(e,n,r,function(){t.f||(t.f=!0,t.a.Ea(t.l))},function(){t.reset()},i,o,s)}function kc(t){return!(!t||"auth/cordova-not-ready"!=t.code)}function Rc(e,t,n,r,i){var o,s;return(s=e.g).b.set(mc,"pending",s.a).then(function(){return e.a.Nb(t,n,r,i).o(function(t){if(kc(t))throw new I("operation-not-supported-in-this-environment");return o=t,bc(e.g).then(function(){throw o})}).then(function(){return e.a.$b()?new fe(function(){}):bc(e.g).then(function(){return e.qa()}).then(function(){}).o(function(){})})})}function Pc(t,e,n,r,i){return t.a.Ob(r,function(t){e.na(n,null,t,i)},Cc.get())}wc.prototype.qa=function(){return this.b.qa()};var Oc={};function Dc(t,e,n){return t=t+":"+e,t=n?t+":"+n.url:t}function xc(t,e,n,r){var i=Dc(e,n,r);return Oc[i]||(Oc[i]=new wc(t,e,n,r)),Oc[i]}function Lc(){this.b=null,this.f=[],this.c=[],this.a=null,this.i=this.g=!1}function Mc(t){t.g||(t.g=!0,jc(t,!1,null,null))}function Fc(t){t.g&&!t.i&&jc(t,!1,null,null)}function Uc(t,e){if(t.b=function(){return be(e)},t.f.length)for(var n=0;n<t.f.length;n++)t.f[n](e)}function jc(t,e,n,r){e?r?function(t,e){if(t.b=function(){return we(e)},t.c.length)for(var n=0;n<t.c.length;n++)t.c[n](e)}(t,r):Uc(t,n):Uc(t,{user:null}),t.f=[],t.c=[]}function qc(){}function Vc(){this.ib=!1,Object.defineProperty(this,"appVerificationDisabled",{get:function(){return this.ib},set:function(t){this.ib=t},enumerable:!1})}function Bc(t,e){this.a=e,jr(this,"verificationId",t)}function Kc(t,e,n,r){return new Co(t).fb(e,n).then(function(t){return new Bc(t,r)})}function Wc(t){var e=xi(t);if(!(e&&e.exp&&e.auth_time&&e.iat))throw new I("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");qr(this,{token:t,expirationTime:Dr(1e3*e.exp),authTime:Dr(1e3*e.auth_time),issuedAtTime:Dr(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 Hc(t,e,n){var r=e&&e[zc];if(!r)throw new I("argument-error","Internal assert: Invalid MultiFactorResolver");this.a=t,this.f=ct(e),this.g=n,this.c=new Yi(null,r),this.b=[];var i=this;j(e[Gc]||[],function(t){(t=Wr(t))&&i.b.push(t)}),jr(this,"auth",this.a),jr(this,"session",this.c),jr(this,"hints",this.b)}Lc.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},Lc.prototype.h=function(t,e){var n,r,i,o;t?(this.reset(),this.g=!0,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?(jc(this,!0,null,t.a),be()):e.Fa(n,r)?function(e,t,n){n=n.Fa(t.c,t.b);var r=t.g,i=t.f,o=t.i,s=t.T(),a=!!t.c.match(/Redirect$/);n(r,i,s,o).then(function(t){jc(e,a,t,null)}).o(function(t){jc(e,a,null,t)})}(this,t,e):we(new I("invalid-auth-event")):(jc(this,!1,null,null),be())):we(new I("invalid-auth-event"))},Lc.prototype.qa=function(){var i=this;return new fe(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 I("timeout"),n.a&&n.a.cancel(),n.a=gn(Nc.get()).then(function(){n.b||(n.g=!0,jc(n,!0,null,r))}))})},qc.prototype.h=function(t,e){var n,r,i,o,s;t?(n=t.c,r=t.b,t.a?(e.na(t.c,null,t.a,t.b),be()):e.Fa(n,r)?(i=e,o=(t=t).b,s=t.c,i.Fa(s,o)(t.g,t.f,t.T(),t.i).then(function(t){i.na(s,t,null,o)}).o(function(t){i.na(s,null,t,o)})):we(new I("invalid-auth-event"))):we(new I("invalid-auth-event"))},Bc.prototype.confirm=function(t){return t=No(this.verificationId,t),this.a(t)};var Gc="mfaInfo",zc="mfaPendingCredential";function Qc(t,e,n,r){I.call(this,"multi-factor-auth-required",r,e),this.b=new Hc(t,e,n),jr(this,"resolver",this.b)}function Yc(t,e,n){if(t&&g(t.serverResponse)&&"auth/multi-factor-auth-required"===t.code)try{return new Qc(e,t.serverResponse,n,t.message)}catch(t){}return null}function Xc(){}function Jc(t){jr(this,"factorId",t.fa),this.a=t}function $c(t){if(Jc.call(this,t),this.a.fa!=Co.PROVIDER_ID)throw new I("argument-error","firebase.auth.PhoneMultiFactorAssertion requires a valid firebase.auth.PhoneAuthCredential")}function Zc(t,e){for(var n in qe.call(this,t),e)this[n]=e[n]}function th(t,e){this.a=t,this.b=[],this.c=m(this.yc,this),$e(this.a,"userReloaded",this.c);var r=[];e&&e.multiFactor&&e.multiFactor.enrolledFactors&&j(e.multiFactor.enrolledFactors,function(t){var e=null,n={};if(t){t.uid&&(n[zr]=t.uid),t.displayName&&(n[Hr]=t.displayName),t.enrollmentTime&&(n[Gr]=new Date(t.enrollmentTime).toISOString()),t.phoneNumber&&(n[Qr]=t.phoneNumber);try{e=new Yr(n)}catch(t){}t=e}else t=null;t&&r.push(t)}),eh(this,r)}function eh(t,e){t.b=e,jr(t,"enrolledFactors",e)}function nh(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 rh(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 ih(t){this.f=t,this.b=this.a=null,this.c=Date.now()}function oh(t,e){void 0===e&&(e=t.b?(e=t.b).a-e.g:0),t.c=Date.now()+1e3*e}function sh(t,e){t.b=Di(e[Bs]||""),t.a=e.refreshToken,oh(t,void 0!==(e=e.expiresIn)?Number(e):void 0)}function ah(e,t){return r=e.f,i=t,new fe(function(e,n){"refresh_token"==i.grant_type&&i.refresh_token||"authorization_code"==i.grant_type&&i.code?Js(r,r.l+"?key="+encodeURIComponent(r.c),function(t){t?t.error?n(Ya(t)):t.access_token&&t.refresh_token?e(t):n(new I("internal-error")):n(new I("network-request-failed"))},"POST",Vn(i).toString(),r.g,r.m.get()):n(new I("internal-error"))}).then(function(t){return e.b=Di(t.access_token),e.a=t.refresh_token,oh(e,t.expires_in),{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 uh(t,e){this.a=t||null,this.b=e||null,qr(this,{lastSignInTime:Dr(e||null),creationTime:Dr(t||null)})}function ch(t,e,n,r,i,o){qr(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function hh(t,e,n){this.J=[],this.l=t.apiKey,this.m=t.appName,this.s=t.authDomain||null;var r,i=Xl.SDK_VERSION?gr(Xl.SDK_VERSION):null;this.a=new qs(this.l,A(E),i),t.emulatorConfig&&Qs(this.a,t.emulatorConfig),this.b=new ih(this.a),mh(this,e[Bs]),sh(this.b,e),jr(this,"refreshToken",this.b.a),_h(this,n||{}),ln.call(this),this.R=!1,this.s&&wr()&&(this.i=xc(this.s,this.l,this.m)),this.S=[],this.h=null,this.u=(r=this,new nh(function(){return r.I(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var t=r.b.c-Date.now()-3e5;return 0<t?t:0})),this.aa=m(this.hb,this);var o=this;this.ya=null,this.Oa=function(t){o.wa(t.h)},this.ja=null,this.Aa=function(t){Qs(o.a,t.c)},this.X=null,this.$=[],this.Ba=function(t){ph(o,t.f)},this.ba=null,this.O=new th(this,n),jr(this,"multiFactor",this.O)}function lh(t,e){t.ja&&en(t.ja,"languageCodeChanged",t.Oa),(t.ja=e)&&$e(e,"languageCodeChanged",t.Oa)}function fh(t,e){t.X&&en(t.X,"emulatorConfigChanged",t.Aa),(t.X=e)&&$e(e,"emulatorConfigChanged",t.Aa)}function ph(t,e){t.$=e,Xs(t.a,Xl.SDK_VERSION?gr(Xl.SDK_VERSION,t.$):null)}function dh(t,e){t.ba&&en(t.ba,"frameworkChanged",t.Ba),(t.ba=e)&&$e(e,"frameworkChanged",t.Ba)}function vh(e){try{return Xl.app(e.m).auth()}catch(t){throw new I("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+e.m+"'!")}}function gh(t){t.D||t.u.b||(t.u.start(),en(t,"tokenChanged",t.aa),$e(t,"tokenChanged",t.aa))}function yh(t){en(t,"tokenChanged",t.aa),t.u.stop()}function mh(t,e){t.za=e,jr(t,"_lat",e)}function bh(t){for(var e=[],n=0;n<t.S.length;n++)e.push(t.S[n](t));return Ie(e).then(function(){return t})}function wh(t){t.i&&!t.R&&(t.R=!0,Ec(t.i,t))}function _h(t,e){qr(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 uh(e.createdAt,e.lastLoginAt),providerData:[]}),t.a.b=t.tenantId}function Ih(){}function Th(t){return be().then(function(){if(t.D)throw new I("app-deleted")})}function Eh(t){return V(t.providerData,function(t){return t.providerId})}function Sh(t,e){e&&(Ch(t,e.providerId),t.providerData.push(e))}function Ch(t,e){H(t.providerData,function(t){return t.providerId==e})}function Nh(t,e,n){("uid"!=e||n)&&t.hasOwnProperty(e)&&jr(t,e,n)}function Ah(e,t){var n,r;e!=t&&(qr(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?jr(e,"metadata",new uh((r=t.metadata).a,r.b)):jr(e,"metadata",new uh),j(t.providerData,function(t){Sh(e,t)}),n=e.b,r=t.b,n.b=r.b,n.a=r.a,n.c=r.c,jr(e,"refreshToken",e.b.a),eh(e.O,t.O.b))}function kh(i){return i.I().then(function(t){var e,n,r=i.isAnonymous;return n=t,za((e=i).a,Ea,{idToken:n}).then(m(e.Kc,e)).then(function(){return r||Nh(i,"isAnonymous",!1),t})})}function Rh(t,e){e[Bs]&&t.za!=e[Bs]&&(sh(t.b,e),t.dispatchEvent(new Zc("tokenChanged")),mh(t,e[Bs]),Nh(t,"refreshToken",t.b.a))}function Ph(t,e){return kh(t).then(function(){if(K(Eh(t),e))return bh(t).then(function(){throw new I("provider-already-linked")})})}function Oh(t,e,n){return Vr({user:t,credential:Ao(e),additionalUserInfo:e=ji(e),operationType:n})}function Dh(t,e){return Rh(t,e),t.reload().then(function(){return t})}function xh(n,r,t,e,i){if(!wr())return we(new I("operation-not-supported-in-this-environment"));if(n.h&&!i)return we(n.h);var o=Ui(t.providerId),s=Nr(n.uid+":::"),a=null,u=rr(a=(!Tr()||ur())&&n.s&&t.isOAuthProvider?uu(n.s,n.l,n.m,r,t,null,s,Xl.SDK_VERSION||null,null,null,n.tenantId):a,o&&o.ua,o&&o.ta);return e=e().then(function(){if(Mh(n),!i)return n.I().then(function(){})}).then(function(){return Ac(n.i,u,r,t,s,!!a,n.tenantId)}).then(function(){return new fe(function(t,e){n.na(r,null,new I("cancelled-popup-request"),n.g||null),n.f=t,n.C=e,n.g=s,n.c=Pc(n.i,n,r,u,s)})}).then(function(t){return u&&nr(u),t?Vr(t):null}).o(function(t){throw u&&nr(u),t}),Fh(n,e,i)}function Lh(e,t,n,r,i){if(!wr())return we(new I("operation-not-supported-in-this-environment"));if(e.h&&!i)return we(e.h);var o=null,s=Nr(e.uid+":::");return r=r().then(function(){if(Mh(e),!i)return e.I().then(function(){})}).then(function(){return e.ga=s,bh(e)}).then(function(t){return t=e.ha?(t=e.ha).b.set(qh,e.w(),t.a):t}).then(function(){return Rc(e.i,t,n,s,e.tenantId)}).o(function(t){if(o=t,e.ha)return Vh(e.ha);throw o}).then(function(){if(o)throw o}),Fh(e,r,i)}function Mh(t){if(!t.i||!t.R){if(t.i&&!t.R)throw new I("internal-error");throw new I("auth-domain-config-required")}}function Fh(n,t,e){var r,i=(t=t,e=e,(r=n).h&&!e?(t.cancel(),we(r.h)):t.o(function(t){throw!t||"auth/user-disabled"!=t.code&&"auth/user-token-expired"!=t.code||(r.h||r.dispatchEvent(new Zc("userInvalidated")),r.h=t),t}));return n.J.push(i),i.oa(function(){W(n.J,i)}),i.o(function(t){var e=null;throw(e=t&&"auth/multi-factor-auth-required"===t.code?Yc(t.w(),vh(n),m(n.jc,n)):e)||t})}function Uh(t){if(!t.apiKey)return null;var e={apiKey:t.apiKey,authDomain:t.authDomain,appName:t.appName,emulatorConfig:t.emulatorConfig},n={};if(!t.stsTokenManager||!t.stsTokenManager.accessToken)return null;n[Bs]=t.stsTokenManager.accessToken,n.refreshToken=t.stsTokenManager.refreshToken||null;var r=t.stsTokenManager.expirationTime;r&&(n.expiresIn=(r-Date.now())/1e3);var i=new hh(e,n,t);return t.providerData&&j(t.providerData,function(t){t&&Sh(i,Vr(t))}),t.redirectEventId&&(i.ga=t.redirectEventId),i}function jh(t){this.a=t,this.b=Hu()}Hc.prototype.Rc=function(t){var n=this;return t.sb(this.a.a,this.c).then(function(t){var e=ct(n.f);return delete e[Gc],delete e[zc],lt(e,t),n.g(e)})},w(Qc,I),Xc.prototype.sb=function(t,e,n){return e.type==Xi?(o=this,s=t,a=n,e.Ha().then(function(t){return t={idToken:t},void 0!==a&&(t.displayName=a),lt(t,{phoneVerificationInfo:So(o.a)}),za(s,Ia,t)})):(r=this,i=t,e.Ha().then(function(t){return lt(t={mfaPendingCredential:t},{phoneVerificationInfo:So(r.a)}),za(i,Ta,t)}));var r,i,o,s,a},w(Jc,Xc),w($c,Jc),w(Zc,qe),(t=th.prototype).yc=function(t){var e;eh(this,(t=t.hd,e=[],j(t.mfaInfo||[],function(t){(t=Wr(t))&&e.push(t)}),e))},t.Rb=function(){return this.a.I().then(function(t){return new Yi(t,null)})},t.fc=function(e,n){var r=this,i=this.a.a;return this.Rb().then(function(t){return e.sb(i,t,n)}).then(function(t){return Rh(r.a,t),r.a.reload()})},t.bd=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=q(n.b,function(t){return t.uid!=r});return eh(n,e),Rh(n.a,t),n.a.reload().o(function(t){if("auth/user-token-expired"!=t.code)throw t})})},t.w=function(){return{multiFactor:{enrolledFactors:V(this.b,function(t){return t.w()})}}},nh.prototype.start=function(){this.a=this.c,function e(n,t){n.stop();n.b=gn(rh(n,t)).then(Or).then(function(){return n.h()}).then(function(){e(n,!0)}).o(function(t){n.i(t)&&e(n,!1)})}(this,!0)},nh.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},ih.prototype.w=function(){return{apiKey:this.f.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:this.c}},ih.prototype.getToken=function(t){return t=!!t,this.b&&!this.a?we(new I("user-token-expired")):t||!this.b||Date.now()>this.c-3e4?this.a?ah(this,{grant_type:"refresh_token",refresh_token:this.a}):be(null):be({accessToken:this.b.toString(),refreshToken:this.a})},uh.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}},w(hh,ln),hh.prototype.wa=function(t){this.ya=t,zs(this.a,t)},hh.prototype.la=function(){return this.ya},hh.prototype.Ga=function(){return z(this.$)},hh.prototype.hb=function(){this.u.b&&(this.u.stop(),this.u.start())},jr(hh.prototype,"providerId","firebase"),(t=hh.prototype).reload=function(){var t=this;return Fh(this,Th(this).then(function(){return kh(t).then(function(){return bh(t)}).then(Ih)}))},t.oc=function(t){return this.I(t).then(function(t){return new Wc(t)})},t.I=function(t){var e=this;return Fh(this,Th(this).then(function(){return e.b.getToken(t)}).then(function(t){if(!t)throw new I("internal-error");return t.accessToken!=e.za&&(mh(e,t.accessToken),e.dispatchEvent(new Zc("tokenChanged"))),Nh(e,"refreshToken",t.refreshToken),t.accessToken}))},t.Kc=function(t){if(!(t=t.users)||!t.length)throw new I("internal-error");_h(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,n=(e=(e=t).providerUserInfo)&&e.length?V(e,function(t){return new ch(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[],r=0;r<n.length;r++)Sh(this,n[r]);Nh(this,"isAnonymous",!(this.email&&t.passwordHash||this.providerData&&this.providerData.length)),this.dispatchEvent(new Zc("userReloaded",{hd:t}))},t.Lc=function(t){return Fr("firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.reauthenticateWithCredential instead."),this.tb(t)},t.tb=function(t){var e=this,n=null;return Fh(this,t.c(this.a,this.uid).then(function(t){return Rh(e,t),n=Oh(e,t,"reauthenticate"),e.h=null,e.reload()}).then(function(){return n}),!0)},t.Cc=function(t){return Fr("firebase.User.prototype.linkAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.linkWithCredential instead."),this.qb(t)},t.qb=function(e){var n=this,r=null;return Fh(this,Ph(this,e.providerId).then(function(){return n.I()}).then(function(t){return e.b(n.a,t)}).then(function(t){return r=Oh(n,t,"link"),Dh(n,t)}).then(function(){return r}))},t.Dc=function(t,e){var n=this;return Fh(this,Ph(this,"phone").then(function(){return Kc(vh(n),t,e,m(n.qb,n))}))},t.Mc=function(t,e){var n=this;return Fh(this,be().then(function(){return Kc(vh(n),t,e,m(n.tb,n))}),!0)},t.Bb=function(e){var n=this;return Fh(this,this.I().then(function(t){return n.a.Bb(t,e)}).then(function(t){return Rh(n,t),n.reload()}))},t.ed=function(e){var n=this;return Fh(this,this.I().then(function(t){return e.b(n.a,t)}).then(function(t){return Rh(n,t),n.reload()}))},t.Cb=function(e){var n=this;return Fh(this,this.I().then(function(t){return n.a.Cb(t,e)}).then(function(t){return Rh(n,t),n.reload()}))},t.Db=function(e){if(void 0===e.displayName&&void 0===e.photoURL)return Th(this);var n=this;return Fh(this,this.I().then(function(t){return n.a.Db(t,{displayName:e.displayName,photoUrl:e.photoURL})}).then(function(t){return Rh(n,t),Nh(n,"displayName",t.displayName||null),Nh(n,"photoURL",t.photoUrl||null),j(n.providerData,function(t){"password"===t.providerId&&(jr(t,"displayName",n.displayName),jr(t,"photoURL",n.photoURL))}),bh(n)}).then(Ih))},t.cd=function(e){var n=this;return Fh(this,kh(this).then(function(t){return K(Eh(n),e)?za(n.a,ba,{idToken:t,deleteProvider:[e]}).then(function(t){var e={};return j(t.providerUserInfo||[],function(t){e[t.providerId]=!0}),j(Eh(n),function(t){e[t]||Ch(n,t)}),e[Co.PROVIDER_ID]||jr(n,"phoneNumber",null),bh(n)}):bh(n).then(function(){throw new I("no-such-provider")})}))},t.delete=function(){var e=this;return Fh(this,this.I().then(function(t){return za(e.a,ma,{idToken:t})}).then(function(){e.dispatchEvent(new Zc("userDeleted"))})).then(function(){for(var t=0;t<e.J.length;t++)e.J[t].cancel("app-deleted");lh(e,null),fh(e,null),dh(e,null),e.J=[],e.D=!0,yh(e),jr(e,"refreshToken",null),e.i&&Sc(e.i,e)})},t.Fb=function(t,e){return!!("linkViaPopup"==t&&(this.g||null)==e&&this.f||"reauthViaPopup"==t&&(this.g||null)==e&&this.f||"linkViaRedirect"==t&&(this.ga||null)==e||"reauthViaRedirect"==t&&(this.ga||null)==e)},t.na=function(t,e,n,r){"linkViaPopup"!=t&&"reauthViaPopup"!=t||r!=(this.g||null)||(n&&this.C?this.C(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.C)},t.Fa=function(t,e){return"linkViaPopup"==t&&e==(this.g||null)?m(this.Kb,this):"reauthViaPopup"==t&&e==(this.g||null)?m(this.Lb,this):"linkViaRedirect"==t&&(this.ga||null)==e?m(this.Kb,this):"reauthViaRedirect"==t&&(this.ga||null)==e?m(this.Lb,this):null},t.Ec=function(t){var e=this;return xh(this,"linkViaPopup",t,function(){return Ph(e,t.providerId).then(function(){return bh(e)})},!1)},t.Nc=function(t){return xh(this,"reauthViaPopup",t,function(){return be()},!0)},t.Fc=function(t){var e=this;return Lh(this,"linkViaRedirect",t,function(){return Ph(e,t.providerId)},!1)},t.Oc=function(t){return Lh(this,"reauthViaRedirect",t,function(){return be()},!0)},t.Kb=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=Oh(i,t,"link"),Dh(i,t)}).then(function(){return o}),Fh(this,t)},t.Lb=function(t,e,n,r){var i=this;this.c&&(this.c.cancel(),this.c=null);var o=null;return Fh(this,be().then(function(){return Zi(fa(i.a,{requestUri:t,sessionId:e,postBody:r,tenantId:n}),i.uid)}).then(function(t){return o=Oh(i,t,"reauthenticate"),Rh(i,t),i.h=null,i.reload()}).then(function(){return o}),!0)},t.ub=function(e){var n=this,r=null;return Fh(this,this.I().then(function(t){return r=t,void 0===e||ut(e)?{}:ki(new bi(e))}).then(function(t){return n.a.ub(r,t)}).then(function(t){if(n.email!=t)return n.reload()}).then(function(){}))},t.Eb=function(e,n){var r=this,i=null;return Fh(this,this.I().then(function(t){return i=t,void 0===n||ut(n)?{}:ki(new bi(n))}).then(function(t){return r.a.Eb(i,e,t)}).then(function(t){if(r.email!=t)return r.reload()}).then(function(){}))},t.jc=function(t){var e=null,n=this;return Fh(this,t=Zi(be(t),n.uid).then(function(t){return e=Oh(n,t,"reauthenticate"),Rh(n,t),n.h=null,n.reload()}).then(function(){return e}),!0)},t.toJSON=function(){return this.w()},t.w=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.w(),redirectEventId:this.ga||null};return this.metadata&<(e,this.metadata.w()),j(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.w()),e};var qh={name:"redirectUser",F:"session"};function Vh(t){return Qu(t.b,qh,t.a)}function Bh(t){var e,n,r,i;this.a=t,this.b=Hu(),this.c=null,this.f=(n=Hh("local"),r=Hh("session"),i=Hh("none"),function(n,r,i){var o=zu(r,i),s=Gu(n,r.F);return n.get(r,i).then(function(t){var e=null;try{e=Cr(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(Wh,e.a).then(function(t){return t?Hh(t):n})})})}).then(function(t){return e.c=t,Kh(e,t.F)}).o(function(){e.c||(e.c=n)})),this.b.addListener(Hh("local"),this.a,m(this.g,this))}function Kh(t,e){var n,a,r=[];for(n in Ku)Ku[n]!==e&&r.push(Qu(t.b,Hh(Ku[n]),t.a));return r.push(Qu(t.b,Wh,t.a)),a=r,new fe(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++)_e(a[s],b(t,s),o);else n(i)})}Bh.prototype.g=function(){var e=this,n=Hh("local");Yh(this,function(){return be().then(function(){return e.c&&"local"!=e.c.F?e.b.get(n,e.a):null}).then(function(t){if(t)return Kh(e,"local").then(function(){e.c=n})})})};var Wh={name:"persistence",F:"session"};function Hh(t){return{name:"authUser",F:t}}function Gh(t,e){return Yh(t,function(){return t.b.set(t.c,e.w(),t.a)})}function zh(t){return Yh(t,function(){return Qu(t.b,t.c,t.a)})}function Qh(t,e,n){return Yh(t,function(){return t.b.get(t.c,t.a).then(function(t){return t&&e&&(t.authDomain=e),t&&n&&(t.emulatorConfig=n),Uh(t||{})})})}function Yh(t,e){return t.f=t.f.then(e,e),t.f}function Xh(t){if(this.l=!1,jr(this,"settings",new Vc),jr(this,"app",t),!this.app.options||!this.app.options.apiKey)throw new I("invalid-api-key");var n,e,r,i,o,s;t=Xl.SDK_VERSION?gr(Xl.SDK_VERSION):null,this.a=new qs(this.app.options&&this.app.options.apiKey,A(E),t),this.R=[],this.s=[],this.O=[],this.hb=Xl.INTERNAL.createSubscribe(m(this.zc,this)),this.X=void 0,this.bc=Xl.INTERNAL.createSubscribe(m(this.Ac,this)),rl(this,null),this.i=new Bh(this.app.options.apiKey+":"+this.app.name),this.D=new jh(this.app.options.apiKey+":"+this.app.name),this.$=ul(this,(e=(n=this).app.options.authDomain,t=function(e){var t=function(t,e){return t.b.get(qh,t.a).then(function(t){return t&&e&&(t.authDomain=e),Uh(t||{})})}(e.D,e.app.options.authDomain).then(function(t){return(e.m=t)&&(t.ha=e.D),Vh(e.D)});return ul(e,t)}(n).then(function(){return Qh(n.i,e,n.P)}).then(function(e){return e?(e.ha=n.D,n.m&&(n.m.ga||null)==(e.ga||null)?e:e.reload().then(function(){return Gh(n.i,e).then(function(){return e})}).o(function(t){return"auth/network-request-failed"==t.code?e:zh(n.i)})):null}).then(function(t){rl(n,t||null)}),ul(n,t))),this.h=ul(this,(r=this).$.then(function(){return el(r)}).o(function(){}).then(function(){if(!r.l)return r.ja()}).o(function(){}).then(function(){var t;r.l||(r.ba=!0,(t=r.i).b.addListener(Hh("local"),t.a,r.ja))})),this.ba=!1,this.ja=m(this.Zc,this),this.Ba=m(this.da,this),this.ya=m(this.mc,this),this.za=m(this.wc,this),this.Aa=m(this.xc,this),this.b=null,o=(i=this).app.options.authDomain,s=i.app.options.apiKey,o&&wr()&&(i.Oa=i.$.then(function(){var t;if(!i.l)return i.b=xc(o,s,i.app.name,i.P),Ec(i.b,i),ol(i)&&wh(ol(i)),i.m&&(wh(i.m),(t=i.m).wa(i.la()),lh(t,i),ph(t=i.m,i.J),dh(t,i),Qs((t=i.m).a,i.P),fh(t,i),i.m=null),i.b})),this.INTERNAL={},this.INTERNAL.delete=m(this.delete,this),this.INTERNAL.logFramework=m(this.Gc,this),this.u=0,ln.call(this),t=this,Object.defineProperty(t,"lc",{get:function(){return this.la()},set:function(t){this.wa(t)},enumerable:!1}),t.aa=null,Object.defineProperty(t,"ti",{get:function(){return this.T()},set:function(t){this.yb(t)},enumerable:!1}),t.S=null,Object.defineProperty(t,"emulatorConfig",{get:function(){var t;return t=this.P?Vr({protocol:(t=kn(this.P.url)).c,host:t.a,port:t.g,options:Vr({disableWarnings:this.P.ec})}):null},enumerable:!1}),this.J=[],this.P=null}function Jh(t){qe.call(this,"languageCodeChanged"),this.h=t}function $h(t){qe.call(this,"emulatorConfigChanged"),this.c=t}function Zh(t){qe.call(this,"frameworkChanged"),this.f=t}function tl(t){return t.Oa||we(new I("auth-domain-config-required"))}function el(t){if(!wr())return we(new I("operation-not-supported-in-this-environment"));var e=tl(t).then(function(){return t.b.qa()}).then(function(t){return t?Vr(t):null});return ul(t,e)}function nl(o,s){var a={};return a.apiKey=o.app.options.apiKey,a.authDomain=o.app.options.authDomain,a.appName=o.app.name,o.P&&(a.emulatorConfig=o.P),o.$.then(function(){return t=a,e=s,n=o.D,r=o.Ga(),i=new hh(t,e),n&&(i.ha=n),r&&ph(i,r),i.reload().then(function(){return i});var t,e,n,r,i}).then(function(t){return ol(o)&&t.uid==ol(o).uid?Ah(ol(o),t):(rl(o,t),wh(t)),o.da(t)}).then(function(){al(o)})}function rl(t,e){var n,r;ol(t)&&(n=ol(t),r=t.Ba,H(n.S,function(t){return t==r}),en(ol(t),"tokenChanged",t.ya),en(ol(t),"userDeleted",t.za),en(ol(t),"userInvalidated",t.Aa),yh(ol(t))),e&&(e.S.push(t.Ba),$e(e,"tokenChanged",t.ya),$e(e,"userDeleted",t.za),$e(e,"userInvalidated",t.Aa),0<t.u&&gh(e)),jr(t,"currentUser",e),e&&(e.wa(t.la()),lh(e,t),ph(e,t.J),dh(e,t),Qs(e.a,t.P),fh(e,t))}function il(n,t){var e=null,r=null;return ul(n,t.then(function(t){return e=Ao(t),r=ji(t),nl(n,t)},function(t){var e=null;throw(e=t&&"auth/multi-factor-auth-required"===t.code?Yc(t.w(),n,m(n.kc,n)):e)||t}).then(function(){return Vr({user:ol(n),credential:e,additionalUserInfo:r,operationType:"signIn"})}))}function ol(t){return t.currentUser}function sl(t){return ol(t)&&ol(t)._lat||null}function al(t){if(t.ba){for(var e=0;e<t.s.length;e++)t.s[e]&&t.s[e](sl(t));if(t.X!==t.getUid()&&t.O.length)for(t.X=t.getUid(),e=0;e<t.O.length;e++)t.O[e]&&t.O[e](sl(t))}}function ul(t,e){return t.R.push(e),e.oa(function(){W(t.R,e)}),e}function cl(){}function hl(){this.a={},this.b=1e12}Bh.prototype.xb=function(e){var n=null,r=this;return function(t){var e=new I("invalid-persistence-type"),n=new I("unsupported-persistence-type");t:{for(r in Ku)if(Ku[r]==t){var r=!0;break t}r=!1}if(!r||"string"!=typeof t)throw e;switch(hr()){case"ReactNative":if("session"===t)throw n;break;case"Node":if("none"!==t)throw n;break;case"Worker":if("session"===t||!Iu()&&"none"!==t)throw n;break;default:if(!br()&&"none"!==t)throw n}}(e),Yh(this,function(){return e!=r.c.F?r.b.get(r.c,r.a).then(function(t){return n=t,Kh(r,e)}).then(function(){if(r.c=Hh(e),n)return r.b.set(r.c,n,r.a)}):be()})},w(Xh,ln),w(Jh,qe),w($h,qe),w(Zh,qe),(t=Xh.prototype).xb=function(t){return t=this.i.xb(t),ul(this,t)},t.wa=function(t){this.aa===t||this.l||(this.aa=t,zs(this.a,this.aa),this.dispatchEvent(new Jh(this.la())))},t.la=function(){return this.aa},t.fd=function(){var t=l.navigator;this.wa(t&&(t.languages&&t.languages[0]||t.language||t.userLanguage)||null)},t.gd=function(t,e){if(!this.P){if(!/^https?:\/\//.test(t))throw new I("argument-error","Emulator URL must start with a valid scheme (http:// or https://).");e=!!e&&!!e.disableWarnings,n=e,"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),l.document&&!n&&sr().then(function(){var t=l.document.createElement("div");t.innerText="Running in emulator mode. Do not use with production credentials.",t.style.position="fixed",t.style.width="100%",t.style.backgroundColor="#ffffff",t.style.border=".1em solid #000000",t.style.color="#ff0000",t.style.bottom="0px",t.style.left="0px",t.style.margin="0px",t.style.zIndex=1e4,t.style.textAlign="center",t.classList.add("firebase-emulator-warning"),l.document.body.appendChild(t)}),this.P={url:t,ec:e},this.settings.ib=!0,Qs(this.a,this.P),this.dispatchEvent(new $h(this.P))}var n},t.Gc=function(t){this.J.push(t),Xs(this.a,Xl.SDK_VERSION?gr(Xl.SDK_VERSION,this.J):null),this.dispatchEvent(new Zh(this.J))},t.Ga=function(){return z(this.J)},t.yb=function(t){this.S===t||this.l||(this.S=t,this.a.b=this.S)},t.T=function(){return this.S},t.toJSON=function(){return{apiKey:this.app.options.apiKey,authDomain:this.app.options.authDomain,appName:this.app.name,currentUser:ol(this)&&ol(this).w()}},t.Fb=function(t,e){switch(t){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==e&&!!this.f;default:return!1}},t.na=function(t,e,n,r){"signInViaPopup"==t&&this.g==r&&(n&&this.C?this.C(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.C)},t.Fa=function(t,e){return"signInViaRedirect"==t||"signInViaPopup"==t&&this.g==e&&this.f?m(this.ic,this):null},t.ic=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.$.then(function(){return il(i,ha(i.a,o))})},t.Xc=function(e){if(!wr())return we(new I("operation-not-supported-in-this-environment"));var n=this,t=Ui(e.providerId),r=Nr(),i=null,o=rr(i=(!Tr()||ur())&&this.app.options.authDomain&&e.isOAuthProvider?uu(this.app.options.authDomain,this.app.options.apiKey,this.app.name,"signInViaPopup",e,null,r,Xl.SDK_VERSION||null,null,null,this.T(),this.P):i,t&&t.ua,t&&t.ta);return ul(this,t=tl(this).then(function(t){return Ac(t,o,"signInViaPopup",e,r,!!i,n.T())}).then(function(){return new fe(function(t,e){n.na("signInViaPopup",null,new I("cancelled-popup-request"),n.g),n.f=t,n.C=e,n.g=r,n.c=Pc(n.b,n,"signInViaPopup",o,r)})}).then(function(t){return o&&nr(o),t?Vr(t):null}).o(function(t){throw o&&nr(o),t}))},t.Yc=function(t){if(!wr())return we(new I("operation-not-supported-in-this-environment"));var e=this;return ul(this,tl(this).then(function(){return Yh(t=e.i,function(){return t.b.set(Wh,t.c.F,t.a)});var t}).then(function(){return Rc(e.b,"signInViaRedirect",t,void 0,e.T())}))},t.qa=function(){var e=this;return el(this).then(function(t){return e.b&&Fc(e.b.b),t}).o(function(t){throw e.b&&Fc(e.b.b),t})},t.dd=function(t){if(!t)return we(new I("null-user"));if(this.S!=t.tenantId)return we(new I("tenant-id-mismatch"));var e=this,n={};n.apiKey=this.app.options.apiKey,n.authDomain=this.app.options.authDomain,n.appName=this.app.name;var r,i,o,s,a,u=(r=t,i=n,o=e.D,s=e.Ga(),a=r.b,(n={})[Bs]=a.b&&a.b.toString(),n.refreshToken=a.a,i=new hh(i||{apiKey:r.l,authDomain:r.s,appName:r.m},n),o&&(i.ha=o),s&&ph(i,s),Ah(i,r),i);return ul(this,this.h.then(function(){if(e.app.options.apiKey!=t.l)return u.reload()}).then(function(){return ol(e)&&t.uid==ol(e).uid?(Ah(ol(e),t),e.da(t)):(rl(e,u),wh(u),e.da(u))}).then(function(){al(e)}))},t.Ab=function(){var t=this,e=this.h.then(function(){return t.b&&Fc(t.b.b),ol(t)?(rl(t,null),zh(t.i).then(function(){al(t)})):be()});return ul(this,e)},t.Zc=function(){var r=this;return Qh(this.i,this.app.options.authDomain).then(function(t){if(!r.l){var e,n;if((e=ol(r)&&t)&&(e=ol(r).uid,n=t.uid,e=null!=e&&""!==e&&null!=n&&""!==n&&e==n),e)return Ah(ol(r),t),ol(r).I();(ol(r)||t)&&(rl(r,t),t&&(wh(t),t.ha=r.D),r.b&&Ec(r.b,r),al(r))}})},t.da=function(t){return Gh(this.i,t)},t.mc=function(){al(this),this.da(ol(this))},t.wc=function(){this.Ab()},t.xc=function(){this.Ab()},t.kc=function(t){var e=this;return this.h.then(function(){return il(e,be(t))})},t.zc=function(t){var e=this;this.addAuthTokenListener(function(){t.next(ol(e))})},t.Ac=function(t){var e,n,r=this;n=function(){t.next(ol(r))},(e=this).O.push(n),ul(e,e.h.then(function(){!e.l&&K(e.O,n)&&e.X!==e.getUid()&&(e.X=e.getUid(),n(sl(e)))}))},t.Ic=function(t,e,n){var r=this;return this.ba&&Promise.resolve().then(function(){"function"==typeof t?t(ol(r)):"function"==typeof t.next&&t.next(ol(r))}),this.hb(t,e,n)},t.Hc=function(t,e,n){var r=this;return this.ba&&Promise.resolve().then(function(){r.X=r.getUid(),"function"==typeof t?t(ol(r)):"function"==typeof t.next&&t.next(ol(r))}),this.bc(t,e,n)},t.nc=function(t){var e=this,n=this.h.then(function(){return ol(e)?ol(e).I(t).then(function(t){return{accessToken:t}}):null});return ul(this,n)},t.Tc=function(t){var n=this;return this.h.then(function(){return il(n,za(n.a,Va,{token:t}))}).then(function(t){var e=t.user;return Nh(e,"isAnonymous",!1),n.da(e),t})},t.Uc=function(t,e){var n=this;return this.h.then(function(){return il(n,za(n.a,Ba,{email:t,password:e}))})},t.dc=function(t,e){var n=this;return this.h.then(function(){return il(n,za(n.a,ga,{email:t,password:e}))})},t.$a=function(t){var e=this;return this.h.then(function(){return il(e,t.ka(e.a))})},t.Sc=function(t){return Fr("firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential is deprecated. Please use firebase.auth.Auth.prototype.signInWithCredential instead."),this.$a(t)},t.zb=function(){var n=this;return this.h.then(function(){var t=ol(n);if(t&&t.isAnonymous){var e=Vr({providerId:null,isNewUser:!1});return Vr({user:t,credential:null,additionalUserInfo:e,operationType:"signIn"})}return il(n,n.a.zb()).then(function(t){var e=t.user;return Nh(e,"isAnonymous",!0),n.da(e),t})})},t.getUid=function(){return ol(this)&&ol(this).uid||null},t.cc=function(t){this.addAuthTokenListener(t),this.u++,0<this.u&&ol(this)&&gh(ol(this))},t.Pc=function(e){var n=this;j(this.s,function(t){t==e&&n.u--}),this.u<0&&(this.u=0),0==this.u&&ol(this)&&yh(ol(this)),this.removeAuthTokenListener(e)},t.addAuthTokenListener=function(t){var e=this;this.s.push(t),ul(this,this.h.then(function(){e.l||K(e.s,t)&&t(sl(e))}))},t.removeAuthTokenListener=function(e){H(this.s,function(t){return t==e})},t.delete=function(){this.l=!0;for(var t=0;t<this.R.length;t++)this.R[t].cancel("app-deleted");return this.R=[],this.i&&(t=this.i).b.removeListener(Hh("local"),t.a,this.ja),this.b&&(Sc(this.b,this),Fc(this.b.b)),Promise.resolve()},t.hc=function(t){return ul(this,za(this.a,ya,{identifier:t,continueUri:_r()?Zn():"http://localhost"}).then(function(t){return t.signinMethods||[]}))},t.Bc=function(t){return!!Io(t)},t.wb=function(e,n){var r=this;return ul(this,be().then(function(){var t=new bi(n);if(!t.c)throw new I("argument-error",Ii+" must be true when sending sign in link to email");return ki(t)}).then(function(t){return r.a.wb(e,t)}).then(function(){}))},t.jd=function(t){return this.Ra(t).then(function(t){return t.data.email})},t.nb=function(t,e){return ul(this,this.a.nb(t,e).then(function(){}))},t.Ra=function(t){return ul(this,this.a.Ra(t).then(function(t){return new Xr(t)}))},t.jb=function(t){return ul(this,this.a.jb(t).then(function(){}))},t.vb=function(e,t){var n=this;return ul(this,be().then(function(){return void 0===t||ut(t)?{}:ki(new bi(t))}).then(function(t){return n.a.vb(e,t)}).then(function(){}))},t.Wc=function(t,e){return ul(this,Kc(this,t,e,m(this.$a,this)))},t.Vc=function(n,r){var i=this;return ul(this,be().then(function(){var t=r||Zn(),e=_o(n,t);if(!(t=Io(t)))throw new I("argument-error","Invalid email link!");if(t.tenantId!==i.T())throw new I("tenant-id-mismatch");return i.$a(e)}))},cl.prototype.render=function(){},cl.prototype.reset=function(){},cl.prototype.getResponse=function(){},cl.prototype.execute=function(){};var ll=null;function fl(t,e){return(e=pl(e))&&t.a[e]||null}function pl(t){return(t=void 0===t?1e12:t)?t.toString():null}function dl(t,e){this.g=!1,this.c=e,this.a=this.b=null,this.h="invisible"!==this.c.size,this.f=te(t);var n=this;this.i=function(){n.execute()},this.h?this.execute():$e(this.f,"click",this.i)}function vl(t){if(t.g)throw Error("reCAPTCHA mock was already deleted!")}function gl(){}function yl(){}hl.prototype.render=function(t,e){return this.a[this.b.toString()]=new dl(t,e),this.b++},hl.prototype.reset=function(t){var e=fl(this,t);t=pl(t),e&&t&&(e.delete(),delete this.a[t])},hl.prototype.getResponse=function(t){return(t=fl(this,t))?t.getResponse():null},hl.prototype.execute=function(t){(t=fl(this,t))&&t.execute()},dl.prototype.getResponse=function(){return vl(this),this.b},dl.prototype.execute=function(){vl(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))},dl.prototype.delete=function(){vl(this),this.g=!0,clearTimeout(this.a),this.a=null,en(this.f,"click",this.i)},jr(gl,"FACTOR_ID","phone"),yl.prototype.g=function(){return be(ll=ll||new hl)},yl.prototype.c=function(){};var ml=null;function bl(){this.b=l.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var wl=new pt(yt,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),_l=new Rr(3e4,6e4);bl.prototype.g=function(i){var o=this;return new fe(function(t,e){var r=setTimeout(function(){e(new I("network-request-failed"))},_l.get());!l.grecaptcha||i!==o.f&&!o.b?(l[o.a]=function(){var n;l.grecaptcha?(o.f=i,n=l.grecaptcha.render,l.grecaptcha.render=function(t,e){return t=n(t,e),o.b++,t},clearTimeout(r),t(l.grecaptcha)):(clearTimeout(r),e(new I("internal-error"))),delete l[o.a]},be(Ds(_t(wl,{onload:o.a,hl:i||""}))).o(function(){clearTimeout(r),e(new I("internal-error","Unable to load external reCAPTCHA dependencies!"))})):(clearTimeout(r),t(l.grecaptcha))})},bl.prototype.c=function(){this.b--};var Il=null;function Tl(t,e,n,r,i,o,s){if(jr(this,"type","recaptcha"),this.c=this.f=null,this.D=!1,this.v=e,this.g=null,s=s?ml=ml||new yl:Il=Il||new bl,this.m=s,this.a=n||{theme:"light",type:"image"},this.h=[],this.a[Cl])throw new I("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i="invisible"===this.a[Nl],!l.document)throw new I("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!te(e)||!this.i&&te(e).hasChildNodes())throw new I("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.s=new qs(t,o||null,i||null),this.u=r||function(){return null};var a=this;this.l=[];var u=this.a[El];this.a[El]=function(t){var e;Al(a,t),"function"==typeof u?u(t):"string"!=typeof u||"function"==typeof(e=mr(u,l))&&e(t)};var c=this.a[Sl];this.a[Sl]=function(){var t;Al(a,null),"function"==typeof c?c():"string"!=typeof c||"function"==typeof(t=mr(c,l))&&t()}}var El="callback",Sl="expired-callback",Cl="sitekey",Nl="size";function Al(t,e){for(var n=0;n<t.l.length;n++)try{t.l[n](e)}catch(t){}}function kl(t,e){return t.h.push(e),e.oa(function(){W(t.h,e)}),e}function Rl(t){if(t.D)throw new I("internal-error","RecaptchaVerifier instance has been destroyed.")}function Pl(t,e,n){var r=!1;try{this.b=n||Xl.app()}catch(t){throw new I("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.b.options||!this.b.options.apiKey)throw new I("invalid-api-key");n=this.b.options.apiKey;var i=this,o=null;try{o=this.b.auth().Ga()}catch(t){}try{r=this.b.auth().settings.appVerificationDisabledForTesting}catch(t){}o=Xl.SDK_VERSION?gr(Xl.SDK_VERSION,o):null,Tl.call(this,n,t,e,function(){try{var e=i.b.auth().la()}catch(t){e=null}return e},o,A(E),r)}function Ol(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 I("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].M(n[i])&&!o){if(e=e[i],i<0||i>=Dl.length)throw new I("internal-error","Argument validator received an unsupported number of arguments.");n=Dl[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.K+".";break t}r=null}}if(r)throw new I("argument-error",t+" failed: "+r)}(t=Tl.prototype).Ia=function(){var e=this;return this.f||(this.f=kl(this,be().then(function(){if(_r()&&!cr())return sr();throw new I("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return e.m.g(e.u())}).then(function(t){return e.g=t,za(e.s,Ra,{})}).then(function(t){e.a[Cl]=t.recaptchaSiteKey}).o(function(t){throw e.f=null,t})))},t.render=function(){Rl(this);var n=this;return kl(this,this.Ia().then(function(){var t,e;return null===n.c&&(e=n.v,n.i||(t=te(e),e=oe("DIV"),t.appendChild(e)),n.c=n.g.render(e,n.a)),n.c}))},t.verify=function(){Rl(this);var i=this;return kl(this,this.render().then(function(e){return new fe(function(n){var r,t=i.g.getResponse(e);t?n(t):(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(){Rl(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){Rl(this),this.D=!0,this.m.c();for(var t,e=0;e<this.h.length;e++)this.h[e].cancel("RecaptchaVerifier instance has been destroyed.");if(!this.i){e=te(this.v);for(;t=e.firstChild;)e.removeChild(t)}},w(Pl,Tl);var Dl="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function xl(t,e){return{name:t||"",K:"a valid string",optional:!!e,M:function(t){return"string"==typeof t}}}function Ll(t,e){return{name:t||"",K:"a boolean",optional:!!e,M:function(t){return"boolean"==typeof t}}}function Ml(t,e){return{name:t||"",K:"a valid object",optional:!!e,M:g}}function Fl(t,e){return{name:t||"",K:"a function",optional:!!e,M:function(t){return"function"==typeof t}}}function Ul(t,e){return{name:t||"",K:"null",optional:!!e,M:function(t){return null===t}}}function jl(n){return{name:n?n+"Credential":"credential",K:n?"a valid "+n+" credential":"a valid credential",optional:!1,M:function(t){if(!t)return!1;var e=!n||t.providerId===n;return!(!t.ka||!e)}}}function ql(){return{name:"multiFactorAssertion",K:"a valid multiFactorAssertion",optional:!1,M:function(t){return!!t&&!!t.sb}}}function Vl(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}}function Bl(t,e){return g(t)&&"string"==typeof t.type&&t.type===e&&"function"==typeof t.Ha}function Kl(t){return g(t)&&"string"==typeof t.uid}function Wl(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(t){return!(!t||"string"!=typeof t.type||"function"!=typeof t.verify)}}}function Hl(e,n,t,r){return{name:t||"",K:e.K+" or "+n.K,optional:!!r,M:function(t){return e.M(t)||n.M(t)}}}function Gl(t,e){for(var n in e){var r=e[n].name;t[r]=Yl(r,t[n],e[n].j)}}function zl(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){Ol(t,[n],[r],!0),this[e]=r},r,n,e[n].kb),enumerable:!0})}}function Ql(t,e,n,r){t[e]=Yl(e,n,r)}function Yl(t,e,n){function r(){var t=Array.prototype.slice.call(arguments);return Ol(o,n,t),e.apply(this,t)}if(!n)return e;var i,o=(t=(t=t).split("."))[t.length-1];for(i in e)r[i]=e[i];for(i in e.prototype)r.prototype[i]=e.prototype[i];return r}Gl(Xh.prototype,{jb:{name:"applyActionCode",j:[xl("code")]},Ra:{name:"checkActionCode",j:[xl("code")]},nb:{name:"confirmPasswordReset",j:[xl("code"),xl("newPassword")]},dc:{name:"createUserWithEmailAndPassword",j:[xl("email"),xl("password")]},hc:{name:"fetchSignInMethodsForEmail",j:[xl("email")]},qa:{name:"getRedirectResult",j:[]},Bc:{name:"isSignInWithEmailLink",j:[xl("emailLink")]},Hc:{name:"onAuthStateChanged",j:[Hl(Ml(),Fl(),"nextOrObserver"),Fl("opt_error",!0),Fl("opt_completed",!0)]},Ic:{name:"onIdTokenChanged",j:[Hl(Ml(),Fl(),"nextOrObserver"),Fl("opt_error",!0),Fl("opt_completed",!0)]},vb:{name:"sendPasswordResetEmail",j:[xl("email"),Hl(Ml("opt_actionCodeSettings",!0),Ul(null,!0),"opt_actionCodeSettings",!0)]},wb:{name:"sendSignInLinkToEmail",j:[xl("email"),Ml("actionCodeSettings")]},xb:{name:"setPersistence",j:[xl("persistence")]},Sc:{name:"signInAndRetrieveDataWithCredential",j:[jl()]},zb:{name:"signInAnonymously",j:[]},$a:{name:"signInWithCredential",j:[jl()]},Tc:{name:"signInWithCustomToken",j:[xl("token")]},Uc:{name:"signInWithEmailAndPassword",j:[xl("email"),xl("password")]},Vc:{name:"signInWithEmailLink",j:[xl("email"),xl("emailLink",!0)]},Wc:{name:"signInWithPhoneNumber",j:[xl("phoneNumber"),Wl()]},Xc:{name:"signInWithPopup",j:[Vl()]},Yc:{name:"signInWithRedirect",j:[Vl()]},dd:{name:"updateCurrentUser",j:[Hl({name:"user",K:"an instance of Firebase User",optional:!1,M:function(t){return!!(t&&t instanceof hh)}},Ul(),"user")]},Ab:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[xl(null,!0)]},fd:{name:"useDeviceLanguage",j:[]},gd:{name:"useEmulator",j:[xl("url"),Ml("options",!0)]},jd:{name:"verifyPasswordResetCode",j:[xl("code")]}}),zl(Xh.prototype,{lc:{name:"languageCode",kb:Hl(xl(),Ul(),"languageCode")},ti:{name:"tenantId",kb:Hl(xl(),Ul(),"tenantId")}}),(Xh.Persistence=Ku).LOCAL="local",Xh.Persistence.SESSION="session",Xh.Persistence.NONE="none",Gl(hh.prototype,{delete:{name:"delete",j:[]},oc:{name:"getIdTokenResult",j:[Ll("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[Ll("opt_forceRefresh",!0)]},Cc:{name:"linkAndRetrieveDataWithCredential",j:[jl()]},qb:{name:"linkWithCredential",j:[jl()]},Dc:{name:"linkWithPhoneNumber",j:[xl("phoneNumber"),Wl()]},Ec:{name:"linkWithPopup",j:[Vl()]},Fc:{name:"linkWithRedirect",j:[Vl()]},Lc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[jl()]},tb:{name:"reauthenticateWithCredential",j:[jl()]},Mc:{name:"reauthenticateWithPhoneNumber",j:[xl("phoneNumber"),Wl()]},Nc:{name:"reauthenticateWithPopup",j:[Vl()]},Oc:{name:"reauthenticateWithRedirect",j:[Vl()]},reload:{name:"reload",j:[]},ub:{name:"sendEmailVerification",j:[Hl(Ml("opt_actionCodeSettings",!0),Ul(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[xl(null,!0)]},cd:{name:"unlink",j:[xl("provider")]},Bb:{name:"updateEmail",j:[xl("email")]},Cb:{name:"updatePassword",j:[xl("password")]},ed:{name:"updatePhoneNumber",j:[jl("phone")]},Db:{name:"updateProfile",j:[Ml("profile")]},Eb:{name:"verifyBeforeUpdateEmail",j:[xl("email"),Hl(Ml("opt_actionCodeSettings",!0),Ul(null,!0),"opt_actionCodeSettings",!0)]}}),Gl(hl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Gl(cl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Gl(fe.prototype,{oa:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),zl(Vc.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",kb:Ll("appVerificationDisabledForTesting")}}),Gl(Bc.prototype,{confirm:{name:"confirm",j:[xl("verificationCode")]}}),Ql($i,"fromJSON",function(t){t="string"==typeof t?JSON.parse(t):t;for(var e,n=[oo,bo,Eo,no],r=0;r<n.length;r++)if(e=n[r](t))return e;return null},[Hl(xl(),Ml(),"json")]),Ql(wo,"credential",function(t,e){return new mo(t,e)},[xl("email"),xl("password")]),Gl(mo.prototype,{w:{name:"toJSON",j:[xl(null,!0)]}}),Gl(co.prototype,{Ca:{name:"addScope",j:[xl("scope")]},Ka:{name:"setCustomParameters",j:[Ml("customOAuthParameters")]}}),Ql(co,"credential",ho,[Hl(xl(),Ml(),"token")]),Ql(wo,"credentialWithLink",_o,[xl("email"),xl("emailLink")]),Gl(lo.prototype,{Ca:{name:"addScope",j:[xl("scope")]},Ka:{name:"setCustomParameters",j:[Ml("customOAuthParameters")]}}),Ql(lo,"credential",fo,[Hl(xl(),Ml(),"token")]),Gl(po.prototype,{Ca:{name:"addScope",j:[xl("scope")]},Ka:{name:"setCustomParameters",j:[Ml("customOAuthParameters")]}}),Ql(po,"credential",vo,[Hl(xl(),Hl(Ml(),Ul()),"idToken"),Hl(xl(),Ul(),"accessToken",!0)]),Gl(go.prototype,{Ka:{name:"setCustomParameters",j:[Ml("customOAuthParameters")]}}),Ql(go,"credential",yo,[Hl(xl(),Ml(),"token"),xl("secret",!0)]),Gl(uo.prototype,{Ca:{name:"addScope",j:[xl("scope")]},credential:{name:"credential",j:[Hl(xl(),Hl(Ml(),Ul()),"optionsOrIdToken"),Hl(xl(),Ul(),"accessToken",!0)]},Ka:{name:"setCustomParameters",j:[Ml("customOAuthParameters")]}}),Gl(ro.prototype,{w:{name:"toJSON",j:[xl(null,!0)]}}),Gl(to.prototype,{w:{name:"toJSON",j:[xl(null,!0)]}}),Ql(Co,"credential",No,[xl("verificationId"),xl("verificationCode")]),Gl(Co.prototype,{fb:{name:"verifyPhoneNumber",j:[Hl(xl(),{name:"phoneInfoOptions",K:"valid phone info options",optional:!1,M:function(t){return!!t&&(t.session&&t.phoneNumber?Bl(t.session,Xi)&&"string"==typeof t.phoneNumber:t.session&&t.multiFactorHint?Bl(t.session,Ji)&&Kl(t.multiFactorHint):t.session&&t.multiFactorUid?Bl(t.session,Ji)&&"string"==typeof t.multiFactorUid:!!t.phoneNumber&&"string"==typeof t.phoneNumber)}},"phoneInfoOptions"),Wl()]}}),Gl(To.prototype,{w:{name:"toJSON",j:[xl(null,!0)]}}),Gl(I.prototype,{toJSON:{name:"toJSON",j:[xl(null,!0)]}}),Gl(Mo.prototype,{toJSON:{name:"toJSON",j:[xl(null,!0)]}}),Gl(Lo.prototype,{toJSON:{name:"toJSON",j:[xl(null,!0)]}}),Gl(Qc.prototype,{toJSON:{name:"toJSON",j:[xl(null,!0)]}}),Gl(Hc.prototype,{Rc:{name:"resolveSignIn",j:[ql()]}}),Gl(th.prototype,{Rb:{name:"getSession",j:[]},fc:{name:"enroll",j:[ql(),xl("displayName",!0)]},bd:{name:"unenroll",j:[Hl({name:"multiFactorInfo",K:"a valid multiFactorInfo",optional:!1,M:Kl},xl(),"multiFactorInfoIdentifier")]}}),Gl(Pl.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),Ql(hi,"parseLink",mi,[xl("link")]),Ql(gl,"assertion",function(t){return new $c(t)},[jl("phone")]),function(){if(void 0===Xl||!Xl.INTERNAL||!Xl.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:$r,PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:Jr,VERIFY_AND_CHANGE_EMAIL:Zr,VERIFY_EMAIL:"VERIFY_EMAIL"}},Auth:Xh,AuthCredential:$i,Error:I};Ql(t,"EmailAuthProvider",wo,[]),Ql(t,"FacebookAuthProvider",co,[]),Ql(t,"GithubAuthProvider",lo,[]),Ql(t,"GoogleAuthProvider",po,[]),Ql(t,"TwitterAuthProvider",go,[]),Ql(t,"OAuthProvider",uo,[xl("providerId")]),Ql(t,"SAMLAuthProvider",ao,[xl("providerId")]),Ql(t,"PhoneAuthProvider",Co,[{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(t){return!!(t&&t instanceof Xh)}}]),Ql(t,"RecaptchaVerifier",Pl,[Hl(xl(),{name:"",K:"an HTML element",optional:!1,M:function(t){return!!(t&&t instanceof Element)}},"recaptchaContainer"),Ml("recaptchaParameters",!0),{name:"app",K:"an instance of Firebase App",optional:!0,M:function(t){return!!(t&&t instanceof Xl.app.App)}}]),Ql(t,"ActionCodeURL",hi,[]),Ql(t,"PhoneMultiFactorGenerator",gl,[]),Xl.INTERNAL.registerComponent({name:"auth",instanceFactory:function(t){return new Xh(t=t.getProvider("app").getImmediate())},multipleInstances:!1,serviceProps:t,instantiationMode:"LAZY",type:"PUBLIC"}),Xl.INTERNAL.registerComponent({name:"auth-internal",instanceFactory:function(t){return{getUid:m((t=t.getProvider("auth").getImmediate()).getUid,t),getToken:m(t.nc,t),addAuthTokenListener:m(t.cc,t),removeAuthTokenListener:m(t.Pc,t)}},multipleInstances:!1,instantiationMode:"LAZY",type:"PRIVATE"}),Xl.registerVersion("@firebase/auth","0.16.4"),Xl.INTERNAL.extendNamespace({User:hh})}()}.apply("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ps=(Os.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),Ro(e))},Os.prototype.get=function(t){t=this.domStorage_.getItem(this.prefixedName_(t));return null==t?null:ko(t)},Os.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},Os.prototype.prefixedName_=function(t){return this.prefix_+t},Os.prototype.toString=function(){return this.domStorage_.toString()},Os);function Os(t){this.domStorage_=t,this.prefix_="firebase:"}var Ds=(xs.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},xs.prototype.get=function(t){return Oo(this.cache_,t)?this.cache_[t]:null},xs.prototype.remove=function(t){delete this.cache_[t]},xs);function xs(){this.cache_={},this.isInMemoryStorage=!0}function Ls(t){var e=function(t){for(var e=[],n=0,r=0;r<t.length;r++){var i,o=t.charCodeAt(r);55296<=o&&o<=56319&&(i=o-55296,so(++r<t.length,"Surrogate pair missing trail surrogate."),o=65536+(i<<10)+(t.charCodeAt(r)-56320)),o<128?e[n++]=o:(o<2048?e[n++]=o>>6|192:(o<65536?e[n++]=o>>12|224:(e[n++]=o>>18|240,e[n++]=o>>12&63|128),e[n++]=o>>6&63|128),e[n++]=63&o|128)}return e}(t);return(t=new Fo).update(e),t=t.digest(),uo.encodeByteArray(t)}function Ms(t,e){so(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(Hs.logLevel=as.VERBOSE,Qs=Hs.log.bind(Hs),e&&Ws.set("logging_enabled",!0)):"function"==typeof t?Qs=t:(Qs=null,Ws.remove("logging_enabled"))}function Fs(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE INTERNAL ERROR: "+zs.apply(void 0,no([],eo(t)));Hs.error(n)}function Us(t){return"number"==typeof t&&(t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)}function js(t,e){return t===e?0:t<e?-1:1}function qs(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+Ro(e))}function Vs(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 Bs,Sn=function(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 Ps(e)}}catch(t){}return new Ds},Ks=Sn("localStorage"),Ws=Sn("sessionStorage"),Hs=new ps("@firebase/database"),Gs=(Bs=1,function(){return Bs++}),zs=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+=zs.apply(null,i):n+="object"==typeof i?Ro(i):i,n+=" "}return n},Qs=null,Ys=!0,Xs=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];!0===Ys&&(Ys=!1,null===Qs&&!0===Ws.get("logging_enabled")&&Ms(!0)),Qs&&(t=zs.apply(null,e),Qs(t))},Js=function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Xs.apply(void 0,no([n],eo(t)))}},$s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE FATAL ERROR: "+zs.apply(void 0,no([],eo(t)));throw Hs.error(n),new Error(n)},Zs=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE WARNING: "+zs.apply(void 0,no([],eo(t)));Hs.warn(n)},ta="[MIN_NAME]",ea="[MAX_NAME]",na=function(t,e){if(t===e)return 0;if(t===ta||e===ea)return-1;if(e===ta||t===ea)return 1;var n=la(t),r=la(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null===r&&t<e?-1:1},ra=function(t){if("object"!=typeof t||null===t)return Ro(t);var e,n=[];for(e in t)n.push(e);n.sort();for(var r="{",i=0;i<n.length;i++)0!==i&&(r+=","),r+=Ro(n[i]),r+=":",r+=ra(t[n[i]]);return r+="}"};function ia(t,e){for(var n in t)t.hasOwnProperty(n)&&e(n,t[n])}function oa(t){var e,n,r,i;so(!Us(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))));for(var o=[],s=52;s;--s)o.push(r%2?1:0),r=Math.floor(r/2);for(s=11;s;--s)o.push(n%2?1:0),n=Math.floor(n/2);o.push(e?1:0),o.reverse();var a=o.join(""),u="";for(s=0;s<64;s+=8){var c=parseInt(a.substr(s,8),2).toString(16);u+=c=1===c.length?"0"+c:c}return u.toLowerCase()}function sa(t,e){return"object"==typeof(e=setTimeout(t,e))&&e.unref&&e.unref(),e}var aa=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");n=new Error(t+" at "+e.path.toString()+": "+n);return n.code=t.toUpperCase(),n},ua=new RegExp("^-?(0*)\\d{1,10}$"),ca=-2147483648,ha=2147483647,la=function(t){if(ua.test(t)){t=Number(t);if(ca<=t&&t<=ha)return t}return null},fa=function(t){try{t()}catch(e){setTimeout(function(){var t=e.stack||"";throw Zs("Exception was thrown by user callback.",t),e},Math.floor(0))}},pa=(da.prototype.getToken=function(t){return this.auth_?this.auth_.getToken(t).catch(function(t){return t&&"auth/token-not-initialized"===t.code?(Xs("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t)}):Promise.resolve(null)},da.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)}))},da.prototype.removeTokenChangeListener=function(e){this.authProvider_.get().then(function(t){return t.removeAuthTokenListener(e)})},da.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/.',Zs(t)},da);function da(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 va=(ga.prototype.getToken=function(t){return Promise.resolve({accessToken:ga.EMULATOR_AUTH_TOKEN})},ga.prototype.addTokenChangeListener=function(t){t(ga.EMULATOR_AUTH_TOKEN)},ga.prototype.removeTokenChangeListener=function(t){},ga.prototype.notifyForInvalidToken=function(){},ga.EMULATOR_AUTH_TOKEN="owner",ga);function ga(){}var ya=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,ma="websocket",ba="long_polling",wa=(_a.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},_a.prototype.isCustomHost=function(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain},Object.defineProperty(_a.prototype,"host",{get:function(){return this._host},set:function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&Ks.set("host:"+this._host,this.internalHost))},enumerable:!1,configurable:!0}),_a.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},_a.prototype.toURLString=function(){var t=this.secure?"https://":"http://",e=this.includeNamespaceInQueryParams?"?ns="+this.namespace:"";return t+this.host+"/"+e},_a);function _a(t,e,n,r,i,o,s){void 0===i&&(i=!1),void 0===o&&(o=""),void 0===s&&(s=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=s,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=Ks.get("host:"+t)||this._host}function Ia(t,e,n){var r;if(so("string"==typeof e,"typeof type must == string"),so("object"==typeof n,"typeof params must == object"),e===ma)r=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else{if(e!==ba)throw new Error("Unknown connection type: "+e);r=(t.secure?"https://":"http://")+t.internalHost+"/.lp?"}((e=t).host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams)&&(n.ns=t.namespace);var i=[];return ia(n,function(t,e){i.push(t+"="+e)}),r+i.join("&")}var Ta=(Ea.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),Oo(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},Ea.prototype.get=function(){return co(this.counters_)},Ea);function Ea(){this.counters_={}}var Sa={},Ca={};function Na(t){t=t.toString();return Sa[t]||(Sa[t]=new Ta),Sa[t]}var Aa=(ka.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},ka.prototype.handleResponse=function(t,e){var n=this;this.pendingResponses[t]=e;for(var r=this;this.pendingResponses[this.currentResponseNum];)if("break"===function(){var e=r.pendingResponses[r.currentResponseNum];delete r.pendingResponses[r.currentResponseNum];for(var t=0;t<e.length;++t)!function(t){e[t]&&fa(function(){n.onMessage_(e[t])})}(t);if(r.currentResponseNum===r.closeAfterResponse)return r.onClose&&(r.onClose(),r.onClose=null),"break";r.currentResponseNum++}())break},ka);function ka(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}var Ra="pLPCommand",Pa="pRTLPCB",Oa=(Da.prototype.open=function(t,e){var n,r,i,s=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new Aa(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(function(){s.log_("Timed out trying to connect."),s.onClosed_(),s.connectTimeoutTimer_=null},Math.floor(3e4)),n=function(){var t;s.isClosed_||(s.scriptTagHolder=new xa(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=eo(t,5),r=n[0],i=n[1],o=n[2];n[3],n[4];if(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=eo(t,2),r=n[0],n=n[1];s.incrementIncomingBytes_(t),s.myPacketOrderer.handleResponse(r,n)},function(){s.onClosed_()},s.urlFn),(t={start:"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.hostname&&ya.test(location.hostname)&&(t.r="f"),t=s.urlFn(t),s.log_("Connecting via long-poll to "+t),s.scriptTagHolder.addTag(t,function(){}))},"complete"===document.readyState?n():(r=!1,i=function(){document.body?r||(r=!0,n()):setTimeout(i,Math.floor(10))},document.addEventListener?(document.addEventListener("DOMContentLoaded",i,!1),window.addEventListener("load",i,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&i()}),window.attachEvent("onload",i)))},Da.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},Da.forceAllow=function(){Da.forceAllow_=!0},Da.forceDisallow=function(){Da.forceDisallow_=!0},Da.isAvailable=function(){return!!Da.forceAllow_||!(Da.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)},Da.prototype.markConnectionHealthy=function(){},Da.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)},Da.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},Da.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},Da.prototype.send=function(t){t=Ro(t);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);for(var t=function(t){t=ro(t);return uo.encodeByteArray(t,!0)}(t),e=Vs(t,1840),n=0;n<e.length;n++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,e.length,e[n]),this.curSegmentNum++},Da.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)},Da.prototype.incrementIncomingBytes_=function(t){t=Ro(t).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)},Da);function Da(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_=Js(t),this.stats_=Na(e),this.urlFn=function(t){return Ia(e,ba,t)}}var xa=(La.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||Xs("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},La.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())},La.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},La.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 t=this.urlFn(t),e="",n=0;0<this.pendingSegs.length;){if(!(this.pendingSegs[0].d.length+30+e.length<=1870))break;var r=this.pendingSegs.shift(),e=e+"&seg"+n+"="+r.seg+"&ts"+n+"="+r.ts+"&d"+n+"="+r.d;n++}return t+=e,this.addLongPollTag_(t,this.currentSerial),!0}return!1},La.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},La.prototype.addLongPollTag_=function(t,e){var n=this;this.outstandingRequests.add(e);function r(){n.outstandingRequests.delete(e),n.newRequest_()}var i=setTimeout(r,Math.floor(25e3));this.addTag(t,function(){clearTimeout(i),r()})},La.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(){Xs("Long-poll script failed to load: "+t),r.sendNewPolls=!1,r.close()},r.myIFrame.doc.body.appendChild(e)}catch(t){}},Math.floor(1))},La);function La(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=Gs(),window[Ra+this.uniqueCallbackIdentifier]=t,window[Pa+this.uniqueCallbackIdentifier]=e,this.myIFrame=La.createIFrame_();var e="",i="<html><body>"+(e=this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length)?'<script>document.domain="'+document.domain+'";<\/script>':e)+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(i),this.myIFrame.doc.close()}catch(t){Xs("frame writing exception"),t.stack&&Xs(t.stack),Xs(t)}}var Ma="";function Fa(t){Ma=t}var Ua=null;"undefined"!=typeof MozWebSocket?Ua=MozWebSocket:"undefined"!=typeof WebSocket&&(Ua=WebSocket);var ja=(qa.connectionURL_=function(t,e,n){var r={v:"5"};return"undefined"!=typeof location&&location.hostname&&ya.test(location.hostname)&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),Ia(t,ma,r)},qa.prototype.open=function(e,t){var n,r=this;this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,Ks.set("previous_websocket_failure",!0);try{mo()||(n={headers:{"X-Firebase-GMPID":this.applicationId||""}},this.mySock=new Ua(this.connURL,[],n))}catch(t){this.log_("Error instantiating WebSocket.");e=t.message||t.data;return e&&this.log_(e),void this.onClosed_()}this.mySock.onopen=function(){r.log_("Websocket connected."),r.everConnected_=!0},this.mySock.onclose=function(){r.log_("Websocket connection was disconnected."),r.mySock=null,r.onClosed_()},this.mySock.onmessage=function(t){r.handleIncomingFrame(t)},this.mySock.onerror=function(t){r.log_("WebSocket error. Closing connection.");t=t.message||t.data;t&&r.log_(t),r.onClosed_()}},qa.prototype.start=function(){},qa.forceDisallow=function(){qa.forceDisallow_=!0},qa.isAvailable=function(){var t,e=!1;return"undefined"!=typeof navigator&&navigator.userAgent&&((t=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/))&&1<t.length&&parseFloat(t[1])<4.4&&(e=!0)),!e&&null!==Ua&&!qa.forceDisallow_},qa.previouslyFailed=function(){return Ks.isInMemoryStorage||!0===Ks.get("previous_websocket_failure")},qa.prototype.markConnectionHealthy=function(){Ks.remove("previous_websocket_failure")},qa.prototype.appendFrame_=function(t){this.frames.push(t),this.frames.length===this.totalFrames&&(t=this.frames.join(""),this.frames=null,t=ko(t),this.onMessage(t))},qa.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},qa.prototype.extractFrameCount_=function(t){if(so(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},qa.prototype.handleIncomingFrame=function(t){null!==this.mySock&&(t=t.data,this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),null!==this.frames?this.appendFrame_(t):null!==(t=this.extractFrameCount_(t))&&this.appendFrame_(t))},qa.prototype.send=function(t){this.resetKeepAlive();t=Ro(t);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);var e=Vs(t,16384);1<e.length&&this.sendString_(String(e.length));for(var n=0;n<e.length;n++)this.sendString_(e[n])},qa.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},qa.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},qa.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},qa.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.sendString_("0"),t.resetKeepAlive()},Math.floor(45e3))},qa.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)}},qa.responsesRequiredToBeHealthy=2,qa.healthyTimeout=3e4,qa);function qa(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_=Js(this.connId),this.stats_=Na(e),this.connURL=qa.connectionURL_(e,r,i),this.nodeAdmin=e.nodeAdmin}var Va=(Object.defineProperty(Ba,"ALL_TRANSPORTS",{get:function(){return[Oa,ja]},enumerable:!1,configurable:!0}),Ba.prototype.initTransports_=function(t){var e,n,r=ja&&ja.isAvailable(),i=r&&!ja.previouslyFailed();if(t.webSocketOnly&&(r||Zs("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[ja];else{var o=this.transports_=[];try{for(var s=to(Ba.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}}}},Ba.prototype.initialTransport=function(){if(0<this.transports_.length)return this.transports_[0];throw new Error("No transports available")},Ba.prototype.upgradeTransport=function(){return 1<this.transports_.length?this.transports_[1]:null},Ba);function Ba(t){this.initTransports_(t)}var Ka=(Wa.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));e=e.healthyTimeout||0;0<e&&(this.healthyTimeout_=sa(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(e)))},Wa.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},Wa.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")}},Wa.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"))}},Wa.prototype.sendRequest=function(t){t={t:"d",d:t};this.sendData_(t)},Wa.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)},Wa.prototype.onSecondaryControl_=function(t){"t"in t&&("a"===(t=t.t)?this.upgradeIfSecondaryHealthy_():"r"===t?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===t&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_()))},Wa.prototype.onSecondaryMessageReceived_=function(t){var e=qs("t",t),t=qs("d",t);if("c"===e)this.onSecondaryControl_(t);else{if("d"!==e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(t)}},Wa.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:{}}}))},Wa.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()},Wa.prototype.onPrimaryMessageReceived_=function(t){var e=qs("t",t),t=qs("d",t);"c"===e?this.onControl_(t):"d"===e&&this.onDataMessage_(t)},Wa.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},Wa.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},Wa.prototype.onControl_=function(t){var e=qs("t",t);if("d"in t){t=t.d;if("h"===e)this.onHandshake_(t);else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var n=0;n<this.pendingDataMessages.length;++n)this.onDataMessage_(this.pendingDataMessages[n]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.onConnectionShutdown_(t):"r"===e?this.onReset_(t):"e"===e?Fs("Server Error: "+t):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):Fs("Unknown control packet command: "+e)}},Wa.prototype.onHandshake_=function(t){var e=t.ts,n=t.v,r=t.h;this.sessionId=t.s,this.repoInfo_.host=r,0===this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,e),"5"!==n&&Zs("Protocol version mismatch detected"),this.tryStartUpgrade_())},Wa.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)},Wa.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_),t=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,t),sa(function(){e.secondaryConn_&&(e.log_("Timed out trying to upgrade."),e.secondaryConn_.close())},Math.floor(6e4))},Wa.prototype.onReset_=function(t){this.log_("Reset packet received. New host: "+t),this.repoInfo_.host=t,1===this.state_?this.close():(this.closeConnections_(),this.start_())},Wa.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):sa(function(){n.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))},Wa.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},Wa.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()},Wa.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()&&(Ks.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()},Wa.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()},Wa.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},Wa.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},Wa.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)},Wa);function Wa(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_=Js("c:"+this.id+":"),this.transportManager_=new Va(e),this.log_("Connection created"),this.start_()}Ha.prototype.put=function(t,e,n,r){},Ha.prototype.merge=function(t,e,n,r){},Ha.prototype.refreshAuthToken=function(t){},Ha.prototype.onDisconnectPut=function(t,e,n){},Ha.prototype.onDisconnectMerge=function(t,e,n){},Ha.prototype.onDisconnectCancel=function(t,e){},Ha.prototype.reportStats=function(t){},z=Ha;function Ha(){}var Ga=(za.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=no([],eo(this.listeners_[t])),i=0;i<r.length;i++)r[i].callback.apply(r[i].context,e)},za.prototype.on=function(t,e,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:e,context:n});t=this.getInitialEvent(t);t&&e.apply(n,t)},za.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)},za.prototype.validateEventType_=function(e){so(this.allowedEvents_.find(function(t){return t===e}),"Unknown event: "+e)},za);function za(t){this.allowedEvents_=t,this.listeners_={},so(Array.isArray(t)&&0<t.length,"Requires a non-empty array")}var Qa,Ya=(Xi(Xa,Qa=Ga),Xa.getInstance=function(){return new Xa},Xa.prototype.getInitialEvent=function(t){return so("online"===t,"Unknown event type: "+t),[this.online_]},Xa.prototype.currentlyOnline=function(){return this.online_},Xa);function Xa(){var t=Qa.call(this,["online"])||this;return t.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||vo()||(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 Ja=32,$a=768,Za=(tu.prototype.toString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"},tu);function tu(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}function eu(){return new Za("")}function nu(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function ru(t){return t.pieces_.length-t.pieceNum_}function iu(t){var e=t.pieceNum_;return e<t.pieces_.length&&e++,new Za(t.pieces_,e)}function ou(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function su(t,e){return void 0===e&&(e=0),t.pieces_.slice(t.pieceNum_+e)}function au(t){if(t.pieceNum_>=t.pieces_.length)return null;for(var e=[],n=t.pieceNum_;n<t.pieces_.length-1;n++)e.push(t.pieces_[n]);return new Za(e,0)}function uu(t,e){for(var n=[],r=t.pieceNum_;r<t.pieces_.length;r++)n.push(t.pieces_[r]);if(e instanceof Za)for(r=e.pieceNum_;r<e.pieces_.length;r++)n.push(e.pieces_[r]);else for(var i=e.split("/"),r=0;r<i.length;r++)0<i[r].length&&n.push(i[r]);return new Za(n,0)}function cu(t){return t.pieceNum_>=t.pieces_.length}function hu(t,e){var n=nu(t),r=nu(e);if(null===n)return e;if(n===r)return hu(iu(t),iu(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function lu(t,e){for(var n=su(t,0),r=su(e,0),i=0;i<n.length&&i<r.length;i++){var o=na(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length<r.length?-1:1}function fu(t,e){if(ru(t)!==ru(e))return!1;for(var n=t.pieceNum_,r=e.pieceNum_;n<=t.pieces_.length;n++,r++)if(t.pieces_[n]!==e.pieces_[r])return!1;return!0}function pu(t,e){var n=t.pieceNum_,r=e.pieceNum_;if(ru(t)>ru(e))return!1;for(;n<t.pieces_.length;){if(t.pieces_[n]!==e.pieces_[r])return!1;++n,++r}return!0}var du=function(t,e){this.errorPrefix_=e,this.parts_=su(t,0),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n<this.parts_.length;n++)this.byteLength_+=zo(this.parts_[n]);vu(this)};function vu(t){if(t.byteLength_>$a)throw new Error(t.errorPrefix_+"has a key path longer than "+$a+" bytes ("+t.byteLength_+").");if(t.parts_.length>Ja)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Ja+") or object contains a cycle "+gu(t))}function gu(t){return 0===t.parts_.length?"":"in property '"+t.parts_.join(".")+"'"}var yu,mu=(Xi(bu,yu=Ga),bu.getInstance=function(){return new bu},bu.prototype.getInitialEvent=function(t){return so("visible"===t,"Unknown event type: "+t),[this.visible_]},bu);function bu(){var e,t,n=yu.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 wu,_u=1e3,Iu=3e5,Tu=(Xi(Eu,wu=z),Eu.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,e={r:r,a:t,b:e};this.log_(Ro(e)),so(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(e),n&&(this.requestCBHash_[r]=n)},Eu.prototype.get=function(t){var n=this,r=new lo,i={p:t.path.toString(),q:t.queryObject()},e={action:"g",request:i,onComplete:function(t){var e=t.d;"ok"===t.s?(n.onDataUpdate_(i.p,e,!1,null),r.resolve(e)):r.reject(e)}};this.outstandingGets_.push(e),this.outstandingGetCount_++;var o=this.outstandingGets_.length-1;return this.connected_||setTimeout(function(){var t=n.outstandingGets_[o];void 0!==t&&e===t&&(delete n.outstandingGets_[o],n.outstandingGetCount_--,0===n.outstandingGetCount_&&(n.outstandingGets_=[]),n.log_("get "+o+" timed out on connection"),r.reject(new Error("Client is offline.")))},3e3),this.connected_&&this.sendGet_(o),r.promise},Eu.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),so(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),so(!this.listens.get(o).has(i),"listen() called twice for same path/queryId.");n={onComplete:r,hashFn:e,query:t,tag:n};this.listens.get(o).set(i,n),this.connected_&&this.sendListen_(n)},Eu.prototype.sendGet_=function(e){var n=this,r=this.outstandingGets_[e];this.sendRequest("g",r.request,function(t){delete n.outstandingGets_[e],n.outstandingGetCount_--,0===n.outstandingGetCount_&&(n.outstandingGets_=[]),r.onComplete&&r.onComplete(t)})},Eu.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;Eu.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))})},Eu.warnOnListenWarnings_=function(t,e){t&&"object"==typeof t&&Oo(t,"w")&&(t=Do(t,"w"),Array.isArray(t)&&~t.indexOf("no_index")&&(t='".indexOn": "'+e.getQueryParams().getIndex().toString()+'"',e=e.path.toString(),Zs("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding "+t+" at "+e+" to your security rules for better performance.")))},Eu.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)},Eu.prototype.reduceReconnectDelayIfAdminCredential_=function(t){(t&&40===t.length||function(t){t=Po(t).claims;return"object"==typeof t&&!0===t.admin}(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},Eu.prototype.tryAuth=function(){var n,t,e,r=this;this.connected_&&this.authToken_&&(t=function(t){t=Po(t).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")}(n=this.authToken_)?"auth":"gauth",e={cred:n},null===this.authOverride_?e.noauth=!0:"object"==typeof this.authOverride_&&(e.authvar=this.authOverride_),this.sendRequest(t,e,function(t){var e=t.s,t=t.d||"error";r.authToken_===n&&("ok"===e?r.invalidAuthTokenCount_=0:r.onAuthRevoked_(e,t))}))},Eu.prototype.unlisten=function(t,e){var n=t.path.toString(),r=t.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),so(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)},Eu.prototype.sendUnlisten_=function(t,e,n,r){this.log_("Unlisten on "+t+" for "+e);t={p:t};r&&(t.q=n,t.t=r),this.sendRequest("n",t)},Eu.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})},Eu.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})},Eu.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},Eu.prototype.sendOnDisconnect_=function(t,e,n,r){n={p:e,d:n};this.log_("onDisconnect "+t,n),this.sendRequest(t,n,function(t){r&&setTimeout(function(){r(t.s,t.d)},Math.floor(0))})},Eu.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},Eu.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},Eu.prototype.putInternal=function(t,e,n,r,i){n={p:e,d:n};void 0!==i&&(n.h=i),this.outstandingPuts_.push({action:t,request:n,onComplete:r}),this.outstandingPutCount_++;r=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(r):this.log_("Buffering put: "+e)},Eu.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)})},Eu.prototype.reportStats=function(t){var e=this;this.connected_&&(t={c:t},this.log_("reportStats",t),this.sendRequest("s",t,function(t){"ok"!==t.s&&(t=t.d,e.log_("reportStats","Error sending stats: "+t))}))},Eu.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+Ro(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)}},Eu.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):Fs("Unrecognized action received from server: "+Ro(t)+"\nAre you using the latest client?")},Eu.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)},Eu.prototype.scheduleConnect_=function(t){var e=this;so(!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))},Eu.prototype.onVisible_=function(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=_u,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},Eu.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=_u,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())},Eu.prototype.onRealtimeDisconnect_=function(){var t;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_=_u),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime()),t=(new Date).getTime()-this.lastConnectionAttemptTime_,t=Math.max(0,this.reconnectDelay_-t),t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)),this.onConnectStatus_(!1)},Eu.prototype.establishConnection_=function(){var e,n,r,i,o,s,a,u,c,t,h=this;this.shouldReconnect_()&&(this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null,e=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+Eu.nextConnectionId_++,s=(o=this).lastSessionId,a=!1,u=null,c=function(){u?u.close():(a=!0,r())},this.realtime_={close:c,sendRequest:function(t){so(u,"sendRequest call when we're not connected not allowed."),u.sendRequest(t)}},t=this.forceTokenRefresh_,this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(t).then(function(t){a?Xs("getToken() completed but was canceled"):(Xs("getToken() completed. Creating connection."),o.authToken_=t&&t.accessToken,u=new Ka(i,o.repoInfo_,o.applicationId_,e,n,r,function(t){Zs(t+" ("+o.repoInfo_.toString()+")"),o.interrupt("server_kill")},s))}).then(null,function(t){o.log_("Failed to get token: "+t),a||(h.repoInfo_.nodeAdmin&&Zs(t),c())}))},Eu.prototype.interrupt=function(t){Xs("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_())},Eu.prototype.resume=function(t){Xs("Resuming connection for reason: "+t),delete this.interruptReasons_[t],xo(this.interruptReasons_)&&(this.reconnectDelay_=_u,this.realtime_||this.scheduleConnect_(0))},Eu.prototype.handleTimestamp_=function(t){t-=(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:t})},Eu.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_=[])},Eu.prototype.onListenRevoked_=function(t,e){e=e?e.map(function(t){return ra(t)}).join("$"):"default",e=this.removeListen_(t,e);e&&e.onComplete&&e.onComplete("permission_denied")},Eu.prototype.removeListen_=function(t,e){var n,r=new Za(t).toString();return this.listens.has(r)?(n=(t=this.listens.get(r)).get(e),t.delete(e),0===t.size&&this.listens.delete(r)):n=void 0,n},Eu.prototype.onAuthRevoked_=function(t,e){Xs("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()))},Eu.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},Eu.prototype.restoreState_=function(){var e,t,n,r;this.tryAuth();try{for(var i=to(this.listens.values()),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,to(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)}for(h=0;h<this.outstandingGets_.length;h++)this.outstandingGets_[h]&&this.sendGet_(h)},Eu.prototype.sendConnectStats_=function(){var t={};t["sdk.js."+Ma.replace(/\./g,"-")]=1,vo()?t["framework.cordova"]=1:yo()&&(t["framework.reactnative"]=1),this.reportStats(t)},Eu.prototype.shouldReconnect_=function(){var t=Ya.getInstance().currentlyOnline();return xo(this.interruptReasons_)&&t},Eu.nextPersistentConnectionId_=0,Eu.nextConnectionId_=0,Eu);function Eu(t,e,n,r,i,o,s){var a=wu.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=Eu.nextPersistentConnectionId_++,a.log_=Js("p:"+a.id+":"),a.interruptReasons_={},a.listens=new Map,a.outstandingPuts_=[],a.outstandingGets_=[],a.outstandingPutCount_=0,a.outstandingGetCount_=0,a.onDisconnectRequestQueue_=[],a.connected_=!1,a.reconnectDelay_=_u,a.maxReconnectDelay_=Iu,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&&!mo())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return a.scheduleConnect_(0),mu.getInstance().on("visible",a.onVisible_,a),-1===t.host.indexOf("fblocal")&&Ya.getInstance().on("online",a.onOnline_,a),a}var Su=(Cu.Wrap=function(t,e){return new Cu(t,e)},Cu);function Cu(t,e){this.name=t,this.node=e}var Nu,G=(Au.prototype.getCompare=function(){return this.compare.bind(this)},Au.prototype.indexedValueChanged=function(t,e){t=new Su(ta,t),e=new Su(ta,e);return 0!==this.compare(t,e)},Au.prototype.minPost=function(){return Su.MIN},Au);function Au(){}var ku,Sn=(Xi(Ru,ku=G),Object.defineProperty(Ru,"__EMPTY_NODE",{get:function(){return Nu},set:function(t){Nu=t},enumerable:!1,configurable:!0}),Ru.prototype.compare=function(t,e){return na(t.name,e.name)},Ru.prototype.isDefinedOn=function(t){throw ao("KeyIndex.isDefinedOn not expected to be called.")},Ru.prototype.indexedValueChanged=function(t,e){return!1},Ru.prototype.minPost=function(){return Su.MIN},Ru.prototype.maxPost=function(){return new Su(ea,Nu)},Ru.prototype.makePost=function(t,e){return so("string"==typeof t,"KeyIndex indexValue must always be a string."),new Su(t,Nu)},Ru.prototype.toString=function(){return".key"},Ru);function Ru(){return null!==ku&&ku.apply(this,arguments)||this}var Pu=new Sn,Ou=(Du.prototype.getNext=function(){if(0===this.nodeStack_.length)return null;var t=this.nodeStack_.pop(),e=this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value};if(this.isReverse_)for(t=t.left;!t.isEmpty();)this.nodeStack_.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack_.push(t),t=t.left;return e},Du.prototype.hasNext=function(){return 0<this.nodeStack_.length},Du.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}},Du);function Du(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(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 xu=(Lu.prototype.copy=function(t,e,n,r,i){return new Lu(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)},Lu.prototype.count=function(){return this.left.count()+1+this.right.count()},Lu.prototype.isEmpty=function(){return!1},Lu.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)},Lu.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},Lu.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},Lu.prototype.minKey=function(){return this.min_().key},Lu.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},Lu.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_()},Lu.prototype.removeMin_=function(){if(this.left.isEmpty())return Uu.EMPTY_NODE;var t=this;return(t=(t=!t.left.isRed_()&&!t.left.left.isRed_()?t.moveRedLeft_():t).copy(null,null,null,t.left.removeMin_(),null)).fixUp_()},Lu.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r=(r=!(r.left.isEmpty()||r.left.isRed_()||r.left.left.isRed_())?r.moveRedLeft_():r).copy(null,null,null,r.left.remove(t,e),null);else{if(0===e(t,(r=!((r=r.left.isRed_()?r.rotateRight_():r).right.isEmpty()||r.right.isRed_()||r.right.left.isRed_())?r.moveRedRight_():r).key)){if(r.right.isEmpty())return Uu.EMPTY_NODE;n=r.right.min_(),r=r.copy(n.key,n.value,null,null,r.right.removeMin_())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp_()},Lu.prototype.isRed_=function(){return this.color},Lu.prototype.fixUp_=function(){var t=this;return t=(t=(t=t.right.isRed_()&&!t.left.isRed_()?t.rotateLeft_():t).left.isRed_()&&t.left.left.isRed_()?t.rotateRight_():t).left.isRed_()&&t.right.isRed_()?t.colorFlip_():t},Lu.prototype.moveRedLeft_=function(){var t=this.colorFlip_();return t=t.right.left.isRed_()?(t=(t=t.copy(null,null,null,null,t.right.rotateRight_())).rotateLeft_()).colorFlip_():t},Lu.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t=t.left.left.isRed_()?(t=t.rotateRight_()).colorFlip_():t},Lu.prototype.rotateLeft_=function(){var t=this.copy(null,null,Lu.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},Lu.prototype.rotateRight_=function(){var t=this.copy(null,null,Lu.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},Lu.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)},Lu.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},Lu.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)},Lu.RED=!0,Lu.BLACK=!1,Lu);function Lu(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:Lu.RED,this.left=null!=r?r:Uu.EMPTY_NODE,this.right=null!=i?i:Uu.EMPTY_NODE}Mu.prototype.copy=function(t,e,n,r,i){return this},Mu.prototype.insert=function(t,e,n){return new xu(t,e,null)},Mu.prototype.remove=function(t,e){return this},Mu.prototype.count=function(){return 0},Mu.prototype.isEmpty=function(){return!0},Mu.prototype.inorderTraversal=function(t){return!1},Mu.prototype.reverseTraversal=function(t){return!1},Mu.prototype.minKey=function(){return null},Mu.prototype.maxKey=function(){return null},Mu.prototype.check_=function(){return 0},Mu.prototype.isRed_=function(){return!1},Ga=Mu;function Mu(){}var Fu,Uu=(ju.prototype.insert=function(t,e){return new ju(this.comparator_,this.root_.insert(t,e,this.comparator_).copy(null,null,xu.BLACK,null,null))},ju.prototype.remove=function(t){return new ju(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,xu.BLACK,null,null))},ju.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},ju.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?")},ju.prototype.isEmpty=function(){return this.root_.isEmpty()},ju.prototype.count=function(){return this.root_.count()},ju.prototype.minKey=function(){return this.root_.minKey()},ju.prototype.maxKey=function(){return this.root_.maxKey()},ju.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},ju.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},ju.prototype.getIterator=function(t){return new Ou(this.root_,null,this.comparator_,!1,t)},ju.prototype.getIteratorFrom=function(t,e){return new Ou(this.root_,t,this.comparator_,!1,e)},ju.prototype.getReverseIteratorFrom=function(t,e){return new Ou(this.root_,t,this.comparator_,!0,e)},ju.prototype.getReverseIterator=function(t){return new Ou(this.root_,null,this.comparator_,!0,t)},ju.EMPTY_NODE=new Ga,ju);function ju(t,e){void 0===e&&(e=ju.EMPTY_NODE),this.comparator_=t,this.root_=e}function qu(t,e){return na(t.name,e.name)}function Vu(t,e){return na(t,e)}function Bu(t){return"number"==typeof t?"number:"+oa(t):"string:"+t}var Ku,Wu,Hu,Gu,zu=function(t){var e;t.isLeafNode()?(e=t.val(),so("string"==typeof e||"number"==typeof e||"object"==typeof e&&Oo(e,".sv"),"Priority must be a string or number.")):so(t===Fu||t.isEmpty(),"priority of unexpected type."),so(t===Fu||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},Qu=(Object.defineProperty(Yu,"__childrenNodeConstructor",{get:function(){return Ku},set:function(t){Ku=t},enumerable:!1,configurable:!0}),Yu.prototype.isLeafNode=function(){return!0},Yu.prototype.getPriority=function(){return this.priorityNode_},Yu.prototype.updatePriority=function(t){return new Yu(this.value_,t)},Yu.prototype.getImmediateChild=function(t){return".priority"===t?this.priorityNode_:Yu.__childrenNodeConstructor.EMPTY_NODE},Yu.prototype.getChild=function(t){return cu(t)?this:".priority"===nu(t)?this.priorityNode_:Yu.__childrenNodeConstructor.EMPTY_NODE},Yu.prototype.hasChild=function(){return!1},Yu.prototype.getPredecessorChildName=function(t,e){return null},Yu.prototype.updateImmediateChild=function(t,e){return".priority"===t?this.updatePriority(e):e.isEmpty()&&".priority"!==t?this:Yu.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,e).updatePriority(this.priorityNode_)},Yu.prototype.updateChild=function(t,e){var n=nu(t);return null===n?e:e.isEmpty()&&".priority"!==n?this:(so(".priority"!==n||1===ru(t),".priority must be the last token in a path"),this.updateImmediateChild(n,Yu.__childrenNodeConstructor.EMPTY_NODE.updateChild(iu(t),e)))},Yu.prototype.isEmpty=function(){return!1},Yu.prototype.numChildren=function(){return 0},Yu.prototype.forEachChild=function(t,e){return!1},Yu.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},Yu.prototype.hash=function(){var t,e;return null===this.lazyHash_&&(t="",this.priorityNode_.isEmpty()||(t+="priority:"+Bu(this.priorityNode_.val())+":"),t+=(e=typeof this.value_)+":",t+="number"==e?oa(this.value_):this.value_,this.lazyHash_=Ls(t)),this.lazyHash_},Yu.prototype.getValue=function(){return this.value_},Yu.prototype.compareTo=function(t){return t===Yu.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof Yu.__childrenNodeConstructor?-1:(so(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))},Yu.prototype.compareToLeafNode_=function(t){var e=typeof t.value_,n=typeof this.value_,r=Yu.VALUE_TYPE_ORDER.indexOf(e),i=Yu.VALUE_TYPE_ORDER.indexOf(n);return so(0<=r,"Unknown leaf type: "+e),so(0<=i,"Unknown leaf type: "+n),r===i?"object"==n?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:i-r},Yu.prototype.withIndex=function(){return this},Yu.prototype.isIndexed=function(){return!0},Yu.prototype.equals=function(t){return t===this||!!t.isLeafNode()&&(this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_))},Yu.VALUE_TYPE_ORDER=["object","boolean","number","string"],Yu);function Yu(t,e){void 0===e&&(e=Yu.__childrenNodeConstructor.EMPTY_NODE),this.value_=t,this.priorityNode_=e,this.lazyHash_=null,so(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),zu(this.priorityNode_)}function Xu(){return null!==Gu&&Gu.apply(this,arguments)||this}var Ju=new(Xi(Xu,Gu=G),Xu.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),r=n.compareTo(r);return 0===r?na(t.name,e.name):r},Xu.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},Xu.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},Xu.prototype.minPost=function(){return Su.MIN},Xu.prototype.maxPost=function(){return new Su(ea,new Qu("[PRIORITY-POST]",Hu))},Xu.prototype.makePost=function(t,e){t=Wu(t);return new Su(e,new Qu("[PRIORITY-POST]",t))},Xu.prototype.toString=function(){return".priority"},Xu),$u=Math.log(2),Zu=(tc.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<<this.current_);return this.current_--,t},tc);function tc(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/$u,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 ec,nc,rc=function(c,t,h,e){c.sort(t);var l=function(t,e){var n=e-t;if(0==n)return null;if(1==n)return r=c[t],i=h?h(r):r,new xu(i,r.node,xu.BLACK,null,null);var n=parseInt(n/2,10)+t,t=l(t,n),e=l(n+1,e),r=c[n],i=h?h(r):r;return new xu(i,r.node,xu.BLACK,t,e)},n=function(t){for(var e=null,n=null,i=c.length,r=function(t,e){var n=i-t,r=i;i-=t;t=l(1+n,r),r=c[n],n=h?h(r):r;o(new xu(n,r.node,e,null,t))},o=function(t){e=e?e.left=t:n=t},s=0;s<t.count;++s){var a=t.nextBitIsOne(),u=Math.pow(2,t.count-(s+1));a?r(u,xu.BLACK):(r(u,xu.BLACK),r(u,xu.RED))}return n}(new Zu(c.length));return new Uu(e||t,n)},ic={},oc=(Object.defineProperty(sc,"Default",{get:function(){return so(Ju,"ChildrenNode.ts has not been loaded"),ec=ec||new sc({".priority":ic},{".priority":Ju})},enumerable:!1,configurable:!0}),sc.prototype.get=function(t){var e=Do(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e instanceof Uu?e:null},sc.prototype.hasIndex=function(t){return Oo(this.indexSet_,t.toString())},sc.prototype.addIndex=function(t,e){so(t!==Pu,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var n=[],r=!1,i=e.getIterator(Su.Wrap),o=i.getNext();o;)r=r||t.isDefinedOn(o.node),n.push(o),o=i.getNext();var s=r?rc(n,t.getCompare()):ic,a=t.toString(),u=Ji({},this.indexSet_);u[a]=t;e=Ji({},this.indexes_);return e[a]=s,new sc(e,u)},sc.prototype.addToIndexes=function(s,a){var u=this;return new sc(Lo(this.indexes_,function(t,e){var n=Do(u.indexSet_,e);if(so(n,"Missing index implementation for "+e),t===ic){if(n.isDefinedOn(s.node)){for(var r=[],i=a.getIterator(Su.Wrap),o=i.getNext();o;)o.name!==s.name&&r.push(o),o=i.getNext();return r.push(s),rc(r,n.getCompare())}return ic}n=a.get(s.name);return(t=n?t.remove(new Su(s.name,n)):t).insert(s,s.node)}),this.indexSet_)},sc.prototype.removeFromIndexes=function(n,r){return new sc(Lo(this.indexes_,function(t){if(t===ic)return t;var e=r.get(n.name);return e?t.remove(new Su(n.name,e)):t}),this.indexSet_)},sc);function sc(t,e){this.indexes_=t,this.indexSet_=e}var ac,uc=(Object.defineProperty(cc,"EMPTY_NODE",{get:function(){return nc=nc||new cc(new Uu(Vu),null,oc.Default)},enumerable:!1,configurable:!0}),cc.prototype.isLeafNode=function(){return!1},cc.prototype.getPriority=function(){return this.priorityNode_||nc},cc.prototype.updatePriority=function(t){return this.children_.isEmpty()?this:new cc(this.children_,t,this.indexMap_)},cc.prototype.getImmediateChild=function(t){if(".priority"===t)return this.getPriority();t=this.children_.get(t);return null===t?nc:t},cc.prototype.getChild=function(t){var e=nu(t);return null===e?this:this.getImmediateChild(e).getChild(iu(t))},cc.prototype.hasChild=function(t){return null!==this.children_.get(t)},cc.prototype.updateImmediateChild=function(t,e){if(so(e,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(e);var n=new Su(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_)),n=r.isEmpty()?nc:this.priorityNode_;return new cc(r,n,i)},cc.prototype.updateChild=function(t,e){var n=nu(t);if(null===n)return e;so(".priority"!==nu(t)||1===ru(t),".priority must be the last token in a path");e=this.getImmediateChild(n).updateChild(iu(t),e);return this.updateImmediateChild(n,e)},cc.prototype.isEmpty=function(){return this.children_.isEmpty()},cc.prototype.numChildren=function(){return this.children_.count()},cc.prototype.val=function(n){if(this.isEmpty())return null;var r={},i=0,o=0,s=!0;if(this.forEachChild(Ju,function(t,e){r[t]=e.val(n),i++,s&&cc.INTEGER_REGEXP_.test(t)?o=Math.max(o,Number(t)):s=!1}),!n&&s&&o<2*i){var t,e=[];for(t in r)e[t]=r[t];return e}return n&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r},cc.prototype.hash=function(){var n;return null===this.lazyHash_&&(n="",this.getPriority().isEmpty()||(n+="priority:"+Bu(this.getPriority().val())+":"),this.forEachChild(Ju,function(t,e){e=e.hash();""!==e&&(n+=":"+t+":"+e)}),this.lazyHash_=""===n?"":Ls(n)),this.lazyHash_},cc.prototype.getPredecessorChildName=function(t,e,n){n=this.resolveIndex_(n);if(n){e=n.getPredecessorKey(new Su(t,e));return e?e.name:null}return this.children_.getPredecessorKey(t)},cc.prototype.getFirstChildName=function(t){t=this.resolveIndex_(t);if(t){t=t.minKey();return t&&t.name}return this.children_.minKey()},cc.prototype.getFirstChild=function(t){t=this.getFirstChildName(t);return t?new Su(t,this.children_.get(t)):null},cc.prototype.getLastChildName=function(t){t=this.resolveIndex_(t);if(t){t=t.maxKey();return t&&t.name}return this.children_.maxKey()},cc.prototype.getLastChild=function(t){t=this.getLastChildName(t);return t?new Su(t,this.children_.get(t)):null},cc.prototype.forEachChild=function(t,e){t=this.resolveIndex_(t);return t?t.inorderTraversal(function(t){return e(t.name,t.node)}):this.children_.inorderTraversal(e)},cc.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},cc.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,Su.Wrap),i=r.peek();null!=i&&e.compare(i,t)<0;)r.getNext(),i=r.peek();return r},cc.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},cc.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,Su.Wrap),i=r.peek();null!=i&&0<e.compare(i,t);)r.getNext(),i=r.peek();return r},cc.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===lc?-1:0},cc.prototype.withIndex=function(t){if(t===Pu||this.indexMap_.hasIndex(t))return this;t=this.indexMap_.addIndex(t,this.children_);return new cc(this.children_,this.priorityNode_,t)},cc.prototype.isIndexed=function(t){return t===Pu||this.indexMap_.hasIndex(t)},cc.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;if(this.getPriority().equals(t.getPriority())){if(this.children_.count()!==t.children_.count())return!1;for(var e=this.getIterator(Ju),n=t.getIterator(Ju),r=e.getNext(),i=n.getNext();r&&i;){if(r.name!==i.name||!r.node.equals(i.node))return!1;r=e.getNext(),i=n.getNext()}return null===r&&null===i}return!1},cc.prototype.resolveIndex_=function(t){return t===Pu?null:this.indexMap_.get(t.toString())},cc.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,cc);function cc(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&zu(this.priorityNode_),this.children_.isEmpty()&&so(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}function hc(){return ac.call(this,new Uu(Vu),uc.EMPTY_NODE,oc.Default)||this}var lc=new(Xi(hc,ac=uc),hc.prototype.compareTo=function(t){return t===this?0:1},hc.prototype.equals=function(t){return t===this},hc.prototype.getPriority=function(){return this},hc.prototype.getImmediateChild=function(t){return uc.EMPTY_NODE},hc.prototype.isEmpty=function(){return!1},hc);Object.defineProperties(Su,{MIN:{value:new Su(ta,uc.EMPTY_NODE)},MAX:{value:new Su(ea,lc)}}),Sn.__EMPTY_NODE=uc.EMPTY_NODE,Qu.__childrenNodeConstructor=uc,Fu=lc,Hu=lc;var fc=!0;function pc(n,t){if(void 0===t&&(t=null),null===n)return uc.EMPTY_NODE;if("object"==typeof n&&".priority"in n&&(t=n[".priority"]),so(null===t||"string"==typeof t||"number"==typeof t||"object"==typeof t&&".sv"in t,"Invalid priority type found: "+typeof t),"object"==typeof n&&".value"in n&&null!==n[".value"]&&(n=n[".value"]),"object"!=typeof n||".sv"in n)return new Qu(n,pc(t));if(n instanceof Array||!fc){var r=uc.EMPTY_NODE;return ia(n,function(t,e){Oo(n,t)&&"."!==t.substring(0,1)&&(!(e=pc(e)).isLeafNode()&&e.isEmpty()||(r=r.updateImmediateChild(t,e)))}),r.updatePriority(pc(t))}var i=[],o=!1;if(ia(n,function(t,e){"."!==t.substring(0,1)&&((e=pc(e)).isEmpty()||(o=o||!e.getPriority().isEmpty(),i.push(new Su(t,e))))}),0===i.length)return uc.EMPTY_NODE;var e=rc(i,qu,function(t){return t.name},Vu);if(o){var s=rc(i,Ju.getCompare());return new uc(e,pc(t),new oc({".priority":s},{".priority":Ju}))}return new uc(e,pc(t),oc.Default)}Wu=pc;var dc,vc,gc=(Xi(yc,dc=G),yc.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},yc.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},yc.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),r=n.compareTo(r);return 0===r?na(t.name,e.name):r},yc.prototype.makePost=function(t,e){t=pc(t),t=uc.EMPTY_NODE.updateChild(this.indexPath_,t);return new Su(e,t)},yc.prototype.maxPost=function(){var t=uc.EMPTY_NODE.updateChild(this.indexPath_,lc);return new Su(ea,t)},yc.prototype.toString=function(){return su(this.indexPath_,0).join("/")},yc);function yc(t){var e=dc.call(this)||this;return e.indexPath_=t,so(!cu(t)&&".priority"!==nu(t),"Can't create PathIndex with empty path or .priority key"),e}function mc(){return null!==vc&&vc.apply(this,arguments)||this}function bc(t){if(t===""+ha)return"-";var e=la(t);if(null!=e)return""+(e+1);for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t.charAt(r);if(n.length<786)return n.push("-"),n.join("");for(var i=n.length-1;0<=i&&"z"===n[i];)i--;return-1===i?ea:(e=n[i],e=Ec.charAt(Ec.indexOf(e)+1),n[i]=e,n.slice(0,i+1).join(""))}function wc(t){if(t===""+ca)return ta;var e=la(t);if(null!=e)return""+(e-1);for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t.charAt(r);return"-"===n[n.length-1]?1===n.length?""+ha:(delete n[n.length-1],n.join("")):(n[n.length-1]=Ec.charAt(Ec.indexOf(n[n.length-1])-1),n.join("")+"z".repeat(786-n.length))}var _c,Ic,Tc=new(Xi(mc,vc=G),mc.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?na(t.name,e.name):n},mc.prototype.isDefinedOn=function(t){return!0},mc.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},mc.prototype.minPost=function(){return Su.MIN},mc.prototype.maxPost=function(){return Su.MAX},mc.prototype.makePost=function(t,e){t=pc(t);return new Su(e,t)},mc.prototype.toString=function(){return".value"},mc),Ec="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",Sc=(_c=0,Ic=[],function(t){var e=t===_c;_c=t;for(var n=new Array(8),r=7;0<=r;r--)n[r]=Ec.charAt(t%64),t=Math.floor(t/64);so(0===t,"Cannot push at time == 0");var i=n.join("");if(e){for(r=11;0<=r&&63===Ic[r];r--)Ic[r]=0;Ic[r]++}else for(r=0;r<12;r++)Ic[r]=Math.floor(64*Math.random());for(r=0;r<12;r++)i+=Ec.charAt(Ic[r]);return so(20===i.length,"nextPushId: Length should be 20."),i});function Cc(t){return{type:"value",snapshotNode:t}}function Nc(t,e){return{type:"child_added",snapshotNode:e,childName:t}}function Ac(t,e){return{type:"child_removed",snapshotNode:e,childName:t}}function kc(t,e,n){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:n}}var Rc=(Pc.prototype.updateChild=function(t,e,n,r,i,o){so(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(Ac(e,s)):so(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(Nc(e,n)):o.trackChildChange(kc(e,n,s))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},Pc.prototype.updateFullNode=function(r,n,i){return null!=i&&(r.isLeafNode()||r.forEachChild(Ju,function(t,e){n.hasChild(t)||i.trackChildChange(Ac(t,e))}),n.isLeafNode()||n.forEachChild(Ju,function(t,e){var n;r.hasChild(t)?(n=r.getImmediateChild(t)).equals(e)||i.trackChildChange(kc(t,e,n)):i.trackChildChange(Nc(t,e))})),n.withIndex(this.index_)},Pc.prototype.updatePriority=function(t,e){return t.isEmpty()?uc.EMPTY_NODE:t.updatePriority(e)},Pc.prototype.filtersNodes=function(){return!1},Pc.prototype.getIndexedFilter=function(){return this},Pc.prototype.getIndex=function(){return this.index_},Pc);function Pc(t){this.index_=t}var Oc=(Dc.prototype.getStartPost=function(){return this.startPost_},Dc.prototype.getEndPost=function(){return this.endPost_},Dc.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)<=0&&this.index_.compare(t,this.getEndPost())<=0},Dc.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new Su(e,n))||(n=uc.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},Dc.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&&(e=uc.EMPTY_NODE);var r=(r=e.withIndex(this.index_)).updatePriority(uc.EMPTY_NODE),i=this;return e.forEachChild(Ju,function(t,e){i.matches(new Su(t,e))||(r=r.updateImmediateChild(t,uc.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,r,n)},Dc.prototype.updatePriority=function(t,e){return t},Dc.prototype.filtersNodes=function(){return!0},Dc.prototype.getIndexedFilter=function(){return this.indexedFilter_},Dc.prototype.getIndex=function(){return this.index_},Dc.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},Dc.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},Dc);function Dc(t){this.indexedFilter_=new Rc(t.getIndex()),this.index_=t.getIndex(),this.startPost_=Dc.getStartPost_(t),this.endPost_=Dc.getEndPost_(t)}var xc=(Lc.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new Su(e,n))||(n=uc.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)},Lc.prototype.updateFullNode=function(t,e,n){if(e.isLeafNode()||e.isEmpty())r=uc.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){var r=uc.EMPTY_NODE.withIndex(this.index_),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(uc.EMPTY_NODE);var a,u=void 0,c=void 0,h=void 0,i=void 0;h=this.reverse_?(i=r.getReverseIterator(this.index_),u=this.rangedFilter_.getEndPost(),c=this.rangedFilter_.getStartPost(),a=this.index_.getCompare(),function(t,e){return a(e,t)}):(i=r.getIterator(this.index_),u=this.rangedFilter_.getStartPost(),c=this.rangedFilter_.getEndPost(),this.index_.getCompare());for(var o=0,l=!1;i.hasNext();){s=i.getNext();(l=!l&&h(u,s)<=0?!0:l)&&o<this.limit_&&h(s,c)<=0?o++:r=r.updateImmediateChild(s.name,uc.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},Lc.prototype.updatePriority=function(t,e){return t},Lc.prototype.filtersNodes=function(){return!0},Lc.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},Lc.prototype.getIndex=function(){return this.index_},Lc.prototype.fullLimitUpdateChild_=function(t,e,n,r,i){var o,s;s=this.reverse_?(o=this.index_.getCompare(),function(t,e){return o(e,t)}):this.index_.getCompare();var a=t;so(a.numChildren()===this.limit_,"");var u=new Su(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:s(f,u);if(h&&!n.isEmpty()&&0<=p)return null!=i&&i.trackChildChange(kc(e,n,l)),a.updateImmediateChild(e,n);null!=i&&i.trackChildChange(Ac(e,l));l=a.updateImmediateChild(e,uc.EMPTY_NODE);return null!=f&&this.rangedFilter_.matches(f)?(null!=i&&i.trackChildChange(Nc(f.name,f.node)),l.updateImmediateChild(f.name,f.node)):l}return!n.isEmpty()&&h&&0<=s(c,u)?(null!=i&&(i.trackChildChange(Ac(c.name,c.node)),i.trackChildChange(Nc(e,n))),a.updateImmediateChild(e,n).updateImmediateChild(c.name,uc.EMPTY_NODE)):t},Lc);function Lc(t){this.rangedFilter_=new Oc(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}var Mc=(Fc.prototype.hasStart=function(){return this.startSet_},Fc.prototype.hasStartAfter=function(){return this.startAfterSet_},Fc.prototype.hasEndBefore=function(){return this.endBeforeSet_},Fc.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:"l"===this.viewFrom_},Fc.prototype.getIndexStartValue=function(){return so(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},Fc.prototype.getIndexStartName=function(){return so(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:ta},Fc.prototype.hasEnd=function(){return this.endSet_},Fc.prototype.getIndexEndValue=function(){return so(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},Fc.prototype.getIndexEndName=function(){return so(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:ea},Fc.prototype.hasLimit=function(){return this.limitSet_},Fc.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},Fc.prototype.getLimit=function(){return so(this.limitSet_,"Only valid if limit has been set"),this.limit_},Fc.prototype.getIndex=function(){return this.index_},Fc.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},Fc.prototype.isDefault=function(){return this.loadsAllData()&&this.index_===Ju},Fc.prototype.copy=function(){var t=new Fc;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},Fc);function Fc(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Ju}function Uc(t,e,n){t=t.copy();return t.startSet_=!0,void 0===e&&(e=null),t.indexStartValue_=e,null!=n?(t.startNameSet_=!0,t.indexStartName_=n):(t.startNameSet_=!1,t.indexStartName_=""),t}function jc(t,e,n){t=t.copy();return t.endSet_=!0,void 0===e&&(e=null),t.indexEndValue_=e,void 0!==n?(t.endNameSet_=!0,t.indexEndName_=n):(t.endNameSet_=!1,t.indexEndName_=""),t}function qc(t,e){t=t.copy();return t.index_=e,t}function Vc(t){var e,n={};return t.isDefault()||(e=t.index_===Ju?"$priority":t.index_===Tc?"$value":t.index_===Pu?"$key":(so(t.index_ instanceof gc,"Unrecognized index type!"),t.index_.toString()),n.orderBy=Ro(e),t.startSet_&&(n.startAt=Ro(t.indexStartValue_),t.startNameSet_&&(n.startAt+=","+Ro(t.indexStartName_))),t.endSet_&&(n.endAt=Ro(t.indexEndValue_),t.endNameSet_&&(n.endAt+=","+Ro(t.indexEndName_))),t.limitSet_&&(t.isViewFromLeft()?n.limitToFirst=t.limit_:n.limitToLast=t.limit_)),n}var Bc,Kc=(Xi(Wc,Bc=z),Wc.prototype.reportStats=function(t){throw new Error("Method not implemented.")},Wc.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(so(t.getQueryParams().isDefault(),"should have a tag if it's not a default query."),t.path.toString())},Wc.prototype.listen=function(t,e,n,r){var i=this,o=t.path.toString();this.log_("Listen called for "+o+" "+t.queryIdentifier());var s=Wc.getListenId_(t,n),a={};this.listens_[s]=a;t=Vc(t.getQueryParams());this.restRequest_(o+".json",t,function(t,e){null===(t=404===t?e=null:t)&&i.onDataUpdate_(o,e,!1,n),Do(i.listens_,s)===a&&r(t?401===t?"permission_denied":"rest_error:"+t:"ok",null)})},Wc.prototype.unlisten=function(t,e){e=Wc.getListenId_(t,e);delete this.listens_[e]},Wc.prototype.get=function(t){var n=this,e=Vc(t.getQueryParams()),r=t.path.toString(),i=new lo;return this.restRequest_(r+".json",e,function(t,e){null===(t=404===t?e=null:t)?(n.onDataUpdate_(r,e,!1,null),i.resolve(e)):i.reject(new Error(e))}),i.promise},Wc.prototype.refreshAuthToken=function(t){},Wc.prototype.restRequest_=function(r,i,o){var s=this;(i=void 0===i?{}:i).format="export",this.authTokenProvider_.getToken(!1).then(function(t){t=t&&t.accessToken;t&&(i.auth=t);var e=(s.repoInfo_.secure?"https://":"http://")+s.repoInfo_.host+r+"?ns="+s.repoInfo_.namespace+Mo(i);s.log_("Sending REST request for "+e);var n=new XMLHttpRequest;n.onreadystatechange=function(){if(o&&4===n.readyState){s.log_("REST Response for "+e+" received. status:",n.status,"response:",n.responseText);var t=null;if(200<=n.status&&n.status<300){try{t=ko(n.responseText)}catch(t){Zs("Failed to parse JSON response for "+e+": "+n.responseText)}o(null,t)}else 401!==n.status&&404!==n.status&&Zs("Got unsuccessful REST response for "+e+" Status: "+n.status),o(n.status);o=null}},n.open("GET",e,!0),n.send()})},Wc);function Wc(t,e,n){var r=Bc.call(this)||this;return r.repoInfo_=t,r.onDataUpdate_=e,r.authTokenProvider_=n,r.log_=Js("p:rest:"),r.listens_={},r}var Hc=(Gc.prototype.getNode=function(t){return this.rootNode_.getChild(t)},Gc.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},Gc);function Gc(){this.rootNode_=uc.EMPTY_NODE}function zc(){return{value:null,children:new Map}}function Qc(t,e,n){var r;cu(e)?(t.value=n,t.children.clear()):null!==t.value?t.value=t.value.updateChild(e,n):(r=nu(e),t.children.has(r)||t.children.set(r,zc()),Qc(t.children.get(r),e=iu(e),n))}function Yc(t,n,r){var i;null!==t.value?r(n,t.value):(i=function(t,e){Yc(e,new Za(n.toString()+"/"+t),r)},t.children.forEach(function(t,e){i(e,t)}))}var Xc=(Jc.prototype.get=function(){var t=this.collection_.get(),n=Ji({},t);return this.last_&&ia(this.last_,function(t,e){n[t]=n[t]-e}),this.last_=t,n},Jc);function Jc(t){this.collection_=t,this.last_=null}var $c,Zc=(th.prototype.reportStats_=function(){var n=this,t=this.statsListener_.get(),r={},i=!1;ia(t,function(t,e){0<e&&Oo(n.statsToReport_,t)&&(r[t]=e,i=!0)}),i&&this.server_.reportStats(r),sa(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},th);function th(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Xc(t);t=1e4+2e4*Math.random();sa(this.reportStats_.bind(this),Math.floor(t))}function eh(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function nh(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function rh(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}(Ga=$c=$c||{})[Ga.OVERWRITE=0]="OVERWRITE",Ga[Ga.MERGE=1]="MERGE",Ga[Ga.ACK_USER_WRITE=2]="ACK_USER_WRITE",Ga[Ga.LISTEN_COMPLETE=3]="LISTEN_COMPLETE";var ih=(oh.prototype.operationForChild=function(t){if(cu(this.path)){if(null!=this.affectedTree.value)return so(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var e=this.affectedTree.subtree(new Za(t));return new oh(eu(),e,this.revert)}return so(nu(this.path)===t,"operationForChild called for unrelated child."),new oh(iu(this.path),this.affectedTree,this.revert)},oh);function oh(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=$c.ACK_USER_WRITE,this.source=eh()}var sh=(ah.prototype.operationForChild=function(t){return cu(this.path)?new ah(this.source,eu()):new ah(this.source,iu(this.path))},ah);function ah(t,e){this.source=t,this.path=e,this.type=$c.LISTEN_COMPLETE}var uh=(ch.prototype.operationForChild=function(t){return cu(this.path)?new ch(this.source,eu(),this.snap.getImmediateChild(t)):new ch(this.source,iu(this.path),this.snap)},ch);function ch(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=$c.OVERWRITE}var hh=(lh.prototype.operationForChild=function(t){if(cu(this.path)){var e=this.children.subtree(new Za(t));return e.isEmpty()?null:e.value?new uh(this.source,eu(),e.value):new lh(this.source,eu(),e)}return so(nu(this.path)===t,"Can't get a merge for a child not on the path of the operation"),new lh(this.source,iu(this.path),this.children)},lh.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},lh);function lh(t,e,n){this.source=t,this.path=e,this.children=n,this.type=$c.MERGE}var fh=(ph.prototype.isFullyInitialized=function(){return this.fullyInitialized_},ph.prototype.isFiltered=function(){return this.filtered_},ph.prototype.isCompleteForPath=function(t){if(cu(t))return this.isFullyInitialized()&&!this.filtered_;t=nu(t);return this.isCompleteForChild(t)},ph.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},ph.prototype.getNode=function(){return this.node_},ph);function ph(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}var dh,vh=function(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()};function gh(n,t,e,r){var i=[],o=[];return t.forEach(function(t){var e;"child_changed"===t.type&&n.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push((e=t.childName,{type:"child_moved",snapshotNode:t.snapshotNode,childName:e}))}),yh(n,i,"child_removed",t,r,e),yh(n,i,"child_added",t,r,e),yh(n,i,"child_moved",o,r,e),yh(n,i,"child_changed",t,r,e),yh(n,i,"value",t,r,e),i}function yh(o,s,e,t,a,u){t=t.filter(function(t){return t.type===e});t.sort(function(t,e){return function(t,e,n){if(null==e.childName||null==n.childName)throw ao("Should only compare child_ events.");e=new Su(e.childName,e.snapshotNode),n=new Su(n.childName,n.snapshotNode);return t.index_.compare(e,n)}(o,t,e)}),t.forEach(function(e){var t,n,r,i=(t=o,r=u,"value"===(n=e).type||"child_removed"===n.type||(n.prevName=r.getPredecessorChildName(n.childName,n.snapshotNode,t.index_)),n);a.forEach(function(t){t.respondsTo(e.type)&&s.push(t.createEvent(i,o.query_))})})}function mh(t,e){return{eventCache:t,serverCache:e}}function bh(t,e,n,r){return mh(new fh(e,n,r),t.serverCache)}function wh(t,e,n,r){return mh(t.eventCache,new fh(e,n,r))}function _h(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function Ih(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}var Th=(Eh.fromObject=function(t){var n=new Eh(null);return ia(t,function(t,e){n=n.set(new Za(t),e)}),n},Eh.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},Eh.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:eu(),value:this.value};if(cu(t))return null;var n=nu(t),r=this.children.get(n);if(null===r)return null;e=r.findRootMostMatchingPathAndValue(iu(t),e);return null==e?null:{path:uu(new Za(n),e.path),value:e.value}},Eh.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},Eh.prototype.subtree=function(t){if(cu(t))return this;var e=nu(t),e=this.children.get(e);return null!==e?e.subtree(iu(t)):new Eh(null)},Eh.prototype.set=function(t,e){if(cu(t))return new Eh(e,this.children);var n=nu(t),e=(this.children.get(n)||new Eh(null)).set(iu(t),e),e=this.children.insert(n,e);return new Eh(this.value,e)},Eh.prototype.remove=function(t){if(cu(t))return this.children.isEmpty()?new Eh(null):new Eh(null,this.children);var e=nu(t),n=this.children.get(e);if(n){n=n.remove(iu(t)),t=void 0,t=n.isEmpty()?this.children.remove(e):this.children.insert(e,n);return null===this.value&&t.isEmpty()?new Eh(null):new Eh(this.value,t)}return this},Eh.prototype.get=function(t){if(cu(t))return this.value;var e=nu(t),e=this.children.get(e);return e?e.get(iu(t)):null},Eh.prototype.setTree=function(t,e){if(cu(t))return e;var n=nu(t),t=(this.children.get(n)||new Eh(null)).setTree(iu(t),e),e=void 0,e=t.isEmpty()?this.children.remove(n):this.children.insert(n,t);return new Eh(this.value,e)},Eh.prototype.fold=function(t){return this.fold_(eu(),t)},Eh.prototype.fold_=function(n,r){var i={};return this.children.inorderTraversal(function(t,e){i[t]=e.fold_(uu(n,t),r)}),r(n,this.value,i)},Eh.prototype.findOnPath=function(t,e){return this.findOnPath_(t,eu(),e)},Eh.prototype.findOnPath_=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(cu(t))return null;var i=nu(t),r=this.children.get(i);return r?r.findOnPath_(iu(t),uu(e,i),n):null},Eh.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,eu(),e)},Eh.prototype.foreachOnPath_=function(t,e,n){if(cu(t))return this;this.value&&n(e,this.value);var r=nu(t),i=this.children.get(r);return i?i.foreachOnPath_(iu(t),uu(e,r),n):new Eh(null)},Eh.prototype.foreach=function(t){this.foreach_(eu(),t)},Eh.prototype.foreach_=function(n,r){this.children.inorderTraversal(function(t,e){e.foreach_(uu(n,t),r)}),this.value&&r(n,this.value)},Eh.prototype.foreachChild=function(n){this.children.inorderTraversal(function(t,e){e.value&&n(t,e.value)})},Eh);function Eh(t,e){void 0===e&&(e=dh=dh||new Uu(js)),this.value=t,this.children=e}var Sh=(Ch.empty=function(){return new Ch(new Th(null))},Ch);function Ch(t){this.writeTree_=t}function Nh(t,e,n){if(cu(e))return new Sh(new Th(n));var r=t.writeTree_.findRootMostValueAndPath(e);if(null!=r){var i=r.path,o=r.value,r=hu(i,e),o=o.updateChild(r,n);return new Sh(t.writeTree_.set(i,o))}n=new Th(n),n=t.writeTree_.setTree(e,n);return new Sh(n)}function Ah(t,n,e){var r=t;return ia(e,function(t,e){r=Nh(r,uu(n,t),e)}),r}function kh(t,e){if(cu(e))return Sh.empty();e=t.writeTree_.setTree(e,new Th(null));return new Sh(e)}function Rh(t,e){return null!=Ph(t,e)}function Ph(t,e){var n=t.writeTree_.findRootMostValueAndPath(e);return null!=n?t.writeTree_.get(n.path).getChild(hu(n.path,e)):null}function Oh(t){var n=[],e=t.writeTree_.value;return null!=e?e.isLeafNode()||e.forEachChild(Ju,function(t,e){n.push(new Su(t,e))}):t.writeTree_.children.inorderTraversal(function(t,e){null!=e.value&&n.push(new Su(t,e.value))}),n}function Dh(t,e){if(cu(e))return t;var n=Ph(t,e);return new Sh(null!=n?new Th(n):t.writeTree_.subtree(e))}function xh(t){return t.writeTree_.isEmpty()}function Lh(t,e){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?(so(null!==e.value,"Priority writes must always be leaf nodes"),o=e.value):i=n(uu(r,t),e,i)}),i=!i.getChild(r).isEmpty()&&null!==o?i.updateChild(uu(r,".priority"),o):i}}(eu(),t.writeTree_,e)}function Mh(t,e){return Qh(e,t)}function Fh(e,n){var t=e.allWrites.findIndex(function(t){return t.writeId===n});so(0<=t,"removeWrite called with nonexistent writeId.");var r=e.allWrites[t];e.allWrites.splice(t,1);for(var i,o=r.visible,s=!1,a=e.allWrites.length-1;o&&0<=a;){var u=e.allWrites[a];u.visible&&(t<=a&&function(t,e){{if(t.snap)return pu(t.path,e);for(var n in t.children)if(t.children.hasOwnProperty(n)&&pu(uu(t.path,n),e))return!0;return!1}}(u,r.path)?o=!1:pu(r.path,u.path)&&(s=!0)),a--}return!!o&&(s?((i=e).visibleWrites=jh(i.allWrites,Uh,eu()),0<i.allWrites.length?i.lastWriteId=i.allWrites[i.allWrites.length-1].writeId:i.lastWriteId=-1):r.snap?e.visibleWrites=kh(e.visibleWrites,r.path):ia(r.children,function(t){e.visibleWrites=kh(e.visibleWrites,uu(r.path,t))}),!0)}function Uh(t){return t.visible}function jh(t,e,n){for(var r=Sh.empty(),i=0;i<t.length;++i){var o=t[i];if(e(o)){var s=o.path,a=void 0;if(o.snap)pu(n,s)?r=Nh(r,a=hu(n,s),o.snap):pu(s,n)&&(a=hu(s,n),r=Nh(r,eu(),o.snap.getChild(a)));else{if(!o.children)throw ao("WriteRecord should have .snap or .children");pu(n,s)?r=Ah(r,a=hu(n,s),o.children):pu(s,n)&&(cu(a=hu(s,n))?r=Ah(r,eu(),o.children):(o=Do(o.children,nu(a)))&&(a=o.getChild(iu(a)),r=Nh(r,eu(),a)))}}}return r}function qh(t,e,n,r,i){if(r||i){var o=Dh(t.visibleWrites,e);if(!i&&xh(o))return n;if(i||null!=n||Rh(o,eu()))return Lh(jh(t.allWrites,function(t){return(t.visible||i)&&(!r||!~r.indexOf(t.writeId))&&(pu(t.path,e)||pu(e,t.path))},e),n||uc.EMPTY_NODE);return null}o=Ph(t.visibleWrites,e);if(null!=o)return o;t=Dh(t.visibleWrites,e);return xh(t)?n:null!=n||Rh(t,eu())?Lh(t,n||uc.EMPTY_NODE):null}function Vh(t,e,n,r){return qh(t.writeTree,t.treePath,e,n,r)}function Bh(t,e){return function(t,e,n){var r=uc.EMPTY_NODE,i=Ph(t.visibleWrites,e);if(i)return i.isLeafNode()||i.forEachChild(Ju,function(t,e){r=r.updateImmediateChild(t,e)}),r;if(n){var o=Dh(t.visibleWrites,e);return n.forEachChild(Ju,function(t,e){e=Lh(Dh(o,new Za(t)),e);r=r.updateImmediateChild(t,e)}),Oh(o).forEach(function(t){r=r.updateImmediateChild(t.name,t.node)}),r}return Oh(Dh(t.visibleWrites,e)).forEach(function(t){r=r.updateImmediateChild(t.name,t.node)}),r}(t.writeTree,t.treePath,e)}function Kh(t,e,n,r){return i=t.writeTree,t=t.treePath,e=e,r=r,so(n||r,"Either existingEventSnap or existingServerSnap must exist"),t=uu(t,e),Rh(i.visibleWrites,t)?null:xh(t=Dh(i.visibleWrites,t))?r.getChild(e):Lh(t,r.getChild(e));var i}function Wh(t,e){return n=t.writeTree,e=uu(t.treePath,e),Ph(n.visibleWrites,e);var n}function Hh(t,e,n,r,i,o){return function(t,e,n,r,i,o,s){var a,t=Dh(t.visibleWrites,e);if(null!=(e=Ph(t,eu())))a=e;else{if(null==n)return[];a=Lh(t,n)}if((a=a.withIndex(s)).isEmpty()||a.isLeafNode())return[];for(var u=[],c=s.getCompare(),h=o?a.getReverseIteratorFrom(r,s):a.getIteratorFrom(r,s),l=h.getNext();l&&u.length<i;)0!==c(l,r)&&u.push(l),l=h.getNext();return u}(t.writeTree,t.treePath,e,n,r,i,o)}function Gh(t,e,n){return r=t.writeTree,i=t.treePath,t=n,e=uu(i,n=e),null!=(i=Ph(r.visibleWrites,e))?i:t.isCompleteForChild(n)?Lh(Dh(r.visibleWrites,e),t.getNode().getImmediateChild(n)):null;var r,i}function zh(t,e){return Qh(uu(t.treePath,e),t.writeTree)}function Qh(t,e){return{treePath:t,writeTree:e}}var Yh=(Xh.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;so("child_added"===e||"child_changed"===e||"child_removed"===e,"Only child changes supported for tracking"),so(".priority"!==n,"Only non-priority child changes can be tracked.");var r=this.changeMap.get(n);if(r){var i=r.type;if("child_added"===e&&"child_removed"===i)this.changeMap.set(n,kc(n,t.snapshotNode,r.snapshotNode));else if("child_removed"===e&&"child_added"===i)this.changeMap.delete(n);else if("child_removed"===e&&"child_changed"===i)this.changeMap.set(n,Ac(n,r.oldSnap));else if("child_changed"===e&&"child_added"===i)this.changeMap.set(n,Nc(n,t.snapshotNode));else{if("child_changed"!==e||"child_changed"!==i)throw ao("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,kc(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},Xh.prototype.getChanges=function(){return Array.from(this.changeMap.values())},Xh);function Xh(){this.changeMap=new Map}function Jh(){}var $h=new(Jh.prototype.getCompleteChild=function(t){return null},Jh.prototype.getChildAfterChild=function(t,e,n){return null},Jh),Zh=(tl.prototype.getCompleteChild=function(t){var e=this.viewCache_.eventCache;if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);e=null!=this.optCompleteServerCache_?new fh(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return Gh(this.writes_,t,e)},tl.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:Ih(this.viewCache_),t=Hh(this.writes_,r,e,1,n,t);return 0===t.length?null:t[0]},tl);function tl(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}function el(t,e,n,r,i){var o,s,a,u,c,h,l,f,p=new Yh;if(n.type===$c.OVERWRITE)var d=n,v=d.source.fromUser?il(t,e,d.path,d.snap,r,i,p):(so(d.source.fromServer,"Unknown source."),o=d.source.tagged||e.serverCache.isFiltered()&&!cu(d.path),rl(t,e,d.path,d.snap,r,i,o,p));else if(n.type===$c.MERGE){var g=n;v=g.source.fromUser?(s=t,a=e,u=g.path,d=g.children,c=r,h=i,l=p,f=a,d.foreach(function(t,e){t=uu(u,t);ol(a,nu(t))&&(f=il(s,f,t,e,c,h,l))}),d.foreach(function(t,e){t=uu(u,t);ol(a,nu(t))||(f=il(s,f,t,e,c,h,l))}),f):(so(g.source.fromServer,"Unknown source."),o=g.source.tagged||e.serverCache.isFiltered(),al(t,e,g.path,g.children,r,i,o,p))}else if(n.type===$c.ACK_USER_WRITE){var y=n;v=y.revert?function(t,e,n,r,i,o){var s;{if(null!=Wh(r,n))return e;var a,u,c=new Zh(r,e,i),h=e.eventCache.getNode(),i=void 0;return cu(n)||".priority"===nu(n)?(u=void 0,u=e.serverCache.isFullyInitialized()?Vh(r,Ih(e)):(a=e.serverCache.getNode(),so(a instanceof uc,"serverChildren would be complete if leaf node"),Bh(r,a)),i=t.filter.updateFullNode(h,u,o)):(a=nu(n),null==(u=Gh(r,a,e.serverCache))&&e.serverCache.isCompleteForChild(a)&&(u=h.getImmediateChild(a)),(i=null!=u?t.filter.updateChild(h,a,u,iu(n),c,o):e.eventCache.getNode().hasChild(a)?t.filter.updateChild(h,a,uc.EMPTY_NODE,iu(n),c,o):h).isEmpty()&&e.serverCache.isFullyInitialized()&&(s=Vh(r,Ih(e))).isLeafNode()&&(i=t.filter.updateFullNode(i,s,o))),s=e.serverCache.isFullyInitialized()||null!=Wh(r,eu()),bh(e,i,s,t.filter.filtersNodes())}}(t,e,y.path,r,i,p):function(t,e,r,n,i,o,s){if(null!=Wh(i,r))return e;var a=e.serverCache.isFiltered(),u=e.serverCache;{if(null!=n.value){if(cu(r)&&u.isFullyInitialized()||u.isCompleteForPath(r))return rl(t,e,r,u.getNode().getChild(r),i,o,a,s);if(cu(r)){var c=new Th(null);return u.getNode().forEachChild(Pu,function(t,e){c=c.set(new Za(t),e)}),al(t,e,r,c,i,o,a,s)}return e}var h=new Th(null);return n.foreach(function(t,e){var n=uu(r,t);u.isCompleteForPath(n)&&(h=h.set(t,u.getNode().getChild(n)))}),al(t,e,r,h,i,o,a,s)}}(t,e,y.path,y.affectedTree,r,i,p)}else{if(n.type!==$c.LISTEN_COMPLETE)throw ao("Unknown operation type: "+n.type);o=t,y=e,i=n.path,t=r,n=p,r=y.serverCache,r=wh(y,r.getNode(),r.isFullyInitialized()||cu(i),r.isFiltered()),v=nl(o,r,i,t,$h,n)}p=p.getChanges();return function(t,e,n){var r=e.eventCache;{var i,o;r.isFullyInitialized()&&(i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=_h(t),(0<n.length||!t.eventCache.isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(Cc(_h(e))))}}(e,v,p),{viewCache:v,changes:p}}function nl(t,e,n,r,i,o){var s=e.eventCache;if(null!=Wh(r,n))return e;var a,u,c,h,l=void 0,f=void 0;return l=cu(n)?(so(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()?(a=Bh(r,(a=Ih(e))instanceof uc?a:uc.EMPTY_NODE),t.filter.updateFullNode(e.eventCache.getNode(),a,o)):(u=Vh(r,Ih(e)),t.filter.updateFullNode(e.eventCache.getNode(),u,o))):".priority"===(u=nu(n))?(so(1===ru(n),"Can't have a priority with additional path components"),null!=(h=Kh(r,n,c=s.getNode(),f=e.serverCache.getNode()))?t.filter.updatePriority(c,h):s.getNode()):(c=iu(n),h=void 0,null!=(h=s.isCompleteForChild(u)?(f=e.serverCache.getNode(),null!=(f=Kh(r,n,s.getNode(),f))?s.getNode().getImmediateChild(u).updateChild(c,f):s.getNode().getImmediateChild(u)):Gh(r,u,e.serverCache))?t.filter.updateChild(s.getNode(),u,h,c,i,o):s.getNode()),bh(e,l,s.isFullyInitialized()||cu(n),t.filter.filtersNodes())}function rl(t,e,n,r,i,o,s,a){var u=e.serverCache,c=s?t.filter:t.filter.getIndexedFilter();if(cu(n))l=c.updateFullNode(u.getNode(),r,null);else if(c.filtersNodes()&&!u.isFiltered())var h=u.getNode().updateChild(n,r),l=c.updateFullNode(u.getNode(),h,null);else{s=nu(n);if(!u.isCompleteForPath(n)&&1<ru(n))return e;h=iu(n),r=u.getNode().getImmediateChild(s).updateChild(h,r);l=".priority"===s?c.updatePriority(u.getNode(),r):c.updateChild(u.getNode(),s,r,h,$h,null)}c=wh(e,l,u.isFullyInitialized()||cu(n),c.filtersNodes());return nl(t,c,n,i,new Zh(i,c,o),a)}function il(t,e,n,r,i,o,s){var a,u,c=e.eventCache,h=new Zh(i,e,o);return cu(n)?(u=t.filter.updateFullNode(e.eventCache.getNode(),r,s),bh(e,u,!0,t.filter.filtersNodes())):".priority"===(a=nu(n))?(u=t.filter.updatePriority(e.eventCache.getNode(),r),bh(e,u,c.isFullyInitialized(),c.isFiltered())):(i=iu(n),o=c.getNode().getImmediateChild(a),u=void 0,u=cu(i)?r:null!=(n=h.getCompleteChild(a))?".priority"===ou(i)&&n.getChild(au(i)).isEmpty()?n:n.updateChild(i,r):uc.EMPTY_NODE,o.equals(u)?e:bh(e,t.filter.updateChild(c.getNode(),a,u,i,h,s),c.isFullyInitialized(),t.filter.filtersNodes()))}function ol(t,e){return t.eventCache.isCompleteForChild(e)}function sl(t,n,e){return e.foreach(function(t,e){n=n.updateChild(t,e)}),n}function al(r,i,t,e,o,s,a,u){if(i.serverCache.getNode().isEmpty()&&!i.serverCache.isFullyInitialized())return i;var c=i,e=cu(t)?e:new Th(null).setTree(t,e),h=i.serverCache.getNode();return e.children.inorderTraversal(function(t,e){h.hasChild(t)&&(e=sl(0,i.serverCache.getNode().getImmediateChild(t),e),c=rl(r,c,new Za(t),e,o,s,a,u))}),e.children.inorderTraversal(function(t,e){var n=!i.serverCache.isCompleteForChild(t)&&void 0===e.value;h.hasChild(t)||n||(e=sl(0,i.serverCache.getNode().getImmediateChild(t),e),c=rl(r,c,new Za(t),e,o,s,a,u))}),c}var ul,cl=(Object.defineProperty(hl.prototype,"query",{get:function(){return this.query_},enumerable:!1,configurable:!0}),hl);function hl(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new Rc(n.getIndex()),i=(o=n).loadsAllData()?new Rc(o.getIndex()):new(o.hasLimit()?xc:Oc)(o);this.processor_={filter:i};var t=e.serverCache,n=e.eventCache,o=r.updateFullNode(uc.EMPTY_NODE,t.getNode(),null),e=i.updateFullNode(uc.EMPTY_NODE,n.getNode(),null),r=new fh(o,t.isFullyInitialized(),r.filtersNodes()),i=new fh(e,n.isFullyInitialized(),i.filtersNodes());this.viewCache_=mh(i,r),this.eventGenerator_=new vh(this.query_)}function ll(t){return 0===t.eventRegistrations_.length}function fl(t,e,n){var r,i=[];if(n&&(so(null==e,"A cancel should cancel all event registrations."),r=t.query.path,t.eventRegistrations_.forEach(function(t){t=t.createCancelEvent(n,r);t&&i.push(t)})),e){for(var o=[],s=0;s<t.eventRegistrations_.length;++s){var a=t.eventRegistrations_[s];if(a.matches(e)){if(e.hasAnyCallback()){o=o.concat(t.eventRegistrations_.slice(s+1));break}}else o.push(a)}t.eventRegistrations_=o}else t.eventRegistrations_=[];return i}function pl(t,e,n,r){e.type===$c.MERGE&&null!==e.source.queryId&&(so(Ih(t.viewCache_),"We should always have a full cache before handling merges"),so(_h(t.viewCache_),"Missing event cache, even though we have a server cache"));var i=t.viewCache_,e=el(t.processor_,i,e,n,r);return n=t.processor_,r=e.viewCache,so(r.eventCache.getNode().isIndexed(n.filter.getIndex()),"Event snap not indexed"),so(r.serverCache.getNode().isIndexed(n.filter.getIndex()),"Server snap not indexed"),so(e.viewCache.serverCache.isFullyInitialized()||!i.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=e.viewCache,dl(t,e.changes,e.viewCache.eventCache.getNode(),null)}function dl(t,e,n,r){r=r?[r]:t.eventRegistrations_;return gh(t.eventGenerator_,e,n,r)}var vl=function(){this.views=new Map};function gl(t,e,n,r){var i,o,s=e.source.queryId;if(null!==s){var a=t.views.get(s);return so(null!=a,"SyncTree gave us an op for an invalid query."),pl(a,e,n,r)}var u=[];try{for(var c=to(t.views.values()),h=c.next();!h.done;h=c.next())a=h.value,u=u.concat(pl(a,e,n,r))}catch(t){i={error:t}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}return u}function yl(t,e,n,r,i){var o=e.queryIdentifier(),t=t.views.get(o);if(t)return t;o=Vh(n,i?r:null),t=!1,t=!!o||(o=r instanceof uc?Bh(n,r):uc.EMPTY_NODE,!1),i=mh(new fh(o,t,!1),new fh(r,i,!1));return new cl(e,i)}function ml(t,e,n,r,i,o){var s,o=yl(t,e,r,i,o);return t.views.has(e.queryIdentifier())||t.views.set(e.queryIdentifier(),o),e=n,o.eventRegistrations_.push(e),e=n,o=(n=o).viewCache_.eventCache,s=[],o.getNode().isLeafNode()||o.getNode().forEachChild(Ju,function(t,e){s.push(Nc(t,e))}),o.isFullyInitialized()&&s.push(Cc(o.getNode())),dl(n,s,o.getNode(),e)}function bl(t,e,n,r){var i,o,s=e.queryIdentifier(),a=[],u=[],c=El(t);if("default"===s)try{for(var h=to(t.views.entries()),l=h.next();!l.done;l=h.next()){var f=eo(l.value,2),p=f[0],d=f[1],u=u.concat(fl(d,n,r));ll(d)&&(t.views.delete(p),d.query.getQueryParams().loadsAllData()||a.push(d.query))}}catch(t){i={error:t}}finally{try{l&&!l.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}else(d=t.views.get(s))&&(u=u.concat(fl(d,n,r)),ll(d)&&(t.views.delete(s),d.query.getQueryParams().loadsAllData()||a.push(d.query)));return c&&!El(t)&&a.push((so(ul,"Reference.ts has not been loaded"),new ul(e.database,e.path))),{removed:a,events:u}}function wl(t){var e,n,r=[];try{for(var i=to(t.views.values()),o=i.next();!o.done;o=i.next()){var s=o.value;s.query.getQueryParams().loadsAllData()||r.push(s)}}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 _l(t,e){var n,r,i,o,s=null;try{for(var a=to(t.views.values()),u=a.next();!u.done;u=a.next())var c=u.value,s=s||(i=e,o=void 0,(o=Ih((c=c).viewCache_))&&(c.query.getQueryParams().loadsAllData()||!cu(i)&&!o.getImmediateChild(nu(i)).isEmpty())?o.getChild(i):null)}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return s}function Il(t,e){if(e.getQueryParams().loadsAllData())return Sl(t);e=e.queryIdentifier();return t.views.get(e)}function Tl(t,e){return null!=Il(t,e)}function El(t){return null!=Sl(t)}function Sl(t){var e,n;try{for(var r=to(t.views.values()),i=r.next();!i.done;i=r.next()){var o=i.value;if(o.query.getQueryParams().loadsAllData())return o}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return null}var Cl=1,Nl=function(t){this.listenProvider_=t,this.syncPointTree_=new Th(null),this.pendingWriteTree_={visibleWrites:Sh.empty(),allWrites:[],lastWriteId:-1},this.tagToQueryMap=new Map,this.queryToTagMap=new Map};function Al(t,e,n,r,i){var o,s,a,u;return o=t.pendingWriteTree_,s=e,a=n,u=i,so((r=r)>o.lastWriteId,"Stacking an older write on top of newer ones"),void 0===u&&(u=!0),o.allWrites.push({path:s,snap:a,writeId:r,visible:u}),u&&(o.visibleWrites=Nh(o.visibleWrites,s,a)),o.lastWriteId=r,i?Ml(t,new uh(eh(),e,n)):[]}function kl(t,e,n,r){var i,o,s;i=t.pendingWriteTree_,o=e,s=n,so((r=r)>i.lastWriteId,"Stacking an older merge on top of newer ones"),i.allWrites.push({path:o,children:s,writeId:r,visible:!0}),i.visibleWrites=Ah(i.visibleWrites,o,s),i.lastWriteId=r;n=Th.fromObject(n);return Ml(t,new hh(eh(),e,n))}function Rl(t,e,n){void 0===n&&(n=!1);var r=function(t,e){for(var n=0;n<t.allWrites.length;n++){var r=t.allWrites[n];if(r.writeId===e)return r}return null}(t.pendingWriteTree_,e);if(Fh(t.pendingWriteTree_,e)){var i=new Th(null);return null!=r.snap?i=i.set(eu(),!0):ia(r.children,function(t){i=i.set(new Za(t),!0)}),Ml(t,new ih(r.path,i,n))}return[]}function Pl(t,e,n){return Ml(t,new uh(nh(),e,n))}function Ol(n,t,e,r){var i=t.path,o=n.syncPointTree_.get(i),s=[];if(o&&("default"===t.queryIdentifier()||Tl(o,t))){var a=bl(o,t,e,r);0===o.views.size&&(n.syncPointTree_=n.syncPointTree_.remove(i));e=a.removed,s=a.events,o=-1!==e.findIndex(function(t){return t.getQueryParams().loadsAllData()}),a=n.syncPointTree_.findOnPath(i,function(t,e){return El(e)});if(o&&!a){i=n.syncPointTree_.subtree(i);if(!i.isEmpty())for(var u=i.fold(function(t,e,n){if(e&&El(e))return[Sl(e)];var r=[];return e&&(r=wl(e)),ia(n,function(t,e){r=r.concat(e)}),r}),c=0;c<u.length;++c){var h=u[c],l=h.query,h=Ul(n,h);n.listenProvider_.startListening(Wl(l),jl(n,l),h.hashFn,h.onComplete)}}!a&&0<e.length&&!r&&(o?n.listenProvider_.stopListening(Wl(t),null):e.forEach(function(t){var e=n.queryToTagMap.get(ql(t));n.listenProvider_.stopListening(Wl(t),e)})),function(t,e){for(var n=0;n<e.length;++n){var r,i=e[n];i.getQueryParams().loadsAllData()||(r=ql(i),i=t.queryToTagMap.get(r),t.queryToTagMap.delete(r),t.tagToQueryMap.delete(i))}}(n,e)}return s}function Dl(t,e,n){var r=e.path,i=null,o=!1;t.syncPointTree_.foreachOnPath(r,function(t,e){t=hu(t,r);i=i||_l(e,t),o=o||El(e)});var s=t.syncPointTree_.get(r);s?(o=o||El(s),i=i||_l(s,eu())):(s=new vl,t.syncPointTree_=t.syncPointTree_.set(r,s)),null!=i?h=!0:(h=!1,i=uc.EMPTY_NODE,t.syncPointTree_.subtree(r).foreachChild(function(t,e){e=_l(e,eu());e&&(i=i.updateImmediateChild(t,e))}));var a,u,c=Tl(s,e);c||e.getQueryParams().loadsAllData()||(a=ql(e),so(!t.queryToTagMap.has(a),"View does not exist, but we have a tag"),u=Cl++,t.queryToTagMap.set(a,u),t.tagToQueryMap.set(u,a));var h=ml(s,e,n,Mh(t.pendingWriteTree_,r),i,h);return c||o||(s=Il(s,e),h=h.concat(function(t,e,n){var r=e.path,i=jl(t,e),n=Ul(t,n),n=t.listenProvider_.startListening(Wl(e),i,n.hashFn,n.onComplete),r=t.syncPointTree_.subtree(r);if(i)so(!El(r.value),"If we're adding a query, it shouldn't be shadowed");else for(var o=r.fold(function(t,e,n){if(!cu(t)&&e&&El(e))return[Sl(e).query];var r=[];return e&&(r=r.concat(wl(e).map(function(t){return t.query}))),ia(n,function(t,e){r=r.concat(e)}),r}),s=0;s<o.length;++s){var a=o[s];t.listenProvider_.stopListening(Wl(a),jl(t,a))}return n}(t,e,s))),h}function xl(t,n,e){var r=t.pendingWriteTree_,t=t.syncPointTree_.findOnPath(n,function(t,e){t=_l(e,hu(t,n));if(t)return t});return qh(r,n,t,e,!0)}function Ll(t,e){var n=e.path,r=null;t.syncPointTree_.foreachOnPath(n,function(t,e){t=hu(t,n);r=r||_l(e,t)});var i=t.syncPointTree_.get(n);i?r=r||_l(i,eu()):(i=new vl,t.syncPointTree_=t.syncPointTree_.set(n,i));var o=null!=r,s=o?new fh(r,!0,!1):null,o=yl(i,e,Mh(t.pendingWriteTree_,e.path),o?s.getNode():uc.EMPTY_NODE,o);return _h(o.viewCache_)}function Ml(t,e){return function t(e,n,r,i){{if(cu(e.path))return Fl(e,n,r,i);var o=n.get(eu());null==r&&null!=o&&(r=_l(o,eu()));var s=[],a=nu(e.path),u=e.operationForChild(a),c=n.children.get(a);return c&&u&&(n=r?r.getImmediateChild(a):null,a=zh(i,a),s=s.concat(t(u,c,n,a))),s=o?s.concat(gl(o,e,i,r)):s}}(e,t.syncPointTree_,null,Mh(t.pendingWriteTree_,eu()))}function Fl(i,t,o,s){var e=t.get(eu());null==o&&null!=e&&(o=_l(e,eu()));var a=[];return t.children.inorderTraversal(function(t,e){var n=o?o.getImmediateChild(t):null,r=zh(s,t),t=i.operationForChild(t);t&&(a=a.concat(Fl(t,e,n,r)))}),a=e?a.concat(gl(e,i,s,o)):a}function Ul(r,t){var i=t.query,o=jl(r,i);return{hashFn:function(){return(t.viewCache_.serverCache.getNode()||uc.EMPTY_NODE).hash()},onComplete:function(t){if("ok"===t)return o?function(t,e,n){var r=Vl(t,n);if(r){n=Bl(r),r=n.path,n=n.queryId,e=hu(r,e);return Kl(t,r,new sh(rh(n),e))}return[]}(r,i.path,o):(e=r,n=i.path,Ml(e,new sh(nh(),n)));var e,n,t=aa(t,i);return Ol(r,i,null,t)}}}function jl(t,e){e=ql(e);return t.queryToTagMap.get(e)}function ql(t){return t.path.toString()+"$"+t.queryIdentifier()}function Vl(t,e){return t.tagToQueryMap.get(e)}function Bl(t){var e=t.indexOf("$");return so(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new Za(t.substr(0,e))}}function Kl(t,e,n){var r=t.syncPointTree_.get(e);return so(r,"Missing sync point for query tag that we're tracking"),gl(r,n,Mh(t.pendingWriteTree_,e),null)}function Wl(t){return t.getQueryParams().loadsAllData()&&!t.getQueryParams().isDefault()?t.getRef():t}var Hl=(Gl.prototype.getImmediateChild=function(t){return new Gl(this.node_.getImmediateChild(t))},Gl.prototype.node=function(){return this.node_},Gl);function Gl(t){this.node_=t}var zl=(Ql.prototype.getImmediateChild=function(t){t=uu(this.path_,t);return new Ql(this.syncTree_,t)},Ql.prototype.node=function(){return xl(this.syncTree_,this.path_)},Ql);function Ql(t,e){this.syncTree_=t,this.path_=e}var Yl=function(t){return(t=t||{}).timestamp=t.timestamp||(new Date).getTime(),t},Jl=function(t,e,n){return t&&"object"==typeof t?(so(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?$l(t[".sv"],e,n):"object"==typeof t[".sv"]?Zl(t[".sv"],e):void so(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},$l=function(t,e,n){if("timestamp"===t)return n.timestamp;so(!1,"Unexpected server value: "+t)},Zl=function(t,e,n){t.hasOwnProperty("increment")||so(!1,"Unexpected server value: "+JSON.stringify(t,null,2));t=t.increment;"number"!=typeof t&&so(!1,"Unexpected increment value: "+t);e=e.node();if(so(null!=e,"Expected ChildrenNode.EMPTY_NODE for nulls"),!e.isLeafNode())return t;e=e.getValue();return"number"!=typeof e?t:e+t},tf=function(t,e,n,r){return nf(e,new zl(n,t),r)},ef=function(t,e,n){return nf(t,new Hl(e),n)};function nf(t,r,i){var e=t.getPriority().val(),n=Jl(e,r.getImmediateChild(".priority"),i);if(t.isLeafNode()){var o=t,e=Jl(o.getValue(),r,i);return e!==o.getValue()||n!==o.getPriority().val()?new Qu(e,pc(n)):t}var t=t,s=t;return n!==t.getPriority().val()&&(s=s.updatePriority(new Qu(n))),t.forEachChild(Ju,function(t,e){var n=nf(e,r.getImmediateChild(t),i);n!==e&&(s=s.updateImmediateChild(t,n))}),s}var rf=function(t,e,n){void 0===t&&(t=""),void 0===e&&(e=null),void 0===n&&(n={children:{},childCount:0}),this.name=t,this.parent=e,this.node=n};function of(t,e){for(var n=e instanceof Za?e:new Za(e),r=t,i=nu(n);null!==i;)var o=Do(r.node.children,i)||{children:{},childCount:0},r=new rf(i,r,o),i=nu(n=iu(n));return r}function sf(t){return t.node.value}function af(t,e){t.node.value=e,lf(t)}function uf(t){return 0<t.node.childCount}function cf(n,r){ia(n.node.children,function(t,e){r(new rf(t,n,e))})}function hf(t){return new Za(null===t.parent?t.name:hf(t.parent)+"/"+t.name)}function lf(t){var e,n,r,i;null!==t.parent&&(e=t.parent,n=t.name,i=function(t){return void 0===sf(t)&&!uf(t)}(r=t),t=Oo(e.node.children,n),i&&t?(delete e.node.children[n],e.node.childCount--,lf(e)):i||t||(e.node.children[n]=r.node,e.node.childCount++,lf(e)))}function ff(t){return"string"==typeof t&&0!==t.length&&!If.test(t)}function pf(t){return"string"==typeof t&&0!==t.length&&!Tf.test(t)}function df(t){return null===t||"string"==typeof t||"number"==typeof t&&!Us(t)||t&&"object"==typeof t&&Oo(t,".sv")}function vf(t,e,n,r,i){i&&void 0===n||Sf(Wo(t,e,i),n,r)}function gf(t,e,n,r,i){if(!i||void 0!==n){var o=Wo(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=[];ia(n,function(t,e){t=new Za(t);if(Sf(o,e,uu(r,t)),".priority"===ou(t)&&!df(e))throw new Error(o+"contains an invalid value for '"+t.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(t)}),function(t,e){for(var n=0;n<e.length;n++)for(var r,i=su(r=e[n]),o=0;o<i.length;o++)if((".priority"!==i[o]||o!==i.length-1)&&!ff(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);var s=null;for(n=0;n<e.length;n++){if(r=e[n],null!==s&&pu(s,r))throw new Error(t+"contains a path "+s.toString()+" that is ancestor of another path "+r.toString());s=r}}(o,s)}}function yf(t,e,n,r){if(!r||void 0!==n){if(Us(n))throw new Error(Wo(t,e,r)+"is "+n.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!df(n))throw new Error(Wo(t,e,r)+"must be a valid Firebase priority (a string, finite number, server value, or null).")}}function mf(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(Wo(t,e,r)+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}}function bf(t,e,n,r){if(!(r&&void 0===n||ff(n)))throw new Error(Wo(t,e,r)+'was an invalid key = "'+n+'". Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')}function wf(t,e,n,r){if(!(r&&void 0===n||pf(n)))throw new Error(Wo(t,e,r)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')}function _f(t,e){if(".info"===nu(e))throw new Error(t+" failed = Can't modify data under /.info/")}var If=/[\[\].#$\/\u0000-\u001F\u007F]/,Tf=/[\[\].#$\u0000-\u001F\u007F]/,Ef=10485760,Sf=function(r,t,e){var i=e instanceof Za?new du(e,r):e;if(void 0===t)throw new Error(r+"contains undefined "+gu(i));if("function"==typeof t)throw new Error(r+"contains a function "+gu(i)+" with contents = "+t.toString());if(Us(t))throw new Error(r+"contains "+t.toString()+" "+gu(i));if("string"==typeof t&&t.length>Ef/3&&zo(t)>Ef)throw new Error(r+"contains a string greater than "+Ef+" utf8 bytes "+gu(i)+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){var o=!1,s=!1;if(ia(t,function(t,e){if(".value"===t)o=!0;else if(".priority"!==t&&".sv"!==t&&(s=!0,!ff(t)))throw new Error(r+" contains an invalid key ("+t+") "+gu(i)+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');var n;n=t,0<(t=i).parts_.length&&(t.byteLength_+=1),t.parts_.push(n),t.byteLength_+=zo(n),vu(t),Sf(r,e,i),e=(t=i).parts_.pop(),t.byteLength_-=zo(e),0<t.parts_.length&&--t.byteLength_}),o&&s)throw new Error(r+' contains ".value" child '+gu(i)+" in addition to actual children.")}},Cf=function(t,e,n){var r=n.path.toString();if("string"!=typeof n.repoInfo.host||0===n.repoInfo.host.length||!ff(n.repoInfo.namespace)&&"localhost"!==n.repoInfo.host.split(":")[0]||0!==r.length&&(r=(r=r)&&r.replace(/^\/*\.info(\/|$)/,"/"),!pf(r)))throw new Error(Wo(t,e,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')},Nf=function(){this.eventLists_=[],this.recursionDepth_=0};function Af(t,e){for(var n=null,r=0;r<e.length;r++){var i=e[r],o=i.getPath();null===n||fu(o,n.path)||(t.eventLists_.push(n),n=null),(n=null===n?{events:[],path:o}:n).events.push(i)}n&&t.eventLists_.push(n)}function kf(t,e,n){Af(t,n),Pf(t,function(t){return fu(t,e)})}function Rf(t,e,n){Af(t,n),Pf(t,function(t){return pu(t,e)||pu(e,t)})}function Pf(t,e){t.recursionDepth_++;for(var n=!0,r=0;r<t.eventLists_.length;r++){var i=t.eventLists_[r];i&&(e(i.path)?(function(t){for(var e=0;e<t.events.length;e++){var n,r=t.events[e];null!==r&&(t.events[e]=null,n=r.getEventRunner(),Qs&&Xs("event: "+r.toString()),fa(n))}}(t.eventLists_[r]),t.eventLists_[r]=null):n=!1)}n&&(t.eventLists_=[]),t.recursionDepth_--}var Of="repo_interrupt",Df=25,xf=(Lf.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},Lf);function Lf(t,e,n,r){this.repoInfo_=t,this.forceRestClient_=e,this.app=n,this.authTokenProvider_=r,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Nf,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=zc(),this.transactionQueueTree_=new rf,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}function Mf(s){if(s.stats_=Na(s.repoInfo_),s.forceRestClient_||0<=("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i))s.server_=new Kc(s.repoInfo_,function(t,e,n,r){jf(s,t,e,n,r)},s.authTokenProvider_),setTimeout(function(){return qf(s,!0)},0);else{var t=s.app.options.databaseAuthVariableOverride;if(null!=t){if("object"!=typeof t)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Ro(t)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}s.persistentConnection_=new Tu(s.repoInfo_,s.app.options.appId,function(t,e,n,r){jf(s,t,e,n,r)},function(t){qf(s,t)},function(t){var n;n=s,ia(t,function(t,e){Vf(n,t,e)})},s.authTokenProvider_,t),s.server_=s.persistentConnection_}var e,n;s.authTokenProvider_.addTokenChangeListener(function(t){s.server_.refreshAuthToken(t)}),s.statsReporter_=(e=s.repoInfo_,n=function(){return new Zc(s.stats_,s.server_)},e=e.toString(),Ca[e]||(Ca[e]=n()),Ca[e]),s.infoData_=new Hc,s.infoSyncTree_=new Nl({startListening:function(t,e,n,r){var i=[],o=s.infoData_.getNode(t.path);return o.isEmpty()||(i=Pl(s.infoSyncTree_,t.path,o),setTimeout(function(){r("ok")},0)),i},stopListening:function(){}}),Vf(s,"connected",!1),s.serverSyncTree_=new Nl({startListening:function(n,t,e,r){return s.server_.listen(n,e,t,function(t,e){e=r(t,e);Rf(s.eventQueue_,n.path,e)}),[]},stopListening:function(t,e){s.server_.unlisten(t,e)}})}function Ff(t){t=t.infoData_.getNode(new Za(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t}function Uf(t){return Yl({timestamp:Ff(t)})}function jf(t,e,n,r,i){t.dataUpdateCount++;var o=new Za(e);n=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,n):n;var s,a,u,c=[],h=o;0<(c=i?r?(s=Lo(n,function(t){return pc(t)}),function(t,e,n,r){var i=Vl(t,r);if(i){r=Bl(i),i=r.path,r=r.queryId,e=hu(i,e),n=Th.fromObject(n);return Kl(t,i,new hh(rh(r),e,n))}return[]}(t.serverSyncTree_,o,s,i)):(e=pc(n),s=t.serverSyncTree_,a=o,u=e,null==(i=Vl(s,e=i))?[]:(e=Bl(i),i=e.path,e=e.queryId,a=hu(i,a),Kl(s,i,new uh(rh(e),a,u)))):r?(a=Lo(n,function(t){return pc(t)}),u=t.serverSyncTree_,r=o,a=a,a=Th.fromObject(a),Ml(u,new hh(nh(),r,a))):(n=pc(n),Pl(t.serverSyncTree_,o,n))).length&&(h=$f(t,o)),Rf(t.eventQueue_,h,c)}function qf(t,e){Vf(t,"connected",e),!1===e&&function(n){Qf(n,"onDisconnectEvents");var r=Uf(n),i=zc();Yc(n.onDisconnect_,eu(),function(t,e){e=tf(t,e,n.serverSyncTree_,r);Qc(i,t,e)});var o=[];Yc(i,eu(),function(t,e){o=o.concat(Pl(n.serverSyncTree_,t,e));t=np(n,t);$f(n,t)}),n.onDisconnect_=zc(),Rf(n.eventQueue_,eu(),o)}(t)}function Vf(t,e,n){e=new Za("/.info/"+e),n=pc(n);t.infoData_.updateSnapshot(e,n);n=Pl(t.infoSyncTree_,e,n);Rf(t.eventQueue_,e,n)}function Bf(t){return t.nextWriteId_++}function Kf(r,i,t,e,o){Qf(r,"set",{path:i.toString(),value:t,priority:e});var n=Uf(r),t=pc(t,e),e=xl(r.serverSyncTree_,i),n=ef(t,e,n),s=Bf(r),n=Al(r.serverSyncTree_,i,n,s,!0);Af(r.eventQueue_,n),r.server_.put(i.toString(),t.val(!0),function(t,e){var n="ok"===t;n||Zs("set at "+i+" failed: "+t);n=Rl(r.serverSyncTree_,s,!n);Rf(r.eventQueue_,i,n),Yf(0,o,t,e)});t=np(r,i);$f(r,t),Rf(r.eventQueue_,t,[])}function Wf(n,r,i){n.server_.onDisconnectCancel(r.toString(),function(t,e){"ok"===t&&!function t(n,e){if(cu(e))return n.value=null,n.children.clear(),!0;if(null!==n.value){if(n.value.isLeafNode())return!1;var r=n.value;return n.value=null,r.forEachChild(Ju,function(t,e){Qc(n,new Za(t),e)}),t(n,e)}if(0<n.children.size)return r=nu(e),e=iu(e),n.children.has(r)&&t(n.children.get(r),e)&&n.children.delete(r),0===n.children.size;return!0}(n.onDisconnect_,r),Yf(0,i,t,e)})}function Hf(n,r,t,i){var o=pc(t);n.server_.onDisconnectPut(r.toString(),o.val(!0),function(t,e){"ok"===t&&Qc(n.onDisconnect_,r,o),Yf(0,i,t,e)})}function Gf(t,e,n){n=".info"===nu(e.path)?Dl(t.infoSyncTree_,e,n):Dl(t.serverSyncTree_,e,n);kf(t.eventQueue_,e.path,n)}function zf(t){t.persistentConnection_&&t.persistentConnection_.interrupt(Of)}function Qf(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r="";t.persistentConnection_&&(r=t.persistentConnection_.id+":"),Xs.apply(void 0,no([r],eo(e)))}function Yf(t,n,r,i){n&&fa(function(){var t,e;"ok"===r?n(null):(e=t=(r||"error").toUpperCase(),i&&(e+=": "+i),(e=new Error(e)).code=t,n(e))})}function Xf(t,e,n){return xl(t.serverSyncTree_,e,n)||uc.EMPTY_NODE}function Jf(e,t){var n;(t=void 0===t?e.transactionQueueTree_:t)||ep(e,t),sf(t)?(n=tp(e,t),so(0<n.length,"Sending zero length transaction queue"),n.every(function(t){return 0===t.status})&&function(i,o,s){for(var t=s.map(function(t){return t.currentWriteId}),e=Xf(i,o,t),n=e,t=e.hash(),r=0;r<s.length;r++){var a=s[r];so(0===a.status,"tryToSendTransactionQueue_: items in queue should all be run."),a.status=1,a.retryCount++;var u=hu(o,a.path);n=n.updateChild(u,a.currentOutputSnapshotRaw)}var e=n.val(!0),c=o;i.server_.put(c.toString(),e,function(t){Qf(i,"transaction put response",{path:c.toString(),status:t});var e=[];if("ok"===t){for(var n=[],r=0;r<s.length;r++)!function(t){s[t].status=2,e=e.concat(Rl(i.serverSyncTree_,s[t].currentWriteId)),s[t].onComplete&&n.push(function(){return s[t].onComplete(null,!0,s[t].currentOutputSnapshotResolved)}),s[t].unwatcher()}(r);ep(i,of(i.transactionQueueTree_,o)),Jf(i,i.transactionQueueTree_),Rf(i.eventQueue_,o,e);for(r=0;r<n.length;r++)fa(n[r])}else{if("datastale"===t)for(r=0;r<s.length;r++)3===s[r].status?s[r].status=4:s[r].status=0;else{Zs("transaction at "+c.toString()+" failed: "+t);for(r=0;r<s.length;r++)s[r].status=4,s[r].abortReason=t}$f(i,o)}},t)}(e,hf(t),n)):uf(t)&&cf(t,function(t){Jf(e,t)})}function $f(t,e){var n=Zf(t,e),e=hf(n);return function(u,c,h){if(0===c.length)return;for(var l=[],f=[],p=c.filter(function(t){return 0===t.status}).map(function(t){return t.currentWriteId}),t=0;t<c.length;t++)!function(t){var e,n,r,i,o=c[t],s=hu(h,o.path),a=!1;so(null!==s,"rerunTransactionsUnderNode_: relativePath should not be null."),4===o.status?(a=!0,e=o.abortReason,f=f.concat(Rl(u.serverSyncTree_,o.currentWriteId,!0))):0===o.status&&(f=o.retryCount>=Df?(a=!0,e="maxretry",f.concat(Rl(u.serverSyncTree_,o.currentWriteId,!0))):(n=Xf(u,o.path,p),o.currentInputSnapshot=n,void 0!==(i=c[t].update(n.val()))?(Sf("transaction failed: Data returned ",i,o.path),r=pc(i),"object"==typeof i&&null!=i&&Oo(i,".priority")||(r=r.updatePriority(n.getPriority())),s=o.currentWriteId,i=Uf(u),i=ef(r,n,i),o.currentOutputSnapshotRaw=r,o.currentOutputSnapshotResolved=i,o.currentWriteId=Bf(u),p.splice(p.indexOf(s),1),(f=f.concat(Al(u.serverSyncTree_,o.path,i,o.currentWriteId,o.applyLocally))).concat(Rl(u.serverSyncTree_,s,!0))):(a=!0,e="nodata",f.concat(Rl(u.serverSyncTree_,o.currentWriteId,!0))))),Rf(u.eventQueue_,h,f),f=[],a&&(c[t].status=2,a=c[t].unwatcher,setTimeout(a,Math.floor(0)),c[t].onComplete&&("nodata"===e?l.push(function(){return c[t].onComplete(null,!1,c[t].currentInputSnapshot)}):l.push(function(){return c[t].onComplete(new Error(e),!1,null)})))}(t);ep(u,u.transactionQueueTree_);for(t=0;t<l.length;t++)fa(l[t]);Jf(u,u.transactionQueueTree_)}(t,tp(t,n),e),e}function Zf(t,e){for(var n=t.transactionQueueTree_,r=nu(e);null!==r&&void 0===sf(n);)n=of(n,r),r=nu(e=iu(e));return n}function tp(t,e){var n=[];return function e(n,t,r){var i=sf(t);if(i)for(var o=0;o<i.length;o++)r.push(i[o]);cf(t,function(t){e(n,t,r)})}(t,e,n),n.sort(function(t,e){return t.order-e.order}),n}function ep(e,t){var n=sf(t);if(n){for(var r=0,i=0;i<n.length;i++)2!==n[i].status&&(n[r]=n[i],r++);n.length=r,af(t,0<n.length?n:void 0)}cf(t,function(t){ep(e,t)})}function np(e,t){var n=hf(Zf(e,t)),t=of(e.transactionQueueTree_,t);return function(t,e,n){for(var r=n?t:t.parent;null!==r;){if(e(r))return;r=r.parent}}(t,function(t){rp(e,t)}),rp(e,t),function e(t,n,r,i){r&&!i&&n(t),cf(t,function(t){e(t,n,!0,i)}),r&&i&&n(t)}(t,function(t){rp(e,t)}),n}function rp(t,e){var n=sf(e);if(n){for(var r=[],i=[],o=-1,s=0;s<n.length;s++)3===n[s].status||(1===n[s].status?(so(o===s-1,"All SENT items should be at beginning of queue."),n[o=s].status=3,n[s].abortReason="set"):(so(0===n[s].status,"Unexpected transaction status in abort"),n[s].unwatcher(),i=i.concat(Rl(t.serverSyncTree_,n[s].currentWriteId,!0)),n[s].onComplete&&r.push(n[s].onComplete.bind(null,new Error("set"),!1,null))));-1===o?af(e,void 0):n.length=o+1,Rf(t.eventQueue_,hf(e),i);for(s=0;s<r.length;s++)fa(r[s])}}var ip=function(t,e){var n=op(t),r=n.namespace;"firebase.com"===n.domain&&$s(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),r&&"undefined"!==r||"localhost"===n.domain||$s("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&Zs("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");t="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new wa(n.host,n.secure,r,e,t,"",r!==n.subdomain),path:new Za(n.pathString)}},op=function(t){var e,n,r,i="",o="",s="",a="",u="",c=!0,h="https",l=443;return"string"==typeof t&&(0<=(r=t.indexOf("//"))&&(h=t.substring(0,r-1),t=t.substring(r+2)),-1===(e=t.indexOf("/"))&&(e=t.length),-1===(n=t.indexOf("?"))&&(n=t.length),i=t.substring(0,Math.min(e,n)),e<n&&(a=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(e,n))),n=function(t){var e,n,r={};"?"===t.charAt(0)&&(t=t.substring(1));try{for(var i=to(t.split("&")),o=i.next();!o.done;o=i.next()){var s,a=o.value;0!==a.length&&(2===(s=a.split("=")).length?r[decodeURIComponent(s[0])]=decodeURIComponent(s[1]):Zs("Invalid query segment '"+a+"' 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,n))),0<=(r=i.indexOf(":"))?(c="https"===h||"wss"===h,l=parseInt(i.substring(r+1),10)):r=i.length,"localhost"===(r=i.slice(0,r)).toLowerCase()?o="localhost":r.split(".").length<=2?o=r:(r=i.indexOf("."),s=i.substring(0,r).toLowerCase(),o=i.substring(r+1),u=s),"ns"in n&&(u=n.ns)),{host:i,port:l,domain:o,subdomain:s,secure:c,scheme:h,pathString:a,namespace:u}},sp=(ap.prototype.val=function(){return Ko("DataSnapshot.val",0,0,arguments.length),this.node_.val()},ap.prototype.exportVal=function(){return Ko("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},ap.prototype.toJSON=function(){return Ko("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},ap.prototype.exists=function(){return Ko("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},ap.prototype.child=function(t){Ko("DataSnapshot.child",0,1,arguments.length),t=String(t),wf("DataSnapshot.child",1,t,!1);var e=new Za(t),t=this.ref_.child(e);return new ap(this.node_.getChild(e),t,Ju)},ap.prototype.hasChild=function(t){Ko("DataSnapshot.hasChild",1,1,arguments.length),wf("DataSnapshot.hasChild",1,t,!1);t=new Za(t);return!this.node_.getChild(t).isEmpty()},ap.prototype.getPriority=function(){return Ko("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},ap.prototype.forEach=function(n){var r=this;return Ko("DataSnapshot.forEach",1,1,arguments.length),Ho("DataSnapshot.forEach",1,n,!1),!this.node_.isLeafNode()&&!!this.node_.forEachChild(this.index_,function(t,e){return n(new ap(e,r.ref_.child(t),Ju))})},ap.prototype.hasChildren=function(){return Ko("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(ap.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!1,configurable:!0}),ap.prototype.numChildren=function(){return Ko("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},ap.prototype.getRef=function(){return Ko("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(ap.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),ap);function ap(t,e,n){this.node_=t,this.ref_=e,this.index_=n}var up=(cp.prototype.cancel=function(t){Ko("OnDisconnect.cancel",0,1,arguments.length),Ho("OnDisconnect.cancel",1,t,!0);var e=new lo;return Wf(this.repo_,this.path_,e.wrapCallback(t)),e.promise},cp.prototype.remove=function(t){Ko("OnDisconnect.remove",0,1,arguments.length),_f("OnDisconnect.remove",this.path_),Ho("OnDisconnect.remove",1,t,!0);var e=new lo;return Hf(this.repo_,this.path_,null,e.wrapCallback(t)),e.promise},cp.prototype.set=function(t,e){Ko("OnDisconnect.set",1,2,arguments.length),_f("OnDisconnect.set",this.path_),vf("OnDisconnect.set",1,t,this.path_,!1),Ho("OnDisconnect.set",2,e,!0);var n=new lo;return Hf(this.repo_,this.path_,t,n.wrapCallback(e)),n.promise},cp.prototype.setWithPriority=function(t,e,n){Ko("OnDisconnect.setWithPriority",2,3,arguments.length),_f("OnDisconnect.setWithPriority",this.path_),vf("OnDisconnect.setWithPriority",1,t,this.path_,!1),yf("OnDisconnect.setWithPriority",2,e,!1),Ho("OnDisconnect.setWithPriority",3,n,!0);var r,i,o,s,a=new lo;return r=this.repo_,i=this.path_,t=t,e=e,o=a.wrapCallback(n),s=pc(t,e),r.server_.onDisconnectPut(i.toString(),s.val(!0),function(t,e){"ok"===t&&Qc(r.onDisconnect_,i,s),Yf(0,o,t,e)}),a.promise},cp.prototype.update=function(t,e){if(Ko("OnDisconnect.update",1,2,arguments.length),_f("OnDisconnect.update",this.path_),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,Zs("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.")}gf("OnDisconnect.update",1,t,this.path_,!1),Ho("OnDisconnect.update",2,e,!0);var i=new lo;return function(n,r,i,o){if(xo(i))return Xs("onDisconnect().update() called with empty data. Don't do anything."),Yf(0,o,"ok",void 0);n.server_.onDisconnectMerge(r.toString(),i,function(t,e){"ok"===t&&ia(i,function(t,e){e=pc(e);Qc(n.onDisconnect_,uu(r,t),e)}),Yf(0,o,t,e)})}(this.repo_,this.path_,t,i.wrapCallback(e)),i.promise},cp);function cp(t,e){this.repo_=t,this.path_=e}var hp=(lp.prototype.getPath=function(){var t=this.snapshot.getRef();return("value"===this.eventType?t:t.getParent()).path},lp.prototype.getEventType=function(){return this.eventType},lp.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},lp.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+Ro(this.snapshot.exportVal())},lp);function lp(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}var fp=(pp.prototype.getPath=function(){return this.path},pp.prototype.getEventType=function(){return"cancel"},pp.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},pp.prototype.toString=function(){return this.path.toString()+":cancel"},pp);function pp(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}var dp=(vp.prototype.respondsTo=function(t){return"value"===t},vp.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new hp("value",this,new sp(t.snapshotNode,e.getRef(),n))},vp.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){so(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)}},vp.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new fp(this,t,e):null},vp.prototype.matches=function(t){return t instanceof vp&&(!t.callback_||!this.callback_||t.callback_===this.callback_&&t.context_===this.context_)},vp.prototype.hasAnyCallback=function(){return null!==this.callback_},vp);function vp(t,e,n){this.callback_=t,this.cancelCallback_=e,this.context_=n}var gp,yp=(mp.prototype.respondsTo=function(t){t="children_removed"===(t="children_added"===t?"child_added":t)?"child_removed":t;return Oo(this.callbacks_,t)},mp.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new fp(this,t,e):null},mp.prototype.createEvent=function(t,e){so(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),e=e.getQueryParams().getIndex();return new hp(t.type,this,new sp(t.snapshotNode,n,e),t.prevName)},mp.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){so(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)}},mp.prototype.matches=function(e){var n=this;if(e instanceof mp){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]});t=t[0],r=r[0];return!(r!==t||e.callbacks_[t]&&this.callbacks_[r]&&e.callbacks_[t]!==this.callbacks_[r])}}}return!1},mp.prototype.hasAnyCallback=function(){return null!==this.callbacks_},mp);function mp(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}var bp=(Object.defineProperty(wp,"__referenceConstructor",{get:function(){return so(gp,"Reference.ts has not been loaded"),gp},set:function(t){gp=t},enumerable:!1,configurable:!0}),wp.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===Pu){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(), startAfter(), endAt(), endBefore(), or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!==ta)throw new Error(r);if("string"!=typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!==ea)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===Ju){if(null!=e&&!df(e)||null!=n&&!df(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), startAfter() endAt(), endBefore(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(so(t.getIndex()instanceof gc||t.getIndex()===Tc,"unknown index type."),null!=e&&"object"==typeof e||null!=n&&"object"==typeof n)throw new Error("Query: First argument passed to startAt(), startAfter(), endAt(), endBefore(), or equalTo() cannot be an object.")},wp.validateLimit_=function(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), startAfter(), endAt(), endBefore(), and limit(). Use limitToFirst() or limitToLast() instead.")},wp.prototype.validateNoPreviousOrderByCall_=function(t){if(!0===this.orderByCalled_)throw new Error(t+": You can't combine multiple orderBy calls.")},wp.prototype.getQueryParams=function(){return this.queryParams_},wp.prototype.getRef=function(){return Ko("Query.ref",0,0,arguments.length),new wp.__referenceConstructor(this.database,this.path)},wp.prototype.on=function(t,e,n,r){Ko("Query.on",2,4,arguments.length),mf("Query.on",1,t,!1),Ho("Query.on",2,e,!1);n=wp.getCancelAndContextArgs_("Query.on",n,r);return"value"===t?this.onValueEvent(e,n.cancel,n.context):((r={})[t]=e,this.onChildEvent(r,n.cancel,n.context)),e},wp.prototype.onValueEvent=function(t,e,n){n=new dp(t,e||null,n||null);Gf(this.repo,this,n)},wp.prototype.onChildEvent=function(t,e,n){n=new yp(t,e,n);Gf(this.repo,this,n)},wp.prototype.off=function(t,e,n){Ko("Query.off",0,3,arguments.length),mf("Query.off",1,t,!0),Ho("Query.off",2,e,!0),Go("Query.off",3,n,!0);var r=null,i=null;"value"===t?r=new dp(e||null,null,n||null):t&&(e&&((i={})[t]=e),r=new yp(i,null,n||null)),i=this.repo,n=r,n=".info"===nu((r=this).path)?Ol(i.infoSyncTree_,r,n):Ol(i.serverSyncTree_,r,n),kf(i.eventQueue_,r.path,n)},wp.prototype.get=function(){var n,r,t,e=this;return n=this.repo,r=this,(null!=(t=Ll(n.serverSyncTree_,r))?Promise.resolve(t):n.server_.get(r).then(function(t){var e=pc(t),t=Pl(n.serverSyncTree_,r.path,e);return kf(n.eventQueue_,r.path,t),Promise.resolve(e)},function(t){return Qf(n,"get for query "+Ro(r)+" failed: "+t),Promise.reject(new Error(t))})).then(function(t){return new sp(t,e.getRef(),e.getQueryParams().getIndex())})},wp.prototype.once=function(e,n,t,r){var i=this;Ko("Query.once",1,4,arguments.length),mf("Query.once",1,e,!1),Ho("Query.once",2,n,!0);var o=wp.getCancelAndContextArgs_("Query.once",t,r),s=!0,a=new lo;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},wp.prototype.limitToFirst=function(t){if(Ko("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 wp(this.database,this.path,(e=this.queryParams_,t=t,(e=e.copy()).limitSet_=!0,e.limit_=t,e.viewFrom_="l",e),this.orderByCalled_);var e},wp.prototype.limitToLast=function(t){if(Ko("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 wp(this.database,this.path,(e=this.queryParams_,t=t,(e=e.copy()).limitSet_=!0,e.limit_=t,e.viewFrom_="r",e),this.orderByCalled_);var e},wp.prototype.orderByChild=function(t){if(Ko("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.');wf("Query.orderByChild",1,t,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");t=new Za(t);if(cu(t))throw new Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");t=new gc(t),t=qc(this.queryParams_,t);return wp.validateQueryEndpoints_(t),new wp(this.database,this.path,t,!0)},wp.prototype.orderByKey=function(){Ko("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var t=qc(this.queryParams_,Pu);return wp.validateQueryEndpoints_(t),new wp(this.database,this.path,t,!0)},wp.prototype.orderByPriority=function(){Ko("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var t=qc(this.queryParams_,Ju);return wp.validateQueryEndpoints_(t),new wp(this.database,this.path,t,!0)},wp.prototype.orderByValue=function(){Ko("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var t=qc(this.queryParams_,Tc);return wp.validateQueryEndpoints_(t),new wp(this.database,this.path,t,!0)},wp.prototype.startAt=function(t,e){void 0===t&&(t=null),Ko("Query.startAt",0,2,arguments.length),vf("Query.startAt",1,t,this.path,!0),bf("Query.startAt",2,e,!0);var n=Uc(this.queryParams_,t,e);if(wp.validateLimit_(n),wp.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 wp(this.database,this.path,n,this.orderByCalled_)},wp.prototype.startAfter=function(t,e){void 0===t&&(t=null),Ko("Query.startAfter",0,2,arguments.length),vf("Query.startAfter",1,t,this.path,!1),bf("Query.startAfter",2,e,!0);var n,e=(n=this.queryParams_,t=t,e=e,(e=n.index_===Pu?Uc(n,t="string"==typeof t?bc(t):t,e):Uc(n,t,null==e?ea:bc(e))).startAfterSet_=!0,e);if(wp.validateLimit_(e),wp.validateQueryEndpoints_(e),this.queryParams_.hasStart())throw new Error("Query.startAfter: Starting point was already set (by another call to startAt, startAfter or equalTo).");return new wp(this.database,this.path,e,this.orderByCalled_)},wp.prototype.endAt=function(t,e){void 0===t&&(t=null),Ko("Query.endAt",0,2,arguments.length),vf("Query.endAt",1,t,this.path,!0),bf("Query.endAt",2,e,!0);e=jc(this.queryParams_,t,e);if(wp.validateLimit_(e),wp.validateQueryEndpoints_(e),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt, endBefore, or equalTo).");return new wp(this.database,this.path,e,this.orderByCalled_)},wp.prototype.endBefore=function(t,e){void 0===t&&(t=null),Ko("Query.endBefore",0,2,arguments.length),vf("Query.endBefore",1,t,this.path,!1),bf("Query.endBefore",2,e,!0);var n,e=(n=this.queryParams_,t=t,e=e,(e=n.index_===Pu?jc(n,t="string"==typeof t?wc(t):t,e):jc(n,t,null==e?ta:wc(e))).endBeforeSet_=!0,e);if(wp.validateLimit_(e),wp.validateQueryEndpoints_(e),this.queryParams_.hasEnd())throw new Error("Query.endBefore: Ending point was already set (by another call to endAt, endBefore, or equalTo).");return new wp(this.database,this.path,e,this.orderByCalled_)},wp.prototype.equalTo=function(t,e){if(Ko("Query.equalTo",1,2,arguments.length),vf("Query.equalTo",1,t,this.path,!1),bf("Query.equalTo",2,e,!0),this.queryParams_.hasStart())throw new Error("Query.equalTo: Starting point was already set (by another call to startAt/startAfter or equalTo).");if(this.queryParams_.hasEnd())throw new Error("Query.equalTo: Ending point was already set (by another call to endAt/endBefore or equalTo).");return this.startAt(t,e).endAt(t,e)},wp.prototype.toString=function(){return Ko("Query.toString",0,0,arguments.length),this.repo.toString()+function(t){for(var e="",n=t.pieceNum_;n<t.pieces_.length;n++)""!==t.pieces_[n]&&(e+="/"+encodeURIComponent(String(t.pieces_[n])));return e||"/"}(this.path)},wp.prototype.toJSON=function(){return Ko("Query.toJSON",0,1,arguments.length),this.toString()},wp.prototype.queryObject=function(){return t=this.queryParams_,n={},t.startSet_&&(n.sp=t.indexStartValue_,t.startNameSet_&&(n.sn=t.indexStartName_)),t.endSet_&&(n.ep=t.indexEndValue_,t.endNameSet_&&(n.en=t.indexEndName_)),t.limitSet_&&(n.l=t.limit_,""===(e=t.viewFrom_)&&(e=t.isViewFromLeft()?"l":"r"),n.vf=e),t.index_!==Ju&&(n.i=t.index_.toString()),n;var t,e,n},wp.prototype.queryIdentifier=function(){var t=this.queryObject(),t=ra(t);return"{}"===t?"default":t},wp.prototype.isEqual=function(t){if(Ko("Query.isEqual",1,1,arguments.length),!(t instanceof wp))throw new Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.");var e=this.repo===t.repo,n=fu(this.path,t.path),t=this.queryIdentifier()===t.queryIdentifier();return e&&n&&t},wp.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,Ho(t,3,r.cancel,!0),r.context=n,Go(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(Wo(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(wp.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),wp);function wp(t,e,n,r){this.database=t,this.path=e,this.queryParams_=n,this.orderByCalled_=r,this.repo=t.repo_}var _p=(Ip.prototype.toJSON=function(){return Ko("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},Ip);function Ip(t,e){this.committed=t,this.snapshot=e}var Tp,Ep,Sp=(Xi(Cp,Tp=bp),Cp.prototype.getKey=function(){return Ko("Reference.key",0,0,arguments.length),cu(this.path)?null:ou(this.path)},Cp.prototype.child=function(t){var e,n,r,i;return Ko("Reference.child",1,1,arguments.length),"number"==typeof t?t=String(t):t instanceof Za||(null===nu(this.path)?(e="Reference.child",i=!(n=1),r=(r=t)&&r.replace(/^\/*\.info(\/|$)/,"/"),wf(e,n,r,i)):wf("Reference.child",1,t,!1)),new Cp(this.database,uu(this.path,t))},Cp.prototype.getParent=function(){Ko("Reference.parent",0,0,arguments.length);var t=au(this.path);return null===t?null:new Cp(this.database,t)},Cp.prototype.getRoot=function(){Ko("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},Cp.prototype.set=function(t,e){Ko("Reference.set",1,2,arguments.length),_f("Reference.set",this.path),vf("Reference.set",1,t,this.path,!1),Ho("Reference.set",2,e,!0);var n=new lo;return Kf(this.repo,this.path,t,null,n.wrapCallback(e)),n.promise},Cp.prototype.update=function(t,e){if(Ko("Reference.update",1,2,arguments.length),_f("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,Zs("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.")}gf("Reference.update",1,t,this.path,!1),Ho("Reference.update",2,e,!0);var i=new lo;return function(i,o,t,s){Qf(i,"update",{path:o.toString(),value:t});var a,e,n=!0,r=Uf(i),u={};ia(t,function(t,e){n=!1,u[t]=tf(uu(o,t),pc(e),i.serverSyncTree_,r)}),n?(Xs("update() called with empty data. Don't do anything."),Yf(0,s,"ok",void 0)):(a=Bf(i),e=kl(i.serverSyncTree_,o,u,a),Af(i.eventQueue_,e),i.server_.merge(o.toString(),t,function(t,e){var n="ok"===t;n||Zs("update at "+o+" failed: "+t);var r=Rl(i.serverSyncTree_,a,!n),n=0<r.length?$f(i,o):o;Rf(i.eventQueue_,n,r),Yf(0,s,t,e)}),ia(t,function(t){t=np(i,uu(o,t));$f(i,t)}),Rf(i.eventQueue_,o,[]))}(this.repo,this.path,t,i.wrapCallback(e)),i.promise},Cp.prototype.setWithPriority=function(t,e,n){if(Ko("Reference.setWithPriority",2,3,arguments.length),_f("Reference.setWithPriority",this.path),vf("Reference.setWithPriority",1,t,this.path,!1),yf("Reference.setWithPriority",2,e,!1),Ho("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 lo;return Kf(this.repo,this.path,t,e,r.wrapCallback(n)),r.promise},Cp.prototype.remove=function(t){return Ko("Reference.remove",0,1,arguments.length),_f("Reference.remove",this.path),Ho("Reference.remove",1,t,!0),this.set(null,t)},Cp.prototype.transaction=function(t,r,e){var i=this;if(Ko("Reference.transaction",1,3,arguments.length),_f("Reference.transaction",this.path),Ho("Reference.transaction",1,t,!1),Ho("Reference.transaction",2,r,!0),function(t,e,n,r){if((!r||void 0!==n)&&"boolean"!=typeof n)throw new Error(Wo(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 o=new lo;"function"==typeof r&&o.promise.catch(function(){});function n(){}var s=new Cp(this.database,this.path);s.on("value",n);return function(t,e,n,r,i,o){Qf(t,"transaction on "+e);var s={path:e,update:n,onComplete:r,status:null,order:Gs(),applyLocally:o,retryCount:0,unwatcher:i,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},n=Xf(t,e,void 0);s.currentInputSnapshot=n,void 0===(r=s.update(n.val()))?(s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete&&s.onComplete(null,!1,s.currentInputSnapshot)):(Sf("transaction failed: Data returned ",r,s.path),s.status=0,(i=sf(o=of(t.transactionQueueTree_,e))||[]).push(s),af(o,i),o=void 0,"object"==typeof r&&null!==r&&Oo(r,".priority")?(o=Do(r,".priority"),so(df(o),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):o=(xl(t.serverSyncTree_,e)||uc.EMPTY_NODE).getPriority().val(),i=Uf(t),o=pc(r,o),i=ef(o,n,i),s.currentOutputSnapshotRaw=o,s.currentOutputSnapshotResolved=i,s.currentWriteId=Bf(t),s=Al(t.serverSyncTree_,e,i,s.currentWriteId,s.applyLocally),Rf(t.eventQueue_,e,s),Jf(t,t.transactionQueueTree_))}(this.repo,this.path,t,function(t,e,n){t?(o.reject(t),"function"==typeof r&&r(t,e,null)):(n=new sp(n,new Cp(i.database,i.path),Ju),o.resolve(new _p(e,n)),"function"==typeof r&&r(null,e,n))},function(){s.off("value",n)},e),o.promise},Cp.prototype.setPriority=function(t,e){Ko("Reference.setPriority",1,2,arguments.length),_f("Reference.setPriority",this.path),yf("Reference.setPriority",1,t,!1),Ho("Reference.setPriority",2,e,!0);var n=new lo;return Kf(this.repo,uu(this.path,".priority"),t,null,n.wrapCallback(e)),n.promise},Cp.prototype.push=function(t,e){Ko("Reference.push",0,2,arguments.length),_f("Reference.push",this.path),vf("Reference.push",1,t,this.path,!0),Ho("Reference.push",2,e,!0);var n=Ff(this.repo),r=Sc(n),n=this.child(r),i=this.child(r),t=null!=t?n.set(t,e).then(function(){return i}):Promise.resolve(i);return n.then=t.then.bind(t),n.catch=t.then.bind(t,void 0),"function"==typeof e&&t.catch(function(){}),n},Cp.prototype.onDisconnect=function(){return _f("Reference.onDisconnect",this.path),new up(this.repo,this.path)},Object.defineProperty(Cp.prototype,"key",{get:function(){return this.getKey()},enumerable:!1,configurable:!0}),Object.defineProperty(Cp.prototype,"parent",{get:function(){return this.getParent()},enumerable:!1,configurable:!0}),Object.defineProperty(Cp.prototype,"root",{get:function(){return this.getRoot()},enumerable:!1,configurable:!0}),Cp);function Cp(t,e){return Tp.call(this,t,e,new Mc,!1)||this}bp.__referenceConstructor=Sp,Ep=Sp,so(!ul,"__referenceConstructor has already been defined"),ul=Ep;var Np="FIREBASE_DATABASE_EMULATOR_HOST",Ap={},kp=!1;function Rp(t,e,n,r){var i=n||t.options.databaseURL;void 0===i&&(t.options.projectId||$s("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),Xs("Using default host for project ",t.options.projectId),i=t.options.projectId+"-default-rtdb.firebaseio.com");var o,s=ip(i,r),a=s.repoInfo,n=void 0;(n="undefined"!=typeof process?process.env[Np]:n)?(o=!0,i="http://"+n+"?ns="+a.namespace,a=(s=ip(i,r)).repoInfo):o=!s.repoInfo.secure;e=r&&o?new va:new pa(t,e);Cf("Invalid Firebase Database URL",1,s),cu(s.path)||$s("Database URL must point to the root of a Firebase Database (not including a child path).");e=function(t,e,n){var r=Do(Ap,e.name);r||(r={},Ap[e.name]=r);var i=Do(r,t.toURLString());i&&$s("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call.");return i=new xf(t,kp,e,n),r[t.toURLString()]=i}(a,t,e);return new Pp(e)}var Pp=(Object.defineProperty(Op.prototype,"repo_",{get:function(){return this.instanceStarted_||(Mf(this.repoInternal_),this.instanceStarted_=!0),this.repoInternal_},enumerable:!1,configurable:!0}),Object.defineProperty(Op.prototype,"root_",{get:function(){return this.rootInternal_||(this.rootInternal_=new Sp(this,eu())),this.rootInternal_},enumerable:!1,configurable:!0}),Object.defineProperty(Op.prototype,"app",{get:function(){return this.repo_.app},enumerable:!1,configurable:!0}),Op.prototype.useEmulator=function(t,e){var n;this.checkDeleted_("useEmulator"),this.instanceStarted_?$s("Cannot call useEmulator() after instance has already been initialized."):(n=this.repoInternal_,t=t,e=e,n.repoInfo_=new wa(t+":"+e,!1,n.repoInfo_.namespace,n.repoInfo_.webSocketOnly,n.repoInfo_.nodeAdmin,n.repoInfo_.persistenceKey,n.repoInfo_.includeNamespaceInQueryParams),n.repoInfo_.nodeAdmin&&(n.authTokenProvider_=new va))},Op.prototype.ref=function(t){return this.checkDeleted_("ref"),Ko("database.ref",0,1,arguments.length),t instanceof Sp?this.refFromURL(t.toString()):void 0!==t?this.root_.child(t):this.root_},Op.prototype.refFromURL=function(t){var e="database.refFromURL";this.checkDeleted_(e),Ko(e,1,1,arguments.length);var n=ip(t,this.repo_.repoInfo_.nodeAdmin);Cf(e,1,n);t=n.repoInfo;return this.repo_.repoInfo_.isCustomHost()||t.host===this.repo_.repoInfo_.host||$s(e+": Host name does not match the current database: (found "+t.host+" but expected "+this.repo_.repoInfo_.host+")"),this.ref(n.path.toString())},Op.prototype.checkDeleted_=function(t){null===this.repoInternal_&&$s("Cannot call "+t+" on a deleted database.")},Op.prototype.goOffline=function(){Ko("database.goOffline",0,0,arguments.length),this.checkDeleted_("goOffline"),zf(this.repo_)},Op.prototype.goOnline=function(){var t;Ko("database.goOnline",0,0,arguments.length),this.checkDeleted_("goOnline"),(t=this.repo_).persistentConnection_&&t.persistentConnection_.resume(Of)},Op.ServerValue={TIMESTAMP:{".sv":"timestamp"},increment:function(t){return{".sv":{increment:t}}}},Op);function Op(t){var e=this;this.repoInternal_=t,this.instanceStarted_=!1,this.INTERNAL={delete:function(){return $i(e,void 0,void 0,function(){return Zi(this,function(t){var e,n;return this.checkDeleted_("delete"),e=this.repo_,(n=Do(Ap,e.app.name))&&Do(n,e.key)===e||$s("Database "+e.app.name+"("+e.repoInfo_+") has already been deleted."),zf(e),delete n[e.key],this.repoInternal_=null,this.rootInternal_=null,[2]})})}},t instanceof xf||$s("Don't call new Database() directly - please use firebase.database().")}var Dp=Object.freeze({__proto__:null,forceLongPolling:function(){ja.forceDisallow(),Oa.forceAllow()},forceWebSockets:function(){Oa.forceDisallow()},isWebSocketsAvailable:function(){return ja.isAvailable()},setSecurityDebugCallback:function(t,e){t.repo.persistentConnection_.securityDebugCallback_=e},stats:function(t,e){var i;t=t.repo,void 0===(e=e)&&(e=!1),"undefined"!=typeof console&&(t=e?(t.statsListener_||(t.statsListener_=new Xc(t.stats_)),t.statsListener_.get()):t.stats_.get(),i=Object.keys(t).reduce(function(t,e){return Math.max(e.length,t)},0),ia(t,function(t,e){for(var n=t,r=t.length;r<i+2;r++)n+=" ";console.log(n+e)}))},statsIncrementCounter:function(t,e){t=t.repo,e=e,t.stats_.incrementCounter(e),t=t.statsReporter_,e=e,t.statsToReport_[e]=!0},dataUpdateCount:function(t){return t.repo.dataUpdateCount},interceptServerData:function(t,e){t=t.repo,e=e,t.interceptServerDataCallback_=e},initStandalone:function(t){var e=t.app,n=t.url,r=t.version,i=t.customAuthImpl,o=t.namespace,t=void 0!==(t=t.nodeAdmin)&&t;return Fa(r),(r=new rs("auth-internal",new os("database-standalone"))).setComponent(new ts("auth-internal",function(){return i},"PRIVATE")),{instance:Rp(e,r,n,t),namespace:o}}}),Sn=Tu;Tu.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},Tu.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var xp,Lp=Object.freeze({__proto__:null,DataConnection:Sn,RealTimeConnection:Ka,hijackHash:function(i){var o=Tu.prototype.put;return Tu.prototype.put=function(t,e,n,r){void 0!==r&&(r=i()),o.call(this,t,e,n,r)},function(){Tu.prototype.put=o}},ConnectionTarget:wa,queryIdentifier:function(t){return t.queryIdentifier()},forceRestClient:function(t){kp=t}}),Mp=Pp.ServerValue;Fa((xp=Xl).SDK_VERSION),xp.INTERNAL.registerComponent(new ts("database",function(t,e){e=e.instanceIdentifier;return Rp(t.getProvider("app").getImmediate(),t.getProvider("auth-internal"),e,void 0)},"PUBLIC").setServiceProps({Reference:Sp,Query:bp,Database:Pp,DataSnapshot:sp,enableLogging:Ms,INTERNAL:Dp,ServerValue:Mp,TEST_ACCESS:Lp}).setMultipleInstances(!0)),xp.registerVersion("@firebase/database","0.9.7");var Fp=function(t,e){return(Fp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function Up(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{value:(t=t&&r>=t.length?void 0:t)&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},jp={},qp=G||self;function Vp(){}function Bp(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function Kp(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Wp="closure_uid_"+(1e9*Math.random()>>>0),Hp=0;function Gp(t,e,n){return t.call.apply(t.bind,arguments)}function zp(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 Qp(t,e,n){return(Qp=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Gp:zp).apply(null,arguments)}function Yp(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)}}function Xp(){return Date.now()}function Jp(t,o){function e(){}e.prototype=o.prototype,t.X=o.prototype,t.prototype=new e,(t.prototype.constructor=t).Kb=function(t,e,n){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return o.prototype[e].apply(t,r)}}function $p(){this.j=this.j,this.i=this.i}$p.prototype.j=!1,$p.prototype.ja=function(){var t;!this.j&&(this.j=!0,this.G(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Wp)&&t[Wp]||(t[Wp]=++Hp))},$p.prototype.G=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var Zp=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},td=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 ed(){return Array.prototype.concat.apply([],arguments)}function nd(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 rd(t){return/^[\s\xa0]*$/.test(t)}var id,od=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function sd(t,e){return-1!=t.indexOf(e)}function ad(t,e){return t<e?-1:e<t?1:0}t:{var ud=qp.navigator;if(ud){ud=ud.userAgent;if(ud){id=ud;break t}}id=""}function cd(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function hd(t){var e,n={};for(e in t)n[e]=t[e];return n}var ld="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function fd(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<ld.length;i++)e=ld[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function pd(t){return pd[" "](t),t}pd[" "]=Vp;var dd,vd=sd(id,"Opera"),gd=sd(id,"Trident")||sd(id,"MSIE"),yd=sd(id,"Edge"),md=yd||gd,bd=sd(id,"Gecko")&&!(sd(id.toLowerCase(),"webkit")&&!sd(id,"Edge"))&&!(sd(id,"Trident")||sd(id,"MSIE"))&&!sd(id,"Edge"),wd=sd(id.toLowerCase(),"webkit")&&!sd(id,"Edge");function _d(){var t=qp.document;return t?t.documentMode:void 0}t:{var Id="",Td=(Td=id,bd?/rv:([^\);]+)(\)|;)/.exec(Td):yd?/Edge\/([\d\.]+)/.exec(Td):gd?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Td):wd?/WebKit\/(\S+)/.exec(Td):vd?/(?:Version)[ \/]?(\S+)/.exec(Td):void 0);if(Td&&(Id=Td?Td[1]:""),gd){Td=_d();if(null!=Td&&Td>parseFloat(Id)){dd=String(Td);break t}}dd=Id}var Ed={};function Sd(a){return t=a,e=function(){for(var t=0,e=od(String(dd)).split("."),n=od(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++)for(var o=e[i]||"",s=n[i]||"";o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],(0!=o[0].length||0!=s[0].length)&&(t=ad(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||ad(0==o[2].length,0==s[2].length)||ad(o[2],s[2]),o=o[3],s=s[3],0==t););return 0<=t},n=Ed,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}var Cd=qp.document&&gd&&(_d()||parseInt(dd,10))||void 0,Nd=!gd||9<=Number(Cd),Ad=gd&&!Sd("9"),kd=function(){if(!qp.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{qp.addEventListener("test",Vp,e),qp.removeEventListener("test",Vp,e)}catch(t){}return t}();function Rd(t,e){this.type=t,this.a=this.target=e,this.defaultPrevented=!1}function Pd(t,e){if(Rd.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(bd){t:{try{pd(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:Od[t.pointerType]||"",(this.c=t).defaultPrevented&&this.b()}}Rd.prototype.b=function(){this.defaultPrevented=!0},Jp(Pd,Rd);var Od={2:"touch",3:"pen",4:"mouse"};Pd.prototype.b=function(){Pd.X.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,Ad)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}};var Dd="closure_listenable_"+(1e6*Math.random()|0),xd=0;function Ld(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ca=i,this.key=++xd,this.Y=this.Z=!1}function Md(t){t.Y=!0,t.listener=null,t.proxy=null,t.src=null,t.ca=null}function Fd(t){this.src=t,this.a={},this.b=0}function Ud(t,e){var n,r,i,o=e.type;o in t.a&&(n=t.a[o],(i=0<=(r=Zp(n,e)))&&Array.prototype.splice.call(n,r,1),i&&(Md(e),0==t.a[o].length&&(delete t.a[o],t.b--)))}function jd(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.Y&&o.listener==e&&o.capture==!!n&&o.ca==r)return i}return-1}Fd.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=jd(t,e,r,i);return-1<s?(e=t[s],n||(e.Z=!1)):((e=new Ld(e,this.src,o,!!r,i)).Z=n,t.push(e)),e};var qd="closure_lm_"+(1e6*Math.random()|0),Vd={};function Bd(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=Xd(r);return e&&e[Dd]?e.wa(n,r,Kp(i)?!!i.capture:!!i,o):Kd(e,n,r,!0,i,o)}(t,e,n,r,i);if(Array.isArray(e)){for(var o=0;o<e.length;o++)Bd(t,e[o],n,r,i);return null}return n=Xd(n),t&&t[Dd]?t.va(e,n,Kp(r)?!!r.capture:!!r,i):Kd(t,e,n,!1,r,i)}function Kd(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s=Kp(i)?!!i.capture:!!i;if(s&&!Nd)return null;var a,u,c=Qd(t);if(c||(t[qd]=c=new Fd(t)),(n=c.add(e,n,r,s,o)).proxy)return n;if(a=zd,r=u=Nd?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)void 0===(i=!kd?s:i)&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Hd(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Wd(t){var e,n,r;"number"!=typeof t&&t&&!t.Y&&((e=t.src)&&e[Dd]?Ud(e.c,t):(n=t.type,r=t.proxy,e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Hd(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Qd(e))?(Ud(n,t),0==n.b&&(n.src=null,e[qd]=null)):Md(t)))}function Hd(t){return t in Vd?Vd[t]:Vd[t]="on"+t}function Gd(t,e){var n=t.listener,r=t.ca||t.src;return t.Z&&Wd(t),n.call(r,e)}function zd(t,e){if(t.Y)return!0;if(Nd)return Gd(t,new Pd(e,this));if(!e)t:{e=["window","event"];for(var n=qp,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}return Gd(t,e=new Pd(e,this))}function Qd(t){return(t=t[qd])instanceof Fd?t:null}var Yd="__closure_events_fn_"+(1e9*Math.random()>>>0);function Xd(e){return"function"==typeof e?e:(e[Yd]||(e[Yd]=function(t){return e.handleEvent(t)}),e[Yd])}function Jd(){$p.call(this),this.c=new Fd(this),(this.J=this).C=null}function $d(t,e){var n,r=t.C;if(r)for(n=[];r;r=r.C)n.push(r);if(t=t.J,r=e.type||e,"string"==typeof e?e=new Rd(e,t):e instanceof Rd?e.target=e.target||t:(s=e,fd(e=new Rd(r,t),s)),s=!0,n)for(var i=n.length-1;0<=i;i--)var o=e.a=n[i],s=Zd(o,r,!0,e)&&s;if(s=Zd(o=e.a=t,r,!0,e)&&s,s=Zd(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=Zd(o=e.a=n[i],r,!1,e)&&s}function Zd(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,a,u=e[o];u&&!u.Y&&u.capture==n&&(s=u.listener,a=u.ca||u.src,u.Z&&Ud(t.c,u),i=!1!==s.call(a,r)&&i)}return i&&!r.defaultPrevented}Jp(Jd,$p),Jd.prototype[Dd]=!0,(z=Jd.prototype).addEventListener=function(t,e,n,r){Bd(this,t,e,n,r)},z.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=Kp(i)?!!i.capture:!!i,r=Xd(r),e&&e[Dd]?(e=e.c,(n=String(n).toString())in e.a&&-1<(r=jd(s=e.a[n],r,i,o))&&(Md(s[r]),Array.prototype.splice.call(s,r,1),0==s.length&&(delete e.a[n],e.b--))):(e=e&&Qd(e))&&(n=e.a[n.toString()],(r=(e=-1)<(e=n?jd(n,r,i,o):e)?n[e]:null)&&Wd(r))}(this,t,e,n,r)},z.G=function(){if(Jd.X.G.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++)Md(n[r]);delete e.a[t],e.b--}}this.C=null},z.va=function(t,e,n,r){return this.c.add(String(t),e,!1,n,r)},z.wa=function(t,e,n,r){return this.c.add(String(t),e,!0,n,r)};var tv=qp.JSON.stringify;function ev(){this.b=this.a=null}var nv,rv=(iv.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 iv(function(){return new ov},function(t){t.reset()}));function iv(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function ov(){this.next=this.b=this.a=null}function sv(t,e){var n;nv||(n=qp.Promise.resolve(void 0),nv=function(){n.then(cv)}),av||(nv(),av=!0),uv.add(t,e)}ev.prototype.add=function(t,e){var n=rv.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},ov.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null};var av=!(ov.prototype.reset=function(){this.next=this.b=this.a=null}),uv=new ev;function cv(){for(var t,e;n=e=void 0,n=null,(e=uv).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){!function(t){qp.setTimeout(function(){throw t},0)}(t)}var n=rv;n.f(t),n.b<100&&(n.b++,t.next=n.a,n.a=t)}av=!1}function hv(t,e){Jd.call(this),this.b=t||1,this.a=e||qp,this.f=Qp(this.Za,this),this.g=Xp()}function lv(t){t.aa=!1,t.M&&(t.a.clearTimeout(t.M),t.M=null)}function fv(t,e,n){if("function"==typeof t)n&&(t=Qp(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Qp(t.handleEvent,t)}return 2147483647<Number(e)?-1:qp.setTimeout(t,e||0)}Jp(hv,Jd),(z=hv.prototype).aa=!1,z.M=null,z.Za=function(){var t;this.aa&&(0<(t=Xp()-this.g)&&t<.8*this.b?this.M=this.a.setTimeout(this.f,this.b-t):(this.M&&(this.a.clearTimeout(this.M),this.M=null),$d(this,"tick"),this.aa&&(lv(this),this.start())))},z.start=function(){this.aa=!0,this.M||(this.M=this.a.setTimeout(this.f,this.b),this.g=Xp())},z.G=function(){hv.X.G.call(this),lv(this),delete this.a};var pv,dv,vv,gv=(Fp(dv=mv,vv=pv=$p),dv.prototype=null===vv?Object.create(vv):(yv.prototype=vv.prototype,new yv),mv.prototype.f=function(t){this.b=arguments,this.a?this.c=!0:function t(e){e.a=fv(function(){e.a=null,e.c&&(e.c=!1,t(e))},e.h);var n=e.b;e.b=null,e.g.apply(null,n)}(this)},mv.prototype.G=function(){pv.prototype.G.call(this),this.a&&(qp.clearTimeout(this.a),this.a=null,this.c=!1,this.b=null)},mv);function yv(){this.constructor=dv}function mv(t,e){var n=pv.call(this)||this;return n.g=t,n.h=e,n.b=null,n.c=!1,n.a=null,n}function bv(t){$p.call(this),this.b=t,this.a={}}Jp(bv,$p);var wv=[];function _v(t,e,n,r){Array.isArray(n)||(n&&(wv[0]=n.toString()),n=wv);for(var i=0;i<n.length;i++){var o=Bd(e,n[i],r||t.handleEvent,!1,t.b||t);if(!o)break;t.a[o.key]=o}}function Iv(t){cd(t.a,function(t,e){this.a.hasOwnProperty(e)&&Wd(t)},t),t.a={}}function Tv(){this.a=!0}function Ev(t,e,n,r){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.a)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(r.length<2)){var i=r[1];if(Array.isArray(i)&&!(i.length<1)){r=i[0];if("noop"!=r&&"stop"!=r&&"close"!=r)for(var o=1;o<i.length;o++)i[o]=""}}}return tv(n)}catch(t){return e}}(t,n)+(r?" "+r:"")})}bv.prototype.G=function(){bv.X.G.call(this),Iv(this)},bv.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},Tv.prototype.info=function(){};var Sv={},Cv=null;function Nv(){return Cv=Cv||new Jd}function Av(t){Rd.call(this,Sv.Fa,t)}function kv(t){var e=Nv();$d(e,new Av(e))}function Rv(t,e){Rd.call(this,Sv.STAT_EVENT,t),this.stat=e}function Pv(t){var e=Nv();$d(e,new Rv(e,t))}function Ov(t){Rd.call(this,Sv.Ga,t)}function Dv(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return qp.setTimeout(function(){t()},e)}Sv.Fa="serverreachability",Jp(Av,Rd),Sv.STAT_EVENT="statevent",Jp(Rv,Rd),Sv.Ga="timingevent",Jp(Ov,Rd);Ga={NO_ERROR:0,$a:1,nb:2,mb:3,hb:4,lb:5,ob:6,Da:7,TIMEOUT:8,rb:9},Sn={fb:"complete",Bb:"success",Ea:"error",Da:"abort",tb:"ready",ub:"readystatechange",TIMEOUT:"timeout",pb:"incrementaldata",sb:"progress",ib:"downloadprogress",Jb:"uploadprogress"};function xv(){}function Lv(t){var e;return e=!(e=t.a)?t.a={}:e}function Mv(){}xv.prototype.a=null;G={OPEN:"a",eb:"b",Ea:"c",qb:"d"};function Fv(){Rd.call(this,"d")}function Uv(){Rd.call(this,"c")}function jv(){}function qv(t,e,n,r){this.g=t,this.c=e,this.f=n,this.S=r||1,this.J=new bv(this),this.P=Bv,t=md?125:void 0,this.R=new hv(t),this.B=null,this.b=!1,this.j=this.l=this.i=this.H=this.u=this.T=this.o=null,this.s=[],this.a=null,this.D=0,this.h=this.m=null,this.N=-1,this.A=!1,this.O=0,this.F=null,this.V=this.C=this.U=this.I=!1}Jp(Fv,Rd),Jp(Uv,Rd),Jp(jv,xv);var Vv=new jv,Bv=45e3,Kv={},Wv={};function Hv(t,e,n){t.H=1,t.i=fg(sg(e)),t.j=n,t.I=!0,Gv(t,null)}function Gv(t,e){t.u=Xp(),Qv(t),t.l=sg(t.i);var s,a,u,c,h,l,n=t.l,r=t.S;Array.isArray(r)||(r=[String(r)]),Sg(n.b,"t",r),t.D=0,t.a=my(t.g,t.g.C?e:null),0<t.O&&(t.F=new gv(Qp(t.Ca,t,t.a),t.O)),_v(t.J,t.a,"readystatechange",t.Xa),e=t.B?hd(t.B):{},t.j?(t.m||(t.m="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.a.ba(t.l,t.m,t.j,e)):(t.m="GET",t.a.ba(t.l,t.m,null,e)),kv(1),s=t.c,a=t.m,u=t.l,c=t.f,h=t.S,l=t.j,s.info(function(){if(s.a)if(l)for(var t="",e=l.split("&"),n=0;n<e.length;n++){var r,i,o=e[n].split("=");1<o.length&&(r=o[0],o=o[1],t=2<=(i=r.split("_")).length&&"type"==i[1]?t+(r+"=")+o+"&":t+(r+"=redacted&"))}else t=null;else t=l;return"XMLHTTP REQ ("+c+") [attempt "+h+"]: "+a+"\n"+u+"\n"+t})}function zv(t,e,n){for(var r,i,o,s=!0;!t.A&&t.D<n.length;){var a=(a=n,o=i=void 0,i=(r=t).D,-1==(o=a.indexOf("\n",i))?Wv:(i=Number(a.substring(i,o)),isNaN(i)?Kv:(o+=1)+i>a.length?Wv:(a=a.substr(o,i),r.D=o+i,a)));if(a==Wv){4==e&&(t.h=4,Pv(14),s=!1),Ev(t.c,t.f,null,"[Incomplete Response]");break}if(a==Kv){t.h=4,Pv(15),Ev(t.c,t.f,n,"[Invalid Chunk]"),s=!1;break}Ev(t.c,t.f,a,null),Zv(t,a)}4==e&&0==n.length&&(t.h=1,Pv(16),s=!1),t.b=t.b&&s,s?0<n.length&&!t.V&&(t.V=!0,(e=t.g).a==t&&e.U&&!e.F&&(e.c.info("Great, no buffering proxy detected. Bytes received: "+n.length),hy(e),e.F=!0,Pv(11))):(Ev(t.c,t.f,n,"[Invalid Chunked Response]"),$v(t),Jv(t))}function Qv(t){t.T=Xp()+t.P,Yv(t,t.P)}function Yv(t,e){if(null!=t.o)throw Error("WatchDog timer not null");t.o=Dv(Qp(t.Va,t),e)}function Xv(t){t.o&&(qp.clearTimeout(t.o),t.o=null)}function Jv(t){0==t.g.v||t.A||py(t.g,t)}function $v(t){Xv(t);var e=t.F;e&&"function"==typeof e.ja&&e.ja(),t.F=null,lv(t.R),Iv(t.J),t.a&&(e=t.a,t.a=null,e.abort(),e.ja())}function Zv(t,e){try{var n,r,i,o,s,a=t.g;if(0!=a.v&&(a.a==t||Og(a.b,t)))if(a.I=t.N,!t.C&&Og(a.b,t)&&3==a.v){try{var u=a.ka.a.parse(e)}catch(t){u=null}if(Array.isArray(u)&&3==u.length){var c=u;if(0==c[0]){t:if(!a.j){if(a.a){if(!(a.a.u+3e3<t.u))break t;fy(a),ey(a)}cy(a),Pv(18)}}else a.oa=c[1],0<a.oa-a.P&&c[2]<37500&&a.H&&0==a.o&&!a.m&&(a.m=Dv(Qp(a.Sa,a),6e3));if(Pg(a.b)<=1&&a.ea){try{a.ea()}catch(t){}a.ea=void 0}}else vy(a,11)}else if(!t.C&&a.a!=t||fy(a),!rd(e))for(e=u=a.ka.a.parse(e),u=0;u<e.length;u++)c=e[u],a.P=c[0],c=c[1],2==a.v?"c"==c[0]?(a.J=c[1],a.ga=c[2],null!=(r=c[3])&&(a.ha=r,a.c.info("VER="+a.ha)),null!=(o=c[4])&&(a.pa=o,a.c.info("SVER="+a.pa)),null!=(r=c[5])&&"number"==typeof r&&0<r&&(n=1.5*r,a.D=n,a.c.info("backChannelRequestTimeoutMs_="+n)),n=a,(o=t.a)&&(!(r=o.a?o.a.getResponseHeader("X-Client-Wire-Protocol"):null)||!(i=n.b).a&&(sd(r,"spdy")||sd(r,"quic")||sd(r,"h2"))&&(i.f=i.g,i.a=new Set,i.b&&(Dg(i,i.b),i.b=null)),!n.A||(s=o.a?o.a.getResponseHeader("X-HTTP-Session-Id"):null)&&(n.na=s,lg(n.B,n.A,s))),a.v=3,a.f&&a.f.ta(),a.U&&(a.N=Xp()-t.u,a.c.info("Handshake RTT: "+a.N+"ms")),i=t,(n=a).la=yy(n,n.C?n.ga:null,n.fa),i.C?(xg(n.b,i),o=i,(s=n.D)&&o.setTimeout(s),o.o&&(Xv(o),Qv(o)),n.a=i):uy(n),0<a.g.length&&iy(a)):"stop"!=c[0]&&"close"!=c[0]||vy(a,7):3==a.v&&("stop"==c[0]||"close"==c[0]?"stop"==c[0]?vy(a,7):ty(a):"noop"!=c[0]&&a.f&&a.f.sa(c),a.o=0);kv(4)}catch(t){}}function tg(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Bp(t)||"string"==typeof t)td(t,e,void 0);else{if(t.L&&"function"==typeof t.L)var n=t.L();else if(t.K&&"function"==typeof t.K)n=void 0;else if(Bp(t)||"string"==typeof t)for(var n=[],r=t.length,i=0;i<r;i++)n.push(i);else for(i in n=[],r=0,t)n[r++]=i;for(var i=(r=function(t){if(t.K&&"function"==typeof t.K)return t.K();if("string"==typeof t)return t.split("");if(Bp(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,o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}}function eg(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 eg)for(n=t.L(),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 ng(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];rg(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){for(var i={},n=e=0;e<t.a.length;)rg(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function rg(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(z=qv.prototype).setTimeout=function(t){this.P=t},z.Xa=function(t){t=t.target;var e=this.F;e&&3==Xg(t)?e.f():this.Ca(t)},z.Ca=function(t){try{if(t==this.a)t:{var e=Xg(this.a),n=this.a.ua(),r=this.a.W();if(!(e<3||3==e&&!md&&!this.a.$())){this.A||4!=e||7==n||kv(8==n||r<=0?3:2),Xv(this);var i=this.a.W();this.N=i;var o=this.a.$();if(this.b=200==i,r=this.c,u=this.m,c=this.l,h=this.f,l=this.S,f=e,p=i,r.info(function(){return"XMLHTTP RESP ("+h+") [ attempt "+l+"]: "+u+"\n"+c+"\n"+f+" "+p}),this.b){if(this.U&&!this.C){e:{if(this.a){var s=this.a;if((s=s.a?s.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!rd(s)){var a=s;break e}}a=null}if(!a){this.b=!1,this.h=3,Pv(12),$v(this),Jv(this);break t}Ev(this.c,this.f,a,"Initial handshake response via X-HTTP-Initial-Response"),this.C=!0,Zv(this,a)}this.I?(zv(this,e,o),md&&this.b&&3==e&&(_v(this.J,this.R,"tick",this.Wa),this.R.start())):(Ev(this.c,this.f,o,null),Zv(this,o)),4==e&&$v(this),this.b&&!this.A&&(4==e?py(this.g,this):(this.b=!1,Qv(this)))}else 400==i&&0<o.indexOf("Unknown SID")?(this.h=3,Pv(12)):(this.h=0,Pv(13)),$v(this),Jv(this)}}}catch(t){}var u,c,h,l,f,p},z.Wa=function(){var t,e;this.a&&(t=Xg(this.a),e=this.a.$(),this.D<e.length&&(Xv(this),zv(this,t,e),this.b&&4!=t&&Qv(this)))},z.cancel=function(){this.A=!0,$v(this)},z.Va=function(){this.o=null;var t,e,n=Xp();0<=n-this.T?(t=this.c,e=this.l,t.info(function(){return"TIMEOUT: "+e}),2!=this.H&&(kv(3),Pv(17)),$v(this),this.h=2,Jv(this)):Yv(this,this.T-n)},(z=eg.prototype).K=function(){ng(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},z.L=function(){return ng(this),this.a.concat()},z.get=function(t,e){return rg(this.b,t)?this.b[t]:e},z.set=function(t,e){rg(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},z.forEach=function(t,e){for(var n=this.L(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var ig=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function og(t,e){var n;this.c=this.j=this.f="",this.h=null,this.i=this.g="",this.a=!1,t instanceof og?(this.a=void 0!==e?e:t.a,ag(this,t.f),this.j=t.j,ug(this,t.c),cg(this,t.h),this.g=t.g,e=t.b,(n=new _g).c=e.c,e.a&&(n.a=new eg(e.a),n.b=e.b),hg(this,n),this.i=t.i):t&&(n=String(t).match(ig))?(this.a=!!e,ag(this,n[1]||"",!0),this.j=pg(n[2]||""),ug(this,n[3]||"",!0),cg(this,n[4]),this.g=pg(n[5]||"",!0),hg(this,n[6]||"",!0),this.i=pg(n[7]||"")):(this.a=!!e,this.b=new _g(null,this.a))}function sg(t){return new og(t)}function ag(t,e,n){t.f=n?pg(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function ug(t,e,n){t.c=n?pg(e,!0):e}function cg(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 hg(t,e,n){var r,i;e instanceof _g?(t.b=e,r=t.b,(i=t.a)&&!r.f&&(Ig(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Tg(this,e),Sg(this,n,t))},r)),r.f=i):(n||(e=dg(e,bg)),t.b=new _g(e,t.a))}function lg(t,e,n){t.b.set(e,n)}function fg(t){return lg(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Xp()).toString(36)),t}function pg(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function dg(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,vg),t=n?t.replace(/%25([0-9a-fA-F]{2})/g,"%$1"):t):null}function vg(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}og.prototype.toString=function(){var t=[],e=this.f;e&&t.push(dg(e,gg,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(dg(e,gg,!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(dg(n,"/"==n.charAt(0)?mg:yg,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",dg(n,wg)),t.join("")};var gg=/[#\/\?@]/g,yg=/[#\?:]/g,mg=/[#\?]/g,bg=/[#\?@]/g,wg=/#/g;function _g(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Ig(n){n.a||(n.a=new eg,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r,i=t[n].indexOf("="),o=null;0<=i?(r=t[n].substring(0,i),o=t[n].substring(i+1)):r=t[n],e(r,o?decodeURIComponent(o.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function Tg(t,e){Ig(t),e=Cg(t,e),rg(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,rg((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&ng(t)))}function Eg(t,e){return Ig(t),e=Cg(t,e),rg(t.a.b,e)}function Sg(t,e,n){Tg(t,e),0<n.length&&(t.c=null,t.a.set(Cg(t,e),nd(n)),t.b+=n.length)}function Cg(t,e){return e=String(e),e=t.f?e.toLowerCase():e}(z=_g.prototype).add=function(t,e){Ig(this),this.c=null,t=Cg(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},z.forEach=function(n,r){Ig(this),this.a.forEach(function(t,e){td(t,function(t){n.call(r,t,e,this)},this)},this)},z.L=function(){Ig(this);for(var t=this.a.K(),e=this.a.L(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},z.K=function(t){Ig(this);var e=[];if("string"==typeof t)Eg(this,t)&&(e=ed(e,this.a.get(Cg(this,t))));else{t=this.a.K();for(var n=0;n<t.length;n++)e=ed(e,t[n])}return e},z.set=function(t,e){return Ig(this),this.c=null,Eg(this,t=Cg(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},z.get=function(t,e){return t&&0<(t=this.K(t)).length?String(t[0]):e},z.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.L(),n=0;n<e.length;n++)for(var r=e[n],i=encodeURIComponent(String(r)),r=this.K(r),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 Ng=function(t,e){this.b=t,this.a=e};function Ag(t){this.g=t||kg,t=qp.PerformanceNavigationTiming?0<(t=qp.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(qp.ia&&qp.ia.ya&&qp.ia.ya()&&qp.ia.ya().Lb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Set),this.b=null,this.c=[]}var kg=10;function Rg(t){return t.b||t.a&&t.a.size>=t.f}function Pg(t){return t.b?1:t.a?t.a.size:0}function Og(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function Dg(t,e){t.a?t.a.add(e):t.b=e}function xg(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function Lg(t){var e,n;if(null!=t.b)return t.c.concat(t.b.s);if(null==t.a||0===t.a.size)return nd(t.c);var r=t.c;try{for(var i=Up(t.a.values()),o=i.next();!o.done;o=i.next())var s=o.value,r=r.concat(s.s)}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 Mg(){}function Fg(){this.a=new Mg}function Ug(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}Ag.prototype.cancel=function(){var e,t;if(this.c=Lg(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=Up(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()}},Mg.prototype.stringify=function(t){return qp.JSON.stringify(t,void 0)},Mg.prototype.parse=function(t){return qp.JSON.parse(t,void 0)};var jg=qp.JSON.parse;function qg(t){Jd.call(this),this.headers=new eg,this.H=t||null,this.b=!1,this.s=this.a=null,this.B="",this.h=0,this.f="",this.g=this.A=this.l=this.u=!1,this.o=0,this.m=null,this.I=Vg,this.D=this.F=!1}Jp(qg,Jd);var Vg="",Bg=/^https?$/i,Kg=["POST","PUT"];function Wg(t){return"content-type"==t.toLowerCase()}function Hg(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,Gg(t),Qg(t)}function Gg(t){t.u||(t.u=!0,$d(t,"complete"),$d(t,"error"))}function zg(t){if(t.b&&void 0!==jp&&(!t.s[1]||4!=Xg(t)||2!=t.W()))if(t.l&&4==Xg(t))fv(t.za,0,t);else if($d(t,"readystatechange"),4==Xg(t)){t.b=!1;try{var e,n,r,i,o=t.W();t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var s=!0;break t;default:s=!1}(e=s)||((n=0===o)&&(!(i=String(t.B).match(ig)[1]||null)&&qp.self&&qp.self.location&&(i=(r=qp.self.location.protocol).substr(0,r.length-1)),n=!Bg.test(i?i.toLowerCase():"")),e=n);if(e)$d(t,"complete"),$d(t,"success");else{t.h=6;try{var a=2<Xg(t)?t.a.statusText:""}catch(o){a=""}t.f=a+" ["+t.W()+"]",Gg(t)}}finally{Qg(t)}}}function Qg(t,e){if(t.a){Yg(t);var n=t.a,r=t.s[0]?Vp:null;t.a=null,t.s=null,e||$d(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Yg(t){t.a&&t.D&&(t.a.ontimeout=null),t.m&&(qp.clearTimeout(t.m),t.m=null)}function Xg(t){return t.a?t.a.readyState:0}function Jg(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}var i;r||(i="",cd(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,"string"==typeof t?null!=n&&encodeURIComponent(String(n)):lg(t,e,n))}function $g(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Zg(t){this.pa=0,this.g=[],this.c=new Tv,this.ga=this.la=this.B=this.fa=this.a=this.na=this.A=this.V=this.i=this.O=this.l=null,this.Oa=this.R=0,this.La=$g("failFast",!1,t),this.H=this.m=this.j=this.h=this.f=null,this.S=!0,this.I=this.oa=this.P=-1,this.T=this.o=this.u=0,this.Ha=$g("baseRetryDelayMs",5e3,t),this.Ra=$g("retryDelaySeedMs",1e4,t),this.Ma=$g("forwardChannelMaxRetries",2,t),this.ma=$g("forwardChannelRequestTimeoutMs",2e4,t),this.Na=t&&t.g||void 0,this.D=void 0,this.C=t&&t.supportsCrossDomainXhr||!1,this.J="",this.b=new Ag(t&&t.concurrentRequestLimit),this.ka=new Fg,this.da=t&&t.fastHandshake||!1,this.Ia=t&&t.b||!1,t&&t.f&&(this.c.a=!1),t&&t.forceLongPolling&&(this.S=!1),this.U=!this.da&&this.S&&t&&t.detectBufferingProxy||!1,this.ea=void 0,this.N=0,this.F=!1,this.s=null,(this.Ka=t&&t.c||!1)&&this.c.info("Opt-in to enable Chrome Origin Trials.")}function ty(t){var e,n;ny(t),3==t.v&&(e=t.R++,lg(n=sg(t.B),"SID",t.J),lg(n,"RID",e),lg(n,"TYPE","terminate"),sy(t,n),(e=new qv(t,t.c,e,void 0)).H=2,e.i=fg(sg(n)),n=!1,!(n=qp.navigator&&qp.navigator.sendBeacon?qp.navigator.sendBeacon(e.i.toString(),""):n)&&qp.Image&&((new Image).src=e.i,n=!0),n||(e.a=my(e.g,null),e.a.ba(e.i)),e.u=Xp(),Qv(e)),gy(t)}function ey(t){t.a&&(hy(t),t.a.cancel(),t.a=null)}function ny(t){ey(t),t.j&&(qp.clearTimeout(t.j),t.j=null),fy(t),t.b.cancel(),t.h&&("number"==typeof t.h&&qp.clearTimeout(t.h),t.h=null)}function ry(t,e){t.g.push(new Ng(t.Oa++,e)),3==t.v&&iy(t)}function iy(t){Rg(t.b)||t.h||(t.h=!0,sv(t.Ba,t),t.u=0)}function oy(t,e){var n=e?e.f:t.R++,r=sg(t.B);lg(r,"SID",t.J),lg(r,"RID",n),lg(r,"AID",t.P),sy(t,r),t.i&&t.l&&Jg(r,t.i,t.l),n=new qv(t,t.c,n,t.u+1),null===t.i&&(n.B=t.l),e&&(t.g=e.s.concat(t.g)),e=ay(t,n,1e3),n.setTimeout(Math.round(.5*t.ma)+Math.round(.5*t.ma*Math.random())),Dg(t.b,n),Hv(n,r,e)}function sy(t,n){t.f&&tg({},function(t,e){lg(n,e,t)})}function ay(t,e,n){n=Math.min(t.g.length,n);var r=t.f?Qp(t.f.Ja,t.f,t):null;t:for(var i=t.g,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{!function(t,r,e){var i=e||"";try{tg(t,function(t,e){var n=t;Kp(t)&&(n=tv(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}(h,s,"req"+c+"_")}catch(t){r&&r(h)}}if(a){r=s.join("&");break t}}return t=t.g.splice(0,n),e.s=t,r}function uy(t){t.a||t.j||(t.T=1,sv(t.Aa,t),t.o=0)}function cy(t){return!(t.a||t.j||3<=t.o)&&(t.T++,t.j=Dv(Qp(t.Aa,t),dy(t,t.o)),t.o++,1)}function hy(t){null!=t.s&&(qp.clearTimeout(t.s),t.s=null)}function ly(t){t.a=new qv(t,t.c,"rpc",t.T),null===t.i&&(t.a.B=t.l),t.a.O=0;var e=sg(t.la);lg(e,"RID","rpc"),lg(e,"SID",t.J),lg(e,"CI",t.H?"0":"1"),lg(e,"AID",t.P),sy(t,e),lg(e,"TYPE","xmlhttp"),t.i&&t.l&&Jg(e,t.i,t.l),t.D&&t.a.setTimeout(t.D);var n=t.a;t=t.ga,n.H=1,n.i=fg(sg(e)),n.j=null,n.I=!0,Gv(n,t)}function fy(t){null!=t.m&&(qp.clearTimeout(t.m),t.m=null)}function py(t,e){var n,r,i,o=null;if(t.a==e){fy(t),hy(t),t.a=null;var s=2}else{if(!Og(t.b,e))return;o=e.s,xg(t.b,e),s=1}if(t.I=e.N,0!=t.v)if(e.b)1==s?(o=e.j?e.j.length:0,e=Xp()-e.u,n=t.u,$d(s=Nv(),new Ov(s)),iy(t)):uy(t);else if(3==(n=e.h)||0==n&&0<t.I||(1!=s||(i=e,Pg((r=t).b)>=r.b.f-(r.h?1:0)||(r.h?(r.g=i.s.concat(r.g),0):1==r.v||2==r.v||r.u>=(r.La?0:r.Ma)||(r.h=Dv(Qp(r.Ba,r,i),dy(r,r.u)),r.u++,0))))&&(2!=s||!cy(t)))switch(o&&0<o.length&&(e=t.b,e.c=e.c.concat(o)),n){case 1:vy(t,5);break;case 4:vy(t,10);break;case 3:vy(t,6);break;default:vy(t,2)}}function dy(t,e){var n=t.Ha+Math.floor(Math.random()*t.Ra);return t.f||(n*=2),n*e}function vy(t,e){var n,r,i,o;t.c.info("Error code "+e),2==e?(r=null,t.f&&(r=null),o=Qp(t.Ya,t),r||(r=new og("//www.google.com/images/cleardot.gif"),qp.location&&"http"==qp.location.protocol||ag(r,"https"),fg(r)),n=r.toString(),r=o,o=new Tv,qp.Image?((i=new Image).onload=Yp(Ug,o,i,"TestLoadImage: loaded",!0,r),i.onerror=Yp(Ug,o,i,"TestLoadImage: error",!1,r),i.onabort=Yp(Ug,o,i,"TestLoadImage: abort",!1,r),i.ontimeout=Yp(Ug,o,i,"TestLoadImage: timeout",!1,r),qp.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=n):r(!1)):Pv(2),t.v=0,t.f&&t.f.ra(e),gy(t),ny(t)}function gy(t){t.v=0,t.I=-1,t.f&&(0==Lg(t.b).length&&0==t.g.length||(t.b.c.length=0,nd(t.g),t.g.length=0),t.f.qa())}function yy(t,e,n){var r,i,o,s,a,u=(s=n)instanceof og?sg(s):new og(s,void 0);return""!=u.c?(e&&ug(u,e+"."+u.c),cg(u,u.h)):(a=qp.location,r=a.protocol,i=e?e+"."+a.hostname:a.hostname,o=+a.port,s=n,a=new og(null,void 0),r&&ag(a,r),i&&ug(a,i),o&&cg(a,o),s&&(a.g=s),u=a),t.V&&cd(t.V,function(t,e){lg(u,e,t)}),e=t.A,n=t.na,e&&n&&lg(u,e,n),lg(u,"VER",t.ha),sy(t,u),u}function my(t,e){if(e&&!t.C)throw Error("Can't create secondary domain capable XhrIo object.");return(e=new qg(t.Na)).F=t.C,e}function by(){}function wy(){if(gd&&!(10<=Number(Cd)))throw Error("Environmental error: no available transport.")}function _y(t,e){Jd.call(this),this.a=new Zg(e),this.o=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.l=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.a&&(t?t["X-WebChannel-Client-Profile"]=e.a:t={"X-WebChannel-Client-Profile":e.a}),this.a.O=t,(t=e&&e.httpHeadersOverwriteParam)&&!rd(t)&&(this.a.i=t),this.m=e&&e.supportsCrossDomainXhr||!1,this.l=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!rd(e)&&(this.a.A=e,null!==(t=this.b)&&e in t&&(e in(t=this.b)&&delete t[e])),this.f=new Ey(this)}function Iy(t){Fv.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 Ty(){Uv.call(this),this.status=1}function Ey(t){this.a=t}(z=qg.prototype).ba=function(t,e,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.B+"; newUri="+t);e=e?e.toUpperCase():"GET",this.B=t,this.f="",this.h=0,this.u=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.H?Lv(this.H):Lv(Vv),this.a.onreadystatechange=Qp(this.za,this);try{this.A=!0,this.a.open(e,String(t),!0),this.A=!1}catch(t){return void Hg(this,t)}t=n||"";var i,o=new eg(this.headers);r&&tg(r,function(t,e){o.set(e,t)}),r=function(t){t:{for(var e=Wg,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.L()),n=qp.FormData&&t instanceof qp.FormData,0<=Zp(Kg,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.I&&(this.a.responseType=this.I),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{Yg(this),0<this.o&&((this.D=(i=this.a,gd&&Sd(9)&&"number"==typeof i.timeout&&void 0!==i.ontimeout))?(this.a.timeout=this.o,this.a.ontimeout=Qp(this.xa,this)):this.m=fv(this.xa,this.o,this)),this.l=!0,this.a.send(t),this.l=!1}catch(t){Hg(this,t)}},z.xa=function(){void 0!==jp&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,$d(this,"timeout"),this.abort(8))},z.abort=function(t){this.a&&this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.h=t||7,$d(this,"complete"),$d(this,"abort"),Qg(this))},z.G=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),Qg(this,!0)),qg.X.G.call(this)},z.za=function(){this.j||(this.A||this.l||this.g?zg(this):this.Ua())},z.Ua=function(){zg(this)},z.W=function(){try{return 2<Xg(this)?this.a.status:-1}catch(t){return-1}},z.$=function(){try{return this.a?this.a.responseText:""}catch(t){return""}},z.Pa=function(t){if(this.a){var e=this.a.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),jg(e)}},z.ua=function(){return this.h},z.Qa=function(){return"string"==typeof this.f?this.f:String(this.f)},(z=Zg.prototype).ha=8,z.v=1,z.Ba=function(t){if(this.h)if(this.h=null,1==this.v){if(!t){this.R=Math.floor(1e5*Math.random()),t=this.R++;var e,n=new qv(this,this.c,t,void 0),r=this.l;if(this.O&&(r?fd(r=hd(r),this.O):r=this.O),null===this.i&&(n.B=r),this.da)t:{for(var i=e=0;i<this.g.length;i++){var o=this.g[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.g.length-1){e=i+1;break t}}e=1e3}else e=1e3;e=ay(this,n,e),lg(i=sg(this.B),"RID",t),lg(i,"CVER",22),this.A&&lg(i,"X-HTTP-Session-Id",this.A),sy(this,i),this.i&&r&&Jg(i,this.i,r),Dg(this.b,n),this.Ia&&lg(i,"TYPE","init"),this.da?(lg(i,"$req",e),lg(i,"SID","null"),n.U=!0,Hv(n,i,null)):Hv(n,i,e),this.v=2}}else 3==this.v&&(t?oy(this,t):0==this.g.length||Rg(this.b)||oy(this))},z.Aa=function(){var t;this.j=null,ly(this),this.U&&!(this.F||null==this.a||this.N<=0)&&(t=2*this.N,this.c.info("BP detection timer enabled: "+t),this.s=Dv(Qp(this.Ta,this),t))},z.Ta=function(){this.s&&(this.s=null,this.c.info("BP detection timeout reached."),this.c.info("Buffering proxy detected and switch to long-polling!"),this.H=!1,this.F=!0,Pv(10),ey(this),ly(this))},z.Sa=function(){null!=this.m&&(this.m=null,ey(this),cy(this),Pv(19))},z.Ya=function(t){t?(this.c.info("Successfully pinged google.com"),Pv(2)):(this.c.info("Failed to ping google.com"),Pv(1))},(z=by.prototype).ta=function(){},z.sa=function(){},z.ra=function(){},z.qa=function(){},z.Ja=function(){},wy.prototype.a=function(t,e){return new _y(t,e)},Jp(_y,Jd),_y.prototype.g=function(){this.a.f=this.f,this.m&&(this.a.C=!0);var t=this.a,e=this.o,n=this.b||void 0;Pv(0),t.fa=e,t.V=n||{},t.H=t.S,t.B=yy(t,null,t.fa),iy(t)},_y.prototype.close=function(){ty(this.a)},_y.prototype.h=function(t){var e;"string"==typeof t?((e={}).__data__=t,ry(this.a,e)):this.l?((e={}).__data__=tv(t),ry(this.a,e)):ry(this.a,t)},_y.prototype.G=function(){this.a.f=null,delete this.f,ty(this.a),delete this.a,_y.X.G.call(this)},Jp(Iy,Fv),Jp(Ty,Uv),Jp(Ey,by),Ey.prototype.ta=function(){$d(this.a,"a")},Ey.prototype.sa=function(t){$d(this.a,new Iy(t))},Ey.prototype.ra=function(t){$d(this.a,new Ty)},Ey.prototype.qa=function(){$d(this.a,"b")},wy.prototype.createWebChannel=wy.prototype.a,_y.prototype.send=_y.prototype.h,_y.prototype.open=_y.prototype.g,Ga.NO_ERROR=0,Ga.TIMEOUT=8,Ga.HTTP_ERROR=6,Sn.COMPLETE="complete",(Mv.EventType=G).OPEN="a",G.CLOSE="b",G.ERROR="c",G.MESSAGE="d",Jd.prototype.listen=Jd.prototype.va,qg.prototype.listenOnce=qg.prototype.wa,qg.prototype.getLastError=qg.prototype.Qa,qg.prototype.getLastErrorCode=qg.prototype.ua,qg.prototype.getStatus=qg.prototype.W,qg.prototype.getResponseJson=qg.prototype.Pa,qg.prototype.getResponseText=qg.prototype.$,qg.prototype.send=qg.prototype.ba;var Sy=Nv,Cy=Ga,Ny=Sn,Ay=Sv,ky=10,Ry=11,Py=Mv,Oy=qg,Dy=(xy.prototype.t=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},xy.prototype.next=function(){var t=++this.previousValue;return this.i&&this.i(t),t},xy);function xy(t,e){var n=this;this.previousValue=t,e&&(e.sequenceNumberHandler=function(t){return n.t(t)},this.i=function(t){return e.writeSequenceNumber(t)})}Dy.o=-1;var Ly,My={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"},Fy=(Xi(jy,Ly=Error),jy),Uy=new ps("@firebase/firestore");function jy(t,e){var n=this;return(n=Ly.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 qy(){return Uy.logLevel}function Vy(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Uy.logLevel<=as.DEBUG&&(e=n.map(Wy),Uy.debug.apply(Uy,no(["Firestore (8.3.2): "+t],e)))}function By(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Uy.logLevel<=as.ERROR&&(e=n.map(Wy),Uy.error.apply(Uy,no(["Firestore (8.3.2): "+t],e)))}function Ky(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Uy.logLevel<=as.WARN&&(e=n.map(Wy),Uy.warn.apply(Uy,no(["Firestore (8.3.2): "+t],e)))}function Wy(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function Hy(t){t="FIRESTORE (8.3.2) INTERNAL ASSERTION FAILED: "+(t=void 0===t?"Unexpected state":t);throw By(t),new Error(t)}function Gy(t){t||Hy()}var zy=(Qy.u=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length,n="";n.length<20;)for(var r=function(t){var e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(var r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n}(40),i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%t.length));return n},Qy);function Qy(){}function Yy(t,e){return t<e?-1:e<t?1:0}function Xy(t,n,r){return t.length===n.length&&t.every(function(t,e){return r(t,n[e])})}function Jy(t){return t+"\0"}var $y=(em.now=function(){return em.fromMillis(Date.now())},em.fromDate=function(t){return em.fromMillis(t.getTime())},em.fromMillis=function(t){var e=Math.floor(t/1e3);return new em(e,1e6*(t-1e3*e))},em.prototype.toDate=function(){return new Date(this.toMillis())},em.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},em.prototype._compareTo=function(t){return this.seconds===t.seconds?Yy(this.nanoseconds,t.nanoseconds):Yy(this.seconds,t.seconds)},em.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},em.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},em.prototype.toJSON=function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}},em.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},em),Zy=(tm.fromTimestamp=function(t){return new tm(t)},tm.min=function(){return new tm(new $y(0,0))},tm.prototype.compareTo=function(t){return this.timestamp._compareTo(t.timestamp)},tm.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},tm.prototype.toMicroseconds=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},tm.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},tm.prototype.toTimestamp=function(){return this.timestamp},tm);function tm(t){this.timestamp=t}function em(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new Fy(My.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new Fy(My.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Fy(My.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new Fy(My.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function nm(t){var e,n=0;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n++;return n}function rm(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function im(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var om,sm,Ga=(Object.defineProperty(gm.prototype,"length",{get:function(){return this.len},enumerable:!1,configurable:!0}),gm.prototype.isEqual=function(t){return 0===gm.comparator(this,t)},gm.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof gm?t.forEach(function(t){e.push(t)}):e.push(t),this.construct(e)},gm.prototype.limit=function(){return this.offset+this.length},gm.prototype.popFirst=function(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)},gm.prototype.popLast=function(){return this.construct(this.segments,this.offset,this.length-1)},gm.prototype.firstSegment=function(){return this.segments[this.offset]},gm.prototype.lastSegment=function(){return this.get(this.length-1)},gm.prototype.get=function(t){return this.segments[this.offset+t]},gm.prototype.isEmpty=function(){return 0===this.length},gm.prototype.isPrefixOf=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},gm.prototype.isImmediateParentOf=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},gm.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},gm.prototype.toArray=function(){return this.segments.slice(this.offset,this.limit())},gm.comparator=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},gm),am=(Xi(vm,sm=Ga),vm.prototype.construct=function(t,e,n){return new vm(t,e,n)},vm.prototype.canonicalString=function(){return this.toArray().join("/")},vm.prototype.toString=function(){return this.canonicalString()},vm.fromString=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];if(0<=o.indexOf("//"))throw new Fy(My.INVALID_ARGUMENT,"Invalid segment ("+o+"). Paths must not contain // in them.");n.push.apply(n,o.split("/").filter(function(t){return 0<t.length}))}return new vm(n)},vm.emptyPath=function(){return new vm([])},vm),um=/^[_a-zA-Z][_a-zA-Z0-9]*$/,cm=(Xi(dm,om=Ga),dm.prototype.construct=function(t,e,n){return new dm(t,e,n)},dm.isValidIdentifier=function(t){return um.test(t)},dm.prototype.canonicalString=function(){return this.toArray().map(function(t){return t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),t=!dm.isValidIdentifier(t)?"`"+t+"`":t}).join(".")},dm.prototype.toString=function(){return this.canonicalString()},dm.prototype.isKeyField=function(){return 1===this.length&&"__name__"===this.get(0)},dm.keyField=function(){return new dm(["__name__"])},dm.fromServerFormat=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new Fy(My.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 Fy(My.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var a=t[r+1];if("\\"!==a&&"."!==a&&"`"!==a)throw new Fy(My.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 Fy(My.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new dm(e)},dm.emptyPath=function(){return new dm([])},dm),hm=(pm.prototype.covers=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].isPrefixOf(t))return!0;return!1},pm.prototype.isEqual=function(t){return Xy(this.fields,t.fields,function(t,e){return t.isEqual(e)})},pm),lm=(fm.fromBase64String=function(t){return new fm(atob(t))},fm.fromUint8Array=function(t){return new fm(function(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t))},fm.prototype.toBase64=function(){return t=this.binaryString,btoa(t);var t},fm.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.binaryString)},fm.prototype.approximateByteSize=function(){return 2*this.binaryString.length},fm.prototype.compareTo=function(t){return Yy(this.binaryString,t.binaryString)},fm.prototype.isEqual=function(t){return this.binaryString===t.binaryString},fm);function fm(t){this.binaryString=t}function pm(t){(this.fields=t).sort(cm.comparator)}function dm(){return null!==om&&om.apply(this,arguments)||this}function vm(){return null!==sm&&sm.apply(this,arguments)||this}function gm(t,e,n){void 0===e?e=0:e>t.length&&Hy(),void 0===n?n=t.length-e:n>t.length-e&&Hy(),this.segments=t,this.offset=e,this.len=n}lm.EMPTY_BYTE_STRING=new lm("");var ym=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function mm(t){if(Gy(!!t),"string"!=typeof t)return{seconds:bm(t.seconds),nanos:bm(t.nanos)};var e=0,n=ym.exec(t);Gy(!!n),n[1]&&(n=((n=n[1])+"000000000").substr(0,9),e=Number(n));t=new Date(t);return{seconds:Math.floor(t.getTime()/1e3),nanos:e}}function bm(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function wm(t){return"string"==typeof t?lm.fromBase64String(t):lm.fromUint8Array(t)}function _m(t){return"server_timestamp"===(null===(t=((null===(t=null==t?void 0:t.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===t?void 0:t.stringValue)}function Im(t){t=mm(t.mapValue.fields.__local_write_time__.timestampValue);return new $y(t.seconds,t.nanos)}function Tm(t){return null==t}function Em(t){return 0===t&&1/t==-1/0}function Sm(t){return"number"==typeof t&&Number.isInteger(t)&&!Em(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var Cm=(Nm.fromPath=function(t){return new Nm(am.fromString(t))},Nm.fromName=function(t){return new Nm(am.fromString(t).popFirst(5))},Nm.prototype.hasCollectionId=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},Nm.prototype.isEqual=function(t){return null!==t&&0===am.comparator(this.path,t.path)},Nm.prototype.toString=function(){return this.path.toString()},Nm.comparator=function(t,e){return am.comparator(t.path,e.path)},Nm.isDocumentKey=function(t){return t.length%2==0},Nm.fromSegments=function(t){return new Nm(new am(t.slice()))},Nm);function Nm(t){this.path=t}function Am(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?_m(t)?4:10:Hy()}function km(r,i){var t,e,n=Am(r);if(n!==Am(i))return!1;switch(n){case 0:return!0;case 1:return r.booleanValue===i.booleanValue;case 4:return Im(r).isEqual(Im(i));case 3:return function(t){if("string"==typeof r.timestampValue&&"string"==typeof t.timestampValue&&r.timestampValue.length===t.timestampValue.length)return r.timestampValue===t.timestampValue;var e=mm(r.timestampValue),t=mm(t.timestampValue);return e.seconds===t.seconds&&e.nanos===t.nanos}(i);case 5:return r.stringValue===i.stringValue;case 6:return e=i,wm(r.bytesValue).isEqual(wm(e.bytesValue));case 7:return r.referenceValue===i.referenceValue;case 8:return t=i,bm((e=r).geoPointValue.latitude)===bm(t.geoPointValue.latitude)&&bm(e.geoPointValue.longitude)===bm(t.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return bm(t.integerValue)===bm(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){t=bm(t.doubleValue),e=bm(e.doubleValue);return t===e?Em(t)===Em(e):isNaN(t)&&isNaN(e)}return!1}(r,i);case 9:return Xy(r.arrayValue.values||[],i.arrayValue.values||[],km);case 10:return function(){var t,e=r.mapValue.fields||{},n=i.mapValue.fields||{};if(nm(e)!==nm(n))return!1;for(t in e)if(e.hasOwnProperty(t)&&(void 0===n[t]||!km(e[t],n[t])))return!1;return!0}();default:return Hy()}}function Rm(t,e){return void 0!==(t.values||[]).find(function(t){return km(t,e)})}function Pm(t,e){var n,r,i,o=Am(t),s=Am(e);if(o!==s)return Yy(o,s);switch(o){case 0:return 0;case 1:return Yy(t.booleanValue,e.booleanValue);case 2:return r=e,i=bm(t.integerValue||t.doubleValue),r=bm(r.integerValue||r.doubleValue),i<r?-1:r<i?1:i===r?0:isNaN(i)?isNaN(r)?0:-1:1;case 3:return Om(t.timestampValue,e.timestampValue);case 4:return Om(Im(t),Im(e));case 5:return Yy(t.stringValue,e.stringValue);case 6:return function(t,e){t=wm(t),e=wm(e);return t.compareTo(e)}(t.bytesValue,e.bytesValue);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=Yy(n[i],r[i]);if(0!==o)return o}return Yy(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return n=t.geoPointValue,i=e.geoPointValue,0!==(r=Yy(bm(n.latitude),bm(i.latitude)))?r:Yy(bm(n.longitude),bm(i.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=Pm(n[i],r[i]);if(o)return o}return Yy(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=Yy(r[s],o[s]);if(0!==a)return a;a=Pm(n[r[s]],i[o[s]]);if(0!==a)return a}return Yy(r.length,o.length)}(t.mapValue,e.mapValue);default:throw Hy()}}function Om(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Yy(t,e);var n=mm(t),t=mm(e),e=Yy(n.seconds,t.seconds);return 0!==e?e:Yy(n.nanos,t.nanos)}function Dm(t){return function s(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){var t=mm(t);return"time("+t.seconds+","+t.nanos+")"}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?wm(t.bytesValue).toBase64():"referenceValue"in t?(e=t.referenceValue,Cm.fromName(e).toString()):"geoPointValue"in t?"geo("+(e=t.geoPointValue).latitude+","+e.longitude+")":"arrayValue"in t?function(t){for(var e="[",n=!0,r=0,i=t.values||[];r<i.length;r++)n?n=!1:e+=",",e+=s(i[r]);return e+"]"}(t.arrayValue):"mapValue"in t?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+"}"}(t.mapValue):Hy();var e}(t)}function xm(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.canonicalString()}}function Lm(t){return t&&"integerValue"in t}function Mm(t){return!!t&&"arrayValue"in t}function Fm(t){return t&&"nullValue"in t}function Um(t){return t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function jm(t){return t&&"mapValue"in t}var qm=(Vm.empty=function(){return new Vm({mapValue:{}})},Vm.prototype.field=function(t){return Vm.extractNestedValue(this.buildProto(),t)},Vm.prototype.toProto=function(){return this.field(cm.emptyPath())},Vm.prototype.set=function(t,e){this.setOverlay(t,e)},Vm.prototype.setAll=function(t){var n=this;t.forEach(function(t,e){t?n.set(e,t):n.delete(e)})},Vm.prototype.delete=function(t){this.setOverlay(t,null)},Vm.prototype.isEqual=function(t){return km(this.buildProto(),t.buildProto())},Vm.prototype.setOverlay=function(t,e){for(var n=this.overlayMap,r=0;r<t.length-1;++r)var i=t.get(r),o=n.get(i),n=(o instanceof Map||(o=o&&10===Am(o)?new Map(Object.entries(o.mapValue.fields||{})):new Map,n.set(i,o)),o);n.set(t.lastSegment(),e)},Vm.prototype.applyOverlay=function(r,t){var i=this,o=!1,e=Vm.extractNestedValue(this.partialValue,r),s=jm(e)?Object.assign({},e.mapValue.fields):{};return t.forEach(function(t,e){var n;t instanceof Map?null!=(n=i.applyOverlay(r.child(e),t))&&(s[e]=n,o=!0):null!==t?(s[e]=t,o=!0):s.hasOwnProperty(e)&&(delete s[e],o=!0)}),o?{mapValue:{fields:s}}:null},Vm.prototype.buildProto=function(){var t=this.applyOverlay(cm.emptyPath(),this.overlayMap);return null!=t&&(this.partialValue=t,this.overlayMap.clear()),this.partialValue},Vm.extractNestedValue=function(t,e){if(e.isEmpty())return t;for(var n=t,r=0;r<e.length-1;++r){if(!n.mapValue.fields)return null;if(!jm(n=n.mapValue.fields[e.get(r)]))return null}return(n=(n.mapValue.fields||{})[e.lastSegment()])||null},Vm.prototype.clone=function(){return new Vm(this.buildProto())},Vm);function Vm(t){this.overlayMap=new Map,this.partialValue=t}var Bm=(Wm.newInvalidDocument=function(t){return new Wm(t,0,Zy.min(),qm.empty(),0)},Wm.newFoundDocument=function(t,e,n){return new Wm(t,1,e,n,0)},Wm.newNoDocument=function(t,e){return new Wm(t,2,e,qm.empty(),0)},Wm.newUnknownDocument=function(t,e){return new Wm(t,3,e,qm.empty(),2)},Wm.prototype.convertToFoundDocument=function(t,e){return this.version=t,this.documentType=1,this.data=e,this.documentState=0,this},Wm.prototype.convertToNoDocument=function(t){return this.version=t,this.documentType=2,this.data=qm.empty(),this.documentState=0,this},Wm.prototype.convertToUnknownDocument=function(t){return this.version=t,this.documentType=3,this.data=qm.empty(),this.documentState=2,this},Wm.prototype.setHasCommittedMutations=function(){return this.documentState=2,this},Wm.prototype.setHasLocalMutations=function(){return this.documentState=1,this},Object.defineProperty(Wm.prototype,"hasLocalMutations",{get:function(){return 1===this.documentState},enumerable:!1,configurable:!0}),Object.defineProperty(Wm.prototype,"hasCommittedMutations",{get:function(){return 2===this.documentState},enumerable:!1,configurable:!0}),Object.defineProperty(Wm.prototype,"hasPendingWrites",{get:function(){return this.hasLocalMutations||this.hasCommittedMutations},enumerable:!1,configurable:!0}),Wm.prototype.isValidDocument=function(){return 0!==this.documentType},Wm.prototype.isFoundDocument=function(){return 1===this.documentType},Wm.prototype.isNoDocument=function(){return 2===this.documentType},Wm.prototype.isUnknownDocument=function(){return 3===this.documentType},Wm.prototype.isEqual=function(t){return t instanceof Wm&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)},Wm.prototype.clone=function(){return new Wm(this.key,this.documentType,this.version,this.data.clone(),this.documentState)},Wm.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+JSON.stringify(this.data.toProto())+", {documentType: "+this.documentType+"}), {documentState: "+this.documentState+"})"},Wm),Km=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.h=null};function Wm(t,e,n,r,i){this.key=t,this.documentType=e,this.version=n,this.data=r,this.documentState=i}function Hm(t,e,n,r,i,o,s){return new Km(t,e=void 0===e?null:e,n=void 0===n?[]:n,r=void 0===r?[]:r,i=void 0===i?null:i,o=void 0===o?null:o,s=void 0===s?null:s)}function Gm(t){var e=t;return null===e.h&&(t=e.path.canonicalString(),null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(function(t){return(t=t).field.canonicalString()+t.op.toString()+Dm(t.value)}).join(","),t+="|ob:",t+=e.orderBy.map(function(t){return(t=t).field.canonicalString()+t.dir}).join(","),Tm(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=_b(e.startAt)),e.endAt&&(t+="|ub:",t+=_b(e.endAt)),e.h=t),e.h}function zm(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(var n,r,i=0;i<t.orderBy.length;i++)if(n=t.orderBy[i],r=e.orderBy[i],n.dir!==r.dir||!n.field.isEqual(r.field))return!1;if(t.filters.length!==e.filters.length)return!1;for(var o,s,a=0;a<t.filters.length;a++)if(o=t.filters[a],s=e.filters[a],o.op!==s.op||!o.field.isEqual(s.field)||!km(o.value,s.value))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Eb(t.startAt,e.startAt)&&Eb(t.endAt,e.endAt)}function Qm(t){return Cm.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}var Ym,Xm=(Xi(Jm,Ym=function(){}),Jm.create=function(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.l(t,e,n):new eb(t,e,n):"array-contains"===e?new fb(t,n):"in"===e?new pb(t,n):"not-in"===e?new db(t,n):"array-contains-any"===e?new vb(t,n):new Jm(t,e,n)},Jm.l=function(t,e,n){return new("in"===e?nb:rb)(t,n)},Jm.prototype.matches=function(t){t=t.data.field(this.field);return"!="===this.op?null!==t&&this.m(Pm(t,this.value)):null!==t&&Am(this.value)===Am(t)&&this.m(Pm(t,this.value))},Jm.prototype.m=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;case">=":return 0<=t;default:return Hy()}},Jm.prototype.g=function(){return 0<=["<","<=",">",">=","!=","not-in"].indexOf(this.op)},Jm);function Jm(t,e,n){var r=this;return(r=Ym.call(this)||this).field=t,r.op=e,r.value=n,r}var $m,Zm,tb,eb=(Xi(sb,tb=Xm),sb.prototype.matches=function(t){t=Cm.comparator(t.key,this.key);return this.m(t)},sb),nb=(Xi(ob,Zm=Xm),ob.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},ob),rb=(Xi(ib,$m=Xm),ib.prototype.matches=function(e){return!this.keys.some(function(t){return t.isEqual(e.key)})},ib);function ib(t,e){var n=this;return(n=$m.call(this,t,"not-in",e)||this).keys=ab(0,e),n}function ob(t,e){var n=this;return(n=Zm.call(this,t,"in",e)||this).keys=ab(0,e),n}function sb(t,e,n){var r=this;return(r=tb.call(this,t,e,n)||this).key=Cm.fromName(n.referenceValue),r}function ab(t,e){return((null===(e=e.arrayValue)||void 0===e?void 0:e.values)||[]).map(function(t){return Cm.fromName(t.referenceValue)})}var ub,cb,hb,lb,fb=(Xi(wb,lb=Xm),wb.prototype.matches=function(t){t=t.data.field(this.field);return Mm(t)&&Rm(t.arrayValue,this.value)},wb),pb=(Xi(bb,hb=Xm),bb.prototype.matches=function(t){t=t.data.field(this.field);return null!==t&&Rm(this.value.arrayValue,t)},bb),db=(Xi(mb,cb=Xm),mb.prototype.matches=function(t){if(Rm(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;t=t.data.field(this.field);return null!==t&&!Rm(this.value.arrayValue,t)},mb),vb=(Xi(yb,ub=Xm),yb.prototype.matches=function(t){var e=this,t=t.data.field(this.field);return!(!Mm(t)||!t.arrayValue.values)&&t.arrayValue.values.some(function(t){return Rm(e.value.arrayValue,t)})},yb),gb=function(t,e){this.position=t,this.before=e};function yb(t,e){return ub.call(this,t,"array-contains-any",e)||this}function mb(t,e){return cb.call(this,t,"not-in",e)||this}function bb(t,e){return hb.call(this,t,"in",e)||this}function wb(t,e){return lb.call(this,t,"array-contains",e)||this}function _b(t){return(t.before?"b":"a")+":"+t.position.map(Dm).join(",")}var Ib=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function Tb(t,e,n){for(var r=0,i=0;i<t.position.length;i++){var o=e[i],s=t.position[i],r=o.field.isKeyField()?Cm.comparator(Cm.fromName(s.referenceValue),n.key):Pm(s,n.data.field(o.field));if("desc"===o.dir&&(r*=-1),0!==r)break}return t.before?r<=0:r<0}function Eb(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(!km(t.position[n],e.position[n]))return!1;return!0}var Sb=function(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.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=o,this.startAt=s,this.endAt=a,this.p=null,this.T=null,this.startAt,this.endAt};function Cb(t,e,n,r,i,o,s,a){return new Sb(t,e,n,r,i,o,s,a)}function Nb(t){return new Sb(t)}function Ab(t){return!Tm(t.limit)&&"F"===t.limitType}function kb(t){return!Tm(t.limit)&&"L"===t.limitType}function Rb(t){return 0<t.explicitOrderBy.length?t.explicitOrderBy[0].field:null}function Pb(t){for(var e=0,n=t.filters;e<n.length;e++){var r=n[e];if(r.g())return r.field}return null}function Ob(t){return null!==t.collectionGroup}function Db(t){var e=t;if(null===e.p){e.p=[];var n=Pb(e),t=Rb(e);if(null!==n&&null===t)n.isKeyField()||e.p.push(new Ib(n)),e.p.push(new Ib(cm.keyField(),"asc"));else{for(var r=!1,i=0,o=e.explicitOrderBy;i<o.length;i++){var s=o[i];e.p.push(s),s.field.isKeyField()&&(r=!0)}r||(n=0<e.explicitOrderBy.length?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc",e.p.push(new Ib(cm.keyField(),n)))}}return e.p}function xb(t){var e=t;if(!e.T)if("F"===e.limitType)e.T=Hm(e.path,e.collectionGroup,Db(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=Db(e);r<i.length;r++){var o=i[r],s="desc"===o.dir?"asc":"desc";n.push(new Ib(o.field,s))}var a=e.endAt?new gb(e.endAt.position,!e.endAt.before):null,t=e.startAt?new gb(e.startAt.position,!e.startAt.before):null;e.T=Hm(e.path,e.collectionGroup,n,e.filters,e.limit,a,t)}return e.T}function Lb(t,e,n){return new Sb(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Mb(t,e){return zm(xb(t),xb(e))&&t.limitType===e.limitType}function Fb(t){return Gm(xb(t))+"|lt:"+t.limitType}function Ub(t){return"Query(target="+(e=xb(t),n=e.path.canonicalString(),null!==e.collectionGroup&&(n+=" collectionGroup="+e.collectionGroup),0<e.filters.length&&(n+=", filters: ["+e.filters.map(function(t){return(t=t).field.canonicalString()+" "+t.op+" "+Dm(t.value)}).join(", ")+"]"),Tm(e.limit)||(n+=", limit: "+e.limit),0<e.orderBy.length&&(n+=", orderBy: ["+e.orderBy.map(function(t){return(t=t).field.canonicalString()+" ("+t.dir+")"}).join(", ")+"]"),e.startAt&&(n+=", startAt: "+_b(e.startAt)),e.endAt&&(n+=", endAt: "+_b(e.endAt)),"Target("+n+")")+"; limitType="+t.limitType+")";var e,n}function jb(i,t){return t.isFoundDocument()&&(e=i,n=t.key.path,null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):Cm.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n))&&function(t){for(var e=0,n=i.explicitOrderBy;e<n.length;e++){var r=n[e];if(!r.field.isKeyField()&&null===t.data.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,(!(t=i).startAt||Tb(t.startAt,Db(t),n))&&(!t.endAt||!Tb(t.endAt,Db(t),n)));var e,n}function qb(a){return function(t,e){for(var n=!1,r=0,i=Db(a);r<i.length;r++){var o=i[r],s=function(t,r,e){var n=t.field.isKeyField()?Cm.comparator(r.key,e.key):function(t,e){var n=r.data.field(t),t=e.data.field(t);return null!==n&&null!==t?Pm(n,t):Hy()}(t.field,e);switch(t.dir){case"asc":return n;case"desc":return-1*n;default:return Hy()}}(o,t,e);if(0!==s)return s;n=n||o.field.isKeyField()}return 0}}function Vb(t,e){if(t.I){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Em(e)?"-0":e}}function Bb(t){return{integerValue:""+t}}function Kb(t,e){return Sm(e)?Bb(e):Vb(t,e)}Sn=function(){this._=void 0};function Wb(t,e){return t instanceof rw?Lm(t=e)||t&&"doubleValue"in t?e:{integerValue:0}:null}var Hb,Gb,zb=(Xi(Xb,Gb=Sn),Xb),Qb=(Xi(Yb,Hb=Sn),Yb);function Yb(t){var e=this;return(e=Hb.call(this)||this).elements=t,e}function Xb(){return null!==Gb&&Gb.apply(this,arguments)||this}function Jb(t,e){for(var n=sw(e),r=0,i=t.elements;r<i.length;r++)!function(e){n.some(function(t){return km(t,e)})||n.push(e)}(i[r]);return{arrayValue:{values:n}}}var $b,Zb=(Xi(tw,$b=Sn),tw);function tw(t){var e=this;return(e=$b.call(this)||this).elements=t,e}function ew(t,e){for(var n=sw(e),r=0,i=t.elements;r<i.length;r++)!function(e){n=n.filter(function(t){return!km(t,e)})}(i[r]);return{arrayValue:{values:n}}}var nw,rw=(Xi(iw,nw=Sn),iw);function iw(t,e){var n=this;return(n=nw.call(this)||this).R=t,n.A=e,n}function ow(t){return bm(t.integerValue||t.doubleValue)}function sw(t){return Mm(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function aw(t,e){this.version=t,this.transformResults=e}var uw=function(t,e){this.field=t,this.transform=e},cw=(hw.none=function(){return new hw},hw.exists=function(t){return new hw(void 0,t)},hw.updateTime=function(t){return new hw(t)},Object.defineProperty(hw.prototype,"isNone",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!1,configurable:!0}),hw.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},hw);function hw(t,e){this.updateTime=t,this.exists=e}function lw(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}Ga=function(){};function fw(t,e,n){var r,i,o,s;t instanceof yw?(i=e,o=n,lw((r=t).precondition,i)&&(s=r.value.clone(),o=Tw(r.fieldTransforms,o,i),s.setAll(o),i.convertToFoundDocument(dw(i),s).setHasLocalMutations())):t instanceof mw?(o=e,i=n,lw((s=t).precondition,o)&&(n=Tw(s.fieldTransforms,i,o),(i=o.data).setAll(_w(s)),i.setAll(n),o.convertToFoundDocument(dw(o),i).setHasLocalMutations())):(e=e,lw(t.precondition,e)&&e.convertToNoDocument(Zy.min()))}function pw(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&(n=t.fieldTransforms,r=e.fieldTransforms,!!(void 0===n&&void 0===r||n&&r&&Xy(n,r,function(t,e){return e=e,(t=t).field.isEqual(e.field)&&(t=t.transform,e=e.transform,t instanceof Qb&&e instanceof Qb||t instanceof Zb&&e instanceof Zb?Xy(t.elements,e.elements,km):t instanceof rw&&e instanceof rw?km(t.A,e.A):t instanceof zb&&e instanceof zb)})))&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask));var n,r}function dw(t){return t.isFoundDocument()?t.version:Zy.min()}var vw,gw,yw=(Xi(ww,gw=Ga),ww),mw=(Xi(bw,vw=Ga),bw);function bw(t,e,n,r,i){void 0===i&&(i=[]);var o=this;return(o=vw.call(this)||this).key=t,o.data=e,o.fieldMask=n,o.precondition=r,o.fieldTransforms=i,o.type=1,o}function ww(t,e,n,r){void 0===r&&(r=[]);var i=this;return(i=gw.call(this)||this).key=t,i.value=e,i.precondition=n,i.fieldTransforms=r,i.type=0,i}function _w(n){var r=new Map;return n.fieldMask.fields.forEach(function(t){var e;t.isEmpty()||(e=n.data.field(t),r.set(t,e))}),r}function Iw(t,e,n){var r=new Map;Gy(t.length===n.length);for(var i=0;i<n.length;i++){var o=t[i],s=o.transform,a=e.data.field(o.field);r.set(o.field,(o=s,s=a,a=n[i],o instanceof Qb?Jb(o,s):o instanceof Zb?ew(o,s):a))}return r}function Tw(t,e,n){for(var r,i=new Map,o=0,s=t;o<s.length;o++){var a=s[o],u=a.transform,c=n.data.field(a.field);i.set(a.field,(r=c,a=e,c=void 0,(u=u)instanceof zb?(c={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:a.seconds,nanos:a.nanoseconds}}}},r&&(c.fields.__previous_value__=r),{mapValue:c}):u instanceof Qb?Jb(u,r):u instanceof Zb?ew(u,r):(u=Wb(c=u,r),r=ow(u)+ow(c.A),Lm(u)&&Lm(c.A)?Bb(r):Vb(c.R,r))))}return i}function Ew(t){this.count=t}var Sw,Cw,Nw,Aw=(Xi(Pw,Nw=Ga),Pw),kw=(Xi(Rw,Cw=Ga),Rw);function Rw(t,e){var n=this;return(n=Cw.call(this)||this).key=t,n.precondition=e,n.type=3,n.fieldTransforms=[],n}function Pw(t,e){var n=this;return(n=Nw.call(this)||this).key=t,n.precondition=e,n.type=2,n.fieldTransforms=[],n}function Ow(t){switch(t){case My.OK:return Hy(),0;case My.CANCELLED:case My.UNKNOWN:case My.DEADLINE_EXCEEDED:case My.RESOURCE_EXHAUSTED:case My.INTERNAL:case My.UNAVAILABLE:case My.UNAUTHENTICATED:return;case My.INVALID_ARGUMENT:case My.NOT_FOUND:case My.ALREADY_EXISTS:case My.PERMISSION_DENIED:case My.FAILED_PRECONDITION:case My.ABORTED:case My.OUT_OF_RANGE:case My.UNIMPLEMENTED:case My.DATA_LOSS:return 1;default:return Hy(),0}}function Dw(t){if(void 0===t)return By("GRPC error has no .code"),My.UNKNOWN;switch(t){case Sw.OK:return My.OK;case Sw.CANCELLED:return My.CANCELLED;case Sw.UNKNOWN:return My.UNKNOWN;case Sw.DEADLINE_EXCEEDED:return My.DEADLINE_EXCEEDED;case Sw.RESOURCE_EXHAUSTED:return My.RESOURCE_EXHAUSTED;case Sw.INTERNAL:return My.INTERNAL;case Sw.UNAVAILABLE:return My.UNAVAILABLE;case Sw.UNAUTHENTICATED:return My.UNAUTHENTICATED;case Sw.INVALID_ARGUMENT:return My.INVALID_ARGUMENT;case Sw.NOT_FOUND:return My.NOT_FOUND;case Sw.ALREADY_EXISTS:return My.ALREADY_EXISTS;case Sw.PERMISSION_DENIED:return My.PERMISSION_DENIED;case Sw.FAILED_PRECONDITION:return My.FAILED_PRECONDITION;case Sw.ABORTED:return My.ABORTED;case Sw.OUT_OF_RANGE:return My.OUT_OF_RANGE;case Sw.UNIMPLEMENTED:return My.UNIMPLEMENTED;case Sw.DATA_LOSS:return My.DATA_LOSS;default:return Hy()}}(Sn=Sw=Sw||{})[Sn.OK=0]="OK",Sn[Sn.CANCELLED=1]="CANCELLED",Sn[Sn.UNKNOWN=2]="UNKNOWN",Sn[Sn.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Sn[Sn.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Sn[Sn.NOT_FOUND=5]="NOT_FOUND",Sn[Sn.ALREADY_EXISTS=6]="ALREADY_EXISTS",Sn[Sn.PERMISSION_DENIED=7]="PERMISSION_DENIED",Sn[Sn.UNAUTHENTICATED=16]="UNAUTHENTICATED",Sn[Sn.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Sn[Sn.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Sn[Sn.ABORTED=10]="ABORTED",Sn[Sn.OUT_OF_RANGE=11]="OUT_OF_RANGE",Sn[Sn.UNIMPLEMENTED=12]="UNIMPLEMENTED",Sn[Sn.INTERNAL=13]="INTERNAL",Sn[Sn.UNAVAILABLE=14]="UNAVAILABLE",Sn[Sn.DATA_LOSS=15]="DATA_LOSS";var xw=(jw.prototype.insert=function(t,e){return new jw(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,Mw.BLACK,null,null))},jw.prototype.remove=function(t){return new jw(this.comparator,this.root.remove(t,this.comparator).copy(null,null,Mw.BLACK,null,null))},jw.prototype.get=function(t){for(var e=this.root;!e.isEmpty();){var n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:0<n&&(e=e.right)}return null},jw.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.isEmpty();){var r=this.comparator(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},jw.prototype.isEmpty=function(){return this.root.isEmpty()},Object.defineProperty(jw.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),jw.prototype.minKey=function(){return this.root.minKey()},jw.prototype.maxKey=function(){return this.root.maxKey()},jw.prototype.inorderTraversal=function(t){return this.root.inorderTraversal(t)},jw.prototype.forEach=function(n){this.inorderTraversal(function(t,e){return n(t,e),!1})},jw.prototype.toString=function(){var n=[];return this.inorderTraversal(function(t,e){return n.push(t+":"+e),!1}),"{"+n.join(", ")+"}"},jw.prototype.reverseTraversal=function(t){return this.root.reverseTraversal(t)},jw.prototype.getIterator=function(){return new Lw(this.root,null,this.comparator,!1)},jw.prototype.getIteratorFrom=function(t){return new Lw(this.root,t,this.comparator,!1)},jw.prototype.getReverseIterator=function(){return new Lw(this.root,null,this.comparator,!0)},jw.prototype.getReverseIteratorFrom=function(t){return new Lw(this.root,t,this.comparator,!0)},jw),Lw=(Uw.prototype.getNext=function(){var t=this.nodeStack.pop(),e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e},Uw.prototype.hasNext=function(){return 0<this.nodeStack.length},Uw.prototype.peek=function(){if(0===this.nodeStack.length)return null;var t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}},Uw),Mw=(Fw.prototype.copy=function(t,e,n,r,i){return new Fw(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)},Fw.prototype.isEmpty=function(){return!1},Fw.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},Fw.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},Fw.prototype.min=function(){return this.left.isEmpty()?this:this.left.min()},Fw.prototype.minKey=function(){return this.min().key},Fw.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},Fw.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()},Fw.prototype.removeMin=function(){if(this.left.isEmpty())return Fw.EMPTY;var t=this;return(t=(t=!t.left.isRed()&&!t.left.left.isRed()?t.moveRedLeft():t).copy(null,null,null,t.left.removeMin(),null)).fixUp()},Fw.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r=(r=!(r.left.isEmpty()||r.left.isRed()||r.left.left.isRed())?r.moveRedLeft():r).copy(null,null,null,r.left.remove(t,e),null);else{if(0===e(t,(r=!((r=r.left.isRed()?r.rotateRight():r).right.isEmpty()||r.right.isRed()||r.right.left.isRed())?r.moveRedRight():r).key)){if(r.right.isEmpty())return Fw.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()},Fw.prototype.isRed=function(){return this.color},Fw.prototype.fixUp=function(){var t=this;return t=(t=(t=t.right.isRed()&&!t.left.isRed()?t.rotateLeft():t).left.isRed()&&t.left.left.isRed()?t.rotateRight():t).left.isRed()&&t.right.isRed()?t.colorFlip():t},Fw.prototype.moveRedLeft=function(){var t=this.colorFlip();return t=t.right.left.isRed()?(t=(t=t.copy(null,null,null,null,t.right.rotateRight())).rotateLeft()).colorFlip():t},Fw.prototype.moveRedRight=function(){var t=this.colorFlip();return t=t.left.left.isRed()?(t=t.rotateRight()).colorFlip():t},Fw.prototype.rotateLeft=function(){var t=this.copy(null,null,Fw.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},Fw.prototype.rotateRight=function(){var t=this.copy(null,null,Fw.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},Fw.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)},Fw.prototype.checkMaxDepth=function(){var t=this.check();return Math.pow(2,t)<=this.size+1},Fw.prototype.check=function(){if(this.isRed()&&this.left.isRed())throw Hy();if(this.right.isRed())throw Hy();var t=this.left.check();if(t!==this.right.check())throw Hy();return t+(this.isRed()?0:1)},Fw);function Fw(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:Fw.RED,this.left=null!=r?r:Fw.EMPTY,this.right=null!=i?i:Fw.EMPTY,this.size=this.left.size+1+this.right.size}function Uw(t,e,n,r){this.isReverse=r,this.nodeStack=[];for(var i=1;!t.isEmpty();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.isReverse?t.left:t.right;else{if(0===i){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}function jw(t,e){this.comparator=t,this.root=e||Mw.EMPTY}function qw(){this.size=0}Mw.EMPTY=null,Mw.RED=!0,Mw.BLACK=!1,Mw.EMPTY=(Object.defineProperty(qw.prototype,"key",{get:function(){throw Hy()},enumerable:!1,configurable:!0}),Object.defineProperty(qw.prototype,"value",{get:function(){throw Hy()},enumerable:!1,configurable:!0}),Object.defineProperty(qw.prototype,"color",{get:function(){throw Hy()},enumerable:!1,configurable:!0}),Object.defineProperty(qw.prototype,"left",{get:function(){throw Hy()},enumerable:!1,configurable:!0}),Object.defineProperty(qw.prototype,"right",{get:function(){throw Hy()},enumerable:!1,configurable:!0}),qw.prototype.copy=function(t,e,n,r,i){return this},qw.prototype.insert=function(t,e,n){return new Mw(t,e)},qw.prototype.remove=function(t,e){return this},qw.prototype.isEmpty=function(){return!0},qw.prototype.inorderTraversal=function(t){return!1},qw.prototype.reverseTraversal=function(t){return!1},qw.prototype.minKey=function(){return null},qw.prototype.maxKey=function(){return null},qw.prototype.isRed=function(){return!1},qw.prototype.checkMaxDepth=function(){return!0},qw.prototype.check=function(){return 0},new qw);var Vw=(Hw.prototype.has=function(t){return null!==this.data.get(t)},Hw.prototype.first=function(){return this.data.minKey()},Hw.prototype.last=function(){return this.data.maxKey()},Object.defineProperty(Hw.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),Hw.prototype.indexOf=function(t){return this.data.indexOf(t)},Hw.prototype.forEach=function(n){this.data.inorderTraversal(function(t,e){return n(t),!1})},Hw.prototype.forEachInRange=function(t,e){for(var n=this.data.getIteratorFrom(t[0]);n.hasNext();){var r=n.getNext();if(0<=this.comparator(r.key,t[1]))return;e(r.key)}},Hw.prototype.forEachWhile=function(t,e){for(var n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return},Hw.prototype.firstAfterOrEqual=function(t){t=this.data.getIteratorFrom(t);return t.hasNext()?t.getNext().key:null},Hw.prototype.getIterator=function(){return new Bw(this.data.getIterator())},Hw.prototype.getIteratorFrom=function(t){return new Bw(this.data.getIteratorFrom(t))},Hw.prototype.add=function(t){return this.copy(this.data.remove(t).insert(t,!0))},Hw.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},Hw.prototype.isEmpty=function(){return this.data.isEmpty()},Hw.prototype.unionWith=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach(function(t){e=e.add(t)}),e},Hw.prototype.isEqual=function(t){if(!(t instanceof Hw))return!1;if(this.size!==t.size)return!1;for(var e=this.data.getIterator(),n=t.data.getIterator();e.hasNext();){var r=e.getNext().key,i=n.getNext().key;if(0!==this.comparator(r,i))return!1}return!0},Hw.prototype.toArray=function(){var e=[];return this.forEach(function(t){e.push(t)}),e},Hw.prototype.toString=function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"},Hw.prototype.copy=function(t){var e=new Hw(this.comparator);return e.data=t,e},Hw),Bw=(Ww.prototype.getNext=function(){return this.iter.getNext().key},Ww.prototype.hasNext=function(){return this.iter.hasNext()},Ww),Kw=new xw(Cm.comparator);function Ww(t){this.iter=t}function Hw(t){this.comparator=t,this.data=new xw(this.comparator)}var Gw=new xw(Cm.comparator);var zw=new xw(Cm.comparator);var Qw=new Vw(Cm.comparator);function Yw(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=Qw,r=0,i=t;r<i.length;r++)var o=i[r],n=n.add(o);return n}var Xw=new Vw(Yy);var Jw=(a_.createSynthesizedRemoteEventForCurrentChange=function(t,e){var n=new Map;return n.set(t,$w.createSynthesizedTargetChangeForCurrentChange(t,e)),new a_(Zy.min(),n,Xw,Kw,Yw())},a_),$w=(s_.createSynthesizedTargetChangeForCurrentChange=function(t,e){return new s_(lm.EMPTY_BYTE_STRING,e,Yw(),Yw(),Yw())},s_),Zw=function(t,e,n,r){this.v=t,this.removedTargetIds=e,this.key=n,this.P=r},t_=function(t,e){this.targetId=t,this.V=e},e_=function(t,e,n,r){void 0===n&&(n=lm.EMPTY_BYTE_STRING),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r},n_=(Object.defineProperty(o_.prototype,"current",{get:function(){return this.N},enumerable:!1,configurable:!0}),Object.defineProperty(o_.prototype,"resumeToken",{get:function(){return this.C},enumerable:!1,configurable:!0}),Object.defineProperty(o_.prototype,"k",{get:function(){return 0!==this.S},enumerable:!1,configurable:!0}),Object.defineProperty(o_.prototype,"O",{get:function(){return this.F},enumerable:!1,configurable:!0}),o_.prototype.$=function(t){0<t.approximateByteSize()&&(this.F=!0,this.C=t)},o_.prototype.M=function(){var n=Yw(),r=Yw(),i=Yw();return this.D.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:Hy()}}),new $w(this.C,this.N,n,r,i)},o_.prototype.L=function(){this.F=!1,this.D=c_()},o_.prototype.B=function(t,e){this.F=!0,this.D=this.D.insert(t,e)},o_.prototype.q=function(t){this.F=!0,this.D=this.D.remove(t)},o_.prototype.U=function(){this.S+=1},o_.prototype.K=function(){--this.S},o_.prototype.j=function(){this.F=!0,this.N=!0},o_),r_=(i_.prototype.X=function(t){for(var e=0,n=t.v;e<n.length;e++){var r=n[e];t.P&&t.P.isFoundDocument()?this.Z(r,t.P):this.tt(r,t.key,t.P)}for(var i=0,o=t.removedTargetIds;i<o.length;i++)r=o[i],this.tt(r,t.key,t.P)},i_.prototype.et=function(n){var r=this;this.forEachTarget(n,function(t){var e=r.nt(t);switch(n.state){case 0:r.st(t)&&e.$(n.resumeToken);break;case 1:e.K(),e.k||e.L(),e.$(n.resumeToken);break;case 2:e.K(),e.k||r.removeTarget(t);break;case 3:r.st(t)&&(e.j(),e.$(n.resumeToken));break;case 4:r.st(t)&&(r.it(t),e.$(n.resumeToken));break;default:Hy()}})},i_.prototype.forEachTarget=function(t,n){var r=this;0<t.targetIds.length?t.targetIds.forEach(n):this.G.forEach(function(t,e){r.st(e)&&n(e)})},i_.prototype.rt=function(t){var e=t.targetId,n=t.V.count,t=this.ot(e);t&&(Qm(t=t.target)?0===n?(t=new Cm(t.path),this.tt(e,t,Bm.newNoDocument(t,Zy.min()))):Gy(1===n):this.ct(e)!==n&&(this.it(e),this.Y=this.Y.add(e)))},i_.prototype.ut=function(r){var i=this,o=new Map;this.G.forEach(function(t,e){var n=i.ot(e);n&&(t.current&&Qm(n.target)&&(n=new Cm(n.target.path),null!==i.H.get(n)||i.at(e,n)||i.tt(e,n,Bm.newNoDocument(n,r))),t.O&&(o.set(e,t.M()),t.L()))});var s=Yw();this.J.forEach(function(t,e){var n=!0;e.forEachWhile(function(t){t=i.ot(t);return!t||2===t.purpose||(n=!1)}),n&&(s=s.add(t))});var t=new Jw(r,o,this.Y,this.H,s);return this.H=Kw,this.J=u_(),this.Y=new Vw(Yy),t},i_.prototype.Z=function(t,e){var n;this.st(t)&&(n=this.at(t,e.key)?2:0,this.nt(t).B(e.key,n),this.H=this.H.insert(e.key,e),this.J=this.J.insert(e.key,this.ht(e.key).add(t)))},i_.prototype.tt=function(t,e,n){var r;this.st(t)&&(r=this.nt(t),this.at(t,e)?r.B(e,1):r.q(e),this.J=this.J.insert(e,this.ht(e).delete(t)),n&&(this.H=this.H.insert(e,n)))},i_.prototype.removeTarget=function(t){this.G.delete(t)},i_.prototype.ct=function(t){var e=this.nt(t).M();return this.W.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size},i_.prototype.U=function(t){this.nt(t).U()},i_.prototype.nt=function(t){var e=this.G.get(t);return e||(e=new n_,this.G.set(t,e)),e},i_.prototype.ht=function(t){var e=this.J.get(t);return e||(e=new Vw(Yy),this.J=this.J.insert(t,e)),e},i_.prototype.st=function(t){var e=null!==this.ot(t);return e||Vy("WatchChangeAggregator","Detected inactive target",t),e},i_.prototype.ot=function(t){var e=this.G.get(t);return e&&e.k?null:this.W.lt(t)},i_.prototype.it=function(e){var n=this;this.G.set(e,new n_),this.W.getRemoteKeysForTarget(e).forEach(function(t){n.tt(e,t,null)})},i_.prototype.at=function(t,e){return this.W.getRemoteKeysForTarget(t).has(e)},i_);function i_(t){this.W=t,this.G=new Map,this.H=Kw,this.J=u_(),this.Y=new Vw(Yy)}function o_(){this.S=0,this.D=c_(),this.C=lm.EMPTY_BYTE_STRING,this.N=!1,this.F=!0}function s_(t,e,n,r,i){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}function a_(t,e,n,r,i){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}function u_(){return new xw(Cm.comparator)}function c_(){return new xw(Cm.comparator)}var h_={asc:"ASCENDING",desc:"DESCENDING"},l_={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},f_=function(t,e){this.databaseId=t,this.I=e};function p_(t,e){return t.I?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function d_(t,e){return t.I?e.toBase64():e.toUint8Array()}function v_(t){return Gy(!!t),Zy.fromTimestamp((t=mm(t),new $y(t.seconds,t.nanos)))}function g_(t,e){return new am(["projects",t.projectId,"databases",t.database]).child("documents").child(e).canonicalString()}function y_(t){t=am.fromString(t);return Gy(F_(t)),t}function m_(t,e){return g_(t.databaseId,e.path)}function b_(t,e){e=y_(e);if(e.get(1)!==t.databaseId.projectId)throw new Fy(My.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+e.get(1)+" vs "+t.databaseId.projectId);if(e.get(3)!==t.databaseId.database)throw new Fy(My.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+e.get(3)+" vs "+t.databaseId.database);return new Cm(T_(e))}function w_(t,e){return g_(t.databaseId,e)}function __(t){t=y_(t);return 4===t.length?am.emptyPath():T_(t)}function I_(t){return new am(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function T_(t){return Gy(4<t.length&&"documents"===t.get(4)),t.popFirst(5)}function E_(t,e,n){return{name:m_(t,e),fields:n.toProto().mapValue.fields}}function S_(t,e,n){var r=b_(t,e.name),t=v_(e.updateTime),e=new qm({mapValue:{fields:e.fields}}),e=Bm.newFoundDocument(r,t,e);return n&&e.setHasCommittedMutations(),n?e.setHasCommittedMutations():e}function C_(t,e){var n,r,i;if(e instanceof yw)n={update:E_(t,e.key,e.value)};else if(e instanceof Aw)n={delete:m_(t,e.key)};else if(e instanceof mw)n={update:E_(t,e.key,e.data),updateMask:(i=e.fieldMask,r=[],i.fields.forEach(function(t){return r.push(t.canonicalString())}),{fieldPaths:r})};else{if(!(e instanceof kw))return Hy();n={verify:m_(t,e.key)}}return 0<e.fieldTransforms.length&&(n.updateTransforms=e.fieldTransforms.map(function(t){var e=t.transform;if(e instanceof zb)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(e instanceof Qb)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:e.elements}};if(e instanceof Zb)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:e.elements}};if(e instanceof rw)return{fieldPath:t.field.canonicalString(),increment:e.A};throw Hy()})),e.precondition.isNone||(n.currentDocument=void 0!==(i=e.precondition).updateTime?{updateTime:(e=t,t=i.updateTime,p_(e,t.toTimestamp()))}:void 0!==i.exists?{exists:i.exists}:Hy()),n}function N_(e,t){var n=t.currentDocument?void 0!==(s=t.currentDocument).updateTime?cw.updateTime(v_(s.updateTime)):void 0!==s.exists?cw.exists(s.exists):cw.none():cw.none(),r=t.updateTransforms?t.updateTransforms.map(function(t){return function(t,e){var n,r=null;"setToServerValue"in e?(Gy("REQUEST_TIME"===e.setToServerValue),r=new zb):"appendMissingElements"in e?(n=e.appendMissingElements.values||[],r=new Qb(n)):"removeAllFromArray"in e?(n=e.removeAllFromArray.values||[],r=new Zb(n)):"increment"in e?r=new rw(t,e.increment):Hy();e=cm.fromServerFormat(e.fieldPath);return new uw(e,r)}(e,t)}):[];if(t.update){t.update.name;var i=b_(e,t.update.name),o=new qm({mapValue:{fields:t.update.fields}});if(t.updateMask){var s=(s=t.updateMask.fieldPaths||[],new hm(s.map(function(t){return cm.fromServerFormat(t)})));return new mw(i,o,s,n,r)}return new yw(i,o,n,r)}if(t.delete){r=b_(e,t.delete);return new Aw(r,n)}if(t.verify){t=b_(e,t.verify);return new kw(t,n)}return Hy()}function A_(t,e){return{documents:[w_(t,e.path)]}}function k_(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=w_(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=w_(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);r=function(t){if(0!==t.length){t=t.map(function(t){if("=="===t.op){if(Um(t.value))return{unaryFilter:{field:D_(t.field),op:"IS_NAN"}};if(Fm(t.value))return{unaryFilter:{field:D_(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Um(t.value))return{unaryFilter:{field:D_(t.field),op:"IS_NOT_NAN"}};if(Fm(t.value))return{unaryFilter:{field:D_(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:D_(t.field),op:(e=t.op,l_[e]),value:t.value}};var e});return 1===t.length?t[0]:{compositeFilter:{op:"AND",filters:t}}}}(e.filters);r&&(n.structuredQuery.where=r);r=function(t){if(0!==t.length)return t.map(function(t){return{field:D_((t=t).field),direction:(t=t.dir,h_[t])}})}(e.orderBy);r&&(n.structuredQuery.orderBy=r);r=e.limit,r=t.I||Tm(r)?r:{value:r};return null!==r&&(n.structuredQuery.limit=r),e.startAt&&(n.structuredQuery.startAt=P_(e.startAt)),e.endAt&&(n.structuredQuery.endAt=P_(e.endAt)),n}function R_(t){var e=__(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;0<r&&(Gy(1===r),(a=n.from[0]).allDescendants?i=a.collectionId:e=e.child(a.collectionId));var o=[];n.where&&(o=function e(t){return t?void 0!==t.unaryFilter?[M_(t)]:void 0!==t.fieldFilter?[L_(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map(function(t){return e(t)}).reduce(function(t,e){return t.concat(e)}):Hy():[]}(n.where));var s=[],t=null,r=null,a=null;return Cb(e,i,s=n.orderBy?n.orderBy.map(function(t){return new Ib(x_((e=t).field),function(){switch(e.direction){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}());var e}):s,o,t=n.limit?Tm(o="object"==typeof(o=n.limit)?o.value:o)?null:o:t,"F",r=n.startAt?O_(n.startAt):r,a=n.endAt?O_(n.endAt):a)}function P_(t){return{before:t.before,values:t.position}}function O_(t){var e=!!t.before,t=t.values||[];return new gb(t,e)}function D_(t){return{fieldPath:t.canonicalString()}}function x_(t){return cm.fromServerFormat(t.fieldPath)}function L_(t){return Xm.create(x_(t.fieldFilter.field),function(){switch(t.fieldFilter.op){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return Hy()}}(),t.fieldFilter.value)}function M_(t){switch(t.unaryFilter.op){case"IS_NAN":var e=x_(t.unaryFilter.field);return Xm.create(e,"==",{doubleValue:NaN});case"IS_NULL":e=x_(t.unaryFilter.field);return Xm.create(e,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var n=x_(t.unaryFilter.field);return Xm.create(n,"!=",{doubleValue:NaN});case"IS_NOT_NULL":n=x_(t.unaryFilter.field);return Xm.create(n,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return Hy()}}function F_(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}function U_(t){for(var e="",n=0;n<t.length;n++)0<e.length&&(e=j_(e)),e=function(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}(t.get(n),e);return j_(e)}function j_(t){return t+""}function q_(t){var e=t.length;if(Gy(2<=e),2===e)return Gy(""===t.charAt(0)&&""===t.charAt(1)),am.emptyPath();for(var n=e-2,r=[],i="",o=0;o<e;){var s=t.indexOf("",o);switch((s<0||n<s)&&Hy(),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:Hy()}o=s+2}return new am(r)}function V_(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n}var B_=function(t,e){this.seconds=t,this.nanoseconds=e};V_.store="owner",V_.key="owner";function K_(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n}K_.store="mutationQueues",K_.keyPath="userId";function W_(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i}W_.store="mutations",W_.keyPath="batchId",W_.userMutationsIndex="userMutationsIndex",W_.userMutationsKeyPath=["userId","batchId"];var H_=(G_.prefixForUser=function(t){return[t]},G_.prefixForPath=function(t,e){return[t,U_(e)]},G_.key=function(t,e,n){return[t,U_(e),n]},G_);function G_(){}H_.store="documentMutations",H_.PLACEHOLDER=new H_;function z_(t,e){this.path=t,this.readTime=e}function Q_(t,e){this.path=t,this.version=e}var Y_=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};Y_.store="remoteDocuments",Y_.readTimeIndex="readTimeIndex",Y_.readTimeIndexPath="readTime",Y_.collectionReadTimeIndex="collectionReadTimeIndex",Y_.collectionReadTimeIndexPath=["parentPath","readTime"];function X_(t){this.byteSize=t}X_.store="remoteDocumentGlobal",X_.key="remoteDocumentGlobalKey";function J_(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}J_.store="targets",J_.keyPath="targetId",J_.queryTargetsIndexName="queryTargetsIndex",J_.queryTargetsKeyPath=["canonicalId","targetId"];var $_=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};$_.store="targetDocuments",$_.keyPath=["targetId","path"],$_.documentTargetsIndex="documentTargetsIndex",$_.documentTargetsKeyPath=["path","targetId"];function Z_(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r}Z_.key="targetGlobalKey",Z_.store="targetGlobal";function tI(t,e){this.collectionId=t,this.parent=e}tI.store="collectionParents",tI.keyPath=["collectionId","parent"];function eI(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r}eI.store="clientMetadata",eI.keyPath="clientId";function nI(t,e,n){this.bundleId=t,this.createTime=e,this.version=n}nI.store="bundles",nI.keyPath="bundleId";function rI(t,e,n){this.name=t,this.readTime=e,this.bundledQuery=n}rI.store="namedQueries",rI.keyPath="name";var iI,oI=no(no([],no(no([],no(no([],no(no([],[K_.store,W_.store,H_.store,Y_.store,J_.store,V_.store,Z_.store,$_.store]),[eI.store])),[X_.store])),[tI.store])),[nI.store,rI.store]),sI="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Ga=(mI.prototype.addOnCommittedListener=function(t){this.onCommittedListeners.push(t)},mI.prototype.raiseOnCommittedEvent=function(){this.onCommittedListeners.forEach(function(t){return t()})},mI),aI=function(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})},uI=(yI.prototype.catch=function(t){return this.next(void 0,t)},yI.prototype.next=function(r,i){var o=this;return this.callbackAttached&&Hy(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(i,this.error):this.wrapSuccess(r,this.result):new yI(function(e,n){o.nextCallback=function(t){o.wrapSuccess(r,t).next(e,n)},o.catchCallback=function(t){o.wrapFailure(i,t).next(e,n)}})},yI.prototype.toPromise=function(){var n=this;return new Promise(function(t,e){n.next(t,e)})},yI.prototype.wrapUserFunction=function(t){try{var e=t();return e instanceof yI?e:yI.resolve(e)}catch(t){return yI.reject(t)}},yI.prototype.wrapSuccess=function(t,e){return t?this.wrapUserFunction(function(){return t(e)}):yI.resolve(e)},yI.prototype.wrapFailure=function(t,e){return t?this.wrapUserFunction(function(){return t(e)}):yI.reject(e)},yI.resolve=function(n){return new yI(function(t,e){t(n)})},yI.reject=function(n){return new yI(function(t,e){e(n)})},yI.waitFor=function(t){return new yI(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()})},yI.or=function(t){for(var n=yI.resolve(!1),e=0,r=t;e<r.length;e++)!function(e){n=n.next(function(t){return t?yI.resolve(t):e()})}(r[e]);return n},yI.forEach=function(t,n){var r=this,i=[];return t.forEach(function(t,e){i.push(n.call(r,t,e))}),this.waitFor(i)},yI),cI=(gI.open=function(t,e,n,r){try{return new gI(e,t.transaction(r,n))}catch(t){throw new fI(e,t)}},Object.defineProperty(gI.prototype,"dt",{get:function(){return this.ft.promise},enumerable:!1,configurable:!0}),gI.prototype.abort=function(t){t&&this.ft.reject(t),this.aborted||(Vy("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},gI.prototype.store=function(t){t=this.transaction.objectStore(t);return new wI(t)},gI),hI=(vI.delete=function(t){return Vy("SimpleDb","Removing database:",t),II(window.indexedDB.deleteDatabase(t)).toPromise()},vI.yt=function(){if("undefined"==typeof indexedDB)return!1;if(vI.gt())return!0;var t=po(),e=vI._t(t),n=0<e&&e<10,e=vI.Et(t),e=0<e&&e<4.5;return!(0<t.indexOf("MSIE ")||0<t.indexOf("Trident/")||0<t.indexOf("Edge/")||n||e)},vI.gt=function(){var t;return"undefined"!=typeof process&&"YES"===(null===(t=process.env)||void 0===t?void 0:t.Tt)},vI.It=function(t,e){return t.store(e)},vI._t=function(t){t=t.match(/i(?:phone|pad|pod) os ([\d_]+)/i),t=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(t)},vI.Et=function(t){t=t.match(/Android ([\d.]+)/i),t=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(t)},vI.prototype.At=function(o){return $i(this,void 0,void 0,function(){var e,i=this;return Zi(this,function(t){switch(t.label){case 0:return this.db?[3,2]:(Vy("SimpleDb","Opening database:",this.name),e=this,[4,new Promise(function(e,n){var r=indexedDB.open(i.name,i.version);r.onsuccess=function(t){t=t.target.result;e(t)},r.onblocked=function(){n(new fI(o,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},r.onerror=function(t){t=t.target.error;"VersionError"===t.name?n(new Fy(My.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.")):n(new fI(o,t))},r.onupgradeneeded=function(t){Vy("SimpleDb",'Database "'+i.name+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;i.wt.Rt(e,r.transaction,t.oldVersion,i.version).next(function(){Vy("SimpleDb","Database upgrade to version "+i.version+" complete")})}})]);case 1:e.db=t.sent(),t.label=2;case 2:return[2,(this.bt&&(this.db.onversionchange=function(t){return i.bt(t)}),this.db)]}})})},vI.prototype.vt=function(e){this.bt=e,this.db&&(this.db.onversionchange=function(t){return e(t)})},vI.prototype.runTransaction=function(a,n,u,c){return $i(this,void 0,void 0,function(){var i,o,s,e;return Zi(this,function(t){switch(t.label){case 0:i="readonly"===n,o=0,e=function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:++o,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,s.At(a)];case 2:return s.db=t.sent(),e=cI.open(s.db,a,i?"readonly":"readwrite",u),n=c(e).catch(function(t){return e.abort(t),uI.reject(t)}).toPromise(),r={},n.catch(function(){}),[4,e.dt];case 3:return[2,(r.value=(t.sent(),n),r)];case 4:return n=t.sent(),r="FirebaseError"!==n.name&&o<3,Vy("SimpleDb","Transaction failed with error:",n.message,"Retrying:",r),s.close(),r?[3,5]:[2,{value:Promise.reject(n)}];case 5:return[2]}})},s=this,t.label=1;case 1:return[5,e()];case 2:if("object"==typeof(e=t.sent()))return[2,e.value];t.label=3;case 3:return[3,1];case 4:return[2]}})})},vI.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},vI),lI=(Object.defineProperty(dI.prototype,"isDone",{get:function(){return this.Vt},enumerable:!1,configurable:!0}),Object.defineProperty(dI.prototype,"Dt",{get:function(){return this.St},enumerable:!1,configurable:!0}),Object.defineProperty(dI.prototype,"cursor",{set:function(t){this.Pt=t},enumerable:!1,configurable:!0}),dI.prototype.done=function(){this.Vt=!0},dI.prototype.Ct=function(t){this.St=t},dI.prototype.delete=function(){return II(this.Pt.delete())},dI),fI=(Xi(pI,iI=Fy),pI);function pI(t,e){var n=this;return(n=iI.call(this,My.UNAVAILABLE,"IndexedDB transaction '"+t+"' failed: "+e)||this).name="IndexedDbTransactionError",n}function dI(t){this.Pt=t,this.Vt=!1,this.St=null}function vI(t,e,n){this.name=t,this.version=e,this.wt=n,12.2===vI._t(po())&&By("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 gI(e,t){var n=this;this.action=e,this.transaction=t,this.aborted=!1,this.ft=new aI,this.transaction.oncomplete=function(){n.ft.resolve()},this.transaction.onabort=function(){t.error?n.ft.reject(new fI(e,t.error)):n.ft.resolve()},this.transaction.onerror=function(t){t=EI(t.target.error);n.ft.reject(new fI(e,t))}}function yI(t){var e=this;this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(function(t){e.isDone=!0,e.result=t,e.nextCallback&&e.nextCallback(t)},function(t){e.isDone=!0,e.error=t,e.catchCallback&&e.catchCallback(t)})}function mI(){this.onCommittedListeners=[]}function bI(t){return"IndexedDbTransactionError"===t.name}var wI=(_I.prototype.put=function(t,e){t=void 0!==e?(Vy("SimpleDb","PUT",this.store.name,t,e),this.store.put(e,t)):(Vy("SimpleDb","PUT",this.store.name,"<auto-key>",t),this.store.put(t));return II(t)},_I.prototype.add=function(t){return Vy("SimpleDb","ADD",this.store.name,t,t),II(this.store.add(t))},_I.prototype.get=function(e){var n=this;return II(this.store.get(e)).next(function(t){return void 0===t&&(t=null),Vy("SimpleDb","GET",n.store.name,e,t),t})},_I.prototype.delete=function(t){return Vy("SimpleDb","DELETE",this.store.name,t),II(this.store.delete(t))},_I.prototype.count=function(){return Vy("SimpleDb","COUNT",this.store.name),II(this.store.count())},_I.prototype.Nt=function(t,e){var e=this.cursor(this.options(t,e)),n=[];return this.xt(e,function(t,e){n.push(e)}).next(function(){return n})},_I.prototype.Ft=function(t,e){Vy("SimpleDb","DELETE ALL",this.store.name);e=this.options(t,e);e.kt=!1;e=this.cursor(e);return this.xt(e,function(t,e,n){return n.delete()})},_I.prototype.Ot=function(t,e){e?n=t:(n={},e=t);var n=this.cursor(n);return this.xt(n,e)},_I.prototype.$t=function(r){var t=this.cursor({});return new uI(function(n,e){t.onerror=function(t){t=EI(t.target.error);e(t)},t.onsuccess=function(t){var e=t.target.result;e?r(e.primaryKey,e.value).next(function(t){t?e.continue():n()}):n()}})},_I.prototype.xt=function(t,i){var o=[];return new uI(function(r,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e,n=t.target.result;n?(e=new lI(n),(t=i(n.primaryKey,n.value,e))instanceof uI&&(t=t.catch(function(t){return e.done(),uI.reject(t)}),o.push(t)),e.isDone?r():null===e.Dt?n.continue():n.continue(e.Dt)):r()}}).next(function(){return uI.waitFor(o)})},_I.prototype.options=function(t,e){var n;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},_I.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.kt?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},_I);function _I(t){this.store=t}function II(t){return new uI(function(e,n){t.onsuccess=function(t){t=t.target.result;e(t)},t.onerror=function(t){t=EI(t.target.error);n(t)}})}var TI=!1;function EI(t){var e=hI._t(po());if(12.2<=e&&e<13){e="An internal error was encountered in the Indexed Database server";if(0<=t.message.indexOf(e)){var n=new Fy("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+e+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return TI||(TI=!0,setTimeout(function(){throw n},0)),n}}return t}var SI,CI=(Xi(NI,SI=Ga),NI);function NI(t,e){var n=this;return(n=SI.call(this)||this).Mt=t,n.currentSequenceNumber=e,n}function AI(t,e){return hI.It(t.Mt,e)}var kI=(LI.prototype.applyToRemoteDocument=function(t,e){for(var n,r,i,o,s,a,u=e.mutationResults,c=0;c<this.mutations.length;c++){var h=this.mutations[c];h.key.isEqual(t.key)&&(n=h,r=t,i=u[c],h=a=s=o=void 0,n instanceof yw?(s=r,a=i,h=(o=n).value.clone(),o=Iw(o.fieldTransforms,s,a.transformResults),h.setAll(o),s.convertToFoundDocument(a.version,h).setHasCommittedMutations()):n instanceof mw?(o=r,s=i,lw((a=n).precondition,o)?(h=Iw(a.fieldTransforms,o,s.transformResults),(n=o.data).setAll(_w(a)),n.setAll(h),o.convertToFoundDocument(s.version,n).setHasCommittedMutations()):o.convertToUnknownDocument(s.version)):r.convertToNoDocument(i.version).setHasCommittedMutations())}},LI.prototype.applyToLocalView=function(t){for(var e=0,n=this.baseMutations;e<n.length;e++)(r=n[e]).key.isEqual(t.key)&&fw(r,t,this.localWriteTime);for(var r,i=0,o=this.mutations;i<o.length;i++)(r=o[i]).key.isEqual(t.key)&&fw(r,t,this.localWriteTime)},LI.prototype.applyToLocalDocumentSet=function(n){var r=this;this.mutations.forEach(function(t){var e=n.get(t.key),t=e;r.applyToLocalView(t),e.isValidDocument()||t.convertToNoDocument(Zy.min())})},LI.prototype.keys=function(){return this.mutations.reduce(function(t,e){return t.add(e.key)},Yw())},LI.prototype.isEqual=function(t){return this.batchId===t.batchId&&Xy(this.mutations,t.mutations,pw)&&Xy(this.baseMutations,t.baseMutations,pw)},LI),RI=(xI.from=function(t,e,n){Gy(t.mutations.length===n.length);for(var r=zw,i=t.mutations,o=0;o<i.length;o++)r=r.insert(i[o].key,n[o].version);return new xI(t,e,n,r)},xI),PI=(DI.prototype.withSequenceNumber=function(t){return new DI(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)},DI.prototype.withResumeToken=function(t,e){return new DI(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)},DI.prototype.withLastLimboFreeSnapshotVersion=function(t){return new DI(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)},DI),OI=function(t){this.Lt=t};function DI(t,e,n,r,i,o,s){void 0===i&&(i=Zy.min()),void 0===o&&(o=Zy.min()),void 0===s&&(s=lm.EMPTY_BYTE_STRING),this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s}function xI(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}function LI(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}function MI(t,e){if(e.document)return S_(t.Lt,e.document,!!e.hasCommittedMutations);if(e.noDocument){var n=Cm.fromSegments(e.noDocument.path),r=VI(e.noDocument.readTime),n=Bm.newNoDocument(n,r);return e.hasCommittedMutations?n.setHasCommittedMutations():n}if(e.unknownDocument){n=Cm.fromSegments(e.unknownDocument.path),r=VI(e.unknownDocument.version);return Bm.newUnknownDocument(n,r)}return Hy()}function FI(t,e,n){var r=UI(n),n=e.key.path.popLast().toArray();if(e.isFoundDocument()){var i={name:m_(o=t.Lt,(s=e).key),fields:s.data.toProto().mapValue.fields,updateTime:p_(o,s.version.toTimestamp())},o=e.hasCommittedMutations;return new Y_(null,null,i,o,r,n)}if(e.isNoDocument()){var s=e.key.path.toArray(),i=qI(e.version),o=e.hasCommittedMutations;return new Y_(null,new z_(s,i),null,o,r,n)}if(e.isUnknownDocument()){o=e.key.path.toArray(),e=qI(e.version);return new Y_(new Q_(o,e),null,null,!0,r,n)}return Hy()}function UI(t){t=t.toTimestamp();return[t.seconds,t.nanoseconds]}function jI(t){t=new $y(t[0],t[1]);return Zy.fromTimestamp(t)}function qI(t){t=t.toTimestamp();return new B_(t.seconds,t.nanoseconds)}function VI(t){t=new $y(t.seconds,t.nanoseconds);return Zy.fromTimestamp(t)}function BI(e,t){for(var n=(t.baseMutations||[]).map(function(t){return N_(e.Lt,t)}),r=0;r<t.mutations.length-1;++r){var i,o=t.mutations[r];r+1<t.mutations.length&&void 0!==t.mutations[r+1].transform&&(i=t.mutations[r+1],o.updateTransforms=i.transform.fieldTransforms,t.mutations.splice(r+1,1),++r)}var s=t.mutations.map(function(t){return N_(e.Lt,t)}),a=$y.fromMillis(t.localWriteTimeMs);return new kI(t.batchId,a,n,s)}function KI(t){var e=VI(t.readTime),n=void 0!==t.lastLimboFreeSnapshotVersion?VI(t.lastLimboFreeSnapshotVersion):Zy.min(),r=void 0!==t.query.documents?(Gy(1===(r=t.query).documents.length),xb(Nb(__(r.documents[0])))):xb(R_(t.query));return new PI(r,t.targetId,0,t.lastListenSequenceNumber,e,n,lm.fromBase64String(t.resumeToken))}function WI(t,e){var n=qI(e.snapshotVersion),r=qI(e.lastLimboFreeSnapshotVersion),i=(Qm(e.target)?A_:k_)(t.Lt,e.target),t=e.resumeToken.toBase64();return new J_(e.targetId,Gm(e.target),n,t,e.sequenceNumber,r,i)}function HI(t){var e=R_({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?Lb(e,e.limit,"L"):e}var GI=(zI.prototype.getBundleMetadata=function(t,e){return QI(t).get(e).next(function(t){if(t)return{id:(t=t).bundleId,createTime:VI(t.createTime),version:t.version}})},zI.prototype.saveBundleMetadata=function(t,e){return QI(t).put({bundleId:(e=e).id,createTime:qI(v_(e.createTime)),version:e.version})},zI.prototype.getNamedQuery=function(t,e){return YI(t).get(e).next(function(t){if(t)return{name:(t=t).name,query:HI(t.bundledQuery),readTime:VI(t.readTime)}})},zI.prototype.saveNamedQuery=function(t,e){return YI(t).put({name:(e=e).name,readTime:qI(v_(e.readTime)),bundledQuery:e.bundledQuery})},zI);function zI(){}function QI(t){return AI(t,nI.store)}function YI(t){return AI(t,rI.store)}var XI=(eT.prototype.addToCollectionParentIndex=function(t,e){return this.Bt.add(e),uI.resolve()},eT.prototype.getCollectionParents=function(t,e){return uI.resolve(this.Bt.getEntries(e))},eT),JI=(tT.prototype.add=function(t){var e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new Vw(am.comparator),t=!r.has(n);return this.index[e]=r.add(n),t},tT.prototype.has=function(t){var e=t.lastSegment(),t=t.popLast(),e=this.index[e];return e&&e.has(t)},tT.prototype.getEntries=function(t){return(this.index[t]||new Vw(am.comparator)).toArray()},tT),$I=(ZI.prototype.addToCollectionParentIndex=function(t,e){var n=this;if(this.qt.has(e))return uI.resolve();var r=e.lastSegment(),i=e.popLast();t.addOnCommittedListener(function(){n.qt.add(e)});i={collectionId:r,parent:U_(i)};return nT(t).put(i)},ZI.prototype.getCollectionParents=function(t,i){var o=[],e=IDBKeyRange.bound([i,""],[Jy(i),""],!1,!0);return nT(t).Nt(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(q_(r.parent))}return o})},ZI);function ZI(){this.qt=new JI}function tT(){this.index={}}function eT(){this.Bt=new JI}function nT(t){return AI(t,tI.store)}var rT={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},iT=(oT.withCacheSize=function(t){return new oT(t,oT.DEFAULT_COLLECTION_PERCENTILE,oT.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)},oT);function oT(t,e,n){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=e,this.maximumSequenceNumbersToCollect=n}function sT(t,e,n){var r=t.store(W_.store),i=t.store(H_.store),o=[],t=IDBKeyRange.only(n.batchId),s=0,t=r.Ot({range:t},function(t,e,n){return s++,n.delete()});o.push(t.next(function(){Gy(1===s)}));for(var a=[],u=0,c=n.mutations;u<c.length;u++){var h=c[u],l=H_.key(e,h.key.path,n.batchId);o.push(i.delete(l)),a.push(h.key)}return uI.waitFor(o).next(function(){return a})}function aT(t){if(!t)return 0;var e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw Hy();e=t.noDocument}return JSON.stringify(e).length}iT.DEFAULT_COLLECTION_PERCENTILE=10,iT.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,iT.DEFAULT=new iT(41943040,iT.DEFAULT_COLLECTION_PERCENTILE,iT.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),iT.DISABLED=new iT(-1,0,0);var uT=(cT.Kt=function(t,e,n,r){return Gy(""!==t.uid),new cT(t.isAuthenticated()?t.uid:"",e,n,r)},cT.prototype.checkEmpty=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return lT(t).Ot({index:W_.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},cT.prototype.addMutationBatch=function(d,v,g,y){var m=this,b=fT(d),w=lT(d);return w.add({}).next(function(t){Gy("number"==typeof t);for(var e,n,r,i,o,s=new kI(t,v,g,y),a=(e=m.R,n=m.userId,i=(r=s).baseMutations.map(function(t){return C_(e.Lt,t)}),o=r.mutations.map(function(t){return C_(e.Lt,t)}),new W_(n,r.batchId,r.localWriteTime.toMillis(),i,o)),u=[],c=new Vw(function(t,e){return Yy(t.canonicalString(),e.canonicalString())}),h=0,l=y;h<l.length;h++){var f=l[h],p=H_.key(m.userId,f.key.path,t),c=c.add(f.key.path.popLast());u.push(w.put(a)),u.push(b.put(p,H_.PLACEHOLDER))}return c.forEach(function(t){u.push(m.Ut.addToCollectionParentIndex(d,t))}),d.addOnCommittedListener(function(){m.Qt[t]=s.keys()}),uI.waitFor(u).next(function(){return s})})},cT.prototype.lookupMutationBatch=function(t,e){var n=this;return lT(t).get(e).next(function(t){return t?(Gy(t.userId===n.userId),BI(n.R,t)):null})},cT.prototype.jt=function(t,e){var n=this;return this.Qt[e]?uI.resolve(this.Qt[e]):this.lookupMutationBatch(t,e).next(function(t){if(t){t=t.keys();return n.Qt[e]=t}return null})},cT.prototype.getNextMutationBatchAfterBatchId=function(t,e){var r=this,i=e+1,e=IDBKeyRange.lowerBound([this.userId,i]),o=null;return lT(t).Ot({index:W_.userMutationsIndex,range:e},function(t,e,n){e.userId===r.userId&&(Gy(e.batchId>=i),o=BI(r.R,e)),n.done()}).next(function(){return o})},cT.prototype.getHighestUnacknowledgedBatchId=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return lT(t).Ot({index:W_.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},cT.prototype.getAllMutationBatches=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return lT(t).Nt(W_.userMutationsIndex,n).next(function(t){return t.map(function(t){return BI(e.R,t)})})},cT.prototype.getAllMutationBatchesAffectingDocumentKey=function(o,s){var a=this,t=H_.prefixForPath(this.userId,s.path),t=IDBKeyRange.lowerBound(t),u=[];return fT(o).Ot({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=q_(i);if(r===a.userId&&s.path.isEqual(i))return lT(o).get(t).next(function(t){if(!t)throw Hy();Gy(t.userId===a.userId),u.push(BI(a.R,t))});n.done()}).next(function(){return u})},cT.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,t){var s=this,a=new Vw(Yy),n=[];return t.forEach(function(o){var t=H_.prefixForPath(s.userId,o.path),t=IDBKeyRange.lowerBound(t),t=fT(e).Ot({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=q_(i);r===s.userId&&o.path.isEqual(i)?a=a.add(t):n.done()});n.push(t)}),uI.waitFor(n).next(function(){return s.Wt(e,a)})},cT.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var o=this,s=e.path,a=s.length+1,e=H_.prefixForPath(this.userId,s),e=IDBKeyRange.lowerBound(e),u=new Vw(Yy);return fT(t).Ot({range:e},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=q_(i);r===o.userId&&s.isPrefixOf(i)?i.length===a&&(u=u.add(t)):n.done()}).next(function(){return o.Wt(t,u)})},cT.prototype.Wt=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(lT(e).get(t).next(function(t){if(null===t)throw Hy();Gy(t.userId===n.userId),r.push(BI(n.R,t))}))}),uI.waitFor(i).next(function(){return r})},cT.prototype.removeMutationBatch=function(e,n){var r=this;return sT(e.Mt,this.userId,n).next(function(t){return e.addOnCommittedListener(function(){r.Gt(n.batchId)}),uI.forEach(t,function(t){return r.referenceDelegate.markPotentiallyOrphaned(e,t)})})},cT.prototype.Gt=function(t){delete this.Qt[t]},cT.prototype.performConsistencyCheck=function(e){var i=this;return this.checkEmpty(e).next(function(t){if(!t)return uI.resolve();var t=IDBKeyRange.lowerBound(H_.prefixForUser(i.userId)),r=[];return fT(e).Ot({range:t},function(t,e,n){t[0]===i.userId?(t=q_(t[1]),r.push(t)):n.done()}).next(function(){Gy(0===r.length)})})},cT.prototype.containsKey=function(t,e){return hT(t,this.userId,e)},cT.prototype.zt=function(t){var e=this;return pT(t).get(this.userId).next(function(t){return t||new K_(e.userId,-1,"")})},cT);function cT(t,e,n,r){this.userId=t,this.R=e,this.Ut=n,this.referenceDelegate=r,this.Qt={}}function hT(t,o,e){var e=H_.prefixForPath(o,e.path),s=e[1],e=IDBKeyRange.lowerBound(e),a=!1;return fT(t).Ot({range:e,kt:!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 lT(t){return AI(t,W_.store)}function fT(t){return AI(t,H_.store)}function pT(t){return AI(t,K_.store)}var dT=(yT.prototype.next=function(){return this.Ht+=2,this.Ht},yT.Jt=function(){return new yT(0)},yT.Yt=function(){return new yT(-1)},yT),vT=(gT.prototype.allocateTargetId=function(n){var r=this;return this.Xt(n).next(function(t){var e=new dT(t.highestTargetId);return t.highestTargetId=e.next(),r.Zt(n,t).next(function(){return t.highestTargetId})})},gT.prototype.getLastRemoteSnapshotVersion=function(t){return this.Xt(t).next(function(t){return Zy.fromTimestamp(new $y(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},gT.prototype.getHighestSequenceNumber=function(t){return this.Xt(t).next(function(t){return t.highestListenSequenceNumber})},gT.prototype.setTargetsMetadata=function(e,n,r){var i=this;return this.Xt(e).next(function(t){return t.highestListenSequenceNumber=n,r&&(t.lastRemoteSnapshotVersion=r.toTimestamp()),n>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.Zt(e,t)})},gT.prototype.addTargetData=function(e,n){var r=this;return this.te(e,n).next(function(){return r.Xt(e).next(function(t){return t.targetCount+=1,r.ee(n,t),r.Zt(e,t)})})},gT.prototype.updateTargetData=function(t,e){return this.te(t,e)},gT.prototype.removeTargetData=function(e,t){var n=this;return this.removeMatchingKeysForTargetId(e,t.targetId).next(function(){return mT(e).delete(t.targetId)}).next(function(){return n.Xt(e)}).next(function(t){return Gy(0<t.targetCount),--t.targetCount,n.Zt(e,t)})},gT.prototype.removeTargets=function(n,r,i){var o=this,s=0,a=[];return mT(n).Ot(function(t,e){e=KI(e);e.sequenceNumber<=r&&null===i.get(e.targetId)&&(s++,a.push(o.removeTargetData(n,e)))}).next(function(){return uI.waitFor(a)}).next(function(){return s})},gT.prototype.forEachTarget=function(t,n){return mT(t).Ot(function(t,e){e=KI(e);n(e)})},gT.prototype.Xt=function(t){return bT(t).get(Z_.key).next(function(t){return Gy(null!==t),t})},gT.prototype.Zt=function(t,e){return bT(t).put(Z_.key,e)},gT.prototype.te=function(t,e){return mT(t).put(WI(this.R,e))},gT.prototype.ee=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},gT.prototype.getTargetCount=function(t){return this.Xt(t).next(function(t){return t.targetCount})},gT.prototype.getTargetData=function(t,r){var e=Gm(r),e=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),i=null;return mT(t).Ot({range:e,index:J_.queryTargetsIndexName},function(t,e,n){e=KI(e);zm(r,e.target)&&(i=e,n.done())}).next(function(){return i})},gT.prototype.addMatchingKeys=function(n,t,r){var i=this,o=[],s=wT(n);return t.forEach(function(t){var e=U_(t.path);o.push(s.put(new $_(r,e))),o.push(i.referenceDelegate.addReference(n,r,t))}),uI.waitFor(o)},gT.prototype.removeMatchingKeys=function(n,t,r){var i=this,o=wT(n);return uI.forEach(t,function(t){var e=U_(t.path);return uI.waitFor([o.delete([r,e]),i.referenceDelegate.removeReference(n,r,t)])})},gT.prototype.removeMatchingKeysForTargetId=function(t,e){t=wT(t),e=IDBKeyRange.bound([e],[e+1],!1,!0);return t.delete(e)},gT.prototype.getMatchingKeysForTargetId=function(t,e){var e=IDBKeyRange.bound([e],[e+1],!1,!0),t=wT(t),r=Yw();return t.Ot({range:e,kt:!0},function(t,e,n){t=q_(t[1]),t=new Cm(t);r=r.add(t)}).next(function(){return r})},gT.prototype.containsKey=function(t,e){var e=U_(e.path),e=IDBKeyRange.bound([e],[Jy(e)],!1,!0),i=0;return wT(t).Ot({index:$_.documentTargetsIndex,kt:!0,range:e},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0<i})},gT.prototype.lt=function(t,e){return mT(t).get(e).next(function(t){return t?KI(t):null})},gT);function gT(t,e){this.referenceDelegate=t,this.R=e}function yT(t){this.Ht=t}function mT(t){return AI(t,J_.store)}function bT(t){return AI(t,Z_.store)}function wT(t){return AI(t,$_.store)}function _T(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){if(e.code!==My.FAILED_PRECONDITION||e.message!==sI)throw e;return Vy("LocalStore","Unexpectedly lost primary lease"),[2]})})}function IT(t,e){var n=t[0],r=t[1],t=e[0],e=e[1],t=Yy(n,t);return 0===t?Yy(r,e):t}var TT=(RT.prototype.ie=function(){return++this.se},RT.prototype.re=function(t){var e=[t,this.ie()];this.buffer.size<this.ne?this.buffer=this.buffer.add(e):IT(e,t=this.buffer.last())<0&&(this.buffer=this.buffer.delete(t).add(e))},Object.defineProperty(RT.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!1,configurable:!0}),RT),ET=(kT.prototype.start=function(t){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.ue(t)},kT.prototype.stop=function(){this.ce&&(this.ce.cancel(),this.ce=null)},Object.defineProperty(kT.prototype,"started",{get:function(){return null!==this.ce},enumerable:!1,configurable:!0}),kT.prototype.ue=function(n){var t=this,e=this.oe?3e5:6e4;Vy("LruGarbageCollector","Garbage collection scheduled in "+e+"ms"),this.ce=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:this.ce=null,this.oe=!0,t.label=1;case 1:return t.trys.push([1,3,,7]),[4,n.collectGarbage(this.garbageCollector)];case 2:return t.sent(),[3,7];case 3:return bI(e=t.sent())?(Vy("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",e),[3,6]):[3,4];case 4:return[4,_T(e)];case 5:t.sent(),t.label=6;case 6:return[3,7];case 7:return[4,this.ue(n)];case 8:return t.sent(),[2]}})})})},kT),ST=(AT.prototype.calculateTargetCount=function(t,e){return this.ae.he(t).next(function(t){return Math.floor(e/100*t)})},AT.prototype.nthSequenceNumber=function(t,e){var n=this;if(0===e)return uI.resolve(Dy.o);var r=new TT(e);return this.ae.forEachTarget(t,function(t){return r.re(t.sequenceNumber)}).next(function(){return n.ae.le(t,function(t){return r.re(t)})}).next(function(){return r.maxValue})},AT.prototype.removeTargets=function(t,e,n){return this.ae.removeTargets(t,e,n)},AT.prototype.removeOrphanedDocuments=function(t,e){return this.ae.removeOrphanedDocuments(t,e)},AT.prototype.collect=function(e,n){var r=this;return-1===this.params.cacheSizeCollectionThreshold?(Vy("LruGarbageCollector","Garbage collection skipped; disabled"),uI.resolve(rT)):this.getCacheSize(e).next(function(t){return t<r.params.cacheSizeCollectionThreshold?(Vy("LruGarbageCollector","Garbage collection skipped; Cache size "+t+" is lower than threshold "+r.params.cacheSizeCollectionThreshold),rT):r.fe(e,n)})},AT.prototype.getCacheSize=function(t){return this.ae.getCacheSize(t)},AT.prototype.fe=function(e,n){var r,i,o,s,a,u,c,h=this,l=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(function(t){return i=t>h.params.maximumSequenceNumbersToCollect?(Vy("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.maximumSequenceNumbersToCollect+" from "+t),h.params.maximumSequenceNumbersToCollect):t,s=Date.now(),h.nthSequenceNumber(e,i)}).next(function(t){return r=t,a=Date.now(),h.removeTargets(e,r,n)}).next(function(t){return o=t,u=Date.now(),h.removeOrphanedDocuments(e,r)}).next(function(t){return c=Date.now(),qy()<=as.DEBUG&&Vy("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"),uI.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:o,documentsRemoved:t})})},AT),CT=(NT.prototype.he=function(t){var n=this.de(t);return this.db.getTargetCache().getTargetCount(t).next(function(e){return n.next(function(t){return e+t})})},NT.prototype.de=function(t){var e=0;return this.le(t,function(t){e++}).next(function(){return e})},NT.prototype.forEachTarget=function(t,e){return this.db.getTargetCache().forEachTarget(t,e)},NT.prototype.le=function(t,n){return this.we(t,function(t,e){return n(e)})},NT.prototype.addReference=function(t,e,n){return PT(t,n)},NT.prototype.removeReference=function(t,e,n){return PT(t,n)},NT.prototype.removeTargets=function(t,e,n){return this.db.getTargetCache().removeTargets(t,e,n)},NT.prototype.markPotentiallyOrphaned=PT,NT.prototype._e=function(t,e){return r=e,i=!1,pT(n=t).$t(function(t){return hT(n,t,r).next(function(t){return t&&(i=!0),uI.resolve(!t)})}).next(function(){return i});var n,r,i},NT.prototype.removeOrphanedDocuments=function(n,r){var i=this,o=this.db.getRemoteDocumentCache().newChangeBuffer(),s=[],a=0;return this.we(n,function(e,t){t<=r&&(t=i._e(n,e).next(function(t){if(!t)return a++,o.getEntry(n,e).next(function(){return o.removeEntry(e),wT(n).delete([0,U_(e.path)])})}),s.push(t))}).next(function(){return uI.waitFor(s)}).next(function(){return o.apply(n)}).next(function(){return a})},NT.prototype.removeTarget=function(t,e){e=e.withSequenceNumber(t.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(t,e)},NT.prototype.updateLimboDocument=PT,NT.prototype.we=function(t,r){var i,t=wT(t),o=Dy.o;return t.Ot({index:$_.documentTargetsIndex},function(t,e){var n=t[0],t=(t[1],e.path),e=e.sequenceNumber;0===n?(o!==Dy.o&&r(new Cm(q_(i)),o),o=e,i=t):o=Dy.o}).next(function(){o!==Dy.o&&r(new Cm(q_(i)),o)})},NT.prototype.getCacheSize=function(t){return this.db.getRemoteDocumentCache().getSize(t)},NT);function NT(t,e){this.db=t,this.garbageCollector=new ST(this,e)}function AT(t,e){this.ae=t,this.params=e}function kT(t,e){this.garbageCollector=t,this.asyncQueue=e,this.oe=!1,this.ce=null}function RT(t){this.ne=t,this.buffer=new Vw(IT),this.se=0}function PT(t,e){return wT(t).put((t=t.currentSequenceNumber,new $_(0,U_(e.path),t)))}var OT,DT=(jT.prototype.get=function(t){var e=this.mapKeyFn(t),e=this.inner[e];if(void 0!==e)for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],i=i[1];if(this.equalsFn(o,t))return i}},jT.prototype.has=function(t){return void 0!==this.get(t)},jT.prototype.set=function(t,e){var n=this.mapKeyFn(t),r=this.inner[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(this.equalsFn(r[i][0],t))return void(r[i]=[t,e]);r.push([t,e])}else this.inner[n]=[[t,e]]},jT.prototype.delete=function(t){var e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.equalsFn(n[r][0],t))return 1===n.length?delete this.inner[e]:n.splice(r,1),!0;return!1},jT.prototype.forEach=function(s){rm(this.inner,function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],i=i[1];s(o,i)}})},jT.prototype.isEmpty=function(){return im(this.inner)},jT),Sn=(UT.prototype.getReadTime=function(t){t=this.changes.get(t);return t?t.readTime:Zy.min()},UT.prototype.addEntry=function(t,e){this.assertNotApplied(),this.changes.set(t.key,{document:t,readTime:e})},UT.prototype.removeEntry=function(t,e){void 0===e&&(e=null),this.assertNotApplied(),this.changes.set(t,{document:Bm.newInvalidDocument(t),readTime:e})},UT.prototype.getEntry=function(t,e){this.assertNotApplied();var n=this.changes.get(e);return void 0!==n?uI.resolve(n.document):this.getFromCache(t,e)},UT.prototype.getEntries=function(t,e){return this.getAllFromCache(t,e)},UT.prototype.apply=function(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)},UT.prototype.assertNotApplied=function(){},UT),xT=(FT.prototype.addEntry=function(t,e,n){return VT(t).put(BT(e),n)},FT.prototype.removeEntry=function(t,e){t=VT(t),e=BT(e);return t.delete(e)},FT.prototype.updateMetadata=function(e,n){var r=this;return this.getMetadata(e).next(function(t){return t.byteSize+=n,r.me(e,t)})},FT.prototype.getEntry=function(t,e){var n=this;return VT(t).get(BT(e)).next(function(t){return n.ye(e,t)})},FT.prototype.ge=function(t,e){var n=this;return VT(t).get(BT(e)).next(function(t){return{document:n.ye(e,t),size:aT(t)}})},FT.prototype.getEntries=function(t,e){var n=this,r=Kw;return this.pe(t,e,function(t,e){e=n.ye(t,e);r=r.insert(t,e)}).next(function(){return r})},FT.prototype.Ee=function(t,e){var r=this,i=Kw,o=new xw(Cm.comparator);return this.pe(t,e,function(t,e){var n=r.ye(t,e);i=i.insert(t,n),o=o.insert(t,aT(e))}).next(function(){return{documents:i,Te:o}})},FT.prototype.pe=function(t,e,i){if(e.isEmpty())return uI.resolve();var n=IDBKeyRange.bound(e.first().path.toArray(),e.last().path.toArray()),o=e.getIterator(),s=o.getNext();return VT(t).Ot({range:n},function(t,e,n){for(var r=Cm.fromSegments(t);s&&Cm.comparator(s,r)<0;)i(s,null),s=o.getNext();s&&s.isEqual(r)&&(i(s,e),s=o.hasNext()?o.getNext():null),s?n.Ct(s.path.toArray()):n.done()}).next(function(){for(;s;)i(s,null),s=o.hasNext()?o.getNext():null})},FT.prototype.getDocumentsMatchingQuery=function(t,r,e){var n,i=this,o=Kw,s=r.path.length+1,a={};return e.isEqual(Zy.min())?(n=r.path.toArray(),a.range=IDBKeyRange.lowerBound(n)):(n=r.path.toArray(),e=UI(e),a.range=IDBKeyRange.lowerBound([n,e],!0),a.index=Y_.collectionReadTimeIndex),VT(t).Ot(a,function(t,e,n){t.length===s&&(e=MI(i.R,e),r.path.isPrefixOf(e.key.path)?jb(r,e)&&(o=o.insert(e.key,e)):n.done())}).next(function(){return o})},FT.prototype.newChangeBuffer=function(t){return new LT(this,!!t&&t.trackRemovals)},FT.prototype.getSize=function(t){return this.getMetadata(t).next(function(t){return t.byteSize})},FT.prototype.getMetadata=function(t){return qT(t).get(X_.key).next(function(t){return Gy(!!t),t})},FT.prototype.me=function(t,e){return qT(t).put(X_.key,e)},FT.prototype.ye=function(t,e){if(e){e=MI(this.R,e);if(!e.isNoDocument()||!e.version.isEqual(Zy.min()))return e}return Bm.newInvalidDocument(t)},FT),LT=(Xi(MT,OT=Sn),MT.prototype.applyChanges=function(i){var o=this,s=[],a=0,u=new Vw(function(t,e){return Yy(t.canonicalString(),e.canonicalString())});return this.changes.forEach(function(t,e){var n,r=o.Ae.get(t);e.document.isValidDocument()?(n=FI(o.Ie.R,e.document,o.getReadTime(t)),u=u.add(t.path.popLast()),e=aT(n),a+=e-r,s.push(o.Ie.addEntry(i,t,n))):(a-=r,o.trackRemovals?(r=FI(o.Ie.R,Bm.newNoDocument(t,Zy.min()),o.getReadTime(t)),s.push(o.Ie.addEntry(i,t,r))):s.push(o.Ie.removeEntry(i,t)))}),u.forEach(function(t){s.push(o.Ie.Ut.addToCollectionParentIndex(i,t))}),s.push(this.Ie.updateMetadata(i,a)),uI.waitFor(s)},MT.prototype.getFromCache=function(t,e){var n=this;return this.Ie.ge(t,e).next(function(t){return n.Ae.set(e,t.size),t.document})},MT.prototype.getAllFromCache=function(t,e){var n=this;return this.Ie.Ee(t,e).next(function(t){var e=t.documents;return t.Te.forEach(function(t,e){n.Ae.set(t,e)}),e})},MT);function MT(t,e){var n=this;return(n=OT.call(this)||this).Ie=t,n.trackRemovals=e,n.Ae=new DT(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),n}function FT(t,e){this.R=t,this.Ut=e}function UT(){this.changes=new DT(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),this.changesApplied=!1}function jT(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={}}function qT(t){return AI(t,X_.store)}function VT(t){return AI(t,Y_.store)}function BT(t){return t.path.toArray()}var KT=(WT.prototype.Rt=function(e,n,t,r){var i=this;Gy(t<r&&0<=t&&r<=11);var o=new cI("createOrUpgrade",n);t<1&&1<=r&&(e.createObjectStore(V_.store),(s=e).createObjectStore(K_.store,{keyPath:K_.keyPath}),s.createObjectStore(W_.store,{keyPath:W_.keyPath,autoIncrement:!0}).createIndex(W_.userMutationsIndex,W_.userMutationsKeyPath,{unique:!0}),s.createObjectStore(H_.store),HT(e),e.createObjectStore(Y_.store));var s,a=uI.resolve();return t<3&&3<=r&&(0!==t&&((s=e).deleteObjectStore($_.store),s.deleteObjectStore(J_.store),s.deleteObjectStore(Z_.store),HT(e)),a=a.next(function(){return t=o.store(Z_.store),e=new Z_(0,0,Zy.min().toTimestamp(),0),t.put(Z_.key,e);var t,e})),t<4&&4<=r&&(a=(a=0!==t?a.next(function(){return n=e,(r=o).store(W_.store).Nt().next(function(t){n.deleteObjectStore(W_.store),n.createObjectStore(W_.store,{keyPath:W_.keyPath,autoIncrement:!0}).createIndex(W_.userMutationsIndex,W_.userMutationsKeyPath,{unique:!0});var e=r.store(W_.store),t=t.map(function(t){return e.put(t)});return uI.waitFor(t)});var n,r}):a).next(function(){e.createObjectStore(eI.store,{keyPath:eI.keyPath})})),t<5&&5<=r&&(a=a.next(function(){return i.Re(o)})),t<6&&6<=r&&(a=a.next(function(){return e.createObjectStore(X_.store),i.be(o)})),t<7&&7<=r&&(a=a.next(function(){return i.ve(o)})),t<8&&8<=r&&(a=a.next(function(){return i.Pe(e,o)})),t<9&&9<=r&&(a=a.next(function(){var t;(t=e).objectStoreNames.contains("remoteDocumentChanges")&&t.deleteObjectStore("remoteDocumentChanges"),(t=n.objectStore(Y_.store)).createIndex(Y_.readTimeIndex,Y_.readTimeIndexPath,{unique:!1}),t.createIndex(Y_.collectionReadTimeIndex,Y_.collectionReadTimeIndexPath,{unique:!1})})),t<10&&10<=r&&(a=a.next(function(){return i.Ve(o)})),a=t<11&&11<=r?a.next(function(){e.createObjectStore(nI.store,{keyPath:nI.keyPath}),e.createObjectStore(rI.store,{keyPath:rI.keyPath})}):a},WT.prototype.be=function(e){var n=0;return e.store(Y_.store).Ot(function(t,e){n+=aT(e)}).next(function(){var t=new X_(n);return e.store(X_.store).put(X_.key,t)})},WT.prototype.Re=function(n){var r=this,t=n.store(K_.store),i=n.store(W_.store);return t.Nt().next(function(t){return uI.forEach(t,function(e){var t=IDBKeyRange.bound([e.userId,-1],[e.userId,e.lastAcknowledgedBatchId]);return i.Nt(W_.userMutationsIndex,t).next(function(t){return uI.forEach(t,function(t){Gy(t.userId===e.userId);t=BI(r.R,t);return sT(n,e.userId,t).next(function(){})})})})})},WT.prototype.ve=function(t){var o=t.store($_.store),e=t.store(Y_.store);return t.store(Z_.store).get(Z_.key).next(function(r){var i=[];return e.Ot(function(t,e){var n=new am(t),t=[0,U_(n)];i.push(o.get(t).next(function(t){return t?uI.resolve():o.put(new $_(0,U_(n),r.highestListenSequenceNumber))}))}).next(function(){return uI.waitFor(i)})})},WT.prototype.Pe=function(t,e){t.createObjectStore(tI.store,{keyPath:tI.keyPath});function r(t){if(i.add(t)){var e=t.lastSegment(),t=t.popLast();return n.put({collectionId:e,parent:U_(t)})}}var n=e.store(tI.store),i=new JI;return e.store(Y_.store).Ot({kt:!0},function(t,e){t=new am(t);return r(t.popLast())}).next(function(){return e.store(H_.store).Ot({kt:!0},function(t,e){t[0];var n=t[1],n=(t[2],q_(n));return r(n.popLast())})})},WT.prototype.Ve=function(t){var n=this,r=t.store(J_.store);return r.Ot(function(t,e){e=KI(e),e=WI(n.R,e);return r.put(e)})},WT);function WT(t){this.R=t}function HT(t){t.createObjectStore($_.store,{keyPath:$_.keyPath}).createIndex($_.documentTargetsIndex,$_.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(J_.store,{keyPath:J_.keyPath}).createIndex(J_.queryTargetsIndexName,J_.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(Z_.store)}var GT="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",zT=(QT.prototype.start=function(){var e=this;return this.je().then(function(){if(!e.isPrimary&&!e.allowTabSynchronization)throw new Fy(My.FAILED_PRECONDITION,GT);return e.We(),e.Ge(),e.ze(),e.runTransaction("getHighestListenSequenceNumber","readonly",function(t){return e.qe.getHighestSequenceNumber(t)})}).then(function(t){e.Ne=new Dy(t,e.De)}).then(function(){e.xe=!0}).catch(function(t){return e.Be&&e.Be.close(),Promise.reject(t)})},QT.prototype.He=function(n){var t=this;return this.Me=function(e){return $i(t,void 0,void 0,function(){return Zi(this,function(t){return this.started?[2,n(e)]:[2]})})},n(this.isPrimary)},QT.prototype.setDatabaseDeletedListener=function(n){var t=this;this.Be.vt(function(e){return $i(t,void 0,void 0,function(){return Zi(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]}})})})},QT.prototype.setNetworkEnabled=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.Se.enqueueAndForget(function(){return $i(e,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.started?[4,this.je()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},QT.prototype.je=function(){var n=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",function(e){return XT(e).put(new eI(n.clientId,Date.now(),n.networkEnabled,n.inForeground)).next(function(){if(n.isPrimary)return n.Je(e).next(function(t){t||(n.isPrimary=!1,n.Se.enqueueRetryable(function(){return n.Me(!1)}))})}).next(function(){return n.Ye(e)}).next(function(t){return n.isPrimary&&!t?n.Xe(e).next(function(){return!1}):!!t&&n.Ze(e).next(function(){return!0})})}).catch(function(t){if(bI(t))return Vy("IndexedDbPersistence","Failed to extend owner lease: ",t),n.isPrimary;if(!n.allowTabSynchronization)throw t;return Vy("IndexedDbPersistence","Releasing owner lease after error during lease refresh",t),!1}).then(function(t){n.isPrimary!==t&&n.Se.enqueueRetryable(function(){return n.Me(t)}),n.isPrimary=t})},QT.prototype.Je=function(t){var e=this;return YT(t).get(V_.key).next(function(t){return uI.resolve(e.tn(t))})},QT.prototype.en=function(t){return XT(t).delete(this.clientId)},QT.prototype.nn=function(){return $i(this,void 0,void 0,function(){var e,n,r,i,o=this;return Zi(this,function(t){switch(t.label){case 0:return!this.isPrimary||this.sn(this.$e,18e5)?[3,2]:(this.$e=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(t){var r=AI(t,eI.store);return r.Nt().next(function(t){var e=o.rn(t,18e5),n=t.filter(function(t){return-1===e.indexOf(t)});return uI.forEach(n,function(t){return r.delete(t.clientId)}).next(function(){return n})})}).catch(function(){return[]})]);case 1:if(e=t.sent(),this.Ke)for(n=0,r=e;n<r.length;n++)i=r[n],this.Ke.removeItem(this.on(i.clientId));t.label=2;case 2:return[2]}})})},QT.prototype.ze=function(){var t=this;this.Oe=this.Se.enqueueAfterDelay("client_metadata_refresh",4e3,function(){return t.je().then(function(){return t.nn()}).then(function(){return t.ze()})})},QT.prototype.tn=function(t){return!!t&&t.ownerId===this.clientId},QT.prototype.Ye=function(e){var r=this;return this.Ce?uI.resolve(!0):YT(e).get(V_.key).next(function(t){if(null!==t&&r.sn(t.leaseTimestampMs,5e3)&&!r.cn(t.ownerId)){if(r.tn(t)&&r.networkEnabled)return!0;if(!r.tn(t)){if(!t.allowTabSynchronization)throw new Fy(My.FAILED_PRECONDITION,GT);return!1}}return!(!r.networkEnabled||!r.inForeground)||XT(e).Nt().next(function(t){return void 0===r.rn(t,5e3).find(function(t){if(r.clientId!==t.clientId){var e=!r.networkEnabled&&t.networkEnabled,n=!r.inForeground&&t.inForeground,t=r.networkEnabled===t.networkEnabled;if(e||n&&t)return!0}return!1})})}).next(function(t){return r.isPrimary!==t&&Vy("IndexedDbPersistence","Client "+(t?"is":"is not")+" eligible for a primary lease."),t})},QT.prototype.shutdown=function(){return $i(this,void 0,void 0,function(){var n=this;return Zi(this,function(t){switch(t.label){case 0:return this.xe=!1,this.un(),this.Oe&&(this.Oe.cancel(),this.Oe=null),this.an(),this.hn(),[4,this.Be.runTransaction("shutdown","readwrite",[V_.store,eI.store],function(t){var e=new CI(t,Dy.o);return n.Xe(e).next(function(){return n.en(e)})})];case 1:return t.sent(),this.Be.close(),this.ln(),[2]}})})},QT.prototype.rn=function(t,e){var n=this;return t.filter(function(t){return n.sn(t.updateTimeMs,e)&&!n.cn(t.clientId)})},QT.prototype.fn=function(){var e=this;return this.runTransaction("getActiveClients","readonly",function(t){return XT(t).Nt().next(function(t){return e.rn(t,18e5).map(function(t){return t.clientId})})})},Object.defineProperty(QT.prototype,"started",{get:function(){return this.xe},enumerable:!1,configurable:!0}),QT.prototype.getMutationQueue=function(t){return uT.Kt(t,this.R,this.Ut,this.referenceDelegate)},QT.prototype.getTargetCache=function(){return this.qe},QT.prototype.getRemoteDocumentCache=function(){return this.Ue},QT.prototype.getIndexManager=function(){return this.Ut},QT.prototype.getBundleCache=function(){return this.Qe},QT.prototype.runTransaction=function(e,n,r){var i=this;Vy("IndexedDbPersistence","Starting transaction:",e);var o,t="readonly"===n?"readonly":"readwrite";return this.Be.runTransaction(e,t,oI,function(t){return o=new CI(t,i.Ne?i.Ne.next():Dy.o),"readwrite-primary"===n?i.Je(o).next(function(t){return!!t||i.Ye(o)}).next(function(t){if(!t)throw By("Failed to obtain primary lease for action '"+e+"'."),i.isPrimary=!1,i.Se.enqueueRetryable(function(){return i.Me(!1)}),new Fy(My.FAILED_PRECONDITION,sI);return r(o)}).next(function(t){return i.Ze(o).next(function(){return t})}):i.dn(o).next(function(){return r(o)})}).then(function(t){return o.raiseOnCommittedEvent(),t})},QT.prototype.dn=function(t){var e=this;return YT(t).get(V_.key).next(function(t){if(null!==t&&e.sn(t.leaseTimestampMs,5e3)&&!e.cn(t.ownerId)&&!e.tn(t)&&!(e.Ce||e.allowTabSynchronization&&t.allowTabSynchronization))throw new Fy(My.FAILED_PRECONDITION,GT)})},QT.prototype.Ze=function(t){var e=new V_(this.clientId,this.allowTabSynchronization,Date.now());return YT(t).put(V_.key,e)},QT.yt=function(){return hI.yt()},QT.prototype.Xe=function(t){var e=this,n=YT(t);return n.get(V_.key).next(function(t){return e.tn(t)?(Vy("IndexedDbPersistence","Releasing primary lease."),n.delete(V_.key)):uI.resolve()})},QT.prototype.sn=function(t,e){var n=Date.now();return!(t<n-e||n<t&&(By("Detected an update time that is in the future: "+t+" > "+n),1))},QT.prototype.We=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.ke=function(){t.Se.enqueueAndForget(function(){return t.inForeground="visible"===t.document.visibilityState,t.je()})},this.document.addEventListener("visibilitychange",this.ke),this.inForeground="visible"===this.document.visibilityState)},QT.prototype.an=function(){this.ke&&(this.document.removeEventListener("visibilitychange",this.ke),this.ke=null)},QT.prototype.Ge=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.Fe=function(){e.un(),e.Se.enqueueAndForget(function(){return e.shutdown()})},this.window.addEventListener("unload",this.Fe))},QT.prototype.hn=function(){this.Fe&&(this.window.removeEventListener("unload",this.Fe),this.Fe=null)},QT.prototype.cn=function(t){try{var e=null!==(null===(e=this.Ke)||void 0===e?void 0:e.getItem(this.on(t)));return Vy("IndexedDbPersistence","Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(t){return By("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},QT.prototype.un=function(){if(this.Ke)try{this.Ke.setItem(this.on(this.clientId),String(Date.now()))}catch(t){By("Failed to set zombie client id.",t)}},QT.prototype.ln=function(){if(this.Ke)try{this.Ke.removeItem(this.on(this.clientId))}catch(t){}},QT.prototype.on=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},QT);function QT(t,e,n,r,i,o,s,a,u,c){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.Se=i,this.window=o,this.document=s,this.De=u,this.Ce=c,this.Ne=null,this.xe=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Fe=null,this.inForeground=!1,this.ke=null,this.Oe=null,this.$e=Number.NEGATIVE_INFINITY,this.Me=function(t){return Promise.resolve()},!QT.yt())throw new Fy(My.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new CT(this,r),this.Le=e+"main",this.R=new OI(a),this.Be=new hI(this.Le,11,new KT(this.R)),this.qe=new vT(this.referenceDelegate,this.R),this.Ut=new $I,this.Ue=(e=this.R,a=this.Ut,new xT(e,a)),this.Qe=new GI,this.window&&this.window.localStorage?this.Ke=this.window.localStorage:(this.Ke=null,!1===c&&By("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}function YT(t){return AI(t,V_.store)}function XT(t){return AI(t,eI.store)}function JT(t,e){var n=t.projectId;return t.isDefaultDatabase||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}function $T(t,e){this.progress=t,this.wn=e}var ZT=(sE.prototype.mn=function(e,n){var r=this;return this._n.getAllMutationBatchesAffectingDocumentKey(e,n).next(function(t){return r.yn(e,n,t)})},sE.prototype.yn=function(t,e,r){return this.Ue.getEntry(t,e).next(function(t){for(var e=0,n=r;e<n.length;e++)n[e].applyToLocalView(t);return t})},sE.prototype.gn=function(t,i){t.forEach(function(t,e){for(var n=0,r=i;n<r.length;n++)r[n].applyToLocalView(e)})},sE.prototype.pn=function(e,t){var n=this;return this.Ue.getEntries(e,t).next(function(t){return n.En(e,t).next(function(){return t})})},sE.prototype.En=function(t,e){var n=this;return this._n.getAllMutationBatchesAffectingDocumentKeys(t,e).next(function(t){return n.gn(e,t)})},sE.prototype.getDocumentsMatchingQuery=function(t,e,n){return r=e,Cm.isDocumentKey(r.path)&&null===r.collectionGroup&&0===r.filters.length?this.Tn(t,e.path):Ob(e)?this.In(t,e,n):this.An(t,e,n);var r},sE.prototype.Tn=function(t,e){return this.mn(t,new Cm(e)).next(function(t){var e=Gw;return e=t.isFoundDocument()?e.insert(t.key,t):e})},sE.prototype.In=function(n,r,i){var o=this,s=r.collectionGroup,a=Gw;return this.Ut.getCollectionParents(n,s).next(function(t){return uI.forEach(t,function(t){var e,e=(e=r,t=t.child(s),new Sb(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt));return o.An(n,e,i).next(function(t){t.forEach(function(t,e){a=a.insert(t,e)})})}).next(function(){return a})})},sE.prototype.An=function(e,n,t){var c,h,r=this;return this.Ue.getDocumentsMatchingQuery(e,n,t).next(function(t){return c=t,r._n.getAllMutationBatchesAffectingQuery(e,n)}).next(function(t){return h=t,r.Rn(e,h,c).next(function(t){c=t;for(var e=0,n=h;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=c.get(a);null==u&&(u=Bm.newInvalidDocument(a),c=c.insert(a,u)),fw(s,u,r.localWriteTime),u.isFoundDocument()||(c=c.remove(a))}})}).next(function(){return c.forEach(function(t,e){jb(n,e)||(c=c.remove(t))}),c})},sE.prototype.Rn=function(t,e,n){for(var r=Yw(),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 mw&&null===n.get(u.key)&&(r=r.add(u.key))}var c=n;return this.Ue.getEntries(t,r).next(function(t){return t.forEach(function(t,e){e.isFoundDocument()&&(c=c.insert(t,e))}),c})},sE),tE=(oE.Pn=function(t,e){for(var n=Yw(),r=Yw(),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 oE(t,e.fromCache,n,r)},oE),eE=(iE.prototype.Vn=function(t){this.Sn=t},iE.prototype.getDocumentsMatchingQuery=function(e,r,i,o){var s=this;return 0===r.filters.length&&null===r.limit&&null==r.startAt&&null==r.endAt&&(0===r.explicitOrderBy.length||1===r.explicitOrderBy.length&&r.explicitOrderBy[0].field.isKeyField())||i.isEqual(Zy.min())?this.Dn(e,r):this.Sn.pn(e,o).next(function(t){var n=s.Cn(r,t);return(Ab(r)||kb(r))&&s.Nn(r.limitType,n,o,i)?s.Dn(e,r):(qy()<=as.DEBUG&&Vy("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),Ub(r)),s.Sn.getDocumentsMatchingQuery(e,r,i).next(function(e){return n.forEach(function(t){e=e.insert(t.key,t)}),e}))})},iE.prototype.Cn=function(n,t){var r=new Vw(qb(n));return t.forEach(function(t,e){jb(n,e)&&(r=r.add(e))}),r},iE.prototype.Nn=function(t,e,n,r){if(n.size!==e.size)return!0;e="F"===t?e.last():e.first();return!!e&&(e.hasPendingWrites||0<e.version.compareTo(r))},iE.prototype.Dn=function(t,e){return qy()<=as.DEBUG&&Vy("QueryEngine","Using full collection scan to execute query:",Ub(e)),this.Sn.getDocumentsMatchingQuery(t,e,Zy.min())},iE),nE=(rE.prototype.collectGarbage=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(t){return e.collect(t,n.Fn)})},rE);function rE(t,e,n,r){this.persistence=t,this.xn=e,this.R=r,this.Fn=new xw(Yy),this.kn=new DT(Gm,zm),this.On=Zy.min(),this._n=t.getMutationQueue(n),this.$n=t.getRemoteDocumentCache(),this.qe=t.getTargetCache(),this.Mn=new ZT(this.$n,this._n,this.persistence.getIndexManager()),this.Qe=t.getBundleCache(),this.xn.Vn(this.Mn)}function iE(){}function oE(t,e,n,r){this.targetId=t,this.fromCache=e,this.bn=n,this.vn=r}function sE(t,e,n){this.Ue=t,this._n=e,this.Ut=n}function aE(t,e,n,r){return new nE(t,e,n,r)}function uE(i,o){return $i(this,void 0,void 0,function(){var e,n,m,r;return Zi(this,function(t){switch(t.label){case 0:return n=(e=i)._n,m=e.Mn,[4,e.persistence.runTransaction("Handle user change","readonly",function(g){var y;return e._n.getAllMutationBatches(g).next(function(t){return y=t,n=e.persistence.getMutationQueue(o),m=new ZT(e.$n,n,e.persistence.getIndexManager()),n.getAllMutationBatches(g)}).next(function(t){for(var e=[],n=[],r=Yw(),i=0,o=y;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.pn(g,r).next(function(t){return{Ln:t,removedBatchIds:e,addedBatchIds:n}})})})];case 1:return r=t.sent(),[2,(e._n=n,e.Mn=m,e.xn.Vn(e.Mn),r)]}})})}function cE(t,h){var l=t;return l.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(t){var e,r,i,o,s,n,a,u=h.batch.keys(),c=l.$n.newChangeBuffer({trackRemovals:!0});return e=l,r=t,o=c,s=(i=h).batch,n=s.keys(),a=uI.resolve(),n.forEach(function(n){a=a.next(function(){return o.getEntry(r,n)}).next(function(t){var e=i.docVersions.get(n);Gy(null!==e),t.version.compareTo(e)<0&&(s.applyToRemoteDocument(t,i),t.isValidDocument()&&o.addEntry(t,i.commitVersion))})}),a.next(function(){return e._n.removeMutationBatch(r,s)}).next(function(){return c.apply(t)}).next(function(){return l._n.performConsistencyCheck(t)}).next(function(){return l.Mn.pn(t,u)})})}function hE(t){var e=t;return e.persistence.runTransaction("Get last remote snapshot version","readonly",function(t){return e.qe.getLastRemoteSnapshotVersion(t)})}function lE(t,r){var u=t,c=r.snapshotVersion,h=u.Fn;return u.persistence.runTransaction("Apply remote event","readwrite-primary",function(s){var t=u.$n.newChangeBuffer({trackRemovals:!0});h=u.Fn;var a=[];r.targetChanges.forEach(function(t,e){var n,r,i,o=h.get(e);o&&(a.push(u.qe.removeMatchingKeys(s,t.removedDocuments,e).next(function(){return u.qe.addMatchingKeys(s,t.addedDocuments,e)})),0<(i=t.resumeToken).approximateByteSize()&&(n=o.withResumeToken(i,c).withSequenceNumber(s.currentSequenceNumber),h=h.insert(e,n),r=o,i=t,Gy(0<(o=n).resumeToken.approximateByteSize()),(0===r.resumeToken.approximateByteSize()||3e8<=o.snapshotVersion.toMicroseconds()-r.snapshotVersion.toMicroseconds()||0<i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size)&&a.push(u.qe.updateTargetData(s,n))))});var e,n=Kw;return r.documentUpdates.forEach(function(t,e){r.resolvedLimboDocuments.has(t)&&a.push(u.persistence.referenceDelegate.updateLimboDocument(s,t))}),a.push(fE(s,t,r.documentUpdates,c,void 0).next(function(t){n=t})),c.isEqual(Zy.min())||(e=u.qe.getLastRemoteSnapshotVersion(s).next(function(t){return u.qe.setTargetsMetadata(s,s.currentSequenceNumber,c)}),a.push(e)),uI.waitFor(a).next(function(){return t.apply(s)}).next(function(){return u.Mn.En(s,n)}).next(function(){return n})}).then(function(t){return u.Fn=h,t})}function fE(t,s,e,a,u){var n=Yw();return e.forEach(function(t){return n=n.add(t)}),s.getEntries(t,n).next(function(i){var o=Kw;return e.forEach(function(t,e){var n=i.get(t),r=(null==u?void 0:u.get(t))||a;e.isNoDocument()&&e.version.isEqual(Zy.min())?(s.removeEntry(t,r),o=o.insert(t,e)):!n.isValidDocument()||0<e.version.compareTo(n.version)||0===e.version.compareTo(n.version)&&n.hasPendingWrites?(s.addEntry(e,r),o=o.insert(t,e)):Vy("LocalStore","Ignoring outdated watch update for ",t,". Current version:",n.version," Watch version:",e.version)}),o})}function pE(t,r){var i=t;return i.persistence.runTransaction("Allocate target","readwrite",function(e){var n;return i.qe.getTargetData(e,r).next(function(t){return t?(n=t,uI.resolve(n)):i.qe.allocateTargetId(e).next(function(t){return n=new PI(r,t,0,e.currentSequenceNumber),i.qe.addTargetData(e,n).next(function(){return n})})})}).then(function(t){var e=i.Fn.get(t.targetId);return(null===e||0<t.snapshotVersion.compareTo(e.snapshotVersion))&&(i.Fn=i.Fn.insert(t.targetId,t),i.kn.set(r,t.targetId)),t})}function dE(i,o,s){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:n=(e=i).Fn.get(o),r=s?"readwrite":"readwrite-primary",t.label=1;case 1:return t.trys.push([1,4,,5]),s?[3,3]:[4,e.persistence.runTransaction("Release target",r,function(t){return e.persistence.referenceDelegate.removeTarget(t,n)})];case 2:t.sent(),t.label=3;case 3:return[3,5];case 4:if(!bI(r=t.sent()))throw r;return Vy("LocalStore","Failed to update sequence numbers for target "+o+": "+r),[3,5];case 5:return e.Fn=e.Fn.remove(o),e.kn.delete(n.target),[2]}})})}function vE(t,o,s){var a=t,u=Zy.min(),c=Yw();return a.persistence.runTransaction("Execute query","readonly",function(e){return t=a,n=e,r=xb(o),(void 0!==(t=(i=t).kn.get(r))?uI.resolve(i.Fn.get(t)):i.qe.getTargetData(n,r)).next(function(t){if(t)return u=t.lastLimboFreeSnapshotVersion,a.qe.getMatchingKeysForTargetId(e,t.targetId).next(function(t){c=t})}).next(function(){return a.xn.getDocumentsMatchingQuery(e,o,s?u:Zy.min(),s?c:Yw())}).next(function(t){return{documents:t,Bn:c}});var t,n,r,i})}function gE(t,e){var n=t,r=n.qe,t=n.Fn.get(e);return t?Promise.resolve(t.target):n.persistence.runTransaction("Get target data","readonly",function(t){return r.lt(t,e).next(function(t){return t?t.target:null})})}function yE(t){var s=t;return s.persistence.runTransaction("Get new document changes","readonly",function(t){return e=s.$n,n=t,t=s.On,r=e,i=Kw,o=UI(t),t=VT(n),n=IDBKeyRange.lowerBound(o,!0),t.Ot({index:Y_.readTimeIndex,range:n},function(t,e){var n=MI(r.R,e);i=i.insert(n.key,n),o=e.readTime}).next(function(){return{wn:i,readTime:jI(o)}});var e,n,r,i,o}).then(function(t){var e=t.wn,t=t.readTime;return s.On=t,e})}function mE(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){return[2,(e=n).persistence.runTransaction("Synchronize last document change read time","readonly",function(t){return t=VT(t),r=Zy.min(),t.Ot({index:Y_.readTimeIndex,reverse:!0},function(t,e,n){e.readTime&&(r=jI(e.readTime)),n.done()}).next(function(){return r});var r}).then(function(t){e.On=t})]})})}var bE,wE,_E=(BE.prototype.getBundleMetadata=function(t,e){return uI.resolve(this.Kn.get(e))},BE.prototype.saveBundleMetadata=function(t,e){return this.Kn.set(e.id,{id:e.id,version:e.version,createTime:v_(e.createTime)}),uI.resolve()},BE.prototype.getNamedQuery=function(t,e){return uI.resolve(this.jn.get(e))},BE.prototype.saveNamedQuery=function(t,e){return this.jn.set(e.name,{name:(e=e).name,query:HI(e.bundledQuery),readTime:v_(e.readTime)}),uI.resolve()},BE),IE=(VE.prototype.isEmpty=function(){return this.Wn.isEmpty()},VE.prototype.addReference=function(t,e){e=new TE(t,e);this.Wn=this.Wn.add(e),this.zn=this.zn.add(e)},VE.prototype.Jn=function(t,e){var n=this;t.forEach(function(t){return n.addReference(t,e)})},VE.prototype.removeReference=function(t,e){this.Yn(new TE(t,e))},VE.prototype.Xn=function(t,e){var n=this;t.forEach(function(t){return n.removeReference(t,e)})},VE.prototype.Zn=function(t){var e=this,n=new Cm(new am([])),r=new TE(n,t),t=new TE(n,t+1),i=[];return this.zn.forEachInRange([r,t],function(t){e.Yn(t),i.push(t.key)}),i},VE.prototype.ts=function(){var e=this;this.Wn.forEach(function(t){return e.Yn(t)})},VE.prototype.Yn=function(t){this.Wn=this.Wn.delete(t),this.zn=this.zn.delete(t)},VE.prototype.es=function(t){var e=new Cm(new am([])),n=new TE(e,t),t=new TE(e,t+1),r=Yw();return this.zn.forEachInRange([n,t],function(t){r=r.add(t.key)}),r},VE.prototype.containsKey=function(t){var e=new TE(t,0),e=this.Wn.firstAfterOrEqual(e);return null!==e&&t.isEqual(e.key)},VE),TE=(qE.Gn=function(t,e){return Cm.comparator(t.key,e.key)||Yy(t.ns,e.ns)},qE.Hn=function(t,e){return Yy(t.ns,e.ns)||Cm.comparator(t.key,e.key)},qE),EE=(jE.prototype.checkEmpty=function(t){return uI.resolve(0===this._n.length)},jE.prototype.addMutationBatch=function(t,e,n,r){var i=this.ss;this.ss++,0<this._n.length&&this._n[this._n.length-1];n=new kI(i,e,n,r);this._n.push(n);for(var o=0,s=r;o<s.length;o++){var a=s[o];this.rs=this.rs.add(new TE(a.key,i)),this.Ut.addToCollectionParentIndex(t,a.key.path.popLast())}return uI.resolve(n)},jE.prototype.lookupMutationBatch=function(t,e){return uI.resolve(this.os(e))},jE.prototype.getNextMutationBatchAfterBatchId=function(t,e){e+=1,e=this.cs(e),e=e<0?0:e;return uI.resolve(this._n.length>e?this._n[e]:null)},jE.prototype.getHighestUnacknowledgedBatchId=function(){return uI.resolve(0===this._n.length?-1:this.ss-1)},jE.prototype.getAllMutationBatches=function(t){return uI.resolve(this._n.slice())},jE.prototype.getAllMutationBatchesAffectingDocumentKey=function(t,e){var n=this,r=new TE(e,0),e=new TE(e,Number.POSITIVE_INFINITY),i=[];return this.rs.forEachInRange([r,e],function(t){t=n.os(t.ns);i.push(t)}),uI.resolve(i)},jE.prototype.getAllMutationBatchesAffectingDocumentKeys=function(t,e){var n=this,r=new Vw(Yy);return e.forEach(function(t){var e=new TE(t,0),t=new TE(t,Number.POSITIVE_INFINITY);n.rs.forEachInRange([e,t],function(t){r=r.add(t.ns)})}),uI.resolve(this.us(r))},jE.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var n=e.path,r=n.length+1,e=n;Cm.isDocumentKey(e)||(e=e.child(""));var e=new TE(new Cm(e),0),i=new Vw(Yy);return this.rs.forEachWhile(function(t){var e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(i=i.add(t.ns)),!0)},e),uI.resolve(this.us(i))},jE.prototype.us=function(t){var e=this,n=[];return t.forEach(function(t){t=e.os(t);null!==t&&n.push(t)}),n},jE.prototype.removeMutationBatch=function(n,r){var i=this;Gy(0===this.hs(r.batchId,"removed")),this._n.shift();var o=this.rs;return uI.forEach(r.mutations,function(t){var e=new TE(t.key,r.batchId);return o=o.delete(e),i.referenceDelegate.markPotentiallyOrphaned(n,t.key)}).next(function(){i.rs=o})},jE.prototype.Gt=function(t){},jE.prototype.containsKey=function(t,e){var n=new TE(e,0),n=this.rs.firstAfterOrEqual(n);return uI.resolve(e.isEqual(n&&n.key))},jE.prototype.performConsistencyCheck=function(t){return this._n.length,uI.resolve()},jE.prototype.hs=function(t,e){return this.cs(t)},jE.prototype.cs=function(t){return 0===this._n.length?0:t-this._n[0].batchId},jE.prototype.os=function(t){t=this.cs(t);return t<0||t>=this._n.length?null:this._n[t]},jE),SE=(UE.prototype.addEntry=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,i=this.ls(e);return this.docs=this.docs.insert(r,{document:e.clone(),size:i,readTime:n}),this.size+=i-o,this.Ut.addToCollectionParentIndex(t,r.path.popLast())},UE.prototype.removeEntry=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},UE.prototype.getEntry=function(t,e){var n=this.docs.get(e);return uI.resolve(n?n.document.clone():Bm.newInvalidDocument(e))},UE.prototype.getEntries=function(t,e){var n=this,r=Kw;return e.forEach(function(t){var e=n.docs.get(t);r=r.insert(t,e?e.document.clone():Bm.newInvalidDocument(t))}),uI.resolve(r)},UE.prototype.getDocumentsMatchingQuery=function(t,e,n){for(var r=Kw,i=new Cm(e.path.child("")),o=this.docs.getIteratorFrom(i);o.hasNext();){var s=o.getNext(),a=s.key,u=s.value,s=u.document,u=u.readTime;if(!e.path.isPrefixOf(a.path))break;u.compareTo(n)<=0||jb(e,s)&&(r=r.insert(s.key,s.clone()))}return uI.resolve(r)},UE.prototype.fs=function(t,e){return uI.forEach(this.docs,function(t){return e(t)})},UE.prototype.newChangeBuffer=function(t){return new CE(this)},UE.prototype.getSize=function(t){return uI.resolve(this.size)},UE),CE=(Xi(FE,wE=Sn),FE.prototype.applyChanges=function(n){var r=this,i=[];return this.changes.forEach(function(t,e){e.document.isValidDocument()?i.push(r.Ie.addEntry(n,e.document,r.getReadTime(t))):r.Ie.removeEntry(t)}),uI.waitFor(i)},FE.prototype.getFromCache=function(t,e){return this.Ie.getEntry(t,e)},FE.prototype.getAllFromCache=function(t,e){return this.Ie.getEntries(t,e)},FE),NE=(ME.prototype.forEachTarget=function(t,n){return this.ds.forEach(function(t,e){return n(e)}),uI.resolve()},ME.prototype.getLastRemoteSnapshotVersion=function(t){return uI.resolve(this.lastRemoteSnapshotVersion)},ME.prototype.getHighestSequenceNumber=function(t){return uI.resolve(this.ws)},ME.prototype.allocateTargetId=function(t){return this.highestTargetId=this.ys.next(),uI.resolve(this.highestTargetId)},ME.prototype.setTargetsMetadata=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.ws&&(this.ws=e),uI.resolve()},ME.prototype.te=function(t){this.ds.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.ys=new dT(e),this.highestTargetId=e),t.sequenceNumber>this.ws&&(this.ws=t.sequenceNumber)},ME.prototype.addTargetData=function(t,e){return this.te(e),this.targetCount+=1,uI.resolve()},ME.prototype.updateTargetData=function(t,e){return this.te(e),uI.resolve()},ME.prototype.removeTargetData=function(t,e){return this.ds.delete(e.target),this._s.Zn(e.targetId),--this.targetCount,uI.resolve()},ME.prototype.removeTargets=function(n,r,i){var o=this,s=0,a=[];return this.ds.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.ds.delete(t),a.push(o.removeMatchingKeysForTargetId(n,e.targetId)),s++)}),uI.waitFor(a).next(function(){return s})},ME.prototype.getTargetCount=function(t){return uI.resolve(this.targetCount)},ME.prototype.getTargetData=function(t,e){e=this.ds.get(e)||null;return uI.resolve(e)},ME.prototype.addMatchingKeys=function(t,e,n){return this._s.Jn(e,n),uI.resolve()},ME.prototype.removeMatchingKeys=function(e,t,n){this._s.Xn(t,n);var r=this.persistence.referenceDelegate,i=[];return r&&t.forEach(function(t){i.push(r.markPotentiallyOrphaned(e,t))}),uI.waitFor(i)},ME.prototype.removeMatchingKeysForTargetId=function(t,e){return this._s.Zn(e),uI.resolve()},ME.prototype.getMatchingKeysForTargetId=function(t,e){e=this._s.es(e);return uI.resolve(e)},ME.prototype.containsKey=function(t,e){return uI.resolve(this._s.containsKey(e))},ME),AE=(LE.prototype.start=function(){return Promise.resolve()},LE.prototype.shutdown=function(){return this.xe=!1,Promise.resolve()},Object.defineProperty(LE.prototype,"started",{get:function(){return this.xe},enumerable:!1,configurable:!0}),LE.prototype.setDatabaseDeletedListener=function(){},LE.prototype.setNetworkEnabled=function(){},LE.prototype.getIndexManager=function(){return this.Ut},LE.prototype.getMutationQueue=function(t){var e=this.gs[t.toKey()];return e||(e=new EE(this.Ut,this.referenceDelegate),this.gs[t.toKey()]=e),e},LE.prototype.getTargetCache=function(){return this.qe},LE.prototype.getRemoteDocumentCache=function(){return this.Ue},LE.prototype.getBundleCache=function(){return this.Qe},LE.prototype.runTransaction=function(t,e,n){var r=this;Vy("MemoryPersistence","Starting transaction:",t);var i=new kE(this.Ne.next());return this.referenceDelegate.Es(),n(i).next(function(t){return r.referenceDelegate.Ts(i).next(function(){return t})}).toPromise().then(function(t){return i.raiseOnCommittedEvent(),t})},LE.prototype.Is=function(e,n){return uI.or(Object.values(this.gs).map(function(t){return function(){return t.containsKey(e,n)}}))},LE),kE=(Xi(xE,bE=Ga),xE),RE=(DE.bs=function(t){return new DE(t)},Object.defineProperty(DE.prototype,"vs",{get:function(){if(this.Rs)return this.Rs;throw Hy()},enumerable:!1,configurable:!0}),DE.prototype.addReference=function(t,e,n){return this.As.addReference(n,e),this.vs.delete(n.toString()),uI.resolve()},DE.prototype.removeReference=function(t,e,n){return this.As.removeReference(n,e),this.vs.add(n.toString()),uI.resolve()},DE.prototype.markPotentiallyOrphaned=function(t,e){return this.vs.add(e.toString()),uI.resolve()},DE.prototype.removeTarget=function(t,e){var n=this;this.As.Zn(e.targetId).forEach(function(t){return n.vs.add(t.toString())});var r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(t,e.targetId).next(function(t){t.forEach(function(t){return n.vs.add(t.toString())})}).next(function(){return r.removeTargetData(t,e)})},DE.prototype.Es=function(){this.Rs=new Set},DE.prototype.Ts=function(n){var r=this,i=this.persistence.getRemoteDocumentCache().newChangeBuffer();return uI.forEach(this.vs,function(t){var e=Cm.fromPath(t);return r.Ps(n,e).next(function(t){t||i.removeEntry(e)})}).next(function(){return r.Rs=null,i.apply(n)})},DE.prototype.updateLimboDocument=function(t,e){var n=this;return this.Ps(t,e).next(function(t){t?n.vs.delete(e.toString()):n.vs.add(e.toString())})},DE.prototype.ps=function(t){return 0},DE.prototype.Ps=function(t,e){var n=this;return uI.or([function(){return uI.resolve(n.As.containsKey(e))},function(){return n.persistence.getTargetCache().containsKey(t,e)},function(){return n.persistence.Is(t,e)}])},DE),PE=(OE.prototype.isAuthenticated=function(){return null!=this.uid},OE.prototype.toKey=function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"},OE.prototype.isEqual=function(t){return t.uid===this.uid},OE);function OE(t){this.uid=t}function DE(t){this.persistence=t,this.As=new IE,this.Rs=null}function xE(t){var e=this;return(e=bE.call(this)||this).currentSequenceNumber=t,e}function LE(t,e){var n=this;this.gs={},this.Ne=new Dy(0),this.xe=!1,this.xe=!0,this.referenceDelegate=t(this),this.qe=new NE(this),this.Ut=new XI,this.Ue=(t=this.Ut,new SE(t,function(t){return n.referenceDelegate.ps(t)})),this.R=new OI(e),this.Qe=new _E(this.R)}function ME(t){this.persistence=t,this.ds=new DT(Gm,zm),this.lastRemoteSnapshotVersion=Zy.min(),this.highestTargetId=0,this.ws=0,this._s=new IE,this.targetCount=0,this.ys=dT.Jt()}function FE(t){var e=this;return(e=wE.call(this)||this).Ie=t,e}function UE(t,e){this.Ut=t,this.ls=e,this.docs=new xw(Cm.comparator),this.size=0}function jE(t,e){this.Ut=t,this.referenceDelegate=e,this._n=[],this.ss=1,this.rs=new Vw(TE.Gn)}function qE(t,e){this.key=t,this.ns=e}function VE(){this.Wn=new Vw(TE.Gn),this.zn=new Vw(TE.Hn)}function BE(t){this.R=t,this.Kn=new Map,this.jn=new Map}function KE(t,e){return"firestore_clients_"+t+"_"+e}function WE(t,e,n){n="firestore_mutations_"+t+"_"+n;return e.isAuthenticated()&&(n+="_"+e.uid),n}function HE(t,e){return"firestore_targets_"+t+"_"+e}PE.UNAUTHENTICATED=new PE(null),PE.GOOGLE_CREDENTIALS=new PE("google-credentials-uid"),PE.FIRST_PARTY=new PE("first-party-uid");var GE,zE=(gS.Vs=function(t,e,n){var r,i=JSON.parse(n),o="object"==typeof i&&-1!==["pending","acknowledged","rejected"].indexOf(i.state)&&(void 0===i.error||"object"==typeof i.error);return o&&i.error&&(o="string"==typeof i.error.message&&"string"==typeof i.error.code)&&(r=new Fy(i.error.code,i.error.message)),o?new gS(t,e,i.state,r):(By("SharedClientState","Failed to parse mutation state for ID '"+e+"': "+n),null)},gS.prototype.Ss=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)},gS),QE=(vS.Vs=function(t,e){var n,r=JSON.parse(e),i="object"==typeof r&&-1!==["not-current","current","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error);return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code)&&(n=new Fy(r.error.code,r.error.message)),i?new vS(t,r.state,n):(By("SharedClientState","Failed to parse target state for ID '"+t+"': "+e),null)},vS.prototype.Ss=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)},vS),YE=(dS.Vs=function(t,e){for(var n=JSON.parse(e),r="object"==typeof n&&n.activeTargetIds instanceof Array,i=Xw,o=0;r&&o<n.activeTargetIds.length;++o)r=Sm(n.activeTargetIds[o]),i=i.add(n.activeTargetIds[o]);return r?new dS(t,i):(By("SharedClientState","Failed to parse client data for instance '"+t+"': "+e),null)},dS),XE=(pS.Vs=function(t){var e=JSON.parse(t);return"object"==typeof e&&-1!==["Unknown","Online","Offline"].indexOf(e.onlineState)&&"string"==typeof e.clientId?new pS(e.clientId,e.onlineState):(By("SharedClientState","Failed to parse online state: "+t),null)},pS),JE=(fS.prototype.Ds=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},fS.prototype.Cs=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},fS.prototype.Ss=function(){var t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)},fS),$E=(lS.yt=function(t){return!(!t||!t.localStorage)},lS.prototype.start=function(){return $i(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l=this;return Zi(this,function(t){switch(t.label){case 0:return[4,this.syncEngine.fn()];case 1:for(s=t.sent(),e=0,n=s;e<n.length;e++)(r=n[e])!==this.Ns&&(i=this.getItem(KE(this.persistenceKey,r)))&&(o=YE.Vs(r,i))&&(this.ks=this.ks.insert(o.clientId,o));for(this.Ks(),(s=this.storage.getItem(this.Us))&&(a=this.js(s))&&this.Ws(a),u=0,c=this.Os;u<c.length;u++)h=c[u],this.Fs(h);return this.Os=[],this.window.addEventListener("unload",function(){return l.shutdown()}),this.started=!0,[2]}})})},lS.prototype.writeSequenceNumber=function(t){this.setItem(this.Ms,JSON.stringify(t))},lS.prototype.getAllActiveQueryTargets=function(){return this.Gs(this.ks)},lS.prototype.isActiveQueryTarget=function(n){var r=!1;return this.ks.forEach(function(t,e){e.activeTargetIds.has(n)&&(r=!0)}),r},lS.prototype.addPendingMutation=function(t){this.zs(t,"pending")},lS.prototype.updateMutationState=function(t,e,n){this.zs(t,e,n),this.Hs(t)},lS.prototype.addLocalQueryTarget=function(t){var e,n="not-current";return this.isActiveQueryTarget(t)&&(!(e=this.storage.getItem(HE(this.persistenceKey,t)))||(e=QE.Vs(t,e))&&(n=e.state)),this.Js.Ds(t),this.Ks(),n},lS.prototype.removeLocalQueryTarget=function(t){this.Js.Cs(t),this.Ks()},lS.prototype.isLocalQueryTarget=function(t){return this.Js.activeTargetIds.has(t)},lS.prototype.clearQueryState=function(t){this.removeItem(HE(this.persistenceKey,t))},lS.prototype.updateQueryState=function(t,e,n){this.Ys(t,e,n)},lS.prototype.handleUserChange=function(t,e,n){var r=this;e.forEach(function(t){r.Hs(t)}),this.currentUser=t,n.forEach(function(t){r.addPendingMutation(t)})},lS.prototype.setOnlineState=function(t){this.Xs(t)},lS.prototype.notifyBundleLoaded=function(){this.Zs()},lS.prototype.shutdown=function(){this.started&&(this.window.removeEventListener("storage",this.xs),this.removeItem(this.$s),this.started=!1)},lS.prototype.getItem=function(t){var e=this.storage.getItem(t);return Vy("SharedClientState","READ",t,e),e},lS.prototype.setItem=function(t,e){Vy("SharedClientState","SET",t,e),this.storage.setItem(t,e)},lS.prototype.removeItem=function(t){Vy("SharedClientState","REMOVE",t),this.storage.removeItem(t)},lS.prototype.Fs=function(t){var e=this,o=t;o.storageArea===this.storage&&(Vy("SharedClientState","EVENT",o.key,o.newValue),o.key!==this.$s?this.Se.enqueueRetryable(function(){return $i(e,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){if(this.started){if(null!==o.key)if(this.Ls.test(o.key)){if(null==o.newValue)return e=this.ti(o.key),[2,this.ei(e,null)];if(e=this.ni(o.key,o.newValue))return[2,this.ei(e.clientId,e)]}else if(this.Bs.test(o.key)){if(null!==o.newValue&&(n=this.si(o.key,o.newValue)))return[2,this.ii(n)]}else if(this.qs.test(o.key)){if(null!==o.newValue&&(r=this.ri(o.key,o.newValue)))return[2,this.oi(r)]}else if(o.key===this.Us){if(null!==o.newValue&&(i=this.js(o.newValue)))return[2,this.Ws(i)]}else if(o.key===this.Ms)(i=function(t){var e=Dy.o;if(null!=t)try{var n=JSON.parse(t);Gy("number"==typeof n),e=n}catch(t){By("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(o.newValue))!==Dy.o&&this.sequenceNumberHandler(i);else if(o.key===this.Qs)return[2,this.syncEngine.ci()]}else this.Os.push(o);return[2]})})}):By("Received WebStorage notification for local change. Another client might have garbage-collected our state"))},Object.defineProperty(lS.prototype,"Js",{get:function(){return this.ks.get(this.Ns)},enumerable:!1,configurable:!0}),lS.prototype.Ks=function(){this.setItem(this.$s,this.Js.Ss())},lS.prototype.zs=function(t,e,n){n=new zE(this.currentUser,t,e,n),t=WE(this.persistenceKey,this.currentUser,t);this.setItem(t,n.Ss())},lS.prototype.Hs=function(t){t=WE(this.persistenceKey,this.currentUser,t);this.removeItem(t)},lS.prototype.Xs=function(t){t={clientId:this.Ns,onlineState:t};this.storage.setItem(this.Us,JSON.stringify(t))},lS.prototype.Ys=function(t,e,n){var r=HE(this.persistenceKey,t),n=new QE(t,e,n);this.setItem(r,n.Ss())},lS.prototype.Zs=function(){this.setItem(this.Qs,"value-not-used")},lS.prototype.ti=function(t){t=this.Ls.exec(t);return t?t[1]:null},lS.prototype.ni=function(t,e){t=this.ti(t);return YE.Vs(t,e)},lS.prototype.si=function(t,e){var n=this.Bs.exec(t),t=Number(n[1]),n=void 0!==n[2]?n[2]:null;return zE.Vs(new PE(n),t,e)},lS.prototype.ri=function(t,e){t=this.qs.exec(t),t=Number(t[1]);return QE.Vs(t,e)},lS.prototype.js=function(t){return XE.Vs(t)},lS.prototype.ii=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return e.user.uid===this.currentUser.uid?[2,this.syncEngine.ui(e.batchId,e.state,e.error)]:(Vy("SharedClientState","Ignoring mutation for non-active user "+e.user.uid),[2])})})},lS.prototype.oi=function(t){return this.syncEngine.ai(t.targetId,t.state,t.error)},lS.prototype.ei=function(t,e){var n=this,r=e?this.ks.insert(t,e):this.ks.remove(t),i=this.Gs(this.ks),o=this.Gs(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.syncEngine.hi(s,a).then(function(){n.ks=r})},lS.prototype.Ws=function(t){this.ks.get(t.clientId)&&this.onlineStateHandler(t.onlineState)},lS.prototype.Gs=function(t){var n=Xw;return t.forEach(function(t,e){n=n.unionWith(e.activeTargetIds)}),n},lS),ZE=(hS.prototype.addPendingMutation=function(t){},hS.prototype.updateMutationState=function(t,e,n){},hS.prototype.addLocalQueryTarget=function(t){return this.li.Ds(t),this.fi[t]||"not-current"},hS.prototype.updateQueryState=function(t,e,n){this.fi[t]=e},hS.prototype.removeLocalQueryTarget=function(t){this.li.Cs(t)},hS.prototype.isLocalQueryTarget=function(t){return this.li.activeTargetIds.has(t)},hS.prototype.clearQueryState=function(t){delete this.fi[t]},hS.prototype.getAllActiveQueryTargets=function(){return this.li.activeTargetIds},hS.prototype.isActiveQueryTarget=function(t){return this.li.activeTargetIds.has(t)},hS.prototype.start=function(){return this.li=new JE,Promise.resolve()},hS.prototype.handleUserChange=function(t,e,n){},hS.prototype.setOnlineState=function(t){},hS.prototype.shutdown=function(){},hS.prototype.writeSequenceNumber=function(t){},hS.prototype.notifyBundleLoaded=function(){},hS),tS=(cS.prototype.di=function(t){},cS.prototype.shutdown=function(){},cS),eS=(uS.prototype.di=function(t){this.gi.push(t)},uS.prototype.shutdown=function(){window.removeEventListener("online",this.wi),window.removeEventListener("offline",this.mi)},uS.prototype.pi=function(){window.addEventListener("online",this.wi),window.addEventListener("offline",this.mi)},uS.prototype._i=function(){Vy("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.gi;t<e.length;t++)(0,e[t])(0)},uS.prototype.yi=function(){Vy("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.gi;t<e.length;t++)(0,e[t])(1)},uS.yt=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},uS),nS={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},rS=(aS.prototype.Ii=function(t){this.Ai=t},aS.prototype.Ri=function(t){this.bi=t},aS.prototype.onMessage=function(t){this.vi=t},aS.prototype.close=function(){this.Ti()},aS.prototype.send=function(t){this.Ei(t)},aS.prototype.Pi=function(){this.Ai()},aS.prototype.Vi=function(t){this.bi(t)},aS.prototype.Si=function(t){this.vi(t)},aS),iS=(sS.prototype.Ni=function(e,t,n,r){var i=this.xi(e,t);Vy("RestConnection","Sending: ",i,n);t={};return this.Fi(t,r),this.ki(e,i,t,n).then(function(t){return Vy("RestConnection","Received: ",t),t},function(t){throw Ky("RestConnection",e+" failed with error: ",t,"url: ",i,"request:",n),t})},sS.prototype.Oi=function(t,e,n,r){return this.Ni(t,e,n,r)},sS.prototype.Fi=function(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/8.3.2",t["X-Firebase-GMPID"]=this.databaseInfo.appId,t["Content-Type"]="text/plain",e)for(var n in e.authHeaders)e.authHeaders.hasOwnProperty(n)&&(t[n]=e.authHeaders[n])},sS.prototype.xi=function(t,e){t=nS[t];return this.Di+"/v1/"+e+":"+t},Xi(oS,GE=sS),oS.prototype.ki=function(o,e,s,a){return new Promise(function(n,r){var i=new Oy;i.listenOnce(Ny.COMPLETE,function(){try{switch(i.getLastErrorCode()){case Cy.NO_ERROR:var t=i.getResponseJson();Vy("Connection","XHR received:",JSON.stringify(t)),n(t);break;case Cy.TIMEOUT:Vy("Connection",'RPC "'+o+'" timed out'),r(new Fy(My.DEADLINE_EXCEEDED,"Request time out"));break;case Cy.HTTP_ERROR:var e=i.getStatus();Vy("Connection",'RPC "'+o+'" failed with status:',e,"response text:",i.getResponseText()),0<e?(t=i.getResponseJson().error)&&t.status&&t.message?(e=t.status.toLowerCase().replace(/_/g,"-"),e=0<=Object.values(My).indexOf(e)?e:My.UNKNOWN,r(new Fy(e,t.message))):r(new Fy(My.UNKNOWN,"Server responded with status "+i.getStatus())):r(new Fy(My.UNAVAILABLE,"Connection failed."));break;default:Hy()}}finally{Vy("Connection",'RPC "'+o+'" completed.')}});var t=JSON.stringify(a);i.send(e,"POST",t,s,15)})},oS.prototype.$i=function(t,e){var n=[this.Di,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=new wy,i=Sy(),t={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.Fi(t.initMessageHeaders,e),vo()||yo()||0<=po().indexOf("Electron/")||(0<=(e=po()).indexOf("MSIE ")||0<=e.indexOf("Trident/"))||0<=po().indexOf("MSAppHost/")||go()||(t.httpHeadersOverwriteParam="$httpHeaders");n=n.join("");Vy("Connection","Creating WebChannel: "+n,t);var o=r.createWebChannel(n,t),s=!1,a=!1,u=new rS({Ei:function(t){a?Vy("Connection","Not sending because WebChannel is closed:",t):(s||(Vy("Connection","Opening WebChannel transport."),o.open(),s=!0),Vy("Connection","WebChannel sending:",t),o.send(t))},Ti:function(){return o.close()}}),t=function(t,e,n){t.listen(e,function(t){try{n(t)}catch(t){setTimeout(function(){throw t},0)}})};return t(o,Py.EventType.OPEN,function(){a||Vy("Connection","WebChannel transport opened.")}),t(o,Py.EventType.CLOSE,function(){a||(a=!0,Vy("Connection","WebChannel transport closed"),u.Vi())}),t(o,Py.EventType.ERROR,function(t){a||(a=!0,Ky("Connection","WebChannel transport errored:",t),u.Vi(new Fy(My.UNAVAILABLE,"The operation could not be completed")))}),t(o,Py.EventType.MESSAGE,function(t){var e,n,r,i;a||(Gy(!!(e=t.data[0])),(n=e.error||(null===(i=e[0])||void 0===i?void 0:i.error))?(Vy("Connection","WebChannel received error:",n),r=n.status,t=function(){var t=Sw[r];if(void 0!==t)return Dw(t)}(),i=n.message,void 0===t&&(t=My.INTERNAL,i="Unknown error status: "+r+" with message "+n.message),a=!0,u.Vi(new Fy(t,i)),o.close()):(Vy("Connection","WebChannel received:",e),u.Si(e)))}),t(i,Ay.STAT_EVENT,function(t){t.stat===ky?Vy("Connection","Detected buffering proxy"):t.stat===Ry&&Vy("Connection","Detected no buffering proxy")}),setTimeout(function(){u.Pi()},0),u},oS);function oS(t){var e=this;return(e=GE.call(this,t)||this).forceLongPolling=t.forceLongPolling,e.autoDetectLongPolling=t.autoDetectLongPolling,e}function sS(t){this.databaseInfo=t,this.databaseId=t.databaseId;var e=t.ssl?"https":"http";this.Di=e+"://"+t.host,this.Ci="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}function aS(t){this.Ei=t.Ei,this.Ti=t.Ti}function uS(){var t=this;this.wi=function(){return t._i()},this.mi=function(){return t.yi()},this.gi=[],this.pi()}function cS(){}function hS(){this.li=new JE,this.fi={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}function lS(t,e,n,r,i){this.window=t,this.Se=e,this.persistenceKey=n,this.Ns=r,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.xs=this.Fs.bind(this),this.ks=new xw(Yy),this.started=!1,this.Os=[];n=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=i,this.$s=KE(this.persistenceKey,this.Ns),this.Ms="firestore_sequence_number_"+this.persistenceKey,this.ks=this.ks.insert(this.Ns,new JE),this.Ls=new RegExp("^firestore_clients_"+n+"_([^_]*)$"),this.Bs=new RegExp("^firestore_mutations_"+n+"_(\\d+)(?:_(.*))?$"),this.qs=new RegExp("^firestore_targets_"+n+"_(\\d+)$"),this.Us="firestore_online_state_"+this.persistenceKey,this.Qs="firestore_bundle_loaded_"+this.persistenceKey,this.window.addEventListener("storage",this.xs)}function fS(){this.activeTargetIds=Xw}function pS(t,e){this.clientId=t,this.onlineState=e}function dS(t,e){this.clientId=t,this.activeTargetIds=e}function vS(t,e,n){this.targetId=t,this.state=e,this.error=n}function gS(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}function yS(){return"undefined"!=typeof window?window:null}function mS(){return"undefined"!=typeof document?document:null}function bS(t){return new f_(t,!0)}function wS(t,e,n,r,i){var o=this;this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.kr=[],this.Or=new Map,this.$r=new Set,this.Mr=[],this.Lr=i,this.Lr.di(function(t){n.enqueueAndForget(function(){return $i(o,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return KS(this)?(Vy("RemoteStore","Restarting streams for network reachability change."),[4,function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return(e=n).$r.add(4),[4,MS(e)];case 1:return t.sent(),e.Br.set("Unknown"),e.$r.delete(4),[4,LS(e)];case 2:return t.sent(),[2]}})})}(this)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.Br=new AS(n,r)}var _S,IS,TS,ES=(xS.prototype.reset=function(){this.qi=0},xS.prototype.Ki=function(){this.qi=this.Bi},xS.prototype.ji=function(t){var e=this;this.cancel();var n=Math.floor(this.qi+this.Wi()),r=Math.max(0,Date.now()-this.Qi),i=Math.max(0,n-r);0<i&&Vy("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.qi+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.Ui=this.Se.enqueueAfterDelay(this.timerId,i,function(){return e.Qi=Date.now(),t()}),this.qi*=this.Li,this.qi<this.Mi&&(this.qi=this.Mi),this.qi>this.Bi&&(this.qi=this.Bi)},xS.prototype.Gi=function(){null!==this.Ui&&(this.Ui.skipDelay(),this.Ui=null)},xS.prototype.cancel=function(){null!==this.Ui&&(this.Ui.cancel(),this.Ui=null)},xS.prototype.Wi=function(){return(Math.random()-.5)*this.qi},xS),Sn=(DS.prototype.tr=function(){return 1===this.state||2===this.state||4===this.state},DS.prototype.er=function(){return 2===this.state},DS.prototype.start=function(){3!==this.state?this.auth():this.nr()},DS.prototype.stop=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.tr()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},DS.prototype.sr=function(){this.state=0,this.Zi.reset()},DS.prototype.ir=function(){var t=this;this.er()&&null===this.Xi&&(this.Xi=this.Se.enqueueAfterDelay(this.zi,6e4,function(){return t.rr()}))},DS.prototype.cr=function(t){this.ur(),this.stream.send(t)},DS.prototype.rr=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return this.er()?[2,this.close(0)]:[2]})})},DS.prototype.ur=function(){this.Xi&&(this.Xi.cancel(),this.Xi=null)},DS.prototype.close=function(e,n){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.ur(),this.Zi.cancel(),this.Yi++,3!==e?this.Zi.reset():n&&n.code===My.RESOURCE_EXHAUSTED?(By(n.toString()),By("Using maximum backoff delay to prevent overloading the backend."),this.Zi.Ki()):n&&n.code===My.UNAUTHENTICATED&&this.Ji.invalidateToken(),null!==this.stream&&(this.ar(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.Ri(n)];case 1:return t.sent(),[2]}})})},DS.prototype.ar=function(){},DS.prototype.auth=function(){var n=this;this.state=1;var t=this.hr(this.Yi),e=this.Yi;this.Ji.getToken().then(function(t){n.Yi===e&&n.lr(t)},function(e){t(function(){var t=new Fy(My.UNKNOWN,"Fetching auth token failed: "+e.message);return n.dr(t)})})},DS.prototype.lr=function(t){var e=this,n=this.hr(this.Yi);this.stream=this.wr(t),this.stream.Ii(function(){n(function(){return e.state=2,e.listener.Ii()})}),this.stream.Ri(function(t){n(function(){return e.dr(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},DS.prototype.nr=function(){var t=this;this.state=4,this.Zi.ji(function(){return $i(t,void 0,void 0,function(){return Zi(this,function(t){return this.state=0,this.start(),[2]})})})},DS.prototype.dr=function(t){return Vy("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},DS.prototype.hr=function(e){var n=this;return function(t){n.Se.enqueueAndForget(function(){return n.Yi===e?t():(Vy("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},DS),SS=(Xi(OS,TS=Sn),OS.prototype.wr=function(t){return this.Hi.$i("Listen",t)},OS.prototype.onMessage=function(t){this.Zi.reset();var e=function(t,e){if("targetChange"in e){e.targetChange;var n="NO_CHANGE"===(o=e.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===o?1:"REMOVE"===o?2:"CURRENT"===o?3:"RESET"===o?4:Hy(),r=e.targetChange.targetIds||[],i=(s=e.targetChange.resumeToken,t.I?(Gy(void 0===s||"string"==typeof s),lm.fromBase64String(s||"")):(Gy(void 0===s||s instanceof Uint8Array),lm.fromUint8Array(s||new Uint8Array))),o=(a=e.targetChange.cause)&&(u=void 0===(c=a).code?My.UNKNOWN:Dw(c.code),new Fy(u,c.message||"")),s=new e_(n,r,i,o||null)}else if("documentChange"in e){e.documentChange,(n=e.documentChange).document,n.document.name,n.document.updateTime;var r=b_(t,n.document.name),i=v_(n.document.updateTime),a=new qm({mapValue:{fields:n.document.fields}}),u=(o=Bm.newFoundDocument(r,i,a),n.targetIds||[]),c=n.removedTargetIds||[];s=new Zw(u,c,o.key,o)}else if("documentDelete"in e)e.documentDelete,(n=e.documentDelete).document,r=b_(t,n.document),i=n.readTime?v_(n.readTime):Zy.min(),a=Bm.newNoDocument(r,i),o=n.removedTargetIds||[],s=new Zw([],o,a.key,a);else if("documentRemove"in e)e.documentRemove,(n=e.documentRemove).document,r=b_(t,n.document),i=n.removedTargetIds||[],s=new Zw([],i,r,null);else{if(!("filter"in e))return Hy();e.filter;e=e.filter;e.targetId,n=e.count||0,r=new Ew(n),i=e.targetId,s=new t_(i,r)}return s}(this.R,t),t=function(t){if(!("targetChange"in t))return Zy.min();t=t.targetChange;return(!t.targetIds||!t.targetIds.length)&&t.readTime?v_(t.readTime):Zy.min()}(t);return this.listener._r(e,t)},OS.prototype.mr=function(t){var e,n,r,i={};i.database=I_(this.R),i.addTarget=(e=this.R,(r=Qm(r=(n=t).target)?{documents:A_(e,r)}:{query:k_(e,r)}).targetId=n.targetId,0<n.resumeToken.approximateByteSize()?r.resumeToken=d_(e,n.resumeToken):0<n.snapshotVersion.compareTo(Zy.min())&&(r.readTime=p_(e,n.snapshotVersion.toTimestamp())),r);var o,t=(this.R,o=t,null==(t=function(){switch(o.purpose){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Hy()}}())?null:{"goog-listen-tags":t});t&&(i.labels=t),this.cr(i)},OS.prototype.yr=function(t){var e={};e.database=I_(this.R),e.removeTarget=t,this.cr(e)},OS),CS=(Xi(PS,IS=Sn),Object.defineProperty(PS.prototype,"pr",{get:function(){return this.gr},enumerable:!1,configurable:!0}),PS.prototype.start=function(){this.gr=!1,this.lastStreamToken=void 0,IS.prototype.start.call(this)},PS.prototype.ar=function(){this.gr&&this.Er([])},PS.prototype.wr=function(t){return this.Hi.$i("Write",t)},PS.prototype.onMessage=function(t){if(Gy(!!t.streamToken),this.lastStreamToken=t.streamToken,this.gr){this.Zi.reset();var e=(n=t.writeResults,r=t.commitTime,n&&0<n.length?(Gy(void 0!==r),n.map(function(t){return n=r,(t=(e=t).updateTime?v_(e.updateTime):v_(n)).isEqual(Zy.min())&&(t=v_(n)),new aw(t,e.transformResults||[]);var e,n})):[]),n=v_(t.commitTime);return this.listener.Tr(n,e)}var n,r;return Gy(!t.writeResults||0===t.writeResults.length),this.gr=!0,this.listener.Ir()},PS.prototype.Ar=function(){var t={};t.database=I_(this.R),this.cr(t)},PS.prototype.Er=function(t){var e=this,t={streamToken:this.lastStreamToken,writes:t.map(function(t){return C_(e.R,t)})};this.cr(t)},PS),NS=(Xi(RS,_S=function(){}),RS.prototype.br=function(){if(this.Rr)throw new Fy(My.FAILED_PRECONDITION,"The client has already been terminated.")},RS.prototype.Ni=function(e,n,r){var i=this;return this.br(),this.credentials.getToken().then(function(t){return i.Hi.Ni(e,n,r,t)}).catch(function(t){throw t.code===My.UNAUTHENTICATED&&i.credentials.invalidateToken(),t})},RS.prototype.Oi=function(e,n,r){var i=this;return this.br(),this.credentials.getToken().then(function(t){return i.Hi.Oi(e,n,r,t)}).catch(function(t){throw t.code===My.UNAUTHENTICATED&&i.credentials.invalidateToken(),t})},RS.prototype.terminate=function(){this.Rr=!1},RS),AS=(kS.prototype.Sr=function(){var t=this;0===this.vr&&(this.Dr("Unknown"),this.Pr=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,function(){return t.Pr=null,t.Cr("Backend didn't respond within 10 seconds."),t.Dr("Offline"),Promise.resolve()}))},kS.prototype.Nr=function(t){"Online"===this.state?this.Dr("Unknown"):(this.vr++,1<=this.vr&&(this.Fr(),this.Cr("Connection failed 1 times. Most recent error: "+t.toString()),this.Dr("Offline")))},kS.prototype.set=function(t){this.Fr(),this.vr=0,"Online"===t&&(this.Vr=!1),this.Dr(t)},kS.prototype.Dr=function(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))},kS.prototype.Cr=function(t){t="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.Vr?(By(t),this.Vr=!1):Vy("OnlineStateTracker",t)},kS.prototype.Fr=function(){null!==this.Pr&&(this.Pr.cancel(),this.Pr=null)},kS);function kS(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.vr=0,this.Pr=null,this.Vr=!0}function RS(t,e,n){var r=this;return(r=_S.call(this)||this).credentials=t,r.Hi=e,r.R=n,r.Rr=!1,r}function PS(t,e,n,r,i){var o=this;return(o=IS.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this).R=r,o.gr=!1,o}function OS(t,e,n,r,i){var o=this;return(o=TS.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this).R=r,o}function DS(t,e,n,r,i,o){this.Se=t,this.zi=n,this.Hi=r,this.Ji=i,this.listener=o,this.state=0,this.Yi=0,this.Xi=null,this.stream=null,this.Zi=new ES(t,e)}function xS(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.Se=t,this.timerId=e,this.Mi=n,this.Li=r,this.Bi=i,this.qi=0,this.Ui=null,this.Qi=Date.now(),this.reset()}function LS(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:if(!KS(r))return[3,4];e=0,n=r.Mr,t.label=1;case 1:return e<n.length?[4,(0,n[e])(!0)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})}function MS(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:e=0,n=r.Mr,t.label=1;case 1:return e<n.length?[4,(0,n[e])(!1)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})}function FS(t,e){t.Or.has(e.targetId)||(t.Or.set(e.targetId,e),BS(t)?VS(t):$S(t).er()&&jS(t,e))}function US(t,e){var n=t,t=$S(n);n.Or.delete(e),t.er()&&qS(n,e),0===n.Or.size&&(t.er()?t.ir():KS(n)&&n.Br.set("Unknown"))}function jS(t,e){t.qr.U(e.targetId),$S(t).mr(e)}function qS(t,e){t.qr.U(e),$S(t).yr(e)}function VS(e){e.qr=new r_({getRemoteKeysForTarget:function(t){return e.remoteSyncer.getRemoteKeysForTarget(t)},lt:function(t){return e.Or.get(t)||null}}),$S(e).start(),e.Br.Sr()}function BS(t){return KS(t)&&!$S(t).tr()&&0<t.Or.size}function KS(t){return 0===t.$r.size}function WS(t){t.qr=void 0}function HS(s,a,u){return $i(this,void 0,void 0,function(){var n,o;return Zi(this,function(t){switch(t.label){case 0:if(s.Br.set("Online"),!(a instanceof e_&&2===a.state&&a.cause))return[3,6];t.label=1;case 1:return t.trys.push([1,3,,5]),[4,function(o,s){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:e=s.cause,n=0,r=s.targetIds,t.label=1;case 1:return n<r.length?(i=r[n],o.Or.has(i)?[4,o.remoteSyncer.rejectListen(i,e)]:[3,3]):[3,5];case 2:t.sent(),o.Or.delete(i),o.qr.removeTarget(i),t.label=3;case 3:t.label=4;case 4:return n++,[3,1];case 5:return[2]}})})}(s,a)];case 2:return t.sent(),[3,5];case 3:return n=t.sent(),Vy("RemoteStore","Failed to remove targets %s: %s ",a.targetIds.join(","),n),[4,GS(s,n)];case 4:return t.sent(),[3,5];case 5:return[3,13];case 6:if(a instanceof Zw?s.qr.X(a):a instanceof t_?s.qr.rt(a):s.qr.et(a),u.isEqual(Zy.min()))return[3,13];t.label=7;case 7:return t.trys.push([7,11,,13]),[4,hE(s.localStore)];case 8:return o=t.sent(),0<=u.compareTo(o)?[4,(i=u,(e=(r=s).qr.ut(i)).targetChanges.forEach(function(t,e){var n;0<t.resumeToken.approximateByteSize()&&((n=r.Or.get(e))&&r.Or.set(e,n.withResumeToken(t.resumeToken,i)))}),e.targetMismatches.forEach(function(t){var e=r.Or.get(t);e&&(r.Or.set(t,e.withResumeToken(lm.EMPTY_BYTE_STRING,e.snapshotVersion)),qS(r,t),e=new PI(e.target,t,1,e.sequenceNumber),jS(r,e))}),r.remoteSyncer.applyRemoteEvent(e))]:[3,10];case 9:t.sent(),t.label=10;case 10:return[3,13];case 11:return Vy("RemoteStore","Failed to raise snapshot:",o=t.sent()),[4,GS(s,o)];case 12:return t.sent(),[3,13];case 13:return[2]}var r,i,e})})}function GS(n,r,i){return $i(this,void 0,void 0,function(){var e=this;return Zi(this,function(t){switch(t.label){case 0:if(!bI(r))throw r;return n.$r.add(1),[4,MS(n)];case 1:return t.sent(),n.Br.set("Offline"),i=i||function(){return hE(n.localStore)},n.asyncQueue.enqueueRetryable(function(){return $i(e,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return Vy("RemoteStore","Retrying IndexedDB access"),[4,i()];case 1:return t.sent(),n.$r.delete(1),[4,LS(n)];case 2:return t.sent(),[2]}})})}),[2]}})})}function zS(e,n){return n().catch(function(t){return GS(e,t,n)})}function QS(u){return $i(this,void 0,void 0,function(){var i,o,s,a;return Zi(this,function(t){switch(t.label){case 0:o=ZS(i=u),s=0<i.kr.length?i.kr[i.kr.length-1].batchId:-1,t.label=1;case 1:if(!(KS(i)&&i.kr.length<10))return[3,7];t.label=2;case 2:return t.trys.push([2,4,,6]),[4,(e=i.localStore,n=s,(r=e).persistence.runTransaction("Get next mutation batch","readonly",function(t){return void 0===n&&(n=-1),r._n.getNextMutationBatchAfterBatchId(t,n)}))];case 3:return null===(a=t.sent())?(0===i.kr.length&&o.ir(),[3,7]):(s=a.batchId,function(t,e){t.kr.push(e);t=ZS(t);t.er()&&t.pr&&t.Er(e.mutations)}(i,a),[3,6]);case 4:return a=t.sent(),[4,GS(i,a)];case 5:return t.sent(),[3,6];case 6:return[3,1];case 7:return YS(i)&&XS(i),[2]}var e,n,r})})}function YS(t){return KS(t)&&!ZS(t).tr()&&0<t.kr.length}function XS(t){ZS(t).start()}function JS(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=n,r?(e.$r.delete(2),[4,LS(e)]):[3,2];case 1:return t.sent(),[3,5];case 2:return r?[3,4]:(e.$r.add(2),[4,MS(e)]);case 3:t.sent(),e.Br.set("Unknown"),t.label=4;case 4:t.label=5;case 5:return[2]}})})}function $S(n){var t,e,r,i=this;return n.Ur||(n.Ur=(t=n.datastore,e=n.asyncQueue,r={Ii:function(n){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return n.Or.forEach(function(t,e){jS(n,t)}),[2]})})}.bind(null,n),Ri:function(e,n){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return WS(e),BS(e)?(e.Br.Nr(n),VS(e)):e.Br.set("Unknown"),[2]})})}.bind(null,n),_r:HS.bind(null,n)},t.br(),new SS(e,t.Hi,t.credentials,t.R,r)),n.Mr.push(function(e){return $i(i,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return e?(n.Ur.sr(),BS(n)?VS(n):n.Br.set("Unknown"),[3,3]):[3,1];case 1:return[4,n.Ur.stop()];case 2:t.sent(),WS(n),t.label=3;case 3:return[2]}})})})),n.Ur}function ZS(n){var t,e,r,i=this;return n.Qr||(n.Qr=(t=n.datastore,e=n.asyncQueue,r={Ii:function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return ZS(e).Ar(),[2]})})}.bind(null,n),Ri:function(e,n){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return n&&ZS(e).pr?[4,function(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return Ow(n=i.code)&&n!==My.ABORTED?(e=r.kr.shift(),ZS(r).sr(),[4,zS(r,function(){return r.remoteSyncer.rejectFailedWrite(e.batchId,i)})]):[3,3];case 1:return t.sent(),[4,QS(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}(e,n)]:[3,2];case 1:t.sent(),t.label=2;case 2:return YS(e)&&XS(e),[2]}})})}.bind(null,n),Ir:function(o){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){for(e=ZS(o),n=0,r=o.kr;n<r.length;n++)i=r[n],e.Er(i.mutations);return[2]})})}.bind(null,n),Tr:function(r,i,o){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=r.kr.shift(),n=RI.from(e,i,o),[4,zS(r,function(){return r.remoteSyncer.applySuccessfulWrite(n)})];case 1:return t.sent(),[4,QS(r)];case 2:return t.sent(),[2]}})})}.bind(null,n)},t.br(),new CS(e,t.Hi,t.credentials,t.R,r)),n.Mr.push(function(e){return $i(i,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return e?(n.Qr.sr(),[4,QS(n)]):[3,2];case 1:return t.sent(),[3,4];case 2:return[4,n.Qr.stop()];case 3:t.sent(),0<n.kr.length&&(Vy("RemoteStore","Stopping write stream with "+n.kr.length+" pending writes"),n.kr=[]),t.label=4;case 4:return[2]}})})})),n.Qr}var tC=(eC.createAndSchedule=function(t,e,n,r,i){i=new eC(t,e,Date.now()+n,r,i);return i.start(n),i},eC.prototype.start=function(t){var e=this;this.timerHandle=setTimeout(function(){return e.handleDelayElapsed()},t)},eC.prototype.skipDelay=function(){return this.handleDelayElapsed()},eC.prototype.cancel=function(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Fy(My.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},eC.prototype.handleDelayElapsed=function(){var e=this;this.asyncQueue.enqueueAndForget(function(){return null!==e.timerHandle?(e.clearTimeout(),e.op().then(function(t){return e.deferred.resolve(t)})):Promise.resolve()})},eC.prototype.clearTimeout=function(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)},eC);function eC(t,e,n,r,i){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new aI,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(function(t){})}function nC(t,e){if(By("AsyncQueue",e+": "+t),bI(t))return new Fy(My.UNAVAILABLE,e+": "+t);throw t}function rC(){this.queries=new DT(Fb,Mb),this.onlineState="Unknown",this.Gr=new Set}var iC=(hC.emptySet=function(t){return new hC(t.comparator)},hC.prototype.has=function(t){return null!=this.keyedMap.get(t)},hC.prototype.get=function(t){return this.keyedMap.get(t)},hC.prototype.first=function(){return this.sortedSet.minKey()},hC.prototype.last=function(){return this.sortedSet.maxKey()},hC.prototype.isEmpty=function(){return this.sortedSet.isEmpty()},hC.prototype.indexOf=function(t){t=this.keyedMap.get(t);return t?this.sortedSet.indexOf(t):-1},Object.defineProperty(hC.prototype,"size",{get:function(){return this.sortedSet.size},enumerable:!1,configurable:!0}),hC.prototype.forEach=function(n){this.sortedSet.inorderTraversal(function(t,e){return n(t),!1})},hC.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))},hC.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this},hC.prototype.isEqual=function(t){if(!(t instanceof hC))return!1;if(this.size!==t.size)return!1;for(var e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();e.hasNext();){var r=e.getNext().key,i=n.getNext().key;if(!r.isEqual(i))return!1}return!0},hC.prototype.toString=function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"},hC.prototype.copy=function(t,e){var n=new hC;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n},hC),oC=(cC.prototype.track=function(t){var e=t.doc.key,n=this.Kr.get(e);!n||0!==t.type&&3===n.type?this.Kr=this.Kr.insert(e,t):3===t.type&&1!==n.type?this.Kr=this.Kr.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Kr=this.Kr.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Kr=this.Kr.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Kr=this.Kr.remove(e):1===t.type&&2===n.type?this.Kr=this.Kr.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Kr=this.Kr.insert(e,{type:2,doc:t.doc}):Hy()},cC.prototype.jr=function(){var n=[];return this.Kr.inorderTraversal(function(t,e){n.push(e)}),n},cC),sC=(uC.fromInitialDocuments=function(t,e,n,r){var i=[];return e.forEach(function(t){i.push({type:0,doc:t})}),new uC(t,e,iC.emptySet(e),i,n,r,!0,!1)},Object.defineProperty(uC.prototype,"hasPendingWrites",{get:function(){return!this.mutatedKeys.isEmpty()},enumerable:!1,configurable:!0}),uC.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&Mb(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))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},uC),aC=function(){this.Wr=void 0,this.listeners=[]};function uC(t,e,n,r,i,o,s,a){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=s,this.excludesMetadataChanges=a}function cC(){this.Kr=new xw(Cm.comparator)}function hC(n){this.comparator=n?function(t,e){return n(t,e)||Cm.comparator(t.key,e.key)}:function(t,e){return Cm.comparator(t.key,e.key)},this.keyedMap=Gw,this.sortedSet=new xw(this.comparator)}function lC(s,a){return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:if(e=s,n=a.query,r=!1,(i=e.queries.get(n))||(r=!0,i=new aC),!r)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),o=i,[4,e.onListen(n)];case 2:return o.Wr=t.sent(),[3,4];case 3:return o=t.sent(),o=nC(o,"Initialization of query '"+Ub(a.query)+"' failed"),[2,void a.onError(o)];case 4:return e.queries.set(n,i),i.listeners.push(a),a.zr(e.onlineState),i.Wr&&a.Hr(i.Wr)&&pC(e),[2]}})})}function fC(s,a){return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){return e=s,n=a.query,r=!1,(i=e.queries.get(n))&&0<=(o=i.listeners.indexOf(a))&&(i.listeners.splice(o,1),r=0===i.listeners.length),r?[2,(e.queries.delete(n),e.onUnlisten(n))]:[2]})})}function pC(t){t.Gr.forEach(function(t){t.next()})}var dC=(_C.prototype.Hr=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 sC(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0)}var o=!1;return this.Yr?this.Zr(t)&&(this.Jr.next(t),o=!0):this.eo(t,this.onlineState)&&(this.no(t),o=!0),this.Xr=t,o},_C.prototype.onError=function(t){this.Jr.error(t)},_C.prototype.zr=function(t){this.onlineState=t;var e=!1;return this.Xr&&!this.Yr&&this.eo(this.Xr,t)&&(this.no(this.Xr),e=!0),e},_C.prototype.eo=function(t,e){if(!t.fromCache)return!0;var n="Offline"!==e;return!(this.options.so&&n||t.docs.isEmpty()&&"Offline"!==e)},_C.prototype.Zr=function(t){if(0<t.docChanges.length)return!0;var e=this.Xr&&this.Xr.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges},_C.prototype.no=function(t){t=sC.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache),this.Yr=!0,this.Jr.next(t)},_C),vC=(wC.prototype.io=function(){return"metadata"in this.payload},wC),gC=(bC.prototype.qn=function(t){return b_(this.R,t)},bC.prototype.Un=function(t){return t.metadata.exists?S_(this.R,t.document,!1):Bm.newNoDocument(this.qn(t.metadata.name),this.Qn(t.metadata.readTime))},bC.prototype.Qn=v_,bC),yC=(mC.prototype.oo=function(t){this.progress.bytesLoaded+=t.byteLength;var e=this.progress.documentsLoaded;return t.payload.namedQuery?this.queries.push(t.payload.namedQuery):t.payload.documentMetadata?(this.documents.push({metadata:t.payload.documentMetadata}),t.payload.documentMetadata.exists||++e):t.payload.document&&(this.documents[this.documents.length-1].document=t.payload.document,++e),e!==this.progress.documentsLoaded?(this.progress.documentsLoaded=e,Object.assign({},this.progress)):null},mC.prototype.co=function(t){for(var e=new Map,n=new gC(this.R),r=0,i=t;r<i.length;r++){var o=i[r];if(o.metadata.queries)for(var s=n.qn(o.metadata.name),a=0,u=o.metadata.queries;a<u.length;a++){var c=u[a],h=(e.get(c)||Yw()).add(s);e.set(c,h)}}return e},mC.prototype.complete=function(){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return[4,function(l,f,p,d){return $i(this,void 0,void 0,function(){var n,r,i,o,e,s,a,u,c,h;return Zi(this,function(t){switch(t.label){case 0:for(n=l,r=Yw(),i=Kw,o=zw,e=0,s=p;e<s.length;e++)a=s[e],u=f.qn(a.metadata.name),a.document&&(r=r.add(u)),i=i.insert(u,f.Un(a)),o=o.insert(u,f.Qn(a.metadata.readTime));return c=n.$n.newChangeBuffer({trackRemovals:!0}),[4,pE(n,xb(Nb(am.fromString("__bundle__/docs/"+d))))];case 1:return h=t.sent(),[2,n.persistence.runTransaction("Apply bundle documents","readwrite",function(e){return fE(e,c,i,Zy.min(),o).next(function(t){return c.apply(e),t}).next(function(t){return n.qe.removeMatchingKeysForTargetId(e,h.targetId).next(function(){return n.qe.addMatchingKeys(e,r,h.targetId)}).next(function(){return n.Mn.En(e,t)}).next(function(){return t})})})]}})})}(this.localStore,new gC(this.R),this.documents,this.ro.id)];case 1:e=t.sent(),n=this.co(this.documents),r=0,i=this.queries,t.label=2;case 2:return r<i.length?(i=i[r],[4,function(e,i,o){return void 0===o&&(o=Yw()),$i(this,void 0,void 0,function(){var n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,pE(e,xb(HI(i.bundledQuery)))];case 1:return n=t.sent(),[2,(r=e).persistence.runTransaction("Save named query","readwrite",function(t){var e=v_(i.readTime);if(0<=n.snapshotVersion.compareTo(e))return r.Qe.saveNamedQuery(t,i);e=n.withResumeToken(lm.EMPTY_BYTE_STRING,e);return r.Fn=r.Fn.insert(e.targetId,e),r.qe.updateTargetData(t,e).next(function(){return r.qe.removeMatchingKeysForTargetId(t,n.targetId)}).next(function(){return r.qe.addMatchingKeys(t,o,n.targetId)}).next(function(){return r.Qe.saveNamedQuery(t,i)})})]}})})}(this.localStore,i,n.get(i.name))]):[3,5];case 3:t.sent(),t.label=4;case 4:return r++,[3,2];case 5:return[2,(this.progress.taskState="Success",new $T(Object.assign({},this.progress),e))]}})})},mC);function mC(t,e,n){this.ro=t,this.localStore=e,this.R=n,this.queries=[],this.documents=[],this.progress=IC(t)}function bC(t){this.R=t}function wC(t,e){this.payload=t,this.byteLength=e}function _C(t,e,n){this.query=t,this.Jr=e,this.Yr=!1,this.Xr=null,this.onlineState="Unknown",this.options=n||{}}function IC(t){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:t.totalDocuments,totalBytes:t.totalBytes}}var TC=function(t){this.key=t},EC=function(t){this.key=t},SC=(Object.defineProperty(RC.prototype,"wo",{get:function(){return this.uo},enumerable:!1,configurable:!0}),RC.prototype._o=function(t,e){var s=this,a=e?e.mo:new oC,u=(e||this).fo,c=(e||this).mutatedKeys,h=u,l=!1,f=Ab(this.query)&&u.size===this.query.limit?u.last():null,p=kb(this.query)&&u.size===this.query.limit?u.first():null;if(t.inorderTraversal(function(t,e){var n=u.get(t),r=jb(s.query,e)?e:null,i=!!n&&s.mutatedKeys.has(n.key),o=!!r&&(r.hasLocalMutations||s.mutatedKeys.has(r.key)&&r.hasCommittedMutations),e=!1;n&&r?n.data.isEqual(r.data)?i!==o&&(a.track({type:3,doc:r}),e=!0):s.yo(n,r)||(a.track({type:2,doc:r}),e=!0,(f&&0<s.lo(r,f)||p&&s.lo(r,p)<0)&&(l=!0)):!n&&r?(a.track({type:0,doc:r}),e=!0):n&&!r&&(a.track({type:1,doc:n}),e=!0,(f||p)&&(l=!0)),e&&(c=r?(h=h.add(r),o?c.add(t):c.delete(t)):(h=h.delete(t),c.delete(t)))}),Ab(this.query)||kb(this.query))for(;h.size>this.query.limit;){var n=Ab(this.query)?h.last():h.first(),h=h.delete(n.key),c=c.delete(n.key);a.track({type:1,doc:n})}return{fo:h,mo:a,Nn:l,mutatedKeys:c}},RC.prototype.yo=function(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations},RC.prototype.applyChanges=function(t,e,n){var o=this,r=this.fo;this.fo=t.fo,this.mutatedKeys=t.mutatedKeys;var i=t.mo.jr();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.lo(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 Hy()}}var r,i}),this.po(n);var s=e?this.Eo():[],n=0===this.ho.size&&this.current?1:0,e=n!==this.ao;return this.ao=n,0!==i.length||e?{snapshot:new sC(this.query,t.fo,r,i,t.mutatedKeys,0==n,e,!1),To:s}:{To:s}},RC.prototype.zr=function(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({fo:this.fo,mo:new oC,mutatedKeys:this.mutatedKeys,Nn:!1},!1)):{To:[]}},RC.prototype.Io=function(t){return!this.uo.has(t)&&!!this.fo.has(t)&&!this.fo.get(t).hasLocalMutations},RC.prototype.po=function(t){var e=this;t&&(t.addedDocuments.forEach(function(t){return e.uo=e.uo.add(t)}),t.modifiedDocuments.forEach(function(t){}),t.removedDocuments.forEach(function(t){return e.uo=e.uo.delete(t)}),this.current=t.current)},RC.prototype.Eo=function(){var e=this;if(!this.current)return[];var n=this.ho;this.ho=Yw(),this.fo.forEach(function(t){e.Io(t.key)&&(e.ho=e.ho.add(t.key))});var r=[];return n.forEach(function(t){e.ho.has(t)||r.push(new EC(t))}),this.ho.forEach(function(t){n.has(t)||r.push(new TC(t))}),r},RC.prototype.Ao=function(t){this.uo=t.Bn,this.ho=Yw();t=this._o(t.documents);return this.applyChanges(t,!0)},RC.prototype.Ro=function(){return sC.fromInitialDocuments(this.query,this.fo,this.mutatedKeys,0===this.ao)},RC),CC=function(t,e,n){this.query=t,this.targetId=e,this.view=n},NC=function(t){this.key=t,this.bo=!1},AC=(Object.defineProperty(kC.prototype,"isPrimaryClient",{get:function(){return!0===this.Oo},enumerable:!1,configurable:!0}),kC);function kC(t,e,n,r,i,o){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.vo={},this.Po=new DT(Fb,Mb),this.Vo=new Map,this.So=new Set,this.Do=new xw(Cm.comparator),this.Co=new Map,this.No=new IE,this.xo={},this.Fo=new Map,this.ko=dT.Yt(),this.onlineState="Unknown",this.Oo=void 0}function RC(t,e){this.query=t,this.uo=e,this.ao=null,this.current=!1,this.ho=Yw(),this.mutatedKeys=Yw(),this.lo=qb(t),this.fo=new iC(this.lo)}function PC(i,o,s,a){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return i.$o=function(t,e,n){return function(r,i,o,s){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return(e=i.view._o(o)).Nn?[4,vE(r.localStore,i.query,!1).then(function(t){t=t.documents;return i.view._o(t,e)})]:[3,2];case 1:e=t.sent(),t.label=2;case 2:return n=s&&s.targetChanges.get(i.targetId),n=i.view.applyChanges(e,r.isPrimaryClient,n),[2,(VC(r,i.targetId,n.To),n.snapshot)]}})})}(i,t,e,n)},[4,vE(i.localStore,o,!0)];case 1:return n=t.sent(),r=new SC(o,n.Bn),e=r._o(n.documents),n=$w.createSynthesizedTargetChangeForCurrentChange(s,a&&"Offline"!==i.onlineState),n=r.applyChanges(e,i.isPrimaryClient,n),VC(i,s,n.To),r=new CC(o,s,r),[2,(i.Po.set(o,r),i.Vo.has(s)?i.Vo.get(s).push(o):i.Vo.set(s,[o]),n.snapshot)]}})})}function OC(f,p,d){return $i(this,void 0,void 0,function(){var s,l;return Zi(this,function(t){switch(t.label){case 0:l=XC(f),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,(i=l.localStore,a=p,c=i,h=$y.now(),o=a.reduce(function(t,e){return t.add(e.key)},Yw()),c.persistence.runTransaction("Locally write mutations","readwrite",function(s){return c.Mn.pn(s,o).next(function(t){u=t;for(var e=[],n=0,r=a;n<r.length;n++){var i=r[n],o=function(t,e){for(var n=null,r=0,i=t.fieldTransforms;r<i.length;r++){var o=i[r],s=e.data.field(o.field),s=Wb(o.transform,s||null);null!=s&&(n=null==n?qm.empty():n).set(o.field,s)}return n||null}(i,u.get(i.key));null!=o&&e.push(new mw(i.key,o,function s(t){var a=[];return rm(t.fields||{},function(t,e){var n=new cm([t]);if(jm(e))if(0===(e=s(e.mapValue).fields).length)a.push(n);else for(var r=0,i=e;r<i.length;r++){var o=i[r];a.push(n.child(o))}else a.push(n)}),new hm(a)}(o.toProto().mapValue),cw.exists(!0)))}return c._n.addMutationBatch(s,h,e,a)})}).then(function(t){return t.applyToLocalDocumentSet(u),{batchId:t.batchId,changes:u}}))];case 2:return s=t.sent(),l.sharedClientState.addPendingMutation(s.batchId),e=l,n=s.batchId,r=d,i=(i=(i=e.xo[e.currentUser.toKey()])||new xw(Yy)).insert(n,r),e.xo[e.currentUser.toKey()]=i,[4,KC(l,s.changes)];case 3:return t.sent(),[4,QS(l.remoteStore)];case 4:return t.sent(),[3,6];case 5:return l=t.sent(),l=nC(l,"Failed to persist write"),d.reject(l),[3,6];case 6:return[2]}var e,n,r,i,a,u,c,h,o})})}function DC(r,i){return $i(this,void 0,void 0,function(){var n,e;return Zi(this,function(t){switch(t.label){case 0:n=r,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,lE(n.localStore,i)];case 2:return e=t.sent(),i.targetChanges.forEach(function(t,e){e=n.Co.get(e);e&&(Gy(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),0<t.addedDocuments.size?e.bo=!0:0<t.modifiedDocuments.size?Gy(e.bo):0<t.removedDocuments.size&&(Gy(e.bo),e.bo=!1))}),[4,KC(n,e,i)];case 3:return t.sent(),[3,6];case 4:return[4,_T(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}function xC(t,n,e){var r,t=t;(t.isPrimaryClient&&0===e||!t.isPrimaryClient&&1===e)&&(r=[],t.Po.forEach(function(t,e){e=e.view.zr(n);e.snapshot&&r.push(e.snapshot)}),function(t,i){t.onlineState=i;var o=!1;t.queries.forEach(function(t,e){for(var n=0,r=e.listeners;n<r.length;n++)r[n].zr(i)&&(o=!0)}),o&&pC(t)}(t.eventManager,n),r.length&&t.vo._r(r),t.onlineState=n,t.isPrimaryClient&&t.sharedClientState.setOnlineState(n))}function LC(s,a,u){return $i(this,void 0,void 0,function(){var n,o;return Zi(this,function(t){switch(t.label){case 0:n=s,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,(e=n.localStore,r=a,(i=e).persistence.runTransaction("Reject batch","readwrite-primary",function(e){var n;return i._n.lookupMutationBatch(e,r).next(function(t){return Gy(null!==t),n=t.keys(),i._n.removeMutationBatch(e,t)}).next(function(){return i._n.performConsistencyCheck(e)}).next(function(){return i.Mn.pn(e,n)})}))];case 2:return o=t.sent(),UC(n,a,u),FC(n,a),n.sharedClientState.updateMutationState(a,"rejected",u),[4,KC(n,o)];case 3:return t.sent(),[3,6];case 4:return[4,_T(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}var e,r,i})})}function MC(o,s){return $i(this,void 0,void 0,function(){var n,r,i;return Zi(this,function(t){switch(t.label){case 0:KS((n=o).remoteStore)||Vy("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,(e=n.localStore).persistence.runTransaction("Get highest unacknowledged batch id","readonly",function(t){return e._n.getHighestUnacknowledgedBatchId(t)})];case 2:return-1===(r=t.sent())?[2,void s.resolve()]:((i=n.Fo.get(r)||[]).push(s),n.Fo.set(r,i),[3,4]);case 3:return i=t.sent(),i=nC(i,"Initialization of waitForPendingWrites() operation failed"),s.reject(i),[3,4];case 4:return[2]}var e})})}function FC(t,e){(t.Fo.get(e)||[]).forEach(function(t){t.resolve()}),t.Fo.delete(e)}function UC(t,e,n){var r=t,i=r.xo[r.currentUser.toKey()];i&&((t=i.get(e))&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.xo[r.currentUser.toKey()]=i)}function jC(e,t,n){void 0===n&&(n=null),e.sharedClientState.removeLocalQueryTarget(t);for(var r=0,i=e.Vo.get(t);r<i.length;r++){var o=i[r];e.Po.delete(o),n&&e.vo.Mo(o,n)}e.Vo.delete(t),e.isPrimaryClient&&e.No.Zn(t).forEach(function(t){e.No.containsKey(t)||qC(e,t)})}function qC(t,e){t.So.delete(e.path.canonicalString());var n=t.Do.get(e);null!==n&&(US(t.remoteStore,n),t.Do=t.Do.remove(e),t.Co.delete(n),BC(t))}function VC(t,e,n){for(var r,i,o,s=0,a=n;s<a.length;s++){var u=a[s];u instanceof TC?(t.No.addReference(u.key,e),r=t,o=void 0,i=(o=(i=u).key).path.canonicalString(),r.Do.get(o)||r.So.has(i)||(Vy("SyncEngine","New document in limbo: "+o),r.So.add(i),BC(r))):u instanceof EC?(Vy("SyncEngine","Document no longer in limbo: "+u.key),t.No.removeReference(u.key,e),t.No.containsKey(u.key)||qC(t,u.key)):Hy()}}function BC(t){for(;0<t.So.size&&t.Do.size<t.maxConcurrentLimboResolutions;){var e=t.So.values().next().value;t.So.delete(e);var n=new Cm(am.fromString(e)),e=t.ko.next();t.Co.set(e,new NC(n)),t.Do=t.Do.insert(n,e),FS(t.remoteStore,new PI(xb(Nb(n.path)),e,2,Dy.o))}}function KC(e,s,a){return $i(this,void 0,void 0,function(){var n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return r=[],i=[],o=[],(n=e).Po.isEmpty()?[3,3]:(n.Po.forEach(function(t,e){o.push(n.$o(e,s,a).then(function(t){t&&(n.isPrimaryClient&&n.sharedClientState.updateQueryState(e.targetId,t.fromCache?"not-current":"current"),r.push(t),t=tE.Pn(e.targetId,t),i.push(t))}))}),[4,Promise.all(o)]);case 1:return t.sent(),n.vo._r(r),[4,function(u,c){return $i(this,void 0,void 0,function(){var r,e,n,i,o,s,a;return Zi(this,function(t){switch(t.label){case 0:r=u,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,r.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(n){return uI.forEach(c,function(e){return uI.forEach(e.bn,function(t){return r.persistence.referenceDelegate.addReference(n,e.targetId,t)}).next(function(){return uI.forEach(e.vn,function(t){return r.persistence.referenceDelegate.removeReference(n,e.targetId,t)})})})})];case 2:return t.sent(),[3,4];case 3:if(!bI(e=t.sent()))throw e;return Vy("LocalStore","Failed to update sequence numbers: "+e),[3,4];case 4:for(n=0,i=c;n<i.length;n++)a=i[n],o=a.targetId,a.fromCache||(s=r.Fn.get(o),a=s.snapshotVersion,a=s.withLastLimboFreeSnapshotVersion(a),r.Fn=r.Fn.insert(o,a));return[2]}})})}(n.localStore,i)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}function WC(i,o){return $i(this,void 0,void 0,function(){var n,r;return Zi(this,function(t){switch(t.label){case 0:return(n=i).currentUser.isEqual(o)?[3,3]:(Vy("SyncEngine","User change. New user:",o.toKey()),[4,uE(n.localStore,o)]);case 1:return r=t.sent(),n.currentUser=o,(e=n).Fo.forEach(function(t){t.forEach(function(t){t.reject(new Fy(My.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.Fo.clear(),n.sharedClientState.handleUserChange(o,r.removedBatchIds,r.addedBatchIds),[4,KC(n,r.Ln)];case 2:t.sent(),t.label=3;case 3:return[2]}var e})})}function HC(a,u,c,h){return $i(this,void 0,void 0,function(){var o,s;return Zi(this,function(t){switch(t.label){case 0:return[4,(e=(o=a).localStore,n=u,i=(r=e)._n,r.persistence.runTransaction("Lookup mutation documents","readonly",function(e){return i.jt(e,n).next(function(t){return t?r.Mn.pn(e,t):uI.resolve(null)})}))];case 1:return null===(s=t.sent())?[3,6]:"pending"!==c?[3,3]:[4,QS(o.remoteStore)];case 2:return t.sent(),[3,4];case 3:"acknowledged"===c||"rejected"===c?(UC(o,u,h||null),FC(o,u),o.localStore._n.Gt(u)):Hy(),t.label=4;case 4:return[4,KC(o,s)];case 5:return t.sent(),[3,7];case 6:Vy("SyncEngine","Cannot apply mutation batch with id: "+u),t.label=7;case 7:return[2]}var e,n,r,i})})}function GC(h,l){return $i(this,void 0,void 0,function(){var r,e,i,o,s,a,u,c;return Zi(this,function(t){switch(t.label){case 0:return YC(r=h),XC(r),!0!==l||!0===r.Oo?[3,3]:(e=r.sharedClientState.getAllActiveQueryTargets(),[4,zC(r,e.toArray())]);case 1:return i=t.sent(),r.Oo=!0,[4,JS(r.remoteStore,!0)];case 2:for(t.sent(),o=0,s=i;o<s.length;o++)a=s[o],FS(r.remoteStore,a);return[3,7];case 3:return!1!==l||!1===r.Oo?[3,7]:(u=[],c=Promise.resolve(),r.Vo.forEach(function(t,e){r.sharedClientState.isLocalQueryTarget(e)?u.push(e):c=c.then(function(){return jC(r,e),dE(r.localStore,e,!0)}),US(r.remoteStore,e)}),[4,c]);case 4:return t.sent(),[4,zC(r,u)];case 5:return t.sent(),(n=r).Co.forEach(function(t,e){US(n.remoteStore,e)}),n.No.ts(),n.Co=new Map,n.Do=new xw(Cm.comparator),r.Oo=!1,[4,JS(r.remoteStore,!1)];case 6:t.sent(),t.label=7;case 7:return[2]}var n})})}function zC(p,d){return $i(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l,f;return Zi(this,function(t){switch(t.label){case 0:e=p,n=[],r=[],i=0,o=d,t.label=1;case 1:return i<o.length?(s=o[i],a=void 0,(u=e.Vo.get(s))&&0!==u.length?[4,pE(e.localStore,xb(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],l=e.Po.get(l),[4,function(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,vE((e=r).localStore,i.query,!0)];case 1:return n=t.sent(),n=i.view.Ao(n),[2,(e.isPrimaryClient&&VC(e,i.targetId,n.To),n)]}})})}(e,l)]):[3,6];case 4:(l=t.sent()).snapshot&&r.push(l.snapshot),t.label=5;case 5:return c++,[3,3];case 6:return[3,11];case 7:return[4,gE(e.localStore,s)];case 8:return f=t.sent(),[4,pE(e.localStore,f)];case 9:return a=t.sent(),[4,PC(e,QC(f),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.vo._r(r),n)]}})})}function QC(t){return Cb(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)}function YC(t){return t.remoteStore.remoteSyncer.applyRemoteEvent=DC.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=function(t,e){var n=t;if((t=n.Co.get(e))&&t.bo)return Yw().add(t.key);var r=Yw();if(!(e=n.Vo.get(e)))return r;for(var i=0,o=e;i<o.length;i++)var s=o[i],s=n.Po.get(s),r=r.unionWith(s.view.wo);return r}.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=function(o,s,a){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return(e=o).sharedClientState.updateQueryState(s,"rejected",a),i=e.Co.get(s),(n=i&&i.key)?(r=(r=new xw(Cm.comparator)).insert(n,Bm.newNoDocument(n,Zy.min())),i=Yw().add(n),i=new Jw(Zy.min(),new Map,new Vw(Yy),r,i),[4,DC(e,i)]):[3,2];case 1:return t.sent(),e.Do=e.Do.remove(n),e.Co.delete(s),BC(e),[3,4];case 2:return[4,dE(e.localStore,s,!1).then(function(){return jC(e,s,a)}).catch(_T)];case 3:t.sent(),t.label=4;case 4:return[2]}})})}.bind(null,t),t.vo._r=function(t,e){for(var n=t,r=!1,i=0,o=e;i<o.length;i++){var s=o[i],a=s.query,a=n.queries.get(a);if(a){for(var u=0,c=a.listeners;u<c.length;u++)c[u].Hr(s)&&(r=!0);a.Wr=s}}r&&pC(n)}.bind(null,t.eventManager),t.vo.Mo=function(t,e,n){var r=t;if(t=r.queries.get(e))for(var i=0,o=t.listeners;i<o.length;i++)o[i].onError(n);r.queries.delete(e)}.bind(null,t.eventManager),t}function XC(t){return t.remoteStore.remoteSyncer.applySuccessfulWrite=function(i,o){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:e=i,n=o.batch.batchId,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,cE(e.localStore,o)];case 2:return r=t.sent(),UC(e,n,null),FC(e,n),e.sharedClientState.updateMutationState(n,"acknowledged"),[4,KC(e,r)];case 3:return t.sent(),[3,6];case 4:return[4,_T(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=LC.bind(null,t),t}function JC(t,e,n){var r=t;!function(f,p,d){return $i(this,void 0,void 0,function(){var a,u,c,h,l;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,14,,15]),[4,p.getMetadata()];case 1:return a=t.sent(),[4,(r=f.localStore,o=r,s=v_((i=a).createTime),o.persistence.runTransaction("hasNewerBundle","readonly",function(t){return o.Qe.getBundleMetadata(t,i.id)}).then(function(t){return!!t&&0<=t.createTime.compareTo(s)}))];case 2:return t.sent()?[4,p.close()]:[3,4];case 3:return[2,(t.sent(),void d._completeWith({taskState:"Success",documentsLoaded:a.totalDocuments,bytesLoaded:a.totalBytes,totalDocuments:a.totalDocuments,totalBytes:a.totalBytes}))];case 4:return d._updateProgress(IC(a)),u=new yC(a,f.localStore,p.R),[4,p.Lo()];case 5:c=t.sent(),t.label=6;case 6:return c?[4,u.oo(c)]:[3,10];case 7:return(h=t.sent())&&d._updateProgress(h),[4,p.Lo()];case 8:c=t.sent(),t.label=9;case 9:return[3,6];case 10:return[4,u.complete()];case 11:return l=t.sent(),[4,KC(f,l.wn,void 0)];case 12:return t.sent(),[4,(r=f.localStore,e=a,(n=r).persistence.runTransaction("Save bundle","readwrite",function(t){return n.Qe.saveBundleMetadata(t,e)}))];case 13:return t.sent(),d._completeWith(l.progress),[3,15];case 14:return Ky("SyncEngine","Loading bundle failed with "+(l=t.sent())),d._failWith(l),[3,15];case 15:return[2]}var e,n,r,i,o,s})})}(r,e,n).then(function(){r.sharedClientState.notifyBundleLoaded()})}var $C,ZC,tN=(aN.prototype.initialize=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.R=bS(e.databaseInfo.databaseId),this.sharedClientState=this.Bo(e),this.persistence=this.qo(e),[4,this.persistence.start()];case 1:return t.sent(),this.gcScheduler=this.Uo(e),this.localStore=this.Qo(e),[2]}})})},aN.prototype.Uo=function(t){return null},aN.prototype.Qo=function(t){return aE(this.persistence,new eE,t.initialUser,this.R)},aN.prototype.qo=function(t){return new AE(RE.bs,this.R)},aN.prototype.Bo=function(t){return new ZE},aN.prototype.terminate=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.gcScheduler&&this.gcScheduler.stop(),[4,this.sharedClientState.shutdown()];case 1:return t.sent(),[4,this.persistence.shutdown()];case 2:return t.sent(),[2]}})})},aN),eN=(Xi(sN,ZC=tN),sN.prototype.initialize=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,ZC.prototype.initialize.call(this,e)];case 1:return t.sent(),[4,mE(this.localStore)];case 2:return t.sent(),[4,this.Ko.initialize(this,e)];case 3:return t.sent(),[4,XC(this.Ko.syncEngine)];case 4:return t.sent(),[4,QS(this.Ko.remoteStore)];case 5:return t.sent(),[2]}})})},sN.prototype.Qo=function(t){return aE(this.persistence,new eE,t.initialUser,this.R)},sN.prototype.Uo=function(t){var e=this.persistence.referenceDelegate.garbageCollector;return new ET(e,t.asyncQueue)},sN.prototype.qo=function(t){var e=JT(t.databaseInfo.databaseId,t.databaseInfo.persistenceKey),n=void 0!==this.cacheSizeBytes?iT.withCacheSize(this.cacheSizeBytes):iT.DEFAULT;return new zT(this.synchronizeTabs,e,t.clientId,n,t.asyncQueue,yS(),mS(),this.R,this.sharedClientState,!!this.forceOwnership)},sN.prototype.Bo=function(t){return new ZE},sN),nN=(Xi(oN,$C=eN),oN.prototype.initialize=function(r){return $i(this,void 0,void 0,function(){var e,n=this;return Zi(this,function(t){switch(t.label){case 0:return[4,$C.prototype.initialize.call(this,r)];case 1:return t.sent(),e=this.Ko.syncEngine,this.sharedClientState instanceof $E?(this.sharedClientState.syncEngine={ui:HC.bind(null,e),ai:function(i,o,s,a){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return(e=i).Oo?(Vy("SyncEngine","Ignoring unexpected query state notification."),[3,8]):[3,1];case 1:if(!e.Vo.has(o))return[3,8];switch(s){case"current":case"not-current":return[3,2];case"rejected":return[3,5]}return[3,7];case 2:return[4,yE(e.localStore)];case 3:return n=t.sent(),r=Jw.createSynthesizedRemoteEventForCurrentChange(o,"current"===s),[4,KC(e,n,r)];case 4:return t.sent(),[3,8];case 5:return[4,dE(e.localStore,o,!0)];case 6:return t.sent(),jC(e,o,a),[3,8];case 7:Hy(),t.label=8;case 8:return[2]}})})}.bind(null,e),hi:function(c,h,l){return $i(this,void 0,void 0,function(){var n,e,r,i,o,s,a,u;return Zi(this,function(t){switch(t.label){case 0:if(!(n=YC(c)).Oo)return[3,10];e=0,r=h,t.label=1;case 1:return e<r.length?(r=r[e],n.Vo.has(r)?(Vy("SyncEngine","Adding an already active target "+r),[3,5]):[4,gE(n.localStore,r)]):[3,6];case 2:return i=t.sent(),[4,pE(n.localStore,i)];case 3:return o=t.sent(),[4,PC(n,QC(i),o.targetId,!1)];case 4:t.sent(),FS(n.remoteStore,o),t.label=5;case 5:return e++,[3,1];case 6:s=function(e){return Zi(this,function(t){switch(t.label){case 0:return n.Vo.has(e)?[4,dE(n.localStore,e,!1).then(function(){US(n.remoteStore,e),jC(n,e)}).catch(_T)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})},a=0,u=l,t.label=7;case 7:return a<u.length?(u=u[a],[5,s(u)]):[3,10];case 8:t.sent(),t.label=9;case 9:return a++,[3,7];case 10:return[2]}})})}.bind(null,e),fn:function(t){return t.localStore.persistence.fn()}.bind(null,e),ci:function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){return[2,yE((e=n).localStore).then(function(t){return KC(e,t)})]})})}.bind(null,e)},[4,this.sharedClientState.start()]):[3,3];case 2:t.sent(),t.label=3;case 3:return[4,this.persistence.He(function(e){return $i(n,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,GC(this.Ko.syncEngine,e)];case 1:return t.sent(),this.gcScheduler&&(e&&!this.gcScheduler.started?this.gcScheduler.start(this.localStore):e||this.gcScheduler.stop()),[2]}})})})];case 4:return t.sent(),[2]}})})},oN.prototype.Bo=function(t){var e=yS();if(!$E.yt(e))throw new Fy(My.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var n=JT(t.databaseInfo.databaseId,t.databaseInfo.persistenceKey);return new $E(e,t.asyncQueue,n,t.clientId,t.initialUser)},oN),rN=(iN.prototype.initialize=function(n,r){return $i(this,void 0,void 0,function(){var e=this;return Zi(this,function(t){switch(t.label){case 0:return this.localStore?[3,2]:(this.localStore=n.localStore,this.sharedClientState=n.sharedClientState,this.datastore=this.createDatastore(r),this.remoteStore=this.createRemoteStore(r),this.eventManager=this.createEventManager(r),this.syncEngine=this.createSyncEngine(r,!n.synchronizeTabs),this.sharedClientState.onlineStateHandler=function(t){return xC(e.syncEngine,t,1)},this.remoteStore.remoteSyncer.handleCredentialChange=WC.bind(null,this.syncEngine),[4,JS(this.remoteStore,this.syncEngine.isPrimaryClient)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},iN.prototype.createEventManager=function(t){return new rC},iN.prototype.createDatastore=function(t){var e=bS(t.databaseInfo.databaseId),n=(n=t.databaseInfo,new iS(n));return t=t.credentials,new NS(t,n,e)},iN.prototype.createRemoteStore=function(t){var e=this,n=this.localStore,r=this.datastore,i=t.asyncQueue,o=function(t){return xC(e.syncEngine,t,0)},t=new(eS.yt()?eS:tS);return new wS(n,r,i,o,t)},iN.prototype.createSyncEngine=function(t,e){return function(t,e,n,r,i,o,s){o=new AC(t,e,n,r,i,o);return s&&(o.Oo=!0),o}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)},iN.prototype.terminate=function(){return function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=n,Vy("RemoteStore","RemoteStore shutting down."),e.$r.add(5),[4,MS(e)];case 1:return t.sent(),e.Lr.shutdown(),e.Br.set("Unknown"),[2]}})})}(this.remoteStore)},iN);function iN(){}function oN(t,e){var n=this;return(n=$C.call(this,t,e,!1)||this).Ko=t,n.cacheSizeBytes=e,n.synchronizeTabs=!0,n}function sN(t,e,n){var r=this;return(r=ZC.call(this)||this).Ko=t,r.cacheSizeBytes=e,r.forceOwnership=n,r.synchronizeTabs=!1,r}function aN(){this.synchronizeTabs=!1}function uN(n,r){void 0===r&&(r=10240);var i=0;return{read:function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){return i<n.byteLength?(e={value:n.slice(i,i+r),done:!1},[2,(i+=r,e)]):[2,{done:!0}]})})},cancel:function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return[2]})})},releaseLock:function(){},closed:Promise.reject("unimplemented")}}var cN=(mN.prototype.next=function(t){this.observer.next&&this.jo(this.observer.next,t)},mN.prototype.error=function(t){this.observer.error?this.jo(this.observer.error,t):console.error("Uncaught Error in snapshot listener:",t)},mN.prototype.Wo=function(){this.muted=!0},mN.prototype.jo=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},mN),hN=(yN.prototype.close=function(){return this.Go.cancel()},yN.prototype.getMetadata=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return[2,this.metadata.promise]})})},yN.prototype.Lo=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,this.getMetadata()];case 1:return[2,(t.sent(),this.Ho())]}})})},yN.prototype.Ho=function(){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,this.Jo()];case 1:return null===(e=t.sent())?[2,null]:(r=this.zo.decode(e),n=Number(r),isNaN(n)&&this.Yo("length string ("+r+") is not valid number"),[4,this.Xo(n)]);case 2:return r=t.sent(),[2,new vC(JSON.parse(r),e.length+n)]}})})},yN.prototype.Zo=function(){return this.buffer.findIndex(function(t){return t==="{".charCodeAt(0)})},yN.prototype.Jo=function(){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return this.Zo()<0?[4,this.tc()]:[3,3];case 1:if(t.sent())return[3,3];t.label=2;case 2:return[3,0];case 3:return 0===this.buffer.length?[2,null]:((e=this.Zo())<0&&this.Yo("Reached the end of bundle when a length string is expected."),n=this.buffer.slice(0,e),[2,(this.buffer=this.buffer.slice(e),n)])}})})},yN.prototype.Xo=function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return this.buffer.length<n?[4,this.tc()]:[3,3];case 1:t.sent()&&this.Yo("Reached the end of bundle when more is expected."),t.label=2;case 2:return[3,0];case 3:return e=this.zo.decode(this.buffer.slice(0,n)),[2,(this.buffer=this.buffer.slice(n),e)]}})})},yN.prototype.Yo=function(t){throw this.Go.cancel(),new Error("Invalid bundle format: "+t)},yN.prototype.tc=function(){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,this.Go.read()];case 1:return(e=t.sent()).done||((n=new Uint8Array(this.buffer.length+e.value.length)).set(this.buffer),n.set(e.value,this.buffer.length),this.buffer=n),[2,e.done]}})})},yN),lN=(gN.prototype.lookup=function(r){return $i(this,void 0,void 0,function(){var e,n=this;return Zi(this,function(t){switch(t.label){case 0:if(this.ensureCommitNotCalled(),0<this.mutations.length)throw new Fy(My.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(s,a){return $i(this,void 0,void 0,function(){var n,e,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return e=I_((n=s).R)+"/documents",r={documents:a.map(function(t){return m_(n.R,t)})},[4,n.Oi("BatchGetDocuments",e,r)];case 1:return r=t.sent(),i=new Map,r.forEach(function(t){var e,t=(e=n.R,"found"in(t=t)?function(t,e){Gy(!!e.found),e.found.name,e.found.updateTime;var n=b_(t,e.found.name),t=v_(e.found.updateTime),e=new qm({mapValue:{fields:e.found.fields}});return Bm.newFoundDocument(n,t,e)}(e,t):"missing"in t?function(t,e){Gy(!!e.missing),Gy(!!e.readTime);t=b_(t,e.missing),e=v_(e.readTime);return Bm.newNoDocument(t,e)}(e,t):Hy());i.set(t.key.toString(),t)}),o=[],[2,(a.forEach(function(t){t=i.get(t.toString());Gy(!!t),o.push(t)}),o)]}})})}(this.datastore,r)];case 1:return[2,((e=t.sent()).forEach(function(t){return n.recordVersion(t)}),e)]}})})},gN.prototype.set=function(t,e){this.write(e.toMutation(t,this.precondition(t))),this.writtenDocs.add(t.toString())},gN.prototype.update=function(t,e){try{this.write(e.toMutation(t,this.preconditionForUpdate(t)))}catch(t){this.lastWriteError=t}this.writtenDocs.add(t.toString())},gN.prototype.delete=function(t){this.write(new Aw(t,this.precondition(t))),this.writtenDocs.add(t.toString())},gN.prototype.commit=function(){return $i(this,void 0,void 0,function(){var e,n=this;return Zi(this,function(t){switch(t.label){case 0:if(this.ensureCommitNotCalled(),this.lastWriteError)throw this.lastWriteError;return e=this.readVersions,this.mutations.forEach(function(t){e.delete(t.key.toString())}),e.forEach(function(t,e){e=Cm.fromPath(e);n.mutations.push(new kw(e,n.precondition(e)))}),[4,function(i,o){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return n=I_((e=i).R)+"/documents",r={writes:o.map(function(t){return C_(e.R,t)})},[4,e.Ni("Commit",n,r)];case 1:return t.sent(),[2]}})})}(this.datastore,this.mutations)];case 1:return t.sent(),this.committed=!0,[2]}})})},gN.prototype.recordVersion=function(t){var e;if(t.isFoundDocument())e=t.version;else{if(!t.isNoDocument())throw Hy();e=Zy.min()}var n=this.readVersions.get(t.key.toString());if(n){if(!e.isEqual(n))throw new Fy(My.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(t.key.toString(),e)},gN.prototype.precondition=function(t){var e=this.readVersions.get(t.toString());return!this.writtenDocs.has(t.toString())&&e?cw.updateTime(e):cw.none()},gN.prototype.preconditionForUpdate=function(t){var e=this.readVersions.get(t.toString());if(this.writtenDocs.has(t.toString())||!e)return cw.exists(!0);if(e.isEqual(Zy.min()))throw new Fy(My.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return cw.updateTime(e)},gN.prototype.write=function(t){this.ensureCommitNotCalled(),this.mutations.push(t)},gN.prototype.ensureCommitNotCalled=function(){},gN),fN=(vN.prototype.run=function(){this.nc()},vN.prototype.nc=function(){var t=this;this.Zi.ji(function(){return $i(t,void 0,void 0,function(){var e,n,r=this;return Zi(this,function(t){return e=new lN(this.datastore),(n=this.sc(e))&&n.then(function(t){r.asyncQueue.enqueueAndForget(function(){return e.commit().then(function(){r.deferred.resolve(t)}).catch(function(t){r.ic(t)})})}).catch(function(t){r.ic(t)}),[2]})})})},vN.prototype.sc=function(t){try{var e=this.updateFunction(t);return!Tm(e)&&e.catch&&e.then?e:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.deferred.reject(t),null}},vN.prototype.ic=function(t){var e=this;0<this.ec&&this.rc(t)?(--this.ec,this.asyncQueue.enqueueAndForget(function(){return e.nc(),Promise.resolve()})):this.deferred.reject(t)},vN.prototype.rc=function(t){if("FirebaseError"!==t.name)return!1;t=t.code;return"aborted"===t||"failed-precondition"===t||!Ow(t)},vN),pN=(dN.prototype.getConfiguration=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,this.receivedInitialUser.promise];case 1:return[2,(t.sent(),{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,credentials:this.credentials,initialUser:this.user,maxConcurrentLimboResolutions:100})]}})})},dN.prototype.setCredentialChangeListener=function(t){var e=this;this.credentialListener=t,this.receivedInitialUser.promise.then(function(){return e.credentialListener(e.user)})},dN.prototype.verifyNotTerminated=function(){if(this.asyncQueue.isShuttingDown)throw new Fy(My.FAILED_PRECONDITION,"The client has already been terminated.")},dN.prototype.terminate=function(){var t=this;this.asyncQueue.enterRestrictedMode();var n=new aI;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,5,,6]),this.onlineComponents?[4,this.onlineComponents.terminate()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.offlineComponents?[4,this.offlineComponents.terminate()]:[3,4];case 3:t.sent(),t.label=4;case 4:return this.credentials.removeChangeListener(),n.resolve(),[3,6];case 5:return e=t.sent(),e=nC(e,"Failed to shutdown persistence"),n.reject(e),[3,6];case 6:return[2]}})})}),n.promise},dN);function dN(t,e,n){var r=this;this.credentials=t,this.asyncQueue=e,this.databaseInfo=n,this.user=PE.UNAUTHENTICATED,this.clientId=zy.u(),this.credentialListener=function(){},this.receivedInitialUser=new aI,this.credentials.setChangeListener(function(t){Vy("FirestoreClient","Received user=",t.uid),r.user=t,r.credentialListener(t),r.receivedInitialUser.resolve()})}function vN(t,e,n,r){this.asyncQueue=t,this.datastore=e,this.updateFunction=n,this.deferred=r,this.ec=5,this.Zi=new ES(this.asyncQueue,"transaction_retry")}function gN(t){this.datastore=t,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastWriteError=null,this.writtenDocs=new Set}function yN(t,e){var n=this;this.Go=t,this.R=e,this.metadata=new aI,this.buffer=new Uint8Array,this.zo=new TextDecoder("utf-8"),this.Ho().then(function(t){t&&t.io()?n.metadata.resolve(t.payload.metadata):n.metadata.reject(new Error("The first element of the bundle is not a metadata, it is\n "+JSON.stringify(null==t?void 0:t.payload)))},function(t){return n.metadata.reject(t)})}function mN(t){this.observer=t,this.muted=!1}function bN(i,o){return $i(this,void 0,void 0,function(){var e,n,r=this;return Zi(this,function(t){switch(t.label){case 0:return i.asyncQueue.verifyOperationInProgress(),Vy("FirestoreClient","Initializing OfflineComponentProvider"),[4,i.getConfiguration()];case 1:return e=t.sent(),[4,o.initialize(e)];case 2:return t.sent(),n=e.initialUser,i.setCredentialChangeListener(function(e){n.isEqual(e)||(n=e,i.asyncQueue.enqueueRetryable(function(){return $i(r,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,uE(o.localStore,e)];case 1:return t.sent(),[2]}})})}))}),o.persistence.setDatabaseDeletedListener(function(){return i.terminate()}),i.offlineComponents=o,[2]}})})}function wN(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return r.asyncQueue.verifyOperationInProgress(),[4,_N(r)];case 1:return e=t.sent(),Vy("FirestoreClient","Initializing OnlineComponentProvider"),[4,r.getConfiguration()];case 2:return n=t.sent(),[4,i.initialize(e,n)];case 3:return t.sent(),r.setCredentialChangeListener(function(t){return r.asyncQueue.enqueueRetryable(function(){return function(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return(e=r).asyncQueue.verifyOperationInProgress(),Vy("RemoteStore","RemoteStore received new credentials"),n=KS(e),e.$r.add(3),[4,MS(e)];case 1:return t.sent(),n&&e.Br.set("Unknown"),[4,e.remoteSyncer.handleCredentialChange(i)];case 2:return t.sent(),e.$r.delete(3),[4,LS(e)];case 3:return t.sent(),[2]}})})}(i.remoteStore,t)})}),r.onlineComponents=i,[2]}})})}function _N(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return e.offlineComponents?[3,2]:(Vy("FirestoreClient","Using default OfflineComponentProvider"),[4,bN(e,new tN)]);case 1:t.sent(),t.label=2;case 2:return[2,e.offlineComponents]}})})}function IN(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return e.onlineComponents?[3,2]:(Vy("FirestoreClient","Using default OnlineComponentProvider"),[4,wN(e,new rN)]);case 1:t.sent(),t.label=2;case 2:return[2,e.onlineComponents]}})})}function TN(t){return _N(t).then(function(t){return t.persistence})}function EN(t){return _N(t).then(function(t){return t.localStore})}function SN(t){return IN(t).then(function(t){return t.remoteStore})}function CN(t){return IN(t).then(function(t){return t.syncEngine})}function NN(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,IN(r)];case 1:return e=t.sent(),[2,((n=e.eventManager).onListen=function(s,a){return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return e=YC(s),(o=e.Po.get(a))?(n=o.targetId,e.sharedClientState.addLocalQueryTarget(n),r=o.view.Ro(),[3,4]):[3,1];case 1:return[4,pE(e.localStore,xb(a))];case 2:return i=t.sent(),o=e.sharedClientState.addLocalQueryTarget(i.targetId),n=i.targetId,[4,PC(e,a,n,"current"===o)];case 3:r=t.sent(),e.isPrimaryClient&&FS(e.remoteStore,i),t.label=4;case 4:return[2,r]}})})}.bind(null,e.syncEngine),n.onUnlisten=function(i,o){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return n=(e=i).Po.get(o),1<(r=e.Vo.get(n.targetId)).length?[2,(e.Vo.set(n.targetId,r.filter(function(t){return!Mb(t,o)})),void e.Po.delete(o))]:e.isPrimaryClient?(e.sharedClientState.removeLocalQueryTarget(n.targetId),e.sharedClientState.isActiveQueryTarget(n.targetId)?[3,2]:[4,dE(e.localStore,n.targetId,!1).then(function(){e.sharedClientState.clearQueryState(n.targetId),US(e.remoteStore,n.targetId),jC(e,n.targetId)}).catch(_T)]):[3,3];case 1:t.sent(),t.label=2;case 2:return[3,5];case 3:return jC(e,n.targetId),[4,dE(e.localStore,n.targetId,!0)];case 4:t.sent(),t.label=5;case 5:return[2]}})})}.bind(null,e.syncEngine),n)]}})})}function AN(n,r,i){var t=this;void 0===i&&(i={});var o=new aI;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(n,r,i,o,s){var t=new cN({next:function(t){r.enqueueAndForget(function(){return fC(n,a)});var e=t.docs.has(i);!e&&t.fromCache?s.reject(new Fy(My.UNAVAILABLE,"Failed to get document because the client is offline.")):e&&t.fromCache&&o&&"server"===o.source?s.reject(new Fy(My.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.)')):s.resolve(t)},error:function(t){return s.reject(t)}}),a=new dC(Nb(i.path),t,{includeMetadataChanges:!0,so:!0});return lC(n,a)},[4,NN(n)];case 1:return[2,e.apply(void 0,[t.sent(),n.asyncQueue,r,i,o])]}})})}),o.promise}function kN(n,r,i){var t=this;void 0===i&&(i={});var o=new aI;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(e,n,t,r,i){var o=new cN({next:function(t){n.enqueueAndForget(function(){return fC(e,s)}),t.fromCache&&"server"===r.source?i.reject(new Fy(My.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.)')):i.resolve(t)},error:function(t){return i.reject(t)}}),s=new dC(t,o,{includeMetadataChanges:!0,so:!0});return lC(e,s)},[4,NN(n)];case 1:return[2,e.apply(void 0,[t.sent(),n.asyncQueue,r,i,o])]}})})}),o.promise}function RN(t,e){this.user=e,this.type="OAuth",this.authHeaders={},this.authHeaders.Authorization="Bearer "+t}var PN=function(t,e,n,r,i,o,s){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=o,this.autoDetectLongPolling=s},ON=(Object.defineProperty(BN.prototype,"isDefaultDatabase",{get:function(){return"(default)"===this.database},enumerable:!1,configurable:!0}),BN.prototype.isEqual=function(t){return t instanceof BN&&t.projectId===this.projectId&&t.database===this.database},BN),DN=new Map,xN=(VN.prototype.getToken=function(){return Promise.resolve(null)},VN.prototype.invalidateToken=function(){},VN.prototype.setChangeListener=function(t){(this.changeListener=t)(PE.UNAUTHENTICATED)},VN.prototype.removeChangeListener=function(){this.changeListener=null},VN),LN=(qN.prototype.getToken=function(){var e=this,n=this.cc,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(function(t){return e.cc!==n?(Vy("FirebaseCredentialsProvider","getToken aborted due to token change."),e.getToken()):t?(Gy("string"==typeof t.accessToken),new RN(t.accessToken,e.currentUser)):null}):Promise.resolve(null)},qN.prototype.invalidateToken=function(){this.forceRefresh=!0},qN.prototype.setChangeListener=function(t){this.changeListener=t,this.receivedInitialUser&&t(this.currentUser)},qN.prototype.removeChangeListener=function(){this.auth&&this.auth.removeAuthTokenListener(this.oc),this.oc=null,this.changeListener=null},qN.prototype.uc=function(){var t=this.auth&&this.auth.getUid();return Gy(null===t||"string"==typeof t),new PE(t)},qN),MN=(Object.defineProperty(jN.prototype,"authHeaders",{get:function(){var t={"X-Goog-AuthUser":this.hc},e=this.ac.auth.getAuthHeaderValueForFirstParty([]);return e&&(t.Authorization=e),t},enumerable:!1,configurable:!0}),jN),FN=(UN.prototype.getToken=function(){return Promise.resolve(new MN(this.ac,this.hc))},UN.prototype.setChangeListener=function(t){t(PE.FIRST_PARTY)},UN.prototype.removeChangeListener=function(){},UN.prototype.invalidateToken=function(){},UN);function UN(t,e){this.ac=t,this.hc=e}function jN(t,e){this.ac=t,this.hc=e,this.type="FirstParty",this.user=PE.FIRST_PARTY}function qN(t){var e=this;this.oc=null,this.currentUser=PE.UNAUTHENTICATED,this.receivedInitialUser=!1,this.cc=0,this.changeListener=null,this.forceRefresh=!1,this.oc=function(){e.cc++,e.currentUser=e.uc(),e.receivedInitialUser=!0,e.changeListener&&e.changeListener(e.currentUser)},this.cc=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.oc):(this.oc(null),t.get().then(function(t){e.auth=t,e.oc&&e.auth.addAuthTokenListener(e.oc)},function(){}))}function VN(){this.changeListener=null}function BN(t,e){this.projectId=t,this.database=e||"(default)"}function KN(t,e,n){if(!n)throw new Fy(My.INVALID_ARGUMENT,"Function "+t+"() cannot be called with an empty "+e+".")}function WN(t,e){if(void 0===e)return{merge:!1};if(void 0!==e.mergeFields&&void 0!==e.merge)throw new Fy(My.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');return e}function HN(t,e,n,r){if(!0===e&&!0===r)throw new Fy(My.INVALID_ARGUMENT,t+" and "+n+" cannot be used together.")}function GN(t){if(!Cm.isDocumentKey(t))throw new Fy(My.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t+" has "+t.length+".")}function zN(t){if(Cm.isDocumentKey(t))throw new Fy(My.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t+" has "+t.length+".")}function QN(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":Hy();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 YN(t,e){if((t="_delegate"in t?t._delegate:t)instanceof e)return t;if(e.name===t.constructor.name)throw new Fy(My.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");t=QN(t);throw new Fy(My.INVALID_ARGUMENT,"Expected type '"+e.name+"', but it was: "+t)}function XN(t,e){if(e<=0)throw new Fy(My.INVALID_ARGUMENT,"Function "+t+"() requires a positive number, but it was: "+e+".")}var JN,$N=(aA.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},aA),ZN=(Object.defineProperty(sA.prototype,"app",{get:function(){if(!this._app)throw new Fy(My.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app},enumerable:!1,configurable:!0}),Object.defineProperty(sA.prototype,"_initialized",{get:function(){return this._settingsFrozen},enumerable:!1,configurable:!0}),Object.defineProperty(sA.prototype,"_terminated",{get:function(){return void 0!==this._terminateTask},enumerable:!1,configurable:!0}),sA.prototype._setSettings=function(t){if(this._settingsFrozen)throw new Fy(My.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new $N(t),void 0!==t.credentials&&(this._credentials=function(t){if(!t)return new xN;switch(t.type){case"gapi":var e=t.client;return Gy(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new FN(e,t.sessionIndex||"0");case"provider":return t.client;default:throw new Fy(My.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(t.credentials))},sA.prototype._getSettings=function(){return this._settings},sA.prototype._freezeSettings=function(){return this._settingsFrozen=!0,this._settings},sA.prototype._delete=function(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask},sA.prototype.toJSON=function(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}},sA.prototype._terminate=function(){return(t=DN.get(this))&&(Vy("ComponentProvider","Removing Datastore"),DN.delete(this),t.terminate()),Promise.resolve();var t},sA),tA=(Object.defineProperty(oA.prototype,"_path",{get:function(){return this._key.path},enumerable:!1,configurable:!0}),Object.defineProperty(oA.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!1,configurable:!0}),Object.defineProperty(oA.prototype,"path",{get:function(){return this._key.path.canonicalString()},enumerable:!1,configurable:!0}),Object.defineProperty(oA.prototype,"parent",{get:function(){return new nA(this.firestore,this._converter,this._key.path.popLast())},enumerable:!1,configurable:!0}),oA.prototype.withConverter=function(t){return new oA(this.firestore,t,this._key)},oA),eA=(iA.prototype.withConverter=function(t){return new iA(this.firestore,t,this._query)},iA),nA=(Xi(rA,JN=eA),Object.defineProperty(rA.prototype,"id",{get:function(){return this._query.path.lastSegment()},enumerable:!1,configurable:!0}),Object.defineProperty(rA.prototype,"path",{get:function(){return this._query.path.canonicalString()},enumerable:!1,configurable:!0}),Object.defineProperty(rA.prototype,"parent",{get:function(){var t=this._path.popLast();return t.isEmpty()?null:new tA(this.firestore,null,new Cm(t))},enumerable:!1,configurable:!0}),rA.prototype.withConverter=function(t){return new rA(this.firestore,t,this._path)},rA);function rA(t,e,n){var r=this;return(r=JN.call(this,t,e,Nb(n))||this).firestore=t,r._path=n,r.type="collection",r}function iA(t,e,n){this._converter=e,this._query=n,this.type="query",this.firestore=t}function oA(t,e,n){this._converter=e,this._key=n,this.type="document",this.firestore=t}function sA(t,e){this._persistenceKey="(lite)",this._settings=new $N({}),this._settingsFrozen=!1,t instanceof ON?(this._databaseId=t,this._credentials=new xN):(this._app=t,this._databaseId=function(t){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Fy(My.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ON(t.options.projectId)}(t),this._credentials=new LN(e))}function aA(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Fy(My.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Fy(My.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,HN("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}function uA(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(t=Zo(t),KN("collection","path",e),t instanceof ZN)return zN(n=am.fromString.apply(am,no([e],r))),new nA(t,null,n);if(!(t instanceof tA||t instanceof nA))throw new Fy(My.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");return zN(n=am.fromString.apply(am,no([t.path],r)).child(am.fromString(e))),new nA(t.firestore,null,n)}function cA(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(t=Zo(t),KN("doc","path",e=1===arguments.length?zy.u():e),t instanceof ZN)return GN(n=am.fromString.apply(am,no([e],r))),new tA(t,null,new Cm(n));if(!(t instanceof tA||t instanceof nA))throw new Fy(My.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");return GN(n=t._path.child(am.fromString.apply(am,no([e],r)))),new tA(t.firestore,t instanceof nA?t._converter:null,new Cm(n))}function hA(t,e){return t=Zo(t),e=Zo(e),(t instanceof tA||t instanceof nA)&&(e instanceof tA||e instanceof nA)&&t.firestore===e.firestore&&t.path===e.path&&t._converter===e._converter}function lA(t,e){return t=Zo(t),e=Zo(e),t instanceof eA&&e instanceof eA&&t.firestore===e.firestore&&Mb(t._query,e._query)&&t._converter===e._converter}var fA=(Object.defineProperty(pA.prototype,"isShuttingDown",{get:function(){return this.dc},enumerable:!1,configurable:!0}),pA.prototype.enqueueAndForget=function(t){this.enqueue(t)},pA.prototype.enqueueAndForgetEvenWhileRestricted=function(t){this.Ec(),this.Tc(t)},pA.prototype.enterRestrictedMode=function(){var t;this.dc||(this.dc=!0,(t=mS())&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.gc))},pA.prototype.enqueue=function(t){return this.Ec(),this.dc?new Promise(function(t){}):this.Tc(t)},pA.prototype.enqueueRetryable=function(t){var e=this;this.enqueueAndForget(function(){return e.fc.push(t),e.Ic()})},pA.prototype.Ic=function(){return $i(this,void 0,void 0,function(){var e,n=this;return Zi(this,function(t){switch(t.label){case 0:if(0===this.fc.length)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.fc[0]()];case 2:return t.sent(),this.fc.shift(),this.Zi.reset(),[3,4];case 3:if(!bI(e=t.sent()))throw e;return Vy("AsyncQueue","Operation failed with retryable error: "+e),[3,4];case 4:0<this.fc.length&&this.Zi.ji(function(){return n.Ic()}),t.label=5;case 5:return[2]}})})},pA.prototype.Tc=function(t){var r=this,e=this.lc.then(function(){return r.mc=!0,t().catch(function(t){throw r._c=t,r.mc=!1,By("INTERNAL UNHANDLED ERROR: ",(n=(e=t).message||"",n=e.stack?e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack:n)),t;var e,n}).then(function(t){return r.mc=!1,t})});return this.lc=e},pA.prototype.enqueueAfterDelay=function(t,e,n){var r=this;this.Ec(),-1<this.yc.indexOf(t)&&(e=0);n=tC.createAndSchedule(this,t,e,n,function(t){return r.Ac(t)});return this.wc.push(n),n},pA.prototype.Ec=function(){this._c&&Hy()},pA.prototype.verifyOperationInProgress=function(){},pA.prototype.Rc=function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,e=this.lc];case 1:t.sent(),t.label=2;case 2:if(e!==this.lc)return[3,0];t.label=3;case 3:return[2]}})})},pA.prototype.bc=function(t){for(var e=0,n=this.wc;e<n.length;e++)if(n[e].timerId===t)return!0;return!1},pA.prototype.vc=function(r){var i=this;return this.Rc().then(function(){i.wc.sort(function(t,e){return t.targetTimeMs-e.targetTimeMs});for(var t=0,e=i.wc;t<e.length;t++){var n=e[t];if(n.skipDelay(),"all"!==r&&n.timerId===r)break}return i.Rc()})},pA.prototype.Pc=function(t){this.yc.push(t)},pA.prototype.Ac=function(t){t=this.wc.indexOf(t);this.wc.splice(t,1)},pA);function pA(){var e=this;this.lc=Promise.resolve(),this.fc=[],this.dc=!1,this.wc=[],this._c=null,this.mc=!1,this.yc=[],this.Zi=new ES(this,"async_queue_retry"),this.gc=function(){var t=mS();t&&Vy("AsyncQueue","Visibility state changed to "+t.visibilityState),e.Zi.Gi()};var t=mS();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.gc)}function dA(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 vA,gA=(bA.prototype.onProgress=function(t,e,n){this._progressObserver={next:t,error:e,complete:n}},bA.prototype.catch=function(t){return this._taskCompletionResolver.promise.catch(t)},bA.prototype.then=function(t,e){return this._taskCompletionResolver.promise.then(t,e)},bA.prototype._completeWith=function(t){this._updateProgress(t),this._progressObserver.complete&&this._progressObserver.complete(),this._taskCompletionResolver.resolve(t)},bA.prototype._failWith=function(t){this._lastProgress.taskState="Error",this._progressObserver.next&&this._progressObserver.next(this._lastProgress),this._progressObserver.error&&this._progressObserver.error(t),this._taskCompletionResolver.reject(t)},bA.prototype._updateProgress=function(t){this._lastProgress=t,this._progressObserver.next&&this._progressObserver.next(t)},bA),yA=(Xi(mA,vA=ZN),mA.prototype._terminate=function(){return this._firestoreClient||_A(this),this._firestoreClient.terminate()},mA);function mA(t,e){var n=this;return(n=vA.call(this,t,e)||this)._queue=new fA,n._persistenceKey="name"in t?t.name:"[DEFAULT]",n}function bA(){this._progressObserver={},this._taskCompletionResolver=new aI,this._lastProgress={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}function wA(t){return t._firestoreClient||_A(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function _A(t){var e,n,r,i=t._freezeSettings(),i=(e=t._databaseId,n=(null===(r=t._app)||void 0===r?void 0:r.options.appId)||"",r=t._persistenceKey,new PN(e,n,r,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling));t._firestoreClient=new pN(t._credentials,t._queue,i)}function IA(r,i,o){var t=this,s=new aI;return r.asyncQueue.enqueue(function(){return $i(t,void 0,void 0,function(){var n;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,bN(r,o)];case 1:return t.sent(),[4,wN(r,i)];case 2:return t.sent(),s.resolve(),[3,4];case 3:if(!("FirebaseError"===(e=n=t.sent()).name?e.code===My.FAILED_PRECONDITION||e.code===My.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code))throw n;return console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+n),s.reject(n),[3,4];case 4:return[2]}var e})})}).then(function(){return s.promise})}function TA(t){if(t._initialized||t._terminated)throw new Fy(My.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.")}var EA=(LA.prototype.isEqual=function(t){return this._internalPath.isEqual(t._internalPath)},LA),SA=(xA.fromBase64String=function(t){try{return new xA(lm.fromBase64String(t))}catch(t){throw new Fy(My.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}},xA.fromUint8Array=function(t){return new xA(lm.fromUint8Array(t))},xA.prototype.toBase64=function(){return this._byteString.toBase64()},xA.prototype.toUint8Array=function(){return this._byteString.toUint8Array()},xA.prototype.toString=function(){return"Bytes(base64: "+this.toBase64()+")"},xA.prototype.isEqual=function(t){return this._byteString.isEqual(t._byteString)},xA),CA=function(t){this._methodName=t},NA=(Object.defineProperty(DA.prototype,"latitude",{get:function(){return this._lat},enumerable:!1,configurable:!0}),Object.defineProperty(DA.prototype,"longitude",{get:function(){return this._long},enumerable:!1,configurable:!0}),DA.prototype.isEqual=function(t){return this._lat===t._lat&&this._long===t._long},DA.prototype.toJSON=function(){return{latitude:this._lat,longitude:this._long}},DA.prototype._compareTo=function(t){return Yy(this._lat,t._lat)||Yy(this._long,t._long)},DA),AA=/^__.*__$/,kA=(OA.prototype.toMutation=function(t,e){return null!==this.fieldMask?new mw(t,this.data,this.fieldMask,e,this.fieldTransforms):new yw(t,this.data,e,this.fieldTransforms)},OA),RA=(PA.prototype.toMutation=function(t,e){return new mw(t,this.data,this.fieldMask,e,this.fieldTransforms)},PA);function PA(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}function OA(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}function DA(t,e){if(!isFinite(t)||t<-90||90<t)throw new Fy(My.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||180<e)throw new Fy(My.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}function xA(t){this._byteString=t}function LA(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0;n<t.length;++n)if(0===t[n].length)throw new Fy(My.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new cm(t)}function MA(t){switch(t){case 0:case 2:case 1:return 1;case 3:case 4:return;default:throw Hy()}}var FA=(Object.defineProperty(qA.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(qA.prototype,"Sc",{get:function(){return this.settings.Sc},enumerable:!1,configurable:!0}),qA.prototype.Dc=function(t){return new qA(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.R,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)},qA.prototype.Cc=function(t){var e=null===(e=this.path)||void 0===e?void 0:e.child(t),e=this.Dc({path:e,Nc:!1});return e.xc(t),e},qA.prototype.Fc=function(t){var e,t=null===(e=this.path)||void 0===e?void 0:e.child(t),t=this.Dc({path:t,Nc:!1});return t.Vc(),t},qA.prototype.kc=function(t){return this.Dc({path:void 0,Nc:!0})},qA.prototype.Oc=function(t){return vk(t,this.settings.methodName,this.settings.$c||!1,this.path,this.settings.Mc)},qA.prototype.contains=function(e){return void 0!==this.fieldMask.find(function(t){return e.isPrefixOf(t)})||void 0!==this.fieldTransforms.find(function(t){return e.isPrefixOf(t.field)})},qA.prototype.Vc=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.xc(this.path.get(t))},qA.prototype.xc=function(t){if(0===t.length)throw this.Oc("Document fields must not be empty");if(MA(this.Sc)&&AA.test(t))throw this.Oc('Document fields cannot begin and end with "__"')},qA),UA=(jA.prototype.Lc=function(t,e,n,r){return void 0===r&&(r=!1),new FA({Sc:t,methodName:e,Mc:n,path:cm.emptyPath(),Nc:!1,$c:r},this.databaseId,this.R,this.ignoreUndefinedProperties)},jA);function jA(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.R=n||bS(t)}function qA(t,e,n,r,i,o){this.settings=t,this.databaseId=e,this.R=n,this.ignoreUndefinedProperties=r,void 0===i&&this.Vc(),this.fieldTransforms=i||[],this.fieldMask=o||[]}function VA(t){var e=t._freezeSettings(),n=bS(t._databaseId);return new UA(t._databaseId,!!e.ignoreUndefinedProperties,n)}function BA(t,e,n,r,i,o){void 0===o&&(o={});var s=t.Lc(o.merge||o.mergeFields?2:0,e,n,i);lk("Data must be an object, but it was:",s,r);var a,u,r=ck(r,s);if(o.merge)a=new hm(s.fieldMask),u=s.fieldTransforms;else if(o.mergeFields){for(var c=[],h=0,l=o.mergeFields;h<l.length;h++){var f=fk(e,l[h],n);if(!s.contains(f))throw new Fy(My.INVALID_ARGUMENT,"Field '"+f+"' is specified in your field mask but missing from your input data.");gk(c,f)||c.push(f)}a=new hm(c),u=s.fieldTransforms.filter(function(t){return a.covers(t.field)})}else a=null,u=s.fieldTransforms;return new kA(new qm(r),a,u)}var KA,WA=(Xi(HA,KA=CA),HA.prototype._toFieldTransform=function(t){if(2!==t.Sc)throw 1===t.Sc?t.Oc(this._methodName+"() can only appear at the top level of your update data"):t.Oc(this._methodName+"() cannot be used with set() unless you pass {merge:true}");return t.fieldMask.push(t.path),null},HA.prototype.isEqual=function(t){return t instanceof HA},HA);function HA(){return null!==KA&&KA.apply(this,arguments)||this}function GA(t,e,n){return new FA({Sc:3,Mc:e.settings.Mc,methodName:t._methodName,Nc:n},e.databaseId,e.R,e.ignoreUndefinedProperties)}var zA,QA,YA,XA,JA=(Xi(ik,XA=CA),ik.prototype._toFieldTransform=function(t){return new uw(t.path,new zb)},ik.prototype.isEqual=function(t){return t instanceof ik},ik),$A=(Xi(rk,YA=CA),rk.prototype._toFieldTransform=function(t){var e=GA(this,t,!0),n=this.Bc.map(function(t){return uk(t,e)}),n=new Qb(n);return new uw(t.path,n)},rk.prototype.isEqual=function(t){return this===t},rk),ZA=(Xi(nk,QA=CA),nk.prototype._toFieldTransform=function(t){var e=GA(this,t,!0),n=this.Bc.map(function(t){return uk(t,e)}),n=new Zb(n);return new uw(t.path,n)},nk.prototype.isEqual=function(t){return this===t},nk),tk=(Xi(ek,zA=CA),ek.prototype._toFieldTransform=function(t){var e=new rw(t.R,Kb(t.R,this.qc));return new uw(t.path,e)},ek.prototype.isEqual=function(t){return this===t},ek);function ek(t,e){var n=this;return(n=zA.call(this,t)||this).qc=e,n}function nk(t,e){var n=this;return(n=QA.call(this,t)||this).Bc=e,n}function rk(t,e){var n=this;return(n=YA.call(this,t)||this).Bc=e,n}function ik(){return null!==XA&&XA.apply(this,arguments)||this}function ok(t,r,i,e){var o=t.Lc(1,r,i);lk("Data must be an object, but it was:",o,e);var s=[],a=qm.empty();rm(e,function(t,e){var n=dk(r,t,i);e=Zo(e);t=o.Fc(n);e instanceof WA?s.push(n):null!=(t=uk(e,t))&&(s.push(n),a.set(n,t))});e=new hm(s);return new RA(a,e,o.fieldTransforms)}function sk(t,e,n,r,i,o){var s=t.Lc(1,e,n),a=[fk(e,r,n)],u=[i];if(o.length%2!=0)throw new Fy(My.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(fk(e,o[c])),u.push(o[c+1]);for(var h,l,f,p=[],d=qm.empty(),v=a.length-1;0<=v;--v)gk(p,a[v])||(h=a[v],l=Zo(l=u[v]),f=s.Fc(h),l instanceof WA?p.push(h):null!=(f=uk(l,f))&&(p.push(h),d.set(h,f)));i=new hm(p);return new RA(d,i,s.fieldTransforms)}function ak(t,e,n,r){return void 0===r&&(r=!1),uk(n,t.Lc(r?4:3,e))}function uk(s,t){if(hk(s=Zo(s)))return lk("Unsupported field value:",t,s),ck(s,t);if(s instanceof CA)return function(t,e){if(!MA(e.Sc))throw e.Oc(t._methodName+"() can only be used with update() and set()");if(!e.path)throw e.Oc(t._methodName+"() is not currently supported inside arrays");t=t._toFieldTransform(e);t&&e.fieldTransforms.push(t)}(s,t),null;if(void 0===s&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),s instanceof Array){if(t.settings.Nc&&4!==t.Sc)throw t.Oc("Nested arrays are not supported");return function(t){for(var e=[],n=0,r=0,i=s;r<i.length;r++){var o=uk(i[r],t.kc(n));null==o&&(o={nullValue:"NULL_VALUE"}),e.push(o),n++}return{arrayValue:{values:e}}}(t)}return function(t,e){if(null===(t=Zo(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Kb(e.R,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=$y.fromDate(t);return{timestampValue:p_(e.R,n)}}if(t instanceof $y)return n=new $y(t.seconds,1e3*Math.floor(t.nanoseconds/1e3)),{timestampValue:p_(e.R,n)};if(t instanceof NA)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof SA)return{bytesValue:d_(e.R,t._byteString)};if(t instanceof tA){var n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.Oc("Document reference is for database "+r.projectId+"/"+r.database+" but should be for database "+n.projectId+"/"+n.database);return{referenceValue:g_(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.Oc("Unsupported field value: "+QN(t))}(s,t)}function ck(t,n){var r={};return im(t)?n.path&&0<n.path.length&&n.fieldMask.push(n.path):rm(t,function(t,e){e=uk(e,n.Cc(t));null!=e&&(r[t]=e)}),{mapValue:{fields:r}}}function hk(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof $y||t instanceof NA||t instanceof SA||t instanceof tA||t instanceof CA)}function lk(t,e,n){if(!hk(n)||("object"!=typeof(r=n)||null===r||Object.getPrototypeOf(r)!==Object.prototype&&null!==Object.getPrototypeOf(r))){n=QN(n);throw"an object"===n?e.Oc(t+" a custom object"):e.Oc(t+" "+n)}var r}function fk(t,e,n){if((e=Zo(e))instanceof EA)return e._internalPath;if("string"==typeof e)return dk(t,e);throw vk("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}var pk=new RegExp("[~\\*/\\[\\]]");function dk(e,n,r){if(0<=n.search(pk))throw vk("Invalid field path ("+n+"). Paths must not contain '~', '*', '/', '[', or ']'",e,!1,void 0,r);try{return(new(EA.bind.apply(EA,no([void 0],n.split(".")))))._internalPath}catch(t){throw vk("Invalid field path ("+n+"). Paths must not be empty, begin with '.', end with '.', or contain '..'",e,!1,void 0,r)}}function vk(t,e,n,r,i){var o=r&&!r.isEmpty(),s=void 0!==i,e="Function "+e+"() called with invalid data";n&&(e+=" (via `toFirestore()`)");n="";return(o||s)&&(n+=" (found",o&&(n+=" in field "+r),s&&(n+=" in document "+i),n+=")"),new Fy(My.INVALID_ARGUMENT,(e+=". ")+t+n)}function gk(t,e){return t.some(function(t){return t.isEqual(e)})}var yk,mk=(Object.defineProperty(_k.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!1,configurable:!0}),Object.defineProperty(_k.prototype,"ref",{get:function(){return new tA(this._firestore,this._converter,this._key)},enumerable:!1,configurable:!0}),_k.prototype.exists=function(){return null!==this._document},_k.prototype.data=function(){if(this._document){if(this._converter){var t=new bk(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.toProto())}},_k.prototype.get=function(t){if(this._document){t=this._document.data.field(Ik("DocumentSnapshot.get",t));if(null!==t)return this._userDataWriter.convertValue(t)}},_k),bk=(Xi(wk,yk=mk),wk.prototype.data=function(){return yk.prototype.data.call(this)},wk);function wk(){return null!==yk&&yk.apply(this,arguments)||this}function _k(t,e,n,r,i){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=i}function Ik(t,e){return"string"==typeof e?dk(t,e):(e instanceof EA?e:e._delegate)._internalPath}var Tk,Ek,Sk=(Ok.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},Ok),Ck=(Xi(Pk,Ek=mk),Pk.prototype.exists=function(){return Ek.prototype.exists.call(this)},Pk.prototype.data=function(t){if(void 0===t&&(t={}),this._document){if(this._converter){var e=new Nk(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.toProto(),t.serverTimestamps)}},Pk.prototype.get=function(t,e){if(void 0===e&&(e={}),this._document){t=this._document.data.field(Ik("DocumentSnapshot.get",t));if(null!==t)return this._userDataWriter.convertValue(t,e.serverTimestamps)}},Pk),Nk=(Xi(Rk,Tk=Ck),Rk.prototype.data=function(t){return void 0===t&&(t={}),Tk.prototype.data.call(this,t)},Rk),Ak=(Object.defineProperty(kk.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!1,configurable:!0}),Object.defineProperty(kk.prototype,"size",{get:function(){return this._snapshot.docs.size},enumerable:!1,configurable:!0}),Object.defineProperty(kk.prototype,"empty",{get:function(){return 0===this.size},enumerable:!1,configurable:!0}),kk.prototype.forEach=function(e,n){var r=this;this._snapshot.docs.forEach(function(t){e.call(n,new Nk(r._firestore,r._userDataWriter,t.key,t,new Sk(r._snapshot.mutatedKeys.has(t.key),r._snapshot.fromCache),r.query._converter))})},kk.prototype.docChanges=function(t){t=!!(t=void 0===t?{}:t).includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new Fy(My.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(i,e){if(i._snapshot.oldDocs.isEmpty()){var n=0;return i._snapshot.docChanges.map(function(t){var e=new Nk(i._firestore,i._userDataWriter,t.doc.key,t.doc,new Sk(i._snapshot.mutatedKeys.has(t.doc.key),i._snapshot.fromCache),i.query._converter);return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=new Nk(i._firestore,i._userDataWriter,t.doc.key,t.doc,new Sk(i._snapshot.mutatedKeys.has(t.doc.key),i._snapshot.fromCache),i.query._converter),n=-1,r=-1;return 0!==t.type&&(n=o.indexOf(t.doc.key),o=o.delete(t.doc.key)),1!==t.type&&(r=(o=o.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 Hy()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges},kk);function kk(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Sk(r.hasPendingWrites,r.fromCache),this.query=n}function Rk(){return null!==Tk&&Tk.apply(this,arguments)||this}function Pk(t,e,n,r,i,o){var s=this;return(s=Ek.call(this,t,e,n,r,o)||this)._firestore=t,s._firestoreImpl=t,s.metadata=i,s}function Ok(t,e){this.hasPendingWrites=t,this.fromCache=e}function Dk(t,e){return t instanceof Ck&&e instanceof Ck?t._firestore===e._firestore&&t._key.isEqual(e._key)&&(null===t._document?null===e._document:t._document.isEqual(e._document))&&t._converter===e._converter:t instanceof Ak&&e instanceof Ak&&t._firestore===e._firestore&&lA(t.query,e.query)&&t.metadata.isEqual(e.metadata)&&t._snapshot.isEqual(e._snapshot)}function xk(t){if(kb(t)&&0===t.explicitOrderBy.length)throw new Fy(My.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}Ga=function(){};function Lk(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,i=e;r<i.length;r++)t=i[r]._apply(t);return t}var Mk,Fk,Uk,jk,qk,Vk=(Xi(Xk,qk=Ga),Xk.prototype._apply=function(t){var e=VA(t.firestore),e=function(t,e,n,r,i,o){if(r.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Fy(My.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+i+"' queries on FieldPath.documentId().");if("in"===i||"not-in"===i){Zk(o,i);for(var s=[],a=0,u=o;a<u.length;a++){var c=u[a];s.push($k(n,t,c))}h={arrayValue:{values:s}}}else h=$k(n,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Zk(o,i),h=ak(e,"where",o,"in"===i||"not-in"===i);var h=Xm.create(r,i,h);return function(t,e){if(e.g()){var n=Pb(t);if(null!==n&&!n.isEqual(e.field))throw new Fy(My.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '"+n.toString()+"' and '"+e.field.toString()+"'");n=Rb(t);null!==n&&tR(0,e.field,n)}t=function(t,e){for(var n=0,r=t.filters;n<r.length;n++){var i=r[n];if(0<=e.indexOf(i.op))return i.op}return null}(t,function(){switch(e.op){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}());if(null!==t)throw t===e.op?new Fy(My.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new Fy(My.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+t.toString()+"' filters.")}(t,h),h}(t._query,e,t.firestore._databaseId,this.Uc,this.Qc,this.Kc);return new eA(t.firestore,t._converter,(t=t._query,e=t.filters.concat([e]),new Sb(t.path,t.collectionGroup,t.explicitOrderBy.slice(),e,t.limit,t.limitType,t.startAt,t.endAt)))},Xk),Bk=(Xi(Yk,jk=Ga),Yk.prototype._apply=function(t){var e=function(t,e,n){if(null!==t.startAt)throw new Fy(My.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new Fy(My.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r=new Ib(e,n);return e=r,null!==Rb(n=t)||null!==(t=Pb(n))&&tR(0,t,e.field),r}(t._query,this.Uc,this.jc);return new eA(t.firestore,t._converter,(t=t._query,e=t.explicitOrderBy.concat([e]),new Sb(t.path,t.collectionGroup,e,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)))},Yk),Kk=(Xi(Qk,Uk=Ga),Qk.prototype._apply=function(t){return new eA(t.firestore,t._converter,Lb(t._query,this.Wc,this.Gc))},Qk),Wk=(Xi(zk,Fk=Ga),zk.prototype._apply=function(t){var e=Jk(t,this.type,this.zc,this.Hc);return new eA(t.firestore,t._converter,(t=t._query,e=e,new Sb(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,e,t.endAt)))},zk),Hk=(Xi(Gk,Mk=Ga),Gk.prototype._apply=function(t){var e=Jk(t,this.type,this.zc,this.Hc);return new eA(t.firestore,t._converter,(t=t._query,e=e,new Sb(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,e)))},Gk);function Gk(t,e,n){var r=this;return(r=Mk.call(this)||this).type=t,r.zc=e,r.Hc=n,r}function zk(t,e,n){var r=this;return(r=Fk.call(this)||this).type=t,r.zc=e,r.Hc=n,r}function Qk(t,e,n){var r=this;return(r=Uk.call(this)||this).type=t,r.Wc=e,r.Gc=n,r}function Yk(t,e){var n=this;return(n=jk.call(this)||this).Uc=t,n.jc=e,n.type="orderBy",n}function Xk(t,e,n){var r=this;return(r=qk.call(this)||this).Uc=t,r.Qc=e,r.Kc=n,r.type="where",r}function Jk(t,c,e,n){if(e[0]=Zo(e[0]),e[0]instanceof mk)return function(t,e,n,r){if(!n)throw new Fy(My.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+c+"().");for(var i=[],o=0,s=Db(t);o<s.length;o++){var a=s[o];if(a.field.isKeyField())i.push(xm(e,n.key));else{var u=n.data.field(a.field);if(_m(u))throw new Fy(My.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+a.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===u){a=a.field.canonicalString();throw new Fy(My.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+a+"' (used as the orderBy) does not exist.")}i.push(u)}}return new gb(i,r)}(t._query,t.firestore._databaseId,e[0]._document,n);var r=VA(t.firestore);return function(t,e,n,r,i,o){var s=t.explicitOrderBy;if(i.length>s.length)throw new Fy(My.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.isKeyField()){if("string"!=typeof c)throw new Fy(My.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+r+"(), but got a "+typeof c);if(!Ob(t)&&-1!==c.indexOf("/"))throw new Fy(My.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(am.fromString(c));if(!Cm.isDocumentKey(h))throw new Fy(My.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.");h=new Cm(h);a.push(xm(e,h))}else{c=ak(n,r,c);a.push(c)}}return new gb(a,o)}(t._query,t.firestore._databaseId,r,c,e,n)}function $k(t,e,n){if("string"==typeof(n=Zo(n))){if(""===n)throw new Fy(My.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!Ob(e)&&-1!==n.indexOf("/"))throw new Fy(My.INVALID_ARGUMENT,"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '"+n+"' contains a '/' character.");e=e.path.child(am.fromString(n));if(!Cm.isDocumentKey(e))throw new Fy(My.INVALID_ARGUMENT,"Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '"+e+"' is not because it has an odd number of segments ("+e.length+").");return xm(t,new Cm(e))}if(n instanceof tA)return xm(t,n._key);throw new Fy(My.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+QN(n)+".")}function Zk(t,e){if(!Array.isArray(t)||0===t.length)throw new Fy(My.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(10<t.length)throw new Fy(My.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.")}function tR(t,e,n){if(!n.isEqual(e))throw new Fy(My.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first argument to orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}eR.prototype.convertValue=function(t,e){switch(void 0===e&&(e="none"),Am(t)){case 0:return null;case 1:return t.booleanValue;case 2:return bm(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(wm(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Hy()}},eR.prototype.convertObject=function(t,n){var r=this,i={};return rm(t.fields||{},function(t,e){i[t]=r.convertValue(e,n)}),i},eR.prototype.convertGeoPoint=function(t){return new NA(bm(t.latitude),bm(t.longitude))},eR.prototype.convertArray=function(t,e){var n=this;return(t.values||[]).map(function(t){return n.convertValue(t,e)})},eR.prototype.convertServerTimestamp=function(t,e){switch(e){case"previous":var n=function t(e){e=e.mapValue.fields.__previous_value__;return _m(e)?t(e):e}(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Im(t));default:return null}},eR.prototype.convertTimestamp=function(t){t=mm(t);return new $y(t.seconds,t.nanos)},eR.prototype.convertDocumentKey=function(t,e){var n=am.fromString(t);Gy(F_(n));t=new ON(n.get(1),n.get(3)),n=new Cm(n.popFirst(5));return t.isEqual(e)||By("Document "+n+" contains a document reference within a different database ("+t.projectId+"/"+t.database+") which is not supported. It will be treated as a reference in the current database ("+e.projectId+"/"+e.database+") instead."),n},Sn=eR;function eR(){}function nR(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var rR,iR=(Xi(aR,rR=Sn),aR.prototype.convertBytes=function(t){return new SA(t)},aR.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return new tA(this.firestore,null,t)},aR),oR=(sR.prototype.set=function(t,e,n){this._verifyNotCommitted();t=uR(t,this._firestore),e=nR(t._converter,e,n),n=BA(this._dataReader,"WriteBatch.set",t._key,e,null!==t._converter,n);return this._mutations.push(n.toMutation(t._key,cw.none())),this},sR.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];this._verifyNotCommitted();t=uR(t,this._firestore),e="string"==typeof(e=Zo(e))||e instanceof EA?sk(this._dataReader,"WriteBatch.update",t._key,e,n,r):ok(this._dataReader,"WriteBatch.update",t._key,e);return this._mutations.push(e.toMutation(t._key,cw.exists(!0))),this},sR.prototype.delete=function(t){this._verifyNotCommitted();t=uR(t,this._firestore);return this._mutations=this._mutations.concat(new Aw(t._key,cw.none())),this},sR.prototype.commit=function(){return this._verifyNotCommitted(),this._committed=!0,0<this._mutations.length?this._commitHandler(this._mutations):Promise.resolve()},sR.prototype._verifyNotCommitted=function(){if(this._committed)throw new Fy(My.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},sR);function sR(t,e){this._firestore=t,this._commitHandler=e,this._mutations=[],this._committed=!1,this._dataReader=VA(t)}function aR(t){var e=this;return(e=rR.call(this)||this).firestore=t,e}function uR(t,e){if((t=Zo(t)).firestore!==e)throw new Fy(My.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}var cR,hR=(Xi(lR,cR=Sn),lR.prototype.convertBytes=function(t){return new SA(t)},lR.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return new tA(this.firestore,null,t)},lR);function lR(t){var e=this;return(e=cR.call(this)||this).firestore=t,e}function fR(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];t=YN(t,tA);var o=YN(t.firestore,yA),s=VA(o);return dR(o,[("string"==typeof(e=Zo(e))||e instanceof EA?sk(s,"updateDoc",t._key,e,n,r):ok(s,"updateDoc",t._key,e)).toMutation(t._key,cw.exists(!0))])}function pR(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];e=Zo(e);var r={includeMetadataChanges:!1},i=0;"object"!=typeof n[i]||dA(n[i])||(r=n[i],i++);var o,s,a,u,c,h,l={includeMetadataChanges:r.includeMetadataChanges};return dA(n[i])&&(o=n[i],n[i]=null===(r=o.next)||void 0===r?void 0:r.bind(o),n[i+1]=null===(r=o.error)||void 0===r?void 0:r.bind(o),n[i+2]=null===(r=o.complete)||void 0===r?void 0:r.bind(o)),e instanceof tA?(a=YN(e.firestore,yA),u=Nb(e._key.path),h={next:function(t){n[i]&&n[i](vR(a,e,t))},error:n[i+1],complete:n[i+2]}):(s=YN(e,eA),a=YN(s.firestore,yA),u=s._query,c=new hR(a),h={next:function(t){n[i]&&n[i](new Ak(a,c,s,t))},error:n[i+1],complete:n[i+2]},xk(e._query)),function(n,t,e){var r=this,i=new cN(h),o=new dC(t,i,e);return n.asyncQueue.enqueueAndForget(function(){return $i(r,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=lC,[4,NN(n)];case 1:return[2,e.apply(void 0,[t.sent(),o])]}})})}),function(){i.Wo(),n.asyncQueue.enqueueAndForget(function(){return $i(r,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=fC,[4,NN(n)];case 1:return[2,e.apply(void 0,[t.sent(),o])]}})})})}}(wA(a),u,l)}function dR(t,e){return function(n,r){var t=this,i=new aI;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=OC,[4,CN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(wA(t),e)}function vR(t,e,n){var r=n.docs.get(e._key),i=new hR(t);return new Ck(t,i,e._key,r,new Sk(n.hasPendingWrites,n.fromCache),e._converter)}var gR,yR=(bR.prototype.get=function(t){var e=this,n=uR(t,this._firestore),r=new iR(this._firestore);return this._transaction.lookup([n._key]).then(function(t){if(!t||1!==t.length)return Hy();t=t[0];if(t.isFoundDocument())return new mk(e._firestore,r,t.key,t,n._converter);if(t.isNoDocument())return new mk(e._firestore,r,n._key,null,n._converter);throw Hy()})},bR.prototype.set=function(t,e,n){t=uR(t,this._firestore),e=nR(t._converter,e,n),n=BA(this._dataReader,"Transaction.set",t._key,e,null!==t._converter,n);return this._transaction.set(t._key,n),this},bR.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];t=uR(t,this._firestore),e="string"==typeof(e=Zo(e))||e instanceof EA?sk(this._dataReader,"Transaction.update",t._key,e,n,r):ok(this._dataReader,"Transaction.update",t._key,e);return this._transaction.update(t._key,e),this},bR.prototype.delete=function(t){t=uR(t,this._firestore);return this._transaction.delete(t._key),this},Xi(mR,gR=bR),mR.prototype.get=function(t){var e=this,n=uR(t,this._firestore),r=new hR(this._firestore);return gR.prototype.get.call(this,t).then(function(t){return new Ck(e._firestore,r,n._key,t._document,new Sk(!1,!1),n._converter)})},mR);function mR(t,e){var n=this;return(n=gR.call(this,t,e)||this)._firestore=t,n}function bR(t,e){this._firestore=t,this._transaction=e,this._dataReader=VA(t)}function wR(){if("undefined"==typeof Uint8Array)throw new Fy(My.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function _R(){if("undefined"==typeof atob)throw new Fy(My.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var IR,TR=(RR.fromBase64String=function(t){return _R(),new RR(SA.fromBase64String(t))},RR.fromUint8Array=function(t){return wR(),new RR(SA.fromUint8Array(t))},RR.prototype.toBase64=function(){return _R(),this._delegate.toBase64()},RR.prototype.toUint8Array=function(){return wR(),this._delegate.toUint8Array()},RR.prototype.isEqual=function(t){return this._delegate.isEqual(t._delegate)},RR.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},RR),ER=(kR.prototype.enableIndexedDbPersistence=function(t,e){return function(t,e){TA(t=YN(t,yA));var n=wA(t),r=t._freezeSettings(),t=new rN;return IA(n,t,new eN(t,r.cacheSizeBytes,null==e?void 0:e.forceOwnership))}(t._delegate,{forceOwnership:e})},kR.prototype.enableMultiTabIndexedDbPersistence=function(t){return function(t){TA(t=YN(t,yA));var e=wA(t),n=t._freezeSettings(),t=new rN;return IA(e,t,new nN(t,n.cacheSizeBytes))}(t._delegate)},kR.prototype.clearIndexedDbPersistence=function(t){return function(n){var t=this;if(n._initialized&&!n._terminated)throw new Fy(My.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");var r=new aI;return n._queue.enqueueAndForgetEvenWhileRestricted(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return hI.yt()?(e=n+"main",[4,hI.delete(e)]):[2,Promise.resolve()];case 1:return t.sent(),[2]}})})}(JT(n._databaseId,n._persistenceKey))];case 1:return t.sent(),r.resolve(),[3,3];case 2:return e=t.sent(),r.reject(e),[3,3];case 3:return[2]}})})}),r.promise}(t._delegate)},kR),SR=(Object.defineProperty(AR.prototype,"_databaseId",{get:function(){return this._delegate._databaseId},enumerable:!1,configurable:!0}),AR.prototype.settings=function(t){t.merge&&delete(t=Object.assign(Object.assign({},this._delegate._getSettings()),t)).merge,this._delegate._setSettings(t)},AR.prototype.useEmulator=function(t,e){var n,r;n=this._delegate,r=t,t=e,"firestore.googleapis.com"!==(e=(n=YN(n,ZN))._getSettings()).host&&e.host!==r&&Ky("Host has been set in both settings() and useEmulator(), emulator host will be used"),n._setSettings(Object.assign(Object.assign({},e),{host:r+":"+t,ssl:!1}))},AR.prototype.enableNetwork=function(){return function(i){var t=this;return i.asyncQueue.enqueue(function(){return $i(t,void 0,void 0,function(){var n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,TN(i)];case 1:return n=t.sent(),[4,SN(i)];case 2:return r=t.sent(),[2,(n.setNetworkEnabled(!0),(e=r).$r.delete(0),LS(e))]}var e})})})}(wA(YN(this._delegate,yA)))},AR.prototype.disableNetwork=function(){return function(r){var t=this;return r.asyncQueue.enqueue(function(){return $i(t,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,TN(r)];case 1:return e=t.sent(),[4,SN(r)];case 2:return n=t.sent(),[2,(e.setNetworkEnabled(!1),function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return(e=n).$r.add(0),[4,MS(e)];case 1:return t.sent(),e.Br.set("Offline"),[2]}})})}(n))]}})})})}(wA(YN(this._delegate,yA)))},AR.prototype.enablePersistence=function(t){var e=!1,n=!1;return t&&HN("synchronizeTabs",e=!!t.synchronizeTabs,"experimentalForceOwningTab",n=!!t.experimentalForceOwningTab),e?this.Jc.enableMultiTabIndexedDbPersistence(this):this.Jc.enableIndexedDbPersistence(this,n)},AR.prototype.clearPersistence=function(){return this.Jc.clearIndexedDbPersistence(this)},AR.prototype.terminate=function(){return this.Yc&&(this.Yc._removeServiceInstance("firestore"),this.Yc._removeServiceInstance("firestore-exp")),this._delegate._delete()},AR.prototype.waitForPendingWrites=function(){return function(n){var t=this,r=new aI;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=MC,[4,CN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})}),r.promise}(wA(YN(this._delegate,yA)))},AR.prototype.onSnapshotsInSync=function(t){return e=this._delegate,t=t,function(n,t){var e=this,r=new cN(t);return n.asyncQueue.enqueueAndForget(function(){return $i(e,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(t,e){t.Gr.add(e),e.next()},[4,NN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})}),function(){r.Wo(),n.asyncQueue.enqueueAndForget(function(){return $i(e,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(t,e){t.Gr.delete(e)},[4,NN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})})}}(wA(YN(e,yA)),dA(t)?t:{next:t});var e},Object.defineProperty(AR.prototype,"app",{get:function(){if(!this.Yc)throw new Fy(My.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.Yc},enumerable:!1,configurable:!0}),AR.prototype.collection=function(t){try{return new YR(this,uA(this._delegate,t))}catch(t){throw jR(t,"collection()","Firestore.collection()")}},AR.prototype.doc=function(t){try{return new FR(this,cA(this._delegate,t))}catch(t){throw jR(t,"doc()","Firestore.doc()")}},AR.prototype.collectionGroup=function(t){try{return new GR(this,function(t,e){if(t=YN(t,ZN),KN("collectionGroup","collection id",e),0<=e.indexOf("/"))throw new Fy(My.INVALID_ARGUMENT,"Invalid collection ID '"+e+"' passed to function collectionGroup(). Collection IDs must not contain '/'.");return new eA(t,null,(e=e,new Sb(am.emptyPath(),e)))}(this._delegate,t))}catch(t){throw jR(t,"collectionGroup()","Firestore.collectionGroup()")}},AR.prototype.runTransaction=function(e){var n,r=this;return function(n,r){var t=this,i=new aI;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,IN(n).then(function(t){return t.datastore})];case 1:return e=t.sent(),new fN(n.asyncQueue,e,r,i).run(),[2]}})})}),i.promise}(wA(n=this._delegate),function(t){return t=new yR(n,t),e(new PR(r,t))})},AR.prototype.batch=function(){var e=this;return wA(this._delegate),new OR(new oR(this._delegate,function(t){return dR(e._delegate,t)}))},AR.prototype.loadBundle=function(t){throw new Fy(My.FAILED_PRECONDITION,'"loadBundle()" does not exist, have you imported "firebase/firestore/bundle"?')},AR.prototype.namedQuery=function(t){throw new Fy(My.FAILED_PRECONDITION,'"namedQuery()" does not exist, have you imported "firebase/firestore/bundle"?')},AR),CR=(Xi(NR,IR=Sn),NR.prototype.convertBytes=function(t){return new TR(new SA(t))},NR.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return FR.Xc(t,this.firestore,null)},NR);function NR(t){var e=this;return(e=IR.call(this)||this).firestore=t,e}function AR(t,e,n){var r=this;this._delegate=e,this.Jc=n,this.INTERNAL={delete:function(){return r.terminate()}},t instanceof ON||(this.Yc=t)}function kR(){}function RR(t){this._delegate=t}var PR=(MR.prototype.get=function(t){var e=this,n=nP(t);return this._delegate.get(n).then(function(t){return new WR(e._firestore,new Ck(e._firestore._delegate,e._userDataWriter,t._key,t._document,t.metadata,n._converter))})},MR.prototype.set=function(t,e,n){t=nP(t);return n?(WN("Transaction.set",n),this._delegate.set(t,e,n)):this._delegate.set(t,e),this},MR.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];var o=nP(t);return 2===arguments.length?this._delegate.update(o,e):(t=this._delegate).update.apply(t,no([o,e,n],r)),this},MR.prototype.delete=function(t){t=nP(t);return this._delegate.delete(t),this},MR),OR=(LR.prototype.set=function(t,e,n){t=nP(t);return n?(WN("WriteBatch.set",n),this._delegate.set(t,e,n)):this._delegate.set(t,e),this},LR.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];var o=nP(t);return 2===arguments.length?this._delegate.update(o,e):(t=this._delegate).update.apply(t,no([o,e,n],r)),this},LR.prototype.delete=function(t){t=nP(t);return this._delegate.delete(t),this},LR.prototype.commit=function(){return this._delegate.commit()},LR),DR=(xR.prototype.fromFirestore=function(t,e){t=new Nk(this._firestore._delegate,this._userDataWriter,t._key,t._document,t.metadata,null);return this._delegate.fromFirestore(new HR(this._firestore,t),null!=e?e:{})},xR.prototype.toFirestore=function(t,e){return e?this._delegate.toFirestore(t,e):this._delegate.toFirestore(t)},xR.Zc=function(t,e){var n=xR.tu,r=n.get(t);r||(r=new WeakMap,n.set(t,r));n=r.get(e);return n||(n=new xR(t,new CR(t),e),r.set(e,n)),n},xR);function xR(t,e,n){this._firestore=t,this._userDataWriter=e,this._delegate=n}function LR(t){this._delegate=t}function MR(t,e){this._firestore=t,this._delegate=e,this._userDataWriter=new CR(t)}DR.tu=new WeakMap;var FR=(UR.eu=function(t,e,n){if(t.length%2!=0)throw new Fy(My.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.canonicalString()+" has "+t.length);return new UR(e,new tA(e._delegate,n,new Cm(t)))},UR.Xc=function(t,e,n){return new UR(e,new tA(e._delegate,n,t))},Object.defineProperty(UR.prototype,"id",{get:function(){return this._delegate.id},enumerable:!1,configurable:!0}),Object.defineProperty(UR.prototype,"parent",{get:function(){return new YR(this.firestore,this._delegate.parent)},enumerable:!1,configurable:!0}),Object.defineProperty(UR.prototype,"path",{get:function(){return this._delegate.path},enumerable:!1,configurable:!0}),UR.prototype.collection=function(t){try{return new YR(this.firestore,uA(this._delegate,t))}catch(t){throw jR(t,"collection()","DocumentReference.collection()")}},UR.prototype.isEqual=function(t){return(t=Zo(t))instanceof tA&&hA(this._delegate,t)},UR.prototype.set=function(t,e){e=WN("DocumentReference.set",e);try{return function(t,e,n){t=YN(t,tA);var r=YN(t.firestore,yA),e=nR(t._converter,e,n);return dR(r,[BA(VA(r),"setDoc",t._key,e,null!==t._converter,n).toMutation(t._key,cw.none())])}(this._delegate,t,e)}catch(t){throw jR(t,"setDoc()","DocumentReference.set()")}},UR.prototype.update=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];try{return 1===arguments.length?fR(this._delegate,t):fR.apply(void 0,no([this._delegate,t,e],n))}catch(t){throw jR(t,"updateDoc()","DocumentReference.update()")}},UR.prototype.delete=function(){return dR(YN((t=this._delegate).firestore,yA),[new Aw(t._key,cw.none())]);var t},UR.prototype.onSnapshot=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=qR(t),i=VR(t,function(t){return new WR(e.firestore,new Ck(e.firestore._delegate,e._userDataWriter,t._key,t._document,t.metadata,e._delegate._converter))});return pR(this._delegate,r,i)},UR.prototype.get=function(t){var e=this;return("cache"===(null==t?void 0:t.source)?function(e){e=YN(e,tA);var n=YN(e.firestore,yA),t=wA(n),r=new hR(n);return function(n,r){var t=this,i=new aI;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(o,s,a){return $i(this,void 0,void 0,function(){var r,i;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(e=s,(n=o).persistence.runTransaction("read document","readonly",function(t){return n.Mn.mn(t,e)}))];case 1:return(i=t.sent()).isFoundDocument()?a.resolve(i):i.isNoDocument()?a.resolve(null):a.reject(new Fy(My.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 r=t.sent(),i=nC(r,"Failed to get document '"+s+" from cache"),a.reject(i),[3,3];case 3:return[2]}var e,n})})},[4,EN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(t,e._key).then(function(t){return new Ck(n,r,e._key,t,new Sk(null!==t&&t.hasLocalMutations,!0),e._converter)})}:"server"===(null==t?void 0:t.source)?function(e){e=YN(e,tA);var n=YN(e.firestore,yA);return AN(wA(n),e._key,{source:"server"}).then(function(t){return vR(n,e,t)})}:function(e){e=YN(e,tA);var n=YN(e.firestore,yA);return AN(wA(n),e._key).then(function(t){return vR(n,e,t)})})(this._delegate).then(function(t){return new WR(e.firestore,new Ck(e.firestore._delegate,e._userDataWriter,t._key,t._document,t.metadata,e._delegate._converter))})},UR.prototype.withConverter=function(t){return new UR(this.firestore,t?this._delegate.withConverter(DR.Zc(this.firestore,t)):this._delegate.withConverter(null))},UR);function UR(t,e){this.firestore=t,this._delegate=e,this._userDataWriter=new CR(t)}function jR(t,e,n){return t.message=t.message.replace(e,n),t}function qR(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];if("object"==typeof r&&!dA(r))return r}return{}}function VR(t,e){var n;return{next:function(t){n.next&&n.next(e(t))},error:null===(t=(n=dA(t[0])?t[0]:dA(t[1])?t[1]:"function"==typeof t[0]?{next:t[0],error:t[1],complete:t[2]}:{next:t[1],error:t[2],complete:t[3]}).error)||void 0===t?void 0:t.bind(n),complete:null===(t=n.complete)||void 0===t?void 0:t.bind(n)}}var BR,KR,WR=(Object.defineProperty(eP.prototype,"ref",{get:function(){return new FR(this._firestore,this._delegate.ref)},enumerable:!1,configurable:!0}),Object.defineProperty(eP.prototype,"id",{get:function(){return this._delegate.id},enumerable:!1,configurable:!0}),Object.defineProperty(eP.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(eP.prototype,"exists",{get:function(){return this._delegate.exists()},enumerable:!1,configurable:!0}),eP.prototype.data=function(t){return this._delegate.data(t)},eP.prototype.get=function(t,e){return this._delegate.get(t,e)},eP.prototype.isEqual=function(t){return Dk(this._delegate,t._delegate)},eP),HR=(Xi(tP,KR=WR),tP.prototype.data=function(t){return this._delegate.data(t)},tP),GR=(ZR.prototype.where=function(t,e,n){try{return new ZR(this.firestore,Lk(this._delegate,(r=n,i=e,o=Ik("where",t),new Vk(o,i,r))))}catch(t){throw jR(t,/(orderBy|where)\(\)/,"Query.$1()")}var r,i,o},ZR.prototype.orderBy=function(t,e){try{return new ZR(this.firestore,Lk(this._delegate,(n=void 0===e?"asc":e,r=Ik("orderBy",t),new Bk(r,n))))}catch(t){throw jR(t,/(orderBy|where)\(\)/,"Query.$1()")}var n,r},ZR.prototype.limit=function(t){try{return new ZR(this.firestore,Lk(this._delegate,(XN("limit",e=t),new Kk("limit",e,"F"))))}catch(t){throw jR(t,"limit()","Query.limit()")}var e},ZR.prototype.limitToLast=function(t){try{return new ZR(this.firestore,Lk(this._delegate,(XN("limitToLast",e=t),new Kk("limitToLast",e,"L"))))}catch(t){throw jR(t,"limitToLast()","Query.limitToLast()")}var e},ZR.prototype.startAt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new ZR(this.firestore,Lk(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Wk("startAt",t,!0)}.apply(void 0,t)))}catch(t){throw jR(t,"startAt()","Query.startAt()")}},ZR.prototype.startAfter=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new ZR(this.firestore,Lk(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Wk("startAfter",t,!1)}.apply(void 0,t)))}catch(t){throw jR(t,"startAfter()","Query.startAfter()")}},ZR.prototype.endBefore=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new ZR(this.firestore,Lk(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Hk("endBefore",t,!0)}.apply(void 0,t)))}catch(t){throw jR(t,"endBefore()","Query.endBefore()")}},ZR.prototype.endAt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new ZR(this.firestore,Lk(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Hk("endAt",t,!1)}.apply(void 0,t)))}catch(t){throw jR(t,"endAt()","Query.endAt()")}},ZR.prototype.isEqual=function(t){return lA(this._delegate,t._delegate)},ZR.prototype.get=function(t){var e=this;return("cache"===(null==t?void 0:t.source)?function(e){e=YN(e,eA);var n=YN(e.firestore,yA),t=wA(n),r=new hR(n);return function(n,r){var t=this,i=new aI;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(i,o,s){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,vE(i,o,!0)];case 1:return r=t.sent(),e=new SC(o,r.Bn),n=e._o(r.documents),n=e.applyChanges(n,!1),s.resolve(n.snapshot),[3,3];case 2:return n=t.sent(),r=nC(n,"Failed to execute query '"+o+" against cache"),s.reject(r),[3,3];case 3:return[2]}})})},[4,EN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(t,e._query).then(function(t){return new Ak(n,r,e,t)})}:"server"===(null==t?void 0:t.source)?function(e){e=YN(e,eA);var n=YN(e.firestore,yA),t=wA(n),r=new hR(n);return kN(t,e._query,{source:"server"}).then(function(t){return new Ak(n,r,e,t)})}:function(e){e=YN(e,eA);var n=YN(e.firestore,yA),t=wA(n),r=new hR(n);return xk(e._query),kN(t,e._query).then(function(t){return new Ak(n,r,e,t)})})(this._delegate).then(function(t){return new QR(e.firestore,new Ak(e.firestore._delegate,e._userDataWriter,e._delegate,t._snapshot))})},ZR.prototype.onSnapshot=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=qR(t),i=VR(t,function(t){return new QR(e.firestore,new Ak(e.firestore._delegate,e._userDataWriter,e._delegate,t._snapshot))});return pR(this._delegate,r,i)},ZR.prototype.withConverter=function(t){return new ZR(this.firestore,t?this._delegate.withConverter(DR.Zc(this.firestore,t)):this._delegate.withConverter(null))},ZR),zR=(Object.defineProperty($R.prototype,"type",{get:function(){return this._delegate.type},enumerable:!1,configurable:!0}),Object.defineProperty($R.prototype,"doc",{get:function(){return new HR(this._firestore,this._delegate.doc)},enumerable:!1,configurable:!0}),Object.defineProperty($R.prototype,"oldIndex",{get:function(){return this._delegate.oldIndex},enumerable:!1,configurable:!0}),Object.defineProperty($R.prototype,"newIndex",{get:function(){return this._delegate.newIndex},enumerable:!1,configurable:!0}),$R),QR=(Object.defineProperty(JR.prototype,"query",{get:function(){return new GR(this._firestore,this._delegate.query)},enumerable:!1,configurable:!0}),Object.defineProperty(JR.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(JR.prototype,"size",{get:function(){return this._delegate.size},enumerable:!1,configurable:!0}),Object.defineProperty(JR.prototype,"empty",{get:function(){return this._delegate.empty},enumerable:!1,configurable:!0}),Object.defineProperty(JR.prototype,"docs",{get:function(){var e=this;return this._delegate.docs.map(function(t){return new HR(e._firestore,t)})},enumerable:!1,configurable:!0}),JR.prototype.docChanges=function(t){var e=this;return this._delegate.docChanges(t).map(function(t){return new zR(e._firestore,t)})},JR.prototype.forEach=function(e,n){var r=this;this._delegate.forEach(function(t){e.call(n,new HR(r._firestore,t))})},JR.prototype.isEqual=function(t){return Dk(this._delegate,t._delegate)},JR),YR=(Xi(XR,BR=GR),Object.defineProperty(XR.prototype,"id",{get:function(){return this._delegate.id},enumerable:!1,configurable:!0}),Object.defineProperty(XR.prototype,"path",{get:function(){return this._delegate.path},enumerable:!1,configurable:!0}),Object.defineProperty(XR.prototype,"parent",{get:function(){var t=this._delegate.parent;return t?new FR(this.firestore,t):null},enumerable:!1,configurable:!0}),XR.prototype.doc=function(t){try{return new FR(this.firestore,void 0===t?cA(this._delegate):cA(this._delegate,t))}catch(t){throw jR(t,"doc()","CollectionReference.doc()")}},XR.prototype.add=function(t){var e,n,r,i=this;return e=this._delegate,n=t,t=YN(e.firestore,yA),r=cA(e),n=nR(e._converter,n),dR(t,[BA(VA(e.firestore),"addDoc",r._key,n,null!==e._converter,{}).toMutation(r._key,cw.exists(!1))]).then(function(){return r}).then(function(t){return new FR(i.firestore,t)})},XR.prototype.isEqual=function(t){return hA(this._delegate,t._delegate)},XR.prototype.withConverter=function(t){return new XR(this.firestore,t?this._delegate.withConverter(DR.Zc(this.firestore,t)):this._delegate.withConverter(null))},XR);function XR(t,e){var n=this;return(n=BR.call(this,t,e)||this).firestore=t,n._delegate=e,n}function JR(t,e){this._firestore=t,this._delegate=e}function $R(t,e){this._firestore=t,this._delegate=e}function ZR(t,e){this.firestore=t,this._delegate=e,this._userDataWriter=new CR(t)}function tP(){return null!==KR&&KR.apply(this,arguments)||this}function eP(t,e){this._firestore=t,this._delegate=e}function nP(t){return YN(t,tA)}iP.documentId=function(){return new iP(cm.keyField().canonicalString())},iP.prototype.isEqual=function(t){return(t=Zo(t))instanceof EA&&this._delegate._internalPath.isEqual(t._internalPath)},Ga=iP,rP.serverTimestamp=function(){var t=new JA("serverTimestamp");return t._methodName="FieldValue.serverTimestamp",new rP(t)},rP.delete=function(){var t=new WA("deleteField");return t._methodName="FieldValue.delete",new rP(t)},rP.arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new $A("arrayUnion",t)}.apply(void 0,t);return n._methodName="FieldValue.arrayUnion",new rP(n)},rP.arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new ZA("arrayRemove",t)}.apply(void 0,t);return n._methodName="FieldValue.arrayRemove",new rP(n)},rP.increment=function(t){t=new tk("increment",t);return t._methodName="FieldValue.increment",new rP(t)},rP.prototype.isEqual=function(t){return this._delegate.isEqual(t._delegate)},Sn=rP;function rP(t){this._delegate=t}function iP(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._delegate=new(EA.bind.apply(EA,no([void 0],t)))}function oP(t){return e=this._delegate,s=t,n=wA(e=YN(e,yA)),t=new gA,function(n,t,r){var e,i=this,o=(e=s,t=bS(t),e=function(t){if(t instanceof Uint8Array)return uN(t,void 0);if(t instanceof ArrayBuffer)return uN(new Uint8Array(t),void 0);if(t instanceof ReadableStream)return t.getReader();throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream")}("string"==typeof e?(new TextEncoder).encode(e):e),new hN(e,t));n.asyncQueue.enqueueAndForget(function(){return $i(i,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=JC,[4,CN(n)];case 1:return e.apply(void 0,[t.sent(),o,r]),[2]}})})})}(n,e._databaseId,t),t;var e,s,n}function sP(t){var e=this,n=this._delegate,t=t;return function(n,r){var t=this;return n.asyncQueue.enqueue(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(t,e){var n=t;return n.persistence.runTransaction("Get named query","readonly",function(t){return n.Qe.getNamedQuery(t,e)})},[4,EN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})})}(wA(n=YN(n,yA)),t).then(function(t){return t?new eA(n,null,t.query):null}).then(function(t){return t?new GR(e,t):null})}var aP,uP,cP={Firestore:SR,GeoPoint:NA,Timestamp:$y,Blob:TR,Transaction:PR,WriteBatch:OR,DocumentReference:FR,DocumentSnapshot:WR,Query:GR,QueryDocumentSnapshot:HR,QuerySnapshot:QR,CollectionReference:YR,FieldPath:Ga,FieldValue:Sn,setLogLevel:function(t){Uy.setLogLevel(t)},CACHE_SIZE_UNLIMITED:-1};(aP=Xl).INTERNAL.registerComponent(new ts("firestore",function(t){var e=t.getProvider("app").getImmediate();return e=e,t=t.getProvider("auth-internal"),new SR(e,new yA(e,t),new ER)},"PUBLIC").setServiceProps(Object.assign({},cP))),aP.registerVersion("@firebase/firestore","2.2.2"),(uP=SR).prototype.loadBundle=oP,uP.prototype.namedQuery=sP;var hP,lP={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"},fP=(Xi(pP,hP=Error),pP);function pP(t,e,n){e=hP.call(this,e)||this;return Object.setPrototypeOf(e,pP.prototype),e.code=t,e.details=n,e}function dP(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(!lP[a])return new fP("internal","internal");r=lP[a],i=a}a=s.message;"string"==typeof a&&(i=a),void 0!==(o=s.details)&&(o=n.decode(o))}}catch(t){}return"ok"===r?null:new fP(r,i,o)}var vP=(gP.prototype.getAuthToken=function(){return $i(this,void 0,void 0,function(){var e;return Zi(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]}})})},gP.prototype.getInstanceIdToken=function(){return $i(this,void 0,void 0,function(){return Zi(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]})})},gP.prototype.getContext=function(){return $i(this,void 0,void 0,function(){var e,n;return Zi(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}]}})})},gP);function gP(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 yP(t,e){var n,r={};for(n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}var mP=(bP.prototype.encode=function(t){var e=this;if(null==t)return null;if("number"==typeof(t=t instanceof Number?t.valueOf():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 yP(t,function(t){return e.encode(t)});throw new Error("Data cannot be encoded in JSON: "+t)},bP.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?yP(t,function(t){return e.decode(t)}):t},bP);function bP(){}var wP=(Object.defineProperty(_P.prototype,"app",{get:function(){return this.app_},enumerable:!1,configurable:!0}),_P.prototype._url=function(t){var e=this.app_.options.projectId;return null===this.emulatorOrigin?null!==this.customDomain?this.customDomain+"/"+t:"https://"+this.region+"-"+e+".cloudfunctions.net/"+t:this.emulatorOrigin+"/"+e+"/"+this.region+"/"+t},_P.prototype.useEmulator=function(t,e){this.emulatorOrigin="http://"+t+":"+e},_P.prototype.useFunctionsEmulator=function(t){this.emulatorOrigin=t},_P.prototype.httpsCallable=function(e,n){var r=this;return function(t){return r.call(e,t,n||{})}},_P.prototype.postJSON=function(r,i,o){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:o["Content-Type"]="application/json",t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.fetchImpl(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}]}})})},_P.prototype.call=function(c,h,l){return $i(this,void 0,void 0,function(){var i,o,s,a,u;return Zi(this,function(t){switch(t.label){case 0:return i=this._url(c),h=this.serializer.encode(h),o={data:h},s={},[4,this.contextProvider.getContext()];case 1:return(a=t.sent()).authToken&&(s.Authorization="Bearer "+a.authToken),a.instanceIdToken&&(s["Firebase-Instance-ID-Token"]=a.instanceIdToken),u=l.timeout||7e4,n=u,e=new Promise(function(t,e){r=setTimeout(function(){e(new fP("deadline-exceeded","deadline-exceeded"))},n)}),u=(a={timer:r,promise:e}).timer,a=a.promise,[4,Promise.race([IP(u,this.postJSON(i,o,s)),a,IP(u,this.cancelAllRequests)])];case 2:if(!(a=t.sent()))throw new fP("cancelled","Firebase Functions instance was deleted.");if(u=dP(a.status,a.json,this.serializer))throw u;if(!a.json)throw new fP("internal","Response is not valid JSON object.");if(void 0===(u=void 0===(u=a.json.data)?a.json.result:u))throw new fP("internal","Response is missing data field.");return[2,{data:this.serializer.decode(u)}]}var n,r,e})})},_P);function _P(t,e,n,r,i){var o=this;void 0===r&&(r="us-central1"),this.app_=t,this.fetchImpl=i,this.serializer=new mP,this.emulatorOrigin=null,this.INTERNAL={delete:function(){return Promise.resolve(o.deleteService())}},this.contextProvider=new vP(e,n),this.cancelAllRequests=new Promise(function(t){o.deleteService=function(){return t()}});try{var s=new URL(r);this.customDomain=s.origin,this.region="us-central1"}catch(t){this.customDomain=null,this.region=r}}function IP(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,r];case 1:return e=t.sent(),clearTimeout(n),[2,e]}})})}var TP,EP,SP;function CP(n){return new Promise(function(t,e){n.onsuccess=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function NP(n,r,i){var o,t=new Promise(function(t,e){CP(o=n[r].apply(n,i)).then(t,e)});return t.request=o,t}function AP(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 kP(e,n,r,t){t.forEach(function(t){t in r.prototype&&(e.prototype[t]=function(){return NP(this[n],t,arguments)})})}function RP(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 PP(t,r,e,n){n.forEach(function(n){n in e.prototype&&(t.prototype[n]=function(){return t=this[r],(e=NP(t,n,arguments)).then(function(t){if(t)return new DP(t,e.request)});var t,e})})}function OP(t){this._index=t}function DP(t,e){this._cursor=t,this._request=e}function xP(t){this._store=t}function LP(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 MP(t,e,n){this._db=t,this.oldVersion=e,this.transaction=new LP(n)}function FP(t){this._db=t}function UP(t,e,n){var e=NP(indexedDB,"open",[t,e]),r=e.request;return r&&(r.onupgradeneeded=function(t){n&&n(new MP(r.result,t.oldVersion,r.transaction))}),e.then(function(t){return new FP(t)})}function jP(t){return NP(indexedDB,"deleteDatabase",[t])}TP=Xl,EP=fetch.bind(self),SP={Functions:wP},TP.INTERNAL.registerComponent(new ts("functions",function(t,e){var n=e.instanceIdentifier,r=t.getProvider("app").getImmediate(),e=t.getProvider("auth-internal"),t=t.getProvider("messaging");return new wP(r,e,t,n,EP)},"PUBLIC").setServiceProps(SP).setMultipleInstances(!0)),Xl.registerVersion("@firebase/functions","0.6.5"),AP(OP,"_index",["name","keyPath","multiEntry","unique"]),kP(OP,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),PP(OP,"_index",IDBIndex,["openCursor","openKeyCursor"]),AP(DP,"_cursor",["direction","key","primaryKey","value"]),kP(DP,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(DP.prototype[n]=function(){var e=this,t=arguments;return Promise.resolve().then(function(){return e._cursor[n].apply(e._cursor,t),CP(e._request).then(function(t){if(t)return new DP(t,e._request)})})})}),xP.prototype.createIndex=function(){return new OP(this._store.createIndex.apply(this._store,arguments))},xP.prototype.index=function(){return new OP(this._store.index.apply(this._store,arguments))},AP(xP,"_store",["name","keyPath","indexNames","autoIncrement"]),kP(xP,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),PP(xP,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),RP(xP,"_store",IDBObjectStore,["deleteIndex"]),LP.prototype.objectStore=function(){return new xP(this._tx.objectStore.apply(this._tx,arguments))},AP(LP,"_tx",["objectStoreNames","mode"]),RP(LP,"_tx",IDBTransaction,["abort"]),MP.prototype.createObjectStore=function(){return new xP(this._db.createObjectStore.apply(this._db,arguments))},AP(MP,"_db",["name","version","objectStoreNames"]),RP(MP,"_db",IDBDatabase,["deleteObjectStore","close"]),FP.prototype.transaction=function(){return new LP(this._db.transaction.apply(this._db,arguments))},AP(FP,"_db",["name","version","objectStoreNames"]),RP(FP,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(i){[xP,OP].forEach(function(t){i in t.prototype&&(t.prototype[i.replace("open","iterate")]=function(){var t=(n=arguments,Array.prototype.slice.call(n)),e=t[t.length-1],n=this._store||this._index,r=n[i].apply(n,t.slice(0,-1));r.onsuccess=function(){e(r.result)}})})}),[OP,xP].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 qP=1e4,VP="w:0.4.23",BP="FIS_v2",KP="https://firebaseinstallations.googleapis.com/v1",WP=36e5,Sn=((Ga={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',Ga["not-registered"]="Firebase Installation is not registered.",Ga["installation-not-found"]="Firebase Installation not found.",Ga["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',Ga["app-offline"]="Could not process request. Application offline.",Ga["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",Ga),HP=new Co("installations","Installations",Sn);function GP(t){return t instanceof Eo&&t.code.includes("request-failed")}function zP(t){t=t.projectId;return KP+"/projects/"+t+"/installations"}function QP(t){return{token:t.token,requestStatus:2,expiresIn:(t=t.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()}}function YP(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,r.json()];case 1:return e=t.sent(),e=e.error,[2,HP.create("request-failed",{requestName:n,serverCode:e.code,serverMessage:e.message,serverStatus:e.status})]}})})}function XP(t){t=t.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function JP(t,e){e=e.refreshToken,t=XP(t);return t.append("Authorization",BP+" "+e),t}function $P(n){return $i(this,void 0,void 0,function(){var e;return Zi(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 ZP(e){return new Promise(function(t){setTimeout(t,e)})}var tO=/^[cdef][\w-]{21}$/,eO="";function nO(){try{var t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;t=function(t){return btoa(String.fromCharCode.apply(String,no([],eo(t)))).replace(/\+/g,"-").replace(/\//g,"_")}(t).substr(0,22);return tO.test(t)?t:eO}catch(t){return eO}}function rO(t){return t.appName+"!"+t.appId}var iO=new Map;function oO(t,e){t=rO(t);sO(t,e),function(t,e){var n=uO();n&&n.postMessage({key:t,fid:e});cO()}(t,e)}function sO(t,e){var n,r,i=iO.get(t);if(i)try{for(var o=to(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 aO=null;function uO(){return!aO&&"BroadcastChannel"in self&&((aO=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(t){sO(t.data.key,t.data.fid)}),aO}function cO(){0===iO.size&&aO&&(aO.close(),aO=null)}var hO,lO="firebase-installations-database",fO=1,pO="firebase-installations-store",dO=null;function vO(){return dO=dO||UP(lO,fO,function(t){0===t.oldVersion&&t.createObjectStore(pO)})}function gO(o,s){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return e=rO(o),[4,vO()];case 1:return r=t.sent(),n=r.transaction(pO,"readwrite"),[4,(r=n.objectStore(pO)).get(e)];case 2:return i=t.sent(),[4,r.put(s,e)];case 3:return t.sent(),[4,n.complete];case 4:return t.sent(),i&&i.fid===s.fid||oO(o,s.fid),[2,s]}})})}function yO(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=rO(r),[4,vO()];case 1:return n=t.sent(),[4,(n=n.transaction(pO,"readwrite")).objectStore(pO).delete(e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2]}})})}function mO(s,a){return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return e=rO(s),[4,vO()];case 1:return r=t.sent(),n=r.transaction(pO,"readwrite"),[4,(r=n.objectStore(pO)).get(e)];case 2:return i=t.sent(),void 0!==(o=a(i))?[3,4]:[4,r.delete(e)];case 3:return t.sent(),[3,6];case 4:return[4,r.put(o,e)];case 5:t.sent(),t.label=6;case 6:return[4,n.complete];case 7:return t.sent(),!o||i&&i.fid===o.fid||oO(s,o.fid),[2,o]}})})}function bO(i){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,mO(i,function(t){t=_O(t||{fid:nO(),registrationStatus:0}),t=function(t,e){{if(0!==e.registrationStatus)return 1===e.registrationStatus?{installationEntry:e,registrationPromise:function(i){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,wO(i)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.registrationStatus?[3,5]:[4,ZP(100)];case 3:return t.sent(),[4,wO(i)];case 4:return e=t.sent(),[3,2];case 5:return 0!==e.registrationStatus?[3,7]:[4,bO(i)];case 6:return r=t.sent(),n=r.installationEntry,(r=r.registrationPromise)?[2,r]:[2,n];case 7:return[2,e]}})})}(t)}:{installationEntry:e};if(!navigator.onLine){var n=Promise.reject(HP.create("app-offline"));return{installationEntry:e,registrationPromise:n}}e={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},t=function(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,function(s,t){var a=t.fid;return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return e=zP(s),n=XP(s),o={fid:a,authVersion:BP,appId:s.appId,sdkVersion:VP},r={method:"POST",headers:n,body:JSON.stringify(o)},[4,$P(function(){return fetch(e,r)})];case 1:return(i=t.sent()).ok?[4,i.json()]:[3,3];case 2:return o=t.sent(),[2,{fid:o.fid||a,registrationStatus:2,refreshToken:o.refreshToken,authToken:QP(o.authToken)}];case 3:return[4,YP("Create Installation",i)];case 4:throw t.sent()}})})}(r,i)];case 1:return e=t.sent(),[2,gO(r,e)];case 2:return GP(n=t.sent())&&409===n.customData.serverCode?[4,yO(r)]:[3,4];case 3:return t.sent(),[3,6];case 4:return[4,gO(r,{fid:i.fid,registrationStatus:0})];case 5:t.sent(),t.label=6;case 6:throw n;case 7:return[2]}})})}(t,e);return{installationEntry:e,registrationPromise:t}}}(i,t);return e=t.registrationPromise,t.installationEntry})];case 1:return(n=t.sent()).fid!==eO?[3,3]:(r={},[4,e]);case 2:return[2,(r.installationEntry=t.sent(),r)];case 3:return[2,{installationEntry:n,registrationPromise:e}]}})})}function wO(t){return mO(t,function(t){if(!t)throw HP.create("installation-not-found");return _O(t)})}function _O(t){return 1===(e=t).registrationStatus&&e.registrationTime+qP<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}function IO(t,s){var a=t.appConfig,u=t.platformLoggerProvider;return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return e=function(t,e){e=e.fid;return zP(t)+"/"+e+"/authTokens:generate"}(a,s),n=JP(a,s),(o=u.getImmediate({optional:!0}))&&n.append("x-firebase-client",o.getPlatformInfoString()),o={installation:{sdkVersion:VP}},r={method:"POST",headers:n,body:JSON.stringify(o)},[4,$P(function(){return fetch(e,r)})];case 1:return(i=t.sent()).ok?[4,i.json()]:[3,3];case 2:return o=t.sent(),[2,QP(o)];case 3:return[4,YP("Generate Auth Token",i)];case 4:throw t.sent()}})})}function TO(i,o){return void 0===o&&(o=!1),$i(this,void 0,void 0,function(){var r,e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,mO(i.appConfig,function(t){if(!SO(t))throw HP.create("not-registered");var e,n=t.authToken;if(o||2!==(e=n).requestStatus||function(t){var e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+WP}(e)){if(1===n.requestStatus)return r=function(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,EO(n.appConfig)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.authToken.requestStatus?[3,5]:[4,ZP(100)];case 3:return t.sent(),[4,EO(n.appConfig)];case 4:return e=t.sent(),[3,2];case 5:return 0===(e=e.authToken).requestStatus?[2,TO(n,r)]:[2,e]}})})}(i,o),t;if(!navigator.onLine)throw HP.create("app-offline");n=(e=t,n={requestStatus:1,requestTime:Date.now()},Ji(Ji({},e),{authToken:n}));return r=function(i,o){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,8]),[4,IO(i,o)];case 1:return e=t.sent(),r=Ji(Ji({},o),{authToken:e}),[4,gO(i.appConfig,r)];case 2:return t.sent(),[2,e];case 3:return!GP(n=t.sent())||401!==n.customData.serverCode&&404!==n.customData.serverCode?[3,5]:[4,yO(i.appConfig)];case 4:return t.sent(),[3,7];case 5:return r=Ji(Ji({},o),{authToken:{requestStatus:0}}),[4,gO(i.appConfig,r)];case 6:t.sent(),t.label=7;case 7:throw n;case 8:return[2]}})})}(i,n),n}return t})];case 1:return e=t.sent(),r?[4,r]:[3,3];case 2:return n=t.sent(),[3,4];case 3:n=e.authToken,t.label=4;case 4:return[2,n]}})})}function EO(t){return mO(t,function(t){if(!SO(t))throw HP.create("not-registered");var e=t.authToken;return 1===(e=e).requestStatus&&e.requestTime+qP<Date.now()?Ji(Ji({},t),{authToken:{requestStatus:0}}):t})}function SO(t){return void 0!==t&&2===t.registrationStatus}function CO(e,n){return void 0===n&&(n=!1),$i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,bO(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,TO(e,n)];case 2:return[2,t.sent().token]}})})}function NO(i,o){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return e=function(t,e){e=e.fid;return zP(t)+"/"+e}(i,o),r=JP(i,o),n={method:"DELETE",headers:r},[4,$P(function(){return fetch(e,n)})];case 1:return(r=t.sent()).ok?[3,3]:[4,YP("Delete Installation",r)];case 2:throw t.sent();case 3:return[2]}})})}function AO(t,r){var i=t.appConfig;return function(t,e){uO();var n=rO(t);(t=iO.get(n))||(t=new Set,iO.set(n,t)),t.add(e)}(i,r),function(){var t,e,n;e=r,n=rO(t=i),(t=iO.get(n))&&(t.delete(e),0===t.size&&iO.delete(n),cO())}}function kO(t){return HP.create("missing-app-config-values",{valueName:t})}(hO=Xl).INTERNAL.registerComponent(new ts("installations",function(t){var e=t.getProvider("app").getImmediate(),n={appConfig:function(t){var e,n;if(!t||!t.options)throw kO("App Configuration");if(!t.name)throw kO("App Name");try{for(var r=to(["projectId","apiKey","appId"]),i=r.next();!i.done;i=r.next()){var o=i.value;if(!t.options[o])throw kO(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(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,bO(r.appConfig)];case 1:return e=t.sent(),n=e.installationEntry,(e.registrationPromise||TO(r)).catch(console.error),[2,n.fid]}})})}(n)},getToken:function(t){return CO(n,t)},delete:function(){return function(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,mO(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 HP.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw HP.create("app-offline");case 3:return[4,NO(e,n)];case 4:return t.sent(),[4,yO(e)];case 5:t.sent(),t.label=6;case 6:return[2]}})})}(n)},onIdChange:function(t){return AO(n,t)}}},"PUBLIC")),hO.registerVersion("@firebase/installations","0.4.23");var RO,Sn=((Ga={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',Ga["only-available-in-window"]="This method is available in a Window context.",Ga["only-available-in-sw"]="This method is available in a service worker context.",Ga["permission-default"]="The notification permission was not granted and dismissed instead.",Ga["permission-blocked"]="The notification permission was not granted and blocked instead.",Ga["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",Ga["failed-service-worker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",Ga["token-subscribe-failed"]="A problem occurred while subscribing the user to FCM: {$errorInfo}",Ga["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",Ga["token-unsubscribe-failed"]="A problem occurred while unsubscribing the user from FCM: {$errorInfo}",Ga["token-update-failed"]="A problem occurred while updating the user from FCM: {$errorInfo}",Ga["token-update-no-token"]="FCM returned no token when updating the user to push.",Ga["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.",Ga["invalid-sw-registration"]="The input to useServiceWorker() must be a ServiceWorkerRegistration.",Ga["invalid-bg-handler"]="The input to setBackgroundMessageHandler() must be a function.",Ga["invalid-vapid-key"]="The public VAPID key must be a string.",Ga["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.",Ga),PO=new Co("messaging","Messaging",Sn),OO="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",DO="https://fcmregistrations.googleapis.com/v1",xO="FCM_MSG",LO="google.c.a.c_id";function MO(t){t=new Uint8Array(t);return btoa(String.fromCharCode.apply(String,no([],eo(t)))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(Ga=RO=RO||{}).PUSH_RECEIVED="push-received",Ga.NOTIFICATION_CLICKED="notification-clicked";var FO="fcm_token_details_db",UO=5,jO="fcm_token_object_Store";function qO(s){return $i(this,void 0,void 0,function(){var e,o,n=this;return Zi(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(FO))return[2,null];t.label=2;case 2:return o=null,[4,UP(FO,UO,function(i){return $i(n,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return i.oldVersion<2?[2]:i.objectStoreNames.contains(jO)?[4,(r=i.transaction.objectStore(jO)).index("fcmSenderId").get(s)]:[2];case 1:return e=t.sent(),[4,r.clear()];case 2:if(t.sent(),!e)return[2];if(2===i.oldVersion){if(!(n=e).auth||!n.p256dh||!n.endpoint)return[2];o={token:n.fcmToken,createTime:null!==(r=n.createTime)&&void 0!==r?r:Date.now(),subscriptionOptions:{auth:n.auth,p256dh:n.p256dh,endpoint:n.endpoint,swScope:n.swScope,vapidKey:"string"==typeof n.vapidKey?n.vapidKey:MO(n.vapidKey)}}}else(3===i.oldVersion||4===i.oldVersion)&&(o={token:(n=e).fcmToken,createTime:n.createTime,subscriptionOptions:{auth:MO(n.auth),p256dh:MO(n.p256dh),endpoint:n.endpoint,swScope:n.swScope,vapidKey:MO(n.vapidKey)}});return[2]}})})})];case 3:return t.sent().close(),[4,jP(FO)];case 4:return t.sent(),[4,jP("fcm_vapid_details_db")];case 5:return t.sent(),[4,jP("undefined")];case 6:return t.sent(),[2,function(t){if(!t||!t.subscriptionOptions)return!1;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}(o)?o:null]}})})}var VO="firebase-messaging-database",BO=1,KO="firebase-messaging-store",WO=null;function HO(){return WO=WO||UP(VO,BO,function(t){0===t.oldVersion&&t.createObjectStore(KO)})}function GO(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=QO(r),[4,HO()];case 1:return[4,t.sent().transaction(KO).objectStore(KO).get(e)];case 2:return(e=t.sent())?[2,e]:[3,3];case 3:return[4,qO(r.appConfig.senderId)];case 4:return(n=t.sent())?[4,zO(r,n)]:[3,6];case 5:return t.sent(),[2,n];case 6:return[2]}})})}function zO(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=QO(r),[4,HO()];case 1:return n=t.sent(),[4,(n=n.transaction(KO,"readwrite")).objectStore(KO).put(i,e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2,i]}})})}function QO(t){return t.appConfig.appId}function YO(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,JO(r)];case 1:e=t.sent(),e={method:"DELETE",headers:e},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(XO(r.appConfig)+"/"+i,e)];case 3:return[4,t.sent().json()];case 4:if((e=t.sent()).error)throw n=e.error.message,PO.create("token-unsubscribe-failed",{errorInfo:n});return[3,6];case 5:throw n=t.sent(),PO.create("token-unsubscribe-failed",{errorInfo:n});case 6:return[2]}})})}function XO(t){t=t.projectId;return DO+"/projects/"+t+"/registrations"}function JO(t){var n=t.appConfig,r=t.installations;return $i(this,void 0,void 0,function(){var e;return Zi(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 $O(t){var e=t.p256dh,n=t.auth,r=t.endpoint,t=t.vapidKey,e={web:{endpoint:r,auth:n,p256dh:e}};return t!==OO&&(e.web.applicationPubKey=t),e}function ZO(c,h,l){return $i(this,void 0,void 0,function(){var s,a,u;return Zi(this,function(t){switch(t.label){case 0:if("granted"!==Notification.permission)throw PO.create("permission-blocked");return[4,function(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(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 t=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),e=atob(t),n=new Uint8Array(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}(r)})]}})})}(h,l)];case 1:return u=t.sent(),[4,GO(c)];case 2:return s=t.sent(),a={vapidKey:l,swScope:h.scope,endpoint:u.endpoint,auth:MO(u.getKey("auth")),p256dh:MO(u.getKey("p256dh"))},s?[3,3]:[2,eD(c,a)];case 3:if(e=s.subscriptionOptions,r=(n=a).vapidKey===e.vapidKey,i=n.endpoint===e.endpoint,o=n.auth===e.auth,e=n.p256dh===e.p256dh,r&&i&&o&&e)return[3,8];t.label=4;case 4:return t.trys.push([4,6,,7]),[4,YO(c,s.token)];case 5:return t.sent(),[3,7];case 6:return u=t.sent(),console.warn(u),[3,7];case 7:return[2,eD(c,a)];case 8:return Date.now()>=s.createTime+6048e5?[2,function(i,o,s){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,5]),[4,function(o,s){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return[4,JO(o)];case 1:e=t.sent(),n=$O(s.subscriptionOptions),n={method:"PATCH",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(XO(o.appConfig)+"/"+s.token,n)];case 3:return[4,t.sent().json()];case 4:return r=t.sent(),[3,6];case 5:throw i=t.sent(),PO.create("token-update-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,PO.create("token-update-failed",{errorInfo:i});if(!r.token)throw PO.create("token-update-no-token");return[2,r.token]}})})}(o,i)];case 1:return e=t.sent(),n=Ji(Ji({},i),{token:e,createTime:Date.now()}),[4,zO(o,n)];case 2:return t.sent(),[2,e];case 3:return r=t.sent(),[4,tD(o,s)];case 4:throw t.sent(),r;case 5:return[2]}})})}({token:s.token,createTime:Date.now(),subscriptionOptions:a},c,h)]:[2,s.token];case 9:return[2]}var e,n,r,i,o})})}function tD(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,GO(n)];case 1:return(e=t.sent())?[4,YO(n,e.token)]:[3,4];case 2:return t.sent(),[4,function(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=QO(r),[4,HO()];case 1:return n=t.sent(),[4,(n=n.transaction(KO,"readwrite")).objectStore(KO).delete(e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2]}})})}(n)];case 3:t.sent(),t.label=4;case 4:return[4,r.pushManager.getSubscription()];case 5:return(e=t.sent())?[2,e.unsubscribe()]:[2,!0]}})})}function eD(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,function(o,s){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return[4,JO(o)];case 1:e=t.sent(),n=$O(s),n={method:"POST",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(XO(o.appConfig),n)];case 3:return[4,t.sent().json()];case 4:return r=t.sent(),[3,6];case 5:throw i=t.sent(),PO.create("token-subscribe-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,PO.create("token-subscribe-failed",{errorInfo:i});if(!r.token)throw PO.create("token-subscribe-no-token");return[2,r.token]}})})}(n,r)];case 1:return e=t.sent(),e={token:e,createTime:Date.now(),subscriptionOptions:r},[4,zO(n,e)];case 2:return t.sent(),[2,e.token]}})})}function nD(t){var e={from:t.from,collapseKey:t.collapse_key};return function(t,e){if(!e.notification)return;t.notification={};var n=e.notification.title;n&&(t.notification.title=n);n=e.notification.body;n&&(t.notification.body=n);e=e.notification.image;e&&(t.notification.image=e)}(e,t),function(t,e){if(!e.data)return;t.data=e.data}(e,t),function(t,e){if(!e.fcmOptions)return;t.fcmOptions={};var n=e.fcmOptions.link;n&&(t.fcmOptions.link=n);e=e.fcmOptions.analytics_label;e&&(t.fcmOptions.analyticsLabel=e)}(e,t),e}function rD(t){return"object"==typeof t&&t&&LO in t}function iD(e){return new Promise(function(t){setTimeout(t,e)})}var oD=(Object.defineProperty(sD.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),sD.prototype.setBackgroundMessageHandler=function(t){if(this.isOnBackgroundMessageUsed=!1,!t||"function"!=typeof t)throw PO.create("invalid-bg-handler");this.bgMessageHandler=t},sD.prototype.onBackgroundMessage=function(t){var e=this;return this.isOnBackgroundMessageUsed=!0,this.bgMessageHandler=t,function(){e.bgMessageHandler=null}},sD.prototype.getToken=function(){var n;return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return this.vapidKey?[3,2]:[4,GO(this.firebaseDependencies)];case 1:e=t.sent(),this.vapidKey=null!==(n=null===(n=null==e?void 0:e.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==n?n:OO,t.label=2;case 2:return[2,ZO(this.firebaseDependencies,self.registration,this.vapidKey)]}})})},sD.prototype.deleteToken=function(){return tD(this.firebaseDependencies,self.registration)},sD.prototype.requestPermission=function(){throw PO.create("only-available-in-window")},sD.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw PO.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw PO.create("invalid-vapid-key");this.vapidKey=t},sD.prototype.useServiceWorker=function(){throw PO.create("only-available-in-window")},sD.prototype.onMessage=function(){throw PO.create("only-available-in-window")},sD.prototype.onTokenRefresh=function(){throw PO.create("only-available-in-window")},sD.prototype.onPush=function(a){return $i(this,void 0,void 0,function(){var i,o,s;return Zi(this,function(t){switch(t.label){case 0:return(s=function(t){var e=t.data;if(!e)return null;try{return e.json()}catch(t){return null}}(a))?[4,aD()]:(console.debug("FirebaseMessaging: failed to get parsed MessagePayload from the PushEvent. Skip handling the push."),[2]);case 1:return(i=t.sent(),i.some(function(t){return"visible"===t.visibilityState&&!t.url.startsWith("chrome-extension://")}))?[2,function(t,e){var n,r;e.isFirebaseMessaging=!0,e.messageType=RO.PUSH_RECEIVED;try{for(var i=to(t),o=i.next();!o.done;o=i.next())o.value.postMessage(e)}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}(i,s)]:(o=!1,s.notification?[4,function(t){var e=t.actions,n=Notification.maxActions;e&&n&&e.length>n&&console.warn("This browser only supports "+n+" actions. The remaining actions will not be displayed.");return self.registration.showNotification(null!==(n=t.title)&&void 0!==n?n:"",t)}(((r=Ji({},(e=s).notification)).data=((n={})[xO]=e,n),r))]:[3,3]);case 2:t.sent(),o=!0,t.label=3;case 3:return!0===o&&!1===this.isOnBackgroundMessageUsed?[2]:(this.bgMessageHandler&&(s=nD(s),"function"==typeof this.bgMessageHandler?this.bgMessageHandler(s):this.bgMessageHandler.next(s)),[4,iD(1e3)]);case 4:return t.sent(),[2]}var e,n,r})})},sD.prototype.onSubChange=function(n){var r;return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return n.newSubscription?[3,2]:[4,tD(this.firebaseDependencies,self.registration)];case 1:return t.sent(),[2];case 2:return[4,GO(this.firebaseDependencies)];case 3:return e=t.sent(),[4,tD(this.firebaseDependencies,self.registration)];case 4:return t.sent(),[4,ZO(this.firebaseDependencies,self.registration,null!==(r=null===(r=null==e?void 0:e.subscriptionOptions)||void 0===r?void 0:r.vapidKey)&&void 0!==r?r:OO)];case 5:return t.sent(),[2]}})})},sD.prototype.onNotificationClick=function(s){var a;return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return(e=null===(a=null===(a=s.notification)||void 0===a?void 0:a.data)||void 0===a?void 0:a[xO])?s.action?[2]:(s.stopImmediatePropagation(),s.notification.close(),(n=function(t){var e,n=null!==(e=null===(e=t.fcmOptions)||void 0===e?void 0:e.link)&&void 0!==e?e:null===(n=t.notification)||void 0===n?void 0:n.click_action;if(n)return n;return rD(t.data)?self.location.origin:null}(e))?(r=new URL(n,self.location.href),i=new URL(self.location.origin),r.host!==i.host?[2]:[4,function(u){return $i(this,void 0,void 0,function(){var e,n,r,i,o,s,a;return Zi(this,function(t){switch(t.label){case 0:return[4,aD()];case 1:e=t.sent();try{for(n=to(e),r=n.next();!r.done;r=n.next())if(i=r.value,o=new URL(i.url,self.location.href),u.host===o.host)return[2,i]}catch(t){s={error:t}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}}return[2,null]}})})}(r)]):[2]):[2];case 1:return(o=t.sent())?[3,4]:[4,self.clients.openWindow(n)];case 2:return o=t.sent(),[4,iD(3e3)];case 3:return t.sent(),[3,6];case 4:return[4,o.focus()];case 5:o=t.sent(),t.label=6;case 6:return o?(e.messageType=RO.NOTIFICATION_CLICKED,e.isFirebaseMessaging=!0,[2,o.postMessage(e)]):[2]}})})},sD);function sD(t){var e=this;this.firebaseDependencies=t,this.isOnBackgroundMessageUsed=null,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 aD(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}var uD=(Object.defineProperty(cD.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),cD.prototype.messageEventListener=function(i){return $i(this,void 0,void 0,function(){var n,r;return Zi(this,function(t){switch(t.label){case 0:return(n=i.data).isFirebaseMessaging?(this.onMessageCallback&&n.messageType===RO.PUSH_RECEIVED&&("function"==typeof this.onMessageCallback?this.onMessageCallback((delete(e=Object.assign({},n)).messageType,delete e.isFirebaseMessaging,e)):this.onMessageCallback.next(Object.assign({},n))),rD(r=n.data)&&"1"===r["google.c.a.e"]?[4,this.logEvent(n.messageType,r)]:[3,2]):[2];case 1:t.sent(),t.label=2;case 2:return[2]}var e})})},cD.prototype.getVapidKey=function(){return this.vapidKey},cD.prototype.getSwReg=function(){return this.swRegistration},cD.prototype.getToken=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return"default"!==Notification.permission?[3,2]:[4,Notification.requestPermission()];case 1:t.sent(),t.label=2;case 2:if("granted"!==Notification.permission)throw PO.create("permission-blocked");return[4,this.updateVapidKey(null==e?void 0:e.vapidKey)];case 3:return t.sent(),[4,this.updateSwReg(null==e?void 0:e.serviceWorkerRegistration)];case 4:return t.sent(),[2,ZO(this.firebaseDependencies,this.swRegistration,this.vapidKey)]}})})},cD.prototype.updateVapidKey=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return e?this.vapidKey=e:this.vapidKey||(this.vapidKey=OO),[2]})})},cD.prototype.updateSwReg=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return e||this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:t.sent(),t.label=2;case 2:if(!e&&this.swRegistration)return[2];if(!(e instanceof ServiceWorkerRegistration))throw PO.create("invalid-sw-registration");return this.swRegistration=e,[2]}})})},cD.prototype.registerDefaultSw=function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=this,[4,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"})];case 1:return e.swRegistration=t.sent(),this.swRegistration.update().catch(function(){}),[3,3];case 2:throw e=t.sent(),PO.create("failed-service-worker-registration",{browserErrorMessage:e.message});case 3:return[2]}})})},cD.prototype.deleteToken=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:t.sent(),t.label=2;case 2:return[2,tD(this.firebaseDependencies,this.swRegistration)]}})})},cD.prototype.requestPermission=function(){return $i(this,void 0,void 0,function(){var e;return Zi(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?PO.create("permission-blocked"):PO.create("permission-default")}})})},cD.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw PO.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw PO.create("invalid-vapid-key");this.vapidKey=t},cD.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw PO.create("invalid-sw-registration");if(this.swRegistration)throw PO.create("use-sw-after-get-token");this.swRegistration=t},cD.prototype.onMessage=function(t){var e=this;return this.onMessageCallback=t,function(){e.onMessageCallback=null}},cD.prototype.setBackgroundMessageHandler=function(){throw PO.create("only-available-in-sw")},cD.prototype.onBackgroundMessage=function(){throw PO.create("only-available-in-sw")},cD.prototype.onTokenRefresh=function(){return function(){}},cD.prototype.logEvent=function(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(t){switch(t){case RO.NOTIFICATION_CLICKED:return"notification_open";case RO.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[LO],message_name:r["google.c.a.c_l"],message_time:r["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}})})},cD);function cD(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",function(t){return e.messageEventListener(t)})}function hD(t){return PO.create("missing-app-config-values",{valueName:t})}Sn={isSupported:lD};function lD(){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")}Xl.INTERNAL.registerComponent(new ts("messaging",function(t){var e=t.getProvider("app").getImmediate(),t={app:e,appConfig:function(t){var e,n;if(!t||!t.options)throw hD("App Configuration Object");if(!t.name)throw hD("App Name");var r=t.options;try{for(var i=to(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var s=o.value;if(!r[s])throw hD(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(!lD())throw PO.create("unsupported-browser");return new(self&&"ServiceWorkerGlobalScope"in self?oD:uD)(t)},"PUBLIC").setServiceProps(Sn));var fD,pD="firebasestorage.googleapis.com",dD="storageBucket",vD=(Xi(gD,fD=Eo),gD.prototype._codeEquals=function(t){return yD(t)===this.code},Object.defineProperty(gD.prototype,"message",{get:function(){return this.customData.serverResponse?this.message+"\n"+this.customData.serverResponse:this.message},enumerable:!1,configurable:!0}),Object.defineProperty(gD.prototype,"serverResponse",{get:function(){return this.customData.serverResponse},set:function(t){this.customData.serverResponse=t},enumerable:!1,configurable:!0}),gD);function gD(t,e){t=fD.call(this,yD(t),"Firebase Storage: "+e+" ("+yD(t)+")")||this;return t.customData={serverResponse:null},Object.setPrototypeOf(t,gD.prototype),t}function yD(t){return"storage/"+t}function mD(){return new vD("unknown","An unknown error occurred, please check the error payload for server response.")}function bD(){return new vD("canceled","User canceled the upload/download.")}function wD(){return new vD("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.")}function _D(t){return new vD("invalid-argument",t)}function ID(){return new vD("app-deleted","The Firebase app was deleted.")}function TD(t){return new vD("invalid-root-operation","The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function ED(t,e){return new vD("invalid-format","String does not match format '"+t+"': "+e)}function SD(t){throw new vD("internal-error","Internal error: "+t)}var CD={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},ND=function(t,e){this.data=t,this.contentType=e||null};function AD(t,e){switch(t){case CD.RAW:return new ND(kD(e));case CD.BASE64:case CD.BASE64URL:return new ND(RD(t,e));case CD.DATA_URL:return new ND(function(t){t=new PD(t);return t.base64?RD(CD.BASE64,t.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw ED(CD.DATA_URL,"Malformed data URL.")}return kD(e)}(t.rest)}(e),new PD(e).contentType)}throw mD()}function kD(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);r<=127?e.push(r):r<=2047?e.push(192|r>>6,128|63&r):55296==(64512&r)?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)):e.push(239,191,189):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 RD(e,t){switch(e){case CD.BASE64:var n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r)throw ED(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case CD.BASE64URL:r=-1!==t.indexOf("+"),n=-1!==t.indexOf("/");if(r||n)throw ED(e,"Invalid character '"+(r?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}var i;try{i=atob(t)}catch(t){throw ED(e,"Invalid character found")}for(var o=new Uint8Array(i.length),s=0;s<i.length;s++)o[s]=i.charCodeAt(s);return o}var PD=function(t){var e;if(this.base64=!1,(this.contentType=null)===(e=t.match(/^data:([^,]+)?,/)))throw ED(CD.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");var n,r=e[1]||null;null!=r&&(this.base64=(n=";base64",(e=r).length>=n.length&&e.substring(e.length-n.length)===n),this.contentType=this.base64?r.substring(0,r.length-";base64".length):r),this.rest=t.substring(t.indexOf(",")+1)};var OD,DD={STATE_CHANGED:"state_changed"},xD={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function LD(t){switch(t){case"running":case"pausing":case"canceling":return xD.RUNNING;case"paused":return xD.PAUSED;case"success":return xD.SUCCESS;case"canceled":return xD.CANCELED;case"error":default:return xD.ERROR}}(Ga=OD=OD||{})[Ga.NO_ERROR=0]="NO_ERROR",Ga[Ga.NETWORK_ERROR=1]="NETWORK_ERROR",Ga[Ga.ABORT=2]="ABORT";var MD=(FD.prototype.send=function(t,e,n,r){if(this.sent_)throw SD("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),void 0!==r)for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return void 0!==n?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},FD.prototype.getErrorCode=function(){if(!this.sent_)throw SD("cannot .getErrorCode() before sending");return this.errorCode_},FD.prototype.getStatus=function(){if(!this.sent_)throw SD("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},FD.prototype.getResponseText=function(){if(!this.sent_)throw SD("cannot .getResponseText() before sending");return this.xhr_.responseText},FD.prototype.abort=function(){this.xhr_.abort()},FD.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},FD.prototype.addUploadProgressListener=function(t){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",t)},FD.prototype.removeUploadProgressListener=function(t){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",t)},FD);function FD(){var e=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=OD.NO_ERROR,this.sendPromise_=new Promise(function(t){e.xhr_.addEventListener("abort",function(){e.errorCode_=OD.ABORT,t(e)}),e.xhr_.addEventListener("error",function(){e.errorCode_=OD.NETWORK_ERROR,t(e)}),e.xhr_.addEventListener("load",function(){t(e)})})}var UD=(jD.prototype.createXhrIo=function(){return new MD},jD);function jD(){}var qD=(Object.defineProperty(VD.prototype,"path",{get:function(){return this.path_},enumerable:!1,configurable:!0}),Object.defineProperty(VD.prototype,"isRoot",{get:function(){return 0===this.path.length},enumerable:!1,configurable:!0}),VD.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},VD.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},VD.makeFromBucketSpec=function(e){var t;try{t=VD.makeFromUrl(e)}catch(t){return new VD(e,"")}if(""===t.path)return t;throw new vD("invalid-default-bucket","Invalid default bucket '"+e+"'.")},VD.makeFromUrl=function(t){var e=null,n="([A-Za-z0-9.\\-_]+)";var r=new RegExp("^gs://"+n+"(/(.*))?$","i");function i(t){t.path_=decodeURIComponent(t.path)}for(var o=pD.replace(/[.]/g,"\\."),s=[{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?://"+o+"/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}],a=0;a<s.length;a++){var u=s[a],c=u.regex.exec(t);if(c){e=new VD(c[u.indices.bucket],c[u.indices.path]||"");u.postModify(e);break}}if(null==e)throw new vD("invalid-url","Invalid URL '"+t+"'.");return e},VD);function VD(t,e){this.bucket=t,this.path_=e}var BD=(KD.prototype.getPromise=function(){return this.promise_},KD.prototype.cancel=function(t){},KD);function KD(t){this.promise_=Promise.reject(t)}function WD(t){return"string"==typeof t||t instanceof String}function HD(t){return GD()&&t instanceof Blob}function GD(){return"undefined"!=typeof Blob}function zD(t,e,n,r){if(r<e)throw _D("Invalid value for '"+t+"'. Expected "+e+" or greater.");if(n<r)throw _D("Invalid value for '"+t+"'. Expected "+n+" or less.")}function QD(t){return"https://"+pD+"/v0"+t}function YD(t){var e,n=encodeURIComponent,r="?";for(e in t)t.hasOwnProperty(e)&&(r=r+(n(e)+"="+n(t[e]))+"&");return r=r.slice(0,-1)}var XD=(JD.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());void 0!==s?r(s):r()}catch(t){i(t)}else null!==o?((n=mD()).serverResponse=o.getResponseText(),c.errorCallback_?i(c.errorCallback_(o,n)):i(n)):e.canceled?i(n=(c.appDelete_?ID:bD)()):i(n=new vD("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,no([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 $D(!1,null,!0)):this.backoffId_=(e=function(r,t){function i(t){var e=t.loaded,t=t.lengthComputable?t.total:-1;null!==c.progressCallback_&&c.progressCallback_(e,t)}t?r(!1,new $D(!1,null,!0)):(t=c.pool_.createXhrIo(),c.pendingXhr_=t,null!==c.progressCallback_&&t.addUploadProgressListener(i),t.send(c.url_,c.method_,c.body_,c.headers_).then(function(t){null!==c.progressCallback_&&t.removeUploadProgressListener(i),c.pendingXhr_=null;var e=t.getErrorCode()===OD.NO_ERROR,n=t.getStatus();e&&!c.isRetryStatusCode_(n)?(n=-1!==c.successCodes_.indexOf(n),r(!0,new $D(n,t))):(t=t.getErrorCode()===OD.ABORT,r(!1,new $D(!1,null,t)))}))},n=h,t=this.timeout_,i=null,u=a=o=!(r=1),p(s=0),setTimeout(function(){o=!0,v(!0)},t),v)},JD.prototype.getPromise=function(){return this.promise_},JD.prototype.cancel=function(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingXhr_&&this.pendingXhr_.abort()},JD.prototype.isRetryStatusCode_=function(t){var e=500<=t&&t<600,n=-1!==[408,429].indexOf(t),t=-1!==this.additionalRetryCodes_.indexOf(t);return e||n||t},JD);function JD(t,e,n,r,i,o,s,a,u,c,h){var l=this;this.pendingXhr_=null,this.backoffId_=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 $D=function(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n};function ZD(){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(GD())return new Blob(t);throw new vD("unsupported-environment","This browser doesn't seem to support creating Blobs")}var tx=(ex.prototype.size=function(){return this.size_},ex.prototype.type=function(){return this.type_},ex.prototype.slice=function(t,e){if(HD(this.data_)){var n=this.data_,r=(i=t,r=e,(n=n).webkitSlice?n.webkitSlice(i,r):n.mozSlice?n.mozSlice(i,r):n.slice?n.slice(i,r):null);return null===r?null:new ex(r)}var i,r;return new ex(new Uint8Array(this.data_.buffer,t,e-t),!0)},ex.getBlob=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(GD()){var n=t.map(function(t){return t instanceof ex?t.data_:t});return new ex(ZD.apply(null,n))}var n=t.map(function(t){return WD(t)?AD(CD.RAW,t).data:t.data_}),r=0;n.forEach(function(t){r+=t.byteLength});var i=new Uint8Array(r),o=0;return n.forEach(function(t){for(var e=0;e<t.length;e++)i[o++]=t[e]}),new ex(i,!0)},ex.prototype.uploadData=function(){return this.data_},ex);function ex(t,e){var n=0,r="";HD(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}function nx(t){var e,n;try{e=JSON.parse(t)}catch(t){return null}return"object"!=typeof(n=e)||Array.isArray(n)?null:e}function rx(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function ix(t,e){return e}var ox=function(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||ix},sx=null;function ax(){if(sx)return sx;var t=[];t.push(new ox("bucket")),t.push(new ox("generation")),t.push(new ox("metageneration")),t.push(new ox("name","fullPath",!0));var e=new ox("name");e.xform=function(t,e){return!WD(e=e)||e.length<2?e:rx(e)},t.push(e);e=new ox("size");return e.xform=function(t,e){return void 0!==e?Number(e):e},t.push(e),t.push(new ox("timeCreated")),t.push(new ox("updated")),t.push(new ox("md5Hash",null,!0)),t.push(new ox("cacheControl",null,!0)),t.push(new ox("contentDisposition",null,!0)),t.push(new ox("contentEncoding",null,!0)),t.push(new ox("contentLanguage",null,!0)),t.push(new ox("contentType",null,!0)),t.push(new ox("metadata","customMetadata",!0)),sx=t}function ux(n,r){Object.defineProperty(n,"ref",{get:function(){var t=n.bucket,e=n.fullPath,e=new qD(t,e);return r._makeStorageReference(e)}})}function cx(t,e,n){e=nx(e);if(null===e)return null;return 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 ux(r,t),r}(t,e,n)}function hx(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)}var lx="prefixes",fx="items";function px(t,e,n){n=nx(n);if(null===n)return null;return function(t,e,n){var r={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n[lx])for(var i=0,o=n[lx];i<o.length;i++){var s=o[i].replace(/\/$/,""),a=t._makeStorageReference(new qD(e,s));r.prefixes.push(a)}if(n[fx])for(var u=0,c=n[fx];u<c.length;u++){var h=c[u],a=t._makeStorageReference(new qD(e,h.name));r.items.push(a)}return r}(t,e,n)}var dx=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 vx(t){if(!t)throw mD()}function gx(n,r){return function(t,e){return vx(null!==(e=cx(n,e,r))),e}}function yx(n,r){return function(t,e){return vx(null!==(e=px(n,r,e))),e}}function mx(r,i){return function(t,e){var n=cx(r,e,i);return vx(null!==n),function(r,t){if(null===(t=nx(t)))return null;if(!WD(t.downloadTokens))return null;if(0===(t=t.downloadTokens).length)return null;var i=encodeURIComponent;return t.split(",").map(function(t){var e=r.bucket,n=r.fullPath;return QD("/b/"+i(e)+"/o/"+i(n))+YD({alt:"media",token:t})})[0]}(n,e)}}function bx(i){return function(t,e){var n,r=401===t.getStatus()?new vD("unauthenticated","User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(n=i.bucket,new vD("quota-exceeded","Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=i.path,new vD("unauthorized","User does not have permission to access '"+r+"'.")):e;return r.serverResponse=e.serverResponse,r}}function wx(r){var i=bx(r);return function(t,e){var n=i(t,e);return 404===t.getStatus()&&(t=r.path,n=new vD("object-not-found","Object '"+t+"' does not exist.")),n.serverResponse=e.serverResponse,n}}function _x(t,e,n){var r=QD(e.fullServerUrl()),i=t.maxOperationRetryTime,i=new dx(r,"GET",gx(t,n),i);return i.errorHandler=wx(e),i}function Ix(t,e,n){n=Object.assign({},n);return n.fullPath=t.path,n.size=e.size(),n.contentType||(n.contentType=(t=e,(e=null)&&e.contentType||t&&t.type()||"application/octet-stream")),n}function Tx(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=Ix(e,r,i),i="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+hx(u,n)+"\r\n--"+a+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",a="\r\n--"+a+"--",r=tx.getBlob(i,r,a);if(null===r)throw wD();a={name:u.fullPath},u=QD(o),o=t.maxUploadRetryTime,o=new dx(u,"POST",gx(t,n),o);return o.urlParams=a,o.headers=s,o.body=r.uploadData(),o.errorHandler=bx(e),o}var Ex=function(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null};function Sx(t,e){var n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){vx(!1)}return vx(!!n&&-1!==(e||["active"]).indexOf(n)),n}function Cx(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),s=Ix(e,r,i),i={name:s.fullPath},o=QD(o),r={"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"},n=hx(s,n),t=t.maxUploadRetryTime;t=new dx(o,"POST",function(t){var e;Sx(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){vx(!1)}return vx(WD(e)),e},t);return t.urlParams=i,t.headers=r,t.body=n,t.errorHandler=bx(e),t}function Nx(t,e,n,i){t=t.maxUploadRetryTime,t=new dx(n,"POST",function(t){var e=Sx(t,["active","final"]),n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){vx(!1)}n||vx(!1);var r=Number(n);return vx(!isNaN(r)),new Ex(r,i.size(),"final"===e)},t);return t.headers={"X-Goog-Upload-Command":"query"},t.errorHandler=bx(e),t}function Ax(t,o,e,s,n,a,r,i){var u=new Ex(0,0);if(r?(u.current=r.current,u.total=r.total):(u.current=0,u.total=s.size()),s.size()!==u.total)throw new vD("server-file-wrong-size","Server recorded incorrect upload file size, please retry the upload.");var c=u.total-u.current,h=c;0<n&&(h=Math.min(h,n));r=u.current,n=r+h,c={"X-Goog-Upload-Command":h===c?"upload, finalize":"upload","X-Goog-Upload-Offset":u.current},r=s.slice(r,n);if(null===r)throw wD();n=o.maxUploadRetryTime,n=new dx(e,"POST",function(t,e){var n=Sx(t,["active","final"]),r=u.current+h,i=s.size(),e="final"===n?gx(o,a)(t,e):null;return new Ex(r,i,"final"===n,e)},n);return n.headers=c,n.body=r.uploadData(),n.progressCallback=i||null,n.errorHandler=bx(t),n}var kx=function(t,e,n){"function"==typeof t||null!=e||null!=n?(this.next=t,this.error=e,this.complete=n):(t=t,this.next=t.next,this.error=t.error,this.complete=t.complete)};function Rx(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 Px=(Ox.prototype._makeProgressCallback=function(){var e=this,n=this._transferred;return function(t){return e._updateProgress(n+t)}},Ox.prototype._shouldDoResumable=function(t){return 262144<t.size()},Ox.prototype._start=function(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this._continueUpload():this._oneShotUpload())},Ox.prototype._resolveToken=function(e){var n=this;this._ref.storage._getAuthToken().then(function(t){switch(n._state){case"running":e(t);break;case"canceling":n._transition("canceled");break;case"pausing":n._transition("paused")}})},Ox.prototype._createResumable=function(){var n=this;this._resolveToken(function(t){var e=Cx(n._ref.storage,n._ref._location,n._mappings,n._blob,n._metadata),t=n._ref.storage._makeRequest(e,t);(n._request=t).getPromise().then(function(t){n._request=void 0,n._uploadUrl=t,n._needToFetchStatus=!1,n.completeTransitions_()},n._errorHandler)})},Ox.prototype._fetchStatus=function(){var n=this,r=this._uploadUrl;this._resolveToken(function(t){var e=Nx(n._ref.storage,n._ref._location,r,n._blob),t=n._ref.storage._makeRequest(e,t);(n._request=t).getPromise().then(function(t){n._request=void 0,n._updateProgress(t.current),n._needToFetchStatus=!1,t.finalized&&(n._needToFetchMetadata=!0),n.completeTransitions_()},n._errorHandler)})},Ox.prototype._continueUpload=function(){var n=this,r=262144*this._chunkMultiplier,i=new Ex(this._transferred,this._blob.size()),o=this._uploadUrl;this._resolveToken(function(t){var e;try{e=Ax(n._ref._location,n._ref.storage,o,n._blob,r,n._mappings,i,n._makeProgressCallback())}catch(t){return n._error=t,void n._transition("error")}t=n._ref.storage._makeRequest(e,t);(n._request=t).getPromise().then(function(t){n._increaseMultiplier(),n._request=void 0,n._updateProgress(t.current),t.finalized?(n._metadata=t.metadata,n._transition("success")):n.completeTransitions_()},n._errorHandler)})},Ox.prototype._increaseMultiplier=function(){262144*this._chunkMultiplier<33554432&&(this._chunkMultiplier*=2)},Ox.prototype._fetchMetadata=function(){var n=this;this._resolveToken(function(t){var e=_x(n._ref.storage,n._ref._location,n._mappings),t=n._ref.storage._makeRequest(e,t);(n._request=t).getPromise().then(function(t){n._request=void 0,n._metadata=t,n._transition("success")},n._metadataErrorHandler)})},Ox.prototype._oneShotUpload=function(){var n=this;this._resolveToken(function(t){var e=Tx(n._ref.storage,n._ref._location,n._mappings,n._blob,n._metadata),t=n._ref.storage._makeRequest(e,t);(n._request=t).getPromise().then(function(t){n._request=void 0,n._metadata=t,n._updateProgress(n._blob.size()),n._transition("success")},n._errorHandler)})},Ox.prototype._updateProgress=function(t){var e=this._transferred;this._transferred=t,this._transferred!==e&&this._notifyObservers()},Ox.prototype._transition=function(t){if(this._state!==t)switch(t){case"canceling":case"pausing":this._state=t,void 0!==this._request&&this._request.cancel();break;case"running":var e="paused"===this._state;this._state=t,e&&(this._notifyObservers(),this._start());break;case"paused":this._state=t,this._notifyObservers();break;case"canceled":this._error=bD(),this._state=t,this._notifyObservers();break;case"error":case"success":this._state=t,this._notifyObservers()}},Ox.prototype.completeTransitions_=function(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}},Object.defineProperty(Ox.prototype,"snapshot",{get:function(){var t=LD(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:t,metadata:this._metadata,task:this,ref:this._ref}},enumerable:!1,configurable:!0}),Ox.prototype.on=function(t,e,n,r){var i=this,o=new kx(e,n,r);return this._addObserver(o),function(){i._removeObserver(o)}},Ox.prototype.then=function(t,e){return this._promise.then(t,e)},Ox.prototype.catch=function(t){return this.then(null,t)},Ox.prototype._addObserver=function(t){this._observers.push(t),this._notifyObserver(t)},Ox.prototype._removeObserver=function(t){t=this._observers.indexOf(t);-1!==t&&this._observers.splice(t,1)},Ox.prototype._notifyObservers=function(){var e=this;this._finishPromise(),this._observers.slice().forEach(function(t){e._notifyObserver(t)})},Ox.prototype._finishPromise=function(){if(void 0!==this._resolve){var t=!0;switch(LD(this._state)){case xD.SUCCESS:Rx(this._resolve.bind(null,this.snapshot))();break;case xD.CANCELED:case xD.ERROR:Rx(this._reject.bind(null,this._error))();break;default:t=!1}t&&(this._resolve=void 0,this._reject=void 0)}},Ox.prototype._notifyObserver=function(t){switch(LD(this._state)){case xD.RUNNING:case xD.PAUSED:t.next&&Rx(t.next.bind(t,this.snapshot))();break;case xD.SUCCESS:t.complete&&Rx(t.complete.bind(t))();break;case xD.CANCELED:case xD.ERROR:t.error&&Rx(t.error.bind(t,this._error))();break;default:t.error&&Rx(t.error.bind(t,this._error))()}},Ox.prototype.resume=function(){var t="paused"===this._state||"pausing"===this._state;return t&&this._transition("running"),t},Ox.prototype.pause=function(){var t="running"===this._state;return t&&this._transition("pausing"),t},Ox.prototype.cancel=function(){var t="running"===this._state||"pausing"===this._state;return t&&this._transition("canceling"),t},Ox);function Ox(t,e,n){var r=this;void 0===n&&(n=null),this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=t,this._blob=e,this._metadata=n,this._mappings=ax(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=function(t){r._request=void 0,r._chunkMultiplier=1,t._codeEquals("canceled")?(r._needToFetchStatus=!0,r.completeTransitions_()):(r._error=t,r._transition("error"))},this._metadataErrorHandler=function(t){r._request=void 0,t._codeEquals("canceled")?r.completeTransitions_():(r._error=t,r._transition("error"))},this._promise=new Promise(function(t,e){r._resolve=t,r._reject=e,r._start()}),this._promise.then(null,function(){})}var Dx=(xx.prototype.toString=function(){return"gs://"+this._location.bucket+"/"+this._location.path},xx.prototype._newRef=function(t,e){return new xx(t,e)},Object.defineProperty(xx.prototype,"root",{get:function(){var t=new qD(this._location.bucket,"");return this._newRef(this._service,t)},enumerable:!1,configurable:!0}),Object.defineProperty(xx.prototype,"bucket",{get:function(){return this._location.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(xx.prototype,"fullPath",{get:function(){return this._location.path},enumerable:!1,configurable:!0}),Object.defineProperty(xx.prototype,"name",{get:function(){return rx(this._location.path)},enumerable:!1,configurable:!0}),Object.defineProperty(xx.prototype,"storage",{get:function(){return this._service},enumerable:!1,configurable:!0}),Object.defineProperty(xx.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;t=new qD(this._location.bucket,t);return new xx(this._service,t)},enumerable:!1,configurable:!0}),xx.prototype._throwIfRoot=function(t){if(""===this._location.path)throw TD(t)},xx);function xx(t,e){this._service=t,this._location=e instanceof qD?e:qD.makeFromUrl(e)}function Lx(t){var e={prefixes:[],items:[]};return function r(i,o,s){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,Mx(i,{pageToken:s})];case 1:return e=t.sent(),(n=o.prefixes).push.apply(n,e.prefixes),(n=o.items).push.apply(n,e.items),null==e.nextPageToken?[3,3]:[4,r(i,o,e.nextPageToken)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}(t,e).then(function(){return e})}function Mx(c,h){return $i(this,void 0,void 0,function(){var a,u;return Zi(this,function(t){switch(t.label){case 0:return null!=h&&"number"==typeof h.maxResults&&zD("options.maxResults",1,1e3,h.maxResults),[4,c.storage._getAuthToken()];case 1:return a=t.sent(),u=h||{},e=c.storage,n=c._location,r="/",i=u.pageToken,o=u.maxResults,s={},n.isRoot?s.prefix="":s.prefix=n.path+"/",r&&0<r.length&&(s.delimiter=r),i&&(s.pageToken=i),o&&(s.maxResults=o),i=QD(n.bucketOnlyServerUrl()),o=e.maxOperationRetryTime,(o=new dx(i,"GET",yx(e,n.bucket),o)).urlParams=s,o.errorHandler=bx(n),[2,c.storage._makeRequest(o,a).getPromise()]}var e,n,r,i,o,s})})}function Fx(u,c){return $i(this,void 0,void 0,function(){var a;return Zi(this,function(t){switch(t.label){case 0:return u._throwIfRoot("updateMetadata"),[4,u.storage._getAuthToken()];case 1:return a=t.sent(),e=u.storage,n=u._location,r=c,i=ax(),o=QD(n.fullServerUrl()),s=hx(r,i),r=e.maxOperationRetryTime,(r=new dx(o,"PATCH",gx(e,i),r)).headers={"Content-Type":"application/json; charset=utf-8"},r.body=s,r.errorHandler=wx(n),[2,u.storage._makeRequest(r,a).getPromise()]}var e,n,r,i,o,s})})}function Ux(a){return $i(this,void 0,void 0,function(){var s;return Zi(this,function(t){switch(t.label){case 0:return a._throwIfRoot("getDownloadURL"),[4,a.storage._getAuthToken()];case 1:return s=t.sent(),e=a.storage,n=a._location,r=ax(),i=QD(n.fullServerUrl()),o=e.maxOperationRetryTime,(o=new dx(i,"GET",mx(e,r),o)).errorHandler=wx(n),[2,a.storage._makeRequest(o,s).getPromise().then(function(t){if(null===t)throw new vD("no-download-url","The given file does not have any download URLs.");return t})]}var e,n,r,i,o})})}function jx(o){return $i(this,void 0,void 0,function(){var i;return Zi(this,function(t){switch(t.label){case 0:return o._throwIfRoot("deleteObject"),[4,o.storage._getAuthToken()];case 1:return i=t.sent(),e=o.storage,n=o._location,r=QD(n.fullServerUrl()),e=e.maxOperationRetryTime,(e=new dx(r,"DELETE",function(t,e){},e)).successCodes=[200,204],e.errorHandler=wx(n),[2,o.storage._makeRequest(e,i).getPromise()]}var e,n,r})})}function qx(t,e){var n,e=(n=t._location.path,e=(e=e).split("/").filter(function(t){return 0<t.length}).join("/"),0===n.length?e:n+"/"+e),e=new qD(t._location.bucket,e);return new Dx(t.storage,e)}function Vx(t){return/^[A-Za-z]+:\/\//.test(t)}function Bx(t,e){if(t instanceof Wx){var n=t;if(null==n._bucket)throw new vD("no-default-bucket","No default bucket found. Did you set the '"+dD+"' property when initializing the app?");n=new Dx(n,n._bucket);return null!=e?Bx(n,e):n}if(void 0===e)return t;if(e.includes(".."))throw _D('`path` param cannot contain ".."');return qx(t,e)}function Kx(t,e){if(e&&Vx(e)){if(t instanceof Wx)return new Dx(t,e);throw _D("To use ref(service, url), the first argument must be a Storage instance.")}return Bx(t,e)}var Wx=(Object.defineProperty(Hx.prototype,"maxUploadRetryTime",{get:function(){return this._maxUploadRetryTime},set:function(t){zD("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t},enumerable:!1,configurable:!0}),Object.defineProperty(Hx.prototype,"maxOperationRetryTime",{get:function(){return this._maxOperationRetryTime},set:function(t){zD("time",0,Number.POSITIVE_INFINITY,t),this._maxOperationRetryTime=t},enumerable:!1,configurable:!0}),Hx.prototype._getAuthToken=function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return(e=this._authProvider.getImmediate({optional:!0}))?[4,e.getToken()]:[3,2];case 1:if(null!==(e=t.sent()))return[2,e.accessToken];t.label=2;case 2:return[2,null]}})})},Hx.prototype._delete=function(){return this._deleted=!0,this._requests.forEach(function(t){return t.cancel()}),this._requests.clear(),Promise.resolve()},Hx.prototype._makeStorageReference=function(t){return new Dx(this,t)},Hx.prototype._makeRequest=function(t,e){var n=this;if(this._deleted)return new BD(ID());var r,i,o,s,a,u,c=(r=t,i=this._appId,o=e,s=this._pool,a=this._firebaseVersion,u=YD(r.urlParams),t=r.url+u,e=Object.assign({},r.headers),u=e,(i=i)&&(u["X-Firebase-GMPID"]=i),i=e,null!==(o=o)&&0<o.length&&(i.Authorization="Firebase "+o),a=a,e["X-Firebase-Storage-Version"]="webjs/"+(null!=a?a:"AppManager"),new XD(t,r.method,e,r.body,r.successCodes,r.additionalRetryCodes,r.handler,r.errorHandler,r.timeout,r.progressCallback,s));return this._requests.add(c),c.getPromise().then(function(){return n._requests.delete(c)},function(){return n._requests.delete(c)}),c},Hx);function Hx(t,e,n,r,i){this.app=t,this._authProvider=e,this._pool=n,this._url=r,this._firebaseVersion=i,this._bucket=null,this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=r?qD.makeFromBucketSpec(r):null==(r=null==(r=this.app.options)?void 0:r[dD])?null:qD.makeFromBucketSpec(r)}function Gx(t,e,n){return e=e,n=n,(t=t)._throwIfRoot("uploadBytesResumable"),new Px(t,new tx(e),n)}function zx(t){return function(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return r._throwIfRoot("getMetadata"),[4,r.storage._getAuthToken()];case 1:return e=t.sent(),n=_x(r.storage,r._location,ax()),[2,r.storage._makeRequest(n,e).getPromise()]}})})}(t)}function Qx(t,e){return Kx(t,e)}var Yx=(Object.defineProperty(Xx.prototype,"bytesTransferred",{get:function(){return this._delegate.bytesTransferred},enumerable:!1,configurable:!0}),Object.defineProperty(Xx.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(Xx.prototype,"state",{get:function(){return this._delegate.state},enumerable:!1,configurable:!0}),Object.defineProperty(Xx.prototype,"totalBytes",{get:function(){return this._delegate.totalBytes},enumerable:!1,configurable:!0}),Xx);function Xx(t,e,n){this._delegate=t,this.task=e,this.ref=n}var Jx=(Object.defineProperty($x.prototype,"snapshot",{get:function(){return new Yx(this._delegate.snapshot,this,this._ref)},enumerable:!1,configurable:!0}),$x.prototype.then=function(e,t){var n=this;return this._delegate.then(function(t){if(e)return e(new Yx(t,n,n._ref))},t)},$x.prototype.on=function(t,e,n,r){var i=this,o=void 0;return e&&(o="function"==typeof e?function(t){return e(new Yx(t,i,i._ref))}:{next:e.next?function(t){return e.next(new Yx(t,i,i._ref))}:void 0,complete:e.complete||void 0,error:e.error||void 0}),this._delegate.on(t,o,n||void 0,r||void 0)},$x);function $x(t,e){this._delegate=t,this._ref=e,this.cancel=this._delegate.cancel.bind(this._delegate),this.catch=this._delegate.catch.bind(this._delegate),this.pause=this._delegate.pause.bind(this._delegate),this.resume=this._delegate.resume.bind(this._delegate)}var Zx=(Object.defineProperty(tL.prototype,"prefixes",{get:function(){var e=this;return this._delegate.prefixes.map(function(t){return new eL(t,e._service)})},enumerable:!1,configurable:!0}),Object.defineProperty(tL.prototype,"items",{get:function(){var e=this;return this._delegate.items.map(function(t){return new eL(t,e._service)})},enumerable:!1,configurable:!0}),Object.defineProperty(tL.prototype,"nextPageToken",{get:function(){return this._delegate.nextPageToken||null},enumerable:!1,configurable:!0}),tL);function tL(t,e){this._delegate=t,this._service=e}var eL=(Object.defineProperty(nL.prototype,"name",{get:function(){return this._delegate.name},enumerable:!1,configurable:!0}),Object.defineProperty(nL.prototype,"bucket",{get:function(){return this._delegate.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(nL.prototype,"fullPath",{get:function(){return this._delegate.fullPath},enumerable:!1,configurable:!0}),nL.prototype.toString=function(){return this._delegate.toString()},nL.prototype.child=function(t){return new nL(qx(this._delegate,t),this.storage)},Object.defineProperty(nL.prototype,"root",{get:function(){return new nL(this._delegate.root,this.storage)},enumerable:!1,configurable:!0}),Object.defineProperty(nL.prototype,"parent",{get:function(){var t=this._delegate.parent;return null==t?null:new nL(t,this.storage)},enumerable:!1,configurable:!0}),nL.prototype.put=function(t,e){return this._throwIfRoot("put"),new Jx(Gx(this._delegate,t,e),this)},nL.prototype.putString=function(t,e,n){void 0===e&&(e=CD.RAW),this._throwIfRoot("putString");t=AD(e,t),n=Ji({},n);return null==n.contentType&&null!=t.contentType&&(n.contentType=t.contentType),new Jx(new Px(this._delegate,new tx(t.data,!0),n),this)},nL.prototype.listAll=function(){var e=this;return Lx(this._delegate).then(function(t){return new Zx(t,e.storage)})},nL.prototype.list=function(t){var e=this;return Mx(this._delegate,t||void 0).then(function(t){return new Zx(t,e.storage)})},nL.prototype.getMetadata=function(){return zx(this._delegate)},nL.prototype.updateMetadata=function(t){return Fx(this._delegate,t)},nL.prototype.getDownloadURL=function(){return Ux(this._delegate)},nL.prototype.delete=function(){return this._throwIfRoot("delete"),jx(this._delegate)},nL.prototype._throwIfRoot=function(t){if(""===this._delegate._location.path)throw TD(t)},nL);function nL(t,e){this._delegate=t,this.storage=e}var rL=(Object.defineProperty(iL.prototype,"maxOperationRetryTime",{get:function(){return this._delegate.maxOperationRetryTime},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"maxUploadRetryTime",{get:function(){return this._delegate.maxUploadRetryTime},enumerable:!1,configurable:!0}),iL.prototype.ref=function(t){if(Vx(t))throw _D("ref() expected a child path but got a URL, use refFromURL instead.");return new eL(Qx(this._delegate,t),this)},iL.prototype.refFromURL=function(t){if(!Vx(t))throw _D("refFromURL() expected a full URL but got a child path, use ref() instead.");try{qD.makeFromUrl(t)}catch(t){throw _D("refFromUrl() expected a valid full URL but got an invalid one.")}return new eL(Qx(this._delegate,t),this)},iL.prototype.setMaxUploadRetryTime=function(t){this._delegate.maxUploadRetryTime=t},iL.prototype.setMaxOperationRetryTime=function(t){this._delegate.maxOperationRetryTime=t},iL);function iL(t,e){var n=this;this.app=t,this._delegate=e,this.INTERNAL={delete:function(){return n._delegate._delete()}}}var oL,sL;function aL(t,e){var n=e.instanceIdentifier,e=t.getProvider("app").getImmediate(),t=t.getProvider("auth-internal");return new rL(e,new Wx(e,t,new UD,n,Xl.SDK_VERSION))}sL={TaskState:xD,TaskEvent:DD,StringFormat:CD,Storage:Wx,Reference:eL},(oL=Xl).INTERNAL.registerComponent(new ts("storage",aL,"PUBLIC").setServiceProps(sL).setMultipleInstances(!0)),oL.registerVersion("@firebase/storage","0.4.6");var uL,cL,hL="0.4.9",lL="FB-PERF-TRACE-MEASURE",fL="@firebase/performance/config",pL="@firebase/performance/configexpire",Sn="Performance",Ga=((Ga={})["trace started"]="Trace {$traceName} was started before.",Ga["trace stopped"]="Trace {$traceName} is not running.",Ga["nonpositive trace startTime"]="Trace {$traceName} startTime should be positive.",Ga["nonpositive trace duration"]="Trace {$traceName} duration should be positive.",Ga["no window"]="Window is not available.",Ga["no app id"]="App id is not available.",Ga["no project id"]="Project id is not available.",Ga["no api key"]="Api key is not available.",Ga["invalid cc log"]="Attempted to queue invalid cc event",Ga["FB not default"]="Performance can only start when Firebase app instance is the default one.",Ga["RC response not ok"]="RC response is not ok",Ga["invalid attribute name"]="Attribute name {$attributeName} is invalid.",Ga["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",Ga["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",Ga["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",Ga),dL=new Co("performance",Sn,Ga),vL=new ps(Sn);vL.logLevel=as.INFO;var gL,yL=(mL.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},mL.prototype.mark=function(t){this.performance&&this.performance.mark&&this.performance.mark(t)},mL.prototype.measure=function(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)},mL.prototype.getEntriesByType=function(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]},mL.prototype.getEntriesByName=function(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]},mL.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},mL.prototype.requiredApisAvailable=function(){return fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled?!!bo()||(vL.info("IndexedDB is not supported by current browswer"),!1):(vL.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)},mL.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]})},mL.getInstance=function(){return uL=void 0===uL?new mL(cL):uL},mL);function mL(t){if(!(this.window=t))throw dL.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 bL(t,e){var n=t.length-e.length;if(n<0||1<n)throw dL.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 wL,_L,IL=(TL.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw dL.create("no app id");return t},TL.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw dL.create("no project id");return t},TL.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw dL.create("no api key");return t},TL.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},TL.getInstance=function(){return gL=void 0===gL?new TL:gL},TL);function TL(){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=bL("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=bL("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}(Sn=_L=_L||{})[Sn.UNKNOWN=0]="UNKNOWN",Sn[Sn.VISIBLE=1]="VISIBLE",Sn[Sn.HIDDEN=2]="HIDDEN";var EL=["firebase_","google_","ga_"],SL=new RegExp("^[a-zA-Z]\\w*$");function CL(){switch(yL.getInstance().document.visibilityState){case"visible":return _L.VISIBLE;case"hidden":return _L.HIDDEN;default:return _L.UNKNOWN}}var NL="0.0.1",AL={loggingEnabled:!0},kL="FIREBASE_INSTALLATIONS_AUTH";function RL(t){var n,e=function(){var t=yL.getInstance().localStorage;if(!t)return;var e=t.getItem(pL);if(!e||!function(t){return Number(t)>Date.now()}(e))return;var n=t.getItem(fL);if(!n)return;try{return JSON.parse(n)}catch(t){return}}();return e?(OL(e),Promise.resolve()):(n=t,function(){var t=IL.getInstance().installationsService.getToken();return t.then(function(t){}),t}().then(function(t){var e="https://firebaseremoteconfig.googleapis.com/v1/projects/"+IL.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+IL.getInstance().getApiKey(),t=new Request(e,{method:"POST",headers:{Authorization:kL+" "+t},body:JSON.stringify({app_instance_id:n,app_instance_id_token:t,app_id:IL.getInstance().getAppId(),app_version:hL,sdk_version:NL})});return fetch(t).then(function(t){if(t.ok)return t.json();throw dL.create("RC response not ok")})}).catch(function(){vL.info(PL)}).then(OL).then(function(t){var e=yL.getInstance().localStorage;if(!t||!e)return;e.setItem(fL,JSON.stringify(t)),e.setItem(pL,String(Date.now()+60*IL.getInstance().configTimeToLive*60*1e3))},function(){}))}var PL="Could not fetch config, will use default configs";function OL(t){if(!t)return t;var e=IL.getInstance(),n=t.entries||{};return e.loggingEnabled=void 0!==n.fpr_enabled?"true"===String(n.fpr_enabled):AL.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=DL(e.tracesSamplingRate),e.logNetworkAfterSampling=DL(e.networkRequestsSamplingRate),t}function DL(t){return Math.random()<=t}var xL,LL=1;function ML(){return LL=2,xL=xL||function(){var n=yL.getInstance().document;return new Promise(function(t){var e;n&&"complete"!==n.readyState?(e=function(){"complete"===n.readyState&&(n.removeEventListener("readystatechange",e),t())},n.addEventListener("readystatechange",e)):t()})}().then(function(){return(t=IL.getInstance().installationsService.getId()).then(function(t){wL=t}),t;var t}).then(RL).then(FL,FL)}function FL(){LL=3}var UL,jL=1e4,qL=5500,VL=3,BL=1e3,KL=VL,WL=[],HL=!1;function GL(t){setTimeout(function(){var t,e;if(0!==KL)return WL.length?(t=WL.splice(0,BL),e=t.map(function(t){return{source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)}}),void function(t,r){return function(t){var e=IL.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then(function(t){return t.ok||vL.info("Call to Firebase backend failed."),t.json()}).then(function(t){var e=Number(t.nextRequestWaitMillis),n=jL;isNaN(e)||(n=Math.max(e,n));t=t.logResponseDetails;Array.isArray(t)&&0<t.length&&"RETRY_REQUEST_LATER"===t[0].responseAction&&(WL=no(no([],r),WL),vL.info("Retry transport request later.")),KL=VL,GL(n)})}({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:IL.getInstance().logSource,log_event:e},t).catch(function(){WL=no(no([],t),WL),KL--,vL.info("Tries left: "+KL+"."),GL(jL)})):GL(jL)},t)}function zL(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(t){if(!t.eventTime||!t.message)throw dL.create("invalid cc log");WL=no(no([],WL),[t])}({message:n.apply(void 0,t),eventTime:Date.now()})}}function QL(t,e){(UL=UL||zL(JL))(t,e)}function YL(t){var e=IL.getInstance();!e.instrumentationEnabled&&t.isAuto||(e.dataCollectionEnabled||t.isAuto)&&yL.getInstance().requiredApisAvailable()&&(t.isAuto&&CL()!==_L.VISIBLE||(3===LL?XL(t):ML().then(function(){return XL(t)},function(){return XL(t)})))}function XL(t){var e;!wL||(e=IL.getInstance()).loggingEnabled&&e.logTraceAfterSampling&&setTimeout(function(){return QL(t,1)},0)}function JL(t,e){return(0===e?function(t){t={url:t.url,http_method:t.httpMethod||0,http_response_code:200,response_payload_bytes:t.responsePayloadBytes,client_start_time_us:t.startTimeUs,time_to_response_initiated_us:t.timeToResponseInitiatedUs,time_to_response_completed_us:t.timeToResponseCompletedUs},t={application_info:$L(),network_request_metric:t};return JSON.stringify(t)}: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);t=t.getAttributes();0!==Object.keys(t).length&&(e.custom_attributes=t);e={application_info:$L(),trace_metric:e};return JSON.stringify(e)})(t)}function $L(){return{google_app_id:IL.getInstance().getAppId(),app_instance_id:wL,web_app_info:{sdk_version:hL,page_url:yL.getInstance().getUrl(),service_worker_status:"serviceWorker"in(t=yL.getInstance().navigator)?t.serviceWorker.controller?2:3:1,visibility_state:CL(),effective_connection_type:function(){var t=yL.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 ZL=["_fp","_fcp","_fid"];var tM=(eM.prototype.start=function(){if(1!==this.state)throw dL.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},eM.prototype.stop=function(){if(2!==this.state)throw dL.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(),YL(this)},eM.prototype.record=function(t,e,n){if(t<=0)throw dL.create("nonpositive trace startTime",{traceName:this.name});if(e<=0)throw dL.create("nonpositive trace duration",{traceName:this.name});if(this.durationUs=Math.floor(1e3*e),this.startTimeUs=Math.floor(1e3*t),n&&n.attributes&&(this.customAttributes=Ji({},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])))}YL(this)},eM.prototype.incrementMetric=function(t,e){void 0===e&&(e=1),void 0===this.counters[t]?this.putMetric(t,e):this.putMetric(t,this.counters[t]+e)},eM.prototype.putMetric=function(t,e){if(n=t,r=this.name,0===n.length||100<n.length||!(r&&r.startsWith("_wt_")&&-1<ZL.indexOf(n))&&n.startsWith("_"))throw dL.create("invalid custom metric name",{customMetricName:t});var n,r;this.counters[t]=(t=e,(e=Math.floor(t))<t&&vL.info("Metric value should be an Integer, setting the value as : "+e+"."),e)},eM.prototype.getMetric=function(t){return this.counters[t]||0},eM.prototype.putAttribute=function(t,e){var n,r,i=!(0===(n=t).length||40<n.length)&&(!EL.some(function(t){return n.startsWith(t)})&&!!n.match(SL)),r=0!==(r=e).length&&r.length<=100;if(i&&r)this.customAttributes[t]=e;else{if(!i)throw dL.create("invalid attribute name",{attributeName:t});if(!r)throw dL.create("invalid attribute value",{attributeValue:e})}},eM.prototype.getAttribute=function(t){return this.customAttributes[t]},eM.prototype.removeAttribute=function(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]},eM.prototype.getAttributes=function(){return Ji({},this.customAttributes)},eM.prototype.setStartTime=function(t){this.startTimeUs=t},eM.prototype.setDuration=function(t){this.durationUs=t},eM.prototype.calculateTraceMetrics=function(){var t=this.api.getEntriesByName(this.traceMeasure),t=t&&t[0];t&&(this.durationUs=Math.floor(1e3*t.duration),this.startTimeUs=Math.floor(1e3*(t.startTime+this.api.getTimeOrigin())))},eM.createOobTrace=function(t,e,n){var r,i=yL.getInstance().getUrl();i&&(r=new eM("_wt_"+i,!0),i=Math.floor(1e3*yL.getInstance().getTimeOrigin()),r.setStartTime(i),t&&t[0]&&(r.setDuration(Math.floor(1e3*t[0].duration)),r.putMetric("domInteractive",Math.floor(1e3*t[0].domInteractive)),r.putMetric("domContentLoadedEventEnd",Math.floor(1e3*t[0].domContentLoadedEventEnd)),r.putMetric("loadEventEnd",Math.floor(1e3*t[0].loadEventEnd))),e&&((t=e.find(function(t){return"first-paint"===t.name}))&&t.startTime&&r.putMetric("_fp",Math.floor(1e3*t.startTime)),(e=e.find(function(t){return"first-contentful-paint"===t.name}))&&e.startTime&&r.putMetric("_fcp",Math.floor(1e3*e.startTime)),n&&r.putMetric("_fid",Math.floor(1e3*n))),YL(r))},eM.createUserTimingTrace=function(t){YL(new eM(t,!1,t))},eM);function eM(t,e,n){void 0===e&&(e=!1),this.name=t,this.isAuto=e,this.state=1,this.customAttributes={},this.counters={},this.api=yL.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||lL+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function nM(t){var e,n,r,i=t;i&&void 0!==i.responseStart&&(n=yL.getInstance().getTimeOrigin(),r=Math.floor(1e3*(i.startTime+n)),t=i.responseStart?Math.floor(1e3*(i.responseStart-i.startTime)):void 0,n=Math.floor(1e3*(i.responseEnd-i.startTime)),i={url:i.name&&i.name.split("?")[0],responsePayloadBytes:i.transferSize,startTimeUs:r,timeToResponseInitiatedUs:t,timeToResponseCompletedUs:n},e=i,(r=IL.getInstance()).instrumentationEnabled&&(t=e.url,n=r.logEndPointUrl.split("?")[0],i=r.flTransportEndpointUrl.split("?")[0],t!==n&&t!==i&&r.loggingEnabled&&r.logNetworkAfterSampling&&setTimeout(function(){return QL(e,0)},0)))}var rM=5e3;function iM(){wL&&(setTimeout(function(){var t=yL.getInstance(),e=t.getEntriesByType("navigation"),n=t.getEntriesByType("paint");{var r;t.onFirstInputDelay?(r=setTimeout(function(){tM.createOobTrace(e,n),r=void 0},rM),t.onFirstInputDelay(function(t){r&&(clearTimeout(r),tM.createOobTrace(e,n,t))})):tM.createOobTrace(e,n)}},0),setTimeout(function(){for(var t=yL.getInstance(),e=t.getEntriesByType("resource"),n=0,r=e;n<r.length;n++)nM(r[n]);t.setupObserver("resource",nM)},0),setTimeout(function(){for(var t=yL.getInstance(),e=t.getEntriesByType("measure"),n=0,r=e;n<r.length;n++)oM(r[n]);t.setupObserver("measure",oM)},0))}function oM(t){t=t.name;t.substring(0,lL.length)!==lL&&tM.createUserTimingTrace(t)}var sM=(aM.prototype.trace=function(t){return new tM(t)},Object.defineProperty(aM.prototype,"instrumentationEnabled",{get:function(){return IL.getInstance().instrumentationEnabled},set:function(t){IL.getInstance().instrumentationEnabled=t},enumerable:!1,configurable:!0}),Object.defineProperty(aM.prototype,"dataCollectionEnabled",{get:function(){return IL.getInstance().dataCollectionEnabled},set:function(t){IL.getInstance().dataCollectionEnabled=t},enumerable:!1,configurable:!0}),aM);function aM(t){this.app=t,yL.getInstance().requiredApisAvailable()&&wo().then(function(t){t&&(HL||(GL(qL),HL=!0),ML().then(iM,iM))}).catch(function(t){vL.info("Environment doesn't support IndexedDB: "+t)})}var uM;function cM(t,e){if("[DEFAULT]"!==t.name)throw dL.create("FB not default");if("undefined"==typeof window)throw dL.create("no window");return cL=window,IL.getInstance().firebaseAppInstance=t,IL.getInstance().installationsService=e,new sM(t)}(uM=Xl).INTERNAL.registerComponent(new ts("performance",function(t){var e=t.getProvider("app").getImmediate(),t=t.getProvider("installations").getImmediate();return cM(e,t)},"PUBLIC")),uM.registerVersion("@firebase/performance","0.4.9");var hM,lM,fM="firebase_id",pM="origin",dM=6e4,vM="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",gM="https://www.googletagmanager.com/gtag/js";(Sn=hM=hM||{}).EVENT="event",Sn.SET="set",Sn.CONFIG="config",(Sn=lM=lM||{}).ADD_SHIPPING_INFO="add_shipping_info",Sn.ADD_PAYMENT_INFO="add_payment_info",Sn.ADD_TO_CART="add_to_cart",Sn.ADD_TO_WISHLIST="add_to_wishlist",Sn.BEGIN_CHECKOUT="begin_checkout",Sn.CHECKOUT_PROGRESS="checkout_progress",Sn.EXCEPTION="exception",Sn.GENERATE_LEAD="generate_lead",Sn.LOGIN="login",Sn.PAGE_VIEW="page_view",Sn.PURCHASE="purchase",Sn.REFUND="refund",Sn.REMOVE_FROM_CART="remove_from_cart",Sn.SCREEN_VIEW="screen_view",Sn.SEARCH="search",Sn.SELECT_CONTENT="select_content",Sn.SELECT_ITEM="select_item",Sn.SELECT_PROMOTION="select_promotion",Sn.SET_CHECKOUT_OPTION="set_checkout_option",Sn.SHARE="share",Sn.SIGN_UP="sign_up",Sn.TIMING_COMPLETE="timing_complete",Sn.VIEW_CART="view_cart",Sn.VIEW_ITEM="view_item",Sn.VIEW_ITEM_LIST="view_item_list",Sn.VIEW_PROMOTION="view_promotion",Sn.VIEW_SEARCH_RESULTS="view_search_results";var yM=new ps("@firebase/analytics");function mM(o,s,a,u){return function(n,r,i){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,6,,7]),n!==hM.EVENT?[3,2]:[4,function(u,c,h,l,f){return $i(this,void 0,void 0,function(){var n,r,e,i,o,s,a;return Zi(this,function(t){switch(t.label){case 0:return(t.trys.push([0,4,,5]),n=[],f&&f.send_to)?(a=f.send_to,Array.isArray(a)||(a=[a]),[4,Promise.all(h)]):[3,2];case 1:for(r=t.sent(),e=function(e){var t=r.find(function(t){return t.measurementId===e}),t=t&&c[t.appId];if(!t)return n=[],"break";n.push(t)},i=0,o=a;i<o.length&&(s=o[i],"break"!==e(s));i++);t.label=2;case 2:return 0===n.length&&(n=Object.values(c)),[4,Promise.all(n)];case 3:return t.sent(),u(hM.EVENT,l,f||{}),[3,5];case 4:return a=t.sent(),yM.error(a),[3,5];case 5:return[2]}})})}(o,s,a,r,i)];case 1:return t.sent(),[3,5];case 2:return n!==hM.CONFIG?[3,4]:[4,function(r,i,o,s,a,u){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:e=s[a],t.label=1;case 1:return t.trys.push([1,7,,8]),e?[4,i[e]]:[3,3];case 2:return t.sent(),[3,6];case 3:return[4,Promise.all(o)];case 4:return n=t.sent(),(n=n.find(function(t){return t.measurementId===a}))?[4,i[n.appId]]:[3,6];case 5:t.sent(),t.label=6;case 6:return[3,8];case 7:return n=t.sent(),yM.error(n),[3,8];case 8:return r(hM.CONFIG,a,u),[2]}})})}(o,s,a,u,r,i)];case 3:return t.sent(),[3,5];case 4:o(hM.SET,r),t.label=5;case 5:return[3,7];case 6:return e=t.sent(),yM.error(e),[3,7];case 7:return[2]}})})}}var Sn=((Sn={})["already-exists"]="A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.",Sn["already-initialized"]="Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.",Sn["interop-component-reg-failed"]="Firebase Analytics Interop Component failed to instantiate: {$reason}",Sn["invalid-analytics-context"]="Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}",Sn["indexeddb-unavailable"]="IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}",Sn["fetch-throttle"]="The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.",Sn["config-fetch-failed"]="Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}",Sn["no-api-key"]='The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',Sn["no-app-id"]='The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',Sn),bM=new Co("analytics","Analytics",Sn),wM=30;function _M(t,e){void 0===t&&(t={}),void 0===e&&(e=1e3),this.throttleMetadata=t,this.intervalMillis=e}var IM=new(_M.prototype.getThrottleMetadata=function(t){return this.throttleMetadata[t]},_M.prototype.setThrottleMetadata=function(t,e){this.throttleMetadata[t]=e},_M.prototype.deleteThrottleMetadata=function(t){delete this.throttleMetadata[t]},_M);function TM(o){var s;return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return e=o.appId,i=o.apiKey,i={method:"GET",headers:new Headers({Accept:"application/json","x-goog-api-key":i})},e=vM.replace("{app-id}",e),[4,fetch(e,i)];case 1:if(200===(n=t.sent()).status||304===n.status)return[3,6];r="",t.label=2;case 2:return t.trys.push([2,4,,5]),[4,n.json()];case 3:return i=t.sent(),null!==(s=i.error)&&void 0!==s&&s.message&&(r=i.error.message),[3,5];case 4:return t.sent(),[3,5];case 5:throw bM.create("config-fetch-failed",{httpStatus:n.status,responseMessage:r});case 6:return[2,n.json()]}})})}function EM(a,u,c){return void 0===u&&(u=IM),$i(this,void 0,void 0,function(){var e,n,r,i,o,s=this;return Zi(this,function(t){if(i=a.options,e=i.appId,n=i.apiKey,r=i.measurementId,!e)throw bM.create("no-app-id");if(n)return i=u.getThrottleMetadata(e)||{backoffCount:0,throttleEndTimeMillis:Date.now()},o=new NM,setTimeout(function(){return $i(s,void 0,void 0,function(){return Zi(this,function(t){return o.abort(),[2]})})},void 0!==c?c:dM),[2,function s(a,t,u,c){var h=t.throttleEndTimeMillis,l=t.backoffCount;void 0===c&&(c=IM);return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:e=a.appId,n=a.measurementId,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,SM(u,h)];case 2:return t.sent(),[3,4];case 3:if(i=t.sent(),n)return yM.warn("Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID "+n+' provided in the "measurementId" field in the local Firebase config. ['+i.message+"]"),[2,{appId:e,measurementId:n}];throw i;case 4:return t.trys.push([4,6,,7]),[4,TM(a)];case 5:return o=t.sent(),c.deleteThrottleMetadata(e),[2,o];case 6:if(CM(r=t.sent()))return i=503===Number(r.customData.httpStatus)?$o(l,c.intervalMillis,wM):$o(l,c.intervalMillis),o={throttleEndTimeMillis:Date.now()+i,backoffCount:l+1},c.setThrottleMetadata(e,o),yM.debug("Calling attemptFetch again in "+i+" millis"),[2,s(a,o,u,c)];if(c.deleteThrottleMetadata(e),n)return yM.warn("Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID "+n+' provided in the "measurementId" field in the local Firebase config. ['+r.message+"]"),[2,{appId:e,measurementId:n}];throw r;case 7:return[2]}})})}({appId:e,apiKey:n,measurementId:r},i,o,u)];if(r)return[2,{measurementId:r,appId:e}];throw bM.create("no-api-key")})})}function SM(i,o){return new Promise(function(t,e){var n=Math.max(o-Date.now(),0),r=setTimeout(t,n);i.addEventListener(function(){clearTimeout(r),e(bM.create("fetch-throttle",{throttleEndTimeMillis:o}))})})}function CM(t){if(t instanceof Eo&&t.customData){t=Number(t.customData.httpStatus);return 429===t||500===t||503===t||504===t}}var NM=(AM.prototype.addEventListener=function(t){this.listeners.push(t)},AM.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},AM);function AM(){this.listeners=[]}function kM(a,u,c,h,l,f){return $i(this,void 0,void 0,function(){var i,o,s;return Zi(this,function(t){switch(t.label){case 0:return(i=EM(a)).then(function(t){c[t.measurementId]=t.appId,a.options.measurementId&&t.measurementId!==a.options.measurementId&&yM.warn("The measurement ID in the local Firebase config ("+a.options.measurementId+") does not match the measurement ID fetched from the server ("+t.measurementId+"). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.")}).catch(function(t){return yM.error(t)}),u.push(i),o=function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return bo()?[3,1]:(yM.warn(bM.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),[2,!1]);case 1:return t.trys.push([1,3,,4]),[4,wo()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),yM.warn(bM.create("indexeddb-unavailable",{errorInfo:e}).message),[2,!1];case 4:return[2,!0]}})})}().then(function(t){if(t)return h.getId()}),[4,Promise.all([i,o])];case 1:return s=t.sent(),i=s[0],o=s[1],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(gM))return r}}()||(e=f,n=i.measurementId,(r=document.createElement("script")).src=gM+"?l="+e+"&id="+n,r.async=!0,document.head.appendChild(r)),l("js",new Date),(s={})[pM]="firebase",s.update=!0,s=s,null!=o&&(s[fM]=o),l(hM.CONFIG,i.measurementId,s),[2,i.measurementId]}var e,n,r})})}var RM,PM,OM={},DM=[],xM={},LM="dataLayer",MM="gtag",FM=!1;function UM(t){if(FM)throw bM.create("already-initialized");t.dataLayerName&&(LM=t.dataLayerName),t.gtagName&&(MM=t.gtagName)}function jM(t,e){i=[],go()&&i.push("This is a browser extension environment."),_o()||i.push("Cookies are not available."),0<i.length&&(i=i.map(function(t,e){return"("+(e+1)+") "+t}).join(" "),i=bM.create("invalid-analytics-context",{errorInfo:i}),yM.warn(i.message));var n,r,i,o,s,a,u=t.options.appId;if(!u)throw bM.create("no-app-id");if(!t.options.apiKey){if(!t.options.measurementId)throw bM.create("no-api-key");yM.warn('The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID '+t.options.measurementId+' provided in the "measurementId" field in the local Firebase config.')}if(null!=OM[u])throw bM.create("already-exists",{id:u});return FM||(s=LM,a=[],Array.isArray(window[s])?a=window[s]:window[s]=a,n=OM,r=DM,i=xM,o=LM,s=MM,a=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];window[o].push(arguments)},window[s]&&"function"==typeof window[s]&&(a=window[s]),window[s]=mM(a,n,r,i),s={gtagCore:a,wrappedGtag:window[s]},PM=s.wrappedGtag,RM=s.gtagCore,FM=!0),OM[u]=kM(t,DM,xM,e,RM,LM),{app:t,logEvent:function(t,e,n){!function(n,r,i,o,s){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return s&&s.global?(n(hM.EVENT,i,o),[2]):[3,1];case 1:return[4,r];case 2:e=t.sent(),e=Ji(Ji({},o),{send_to:e}),n(hM.EVENT,i,e),t.label=3;case 3:return[2]}})})}(PM,OM[u],t,e,n).catch(function(t){return yM.error(t)})},setCurrentScreen:function(t,e){!function(n,r,i,o){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return o&&o.global?(n(hM.SET,{screen_name:i}),[2,Promise.resolve()]):[3,1];case 1:return[4,r];case 2:e=t.sent(),n(hM.CONFIG,e,{update:!0,screen_name:i}),t.label=3;case 3:return[2]}})})}(PM,OM[u],t,e).catch(function(t){return yM.error(t)})},setUserId:function(t,e){!function(n,r,i,o){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return o&&o.global?(n(hM.SET,{user_id:i}),[2,Promise.resolve()]):[3,1];case 1:return[4,r];case 2:e=t.sent(),n(hM.CONFIG,e,{update:!0,user_id:i}),t.label=3;case 3:return[2]}})})}(PM,OM[u],t,e).catch(function(t){return yM.error(t)})},setUserProperties:function(t,e){!function(s,a,u,c){return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:if(!c||!c.global)return[3,1];for(e={},n=0,r=Object.keys(u);n<r.length;n++)i=r[n],e["user_properties."+i]=u[i];return s(hM.SET,e),[2,Promise.resolve()];case 1:return[4,a];case 2:o=t.sent(),s(hM.CONFIG,o,{update:!0,user_properties:u}),t.label=3;case 3:return[2]}})})}(PM,OM[u],t,e).catch(function(t){return yM.error(t)})},setAnalyticsCollectionEnabled:function(t){!function(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,n];case 1:return e=t.sent(),window["ga-disable-"+e]=!r,[2]}})})}(OM[u],t).catch(function(t){return yM.error(t)})},INTERNAL:{delete:function(){return delete OM[u],Promise.resolve()}}}}var qM,VM="analytics";function BM(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:if(go())return[2,!1];if(!_o())return[2,!1];if(!bo())return[2,!1];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,wo()];case 2:return[2,t.sent()];case 3:return t.sent(),[2,!1];case 4:return[2]}})})}(qM=Xl).INTERNAL.registerComponent(new ts(VM,function(t){return jM(t.getProvider("app").getImmediate(),t.getProvider("installations").getImmediate())},"PUBLIC").setServiceProps({settings:UM,EventName:lM,isSupported:BM})),qM.INTERNAL.registerComponent(new ts("analytics-internal",function(t){try{return{logEvent:t.getProvider(VM).getImmediate().logEvent}}catch(t){throw bM.create("interop-component-reg-failed",{reason:t})}},"PRIVATE")),qM.registerVersion("@firebase/analytics","0.6.7");var KM=(WM.prototype.isCachedDataFresh=function(t,e){if(!e)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;var n=Date.now()-e,e=n<=t;return this.logger.debug("Config fetch cache check. Cache age millis: "+n+". Cache max age millis (minimumFetchIntervalMillis setting): "+t+". Is cache hit: "+e+"."),e},WM.prototype.fetch=function(i){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()])];case 1:return(r=t.sent(),e=r[0],(r=r[1])&&this.isCachedDataFresh(i.cacheMaxAgeMillis,e))?[2,r]:(i.eTag=r&&r.eTag,[4,this.client.fetch(i)]);case 2:return n=t.sent(),r=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())],200===n.status&&r.push(this.storage.setLastSuccessfulFetchResponse(n)),[4,Promise.all(r)];case 3:return t.sent(),[2,n]}})})},WM);function WM(t,e,n,r){this.client=t,this.storage=e,this.storageCache=n,this.logger=r}var Sn=((Sn={})["registration-window"]="Undefined window object. This SDK only supports usage in a browser environment.",Sn["registration-project-id"]="Undefined project identifier. Check Firebase app initialization.",Sn["registration-api-key"]="Undefined API key. Check Firebase app initialization.",Sn["registration-app-id"]="Undefined app identifier. Check Firebase app initialization.",Sn["storage-open"]="Error thrown when opening storage. Original error: {$originalErrorMessage}.",Sn["storage-get"]="Error thrown when reading from storage. Original error: {$originalErrorMessage}.",Sn["storage-set"]="Error thrown when writing to storage. Original error: {$originalErrorMessage}.",Sn["storage-delete"]="Error thrown when deleting from storage. Original error: {$originalErrorMessage}.",Sn["fetch-client-network"]="Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.",Sn["fetch-timeout"]='The config fetch request timed out. Configure timeout using "fetchTimeoutMillis" SDK setting.',Sn["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}.',Sn["fetch-client-parse"]="Fetch client could not parse response. Original error: {$originalErrorMessage}.",Sn["fetch-status"]="Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.",Sn),HM=new Co("remoteconfig","Remote Config",Sn);var GM=(zM.prototype.fetch=function(f){return $i(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,h,l;return Zi(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()])];case 1:o=t.sent(),n=o[0],i=o[1],r=window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com",o=r+"/v1/projects/"+this.projectId+"/namespaces/"+this.namespace+":fetch?key="+this.apiKey,r={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":f.eTag||"*"},i={sdk_version:this.sdkVersion,app_instance_id:n,app_instance_id_token:i,app_id:this.appId,language_code:(e=void 0===e?navigator:e).languages&&e.languages[0]||e.language},i={method:"POST",headers:r,body:JSON.stringify(i)},o=fetch(o,i),i=new Promise(function(t,e){f.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([o,i])];case 3:return t.sent(),[4,o];case 4:return l=t.sent(),[3,6];case 5:throw i=t.sent(),o="fetch-client-network","AbortError"===i.name&&(o="fetch-timeout"),HM.create(o,{originalErrorMessage:i.message});case 6:if(s=l.status,a=l.headers.get("ETag")||void 0,200!==l.status)return[3,11];h=void 0,t.label=7;case 7:return t.trys.push([7,9,,10]),[4,l.json()];case 8:return h=t.sent(),[3,10];case 9:throw l=t.sent(),HM.create("fetch-client-parse",{originalErrorMessage:l.message});case 10:u=h.entries,c=h.state,t.label=11;case 11:if("INSTANCE_STATE_UNSPECIFIED"===c?s=500:"NO_CHANGE"===c?s=304:"NO_TEMPLATE"!==c&&"EMPTY_CONFIG"!==c||(u={}),304!==s&&200!==s)throw HM.create("fetch-status",{httpStatus:s});return[2,{status:s,eTag:a,config:u}]}var e})})},zM);function zM(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 QM=(YM.prototype.addEventListener=function(t){this.listeners.push(t)},YM.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},YM);function YM(){this.listeners=[]}var XM=["1","true","t","yes","y","on"],JM=($M.prototype.asString=function(){return this._value},$M.prototype.asBoolean=function(){return"static"!==this._source&&0<=XM.indexOf(this._value.toLowerCase())},$M.prototype.asNumber=function(){if("static"===this._source)return 0;var t=Number(this._value);return t=isNaN(t)?0:t},$M.prototype.getSource=function(){return this._source},$M);function $M(t,e){void 0===e&&(e=""),this._source=t,this._value=e}var ZM=(tF.prototype.setLogLevel=function(t){switch(t){case"debug":this._logger.logLevel=as.DEBUG;break;case"silent":this._logger.logLevel=as.SILENT;break;default:this._logger.logLevel=as.ERROR}},Object.defineProperty(tF.prototype,"fetchTimeMillis",{get:function(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1},enumerable:!1,configurable:!0}),Object.defineProperty(tF.prototype,"lastFetchStatus",{get:function(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"},enumerable:!1,configurable:!0}),tF.prototype.activate=function(){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,Promise.all([this._storage.getLastSuccessfulFetchResponse(),this._storage.getActiveConfigEtag()])];case 1:return n=t.sent(),e=n[0],n=n[1],e&&e.config&&e.eTag&&e.eTag!==n?[4,Promise.all([this._storageCache.setActiveConfig(e.config),this._storage.setActiveConfigEtag(e.eTag)])]:[2,!1];case 2:return t.sent(),[2,!0]}})})},tF.prototype.ensureInitialized=function(){var t=this;return this._initializePromise||(this._initializePromise=this._storageCache.loadFromStorage().then(function(){t._isInitializationComplete=!0})),this._initializePromise},tF.prototype.fetch=function(){return $i(this,void 0,void 0,function(){var r,i,o,s=this;return Zi(this,function(t){switch(t.label){case 0:r=new QM,setTimeout(function(){return $i(s,void 0,void 0,function(){return Zi(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 Eo&&-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})})},tF.prototype.fetchAndActivate=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,this.fetch()];case 1:return t.sent(),[2,this.activate()]}})})},tF.prototype.getAll=function(){var n=this;return function(t,e){void 0===t&&(t={});void 0===e&&(e={});return Object.keys(Ji(Ji({},t),e))}(this._storageCache.getActiveConfig(),this.defaultConfig).reduce(function(t,e){return t[e]=n.getValue(e),t},{})},tF.prototype.getBoolean=function(t){return this.getValue(t).asBoolean()},tF.prototype.getNumber=function(t){return this.getValue(t).asNumber()},tF.prototype.getString=function(t){return this.getValue(t).asString()},tF.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 JM("remote",e[t]):this.defaultConfig&&void 0!==this.defaultConfig[t]?new JM("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 JM("static"))},tF);function tF(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 eF(t,e){t=t.target.error||void 0;return HM.create(e,{originalErrorMessage:t&&t.message})}var nF="app_namespace_store",rF="firebase_remote_config",iF=1;var oF=(sF.prototype.getLastFetchStatus=function(){return this.get("last_fetch_status")},sF.prototype.setLastFetchStatus=function(t){return this.set("last_fetch_status",t)},sF.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.get("last_successful_fetch_timestamp_millis")},sF.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.set("last_successful_fetch_timestamp_millis",t)},sF.prototype.getLastSuccessfulFetchResponse=function(){return this.get("last_successful_fetch_response")},sF.prototype.setLastSuccessfulFetchResponse=function(t){return this.set("last_successful_fetch_response",t)},sF.prototype.getActiveConfig=function(){return this.get("active_config")},sF.prototype.setActiveConfig=function(t){return this.set("active_config",t)},sF.prototype.getActiveConfigEtag=function(){return this.get("active_config_etag")},sF.prototype.setActiveConfigEtag=function(t){return this.set("active_config_etag",t)},sF.prototype.getThrottleMetadata=function(){return this.get("throttle_metadata")},sF.prototype.setThrottleMetadata=function(t){return this.set("throttle_metadata",t)},sF.prototype.deleteThrottleMetadata=function(){return this.delete("throttle_metadata")},sF.prototype.get=function(a){return $i(this,void 0,void 0,function(){var o,s=this;return Zi(this,function(t){switch(t.label){case 0:return[4,this.openDbPromise];case 1:return o=t.sent(),[2,new Promise(function(e,n){var t=o.transaction([nF],"readonly").objectStore(nF),r=s.createCompositeKey(a);try{var i=t.get(r);i.onerror=function(t){n(eF(t,"storage-get"))},i.onsuccess=function(t){t=t.target.result;e(t?t.value:void 0)}}catch(t){n(HM.create("storage-get",{originalErrorMessage:t&&t.message}))}})]}})})},sF.prototype.set=function(a,u){return $i(this,void 0,void 0,function(){var o,s=this;return Zi(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([nF],"readwrite").objectStore(nF),r=s.createCompositeKey(a);try{var i=n.put({compositeKey:r,value:u});i.onerror=function(t){e(eF(t,"storage-set"))},i.onsuccess=function(){t()}}catch(t){e(HM.create("storage-set",{originalErrorMessage:t&&t.message}))}})]}})})},sF.prototype.delete=function(a){return $i(this,void 0,void 0,function(){var o,s=this;return Zi(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([nF],"readwrite").objectStore(nF),r=s.createCompositeKey(a);try{var i=n.delete(r);i.onerror=function(t){e(eF(t,"storage-delete"))},i.onsuccess=function(){t()}}catch(t){e(HM.create("storage-delete",{originalErrorMessage:t&&t.message}))}})]}})})},sF.prototype.createCompositeKey=function(t){return[this.appId,this.appName,this.namespace,t].join()},sF);function sF(t,e,n,r){void 0===r&&(r=new Promise(function(e,n){var t=indexedDB.open(rF,iF);t.onerror=function(t){n(eF(t,"storage-open"))},t.onsuccess=function(t){e(t.target.result)},t.onupgradeneeded=function(t){var e=t.target.result;0===t.oldVersion&&e.createObjectStore(nF,{keyPath:"compositeKey"})}})),this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=r}var aF=(uF.prototype.getLastFetchStatus=function(){return this.lastFetchStatus},uF.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.lastSuccessfulFetchTimestampMillis},uF.prototype.getActiveConfig=function(){return this.activeConfig},uF.prototype.loadFromStorage=function(){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(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(e=t.sent())&&(this.lastFetchStatus=e),[4,n];case 2:return(n=t.sent())&&(this.lastSuccessfulFetchTimestampMillis=n),[4,r];case 3:return(r=t.sent())&&(this.activeConfig=r),[2]}})})},uF.prototype.setLastFetchStatus=function(t){return this.lastFetchStatus=t,this.storage.setLastFetchStatus(t)},uF.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.lastSuccessfulFetchTimestampMillis=t,this.storage.setLastSuccessfulFetchTimestampMillis(t)},uF.prototype.setActiveConfig=function(t){return this.activeConfig=t,this.storage.setActiveConfig(t)},uF);function uF(t){this.storage=t}var cF=(hF.prototype.fetch=function(n){return $i(this,void 0,void 0,function(){var e;return Zi(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)]}})})},hF.prototype.attemptFetch=function(r,t){var s=t.throttleEndTimeMillis,a=t.backoffCount;return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,(i=r.signal,o=s,new Promise(function(t,e){var n=Math.max(o-Date.now(),0),r=setTimeout(t,n);i.addEventListener(function(){clearTimeout(r),e(HM.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(r)];case 3:return e=t.sent(),[4,this.storage.deleteThrottleMetadata()];case 4:return t.sent(),[2,e];case 5:if(!function(t){if(t instanceof Eo&&t.customData){t=Number(t.customData.httpStatus);return 429===t||500===t||503===t||504===t}}(n=t.sent()))throw n;return n={throttleEndTimeMillis:Date.now()+$o(a),backoffCount:a+1},[4,this.storage.setThrottleMetadata(n)];case 6:return t.sent(),[2,this.attemptFetch(r,n)];case 7:return[2]}var i,o})})},hF);function hF(t,e){this.client=t,this.storage=e}var lF,fF="@firebase/remote-config";return(lF=Xl).INTERNAL.registerComponent(new ts("remoteConfig",function(t,e){var n=e.instanceIdentifier,r=t.getProvider("app").getImmediate(),i=t.getProvider("installations").getImmediate();if("undefined"==typeof window)throw HM.create("registration-window");var o=r.options,s=o.projectId,a=o.apiKey,u=o.appId;if(!s)throw HM.create("registration-project-id");if(!a)throw HM.create("registration-api-key");if(!u)throw HM.create("registration-app-id");n=n||"firebase";e=new oF(u,r.name,n),t=new aF(e),o=new ps(fF);o.logLevel=as.ERROR;u=new GM(i,lF.SDK_VERSION,n,s,a,u),u=new cF(u,e),u=new KM(u,e,t,o),o=new ZM(r,u,t,e,o);return o.ensureInitialized(),o},"PUBLIC").setMultipleInstances(!0)),lF.registerVersion(fF,"0.1.34"),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"),Xl.registerVersion("firebase","8.3.2","cdn"),Xl}); //# sourceMappingURL=firebase.js.map