pwa-auth 3.3.9 → 3.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/LICENSES.txt +27 -27
  2. package/README.md +6 -6
  3. package/base/export/pwa-auth.d.ts +7 -7
  4. package/base/export/pwa-auth.js +7 -7
  5. package/base/firebase/authentication.d.ts +10 -10
  6. package/base/firebase/authentication.js +10 -10
  7. package/base/firebase/interface.d.ts +5 -5
  8. package/base/firebase/interface.js +80 -80
  9. package/base/firebase/interface.js.map +1 -1
  10. package/base/lazy-loader.d.ts +11 -11
  11. package/base/lazy-loader.js +22 -22
  12. package/base/lazy-loader.js.map +1 -1
  13. package/base/redux/backend.d.ts +113 -122
  14. package/base/redux/backend.js +43 -43
  15. package/base/redux/drawer.d.ts +17 -19
  16. package/base/redux/drawer.js +21 -21
  17. package/base/redux/drawer.js.map +1 -1
  18. package/base/redux/frontend.d.ts +185 -198
  19. package/base/redux/frontend.js +86 -86
  20. package/base/redux/frontend.js.map +1 -1
  21. package/base/store.d.ts +62 -62
  22. package/base/store.js +13 -13
  23. package/base/webcomponents/css/animation.d.ts +2 -2
  24. package/base/webcomponents/css/animation.js +2 -2
  25. package/base/webcomponents/css/svg.d.ts +3 -3
  26. package/base/webcomponents/css/svg.js +4 -4
  27. package/base/webcomponents/css/toggle.d.ts +1 -1
  28. package/base/webcomponents/css/toggle.js +2 -2
  29. package/base/webcomponents/drawer/css/drawer.d.ts +2 -2
  30. package/base/webcomponents/drawer/css/drawer.js +2 -2
  31. package/base/webcomponents/drawer/css/exit.d.ts +2 -2
  32. package/base/webcomponents/drawer/css/exit.js +2 -2
  33. package/base/webcomponents/drawer/css/link.d.ts +2 -2
  34. package/base/webcomponents/drawer/css/link.js +2 -2
  35. package/base/webcomponents/drawer/css/paragraph.d.ts +2 -2
  36. package/base/webcomponents/drawer/css/paragraph.js +2 -2
  37. package/base/webcomponents/drawer/drawer.d.ts +58 -58
  38. package/base/webcomponents/drawer/drawer.js +100 -100
  39. package/base/webcomponents/drawer/drawer.js.map +1 -1
  40. package/base/webcomponents/form/css/button.d.ts +2 -2
  41. package/base/webcomponents/form/css/button.js +2 -2
  42. package/base/webcomponents/form/css/input.d.ts +2 -2
  43. package/base/webcomponents/form/css/input.js +2 -2
  44. package/base/webcomponents/form/css/label.d.ts +2 -2
  45. package/base/webcomponents/form/css/label.js +2 -2
  46. package/base/webcomponents/form/css/list.d.ts +2 -2
  47. package/base/webcomponents/form/css/list.js +2 -2
  48. package/base/webcomponents/form/css/toggle.d.ts +2 -2
  49. package/base/webcomponents/form/css/toggle.js +2 -2
  50. package/base/webcomponents/form/forgot.d.ts +15 -15
  51. package/base/webcomponents/form/forgot.js +45 -45
  52. package/base/webcomponents/form/forgot.js.map +1 -1
  53. package/base/webcomponents/form/login.d.ts +20 -20
  54. package/base/webcomponents/form/login.js +88 -88
  55. package/base/webcomponents/form/login.js.map +1 -1
  56. package/base/webcomponents/form/signup.d.ts +20 -20
  57. package/base/webcomponents/form/signup.js +95 -95
  58. package/base/webcomponents/form/signup.js.map +1 -1
  59. package/base/webcomponents/icon/css/icon.d.ts +1 -1
  60. package/base/webcomponents/icon/css/icon.js +3 -3
  61. package/base/webcomponents/icon/icon.d.ts +54 -54
  62. package/base/webcomponents/icon/icon.js +59 -59
  63. package/base/webcomponents/icon/icon.js.map +1 -1
  64. package/base/webcomponents/login/css/auth.d.ts +2 -2
  65. package/base/webcomponents/login/css/auth.js +2 -2
  66. package/base/webcomponents/login/css/link.d.ts +2 -2
  67. package/base/webcomponents/login/css/link.js +2 -2
  68. package/base/webcomponents/login/css/paragraph.d.ts +2 -2
  69. package/base/webcomponents/login/css/paragraph.js +2 -2
  70. package/base/webcomponents/login/page.d.ts +55 -55
  71. package/base/webcomponents/login/page.js +71 -71
  72. package/base/webcomponents/login/page.js.map +1 -1
  73. package/base/webcomponents/settings/css/navigation.d.ts +1 -1
  74. package/base/webcomponents/settings/css/navigation.js +2 -2
  75. package/base/webcomponents/settings/input/delete.d.ts +55 -55
  76. package/base/webcomponents/settings/input/delete.js +73 -73
  77. package/base/webcomponents/settings/input/delete.js.map +1 -1
  78. package/base/webcomponents/settings/input/email.d.ts +55 -55
  79. package/base/webcomponents/settings/input/email.js +72 -72
  80. package/base/webcomponents/settings/input/email.js.map +1 -1
  81. package/base/webcomponents/settings/input/name.d.ts +54 -54
  82. package/base/webcomponents/settings/input/name.js +67 -67
  83. package/base/webcomponents/settings/input/name.js.map +1 -1
  84. package/base/webcomponents/settings/input/password.d.ts +57 -57
  85. package/base/webcomponents/settings/input/password.js +97 -97
  86. package/base/webcomponents/settings/input/password.js.map +1 -1
  87. package/base/webcomponents/settings/input/uploader.d.ts +58 -58
  88. package/base/webcomponents/settings/input/uploader.js +150 -150
  89. package/base/webcomponents/settings/input/uploader.js.map +1 -1
  90. package/base/webcomponents/settings/settings.d.ts +58 -58
  91. package/base/webcomponents/settings/settings.js +80 -80
  92. package/base/webcomponents/settings/settings.js.map +1 -1
  93. package/package.json +8 -8
  94. package/source/pwa-auth.js +83 -64
@@ -4,7 +4,7 @@
4
4
  * Licensed under MIT
5
5
  */
6
6
 
7
- const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),i=new WeakMap;let r=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const n=this.t;if(t&&void 0===e){const t=void 0!==n&&1===n.length;t&&(e=i.get(n)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&i.set(n,e))}return e}toString(){return this.cssText}};const s=(e,...t)=>{const i=1===e.length?e[0]:t.reduce((t,n,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[i+1],e[0]);return new r(i,e,n)},o=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new r("string"==typeof e?e:e+"",void 0,n))(t)})(e):e,{is:a,defineProperty:c,getOwnPropertyDescriptor:h,getOwnPropertyNames:l,getOwnPropertySymbols:u,getPrototypeOf:d}=Object,p=globalThis,f=p.trustedTypes,g=f?f.emptyScript:"",m=p.reactiveElementPolyfillSupport,y=(e,t)=>e,_={toAttribute(e,t){switch(t){case Boolean:e=e?g:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},w=(e,t)=>!a(e,t),b={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let v=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=b){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);void 0!==i&&c(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:r}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const s=i?.call(this);r?.call(this,t),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??b}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const e=d(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const e=this.properties,t=[...l(e),...u(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(o(e))}else void 0!==e&&t.push(o(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((n,i)=>{if(t)n.adoptedStyleSheets=i.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const t of i){const i=document.createElement("style"),r=e.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=t.cssText,n.appendChild(i)}})(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==n.converter?.toAttribute?n.converter:_).toAttribute(t,n.type);this._$Em=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=n.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:_;this._$Em=i;const s=r.fromAttribute(t,e.type);this[i]=s??this._$Ej?.get(i)??s,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const i=this.constructor,r=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??w)(r,t)||n.useDefault&&n.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:r},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==r||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,n,i)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};v.elementStyles=[],v.shadowRootOptions={mode:"open"},v[y("elementProperties")]=new Map,v[y("finalized")]=new Map,m?.({ReactiveElement:v}),(p.reactiveElementVersions??=[]).push("2.1.1");const T=globalThis,E=T.trustedTypes,I=E?E.createPolicy("lit-html",{createHTML:e=>e}):void 0,S="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+k,A=`<${C}>`,P=document,R=()=>P.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,x=Array.isArray,N="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,U=/>/g,M=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,$=/"/g,F=/^(?:script|style|textarea|title)$/i,B=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),z=Symbol.for("lit-noChange"),H=Symbol.for("lit-nothing"),V=new WeakMap,q=P.createTreeWalker(P,129);function W(e,t){if(!x(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==I?I.createHTML(t):t}const K=(e,t)=>{const n=e.length-1,i=[];let r,s=2===t?"<svg>":3===t?"<math>":"",o=D;for(let t=0;t<n;t++){const n=e[t];let a,c,h=-1,l=0;for(;l<n.length&&(o.lastIndex=l,c=o.exec(n),null!==c);)l=o.lastIndex,o===D?"!--"===c[1]?o=L:void 0!==c[1]?o=U:void 0!==c[2]?(F.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=M):void 0!==c[3]&&(o=M):o===M?">"===c[0]?(o=r??D,h=-1):void 0===c[1]?h=-2:(h=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?M:'"'===c[3]?$:j):o===$||o===j?o=M:o===L||o===U?o=D:(o=M,r=void 0);const u=o===M&&e[t+1].startsWith("/>")?" ":"";s+=o===D?n+A:h>=0?(i.push(a),n.slice(0,h)+S+n.slice(h)+k+u):n+k+(-2===h?t:u)}return[W(e,s+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};let G=class e{constructor({strings:t,_$litType$:n},i){let r;this.parts=[];let s=0,o=0;const a=t.length-1,c=this.parts,[h,l]=K(t,n);if(this.el=e.createElement(h,i),q.currentNode=this.el.content,2===n||3===n){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(r=q.nextNode())&&c.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const e of r.getAttributeNames())if(e.endsWith(S)){const t=l[o++],n=r.getAttribute(e).split(k),i=/([.?@])?(.*)/.exec(t);c.push({type:1,index:s,name:i[2],strings:n,ctor:"."===i[1]?Q:"?"===i[1]?ee:"@"===i[1]?te:Z}),r.removeAttribute(e)}else e.startsWith(k)&&(c.push({type:6,index:s}),r.removeAttribute(e));if(F.test(r.tagName)){const e=r.textContent.split(k),t=e.length-1;if(t>0){r.textContent=E?E.emptyScript:"";for(let n=0;n<t;n++)r.append(e[n],R()),q.nextNode(),c.push({type:2,index:++s});r.append(e[t],R())}}}else if(8===r.nodeType)if(r.data===C)c.push({type:2,index:s});else{let e=-1;for(;-1!==(e=r.data.indexOf(k,e+1));)c.push({type:7,index:s}),e+=k.length-1}s++}}static createElement(e,t){const n=P.createElement("template");return n.innerHTML=e,n}};function J(e,t,n=e,i){if(t===z)return t;let r=void 0!==i?n._$Co?.[i]:n._$Cl;const s=O(t)?void 0:t._$litDirective$;return r?.constructor!==s&&(r?._$AO?.(!1),void 0===s?r=void 0:(r=new s(e),r._$AT(e,n,i)),void 0!==i?(n._$Co??=[])[i]=r:n._$Cl=r),void 0!==r&&(t=J(e,r._$AS(e,t.values),r,i)),t}let X=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??P).importNode(t,!0);q.currentNode=i;let r=q.nextNode(),s=0,o=0,a=n[0];for(;void 0!==a;){if(s===a.index){let t;2===a.type?t=new Y(r,r.nextSibling,this,e):1===a.type?t=new a.ctor(r,a.name,a.strings,this,e):6===a.type&&(t=new ne(r,this,e)),this._$AV.push(t),a=n[++o]}s!==a?.index&&(r=q.nextNode(),s++)}return q.currentNode=P,i}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}};class Y{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=H,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=J(this,e,t),O(e)?e===H||null==e||""===e?(this._$AH!==H&&this._$AR(),this._$AH=H):e!==this._$AH&&e!==z&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>x(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==H&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(P.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=G.createElement(W(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new X(i,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=V.get(e.strings);return void 0===t&&V.set(e.strings,t=new G(e)),t}k(e){x(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new Y(this.O(R()),this.O(R()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}let Z=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,r){this.type=1,this._$AH=H,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=H}_$AI(e,t=this,n,i){const r=this.strings;let s=!1;if(void 0===r)e=J(this,e,t,0),s=!O(e)||e!==this._$AH&&e!==z,s&&(this._$AH=e);else{const i=e;let o,a;for(e=r[0],o=0;o<r.length-1;o++)a=J(this,i[n+o],t,o),a===z&&(a=this._$AH[o]),s||=!O(a)||a!==this._$AH[o],a===H?e=H:e!==H&&(e+=(a??"")+r[o+1]),this._$AH[o]=a}s&&!i&&this.j(e)}j(e){e===H?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}};class Q extends Z{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===H?void 0:e}}class ee extends Z{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==H)}}let te=class extends Z{constructor(e,t,n,i,r){super(e,t,n,i,r),this.type=5}_$AI(e,t=this){if((e=J(this,e,t,0)??H)===z)return;const n=this._$AH,i=e===H&&n!==H||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==H&&(n===H||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}};class ne{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){J(this,e)}}const ie=T.litHtmlPolyfillSupport;ie?.(G,Y),(T.litHtmlVersions??=[]).push("3.3.1");const re=globalThis;class se extends v{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const i=n?.renderBefore??t;let r=i._$litPart$;if(void 0===r){const e=n?.renderBefore??null;i._$litPart$=r=new Y(t.insertBefore(R(),e),e,void 0,n??{})}return r._$AI(e),r})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return z}}se._$litElement$=!0,se.finalized=!0,re.litElementHydrateSupport?.({LitElement:se});const oe=re.litElementPolyfillSupport;oe?.({LitElement:se}),(re.litElementVersions??=[]).push("4.2.1");const ae=e=>(t,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},ce={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:w},he=(e=ce,t,n)=>{const{kind:i,metadata:r}=n;let s=globalThis.litPropertyMetadata.get(r);if(void 0===s&&globalThis.litPropertyMetadata.set(r,s=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),s.set(n.name,e),"accessor"===i){const{name:i}=n;return{set(n){const r=t.get.call(this);t.set.call(this,n),this.requestUpdate(i,r,e)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=n;return function(n){const r=this[i];t.call(this,n),this.requestUpdate(i,r,e)}}throw Error("Unsupported decorator location: "+i)};function le(e){return(t,n)=>"object"==typeof n?he(e,t,n):((e,t,n)=>{const i=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),i?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function ue(e){return le({...e,state:!0,attribute:!1})}const de=e=>t=>class extends t{connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=e.subscribe(()=>this.stateChanged(e.getState())),this.stateChanged(e.getState())}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}stateChanged(e){}};function pe(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var fe=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),ge=()=>Math.random().toString(36).substring(7).split("").join("."),me={INIT:`@@redux/INIT${ge()}`,REPLACE:`@@redux/REPLACE${ge()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ge()}`};function ye(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function _e(e,t,n){if("function"!=typeof e)throw new Error(pe(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(pe(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(pe(1));return n(_e)(e,t)}let i=e,r=t,s=new Map,o=s,a=0,c=!1;function h(){o===s&&(o=new Map,s.forEach((e,t)=>{o.set(t,e)}))}function l(){if(c)throw new Error(pe(3));return r}function u(e){if("function"!=typeof e)throw new Error(pe(4));if(c)throw new Error(pe(5));let t=!0;h();const n=a++;return o.set(n,e),function(){if(t){if(c)throw new Error(pe(6));t=!1,h(),o.delete(n),s=null}}}function d(e){if(!ye(e))throw new Error(pe(7));if(void 0===e.type)throw new Error(pe(8));if("string"!=typeof e.type)throw new Error(pe(17));if(c)throw new Error(pe(9));try{c=!0,r=i(r,e)}finally{c=!1}return(s=o).forEach(e=>{e()}),e}d({type:me.INIT});return{dispatch:d,subscribe:u,getState:l,replaceReducer:function(e){if("function"!=typeof e)throw new Error(pe(10));i=e,d({type:me.REPLACE})},[fe]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(pe(11));function n(){const e=t;e.next&&e.next(l())}n();return{unsubscribe:e(n)}},[fe](){return this}}}}}function we(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const r=t[i];"function"==typeof e[r]&&(n[r]=e[r])}const i=Object.keys(n);let r;try{!function(e){Object.keys(e).forEach(t=>{const n=e[t];if(void 0===n(void 0,{type:me.INIT}))throw new Error(pe(12));if(void 0===n(void 0,{type:me.PROBE_UNKNOWN_ACTION()}))throw new Error(pe(13))})}(n)}catch(e){r=e}return function(e={},t){if(r)throw r;let s=!1;const o={};for(let r=0;r<i.length;r++){const a=i[r],c=n[a],h=e[a],l=c(h,t);if(void 0===l)throw t&&t.type,new Error(pe(14));o[a]=l,s=s||l!==h}return s=s||i.length!==Object.keys(e).length,s?o:e}}function be(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}var ve=Symbol.for("immer-nothing"),Te=Symbol.for("immer-draftable"),Ee=Symbol.for("immer-state");function Ie(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Se=Object.getPrototypeOf;function ke(e){return!!e&&!!e[Ee]}function Ce(e){return!!e&&(Re(e)||Array.isArray(e)||!!e[Te]||!!e.constructor?.[Te]||Le(e)||Ue(e))}var Ae=Object.prototype.constructor.toString(),Pe=new WeakMap;function Re(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let i=Pe.get(n);return void 0===i&&(i=Function.toString.call(n),Pe.set(n,i)),i===Ae}function Oe(e,t,n=!0){if(0===xe(e)){(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)})}else e.forEach((n,i)=>t(i,n,e))}function xe(e){const t=e[Ee];return t?t.type_:Array.isArray(e)?1:Le(e)?2:Ue(e)?3:0}function Ne(e,t){return 2===xe(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function De(e,t,n){const i=xe(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function Le(e){return e instanceof Map}function Ue(e){return e instanceof Set}function Me(e){return e.copy_||e.base_}function je(e,t){if(Le(e))return new Map(e);if(Ue(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Re(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[Ee];let n=Reflect.ownKeys(t);for(let i=0;i<n.length;i++){const r=n[i],s=t[r];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(t[r]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[r]})}return Object.create(Se(e),t)}{const t=Se(e);if(null!==t&&n)return{...e};const i=Object.create(t);return Object.assign(i,e)}}function $e(e,t=!1){return Be(e)||ke(e)||!Ce(e)||(xe(e)>1&&Object.defineProperties(e,{set:Fe,add:Fe,clear:Fe,delete:Fe}),Object.freeze(e),t&&Object.values(e).forEach(e=>$e(e,!0))),e}var Fe={value:function(){Ie(2)}};function Be(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var ze,He={};function Ve(e){const t=He[e];return t||Ie(0),t}function qe(){return ze}function We(e,t){t&&(Ve("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ke(e){Ge(e),e.drafts_.forEach(Xe),e.drafts_=null}function Ge(e){e===ze&&(ze=e.parent_)}function Je(e){return ze={drafts_:[],parent_:ze,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Xe(e){const t=e[Ee];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ye(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Ee].modified_&&(Ke(t),Ie(4)),Ce(e)&&(e=Ze(t,e),t.parent_||et(t,e)),t.patches_&&Ve("Patches").generateReplacementPatches_(n[Ee].base_,e,t.patches_,t.inversePatches_)):e=Ze(t,n,[]),Ke(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ve?e:void 0}function Ze(e,t,n){if(Be(t))return t;const i=e.immer_.shouldUseStrictIteration(),r=t[Ee];if(!r)return Oe(t,(i,s)=>Qe(e,r,t,i,s,n),i),t;if(r.scope_!==e)return t;if(!r.modified_)return et(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let s=t,o=!1;3===r.type_&&(s=new Set(t),t.clear(),o=!0),Oe(s,(i,s)=>Qe(e,r,t,i,s,n,o),i),et(e,t,!1),n&&e.patches_&&Ve("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Qe(e,t,n,i,r,s,o){if(null==r)return;if("object"!=typeof r&&!o)return;const a=Be(r);if(!a||o){if(ke(r)){const o=Ze(e,r,s&&t&&3!==t.type_&&!Ne(t.assigned_,i)?s.concat(i):void 0);if(De(n,i,o),!ke(o))return;e.canAutoFreeze_=!1}else o&&n.add(r);if(Ce(r)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;if(t&&t.base_&&t.base_[i]===r&&a)return;Ze(e,r),t&&t.scope_.parent_||"symbol"==typeof i||!(Le(n)?n.has(i):Object.prototype.propertyIsEnumerable.call(n,i))||et(e,r)}}}function et(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&$e(t,n)}var tt={get(e,t){if(t===Ee)return e;const n=Me(e);if(!Ne(n,t))return function(e,t,n){const i=rt(t,n);return i?"value"in i?i.value:i.get?.call(e.draft_):void 0}(e,n,t);const i=n[t];return e.finalized_||!Ce(i)?i:i===it(e.base_,t)?(ot(e),e.copy_[t]=at(i,e)):i},has:(e,t)=>t in Me(e),ownKeys:e=>Reflect.ownKeys(Me(e)),set(e,t,n){const i=rt(Me(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=it(Me(e),t),r=i?.[Ee];if(r&&r.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,i)&&(void 0!==n||Ne(e.base_,t)))return!0;ot(e),st(e)}return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==it(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ot(e),st(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Me(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){Ie(11)},getPrototypeOf:e=>Se(e.base_),setPrototypeOf(){Ie(12)}},nt={};function it(e,t){const n=e[Ee];return(n?Me(n):e)[t]}function rt(e,t){if(!(t in e))return;let n=Se(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Se(n)}}function st(e){e.modified_||(e.modified_=!0,e.parent_&&st(e.parent_))}function ot(e){e.copy_||(e.copy_=je(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Oe(tt,(e,t)=>{nt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),nt.deleteProperty=function(e,t){return nt.set.call(this,e,t,void 0)},nt.set=function(e,t,n){return tt.set.call(this,e[0],t,n,e[0])};function at(e,t){const n=Le(e)?Ve("MapSet").proxyMap_(e,t):Ue(e)?Ve("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:qe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,s=tt;n&&(r=[i],s=nt);const{revoke:o,proxy:a}=Proxy.revocable(r,s);return i.draft_=a,i.revoke_=o,a}(e,t);return(t?t.scope_:qe()).drafts_.push(n),n}function ct(e){if(!Ce(e)||Be(e))return e;const t=e[Ee];let n,i=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=je(e,t.scope_.immer_.useStrictShallowCopy_),i=t.scope_.immer_.shouldUseStrictIteration()}else n=je(e,!0);return Oe(n,(e,t)=>{De(n,e,ct(t))},i),t&&(t.finalized_=!1),n}var ht=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const i=this;return function(e=n,...r){return i.produce(e,e=>t.call(this,e,...r))}}let i;if("function"!=typeof t&&Ie(6),void 0!==n&&"function"!=typeof n&&Ie(7),Ce(e)){const r=Je(this),s=at(e,void 0);let o=!0;try{i=t(s),o=!1}finally{o?Ke(r):Ge(r)}return We(r,n),Ye(i,r)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===ve&&(i=void 0),this.autoFreeze_&&$e(i,!0),n){const t=[],r=[];Ve("Patches").generateReplacementPatches_(e,i,t,r),n(t,r)}return i}Ie(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,i;const r=this.produce(e,t,(e,t)=>{n=e,i=t});return[r,n,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ce(e)||Ie(8),ke(e)&&(e=function(e){ke(e)||Ie(10);return ct(e)}(e));const t=Je(this),n=at(e,void 0);return n[Ee].isManual_=!0,Ge(t),n}finishDraft(e,t){const n=e&&e[Ee];n&&n.isManual_||Ie(9);const{scope_:i}=n;return We(i,t),Ye(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));const i=Ve("Patches").applyPatches_;return ke(e)?i(e,t):this.produce(e,e=>i(e,t))}},lt=ht.produce,ut=ht.setUseStrictIteration.bind(ht);function dt(e){return({dispatch:t,getState:n})=>i=>r=>"function"==typeof r?r(t,n,e):i(r)}var pt=dt(),ft=dt,gt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?be:be.apply(null,arguments)};function mt(e,t){function n(...n){if(t){let i=t(...n);if(!i)throw new Error(Pt(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>function(e){return ye(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var yt=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function _t(e){return Ce(e)?lt(e,()=>{}):e}function wt(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var bt=e=>t=>{setTimeout(t,e)},vt=e=>function(t){const{autoBatch:n=!0}=t??{};let i=new yt(e);return n&&i.push(((e={type:"raf"})=>t=>(...n)=>{const i=t(...n);let r=!0,s=!1,o=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:bt(10):"callback"===e.type?e.queueNotification:bt(e.timeout),h=()=>{o=!1,s&&(s=!1,a.forEach(e=>e()))};return Object.assign({},i,{subscribe(e){const t=i.subscribe(()=>r&&e());return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,s=!r,s&&(o||(o=!0,c(h))),i.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),i};function Tt(e){const t={},n=[];let i;const r={addCase(e,n){const i="string"==typeof e?e:e.type;if(!i)throw new Error(Pt(28));if(i in t)throw new Error(Pt(29));return t[i]=n,r},addAsyncThunk:(e,i)=>(i.pending&&(t[e.pending.type]=i.pending),i.rejected&&(t[e.rejected.type]=i.rejected),i.fulfilled&&(t[e.fulfilled.type]=i.fulfilled),i.settled&&n.push({matcher:e.settled,reducer:i.settled}),r),addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),r),addDefaultCase:e=>(i=e,r)};return e(r),[t,n,i]}ut(!1);var Et=Symbol.for("rtk-slice-createasyncthunk");function It(e,t){return`${e}/${t}`}function St({creators:e}={}){const t=e?.asyncThunk?.[Et];return function(e){const{name:n,reducerPath:i=n}=e;if(!n)throw new Error(Pt(11));const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},s=Object.keys(r),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(Pt(12));if(n in o.sliceCaseReducersByType)throw new Error(Pt(13));return o.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(o.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(o.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(o.sliceCaseReducersByName[e]=t,a)};function c(){const[t={},n=[],i]="function"==typeof e.extraReducers?Tt(e.extraReducers):[e.extraReducers],r={...t,...o.sliceCaseReducersByType};return function(e,t){let n,[i,r,s]=Tt(t);if(function(e){return"function"==typeof e}(e))n=()=>_t(e());else{const t=_t(e);n=()=>t}function o(e=n(),t){let o=[i[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===o.filter(e=>!!e).length&&(o=[s]),o.reduce((e,n)=>{if(n){if(ke(e)){const i=n(e,t);return void 0===i?e:i}if(Ce(e))return lt(e,e=>n(e,t));{const i=n(e,t);if(void 0===i){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}}return e},e)}return o.getInitialState=n,o}(e.initialState,e=>{for(let t in r)e.addCase(t,r[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);i&&e.addDefaultCase(i)})}s.forEach(i=>{const s=r[i],o={reducerName:i,type:It(n,i),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(s)?function({type:e,reducerName:t,createNotation:n},i,r){let s,o;if("reducer"in i){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(i))throw new Error(Pt(17));s=i.reducer,o=i.prepare}else s=i;r.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?mt(e,o):mt(e))}(o,s,a):function({type:e,reducerName:t},n,i,r){if(!r)throw new Error(Pt(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:c,settled:h,options:l}=n,u=r(e,s,l);i.exposeAction(t,u),o&&i.addCase(u.fulfilled,o);a&&i.addCase(u.pending,a);c&&i.addCase(u.rejected,c);h&&i.addMatcher(u.settled,h);i.exposeCaseReducer(t,{fulfilled:o||At,pending:a||At,rejected:c||At,settled:h||At})}(o,s,a,t)});const h=e=>e,l=new Map,u=new WeakMap;let d;function p(e,t){return d||(d=c()),d(e,t)}function f(){return d||(d=c()),d.getInitialState()}function g(t,n=!1){function i(e){let r=e[t];return void 0===r&&n&&(r=wt(u,i,f)),r}function r(t=h){const i=wt(l,n,()=>new WeakMap);return wt(i,t,()=>{const i={};for(const[r,s]of Object.entries(e.selectors??{}))i[r]=kt(s,t,()=>wt(u,t,f),n);return i})}return{reducerPath:t,getSelectors:r,get selectors(){return r(i)},selectSlice:i}}const m={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:f,...g(i),injectInto(e,{reducerPath:t,...n}={}){const r=t??i;return e.inject({reducerPath:r,reducer:p},n),{...m,...g(r,!0)}}};return m}}function kt(e,t,n,i){function r(r,...s){let o=t(r);return void 0===o&&i&&(o=n()),e(o,...s)}return r.unwrapped=e,r}var Ct=St();function At(){}function Pt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const Rt=Ct({name:"user",initialState:{settings:"profile",login:!1,drawer:!1,registerOne:!1,registerTwo:!1,userId:"user",customer:"John Doe",profileChoice:"unChosen",name:"Modern Business",photoURL:"",phone:"(...) ... - ....",email:""},reducers:{navigateAuth:(e,t)=>{switch(t.payload){case"profile":case"verification":case"password":case"delete":break;default:t.payload="profile"}e.settings=t.payload},userAuth:(e,t)=>{e.login=t.payload},toggleSign:e=>{!0===e.drawer?e.drawer=!1:e.drawer=!0},closeSign:e=>{e.drawer=!1},signUpAction:e=>{!1===e.registerOne?e.registerOne=!0:e.registerOne=!1},universalToggle:(e,t)=>{"drawer"===t.payload?!1===e.registerOne?e.registerOne=!0:e.registerOne=!1:!1===e.registerTwo?e.registerTwo=!0:e.registerTwo=!1},signUpClose:(e,t)=>{e.registerOne=t.payload},iconAuth:(e,t)=>{e.photoURL=t.payload},nameAuth:(e,t)=>{e.name=t.payload}}}),{universalToggle:Ot,navigateAuth:xt,iconAuth:Nt,nameAuth:Dt,userAuth:Lt,toggleSign:Ut,closeSign:Mt,signUpAction:jt,signUpClose:$t}=Rt.actions,Ft=Ct({name:"drawers",initialState:{drawer:!1},reducers:{setDrawer:e=>{!1===e.drawer?e.drawer=!0:e.drawer=!1},closeDrawer:e=>{e.drawer=!1}}}),{setDrawer:Bt,closeDrawer:zt}=Ft.actions,Ht=Ct({name:"backend",initialState:{verified:!1,anon:!1,userId:"",name:"John Doe",email:"",photoURL:"",phone:"",msgToken:""},reducers:{accVerified:(e,t)=>{e.verified=t.payload},accAnon:(e,t)=>{e.anon=t.payload},accID:(e,t)=>{e.userId=t.payload},accName:(e,t)=>{e.name=t.payload},accPhone:(e,t)=>{e.phone=t.payload},accEmail:(e,t)=>{e.email=t.payload},accImage:(e,t)=>{e.photoURL=t.payload},messageId:(e,t)=>{e.msgToken=t.payload}}}),{accVerified:Vt,accID:qt,accName:Wt,accPhone:Kt,accEmail:Gt,accImage:Jt,accAnon:Xt,messageId:Yt}=Ht.actions,Zt=function(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:r=!0}=e??{};let s=new yt;return t&&(function(e){return"boolean"==typeof e}(t)?s.push(pt):s.push(ft(t.extraArgument))),s},{reducer:n,middleware:i,devTools:r=!0,preloadedState:s,enhancers:o}=e||{};let a,c;if("function"==typeof n)a=n;else{if(!ye(n))throw new Error(Pt(1));a=we(n)}c="function"==typeof i?i(t):t();let h=be;r&&(h=gt({trace:!1,..."object"==typeof r&&r}));const l=function(...e){return t=>(n,i)=>{const r=t(n,i);let s=()=>{throw new Error(pe(15))};const o={getState:r.getState,dispatch:(e,...t)=>s(e,...t)},a=e.map(e=>e(o));return s=be(...a)(r.dispatch),{...r,dispatch:s}}}(...c),u=vt(l);return _e(a,s,h(..."function"==typeof o?o(u):u()))}({reducer:{frontend:Rt.reducer,drawer:Ft.reducer,backend:Ht.reducer},devTools:!0}),Qt=s`
7
+ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),r=new WeakMap;let i=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const n=this.t;if(t&&void 0===e){const t=void 0!==n&&1===n.length;t&&(e=r.get(n)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&r.set(n,e))}return e}toString(){return this.cssText}};const s=(e,...t)=>{const r=1===e.length?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[r+1],e[0]);return new i(r,e,n)},o=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new i("string"==typeof e?e:e+"",void 0,n))(t)})(e):e,{is:a,defineProperty:c,getOwnPropertyDescriptor:l,getOwnPropertyNames:u,getOwnPropertySymbols:h,getPrototypeOf:d}=Object,p=globalThis,f=p.trustedTypes,g=f?f.emptyScript:"",m=p.reactiveElementPolyfillSupport,y=(e,t)=>e,_={toAttribute(e,t){switch(t){case Boolean:e=e?g:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},w=(e,t)=>!a(e,t),v={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let b=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=v){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(e,n,t);void 0!==r&&c(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){const{get:r,set:i}=l(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){const s=r?.call(this);i?.call(this,t),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??v}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const e=d(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const e=this.properties,t=[...u(e),...h(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(o(e))}else void 0!==e&&t.push(o(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((n,r)=>{if(t)n.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const t of r){const r=document.createElement("style"),i=e.litNonce;void 0!==i&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}})(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(void 0!==r&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:_).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,r=n._$Eh.get(e);if(void 0!==r&&this._$Em!==r){const e=n.getPropertyOptions(r),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:_;this._$Em=r;const s=i.fromAttribute(t,e.type);this[r]=s??this._$Ej?.get(r)??s,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const r=this.constructor,i=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??w)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==i||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||void 0===r||this.C(t,void 0,n,r)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[y("elementProperties")]=new Map,b[y("finalized")]=new Map,m?.({ReactiveElement:b}),(p.reactiveElementVersions??=[]).push("2.1.1");const E=globalThis,T=E.trustedTypes,I=T?T.createPolicy("lit-html",{createHTML:e=>e}):void 0,S="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+C,A=`<${k}>`,R=document,O=()=>R.createComment(""),P=e=>null===e||"object"!=typeof e&&"function"!=typeof e,x=Array.isArray,N="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,M=/>/g,U=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),$=/'/g,F=/"/g,j=/^(?:script|style|textarea|title)$/i,V=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),B=Symbol.for("lit-noChange"),z=Symbol.for("lit-nothing"),q=new WeakMap,H=R.createTreeWalker(R,129);function K(e,t){if(!x(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==I?I.createHTML(t):t}const W=(e,t)=>{const n=e.length-1,r=[];let i,s=2===t?"<svg>":3===t?"<math>":"",o=D;for(let t=0;t<n;t++){const n=e[t];let a,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),null!==c);)u=o.lastIndex,o===D?"!--"===c[1]?o=L:void 0!==c[1]?o=M:void 0!==c[2]?(j.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=U):void 0!==c[3]&&(o=U):o===U?">"===c[0]?(o=i??D,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?U:'"'===c[3]?F:$):o===F||o===$?o=U:o===L||o===M?o=D:(o=U,i=void 0);const h=o===U&&e[t+1].startsWith("/>")?" ":"";s+=o===D?n+A:l>=0?(r.push(a),n.slice(0,l)+S+n.slice(l)+C+h):n+C+(-2===l?t:h)}return[K(e,s+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]};let G=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let s=0,o=0;const a=t.length-1,c=this.parts,[l,u]=W(t,n);if(this.el=e.createElement(l,r),H.currentNode=this.el.content,2===n||3===n){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=H.nextNode())&&c.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(S)){const t=u[o++],n=i.getAttribute(e).split(C),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:s,name:r[2],strings:n,ctor:"."===r[1]?Z:"?"===r[1]?ee:"@"===r[1]?te:Y}),i.removeAttribute(e)}else e.startsWith(C)&&(c.push({type:6,index:s}),i.removeAttribute(e));if(j.test(i.tagName)){const e=i.textContent.split(C),t=e.length-1;if(t>0){i.textContent=T?T.emptyScript:"";for(let n=0;n<t;n++)i.append(e[n],O()),H.nextNode(),c.push({type:2,index:++s});i.append(e[t],O())}}}else if(8===i.nodeType)if(i.data===k)c.push({type:2,index:s});else{let e=-1;for(;-1!==(e=i.data.indexOf(C,e+1));)c.push({type:7,index:s}),e+=C.length-1}s++}}static createElement(e,t){const n=R.createElement("template");return n.innerHTML=e,n}};function X(e,t,n=e,r){if(t===B)return t;let i=void 0!==r?n._$Co?.[r]:n._$Cl;const s=P(t)?void 0:t._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),void 0===s?i=void 0:(i=new s(e),i._$AT(e,n,r)),void 0!==r?(n._$Co??=[])[r]=i:n._$Cl=i),void 0!==i&&(t=X(e,i._$AS(e,t.values),i,r)),t}let Q=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??R).importNode(t,!0);H.currentNode=r;let i=H.nextNode(),s=0,o=0,a=n[0];for(;void 0!==a;){if(s===a.index){let t;2===a.type?t=new J(i,i.nextSibling,this,e):1===a.type?t=new a.ctor(i,a.name,a.strings,this,e):6===a.type&&(t=new ne(i,this,e)),this._$AV.push(t),a=n[++o]}s!==a?.index&&(i=H.nextNode(),s++)}return H.currentNode=R,r}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}};class J{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=z,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=X(this,e,t),P(e)?e===z||null==e||""===e?(this._$AH!==z&&this._$AR(),this._$AH=z):e!==this._$AH&&e!==B&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>x(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==z&&P(this._$AH)?this._$AA.nextSibling.data=e:this.T(R.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,r="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=G.createElement(K(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{const e=new Q(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=q.get(e.strings);return void 0===t&&q.set(e.strings,t=new G(e)),t}k(e){x(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,r=0;for(const i of e)r===t.length?t.push(n=new J(this.O(O()),this.O(O()),this,this.options)):n=t[r],n._$AI(i),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}let Y=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=z,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=z}_$AI(e,t=this,n,r){const i=this.strings;let s=!1;if(void 0===i)e=X(this,e,t,0),s=!P(e)||e!==this._$AH&&e!==B,s&&(this._$AH=e);else{const r=e;let o,a;for(e=i[0],o=0;o<i.length-1;o++)a=X(this,r[n+o],t,o),a===B&&(a=this._$AH[o]),s||=!P(a)||a!==this._$AH[o],a===z?e=z:e!==z&&(e+=(a??"")+i[o+1]),this._$AH[o]=a}s&&!r&&this.j(e)}j(e){e===z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}};class Z extends Y{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===z?void 0:e}}class ee extends Y{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==z)}}let te=class extends Y{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=X(this,e,t,0)??z)===B)return;const n=this._$AH,r=e===z&&n!==z||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==z&&(n===z||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}};class ne{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){X(this,e)}}const re=E.litHtmlPolyfillSupport;re?.(G,J),(E.litHtmlVersions??=[]).push("3.3.1");const ie=globalThis;class se extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const r=n?.renderBefore??t;let i=r._$litPart$;if(void 0===i){const e=n?.renderBefore??null;r._$litPart$=i=new J(t.insertBefore(O(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return B}}se._$litElement$=!0,se.finalized=!0,ie.litElementHydrateSupport?.({LitElement:se});const oe=ie.litElementPolyfillSupport;oe?.({LitElement:se}),(ie.litElementVersions??=[]).push("4.2.1");const ae=e=>(t,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},ce={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:w},le=(e=ce,t,n)=>{const{kind:r,metadata:i}=n;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===r&&((e=Object.create(e)).wrapped=!0),s.set(n.name,e),"accessor"===r){const{name:r}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e)},init(t){return void 0!==t&&this.C(r,void 0,e,t),t}}}if("setter"===r){const{name:r}=n;return function(n){const i=this[r];t.call(this,n),this.requestUpdate(r,i,e)}}throw Error("Unsupported decorator location: "+r)};function ue(e){return(t,n)=>"object"==typeof n?le(e,t,n):((e,t,n)=>{const r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function he(e){return ue({...e,state:!0,attribute:!1})}const de=e=>t=>class extends t{connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=e.subscribe(()=>this.stateChanged(e.getState())),this.stateChanged(e.getState())}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}stateChanged(e){}};function pe(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var fe=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),ge=()=>Math.random().toString(36).substring(7).split("").join("."),me={INIT:`@@redux/INIT${ge()}`,REPLACE:`@@redux/REPLACE${ge()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ge()}`};function ye(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function _e(e,t,n){if("function"!=typeof e)throw new Error(pe(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(pe(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(pe(1));return n(_e)(e,t)}let r=e,i=t,s=new Map,o=s,a=0,c=!1;function l(){o===s&&(o=new Map,s.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw new Error(pe(3));return i}function h(e){if("function"!=typeof e)throw new Error(pe(4));if(c)throw new Error(pe(5));let t=!0;l();const n=a++;return o.set(n,e),function(){if(t){if(c)throw new Error(pe(6));t=!1,l(),o.delete(n),s=null}}}function d(e){if(!ye(e))throw new Error(pe(7));if(void 0===e.type)throw new Error(pe(8));if("string"!=typeof e.type)throw new Error(pe(17));if(c)throw new Error(pe(9));try{c=!0,i=r(i,e)}finally{c=!1}return(s=o).forEach(e=>{e()}),e}d({type:me.INIT});return{dispatch:d,subscribe:h,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(pe(10));r=e,d({type:me.REPLACE})},[fe]:function(){const e=h;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(pe(11));function n(){const e=t;e.next&&e.next(u())}n();return{unsubscribe:e(n)}},[fe](){return this}}}}}function we(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const i=t[r];"function"==typeof e[i]&&(n[i]=e[i])}const r=Object.keys(n);let i;try{!function(e){Object.keys(e).forEach(t=>{const n=e[t];if(void 0===n(void 0,{type:me.INIT}))throw new Error(pe(12));if(void 0===n(void 0,{type:me.PROBE_UNKNOWN_ACTION()}))throw new Error(pe(13))})}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let s=!1;const o={};for(let i=0;i<r.length;i++){const a=r[i],c=n[a],l=e[a],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(pe(14));o[a]=u,s=s||u!==l}return s=s||r.length!==Object.keys(e).length,s?o:e}}function ve(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}var be=Symbol.for("immer-nothing"),Ee=Symbol.for("immer-draftable"),Te=Symbol.for("immer-state");function Ie(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Se=Object,Ce=Se.getPrototypeOf,ke="constructor",Ae="prototype",Re="configurable",Oe="enumerable",Pe="writable",xe="value",Ne=e=>!!e&&!!e[Te];function De(e){return!!e&&(Ue(e)||ze(e)||!!e[Ee]||!!e[ke]?.[Ee]||qe(e)||He(e))}var Le=Se[Ae][ke].toString(),Me=new WeakMap;function Ue(e){if(!e||!Ke(e))return!1;const t=Ce(e);if(null===t||t===Se[Ae])return!0;const n=Se.hasOwnProperty.call(t,ke)&&t[ke];if(n===Object)return!0;if(!We(n))return!1;let r=Me.get(n);return void 0===r&&(r=Function.toString.call(n),Me.set(n,r)),r===Le}function $e(e,t,n=!0){if(0===Fe(e)){(n?Reflect.ownKeys(e):Se.keys(e)).forEach(n=>{t(n,e[n],e)})}else e.forEach((n,r)=>t(r,n,e))}function Fe(e){const t=e[Te];return t?t.type_:ze(e)?1:qe(e)?2:He(e)?3:0}var je=(e,t,n=Fe(e))=>2===n?e.has(t):Se[Ae].hasOwnProperty.call(e,t),Ve=(e,t,n=Fe(e))=>2===n?e.get(t):e[t],Be=(e,t,n,r=Fe(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n};var ze=Array.isArray,qe=e=>e instanceof Map,He=e=>e instanceof Set,Ke=e=>"object"==typeof e,We=e=>"function"==typeof e,Ge=e=>"boolean"==typeof e;var Xe=e=>e.copy_||e.base_,Qe=e=>e.modified_?e.copy_:e.base_;function Je(e,t){if(qe(e))return new Map(e);if(He(e))return new Set(e);if(ze(e))return Array[Ae].slice.call(e);const n=Ue(e);if(!0===t||"class_only"===t&&!n){const t=Se.getOwnPropertyDescriptors(e);delete t[Te];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],s=t[i];!1===s[Pe]&&(s[Pe]=!0,s[Re]=!0),(s.get||s.set)&&(t[i]={[Re]:!0,[Pe]:!0,[Oe]:s[Oe],[xe]:e[i]})}return Se.create(Ce(e),t)}{const t=Ce(e);if(null!==t&&n)return{...e};const r=Se.create(t);return Se.assign(r,e)}}function Ye(e,t=!1){return et(e)||Ne(e)||!De(e)||(Fe(e)>1&&Se.defineProperties(e,{set:Ze,add:Ze,clear:Ze,delete:Ze}),Se.freeze(e),t&&$e(e,(e,t)=>{Ye(t,!0)},!1)),e}var Ze={[xe]:function(){Ie(2)}};function et(e){return null===e||!Ke(e)||Se.isFrozen(e)}var tt="MapSet",nt="Patches",rt="ArrayMethods",it={};function st(e){const t=it[e];return t||Ie(0),t}var ot,at=e=>!!it[e],ct=()=>ot;function lt(e,t){t&&(e.patchPlugin_=st(nt),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ut(e){ht(e),e.drafts_.forEach(pt),e.drafts_=null}function ht(e){e===ot&&(ot=e.parent_)}var dt=e=>ot={drafts_:[],parent_:ot,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:at(tt)?st(tt):void 0,arrayMethodsPlugin_:at(rt)?st(rt):void 0};function pt(e){const t=e[Te];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ft(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[Te].modified_&&(ut(t),Ie(4)),De(e)&&(e=gt(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Te].base_,e,t)}else e=gt(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ye(t,n)}(t,e,!0),ut(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==be?e:void 0}function gt(e,t){if(et(t))return t;const n=t[Te];if(!n){return bt(t,e.handledSet_,e)}if(!yt(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;){t.pop()(e)}vt(n,e)}return n.copy_}function mt(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var yt=(e,t)=>e.scope_===t,_t=[];function wt(e,t,n,r){const i=Xe(e),s=e.type_;if(void 0!==r){if(Ve(i,r,s)===t)return void Be(i,r,n,s)}if(!e.draftLocations_){const t=e.draftLocations_=new Map;$e(i,(e,n)=>{if(Ne(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const o=e.draftLocations_.get(t)??_t;for(const e of o)Be(i,e,n,s)}function vt(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}mt(e)}}function bt(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ne(e)||t.has(e)||!De(e)||et(e)||(t.add(e),$e(e,(r,i)=>{if(Ne(i)){const t=i[Te];if(yt(t,n)){const n=Qe(t);Be(e,r,n,e.type_),mt(t)}}else De(i)&&bt(i,t,n)})),e}var Et={get(e,t){if(t===Te)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=Xe(e);if(!je(i,t,e.type_))return function(e,t,n){const r=St(t,n);return r?xe in r?r[xe]:r.get?.call(e.draft_):void 0}(e,i,t);const s=i[t];if(e.finalized_||!De(s))return s;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return s;if(s===It(e.base_,t)){kt(e);const n=1===e.type_?+t:t,r=At(e.scope_,s,e,n);return e.copy_[n]=r}return s},has:(e,t)=>t in Xe(e),ownKeys:e=>Reflect.ownKeys(Xe(e)),set(e,t,n){const r=St(Xe(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=It(Xe(e),t),i=r?.[Te];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,r)&&(void 0!==n||je(e.base_,t,e.type_)))return!0;kt(e),Ct(e)}return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(Ne(n)){const i=n[Te];yt(i,r)&&i.callbacks_.push(function(){kt(e);const r=Qe(i);wt(e,n,r,t)})}else De(n)&&e.callbacks_.push(function(){const i=Xe(e);3===e.type_?i.has(n)&&bt(n,r.handledSet_,r):Ve(i,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&bt(Ve(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(kt(e),void 0!==It(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),Ct(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Xe(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[Pe]:!0,[Re]:1!==e.type_||"length"!==t,[Oe]:r[Oe],[xe]:n[t]}:r},defineProperty(){Ie(11)},getPrototypeOf:e=>Ce(e.base_),setPrototypeOf(){Ie(12)}},Tt={};for(let e in Et){let t=Et[e];Tt[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function It(e,t){const n=e[Te];return(n?Xe(n):e)[t]}function St(e,t){if(!(t in e))return;let n=Ce(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ce(n)}}function Ct(e){e.modified_||(e.modified_=!0,e.parent_&&Ct(e.parent_))}function kt(e){e.copy_||(e.assigned_=new Map,e.copy_=Je(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Tt.deleteProperty=function(e,t){return Tt.set.call(this,e,t,void 0)},Tt.set=function(e,t,n){return Et.set.call(this,e[0],t,n,e[0])};function At(e,t,n,r){const[i,s]=qe(t)?st(tt).proxyMap_(t,n):He(t)?st(tt).proxySet_(t,n):function(e,t){const n=ze(e),r={type_:n?1:0,scope_:t?t.scope_:ct(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=Et;n&&(i=[r],s=Tt);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}(t,n);return(n?.scope_??ct()).drafts_.push(i),s.callbacks_=n?.callbacks_??[],s.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const i=t;if(!i||!yt(i,r))return;r.mapSetPlugin_?.fixSetContents(i);const s=Qe(i);wt(e,i.draft_??i,s,n),vt(i,r)})}(n,s,r):s.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(s);const{patchPlugin_:t}=e;s.modified_&&t&&t.generatePatches_(s,[],e)}),i}function Rt(e){if(!De(e)||et(e))return e;const t=e[Te];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Je(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Je(e,!0);return $e(n,(e,t)=>{Be(n,e,Rt(t))},r),t&&(t.finalized_=!1),n}var Ot=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(We(e)&&!We(t)){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if(We(t)||Ie(6),void 0===n||We(n)||Ie(7),De(e)){const i=dt(this),s=At(i,e,void 0);let o=!0;try{r=t(s),o=!1}finally{o?ut(i):ht(i)}return lt(i,n),ft(r,i)}if(!e||!Ke(e)){if(r=t(e),void 0===r&&(r=e),r===be&&(r=void 0),this.autoFreeze_&&Ye(r,!0),n){const t=[],i=[];st(nt).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}Ie(1)},this.produceWithPatches=(e,t)=>{if(We(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;const i=this.produce(e,t,(e,t)=>{n=e,r=t});return[i,n,r]},Ge(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ge(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ge(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){De(e)||Ie(8),Ne(e)&&(e=function(e){Ne(e)||Ie(10);return Rt(e)}(e));const t=dt(this),n=At(t,e,void 0);return n[Te].isManual_=!0,ht(t),n}finishDraft(e,t){const n=e&&e[Te];n&&n.isManual_||Ie(9);const{scope_:r}=n;return lt(r,t),ft(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=st(nt).applyPatches_;return Ne(e)?r(e,t):this.produce(e,e=>r(e,t))}},Pt=Ot.produce;function xt(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var Nt=xt(),Dt=xt,Lt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ve:ve.apply(null,arguments)};function Mt(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(Xt(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>function(e){return ye(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var Ut=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function $t(e){return De(e)?Pt(e,()=>{}):e}function Ft(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var jt=e=>t=>{setTimeout(t,e)},Vt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Ut(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,s=!1,o=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:jt(10):"callback"===e.type?e.queueNotification:jt(e.timeout),l=()=>{o=!1,s&&(s=!1,a.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>i&&e());return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return i=!e?.meta?.RTK_autoBatch,s=!i,s&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})})("object"==typeof n?n:void 0)),r};function Bt(e){const t={},n=[];let r;const i={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(Xt(28));if(r in t)throw new Error(Xt(29));return t[r]=n,i},addAsyncThunk:(e,r)=>(r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i),addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(r=e,i)};return e(i),[t,n,r]}var zt=Symbol.for("rtk-slice-createasyncthunk");function qt(e,t){return`${e}/${t}`}function Ht({creators:e}={}){const t=e?.asyncThunk?.[zt];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(Xt(11));const i=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},s=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(Xt(12));if(n in o.sliceCaseReducersByType)throw new Error(Xt(13));return o.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(o.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(o.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(o.sliceCaseReducersByName[e]=t,a)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?Bt(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return function(e,t){let n,[r,i,s]=Bt(t);if(function(e){return"function"==typeof e}(e))n=()=>$t(e());else{const t=$t(e);n=()=>t}function o(e=n(),t){let o=[r[t.type],...i.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===o.filter(e=>!!e).length&&(o=[s]),o.reduce((e,n)=>{if(n){if(Ne(e)){const r=n(e,t);return void 0===r?e:r}if(De(e))return Pt(e,e=>n(e,t));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e},e)}return o.getInitialState=n,o}(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}s.forEach(r=>{const s=i[r],o={reducerName:r,type:qt(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(s)?function({type:e,reducerName:t,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(Xt(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?Mt(e,o):Mt(e))}(o,s,a):function({type:e,reducerName:t},n,r,i){if(!i)throw new Error(Xt(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:c,settled:l,options:u}=n,h=i(e,s,u);r.exposeAction(t,h),o&&r.addCase(h.fulfilled,o);a&&r.addCase(h.pending,a);c&&r.addCase(h.rejected,c);l&&r.addMatcher(h.settled,l);r.exposeCaseReducer(t,{fulfilled:o||Gt,pending:a||Gt,rejected:c||Gt,settled:l||Gt})}(o,s,a,t)});const l=e=>e,u=new Map,h=new WeakMap;let d;function p(e,t){return d||(d=c()),d(e,t)}function f(){return d||(d=c()),d.getInitialState()}function g(t,n=!1){function r(e){let i=e[t];return void 0===i&&n&&(i=Ft(h,r,f)),i}function i(t=l){const r=Ft(u,n,()=>new WeakMap);return Ft(r,t,()=>{const r={};for(const[i,s]of Object.entries(e.selectors??{}))r[i]=Kt(s,t,()=>Ft(h,t,f),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}const m={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:f,...g(r),injectInto(e,{reducerPath:t,...n}={}){const i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...m,...g(i,!0)}}};return m}}function Kt(e,t,n,r){function i(i,...s){let o=t(i);return void 0===o&&r&&(o=n()),e(o,...s)}return i.unwrapped=e,i}var Wt=Ht();function Gt(){}function Xt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const Qt=Wt({name:"user",initialState:{settings:"profile",login:!1,drawer:!1,registerOne:!1,registerTwo:!1,userId:"user",customer:"John Doe",profileChoice:"unChosen",name:"Modern Business",photoURL:"",phone:"(...) ... - ....",email:""},reducers:{navigateAuth:(e,t)=>{switch(t.payload){case"profile":case"verification":case"password":case"delete":break;default:t.payload="profile"}e.settings=t.payload},userAuth:(e,t)=>{e.login=t.payload},toggleSign:e=>{!0===e.drawer?e.drawer=!1:e.drawer=!0},closeSign:e=>{e.drawer=!1},signUpAction:e=>{!1===e.registerOne?e.registerOne=!0:e.registerOne=!1},universalToggle:(e,t)=>{"drawer"===t.payload?!1===e.registerOne?e.registerOne=!0:e.registerOne=!1:!1===e.registerTwo?e.registerTwo=!0:e.registerTwo=!1},signUpClose:(e,t)=>{e.registerOne=t.payload},iconAuth:(e,t)=>{e.photoURL=t.payload},nameAuth:(e,t)=>{e.name=t.payload}}}),{universalToggle:Jt,navigateAuth:Yt,iconAuth:Zt,nameAuth:en,userAuth:tn,toggleSign:nn,closeSign:rn,signUpAction:sn,signUpClose:on}=Qt.actions,an=Wt({name:"drawers",initialState:{drawer:!1},reducers:{setDrawer:e=>{!1===e.drawer?e.drawer=!0:e.drawer=!1},closeDrawer:e=>{e.drawer=!1}}}),{setDrawer:cn,closeDrawer:ln}=an.actions,un=Wt({name:"backend",initialState:{verified:!1,anon:!1,userId:"",name:"John Doe",email:"",photoURL:"",phone:"",msgToken:""},reducers:{accVerified:(e,t)=>{e.verified=t.payload},accAnon:(e,t)=>{e.anon=t.payload},accID:(e,t)=>{e.userId=t.payload},accName:(e,t)=>{e.name=t.payload},accPhone:(e,t)=>{e.phone=t.payload},accEmail:(e,t)=>{e.email=t.payload},accImage:(e,t)=>{e.photoURL=t.payload},messageId:(e,t)=>{e.msgToken=t.payload}}}),{accVerified:hn,accID:dn,accName:pn,accPhone:fn,accEmail:gn,accImage:mn,accAnon:yn,messageId:_n}=un.actions,wn=function(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let s=new Ut;return t&&(function(e){return"boolean"==typeof e}(t)?s.push(Nt):s.push(Dt(t.extraArgument))),s},{reducer:n,middleware:r,devTools:i=!0,preloadedState:s,enhancers:o}=e||{};let a,c;if("function"==typeof n)a=n;else{if(!ye(n))throw new Error(Xt(1));a=we(n)}c="function"==typeof r?r(t):t();let l=ve;i&&(l=Lt({trace:!1,..."object"==typeof i&&i}));const u=function(...e){return t=>(n,r)=>{const i=t(n,r);let s=()=>{throw new Error(pe(15))};const o={getState:i.getState,dispatch:(e,...t)=>s(e,...t)},a=e.map(e=>e(o));return s=ve(...a)(i.dispatch),{...i,dispatch:s}}}(...c),h=Vt(u);return _e(a,s,l(..."function"==typeof o?o(h):h()))}({reducer:{frontend:Qt.reducer,drawer:an.reducer,backend:un.reducer},devTools:!0}),vn=s`
8
8
 
9
9
  :host {
10
10
  transition: max-height 1.4s ease-out;
@@ -40,7 +40,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
40
40
  box-shadow: 0px 6px 6px -6px;
41
41
  }
42
42
 
43
- `,en=s`
43
+ `,bn=s`
44
44
 
45
45
  a {
46
46
  text-transform: uppercase;
@@ -50,7 +50,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
50
50
  text-decoration: none;
51
51
  }
52
52
 
53
- `,tn=s`
53
+ `,En=s`
54
54
 
55
55
  .setLog > p {
56
56
  margin: 12px;
@@ -58,7 +58,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
58
58
  text-align: center;
59
59
  }
60
60
 
61
- `,nn=s`
61
+ `,Tn=s`
62
62
 
63
63
  .wrapper {
64
64
  display: grid;
@@ -125,7 +125,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
125
125
  z-index: 2;
126
126
  }
127
127
 
128
- `,rn=s`
128
+ `,In=s`
129
129
 
130
130
  ul {
131
131
  list-style-type: none;
@@ -144,7 +144,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
144
144
  margin: 0 16px;
145
145
  }
146
146
 
147
- `,sn=function(e){const t=[];let n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);r<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&i+1<e.length&&56320==(64512&e.charCodeAt(i+1))?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++i)),t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128)}return t},on={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_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let t=0;t<e.length;t+=3){const r=e[t],s=t+1<e.length,o=s?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,h=r>>2,l=(3&r)<<4|o>>4;let u=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(u=64)),i.push(n[h],n[l],n[u],n[d])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(sn(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,i=0;for(;n<e.length;){const r=e[n++];if(r<128)t[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=e[n++];t[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){const s=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[i++]=String.fromCharCode(55296+(s>>10)),t[i++]=String.fromCharCode(56320+(1023&s))}else{const s=e[n++],o=e[n++];t[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let t=0;t<e.length;){const r=n[e.charAt(t++)],s=t<e.length?n[e.charAt(t)]:0;++t;const o=t<e.length?n[e.charAt(t)]:64;++t;const a=t<e.length?n[e.charAt(t)]:64;if(++t,null==r||null==s||null==o||null==a)throw new an;const c=r<<2|s>>4;if(i.push(c),64!==o){const e=s<<4&240|o>>2;if(i.push(e),64!==a){const e=o<<6&192|a;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)}}};class an extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const cn=function(e){return function(e){const t=sn(e);return on.encodeByteArray(t,!0)}(e).replace(/\./g,"")},hn=function(e){try{return on.decodeString(e,!0)}catch(e){}return null};const ln=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,un=()=>{try{return ln()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&hn(e[1]);return t&&JSON.parse(t)})()}catch(e){return}},dn=e=>un()?.emulatorHosts?.[e],pn=e=>{const t=dn(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const i=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),i]:[t.substring(0,n),i]},fn=()=>un()?.config,gn=e=>un()?.[`_${e}`];class mn{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))}}}function yn(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function _n(e){return(await fetch(e,{credentials:"include"})).ok}function wn(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",i=e.iat||0,r=e.sub||e.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s={iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}},...e};return[cn(JSON.stringify({alg:"none",type:"JWT"})),cn(JSON.stringify(s)),""].join(".")}const bn={};let vn=!1;function Tn(e,t){if("undefined"==typeof window||"undefined"==typeof document||!yn(window.location.host)||bn[e]===t||bn[e]||vn)return;function n(e){return`__firebase__banner__${e}`}bn[e]=t;const i="__firebase__banner",r=function(){const e={prod:[],emulator:[]};for(const t of Object.keys(bn))bn[t]?e.emulator.push(t):e.prod.push(t);return e}().prod.length>0;function s(){const e=document.createElement("span");return e.style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" &times;",e.onclick=()=>{vn=!0,function(){const e=document.getElementById(i);e&&e.remove()}()},e}function o(){const e=function(e){let t=document.getElementById(e),n=!1;return t||(t=document.createElement("div"),t.setAttribute("id",e),n=!0),{created:n,element:t}}(i),t=n("text"),o=document.getElementById(t)||document.createElement("span"),a=n("learnmore"),c=document.getElementById(a)||document.createElement("a"),h=n("preprendIcon"),l=document.getElementById(h)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(e.created){const t=e.element;!function(e){e.style.display="flex",e.style.background="#7faaf0",e.style.position="fixed",e.style.bottom="5px",e.style.left="5px",e.style.padding=".5em",e.style.borderRadius="5px",e.style.alignItems="center"}(t),function(e,t){e.setAttribute("id",t),e.innerText="Learn more",e.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",e.setAttribute("target","__blank"),e.style.paddingLeft="5px",e.style.textDecoration="underline"}(c,a);const n=s();!function(e,t){e.setAttribute("width","24"),e.setAttribute("id",t),e.setAttribute("height","24"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.style.marginLeft="-6px"}(l,h),t.append(l,o,c,n),document.body.appendChild(t)}r?(o.innerText="Preview backend disconnected.",l.innerHTML='<g clip-path="url(#clip0_6013_33858)">\n<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6013_33858">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>'):(l.innerHTML='<g clip-path="url(#clip0_6083_34804)">\n<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6083_34804">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>',o.innerText="Preview backend running in this workspace."),o.setAttribute("id",t)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",o):o()}function En(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function In(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function Sn(){try{return"object"==typeof indexedDB}catch(e){return!1}}function kn(){return new Promise((e,t)=>{try{let n=!0;const i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{t(r.error?.message||"")}}catch(e){t(e)}})}function Cn(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class An extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,An.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Pn.prototype.create)}}class Pn{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},i=`${this.service}/${e}`,r=this.errors[e],s=r?function(e,t){return e.replace(Rn,(e,n)=>{const i=t[n];return null!=i?String(i):`<${n}?>`})}(r,n):"Error",o=`${this.serviceName}: ${s} (${i}).`;return new An(i,o,n)}}const Rn=/\{\$([^}]+)}/g;function On(e,t){if(e===t)return!0;const n=Object.keys(e),i=Object.keys(t);for(const r of n){if(!i.includes(r))return!1;const n=e[r],s=t[r];if(xn(n)&&xn(s)){if(!On(n,s))return!1}else if(n!==s)return!1}for(const e of i)if(!n.includes(e))return!1;return!0}function xn(e){return null!==e&&"object"==typeof e}function Nn(e){const t=[];for(const[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 Dn(e){const t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){const[n,i]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(i)}}),t}function Ln(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class Un{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 new Error("Missing Observer.");i=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===i.next&&(i.next=Mn),void 0===i.error&&(i.error=Mn),void 0===i.complete&&(i.complete=Mn);const r=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),r}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}})}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 Mn(){}function jn(e,t=1e3,n=2){const i=t*Math.pow(n,e),r=Math.round(.5*i*(Math.random()-.5)*2);return Math.min(144e5,i+r)}function $n(e){return e&&e._delegate?e._delegate:e}class Fn{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}}const Bn="[DEFAULT]";class zn{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){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new mn;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e?.identifier),n=e?.optional??!1;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(n)return null;throw e}}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(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:Bn})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=Bn){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const 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=Bn){return this.instances.has(e)}getOptions(e=Bn){return this.instancesOptions.get(e)||{}}initialize(e={}){const{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`);const i=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(i)}return i}onInit(e,t){const n=this.normalizeInstanceIdentifier(t),i=this.onInitCallbacks.get(n)??new Set;i.add(e),this.onInitCallbacks.set(n,i);const r=this.instances.get(n);return r&&e(r,n),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const i of n)try{i(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(i=e,i===Bn?void 0:i),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{}var i;return n||null}normalizeInstanceIdentifier(e=Bn){return this.component?this.component.multipleInstances?e:Bn:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class Hn{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new zn(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}var Vn;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(Vn||(Vn={}));const qn={debug:Vn.DEBUG,verbose:Vn.VERBOSE,info:Vn.INFO,warn:Vn.WARN,error:Vn.ERROR,silent:Vn.SILENT},Wn=Vn.INFO,Kn={[Vn.DEBUG]:"log",[Vn.VERBOSE]:"log",[Vn.INFO]:"info",[Vn.WARN]:"warn",[Vn.ERROR]:"error"},Gn=(e,t,...n)=>{if(t<e.logLevel)return;(new Date).toISOString();if(!Kn[t])throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class Jn{constructor(e){this.name=e,this._logLevel=Wn,this._logHandler=Gn,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Vn))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?qn[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,Vn.DEBUG,...e),this._logHandler(this,Vn.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Vn.VERBOSE,...e),this._logHandler(this,Vn.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Vn.INFO,...e),this._logHandler(this,Vn.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,Vn.WARN,...e),this._logHandler(this,Vn.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Vn.ERROR,...e),this._logHandler(this,Vn.ERROR,...e)}}let Xn,Yn;const Zn=new WeakMap,Qn=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap;let ii={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Qn.get(e);if("objectStoreNames"===t)return e.objectStoreNames||ei.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return oi(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function ri(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Yn||(Yn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(ai(this),t),oi(Zn.get(this))}:function(...t){return oi(e.apply(ai(this),t))}:function(t,...n){const i=e.call(ai(this),t,...n);return ei.set(i,t.sort?t.sort():[t]),oi(i)}}function si(e){return"function"==typeof e?ri(e):(e instanceof IDBTransaction&&function(e){if(Qn.has(e))return;const t=new Promise((t,n)=>{const i=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",s),e.removeEventListener("abort",s)},r=()=>{t(),i()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",r),e.addEventListener("error",s),e.addEventListener("abort",s)});Qn.set(e,t)}(e),t=e,(Xn||(Xn=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,ii):e);var t}function oi(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const i=()=>{e.removeEventListener("success",r),e.removeEventListener("error",s)},r=()=>{t(oi(e.result)),i()},s=()=>{n(e.error),i()};e.addEventListener("success",r),e.addEventListener("error",s)});return t.then(t=>{t instanceof IDBCursor&&Zn.set(t,e)}).catch(()=>{}),ni.set(t,e),t}(e);if(ti.has(e))return ti.get(e);const t=si(e);return t!==e&&(ti.set(e,t),ni.set(t,e)),t}const ai=e=>ni.get(e);function ci(e,t,{blocked:n,upgrade:i,blocking:r,terminated:s}={}){const o=indexedDB.open(e,t),a=oi(o);return i&&o.addEventListener("upgradeneeded",e=>{i(oi(o.result),e.oldVersion,e.newVersion,oi(o.transaction),e)}),n&&o.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{s&&e.addEventListener("close",()=>s()),r&&e.addEventListener("versionchange",e=>r(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}function hi(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",e=>t(e.oldVersion,e)),oi(n).then(()=>{})}const li=["get","getKey","getAll","getAllKeys","count"],ui=["put","add","delete","clear"],di=new Map;function pi(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(di.get(t))return di.get(t);const n=t.replace(/FromIndex$/,""),i=t!==n,r=ui.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!r&&!li.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,r?"readwrite":"readonly");let o=s.store;return i&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),r&&s.done]))[0]};return di.set(t,s),s}ii=(e=>({...e,get:(t,n,i)=>pi(t,n)||e.get(t,n,i),has:(t,n)=>!!pi(t,n)||e.has(t,n)}))(ii);class fi{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===t?.type}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const gi="@firebase/app",mi="0.14.5",yi=new Jn("@firebase/app"),_i="@firebase/app-compat",wi="@firebase/analytics-compat",bi="@firebase/analytics",vi="@firebase/app-check-compat",Ti="@firebase/app-check",Ei="@firebase/auth",Ii="@firebase/auth-compat",Si="@firebase/database",ki="@firebase/data-connect",Ci="@firebase/database-compat",Ai="@firebase/functions",Pi="@firebase/functions-compat",Ri="@firebase/installations",Oi="@firebase/installations-compat",xi="@firebase/messaging",Ni="@firebase/messaging-compat",Di="@firebase/performance",Li="@firebase/performance-compat",Ui="@firebase/remote-config",Mi="@firebase/remote-config-compat",ji="@firebase/storage",$i="@firebase/storage-compat",Fi="@firebase/firestore",Bi="@firebase/ai",zi="@firebase/firestore-compat",Hi="firebase",Vi="[DEFAULT]",qi={[gi]:"fire-core",[_i]:"fire-core-compat",[bi]:"fire-analytics",[wi]:"fire-analytics-compat",[Ti]:"fire-app-check",[vi]:"fire-app-check-compat",[Ei]:"fire-auth",[Ii]:"fire-auth-compat",[Si]:"fire-rtdb",[ki]:"fire-data-connect",[Ci]:"fire-rtdb-compat",[Ai]:"fire-fn",[Pi]:"fire-fn-compat",[Ri]:"fire-iid",[Oi]:"fire-iid-compat",[xi]:"fire-fcm",[Ni]:"fire-fcm-compat",[Di]:"fire-perf",[Li]:"fire-perf-compat",[Ui]:"fire-rc",[Mi]:"fire-rc-compat",[ji]:"fire-gcs",[$i]:"fire-gcs-compat",[Fi]:"fire-fst",[zi]:"fire-fst-compat",[Bi]:"fire-vertex","fire-js":"fire-js",[Hi]:"fire-js-all"},Wi=new Map,Ki=new Map,Gi=new Map;function Ji(e,t){try{e.container.addComponent(t)}catch(n){yi.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Xi(e){const t=e.name;if(Gi.has(t))return yi.debug(`There were multiple attempts to register component ${t}.`),!1;Gi.set(t,e);for(const t of Wi.values())Ji(t,e);for(const t of Ki.values())Ji(t,e);return!0}function Yi(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function Zi(e){return null!=e&&void 0!==e.settings}const Qi=new Pn("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","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class er{constructor(e,t,n){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new Fn("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 Qi.create("app-deleted",{appName:this._name})}}const tr="12.5.0";function nr(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const i={name:Vi,automaticDataCollectionEnabled:!0,...t},r=i.name;if("string"!=typeof r||!r)throw Qi.create("bad-app-name",{appName:String(r)});if(n||(n=fn()),!n)throw Qi.create("no-options");const s=Wi.get(r);if(s){if(On(n,s.options)&&On(i,s.config))return s;throw Qi.create("duplicate-app",{appName:r})}const o=new Hn(r);for(const e of Gi.values())o.addComponent(e);const a=new er(n,i,o);return Wi.set(r,a),a}function ir(e=Vi){const t=Wi.get(e);if(!t&&e===Vi&&fn())return nr();if(!t)throw Qi.create("no-app",{appName:e});return t}function rr(e,t,n){let i=qi[e]??e;n&&(i+=`-${n}`);const r=i.match(/\s|\//),s=t.match(/\s|\//);if(r||s){const e=[`Unable to register library "${i}" with version "${t}":`];return r&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),r&&s&&e.push("and"),s&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void yi.warn(e.join(" "))}Xi(new Fn(`${i}-version`,()=>({library:i,version:t}),"VERSION"))}const sr="firebase-heartbeat-store";let or=null;function ar(){return or||(or=ci("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(sr)}catch(e){}}}).catch(e=>{throw Qi.create("idb-open",{originalErrorMessage:e.message})})),or}async function cr(e,t){try{const n=(await ar()).transaction(sr,"readwrite"),i=n.objectStore(sr);await i.put(t,hr(e)),await n.done}catch(e){if(e instanceof An)yi.warn(e.message);else{const t=Qi.create("idb-set",{originalErrorMessage:e?.message});yi.warn(t.message)}}}function hr(e){return`${e.name}!${e.options.appId}`}class lr{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new dr(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){try{const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=ur();if(null==this._heartbeatsCache?.heartbeats&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats))return;if(this._heartbeatsCache.lastSentHeartbeatDate===t||this._heartbeatsCache.heartbeats.some(e=>e.date===t))return;if(this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats.length>30){const e=function(e){if(0===e.length)return-1;let t=0,n=e[0].date;for(let i=1;i<e.length;i++)e[i].date<n&&(n=e[i].date,t=i);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){yi.warn(e)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats||0===this._heartbeatsCache.heartbeats.length)return"";const e=ur(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let i=e.slice();for(const r of e){const e=n.find(e=>e.agent===r.agent);if(e){if(e.dates.push(r.date),pr(n)>t){e.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),pr(n)>t){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),i=cn(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}catch(e){return yi.warn(e),""}}}function ur(){return(new Date).toISOString().substring(0,10)}class dr{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!Sn()&&kn().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await ar()).transaction(sr),n=await t.objectStore(sr).get(hr(e));return await t.done,n}catch(e){if(e instanceof An)yi.warn(e.message);else{const t=Qi.create("idb-get",{originalErrorMessage:e?.message});yi.warn(t.message)}}}(this.app);return e?.heartbeats?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const t=await this.read();return cr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){if(await this._canUseIndexedDBPromise){const t=await this.read();return cr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:[...t.heartbeats,...e.heartbeats]})}}}function pr(e){return cn(JSON.stringify({version:2,heartbeats:e})).length}var fr;function gr(){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."}}fr="",Xi(new Fn("platform-logger",e=>new fi(e),"PRIVATE")),Xi(new Fn("heartbeat",e=>new lr(e),"PRIVATE")),rr(gi,mi,fr),rr(gi,mi,"esm2020"),rr("fire-js","");const mr=gr,yr=new Pn("auth","Firebase",{"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."}),_r=new Jn("@firebase/auth");function wr(e,...t){_r.logLevel<=Vn.ERROR&&_r.error(`Auth (${tr}): ${e}`,...t)}function br(e,...t){throw Ir(e,...t)}function vr(e,...t){return Ir(e,...t)}function Tr(e,t,n){const i={...mr(),[t]:n};return new Pn("auth","Firebase",i).create(t,{appName:e.name})}function Er(e){return Tr(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Ir(e,...t){if("string"!=typeof e){const n=t[0],i=[...t.slice(1)];return i[0]&&(i[0].appName=e.name),e._errorFactory.create(n,...i)}return yr.create(e,...t)}function Sr(e,t,...n){if(!e)throw Ir(t,...n)}function kr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw wr(t),new Error(t)}function Cr(e,t){e||kr(t)}function Ar(){return"undefined"!=typeof self&&self.location?.href||""}function Pr(){return"undefined"!=typeof self&&self.location?.protocol||null}function Rr(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Pr()&&"https:"!==Pr()&&!In()&&!("connection"in navigator)||navigator.onLine}class Or{constructor(e,t){this.shortDelay=e,this.longDelay=t,Cr(t>e,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(En())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Rr()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function xr(e,t){Cr(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class Nr{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:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void kr("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:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void kr("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:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void kr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Dr={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",INVALID_LOGIN_CREDENTIALS:"invalid-credential",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"},Lr=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Ur=new Or(3e4,6e4);function Mr(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function jr(e,t,n,i,r={}){return $r(e,r,async()=>{let r={},s={};i&&("GET"===t?s=i:r={body:JSON.stringify(i)});const o=Nn({key:e.config.apiKey,...s}).slice(1),a=await e._getAdditionalHeaders();a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode);const c={method:t,headers:a,...r};return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(c.referrerPolicy="no-referrer"),e.emulatorConfig&&yn(e.emulatorConfig.host)&&(c.credentials="include"),Nr.fetch()(await Br(e,e.config.apiHost,n,o),c)})}async function $r(e,t,n){e._canInitEmulator=!1;const i={...Dr,...t};try{const t=new Hr(e),r=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const s=await r.json();if("needConfirmation"in s)throw Vr(e,"account-exists-with-different-credential",s);if(r.ok&&!("errorMessage"in s))return s;{const t=r.ok?s.errorMessage:s.error.message,[n,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Vr(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Vr(e,"email-already-in-use",s);if("USER_DISABLED"===n)throw Vr(e,"user-disabled",s);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Tr(e,a,o);br(e,a)}}catch(t){if(t instanceof An)throw t;br(e,"network-request-failed",{message:String(t)})}}async function Fr(e,t,n,i,r={}){const s=await jr(e,t,n,i,r);return"mfaPendingCredential"in s&&br(e,"multi-factor-auth-required",{_serverResponse:s}),s}async function Br(e,t,n,i){const r=`${t}${n}?${i}`,s=e,o=s.config.emulator?xr(e.config,r):`${e.config.apiScheme}://${r}`;if(Lr.includes(n)&&(await s._persistenceManagerAvailable,"COOKIE"===s._getPersistenceType())){return s._getPersistence()._getFinalTarget(o).toString()}return o}function zr(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Hr{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(vr(this.auth,"network-request-failed")),Ur.get())})}}function Vr(e,t,n){const i={appName:e.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const r=vr(e,t,i);return r.customData._tokenResponse=n,r}function qr(e){return void 0!==e&&void 0!==e.enterprise}class Wr{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return zr(t.enforcementState);return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function Kr(e,t){return jr(e,"POST","/v1/accounts:lookup",t)}function Gr(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function Jr(e){return 1e3*Number(e)}function Xr(e){const[t,n,i]=e.split(".");if(void 0===t||void 0===n||void 0===i)return wr("JWT malformed, contained fewer than 3 sections"),null;try{const e=hn(n);return e?JSON.parse(e):(wr("Failed to decode base64 JWT payload"),null)}catch(e){return wr("Caught error parsing JWT payload as JSON",e?.toString()),null}}function Yr(e){const t=Xr(e);return Sr(t,"internal-error"),Sr(void 0!==t.exp,"internal-error"),Sr(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function Zr(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof An&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class Qr{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){if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===e?.code&&this.schedule(!0))}this.schedule()}}class es{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Gr(this.lastLoginAt),this.creationTime=Gr(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function ts(e){const t=e.auth,n=await e.getIdToken(),i=await Zr(e,Kr(t,{idToken:n}));Sr(i?.users.length,t,"internal-error");const r=i.users[0];e._notifyReloadListener(r);const s=r.providerUserInfo?.length?ns(r.providerUserInfo):[],o=function(e,t){const n=e.filter(e=>!t.some(t=>t.providerId===e.providerId));return[...n,...t]}(e.providerData,s),a=e.isAnonymous,c=!(e.email&&r.passwordHash||o?.length),h=!!a&&c,l={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:o,metadata:new es(r.createdAt,r.lastLoginAt),isAnonymous:h};Object.assign(e,l)}function ns(e){return e.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}class is{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Sr(e.idToken,"internal-error"),Sr(void 0!==e.idToken,"internal-error"),Sr(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):Yr(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){Sr(0!==e.length,"internal-error");const t=Yr(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(Sr(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:i,expiresIn:r}=await async function(e,t){const n=await $r(e,{},async()=>{const n=Nn({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:r}=e.config,s=await Br(e,i,"/v1/token",`key=${r}`),o=await e._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:o,body:n};return e.emulatorConfig&&yn(e.emulatorConfig.host)&&(a.credentials="include"),Nr.fetch()(s,a)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,i,Number(r))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:i,expirationTime:r}=t,s=new is;return n&&(Sr("string"==typeof n,"internal-error",{appName:e}),s.refreshToken=n),i&&(Sr("string"==typeof i,"internal-error",{appName:e}),s.accessToken=i),r&&(Sr("number"==typeof r,"internal-error",{appName:e}),s.expirationTime=r),s}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 is,this.toJSON())}_performRefresh(){return kr("not implemented")}}function rs(e,t){Sr("string"==typeof e||void 0===e,"internal-error",{appName:t})}class ss{constructor({uid:e,auth:t,stsTokenManager:n,...i}){this.providerId="firebase",this.proactiveRefresh=new Qr(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new es(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await Zr(this,this.stsTokenManager.getToken(this.auth,e));return Sr(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const n=$n(e),i=await n.getIdToken(t),r=Xr(i);Sr(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const s="object"==typeof r.firebase?r.firebase:void 0,o=s?.sign_in_provider;return{claims:r,token:i,authTime:Gr(Jr(r.auth_time)),issuedAtTime:Gr(Jr(r.iat)),expirationTime:Gr(Jr(r.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}(this,e)}reload(){return async function(e){const t=$n(e);await ts(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(Sr(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=>({...e})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new ss({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){Sr(!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 ts(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Zi(this.auth.app))return Promise.reject(Er(this.auth));const e=await this.getIdToken();return await Zr(this,async function(e,t){return jr(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{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=>({...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){const n=t.displayName??void 0,i=t.email??void 0,r=t.phoneNumber??void 0,s=t.photoURL??void 0,o=t.tenantId??void 0,a=t._redirectEventId??void 0,c=t.createdAt??void 0,h=t.lastLoginAt??void 0,{uid:l,emailVerified:u,isAnonymous:d,providerData:p,stsTokenManager:f}=t;Sr(l&&f,e,"internal-error");const g=is.fromJSON(this.name,f);Sr("string"==typeof l,e,"internal-error"),rs(n,e.name),rs(i,e.name),Sr("boolean"==typeof u,e,"internal-error"),Sr("boolean"==typeof d,e,"internal-error"),rs(r,e.name),rs(s,e.name),rs(o,e.name),rs(a,e.name),rs(c,e.name),rs(h,e.name);const m=new ss({uid:l,auth:e,email:i,emailVerified:u,displayName:n,isAnonymous:d,photoURL:s,phoneNumber:r,tenantId:o,stsTokenManager:g,createdAt:c,lastLoginAt:h});return p&&Array.isArray(p)&&(m.providerData=p.map(e=>({...e}))),a&&(m._redirectEventId=a),m}static async _fromIdTokenResponse(e,t,n=!1){const i=new is;i.updateFromServerResponse(t);const r=new ss({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:n});return await ts(r),r}static async _fromGetAccountInfoResponse(e,t,n){const i=t.users[0];Sr(void 0!==i.localId,"internal-error");const r=void 0!==i.providerUserInfo?ns(i.providerUserInfo):[],s=!(i.email&&i.passwordHash||r?.length),o=new is;o.updateFromIdToken(n);const a=new ss({uid:i.localId,auth:e,stsTokenManager:o,isAnonymous:s}),c={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:r,metadata:new es(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash||r?.length)};return Object.assign(a,c),a}}const os=new Map;function as(e){Cr(e instanceof Function,"Expected a class definition");let t=os.get(e);return t?(Cr(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,os.set(e,t),t)}class cs{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}cs.type="NONE";const hs=cs;function ls(e,t,n){return`firebase:${e}:${t}:${n}`}class us{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:i,name:r}=this.auth;this.fullUserKey=ls(this.userKey,i.apiKey,r),this.fullPersistenceKey=ls("persistence",i.apiKey,r),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(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){const t=await Kr(this.auth,{idToken:e}).catch(()=>{});return t?ss._fromGetAccountInfoResponse(this.auth,t,e):null}return ss._fromJSON(this.auth,e)}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;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new us(as(hs),e,n);const i=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let r=i[0]||as(hs);const s=ls(n,e.config.apiKey,e.name);let o=null;for(const n of t)try{const t=await n._get(s);if(t){let i;if("string"==typeof t){const n=await Kr(e,{idToken:t}).catch(()=>{});if(!n)break;i=await ss._fromGetAccountInfoResponse(e,n,t)}else i=ss._fromJSON(e,t);n!==r&&(o=i),r=n;break}}catch{}const a=i.filter(e=>e._shouldAllowMigration);return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(s,o.toJSON()),await Promise.all(t.map(async e=>{if(e!==r)try{await e._remove(s)}catch{}})),new us(r,e,n)):new us(r,e,n)}}function ds(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(ms(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(ps(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(_s(t))return"Blackberry";if(ws(t))return"Webos";if(fs(t))return"Safari";if((t.includes("chrome/")||gs(t))&&!t.includes("edge/"))return"Chrome";if(ys(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===n?.length)return n[1]}return"Other"}function ps(e=En()){return/firefox\//i.test(e)}function fs(e=En()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function gs(e=En()){return/crios\//i.test(e)}function ms(e=En()){return/iemobile/i.test(e)}function ys(e=En()){return/android/i.test(e)}function _s(e=En()){return/blackberry/i.test(e)}function ws(e=En()){return/webos/i.test(e)}function bs(e=En()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function vs(){return function(){const e=En();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function Ts(e=En()){return bs(e)||ys(e)||ws(e)||_s(e)||/windows phone/i.test(e)||ms(e)}function Es(e,t=[]){let n;switch(e){case"Browser":n=ds(En());break;case"Worker":n=`${ds(En())}-${e}`;break;default:n=e}const i=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${tr}/${i}`}class Is{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise((n,i)=>{try{n(e(t))}catch(e){i(e)}});n.onAbort=t,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:e?.message})}}}class Ss{constructor(e){const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??6,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),void 0!==t.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),void 0!==t.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),void 0!==t.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),void 0!==t.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const 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,r){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=r))}}class ks{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 As(this),this.idTokenSubscription=new As(this),this.beforeStateQueue=new Is(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=yr,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=as(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await us.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.uid||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await Kr(this,{idToken:e}),n=await ss._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(Zi(this.app)){const e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let n=t,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const t=this.redirectUser?._redirectEventId,r=n?._redirectEventId,s=await this.tryRedirectSignIn(e);t&&t!==r||!s?.user||(n=s.user,i=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(n)}catch(e){n=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return Sr(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}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 ts(e)}catch(e){if("auth/network-request-failed"!==e?.code)return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Zi(this.app))return Promise.reject(Er(this));const t=e?$n(e):null;return t&&Sr(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&&Sr(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 Zi(this.app)?Promise.reject(Er(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Zi(this.app)?Promise.reject(Er(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(as(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const 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(){const e=await async function(e,t={}){return jr(e,"GET","/v2/passwordPolicy",Mr(e,t))}(this),t=new Ss(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Pn("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)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return jr(e,"POST","/v2/accounts:revokeToken",Mr(e,t))}(this,t)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&as(e)||this._popupRedirectResolver;Sr(t,this,"argument-error"),this.redirectPersistenceManager=await us.create(this,[as(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._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(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,i){if(this._deleted)return()=>{};const r="function"==typeof t?t:t.next.bind(t);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Sr(o,this,"internal-error"),o.then(()=>{s||r(this.currentUser)}),"function"==typeof t){const r=e.addObserver(t,n,i);return()=>{s=!0,r()}}{const n=e.addObserver(t);return()=>{s=!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 Sr(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Es(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await(this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader());t&&(e["X-Firebase-Client"]=t);const n=await this._getAppCheckToken();return n&&(e["X-Firebase-AppCheck"]=n),e}async _getAppCheckToken(){if(Zi(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await(this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken());return e?.error&&function(e,...t){_r.logLevel<=Vn.WARN&&_r.warn(`Auth (${tr}): ${e}`,...t)}(`Error while retrieving App Check token: ${e.error}`),e?.token}}function Cs(e){return $n(e)}class As{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new Un(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return Sr(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Ps={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Rs(e){return Ps.loadJS(e)}class Os{constructor(){this.enterprise=new xs}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class xs{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const Ns="NO_RECAPTCHA";class Ds{constructor(e){this.type="recaptcha-enterprise",this.auth=Cs(e)}async verify(e="verify",t=!1){async function n(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)=>{(async function(e,t){return jr(e,"GET","/v2/recaptchaConfig",Mr(e,t))})(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(i=>{if(void 0!==i.recaptchaKey){const n=new Wr(i);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))}).catch(e=>{n(e)})})}function i(t,n,i){const r=window.grecaptcha;qr(r)?r.enterprise.ready(()=>{r.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n(Ns)})}):i(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new Os).execute("siteKey",{action:"verify"})}return new Promise((e,r)=>{n(this.auth).then(n=>{if(!t&&qr(window.grecaptcha))i(n,e,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let t=Ps.recaptchaEnterpriseScript;0!==t.length&&(t+=n),Rs(t).then(()=>{i(n,e,r)}).catch(e=>{r(e)})}}).catch(e=>{r(e)})})}}async function Ls(e,t,n,i=!1,r=!1){const s=new Ds(e);let o;if(r)o=Ns;else try{o=await s.verify(n)}catch(e){o=await s.verify(n,!0)}const a={...t};if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in a){const e=a.phoneEnrollmentInfo.phoneNumber,t=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const e=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return i?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function Us(e,t,n,i,r){if(e._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await Ls(e,t,n,"getOobCode"===n);return i(e,r)}return i(e,t).catch(async r=>{if("auth/missing-recaptcha-token"===r.code){const r=await Ls(e,t,n,"getOobCode"===n);return i(e,r)}return Promise.reject(r)})}function Ms(e,t,n){const i=Cs(e);Sr(/^https?:\/\//.test(t),i,"invalid-emulator-scheme");const r=js(t),{host:s,port:o}=function(e){const t=js(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const i=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const e=r[1];return{host:e,port:$s(i.substr(e.length+1))}}{const[e,t]=i.split(":");return{host:e,port:$s(t)}}}(t),a=null===o?"":`:${o}`,c={url:`${r}//${s}${a}/`},h=Object.freeze({host:s,port:o,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!i._canInitEmulator)return Sr(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),void Sr(On(c,i.config.emulator)&&On(h,i.emulatorConfig),i,"emulator-config-failed");i.config.emulator=c,i.emulatorConfig=h,i.settings.appVerificationDisabledForTesting=!0,yn(s)?(_n(`${r}//${s}${a}`),Tn("Auth",!0)):function(){function e(){const 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&&console.info;"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function js(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function $s(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class Fs{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return kr("not implemented")}_getIdTokenResponse(e){return kr("not implemented")}_linkToIdToken(e,t){return kr("not implemented")}_getReauthenticationResolver(e){return kr("not implemented")}}async function Bs(e,t){return jr(e,"POST","/v1/accounts:signUp",t)}async function zs(e,t){return Fr(e,"POST","/v1/accounts:signInWithPassword",Mr(e,t))}async function Hs(e,t){return jr(e,"POST","/v1/accounts:sendOobCode",Mr(e,t))}async function Vs(e,t){return Hs(e,t)}class qs extends Fs{constructor(e,t,n,i=null){super("password",n),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new qs(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new qs(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e;if(t?.email&&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){switch(this.signInMethod){case"password":return Us(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",zs);case"emailLink":return async function(e,t){return Fr(e,"POST","/v1/accounts:signInWithEmailLink",Mr(e,t))}(e,{email:this._email,oobCode:this._password});default:br(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return Us(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Bs);case"emailLink":return async function(e,t){return Fr(e,"POST","/v1/accounts:signInWithEmailLink",Mr(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:br(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Ws(e,t){return Fr(e,"POST","/v1/accounts:signInWithIdp",Mr(e,t))}class Ks extends Fs{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Ks(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):br("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:i,...r}=t;if(!n||!i)return null;const s=new Ks(n,i);return s.idToken=r.idToken||void 0,s.accessToken=r.accessToken||void 0,s.secret=r.secret,s.nonce=r.nonce,s.pendingToken=r.pendingToken||null,s}_getIdTokenResponse(e){return Ws(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Ws(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Ws(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const 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=Nn(t)}return e}}class Gs{constructor(e){const t=Dn(Ln(e)),n=t.apiKey??null,i=t.oobCode??null,r=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}}(t.mode??null);Sr(n&&i&&r,"argument-error"),this.apiKey=n,this.operation=r,this.code=i,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){const t=function(e){const t=Dn(Ln(e)).link,n=t?Dn(Ln(t)).deep_link_id:null,i=Dn(Ln(e)).deep_link_id;return(i?Dn(Ln(i)).link:null)||i||n||t||e}(e);try{return new Gs(t)}catch{return null}}}class Js{constructor(){this.providerId=Js.PROVIDER_ID}static credential(e,t){return qs._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=Gs.parseLink(t);return Sr(n,"argument-error"),qs._fromEmailAndCode(e,n.code,n.tenantId)}}Js.PROVIDER_ID="password",Js.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Js.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class Xs{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}}class Ys extends Xs{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Zs extends Ys{constructor(){super("facebook.com")}static credential(e){return Ks._fromParams({providerId:Zs.PROVIDER_ID,signInMethod:Zs.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Zs.credentialFromTaggedObject(e)}static credentialFromError(e){return Zs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return Zs.credential(e.oauthAccessToken)}catch{return null}}}Zs.FACEBOOK_SIGN_IN_METHOD="facebook.com",Zs.PROVIDER_ID="facebook.com";class Qs extends Ys{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Ks._fromParams({providerId:Qs.PROVIDER_ID,signInMethod:Qs.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return Qs.credentialFromTaggedObject(e)}static credentialFromError(e){return Qs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return Qs.credential(t,n)}catch{return null}}}Qs.GOOGLE_SIGN_IN_METHOD="google.com",Qs.PROVIDER_ID="google.com";class eo extends Ys{constructor(){super("github.com")}static credential(e){return Ks._fromParams({providerId:eo.PROVIDER_ID,signInMethod:eo.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return eo.credentialFromTaggedObject(e)}static credentialFromError(e){return eo.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return eo.credential(e.oauthAccessToken)}catch{return null}}}eo.GITHUB_SIGN_IN_METHOD="github.com",eo.PROVIDER_ID="github.com";class to extends Ys{constructor(){super("twitter.com")}static credential(e,t){return Ks._fromParams({providerId:to.PROVIDER_ID,signInMethod:to.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return to.credentialFromTaggedObject(e)}static credentialFromError(e){return to.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return to.credential(t,n)}catch{return null}}}async function no(e,t){return Fr(e,"POST","/v1/accounts:signUp",Mr(e,t))}to.TWITTER_SIGN_IN_METHOD="twitter.com",to.PROVIDER_ID="twitter.com";class io{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){const r=await ss._fromIdTokenResponse(e,n,i),s=ro(n);return new io({user:r,providerId:s,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const i=ro(n);return new io({user:e,providerId:i,_tokenResponse:n,operationType:t})}}function ro(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class so extends An{constructor(e,t,n,i){super(t.code,t.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,so.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,i){return new so(e,t,n,i)}}function oo(e,t,n,i){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw so._fromErrorAndOperation(e,n,t,i);throw n})}async function ao(e,t,n=!1){if(Zi(e.app))return Promise.reject(Er(e));const i="signIn",r=await oo(e,i,t),s=await io._fromIdTokenResponse(e,i,r);return n||await e._updateCurrentUser(s.user),s}async function co(e,t,n){if(Zi(e.app))return Promise.reject(Er(e));const i=Cs(e),r=Us(i,{returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",no),s=await r.catch(t=>{throw"auth/password-does-not-meet-requirements"===t.code&&async function(e){const t=Cs(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}(e),t}),o=await io._fromIdTokenResponse(i,"signIn",s);return await i._updateCurrentUser(o.user),o}async function ho(e,t){const n=$n(e),i={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()},{email:r}=await async function(e,t){return Hs(e,t)}(n.auth,i);r!==e.email&&await e.reload()}async function lo(e,{displayName:t,photoURL:n}){if(void 0===t&&void 0===n)return;const i=$n(e),r={idToken:await i.getIdToken(),displayName:t,photoUrl:n,returnSecureToken:!0},s=await Zr(i,async function(e,t){return jr(e,"POST","/v1/accounts:update",t)}(i.auth,r));i.displayName=s.displayName||null,i.photoURL=s.photoUrl||null;const o=i.providerData.find(({providerId:e})=>"password"===e);o&&(o.displayName=i.displayName,o.photoURL=i.photoURL),await i._updateTokensIfNecessary(s)}async function uo(e,t,n){const{auth:i}=e,r={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(r.email=t),n&&(r.password=n);const s=await Zr(e,async function(e,t){return jr(e,"POST","/v1/accounts:update",t)}(i,r));await e._updateTokensIfNecessary(s,!0)}const po="__sak";class fo{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(po,"1"),this.storage.removeItem(po),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const 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()}}class go extends fo{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Ts(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),i=this.localCache[t];n!==i&&e(t,i,n)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});const n=e.key;t?this.detachListener():this.stopPolling();const i=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},r=this.storage.getItem(n);vs()&&r!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,10):i()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const 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){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}go.type="LOCAL";const mo=go;class yo extends fo{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}yo.type="SESSION";const _o=yo;class wo{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;const n=new wo(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:i,data:r}=t.data,s=this.handlersMap[i];if(!s?.size)return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:i});const o=Array.from(s).map(async e=>e(t.origin,r)),a=await function(e){return Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}}))}(o);t.ports[0].postMessage({status:"done",eventId:n,eventType:i,response:a})}_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)}}function bo(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}wo.receivers=[];class vo{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){const i="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let r,s;return new Promise((o,a)=>{const c=bo("",20);i.port1.start();const h=setTimeout(()=>{a(new Error("unsupported_event"))},n);s={messageChannel:i,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(h),r=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(r),o(t.data.response);break;default:clearTimeout(h),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(s),i.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[i.port2])}).finally(()=>{s&&this.removeMessageHandler(s)})}}function To(){return window}function Eo(){return void 0!==To().WorkerGlobalScope&&"function"==typeof To().importScripts}const Io="firebaseLocalStorageDb",So="firebaseLocalStorage",ko="fbase_key";class Co{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 Ao(e,t){return e.transaction([So],t?"readwrite":"readonly").objectStore(So)}function Po(){const e=indexedDB.open(Io,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(So,{keyPath:ko})}catch(e){n(e)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(So)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Io);return new Co(e).toPromise()}(),t(await Po()))})})}async function Ro(e,t,n){const i=Ao(e,!0).put({[ko]:t,value:n});return new Co(i).toPromise()}function Oo(e,t){const n=Ao(e,!0).delete(t);return new Co(n).toPromise()}class xo{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 Po()),this.db}async _withRetries(e){let t=0;for(;;)try{const 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 Eo()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=wo._getInstance(Eo()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await async function(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}(),!this.activeServiceWorker)return;this.sender=new vo(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&(navigator?.serviceWorker?.controller||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Po();return await Ro(e,po,"1"),await Oo(e,po),!0}catch{}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=>Ro(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(t=>async function(e,t){const n=Ao(e,!1).get(t),i=await new Co(n).toPromise();return void 0===i?null:i.value}(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Oo(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(e=>{const t=Ao(e,!1).getAll();return new Co(t).toPromise()});if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:i,value:r}of e)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(r)&&(this.notifyListeners(i,r),t.push(i));for(const 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;const n=this.listeners[e];if(n)for(const 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()}}xo.type="LOCAL";const No=xo;new Or(3e4,6e4);class Do extends Fs{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Ws(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Ws(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Ws(e,this._buildIdpRequest())}_buildIdpRequest(e){const 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 Lo(e){return ao(e.auth,new Do(e),e.bypassAuthState)}function Uo(e){const{auth:t,user:n}=e;return Sr(n,t,"internal-error"),async function(e,t,n=!1){const{auth:i}=e;if(Zi(i.app))return Promise.reject(Er(i));const r="reauthenticate";try{const s=await Zr(e,oo(i,r,t,e),n);Sr(s.idToken,i,"internal-error");const o=Xr(s.idToken);Sr(o,i,"internal-error");const{sub:a}=o;return Sr(e.uid===a,i,"user-mismatch"),io._forOperation(e,r,s)}catch(e){throw"auth/user-not-found"===e?.code&&br(i,"user-mismatch"),e}}(n,new Do(e),e.bypassAuthState)}async function Mo(e){const{auth:t,user:n}=e;return Sr(n,t,"internal-error"),async function(e,t,n=!1){const i=await Zr(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return io._forOperation(e,"link",i)}(n,new Do(e),e.bypassAuthState)}class jo{constructor(e,t,n,i,r=!1){this.auth=e,this.resolver=n,this.user=i,this.bypassAuthState=r,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){const{urlResponse:t,sessionId:n,postBody:i,tenantId:r,error:s,type:o}=e;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:r||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Lo;case"linkViaPopup":case"linkViaRedirect":return Mo;case"reauthViaPopup":case"reauthViaRedirect":return Uo;default:br(this.auth,"internal-error")}}resolve(e){Cr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Cr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const $o=new Or(2e3,1e4);class Fo extends jo{constructor(e,t,n,i,r){super(e,t,i,r),this.provider=n,this.authWindow=null,this.pollId=null,Fo.currentPopupAction&&Fo.currentPopupAction.cancel(),Fo.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Sr(e,this.auth,"internal-error"),e}async onExecution(){Cr(1===this.filter.length,"Popup operations only handle one event");const e=bo();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(vr(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(vr(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Fo.currentPopupAction=null}pollUserCancellation(){const e=()=>{this.authWindow?.window?.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(vr(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(e,$o.get())};e()}}Fo.currentPopupAction=null;const Bo="pendingRedirect",zo=new Map;class Ho extends jo{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=zo.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=function(e){return ls(Bo,e.config.apiKey,e.name)}(t),i=function(e){return as(e._redirectPersistence)}(e);if(!await i._isAvailable())return!1;const r="true"===await i._get(n);return await i._remove(n),r}(this.resolver,this.auth),n=t?await super.execute():null;e=()=>Promise.resolve(n)}catch(t){e=()=>Promise.reject(t)}zo.set(this.auth._key(),e)}return this.bypassAuthState||zo.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Vo(e,t){zo.set(e._key(),t)}async function qo(e,t,n=!1){if(Zi(e.app))return Promise.reject(Er(e));const i=Cs(e),r=function(e,t){return t?as(t):(Sr(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(i,t),s=new Ho(i,r,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,t)),o}class Wo{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 Go(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!Go(e)){const n=e.error.code?.split("auth/")[1]||"internal-error";t.onError(vr(this.auth,n))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const 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(Ko(e))}saveEventToCache(e){this.cachedEventUids.add(Ko(e)),this.lastProcessedEventTime=Date.now()}}function Ko(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function Go({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===t?.code}const Jo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Xo=/^https?/;async function Yo(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return jr(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(Zo(e))return}catch{}br(e,"unauthorized-domain")}function Zo(e){const t=Ar(),{protocol:n,hostname:i}=new URL(t);if(e.startsWith("chrome-extension://")){const r=new URL(e);return""===r.hostname&&""===i?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===i}if(!Xo.test(n))return!1;if(Jo.test(e))return i===e;const r=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}const Qo=new Or(3e4,6e4);function ea(){const e=To().___jsl;if(e?.H)for(const 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}function ta(e){return new Promise((t,n)=>{function i(){ea(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{ea(),n(vr(e,"network-request-failed"))},timeout:Qo.get()})}if(To().gapi?.iframes?.Iframe)t(gapi.iframes.getContext());else{if(!To().gapi?.load){const t=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return To()[t]=()=>{gapi.load?i():n(vr(e,"network-request-failed"))},Rs(`${Ps.gapiScript}?onload=${t}`).catch(e=>n(e))}i()}}).catch(e=>{throw na=null,e})}let na=null;const ia=new Or(5e3,15e3),ra={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},sa=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function oa(e){const t=e.config;Sr(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?xr(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,i={apiKey:t.apiKey,appName:e.name,v:tr},r=sa.get(e.config.apiHost);r&&(i.eid=r);const s=e._getFrameworks();return s.length&&(i.fw=s.join(",")),`${n}?${Nn(i).slice(1)}`}async function aa(e){const t=await function(e){return na=na||ta(e),na}(e),n=To().gapi;return Sr(n,e,"internal-error"),t.open({where:document.body,url:oa(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:ra,dontclear:!0},t=>new Promise(async(n,i)=>{await t.restyle({setHideOnLeave:!1});const r=vr(e,"network-request-failed"),s=To().setTimeout(()=>{i(r)},ia.get());function o(){To().clearTimeout(s),n(t)}t.ping(o).then(o,()=>{i(r)})}))}const ca={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class ha{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function la(e,t,n,i=500,r=600){const s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const c={...ca,width:i.toString(),height:r.toString(),top:s,left:o},h=En().toLowerCase();n&&(a=gs(h)?"_blank":n),ps(h)&&(t=t||"http://localhost",c.scrollbars="yes");const l=Object.entries(c).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=En()){return bs(e)&&!!window.navigator?.standalone}(h)&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const 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||"",a),new ha(null);const u=window.open(t||"",a,l);Sr(u,e,"popup-blocked");try{u.focus()}catch(e){}return new ha(u)}const ua="__/auth/handler",da="emulator/auth/handler",pa=encodeURIComponent("fac");async function fa(e,t,n,i,r,s){Sr(e.config.authDomain,e,"auth-domain-config-required"),Sr(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:i,v:tr,eventId:r};if(t instanceof Xs){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries({}))o[e]=t}if(t instanceof Ys){const e=t.getScopes().filter(e=>""!==e);e.length>0&&(o.scopes=e.join(","))}e.tenantId&&(o.tid=e.tenantId);const a=o;for(const e of Object.keys(a))void 0===a[e]&&delete a[e];const c=await e._getAppCheckToken(),h=c?`#${pa}=${encodeURIComponent(c)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${ua}`;return xr(e,da)}(e)}?${Nn(a).slice(1)}${h}`}const ga="webStorageSupport";const ma=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=_o,this._completeRedirectFn=qo,this._overrideRedirectResult=Vo}async _openPopup(e,t,n,i){Cr(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");return la(e,await fa(e,t,n,Ar(),i),bo())}async _openRedirect(e,t,n,i){await this._originValidation(e);return function(e){To().location.href=e}(await fa(e,t,n,Ar(),i)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(Cr(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){const t=await aa(e),n=new Wo(e);return t.register("authEvent",t=>{Sr(t?.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(ga,{type:ga},n=>{const i=n?.[0]?.[ga];void 0!==i&&t(!!i),br(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Yo(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Ts()||fs()||bs()}};var ya="@firebase/auth",_a="1.11.1";class wa{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){Sr(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const ba=gn("authIdTokenMaxAge")||300;let va=null;function Ta(e=ir()){const t=Yi(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=Yi(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(On(n.getOptions(),t??{}))return e;br(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:ma,persistence:[No,mo,_o]}),i=gn("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(i,location.origin);if(location.origin===e.origin){const t=(r=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>ba)return;const i=t?.token;va!==i&&(va=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(e,t,n){$n(e).beforeAuthStateChanged(t,n)}(n,t,()=>t(n.currentUser)),function(e,t,n,i){$n(e).onIdTokenChanged(t,n,i)}(n,e=>t(e))}}var r;const s=dn("auth");return s&&Ms(n,`http://${s}`),n}var Ea;!function(e){Ps=e}({loadJS:e=>new Promise((t,n)=>{const i=document.createElement("script");i.setAttribute("src",e),i.onload=t,i.onerror=e=>{const t=vr("internal-error");t.customData=e,n(t)},i.type="text/javascript",i.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(i)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),Ea="Browser",Xi(new Fn("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),r=e.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Sr(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:Ea,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Es(Ea)},c=new ks(n,i,r,a);return function(e,t){const n=t?.persistence||[],i=(Array.isArray(n)?n:[n]).map(as);t?.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(i,t?.popupRedirectResolver)}(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Xi(new Fn("auth-internal",e=>(e=>new wa(e))(Cs(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),rr(ya,_a,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Ea)),rr(ya,_a,"esm2020");rr("firebase","12.5.0","app");var Ia,Sa="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var e;function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}function n(e,t,n){n||(n=0);const i=Array(16);if("string"==typeof t)for(var r=0;r<16;++r)i[r]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(r=0;r<16;++r)i[r]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],r=e.g[2];let s,o=e.g[3];s=t+(o^n&(r^o))+i[0]+3614090360&4294967295,s=o+(r^(t=n+(s<<7&4294967295|s>>>25))&(n^r))+i[1]+3905402710&4294967295,o=t+(s<<12&4294967295|s>>>20),s=r+(n^o&(t^n))+i[2]+606105819&4294967295,s=n+(t^(r=o+(s<<17&4294967295|s>>>15))&(o^t))+i[3]+3250441966&4294967295,s=t+(o^(n=r+(s<<22&4294967295|s>>>10))&(r^o))+i[4]+4118548399&4294967295,s=o+(r^(t=n+(s<<7&4294967295|s>>>25))&(n^r))+i[5]+1200080426&4294967295,o=t+(s<<12&4294967295|s>>>20),s=r+(n^o&(t^n))+i[6]+2821735955&4294967295,s=n+(t^(r=o+(s<<17&4294967295|s>>>15))&(o^t))+i[7]+4249261313&4294967295,s=t+(o^(n=r+(s<<22&4294967295|s>>>10))&(r^o))+i[8]+1770035416&4294967295,s=o+(r^(t=n+(s<<7&4294967295|s>>>25))&(n^r))+i[9]+2336552879&4294967295,o=t+(s<<12&4294967295|s>>>20),s=r+(n^o&(t^n))+i[10]+4294925233&4294967295,s=n+(t^(r=o+(s<<17&4294967295|s>>>15))&(o^t))+i[11]+2304563134&4294967295,s=t+(o^(n=r+(s<<22&4294967295|s>>>10))&(r^o))+i[12]+1804603682&4294967295,s=o+(r^(t=n+(s<<7&4294967295|s>>>25))&(n^r))+i[13]+4254626195&4294967295,o=t+(s<<12&4294967295|s>>>20),s=r+(n^o&(t^n))+i[14]+2792965006&4294967295,s=n+(t^(r=o+(s<<17&4294967295|s>>>15))&(o^t))+i[15]+1236535329&4294967295,s=t+(r^o&((n=r+(s<<22&4294967295|s>>>10))^r))+i[1]+4129170786&4294967295,s=o+(n^r&((t=n+(s<<5&4294967295|s>>>27))^n))+i[6]+3225465664&4294967295,o=t+(s<<9&4294967295|s>>>23),s=r+(t^n&(o^t))+i[11]+643717713&4294967295,s=n+(o^t&((r=o+(s<<14&4294967295|s>>>18))^o))+i[0]+3921069994&4294967295,s=t+(r^o&((n=r+(s<<20&4294967295|s>>>12))^r))+i[5]+3593408605&4294967295,s=o+(n^r&((t=n+(s<<5&4294967295|s>>>27))^n))+i[10]+38016083&4294967295,o=t+(s<<9&4294967295|s>>>23),s=r+(t^n&(o^t))+i[15]+3634488961&4294967295,s=n+(o^t&((r=o+(s<<14&4294967295|s>>>18))^o))+i[4]+3889429448&4294967295,s=t+(r^o&((n=r+(s<<20&4294967295|s>>>12))^r))+i[9]+568446438&4294967295,s=o+(n^r&((t=n+(s<<5&4294967295|s>>>27))^n))+i[14]+3275163606&4294967295,o=t+(s<<9&4294967295|s>>>23),s=r+(t^n&(o^t))+i[3]+4107603335&4294967295,s=n+(o^t&((r=o+(s<<14&4294967295|s>>>18))^o))+i[8]+1163531501&4294967295,s=t+(r^o&((n=r+(s<<20&4294967295|s>>>12))^r))+i[13]+2850285829&4294967295,s=o+(n^r&((t=n+(s<<5&4294967295|s>>>27))^n))+i[2]+4243563512&4294967295,o=t+(s<<9&4294967295|s>>>23),s=r+(t^n&(o^t))+i[7]+1735328473&4294967295,s=n+(o^t&((r=o+(s<<14&4294967295|s>>>18))^o))+i[12]+2368359562&4294967295,s=t+((n=r+(s<<20&4294967295|s>>>12))^r^o)+i[5]+4294588738&4294967295,s=o+((t=n+(s<<4&4294967295|s>>>28))^n^r)+i[8]+2272392833&4294967295,o=t+(s<<11&4294967295|s>>>21),s=r+(o^t^n)+i[11]+1839030562&4294967295,s=n+((r=o+(s<<16&4294967295|s>>>16))^o^t)+i[14]+4259657740&4294967295,s=t+((n=r+(s<<23&4294967295|s>>>9))^r^o)+i[1]+2763975236&4294967295,s=o+((t=n+(s<<4&4294967295|s>>>28))^n^r)+i[4]+1272893353&4294967295,o=t+(s<<11&4294967295|s>>>21),s=r+(o^t^n)+i[7]+4139469664&4294967295,s=n+((r=o+(s<<16&4294967295|s>>>16))^o^t)+i[10]+3200236656&4294967295,s=t+((n=r+(s<<23&4294967295|s>>>9))^r^o)+i[13]+681279174&4294967295,s=o+((t=n+(s<<4&4294967295|s>>>28))^n^r)+i[0]+3936430074&4294967295,o=t+(s<<11&4294967295|s>>>21),s=r+(o^t^n)+i[3]+3572445317&4294967295,s=n+((r=o+(s<<16&4294967295|s>>>16))^o^t)+i[6]+76029189&4294967295,s=t+((n=r+(s<<23&4294967295|s>>>9))^r^o)+i[9]+3654602809&4294967295,s=o+((t=n+(s<<4&4294967295|s>>>28))^n^r)+i[12]+3873151461&4294967295,o=t+(s<<11&4294967295|s>>>21),s=r+(o^t^n)+i[15]+530742520&4294967295,s=n+((r=o+(s<<16&4294967295|s>>>16))^o^t)+i[2]+3299628645&4294967295,s=t+(r^((n=r+(s<<23&4294967295|s>>>9))|~o))+i[0]+4096336452&4294967295,s=o+(n^((t=n+(s<<6&4294967295|s>>>26))|~r))+i[7]+1126891415&4294967295,o=t+(s<<10&4294967295|s>>>22),s=r+(t^(o|~n))+i[14]+2878612391&4294967295,s=n+(o^((r=o+(s<<15&4294967295|s>>>17))|~t))+i[5]+4237533241&4294967295,s=t+(r^((n=r+(s<<21&4294967295|s>>>11))|~o))+i[12]+1700485571&4294967295,s=o+(n^((t=n+(s<<6&4294967295|s>>>26))|~r))+i[3]+2399980690&4294967295,o=t+(s<<10&4294967295|s>>>22),s=r+(t^(o|~n))+i[10]+4293915773&4294967295,s=n+(o^((r=o+(s<<15&4294967295|s>>>17))|~t))+i[1]+2240044497&4294967295,s=t+(r^((n=r+(s<<21&4294967295|s>>>11))|~o))+i[8]+1873313359&4294967295,s=o+(n^((t=n+(s<<6&4294967295|s>>>26))|~r))+i[15]+4264355552&4294967295,o=t+(s<<10&4294967295|s>>>22),s=r+(t^(o|~n))+i[6]+2734768916&4294967295,s=n+(o^((r=o+(s<<15&4294967295|s>>>17))|~t))+i[13]+1309151649&4294967295,s=t+(r^((n=r+(s<<21&4294967295|s>>>11))|~o))+i[4]+4149444226&4294967295,s=o+(n^((t=n+(s<<6&4294967295|s>>>26))|~r))+i[11]+3174756917&4294967295,o=t+(s<<10&4294967295|s>>>22),s=r+(t^(o|~n))+i[2]+718787259&4294967295,s=n+(o^((r=o+(s<<15&4294967295|s>>>17))|~t))+i[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(r+(s<<21&4294967295|s>>>11))&4294967295,e.g[2]=e.g[2]+r&4294967295,e.g[3]=e.g[3]+o&4294967295}function i(e,t){this.h=t;const n=[];let i=!0;for(let r=e.length-1;r>=0;r--){const s=0|e[r];i&&s==t||(n[r]=s,i=!1)}this.g=n}!function(e,t){function n(){}n.prototype=t.prototype,e.F=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.D=function(e,n,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)}}(t,function(){this.blockSize=-1}),t.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},t.prototype.v=function(e,t){void 0===t&&(t=e.length);const i=t-this.blockSize,r=this.C;let s=this.h,o=0;for(;o<t;){if(0==s)for(;o<=i;)n(this,e,o),o+=this.blockSize;if("string"==typeof e){for(;o<t;)if(r[s++]=e.charCodeAt(o++),s==this.blockSize){n(this,r),s=0;break}}else for(;o<t;)if(r[s++]=e[o++],s==this.blockSize){n(this,r),s=0;break}}this.h=s,this.o+=t},t.prototype.A=function(){var e=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;t=8*this.o;for(var n=e.length-8;n<e.length;++n)e[n]=255&t,t/=256;for(this.v(e),e=Array(16),t=0,n=0;n<4;++n)for(let i=0;i<32;i+=8)e[t++]=this.g[n]>>>i&255;return e};var r={};function s(e){return-128<=e&&e<128?function(e,t){var n=r;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,function(e){return new i([0|e],e<0?-1:0)}):new i([0|e],e<0?-1:0)}function o(e){if(isNaN(e)||!isFinite(e))return a;if(e<0)return d(o(-e));const t=[];let n=1;for(let i=0;e>=n;i++)t[i]=e/n|0,n*=4294967296;return new i(t,0)}var a=s(0),c=s(1),h=s(16777216);function l(e){if(0!=e.h)return!1;for(let t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function u(e){return-1==e.h}function d(e){const t=e.g.length,n=[];for(let i=0;i<t;i++)n[i]=~e.g[i];return new i(n,~e.h).add(c)}function p(e,t){return e.add(d(t))}function f(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function g(e,t){this.g=e,this.h=t}function m(e,t){if(l(t))throw Error("division by zero");if(l(e))return new g(a,a);if(u(e))return t=m(d(e),t),new g(d(t.g),d(t.h));if(u(t))return t=m(e,d(t)),new g(d(t.g),t.h);if(e.g.length>30){if(u(e)||u(t))throw Error("slowDivide_ only works with positive integers.");for(var n=c,i=t;i.l(e)<=0;)n=y(n),i=y(i);var r=_(n,1),s=_(i,1);for(i=_(i,2),n=_(n,2);!l(i);){var h=s.add(i);h.l(e)<=0&&(r=r.add(n),s=h),i=_(i,1),n=_(n,1)}return t=p(e,r.j(t)),new g(r,t)}for(r=a;e.l(t)>=0;){for(n=Math.max(1,Math.floor(e.m()/t.m())),i=(i=Math.ceil(Math.log(n)/Math.LN2))<=48?1:Math.pow(2,i-48),h=(s=o(n)).j(t);u(h)||h.l(e)>0;)h=(s=o(n-=i)).j(t);l(s)&&(s=c),r=r.add(s),e=p(e,h)}return new g(r,e)}function y(e){const t=e.g.length+1,n=[];for(let i=0;i<t;i++)n[i]=e.i(i)<<1|e.i(i-1)>>>31;return new i(n,e.h)}function _(e,t){const n=t>>5;t%=32;const r=e.g.length-n,s=[];for(let i=0;i<r;i++)s[i]=t>0?e.i(i+n)>>>t|e.i(i+n+1)<<32-t:e.i(i+n);return new i(s,e.h)}(e=i.prototype).m=function(){if(u(this))return-d(this).m();let e=0,t=1;for(let n=0;n<this.g.length;n++){const i=this.i(n);e+=(i>=0?i:4294967296+i)*t,t*=4294967296}return e},e.toString=function(e){if((e=e||10)<2||36<e)throw Error("radix out of range: "+e);if(l(this))return"0";if(u(this))return"-"+d(this).toString(e);const t=o(Math.pow(e,6));var n=this;let i="";for(;;){const r=m(n,t).g;let s=(((n=p(n,r.j(t))).g.length>0?n.g[0]:n.h)>>>0).toString(e);if(l(n=r))return s+i;for(;s.length<6;)s="0"+s;i=s+i}},e.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return u(e=p(this,e))?-1:l(e)?0:1},e.abs=function(){return u(this)?d(this):this},e.add=function(e){const t=Math.max(this.g.length,e.g.length),n=[];let r=0;for(let i=0;i<=t;i++){let t=r+(65535&this.i(i))+(65535&e.i(i)),s=(t>>>16)+(this.i(i)>>>16)+(e.i(i)>>>16);r=s>>>16,t&=65535,s&=65535,n[i]=s<<16|t}return new i(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(l(this)||l(e))return a;if(u(this))return u(e)?d(this).j(d(e)):d(d(this).j(e));if(u(e))return d(this.j(d(e)));if(this.l(h)<0&&e.l(h)<0)return o(this.m()*e.m());const t=this.g.length+e.g.length,n=[];for(var r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(let t=0;t<e.g.length;t++){const i=this.i(r)>>>16,s=65535&this.i(r),o=e.i(t)>>>16,a=65535&e.i(t);n[2*r+2*t]+=s*a,f(n,2*r+2*t),n[2*r+2*t+1]+=i*a,f(n,2*r+2*t+1),n[2*r+2*t+1]+=s*o,f(n,2*r+2*t+1),n[2*r+2*t+2]+=i*o,f(n,2*r+2*t+2)}for(e=0;e<t;e++)n[e]=n[2*e+1]<<16|n[2*e];for(e=t;e<2*t;e++)n[e]=0;return new i(n,0)},e.B=function(e){return m(this,e).h},e.and=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let i=0;i<t;i++)n[i]=this.i(i)&e.i(i);return new i(n,this.h&e.h)},e.or=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let i=0;i<t;i++)n[i]=this.i(i)|e.i(i);return new i(n,this.h|e.h)},e.xor=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let i=0;i<t;i++)n[i]=this.i(i)^e.i(i);return new i(n,this.h^e.h)},t.prototype.digest=t.prototype.A,t.prototype.reset=t.prototype.u,t.prototype.update=t.prototype.v,i.prototype.add=i.prototype.add,i.prototype.multiply=i.prototype.j,i.prototype.modulo=i.prototype.B,i.prototype.compare=i.prototype.l,i.prototype.toNumber=i.prototype.m,i.prototype.toString=i.prototype.toString,i.prototype.getBits=i.prototype.i,i.fromNumber=o,i.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if((n=n||10)<2||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return d(e(t.substring(1),n));if(t.indexOf("-")>=0)throw Error('number format error: interior "-" character');const i=o(Math.pow(n,8));let r=a;for(let e=0;e<t.length;e+=8){var s=Math.min(8,t.length-e);const a=parseInt(t.substring(e,e+s),n);s<8?(s=o(Math.pow(n,s)),r=r.j(s).add(o(a))):(r=r.j(i),r=r.add(o(a)))}return r},Ia=i}).apply(void 0!==Sa?Sa:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ka="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var e,t=Object.defineProperty;var n=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof ka&&ka];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function i(e,i){if(i)e:{var r=n;e=e.split(".");for(var s=0;s<e.length-1;s++){var o=e[s];if(!(o in r))break e;r=r[o]}(i=i(s=r[e=e[e.length-1]]))!=s&&null!=i&&t(r,e,{configurable:!0,writable:!0,value:i})}}i("Symbol.dispose",function(e){return e||Symbol("Symbol.dispose")}),i("Array.prototype.values",function(e){return e||function(){return this[Symbol.iterator]()}}),i("Object.entries",function(e){return e||function(e){var t,n=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push([t,e[t]]);return n}});var r=r||{},s=this||self;function o(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function a(e,t,n){return e.call.apply(e.bind,arguments)}function c(e,t,n){return(c=a).apply(null,arguments)}function h(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 l(e,t){function n(){}n.prototype=t.prototype,e.Z=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Ob=function(e,n,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)}}var u="undefined"!=typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function d(e){const t=e.length;if(t>0){const n=Array(t);for(let i=0;i<t;i++)n[i]=e[i];return n}return[]}function p(e,t){for(let t=1;t<arguments.length;t++){const i=arguments[t];var n=typeof i;if("array"==(n="object"!=n?n:i?Array.isArray(i)?"array":n:"null")||"object"==n&&"number"==typeof i.length){n=e.length||0;const t=i.length||0;e.length=n+t;for(let r=0;r<t;r++)e[n+r]=i[r]}else e.push(i)}}function f(e){s.setTimeout(()=>{throw e},0)}function g(){var e=b;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var m=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return this.h>0?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new y,e=>e.reset());class y{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 _,w=!1,b=new class{constructor(){this.h=this.g=null}add(e,t){const n=m.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},v=()=>{const e=Promise.resolve(void 0);_=()=>{e.then(T)}};function T(){for(var e;e=g();){try{e.h.call(e.g)}catch(e){f(e)}var t=m;t.j(e),t.h<100&&(t.h++,e.next=t.g,t.g=e)}w=!1}function E(){this.u=this.u,this.C=this.C}function I(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}E.prototype.u=!1,E.prototype.dispose=function(){this.u||(this.u=!0,this.N())},E.prototype[Symbol.dispose]=function(){this.dispose()},E.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},I.prototype.h=function(){this.defaultPrevented=!0};var S=function(){if(!s.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};s.addEventListener("test",e,t),s.removeEventListener("test",e,t)}catch(e){}return e}();function k(e){return/^[\s\xa0]*$/.test(e)}function C(e,t){I.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&&this.init(e,t)}l(C,I),C.prototype.init=function(e,t){const n=this.type=e.type,i=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,(t=e.relatedTarget)||("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=e.pointerType,this.state=e.state,this.i=e,e.defaultPrevented&&C.Z.h.call(this)},C.prototype.h=function(){C.Z.h.call(this);const e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var A="closure_listenable_"+(1e6*Math.random()|0),P=0;function R(e,t,n,i,r){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!i,this.ha=r,this.key=++P,this.da=this.fa=!1}function O(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function x(e,t,n){for(const i in e)t.call(n,e[i],i,e)}function N(e){const t={};for(const n in e)t[n]=e[n];return t}const D="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function L(e,t){let n,i;for(let t=1;t<arguments.length;t++){for(n in i=arguments[t],i)e[n]=i[n];for(let t=0;t<D.length;t++)n=D[t],Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}}function U(e){this.src=e,this.g={},this.h=0}function M(e,t){const n=t.type;if(n in e.g){var i,r=e.g[n],s=Array.prototype.indexOf.call(r,t,void 0);(i=s>=0)&&Array.prototype.splice.call(r,s,1),i&&(O(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function j(e,t,n,i){for(let r=0;r<e.length;++r){const s=e[r];if(!s.da&&s.listener==t&&s.capture==!!n&&s.ha==i)return r}return-1}U.prototype.add=function(e,t,n,i,r){const s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);const o=j(e,t,i,r);return o>-1?(t=e[o],n||(t.fa=!1)):((t=new R(t,this.src,s,!!i,r)).fa=n,e.push(t)),t};var $="closure_lm_"+(1e6*Math.random()|0),F={};function B(e,t,n,i,r){if(Array.isArray(t)){for(let s=0;s<t.length;s++)B(e,t[s],n,i,r);return null}return n=G(n),e&&e[A]?e.J(t,n,!!o(i)&&!!i.capture,r):function(e,t,n,i,r,s){if(!t)throw Error("Invalid event type");const a=o(r)?!!r.capture:!!r;let c=W(e);if(c||(e[$]=c=new U(e)),n=c.add(t,n,i,a,s),n.proxy)return n;if(i=function(){function e(n){return t.call(e.src,e.listener,n)}const t=q;return e}(),n.proxy=i,i.src=e,i.listener=n,e.addEventListener)S||(r=a),void 0===r&&(r=!1),e.addEventListener(t.toString(),i,r);else if(e.attachEvent)e.attachEvent(V(t.toString()),i);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(i)}return n}(e,t,n,!1,i,r)}function z(e,t,n,i,r){if(Array.isArray(t))for(var s=0;s<t.length;s++)z(e,t[s],n,i,r);else i=o(i)?!!i.capture:!!i,n=G(n),e&&e[A]?(e=e.i,(s=String(t).toString())in e.g&&((n=j(t=e.g[s],n,i,r))>-1&&(O(t[n]),Array.prototype.splice.call(t,n,1),0==t.length&&(delete e.g[s],e.h--)))):e&&(e=W(e))&&(t=e.g[t.toString()],e=-1,t&&(e=j(t,n,i,r)),(n=e>-1?t[e]:null)&&H(n))}function H(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[A])M(t.i,e);else{var n=e.type,i=e.proxy;t.removeEventListener?t.removeEventListener(n,i,e.capture):t.detachEvent?t.detachEvent(V(n),i):t.addListener&&t.removeListener&&t.removeListener(i),(n=W(t))?(M(n,e),0==n.h&&(n.src=null,t[$]=null)):O(e)}}}function V(e){return e in F?F[e]:F[e]="on"+e}function q(e,t){if(e.da)e=!0;else{t=new C(t,this);const n=e.listener,i=e.ha||e.src;e.fa&&H(e),e=n.call(i,t)}return e}function W(e){return(e=e[$])instanceof U?e:null}var K="__closure_events_fn_"+(1e9*Math.random()>>>0);function G(e){return"function"==typeof e?e:(e[K]||(e[K]=function(t){return e.handleEvent(t)}),e[K])}function J(){E.call(this),this.i=new U(this),this.M=this,this.G=null}function X(e,t){var n,i=e.G;if(i)for(n=[];i;i=i.G)n.push(i);if(e=e.M,i=t.type||t,"string"==typeof t)t=new I(t,e);else if(t instanceof I)t.target=t.target||e;else{var r=t;L(t=new I(i,e),r)}let s,o;if(r=!0,n)for(o=n.length-1;o>=0;o--)s=t.g=n[o],r=Y(s,i,!0,t)&&r;if(s=t.g=e,r=Y(s,i,!0,t)&&r,r=Y(s,i,!1,t)&&r,n)for(o=0;o<n.length;o++)s=t.g=n[o],r=Y(s,i,!1,t)&&r}function Y(e,t,n,i){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();let r=!0;for(let s=0;s<t.length;++s){const o=t[s];if(o&&!o.da&&o.capture==n){const t=o.listener,n=o.ha||o.src;o.fa&&M(e.i,o),r=!1!==t.call(n,i)&&r}}return r&&!i.defaultPrevented}function Z(e){e.g=function(e,t){if("function"!=typeof e){if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=c(e.handleEvent,e)}return Number(t)>2147483647?-1:s.setTimeout(e,t||0)}(()=>{e.g=null,e.i&&(e.i=!1,Z(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}l(J,E),J.prototype[A]=!0,J.prototype.removeEventListener=function(e,t,n,i){z(this,e,t,n,i)},J.prototype.N=function(){if(J.Z.N.call(this),this.i){var e=this.i;for(const t in e.g){const n=e.g[t];for(let e=0;e<n.length;e++)O(n[e]);delete e.g[t],e.h--}}this.G=null},J.prototype.J=function(e,t,n,i){return this.i.add(String(e),t,!1,n,i)},J.prototype.K=function(e,t,n,i){return this.i.add(String(e),t,!0,n,i)};class Q extends E{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:Z(this)}N(){super.N(),this.g&&(s.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ee(e){E.call(this),this.h=e,this.g={}}l(ee,E);var te=[];function ne(e){x(e.g,function(e,t){this.g.hasOwnProperty(t)&&H(e)},e),e.g={}}ee.prototype.N=function(){ee.Z.N.call(this),ne(this)},ee.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ie=s.JSON.stringify,re=s.JSON.parse,se=class{stringify(e){return s.JSON.stringify(e,void 0)}parse(e){return s.JSON.parse(e,void 0)}};function oe(){}var ae={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function ce(){I.call(this,"d")}function he(){I.call(this,"c")}l(ce,I),l(he,I);var le={},ue=null;function de(){return ue=ue||new J}function pe(e){I.call(this,le.Ia,e)}function fe(e){const t=de();X(t,new pe(t))}function ge(e,t){I.call(this,le.STAT_EVENT,e),this.stat=t}function me(e){const t=de();X(t,new ge(t,e))}function ye(e,t){I.call(this,le.Ja,e),this.size=t}function _e(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return s.setTimeout(function(){e()},t)}function we(){this.g=!0}function be(e,t,n,i){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{const s=JSON.parse(t);if(s)for(e=0;e<s.length;e++)if(Array.isArray(s[e])){var n=s[e];if(!(n.length<2)){var i=n[1];if(Array.isArray(i)&&!(i.length<1)){var r=i[0];if("noop"!=r&&"stop"!=r&&"close"!=r)for(let e=1;e<i.length;e++)i[e]=""}}}return ie(s)}catch(e){return t}}(e,n)+(i?" "+i:"")})}le.Ia="serverreachability",l(pe,I),le.STAT_EVENT="statevent",l(ge,I),le.Ja="timingevent",l(ye,I),we.prototype.ua=function(){this.g=!1},we.prototype.info=function(){};var ve,Te={NO_ERROR:0,TIMEOUT:8};function Ee(){}function Ie(e){return encodeURIComponent(String(e))}function Se(e){var t=1;e=e.split(":");const n=[];for(;t>0&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function ke(e,t,n,i){this.j=e,this.i=t,this.l=n,this.S=i||1,this.V=new ee(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Ce}function Ce(){this.i=null,this.g="",this.h=!1}l(Ee,oe),Ee.prototype.g=function(){return new XMLHttpRequest},ve=new Ee;var Ae={},Pe={};function Re(e,t,n){e.M=1,e.A=tt(Xe(t)),e.u=n,e.R=!0,Oe(e,null)}function Oe(e,t){e.F=Date.now(),De(e),e.B=Xe(e.A);var n=e.B,i=e.S;Array.isArray(i)||(i=[String(i)]),gt(n.i,"t",i),e.C=0,n=e.j.L,e.h=new Ce,e.g=tn(e.j,n?t:null,!e.u),e.P>0&&(e.O=new Q(c(e.Y,e,e.g),e.P)),t=e.V,n=e.g,i=e.ba;var r="readystatechange";Array.isArray(r)||(r&&(te[0]=r.toString()),r=te);for(let e=0;e<r.length;e++){const s=B(n,r[e],i||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}t=e.J?N(e.J):{},e.u?(e.v||(e.v="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.B,e.v,e.u,t)):(e.v="GET",e.g.ea(e.B,e.v,null,t)),fe(),function(e,t,n,i,r,s){e.info(function(){if(e.g)if(s){var o="",a=s.split("&");for(let e=0;e<a.length;e++){var c=a[e].split("=");if(c.length>1){const e=c[0];c=c[1];const t=e.split("_");o=t.length>=2&&"type"==t[1]?o+(e+"=")+c+"&":o+(e+"=redacted&")}}}else o=null;else o=s;return"XMLHTTP REQ ("+i+") [attempt "+r+"]: "+t+"\n"+n+"\n"+o})}(e.i,e.v,e.B,e.l,e.S,e.u)}function xe(e){return!!e.g&&("GET"==e.v&&2!=e.M&&e.j.Aa)}function Ne(e,t){var n=e.C,i=t.indexOf("\n",n);return-1==i?Pe:(n=Number(t.substring(n,i)),isNaN(n)?Ae:(i+=1)+n>t.length?Pe:(t=t.slice(i,i+n),e.C=i+n,t))}function De(e){e.T=Date.now()+e.H,Le(e,e.H)}function Le(e,t){if(null!=e.D)throw Error("WatchDog timer not null");e.D=_e(c(e.aa,e),t)}function Ue(e){e.D&&(s.clearTimeout(e.D),e.D=null)}function Me(e){0==e.j.I||e.K||Xt(e.j,e)}function je(e){Ue(e);var t=e.O;t&&"function"==typeof t.dispose&&t.dispose(),e.O=null,ne(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dispose())}function $e(e,t){try{var n=e.j;if(0!=n.I&&(n.g==e||Ve(n.h,e)))if(!e.L&&Ve(n.h,e)&&3==n.I){try{var i=n.Ba.g.parse(t)}catch(e){i=null}if(Array.isArray(i)&&3==i.length){var r=i;if(0==r[0]){e:if(!n.v){if(n.g){if(!(n.g.F+3e3<e.F))break e;Jt(n),$t(n)}Wt(n),me(18)}}else n.xa=r[1],0<n.xa-n.K&&r[2]<37500&&n.F&&0==n.A&&!n.C&&(n.C=_e(c(n.Va,n),6e3));He(n.h)<=1&&n.ta&&(n.ta=void 0)}else Zt(n,11)}else if((e.L||n.g==e)&&Jt(n),!k(t))for(r=n.Ba.g.parse(t),t=0;t<r.length;t++){let c=r[t];const l=c[0];if(!(l<=n.K))if(n.K=l,c=c[1],2==n.I)if("c"==c[0]){n.M=c[1],n.ba=c[2];const t=c[3];null!=t&&(n.ka=t,n.j.info("VER="+n.ka));const r=c[4];null!=r&&(n.za=r,n.j.info("SVER="+n.za));const l=c[5];null!=l&&"number"==typeof l&&l>0&&(i=1.5*l,n.O=i,n.j.info("backChannelRequestTimeoutMs_="+i)),i=n;const u=e.g;if(u){const e=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=i.h;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(qe(s,s.h),s.h=null))}if(i.G){const e=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(i.wa=e,et(i.J,i.G,e))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-e.F,n.j.info("Handshake RTT: "+n.T+"ms"));var o=e;if((i=n).na=en(i,i.L?i.ba:null,i.W),o.L){We(i.h,o);var a=o,h=i.O;h&&(a.H=h),a.D&&(Ue(a),De(a)),i.g=o}else qt(i);n.i.length>0&&Bt(n)}else"stop"!=c[0]&&"close"!=c[0]||Zt(n,7);else 3==n.I&&("stop"==c[0]||"close"==c[0]?"stop"==c[0]?Zt(n,7):jt(n):"noop"!=c[0]&&n.l&&n.l.qa(c),n.A=0)}fe()}catch(e){}}ke.prototype.ba=function(e){e=e.target;const t=this.O;t&&3==Dt(e)?t.j():this.Y(e)},ke.prototype.Y=function(e){try{if(e==this.g)e:{const c=Dt(this.g),h=this.g.ya();this.g.ca();if(!(c<3)&&(3!=c||this.g&&(this.h.h||this.g.la()||Lt(this.g)))){this.K||4!=c||7==h||fe(),Ue(this);var t=this.g.ca();this.X=t;var n=function(e){if(!xe(e))return e.g.la();const t=Lt(e.g);if(""===t)return"";let n="";const i=t.length,r=4==Dt(e.g);if(!e.h.i){if("undefined"==typeof TextDecoder)return je(e),Me(e),"";e.h.i=new s.TextDecoder}for(let s=0;s<i;s++)e.h.h=!0,n+=e.h.i.decode(t[s],{stream:!(r&&s==i-1)});return t.length=0,e.h.g+=n,e.C=0,e.h.g}(this);if(this.o=200==t,function(e,t,n,i,r,s,o){e.info(function(){return"XMLHTTP RESP ("+i+") [ attempt "+r+"]: "+t+"\n"+n+"\n"+s+" "+o})}(this.i,this.v,this.B,this.l,this.S,c,t),this.o){if(this.U&&!this.L){t:{if(this.g){var i,r=this.g;if((i=r.g?r.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!k(i)){var o=i;break t}}o=null}if(!(e=o)){this.o=!1,this.m=3,me(12),je(this),Me(this);break e}be(this.i,this.l,e,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,$e(this,e)}if(this.R){let t;for(e=!0;!this.K&&this.C<n.length;){if(t=Ne(this,n),t==Pe){4==c&&(this.m=4,me(14),e=!1),be(this.i,this.l,null,"[Incomplete Response]");break}if(t==Ae){this.m=4,me(15),be(this.i,this.l,n,"[Invalid Chunk]"),e=!1;break}be(this.i,this.l,t,null),$e(this,t)}if(xe(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=c||0!=n.length||this.h.h||(this.m=1,me(16),e=!1),this.o=this.o&&e,e){if(n.length>0&&!this.W){this.W=!0;var a=this.j;a.g==this&&a.aa&&!a.P&&(a.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Kt(a),a.P=!0,me(11))}}else be(this.i,this.l,n,"[Invalid Chunked Response]"),je(this),Me(this)}else be(this.i,this.l,n,null),$e(this,n);4==c&&je(this),this.o&&!this.K&&(4==c?Xt(this.j,this):(this.o=!1,De(this)))}else(function(e){const t={};e=(e.g&&Dt(e)>=2&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let i=0;i<e.length;i++){if(k(e[i]))continue;var n=Se(e[i]);const r=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const s=t[r]||[];t[r]=s,s.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==t&&n.indexOf("Unknown SID")>0?(this.m=3,me(12)):(this.m=0,me(13)),je(this),Me(this)}}}catch(e){}},ke.prototype.cancel=function(){this.K=!0,je(this)},ke.prototype.aa=function(){this.D=null;const e=Date.now();e-this.T>=0?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.B),2!=this.M&&(fe(),me(17)),je(this),this.m=2,Me(this)):Le(this,this.T-e)};var Fe=class{constructor(e,t){this.g=e,this.map=t}};function Be(e){this.l=e||10,s.PerformanceNavigationTiming?e=(e=s.performance.getEntriesByType("navigation")).length>0&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(s.chrome&&s.chrome.loadTimes&&s.chrome.loadTimes()&&s.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function ze(e){return!!e.h||!!e.g&&e.g.size>=e.j}function He(e){return e.h?1:e.g?e.g.size:0}function Ve(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function qe(e,t){e.g?e.g.add(t):e.h=t}function We(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function Ke(e){if(null!=e.h)return e.i.concat(e.h.G);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.G);return t}return d(e.i)}Be.prototype.cancel=function(){if(this.i=Ke(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var Ge=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Je(e){let t;this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1,e instanceof Je?(this.l=e.l,Ye(this,e.j),this.o=e.o,this.g=e.g,Ze(this,e.u),this.h=e.h,Qe(this,mt(e.i)),this.m=e.m):e&&(t=String(e).match(Ge))?(this.l=!1,Ye(this,t[1]||"",!0),this.o=nt(t[2]||""),this.g=nt(t[3]||"",!0),Ze(this,t[4]),this.h=nt(t[5]||"",!0),Qe(this,t[6]||"",!0),this.m=nt(t[7]||"")):(this.l=!1,this.i=new lt(null,this.l))}function Xe(e){return new Je(e)}function Ye(e,t,n){e.j=n?nt(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function Ze(e,t){if(t){if(t=Number(t),isNaN(t)||t<0)throw Error("Bad port number "+t);e.u=t}else e.u=null}function Qe(e,t,n){t instanceof lt?(e.i=t,function(e,t){t&&!e.j&&(ut(e),e.i=null,e.g.forEach(function(e,t){const n=t.toLowerCase();t!=n&&(dt(this,t),gt(this,n,e))},e)),e.j=t}(e.i,e.l)):(n||(t=it(t,ct)),e.i=new lt(t,e.l))}function et(e,t,n){e.i.set(t,n)}function tt(e){return et(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function nt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function it(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,rt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function rt(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Je.prototype.toString=function(){const e=[];var t=this.j;t&&e.push(it(t,st,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(it(t,st,!0),"@"),e.push(Ie(n).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.u)&&e.push(":",String(n))),(n=this.h)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(it(n,"/"==n.charAt(0)?at:ot,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",it(n,ht)),e.join("")},Je.prototype.resolve=function(e){const t=Xe(this);let n=!!e.j;n?Ye(t,e.j):n=!!e.o,n?t.o=e.o:n=!!e.g,n?t.g=e.g:n=null!=e.u;var i=e.h;if(n)Ze(t,e.u);else if(n=!!e.h){if("/"!=i.charAt(0))if(this.g&&!this.h)i="/"+i;else{var r=t.h.lastIndexOf("/");-1!=r&&(i=t.h.slice(0,r+1)+i)}if(".."==(r=i)||"."==r)i="";else if(-1!=r.indexOf("./")||-1!=r.indexOf("/.")){i=0==r.lastIndexOf("/",0),r=r.split("/");const e=[];for(let t=0;t<r.length;){const n=r[t++];"."==n?i&&t==r.length&&e.push(""):".."==n?((e.length>1||1==e.length&&""!=e[0])&&e.pop(),i&&t==r.length&&e.push("")):(e.push(n),i=!0)}i=e.join("/")}else i=r}return n?t.h=i:n=""!==e.i.toString(),n?Qe(t,mt(e.i)):n=!!e.m,n&&(t.m=e.m),t};var st=/[#\/\?@]/g,ot=/[#\?:]/g,at=/[#\?]/g,ct=/[#\?@]/g,ht=/#/g;function lt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function ut(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(let n=0;n<e.length;n++){const i=e[n].indexOf("=");let r,s=null;i>=0?(r=e[n].substring(0,i),s=e[n].substring(i+1)):r=e[n],t(r,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function dt(e,t){ut(e),t=yt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function pt(e,t){return ut(e),t=yt(e,t),e.g.has(t)}function ft(e,t){ut(e);let n=[];if("string"==typeof t)pt(e,t)&&(n=n.concat(e.g.get(yt(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)n=n.concat(e[t]);return n}function gt(e,t,n){dt(e,t),n.length>0&&(e.i=null,e.g.set(yt(e,t),d(n)),e.h+=n.length)}function mt(e){const t=new lt;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function yt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function _t(e,t,n,i,r){try{r&&(r.onload=null,r.onerror=null,r.onabort=null,r.ontimeout=null),i(n)}catch(e){}}function wt(){this.g=new se}function bt(e){this.i=e.Sb||null,this.h=e.ab||!1}function vt(e,t){J.call(this),this.H=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}function Tt(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}function Et(e){e.readyState=4,e.l=null,e.j=null,e.B=null,It(e)}function It(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function St(e){let t="";return x(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function kt(e,t,n){e:{for(i in n){var i=!1;break e}i=!0}i||(n=St(n),"string"==typeof e?null!=n&&Ie(n):et(e,t,n))}function Ct(e){J.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}(e=lt.prototype).add=function(e,t){ut(this),this.i=null,e=yt(this,e);let n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){ut(this),this.g.forEach(function(n,i){n.forEach(function(n){e.call(t,n,i,this)},this)},this)},e.set=function(e,t){return ut(this),this.i=null,pt(this,e=yt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&(e=ft(this,e)).length>0?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(let i=0;i<t.length;i++){var n=t[i];const r=Ie(n);n=ft(this,n);for(let t=0;t<n.length;t++){let i=r;""!==n[t]&&(i+="="+Ie(n[t])),e.push(i)}}return this.i=e.join("&")},l(bt,oe),bt.prototype.g=function(){return new vt(this.i,this.h)},l(vt,J),(e=vt.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=e,this.D=t,this.readyState=1,It(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};e&&(t.body=e),(this.H||s).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&4!=this.readyState&&(this.g=!1,Et(this)),this.readyState=0},e.Pa=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,It(this)),this.g&&(this.readyState=3,It(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(void 0!==s.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;Tt(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))},e.Ma=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?Et(this):It(this),3==this.readyState&&Tt(this)}},e.Oa=function(e){this.g&&(this.response=this.responseText=e,Et(this))},e.Na=function(e){this.g&&(this.response=e,Et(this))},e.ga=function(){this.g&&Et(this)},e.setRequestHeader=function(e,t){this.A.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(vt.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),l(Ct,J);var At=/^https?$/i,Pt=["POST","PUT"];function Rt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,Ot(e),Nt(e)}function Ot(e){e.A||(e.A=!0,X(e,"complete"),X(e,"error"))}function xt(e){if(e.h&&void 0!==r)if(e.v&&4==Dt(e))setTimeout(e.Ca.bind(e),0);else if(X(e,"readystatechange"),4==Dt(e)){e.h=!1;try{const r=e.ca();e:switch(r){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var i;if(i=0===r){let t=String(e.D).match(Ge)[1]||null;!t&&s.self&&s.self.location&&(t=s.self.location.protocol.slice(0,-1)),i=!At.test(t?t.toLowerCase():"")}n=i}if(n)X(e,"complete"),X(e,"success");else{e.o=6;try{var o=Dt(e)>2?e.g.statusText:""}catch(e){o=""}e.l=o+" ["+e.ca()+"]",Ot(e)}}finally{Nt(e)}}}function Nt(e,t){if(e.g){e.m&&(clearTimeout(e.m),e.m=null);const n=e.g;e.g=null,t||X(e,"ready");try{n.onreadystatechange=null}catch(e){}}}function Dt(e){return e.g?e.g.readyState:0}function Lt(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.F){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function Ut(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Mt(e){this.za=0,this.i=[],this.j=new we,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Ut("failFast",!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Ut("baseRetryDelayMs",5e3,e),this.Za=Ut("retryDelaySeedMs",1e4,e),this.Ta=Ut("forwardChannelMaxRetries",2,e),this.va=Ut("forwardChannelRequestTimeoutMs",2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M="",this.h=new Be(e&&e.concurrentRequestLimit),this.Ba=new wt,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&e.longPollingTimeout>0&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function jt(e){if(Ft(e),3==e.I){var t=e.V++,n=Xe(e.J);if(et(n,"SID",e.M),et(n,"RID",t),et(n,"TYPE","terminate"),Ht(e,n),(t=new ke(e,e.j,t)).M=2,t.A=tt(Xe(n)),n=!1,s.navigator&&s.navigator.sendBeacon)try{n=s.navigator.sendBeacon(t.A.toString(),"")}catch(e){}!n&&s.Image&&((new Image).src=t.A,n=!0),n||(t.g=tn(t.j,null),t.g.ea(t.A)),t.F=Date.now(),De(t)}Qt(e)}function $t(e){e.g&&(Kt(e),e.g.cancel(),e.g=null)}function Ft(e){$t(e),e.v&&(s.clearTimeout(e.v),e.v=null),Jt(e),e.h.cancel(),e.m&&("number"==typeof e.m&&s.clearTimeout(e.m),e.m=null)}function Bt(e){if(!ze(e.h)&&!e.m){e.m=!0;var t=e.Ea;_||v(),w||(_(),w=!0),b.add(t,e),e.D=0}}function zt(e,t){var n;n=t?t.l:e.V++;const i=Xe(e.J);et(i,"SID",e.M),et(i,"RID",n),et(i,"AID",e.K),Ht(e,i),e.u&&e.o&&kt(i,e.u,e.o),n=new ke(e,e.j,n,e.D+1),null===e.u&&(n.J=e.o),t&&(e.i=t.G.concat(e.i)),t=Vt(e,n,1e3),n.H=Math.round(.5*e.va)+Math.round(.5*e.va*Math.random()),qe(e.h,n),Re(n,i,t)}function Ht(e,t){e.H&&x(e.H,function(e,n){et(t,n,e)}),e.l&&x({},function(e,n){et(t,n,e)})}function Vt(e,t,n){n=Math.min(e.i.length,n);const i=e.l?c(e.l.Ka,e.l,e):null;e:{var r=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?n>0?(t=r[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let c=!0;for(let h=0;h<n;h++){var s=r[h].g;const n=r[h].map;if((s-=t)<0)t=Math.max(0,r[h].g-100),c=!1;else try{s="req"+s+"_"||"";try{var a=n instanceof Map?n:Object.entries(n);for(const[t,n]of a){let i=n;o(n)&&(i=ie(n)),e.push(s+t+"="+encodeURIComponent(i))}}catch(t){throw e.push(s+"type="+encodeURIComponent("_badmap")),t}}catch(e){i&&i(n)}}if(c){a=e.join("&");break e}}a=void 0}return e=e.i.splice(0,n),t.G=e,a}function qt(e){if(!e.g&&!e.v){e.Y=1;var t=e.Da;_||v(),w||(_(),w=!0),b.add(t,e),e.A=0}}function Wt(e){return!(e.g||e.v||e.A>=3)&&(e.Y++,e.v=_e(c(e.Da,e),Yt(e,e.A)),e.A++,!0)}function Kt(e){null!=e.B&&(s.clearTimeout(e.B),e.B=null)}function Gt(e){e.g=new ke(e,e.j,"rpc",e.Y),null===e.u&&(e.g.J=e.o),e.g.P=0;var t=Xe(e.na);et(t,"RID","rpc"),et(t,"SID",e.M),et(t,"AID",e.K),et(t,"CI",e.F?"0":"1"),!e.F&&e.ia&&et(t,"TO",e.ia),et(t,"TYPE","xmlhttp"),Ht(e,t),e.u&&e.o&&kt(t,e.u,e.o),e.O&&(e.g.H=e.O);var n=e.g;e=e.ba,n.M=1,n.A=tt(Xe(t)),n.u=null,n.R=!0,Oe(n,e)}function Jt(e){null!=e.C&&(s.clearTimeout(e.C),e.C=null)}function Xt(e,t){var n=null;if(e.g==t){Jt(e),Kt(e),e.g=null;var i=2}else{if(!Ve(e.h,t))return;n=t.G,We(e.h,t),i=1}if(0!=e.I)if(t.o)if(1==i){n=t.u?t.u.length:0,t=Date.now()-t.F;var r=e.D;X(i=de(),new ye(i,n)),Bt(e)}else qt(e);else if(3==(r=t.m)||0==r&&t.X>0||!(1==i&&function(e,t){return!(He(e.h)>=e.h.j-(e.m?1:0)||(e.m?(e.i=t.G.concat(e.i),0):1==e.I||2==e.I||e.D>=(e.Sa?0:e.Ta)||(e.m=_e(c(e.Ea,e,t),Yt(e,e.D)),e.D++,0)))}(e,t)||2==i&&Wt(e)))switch(n&&n.length>0&&(t=e.h,t.i=t.i.concat(n)),r){case 1:Zt(e,5);break;case 4:Zt(e,10);break;case 3:Zt(e,6);break;default:Zt(e,2)}}function Yt(e,t){let n=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(n*=2),n*t}function Zt(e,t){if(e.j.info("Error code "+t),2==t){var n=c(e.bb,e),i=e.Ua;const t=!i;i=new Je(i||"//www.google.com/images/cleardot.gif"),s.location&&"http"==s.location.protocol||Ye(i,"https"),tt(i),t?function(e,t){const n=new we;if(s.Image){const i=new Image;i.onload=h(_t,n,"TestLoadImage: loaded",!0,t,i),i.onerror=h(_t,n,"TestLoadImage: error",!1,t,i),i.onabort=h(_t,n,"TestLoadImage: abort",!1,t,i),i.ontimeout=h(_t,n,"TestLoadImage: timeout",!1,t,i),s.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=e}else t(!1)}(i.toString(),n):function(e,t){new we;const n=new AbortController,i=setTimeout(()=>{n.abort(),_t(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(i),e.ok?_t(0,0,!0,t):_t(0,0,!1,t)}).catch(()=>{clearTimeout(i),_t(0,0,!1,t)})}(i.toString(),n)}else me(2);e.I=0,e.l&&e.l.pa(t),Qt(e),Ft(e)}function Qt(e){if(e.I=0,e.ja=[],e.l){const t=Ke(e.h);0==t.length&&0==e.i.length||(p(e.ja,t),p(e.ja,e.i),e.h.i.length=0,d(e.i),e.i.length=0),e.l.oa()}}function en(e,t,n){var i=n instanceof Je?Xe(n):new Je(n);if(""!=i.g)t&&(i.g=t+"."+i.g),Ze(i,i.u);else{var r=s.location;i=r.protocol,t=t?t+"."+r.hostname:r.hostname,r=+r.port;const e=new Je(null);i&&Ye(e,i),t&&(e.g=t),r&&Ze(e,r),n&&(e.h=n),i=e}return n=e.G,t=e.wa,n&&t&&et(i,n,t),et(i,"VER",e.ka),Ht(e,i),i}function tn(e,t,n){if(t&&!e.L)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Aa&&!e.ma?new Ct(new bt({ab:n})):new Ct(e.ma)).Fa(e.L),t}function nn(){}function rn(e,t){J.call(this),this.g=new Mt(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.o=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.sa&&(e?e["X-WebChannel-Client-Profile"]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!k(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!k(t)&&(this.g.G=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new an(this)}function sn(e){ce.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(const 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 on(){he.call(this),this.status=1}function an(e){this.g=e}(e=Ct.prototype).Fa=function(e){this.H=e},e.ea=function(e,t,n,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():ve.g(),this.g.onreadystatechange=u(c(this.Ca,this));try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void Rt(this,e)}if(e=n||"",n=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var r in i)n.set(r,i[r]);else{if("function"!=typeof i.keys||"function"!=typeof i.get)throw Error("Unknown input type for opt_headers: "+String(i));for(const e of i.keys())n.set(e,i.get(e))}i=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),r=s.FormData&&e instanceof s.FormData,!(Array.prototype.indexOf.call(Pt,t,void 0)>=0)||i||r||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(e),this.v=!1}catch(e){Rt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,X(this,"complete"),X(this,"abort"),Nt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Nt(this,!0)),Ct.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?xt(this):this.Xa())},e.Xa=function(){xt(this)},e.isActive=function(){return!!this.g},e.ca=function(){try{return Dt(this)>2?this.g.status:-1}catch(e){return-1}},e.la=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.La=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),re(t)}},e.ya=function(){return this.o},e.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=Mt.prototype).ka=8,e.I=1,e.connect=function(e,t,n,i){me(0),this.W=e,this.H=t||{},n&&void 0!==i&&(this.H.OSID=n,this.H.OAID=i),this.F=this.X,this.J=en(this,null,this.W),Bt(this)},e.Ea=function(e){if(this.m)if(this.m=null,1==this.I){if(!e){this.V=Math.floor(1e5*Math.random()),e=this.V++;const r=new ke(this,this.j,e);let s=this.o;if(this.U&&(s?(s=N(s),L(s,this.U)):s=this.U),null!==this.u||this.R||(r.J=s,s=null),this.S)e:{for(var t=0,n=0;n<this.i.length;n++){var i=this.i[n];if(void 0===(i="__data__"in i.map&&"string"==typeof(i=i.map.__data__)?i.length:void 0))break;if((t+=i)>4096){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=Vt(this,r,t),et(n=Xe(this.J),"RID",e),et(n,"CVER",22),this.G&&et(n,"X-HTTP-Session-Id",this.G),Ht(this,n),s&&(this.R?t="headers="+Ie(St(s))+"&"+t:this.u&&kt(n,this.u,s)),qe(this.h,r),this.Ra&&et(n,"TYPE","init"),this.S?(et(n,"$req",t),et(n,"SID","null"),r.U=!0,Re(r,n,null)):Re(r,n,t),this.I=2}}else 3==this.I&&(e?zt(this,e):0==this.i.length||ze(this.h)||zt(this))},e.Da=function(){if(this.v=null,Gt(this),this.aa&&!(this.P||null==this.g||this.T<=0)){var e=4*this.T;this.j.info("BP detection timer enabled: "+e),this.B=_e(c(this.Wa,this),e)}},e.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,me(10),$t(this),Gt(this))},e.Va=function(){null!=this.C&&(this.C=null,$t(this),Wt(this),me(19))},e.bb=function(e){e?(this.j.info("Successfully pinged google.com"),me(2)):(this.j.info("Failed to ping google.com"),me(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=nn.prototype).ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){},l(rn,J),rn.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},rn.prototype.close=function(){jt(this.g)},rn.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=ie(e),e=n);t.i.push(new Fe(t.Ya++,e)),3==t.I&&Bt(t)},rn.prototype.N=function(){this.g.l=null,delete this.j,jt(this.g),delete this.g,rn.Z.N.call(this)},l(sn,ce),l(on,he),l(an,nn),an.prototype.ra=function(){X(this.g,"a")},an.prototype.qa=function(e){X(this.g,new sn(e))},an.prototype.pa=function(e){X(this.g,new on)},an.prototype.oa=function(){X(this.g,"b")},rn.prototype.send=rn.prototype.o,rn.prototype.open=rn.prototype.m,rn.prototype.close=rn.prototype.close,Te.NO_ERROR=0,Te.TIMEOUT=8,Te.HTTP_ERROR=6,ae.OPEN="a",ae.CLOSE="b",ae.ERROR="c",ae.MESSAGE="d",J.prototype.listen=J.prototype.J,Ct.prototype.listenOnce=Ct.prototype.K,Ct.prototype.getLastError=Ct.prototype.Ha,Ct.prototype.getLastErrorCode=Ct.prototype.ya,Ct.prototype.getStatus=Ct.prototype.ca,Ct.prototype.getResponseJson=Ct.prototype.La,Ct.prototype.getResponseText=Ct.prototype.la,Ct.prototype.send=Ct.prototype.ea,Ct.prototype.setWithCredentials=Ct.prototype.Fa}).apply(void 0!==ka?ka:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});const Ca="@firebase/firestore",Aa="4.9.2";class Pa{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}}Pa.UNAUTHENTICATED=new Pa(null),Pa.GOOGLE_CREDENTIALS=new Pa("google-credentials-uid"),Pa.FIRST_PARTY=new Pa("first-party-uid"),Pa.MOCK_USER=new Pa("mock-user");let Ra="12.3.0";const Oa=new Jn("@firebase/firestore");function xa(e,...t){if(Oa.logLevel<=Vn.DEBUG){const n=t.map(Da);Oa.debug(`Firestore (${Ra}): ${e}`,...n)}}function Na(e,...t){if(Oa.logLevel<=Vn.ERROR){const n=t.map(Da);Oa.error(`Firestore (${Ra}): ${e}`,...n)}}function Da(e){if("string"==typeof e)return e;try{return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}function La(e,t,n){let i="Unexpected state";"string"==typeof t?i=t:n=t,Ua(e,i,n)}function Ua(e,t,n){let i=`FIRESTORE (${Ra}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==n)try{i+=" CONTEXT: "+JSON.stringify(n)}catch(e){i+=" CONTEXT: "+n}throw Na(i),new Error(i)}function Ma(e,t,n,i){let r="Unexpected state";"string"==typeof n?r=n:i=n,e||Ua(t,r,i)}const ja="cancelled",$a="invalid-argument",Fa="failed-precondition";class Ba extends An{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class za{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class Ha{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Va{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(Pa.UNAUTHENTICATED))}shutdown(){}}class qa{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}}class Wa{constructor(e){this.t=e,this.currentUser=Pa.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Ma(void 0===this.o,42304);let n=this.i;const i=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let r=new za;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new za,e.enqueueRetryable(()=>i(this.currentUser))};const s=()=>{const t=r;e.enqueueRetryable(async()=>{await t.promise,await i(this.currentUser)})},o=e=>{xa("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(e=>o(e)),setTimeout(()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?o(e):(xa("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new za)}},0),s()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(xa("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(Ma("string"==typeof t.accessToken,31837,{l:t}),new Ha(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Ma(null===e||"string"==typeof e,2055,{h:e}),new Pa(e)}}class Ka{constructor(e,t,n){this.P=e,this.T=t,this.I=n,this.type="FirstParty",this.user=Pa.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class Ga{constructor(e,t,n){this.P=e,this.T=t,this.I=n}getToken(){return Promise.resolve(new Ka(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(Pa.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Ja{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Xa{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Zi(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){Ma(void 0===this.o,3512);const n=e=>{null!=e.error&&xa("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);const n=e.token!==this.m;return this.m=e.token,xa("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};const i=e=>{xa("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(e=>i(e)),setTimeout(()=>{if(!this.appCheck){const e=this.V.getImmediate({optional:!0});e?i(e):xa("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Ja(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(Ma("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new Ja(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}function Ya(e){const 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}class Za{static newId(){const e=62*Math.floor(256/62);let t="";for(;t.length<20;){const n=Ya(40);for(let i=0;i<n.length;++i)t.length<20&&n[i]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[i]%62))}return t}}function Qa(e,t){return e<t?-1:e>t?1:0}const ec=55296,tc=57343;function nc(e){const t=e.charCodeAt(0);return t>=ec&&t<=tc}const ic="__name__";class rc{constructor(e,t,n){void 0===t?t=0:t>e.length&&La(637,{offset:t,range:e.length}),void 0===n?n=e.length-t:n>e.length-t&&La(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===rc.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof rc?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){const n=Math.min(e.length,t.length);for(let i=0;i<n;i++){const n=rc.compareSegments(e.get(i),t.get(i));if(0!==n)return n}return Qa(e.length,t.length)}static compareSegments(e,t){const n=rc.isNumericId(e),i=rc.isNumericId(t);return n&&!i?-1:!n&&i?1:n&&i?rc.extractNumericId(e).compare(rc.extractNumericId(t)):function(e,t){const n=Math.min(e.length,t.length);for(let i=0;i<n;i++){const n=e.charAt(i),r=t.charAt(i);if(n!==r)return nc(n)===nc(r)?Qa(n,r):nc(n)?1:-1}return Qa(e.length,t.length)}(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Ia.fromString(e.substring(4,e.length-2))}}class sc extends rc{construct(e,t,n){return new sc(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const n of e){if(n.indexOf("//")>=0)throw new Ba($a,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new sc(t)}static emptyPath(){return new sc([])}}const oc=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class ac extends rc{construct(e,t,n){return new ac(e,t,n)}static isValidIdentifier(e){return oc.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),ac.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===ic}static keyField(){return new ac([ic])}static fromServerFormat(e){const t=[];let n="",i=0;const r=()=>{if(0===n.length)throw new Ba($a,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let s=!1;for(;i<e.length;){const t=e[i];if("\\"===t){if(i+1===e.length)throw new Ba($a,"Path has trailing escape character: "+e);const t=e[i+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new Ba($a,"Path has invalid escape sequence: "+e);n+=t,i+=2}else"`"===t?(s=!s,i++):"."!==t||s?(n+=t,i++):(r(),i++)}if(r(),s)throw new Ba($a,"Unterminated ` in path: "+e);return new ac(t)}static emptyPath(){return new ac([])}}class cc{constructor(e){this.path=e}static fromPath(e){return new cc(sc.fromString(e))}static fromName(e){return new cc(sc.fromString(e).popFirst(5))}static empty(){return new cc(sc.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===sc.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return sc.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new cc(new sc(e.slice()))}}function hc(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new Ba($a,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=function(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";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return"function"==typeof e?"a function":La(12329,{type:typeof e})}(e);throw new Ba($a,`Expected type '${t.name}', but it was: ${n}`)}}return e}function lc(e,t){const n={typeString:e};return t&&(n.value=t),n}function uc(e,t){if(!function(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}(e))throw new Ba($a,"JSON must be an object");let n;for(const i in t)if(t[i]){const r=t[i].typeString,s="value"in t[i]?{value:t[i].value}:void 0;if(!(i in e)){n=`JSON missing required field: '${i}'`;break}const o=e[i];if(r&&typeof o!==r){n=`JSON field '${i}' must be a ${r}.`;break}if(void 0!==s&&o!==s.value){n=`Expected '${i}' field to equal '${s.value}'`;break}}if(n)throw new Ba($a,n);return!0}const dc=-62135596800,pc=1e6;class fc{static now(){return fc.fromMillis(Date.now())}static fromDate(e){return fc.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*pc);return new fc(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new Ba($a,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new Ba($a,"Timestamp nanoseconds out of range: "+t);if(e<dc)throw new Ba($a,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Ba($a,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/pc}_compareTo(e){return this.seconds===e.seconds?Qa(this.nanoseconds,e.nanoseconds):Qa(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{type:fc._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(uc(e,fc._jsonSchema))return new fc(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-dc;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}fc._jsonSchemaVersion="firestore/timestamp/1.0",fc._jsonSchema={type:lc("string",fc._jsonSchemaVersion),seconds:lc("number"),nanoseconds:lc("number")};class gc extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class mc{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new gc("Invalid base64 string: "+e):e}}(e);return new mc(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new mc(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(e){return btoa(e)}(this.binaryString)}toUint8Array(){return function(e){const 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 Qa(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}mc.EMPTY_BYTE_STRING=new mc("");const yc="(default)";class _c{constructor(e,t){this.projectId=e,this.database=t||yc}static empty(){return new _c("","")}get isDefaultDatabase(){return this.database===yc}isEqual(e){return e instanceof _c&&e.projectId===this.projectId&&e.database===this.database}}class wc{constructor(e,t=null,n=[],i=[],r=null,s="F",o=null,a=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=i,this.limit=r,this.limitType=s,this.startAt=o,this.endAt=a,this.Ie=null,this.Ee=null,this.de=null,this.startAt,this.endAt}}var bc,vc;(vc=bc||(bc={}))[vc.OK=0]="OK",vc[vc.CANCELLED=1]="CANCELLED",vc[vc.UNKNOWN=2]="UNKNOWN",vc[vc.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",vc[vc.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",vc[vc.NOT_FOUND=5]="NOT_FOUND",vc[vc.ALREADY_EXISTS=6]="ALREADY_EXISTS",vc[vc.PERMISSION_DENIED=7]="PERMISSION_DENIED",vc[vc.UNAUTHENTICATED=16]="UNAUTHENTICATED",vc[vc.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",vc[vc.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",vc[vc.ABORTED=10]="ABORTED",vc[vc.OUT_OF_RANGE=11]="OUT_OF_RANGE",vc[vc.UNIMPLEMENTED=12]="UNIMPLEMENTED",vc[vc.INTERNAL=13]="INTERNAL",vc[vc.UNAVAILABLE=14]="UNAVAILABLE",vc[vc.DATA_LOSS=15]="DATA_LOSS",new Ia([4294967295,4294967295],0);function Tc(){return"undefined"!=typeof document?document:null}class Ec{constructor(e,t,n=1e3,i=1.5,r=6e4){this.Mi=e,this.timerId=t,this.d_=n,this.A_=i,this.R_=r,this.V_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.V_=0}g_(){this.V_=this.R_}p_(e){this.cancel();const t=Math.floor(this.V_+this.y_()),n=Math.max(0,Date.now()-this.f_),i=Math.max(0,t-n);i>0&&xa("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.V_} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.m_=this.Mi.enqueueAfterDelay(this.timerId,i,()=>(this.f_=Date.now(),e())),this.V_*=this.A_,this.V_<this.d_&&(this.V_=this.d_),this.V_>this.R_&&(this.V_=this.R_)}w_(){null!==this.m_&&(this.m_.skipDelay(),this.m_=null)}cancel(){null!==this.m_&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.V_}}class Ic{constructor(e,t,n,i,r){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=r,this.deferred=new za,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,r){const s=Date.now()+n,o=new Ic(e,t,s,i,r);return o.start(n),o}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Ba(ja,"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)}}var Sc,kc;(kc=Sc||(Sc={})).Ma="default",kc.Cache="cache";const Cc=new Map,Ac="firestore.googleapis.com",Pc=!0;class Rc{constructor(e){if(void 0===e.host){if(void 0!==e.ssl)throw new Ba($a,"Can't provide ssl option if host option is not set");this.host=Ac,this.ssl=Pc}else this.host=e.host,this.ssl=e.ssl??Pc;if(this.isUsingEmulator=void 0!==e.emulatorOptions,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 Ba($a,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,i){if(!0===t&&!0===i)throw new Ba($a,`${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=function(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}(e.experimentalLongPollingOptions??{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new Ba($a,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new Ba($a,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new Ba($a,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Oc{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 Rc({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Ba(Fa,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new Ba(Fa,"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 Rc(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new Va;switch(e.type){case"firstParty":return new Ga(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new Ba($a,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=Cc.get(e);t&&(xa("ComponentProvider","Removing Datastore"),Cc.delete(e),t.terminate())}(this),Promise.resolve()}}function xc(e,t,n,i={}){e=hc(e,Oc);const r=yn(t),s=e._getSettings(),o={...s,emulatorOptions:e._getEmulatorOptions()},a=`${t}:${n}`;r&&(_n(`https://${a}`),Tn("Firestore",!0)),s.host!==Ac&&s.host!==a&&function(e,...t){if(Oa.logLevel<=Vn.WARN){const n=t.map(Da);Oa.warn(`Firestore (${Ra}): ${e}`,...n)}}("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const c={...s,host:a,ssl:r,emulatorOptions:i};if(!On(c,o)&&(e._setSettings(c),i.mockUserToken)){let t,n;if("string"==typeof i.mockUserToken)t=i.mockUserToken,n=Pa.MOCK_USER;else{t=wn(i.mockUserToken,e._app?.options.projectId);const r=i.mockUserToken.sub||i.mockUserToken.user_id;if(!r)throw new Ba($a,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Pa(r)}e._authCredentials=new qa(new Ha(t,n))}}class Nc{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new Nc(this.firestore,e,this._query)}}class Dc{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 Lc(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Dc(this.firestore,e,this._key)}toJSON(){return{type:Dc._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(uc(t,Dc._jsonSchema))return new Dc(e,n||null,new cc(sc.fromString(t.referencePath)))}}Dc._jsonSchemaVersion="firestore/documentReference/1.0",Dc._jsonSchema={type:lc("string",Dc._jsonSchemaVersion),referencePath:lc("string")};class Lc extends Nc{constructor(e,t,n){super(e,t,function(e){return new wc(e)}(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Dc(this.firestore,null,new cc(e))}withConverter(e){return new Lc(this.firestore,e,this._path)}}const Uc="AsyncQueue";class Mc{constructor(e=Promise.resolve()){this.Xu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new Ec(this,"async_queue_retry"),this._c=()=>{const e=Tc();e&&xa(Uc,"Visibility state changed to "+e.visibilityState),this.M_.w_()},this.ac=e;const t=Tc();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const t=Tc();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise(()=>{});const t=new za;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Xu.push(e),this.lc()))}async lc(){if(0!==this.Xu.length){try{await this.Xu[0](),this.Xu.shift(),this.M_.reset()}catch(e){if(!function(e){return"IndexedDbTransactionError"===e.name}(e))throw e;xa(Uc,"Operation failed with retryable error: "+e)}this.Xu.length>0&&this.M_.p_(()=>this.lc())}}cc(e){const t=this.ac.then(()=>(this.rc=!0,e().catch(e=>{throw this.nc=e,this.rc=!1,Na("INTERNAL UNHANDLED ERROR: ",jc(e)),e}).then(e=>(this.rc=!1,e))));return this.ac=t,t}enqueueAfterDelay(e,t,n){this.uc(),this.oc.indexOf(e)>-1&&(t=0);const i=Ic.createAndSchedule(this,e,t,n,e=>this.hc(e));return this.tc.push(i),i}uc(){this.nc&&La(47125,{Pc:jc(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do{e=this.ac,await e}while(e!==this.ac)}Ic(e){for(const t of this.tc)if(t.timerId===e)return!0;return!1}Ec(e){return this.Tc().then(()=>{this.tc.sort((e,t)=>e.targetTimeMs-t.targetTimeMs);for(const t of this.tc)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.Tc()})}dc(e){this.oc.push(e)}hc(e){const t=this.tc.indexOf(e);this.tc.splice(t,1)}}function jc(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}class $c extends Oc{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=new Mc,this._persistenceKey=i?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Mc(e),this._firestoreClient=void 0,await e}}}class Fc{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Fc(mc.fromBase64String(e))}catch(e){throw new Ba($a,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new Fc(mc.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)}toJSON(){return{type:Fc._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(uc(e,Fc._jsonSchema))return Fc.fromBase64String(e.bytes)}}Fc._jsonSchemaVersion="firestore/bytes/1.0",Fc._jsonSchema={type:lc("string",Fc._jsonSchemaVersion),bytes:lc("string")};class Bc{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new Ba($a,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new ac(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class zc{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new Ba($a,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new Ba($a,"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}_compareTo(e){return Qa(this._lat,e._lat)||Qa(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:zc._jsonSchemaVersion}}static fromJSON(e){if(uc(e,zc._jsonSchema))return new zc(e.latitude,e.longitude)}}zc._jsonSchemaVersion="firestore/geoPoint/1.0",zc._jsonSchema={type:lc("string",zc._jsonSchemaVersion),latitude:lc("number"),longitude:lc("number")};class Hc{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:Hc._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(uc(e,Hc._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new Hc(e.vectorValues);throw new Ba($a,"Expected 'vectorValues' field to be a number array")}}}Hc._jsonSchemaVersion="firestore/vectorValue/1.0",Hc._jsonSchema={type:lc("string",Hc._jsonSchemaVersion),vectorValues:lc("object")};const Vc=new RegExp("[~\\*/\\[\\]]");function qc(e,t,n,i,r){let s=`Function ${t}() called with invalid data`;s+=". ";return new Ba($a,s+e+"")}class Wc{constructor(e,t,n,i,r){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=i,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new Dc(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Kc(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){const t=this._document.data.field(Gc("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class Kc extends Wc{data(){return super.data()}}function Gc(e,t){return"string"==typeof t?function(e,t){if(t.search(Vc)>=0)throw qc(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e);try{return new Bc(...t.split("."))._internalPath}catch(n){throw qc(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e)}}(e,t):t instanceof Bc?t._internalPath:t._delegate._internalPath}class Jc{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Xc extends Wc{constructor(e,t,n,i,r,s){super(e,t,n,i,s),this._firestore=e,this._firestoreImpl=e,this.metadata=r}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Yc(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){const n=this._document.data.field(Gc("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Ba(Fa,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=Xc._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),e&&e.isValidDocument()&&e.isFoundDocument()?(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t):t}}Xc._jsonSchemaVersion="firestore/documentSnapshot/1.0",Xc._jsonSchema={type:lc("string",Xc._jsonSchemaVersion),bundleSource:lc("string","DocumentSnapshot"),bundleName:lc("string"),bundle:lc("string")};class Yc extends Xc{data(e={}){return super.data(e)}}class Zc{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new Jc(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){const 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 Yc(this._firestore,this._userDataWriter,n.key,n,new Jc(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new Ba($a,"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=>{const i=new Yc(e._firestore,e._userDataWriter,n.doc.key,n.doc,new Jc(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=>{const i=new Yc(e._firestore,e._userDataWriter,t.doc.key,t.doc,new Jc(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let r=-1,s=-1;return 0!==t.type&&(r=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),s=n.indexOf(t.doc.key)),{type:Qc(t.type),doc:i,oldIndex:r,newIndex:s}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Ba(Fa,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=Zc._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Za.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],i=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),i.push(e.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function Qc(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return La(61501,{type:e})}}Zc._jsonSchemaVersion="firestore/querySnapshot/1.0",Zc._jsonSchema={type:lc("string",Zc._jsonSchemaVersion),bundleSource:lc("string","QuerySnapshot"),bundleName:lc("string"),bundle:lc("string")},function(e,t=!0){!function(e){Ra=e}(tr),Xi(new Fn("firestore",(e,{instanceIdentifier:n,options:i})=>{const r=e.getProvider("app").getImmediate(),s=new $c(new Wa(e.getProvider("auth-internal")),new Xa(r,e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new Ba($a,'"projectId" not provided in firebase.initializeApp.');return new _c(e.options.projectId,t)}(r,n),r);return i={useFetchStreams:t,...i},s._setSettings(i),s},"PUBLIC").setMultipleInstances(!0)),rr(Ca,Aa,e),rr(Ca,Aa,"esm2020")}();const eh="firebasestorage.googleapis.com",th="storageBucket";class nh extends An{constructor(e,t,n=0){super(sh(e),`Firebase Storage: ${t} (${sh(e)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,nh.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return sh(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}}var ih,rh;function sh(e){return"storage/"+e}function oh(){return new nh(ih.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function ah(){return new nh(ih.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function ch(){return new nh(ih.CANCELED,"User canceled the upload/download.")}function hh(){return new nh(ih.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function lh(e){return new nh(ih.INVALID_ARGUMENT,e)}function uh(){return new nh(ih.APP_DELETED,"The Firebase app was deleted.")}function dh(e,t){return new nh(ih.INVALID_FORMAT,"String does not match format '"+e+"': "+t)}function ph(e){throw new nh(ih.INTERNAL_ERROR,"Internal error: "+e)}!function(e){e.UNKNOWN="unknown",e.OBJECT_NOT_FOUND="object-not-found",e.BUCKET_NOT_FOUND="bucket-not-found",e.PROJECT_NOT_FOUND="project-not-found",e.QUOTA_EXCEEDED="quota-exceeded",e.UNAUTHENTICATED="unauthenticated",e.UNAUTHORIZED="unauthorized",e.UNAUTHORIZED_APP="unauthorized-app",e.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",e.INVALID_CHECKSUM="invalid-checksum",e.CANCELED="canceled",e.INVALID_EVENT_NAME="invalid-event-name",e.INVALID_URL="invalid-url",e.INVALID_DEFAULT_BUCKET="invalid-default-bucket",e.NO_DEFAULT_BUCKET="no-default-bucket",e.CANNOT_SLICE_BLOB="cannot-slice-blob",e.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",e.NO_DOWNLOAD_URL="no-download-url",e.INVALID_ARGUMENT="invalid-argument",e.INVALID_ARGUMENT_COUNT="invalid-argument-count",e.APP_DELETED="app-deleted",e.INVALID_ROOT_OPERATION="invalid-root-operation",e.INVALID_FORMAT="invalid-format",e.INTERNAL_ERROR="internal-error",e.UNSUPPORTED_ENVIRONMENT="unsupported-environment"}(ih||(ih={}));class fh{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let n;try{n=fh.makeFromUrl(e,t)}catch(t){return new fh(e,"")}if(""===n.path)return n;throw i=e,new nh(ih.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+i+"'.");var i}static makeFromUrl(e,t){let n=null;const i="([A-Za-z0-9.\\-_]+)";const r=new RegExp("^gs://"+i+"(/(.*))?$","i");function s(e){e.path_=decodeURIComponent(e.path)}const o=t.replace(/[.]/g,"\\."),a=[{regex:r,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:new RegExp(`^https?://${o}/v[A-Za-z0-9_]+/b/${i}/o(/([^?#]*).*)?$`,"i"),indices:{bucket:1,path:3},postModify:s},{regex:new RegExp(`^https?://${t===eh?"(?:storage.googleapis.com|storage.cloud.google.com)":t}/${i}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:s}];for(let t=0;t<a.length;t++){const i=a[t],r=i.regex.exec(e);if(r){const e=r[i.indices.bucket];let t=r[i.indices.path];t||(t=""),n=new fh(e,t),i.postModify(n);break}}if(null==n)throw function(e){return new nh(ih.INVALID_URL,"Invalid URL '"+e+"'.")}(e);return n}}class gh{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}function mh(e){return"string"==typeof e||e instanceof String}function yh(e){return _h()&&e instanceof Blob}function _h(){return"undefined"!=typeof Blob}function wh(e,t,n,i){if(i<t)throw lh(`Invalid value for '${e}'. Expected ${t} or greater.`);if(i>n)throw lh(`Invalid value for '${e}'. Expected ${n} or less.`)}function bh(e,t,n){let i=t;return null==n&&(i=`https://${t}`),`${n}://${i}/v0${e}`}function vh(e){const t=encodeURIComponent;let n="?";for(const i in e)if(e.hasOwnProperty(i)){n=n+(t(i)+"="+t(e[i]))+"&"}return n=n.slice(0,-1),n}function Th(e,t){const n=e>=500&&e<600,i=-1!==[408,429].indexOf(e),r=-1!==t.indexOf(e);return n||i||r}!function(e){e[e.NO_ERROR=0]="NO_ERROR",e[e.NETWORK_ERROR=1]="NETWORK_ERROR",e[e.ABORT=2]="ABORT"}(rh||(rh={}));class Eh{constructor(e,t,n,i,r,s,o,a,c,h,l,u=!0,d=!1){this.url_=e,this.method_=t,this.headers_=n,this.body_=i,this.successCodes_=r,this.additionalRetryCodes_=s,this.callback_=o,this.errorCallback_=a,this.timeout_=c,this.progressCallback_=h,this.connectionFactory_=l,this.retry=u,this.isUsingEmulator=d,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((e,t)=>{this.resolve_=e,this.reject_=t,this.start_()})}start_(){const e=(e,t)=>{if(t)return void e(!1,new Ih(!1,null,!0));const n=this.connectionFactory_();this.pendingConnection_=n;const i=e=>{const t=e.loaded,n=e.lengthComputable?e.total:-1;null!==this.progressCallback_&&this.progressCallback_(t,n)};null!==this.progressCallback_&&n.addUploadProgressListener(i),n.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(i),this.pendingConnection_=null;const t=n.getErrorCode()===rh.NO_ERROR,r=n.getStatus();if(!t||Th(r,this.additionalRetryCodes_)&&this.retry){const t=n.getErrorCode()===rh.ABORT;return void e(!1,new Ih(!1,null,t))}const s=-1!==this.successCodes_.indexOf(r);e(!0,new Ih(s,n))})},t=(e,t)=>{const n=this.resolve_,i=this.reject_,r=t.connection;if(t.wasSuccessCode)try{const e=this.callback_(r,r.getResponse());!function(e){return void 0!==e}(e)?n():n(e)}catch(e){i(e)}else if(null!==r){const e=oh();e.serverResponse=r.getErrorText(),this.errorCallback_?i(this.errorCallback_(r,e)):i(e)}else if(t.canceled){i(this.appDelete_?uh():ch())}else{i(ah())}};this.canceled_?t(0,new Ih(!1,null,!0)):this.backoffId_=function(e,t,n){let i=1,r=null,s=null,o=!1,a=0;function c(){return 2===a}let h=!1;function l(...e){h||(h=!0,t.apply(null,e))}function u(t){r=setTimeout(()=>{r=null,e(p,c())},t)}function d(){s&&clearTimeout(s)}function p(e,...t){if(h)return void d();if(e)return d(),void l.call(null,e,...t);if(c()||o)return d(),void l.call(null,e,...t);let n;i<64&&(i*=2),1===a?(a=2,n=0):n=1e3*(i+Math.random()),u(n)}let f=!1;function g(e){f||(f=!0,d(),h||(null!==r?(e||(a=2),clearTimeout(r),u(0)):e||(a=1)))}return u(0),s=setTimeout(()=>{o=!0,g(!0)},n),g}(e,t,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()}}class Ih{constructor(e,t,n){this.wasSuccessCode=e,this.connection=t,this.canceled=!!n}}function Sh(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function kh(...e){const t=Sh();if(void 0!==t){const n=new t;for(let t=0;t<e.length;t++)n.append(e[t]);return n.getBlob()}if(_h())return new Blob(e);throw new nh(ih.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}function Ch(e){if("undefined"==typeof atob)throw t="base-64",new nh(ih.UNSUPPORTED_ENVIRONMENT,`${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);var t;return atob(e)}const Ah="raw",Ph="base64",Rh="base64url",Oh="data_url";class xh{constructor(e,t){this.data=e,this.contentType=t||null}}function Nh(e,t){switch(e){case Ah:return new xh(Dh(t));case Ph:case Rh:return new xh(Lh(e,t));case Oh:return new xh(function(e){const t=new Uh(e);return t.base64?Lh(Ph,t.rest):function(e){let t;try{t=decodeURIComponent(e)}catch(e){throw dh(Oh,"Malformed data URL.")}return Dh(t)}(t.rest)}(t),new Uh(t).contentType)}throw oh()}function Dh(e){const t=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i<=127)t.push(i);else if(i<=2047)t.push(192|i>>6,128|63&i);else if(55296==(64512&i)){if(n<e.length-1&&56320==(64512&e.charCodeAt(n+1))){i=65536|(1023&i)<<10|1023&e.charCodeAt(++n),t.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i)}else t.push(239,191,189)}else 56320==(64512&i)?t.push(239,191,189):t.push(224|i>>12,128|i>>6&63,128|63&i)}return new Uint8Array(t)}function Lh(e,t){switch(e){case Ph:{const n=-1!==t.indexOf("-"),i=-1!==t.indexOf("_");if(n||i){throw dh(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?")}break}case Rh:{const n=-1!==t.indexOf("+"),i=-1!==t.indexOf("/");if(n||i){throw dh(e,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?")}t=t.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=Ch(t)}catch(t){if(t.message.includes("polyfill"))throw t;throw dh(e,"Invalid character found")}const i=new Uint8Array(n.length);for(let e=0;e<n.length;e++)i[e]=n.charCodeAt(e);return i}class Uh{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(null===t)throw dh(Oh,"Must be formatted 'data:[<mediatype>][;base64],<data>");const n=t[1]||null;null!=n&&(this.base64=function(e,t){const n=e.length>=t.length;if(!n)return!1;return e.substring(e.length-t.length)===t}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=e.substring(e.indexOf(",")+1)}}class Mh{constructor(e,t){let n=0,i="";yh(e)?(this.data_=e,n=e.size,i=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),n=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),n=e.length),this.size_=n,this.type_=i}size(){return this.size_}type(){return this.type_}slice(e,t){if(yh(this.data_)){const n=function(e,t,n){return e.webkitSlice?e.webkitSlice(t,n):e.mozSlice?e.mozSlice(t,n):e.slice?e.slice(t,n):null}(this.data_,e,t);return null===n?null:new Mh(n)}{const n=new Uint8Array(this.data_.buffer,e,t-e);return new Mh(n,!0)}}static getBlob(...e){if(_h()){const t=e.map(e=>e instanceof Mh?e.data_:e);return new Mh(kh.apply(null,t))}{const t=e.map(e=>mh(e)?Nh(Ah,e).data:e.data_);let n=0;t.forEach(e=>{n+=e.byteLength});const i=new Uint8Array(n);let r=0;return t.forEach(e=>{for(let t=0;t<e.length;t++)i[r++]=e[t]}),new Mh(i,!0)}}uploadData(){return this.data_}}function jh(e){let t;try{t=JSON.parse(e)}catch(e){return null}return function(e){return"object"==typeof e&&!Array.isArray(e)}(t)?t:null}function $h(e){const t=e.lastIndexOf("/",e.length-2);return-1===t?e:e.slice(t+1)}function Fh(e,t){return t}class Bh{constructor(e,t,n,i){this.server=e,this.local=t||e,this.writable=!!n,this.xform=i||Fh}}let zh=null;function Hh(){if(zh)return zh;const e=[];e.push(new Bh("bucket")),e.push(new Bh("generation")),e.push(new Bh("metageneration")),e.push(new Bh("name","fullPath",!0));const t=new Bh("name");t.xform=function(e,t){return function(e){return!mh(e)||e.length<2?e:$h(e)}(t)},e.push(t);const n=new Bh("size");return n.xform=function(e,t){return void 0!==t?Number(t):t},e.push(n),e.push(new Bh("timeCreated")),e.push(new Bh("updated")),e.push(new Bh("md5Hash",null,!0)),e.push(new Bh("cacheControl",null,!0)),e.push(new Bh("contentDisposition",null,!0)),e.push(new Bh("contentEncoding",null,!0)),e.push(new Bh("contentLanguage",null,!0)),e.push(new Bh("contentType",null,!0)),e.push(new Bh("metadata","customMetadata",!0)),zh=e,zh}function Vh(e,t,n){const i={type:"file"},r=n.length;for(let e=0;e<r;e++){const r=n[e];i[r.local]=r.xform(i,t[r.server])}return function(e,t){Object.defineProperty(e,"ref",{get:function(){const n=e.bucket,i=e.fullPath,r=new fh(n,i);return t._makeStorageReference(r)}})}(i,e),i}function qh(e,t,n){const i=jh(t);if(null===i)return null;return Vh(e,i,n)}function Wh(e,t){const n={},i=t.length;for(let r=0;r<i;r++){const i=t[r];i.writable&&(n[i.server]=e[i.local])}return JSON.stringify(n)}class Kh{constructor(e,t,n,i){this.url=e,this.method=t,this.handler=n,this.timeout=i,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function Gh(e){if(!e)throw oh()}function Jh(e,t){return function(n,i){const r=qh(e,i,t);return Gh(null!==r),r}}function Xh(e,t){return function(n,i){const r=qh(e,i,t);return Gh(null!==r),function(e,t,n,i){const r=jh(t);if(null===r)return null;if(!mh(r.downloadTokens))return null;const s=r.downloadTokens;if(0===s.length)return null;const o=encodeURIComponent;return s.split(",").map(t=>{const r=e.bucket,s=e.fullPath;return bh("/b/"+o(r)+"/o/"+o(s),n,i)+vh({alt:"media",token:t})})[0]}(r,i,e.host,e._protocol)}}function Yh(e){return function(t,n){let i;var r,s;return 401===t.getStatus()?i=t.getErrorText().includes("Firebase App Check token is invalid")?new nh(ih.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new nh(ih.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(s=e.bucket,i=new nh(ih.QUOTA_EXCEEDED,"Quota for bucket '"+s+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=e.path,i=new nh(ih.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):i=n,i.status=t.getStatus(),i.serverResponse=n.serverResponse,i}}function Zh(e){const t=Yh(e);return function(n,i){let r=t(n,i);var s;return 404===n.getStatus()&&(s=e.path,r=new nh(ih.OBJECT_NOT_FOUND,"Object '"+s+"' does not exist.")),r.serverResponse=i.serverResponse,r}}function Qh(e,t,n){const i=Object.assign({},n);return i.fullPath=e.path,i.size=t.size(),i.contentType||(i.contentType=function(e,t){return e&&e.contentType||t&&t.type()||"application/octet-stream"}(null,t)),i}class el{constructor(e,t,n,i){this.current=e,this.total=t,this.finalized=!!n,this.metadata=i||null}}function tl(e,t){let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Status")}catch(e){Gh(!1)}return Gh(!!n&&-1!==(t||["active"]).indexOf(n)),n}const nl=262144;function il(e,t,n,i,r,s,o,a){const c=new el(0,0);if(o?(c.current=o.current,c.total=o.total):(c.current=0,c.total=i.size()),i.size()!==c.total)throw new nh(ih.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");const h=c.total-c.current;let l=h;r>0&&(l=Math.min(l,r));const u=c.current,d=u+l;let p="";p=0===l?"finalize":h===l?"upload, finalize":"upload";const f={"X-Goog-Upload-Command":p,"X-Goog-Upload-Offset":`${c.current}`},g=i.slice(u,d);if(null===g)throw hh();const m=t.maxUploadRetryTime,y=new Kh(n,"POST",function(e,n){const r=tl(e,["active","final"]),o=c.current+l,a=i.size();let h;return h="final"===r?Jh(t,s)(e,n):null,new el(o,a,"final"===r,h)},m);return y.headers=f,y.body=g.uploadData(),y.progressCallback=a||null,y.errorHandler=Yh(e),y}const rl="running",sl="paused",ol="success",al="canceled",cl="error";function hl(e){switch(e){case"running":case"pausing":case"canceling":return rl;case"paused":return sl;case"success":return ol;case"canceled":return al;default:return cl}}class ll{constructor(e,t,n){const i=function(e){return"function"==typeof e}(e)||null!=t||null!=n;if(i)this.next=e,this.error=t??void 0,this.complete=n??void 0;else{const t=e;this.next=t.next,this.error=t.error,this.complete=t.complete}}}function ul(e){return(...t)=>{Promise.resolve().then(()=>e(...t))}}class dl{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=rh.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=rh.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=rh.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,n,i,r){if(this.sent_)throw ph("cannot .send() more than once");if(yn(e)&&n&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(t,e,!0),void 0!==r)for(const e in r)r.hasOwnProperty(e)&&this.xhr_.setRequestHeader(e,r[e].toString());return void 0!==i?this.xhr_.send(i):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw ph("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw ph("cannot .getStatus() before sending");try{return this.xhr_.status}catch(e){return-1}}getResponse(){if(!this.sent_)throw ph("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw ph("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",e)}}class pl extends dl{initXhr(){this.xhr_.responseType="text"}}function fl(){return new pl}class gl{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(e,t,n=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=n,this._mappings=Hh(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=e=>{if(this._request=void 0,this._chunkMultiplier=1,e._codeEquals(ih.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const t=this.isExponentialBackoffExpired();if(Th(e.status,[])){if(!t)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();e=ah()}this._error=e,this._transition("error")}},this._metadataErrorHandler=e=>{this._request=void 0,e._codeEquals(ih.CANCELED)?this.completeTransitions_():(this._error=e,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){const e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>262144}_start(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([t,n])=>{switch(this._state){case"running":e(t,n);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}})}_createResumable(){this._resolveToken((e,t)=>{const n=function(e,t,n,i,r){const s=t.bucketOnlyServerUrl(),o=Qh(t,i,r),a={name:o.fullPath},c=bh(s,e.host,e._protocol),h={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${i.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},l=Wh(o,n),u=e.maxUploadRetryTime,d=new Kh(c,"POST",function(e){let t;tl(e);try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(e){Gh(!1)}return Gh(mh(t)),t},u);return d.urlParams=a,d.headers=h,d.body=l,d.errorHandler=Yh(t),d}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),i=this._ref.storage._makeRequest(n,fl,e,t);this._request=i,i.getPromise().then(e=>{this._request=void 0,this._uploadUrl=e,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const e=this._uploadUrl;this._resolveToken((t,n)=>{const i=function(e,t,n,i){const r=e.maxUploadRetryTime,s=new Kh(n,"POST",function(e){const t=tl(e,["active","final"]);let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(e){Gh(!1)}n||Gh(!1);const r=Number(n);return Gh(!isNaN(r)),new el(r,i.size(),"final"===t)},r);return s.headers={"X-Goog-Upload-Command":"query"},s.errorHandler=Yh(t),s}(this._ref.storage,this._ref._location,e,this._blob),r=this._ref.storage._makeRequest(i,fl,t,n);this._request=r,r.getPromise().then(e=>{this._request=void 0,this._updateProgress(e.current),this._needToFetchStatus=!1,e.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=nl*this._chunkMultiplier,t=new el(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken((i,r)=>{let s;try{s=il(this._ref._location,this._ref.storage,n,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(e){return this._error=e,void this._transition("error")}const o=this._ref.storage._makeRequest(s,fl,i,r,!1);this._request=o,o.getPromise().then(e=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(e.current),e.finalized?(this._metadata=e.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){2*(nl*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{const n=function(e,t,n){const i=bh(t.fullServerUrl(),e.host,e._protocol),r=e.maxOperationRetryTime,s=new Kh(i,"GET",Jh(e,n),r);return s.errorHandler=Zh(t),s}(this._ref.storage,this._ref._location,this._mappings),i=this._ref.storage._makeRequest(n,fl,e,t);this._request=i,i.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{const n=function(e,t,n,i,r){const s=t.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"},a=function(){let e="";for(let t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}();o["Content-Type"]="multipart/related; boundary="+a;const c=Qh(t,i,r),h="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+Wh(c,n)+"\r\n--"+a+"\r\nContent-Type: "+c.contentType+"\r\n\r\n",l="\r\n--"+a+"--",u=Mh.getBlob(h,i,l);if(null===u)throw hh();const d={name:c.fullPath},p=bh(s,e.host,e._protocol),f=e.maxUploadRetryTime,g=new Kh(p,"POST",Jh(e,n),f);return g.urlParams=d,g.headers=o,g.body=u.uploadData(),g.errorHandler=Yh(t),g}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),i=this._ref.storage._makeRequest(n,fl,e,t);this._request=i,i.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){const t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const t="paused"===this._state;this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":case"error":case"success":this._state=e,this._notifyObservers();break;case"canceled":this._error=ch(),this._state=e,this._notifyObservers()}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}}get snapshot(){const e=hl(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,n,i){const r=new ll(t||void 0,n||void 0,i||void 0);return this._addObserver(r),()=>{this._removeObserver(r)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const t=this._observers.indexOf(e);-1!==t&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise();this._observers.slice().forEach(e=>{this._notifyObserver(e)})}_finishPromise(){if(void 0!==this._resolve){let e=!0;switch(hl(this._state)){case ol:ul(this._resolve.bind(null,this.snapshot))();break;case al:case cl:ul(this._reject.bind(null,this._error))();break;default:e=!1}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(hl(this._state)){case rl:case sl:e.next&&ul(e.next.bind(e,this.snapshot))();break;case ol:e.complete&&ul(e.complete.bind(e))();break;default:e.error&&ul(e.error.bind(e,this._error))()}}resume(){const e="paused"===this._state||"pausing"===this._state;return e&&this._transition("running"),e}pause(){const e="running"===this._state;return e&&this._transition("pausing"),e}cancel(){const e="running"===this._state||"pausing"===this._state;return e&&this._transition("canceling"),e}}class ml{constructor(e,t){this._service=e,this._location=t instanceof fh?t:fh.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new ml(e,t)}get root(){const e=new fh(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return $h(this._location.path)}get storage(){return this._service}get parent(){const e=function(e){if(0===e.length)return null;const t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)}(this._location.path);if(null===e)return null;const t=new fh(this._location.bucket,e);return new ml(this._service,t)}_throwIfRoot(e){if(""===this._location.path)throw function(e){return new nh(ih.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').")}(e)}}function yl(e,t){e._throwIfRoot("updateMetadata");const n=function(e,t,n,i){const r=bh(t.fullServerUrl(),e.host,e._protocol),s=Wh(n,i),o=e.maxOperationRetryTime,a=new Kh(r,"PATCH",Jh(e,i),o);return a.headers={"Content-Type":"application/json; charset=utf-8"},a.body=s,a.errorHandler=Zh(t),a}(e.storage,e._location,t,Hh());return e.storage.makeRequestWithTokens(n,fl)}function _l(e){e._throwIfRoot("getDownloadURL");const t=function(e,t,n){const i=bh(t.fullServerUrl(),e.host,e._protocol),r=e.maxOperationRetryTime,s=new Kh(i,"GET",Xh(e,n),r);return s.errorHandler=Zh(t),s}(e.storage,e._location,Hh());return e.storage.makeRequestWithTokens(t,fl).then(e=>{if(null===e)throw new nh(ih.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return e})}function wl(e,t){if(e instanceof Tl){const n=e;if(null==n._bucket)throw new nh(ih.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+th+"' property when initializing the app?");const i=new ml(n,n._bucket);return null!=t?wl(i,t):i}return void 0!==t?function(e,t){const n=function(e,t){const n=t.split("/").filter(e=>e.length>0).join("/");return 0===e.length?n:e+"/"+n}(e._location.path,t),i=new fh(e._location.bucket,n);return new ml(e.storage,i)}(e,t):e}function bl(e,t){if(t&&/^[A-Za-z]+:\/\//.test(t)){if(e instanceof Tl)return new ml(e,t);throw lh("To use ref(service, url), the first argument must be a Storage instance.")}return wl(e,t)}function vl(e,t){const n=t?.[th];return null==n?null:fh.makeFromBucketSpec(n,e)}class Tl{constructor(e,t,n,i,r,s=!1){this.app=e,this._authProvider=t,this._appCheckProvider=n,this._url=i,this._firebaseVersion=r,this._isUsingEmulator=s,this._bucket=null,this._host=eh,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=i?fh.makeFromBucketSpec(i,this._host):vl(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=fh.makeFromBucketSpec(this._url,e):this._bucket=vl(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){wh("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){wh("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(null!==t)return t.accessToken}return null}async _getAppCheckToken(){if(Zi(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});if(e){return(await e.getToken()).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 ml(this,e)}_makeRequest(e,t,n,i,r=!0){if(this._deleted)return new gh(uh());{const s=function(e,t,n,i,r,s,o=!0,a=!1){const c=vh(e.urlParams),h=e.url+c,l=Object.assign({},e.headers);return function(e,t){t&&(e["X-Firebase-GMPID"]=t)}(l,t),function(e,t){null!==t&&t.length>0&&(e.Authorization="Firebase "+t)}(l,n),function(e,t){e["X-Firebase-Storage-Version"]="webjs/"+(t??"AppManager")}(l,s),function(e,t){null!==t&&(e["X-Firebase-AppCheck"]=t)}(l,i),new Eh(h,e.method,l,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,r,o,a)}(e,this._appId,n,i,t,this._firebaseVersion,r,this._isUsingEmulator);return this._requests.add(s),s.getPromise().then(()=>this._requests.delete(s),()=>this._requests.delete(s)),s}}async makeRequestWithTokens(e,t){const[n,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,n,i).getPromise()}}const El="@firebase/storage",Il="0.14.0",Sl="storage";function kl(e,t,n){return function(e,t,n){return e._throwIfRoot("uploadBytesResumable"),new gl(e,new Mh(t),n)}(e=$n(e),t,n)}function Cl(e,{instanceIdentifier:t}){const n=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),r=e.getProvider("app-check-internal");return new Tl(n,i,r,t,tr)}Xi(new Fn(Sl,Cl,"PUBLIC").setMultipleInstances(!0)),rr(El,Il,""),rr(El,Il,"esm2020");const Al=JSON.parse(process.env.FIREBASE_CONFIG||"{}"),Pl=nr(Al),Rl=function(e){const t="object"==typeof e?e:ir(),n="string"==typeof e?e:yc,i=Yi(t,"firestore").getImmediate({identifier:n});if(!i._initialized){const e=pn("firestore");e&&xc(i,...e)}return i}(Pl),Ol=function(e=ir(),t){const n=Yi(e=$n(e),Sl).getImmediate({identifier:t}),i=pn("storage");return i&&function(e,t,n,i={}){!function(e,t,n,i={}){e.host=`${t}:${n}`;const r=yn(t);r&&(_n(`https://${e.host}/b`),Tn("Storage",!0)),e._isUsingEmulator=!0,e._protocol=r?"https":"http";const{mockUserToken:s}=i;s&&(e._overrideAuthToken="string"==typeof s?s:wn(s,e.app.options.projectId))}(e,t,n,i)}(n,...i),n}(Pl),xl=Ta(Pl),Nl=xl.currentUser,Dl=s`
147
+ `,Sn=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},Cn={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_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){const i=e[t],s=t+1<e.length,o=s?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Sn(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){const i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(s>>10)),t[r++]=String.fromCharCode(56320+(1023&s))}else{const s=e[n++],o=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){const i=n[e.charAt(t++)],s=t<e.length?n[e.charAt(t)]:0;++t;const o=t<e.length?n[e.charAt(t)]:64;++t;const a=t<e.length?n[e.charAt(t)]:64;if(++t,null==i||null==s||null==o||null==a)throw new kn;const c=i<<2|s>>4;if(r.push(c),64!==o){const e=s<<4&240|o>>2;if(r.push(e),64!==a){const e=o<<6&192|a;r.push(e)}}}return r},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)}}};class kn extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const An=function(e){return function(e){const t=Sn(e);return Cn.encodeByteArray(t,!0)}(e).replace(/\./g,"")},Rn=function(e){try{return Cn.decodeString(e,!0)}catch(e){}return null};const On=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,Pn=()=>{try{return On()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&Rn(e[1]);return t&&JSON.parse(t)})()}catch(e){return}},xn=e=>Pn()?.emulatorHosts?.[e],Nn=e=>{const t=xn(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]},Dn=()=>Pn()?.config,Ln=e=>Pn()?.[`_${e}`];class Mn{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))}}}function Un(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function $n(e){return(await fetch(e,{credentials:"include"})).ok}function Fn(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",r=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s={iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...e};return[An(JSON.stringify({alg:"none",type:"JWT"})),An(JSON.stringify(s)),""].join(".")}const jn={};let Vn=!1;function Bn(e,t){if("undefined"==typeof window||"undefined"==typeof document||!Un(window.location.host)||jn[e]===t||jn[e]||Vn)return;function n(e){return`__firebase__banner__${e}`}jn[e]=t;const r="__firebase__banner",i=function(){const e={prod:[],emulator:[]};for(const t of Object.keys(jn))jn[t]?e.emulator.push(t):e.prod.push(t);return e}().prod.length>0;function s(){const e=document.createElement("span");return e.style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" &times;",e.onclick=()=>{Vn=!0,function(){const e=document.getElementById(r);e&&e.remove()}()},e}function o(){const e=function(e){let t=document.getElementById(e),n=!1;return t||(t=document.createElement("div"),t.setAttribute("id",e),n=!0),{created:n,element:t}}(r),t=n("text"),o=document.getElementById(t)||document.createElement("span"),a=n("learnmore"),c=document.getElementById(a)||document.createElement("a"),l=n("preprendIcon"),u=document.getElementById(l)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(e.created){const t=e.element;!function(e){e.style.display="flex",e.style.background="#7faaf0",e.style.position="fixed",e.style.bottom="5px",e.style.left="5px",e.style.padding=".5em",e.style.borderRadius="5px",e.style.alignItems="center"}(t),function(e,t){e.setAttribute("id",t),e.innerText="Learn more",e.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",e.setAttribute("target","__blank"),e.style.paddingLeft="5px",e.style.textDecoration="underline"}(c,a);const n=s();!function(e,t){e.setAttribute("width","24"),e.setAttribute("id",t),e.setAttribute("height","24"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.style.marginLeft="-6px"}(u,l),t.append(u,o,c,n),document.body.appendChild(t)}i?(o.innerText="Preview backend disconnected.",u.innerHTML='<g clip-path="url(#clip0_6013_33858)">\n<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6013_33858">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>'):(u.innerHTML='<g clip-path="url(#clip0_6083_34804)">\n<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6083_34804">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>',o.innerText="Preview backend running in this workspace."),o.setAttribute("id",t)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",o):o()}function zn(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function qn(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function Hn(){return!function(){const e=Pn()?.forceEnvironment;if("node"===e)return!0;if("browser"===e)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Kn(){try{return"object"==typeof indexedDB}catch(e){return!1}}function Wn(){return new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{t(i.error?.message||"")}}catch(e){t(e)}})}function Gn(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class Xn extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,Xn.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Qn.prototype.create)}}class Qn{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,i=this.errors[e],s=i?function(e,t){return e.replace(Jn,(e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`})}(i,n):"Error",o=`${this.serviceName}: ${s} (${r}).`;return new Xn(r,o,n)}}const Jn=/\{\$([^}]+)}/g;function Yn(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const i of n){if(!r.includes(i))return!1;const n=e[i],s=t[i];if(Zn(n)&&Zn(s)){if(!Yn(n,s))return!1}else if(n!==s)return!1}for(const e of r)if(!n.includes(e))return!1;return!0}function Zn(e){return null!==e&&"object"==typeof e}function er(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function tr(e){const t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t}function nr(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class rr{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 r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=ir),void 0===r.error&&(r.error=ir),void 0===r.complete&&(r.complete=ir);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}}),this.observers.push(r),i}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}})}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 ir(){}function sr(e,t=1e3,n=2){const r=t*Math.pow(n,e),i=Math.round(.5*r*(Math.random()-.5)*2);return Math.min(144e5,r+i)}function or(e){return e&&e._delegate?e._delegate:e}class ar{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}}const cr="[DEFAULT]";class lr{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){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new Mn;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e?.identifier),n=e?.optional??!1;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(n)return null;throw e}}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(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:cr})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=cr){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const 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=cr){return this.instances.has(e)}getOptions(e=cr){return this.instancesOptions.get(e)||{}}initialize(e={}){const{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`);const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(r)}return r}onInit(e,t){const n=this.normalizeInstanceIdentifier(t),r=this.onInitCallbacks.get(n)??new Set;r.add(e),this.onInitCallbacks.set(n,r);const i=this.instances.get(n);return i&&e(i,n),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e,r===cr?void 0:r),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{}var r;return n||null}normalizeInstanceIdentifier(e=cr){return this.component?this.component.multipleInstances?e:cr:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class ur{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new lr(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}var hr;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(hr||(hr={}));const dr={debug:hr.DEBUG,verbose:hr.VERBOSE,info:hr.INFO,warn:hr.WARN,error:hr.ERROR,silent:hr.SILENT},pr=hr.INFO,fr={[hr.DEBUG]:"log",[hr.VERBOSE]:"log",[hr.INFO]:"info",[hr.WARN]:"warn",[hr.ERROR]:"error"},gr=(e,t,...n)=>{if(t<e.logLevel)return;(new Date).toISOString();if(!fr[t])throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class mr{constructor(e){this.name=e,this._logLevel=pr,this._logHandler=gr,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in hr))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?dr[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,hr.DEBUG,...e),this._logHandler(this,hr.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,hr.VERBOSE,...e),this._logHandler(this,hr.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,hr.INFO,...e),this._logHandler(this,hr.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,hr.WARN,...e),this._logHandler(this,hr.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,hr.ERROR,...e),this._logHandler(this,hr.ERROR,...e)}}let yr,_r;const wr=new WeakMap,vr=new WeakMap,br=new WeakMap,Er=new WeakMap,Tr=new WeakMap;let Ir={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return vr.get(e);if("objectStoreNames"===t)return e.objectStoreNames||br.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return kr(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Sr(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(_r||(_r=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Ar(this),t),kr(wr.get(this))}:function(...t){return kr(e.apply(Ar(this),t))}:function(t,...n){const r=e.call(Ar(this),t,...n);return br.set(r,t.sort?t.sort():[t]),kr(r)}}function Cr(e){return"function"==typeof e?Sr(e):(e instanceof IDBTransaction&&function(e){if(vr.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});vr.set(e,t)}(e),t=e,(yr||(yr=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,Ir):e);var t}function kr(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(kr(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",s)});return t.then(t=>{t instanceof IDBCursor&&wr.set(t,e)}).catch(()=>{}),Tr.set(t,e),t}(e);if(Er.has(e))return Er.get(e);const t=Cr(e);return t!==e&&(Er.set(e,t),Tr.set(t,e)),t}const Ar=e=>Tr.get(e);function Rr(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(e,t),a=kr(o);return r&&o.addEventListener("upgradeneeded",e=>{r(kr(o.result),e.oldVersion,e.newVersion,kr(o.transaction),e)}),n&&o.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}function Or(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",e=>t(e.oldVersion,e)),kr(n).then(()=>{})}const Pr=["get","getKey","getAll","getAllKeys","count"],xr=["put","add","delete","clear"],Nr=new Map;function Dr(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Nr.get(t))return Nr.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=xr.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Pr.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,i?"readwrite":"readonly");let o=s.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&s.done]))[0]};return Nr.set(t,s),s}Ir=(e=>({...e,get:(t,n,r)=>Dr(t,n)||e.get(t,n,r),has:(t,n)=>!!Dr(t,n)||e.has(t,n)}))(Ir);class Lr{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===t?.type}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const Mr="@firebase/app",Ur="0.14.6",$r=new mr("@firebase/app"),Fr="@firebase/app-compat",jr="@firebase/analytics-compat",Vr="@firebase/analytics",Br="@firebase/app-check-compat",zr="@firebase/app-check",qr="@firebase/auth",Hr="@firebase/auth-compat",Kr="@firebase/database",Wr="@firebase/data-connect",Gr="@firebase/database-compat",Xr="@firebase/functions",Qr="@firebase/functions-compat",Jr="@firebase/installations",Yr="@firebase/installations-compat",Zr="@firebase/messaging",ei="@firebase/messaging-compat",ti="@firebase/performance",ni="@firebase/performance-compat",ri="@firebase/remote-config",ii="@firebase/remote-config-compat",si="@firebase/storage",oi="@firebase/storage-compat",ai="@firebase/firestore",ci="@firebase/ai",li="@firebase/firestore-compat",ui="firebase",hi="[DEFAULT]",di={[Mr]:"fire-core",[Fr]:"fire-core-compat",[Vr]:"fire-analytics",[jr]:"fire-analytics-compat",[zr]:"fire-app-check",[Br]:"fire-app-check-compat",[qr]:"fire-auth",[Hr]:"fire-auth-compat",[Kr]:"fire-rtdb",[Wr]:"fire-data-connect",[Gr]:"fire-rtdb-compat",[Xr]:"fire-fn",[Qr]:"fire-fn-compat",[Jr]:"fire-iid",[Yr]:"fire-iid-compat",[Zr]:"fire-fcm",[ei]:"fire-fcm-compat",[ti]:"fire-perf",[ni]:"fire-perf-compat",[ri]:"fire-rc",[ii]:"fire-rc-compat",[si]:"fire-gcs",[oi]:"fire-gcs-compat",[ai]:"fire-fst",[li]:"fire-fst-compat",[ci]:"fire-vertex","fire-js":"fire-js",[ui]:"fire-js-all"},pi=new Map,fi=new Map,gi=new Map;function mi(e,t){try{e.container.addComponent(t)}catch(n){$r.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function yi(e){const t=e.name;if(gi.has(t))return $r.debug(`There were multiple attempts to register component ${t}.`),!1;gi.set(t,e);for(const t of pi.values())mi(t,e);for(const t of fi.values())mi(t,e);return!0}function _i(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function wi(e){return null!=e&&void 0!==e.settings}const vi=new Qn("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","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class bi{constructor(e,t,n){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new ar("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 vi.create("app-deleted",{appName:this._name})}}const Ei="12.6.0";function Ti(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r={name:hi,automaticDataCollectionEnabled:!0,...t},i=r.name;if("string"!=typeof i||!i)throw vi.create("bad-app-name",{appName:String(i)});if(n||(n=Dn()),!n)throw vi.create("no-options");const s=pi.get(i);if(s){if(Yn(n,s.options)&&Yn(r,s.config))return s;throw vi.create("duplicate-app",{appName:i})}const o=new ur(i);for(const e of gi.values())o.addComponent(e);const a=new bi(n,r,o);return pi.set(i,a),a}function Ii(e=hi){const t=pi.get(e);if(!t&&e===hi&&Dn())return Ti();if(!t)throw vi.create("no-app",{appName:e});return t}function Si(e,t,n){let r=di[e]??e;n&&(r+=`-${n}`);const i=r.match(/\s|\//),s=t.match(/\s|\//);if(i||s){const e=[`Unable to register library "${r}" with version "${t}":`];return i&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&e.push("and"),s&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void $r.warn(e.join(" "))}yi(new ar(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}const Ci="firebase-heartbeat-store";let ki=null;function Ai(){return ki||(ki=Rr("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Ci)}catch(e){}}}).catch(e=>{throw vi.create("idb-open",{originalErrorMessage:e.message})})),ki}async function Ri(e,t){try{const n=(await Ai()).transaction(Ci,"readwrite"),r=n.objectStore(Ci);await r.put(t,Oi(e)),await n.done}catch(e){if(e instanceof Xn)$r.warn(e.message);else{const t=vi.create("idb-set",{originalErrorMessage:e?.message});$r.warn(t.message)}}}function Oi(e){return`${e.name}!${e.options.appId}`}class Pi{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Ni(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){try{const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=xi();if(null==this._heartbeatsCache?.heartbeats&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats))return;if(this._heartbeatsCache.lastSentHeartbeatDate===t||this._heartbeatsCache.heartbeats.some(e=>e.date===t))return;if(this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats.length>30){const e=function(e){if(0===e.length)return-1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){$r.warn(e)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats||0===this._heartbeatsCache.heartbeats.length)return"";const e=xi(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let r=e.slice();for(const i of e){const e=n.find(e=>e.agent===i.agent);if(e){if(e.dates.push(i.date),Di(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Di(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),r=An(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)),r}catch(e){return $r.warn(e),""}}}function xi(){return(new Date).toISOString().substring(0,10)}class Ni{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!Kn()&&Wn().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Ai()).transaction(Ci),n=await t.objectStore(Ci).get(Oi(e));return await t.done,n}catch(e){if(e instanceof Xn)$r.warn(e.message);else{const t=vi.create("idb-get",{originalErrorMessage:e?.message});$r.warn(t.message)}}}(this.app);return e?.heartbeats?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const t=await this.read();return Ri(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){if(await this._canUseIndexedDBPromise){const t=await this.read();return Ri(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:[...t.heartbeats,...e.heartbeats]})}}}function Di(e){return An(JSON.stringify({version:2,heartbeats:e})).length}var Li;function Mi(){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."}}Li="",yi(new ar("platform-logger",e=>new Lr(e),"PRIVATE")),yi(new ar("heartbeat",e=>new Pi(e),"PRIVATE")),Si(Mr,Ur,Li),Si(Mr,Ur,"esm2020"),Si("fire-js","");const Ui=Mi,$i=new Qn("auth","Firebase",{"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."}),Fi=new mr("@firebase/auth");function ji(e,...t){Fi.logLevel<=hr.ERROR&&Fi.error(`Auth (${Ei}): ${e}`,...t)}function Vi(e,...t){throw Hi(e,...t)}function Bi(e,...t){return Hi(e,...t)}function zi(e,t,n){const r={...Ui(),[t]:n};return new Qn("auth","Firebase",r).create(t,{appName:e.name})}function qi(e){return zi(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Hi(e,...t){if("string"!=typeof e){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return $i.create(e,...t)}function Ki(e,t,...n){if(!e)throw Hi(t,...n)}function Wi(e){const t="INTERNAL ASSERTION FAILED: "+e;throw ji(t),new Error(t)}function Gi(e,t){e||Wi(t)}function Xi(){return"undefined"!=typeof self&&self.location?.href||""}function Qi(){return"undefined"!=typeof self&&self.location?.protocol||null}function Ji(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Qi()&&"https:"!==Qi()&&!qn()&&!("connection"in navigator)||navigator.onLine}class Yi{constructor(e,t){this.shortDelay=e,this.longDelay=t,Gi(t>e,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(zn())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Ji()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Zi(e,t){Gi(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class es{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:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Wi("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:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Wi("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:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Wi("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const ts={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",INVALID_LOGIN_CREDENTIALS:"invalid-credential",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"},ns=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],rs=new Yi(3e4,6e4);function is(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function ss(e,t,n,r,i={}){return os(e,i,async()=>{let i={},s={};r&&("GET"===t?s=r:i={body:JSON.stringify(r)});const o=er({key:e.config.apiKey,...s}).slice(1),a=await e._getAdditionalHeaders();a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode);const c={method:t,headers:a,...i};return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(c.referrerPolicy="no-referrer"),e.emulatorConfig&&Un(e.emulatorConfig.host)&&(c.credentials="include"),es.fetch()(await cs(e,e.config.apiHost,n,o),c)})}async function os(e,t,n){e._canInitEmulator=!1;const r={...ts,...t};try{const t=new us(e),i=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const s=await i.json();if("needConfirmation"in s)throw hs(e,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{const t=i.ok?s.errorMessage:s.error.message,[n,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw hs(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw hs(e,"email-already-in-use",s);if("USER_DISABLED"===n)throw hs(e,"user-disabled",s);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw zi(e,a,o);Vi(e,a)}}catch(t){if(t instanceof Xn)throw t;Vi(e,"network-request-failed",{message:String(t)})}}async function as(e,t,n,r,i={}){const s=await ss(e,t,n,r,i);return"mfaPendingCredential"in s&&Vi(e,"multi-factor-auth-required",{_serverResponse:s}),s}async function cs(e,t,n,r){const i=`${t}${n}?${r}`,s=e,o=s.config.emulator?Zi(e.config,i):`${e.config.apiScheme}://${i}`;if(ns.includes(n)&&(await s._persistenceManagerAvailable,"COOKIE"===s._getPersistenceType())){return s._getPersistence()._getFinalTarget(o).toString()}return o}function ls(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class us{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(Bi(this.auth,"network-request-failed")),rs.get())})}}function hs(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=Bi(e,t,r);return i.customData._tokenResponse=n,i}function ds(e){return void 0!==e&&void 0!==e.enterprise}class ps{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return ls(t.enforcementState);return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function fs(e,t){return ss(e,"POST","/v1/accounts:lookup",t)}function gs(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function ms(e){return 1e3*Number(e)}function ys(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return ji("JWT malformed, contained fewer than 3 sections"),null;try{const e=Rn(n);return e?JSON.parse(e):(ji("Failed to decode base64 JWT payload"),null)}catch(e){return ji("Caught error parsing JWT payload as JSON",e?.toString()),null}}function _s(e){const t=ys(e);return Ki(t,"internal-error"),Ki(void 0!==t.exp,"internal-error"),Ki(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function ws(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof Xn&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class vs{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){if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===e?.code&&this.schedule(!0))}this.schedule()}}class bs{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=gs(this.lastLoginAt),this.creationTime=gs(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function Es(e){const t=e.auth,n=await e.getIdToken(),r=await ws(e,fs(t,{idToken:n}));Ki(r?.users.length,t,"internal-error");const i=r.users[0];e._notifyReloadListener(i);const s=i.providerUserInfo?.length?Ts(i.providerUserInfo):[],o=function(e,t){const n=e.filter(e=>!t.some(t=>t.providerId===e.providerId));return[...n,...t]}(e.providerData,s),a=e.isAnonymous,c=!(e.email&&i.passwordHash||o?.length),l=!!a&&c,u={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new bs(i.createdAt,i.lastLoginAt),isAnonymous:l};Object.assign(e,u)}function Ts(e){return e.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}class Is{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Ki(e.idToken,"internal-error"),Ki(void 0!==e.idToken,"internal-error"),Ki(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):_s(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){Ki(0!==e.length,"internal-error");const t=_s(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(Ki(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:r,expiresIn:i}=await async function(e,t){const n=await os(e,{},async()=>{const n=er({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:i}=e.config,s=await cs(e,r,"/v1/token",`key=${i}`),o=await e._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:o,body:n};return e.emulatorConfig&&Un(e.emulatorConfig.host)&&(a.credentials="include"),es.fetch()(s,a)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:r,expirationTime:i}=t,s=new Is;return n&&(Ki("string"==typeof n,"internal-error",{appName:e}),s.refreshToken=n),r&&(Ki("string"==typeof r,"internal-error",{appName:e}),s.accessToken=r),i&&(Ki("number"==typeof i,"internal-error",{appName:e}),s.expirationTime=i),s}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 Is,this.toJSON())}_performRefresh(){return Wi("not implemented")}}function Ss(e,t){Ki("string"==typeof e||void 0===e,"internal-error",{appName:t})}class Cs{constructor({uid:e,auth:t,stsTokenManager:n,...r}){this.providerId="firebase",this.proactiveRefresh=new vs(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new bs(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await ws(this,this.stsTokenManager.getToken(this.auth,e));return Ki(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const n=or(e),r=await n.getIdToken(t),i=ys(r);Ki(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s="object"==typeof i.firebase?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:r,authTime:gs(ms(i.auth_time)),issuedAtTime:gs(ms(i.iat)),expirationTime:gs(ms(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}(this,e)}reload(){return async function(e){const t=or(e);await Es(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(Ki(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=>({...e})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new Cs({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){Ki(!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 Es(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(wi(this.auth.app))return Promise.reject(qi(this.auth));const e=await this.getIdToken();return await ws(this,async function(e,t){return ss(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{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=>({...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){const n=t.displayName??void 0,r=t.email??void 0,i=t.phoneNumber??void 0,s=t.photoURL??void 0,o=t.tenantId??void 0,a=t._redirectEventId??void 0,c=t.createdAt??void 0,l=t.lastLoginAt??void 0,{uid:u,emailVerified:h,isAnonymous:d,providerData:p,stsTokenManager:f}=t;Ki(u&&f,e,"internal-error");const g=Is.fromJSON(this.name,f);Ki("string"==typeof u,e,"internal-error"),Ss(n,e.name),Ss(r,e.name),Ki("boolean"==typeof h,e,"internal-error"),Ki("boolean"==typeof d,e,"internal-error"),Ss(i,e.name),Ss(s,e.name),Ss(o,e.name),Ss(a,e.name),Ss(c,e.name),Ss(l,e.name);const m=new Cs({uid:u,auth:e,email:r,emailVerified:h,displayName:n,isAnonymous:d,photoURL:s,phoneNumber:i,tenantId:o,stsTokenManager:g,createdAt:c,lastLoginAt:l});return p&&Array.isArray(p)&&(m.providerData=p.map(e=>({...e}))),a&&(m._redirectEventId=a),m}static async _fromIdTokenResponse(e,t,n=!1){const r=new Is;r.updateFromServerResponse(t);const i=new Cs({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await Es(i),i}static async _fromGetAccountInfoResponse(e,t,n){const r=t.users[0];Ki(void 0!==r.localId,"internal-error");const i=void 0!==r.providerUserInfo?Ts(r.providerUserInfo):[],s=!(r.email&&r.passwordHash||i?.length),o=new Is;o.updateFromIdToken(n);const a=new Cs({uid:r.localId,auth:e,stsTokenManager:o,isAnonymous:s}),c={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:i,metadata:new bs(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash||i?.length)};return Object.assign(a,c),a}}const ks=new Map;function As(e){Gi(e instanceof Function,"Expected a class definition");let t=ks.get(e);return t?(Gi(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,ks.set(e,t),t)}class Rs{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Rs.type="NONE";const Os=Rs;function Ps(e,t,n){return`firebase:${e}:${t}:${n}`}class xs{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:r,name:i}=this.auth;this.fullUserKey=Ps(this.userKey,r.apiKey,i),this.fullPersistenceKey=Ps("persistence",r.apiKey,i),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(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){const t=await fs(this.auth,{idToken:e}).catch(()=>{});return t?Cs._fromGetAccountInfoResponse(this.auth,t,e):null}return Cs._fromJSON(this.auth,e)}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;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new xs(As(Os),e,n);const r=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let i=r[0]||As(Os);const s=Ps(n,e.config.apiKey,e.name);let o=null;for(const n of t)try{const t=await n._get(s);if(t){let r;if("string"==typeof t){const n=await fs(e,{idToken:t}).catch(()=>{});if(!n)break;r=await Cs._fromGetAccountInfoResponse(e,n,t)}else r=Cs._fromJSON(e,t);n!==i&&(o=r),i=n;break}}catch{}const a=r.filter(e=>e._shouldAllowMigration);return i._shouldAllowMigration&&a.length?(i=a[0],o&&await i._set(s,o.toJSON()),await Promise.all(t.map(async e=>{if(e!==i)try{await e._remove(s)}catch{}})),new xs(i,e,n)):new xs(i,e,n)}}function Ns(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Us(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Ds(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Fs(t))return"Blackberry";if(js(t))return"Webos";if(Ls(t))return"Safari";if((t.includes("chrome/")||Ms(t))&&!t.includes("edge/"))return"Chrome";if($s(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===n?.length)return n[1]}return"Other"}function Ds(e=zn()){return/firefox\//i.test(e)}function Ls(e=zn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Ms(e=zn()){return/crios\//i.test(e)}function Us(e=zn()){return/iemobile/i.test(e)}function $s(e=zn()){return/android/i.test(e)}function Fs(e=zn()){return/blackberry/i.test(e)}function js(e=zn()){return/webos/i.test(e)}function Vs(e=zn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Bs(){return function(){const e=zn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function zs(e=zn()){return Vs(e)||$s(e)||js(e)||Fs(e)||/windows phone/i.test(e)||Us(e)}function qs(e,t=[]){let n;switch(e){case"Browser":n=Ns(zn());break;case"Worker":n=`${Ns(zn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ei}/${r}`}class Hs{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise((n,r)=>{try{n(e(t))}catch(e){r(e)}});n.onAbort=t,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:e?.message})}}}class Ks{constructor(e){const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??6,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),void 0!==t.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),void 0!==t.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),void 0!==t.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),void 0!==t.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let r=0;r<e.length;r++)n=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class Ws{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Xs(this),this.idTokenSubscription=new Xs(this),this.beforeStateQueue=new Hs(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=$i,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=As(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await xs.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.uid||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await fs(this,{idToken:e}),n=await Cs._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(wi(this.app)){const e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let n=t,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const t=this.redirectUser?._redirectEventId,i=n?._redirectEventId,s=await this.tryRedirectSignIn(e);t&&t!==i||!s?.user||(n=s.user,r=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(n)}catch(e){n=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return Ki(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}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 Es(e)}catch(e){if("auth/network-request-failed"!==e?.code)return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(wi(this.app))return Promise.reject(qi(this));const t=e?or(e):null;return t&&Ki(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&&Ki(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 wi(this.app)?Promise.reject(qi(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return wi(this.app)?Promise.reject(qi(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(As(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const 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(){const e=await async function(e,t={}){return ss(e,"GET","/v2/passwordPolicy",is(e,t))}(this),t=new Ks(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Qn("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)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return ss(e,"POST","/v2/accounts:revokeToken",is(e,t))}(this,t)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&As(e)||this._popupRedirectResolver;Ki(t,this,"argument-error"),this.redirectPersistenceManager=await xs.create(this,[As(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._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(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const i="function"==typeof t?t:t.next.bind(t);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ki(o,this,"internal-error"),o.then(()=>{s||i(this.currentUser)}),"function"==typeof t){const i=e.addObserver(t,n,r);return()=>{s=!0,i()}}{const n=e.addObserver(t);return()=>{s=!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 Ki(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=qs(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await(this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader());t&&(e["X-Firebase-Client"]=t);const n=await this._getAppCheckToken();return n&&(e["X-Firebase-AppCheck"]=n),e}async _getAppCheckToken(){if(wi(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await(this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken());return e?.error&&function(e,...t){Fi.logLevel<=hr.WARN&&Fi.warn(`Auth (${Ei}): ${e}`,...t)}(`Error while retrieving App Check token: ${e.error}`),e?.token}}function Gs(e){return or(e)}class Xs{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new rr(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return Ki(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Qs={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Js(e){return Qs.loadJS(e)}class Ys{constructor(){this.enterprise=new Zs}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Zs{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const eo="NO_RECAPTCHA";class to{constructor(e){this.type="recaptcha-enterprise",this.auth=Gs(e)}async verify(e="verify",t=!1){async function n(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)=>{(async function(e,t){return ss(e,"GET","/v2/recaptchaConfig",is(e,t))})(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(r=>{if(void 0!==r.recaptchaKey){const n=new ps(r);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))}).catch(e=>{n(e)})})}function r(t,n,r){const i=window.grecaptcha;ds(i)?i.enterprise.ready(()=>{i.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n(eo)})}):r(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new Ys).execute("siteKey",{action:"verify"})}return new Promise((e,i)=>{n(this.auth).then(n=>{if(!t&&ds(window.grecaptcha))r(n,e,i);else{if("undefined"==typeof window)return void i(new Error("RecaptchaVerifier is only supported in browser"));let t=Qs.recaptchaEnterpriseScript;0!==t.length&&(t+=n),Js(t).then(()=>{r(n,e,i)}).catch(e=>{i(e)})}}).catch(e=>{i(e)})})}}async function no(e,t,n,r=!1,i=!1){const s=new to(e);let o;if(i)o=eo;else try{o=await s.verify(n)}catch(e){o=await s.verify(n,!0)}const a={...t};if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in a){const e=a.phoneEnrollmentInfo.phoneNumber,t=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const e=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return r?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function ro(e,t,n,r,i){if(e._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await no(e,t,n,"getOobCode"===n);return r(e,i)}return r(e,t).catch(async i=>{if("auth/missing-recaptcha-token"===i.code){const i=await no(e,t,n,"getOobCode"===n);return r(e,i)}return Promise.reject(i)})}function io(e,t,n){const r=Gs(e);Ki(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const i=so(t),{host:s,port:o}=function(e){const t=so(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const e=i[1];return{host:e,port:oo(r.substr(e.length+1))}}{const[e,t]=r.split(":");return{host:e,port:oo(t)}}}(t),a=null===o?"":`:${o}`,c={url:`${i}//${s}${a}/`},l=Object.freeze({host:s,port:o,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!r._canInitEmulator)return Ki(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),void Ki(Yn(c,r.config.emulator)&&Yn(l,r.emulatorConfig),r,"emulator-config-failed");r.config.emulator=c,r.emulatorConfig=l,r.settings.appVerificationDisabledForTesting=!0,Un(s)?($n(`${i}//${s}${a}`),Bn("Auth",!0)):function(){function e(){const 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&&console.info;"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function so(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function oo(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class ao{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Wi("not implemented")}_getIdTokenResponse(e){return Wi("not implemented")}_linkToIdToken(e,t){return Wi("not implemented")}_getReauthenticationResolver(e){return Wi("not implemented")}}async function co(e,t){return ss(e,"POST","/v1/accounts:signUp",t)}async function lo(e,t){return as(e,"POST","/v1/accounts:signInWithPassword",is(e,t))}async function uo(e,t){return ss(e,"POST","/v1/accounts:sendOobCode",is(e,t))}async function ho(e,t){return uo(e,t)}class po extends ao{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new po(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new po(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e;if(t?.email&&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){switch(this.signInMethod){case"password":return ro(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",lo);case"emailLink":return async function(e,t){return as(e,"POST","/v1/accounts:signInWithEmailLink",is(e,t))}(e,{email:this._email,oobCode:this._password});default:Vi(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return ro(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",co);case"emailLink":return async function(e,t){return as(e,"POST","/v1/accounts:signInWithEmailLink",is(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:Vi(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function fo(e,t){return as(e,"POST","/v1/accounts:signInWithIdp",is(e,t))}class go extends ao{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new go(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):Vi("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:r,...i}=t;if(!n||!r)return null;const s=new go(n,r);return s.idToken=i.idToken||void 0,s.accessToken=i.accessToken||void 0,s.secret=i.secret,s.nonce=i.nonce,s.pendingToken=i.pendingToken||null,s}_getIdTokenResponse(e){return fo(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,fo(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,fo(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const 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=er(t)}return e}}class mo{constructor(e){const t=tr(nr(e)),n=t.apiKey??null,r=t.oobCode??null,i=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}}(t.mode??null);Ki(n&&r&&i,"argument-error"),this.apiKey=n,this.operation=i,this.code=r,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){const t=function(e){const t=tr(nr(e)).link,n=t?tr(nr(t)).deep_link_id:null,r=tr(nr(e)).deep_link_id;return(r?tr(nr(r)).link:null)||r||n||t||e}(e);try{return new mo(t)}catch{return null}}}class yo{constructor(){this.providerId=yo.PROVIDER_ID}static credential(e,t){return po._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=mo.parseLink(t);return Ki(n,"argument-error"),po._fromEmailAndCode(e,n.code,n.tenantId)}}yo.PROVIDER_ID="password",yo.EMAIL_PASSWORD_SIGN_IN_METHOD="password",yo.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class _o{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}}class wo extends _o{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class vo extends wo{constructor(){super("facebook.com")}static credential(e){return go._fromParams({providerId:vo.PROVIDER_ID,signInMethod:vo.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return vo.credentialFromTaggedObject(e)}static credentialFromError(e){return vo.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return vo.credential(e.oauthAccessToken)}catch{return null}}}vo.FACEBOOK_SIGN_IN_METHOD="facebook.com",vo.PROVIDER_ID="facebook.com";class bo extends wo{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return go._fromParams({providerId:bo.PROVIDER_ID,signInMethod:bo.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return bo.credentialFromTaggedObject(e)}static credentialFromError(e){return bo.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return bo.credential(t,n)}catch{return null}}}bo.GOOGLE_SIGN_IN_METHOD="google.com",bo.PROVIDER_ID="google.com";class Eo extends wo{constructor(){super("github.com")}static credential(e){return go._fromParams({providerId:Eo.PROVIDER_ID,signInMethod:Eo.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Eo.credentialFromTaggedObject(e)}static credentialFromError(e){return Eo.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return Eo.credential(e.oauthAccessToken)}catch{return null}}}Eo.GITHUB_SIGN_IN_METHOD="github.com",Eo.PROVIDER_ID="github.com";class To extends wo{constructor(){super("twitter.com")}static credential(e,t){return go._fromParams({providerId:To.PROVIDER_ID,signInMethod:To.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return To.credentialFromTaggedObject(e)}static credentialFromError(e){return To.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return To.credential(t,n)}catch{return null}}}async function Io(e,t){return as(e,"POST","/v1/accounts:signUp",is(e,t))}To.TWITTER_SIGN_IN_METHOD="twitter.com",To.PROVIDER_ID="twitter.com";class So{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,r=!1){const i=await Cs._fromIdTokenResponse(e,n,r),s=Co(n);return new So({user:i,providerId:s,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const r=Co(n);return new So({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function Co(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class ko extends Xn{constructor(e,t,n,r){super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,ko.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new ko(e,t,n,r)}}function Ao(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw ko._fromErrorAndOperation(e,n,t,r);throw n})}async function Ro(e,t,n=!1){if(wi(e.app))return Promise.reject(qi(e));const r="signIn",i=await Ao(e,r,t),s=await So._fromIdTokenResponse(e,r,i);return n||await e._updateCurrentUser(s.user),s}async function Oo(e,t,n){if(wi(e.app))return Promise.reject(qi(e));const r=Gs(e),i=ro(r,{returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Io),s=await i.catch(t=>{throw"auth/password-does-not-meet-requirements"===t.code&&async function(e){const t=Gs(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}(e),t}),o=await So._fromIdTokenResponse(r,"signIn",s);return await r._updateCurrentUser(o.user),o}async function Po(e,t){const n=or(e),r={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()},{email:i}=await async function(e,t){return uo(e,t)}(n.auth,r);i!==e.email&&await e.reload()}async function xo(e,{displayName:t,photoURL:n}){if(void 0===t&&void 0===n)return;const r=or(e),i={idToken:await r.getIdToken(),displayName:t,photoUrl:n,returnSecureToken:!0},s=await ws(r,async function(e,t){return ss(e,"POST","/v1/accounts:update",t)}(r.auth,i));r.displayName=s.displayName||null,r.photoURL=s.photoUrl||null;const o=r.providerData.find(({providerId:e})=>"password"===e);o&&(o.displayName=r.displayName,o.photoURL=r.photoURL),await r._updateTokensIfNecessary(s)}async function No(e,t,n){const{auth:r}=e,i={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(i.email=t),n&&(i.password=n);const s=await ws(e,async function(e,t){return ss(e,"POST","/v1/accounts:update",t)}(r,i));await e._updateTokensIfNecessary(s,!0)}const Do="__sak";class Lo{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Do,"1"),this.storage.removeItem(Do),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const 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()}}class Mo extends Lo{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=zs(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});const n=e.key;t?this.detachListener():this.stopPolling();const r=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},i=this.storage.getItem(n);Bs()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,10):r()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const 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){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Mo.type="LOCAL";const Uo=Mo;class $o extends Lo{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}$o.type="SESSION";const Fo=$o;class jo{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;const n=new jo(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:i}=t.data,s=this.handlersMap[r];if(!s?.size)return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(s).map(async e=>e(t.origin,i)),a=await function(e){return Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}}))}(o);t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_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)}}function Vo(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}jo.receivers=[];class Bo{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){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let i,s;return new Promise((o,a)=>{const c=Vo("",20);r.port1.start();const l=setTimeout(()=>{a(new Error("unsupported_event"))},n);s={messageChannel:r,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(l),i=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),o(t.data.response);break;default:clearTimeout(l),clearTimeout(i),a(new Error("invalid_response"))}}},this.handlers.add(s),r.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])}).finally(()=>{s&&this.removeMessageHandler(s)})}}function zo(){return window}function qo(){return void 0!==zo().WorkerGlobalScope&&"function"==typeof zo().importScripts}const Ho="firebaseLocalStorageDb",Ko="firebaseLocalStorage",Wo="fbase_key";class Go{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 Xo(e,t){return e.transaction([Ko],t?"readwrite":"readonly").objectStore(Ko)}function Qo(){const e=indexedDB.open(Ho,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(Ko,{keyPath:Wo})}catch(e){n(e)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(Ko)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Ho);return new Go(e).toPromise()}(),t(await Qo()))})})}async function Jo(e,t,n){const r=Xo(e,!0).put({[Wo]:t,value:n});return new Go(r).toPromise()}function Yo(e,t){const n=Xo(e,!0).delete(t);return new Go(n).toPromise()}class Zo{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 Qo()),this.db}async _withRetries(e){let t=0;for(;;)try{const 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 qo()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=jo._getInstance(qo()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await async function(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}(),!this.activeServiceWorker)return;this.sender=new Bo(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&(navigator?.serviceWorker?.controller||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Qo();return await Jo(e,Do,"1"),await Yo(e,Do),!0}catch{}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=>Jo(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(t=>async function(e,t){const n=Xo(e,!1).get(t),r=await new Go(n).toPromise();return void 0===r?null:r.value}(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yo(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(e=>{const t=Xo(e,!1).getAll();return new Go(t).toPromise()});if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:r,value:i}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),t.push(r));for(const 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;const n=this.listeners[e];if(n)for(const 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()}}Zo.type="LOCAL";const ea=Zo;new Yi(3e4,6e4);class ta extends ao{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return fo(e,this._buildIdpRequest())}_linkToIdToken(e,t){return fo(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return fo(e,this._buildIdpRequest())}_buildIdpRequest(e){const 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 na(e){return Ro(e.auth,new ta(e),e.bypassAuthState)}function ra(e){const{auth:t,user:n}=e;return Ki(n,t,"internal-error"),async function(e,t,n=!1){const{auth:r}=e;if(wi(r.app))return Promise.reject(qi(r));const i="reauthenticate";try{const s=await ws(e,Ao(r,i,t,e),n);Ki(s.idToken,r,"internal-error");const o=ys(s.idToken);Ki(o,r,"internal-error");const{sub:a}=o;return Ki(e.uid===a,r,"user-mismatch"),So._forOperation(e,i,s)}catch(e){throw"auth/user-not-found"===e?.code&&Vi(r,"user-mismatch"),e}}(n,new ta(e),e.bypassAuthState)}async function ia(e){const{auth:t,user:n}=e;return Ki(n,t,"internal-error"),async function(e,t,n=!1){const r=await ws(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return So._forOperation(e,"link",r)}(n,new ta(e),e.bypassAuthState)}class sa{constructor(e,t,n,r,i=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=i,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){const{urlResponse:t,sessionId:n,postBody:r,tenantId:i,error:s,type:o}=e;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return na;case"linkViaPopup":case"linkViaRedirect":return ia;case"reauthViaPopup":case"reauthViaRedirect":return ra;default:Vi(this.auth,"internal-error")}}resolve(e){Gi(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Gi(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const oa=new Yi(2e3,1e4);class aa extends sa{constructor(e,t,n,r,i){super(e,t,r,i),this.provider=n,this.authWindow=null,this.pollId=null,aa.currentPopupAction&&aa.currentPopupAction.cancel(),aa.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Ki(e,this.auth,"internal-error"),e}async onExecution(){Gi(1===this.filter.length,"Popup operations only handle one event");const e=Vo();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(Bi(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(Bi(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,aa.currentPopupAction=null}pollUserCancellation(){const e=()=>{this.authWindow?.window?.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Bi(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(e,oa.get())};e()}}aa.currentPopupAction=null;const ca="pendingRedirect",la=new Map;class ua extends sa{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=la.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=function(e){return Ps(ca,e.config.apiKey,e.name)}(t),r=function(e){return As(e._redirectPersistence)}(e);if(!await r._isAvailable())return!1;const i="true"===await r._get(n);return await r._remove(n),i}(this.resolver,this.auth),n=t?await super.execute():null;e=()=>Promise.resolve(n)}catch(t){e=()=>Promise.reject(t)}la.set(this.auth._key(),e)}return this.bypassAuthState||la.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function ha(e,t){la.set(e._key(),t)}async function da(e,t,n=!1){if(wi(e.app))return Promise.reject(qi(e));const r=Gs(e),i=function(e,t){return t?As(t):(Ki(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(r,t),s=new ua(r,i,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,t)),o}class pa{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 ga(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!ga(e)){const n=e.error.code?.split("auth/")[1]||"internal-error";t.onError(Bi(this.auth,n))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const 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(fa(e))}saveEventToCache(e){this.cachedEventUids.add(fa(e)),this.lastProcessedEventTime=Date.now()}}function fa(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function ga({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===t?.code}const ma=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ya=/^https?/;async function _a(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return ss(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(wa(e))return}catch{}Vi(e,"unauthorized-domain")}function wa(e){const t=Xi(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const i=new URL(e);return""===i.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!ya.test(n))return!1;if(ma.test(e))return r===e;const i=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}const va=new Yi(3e4,6e4);function ba(){const e=zo().___jsl;if(e?.H)for(const 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}function Ea(e){return new Promise((t,n)=>{function r(){ba(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{ba(),n(Bi(e,"network-request-failed"))},timeout:va.get()})}if(zo().gapi?.iframes?.Iframe)t(gapi.iframes.getContext());else{if(!zo().gapi?.load){const t=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return zo()[t]=()=>{gapi.load?r():n(Bi(e,"network-request-failed"))},Js(`${Qs.gapiScript}?onload=${t}`).catch(e=>n(e))}r()}}).catch(e=>{throw Ta=null,e})}let Ta=null;const Ia=new Yi(5e3,15e3),Sa={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ca=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ka(e){const t=e.config;Ki(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Zi(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,r={apiKey:t.apiKey,appName:e.name,v:Ei},i=Ca.get(e.config.apiHost);i&&(r.eid=i);const s=e._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${er(r).slice(1)}`}async function Aa(e){const t=await function(e){return Ta=Ta||Ea(e),Ta}(e),n=zo().gapi;return Ki(n,e,"internal-error"),t.open({where:document.body,url:ka(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Sa,dontclear:!0},t=>new Promise(async(n,r)=>{await t.restyle({setHideOnLeave:!1});const i=Bi(e,"network-request-failed"),s=zo().setTimeout(()=>{r(i)},Ia.get());function o(){zo().clearTimeout(s),n(t)}t.ping(o).then(o,()=>{r(i)})}))}const Ra={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Oa{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function Pa(e,t,n,r=500,i=600){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c={...Ra,width:r.toString(),height:i.toString(),top:s,left:o},l=zn().toLowerCase();n&&(a=Ms(l)?"_blank":n),Ds(l)&&(t=t||"http://localhost",c.scrollbars="yes");const u=Object.entries(c).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=zn()){return Vs(e)&&!!window.navigator?.standalone}(l)&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",a),new Oa(null);const h=window.open(t||"",a,u);Ki(h,e,"popup-blocked");try{h.focus()}catch(e){}return new Oa(h)}const xa="__/auth/handler",Na="emulator/auth/handler",Da=encodeURIComponent("fac");async function La(e,t,n,r,i,s){Ki(e.config.authDomain,e,"auth-domain-config-required"),Ki(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:Ei,eventId:i};if(t instanceof _o){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries({}))o[e]=t}if(t instanceof wo){const e=t.getScopes().filter(e=>""!==e);e.length>0&&(o.scopes=e.join(","))}e.tenantId&&(o.tid=e.tenantId);const a=o;for(const e of Object.keys(a))void 0===a[e]&&delete a[e];const c=await e._getAppCheckToken(),l=c?`#${Da}=${encodeURIComponent(c)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${xa}`;return Zi(e,Na)}(e)}?${er(a).slice(1)}${l}`}const Ma="webStorageSupport";const Ua=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Fo,this._completeRedirectFn=da,this._overrideRedirectResult=ha}async _openPopup(e,t,n,r){Gi(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");return Pa(e,await La(e,t,n,Xi(),r),Vo())}async _openRedirect(e,t,n,r){await this._originValidation(e);return function(e){zo().location.href=e}(await La(e,t,n,Xi(),r)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(Gi(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){const t=await Aa(e),n=new pa(e);return t.register("authEvent",t=>{Ki(t?.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Ma,{type:Ma},n=>{const r=n?.[0]?.[Ma];void 0!==r&&t(!!r),Vi(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=_a(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return zs()||Ls()||Vs()}};var $a="@firebase/auth",Fa="1.12.0";class ja{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){Ki(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const Va=Ln("authIdTokenMaxAge")||300;let Ba=null;function za(e=Ii()){const t=_i(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=_i(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(Yn(n.getOptions(),t??{}))return e;Vi(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:Ua,persistence:[ea,Uo,Fo]}),r=Ln("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(r,location.origin);if(location.origin===e.origin){const t=(i=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>Va)return;const r=t?.token;Ba!==r&&(Ba=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(e,t,n){or(e).beforeAuthStateChanged(t,n)}(n,t,()=>t(n.currentUser)),function(e,t,n,r){or(e).onIdTokenChanged(t,n,r)}(n,e=>t(e))}}var i;const s=xn("auth");return s&&io(n,`http://${s}`),n}var qa;!function(e){Qs=e}({loadJS:e=>new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=Bi("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(r)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),qa="Browser",yi(new ar("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Ki(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:qa,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:qs(qa)},c=new Ws(n,r,i,a);return function(e,t){const n=t?.persistence||[],r=(Array.isArray(n)?n:[n]).map(As);t?.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t?.popupRedirectResolver)}(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),yi(new ar("auth-internal",e=>(e=>new ja(e))(Gs(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),Si($a,Fa,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(qa)),Si($a,Fa,"esm2020");Si("firebase","12.7.0","app");var Ha,Ka="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var e;function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}function n(e,t,n){n||(n=0);const r=Array(16);if("string"==typeof t)for(var i=0;i<16;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;i<16;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];let s,o=e.g[3];s=t+(o^n&(i^o))+r[0]+3614090360&4294967295,s=o+(i^(t=n+(s<<7&4294967295|s>>>25))&(n^i))+r[1]+3905402710&4294967295,o=t+(s<<12&4294967295|s>>>20),s=i+(n^o&(t^n))+r[2]+606105819&4294967295,s=n+(t^(i=o+(s<<17&4294967295|s>>>15))&(o^t))+r[3]+3250441966&4294967295,s=t+(o^(n=i+(s<<22&4294967295|s>>>10))&(i^o))+r[4]+4118548399&4294967295,s=o+(i^(t=n+(s<<7&4294967295|s>>>25))&(n^i))+r[5]+1200080426&4294967295,o=t+(s<<12&4294967295|s>>>20),s=i+(n^o&(t^n))+r[6]+2821735955&4294967295,s=n+(t^(i=o+(s<<17&4294967295|s>>>15))&(o^t))+r[7]+4249261313&4294967295,s=t+(o^(n=i+(s<<22&4294967295|s>>>10))&(i^o))+r[8]+1770035416&4294967295,s=o+(i^(t=n+(s<<7&4294967295|s>>>25))&(n^i))+r[9]+2336552879&4294967295,o=t+(s<<12&4294967295|s>>>20),s=i+(n^o&(t^n))+r[10]+4294925233&4294967295,s=n+(t^(i=o+(s<<17&4294967295|s>>>15))&(o^t))+r[11]+2304563134&4294967295,s=t+(o^(n=i+(s<<22&4294967295|s>>>10))&(i^o))+r[12]+1804603682&4294967295,s=o+(i^(t=n+(s<<7&4294967295|s>>>25))&(n^i))+r[13]+4254626195&4294967295,o=t+(s<<12&4294967295|s>>>20),s=i+(n^o&(t^n))+r[14]+2792965006&4294967295,s=n+(t^(i=o+(s<<17&4294967295|s>>>15))&(o^t))+r[15]+1236535329&4294967295,s=t+(i^o&((n=i+(s<<22&4294967295|s>>>10))^i))+r[1]+4129170786&4294967295,s=o+(n^i&((t=n+(s<<5&4294967295|s>>>27))^n))+r[6]+3225465664&4294967295,o=t+(s<<9&4294967295|s>>>23),s=i+(t^n&(o^t))+r[11]+643717713&4294967295,s=n+(o^t&((i=o+(s<<14&4294967295|s>>>18))^o))+r[0]+3921069994&4294967295,s=t+(i^o&((n=i+(s<<20&4294967295|s>>>12))^i))+r[5]+3593408605&4294967295,s=o+(n^i&((t=n+(s<<5&4294967295|s>>>27))^n))+r[10]+38016083&4294967295,o=t+(s<<9&4294967295|s>>>23),s=i+(t^n&(o^t))+r[15]+3634488961&4294967295,s=n+(o^t&((i=o+(s<<14&4294967295|s>>>18))^o))+r[4]+3889429448&4294967295,s=t+(i^o&((n=i+(s<<20&4294967295|s>>>12))^i))+r[9]+568446438&4294967295,s=o+(n^i&((t=n+(s<<5&4294967295|s>>>27))^n))+r[14]+3275163606&4294967295,o=t+(s<<9&4294967295|s>>>23),s=i+(t^n&(o^t))+r[3]+4107603335&4294967295,s=n+(o^t&((i=o+(s<<14&4294967295|s>>>18))^o))+r[8]+1163531501&4294967295,s=t+(i^o&((n=i+(s<<20&4294967295|s>>>12))^i))+r[13]+2850285829&4294967295,s=o+(n^i&((t=n+(s<<5&4294967295|s>>>27))^n))+r[2]+4243563512&4294967295,o=t+(s<<9&4294967295|s>>>23),s=i+(t^n&(o^t))+r[7]+1735328473&4294967295,s=n+(o^t&((i=o+(s<<14&4294967295|s>>>18))^o))+r[12]+2368359562&4294967295,s=t+((n=i+(s<<20&4294967295|s>>>12))^i^o)+r[5]+4294588738&4294967295,s=o+((t=n+(s<<4&4294967295|s>>>28))^n^i)+r[8]+2272392833&4294967295,o=t+(s<<11&4294967295|s>>>21),s=i+(o^t^n)+r[11]+1839030562&4294967295,s=n+((i=o+(s<<16&4294967295|s>>>16))^o^t)+r[14]+4259657740&4294967295,s=t+((n=i+(s<<23&4294967295|s>>>9))^i^o)+r[1]+2763975236&4294967295,s=o+((t=n+(s<<4&4294967295|s>>>28))^n^i)+r[4]+1272893353&4294967295,o=t+(s<<11&4294967295|s>>>21),s=i+(o^t^n)+r[7]+4139469664&4294967295,s=n+((i=o+(s<<16&4294967295|s>>>16))^o^t)+r[10]+3200236656&4294967295,s=t+((n=i+(s<<23&4294967295|s>>>9))^i^o)+r[13]+681279174&4294967295,s=o+((t=n+(s<<4&4294967295|s>>>28))^n^i)+r[0]+3936430074&4294967295,o=t+(s<<11&4294967295|s>>>21),s=i+(o^t^n)+r[3]+3572445317&4294967295,s=n+((i=o+(s<<16&4294967295|s>>>16))^o^t)+r[6]+76029189&4294967295,s=t+((n=i+(s<<23&4294967295|s>>>9))^i^o)+r[9]+3654602809&4294967295,s=o+((t=n+(s<<4&4294967295|s>>>28))^n^i)+r[12]+3873151461&4294967295,o=t+(s<<11&4294967295|s>>>21),s=i+(o^t^n)+r[15]+530742520&4294967295,s=n+((i=o+(s<<16&4294967295|s>>>16))^o^t)+r[2]+3299628645&4294967295,s=t+(i^((n=i+(s<<23&4294967295|s>>>9))|~o))+r[0]+4096336452&4294967295,s=o+(n^((t=n+(s<<6&4294967295|s>>>26))|~i))+r[7]+1126891415&4294967295,o=t+(s<<10&4294967295|s>>>22),s=i+(t^(o|~n))+r[14]+2878612391&4294967295,s=n+(o^((i=o+(s<<15&4294967295|s>>>17))|~t))+r[5]+4237533241&4294967295,s=t+(i^((n=i+(s<<21&4294967295|s>>>11))|~o))+r[12]+1700485571&4294967295,s=o+(n^((t=n+(s<<6&4294967295|s>>>26))|~i))+r[3]+2399980690&4294967295,o=t+(s<<10&4294967295|s>>>22),s=i+(t^(o|~n))+r[10]+4293915773&4294967295,s=n+(o^((i=o+(s<<15&4294967295|s>>>17))|~t))+r[1]+2240044497&4294967295,s=t+(i^((n=i+(s<<21&4294967295|s>>>11))|~o))+r[8]+1873313359&4294967295,s=o+(n^((t=n+(s<<6&4294967295|s>>>26))|~i))+r[15]+4264355552&4294967295,o=t+(s<<10&4294967295|s>>>22),s=i+(t^(o|~n))+r[6]+2734768916&4294967295,s=n+(o^((i=o+(s<<15&4294967295|s>>>17))|~t))+r[13]+1309151649&4294967295,s=t+(i^((n=i+(s<<21&4294967295|s>>>11))|~o))+r[4]+4149444226&4294967295,s=o+(n^((t=n+(s<<6&4294967295|s>>>26))|~i))+r[11]+3174756917&4294967295,o=t+(s<<10&4294967295|s>>>22),s=i+(t^(o|~n))+r[2]+718787259&4294967295,s=n+(o^((i=o+(s<<15&4294967295|s>>>17))|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(s<<21&4294967295|s>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+o&4294967295}function r(e,t){this.h=t;const n=[];let r=!0;for(let i=e.length-1;i>=0;i--){const s=0|e[i];r&&s==t||(n[i]=s,r=!1)}this.g=n}!function(e,t){function n(){}n.prototype=t.prototype,e.F=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.D=function(e,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return t.prototype[n].apply(e,i)}}(t,function(){this.blockSize=-1}),t.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},t.prototype.v=function(e,t){void 0===t&&(t=e.length);const r=t-this.blockSize,i=this.C;let s=this.h,o=0;for(;o<t;){if(0==s)for(;o<=r;)n(this,e,o),o+=this.blockSize;if("string"==typeof e){for(;o<t;)if(i[s++]=e.charCodeAt(o++),s==this.blockSize){n(this,i),s=0;break}}else for(;o<t;)if(i[s++]=e[o++],s==this.blockSize){n(this,i),s=0;break}}this.h=s,this.o+=t},t.prototype.A=function(){var e=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;t=8*this.o;for(var n=e.length-8;n<e.length;++n)e[n]=255&t,t/=256;for(this.v(e),e=Array(16),t=0,n=0;n<4;++n)for(let r=0;r<32;r+=8)e[t++]=this.g[n]>>>r&255;return e};var i={};function s(e){return-128<=e&&e<128?function(e,t){var n=i;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,function(e){return new r([0|e],e<0?-1:0)}):new r([0|e],e<0?-1:0)}function o(e){if(isNaN(e)||!isFinite(e))return a;if(e<0)return d(o(-e));const t=[];let n=1;for(let r=0;e>=n;r++)t[r]=e/n|0,n*=4294967296;return new r(t,0)}var a=s(0),c=s(1),l=s(16777216);function u(e){if(0!=e.h)return!1;for(let t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function h(e){return-1==e.h}function d(e){const t=e.g.length,n=[];for(let r=0;r<t;r++)n[r]=~e.g[r];return new r(n,~e.h).add(c)}function p(e,t){return e.add(d(t))}function f(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function g(e,t){this.g=e,this.h=t}function m(e,t){if(u(t))throw Error("division by zero");if(u(e))return new g(a,a);if(h(e))return t=m(d(e),t),new g(d(t.g),d(t.h));if(h(t))return t=m(e,d(t)),new g(d(t.g),t.h);if(e.g.length>30){if(h(e)||h(t))throw Error("slowDivide_ only works with positive integers.");for(var n=c,r=t;r.l(e)<=0;)n=y(n),r=y(r);var i=_(n,1),s=_(r,1);for(r=_(r,2),n=_(n,2);!u(r);){var l=s.add(r);l.l(e)<=0&&(i=i.add(n),s=l),r=_(r,1),n=_(n,1)}return t=p(e,i.j(t)),new g(i,t)}for(i=a;e.l(t)>=0;){for(n=Math.max(1,Math.floor(e.m()/t.m())),r=(r=Math.ceil(Math.log(n)/Math.LN2))<=48?1:Math.pow(2,r-48),l=(s=o(n)).j(t);h(l)||l.l(e)>0;)l=(s=o(n-=r)).j(t);u(s)&&(s=c),i=i.add(s),e=p(e,l)}return new g(i,e)}function y(e){const t=e.g.length+1,n=[];for(let r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new r(n,e.h)}function _(e,t){const n=t>>5;t%=32;const i=e.g.length-n,s=[];for(let r=0;r<i;r++)s[r]=t>0?e.i(r+n)>>>t|e.i(r+n+1)<<32-t:e.i(r+n);return new r(s,e.h)}(e=r.prototype).m=function(){if(h(this))return-d(this).m();let e=0,t=1;for(let n=0;n<this.g.length;n++){const r=this.i(n);e+=(r>=0?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(e){if((e=e||10)<2||36<e)throw Error("radix out of range: "+e);if(u(this))return"0";if(h(this))return"-"+d(this).toString(e);const t=o(Math.pow(e,6));var n=this;let r="";for(;;){const i=m(n,t).g;let s=(((n=p(n,i.j(t))).g.length>0?n.g[0]:n.h)>>>0).toString(e);if(u(n=i))return s+r;for(;s.length<6;)s="0"+s;r=s+r}},e.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return h(e=p(this,e))?-1:u(e)?0:1},e.abs=function(){return h(this)?d(this):this},e.add=function(e){const t=Math.max(this.g.length,e.g.length),n=[];let i=0;for(let r=0;r<=t;r++){let t=i+(65535&this.i(r))+(65535&e.i(r)),s=(t>>>16)+(this.i(r)>>>16)+(e.i(r)>>>16);i=s>>>16,t&=65535,s&=65535,n[r]=s<<16|t}return new r(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(u(this)||u(e))return a;if(h(this))return h(e)?d(this).j(d(e)):d(d(this).j(e));if(h(e))return d(this.j(d(e)));if(this.l(l)<0&&e.l(l)<0)return o(this.m()*e.m());const t=this.g.length+e.g.length,n=[];for(var i=0;i<2*t;i++)n[i]=0;for(i=0;i<this.g.length;i++)for(let t=0;t<e.g.length;t++){const r=this.i(i)>>>16,s=65535&this.i(i),o=e.i(t)>>>16,a=65535&e.i(t);n[2*i+2*t]+=s*a,f(n,2*i+2*t),n[2*i+2*t+1]+=r*a,f(n,2*i+2*t+1),n[2*i+2*t+1]+=s*o,f(n,2*i+2*t+1),n[2*i+2*t+2]+=r*o,f(n,2*i+2*t+2)}for(e=0;e<t;e++)n[e]=n[2*e+1]<<16|n[2*e];for(e=t;e<2*t;e++)n[e]=0;return new r(n,0)},e.B=function(e){return m(this,e).h},e.and=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new r(n,this.h&e.h)},e.or=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new r(n,this.h|e.h)},e.xor=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new r(n,this.h^e.h)},t.prototype.digest=t.prototype.A,t.prototype.reset=t.prototype.u,t.prototype.update=t.prototype.v,r.prototype.add=r.prototype.add,r.prototype.multiply=r.prototype.j,r.prototype.modulo=r.prototype.B,r.prototype.compare=r.prototype.l,r.prototype.toNumber=r.prototype.m,r.prototype.toString=r.prototype.toString,r.prototype.getBits=r.prototype.i,r.fromNumber=o,r.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if((n=n||10)<2||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return d(e(t.substring(1),n));if(t.indexOf("-")>=0)throw Error('number format error: interior "-" character');const r=o(Math.pow(n,8));let i=a;for(let e=0;e<t.length;e+=8){var s=Math.min(8,t.length-e);const a=parseInt(t.substring(e,e+s),n);s<8?(s=o(Math.pow(n,s)),i=i.j(s).add(o(a))):(i=i.j(r),i=i.add(o(a)))}return i},Ha=r}).apply(void 0!==Ka?Ka:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Wa,Ga,Xa,Qa,Ja,Ya,Za,ec,tc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var e,t=Object.defineProperty;var n=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof tc&&tc];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function r(e,r){if(r)e:{var i=n;e=e.split(".");for(var s=0;s<e.length-1;s++){var o=e[s];if(!(o in i))break e;i=i[o]}(r=r(s=i[e=e[e.length-1]]))!=s&&null!=r&&t(i,e,{configurable:!0,writable:!0,value:r})}}r("Symbol.dispose",function(e){return e||Symbol("Symbol.dispose")}),r("Array.prototype.values",function(e){return e||function(){return this[Symbol.iterator]()}}),r("Object.entries",function(e){return e||function(e){var t,n=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push([t,e[t]]);return n}});var i=i||{},s=this||self;function o(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function a(e,t,n){return e.call.apply(e.bind,arguments)}function c(e,t,n){return(c=a).apply(null,arguments)}function l(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 u(e,t){function n(){}n.prototype=t.prototype,e.Z=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Ob=function(e,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return t.prototype[n].apply(e,i)}}var h="undefined"!=typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function d(e){const t=e.length;if(t>0){const n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function p(e,t){for(let t=1;t<arguments.length;t++){const r=arguments[t];var n=typeof r;if("array"==(n="object"!=n?n:r?Array.isArray(r)?"array":n:"null")||"object"==n&&"number"==typeof r.length){n=e.length||0;const t=r.length||0;e.length=n+t;for(let i=0;i<t;i++)e[n+i]=r[i]}else e.push(r)}}function f(e){s.setTimeout(()=>{throw e},0)}function g(){var e=v;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var m=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return this.h>0?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new y,e=>e.reset());class y{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 _,w=!1,v=new class{constructor(){this.h=this.g=null}add(e,t){const n=m.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},b=()=>{const e=Promise.resolve(void 0);_=()=>{e.then(E)}};function E(){for(var e;e=g();){try{e.h.call(e.g)}catch(e){f(e)}var t=m;t.j(e),t.h<100&&(t.h++,e.next=t.g,t.g=e)}w=!1}function T(){this.u=this.u,this.C=this.C}function I(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}T.prototype.u=!1,T.prototype.dispose=function(){this.u||(this.u=!0,this.N())},T.prototype[Symbol.dispose]=function(){this.dispose()},T.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},I.prototype.h=function(){this.defaultPrevented=!0};var S=function(){if(!s.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};s.addEventListener("test",e,t),s.removeEventListener("test",e,t)}catch(e){}return e}();function C(e){return/^[\s\xa0]*$/.test(e)}function k(e,t){I.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&&this.init(e,t)}u(k,I),k.prototype.init=function(e,t){const n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,(t=e.relatedTarget)||("mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement)),this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==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=e.pointerType,this.state=e.state,this.i=e,e.defaultPrevented&&k.Z.h.call(this)},k.prototype.h=function(){k.Z.h.call(this);const e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var A="closure_listenable_"+(1e6*Math.random()|0),R=0;function O(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=i,this.key=++R,this.da=this.fa=!1}function P(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function x(e,t,n){for(const r in e)t.call(n,e[r],r,e)}function N(e){const t={};for(const n in e)t[n]=e[n];return t}const D="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function L(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t],r)e[n]=r[n];for(let t=0;t<D.length;t++)n=D[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function M(e){this.src=e,this.g={},this.h=0}function U(e,t){const n=t.type;if(n in e.g){var r,i=e.g[n],s=Array.prototype.indexOf.call(i,t,void 0);(r=s>=0)&&Array.prototype.splice.call(i,s,1),r&&(P(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function $(e,t,n,r){for(let i=0;i<e.length;++i){const s=e[i];if(!s.da&&s.listener==t&&s.capture==!!n&&s.ha==r)return i}return-1}M.prototype.add=function(e,t,n,r,i){const s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);const o=$(e,t,r,i);return o>-1?(t=e[o],n||(t.fa=!1)):((t=new O(t,this.src,s,!!r,i)).fa=n,e.push(t)),t};var F="closure_lm_"+(1e6*Math.random()|0),j={};function V(e,t,n,r,i){if(Array.isArray(t)){for(let s=0;s<t.length;s++)V(e,t[s],n,r,i);return null}return n=G(n),e&&e[A]?e.J(t,n,!!o(r)&&!!r.capture,i):function(e,t,n,r,i,s){if(!t)throw Error("Invalid event type");const a=o(i)?!!i.capture:!!i;let c=K(e);if(c||(e[F]=c=new M(e)),n=c.add(t,n,r,a,s),n.proxy)return n;if(r=function(){function e(n){return t.call(e.src,e.listener,n)}const t=H;return e}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)S||(i=a),void 0===i&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(q(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}return n}(e,t,n,!1,r,i)}function B(e,t,n,r,i){if(Array.isArray(t))for(var s=0;s<t.length;s++)B(e,t[s],n,r,i);else r=o(r)?!!r.capture:!!r,n=G(n),e&&e[A]?(e=e.i,(s=String(t).toString())in e.g&&((n=$(t=e.g[s],n,r,i))>-1&&(P(t[n]),Array.prototype.splice.call(t,n,1),0==t.length&&(delete e.g[s],e.h--)))):e&&(e=K(e))&&(t=e.g[t.toString()],e=-1,t&&(e=$(t,n,r,i)),(n=e>-1?t[e]:null)&&z(n))}function z(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[A])U(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(q(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=K(t))?(U(n,e),0==n.h&&(n.src=null,t[F]=null)):P(e)}}}function q(e){return e in j?j[e]:j[e]="on"+e}function H(e,t){if(e.da)e=!0;else{t=new k(t,this);const n=e.listener,r=e.ha||e.src;e.fa&&z(e),e=n.call(r,t)}return e}function K(e){return(e=e[F])instanceof M?e:null}var W="__closure_events_fn_"+(1e9*Math.random()>>>0);function G(e){return"function"==typeof e?e:(e[W]||(e[W]=function(t){return e.handleEvent(t)}),e[W])}function X(){T.call(this),this.i=new M(this),this.M=this,this.G=null}function Q(e,t){var n,r=e.G;if(r)for(n=[];r;r=r.G)n.push(r);if(e=e.M,r=t.type||t,"string"==typeof t)t=new I(t,e);else if(t instanceof I)t.target=t.target||e;else{var i=t;L(t=new I(r,e),i)}let s,o;if(i=!0,n)for(o=n.length-1;o>=0;o--)s=t.g=n[o],i=J(s,r,!0,t)&&i;if(s=t.g=e,i=J(s,r,!0,t)&&i,i=J(s,r,!1,t)&&i,n)for(o=0;o<n.length;o++)s=t.g=n[o],i=J(s,r,!1,t)&&i}function J(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();let i=!0;for(let s=0;s<t.length;++s){const o=t[s];if(o&&!o.da&&o.capture==n){const t=o.listener,n=o.ha||o.src;o.fa&&U(e.i,o),i=!1!==t.call(n,r)&&i}}return i&&!r.defaultPrevented}function Y(e){e.g=function(e,t){if("function"!=typeof e){if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=c(e.handleEvent,e)}return Number(t)>2147483647?-1:s.setTimeout(e,t||0)}(()=>{e.g=null,e.i&&(e.i=!1,Y(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}u(X,T),X.prototype[A]=!0,X.prototype.removeEventListener=function(e,t,n,r){B(this,e,t,n,r)},X.prototype.N=function(){if(X.Z.N.call(this),this.i){var e=this.i;for(const t in e.g){const n=e.g[t];for(let e=0;e<n.length;e++)P(n[e]);delete e.g[t],e.h--}}this.G=null},X.prototype.J=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},X.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};class Z extends T{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:Y(this)}N(){super.N(),this.g&&(s.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ee(e){T.call(this),this.h=e,this.g={}}u(ee,T);var te=[];function ne(e){x(e.g,function(e,t){this.g.hasOwnProperty(t)&&z(e)},e),e.g={}}ee.prototype.N=function(){ee.Z.N.call(this),ne(this)},ee.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var re=s.JSON.stringify,ie=s.JSON.parse,se=class{stringify(e){return s.JSON.stringify(e,void 0)}parse(e){return s.JSON.parse(e,void 0)}};function oe(){}function ae(){}var ce={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function le(){I.call(this,"d")}function ue(){I.call(this,"c")}u(le,I),u(ue,I);var he={},de=null;function pe(){return de=de||new X}function fe(e){I.call(this,he.Ia,e)}function ge(e){const t=pe();Q(t,new fe(t))}function me(e,t){I.call(this,he.STAT_EVENT,e),this.stat=t}function ye(e){const t=pe();Q(t,new me(t,e))}function _e(e,t){I.call(this,he.Ja,e),this.size=t}function we(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return s.setTimeout(function(){e()},t)}function ve(){this.g=!0}function be(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{const s=JSON.parse(t);if(s)for(e=0;e<s.length;e++)if(Array.isArray(s[e])){var n=s[e];if(!(n.length<2)){var r=n[1];if(Array.isArray(r)&&!(r.length<1)){var i=r[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(let e=1;e<r.length;e++)r[e]=""}}}return re(s)}catch(e){return t}}(e,n)+(r?" "+r:"")})}he.Ia="serverreachability",u(fe,I),he.STAT_EVENT="statevent",u(me,I),he.Ja="timingevent",u(_e,I),ve.prototype.ua=function(){this.g=!1},ve.prototype.info=function(){};var Ee,Te={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},Ie={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"};function Se(){}function Ce(e){return encodeURIComponent(String(e))}function ke(e){var t=1;e=e.split(":");const n=[];for(;t>0&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function Ae(e,t,n,r){this.j=e,this.i=t,this.l=n,this.S=r||1,this.V=new ee(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Re}function Re(){this.i=null,this.g="",this.h=!1}u(Se,oe),Se.prototype.g=function(){return new XMLHttpRequest},Ee=new Se;var Oe={},Pe={};function xe(e,t,n){e.M=1,e.A=rt(Ye(t)),e.u=n,e.R=!0,Ne(e,null)}function Ne(e,t){e.F=Date.now(),Me(e),e.B=Ye(e.A);var n=e.B,r=e.S;Array.isArray(r)||(r=[String(r)]),yt(n.i,"t",r),e.C=0,n=e.j.L,e.h=new Re,e.g=rn(e.j,n?t:null,!e.u),e.P>0&&(e.O=new Z(c(e.Y,e,e.g),e.P)),t=e.V,n=e.g,r=e.ba;var i="readystatechange";Array.isArray(i)||(i&&(te[0]=i.toString()),i=te);for(let e=0;e<i.length;e++){const s=V(n,i[e],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}t=e.J?N(e.J):{},e.u?(e.v||(e.v="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.B,e.v,e.u,t)):(e.v="GET",e.g.ea(e.B,e.v,null,t)),ge(),function(e,t,n,r,i,s){e.info(function(){if(e.g)if(s){var o="",a=s.split("&");for(let e=0;e<a.length;e++){var c=a[e].split("=");if(c.length>1){const e=c[0];c=c[1];const t=e.split("_");o=t.length>=2&&"type"==t[1]?o+(e+"=")+c+"&":o+(e+"=redacted&")}}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+t+"\n"+n+"\n"+o})}(e.i,e.v,e.B,e.l,e.S,e.u)}function De(e){return!!e.g&&("GET"==e.v&&2!=e.M&&e.j.Aa)}function Le(e,t){var n=e.C,r=t.indexOf("\n",n);return-1==r?Pe:(n=Number(t.substring(n,r)),isNaN(n)?Oe:(r+=1)+n>t.length?Pe:(t=t.slice(r,r+n),e.C=r+n,t))}function Me(e){e.T=Date.now()+e.H,Ue(e,e.H)}function Ue(e,t){if(null!=e.D)throw Error("WatchDog timer not null");e.D=we(c(e.aa,e),t)}function $e(e){e.D&&(s.clearTimeout(e.D),e.D=null)}function Fe(e){0==e.j.I||e.K||Yt(e.j,e)}function je(e){$e(e);var t=e.O;t&&"function"==typeof t.dispose&&t.dispose(),e.O=null,ne(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dispose())}function Ve(e,t){try{var n=e.j;if(0!=n.I&&(n.g==e||Ke(n.h,e)))if(!e.L&&Ke(n.h,e)&&3==n.I){try{var r=n.Ba.g.parse(t)}catch(e){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){e:if(!n.v){if(n.g){if(!(n.g.F+3e3<e.F))break e;Jt(n),Vt(n)}Gt(n),ye(18)}}else n.xa=i[1],0<n.xa-n.K&&i[2]<37500&&n.F&&0==n.A&&!n.C&&(n.C=we(c(n.Va,n),6e3));He(n.h)<=1&&n.ta&&(n.ta=void 0)}else en(n,11)}else if((e.L||n.g==e)&&Jt(n),!C(t))for(i=n.Ba.g.parse(t),t=0;t<i.length;t++){let c=i[t];const u=c[0];if(!(u<=n.K))if(n.K=u,c=c[1],2==n.I)if("c"==c[0]){n.M=c[1],n.ba=c[2];const t=c[3];null!=t&&(n.ka=t,n.j.info("VER="+n.ka));const i=c[4];null!=i&&(n.za=i,n.j.info("SVER="+n.za));const u=c[5];null!=u&&"number"==typeof u&&u>0&&(r=1.5*u,n.O=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;const h=e.g;if(h){const e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=r.h;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(We(s,s.h),s.h=null))}if(r.G){const e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(r.wa=e,nt(r.J,r.G,e))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-e.F,n.j.info("Handshake RTT: "+n.T+"ms"));var o=e;if((r=n).na=nn(r,r.L?r.ba:null,r.W),o.L){Ge(r.h,o);var a=o,l=r.O;l&&(a.H=l),a.D&&($e(a),Me(a)),r.g=o}else Wt(r);n.i.length>0&&zt(n)}else"stop"!=c[0]&&"close"!=c[0]||en(n,7);else 3==n.I&&("stop"==c[0]||"close"==c[0]?"stop"==c[0]?en(n,7):jt(n):"noop"!=c[0]&&n.l&&n.l.qa(c),n.A=0)}ge()}catch(e){}}Ae.prototype.ba=function(e){e=e.target;const t=this.O;t&&3==Mt(e)?t.j():this.Y(e)},Ae.prototype.Y=function(e){try{if(e==this.g)e:{const c=Mt(this.g),l=this.g.ya();this.g.ca();if(!(c<3)&&(3!=c||this.g&&(this.h.h||this.g.la()||Ut(this.g)))){this.K||4!=c||7==l||ge(),$e(this);var t=this.g.ca();this.X=t;var n=function(e){if(!De(e))return e.g.la();const t=Ut(e.g);if(""===t)return"";let n="";const r=t.length,i=4==Mt(e.g);if(!e.h.i){if("undefined"==typeof TextDecoder)return je(e),Fe(e),"";e.h.i=new s.TextDecoder}for(let s=0;s<r;s++)e.h.h=!0,n+=e.h.i.decode(t[s],{stream:!(i&&s==r-1)});return t.length=0,e.h.g+=n,e.C=0,e.h.g}(this);if(this.o=200==t,function(e,t,n,r,i,s,o){e.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+t+"\n"+n+"\n"+s+" "+o})}(this.i,this.v,this.B,this.l,this.S,c,t),this.o){if(this.U&&!this.L){t:{if(this.g){var r,i=this.g;if((r=i.g?i.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!C(r)){var o=r;break t}}o=null}if(!(e=o)){this.o=!1,this.m=3,ye(12),je(this),Fe(this);break e}be(this.i,this.l,e,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,Ve(this,e)}if(this.R){let t;for(e=!0;!this.K&&this.C<n.length;){if(t=Le(this,n),t==Pe){4==c&&(this.m=4,ye(14),e=!1),be(this.i,this.l,null,"[Incomplete Response]");break}if(t==Oe){this.m=4,ye(15),be(this.i,this.l,n,"[Invalid Chunk]"),e=!1;break}be(this.i,this.l,t,null),Ve(this,t)}if(De(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=c||0!=n.length||this.h.h||(this.m=1,ye(16),e=!1),this.o=this.o&&e,e){if(n.length>0&&!this.W){this.W=!0;var a=this.j;a.g==this&&a.aa&&!a.P&&(a.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Xt(a),a.P=!0,ye(11))}}else be(this.i,this.l,n,"[Invalid Chunked Response]"),je(this),Fe(this)}else be(this.i,this.l,n,null),Ve(this,n);4==c&&je(this),this.o&&!this.K&&(4==c?Yt(this.j,this):(this.o=!1,Me(this)))}else(function(e){const t={};e=(e.g&&Mt(e)>=2&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let r=0;r<e.length;r++){if(C(e[r]))continue;var n=ke(e[r]);const i=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const s=t[i]||[];t[i]=s,s.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==t&&n.indexOf("Unknown SID")>0?(this.m=3,ye(12)):(this.m=0,ye(13)),je(this),Fe(this)}}}catch(e){}},Ae.prototype.cancel=function(){this.K=!0,je(this)},Ae.prototype.aa=function(){this.D=null;const e=Date.now();e-this.T>=0?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.B),2!=this.M&&(ge(),ye(17)),je(this),this.m=2,Fe(this)):Ue(this,this.T-e)};var Be=class{constructor(e,t){this.g=e,this.map=t}};function ze(e){this.l=e||10,s.PerformanceNavigationTiming?e=(e=s.performance.getEntriesByType("navigation")).length>0&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(s.chrome&&s.chrome.loadTimes&&s.chrome.loadTimes()&&s.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function qe(e){return!!e.h||!!e.g&&e.g.size>=e.j}function He(e){return e.h?1:e.g?e.g.size:0}function Ke(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function We(e,t){e.g?e.g.add(t):e.h=t}function Ge(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function Xe(e){if(null!=e.h)return e.i.concat(e.h.G);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.G);return t}return d(e.i)}ze.prototype.cancel=function(){if(this.i=Xe(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var Qe=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Je(e){let t;this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1,e instanceof Je?(this.l=e.l,Ze(this,e.j),this.o=e.o,this.g=e.g,et(this,e.u),this.h=e.h,tt(this,_t(e.i)),this.m=e.m):e&&(t=String(e).match(Qe))?(this.l=!1,Ze(this,t[1]||"",!0),this.o=it(t[2]||""),this.g=it(t[3]||"",!0),et(this,t[4]),this.h=it(t[5]||"",!0),tt(this,t[6]||"",!0),this.m=it(t[7]||"")):(this.l=!1,this.i=new dt(null,this.l))}function Ye(e){return new Je(e)}function Ze(e,t,n){e.j=n?it(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function et(e,t){if(t){if(t=Number(t),isNaN(t)||t<0)throw Error("Bad port number "+t);e.u=t}else e.u=null}function tt(e,t,n){t instanceof dt?(e.i=t,function(e,t){t&&!e.j&&(pt(e),e.i=null,e.g.forEach(function(e,t){const n=t.toLowerCase();t!=n&&(ft(this,t),yt(this,n,e))},e)),e.j=t}(e.i,e.l)):(n||(t=st(t,ut)),e.i=new dt(t,e.l))}function nt(e,t,n){e.i.set(t,n)}function rt(e){return nt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function it(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function st(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,ot),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function ot(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Je.prototype.toString=function(){const e=[];var t=this.j;t&&e.push(st(t,at,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(st(t,at,!0),"@"),e.push(Ce(n).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.u)&&e.push(":",String(n))),(n=this.h)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(st(n,"/"==n.charAt(0)?lt:ct,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",st(n,ht)),e.join("")},Je.prototype.resolve=function(e){const t=Ye(this);let n=!!e.j;n?Ze(t,e.j):n=!!e.o,n?t.o=e.o:n=!!e.g,n?t.g=e.g:n=null!=e.u;var r=e.h;if(n)et(t,e.u);else if(n=!!e.h){if("/"!=r.charAt(0))if(this.g&&!this.h)r="/"+r;else{var i=t.h.lastIndexOf("/");-1!=i&&(r=t.h.slice(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(-1!=i.indexOf("./")||-1!=i.indexOf("/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");const e=[];for(let t=0;t<i.length;){const n=i[t++];"."==n?r&&t==i.length&&e.push(""):".."==n?((e.length>1||1==e.length&&""!=e[0])&&e.pop(),r&&t==i.length&&e.push("")):(e.push(n),r=!0)}r=e.join("/")}else r=i}return n?t.h=r:n=""!==e.i.toString(),n?tt(t,_t(e.i)):n=!!e.m,n&&(t.m=e.m),t};var at=/[#\/\?@]/g,ct=/[#\?:]/g,lt=/[#\?]/g,ut=/[#\?@]/g,ht=/#/g;function dt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function pt(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(let n=0;n<e.length;n++){const r=e[n].indexOf("=");let i,s=null;r>=0?(i=e[n].substring(0,r),s=e[n].substring(r+1)):i=e[n],t(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function ft(e,t){pt(e),t=wt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function gt(e,t){return pt(e),t=wt(e,t),e.g.has(t)}function mt(e,t){pt(e);let n=[];if("string"==typeof t)gt(e,t)&&(n=n.concat(e.g.get(wt(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)n=n.concat(e[t]);return n}function yt(e,t,n){ft(e,t),n.length>0&&(e.i=null,e.g.set(wt(e,t),d(n)),e.h+=n.length)}function _t(e){const t=new dt;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function wt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function vt(e,t,n,r,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),r(n)}catch(e){}}function bt(){this.g=new se}function Et(e){this.i=e.Sb||null,this.h=e.ab||!1}function Tt(e,t){X.call(this),this.H=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}function It(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}function St(e){e.readyState=4,e.l=null,e.j=null,e.B=null,Ct(e)}function Ct(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function kt(e){let t="";return x(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function At(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=kt(n),"string"==typeof e?null!=n&&Ce(n):nt(e,t,n))}function Rt(e){X.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}(e=dt.prototype).add=function(e,t){pt(this),this.i=null,e=wt(this,e);let n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){pt(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)},e.set=function(e,t){return pt(this),this.i=null,gt(this,e=wt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&(e=mt(this,e)).length>0?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(let r=0;r<t.length;r++){var n=t[r];const i=Ce(n);n=mt(this,n);for(let t=0;t<n.length;t++){let r=i;""!==n[t]&&(r+="="+Ce(n[t])),e.push(r)}}return this.i=e.join("&")},u(Et,oe),Et.prototype.g=function(){return new Tt(this.i,this.h)},u(Tt,X),(e=Tt.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=e,this.D=t,this.readyState=1,Ct(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};e&&(t.body=e),(this.H||s).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&4!=this.readyState&&(this.g=!1,St(this)),this.readyState=0},e.Pa=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,Ct(this)),this.g&&(this.readyState=3,Ct(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(void 0!==s.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;It(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))},e.Ma=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?St(this):Ct(this),3==this.readyState&&It(this)}},e.Oa=function(e){this.g&&(this.response=this.responseText=e,St(this))},e.Na=function(e){this.g&&(this.response=e,St(this))},e.ga=function(){this.g&&St(this)},e.setRequestHeader=function(e,t){this.A.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Tt.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),u(Rt,X);var Ot=/^https?$/i,Pt=["POST","PUT"];function xt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,Nt(e),Lt(e)}function Nt(e){e.A||(e.A=!0,Q(e,"complete"),Q(e,"error"))}function Dt(e){if(e.h&&void 0!==i)if(e.v&&4==Mt(e))setTimeout(e.Ca.bind(e),0);else if(Q(e,"readystatechange"),4==Mt(e)){e.h=!1;try{const i=e.ca();e:switch(i){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var r;if(r=0===i){let t=String(e.D).match(Qe)[1]||null;!t&&s.self&&s.self.location&&(t=s.self.location.protocol.slice(0,-1)),r=!Ot.test(t?t.toLowerCase():"")}n=r}if(n)Q(e,"complete"),Q(e,"success");else{e.o=6;try{var o=Mt(e)>2?e.g.statusText:""}catch(e){o=""}e.l=o+" ["+e.ca()+"]",Nt(e)}}finally{Lt(e)}}}function Lt(e,t){if(e.g){e.m&&(clearTimeout(e.m),e.m=null);const n=e.g;e.g=null,t||Q(e,"ready");try{n.onreadystatechange=null}catch(e){}}}function Mt(e){return e.g?e.g.readyState:0}function Ut(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.F){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function $t(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Ft(e){this.za=0,this.i=[],this.j=new ve,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=$t("failFast",!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=$t("baseRetryDelayMs",5e3,e),this.Za=$t("retryDelaySeedMs",1e4,e),this.Ta=$t("forwardChannelMaxRetries",2,e),this.va=$t("forwardChannelRequestTimeoutMs",2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M="",this.h=new ze(e&&e.concurrentRequestLimit),this.Ba=new bt,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&e.longPollingTimeout>0&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function jt(e){if(Bt(e),3==e.I){var t=e.V++,n=Ye(e.J);if(nt(n,"SID",e.M),nt(n,"RID",t),nt(n,"TYPE","terminate"),Ht(e,n),(t=new Ae(e,e.j,t)).M=2,t.A=rt(Ye(n)),n=!1,s.navigator&&s.navigator.sendBeacon)try{n=s.navigator.sendBeacon(t.A.toString(),"")}catch(e){}!n&&s.Image&&((new Image).src=t.A,n=!0),n||(t.g=rn(t.j,null),t.g.ea(t.A)),t.F=Date.now(),Me(t)}tn(e)}function Vt(e){e.g&&(Xt(e),e.g.cancel(),e.g=null)}function Bt(e){Vt(e),e.v&&(s.clearTimeout(e.v),e.v=null),Jt(e),e.h.cancel(),e.m&&("number"==typeof e.m&&s.clearTimeout(e.m),e.m=null)}function zt(e){if(!qe(e.h)&&!e.m){e.m=!0;var t=e.Ea;_||b(),w||(_(),w=!0),v.add(t,e),e.D=0}}function qt(e,t){var n;n=t?t.l:e.V++;const r=Ye(e.J);nt(r,"SID",e.M),nt(r,"RID",n),nt(r,"AID",e.K),Ht(e,r),e.u&&e.o&&At(r,e.u,e.o),n=new Ae(e,e.j,n,e.D+1),null===e.u&&(n.J=e.o),t&&(e.i=t.G.concat(e.i)),t=Kt(e,n,1e3),n.H=Math.round(.5*e.va)+Math.round(.5*e.va*Math.random()),We(e.h,n),xe(n,r,t)}function Ht(e,t){e.H&&x(e.H,function(e,n){nt(t,n,e)}),e.l&&x({},function(e,n){nt(t,n,e)})}function Kt(e,t,n){n=Math.min(e.i.length,n);const r=e.l?c(e.l.Ka,e.l,e):null;e:{var i=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?n>0?(t=i[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let c=!0;for(let l=0;l<n;l++){var s=i[l].g;const n=i[l].map;if((s-=t)<0)t=Math.max(0,i[l].g-100),c=!1;else try{s="req"+s+"_"||"";try{var a=n instanceof Map?n:Object.entries(n);for(const[t,n]of a){let r=n;o(n)&&(r=re(n)),e.push(s+t+"="+encodeURIComponent(r))}}catch(t){throw e.push(s+"type="+encodeURIComponent("_badmap")),t}}catch(e){r&&r(n)}}if(c){a=e.join("&");break e}}a=void 0}return e=e.i.splice(0,n),t.G=e,a}function Wt(e){if(!e.g&&!e.v){e.Y=1;var t=e.Da;_||b(),w||(_(),w=!0),v.add(t,e),e.A=0}}function Gt(e){return!(e.g||e.v||e.A>=3)&&(e.Y++,e.v=we(c(e.Da,e),Zt(e,e.A)),e.A++,!0)}function Xt(e){null!=e.B&&(s.clearTimeout(e.B),e.B=null)}function Qt(e){e.g=new Ae(e,e.j,"rpc",e.Y),null===e.u&&(e.g.J=e.o),e.g.P=0;var t=Ye(e.na);nt(t,"RID","rpc"),nt(t,"SID",e.M),nt(t,"AID",e.K),nt(t,"CI",e.F?"0":"1"),!e.F&&e.ia&&nt(t,"TO",e.ia),nt(t,"TYPE","xmlhttp"),Ht(e,t),e.u&&e.o&&At(t,e.u,e.o),e.O&&(e.g.H=e.O);var n=e.g;e=e.ba,n.M=1,n.A=rt(Ye(t)),n.u=null,n.R=!0,Ne(n,e)}function Jt(e){null!=e.C&&(s.clearTimeout(e.C),e.C=null)}function Yt(e,t){var n=null;if(e.g==t){Jt(e),Xt(e),e.g=null;var r=2}else{if(!Ke(e.h,t))return;n=t.G,Ge(e.h,t),r=1}if(0!=e.I)if(t.o)if(1==r){n=t.u?t.u.length:0,t=Date.now()-t.F;var i=e.D;Q(r=pe(),new _e(r,n)),zt(e)}else Wt(e);else if(3==(i=t.m)||0==i&&t.X>0||!(1==r&&function(e,t){return!(He(e.h)>=e.h.j-(e.m?1:0)||(e.m?(e.i=t.G.concat(e.i),0):1==e.I||2==e.I||e.D>=(e.Sa?0:e.Ta)||(e.m=we(c(e.Ea,e,t),Zt(e,e.D)),e.D++,0)))}(e,t)||2==r&&Gt(e)))switch(n&&n.length>0&&(t=e.h,t.i=t.i.concat(n)),i){case 1:en(e,5);break;case 4:en(e,10);break;case 3:en(e,6);break;default:en(e,2)}}function Zt(e,t){let n=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(n*=2),n*t}function en(e,t){if(e.j.info("Error code "+t),2==t){var n=c(e.bb,e),r=e.Ua;const t=!r;r=new Je(r||"//www.google.com/images/cleardot.gif"),s.location&&"http"==s.location.protocol||Ze(r,"https"),rt(r),t?function(e,t){const n=new ve;if(s.Image){const r=new Image;r.onload=l(vt,n,"TestLoadImage: loaded",!0,t,r),r.onerror=l(vt,n,"TestLoadImage: error",!1,t,r),r.onabort=l(vt,n,"TestLoadImage: abort",!1,t,r),r.ontimeout=l(vt,n,"TestLoadImage: timeout",!1,t,r),s.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}(r.toString(),n):function(e,t){new ve;const n=new AbortController,r=setTimeout(()=>{n.abort(),vt(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(r),e.ok?vt(0,0,!0,t):vt(0,0,!1,t)}).catch(()=>{clearTimeout(r),vt(0,0,!1,t)})}(r.toString(),n)}else ye(2);e.I=0,e.l&&e.l.pa(t),tn(e),Bt(e)}function tn(e){if(e.I=0,e.ja=[],e.l){const t=Xe(e.h);0==t.length&&0==e.i.length||(p(e.ja,t),p(e.ja,e.i),e.h.i.length=0,d(e.i),e.i.length=0),e.l.oa()}}function nn(e,t,n){var r=n instanceof Je?Ye(n):new Je(n);if(""!=r.g)t&&(r.g=t+"."+r.g),et(r,r.u);else{var i=s.location;r=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;const e=new Je(null);r&&Ze(e,r),t&&(e.g=t),i&&et(e,i),n&&(e.h=n),r=e}return n=e.G,t=e.wa,n&&t&&nt(r,n,t),nt(r,"VER",e.ka),Ht(e,r),r}function rn(e,t,n){if(t&&!e.L)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Aa&&!e.ma?new Rt(new Et({ab:n})):new Rt(e.ma)).Fa(e.L),t}function sn(){}function on(){}function an(e,t){X.call(this),this.g=new Ft(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.o=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.sa&&(e?e["X-WebChannel-Client-Profile"]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!C(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!C(t)&&(this.g.G=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new un(this)}function cn(e){le.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(const 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 ln(){ue.call(this),this.status=1}function un(e){this.g=e}(e=Rt.prototype).Fa=function(e){this.H=e},e.ea=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Ee.g(),this.g.onreadystatechange=h(c(this.Ca,this));try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void xt(this,e)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));for(const e of r.keys())n.set(e,r.get(e))}r=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),i=s.FormData&&e instanceof s.FormData,!(Array.prototype.indexOf.call(Pt,t,void 0)>=0)||r||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(e),this.v=!1}catch(e){xt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,Q(this,"complete"),Q(this,"abort"),Lt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Lt(this,!0)),Rt.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?Dt(this):this.Xa())},e.Xa=function(){Dt(this)},e.isActive=function(){return!!this.g},e.ca=function(){try{return Mt(this)>2?this.g.status:-1}catch(e){return-1}},e.la=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.La=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),ie(t)}},e.ya=function(){return this.o},e.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=Ft.prototype).ka=8,e.I=1,e.connect=function(e,t,n,r){ye(0),this.W=e,this.H=t||{},n&&void 0!==r&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.J=nn(this,null,this.W),zt(this)},e.Ea=function(e){if(this.m)if(this.m=null,1==this.I){if(!e){this.V=Math.floor(1e5*Math.random()),e=this.V++;const i=new Ae(this,this.j,e);let s=this.o;if(this.U&&(s?(s=N(s),L(s,this.U)):s=this.U),null!==this.u||this.R||(i.J=s,s=null),this.S)e:{for(var t=0,n=0;n<this.i.length;n++){var r=this.i[n];if(void 0===(r="__data__"in r.map&&"string"==typeof(r=r.map.__data__)?r.length:void 0))break;if((t+=r)>4096){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=Kt(this,i,t),nt(n=Ye(this.J),"RID",e),nt(n,"CVER",22),this.G&&nt(n,"X-HTTP-Session-Id",this.G),Ht(this,n),s&&(this.R?t="headers="+Ce(kt(s))+"&"+t:this.u&&At(n,this.u,s)),We(this.h,i),this.Ra&&nt(n,"TYPE","init"),this.S?(nt(n,"$req",t),nt(n,"SID","null"),i.U=!0,xe(i,n,null)):xe(i,n,t),this.I=2}}else 3==this.I&&(e?qt(this,e):0==this.i.length||qe(this.h)||qt(this))},e.Da=function(){if(this.v=null,Qt(this),this.aa&&!(this.P||null==this.g||this.T<=0)){var e=4*this.T;this.j.info("BP detection timer enabled: "+e),this.B=we(c(this.Wa,this),e)}},e.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,ye(10),Vt(this),Qt(this))},e.Va=function(){null!=this.C&&(this.C=null,Vt(this),Gt(this),ye(19))},e.bb=function(e){e?(this.j.info("Successfully pinged google.com"),ye(2)):(this.j.info("Failed to ping google.com"),ye(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=sn.prototype).ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){},on.prototype.g=function(e,t){return new an(e,t)},u(an,X),an.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},an.prototype.close=function(){jt(this.g)},an.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=re(e),e=n);t.i.push(new Be(t.Ya++,e)),3==t.I&&zt(t)},an.prototype.N=function(){this.g.l=null,delete this.j,jt(this.g),delete this.g,an.Z.N.call(this)},u(cn,le),u(ln,ue),u(un,sn),un.prototype.ra=function(){Q(this.g,"a")},un.prototype.qa=function(e){Q(this.g,new cn(e))},un.prototype.pa=function(e){Q(this.g,new ln)},un.prototype.oa=function(){Q(this.g,"b")},on.prototype.createWebChannel=on.prototype.g,an.prototype.send=an.prototype.o,an.prototype.open=an.prototype.m,an.prototype.close=an.prototype.close,ec=function(){return new on},Za=function(){return pe()},Ya=he,Ja={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},Te.NO_ERROR=0,Te.TIMEOUT=8,Te.HTTP_ERROR=6,Qa=Te,Ie.COMPLETE="complete",Xa=Ie,ae.EventType=ce,ce.OPEN="a",ce.CLOSE="b",ce.ERROR="c",ce.MESSAGE="d",X.prototype.listen=X.prototype.J,Ga=ae,Rt.prototype.listenOnce=Rt.prototype.K,Rt.prototype.getLastError=Rt.prototype.Ha,Rt.prototype.getLastErrorCode=Rt.prototype.ya,Rt.prototype.getStatus=Rt.prototype.ca,Rt.prototype.getResponseJson=Rt.prototype.La,Rt.prototype.getResponseText=Rt.prototype.la,Rt.prototype.send=Rt.prototype.ea,Rt.prototype.setWithCredentials=Rt.prototype.Fa,Wa=Rt}).apply(void 0!==tc?tc:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});const nc="@firebase/firestore",rc="4.9.3";class ic{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}}ic.UNAUTHENTICATED=new ic(null),ic.GOOGLE_CREDENTIALS=new ic("google-credentials-uid"),ic.FIRST_PARTY=new ic("first-party-uid"),ic.MOCK_USER=new ic("mock-user");let sc="12.7.0";const oc=new mr("@firebase/firestore");function ac(){return oc.logLevel}function cc(e,...t){if(oc.logLevel<=hr.DEBUG){const n=t.map(hc);oc.debug(`Firestore (${sc}): ${e}`,...n)}}function lc(e,...t){if(oc.logLevel<=hr.ERROR){const n=t.map(hc);oc.error(`Firestore (${sc}): ${e}`,...n)}}function uc(e,...t){if(oc.logLevel<=hr.WARN){const n=t.map(hc);oc.warn(`Firestore (${sc}): ${e}`,...n)}}function hc(e){if("string"==typeof e)return e;try{return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}function dc(e,t,n){let r="Unexpected state";"string"==typeof t?r=t:n=t,pc(e,r,n)}function pc(e,t,n){let r=`FIRESTORE (${sc}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==n)try{r+=" CONTEXT: "+JSON.stringify(n)}catch(e){r+=" CONTEXT: "+n}throw lc(r),new Error(r)}function fc(e,t,n,r){let i="Unexpected state";"string"==typeof n?i=n:r=n,e||pc(t,i,r)}function gc(e,t){return e}const mc={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class yc extends Xn{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class _c{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class wc{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class vc{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(ic.UNAUTHENTICATED))}shutdown(){}}class bc{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}}class Ec{constructor(e){this.t=e,this.currentUser=ic.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){fc(void 0===this.o,42304);let n=this.i;const r=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let i=new _c;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new _c,e.enqueueRetryable(()=>r(this.currentUser))};const s=()=>{const t=i;e.enqueueRetryable(async()=>{await t.promise,await r(this.currentUser)})},o=e=>{cc("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(e=>o(e)),setTimeout(()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?o(e):(cc("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new _c)}},0),s()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(cc("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(fc("string"==typeof t.accessToken,31837,{l:t}),new wc(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return fc(null===e||"string"==typeof e,2055,{h:e}),new ic(e)}}class Tc{constructor(e,t,n){this.P=e,this.T=t,this.I=n,this.type="FirstParty",this.user=ic.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class Ic{constructor(e,t,n){this.P=e,this.T=t,this.I=n}getToken(){return Promise.resolve(new Tc(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(ic.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Sc{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Cc{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,wi(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){fc(void 0===this.o,3512);const n=e=>{null!=e.error&&cc("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);const n=e.token!==this.m;return this.m=e.token,cc("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};const r=e=>{cc("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(e=>r(e)),setTimeout(()=>{if(!this.appCheck){const e=this.V.getImmediate({optional:!0});e?r(e):cc("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Sc(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(fc("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new Sc(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}function kc(e){const 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}class Ac{static newId(){const e=62*Math.floor(256/62);let t="";for(;t.length<20;){const n=kc(40);for(let r=0;r<n.length;++r)t.length<20&&n[r]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[r]%62))}return t}}function Rc(e,t){return e<t?-1:e>t?1:0}function Oc(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=e.charAt(r),i=t.charAt(r);if(n!==i)return Nc(n)===Nc(i)?Rc(n,i):Nc(n)?1:-1}return Rc(e.length,t.length)}const Pc=55296,xc=57343;function Nc(e){const t=e.charCodeAt(0);return t>=Pc&&t<=xc}function Dc(e,t,n){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}const Lc="__name__";class Mc{constructor(e,t,n){void 0===t?t=0:t>e.length&&dc(637,{offset:t,range:e.length}),void 0===n?n=e.length-t:n>e.length-t&&dc(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===Mc.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Mc?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){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=Mc.compareSegments(e.get(r),t.get(r));if(0!==n)return n}return Rc(e.length,t.length)}static compareSegments(e,t){const n=Mc.isNumericId(e),r=Mc.isNumericId(t);return n&&!r?-1:!n&&r?1:n&&r?Mc.extractNumericId(e).compare(Mc.extractNumericId(t)):Oc(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Ha.fromString(e.substring(4,e.length-2))}}class Uc extends Mc{construct(e,t,n){return new Uc(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const n of e){if(n.indexOf("//")>=0)throw new yc(mc.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new Uc(t)}static emptyPath(){return new Uc([])}}const $c=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Fc extends Mc{construct(e,t,n){return new Fc(e,t,n)}static isValidIdentifier(e){return $c.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Fc.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===Lc}static keyField(){return new Fc([Lc])}static fromServerFormat(e){const t=[];let n="",r=0;const i=()=>{if(0===n.length)throw new yc(mc.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let s=!1;for(;r<e.length;){const t=e[r];if("\\"===t){if(r+1===e.length)throw new yc(mc.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new yc(mc.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,r+=2}else"`"===t?(s=!s,r++):"."!==t||s?(n+=t,r++):(i(),r++)}if(i(),s)throw new yc(mc.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new Fc(t)}static emptyPath(){return new Fc([])}}class jc{constructor(e){this.path=e}static fromPath(e){return new jc(Uc.fromString(e))}static fromName(e){return new jc(Uc.fromString(e).popFirst(5))}static empty(){return new jc(Uc.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===Uc.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return Uc.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new jc(new Uc(e.slice()))}}function Vc(e){if(!jc.isDocumentKey(e))throw new yc(mc.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function Bc(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new yc(mc.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=function(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";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return"function"==typeof e?"a function":dc(12329,{type:typeof e})}(e);throw new yc(mc.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}function zc(e,t){const n={typeString:e};return t&&(n.value=t),n}function qc(e,t){if(!function(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}(e))throw new yc(mc.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in t)if(t[r]){const i=t[r].typeString,s="value"in t[r]?{value:t[r].value}:void 0;if(!(r in e)){n=`JSON missing required field: '${r}'`;break}const o=e[r];if(i&&typeof o!==i){n=`JSON field '${r}' must be a ${i}.`;break}if(void 0!==s&&o!==s.value){n=`Expected '${r}' field to equal '${s.value}'`;break}}if(n)throw new yc(mc.INVALID_ARGUMENT,n);return!0}const Hc=-62135596800,Kc=1e6;class Wc{static now(){return Wc.fromMillis(Date.now())}static fromDate(e){return Wc.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*Kc);return new Wc(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new yc(mc.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new yc(mc.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<Hc)throw new yc(mc.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new yc(mc.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Kc}_compareTo(e){return this.seconds===e.seconds?Rc(this.nanoseconds,e.nanoseconds):Rc(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{type:Wc._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(qc(e,Wc._jsonSchema))return new Wc(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-Hc;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Wc._jsonSchemaVersion="firestore/timestamp/1.0",Wc._jsonSchema={type:zc("string",Wc._jsonSchemaVersion),seconds:zc("number"),nanoseconds:zc("number")};class Gc{static fromTimestamp(e){return new Gc(e)}static min(){return new Gc(new Wc(0,0))}static max(){return new Gc(new Wc(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}function Xc(e){return new Qc(e.readTime,e.key,-1)}class Qc{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new Qc(Gc.min(),jc.empty(),-1)}static max(){return new Qc(Gc.max(),jc.empty(),-1)}}function Jc(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=jc.comparator(e.documentKey,t.documentKey),0!==n?n:Rc(e.largestBatchId,t.largestBatchId))}class Yc{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function Zc(e){if(e.code!==mc.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;cc("LocalStore","Unexpectedly lost primary lease")}class el{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&&dc(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new el((n,r)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,r)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,r)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof el?t:el.resolve(t)}catch(e){return el.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):el.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):el.reject(t)}static resolve(e){return new el((t,n)=>{t(e)})}static reject(e){return new el((t,n)=>{n(e)})}static waitFor(e){return new el((t,n)=>{let r=0,i=0,s=!1;e.forEach(e=>{++r,e.next(()=>{++i,s&&i===r&&t()},e=>n(e))}),s=!0,i===r&&t()})}static or(e){let t=el.resolve(!1);for(const n of e)t=t.next(e=>e?el.resolve(e):n());return t}static forEach(e,t){const n=[];return e.forEach((e,r)=>{n.push(t.call(this,e,r))}),this.waitFor(n)}static mapArray(e,t){return new el((n,r)=>{const i=e.length,s=new Array(i);let o=0;for(let a=0;a<i;a++){const c=a;t(e[c]).next(e=>{s[c]=e,++o,o===i&&n(s)},e=>r(e))}})}static doWhile(e,t){return new el((n,r)=>{const i=()=>{!0===e()?t().next(()=>{i()},r):n()};i()})}}function tl(e){return"IndexedDbTransactionError"===e.name}class nl{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ae(e),this.ue=e=>t.writeSequenceNumber(e))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}nl.ce=-1;function rl(e){return null==e}function il(e){return 0===e&&1/e==-1/0}function sl(e,t){let n=t;const r=e.length;for(let t=0;t<r;t++){const r=e.charAt(t);switch(r){case"\0":n+="";break;case"":n+="";break;default:n+=r}}return n}function ol(e){return e+""}function al(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function cl(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}class ll{constructor(e,t){this.comparator=e,this.root=t||hl.EMPTY}insert(e,t){return new ll(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,hl.BLACK,null,null))}remove(e){return new ll(this.comparator,this.root.remove(e,this.comparator).copy(null,null,hl.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const 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();){const r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<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(){const e=[];return this.inorderTraversal((t,n)=>(e.push(`${t}:${n}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new ul(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new ul(this.root,e,this.comparator,!1)}getReverseIterator(){return new ul(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new ul(this.root,e,this.comparator,!0)}}class ul{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?n(e.key,t):1,t&&r&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(0===i){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const 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;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class hl{constructor(e,t,n,r,i){this.key=e,this.value=t,this.color=null!=n?n:hl.RED,this.left=null!=r?r:hl.EMPTY,this.right=null!=i?i:hl.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,r,i){return new hl(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this;const i=n(e,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return hl.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let n,r=this;if(t(e,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(e,t),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===t(e,r.key)){if(r.right.isEmpty())return hl.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(e,t))}return r.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,hl.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,hl.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const 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(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw dc(43730,{key:this.key,value:this.value});if(this.right.isRed())throw dc(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw dc(27949);return e+(this.isRed()?0:1)}}hl.EMPTY=null,hl.RED=!0,hl.BLACK=!1,hl.EMPTY=new class{constructor(){this.size=0}get key(){throw dc(57766)}get value(){throw dc(16141)}get color(){throw dc(16727)}get left(){throw dc(29726)}get right(){throw dc(36894)}copy(e,t,n,r,i){return this}insert(e,t,n){return new hl(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}};class dl{constructor(e){this.comparator=e,this.data=new ll(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){const n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.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){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new pl(this.data.getIterator())}getIteratorFrom(e){return new pl(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 dl))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(0!==this.comparator(e,r))return!1}return!0}toArray(){const e=[];return this.forEach(t=>{e.push(t)}),e}toString(){const e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){const t=new dl(this.comparator);return t.data=e,t}}class pl{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class fl{constructor(e){this.fields=e,e.sort(Fc.comparator)}static empty(){return new fl([])}unionWith(e){let t=new dl(Fc.comparator);for(const e of this.fields)t=t.add(e);for(const n of e)t=t.add(n);return new fl(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Dc(this.fields,e.fields,(e,t)=>e.isEqual(t))}}class gl extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class ml{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new gl("Invalid base64 string: "+e):e}}(e);return new ml(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new ml(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(e){return btoa(e)}(this.binaryString)}toUint8Array(){return function(e){const 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 Rc(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}ml.EMPTY_BYTE_STRING=new ml("");const yl=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function _l(e){if(fc(!!e,39018),"string"==typeof e){let t=0;const n=yl.exec(e);if(fc(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const r=new Date(e);return{seconds:Math.floor(r.getTime()/1e3),nanos:t}}return{seconds:wl(e.seconds),nanos:wl(e.nanos)}}function wl(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function vl(e){return"string"==typeof e?ml.fromBase64String(e):ml.fromUint8Array(e)}const bl="server_timestamp",El="__type__",Tl="__previous_value__",Il="__local_write_time__";function Sl(e){const t=(e?.mapValue?.fields||{})[El]?.stringValue;return t===bl}function Cl(e){const t=e.mapValue.fields[Tl];return Sl(t)?Cl(t):t}function kl(e){const t=_l(e.mapValue.fields[Il].timestampValue);return new Wc(t.seconds,t.nanos)}class Al{constructor(e,t,n,r,i,s,o,a,c,l){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=c,this.isUsingEmulator=l}}const Rl="(default)";class Ol{constructor(e,t){this.projectId=e,this.database=t||Rl}static empty(){return new Ol("","")}get isDefaultDatabase(){return this.database===Rl}isEqual(e){return e instanceof Ol&&e.projectId===this.projectId&&e.database===this.database}}const Pl="__type__",xl="__max__",Nl={},Dl="__vector__",Ll="value";function Ml(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?Sl(e)?4:function(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===xl}(e)?9007199254740991:function(e){const t=(e?.mapValue?.fields||{})[Pl]?.stringValue;return t===Dl}(e)?10:11:dc(28295,{value:e})}function Ul(e,t){if(e===t)return!0;const n=Ml(e);if(n!==Ml(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return kl(e).isEqual(kl(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;const n=_l(e.timestampValue),r=_l(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return vl(e.bytesValue).isEqual(vl(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return wl(e.geoPointValue.latitude)===wl(t.geoPointValue.latitude)&&wl(e.geoPointValue.longitude)===wl(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return wl(e.integerValue)===wl(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){const n=wl(e.doubleValue),r=wl(t.doubleValue);return n===r?il(n)===il(r):isNaN(n)&&isNaN(r)}return!1}(e,t);case 9:return Dc(e.arrayValue.values||[],t.arrayValue.values||[],Ul);case 10:case 11:return function(e,t){const n=e.mapValue.fields||{},r=t.mapValue.fields||{};if(al(n)!==al(r))return!1;for(const e in n)if(n.hasOwnProperty(e)&&(void 0===r[e]||!Ul(n[e],r[e])))return!1;return!0}(e,t);default:return dc(52216,{left:e})}}function $l(e,t){return void 0!==(e.values||[]).find(e=>Ul(e,t))}function Fl(e,t){if(e===t)return 0;const n=Ml(e),r=Ml(t);if(n!==r)return Rc(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Rc(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=wl(e.integerValue||e.doubleValue),r=wl(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return jl(e.timestampValue,t.timestampValue);case 4:return jl(kl(e),kl(t));case 5:return Oc(e.stringValue,t.stringValue);case 6:return function(e,t){const n=vl(e),r=vl(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),r=t.split("/");for(let e=0;e<n.length&&e<r.length;e++){const t=Rc(n[e],r[e]);if(0!==t)return t}return Rc(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=Rc(wl(e.latitude),wl(t.latitude));return 0!==n?n:Rc(wl(e.longitude),wl(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return Vl(e.arrayValue,t.arrayValue);case 10:return function(e,t){const n=e.fields||{},r=t.fields||{},i=n[Ll]?.arrayValue,s=r[Ll]?.arrayValue,o=Rc(i?.values?.length||0,s?.values?.length||0);return 0!==o?o:Vl(i,s)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===Nl&&t===Nl)return 0;if(e===Nl)return 1;if(t===Nl)return-1;const n=e.fields||{},r=Object.keys(n),i=t.fields||{},s=Object.keys(i);r.sort(),s.sort();for(let e=0;e<r.length&&e<s.length;++e){const t=Oc(r[e],s[e]);if(0!==t)return t;const o=Fl(n[r[e]],i[s[e]]);if(0!==o)return o}return Rc(r.length,s.length)}(e.mapValue,t.mapValue);default:throw dc(23264,{he:n})}}function jl(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return Rc(e,t);const n=_l(e),r=_l(t),i=Rc(n.seconds,r.seconds);return 0!==i?i:Rc(n.nanos,r.nanos)}function Vl(e,t){const n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){const t=Fl(n[e],r[e]);if(t)return t}return Rc(n.length,r.length)}function Bl(e){return zl(e)}function zl(e){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){const t=_l(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return vl(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return jc.fromName(e).toString()}(e.referenceValue):"geoPointValue"in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):"arrayValue"in e?function(e){let t="[",n=!0;for(const r of e.values||[])n?n=!1:t+=",",t+=zl(r);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",r=!0;for(const i of t)r?r=!1:n+=",",n+=`${i}:${zl(e.fields[i])}`;return n+"}"}(e.mapValue):dc(61005,{value:e})}function ql(e){switch(Ml(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Cl(e);return t?16+ql(t):16;case 5:return 2*e.stringValue.length;case 6:return vl(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce((e,t)=>e+ql(t),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return cl(e.fields,(e,n)=>{t+=e.length+ql(n)}),t}(e.mapValue);default:throw dc(13486,{value:e})}}function Hl(e){return!!e&&"integerValue"in e}function Kl(e){return!!e&&"arrayValue"in e}function Wl(e){return!!e&&"mapValue"in e}function Gl(e){if(e.geoPointValue)return{geoPointValue:{...e.geoPointValue}};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:{...e.timestampValue}};if(e.mapValue){const t={mapValue:{fields:{}}};return cl(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=Gl(n)),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=Gl(e.arrayValue.values[n]);return t}return{...e}}class Xl{constructor(e){this.value=e}static empty(){return new Xl({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!Wl(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Gl(t)}setAll(e){let t=Fc.emptyPath(),n={},r=[];e.forEach((e,i)=>{if(!t.isImmediateParentOf(i)){const e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=i.popLast()}e?n[i.lastSegment()]=Gl(e):r.push(i.lastSegment())});const i=this.getFieldsMap(t);this.applyChanges(i,n,r)}delete(e){const t=this.field(e.popLast());Wl(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Ul(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 r=t.mapValue.fields[e.get(n)];Wl(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}applyChanges(e,t,n){cl(t,(t,n)=>e[t]=n);for(const t of n)delete e[t]}clone(){return new Xl(Gl(this.value))}}function Ql(e){const t=[];return cl(e.fields,(e,n)=>{const r=new Fc([e]);if(Wl(n)){const e=Ql(n.mapValue).fields;if(0===e.length)t.push(r);else for(const n of e)t.push(r.child(n))}else t.push(r)}),new fl(t)}class Jl{constructor(e,t,n,r,i,s,o){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=i,this.data=s,this.documentState=o}static newInvalidDocument(e){return new Jl(e,0,Gc.min(),Gc.min(),Gc.min(),Xl.empty(),0)}static newFoundDocument(e,t,n,r){return new Jl(e,1,t,Gc.min(),n,r,0)}static newNoDocument(e,t){return new Jl(e,2,t,Gc.min(),Gc.min(),Xl.empty(),0)}static newUnknownDocument(e,t){return new Jl(e,3,t,Gc.min(),Gc.min(),Xl.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(Gc.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=Xl.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Xl.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Gc.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 Jl&&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 Jl(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}})`}}class Yl{constructor(e,t){this.position=e,this.inclusive=t}}function Zl(e,t,n){let r=0;for(let i=0;i<e.position.length;i++){const s=t[i],o=e.position[i];if(r=s.field.isKeyField()?jc.comparator(jc.fromName(o.referenceValue),n.key):Fl(o,n.data.field(s.field)),"desc"===s.dir&&(r*=-1),0!==r)break}return r}function eu(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!Ul(e.position[n],t.position[n]))return!1;return!0}class tu{constructor(e,t="asc"){this.field=e,this.dir=t}}function nu(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}class ru{}class iu extends ru{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 hu(e,t,n):"array-contains"===t?new gu(e,n):"in"===t?new mu(e,n):"not-in"===t?new yu(e,n):"array-contains-any"===t?new _u(e,n):new iu(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new du(e,n):new pu(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(Fl(t,this.value)):null!==t&&Ml(this.value)===Ml(t)&&this.matchesComparison(Fl(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 dc(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class su extends ru{constructor(e,t){super(),this.filters=e,this.op=t,this.Pe=null}static create(e,t){return new su(e,t)}matches(e){return ou(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.Pe||(this.Pe=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function ou(e){return"and"===e.op}function au(e){return function(e){for(const t of e.filters)if(t instanceof su)return!1;return!0}(e)&&ou(e)}function cu(e){if(e instanceof iu)return e.field.canonicalString()+e.op.toString()+Bl(e.value);if(au(e))return e.filters.map(e=>cu(e)).join(",");{const t=e.filters.map(e=>cu(e)).join(",");return`${e.op}(${t})`}}function lu(e,t){return e instanceof iu?function(e,t){return t instanceof iu&&e.op===t.op&&e.field.isEqual(t.field)&&Ul(e.value,t.value)}(e,t):e instanceof su?function(e,t){return t instanceof su&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((e,n,r)=>e&&lu(n,t.filters[r]),!0)}(e,t):void dc(19439)}function uu(e){return e instanceof iu?function(e){return`${e.field.canonicalString()} ${e.op} ${Bl(e.value)}`}(e):e instanceof su?function(e){return e.op.toString()+" {"+e.getFilters().map(uu).join(" ,")+"}"}(e):"Filter"}class hu extends iu{constructor(e,t,n){super(e,t,n),this.key=jc.fromName(n.referenceValue)}matches(e){const t=jc.comparator(e.key,this.key);return this.matchesComparison(t)}}class du extends iu{constructor(e,t){super(e,"in",t),this.keys=fu("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class pu extends iu{constructor(e,t){super(e,"not-in",t),this.keys=fu("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function fu(e,t){return(t.arrayValue?.values||[]).map(e=>jc.fromName(e.referenceValue))}class gu extends iu{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Kl(t)&&$l(t.arrayValue,this.value)}}class mu extends iu{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&$l(this.value.arrayValue,t)}}class yu extends iu{constructor(e,t){super(e,"not-in",t)}matches(e){if($l(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!$l(this.value.arrayValue,t)}}class _u extends iu{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Kl(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>$l(this.value.arrayValue,e))}}class wu{constructor(e,t=null,n=[],r=[],i=null,s=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=s,this.endAt=o,this.Te=null}}function vu(e,t=null,n=[],r=[],i=null,s=null,o=null){return new wu(e,t,n,r,i,s,o)}function bu(e){const t=gc(e);if(null===t.Te){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map(e=>cu(e)).join(","),e+="|ob:",e+=t.orderBy.map(e=>function(e){return e.field.canonicalString()+e.dir}(e)).join(","),rl(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map(e=>Bl(e)).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(e=>Bl(e)).join(",")),t.Te=e}return t.Te}function Eu(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!nu(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!lu(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!eu(e.startAt,t.startAt)&&eu(e.endAt,t.endAt)}class Tu{constructor(e,t=null,n=[],r=[],i=null,s="F",o=null,a=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=o,this.endAt=a,this.Ie=null,this.Ee=null,this.de=null,this.startAt,this.endAt}}function Iu(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 Su(e){const t=gc(e);if(null===t.Ie){t.Ie=[];const e=new Set;for(const n of t.explicitOrderBy)t.Ie.push(n),e.add(n.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",r=function(e){let t=new dl(Fc.comparator);return e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t}(t);r.forEach(r=>{e.has(r.canonicalString())||r.isKeyField()||t.Ie.push(new tu(r,n))}),e.has(Fc.keyField().canonicalString())||t.Ie.push(new tu(Fc.keyField(),n))}return t.Ie}function Cu(e){const t=gc(e);return t.Ee||(t.Ee=function(e,t){if("F"===e.limitType)return vu(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(e=>{const t="desc"===e.dir?"asc":"desc";return new tu(e.field,t)});const n=e.endAt?new Yl(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Yl(e.startAt.position,e.startAt.inclusive):null;return vu(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}(t,Su(e))),t.Ee}function ku(e,t,n){return new Tu(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function Au(e,t){return Eu(Cu(e),Cu(t))&&e.limitType===t.limitType}function Ru(e){return`${bu(Cu(e))}|lt:${e.limitType}`}function Ou(e){return`Query(target=${function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map(e=>uu(e)).join(", ")}]`),rl(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map(e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e)).join(", ")}]`),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(e=>Bl(e)).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>Bl(e)).join(",")),`Target(${t})`}(Cu(e))}; limitType=${e.limitType})`}function Pu(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):jc.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Su(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const r=Zl(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,Su(e),t))&&!(e.endAt&&!function(e,t,n){const r=Zl(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,Su(e),t))}(e,t)}function xu(e,t,n){const r=e.field.isKeyField()?jc.comparator(t.key,n.key):function(e,t,n){const r=t.data.field(e),i=n.data.field(e);return null!==r&&null!==i?Fl(r,i):dc(42886)}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return dc(19790,{direction:e.dir})}}class Nu{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n)for(const[t,r]of n)if(this.equalsFn(t,e))return r}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){cl(this.inner,(t,n)=>{for(const[t,r]of n)e(t,r)})}isEmpty(){return function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(this.inner)}size(){return this.innerSize}}const Du=new ll(jc.comparator);function Lu(){return Du}const Mu=new ll(jc.comparator);function Uu(...e){let t=Mu;for(const n of e)t=t.insert(n.key,n);return t}function $u(e){let t=Mu;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function Fu(){return Vu()}function ju(){return Vu()}function Vu(){return new Nu(e=>e.toString(),(e,t)=>e.isEqual(t))}const Bu=new ll(jc.comparator),zu=new dl(jc.comparator);function qu(...e){let t=zu;for(const n of e)t=t.add(n);return t}const Hu=new dl(Rc);class Ku{constructor(){this._=void 0}}function Wu(e,t,n){return e instanceof Qu?function(e,t){const n={fields:{[El]:{stringValue:bl},[Il]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Sl(t)&&(t=Cl(t)),t&&(n.fields[Tl]=t),{mapValue:n}}(n,t):e instanceof Ju?Yu(e,t):e instanceof Zu?eh(e,t):function(e,t){const n=Xu(e,t),r=nh(n)+nh(e.Ae);return Hl(n)&&Hl(e.Ae)?function(e){return{integerValue:""+e}}(r):function(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:il(t)?"-0":t}}(e.serializer,r)}(e,t)}function Gu(e,t,n){return e instanceof Ju?Yu(e,t):e instanceof Zu?eh(e,t):n}function Xu(e,t){return e instanceof th?function(e){return Hl(e)||function(e){return!!e&&"doubleValue"in e}(e)}(t)?t:{integerValue:0}:null}class Qu extends Ku{}class Ju extends Ku{constructor(e){super(),this.elements=e}}function Yu(e,t){const n=rh(t);for(const t of e.elements)n.some(e=>Ul(e,t))||n.push(t);return{arrayValue:{values:n}}}class Zu extends Ku{constructor(e){super(),this.elements=e}}function eh(e,t){let n=rh(t);for(const t of e.elements)n=n.filter(e=>!Ul(e,t));return{arrayValue:{values:n}}}class th extends Ku{constructor(e,t){super(),this.serializer=e,this.Ae=t}}function nh(e){return wl(e.integerValue||e.doubleValue)}function rh(e){return Kl(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class ih{constructor(e,t){this.version=e,this.transformResults=t}}class sh{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new sh}static exists(e){return new sh(void 0,e)}static updateTime(e){return new sh(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 oh(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class ah{}function ch(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new _h(e.key,sh.none()):new ph(e.key,e.data,sh.none());{const n=e.data,r=Xl.empty();let i=new dl(Fc.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?r.delete(e):r.set(e,t),i=i.add(e)}return new fh(e.key,r,new fl(i.toArray()),sh.none())}}function lh(e,t,n){e instanceof ph?function(e,t,n){const r=e.value.clone(),i=mh(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof fh?function(e,t,n){if(!oh(e.precondition,t))return void t.convertToUnknownDocument(n.version);const r=mh(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(gh(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function uh(e,t,n,r){return e instanceof ph?function(e,t,n,r){if(!oh(e.precondition,t))return n;const i=e.value.clone(),s=yh(e.fieldTransforms,r,t);return i.setAll(s),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof fh?function(e,t,n,r){if(!oh(e.precondition,t))return n;const i=yh(e.fieldTransforms,r,t),s=t.data;return s.setAll(gh(e)),s.setAll(i),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,r):function(e,t,n){return oh(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function hh(e,t){let n=null;for(const r of e.fieldTransforms){const e=t.data.field(r.field),i=Xu(r.transform,e||null);null!=i&&(null===n&&(n=Xl.empty()),n.set(r.field,i))}return n||null}function dh(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Dc(e,t,(e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Ju&&t instanceof Ju||e instanceof Zu&&t instanceof Zu?Dc(e.elements,t.elements,Ul):e instanceof th&&t instanceof th?Ul(e.Ae,t.Ae):e instanceof Qu&&t instanceof Qu}(e.transform,t.transform)}(e,t))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class ph extends ah{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class fh extends ah{constructor(e,t,n,r,i=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function gh(e){const t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=e.data.field(n);t.set(n,r)}}),t}function mh(e,t,n){const r=new Map;fc(e.length===n.length,32656,{Re:n.length,Ve:e.length});for(let i=0;i<n.length;i++){const s=e[i],o=s.transform,a=t.data.field(s.field);r.set(s.field,Gu(o,a,n[i]))}return r}function yh(e,t,n){const r=new Map;for(const i of e){const e=i.transform,s=n.data.field(i.field);r.set(i.field,Wu(e,s,t))}return r}class _h extends ah{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class wh extends ah{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class vh{constructor(e,t,n,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(e,t){const n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){const r=this.mutations[t];r.key.isEqual(e.key)&&lh(r,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=uh(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=uh(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=ju();return this.mutations.forEach(r=>{const i=e.get(r.key),s=i.overlayedDocument;let o=this.applyToLocalView(s,i.mutatedFields);o=t.has(r.key)?null:o;const a=ch(s,o);null!==a&&n.set(r.key,a),s.isValidDocument()||s.convertToNoDocument(Gc.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),qu())}isEqual(e){return this.batchId===e.batchId&&Dc(this.mutations,e.mutations,(e,t)=>dh(e,t))&&Dc(this.baseMutations,e.baseMutations,(e,t)=>dh(e,t))}}class bh{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(e,t,n){fc(e.mutations.length===n.length,58842,{me:e.mutations.length,fe:n.length});let r=Bu;const i=e.mutations;for(let e=0;e<i.length;e++)r=r.insert(i[e].key,n[e].version);return new bh(e,t,n,r)}}class Eh{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{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}var Th,Ih;(Ih=Th||(Th={}))[Ih.OK=0]="OK",Ih[Ih.CANCELLED=1]="CANCELLED",Ih[Ih.UNKNOWN=2]="UNKNOWN",Ih[Ih.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Ih[Ih.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Ih[Ih.NOT_FOUND=5]="NOT_FOUND",Ih[Ih.ALREADY_EXISTS=6]="ALREADY_EXISTS",Ih[Ih.PERMISSION_DENIED=7]="PERMISSION_DENIED",Ih[Ih.UNAUTHENTICATED=16]="UNAUTHENTICATED",Ih[Ih.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Ih[Ih.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Ih[Ih.ABORTED=10]="ABORTED",Ih[Ih.OUT_OF_RANGE=11]="OUT_OF_RANGE",Ih[Ih.UNIMPLEMENTED=12]="UNIMPLEMENTED",Ih[Ih.INTERNAL=13]="INTERNAL",Ih[Ih.UNAVAILABLE=14]="UNAVAILABLE",Ih[Ih.DATA_LOSS=15]="DATA_LOSS",new Ha([4294967295,4294967295],0);class Sh{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Ch(e,t){return function(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}}(e,t.toTimestamp())}function kh(e){return fc(!!e,49232),Gc.fromTimestamp(function(e){const t=_l(e);return new Wc(t.seconds,t.nanos)}(e))}function Ah(e,t){const n=function(e){return new Uc(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function Rh(e,t){return function(e,t){return Ah(e,t).canonicalString()}(e.databaseId,t.path)}function Oh(e){const t=function(e){const t=Uc.fromString(e);return fc(function(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}(t),10190,{key:t.toString()}),t}(e);return 4===t.length?Uc.emptyPath():function(e){return fc(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}(t)}function Ph(e,t,n){return{name:Rh(e,t),fields:n.value.mapValue.fields}}function xh(e){let t=Oh(e.parent);const n=e.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){fc(1===r,65062);const e=n.from[0];e.allDescendants?i=e.collectionId:t=t.child(e.collectionId)}let s=[];n.where&&(s=function(e){const t=Nh(e);return t instanceof su&&au(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map(e=>function(e){return new tu(Dh(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))}(n.orderBy));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,rl(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new Yl(n,t)}(n.startAt));let l=null;return n.endAt&&(l=function(e){const t=!e.before,n=e.values||[];return new Yl(n,t)}(n.endAt)),function(e,t,n,r,i,s,o,a){return new Tu(e,t,n,r,i,s,o,a)}(t,i,o,s,a,"F",c,l)}function Nh(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=Dh(e.unaryFilter.field);return iu.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=Dh(e.unaryFilter.field);return iu.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=Dh(e.unaryFilter.field);return iu.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=Dh(e.unaryFilter.field);return iu.create(i,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return dc(61313);default:return dc(60726)}}(e):void 0!==e.fieldFilter?function(e){return iu.create(Dh(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";case"OPERATOR_UNSPECIFIED":return dc(58110);default:return dc(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return su.create(e.compositeFilter.filters.map(e=>Nh(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return dc(1026)}}(e.compositeFilter.op))}(e):dc(30097,{filter:e})}function Dh(e){return Fc.fromServerFormat(e.fieldPath)}function Lh(e){const t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}class Mh{constructor(e){this.yt=e}}function Uh(e){const t=xh({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?ku(t,t.limit,"L"):t}class $h{constructor(){this.Cn=new Fh}addToCollectionParentIndex(e,t){return this.Cn.add(t),el.resolve()}getCollectionParents(e,t){return el.resolve(this.Cn.getEntries(t))}addFieldIndex(e,t){return el.resolve()}deleteFieldIndex(e,t){return el.resolve()}deleteAllFieldIndexes(e){return el.resolve()}createTargetIndexes(e,t){return el.resolve()}getDocumentsMatchingTarget(e,t){return el.resolve(null)}getIndexType(e,t){return el.resolve(0)}getFieldIndexes(e,t){return el.resolve([])}getNextCollectionGroupToUpdate(e){return el.resolve(null)}getMinOffset(e,t){return el.resolve(Qc.min())}getMinOffsetFromCollectionGroup(e,t){return el.resolve(Qc.min())}updateCollectionGroup(e,t,n){return el.resolve()}updateIndexEntries(e,t){return el.resolve()}}class Fh{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new dl(Uc.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}has(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new dl(Uc.comparator)).toArray()}}const jh={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Vh=41943040;class Bh{static withCacheSize(e){return new Bh(e,Bh.DEFAULT_COLLECTION_PERCENTILE,Bh.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}}Bh.DEFAULT_COLLECTION_PERCENTILE=10,Bh.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Bh.DEFAULT=new Bh(Vh,Bh.DEFAULT_COLLECTION_PERCENTILE,Bh.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Bh.DISABLED=new Bh(-1,0,0);class zh{constructor(e){this.ar=e}next(){return this.ar+=2,this.ar}static ur(){return new zh(0)}static cr(){return new zh(-1)}}const qh="LruGarbageCollector";function Hh([e,t],[n,r]){const i=Rc(e,n);return 0===i?Rc(t,r):i}class Kh{constructor(e){this.Ir=e,this.buffer=new dl(Hh),this.Er=0}dr(){return++this.Er}Ar(e){const t=[e,this.dr()];if(this.buffer.size<this.Ir)this.buffer=this.buffer.add(t);else{const e=this.buffer.last();Hh(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}}class Wh{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.Rr=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.Vr(6e4)}stop(){this.Rr&&(this.Rr.cancel(),this.Rr=null)}get started(){return null!==this.Rr}Vr(e){cc(qh,`Garbage collection scheduled in ${e}ms`),this.Rr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){tl(e)?cc(qh,"Ignoring IndexedDB error during garbage collection: ",e):await Zc(e)}await this.Vr(3e5)})}}class Gh{constructor(e,t){this.mr=e,this.params=t}calculateTargetCount(e,t){return this.mr.gr(e).next(e=>Math.floor(t/100*e))}nthSequenceNumber(e,t){if(0===t)return el.resolve(nl.ce);const n=new Kh(t);return this.mr.forEachTarget(e,e=>n.Ar(e.sequenceNumber)).next(()=>this.mr.pr(e,e=>n.Ar(e))).next(()=>n.maxValue)}removeTargets(e,t,n){return this.mr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.mr.removeOrphanedDocuments(e,t)}collect(e,t){return-1===this.params.cacheSizeCollectionThreshold?(cc("LruGarbageCollector","Garbage collection skipped; disabled"),el.resolve(jh)):this.getCacheSize(e).next(n=>n<this.params.cacheSizeCollectionThreshold?(cc("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),jh):this.yr(e,t))}getCacheSize(e){return this.mr.getCacheSize(e)}yr(e,t){let n,r,i,s,o,a,c;const l=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(t=>(t>this.params.maximumSequenceNumbersToCollect?(cc("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),r=this.params.maximumSequenceNumbersToCollect):r=t,s=Date.now(),this.nthSequenceNumber(e,r))).next(r=>(n=r,o=Date.now(),this.removeTargets(e,n,t))).next(t=>(i=t,a=Date.now(),this.removeOrphanedDocuments(e,n))).next(e=>(c=Date.now(),ac()<=hr.DEBUG&&cc("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${s-l}ms\n\tDetermined least recently used ${r} in `+(o-s)+"ms\n"+`\tRemoved ${i} targets in `+(a-o)+"ms\n"+`\tRemoved ${e} documents in `+(c-a)+"ms\n"+`Total Duration: ${c-l}ms`),el.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:i,documentsRemoved:e})))}}class Xh{constructor(){this.changes=new Nu(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,Jl.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?el.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(){}}class Qh{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class Jh{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(r=>(n=r,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&uh(n.mutation,e,fl.empty(),Wc.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,qu()).next(()=>t))}getLocalViewOfDocuments(e,t,n=qu()){const r=Fu();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,n).next(e=>{let t=Uu();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){const n=Fu();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,qu()))}populateOverlays(e,t,n){const r=[];return n.forEach(e=>{t.has(e)||r.push(e)}),this.documentOverlayCache.getOverlays(e,r).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,r){let i=Lu();const s=Vu(),o=Vu();return t.forEach((e,t)=>{const o=n.get(t.key);r.has(t.key)&&(void 0===o||o.mutation instanceof fh)?i=i.insert(t.key,t):void 0!==o?(s.set(t.key,o.mutation.getFieldMask()),uh(o.mutation,t,o.mutation.getFieldMask(),Wc.now())):s.set(t.key,fl.empty())}),this.recalculateAndSaveOverlays(e,i).next(e=>(e.forEach((e,t)=>s.set(e,t)),t.forEach((e,t)=>o.set(e,new Qh(t,s.get(e)??null))),o))}recalculateAndSaveOverlays(e,t){const n=Vu();let r=new ll((e,t)=>e-t),i=qu();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(const i of e)i.keys().forEach(e=>{const s=t.get(e);if(null===s)return;let o=n.get(e)||fl.empty();o=i.applyToLocalView(s,o),n.set(e,o);const a=(r.get(i.batchId)||qu()).add(e);r=r.insert(i.batchId,a)})}).next(()=>{const s=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,l=ju();c.forEach(e=>{if(!i.has(e)){const r=ch(t.get(e),n.get(e));null!==r&&l.set(e,r),i=i.add(e)}}),s.push(this.documentOverlayCache.saveOverlays(e,a,l))}return el.waitFor(s)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,r){return function(e){return jc.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):function(e){return null!==e.collectionGroup}(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next(i=>{const s=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-i.size):el.resolve(Fu());let o=-1,a=i;return s.next(t=>el.forEach(t,(t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(t)?el.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{a=a.insert(t,e)}))).next(()=>this.populateOverlays(e,t,i)).next(()=>this.computeViews(e,a,t,qu())).next(e=>({batchId:o,changes:$u(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new jc(t)).next(e=>{let t=Uu();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){const i=t.collectionGroup;let s=Uu();return this.indexManager.getCollectionParents(e,i).next(o=>el.forEach(o,o=>{const a=function(e,t){return new Tu(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(i));return this.getDocumentsMatchingCollectionQuery(e,a,n,r).next(e=>{e.forEach((e,t)=>{s=s.insert(e,t)})})}).next(()=>s))}getDocumentsMatchingCollectionQuery(e,t,n,r){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(s=>(i=s,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r))).next(e=>{i.forEach((t,n)=>{const r=n.getKey();null===e.get(r)&&(e=e.insert(r,Jl.newInvalidDocument(r)))});let n=Uu();return e.forEach((e,r)=>{const s=i.get(e);void 0!==s&&uh(s.mutation,r,fl.empty(),Wc.now()),Pu(t,r)&&(n=n.insert(e,r))}),n})}}class Yh{constructor(e){this.serializer=e,this.Lr=new Map,this.kr=new Map}getBundleMetadata(e,t){return el.resolve(this.Lr.get(t))}saveBundleMetadata(e,t){return this.Lr.set(t.id,function(e){return{id:e.id,version:e.version,createTime:kh(e.createTime)}}(t)),el.resolve()}getNamedQuery(e,t){return el.resolve(this.kr.get(t))}saveNamedQuery(e,t){return this.kr.set(t.name,function(e){return{name:e.name,query:Uh(e.bundledQuery),readTime:kh(e.readTime)}}(t)),el.resolve()}}class Zh{constructor(){this.overlays=new ll(jc.comparator),this.qr=new Map}getOverlay(e,t){return el.resolve(this.overlays.get(t))}getOverlays(e,t){const n=Fu();return el.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,r)=>{this.St(e,t,r)}),el.resolve()}removeOverlaysForBatchId(e,t,n){const r=this.qr.get(n);return void 0!==r&&(r.forEach(e=>this.overlays=this.overlays.remove(e)),this.qr.delete(n)),el.resolve()}getOverlaysForCollection(e,t,n){const r=Fu(),i=t.length+1,s=new jc(t.child("")),o=this.overlays.getIteratorFrom(s);for(;o.hasNext();){const e=o.getNext().value,s=e.getKey();if(!t.isPrefixOf(s.path))break;s.path.length===i&&e.largestBatchId>n&&r.set(e.getKey(),e)}return el.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let i=new ll((e,t)=>e-t);const s=this.overlays.getIterator();for(;s.hasNext();){const e=s.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);null===t&&(t=Fu(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const o=Fu(),a=i.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach((e,t)=>o.set(e,t)),!(o.size()>=r)););return el.resolve(o)}St(e,t,n){const r=this.overlays.get(n.key);if(null!==r){const e=this.qr.get(r.largestBatchId).delete(n.key);this.qr.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new Eh(t,n));let i=this.qr.get(t);void 0===i&&(i=qu(),this.qr.set(t,i)),this.qr.set(t,i.add(n.key))}}class ed{constructor(){this.sessionToken=ml.EMPTY_BYTE_STRING}getSessionToken(e){return el.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,el.resolve()}}class td{constructor(){this.Qr=new dl(nd.$r),this.Ur=new dl(nd.Kr)}isEmpty(){return this.Qr.isEmpty()}addReference(e,t){const n=new nd(e,t);this.Qr=this.Qr.add(n),this.Ur=this.Ur.add(n)}Wr(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.Gr(new nd(e,t))}zr(e,t){e.forEach(e=>this.removeReference(e,t))}jr(e){const t=new jc(new Uc([])),n=new nd(t,e),r=new nd(t,e+1),i=[];return this.Ur.forEachInRange([n,r],e=>{this.Gr(e),i.push(e.key)}),i}Jr(){this.Qr.forEach(e=>this.Gr(e))}Gr(e){this.Qr=this.Qr.delete(e),this.Ur=this.Ur.delete(e)}Hr(e){const t=new jc(new Uc([])),n=new nd(t,e),r=new nd(t,e+1);let i=qu();return this.Ur.forEachInRange([n,r],e=>{i=i.add(e.key)}),i}containsKey(e){const t=new nd(e,0),n=this.Qr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class nd{constructor(e,t){this.key=e,this.Yr=t}static $r(e,t){return jc.comparator(e.key,t.key)||Rc(e.Yr,t.Yr)}static Kr(e,t){return Rc(e.Yr,t.Yr)||jc.comparator(e.key,t.key)}}class rd{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.tr=1,this.Zr=new dl(nd.$r)}checkEmpty(e){return el.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,r){const i=this.tr;this.tr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const s=new vh(i,t,n,r);this.mutationQueue.push(s);for(const t of r)this.Zr=this.Zr.add(new nd(t.key,i)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return el.resolve(s)}lookupMutationBatch(e,t){return el.resolve(this.Xr(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,r=this.ei(n),i=r<0?0:r;return el.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return el.resolve(0===this.mutationQueue.length?-1:this.tr-1)}getAllMutationBatches(e){return el.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new nd(t,0),r=new nd(t,Number.POSITIVE_INFINITY),i=[];return this.Zr.forEachInRange([n,r],e=>{const t=this.Xr(e.Yr);i.push(t)}),el.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new dl(Rc);return t.forEach(e=>{const t=new nd(e,0),r=new nd(e,Number.POSITIVE_INFINITY);this.Zr.forEachInRange([t,r],e=>{n=n.add(e.Yr)})}),el.resolve(this.ti(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,r=n.length+1;let i=n;jc.isDocumentKey(i)||(i=i.child(""));const s=new nd(new jc(i),0);let o=new dl(Rc);return this.Zr.forEachWhile(e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(o=o.add(e.Yr)),!0)},s),el.resolve(this.ti(o))}ti(e){const t=[];return e.forEach(e=>{const n=this.Xr(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){fc(0===this.ni(t.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.Zr;return el.forEach(t.mutations,r=>{const i=new nd(r.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)}).next(()=>{this.Zr=n})}ir(e){}containsKey(e,t){const n=new nd(t,0),r=this.Zr.firstAfterOrEqual(n);return el.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,el.resolve()}ni(e,t){return this.ei(e)}ei(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Xr(e){const t=this.ei(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class id{constructor(e){this.ri=e,this.docs=new ll(jc.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,r=this.docs.get(n),i=r?r.size:0,s=this.ri(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:s}),this.size+=s-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return el.resolve(n?n.document.mutableCopy():Jl.newInvalidDocument(t))}getEntries(e,t){let n=Lu();return t.forEach(e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():Jl.newInvalidDocument(e))}),el.resolve(n)}getDocumentsMatchingQuery(e,t,n,r){let i=Lu();const s=t.path,o=new jc(s.child("__id-9223372036854775808__")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){const{key:e,value:{document:o}}=a.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||Jc(Xc(o),n)<=0||(r.has(o.key)||Pu(t,o))&&(i=i.insert(o.key,o.mutableCopy()))}return el.resolve(i)}getAllFromCollectionGroup(e,t,n,r){dc(9500)}ii(e,t){return el.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new sd(this)}getSize(e){return el.resolve(this.size)}}class sd extends Xh{constructor(e){super(),this.Nr=e}applyChanges(e){const t=[];return this.changes.forEach((n,r)=>{r.isValidDocument()?t.push(this.Nr.addEntry(e,r)):this.Nr.removeEntry(n)}),el.waitFor(t)}getFromCache(e,t){return this.Nr.getEntry(e,t)}getAllFromCache(e,t){return this.Nr.getEntries(e,t)}}class od{constructor(e){this.persistence=e,this.si=new Nu(e=>bu(e),Eu),this.lastRemoteSnapshotVersion=Gc.min(),this.highestTargetId=0,this.oi=0,this._i=new td,this.targetCount=0,this.ai=zh.ur()}forEachTarget(e,t){return this.si.forEach((e,n)=>t(n)),el.resolve()}getLastRemoteSnapshotVersion(e){return el.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return el.resolve(this.oi)}allocateTargetId(e){return this.highestTargetId=this.ai.next(),el.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.oi&&(this.oi=t),el.resolve()}Pr(e){this.si.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.ai=new zh(t),this.highestTargetId=t),e.sequenceNumber>this.oi&&(this.oi=e.sequenceNumber)}addTargetData(e,t){return this.Pr(t),this.targetCount+=1,el.resolve()}updateTargetData(e,t){return this.Pr(t),el.resolve()}removeTargetData(e,t){return this.si.delete(t.target),this._i.jr(t.targetId),this.targetCount-=1,el.resolve()}removeTargets(e,t,n){let r=0;const i=[];return this.si.forEach((s,o)=>{o.sequenceNumber<=t&&null===n.get(o.targetId)&&(this.si.delete(s),i.push(this.removeMatchingKeysForTargetId(e,o.targetId)),r++)}),el.waitFor(i).next(()=>r)}getTargetCount(e){return el.resolve(this.targetCount)}getTargetData(e,t){const n=this.si.get(t)||null;return el.resolve(n)}addMatchingKeys(e,t,n){return this._i.Wr(t,n),el.resolve()}removeMatchingKeys(e,t,n){this._i.zr(t,n);const r=this.persistence.referenceDelegate,i=[];return r&&t.forEach(t=>{i.push(r.markPotentiallyOrphaned(e,t))}),el.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this._i.jr(t),el.resolve()}getMatchingKeysForTargetId(e,t){const n=this._i.Hr(t);return el.resolve(n)}containsKey(e,t){return el.resolve(this._i.containsKey(t))}}class ad{constructor(e,t){this.ui={},this.overlays={},this.ci=new nl(0),this.li=!1,this.li=!0,this.hi=new ed,this.referenceDelegate=e(this),this.Pi=new od(this),this.indexManager=new $h,this.remoteDocumentCache=function(e){return new id(e)}(e=>this.referenceDelegate.Ti(e)),this.serializer=new Mh(t),this.Ii=new Yh(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.li=!1,Promise.resolve()}get started(){return this.li}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Zh,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.ui[e.toKey()];return n||(n=new rd(t,this.referenceDelegate),this.ui[e.toKey()]=n),n}getGlobalsCache(){return this.hi}getTargetCache(){return this.Pi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ii}runTransaction(e,t,n){cc("MemoryPersistence","Starting transaction:",e);const r=new cd(this.ci.next());return this.referenceDelegate.Ei(),n(r).next(e=>this.referenceDelegate.di(r).next(()=>e)).toPromise().then(e=>(r.raiseOnCommittedEvent(),e))}Ai(e,t){return el.or(Object.values(this.ui).map(n=>()=>n.containsKey(e,t)))}}class cd extends Yc{constructor(e){super(),this.currentSequenceNumber=e}}class ld{constructor(e){this.persistence=e,this.Ri=new td,this.Vi=null}static mi(e){return new ld(e)}get fi(){if(this.Vi)return this.Vi;throw dc(60996)}addReference(e,t,n){return this.Ri.addReference(n,t),this.fi.delete(n.toString()),el.resolve()}removeReference(e,t,n){return this.Ri.removeReference(n,t),this.fi.add(n.toString()),el.resolve()}markPotentiallyOrphaned(e,t){return this.fi.add(t.toString()),el.resolve()}removeTarget(e,t){this.Ri.jr(t.targetId).forEach(e=>this.fi.add(e.toString()));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.fi.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}Ei(){this.Vi=new Set}di(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return el.forEach(this.fi,n=>{const r=jc.fromPath(n);return this.gi(e,r).next(e=>{e||t.removeEntry(r,Gc.min())})}).next(()=>(this.Vi=null,t.apply(e)))}updateLimboDocument(e,t){return this.gi(e,t).next(e=>{e?this.fi.delete(t.toString()):this.fi.add(t.toString())})}Ti(e){return 0}gi(e,t){return el.or([()=>el.resolve(this.Ri.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ai(e,t)])}}class ud{constructor(e,t){this.persistence=e,this.pi=new Nu(e=>function(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t=ol(t)),t=sl(e.get(n),t);return ol(t)}(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=function(e,t){return new Gh(e,t)}(this,t)}static mi(e,t){return new ud(e,t)}Ei(){}di(e){return el.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}gr(e){const t=this.wr(e);return this.persistence.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}wr(e){let t=0;return this.pr(e,e=>{t++}).next(()=>t)}pr(e,t){return el.forEach(this.pi,(n,r)=>this.br(e,n,r).next(e=>e?el.resolve():t(r)))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0;const r=this.persistence.getRemoteDocumentCache(),i=r.newChangeBuffer();return r.ii(e,r=>this.br(e,r,t).next(e=>{e||(n++,i.removeEntry(r,Gc.min()))})).next(()=>i.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.pi.set(t,e.currentSequenceNumber),el.resolve()}removeTarget(e,t){const n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.pi.set(n,e.currentSequenceNumber),el.resolve()}removeReference(e,t,n){return this.pi.set(n,e.currentSequenceNumber),el.resolve()}updateLimboDocument(e,t){return this.pi.set(t,e.currentSequenceNumber),el.resolve()}Ti(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=ql(e.data.value)),t}br(e,t,n){return el.or([()=>this.persistence.Ai(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const e=this.pi.get(t);return el.resolve(void 0!==e&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}class hd{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.Es=n,this.ds=r}static As(e,t){let n=qu(),r=qu();for(const e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:r=r.add(e.doc.key)}return new hd(e,t.fromCache,n,r)}}class dd{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class pd{constructor(){this.Rs=!1,this.Vs=!1,this.fs=100,this.gs=Hn()?8:function(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}(zn())>0?6:4}initialize(e,t){this.ps=e,this.indexManager=t,this.Rs=!0}getDocumentsMatchingQuery(e,t,n,r){const i={result:null};return this.ys(e,t).next(e=>{i.result=e}).next(()=>{if(!i.result)return this.ws(e,t,r,n).next(e=>{i.result=e})}).next(()=>{if(i.result)return;const n=new dd;return this.Ss(e,t,n).next(r=>{if(i.result=r,this.Vs)return this.bs(e,t,n,r.size)})}).next(()=>i.result)}bs(e,t,n,r){return n.documentReadCount<this.fs?(ac()<=hr.DEBUG&&cc("QueryEngine","SDK will not create cache indexes for query:",Ou(t),"since it only creates cache indexes for collection contains","more than or equal to",this.fs,"documents"),el.resolve()):(ac()<=hr.DEBUG&&cc("QueryEngine","Query:",Ou(t),"scans",n.documentReadCount,"local documents and returns",r,"documents as results."),n.documentReadCount>this.gs*r?(ac()<=hr.DEBUG&&cc("QueryEngine","The SDK decides to create cache indexes for query:",Ou(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Cu(t))):el.resolve())}ys(e,t){if(Iu(t))return el.resolve(null);let n=Cu(t);return this.indexManager.getIndexType(e,n).next(r=>0===r?null:(null!==t.limit&&1===r&&(t=ku(t,null,"F"),n=Cu(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next(r=>{const i=qu(...r);return this.ps.getDocuments(e,i).next(r=>this.indexManager.getMinOffset(e,n).next(n=>{const s=this.Ds(t,r);return this.Cs(t,s,i,n.readTime)?this.ys(e,ku(t,null,"F")):this.vs(e,s,t,n)}))})))}ws(e,t,n,r){return Iu(t)||r.isEqual(Gc.min())?el.resolve(null):this.ps.getDocuments(e,n).next(i=>{const s=this.Ds(t,i);return this.Cs(t,s,n,r)?el.resolve(null):(ac()<=hr.DEBUG&&cc("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Ou(t)),this.vs(e,s,t,function(e,t){const n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,i=Gc.fromTimestamp(1e9===r?new Wc(n+1,0):new Wc(n,r));return new Qc(i,jc.empty(),t)}(r,-1)).next(e=>e))})}Ds(e,t){let n=new dl(function(e){return(t,n)=>{let r=!1;for(const i of Su(e)){const e=xu(i,t,n);if(0!==e)return e;r=r||i.field.isKeyField()}return 0}}(e));return t.forEach((t,r)=>{Pu(e,r)&&(n=n.add(r))}),n}Cs(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}Ss(e,t,n){return ac()<=hr.DEBUG&&cc("QueryEngine","Using full collection scan to execute query:",Ou(t)),this.ps.getDocumentsMatchingQuery(e,t,Qc.min(),n)}vs(e,t,n,r){return this.ps.getDocumentsMatchingQuery(e,n,r).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}class fd{constructor(e,t,n,r){this.persistence=e,this.Fs=t,this.serializer=r,this.Ms=new ll(Rc),this.xs=new Nu(e=>bu(e),Eu),this.Os=new Map,this.Ns=e.getRemoteDocumentCache(),this.Pi=e.getTargetCache(),this.Ii=e.getBundleCache(),this.Bs(n)}Bs(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Jh(this.Ns,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Ns.setIndexManager(this.indexManager),this.Fs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Ms))}}async function gd(e,t){const n=gc(e);return await n.persistence.runTransaction("Handle user change","readonly",e=>{let r;return n.mutationQueue.getAllMutationBatches(e).next(i=>(r=i,n.Bs(t),n.mutationQueue.getAllMutationBatches(e))).next(t=>{const i=[],s=[];let o=qu();for(const e of r){i.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}for(const e of t){s.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next(e=>({Ls:e,removedBatchIds:i,addedBatchIds:s}))})})}function md(e,t){const n=gc(e);return n.persistence.runTransaction("Get next mutation batch","readonly",e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)))}class yd{constructor(){this.activeTargetIds=Hu}zs(e){this.activeTargetIds=this.activeTargetIds.add(e)}js(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Gs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class _d{constructor(){this.Mo=new yd,this.xo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Mo.zs(e),this.xo[e]||"not-current"}updateQueryState(e,t,n){this.xo[e]=t}removeLocalQueryTarget(e){this.Mo.js(e)}isLocalQueryTarget(e){return this.Mo.activeTargetIds.has(e)}clearQueryState(e){delete this.xo[e]}getAllActiveQueryTargets(){return this.Mo.activeTargetIds}isActiveQueryTarget(e){return this.Mo.activeTargetIds.has(e)}start(){return this.Mo=new yd,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class wd{Oo(e){}shutdown(){}}const vd="ConnectivityMonitor";class bd{constructor(){this.No=()=>this.Bo(),this.Lo=()=>this.ko(),this.qo=[],this.Qo()}Oo(e){this.qo.push(e)}shutdown(){window.removeEventListener("online",this.No),window.removeEventListener("offline",this.Lo)}Qo(){window.addEventListener("online",this.No),window.addEventListener("offline",this.Lo)}Bo(){cc(vd,"Network connectivity changed: AVAILABLE");for(const e of this.qo)e(0)}ko(){cc(vd,"Network connectivity changed: UNAVAILABLE");for(const e of this.qo)e(1)}static v(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let Ed=null;function Td(){return null===Ed?Ed=268435456+Math.round(2147483648*Math.random()):Ed++,"0x"+Ed.toString(16)}const Id="RestConnection",Sd={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class Cd{get $o(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.Uo=t+"://"+e.host,this.Ko=`projects/${n}/databases/${r}`,this.Wo=this.databaseId.database===Rl?`project_id=${n}`:`project_id=${n}&database_id=${r}`}Go(e,t,n,r,i){const s=Td(),o=this.zo(e,t.toUriEncodedString());cc(Id,`Sending RPC '${e}' ${s}:`,o,n);const a={"google-cloud-resource-prefix":this.Ko,"x-goog-request-params":this.Wo};this.jo(a,r,i);const{host:c}=new URL(o),l=Un(c);return this.Jo(e,o,a,n,l).then(t=>(cc(Id,`Received RPC '${e}' ${s}: `,t),t),t=>{throw uc(Id,`RPC '${e}' ${s} failed with error: `,t,"url: ",o,"request:",n),t})}Ho(e,t,n,r,i,s){return this.Go(e,t,n,r,i)}jo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+sc,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)}zo(e,t){const n=Sd[e];return`${this.Uo}/v1/${t}:${n}`}terminate(){}}class kd{constructor(e){this.Yo=e.Yo,this.Zo=e.Zo}Xo(e){this.e_=e}t_(e){this.n_=e}r_(e){this.i_=e}onMessage(e){this.s_=e}close(){this.Zo()}send(e){this.Yo(e)}o_(){this.e_()}__(){this.n_()}a_(e){this.i_(e)}u_(e){this.s_(e)}}const Ad="WebChannelConnection";class Rd extends Cd{constructor(e){super(e),this.c_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Jo(e,t,n,r,i){const s=Td();return new Promise((i,o)=>{const a=new Wa;a.setWithCredentials(!0),a.listenOnce(Xa.COMPLETE,()=>{try{switch(a.getLastErrorCode()){case Qa.NO_ERROR:const t=a.getResponseJson();cc(Ad,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(t)),i(t);break;case Qa.TIMEOUT:cc(Ad,`RPC '${e}' ${s} timed out`),o(new yc(mc.DEADLINE_EXCEEDED,"Request time out"));break;case Qa.HTTP_ERROR:const n=a.getStatus();if(cc(Ad,`RPC '${e}' ${s} failed with status:`,n,"response text:",a.getResponseText()),n>0){let e=a.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=e?.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(mc).indexOf(t)>=0?t:mc.UNKNOWN}(t.status);o(new yc(e,t.message))}else o(new yc(mc.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new yc(mc.UNAVAILABLE,"Connection failed."));break;default:dc(9055,{l_:e,streamId:s,h_:a.getLastErrorCode(),P_:a.getLastError()})}}finally{cc(Ad,`RPC '${e}' ${s} completed.`)}});const c=JSON.stringify(r);cc(Ad,`RPC '${e}' ${s} sending request:`,r),a.send(t,"POST",c,n,15)})}T_(e,t,n){const r=Td(),i=[this.Uo,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=ec(),o=Za(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;void 0!==c&&(a.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(a.useFetchStreams=!0),this.jo(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const l=i.join("");cc(Ad,`Creating RPC '${e}' stream ${r}: ${l}`,a);const u=s.createWebChannel(l,a);this.I_(u);let h=!1,d=!1;const p=new kd({Yo:t=>{d?cc(Ad,`Not sending because RPC '${e}' stream ${r} is closed:`,t):(h||(cc(Ad,`Opening RPC '${e}' stream ${r} transport.`),u.open(),h=!0),cc(Ad,`RPC '${e}' stream ${r} sending:`,t),u.send(t))},Zo:()=>u.close()}),f=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};return f(u,Ga.EventType.OPEN,()=>{d||(cc(Ad,`RPC '${e}' stream ${r} transport opened.`),p.o_())}),f(u,Ga.EventType.CLOSE,()=>{d||(d=!0,cc(Ad,`RPC '${e}' stream ${r} transport closed`),p.a_(),this.E_(u))}),f(u,Ga.EventType.ERROR,t=>{d||(d=!0,uc(Ad,`RPC '${e}' stream ${r} transport errored. Name:`,t.name,"Message:",t.message),p.a_(new yc(mc.UNAVAILABLE,"The operation could not be completed")))}),f(u,Ga.EventType.MESSAGE,t=>{if(!d){const n=t.data[0];fc(!!n,16349);const i=n,s=i?.error||i[0]?.error;if(s){cc(Ad,`RPC '${e}' stream ${r} received error:`,s);const t=s.status;let n=function(e){const t=Th[e];if(void 0!==t)return function(e){if(void 0===e)return lc("GRPC error has no .code"),mc.UNKNOWN;switch(e){case Th.OK:return mc.OK;case Th.CANCELLED:return mc.CANCELLED;case Th.UNKNOWN:return mc.UNKNOWN;case Th.DEADLINE_EXCEEDED:return mc.DEADLINE_EXCEEDED;case Th.RESOURCE_EXHAUSTED:return mc.RESOURCE_EXHAUSTED;case Th.INTERNAL:return mc.INTERNAL;case Th.UNAVAILABLE:return mc.UNAVAILABLE;case Th.UNAUTHENTICATED:return mc.UNAUTHENTICATED;case Th.INVALID_ARGUMENT:return mc.INVALID_ARGUMENT;case Th.NOT_FOUND:return mc.NOT_FOUND;case Th.ALREADY_EXISTS:return mc.ALREADY_EXISTS;case Th.PERMISSION_DENIED:return mc.PERMISSION_DENIED;case Th.FAILED_PRECONDITION:return mc.FAILED_PRECONDITION;case Th.ABORTED:return mc.ABORTED;case Th.OUT_OF_RANGE:return mc.OUT_OF_RANGE;case Th.UNIMPLEMENTED:return mc.UNIMPLEMENTED;case Th.DATA_LOSS:return mc.DATA_LOSS;default:return dc(39323,{code:e})}}(t)}(t),i=s.message;void 0===n&&(n=mc.INTERNAL,i="Unknown error status: "+t+" with message "+s.message),d=!0,p.a_(new yc(n,i)),u.close()}else cc(Ad,`RPC '${e}' stream ${r} received:`,n),p.u_(n)}}),f(o,Ya.STAT_EVENT,t=>{t.stat===Ja.PROXY?cc(Ad,`RPC '${e}' stream ${r} detected buffering proxy`):t.stat===Ja.NOPROXY&&cc(Ad,`RPC '${e}' stream ${r} detected no buffering proxy`)}),setTimeout(()=>{p.__()},0),p}terminate(){this.c_.forEach(e=>e.close()),this.c_=[]}I_(e){this.c_.push(e)}E_(e){this.c_=this.c_.filter(t=>t===e)}}function Od(){return"undefined"!=typeof document?document:null}function Pd(e){return new Sh(e,!0)}class xd{constructor(e,t,n=1e3,r=1.5,i=6e4){this.Mi=e,this.timerId=t,this.d_=n,this.A_=r,this.R_=i,this.V_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.V_=0}g_(){this.V_=this.R_}p_(e){this.cancel();const t=Math.floor(this.V_+this.y_()),n=Math.max(0,Date.now()-this.f_),r=Math.max(0,t-n);r>0&&cc("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.V_} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.m_=this.Mi.enqueueAfterDelay(this.timerId,r,()=>(this.f_=Date.now(),e())),this.V_*=this.A_,this.V_<this.d_&&(this.V_=this.d_),this.V_>this.R_&&(this.V_=this.R_)}w_(){null!==this.m_&&(this.m_.skipDelay(),this.m_=null)}cancel(){null!==this.m_&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.V_}}const Nd="PersistentStream";class Dd{constructor(e,t,n,r,i,s,o,a){this.Mi=e,this.S_=n,this.b_=r,this.connection=i,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new xd(e,t)}x_(){return 1===this.state||5===this.state||this.O_()}O_(){return 2===this.state||3===this.state}start(){this.F_=0,4!==this.state?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&null===this.C_&&(this.C_=this.Mi.enqueueAfterDelay(this.S_,6e4,()=>this.k_()))}q_(e){this.Q_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}Q_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,t){this.Q_(),this.U_(),this.M_.cancel(),this.D_++,4!==e?this.M_.reset():t&&t.code===mc.RESOURCE_EXHAUSTED?(lc(t.toString()),lc("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):t&&t.code===mc.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.K_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.r_(t)}K_(){}auth(){this.state=1;const e=this.W_(this.D_),t=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.D_===t&&this.G_(e,n)},t=>{e(()=>{const e=new yc(mc.UNKNOWN,"Fetching auth token failed: "+t.message);return this.z_(e)})})}G_(e,t){const n=this.W_(this.D_);this.stream=this.j_(e,t),this.stream.Xo(()=>{n(()=>this.listener.Xo())}),this.stream.t_(()=>{n(()=>(this.state=2,this.v_=this.Mi.enqueueAfterDelay(this.b_,1e4,()=>(this.O_()&&(this.state=3),Promise.resolve())),this.listener.t_()))}),this.stream.r_(e=>{n(()=>this.z_(e))}),this.stream.onMessage(e=>{n(()=>1==++this.F_?this.J_(e):this.onNext(e))})}N_(){this.state=5,this.M_.p_(async()=>{this.state=0,this.start()})}z_(e){return cc(Nd,`close with error: ${e}`),this.stream=null,this.close(4,e)}W_(e){return t=>{this.Mi.enqueueAndForget(()=>this.D_===e?t():(cc(Nd,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class Ld extends Dd{constructor(e,t,n,r,i,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,r,s),this.serializer=i}get X_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}K_(){this.X_&&this.ea([])}j_(e,t){return this.connection.T_("Write",e,t)}J_(e){return fc(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,fc(!e.writeResults||0===e.writeResults.length,55816),this.listener.ta()}onNext(e){fc(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const t=function(e,t){return e&&e.length>0?(fc(void 0!==t,14353),e.map(e=>function(e,t){let n=e.updateTime?kh(e.updateTime):kh(t);return n.isEqual(Gc.min())&&(n=kh(t)),new ih(n,e.transformResults||[])}(e,t))):[]}(e.writeResults,e.commitTime),n=kh(e.commitTime);return this.listener.na(n,t)}ra(){const e={};e.database=function(e){return new Uc(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}(this.serializer),this.q_(e)}ea(e){const t={streamToken:this.lastStreamToken,writes:e.map(e=>function(e,t){let n;if(t instanceof ph)n={update:Ph(e,t.key,t.value)};else if(t instanceof _h)n={delete:Rh(e,t.key)};else if(t instanceof fh)n={update:Ph(e,t.key,t.data),updateMask:Lh(t.fieldMask)};else{if(!(t instanceof wh))return dc(16599,{Vt:t.type});n={verify:Rh(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(e=>function(e,t){const n=t.transform;if(n instanceof Qu)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Ju)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Zu)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof th)return{fieldPath:t.field.canonicalString(),increment:n.Ae};throw dc(20930,{transform:t.transform})}(0,e))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:Ch(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:dc(27497)}(e,t.precondition)),n}(this.serializer,e))};this.q_(t)}}class Md{}class Ud extends Md{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.ia=!1}sa(){if(this.ia)throw new yc(mc.FAILED_PRECONDITION,"The client has already been terminated.")}Go(e,t,n,r){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,s])=>this.connection.Go(e,Ah(t,n),r,i,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===mc.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new yc(mc.UNKNOWN,e.toString())})}Ho(e,t,n,r,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Ho(e,Ah(t,n),r,s,o,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===mc.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new yc(mc.UNKNOWN,e.toString())})}terminate(){this.ia=!0,this.connection.terminate()}}class $d{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){0===this.oa&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve())))}ha(e){"Online"===this.state?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,"Online"===e&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){const t=`Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(lc(t),this.aa=!1):cc("OnlineStateTracker",t)}Pa(){null!==this._a&&(this._a.cancel(),this._a=null)}}const Fd="RemoteStore";class jd{constructor(e,t,n,r,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Set,this.da=[],this.Aa=i,this.Aa.Oo(e=>{n.enqueueAndForget(async()=>{zd(this)&&(cc(Fd,"Restarting streams for network reachability change."),await async function(e){const t=gc(e);t.Ea.add(4),await Bd(t),t.Ra.set("Unknown"),t.Ea.delete(4),await Vd(t)}(this))})}),this.Ra=new $d(n,r)}}async function Vd(e){if(zd(e))for(const t of e.da)await t(!0)}async function Bd(e){for(const t of e.da)await t(!1)}function zd(e){return 0===gc(e).Ea.size}async function qd(e,t,n){if(!tl(t))throw t;e.Ea.add(1),await Bd(e),e.Ra.set("Offline"),n||(n=()=>function(e){const t=gc(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",e=>t.Pi.getLastRemoteSnapshotVersion(e))}(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{cc(Fd,"Retrying IndexedDB access"),await n(),e.Ea.delete(1),await Vd(e)})}function Hd(e,t){return t().catch(n=>qd(e,n,t))}async function Kd(e){const t=gc(e),n=np(t);let r=t.Ta.length>0?t.Ta[t.Ta.length-1].batchId:-1;for(;Wd(t);)try{const e=await md(t.localStore,r);if(null===e){0===t.Ta.length&&n.L_();break}r=e.batchId,Gd(t,e)}catch(e){await qd(t,e)}Xd(t)&&Qd(t)}function Wd(e){return zd(e)&&e.Ta.length<10}function Gd(e,t){e.Ta.push(t);const n=np(e);n.O_()&&n.X_&&n.ea(t.mutations)}function Xd(e){return zd(e)&&!np(e).x_()&&e.Ta.length>0}function Qd(e){np(e).start()}async function Jd(e){np(e).ra()}async function Yd(e){const t=np(e);for(const n of e.Ta)t.ea(n.mutations)}async function Zd(e,t,n){const r=e.Ta.shift(),i=bh.from(r,t,n);await Hd(e,()=>e.remoteSyncer.applySuccessfulWrite(i)),await Kd(e)}async function ep(e,t){t&&np(e).X_&&await async function(e,t){if(function(e){return function(e){switch(e){case mc.OK:return dc(64938);case mc.CANCELLED:case mc.UNKNOWN:case mc.DEADLINE_EXCEEDED:case mc.RESOURCE_EXHAUSTED:case mc.INTERNAL:case mc.UNAVAILABLE:case mc.UNAUTHENTICATED:return!1;case mc.INVALID_ARGUMENT:case mc.NOT_FOUND:case mc.ALREADY_EXISTS:case mc.PERMISSION_DENIED:case mc.FAILED_PRECONDITION:case mc.ABORTED:case mc.OUT_OF_RANGE:case mc.UNIMPLEMENTED:case mc.DATA_LOSS:return!0;default:return dc(15467,{code:e})}}(e)&&e!==mc.ABORTED}(t.code)){const n=e.Ta.shift();np(e).B_(),await Hd(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await Kd(e)}}(e,t),Xd(e)&&Qd(e)}async function tp(e,t){const n=gc(e);n.asyncQueue.verifyOperationInProgress(),cc(Fd,"RemoteStore received new credentials");const r=zd(n);n.Ea.add(3),await Bd(n),r&&n.Ra.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.Ea.delete(3),await Vd(n)}function np(e){return e.fa||(e.fa=function(e,t,n){const r=gc(e);return r.sa(),new Ld(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Xo:()=>Promise.resolve(),t_:Jd.bind(null,e),r_:ep.bind(null,e),ta:Yd.bind(null,e),na:Zd.bind(null,e)}),e.da.push(async t=>{t?(e.fa.B_(),await Kd(e)):(await e.fa.stop(),e.Ta.length>0&&(cc(Fd,`Stopping write stream with ${e.Ta.length} pending writes`),e.Ta=[]))})),e.fa}class rp{constructor(e,t,n,r,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new _c,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,r,i){const s=Date.now()+n,o=new rp(e,t,s,r,i);return o.start(n),o}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new yc(mc.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 ip(e,t){if(lc("AsyncQueue",`${t}: ${e}`),tl(e))return new yc(mc.UNAVAILABLE,`${t}: ${e}`);throw e}class sp{constructor(){this.queries=op(),this.onlineState="Unknown",this.Ca=new Set}terminate(){!function(e,t){const n=gc(e),r=n.queries;n.queries=op(),r.forEach((e,n)=>{for(const e of n.Sa)e.onError(t)})}(this,new yc(mc.ABORTED,"Firestore shutting down"))}}function op(){return new Nu(e=>Ru(e),Au)}var ap,cp;(cp=ap||(ap={})).Ma="default",cp.Cache="cache";class lp{constructor(e,t,n,r,i,s){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.Pu={},this.Tu=new Nu(e=>Ru(e),Au),this.Iu=new Map,this.Eu=new Set,this.du=new ll(jc.comparator),this.Au=new Map,this.Ru=new td,this.Vu={},this.mu=new Map,this.fu=zh.cr(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return!0===this.gu}}async function up(e,t,n){const r=function(e){const t=gc(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=dp.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=pp.bind(null,t),t}(e);try{const e=await function(e,t){const n=gc(e),r=Wc.now(),i=t.reduce((e,t)=>e.add(t.key),qu());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",e=>{let a=Lu(),c=qu();return n.Ns.getEntries(e,i).next(e=>{a=e,a.forEach((e,t)=>{t.isValidDocument()||(c=c.add(e))})}).next(()=>n.localDocuments.getOverlayedDocuments(e,a)).next(i=>{s=i;const o=[];for(const e of t){const t=hh(e,s.get(e.key).overlayedDocument);null!=t&&o.push(new fh(e.key,t,Ql(t.value.mapValue),sh.exists(!0)))}return n.mutationQueue.addMutationBatch(e,r,o,t)}).next(t=>{o=t;const r=t.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)})}).then(()=>({batchId:o.batchId,changes:$u(s)}))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.Vu[e.currentUser.toKey()];r||(r=new ll(Rc)),r=r.insert(t,n),e.Vu[e.currentUser.toKey()]=r}(r,e.batchId,n),await mp(r,e.changes),await Kd(r.remoteStore)}catch(e){const t=ip(e,"Failed to persist write");n.reject(t)}}function hp(e,t,n){const r=gc(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const e=[];r.Tu.forEach((n,r)=>{const i=r.view.va(t);i.snapshot&&e.push(i.snapshot)}),function(e,t){const n=gc(e);n.onlineState=t;let r=!1;n.queries.forEach((e,n)=>{for(const e of n.Sa)e.va(t)&&(r=!0)}),r&&function(e){e.Ca.forEach(e=>{e.next()})}(n)}(r.eventManager,t),e.length&&r.Pu.H_(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function dp(e,t){const n=gc(e),r=t.batch.batchId;try{const e=await function(e,t){const n=gc(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{const r=t.batch.keys(),i=n.Ns.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){const i=n.batch,s=i.keys();let o=el.resolve();return s.forEach(e=>{o=o.next(()=>r.getEntry(t,e)).next(t=>{const s=n.docVersions.get(e);fc(null!==s,48541),t.version.compareTo(s)<0&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))})}),o.next(()=>e.mutationQueue.removeMutationBatch(t,i))}(n,e,t,i).next(()=>i.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=qu();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,r))})}(n.localStore,t);gp(n,r,null),fp(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await mp(n,e)}catch(e){await Zc(e)}}async function pp(e,t,n){const r=gc(e);try{const e=await function(e,t){const n=gc(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let r;return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(fc(null!==t,37113),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t))).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r)).next(()=>n.localDocuments.getDocuments(e,r))})}(r.localStore,t);gp(r,t,n),fp(r,t),r.sharedClientState.updateMutationState(t,"rejected",n),await mp(r,e)}catch(n){await Zc(n)}}function fp(e,t){(e.mu.get(t)||[]).forEach(e=>{e.resolve()}),e.mu.delete(t)}function gp(e,t,n){const r=gc(e);let i=r.Vu[r.currentUser.toKey()];if(i){const e=i.get(t);e&&(n?e.reject(n):e.resolve(),i=i.remove(t)),r.Vu[r.currentUser.toKey()]=i}}async function mp(e,t,n){const r=gc(e),i=[],s=[],o=[];r.Tu.isEmpty()||(r.Tu.forEach((e,a)=>{o.push(r.pu(a,t,n).then(e=>{if((e||n)&&r.isPrimaryClient){const t=e?!e.fromCache:n?.targetChanges.get(a.targetId)?.current;r.sharedClientState.updateQueryState(a.targetId,t?"current":"not-current")}if(e){i.push(e);const t=hd.As(a.targetId,e);s.push(t)}}))}),await Promise.all(o),r.Pu.H_(i),await async function(e,t){const n=gc(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",e=>el.forEach(t,t=>el.forEach(t.Es,r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r)).next(()=>el.forEach(t.ds,r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))}catch(e){if(!tl(e))throw e;cc("LocalStore","Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.Ms.get(t),r=e.snapshotVersion,i=e.withLastLimboFreeSnapshotVersion(r);n.Ms=n.Ms.insert(t,i)}}}(r.localStore,s))}async function yp(e,t){const n=gc(e);if(!n.currentUser.isEqual(t)){cc("SyncEngine","User change. New user:",t.toKey());const e=await gd(n.localStore,t);n.currentUser=t,function(e,t){e.mu.forEach(e=>{e.forEach(e=>{e.reject(new yc(mc.CANCELLED,t))})}),e.mu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await mp(n,e.Ls)}}class _p{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Pd(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,t){return null}Mu(e,t){return null}vu(e){return function(e,t,n,r){return new fd(e,t,n,r)}(this.persistence,new pd,e.initialUser,this.serializer)}Cu(e){return new ad(ld.mi,this.serializer)}Du(e){return new _d}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}_p.provider={build:()=>new _p};class wp extends _p{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,t){fc(this.persistence.referenceDelegate instanceof ud,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new Wh(n,e.asyncQueue,t)}Cu(e){const t=void 0!==this.cacheSizeBytes?Bh.withCacheSize(this.cacheSizeBytes):Bh.DEFAULT;return new ad(e=>ud.mi(e,t),this.serializer)}}class vp{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=>hp(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=yp.bind(null,this.syncEngine),await async function(e,t){const n=gc(e);t?(n.Ea.delete(2),await Vd(n)):t||(n.Ea.add(2),await Bd(n),n.Ra.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new sp}createDatastore(e){const t=Pd(e.databaseInfo.databaseId),n=function(e){return new Rd(e)}(e.databaseInfo);return function(e,t,n,r){return new Ud(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,i){return new jd(e,t,n,r,i)}(this.localStore,this.datastore,e.asyncQueue,e=>hp(this.syncEngine,e,0),bd.v()?new bd:new wd)}createSyncEngine(e,t){return function(e,t,n,r,i,s,o){const a=new lp(e,t,n,r,i,s);return o&&(a.gu=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){await async function(e){const t=gc(e);cc(Fd,"RemoteStore shutting down."),t.Ea.add(5),await Bd(t),t.Aa.shutdown(),t.Ra.set("Unknown")}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}vp.provider={build:()=>new vp};const bp="FirestoreClient";class Ep{constructor(e,t,n,r,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=r,this.user=ic.UNAUTHENTICATED,this.clientId=Ac.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(n,async e=>{cc(bp,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(cc(bp,"Received new app check token=",e),this.appCheckCredentialListener(e,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new _c;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const n=ip(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}}async function Tp(e,t){e.asyncQueue.verifyOperationInProgress(),cc(bp,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener(async e=>{r.isEqual(e)||(await gd(t.localStore,e),r=e)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}async function Ip(e,t){e.asyncQueue.verifyOperationInProgress();const n=await async function(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){cc(bp,"Using user provided OfflineComponentProvider");try{await Tp(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(e){return"FirebaseError"===e.name?e.code===mc.FAILED_PRECONDITION||e.code===mc.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}(n))throw n;uc("Error using user provided cache. Falling back to memory cache: "+n),await Tp(e,new _p)}}else cc(bp,"Using default OfflineComponentProvider"),await Tp(e,new wp(void 0));return e._offlineComponents}(e);cc(bp,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>tp(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>tp(t.remoteStore,n)),e._onlineComponents=t}function Sp(e){return async function(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(cc(bp,"Using user provided OnlineComponentProvider"),await Ip(e,e._uninitializedComponentsProvider._online)):(cc(bp,"Using default OnlineComponentProvider"),await Ip(e,new vp))),e._onlineComponents}(e).then(e=>e.syncEngine)}function Cp(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}const kp=new Map,Ap="firestore.googleapis.com",Rp=!0;class Op{constructor(e){if(void 0===e.host){if(void 0!==e.ssl)throw new yc(mc.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Ap,this.ssl=Rp}else this.host=e.host,this.ssl=e.ssl??Rp;if(this.isUsingEmulator=void 0!==e.emulatorOptions,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=Vh;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new yc(mc.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,r){if(!0===t&&!0===r)throw new yc(mc.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=Cp(e.experimentalLongPollingOptions??{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new yc(mc.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new yc(mc.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new yc(mc.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Pp{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Op({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new yc(mc.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"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new yc(mc.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 Op(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new vc;switch(e.type){case"firstParty":return new Ic(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new yc(mc.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=kp.get(e);t&&(cc("ComponentProvider","Removing Datastore"),kp.delete(e),t.terminate())}(this),Promise.resolve()}}class xp{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new xp(this.firestore,e,this._query)}}class Np{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 Dp(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Np(this.firestore,e,this._key)}toJSON(){return{type:Np._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(qc(t,Np._jsonSchema))return new Np(e,n||null,new jc(Uc.fromString(t.referencePath)))}}Np._jsonSchemaVersion="firestore/documentReference/1.0",Np._jsonSchema={type:zc("string",Np._jsonSchemaVersion),referencePath:zc("string")};class Dp extends xp{constructor(e,t,n){super(e,t,function(e){return new Tu(e)}(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Np(this.firestore,null,new jc(e))}withConverter(e){return new Dp(this.firestore,e,this._path)}}function Lp(e,t,...n){if(e=or(e),1===arguments.length&&(t=Ac.newId()),function(e,t,n){if(!n)throw new yc(mc.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}("doc","path",t),e instanceof Pp){const r=Uc.fromString(t,...n);return Vc(r),new Np(e,null,new jc(r))}{if(!(e instanceof Np||e instanceof Dp))throw new yc(mc.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(Uc.fromString(t,...n));return Vc(r),new Np(e.firestore,e instanceof Dp?e.converter:null,new jc(r))}}const Mp="AsyncQueue";class Up{constructor(e=Promise.resolve()){this.Xu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new xd(this,"async_queue_retry"),this._c=()=>{const e=Od();e&&cc(Mp,"Visibility state changed to "+e.visibilityState),this.M_.w_()},this.ac=e;const t=Od();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const t=Od();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise(()=>{});const t=new _c;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Xu.push(e),this.lc()))}async lc(){if(0!==this.Xu.length){try{await this.Xu[0](),this.Xu.shift(),this.M_.reset()}catch(e){if(!tl(e))throw e;cc(Mp,"Operation failed with retryable error: "+e)}this.Xu.length>0&&this.M_.p_(()=>this.lc())}}cc(e){const t=this.ac.then(()=>(this.rc=!0,e().catch(e=>{throw this.nc=e,this.rc=!1,lc("INTERNAL UNHANDLED ERROR: ",$p(e)),e}).then(e=>(this.rc=!1,e))));return this.ac=t,t}enqueueAfterDelay(e,t,n){this.uc(),this.oc.indexOf(e)>-1&&(t=0);const r=rp.createAndSchedule(this,e,t,n,e=>this.hc(e));return this.tc.push(r),r}uc(){this.nc&&dc(47125,{Pc:$p(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do{e=this.ac,await e}while(e!==this.ac)}Ic(e){for(const t of this.tc)if(t.timerId===e)return!0;return!1}Ec(e){return this.Tc().then(()=>{this.tc.sort((e,t)=>e.targetTimeMs-t.targetTimeMs);for(const t of this.tc)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.Tc()})}dc(e){this.oc.push(e)}hc(e){const t=this.tc.indexOf(e);this.tc.splice(t,1)}}function $p(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}class Fp extends Pp{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new Up,this._persistenceKey=r?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Up(e),this._firestoreClient=void 0,await e}}}function jp(e){if(e._terminated)throw new yc(mc.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){const t=e._freezeSettings(),n=function(e,t,n,r){return new Al(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,Cp(r.experimentalLongPollingOptions),r.useFetchStreams,r.isUsingEmulator)}(e._databaseId,e._app?.options.appId||"",e._persistenceKey,t);e._componentsProvider||t.localCache?._offlineComponentProvider&&t.localCache?._onlineComponentProvider&&(e._componentsProvider={_offline:t.localCache._offlineComponentProvider,_online:t.localCache._onlineComponentProvider}),e._firestoreClient=new Ep(e._authCredentials,e._appCheckCredentials,e._queue,n,e._componentsProvider&&function(e){const t=e?._online.build();return{_offline:e?._offline.build(t),_online:t}}(e._componentsProvider))}(e),e._firestoreClient}class Vp{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Vp(ml.fromBase64String(e))}catch(e){throw new yc(mc.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new Vp(ml.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)}toJSON(){return{type:Vp._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(qc(e,Vp._jsonSchema))return Vp.fromBase64String(e.bytes)}}Vp._jsonSchemaVersion="firestore/bytes/1.0",Vp._jsonSchema={type:zc("string",Vp._jsonSchemaVersion),bytes:zc("string")};class Bp{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new yc(mc.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Fc(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class zp{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new yc(mc.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new yc(mc.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}_compareTo(e){return Rc(this._lat,e._lat)||Rc(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:zp._jsonSchemaVersion}}static fromJSON(e){if(qc(e,zp._jsonSchema))return new zp(e.latitude,e.longitude)}}zp._jsonSchemaVersion="firestore/geoPoint/1.0",zp._jsonSchema={type:zc("string",zp._jsonSchemaVersion),latitude:zc("number"),longitude:zc("number")};class qp{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:qp._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(qc(e,qp._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new qp(e.vectorValues);throw new yc(mc.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}qp._jsonSchemaVersion="firestore/vectorValue/1.0",qp._jsonSchema={type:zc("string",qp._jsonSchemaVersion),vectorValues:zc("object")};const Hp=new RegExp("[~\\*/\\[\\]]");function Kp(e,t,n,r,i){let s=`Function ${t}() called with invalid data`;s+=". ";return new yc(mc.INVALID_ARGUMENT,s+e+"")}class Wp{constructor(e,t,n,r,i){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Np(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Gp(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){const t=this._document.data.field(Xp("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class Gp extends Wp{data(){return super.data()}}function Xp(e,t){return"string"==typeof t?function(e,t){if(t.search(Hp)>=0)throw Kp(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e);try{return new Bp(...t.split("."))._internalPath}catch(n){throw Kp(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e)}}(e,t):t instanceof Bp?t._internalPath:t._delegate._internalPath}class Qp{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Jp extends Wp{constructor(e,t,n,r,i,s){super(e,t,n,r,s),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Yp(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){const n=this._document.data.field(Xp("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new yc(mc.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=Jp._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),e&&e.isValidDocument()&&e.isFoundDocument()?(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t):t}}Jp._jsonSchemaVersion="firestore/documentSnapshot/1.0",Jp._jsonSchema={type:zc("string",Jp._jsonSchemaVersion),bundleSource:zc("string","DocumentSnapshot"),bundleName:zc("string"),bundle:zc("string")};class Yp extends Jp{data(e={}){return super.data(e)}}class Zp{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new Qp(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const 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 Yp(this._firestore,this._userDataWriter,n.key,n,new Qp(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new yc(mc.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=>{const r=new Yp(e._firestore,e._userDataWriter,n.doc.key,n.doc,new Qp(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{const r=new Yp(e._firestore,e._userDataWriter,t.doc.key,t.doc,new Qp(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let i=-1,s=-1;return 0!==t.type&&(i=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),s=n.indexOf(t.doc.key)),{type:ef(t.type),doc:r,oldIndex:i,newIndex:s}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new yc(mc.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=Zp._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Ac.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],r=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),r.push(e.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function ef(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return dc(61501,{type:e})}}function tf(e){return function(e,t){return function(e,t){const n=new _c;return e.asyncQueue.enqueueAndForget(async()=>up(await Sp(e),t,n)),n.promise}(jp(e),t)}(Bc(e.firestore,Fp),[new _h(e._key,sh.none())])}Zp._jsonSchemaVersion="firestore/querySnapshot/1.0",Zp._jsonSchema={type:zc("string",Zp._jsonSchemaVersion),bundleSource:zc("string","QuerySnapshot"),bundleName:zc("string"),bundle:zc("string")},function(e,t=!0){!function(e){sc=e}(Ei),yi(new ar("firestore",(e,{instanceIdentifier:n,options:r})=>{const i=e.getProvider("app").getImmediate(),s=new Fp(new Ec(e.getProvider("auth-internal")),new Cc(i,e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new yc(mc.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Ol(e.options.projectId,t)}(i,n),i);return r={useFetchStreams:t,...r},s._setSettings(r),s},"PUBLIC").setMultipleInstances(!0)),Si(nc,rc,e),Si(nc,rc,"esm2020")}();const nf="firebasestorage.googleapis.com",rf="storageBucket";class sf extends Xn{constructor(e,t,n=0){super(cf(e),`Firebase Storage: ${t} (${cf(e)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,sf.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return cf(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}}var of,af;function cf(e){return"storage/"+e}function lf(){return new sf(of.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function uf(){return new sf(of.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function hf(){return new sf(of.CANCELED,"User canceled the upload/download.")}function df(){return new sf(of.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function pf(e){return new sf(of.INVALID_ARGUMENT,e)}function ff(){return new sf(of.APP_DELETED,"The Firebase app was deleted.")}function gf(e,t){return new sf(of.INVALID_FORMAT,"String does not match format '"+e+"': "+t)}function mf(e){throw new sf(of.INTERNAL_ERROR,"Internal error: "+e)}!function(e){e.UNKNOWN="unknown",e.OBJECT_NOT_FOUND="object-not-found",e.BUCKET_NOT_FOUND="bucket-not-found",e.PROJECT_NOT_FOUND="project-not-found",e.QUOTA_EXCEEDED="quota-exceeded",e.UNAUTHENTICATED="unauthenticated",e.UNAUTHORIZED="unauthorized",e.UNAUTHORIZED_APP="unauthorized-app",e.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",e.INVALID_CHECKSUM="invalid-checksum",e.CANCELED="canceled",e.INVALID_EVENT_NAME="invalid-event-name",e.INVALID_URL="invalid-url",e.INVALID_DEFAULT_BUCKET="invalid-default-bucket",e.NO_DEFAULT_BUCKET="no-default-bucket",e.CANNOT_SLICE_BLOB="cannot-slice-blob",e.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",e.NO_DOWNLOAD_URL="no-download-url",e.INVALID_ARGUMENT="invalid-argument",e.INVALID_ARGUMENT_COUNT="invalid-argument-count",e.APP_DELETED="app-deleted",e.INVALID_ROOT_OPERATION="invalid-root-operation",e.INVALID_FORMAT="invalid-format",e.INTERNAL_ERROR="internal-error",e.UNSUPPORTED_ENVIRONMENT="unsupported-environment"}(of||(of={}));class yf{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let n;try{n=yf.makeFromUrl(e,t)}catch(t){return new yf(e,"")}if(""===n.path)return n;throw r=e,new sf(of.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+r+"'.");var r}static makeFromUrl(e,t){let n=null;const r="([A-Za-z0-9.\\-_]+)";const i=new RegExp("^gs://"+r+"(/(.*))?$","i");function s(e){e.path_=decodeURIComponent(e.path)}const o=t.replace(/[.]/g,"\\."),a=[{regex:i,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:new RegExp(`^https?://${o}/v[A-Za-z0-9_]+/b/${r}/o(/([^?#]*).*)?$`,"i"),indices:{bucket:1,path:3},postModify:s},{regex:new RegExp(`^https?://${t===nf?"(?:storage.googleapis.com|storage.cloud.google.com)":t}/${r}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:s}];for(let t=0;t<a.length;t++){const r=a[t],i=r.regex.exec(e);if(i){const e=i[r.indices.bucket];let t=i[r.indices.path];t||(t=""),n=new yf(e,t),r.postModify(n);break}}if(null==n)throw function(e){return new sf(of.INVALID_URL,"Invalid URL '"+e+"'.")}(e);return n}}class _f{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}function wf(e){return"string"==typeof e||e instanceof String}function vf(e){return bf()&&e instanceof Blob}function bf(){return"undefined"!=typeof Blob}function Ef(e,t,n,r){if(r<t)throw pf(`Invalid value for '${e}'. Expected ${t} or greater.`);if(r>n)throw pf(`Invalid value for '${e}'. Expected ${n} or less.`)}function Tf(e,t,n){let r=t;return null==n&&(r=`https://${t}`),`${n}://${r}/v0${e}`}function If(e){const t=encodeURIComponent;let n="?";for(const r in e)if(e.hasOwnProperty(r)){n=n+(t(r)+"="+t(e[r]))+"&"}return n=n.slice(0,-1),n}function Sf(e,t){const n=e>=500&&e<600,r=-1!==[408,429].indexOf(e),i=-1!==t.indexOf(e);return n||r||i}!function(e){e[e.NO_ERROR=0]="NO_ERROR",e[e.NETWORK_ERROR=1]="NETWORK_ERROR",e[e.ABORT=2]="ABORT"}(af||(af={}));class Cf{constructor(e,t,n,r,i,s,o,a,c,l,u,h=!0,d=!1){this.url_=e,this.method_=t,this.headers_=n,this.body_=r,this.successCodes_=i,this.additionalRetryCodes_=s,this.callback_=o,this.errorCallback_=a,this.timeout_=c,this.progressCallback_=l,this.connectionFactory_=u,this.retry=h,this.isUsingEmulator=d,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((e,t)=>{this.resolve_=e,this.reject_=t,this.start_()})}start_(){const e=(e,t)=>{if(t)return void e(!1,new kf(!1,null,!0));const n=this.connectionFactory_();this.pendingConnection_=n;const r=e=>{const t=e.loaded,n=e.lengthComputable?e.total:-1;null!==this.progressCallback_&&this.progressCallback_(t,n)};null!==this.progressCallback_&&n.addUploadProgressListener(r),n.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(r),this.pendingConnection_=null;const t=n.getErrorCode()===af.NO_ERROR,i=n.getStatus();if(!t||Sf(i,this.additionalRetryCodes_)&&this.retry){const t=n.getErrorCode()===af.ABORT;return void e(!1,new kf(!1,null,t))}const s=-1!==this.successCodes_.indexOf(i);e(!0,new kf(s,n))})},t=(e,t)=>{const n=this.resolve_,r=this.reject_,i=t.connection;if(t.wasSuccessCode)try{const e=this.callback_(i,i.getResponse());!function(e){return void 0!==e}(e)?n():n(e)}catch(e){r(e)}else if(null!==i){const e=lf();e.serverResponse=i.getErrorText(),this.errorCallback_?r(this.errorCallback_(i,e)):r(e)}else if(t.canceled){r(this.appDelete_?ff():hf())}else{r(uf())}};this.canceled_?t(0,new kf(!1,null,!0)):this.backoffId_=function(e,t,n){let r=1,i=null,s=null,o=!1,a=0;function c(){return 2===a}let l=!1;function u(...e){l||(l=!0,t.apply(null,e))}function h(t){i=setTimeout(()=>{i=null,e(p,c())},t)}function d(){s&&clearTimeout(s)}function p(e,...t){if(l)return void d();if(e)return d(),void u.call(null,e,...t);if(c()||o)return d(),void u.call(null,e,...t);let n;r<64&&(r*=2),1===a?(a=2,n=0):n=1e3*(r+Math.random()),h(n)}let f=!1;function g(e){f||(f=!0,d(),l||(null!==i?(e||(a=2),clearTimeout(i),h(0)):e||(a=1)))}return h(0),s=setTimeout(()=>{o=!0,g(!0)},n),g}(e,t,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()}}class kf{constructor(e,t,n){this.wasSuccessCode=e,this.connection=t,this.canceled=!!n}}function Af(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function Rf(...e){const t=Af();if(void 0!==t){const n=new t;for(let t=0;t<e.length;t++)n.append(e[t]);return n.getBlob()}if(bf())return new Blob(e);throw new sf(of.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}function Of(e){if("undefined"==typeof atob)throw t="base-64",new sf(of.UNSUPPORTED_ENVIRONMENT,`${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);var t;return atob(e)}const Pf="raw",xf="base64",Nf="base64url",Df="data_url";class Lf{constructor(e,t){this.data=e,this.contentType=t||null}}function Mf(e,t){switch(e){case Pf:return new Lf(Uf(t));case xf:case Nf:return new Lf($f(e,t));case Df:return new Lf(function(e){const t=new Ff(e);return t.base64?$f(xf,t.rest):function(e){let t;try{t=decodeURIComponent(e)}catch(e){throw gf(Df,"Malformed data URL.")}return Uf(t)}(t.rest)}(t),new Ff(t).contentType)}throw lf()}function Uf(e){const t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<=127)t.push(r);else if(r<=2047)t.push(192|r>>6,128|63&r);else if(55296==(64512&r)){if(n<e.length-1&&56320==(64512&e.charCodeAt(n+1))){r=65536|(1023&r)<<10|1023&e.charCodeAt(++n),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r)}else t.push(239,191,189)}else 56320==(64512&r)?t.push(239,191,189):t.push(224|r>>12,128|r>>6&63,128|63&r)}return new Uint8Array(t)}function $f(e,t){switch(e){case xf:{const n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r){throw gf(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?")}break}case Nf:{const n=-1!==t.indexOf("+"),r=-1!==t.indexOf("/");if(n||r){throw gf(e,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?")}t=t.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=Of(t)}catch(t){if(t.message.includes("polyfill"))throw t;throw gf(e,"Invalid character found")}const r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}class Ff{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(null===t)throw gf(Df,"Must be formatted 'data:[<mediatype>][;base64],<data>");const n=t[1]||null;null!=n&&(this.base64=function(e,t){const n=e.length>=t.length;if(!n)return!1;return e.substring(e.length-t.length)===t}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=e.substring(e.indexOf(",")+1)}}class jf{constructor(e,t){let n=0,r="";vf(e)?(this.data_=e,n=e.size,r=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),n=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),n=e.length),this.size_=n,this.type_=r}size(){return this.size_}type(){return this.type_}slice(e,t){if(vf(this.data_)){const n=function(e,t,n){return e.webkitSlice?e.webkitSlice(t,n):e.mozSlice?e.mozSlice(t,n):e.slice?e.slice(t,n):null}(this.data_,e,t);return null===n?null:new jf(n)}{const n=new Uint8Array(this.data_.buffer,e,t-e);return new jf(n,!0)}}static getBlob(...e){if(bf()){const t=e.map(e=>e instanceof jf?e.data_:e);return new jf(Rf.apply(null,t))}{const t=e.map(e=>wf(e)?Mf(Pf,e).data:e.data_);let n=0;t.forEach(e=>{n+=e.byteLength});const r=new Uint8Array(n);let i=0;return t.forEach(e=>{for(let t=0;t<e.length;t++)r[i++]=e[t]}),new jf(r,!0)}}uploadData(){return this.data_}}function Vf(e){let t;try{t=JSON.parse(e)}catch(e){return null}return function(e){return"object"==typeof e&&!Array.isArray(e)}(t)?t:null}function Bf(e){const t=e.lastIndexOf("/",e.length-2);return-1===t?e:e.slice(t+1)}function zf(e,t){return t}class qf{constructor(e,t,n,r){this.server=e,this.local=t||e,this.writable=!!n,this.xform=r||zf}}let Hf=null;function Kf(){if(Hf)return Hf;const e=[];e.push(new qf("bucket")),e.push(new qf("generation")),e.push(new qf("metageneration")),e.push(new qf("name","fullPath",!0));const t=new qf("name");t.xform=function(e,t){return function(e){return!wf(e)||e.length<2?e:Bf(e)}(t)},e.push(t);const n=new qf("size");return n.xform=function(e,t){return void 0!==t?Number(t):t},e.push(n),e.push(new qf("timeCreated")),e.push(new qf("updated")),e.push(new qf("md5Hash",null,!0)),e.push(new qf("cacheControl",null,!0)),e.push(new qf("contentDisposition",null,!0)),e.push(new qf("contentEncoding",null,!0)),e.push(new qf("contentLanguage",null,!0)),e.push(new qf("contentType",null,!0)),e.push(new qf("metadata","customMetadata",!0)),Hf=e,Hf}function Wf(e,t,n){const r={type:"file"},i=n.length;for(let e=0;e<i;e++){const i=n[e];r[i.local]=i.xform(r,t[i.server])}return function(e,t){Object.defineProperty(e,"ref",{get:function(){const n=e.bucket,r=e.fullPath,i=new yf(n,r);return t._makeStorageReference(i)}})}(r,e),r}function Gf(e,t,n){const r=Vf(t);if(null===r)return null;return Wf(e,r,n)}function Xf(e,t){const n={},r=t.length;for(let i=0;i<r;i++){const r=t[i];r.writable&&(n[r.server]=e[r.local])}return JSON.stringify(n)}class Qf{constructor(e,t,n,r){this.url=e,this.method=t,this.handler=n,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function Jf(e){if(!e)throw lf()}function Yf(e,t){return function(n,r){const i=Gf(e,r,t);return Jf(null!==i),i}}function Zf(e,t){return function(n,r){const i=Gf(e,r,t);return Jf(null!==i),function(e,t,n,r){const i=Vf(t);if(null===i)return null;if(!wf(i.downloadTokens))return null;const s=i.downloadTokens;if(0===s.length)return null;const o=encodeURIComponent;return s.split(",").map(t=>{const i=e.bucket,s=e.fullPath;return Tf("/b/"+o(i)+"/o/"+o(s),n,r)+If({alt:"media",token:t})})[0]}(i,r,e.host,e._protocol)}}function eg(e){return function(t,n){let r;var i,s;return 401===t.getStatus()?r=t.getErrorText().includes("Firebase App Check token is invalid")?new sf(of.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new sf(of.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(s=e.bucket,r=new sf(of.QUOTA_EXCEEDED,"Quota for bucket '"+s+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(i=e.path,r=new sf(of.UNAUTHORIZED,"User does not have permission to access '"+i+"'.")):r=n,r.status=t.getStatus(),r.serverResponse=n.serverResponse,r}}function tg(e){const t=eg(e);return function(n,r){let i=t(n,r);var s;return 404===n.getStatus()&&(s=e.path,i=new sf(of.OBJECT_NOT_FOUND,"Object '"+s+"' does not exist.")),i.serverResponse=r.serverResponse,i}}function ng(e,t,n){const r=Object.assign({},n);return r.fullPath=e.path,r.size=t.size(),r.contentType||(r.contentType=function(e,t){return e&&e.contentType||t&&t.type()||"application/octet-stream"}(null,t)),r}class rg{constructor(e,t,n,r){this.current=e,this.total=t,this.finalized=!!n,this.metadata=r||null}}function ig(e,t){let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Status")}catch(e){Jf(!1)}return Jf(!!n&&-1!==(t||["active"]).indexOf(n)),n}const sg=262144;function og(e,t,n,r,i,s,o,a){const c=new rg(0,0);if(o?(c.current=o.current,c.total=o.total):(c.current=0,c.total=r.size()),r.size()!==c.total)throw new sf(of.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");const l=c.total-c.current;let u=l;i>0&&(u=Math.min(u,i));const h=c.current,d=h+u;let p="";p=0===u?"finalize":l===u?"upload, finalize":"upload";const f={"X-Goog-Upload-Command":p,"X-Goog-Upload-Offset":`${c.current}`},g=r.slice(h,d);if(null===g)throw df();const m=t.maxUploadRetryTime,y=new Qf(n,"POST",function(e,n){const i=ig(e,["active","final"]),o=c.current+u,a=r.size();let l;return l="final"===i?Yf(t,s)(e,n):null,new rg(o,a,"final"===i,l)},m);return y.headers=f,y.body=g.uploadData(),y.progressCallback=a||null,y.errorHandler=eg(e),y}const ag="running",cg="paused",lg="success",ug="canceled",hg="error";function dg(e){switch(e){case"running":case"pausing":case"canceling":return ag;case"paused":return cg;case"success":return lg;case"canceled":return ug;default:return hg}}class pg{constructor(e,t,n){const r=function(e){return"function"==typeof e}(e)||null!=t||null!=n;if(r)this.next=e,this.error=t??void 0,this.complete=n??void 0;else{const t=e;this.next=t.next,this.error=t.error,this.complete=t.complete}}}function fg(e){return(...t)=>{Promise.resolve().then(()=>e(...t))}}class gg{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=af.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=af.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=af.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,n,r,i){if(this.sent_)throw mf("cannot .send() more than once");if(Un(e)&&n&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(t,e,!0),void 0!==i)for(const e in i)i.hasOwnProperty(e)&&this.xhr_.setRequestHeader(e,i[e].toString());return void 0!==r?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw mf("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw mf("cannot .getStatus() before sending");try{return this.xhr_.status}catch(e){return-1}}getResponse(){if(!this.sent_)throw mf("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw mf("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",e)}}class mg extends gg{initXhr(){this.xhr_.responseType="text"}}function yg(){return new mg}class _g{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(e,t,n=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=n,this._mappings=Kf(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=e=>{if(this._request=void 0,this._chunkMultiplier=1,e._codeEquals(of.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const t=this.isExponentialBackoffExpired();if(Sf(e.status,[])){if(!t)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();e=uf()}this._error=e,this._transition("error")}},this._metadataErrorHandler=e=>{this._request=void 0,e._codeEquals(of.CANCELED)?this.completeTransitions_():(this._error=e,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){const e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>262144}_start(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([t,n])=>{switch(this._state){case"running":e(t,n);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}})}_createResumable(){this._resolveToken((e,t)=>{const n=function(e,t,n,r,i){const s=t.bucketOnlyServerUrl(),o=ng(t,r,i),a={name:o.fullPath},c=Tf(s,e.host,e._protocol),l={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},u=Xf(o,n),h=e.maxUploadRetryTime,d=new Qf(c,"POST",function(e){let t;ig(e);try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(e){Jf(!1)}return Jf(wf(t)),t},h);return d.urlParams=a,d.headers=l,d.body=u,d.errorHandler=eg(t),d}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),r=this._ref.storage._makeRequest(n,yg,e,t);this._request=r,r.getPromise().then(e=>{this._request=void 0,this._uploadUrl=e,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const e=this._uploadUrl;this._resolveToken((t,n)=>{const r=function(e,t,n,r){const i=e.maxUploadRetryTime,s=new Qf(n,"POST",function(e){const t=ig(e,["active","final"]);let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(e){Jf(!1)}n||Jf(!1);const i=Number(n);return Jf(!isNaN(i)),new rg(i,r.size(),"final"===t)},i);return s.headers={"X-Goog-Upload-Command":"query"},s.errorHandler=eg(t),s}(this._ref.storage,this._ref._location,e,this._blob),i=this._ref.storage._makeRequest(r,yg,t,n);this._request=i,i.getPromise().then(e=>{this._request=void 0,this._updateProgress(e.current),this._needToFetchStatus=!1,e.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=sg*this._chunkMultiplier,t=new rg(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken((r,i)=>{let s;try{s=og(this._ref._location,this._ref.storage,n,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(e){return this._error=e,void this._transition("error")}const o=this._ref.storage._makeRequest(s,yg,r,i,!1);this._request=o,o.getPromise().then(e=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(e.current),e.finalized?(this._metadata=e.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){2*(sg*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{const n=function(e,t,n){const r=Tf(t.fullServerUrl(),e.host,e._protocol),i=e.maxOperationRetryTime,s=new Qf(r,"GET",Yf(e,n),i);return s.errorHandler=tg(t),s}(this._ref.storage,this._ref._location,this._mappings),r=this._ref.storage._makeRequest(n,yg,e,t);this._request=r,r.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{const n=function(e,t,n,r,i){const s=t.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"},a=function(){let e="";for(let t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}();o["Content-Type"]="multipart/related; boundary="+a;const c=ng(t,r,i),l="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+Xf(c,n)+"\r\n--"+a+"\r\nContent-Type: "+c.contentType+"\r\n\r\n",u="\r\n--"+a+"--",h=jf.getBlob(l,r,u);if(null===h)throw df();const d={name:c.fullPath},p=Tf(s,e.host,e._protocol),f=e.maxUploadRetryTime,g=new Qf(p,"POST",Yf(e,n),f);return g.urlParams=d,g.headers=o,g.body=h.uploadData(),g.errorHandler=eg(t),g}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),r=this._ref.storage._makeRequest(n,yg,e,t);this._request=r,r.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){const t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const t="paused"===this._state;this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":case"error":case"success":this._state=e,this._notifyObservers();break;case"canceled":this._error=hf(),this._state=e,this._notifyObservers()}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}}get snapshot(){const e=dg(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,n,r){const i=new pg(t||void 0,n||void 0,r||void 0);return this._addObserver(i),()=>{this._removeObserver(i)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const t=this._observers.indexOf(e);-1!==t&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise();this._observers.slice().forEach(e=>{this._notifyObserver(e)})}_finishPromise(){if(void 0!==this._resolve){let e=!0;switch(dg(this._state)){case lg:fg(this._resolve.bind(null,this.snapshot))();break;case ug:case hg:fg(this._reject.bind(null,this._error))();break;default:e=!1}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(dg(this._state)){case ag:case cg:e.next&&fg(e.next.bind(e,this.snapshot))();break;case lg:e.complete&&fg(e.complete.bind(e))();break;default:e.error&&fg(e.error.bind(e,this._error))()}}resume(){const e="paused"===this._state||"pausing"===this._state;return e&&this._transition("running"),e}pause(){const e="running"===this._state;return e&&this._transition("pausing"),e}cancel(){const e="running"===this._state||"pausing"===this._state;return e&&this._transition("canceling"),e}}class wg{constructor(e,t){this._service=e,this._location=t instanceof yf?t:yf.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new wg(e,t)}get root(){const e=new yf(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return Bf(this._location.path)}get storage(){return this._service}get parent(){const e=function(e){if(0===e.length)return null;const t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)}(this._location.path);if(null===e)return null;const t=new yf(this._location.bucket,e);return new wg(this._service,t)}_throwIfRoot(e){if(""===this._location.path)throw function(e){return new sf(of.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').")}(e)}}function vg(e,t){e._throwIfRoot("updateMetadata");const n=function(e,t,n,r){const i=Tf(t.fullServerUrl(),e.host,e._protocol),s=Xf(n,r),o=e.maxOperationRetryTime,a=new Qf(i,"PATCH",Yf(e,r),o);return a.headers={"Content-Type":"application/json; charset=utf-8"},a.body=s,a.errorHandler=tg(t),a}(e.storage,e._location,t,Kf());return e.storage.makeRequestWithTokens(n,yg)}function bg(e){e._throwIfRoot("getDownloadURL");const t=function(e,t,n){const r=Tf(t.fullServerUrl(),e.host,e._protocol),i=e.maxOperationRetryTime,s=new Qf(r,"GET",Zf(e,n),i);return s.errorHandler=tg(t),s}(e.storage,e._location,Kf());return e.storage.makeRequestWithTokens(t,yg).then(e=>{if(null===e)throw new sf(of.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return e})}function Eg(e,t){if(e instanceof Sg){const n=e;if(null==n._bucket)throw new sf(of.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+rf+"' property when initializing the app?");const r=new wg(n,n._bucket);return null!=t?Eg(r,t):r}return void 0!==t?function(e,t){const n=function(e,t){const n=t.split("/").filter(e=>e.length>0).join("/");return 0===e.length?n:e+"/"+n}(e._location.path,t),r=new yf(e._location.bucket,n);return new wg(e.storage,r)}(e,t):e}function Tg(e,t){if(t&&/^[A-Za-z]+:\/\//.test(t)){if(e instanceof Sg)return new wg(e,t);throw pf("To use ref(service, url), the first argument must be a Storage instance.")}return Eg(e,t)}function Ig(e,t){const n=t?.[rf];return null==n?null:yf.makeFromBucketSpec(n,e)}class Sg{constructor(e,t,n,r,i,s=!1){this.app=e,this._authProvider=t,this._appCheckProvider=n,this._url=r,this._firebaseVersion=i,this._isUsingEmulator=s,this._bucket=null,this._host=nf,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=r?yf.makeFromBucketSpec(r,this._host):Ig(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=yf.makeFromBucketSpec(this._url,e):this._bucket=Ig(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){Ef("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){Ef("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(null!==t)return t.accessToken}return null}async _getAppCheckToken(){if(wi(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});if(e){return(await e.getToken()).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 wg(this,e)}_makeRequest(e,t,n,r,i=!0){if(this._deleted)return new _f(ff());{const s=function(e,t,n,r,i,s,o=!0,a=!1){const c=If(e.urlParams),l=e.url+c,u=Object.assign({},e.headers);return function(e,t){t&&(e["X-Firebase-GMPID"]=t)}(u,t),function(e,t){null!==t&&t.length>0&&(e.Authorization="Firebase "+t)}(u,n),function(e,t){e["X-Firebase-Storage-Version"]="webjs/"+(t??"AppManager")}(u,s),function(e,t){null!==t&&(e["X-Firebase-AppCheck"]=t)}(u,r),new Cf(l,e.method,u,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,i,o,a)}(e,this._appId,n,r,t,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(s),s.getPromise().then(()=>this._requests.delete(s),()=>this._requests.delete(s)),s}}async makeRequestWithTokens(e,t){const[n,r]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,n,r).getPromise()}}const Cg="@firebase/storage",kg="0.14.0",Ag="storage";function Rg(e,t,n){return function(e,t,n){return e._throwIfRoot("uploadBytesResumable"),new _g(e,new jf(t),n)}(e=or(e),t,n)}function Og(e,{instanceIdentifier:t}){const n=e.getProvider("app").getImmediate(),r=e.getProvider("auth-internal"),i=e.getProvider("app-check-internal");return new Sg(n,r,i,t,Ei)}yi(new ar(Ag,Og,"PUBLIC").setMultipleInstances(!0)),Si(Cg,kg,""),Si(Cg,kg,"esm2020");const Pg=JSON.parse(process.env.FIREBASE_CONFIG||"{}"),xg=Ti(Pg),Ng=function(e){const t="object"==typeof e?e:Ii(),n="string"==typeof e?e:Rl,r=_i(t,"firestore").getImmediate({identifier:n});if(!r._initialized){const e=Nn("firestore");e&&function(e,t,n,r={}){e=Bc(e,Pp);const i=Un(t),s=e._getSettings(),o={...s,emulatorOptions:e._getEmulatorOptions()},a=`${t}:${n}`;i&&($n(`https://${a}`),Bn("Firestore",!0)),s.host!==Ap&&s.host!==a&&uc("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const c={...s,host:a,ssl:i,emulatorOptions:r};if(!Yn(c,o)&&(e._setSettings(c),r.mockUserToken)){let t,n;if("string"==typeof r.mockUserToken)t=r.mockUserToken,n=ic.MOCK_USER;else{t=Fn(r.mockUserToken,e._app?.options.projectId);const i=r.mockUserToken.sub||r.mockUserToken.user_id;if(!i)throw new yc(mc.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new ic(i)}e._authCredentials=new bc(new wc(t,n))}}(r,...e)}return r}(xg),Dg=function(e=Ii(),t){const n=_i(e=or(e),Ag).getImmediate({identifier:t}),r=Nn("storage");return r&&function(e,t,n,r={}){!function(e,t,n,r={}){e.host=`${t}:${n}`;const i=Un(t);i&&($n(`https://${e.host}/b`),Bn("Storage",!0)),e._isUsingEmulator=!0,e._protocol=i?"https":"http";const{mockUserToken:s}=r;s&&(e._overrideAuthToken="string"==typeof s?s:Fn(s,e.app.options.projectId))}(e,t,n,r)}(n,...r),n}(xg),Lg=za(xg),Mg=Lg.currentUser,Ug=s`
148
148
 
149
149
  .action-button:focus { outline:0; }
150
150
 
@@ -195,7 +195,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
195
195
  cursor: pointer;
196
196
  }
197
197
 
198
- `,Ll=s`
198
+ `,$g=s`
199
199
 
200
200
  label { font-size: .9em; }
201
201
  label {
@@ -216,7 +216,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
216
216
 
217
217
  }
218
218
 
219
- `,Ul=s`
219
+ `,Fg=s`
220
220
 
221
221
  input[type=text],
222
222
  input[type=email],
@@ -237,7 +237,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
237
237
 
238
238
  input.invalid { background-color: #ffdddd; }
239
239
 
240
- `,Ml=s`
240
+ `,jg=s`
241
241
 
242
242
  .new {
243
243
  border: 0px;
@@ -254,7 +254,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
254
254
  line-height: 42px;
255
255
  }
256
256
 
257
- `;var jl=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},$l=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let Fl=class extends se{constructor(){super(),this.source="",this.email="",this.password="",this.signIn=async(e,t)=>{const n=Js.credential(e,t);await async function(e,t){return ao(Cs(e),t)}(xl,n).catch(e=>{})}}static get styles(){return[rn,Ll,Ul,Dl,Ml,s`
257
+ `;var Vg=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},Bg=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let zg=class extends se{constructor(){super(),this.source="",this.email="",this.password="",this.signIn=async(e,t)=>{const n=yo.credential(e,t);await async function(e,t){return Ro(Gs(e),t)}(Lg,n).catch(e=>{})}}static get styles(){return[In,$g,Fg,Ug,jg,s`
258
258
 
259
259
  :host {
260
260
  background-color: white;
@@ -267,7 +267,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
267
267
 
268
268
  form { display: grid; }
269
269
 
270
- `]}render(){return B`
270
+ `]}render(){return V`
271
271
 
272
272
  <!-- Log-in State -->
273
273
  <form
@@ -327,7 +327,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
327
327
 
328
328
  </form>
329
329
 
330
- `}change(){Zt.dispatch(Ot(this.source))}handleEmail(e){const t=e.target;this.email=t.value}handlePassword(e){const t=e.target;this.password=t.value}_handleSubmit(e){e.preventDefault()}login(){this.email.length<4?alert("Please enter an email address."):this.password.length<4?alert("Please enter a password."):this.signIn(this.email,this.password)}};jl([le({type:String}),$l("design:type",Object)],Fl.prototype,"source",void 0),jl([ue(),$l("design:type",Object)],Fl.prototype,"email",void 0),jl([ue(),$l("design:type",Object)],Fl.prototype,"password",void 0),Fl=jl([ae("form-login"),$l("design:paramtypes",[])],Fl);const Bl="@firebase/installations",zl="0.6.19",Hl=1e4,Vl=`w:${zl}`,ql="FIS_v2",Wl=36e5,Kl=new Pn("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function Gl(e){return e instanceof An&&e.code.includes("request-failed")}function Jl({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function Xl(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function Yl(e,t){const n=(await t.json()).error;return Kl.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function Zl({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function Ql(e,{refreshToken:t}){const n=Zl(e);return n.append("Authorization",function(e){return`${ql} ${e}`}(t)),n}async function eu(e){const t=await e();return t.status>=500&&t.status<600?e():t}function tu(e){return new Promise(t=>{setTimeout(t,e)})}const nu=/^[cdef][\w-]{21}$/;function iu(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(n=e,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return t.substr(0,22)}(e);return nu.test(t)?t:""}catch{return""}}function ru(e){return`${e.appName}!${e.appId}`}const su=new Map;function ou(e,t){const n=ru(e);au(n,t),function(e,t){const n=function(){!cu&&"BroadcastChannel"in self&&(cu=new BroadcastChannel("[Firebase] FID Change"),cu.onmessage=e=>{au(e.data.key,e.data.fid)});return cu}();n&&n.postMessage({key:e,fid:t});0===su.size&&cu&&(cu.close(),cu=null)}(n,t)}function au(e,t){const n=su.get(e);if(n)for(const e of n)e(t)}let cu=null;const hu="firebase-installations-store";let lu=null;function uu(){return lu||(lu=ci("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(hu)}})),lu}async function du(e,t){const n=ru(e),i=(await uu()).transaction(hu,"readwrite"),r=i.objectStore(hu),s=await r.get(n);return await r.put(t,n),await i.done,s&&s.fid===t.fid||ou(e,t.fid),t}async function pu(e){const t=ru(e),n=(await uu()).transaction(hu,"readwrite");await n.objectStore(hu).delete(t),await n.done}async function fu(e,t){const n=ru(e),i=(await uu()).transaction(hu,"readwrite"),r=i.objectStore(hu),s=await r.get(n),o=t(s);return void 0===o?await r.delete(n):await r.put(o,n),await i.done,!o||s&&s.fid===o.fid||ou(e,o.fid),o}async function gu(e){let t;const n=await fu(e.appConfig,n=>{const i=function(e){const t=e||{fid:iu(),registrationStatus:0};return _u(t)}(n),r=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(Kl.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},i=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const i=Jl(e),r=Zl(e),s=t.getImmediate({optional:!0});if(s){const e=await s.getHeartbeatsHeader();e&&r.append("x-firebase-client",e)}const o={fid:n,authVersion:ql,appId:e.appId,sdkVersion:Vl},a={method:"POST",headers:r,body:JSON.stringify(o)},c=await eu(()=>fetch(i,a));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:Xl(e.authToken)}}throw await Yl("Create Installation",c)}(e,t);return du(e.appConfig,n)}catch(n){throw Gl(n)&&409===n.customData.serverCode?await pu(e.appConfig):await du(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:i}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:mu(e)}:{installationEntry:t}}(e,i);return t=r.registrationPromise,r.installationEntry});return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function mu(e){let t=await yu(e.appConfig);for(;1===t.registrationStatus;)await tu(100),t=await yu(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await gu(e);return n||t}return t}function yu(e){return fu(e,e=>{if(!e)throw Kl.create("installation-not-found");return _u(e)})}function _u(e){return 1===(t=e).registrationStatus&&t.registrationTime+Hl<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function wu({appConfig:e,heartbeatServiceProvider:t},n){const i=function(e,{fid:t}){return`${Jl(e)}/${t}/authTokens:generate`}(e,n),r=Ql(e,n),s=t.getImmediate({optional:!0});if(s){const e=await s.getHeartbeatsHeader();e&&r.append("x-firebase-client",e)}const o={installation:{sdkVersion:Vl,appId:e.appId}},a={method:"POST",headers:r,body:JSON.stringify(o)},c=await eu(()=>fetch(i,a));if(c.ok){return Xl(await c.json())}throw await Yl("Generate Auth Token",c)}async function bu(e,t=!1){let n;const i=await fu(e.appConfig,i=>{if(!Tu(i))throw Kl.create("not-registered");const r=i.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+Wl}(e)}(r))return i;if(1===r.requestStatus)return n=async function(e,t){let n=await vu(e.appConfig);for(;1===n.authToken.requestStatus;)await tu(100),n=await vu(e.appConfig);const i=n.authToken;return 0===i.requestStatus?bu(e,t):i}(e,t),i;{if(!navigator.onLine)throw Kl.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return{...e,authToken:t}}(i);return n=async function(e,t){try{const n=await wu(e,t),i={...t,authToken:n};return await du(e.appConfig,i),n}catch(n){if(!Gl(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n={...t,authToken:{requestStatus:0}};await du(e.appConfig,n)}else await pu(e.appConfig);throw n}}(e,t),t}});return n?await n:i.authToken}function vu(e){return fu(e,e=>{if(!Tu(e))throw Kl.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+Hl<Date.now()?{...e,authToken:{requestStatus:0}}:e;var n})}function Tu(e){return void 0!==e&&2===e.registrationStatus}async function Eu(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await gu(e);t&&await t}(n);return(await bu(n,t)).token}function Iu(e){return Kl.create("missing-app-config-values",{valueName:e})}const Su="installations",ku=e=>{const t=Yi(e.getProvider("app").getImmediate(),Su).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:i}=await gu(t);return i?i.catch(console.error):bu(t).catch(console.error),n.fid}(t),getToken:e=>Eu(t,e)}};Xi(new Fn(Su,e=>{const t=e.getProvider("app").getImmediate(),n=function(e){if(!e||!e.options)throw Iu("App Configuration");if(!e.name)throw Iu("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw Iu(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:Yi(t,"heartbeat"),_delete:()=>Promise.resolve()}},"PUBLIC")),Xi(new Fn("installations-internal",ku,"PRIVATE")),rr(Bl,zl),rr(Bl,zl,"esm2020");const Cu="analytics",Au="https://www.googletagmanager.com/gtag/js",Pu=new Jn("@firebase/analytics"),Ru=new Pn("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."});function Ou(e){if(!e.startsWith(Au)){const t=Ru.create("invalid-gtag-resource",{gtagURL:e});return Pu.warn(t.message),""}return e}function xu(e){return Promise.all(e.map(e=>e.catch(e=>e)))}function Nu(e,t){const n=function(e,t){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(e,t)),n}("firebase-js-sdk-policy",{createScriptURL:Ou}),i=document.createElement("script"),r=`${Au}?l=${e}&id=${t}`;i.src=n?n?.createScriptURL(r):r,i.async=!0,document.head.appendChild(i)}function Du(e,t,n,i){return async function(r,...s){try{if("event"===r){const[i,r]=s;await async function(e,t,n,i,r){try{let s=[];if(r&&r.send_to){let e=r.send_to;Array.isArray(e)||(e=[e]);const i=await xu(n);for(const n of e){const e=i.find(e=>e.measurementId===n),r=e&&t[e.appId];if(!r){s=[];break}s.push(r)}}0===s.length&&(s=Object.values(t)),await Promise.all(s),e("event",i,r||{})}catch(e){Pu.error(e)}}(e,t,n,i,r)}else if("config"===r){const[r,o]=s;await async function(e,t,n,i,r,s){const o=i[r];try{if(o)await t[o];else{const e=(await xu(n)).find(e=>e.measurementId===r);e&&await t[e.appId]}}catch(e){Pu.error(e)}e("config",r,s)}(e,t,n,i,r,o)}else if("consent"===r){const[t,n]=s;e("consent",t,n)}else if("get"===r){const[t,n,i]=s;e("get",t,n,i)}else if("set"===r){const[t]=s;e("set",t)}else e(r,...s)}catch(e){Pu.error(e)}}}const Lu=new class{constructor(e={},t=1e3){this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}};function Uu(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function Mu(e,t=Lu,n){const{appId:i,apiKey:r,measurementId:s}=e.options;if(!i)throw Ru.create("no-app-id");if(!r){if(s)return{measurementId:s,appId:i};throw Ru.create("no-api-key")}const o=t.getThrottleMetadata(i)||{backoffCount:0,throttleEndTimeMillis:Date.now()},a=new $u;return setTimeout(async()=>{a.abort()},6e4),ju({appId:i,apiKey:r,measurementId:s},o,a,t)}async function ju(e,{throttleEndTimeMillis:t,backoffCount:n},i,r=Lu){const{appId:s,measurementId:o}=e;try{await function(e,t){return new Promise((n,i)=>{const r=Math.max(t-Date.now(),0),s=setTimeout(n,r);e.addEventListener(()=>{clearTimeout(s),i(Ru.create("fetch-throttle",{throttleEndTimeMillis:t}))})})}(i,t)}catch(e){if(o)return Pu.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${o} provided in the "measurementId" field in the local Firebase config. [${e?.message}]`),{appId:s,measurementId:o};throw e}try{const t=await async function(e){const{appId:t,apiKey:n}=e,i={method:"GET",headers:Uu(n)},r="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",t),s=await fetch(r,i);if(200!==s.status&&304!==s.status){let e="";try{const t=await s.json();t.error?.message&&(e=t.error.message)}catch(e){}throw Ru.create("config-fetch-failed",{httpStatus:s.status,responseMessage:e})}return s.json()}(e);return r.deleteThrottleMetadata(s),t}catch(t){const a=t;if(!function(e){if(!(e instanceof An&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(a)){if(r.deleteThrottleMetadata(s),o)return Pu.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${o} provided in the "measurementId" field in the local Firebase config. [${a?.message}]`),{appId:s,measurementId:o};throw t}const c=503===Number(a?.customData?.httpStatus)?jn(n,r.intervalMillis,30):jn(n,r.intervalMillis),h={throttleEndTimeMillis:Date.now()+c,backoffCount:n+1};return r.setThrottleMetadata(s,h),Pu.debug(`Calling attemptFetch again in ${c} millis`),ju(e,h,i,r)}}class $u{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}async function Fu(e,t,n,i,r,s,o){const a=Mu(e);a.then(t=>{n[t.measurementId]=t.appId,e.options.measurementId&&t.measurementId!==e.options.measurementId&&Pu.warn(`The measurement ID in the local Firebase config (${e.options.measurementId}) does not match the measurement ID fetched from the server (${t.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)}).catch(e=>Pu.error(e)),t.push(a);const c=async function(){if(!Sn())return Pu.warn(Ru.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await kn()}catch(e){return Pu.warn(Ru.create("indexeddb-unavailable",{errorInfo:e?.toString()}).message),!1}return!0}().then(e=>e?i.getId():void 0),[h,l]=await Promise.all([a,c]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(Au)&&n.src.includes(e))return n;return null})(s)||Nu(s,h.measurementId),r("js",new Date);const u=o?.config??{};return u.origin="firebase",u.update=!0,null!=l&&(u.firebase_id=l),r("config",h.measurementId,u),h.measurementId}class Bu{constructor(e){this.app=e}_delete(){return delete zu[this.app.options.appId],Promise.resolve()}}let zu={},Hu=[];const Vu={};let qu,Wu,Ku="dataLayer",Gu=!1;function Ju(e,t,n){!function(){const e=[];if(In()&&e.push("This is a browser extension environment."),Cn()||e.push("Cookies are not available."),e.length>0){const t=e.map((e,t)=>`(${t+1}) ${e}`).join(" "),n=Ru.create("invalid-analytics-context",{errorInfo:t});Pu.warn(n.message)}}();const i=e.options.appId;if(!i)throw Ru.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw Ru.create("no-api-key");Pu.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${e.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=zu[i])throw Ru.create("already-exists",{id:i});if(!Gu){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(Ku);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,i,r){let s=function(...e){window[i].push(arguments)};return window[r]&&"function"==typeof window[r]&&(s=window[r]),window[r]=Du(s,e,t,n),{gtagCore:s,wrappedGtag:window[r]}}(zu,Hu,Vu,Ku,"gtag");Wu=e,qu=t,Gu=!0}zu[i]=Fu(e,Hu,Vu,t,qu,Ku,n);return new Bu(e)}function Xu(e=ir()){const t=Yi(e=$n(e),Cu);return t.isInitialized()?t.getImmediate():function(e,t={}){const n=Yi(e,Cu);if(n.isInitialized()){const e=n.getImmediate();if(On(t,n.getOptions()))return e;throw Ru.create("already-initialized")}const i=n.initialize({options:t});return i}(e)}function Yu(e,t,n){e=$n(e),async function(e,t,n,i){if(i&&i.global){const t={};for(const e of Object.keys(n))t[`user_properties.${e}`]=n[e];return e("set",t),Promise.resolve()}e("config",await t,{update:!0,user_properties:n})}(Wu,zu[e.app.options.appId],t,n).catch(e=>Pu.error(e))}function Zu(e,t,n,i){e=$n(e),async function(e,t,n,i,r){if(r&&r.global)e("event",n,i);else{const r=await t;e("event",n,{...i,send_to:r})}}(Wu,zu[e.app.options.appId],t,n,i).catch(e=>Pu.error(e))}const Qu="@firebase/analytics",ed="0.10.19";Xi(new Fn(Cu,(e,{options:t})=>Ju(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t),"PUBLIC")),Xi(new Fn("analytics-internal",function(e){try{const t=e.getProvider(Cu).getImmediate();return{logEvent:(e,n,i)=>Zu(t,e,n,i),setUserProperties:(e,n)=>Yu(t,e,n)}}catch(e){throw Ru.create("interop-component-reg-failed",{reason:e})}},"PRIVATE")),rr(Qu,ed),rr(Qu,ed,"esm2020");const td="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",nd="google.c.a.c_id",id=1e4;var rd,sd;function od(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ad(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),i=new Uint8Array(n.length);for(let e=0;e<n.length;++e)i[e]=n.charCodeAt(e);return i}!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(rd||(rd={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(sd||(sd={}));const cd="fcm_token_details_db",hd="fcm_token_object_Store";const ld="firebase-messaging-store";let ud=null;function dd(){return ud||(ud=ci("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(ld)}})),ud}async function pd(e){const t=gd(e),n=await dd(),i=await n.transaction(ld).objectStore(ld).get(t);if(i)return i;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(cd))return null}let t=null;return(await ci(cd,5,{upgrade:async(n,i,r,s)=>{if(i<2)return;if(!n.objectStoreNames.contains(hd))return;const o=s.objectStore(hd),a=await o.index("fcmSenderId").get(e);if(await o.clear(),a)if(2===i){const e=a;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:e.createTime??Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:od(e.vapidKey)}}}else if(3===i){const e=a;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:od(e.auth),p256dh:od(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:od(e.vapidKey)}}}else if(4===i){const e=a;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:od(e.auth),p256dh:od(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:od(e.vapidKey)}}}}})).close(),await hi(cd),await hi("fcm_vapid_details_db"),await hi("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await fd(e,t),t}}async function fd(e,t){const n=gd(e),i=(await dd()).transaction(ld,"readwrite");return await i.objectStore(ld).put(t,n),await i.done,t}function gd({appConfig:e}){return e.appId}const md=new Pn("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});function yd({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function _d({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function wd({p256dh:e,auth:t,endpoint:n,vapidKey:i}){const r={web:{endpoint:n,auth:t,p256dh:e}};return i!==td&&(r.web.applicationPubKey=i),r}async function bd(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:ad(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:od(t.getKey("auth")),p256dh:od(t.getKey("p256dh"))},i=await pd(e.firebaseDependencies);if(i){if(function(e,t){const n=t.vapidKey===e.vapidKey,i=t.endpoint===e.endpoint,r=t.auth===e.auth,s=t.p256dh===e.p256dh;return n&&i&&r&&s}(i.subscriptionOptions,n))return Date.now()>=i.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await _d(e),i=wd(t.subscriptionOptions),r={method:"PATCH",headers:n,body:JSON.stringify(i)};let s;try{const n=await fetch(`${yd(e.appConfig)}/${t.token}`,r);s=await n.json()}catch(e){throw md.create("token-update-failed",{errorInfo:e?.toString()})}if(s.error){const e=s.error.message;throw md.create("token-update-failed",{errorInfo:e})}if(!s.token)throw md.create("token-update-no-token");return s.token}(e.firebaseDependencies,t),i={...t,token:n,createTime:Date.now()};return await fd(e.firebaseDependencies,i),n}catch(e){throw e}}(e,{token:i.token,createTime:Date.now(),subscriptionOptions:n}):i.token;try{await async function(e,t){const n={method:"DELETE",headers:await _d(e)};try{const i=await fetch(`${yd(e.appConfig)}/${t}`,n),r=await i.json();if(r.error){const e=r.error.message;throw md.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw md.create("token-unsubscribe-failed",{errorInfo:e?.toString()})}}(e.firebaseDependencies,i.token)}catch(e){}return vd(e.firebaseDependencies,n)}return vd(e.firebaseDependencies,n)}async function vd(e,t){const n=await async function(e,t){const n=await _d(e),i=wd(t),r={method:"POST",headers:n,body:JSON.stringify(i)};let s;try{const t=await fetch(yd(e.appConfig),r);s=await t.json()}catch(e){throw md.create("token-subscribe-failed",{errorInfo:e?.toString()})}if(s.error){const e=s.error.message;throw md.create("token-subscribe-failed",{errorInfo:e})}if(!s.token)throw md.create("token-subscribe-no-token");return s.token}(e,t),i={token:n,createTime:Date.now(),subscriptionOptions:t};return await fd(e,i),i.token}function Td(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const i=t.notification.body;i&&(e.notification.body=i);const r=t.notification.image;r&&(e.notification.image=r);const s=t.notification.icon;s&&(e.notification.icon=s)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){if(!t.fcmOptions&&!t.notification?.click_action)return;e.fcmOptions={};const n=t.fcmOptions?.link??t.notification?.click_action;n&&(e.fcmOptions.link=n);const i=t.fcmOptions?.analytics_label;i&&(e.fcmOptions.analyticsLabel=i)}(t,e),t}function Ed(e){return md.create("missing-app-config-values",{valueName:e})}class Id{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const i=function(e){if(!e||!e.options)throw Ed("App Configuration Object");if(!e.name)throw Ed("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw Ed(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:i,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}async function Sd(e){try{e.swRegistration=await navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,n)=>{const i=setTimeout(()=>n(new Error("Service worker not registered after 10000 ms")),id),r=e.installing||e.waiting;e.active?(clearTimeout(i),t()):r?r.onstatechange=e=>{"activated"===e.target?.state&&(r.onstatechange=null,clearTimeout(i),t())}:(clearTimeout(i),n(new Error("No incoming service worker found.")))})}(e.swRegistration)}catch(e){throw md.create("failed-service-worker-registration",{browserErrorMessage:e?.message})}}async function kd(e,t){if(!navigator)throw md.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw md.create("permission-blocked");return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=td)}(e,t?.vapidKey),await async function(e,t){if(t||e.swRegistration||await Sd(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw md.create("invalid-sw-registration");e.swRegistration=t}}(e,t?.serviceWorkerRegistration),bd(e)}async function Cd(e,t,n){const i=function(e){switch(e){case sd.NOTIFICATION_CLICKED:return"notification_open";case sd.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(i,{message_id:n[nd],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function Ad(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===sd.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(Td(n)):e.onMessageHandler.next(Td(n)));const i=n.data;var r;"object"==typeof(r=i)&&r&&nd in r&&"1"===i["google.c.a.e"]&&await Cd(e,n.messageType,i)}const Pd="@firebase/messaging",Rd="0.12.23",Od=e=>{const t=new Id(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>Ad(t,e)),t},xd=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>kd(t,e)}};let Nd;Xi(new Fn("messaging",Od,"PUBLIC")),Xi(new Fn("messaging-internal",xd,"PRIVATE")),rr(Pd,Rd),rr(Pd,Rd,"esm2020"),Ta().useDeviceLanguage(),(async()=>{await async function(){try{await kn()}catch(e){return!1}return"undefined"!=typeof window&&Sn()&&Cn()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}()&&(Nd=Xu(Pl))})(),navigator,window;let Dd=!1;window.addEventListener("userEmailChanged",()=>{Dd=!0}),function(e,t,n,i){$n(e).onAuthStateChanged(t,n,i)}(xl,e=>{e?(Zt.dispatch(Lt(!0)),Zt.dispatch(Mt()),Zt.dispatch(qt(e.uid)),Zt.dispatch(Wt(e.displayName||"John Doe")),Zt.dispatch(Gt(e.email||"")),Zt.dispatch(Jt(e.photoURL||"")),Zt.dispatch(Dt(e.displayName||"John Doe")),Zt.dispatch(Nt(e.photoURL||"")),Dd&&!e.emailVerified?ho(e).then(()=>{Dd=!1}).catch(e=>{Dd=!1}):e.emailVerified):(Zt.dispatch(Lt(!1)),Zt.dispatch(qt("")),Zt.dispatch(Wt("John Doe")),Zt.dispatch(Gt("")),Zt.dispatch(Jt("")),Zt.dispatch(Dt("John Doe")),Zt.dispatch(Nt("")))});const Ld=async()=>function(e){return $n(e).signOut()}(xl);var Ud=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},Md=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let jd=class extends se{constructor(){super(),this.source="",this.email="",this.password="",this.newAccount=async(e,t)=>{await co(xl,e,t).then(e=>{ho(e.user).then(()=>{})}).then(()=>{(async()=>{Zu(Nd,"create_account")})()})}}static get styles(){return[rn,Ll,Ul,Dl,Ml,s`
330
+ `}change(){wn.dispatch(Jt(this.source))}handleEmail(e){const t=e.target;this.email=t.value}handlePassword(e){const t=e.target;this.password=t.value}_handleSubmit(e){e.preventDefault()}login(){this.email.length<4?alert("Please enter an email address."):this.password.length<4?alert("Please enter a password."):this.signIn(this.email,this.password)}};Vg([ue({type:String}),Bg("design:type",Object)],zg.prototype,"source",void 0),Vg([he(),Bg("design:type",Object)],zg.prototype,"email",void 0),Vg([he(),Bg("design:type",Object)],zg.prototype,"password",void 0),zg=Vg([ae("form-login"),Bg("design:paramtypes",[])],zg);const qg="@firebase/installations",Hg="0.6.19",Kg=1e4,Wg=`w:${Hg}`,Gg="FIS_v2",Xg=36e5,Qg=new Qn("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function Jg(e){return e instanceof Xn&&e.code.includes("request-failed")}function Yg({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function Zg(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function em(e,t){const n=(await t.json()).error;return Qg.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function tm({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function nm(e,{refreshToken:t}){const n=tm(e);return n.append("Authorization",function(e){return`${Gg} ${e}`}(t)),n}async function rm(e){const t=await e();return t.status>=500&&t.status<600?e():t}function im(e){return new Promise(t=>{setTimeout(t,e)})}const sm=/^[cdef][\w-]{21}$/;function om(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(n=e,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return t.substr(0,22)}(e);return sm.test(t)?t:""}catch{return""}}function am(e){return`${e.appName}!${e.appId}`}const cm=new Map;function lm(e,t){const n=am(e);um(n,t),function(e,t){const n=function(){!hm&&"BroadcastChannel"in self&&(hm=new BroadcastChannel("[Firebase] FID Change"),hm.onmessage=e=>{um(e.data.key,e.data.fid)});return hm}();n&&n.postMessage({key:e,fid:t});0===cm.size&&hm&&(hm.close(),hm=null)}(n,t)}function um(e,t){const n=cm.get(e);if(n)for(const e of n)e(t)}let hm=null;const dm="firebase-installations-store";let pm=null;function fm(){return pm||(pm=Rr("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(dm)}})),pm}async function gm(e,t){const n=am(e),r=(await fm()).transaction(dm,"readwrite"),i=r.objectStore(dm),s=await i.get(n);return await i.put(t,n),await r.done,s&&s.fid===t.fid||lm(e,t.fid),t}async function mm(e){const t=am(e),n=(await fm()).transaction(dm,"readwrite");await n.objectStore(dm).delete(t),await n.done}async function ym(e,t){const n=am(e),r=(await fm()).transaction(dm,"readwrite"),i=r.objectStore(dm),s=await i.get(n),o=t(s);return void 0===o?await i.delete(n):await i.put(o,n),await r.done,!o||s&&s.fid===o.fid||lm(e,o.fid),o}async function _m(e){let t;const n=await ym(e.appConfig,n=>{const r=function(e){const t=e||{fid:om(),registrationStatus:0};return bm(t)}(n),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(Qg.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const r=Yg(e),i=tm(e),s=t.getImmediate({optional:!0});if(s){const e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const o={fid:n,authVersion:Gg,appId:e.appId,sdkVersion:Wg},a={method:"POST",headers:i,body:JSON.stringify(o)},c=await rm(()=>fetch(r,a));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:Zg(e.authToken)}}throw await em("Create Installation",c)}(e,t);return gm(e.appConfig,n)}catch(n){throw Jg(n)&&409===n.customData.serverCode?await mm(e.appConfig):await gm(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:r}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:wm(e)}:{installationEntry:t}}(e,r);return t=i.registrationPromise,i.installationEntry});return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function wm(e){let t=await vm(e.appConfig);for(;1===t.registrationStatus;)await im(100),t=await vm(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await _m(e);return n||t}return t}function vm(e){return ym(e,e=>{if(!e)throw Qg.create("installation-not-found");return bm(e)})}function bm(e){return 1===(t=e).registrationStatus&&t.registrationTime+Kg<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function Em({appConfig:e,heartbeatServiceProvider:t},n){const r=function(e,{fid:t}){return`${Yg(e)}/${t}/authTokens:generate`}(e,n),i=nm(e,n),s=t.getImmediate({optional:!0});if(s){const e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const o={installation:{sdkVersion:Wg,appId:e.appId}},a={method:"POST",headers:i,body:JSON.stringify(o)},c=await rm(()=>fetch(r,a));if(c.ok){return Zg(await c.json())}throw await em("Generate Auth Token",c)}async function Tm(e,t=!1){let n;const r=await ym(e.appConfig,r=>{if(!Sm(r))throw Qg.create("not-registered");const i=r.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+Xg}(e)}(i))return r;if(1===i.requestStatus)return n=async function(e,t){let n=await Im(e.appConfig);for(;1===n.authToken.requestStatus;)await im(100),n=await Im(e.appConfig);const r=n.authToken;return 0===r.requestStatus?Tm(e,t):r}(e,t),r;{if(!navigator.onLine)throw Qg.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return{...e,authToken:t}}(r);return n=async function(e,t){try{const n=await Em(e,t),r={...t,authToken:n};return await gm(e.appConfig,r),n}catch(n){if(!Jg(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n={...t,authToken:{requestStatus:0}};await gm(e.appConfig,n)}else await mm(e.appConfig);throw n}}(e,t),t}});return n?await n:r.authToken}function Im(e){return ym(e,e=>{if(!Sm(e))throw Qg.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+Kg<Date.now()?{...e,authToken:{requestStatus:0}}:e;var n})}function Sm(e){return void 0!==e&&2===e.registrationStatus}async function Cm(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await _m(e);t&&await t}(n);return(await Tm(n,t)).token}function km(e){return Qg.create("missing-app-config-values",{valueName:e})}const Am="installations",Rm=e=>{const t=_i(e.getProvider("app").getImmediate(),Am).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:r}=await _m(t);return r?r.catch(console.error):Tm(t).catch(console.error),n.fid}(t),getToken:e=>Cm(t,e)}};yi(new ar(Am,e=>{const t=e.getProvider("app").getImmediate(),n=function(e){if(!e||!e.options)throw km("App Configuration");if(!e.name)throw km("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw km(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:_i(t,"heartbeat"),_delete:()=>Promise.resolve()}},"PUBLIC")),yi(new ar("installations-internal",Rm,"PRIVATE")),Si(qg,Hg),Si(qg,Hg,"esm2020");const Om="analytics",Pm="https://www.googletagmanager.com/gtag/js",xm=new mr("@firebase/analytics"),Nm=new Qn("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."});function Dm(e){if(!e.startsWith(Pm)){const t=Nm.create("invalid-gtag-resource",{gtagURL:e});return xm.warn(t.message),""}return e}function Lm(e){return Promise.all(e.map(e=>e.catch(e=>e)))}function Mm(e,t){const n=function(e,t){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(e,t)),n}("firebase-js-sdk-policy",{createScriptURL:Dm}),r=document.createElement("script"),i=`${Pm}?l=${e}&id=${t}`;r.src=n?n?.createScriptURL(i):i,r.async=!0,document.head.appendChild(r)}function Um(e,t,n,r){return async function(i,...s){try{if("event"===i){const[r,i]=s;await async function(e,t,n,r,i){try{let s=[];if(i&&i.send_to){let e=i.send_to;Array.isArray(e)||(e=[e]);const r=await Lm(n);for(const n of e){const e=r.find(e=>e.measurementId===n),i=e&&t[e.appId];if(!i){s=[];break}s.push(i)}}0===s.length&&(s=Object.values(t)),await Promise.all(s),e("event",r,i||{})}catch(e){xm.error(e)}}(e,t,n,r,i)}else if("config"===i){const[i,o]=s;await async function(e,t,n,r,i,s){const o=r[i];try{if(o)await t[o];else{const e=(await Lm(n)).find(e=>e.measurementId===i);e&&await t[e.appId]}}catch(e){xm.error(e)}e("config",i,s)}(e,t,n,r,i,o)}else if("consent"===i){const[t,n]=s;e("consent",t,n)}else if("get"===i){const[t,n,r]=s;e("get",t,n,r)}else if("set"===i){const[t]=s;e("set",t)}else e(i,...s)}catch(e){xm.error(e)}}}const $m=new class{constructor(e={},t=1e3){this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}};function Fm(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function jm(e,t=$m,n){const{appId:r,apiKey:i,measurementId:s}=e.options;if(!r)throw Nm.create("no-app-id");if(!i){if(s)return{measurementId:s,appId:r};throw Nm.create("no-api-key")}const o=t.getThrottleMetadata(r)||{backoffCount:0,throttleEndTimeMillis:Date.now()},a=new Bm;return setTimeout(async()=>{a.abort()},6e4),Vm({appId:r,apiKey:i,measurementId:s},o,a,t)}async function Vm(e,{throttleEndTimeMillis:t,backoffCount:n},r,i=$m){const{appId:s,measurementId:o}=e;try{await function(e,t){return new Promise((n,r)=>{const i=Math.max(t-Date.now(),0),s=setTimeout(n,i);e.addEventListener(()=>{clearTimeout(s),r(Nm.create("fetch-throttle",{throttleEndTimeMillis:t}))})})}(r,t)}catch(e){if(o)return xm.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${o} provided in the "measurementId" field in the local Firebase config. [${e?.message}]`),{appId:s,measurementId:o};throw e}try{const t=await async function(e){const{appId:t,apiKey:n}=e,r={method:"GET",headers:Fm(n)},i="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",t),s=await fetch(i,r);if(200!==s.status&&304!==s.status){let e="";try{const t=await s.json();t.error?.message&&(e=t.error.message)}catch(e){}throw Nm.create("config-fetch-failed",{httpStatus:s.status,responseMessage:e})}return s.json()}(e);return i.deleteThrottleMetadata(s),t}catch(t){const a=t;if(!function(e){if(!(e instanceof Xn&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(a)){if(i.deleteThrottleMetadata(s),o)return xm.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${o} provided in the "measurementId" field in the local Firebase config. [${a?.message}]`),{appId:s,measurementId:o};throw t}const c=503===Number(a?.customData?.httpStatus)?sr(n,i.intervalMillis,30):sr(n,i.intervalMillis),l={throttleEndTimeMillis:Date.now()+c,backoffCount:n+1};return i.setThrottleMetadata(s,l),xm.debug(`Calling attemptFetch again in ${c} millis`),Vm(e,l,r,i)}}class Bm{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}async function zm(e,t,n,r,i,s,o){const a=jm(e);a.then(t=>{n[t.measurementId]=t.appId,e.options.measurementId&&t.measurementId!==e.options.measurementId&&xm.warn(`The measurement ID in the local Firebase config (${e.options.measurementId}) does not match the measurement ID fetched from the server (${t.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)}).catch(e=>xm.error(e)),t.push(a);const c=async function(){if(!Kn())return xm.warn(Nm.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await Wn()}catch(e){return xm.warn(Nm.create("indexeddb-unavailable",{errorInfo:e?.toString()}).message),!1}return!0}().then(e=>e?r.getId():void 0),[l,u]=await Promise.all([a,c]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(Pm)&&n.src.includes(e))return n;return null})(s)||Mm(s,l.measurementId),i("js",new Date);const h=o?.config??{};return h.origin="firebase",h.update=!0,null!=u&&(h.firebase_id=u),i("config",l.measurementId,h),l.measurementId}class qm{constructor(e){this.app=e}_delete(){return delete Hm[this.app.options.appId],Promise.resolve()}}let Hm={},Km=[];const Wm={};let Gm,Xm,Qm="dataLayer",Jm=!1;function Ym(e,t,n){!function(){const e=[];if(qn()&&e.push("This is a browser extension environment."),Gn()||e.push("Cookies are not available."),e.length>0){const t=e.map((e,t)=>`(${t+1}) ${e}`).join(" "),n=Nm.create("invalid-analytics-context",{errorInfo:t});xm.warn(n.message)}}();const r=e.options.appId;if(!r)throw Nm.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw Nm.create("no-api-key");xm.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${e.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=Hm[r])throw Nm.create("already-exists",{id:r});if(!Jm){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(Qm);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,r,i){let s=function(...e){window[r].push(arguments)};return window[i]&&"function"==typeof window[i]&&(s=window[i]),window[i]=Um(s,e,t,n),{gtagCore:s,wrappedGtag:window[i]}}(Hm,Km,Wm,Qm,"gtag");Xm=e,Gm=t,Jm=!0}Hm[r]=zm(e,Km,Wm,t,Gm,Qm,n);return new qm(e)}function Zm(e=Ii()){const t=_i(e=or(e),Om);return t.isInitialized()?t.getImmediate():function(e,t={}){const n=_i(e,Om);if(n.isInitialized()){const e=n.getImmediate();if(Yn(t,n.getOptions()))return e;throw Nm.create("already-initialized")}const r=n.initialize({options:t});return r}(e)}function ey(e,t,n){e=or(e),async function(e,t,n,r){if(r&&r.global){const t={};for(const e of Object.keys(n))t[`user_properties.${e}`]=n[e];return e("set",t),Promise.resolve()}e("config",await t,{update:!0,user_properties:n})}(Xm,Hm[e.app.options.appId],t,n).catch(e=>xm.error(e))}function ty(e,t,n,r){e=or(e),async function(e,t,n,r,i){if(i&&i.global)e("event",n,r);else{const i=await t;e("event",n,{...r,send_to:i})}}(Xm,Hm[e.app.options.appId],t,n,r).catch(e=>xm.error(e))}const ny="@firebase/analytics",ry="0.10.19";yi(new ar(Om,(e,{options:t})=>Ym(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t),"PUBLIC")),yi(new ar("analytics-internal",function(e){try{const t=e.getProvider(Om).getImmediate();return{logEvent:(e,n,r)=>ty(t,e,n,r),setUserProperties:(e,n)=>ey(t,e,n)}}catch(e){throw Nm.create("interop-component-reg-failed",{reason:e})}},"PRIVATE")),Si(ny,ry),Si(ny,ry,"esm2020");const iy="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",sy="google.c.a.c_id",oy=1e4;var ay,cy;function ly(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function uy(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;++e)r[e]=n.charCodeAt(e);return r}!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(ay||(ay={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(cy||(cy={}));const hy="fcm_token_details_db",dy="fcm_token_object_Store";const py="firebase-messaging-store";let fy=null;function gy(){return fy||(fy=Rr("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(py)}})),fy}async function my(e){const t=_y(e),n=await gy(),r=await n.transaction(py).objectStore(py).get(t);if(r)return r;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(hy))return null}let t=null;return(await Rr(hy,5,{upgrade:async(n,r,i,s)=>{if(r<2)return;if(!n.objectStoreNames.contains(dy))return;const o=s.objectStore(dy),a=await o.index("fcmSenderId").get(e);if(await o.clear(),a)if(2===r){const e=a;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:e.createTime??Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:ly(e.vapidKey)}}}else if(3===r){const e=a;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:ly(e.auth),p256dh:ly(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:ly(e.vapidKey)}}}else if(4===r){const e=a;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:ly(e.auth),p256dh:ly(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:ly(e.vapidKey)}}}}})).close(),await Or(hy),await Or("fcm_vapid_details_db"),await Or("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await yy(e,t),t}}async function yy(e,t){const n=_y(e),r=(await gy()).transaction(py,"readwrite");return await r.objectStore(py).put(t,n),await r.done,t}function _y({appConfig:e}){return e.appId}const wy=new Qn("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});function vy({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function by({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function Ey({p256dh:e,auth:t,endpoint:n,vapidKey:r}){const i={web:{endpoint:n,auth:t,p256dh:e}};return r!==iy&&(i.web.applicationPubKey=r),i}async function Ty(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:uy(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:ly(t.getKey("auth")),p256dh:ly(t.getKey("p256dh"))},r=await my(e.firebaseDependencies);if(r){if(function(e,t){const n=t.vapidKey===e.vapidKey,r=t.endpoint===e.endpoint,i=t.auth===e.auth,s=t.p256dh===e.p256dh;return n&&r&&i&&s}(r.subscriptionOptions,n))return Date.now()>=r.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await by(e),r=Ey(t.subscriptionOptions),i={method:"PATCH",headers:n,body:JSON.stringify(r)};let s;try{const n=await fetch(`${vy(e.appConfig)}/${t.token}`,i);s=await n.json()}catch(e){throw wy.create("token-update-failed",{errorInfo:e?.toString()})}if(s.error){const e=s.error.message;throw wy.create("token-update-failed",{errorInfo:e})}if(!s.token)throw wy.create("token-update-no-token");return s.token}(e.firebaseDependencies,t),r={...t,token:n,createTime:Date.now()};return await yy(e.firebaseDependencies,r),n}catch(e){throw e}}(e,{token:r.token,createTime:Date.now(),subscriptionOptions:n}):r.token;try{await async function(e,t){const n={method:"DELETE",headers:await by(e)};try{const r=await fetch(`${vy(e.appConfig)}/${t}`,n),i=await r.json();if(i.error){const e=i.error.message;throw wy.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw wy.create("token-unsubscribe-failed",{errorInfo:e?.toString()})}}(e.firebaseDependencies,r.token)}catch(e){}return Iy(e.firebaseDependencies,n)}return Iy(e.firebaseDependencies,n)}async function Iy(e,t){const n=await async function(e,t){const n=await by(e),r=Ey(t),i={method:"POST",headers:n,body:JSON.stringify(r)};let s;try{const t=await fetch(vy(e.appConfig),i);s=await t.json()}catch(e){throw wy.create("token-subscribe-failed",{errorInfo:e?.toString()})}if(s.error){const e=s.error.message;throw wy.create("token-subscribe-failed",{errorInfo:e})}if(!s.token)throw wy.create("token-subscribe-no-token");return s.token}(e,t),r={token:n,createTime:Date.now(),subscriptionOptions:t};return await yy(e,r),r.token}function Sy(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const r=t.notification.body;r&&(e.notification.body=r);const i=t.notification.image;i&&(e.notification.image=i);const s=t.notification.icon;s&&(e.notification.icon=s)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){if(!t.fcmOptions&&!t.notification?.click_action)return;e.fcmOptions={};const n=t.fcmOptions?.link??t.notification?.click_action;n&&(e.fcmOptions.link=n);const r=t.fcmOptions?.analytics_label;r&&(e.fcmOptions.analyticsLabel=r)}(t,e),t}function Cy(e){return wy.create("missing-app-config-values",{valueName:e})}class ky{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const r=function(e){if(!e||!e.options)throw Cy("App Configuration Object");if(!e.name)throw Cy("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw Cy(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:r,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}async function Ay(e){try{e.swRegistration=await navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,n)=>{const r=setTimeout(()=>n(new Error("Service worker not registered after 10000 ms")),oy),i=e.installing||e.waiting;e.active?(clearTimeout(r),t()):i?i.onstatechange=e=>{"activated"===e.target?.state&&(i.onstatechange=null,clearTimeout(r),t())}:(clearTimeout(r),n(new Error("No incoming service worker found.")))})}(e.swRegistration)}catch(e){throw wy.create("failed-service-worker-registration",{browserErrorMessage:e?.message})}}async function Ry(e,t){if(!navigator)throw wy.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw wy.create("permission-blocked");return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=iy)}(e,t?.vapidKey),await async function(e,t){if(t||e.swRegistration||await Ay(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw wy.create("invalid-sw-registration");e.swRegistration=t}}(e,t?.serviceWorkerRegistration),Ty(e)}async function Oy(e,t,n){const r=function(e){switch(e){case cy.NOTIFICATION_CLICKED:return"notification_open";case cy.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:n[sy],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function Py(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===cy.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(Sy(n)):e.onMessageHandler.next(Sy(n)));const r=n.data;var i;"object"==typeof(i=r)&&i&&sy in i&&"1"===r["google.c.a.e"]&&await Oy(e,n.messageType,r)}const xy="@firebase/messaging",Ny="0.12.23",Dy=e=>{const t=new ky(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>Py(t,e)),t},Ly=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>Ry(t,e)}};let My;yi(new ar("messaging",Dy,"PUBLIC")),yi(new ar("messaging-internal",Ly,"PRIVATE")),Si(xy,Ny),Si(xy,Ny,"esm2020"),za().useDeviceLanguage(),(async()=>{await async function(){try{await Wn()}catch(e){return!1}return"undefined"!=typeof window&&Kn()&&Gn()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}()&&(My=Zm(xg))})(),navigator,window;let Uy=!1;window.addEventListener("userEmailChanged",()=>{Uy=!0}),function(e,t,n,r){or(e).onAuthStateChanged(t,n,r)}(Lg,e=>{e?(wn.dispatch(tn(!0)),wn.dispatch(rn()),wn.dispatch(dn(e.uid)),wn.dispatch(pn(e.displayName||"John Doe")),wn.dispatch(gn(e.email||"")),wn.dispatch(mn(e.photoURL||"")),wn.dispatch(en(e.displayName||"John Doe")),wn.dispatch(Zt(e.photoURL||"")),Uy&&!e.emailVerified?Po(e).then(()=>{Uy=!1}).catch(e=>{Uy=!1}):e.emailVerified):(wn.dispatch(tn(!1)),wn.dispatch(dn("")),wn.dispatch(pn("John Doe")),wn.dispatch(gn("")),wn.dispatch(mn("")),wn.dispatch(en("John Doe")),wn.dispatch(Zt("")))});const $y=async()=>function(e){return or(e).signOut()}(Lg),Fy=async()=>{ty(My,"create_account")},jy=async()=>{ty(My,"delete_account")},Vy=async(e,t)=>{await tf(Lp(Ng,e,t))};var By=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},zy=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let qy=class extends se{constructor(){super(),this.source="",this.email="",this.password="",this.newAccount=async(e,t)=>{await Oo(Lg,e,t).then(e=>{Po(e.user).then(()=>{})}).then(()=>{Fy()})}}static get styles(){return[In,$g,Fg,Ug,jg,s`
331
331
 
332
332
  :host {
333
333
  background-color: white;
@@ -340,7 +340,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
340
340
 
341
341
  form { display: grid; }
342
342
 
343
- `]}render(){return B`
343
+ `]}render(){return V`
344
344
 
345
345
  <!-- Sign Up State-->
346
346
  <form
@@ -404,7 +404,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
404
404
 
405
405
  </form>
406
406
 
407
- `}change(){Zt.dispatch(Ot(this.source))}_handleSubmit(e){e.preventDefault()}handleEmail(e){const t=e.target;this.email=t.value}handlePassword(e){const t=e.target;this.password=t.value}signUp(){this.email.length<4?alert("Please enter an email address."):this.password.length<4?alert("Please enter a password."):this.newAccount(this.email,this.password)}};Ud([le({type:String}),Md("design:type",Object)],jd.prototype,"source",void 0),Ud([ue(),Md("design:type",Object)],jd.prototype,"email",void 0),Ud([ue(),Md("design:type",Object)],jd.prototype,"password",void 0),jd=Ud([ae("form-signup"),Md("design:paramtypes",[])],jd);var $d=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},Fd=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let Bd=class extends(de(Zt)(se)){constructor(){super(),this.subscribe=!1,this._name="",this._log=!1,this._sign=!1}stateChanged(e){this._name=e.backend.name,this._log=e.frontend.login,this._sign=e.frontend.registerTwo}static get styles(){return[Qt,en,tn,rn,nn]}render(){return B`
407
+ `}change(){wn.dispatch(Jt(this.source))}_handleSubmit(e){e.preventDefault()}handleEmail(e){const t=e.target;this.email=t.value}handlePassword(e){const t=e.target;this.password=t.value}signUp(){this.email.length<4?alert("Please enter an email address."):this.password.length<4?alert("Please enter a password."):this.newAccount(this.email,this.password)}};By([ue({type:String}),zy("design:type",Object)],qy.prototype,"source",void 0),By([he(),zy("design:type",Object)],qy.prototype,"email",void 0),By([he(),zy("design:type",Object)],qy.prototype,"password",void 0),qy=By([ae("form-signup"),zy("design:paramtypes",[])],qy);var Hy=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},Ky=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let Wy=class extends(de(wn)(se)){constructor(){super(),this.subscribe=!1,this._name="",this._log=!1,this._sign=!1}stateChanged(e){this._name=e.backend.name,this._log=e.frontend.login,this._sign=e.frontend.registerTwo}static get styles(){return[vn,bn,En,In,Tn]}render(){return V`
408
408
 
409
409
  <section class="service">
410
410
 
@@ -440,25 +440,29 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
440
440
  class= "spec setLog"
441
441
  ?on= "${!0===this._log}">
442
442
 
443
- <slot></slot>
443
+ <slot name="content"></slot>
444
444
 
445
445
  </div>
446
446
 
447
447
  </section>
448
448
 
449
- `}};$d([le({type:Boolean,attribute:!0,reflect:!0}),Fd("design:type",Object)],Bd.prototype,"subscribe",void 0),$d([ue(),Fd("design:type",Object)],Bd.prototype,"_name",void 0),$d([ue(),Fd("design:type",Object)],Bd.prototype,"_log",void 0),$d([ue(),Fd("design:type",Object)],Bd.prototype,"_sign",void 0),Bd=$d([ae("user-login"),Fd("design:paramtypes",[])],Bd),B`<svg viewBox="0 0 24 24" height="34px" width="34px"><path d="M9 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm6 0c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c.78 0 1.53-.09 2.25-.26.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8z"></path></svg>`,B`<svg viewBox="0 0 24 24"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"></path></svg>`;const zd=B`<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>`,Hd=s`
449
+ `}};Hy([ue({type:Boolean,attribute:!0,reflect:!0}),Ky("design:type",Object)],Wy.prototype,"subscribe",void 0),Hy([he(),Ky("design:type",Object)],Wy.prototype,"_name",void 0),Hy([he(),Ky("design:type",Object)],Wy.prototype,"_log",void 0),Hy([he(),Ky("design:type",Object)],Wy.prototype,"_sign",void 0),Wy=Hy([ae("user-login"),Ky("design:paramtypes",[])],Wy),V`<svg viewBox="0 0 24 24" height="34px" width="34px"><path d="M9 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm6 0c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c.78 0 1.53-.09 2.25-.26.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8z"></path></svg>`,V`<svg viewBox="0 0 24 24"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"></path></svg>`;const Gy=V`<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>`,Xy=s`
450
450
 
451
451
  .spec[on] { display: grid; }
452
452
  .spec { display: none; }
453
453
 
454
- `,Vd=s`
454
+ `,Qy=s`
455
455
 
456
456
  :host {
457
- position: absolute;
457
+ position: var(--pwa_drawer_position, fixed);
458
+ z-index: 4;
458
459
  max-height: 0px;
459
- transition: max-height 1.4s ease-out;
460
+ transition: max-height 1.4s ease-in-out;
460
461
  overflow: hidden;
461
462
  height: auto;
463
+ width: 100%;
464
+ box-sizing: border-box;
465
+ -webkit-box-sizing: border-box;
462
466
  display: grid;
463
467
  padding-top: env(safe-area-inset-top);
464
468
  }
@@ -475,10 +479,10 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
475
479
 
476
480
  .userDrawer {
477
481
  display: grid;
478
- position: fixed;
479
- top: 0;
482
+ position: relative;
483
+ /* top: 0;
480
484
  left: 0;
481
- right: 0;
485
+ right: 0; */
482
486
  transition-duration: 1.4s;
483
487
  overflow: hidden;
484
488
  box-sizing: border-box;
@@ -498,29 +502,30 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
498
502
  .in {
499
503
  max-height: 0px;
500
504
  visibility: hidden;
501
- transition: max-height 1.4s ease-out, visibility 0s linear 1.4s, transform 1.4s;
505
+ transition: max-height 1.4s ease-in-out, visibility 0s linear 1.4s, transform 1.4s;
502
506
  }
503
507
 
504
508
  .spec-in {
505
- transform: translate3d(0, -150%, 0);
506
- transition: transform 2.4s;
509
+ transform: translate3d(0, -100%, 0);
510
+ transition: transform 1.5s;
507
511
  z-index: -1;
512
+ animation-timing-function: linear;
508
513
  }
509
514
 
510
515
  .out {
511
516
  max-height: 100%;
512
517
  visibility: visible;
513
- transition: max-height 1.4s ease-out, visibility 0s, transform 1.4s;
518
+ transition: max-height 1.4s ease-in-out, visibility 0s, transform 1.4s;
514
519
  }
515
520
 
516
521
  .spec-out {
517
522
  transform: translate3d(0, 0, 0);
518
- transition: transform 1.6s;
523
+ transition: transform 2.2s;
519
524
  z-index: -1;
520
- animation-timing-function: ease-out;
525
+ animation-timing-function: linear;
521
526
  }
522
527
 
523
- `,qd=s`
528
+ `,Jy=s`
524
529
 
525
530
  .exit {
526
531
  display: grid;
@@ -572,7 +577,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
572
577
 
573
578
 
574
579
 
575
- `,Wd=s`
580
+ `,Yy=s`
576
581
 
577
582
  a {
578
583
  text-transform: uppercase;
@@ -582,15 +587,27 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
582
587
  text-decoration: none;
583
588
  }
584
589
 
585
- `,Kd=s`
590
+ `,Zy=s`
586
591
 
587
- .setLog > p {
588
- margin: 12px;
589
- box-sizing: border-box;
590
- text-align: center;
592
+ .setLog > a {
593
+ padding: 16px;
594
+ margin: 16px;
595
+ border: 2px solid grey;
596
+ border-radius: 6px;
597
+ box-sizing: border-box;
598
+ text-align: center;
599
+ cursor: pointer;
600
+ }
601
+
602
+ .setLog > button {
603
+ cursor: pointer;
604
+ padding: 16px;
605
+ margin: 16px;
606
+ border-radius: 6px;
591
607
  }
592
608
 
593
- `;var Gd=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},Jd=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let Xd=class extends(de(Zt)(se)){constructor(){super(),this.url="",this.drawer=!1,this.subscribe=!1,this.name="",this.user=!1,this.signup=!1}stateChanged(e){this.name=e.backend.name,this.drawer=e.frontend.drawer,this.user=e.frontend.login,this.signup=e.frontend.registerOne}firstUpdated(){this.shadowRoot.querySelector(".close").addEventListener("click",()=>{Zt.dispatch(Ut())}),this.shadowRoot.querySelector(".leave").addEventListener("click",()=>{this.user&&Ld(),Zt.dispatch(Ut())})}static get styles(){return[Hd,nn,Vd,qd,Wd,Kd,rn]}render(){return B`
609
+
610
+ `;var e_=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},t_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let n_=class extends(de(wn)(se)){constructor(){super(),this.url="",this.drawer=!1,this.subscribe=!1,this.name="",this.user=!1,this.signup=!1}stateChanged(e){this.name=e.backend.name,this.drawer=e.frontend.drawer,this.user=e.frontend.login,this.signup=e.frontend.registerOne}firstUpdated(){this.shadowRoot.querySelector(".close").addEventListener("click",()=>{wn.dispatch(nn())}),this.shadowRoot.querySelector(".leave").addEventListener("click",()=>{this.user&&$y(),wn.dispatch(nn())})}static get styles(){return[Xy,Tn,Qy,Jy,Yy,Zy,In]}render(){return V`
594
611
 
595
612
  <!-- Drawer Wrapper -->
596
613
  <section
@@ -600,7 +617,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
600
617
  <header class="exit">
601
618
  <div></div>
602
619
  <h3>${!1===this.user?this.signup===this.subscribe?"Login":"Subscribe":this.name}</h3>
603
- <button class="close">${zd}</button>
620
+ <button class="close">${Gy}</button>
604
621
  </header>
605
622
 
606
623
  <!-- Logged-out State -->
@@ -633,15 +650,19 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
633
650
  class="spec setLog"
634
651
  ?on="${!0===this.user}">
635
652
 
636
- <p><a href="${this.url}">Settings</a></p>
653
+ <slot name="before"></slot>
654
+
655
+ <a href="${this.url}">Settings</a>
637
656
 
638
- <p><a class="leave" aria-label="log out">log out</a></p>
657
+ <slot name="within"></slot>
658
+
659
+ <button class="leave" aria-label="log out">log out</button>
639
660
 
640
661
  </div>
641
662
 
642
663
  </section>
643
664
 
644
- `}};Gd([le({type:String,reflect:!0}),Jd("design:type",Object)],Xd.prototype,"url",void 0),Gd([le({type:Boolean,attribute:!0,reflect:!0}),Jd("design:type",Object)],Xd.prototype,"drawer",void 0),Gd([le({type:Boolean,attribute:!0,reflect:!0}),Jd("design:type",Object)],Xd.prototype,"subscribe",void 0),Gd([ue(),Jd("design:type",Object)],Xd.prototype,"name",void 0),Gd([ue(),Jd("design:type",Object)],Xd.prototype,"user",void 0),Gd([ue(),Jd("design:type",Object)],Xd.prototype,"signup",void 0),Xd=Gd([ae("user-drawer"),Jd("design:paramtypes",[])],Xd);const Yd=s`
665
+ `}};e_([ue({type:String,reflect:!0}),t_("design:type",Object)],n_.prototype,"url",void 0),e_([ue({type:Boolean,attribute:!0,reflect:!0}),t_("design:type",Object)],n_.prototype,"drawer",void 0),e_([ue({type:Boolean,attribute:!0,reflect:!0}),t_("design:type",Object)],n_.prototype,"subscribe",void 0),e_([he(),t_("design:type",Object)],n_.prototype,"name",void 0),e_([he(),t_("design:type",Object)],n_.prototype,"user",void 0),e_([he(),t_("design:type",Object)],n_.prototype,"signup",void 0),n_=e_([ae("user-drawer"),t_("design:paramtypes",[])],n_);const r_=s`
645
666
 
646
667
  nav {
647
668
  overflow: hidden;
@@ -709,7 +730,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
709
730
  box-shadow: 0px 6px 6px -6px;
710
731
  }
711
732
 
712
- `;var Zd=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},Qd=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class ep extends(de(Zt)(se)){constructor(){super(),this.photo="",this.emptyArtwork="",this.user="",this.login=!1,this.progress=0,this.error="",this.status="",this.dispatchPhoto=async e=>{xl.currentUser&&(await lo(xl.currentUser,{photoURL:e}).catch(e=>{}),Zt.dispatch(Jt(e)))},this.progress=0,this.error="",this.status=""}stateChanged(e){this.login=e.frontend.login,this.user=e.backend.userId,this.photo=e.backend.photoURL}static get styles(){return[Ll,s`
733
+ `;var i_=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},s_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class o_ extends(de(wn)(se)){constructor(){super(),this.photo="",this.emptyArtwork="",this.user="",this.login=!1,this.progress=0,this.error="",this.status="",this.dispatchPhoto=async e=>{Lg.currentUser&&(await xo(Lg.currentUser,{photoURL:e}).catch(e=>{}),wn.dispatch(mn(e)))},this.progress=0,this.error="",this.status=""}stateChanged(e){this.login=e.frontend.login,this.user=e.backend.userId,this.photo=e.backend.photoURL}static get styles(){return[$g,s`
713
734
 
714
735
  :host {
715
736
  box-sizing: border-box;
@@ -729,7 +750,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
729
750
  box-shadow: 1px 1px 2px black, 0 0 25px grey, 0 0 5px #fff;
730
751
  }
731
752
 
732
- `]}render(){return B`
753
+ `]}render(){return V`
733
754
  <label
734
755
  for="pwa-uploader"
735
756
  style="
@@ -795,11 +816,11 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
795
816
  </label>
796
817
 
797
818
  <p style="text-align:center;">${this.status}${this.error}</p>
798
- `}async saveImage(){const e=this.shadowRoot.querySelector(".uploader");if(xl.currentUser){this.error="",this.status="Uploading...";const i=this.shadowRoot.querySelector("#photoURL");if(!i)return;const r=(t=Ol,n="/pwa-auth/"+this.user+"/"+i.files[0].name,bl(t=$n(t),n)),s={cacheControl:"public,max-age=300",contentType:i.files[0].type},o=kl(r,i.files[0],s);o.on("state_changed",t=>{switch(this.progress=t.bytesTransferred/t.totalBytes*100,this.status=`Upload is ${Math.round(this.progress)}% done`,t.state){case"paused":this.status="Upload is paused";break;case"running":this.status=`Upload is running (${Math.round(this.progress)}%)`}let n=0;t.totalBytes>0&&(n=t.bytesTransferred/t.totalBytes*100),isFinite(n)?(e.value=n,e.textContent=`${Math.round(n)}%`):(e.value=0,e.textContent="0%")},t=>{this.error=`Upload failed: ${t.message}`,this.status="",e.value=0,e.textContent="Error"},async()=>{await function(e){return _l(e=$n(e))}(o.snapshot.ref).then(t=>{(function(e,t){return yl(e=$n(e),t)})(r,s).then(()=>{}).catch(e=>{}),Nl&&(lo(Nl,{photoURL:t}).then(()=>{e.value=100,e.textContent="Complete"}),this.status="User profile updated successfully!",this.dispatchPhoto(t))}).catch(()=>{})})}var t,n}}Zd([le(),Qd("design:type",Object)],ep.prototype,"photo",void 0),Zd([le({type:String,reflect:!0}),Qd("design:type",Object)],ep.prototype,"emptyArtwork",void 0),Zd([ue(),Qd("design:type",Object)],ep.prototype,"user",void 0),Zd([ue(),Qd("design:type",Boolean)],ep.prototype,"login",void 0),Zd([ue(),Qd("design:type",Number)],ep.prototype,"progress",void 0),Zd([ue(),Qd("design:type",String)],ep.prototype,"error",void 0),Zd([ue(),Qd("design:type",String)],ep.prototype,"status",void 0),customElements.define("contact-photo",ep);var tp=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},np=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class ip extends(de(Zt)(se)){constructor(){super(),this.value="",this.login=!1,this.default=e=>{e.preventDefault()},this.alertProfile=async()=>{xl.currentUser?await lo(xl.currentUser,{displayName:this.value}).then(()=>{Zt.dispatch(Wt(this.value))}).then(()=>{alert("updated name:"+this.value)}):alert("Please Login")}}stateChanged(e){this.login=e.frontend.login,this.value=e.backend.name}static get styles(){return[Ll,Ul,Dl,s`
819
+ `}async saveImage(){const e=this.shadowRoot.querySelector(".uploader");if(Lg.currentUser){this.error="",this.status="Uploading...";const r=this.shadowRoot.querySelector("#photoURL");if(!r)return;const i=(t=Dg,n="/pwa-auth/"+this.user+"/"+r.files[0].name,Tg(t=or(t),n)),s={cacheControl:"public,max-age=300",contentType:r.files[0].type},o=Rg(i,r.files[0],s);o.on("state_changed",t=>{switch(this.progress=t.bytesTransferred/t.totalBytes*100,this.status=`Upload is ${Math.round(this.progress)}% done`,t.state){case"paused":this.status="Upload is paused";break;case"running":this.status=`Upload is running (${Math.round(this.progress)}%)`}let n=0;t.totalBytes>0&&(n=t.bytesTransferred/t.totalBytes*100),isFinite(n)?(e.value=n,e.textContent=`${Math.round(n)}%`):(e.value=0,e.textContent="0%")},t=>{this.error=`Upload failed: ${t.message}`,this.status="",e.value=0,e.textContent="Error"},async()=>{await function(e){return bg(e=or(e))}(o.snapshot.ref).then(t=>{(function(e,t){return vg(e=or(e),t)})(i,s).then(()=>{}).catch(e=>{}),Mg&&(xo(Mg,{photoURL:t}).then(()=>{e.value=100,e.textContent="Complete"}),this.status="User profile updated successfully!",this.dispatchPhoto(t))}).catch(()=>{})})}var t,n}}i_([ue(),s_("design:type",Object)],o_.prototype,"photo",void 0),i_([ue({type:String,reflect:!0}),s_("design:type",Object)],o_.prototype,"emptyArtwork",void 0),i_([he(),s_("design:type",Object)],o_.prototype,"user",void 0),i_([he(),s_("design:type",Boolean)],o_.prototype,"login",void 0),i_([he(),s_("design:type",Number)],o_.prototype,"progress",void 0),i_([he(),s_("design:type",String)],o_.prototype,"error",void 0),i_([he(),s_("design:type",String)],o_.prototype,"status",void 0),customElements.define("contact-photo",o_);var a_=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},c_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class l_ extends(de(wn)(se)){constructor(){super(),this.value="",this.login=!1,this.default=e=>{e.preventDefault()},this.alertProfile=async()=>{Lg.currentUser?await xo(Lg.currentUser,{displayName:this.value}).then(()=>{wn.dispatch(pn(this.value))}).then(()=>{alert("updated name:"+this.value)}):alert("Please Login")}}stateChanged(e){this.login=e.frontend.login,this.value=e.backend.name}static get styles(){return[$g,Fg,Ug,s`
799
820
 
800
821
  :host, form { display: grid; }
801
822
 
802
- `]}render(){return B`
823
+ `]}render(){return V`
803
824
 
804
825
  <form
805
826
  @submit="${this.default}">
@@ -825,11 +846,11 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
825
846
 
826
847
  </form>
827
848
 
828
- `}handleInput(e){const t=e.target;this.value=t.value}}tp([le({type:String,reflect:!0}),np("design:type",Object)],ip.prototype,"value",void 0),tp([ue(),np("design:type",Boolean)],ip.prototype,"login",void 0),customElements.define("input-name",ip);var rp=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},sp=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class op extends(de(Zt)(se)){constructor(){super(),this.email="",this.login=!1,this.mail="",this.default=e=>{e.preventDefault()},this.saveEmail=async()=>{if(xl.currentUser){let e=this.shadowRoot?.querySelector("#pwa-email");await function(e,t){const n=$n(e);return Zi(n.auth.app)?Promise.reject(Er(n.auth)):uo(n,t,null)}(xl.currentUser,e.value).catch(e=>{});const t=new CustomEvent("userEmailChanged",{detail:{email:e.value}});window.dispatchEvent(t),alert("Email Updated")}}}stateChanged(e){this.login=e.frontend.login,this.mail=e.backend.email}handleEmail(e){const t=e.target;this.mail=t.value}static get styles(){return[Ll,Ul,Dl,s`
849
+ `}handleInput(e){const t=e.target;this.value=t.value}}a_([ue({type:String,reflect:!0}),c_("design:type",Object)],l_.prototype,"value",void 0),a_([he(),c_("design:type",Boolean)],l_.prototype,"login",void 0),customElements.define("input-name",l_);var u_=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},h_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class d_ extends(de(wn)(se)){constructor(){super(),this.email="",this.login=!1,this.mail="",this.default=e=>{e.preventDefault()},this.saveEmail=async()=>{if(Lg.currentUser){let e=this.shadowRoot?.querySelector("#pwa-email");await function(e,t){const n=or(e);return wi(n.auth.app)?Promise.reject(qi(n.auth)):No(n,t,null)}(Lg.currentUser,e.value).catch(e=>{});const t=new CustomEvent("userEmailChanged",{detail:{email:e.value}});window.dispatchEvent(t),alert("Email Updated")}}}stateChanged(e){this.login=e.frontend.login,this.mail=e.backend.email}handleEmail(e){const t=e.target;this.mail=t.value}static get styles(){return[$g,Fg,Ug,s`
829
850
 
830
851
  :host, form { display: grid; }
831
852
 
832
- `]}render(){return B`
853
+ `]}render(){return V`
833
854
 
834
855
  <form
835
856
  autocomplete="off"
@@ -857,7 +878,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
857
878
 
858
879
  </form>
859
880
 
860
- `}}rp([le({type:String,reflect:!0}),sp("design:type",Object)],op.prototype,"email",void 0),rp([ue(),sp("design:type",Boolean)],op.prototype,"login",void 0),rp([ue(),sp("design:type",String)],op.prototype,"mail",void 0),customElements.define("contact-email",op);var ap=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},cp=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class hp extends(de(Zt)(se)){constructor(){super(),this.message="",this.password="",this.login=!1,this.default=e=>{e.preventDefault()},this.updatePass=async e=>{xl.currentUser?await function(e,t){return uo($n(e),null,t)}(xl.currentUser,e).then(()=>{}).catch(e=>{}):alert("Please Login")}}firstUpdated(){this.shadowRoot.querySelector(".pass").addEventListener("click",()=>{this.alertPassword()})}stateChanged(e){this.login=e.frontend.login}handleInputChange(e){const t=e.target;this.password=t.value}static get styles(){return[Ll,Ul,Dl,s`
881
+ `}}u_([ue({type:String,reflect:!0}),h_("design:type",Object)],d_.prototype,"email",void 0),u_([he(),h_("design:type",Boolean)],d_.prototype,"login",void 0),u_([he(),h_("design:type",String)],d_.prototype,"mail",void 0),customElements.define("contact-email",d_);var p_=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},f_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class g_ extends(de(wn)(se)){constructor(){super(),this.message="",this.password="",this.login=!1,this.default=e=>{e.preventDefault()},this.updatePass=async e=>{Lg.currentUser?await function(e,t){return No(or(e),null,t)}(Lg.currentUser,e).then(()=>{}).catch(e=>{}):alert("Please Login")}}firstUpdated(){this.shadowRoot.querySelector(".pass").addEventListener("click",()=>{this.alertPassword()})}stateChanged(e){this.login=e.frontend.login}handleInputChange(e){const t=e.target;this.password=t.value}static get styles(){return[$g,Fg,Ug,s`
861
882
 
862
883
  :host{
863
884
  display: grid;
@@ -867,7 +888,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
867
888
 
868
889
  p.error { color: red; }
869
890
 
870
- `]}render(){return B`
891
+ `]}render(){return V`
871
892
 
872
893
  <form
873
894
  autocomplete="off"
@@ -902,7 +923,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
902
923
 
903
924
  </label>
904
925
 
905
- ${this.message?B`
926
+ ${this.message?V`
906
927
 
907
928
  <p
908
929
  class=${this.message.includes("Password entered")?"":"error"}
@@ -923,7 +944,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
923
944
 
924
945
  </form>
925
946
 
926
- `}alertPassword(){this.password?this.password.length<8?this.message="Password must be at least 8 characters long":(this.message="Password entered:",/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/.test(this.password)?xl.currentUser?this.updatePass(this.password):alert("Please Login"):this.message="Password must include letters, numbers, and be 8+ characters"):this.message="Please enter a password"}}ap([ue(),cp("design:type",String)],hp.prototype,"message",void 0),ap([ue(),cp("design:type",String)],hp.prototype,"password",void 0),ap([ue(),cp("design:type",Boolean)],hp.prototype,"login",void 0),customElements.define("input-password",hp);var lp=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},up=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class dp extends(de(Zt)(se)){constructor(){super(),this.login=!1,this.email="",this.officialDelete=async()=>{if(xl.currentUser)return xl.currentUser.delete().then(()=>{}).catch(()=>{});alert("Please Sign-in")}}firstUpdated(){this.shadowRoot.querySelector(".deleteUser").addEventListener("click",()=>{this.alertDelete()})}stateChanged(e){this.login=e.frontend.login,this.email=e.backend.email}static get styles(){return[Dl,s`
947
+ `}alertPassword(){this.password?this.password.length<8?this.message="Password must be at least 8 characters long":(this.message="Password entered:",/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/.test(this.password)?Lg.currentUser?this.updatePass(this.password):alert("Please Login"):this.message="Password must include letters, numbers, and be 8+ characters"):this.message="Please enter a password"}}p_([he(),f_("design:type",String)],g_.prototype,"message",void 0),p_([he(),f_("design:type",String)],g_.prototype,"password",void 0),p_([he(),f_("design:type",Boolean)],g_.prototype,"login",void 0),customElements.define("input-password",g_);var m_=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},y_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class __ extends(de(wn)(se)){constructor(){super(),this.login=!1,this.email="",this.officialDelete=async()=>{if(Lg.currentUser)return Lg.currentUser.delete().then(()=>{}).catch(()=>{});alert("Please Sign-in")}}firstUpdated(){this.shadowRoot.querySelector(".deleteUser").addEventListener("click",()=>{this.alertDelete()})}stateChanged(e){this.login=e.frontend.login,this.email=e.backend.email}static get styles(){return[Ug,s`
927
948
 
928
949
  :host {
929
950
  display: grid;
@@ -934,7 +955,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
934
955
  padding: 0 16px;
935
956
  }
936
957
 
937
- `]}render(){return B`
958
+ `]}render(){return V`
938
959
 
939
960
  <p>Permanently delete the user account and data related to: ${this.email}</p>
940
961
 
@@ -942,7 +963,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
942
963
  class="action-button deleteUser"
943
964
  ?disabled="${!1===this.login}">Delete</button>
944
965
 
945
- `}alertDelete(){xl.currentUser?this.deleteUser():alert("Please Login")}deleteUser(){1==confirm("Delete Account?")&&this.officialDelete()}}lp([ue(),up("design:type",Boolean)],dp.prototype,"login",void 0),lp([ue(),up("design:type",String)],dp.prototype,"email",void 0),customElements.define("delete-user",dp);var pp=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},fp=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let gp=class extends(de(Zt)(se)){constructor(){super(),this.empty="",this.profileTopic="",this.name=""}firstUpdated(){this.querySelectorAll("form").forEach(e=>{e.preventDefault()}),this.shadowRoot.querySelector("button[value=profile]").addEventListener("click",()=>{Zt.dispatch(xt("profile"))}),this.shadowRoot.querySelector("button[value=verification]").addEventListener("click",()=>{Zt.dispatch(xt("verification"))}),this.shadowRoot.querySelector("button[value=password]").addEventListener("click",()=>{Zt.dispatch(xt("password"))}),this.shadowRoot.querySelector("button[value=delete]").addEventListener("click",()=>{Zt.dispatch(xt("delete"))})}stateChanged(e){this.profileTopic=e.frontend.settings,this.name=e.backend.name}static get styles(){return[Yd,rn,nn,s`
966
+ `}alertDelete(){Lg.currentUser?this.deleteUser():alert("Please Login")}deleteUser(){1==confirm("Delete Account?")&&this.officialDelete()}}m_([he(),y_("design:type",Boolean)],__.prototype,"login",void 0),m_([he(),y_("design:type",String)],__.prototype,"email",void 0),customElements.define("delete-user",__);var w_=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},v_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let b_=class extends(de(wn)(se)){constructor(){super(),this.empty="",this.profileTopic="",this.name=""}firstUpdated(){this.querySelectorAll("form").forEach(e=>{e.preventDefault()}),this.shadowRoot.querySelector("button[value=profile]").addEventListener("click",()=>{wn.dispatch(Yt("profile"))}),this.shadowRoot.querySelector("button[value=verification]").addEventListener("click",()=>{wn.dispatch(Yt("verification"))}),this.shadowRoot.querySelector("button[value=password]").addEventListener("click",()=>{wn.dispatch(Yt("password"))}),this.shadowRoot.querySelector("button[value=delete]").addEventListener("click",()=>{wn.dispatch(Yt("delete"))})}stateChanged(e){this.profileTopic=e.frontend.settings,this.name=e.backend.name}static get styles(){return[r_,In,Tn,s`
946
967
 
947
968
  :host {
948
969
  display: grid;
@@ -964,7 +985,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
964
985
  }
965
986
  }
966
987
 
967
- `]}render(){return B`
988
+ `]}render(){return V`
968
989
 
969
990
  <!-- Page Menu -->
970
991
  <nav>
@@ -1062,12 +1083,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1062
1083
  </div>
1063
1084
  </div>
1064
1085
 
1065
- `}};pp([le({type:String,reflect:!0}),fp("design:type",Object)],gp.prototype,"empty",void 0),pp([ue(),fp("design:type",Object)],gp.prototype,"profileTopic",void 0),pp([ue(),fp("design:type",Object)],gp.prototype,"name",void 0),gp=pp([ae("user-settings"),fp("design:paramtypes",[])],gp);const mp=s`
1066
-
1067
- :host {
1068
- box-shadow: 4px 4px 4px 0px;
1069
- border-radius: 8px;
1070
- }
1086
+ `}};w_([ue({type:String,reflect:!0}),v_("design:type",Object)],b_.prototype,"empty",void 0),w_([he(),v_("design:type",Object)],b_.prototype,"profileTopic",void 0),w_([he(),v_("design:type",Object)],b_.prototype,"name",void 0),b_=w_([ae("user-settings"),v_("design:paramtypes",[])],b_);const E_=s`
1071
1087
 
1072
1088
  .icon, .login {
1073
1089
  cursor: pointer;
@@ -1078,7 +1094,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1078
1094
  color: white;
1079
1095
  font-size: 15px;
1080
1096
  text-decoration: none;
1081
- transition-duration: 2s;
1097
+ transition-duration: 0s;
1082
1098
  }
1083
1099
 
1084
1100
  .icon:hover,
@@ -1091,6 +1107,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1091
1107
  width: var(--pwa_icon_diameter, 32px);
1092
1108
  border-radius: 50%;
1093
1109
  padding: 0;
1110
+ box-shadow: 4px 4px 4px 0px;
1094
1111
  }
1095
1112
 
1096
1113
  .login {
@@ -1101,6 +1118,8 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1101
1118
  font-family: var(--pwa_icon_font, 'Arial', sans-serif);
1102
1119
  font-weight: 500;
1103
1120
  text-align: center;
1121
+ /* box-shadow: 4px 4px 4px 0px;*/
1122
+ border-radius: 8px;
1104
1123
  }
1105
1124
 
1106
1125
  .userImage {
@@ -1114,14 +1133,14 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1114
1133
  margin: auto;
1115
1134
  }
1116
1135
 
1117
- `;var yp=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},_p=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let wp=class extends(de(Zt)(se)){constructor(){super(),this.subscribe=!1,this.empty="",this._user=!1,this._photoURL=""}firstUpdated(){this.shadowRoot.querySelector(".toggles").addEventListener("click",()=>{Zt.dispatch(Ut())})}stateChanged(e){this._user=e.frontend.login,this._photoURL=e.backend.photoURL}static get styles(){return[mp]}render(){return B`
1136
+ `;var T_=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},I_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let S_=class extends(de(wn)(se)){constructor(){super(),this.subscribe=!1,this.empty="",this._user=!1,this._photoURL=""}firstUpdated(){this.shadowRoot.querySelector(".toggles").addEventListener("click",()=>{wn.dispatch(nn())})}stateChanged(e){this._user=e.frontend.login,this._photoURL=e.backend.photoURL}static get styles(){return[E_]}render(){return V`
1118
1137
 
1119
1138
  <!-- two classes: icon / login -->
1120
1139
  <button
1121
1140
  class="${this._user?"icon":"login"} toggles"
1122
1141
  aria-label="login">
1123
1142
 
1124
- ${this._user?B`
1143
+ ${this._user?V`
1125
1144
  <!-- <div
1126
1145
  class = "iconArea"> -->
1127
1146
  <input
@@ -1136,7 +1155,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1136
1155
 
1137
1156
  </button>
1138
1157
 
1139
- `}};yp([le({type:Boolean,reflect:!0}),_p("design:type",Object)],wp.prototype,"subscribe",void 0),yp([le({type:String,reflect:!0}),_p("design:type",Object)],wp.prototype,"empty",void 0),yp([ue(),_p("design:type",Object)],wp.prototype,"_user",void 0),yp([ue(),_p("design:type",Object)],wp.prototype,"_photoURL",void 0),wp=yp([ae("user-icon"),_p("design:paramtypes",[])],wp);var bp=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},vp=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class Tp extends se{constructor(){super(),this.active=!1}shouldUpdate(){return this.active}}bp([le({type:Boolean}),vp("design:type",Boolean)],Tp.prototype,"active",void 0);var Ep=function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},Ip=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let Sp=class extends Tp{constructor(){super(),this.userEmail="",this.restPassword=async()=>{await async function(e,t){const n=Cs(e),i={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};await Us(n,i,"getOobCode",Vs)}(xl,this.userEmail).catch(e=>{})}}firstUpdated(){this.shadowRoot.querySelector(".reset").addEventListener("click",()=>{this.restPassword()})}handleEmail(e){const t=e.target;this.userEmail=t.value}render(){return B`
1158
+ `}};T_([ue({type:Boolean,reflect:!0}),I_("design:type",Object)],S_.prototype,"subscribe",void 0),T_([ue({type:String,reflect:!0}),I_("design:type",Object)],S_.prototype,"empty",void 0),T_([he(),I_("design:type",Object)],S_.prototype,"_user",void 0),T_([he(),I_("design:type",Object)],S_.prototype,"_photoURL",void 0),S_=T_([ae("user-icon"),I_("design:paramtypes",[])],S_);var C_=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},k_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class A_ extends se{constructor(){super(),this.active=!1}shouldUpdate(){return this.active}}C_([ue({type:Boolean}),k_("design:type",Boolean)],A_.prototype,"active",void 0);var R_=function(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},O_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let P_=class extends A_{constructor(){super(),this.userEmail="",this.restPassword=async()=>{await async function(e,t){const n=Gs(e),r={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};await ro(n,r,"getOobCode",ho)}(Lg,this.userEmail).catch(e=>{})}}firstUpdated(){this.shadowRoot.querySelector(".reset").addEventListener("click",()=>{this.restPassword()})}handleEmail(e){const t=e.target;this.userEmail=t.value}render(){return V`
1140
1159
 
1141
1160
  <form class="resetPass">
1142
1161
 
@@ -1156,4 +1175,4 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
1156
1175
  class ="phoneVerify"
1157
1176
  type ="text" />
1158
1177
 
1159
- `}};Ep([ue(),Ip("design:type",String)],Sp.prototype,"userEmail",void 0),Sp=Ep([ae("email-reset"),Ip("design:paramtypes",[])],Sp);export{Sp as EmailReset,Xd as UserDrawer,wp as UserIcon,Bd as UserLogin,gp as UserSettings,Pl as application,xl as auth,Rl as db,Al as firebaseConfig,Ol as storage,Nl as user};
1178
+ `}};R_([he(),O_("design:type",String)],P_.prototype,"userEmail",void 0),P_=R_([ae("email-reset"),O_("design:paramtypes",[])],P_);export{P_ as EmailReset,n_ as UserDrawer,S_ as UserIcon,Wy as UserLogin,b_ as UserSettings,xg as application,Lg as auth,Ng as db,Vy as deleteDocument,Pg as firebaseConfig,Fy as logAccount,jy as logAccountDelete,$y as logOut,Dg as storage,Mg as user};