1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[888],{602:function(e,t,n){"use strict";n.d(t,{Z:function(){return createCache}});var i=function(){function StyleSheet(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var e=StyleSheet.prototype;return e.hydrate=function(e){e.forEach(this._insertTag)},e.insert=function(e){if(this.ctr%(this.isSpeedy?65e3:1)==0){var t;this._insertTag(((t=document.createElement("style")).setAttribute("data-emotion",this.key),void 0!==this.nonce&&t.setAttribute("nonce",this.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t))}var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(n);try{i.insertRule(e,i.cssRules.length)}catch(e){}}else n.appendChild(document.createTextNode(e));this.ctr++}
vendor: 6,161 bytes, line 1
1,e.flush=function(){this.tags.forEach(function(e){return e.parentNode&&e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0},StyleSheet}(),s=Math.abs,o=String.fromCharCode,l=Object.assign;function Utility_replace(e,t,n){return e.replace(t,n)}function indexof(e,t){return e.indexOf(t)}function Utility_charat(e,t){return 0|e.charCodeAt(t)}function Utility_substr(e,t,n){return e.slice(t,n)}function Utility_strlen(e){return e.length}function Utility_append(e,t){return t.push(e),e}var u=1,h=1,d=0,_=0,m=0,g="";function node(e,t,n,i,s,o,l){return{value:e,root:t,parent:n,type:i,props:s,children:o,line:u,column:h,length:l,return:""}}function Tokenizer_copy(e,t){return l(node("",null,null,"",null,null,0),e,{length:-e.length},t)}function next(){return m=_<d?Utility_charat(g,_++):0,h++,10===m&&(h=1,u++),m}function peek(){return Utility_charat(g,_)}function token(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function alloc(e){return u=h=1,d=Utility_strlen(g=e),_=0,[]}function delimit(e){var t,n;return(t=_-1,n=function delimiter(e){for(;next();)switch(m){case e:return _;case 34:case 39:34!==e&&39!==e&&delimiter(m);break;case 40:41===e&&delimiter(e);break;case 92:next()}return _}(91===e?e+2:40===e?e+1:e),Utility_substr(g,t,n)).trim()}var E="-ms-",b="-moz-",V="-webkit-",k="comm",L="rule",j="decl",$="@keyframes";function Serializer_serialize(e,t){for(var n="",i=e.length,s=0;s<i;s++)n+=t(e[s],s,e,t)||"";return n}function stringify(e,t,n,i){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case j:return e.return=e.return||e.value;case k:return"";case $:return e.return=e.value+"{"+Serializer_serialize(e.children,i)+"}";case L:e.value=e.props.join(",")}return Utility_strlen(n=Serializer_serialize(e.children,i))?e.return=e.value+"{"+n+"}":""}function ruleset(e,t,n,i,o,l,u,h,d,_,m){for(var g=o-1,E=0===o?l:[""],b=E.length,V=0,k=0,j=0;V<i;++V)for(var $=0,z=Utility_substr(e,g+1,g=s(k=u[V])),ee=e;$<b;++$)(ee=(k>0?E[$]+" "+z:Utility_replace(z,/&\f/g,E[$])).trim())&&(d[j++]=ee);return node(e,t,n,0===o?L:h,d,_,m)}function declaration(e,t,n,i){return node(e,t,n,j,Utility_substr(e,0,i),Utility_substr(e,i+1,-1),i)}var identifierWithPointTracking=function(e,t,n){for(var i=0,s=0;i=s,s=peek(),38===i&&12===s&&(t[n]=1),!token(s);)next();return Utility_substr(g,e,_)},toRules=function(e,t){var n=-1,i=44;do switch(token(i)){case 0:38===i&&12===peek()&&(t[n]=1),e[n]+=identifierWithPointTracking(_-1,t,n);break;case 2:e[n]+=delimit(i);break;case 4:if(44===i){e[++n]=58===peek()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=o(i)}while(i=next());return e},getRules=function(e,t){var n;return n=toRules(alloc(e),t),g="",n},z=new WeakMap,compat=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,i=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||z.get(n))&&!i){z.set(e,!0);for(var s=[],o=getRules(t,s),l=n.props,u=0,h=0;u<o.length;u++)for(var d=0;d<l.length;d++,h++)e.props[h]=s[u]?o[u].replace(/&\f/g,l[d]):l[d]+" "+o[u]}}},removeLabel=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}},ee=[function(e,t,n,i){if(e.length>-1&&!e.return)switch(e.type){case j:e.return=function emotion_cache_browser_esm_prefix(e,t){switch(45^Utility_charat(e,0)?(((t<<2^Utility_charat(e,0))<<2^Utility_charat(e,1))<<2^Utility_charat(e,2))<<2^Utility_charat(e,3):0){case 5103:return V+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return V+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return V+e+b+e+E+e+e;case 6828:case 4268:return V+e+E+e+e;case 6165:return V+e+E+"flex-"+e+e;case 5187:return V+e+Utility_replace(e,/(\w+).+(:[^]+)/,V+"box-$1$2"+E+"flex-$1$2")+e;case 5443:return V+e+E+"flex-item-"+Utility_replace(e,/flex-|-self/,"")+e;case 4675:return V+e+E+"flex-line-pack"+Utility_replace(e,/align-content|flex-|-self/,"")+e;case 5548:return V+e+E+Utility_replace(e,"shrink","negative")+e;case 5292:return V+e+E+Utility_replace(e,"basis","preferred-size")+e;case 6060:return V+"box-"+Utility_replace(e,"-grow","")+V+e+E+Utility_replace(e,"grow","positive")+e;case 4554:return V+Utility_replace(e,/([^-])(transform)/g,"$1"+V+"$2")+e;case 6187:return Utility_replace(Utility_replace(Utility_replace(e,/(zoom-|grab)/,V+"$1"),/(image-set)/,V+"$1"),e,"")+e;case 5495:case 3959:return Utility_replace(e,/(image-set\([^]*)/,V+"$1$`$1");case 4968:return Utility_replace(Utility_replace(e,/(.+:)(flex-)?(.*)/,V+"box-pack:$3"+E+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+V+e+e;case 4095:case 3583:case 4068:case 2532:return Utility_replace(e,/(.+)-inline(.+)/,V+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Utility_strlen(e)-1-t>6)switch(Utility_charat(e,t+1)){case 109:if(45!==Utility_charat(e,t+4))break;case 102:return Utility_replace(e,/(.+:)(.+)-([^]+)/,"$1"+V+"$2-$3$1"+b+(108==Utility_charat(e,t+3)?"$3":"$2-$3"))+e;case 115:return~indexof(e,"stretch")?emotion_cache_browser_esm_prefix(Utility_replace(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==Utility_charat(e,t+1))break;case 6444:switch(Utility_charat(e,Utility_strlen(e)-3-(~indexof(e,"!important")&&10))){case 107:return Utility_replace(e,":",":"+V)+e;case 101:return Utility_replace(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+V+(45===Utility_charat(e,14)?"inline-":"")+"box$3$1"+V+"$2$3$1"+E+"$2box$3")+e}break;case 5936:switch(Utility_charat(e,t+11)){case 114:return V+e+E+Utility_replace(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return V+e+E+Utility_replace(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return V+e+E+Utility_replace(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return V+e+E+e+e}return e}(e.value,e.length);break;
1case $:return Serializer_serialize([Tokenizer_copy(e,{value:Utility_replace(e.value,"@","@"+V)})],i);case L:if(e.length)return e.props.map(function(t){var n;switch(n=t,(n=/(::plac\w+|:read-\w+)/.exec(n))?n[0]:n){case":read-only":case":read-write":return Serializer_serialize([Tokenizer_copy(e,{props:[Utility_replace(t,/:(read-\w+)/,":"+b+"$1")]})],i);case"::placeholder":return Serializer_serialize([Tokenizer_copy(e,{props:[Utility_replace(t,/:(plac\w+)/,":"+V+"input-$1")]}),Tokenizer_copy(e,{props:[Utility_replace(t,/:(plac\w+)/,":"+b+"$1")]}),Tokenizer_copy(e,{props:[Utility_replace(t,/:(plac\w+)/,E+"input-$1")]})],i)}return""}).join("")}}],createCache=function(e){var t,n,s,l,d,E=e.key;if("css"===E){var b=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(b,function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))})}var V=e.stylisPlugins||ee,L={},j=[];l=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+E+' "]'),function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)L[t[n]]=!0;j.push(e)});var $=(n=(t=[compat,removeLabel].concat(V,[stringify,(s=function(e){d.insert(e)},function(e){!e.root&&(e=e.return)&&s(e)})])).length,function(e,i,s,o){for(var l="",u=0;u<n;u++)l+=t[u](e,i,s,o)||"";return l}),stylis=function(e){var t,n;return Serializer_serialize((n=function parse(e,t,n,i,s,l,d,E,b){for(var V,L=0,j=0,$=d,z=0,ee=0,et=0,er=1,en=1,ei=1,es=0,eo="",el=s,eu=l,ec=i,eh=eo;en;)switch(et=es,es=next()){case 40:if(108!=et&&58==Utility_charat(eh,$-1)){-1!=indexof(eh+=Utility_replace(delimit(es),"&","&\f"),"&\f")&&(ei=-1);break}case 34:case 39:case 91:eh+=delimit(es);break;case 9:case 10:case 13:case 32:eh+=function(e){for(;m=peek();)if(m<33)next();else break;return token(e)>2||token(m)>3?"":" "}(et);break;case 92:eh+=function(e,t){for(var n;--t&&next()&&!(m<48)&&!(m>102)&&(!(m>57)||!(m<65))&&(!(m>70)||!(m<97)););return n=_+(t<6&&32==peek()&&32==next()),Utility_substr(g,e,n)}(_-1,7);continue;case 47:switch(peek()){case 42:case 47:Utility_append(node(V=function(e,t){for(;next();)if(e+m===57)break;else if(e+m===84&&47===peek())break;return"/*"+Utility_substr(g,t,_-1)+"*"+o(47===e?e:next())}(next(),_),t,n,k,o(m),Utility_substr(V,2,-2),0),b);break;default:eh+="/"}break;case 123*er:E[L++]=Utility_strlen(eh)*ei;case 125*er:case 59:case 0:switch(es){case 0:case 125:en=0;case 59+j:-1==ei&&(eh=Utility_replace(eh,/\f/g,"")),ee>0&&Utility_strlen(eh)-$&&Utility_append(ee>32?declaration(eh+";",i,n,$-1):declaration(Utility_replace(eh," ","")+";",i,n,$-2),b);break;case 59:eh+=";";default:if(Utility_append(ec=ruleset(eh,t,n,L,j,s,E,eo,el=[],eu=[],$),l),123===es){if(0===j)parse(eh,t,ec,ec,el,l,$,E,eu);else switch(99===z&&110===Utility_charat(eh,3)?100:z){case 100:case 108:case 109:case 115:parse(e,ec,ec,i&&Utility_append(ruleset(e,ec,ec,0,0,s,E,eo,s,el=[],$),eu),s,eu,$,E,i?el:eu);break;default:parse(eh,ec,ec,ec,[""],eu,0,E,eu)}}}L=j=ee=0,er=ei=1,eo=eh="",$=d;break;case 58:$=1+Utility_strlen(eh),ee=et;default:if(er<1){if(123==es)--er;else if(125==es&&0==er++&&125==(m=_>0?Utility_charat(g,--_):0,h--,10===m&&(h=1,u--),m))continue}switch(eh+=o(es),es*er){case 38:ei=j>0?1:(eh+="\f",-1);break;case 44:E[L++]=(Utility_strlen(eh)-1)*ei,ei=1;break;case 64:45===peek()&&(eh+=delimit(next())),z=peek(),j=$=Utility_strlen(eo=eh+=function(e){for(;!token(peek());)next();return Utility_substr(g,e,_)}(_)),es++;break;case 45:45===et&&2==Utility_strlen(eh)&&(er=0)}}return l}("",null,null,null,[""],t=alloc(t=e),0,[0],t),g="",n),$)},z={key:E,sheet:new i({key:E,container:l,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:L,registered:{},insert:function(e,t,n,i){d=n,stylis(e?e+"{"+t.styles+"}":t.styles),i&&(z.inserted[t.name]=!0)}};return z.sheet.hydrate(j),z}},5042:function(e,t,n){"use strict";function memoize(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}n.d(t,{Z:function(){return memoize}})},2443:function(e,t,n){"use strict";n.d(t,{T:function(){return l},w:function(){return withEmotionCache}});var i=n(7294),s=n(602);n(8137),n(7278);var o=(0,i.createContext)("undefined"!=typeof HTMLElement?(0,s.Z)({key:"css"}):null);o.Provider;var withEmotionCache=function(e){return(0,i.forwardRef)(function(t,n){return e(t,(0,i.useContext)(o),n)})},l=(0,i.createContext)({})},8137:function(e,t,n){"use strict";n.d(t,{O:function(){return serializeStyles}});var i,emotion_hash_esm=function(e){for(var t,n=0,i=0,s=e.length;s>=4;++i,s-=4)t=(65535&(t=255&e.charCodeAt(i)|(255&e.charCodeAt(++i))<<8|(255&e.charCodeAt(++i))<<16|(255&e.charCodeAt(++i))<<24))*1540483477+((t>>
1>16)*59797<<16),t^=t>>>24,n=(65535&t)*1540483477+((t>>>16)*59797<<16)^(65535&n)*1540483477+((n>>>16)*59797<<16);switch(s){case 3:n^=(255&e.charCodeAt(i+2))<<16;case 2:n^=(255&e.charCodeAt(i+1))<<8;case 1:n^=255&e.charCodeAt(i),n=(65535&n)*1540483477+((n>>>16)*59797<<16)}return n^=n>>>13,(((n=(65535&n)*1540483477+((n>>>16)*59797<<16))^n>>>15)>>>0).toString(36)},s={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},o=n(5042),l=/[A-Z]|^ms/g,u=/_EMO_([^_]+?)_([^]*?)_EMO_/g,isCustomProperty=function(e){return 45===e.charCodeAt(1)},isProcessableValue=function(e){return null!=e&&"boolean"!=typeof e},h=(0,o.Z)(function(e){return isCustomProperty(e)?e:e.replace(l,"-$&").toLowerCase()}),processStyleValue=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(u,function(e,t,n){return i={name:t,styles:n,next:i},t})}return 1===s[e]||isCustomProperty(e)||"number"!=typeof t||0===t?t:t+"px"};function handleInterpolation(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return i={name:n.name,styles:n.styles,next:i},n.name;if(void 0!==n.styles){var s=n.next;if(void 0!==s)for(;void 0!==s;)i={name:s.name,styles:s.styles,next:i},s=s.next;return n.styles+";"}return function(e,t,n){var i="";if(Array.isArray(n))for(var s=0;s<n.length;s++)i+=handleInterpolation(e,t,n[s])+";";else for(var o in n){var l=n[o];if("object"!=typeof l)null!=t&&void 0!==t[l]?i+=o+"{"+t[l]+"}":isProcessableValue(l)&&(i+=h(o)+":"+processStyleValue(o,l)+";");else if(Array.isArray(l)&&"string"==typeof l[0]&&(null==t||void 0===t[l[0]]))for(var u=0;u<l.length;u++)isProcessableValue(l[u])&&(i+=h(o)+":"+processStyleValue(o,l[u])+";");else{var d=handleInterpolation(e,t,l);switch(o){case"animation":case"animationName":i+=h(o)+":"+d+";";break;default:i+=o+"{"+d+"}"}}}return i}(e,t,n);case"function":if(void 0!==e){var o=i,l=n(e);return i=o,handleInterpolation(e,t,l)}}if(null==t)return n;var u=t[n];return void 0!==u?u:n}var d=/label:\s*([^\s;\n{]+)\s*(;|$)/g,serializeStyles=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var s,o=!0,l="";i=void 0;var u=e[0];null==u||void 0===u.raw?(o=!1,l+=handleInterpolation(n,t,u)):l+=u[0];for(var h=1;h<e.length;h++)l+=handleInterpolation(n,t,e[h]),o&&(l+=u[h]);d.lastIndex=0;for(var _="";null!==(s=d.exec(l));)_+="-"+s[1];return{name:emotion_hash_esm(l)+_,styles:l,next:i}}},7278:function(e,t,n){"use strict";n.d(t,{L:function(){return o}});var i,s=n(7294),o=!!(i||(i=n.t(s,2))).useInsertionEffect&&(i||(i=n.t(s,2))).useInsertionEffect||function(e){return e()}},4444:function(e,t,n){"use strict";n.d(t,{BH:function(){return Deferred},L:function(){return base64urlEncodeWithoutPadding},LL:function(){return ErrorFactory},P0:function(){return getDefaultEmulatorHostnameAndPort},Pz:function(){return getExperimentalSetting},Sg:function(){return createMockUserToken},ZR:function(){return FirebaseError},aH:function(){return getDefaultAppConfig},b$:function(){return isReactNative},eu:function(){return validateIndexedDBOpenable},hl:function(){return isIndexedDBAvailable},m9:function(){return getModularInstance},ne:function(){return createSubscribe},pd:function(){return extractQuerystring},q4:function(){return getDefaultEmulatorHost},ru:function(){return isBrowserExtension},tV:function(){return base64Decode},uI:function(){return isMobileCordova},vZ:function(){return function deepEqual(e,t){if(e===t)return!0;let n=Object.keys(e),i=Object.keys(t);for(let s of n){if(!i.includes(s))return!1;let n=e[s],o=t[s];if(isObject(n)&&isObject(o)){if(!deepEqual(n,o))return!1}else if(n!==o)return!1}for(let e of i)if(!n.includes(e))return!1;return!0}},w1:function(){return isIE},xO:function(){return querystring},xb:function(){return isEmpty}
1,z$:function(){return getUA},zd:function(){return querystringDecode}});var i=n(3454);/** 2 * @license 3 * Copyright 2017 Google LLC 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */let stringToByteArray$1=function(e){let t=[],n=0;for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);s<128?t[n++]=s:(s<2048?t[n++]=s>>6|192:((64512&s)==55296&&i+1<e.length&&(64512&e.charCodeAt(i+1))==56320?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),t[n++]=s>>18|240,t[n++]=s>>12&63|128):t[n++]=s>>12|224,t[n++]=s>>6&63|128),t[n++]=63&s|128)}return t},byteArrayToString=function(e){let t=[],n=0,i=0;for(;n<e.length;){let s=e[n++];if(s<128)t[i++]=String.fromCharCode(s);else if(s>191&&s<224){let o=e[n++];t[i++]=String.fromCharCode((31&s)<<6|63&o)}else if(s>239&&s<365){let o=e[n++],l=e[n++],u=e[n++],h=((7&s)<<18|(63&o)<<12|(63&l)<<6|63&u)-65536;t[i++]=String.fromCharCode(55296+(h>>10)),t[i++]=String.fromCharCode(56320+(1023&h))}else{let o=e[n++],l=e[n++];t[i++]=String.fromCharCode((15&s)<<12|(63&o)<<6|63&l)}}return t.join("")},s={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(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let t=0;t<e.length;t+=3){let s=e[t],o=t+1<e.length,l=o?e[t+1]:0,u=t+2<e.length,h=u?e[t+2]:0,d=s>>2,_=(3&s)<<4|l>>4,m=(15&l)<<2|h>>6,g=63&h;u||(g=64,o||(m=64)),i.push(n[d],n[_],n[m],n[g])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(stringToByteArray$1(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):byteArrayToString(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let n=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let t=0;t<e.length;){let s=n[e.charAt(t++)],o=t<e.length,l=o?n[e.charAt(t)]:0;++t;let u=t<e.length,h=u?n[e.charAt(t)]:64;++t;let d=t<e.length,_=d?n[e.charAt(t)]:64;if(++t,null==s||null==l||null==h||null==_)throw new DecodeBase64StringError;let m=s<<2|l>>4;if(i.push(m),64!==h){let e=l<<4&240|h>>2;if(i.push(e),64!==_){let e=h<<6&192|_;i.push(e)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};let DecodeBase64StringError=class DecodeBase64StringError extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}};let base64Encode=function(e){let t=stringToByteArray$1(e);return s.encodeByteArray(t,!0)},base64urlEncodeWithoutPadding=function(e){return base64Encode(e).replace(/\./g,"")},base64Decode=function(e){try{return s.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null},getDefaultsFromGlobal=()=>/** 17 * @license 18 * Copyright 2022 Google LLC 19 * 20 * Licensed under the Apache License, Version 2.0 (the "License");
21 * you may not use this file except in compliance with the License. 22 * You may obtain a copy of the License at 23 * 24 * http://www.apache.org/licenses/LICENSE-2.0 25 * 26 * Unless required by applicable law or agreed to in writing, software 27 * distributed under the License is distributed on an "AS IS" BASIS, 28 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 * See the License for the specific language governing permissions and 30 * limitations under the License. 31 */(function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw Error("Unable to locate global object.")})().__FIREBASE_DEFAULTS__,getDefaultsFromEnvVariable=()=>{if(void 0===i||void 0===i.env)return;let e=i.env.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},getDefaultsFromCookie=()=>{let e;if("undefined"==typeof document)return;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}let t=e&&base64Decode(e[1]);return t&&JSON.parse(t)},getDefaults=()=>{try{return getDefaultsFromGlobal()||getDefaultsFromEnvVariable()||getDefaultsFromCookie()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},getDefaultEmulatorHost=e=>{var t,n;return null===(n=null===(t=getDefaults())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},getDefaultEmulatorHostnameAndPort=e=>{let t=getDefaultEmulatorHost(e);if(!t)return;let n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw Error(`Invalid host ${t} with no separate hostname and port!`);let i=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),i]:[t.substring(0,n),i]},getDefaultAppConfig=()=>{var e;return null===(e=getDefaults())||void 0===e?void 0:e.config},getExperimentalSetting=e=>{var t;return null===(t=getDefaults())||void 0===t?void 0:t[`_${e}`]};/** 32 * @license 33 * Copyright 2017 Google LLC 34 * 35 * Licensed under the Apache License, Version 2.0 (the "License"); 36 * you may not use this file except in compliance with the License. 37 * You may obtain a copy of the License at 38 * 39 * http://www.apache.org/licenses/LICENSE-2.0 40 * 41 * Unless required by applicable law or agreed to in writing, software 42 * distributed under the License is distributed on an "AS IS" BASIS, 43 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 44 * See the License for the specific language governing permissions and 45 * limitations under the License. 46 */let Deferred=class Deferred{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}};/** 47 * @license 48 * Copyright 2021 Google LLC 49 * 50 * Licensed under the Apache License, Version 2.0 (the "License"); 51 * you may not use this file except in compliance with the License. 52 * You may obtain a copy of the License at 53 * 54 * http://www.apache.org/licenses/LICENSE-2.0 55 * 56 * Unless required by applicable law or agreed to in writing, software 57 * distributed under the License is distributed on an "AS IS" BASIS, 58 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 59 * See the License for the specific language governing permissions and 60 * limitations under the License. 61 */function createMockUserToken(e,t){if(e.uid)throw Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let n=t||"demo-project",i=e.iat||0,s=e.sub||e.user_id;if(!s)throw Error("mockUserToken must contain 'sub' or 'user_id' field!");let o=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},e);return[base64urlEncodeWithoutPadding(JSON.stringify({alg:"none",type:"JWT"})),base64urlEncodeWithoutPadding(JSON.stringify(o)),""].join(".")}/** 62 * @license 63 * Copyright 2017 Google LLC 64 * 65 * Licensed under the Apache License, Version 2.0 (the "License");
66 * you may not use this file except in compliance with the License. 67 * You may obtain a copy of the License at 68 * 69 * http://www.apache.org/licenses/LICENSE-2.0 70 * 71 * Unless required by applicable law or agreed to in writing, software 72 * distributed under the License is distributed on an "AS IS" BASIS, 73 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 74 * See the License for the specific language governing permissions and 75 * limitations under the License. 76 */function getUA(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function isMobileCordova(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())}function isBrowserExtension(){let e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function isReactNative(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function isIE(){let e=getUA();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function isIndexedDBAvailable(){try{return"object"==typeof indexedDB}catch(e){return!1}}function validateIndexedDBOpenable(){return new Promise((e,t)=>{try{let n=!0,i="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(i);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var e;t((null===(e=s.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})}let FirebaseError=class FirebaseError extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,FirebaseError.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ErrorFactory.prototype.create)}};let ErrorFactory=class ErrorFactory{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){let n=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],l=s?s.replace(o,(e,t)=>{let i=n[t];return null!=i?String(i):`<${t}?>`}):"Error",u=`${this.serviceName}: ${l} (${i}).`,h=new FirebaseError(i,u,n);return h}};let o=/\{\$([^}]+)}/g;function isEmpty(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function isObject(e){return null!==e&&"object"==typeof e}/** 77 * @license 78 * Copyright 2017 Google LLC 79 * 80 * Licensed under the Apache License, Version 2.0 (the "License"); 81 * you may not use this file except in compliance with the License. 82 * You may obtain a copy of the License at 83 * 84 * http://www.apache.org/licenses/LICENSE-2.0 85 * 86 * Unless required by applicable law or agreed to in writing, software 87 * distributed under the License is distributed on an "AS IS" BASIS, 88 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 89 * See the License for the specific language governing permissions and 90 * limitations under the License. 91 */function querystring(e){let t=[];for(let[n,i]of Object.entries(e))Array.isArray(i)?i.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(i));return t.length?"&"+t.join("&"):""}function querystringDecode(e){let t={},n=e.replace(/^\?/,"").split("&");return n.forEach(e=>{if(e){let[n,i]=e.split("=");
91t[decodeURIComponent(n)]=decodeURIComponent(i)}}),t}function extractQuerystring(e){let t=e.indexOf("?");if(!t)return"";let n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}function createSubscribe(e,t){let n=new ObserverProxy(e,t);return n.subscribe.bind(n)}let ObserverProxy=class ObserverProxy{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let i;if(void 0===e&&void 0===t&&void 0===n)throw Error("Missing Observer.");void 0===(i=!function(e,t){if("object"!=typeof e||null===e)return!1;for(let n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?{next:e,error:t,complete:n}:e).next&&(i.next=noop),void 0===i.error&&(i.error=noop),void 0===i.complete&&(i.complete=noop);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(e){}}),this.observers.push(i),s}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function noop(){}/** 92 * @license 93 * Copyright 2021 Google LLC 94 * 95 * Licensed under the Apache License, Version 2.0 (the "License"); 96 * you may not use this file except in compliance with the License. 97 * You may obtain a copy of the License at 98 * 99 * http://www.apache.org/licenses/LICENSE-2.0 100 * 101 * Unless required by applicable law or agreed to in writing, software 102 * distributed under the License is distributed on an "AS IS" BASIS, 103 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 104 * See the License for the specific language governing permissions and 105 * limitations under the License. 106 */function getModularInstance(e){return e&&e._delegate?e._delegate:e}},1265:function(e,t,n){"use strict";n.d(t,{Z:function(){return styles_createTheme}});var i=n(7462),s=n(3366),o=n(1387),l=n(9766),u=n(6500),h=n(4920),d=n(6523),_=n(1796),m={black:"#000",white:"#fff"},g={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},E={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},b={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},V={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},k={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},L={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},j={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"};let $=["mode","contrastThreshold","tonalOffset"],z={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:m.white,default:m.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackgroun
106d:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},ee={text:{primary:m.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:m.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function addLightOrDark(e,t,n,i){let s=i.light||i,o=i.dark||1.5*i;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:"light"===t?e.light=(0,_.$n)(e.main,s):"dark"===t&&(e.dark=(0,_._j)(e.main,o)))}let et=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"],er={textTransform:"uppercase"},en='"Roboto", "Helvetica", "Arial", sans-serif';function createShadow(...e){return`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,0.2),${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,0.14),${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,0.12)`}let ei=["none",createShadow(0,2,1,-1,0,1,1,0,0,1,3,0),createShadow(0,3,1,-2,0,2,2,0,0,1,5,0),createShadow(0,3,3,-2,0,3,4,0,0,1,8,0),createShadow(0,2,4,-1,0,4,5,0,0,1,10,0),createShadow(0,3,5,-1,0,5,8,0,0,1,14,0),createShadow(0,3,5,-1,0,6,10,0,0,1,18,0),createShadow(0,4,5,-2,0,7,10,1,0,2,16,1),createShadow(0,5,5,-3,0,8,10,1,0,3,14,2),createShadow(0,5,6,-3,0,9,12,1,0,3,16,2),createShadow(0,6,6,-3,0,10,14,1,0,4,18,3),createShadow(0,6,7,-4,0,11,15,1,0,4,20,3),createShadow(0,7,8,-4,0,12,17,2,0,5,22,4),createShadow(0,7,8,-4,0,13,19,2,0,5,24,4),createShadow(0,7,9,-4,0,14,21,2,0,5,26,4),createShadow(0,8,9,-5,0,15,22,2,0,6,28,5),createShadow(0,8,10,-5,0,16,24,2,0,6,30,5),createShadow(0,8,11,-5,0,17,26,2,0,6,32,5),createShadow(0,9,11,-5,0,18,28,2,0,7,34,6),createShadow(0,9,12,-6,0,19,29,2,0,7,36,6),createShadow(0,10,13,-6,0,20,31,3,0,8,38,7),createShadow(0,10,13,-6,0,21,33,3,0,8,40,7),createShadow(0,10,14,-6,0,22,35,3,0,8,42,7),createShadow(0,11,14,-7,0,23,36,3,0,9,44,8),createShadow(0,11,15,-7,0,24,38,3,0,9,46,8)],es=["duration","easing","delay"],eo={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},el={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function formatMs(e){return`${Math.round(e)}ms`}function getAutoHeightDuration(e){if(!e)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}var eu={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};let ec=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];var styles_createTheme=function(e={},...t){var n;let{mixins:eh={},palette:e_={},transitions:ef={},typography:ep={}}=e,em=(0,s.Z)(e,ec);if(e.vars)throw Error((0,o.Z)(18));let eg=function(e){let{mode:t="light",contrastThreshold:n=3,tonalOffset:u=.2}=e,h=(0,s.Z)(e,$),d=e.primary||function(e="light"){return"dark"===e?{main:k[200],light:k[50],dark:k[400]}:{main:k[700],light:k[400],dark:k[800]}}(t),et=e.secondary||function(e="light"){return"dark"===e?{main:E[200],light:E[50],dark:E[400]}:{main:E[500],light:E[300],dark:E[700]}}(t),er=e.error||function(e="light"){return"dark"===e?{main:b[500],light:b[300],dark:b[700]}:{main:b[700],light:b[400],dark:b[800]}}(t),en=e.info||function(e="light"){return"dark"===e?{main:L[400],light:L[300],dark:L[700]}:{main:L[700],light:L[500],dark:L[900]}}(t),ei=e.success||function(e="light"){return"dark"===e?{main:j[400],light:j[300],dark:j[700]}:{main:j[800],light:j[500],dark:j[900]}}(t),es=e.warning||function(e="light"){return"dark"===e?{main:V[400],light:V[300],dark:V[700]}:{main:"#ed6c02",light:V[500],dark:V[900]}}(t);function getContrastText(e){let t=(0,_.mi)(e,ee.text.primary)>=n?ee.text.primary:z.text.primary;return t}
106let augmentColor=({color:e,name:t,mainShade:n=500,lightShade:s=300,darkShade:l=700})=>{if(!(e=(0,i.Z)({},e)).main&&e[n]&&(e.main=e[n]),!e.hasOwnProperty("main"))throw Error((0,o.Z)(11,t?` (${t})`:"",n));if("string"!=typeof e.main)throw Error((0,o.Z)(12,t?` (${t})`:"",JSON.stringify(e.main)));return addLightOrDark(e,"light",s,u),addLightOrDark(e,"dark",l,u),e.contrastText||(e.contrastText=getContrastText(e.main)),e},eo=(0,l.Z)((0,i.Z)({common:(0,i.Z)({},m),mode:t,primary:augmentColor({color:d,name:"primary"}),secondary:augmentColor({color:et,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:augmentColor({color:er,name:"error"}),warning:augmentColor({color:es,name:"warning"}),info:augmentColor({color:en,name:"info"}),success:augmentColor({color:ei,name:"success"}),grey:g,contrastThreshold:n,getContrastText,augmentColor,tonalOffset:u},{dark:ee,light:z}[t]),h);return eo}(e_),ey=(0,u.Z)(e),eE=(0,l.Z)(ey,{mixins:(n=ey.breakpoints,(0,i.Z)({toolbar:{minHeight:56,[n.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[n.up("sm")]:{minHeight:64}}},eh)),palette:eg,shadows:ei.slice(),typography:function(e,t){let n="function"==typeof t?t(e):t,{fontFamily:o=en,fontSize:u=14,fontWeightLight:h=300,fontWeightRegular:d=400,fontWeightMedium:_=500,fontWeightBold:m=700,htmlFontSize:g=16,allVariants:E,pxToRem:b}=n,V=(0,s.Z)(n,et),k=u/14,L=b||(e=>`${e/g*k}rem`),buildVariant=(e,t,n,s,l)=>(0,i.Z)({fontFamily:o,fontWeight:e,fontSize:L(t),lineHeight:n},o===en?{letterSpacing:`${Math.round(1e5*(s/t))/1e5}em`}:{},l,E),j={h1:buildVariant(h,96,1.167,-1.5),h2:buildVariant(h,60,1.2,-.5),h3:buildVariant(d,48,1.167,0),h4:buildVariant(d,34,1.235,.25),h5:buildVariant(d,24,1.334,0),h6:buildVariant(_,20,1.6,.15),subtitle1:buildVariant(d,16,1.75,.15),subtitle2:buildVariant(_,14,1.57,.1),body1:buildVariant(d,16,1.5,.15),body2:buildVariant(d,14,1.43,.15),button:buildVariant(_,14,1.75,.4,er),caption:buildVariant(d,12,1.66,.4),overline:buildVariant(d,12,2.66,1,er),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return(0,l.Z)((0,i.Z)({htmlFontSize:g,pxToRem:L,fontFamily:o,fontSize:u,fontWeightLight:h,fontWeightRegular:d,fontWeightMedium:_,fontWeightBold:m},j),V,{clone:!1})}(eg,ep),transitions:function(e){let t=(0,i.Z)({},eo,e.easing),n=(0,i.Z)({},el,e.duration);return(0,i.Z)({getAutoHeightDuration,create:(e=["all"],i={})=>{let{duration:o=n.standard,easing:l=t.easeInOut,delay:u=0}=i;return(0,s.Z)(i,es),(Array.isArray(e)?e:[e]).map(e=>`${e} ${"string"==typeof o?o:formatMs(o)} ${l} ${"string"==typeof u?u:formatMs(u)}`).join(",")}},e,{easing:t,duration:n})}(ef),zIndex:(0,i.Z)({},eu)});return eE=(0,l.Z)(eE,em),(eE=t.reduce((e,t)=>(0,l.Z)(e,t),eE)).unstable_sxConfig=(0,i.Z)({},h.Z,null==em?void 0:em.unstable_sxConfig),eE.unstable_sx=function(e){return(0,d.Z)({sx:e,theme:this})},eE}},5408:function(e,t,n){"use strict";n.d(t,{L7:function(){return removeUnusedBreakpoints},VO:function(){return i},W8:function(){return createEmptyBreakpointObject},k9:function(){return handleBreakpoints}});let i={xs:0,sm:600,md:900,lg:1200,xl:1536},s={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${i[e]}px)`};function handleBreakpoints(e,t,n){let o=e.theme||{};if(Array.isArray(t)){let e=o.breakpoints||s;return t.reduce((i,s,o)=>(i[e.up(e.keys[o])]=n(t[o]),i),{})}if("object"==typeof t){let e=o.breakpoints||s;return Object.keys(t).reduce((s,o)=>{if(-1!==Object.keys(e.values||i).indexOf(o)){let i=e.up(o);s[i]=n(t[o],o)}else s[o]=t[o];return s},{})}let l=n(t);return l}function createEmptyBreakpointObject(e={}){var t;let n=null==(t=e.keys)?void 0:t.reduce((t,n)=>{let i=e.up(n);return t[i]={},t},{});return n||{}}function removeUnusedBreakpoints(e,t){return e.reduce((e,t)=>{let n=e[t],i=!n||0===Object.keys(n).length;return i&&delete e[t],e},t)}},1796:function(e,t,n){"use strict";n.d(t,{$n:function(){return lighten},Fq:function(){return alpha},_j:function(){return darken},mi:function(){return getContrastRatio}});var i=n(1387);function clamp(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function decomposeColor(e){let t;if(e.type)return e;if("#"===e.charAt(0))return decomposeColor(function(e){e=e.slice(1);
106let t=RegExp(`.{1,${e.length>=6?2:1}}`,"g"),n=e.match(t);return n&&1===n[0].length&&(n=n.map(e=>e+e)),n?`rgb${4===n.length?"a":""}(${n.map((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3).join(", ")})`:""}(e));let n=e.indexOf("("),s=e.substring(0,n);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(s))throw Error((0,i.Z)(9,e));let o=e.substring(n+1,e.length-1);if("color"===s){if(t=(o=o.split(" ")).shift(),4===o.length&&"/"===o[3].charAt(0)&&(o[3]=o[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(t))throw Error((0,i.Z)(10,t))}else o=o.split(",");return{type:s,values:o=o.map(e=>parseFloat(e)),colorSpace:t}}function recomposeColor(e){let{type:t,colorSpace:n}=e,{values:i}=e;return -1!==t.indexOf("rgb")?i=i.map((e,t)=>t<3?parseInt(e,10):e):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function getLuminance(e){let t="hsl"===(e=decomposeColor(e)).type||"hsla"===e.type?decomposeColor(function(e){e=decomposeColor(e);let{values:t}=e,n=t[0],i=t[1]/100,s=t[2]/100,o=i*Math.min(s,1-s),f=(e,t=(e+n/30)%12)=>s-o*Math.max(Math.min(t-3,9-t,1),-1),l="rgb",u=[Math.round(255*f(0)),Math.round(255*f(8)),Math.round(255*f(4))];return"hsla"===e.type&&(l+="a",u.push(t[3])),recomposeColor({type:l,values:u})}(e)).values:e.values;return Number((.2126*(t=t.map(t=>("color"!==e.type&&(t/=255),t<=.03928?t/12.92:((t+.055)/1.055)**2.4)))[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function getContrastRatio(e,t){let n=getLuminance(e),i=getLuminance(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}function alpha(e,t){return e=decomposeColor(e),t=clamp(t),("rgb"===e.type||"hsl"===e.type)&&(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,recomposeColor(e)}function darken(e,t){if(e=decomposeColor(e),t=clamp(t),-1!==e.type.indexOf("hsl"))e.values[2]*=1-t;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]*=1-t;return recomposeColor(e)}function lighten(e,t){if(e=decomposeColor(e),t=clamp(t),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*t;else if(-1!==e.type.indexOf("rgb"))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return recomposeColor(e)}},6500:function(e,t,n){"use strict";n.d(t,{Z:function(){return createTheme_createTheme}});var i=n(7462),s=n(3366),o=n(9766);let l=["values","unit","step"],sortBreakpointsValues=e=>{let t=Object.keys(e).map(t=>({key:t,val:e[t]}))||[];return t.sort((e,t)=>e.val-t.val),t.reduce((e,t)=>(0,i.Z)({},e,{[t.key]:t.val}),{})};var u={borderRadius:4},h=n(8700),d=n(6523),_=n(4920);let m=["breakpoints","palette","spacing","shape"];var createTheme_createTheme=function(e={},...t){let{breakpoints:n={},palette:g={},spacing:E,shape:b={}}=e,V=(0,s.Z)(e,m),k=function(e){let{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:o=5}=e,u=(0,s.Z)(e,l),h=sortBreakpointsValues(t),d=Object.keys(h);function up(e){let i="number"==typeof t[e]?t[e]:e;return`@media (min-width:${i}${n})`}function down(e){let i="number"==typeof t[e]?t[e]:e;return`@media (max-width:${i-o/100}${n})`}function between(e,i){let s=d.indexOf(i);return`@media (min-width:${"number"==typeof t[e]?t[e]:e}${n}) and (max-width:${(-1!==s&&"number"==typeof t[d[s]]?t[d[s]]:i)-o/100}${n})`}return(0,i.Z)({keys:d,values:h,up,down,between,only:function(e){return d.indexOf(e)+1<d.length?between(e,d[d.indexOf(e)+1]):up(e)},not:function(e){let t=d.indexOf(e);return 0===t?up(d[1]):t===d.length-1?down(d[t]):between(e,d[d.indexOf(e)+1]).replace("@media","@media not all and")},unit:n},u)}(n),L=function(e=8){if(e.mui)return e;let t=(0,h.hB)({spacing:e}),spacing=(...e)=>{let n=0===e.length?[1]:e;return n.map(e=>{let n=t(e);return"number"==typeof n?`${n}px`:n}).join(" ")};return spacing.mui=!0,spacing}(E),j=(0,o.Z)({breakpoints:k,direction:"ltr",components:{},palette:(0,i.Z)({mode:"light"},g),spacing:L,shape:(0,i.Z)({},u,b)},V);return(j=t.reduce((e,t)=>(0,o.Z)(e,t),j)).unstable_sxConfig=(0,i.Z)({},_.Z,null==V?void 0:V.unstable_sxConfig),j.unstable_sx=function(e){return(0,d.Z)({sx:e,theme:this})},j}},7730:function(e,t,n){"use strict";var i=n(9766);t.Z=function(e,t){return t?(0,i.Z)(e,t,{clone:!1}):e}},8700:function(e,t,n){"use strict";n.d(t,{hB:function(){return createUnarySpacing},eI:function(){return createUnaryUnit},NA:function(){return getValue},e6:function(){return margin},o3:function(){return padding}});var i=n(5408),s=n(4844),o=n(7730);let l={m:"margin",p:"padding"},u={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},h={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},d=function(e){let t={};return n=>(void 0===t[n]&&(t[n]=e(n)),t[n])}(e=>{if(e.length>2){if(!h[e])return[e];e=h[e]}let[t,n]=e.split(""),i=l[t],s=u[n]||"";return Array.isArray(s)?s.map(e=>i+e):[i+s]}),_=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],m=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],g=[..._,...m];function createUnaryUnit(e,t,n,i){var o;let l=null!=(o=(0,s.DW)(e,t,!1))?o:n;return"number"==typeof l?e=>"string"==typeof e?e:l*e:Array.isArray(l)?e=>"string"==typeof e?e:l[e]:"function"==typeof l?l:()=>void 0}function createUnarySpacing(e){return createUnaryUnit(e,"spacing",8,"spacing")}function getValue(e,t){if("string"==typeof t||null==t)return t;let n=Math.abs(t),i=e(n);return t>=0?i:"number"==typeof i?-i:`-${i}`}function spacing_style(e,t){let n=createUnarySpacing(e.theme);return Object.keys(e).map(s=>(function(e,t,n,s){if(-1===t.indexOf(n))return null;let o=d(n),l=e[n];return(0,i.k9)(e,l,e=>o.reduce((t,n)=>(t[n]=getValue(s,e),t),{}))})(e,t,s,n)).reduce(o.Z,{})}function margin(e){return spacing_style(e,_)}
106function padding(e){return spacing_style(e,m)}function spacing(e){return spacing_style(e,g)}margin.propTypes={},margin.filterProps=_,padding.propTypes={},padding.filterProps=m,spacing.propTypes={},spacing.filterProps=g},4844:function(e,t,n){"use strict";n.d(t,{DW:function(){return getPath},Jq:function(){return getStyleValue}});var i=n(4142),s=n(5408);function getPath(e,t,n=!0){if(!t||"string"!=typeof t)return null;if(e&&e.vars&&n){let n=`vars.${t}`.split(".").reduce((e,t)=>e&&e[t]?e[t]:null,e);if(null!=n)return n}return t.split(".").reduce((e,t)=>e&&null!=e[t]?e[t]:null,e)}function getStyleValue(e,t,n,i=n){let s;return s="function"==typeof e?e(n):Array.isArray(e)?e[n]||i:getPath(e,n)||i,t&&(s=t(s,i,e)),s}t.ZP=function(e){let{prop:t,cssProperty:n=e.prop,themeKey:o,transform:l}=e,fn=e=>{if(null==e[t])return null;let u=e[t],h=e.theme,d=getPath(h,o)||{};return(0,s.k9)(e,u,e=>{let s=getStyleValue(d,l,e);return(e===s&&"string"==typeof e&&(s=getStyleValue(d,l,`${t}${"default"===e?"":(0,i.Z)(e)}`,e)),!1===n)?s:{[n]:s}})};return fn.propTypes={},fn.filterProps=[t],fn}},4920:function(e,t,n){"use strict";n.d(t,{Z:function(){return eg}});var i=n(8700),s=n(4844),o=n(7730),esm_compose=function(...e){let t=e.reduce((e,t)=>(t.filterProps.forEach(n=>{e[n]=t}),e),{}),fn=e=>Object.keys(e).reduce((n,i)=>t[i]?(0,o.Z)(n,t[i](e)):n,{});return fn.propTypes={},fn.filterProps=e.reduce((e,t)=>e.concat(t.filterProps),[]),fn},l=n(5408);function borderTransform(e){return"number"!=typeof e?e:`${e}px solid`}let u=(0,s.ZP)({prop:"border",themeKey:"borders",transform:borderTransform}),h=(0,s.ZP)({prop:"borderTop",themeKey:"borders",transform:borderTransform}),d=(0,s.ZP)({prop:"borderRight",themeKey:"borders",transform:borderTransform}),_=(0,s.ZP)({prop:"borderBottom",themeKey:"borders",transform:borderTransform}),m=(0,s.ZP)({prop:"borderLeft",themeKey:"borders",transform:borderTransform}),g=(0,s.ZP)({prop:"borderColor",themeKey:"palette"}),E=(0,s.ZP)({prop:"borderTopColor",themeKey:"palette"}),b=(0,s.ZP)({prop:"borderRightColor",themeKey:"palette"}),V=(0,s.ZP)({prop:"borderBottomColor",themeKey:"palette"}),k=(0,s.ZP)({prop:"borderLeftColor",themeKey:"palette"}),borderRadius=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){let t=(0,i.eI)(e.theme,"shape.borderRadius",4,"borderRadius");return(0,l.k9)(e,e.borderRadius,e=>({borderRadius:(0,i.NA)(t,e)}))}return null};borderRadius.propTypes={},borderRadius.filterProps=["borderRadius"],esm_compose(u,h,d,_,m,g,E,b,V,k,borderRadius);let gap=e=>{if(void 0!==e.gap&&null!==e.gap){let t=(0,i.eI)(e.theme,"spacing",8,"gap");return(0,l.k9)(e,e.gap,e=>({gap:(0,i.NA)(t,e)}))}return null};gap.propTypes={},gap.filterProps=["gap"];let columnGap=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){let t=(0,i.eI)(e.theme,"spacing",8,"columnGap");return(0,l.k9)(e,e.columnGap,e=>({columnGap:(0,i.NA)(t,e)}))}return null};columnGap.propTypes={},columnGap.filterProps=["columnGap"];let rowGap=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){let t=(0,i.eI)(e.theme,"spacing",8,"rowGap");return(0,l.k9)(e,e.rowGap,e=>({rowGap:(0,i.NA)(t,e)}))}return null};rowGap.propTypes={},rowGap.filterProps=["rowGap"];let L=(0,s.ZP)({prop:"gridColumn"}),j=(0,s.ZP)({prop:"gridRow"}),$=(0,s.ZP)({prop:"gridAutoFlow"}),z=(0,s.ZP)({prop:"gridAutoColumns"}),ee=(0,s.ZP)({prop:"gridAutoRows"}),et=(0,s.ZP)({prop:"gridTemplateColumns"}),er=(0,s.ZP)({prop:"gridTemplateRows"}),en=(0,s.ZP)({prop:"gridTemplateAreas"}),ei=(0,s.ZP)({prop:"gridArea"});function paletteTransform(e,t){return"grey"===t?t:e}esm_compose(gap,columnGap,rowGap,L,j,$,z,ee,et,er,en,ei);let es=(0,s.ZP)({prop:"color",themeKey:"palette",transform:paletteTransform}),eo=(0,s.ZP)({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:paletteTransform}),el=(0,s.ZP)({prop:"backgroundColor",themeKey:"palette",transform:paletteTransform});function sizingTransform(e){return e<=1&&0!==e?`${100*e}%`:e}esm_compose(es,eo,el);let eu=(0,s.ZP)({prop:"width",transform:sizingTransform}),maxWidth=e=>void 0!==e.maxWidth&&null!==e.maxWidth?(0,l.k9)(e,e.maxWidth,t=>{var n,i;let s=(null==(n=e.theme)||null==(n=n.breakpoints)||null==(n=n.values)?void 0:n[t])||l.VO[t];return s?(null==(i=e.theme)||null==(i=i.breakpoints)?void 0:i.unit)!=="px"?{maxWidth:`${s}${e.theme.breakpoints.unit}`}:{maxWidth:s}:{maxWidth:sizingTransform(t)}}):null;maxWidth.filterProps=["maxWidth"];let ec=(0,s.ZP)({prop:"minWidth",transform:sizingTransform}),eh=(0,s.ZP)({prop:"height",transform:sizingTransform}),e_=(0,s.ZP)({prop:"maxHeight",transform:sizingTransform}),ef=(0,s.ZP)({prop:"minHeight",transform:sizingTransform});(0,s.ZP)({prop:"size",cssProperty:"width",transform:sizingTransform}),(0,s.ZP)({prop:"size",cssProperty:"height",transform:sizingTransform});let ep=(0,s.ZP)({prop:"boxSizing"});esm_compose(eu,maxWidth,ec,eh,e_,ef,ep);let em={border:{themeKey:"borders",transform:borderTransform},borderTop:{themeKey:"borders",transform:borderTransform},borderRight:{themeKey:"borders",transform:borderTransform},borderBottom:{themeKey:"borders",transform:borderTransform},borderLeft:{themeKey:"borders",transform:borderTransform},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:borderRadius},color:{themeKey:"palette",transform:paletteTransform},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:paletteTransform},backgroundColor:{themeKey:"palette",transform:paletteTransform},p:{style:i.o3},pt:{style:i.o3},pr:{style:i.o3},pb:{style:i.o3},pl:{style:i.o3},px:{style:i.o3},py:{style:i.o3},padding:{style:i.o3},paddingTop:{style:i.o3},paddingRight:{style:i.o3}
106,paddingBottom:{style:i.o3},paddingLeft:{style:i.o3},paddingX:{style:i.o3},paddingY:{style:i.o3},paddingInline:{style:i.o3},paddingInlineStart:{style:i.o3},paddingInlineEnd:{style:i.o3},paddingBlock:{style:i.o3},paddingBlockStart:{style:i.o3},paddingBlockEnd:{style:i.o3},m:{style:i.e6},mt:{style:i.e6},mr:{style:i.e6},mb:{style:i.e6},ml:{style:i.e6},mx:{style:i.e6},my:{style:i.e6},margin:{style:i.e6},marginTop:{style:i.e6},marginRight:{style:i.e6},marginBottom:{style:i.e6},marginLeft:{style:i.e6},marginX:{style:i.e6},marginY:{style:i.e6},marginInline:{style:i.e6},marginInlineStart:{style:i.e6},marginInlineEnd:{style:i.e6},marginBlock:{style:i.e6},marginBlockStart:{style:i.e6},marginBlockEnd:{style:i.e6},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:gap},rowGap:{style:rowGap},columnGap:{style:columnGap},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:sizingTransform},maxWidth:{style:maxWidth},minWidth:{transform:sizingTransform},height:{transform:sizingTransform},maxHeight:{transform:sizingTransform},minHeight:{transform:sizingTransform},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};var eg=em},6523:function(e,t,n){"use strict";var i=n(4142),s=n(7730),o=n(4844),l=n(5408),u=n(4920);let h=function(){function getThemeValue(e,t,n,s){let u={[e]:t,theme:n},h=s[e];if(!h)return{[e]:t};let{cssProperty:d=e,themeKey:_,transform:m,style:g}=h;if(null==t)return null;if("typography"===_&&"inherit"===t)return{[e]:t};let E=(0,o.DW)(n,_)||{};return g?g(u):(0,l.k9)(u,t,t=>{let n=(0,o.Jq)(E,m,t);return(t===n&&"string"==typeof t&&(n=(0,o.Jq)(E,m,`${e}${"default"===t?"":(0,i.Z)(t)}`,t)),!1===d)?n:{[d]:n}})}return function styleFunctionSx(e){var t;let{sx:n,theme:i={}}=e||{};if(!n)return null;let o=null!=(t=i.unstable_sxConfig)?t:u.Z;function traverse(e){let t=e;if("function"==typeof e)t=e(i);else if("object"!=typeof e)return e;if(!t)return null;let n=(0,l.W8)(i.breakpoints),u=Object.keys(n),h=n;return Object.keys(t).forEach(e=>{var n;let u="function"==typeof(n=t[e])?n(i):n;if(null!=u){if("object"==typeof u){if(o[e])h=(0,s.Z)(h,getThemeValue(e,u,i,o));else{let t=(0,l.k9)({theme:i},u,t=>({[e]:t}));(function(...e){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]),n=new Set(t);return e.every(e=>n.size===Object.keys(e).length)})(t,u)?h[e]=styleFunctionSx({sx:u,theme:i}):h=(0,s.Z)(h,t)}}else h=(0,s.Z)(h,getThemeValue(e,u,i,o))}}),(0,l.L7)(u,h)}return Array.isArray(n)?n.map(traverse):traverse(n)}}();h.filterProps=["sx"],t.Z=h},4168:function(e,t,n){"use strict";var i=n(7294),s=n(2443);t.Z=function(e=null){let t=i.useContext(s.T);return t&&0!==Object.keys(t).length?t:e}},4142:function(e,t,n){"use strict";n.d(t,{Z:function(){return capitalize}});var i=n(1387);function capitalize(e){if("string"!=typeof e)throw Error((0,i.Z)(7));return e.charAt(0).toUpperCase()+e.slice(1)}},9766:function(e,t,n){"use strict";n.d(t,{P:function(){return isPlainObject},Z:function(){return function deepmerge(e,t,n={clone:!0}){let s=n.clone?(0,i.Z)({},e):e;return isPlainObject(e)&&isPlainObject(t)&&Object.keys(t).forEach(i=>{"__proto__"!==i&&(isPlainObject(t[i])&&i in e&&isPlainObject(e[i])?s[i]=deepmerge(e[i],t[i],n):n.clone?s[i]=isPlainObject(t[i])?function deepClone(e){if(!isPlainObject(e))return e;let t={};return Object.keys(e).forEach(n=>{t[n]=deepClone(e[n])}),t}(t[i]):t[i]:s[i]=t[i])}),s}}});var i=n(7462);function isPlainObject(e){return null!==e&&"object"==typeof e&&e.constructor===Object}},1387:function(e,t,n){"use strict";function formatMuiErrorMessage(e){let t="https://mui.com/production-error/?code="+e;for(let e=1;e<arguments.length;e+=1)t+="&args[]="+encodeURIComponent(arguments[e]);return"Minified MUI error #"+e+"; visit "+t+" for the full message."}n.d(t,{Z:function(){return formatMuiErrorMessage}})},6489:function(e,t){"use strict";/*! 107 * cookie 108 * Copyright(c) 2012-2014 Roman Shtylman 109 * Copyright(c) 2015 Douglas Christopher Wilson 110 * MIT Licensed 111 */t.parse=function(e,t){if("string"!=typeof e)throw TypeError("argument str must be a string");for(var i={},s=e.split(";"),o=(t||{}).decode||n,l=0;l<s.length;l++){var u=s[l],h=u.indexOf("=");if(!(h<0)){var d=u.substring(0,h).trim();if(void 0==i[d]){var _=u.substring(h+1,u.length).trim();'"'===_[0]&&(_=_.slice(1,-1)),i[d]=function(e,t){try{return t(e)}catch(t){return e}}(_,o)}}}return i},t.serialize=function(e,t,n){var o=n||{},l=o.encode||i;if("function"!=typeof l)throw TypeError("option encode is invali
111d");if(!s.test(e))throw TypeError("argument name is invalid");var u=l(t);if(u&&!s.test(u))throw TypeError("argument val is invalid");var h=e+"="+u;if(null!=o.maxAge){var d=o.maxAge-0;if(isNaN(d)||!isFinite(d))throw TypeError("option maxAge is invalid");h+="; Max-Age="+Math.floor(d)}if(o.domain){if(!s.test(o.domain))throw TypeError("option domain is invalid");h+="; Domain="+o.domain}if(o.path){if(!s.test(o.path))throw TypeError("option path is invalid");h+="; Path="+o.path}if(o.expires){if("function"!=typeof o.expires.toUTCString)throw TypeError("option expires is invalid");h+="; Expires="+o.expires.toUTCString()}if(o.httpOnly&&(h+="; HttpOnly"),o.secure&&(h+="; Secure"),o.sameSite)switch("string"==typeof o.sameSite?o.sameSite.toLowerCase():o.sameSite){case!0:case"strict":h+="; SameSite=Strict";break;case"lax":h+="; SameSite=Lax";break;case"none":h+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid")}return h};var n=decodeURIComponent,i=encodeURIComponent,s=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/},3454:function(e,t,n){"use strict";var i,s;e.exports=(null==(i=n.g.process)?void 0:i.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(7663)},1118:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return n(440)}])},6770:function(e,t,n){"use strict";n.d(t,{H:function(){return AuthProvider},a:function(){return useAuth}});var i=n(5893),s=n(7294),o=n(6971),l=n(4556),u=n(2286),h=n.n(u);let d=(0,s.createContext)({user:null}),useAuth=()=>(0,s.useContext)(d);function AuthProvider(e){let{children:t}=e,[n,u]=(0,s.useState)(null);(0,s.useEffect)(()=>(0,l.Aj)(o.I8,async e=>{if(e){let t=await e.getIdToken();u(e),h().set(void 0,"token",t,{path:"/"})}else u(null),h().set(void 0,"token","",{path:"/"})}),[]),(0,s.useEffect)(()=>{let e=setInterval(async()=>{let e=o.I8.currentUser;e&&await e.getIdToken(!0)},6e5);return()=>clearInterval(e)},[]);let logOut=async()=>{u({email:null,uid:null}),await (0,l.w7)(o.I8)};return(0,i.jsx)(d.Provider,{value:{user:n,signUp:(e,t)=>(0,l.Xb)(o.I8,e,t),logIn:(e,t)=>(0,l.e5)(o.I8,e,t),logOut,sendEmailVerification:l.w$},children:t})}},440:function(e,t,n){"use strict";n.r(t),n.d(t,{MyCustomApp:function(){return MyCustomApp},default:function(){return $}});var i=n(5893),s=n(7294);n(415);var o=n(9008),l=n.n(o),u=n(4298),h=n.n(u),d=n(6770),_=n(1265),m=n(7462);let g=s.createContext(null);function useTheme(){let e=s.useContext(g);return e}let E="function"==typeof Symbol&&Symbol.for;var b=E?Symbol.for("mui.nested"):"__THEME_NESTED__",ThemeProvider_ThemeProvider=function(e){let{children:t,theme:n}=e,o=useTheme(),l=s.useMemo(()=>{let e=null===o?n:function(e,t){if("function"==typeof t){let n=t(e);return n}return(0,m.Z)({},e,t)}(o,n);return null!=e&&(e[b]=null!==o),e},[n,o]);return(0,i.jsx)(g.Provider,{value:l,children:t})},V=n(2443),k=n(4168);let L={};function useThemeScoping(e,t,n,i=!1){return s.useMemo(()=>{let s=e&&t[e]||t;if("function"==typeof n){let o=n(s),l=e?(0,m.Z)({},t,{[e]:o}):o;return i?()=>l:l}return e?(0,m.Z)({},t,{[e]:n}):(0,m.Z)({},t,n)},[e,t,n,i])}var esm_ThemeProvider_ThemeProvider=function(e){let{children:t,theme:n,themeId:s}=e,o=(0,k.Z)(L),l=useTheme()||L,u=useThemeScoping(s,o,n),h=useThemeScoping(s,l,n,!0);return(0,i.jsx)(ThemeProvider_ThemeProvider,{theme:h,children:(0,i.jsx)(V.T.Provider,{value:u,children:t})})};let j=(0,_.Z)({palette:{primary:{main:"#9a8866"}}}),CustomThemeProvider=e=>{let{children:t}=e;return(0,i.jsx)(esm_ThemeProvider_ThemeProvider,{theme:j,children:t})},generateWebsiteJsonLd=()=>({"@context":"https://schema.org","@type":"WebSite",name:"Tarkov Goon Tracker",url:"https://www.tarkov-goon-tracker.com/",description:"\n Tarkov Goon Tracker, the ultimate platform for tracking encounters with The Goons in the immersive world of Tarkov. Our website empowers users to submit their thrilling encounters with The Goons, enabling fellow players to navigate and strategize their own ventures. Dive into a wealth of valuable insights, tips, and tricks, alongside a repository of curated videos to enhance your Tarkov experience.\n\n Stay connected with the Tarkov community through our integrated Twitch Stream links, allowing users to share their live gameplay sessions and engage with a broader audience. Create a personalized profile to showcase your achievements, list your social media channels, and seamlessly keep track of your submitted encounters. Join us on Tarkov Goon Tracker, where every move counts and every adventure is
111worth sharing.\n",image:"https://www.tarkov-goon-tracker.com/_next/image?url=%2Fescape-from-tarkov-goon-tracker.webp&w=128&q=75"});var Schema=()=>{let e=generateWebsiteJsonLd();return(0,i.jsx)(l(),{children:(0,i.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify({"@context":"https://schema.org","@graph":[e]})}})})};function MyCustomApp(e){let{Component:t,pageProps:n}=e;return(0,i.jsxs)(d.H,{children:[(0,i.jsxs)(l(),{children:[(0,i.jsx)("meta",{charSet:"utf-8"}),(0,i.jsx)("meta",{name:"viewport",content:"initial-scale=1.0, width=device-width"})]}),(0,i.jsx)(h(),{src:"https://www.googletagmanager.com/gtag/js?id=G-4Q2Q5BLE40"}),(0,i.jsx)(h(),{id:"google-analytics",children:"\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'G-4Q2Q5BLE40'); \n "}),(0,i.jsx)(h(),{async:!0,src:"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7240508925750002",crossOrigin:"anonymous"}),(0,i.jsx)(Schema,{}),(0,i.jsx)(CustomThemeProvider,{children:(0,i.jsx)(t,{...n})})]})}var $=MyCustomApp},6971:function(e,t,n){"use strict";n.d(t,{I8:function(){return L},N$:function(){return j},Ck:function(){return getDocsFromQuery},e0:function(){return updateDocumentInCollection}});var i,s,o,l,u=n(6100),h=n(5816);/** 112 * @license 113 * Copyright 2020 Google LLC 114 * 115 * Licensed under the Apache License, Version 2.0 (the "License"); 116 * you may not use this file except in compliance with the License. 117 * You may obtain a copy of the License at 118 * 119 * http://www.apache.org/licenses/LICENSE-2.0 120 * 121 * Unless required by applicable law or agreed to in writing, software 122 * distributed under the License is distributed on an "AS IS" BASIS, 123 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 124 * See the License for the specific language governing permissions and 125 * limitations under the License. 126 */(0,h.KN)("firebase","10.5.0","app");var d=n(4556),_=n(4444),m=n(8463);/** 127 * @license 128 * Copyright 2017 Google LLC 129 * 130 * Licensed under the Apache License, Version 2.0 (the "License"); 131 * you may not use this file except in compliance with the License. 132 * You may obtain a copy of the License at 133 * 134 * http://www.apache.org/licenses/LICENSE-2.0 135 * 136 * Unless required by applicable law or agreed to in writing, software 137 * distributed under the License is distributed on an "AS IS" BASIS, 138 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139 * See the License for the specific language governing permissions and 140 * limitations under the License. 141 */let g="firebasestorage.googleapis.com";/** 142 * @license 143 * Copyright 2017 Google LLC 144 * 145 * Licensed under the Apache License, Version 2.0 (the "License"); 146 * you may not use this file except in compliance with the License. 147 * You may obtain a copy of the License at 148 * 149 * http://www.apache.org/licenses/LICENSE-2.0 150 * 151 * Unless required by applicable law or agreed to in writing, software 152 * distributed under the License is distributed on an "AS IS" BASIS, 153 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 154 * See the License for the specific language governing permissions and 155 * limitations under the License. 156 */let StorageError=class StorageError extends _.ZR{constructor(e,t,n=0){super(prependCode(e),`Firebase Storage: ${t} (${prependCode(e)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,StorageError.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return prependCode(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} 157${this.customData.serverResponse}`:this.message=this._baseMessage}};function prependCode(e){return"storage/"+e}
157function invalidArgument(e){return new StorageError(o.INVALID_ARGUMENT,e)}function appDeleted(){return new StorageError(o.APP_DELETED,"The Firebase app was deleted.")}(i=o||(o={})).UNKNOWN="unknown",i.OBJECT_NOT_FOUND="object-not-found",i.BUCKET_NOT_FOUND="bucket-not-found",i.PROJECT_NOT_FOUND="project-not-found",i.QUOTA_EXCEEDED="quota-exceeded",i.UNAUTHENTICATED="unauthenticated",i.UNAUTHORIZED="unauthorized",i.UNAUTHORIZED_APP="unauthorized-app",i.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",i.INVALID_CHECKSUM="invalid-checksum",i.CANCELED="canceled",i.INVALID_EVENT_NAME="invalid-event-name",i.INVALID_URL="invalid-url",i.INVALID_DEFAULT_BUCKET="invalid-default-bucket",i.NO_DEFAULT_BUCKET="no-default-bucket",i.CANNOT_SLICE_BLOB="cannot-slice-blob",i.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",i.NO_DOWNLOAD_URL="no-download-url",i.INVALID_ARGUMENT="invalid-argument",i.INVALID_ARGUMENT_COUNT="invalid-argument-count",i.APP_DELETED="app-deleted",i.INVALID_ROOT_OPERATION="invalid-root-operation",i.INVALID_FORMAT="invalid-format",i.INTERNAL_ERROR="internal-error",i.UNSUPPORTED_ENVIRONMENT="unsupported-environment";/** 158 * @license 159 * Copyright 2017 Google LLC 160 * 161 * Licensed under the Apache License, Version 2.0 (the "License"); 162 * you may not use this file except in compliance with the License. 163 * You may obtain a copy of the License at 164 * 165 * http://www.apache.org/licenses/LICENSE-2.0 166 * 167 * Unless required by applicable law or agreed to in writing, software 168 * distributed under the License is distributed on an "AS IS" BASIS, 169 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 170 * See the License for the specific language governing permissions and 171 * limitations under the License. 172 */let Location=class Location{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){let e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){let e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let n;try{n=Location.makeFromUrl(e,t)}catch(t){return new Location(e,"")}if(""===n.path)return n;throw new StorageError(o.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+e+"'.")}static makeFromUrl(e,t){let n=null,i="([A-Za-z0-9.\\-_]+)",s=RegExp("^gs://"+i+"(/(.*))?$","i");function httpModify(e){e.path_=decodeURIComponent(e.path)}let l=t.replace(/[.]/g,"\\."),u=RegExp(`^https?://${l}/v[A-Za-z0-9_]+/b/${i}/o(/([^?#]*).*)?$`,"i"),h=RegExp(`^https?://${t===g?"(?:storage.googleapis.com|storage.cloud.google.com)":t}/${i}/([^?#]*)`,"i"),d=[{regex:s,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:u,indices:{bucket:1,path:3},postModify:httpModify},{regex:h,indices:{bucket:1,path:2},postModify:httpModify}];for(let t=0;t<d.length;t++){let i=d[t],s=i.regex.exec(e);if(s){let e=s[i.indices.bucket],t=s[i.indices.path];t||(t=""),n=new Location(e,t),i.postModify(n);break}}if(null==n)throw new StorageError(o.INVALID_URL,"Invalid URL '"+e+"'.");return n}};let FailRequest=class FailRequest{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}};function validateNumber(e,t,n,i){if(i<t)throw invalidArgument(`Invalid value for '${e}'. Expected ${t} or greater.`);if(i>n)throw invalidArgument(`Invalid value for '${e}'. Expected ${n} or less.`)}(s=l||(l={}))[s.NO_ERROR=0]="NO_ERROR",s[s.NETWORK_ERROR=1]="NETWORK_ERROR",s[s.ABORT=2]="ABORT";/** 173 * @license 174 * Copyright 2017 Google LLC 175 * 176 * Licensed under the Apache License, Version 2.0 (the "License"); 177 * you may not use this file except in compliance with the License. 178 * You may obtain a copy of the License at 179 * 180 * http://www.apache.org/licenses/LICENSE-2.0 181 * 182 * Unless required by applicable law or agreed to in writing, software 183 * distributed under the License is distributed on an "AS IS" BASIS, 184 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 185 * See the License for the specific language governing permissions and 186 * limitations under the License. 187 */let NetworkRequest=class NetworkRequest{constructor(e,t,n,i,s,o,l,u,h,d,_,m=!0){this.url_=e,this.method_=t,this.headers_=n,this.body_=i,this.successCodes_=s,this.additionalRetryCodes_=o,this.callback_=l,this.errorCallback_=u,this.timeout_=h,this.progressCallback_=d,this.connectionFactory_=_,this.retry=m,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((e,t)=>
187{this.resolve_=e,this.reject_=t,this.start_()})}start_(){let backoffDone=(e,t)=>{let n=this.resolve_,i=this.reject_,s=t.connection;if(t.wasSuccessCode)try{let e=this.callback_(s,s.getResponse());void 0!==e?n(e):n()}catch(e){i(e)}else if(null!==s){let e=new StorageError(o.UNKNOWN,"An unknown error occurred, please check the error payload for server response.");e.serverResponse=s.getErrorText(),i(this.errorCallback_?this.errorCallback_(s,e):e)}else if(t.canceled){let e=this.appDelete_?appDeleted():new StorageError(o.CANCELED,"User canceled the upload/download.");i(e)}else{let e=new StorageError(o.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.");i(e)}};this.canceled_?backoffDone(!1,new RequestEndStatus(!1,null,!0)):this.backoffId_=/** 188 * @license 189 * Copyright 2017 Google LLC 190 * 191 * Licensed under the Apache License, Version 2.0 (the "License"); 192 * you may not use this file except in compliance with the License. 193 * You may obtain a copy of the License at 194 * 195 * http://www.apache.org/licenses/LICENSE-2.0 196 * 197 * Unless required by applicable law or agreed to in writing, software 198 * distributed under the License is distributed on an "AS IS" BASIS, 199 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 * See the License for the specific language governing permissions and 201 * limitations under the License. 202 */function(e,t,n){let i=1,s=null,o=null,l=!1,u=0,h=!1;function triggerCallback(...e){h||(h=!0,t.apply(null,e))}function callWithDelay(t){s=setTimeout(()=>{s=null,e(responseHandler,2===u)},t)}function clearGlobalTimeout(){o&&clearTimeout(o)}function responseHandler(e,...t){let n;if(h){clearGlobalTimeout();return}if(e){clearGlobalTimeout(),triggerCallback.call(null,e,...t);return}let s=2===u||l;if(s){clearGlobalTimeout(),triggerCallback.call(null,e,...t);return}i<64&&(i*=2),1===u?(u=2,n=0):n=(i+Math.random())*1e3,callWithDelay(n)}let d=!1;function stop(e){!d&&(d=!0,clearGlobalTimeout(),!h&&(null!==s?(e||(u=2),clearTimeout(s),callWithDelay(0)):e||(u=1)))}return callWithDelay(0),o=setTimeout(()=>{l=!0,stop(!0)},n),stop}((e,t)=>{if(t){e(!1,new RequestEndStatus(!1,null,!0));return}let n=this.connectionFactory_();this.pendingConnection_=n;let progressListener=e=>{let t=e.loaded,n=e.lengthComputable?e.total:-1;null!==this.progressCallback_&&this.progressCallback_(t,n)};null!==this.progressCallback_&&n.addUploadProgressListener(progressListener),n.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(progressListener),this.pendingConnection_=null;let t=n.getErrorCode()===l.NO_ERROR,i=n.getStatus();if(!t||/** 203 * @license 204 * Copyright 2022 Google LLC 205 * 206 * Licensed under the Apache License, Version 2.0 (the "License"); 207 * you may not use this file except in compliance with the License. 208 * You may obtain a copy of the License at 209 * 210 * http://www.apache.org/licenses/LICENSE-2.0 211 * 212 * Unless required by applicable law or agreed to in writing, software 213 * distributed under the License is distributed on an "AS IS" BASIS, 214 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 215 * See the License for the specific language governing permissions and 216 * limitations under the License. 217 */function(e,t){let n=e>=500&&e<600,i=-1!==[408,429].indexOf(e),s=-1!==t.indexOf(e);return n||i||s}(i,this.additionalRetryCodes_)&&this.retry){let t=n.getErrorCode()===l.ABORT;e(!1,new RequestEndStatus(!1,null,t));return}let s=-1!==this.successCodes_.indexOf(i);e(!0,new RequestEndStatus(s,n))})},backoffDone,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}};let RequestEndStatus=class RequestEndStatus{constructor(e,t,n){this.wasSuccessCode=e,this.connection=t,this.canceled=!!n}};/** 218 * @license 219 * Copyright 2019 Google LLC 220 * 221 * Licensed under the Apache License, Version 2.0 (the "License"); 222 * you may not use this file except in compliance with the License. 223 * You may obtain a copy of the License at 224 * 225 * http://www.apache.org/licenses/LICENSE-2.0 226 * 227 * Unless required by applicable law or agreed to in writing, softw
227are 228 * distributed under the License is distributed on an "AS IS" BASIS, 229 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 230 * See the License for the specific language governing permissions and 231 * limitations under the License. 232 */let Reference=class Reference{constructor(e,t){this._service=e,t instanceof Location?this._location=t:this._location=Location.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new Reference(e,t)}get root(){let e=new Location(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return function(e){let t=e.lastIndexOf("/",e.length-2);return -1===t?e:e.slice(t+1)}(this._location.path)}get storage(){return this._service}get parent(){let e=/** 233 * @license 234 * Copyright 2017 Google LLC 235 * 236 * Licensed under the Apache License, Version 2.0 (the "License"); 237 * you may not use this file except in compliance with the License. 238 * You may obtain a copy of the License at 239 * 240 * http://www.apache.org/licenses/LICENSE-2.0 241 * 242 * Unless required by applicable law or agreed to in writing, software 243 * distributed under the License is distributed on an "AS IS" BASIS, 244 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 245 * See the License for the specific language governing permissions and 246 * limitations under the License. 247 */function(e){if(0===e.length)return null;let t=e.lastIndexOf("/");if(-1===t)return"";let n=e.slice(0,t);return n}(this._location.path);if(null===e)return null;let t=new Location(this._location.bucket,e);return new Reference(this._service,t)}_throwIfRoot(e){if(""===this._location.path)throw new StorageError(o.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}};function extractBucket(e,t){let n=null==t?void 0:t.storageBucket;return null==n?null:Location.makeFromBucketSpec(n,e)}let FirebaseStorageImpl=class FirebaseStorageImpl{constructor(e,t,n,i,s){this.app=e,this._authProvider=t,this._appCheckProvider=n,this._url=i,this._firebaseVersion=s,this._bucket=null,this._host=g,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,null!=i?this._bucket=Location.makeFromBucketSpec(i,this._host):this._bucket=extractBucket(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=Location.makeFromBucketSpec(this._url,e):this._bucket=extractBucket(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){validateNumber("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){validateNumber("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;let e=this._authProvider.getImmediate({optional:!0});if(e){let t=await e.getToken();if(null!==t)return t.accessToken}return null}async _getAppCheckToken(){let e=this._appCheckProvider.getImmediate({optional:!0});if(e){let t=await e.getToken();return t.token}return null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Reference(this,e)}_makeRequest(e,t,n,i,s=!0){if(this._deleted)return new FailRequest(appDeleted());{let o=function(e,t,n,i,s,o,l=!0){let u=function(e){let t=encodeURIComponent,n="?";for(let i in e)if(e.hasOwnProperty(i)){let s=t(i)+"="+t(e[i]);n=n+s+"&"}return n.slice(0,-1)}(e.urlParams),h=e.url+u,d=Object.assign({},e.headers);return t&&(d["X-Firebase-GMPID"]=t),null!==n&&n.length>0&&(d.Authorization="Firebase "+n),d["X-Firebase-Storage-Version"]="webjs/"+(null!=o?o:"AppManager"),null!==i&&(d["X-Firebase-AppCheck"]=i),new NetworkRequest(h,e.method,d,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,s,l)}(e,this._appId,n,i,t,this._firebaseVersion,s);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,t){let[n,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);
247return this._makeRequest(e,t,n,i).getPromise()}};let E="@firebase/storage",b="0.11.2",V="storage";(0,h.Xd)(new m.wA(V,function(e,{instanceIdentifier:t}){let n=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),s=e.getProvider("app-check-internal");return new FirebaseStorageImpl(n,i,s,t,h.Jn)},"PUBLIC").setMultipleInstances(!0)),(0,h.KN)(E,b,""),(0,h.KN)(E,b,"esm2017");let k=(0,h.ZF)({apiKey:"AIzaSyCBXCXdvpPYz1rY9Wximbz0OIAhPVpYdek",authDomain:"legos-1ab16.firebaseapp.com",projectId:"legos-1ab16",storageBucket:"legos-1ab16.appspot.com",messagingSenderId:"712892128313",appId:"1:712892128313:web:f76f772da24f7cd8f301e8",measurementId:"G-X3Q97THP7W"}),L=(0,d.v0)(k),j=(0,u.ad)(k);!function(e=(0,h.Mq)(),t){e=(0,_.m9)(e);let n=(0,h.qX)(e,V),i=n.getImmediate({identifier:void 0}),s=(0,_.P0)("storage");s&&function(e,t,n,i={}){!function(e,t,n,i={}){e.host=`${t}:${n}`,e._protocol="http";let{mockUserToken:s}=i;s&&(e._overrideAuthToken="string"==typeof s?s:(0,_.Sg)(s,e.app.options.projectId))}(e,t,n,i)}(i,...s)}(k);let getDocsFromQuery=async e=>{let t=await (0,u.PL)(e),n=t.docs.map(e=>{let t={...e.data(),id:e.id};return t});return n},updateDocumentInCollection=async(e,t,n)=>{try{let i=(0,u.JU)(j,e,t);return await (0,u.r7)(i,n),console.log("Document updated with ID: ",t),t}catch(e){return console.error("Error updating document: ",e),null}}},415:function(){},7663:function(e){!function(){var t={229:function(e){var t,n,i,s=e.exports={};function defaultSetTimout(){throw Error("setTimeout has not been defined")}function defaultClearTimeout(){throw Error("clearTimeout has not been defined")}function runTimeout(e){if(t===setTimeout)return setTimeout(e,0);if((t===defaultSetTimout||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){t=defaultSetTimout}try{n="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){n=defaultClearTimeout}}();var o=[],l=!1,u=-1;function cleanUpNextTick(){l&&i&&(l=!1,i.length?o=i.concat(o):u=-1,o.length&&drainQueue())}function drainQueue(){if(!l){var e=runTimeout(cleanUpNextTick);l=!0;for(var t=o.length;t;){for(i=o,o=[];++u<t;)i&&i[u].run();u=-1,t=o.length}i=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===defaultClearTimeout||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function Item(e,t){this.fun=e,this.array=t}function noop(){}s.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];o.push(new Item(e,t)),1!==o.length||l||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=noop,s.addListener=noop,s.once=noop,s.off=noop,s.removeListener=noop,s.removeAllListeners=noop,s.emit=noop,s.prependListener=noop,s.prependOnceListener=noop,s.listeners=function(e){return[]},s.binding=function(e){throw Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw Error("process.chdir is not supported")},s.umask=function(){return 0}}},n={};function __nccwpck_require__(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}},o=!0;try{t[e](s,s.exports,__nccwpck_require__),o=!1}finally{o&&delete n[e]}return s.exports}__nccwpck_require__.ab="//";var i=__nccwpck_require__(229);e.exports=i}()},9008:function(e,t,n){e.exports=n(9201)},4298:function(e,t,n){e.exports=n(5354)},2286:function(e,t,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.destroyCookie=t.setCookie=t.parseCookies=void 0;var s=n(6489),o=n(9328),l=n(1022);function parseCookies(e,t){var n,i;return(null===(i=null===(n=null==e?void 0:e.req)||void 0===n?void 0:n.headers)||void 0===i?void 0:i.cookie)?s.parse(e.req.headers.cookie,t):l.isBrowser()?s.parse(document.cookie,t):{}}function setCookie(e,t,n,u){var h,d;if(void 0===u&&(u={}),(null===(h=null==e?void 0:e.res)||void 0===h?void 0:h.getHeader)&&e.res.setHeader){if(null===(d=null==e?void 0:e.res)||void 0===d?void 0:d.finished)return console.warn('Not setting "'+t+'" cookie. Response has finished.'),console.warn("You should set cookie before res.send()"),{};var _=e.res.getHeader("Set-Cookie")||[];"string"==typeof _&&(_=[_]),"number"==typeof _&&(_=[]);var m=o.parse(_,{decodeValues:!1}),g=l.createCookie(t,n,u),E=[];
247m.forEach(function(e){if(!l.areCookiesEqual(e,g)){var t=s.serialize(e.name,e.value,i({encode:function(e){return e}},e));E.push(t)}}),E.push(s.serialize(t,n,u)),e.res.setHeader("Set-Cookie",E)}if(l.isBrowser()){if(u&&u.httpOnly)throw Error("Can not set a httpOnly cookie in the browser.");document.cookie=s.serialize(t,n,u)}return{}}function destroyCookie(e,t,n){return setCookie(e,t,"",i(i({},n||{}),{maxAge:-1}))}t.parseCookies=parseCookies,t.setCookie=setCookie,t.destroyCookie=destroyCookie,t.default={set:setCookie,get:parseCookies,destroy:destroyCookie}},1022:function(e,t){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};function hasSameProperties(e,t){var n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!==i.length)return!1;for(var s=0;s<n.length;s++){var o=n[s];if(e[o]!==t[o])return!1}return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.areCookiesEqual=t.hasSameProperties=t.createCookie=t.isBrowser=void 0,t.isBrowser=function(){return"undefined"!=typeof window},t.createCookie=function(e,t,i){var s=i.sameSite;!0===s&&(s="strict"),(void 0===s||!1===s)&&(s="lax");var o=n(n({},i),{sameSite:s});return delete o.encode,n({name:e,value:t},o)},t.hasSameProperties=hasSameProperties,t.areCookiesEqual=function(e,t){var i=e.sameSite===t.sameSite;return"string"==typeof e.sameSite&&"string"==typeof t.sameSite&&(i=e.sameSite.toLowerCase()===t.sameSite.toLowerCase()),hasSameProperties(n(n({},e),{sameSite:void 0}),n(n({},t),{sameSite:void 0}))&&i}},9328:function(e){"use strict";var t={decodeValues:!0,map:!1,silent:!1};function isNonEmptyString(e){return"string"==typeof e&&!!e.trim()}function parseString(e,n){var i,s,o,l,u=e.split(";").filter(isNonEmptyString),h=(i=u.shift(),s="",o="",(l=i.split("=")).length>1?(s=l.shift(),o=l.join("=")):o=i,{name:s,value:o}),d=h.name,_=h.value;n=n?Object.assign({},t,n):t;try{_=n.decodeValues?decodeURIComponent(_):_}catch(e){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+_+"'. Set options.decodeValues to false to disable this feature.",e)}var m={name:d,value:_};return u.forEach(function(e){var t=e.split("="),n=t.shift().trimLeft().toLowerCase(),i=t.join("=");"expires"===n?m.expires=new Date(i):"max-age"===n?m.maxAge=parseInt(i,10):"secure"===n?m.secure=!0:"httponly"===n?m.httpOnly=!0:"samesite"===n?m.sameSite=i:m[n]=i}),m}function parse(e,n){if(n=n?Object.assign({},t,n):t,!e)return n.map?{}:[];if(e.headers){if("function"==typeof e.headers.getSetCookie)e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var i=e.headers[Object.keys(e.headers).find(function(e){return"set-cookie"===e.toLowerCase()})];i||!e.headers.cookie||n.silent||console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=i}}return(Array.isArray(e)||(e=[e]),(n=n?Object.assign({},t,n):t).map)?e.filter(isNonEmptyString).reduce(function(e,t){var i=parseString(t,n);return e[i.name]=i,e},{}):e.filter(isNonEmptyString).map(function(e){return parseString(e,n)})}e.exports=parse,e.exports.parse=parse,e.exports.parseString=parseString,e.exports.splitCookiesString=function(e){if(Array.isArray(e))return e;if("string"!=typeof e)return[];var t,n,i,s,o,l=[],u=0;function skipWhitespace(){for(;u<e.length&&/\s/.test(e.charAt(u));)u+=1;return u<e.length}for(;u<e.length;){for(t=u,o=!1;skipWhitespace();)if(","===(n=e.charAt(u))){for(i=u,u+=1,skipWhitespace(),s=u;u<e.length&&"="!==(n=e.charAt(u))&&";"!==n&&","!==n;)u+=1;u<e.length&&"="===e.charAt(u)?(o=!0,u=s,l.push(e.substring(t,i)),t=u):u=i+1}else u+=1;(!o||u>=e.length)&&l.push(e.substring(t,e.length))}return l}},7462:function(e,t,n){"use strict";function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}n.d(t,{Z:function(){return _extends}})},3366:function(e,t,n){"use strict";function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var n,i,s={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(s[n]=e[n]);return s}n.d(t,{Z:function(){return _objectWithoutPropertiesLoose}})},5816:function(e,t,n){"use strict";let i,s;n.d(t,{Jn:function(){return es},qX:function(){return _getProvider},Xd:function(){return _registerComponent},Mq:function(){return getApp},ZF:function(){return initializeApp},KN:function(){return registerVersion}});var o,l=n(8463),u=n(3333),h=n(4444);let instanceOfAny=(e,t)=>t.some(t=>e instanceof t),d=new WeakMap,_=new WeakMap,m=new WeakMap,g=new WeakMap,E=new WeakMap,b={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return _.get(e);if("objectStoreNames"===t)return e.objectStoreNames||m.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return wrap_idb_value_wrap(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function wrap_idb_value_wrap(e){var t;if(e instanceof IDBRequest)return function(e){let t=new Promise((t,n)=>{let unlisten=()=>{e.removeEventListener("success",success),e.removeEventListener("error",error)},success=()=>{t(wrap_idb_value_wrap(e.result)),unlisten()},error=()=>{n(e.error),unlisten()};e.addEventListener("success",success),e.addEventListener("error",error)});return t.then(t=>{t instanceof IDBCursor&&d.set(t,e)}).catch(()=>{}),E.set(t,e),t}(e);if(g.has(e))return g.get(e);let n="function"==typeof(t=e)?t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(unwrap(this),e),wrap_idb_value_wrap(d.get(this))}:function(...e){return wrap_idb_value_wrap(t.apply(unwrap(this),e))}:function(e,...n){let i=t.call(unwrap(this),e,...n);return m.set(i,e.sort?e.sort():[e]),wrap_idb_value_wrap(i)}:(t instanceof IDBTransaction&&function(e){if(_.has(e))return;let t=new Promise((t,n)=>{let unlisten=()=>{e.removeEventListener("complete",complete),e.removeEventListener("error",error),e.removeEventListener("abort",error)},complete=()=>{t(),unlisten()},error=()=>{n(e.error||new DOMException("AbortError","AbortError")),unlisten()};e.addEventListener("complete",complete),e.addEventListener("error",error),e.addEventListener("abort",error)});_.set(e,t)}(t),instanceOfAny(t,i||(i=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(t,b):t;
247return n!==e&&(g.set(e,n),E.set(n,e)),n}let unwrap=e=>E.get(e),V=["get","getKey","getAll","getAllKeys","count"],k=["put","add","delete","clear"],L=new Map;function getMethod(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(L.get(t))return L.get(t);let n=t.replace(/FromIndex$/,""),i=t!==n,s=k.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!(s||V.includes(n)))return;let method=async function(e,...t){let o=this.transaction(e,s?"readwrite":"readonly"),l=o.store;return i&&(l=l.index(t.shift())),(await Promise.all([l[n](...t),s&&o.done]))[0]};return L.set(t,method),method}b={...o=b,get:(e,t,n)=>getMethod(e,t)||o.get(e,t,n),has:(e,t)=>!!getMethod(e,t)||o.has(e,t)};/** 248 * @license 249 * Copyright 2019 Google LLC 250 * 251 * Licensed under the Apache License, Version 2.0 (the "License"); 252 * you may not use this file except in compliance with the License. 253 * You may obtain a copy of the License at 254 * 255 * http://www.apache.org/licenses/LICENSE-2.0 256 * 257 * Unless required by applicable law or agreed to in writing, software 258 * distributed under the License is distributed on an "AS IS" BASIS, 259 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 260 * See the License for the specific language governing permissions and 261 * limitations under the License. 262 */let PlatformLoggerServiceImpl=class PlatformLoggerServiceImpl{constructor(e){this.container=e}getPlatformInfoString(){let e=this.container.getProviders();return e.map(e=>{if(!function(e){let t=e.getComponent();return(null==t?void 0:t.type)==="VERSION"}(e))return null;{let t=e.getImmediate();return`${t.library}/${t.version}`}}).filter(e=>e).join(" ")}};let j="@firebase/app",$="0.9.20",z=new u.Yd("@firebase/app"),ee="[DEFAULT]",et={[j]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},er=new Map,en=new Map;function _registerComponent(e){let t=e.name;if(en.has(t))return z.debug(`There were multiple attempts to register component ${t}.`),!1;for(let n of(en.set(t,e),er.values()))!function(e,t){try{e.container.addComponent(t)}catch(n){z.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}(n,e);return!0}function _getProvider(e,t){let n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}let ei=new h.LL("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invali
262d-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});/** 263 * @license 264 * Copyright 2019 Google LLC 265 * 266 * Licensed under the Apache License, Version 2.0 (the "License"); 267 * you may not use this file except in compliance with the License. 268 * You may obtain a copy of the License at 269 * 270 * http://www.apache.org/licenses/LICENSE-2.0 271 * 272 * Unless required by applicable law or agreed to in writing, software 273 * distributed under the License is distributed on an "AS IS" BASIS, 274 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 275 * See the License for the specific language governing permissions and 276 * limitations under the License. 277 */let FirebaseAppImpl=class FirebaseAppImpl{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new l.wA("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw ei.create("app-deleted",{appName:this._name})}};/** 278 * @license 279 * Copyright 2019 Google LLC 280 * 281 * Licensed under the Apache License, Version 2.0 (the "License"); 282 * you may not use this file except in compliance with the License. 283 * You may obtain a copy of the License at 284 * 285 * http://www.apache.org/licenses/LICENSE-2.0 286 * 287 * Unless required by applicable law or agreed to in writing, software 288 * distributed under the License is distributed on an "AS IS" BASIS, 289 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 290 * See the License for the specific language governing permissions and 291 * limitations under the License. 292 */let es="10.5.0";function initializeApp(e,t={}){let n=e;if("object"!=typeof t){let e=t;t={name:e}}let i=Object.assign({name:ee,automaticDataCollectionEnabled:!1},t),s=i.name;if("string"!=typeof s||!s)throw ei.create("bad-app-name",{appName:String(s)});if(n||(n=(0,h.aH)()),!n)throw ei.create("no-options");let o=er.get(s);if(o){if((0,h.vZ)(n,o.options)&&(0,h.vZ)(i,o.config))return o;throw ei.create("duplicate-app",{appName:s})}let u=new l.H0(s);for(let e of en.values())u.addComponent(e);let d=new FirebaseAppImpl(n,i,u);return er.set(s,d),d}function getApp(e=ee){let t=er.get(e);if(!t&&e===ee&&(0,h.aH)())return initializeApp();if(!t)throw ei.create("no-app",{appName:e});return t}function registerVersion(e,t,n){var i;let s=null!==(i=et[e])&&void 0!==i?i:e;n&&(s+=`-${n}`);let o=s.match(/\s|\//),u=t.match(/\s|\//);if(o||u){let e=[`Unable to register library "${s}" with version "${t}":`];o&&e.push(`library name "${s}" contains illegal characters (whitespace or "/")`),o&&u&&e.push("and"),u&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),z.warn(e.join(" "));return}_registerComponent(new l.wA(`${s}-version`,()=>({library:s,version:t}),"VERSION"))}let eo="firebase-heartbeat-store",el=null;function getDbPromise(){return el||(el=(function(e,t,{blocked:n,upgrade:i,blocking:s,terminated:o}={}){let l=indexedDB.open(e,1),u=wrap_idb_value_wrap(l);return i&&l.addEventListener("upgradeneeded",e=>{i(wrap_idb_value_wrap(l.result),e.oldVersion,e.newVersion,wrap_idb_value_wrap(l.transaction),e)}),n&&l.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),u.then(e=>{o&&e.addEventListener("close",()=>o()),s&&e.addEventListener("versionchange",e=>s(e.oldVersion,e.newVersion,e))}).catch(()=>{}),u})("firebase-heartbeat-database",0,{upgrade:(e,t)=>{0===t&&e.createObjectStore(eo)}}).catch(e=>{throw ei.create("idb-open",{originalErrorMessage:e.message})})),el}async function readHeartbeatsFromIndexedDB(e){try{let t=await getDbPromise(),n=await t.transaction(eo).objectStore(eo).get(computeKey(e));return n}catch(e){if(e instanceof h.ZR)z.warn(e.message);else{let t=ei.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});z.warn(t.message)}}}async function writeHeartbeatsToIndexedDB(e,t){try{let n=await getDbPromise(),i=n.transaction(eo,"readwrite"),s=i.objectStore(eo);await s.put(t,computeKey(e)),await i.done}catch(e){if(e instanceof h.ZR)z.warn(e.message);else{let t=ei.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});z.warn(t.message)}}}function computeKey(e){return`${e.name}!${e.options.appId}`}let HeartbeatServiceImpl=class HeartbeatServiceImpl{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new HeartbeatStorageImpl(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){let e=this.container.getProvider("platform-logger").getImmediate(),t=e.getPlatformInfoString(),n=getUTCDateString();return(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate===n||this._heartbeatsCache.heartbeats.some(e=>e.date===n))?void 0:(this._heartbeatsCache.heartbeats.push({date:n,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>{let t=new Date(e.date).valueOf(),n=Date.now();return n-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache))}
292async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";let e=getUTCDateString(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){let n=[],i=e.slice();for(let s of e){let e=n.find(e=>e.agent===s.agent);if(e){if(e.dates.push(s.date),countBytes(n)>t){e.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),countBytes(n)>t){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),i=(0,h.L)(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}};function getUTCDateString(){let e=new Date;return e.toISOString().substring(0,10)}let HeartbeatStorageImpl=class HeartbeatStorageImpl{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,h.hl)()&&(0,h.eu)().then(()=>!0).catch(()=>!1)}async read(){let e=await this._canUseIndexedDBPromise;if(!e)return{heartbeats:[]};{let e=await readHeartbeatsFromIndexedDB(this.app);return e||{heartbeats:[]}}}async overwrite(e){var t;let n=await this._canUseIndexedDBPromise;if(n){let n=await this.read();return writeHeartbeatsToIndexedDB(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;let n=await this._canUseIndexedDBPromise;if(n){let n=await this.read();return writeHeartbeatsToIndexedDB(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}};function countBytes(e){return(0,h.L)(JSON.stringify({version:2,heartbeats:e})).length}_registerComponent(new l.wA("platform-logger",e=>new PlatformLoggerServiceImpl(e),"PRIVATE")),_registerComponent(new l.wA("heartbeat",e=>new HeartbeatServiceImpl(e),"PRIVATE")),registerVersion(j,$,""),registerVersion(j,$,"esm2017"),registerVersion("fire-js","")},8463:function(e,t,n){"use strict";n.d(t,{H0:function(){return ComponentContainer},wA:function(){return Component}});var i=n(4444);let Component=class Component{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};/** 293 * @license 294 * Copyright 2019 Google LLC 295 * 296 * Licensed under the Apache License, Version 2.0 (the "License"); 297 * you may not use this file except in compliance with the License. 298 * You may obtain a copy of the License at 299 * 300 * http://www.apache.org/licenses/LICENSE-2.0 301 * 302 * Unless required by applicable law or agreed to in writing, software 303 * distributed under the License is distributed on an "AS IS" BASIS, 304 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 305 * See the License for the specific language governing permissions and 306 * limitations under the License. 307 */let s="[DEFAULT]";/** 308 * @license 309 * Copyright 2019 Google LLC 310 * 311 * Licensed under the Apache License, Version 2.0 (the "License"); 312 * you may not use this file except in compliance with the License. 313 * You may obtain a copy of the License at 314 * 315 * http://www.apache.org/licenses/LICENSE-2.0 316 * 317 * Unless required by applicable law or agreed to in writing, software 318 * distributed under the License is distributed on an "AS IS" BASIS, 319 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 320 * See the License for the specific language governing permissions and 321 * limitations under the License. 322 */let Provider=class Provider{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let e=new i.BH;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;let n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),i=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(i)return null;throw e}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:s})}catch(e){}for(let[e,t]of this.instancesDeferred.entries()){let n=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=s){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=s){return this.instances.has(e)}getOptions(e=s){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:n,options:t});for(let[e,t]of this.instancesDeferred.entries()){let s=this.normalizeInstanceIdentifier(e);n===s&&t.resolve(i)}return i}onInit(e,t){var n;let i=this.normalizeInstanceIdentifier(t),s=null!==(n=this.onInitCallbacks.get(i))&&void 0!==n?n:new Set;s.add(e),this.onInitCallbacks.set(i,s);let o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){let n=this.onInitCallbacks.get(t);if(n)for(let i of n)try{i(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:e===s?void 0:e,options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}return n||null}normalizeInstanceIdentifier(e=s){return this.component?this.component.multipleInstances?e:s:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}};/** 323 * @license 324 * Copyright 2019 Google LLC 325 * 326 * Licensed under the Apache License, Version 2.0 (the "License");
327 * you may not use this file except in compliance with the License. 328 * You may obtain a copy of the License at 329 * 330 * http://www.apache.org/licenses/LICENSE-2.0 331 * 332 * Unless required by applicable law or agreed to in writing, software 333 * distributed under the License is distributed on an "AS IS" BASIS, 334 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 335 * See the License for the specific language governing permissions and 336 * limitations under the License. 337 */let ComponentContainer=class ComponentContainer{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){let t=this.getProvider(e.name);t.isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new Provider(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}},3333:function(e,t,n){"use strict";var i,s;n.d(t,{Yd:function(){return Logger},in:function(){return i}});/** 338 * @license 339 * Copyright 2017 Google LLC 340 * 341 * Licensed under the Apache License, Version 2.0 (the "License"); 342 * you may not use this file except in compliance with the License. 343 * You may obtain a copy of the License at 344 * 345 * http://www.apache.org/licenses/LICENSE-2.0 346 * 347 * Unless required by applicable law or agreed to in writing, software 348 * distributed under the License is distributed on an "AS IS" BASIS, 349 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 350 * See the License for the specific language governing permissions and 351 * limitations under the License. 352 */let o=[];(s=i||(i={}))[s.DEBUG=0]="DEBUG",s[s.VERBOSE=1]="VERBOSE",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.SILENT=5]="SILENT";let l={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.SILENT},u=i.INFO,h={[i.DEBUG]:"log",[i.VERBOSE]:"log",[i.INFO]:"info",[i.WARN]:"warn",[i.ERROR]:"error"},defaultLogHandler=(e,t,...n)=>{if(t<e.logLevel)return;let i=new Date().toISOString(),s=h[t];if(s)console[s](`[${i}] ${e.name}:`,...n);else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};let Logger=class Logger{constructor(e){this.name=e,this._logLevel=u,this._logHandler=defaultLogHandler,this._userLogHandler=null,o.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in i))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?l[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,i.DEBUG,...e),this._logHandler(this,i.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,i.VERBOSE,...e),this._logHandler(this,i.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,i.INFO,...e),this._logHandler(this,i.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,i.WARN,...e),this._logHandler(this,i.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,i.ERROR,...e),this._logHandler(this,i.ERROR,...e)}}},4556:function(e,t,n){"use strict";n.d(t,{a$:function(){return V},Xb:function(){return createUserWithEmailAndPassword},v0:function(){return getAuth},Aj:function(){return onAuthStateChanged},w$:function(){return sendEmailVerification},LS:function(){return sendPasswordResetEmail},Fb:function(){return setPersistence},e5:function(){return signInWithEmailAndPassword},w7:function(){return signOut}});var i,s=n(4444),o=n(5816),l=n(3333);function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)0>t.indexOf(i[s])&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]]);return n}var u=n(8463);function isEnterprise(e){return void 0!==e&&void 0!==e.enterprise}let RecaptchaConfig=class RecaptchaConfig{constructor(e){if(this.siteKey="",this.emailPasswordEnabled=!1,void 0===e.recaptchaKey)throw Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.emailPasswordEnabled=e.recaptchaEnforcementState.some(e=>"EMAIL_PASSWORD_PROVIDER"===e.provider&&"OFF"!==e.enforcementState)}};function _prodErrorMap(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}let h=new s.LL("auth","Firebase",_prodErrorMap()),d=new l.Yd("@firebase/auth");function _logError(e,...t){d.logLevel<=l.in.ERROR&&d.error(`Auth (${o.Jn}): ${e}`,...t)}/** 353 * @license 354 * Copyright 2020 Google LLC 355 * 356 * Licensed under the Apache License, Version 2.0 (the "License");
357 * you may not use this file except in compliance with the License. 358 * You may obtain a copy of the License at 359 * 360 * http://www.apache.org/licenses/LICENSE-2.0 361 * 362 * Unless required by applicable law or agreed to in writing, software 363 * distributed under the License is distributed on an "AS IS" BASIS, 364 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 365 * See the License for the specific language governing permissions and 366 * limitations under the License. 367 */function _fail(e,...t){throw createErrorInternal(e,...t)}function _createError(e,...t){return createErrorInternal(e,...t)}function createErrorInternal(e,...t){if("string"!=typeof e){let n=t[0],i=[...t.slice(1)];return i[0]&&(i[0].appName=e.name),e._errorFactory.create(n,...i)}return h.create(e,...t)}function _assert(e,t,...n){if(!e)throw createErrorInternal(t,...n)}function debugFail(e){let t="INTERNAL ASSERTION FAILED: "+e;throw _logError(t),Error(t)}/** 368 * @license 369 * Copyright 2020 Google LLC 370 * 371 * Licensed under the Apache License, Version 2.0 (the "License"); 372 * you may not use this file except in compliance with the License. 373 * You may obtain a copy of the License at 374 * 375 * http://www.apache.org/licenses/LICENSE-2.0 376 * 377 * Unless required by applicable law or agreed to in writing, software 378 * distributed under the License is distributed on an "AS IS" BASIS, 379 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 380 * See the License for the specific language governing permissions and 381 * limitations under the License. 382 */function _getCurrentUrl(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function _getCurrentScheme(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}/** 383 * @license 384 * Copyright 2020 Google LLC 385 * 386 * Licensed under the Apache License, Version 2.0 (the "License"); 387 * you may not use this file except in compliance with the License. 388 * You may obtain a copy of the License at 389 * 390 * http://www.apache.org/licenses/LICENSE-2.0 391 * 392 * Unless required by applicable law or agreed to in writing, software 393 * distributed under the License is distributed on an "AS IS" BASIS, 394 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 395 * See the License for the specific language governing permissions and 396 * limitations under the License. 397 */let Delay=class Delay{constructor(e,t){this.shortDelay=e,this.longDelay=t,t>e||debugFail("Short delay should be less than long delay!"),this.isMobile=(0,s.uI)()||(0,s.b$)()}get(){return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&("http:"===_getCurrentScheme()||"https:"===_getCurrentScheme()||(0,s.ru)()||"connection"in navigator))||navigator.onLine?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};/** 398 * @license 399 * Copyright 2020 Google LLC 400 * 401 * Licensed under the Apache License, Version 2.0 (the "License"); 402 * you may not use this file except in compliance with the License. 403 * You may obtain a copy of the License at 404 * 405 * http://www.apache.org/licenses/LICENSE-2.0 406 * 407 * Unless required by applicable law or agreed to in writing, software 408 * distributed under the License is distributed on an "AS IS" BASIS, 409 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 410 * See the License for the specific language governing permissions and 411 * limitations under the License. 412 */function _emulatorUrl(e,t){e.emulator||debugFail("Emulator should always be set here");let{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/** 413 * @license 414 * Copyright 2020 Google LLC 415 * 416 * Licensed under the Apache License, Version 2.0 (the "License"); 417 * you may not use this file except in compliance with the License. 418 * You may obtain a copy of the License at 419 * 420 * http://www.apache.org/licenses/LICENSE-2.0 421 * 422 * Unless required by applicable law or agreed to in writing, software 423 * distributed under the License is distributed on an "AS IS" BASIS, 424 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 425 * See the License for the specific language governing permissions and 426 * limitations under the License.
427 */let FetchProvider=class FetchProvider{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void debugFail("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void debugFail("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void debugFail("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};/** 428 * @license 429 * Copyright 2020 Google LLC 430 * 431 * Licensed under the Apache License, Version 2.0 (the "License"); 432 * you may not use this file except in compliance with the License. 433 * You may obtain a copy of the License at 434 * 435 * http://www.apache.org/licenses/LICENSE-2.0 436 * 437 * Unless required by applicable law or agreed to in writing, software 438 * distributed under the License is distributed on an "AS IS" BASIS, 439 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 440 * See the License for the specific language governing permissions and 441 * limitations under the License. 442 */let _={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",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_REQ_TYPE:"internal-error",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",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",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",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_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},m=new Delay(3e4,6e4);function _addTidIfNecessary(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function _performApiRequest(e,t,n,i,o={}){return _performFetchWithErrorHandling(e,o,async()=>{let o={},l={};i&&("GET"===t?l=i:o={body:JSON.stringify(i)});let u=(0,s.xO)(Object.assign({key:e.config.apiKey},l)).slice(1),h=await e._getAdditionalHeaders();return h["Content-Type"]="application/json",e.languageCode&&(h["X-Firebase-Locale"]=e.languageCode),FetchProvi
442der.fetch()(_getFinalTarget(e,e.config.apiHost,n,u),Object.assign({method:t,headers:h,referrerPolicy:"no-referrer"},o))})}async function _performFetchWithErrorHandling(e,t,n){e._canInitEmulator=!1;let i=Object.assign(Object.assign({},_),t);try{let t=new NetworkTimeout(e),o=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();let l=await o.json();if("needConfirmation"in l)throw _makeTaggedError(e,"account-exists-with-different-credential",l);if(o.ok&&!("errorMessage"in l))return l;{let t=o.ok?l.errorMessage:l.error.message,[n,u]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw _makeTaggedError(e,"credential-already-in-use",l);if("EMAIL_EXISTS"===n)throw _makeTaggedError(e,"email-already-in-use",l);if("USER_DISABLED"===n)throw _makeTaggedError(e,"user-disabled",l);let h=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw function(e,t,n){let i=Object.assign(Object.assign({},_prodErrorMap()),{[t]:n}),o=new s.LL("auth","Firebase",i);return o.create(t,{appName:e.name})}(e,h,u);_fail(e,h)}}catch(t){if(t instanceof s.ZR)throw t;_fail(e,"network-request-failed",{message:String(t)})}}async function _performSignInRequest(e,t,n,i,s={}){let o=await _performApiRequest(e,t,n,i,s);return"mfaPendingCredential"in o&&_fail(e,"multi-factor-auth-required",{_serverResponse:o}),o}function _getFinalTarget(e,t,n,i){let s=`${t}${n}?${i}`;return e.config.emulator?_emulatorUrl(e.config,s):`${e.config.apiScheme}://${s}`}let NetworkTimeout=class NetworkTimeout{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(_createError(this.auth,"network-request-failed")),m.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}};function _makeTaggedError(e,t,n){let i={appName:e.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);let s=_createError(e,t,i);return s.customData._tokenResponse=n,s}async function getRecaptchaConfig(e,t){return _performApiRequest(e,"GET","/v2/recaptchaConfig",_addTidIfNecessary(e,t))}/** 443 * @license 444 * Copyright 2020 Google LLC 445 * 446 * Licensed under the Apache License, Version 2.0 (the "License"); 447 * you may not use this file except in compliance with the License. 448 * You may obtain a copy of the License at 449 * 450 * http://www.apache.org/licenses/LICENSE-2.0 451 * 452 * Unless required by applicable law or agreed to in writing, software 453 * distributed under the License is distributed on an "AS IS" BASIS, 454 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 455 * See the License for the specific language governing permissions and 456 * limitations under the License. 457 */async function deleteAccount(e,t){return _performApiRequest(e,"POST","/v1/accounts:delete",t)}async function getAccountInfo(e,t){return _performApiRequest(e,"POST","/v1/accounts:lookup",t)}/** 458 * @license 459 * Copyright 2020 Google LLC 460 * 461 * Licensed under the Apache License, Version 2.0 (the "License"); 462 * you may not use this file except in compliance with the License. 463 * You may obtain a copy of the License at 464 * 465 * http://www.apache.org/licenses/LICENSE-2.0 466 * 467 * Unless required by applicable law or agreed to in writing, software 468 * distributed under the License is distributed on an "AS IS" BASIS, 469 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 470 * See the License for the specific language governing permissions and 471 * limitations under the License. 472 */function utcTimestampToDateString(e){if(e)try{let t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}async function getIdTokenResult(e,t=!1){let n=(0,s.m9)(e),i=await n.getIdToken(t),o=_parseToken(i);_assert(o&&o.exp&&o.auth_time&&o.iat,n.auth,"internal-error");let l="object"==typeof o.firebase?o.firebase:void 0,u=null==l?void 0:l.sign_in_provider;return{claims:o,token:i,authTime:utcTimestampToDateString(secondsStringToMilliseconds(o.auth_time)),issuedAtTime:utcTimestampToDateString(secondsStringToMilliseconds(o.iat)),expirationTime:utcTimestampToDateString(secondsStringToMilliseconds(o.exp)),signInProvider:u||null,signInSecondFactor:(null==l?void 0:l.sign_in_second_factor)||null}}function secondsStringToMilliseconds(e){return 1e3*Number(e)}function _parseToken(e){let[t,n,i]=e.split(".");if(void 0===t||void 0===n||void 0===i)return _logError("JWT malformed, contained fewer than 3 sections"),null;try{let e=(0,s.tV)(n);if(!e)return _logError("Failed to decode base64 JWT payload"),null;return JSON.parse(e)}catch(e){return _logError("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}/** 473 * @license 474 * Copyright 2020 Google LLC 475 * 476 * Licensed under the Apache License, Version 2.0 (the "License");
477 * you may not use this file except in compliance with the License. 478 * You may obtain a copy of the License at 479 * 480 * http://www.apache.org/licenses/LICENSE-2.0 481 * 482 * Unless required by applicable law or agreed to in writing, software 483 * distributed under the License is distributed on an "AS IS" BASIS, 484 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 485 * See the License for the specific language governing permissions and 486 * limitations under the License. 487 */async function _logoutIfInvalidated(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof s.ZR&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}/** 488 * @license 489 * Copyright 2020 Google LLC 490 * 491 * Licensed under the Apache License, Version 2.0 (the "License"); 492 * you may not use this file except in compliance with the License. 493 * You may obtain a copy of the License at 494 * 495 * http://www.apache.org/licenses/LICENSE-2.0 496 * 497 * Unless required by applicable law or agreed to in writing, software 498 * distributed under the License is distributed on an "AS IS" BASIS, 499 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 500 * See the License for the specific language governing permissions and 501 * limitations under the License. 502 */let ProactiveRefresh=class ProactiveRefresh{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){let e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;let e=null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0,n=e-Date.now()-3e5;return Math.max(0,n)}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(null==e?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};/** 503 * @license 504 * Copyright 2020 Google LLC 505 * 506 * Licensed under the Apache License, Version 2.0 (the "License"); 507 * you may not use this file except in compliance with the License. 508 * You may obtain a copy of the License at 509 * 510 * http://www.apache.org/licenses/LICENSE-2.0 511 * 512 * Unless required by applicable law or agreed to in writing, software 513 * distributed under the License is distributed on an "AS IS" BASIS, 514 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 515 * See the License for the specific language governing permissions and 516 * limitations under the License. 517 */let UserMetadata=class UserMetadata{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=utcTimestampToDateString(this.lastLoginAt),this.creationTime=utcTimestampToDateString(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};/** 518 * @license 519 * Copyright 2019 Google LLC 520 * 521 * Licensed under the Apache License, Version 2.0 (the "License"); 522 * you may not use this file except in compliance with the License. 523 * You may obtain a copy of the License at 524 * 525 * http://www.apache.org/licenses/LICENSE-2.0 526 * 527 * Unless required by applicable law or agreed to in writing, software 528 * distributed under the License is distributed on an "AS IS" BASIS, 529 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 530 * See the License for the specific language governing permissions and 531 * limitations under the License. 532 */async function _reloadWithoutSaving(e){var t;let n=e.auth,i=await e.getIdToken(),s=await _logoutIfInvalidated(e,getAccountInfo(n,{idToken:i}));_assert(null==s?void 0:s.users.length,n,"internal-error");let o=s.users[0];e._notifyReloadListener(o);let l=(null===(t=o.providerUserInfo)||void 0===t?void 0:t.length)?o.providerUserInfo.map(e=>{var{providerId:t}=e,n=__rest(e,["providerId"]);
532return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}):[],u=function(e,t){let n=e.filter(e=>!t.some(t=>t.providerId===e.providerId));return[...n,...t]}(e.providerData,l),h=e.isAnonymous,d=!(e.email&&o.passwordHash)&&!(null==u?void 0:u.length),_={uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:u,metadata:new UserMetadata(o.createdAt,o.lastLoginAt),isAnonymous:!!h&&d};Object.assign(e,_)}async function reload(e){let t=(0,s.m9)(e);await _reloadWithoutSaving(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}/** 533 * @license 534 * Copyright 2020 Google LLC 535 * 536 * Licensed under the Apache License, Version 2.0 (the "License"); 537 * you may not use this file except in compliance with the License. 538 * You may obtain a copy of the License at 539 * 540 * http://www.apache.org/licenses/LICENSE-2.0 541 * 542 * Unless required by applicable law or agreed to in writing, software 543 * distributed under the License is distributed on an "AS IS" BASIS, 544 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 545 * See the License for the specific language governing permissions and 546 * limitations under the License. 547 */async function requestStsToken(e,t){let n=await _performFetchWithErrorHandling(e,{},async()=>{let n=(0,s.xO)({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:o}=e.config,l=_getFinalTarget(e,i,"/v1/token",`key=${o}`),u=await e._getAdditionalHeaders();return u["Content-Type"]="application/x-www-form-urlencoded",FetchProvider.fetch()(l,{method:"POST",headers:u,body:n})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}/** 548 * @license 549 * Copyright 2020 Google LLC 550 * 551 * Licensed under the Apache License, Version 2.0 (the "License"); 552 * you may not use this file except in compliance with the License. 553 * You may obtain a copy of the License at 554 * 555 * http://www.apache.org/licenses/LICENSE-2.0 556 * 557 * Unless required by applicable law or agreed to in writing, software 558 * distributed under the License is distributed on an "AS IS" BASIS, 559 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 560 * See the License for the specific language governing permissions and 561 * limitations under the License. 562 */let StsTokenManager=class StsTokenManager{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){_assert(e.idToken,"internal-error"),_assert(void 0!==e.idToken,"internal-error"),_assert(void 0!==e.refreshToken,"internal-error");let t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):function(e){let t=_parseToken(e);return _assert(t,"internal-error"),_assert(void 0!==t.exp,"internal-error"),_assert(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return(_assert(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired)?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:n,refreshToken:i,expiresIn:s}=await requestStsToken(e,t);this.updateTokensAndExpiration(n,i,Number(s))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){let{refreshToken:n,accessToken:i,expirationTime:s}=t,o=new StsTokenManager;return n&&(_assert("string"==typeof n,"internal-error",{appName:e}),o.refreshToken=n),i&&(_assert("string"==typeof i,"internal-error",{appName:e}),o.accessToken=i),s&&(_assert("number"==typeof s,"internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new StsTokenManager,this.toJSON())}_performRefresh(){return debugFail("not implemented")}};/** 563 * @license 564 * Copyright 2020 Google LLC 565 * 566 * Licensed under the Apache License, Version 2.0 (the "License");
567 * you may not use this file except in compliance with the License. 568 * You may obtain a copy of the License at 569 * 570 * http://www.apache.org/licenses/LICENSE-2.0 571 * 572 * Unless required by applicable law or agreed to in writing, software 573 * distributed under the License is distributed on an "AS IS" BASIS, 574 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 575 * See the License for the specific language governing permissions and 576 * limitations under the License. 577 */function assertStringOrUndefined(e,t){_assert("string"==typeof e||void 0===e,"internal-error",{appName:t})}let UserImpl=class UserImpl{constructor(e){var{uid:t,auth:n,stsTokenManager:i}=e,s=__rest(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ProactiveRefresh(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new UserMetadata(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){let t=await _logoutIfInvalidated(this,this.stsTokenManager.getToken(this.auth,e));return _assert(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return getIdTokenResult(this,e)}reload(){return reload(this)}_assign(e){this!==e&&(_assert(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new UserImpl(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){_assert(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await _reloadWithoutSaving(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){let e=await this.getIdToken();return await _logoutIfInvalidated(this,deleteAccount(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var n,i,s,o,l,u,h,d;let _=null!==(n=t.displayName)&&void 0!==n?n:void 0,m=null!==(i=t.email)&&void 0!==i?i:void 0,g=null!==(s=t.phoneNumber)&&void 0!==s?s:void 0,E=null!==(o=t.photoURL)&&void 0!==o?o:void 0,b=null!==(l=t.tenantId)&&void 0!==l?l:void 0,V=null!==(u=t._redirectEventId)&&void 0!==u?u:void 0,k=null!==(h=t.createdAt)&&void 0!==h?h:void 0,L=null!==(d=t.lastLoginAt)&&void 0!==d?d:void 0,{uid:j,emailVerified:$,isAnonymous:z,providerData:ee,stsTokenManager:et}=t;_assert(j&&et,e,"internal-error");let er=StsTokenManager.fromJSON(this.name,et);_assert("string"==typeof j,e,"internal-error"),assertStringOrUndefined(_,e.name),assertStringOrUndefined(m,e.name),_assert("boolean"==typeof $,e,"internal-error"),_assert("boolean"==typeof z,e,"internal-error"),assertStringOrUndefined(g,e.name),assertStringOrUndefined(E,e.name),assertStringOrUndefined(b,e.name),assertStringOrUndefined(V,e.name),assertStringOrUndefined(k,e.name),assertStringOrUndefined(L,e.name);let en=new UserImpl({uid:j,auth:e,email:m,emailVerified:$,displayName:_,isAnonymous:z,photoURL:E,phoneNumber:g,tenantId:b,stsTokenManager:er,createdAt:k,lastLoginAt:L});return ee&&Array.isArray(ee)&&(en.providerData=ee.map(e=>Object.assign({},e))),V&&(en._redirectEventId=V),en}static async _fromIdTokenResponse(e,t,n=!1){let i=new StsTokenManager;i.updateFromServerResponse(t);let s=new UserImpl({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:n});return await _reloadWithoutSaving(s),s}};/** 578 * @license 579 * Copyright 2020 Google LLC 580 * 581 * Licensed under the Apache License, Version 2.0 (the "License");
582 * you may not use this file except in compliance with the License. 583 * You may obtain a copy of the License at 584 * 585 * http://www.apache.org/licenses/LICENSE-2.0 586 * 587 * Unless required by applicable law or agreed to in writing, software 588 * distributed under the License is distributed on an "AS IS" BASIS, 589 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 590 * See the License for the specific language governing permissions and 591 * limitations under the License. 592 */let g=new Map;function _getInstance(e){e instanceof Function||debugFail("Expected a class definition");let t=g.get(e);return t?t instanceof e||debugFail("Instance stored in cache mismatched with class"):(t=new e,g.set(e,t)),t}/** 593 * @license 594 * Copyright 2019 Google LLC 595 * 596 * Licensed under the Apache License, Version 2.0 (the "License"); 597 * you may not use this file except in compliance with the License. 598 * You may obtain a copy of the License at 599 * 600 * http://www.apache.org/licenses/LICENSE-2.0 601 * 602 * Unless required by applicable law or agreed to in writing, software 603 * distributed under the License is distributed on an "AS IS" BASIS, 604 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 605 * See the License for the specific language governing permissions and 606 * limitations under the License. 607 */let InMemoryPersistence=class InMemoryPersistence{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}};/** 608 * @license 609 * Copyright 2019 Google LLC 610 * 611 * Licensed under the Apache License, Version 2.0 (the "License"); 612 * you may not use this file except in compliance with the License. 613 * You may obtain a copy of the License at 614 * 615 * http://www.apache.org/licenses/LICENSE-2.0 616 * 617 * Unless required by applicable law or agreed to in writing, software 618 * distributed under the License is distributed on an "AS IS" BASIS, 619 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 620 * See the License for the specific language governing permissions and 621 * limitations under the License. 622 */function _persistenceKeyName(e,t,n){return`firebase:${e}:${t}:${n}`}InMemoryPersistence.type="NONE";let PersistenceUserManager=class PersistenceUserManager{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;let{config:i,name:s}=this.auth;this.fullUserKey=_persistenceKeyName(this.userKey,i.apiKey,s),this.fullPersistenceKey=_persistenceKeyName("persistence",i.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?UserImpl._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new PersistenceUserManager(_getInstance(InMemoryPersistence),e,n);let i=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e),s=i[0]||_getInstance(InMemoryPersistence),o=_persistenceKeyName(n,e.config.apiKey,e.name),l=null;for(let n of t)try{let t=await n._get(o);if(t){let i=UserImpl._fromJSON(e,t);n!==s&&(l=i),s=n;break}}catch(e){}let u=i.filter(e=>e._shouldAllowMigration);return s._shouldAllowMigration&&u.length&&(s=u[0],l&&await s._set(o,l.toJSON()),await Promise.all(t.map(async e=>{if(e!==s)try{await e._remove(o)}catch(e){}}))),new PersistenceUserManager(s,e,n)}};/** 623 * @license 624 * Copyright 2020 Google LLC 625 * 626 * Licensed under the Apache License, Version 2.0 (the "License");
627 * you may not use this file except in compliance with the License. 628 * You may obtain a copy of the License at 629 * 630 * http://www.apache.org/licenses/LICENSE-2.0 631 * 632 * Unless required by applicable law or agreed to in writing, software 633 * distributed under the License is distributed on an "AS IS" BASIS, 634 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 635 * See the License for the specific language governing permissions and 636 * limitations under the License. 637 */function _getBrowserName(e){let t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(_isIEMobile(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";{if(t.includes("edge/"))return"Edge";if(_isFirefox(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(_isBlackBerry(t))return"Blackberry";if(_isWebOS(t))return"Webos";if(_isSafari(t))return"Safari";if((t.includes("chrome/")||_isChromeIOS(t))&&!t.includes("edge/"))return"Chrome";if(_isAndroid(t))return"Android";let n=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);if((null==n?void 0:n.length)===2)return n[1]}return"Other"}function _isFirefox(e=(0,s.z$)()){return/firefox\//i.test(e)}function _isSafari(e=(0,s.z$)()){let t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function _isChromeIOS(e=(0,s.z$)()){return/crios\//i.test(e)}function _isIEMobile(e=(0,s.z$)()){return/iemobile/i.test(e)}function _isAndroid(e=(0,s.z$)()){return/android/i.test(e)}function _isBlackBerry(e=(0,s.z$)()){return/blackberry/i.test(e)}function _isWebOS(e=(0,s.z$)()){return/webos/i.test(e)}function _isIOS(e=(0,s.z$)()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function _isMobileBrowser(e=(0,s.z$)()){return _isIOS(e)||_isAndroid(e)||_isWebOS(e)||_isBlackBerry(e)||/windows phone/i.test(e)||_isIEMobile(e)}/** 638 * @license 639 * Copyright 2020 Google LLC 640 * 641 * Licensed under the Apache License, Version 2.0 (the "License"); 642 * you may not use this file except in compliance with the License. 643 * You may obtain a copy of the License at 644 * 645 * http://www.apache.org/licenses/LICENSE-2.0 646 * 647 * Unless required by applicable law or agreed to in writing, software 648 * distributed under the License is distributed on an "AS IS" BASIS, 649 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 650 * See the License for the specific language governing permissions and 651 * limitations under the License. 652 */function _getClientVersion(e,t=[]){let n;switch(e){case"Browser":n=_getBrowserName((0,s.z$)());break;case"Worker":n=`${_getBrowserName((0,s.z$)())}-${e}`;break;default:n=e}let i=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${o.Jn}/${i}`}/** 653 * @license 654 * Copyright 2022 Google LLC 655 * 656 * Licensed under the Apache License, Version 2.0 (the "License"); 657 * you may not use this file except in compliance with the License. 658 * You may obtain a copy of the License at 659 * 660 * http://www.apache.org/licenses/LICENSE-2.0 661 * 662 * Unless required by applicable law or agreed to in writing, software 663 * distributed under the License is distributed on an "AS IS" BASIS, 664 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 665 * See the License for the specific language governing permissions and 666 * limitations under the License. 667 */let AuthMiddlewareQueue=class AuthMiddlewareQueue{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let wrappedCallback=t=>new Promise((n,i)=>{try{let i=e(t);n(i)}catch(e){i(e)}});wrappedCallback.onAbort=t,this.queue.push(wrappedCallback);let n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){for(let e of(t.reverse(),t))try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}};/** 668 * @license 669 * Copyright 2023 Google LLC 670 * 671 * Licensed under the Apache License, Version 2.0 (the "License");
672 * you may not use this file except in compliance with the License. 673 * You may obtain a copy of the License at 674 * 675 * http://www.apache.org/licenses/LICENSE-2.0 676 * 677 * Unless required by applicable law or agreed to in writing, software 678 * distributed under the License is distributed on an "AS IS" BASIS, 679 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 680 * See the License for the specific language governing permissions and 681 * limitations under the License. 682 */async function _getPasswordPolicy(e,t={}){return _performApiRequest(e,"GET","/v2/passwordPolicy",_addTidIfNecessary(e,t))}let PasswordPolicyImpl=class PasswordPolicyImpl{constructor(e){var t,n,i,s;let o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=o.minPasswordLength)&&void 0!==t?t:6,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),void 0!==o.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),void 0!==o.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),void 0!==o.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),void 0!==o.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(s=e.forceUpgradeOnSignin)&&void 0!==s&&s,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,i,s,o,l;let u={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,u),this.validatePasswordCharacterOptions(e,u),u.isValid&&(u.isValid=null===(t=u.meetsMinPasswordLength)||void 0===t||t),u.isValid&&(u.isValid=null===(n=u.meetsMaxPasswordLength)||void 0===n||n),u.isValid&&(u.isValid=null===(i=u.containsLowercaseLetter)||void 0===i||i),u.isValid&&(u.isValid=null===(s=u.containsUppercaseLetter)||void 0===s||s),u.isValid&&(u.isValid=null===(o=u.containsNumericCharacter)||void 0===o||o),u.isValid&&(u.isValid=null===(l=u.containsNonAlphanumericCharacter)||void 0===l||l),u}validatePasswordLengthOptions(e,t){let n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let i=0;i<e.length;i++)n=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};/** 683 * @license 684 * Copyright 2020 Google LLC 685 * 686 * Licensed under the Apache License, Version 2.0 (the "License"); 687 * you may not use this file except in compliance with the License. 688 * You may obtain a copy of the License at 689 * 690 * http://www.apache.org/licenses/LICENSE-2.0 691 * 692 * Unless required by applicable law or agreed to in writing, software 693 * distributed under the License is distributed on an "AS IS" BASIS, 694 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 695 * See the License for the specific language governing permissions and 696 * limitations under the License. 697 */let AuthImpl=class AuthImpl{constructor(e,t,n,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Subscription(this),this.idTokenSubscription=new Subscription(this),this.beforeStateQueue=new AuthMiddlewareQueue(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=h,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=_getInstance(t)),this._initializationPromise=this.queue(async()=>{var n,i;if(!this._deleted&&(this.persistenceManager=await PersistenceUserManager.create(this,e),!this._deleted)){if
697(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(i=this.currentUser)||void 0===i?void 0:i.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(this.currentUser||e){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUser(e){var t;let n=await this.assertedPersistence.getCurrentUser(),i=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,o=null==i?void 0:i._redirectEventId,l=await this.tryRedirectSignIn(e);(!n||n===o)&&(null==l?void 0:l.user)&&(i=l.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(e){i=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return(_assert(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId)?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await _reloadWithoutSaving(e)}catch(e){if((null==e?void 0:e.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;let e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){let t=e?(0,s.m9)(e):null;return t&&_assert(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&_assert(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue(async()=>{await this.assertedPersistence.setPersistence(_getInstance(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await _getPasswordPolicy(this),t=new PasswordPolicyImpl(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new s.LL("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>
697{if(this.currentUser)e();else{let n=this.onAuthStateChanged(()=>{n(),e()},t)}})}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){let n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&_getInstance(e)||this._popupRedirectResolver;_assert(t,this,"argument-error"),this.redirectPersistenceManager=await PersistenceUserManager.create(this,[_getInstance(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return(this._isInitialized&&await this.queue(async()=>{}),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e)?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,i){if(this._deleted)return()=>{};let s="function"==typeof t?t:t.next.bind(t),o=!1,l=this._isInitialized?Promise.resolve():this._initializationPromise;if(_assert(l,this,"internal-error"),l.then(()=>{o||s(this.currentUser)}),"function"==typeof t){let s=e.addObserver(t,n,i);return()=>{o=!0,s()}}{let n=e.addObserver(t);return()=>{o=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return _assert(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=_getClientVersion(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);let n=await (null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);let i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),t}async _getAppCheckToken(){var e;let t=await (null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){d.logLevel<=l.in.WARN&&d.warn(`Auth (${o.Jn}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}};function _castAuth(e){return(0,s.m9)(e)}let Subscription=class Subscription{constructor(e){this.auth=e,this.observer=null,this.addObserver=(0,s.ne)(e=>this.observer=e)}get next(){return _assert(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};function _loadJS(e){return new Promise((t,n)=>{var i,s;let o=document.createElement("script");o.setAttribute("src",e),o.onload=t,o.onerror=e=>{let t=_createError("internal-error");t.customData=e,n(t)},o.type="text/javascript",o.charset="UTF-8",(null!==(s=null===(i=document.getElementsByTagName("head"))||void 0===i?void 0:i[0])&&void 0!==s?s:document).appendChild(o)})}function _generateCallbackName(e){return`__${e}${Math.floor(1e6*Math.random())}`}let RecaptchaEnterpriseVerifier=class RecaptchaEnterpriseVerifier{constructor(e){this.type="recaptcha-enterprise",this.auth=_castAuth(e)}async verify(e="verify",t=!1){async function retrieveSiteKey(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,n)=>
697{getRecaptchaConfig(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(i=>{if(void 0===i.recaptchaKey)n(Error("recaptcha Enterprise site key undefined"));else{let n=new RecaptchaConfig(i);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}}).catch(e=>{n(e)})})}function retrieveRecaptchaToken(t,n,i){let s=window.grecaptcha;isEnterprise(s)?s.enterprise.ready(()=>{s.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n("NO_RECAPTCHA")})}):i(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((e,n)=>{retrieveSiteKey(this.auth).then(i=>{if(!t&&isEnterprise(window.grecaptcha))retrieveRecaptchaToken(i,e,n);else{if("undefined"==typeof window){n(Error("RecaptchaVerifier is only supported in browser"));return}_loadJS("https://www.google.com/recaptcha/enterprise.js?render="+i).then(()=>{retrieveRecaptchaToken(i,e,n)}).catch(e=>{n(e)})}}).catch(e=>{n(e)})})}};async function injectRecaptchaFields(e,t,n,i=!1){let s;let o=new RecaptchaEnterpriseVerifier(e);try{s=await o.verify(n)}catch(e){s=await o.verify(n,!0)}let l=Object.assign({},t);return i?Object.assign(l,{captchaResp:s}):Object.assign(l,{captchaResponse:s}),Object.assign(l,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(l,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),l}function extractProtocol(e){let t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function parsePort(e){if(!e)return null;let t=Number(e);return isNaN(t)?null:t}/** 698 * @license 699 * Copyright 2020 Google LLC 700 * 701 * Licensed under the Apache License, Version 2.0 (the "License"); 702 * you may not use this file except in compliance with the License. 703 * You may obtain a copy of the License at 704 * 705 * http://www.apache.org/licenses/LICENSE-2.0 706 * 707 * Unless required by applicable law or agreed to in writing, software 708 * distributed under the License is distributed on an "AS IS" BASIS, 709 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 710 * See the License for the specific language governing permissions and 711 * limitations under the License. 712 */let AuthCredential=class AuthCredential{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return debugFail("not implemented")}_getIdTokenResponse(e){return debugFail("not implemented")}_linkToIdToken(e,t){return debugFail("not implemented")}_getReauthenticationResolver(e){return debugFail("not implemented")}};async function updateEmailPassword(e,t){return _performApiRequest(e,"POST","/v1/accounts:update",t)}/** 713 * @license 714 * Copyright 2020 Google LLC 715 * 716 * Licensed under the Apache License, Version 2.0 (the "License"); 717 * you may not use this file except in compliance with the License. 718 * You may obtain a copy of the License at 719 * 720 * http://www.apache.org/licenses/LICENSE-2.0 721 * 722 * Unless required by applicable law or agreed to in writing, software 723 * distributed under the License is distributed on an "AS IS" BASIS, 724 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 725 * See the License for the specific language governing permissions and 726 * limitations under the License. 727 */async function signInWithPassword(e,t){return _performSignInRequest(e,"POST","/v1/accounts:signInWithPassword",_addTidIfNecessary(e,t))}async function sendOobCode(e,t){return _performApiRequest(e,"POST","/v1/accounts:sendOobCode",_addTidIfNecessary(e,t))}async function sendEmailVerification$1(e,t){return sendOobCode(e,t)}async function sendPasswordResetEmail$1(e,t){return sendOobCode(e,t)}/** 728 * @license 729 * Copyright 2020 Google LLC 730 * 731 * Licensed under the Apache License, Version 2.0 (the "License"); 732 * you may not use this file except in compliance with the License. 733 * You may obtain a copy of the License at 734 * 735 * http://www.apache.org/licenses/LICENSE-2.0 736 * 737 * Unless required by applicable law or agreed to in writing, software 738 * distributed under the License is distributed on an "AS IS" BASIS, 739 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 740 * See the License for the specific language governing permissions and 741 * limitations under the License. 742 */async function signInWithEmailLink$1(e,t){return _performSignInRequest(e,"POST","/v1/accounts:signInWithEmailLink",_addTidIfNecessary(e,t))}async function signInWithEmailLinkForLinking(e,t){return _performSignInRequest(e,"POST","/v1/accounts:signInWithEmailLink",_addTidIfNecessary(e,t))}/** 743 * @license 744 * Copyright 2020 Google LLC 745 * 746 * Licensed under the Apache License, Version 2.0 (the "License");
747 * you may not use this file except in compliance with the License. 748 * You may obtain a copy of the License at 749 * 750 * http://www.apache.org/licenses/LICENSE-2.0 751 * 752 * Unless required by applicable law or agreed to in writing, software 753 * distributed under the License is distributed on an "AS IS" BASIS, 754 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 755 * See the License for the specific language governing permissions and 756 * limitations under the License. 757 */let EmailAuthCredential=class EmailAuthCredential extends AuthCredential{constructor(e,t,n,i=null){super("password",n),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new EmailAuthCredential(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new EmailAuthCredential(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e;if((null==t?void 0:t.email)&&(null==t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){var t;switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};if(null===(t=e._getRecaptchaConfig())||void 0===t||!t.emailPasswordEnabled)return signInWithPassword(e,n).catch(async t=>{if("auth/missing-recaptcha-token"!==t.code)return Promise.reject(t);{console.log("Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.");let t=await injectRecaptchaFields(e,n,"signInWithPassword");return signInWithPassword(e,t)}});{let t=await injectRecaptchaFields(e,n,"signInWithPassword");return signInWithPassword(e,t)}case"emailLink":return signInWithEmailLink$1(e,{email:this._email,oobCode:this._password});default:_fail(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return updateEmailPassword(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return signInWithEmailLinkForLinking(e,{idToken:t,email:this._email,oobCode:this._password});default:_fail(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};/** 758 * @license 759 * Copyright 2020 Google LLC 760 * 761 * Licensed under the Apache License, Version 2.0 (the "License"); 762 * you may not use this file except in compliance with the License. 763 * You may obtain a copy of the License at 764 * 765 * http://www.apache.org/licenses/LICENSE-2.0 766 * 767 * Unless required by applicable law or agreed to in writing, software 768 * distributed under the License is distributed on an "AS IS" BASIS, 769 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 770 * See the License for the specific language governing permissions and 771 * limitations under the License. 772 */async function signInWithIdp(e,t){return _performSignInRequest(e,"POST","/v1/accounts:signInWithIdp",_addTidIfNecessary(e,t))}let OAuthCredential=class OAuthCredential extends AuthCredential{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new OAuthCredential(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):_fail("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
772once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:i}=t,s=__rest(t,["providerId","signInMethod"]);if(!n||!i)return null;let o=new OAuthCredential(n,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let t=this.buildRequest();return signInWithIdp(e,t)}_linkToIdToken(e,t){let n=this.buildRequest();return n.idToken=t,signInWithIdp(e,n)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,signInWithIdp(e,t)}buildRequest(){let e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=(0,s.xO)(t)}return e}};/** 773 * @license 774 * Copyright 2020 Google LLC 775 * 776 * Licensed under the Apache License, Version 2.0 (the "License"); 777 * you may not use this file except in compliance with the License. 778 * You may obtain a copy of the License at 779 * 780 * http://www.apache.org/licenses/LICENSE-2.0 781 * 782 * Unless required by applicable law or agreed to in writing, software 783 * distributed under the License is distributed on an "AS IS" BASIS, 784 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 785 * See the License for the specific language governing permissions and 786 * limitations under the License. 787 */async function sendPhoneVerificationCode(e,t){return _performApiRequest(e,"POST","/v1/accounts:sendVerificationCode",_addTidIfNecessary(e,t))}async function signInWithPhoneNumber$1(e,t){return _performSignInRequest(e,"POST","/v1/accounts:signInWithPhoneNumber",_addTidIfNecessary(e,t))}async function linkWithPhoneNumber$1(e,t){let n=await _performSignInRequest(e,"POST","/v1/accounts:signInWithPhoneNumber",_addTidIfNecessary(e,t));if(n.temporaryProof)throw _makeTaggedError(e,"account-exists-with-different-credential",n);return n}let E={USER_NOT_FOUND:"user-not-found"};async function verifyPhoneNumberForExisting(e,t){let n=Object.assign(Object.assign({},t),{operation:"REAUTH"});return _performSignInRequest(e,"POST","/v1/accounts:signInWithPhoneNumber",_addTidIfNecessary(e,n),E)}/** 788 * @license 789 * Copyright 2020 Google LLC 790 * 791 * Licensed under the Apache License, Version 2.0 (the "License"); 792 * you may not use this file except in compliance with the License. 793 * You may obtain a copy of the License at 794 * 795 * http://www.apache.org/licenses/LICENSE-2.0 796 * 797 * Unless required by applicable law or agreed to in writing, software 798 * distributed under the License is distributed on an "AS IS" BASIS, 799 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 800 * See the License for the specific language governing permissions and 801 * limitations under the License. 802 */let PhoneAuthCredential=class PhoneAuthCredential extends AuthCredential{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new PhoneAuthCredential({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new PhoneAuthCredential({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return signInWithPhoneNumber$1(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return linkWithPhoneNumber$1(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return verifyPhoneNumberForExisting(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:i}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"==typeof e&&(e=JSON.parse(e));let{verificationId:t,verificationCode:n,phoneNumber:i,temporaryProof:s}=e;return n||t||i||s?new PhoneAuthCredential({verificationId:t,verificationCode:n,phoneNumber:i,temporaryProof:s}):null}};let ActionCodeURL=class ActionCodeURL{constructor(e){var t,n,i,o,l,u;let h=(0,s.zd)((0,s.pd)(e)),d=null!==(t=h.apiKey)&&void 0!==t?t:null,_=null!==(n=h.oobCode)&&void 0!==n?n:null,m=/** 803 * @license 804 * Copyright 2020 Google LLC 805 * 806 * Licensed under the Apache License, Version 2.0 (the "License");
807 * you may not use this file except in compliance with the License. 808 * You may obtain a copy of the License at 809 * 810 * http://www.apache.org/licenses/LICENSE-2.0 811 * 812 * Unless required by applicable law or agreed to in writing, software 813 * distributed under the License is distributed on an "AS IS" BASIS, 814 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 815 * See the License for the specific language governing permissions and 816 * limitations under the License. 817 */function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(i=h.mode)&&void 0!==i?i:null);_assert(d&&_&&m,"argument-error"),this.apiKey=d,this.operation=m,this.code=_,this.continueUrl=null!==(o=h.continueUrl)&&void 0!==o?o:null,this.languageCode=null!==(l=h.languageCode)&&void 0!==l?l:null,this.tenantId=null!==(u=h.tenantId)&&void 0!==u?u:null}static parseLink(e){let t=function(e){let t=(0,s.zd)((0,s.pd)(e)).link,n=t?(0,s.zd)((0,s.pd)(t)).deep_link_id:null,i=(0,s.zd)((0,s.pd)(e)).deep_link_id,o=i?(0,s.zd)((0,s.pd)(i)).link:null;return o||i||n||t||e}(e);try{return new ActionCodeURL(t)}catch(e){return null}}};/** 818 * @license 819 * Copyright 2020 Google LLC 820 * 821 * Licensed under the Apache License, Version 2.0 (the "License"); 822 * you may not use this file except in compliance with the License. 823 * You may obtain a copy of the License at 824 * 825 * http://www.apache.org/licenses/LICENSE-2.0 826 * 827 * Unless required by applicable law or agreed to in writing, software 828 * distributed under the License is distributed on an "AS IS" BASIS, 829 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 830 * See the License for the specific language governing permissions and 831 * limitations under the License. 832 */let EmailAuthProvider=class EmailAuthProvider{constructor(){this.providerId=EmailAuthProvider.PROVIDER_ID}static credential(e,t){return EmailAuthCredential._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let n=ActionCodeURL.parseLink(t);return _assert(n,"argument-error"),EmailAuthCredential._fromEmailAndCode(e,n.code,n.tenantId)}};EmailAuthProvider.PROVIDER_ID="password",EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD="password",EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/** 833 * @license 834 * Copyright 2020 Google LLC 835 * 836 * Licensed under the Apache License, Version 2.0 (the "License"); 837 * you may not use this file except in compliance with the License. 838 * You may obtain a copy of the License at 839 * 840 * http://www.apache.org/licenses/LICENSE-2.0 841 * 842 * Unless required by applicable law or agreed to in writing, software 843 * distributed under the License is distributed on an "AS IS" BASIS, 844 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 845 * See the License for the specific language governing permissions and 846 * limitations under the License. 847 */let FederatedAuthProvider=class FederatedAuthProvider{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}};/** 848 * @license 849 * Copyright 2019 Google LLC 850 * 851 * Licensed under the Apache License, Version 2.0 (the "License"); 852 * you may not use this file except in compliance with the License. 853 * You may obtain a copy of the License at 854 * 855 * http://www.apache.org/licenses/LICENSE-2.0 856 * 857 * Unless required by applicable law or agreed to in writing, software 858 * distributed under the License is distributed on an "AS IS" BASIS, 859 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 860 * See the License for the specific language governing permissions and 861 * limitations under the License. 862 */let BaseOAuthProvider=class BaseOAuthProvider extends FederatedAuthProvider{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};/** 863 * @license 864 * Copyright 2020 Google LLC 865 * 866 * Licensed under the Apache License, Version 2.0 (the "License");
867 * you may not use this file except in compliance with the License. 868 * You may obtain a copy of the License at 869 * 870 * http://www.apache.org/licenses/LICENSE-2.0 871 * 872 * Unless required by applicable law or agreed to in writing, software 873 * distributed under the License is distributed on an "AS IS" BASIS, 874 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 875 * See the License for the specific language governing permissions and 876 * limitations under the License. 877 */let FacebookAuthProvider=class FacebookAuthProvider extends BaseOAuthProvider{constructor(){super("facebook.com")}static credential(e){return OAuthCredential._fromParams({providerId:FacebookAuthProvider.PROVIDER_ID,signInMethod:FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return FacebookAuthProvider.credentialFromTaggedObject(e)}static credentialFromError(e){return FacebookAuthProvider.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return FacebookAuthProvider.credential(e.oauthAccessToken)}catch(e){return null}}};FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD="facebook.com",FacebookAuthProvider.PROVIDER_ID="facebook.com";/** 878 * @license 879 * Copyright 2020 Google LLC 880 * 881 * Licensed under the Apache License, Version 2.0 (the "License"); 882 * you may not use this file except in compliance with the License. 883 * You may obtain a copy of the License at 884 * 885 * http://www.apache.org/licenses/LICENSE-2.0 886 * 887 * Unless required by applicable law or agreed to in writing, software 888 * distributed under the License is distributed on an "AS IS" BASIS, 889 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 890 * See the License for the specific language governing permissions and 891 * limitations under the License. 892 */let GoogleAuthProvider=class GoogleAuthProvider extends BaseOAuthProvider{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return OAuthCredential._fromParams({providerId:GoogleAuthProvider.PROVIDER_ID,signInMethod:GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return GoogleAuthProvider.credentialFromTaggedObject(e)}static credentialFromError(e){return GoogleAuthProvider.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return GoogleAuthProvider.credential(t,n)}catch(e){return null}}};GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD="google.com",GoogleAuthProvider.PROVIDER_ID="google.com";/** 893 * @license 894 * Copyright 2020 Google LLC 895 * 896 * Licensed under the Apache License, Version 2.0 (the "License"); 897 * you may not use this file except in compliance with the License. 898 * You may obtain a copy of the License at 899 * 900 * http://www.apache.org/licenses/LICENSE-2.0 901 * 902 * Unless required by applicable law or agreed to in writing, software 903 * distributed under the License is distributed on an "AS IS" BASIS, 904 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 905 * See the License for the specific language governing permissions and 906 * limitations under the License. 907 */let GithubAuthProvider=class GithubAuthProvider extends BaseOAuthProvider{constructor(){super("github.com")}static credential(e){return OAuthCredential._fromParams({providerId:GithubAuthProvider.PROVIDER_ID,signInMethod:GithubAuthProvider.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return GithubAuthProvider.credentialFromTaggedObject(e)}static credentialFromError(e){return GithubAuthProvider.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return GithubAuthProvider.credential(e.oauthAccessToken)}catch(e){return null}}};GithubAuthProvider.GITHUB_SIGN_IN_METHOD="github.com",GithubAuthProvider.PROVIDER_ID="github.com";/** 908 * @license 909 * Copyright 2020 Google LLC 910 * 911 * Licensed under the Apache License, Version 2.0 (the "License");
912 * you may not use this file except in compliance with the License. 913 * You may obtain a copy of the License at 914 * 915 * http://www.apache.org/licenses/LICENSE-2.0 916 * 917 * Unless required by applicable law or agreed to in writing, software 918 * distributed under the License is distributed on an "AS IS" BASIS, 919 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 920 * See the License for the specific language governing permissions and 921 * limitations under the License. 922 */let TwitterAuthProvider=class TwitterAuthProvider extends BaseOAuthProvider{constructor(){super("twitter.com")}static credential(e,t){return OAuthCredential._fromParams({providerId:TwitterAuthProvider.PROVIDER_ID,signInMethod:TwitterAuthProvider.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return TwitterAuthProvider.credentialFromTaggedObject(e)}static credentialFromError(e){return TwitterAuthProvider.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return TwitterAuthProvider.credential(t,n)}catch(e){return null}}};/** 923 * @license 924 * Copyright 2020 Google LLC 925 * 926 * Licensed under the Apache License, Version 2.0 (the "License"); 927 * you may not use this file except in compliance with the License. 928 * You may obtain a copy of the License at 929 * 930 * http://www.apache.org/licenses/LICENSE-2.0 931 * 932 * Unless required by applicable law or agreed to in writing, software 933 * distributed under the License is distributed on an "AS IS" BASIS, 934 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 935 * See the License for the specific language governing permissions and 936 * limitations under the License. 937 */async function signUp(e,t){return _performSignInRequest(e,"POST","/v1/accounts:signUp",_addTidIfNecessary(e,t))}TwitterAuthProvider.TWITTER_SIGN_IN_METHOD="twitter.com",TwitterAuthProvider.PROVIDER_ID="twitter.com";/** 938 * @license 939 * Copyright 2020 Google LLC 940 * 941 * Licensed under the Apache License, Version 2.0 (the "License"); 942 * you may not use this file except in compliance with the License. 943 * You may obtain a copy of the License at 944 * 945 * http://www.apache.org/licenses/LICENSE-2.0 946 * 947 * Unless required by applicable law or agreed to in writing, software 948 * distributed under the License is distributed on an "AS IS" BASIS, 949 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 950 * See the License for the specific language governing permissions and 951 * limitations under the License. 952 */let UserCredentialImpl=class UserCredentialImpl{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,i=!1){let s=await UserImpl._fromIdTokenResponse(e,n,i),o=providerIdForResponse(n),l=new UserCredentialImpl({user:s,providerId:o,_tokenResponse:n,operationType:t});return l}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);let i=providerIdForResponse(n);return new UserCredentialImpl({user:e,providerId:i,_tokenResponse:n,operationType:t})}};function providerIdForResponse(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/** 953 * @license 954 * Copyright 2020 Google LLC 955 * 956 * Licensed under the Apache License, Version 2.0 (the "License"); 957 * you may not use this file except in compliance with the License. 958 * You may obtain a copy of the License at 959 * 960 * http://www.apache.org/licenses/LICENSE-2.0 961 * 962 * Unless required by applicable law or agreed to in writing, software 963 * distributed under the License is distributed on an "AS IS" BASIS, 964 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 965 * See the License for the specific language governing permissions and 966 * limitations under the License. 967 */let MultiFactorError=class MultiFactorError extends s.ZR{constructor(e,t,n,i){var s;super(t.code,t.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,MultiFactorError.prototype),this.customData={appName:e.n
967ame,tenantId:null!==(s=e.tenantId)&&void 0!==s?s:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,i){return new MultiFactorError(e,t,n,i)}};function _processCredentialSavingMfaContextIfNecessary(e,t,n,i){let s="reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e);return s.catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw MultiFactorError._fromErrorAndOperation(e,n,t,i);throw n})}async function _link$1(e,t,n=!1){let i=await _logoutIfInvalidated(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return UserCredentialImpl._forOperation(e,"link",i)}/** 968 * @license 969 * Copyright 2019 Google LLC 970 * 971 * Licensed under the Apache License, Version 2.0 (the "License"); 972 * you may not use this file except in compliance with the License. 973 * You may obtain a copy of the License at 974 * 975 * http://www.apache.org/licenses/LICENSE-2.0 976 * 977 * Unless required by applicable law or agreed to in writing, software 978 * distributed under the License is distributed on an "AS IS" BASIS, 979 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 980 * See the License for the specific language governing permissions and 981 * limitations under the License. 982 */async function _reauthenticate(e,t,n=!1){let{auth:i}=e,s="reauthenticate";try{let o=await _logoutIfInvalidated(e,_processCredentialSavingMfaContextIfNecessary(i,s,t,e),n);_assert(o.idToken,i,"internal-error");let l=_parseToken(o.idToken);_assert(l,i,"internal-error");let{sub:u}=l;return _assert(e.uid===u,i,"user-mismatch"),UserCredentialImpl._forOperation(e,s,o)}catch(e){throw(null==e?void 0:e.code)==="auth/user-not-found"&&_fail(i,"user-mismatch"),e}}/** 983 * @license 984 * Copyright 2020 Google LLC 985 * 986 * Licensed under the Apache License, Version 2.0 (the "License"); 987 * you may not use this file except in compliance with the License. 988 * You may obtain a copy of the License at 989 * 990 * http://www.apache.org/licenses/LICENSE-2.0 991 * 992 * Unless required by applicable law or agreed to in writing, software 993 * distributed under the License is distributed on an "AS IS" BASIS, 994 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 995 * See the License for the specific language governing permissions and 996 * limitations under the License. 997 */async function _signInWithCredential(e,t,n=!1){let i="signIn",s=await _processCredentialSavingMfaContextIfNecessary(e,i,t),o=await UserCredentialImpl._fromIdTokenResponse(e,i,s);return n||await e._updateCurrentUser(o.user),o}async function signInWithCredential(e,t){return _signInWithCredential(_castAuth(e),t)}/** 998 * @license 999 * Copyright 2020 Google LLC 1000 * 1001 * Licensed under the Apache License, Version 2.0 (the "License"); 1002 * you may not use this file except in compliance with the License. 1003 * You may obtain a copy of the License at 1004 * 1005 * http://www.apache.org/licenses/LICENSE-2.0 1006 * 1007 * Unless required by applicable law or agreed to in writing, software 1008 * distributed under the License is distributed on an "AS IS" BASIS, 1009 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1010 * See the License for the specific language governing permissions and 1011 * limitations under the License. 1012 */function _setActionCodeSettingsOnRequest(e,t,n){var i;_assert((null===(i=n.url)||void 0===i?void 0:i.length)>0,e,"invalid-continue-uri"),_assert(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(_assert(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(_assert(n.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}/** 1013 * @license 1014 * Copyright 2020 Google LLC 1015 * 1016 * Licensed under the Apache License, Version 2.0 (the "License"); 1017 * you may not use this file except in compliance with the License. 1018 * You may obtain a copy of the License at 1019 * 1020 * http://www.apache.org/licenses/LICENSE-2.0 1021 * 1022 * Unless required by applicable law or agreed to in writing, softw
1022are 1023 * distributed under the License is distributed on an "AS IS" BASIS, 1024 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1025 * See the License for the specific language governing permissions and 1026 * limitations under the License. 1027 */async function recachePasswordPolicy(e){let t=_castAuth(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function sendPasswordResetEmail(e,t,n){var i;let s=_castAuth(e),o={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};if(null===(i=s._getRecaptchaConfig())||void 0===i?void 0:i.emailPasswordEnabled){let e=await injectRecaptchaFields(s,o,"getOobCode",!0);n&&_setActionCodeSettingsOnRequest(s,e,n),await sendPasswordResetEmail$1(s,e)}else n&&_setActionCodeSettingsOnRequest(s,o,n),await sendPasswordResetEmail$1(s,o).catch(async e=>{if("auth/missing-recaptcha-token"!==e.code)return Promise.reject(e);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");let e=await injectRecaptchaFields(s,o,"getOobCode",!0);n&&_setActionCodeSettingsOnRequest(s,e,n),await sendPasswordResetEmail$1(s,e)}})}async function createUserWithEmailAndPassword(e,t,n){var i;let s;let o=_castAuth(e),l={returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"};if(null===(i=o._getRecaptchaConfig())||void 0===i?void 0:i.emailPasswordEnabled){let e=await injectRecaptchaFields(o,l,"signUpPassword");s=signUp(o,e)}else s=signUp(o,l).catch(async e=>{if("auth/missing-recaptcha-token"===e.code){console.log("Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.");let e=await injectRecaptchaFields(o,l,"signUpPassword");return signUp(o,e)}throw e});let u=await s.catch(t=>{throw"auth/password-does-not-meet-requirements"===t.code&&recachePasswordPolicy(e),t}),h=await UserCredentialImpl._fromIdTokenResponse(o,"signIn",u);return await o._updateCurrentUser(h.user),h}function signInWithEmailAndPassword(e,t,n){return signInWithCredential((0,s.m9)(e),EmailAuthProvider.credential(t,n)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&recachePasswordPolicy(e),t})}async function sendEmailVerification(e,t){let n=(0,s.m9)(e),i=await e.getIdToken(),o={requestType:"VERIFY_EMAIL",idToken:i};t&&_setActionCodeSettingsOnRequest(n.auth,o,t);let{email:l}=await sendEmailVerification$1(n.auth,o);l!==e.email&&await e.reload()}/** 1028 * @license 1029 * Copyright 2020 Google LLC 1030 * 1031 * Licensed under the Apache License, Version 2.0 (the "License"); 1032 * you may not use this file except in compliance with the License. 1033 * You may obtain a copy of the License at 1034 * 1035 * http://www.apache.org/licenses/LICENSE-2.0 1036 * 1037 * Unless required by applicable law or agreed to in writing, software 1038 * distributed under the License is distributed on an "AS IS" BASIS, 1039 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1040 * See the License for the specific language governing permissions and 1041 * limitations under the License. 1042 */function setPersistence(e,t){return(0,s.m9)(e).setPersistence(t)}function onAuthStateChanged(e,t,n,i){return(0,s.m9)(e).onAuthStateChanged(t,n,i)}function signOut(e){return(0,s.m9)(e).signOut()}new WeakMap;let b="__sak";/** 1043 * @license 1044 * Copyright 2019 Google LLC 1045 * 1046 * Licensed under the Apache License, Version 2.0 (the "License"); 1047 * you may not use this file except in compliance with the License. 1048 * You may obtain a copy of the License at 1049 * 1050 * http://www.apache.org/licenses/LICENSE-2.0 1051 * 1052 * Unless required by applicable law or agreed to in writing, software 1053 * distributed under the License is distributed on an "AS IS" BASIS, 1054 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1055 * See the License for the specific language governing permissions and 1056 * limitations under the License. 1057 */let BrowserPersistenceClass=class BrowserPersistenceClass{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{if(!this.storage)return Promise.resolve(!1);return this.storage.setItem(b,"1"),this.storage.removeItem(b),Promise.resolve(!0)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};let BrowserLocalPersistence=class BrowserLocalPersistence extends BrowserPersistenceClass{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=/** 1058 * @license 1059 * Copyright 2020 Google LLC 1060 * 1061 * Licensed under the Apache License, Version 2.0 (the "License");
1062 * you may not use this file except in compliance with the License. 1063 * You may obtain a copy of the License at 1064 * 1065 * http://www.apache.org/licenses/LICENSE-2.0 1066 * 1067 * Unless required by applicable law or agreed to in writing, software 1068 * distributed under the License is distributed on an "AS IS" BASIS, 1069 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1070 * See the License for the specific language governing permissions and 1071 * limitations under the License. 1072 */function(){let e=(0,s.z$)();return _isSafari(e)||_isIOS(e)}()&&function(){try{return!!(window&&window!==window.top)}catch(e){return!1}}(),this.fallbackToPolling=_isMobileBrowser(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let n=this.storage.getItem(t),i=this.localCache[t];n!==i&&e(t,i,n)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});return}let n=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){let i=this.storage.getItem(n);if(e.newValue!==i)null!==e.newValue?this.storage.setItem(n,e.newValue):this.storage.removeItem(n);else if(this.localCache[n]===e.newValue&&!t)return}let triggerListeners=()=>{let e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},i=this.storage.getItem(n);(0,s.w1)()&&10===document.documentMode&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(triggerListeners,10):triggerListeners()}notifyListeners(e,t){this.localCache[e]=t;let n=this.listeners[e];if(n)for(let e of Array.from(n))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}};BrowserLocalPersistence.type="LOCAL";let V=BrowserLocalPersistence;/** 1073 * @license 1074 * Copyright 2020 Google LLC 1075 * 1076 * Licensed under the Apache License, Version 2.0 (the "License"); 1077 * you may not use this file except in compliance with the License. 1078 * You may obtain a copy of the License at 1079 * 1080 * http://www.apache.org/licenses/LICENSE-2.0 1081 * 1082 * Unless required by applicable law or agreed to in writing, software 1083 * distributed under the License is distributed on an "AS IS" BASIS, 1084 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1085 * See the License for the specific language governing permissions and 1086 * limitations under the License. 1087 */let BrowserSessionPersistence=class BrowserSessionPersistence extends BrowserPersistenceClass{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}};BrowserSessionPersistence.type="SESSION";/** 1088 * @license 1089 * Copyright 2019 Google LLC 1090 * 1091 * Licensed under the Apache License, Version 2.0 (the "License"); 1092 * you may not use this file except in compliance with the License. 1093 * You may obtain a copy of the License at 1094 * 1095 * http://www.apache.org/licenses/LICENSE-2.0 1096 * 1097 * Unless required by applicable law or agreed to in writing, software 1098 * distributed under the License is distributed on an "AS IS" BASIS, 1099 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1100 * See the License for the specific language governing permissions and 1101 * limitations under the License. 1102 */let Receiver=class Receiver{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;let n=new Receiver(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let{eventId:t,eventType:n,data:i}=e.data,s=this.handlersMap[n];if(!(null==s?void 0:s.size))return;e.ports[0].postMessage({status:"ack",eventId:t,eventType:n});let o=Array.from(s).map(async t=>t(e.origin,i)),l=await Promise.all(o.map(async e=>{try{let t=await e;return{fulfilled:!0,value:t}}catch(e){return{fulfilled:!1,reason:e}}}));e.ports[0].postMessage({status:"done",eventId:t,eventType:n,response:l})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};/** 1103 * @license 1104 * Copyright 2020 Google LLC 1105 * 1106 * Licensed under the Apache License, Version 2.0 (the "License");
1107 * you may not use this file except in compliance with the License. 1108 * You may obtain a copy of the License at 1109 * 1110 * http://www.apache.org/licenses/LICENSE-2.0 1111 * 1112 * Unless required by applicable law or agreed to in writing, software 1113 * distributed under the License is distributed on an "AS IS" BASIS, 1114 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1115 * See the License for the specific language governing permissions and 1116 * limitations under the License. 1117 */function _generateEventId(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}Receiver.receivers=[];/** 1118 * @license 1119 * Copyright 2019 Google LLC 1120 * 1121 * Licensed under the Apache License, Version 2.0 (the "License"); 1122 * you may not use this file except in compliance with the License. 1123 * You may obtain a copy of the License at 1124 * 1125 * http://www.apache.org/licenses/LICENSE-2.0 1126 * 1127 * Unless required by applicable law or agreed to in writing, software 1128 * distributed under the License is distributed on an "AS IS" BASIS, 1129 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1130 * See the License for the specific language governing permissions and 1131 * limitations under the License. 1132 */let Sender=class Sender{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,n=50){let i,s;let o="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!o)throw Error("connection_unavailable");return new Promise((l,u)=>{let h=_generateEventId("",20);o.port1.start();let d=setTimeout(()=>{u(Error("unsupported_event"))},n);s={messageChannel:o,onMessage(e){if(e.data.eventId===h)switch(e.data.status){case"ack":clearTimeout(d),i=setTimeout(()=>{u(Error("timeout"))},3e3);break;case"done":clearTimeout(i),l(e.data.response);break;default:clearTimeout(d),clearTimeout(i),u(Error("invalid_response"))}}},this.handlers.add(s),o.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:e,eventId:h,data:t},[o.port2])}).finally(()=>{s&&this.removeMessageHandler(s)})}};/** 1133 * @license 1134 * Copyright 2020 Google LLC 1135 * 1136 * Licensed under the Apache License, Version 2.0 (the "License"); 1137 * you may not use this file except in compliance with the License. 1138 * You may obtain a copy of the License at 1139 * 1140 * http://www.apache.org/licenses/LICENSE-2.0 1141 * 1142 * Unless required by applicable law or agreed to in writing, software 1143 * distributed under the License is distributed on an "AS IS" BASIS, 1144 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1145 * See the License for the specific language governing permissions and 1146 * limitations under the License. 1147 */function _window(){return window}/** 1148 * @license 1149 * Copyright 2020 Google LLC. 1150 * 1151 * Licensed under the Apache License, Version 2.0 (the "License"); 1152 * you may not use this file except in compliance with the License. 1153 * You may obtain a copy of the License at 1154 * 1155 * http://www.apache.org/licenses/LICENSE-2.0 1156 * 1157 * Unless required by applicable law or agreed to in writing, software 1158 * distributed under the License is distributed on an "AS IS" BASIS, 1159 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1160 * See the License for the specific language governing permissions and 1161 * limitations under the License. 1162 */function _isWorker(){return void 0!==_window().WorkerGlobalScope&&"function"==typeof _window().importScripts}async function _getActiveServiceWorker(){if(!(null==navigator?void 0:navigator.serviceWorker))return null;try{let e=await navigator.serviceWorker.ready;return e.active}catch(e){return null}}/** 1163 * @license 1164 * Copyright 2019 Google LLC 1165 * 1166 * Licensed under the Apache License, Version 2.0 (the "License"); 1167 * you may not use this file except in compliance with the License. 1168 * You may obtain a copy of the License at 1169 * 1170 * http://www.apache.org/licenses/LICENSE-2.0 1171 * 1172 * Unless required by applicable law or agreed to in writing, softw
1172are 1173 * distributed under the License is distributed on an "AS IS" BASIS, 1174 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1175 * See the License for the specific language governing permissions and 1176 * limitations under the License. 1177 */let k="firebaseLocalStorageDb",L="firebaseLocalStorage",j="fbase_key";let DBPromise=class DBPromise{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}};function getObjectStore(e,t){return e.transaction([L],t?"readwrite":"readonly").objectStore(L)}function _openDatabase(){let e=indexedDB.open(k,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{let t=e.result;try{t.createObjectStore(L,{keyPath:j})}catch(e){n(e)}}),e.addEventListener("success",async()=>{let n=e.result;n.objectStoreNames.contains(L)?t(n):(n.close(),await function(){let e=indexedDB.deleteDatabase(k);return new DBPromise(e).toPromise()}(),t(await _openDatabase()))})})}async function _putObject(e,t,n){let i=getObjectStore(e,!0).put({[j]:t,value:n});return new DBPromise(i).toPromise()}async function getObject(e,t){let n=getObjectStore(e,!1).get(t),i=await new DBPromise(n).toPromise();return void 0===i?null:i.value}function _deleteObject(e,t){let n=getObjectStore(e,!0).delete(t);return new DBPromise(n).toPromise()}let IndexedDBLocalPersistence=class IndexedDBLocalPersistence{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await _openDatabase()),this.db}async _withRetries(e){let t=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return _isWorker()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Receiver._getInstance(_isWorker()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>{let n=await this._poll();return{keyProcessed:n.includes(t.key)}}),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await _getActiveServiceWorker(),!this.activeServiceWorker)return;this.sender=new Sender(this.activeServiceWorker);let n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null===(t=null==navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(e){}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await _openDatabase();return await _putObject(e,b,"1"),await _deleteObject(e,b),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>_putObject(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(t=>getObject(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>_deleteObject(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(e=>{let t=getObjectStore(e,!1).getAll();return new DBPromise(t).toPromise()});if(!e||0!==this.pendingWrites)return[];let t=[],n=new Set;for(let{fbase_key:i,value:s}of e)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),t.push(i));for(let e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;let n=this.listeners[e];if(n)for(let e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}};async function _verifyPhoneNumber(e,t,n){var i,s,o;let l=await n.verify();try{let u;if(_assert("string"==typeof l,e,"argument-error"),_assert("recaptcha"===n.type,e,"argument-error"),u="string"==typeof t?{phoneNumber:t}
1177:t,"session"in u){let t=u.session;if("phoneNumber"in u){_assert("enroll"===t.type,e,"internal-error");let n=await (s={idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:u.phoneNumber,recaptchaToken:l}},_performApiRequest(e,"POST","/v2/accounts/mfaEnrollment:start",_addTidIfNecessary(e,s)));return n.phoneSessionInfo.sessionInfo}{_assert("signin"===t.type,e,"internal-error");let n=(null===(i=u.multiFactorHint)||void 0===i?void 0:i.uid)||u.multiFactorUid;_assert(n,e,"missing-multi-factor-info");let s=await (o={mfaPendingCredential:t.credential,mfaEnrollmentId:n,phoneSignInInfo:{recaptchaToken:l}},_performApiRequest(e,"POST","/v2/accounts/mfaSignIn:start",_addTidIfNecessary(e,o)));return s.phoneResponseInfo.sessionInfo}}{let{sessionInfo:t}=await sendPhoneVerificationCode(e,{phoneNumber:u.phoneNumber,recaptchaToken:l});return t}}finally{n._reset()}}IndexedDBLocalPersistence.type="LOCAL",_generateCallbackName("rcb"),new Delay(3e4,6e4);/** 1178 * @license 1179 * Copyright 2020 Google LLC 1180 * 1181 * Licensed under the Apache License, Version 2.0 (the "License"); 1182 * you may not use this file except in compliance with the License. 1183 * You may obtain a copy of the License at 1184 * 1185 * http://www.apache.org/licenses/LICENSE-2.0 1186 * 1187 * Unless required by applicable law or agreed to in writing, software 1188 * distributed under the License is distributed on an "AS IS" BASIS, 1189 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1190 * See the License for the specific language governing permissions and 1191 * limitations under the License. 1192 */let PhoneAuthProvider=class PhoneAuthProvider{constructor(e){this.providerId=PhoneAuthProvider.PROVIDER_ID,this.auth=_castAuth(e)}verifyPhoneNumber(e,t){return _verifyPhoneNumber(this.auth,e,(0,s.m9)(t))}static credential(e,t){return PhoneAuthCredential._fromVerification(e,t)}static credentialFromResult(e){return PhoneAuthProvider.credentialFromTaggedObject(e)}static credentialFromError(e){return PhoneAuthProvider.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:n}=e;return t&&n?PhoneAuthCredential._fromTokenResponse(t,n):null}};PhoneAuthProvider.PROVIDER_ID="phone",PhoneAuthProvider.PHONE_SIGN_IN_METHOD="phone";/** 1193 * @license 1194 * Copyright 2019 Google LLC 1195 * 1196 * Licensed under the Apache License, Version 2.0 (the "License"); 1197 * you may not use this file except in compliance with the License. 1198 * You may obtain a copy of the License at 1199 * 1200 * http://www.apache.org/licenses/LICENSE-2.0 1201 * 1202 * Unless required by applicable law or agreed to in writing, software 1203 * distributed under the License is distributed on an "AS IS" BASIS, 1204 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1205 * See the License for the specific language governing permissions and 1206 * limitations under the License. 1207 */let IdpCredential=class IdpCredential extends AuthCredential{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return signInWithIdp(e,this._buildIdpRequest())}_linkToIdToken(e,t){return signInWithIdp(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return signInWithIdp(e,this._buildIdpRequest())}_buildIdpRequest(e){let t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}};function _signIn(e){return _signInWithCredential(e.auth,new IdpCredential(e),e.bypassAuthState)}function _reauth(e){let{auth:t,user:n}=e;return _assert(n,t,"internal-error"),_reauthenticate(n,new IdpCredential(e),e.bypassAuthState)}async function _link(e){let{auth:t,user:n}=e;return _assert(n,t,"internal-error"),_link$1(n,new IdpCredential(e),e.bypassAuthState)}/** 1208 * @license 1209 * Copyright 2020 Google LLC 1210 * 1211 * Licensed under the Apache License, Version 2.0 (the "License"); 1212 * you may not use this file except in compliance with the License. 1213 * You may obtain a copy of the License at 1214 * 1215 * http://www.apache.org/licenses/LICENSE-2.0 1216 * 1217 * Unless required by applicable law or agreed to in writing, softw
1217are 1218 * distributed under the License is distributed on an "AS IS" BASIS, 1219 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1220 * See the License for the specific language governing permissions and 1221 * limitations under the License. 1222 */let AbstractPopupRedirectOperation=class AbstractPopupRedirectOperation{constructor(e,t,n,i,s=!1){this.auth=e,this.resolver=n,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:n,postBody:i,tenantId:s,error:o,type:l}=e;if(o){this.reject(o);return}let u={auth:this.auth,requestUri:t,sessionId:n,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(l)(u))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return _signIn;case"linkViaPopup":case"linkViaRedirect":return _link;case"reauthViaPopup":case"reauthViaRedirect":return _reauth;default:_fail(this.auth,"internal-error")}}resolve(e){this.pendingPromise||debugFail("Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){this.pendingPromise||debugFail("Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};/** 1223 * @license 1224 * Copyright 2020 Google LLC 1225 * 1226 * Licensed under the Apache License, Version 2.0 (the "License"); 1227 * you may not use this file except in compliance with the License. 1228 * You may obtain a copy of the License at 1229 * 1230 * http://www.apache.org/licenses/LICENSE-2.0 1231 * 1232 * Unless required by applicable law or agreed to in writing, software 1233 * distributed under the License is distributed on an "AS IS" BASIS, 1234 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1235 * See the License for the specific language governing permissions and 1236 * limitations under the License. 1237 */let $=new Delay(2e3,1e4);let PopupOperation=class PopupOperation extends AbstractPopupRedirectOperation{constructor(e,t,n,i,s){super(e,t,i,s),this.provider=n,this.authWindow=null,this.pollId=null,PopupOperation.currentPopupAction&&PopupOperation.currentPopupAction.cancel(),PopupOperation.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return _assert(e,this.auth,"internal-error"),e}async onExecution(){1===this.filter.length||debugFail("Popup operations only handle one event");let e=_generateEventId();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(_createError(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(_createError(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,PopupOperation.currentPopupAction=null}pollUserCancellation(){let poll=()=>{var e,t;if(null===(t=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===t?void 0:t.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(_createError(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(poll,$.get())};poll()}};PopupOperation.currentPopupAction=null;let z=new Map;let RedirectAction=class RedirectAction extends AbstractPopupRedirectOperation{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=z.get(this.auth._key());if(!e){try{let t=await _getAndClearPendingRedirectStatus(this.resolver,this.auth),n=t?await super.execute():null;e=()=>Promise.resolve(n)}catch(t){e=()=>Promise.reject(t)}z.set(this.auth._key(),e)}return this.bypassAuthState||z.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);
1237if("unknown"===e.type){this.resolve(null);return}if(e.eventId){let t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function _getAndClearPendingRedirectStatus(e,t){let n=_persistenceKeyName("pendingRedirect",t.config.apiKey,t.name),i=_getInstance(e._redirectPersistence);if(!await i._isAvailable())return!1;let s=await i._get(n)==="true";return await i._remove(n),s}function _overrideRedirectResult(e,t){z.set(e._key(),t)}async function _getRedirectResult(e,t,n=!1){let i=_castAuth(e),s=t?_getInstance(t):(_assert(i._popupRedirectResolver,i,"argument-error"),i._popupRedirectResolver),o=new RedirectAction(i,s,n),l=await o.execute();return l&&!n&&(delete l.user._redirectEventId,await i._persistUserIfCurrent(l.user),await i._setRedirectUser(null,t)),l}let AuthEventManager=class AuthEventManager{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return isNullRedirectEvent(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!isNullRedirectEvent(e)){let i=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(_createError(this.auth,i))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(eventUid(e))}saveEventToCache(e){this.cachedEventUids.add(eventUid(e)),this.lastProcessedEventTime=Date.now()}};function eventUid(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function isNullRedirectEvent({type:e,error:t}){return"unknown"===e&&(null==t?void 0:t.code)==="auth/no-auth-event"}/** 1238 * @license 1239 * Copyright 2020 Google LLC 1240 * 1241 * Licensed under the Apache License, Version 2.0 (the "License"); 1242 * you may not use this file except in compliance with the License. 1243 * You may obtain a copy of the License at 1244 * 1245 * http://www.apache.org/licenses/LICENSE-2.0 1246 * 1247 * Unless required by applicable law or agreed to in writing, software 1248 * distributed under the License is distributed on an "AS IS" BASIS, 1249 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1250 * See the License for the specific language governing permissions and 1251 * limitations under the License. 1252 */async function _getProjectConfig(e,t={}){return _performApiRequest(e,"GET","/v1/projects",t)}/** 1253 * @license 1254 * Copyright 2020 Google LLC 1255 * 1256 * Licensed under the Apache License, Version 2.0 (the "License"); 1257 * you may not use this file except in compliance with the License. 1258 * You may obtain a copy of the License at 1259 * 1260 * http://www.apache.org/licenses/LICENSE-2.0 1261 * 1262 * Unless required by applicable law or agreed to in writing, software 1263 * distributed under the License is distributed on an "AS IS" BASIS, 1264 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1265 * See the License for the specific language governing permissions and 1266 * limitations under the License. 1267 */let ee=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,et=/^https?/;async function _validateOrigin(e){if(e.config.emulator)return;let{authorizedDomains:t}=await _getProjectConfig(e);for(let e of t)try{if(function(e){let t=_getCurrentUrl(),{protocol:n,hostname:i}=new URL(t);if(e.startsWith("chrome-extension://")){let s=new URL(e);return""===s.hostname&&""===i?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===i}if(!et.test(n))return!1;if(ee.test(e))return i===e;let s=e.replace(/\./g,"\\."),o=RegExp("^(.+\\."+s+"|"+s+")$","i");return o.test(i)}(e))return}catch(e){}_fail(e,"unauthorized-domain")}/** 1268 * @license 1269 * Copyright 2020 Google LLC. 1270 * 1271 * Licensed under the Apache License, Version 2.0 (the "License");
1272 * you may not use this file except in compliance with the License. 1273 * You may obtain a copy of the License at 1274 * 1275 * http://www.apache.org/licenses/LICENSE-2.0 1276 * 1277 * Unless required by applicable law or agreed to in writing, software 1278 * distributed under the License is distributed on an "AS IS" BASIS, 1279 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1280 * See the License for the specific language governing permissions and 1281 * limitations under the License. 1282 */let er=new Delay(3e4,6e4);function resetUnloadedGapiModules(){let e=_window().___jsl;if(null==e?void 0:e.H){for(let t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}}let en=null,ei=new Delay(5e3,15e3),es={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},eo=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function _openIframe(e){let t=await (en=en||new Promise((t,n)=>{var i,s,o;function loadGapiIframe(){resetUnloadedGapiModules(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{resetUnloadedGapiModules(),n(_createError(e,"network-request-failed"))},timeout:er.get()})}if(null===(s=null===(i=_window().gapi)||void 0===i?void 0:i.iframes)||void 0===s?void 0:s.Iframe)t(gapi.iframes.getContext());else if(null===(o=_window().gapi)||void 0===o?void 0:o.load)loadGapiIframe();else{let t=_generateCallbackName("iframefcb");return _window()[t]=()=>{gapi.load?loadGapiIframe():n(_createError(e,"network-request-failed"))},_loadJS(`https://apis.google.com/js/api.js?onload=${t}`).catch(e=>n(e))}}).catch(e=>{throw en=null,e})),n=_window().gapi;return _assert(n,e,"internal-error"),t.open({where:document.body,url:function(e){let t=e.config;_assert(t.authDomain,e,"auth-domain-config-required");let n=t.emulator?_emulatorUrl(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,i={apiKey:t.apiKey,appName:e.name,v:o.Jn},l=eo.get(e.config.apiHost);l&&(i.eid=l);let u=e._getFrameworks();return u.length&&(i.fw=u.join(",")),`${n}?${(0,s.xO)(i).slice(1)}`}(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:es,dontclear:!0},t=>new Promise(async(n,i)=>{await t.restyle({setHideOnLeave:!1});let s=_createError(e,"network-request-failed"),o=_window().setTimeout(()=>{i(s)},ei.get());function clearTimerAndResolve(){_window().clearTimeout(o),n(t)}t.ping(clearTimerAndResolve).then(clearTimerAndResolve,()=>{i(s)})}))}/** 1283 * @license 1284 * Copyright 2020 Google LLC. 1285 * 1286 * Licensed under the Apache License, Version 2.0 (the "License"); 1287 * you may not use this file except in compliance with the License. 1288 * You may obtain a copy of the License at 1289 * 1290 * http://www.apache.org/licenses/LICENSE-2.0 1291 * 1292 * Unless required by applicable law or agreed to in writing, software 1293 * distributed under the License is distributed on an "AS IS" BASIS, 1294 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1295 * See the License for the specific language governing permissions and 1296 * limitations under the License. 1297 */let el={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};let AuthPopup=class AuthPopup{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}};let eu=encodeURIComponent("fac");async function _getRedirectUrl(e,t,n,i,l,u){_assert(e.config.authDomain,e,"auth-domain-config-required"),_assert(e.config.apiKey,e,"invalid-api-key");let h={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:i,v:o.Jn,eventId:l};if(t instanceof FederatedAuthProvider)for(let[n,i]of(t.setDefaultLanguage(e.languageCode),h.providerId=t.providerId||"",(0,s.xb)(t.getCustomParameters())||(h.customParameters=JSON.stringify(t.getCustomParameters())),Object.entries(u||{})))h[n]=i;if(t instanceof BaseOAuthProvider){let e=t.getScopes().filter(e=>""!==e);e.length>0&&(h.scopes=e.join(","))}for(let t of(e.tenantId&&(h.tid=e.tenantId),Object.keys(h)))void 0===h[t]&&delete h[t];let d=await e._getAppCheckToken(),_=d?`#${eu}=${encodeURIComponent(d)}`:"";return`${function({config:e}){return e.emulator?_emulatorUrl(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${(0,s.xO)(h).slice(1)}${_}`}
1297/** 1298 * @license 1299 * Copyright 2020 Google LLC 1300 * 1301 * Licensed under the Apache License, Version 2.0 (the "License"); 1302 * you may not use this file except in compliance with the License. 1303 * You may obtain a copy of the License at 1304 * 1305 * http://www.apache.org/licenses/LICENSE-2.0 1306 * 1307 * Unless required by applicable law or agreed to in writing, software 1308 * distributed under the License is distributed on an "AS IS" BASIS, 1309 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1310 * See the License for the specific language governing permissions and 1311 * limitations under the License. 1312 */let ec="webStorageSupport",eh=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=BrowserSessionPersistence,this._completeRedirectFn=_getRedirectResult,this._overrideRedirectResult=_overrideRedirectResult}async _openPopup(e,t,n,i){var o;(null===(o=this.eventManagers[e._key()])||void 0===o?void 0:o.manager)||debugFail("_initialize() not called before _openPopup()");let l=await _getRedirectUrl(e,t,n,_getCurrentUrl(),i);return function(e,t,n,i=500,o=600){let l=Math.max((window.screen.availHeight-o)/2,0).toString(),u=Math.max((window.screen.availWidth-i)/2,0).toString(),h="",d=Object.assign(Object.assign({},el),{width:i.toString(),height:o.toString(),top:l,left:u}),_=(0,s.z$)().toLowerCase();n&&(h=_isChromeIOS(_)?"_blank":n),_isFirefox(_)&&(t=t||"http://localhost",d.scrollbars="yes");let m=Object.entries(d).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=(0,s.z$)()){var t;return _isIOS(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(_)&&"_self"!==h)return function(e,t){let n=document.createElement("a");n.href=e,n.target=t;let i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}(t||"",h),new AuthPopup(null);let g=window.open(t||"",h,m);_assert(g,e,"popup-blocked");try{g.focus()}catch(e){}return new AuthPopup(g)}(e,l,_generateEventId())}async _openRedirect(e,t,n,i){await this._originValidation(e);let s=await _getRedirectUrl(e,t,n,_getCurrentUrl(),i);return _window().location.href=s,new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){let{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(n||debugFail("If manager is not set, promise should be"),n)}let n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){let t=await _openIframe(e),n=new AuthEventManager(e);return t.register("authEvent",t=>{_assert(null==t?void 0:t.authEvent,e,"invalid-auth-event");let i=n.onEvent(t.authEvent);return{status:i?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){let n=this.iframes[e._key()];n.send(ec,{type:ec},n=>{var i;let s=null===(i=null==n?void 0:n[0])||void 0===i?void 0:i[ec];void 0!==s&&t(!!s),_fail(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=_validateOrigin(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return _isMobileBrowser()||_isSafari()||_isIOS()}};let MultiFactorAssertionImpl=class MultiFactorAssertionImpl{constructor(e){this.factorId=e}_process(e,t,n){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,n);case"signin":return this._finalizeSignIn(e,t.credential);default:return debugFail("unexpected MultiFactorSessionType")}}};let PhoneMultiFactorAssertionImpl=class PhoneMultiFactorAssertionImpl extends MultiFactorAssertionImpl{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new PhoneMultiFactorAssertionImpl(e)}_finalizeEnroll(e,t,n){return _performApiRequest(e,"POST","/v2/accounts/mfaEnrollment:finalize",_addTidIfNecessary(e,{idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()}))}_finalizeSignIn(e,t){return _performApiRequest(e,"POST","/v2/accounts/mfaSignIn:finalize",_addTidIfNecessary(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()}))}};let TotpMultiFactorAssertionImpl=class TotpMultiFactorAssertionImpl extends MultiFactorAssertionImpl{constructor(e,t,n){super("totp"),this.otp=e,this.enrollmentId=t,this.secret=n}static _fromSecret(e,t){return new TotpMultiFactorAssertionImpl(t,void 0,e)}static _fromEnrollmentId(e,t){return new TotpMultiFactorAssertionImpl(t,e)}async _finalizeEnroll(e,t,n){return _assert(void 0!==this.secret,e,"argument-error"),_performApiRequest(e,"POST","/v2/accounts/mfaEnrollment:finalize",_addTidIfNecessary(e,{idToken:t,displayName:n,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)}))}async _finalizeSignIn(e,t){_assert(void 0!==this.enrollmentId&&void 0!==this.otp,e,"argument-error");let n={verificationCode:this.otp};return _performApiRequest(e,"POST","/v2/accounts/mfaSignIn:finalize",_addTidIfNecessary(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:n}))}};let TotpSecret=class TotpSecret{constructor(e,t,n,i,s,o,l){this.sessionInfo=o,this.auth=l,this.secretKey=e,this.hashingAlgorithm=t,this.co
1312deLength=n,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,t){return new TotpSecret(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,t)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){var n;let i=!1;return(_isEmptyString(e)||_isEmptyString(t))&&(i=!0),i&&(_isEmptyString(e)&&(e=(null===(n=this.auth.currentUser)||void 0===n?void 0:n.email)||"unknownuser"),_isEmptyString(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function _isEmptyString(e){return void 0===e||(null==e?void 0:e.length)===0}var e_="@firebase/auth",ef="1.3.0";/** 1313 * @license 1314 * Copyright 2020 Google LLC 1315 * 1316 * Licensed under the Apache License, Version 2.0 (the "License"); 1317 * you may not use this file except in compliance with the License. 1318 * You may obtain a copy of the License at 1319 * 1320 * http://www.apache.org/licenses/LICENSE-2.0 1321 * 1322 * Unless required by applicable law or agreed to in writing, software 1323 * distributed under the License is distributed on an "AS IS" BASIS, 1324 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1325 * See the License for the specific language governing permissions and 1326 * limitations under the License. 1327 */let AuthInterop=class AuthInterop{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;let t=await this.auth.currentUser.getIdToken(e);return{accessToken:t}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let t=this.auth.onIdTokenChanged(t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){_assert(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};let ep=(0,s.Pz)("authIdTokenMaxAge")||300,em=null,mintCookieFactory=e=>async t=>{let n=t&&await t.getIdTokenResult(),i=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(i&&i>ep)return;let s=null==n?void 0:n.token;em!==s&&(em=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function getAuth(e=(0,o.Mq)()){let t=(0,o.qX)(e,"auth");if(t.isInitialized())return t.getImmediate();let n=/** 1328 * @license 1329 * Copyright 2020 Google LLC 1330 * 1331 * Licensed under the Apache License, Version 2.0 (the "License"); 1332 * you may not use this file except in compliance with the License. 1333 * You may obtain a copy of the License at 1334 * 1335 * http://www.apache.org/licenses/LICENSE-2.0 1336 * 1337 * Unless required by applicable law or agreed to in writing, software 1338 * distributed under the License is distributed on an "AS IS" BASIS, 1339 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1340 * See the License for the specific language governing permissions and 1341 * limitations under the License. 1342 */function(e,t){let n=(0,o.qX)(e,"auth");if(n.isInitialized()){let e=n.getImmediate(),i=n.getOptions();if((0,s.vZ)(i,null!=t?t:{}))return e;_fail(e,"already-initialized")}let i=n.initialize({options:t});return i}(e,{popupRedirectResolver:eh,persistence:[IndexedDBLocalPersistence,V,BrowserSessionPersistence]}),i=(0,s.Pz)("authTokenSyncURL");if(i){let e=mintCookieFactory(i);(0,s.m9)(n).beforeAuthStateChanged(e,()=>e(n.currentUser)),(0,s.m9)(n).onIdTokenChanged(t=>e(t),void 0,void 0)}let l=(0,s.q4)("auth");return l&&function(e,t,n){let i=_castAuth(e);_assert(i._canInitEmulator,i,"emulator-config-failed"),_assert(/^https?:\/\//.test(t),i,"invalid-emulator-scheme");let s=!!(null==n?void 0:n.disableWarnings),o=extractProtocol(t),{host:l,port:u}=function(e){let t=extractProtocol(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};let i=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(i);if(s){let e=s[1];return{host:e,port:parsePort(i.substr(e.length+1))}}{let[e,t]=i.split(":");return{host:e,port:parsePort(t)}}}(t),h=null===u?"":`:${u}`;
1342i.config.emulator={url:`${o}//${l}${h}/`},i.settings.appVerificationDisabledForTesting=!0,i.emulatorConfig=Object.freeze({host:l,port:u,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})}),s||function(){function attachBanner(){let e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(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."),"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",attachBanner):attachBanner())}()}(n,`http://${l}`),n}i="Browser",(0,o.Xd)(new u.wA("auth",(e,{options:t})=>{let n=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:l,authDomain:u}=n.options;_assert(l&&!l.includes(":"),"invalid-api-key",{appName:n.name});let h={apiKey:l,authDomain:u,clientPlatform:i,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:_getClientVersion(i)},d=new AuthImpl(n,s,o,h);return function(e,t){let n=(null==t?void 0:t.persistence)||[],i=(Array.isArray(n)?n:[n]).map(_getInstance);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(i,null==t?void 0:t.popupRedirectResolver)}(d,t),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{let i=e.getProvider("auth-internal");i.initialize()})),(0,o.Xd)(new u.wA("auth-internal",e=>{let t=_castAuth(e.getProvider("auth").getImmediate());return new AuthInterop(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),(0,o.KN)(e_,ef,/** 1343 * @license 1344 * Copyright 2020 Google LLC 1345 * 1346 * Licensed under the Apache License, Version 2.0 (the "License"); 1347 * you may not use this file except in compliance with the License. 1348 * You may obtain a copy of the License at 1349 * 1350 * http://www.apache.org/licenses/LICENSE-2.0 1351 * 1352 * Unless required by applicable law or agreed to in writing, software 1353 * distributed under the License is distributed on an "AS IS" BASIS, 1354 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1355 * See the License for the specific language governing permissions and 1356 * limitations under the License. 1357 */function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(i)),(0,o.KN)(e_,ef,"esm2017")},6100:function(e,t,n){"use strict";n.d(t,{ET:function(){return addDoc},hJ:function(){return collection},oe:function(){return deleteDoc},JU:function(){return doc},PL:function(){return getDocs},ad:function(){return getFirestore},b9:function(){return limit},Xo:function(){return orderBy},IO:function(){return query},pl:function(){return setDoc},r7:function(){return updateDoc},ar:function(){return where}});var i,s,o,l,u,h,d,_=n(5816),m=n(8463),g=n(3333),E=n(4444),b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},V={},k=k||{},L=b||self;function aa(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function p(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function ea(e,t,n){return e.call.apply(e.bind,arguments)}function fa(e,t,n){if(!e)throw Error();if(2<arguments.length){var i=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,i),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function q(e,t,n){return(q=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ea:fa).apply(null,arguments)}
1357function ha(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function r(e,t){function c(){}c.prototype=t.prototype,e.$=t.prototype,e.prototype=new c,e.prototype.constructor=e,e.ac=function(e,n,i){for(var s=Array(arguments.length-2),o=2;o<arguments.length;o++)s[o-2]=arguments[o];return t.prototype[n].apply(e,s)}}function v(){this.s=this.s,this.o=this.o}v.prototype.s=!1,v.prototype.sa=function(){this.s||(this.s=!0,this.N())},v.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};let j=Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t,void 0)}:function(e,t){if("string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.indexOf(t,0);for(let n=0;n<e.length;n++)if(n in e&&e[n]===t)return n;return -1};function ma(e){let t=e.length;if(0<t){let n=Array(t);for(let i=0;i<t;i++)n[i]=e[i];return n}return[]}function na(e,t){for(let t=1;t<arguments.length;t++){let n=arguments[t];if(aa(n)){let t=e.length||0,i=n.length||0;e.length=t+i;for(let s=0;s<i;s++)e[t+s]=n[s]}else e.push(n)}}function w(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}w.prototype.h=function(){this.defaultPrevented=!0};var $=function(){if(!L.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{L.addEventListener("test",()=>{},t),L.removeEventListener("test",()=>{},t)}catch(e){}return e}();function x(e){return/^[\s\xa0]*$/.test(e)}function pa(){var e=L.navigator;return e&&(e=e.userAgent)?e:""}function y(e){return -1!=pa().indexOf(e)}function qa(e){return qa[" "](e),e}qa[" "]=function(){};var z=y("Opera"),ee=y("Trident")||y("MSIE"),et=y("Edge"),er=et||ee,en=y("Gecko")&&!(-1!=pa().toLowerCase().indexOf("webkit")&&!y("Edge"))&&!(y("Trident")||y("MSIE"))&&!y("Edge"),ei=-1!=pa().toLowerCase().indexOf("webkit")&&!y("Edge");function ya(){var e=L.document;return e?e.documentMode:void 0}e:{var es,eo="",el=(es=pa(),en?/rv:([^\);]+)(\)|;)/.exec(es):et?/Edge\/([\d\.]+)/.exec(es):ee?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(es):ei?/WebKit\/(\S+)/.exec(es):z?/(?:Version)[ \/]?(\S+)/.exec(es):void 0);if(el&&(eo=el?el[1]:""),ee){var eu=ya();if(null!=eu&&eu>parseFloat(eo)){s=String(eu);break e}}s=eo}var ec=L.document&&ee&&(ya()||parseInt(s,10))||void 0;function A(e,t){if(w.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,i=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(en){e:{try{qa(t.nodeName);var s=!0;break e}catch(e){}s=!1}s||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,i?(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:eh[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&A.$.h.call(this)}}r(A,w);var eh={2:"touch",3:"pen",4:"mouse"};A.prototype.h=function(){A.$.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var e_="closure_listenable_"+(1e6*Math.random()|0),ef=0;function Ja(e,t,n,i,s){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!i,this.la=s,this.key=++ef,this.fa=this.ia=!1}function Ka(e){e.fa=!0,e.listener=null,e.proxy=null,e.src=null,e.la=null}function Na(e,t,n){for(let i in e)t.call(n,e[i],i,e)}function Pa(e){let t={};for(let n in e)t[n]=e[n];return t}let ep="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
1357ing toString valueOf".split(" ");function Ra(e,t){let n,i;for(let t=1;t<arguments.length;t++){for(n in i=arguments[t])e[n]=i[n];for(let t=0;t<ep.length;t++)n=ep[t],Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}}function Sa(e){this.src=e,this.g={},this.h=0}function Ua(e,t){var n=t.type;if(n in e.g){var i,s=e.g[n],o=j(s,t);(i=0<=o)&&Array.prototype.splice.call(s,o,1),i&&(Ka(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function Ta(e,t,n,i){for(var s=0;s<e.length;++s){var o=e[s];if(!o.fa&&o.listener==t&&!!n==o.capture&&o.la==i)return s}return -1}Sa.prototype.add=function(e,t,n,i,s){var o=e.toString();(e=this.g[o])||(e=this.g[o]=[],this.h++);var l=Ta(e,t,i,s);return -1<l?(t=e[l],n||(t.ia=!1)):((t=new Ja(t,this.src,o,!!i,s)).ia=n,e.push(t)),t};var em="closure_lm_"+(1e6*Math.random()|0),eg={};function ab(e,t,n,i,s,o){if(!t)throw Error("Invalid event type");var l=p(s)?!!s.capture:!!s,u=bb(e);if(u||(e[em]=u=new Sa(e)),(n=u.add(t,n,i,l,o)).proxy)return n;if(i=function a(e){return eb.call(a.src,a.listener,e)},n.proxy=i,i.src=e,i.listener=n,e.addEventListener)$||(s=l),void 0===s&&(s=!1),e.addEventListener(t.toString(),i,s);else if(e.attachEvent)e.attachEvent(db(t.toString()),i);else if(e.addListener&&e.removeListener)e.addListener(i);else throw Error("addEventListener and attachEvent are unavailable.");return n}function gb(e){if("number"!=typeof e&&e&&!e.fa){var t=e.src;if(t&&t[e_])Ua(t.i,e);else{var n=e.type,i=e.proxy;t.removeEventListener?t.removeEventListener(n,i,e.capture):t.detachEvent?t.detachEvent(db(n),i):t.addListener&&t.removeListener&&t.removeListener(i),(n=bb(t))?(Ua(n,e),0==n.h&&(n.src=null,t[em]=null)):Ka(e)}}}function db(e){return e in eg?eg[e]:eg[e]="on"+e}function eb(e,t){if(e.fa)e=!0;else{t=new A(t,this);var n=e.listener,i=e.la||e.src;e.ia&&gb(e),e=n.call(i,t)}return e}function bb(e){return(e=e[em])instanceof Sa?e:null}var ey="__closure_events_fn_"+(1e9*Math.random()>>>0);function $a(e){return"function"==typeof e?e:(e[ey]||(e[ey]=function(t){return e.handleEvent(t)}),e[ey])}function B(){v.call(this),this.i=new Sa(this),this.S=this,this.J=null}function C(e,t){var n,i=e.J;if(i)for(n=[];i;i=i.J)n.push(i);if(e=e.S,i=t.type||t,"string"==typeof t)t=new w(t,e);else if(t instanceof w)t.target=t.target||e;else{var s=t;Ra(t=new w(i,e),s)}if(s=!0,n)for(var o=n.length-1;0<=o;o--){var l=t.g=n[o];s=ib(l,i,!0,t)&&s}if(s=ib(l=t.g=e,i,!0,t)&&s,s=ib(l,i,!1,t)&&s,n)for(o=0;o<n.length;o++)s=ib(l=t.g=n[o],i,!1,t)&&s}function ib(e,t,n,i){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var s=!0,o=0;o<t.length;++o){var l=t[o];if(l&&!l.fa&&l.capture==n){var u=l.listener,h=l.la||l.src;l.ia&&Ua(e.i,l),s=!1!==u.call(h,i)&&s}}return s&&!i.defaultPrevented}r(B,v),B.prototype[e_]=!0,B.prototype.removeEventListener=function(e,t,n,i){!function fb(e,t,n,i,s){if(Array.isArray(t))for(var o=0;o<t.length;o++)fb(e,t[o],n,i,s);else(i=p(i)?!!i.capture:!!i,n=$a(n),e&&e[e_])?(e=e.i,(t=String(t).toString())in e.g&&-1<(n=Ta(o=e.g[t],n,i,s))&&(Ka(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete e.g[t],e.h--))):e&&(e=bb(e))&&(t=e.g[t.toString()],e=-1,t&&(e=Ta(t,n,i,s)),(n=-1<e?t[e]:null)&&gb(n))}(this,e,t,n,i)},B.prototype.N=function(){if(B.$.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],i=0;i<n.length;i++)Ka(n[i]);delete t.g[e],t.h--}}this.J=null},B.prototype.O=function(e,t,n,i){return this.i.add(String(e),t,!1,n,i)},B.prototype.P=function(e,t,n,i){return this.i.add(String(e),t,!0,n,i)};var eE=L.JSON.stringify,eT=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new pb,e=>e.reset());let pb=class pb{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}};let eI,ev=!1,eP=new class{constructor(){this.h=this.g=null}add(e,t){let n=eT.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},vb=()=>{let e=L.Promise.resolve(void 0);eI=()=>{e.then(ub)}};var ub=()=>{let e;for(var t;e=null,eP.g&&(e=eP.g,eP.g=eP.g.next,eP.g||(eP.h=null),e.next=null),t=e;){try{t.h.call(t.g)}catch(e){!function(e){L.setTimeout(()=>{throw e},0)}(e)}eT.j(t),100>eT.h&&(eT.h++,t.next=eT.g,eT.g=t)}ev=!1};function wb(e,t){B.call(this),this.h=e||1,this.g=t||L,this.j=q(this.qb,this),this.l=Date.now()}function xb(e){e.ga=!1,e.T&&(e.g.clearTimeout(e.T),e.T=null)}function yb(e,t,n){if("function"==typeof e)n&&(e=q(e,n));else if(e&&"function"==typeof e.handleEvent)e=q(e.handleEvent,e);else throw Error("Invalid listener argument");return 2147483647<Number(t)?-1:L.setTimeout(e,t||0)}r(wb,B),(d=wb.prototype).ga=!1,d.T=null,d.qb=function(){if(this.ga){var e=Date.now()-this.l;0<e&&e<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-e):(this.T&&(this.g.clearTimeout(this.T),this.T=null),C(this,"tick"),this.ga&&(xb(this),this.start()))}},d.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())},d.N=function(){wb.$.N.call(this),xb(this),delete this.g};let Ab=class Ab extends v{constructor(e,t){super(),this.m=e,this.j=t,this.h=null,this.i=!1,this.g=null}l(e){this.h=arguments,this.g?this.i=!0:function zb(e){e.g=yb(()=>{e.g=null,e.i&&(e.i=!1,zb(e))},e.j);let t=e.h;e.h=null,e.m.apply(null,t)}(this)}N(){super.N(),this.g&&(L.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}};function Bb(e){v.call(this),this.h=e,this.g={}}r(Bb,v);var eA=[];function Db(e,t,n,i){Array.isArray(n)||(n&&(eA[0]=n.toString()),n=eA);for(var s=0;s<n.length;s++){var o=function Ya(e,t,n,i,s){if(i&&i.once)return function Za(e,t,n,i,s){if(Array.isArray(t)){for(var o=0;o<t.length;o++)Za(e,t[o],n,i,s);return null}return n=$a(n),e&&e[e_]?e.P(t,n,p(i)?!!i.capture:!!i,s):ab(e,t,n,!0,i,s)}(e,t,n,i,s);if(Array.isArray(t)){for(var o=0;o<t.length;o++)Ya(e,t[o],n,i,s);return null}return n=$a(n),e&&e[e_]?e.O(t,n,p(i)?!!i.capture:!!i,s):ab(e,t,n,!1,i,s)}(t,n[s],i||e.handleEvent,!1,e.h||e);if(!o)break;e.g[o.key]=o}}function Fb(e){Na(e.g,function(e,t){this.g.hasOwnProperty(t)&&gb(e)},e),e.g={}}function Gb(){this.g=!0}function D(e,t,n,i){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n){for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var i=n[e];if(!(2>i.length)){var s=i[1];if(Array.isArray(s)&&!(1>s.length)){var o=s[0];if("noop"!=o&&"stop"!=o&&"close"!=o)for(var l=1;l<s.length;l++)s[l]=""}}}}return eE(n)}catch(e){return t}}(e,n)+(i?" "+i:"")})}Bb.prototype.N=function(){Bb.$.N.call(this),Fb(this)},Bb.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},Gb.prototype.Ea=function(){this.g=!1},Gb.prototype.info=function(){};var eR={},ew=null;function Mb(){return ew=ew||new B}function Nb(e){w.call(this,eR.Ta,e)}function Ob(e){let t=Mb();C(t,new Nb(t))}function Pb(e,t){w.call(this,eR.STAT_EVENT,e),this.stat=t}function F(e){let t=Mb();C(t,new Pb(t,e))}function Qb(e,t){w.call(this,eR.Ua,e),this.size=t}function Rb(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return L.setTimeout(function(){e()},t)}eR.Ta="serverreachability",r(Nb,w),eR.STAT_EVENT="statevent",r(Pb,w),eR.Ua="timingevent",r(Qb,w);var eS={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9}
1357,eV={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function Ub(){}function Vb(e){return e.h||(e.h=e.i())}function Wb(){}Ub.prototype.h=null;var eC={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function Yb(){w.call(this,"d")}function Zb(){w.call(this,"c")}function ac(){}function bc(e,t,n,i){this.l=e,this.j=t,this.m=n,this.W=i||1,this.U=new Bb(this),this.P=ek,e=er?125:void 0,this.V=new wb(e),this.I=null,this.i=!1,this.s=this.A=this.v=this.L=this.G=this.Y=this.B=null,this.F=[],this.g=null,this.C=0,this.o=this.u=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new dc}function dc(){this.i=null,this.g="",this.h=!1}r(Yb,w),r(Zb,w),r(ac,Ub),ac.prototype.g=function(){return new XMLHttpRequest},ac.prototype.i=function(){return{}},l=new ac;var ek=45e3,eD={},eO={};function gc(e,t,n){e.L=1,e.v=hc(G(t)),e.s=n,e.S=!0,ic(e,null)}function ic(e,t){e.G=Date.now(),jc(e),e.A=G(e.v);var n=e.A,i=e.W;Array.isArray(i)||(i=[String(i)]),kc(n.i,"t",i),e.C=0,n=e.l.J,e.h=new dc,e.g=lc(e.l,n?t:null,!e.s),0<e.O&&(e.M=new Ab(q(e.Pa,e,e.g),e.O)),Db(e.U,e.g,"readystatechange",e.nb),t=e.I?Pa(e.I):{},e.s?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ha(e.A,e.u,e.s,t)):(e.u="GET",e.g.ha(e.A,e.u,null,t)),Ob(),function(e,t,n,i,s,o){e.info(function(){if(e.g){if(o)for(var l="",u=o.split("&"),h=0;h<u.length;h++){var d=u[h].split("=");if(1<d.length){var _=d[0];d=d[1];var m=_.split("_");l=2<=m.length&&"type"==m[1]?l+(_+"=")+d+"&":l+(_+"=redacted&")}}else l=null}else l=o;return"XMLHTTP REQ ("+i+") [attempt "+s+"]: "+t+"\n"+n+"\n"+l})}(e.j,e.u,e.A,e.m,e.W,e.s)}function oc(e){return!!e.g&&"GET"==e.u&&2!=e.L&&e.l.Ha}function rc(e,t,n){let i=!0,s;for(;!e.J&&e.C<n.length;)if((s=function(e,t){var n=e.C,i=t.indexOf("\n",n);return -1==i?eO:isNaN(n=Number(t.substring(n,i)))?eD:(i+=1)+n>t.length?eO:(t=t.slice(i,i+n),e.C=i+n,t)}(e,n))==eO){4==t&&(e.o=4,F(14),i=!1),D(e.j,e.m,null,"[Incomplete Response]");break}else if(s==eD){e.o=4,F(15),D(e.j,e.m,n,"[Invalid Chunk]"),i=!1;break}else D(e.j,e.m,s,null),qc(e,s);oc(e)&&s!=eO&&s!=eD&&(e.h.g="",e.C=0),4!=t||0!=n.length||e.h.h||(e.o=1,F(16),i=!1),e.i=e.i&&i,i?0<n.length&&!e.ba&&(e.ba=!0,(t=e.l).g==e&&t.ca&&!t.M&&(t.l.info("Great, no buffering proxy detected. Bytes received: "+n.length),vc(t),t.M=!0,F(11))):(D(e.j,e.m,n,"[Invalid Chunked Response]"),I(e),pc(e))}function jc(e){e.Y=Date.now()+e.P,wc(e,e.P)}function wc(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Rb(q(e.lb,e),t)}function nc(e){e.B&&(L.clearTimeout(e.B),e.B=null)}function pc(e){0==e.l.H||e.J||sc(e.l,e)}function I(e){nc(e);var t=e.M;t&&"function"==typeof t.sa&&t.sa(),e.M=null,xb(e.V),Fb(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.sa())}function qc(e,t){try{var n=e.l;if(0!=n.H&&(n.g==e||xc(n.i,e))){if(!e.K&&xc(n.i,e)&&3==n.H){try{var i=n.Ja.g.parse(t)}catch(e){i=null}if(Array.isArray(i)&&3==i.length){var s=i;if(0==s[0]){e:if(!n.u){if(n.g){if(n.g.G+3e3<e.G)yc(n),zc(n);else break e}Ac(n),F(18)}}else n.Fa=s[1],0<n.Fa-n.V&&37500>s[2]&&n.G&&0==n.A&&!n.v&&(n.v=Rb(q(n.ib,n),6e3));if(1>=Bc(n.i)&&n.oa){try{n.oa()}catch(e){}n.oa=void 0}}else J(n,11)}else if((e.K||n.g==e)&&yc(n),!x(t))for(s=n.Ja.g.parse(t),t=0;t<s.length;t++){let u=s[t];if(n.V=u[0],u=u[1],2==n.H){if("c"==u[0]){n.K=u[1],n.pa=u[2];let t=u[3];null!=t&&(n.ra=t,n.l.info("VER="+n.ra));let s=u[4];null!=s&&(n.Ga=s,n.l.info("SVER="+n.Ga));let h=u[5];null!=h&&"number"==typeof h&&0<h&&(i=1.5*h,n.L=i,n.l.info("backChannelRequestTimeoutMs_="+i)),i=n;let d=e.g;if(d){let e=d.g?d.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var o=i.i;o.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(o.j=o.l,o.g=new Set,o.h&&(Cc(o,o.h),o.h=null))}if(i.F){let e=d.g?d.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(i.Da=e,K(i.I,i.F,e))}}if(n.H=3,n.h&&n.h.Ba(),n.ca&&(n.S=Date.now()-e.G,n.l.info("Handshake RTT: "+n.S+"ms")),(i=n).wa=Dc(i,i.J?i.pa:null,i.Y),e.K){Ec(i.i,e);var l=i.L;l&&e.setTimeout(l),e.B&&(nc(e),jc(e)),i.g=e}else Fc(i);0<n.j.length&&Gc(n)}else"stop"!=u[0]&&"close"!=u[0]||J(n,7)}else 3==n.H&&("stop"==u[0]||"close"==u[0]?"stop"==u[0]?J(n,7):Hc(n):"noop"!=u[0]&&n.h&&n.h.Aa(u),n.A=0)}}Ob(4)}catch(e){}}function Kc(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(aa(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.ta&&"function"==typeof e.ta)return e.ta();if(!e.Z||"function"!=typeof e.Z){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(aa(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}for(let i in t=[],n=0,e)t[n++]=i;return t}}}(e),i=function(e){if(e.Z&&"function"==typeof e.Z)return e.Z();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");
1357if(aa(e)){for(var t=[],n=e.length,i=0;i<n;i++)t.push(e[i]);return t}for(i in t=[],n=0,e)t[n++]=e[i];return t}(e),s=i.length,o=0;o<s;o++)t.call(void 0,i[o],n&&n[o],e)}(d=bc.prototype).setTimeout=function(e){this.P=e},d.nb=function(e){e=e.target;let t=this.M;t&&3==H(e)?t.l():this.Pa(e)},d.Pa=function(e){try{if(e==this.g)e:{let _=H(this.g);var t=this.g.Ia();let m=this.g.da();if(!(3>_)&&(3!=_||er||this.g&&(this.h.h||this.g.ja()||mc(this.g)))){this.J||4!=_||7==t||(8==t||0>=m?Ob(3):Ob(2)),nc(this);var n=this.g.da();this.ca=n;t:if(oc(this)){var i=mc(this.g);e="";var s=i.length,o=4==H(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){I(this),pc(this);var l="";break t}this.h.i=new L.TextDecoder}for(t=0;t<s;t++)this.h.h=!0,e+=this.h.i.decode(i[t],{stream:o&&t==s-1});i.splice(0,s),this.h.g+=e,this.C=0,l=this.h.g}else l=this.g.ja();if(this.i=200==n,function(e,t,n,i,s,o,l){e.info(function(){return"XMLHTTP RESP ("+i+") [ attempt "+s+"]: "+t+"\n"+n+"\n"+o+" "+l})}(this.j,this.u,this.A,this.m,this.W,_,n),this.i){if(this.aa&&!this.K){t:{if(this.g){var u,h=this.g;if((u=h.g?h.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!x(u)){var d=u;break t}}d=null}if(n=d)D(this.j,this.m,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,qc(this,n);else{this.i=!1,this.o=3,F(12),I(this),pc(this);break e}}this.S?(rc(this,_,l),er&&this.i&&3==_&&(Db(this.U,this.V,"tick",this.mb),this.V.start())):(D(this.j,this.m,l,null),qc(this,l)),4==_&&I(this),this.i&&!this.J&&(4==_?sc(this.l,this):(this.i=!1,jc(this)))}else(function(e){let t={};e=(e.g&&2<=H(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let i=0;i<e.length;i++){if(x(e[i]))continue;var n=function(e){var t=1;e=e.split(":");let n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}(e[i]);let s=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();let o=t[s]||[];t[s]=o,o.push(n)}!function(e,t){for(let n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==n&&0<l.indexOf("Unknown SID")?(this.o=3,F(12)):(this.o=0,F(13)),I(this),pc(this)}}}catch(e){}finally{}},d.mb=function(){if(this.g){var e=H(this.g),t=this.g.ja();this.C<t.length&&(nc(this),rc(this,e,t),this.i&&4!=e&&jc(this))}},d.cancel=function(){this.J=!0,I(this)},d.lb=function(){this.B=null;let e=Date.now();0<=e-this.Y?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.j,this.A),2!=this.L&&(Ob(),F(17)),I(this),this.o=2,pc(this)):wc(this,this.Y-e)};var eN=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function M(e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,e instanceof M){this.h=e.h,Nc(this,e.j),this.s=e.s,this.g=e.g,Oc(this,e.m),this.l=e.l;var t=e.i,n=new Pc;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),Qc(this,n),this.o=e.o}else e&&(t=String(e).match(eN))?(this.h=!1,Nc(this,t[1]||"",!0),this.s=Rc(t[2]||""),this.g=Rc(t[3]||"",!0),Oc(this,t[4]),this.l=Rc(t[5]||"",!0),Qc(this,t[6]||"",!0),this.o=Rc(t[7]||"")):(this.h=!1,this.i=new Pc(null,this.h))}function G(e){return new M(e)}function Nc(e,t,n){e.j=n?Rc(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function Oc(e,t){if(t){if(isNaN(t=Number(t))||0>t)throw Error("Bad port number "+t);e.m=t}else e.m=null}function Qc(e,t,n){var i,s;t instanceof Pc?(e.i=t,i=e.i,(s=e.h)&&!i.j&&(N(i),i.i=null,i.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&($c(this,t),kc(this,n,e))},i)),i.j=s):(n||(t=Sc(t,eF)),e.i=new Pc(t,e.h))}function K(e,t,n){e.i.set(t,n)}function hc(e){return K(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function Rc(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function Sc(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,Zc),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Zc(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}M.prototype.toString=function(){var e=[],t=this.j;t&&e.push(Sc(t,eL,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.s)&&e.push(Sc(t,eL,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(Sc(n,"/"==n.charAt(0)?ex:eM,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.o)&&e.push("#",Sc(n,eU)),e.join("")};var eL=/[#\/\?@]/g,eM=/[#\?:]/g,ex=/[#\?]/g,eF=/[#\?@]/g,eU=/#/g;function Pc(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function N(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var i=e[n].indexOf("="),s=null;if(0<=i){var o=e[n].substring(0,i);s=e[n].substring(i+1)}else o=e[n];t(o,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function $c(e,t){N(e),t=O(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function ad(e,t){return N(e),t=O(e,t),e.g.has(t)}function kc(e,t,n){$c(e,t),0<n.length&&(e.i=null,e.g.set(O(e,t),ma(n)),e.h+=n.length)}function O(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}(d=Pc.prototype).add=function(e,t){N(this),this.i=null,e=O(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},d.forEach=function(e,t){N(this),this.g.forEach(function(n,i){n.forEac
1357h(function(n){e.call(t,n,i,this)},this)},this)},d.ta=function(){N(this);let e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let i=0;i<t.length;i++){let s=e[i];for(let e=0;e<s.length;e++)n.push(t[i])}return n},d.Z=function(e){N(this);let t=[];if("string"==typeof e)ad(this,e)&&(t=t.concat(this.g.get(O(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},d.set=function(e,t){return N(this),this.i=null,ad(this,e=O(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},d.get=function(e,t){return e&&0<(e=this.Z(e)).length?String(e[0]):t},d.toString=function(){if(this.i)return this.i;if(!this.g)return"";let e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var i=t[n];let o=encodeURIComponent(String(i)),l=this.Z(i);for(i=0;i<l.length;i++){var s=o;""!==l[i]&&(s+="="+encodeURIComponent(String(l[i]))),e.push(s)}}return this.i=e.join("&")};var eB=class{constructor(e,t){this.g=e,this.map=t}};function cd(e){this.l=e||ej,e=L.PerformanceNavigationTiming?0<(e=L.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):!!(L.g&&L.g.Ka&&L.g.Ka()&&L.g.Ka().dc),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var ej=10;function ed(e){return!!e.h||!!e.g&&e.g.size>=e.j}function Bc(e){return e.h?1:e.g?e.g.size:0}function xc(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Cc(e,t){e.g?e.g.add(t):e.h=t}function Ec(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function fd(e){if(null!=e.h)return e.i.concat(e.h.F);if(null!=e.g&&0!==e.g.size){let t=e.i;for(let n of e.g.values())t=t.concat(n.F);return t}return ma(e.i)}cd.prototype.cancel=function(){if(this.i=fd(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(let e of this.g.values())e.cancel();this.g.clear()}};var eq=class{stringify(e){return L.JSON.stringify(e,void 0)}parse(e){return L.JSON.parse(e,void 0)}};function hd(){this.g=new eq}function kd(e,t,n,i,s){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,s(i)}catch(e){}}function ld(e){this.l=e.ec||null,this.j=e.ob||!1}function md(e,t){B.call(this),this.F=e,this.u=t,this.m=void 0,this.readyState=e$,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}r(ld,Ub),ld.prototype.g=function(){return new md(this.l,this.j)},ld.prototype.i=(i={},function(){return i}),r(md,B);var e$=0;function qd(e){e.j.read().then(e.Xa.bind(e)).catch(e.ka.bind(e))}function pd(e){e.readyState=4,e.l=null,e.j=null,e.A=null,od(e)}function od(e){e.onreadystatechange&&e.onreadystatechange.call(e)}(d=md.prototype).open=function(e,t){if(this.readyState!=e$)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,od(this)},d.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;let t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};e&&(t.body=e),(this.F||L).fetch(new Request(this.B,t)).then(this.$a.bind(this),this.ka.bind(this))},d.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,pd(this)),this.readyState=e$},d.$a=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,od(this)),this.g&&(this.readyState=3,od(this),this.g))){if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(void 0!==L.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;qd(this)}else e.text().then(this.Za.bind(this),this.ka.bind(this))}},d.Xa=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?pd(this):od(this),3==this.readyState&&qd(this)}},d.Za=function(e){this.g&&(this.response=this.responseText=e,pd(this))},d.Ya=function(e){this.g&&(this.response=e,pd(this))},d.ka=function(){this.g&&pd(this)},d.setRequestHeader=function(e,t){this.v.append(e,t)},d.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},d.getAllResponseHeaders=function(){if(!this.h)return"";let e=[],t=this.h.entries();for(var n=t.next();!n.done;)e.push((n=n.value)[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(md.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}});var ez=L.JSON.parse;function P(e){B.call(this),this.headers=new Map,this.u=e||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=eK,this.L=this.M=!1}r(P,B);var eK="",eW=/^https?$/i,eG=["POST","PUT"];function vd(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,yd(e),zd(e)}function yd(e){e.F||(e.F=!0,C(e,"complete"),C(e,"error"))}function Ad(e){if(e.h&&void 0!==k&&(!e.C[1]||4!=H(e)||2!=e.da())){if(e.v&&4==H(e))yb(e.La,0,e);else if(C(e,"readystatechange"),4==H(e)){e.h=!1;try{let l=e.da();switch(l){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t,n,i=!0;break;default:i=!1}if(!(t=i)){if(n=0===l){var s=String(e.I).match(eN)[1]||null;!s&&L.self&&L.self.location&&(s=L.self.location.protocol.slice(0,-1)),n=!eW.test(s?s.toLowerCase():"")}t=n}if(t)C(e,"complete"),C(e,"success");else{e.m=6;try{var o=2<H(e)?e.g.statusText:""}catch(e){o=""}e.j=o+" ["+e.da()+"]",yd(e)}}finally{zd(e)}}}}function zd(e,t){if(e.g){wd(e);let n=e.g,i=e.C[0]?()=>{}:null;e.g=null,e.C=null,t||C(e,"ready");try{n.onreadystatechange=i}catch(e){}}}
1357function wd(e){e.g&&e.L&&(e.g.ontimeout=null),e.A&&(L.clearTimeout(e.A),e.A=null)}function H(e){return e.g?e.g.readyState:0}function mc(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.K){case eK:case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function Bd(e){let t="";return Na(e,function(e,n){t+=n+":"+e+"\r\n"}),t}function Cd(e,t,n){e:{for(i in n){var i=!1;break e}i=!0}i||(n=Bd(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):K(e,t,n))}function Dd(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Ed(e){this.Ga=0,this.j=[],this.l=new Gb,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=Dd("failFast",!1,e),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=Dd("baseRetryDelayMs",5e3,e),this.hb=Dd("retryDelaySeedMs",1e4,e),this.eb=Dd("forwardChannelMaxRetries",2,e),this.xa=Dd("forwardChannelRequestTimeoutMs",2e4,e),this.va=e&&e.xmlHttpFactory||void 0,this.Ha=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.i=new cd(e&&e.concurrentRequestLimit),this.Ja=new hd,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=e&&e.bc||!1,e&&e.Ea&&this.l.Ea(),e&&e.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&e&&e.detectBufferingProxy||!1,this.qa=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.qa=e.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}function Hc(e){if(Fd(e),3==e.H){var t=e.W++,n=G(e.I);if(K(n,"SID",e.K),K(n,"RID",t),K(n,"TYPE","terminate"),Gd(e,n),(t=new bc(e,e.l,t)).L=2,t.v=hc(G(n)),n=!1,L.navigator&&L.navigator.sendBeacon)try{n=L.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&L.Image&&((new Image).src=t.v,n=!0),n||(t.g=lc(t.l,null),t.g.ha(t.v)),t.G=Date.now(),jc(t)}Hd(e)}function zc(e){e.g&&(vc(e),e.g.cancel(),e.g=null)}function Fd(e){zc(e),e.u&&(L.clearTimeout(e.u),e.u=null),yc(e),e.i.cancel(),e.m&&("number"==typeof e.m&&L.clearTimeout(e.m),e.m=null)}function Gc(e){if(!ed(e.i)&&!e.m){e.m=!0;var t=e.Na;eI||vb(),ev||(eI(),ev=!0),eP.add(t,e),e.C=0}}function Ld(e,t){var n;n=t?t.m:e.W++;let i=G(e.I);K(i,"SID",e.K),K(i,"RID",n),K(i,"AID",e.V),Gd(e,i),e.o&&e.s&&Cd(i,e.o,e.s),n=new bc(e,e.l,n,e.C+1),null===e.o&&(n.I=e.s),t&&(e.j=t.F.concat(e.j)),t=Kd(e,n,1e3),n.setTimeout(Math.round(.5*e.xa)+Math.round(.5*e.xa*Math.random())),Cc(e.i,n),gc(n,i,t)}function Gd(e,t){e.na&&Na(e.na,function(e,n){K(t,n,e)}),e.h&&Kc({},function(e,n){K(t,n,e)})}function Kd(e,t,n){n=Math.min(e.j.length,n);var i=e.h?q(e.h.Va,e.h,e):null;e:{var s=e.j;let t=-1;for(;;){let e=["count="+n];-1==t?0<n?(t=s[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let o=!0;for(let l=0;l<n;l++){let n=s[l].g,u=s[l].map;if(0>(n-=t))t=Math.max(0,s[l].g-100),o=!1;else try{!function(e,t,n){let i=n||"";try{Kc(e,function(e,n){let s=e;p(e)&&(s=eE(e)),t.push(i+n+"="+encodeURIComponent(s))})}catch(e){throw t.push(i+"type="+encodeURIComponent("_badmap")),e}}(u,e,"req"+n+"_")}catch(e){i&&i(u)}}if(o){i=e.join("&");break e}}}return e=e.j.splice(0,n),t.F=e,i}function Fc(e){if(!e.g&&!e.u){e.ba=1;var t=e.Ma;eI||vb(),ev||(eI(),ev=!0),eP.add(t,e),e.A=0}}function Ac(e){return!e.g&&!e.u&&!(3<=e.A)&&(e.ba++,e.u=Rb(q(e.Ma,e),Jd(e,e.A)),e.A++,!0)}function vc(e){null!=e.B&&(L.clearTimeout(e.B),e.B=null)}function Md(e){e.g=new bc(e,e.l,"rpc",e.ba),null===e.o&&(e.g.I=e.s),e.g.O=0;var t=G(e.wa);K(t,"RID","rpc"),K(t,"SID",e.K),K(t,"AID",e.V),K(t,"CI",e.G?"0":"1"),!e.G&&e.qa&&K(t,"TO",e.qa),K(t,"TYPE","xmlhttp"),Gd(e,t),e.o&&e.s&&Cd(t,e.o,e.s),e.L&&e.g.setTimeout(e.L);var n=e.g;e=e.pa,n.L=1,n.v=hc(G(t)),n.s=null,n.S=!0,ic(n,e)}function yc(e){null!=e.v&&(L.clearTimeout(e.v),e.v=null)}function sc(e,t){var n=null;if(e.g==t){yc(e),vc(e),e.g=null;var i=2}else{if(!xc(e.i,t))return;n=t.F,Ec(e.i,t),i=1}if(0!=e.H){if(t.i){if(1==i){n=t.s?t.s.length:0,t=Date.now()-t.G;var s,o=e.C;C(i=Mb(),new Qb(i,n)),Gc(e)}else Fc(e)}else if(3==(o=t.o)||0==o&&0<t.ca||!(1==i&&(s=t,!(Bc(e.i)>=e.i.j-(e.m?1:0))&&(e.m?(e.j=s.F.concat(e.j),!0):1!=e.H&&2!=e.H&&!(e.C>=(e.cb?0:e.eb))&&(e.m=Rb(q(e.Na,e,s),Jd(e,e.C)),e.C++,!0)))||2==i&&Ac(e)))switch(n&&0<n.length&&((t=e.i).i=t.i.concat(n)),o){case 1:J(e,5);break;case 4:J(e,10);break;case 3:J(e,6);break;default:J(e,2)}}}function Jd(e,t){let n=e.ab+Math.floor(Math.random()*e.hb);return e.isActive()||(n*=2),n*t}function J(e,t){if(e.l.info("Error code "+t),2==t){var n=null;e.h&&(n=null);var i=q(e.pb,e);n||(n=new M("//www.google.com/images/cleardot.gif"),L.location&&"http"==L.location.protocol||Nc(n,"https"),hc(n)),function(e,t){let n=new Gb;if(L.Image){let i=new Image;
1357i.onload=ha(kd,n,i,"TestLoadImage: loaded",!0,t),i.onerror=ha(kd,n,i,"TestLoadImage: error",!1,t),i.onabort=ha(kd,n,i,"TestLoadImage: abort",!1,t),i.ontimeout=ha(kd,n,i,"TestLoadImage: timeout",!1,t),L.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=e}else t(!1)}(n.toString(),i)}else F(2);e.H=0,e.h&&e.h.za(t),Hd(e),Fd(e)}function Hd(e){if(e.H=0,e.ma=[],e.h){let t=fd(e.i);(0!=t.length||0!=e.j.length)&&(na(e.ma,t),na(e.ma,e.j),e.i.i.length=0,ma(e.j),e.j.length=0),e.h.ya()}}function Dc(e,t,n){var i=n instanceof M?G(n):new M(n);if(""!=i.g)t&&(i.g=t+"."+i.g),Oc(i,i.m);else{var s=L.location;i=s.protocol,t=t?t+"."+s.hostname:s.hostname,s=+s.port;var o=new M(null);i&&Nc(o,i),t&&(o.g=t),s&&Oc(o,s),n&&(o.l=n),i=o}return n=e.F,t=e.Da,n&&t&&K(i,n,t),K(i,"VER",e.ra),Gd(e,i),i}function lc(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=new P(n&&e.Ha&&!e.va?new ld({ob:!0}):e.va)).Oa(e.J),t}function Nd(){}function Od(){if(ee&&!(10<=Number(ec)))throw Error("Environmental error: no available transport.")}function Q(e,t){B.call(this),this.g=new Ed(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.s=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.Ca&&(e?e["X-WebChannel-Client-Profile"]=t.Ca:e={"X-WebChannel-Client-Profile":t.Ca}),this.g.U=e,(e=t&&t.cc)&&!x(e)&&(this.g.o=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!x(t)&&(this.g.F=t,null!==(e=this.h)&&t in e&&t in(e=this.h)&&delete e[t]),this.j=new R(this)}function Pd(e){Yb.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(let n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function Qd(){Zb.call(this),this.status=1}function R(e){this.g=e}function S(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}function Sd(e,t,n){n||(n=0);var i=Array(16);if("string"==typeof t)for(var s=0;16>s;++s)i[s]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(s=0;16>s;++s)i[s]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],s=e.g[2];var o=e.g[3],l=t+(o^n&(s^o))+i[0]+3614090360&4294967295;l=o+(s^(t=n+(l<<7&4294967295|l>>>25))&(n^s))+i[1]+3905402710&4294967295,l=s+(n^(o=t+(l<<12&4294967295|l>>>20))&(t^n))+i[2]+606105819&4294967295,l=n+(t^(s=o+(l<<17&4294967295|l>>>15))&(o^t))+i[3]+3250441966&4294967295,l=t+(o^(n=s+(l<<22&4294967295|l>>>10))&(s^o))+i[4]+4118548399&4294967295,l=o+(s^(t=n+(l<<7&4294967295|l>>>25))&(n^s))+i[5]+1200080426&4294967295,l=s+(n^(o=t+(l<<12&4294967295|l>>>20))&(t^n))+i[6]+2821735955&4294967295,l=n+(t^(s=o+(l<<17&4294967295|l>>>15))&(o^t))+i[7]+4249261313&4294967295,l=t+(o^(n=s+(l<<22&4294967295|l>>>10))&(s^o))+i[8]+1770035416&4294967295,l=o+(s^(t=n+(l<<7&4294967295|l>>>25))&(n^s))+i[9]+2336552879&4294967295,l=s+(n^(o=t+(l<<12&4294967295|l>>>20))&(t^n))+i[10]+4294925233&4294967295,l=n+(t^(s=o+(l<<17&4294967295|l>>>15))&(o^t))+i[11]+2304563134&4294967295,l=t+(o^(n=s+(l<<22&4294967295|l>>>10))&(s^o))+i[12]+1804603682&4294967295,l=o+(s^(t=n+(l<<7&4294967295|l>>>25))&(n^s))+i[13]+4254626195&4294967295,l=s+(n^(o=t+(l<<12&4294967295|l>>>20))&(t^n))+i[14]+2792965006&4294967295,l=n+(t^(s=o+(l<<17&4294967295|l>>>15))&(o^t))+i[15]+1236535329&4294967295,n=s+(l<<22&4294967295|l>>>10),l=t+(s^o&(n^s))+i[1]+4129170786&4294967295,t=n+(l<<5&4294967295|l>>>27),l=o+(n^s&(t^n))+i[6]+3225465664&4294967295,o=t+(l<<9&4294967295|l>>>23),l=s+(t^n&(o^t))+i[11]+643717713&4294967295,s=o+(l<<14&4294967295|l>>>18),l=n+(o^t&(s^o))+i[0]+3921069994&4294967295,n=s+(l<<20&4294967295|l>>>12),l=t+(s^o&(n^s))+i[5]+3593408605&4294967295,t=n+(l<<5&4294967295|l>>>27),l=o+(n^s&(t^n))+i[10]+38016083&4294967295,o=t+(l<<9&4294967295|l>>>23),l=s+(t^n&(o^t))+i[15]+3634488961&4294967295,s=o+(l<<14&4294967295|l>>>18),l=n+(o^t&(s^o))+i[4]+3889429448&4294967295,n=s+(l<<20&4294967295|l>>>12),l=t+(s^o&(n^s))+i[9]+568446438&4294967295,t=n+(l<<5&4294967295|l>>>27),l=o+(n^s&(t^n))+i[14]+3275163606&4294967295,o=t+(l<<9&4294967295|l>>>23),l=s+(t^n&(o^t))+i[3]+4107603335&4294967295,s=o+(l<<14&4294967295|l>>>18),l=n+(o^t&(s^o))+i[8]+1163531501&4294967295,n=s+(l<<20&4294967295|l>>>12),l=t+(s^o&(n^s))+i[13]+2850285829&4294967295,t=n+(l<<5&4294967295|l>>>27),l=o+(n^s&(t^n))+i[2]+4243563512&4294967295,o=t+(l<<9&4294967295|l>>>23),l=s+(t^n&(o^t))+i[7]+1735328473&4294967295,s=o+(l<<14&4294967295|l>>>18),l=n+(o^t&(s^o))+i[12]+2368359562&4294967295,l=t+((n=s+(l<<20&4294967295|l>>>12))^s^o)+i[5]+4294588738&4294967295,l=o+((t=n+(l<<4&4294967295|l>>>28))^n^s)+i[8]+2272392833&4294967295,l=s+((o=t+(l<<11&4294967295|l>>>21))^t^n)+i[11]+1839030562&4294967295,l=n+((s=o+(l<<16&4294967295|l>>>16))^o^t)+i[14]+4259657740&4294967295,l=t+((n=s+(l<<23&4294967295|l>>>9))^s^o)+i[1]+2763975236&4294967295,l=o+((t=n+(l<<4&4294967295|l>>>28))^n^s)+i[4]+1272893353&4294967295,l=s+((o=t+(l<<11&4294967295|l>>>21))^t^n)+i[7]+4139469664&4294967295,l=n+((s=o+(l<<16&4294967295|l>>>16))^o^t)+i[10]+3200236656&4294967295,l=t+((n=s+(l<<23&4294967295|l>>>9))^s^o)+i[13]+681279174&4294967295,l=o+((t=n+(l<<4&4294967295|l>>>28))^n^s)+i[0]+3936430074&4294967295,l=s+((o=t+(l<<11&4294967295|l>>>21))^t^n)+i[3]+3572445317&4294967295,l=n+((s=o+(l<<16&4294967295|l>>>16))^o^t)+i[6]+76029189&4294967295,l=t+((n=s+(l<<23&4294967295|l>>>9))^s^o)+i[9]+3654602809&4294967295,l=o+((t=n+(l<<4&4294967295|l>>>28))^n^s)+i[12]+3873151461&4294967295,l=s+((o=t+(l<<11&4294967295|l>>>21))^t^n)+i[15]+530742520&4294967295,l=n+((s=o+(l<<16&4294967295|l>>>16))^o^t)+i[2]+3299628645&4294967295,n=s+(l<<23&4294967295|l>>>9),l=t+(s^(n|~o))+i[0]+4096336452&4294967295,t=n+(l<<6&4294967295|l>>>26),l=o+(n^(t|~s))+i[7]+1126891415&4294967295,o=t+(l<<10&4294967295|l>>>22),l=s+(t^(o|~n))+i[14]+2878612391&4294967295,s=o+(l<<15&4294967295|l>>>17),l=n+(o^(s|~t))+i[5]+4237533241&4294967295,n=s+(l<<21&4294967295|l>>>11),l=t+(s^(n|~o))+i[12]+1700485571&4294967295,t=n+(l<<6&4294967295|l>>>26),l=o+(n^(t|~s))+i[3]+2399980690&4294967295,o=t+(l<<10&4294967295|l>>>22),l=s+(t^(o|~n))+i[10]+4293915773&4294967295,s=o+(l<<15&4294967295|l>>>17),l=n+(o^(s|~t))+i[1]+2240044497&4294967295,n=s+(l<<21&4294967295|l>>>11),l=t+(s^(n|~o))+i[8]+1873313359&4294967295,t=n+(l<<6&4294967295|l>>>26),l=o+(n^(t|~s))+i[15]+4264355552&4294967295,o=t+(l<<10&4294967295|l>>>22),l=s+(t^(o|~n))+i[6]+2734768916&4294967295,s=o+(l<<15&4294967295|l>>>17),l=n+(o^(s|~t))+i[13]+1309151649&4294967295,n=s+(l<<21&4294967295|l>>>11),l=t+(s^(n|~o))+i[4]+4149444226&4294967295,t=n+(l<<6&4294967295|l>>>26),l=o+(n^(t|~s))+i[11]+3174756917&4294967295,o=t+(l<<10&4294967295|l>>>22),l=s+(t^(o|~n))+i[2]+718787259&4294967295,s=o+(l<<15&4294967295|l>>>17),l=n+(o^(s|~t))+i[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(s+(l<<21&4294967295|l>>>11))&4294967295,e.g[2]=e.g[2]+s&4294967295,e.g[3]=e.g[3]+o&4294967295}function T(e,t){this.h=t;for(var n=[],i=!0,s=e.length-1;0<=s;s--){var o=0|e[s];i&&o==t||(n[s]=o,i=!1)}this.g=n}(d=P.prototype).Oa=function(e){this.M=e},d.ha=function(e,t,n,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+e);t=t?t.toUpperCase():"GET",this.I=e,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():l.g(),this.C=this.u?Vb(this.u):Vb(l),this.g.onreadystatechange=q(this.La,this);try{this.G=!0,this.g.open(t,String(e),!0),this.G=!1}catch(e){vd(this,e);return}if(e=n||"",n=new Map(this.headers),i){if(Object.getPrototypeOf(i)===Object.prototype)for(var s in i)n.set(s,i[s]);else if("function"==typeof i.keys&&"function"==typeof i.get)for(let e of i.keys())n.set(e,i.get(e));else throw Error("Unknown input type for opt_headers: "+String(i))}for(let[o,l]of(i=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),s=L.FormData&&e instanceof L.FormData,!(0<=j(eG,t))||i||s||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),n))this.g.setRequestHeader(o,l);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{var o;wd(this),0<this.B&&((this.L=(o=this.g,ee&&"number"==typeof o.timeout&&void 0!==o.ontimeout))?(this.g.timeout=this.B,this.g.ontimeout=q(this.ua,this)):this.A=yb(this.ua,this.B,this)),this.v=!0,this.g.send(e),this.v=!1}catch(e){vd(this,e)}},d.ua=function(){void 0!==k&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,C(this,"timeout"),this.abort(8))},d.abort=function(e){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=e||7,C(this,"complete"),C(this,"abort"),zd(this))},d.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),zd(this,!0)),P.$.N.call(this)},d.La=function(){this.s||(this.G||this.v||this.l?Ad(this):this.kb())},d.kb=function(){Ad(this)},d.isActive=function(){return!!this.g},d.da=function(){try{return 2<H(this)?this.g.status:-1}catch(e){return -1}},d.ja=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},d.Wa=function(e){if(this.g){var t=this.g.responseText;
1357return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),ez(t)}},d.Ia=function(){return this.m},d.Sa=function(){return"string"==typeof this.j?this.j:String(this.j)},(d=Ed.prototype).ra=8,d.H=1,d.Na=function(e){if(this.m){if(this.m=null,1==this.H){if(!e){this.W=Math.floor(1e5*Math.random()),e=this.W++;let s=new bc(this,this.l,e),o=this.s;if(this.U&&(o?Ra(o=Pa(o),this.U):o=this.U),null!==this.o||this.O||(s.I=o,o=null),this.P)e:{for(var t=0,n=0;n<this.j.length;n++){t:{var i=this.j[n];if("__data__"in i.map&&"string"==typeof(i=i.map.__data__)){i=i.length;break t}i=void 0}if(void 0===i)break;if(4096<(t+=i)){t=n;break e}if(4096===t||n===this.j.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=Kd(this,s,t),K(n=G(this.I),"RID",e),K(n,"CVER",22),this.F&&K(n,"X-HTTP-Session-Id",this.F),Gd(this,n),o&&(this.O?t="headers="+encodeURIComponent(String(Bd(o)))+"&"+t:this.o&&Cd(n,this.o,o)),Cc(this.i,s),this.bb&&K(n,"TYPE","init"),this.P?(K(n,"$req",t),K(n,"SID","null"),s.aa=!0,gc(s,n,null)):gc(s,n,t),this.H=2}}else 3==this.H&&(e?Ld(this,e):0==this.j.length||ed(this.i)||Ld(this))}},d.Ma=function(){if(this.u=null,Md(this),this.ca&&!(this.M||null==this.g||0>=this.S)){var e=2*this.S;this.l.info("BP detection timer enabled: "+e),this.B=Rb(q(this.jb,this),e)}},d.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,F(10),zc(this),Md(this))},d.ib=function(){null!=this.v&&(this.v=null,zc(this),Ac(this),F(19))},d.pb=function(e){e?(this.l.info("Successfully pinged google.com"),F(2)):(this.l.info("Failed to ping google.com"),F(1))},d.isActive=function(){return!!this.h&&this.h.isActive(this)},(d=Nd.prototype).Ba=function(){},d.Aa=function(){},d.za=function(){},d.ya=function(){},d.isActive=function(){return!0},d.Va=function(){},Od.prototype.g=function(e,t){return new Q(e,t)},r(Q,B),Q.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var e=this.g,t=this.l,n=this.h||void 0;F(0),e.Y=t,e.na=n||{},e.G=e.aa,e.I=Dc(e,null,e.Y),Gc(e)},Q.prototype.close=function(){Hc(this.g)},Q.prototype.u=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=eE(e),e=n);t.j.push(new eB(t.fb++,e)),3==t.H&&Gc(t)},Q.prototype.N=function(){this.g.h=null,delete this.j,Hc(this.g),delete this.g,Q.$.N.call(this)},r(Pd,Yb),r(Qd,Zb),r(R,Nd),R.prototype.Ba=function(){C(this.g,"a")},R.prototype.Aa=function(e){C(this.g,new Pd(e))},R.prototype.za=function(e){C(this.g,new Qd)},R.prototype.ya=function(){C(this.g,"b")},r(S,function(){this.blockSize=-1}),S.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0},S.prototype.j=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,i=this.m,s=this.h,o=0;o<t;){if(0==s)for(;o<=n;)Sd(this,e,o),o+=this.blockSize;if("string"==typeof e){for(;o<t;)if(i[s++]=e.charCodeAt(o++),s==this.blockSize){Sd(this,i),s=0;break}}else for(;o<t;)if(i[s++]=e[o++],s==this.blockSize){Sd(this,i),s=0;break}}this.h=s,this.i+=t},S.prototype.l=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.i;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.j(e),e=Array(16),t=n=0;4>t;++t)for(var i=0;32>i;i+=8)e[n++]=this.g[t]>>>i&255;return e};var eH={};function Td(e){return -128<=e&&128>e?Object.prototype.hasOwnProperty.call(eH,e)?eH[e]:eH[e]=new T([0|e],0>e?-1:0):new T([0|e],0>e?-1:0)}function U(e){if(isNaN(e)||!isFinite(e))return eZ;if(0>e)return W(U(-e));for(var t=[],n=1,i=0;e>=n;i++)t[i]=e/n|0,n*=eQ;return new T(t,0)}var eQ=4294967296,eZ=Td(0),eJ=Td(1),eX=Td(16777216);function Y(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function X(e){return -1==e.h}function W(e){for(var t=e.g.length,n=[],i=0;i<t;i++)n[i]=~e.g[i];return new T(n,~e.h).add(eJ)}function Zd(e,t){return e.add(W(t))}function $d(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function ae(e,t){this.g=e,this.h=t}function Yd(e,t){if(Y(t))throw Error("division by zero");if(Y(e))return new ae(eZ,eZ);if(X(e))return t=Yd(W(e),t),new ae(W(t.g),W(t.h));if(X(t))return t=Yd(e,W(t)),new ae(W(t.g),t.h);if(30<e.g.length){if(X(e)||X(t))throw Error("slowDivide_ only works with positive integers.");for(var n=eJ,i=t;0>=i.X(e);)n=be(n),i=be(i);var s=Z(n,1),o=Z(i,1);for(i=Z(i,2),n=Z(n,2);!Y(i);){var l=o.add(i);0>=l.X(e)&&(s=s.add(n),o=l),i=Z(i,1),n=Z(n,1)}return t=Zd(e,s.R(t)),new ae(s,t)}for(s=eZ;0<=e.X(t);){for(i=48>=(i=Math.ceil(Math.log(n=Math.max(1,Math.floor(e.ea()/t.ea())))/M
1357ath.LN2))?1:Math.pow(2,i-48),l=(o=U(n)).R(t);X(l)||0<l.X(e);)n-=i,l=(o=U(n)).R(t);Y(o)&&(o=eJ),s=s.add(o),e=Zd(e,l)}return new ae(s,e)}function be(e){for(var t=e.g.length+1,n=[],i=0;i<t;i++)n[i]=e.D(i)<<1|e.D(i-1)>>>31;return new T(n,e.h)}function Z(e,t){var n=t>>5;t%=32;for(var i=e.g.length-n,s=[],o=0;o<i;o++)s[o]=0<t?e.D(o+n)>>>t|e.D(o+n+1)<<32-t:e.D(o+n);return new T(s,e.h)}(d=T.prototype).ea=function(){if(X(this))return-W(this).ea();for(var e=0,t=1,n=0;n<this.g.length;n++){var i=this.D(n);e+=(0<=i?i:eQ+i)*t,t*=eQ}return e},d.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(Y(this))return"0";if(X(this))return"-"+W(this).toString(e);for(var t=U(Math.pow(e,6)),n=this,i="";;){var s=Yd(n,t).g,o=((0<(n=Zd(n,s.R(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(Y(n=s))return o+i;for(;6>o.length;)o="0"+o;i=o+i}},d.D=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},d.X=function(e){return X(e=Zd(this,e))?-1:Y(e)?0:1},d.abs=function(){return X(this)?W(this):this},d.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0,s=0;s<=t;s++){var o=i+(65535&this.D(s))+(65535&e.D(s)),l=(o>>>16)+(this.D(s)>>>16)+(e.D(s)>>>16);i=l>>>16,o&=65535,l&=65535,n[s]=l<<16|o}return new T(n,-2147483648&n[n.length-1]?-1:0)},d.R=function(e){if(Y(this)||Y(e))return eZ;if(X(this))return X(e)?W(this).R(W(e)):W(W(this).R(e));if(X(e))return W(this.R(W(e)));if(0>this.X(eX)&&0>e.X(eX))return U(this.ea()*e.ea());for(var t=this.g.length+e.g.length,n=[],i=0;i<2*t;i++)n[i]=0;for(i=0;i<this.g.length;i++)for(var s=0;s<e.g.length;s++){var o=this.D(i)>>>16,l=65535&this.D(i),u=e.D(s)>>>16,h=65535&e.D(s);n[2*i+2*s]+=l*h,$d(n,2*i+2*s),n[2*i+2*s+1]+=o*h,$d(n,2*i+2*s+1),n[2*i+2*s+1]+=l*u,$d(n,2*i+2*s+1),n[2*i+2*s+2]+=o*u,$d(n,2*i+2*s+2)}for(i=0;i<t;i++)n[i]=n[2*i+1]<<16|n[2*i];for(i=t;i<2*t;i++)n[i]=0;return new T(n,0)},d.gb=function(e){return Yd(this,e).h},d.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.D(i)&e.D(i);return new T(n,this.h&e.h)},d.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.D(i)|e.D(i);return new T(n,this.h|e.h)},d.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.D(i)^e.D(i);return new T(n,this.h^e.h)},Od.prototype.createWebChannel=Od.prototype.g,Q.prototype.send=Q.prototype.u,Q.prototype.open=Q.prototype.m,Q.prototype.close=Q.prototype.close,eS.NO_ERROR=0,eS.TIMEOUT=8,eS.HTTP_ERROR=6,eV.COMPLETE="complete",Wb.EventType=eC,eC.OPEN="a",eC.CLOSE="b",eC.ERROR="c",eC.MESSAGE="d",B.prototype.listen=B.prototype.O,P.prototype.listenOnce=P.prototype.P,P.prototype.getLastError=P.prototype.Sa,P.prototype.getLastErrorCode=P.prototype.Ia,P.prototype.getStatus=P.prototype.da,P.prototype.getResponseJson=P.prototype.Wa,P.prototype.getResponseText=P.prototype.ja,P.prototype.send=P.prototype.ha,P.prototype.setWithCredentials=P.prototype.Oa,S.prototype.digest=S.prototype.l,S.prototype.reset=S.prototype.reset,S.prototype.update=S.prototype.j,T.prototype.add=T.prototype.add,T.prototype.multiply=T.prototype.R,T.prototype.modulo=T.prototype.gb,T.prototype.compare=T.prototype.X,T.prototype.toNumber=T.prototype.ea,T.prototype.toString=T.prototype.toString,T.prototype.getBits=T.prototype.D,T.fromNumber=U,T.fromString=function Vd(e,t){if(0==e.length)throw Error("number format error: empty string");if(2>(t=t||10)||36<t)throw Error("radix out of range: "+t);if("-"==e.charAt(0))return W(Vd(e.substring(1),t));if(0<=e.indexOf("-"))throw Error('number format error: interior "-" character');for(var n=U(Math.pow(t,8)),i=eZ,s=0;s<e.length;s+=8){var o=Math.min(8,e.length-s),l=parseInt(e.substring(s,s+o),t);8>o?(o=U(Math.pow(t,o)),i=i.R(o).add(U(l))):i=(i=i.R(n)).add(U(l))}return i};var eY=V.createWebChannelTransport=function(){return new Od},e0=V.getStatEventTarget=function(){return Mb()},e1=V.ErrorCode=eS,e2=V.EventType=eV,e4=V.Event=eR,e9=V.Stat={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20};V.FetchXmlHttpFactory=ld;var e5=V.WebChannel=Wb,e6=V.XhrIo=P,e3=V.Md5=S,e7=V.Integer=T;n(3454);let e8="@firebase/firestore";/** 1358 * @license 1359 * Copyright 2017 Google LLC 1360 * 1361 * Licensed under the Apache License, Version 2.0 (the "License");
1362 * you may not use this file except in compliance with the License. 1363 * You may obtain a copy of the License at 1364 * 1365 * http://www.apache.org/licenses/LICENSE-2.0 1366 * 1367 * Unless required by applicable law or agreed to in writing, software 1368 * distributed under the License is distributed on an "AS IS" BASIS, 1369 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1370 * See the License for the specific language governing permissions and 1371 * limitations under the License. 1372 */let User=class User{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}};User.UNAUTHENTICATED=new User(null),User.GOOGLE_CREDENTIALS=new User("google-credentials-uid"),User.FIRST_PARTY=new User("first-party-uid"),User.MOCK_USER=new User("mock-user");/** 1373 * @license 1374 * Copyright 2017 Google LLC 1375 * 1376 * Licensed under the Apache License, Version 2.0 (the "License"); 1377 * you may not use this file except in compliance with the License. 1378 * You may obtain a copy of the License at 1379 * 1380 * http://www.apache.org/licenses/LICENSE-2.0 1381 * 1382 * Unless required by applicable law or agreed to in writing, software 1383 * distributed under the License is distributed on an "AS IS" BASIS, 1384 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1385 * See the License for the specific language governing permissions and 1386 * limitations under the License. 1387 */let te="10.5.0",tt=new g.Yd("@firebase/firestore");function __PRIVATE_getLogLevel(){return tt.logLevel}function __PRIVATE_logDebug(e,...t){if(tt.logLevel<=g.in.DEBUG){let n=t.map(__PRIVATE_argToString);tt.debug(`Firestore (${te}): ${e}`,...n)}}function __PRIVATE_logError(e,...t){if(tt.logLevel<=g.in.ERROR){let n=t.map(__PRIVATE_argToString);tt.error(`Firestore (${te}): ${e}`,...n)}}function __PRIVATE_logWarn(e,...t){if(tt.logLevel<=g.in.WARN){let n=t.map(__PRIVATE_argToString);tt.warn(`Firestore (${te}): ${e}`,...n)}}function __PRIVATE_argToString(e){if("string"==typeof e)return e;try{/** 1388 * @license 1389 * Copyright 2020 Google LLC 1390 * 1391 * Licensed under the Apache License, Version 2.0 (the "License"); 1392 * you may not use this file except in compliance with the License. 1393 * You may obtain a copy of the License at 1394 * 1395 * http://www.apache.org/licenses/LICENSE-2.0 1396 * 1397 * Unless required by applicable law or agreed to in writing, software 1398 * distributed under the License is distributed on an "AS IS" BASIS, 1399 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1400 * See the License for the specific language governing permissions and 1401 * limitations under the License. 1402 */return JSON.stringify(e)}catch(t){return e}}/** 1403 * @license 1404 * Copyright 2017 Google LLC 1405 * 1406 * Licensed under the Apache License, Version 2.0 (the "License"); 1407 * you may not use this file except in compliance with the License. 1408 * You may obtain a copy of the License at 1409 * 1410 * http://www.apache.org/licenses/LICENSE-2.0 1411 * 1412 * Unless required by applicable law or agreed to in writing, software 1413 * distributed under the License is distributed on an "AS IS" BASIS, 1414 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1415 * See the License for the specific language governing permissions and 1416 * limitations under the License. 1417 */function fail(e="Unexpected state"){let t=`FIRESTORE (${te}) INTERNAL ASSERTION FAILED: `+e;throw __PRIVATE_logError(t),Error(t)}/** 1418 * @license 1419 * Copyright 2017 Google LLC 1420 * 1421 * Licensed under the Apache License, Version 2.0 (the "License"); 1422 * you may not use this file except in compliance with the License. 1423 * You may obtain a copy of the License at 1424 * 1425 * http://www.apache.org/licenses/LICENSE-2.0 1426 * 1427 * Unless required by applicable law or agreed to in writing, software 1428 * distributed under the License is distributed on an "AS IS" BASIS, 1429 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1430 * See the License for the specific language governing permissions and 1431 * limitations under the License. 1432 */let tr={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",UNIMPLEMENT
1432ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};let FirestoreError=class FirestoreError extends E.ZR{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};/** 1433 * @license 1434 * Copyright 2017 Google LLC 1435 * 1436 * Licensed under the Apache License, Version 2.0 (the "License"); 1437 * you may not use this file except in compliance with the License. 1438 * You may obtain a copy of the License at 1439 * 1440 * http://www.apache.org/licenses/LICENSE-2.0 1441 * 1442 * Unless required by applicable law or agreed to in writing, software 1443 * distributed under the License is distributed on an "AS IS" BASIS, 1444 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1445 * See the License for the specific language governing permissions and 1446 * limitations under the License. 1447 */let __PRIVATE_Deferred=class __PRIVATE_Deferred{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}};/** 1448 * @license 1449 * Copyright 2017 Google LLC 1450 * 1451 * Licensed under the Apache License, Version 2.0 (the "License"); 1452 * you may not use this file except in compliance with the License. 1453 * You may obtain a copy of the License at 1454 * 1455 * http://www.apache.org/licenses/LICENSE-2.0 1456 * 1457 * Unless required by applicable law or agreed to in writing, software 1458 * distributed under the License is distributed on an "AS IS" BASIS, 1459 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1460 * See the License for the specific language governing permissions and 1461 * limitations under the License. 1462 */let __PRIVATE_OAuthToken=class __PRIVATE_OAuthToken{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}};let __PRIVATE_EmptyAuthCredentialsProvider=class __PRIVATE_EmptyAuthCredentialsProvider{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(User.UNAUTHENTICATED))}shutdown(){}};let __PRIVATE_EmulatorAuthCredentialsProvider=class __PRIVATE_EmulatorAuthCredentialsProvider{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}};let __PRIVATE_FirebaseAuthCredentialsProvider=class __PRIVATE_FirebaseAuthCredentialsProvider{constructor(e){this.t=e,this.currentUser=User.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let n=this.i,__PRIVATE_guardedChangeListener=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve(),i=new __PRIVATE_Deferred;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new __PRIVATE_Deferred,e.enqueueRetryable(()=>__PRIVATE_guardedChangeListener(this.currentUser))};let __PRIVATE_awaitNextToken=()=>{let t=i;e.enqueueRetryable(async()=>{await t.promise,await __PRIVATE_guardedChangeListener(this.currentUser)})},__PRIVATE_registerAuth=e=>{__PRIVATE_logDebug("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.auth.addAuthTokenListener(this.o),__PRIVATE_awaitNextToken()};this.t.onInit(e=>__PRIVATE_registerAuth(e)),setTimeout(()=>{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?__PRIVATE_registerAuth(e):(__PRIVATE_logDebug("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new __PRIVATE_Deferred)}},0),__PRIVATE_awaitNextToken()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(__PRIVATE_logDebug("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?("string"==typeof t.accessToken||fail(),new __PRIVATE_OAuthToken(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){let e=this.auth&&this.auth.getUid();return null===e||"string"==typeof e||fail(),new User(e)}};let __PRIVATE_FirstPartyToken=class __PRIVATE_FirstPartyToken{constructor(e,t,n){this.l=e,this.h=t,this.P=n,this.type="FirstParty",this.user=User.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);let e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}};let __PRIVATE_FirstPartyAuthCredentialsProvider=class __PRIVATE_FirstPartyAuthCredentialsProvider{constructor(e,t,n){this.l=e,this.h=t,this.P=n}getToken(){return Promise.resolve(new __PRIVATE_FirstPartyToken(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(User.FIRST_PARTY))}shutdown(){}invalidateToken(){}};let AppCheckToken=class AppCheckToken{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}};let __PRIVATE_FirebaseAppCheckTokenProvider=class __PRIVATE_FirebaseAppCheckTokenProvider{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){let onTokenChanged=e=>{null!=e.error&&__PRIVATE_logDebug("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let n=e.token!==this.R;return this.R=e.token,__PRIVATE_logDebug("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>onTokenChanged(t))};let __PRIVATE_registerAppCheck=e=>{__PRIVATE_logDebug("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.appCheck.addTokenListener(this.o)};this.A.onInit(e=>__PRIVATE_registerAppCheck(e)),setTimeout(()=>{if(!this.appCheck){let e=this.A.getImmediate({optional:!0});e?__PRIVATE_registerAppCheck(e):__PRIVATE_logDebug("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?("string"==typeof e.token||fail(),this.R=e.token,new AppCheckToken(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}};/** 1463 * @license 1464 * Copyright 2017 Google LLC 1465 * 1466 * Licensed under the Apache License, Version 2.0 (the "License");
1467 * you may not use this file except in compliance with the License. 1468 * You may obtain a copy of the License at 1469 * 1470 * http://www.apache.org/licenses/LICENSE-2.0 1471 * 1472 * Unless required by applicable law or agreed to in writing, software 1473 * distributed under the License is distributed on an "AS IS" BASIS, 1474 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1475 * See the License for the specific language governing permissions and 1476 * limitations under the License. 1477 */let __PRIVATE_AutoId=class __PRIVATE_AutoId{static V(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length,n="";for(;n.length<20;){let i=/** 1478 * @license 1479 * Copyright 2020 Google LLC 1480 * 1481 * Licensed under the Apache License, Version 2.0 (the "License"); 1482 * you may not use this file except in compliance with the License. 1483 * You may obtain a copy of the License at 1484 * 1485 * http://www.apache.org/licenses/LICENSE-2.0 1486 * 1487 * Unless required by applicable law or agreed to in writing, software 1488 * distributed under the License is distributed on an "AS IS" BASIS, 1489 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1490 * See the License for the specific language governing permissions and 1491 * limitations under the License. 1492 */function(e){let t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}(40);for(let s=0;s<i.length;++s)n.length<20&&i[s]<t&&(n+=e.charAt(i[s]%e.length))}return n}};function __PRIVATE_primitiveComparator(e,t){return e<t?-1:e>t?1:0}function __PRIVATE_arrayEquals(e,t,n){return e.length===t.length&&e.every((e,i)=>n(e,t[i]))}/** 1493 * @license 1494 * Copyright 2017 Google LLC 1495 * 1496 * Licensed under the Apache License, Version 2.0 (the "License"); 1497 * you may not use this file except in compliance with the License. 1498 * You may obtain a copy of the License at 1499 * 1500 * http://www.apache.org/licenses/LICENSE-2.0 1501 * 1502 * Unless required by applicable law or agreed to in writing, software 1503 * distributed under the License is distributed on an "AS IS" BASIS, 1504 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1505 * See the License for the specific language governing permissions and 1506 * limitations under the License. 1507 */let Timestamp=class Timestamp{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new FirestoreError(tr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800||e>=253402300800)throw new FirestoreError(tr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return Timestamp.fromMillis(Date.now())}static fromDate(e){return Timestamp.fromMillis(e.getTime())}static fromMillis(e){let t=Math.floor(e/1e3),n=Math.floor(1e6*(e-1e3*t));return new Timestamp(t,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?__PRIVATE_primitiveComparator(this.nanoseconds,e.nanoseconds):__PRIVATE_primitiveComparator(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){let e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};/** 1508 * @license 1509 * Copyright 2017 Google LLC 1510 * 1511 * Licensed under the Apache License, Version 2.0 (the "License"); 1512 * you may not use this file except in compliance with the License. 1513 * You may obtain a copy of the License at 1514 * 1515 * http://www.apache.org/licenses/LICENSE-2.0 1516 * 1517 * Unless required by applicable law or agreed to in writing, software 1518 * distributed under the License is distributed on an "AS IS" BASIS, 1519 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1520 * See the License for the specific language governing permissions and 1521 * limitations under the License. 1522 */let SnapshotVersion=class SnapshotVersion{constructor(e){this.timestamp=e}static fromTimestamp(e){return new SnapshotVersion(e)}static min(){return new SnapshotVersion(new Timestamp(0,0))}static max(){return new SnapshotVersion(new Timestamp(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}};/** 1523 * @license 1524 * Copyright 2017 Google LLC 1525 * 1526 * Licensed under the Apache License, Version 2.0 (the "License");
1527 * you may not use this file except in compliance with the License. 1528 * You may obtain a copy of the License at 1529 * 1530 * http://www.apache.org/licenses/LICENSE-2.0 1531 * 1532 * Unless required by applicable law or agreed to in writing, software 1533 * distributed under the License is distributed on an "AS IS" BASIS, 1534 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1535 * See the License for the specific language governing permissions and 1536 * limitations under the License. 1537 */let BasePath=class BasePath{constructor(e,t,n){void 0===t?t=0:t>e.length&&fail(),void 0===n?n=e.length-t:n>e.length-t&&fail(),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===BasePath.comparator(this,e)}child(e){let t=this.segments.slice(this.offset,this.limit());return e instanceof BasePath?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){let n=Math.min(e.length,t.length);for(let i=0;i<n;i++){let n=e.get(i),s=t.get(i);if(n<s)return -1;if(n>s)return 1}return e.length<t.length?-1:e.length>t.length?1:0}};let ResourcePath=class ResourcePath extends BasePath{construct(e,t,n){return new ResourcePath(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...e){let t=[];for(let n of e){if(n.indexOf("//")>=0)throw new FirestoreError(tr.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new ResourcePath(t)}static emptyPath(){return new ResourcePath([])}};let tn=/^[_a-zA-Z][_a-zA-Z0-9]*$/;let FieldPath$1=class FieldPath$1 extends BasePath{construct(e,t,n){return new FieldPath$1(e,t,n)}static isValidIdentifier(e){return tn.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),FieldPath$1.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new FieldPath$1(["__name__"])}static fromServerFormat(e){let t=[],n="",i=0,__PRIVATE_addCurrentSegment=()=>{if(0===n.length)throw new FirestoreError(tr.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""},s=!1;for(;i<e.length;){let t=e[i];if("\\"===t){if(i+1===e.length)throw new FirestoreError(tr.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let t=e[i+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new FirestoreError(tr.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,i+=2}else"`"===t?s=!s:"."!==t||s?n+=t:__PRIVATE_addCurrentSegment(),i++}if(__PRIVATE_addCurrentSegment(),s)throw new FirestoreError(tr.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new FieldPath$1(t)}static emptyPath(){return new FieldPath$1([])}};/** 1538 * @license 1539 * Copyright 2017 Google LLC 1540 * 1541 * Licensed under the Apache License, Version 2.0 (the "License"); 1542 * you may not use this file except in compliance with the License. 1543 * You may obtain a copy of the License at 1544 * 1545 * http://www.apache.org/licenses/LICENSE-2.0 1546 * 1547 * Unless required by applicable law or agreed to in writing, software 1548 * distributed under the License is distributed on an "AS IS" BASIS, 1549 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1550 * See the License for the specific language governing permissions and 1551 * limitations under the License. 1552 */let DocumentKey=class DocumentKey{constructor(e){this.path=e}static fromPath(e){return new DocumentKey(ResourcePath.fromString(e))}static fromName(e){return new DocumentKey(ResourcePath.fromString(e).popFirst(5))}static empty(){return new DocumentKey(ResourcePath.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===ResourcePath.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return ResourcePath.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new DocumentKey(new ResourcePath(e.slice()))}};let IndexOffset=class IndexOffset{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new IndexOffset(SnapshotVersion.min(),DocumentKey.empty(),-1)}static max(){return new IndexOffset(SnapshotVersion.max(),DocumentKey.empty(),-1)}};let PersistenceTransaction=class PersistenceTransaction{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}
1552raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}};/** 1553 * @license 1554 * Copyright 2017 Google LLC 1555 * 1556 * Licensed under the Apache License, Version 2.0 (the "License"); 1557 * you may not use this file except in compliance with the License. 1558 * You may obtain a copy of the License at 1559 * 1560 * http://www.apache.org/licenses/LICENSE-2.0 1561 * 1562 * Unless required by applicable law or agreed to in writing, software 1563 * distributed under the License is distributed on an "AS IS" BASIS, 1564 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1565 * See the License for the specific language governing permissions and 1566 * limitations under the License. 1567 */async function __PRIVATE_ignoreIfPrimaryLeaseLoss(e){if(e.code!==tr.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==e.message)throw e;__PRIVATE_logDebug("LocalStore","Unexpectedly lost primary lease")}/** 1568 * @license 1569 * Copyright 2017 Google LLC 1570 * 1571 * Licensed under the Apache License, Version 2.0 (the "License"); 1572 * you may not use this file except in compliance with the License. 1573 * You may obtain a copy of the License at 1574 * 1575 * http://www.apache.org/licenses/LICENSE-2.0 1576 * 1577 * Unless required by applicable law or agreed to in writing, software 1578 * distributed under the License is distributed on an "AS IS" BASIS, 1579 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1580 * See the License for the specific language governing permissions and 1581 * limitations under the License. 1582 */let PersistencePromise=class PersistencePromise{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)},e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&fail(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new PersistencePromise((n,i)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,i)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,i)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{let t=e();return t instanceof PersistencePromise?t:PersistencePromise.resolve(t)}catch(e){return PersistencePromise.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):PersistencePromise.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):PersistencePromise.reject(t)}static resolve(e){return new PersistencePromise((t,n)=>{t(e)})}static reject(e){return new PersistencePromise((t,n)=>{n(e)})}static waitFor(e){return new PersistencePromise((t,n)=>{let i=0,s=0,o=!1;e.forEach(e=>{++i,e.next(()=>{++s,o&&s===i&&t()},e=>n(e))}),o=!0,s===i&&t()})}static or(e){let t=PersistencePromise.resolve(!1);for(let n of e)t=t.next(e=>e?PersistencePromise.resolve(e):n());return t}static forEach(e,t){let n=[];return e.forEach((e,i)=>{n.push(t.call(this,e,i))}),this.waitFor(n)}static mapArray(e,t){return new PersistencePromise((n,i)=>{let s=e.length,o=Array(s),l=0;for(let u=0;u<s;u++){let h=u;t(e[h]).next(e=>{o[h]=e,++l===s&&n(o)},e=>i(e))}})}static doWhile(e,t){return new PersistencePromise((n,i)=>{let process=()=>{!0===e()?t().next(()=>{process()},i):n()};process()})}};function __PRIVATE_isIndexedDbTransactionError(e){return"IndexedDbTransactionError"===e.name}/** 1583 * @license 1584 * Copyright 2018 Google LLC 1585 * 1586 * Licensed under the Apache License, Version 2.0 (the "License"); 1587 * you may not use this file except in compliance with the License. 1588 * You may obtain a copy of the License at 1589 * 1590 * http://www.apache.org/licenses/LICENSE-2.0 1591 * 1592 * Unless required by applicable law or agreed to in writing, software 1593 * distributed under the License is distributed on an "AS IS" BASIS, 1594 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1595 * See the License for the specific language governing permissions and 1596 * limitations under the License. 1597 */let __PRIVATE_ListenSequence=class __PRIVATE_ListenSequence{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.oe(e),this._e=e=>t.writeSequenceNumber(e))}oe(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this._e&&this._e(e),e}};function __PRIVATE_isNegativeZero(e){return 0===e&&1/e==-1/0}/** 1598 * @license 1599 * Copyright 2017 Google LLC 1600 * 1601 * Licensed under the Apache License, Version 2.0 (the "License");
1602 * you may not use this file except in compliance with the License. 1603 * You may obtain a copy of the License at 1604 * 1605 * http://www.apache.org/licenses/LICENSE-2.0 1606 * 1607 * Unless required by applicable law or agreed to in writing, software 1608 * distributed under the License is distributed on an "AS IS" BASIS, 1609 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1610 * See the License for the specific language governing permissions and 1611 * limitations under the License. 1612 */function __PRIVATE_objectSize(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function forEach(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function isEmpty(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}__PRIVATE_ListenSequence.ae=-1;/** 1613 * @license 1614 * Copyright 2017 Google LLC 1615 * 1616 * Licensed under the Apache License, Version 2.0 (the "License"); 1617 * you may not use this file except in compliance with the License. 1618 * You may obtain a copy of the License at 1619 * 1620 * http://www.apache.org/licenses/LICENSE-2.0 1621 * 1622 * Unless required by applicable law or agreed to in writing, software 1623 * distributed under the License is distributed on an "AS IS" BASIS, 1624 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1625 * See the License for the specific language governing permissions and 1626 * limitations under the License. 1627 */let SortedMap=class SortedMap{constructor(e,t){this.comparator=e,this.root=t||LLRBNode.EMPTY}insert(e,t){return new SortedMap(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,LLRBNode.BLACK,null,null))}remove(e){return new SortedMap(this.comparator,this.root.remove(e,this.comparator).copy(null,null,LLRBNode.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){let n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){let i=this.comparator(e,n.key);if(0===i)return t+n.left.size;i<0?n=n.left:(t+=n.left.size+1,n=n.right)}return -1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,n)=>(e(t,n),!1))}toString(){let e=[];return this.inorderTraversal((t,n)=>(e.push(`${t}:${n}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new SortedMapIterator(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new SortedMapIterator(this.root,e,this.comparator,!1)}getReverseIterator(){return new SortedMapIterator(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new SortedMapIterator(this.root,e,this.comparator,!0)}};let SortedMapIterator=class SortedMapIterator{constructor(e,t,n,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,t&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(0===s){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}};let LLRBNode=class LLRBNode{constructor(e,t,n,i,s){this.key=e,this.value=t,this.color=null!=n?n:LLRBNode.RED,this.left=null!=i?i:LLRBNode.EMPTY,this.right=null!=s?s:LLRBNode.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,i,s){return new LLRBNode(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let i=this,s=n(e,i.key);return(i=s<0?i.copy(null,null,null,i.left.insert(e,t,n),null):0===s?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,n))).fixUp()}removeMin(){if(this.left.isEmpty())return LLRBNode.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),(e=e.copy(null,null,null,e.left.removeMin(),null)).fixUp()}remove(e,t){let n,i=this;if(0>t(e,i.key))i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===t(e,i.key)){if(i.right.isEmpty())return LLRBNode.EMPTY;n=i.right.min(),i=i.copy(n.key,n.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e}rotateLeft(){let e=this.copy(null,null,LLRBNode.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,LLRBNode.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){let e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw fail();let e=this.left.check();if(e!==this.right.check())throw fail();return e+(this.isRed()?0:1)}};LLRBNode.EMPTY=null,LLRBNode.RED=!0,LLRBNode.BLACK=!1,LLRBNode.EMPTY=ne
1627w class{constructor(){this.size=0}get key(){throw fail()}get value(){throw fail()}get color(){throw fail()}get left(){throw fail()}get right(){throw fail()}copy(e,t,n,i,s){return this}insert(e,t,n){return new LLRBNode(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/** 1628 * @license 1629 * Copyright 2017 Google LLC 1630 * 1631 * Licensed under the Apache License, Version 2.0 (the "License"); 1632 * you may not use this file except in compliance with the License. 1633 * You may obtain a copy of the License at 1634 * 1635 * http://www.apache.org/licenses/LICENSE-2.0 1636 * 1637 * Unless required by applicable law or agreed to in writing, software 1638 * distributed under the License is distributed on an "AS IS" BASIS, 1639 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1640 * See the License for the specific language governing permissions and 1641 * limitations under the License. 1642 */let SortedSet=class SortedSet{constructor(e){this.comparator=e,this.data=new SortedMap(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,n)=>(e(t),!1))}forEachInRange(e,t){let n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){let i=n.getNext();if(this.comparator(i.key,e[1])>=0)return;t(i.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new SortedSetIterator(this.data.getIterator())}getIteratorFrom(e){return new SortedSetIterator(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof SortedSet)||this.size!==e.size)return!1;let t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){let e=t.getNext().key,i=n.getNext().key;if(0!==this.comparator(e,i))return!1}return!0}toArray(){let e=[];return this.forEach(t=>{e.push(t)}),e}toString(){let e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){let t=new SortedSet(this.comparator);return t.data=e,t}};let SortedSetIterator=class SortedSetIterator{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};/** 1643 * @license 1644 * Copyright 2020 Google LLC 1645 * 1646 * Licensed under the Apache License, Version 2.0 (the "License"); 1647 * you may not use this file except in compliance with the License. 1648 * You may obtain a copy of the License at 1649 * 1650 * http://www.apache.org/licenses/LICENSE-2.0 1651 * 1652 * Unless required by applicable law or agreed to in writing, software 1653 * distributed under the License is distributed on an "AS IS" BASIS, 1654 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1655 * See the License for the specific language governing permissions and 1656 * limitations under the License. 1657 */let FieldMask=class FieldMask{constructor(e){this.fields=e,e.sort(FieldPath$1.comparator)}static empty(){return new FieldMask([])}unionWith(e){let t=new SortedSet(FieldPath$1.comparator);for(let e of this.fields)t=t.add(e);for(let n of e)t=t.add(n);return new FieldMask(t.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return __PRIVATE_arrayEquals(this.fields,e.fields,(e,t)=>e.isEqual(t))}};/** 1658 * @license 1659 * Copyright 2023 Google LLC 1660 * 1661 * Licensed under the Apache License, Version 2.0 (the "License"); 1662 * you may not use this file except in compliance with the License. 1663 * You may obtain a copy of the License at 1664 * 1665 * http://www.apache.org/licenses/LICENSE-2.0 1666 * 1667 * Unless required by applicable law or agreed to in writing, softw
1667are 1668 * distributed under the License is distributed on an "AS IS" BASIS, 1669 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1670 * See the License for the specific language governing permissions and 1671 * limitations under the License. 1672 */let __PRIVATE_Base64DecodeError=class __PRIVATE_Base64DecodeError extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};/** 1673 * @license 1674 * Copyright 2020 Google LLC 1675 * 1676 * Licensed under the Apache License, Version 2.0 (the "License"); 1677 * you may not use this file except in compliance with the License. 1678 * You may obtain a copy of the License at 1679 * 1680 * http://www.apache.org/licenses/LICENSE-2.0 1681 * 1682 * Unless required by applicable law or agreed to in writing, software 1683 * distributed under the License is distributed on an "AS IS" BASIS, 1684 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1685 * See the License for the specific language governing permissions and 1686 * limitations under the License. 1687 */let ByteString=class ByteString{constructor(e){this.binaryString=e}static fromBase64String(e){let t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new __PRIVATE_Base64DecodeError("Invalid base64 string: "+e):e}}(e);return new ByteString(t)}static fromUint8Array(e){let t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new ByteString(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return btoa(this.binaryString)}toUint8Array(){return function(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return __PRIVATE_primitiveComparator(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};ByteString.EMPTY_BYTE_STRING=new ByteString("");let ti=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function __PRIVATE_normalizeTimestamp(e){if(e||fail(),"string"==typeof e){let t=0,n=ti.exec(e);if(n||fail(),n[1]){let e=n[1];t=Number(e=(e+"000000000").substr(0,9))}let i=new Date(e);return{seconds:Math.floor(i.getTime()/1e3),nanos:t}}return{seconds:__PRIVATE_normalizeNumber(e.seconds),nanos:__PRIVATE_normalizeNumber(e.nanos)}}function __PRIVATE_normalizeNumber(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function __PRIVATE_normalizeByteString(e){return"string"==typeof e?ByteString.fromBase64String(e):ByteString.fromUint8Array(e)}/** 1688 * @license 1689 * Copyright 2020 Google LLC 1690 * 1691 * Licensed under the Apache License, Version 2.0 (the "License"); 1692 * you may not use this file except in compliance with the License. 1693 * You may obtain a copy of the License at 1694 * 1695 * http://www.apache.org/licenses/LICENSE-2.0 1696 * 1697 * Unless required by applicable law or agreed to in writing, software 1698 * distributed under the License is distributed on an "AS IS" BASIS, 1699 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1700 * See the License for the specific language governing permissions and 1701 * limitations under the License. 1702 */function __PRIVATE_isServerTimestamp(e){var t,n;return"server_timestamp"===(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function __PRIVATE_getPreviousValue(e){let t=e.mapValue.fields.__previous_value__;return __PRIVATE_isServerTimestamp(t)?__PRIVATE_getPreviousValue(t):t}function __PRIVATE_getLocalWriteTime(e){let t=__PRIVATE_normalizeTimestamp(e.mapValue.fields.__local_write_time__.timestampValue);return new Timestamp(t.seconds,t.nanos)}/** 1703 * @license 1704 * Copyright 2017 Google LLC 1705 * 1706 * Licensed under the Apache License, Version 2.0 (the "License"); 1707 * you may not use this file except in compliance with the License. 1708 * You may obtain a copy of the License at 1709 * 1710 * http://www.apache.org/licenses/LICENSE-2.0 1711 * 1712 * Unless required by applicable law or agreed to in writing, softw
1712are 1713 * distributed under the License is distributed on an "AS IS" BASIS, 1714 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1715 * See the License for the specific language governing permissions and 1716 * limitations under the License. 1717 */let DatabaseInfo=class DatabaseInfo{constructor(e,t,n,i,s,o,l,u,h){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=i,this.ssl=s,this.forceLongPolling=o,this.autoDetectLongPolling=l,this.longPollingOptions=u,this.useFetchStreams=h}};let DatabaseId=class DatabaseId{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new DatabaseId("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(e){return e instanceof DatabaseId&&e.projectId===this.projectId&&e.database===this.database}};/** 1718 * @license 1719 * Copyright 2020 Google LLC 1720 * 1721 * Licensed under the Apache License, Version 2.0 (the "License"); 1722 * you may not use this file except in compliance with the License. 1723 * You may obtain a copy of the License at 1724 * 1725 * http://www.apache.org/licenses/LICENSE-2.0 1726 * 1727 * Unless required by applicable law or agreed to in writing, software 1728 * distributed under the License is distributed on an "AS IS" BASIS, 1729 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1730 * See the License for the specific language governing permissions and 1731 * limitations under the License. 1732 */let ts={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function __PRIVATE_typeOrder(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?__PRIVATE_isServerTimestamp(e)?4:__PRIVATE_isMaxValue(e)?9007199254740991:10:fail()}function __PRIVATE_valueEquals(e,t){if(e===t)return!0;let n=__PRIVATE_typeOrder(e);if(n!==__PRIVATE_typeOrder(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return __PRIVATE_getLocalWriteTime(e).isEqual(__PRIVATE_getLocalWriteTime(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let n=__PRIVATE_normalizeTimestamp(e.timestampValue),i=__PRIVATE_normalizeTimestamp(t.timestampValue);return n.seconds===i.seconds&&n.nanos===i.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return __PRIVATE_normalizeByteString(e.bytesValue).isEqual(__PRIVATE_normalizeByteString(t.bytesValue));case 7:return e.referenceValue===t.referenceValue;case 8:return __PRIVATE_normalizeNumber(e.geoPointValue.latitude)===__PRIVATE_normalizeNumber(t.geoPointValue.latitude)&&__PRIVATE_normalizeNumber(e.geoPointValue.longitude)===__PRIVATE_normalizeNumber(t.geoPointValue.longitude);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return __PRIVATE_normalizeNumber(e.integerValue)===__PRIVATE_normalizeNumber(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){let n=__PRIVATE_normalizeNumber(e.doubleValue),i=__PRIVATE_normalizeNumber(t.doubleValue);return n===i?__PRIVATE_isNegativeZero(n)===__PRIVATE_isNegativeZero(i):isNaN(n)&&isNaN(i)}return!1}(e,t);case 9:return __PRIVATE_arrayEquals(e.arrayValue.values||[],t.arrayValue.values||[],__PRIVATE_valueEquals);case 10:return function(e,t){let n=e.mapValue.fields||{},i=t.mapValue.fields||{};if(__PRIVATE_objectSize(n)!==__PRIVATE_objectSize(i))return!1;for(let e in n)if(n.hasOwnProperty(e)&&(void 0===i[e]||!__PRIVATE_valueEquals(n[e],i[e])))return!1;return!0}(e,t);default:return fail()}}function __PRIVATE_arrayValueContains(e,t){return void 0!==(e.values||[]).find(e=>__PRIVATE_valueEquals(e,t))}function __PRIVATE_valueCompare(e,t){if(e===t)return 0;let n=__PRIVATE_typeOrder(e),i=__PRIVATE_typeOrder(t);if(n!==i)return __PRIVATE_primitiveComparator(n,i);switch(n){case 0:case 9007199254740991:return 0;case 1:return __PRIVATE_primitiveComparator(e.booleanValue,t.booleanValue);case 2:return function(e,t){let n=__PRIVATE_normalizeNumber(e.integerValue||e.doubleValue),i=__PRIVATE_normalizeNumber(t.integerValue||t.doubleValue);return n<i?-1:n>i?1:n===i?0:isNaN(n)?isNaN(i)?0:-1:1}(e,t);case 3:return __PRIVATE_compareTimestamps(e.timestampValue,t.timestampValue);case 4:return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(e),__PRIVATE_getLocalWriteTime(t));case 5:return __PRIVATE_primitiveComparator(e.stringValue,t.stringValue);case 6:return function(e,t){let n=__PRIVATE_normalizeByteString(e),i=__PRIVATE_normalizeByteString(t);return n.compareTo(i)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){let n=e.split("/"),i=t.split("/");for(let e=0;e<n.length&&e<i.length;e++){let t=__PRIVATE_primitiveComparator(n[e],i[e]);if(0!==t)return t}return __PRIVATE_primitiveComparator(n.length,i.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){let n=__PRIVATE_primitiveComparator(__PRIVATE_normalizeNumber(e.latitude),__PRIVATE_normalizeNumber(t.latitude));return 0!==n?n:__PRIVATE_primitiveComparator(__PRIVATE_normalizeNumber(e.longitude),__PRIVATE_normalizeNumber(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return function(e,t){let n=e.values||[],i=t.values||[];for(let e=0;e<n.length&&e<i.length;++e){let t=__PRIVATE_valueCompare(n[e],i[e]);if(t)return t}return __PRIVATE_primitiveComparator(n.length,i.length)}(e.arrayValue,t.arrayValue);case 10:return function(e,t){if(e===ts.mapValue&&t===ts.mapValue)return 0;if(e===ts.mapValue)return 1;if(t===ts.mapValue)return -1;let n=e.fields||{},i=Object.keys(n),s=t.fields||{},o=Object.keys(s);i.sort(),o.sort();for(let e=0;e<i.length&&e<o.length;++e){let t=__PRIVATE_primitiveComparator(i[e],o[e]);if(0!==t)return t;let l=__PRIVATE_valueCompare(n[i[e]],s[o[e]]);if(0!==l)return l}return __PRIVATE_primitiveComparator(i.length,o.length)}(e.mapValue,t.mapValue);default:throw fail()}}function __PRIVATE_compareTimestamps(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return __PRIVATE_primitiveComparator(e,t);let n=__PRIVATE_normalizeTimestamp(e),i=__PRIVATE_normalizeTimestamp(t),s=__PRIVATE_primitiveComparator(n.seconds,i.seconds);return 0!==s?s:__PRIVATE_primitiveComparator(n.nanos,i.nanos)}function __PRIVATE_canonifyValue(e){var t,n;return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){let t=__PRIVATE_normalizeTimestamp(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?__PRIVATE_normalizeByteString(e.bytesValue).toBase64():"referenceValue"in e?(t=e.referenceValue,DocumentKey.fromName(t).toString()):"geoPointValue"in e?(n=e.geoPointValue,`geo(${n.latitude},${n.longitude})`):"arrayValue"in e?function(e){let t="[",n=!0;for(let i of e.values||[])n?n=!1:t+=",",t+=__PRIVATE_canonifyValue(i);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){let t=Object.keys(e.fields||{}).sort(),n="{",i=!0;for(let s of t)i?i=!1:n+=",",n+=`${s}:${__PRIVATE_canonifyValue(e.fields[s])}`;return n+"}"}(e.mapValue):fail()}function __PRIVATE_refValue(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function isInteger(e){return!!e&&"integerValue"in e}function isArray(e){return!!e&&"arrayValue"in e}function __PRIVATE_isNullValue(e){return!!e&&"nullValue"in e}function __PRIVATE_isNanValue(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function __PRIVATE_isMapValue(e){return!!e&&"mapValue"in e}function __PRIVATE_deepClone(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){let t={mapValue:{fields:{}}};return forEach(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=__PRIVATE_deepClone(n)),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=__PRIVATE_deepClone(e.arrayValue.values[n]);return t}return Object.assign({},e)}function __PRIVATE_isMaxValue(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}/** 1733 * @license 1734 * Copyright 2017 Google LLC 1735 * 1736 * Licensed under the Apache License, Version 2.0 (the "License");
1737 * you may not use this file except in compliance with the License. 1738 * You may obtain a copy of the License at 1739 * 1740 * http://www.apache.org/licenses/LICENSE-2.0 1741 * 1742 * Unless required by applicable law or agreed to in writing, software 1743 * distributed under the License is distributed on an "AS IS" BASIS, 1744 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1745 * See the License for the specific language governing permissions and 1746 * limitations under the License. 1747 */let ObjectValue=class ObjectValue{constructor(e){this.value=e}static empty(){return new ObjectValue({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(!__PRIVATE_isMapValue(t=(t.mapValue.fields||{})[e.get(n)]))return null;return(t=(t.mapValue.fields||{})[e.lastSegment()])||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=__PRIVATE_deepClone(t)}setAll(e){let t=FieldPath$1.emptyPath(),n={},i=[];e.forEach((e,s)=>{if(!t.isImmediateParentOf(s)){let e=this.getFieldsMap(t);this.applyChanges(e,n,i),n={},i=[],t=s.popLast()}e?n[s.lastSegment()]=__PRIVATE_deepClone(e):i.push(s.lastSegment())});let s=this.getFieldsMap(t);this.applyChanges(s,n,i)}delete(e){let t=this.field(e.popLast());__PRIVATE_isMapValue(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return __PRIVATE_valueEquals(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let i=t.mapValue.fields[e.get(n)];__PRIVATE_isMapValue(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=i),t=i}return t.mapValue.fields}applyChanges(e,t,n){for(let i of(forEach(t,(t,n)=>e[t]=n),n))delete e[i]}clone(){return new ObjectValue(__PRIVATE_deepClone(this.value))}};/** 1748 * @license 1749 * Copyright 2017 Google LLC 1750 * 1751 * Licensed under the Apache License, Version 2.0 (the "License"); 1752 * you may not use this file except in compliance with the License. 1753 * You may obtain a copy of the License at 1754 * 1755 * http://www.apache.org/licenses/LICENSE-2.0 1756 * 1757 * Unless required by applicable law or agreed to in writing, software 1758 * distributed under the License is distributed on an "AS IS" BASIS, 1759 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1760 * See the License for the specific language governing permissions and 1761 * limitations under the License. 1762 */let MutableDocument=class MutableDocument{constructor(e,t,n,i,s,o,l){this.key=e,this.documentType=t,this.version=n,this.readTime=i,this.createTime=s,this.data=o,this.documentState=l}static newInvalidDocument(e){return new MutableDocument(e,0,SnapshotVersion.min(),SnapshotVersion.min(),SnapshotVersion.min(),ObjectValue.empty(),0)}static newFoundDocument(e,t,n,i){return new MutableDocument(e,1,t,SnapshotVersion.min(),n,i,0)}static newNoDocument(e,t){return new MutableDocument(e,2,t,SnapshotVersion.min(),SnapshotVersion.min(),ObjectValue.empty(),0)}static newUnknownDocument(e,t){return new MutableDocument(e,3,t,SnapshotVersion.min(),SnapshotVersion.min(),ObjectValue.empty(),2)}convertToFoundDocument(e,t){return this.createTime.isEqual(SnapshotVersion.min())&&(2===this.documentType||0===this.documentType)&&(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=ObjectValue.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=ObjectValue.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=SnapshotVersion.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof MutableDocument&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new MutableDocument(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}
1762;/** 1763 * @license 1764 * Copyright 2022 Google LLC 1765 * 1766 * Licensed under the Apache License, Version 2.0 (the "License"); 1767 * you may not use this file except in compliance with the License. 1768 * You may obtain a copy of the License at 1769 * 1770 * http://www.apache.org/licenses/LICENSE-2.0 1771 * 1772 * Unless required by applicable law or agreed to in writing, software 1773 * distributed under the License is distributed on an "AS IS" BASIS, 1774 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1775 * See the License for the specific language governing permissions and 1776 * limitations under the License. 1777 */let Bound=class Bound{constructor(e,t){this.position=e,this.inclusive=t}};function __PRIVATE_boundCompareToDocument(e,t,n){let i=0;for(let s=0;s<e.position.length;s++){let o=t[s],l=e.position[s];if(i=o.field.isKeyField()?DocumentKey.comparator(DocumentKey.fromName(l.referenceValue),n.key):__PRIVATE_valueCompare(l,n.data.field(o.field)),"desc"===o.dir&&(i*=-1),0!==i)break}return i}function __PRIVATE_boundEquals(e,t){if(null===e)return null===t;if(null===t||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!__PRIVATE_valueEquals(e.position[n],t.position[n]))return!1;return!0}/** 1778 * @license 1779 * Copyright 2022 Google LLC 1780 * 1781 * Licensed under the Apache License, Version 2.0 (the "License"); 1782 * you may not use this file except in compliance with the License. 1783 * You may obtain a copy of the License at 1784 * 1785 * http://www.apache.org/licenses/LICENSE-2.0 1786 * 1787 * Unless required by applicable law or agreed to in writing, software 1788 * distributed under the License is distributed on an "AS IS" BASIS, 1789 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1790 * See the License for the specific language governing permissions and 1791 * limitations under the License. 1792 */let OrderBy=class OrderBy{constructor(e,t="asc"){this.field=e,this.dir=t}};/** 1793 * @license 1794 * Copyright 2022 Google LLC 1795 * 1796 * Licensed under the Apache License, Version 2.0 (the "License"); 1797 * you may not use this file except in compliance with the License. 1798 * You may obtain a copy of the License at 1799 * 1800 * http://www.apache.org/licenses/LICENSE-2.0 1801 * 1802 * Unless required by applicable law or agreed to in writing, software 1803 * distributed under the License is distributed on an "AS IS" BASIS, 1804 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1805 * See the License for the specific language governing permissions and 1806 * limitations under the License. 1807 */let Filter=class Filter{};let FieldFilter=class FieldFilter extends Filter{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new __PRIVATE_KeyFieldFilter(e,t,n):"array-contains"===t?new __PRIVATE_ArrayContainsFilter(e,n):"in"===t?new __PRIVATE_InFilter(e,n):"not-in"===t?new __PRIVATE_NotInFilter(e,n):"array-contains-any"===t?new __PRIVATE_ArrayContainsAnyFilter(e,n):new FieldFilter(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new __PRIVATE_KeyFieldInFilter(e,n):new __PRIVATE_KeyFieldNotInFilter(e,n)}matches(e){let t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(__PRIVATE_valueCompare(t,this.value)):null!==t&&__PRIVATE_typeOrder(this.value)===__PRIVATE_typeOrder(t)&&this.matchesComparison(__PRIVATE_valueCompare(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return fail()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}};let CompositeFilter=class CompositeFilter extends Filter{constructor(e,t){super(),this.filters=e,this.op=t,this.ce=null}static create(e,t){return new CompositeFilter(e,t)}matches(e){return __PRIVATE_compositeFilterIsConjunction(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.ce||(this.ce=this.filters.reduce((e,t)=>
1807e.concat(t.getFlattenedFilters()),[])),this.ce}getFilters(){return Object.assign([],this.filters)}};function __PRIVATE_compositeFilterIsConjunction(e){return"and"===e.op}function __PRIVATE_compositeFilterIsFlat(e){for(let t of e.filters)if(t instanceof CompositeFilter)return!1;return!0}let __PRIVATE_KeyFieldFilter=class __PRIVATE_KeyFieldFilter extends FieldFilter{constructor(e,t,n){super(e,t,n),this.key=DocumentKey.fromName(n.referenceValue)}matches(e){let t=DocumentKey.comparator(e.key,this.key);return this.matchesComparison(t)}};let __PRIVATE_KeyFieldInFilter=class __PRIVATE_KeyFieldInFilter extends FieldFilter{constructor(e,t){super(e,"in",t),this.keys=__PRIVATE_extractDocumentKeysFromArrayValue("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}};let __PRIVATE_KeyFieldNotInFilter=class __PRIVATE_KeyFieldNotInFilter extends FieldFilter{constructor(e,t){super(e,"not-in",t),this.keys=__PRIVATE_extractDocumentKeysFromArrayValue("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}};function __PRIVATE_extractDocumentKeysFromArrayValue(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map(e=>DocumentKey.fromName(e.referenceValue))}let __PRIVATE_ArrayContainsFilter=class __PRIVATE_ArrayContainsFilter extends FieldFilter{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return isArray(t)&&__PRIVATE_arrayValueContains(t.arrayValue,this.value)}};let __PRIVATE_InFilter=class __PRIVATE_InFilter extends FieldFilter{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return null!==t&&__PRIVATE_arrayValueContains(this.value.arrayValue,t)}};let __PRIVATE_NotInFilter=class __PRIVATE_NotInFilter extends FieldFilter{constructor(e,t){super(e,"not-in",t)}matches(e){if(__PRIVATE_arrayValueContains(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return null!==t&&!__PRIVATE_arrayValueContains(this.value.arrayValue,t)}};let __PRIVATE_ArrayContainsAnyFilter=class __PRIVATE_ArrayContainsAnyFilter extends FieldFilter{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!isArray(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>__PRIVATE_arrayValueContains(this.value.arrayValue,e))}};/** 1808 * @license 1809 * Copyright 2019 Google LLC 1810 * 1811 * Licensed under the Apache License, Version 2.0 (the "License"); 1812 * you may not use this file except in compliance with the License. 1813 * You may obtain a copy of the License at 1814 * 1815 * http://www.apache.org/licenses/LICENSE-2.0 1816 * 1817 * Unless required by applicable law or agreed to in writing, software 1818 * distributed under the License is distributed on an "AS IS" BASIS, 1819 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1820 * See the License for the specific language governing permissions and 1821 * limitations under the License. 1822 */let __PRIVATE_TargetImpl=class __PRIVATE_TargetImpl{constructor(e,t=null,n=[],i=[],s=null,o=null,l=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=i,this.limit=s,this.startAt=o,this.endAt=l,this.le=null}};function __PRIVATE_newTarget(e,t=null,n=[],i=[],s=null,o=null,l=null){return new __PRIVATE_TargetImpl(e,t,n,i,s,o,l)}function __PRIVATE_canonifyTarget(e){if(null===e.le){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:"+e.filters.map(e=>(function __PRIVATE_canonifyFilter(e){if(e instanceof FieldFilter)return e.field.canonicalString()+e.op.toString()+__PRIVATE_canonifyValue(e.value);if(__PRIVATE_compositeFilterIsFlat(e)&&__PRIVATE_compositeFilterIsConjunction(e))return e.filters.map(e=>__PRIVATE_canonifyFilter(e)).join(",");{let t=e.filters.map(e=>__PRIVATE_canonifyFilter(e)).join(",");return`${e.op}(${t})`}})(e)).join(",")+"|ob:"+e.orderBy.map(e=>e.field.canonicalString()+e.dir).join(","),null==e.limit||(t+="|l:"+e.limit),e.startAt&&(t+="|lb:"+(e.startAt.inclusive?"b:":"a:")+e.startAt.position.map(e=>__PRIVATE_canonifyValue(e)).join(",")),e.endAt&&(t+="|ub:"+(e.endAt.inclusive?"a:":"b:")+e.endAt.position.map(e=>__PRIVATE_canonifyValue(e)).join(",")),e.le=t}return e.le}function __PRIVATE_targetEquals(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let s=0;s<e.orderBy.length;s++){var n,i;if(n=e.orderBy[s],i=t.orderBy[s],!(n.dir===i.dir&&n.field.isEqual(i.field)))return!1}if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!function __PRIVATE_filterEquals(e,t){return e instanceof FieldFilter?t instanceof FieldFilter&&e.op===t.op&&e.field.isEqual(t.field)&&__PRIVATE_valueEquals(e.value,t.value):e instanceof CompositeFilter?t instanceof CompositeFilter&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((e,n,i)=>e&&__PRIVATE_filterEquals(n,t.filters[i]),!0):void fail()}(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!__PRIVATE_boundEquals(e.startAt,t.startAt)&&__PRIVATE_boundEquals(e.endAt,t.endAt)}function __PRIVATE_targetIsDocumentTarget(e){return DocumentKey.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}/** 1823 * @license 1824 * Copyright 2017 Google LLC 1825 * 1826 * Licensed under the Apache License, Version 2.0 (the "License");
1827 * you may not use this file except in compliance with the License. 1828 * You may obtain a copy of the License at 1829 * 1830 * http://www.apache.org/licenses/LICENSE-2.0 1831 * 1832 * Unless required by applicable law or agreed to in writing, software 1833 * distributed under the License is distributed on an "AS IS" BASIS, 1834 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1835 * See the License for the specific language governing permissions and 1836 * limitations under the License. 1837 */let __PRIVATE_QueryImpl=class __PRIVATE_QueryImpl{constructor(e,t=null,n=[],i=[],s=null,o="F",l=null,u=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=i,this.limit=s,this.limitType=o,this.startAt=l,this.endAt=u,this.he=null,this.Pe=null,this.Ie=null,this.startAt,this.endAt}};function __PRIVATE_queryMatchesAllDocuments(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function __PRIVATE_isCollectionGroupQuery(e){return null!==e.collectionGroup}function __PRIVATE_queryNormalizedOrderBy(e){if(null===e.he){let t;e.he=[];let n=new Set;for(let t of e.explicitOrderBy)e.he.push(t),n.add(t.field.canonicalString());let i=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc",s=(t=new SortedSet(FieldPath$1.comparator),e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t);s.forEach(t=>{n.has(t.canonicalString())||t.isKeyField()||e.he.push(new OrderBy(t,i))}),n.has(FieldPath$1.keyField().canonicalString())||e.he.push(new OrderBy(FieldPath$1.keyField(),i))}return e.he}function __PRIVATE_queryToTarget(e){return e.Pe||(e.Pe=function(e,t){if("F"===e.limitType)return __PRIVATE_newTarget(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(e=>{let t="desc"===e.dir?"asc":"desc";return new OrderBy(e.field,t)});let n=e.endAt?new Bound(e.endAt.position,e.endAt.inclusive):null,i=e.startAt?new Bound(e.startAt.position,e.startAt.inclusive):null;return __PRIVATE_newTarget(e.path,e.collectionGroup,t,e.filters,e.limit,n,i)}}(e,__PRIVATE_queryNormalizedOrderBy(e))),e.Pe}function __PRIVATE_queryWithAddedFilter(e,t){let n=e.filters.concat([t]);return new __PRIVATE_QueryImpl(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function __PRIVATE_queryWithLimit(e,t,n){return new __PRIVATE_QueryImpl(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function __PRIVATE_queryEquals(e,t){return __PRIVATE_targetEquals(__PRIVATE_queryToTarget(e),__PRIVATE_queryToTarget(t))&&e.limitType===t.limitType}function __PRIVATE_canonifyQuery(e){return`${__PRIVATE_canonifyTarget(__PRIVATE_queryToTarget(e))}|lt:${e.limitType}`}function __PRIVATE_stringifyQuery(e){var t;let n;return`Query(target=${n=(t=__PRIVATE_queryToTarget(e)).path.canonicalString(),null!==t.collectionGroup&&(n+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(n+=`, filters: [${t.filters.map(e=>(function __PRIVATE_stringifyFilter(e){return e instanceof FieldFilter?`${e.field.canonicalString()} ${e.op} ${__PRIVATE_canonifyValue(e.value)}`:e instanceof CompositeFilter?e.op.toString()+" {"+e.getFilters().map(__PRIVATE_stringifyFilter).join(" ,")+"}":"Filter"})(e)).join(", ")}]`),null==t.limit||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=`, orderBy: [${t.orderBy.map(e=>`${e.field.canonicalString()} (${e.dir})`).join(", ")}]`),t.startAt&&(n+=", startAt: "+(t.startAt.inclusive?"b:":"a:")+t.startAt.position.map(e=>__PRIVATE_canonifyValue(e)).join(",")),t.endAt&&(n+=", endAt: "+(t.endAt.inclusive?"a:":"b:")+t.endAt.position.map(e=>__PRIVATE_canonifyValue(e)).join(",")),`Target(${n})`}; limitType=${e.limitType})`}function __PRIVATE_queryMatches(e,t){return t.isFoundDocument()&&function(e,t){let n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):DocumentKey.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(let n of __PRIVATE_queryNormalizedOrderBy(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(let n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&(!e.startAt||!!function(e,t,n){let i=__PRIVATE_boundCompareToDocument(e,t,n);return e.inclusive?i<=0:i<0}(e.startAt,__PRIVATE_queryNormalizedOrderBy(e),t))&&(!e.endAt||!!function(e,t,n){let i=__PRIVATE_boundCompareToDocument(e,t,n);return e.inclusive?i>=0:i>0}(e.endAt,__PRIVATE_queryNormalizedOrderBy(e),t))}function __PRIVATE_newQueryComparator(e){return(t,n)=>{let i=!1;for(let s of __PRIVATE_queryNormalizedOrderBy(e)){let e=function(e,t,n){let i=e.field.isKeyField()?DocumentKey.comparator(t.key,n.key):function(e,t,n){let i=t.data.field(e),s=n.data.field(e);return null!==i&&null!==s?__PRIVATE_valueCompare(i,s):fail()}(e.field,t,n);switch(e.dir){case"asc":return i;
1837case"desc":return -1*i;default:return fail()}}(s,t,n);if(0!==e)return e;i=i||s.field.isKeyField()}return 0}}/** 1838 * @license 1839 * Copyright 2017 Google LLC 1840 * 1841 * Licensed under the Apache License, Version 2.0 (the "License"); 1842 * you may not use this file except in compliance with the License. 1843 * You may obtain a copy of the License at 1844 * 1845 * http://www.apache.org/licenses/LICENSE-2.0 1846 * 1847 * Unless required by applicable law or agreed to in writing, software 1848 * distributed under the License is distributed on an "AS IS" BASIS, 1849 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1850 * See the License for the specific language governing permissions and 1851 * limitations under the License. 1852 */let ObjectMap=class ObjectMap{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n){for(let[t,i]of n)if(this.equalsFn(t,e))return i}}has(e){return void 0!==this.get(e)}set(e,t){let n=this.mapKeyFn(e),i=this.inner[n];if(void 0===i)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<i.length;n++)if(this.equalsFn(i[n][0],e))return void(i[n]=[e,t]);i.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],e))return 1===n.length?delete this.inner[t]:n.splice(i,1),this.innerSize--,!0;return!1}forEach(e){forEach(this.inner,(t,n)=>{for(let[t,i]of n)e(t,i)})}isEmpty(){return isEmpty(this.inner)}size(){return this.innerSize}};/** 1853 * @license 1854 * Copyright 2017 Google LLC 1855 * 1856 * Licensed under the Apache License, Version 2.0 (the "License"); 1857 * you may not use this file except in compliance with the License. 1858 * You may obtain a copy of the License at 1859 * 1860 * http://www.apache.org/licenses/LICENSE-2.0 1861 * 1862 * Unless required by applicable law or agreed to in writing, software 1863 * distributed under the License is distributed on an "AS IS" BASIS, 1864 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1865 * See the License for the specific language governing permissions and 1866 * limitations under the License. 1867 */let ta=new SortedMap(DocumentKey.comparator),to=new SortedMap(DocumentKey.comparator);function documentMap(...e){let t=to;for(let n of e)t=t.insert(n.key,n);return t}function __PRIVATE_convertOverlayedDocumentMapToDocumentMap(e){let t=to;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function __PRIVATE_newDocumentKeyMap(){return new ObjectMap(e=>e.toString(),(e,t)=>e.isEqual(t))}let tl=new SortedMap(DocumentKey.comparator),tu=new SortedSet(DocumentKey.comparator);function __PRIVATE_documentKeySet(...e){let t=tu;for(let n of e)t=t.add(n);return t}let tc=new SortedSet(__PRIVATE_primitiveComparator);/** 1868 * @license 1869 * Copyright 2020 Google LLC 1870 * 1871 * Licensed under the Apache License, Version 2.0 (the "License"); 1872 * you may not use this file except in compliance with the License. 1873 * You may obtain a copy of the License at 1874 * 1875 * http://www.apache.org/licenses/LICENSE-2.0 1876 * 1877 * Unless required by applicable law or agreed to in writing, software 1878 * distributed under the License is distributed on an "AS IS" BASIS, 1879 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1880 * See the License for the specific language governing permissions and 1881 * limitations under the License. 1882 */function __PRIVATE_toDouble(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:__PRIVATE_isNegativeZero(t)?"-0":t}}function __PRIVATE_toInteger(e){return{integerValue:""+e}}/** 1883 * @license 1884 * Copyright 2018 Google LLC 1885 * 1886 * Licensed under the Apache License, Version 2.0 (the "License"); 1887 * you may not use this file except in compliance with the License. 1888 * You may obtain a copy of the License at 1889 * 1890 * http://www.apache.org/licenses/LICENSE-2.0 1891 * 1892 * Unless required by applicable law or agreed to in writing, software 1893 * distributed under the License is distributed on an "AS IS" BASIS, 1894 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1895 * See the License for the specific language governing permissions and 1896 * limitations under the License. 1897 */let TransformOperation=class TransformOperation{constructor(){this._=void 0}};function __PRIVATE_computeTransformOperationBaseValue(e,t){return e instanceof __PRIVATE_NumericIncrementTransformOperation?isInteger(t)||t&&"doubleValue"in t?t:{integerValue:0}:null}let __PRIVATE_ServerTimestampTransform=class __PRIVATE_ServerTimestampTransform extends TransformOperation{};let __PRIVATE_ArrayUnionTransformOperation=class __PRIVATE_ArrayUnionTransformOperation extends TransformOperation{constructor(e){super(),this.elements=e}};function __PRIVATE_applyArrayUnionTransformOperation(e,t){let n=__PRIVATE_coercedFieldValuesArray(t);for(let t of e.elements)n.some(e=>__PRIVATE_valueEquals(e,t))||n.push(t);return{arrayValue:{values:n}}}let __PRIVATE_ArrayRemoveTransformOperation=class __PRIVATE_ArrayRemoveTransformOperation extends TransformOperation{constructor(e){super(),this.elements=e}};function __PRIVATE_applyArrayRemoveTransformOperation(e,t){let n=__PRIVATE_coercedFieldValuesArray(t);for(let t of e.elements)n=n.filter(e=>!__PRIVATE_valueEquals(e,t));return{arrayValue:{values:n}}}let __PRIVATE_NumericIncrementTransformOperation=class __PRIVATE_NumericIncrementTransformOperation extends TransformOperation{constructor(e,t){super(),this.serializer
1897=e,this.Te=t}};function asNumber(e){return __PRIVATE_normalizeNumber(e.integerValue||e.doubleValue)}function __PRIVATE_coercedFieldValuesArray(e){return isArray(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}let MutationResult=class MutationResult{constructor(e,t){this.version=e,this.transformResults=t}};let Precondition=class Precondition{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Precondition}static exists(e){return new Precondition(void 0,e)}static updateTime(e){return new Precondition(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}};function __PRIVATE_preconditionIsValidForDocument(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}let Mutation=class Mutation{};function __PRIVATE_calculateOverlayMutation(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new __PRIVATE_DeleteMutation(e.key,Precondition.none()):new __PRIVATE_SetMutation(e.key,e.data,Precondition.none());{let n=e.data,i=ObjectValue.empty(),s=new SortedSet(FieldPath$1.comparator);for(let e of t.fields)if(!s.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?i.delete(e):i.set(e,t),s=s.add(e)}return new __PRIVATE_PatchMutation(e.key,i,new FieldMask(s.toArray()),Precondition.none())}}function __PRIVATE_mutationApplyToLocalView(e,t,n,i){return e instanceof __PRIVATE_SetMutation?function(e,t,n,i){if(!__PRIVATE_preconditionIsValidForDocument(e.precondition,t))return n;let s=e.value.clone(),o=__PRIVATE_localTransformResults(e.fieldTransforms,i,t);return s.setAll(o),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null}(e,t,n,i):e instanceof __PRIVATE_PatchMutation?function(e,t,n,i){if(!__PRIVATE_preconditionIsValidForDocument(e.precondition,t))return n;let s=__PRIVATE_localTransformResults(e.fieldTransforms,i,t),o=t.data;return(o.setAll(__PRIVATE_getPatch(e)),o.setAll(s),t.convertToFoundDocument(t.version,o).setHasLocalMutations(),null===n)?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,i):__PRIVATE_preconditionIsValidForDocument(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}function __PRIVATE_mutationEquals(e,t){var n,i;return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&(n=e.fieldTransforms,i=t.fieldTransforms,!!(void 0===n&&void 0===i||!(!n||!i)&&__PRIVATE_arrayEquals(n,i,(e,t)=>{var n,i;return e.field.isEqual(t.field)&&(n=e.transform,i=t.transform,n instanceof __PRIVATE_ArrayUnionTransformOperation&&i instanceof __PRIVATE_ArrayUnionTransformOperation||n instanceof __PRIVATE_ArrayRemoveTransformOperation&&i instanceof __PRIVATE_ArrayRemoveTransformOperation?__PRIVATE_arrayEquals(n.elements,i.elements,__PRIVATE_valueEquals):n instanceof __PRIVATE_NumericIncrementTransformOperation&&i instanceof __PRIVATE_NumericIncrementTransformOperation?__PRIVATE_valueEquals(n.Te,i.Te):n instanceof __PRIVATE_ServerTimestampTransform&&i instanceof __PRIVATE_ServerTimestampTransform)})))&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}let __PRIVATE_SetMutation=class __PRIVATE_SetMutation extends Mutation{constructor(e,t,n,i=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}};let __PRIVATE_PatchMutation=class __PRIVATE_PatchMutation extends Mutation{constructor(e,t,n,i,s=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}};function __PRIVATE_getPatch(e){let t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){let i=e.data.field(n);t.set(n,i)}}),t}function __PRIVATE_serverTransformResults(e,t,n){var i;let s=new Map;e.length===n.length||fail();for(let o=0;o<n.length;o++){let l=e[o],u=l.transform,h=t.data.field(l.field);s.set(l.field,(i=n[o],u instanceof __PRIVATE_ArrayUnionTransformOperation?__PRIVATE_applyArrayUnionTransformOperation(u,h):u instanceof __PRIVATE_ArrayRemoveTransformOperation?__PRIVATE_applyArrayRemoveTransformOperation(u,h):i))}return s}function __PRIVATE_localTransformResults(e,t,n){let i=new Map;for(let s of e){let e=s.transform,o=n.data.field(s.field);i.set(s.field,e instanceof __PRIVATE_ServerTimestampTransform?function(e,t){let n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&__PRIVATE_isServerTimestamp(t)&&(t=__PRIVATE_getPreviousValue(t)),t&&(n.fields.__previous_value__=t),{mapValue:n}}(t,o):e instanceof __PRIVATE_ArrayUnionTransformOperation?__PRIVATE_applyArrayUnionTransformOperation(e,o):e instanceof __PRIVATE_ArrayRemoveTransformOperation?__PRIVATE_applyArrayRemoveTransformOperation(e,o):function(e,t){let n=__PRIVATE_computeTransformOperationBaseValue(e,t),i=asNumber(n)+asNumber(e.Te);return isInteger(n)&&isInteger(e.Te)?__PRIVATE_toInteger(i):__PRIVATE_toDouble(e.serializer,i)}(e,o))}return i}let __PRIVATE_DeleteMutation=class __PRIVATE_DeleteMutation extends Mutation{constructor(e,t){super(),this.key=e,this.prec
1897ondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}};let __PRIVATE_VerifyMutation=class __PRIVATE_VerifyMutation extends Mutation{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};/** 1898 * @license 1899 * Copyright 2017 Google LLC 1900 * 1901 * Licensed under the Apache License, Version 2.0 (the "License"); 1902 * you may not use this file except in compliance with the License. 1903 * You may obtain a copy of the License at 1904 * 1905 * http://www.apache.org/licenses/LICENSE-2.0 1906 * 1907 * Unless required by applicable law or agreed to in writing, software 1908 * distributed under the License is distributed on an "AS IS" BASIS, 1909 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1910 * See the License for the specific language governing permissions and 1911 * limitations under the License. 1912 */let MutationBatch=class MutationBatch{constructor(e,t,n,i){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=i}applyToRemoteDocument(e,t){let n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){let s=this.mutations[t];if(s.key.isEqual(e.key)){var i;i=n[t],s instanceof __PRIVATE_SetMutation?function(e,t,n){let i=e.value.clone(),s=__PRIVATE_serverTransformResults(e.fieldTransforms,t,n.transformResults);i.setAll(s),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(s,e,i):s instanceof __PRIVATE_PatchMutation?function(e,t,n){if(!__PRIVATE_preconditionIsValidForDocument(e.precondition,t))return void t.convertToUnknownDocument(n.version);let i=__PRIVATE_serverTransformResults(e.fieldTransforms,t,n.transformResults),s=t.data;s.setAll(__PRIVATE_getPatch(e)),s.setAll(i),t.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(s,e,i):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,i)}}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=__PRIVATE_mutationApplyToLocalView(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=__PRIVATE_mutationApplyToLocalView(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=__PRIVATE_newDocumentKeyMap();return this.mutations.forEach(i=>{let s=e.get(i.key),o=s.overlayedDocument,l=this.applyToLocalView(o,s.mutatedFields);l=t.has(i.key)?null:l;let u=__PRIVATE_calculateOverlayMutation(o,l);null!==u&&n.set(i.key,u),o.isValidDocument()||o.convertToNoDocument(SnapshotVersion.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),__PRIVATE_documentKeySet())}isEqual(e){return this.batchId===e.batchId&&__PRIVATE_arrayEquals(this.mutations,e.mutations,(e,t)=>__PRIVATE_mutationEquals(e,t))&&__PRIVATE_arrayEquals(this.baseMutations,e.baseMutations,(e,t)=>__PRIVATE_mutationEquals(e,t))}};let MutationBatchResult=class MutationBatchResult{constructor(e,t,n,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=i}static from(e,t,n){e.mutations.length===n.length||fail();let i=tl,s=e.mutations;for(let e=0;e<s.length;e++)i=i.insert(s[e].key,n[e].version);return new MutationBatchResult(e,t,n,i)}};/** 1913 * @license 1914 * Copyright 2022 Google LLC 1915 * 1916 * Licensed under the Apache License, Version 2.0 (the "License"); 1917 * you may not use this file except in compliance with the License. 1918 * You may obtain a copy of the License at 1919 * 1920 * http://www.apache.org/licenses/LICENSE-2.0 1921 * 1922 * Unless required by applicable law or agreed to in writing, software 1923 * distributed under the License is distributed on an "AS IS" BASIS, 1924 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1925 * See the License for the specific language governing permissions and 1926 * limitations under the License. 1927 */let Overlay=class Overlay{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{ 1928 largestBatchId: ${this.largestBatchId}, 1929 mutation: ${this.mutation.toString()} 1930 }`}};/** 1931 * @license 1932 * Copyright 2017 Google LLC 1933 * 1934 * Licensed under the Apache License, Version 2.0 (the "License");
1935 * you may not use this file except in compliance with the License. 1936 * You may obtain a copy of the License at 1937 * 1938 * http://www.apache.org/licenses/LICENSE-2.0 1939 * 1940 * Unless required by applicable law or agreed to in writing, software 1941 * distributed under the License is distributed on an "AS IS" BASIS, 1942 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1943 * See the License for the specific language governing permissions and 1944 * limitations under the License. 1945 */let ExistenceFilter=class ExistenceFilter{constructor(e,t){this.count=e,this.unchangedNames=t}};function __PRIVATE_mapCodeFromRpcCode(e){if(void 0===e)return __PRIVATE_logError("GRPC error has no .code"),tr.UNKNOWN;switch(e){case u.OK:return tr.OK;case u.CANCELLED:return tr.CANCELLED;case u.UNKNOWN:return tr.UNKNOWN;case u.DEADLINE_EXCEEDED:return tr.DEADLINE_EXCEEDED;case u.RESOURCE_EXHAUSTED:return tr.RESOURCE_EXHAUSTED;case u.INTERNAL:return tr.INTERNAL;case u.UNAVAILABLE:return tr.UNAVAILABLE;case u.UNAUTHENTICATED:return tr.UNAUTHENTICATED;case u.INVALID_ARGUMENT:return tr.INVALID_ARGUMENT;case u.NOT_FOUND:return tr.NOT_FOUND;case u.ALREADY_EXISTS:return tr.ALREADY_EXISTS;case u.PERMISSION_DENIED:return tr.PERMISSION_DENIED;case u.FAILED_PRECONDITION:return tr.FAILED_PRECONDITION;case u.ABORTED:return tr.ABORTED;case u.OUT_OF_RANGE:return tr.OUT_OF_RANGE;case u.UNIMPLEMENTED:return tr.UNIMPLEMENTED;case u.DATA_LOSS:return tr.DATA_LOSS;default:return fail()}}(h=u||(u={}))[h.OK=0]="OK",h[h.CANCELLED=1]="CANCELLED",h[h.UNKNOWN=2]="UNKNOWN",h[h.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",h[h.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",h[h.NOT_FOUND=5]="NOT_FOUND",h[h.ALREADY_EXISTS=6]="ALREADY_EXISTS",h[h.PERMISSION_DENIED=7]="PERMISSION_DENIED",h[h.UNAUTHENTICATED=16]="UNAUTHENTICATED",h[h.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",h[h.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",h[h.ABORTED=10]="ABORTED",h[h.OUT_OF_RANGE=11]="OUT_OF_RANGE",h[h.UNIMPLEMENTED=12]="UNIMPLEMENTED",h[h.INTERNAL=13]="INTERNAL",h[h.UNAVAILABLE=14]="UNAVAILABLE",h[h.DATA_LOSS=15]="DATA_LOSS";/** 1946 * @license 1947 * Copyright 2022 Google LLC 1948 * 1949 * Licensed under the Apache License, Version 2.0 (the "License"); 1950 * you may not use this file except in compliance with the License. 1951 * You may obtain a copy of the License at 1952 * 1953 * http://www.apache.org/licenses/LICENSE-2.0 1954 * 1955 * Unless required by applicable law or agreed to in writing, software 1956 * distributed under the License is distributed on an "AS IS" BASIS, 1957 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1958 * See the License for the specific language governing permissions and 1959 * limitations under the License. 1960 */let th=new e7([4294967295,4294967295],0);function __PRIVATE_getMd5HashValue(e){let t=(new TextEncoder).encode(e),n=new e3;return n.update(t),new Uint8Array(n.digest())}function __PRIVATE_get64BitUints(e){let t=new DataView(e.buffer),n=t.getUint32(0,!0),i=t.getUint32(4,!0),s=t.getUint32(8,!0),o=t.getUint32(12,!0);return[new e7([n,i],0),new e7([s,o],0)]}let BloomFilter=class BloomFilter{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new __PRIVATE_BloomFilterError(`Invalid padding: ${t}`);if(n<0||e.length>0&&0===this.hashCount)throw new __PRIVATE_BloomFilterError(`Invalid hash count: ${n}`);if(0===e.length&&0!==t)throw new __PRIVATE_BloomFilterError(`Invalid padding when bitmap length is 0: ${t}`);this.Ee=8*e.length-t,this.de=e7.fromNumber(this.Ee)}Ae(e,t,n){let i=e.add(t.multiply(e7.fromNumber(n)));return 1===i.compare(th)&&(i=new e7([i.getBits(0),i.getBits(1)],0)),i.modulo(this.de).toNumber()}Re(e){return 0!=(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(0===this.Ee)return!1;let t=__PRIVATE_getMd5HashValue(e),[n,i]=__PRIVATE_get64BitUints(t);for(let e=0;e<this.hashCount;e++){let t=this.Ae(n,i,e);if(!this.Re(t))return!1}return!0}static create(e,t,n){let i=new Uint8Array(Math.ceil(e/8)),s=new BloomFilter(i,e%8==0?0:8-e%8,t);return n.forEach(e=>s.insert(e)),s}insert(e){if(0===this.Ee)return;let t=__PRIVATE_getMd5HashValue(e),[n,i]=__PRIVATE_get64BitUints(t);for(let e=0;e<this.hashCount;e++){let t=this.Ae(n,i,e);this.Ve(t)}}Ve(e){this.bitmap[Math.floor(e/8)]|=1<<e%8}};let __PRIVATE_BloomFilterError=class __PRIVATE_BloomFilterError extends
1960Error{constructor(){super(...arguments),this.name="BloomFilterError"}};/** 1961 * @license 1962 * Copyright 2017 Google LLC 1963 * 1964 * Licensed under the Apache License, Version 2.0 (the "License"); 1965 * you may not use this file except in compliance with the License. 1966 * You may obtain a copy of the License at 1967 * 1968 * http://www.apache.org/licenses/LICENSE-2.0 1969 * 1970 * Unless required by applicable law or agreed to in writing, software 1971 * distributed under the License is distributed on an "AS IS" BASIS, 1972 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1973 * See the License for the specific language governing permissions and 1974 * limitations under the License. 1975 */let RemoteEvent=class RemoteEvent{constructor(e,t,n,i,s){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=i,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,t,n){let i=new Map;return i.set(e,TargetChange.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new RemoteEvent(Snapsh
1975otVersion.min(),i,new SortedMap(__PRIVATE_primitiveComparator),ta,__PRIVATE_documentKeySet())}};let TargetChange=class TargetChange{constructor(e,t,n,i,s){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=i,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new TargetChange(n,t,__PRIVATE_documentKeySet(),__PRIVATE_documentKeySet(),__PRIVATE_documentKeySet())}};/** 1976 * @license 1977 * Copyright 2017 Google LLC 1978 * 1979 * Licensed under the Apache License, Version 2.0 (the "License"); 1980 * you may not use this file except in compliance with the License. 1981 * You may obtain a copy of the License at 1982 * 1983 * http://www.apache.org/licenses/LICENSE-2.0 1984 * 1985 * Unless required by applicable law or agreed to in writing, software 1986 * distributed under the License is distributed on an "AS IS" BASIS, 1987 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1988 * See the License for the specific language governing permissions and 1989 * limitations under the License. 1990 */let __PRIVATE_DocumentWatchChange=class __PRIVATE_DocumentWatchChange{constructor(e,t,n,i){this.me=e,this.removedTargetIds=t,this.key=n,this.fe=i}};let __PRIVATE_ExistenceFilterChange=class __PRIVATE_ExistenceFilterChange{constructor(e,t){this.targetId=e,this.ge=t}};let __PRIVATE_WatchTargetChange=class __PRIVATE_WatchTargetChange{constructor(e,t,n=ByteString.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=i}};let __PRIVATE_TargetState=class __PRIVATE_TargetState{constructor(){this.pe=0,this.ye=__PRIVATE_snapshotChangesMap(),this.we=ByteString.EMPTY_BYTE_STRING,this.Se=!1,this.be=!0}get current(){return this.Se}get resumeToken(){return this.we}get De(){return 0!==this.pe}get Ce(){return this.be}ve(e){e.approximateByteSize()>0&&(this.be=!0,this.we=e)}Fe(){let e=__PRIVATE_documentKeySet(),t=__PRIVATE_documentKeySet(),n=__PRIVATE_documentKeySet();return this.ye.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:n=n.add(i);break;default:fail()}}),new TargetChange(this.we,this.Se,e,t,n)}Me(){this.be=!1,this.ye=__PRIVATE_snapshotChangesMap()}xe(e,t){this.be=!0,this.ye=this.ye.insert(e,t)}Oe(e){this.be=!0,this.ye=this.ye.remove(e)}Ne(){this.pe+=1}Be(){this.pe-=1}Le(){this.be=!0,this.Se=!0}};let __PRIVATE_WatchChangeAggregator=class __PRIVATE_WatchChangeAggregator{constructor(e){this.ke=e,this.qe=new Map,this.Qe=ta,this.Ke=__PRIVATE_documentTargetMap(),this.$e=new SortedMap(__PRIVATE_primitiveComparator)}Ue(e){for(let t of e.me)e.fe&&e.fe.isFoundDocument()?this.We(t,e.fe):this.Ge(t,e.key,e.fe);for(let t of e.removedTargetIds)this.Ge(t,e.key,e.fe)}ze(e){this.forEachTarget(e,t=>{let n=this.je(t);switch(e.state){case 0:this.He(t)&&n.ve(e.resumeToken);break;case 1:n.Be(),n.De||n.Me(),n.ve(e.resumeToken);break;case 2:n.Be(),n.De||this.removeTarget(t);break;case 3:this.He(t)&&(n.Le(),n.ve(e.resumeToken));break;case 4:this.He(t)&&(this.Je(t),n.ve(e.resumeToken));break;default:fail()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.qe.forEach((e,n)=>{this.He(n)&&t(n)})}Ye(e){let t=e.targetId,n=e.ge.count,i=this.Ze(t);if(i){let s=i.target;if(__PRIVATE_targetIsDocumentTarget(s)){if(0===n){let e=new DocumentKey(s.path);this.Ge(t,e,MutableDocument.newNoDocument(e,SnapshotVersion.min()))}else 1===n||fail()}else{let i=this.Xe(t);if(i!==n){let n=this.et(e),s=n?this.tt(n,e,i):1;0!==s&&(this.Je(t),this.$e=this.$e.insert(t,2===s?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch"))}}}}et(e){let t,n;let i=e.ge.unchangedNames;if(!i||!i.bits)return null;let{bits:{bitmap:s="",padding:o=0},hashCount:l=0}=i;try{t=__PRIVATE_normalizeByteString(s).toUint8Array()}catch(e){if(e instanceof __PRIVATE_Base64DecodeError)return __PRIVATE_logWarn("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{n=new BloomFilter(t,o,l)}catch(e){return __PRIVATE_logWarn(e instanceof __PRIVATE_BloomFilterError?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===n.Ee?null:n}tt(e,t,n){return t.ge.count===n-this.it(e,t.targetId)?0:2}it(e,t){let n=this.ke.getRemoteKeysForTarget(t),i=0;
1990return n.forEach(n=>{let s=this.ke.rt(),o=`projects/${s.projectId}/databases/${s.database}/documents/${n.path.canonicalString()}`;e.mightContain(o)||(this.Ge(t,n,null),i++)}),i}st(e){let t=new Map;this.qe.forEach((n,i)=>{let s=this.Ze(i);if(s){if(n.current&&__PRIVATE_targetIsDocumentTarget(s.target)){let t=new DocumentKey(s.target.path);null!==this.Qe.get(t)||this.ot(i,t)||this.Ge(i,t,MutableDocument.newNoDocument(t,e))}n.Ce&&(t.set(i,n.Fe()),n.Me())}});let n=__PRIVATE_documentKeySet();this.Ke.forEach((e,t)=>{let i=!0;t.forEachWhile(e=>{let t=this.Ze(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(i=!1,!1)}),i&&(n=n.add(e))}),this.Qe.forEach((t,n)=>n.setReadTime(e));let i=new RemoteEvent(e,t,this.$e,this.Qe,n);return this.Qe=ta,this.Ke=__PRIVATE_documentTargetMap(),this.$e=new SortedMap(__PRIVATE_primitiveComparator),i}We(e,t){if(!this.He(e))return;let n=this.ot(e,t.key)?2:0;this.je(e).xe(t.key,n),this.Qe=this.Qe.insert(t.key,t),this.Ke=this.Ke.insert(t.key,this._t(t.key).add(e))}Ge(e,t,n){if(!this.He(e))return;let i=this.je(e);this.ot(e,t)?i.xe(t,1):i.Oe(t),this.Ke=this.Ke.insert(t,this._t(t).delete(e)),n&&(this.Qe=this.Qe.insert(t,n))}removeTarget(e){this.qe.delete(e)}Xe(e){let t=this.je(e).Fe();return this.ke.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Ne(e){this.je(e).Ne()}je(e){let t=this.qe.get(e);return t||(t=new __PRIVATE_TargetState,this.qe.set(e,t)),t}_t(e){let t=this.Ke.get(e);return t||(t=new SortedSet(__PRIVATE_primitiveComparator),this.Ke=this.Ke.insert(e,t)),t}He(e){let t=null!==this.Ze(e);return t||__PRIVATE_logDebug("WatchChangeAggregator","Detected inactive target",e),t}Ze(e){let t=this.qe.get(e);return t&&t.De?null:this.ke.ut(e)}Je(e){this.qe.set(e,new __PRIVATE_TargetState),this.ke.getRemoteKeysForTarget(e).forEach(t=>{this.Ge(e,t,null)})}ot(e,t){return this.ke.getRemoteKeysForTarget(e).has(t)}};function __PRIVATE_documentTargetMap(){return new SortedMap(DocumentKey.comparator)}function __PRIVATE_snapshotChangesMap(){return new SortedMap(DocumentKey.comparator)}let td={asc:"ASCENDING",desc:"DESCENDING"},t_={"<":"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"},tf={and:"AND",or:"OR"};let JsonProtoSerializer=class JsonProtoSerializer{constructor(e,t){this.databaseId=e,this.useProto3Json=t}};function __PRIVATE_toInt32Proto(e,t){return e.useProto3Json||null==t?t:{value:t}}function toTimestamp(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function __PRIVATE_toBytes(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function __PRIVATE_fromVersion(e){return e||fail(),SnapshotVersion.fromTimestamp(function(e){let t=__PRIVATE_normalizeTimestamp(e);return new Timestamp(t.seconds,t.nanos)}(e))}function __PRIVATE_toResourceName(e,t){return new ResourcePath(["projects",e.projectId,"databases",e.database]).child("documents").child(t).canonicalString()}function __PRIVATE_fromResourceName(e){let t=ResourcePath.fromString(e);return __PRIVATE_isValidResourceName(t)||fail(),t}function __PRIVATE_toName(e,t){return __PRIVATE_toResourceName(e.databaseId,t.path)}function fromName(e,t){let n=__PRIVATE_fromResourceName(t);if(n.get(1)!==e.databaseId.projectId)throw new FirestoreError(tr.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new FirestoreError(tr.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new DocumentKey(__PRIVATE_extractLocalPathFromResourceName(n))}function __PRIVATE_toQueryPath(e,t){return __PRIVATE_toResourceName(e.databaseId,t)}function __PRIVATE_getEncodedDatabaseId(e){return new ResourcePath(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function __PRIVATE_extractLocalPathFromResourceName(e){return e.length>4&&"documents"===e.get(4)||fail(),e.popFirst(5)}function __PRIVATE_toMutationDocument(e,t,n){return{name:__PRIVATE_toName(e,t),fields:n.value.mapValue.fields}}function __PRIVATE_toFieldPathReference(e){return{fieldPath:e.canonicalString()}}function __PRIVATE_fromFieldPathReference(e){return FieldPath$1.fromServerFormat(e.fieldPath)}function __PRIVATE_isValidResourceName(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}/** 1991 * @license 1992 * Copyright 2017 Google LLC 1993 * 1994 * Licensed under the Apache License, Version 2.0 (the "License");
1995 * you may not use this file except in compliance with the License. 1996 * You may obtain a copy of the License at 1997 * 1998 * http://www.apache.org/licenses/LICENSE-2.0 1999 * 2000 * Unless required by applicable law or agreed to in writing, software 2001 * distributed under the License is distributed on an "AS IS" BASIS, 2002 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2003 * See the License for the specific language governing permissions and 2004 * limitations under the License. 2005 */let TargetData=class TargetData{constructor(e,t,n,i,s=SnapshotVersion.min(),o=SnapshotVersion.min(),l=ByteString.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=l,this.expectedCount=u}withSequenceNumber(e){return new TargetData(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new TargetData(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new TargetData(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new TargetData(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}};/** 2006 * @license 2007 * Copyright 2017 Google LLC 2008 * 2009 * Licensed under the Apache License, Version 2.0 (the "License"); 2010 * you may not use this file except in compliance with the License. 2011 * You may obtain a copy of the License at 2012 * 2013 * http://www.apache.org/licenses/LICENSE-2.0 2014 * 2015 * Unless required by applicable law or agreed to in writing, software 2016 * distributed under the License is distributed on an "AS IS" BASIS, 2017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2018 * See the License for the specific language governing permissions and 2019 * limitations under the License. 2020 */let __PRIVATE_LocalSerializer=class __PRIVATE_LocalSerializer{constructor(e){this.ct=e}};/** 2021 * @license 2022 * Copyright 2021 Google LLC 2023 * 2024 * Licensed under the Apache License, Version 2.0 (the "License"); 2025 * you may not use this file except in compliance with the License. 2026 * You may obtain a copy of the License at 2027 * 2028 * http://www.apache.org/licenses/LICENSE-2.0 2029 * 2030 * Unless required by applicable law or agreed to in writing, software 2031 * distributed under the License is distributed on an "AS IS" BASIS, 2032 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2033 * See the License for the specific language governing permissions and 2034 * limitations under the License. 2035 */let __PRIVATE_FirestoreIndexValueWriter=class __PRIVATE_FirestoreIndexValueWriter{constructor(){}Pt(e,t){this.It(e,t),t.Tt()}It(e,t){if("nullValue"in e)this.Et(t,5);else if("booleanValue"in e)this.Et(t,10),t.dt(e.booleanValue?1:0);else if("integerValue"in e)this.Et(t,15),t.dt(__PRIVATE_normalizeNumber(e.integerValue));else if("doubleValue"in e){let n=__PRIVATE_normalizeNumber(e.doubleValue);isNaN(n)?this.Et(t,13):(this.Et(t,15),__PRIVATE_isNegativeZero(n)?t.dt(0):t.dt(n))}else if("timestampValue"in e){let n=e.timestampValue;this.Et(t,20),"string"==typeof n?t.At(n):(t.At(`${n.seconds||""}`),t.dt(n.nanos||0))}else if("stringValue"in e)this.Rt(e.stringValue,t),this.Vt(t);else if("bytesValue"in e)this.Et(t,30),t.ft(__PRIVATE_normalizeByteString(e.bytesValue)),this.Vt(t);else if("referenceValue"in e)this.gt(e.referenceValue,t);else if("geoPointValue"in e){let n=e.geoPointValue;this.Et(t,45),t.dt(n.latitude||0),t.dt(n.longitude||0)}else"mapValue"in e?__PRIVATE_isMaxValue(e)?this.Et(t,Number.MAX_SAFE_INTEGER):(this.yt(e.mapValue,t),this.Vt(t)):"arrayValue"in e?(this.wt(e.arrayValue,t),this.Vt(t)):fail()}Rt(e,t){this.Et(t,25),this.St(e,t)}St(e,t){t.At(e)}yt(e,t){let n=e.fields||{};for(let e of(this.Et(t,55),Object.keys(n)))this.Rt(e,t),this.It(n[e],t)}wt(e,t){let n=e.values||[];for(let e of(this.Et(t,50),n))this.It(e,t)}
2035gt(e,t){this.Et(t,37),DocumentKey.fromName(e).path.forEach(e=>{this.Et(t,60),this.St(e,t)})}Et(e,t){e.dt(t)}Vt(e){e.dt(2)}};__PRIVATE_FirestoreIndexValueWriter.bt=new __PRIVATE_FirestoreIndexValueWriter;/** 2036 * @license 2037 * Copyright 2019 Google LLC 2038 * 2039 * Licensed under the Apache License, Version 2.0 (the "License"); 2040 * you may not use this file except in compliance with the License. 2041 * You may obtain a copy of the License at 2042 * 2043 * http://www.apache.org/licenses/LICENSE-2.0 2044 * 2045 * Unless required by applicable law or agreed to in writing, software 2046 * distributed under the License is distributed on an "AS IS" BASIS, 2047 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2048 * See the License for the specific language governing permissions and 2049 * limitations under the License. 2050 */let __PRIVATE_MemoryIndexManager=class __PRIVATE_MemoryIndexManager{constructor(){this._n=new __PRIVATE_MemoryCollectionParentIndex}addToCollectionParentIndex(e,t){return this._n.add(t),PersistencePromise.resolve()}getCollectionParents(e,t){return PersistencePromise.resolve(this._n.getEntries(t))}addFieldIndex(e,t){return PersistencePromise.resolve()}deleteFieldIndex(e,t){return PersistencePromise.resolve()}deleteAllFieldIndexes(e){return PersistencePromise.resolve()}createTargetIndexes(e,t){return PersistencePromise.resolve()}getDocumentsMatchingTarget(e,t){return PersistencePromise.resolve(null)}getIndexType(e,t){return PersistencePromise.resolve(0)}getFieldIndexes(e,t){return PersistencePromise.resolve([])}getNextCollectionGroupToUpdate(e){return PersistencePromise.resolve(null)}getMinOffset(e,t){return PersistencePromise.resolve(IndexOffset.min())}getMinOffsetFromCollectionGroup(e,t){return PersistencePromise.resolve(IndexOffset.min())}updateCollectionGroup(e,t,n){return PersistencePromise.resolve()}updateIndexEntries(e,t){return PersistencePromise.resolve()}};let __PRIVATE_MemoryCollectionParentIndex=class __PRIVATE_MemoryCollectionParentIndex{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),i=this.index[t]||new SortedSet(ResourcePath.comparator),s=!i.has(n);return this.index[t]=i.add(n),s}has(e){let t=e.lastSegment(),n=e.popLast(),i=this.index[t];return i&&i.has(n)}getEntries(e){return(this.index[e]||new SortedSet(ResourcePath.comparator)).toArray()}};new Uint8Array(0);let LruParams=class LruParams{constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}static withCacheSize(e){return new LruParams(e,LruParams.DEFAULT_COLLECTION_PERCENTILE,LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}};/** 2051 * @license 2052 * Copyright 2017 Google LLC 2053 * 2054 * Licensed under the Apache License, Version 2.0 (the "License"); 2055 * you may not use this file except in compliance with the License. 2056 * You may obtain a copy of the License at 2057 * 2058 * http://www.apache.org/licenses/LICENSE-2.0 2059 * 2060 * Unless required by applicable law or agreed to in writing, software 2061 * distributed under the License is distributed on an "AS IS" BASIS, 2062 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2063 * See the License for the specific language governing permissions and 2064 * limitations under the License. 2065 */LruParams.DEFAULT_COLLECTION_PERCENTILE=10,LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,LruParams.DEFAULT=new LruParams(41943040,LruParams.DEFAULT_COLLECTION_PERCENTILE,LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),LruParams.DISABLED=new LruParams(-1,0,0);/** 2066 * @license 2067 * Copyright 2017 Google LLC 2068 * 2069 * Licensed under the Apache License, Version 2.0 (the "License"); 2070 * you may not use this file except in compliance with the License. 2071 * You may obtain a copy of the License at 2072 * 2073 * http://www.apache.org/licenses/LICENSE-2.0 2074 * 2075 * Unless required by applicable law or agreed to in writing, software 2076 * distributed under the License is distributed on an "AS IS" BASIS, 2077 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2078 * See the License for the specific language governing permissions and 2079 * limitations under the License. 2080 */let __PRIVATE_TargetIdGenerator=class __PRIVATE_TargetIdGenerator{constructor(e){this.On=e}next(){return this.On+=2,this.On}static Nn(){return new __PRIVATE_TargetIdGenerator(0)}static Bn(){return new __PRIVATE_TargetIdGenerator(-1)}};/** 2081 * @license 2082 * Copyright 2017 Google LLC 2083 * 2084 * Licensed under the Apache License, Version 2.0 (the "License");
2085 * you may not use this file except in compliance with the License. 2086 * You may obtain a copy of the License at 2087 * 2088 * http://www.apache.org/licenses/LICENSE-2.0 2089 * 2090 * Unless required by applicable law or agreed to in writing, software 2091 * distributed under the License is distributed on an "AS IS" BASIS, 2092 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2093 * See the License for the specific language governing permissions and 2094 * limitations under the License. 2095 */let RemoteDocumentChangeBuffer=class RemoteDocumentChangeBuffer{constructor(){this.changes=new ObjectMap(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,MutableDocument.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return void 0!==n?PersistencePromise.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}};/** 2096 * @license 2097 * Copyright 2017 Google LLC 2098 * 2099 * Licensed under the Apache License, Version 2.0 (the "License"); 2100 * you may not use this file except in compliance with the License. 2101 * You may obtain a copy of the License at 2102 * 2103 * http://www.apache.org/licenses/LICENSE-2.0 2104 * 2105 * Unless required by applicable law or agreed to in writing, software 2106 * distributed under the License is distributed on an "AS IS" BASIS, 2107 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2108 * See the License for the specific language governing permissions and 2109 * limitations under the License. 2110 *//** 2111 * @license 2112 * Copyright 2022 Google LLC 2113 * 2114 * Licensed under the Apache License, Version 2.0 (the "License"); 2115 * you may not use this file except in compliance with the License. 2116 * You may obtain a copy of the License at 2117 * 2118 * http://www.apache.org/licenses/LICENSE-2.0 2119 * 2120 * Unless required by applicable law or agreed to in writing, software 2121 * distributed under the License is distributed on an "AS IS" BASIS, 2122 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2123 * See the License for the specific language governing permissions and 2124 * limitations under the License. 2125 */let OverlayedDocument=class OverlayedDocument{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}};/** 2126 * @license 2127 * Copyright 2017 Google LLC 2128 * 2129 * Licensed under the Apache License, Version 2.0 (the "License"); 2130 * you may not use this file except in compliance with the License. 2131 * You may obtain a copy of the License at 2132 * 2133 * http://www.apache.org/licenses/LICENSE-2.0 2134 * 2135 * Unless required by applicable law or agreed to in writing, software 2136 * distributed under the License is distributed on an "AS IS" BASIS, 2137 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2138 * See the License for the specific language governing permissions and 2139 * limitations under the License. 2140 */let LocalDocumentsView=class LocalDocumentsView{constructor(e,t,n,i){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=i}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(i=>(n=i,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&__PRIVATE_mutationApplyToLocalView(n.mutation,e,FieldMask.empty(),Timestamp.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,__PRIVATE_documentKeySet()).next(()=>t))}getLocalViewOfDocuments(e,t,n=__PRIVATE_documentKeySet()){let i=__PRIVATE_newDocumentKeyMap();return this.populateOverlays(e,i,t).next(()=>this.computeViews(e,t,i,n).next(e=>{let t=documentMap();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){let n=__PRIVATE_newDocumentKeyMap();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,__PRIVATE_documentKeySet()))}populateOverlays(e,t,n){let i=[];return n.forEach(e=>{t.has(e)||i.push(e)}),this.documentOverlayCache.getOverlays(e,i).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,i){let s=ta,o=__PRIVATE_newDocumentKeyMap(),l=__PRIVATE_newDocumentKeyMap();return t.forEach((e,t)=>{let l=n.get(t.key);i.has(t.key)&&(void 0===l||l.mutation instanceof __PRIVATE_PatchMutation)?s=s.insert(t.key,t):void 0!==l?(o.set(t.key,l.mutation.getFieldMask()),__PRIVATE_mutationApplyToLocalView(l.mutation,t,l.mutation.getFieldMask(),Timestamp.now())):o.set(t.key,FieldMask.empty())}),this.recalculateAndSaveOverlays(e,s).next(e=>(e.forEach((e,t)=>o.set(e,t)),t.forEach((e,t)=>{var n;return l.set(e,new OverlayedDocument(t,null!==(n=o.get(e))&&void 0!==n?n:null))}),l))}recalculateAndSaveOverlays(e,t){let n=__PRIVATE_newDocumentKeyMap(),i=new SortedMap((e,t)=>e-t),s=__PRIVATE_documentKeySet();
2140return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(let s of e)s.keys().forEach(e=>{let o=t.get(e);if(null===o)return;let l=n.get(e)||FieldMask.empty();l=s.applyToLocalView(o,l),n.set(e,l);let u=(i.get(s.batchId)||__PRIVATE_documentKeySet()).add(e);i=i.insert(s.batchId,u)})}).next(()=>{let o=[],l=i.getReverseIterator();for(;l.hasNext();){let i=l.getNext(),u=i.key,h=i.value,d=__PRIVATE_newDocumentKeyMap();h.forEach(e=>{if(!s.has(e)){let i=__PRIVATE_calculateOverlayMutation(t.get(e),n.get(e));null!==i&&d.set(e,i),s=s.add(e)}}),o.push(this.documentOverlayCache.saveOverlays(e,u,d))}return PersistencePromise.waitFor(o)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,i){return DocumentKey.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length?this.getDocumentsMatchingDocumentQuery(e,t.path):__PRIVATE_isCollectionGroupQuery(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,i):this.getDocumentsMatchingCollectionQuery(e,t,n,i)}getNextDocuments(e,t,n,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,i).next(s=>{let o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,i-s.size):PersistencePromise.resolve(__PRIVATE_newDocumentKeyMap()),l=-1,u=s;return o.next(t=>PersistencePromise.forEach(t,(t,n)=>(l<n.largestBatchId&&(l=n.largestBatchId),s.get(t)?PersistencePromise.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{u=u.insert(t,e)}))).next(()=>this.populateOverlays(e,t,s)).next(()=>this.computeViews(e,u,t,__PRIVATE_documentKeySet())).next(e=>({batchId:l,changes:__PRIVATE_convertOverlayedDocumentMapToDocumentMap(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new DocumentKey(t)).next(e=>{let t=documentMap();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,i){let s=t.collectionGroup,o=documentMap();return this.indexManager.getCollectionParents(e,s).next(l=>PersistencePromise.forEach(l,l=>{var u;let h=(u=l.child(s),new __PRIVATE_QueryImpl(u,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt));return this.getDocumentsMatchingCollectionQuery(e,h,n,i).next(e=>{e.forEach((e,t)=>{o=o.insert(e,t)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,t,n,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s,i))).next(e=>{s.forEach((t,n)=>{let i=n.getKey();null===e.get(i)&&(e=e.insert(i,MutableDocument.newInvalidDocument(i)))});let n=documentMap();return e.forEach((e,i)=>{let o=s.get(e);void 0!==o&&__PRIVATE_mutationApplyToLocalView(o.mutation,i,FieldMask.empty(),Timestamp.now()),__PRIVATE_queryMatches(t,i)&&(n=n.insert(e,i))}),n})}};/** 2141 * @license 2142 * Copyright 2020 Google LLC 2143 * 2144 * Licensed under the Apache License, Version 2.0 (the "License"); 2145 * you may not use this file except in compliance with the License. 2146 * You may obtain a copy of the License at 2147 * 2148 * http://www.apache.org/licenses/LICENSE-2.0 2149 * 2150 * Unless required by applicable law or agreed to in writing, software 2151 * distributed under the License is distributed on an "AS IS" BASIS, 2152 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2153 * See the License for the specific language governing permissions and 2154 * limitations under the License. 2155 */let __PRIVATE_MemoryBundleCache=class __PRIVATE_MemoryBundleCache{constructor(e){this.serializer=e,this.cr=new Map,this.lr=new Map}getBundleMetadata(e,t){return PersistencePromise.resolve(this.cr.get(t))}saveBundleMetadata(e,t){return this.cr.set(t.id,{id:t.id,version:t.version,createTime:__PRIVATE_fromVersion(t.createTime)}),PersistencePromise.resolve()}getNamedQuery(e,t){return PersistencePromise.resolve(this.lr.get(t))}saveNamedQuery(e,t){return this.lr.set(t.name,{name:t.name,query:function(e){let t=function(e){var t,n,i,s,o,l,u,h;let d,_=function(e){let t=__PRIVATE_fromResourceName(e);return 4===t.length?ResourcePath.emptyPath():__PRIVATE_extractLocalPathFromResourceName(t)}(e.parent),m=e.structuredQuery,g=m.from?m.from.length:0,E=null;if(g>0){1===g||fail();let e=m.from[0];e.allDescendants?E=e.collectionId:_=_.child(e.collectionId)}let b=[];m.where&&(b=function(e){var t;let n=function __PRIVATE_fromFilter(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":let t=__PRIVATE_fromFieldPathReference(e.unaryFilter.field);return FieldFilter.create(t,"==",{doubleValue:NaN});case"IS_NULL":let n=__PRIVATE_fromFieldPathReference(e.unaryFilter.field);return FieldFilter.create(n,"==",{nullValue:"NULL_VALUE"});
2155case"IS_NOT_NAN":let i=__PRIVATE_fromFieldPathReference(e.unaryFilter.field);return FieldFilter.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let s=__PRIVATE_fromFieldPathReference(e.unaryFilter.field);return FieldFilter.create(s,"!=",{nullValue:"NULL_VALUE"});default:return fail()}}(e):void 0!==e.fieldFilter?FieldFilter.create(__PRIVATE_fromFieldPathReference(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return fail()}}(e.fieldFilter.op),e.fieldFilter.value):void 0!==e.compositeFilter?CompositeFilter.create(e.compositeFilter.filters.map(e=>__PRIVATE_fromFilter(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return fail()}}(e.compositeFilter.op)):fail()}(e);return n instanceof CompositeFilter&&__PRIVATE_compositeFilterIsFlat(t=n)&&__PRIVATE_compositeFilterIsConjunction(t)?n.getFilters():[n]}(m.where));let V=[];m.orderBy&&(V=m.orderBy.map(e=>new OrderBy(__PRIVATE_fromFieldPathReference(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))));let k=null;m.limit&&(k=null==(d="object"==typeof(t=m.limit)?t.value:t)?null:d);let L=null;m.startAt&&(L=function(e){let t=!!e.before,n=e.values||[];return new Bound(n,t)}(m.startAt));let j=null;return m.endAt&&(j=function(e){let t=!e.before,n=e.values||[];return new Bound(n,t)}(m.endAt)),n=_,i=E,s=V,o=b,l=k,u=L,h=j,new __PRIVATE_QueryImpl(n,i,s,o,l,"F",u,h)}({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?__PRIVATE_queryWithLimit(t,t.limit,"L"):t}(t.bundledQuery),readTime:__PRIVATE_fromVersion(t.readTime)}),PersistencePromise.resolve()}};/** 2156 * @license 2157 * Copyright 2022 Google LLC 2158 * 2159 * Licensed under the Apache License, Version 2.0 (the "License"); 2160 * you may not use this file except in compliance with the License. 2161 * You may obtain a copy of the License at 2162 * 2163 * http://www.apache.org/licenses/LICENSE-2.0 2164 * 2165 * Unless required by applicable law or agreed to in writing, software 2166 * distributed under the License is distributed on an "AS IS" BASIS, 2167 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2168 * See the License for the specific language governing permissions and 2169 * limitations under the License. 2170 */let __PRIVATE_MemoryDocumentOverlayCache=class __PRIVATE_MemoryDocumentOverlayCache{constructor(){this.overlays=new SortedMap(DocumentKey.comparator),this.hr=new Map}getOverlay(e,t){return PersistencePromise.resolve(this.overlays.get(t))}getOverlays(e,t){let n=__PRIVATE_newDocumentKeyMap();return PersistencePromise.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&n.set(t,e)})).next(()=>n)}saveOverlays(e,t,n){return n.forEach((n,i)=>{this.ht(e,t,i)}),PersistencePromise.resolve()}removeOverlaysForBatchId(e,t,n){let i=this.hr.get(n);return void 0!==i&&(i.forEach(e=>this.overlays=this.overlays.remove(e)),this.hr.delete(n)),PersistencePromise.resolve()}getOverlaysForCollection(e,t,n){let i=__PRIVATE_newDocumentKeyMap(),s=t.length+1,o=new DocumentKey(t.child("")),l=this.overlays.getIteratorFrom(o);for(;l.hasNext();){let e=l.getNext().value,o=e.getKey();if(!t.isPrefixOf(o.path))break;o.path.length===s&&e.largestBatchId>n&&i.set(e.getKey(),e)}return PersistencePromise.resolve(i)}getOverlaysForCollectionGroup(e,t,n,i){let s=new SortedMap((e,t)=>e-t),o=this.overlays.getIterator();for(;o.hasNext();){let e=o.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=s.get(e.largestBatchId);null===t&&(t=__PRIVATE_newDocumentKeyMap(),s=s.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let l=__PRIVATE_newDocumentKeyMap(),u=s.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach((e,t)=>l.set(e,t)),!(l.size()>=i)););return PersistencePromise.resolve(l)}ht(e,t,n){let i=this.overlays.get(n.key);if(null!==i){let e=this.hr.get(i.largestBatchId).delete(n.key);this.hr.set(i.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new Overlay(t,n));let s=this.hr.get(t);void 0===s&&(s=__PRIVATE_documentKeySet(),this.hr.set(t,s)),this.hr.set(t,s.add(n.key))}};/** 2171 * @license 2172 * Copyright 2017 Google LLC 2173 * 2174 * Licensed under the Apache License, Version 2.0 (the "License");
2175 * you may not use this file except in compliance with the License. 2176 * You may obtain a copy of the License at 2177 * 2178 * http://www.apache.org/licenses/LICENSE-2.0 2179 * 2180 * Unless required by applicable law or agreed to in writing, software 2181 * distributed under the License is distributed on an "AS IS" BASIS, 2182 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2183 * See the License for the specific language governing permissions and 2184 * limitations under the License. 2185 */let __PRIVATE_ReferenceSet=class __PRIVATE_ReferenceSet{constructor(){this.Pr=new SortedSet(__PRIVATE_DocReference.Ir),this.Tr=new SortedSet(__PRIVATE_DocReference.Er)}isEmpty(){return this.Pr.isEmpty()}addReference(e,t){let n=new __PRIVATE_DocReference(e,t);this.Pr=this.Pr.add(n),this.Tr=this.Tr.add(n)}dr(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.Ar(new __PRIVATE_DocReference(e,t))}Rr(e,t){e.forEach(e=>this.removeReference(e,t))}Vr(e){let t=new DocumentKey(new ResourcePath([])),n=new __PRIVATE_DocReference(t,e),i=new __PRIVATE_DocReference(t,e+1),s=[];return this.Tr.forEachInRange([n,i],e=>{this.Ar(e),s.push(e.key)}),s}mr(){this.Pr.forEach(e=>this.Ar(e))}Ar(e){this.Pr=this.Pr.delete(e),this.Tr=this.Tr.delete(e)}gr(e){let t=new DocumentKey(new ResourcePath([])),n=new __PRIVATE_DocReference(t,e),i=new __PRIVATE_DocReference(t,e+1),s=__PRIVATE_documentKeySet();return this.Tr.forEachInRange([n,i],e=>{s=s.add(e.key)}),s}containsKey(e){let t=new __PRIVATE_DocReference(e,0),n=this.Pr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}};let __PRIVATE_DocReference=class __PRIVATE_DocReference{constructor(e,t){this.key=e,this.pr=t}static Ir(e,t){return DocumentKey.comparator(e.key,t.key)||__PRIVATE_primitiveComparator(e.pr,t.pr)}static Er(e,t){return __PRIVATE_primitiveComparator(e.pr,t.pr)||DocumentKey.comparator(e.key,t.key)}};/** 2186 * @license 2187 * Copyright 2017 Google LLC 2188 * 2189 * Licensed under the Apache License, Version 2.0 (the "License"); 2190 * you may not use this file except in compliance with the License. 2191 * You may obtain a copy of the License at 2192 * 2193 * http://www.apache.org/licenses/LICENSE-2.0 2194 * 2195 * Unless required by applicable law or agreed to in writing, software 2196 * distributed under the License is distributed on an "AS IS" BASIS, 2197 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2198 * See the License for the specific language governing permissions and 2199 * limitations under the License. 2200 */let __PRIVATE_MemoryMutationQueue=class __PRIVATE_MemoryMutationQueue{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.yr=1,this.wr=new SortedSet(__PRIVATE_DocReference.Ir)}checkEmpty(e){return PersistencePromise.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,i){let s=this.yr;this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let o=new MutationBatch(s,t,n,i);for(let t of(this.mutationQueue.push(o),i))this.wr=this.wr.add(new __PRIVATE_DocReference(t.key,s)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return PersistencePromise.resolve(o)}lookupMutationBatch(e,t){return PersistencePromise.resolve(this.Sr(t))}getNextMutationBatchAfterBatchId(e,t){let n=this.br(t+1),i=n<0?0:n;return PersistencePromise.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return PersistencePromise.resolve(0===this.mutationQueue.length?-1:this.yr-1)}getAllMutationBatches(e){return PersistencePromise.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new __PRIVATE_DocReference(t,0),i=new __PRIVATE_DocReference(t,Number.POSITIVE_INFINITY),s=[];return this.wr.forEachInRange([n,i],e=>{let t=this.Sr(e.pr);s.push(t)}),PersistencePromise.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new SortedSet(__PRIVATE_primitiveComparator);return t.forEach(e=>{let t=new __PRIVATE_DocReference(e,0),i=new __PRIVATE_DocReference(e,Number.POSITIVE_INFINITY);this.wr.forEachInRange([t,i],e=>{n=n.add(e.pr)})}),PersistencePromise.resolve(this.Dr(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,i=n.length+1,s=n;DocumentKey.isDocumentKey(s)||(s=s.child(""));
2200let o=new __PRIVATE_DocReference(new DocumentKey(s),0),l=new SortedSet(__PRIVATE_primitiveComparator);return this.wr.forEachWhile(e=>{let t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===i&&(l=l.add(e.pr)),!0)},o),PersistencePromise.resolve(this.Dr(l))}Dr(e){let t=[];return e.forEach(e=>{let n=this.Sr(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){0===this.Cr(t.batchId,"removed")||fail(),this.mutationQueue.shift();let n=this.wr;return PersistencePromise.forEach(t.mutations,i=>{let s=new __PRIVATE_DocReference(i.key,t.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.wr=n})}Mn(e){}containsKey(e,t){let n=new __PRIVATE_DocReference(t,0),i=this.wr.firstAfterOrEqual(n);return PersistencePromise.resolve(t.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,PersistencePromise.resolve()}Cr(e,t){return this.br(e)}br(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Sr(e){let t=this.br(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}};/** 2201 * @license 2202 * Copyright 2017 Google LLC 2203 * 2204 * Licensed under the Apache License, Version 2.0 (the "License"); 2205 * you may not use this file except in compliance with the License. 2206 * You may obtain a copy of the License at 2207 * 2208 * http://www.apache.org/licenses/LICENSE-2.0 2209 * 2210 * Unless required by applicable law or agreed to in writing, software 2211 * distributed under the License is distributed on an "AS IS" BASIS, 2212 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2213 * See the License for the specific language governing permissions and 2214 * limitations under the License. 2215 */let __PRIVATE_MemoryRemoteDocumentCacheImpl=class __PRIVATE_MemoryRemoteDocumentCacheImpl{constructor(e){this.vr=e,this.docs=new SortedMap(DocumentKey.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let n=t.key,i=this.docs.get(n),s=i?i.size:0,o=this.vr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){let t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){let n=this.docs.get(t);return PersistencePromise.resolve(n?n.document.mutableCopy():MutableDocument.newInvalidDocument(t))}getEntries(e,t){let n=ta;return t.forEach(e=>{let t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():MutableDocument.newInvalidDocument(e))}),PersistencePromise.resolve(n)}getDocumentsMatchingQuery(e,t,n,i){let s=ta,o=t.path,l=new DocumentKey(o.child("")),u=this.docs.getIteratorFrom(l);for(;u.hasNext();){let{key:e,value:{document:l}}=u.getNext();if(!o.isPrefixOf(e.path))break;e.path.length>o.length+1||0>=function(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:0!==(n=DocumentKey.comparator(e.documentKey,t.documentKey))?n:__PRIVATE_primitiveComparator(e.largestBatchId,t.largestBatchId)}(new IndexOffset(l.readTime,l.key,-1),n)||(i.has(l.key)||__PRIVATE_queryMatches(t,l))&&(s=s.insert(l.key,l.mutableCopy()))}return PersistencePromise.resolve(s)}getAllFromCollectionGroup(e,t,n,i){fail()}Fr(e,t){return PersistencePromise.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new __PRIVATE_MemoryRemoteDocumentChangeBuffer(this)}getSize(e){return PersistencePromise.resolve(this.size)}};let __PRIVATE_MemoryRemoteDocumentChangeBuffer=class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuffer{constructor(e){super(),this.ar=e}applyChanges(e){let t=[];
vendor: 5,889 bytes, lines 2215-2245
2215return this.changes.forEach((n,i)=>{i.isValidDocument()?t.push(this.ar.addEntry(e,i)):this.ar.removeEntry(n)}),PersistencePromise.waitFor(t)}getFromCache(e,t){return this.ar.getEntry(e,t)}getAllFromCache(e,t){return this.ar.getEntries(e,t)}};/** 2216 * @license 2217 * Copyright 2017 Google LLC 2218 * 2219 * Licensed under the Apache License, Version 2.0 (the "License"); 2220 * you may not use this file except in compliance with the License. 2221 * You may obtain a copy of the License at 2222 * 2223 * http://www.apache.org/licenses/LICENSE-2.0 2224 * 2225 * Unless required by applicable law or agreed to in writing, software 2226 * distributed under the License is distributed on an "AS IS" BASIS, 2227 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2228 * See the License for the specific language governing permissions and 2229 * limitations under the License. 2230 */let __PRIVATE_MemoryTargetCache=class __PRIVATE_MemoryTargetCache{constructor(e){this.persistence=e,this.Mr=new ObjectMap(e=>__PRIVATE_canonifyTarget(e),__PRIVATE_targetEquals),this.lastRemoteSnapshotVersion=SnapshotVersion.min(),this.highestTargetId=0,this.Or=0,this.Nr=new __PRIVATE_ReferenceSet,this.targetCount=0,this.Br=__PRIVATE_TargetIdGenerator.Nn()}forEachTarget(e,t){return this.Mr.forEach((e,n)=>t(n)),PersistencePromise.resolve()}getLastRemoteSnapshotVersion(e){return PersistencePromise.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return PersistencePromise.resolve(this.Or)}allocateTargetId(e){return this.highestTargetId=this.Br.next(),PersistencePromise.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Or&&(this.Or=t),PersistencePromise.resolve()}qn(e){this.Mr.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.Br=new __PRIVATE_TargetIdGenerator(t),this.highestTargetId=t),e.sequenceNumber>this.Or&&(this.Or=e.sequenceNumber)}addTargetData(e,t){return this.qn(t),this.targetCount+=1,PersistencePromise.resolve()}updateTargetData(e,t){return this.qn(t),PersistencePromise.resolve()}removeTargetData(e,t){return this.Mr.delete(t.target),this.Nr.Vr(t.targetId),this.targetCount-=1,PersistencePromise.resolve()}removeTargets(e,t,n){let i=0,s=[];return this.Mr.forEach((o,l)=>{l.sequenceNumber<=t&&null===n.get(l.targetId)&&(this.Mr.delete(o),s.push(this.removeMatchingKeysForTargetId(e,l.targetId)),i++)}),PersistencePromise.waitFor(s).next(()=>i)}getTargetCount(e){return PersistencePromise.resolve(this.targetCount)}getTargetData(e,t){let n=this.Mr.get(t)||null;return PersistencePromise.resolve(n)}addMatchingKeys(e,t,n){return this.Nr.dr(t,n),PersistencePromise.resolve()}removeMatchingKeys(e,t,n){this.Nr.Rr(t,n);let i=this.persistence.referenceDelegate,s=[];return i&&t.forEach(t=>{s.push(i.markPotentiallyOrphaned(e,t))}),PersistencePromise.waitFor(s)}removeMatchingKeysForTargetId(e,t){return this.Nr.Vr(t),PersistencePromise.resolve()}getMatchingKeysForTargetId(e,t){let n=this.Nr.gr(t);return PersistencePromise.resolve(n)}containsKey(e,t){return PersistencePromise.resolve(this.Nr.containsKey(t))}};/** 2231 * @license 2232 * Copyright 2017 Google LLC 2233 * 2234 * Licensed under the Apache License, Version 2.0 (the "License"); 2235 * you may not use this file except in compliance with the License. 2236 * You may obtain a copy of the License at 2237 * 2238 * http://www.apache.org/licenses/LICENSE-2.0 2239 * 2240 * Unless required by applicable law or agreed to in writing, software 2241 * distributed under the License is distributed on an "AS IS" BASIS, 2242 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2243 * See the License for the specific language governing permissions and 2244 * limitations under the License. 2245 */let __PRIVATE_MemoryPersistence=class __PRIVATE_MemoryPersistence{constructor(e,t){this.Lr={},this.overlays={},this.kr=new __PRIVATE_ListenSequence(0),this.qr=!1,this.qr=!0,this.referenceDelegate=e(this),this.Qr=new __PRIVATE_MemoryTargetCache(this),this.indexManager=new __PRIVATE_MemoryIndexManager,this.remoteDocumentCache=new __PRIVATE_MemoryRemoteDocumentCacheImpl(e=>this.referenceDelegate.Kr(e)),this.serializer=new __PRIVATE_LocalSerializer(t),this.$r=new __PRIVATE_MemoryBundleCache(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.qr=!1,Promise.resolve()}get started(){return this.qr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new __PRIVATE_MemoryDocumentOverlayCache,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.Lr[e.toKey()];return n||(n=new __PRIVATE_MemoryMutationQueue(t,this.referenceDelegate),this.Lr[e.toKey()]=n),n}getTargetCache(){return this.Qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.$r}runTransaction(e,t,n){__PRIVATE_logDebug("MemoryPersistence","Starting transaction:",e);let i=new __PRIVATE_MemoryTransaction(this.kr.next());return this.referenceDelegate.Ur(),n(i).next(e=>this.referenceDelegate.Wr(i).next(()=>e)).toPromise().then(e=>(i.raiseOnCommittedEvent(),e))}Gr(e,t){return PersistencePromise.or(Object.values(this.Lr).map(n=>()=>n.containsKey(e,t)))}};let __PRIVATE_MemoryTransaction=class __PRIVATE_MemoryTransaction extends PersistenceTransaction{constructor(e){super(),this.currentSequenceNumber=e}};let __PRIVATE_MemoryEagerDelegate=class __PRIVATE_MemoryEagerDelegate{constructor(e){this.persistence=e,this.zr=new __PRIVATE_ReferenceSet,this.jr=null}static Hr(e){return new __PRIVATE_MemoryEagerDelegate(e)}get Jr(){if(this.jr)return this.jr;throw fail()}addReference(e,t,n){return this.zr.addReference(n,t),this.Jr.delete(n.toString()),PersistencePromise.resolve()}removeReference(e,t,n){return this.zr.removeReference(n,t),this.Jr.add(n.toString()),PersistencePromise.resolve()}markPotentiallyOrphaned(e,t){return this.Jr.add(t.toString()),PersistencePromise.resolve()}
2245removeTarget(e,t){this.zr.Vr(t.targetId).forEach(e=>this.Jr.add(e.toString()));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.Jr.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}Ur(){this.jr=new Set}Wr(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return PersistencePromise.forEach(this.Jr,n=>{let i=DocumentKey.fromPath(n);return this.Yr(e,i).next(e=>{e||t.removeEntry(i,SnapshotVersion.min())})}).next(()=>(this.jr=null,t.apply(e)))}updateLimboDocument(e,t){return this.Yr(e,t).next(e=>{e?this.Jr.delete(t.toString()):this.Jr.add(t.toString())})}Kr(e){return 0}Yr(e,t){return PersistencePromise.or([()=>PersistencePromise.resolve(this.zr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Gr(e,t)])}};/** 2246 * @license 2247 * Copyright 2017 Google LLC 2248 * 2249 * Licensed under the Apache License, Version 2.0 (the "License"); 2250 * you may not use this file except in compliance with the License. 2251 * You may obtain a copy of the License at 2252 * 2253 * http://www.apache.org/licenses/LICENSE-2.0 2254 * 2255 * Unless required by applicable law or agreed to in writing, software 2256 * distributed under the License is distributed on an "AS IS" BASIS, 2257 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2258 * See the License for the specific language governing permissions and 2259 * limitations under the License. 2260 */let __PRIVATE_LocalViewChanges=class __PRIVATE_LocalViewChanges{constructor(e,t,n,i){this.targetId=e,this.fromCache=t,this.qi=n,this.Qi=i}static Ki(e,t){let n=__PRIVATE_documentKeySet(),i=__PRIVATE_documentKeySet();for(let e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:i=i.add(e.doc.key)}return new __PRIVATE_LocalViewChanges(e,t.fromCache,n,i)}};/** 2261 * @license 2262 * Copyright 2023 Google LLC 2263 * 2264 * Licensed under the Apache License, Version 2.0 (the "License"); 2265 * you may not use this file except in compliance with the License. 2266 * You may obtain a copy of the License at 2267 * 2268 * http://www.apache.org/licenses/LICENSE-2.0 2269 * 2270 * Unless required by applicable law or agreed to in writing, software 2271 * distributed under the License is distributed on an "AS IS" BASIS, 2272 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2273 * See the License for the specific language governing permissions and 2274 * limitations under the License. 2275 */let QueryContext=class QueryContext{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}};/** 2276 * @license 2277 * Copyright 2019 Google LLC 2278 * 2279 * Licensed under the Apache License, Version 2.0 (the "License"); 2280 * you may not use this file except in compliance with the License. 2281 * You may obtain a copy of the License at 2282 * 2283 * http://www.apache.org/licenses/LICENSE-2.0 2284 * 2285 * Unless required by applicable law or agreed to in writing, software 2286 * distributed under the License is distributed on an "AS IS" BASIS, 2287 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2288 * See the License for the specific language governing permissions and 2289 * limitations under the License. 2290 */let __PRIVATE_QueryEngine=class __PRIVATE_QueryEngine{constructor(){this.$i=!1,this.Ui=!1,this.Wi=100,this.Gi=8}initialize(e,t){this.zi=e,this.indexManager=t,this.$i=!0}getDocumentsMatchingQuery(e,t,n,i){let s={result:null};return this.ji(e,t).next(e=>{s.result=e}).next(()=>{if(!s.result)return this.Hi(e,t,i,n).next(e=>{s.result=e})}).next(()=>{if(s.result)return;let n=new QueryContext;return this.Ji(e,t,n).next(i=>{if(s.result=i,this.Ui)return this.Yi(e,t,n,i.size)})}).next(()=>s.result)}Yi(e,t,n,i){return n.documentReadCount<this.Wi?(__PRIVATE_getLogLevel()<=g.in.DEBUG&&__PRIVATE_logDebug("QueryEngine","SDK will not create cache indexes for query:",__PRIVATE_stringifyQuery(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Wi,"documents"),PersistencePromise.resolve()):(__PRIVATE_getLogLevel()<=g.in.DEBUG&&__PRIVATE_logDebug("QueryEngine","Query:",__PRIVATE_stringifyQuery(t),"scans",n.documentReadCount,"local documents and returns",i,"documents as results."),n.documentReadCount>this.Gi*i?(__PRIVATE_getLogLevel()<=g.in.DEBUG&&__PRIVATE_logDebug("QueryEngine","The SDK decides to create cache indexes for query:",__PRIVATE_stringifyQuery(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,__PRIVATE_queryToTarget(t))):PersistencePromise.resolve())}ji(e,t){if(__PRIVATE_queryMatchesAllDocuments(t))return PersistencePromise.resolve(null);let n=__PRIVATE_queryToTarget(t);return this.indexManager.getIndexType(e,n).next(i=>0===i?null:(null!==t.limit&&1===i&&(n=__PRIVATE_queryToTarget(t=__PRIVATE_queryWithLimit(t,null,"F"))),this.indexManager.getDocumentsMatchingTarget(e,n).next(i=>
2290{let s=__PRIVATE_documentKeySet(...i);return this.zi.getDocuments(e,s).next(i=>this.indexManager.getMinOffset(e,n).next(n=>{let o=this.Zi(t,i);return this.Xi(t,o,s,n.readTime)?this.ji(e,__PRIVATE_queryWithLimit(t,null,"F")):this.es(e,o,t,n)}))})))}Hi(e,t,n,i){return __PRIVATE_queryMatchesAllDocuments(t)||i.isEqual(SnapshotVersion.min())?PersistencePromise.resolve(null):this.zi.getDocuments(e,n).next(s=>{let o=this.Zi(t,s);return this.Xi(t,o,n,i)?PersistencePromise.resolve(null):(__PRIVATE_getLogLevel()<=g.in.DEBUG&&__PRIVATE_logDebug("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),__PRIVATE_stringifyQuery(t)),this.es(e,o,t,function(e,t){let n=e.toTimestamp().seconds,i=e.toTimestamp().nanoseconds+1,s=SnapshotVersion.fromTimestamp(1e9===i?new Timestamp(n+1,0):new Timestamp(n,i));return new IndexOffset(s,DocumentKey.empty(),-1)}(i,0)).next(e=>e))})}Zi(e,t){let n=new SortedSet(__PRIVATE_newQueryComparator(e));return t.forEach((t,i)=>{__PRIVATE_queryMatches(e,i)&&(n=n.add(i))}),n}Xi(e,t,n,i){if(null===e.limit)return!1;if(n.size!==t.size)return!0;let s="F"===e.limitType?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}Ji(e,t,n){return __PRIVATE_getLogLevel()<=g.in.DEBUG&&__PRIVATE_logDebug("QueryEngine","Using full collection scan to execute query:",__PRIVATE_stringifyQuery(t)),this.zi.getDocumentsMatchingQuery(e,t,IndexOffset.min(),n)}es(e,t,n,i){return this.zi.getDocumentsMatchingQuery(e,n,i).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}};/** 2291 * @license 2292 * Copyright 2020 Google LLC 2293 * 2294 * Licensed under the Apache License, Version 2.0 (the "License"); 2295 * you may not use this file except in compliance with the License. 2296 * You may obtain a copy of the License at 2297 * 2298 * http://www.apache.org/licenses/LICENSE-2.0 2299 * 2300 * Unless required by applicable law or agreed to in writing, software 2301 * distributed under the License is distributed on an "AS IS" BASIS, 2302 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2303 * See the License for the specific language governing permissions and 2304 * limitations under the License. 2305 */let __PRIVATE_LocalStoreImpl=class __PRIVATE_LocalStoreImpl{constructor(e,t,n,i){this.persistence=e,this.ts=t,this.serializer=i,this.ns=new SortedMap(__PRIVATE_primitiveComparator),this.rs=new ObjectMap(e=>__PRIVATE_canonifyTarget(e),__PRIVATE_targetEquals),this.ss=new Map,this.os=e.getRemoteDocumentCache(),this.Qr=e.getTargetCache(),this.$r=e.getBundleCache(),this._s(n)}_s(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new LocalDocumentsView(this.os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.os.setIndexManager(this.indexManager),this.ts.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.ns))}};async function __PRIVATE_localStoreHandleUserChange(e,t){return await e.persistence.runTransaction("Handle user change","readonly",n=>{let i;return e.mutationQueue.getAllMutationBatches(n).next(s=>(i=s,e._s(t),e.mutationQueue.getAllMutationBatches(n))).next(t=>{let s=[],o=[],l=__PRIVATE_documentKeySet();for(let e of i)for(let t of(s.push(e.batchId),e.mutations))l=l.add(t.key);for(let e of t)for(let t of(o.push(e.batchId),e.mutations))l=l.add(t.key);return e.localDocuments.getDocuments(n,l).next(e=>({us:e,removedBatchIds:s,addedBatchIds:o}))})})}function __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e){return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Qr.getLastRemoteSnapshotVersion(t))}async function __PRIVATE_localStoreReleaseTarget(e,t,n){let i=e.ns.get(t);try{n||await e.persistence.runTransaction("Release target",n?"readwrite":"readwrite-primary",t=>e.persistence.referenceDelegate.removeTarget(t,i))}catch(e){if(!__PRIVATE_isIndexedDbTransactionError(e))throw e;__PRIVATE_logDebug("LocalStore",`Failed to update sequence numbers for target ${t}: ${e}`)}e.ns=e.ns.remove(t),e.rs.delete(i.target)}function __PRIVATE_localStoreExecuteQuery(e,t,n){let i=SnapshotVersion.min(),s=__PRIVATE_documentKeySet();
2305return e.persistence.runTransaction("Execute query","readwrite",o=>(function(e,t,n){let i=e.rs.get(n);return void 0!==i?PersistencePromise.resolve(e.ns.get(i)):e.Qr.getTargetData(t,n)})(e,o,__PRIVATE_queryToTarget(t)).next(t=>{if(t)return i=t.lastLimboFreeSnapshotVersion,e.Qr.getMatchingKeysForTargetId(o,t.targetId).next(e=>{s=e})}).next(()=>e.ts.getDocumentsMatchingQuery(o,t,n?i:SnapshotVersion.min(),n?s:__PRIVATE_documentKeySet())).next(n=>{var i;let o;return i=t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2)),o=e.ss.get(i)||SnapshotVersion.min(),n.forEach((e,t)=>{t.readTime.compareTo(o)>0&&(o=t.readTime)}),e.ss.set(i,o),{documents:n,hs:s}}))}let __PRIVATE_LocalClientState=class __PRIVATE_LocalClientState{constructor(){this.activeTargetIds=tc}As(e){this.activeTargetIds=this.activeTargetIds.add(e)}Rs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ds(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}};let __PRIVATE_MemorySharedClientState=class __PRIVATE_MemorySharedClientState{constructor(){this.no=new __PRIVATE_LocalClientState,this.ro={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){return this.no.As(e),this.ro[e]||"not-current"}updateQueryState(e,t,n){this.ro[e]=t}removeLocalQueryTarget(e){this.no.Rs(e)}isLocalQueryTarget(e){return this.no.activeTargetIds.has(e)}clearQueryState(e){delete this.ro[e]}getAllActiveQueryTargets(){return this.no.activeTargetIds}isActiveQueryTarget(e){return this.no.activeTargetIds.has(e)}start(){return this.no=new __PRIVATE_LocalClientState,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};/** 2306 * @license 2307 * Copyright 2019 Google LLC 2308 * 2309 * Licensed under the Apache License, Version 2.0 (the "License"); 2310 * you may not use this file except in compliance with the License. 2311 * You may obtain a copy of the License at 2312 * 2313 * http://www.apache.org/licenses/LICENSE-2.0 2314 * 2315 * Unless required by applicable law or agreed to in writing, software 2316 * distributed under the License is distributed on an "AS IS" BASIS, 2317 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2318 * See the License for the specific language governing permissions and 2319 * limitations under the License. 2320 */let __PRIVATE_NoopConnectivityMonitor=class __PRIVATE_NoopConnectivityMonitor{io(e){}shutdown(){}};/** 2321 * @license 2322 * Copyright 2019 Google LLC 2323 * 2324 * Licensed under the Apache License, Version 2.0 (the "License"); 2325 * you may not use this file except in compliance with the License. 2326 * You may obtain a copy of the License at 2327 * 2328 * http://www.apache.org/licenses/LICENSE-2.0 2329 * 2330 * Unless required by applicable law or agreed to in writing, software 2331 * distributed under the License is distributed on an "AS IS" BASIS, 2332 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2333 * See the License for the specific language governing permissions and 2334 * limitations under the License. 2335 */let __PRIVATE_BrowserConnectivityMonitor=class __PRIVATE_BrowserConnectivityMonitor{constructor(){this.so=()=>this.oo(),this._o=()=>this.ao(),this.uo=[],this.co()}io(e){this.uo.push(e)}shutdown(){window.removeEventListener("online",this.so),window.removeEventListener("offline",this._o)}co(){window.addEventListener("online",this.so),window.addEventListener("offline",this._o)}oo(){for(let e of(__PRIVATE_logDebug("ConnectivityMonitor","Network connectivity changed: AVAILABLE"),this.uo))e(0)}ao(){for(let e of(__PRIVATE_logDebug("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE"),this.uo))e(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}};/** 2336 * @license 2337 * Copyright 2023 Google LLC 2338 * 2339 * Licensed under the Apache License, Version 2.0 (the "License"); 2340 * you may not use this file except in compliance with the License. 2341 * You may obtain a copy of the License at 2342 * 2343 * http://www.apache.org/licenses/LICENSE-2.0 2344 * 2345 * Unless required by applicable law or agreed to in writing, softw
2345are 2346 * distributed under the License is distributed on an "AS IS" BASIS, 2347 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2348 * See the License for the specific language governing permissions and 2349 * limitations under the License. 2350 */let tp=null;function __PRIVATE_generateUniqueDebugId(){return null===tp?tp=268435456+Math.round(2147483648*Math.random()):tp++,"0x"+tp.toString(16)}/** 2351 * @license 2352 * Copyright 2020 Google LLC 2353 * 2354 * Licensed under the Apache License, Version 2.0 (the "License"); 2355 * you may not use this file except in compliance with the License. 2356 * You may obtain a copy of the License at 2357 * 2358 * http://www.apache.org/licenses/LICENSE-2.0 2359 * 2360 * Unless required by applicable law or agreed to in writing, software 2361 * distributed under the License is distributed on an "AS IS" BASIS, 2362 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2363 * See the License for the specific language governing permissions and 2364 * limitations under the License. 2365 */let tm={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/** 2366 * @license 2367 * Copyright 2017 Google LLC 2368 * 2369 * Licensed under the Apache License, Version 2.0 (the "License"); 2370 * you may not use this file except in compliance with the License. 2371 * You may obtain a copy of the License at 2372 * 2373 * http://www.apache.org/licenses/LICENSE-2.0 2374 * 2375 * Unless required by applicable law or agreed to in writing, software 2376 * distributed under the License is distributed on an "AS IS" BASIS, 2377 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2378 * See the License for the specific language governing permissions and 2379 * limitations under the License. 2380 */let __PRIVATE_StreamBridge=class __PRIVATE_StreamBridge{constructor(e){this.lo=e.lo,this.ho=e.ho}Po(e){this.Io=e}To(e){this.Eo=e}onMessage(e){this.Ao=e}close(){this.ho()}send(e){this.lo(e)}Ro(){this.Io()}Vo(e){this.Eo(e)}mo(e){this.Ao(e)}};/** 2381 * @license 2382 * Copyright 2017 Google LLC 2383 * 2384 * Licensed under the Apache License, Version 2.0 (the "License"); 2385 * you may not use this file except in compliance with the License. 2386 * You may obtain a copy of the License at 2387 * 2388 * http://www.apache.org/licenses/LICENSE-2.0 2389 * 2390 * Unless required by applicable law or agreed to in writing, software 2391 * distributed under the License is distributed on an "AS IS" BASIS, 2392 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2393 * See the License for the specific language governing permissions and 2394 * limitations under the License. 2395 */let tg="WebChannelConnection";let __PRIVATE_WebChannelConnection=class __PRIVATE_WebChannelConnection extends class{constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.fo=t+"://"+e.host,this.po=`projects/${n}/databases/${i}`,this.yo="(default)"===this.databaseId.database?`project_id=${n}`:`project_id=${n}&database_id=${i}`}get wo(){return!1}So(e,t,n,i,s){let o=__PRIVATE_generateUniqueDebugId(),l=this.bo(e,t);__PRIVATE_logDebug("RestConnection",`Sending RPC '${e}' ${o}:`,l,n);let u={"google-cloud-resource-prefix":this.po,"x-goog-request-params":this.yo};return this.Do(u,i,s),this.Co(e,l,u,n).then(t=>(__PRIVATE_logDebug("RestConnection",`Received RPC '${e}' ${o}: `,t),t),t=>{throw __PRIVATE_logWarn("RestConnection",`RPC '${e}' ${o} failed with error: `,t,"url: ",l,"request:",n),t})}vo(e,t,n,i,s,o){return this.So(e,t,n,i,s)}Do(e,t,n){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+te}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((t,n)=>e[n]=t),n&&n.headers.forEach((t,n)=>e[n]=t)}bo(e,t){let n=tm[e];return`${this.fo}/v1/${t}:${n}`}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Co(e,t,n,i){let s=__PRIVATE_generateUniqueDebugId();return new Promise((o,l)=>{let u=new e6;u.setWithCredentials(!0),u.listenOnce(e2.COMPLETE,()=>{try{switch(u.getLastErrorCode()){case e1.NO_ERROR:let t=u.getResponseJson();__PRIVATE_logDebug(tg,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(t)),o(t);break;case e1.TIMEOUT:__PRIVATE_logDebug(tg,`RPC '${e}' ${s} timed out`),l(new FirestoreError(tr.DEADLINE_EXCEEDED,"Request time out"));break;case e1.HTTP_ERROR:let n=u.getStatus();if(__PRIVATE_logDebug(tg,`RPC '${e}' ${s} failed with status:`,n,"response text:",u.getResponseText()),n>0){let e=u.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=null==e?void 0:e.error;if(t&&t.status&&t.message){let e=function(e){let t=e.toLowerCase().replace(/_/g,"-");return Object.values(tr).indexOf(t)>=0?t:tr.UNKNOWN}(t.status);l(new FirestoreError(e,t.message))}else l(new FirestoreError(tr.UNKNOWN,"Server responded with status "+u.getStatus()))}else l(new FirestoreError(tr.UNAVAILABLE,"Connection failed."));break;default:fail()}}finally{__PRIVATE_logDebug(tg,`RPC '${e}' ${s} completed.`)}});let h=JSON.stringify(i);__PRIVATE_logDebug(tg,`RPC '${e}' ${s} sending request:`,i),u.send(t,"POST",h,n,15)})}Fo(e,t,n){let i=__PRIVATE_generateUniqueDebugId(),s=[this.fo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=eY(),l=e0(),h={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`}
2395,sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},d=this.longPollingOptions.timeoutSeconds;void 0!==d&&(h.longPollingTimeout=Math.round(1e3*d)),this.useFetchStreams&&(h.useFetchStreams=!0),this.Do(h.initMessageHeaders,t,n),h.encodeInitMessageHeaders=!0;let _=s.join("");__PRIVATE_logDebug(tg,`Creating RPC '${e}' stream ${i}: ${_}`,h);let m=o.createWebChannel(_,h),g=!1,E=!1,b=new __PRIVATE_StreamBridge({lo:t=>{E?__PRIVATE_logDebug(tg,`Not sending because RPC '${e}' stream ${i} is closed:`,t):(g||(__PRIVATE_logDebug(tg,`Opening RPC '${e}' stream ${i} transport.`),m.open(),g=!0),__PRIVATE_logDebug(tg,`RPC '${e}' stream ${i} sending:`,t),m.send(t))},ho:()=>m.close()}),__PRIVATE_unguardedEventListen=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};return __PRIVATE_unguardedEventListen(m,e5.EventType.OPEN,()=>{E||__PRIVATE_logDebug(tg,`RPC '${e}' stream ${i} transport opened.`)}),__PRIVATE_unguardedEventListen(m,e5.EventType.CLOSE,()=>{E||(E=!0,__PRIVATE_logDebug(tg,`RPC '${e}' stream ${i} transport closed`),b.Vo())}),__PRIVATE_unguardedEventListen(m,e5.EventType.ERROR,t=>{E||(E=!0,__PRIVATE_logWarn(tg,`RPC '${e}' stream ${i} transport errored:`,t),b.Vo(new FirestoreError(tr.UNAVAILABLE,"The operation could not be completed")))}),__PRIVATE_unguardedEventListen(m,e5.EventType.MESSAGE,t=>{var n;if(!E){let s=t.data[0];s||fail();let o=s.error||(null===(n=s[0])||void 0===n?void 0:n.error);if(o){__PRIVATE_logDebug(tg,`RPC '${e}' stream ${i} received error:`,o);let t=o.status,n=function(e){let t=u[e];if(void 0!==t)return __PRIVATE_mapCodeFromRpcCode(t)}(t),s=o.message;void 0===n&&(n=tr.INTERNAL,s="Unknown error status: "+t+" with message "+o.message),E=!0,b.Vo(new FirestoreError(n,s)),m.close()}else __PRIVATE_logDebug(tg,`RPC '${e}' stream ${i} received:`,s),b.mo(s)}}),__PRIVATE_unguardedEventListen(l,e4.STAT_EVENT,t=>{t.stat===e9.PROXY?__PRIVATE_logDebug(tg,`RPC '${e}' stream ${i} detected buffering proxy`):t.stat===e9.NOPROXY&&__PRIVATE_logDebug(tg,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{b.Ro()},0),b}};function getDocument(){return"undefined"!=typeof document?document:null}/** 2396 * @license 2397 * Copyright 2020 Google LLC 2398 * 2399 * Licensed under the Apache License, Version 2.0 (the "License"); 2400 * you may not use this file except in compliance with the License. 2401 * You may obtain a copy of the License at 2402 * 2403 * http://www.apache.org/licenses/LICENSE-2.0 2404 * 2405 * Unless required by applicable law or agreed to in writing, software 2406 * distributed under the License is distributed on an "AS IS" BASIS, 2407 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2408 * See the License for the specific language governing permissions and 2409 * limitations under the License. 2410 */function __PRIVATE_newSerializer(e){return new JsonProtoSerializer(e,!0)}/** 2411 * @license 2412 * Copyright 2017 Google LLC 2413 * 2414 * Licensed under the Apache License, Version 2.0 (the "License"); 2415 * you may not use this file except in compliance with the License. 2416 * You may obtain a copy of the License at 2417 * 2418 * http://www.apache.org/licenses/LICENSE-2.0 2419 * 2420 * Unless required by applicable law or agreed to in writing, software 2421 * distributed under the License is distributed on an "AS IS" BASIS, 2422 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2423 * See the License for the specific language governing permissions and 2424 * limitations under the License. 2425 */let __PRIVATE_ExponentialBackoff=class __PRIVATE_ExponentialBackoff{constructor(e,t,n=1e3,i=1.5,s=6e4){this.oi=e,this.timerId=t,this.Mo=n,this.xo=i,this.Oo=s,this.No=0,this.Bo=null,this.Lo=Date.now(),this.reset()}reset(){this.No=0}ko(){this.No=this.Oo}qo(e){this.cancel();let t=Math.floor(this.No+this.Qo()),n=Math.max(0,Date.now()-this.Lo),i=Math.max(0,t-n);i>0&&__PRIVATE_logDebug("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.No} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Bo=this.oi.enqueueAfterDelay(this.timerId,i,()=>(this.Lo=Date.now(),e())),this.No*=this.xo,this.No<this.Mo&&(this.No=this.Mo),this.No>this.Oo&&(this.No=this.Oo)}Ko(){null!==this.Bo&&(this.Bo.skipDelay(),this.Bo=null)}cancel(){null!==this.Bo&&(this.Bo.cancel(),this.Bo=null)}Qo(){return(Math.random()-.5)*this.No}};/** 2426 * @license 2427 * Copyright 2017 Google LLC 2428 * 2429 * Licensed under the Apache License, Version 2.0 (the "License");
2430 * you may not use this file except in compliance with the License. 2431 * You may obtain a copy of the License at 2432 * 2433 * http://www.apache.org/licenses/LICENSE-2.0 2434 * 2435 * Unless required by applicable law or agreed to in writing, software 2436 * distributed under the License is distributed on an "AS IS" BASIS, 2437 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2438 * See the License for the specific language governing permissions and 2439 * limitations under the License. 2440 */let __PRIVATE_PersistentStream=class __PRIVATE_PersistentStream{constructor(e,t,n,i,s,o,l,u){this.oi=e,this.$o=n,this.Uo=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=l,this.listener=u,this.state=0,this.Wo=0,this.Go=null,this.zo=null,this.stream=null,this.jo=new __PRIVATE_ExponentialBackoff(e,t)}Ho(){return 1===this.state||5===this.state||this.Jo()}Jo(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Yo()}async stop(){this.Ho()&&await this.close(0)}Zo(){this.state=0,this.jo.reset()}Xo(){this.Jo()&&null===this.Go&&(this.Go=this.oi.enqueueAfterDelay(this.$o,6e4,()=>this.e_()))}t_(e){this.n_(),this.stream.send(e)}async e_(){if(this.Jo())return this.close(0)}
2440n_(){this.Go&&(this.Go.cancel(),this.Go=null)}r_(){this.zo&&(this.zo.cancel(),this.zo=null)}async close(e,t){this.n_(),this.r_(),this.jo.cancel(),this.Wo++,4!==e?this.jo.reset():t&&t.code===tr.RESOURCE_EXHAUSTED?(__PRIVATE_logError(t.toString()),__PRIVATE_logError("Using maximum backoff delay to prevent overloading the backend."),this.jo.ko()):t&&t.code===tr.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.i_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.To(t)}i_(){}auth(){this.state=1;let e=this.s_(this.Wo),t=this.Wo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.Wo===t&&this.o_(e,n)},t=>{e(()=>{let e=new FirestoreError(tr.UNKNOWN,"Fetching auth token failed: "+t.message);return this.__(e)})})}o_(e,t){let n=this.s_(this.Wo);this.stream=this.a_(e,t),this.stream.Po(()=>{n(()=>(this.state=2,this.zo=this.oi.enqueueAfterDelay(this.Uo,1e4,()=>(this.Jo()&&(this.state=3),Promise.resolve())),this.listener.Po()))}),this.stream.To(e=>{n(()=>this.__(e))}),this.stream.onMessage(e=>{n(()=>this.onMessage(e))})}Yo(){this.state=5,this.jo.qo(async()=>{this.state=0,this.start()})}__(e){return __PRIVATE_logDebug("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}s_(e){return t=>{this.oi.enqueueAndForget(()=>this.Wo===e?t():(__PRIVATE_logDebug("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}};let __PRIVATE_PersistentListenStream=class __PRIVATE_PersistentListenStream extends __PRIVATE_PersistentStream{constructor(e,t,n,i,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,i,o),this.serializer=s}a_(e,t){return this.connection.Fo("Listen",e,t)}onMessage(e){this.jo.reset();let t=function(e,t){let n;if("targetChange"in t){var i,s;t.targetChange;let o="NO_CHANGE"===(i=t.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===i?1:"REMOVE"===i?2:"CURRENT"===i?3:"RESET"===i?4:fail(),l=t.targetChange.targetIds||[],u=(s=t.targetChange.resumeToken,e.useProto3Json?(void 0===s||"string"==typeof s||fail(),ByteString.fromBase64String(s||"")):(void 0===s||s instanceof Uint8Array||fail(),ByteString.fromUint8Array(s||new Uint8Array))),h=t.targetChange.cause,d=h&&function(e){let t=void 0===e.code?tr.UNKNOWN:__PRIVATE_mapCodeFromRpcCode(e.code);return new FirestoreError(t,e.message||"")}(h);n=new __PRIVATE_WatchTargetChange(o,l,u,d||null)}else if("documentChange"in t){t.documentChange;let i=t.documentChange;i.document,i.document.name,i.document.updateTime;let s=fromName(e,i.document.name),o=__PRIVATE_fromVersion(i.document.updateTime),l=i.document.createTime?__PRIVATE_fromVersion(i.document.createTime):SnapshotVersion.min(),u=new ObjectValue({mapValue:{fields:i.document.fields}}),h=MutableDocument.newFoundDocument(s,o,l,u),d=i.targetIds||[],_=i.removedTargetIds||[];n=new __PRIVATE_DocumentWatchChange(d,_,h.key,h)}else if("documentDelete"in t){t.documentDelete;let i=t.documentDelete;i.document;let s=fromName(e,i.document),o=i.readTime?__PRIVATE_fromVersion(i.readTime):SnapshotVersion.min(),l=MutableDocument.newNoDocument(s,o),u=i.removedTargetIds||[];n=new __PRIVATE_DocumentWatchChange([],u,l.key,l)}else if("documentRemove"in t){t.documentRemove;let i=t.documentRemove;i.document;let s=fromName(e,i.document),o=i.removedTargetIds||[];n=new __PRIVATE_DocumentWatchChange([],o,s,null)}else{if(!("filter"in t))return fail();{t.filter;let e=t.filter;e.targetId;let{count:i=0,unchangedNames:s}=e,o=new ExistenceFilter(i,s),l=e.targetId;n=new __PRIVATE_ExistenceFilterChange(l,o)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return SnapshotVersion.min();let t=e.targetChange;return t.targetIds&&t.targetIds.length?SnapshotVersion.min():t.readTime?__PRIVATE_fromVersion(t.readTime):SnapshotVersion.min()}(e);return this.listener.u_(t,n)}c_(e){let t={};t.database=__PRIVATE_getEncodedDatabaseId(this.serializer),t.addTarget=function(e,t){let n;let i=t.target;if((n=__PRIVATE_targetIsDocumentTarget(i)?{documents:{documents:[__PRIVATE_toQueryPath(e,i.path)]}}:{query:function(e,t){var n,i;let s={structuredQuery:{}},o=t.path;null!==t.collectionGroup?(s.parent=__PRIVATE_toQueryPath(e,o),s.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(s.parent=__PRIVATE_toQueryPath(e,o.popLast()),s.structuredQuery.from=[{collectionId:o.lastSegment()}]);let l=function(e){if(0!==e.length)return function __PRIVATE_toFilter(e){return e instanceof FieldFilter?function(e){if("=="===e.op){if(__PRIVATE_isNanValue(e.value))return{unaryFilter:{field:__PRIVATE_toFieldPathReference(e.field),op:"IS_NAN"}};if(__PRIVATE_isNullValue(e.value))return{unaryFilter:{field:__PRIVATE_toFieldPathReference(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(__PRIVATE_isNanValue(e.value))return{unaryFilter:{field:__PRIVATE_toFieldPathReference(e.field),op:"IS_NOT_NA
2440N"}};if(__PRIVATE_isNullValue(e.value))return{unaryFilter:{field:__PRIVATE_toFieldPathReference(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:__PRIVATE_toFieldPathReference(e.field),op:t_[e.op],value:e.value}}}(e):e instanceof CompositeFilter?function(e){let t=e.getFilters().map(e=>__PRIVATE_toFilter(e));return 1===t.length?t[0]:{compositeFilter:{op:tf[e.op],filters:t}}}(e):fail()}(CompositeFilter.create(e,"and"))}(t.filters);l&&(s.structuredQuery.where=l);let u=function(e){if(0!==e.length)return e.map(e=>({field:__PRIVATE_toFieldPathReference(e.field),direction:td[e.dir]}))}(t.orderBy);u&&(s.structuredQuery.orderBy=u);let h=__PRIVATE_toInt32Proto(e,t.limit);return null!==h&&(s.structuredQuery.limit=h),t.startAt&&(s.structuredQuery.startAt={before:(n=t.startAt).inclusive,values:n.position}),t.endAt&&(s.structuredQuery.endAt={before:!(i=t.endAt).inclusive,values:i.position}),s}(e,i)}).targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=__PRIVATE_toBytes(e,t.resumeToken);let i=__PRIVATE_toInt32Proto(e,t.expectedCount);null!==i&&(n.expectedCount=i)}else if(t.snapshotVersion.compareTo(SnapshotVersion.min())>0){n.readTime=toTimestamp(e,t.snapshotVersion.toTimestamp());let i=__PRIVATE_toInt32Proto(e,t.expectedCount);null!==i&&(n.expectedCount=i)}return n}(this.serializer,e);let n=function(e,t){let n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return fail()}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.t_(t)}l_(e){let t={};t.database=__PRIVATE_getEncodedDatabaseId(this.serializer),t.removeTarget=e,this.t_(t)}};let __PRIVATE_PersistentWriteStream=class __PRIVATE_PersistentWriteStream extends __PRIVATE_PersistentStream{constructor(e,t,n,i,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,i,o),this.serializer=s,this.h_=!1}get P_(){return this.h_}start(){this.h_=!1,this.lastStreamToken=void 0,super.start()}i_(){this.h_&&this.I_([])}a_(e,t){return this.connection.Fo("Write",e,t)}onMessage(e){var t,n;if(e.streamToken||fail(),this.lastStreamToken=e.streamToken,this.h_){this.jo.reset();let i=(t=e.writeResults,n=e.commitTime,t&&t.length>0?(void 0!==n||fail(),t.map(e=>{let t;return(t=e.updateTime?__PRIVATE_fromVersion(e.updateTime):__PRIVATE_fromVersion(n)).isEqual(SnapshotVersion.min())&&(t=__PRIVATE_fromVersion(n)),new MutationResult(t,e.transformResults||[])})):[]),s=__PRIVATE_fromVersion(e.commitTime);return this.listener.T_(s,i)}return e.writeResults&&0!==e.writeResults.length&&fail(),this.h_=!0,this.listener.E_()}d_(){let e={};e.database=__PRIVATE_getEncodedDatabaseId(this.serializer),this.t_(e)}I_(e){let t={streamToken:this.lastStreamToken,writes:e.map(e=>(function(e,t){var n;let i;if(t instanceof __PRIVATE_SetMutation)i={update:__PRIVATE_toMutationDocument(e,t.key,t.value)};else if(t instanceof __PRIVATE_DeleteMutation)i={delete:__PRIVATE_toName(e,t.key)};else if(t instanceof __PRIVATE_PatchMutation)i={update:__PRIVATE_toMutationDocument(e,t.key,t.data),updateMask:function(e){let t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}(t.fieldMask)};else{if(!(t instanceof __PRIVATE_VerifyMutation))return fail();i={verify:__PRIVATE_toName(e,t.key)}}return t.fieldTransforms.length>0&&(i.updateTransforms=t.fieldTransforms.map(e=>(function(e,t){let n=t.transform;if(n instanceof __PRIVATE_ServerTimestampTransform)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof __PRIVATE_ArrayUnionTransformOperation)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof __PRIVATE_ArrayRemoveTransformOperation)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof __PRIVATE_NumericIncrementTransformOperation)return{fieldPath:t.field.canonicalString(),increment:n.Te};throw fail()})(0,e))),t.precondition.isNone||(i.currentDocument=void 0!==(n=t.precondition).updateTime?{updateTime:toTimestamp(e,n.updateTime.toTimestamp())}:void 0!==n.exists?{exists:n.exists}
2440:fail()),i})(this.serializer,e))};this.t_(t)}};/** 2441 * @license 2442 * Copyright 2017 Google LLC 2443 * 2444 * Licensed under the Apache License, Version 2.0 (the "License"); 2445 * you may not use this file except in compliance with the License. 2446 * You may obtain a copy of the License at 2447 * 2448 * http://www.apache.org/licenses/LICENSE-2.0 2449 * 2450 * Unless required by applicable law or agreed to in writing, software 2451 * distributed under the License is distributed on an "AS IS" BASIS, 2452 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2453 * See the License for the specific language governing permissions and 2454 * limitations under the License. 2455 */let __PRIVATE_DatastoreImpl=class __PRIVATE_DatastoreImpl extends class{}{constructor(e,t,n,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=i,this.A_=!1}R_(){if(this.A_)throw new FirestoreError(tr.FAILED_PRECONDITION,"The client has already been terminated.")}So(e,t,n){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,s])=>this.connection.So(e,t,n,i,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===tr.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new FirestoreError(tr.UNKNOWN,e.toString())})}vo(e,t,n,i){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.vo(e,t,n,s,o,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===tr.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new FirestoreError(tr.UNKNOWN,e.toString())})}terminate(){this.A_=!0}};let __PRIVATE_OnlineStateTracker=class __PRIVATE_OnlineStateTracker{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.m_=0,this.f_=null,this.g_=!0}p_(){0===this.m_&&(this.y_("Unknown"),this.f_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.f_=null,this.w_("Backend didn't respond within 10 seconds."),this.y_("Offline"),Promise.resolve())))}S_(e){"Online"===this.state?this.y_("Unknown"):(this.m_++,this.m_>=1&&(this.b_(),this.w_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.y_("Offline")))}set(e){this.b_(),this.m_=0,"Online"===e&&(this.g_=!1),this.y_(e)}y_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}w_(e){let t=`Could not reach Cloud Firestore backend. ${e} 2456This 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.g_?(__PRIVATE_logError(t),this.g_=!1):__PRIVATE_logDebug("OnlineStateTracker",t)}
2456b_(){null!==this.f_&&(this.f_.cancel(),this.f_=null)}};/** 2457 * @license 2458 * Copyright 2017 Google LLC 2459 * 2460 * Licensed under the Apache License, Version 2.0 (the "License"); 2461 * you may not use this file except in compliance with the License. 2462 * You may obtain a copy of the License at 2463 * 2464 * http://www.apache.org/licenses/LICENSE-2.0 2465 * 2466 * Unless required by applicable law or agreed to in writing, software 2467 * distributed under the License is distributed on an "AS IS" BASIS, 2468 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2469 * See the License for the specific language governing permissions and 2470 * limitations under the License. 2471 */let __PRIVATE_RemoteStoreImpl=class __PRIVATE_RemoteStoreImpl{constructor(e,t,n,i,s){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.D_=[],this.C_=new Map,this.v_=new Set,this.F_=[],this.M_=s,this.M_.io(e=>{n.enqueueAndForget(async()=>{__PRIVATE_canUseNetwork(this)&&(__PRIVATE_logDebug("RemoteStore","Restarting streams for network reachability change."),await async function(e){e.v_.add(4),await __PRIVATE_disableNetworkInternal(e),e.x_.set("Unknown"),e.v_.delete(4),await __PRIVATE_enableNetworkInternal(e)}(this))})}),this.x_=new __PRIVATE_OnlineStateTracker(n,i)}};async function __PRIVATE_enableNetworkInternal(e){if(__PRIVATE_canUseNetwork(e))for(let t of e.F_)await t(!0)}async function __PRIVATE_disableNetworkInternal(e){for(let t of e.F_)await t(!1)}function __PRIVATE_remoteStoreListen(e,t){e.C_.has(t.targetId)||(e.C_.set(t.targetId,t),__PRIVATE_shouldStartWatchStream(e)?__PRIVATE_startWatchStream(e):__PRIVATE_ensureWatchStream(e).Jo()&&__PRIVATE_sendWatchRequest(e,t))}function __PRIVATE_remoteStoreUnlisten(e,t){let n=__PRIVATE_ensureWatchStream(e);e.C_.delete(t),n.Jo()&&__PRIVATE_sendUnwatchRequest(e,t),0===e.C_.size&&(n.Jo()?n.Xo():__PRIVATE_canUseNetwork(e)&&e.x_.set("Unknown"))}function __PRIVATE_sendWatchRequest(e,t){if(e.O_.Ne(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(SnapshotVersion.min())>0){let n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}__PRIVATE_ensureWatchStream(e).c_(t)}function __PRIVATE_sendUnwatchRequest(e,t){e.O_.Ne(t),__PRIVATE_ensureWatchStream(e).l_(t)}function __PRIVATE_startWatchStream(e){e.O_=new __PRIVATE_WatchChangeAggregator({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),ut:t=>e.C_.get(t)||null,rt:()=>e.datastore.serializer.databaseId}),__PRIVATE_ensureWatchStream(e).start(),e.x_.p_()}function __PRIVATE_shouldStartWatchStream(e){return __PRIVATE_canUseNetwork(e)&&!__PRIVATE_ensureWatchStream(e).Ho()&&e.C_.size>0}function __PRIVATE_canUseNetwork(e){return 0===e.v_.size}async function __PRIVATE_onWatchStreamOpen(e){e.C_.forEach((t,n)=>{__PRIVATE_sendWatchRequest(e,t)})}async function __PRIVATE_onWatchStreamClose(e,t){e.O_=void 0,__PRIVATE_shouldStartWatchStream(e)?(e.x_.S_(t),__PRIVATE_startWatchStream(e)):e.x_.set("Unknown")}async function __PRIVATE_onWatchStreamChange(e,t,n){if(e.x_.set("Online"),t instanceof __PRIVATE_WatchTargetChange&&2===t.state&&t.cause)try{await async function(e,t){let n=t.cause;for(let i of t.targetIds)e.C_.has(i)&&(await e.remoteSyncer.rejectListen(i,n),e.C_.delete(i),e.O_.removeTarget(i))}(e,t)}catch(n){__PRIVATE_logDebug("RemoteStore","Failed to remove targets %s: %s ",t.targetIds.join(","),n),await __PRIVATE_disableNetworkUntilRecovery(e,n)}else if(t instanceof __PRIVATE_DocumentWatchChange?e.O_.Ue(t):t instanceof __PRIVATE_ExistenceFilterChange?e.O_.Ye(t):e.O_.ze(t),!n.isEqual(SnapshotVersion.min()))try{let t=await __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e.localStore);n.compareTo(t)>=0&&await function(e,t){let n=e.O_.st(t);
2471return n.targetChanges.forEach((n,i)=>{if(n.resumeToken.approximateByteSize()>0){let s=e.C_.get(i);s&&e.C_.set(i,s.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach((t,n)=>{let i=e.C_.get(t);if(!i)return;e.C_.set(t,i.withResumeToken(ByteString.EMPTY_BYTE_STRING,i.snapshotVersion)),__PRIVATE_sendUnwatchRequest(e,t);let s=new TargetData(i.target,t,n,i.sequenceNumber);__PRIVATE_sendWatchRequest(e,s)}),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){__PRIVATE_logDebug("RemoteStore","Failed to raise snapshot:",t),await __PRIVATE_disableNetworkUntilRecovery(e,t)}}async function __PRIVATE_disableNetworkUntilRecovery(e,t,n){if(!__PRIVATE_isIndexedDbTransactionError(t))throw t;e.v_.add(1),await __PRIVATE_disableNetworkInternal(e),e.x_.set("Offline"),n||(n=()=>__PRIVATE_localStoreGetLastRemoteSnapshotVersion(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{__PRIVATE_logDebug("RemoteStore","Retrying IndexedDB access"),await n(),e.v_.delete(1),await __PRIVATE_enableNetworkInternal(e)})}function __PRIVATE_executeWithRecovery(e,t){return t().catch(n=>__PRIVATE_disableNetworkUntilRecovery(e,n,t))}async function __PRIVATE_fillWritePipeline(e){let t=__PRIVATE_ensureWriteStream(e),n=e.D_.length>0?e.D_[e.D_.length-1].batchId:-1;for(;__PRIVATE_canUseNetwork(e)&&e.D_.length<10;)try{let i=await function(e,t){return e.persistence.runTransaction("Get next mutation batch","readonly",n=>(void 0===t&&(t=-1),e.mutationQueue.getNextMutationBatchAfterBatchId(n,t)))}(e.localStore,n);if(null===i){0===e.D_.length&&t.Xo();break}n=i.batchId,function(e,t){e.D_.push(t);let n=__PRIVATE_ensureWriteStream(e);n.Jo()&&n.P_&&n.I_(t.mutations)}(e,i)}catch(t){await __PRIVATE_disableNetworkUntilRecovery(e,t)}__PRIVATE_shouldStartWriteStream(e)&&__PRIVATE_startWriteStream(e)}function __PRIVATE_shouldStartWriteStream(e){return __PRIVATE_canUseNetwork(e)&&!__PRIVATE_ensureWriteStream(e).Ho()&&e.D_.length>0}function __PRIVATE_startWriteStream(e){__PRIVATE_ensureWriteStream(e).start()}async function __PRIVATE_onWriteStreamOpen(e){__PRIVATE_ensureWriteStream(e).d_()}async function __PRIVATE_onWriteHandshakeComplete(e){let t=__PRIVATE_ensureWriteStream(e);for(let n of e.D_)t.I_(n.mutations)}async function __PRIVATE_onMutationResult(e,t,n){let i=e.D_.shift(),s=MutationBatchResult.from(i,t,n);await __PRIVATE_executeWithRecovery(e,()=>e.remoteSyncer.applySuccessfulWrite(s)),await __PRIVATE_fillWritePipeline(e)}async function __PRIVATE_onWriteStreamClose(e,t){t&&__PRIVATE_ensureWriteStream(e).P_&&await async function(e,t){var n;if(function(e){switch(e){default:return fail();case tr.CANCELLED:case tr.UNKNOWN:case tr.DEADLINE_EXCEEDED:case tr.RESOURCE_EXHAUSTED:case tr.INTERNAL:case tr.UNAVAILABLE:case tr.UNAUTHENTICATED:return!1;case tr.INVALID_ARGUMENT:case tr.NOT_FOUND:case tr.ALREADY_EXISTS:case tr.PERMISSION_DENIED:case tr.FAILED_PRECONDITION:case tr.ABORTED:case tr.OUT_OF_RANGE:case tr.UNIMPLEMENTED:case tr.DATA_LOSS:return!0}}(n=t.code)&&n!==tr.ABORTED){let n=e.D_.shift();__PRIVATE_ensureWriteStream(e).Zo(),await __PRIVATE_executeWithRecovery(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await __PRIVATE_fillWritePipeline(e)}}(e,t),__PRIVATE_shouldStartWriteStream(e)&&__PRIVATE_startWriteStream(e)}async function __PRIVATE_remoteStoreHandleCredentialChange(e,t){e.asyncQueue.verifyOperationInProgress(),__PRIVATE_logDebug("RemoteStore","RemoteStore received new credentials");let n=__PRIVATE_canUseNetwork(e);e.v_.add(3),await __PRIVATE_disableNetworkInternal(e),n&&e.x_.set("Unknown"),await e.remoteSyncer.handleCredentialChange(t),e.v_.delete(3),await __PRIVATE_enableNetworkInternal(e)}async function __PRIVATE_remoteStoreApplyPrimaryState(e,t){t?(e.v_.delete(2),await __PRIVATE_enableNetworkInternal(e)):t||(e.v_.add(2),await __PRIVATE_disableNetworkInternal(e),e.x_.set("Unknown"))}function __PRIVATE_ensureWatchStream(e){var t,n,i;return e.N_||(e.N_=(t=e.datastore,n=e.asyncQueue,i={Po:__PRIVATE_onWatchStreamOpen.bind(null,e),To:__PRIVATE_onWatchStreamClose.bind(null,e),u_:__PRIVATE_onWatchStreamChange.bind(null,e)},t.R_(),new __PRIVATE_PersistentListenStream(n,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,i)),e.F_.push(async t=>{t?(e.N_.Zo(),__PRIVATE_shouldStartWatchStream(e)?__PRIVATE_startWatchStream(e):e.x_.set("Unknown")):(await e.N_.stop(),e.O_=void 0)})),e.N_}function __PRIVATE_ensureWriteStream(e){var t,n,i;return e.B_||(e.B_=(t=e.datastore,n=e.asyncQueue,i={Po:__PRIVATE_onWriteStreamOpen.bind(null,e),To:__PRIVATE_onWriteStreamClose.bind(null,e),E_:__PRIVATE_onWriteHandshakeComplete.bind(null,e),T_:__PRIVATE_onMutationResult.bind(null,e)},t.R_(),new __PRIVATE_PersistentWriteStream(n,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,i)),e.F_.push(async t=>{t?(e.B_.Zo(),await __PRIVATE_fillWritePipeline(e)):(await e.B_.stop(),e.D_.length>0&&(__PRIVATE_logDebug("RemoteStore",`Stopping write stream with ${e.D_.length} pending writes`),e.D_=[]))})),e.B_}/** 2472 * @license 2473 * Copyright 2017 Google LLC 2474 * 2475 * Licensed under the Apache License, Version 2.0 (the "License");
2476 * you may not use this file except in compliance with the License. 2477 * You may obtain a copy of the License at 2478 * 2479 * http://www.apache.org/licenses/LICENSE-2.0 2480 * 2481 * Unless required by applicable law or agreed to in writing, software 2482 * distributed under the License is distributed on an "AS IS" BASIS, 2483 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2484 * See the License for the specific language governing permissions and 2485 * limitations under the License. 2486 */let DelayedOperation=class DelayedOperation{constructor(e,t,n,i,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=s,this.deferred=new __PRIVATE_Deferred,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,i,s){let o=Date.now()+n,l=new DelayedOperation(e,t,o,i,s);return l.start(n),l}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new FirestoreError(tr.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function __PRIVATE_wrapInUserErrorIfRecoverable(e,t){if(__PRIVATE_logError("AsyncQueue",`${t}: ${e}`),__PRIVATE_isIndexedDbTransactionError(e))return new FirestoreError(tr.UNAVAILABLE,`${t}: ${e}`);throw e}/** 2487 * @license 2488 * Copyright 2017 Google LLC 2489 * 2490 * Licensed under the Apache License, Version 2.0 (the "License"); 2491 * you may not use this file except in compliance with the License. 2492 * You may obtain a copy of the License at 2493 * 2494 * http://www.apache.org/licenses/LICENSE-2.0 2495 * 2496 * Unless required by applicable law or agreed to in writing, software 2497 * distributed under the License is distributed on an "AS IS" BASIS, 2498 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2499 * See the License for the specific language governing permissions and 2500 * limitations under the License. 2501 */let DocumentSet=class DocumentSet{constructor(e){this.comparator=e?(t,n)=>e(t,n)||DocumentKey.comparator(t.key,n.key):(e,t)=>DocumentKey.comparator(e.key,t.key),this.keyedMap=documentMap(),this.sortedSet=new SortedMap(this.comparator)}static emptySet(e){return new DocumentSet(e.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,n)=>(e(t),!1))}add(e){let t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){let t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof DocumentSet)||this.size!==e.size)return!1;let t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){let e=t.getNext().key,i=n.getNext().key;if(!e.isEqual(i))return!1}return!0}toString(){let e=[];return this.forEach(t=>{e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){let n=new DocumentSet;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}};/** 2502 * @license 2503 * Copyright 2017 Google LLC 2504 * 2505 * Licensed under the Apache License, Version 2.0 (the "License"); 2506 * you may not use this file except in compliance with the License. 2507 * You may obtain a copy of the License at 2508 * 2509 * http://www.apache.org/licenses/LICENSE-2.0 2510 * 2511 * Unless required by applicable law or agreed to in writing, software 2512 * distributed under the License is distributed on an "AS IS" BASIS, 2513 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2514 * See the License for the specific language governing permissions and 2515 * limitations under the License. 2516 */let __PRIVATE_DocumentChangeSet=class __PRIVATE_DocumentChangeSet{constructor(){this.L_=new SortedMap(DocumentKey.comparator)}track(e){let t=e.doc.key,n=this.L_.get(t);n?0!==e.type&&3===n.type?this.L_=this.L_.insert(t,e):3===e.type&&1!==n.type?this.L_=this.L_.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.L_=this.L_.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.L_=this.L_.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.L_=this.L_.remove(t):1===e.type&&2===n.type?this.L_=this.L_.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.L_=this.L_.insert(t,{type:2,doc:e.doc}):fail():this.L_=this.L_.insert(t,e)}k_(){let e=[];return this.L_.inorderTraversal((t,n)=>{e.push(n)}),e}};
2516let ViewSnapshot=class ViewSnapshot{constructor(e,t,n,i,s,o,l,u,h){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=l,this.excludesMetadataChanges=u,this.hasCachedResults=h}static fromInitialDocuments(e,t,n,i,s){let o=[];return t.forEach(e=>{o.push({type:0,doc:e})}),new ViewSnapshot(e,t,DocumentSet.emptySet(t),o,n,i,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&__PRIVATE_queryEquals(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}};/** 2517 * @license 2518 * Copyright 2017 Google LLC 2519 * 2520 * Licensed under the Apache License, Version 2.0 (the "License"); 2521 * you may not use this file except in compliance with the License. 2522 * You may obtain a copy of the License at 2523 * 2524 * http://www.apache.org/licenses/LICENSE-2.0 2525 * 2526 * Unless required by applicable law or agreed to in writing, software 2527 * distributed under the License is distributed on an "AS IS" BASIS, 2528 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2529 * See the License for the specific language governing permissions and 2530 * limitations under the License. 2531 */let __PRIVATE_QueryListenersInfo=class __PRIVATE_QueryListenersInfo{constructor(){this.q_=void 0,this.listeners=[]}};let __PRIVATE_EventManagerImpl=class __PRIVATE_EventManagerImpl{constructor(){this.queries=new ObjectMap(e=>__PRIVATE_canonifyQuery(e),__PRIVATE_queryEquals),this.onlineState="Unknown",this.Q_=new Set}};async function __PRIVATE_eventManagerListen(e,t){let n=t.query,i=!1,s=e.queries.get(n);if(s||(i=!0,s=new __PRIVATE_QueryListenersInfo),i)try{s.q_=await e.onListen(n)}catch(n){let e=__PRIVATE_wrapInUserErrorIfRecoverable(n,`Initialization of query '${__PRIVATE_stringifyQuery(t.query)}' failed`);return void t.onError(e)}e.queries.set(n,s),s.listeners.push(t),t.K_(e.onlineState),s.q_&&t.U_(s.q_)&&__PRIVATE_raiseSnapshotsInSyncEvent(e)}async function __PRIVATE_eventManagerUnlisten(e,t){let n=t.query,i=!1,s=e.queries.get(n);if(s){let e=s.listeners.indexOf(t);e>=0&&(s.listeners.splice(e,1),i=0===s.listeners.length)}if(i)return e.queries.delete(n),e.onUnlisten(n)}function __PRIVATE_eventManagerOnWatchChange(e,t){let n=!1;for(let i of t){let t=i.query,s=e.queries.get(t);if(s){for(let e of s.listeners)e.U_(i)&&(n=!0);s.q_=i}}n&&__PRIVATE_raiseSnapshotsInSyncEvent(e)}function __PRIVATE_eventManagerOnWatchError(e,t,n){let i=e.queries.get(t);if(i)for(let e of i.listeners)e.onError(n);e.queries.delete(t)}function __PRIVATE_raiseSnapshotsInSyncEvent(e){e.Q_.forEach(e=>{e.next()})}let __PRIVATE_QueryListener=class __PRIVATE_QueryListener{constructor(e,t,n){this.query=e,this.W_=t,this.G_=!1,this.z_=null,this.onlineState="Unknown",this.options=n||{}}U_(e){if(!this.options.includeMetadataChanges){let t=[];for(let n of e.docChanges)3!==n.type&&t.push(n);e=new ViewSnapshot(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.G_?this.j_(e)&&(this.W_.next(e),t=!0):this.H_(e,this.onlineState)&&(this.J_(e),t=!0),this.z_=e,t}onError(e){this.W_.error(e)}K_(e){this.onlineState=e;let t=!1;return this.z_&&!this.G_&&this.H_(this.z_,e)&&(this.J_(this.z_),t=!0),t}H_(e,t){return!e.fromCache||(!this.options.Y_||!("Offline"!==t))&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}j_(e){if(e.docChanges.length>0)return!0;let t=this.z_&&this.z_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}J_(e){e=ViewSnapshot.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.G_=!0,this.W_.next(e)}};/** 2532 * @license 2533 * Copyright 2017 Google LLC 2534 * 2535 * Licensed under the Apache License, Version 2.0 (the "License");
2536 * you may not use this file except in compliance with the License. 2537 * You may obtain a copy of the License at 2538 * 2539 * http://www.apache.org/licenses/LICENSE-2.0 2540 * 2541 * Unless required by applicable law or agreed to in writing, software 2542 * distributed under the License is distributed on an "AS IS" BASIS, 2543 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2544 * See the License for the specific language governing permissions and 2545 * limitations under the License. 2546 */let __PRIVATE_AddedLimboDocument=class __PRIVATE_AddedLimboDocument{constructor(e){this.key=e}};let __PRIVATE_RemovedLimboDocument=class __PRIVATE_RemovedLimboDocument{constructor(e){this.key=e}};let __PRIVATE_View=class __PRIVATE_View{constructor(e,t){this.query=e,this.sa=t,this.oa=null,this.hasCachedResults=!1,this.current=!1,this._a=__PRIVATE_documentKeySet(),this.mutatedKeys=__PRIVATE_documentKeySet(),this.aa=__PRIVATE_newQueryComparator(e),this.ua=new DocumentSet(this.aa)}get ca(){return this.sa}la(e,t){let n=t?t.ha:new __PRIVATE_DocumentChangeSet,i=t?t.ua:this.ua,s=t?t.mutatedKeys:this.mutatedKeys,o=i,l=!1,u="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,h="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((e,t)=>{let d=i.get(e),_=__PRIVATE_queryMatches(this.query,t)?t:null,m=!!d&&this.mutatedKeys.has(d.key),g=!!_&&(_.hasLocalMutations||this.mutatedKeys.has(_.key)&&_.hasCommittedMutations),E=!1;d&&_?d.data.isEqual(_.data)?m!==g&&(n.track({type:3,doc:_}),E=!0):this.Pa(d,_)||(n.track({type:2,doc:_}),E=!0,(u&&this.aa(_,u)>0||h&&0>this.aa(_,h))&&(l=!0)):!d&&_?(n.track({type:0,doc:_}),E=!0):d&&!_&&(n.track({type:1,doc:d}),E=!0,(u||h)&&(l=!0)),E&&(_?(o=o.add(_),s=g?s.add(e):s.delete(e)):(o=o.delete(e),s=s.delete(e)))}),null!==this.query.limit)for(;o.size>this.query.limit;){let e="F"===this.query.limitType?o.last():o.first();o=o.delete(e.key),s=s.delete(e.key),n.track({type:1,doc:e})}return{ua:o,ha:n,Xi:l,mutatedKeys:s}}Pa(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n){let i=this.ua;this.ua=e.ua,this.mutatedKeys=e.mutatedKeys;let s=e.ha.k_();s.sort((e,t)=>(function(e,t){let order=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return fail()}};return order(e)-order(t)})(e.type,t.type)||this.aa(e.doc,t.doc)),this.Ia(n);let o=t?this.Ta():[],l=0===this._a.size&&this.current?1:0,u=l!==this.oa;return(this.oa=l,0!==s.length||u)?{snapshot:new ViewSnapshot(this.query,e.ua,i,s,e.mutatedKeys,0===l,u,!1,!!n&&n.resumeToken.approximateByteSize()>0),Ea:o}:{Ea:o}}K_(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({ua:this.ua,ha:new __PRIVATE_DocumentChangeSet,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{Ea:[]}}da(e){return!this.sa.has(e)&&!!this.ua.has(e)&&!this.ua.get(e).hasLocalMutations}Ia(e){e&&(e.addedDocuments.forEach(e=>this.sa=this.sa.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.sa=this.sa.delete(e)),this.current=e.current)}Ta(){if(!this.current)return[];let e=this._a;this._a=__PRIVATE_documentKeySet(),this.ua.forEach(e=>{this.da(e.key)&&(this._a=this._a.add(e.key))});let t=[];return e.forEach(e=>{this._a.has(e)||t.push(new __PRIVATE_RemovedLimboDocument(e))}),this._a.forEach(n=>{e.has(n)||t.push(new __PRIVATE_AddedLimboDocument(n))}),t}Aa(e){this.sa=e.hs,this._a=__PRIVATE_documentKeySet();let t=this.la(e.documents);return this.applyChanges(t,!0)}Ra(){return ViewSnapshot.fromInitialDocuments(this.query,this.ua,this.mutatedKeys,0===this.oa,this.hasCachedResults)}};let __PRIVATE_QueryView=class __PRIVATE_QueryView{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}};let LimboResolution=class LimboResolution{constructor(e){this.key=e,this.Va=!1}};let __PRIVATE_SyncEngineImpl=class __PRIVATE_SyncEngineImpl{constructor(e,t,n,i,s,o){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.ma={},this.fa=new ObjectMap(e=>__PRIVATE_canonifyQuery(e),__PRIVATE_queryEquals),this.ga=new Map,this.pa=new Set,this.ya=new SortedMap(DocumentKey.comparator),this.wa=new Map,this.Sa=new __PRIVATE_ReferenceSet,this.ba={},this.Da=new Map,this.Ca=__PRIVATE_TargetIdGenerator.Bn(),this.onlineState="Unknown",this.va=void 0}get isPrimaryClient(){return!0===this.va}};async function __PRIVATE_syncEngineListen(e,t){var n,i;let s,o;let l=(e.remoteStore.remoteSyncer.applyRemoteEvent=__PRIVATE_syncEngineApplyRemoteEvent.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=__PRIVATE_syncEngineGetRemoteKeysForTarget.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=__PRIVATE_syncEngineRejectListen.bind(null,e),e.ma.u_=__PRIVATE_eventManagerOnWatchChange.bind(null,e.eventManager),e.ma.Ma=__PRIVATE_eventManagerOnWatchError.bind(null,e.eventManager),e),u=l.fa.get(t);
2546if(u)s=u.targetId,l.sharedClientState.addLocalQueryTarget(s),o=u.view.Ra();else{let e=await (n=l.localStore,i=__PRIVATE_queryToTarget(t),n.persistence.runTransaction("Allocate target","readwrite",e=>{let t;return n.Qr.getTargetData(e,i).next(s=>s?(t=s,PersistencePromise.resolve(t)):n.Qr.allocateTargetId(e).next(s=>(t=new TargetData(i,s,"TargetPurposeListen",e.currentSequenceNumber),n.Qr.addTargetData(e,t).next(()=>t))))}).then(e=>{let t=n.ns.get(e.targetId);return(null===t||e.snapshotVersion.compareTo(t.snapshotVersion)>0)&&(n.ns=n.ns.insert(e.targetId,e),n.rs.set(i,e.targetId)),e})),u=l.sharedClientState.addLocalQueryTarget(e.targetId);s=e.targetId,o=await __PRIVATE_initializeViewAndComputeSnapshot(l,t,s,"current"===u,e.resumeToken),l.isPrimaryClient&&__PRIVATE_remoteStoreListen(l.remoteStore,e)}return o}async function __PRIVATE_initializeViewAndComputeSnapshot(e,t,n,i,s){e.Fa=(t,n,i)=>(async function(e,t,n,i){let s=t.view.la(n);s.Xi&&(s=await __PRIVATE_localStoreExecuteQuery(e.localStore,t.query,!1).then(({documents:e})=>t.view.la(e,s)));let o=i&&i.targetChanges.get(t.targetId),l=t.view.applyChanges(s,e.isPrimaryClient,o);return __PRIVATE_updateTrackedLimbos(e,t.targetId,l.Ea),l.snapshot})(e,t,n,i);let o=await __PRIVATE_localStoreExecuteQuery(e.localStore,t,!0),l=new __PRIVATE_View(t,o.hs),u=l.la(o.documents),h=TargetChange.createSynthesizedTargetChangeForCurrentChange(n,i&&"Offline"!==e.onlineState,s),d=l.applyChanges(u,e.isPrimaryClient,h);__PRIVATE_updateTrackedLimbos(e,n,d.Ea);let _=new __PRIVATE_QueryView(t,n,l);return e.fa.set(t,_),e.ga.has(n)?e.ga.get(n).push(t):e.ga.set(n,[t]),d.snapshot}async function __PRIVATE_syncEngineUnlisten(e,t){let n=e.fa.get(t),i=e.ga.get(n.targetId);if(i.length>1)return e.ga.set(n.targetId,i.filter(e=>!__PRIVATE_queryEquals(e,t))),void e.fa.delete(t);e.isPrimaryClient?(e.sharedClientState.removeLocalQueryTarget(n.targetId),e.sharedClientState.isActiveQueryTarget(n.targetId)||await __PRIVATE_localStoreReleaseTarget(e.localStore,n.targetId,!1).then(()=>{e.sharedClientState.clearQueryState(n.targetId),__PRIVATE_remoteStoreUnlisten(e.remoteStore,n.targetId),__PRIVATE_removeAndCleanupTarget(e,n.targetId)}).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss)):(__PRIVATE_removeAndCleanupTarget(e,n.targetId),await __PRIVATE_localStoreReleaseTarget(e.localStore,n.targetId,!0))}async function __PRIVATE_syncEngineWrite(e,t,n){var i;let s=(e.remoteStore.remoteSyncer.applySuccessfulWrite=__PRIVATE_syncEngineApplySuccessfulWrite.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=__PRIVATE_syncEngineRejectFailedWrite.bind(null,e),e);try{let e;let o=await function(e,t){let n,i;let s=Timestamp.now(),o=t.reduce((e,t)=>e.add(t.key),__PRIVATE_documentKeySet());return e.persistence.runTransaction("Locally write mutations","readwrite",l=>{let u=ta,h=__PRIVATE_documentKeySet();return e.os.getEntries(l,o).next(e=>{(u=e).forEach((e,t)=>{t.isValidDocument()||(h=h.add(e))})}).next(()=>e.localDocuments.getOverlayedDocuments(l,u)).next(i=>{n=i;let o=[];for(let e of t){let t=function(e,t){let n=null;for(let i of e.fieldTransforms){let e=t.data.field(i.field),s=__PRIVATE_computeTransformOperationBaseValue(i.transform,e||null);null!=s&&(null===n&&(n=ObjectValue.empty()),n.set(i.field,s))}return n||null}(e,n.get(e.key).overlayedDocument);null!=t&&o.push(new __PRIVATE_PatchMutation(e.key,t,function __PRIVATE_extractFieldMask(e){let t=[];return forEach(e.fields,(e,n)=>{let i=new FieldPath$1([e]);if(__PRIVATE_isMapValue(n)){let e=__PRIVATE_extractFieldMask(n.mapValue).fields;if(0===e.length)t.push(i);else for(let n of e)t.push(i.child(n))}else t.push(i)}),new FieldMask(t)}(t.value.mapValue),Precondition.exists(!0)))}return e.mutationQueue.addMutationBatch(l,s,o,t)}).next(t=>{i=t;let s=t.applyToLocalDocumentSet(n,h);return e.documentOverlayCache.saveOverlays(l,t.batchId,s)})}).then(()=>({batchId:i.batchId,changes:__PRIVATE_convertOverlayedDocumentMapToDocumentMap(n)}))}(s.localStore,t);s.sharedClientState.addPendingMutation(o.batchId),i=o.batchId,(e=s.ba[s.currentUser.toKey()])||(e=new SortedMap(__PRIVATE_primitiveComparator)),e=e.insert(i,n),s.ba[s.currentUser.toKey()]=e,await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(s,o.changes),await __PRIVATE_fillWritePipeline(s.remoteStore)}catch(t){let e=__PRIVATE_wrapInUserErrorIfRecoverable(t,"Failed to persist write");n.reject(e)}}async function __PRIVATE_syncEngineApplyRemoteEvent(e,t){try{let n=await function(e,t){let n=t.snapshotVersion,i=e.ns;return e.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{var o;let l,u;let h=e.os.newChangeBuffer({trackRemovals:!0});i=e.ns;let d=[];
2546t.targetChanges.forEach((o,l)=>{var u;let h=i.get(l);if(!h)return;d.push(e.Qr.removeMatchingKeys(s,o.removedDocuments,l).next(()=>e.Qr.addMatchingKeys(s,o.addedDocuments,l)));let _=h.withSequenceNumber(s.currentSequenceNumber);null!==t.targetMismatches.get(l)?_=_.withResumeToken(ByteString.EMPTY_BYTE_STRING,SnapshotVersion.min()).withLastLimboFreeSnapshotVersion(SnapshotVersion.min()):o.resumeToken.approximateByteSize()>0&&(_=_.withResumeToken(o.resumeToken,n)),i=i.insert(l,_),u=_,(0===h.resumeToken.approximateByteSize()||u.snapshotVersion.toMicroseconds()-h.snapshotVersion.toMicroseconds()>=3e8||o.addedDocuments.size+o.modifiedDocuments.size+o.removedDocuments.size>0)&&d.push(e.Qr.updateTargetData(s,_))});let _=ta,m=__PRIVATE_documentKeySet();if(t.documentUpdates.forEach(n=>{t.resolvedLimboDocuments.has(n)&&d.push(e.persistence.referenceDelegate.updateLimboDocument(s,n))}),d.push((o=t.documentUpdates,l=__PRIVATE_documentKeySet(),u=__PRIVATE_documentKeySet(),o.forEach(e=>l=l.add(e)),h.getEntries(s,l).next(e=>{let t=ta;return o.forEach((n,i)=>{let s=e.get(n);i.isFoundDocument()!==s.isFoundDocument()&&(u=u.add(n)),i.isNoDocument()&&i.version.isEqual(SnapshotVersion.min())?(h.removeEntry(n,i.readTime),t=t.insert(n,i)):!s.isValidDocument()||i.version.compareTo(s.version)>0||0===i.version.compareTo(s.version)&&s.hasPendingWrites?(h.addEntry(i),t=t.insert(n,i)):__PRIVATE_logDebug("LocalStore","Ignoring outdated watch update for ",n,". Current version:",s.version," Watch version:",i.version)}),{cs:t,ls:u}})).next(e=>{_=e.cs,m=e.ls})),!n.isEqual(SnapshotVersion.min())){let t=e.Qr.getLastRemoteSnapshotVersion(s).next(t=>e.Qr.setTargetsMetadata(s,s.currentSequenceNumber,n));d.push(t)}return PersistencePromise.waitFor(d).next(()=>h.apply(s)).next(()=>e.localDocuments.getLocalViewOfDocuments(s,_,m)).next(()=>_)}).then(t=>(e.ns=i,t))}(e.localStore,t);
2546t.targetChanges.forEach((t,n)=>{let i=e.wa.get(n);i&&(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1||fail(),t.addedDocuments.size>0?i.Va=!0:t.modifiedDocuments.size>0?i.Va||fail():t.removedDocuments.size>0&&(i.Va||fail(),i.Va=!1))}),await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e,n,t)}catch(e){await __PRIVATE_ignoreIfPrimaryLeaseLoss(e)}}function __PRIVATE_syncEngineApplyOnlineStateChange(e,t,n){var i;if(e.isPrimaryClient&&0===n||!e.isPrimaryClient&&1===n){let n;let s=[];e.fa.forEach((e,n)=>{let i=n.view.K_(t);i.snapshot&&s.push(i.snapshot)}),(i=e.eventManager).onlineState=t,n=!1,i.queries.forEach((e,i)=>{for(let e of i.listeners)e.K_(t)&&(n=!0)}),n&&__PRIVATE_raiseSnapshotsInSyncEvent(i),s.length&&e.ma.u_(s),e.onlineState=t,e.isPrimaryClient&&e.sharedClientState.setOnlineState(t)}}async function __PRIVATE_syncEngineRejectListen(e,t,n){e.sharedClientState.updateQueryState(t,"rejected",n);let i=e.wa.get(t),s=i&&i.key;if(s){let n=new SortedMap(DocumentKey.comparator);n=n.insert(s,MutableDocument.newNoDocument(s,SnapshotVersion.min()));let i=__PRIVATE_documentKeySet().add(s),o=new RemoteEvent(SnapshotVersion.min(),new Map,new SortedMap(__PRIVATE_primitiveComparator),n,i);await __PRIVATE_syncEngineApplyRemoteEvent(e,o),e.ya=e.ya.remove(s),e.wa.delete(t),__PRIVATE_pumpEnqueuedLimboResolutions(e)}else await __PRIVATE_localStoreReleaseTarget(e.localStore,t,!1).then(()=>__PRIVATE_removeAndCleanupTarget(e,t,n)).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss)}async function __PRIVATE_syncEngineApplySuccessfulWrite(e,t){var n;let i=t.batch.batchId;try{let s=await (n=e.localStore).persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{let i=t.batch.keys(),s=n.os.newChangeBuffer({trackRemovals:!0});return(function(e,t,n,i){let s=n.batch,o=s.keys(),l=PersistencePromise.resolve();return o.forEach(e=>{l=l.next(()=>i.getEntry(t,e)).next(t=>{let o=n.docVersions.get(e);null!==o||fail(),0>t.version.compareTo(o)&&(s.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),i.addEntry(t)))})}),l.next(()=>e.mutationQueue.removeMutationBatch(t,s))})(n,e,t,s).next(()=>s.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=__PRIVATE_documentKeySet();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))).next(()=>n.localDocuments.getDocuments(e,i))});__PRIVATE_processUserCallback(e,i,null),__PRIVATE_triggerPendingWritesCallbacks(e,i),e.sharedClientState.updateMutationState(i,"acknowledged"),await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e,s)}catch(e){await __PRIVATE_ignoreIfPrimaryLeaseLoss(e)}}async function __PRIVATE_syncEngineRejectFailedWrite(e,t,n){var i;try{let s=await (i=e.localStore).persistence.runTransaction("Reject batch","readwrite-primary",e=>{let n;
2546return i.mutationQueue.lookupMutationBatch(e,t).next(t=>(null!==t||fail(),n=t.keys(),i.mutationQueue.removeMutationBatch(e,t))).next(()=>i.mutationQueue.performConsistencyCheck(e)).next(()=>i.documentOverlayCache.removeOverlaysForBatchId(e,n,t)).next(()=>i.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,n)).next(()=>i.localDocuments.getDocuments(e,n))});__PRIVATE_processUserCallback(e,t,n),__PRIVATE_triggerPendingWritesCallbacks(e,t),e.sharedClientState.updateMutationState(t,"rejected",n),await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e,s)}catch(e){await __PRIVATE_ignoreIfPrimaryLeaseLoss(e)}}function __PRIVATE_triggerPendingWritesCallbacks(e,t){(e.Da.get(t)||[]).forEach(e=>{e.resolve()}),e.Da.delete(t)}function __PRIVATE_processUserCallback(e,t,n){let i=e.ba[e.currentUser.toKey()];if(i){let s=i.get(t);s&&(n?s.reject(n):s.resolve(),i=i.remove(t)),e.ba[e.currentUser.toKey()]=i}}function __PRIVATE_removeAndCleanupTarget(e,t,n=null){for(let i of(e.sharedClientState.removeLocalQueryTarget(t),e.ga.get(t)))e.fa.delete(i),n&&e.ma.Ma(i,n);e.ga.delete(t),e.isPrimaryClient&&e.Sa.Vr(t).forEach(t=>{e.Sa.containsKey(t)||__PRIVATE_removeLimboTarget(e,t)})}function __PRIVATE_removeLimboTarget(e,t){e.pa.delete(t.path.canonicalString());let n=e.ya.get(t);null!==n&&(__PRIVATE_remoteStoreUnlisten(e.remoteStore,n),e.ya=e.ya.remove(t),e.wa.delete(n),__PRIVATE_pumpEnqueuedLimboResolutions(e))}function __PRIVATE_updateTrackedLimbos(e,t,n){for(let i of n)i instanceof __PRIVATE_AddedLimboDocument?(e.Sa.addReference(i.key,t),function(e,t){let n=t.key,i=n.path.canonicalString();e.ya.get(n)||e.pa.has(i)||(__PRIVATE_logDebug("SyncEngine","New document in limbo: "+n),e.pa.add(i),__PRIVATE_pumpEnqueuedLimboResolutions(e))}(e,i)):i instanceof __PRIVATE_RemovedLimboDocument?(__PRIVATE_logDebug("SyncEngine","Document no longer in limbo: "+i.key),e.Sa.removeReference(i.key,t),e.Sa.containsKey(i.key)||__PRIVATE_removeLimboTarget(e,i.key)):fail()}function __PRIVATE_pumpEnqueuedLimboResolutions(e){for(;e.pa.size>0&&e.ya.size<e.maxConcurrentLimboResolutions;){var t;let n=e.pa.values().next().value;e.pa.delete(n);let i=new DocumentKey(ResourcePath.fromString(n)),s=e.Ca.next();e.wa.set(s,new LimboResolution(i)),e.ya=e.ya.insert(i,s),__PRIVATE_remoteStoreListen(e.remoteStore,new TargetData(__PRIVATE_queryToTarget((t=i.path,new __PRIVATE_QueryImpl(t))),s,"TargetPurposeLimboResolution",__PRIVATE_ListenSequence.ae))}}async function __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e,t,n){let i=[],s=[],o=[];e.fa.isEmpty()||(e.fa.forEach((l,u)=>{o.push(e.Fa(u,t,n).then(t=>{if((t||n)&&e.isPrimaryClient&&e.sharedClientState.updateQueryState(u.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){i.push(t);let e=__PRIVATE_LocalViewChanges.Ki(u.targetId,t);s.push(e)}}))}),await Promise.all(o),e.ma.u_(i),await async function(e,t){try{await e.persistence.runTransaction("notifyLocalViewChanges","readwrite",n=>PersistencePromise.forEach(t,t=>PersistencePromise.forEach(t.qi,i=>e.persistence.referenceDelegate.addReference(n,t.targetId,i)).next(()=>PersistencePromise.forEach(t.Qi,i=>e.persistence.referenceDelegate.removeReference(n,t.targetId,i)))))}catch(e){if(!__PRIVATE_isIndexedDbTransactionError(e))throw e;__PRIVATE_logDebug("LocalStore","Failed to update sequence numbers: "+e)}for(let n of t){let t=n.targetId;if(!n.fromCache){let n=e.ns.get(t),i=n.snapshotVersion,s=n.withLastLimboFreeSnapshotVersion(i);e.ns=e.ns.insert(t,s)}}}(e.localStore,s))}async function __PRIVATE_syncEngineHandleCredentialChange(e,t){if(!e.currentUser.isEqual(t)){__PRIVATE_logDebug("SyncEngine","User change. New user:",t.toKey());let n=await __PRIVATE_localStoreHandleUserChange(e.localStore,t);
2546e.currentUser=t,e.Da.forEach(e=>{e.forEach(e=>{e.reject(new FirestoreError(tr.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.Da.clear(),e.sharedClientState.handleUserChange(t,n.removedBatchIds,n.addedBatchIds),await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e,n.us)}}function __PRIVATE_syncEngineGetRemoteKeysForTarget(e,t){let n=e.wa.get(t);if(n&&n.Va)return __PRIVATE_documentKeySet().add(n.key);{let n=__PRIVATE_documentKeySet(),i=e.ga.get(t);if(!i)return n;for(let t of i){let i=e.fa.get(t);n=n.unionWith(i.view.ca)}return n}}let MemoryOfflineComponentProvider=class MemoryOfflineComponentProvider{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=__PRIVATE_newSerializer(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){var t,n,i,s;return t=this.persistence,n=new __PRIVATE_QueryEngine,i=e.initialUser,s=this.serializer,new __PRIVATE_LocalStoreImpl(t,n,i,s)}createPersistence(e){return new __PRIVATE_MemoryPersistence(__PRIVATE_MemoryEagerDelegate.Hr,this.serializer)}createSharedClientState(e){return new __PRIVATE_MemorySharedClientState}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}};let OnlineComponentProvider=class OnlineComponentProvider{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>__PRIVATE_syncEngineApplyOnlineStateChange(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=__PRIVATE_syncEngineHandleCredentialChange.bind(null,this.syncEngine),await __PRIVATE_remoteStoreApplyPrimaryState(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new __PRIVATE_EventManagerImpl}createDatastore(e){var t,n,i;let s=__PRIVATE_newSerializer(e.databaseInfo.databaseId),o=(t=e.databaseInfo,new __PRIVATE_WebChannelConnection(t));return n=e.authCredentials,i=e.appCheckCredentials,new __PRIVATE_DatastoreImpl(n,i,o,s)}createRemoteStore(e){var t,n,i,s;return t=this.localStore,n=this.datastore,i=e.asyncQueue,s=__PRIVATE_BrowserConnectivityMonitor.C()?new __PRIVATE_BrowserConnectivityMonitor:new __PRIVATE_NoopConnectivityMonitor,new __PRIVATE_RemoteStoreImpl(t,n,i,e=>__PRIVATE_syncEngineApplyOnlineStateChange(this.syncEngine,e,0),s)}createSyncEngine(e,t){return function(e,t,n,i,s,o,l){let u=new __PRIVATE_SyncEngineImpl(e,t,n,i,s,o);return l&&(u.va=!0),u}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}terminate(){return async function(e){__PRIVATE_logDebug("RemoteStore","RemoteStore shutting down."),e.v_.add(5),await __PRIVATE_disableNetworkInternal(e),e.M_.shutdown(),e.x_.set("Unknown")}(this.remoteStore)}};/** 2547 * @license 2548 * Copyright 2020 Google LLC 2549 * 2550 * Licensed under the Apache License, Version 2.0 (the "License"); 2551 * you may not use this file except in compliance with the License. 2552 * You may obtain a copy of the License at 2553 * 2554 * http://www.apache.org/licenses/LICENSE-2.0 2555 * 2556 * Unless required by applicable law or agreed to in writing, software 2557 * distributed under the License is distributed on an "AS IS" BASIS, 2558 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2559 * See the License for the specific language governing permissions and 2560 * limitations under the License. 2561 *//** 2562 * @license 2563 * Copyright 2017 Google LLC 2564 * 2565 * Licensed under the Apache License, Version 2.0 (the "License");
2566 * you may not use this file except in compliance with the License. 2567 * You may obtain a copy of the License at 2568 * 2569 * http://www.apache.org/licenses/LICENSE-2.0 2570 * 2571 * Unless required by applicable law or agreed to in writing, software 2572 * distributed under the License is distributed on an "AS IS" BASIS, 2573 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2574 * See the License for the specific language governing permissions and 2575 * limitations under the License. 2576 */let __PRIVATE_AsyncObserver=class __PRIVATE_AsyncObserver{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Na(this.observer.next,e)}error(e){this.observer.error?this.Na(this.observer.error,e):__PRIVATE_logError("Uncaught Error in snapshot listener:",e.toString())}Ba(){this.muted=!0}Na(e,t){this.muted||setTimeout(()=>{this.muted||e(t)},0)}};/** 2577 * @license 2578 * Copyright 2017 Google LLC 2579 * 2580 * Licensed under the Apache License, Version 2.0 (the "License"); 2581 * you may not use this file except in compliance with the License. 2582 * You may obtain a copy of the License at 2583 * 2584 * http://www.apache.org/licenses/LICENSE-2.0 2585 * 2586 * Unless required by applicable law or agreed to in writing, software 2587 * distributed under the License is distributed on an "AS IS" BASIS, 2588 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2589 * See the License for the specific language governing permissions and 2590 * limitations under the License. 2591 */let FirestoreClient=class FirestoreClient{constructor(e,t,n,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=i,this.user=User.UNAUTHENTICATED,this.clientId=__PRIVATE_AutoId.V(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,async e=>{__PRIVATE_logDebug("FirestoreClient","Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(__PRIVATE_logDebug("FirestoreClient","Received new app check token=",e),this.appCheckCredentialListener(e,this.user)))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new FirestoreError(tr.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();let e=new __PRIVATE_Deferred;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){let t=__PRIVATE_wrapInUserErrorIfRecoverable(n,"Failed to shutdown persistence");e.reject(t)}}),e.promise}};async function __PRIVATE_setOfflineComponentProvider(e,t){e.asyncQueue.verifyOperationInProgress(),__PRIVATE_logDebug("FirestoreClient","Initializing OfflineComponentProvider");let n=await e.getConfiguration();await t.initialize(n);let i=n.initialUser;e.setCredentialChangeListener(async e=>{i.isEqual(e)||(await __PRIVATE_localStoreHandleUserChange(t.localStore,e),i=e)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}async function __PRIVATE_setOnlineComponentProvider(e,t){e.asyncQueue.verifyOperationInProgress();let n=await __PRIVATE_ensureOfflineComponents(e);__PRIVATE_logDebug("FirestoreClient","Initializing OnlineComponentProvider");let i=await e.getConfiguration();await t.initialize(n,i),e.setCredentialChangeListener(e=>__PRIVATE_remoteStoreHandleCredentialChange(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>__PRIVATE_remoteStoreHandleCredentialChange(t.remoteStore,n)),e._onlineComponents=t}async function __PRIVATE_ensureOfflineComponents(e){if(!e._offlineComponents){if
2591(e._uninitializedComponentsProvider){__PRIVATE_logDebug("FirestoreClient","Using user provided OfflineComponentProvider");try{await __PRIVATE_setOfflineComponentProvider(e,e._uninitializedComponentsProvider._offline)}catch(t){if(!("FirebaseError"===t.name?t.code===tr.FAILED_PRECONDITION||t.code===tr.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code))throw t;__PRIVATE_logWarn("Error using user provided cache. Falling back to memory cache: "+t),await __PRIVATE_setOfflineComponentProvider(e,new MemoryOfflineComponentProvider)}}else __PRIVATE_logDebug("FirestoreClient","Using default OfflineComponentProvider"),await __PRIVATE_setOfflineComponentProvider(e,new MemoryOfflineComponentProvider)}return e._offlineComponents}async function __PRIVATE_ensureOnlineComponents(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(__PRIVATE_logDebug("FirestoreClient","Using user provided OnlineComponentProvider"),await __PRIVATE_setOnlineComponentProvider(e,e._uninitializedComponentsProvider._online)):(__PRIVATE_logDebug("FirestoreClient","Using default OnlineComponentProvider"),await __PRIVATE_setOnlineComponentProvider(e,new OnlineComponentProvider))),e._onlineComponents}async function __PRIVATE_getEventManager(e){let t=await __PRIVATE_ensureOnlineComponents(e),n=t.eventManager;return n.onListen=__PRIVATE_syncEngineListen.bind(null,t.syncEngine),n.onUnlisten=__PRIVATE_syncEngineUnlisten.bind(null,t.syncEngine),n}/** 2592 * @license 2593 * Copyright 2023 Google LLC 2594 * 2595 * Licensed under the Apache License, Version 2.0 (the "License"); 2596 * you may not use this file except in compliance with the License. 2597 * You may obtain a copy of the License at 2598 * 2599 * http://www.apache.org/licenses/LICENSE-2.0 2600 * 2601 * Unless required by applicable law or agreed to in writing, software 2602 * distributed under the License is distributed on an "AS IS" BASIS, 2603 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2604 * See the License for the specific language governing permissions and 2605 * limitations under the License. 2606 */function __PRIVATE_cloneLongPollingOptions(e){let t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}/** 2607 * @license 2608 * Copyright 2020 Google LLC 2609 * 2610 * Licensed under the Apache License, Version 2.0 (the "License"); 2611 * you may not use this file except in compliance with the License. 2612 * You may obtain a copy of the License at 2613 * 2614 * http://www.apache.org/licenses/LICENSE-2.0 2615 * 2616 * Unless required by applicable law or agreed to in writing, software 2617 * distributed under the License is distributed on an "AS IS" BASIS, 2618 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2619 * See the License for the specific language governing permissions and 2620 * limitations under the License. 2621 */let ty=new Map;/** 2622 * @license 2623 * Copyright 2017 Google LLC 2624 * 2625 * Licensed under the Apache License, Version 2.0 (the "License"); 2626 * you may not use this file except in compliance with the License. 2627 * You may obtain a copy of the License at 2628 * 2629 * http://www.apache.org/licenses/LICENSE-2.0 2630 * 2631 * Unless required by applicable law or agreed to in writing, software 2632 * distributed under the License is distributed on an "AS IS" BASIS, 2633 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2634 * See the License for the specific language governing permissions and 2635 * limitations under the License. 2636 */function __PRIVATE_validateNonEmptyArgument(e,t,n){if(!n)throw new FirestoreError(tr.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function __PRIVATE_validateDocumentPath(e){if(!DocumentKey.isDocumentKey(e))throw new FirestoreError(tr.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function __PRIVATE_validateCollectionPath(e){if(DocumentKey.isDocumentKey(e))throw new FirestoreError(tr.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function __PRIVATE_valueDescription(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{var t;let n=(t=e).constructor?t.constructor.name:null;return n?`a custom ${n} object`:"an object"}}return"function"==typeof e?"a function":fail()}function __PRIVATE_cast(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new FirestoreError(tr.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let n=__PRIVATE_valueDescription(e);throw new FirestoreError(tr.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}/** 2637 * @license 2638 * Copyright 2020 Google LLC 2639 * 2640 * Licensed under the Apache License, Version 2.0 (the "License");
2641 * you may not use this file except in compliance with the License. 2642 * You may obtain a copy of the License at 2643 * 2644 * http://www.apache.org/licenses/LICENSE-2.0 2645 * 2646 * Unless required by applicable law or agreed to in writing, software 2647 * distributed under the License is distributed on an "AS IS" BASIS, 2648 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2649 * See the License for the specific language governing permissions and 2650 * limitations under the License. 2651 */let FirestoreSettingsImpl=class FirestoreSettingsImpl{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new FirestoreError(tr.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=null===(t=e.ssl)||void 0===t||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new FirestoreError(tr.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,i){if(!0===t&&!0===i)throw new FirestoreError(tr.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=__PRIVATE_cloneLongPollingOptions(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new FirestoreError(tr.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new FirestoreError(tr.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new FirestoreError(tr.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){var t,n;return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(t=this.experimentalLongPollingOptions,n=e.experimentalLongPollingOptions,t.timeoutSeconds===n.timeoutSeconds)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}};let Firestore$1=class Firestore$1{constructor(e,t,n,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new FirestoreSettingsImpl({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new FirestoreError(tr.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new FirestoreError(tr.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 FirestoreSettingsImpl(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new __PRIVATE_EmptyAuthCredentialsProvider;switch(e.type){case"firstParty":return new __PRIVATE_FirstPartyAuthCredentialsProvider(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new FirestoreError(tr.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
2651d credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){let t=ty.get(e);t&&(__PRIVATE_logDebug("ComponentProvider","Removing Datastore"),ty.delete(e),t.terminate())}(this),Promise.resolve()}};/** 2652 * @license 2653 * Copyright 2020 Google LLC 2654 * 2655 * Licensed under the Apache License, Version 2.0 (the "License"); 2656 * you may not use this file except in compliance with the License. 2657 * You may obtain a copy of the License at 2658 * 2659 * http://www.apache.org/licenses/LICENSE-2.0 2660 * 2661 * Unless required by applicable law or agreed to in writing, software 2662 * distributed under the License is distributed on an "AS IS" BASIS, 2663 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2664 * See the License for the specific language governing permissions and 2665 * limitations under the License. 2666 */let Query=class Query{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new Query(this.firestore,e,this._query)}};let DocumentReference=class DocumentReference{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new CollectionReference(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new DocumentReference(this.firestore,e,this._key)}};let CollectionReference=class CollectionReference extends Query{constructor(e,t,n){super(e,t,new __PRIVATE_QueryImpl(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){let e=this._path.popLast();return e.isEmpty()?null:new DocumentReference(this.firestore,null,new DocumentKey(e))}withConverter(e){return new CollectionReference(this.firestore,e,this._path)}};function collection(e,t,...n){if(e=(0,E.m9)(e),__PRIVATE_validateNonEmptyArgument("collection","path",t),e instanceof Firestore$1){let i=ResourcePath.fromString(t,...n);return __PRIVATE_validateCollectionPath(i),new CollectionReference(e,null,i)}{if(!(e instanceof DocumentReference||e instanceof CollectionReference))throw new FirestoreError(tr.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let i=e._path.child(ResourcePath.fromString(t,...n));return __PRIVATE_validateCollectionPath(i),new CollectionReference(e.firestore,null,i)}}function doc(e,t,...n){if(e=(0,E.m9)(e),1==arguments.length&&(t=__PRIVATE_AutoId.V()),__PRIVATE_validateNonEmptyArgument("doc","path",t),e instanceof Firestore$1){let i=ResourcePath.fromString(t,...n);return __PRIVATE_validateDocumentPath(i),new DocumentReference(e,null,new DocumentKey(i))}{if(!(e instanceof DocumentReference||e instanceof CollectionReference))throw new FirestoreError(tr.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let i=e._path.child(ResourcePath.fromString(t,...n));return __PRIVATE_validateDocumentPath(i),new DocumentReference(e.firestore,e instanceof CollectionReference?e.converter:null,new DocumentKey(i))}}/** 2667 * @license 2668 * Copyright 2020 Google LLC 2669 * 2670 * Licensed under the Apache License, Version 2.0 (the "License"); 2671 * you may not use this file except in compliance with the License. 2672 * You may obtain a copy of the License at 2673 * 2674 * http://www.apache.org/licenses/LICENSE-2.0 2675 * 2676 * Unless required by applicable law or agreed to in writing, software 2677 * distributed under the License is distributed on an "AS IS" BASIS, 2678 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2679 * See the License for the specific language governing permissions and 2680 * limitations under the License. 2681 */let __PRIVATE_AsyncQueueImpl=class __PRIVATE_AsyncQueueImpl{constructor(){this.Ya=Prom
2681ise.resolve(),this.Za=[],this.Xa=!1,this.eu=[],this.tu=null,this.nu=!1,this.ru=!1,this.iu=[],this.jo=new __PRIVATE_ExponentialBackoff(this,"async_queue_retry"),this.su=()=>{let e=getDocument();e&&__PRIVATE_logDebug("AsyncQueue","Visibility state changed to "+e.visibilityState),this.jo.Ko()};let e=getDocument();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.su)}get isShuttingDown(){return this.Xa}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.ou(),this._u(e)}enterRestrictedMode(e){if(!this.Xa){this.Xa=!0,this.ru=e||!1;let t=getDocument();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.su)}}enqueue(e){if(this.ou(),this.Xa)return new Promise(()=>{});let t=new __PRIVATE_Deferred;return this._u(()=>this.Xa&&this.ru?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Za.push(e),this.au()))}async au(){if(0!==this.Za.length){try{await this.Za[0](),this.Za.shift(),this.jo.reset()}catch(e){if(!__PRIVATE_isIndexedDbTransactionError(e))throw e;__PRIVATE_logDebug("AsyncQueue","Operation failed with retryable error: "+e)}this.Za.length>0&&this.jo.qo(()=>this.au())}}_u(e){let t=this.Ya.then(()=>(this.nu=!0,e().catch(e=>{let t;this.tu=e,this.nu=!1;let n=(t=e.message||"",e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t);throw __PRIVATE_logError("INTERNAL UNHANDLED ERROR: ",n),e}).then(e=>(this.nu=!1,e))));return this.Ya=t,t}enqueueAfterDelay(e,t,n){this.ou(),this.iu.indexOf(e)>-1&&(t=0);let i=DelayedOperation.createAndSchedule(this,e,t,n,e=>this.uu(e));return this.eu.push(i),i}ou(){this.tu&&fail()}verifyOperationInProgress(){}async cu(){let e;do e=this.Ya,await e;while(e!==this.Ya)}lu(e){for(let t of this.eu)if(t.timerId===e)return!0;return!1}hu(e){return this.cu().then(()=>{for(let t of(this.eu.sort((e,t)=>e.targetTimeMs-t.targetTimeMs),this.eu))if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.cu()})}Pu(e){this.iu.push(e)}uu(e){let t=this.eu.indexOf(e);this.eu.splice(t,1)}};let Firestore=class Firestore extends Firestore$1{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=new __PRIVATE_AsyncQueueImpl,this._persistenceKey=(null==i?void 0:i.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||__PRIVATE_configureFirestore(this),this._firestoreClient.terminate()}};function getFirestore(e,t){let n="object"==typeof e?e:(0,_.Mq)(),i=(0,_.qX)(n,"firestore").getImmediate({identifier:"string"==typeof e?e:t||"(default)"});if(!i._initialized){let e=(0,E.P0)("firestore");e&&function(e,t,n,i={}){var s;let o=(e=__PRIVATE_cast(e,Firestore$1))._getSettings(),l=`${t}:${n}`;if("firestore.googleapis.com"!==o.host&&o.host!==l&&__PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),e._setSettings(Object.assign(Object.assign({},o),{host:l,ssl:!1})),i.mockUserToken){let t,n;if("string"==typeof i.mockUserToken)t=i.mockUserToken,n=User.MOCK_USER;else{t=(0,E.Sg)(i.mockUserToken,null===(s=e._app)||void 0===s?void 0:s.options.projectId);let o=i.mockUserToken.sub||i.mockUserToken.user_id;if(!o)throw new FirestoreError(tr.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new User(o)}e._authCredentials=new __PRIVATE_EmulatorAuthCredentialsProvider(new __PRIVATE_OAuthToken(t,n))}}(i,...e)}return i}function ensureFirestoreConfigured(e){return e._firestoreClient||__PRIVATE_configureFirestore(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function __PRIVATE_configureFirestore(e){var t,n,i,s,o,l;let u=e._freezeSettings(),h=(s=e._databaseId,o=(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",l=e._persistenceKey,new DatabaseInfo(s,o,l,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,__PRIVATE_cloneLongPollingOptions(u.experimentalLongPollingOptions),u.useFetchStreams));e._firestoreClient=new FirestoreClient(e._authCredentials,e._appCheckCredentials,e._queue,h),(null===(n=u.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(i=u.localCache)||void 0===i?void 0:i._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:u.localCache.kind,_offline:u.localCache._offlineComponentProvider,_online:u.localCache._onlineComponentProvider})}/** 2682 * @license 2683 * Copyright 2020 Google LLC 2684 * 2685 * Licensed under the Apache License, Version 2.0 (the "License");
2686 * you may not use this file except in compliance with the License. 2687 * You may obtain a copy of the License at 2688 * 2689 * http://www.apache.org/licenses/LICENSE-2.0 2690 * 2691 * Unless required by applicable law or agreed to in writing, software 2692 * distributed under the License is distributed on an "AS IS" BASIS, 2693 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2694 * See the License for the specific language governing permissions and 2695 * limitations under the License. 2696 */let Bytes=class Bytes{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Bytes(ByteString.fromBase64String(e))}catch(e){throw new FirestoreError(tr.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new Bytes(ByteString.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}};/** 2697 * @license 2698 * Copyright 2020 Google LLC 2699 * 2700 * Licensed under the Apache License, Version 2.0 (the "License"); 2701 * you may not use this file except in compliance with the License. 2702 * You may obtain a copy of the License at 2703 * 2704 * http://www.apache.org/licenses/LICENSE-2.0 2705 * 2706 * Unless required by applicable law or agreed to in writing, software 2707 * distributed under the License is distributed on an "AS IS" BASIS, 2708 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2709 * See the License for the specific language governing permissions and 2710 * limitations under the License. 2711 */let FieldPath=class FieldPath{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new FirestoreError(tr.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new FieldPath$1(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};/** 2712 * @license 2713 * Copyright 2020 Google LLC 2714 * 2715 * Licensed under the Apache License, Version 2.0 (the "License"); 2716 * you may not use this file except in compliance with the License. 2717 * You may obtain a copy of the License at 2718 * 2719 * http://www.apache.org/licenses/LICENSE-2.0 2720 * 2721 * Unless required by applicable law or agreed to in writing, software 2722 * distributed under the License is distributed on an "AS IS" BASIS, 2723 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2724 * See the License for the specific language governing permissions and 2725 * limitations under the License. 2726 */let FieldValue=class FieldValue{constructor(e){this._methodName=e}};/** 2727 * @license 2728 * Copyright 2017 Google LLC 2729 * 2730 * Licensed under the Apache License, Version 2.0 (the "License"); 2731 * you may not use this file except in compliance with the License. 2732 * You may obtain a copy of the License at 2733 * 2734 * http://www.apache.org/licenses/LICENSE-2.0 2735 * 2736 * Unless required by applicable law or agreed to in writing, software 2737 * distributed under the License is distributed on an "AS IS" BASIS, 2738 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2739 * See the License for the specific language governing permissions and 2740 * limitations under the License. 2741 */let GeoPoint=class GeoPoint{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new FirestoreError(tr.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new FirestoreError(tr.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return __PRIVATE_primitiveComparator(this._lat,e._lat)||__PRIVATE_primitiveComparator(this._long,e._long)}};/** 2742 * @license 2743 * Copyright 2017 Google LLC 2744 * 2745 * Licensed under the Apache License, Version 2.0 (the "License"); 2746 * you may not use this file except in compliance with the License. 2747 * You may obtain a copy of the License at 2748 * 2749 * http://www.apache.org/licenses/LICENSE-2.0 2750 * 2751 * Unless required by applicable law or agreed to in writing, softw
2751are 2752 * distributed under the License is distributed on an "AS IS" BASIS, 2753 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2754 * See the License for the specific language governing permissions and 2755 * limitations under the License. 2756 */let tE=/^__.*__$/;let ParsedSetData=class ParsedSetData{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new __PRIVATE_PatchMutation(e,this.data,this.fieldMask,t,this.fieldTransforms):new __PRIVATE_SetMutation(e,this.data,t,this.fieldTransforms)}};let ParsedUpdateData=class ParsedUpdateData{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new __PRIVATE_PatchMutation(e,this.data,this.fieldMask,t,this.fieldTransforms)}};function __PRIVATE_isWrite(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw fail()}}let __PRIVATE_ParseContextImpl=class __PRIVATE_ParseContextImpl{constructor(e,t,n,i,s,o){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=i,void 0===s&&this.Iu(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Tu(){return this.settings.Tu}Eu(e){return new __PRIVATE_ParseContextImpl(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}du(e){var t;let n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Eu({path:n,Au:!1});return i.Ru(e),i}Vu(e){var t;let n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Eu({path:n,Au:!1});return i.Iu(),i}mu(e){return this.Eu({path:void 0,Au:!0})}fu(e){return __PRIVATE_createError(e,this.settings.methodName,this.settings.gu||!1,this.path,this.settings.pu)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}Iu(){if(this.path)for(let e=0;e<this.path.length;e++)this.Ru(this.path.get(e))}Ru(e){if(0===e.length)throw this.fu("Document fields must not be empty");if(__PRIVATE_isWrite(this.Tu)&&tE.test(e))throw this.fu('Document fields cannot begin and end with "__"')}};let __PRIVATE_UserDataReader=class __PRIVATE_UserDataReader{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||__PRIVATE_newSerializer(e)}yu(e,t,n,i=!1){return new __PRIVATE_ParseContextImpl({Tu:e,methodName:t,pu:n,path:FieldPath$1.emptyPath(),Au:!1,gu:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function __PRIVATE_newUserDataReader(e){let t=e._freezeSettings(),n=__PRIVATE_newSerializer(e._databaseId);return new __PRIVATE_UserDataReader(e._databaseId,!!t.ignoreUndefinedProperties,n)}function __PRIVATE_parseSetData(e,t,n,i,s,o={}){let l,u;let h=e.yu(o.merge||o.mergeFields?2:0,t,n,s);__PRIVATE_validatePlainObject("Data must be an object, but it was:",h,i);let d=__PRIVATE_parseObject(i,h);if(o.merge)l=new FieldMask(h.fieldMask),u=h.fieldTransforms;else if(o.mergeFields){let e=[];for(let i of o.mergeFields){let s=__PRIVATE_fieldPathFromArgument$1(t,i,n);if(!h.contains(s))throw new FirestoreError(tr.INVALID_ARGUMENT,`Field '${s}' is specified in your field mask but missing from your input data.`);__PRIVATE_fieldMaskContains(e,s)||e.push(s)}l=new FieldMask(e),u=h.fieldTransforms.filter(e=>l.covers(e.field))}else l=null,u=h.fieldTransforms;return new ParsedSetData(new ObjectValue(d),l,u)}let __PRIVATE_DeleteFieldValueImpl=class __PRIVATE_DeleteFieldValueImpl extends FieldValue{_toFieldTransform(e){if(2!==e.Tu)throw 1===e.Tu?e.fu(`${this._methodName}() can only appear at the top level of your update data`):e.fu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof __PRIVATE_DeleteFieldValueImpl}};function __PRIVATE_parseData(e,t){if(__PRIVATE_looksLikeJsonObject(e=(0,E.m9)(e)))return __PRIVATE_validatePlainObject("Unsupported field value:",t,e),__PRIVATE_parseObject(e,t);if(e instanceof FieldValue)return function(e,t){if(!__PRIVATE_isWrite(t.Tu))throw t.fu(`${e._methodName}
2756() can only be used with update() and set()`);if(!t.path)throw t.fu(`${e._methodName}() is not currently supported inside arrays`);let n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.Au&&4!==t.Tu)throw t.fu("Nested arrays are not supported");return function(e,t){let n=[],i=0;for(let s of e){let e=__PRIVATE_parseData(s,t.mu(i));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),i++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=(0,E.m9)(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e){var n,i,s;return n=t.serializer,"number"==typeof(s=i=e)&&Number.isInteger(s)&&!__PRIVATE_isNegativeZero(s)&&s<=Number.MAX_SAFE_INTEGER&&s>=Number.MIN_SAFE_INTEGER?__PRIVATE_toInteger(i):__PRIVATE_toDouble(n,i)}if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){let n=Timestamp.fromDate(e);return{timestampValue:toTimestamp(t.serializer,n)}}if(e instanceof Timestamp){let n=new Timestamp(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:toTimestamp(t.serializer,n)}}if(e instanceof GeoPoint)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof Bytes)return{bytesValue:__PRIVATE_toBytes(t.serializer,e._byteString)};if(e instanceof DocumentReference){let n=t.databaseId,i=e.firestore._databaseId;if(!i.isEqual(n))throw t.fu(`Document reference is for database ${i.projectId}/${i.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:__PRIVATE_toResourceName(e.firestore._databaseId||t.databaseId,e._key.path)}}throw t.fu(`Unsupported field value: ${__PRIVATE_valueDescription(e)}`)}(e,t)}function __PRIVATE_parseObject(e,t){let n={};return isEmpty(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):forEach(e,(e,i)=>{let s=__PRIVATE_parseData(i,t.du(e));null!=s&&(n[e]=s)}),{mapValue:{fields:n}}}function __PRIVATE_looksLikeJsonObject(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof Timestamp||e instanceof GeoPoint||e instanceof Bytes||e instanceof DocumentReference||e instanceof FieldValue)}function __PRIVATE_validatePlainObject(e,t,n){if(!__PRIVATE_looksLikeJsonObject(n)||!("object"==typeof n&&null!==n&&(Object.getPrototypeOf(n)===Object.prototype||null===Object.getPrototypeOf(n)))){let i=__PRIVATE_valueDescription(n);throw"an object"===i?t.fu(e+" a custom object"):t.fu(e+" "+i)}}function __PRIVATE_fieldPathFromArgument$1(e,t,n){if((t=(0,E.m9)(t))instanceof FieldPath)return t._internalPath;if("string"==typeof t)return __PRIVATE_fieldPathFromDotSeparatedString(e,t);throw __PRIVATE_createError("Field path arguments must be of type string or ",e,!1,void 0,n)}let tT=RegExp("[~\\*/\\[\\]]");function __PRIVATE_fieldPathFromDotSeparatedString(e,t,n){if(t.search(tT)>=0)throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new FieldPath(...t.split("."))._internalPath}catch(i){throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function __PRIVATE_createError(e,t,n,i,s){let o=i&&!i.isEmpty(),l=void 0!==s,u=`Function ${t}() called with invalid data`;n&&(u+=" (via `toFirestore()`)"),u+=". ";let h="";return(o||l)&&(h+=" (found",o&&(h+=` in field ${i}`),l&&(h+=` in document ${s}`),h+=")"),new FirestoreError(tr.INVALID_ARGUMENT,u+e+h)}function __PRIVATE_fieldMaskContains(e,t){return e.some(e=>e.isEqual(t))}/** 2757 * @license 2758 * Copyright 2020 Google LLC 2759 * 2760 * Licensed under the Apache License, Version 2.0 (the "License"); 2761 * you may not use this file except in compliance with the License. 2762 * You may obtain a copy of the License at 2763 * 2764 * http://www.apache.org/licenses/LICENSE-2.0 2765 * 2766 * Unless required by applicable law or agreed to in writing, software 2767 * distributed under the License is distributed on an "AS IS" BASIS, 2768 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2769 * See the License for the specific language governing permissions and 2770 * limitations under the License. 2771 */let DocumentSnapshot$1=class DocumentSnapshot$1{constructor(e,t,n,i,s){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new DocumentReference(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){let e=new QueryDocumentSnapshot$1(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let t=this._document.data.field(__PRIVATE_fieldPathFromArgument("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}};let QueryDocumentSnapshot$1=class QueryDocumentSnapshot$1 extends DocumentSnapshot$1{data(){return super.data()}};function __PRIVATE_fieldPathFromArgument(e,t){return"string"==typeof t?__PRIVATE_fieldPathFromDotSeparatedString(e,t):t instanceof FieldPath?t._internalPath:t._delegate._internalPath}let AppliableConstraint=class AppliableConstraint{};let QueryConstraint=class QueryConstraint extends AppliableConstraint{};function query(e,t,...n){let i=[];for(let s of(t instanceof AppliableConstraint&&i.push(t),function(e){let t=e.filter(e=>e instanceof QueryCompositeFilterConstraint).length,n=e.filter(e=>e instanceof QueryFieldFilterConstraint).length;if(t>1||t>0&&n>0)throw new FirestoreError(tr.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
2771(i=i.concat(n)),i))e=s._apply(e);return e}let QueryFieldFilterConstraint=class QueryFieldFilterConstraint extends QueryConstraint{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new QueryFieldFilterConstraint(e,t,n)}_apply(e){let t=this._parse(e);return __PRIVATE_validateNewFieldFilter(e._query,t),new Query(e.firestore,e.converter,__PRIVATE_queryWithAddedFilter(e._query,t))}_parse(e){let t=__PRIVATE_newUserDataReader(e.firestore),n=function(e,t,n,i,s,o,l){let u;if(s.isKeyField()){if("array-contains"===o||"array-contains-any"===o)throw new FirestoreError(tr.INVALID_ARGUMENT,`Invalid Query. You can't perform '${o}' queries on documentId().`);if("in"===o||"not-in"===o){__PRIVATE_validateDisjunctiveFilterElements(l,o);let t=[];for(let n of l)t.push(__PRIVATE_parseDocumentIdValue(i,e,n));u={arrayValue:{values:t}}}else u=__PRIVATE_parseDocumentIdValue(i,e,l)}else"in"!==o&&"not-in"!==o&&"array-contains-any"!==o||__PRIVATE_validateDisjunctiveFilterElements(l,o),u=function(e,t,n,i=!1){return __PRIVATE_parseData(n,e.yu(i?4:3,t))}(n,t,l,"in"===o||"not-in"===o);return FieldFilter.create(s,o,u)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}};function where(e,t,n){let i=__PRIVATE_fieldPathFromArgument("where",e);return QueryFieldFilterConstraint._create(i,t,n)}let QueryCompositeFilterConstraint=class QueryCompositeFilterConstraint extends AppliableConstraint{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new QueryCompositeFilterConstraint(e,t)}_parse(e){let t=this._queryConstraints.map(t=>t._parse(e)).filter(e=>e.getFilters().length>0);return 1===t.length?t[0]:CompositeFilter.create(t,this._getOperator())}_apply(e){let t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e,i=t.getFlattenedFilters();for(let e of i)__PRIVATE_validateNewFieldFilter(n,e),n=__PRIVATE_queryWithAddedFilter(n,e)}(e._query,t),new Query(e.firestore,e.converter,__PRIVATE_queryWithAddedFilter(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}};let QueryOrderByConstraint=class QueryOrderByConstraint extends QueryConstraint{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new QueryOrderByConstraint(e,t)}_apply(e){let t=function(e,t,n){if(null!==e.startAt)throw new FirestoreError(tr.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==e.endAt)throw new FirestoreError(tr.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new OrderBy(t,n)}(e._query,this._field,this._direction);return new Query(e.firestore,e.converter,function(e,t){let n=e.explicitOrderBy.concat([t]);return new __PRIVATE_QueryImpl(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(e._query,t))}};function orderBy(e,t="asc"){let n=__PRIVATE_fieldPathFromArgument("orderBy",e);return QueryOrderByConstraint._create(n,t)}let QueryLimitConstraint=class QueryLimitConstraint extends QueryConstraint{constructor(e,t,n){super(),this.type=e,this._limit=t,this._limitType=n}static _create(e,t,n){return new QueryLimitConstraint(e,t,n)}_apply(e){return new Query(e.firestore,e.converter,__PRIVATE_queryWithLimit(e._query,this._limit,this._limitType))}};function limit(e){return function(e,t){if(t<=0)throw new FirestoreError(tr.INVALID_ARGUMENT,`Function ${e}() requires a positive number, but it was: ${t}.`)}("limit",e),QueryLimitConstraint._create("limit",e,"F")}function __PRIVATE_parseDocumentIdValue(e,t,n){if("string"==typeof(n=(0,E.m9)(n))){if(""===n)throw new FirestoreError(tr.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!__PRIVATE_isCollectionGroupQuery(t)&&-1!==n.indexOf("/"))throw new FirestoreError(tr.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);let i=t.path.child(ResourcePath.fromString(n));if(!DocumentKey.isDocumentKey(i))throw new FirestoreError(tr.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${i}' is not because it has an odd number of segments (${i.length}).`);return __PRIVATE_refValue(e,new DocumentKey(i))}if(n instanceof DocumentReference)return __PRIVATE_refValue(e,n._key);throw new FirestoreError(tr.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${__PRIVATE_valueDescription(n)}.`)}function __PRIVATE_validateDisjunctiveFilterElements(e,t){if(!Array.isArray(e)||0===e.length)throw new FirestoreError(tr.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function __PRIVATE_validateNewFieldFilter(e,t){let n=function(e,t){for(let n of e)for(let e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new FirestoreError(tr.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new FirestoreError(tr.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}let AbstractUserDataWriter=class AbstractUserDataWriter{convertValue(e,t="none"){switch(__PRIVATE_typeOrder(e)){case 0:return null;case 1:return e.booleanValue;case 2:return __PRIVATE_normalizeNumber(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(__PRIVATE_normalizeByteString(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw fail()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){let n={};return forEach(e,(e,i)=>{n[e]=this.convertValue(i,t)}),n}convertGeoPoint(e){return new GeoPoint(__PRIVATE_normalizeNumber(e.latitude),__PRIVATE_normalizeNumber(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":let n=__PRIVATE_getPreviousValue(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(__PRIVATE_getLocalWriteTime(e));default:return null}}convertTimestamp(e){let t=__PRIVATE_normalizeTimestamp(e);return new Timestamp(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=ResourcePath.fromString(e);__PRIVATE_isValidResourceName(n)||fail();let i=new DatabaseId(n.get(1),n.get(3)),s=new DocumentKey(n.popFirst(5));return i.isEqual(t)||__PRIVATE_logError(`Document ${s} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),s}};/** 2772 * @license 2773 * Copyright 2020 Google LLC 2774 * 2775 * Licensed under the Apache License, Version 2.0 (the "License");
2776 * you may not use this file except in compliance with the License. 2777 * You may obtain a copy of the License at 2778 * 2779 * http://www.apache.org/licenses/LICENSE-2.0 2780 * 2781 * Unless required by applicable law or agreed to in writing, software 2782 * distributed under the License is distributed on an "AS IS" BASIS, 2783 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2784 * See the License for the specific language governing permissions and 2785 * limitations under the License. 2786 */function __PRIVATE_applyFirestoreDataConverter(e,t,n){return e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t}/** 2787 * @license 2788 * Copyright 2020 Google LLC 2789 * 2790 * Licensed under the Apache License, Version 2.0 (the "License"); 2791 * you may not use this file except in compliance with the License. 2792 * You may obtain a copy of the License at 2793 * 2794 * http://www.apache.org/licenses/LICENSE-2.0 2795 * 2796 * Unless required by applicable law or agreed to in writing, software 2797 * distributed under the License is distributed on an "AS IS" BASIS, 2798 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2799 * See the License for the specific language governing permissions and 2800 * limitations under the License. 2801 */let SnapshotMetadata=class SnapshotMetadata{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}};let DocumentSnapshot=class DocumentSnapshot extends DocumentSnapshot$1{constructor(e,t,n,i,s,o){super(e,t,n,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new QueryDocumentSnapshot(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){let n=this._document.data.field(__PRIVATE_fieldPathFromArgument("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}};let QueryDocumentSnapshot=class QueryDocumentSnapshot extends DocumentSnapshot{data(e={}){return super.data(e)}};let QuerySnapshot=class QuerySnapshot{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new SnapshotMetadata(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){let e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach(n=>{e.call(t,new QueryDocumentSnapshot(this._firestore,this._userDataWriter,n.key,n,new SnapshotMetadata(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new FirestoreError(tr.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(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map(n=>{let i=new QueryDocumentSnapshot(e._firestore,e._userDataWriter,n.doc.key,n.doc,new SnapshotMetadata(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{let i=new QueryDocumentSnapshot(e._firestore,e._userDataWriter,t.doc.key,t.doc,new SnapshotMetadata(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),s=-1,o=-1;return 0!==t.type&&(s=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(o=(n=n.add(t.doc)).indexOf(t.doc.key)),{type:function(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return fail()}}(t.type),doc:i,oldIndex:s,newIndex:o}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}};let __PRIVATE_ExpUserDataWriter=class __PRIVATE_ExpUserDataWriter extends AbstractUserDataWriter{constructor(e){super(),this.firestore=e}convertBytes(e){return new Bytes(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);
2801return new DocumentReference(this.firestore,null,t)}};function getDocs(e){e=__PRIVATE_cast(e,Query);let t=__PRIVATE_cast(e.firestore,Firestore),n=ensureFirestoreConfigured(t),i=new __PRIVATE_ExpUserDataWriter(t);return(/** 2802 * @license 2803 * Copyright 2020 Google LLC 2804 * 2805 * Licensed under the Apache License, Version 2.0 (the "License"); 2806 * you may not use this file except in compliance with the License. 2807 * You may obtain a copy of the License at 2808 * 2809 * http://www.apache.org/licenses/LICENSE-2.0 2810 * 2811 * Unless required by applicable law or agreed to in writing, software 2812 * distributed under the License is distributed on an "AS IS" BASIS, 2813 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2814 * See the License for the specific language governing permissions and 2815 * limitations under the License. 2816 */function(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new FirestoreError(tr.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}(e._query),(function(e,t,n={}){let i=new __PRIVATE_Deferred;return e.asyncQueue.enqueueAndForget(async()=>(function(e,t,n,i,s){let o=new __PRIVATE_AsyncObserver({next:n=>{t.enqueueAndForget(()=>__PRIVATE_eventManagerUnlisten(e,l)),n.fromCache&&"server"===i.source?s.reject(new FirestoreError(tr.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.)')):s.resolve(n)},error:e=>s.reject(e)}),l=new __PRIVATE_QueryListener(n,o,{includeMetadataChanges:!0,Y_:!0});return __PRIVATE_eventManagerListen(e,l)})(await __PRIVATE_getEventManager(e),e.asyncQueue,t,n,i)),i.promise})(n,e._query).then(n=>new QuerySnapshot(t,i,e,n)))}function setDoc(e,t,n){e=__PRIVATE_cast(e,DocumentReference);let i=__PRIVATE_cast(e.firestore,Firestore),s=__PRIVATE_applyFirestoreDataConverter(e.converter,t,n);return executeWrite(i,[__PRIVATE_parseSetData(__PRIVATE_newUserDataReader(i),"setDoc",e._key,s,null!==e.converter,n).toMutation(e._key,Precondition.none())])}function updateDoc(e,t,n,...i){e=__PRIVATE_cast(e,DocumentReference);let s=__PRIVATE_cast(e.firestore,Firestore),o=__PRIVATE_newUserDataReader(s);return executeWrite(s,[("string"==typeof(t=(0,E.m9)(t))||t instanceof FieldPath?function(e,t,n,i,s,o){let l=e.yu(1,t,n),u=[__PRIVATE_fieldPathFromArgument$1(t,i,n)],h=[s];if(o.length%2!=0)throw new FirestoreError(tr.INVALID_ARGUMENT,`Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let e=0;e<o.length;e+=2)u.push(__PRIVATE_fieldPathFromArgument$1(t,o[e])),h.push(o[e+1]);let d=[],_=ObjectValue.empty();for(let e=u.length-1;e>=0;--e)if(!__PRIVATE_fieldMaskContains(d,u[e])){let t=u[e],n=h[e];n=(0,E.m9)(n);let i=l.Vu(t);if(n instanceof __PRIVATE_DeleteFieldValueImpl)d.push(t);else{let e=__PRIVATE_parseData(n,i);null!=e&&(d.push(t),_.set(t,e))}}let m=new FieldMask(d);return new ParsedUpdateData(_,m,l.fieldTransforms)}(o,"updateDoc",e._key,t,n,i):function(e,t,n,i){let s=e.yu(1,t,n);__PRIVATE_validatePlainObject("Data must be an object, but it was:",s,i);let o=[],l=ObjectValue.empty();forEach(i,(e,i)=>{let u=__PRIVATE_fieldPathFromDotSeparatedString(t,e,n);i=(0,E.m9)(i);let h=s.Vu(u);if(i instanceof __PRIVATE_DeleteFieldValueImpl)o.push(u);else{let e=__PRIVATE_parseData(i,h);null!=e&&(o.push(u),l.set(u,e))}});let u=new FieldMask(o);return new ParsedUpdateData(l,u,s.fieldTransforms)}(o,"updateDoc",e._key,t)).toMutation(e._key,Precondition.exists(!0))])}function deleteDoc(e){return executeWrite(__PRIVATE_cast(e.firestore,Firestore),[new __PRIVATE_DeleteMutation(e._key,Precondition.none())])}function addDoc(e,t){let n=__PRIVATE_cast(e.firestore,Firestore),i=doc(e),s=__PRIVATE_applyFirestoreDataConverter(e.converter,t);return executeWrite(n,[__PRIVATE_parseSetData(__PRIVATE_newUserDataReader(e.firestore),"addDoc",i._key,s,null!==e.converter,{}).toMutation(i._key,Precondition.exists(!1))]).then(()=>i)}function executeWrite(e,t){return function(e,t){let n=new __PRIVATE_Deferred;return e.asyncQueue.enqueueAndForget(async()=>__PRIVATE_syncEngineWrite(await __PRIVATE_ensureOnlineComponents(e).then(e=>e.syncEngine),t,n)),n.promise}(ensureFirestoreConfigured(e),t)}new WeakMap,function(e=!0){te=_.Jn,(0,_.Xd)(new m.wA("firestore",(t,{instanceIdentifier:n,options:i})=>{let s=t.getProvider("app").getImmediate(),o=new Firestore(new __PRIVATE_FirebaseAuthCredentialsProvider(t.getProvider("auth-internal")),new __PRIVATE_FirebaseAppCheckTokenProvider(t.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new FirestoreError(tr.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new DatabaseId(e.options.projectId,t)}(s,n),s);return i=Object.assign({useFetchStreams:e},i),o._setSettings(i),o},"PUBLIC").setMultipleInstances(!0)),(0,_.KN)(e8,"4.3.0",void 0),(0,_.KN)(e8,"4.3.0","esm2017")}()}},function(e){var __webpack_exec__=function(t){return e(e.s=t)};e.O(0,[774,179],function(){return __webpack_exec__(1118),__webpack_exec__(9974)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.