pwa-auth 3.4.8 → 3.4.9
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.
- package/LICENSES.txt +43 -17
- package/README.md +17 -2
- package/base/firebase/interface.js +1 -1
- package/base/firebase/interface.js.map +1 -1
- package/base/webcomponents/css/animation.js +2 -2
- package/base/webcomponents/icon/css/icon.js +1 -1
- package/base/webcomponents/settings/input/delete.js +1 -0
- package/base/webcomponents/settings/input/delete.js.map +1 -1
- package/base/webcomponents/settings/settings.js +1 -0
- package/base/webcomponents/settings/settings.js.map +1 -1
- package/notes.md +11 -0
- package/package.json +9 -23
- package/source/pwa-auth.js +46 -44
package/source/pwa-auth.js
CHANGED
|
@@ -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(),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`
|
|
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 s=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 i=(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 s(r,e,n)},a=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new s("string"==typeof e?e:e+"",void 0,n))(t)})(e):e,{is:o,defineProperty:c,getOwnPropertyDescriptor:u,getOwnPropertyNames:l,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)=>!o(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:s}=u(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){const i=r?.call(this);s?.call(this,t),this.requestUpdate(e,i,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=[...l(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(a(e))}else void 0!==e&&t.push(a(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"),s=e.litNonce;void 0!==s&&r.setAttribute("nonce",s),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 s=(void 0!==n.converter?.toAttribute?n.converter:_).toAttribute(t,n.type);this._$Em=e,null==s?this.removeAttribute(r):this.setAttribute(r,s),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),s="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:_;this._$Em=r;const i=s.fromAttribute(t,e.type);this[r]=i??this._$Ej?.get(r)??i,this._$Em=null}}requestUpdate(e,t,n,r=!1,s){if(void 0!==e){const i=this.constructor;if(!1===r&&(s=this[e]),n??=i.getPropertyOptions(e),!((n.hasChanged??w)(s,t)||n.useDefault&&n.reflect&&s===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:r,wrapped:s},i){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,i??t??this[e]),!0!==s||void 0!==i)||(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.2");const E=globalThis,T=e=>e,S=E.trustedTypes,A=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,I="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,O="?"+C,R=`<${O}>`,k=document,N=()=>k.createComment(""),x=e=>null===e||"object"!=typeof e&&"function"!=typeof e,P=Array.isArray,D="[ \t\n\f\r]",L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,M=/>/g,V=RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),F=/'/g,$=/"/g,j=/^(?:script|style|textarea|title)$/i,B=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),H=Symbol.for("lit-noChange"),z=Symbol.for("lit-nothing"),q=new WeakMap,G=k.createTreeWalker(k,129);function K(e,t){if(!P(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(t):t}let W=class e{constructor({strings:t,_$litType$:n},r){let s;this.parts=[];let i=0,a=0;const o=t.length-1,c=this.parts,[u,l]=((e,t)=>{const n=e.length-1,r=[];let s,i=2===t?"<svg>":3===t?"<math>":"",a=L;for(let t=0;t<n;t++){const n=e[t];let o,c,u=-1,l=0;for(;l<n.length&&(a.lastIndex=l,c=a.exec(n),null!==c);)l=a.lastIndex,a===L?"!--"===c[1]?a=U:void 0!==c[1]?a=M:void 0!==c[2]?(j.test(c[2])&&(s=RegExp("</"+c[2],"g")),a=V):void 0!==c[3]&&(a=V):a===V?">"===c[0]?(a=s??L,u=-1):void 0===c[1]?u=-2:(u=a.lastIndex-c[2].length,o=c[1],a=void 0===c[3]?V:'"'===c[3]?$:F):a===$||a===F?a=V:a===U||a===M?a=L:(a=V,s=void 0);const h=a===V&&e[t+1].startsWith("/>")?" ":"";i+=a===L?n+R:u>=0?(r.push(o),n.slice(0,u)+I+n.slice(u)+C+h):n+C+(-2===u?t:h)}return[K(e,i+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]})(t,n);if(this.el=e.createElement(u,r),G.currentNode=this.el.content,2===n||3===n){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=G.nextNode())&&c.length<o;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(I)){const t=l[a++],n=s.getAttribute(e).split(C),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:i,name:r[2],strings:n,ctor:"."===r[1]?Z:"?"===r[1]?ee:"@"===r[1]?te:J}),s.removeAttribute(e)}else e.startsWith(C)&&(c.push({type:6,index:i}),s.removeAttribute(e));if(j.test(s.tagName)){const e=s.textContent.split(C),t=e.length-1;if(t>0){s.textContent=S?S.emptyScript:"";for(let n=0;n<t;n++)s.append(e[n],N()),G.nextNode(),c.push({type:2,index:++i});s.append(e[t],N())}}}else if(8===s.nodeType)if(s.data===O)c.push({type:2,index:i});else{let e=-1;for(;-1!==(e=s.data.indexOf(C,e+1));)c.push({type:7,index:i}),e+=C.length-1}i++}}static createElement(e,t){const n=k.createElement("template");return n.innerHTML=e,n}};function Y(e,t,n=e,r){if(t===H)return t;let s=void 0!==r?n._$Co?.[r]:n._$Cl;const i=x(t)?void 0:t._$litDirective$;return s?.constructor!==i&&(s?._$AO?.(!1),void 0===i?s=void 0:(s=new i(e),s._$AT(e,n,r)),void 0!==r?(n._$Co??=[])[r]=s:n._$Cl=s),void 0!==s&&(t=Y(e,s._$AS(e,t.values),s,r)),t}class X{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??k).importNode(t,!0);G.currentNode=r;let s=G.nextNode(),i=0,a=0,o=n[0];for(;void 0!==o;){if(i===o.index){let t;2===o.type?t=new Q(s,s.nextSibling,this,e):1===o.type?t=new o.ctor(s,o.name,o.strings,this,e):6===o.type&&(t=new ne(s,this,e)),this._$AV.push(t),o=n[++a]}i!==o?.index&&(s=G.nextNode(),i++)}return G.currentNode=k,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 Q{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=Y(this,e,t),x(e)?e===z||null==e||""===e?(this._$AH!==z&&this._$AR(),this._$AH=z):e!==this._$AH&&e!==H&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>P(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&&x(this._$AH)?this._$AA.nextSibling.data=e:this.T(k.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=W.createElement(K(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{const e=new X(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 W(e)),t}k(e){P(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,r=0;for(const s of e)r===t.length?t.push(n=new Q(this.O(N()),this.O(N()),this,this.options)):n=t[r],n._$AI(s),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=T(e).nextSibling;T(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class J{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,s){this.type=1,this._$AH=z,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=s,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 s=this.strings;let i=!1;if(void 0===s)e=Y(this,e,t,0),i=!x(e)||e!==this._$AH&&e!==H,i&&(this._$AH=e);else{const r=e;let a,o;for(e=s[0],a=0;a<s.length-1;a++)o=Y(this,r[n+a],t,a),o===H&&(o=this._$AH[a]),i||=!x(o)||o!==this._$AH[a],o===z?e=z:e!==z&&(e+=(o??"")+s[a+1]),this._$AH[a]=o}i&&!r&&this.j(e)}j(e){e===z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Z extends J{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===z?void 0:e}}let ee=class extends J{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==z)}};class te extends J{constructor(e,t,n,r,s){super(e,t,n,r,s),this.type=5}_$AI(e,t=this){if((e=Y(this,e,t,0)??z)===H)return;const n=this._$AH,r=e===z&&n!==z||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==z&&(n===z||r);r&&this.element.removeEventListener(this.name,this,n),s&&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){Y(this,e)}}const re=E.litHtmlPolyfillSupport;re?.(W,Q),(E.litHtmlVersions??=[]).push("3.3.3");const se=globalThis;class ie 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 s=r._$litPart$;if(void 0===s){const e=n?.renderBefore??null;r._$litPart$=s=new Q(t.insertBefore(N(),e),e,void 0,n??{})}return s._$AI(e),s})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return H}}ie._$litElement$=!0,ie.finalized=!0,se.litElementHydrateSupport?.({LitElement:ie});const ae=se.litElementPolyfillSupport;ae?.({LitElement:ie}),(se.litElementVersions??=[]).push("4.2.2");const oe=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},ue=(e=ce,t,n)=>{const{kind:r,metadata:s}=n;let i=globalThis.litPropertyMetadata.get(s);if(void 0===i&&globalThis.litPropertyMetadata.set(s,i=new Map),"setter"===r&&((e=Object.create(e)).wrapped=!0),i.set(n.name,e),"accessor"===r){const{name:r}=n;return{set(n){const s=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,s,e,!0,n)},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 s=this[r];t.call(this,n),this.requestUpdate(r,s,e,!0,n)}}throw Error("Unsupported decorator location: "+r)};function le(e){return(t,n)=>"object"==typeof n?ue(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 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 r=e,s=t,i=new Map,a=i,o=0,c=!1;function u(){a===i&&(a=new Map,i.forEach((e,t)=>{a.set(t,e)}))}function l(){if(c)throw new Error(pe(3));return s}function h(e){if("function"!=typeof e)throw new Error(pe(4));if(c)throw new Error(pe(5));let t=!0;u();const n=o++;return a.set(n,e),function(){if(t){if(c)throw new Error(pe(6));t=!1,u(),a.delete(n),i=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,s=r(s,e)}finally{c=!1}return(i=a).forEach(e=>{e()}),e}d({type:me.INIT});return{dispatch:d,subscribe:h,getState:l,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(l())}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 s=t[r];"function"==typeof e[s]&&(n[s]=e[s])}const r=Object.keys(n);let s;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){s=e}return function(e={},t){if(s)throw s;let i=!1;const a={};for(let s=0;s<r.length;s++){const o=r[s],c=n[o],u=e[o],l=c(u,t);if(void 0===l)throw t&&t.type,new Error(pe(14));a[o]=l,i=i||l!==u}return i=i||r.length!==Object.keys(e).length,i?a: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 Se(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ae=Object,Ie=Ae.getPrototypeOf,Ce="constructor",Oe="prototype",Re="configurable",ke="enumerable",Ne="writable",xe="value",Pe=e=>!!e&&!!e[Te];function De(e){return!!e&&(Me(e)||He(e)||!!e[Ee]||!!e[Ce]?.[Ee]||ze(e)||qe(e))}var Le=Ae[Oe][Ce].toString(),Ue=new WeakMap;function Me(e){if(!e||!Ge(e))return!1;const t=Ie(e);if(null===t||t===Ae[Oe])return!0;const n=Ae.hasOwnProperty.call(t,Ce)&&t[Ce];if(n===Object)return!0;if(!Ke(n))return!1;let r=Ue.get(n);return void 0===r&&(r=Function.toString.call(n),Ue.set(n,r)),r===Le}function Ve(e,t,n=!0){if(0===Fe(e)){(n?Reflect.ownKeys(e):Ae.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_:He(e)?1:ze(e)?2:qe(e)?3:0}var $e=(e,t,n=Fe(e))=>2===n?e.has(t):Ae[Oe].hasOwnProperty.call(e,t),je=(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 He=Array.isArray,ze=e=>e instanceof Map,qe=e=>e instanceof Set,Ge=e=>"object"==typeof e,Ke=e=>"function"==typeof e,We=e=>"boolean"==typeof e;var Ye=e=>e.copy_||e.base_,Xe=e=>e.modified_?e.copy_:e.base_;function Qe(e,t){if(ze(e))return new Map(e);if(qe(e))return new Set(e);if(He(e))return Array[Oe].slice.call(e);const n=Me(e);if(!0===t||"class_only"===t&&!n){const t=Ae.getOwnPropertyDescriptors(e);delete t[Te];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const s=n[r],i=t[s];!1===i[Ne]&&(i[Ne]=!0,i[Re]=!0),(i.get||i.set)&&(t[s]={[Re]:!0,[Ne]:!0,[ke]:i[ke],[xe]:e[s]})}return Ae.create(Ie(e),t)}{const t=Ie(e);if(null!==t&&n)return{...e};const r=Ae.create(t);return Ae.assign(r,e)}}function Je(e,t=!1){return et(e)||Pe(e)||!De(e)||(Fe(e)>1&&Ae.defineProperties(e,{set:Ze,add:Ze,clear:Ze,delete:Ze}),Ae.freeze(e),t&&Ve(e,(e,t)=>{Je(t,!0)},!1)),e}var Ze={[xe]:function(){Se(2)}};function et(e){return null===e||!Ge(e)||Ae.isFrozen(e)}var tt="MapSet",nt="Patches",rt="ArrayMethods",st={};function it(e){const t=st[e];return t||Se(0),t}var at,ot=e=>!!st[e],ct=()=>at;function ut(e,t){t&&(e.patchPlugin_=it(nt),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function lt(e){ht(e),e.drafts_.forEach(pt),e.drafts_=null}function ht(e){e===at&&(at=e.parent_)}var dt=e=>at={drafts_:[],parent_:at,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ot(tt)?it(tt):void 0,arrayMethodsPlugin_:ot(rt)?it(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_&&(lt(t),Se(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_&&Je(t,n)}(t,e,!0),lt(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 s=Ye(e),i=e.type_;if(void 0!==r){if(je(s,r,i)===t)return void Be(s,r,n,i)}if(!e.draftLocations_){const t=e.draftLocations_=new Map;Ve(s,(e,n)=>{if(Pe(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const a=e.draftLocations_.get(t)??_t;for(const e of a)Be(s,e,n,i)}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||Pe(e)||t.has(e)||!De(e)||et(e)||(t.add(e),Ve(e,(r,s)=>{if(Pe(s)){const t=s[Te];if(yt(t,n)){const n=Xe(t);Be(e,r,n,e.type_),mt(t)}}else De(s)&&bt(s,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 s=Ye(e);if(!$e(s,t,e.type_))return function(e,t,n){const r=At(t,n);return r?xe in r?r[xe]:r.get?.call(e.draft_):void 0}(e,s,t);const i=s[t];if(e.finalized_||!De(i))return i;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return i;if(i===St(e.base_,t)){Ct(e);const n=1===e.type_?+t:t,r=Ot(e.scope_,i,e,n);return e.copy_[n]=r}return i},has:(e,t)=>t in Ye(e),ownKeys:e=>Reflect.ownKeys(Ye(e)),set(e,t,n){const r=At(Ye(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=St(Ye(e),t),s=r?.[Te];if(s&&s.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||$e(e.base_,t,e.type_)))return!0;Ct(e),It(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(Pe(n)){const s=n[Te];yt(s,r)&&s.callbacks_.push(function(){Ct(e);const r=Xe(s);wt(e,n,r,t)})}else De(n)&&e.callbacks_.push(function(){const s=Ye(e);3===e.type_?s.has(n)&&bt(n,r.handledSet_,r):je(s,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&bt(je(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(Ct(e),void 0!==St(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),It(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ye(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[Ne]:!0,[Re]:1!==e.type_||"length"!==t,[ke]:r[ke],[xe]:n[t]}:r},defineProperty(){Se(11)},getPrototypeOf:e=>Ie(e.base_),setPrototypeOf(){Se(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 St(e,t){const n=e[Te];return(n?Ye(n):e)[t]}function At(e,t){if(!(t in e))return;let n=Ie(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ie(n)}}function It(e){e.modified_||(e.modified_=!0,e.parent_&&It(e.parent_))}function Ct(e){e.copy_||(e.assigned_=new Map,e.copy_=Qe(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 Ot(e,t,n,r){const[s,i]=ze(t)?it(tt).proxyMap_(t,n):qe(t)?it(tt).proxySet_(t,n):function(e,t){const n=He(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 s=r,i=Et;n&&(s=[r],i=Tt);const{revoke:a,proxy:o}=Proxy.revocable(s,i);return r.draft_=o,r.revoke_=a,[o,r]}(t,n);return(n?.scope_??ct()).drafts_.push(s),i.callbacks_=n?.callbacks_??[],i.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const s=t;if(!s||!yt(s,r))return;r.mapSetPlugin_?.fixSetContents(s);const i=Xe(s);wt(e,s.draft_??s,i,n),vt(s,r)})}(n,i,r):i.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(i);const{patchPlugin_:t}=e;i.modified_&&t&&t.generatePatches_(i,[],e)}),s}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=Qe(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Qe(e,!0);return Ve(n,(e,t)=>{Be(n,e,Rt(t))},r),t&&(t.finalized_=!1),n}var kt=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ke(e)&&!Ke(t)){const n=t;t=e;const r=this;return function(e=n,...s){return r.produce(e,e=>t.call(this,e,...s))}}let r;if(Ke(t)||Se(6),void 0===n||Ke(n)||Se(7),De(e)){const s=dt(this),i=Ot(s,e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?lt(s):ht(s)}return ut(s,n),ft(r,s)}if(!e||!Ge(e)){if(r=t(e),void 0===r&&(r=e),r===be&&(r=void 0),this.autoFreeze_&&Je(r,!0),n){const t=[],s=[];it(nt).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:s}),n(t,s)}return r}Se(1)},this.produceWithPatches=(e,t)=>{if(Ke(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;const s=this.produce(e,t,(e,t)=>{n=e,r=t});return[s,n,r]},We(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),We(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),We(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){De(e)||Se(8),Pe(e)&&(e=function(e){Pe(e)||Se(10);return Rt(e)}(e));const t=dt(this),n=Ot(t,e,void 0);return n[Te].isManual_=!0,ht(t),n}finishDraft(e,t){const n=e&&e[Te];n&&n.isManual_||Se(9);const{scope_:r}=n;return ut(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=it(nt).applyPatches_;return Pe(e)?r(e,t):this.produce(e,e=>r(e,t))}},Nt=kt.produce;function xt(e){return({dispatch:t,getState:n})=>r=>s=>"function"==typeof s?s(t,n,e):r(s)}var Pt=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 Ut(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(Yt(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 Mt=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 Vt(e){return De(e)?Nt(e,()=>{}):e}function Ft(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var $t=e=>t=>{setTimeout(t,e)},jt=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let s=!0,i=!1,a=!1;const o=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?(u=window.requestAnimationFrame,l=100,e=>{let t=!1;const n=()=>{t||(t=!0,cancelAnimationFrame(r),clearTimeout(s),e())},r=u(n),s=setTimeout(n,l)}):$t(10):"callback"===e.type?e.queueNotification:$t(e.timeout);var u,l;const h=()=>{a=!1,i&&(i=!1,o.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>s&&e());return o.add(e),()=>{t(),o.delete(e)}},dispatch(e){try{return s=!e?.meta?.RTK_autoBatch,i=!s,i&&(a||(a=!0,c(h))),r.dispatch(e)}finally{s=!0}}})};function Bt(e){const t={},n=[];let r;const s={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(Yt(28));if(r in t)throw new Error(Yt(29));return t[r]=n,s},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}),s),addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),s),addDefaultCase:e=>(r=e,s)};return e(s),[t,n,r]}var Ht=Symbol.for("rtk-slice-createasyncthunk");function zt(e,t){return`${e}/${t}`}function qt({creators:e}={}){const t=e?.asyncThunk?.[Ht];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(Yt(11));const s=("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)||{},i=Object.keys(s),a={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},o={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(Yt(12));if(n in a.sliceCaseReducersByType)throw new Error(Yt(13));return a.sliceCaseReducersByType[n]=t,o},addMatcher:(e,t)=>(a.sliceMatchers.push({matcher:e,reducer:t}),o),exposeAction:(e,t)=>(a.actionCreators[e]=t,o),exposeCaseReducer:(e,t)=>(a.sliceCaseReducersByName[e]=t,o)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?Bt(e.extraReducers):[e.extraReducers],s={...t,...a.sliceCaseReducersByType};return function(e,t){let n,[r,s,i]=Bt(t);if(function(e){return"function"==typeof e}(e))n=()=>Vt(e());else{const t=Vt(e);n=()=>t}function a(e=n(),t){let a=[r[t.type],...s.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===a.filter(e=>!!e).length&&(a=[i]),a.reduce((e,n)=>{if(n){if(Pe(e)){const r=n(e,t);return void 0===r?e:r}if(De(e))return Nt(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 a.getInitialState=n,a}(e.initialState,e=>{for(let t in s)e.addCase(t,s[t]);for(let t of a.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}i.forEach(r=>{const i=s[r],a={reducerName:r,type:zt(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},r,s){let i,a;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(Yt(17));i=r.reducer,a=r.prepare}else i=r;s.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?Ut(e,a):Ut(e))}(a,i,o):function({type:e,reducerName:t},n,r,s){if(!s)throw new Error(Yt(18));const{payloadCreator:i,fulfilled:a,pending:o,rejected:c,settled:u,options:l}=n,h=s(e,i,l);r.exposeAction(t,h),a&&r.addCase(h.fulfilled,a);o&&r.addCase(h.pending,o);c&&r.addCase(h.rejected,c);u&&r.addMatcher(h.settled,u);r.exposeCaseReducer(t,{fulfilled:a||Wt,pending:o||Wt,rejected:c||Wt,settled:u||Wt})}(a,i,o,t)});const u=e=>e,l=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 s=e[t];return void 0===s&&n&&(s=Ft(h,r,f)),s}function s(t=u){const r=Ft(l,n,()=>new WeakMap);return Ft(r,t,()=>{const r={};for(const[s,i]of Object.entries(e.selectors??{}))r[s]=Gt(i,t,()=>Ft(h,t,f),n);return r})}return{reducerPath:t,getSelectors:s,get selectors(){return s(r)},selectSlice:r}}const m={name:n,reducer:p,actions:a.actionCreators,caseReducers:a.sliceCaseReducersByName,getInitialState:f,...g(r),injectInto(e,{reducerPath:t,...n}={}){const s=t??r;return e.inject({reducerPath:s,reducer:p},n),{...m,...g(s,!0)}}};return m}}function Gt(e,t,n,r){function s(s,...i){let a=t(s);return void 0===a&&r&&(a=n()),e(a,...i)}return s.unwrapped=e,s}var Kt=qt();function Wt(){}function Yt(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 Xt=Kt({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:Qt,navigateAuth:Jt,iconAuth:Zt,nameAuth:en,userAuth:tn,toggleSign:nn,closeSign:rn,signUpAction:sn,signUpClose:an}=Xt.actions,on=Kt({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:un}=on.actions,ln=Kt({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}=ln.actions,wn=function(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:s=!0}=e??{};let i=new Mt;return t&&(function(e){return"boolean"==typeof e}(t)?i.push(Pt):i.push(Dt(t.extraArgument))),i},{reducer:n,middleware:r,devTools:s=!0,preloadedState:i,enhancers:a}=e||{};let o,c;if("function"==typeof n)o=n;else{if(!ye(n))throw new Error(Yt(1));o=we(n)}c="function"==typeof r?r(t):t();let u=ve;s&&(u=Lt({trace:!1,..."object"==typeof s&&s}));const l=function(...e){return t=>(n,r)=>{const s=t(n,r);let i=()=>{throw new Error(pe(15))};const a={getState:s.getState,dispatch:(e,...t)=>i(e,...t)},o=e.map(e=>e(a));return i=ve(...o)(s.dispatch),{...s,dispatch:i}}}(...c),h=(e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Mt(e);return n&&r.push(jt("object"==typeof n?n:void 0)),r})(l);return _e(o,i,u(..."function"==typeof a?a(h):h()))}({reducer:{frontend:Xt.reducer,drawer:on.reducer,backend:ln.reducer},devTools:!0}),vn=i`
|
|
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
|
-
`,bn=
|
|
43
|
+
`,bn=i`
|
|
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
|
-
`,En=
|
|
53
|
+
`,En=i`
|
|
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
|
-
`,Tn=
|
|
61
|
+
`,Tn=i`
|
|
62
62
|
|
|
63
63
|
.wrapper {
|
|
64
64
|
display: grid;
|
|
@@ -79,8 +79,8 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
.content {
|
|
82
|
-
|
|
83
|
-
grid-gap: 16px
|
|
82
|
+
/* display: grid;
|
|
83
|
+
grid-gap: 16px;*/
|
|
84
84
|
grid-area: pages;
|
|
85
85
|
|
|
86
86
|
border-bottom: 2px solid grey;
|
|
@@ -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
|
-
`,
|
|
128
|
+
`,Sn=i`
|
|
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 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=" ×",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`
|
|
147
|
+
`,An=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=63&s|128):55296==(64512&s)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=63&s|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=63&s|128)}return t},In={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 s=e[t],i=t+1<e.length,a=i?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,u=s>>2,l=(3&s)<<4|a>>4;let h=(15&a)<<2|c>>6,d=63&c;o||(d=64,i||(h=64)),r.push(n[u],n[l],n[h],n[d])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(An(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 s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=e[n++];t[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],a=e[n++];t[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&a)}}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 s=n[e.charAt(t++)],i=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const o=t<e.length?n[e.charAt(t)]:64;if(++t,null==s||null==i||null==a||null==o)throw new Cn;const c=s<<2|i>>4;if(r.push(c),64!==a){const e=i<<4&240|a>>2;if(r.push(e),64!==o){const e=a<<6&192|o;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 Cn extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const On=function(e){return function(e){const t=An(e);return In.encodeByteArray(t,!0)}(e).replace(/\./g,"")},Rn=function(e){try{return In.decodeString(e,!0)}catch(e){}return null};const kn=()=>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__,Nn=()=>{try{return kn()||(()=>{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=>Nn()?.emulatorHosts?.[e],Pn=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=()=>Nn()?.config,Ln=e=>Nn()?.[`_${e}`];class Un{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 Mn(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,s=e.sub||e.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i={iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}},...e};return[On(JSON.stringify({alg:"none",type:"JWT"})),On(JSON.stringify(i)),""].join(".")}function Vn(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function Fn(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function $n(){return!function(){const e=Nn()?.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 jn(){try{return"object"==typeof indexedDB}catch(e){return!1}}function Bn(){return new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{t(s.error?.message||"")}}catch(e){t(e)}})}function Hn(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class zn extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,zn.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}`,s=this.errors[e],i=s?function(e,t){return e.replace(Gn,(e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`})}(s,n):"Error",a=`${this.serviceName}: ${i} (${r}).`;return new zn(r,a,n)}}const Gn=/\{\$([^}]+)}/g;function Kn(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const s of n){if(!r.includes(s))return!1;const n=e[s],i=t[s];if(Wn(n)&&Wn(i)){if(!Kn(n,i))return!1}else if(n!==i)return!1}for(const e of r)if(!n.includes(e))return!1;return!0}function Wn(e){return null!==e&&"object"==typeof e}function Yn(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 Xn(e){const t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t}function Qn(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class Jn{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=Zn),void 0===r.error&&(r.error=Zn),void 0===r.complete&&(r.complete=Zn);const s=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),s}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error}})}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 Zn(){}function er(e,t=1e3,n=2){const r=t*Math.pow(n,e),s=Math.round(.5*r*(Math.random()-.5)*2);return Math.min(144e5,r+s)}function tr(e){return e&&e._delegate?e._delegate:e}function nr(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function rr(e){return(await fetch(e,{credentials:"include"})).ok}class sr{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 ir="[DEFAULT]";class ar{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 Un;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:ir})}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=ir){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=ir){return this.instances.has(e)}getOptions(e=ir){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 s=this.instances.get(n);return s&&e(s,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===ir?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=ir){return this.component?this.component.multipleInstances?e:ir:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class or{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 ar(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}var cr;!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"}(cr||(cr={}));const ur={debug:cr.DEBUG,verbose:cr.VERBOSE,info:cr.INFO,warn:cr.WARN,error:cr.ERROR,silent:cr.SILENT},lr=cr.INFO,hr={[cr.DEBUG]:"log",[cr.VERBOSE]:"log",[cr.INFO]:"info",[cr.WARN]:"warn",[cr.ERROR]:"error"},dr=(e,t,...n)=>{if(t<e.logLevel)return;(new Date).toISOString();if(!hr[t])throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class pr{constructor(e){this.name=e,this._logLevel=lr,this._logHandler=dr,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in cr))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?ur[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,cr.DEBUG,...e),this._logHandler(this,cr.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,cr.VERBOSE,...e),this._logHandler(this,cr.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,cr.INFO,...e),this._logHandler(this,cr.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,cr.WARN,...e),this._logHandler(this,cr.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,cr.ERROR,...e),this._logHandler(this,cr.ERROR,...e)}}let fr,gr;const mr=new WeakMap,yr=new WeakMap,_r=new WeakMap,wr=new WeakMap,vr=new WeakMap;let br={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return yr.get(e);if("objectStoreNames"===t)return e.objectStoreNames||_r.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Sr(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Er(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(gr||(gr=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Ar(this),t),Sr(mr.get(this))}:function(...t){return Sr(e.apply(Ar(this),t))}:function(t,...n){const r=e.call(Ar(this),t,...n);return _r.set(r,t.sort?t.sort():[t]),Sr(r)}}function Tr(e){return"function"==typeof e?Er(e):(e instanceof IDBTransaction&&function(e){if(yr.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",i),e.removeEventListener("abort",i)},s=()=>{t(),r()},i=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",s),e.addEventListener("error",i),e.addEventListener("abort",i)});yr.set(e,t)}(e),t=e,(fr||(fr=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,br):e);var t}function Sr(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",s),e.removeEventListener("error",i)},s=()=>{t(Sr(e.result)),r()},i=()=>{n(e.error),r()};e.addEventListener("success",s),e.addEventListener("error",i)});return t.then(t=>{t instanceof IDBCursor&&mr.set(t,e)}).catch(()=>{}),vr.set(t,e),t}(e);if(wr.has(e))return wr.get(e);const t=Tr(e);return t!==e&&(wr.set(e,t),vr.set(t,e)),t}const Ar=e=>vr.get(e);function Ir(e,t,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const a=indexedDB.open(e,t),o=Sr(a);return r&&a.addEventListener("upgradeneeded",e=>{r(Sr(a.result),e.oldVersion,e.newVersion,Sr(a.transaction),e)}),n&&a.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),o.then(e=>{i&&e.addEventListener("close",()=>i()),s&&e.addEventListener("versionchange",e=>s(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o}function Cr(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",e=>t(e.oldVersion,e)),Sr(n).then(()=>{})}const Or=["get","getKey","getAll","getAllKeys","count"],Rr=["put","add","delete","clear"],kr=new Map;function Nr(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(kr.get(t))return kr.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=Rr.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!Or.includes(n))return;const i=async function(e,...t){const i=this.transaction(e,s?"readwrite":"readonly");let a=i.store;return r&&(a=a.index(t.shift())),(await Promise.all([a[n](...t),s&&i.done]))[0]};return kr.set(t,i),i}br=(e=>({...e,get:(t,n,r)=>Nr(t,n)||e.get(t,n,r),has:(t,n)=>!!Nr(t,n)||e.has(t,n)}))(br);class xr{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 Pr="@firebase/app",Dr="0.15.0",Lr=new pr("@firebase/app"),Ur="@firebase/app-compat",Mr="@firebase/analytics-compat",Vr="@firebase/analytics",Fr="@firebase/app-check-compat",$r="@firebase/app-check",jr="@firebase/auth",Br="@firebase/auth-compat",Hr="@firebase/database",zr="@firebase/data-connect",qr="@firebase/database-compat",Gr="@firebase/functions",Kr="@firebase/functions-compat",Wr="@firebase/installations",Yr="@firebase/installations-compat",Xr="@firebase/messaging",Qr="@firebase/messaging-compat",Jr="@firebase/performance",Zr="@firebase/performance-compat",es="@firebase/remote-config",ts="@firebase/remote-config-compat",ns="@firebase/storage",rs="@firebase/storage-compat",ss="@firebase/firestore",is="@firebase/ai",as="@firebase/firestore-compat",os="firebase",cs="[DEFAULT]",us={[Pr]:"fire-core",[Ur]:"fire-core-compat",[Vr]:"fire-analytics",[Mr]:"fire-analytics-compat",[$r]:"fire-app-check",[Fr]:"fire-app-check-compat",[jr]:"fire-auth",[Br]:"fire-auth-compat",[Hr]:"fire-rtdb",[zr]:"fire-data-connect",[qr]:"fire-rtdb-compat",[Gr]:"fire-fn",[Kr]:"fire-fn-compat",[Wr]:"fire-iid",[Yr]:"fire-iid-compat",[Xr]:"fire-fcm",[Qr]:"fire-fcm-compat",[Jr]:"fire-perf",[Zr]:"fire-perf-compat",[es]:"fire-rc",[ts]:"fire-rc-compat",[ns]:"fire-gcs",[rs]:"fire-gcs-compat",[ss]:"fire-fst",[as]:"fire-fst-compat",[is]:"fire-vertex","fire-js":"fire-js",[os]:"fire-js-all"},ls=new Map,hs=new Map,ds=new Map;function ps(e,t){try{e.container.addComponent(t)}catch(n){Lr.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function fs(e){const t=e.name;if(ds.has(t))return Lr.debug(`There were multiple attempts to register component ${t}.`),!1;ds.set(t,e);for(const t of ls.values())ps(t,e);for(const t of hs.values())ps(t,e);return!0}function gs(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function ms(e){return null!=e&&void 0!==e.settings}const ys=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 _s{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 sr("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 ys.create("app-deleted",{appName:this._name})}}const ws="12.15.0";function vs(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r={name:cs,automaticDataCollectionEnabled:!0,...t},s=r.name;if("string"!=typeof s||!s)throw ys.create("bad-app-name",{appName:String(s)});if(n||(n=Dn()),!n)throw ys.create("no-options");const i=ls.get(s);if(i){if(Kn(n,i.options)&&Kn(r,i.config))return i;throw ys.create("duplicate-app",{appName:s})}const a=new or(s);for(const e of ds.values())a.addComponent(e);const o=new _s(n,r,a);return ls.set(s,o),o}function bs(e=cs){const t=ls.get(e);if(!t&&e===cs&&Dn())return vs();if(!t)throw ys.create("no-app",{appName:e});return t}function Es(e,t,n){let r=us[e]??e;n&&(r+=`-${n}`);const s=r.match(/\s|\//),i=t.match(/\s|\//);if(s||i){const e=[`Unable to register library "${r}" with version "${t}":`];return s&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&e.push("and"),i&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void Lr.warn(e.join(" "))}fs(new sr(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}const Ts="firebase-heartbeat-store";let Ss=null;function As(){return Ss||(Ss=Ir("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Ts)}catch(e){}}}).catch(e=>{throw ys.create("idb-open",{originalErrorMessage:e.message})})),Ss}async function Is(e,t){try{const n=(await As()).transaction(Ts,"readwrite"),r=n.objectStore(Ts);await r.put(t,Cs(e)),await n.done}catch(e){if(e instanceof zn)Lr.warn(e.message);else{const t=ys.create("idb-set",{originalErrorMessage:e?.message});Lr.warn(t.message)}}}function Cs(e){return`${e.name}!${e.options.appId}`}class Os{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ks(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=Rs();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){Lr.warn(e)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats||0===this._heartbeatsCache.heartbeats.length)return"";const e=Rs(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let r=e.slice();for(const s of e){const e=n.find(e=>e.agent===s.agent);if(e){if(e.dates.push(s.date),Ns(n)>t){e.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Ns(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),r=On(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 Lr.warn(e),""}}}function Rs(){return(new Date).toISOString().substring(0,10)}class ks{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!jn()&&Bn().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await As()).transaction(Ts),n=await t.objectStore(Ts).get(Cs(e));return await t.done,n}catch(e){if(e instanceof zn)Lr.warn(e.message);else{const t=ys.create("idb-get",{originalErrorMessage:e?.message});Lr.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 Is(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){if(await this._canUseIndexedDBPromise){const t=await this.read();return Is(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:[...t.heartbeats,...e.heartbeats]})}}}function Ns(e){return On(JSON.stringify({version:2,heartbeats:e})).length}var xs;function Ps(){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."}}xs="",fs(new sr("platform-logger",e=>new xr(e),"PRIVATE")),fs(new sr("heartbeat",e=>new Os(e),"PRIVATE")),Es(Pr,Dr,xs),Es(Pr,Dr,"esm2020"),Es("fire-js","");const Ds=Ps,Ls=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."}),Us=new pr("@firebase/auth");function Ms(e,...t){Us.logLevel<=cr.ERROR&&Us.error(`Auth (${ws}): ${e}`,...t)}function Vs(e,...t){throw Bs(e,...t)}function Fs(e,...t){return Bs(e,...t)}function $s(e,t,n){const r={...Ds(),[t]:n};return new qn("auth","Firebase",r).create(t,{appName:e.name})}function js(e){return $s(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Bs(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 Ls.create(e,...t)}function Hs(e,t,...n){if(!e)throw Bs(t,...n)}function zs(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Ms(t),new Error(t)}function qs(e,t){e||zs(t)}function Gs(){return"undefined"!=typeof self&&self.location?.href||""}function Ks(){return"undefined"!=typeof self&&self.location?.protocol||null}function Ws(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Ks()&&"https:"!==Ks()&&!Fn()&&!("connection"in navigator)||navigator.onLine}class Ys{constructor(e,t){this.shortDelay=e,this.longDelay=t,qs(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(Vn())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Ws()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Xs(e,t){qs(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class Qs{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 zs("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 zs("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 zs("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Js={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"},Zs=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],ei=new Ys(3e4,6e4);function ti(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function ni(e,t,n,r,s={}){return ri(e,s,async()=>{let s={},i={};r&&("GET"===t?i=r:s={body:JSON.stringify(r)});const a=Yn({...i,key:e.config.apiKey}).slice(1),o=await e._getAdditionalHeaders();o["Content-Type"]="application/json",e.languageCode&&(o["X-Firebase-Locale"]=e.languageCode);const c={method:t,headers:o,...s};return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(c.referrerPolicy="strict-origin-when-cross-origin"),e.emulatorConfig&&nr(e.emulatorConfig.host)&&(c.credentials="include"),Qs.fetch()(await ii(e,e.config.apiHost,n,a),c)})}async function ri(e,t,n){e._canInitEmulator=!1;const r={...Js,...t};try{const t=new oi(e),s=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw ci(e,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const t=s.ok?i.errorMessage:i.error.message,[n,a]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw ci(e,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw ci(e,"email-already-in-use",i);if("USER_DISABLED"===n)throw ci(e,"user-disabled",i);const o=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(a)throw $s(e,o,a);Vs(e,o)}}catch(t){if(t instanceof zn)throw t;Vs(e,"network-request-failed",{message:String(t)})}}async function si(e,t,n,r,s={}){const i=await ni(e,t,n,r,s);return"mfaPendingCredential"in i&&Vs(e,"multi-factor-auth-required",{_serverResponse:i}),i}async function ii(e,t,n,r){const s=`${t}${n}?${r}`,i=e,a=i.config.emulator?Xs(e.config,s):`${e.config.apiScheme}://${s}`;if(Zs.includes(n)&&(await i._persistenceManagerAvailable,"COOKIE"===i._getPersistenceType())){return i._getPersistence()._getFinalTarget(a).toString()}return a}function ai(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class oi{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(Fs(this.auth,"network-request-failed")),ei.get())})}}function ci(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Fs(e,t,r);return s.customData._tokenResponse=n,s}function ui(e){return void 0!==e&&void 0!==e.enterprise}class li{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 ai(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 hi(e,t){return ni(e,"POST","/v1/accounts:lookup",t)}function di(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function pi(e){return 1e3*Number(e)}function fi(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return Ms("JWT malformed, contained fewer than 3 sections"),null;try{const e=Rn(n);return e?JSON.parse(e):(Ms("Failed to decode base64 JWT payload"),null)}catch(e){return Ms("Caught error parsing JWT payload as JSON",e?.toString()),null}}function gi(e){const t=fi(e);return Hs(t,"internal-error"),Hs(void 0!==t.exp,"internal-error"),Hs(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function mi(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof zn&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class yi{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 _i{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=di(this.lastLoginAt),this.creationTime=di(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function wi(e){const t=e.auth,n=await e.getIdToken(),r=await mi(e,hi(t,{idToken:n}));Hs(r?.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const i=s.providerUserInfo?.length?vi(s.providerUserInfo):[],a=function(e,t){const n=e.filter(e=>!t.some(t=>t.providerId===e.providerId));return[...n,...t]}(e.providerData,i),o=e.isAnonymous,c=!(e.email&&s.passwordHash||a?.length),u=!!o&&c,l={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new _i(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(e,l)}function vi(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 bi{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Hs(e.idToken,"internal-error"),Hs(void 0!==e.idToken,"internal-error"),Hs(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):gi(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){Hs(0!==e.length,"internal-error");const t=gi(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(Hs(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:s}=await async function(e,t){const n=await ri(e,{},async()=>{const n=Yn({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:s}=e.config,i=await ii(e,r,"/v1/token",`key=${s}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const o={method:"POST",headers:a,body:n};return e.emulatorConfig&&nr(e.emulatorConfig.host)&&(o.credentials="include"),Qs.fetch()(i,o)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,r,Number(s))}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:s}=t,i=new bi;return n&&(Hs("string"==typeof n,"internal-error",{appName:e}),i.refreshToken=n),r&&(Hs("string"==typeof r,"internal-error",{appName:e}),i.accessToken=r),s&&(Hs("number"==typeof s,"internal-error",{appName:e}),i.expirationTime=s),i}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 bi,this.toJSON())}_performRefresh(){return zs("not implemented")}}function Ei(e,t){Hs("string"==typeof e||void 0===e,"internal-error",{appName:t})}class Ti{constructor({uid:e,auth:t,stsTokenManager:n,...r}){this.providerId="firebase",this.proactiveRefresh=new yi(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 _i(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await mi(this,this.stsTokenManager.getToken(this.auth,e));return Hs(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=tr(e),r=await n.getIdToken(t),s=fi(r);Hs(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,a=i?.sign_in_provider;return{claims:s,token:r,authTime:di(pi(s.auth_time)),issuedAtTime:di(pi(s.iat)),expirationTime:di(pi(s.exp)),signInProvider:a||null,signInSecondFactor:i?.sign_in_second_factor||null}}(this,e)}reload(){return async function(e){const t=tr(e);await wi(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(Hs(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 Ti({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){Hs(!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 wi(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(ms(this.auth.app))return Promise.reject(js(this.auth));const e=await this.getIdToken();return await mi(this,async function(e,t){return ni(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,s=t.phoneNumber??void 0,i=t.photoURL??void 0,a=t.tenantId??void 0,o=t._redirectEventId??void 0,c=t.createdAt??void 0,u=t.lastLoginAt??void 0,{uid:l,emailVerified:h,isAnonymous:d,providerData:p,stsTokenManager:f}=t;Hs(l&&f,e,"internal-error");const g=bi.fromJSON(this.name,f);Hs("string"==typeof l,e,"internal-error"),Ei(n,e.name),Ei(r,e.name),Hs("boolean"==typeof h,e,"internal-error"),Hs("boolean"==typeof d,e,"internal-error"),Ei(s,e.name),Ei(i,e.name),Ei(a,e.name),Ei(o,e.name),Ei(c,e.name),Ei(u,e.name);const m=new Ti({uid:l,auth:e,email:r,emailVerified:h,displayName:n,isAnonymous:d,photoURL:i,phoneNumber:s,tenantId:a,stsTokenManager:g,createdAt:c,lastLoginAt:u});return p&&Array.isArray(p)&&(m.providerData=p.map(e=>({...e}))),o&&(m._redirectEventId=o),m}static async _fromIdTokenResponse(e,t,n=!1){const r=new bi;r.updateFromServerResponse(t);const s=new Ti({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await wi(s),s}static async _fromGetAccountInfoResponse(e,t,n){const r=t.users[0];Hs(void 0!==r.localId,"internal-error");const s=void 0!==r.providerUserInfo?vi(r.providerUserInfo):[],i=!(r.email&&r.passwordHash||s?.length),a=new bi;a.updateFromIdToken(n);const o=new Ti({uid:r.localId,auth:e,stsTokenManager:a,isAnonymous:i}),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:s,metadata:new _i(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash||s?.length)};return Object.assign(o,c),o}}const Si=new Map;function Ai(e){qs(e instanceof Function,"Expected a class definition");let t=Si.get(e);return t?(qs(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Si.set(e,t),t)}class Ii{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){}}Ii.type="NONE";const Ci=Ii;function Oi(e,t,n){return`firebase:${e}:${t}:${n}`}class Ri{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=Oi(this.userKey,r.apiKey,s),this.fullPersistenceKey=Oi("persistence",r.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){const t=await hi(this.auth,{idToken:e}).catch(()=>{});return t?Ti._fromGetAccountInfoResponse(this.auth,t,e):null}return Ti._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 Ri(Ai(Ci),e,n);const r=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let s=r[0]||Ai(Ci);const i=Oi(n,e.config.apiKey,e.name);let a=null;for(const n of t)try{const t=await n._get(i);if(t){let r;if("string"==typeof t){const n=await hi(e,{idToken:t}).catch(()=>{});if(!n)break;r=await Ti._fromGetAccountInfoResponse(e,n,t)}else r=Ti._fromJSON(e,t);n!==s&&(a=r),s=n;break}}catch{}const o=r.filter(e=>e._shouldAllowMigration);return s._shouldAllowMigration&&o.length?(s=o[0],a&&await s._set(i,a.toJSON()),await Promise.all(t.map(async e=>{if(e!==s)try{await e._remove(i)}catch{}})),new Ri(s,e,n)):new Ri(s,e,n)}}function ki(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Di(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Ni(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Ui(t))return"Blackberry";if(Mi(t))return"Webos";if(xi(t))return"Safari";if((t.includes("chrome/")||Pi(t))&&!t.includes("edge/"))return"Chrome";if(Li(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 Ni(e=Vn()){return/firefox\//i.test(e)}function xi(e=Vn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Pi(e=Vn()){return/crios\//i.test(e)}function Di(e=Vn()){return/iemobile/i.test(e)}function Li(e=Vn()){return/android/i.test(e)}function Ui(e=Vn()){return/blackberry/i.test(e)}function Mi(e=Vn()){return/webos/i.test(e)}function Vi(e=Vn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Fi(){return function(){const e=Vn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function $i(e=Vn()){return Vi(e)||Li(e)||Mi(e)||Ui(e)||/windows phone/i.test(e)||Di(e)}function ji(e,t=[]){let n;switch(e){case"Browser":n=ki(Vn());break;case"Worker":n=`${ki(Vn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${ws}/${r}`}class Bi{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 Hi{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,s){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=s))}}class zi{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 Gi(this),this.idTokenSubscription=new Gi(this),this.beforeStateQueue=new Bi(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=Ls,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=Ai(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await Ri.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 hi(this,{idToken:e}),n=await Ti._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(ms(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,s=n?._redirectEventId,i=await this.tryRedirectSignIn(e);t&&t!==s||!i?.user||(n=i.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 Hs(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 wi(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(ms(this.app))return Promise.reject(js(this));const t=e?tr(e):null;return t&&Hs(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&&Hs(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 ms(this.app)?Promise.reject(js(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return ms(this.app)?Promise.reject(js(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Ai(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 ni(e,"GET","/v2/passwordPolicy",ti(e,t))}(this),t=new Hi(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 ni(e,"POST","/v2/accounts:revokeToken",ti(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&&Ai(e)||this._popupRedirectResolver;Hs(t,this,"argument-error"),this.redirectPersistenceManager=await Ri.create(this,[Ai(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 s="function"==typeof t?t:t.next.bind(t);let i=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(Hs(a,this,"internal-error"),a.then(()=>{i||s(this.currentUser)}),"function"==typeof t){const s=e.addObserver(t,n,r);return()=>{i=!0,s()}}{const n=e.addObserver(t);return()=>{i=!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 Hs(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=ji(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(ms(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){Us.logLevel<=cr.WARN&&Us.warn(`Auth (${ws}): ${e}`,...t)}(`Error while retrieving App Check token: ${e.error}`),e?.token}}function qi(e){return tr(e)}class Gi{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new Jn(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return Hs(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Ki={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Wi(e){return Ki.loadJS(e)}class Yi{constructor(){this.enterprise=new Xi}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Xi{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const Qi="NO_RECAPTCHA",Ji="onFirebaseAuthREInstanceReady";class Zi{constructor(e){this.type="recaptcha-enterprise",this.auth=qi(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 ni(e,"GET","/v2/recaptchaConfig",ti(e,t))})(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(r=>{if(void 0!==r.recaptchaKey){const n=new li(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 s=window.grecaptcha;ui(s)?s.enterprise.ready(()=>{s.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n(Qi)})}):r(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new Yi).execute("siteKey",{action:"verify"})}return new Promise((e,s)=>{n(this.auth).then(async n=>{if(!t&&ui(window.grecaptcha)&&Zi.scriptInjectionDeferred)await Zi.scriptInjectionDeferred.promise,r(n,e,s);else{if("undefined"==typeof window)return void s(new Error("RecaptchaVerifier is only supported in browser"));let t=Ki.recaptchaEnterpriseScript;0!==t.length&&(t+=n+`&onload=${Ji}`),Zi.scriptInjectionDeferred=new Un,window[Ji]=()=>{Zi.scriptInjectionDeferred?.resolve()},Wi(t).then(()=>Zi.scriptInjectionDeferred?.promise).then(()=>{r(n,e,s)}).catch(e=>{s(e)})}}).catch(e=>{s(e)})})}}async function ea(e,t,n,r=!1,s=!1){const i=new Zi(e);let a;if(s)a=Qi;else try{a=await i.verify(n)}catch(e){a=await i.verify(n,!0)}const o={...t};if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in o){const e=o.phoneEnrollmentInfo.phoneNumber,t=o.phoneEnrollmentInfo.recaptchaToken;Object.assign(o,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in o){const e=o.phoneSignInInfo.recaptchaToken;Object.assign(o,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return o}return r?Object.assign(o,{captchaResp:a}):Object.assign(o,{captchaResponse:a}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function ta(e,t,n,r,s){if(e._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await ea(e,t,n,"getOobCode"===n);return r(e,s)}return r(e,t).catch(async s=>{if("auth/missing-recaptcha-token"===s.code){const s=await ea(e,t,n,"getOobCode"===n);return r(e,s)}return Promise.reject(s)})}function na(e,t,n){const r=qi(e);Hs(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=ra(t),{host:i,port:a}=function(e){const t=ra(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const e=s[1];return{host:e,port:sa(r.substr(e.length+1))}}{const[e,t]=r.split(":");return{host:e,port:sa(t)}}}(t),o=null===a?"":`:${a}`,c={url:`${s}//${i}${o}/`},u=Object.freeze({host:i,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!r._canInitEmulator)return Hs(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),void Hs(Kn(c,r.config.emulator)&&Kn(u,r.emulatorConfig),r,"emulator-config-failed");r.config.emulator=c,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,nr(i)?rr(`${s}//${i}${o}`):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 ra(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function sa(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}Zi.scriptInjectionDeferred=null;class ia{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return zs("not implemented")}_getIdTokenResponse(e){return zs("not implemented")}_linkToIdToken(e,t){return zs("not implemented")}_getReauthenticationResolver(e){return zs("not implemented")}}async function aa(e,t){return ni(e,"POST","/v1/accounts:signUp",t)}async function oa(e,t){return si(e,"POST","/v1/accounts:signInWithPassword",ti(e,t))}async function ca(e,t){return ni(e,"POST","/v1/accounts:sendOobCode",ti(e,t))}async function ua(e,t){return ca(e,t)}class la extends ia{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new la(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new la(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 ta(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",oa);case"emailLink":return async function(e,t){return si(e,"POST","/v1/accounts:signInWithEmailLink",ti(e,t))}(e,{email:this._email,oobCode:this._password});default:Vs(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return ta(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",aa);case"emailLink":return async function(e,t){return si(e,"POST","/v1/accounts:signInWithEmailLink",ti(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:Vs(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function ha(e,t){return si(e,"POST","/v1/accounts:signInWithIdp",ti(e,t))}class da extends ia{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new da(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):Vs("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,...s}=t;if(!n||!r)return null;const i=new da(n,r);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(e){return ha(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,ha(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,ha(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=Yn(t)}return e}}class pa{constructor(e){const t=Xn(Qn(e)),n=t.apiKey??null,r=t.oobCode??null,s=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);Hs(n&&r&&s,"argument-error"),this.apiKey=n,this.operation=s,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=Xn(Qn(e)).link,n=t?Xn(Qn(t)).deep_link_id:null,r=Xn(Qn(e)).deep_link_id;return(r?Xn(Qn(r)).link:null)||r||n||t||e}(e);try{return new pa(t)}catch{return null}}}class fa{constructor(){this.providerId=fa.PROVIDER_ID}static credential(e,t){return la._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=pa.parseLink(t);return Hs(n,"argument-error"),la._fromEmailAndCode(e,n.code,n.tenantId)}}fa.PROVIDER_ID="password",fa.EMAIL_PASSWORD_SIGN_IN_METHOD="password",fa.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class ga{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 ma extends ga{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class ya extends ma{constructor(){super("facebook.com")}static credential(e){return da._fromParams({providerId:ya.PROVIDER_ID,signInMethod:ya.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ya.credentialFromTaggedObject(e)}static credentialFromError(e){return ya.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return ya.credential(e.oauthAccessToken)}catch{return null}}}ya.FACEBOOK_SIGN_IN_METHOD="facebook.com",ya.PROVIDER_ID="facebook.com";class _a extends ma{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return da._fromParams({providerId:_a.PROVIDER_ID,signInMethod:_a.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return _a.credentialFromTaggedObject(e)}static credentialFromError(e){return _a.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return _a.credential(t,n)}catch{return null}}}_a.GOOGLE_SIGN_IN_METHOD="google.com",_a.PROVIDER_ID="google.com";class wa extends ma{constructor(){super("github.com")}static credential(e){return da._fromParams({providerId:wa.PROVIDER_ID,signInMethod:wa.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return wa.credentialFromTaggedObject(e)}static credentialFromError(e){return wa.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return wa.credential(e.oauthAccessToken)}catch{return null}}}wa.GITHUB_SIGN_IN_METHOD="github.com",wa.PROVIDER_ID="github.com";class va extends ma{constructor(){super("twitter.com")}static credential(e,t){return da._fromParams({providerId:va.PROVIDER_ID,signInMethod:va.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return va.credentialFromTaggedObject(e)}static credentialFromError(e){return va.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return va.credential(t,n)}catch{return null}}}async function ba(e,t){return si(e,"POST","/v1/accounts:signUp",ti(e,t))}va.TWITTER_SIGN_IN_METHOD="twitter.com",va.PROVIDER_ID="twitter.com";class Ea{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 s=await Ti._fromIdTokenResponse(e,n,r),i=Ta(n);return new Ea({user:s,providerId:i,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const r=Ta(n);return new Ea({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function Ta(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class Sa extends zn{constructor(e,t,n,r){super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,Sa.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 Sa(e,t,n,r)}}function Aa(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw Sa._fromErrorAndOperation(e,n,t,r);throw n})}async function Ia(e,t,n=!1){if(ms(e.app))return Promise.reject(js(e));const r="signIn",s=await Aa(e,r,t),i=await Ea._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(i.user),i}async function Ca(e,t,n){if(ms(e.app))return Promise.reject(js(e));const r=qi(e),s=ta(r,{returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ba),i=await s.catch(t=>{throw"auth/password-does-not-meet-requirements"===t.code&&async function(e){const t=qi(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}(e),t}),a=await Ea._fromIdTokenResponse(r,"signIn",i);return await r._updateCurrentUser(a.user),a}async function Oa(e,t){const n=tr(e),r={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()},{email:s}=await async function(e,t){return ca(e,t)}(n.auth,r);s!==e.email&&await e.reload()}async function Ra(e,{displayName:t,photoURL:n}){if(void 0===t&&void 0===n)return;const r=tr(e),s={idToken:await r.getIdToken(),displayName:t,photoUrl:n,returnSecureToken:!0},i=await mi(r,async function(e,t){return ni(e,"POST","/v1/accounts:update",t)}(r.auth,s));r.displayName=i.displayName||null,r.photoURL=i.photoUrl||null;const a=r.providerData.find(({providerId:e})=>"password"===e);a&&(a.displayName=r.displayName,a.photoURL=r.photoURL),await r._updateTokensIfNecessary(i)}async function ka(e,t,n){const{auth:r}=e,s={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(s.email=t),n&&(s.password=n);const i=await mi(e,async function(e,t){return ni(e,"POST","/v1/accounts:update",t)}(r,s));await e._updateTokensIfNecessary(i,!0)}const Na="__sak";class xa{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Na,"1"),this.storage.removeItem(Na),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 Pa extends xa{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=$i(),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)},s=this.storage.getItem(n);Fi()&&s!==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]}}Pa.type="LOCAL";const Da=Pa;class La extends xa{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}La.type="SESSION";const Ua=La;class Ma{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 Ma(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:s}=t.data,i=this.handlersMap[r];if(!i?.size)return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const a=Array.from(i).map(async e=>e(t.origin,s)),o=await function(e){return Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}}))}(a);t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:o})}_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 Va(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}Ma.receivers=[];class Fa{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 s,i;return new Promise((a,o)=>{const c=Va("",20);r.port1.start();const u=setTimeout(()=>{o(new Error("unsupported_event"))},n);i={messageChannel:r,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{o(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(t.data.response);break;default:clearTimeout(u),clearTimeout(s),o(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}function $a(){return window}function ja(){return void 0!==$a().WorkerGlobalScope&&"function"==typeof $a().importScripts}const Ba="firebaseLocalStorageDb",Ha="firebaseLocalStorage",za="fbase_key";class qa{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 Ga(e,t){return e.transaction([Ha],t?"readwrite":"readonly").objectStore(Ha)}function Ka(){const e=indexedDB.open(Ba,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(Ha,{keyPath:za})}catch(e){n(e)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(Ha)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Ba);return new qa(e).toPromise()}(),t(await Ka()))})})}async function Wa(e,t,n){const r=Ga(e,!0).put({[za]:t,value:n});return new qa(r).toPromise()}function Ya(e,t){const n=Ga(e,!0).delete(t);return new qa(n).toPromise()}class Xa{constructor(){this.type="LOCAL",this.dbPromise=null,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.dbPromise||(this.dbPromise=Ka(),this.dbPromise.catch(()=>{this.dbPromise=null})),this.dbPromise}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;if(this.dbPromise){(await this.dbPromise).close(),this.dbPromise=null}}}async initializeServiceWorkerMessaging(){return ja()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ma._getInstance(ja()?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 Fa(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{return!!indexedDB&&(await this._withRetries(async e=>{await Wa(e,Na,"1"),await Ya(e,Na)}),!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=>Wa(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=Ga(e,!1).get(t),r=await new qa(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=>Ya(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(e=>{const t=Ga(e,!1).getAll();return new qa(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:s}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),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()}}Xa.type="LOCAL";const Qa=Xa;new Ys(3e4,6e4);class Ja extends ia{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ha(e,this._buildIdpRequest())}_linkToIdToken(e,t){return ha(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return ha(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 Za(e){return Ia(e.auth,new Ja(e),e.bypassAuthState)}function eo(e){const{auth:t,user:n}=e;return Hs(n,t,"internal-error"),async function(e,t,n=!1){const{auth:r}=e;if(ms(r.app))return Promise.reject(js(r));const s="reauthenticate";try{const i=await mi(e,Aa(r,s,t,e),n);Hs(i.idToken,r,"internal-error");const a=fi(i.idToken);Hs(a,r,"internal-error");const{sub:o}=a;return Hs(e.uid===o,r,"user-mismatch"),Ea._forOperation(e,s,i)}catch(e){throw"auth/user-not-found"===e?.code&&Vs(r,"user-mismatch"),e}}(n,new Ja(e),e.bypassAuthState)}async function to(e){const{auth:t,user:n}=e;return Hs(n,t,"internal-error"),async function(e,t,n=!1){const r=await mi(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return Ea._forOperation(e,"link",r)}(n,new Ja(e),e.bypassAuthState)}class no{constructor(e,t,n,r,s=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:r,tenantId:s,error:i,type:a}=e;if(i)return void this.reject(i);const o={auth:this.auth,requestUri:t,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(o))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Za;case"linkViaPopup":case"linkViaRedirect":return to;case"reauthViaPopup":case"reauthViaRedirect":return eo;default:Vs(this.auth,"internal-error")}}resolve(e){qs(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){qs(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 ro=new Ys(2e3,1e4);class so extends no{constructor(e,t,n,r,s){super(e,t,r,s),this.provider=n,this.authWindow=null,this.pollId=null,so.currentPopupAction&&so.currentPopupAction.cancel(),so.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Hs(e,this.auth,"internal-error"),e}async onExecution(){qs(1===this.filter.length,"Popup operations only handle one event");const e=Va();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(Fs(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(Fs(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,so.currentPopupAction=null}pollUserCancellation(){const e=()=>{this.authWindow?.window?.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Fs(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(e,ro.get())};e()}}so.currentPopupAction=null;const io="pendingRedirect",ao=new Map;class oo extends no{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=ao.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=function(e){return Oi(io,e.config.apiKey,e.name)}(t),r=function(e){return Ai(e._redirectPersistence)}(e);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth),n=t?await super.execute():null;e=()=>Promise.resolve(n)}catch(t){e=()=>Promise.reject(t)}ao.set(this.auth._key(),e)}return this.bypassAuthState||ao.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 co(e,t){ao.set(e._key(),t)}async function uo(e,t,n=!1){if(ms(e.app))return Promise.reject(js(e));const r=qi(e),s=function(e,t){return t?Ai(t):(Hs(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(r,t),i=new oo(r,s,n),a=await i.execute();return a&&!n&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,t)),a}class lo{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 po(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!po(e)){const n=e.error.code?.split("auth/")[1]||"internal-error";t.onError(Fs(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(ho(e))}saveEventToCache(e){this.cachedEventUids.add(ho(e)),this.lastProcessedEventTime=Date.now()}}function ho(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function po({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===t?.code}const fo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,go=/^https?/;async function mo(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return ni(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(yo(e))return}catch{}Vs(e,"unauthorized-domain")}function yo(e){const t=Gs(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const s=new URL(e);return""===s.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===r}if(!go.test(n))return!1;if(fo.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}const _o=new Ys(3e4,6e4);function wo(){const e=$a().___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 vo(e){return new Promise((t,n)=>{function r(){wo(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{wo(),n(Fs(e,"network-request-failed"))},timeout:_o.get()})}if($a().gapi?.iframes?.Iframe)t(gapi.iframes.getContext());else{if(!$a().gapi?.load){const t=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return $a()[t]=()=>{gapi.load?r():n(Fs(e,"network-request-failed"))},Wi(`${Ki.gapiScript}?onload=${t}`).catch(e=>n(e))}r()}}).catch(e=>{throw bo=null,e})}let bo=null;const Eo=new Ys(5e3,15e3),To={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},So=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Ao(e){const t=e.config;Hs(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Xs(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,r={apiKey:t.apiKey,appName:e.name,v:ws},s=So.get(e.config.apiHost);s&&(r.eid=s);const i=e._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${Yn(r).slice(1)}`}async function Io(e){const t=await function(e){return bo=bo||vo(e),bo}(e),n=$a().gapi;return Hs(n,e,"internal-error"),t.open({where:document.body,url:Ao(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:To,dontclear:!0},t=>new Promise(async(n,r)=>{await t.restyle({setHideOnLeave:!1});const s=Fs(e,"network-request-failed"),i=$a().setTimeout(()=>{r(s)},Eo.get());function a(){$a().clearTimeout(i),n(t)}t.ping(a).then(a,()=>{r(s)})}))}const Co={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Oo{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function Ro(e,t,n,r=500,s=600){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let o="";const c={...Co,width:r.toString(),height:s.toString(),top:i,left:a},u=Vn().toLowerCase();n&&(o=Pi(u)?"_blank":n),Ni(u)&&(t=t||"http://localhost",c.scrollbars="yes");const l=Object.entries(c).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=Vn()){return Vi(e)&&!!window.navigator?.standalone}(u)&&"_self"!==o)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||"",o),new Oo(null);const h=window.open(t||"",o,l);Hs(h,e,"popup-blocked");try{h.focus()}catch(e){}return new Oo(h)}const ko="__/auth/handler",No="emulator/auth/handler",xo=encodeURIComponent("fac");async function Po(e,t,n,r,s,i){Hs(e.config.authDomain,e,"auth-domain-config-required"),Hs(e.config.apiKey,e,"invalid-api-key");const a={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:ws,eventId:s};if(t instanceof ga){t.setDefaultLanguage(e.languageCode),a.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(a.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries({}))a[e]=t}if(t instanceof ma){const e=t.getScopes().filter(e=>""!==e);e.length>0&&(a.scopes=e.join(","))}e.tenantId&&(a.tid=e.tenantId);const o=a;for(const e of Object.keys(o))void 0===o[e]&&delete o[e];const c=await e._getAppCheckToken(),u=c?`#${xo}=${encodeURIComponent(c)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${ko}`;return Xs(e,No)}(e)}?${Yn(o).slice(1)}${u}`}const Do="webStorageSupport";const Lo=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Ua,this._completeRedirectFn=uo,this._overrideRedirectResult=co}async _openPopup(e,t,n,r){qs(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");return Ro(e,await Po(e,t,n,Gs(),r),Va())}async _openRedirect(e,t,n,r){await this._originValidation(e);return function(e){$a().location.href=e}(await Po(e,t,n,Gs(),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):(qs(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 Io(e),n=new lo(e);return t.register("authEvent",t=>{Hs(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(Do,{type:Do},n=>{const r=n?.[0]?.[Do];void 0!==r&&t(!!r),Vs(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=mo(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return $i()||xi()||Vi()}};var Uo="@firebase/auth",Mo="1.13.3";class Vo{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(){Hs(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const Fo=Ln("authIdTokenMaxAge")||300;let $o=null;function jo(e=bs()){const t=gs(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=gs(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(Kn(n.getOptions(),t??{}))return e;Vs(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:Lo,persistence:[Qa,Da,Ua]}),r=Ln("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(r,location.origin);if(location.origin===e.origin){const t=(s=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>Fo)return;const r=t?.token;$o!==r&&($o=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(e,t,n){tr(e).beforeAuthStateChanged(t,n)}(n,t,()=>t(n.currentUser)),function(e,t,n,r){tr(e).onIdTokenChanged(t,n,r)}(n,e=>t(e))}}var s;const i=xn("auth");return i&&na(n,`http://${i}`),n}var Bo;!function(e){Ki=e}({loadJS:e=>new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=Fs("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="}),Bo="Browser",fs(new sr("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=n.options;Hs(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const o={apiKey:i,authDomain:a,clientPlatform:Bo,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ji(Bo)},c=new zi(n,r,s,o);return function(e,t){const n=t?.persistence||[],r=(Array.isArray(n)?n:[n]).map(Ai);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()})),fs(new sr("auth-internal",e=>(e=>new Vo(e))(qi(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),Es(Uo,Mo,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}}(Bo)),Es(Uo,Mo,"esm2020");Es("firebase","12.15.0","app");var Ho,zo="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 s=0;s<16;++s)r[s]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(s=0;s<16;++s)r[s]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],s=e.g[2];let i,a=e.g[3];i=t+(a^n&(s^a))+r[0]+3614090360&4294967295,i=a+(s^(t=n+(i<<7&4294967295|i>>>25))&(n^s))+r[1]+3905402710&4294967295,a=t+(i<<12&4294967295|i>>>20),i=s+(n^a&(t^n))+r[2]+606105819&4294967295,i=n+(t^(s=a+(i<<17&4294967295|i>>>15))&(a^t))+r[3]+3250441966&4294967295,i=t+(a^(n=s+(i<<22&4294967295|i>>>10))&(s^a))+r[4]+4118548399&4294967295,i=a+(s^(t=n+(i<<7&4294967295|i>>>25))&(n^s))+r[5]+1200080426&4294967295,a=t+(i<<12&4294967295|i>>>20),i=s+(n^a&(t^n))+r[6]+2821735955&4294967295,i=n+(t^(s=a+(i<<17&4294967295|i>>>15))&(a^t))+r[7]+4249261313&4294967295,i=t+(a^(n=s+(i<<22&4294967295|i>>>10))&(s^a))+r[8]+1770035416&4294967295,i=a+(s^(t=n+(i<<7&4294967295|i>>>25))&(n^s))+r[9]+2336552879&4294967295,a=t+(i<<12&4294967295|i>>>20),i=s+(n^a&(t^n))+r[10]+4294925233&4294967295,i=n+(t^(s=a+(i<<17&4294967295|i>>>15))&(a^t))+r[11]+2304563134&4294967295,i=t+(a^(n=s+(i<<22&4294967295|i>>>10))&(s^a))+r[12]+1804603682&4294967295,i=a+(s^(t=n+(i<<7&4294967295|i>>>25))&(n^s))+r[13]+4254626195&4294967295,a=t+(i<<12&4294967295|i>>>20),i=s+(n^a&(t^n))+r[14]+2792965006&4294967295,i=n+(t^(s=a+(i<<17&4294967295|i>>>15))&(a^t))+r[15]+1236535329&4294967295,i=t+(s^a&((n=s+(i<<22&4294967295|i>>>10))^s))+r[1]+4129170786&4294967295,i=a+(n^s&((t=n+(i<<5&4294967295|i>>>27))^n))+r[6]+3225465664&4294967295,a=t+(i<<9&4294967295|i>>>23),i=s+(t^n&(a^t))+r[11]+643717713&4294967295,i=n+(a^t&((s=a+(i<<14&4294967295|i>>>18))^a))+r[0]+3921069994&4294967295,i=t+(s^a&((n=s+(i<<20&4294967295|i>>>12))^s))+r[5]+3593408605&4294967295,i=a+(n^s&((t=n+(i<<5&4294967295|i>>>27))^n))+r[10]+38016083&4294967295,a=t+(i<<9&4294967295|i>>>23),i=s+(t^n&(a^t))+r[15]+3634488961&4294967295,i=n+(a^t&((s=a+(i<<14&4294967295|i>>>18))^a))+r[4]+3889429448&4294967295,i=t+(s^a&((n=s+(i<<20&4294967295|i>>>12))^s))+r[9]+568446438&4294967295,i=a+(n^s&((t=n+(i<<5&4294967295|i>>>27))^n))+r[14]+3275163606&4294967295,a=t+(i<<9&4294967295|i>>>23),i=s+(t^n&(a^t))+r[3]+4107603335&4294967295,i=n+(a^t&((s=a+(i<<14&4294967295|i>>>18))^a))+r[8]+1163531501&4294967295,i=t+(s^a&((n=s+(i<<20&4294967295|i>>>12))^s))+r[13]+2850285829&4294967295,i=a+(n^s&((t=n+(i<<5&4294967295|i>>>27))^n))+r[2]+4243563512&4294967295,a=t+(i<<9&4294967295|i>>>23),i=s+(t^n&(a^t))+r[7]+1735328473&4294967295,i=n+(a^t&((s=a+(i<<14&4294967295|i>>>18))^a))+r[12]+2368359562&4294967295,i=t+((n=s+(i<<20&4294967295|i>>>12))^s^a)+r[5]+4294588738&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^s)+r[8]+2272392833&4294967295,a=t+(i<<11&4294967295|i>>>21),i=s+(a^t^n)+r[11]+1839030562&4294967295,i=n+((s=a+(i<<16&4294967295|i>>>16))^a^t)+r[14]+4259657740&4294967295,i=t+((n=s+(i<<23&4294967295|i>>>9))^s^a)+r[1]+2763975236&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^s)+r[4]+1272893353&4294967295,a=t+(i<<11&4294967295|i>>>21),i=s+(a^t^n)+r[7]+4139469664&4294967295,i=n+((s=a+(i<<16&4294967295|i>>>16))^a^t)+r[10]+3200236656&4294967295,i=t+((n=s+(i<<23&4294967295|i>>>9))^s^a)+r[13]+681279174&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^s)+r[0]+3936430074&4294967295,a=t+(i<<11&4294967295|i>>>21),i=s+(a^t^n)+r[3]+3572445317&4294967295,i=n+((s=a+(i<<16&4294967295|i>>>16))^a^t)+r[6]+76029189&4294967295,i=t+((n=s+(i<<23&4294967295|i>>>9))^s^a)+r[9]+3654602809&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^s)+r[12]+3873151461&4294967295,a=t+(i<<11&4294967295|i>>>21),i=s+(a^t^n)+r[15]+530742520&4294967295,i=n+((s=a+(i<<16&4294967295|i>>>16))^a^t)+r[2]+3299628645&4294967295,i=t+(s^((n=s+(i<<23&4294967295|i>>>9))|~a))+r[0]+4096336452&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~s))+r[7]+1126891415&4294967295,a=t+(i<<10&4294967295|i>>>22),i=s+(t^(a|~n))+r[14]+2878612391&4294967295,i=n+(a^((s=a+(i<<15&4294967295|i>>>17))|~t))+r[5]+4237533241&4294967295,i=t+(s^((n=s+(i<<21&4294967295|i>>>11))|~a))+r[12]+1700485571&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~s))+r[3]+2399980690&4294967295,a=t+(i<<10&4294967295|i>>>22),i=s+(t^(a|~n))+r[10]+4293915773&4294967295,i=n+(a^((s=a+(i<<15&4294967295|i>>>17))|~t))+r[1]+2240044497&4294967295,i=t+(s^((n=s+(i<<21&4294967295|i>>>11))|~a))+r[8]+1873313359&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~s))+r[15]+4264355552&4294967295,a=t+(i<<10&4294967295|i>>>22),i=s+(t^(a|~n))+r[6]+2734768916&4294967295,i=n+(a^((s=a+(i<<15&4294967295|i>>>17))|~t))+r[13]+1309151649&4294967295,i=t+(s^((n=s+(i<<21&4294967295|i>>>11))|~a))+r[4]+4149444226&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~s))+r[11]+3174756917&4294967295,a=t+(i<<10&4294967295|i>>>22),i=s+(t^(a|~n))+r[2]+718787259&4294967295,i=n+(a^((s=a+(i<<15&4294967295|i>>>17))|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(s+(i<<21&4294967295|i>>>11))&4294967295,e.g[2]=e.g[2]+s&4294967295,e.g[3]=e.g[3]+a&4294967295}function r(e,t){this.h=t;const n=[];let r=!0;for(let s=e.length-1;s>=0;s--){const i=0|e[s];r&&i==t||(n[s]=i,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 s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return t.prototype[n].apply(e,s)}}(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,s=this.C;let i=this.h,a=0;for(;a<t;){if(0==i)for(;a<=r;)n(this,e,a),a+=this.blockSize;if("string"==typeof e){for(;a<t;)if(s[i++]=e.charCodeAt(a++),i==this.blockSize){n(this,s),i=0;break}}else for(;a<t;)if(s[i++]=e[a++],i==this.blockSize){n(this,s),i=0;break}}this.h=i,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 s={};function i(e){return-128<=e&&e<128?function(e,t){var n=s;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 a(e){if(isNaN(e)||!isFinite(e))return o;if(e<0)return d(a(-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 o=i(0),c=i(1),u=i(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 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(l(t))throw Error("division by zero");if(l(e))return new g(o,o);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 s=_(n,1),i=_(r,1);for(r=_(r,2),n=_(n,2);!l(r);){var u=i.add(r);u.l(e)<=0&&(s=s.add(n),i=u),r=_(r,1),n=_(n,1)}return t=p(e,s.j(t)),new g(s,t)}for(s=o;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),u=(i=a(n)).j(t);h(u)||u.l(e)>0;)u=(i=a(n-=r)).j(t);l(i)&&(i=c),s=s.add(i),e=p(e,u)}return new g(s,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 s=e.g.length-n,i=[];for(let r=0;r<s;r++)i[r]=t>0?e.i(r+n)>>>t|e.i(r+n+1)<<32-t:e.i(r+n);return new r(i,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(l(this))return"0";if(h(this))return"-"+d(this).toString(e);const t=a(Math.pow(e,6));var n=this;let r="";for(;;){const s=m(n,t).g;let i=(((n=p(n,s.j(t))).g.length>0?n.g[0]:n.h)>>>0).toString(e);if(l(n=s))return i+r;for(;i.length<6;)i="0"+i;r=i+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:l(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 s=0;for(let r=0;r<=t;r++){let t=s+(65535&this.i(r))+(65535&e.i(r)),i=(t>>>16)+(this.i(r)>>>16)+(e.i(r)>>>16);s=i>>>16,t&=65535,i&=65535,n[r]=i<<16|t}return new r(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(l(this)||l(e))return o;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(u)<0&&e.l(u)<0)return a(this.m()*e.m());const t=this.g.length+e.g.length,n=[];for(var s=0;s<2*t;s++)n[s]=0;for(s=0;s<this.g.length;s++)for(let t=0;t<e.g.length;t++){const r=this.i(s)>>>16,i=65535&this.i(s),a=e.i(t)>>>16,o=65535&e.i(t);n[2*s+2*t]+=i*o,f(n,2*s+2*t),n[2*s+2*t+1]+=r*o,f(n,2*s+2*t+1),n[2*s+2*t+1]+=i*a,f(n,2*s+2*t+1),n[2*s+2*t+2]+=r*a,f(n,2*s+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=a,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=a(Math.pow(n,8));let s=o;for(let e=0;e<t.length;e+=8){var i=Math.min(8,t.length-e);const o=parseInt(t.substring(e,e+i),n);i<8?(i=a(Math.pow(n,i)),s=s.j(i).add(a(o))):(s=s.j(r),s=s.add(a(o)))}return s},Ho=r}).apply(void 0!==zo?zo:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var qo,Go,Ko,Wo,Yo,Xo,Qo,Jo,Zo="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 Zo&&Zo];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 s=n;e=e.split(".");for(var i=0;i<e.length-1;i++){var a=e[i];if(!(a in s))break e;s=s[a]}(r=r(i=s[e=e[e.length-1]]))!=i&&null!=r&&t(s,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 s=s||{},i=this||self;function a(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function o(e,t,n){return e.call.apply(e.bind,arguments)}function c(e,t,n){return(c=o).apply(null,arguments)}function u(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,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return t.prototype[n].apply(e,s)}}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 s=0;s<t;s++)e[n+s]=r[s]}else e.push(r)}}function f(e){i.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 S(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()()},S.prototype.h=function(){this.defaultPrevented=!0};var A=function(){if(!i.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};i.addEventListener("test",e,t),i.removeEventListener("test",e,t)}catch(e){}return e}();function I(e){return/^[\s\xa0]*$/.test(e)}function C(e,t){S.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,S),C.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&&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 O="closure_listenable_"+(1e6*Math.random()|0),R=0;function k(e,t,n,r,s){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=s,this.key=++R,this.da=this.fa=!1}function N(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 P(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 U(e){this.src=e,this.g={},this.h=0}function M(e,t){const n=t.type;if(n in e.g){var r,s=e.g[n],i=Array.prototype.indexOf.call(s,t,void 0);(r=i>=0)&&Array.prototype.splice.call(s,i,1),r&&(N(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function V(e,t,n,r){for(let s=0;s<e.length;++s){const i=e[s];if(!i.da&&i.listener==t&&i.capture==!!n&&i.ha==r)return s}return-1}U.prototype.add=function(e,t,n,r,s){const i=e.toString();(e=this.g[i])||(e=this.g[i]=[],this.h++);const a=V(e,t,r,s);return a>-1?(t=e[a],n||(t.fa=!1)):((t=new k(t,this.src,i,!!r,s)).fa=n,e.push(t)),t};var F="closure_lm_"+(1e6*Math.random()|0),$={};function j(e,t,n,r,s){if(Array.isArray(t)){for(let i=0;i<t.length;i++)j(e,t[i],n,r,s);return null}return n=W(n),e&&e[O]?e.J(t,n,!!a(r)&&!!r.capture,s):function(e,t,n,r,s,i){if(!t)throw Error("Invalid event type");const o=a(s)?!!s.capture:!!s;let c=G(e);if(c||(e[F]=c=new U(e)),n=c.add(t,n,r,o,i),n.proxy)return n;if(r=function(){function e(n){return t.call(e.src,e.listener,n)}const t=q;return e}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)A||(s=o),void 0===s&&(s=!1),e.addEventListener(t.toString(),r,s);else if(e.attachEvent)e.attachEvent(z(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,s)}function B(e,t,n,r,s){if(Array.isArray(t))for(var i=0;i<t.length;i++)B(e,t[i],n,r,s);else r=a(r)?!!r.capture:!!r,n=W(n),e&&e[O]?(e=e.i,(i=String(t).toString())in e.g&&((n=V(t=e.g[i],n,r,s))>-1&&(N(t[n]),Array.prototype.splice.call(t,n,1),0==t.length&&(delete e.g[i],e.h--)))):e&&(e=G(e))&&(t=e.g[t.toString()],e=-1,t&&(e=V(t,n,r,s)),(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[O])M(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(z(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=G(t))?(M(n,e),0==n.h&&(n.src=null,t[F]=null)):N(e)}}}function z(e){return e in $?$[e]:$[e]="on"+e}function q(e,t){if(e.da)e=!0;else{t=new C(t,this);const n=e.listener,r=e.ha||e.src;e.fa&&H(e),e=n.call(r,t)}return e}function G(e){return(e=e[F])instanceof U?e:null}var K="__closure_events_fn_"+(1e9*Math.random()>>>0);function W(e){return"function"==typeof e?e:(e[K]||(e[K]=function(t){return e.handleEvent(t)}),e[K])}function Y(){T.call(this),this.i=new U(this),this.M=this,this.G=null}function X(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 S(t,e);else if(t instanceof S)t.target=t.target||e;else{var s=t;L(t=new S(r,e),s)}let i,a;if(s=!0,n)for(a=n.length-1;a>=0;a--)i=t.g=n[a],s=Q(i,r,!0,t)&&s;if(i=t.g=e,s=Q(i,r,!0,t)&&s,s=Q(i,r,!1,t)&&s,n)for(a=0;a<n.length;a++)i=t.g=n[a],s=Q(i,r,!1,t)&&s}function Q(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();let s=!0;for(let i=0;i<t.length;++i){const a=t[i];if(a&&!a.da&&a.capture==n){const t=a.listener,n=a.ha||a.src;a.fa&&M(e.i,a),s=!1!==t.call(n,r)&&s}}return s&&!r.defaultPrevented}function J(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:i.setTimeout(e,t||0)}(()=>{e.g=null,e.i&&(e.i=!1,J(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}l(Y,T),Y.prototype[O]=!0,Y.prototype.removeEventListener=function(e,t,n,r){B(this,e,t,n,r)},Y.prototype.N=function(){if(Y.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++)N(n[e]);delete e.g[t],e.h--}}this.G=null},Y.prototype.J=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},Y.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:J(this)}N(){super.N(),this.g&&(i.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ee(e){T.call(this),this.h=e,this.g={}}l(ee,T);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 re=i.JSON.stringify,se=i.JSON.parse,ie=class{stringify(e){return i.JSON.stringify(e,void 0)}parse(e){return i.JSON.parse(e,void 0)}};function ae(){}function oe(){}var ce={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function ue(){S.call(this,"d")}function le(){S.call(this,"c")}l(ue,S),l(le,S);var he={},de=null;function pe(){return de=de||new Y}function fe(e){S.call(this,he.Ia,e)}function ge(e){const t=pe();X(t,new fe(t))}function me(e,t){S.call(this,he.STAT_EVENT,e),this.stat=t}function ye(e){const t=pe();X(t,new me(t,e))}function _e(e,t){S.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 i.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 i=JSON.parse(t);if(i)for(e=0;e<i.length;e++)if(Array.isArray(i[e])){var n=i[e];if(!(n.length<2)){var r=n[1];if(Array.isArray(r)&&!(r.length<1)){var s=r[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(let e=1;e<r.length;e++)r[e]=""}}}return re(i)}catch(e){return t}}(e,n)+(r?" "+r:"")})}he.Ia="serverreachability",l(fe,S),he.STAT_EVENT="statevent",l(me,S),he.Ja="timingevent",l(_e,S),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},Se={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"};function Ae(){}function Ie(e){return encodeURIComponent(String(e))}function Ce(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 Oe(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}l(Ae,ae),Ae.prototype.g=function(){return new XMLHttpRequest},Ee=new Ae;var ke={},Ne={};function xe(e,t,n){e.M=1,e.A=rt(Je(t)),e.u=n,e.R=!0,Pe(e,null)}function Pe(e,t){e.F=Date.now(),Ue(e),e.B=Je(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 s="readystatechange";Array.isArray(s)||(s&&(te[0]=s.toString()),s=te);for(let e=0;e<s.length;e++){const i=j(n,s[e],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}t=e.J?P(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,s,i){e.info(function(){if(e.g)if(i){var a="",o=i.split("&");for(let e=0;e<o.length;e++){var c=o[e].split("=");if(c.length>1){const e=c[0];c=c[1];const t=e.split("_");a=t.length>=2&&"type"==t[1]?a+(e+"=")+c+"&":a+(e+"=redacted&")}}}else a=null;else a=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+t+"\n"+n+"\n"+a})}(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?Ne:(n=Number(t.substring(n,r)),isNaN(n)?ke:(r+=1)+n>t.length?Ne:(t=t.slice(r,r+n),e.C=r+n,t))}function Ue(e){e.T=Date.now()+e.H,Me(e,e.H)}function Me(e,t){if(null!=e.D)throw Error("WatchDog timer not null");e.D=we(c(e.aa,e),t)}function Ve(e){e.D&&(i.clearTimeout(e.D),e.D=null)}function Fe(e){0==e.j.I||e.K||Jt(e.j,e)}function $e(e){Ve(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 je(e,t){try{var n=e.j;if(0!=n.I&&(n.g==e||Ge(n.h,e)))if(!e.L&&Ge(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 s=r;if(0==s[0]){e:if(!n.v){if(n.g){if(!(n.g.F+3e3<e.F))break e;Qt(n),jt(n)}Wt(n),ye(18)}}else n.xa=s[1],0<n.xa-n.K&&s[2]<37500&&n.F&&0==n.A&&!n.C&&(n.C=we(c(n.Va,n),6e3));qe(n.h)<=1&&n.ta&&(n.ta=void 0)}else en(n,11)}else if((e.L||n.g==e)&&Qt(n),!I(t))for(s=n.Ba.g.parse(t),t=0;t<s.length;t++){let c=s[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 s=c[4];null!=s&&(n.za=s,n.j.info("SVER="+n.za));const l=c[5];null!=l&&"number"==typeof l&&l>0&&(r=1.5*l,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 i=r.h;i.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(i.j=i.l,i.g=new Set,i.h&&(Ke(i,i.h),i.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 a=e;if((r=n).na=nn(r,r.L?r.ba:null,r.W),a.L){We(r.h,a);var o=a,u=r.O;u&&(o.H=u),o.D&&(Ve(o),Ue(o)),r.g=a}else Kt(r);n.i.length>0&&Ht(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):$t(n):"noop"!=c[0]&&n.l&&n.l.qa(c),n.A=0)}ge()}catch(e){}}Oe.prototype.ba=function(e){e=e.target;const t=this.O;t&&3==Ut(e)?t.j():this.Y(e)},Oe.prototype.Y=function(e){try{if(e==this.g)e:{const c=Ut(this.g),u=this.g.ya();this.g.ca();if(!(c<3)&&(3!=c||this.g&&(this.h.h||this.g.la()||Mt(this.g)))){this.K||4!=c||7==u||ge(),Ve(this);var t=this.g.ca();this.X=t;var n=function(e){if(!De(e))return e.g.la();const t=Mt(e.g);if(""===t)return"";let n="";const r=t.length,s=4==Ut(e.g);if(!e.h.i){if("undefined"==typeof TextDecoder)return $e(e),Fe(e),"";e.h.i=new i.TextDecoder}for(let i=0;i<r;i++)e.h.h=!0,n+=e.h.i.decode(t[i],{stream:!(s&&i==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,s,i,a){e.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+t+"\n"+n+"\n"+i+" "+a})}(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,s=this.g;if((r=s.g?s.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!I(r)){var a=r;break t}}a=null}if(!(e=a)){this.o=!1,this.m=3,ye(12),$e(this),Fe(this);break e}be(this.i,this.l,e,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,je(this,e)}if(this.R){let t;for(e=!0;!this.K&&this.C<n.length;){if(t=Le(this,n),t==Ne){4==c&&(this.m=4,ye(14),e=!1),be(this.i,this.l,null,"[Incomplete Response]");break}if(t==ke){this.m=4,ye(15),be(this.i,this.l,n,"[Invalid Chunk]"),e=!1;break}be(this.i,this.l,t,null),je(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 o=this.j;o.g==this&&o.aa&&!o.P&&(o.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Yt(o),o.P=!0,ye(11))}}else be(this.i,this.l,n,"[Invalid Chunked Response]"),$e(this),Fe(this)}else be(this.i,this.l,n,null),je(this,n);4==c&&$e(this),this.o&&!this.K&&(4==c?Jt(this.j,this):(this.o=!1,Ue(this)))}else(function(e){const t={};e=(e.g&&Ut(e)>=2&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let r=0;r<e.length;r++){if(I(e[r]))continue;var n=Ce(e[r]);const s=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const i=t[s]||[];t[s]=i,i.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)),$e(this),Fe(this)}}}catch(e){}},Oe.prototype.cancel=function(){this.K=!0,$e(this)},Oe.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)),$e(this),this.m=2,Fe(this)):Me(this,this.T-e)};var Be=class{constructor(e,t){this.g=e,this.map=t}};function He(e){this.l=e||10,i.PerformanceNavigationTiming?e=(e=i.performance.getEntriesByType("navigation")).length>0&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(i.chrome&&i.chrome.loadTimes&&i.chrome.loadTimes()&&i.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 qe(e){return e.h?1:e.g?e.g.size:0}function Ge(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Ke(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 Ye(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)}He.prototype.cancel=function(){if(this.i=Ye(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 Xe=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Qe(e){let t;this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1,e instanceof Qe?(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(Xe))?(this.l=!1,Ze(this,t[1]||"",!0),this.o=st(t[2]||""),this.g=st(t[3]||"",!0),et(this,t[4]),this.h=st(t[5]||"",!0),tt(this,t[6]||"",!0),this.m=st(t[7]||"")):(this.l=!1,this.i=new dt(null,this.l))}function Je(e){return new Qe(e)}function Ze(e,t,n){e.j=n?st(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=it(t,lt)),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 st(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,at),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function at(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Qe.prototype.toString=function(){const e=[];var t=this.j;t&&e.push(it(t,ot,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(it(t,ot,!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)?ut:ct,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",it(n,ht)),e.join("")},Qe.prototype.resolve=function(e){const t=Je(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 s=t.h.lastIndexOf("/");-1!=s&&(r=t.h.slice(0,s+1)+r)}if(".."==(s=r)||"."==s)r="";else if(-1!=s.indexOf("./")||-1!=s.indexOf("/.")){r=0==s.lastIndexOf("/",0),s=s.split("/");const e=[];for(let t=0;t<s.length;){const n=s[t++];"."==n?r&&t==s.length&&e.push(""):".."==n?((e.length>1||1==e.length&&""!=e[0])&&e.pop(),r&&t==s.length&&e.push("")):(e.push(n),r=!0)}r=e.join("/")}else r=s}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 ot=/[#\/\?@]/g,ct=/[#\?:]/g,ut=/[#\?]/g,lt=/[#\?@]/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 s,i=null;r>=0?(s=e[n].substring(0,r),i=e[n].substring(r+1)):s=e[n],t(s,i?decodeURIComponent(i.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,s){try{s&&(s.onload=null,s.onerror=null,s.onabort=null,s.ontimeout=null),r(n)}catch(e){}}function bt(){this.g=new ie}function Et(e){this.i=e.Sb||null,this.h=e.ab||!1}function Tt(e,t){Y.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 St(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}function At(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 Ct(e){let t="";return x(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function Ot(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=Ct(n),"string"==typeof e?null!=n&&Ie(n):nt(e,t,n))}function Rt(e){Y.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 s=Ie(n);n=mt(this,n);for(let t=0;t<n.length;t++){let r=s;""!==n[t]&&(r+="="+Ie(n[t])),e.push(r)}}return this.i=e.join("&")},l(Et,ae),Et.prototype.g=function(){return new Tt(this.i,this.h)},l(Tt,Y),(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,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||i).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,At(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!==i.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;St(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?At(this):It(this),3==this.readyState&&St(this)}},e.Oa=function(e){this.g&&(this.response=this.responseText=e,At(this))},e.Na=function(e){this.g&&(this.response=e,At(this))},e.ga=function(){this.g&&At(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"}}),l(Rt,Y);var kt=/^https?$/i,Nt=["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,Pt(e),Lt(e)}function Pt(e){e.A||(e.A=!0,X(e,"complete"),X(e,"error"))}function Dt(e){if(e.h&&void 0!==s)if(e.v&&4==Ut(e))setTimeout(e.Ca.bind(e),0);else if(X(e,"readystatechange"),4==Ut(e)){e.h=!1;try{const s=e.ca();e:switch(s){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===s){let t=String(e.D).match(Xe)[1]||null;!t&&i.self&&i.self.location&&(t=i.self.location.protocol.slice(0,-1)),r=!kt.test(t?t.toLowerCase():"")}n=r}if(n)X(e,"complete"),X(e,"success");else{e.o=6;try{var a=Ut(e)>2?e.g.statusText:""}catch(e){a=""}e.l=a+" ["+e.ca()+"]",Pt(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||X(e,"ready");try{n.onreadystatechange=null}catch(e){}}}function Ut(e){return e.g?e.g.readyState:0}function Mt(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 Vt(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=Vt("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=Vt("baseRetryDelayMs",5e3,e),this.Za=Vt("retryDelaySeedMs",1e4,e),this.Ta=Vt("forwardChannelMaxRetries",2,e),this.va=Vt("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 He(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 $t(e){if(Bt(e),3==e.I){var t=e.V++,n=Je(e.J);if(nt(n,"SID",e.M),nt(n,"RID",t),nt(n,"TYPE","terminate"),qt(e,n),(t=new Oe(e,e.j,t)).M=2,t.A=rt(Je(n)),n=!1,i.navigator&&i.navigator.sendBeacon)try{n=i.navigator.sendBeacon(t.A.toString(),"")}catch(e){}!n&&i.Image&&((new Image).src=t.A,n=!0),n||(t.g=rn(t.j,null),t.g.ea(t.A)),t.F=Date.now(),Ue(t)}tn(e)}function jt(e){e.g&&(Yt(e),e.g.cancel(),e.g=null)}function Bt(e){jt(e),e.v&&(i.clearTimeout(e.v),e.v=null),Qt(e),e.h.cancel(),e.m&&("number"==typeof e.m&&i.clearTimeout(e.m),e.m=null)}function Ht(e){if(!ze(e.h)&&!e.m){e.m=!0;var t=e.Ea;_||b(),w||(_(),w=!0),v.add(t,e),e.D=0}}function zt(e,t){var n;n=t?t.l:e.V++;const r=Je(e.J);nt(r,"SID",e.M),nt(r,"RID",n),nt(r,"AID",e.K),qt(e,r),e.u&&e.o&&Ot(r,e.u,e.o),n=new Oe(e,e.j,n,e.D+1),null===e.u&&(n.J=e.o),t&&(e.i=t.G.concat(e.i)),t=Gt(e,n,1e3),n.H=Math.round(.5*e.va)+Math.round(.5*e.va*Math.random()),Ke(e.h,n),xe(n,r,t)}function qt(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 Gt(e,t,n){n=Math.min(e.i.length,n);const r=e.l?c(e.l.Ka,e.l,e):null;e:{var s=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?n>0?(t=s[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let c=!0;for(let u=0;u<n;u++){var i=s[u].g;const n=s[u].map;if((i-=t)<0)t=Math.max(0,s[u].g-100),c=!1;else try{i="req"+i+"_"||"";try{var o=n instanceof Map?n:Object.entries(n);for(const[t,n]of o){let r=n;a(n)&&(r=re(n)),e.push(i+t+"="+encodeURIComponent(r))}}catch(t){throw e.push(i+"type="+encodeURIComponent("_badmap")),t}}catch(e){r&&r(n)}}if(c){o=e.join("&");break e}}o=void 0}return e=e.i.splice(0,n),t.G=e,o}function Kt(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 Wt(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 Yt(e){null!=e.B&&(i.clearTimeout(e.B),e.B=null)}function Xt(e){e.g=new Oe(e,e.j,"rpc",e.Y),null===e.u&&(e.g.J=e.o),e.g.P=0;var t=Je(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"),qt(e,t),e.u&&e.o&&Ot(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(Je(t)),n.u=null,n.R=!0,Pe(n,e)}function Qt(e){null!=e.C&&(i.clearTimeout(e.C),e.C=null)}function Jt(e,t){var n=null;if(e.g==t){Qt(e),Yt(e),e.g=null;var r=2}else{if(!Ge(e.h,t))return;n=t.G,We(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 s=e.D;X(r=pe(),new _e(r,n)),Ht(e)}else Kt(e);else if(3==(s=t.m)||0==s&&t.X>0||!(1==r&&function(e,t){return!(qe(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&&Wt(e)))switch(n&&n.length>0&&(t=e.h,t.i=t.i.concat(n)),s){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 Qe(r||"//www.google.com/images/cleardot.gif"),i.location&&"http"==i.location.protocol||Ze(r,"https"),rt(r),t?function(e,t){const n=new ve;if(i.Image){const r=new Image;r.onload=u(vt,n,"TestLoadImage: loaded",!0,t,r),r.onerror=u(vt,n,"TestLoadImage: error",!1,t,r),r.onabort=u(vt,n,"TestLoadImage: abort",!1,t,r),r.ontimeout=u(vt,n,"TestLoadImage: timeout",!1,t,r),i.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=Ye(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 Qe?Je(n):new Qe(n);if(""!=r.g)t&&(r.g=t+"."+r.g),et(r,r.u);else{var s=i.location;r=s.protocol,t=t?t+"."+s.hostname:s.hostname,s=+s.port;const e=new Qe(null);r&&Ze(e,r),t&&(e.g=t),s&&et(e,s),n&&(e.h=n),r=e}return n=e.G,t=e.wa,n&&t&&nt(r,n,t),nt(r,"VER",e.ka),qt(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 an(){}function on(e,t){Y.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)&&!I(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!I(t)&&(this.g.G=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new ln(this)}function cn(e){ue.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 un(){le.call(this),this.status=1}function ln(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 s in r)n.set(s,r[s]);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()),s=i.FormData&&e instanceof i.FormData,!(Array.prototype.indexOf.call(Nt,t,void 0)>=0)||r||s||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,X(this,"complete"),X(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 Ut(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)),se(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),Ht(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 s=new Oe(this,this.j,e);let i=this.o;if(this.U&&(i?(i=P(i),L(i,this.U)):i=this.U),null!==this.u||this.R||(s.J=i,i=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=Gt(this,s,t),nt(n=Je(this.J),"RID",e),nt(n,"CVER",22),this.G&&nt(n,"X-HTTP-Session-Id",this.G),qt(this,n),i&&(this.R?t="headers="+Ie(Ct(i))+"&"+t:this.u&&Ot(n,this.u,i)),Ke(this.h,s),this.Ra&&nt(n,"TYPE","init"),this.S?(nt(n,"$req",t),nt(n,"SID","null"),s.U=!0,xe(s,n,null)):xe(s,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,Xt(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),jt(this),Xt(this))},e.Va=function(){null!=this.C&&(this.C=null,jt(this),Wt(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(){},an.prototype.g=function(e,t){return new on(e,t)},l(on,Y),on.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},on.prototype.close=function(){$t(this.g)},on.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&&Ht(t)},on.prototype.N=function(){this.g.l=null,delete this.j,$t(this.g),delete this.g,on.Z.N.call(this)},l(cn,ue),l(un,le),l(ln,sn),ln.prototype.ra=function(){X(this.g,"a")},ln.prototype.qa=function(e){X(this.g,new cn(e))},ln.prototype.pa=function(e){X(this.g,new un)},ln.prototype.oa=function(){X(this.g,"b")},an.prototype.createWebChannel=an.prototype.g,on.prototype.send=on.prototype.o,on.prototype.open=on.prototype.m,on.prototype.close=on.prototype.close,Jo=function(){return new an},Qo=function(){return pe()},Xo=he,Yo={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,Wo=Te,Se.COMPLETE="complete",Ko=Se,oe.EventType=ce,ce.OPEN="a",ce.CLOSE="b",ce.ERROR="c",ce.MESSAGE="d",Y.prototype.listen=Y.prototype.J,Go=oe,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,qo=Rt}).apply(void 0!==Zo?Zo:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});class ec{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=(()=>ec.CLASS_NL|ec.DOT_NL)();static PERL=(()=>ec.CLASS_NL|ec.ONE_LINE|ec.PERL_X|ec.UNICODE_GROUPS)();static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2}class tc{static CODES=(()=>new Map([["",7],["\b",8],["\t",9],["\n",10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]))();static toUpperCase(e){const t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;const n=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){const t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;const n=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}}class nc{static CASE_ORBIT=(()=>new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]))();static C=[[0,31,1],[127,159,1],[173,888,715],[889,896,7],[897,899,1],[907,909,2],[930,1328,398],[1367,1368,1],[1419,1420,1],[1424,1480,56],[1481,1487,1],[1515,1518,1],[1525,1541,1],[1564,1757,193],[1806,1807,1],[1867,1868,1],[1970,1983,1],[2043,2044,1],[2094,2095,1],[2111,2140,29],[2141,2143,2],[2155,2159,1],[2191,2199,1],[2274,2436,162],[2445,2446,1],[2449,2450,1],[2473,2481,8],[2483,2485,1],[2490,2491,1],[2501,2502,1],[2505,2506,1],[2511,2518,1],[2520,2523,1],[2526,2532,6],[2533,2559,26],[2560,2564,4],[2571,2574,1],[2577,2578,1],[2601,2609,8],[2612,2618,3],[2619,2621,2],[2627,2630,1],[2633,2634,1],[2638,2640,1],[2642,2648,1],[2653,2655,2],[2656,2661,1],[2679,2688,1],[2692,2702,10],[2706,2729,23],[2737,2740,3],[2746,2747,1],[2758,2766,4],[2767,2769,2],[2770,2783,1],[2788,2789,1],[2802,2808,1],[2816,2820,4],[2829,2830,1],[2833,2834,1],[2857,2865,8],[2868,2874,6],[2875,2885,10],[2886,2889,3],[2890,2894,4],[2895,2900,1],[2904,2907,1],[2910,2916,6],[2917,2936,19],[2937,2945,1],[2948,2955,7],[2956,2957,1],[2961,2966,5],[2967,2968,1],[2971,2973,2],[2976,2978,1],[2981,2983,1],[2987,2989,1],[3002,3005,1],[3011,3013,1],[3017,3022,5],[3023,3025,2],[3026,3030,1],[3032,3045,1],[3067,3071,1],[3085,3089,4],[3113,3130,17],[3131,3141,10],[3145,3150,5],[3151,3156,1],[3159,3163,4],[3164,3166,2],[3167,3172,5],[3173,3184,11],[3185,3190,1],[3213,3217,4],[3241,3252,11],[3258,3259,1],[3269,3273,4],[3278,3284,1],[3287,3292,1],[3295,3300,5],[3301,3312,11],[3316,3327,1],[3341,3345,4],[3397,3401,4],[3408,3411,1],[3428,3429,1],[3456,3460,4],[3479,3481,1],[3506,3516,10],[3518,3519,1],[3527,3529,1],[3531,3534,1],[3541,3543,2],[3552,3557,1],[3568,3569,1],[3573,3584,1],[3643,3646,1],[3676,3712,1],[3715,3717,2],[3723,3748,25],[3750,3774,24],[3775,3781,6],[3783,3791,8],[3802,3803,1],[3808,3839,1],[3912,3949,37],[3950,3952,1],[3992,4029,37],[4045,4059,14],[4060,4095,1],[4294,4296,2],[4297,4300,1],[4302,4303,1],[4681,4686,5],[4687,4695,8],[4697,4702,5],[4703,4745,42],[4750,4751,1],[4785,4790,5],[4791,4799,8],[4801,4806,5],[4807,4823,16],[4881,4886,5],[4887,4955,68],[4956,4989,33],[4990,4991,1],[5018,5023,1],[5110,5111,1],[5118,5119,1],[5789,5791,1],[5881,5887,1],[5910,5918,1],[5943,5951,1],[5972,5983,1],[5997,6001,4],[6004,6015,1],[6110,6111,1],[6122,6127,1],[6138,6143,1],[6158,6170,12],[6171,6175,1],[6265,6271,1],[6315,6319,1],[6390,6399,1],[6431,6444,13],[6445,6447,1],[6460,6463,1],[6465,6467,1],[6510,6511,1],[6517,6527,1],[6572,6575,1],[6602,6607,1],[6619,6621,1],[6684,6685,1],[6751,6781,30],[6782,6794,12],[6795,6799,1],[6810,6815,1],[6830,6831,1],[6863,6911,1],[6989,6991,1],[7039,7156,117],[7157,7163,1],[7224,7226,1],[7242,7244,1],[7305,7311,1],[7355,7356,1],[7368,7375,1],[7419,7423,1],[7958,7959,1],[7966,7967,1],[8006,8007,1],[8014,8015,1],[8024,8030,2],[8062,8063,1],[8117,8133,16],[8148,8149,1],[8156,8176,20],[8177,8181,4],[8191,8203,12],[8204,8207,1],[8234,8238,1],[8288,8303,1],[8306,8307,1],[8335,8349,14],[8350,8351,1],[8385,8399,1],[8433,8447,1],[8588,8591,1],[9255,9279,1],[9291,9311,1],[11124,11125,1],[11158,11508,350],[11509,11512,1],[11558,11560,2],[11561,11564,1],[11566,11567,1],[11624,11630,1],[11633,11646,1],[11671,11679,1],[11687,11743,8],[11870,11903,1],[11930,12020,90],[12021,12031,1],[12246,12271,1],[12352,12439,87],[12440,12544,104],[12545,12548,1],[12592,12687,95],[12772,12782,1],[12831,42125,29294],[42126,42127,1],[42183,42191,1],[42540,42559,1],[42744,42751,1],[42955,42959,1],[42962,42964,2],[42970,42993,1],[43053,43055,1],[43066,43071,1],[43128,43135,1],[43206,43213,1],[43226,43231,1],[43348,43358,1],[43389,43391,1],[43470,43482,12],[43483,43485,1],[43519,43575,56],[43576,43583,1],[43598,43599,1],[43610,43611,1],[43715,43738,1],[43767,43776,1],[43783,43784,1],[43791,43792,1],[43799,43807,1],[43815,43823,8],[43884,43887,1],[44014,44015,1],[44026,44031,1],[55204,55215,1],[55239,55242,1],[55292,63743,1],[64110,64111,1],[64218,64255,1],[64263,64274,1],[64280,64284,1],[64311,64317,6],[64319,64325,3],[64451,64466,1],[64912,64913,1],[64968,64974,1],[64976,65007,1],[65050,65055,1],[65107,65127,20],[65132,65135,1],[65141,65277,136],[65278,65280,1],[65471,65473,1],[65480,65481,1],[65488,65489,1],[65496,65497,1],[65501,65503,1],[65511,65519,8],[65520,65531,1],[65534,65535,1],[65548,65575,27],[65595,65598,3],[65614,65615,1],[65630,65663,1],[65787,65791,1],[65795,65798,1],[65844,65846,1],[65935,65949,14],[65950,65951,1],[65953,65999,1],[66046,66175,1],[66205,66207,1],[66257,66271,1],[66300,66303,1],[66340,66348,1],[66379,66383,1],[66427,66431,1],[66462,66500,38],[66501,66503,1],[66518,66559,1],[66718,66719,1],[66730,66735,1],[66772,66775,1],[66812,66815,1],[66856,66863,1],[66916,66926,1],[66939,66955,16],[66963,66966,3],[66978,66994,16],[67002,67005,3],[67006,67071,1],[67383,67391,1],[67414,67423,1],[67432,67455,1],[67462,67505,43],[67515,67583,1],[67590,67591,1],[67593,67638,45],[67641,67643,1],[67645,67646,1],[67670,67743,73],[67744,67750,1],[67760,67807,1],[67827,67830,3],[67831,67834,1],[67868,67870,1],[67898,67902,1],[67904,67967,1],[68024,68027,1],[68048,68049,1],[68100,68103,3],[68104,68107,1],[68116,68120,4],[68150,68151,1],[68155,68158,1],[68169,68175,1],[68185,68191,1],[68256,68287,1],[68327,68330,1],[68343,68351,1],[68406,68408,1],[68438,68439,1],[68467,68471,1],[68498,68504,1],[68509,68520,1],[68528,68607,1],[68681,68735,1],[68787,68799,1],[68851,68857,1],[68904,68911,1],[68922,69215,1],[69247,69290,43],[69294,69295,1],[69298,69372,1],[69416,69423,1],[69466,69487,1],[69514,69551,1],[69580,69599,1],[69623,69631,1],[69710,69713,1],[69750,69758,1],[69821,69827,6],[69828,69839,1],[69865,69871,1],[69882,69887,1],[69941,69960,19],[69961,69967,1],[70007,70015,1],[70112,70133,21],[70134,70143,1],[70162,70210,48],[70211,70271,1],[70279,70281,2],[70286,70302,16],[70314,70319,1],[70379,70383,1],[70394,70399,1],[70404,70413,9],[70414,70417,3],[70418,70441,23],[70449,70452,3],[70458,70469,11],[70470,70473,3],[70474,70478,4],[70479,70481,2],[70482,70486,1],[70488,70492,1],[70500,70501,1],[70509,70511,1],[70517,70655,1],[70748,70754,6],[70755,70783,1],[70856,70863,1],[70874,71039,1],[71094,71095,1],[71134,71167,1],[71237,71247,1],[71258,71263,1],[71277,71295,1],[71354,71359,1],[71370,71423,1],[71451,71452,1],[71468,71471,1],[71495,71679,1],[71740,71839,1],[71923,71934,1],[71943,71944,1],[71946,71947,1],[71956,71959,3],[71990,71993,3],[71994,72007,13],[72008,72015,1],[72026,72095,1],[72104,72105,1],[72152,72153,1],[72165,72191,1],[72264,72271,1],[72355,72367,1],[72441,72447,1],[72458,72703,1],[72713,72759,46],[72774,72783,1],[72813,72815,1],[72848,72849,1],[72872,72887,15],[72888,72959,1],[72967,72970,3],[73015,73017,1],[73019,73022,3],[73032,73039,1],[73050,73055,1],[73062,73065,3],[73103,73106,3],[73113,73119,1],[73130,73439,1],[73465,73471,1],[73489,73531,42],[73532,73533,1],[73562,73647,1],[73649,73663,1],[73714,73726,1],[74650,74751,1],[74863,74869,6],[74870,74879,1],[75076,77711,1],[77811,77823,1],[78896,78911,1],[78934,82943,1],[83527,92159,1],[92729,92735,1],[92767,92778,11],[92779,92781,1],[92863,92874,11],[92875,92879,1],[92910,92911,1],[92918,92927,1],[92998,93007,1],[93018,93026,8],[93048,93052,1],[93072,93759,1],[93851,93951,1],[94027,94030,1],[94088,94094,1],[94112,94175,1],[94181,94191,1],[94194,94207,1],[100344,100351,1],[101590,101631,1],[101641,110575,1],[110580,110588,8],[110591,110883,292],[110884,110897,1],[110899,110927,1],[110931,110932,1],[110934,110947,1],[110952,110959,1],[111356,113663,1],[113771,113775,1],[113789,113791,1],[113801,113807,1],[113818,113819,1],[113824,118527,1],[118574,118575,1],[118599,118607,1],[118724,118783,1],[119030,119039,1],[119079,119080,1],[119155,119162,1],[119275,119295,1],[119366,119487,1],[119508,119519,1],[119540,119551,1],[119639,119647,1],[119673,119807,1],[119893,119965,72],[119968,119969,1],[119971,119972,1],[119975,119976,1],[119981,119994,13],[119996,120004,8],[120070,120075,5],[120076,120085,9],[120093,120122,29],[120127,120133,6],[120135,120137,1],[120145,120486,341],[120487,120780,293],[120781,121484,703],[121485,121498,1],[121504,121520,16],[121521,122623,1],[122655,122660,1],[122667,122879,1],[122887,122905,18],[122906,122914,8],[122917,122923,6],[122924,122927,1],[122990,123022,1],[123024,123135,1],[123181,123183,1],[123198,123199,1],[123210,123213,1],[123216,123535,1],[123567,123583,1],[123642,123646,1],[123648,124111,1],[124154,124895,1],[124903,124908,5],[124911,124927,16],[125125,125126,1],[125143,125183,1],[125260,125263,1],[125274,125277,1],[125280,126064,1],[126133,126208,1],[126270,126463,1],[126468,126496,28],[126499,126501,2],[126502,126504,2],[126515,126520,5],[126522,126524,2],[126525,126529,1],[126531,126534,1],[126536,126540,2],[126544,126547,3],[126549,126550,1],[126552,126560,2],[126563,126565,2],[126566,126571,5],[126579,126589,5],[126591,126602,11],[126620,126624,1],[126628,126634,6],[126652,126703,1],[126706,126975,1],[127020,127023,1],[127124,127135,1],[127151,127152,1],[127168,127184,16],[127222,127231,1],[127406,127461,1],[127491,127503,1],[127548,127551,1],[127561,127567,1],[127570,127583,1],[127590,127743,1],[128728,128731,1],[128749,128751,1],[128765,128767,1],[128887,128890,1],[128986,128991,1],[129004,129007,1],[129009,129023,1],[129036,129039,1],[129096,129103,1],[129114,129119,1],[129160,129167,1],[129198,129199,1],[129202,129279,1],[129620,129631,1],[129646,129647,1],[129661,129663,1],[129673,129679,1],[129726,129734,8],[129735,129741,1],[129756,129759,1],[129769,129775,1],[129785,129791,1],[129939,129995,56],[129996,130031,1],[130042,131071,1],[173792,173823,1],[177978,177983,1],[178206,178207,1],[183970,183983,1],[191457,191471,1],[192094,194559,1],[195102,196607,1],[201547,201551,1],[205744,917759,1],[918e3,1114111,1]];static Cc=[[0,31,1],[127,159,1]];static Cf=[[173,1536,1363],[1537,1541,1],[1564,1757,193],[1807,2192,385],[2193,2274,81],[6158,8203,2045],[8204,8207,1],[8234,8238,1],[8288,8292,1],[8294,8303,1],[65279,65529,250],[65530,65531,1],[69821,69837,16],[78896,78911,1],[113824,113827,1],[119155,119162,1],[917505,917536,31],[917537,917631,1]];static Co=[[57344,63743,1],[983040,1048573,1],[1048576,1114109,1]];static Cs=[[55296,57343,1]];static L=[[65,90,1],[97,122,1],[170,181,11],[186,192,6],[193,214,1],[216,246,1],[248,705,1],[710,721,1],[736,740,1],[748,750,2],[880,884,1],[886,887,1],[890,893,1],[895,902,7],[904,906,1],[908,910,2],[911,929,1],[931,1013,1],[1015,1153,1],[1162,1327,1],[1329,1366,1],[1369,1376,7],[1377,1416,1],[1488,1514,1],[1519,1522,1],[1568,1610,1],[1646,1647,1],[1649,1747,1],[1749,1765,16],[1766,1774,8],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2036,2037,1],[2042,2048,6],[2049,2069,1],[2074,2084,10],[2088,2112,24],[2113,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2249,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2417,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3654,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3782,3804,22],[3805,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4256,18],[4257,4293,1],[4295,4301,6],[4304,4346,1],[4348,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5024,5109,1],[5112,5117,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6103,6108,5],[6176,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6823,6917,94],[6918,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7293,1],[7296,7304,1],[7312,7354,1],[7357,7359,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,7424,6],[7425,7615,1],[7680,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8124,1],[8126,8130,4],[8131,8132,1],[8134,8140,1],[8144,8147,1],[8150,8155,1],[8160,8172,1],[8178,8180,1],[8182,8188,1],[8305,8319,14],[8336,8348,1],[8450,8455,5],[8458,8467,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8495,8505,1],[8508,8511,1],[8517,8521,1],[8526,8579,53],[8580,11264,2684],[11265,11492,1],[11499,11502,1],[11506,11507,1],[11520,11557,1],[11559,11565,6],[11568,11623,1],[11631,11648,17],[11649,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[11823,12293,470],[12294,12337,43],[12338,12341,1],[12347,12348,1],[12353,12438,1],[12445,12447,1],[12449,12538,1],[12540,12543,1],[12549,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,42124,1],[42192,42237,1],[42240,42508,1],[42512,42527,1],[42538,42539,1],[42560,42606,1],[42623,42653,1],[42656,42725,1],[42775,42783,1],[42786,42888,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43471,43488,17],[43489,43492,1],[43494,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43741,1],[43744,43754,1],[43762,43764,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43824,43866,1],[43868,43881,1],[43888,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64256,64262,1],[64275,64279,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65313,65338,1],[65345,65370,1],[65382,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66560,66717,1],[66736,66771,1],[66776,66811,1],[66816,66855,1],[66864,66915,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68736,68786,1],[68800,68850,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71840,71903,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[92992,92995,1],[93027,93047,1],[93053,93071,1],[93760,93823,1],[93952,94026,1],[94032,94099,67],[94100,94111,1],[94176,94177,1],[94179,94208,29],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120512,1],[120514,120538,1],[120540,120570,1],[120572,120596,1],[120598,120628,1],[120630,120654,1],[120656,120686,1],[120688,120712,1],[120714,120744,1],[120746,120770,1],[120772,120779,1],[122624,122654,1],[122661,122666,1],[122928,122989,1],[123136,123180,1],[123191,123197,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124139,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[125184,125251,1],[125259,126464,1205],[126465,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static foldL=[[837,837,1]];static Ll=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,311,2],[312,328,2],[329,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[397,402,5],[405,409,4],[410,411,1],[414,417,3],[419,421,2],[424,426,2],[427,429,2],[432,436,4],[438,441,3],[442,445,3],[446,447,1],[454,460,3],[462,476,2],[477,495,2],[496,499,3],[501,505,4],[507,563,2],[564,569,1],[572,575,3],[576,578,2],[583,591,2],[592,659,1],[661,687,1],[881,883,2],[887,891,4],[892,893,1],[912,940,28],[941,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1020,1072,52],[1073,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1376,1416,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7424,7467,1],[7531,7543,1],[7545,7578,1],[7681,7829,2],[7830,7837,1],[7839,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8016,8023,1],[8032,8039,1],[8048,8061,1],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8112,8116,1],[8118,8119,1],[8126,8130,4],[8131,8132,1],[8134,8135,1],[8144,8147,1],[8150,8151,1],[8160,8167,1],[8178,8180,1],[8182,8183,1],[8458,8462,4],[8463,8467,4],[8495,8505,5],[8508,8509,1],[8518,8521,1],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11377,11379,2],[11380,11382,2],[11383,11387,1],[11393,11491,2],[11492,11500,8],[11502,11507,5],[11520,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42800,42801,1],[42803,42865,2],[42866,42872,1],[42874,42876,2],[42879,42887,2],[42892,42894,2],[42897,42899,2],[42900,42901,1],[42903,42921,2],[42927,42933,6],[42935,42947,2],[42952,42954,2],[42961,42969,2],[42998,43002,4],[43824,43866,1],[43872,43880,1],[43888,43967,1],[64256,64262,1],[64275,64279,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[119834,119859,1],[119886,119892,1],[119894,119911,1],[119938,119963,1],[119990,119993,1],[119995,119997,2],[119998,120003,1],[120005,120015,1],[120042,120067,1],[120094,120119,1],[120146,120171,1],[120198,120223,1],[120250,120275,1],[120302,120327,1],[120354,120379,1],[120406,120431,1],[120458,120485,1],[120514,120538,1],[120540,120545,1],[120572,120596,1],[120598,120603,1],[120630,120654,1],[120656,120661,1],[120688,120712,1],[120714,120719,1],[120746,120770,1],[120772,120777,1],[120779,122624,1845],[122625,122633,1],[122635,122654,1],[122661,122666,1],[125218,125251,1]];static foldLl=[[65,90,1],[192,214,1],[216,222,1],[256,302,2],[306,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,453,1],[455,456,1],[458,459,1],[461,475,2],[478,494,2],[497,498,1],[500,502,2],[503,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[837,880,43],[882,886,4],[895,902,7],[904,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,984,9],[986,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8072,8079,1],[8088,8095,1],[8104,8111,1],[8120,8124,1],[8136,8140,1],[8152,8155,1],[8168,8172,1],[8184,8188,1],[8486,8490,4],[8491,8498,7],[8579,11264,2685],[11265,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[125184,125217,1]];static Lm=[[688,705,1],[710,721,1],[736,740,1],[748,750,2],[884,890,6],[1369,1600,231],[1765,1766,1],[2036,2037,1],[2042,2074,32],[2084,2088,4],[2249,2417,168],[3654,3782,128],[4348,6103,1755],[6211,6823,612],[7288,7293,1],[7468,7530,1],[7544,7579,35],[7580,7615,1],[8305,8319,14],[8336,8348,1],[11388,11389,1],[11631,11823,192],[12293,12337,44],[12338,12341,1],[12347,12445,98],[12446,12540,94],[12541,12542,1],[40981,42232,1251],[42233,42237,1],[42508,42623,115],[42652,42653,1],[42775,42783,1],[42864,42888,24],[42994,42996,1],[43e3,43001,1],[43471,43494,23],[43632,43741,109],[43763,43764,1],[43868,43871,1],[43881,65392,21511],[65438,65439,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[92992,92995,1],[94099,94111,1],[94176,94177,1],[94179,110576,16397],[110577,110579,1],[110581,110587,1],[110589,110590,1],[122928,122989,1],[123191,123197,1],[124139,125259,1120]];static Lo=[[170,186,16],[443,448,5],[449,451,1],[660,1488,828],[1489,1514,1],[1519,1522,1],[1568,1599,1],[1601,1610,1],[1646,1647,1],[1649,1747,1],[1749,1774,25],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2048,2069,1],[2112,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2248,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2418,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3653,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3804,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4352,114],[4353,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6108,6176,68],[6177,6210,1],[6212,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6917,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7287,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,8501,1083],[8502,8504,1],[11568,11623,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[12294,12348,54],[12353,12438,1],[12447,12449,2],[12450,12538,1],[12543,12549,6],[12550,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,40980,1],[40982,42124,1],[42192,42231,1],[42240,42507,1],[42512,42527,1],[42538,42539,1],[42606,42656,50],[42657,42725,1],[42895,42999,104],[43003,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43488,43492,1],[43495,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43631,1],[43633,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43740,1],[43744,43754,1],[43762,43777,15],[43778,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43968,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65382,65391,1],[65393,65437,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66640,66717,1],[66816,66855,1],[66864,66915,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[93027,93047,1],[93053,93071,1],[93952,94026,1],[94032,94208,176],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[122634,123136,502],[123137,123180,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124138,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Lt=[[453,459,3],[498,8072,7574],[8073,8079,1],[8088,8095,1],[8104,8111,1],[8124,8140,16],[8188,8188,1]];static foldLt=[[452,454,2],[455,457,2],[458,460,2],[497,499,2],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8115,8131,16],[8179,8179,1]];static Lu=[[65,90,1],[192,214,1],[216,222,1],[256,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,461,3],[463,475,2],[478,494,2],[497,500,3],[502,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[880,882,2],[886,895,9],[902,904,2],[905,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,978,3],[979,980,1],[984,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8120,8123,1],[8136,8139,1],[8152,8155,1],[8168,8172,1],[8184,8187,1],[8450,8455,5],[8459,8461,1],[8464,8466,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8496,8499,1],[8510,8511,1],[8517,8579,62],[11264,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[119808,119833,1],[119860,119885,1],[119912,119937,1],[119964,119966,2],[119967,119973,3],[119974,119977,3],[119978,119980,1],[119982,119989,1],[120016,120041,1],[120068,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120120,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120172,120197,1],[120224,120249,1],[120276,120301,1],[120328,120353,1],[120380,120405,1],[120432,120457,1],[120488,120512,1],[120546,120570,1],[120604,120628,1],[120662,120686,1],[120720,120744,1],[120778,125184,4406],[125185,125217,1]];static Upper=this.Lu;static foldLu=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,303,2],[307,311,2],[314,328,2],[331,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[402,405,3],[409,410,1],[414,417,3],[419,421,2],[424,429,5],[432,436,4],[438,441,3],[445,447,2],[453,454,1],[456,457,1],[459,460,1],[462,476,2],[477,495,2],[498,499,1],[501,505,4],[507,543,2],[547,563,2],[572,575,3],[576,578,2],[583,591,2],[592,596,1],[598,599,1],[601,603,2],[604,608,4],[609,613,2],[614,616,2],[617,620,1],[623,625,2],[626,629,3],[637,640,3],[642,643,1],[647,652,1],[658,669,11],[670,837,167],[881,883,2],[887,891,4],[892,893,1],[940,943,1],[945,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1072,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1377,1414,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7545,7549,4],[7566,7681,115],[7683,7829,2],[7835,7841,6],[7843,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8017,8023,2],[8032,8039,1],[8048,8061,1],[8112,8113,1],[8126,8144,18],[8145,8160,15],[8161,8165,4],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11379,11382,3],[11393,11491,2],[11500,11502,2],[11507,11520,13],[11521,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42803,42863,2],[42874,42876,2],[42879,42887,2],[42892,42897,5],[42899,42900,1],[42903,42921,2],[42933,42947,2],[42952,42954,2],[42961,42967,6],[42969,42998,29],[43859,43888,29],[43889,43967,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[125218,125251,1]];static M=[[768,879,1],[1155,1161,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2307,1],[2362,2364,1],[2366,2383,1],[2385,2391,1],[2402,2403,1],[2433,2435,1],[2492,2494,2],[2495,2500,1],[2503,2504,1],[2507,2509,1],[2519,2530,11],[2531,2558,27],[2561,2563,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2672,31],[2673,2677,4],[2689,2691,1],[2748,2750,2],[2751,2757,1],[2759,2761,1],[2763,2765,1],[2786,2787,1],[2810,2815,1],[2817,2819,1],[2876,2878,2],[2879,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2914,2915,1],[2946,3006,60],[3007,3010,1],[3014,3016,1],[3018,3021,1],[3031,3072,41],[3073,3076,1],[3132,3134,2],[3135,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3203,1],[3260,3262,2],[3263,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3298,3299,1],[3315,3328,13],[3329,3331,1],[3387,3388,1],[3390,3396,1],[3398,3400,1],[3402,3405,1],[3415,3426,11],[3427,3457,30],[3458,3459,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3570,3571,1],[3633,3636,3],[3637,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3902,3903,1],[3953,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4139,101],[4140,4158,1],[4182,4185,1],[4190,4192,1],[4194,4196,1],[4199,4205,1],[4209,4212,1],[4226,4237,1],[4239,4250,11],[4251,4253,1],[4957,4959,1],[5906,5909,1],[5938,5940,1],[5970,5971,1],[6002,6003,1],[6068,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6443,1],[6448,6459,1],[6679,6683,1],[6741,6750,1],[6752,6780,1],[6783,6832,49],[6833,6862,1],[6912,6916,1],[6964,6980,1],[7019,7027,1],[7040,7042,1],[7073,7085,1],[7142,7155,1],[7204,7223,1],[7376,7378,1],[7380,7400,1],[7405,7412,7],[7415,7417,1],[7616,7679,1],[8400,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12335,1],[12441,12442,1],[42607,42610,1],[42612,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43043,24],[43044,43047,1],[43052,43136,84],[43137,43188,51],[43189,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43347,1],[43392,43395,1],[43443,43456,1],[43493,43561,68],[43562,43574,1],[43587,43596,9],[43597,43643,46],[43644,43645,1],[43696,43698,2],[43699,43700,1],[43703,43704,1],[43710,43711,1],[43713,43755,42],[43756,43759,1],[43765,43766,1],[44003,44010,1],[44012,44013,1],[64286,65024,738],[65025,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69632,69634,1],[69688,69702,1],[69744,69747,3],[69748,69759,11],[69760,69762,1],[69808,69818,1],[69826,69888,62],[69889,69890,1],[69927,69940,1],[69957,69958,1],[70003,70016,13],[70017,70018,1],[70067,70080,1],[70089,70092,1],[70094,70095,1],[70188,70199,1],[70206,70209,3],[70367,70378,1],[70400,70403,1],[70459,70460,1],[70462,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70502,3],[70503,70508,1],[70512,70516,1],[70709,70726,1],[70750,70832,82],[70833,70851,1],[71087,71093,1],[71096,71104,1],[71132,71133,1],[71216,71232,1],[71339,71351,1],[71453,71467,1],[71724,71738,1],[71984,71989,1],[71991,71992,1],[71995,71998,1],[72e3,72002,2],[72003,72145,142],[72146,72151,1],[72154,72160,1],[72164,72193,29],[72194,72202,1],[72243,72249,1],[72251,72254,1],[72263,72273,10],[72274,72283,1],[72330,72345,1],[72751,72758,1],[72760,72767,1],[72850,72871,1],[72873,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73098,67],[73099,73102,1],[73104,73105,1],[73107,73111,1],[73459,73462,1],[73472,73473,1],[73475,73524,49],[73525,73530,1],[73534,73538,1],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94033,2],[94034,94087,1],[94095,94098,1],[94180,94192,12],[94193,113821,19628],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119141,119145,1],[119149,119154,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldM=[[921,953,32],[8126,8126,1]];static Mc=[[2307,2363,56],[2366,2368,1],[2377,2380,1],[2382,2383,1],[2434,2435,1],[2494,2496,1],[2503,2504,1],[2507,2508,1],[2519,2563,44],[2622,2624,1],[2691,2750,59],[2751,2752,1],[2761,2763,2],[2764,2818,54],[2819,2878,59],[2880,2887,7],[2888,2891,3],[2892,2903,11],[3006,3007,1],[3009,3010,1],[3014,3016,1],[3018,3020,1],[3031,3073,42],[3074,3075,1],[3137,3140,1],[3202,3203,1],[3262,3264,2],[3265,3268,1],[3271,3272,1],[3274,3275,1],[3285,3286,1],[3315,3330,15],[3331,3390,59],[3391,3392,1],[3398,3400,1],[3402,3404,1],[3415,3458,43],[3459,3535,76],[3536,3537,1],[3544,3551,1],[3570,3571,1],[3902,3903,1],[3967,4139,172],[4140,4145,5],[4152,4155,3],[4156,4182,26],[4183,4194,11],[4195,4196,1],[4199,4205,1],[4227,4228,1],[4231,4236,1],[4239,4250,11],[4251,4252,1],[5909,5940,31],[6070,6078,8],[6079,6085,1],[6087,6088,1],[6435,6438,1],[6441,6443,1],[6448,6449,1],[6451,6456,1],[6681,6682,1],[6741,6743,2],[6753,6755,2],[6756,6765,9],[6766,6770,1],[6916,6965,49],[6971,6973,2],[6974,6977,1],[6979,6980,1],[7042,7073,31],[7078,7079,1],[7082,7143,61],[7146,7148,1],[7150,7154,4],[7155,7204,49],[7205,7211,1],[7220,7221,1],[7393,7415,22],[12334,12335,1],[43043,43044,1],[43047,43136,89],[43137,43188,51],[43189,43203,1],[43346,43347,1],[43395,43444,49],[43445,43450,5],[43451,43454,3],[43455,43456,1],[43567,43568,1],[43571,43572,1],[43597,43643,46],[43645,43755,110],[43758,43759,1],[43765,44003,238],[44004,44006,2],[44007,44009,2],[44010,44012,2],[69632,69634,2],[69762,69808,46],[69809,69810,1],[69815,69816,1],[69932,69957,25],[69958,70018,60],[70067,70069,1],[70079,70080,1],[70094,70188,94],[70189,70190,1],[70194,70195,1],[70197,70368,171],[70369,70370,1],[70402,70403,1],[70462,70463,1],[70465,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70709,210],[70710,70711,1],[70720,70721,1],[70725,70832,107],[70833,70834,1],[70841,70843,2],[70844,70846,1],[70849,71087,238],[71088,71089,1],[71096,71099,1],[71102,71216,114],[71217,71218,1],[71227,71228,1],[71230,71340,110],[71342,71343,1],[71350,71456,106],[71457,71462,5],[71724,71726,1],[71736,71984,248],[71985,71989,1],[71991,71992,1],[71997,72e3,3],[72002,72145,143],[72146,72147,1],[72156,72159,1],[72164,72249,85],[72279,72280,1],[72343,72751,408],[72766,72873,107],[72881,72884,3],[73098,73102,1],[73107,73108,1],[73110,73461,351],[73462,73475,13],[73524,73525,1],[73534,73535,1],[73537,94033,20496],[94034,94087,1],[94192,94193,1],[119141,119142,1],[119149,119154,1]];static Me=[[1160,1161,1],[6846,8413,1567],[8414,8416,1],[8418,8420,1],[42608,42610,1]];static Mn=[[768,879,1],[1155,1159,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2306,1],[2362,2364,2],[2369,2376,1],[2381,2385,4],[2386,2391,1],[2402,2403,1],[2433,2492,59],[2497,2500,1],[2509,2530,21],[2531,2558,27],[2561,2562,1],[2620,2625,5],[2626,2631,5],[2632,2635,3],[2636,2637,1],[2641,2672,31],[2673,2677,4],[2689,2690,1],[2748,2753,5],[2754,2757,1],[2759,2760,1],[2765,2786,21],[2787,2810,23],[2811,2815,1],[2817,2876,59],[2879,2881,2],[2882,2884,1],[2893,2901,8],[2902,2914,12],[2915,2946,31],[3008,3021,13],[3072,3076,4],[3132,3134,2],[3135,3136,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3260,59],[3263,3270,7],[3276,3277,1],[3298,3299,1],[3328,3329,1],[3387,3388,1],[3393,3396,1],[3405,3426,21],[3427,3457,30],[3530,3538,8],[3539,3540,1],[3542,3633,91],[3636,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3953,3966,1],[3968,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4141,103],[4142,4144,1],[4146,4151,1],[4153,4154,1],[4157,4158,1],[4184,4185,1],[4190,4192,1],[4209,4212,1],[4226,4229,3],[4230,4237,7],[4253,4957,704],[4958,4959,1],[5906,5908,1],[5938,5939,1],[5970,5971,1],[6002,6003,1],[6068,6069,1],[6071,6077,1],[6086,6089,3],[6090,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6434,1],[6439,6440,1],[6450,6457,7],[6458,6459,1],[6679,6680,1],[6683,6742,59],[6744,6750,1],[6752,6754,2],[6757,6764,1],[6771,6780,1],[6783,6832,49],[6833,6845,1],[6847,6862,1],[6912,6915,1],[6964,6966,2],[6967,6970,1],[6972,6978,6],[7019,7027,1],[7040,7041,1],[7074,7077,1],[7080,7081,1],[7083,7085,1],[7142,7144,2],[7145,7149,4],[7151,7153,1],[7212,7219,1],[7222,7223,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8400,8412,1],[8417,8421,4],[8422,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12333,1],[12441,12442,1],[42607,42612,5],[42613,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43045,26],[43046,43052,6],[43204,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43345,1],[43392,43394,1],[43443,43446,3],[43447,43449,1],[43452,43453,1],[43493,43561,68],[43562,43566,1],[43569,43570,1],[43573,43574,1],[43587,43596,9],[43644,43696,52],[43698,43700,1],[43703,43704,1],[43710,43711,1],[43713,43756,43],[43757,43766,9],[44005,44008,3],[44013,64286,20273],[65024,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69633,69688,55],[69689,69702,1],[69744,69747,3],[69748,69759,11],[69760,69761,1],[69811,69814,1],[69817,69818,1],[69826,69888,62],[69889,69890,1],[69927,69931,1],[69933,69940,1],[70003,70016,13],[70017,70070,53],[70071,70078,1],[70089,70092,1],[70095,70191,96],[70192,70193,1],[70196,70198,2],[70199,70206,7],[70209,70367,158],[70371,70378,1],[70400,70401,1],[70459,70460,1],[70464,70502,38],[70503,70508,1],[70512,70516,1],[70712,70719,1],[70722,70724,1],[70726,70750,24],[70835,70840,1],[70842,70847,5],[70848,70850,2],[70851,71090,239],[71091,71093,1],[71100,71101,1],[71103,71104,1],[71132,71133,1],[71219,71226,1],[71229,71231,2],[71232,71339,107],[71341,71344,3],[71345,71349,1],[71351,71453,102],[71454,71455,1],[71458,71461,1],[71463,71467,1],[71727,71735,1],[71737,71738,1],[71995,71996,1],[71998,72003,5],[72148,72151,1],[72154,72155,1],[72160,72193,33],[72194,72202,1],[72243,72248,1],[72251,72254,1],[72263,72273,10],[72274,72278,1],[72281,72283,1],[72330,72342,1],[72344,72345,1],[72752,72758,1],[72760,72765,1],[72767,72850,83],[72851,72871,1],[72874,72880,1],[72882,72883,1],[72885,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73104,73],[73105,73109,4],[73111,73459,348],[73460,73472,12],[73473,73526,53],[73527,73530,1],[73536,73538,2],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94095,64],[94096,94098,1],[94180,113821,19641],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldMn=[[921,953,32],[8126,8126,1]];static N=[[48,57,1],[178,179,1],[185,188,3],[189,190,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2548,2553,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[2930,2935,1],[3046,3058,1],[3174,3183,1],[3192,3198,1],[3302,3311,1],[3416,3422,1],[3430,3448,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3891,1],[4160,4169,1],[4240,4249,1],[4969,4988,1],[5870,5872,1],[6112,6121,1],[6128,6137,1],[6160,6169,1],[6470,6479,1],[6608,6618,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[8304,8308,4],[8309,8313,1],[8320,8329,1],[8528,8578,1],[8581,8585,1],[9312,9371,1],[9450,9471,1],[10102,10131,1],[11517,12295,778],[12321,12329,1],[12344,12346,1],[12690,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[42528,42537,1],[42726,42735,1],[43056,43061,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[65799,65843,1],[65856,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[66369,66378,9],[66513,66517,1],[66720,66729,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[68912,68921,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70113,70132,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71483,1],[71904,71922,1],[72016,72025,1],[72784,72812,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[73664,73684,1],[74752,74862,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125127,125135,1],[125264,125273,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1],[130032,130041,1]];static Nd=[[48,57,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[3046,3055,1],[3174,3183,1],[3302,3311,1],[3430,3439,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3881,1],[4160,4169,1],[4240,4249,1],[6112,6121,1],[6160,6169,1],[6470,6479,1],[6608,6617,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[42528,42537,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[66720,66729,1],[68912,68921,1],[69734,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71481,1],[71904,71913,1],[72016,72025,1],[72784,72793,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125264,125273,1],[130032,130041,1]];static Nl=[[5870,5872,1],[8544,8578,1],[8581,8584,1],[12295,12321,26],[12322,12329,1],[12344,12346,1],[42726,42735,1],[65856,65908,1],[66369,66378,9],[66513,66517,1],[74752,74862,1]];static No=[[178,179,1],[185,188,3],[189,190,1],[2548,2553,1],[2930,2935,1],[3056,3058,1],[3192,3198,1],[3416,3422,1],[3440,3448,1],[3882,3891,1],[4969,4988,1],[6128,6137,1],[6618,8304,1686],[8308,8313,1],[8320,8329,1],[8528,8543,1],[8585,9312,727],[9313,9371,1],[9450,9471,1],[10102,10131,1],[11517,12690,1173],[12691,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[43056,43061,1],[65799,65843,1],[65909,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69733,1],[70113,70132,1],[71482,71483,1],[71914,71922,1],[72794,72812,1],[73664,73684,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[125127,125135,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1]];static P=[[33,35,1],[37,42,1],[44,47,1],[58,59,1],[63,64,1],[91,93,1],[95,123,28],[125,161,36],[167,171,4],[182,183,1],[187,191,4],[894,903,9],[1370,1375,1],[1417,1418,1],[1470,1472,2],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3898,38],[3899,3901,1],[3973,4048,75],[4049,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5120,5742,622],[5787,5788,1],[5867,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8208,829],[8209,8231,1],[8240,8259,1],[8261,8273,1],[8275,8286,1],[8317,8318,1],[8333,8334,1],[8968,8971,1],[9001,9002,1],[10088,10101,1],[10181,10182,1],[10214,10223,1],[10627,10648,1],[10712,10715,1],[10748,10749,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11822,1],[11824,11855,1],[11858,11869,1],[12289,12291,1],[12296,12305,1],[12308,12319,1],[12336,12349,13],[12448,12539,91],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,64830,20819],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65121,1],[65123,65128,5],[65130,65131,1],[65281,65283,1],[65285,65290,1],[65292,65295,1],[65306,65307,1],[65311,65312,1],[65339,65341,1],[65343,65371,28],[65373,65375,2],[65376,65381,1],[65792,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69293,69461,168],[69462,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Pc=[[95,8255,8160],[8256,8276,20],[65075,65076,1],[65101,65103,1],[65343,65343,1]];static Pd=[[45,1418,1373],[1470,5120,3650],[6150,8208,2058],[8209,8213,1],[11799,11802,3],[11834,11835,1],[11840,11869,29],[12316,12336,20],[12448,65073,52625],[65074,65112,38],[65123,65293,170],[69293,69293,1]];static Pe=[[41,93,52],[125,3899,3774],[3901,5788,1887],[8262,8318,56],[8334,8969,635],[8971,9002,31],[10089,10101,2],[10182,10215,33],[10217,10223,2],[10628,10648,2],[10713,10715,2],[10749,11811,1062],[11813,11817,2],[11862,11868,2],[12297,12305,2],[12309,12315,2],[12318,12319,1],[64830,65048,218],[65078,65092,2],[65096,65114,18],[65116,65118,2],[65289,65341,52],[65373,65379,3]];static Pf=[[187,8217,8030],[8221,8250,29],[11779,11781,2],[11786,11789,3],[11805,11809,4]];static Pi=[[171,8216,8045],[8219,8220,1],[8223,8249,26],[11778,11780,2],[11785,11788,3],[11804,11808,4]];static Po=[[33,35,1],[37,39,1],[42,46,2],[47,58,11],[59,63,4],[64,92,28],[161,167,6],[182,183,1],[191,894,703],[903,1370,467],[1371,1375,1],[1417,1472,55],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3973,113],[4048,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5742,5867,125],[5868,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6149,1],[6151,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8214,835],[8215,8224,9],[8225,8231,1],[8240,8248,1],[8251,8254,1],[8257,8259,1],[8263,8273,1],[8275,8277,2],[8278,8286,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11782,5],[11783,11784,1],[11787,11790,3],[11791,11798,1],[11800,11801,1],[11803,11806,3],[11807,11818,11],[11819,11822,1],[11824,11833,1],[11836,11839,1],[11841,11843,2],[11844,11855,1],[11858,11860,1],[12289,12291,1],[12349,12539,190],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,65040,21029],[65041,65046,1],[65049,65072,23],[65093,65094,1],[65097,65100,1],[65104,65106,1],[65108,65111,1],[65119,65121,1],[65128,65130,2],[65131,65281,150],[65282,65283,1],[65285,65287,1],[65290,65294,2],[65295,65306,11],[65307,65311,4],[65312,65340,28],[65377,65380,3],[65381,65792,411],[65793,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69461,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Ps=[[40,91,51],[123,3898,3775],[3900,5787,1887],[8218,8222,4],[8261,8317,56],[8333,8968,635],[8970,9001,31],[10088,10100,2],[10181,10214,33],[10216,10222,2],[10627,10647,2],[10712,10714,2],[10748,11810,1062],[11812,11816,2],[11842,11861,19],[11863,11867,2],[12296,12304,2],[12308,12314,2],[12317,64831,52514],[65047,65077,30],[65079,65091,2],[65095,65113,18],[65115,65117,2],[65288,65339,51],[65371,65375,4],[65378,65378,1]];static S=[[36,43,7],[60,62,1],[94,96,2],[124,126,2],[162,166,1],[168,169,1],[172,174,2],[175,177,1],[180,184,4],[215,247,32],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,1014,113],[1154,1421,267],[1422,1423,1],[1542,1544,1],[1547,1550,3],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2046,2047,1],[2184,2546,362],[2547,2554,7],[2555,2801,246],[2928,3059,131],[3060,3066,1],[3199,3407,208],[3449,3647,198],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6107,366],[6464,6622,158],[6623,6655,1],[7009,7018,1],[7028,7036,1],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8352,8384,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8472,1],[8478,8483,1],[8485,8489,2],[8494,8506,12],[8507,8512,5],[8513,8516,1],[8522,8525,1],[8527,8586,59],[8587,8592,5],[8593,8967,1],[8972,9e3,1],[9003,9254,1],[9280,9290,1],[9372,9449,1],[9472,10087,1],[10132,10180,1],[10183,10213,1],[10224,10626,1],[10649,10711,1],[10716,10747,1],[10750,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12443,12444,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43048,43051,1],[43062,43065,1],[43639,43641,1],[43867,43882,15],[43883,64297,20414],[64434,64450,1],[64832,64847,1],[64975,65020,45],[65021,65023,1],[65122,65124,2],[65125,65126,1],[65129,65284,155],[65291,65308,17],[65309,65310,1],[65342,65344,2],[65372,65374,2],[65504,65510,1],[65512,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,123647,432],[126124,126128,4],[126254,126704,450],[126705,126976,271],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Sc=[[36,162,126],[163,165,1],[1423,1547,124],[2046,2047,1],[2546,2547,1],[2555,2801,246],[3065,3647,582],[6107,8352,2245],[8353,8384,1],[43064,65020,21956],[65129,65284,155],[65504,65505,1],[65509,65510,1],[73693,73696,1],[123647,126128,2481]];static Sk=[[94,96,2],[168,175,7],[180,184,4],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,2184,1283],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[12443,12444,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43867,43882,15],[43883,64434,20551],[64435,64450,1],[65342,65344,2],[65507,127995,62488],[127996,127999,1]];static Sm=[[43,60,17],[61,62,1],[124,126,2],[172,177,5],[215,247,32],[1014,1542,528],[1543,1544,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8472,8512,40],[8513,8516,1],[8523,8592,69],[8593,8596,1],[8602,8603,1],[8608,8614,3],[8622,8654,32],[8655,8658,3],[8660,8692,32],[8693,8959,1],[8992,8993,1],[9084,9115,31],[9116,9139,1],[9180,9185,1],[9655,9665,10],[9720,9727,1],[9839,10176,337],[10177,10180,1],[10183,10213,1],[10224,10239,1],[10496,10626,1],[10649,10711,1],[10716,10747,1],[10750,11007,1],[11056,11076,1],[11079,11084,1],[64297,65122,825],[65124,65126,1],[65291,65308,17],[65309,65310,1],[65372,65374,2],[65506,65513,7],[65514,65516,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[126704,126705,1]];static So=[[166,169,3],[174,176,2],[1154,1421,267],[1422,1550,128],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2554,2928,374],[3059,3064,1],[3066,3199,133],[3407,3449,42],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6464,723],[6622,6655,1],[7009,7018,1],[7028,7036,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8478,7],[8479,8483,1],[8485,8489,2],[8494,8506,12],[8507,8522,15],[8524,8525,1],[8527,8586,59],[8587,8597,10],[8598,8601,1],[8604,8607,1],[8609,8610,1],[8612,8613,1],[8615,8621,1],[8623,8653,1],[8656,8657,1],[8659,8661,2],[8662,8691,1],[8960,8967,1],[8972,8991,1],[8994,9e3,1],[9003,9083,1],[9085,9114,1],[9140,9179,1],[9186,9254,1],[9280,9290,1],[9372,9449,1],[9472,9654,1],[9656,9664,1],[9666,9719,1],[9728,9838,1],[9840,10087,1],[10132,10175,1],[10240,10495,1],[11008,11055,1],[11077,11078,1],[11085,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[43048,43051,1],[43062,43063,1],[43065,43639,574],[43640,43641,1],[64832,64847,1],[64975,65021,46],[65022,65023,1],[65508,65512,4],[65517,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73692,1],[73697,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,126124,2909],[126254,126976,722],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,127994,1],[128e3,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Z=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8232,8233,1],[8239,8287,48],[12288,12288,1]];static Zl=[[8232,8232,1]];static Zp=[[8233,8233,1]];static Zs=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8239,8287,48],[12288,12288,1]];static Adlam=[[125184,125259,1],[125264,125273,1],[125278,125279,1]];static Ahom=[[71424,71450,1],[71453,71467,1],[71472,71494,1]];static Anatolian_Hieroglyphs=[[82944,83526,1]];static Arabic=[[1536,1540,1],[1542,1547,1],[1549,1562,1],[1564,1566,1],[1568,1599,1],[1601,1610,1],[1622,1647,1],[1649,1756,1],[1758,1791,1],[1872,1919,1],[2160,2190,1],[2192,2193,1],[2200,2273,1],[2275,2303,1],[64336,64450,1],[64467,64829,1],[64832,64911,1],[64914,64967,1],[64975,65008,33],[65009,65023,1],[65136,65140,1],[65142,65276,1],[69216,69246,1],[69373,69375,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[126704,126705,1]];static Armenian=[[1329,1366,1],[1369,1418,1],[1421,1423,1],[64275,64279,1]];static Avestan=[[68352,68405,1],[68409,68415,1]];static Balinese=[[6912,6988,1],[6992,7038,1]];static Bamum=[[42656,42743,1],[92160,92728,1]];static Bassa_Vah=[[92880,92909,1],[92912,92917,1]];static Batak=[[7104,7155,1],[7164,7167,1]];static Bengali=[[2432,2435,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2492,2500,1],[2503,2504,1],[2507,2510,1],[2519,2524,5],[2525,2527,2],[2528,2531,1],[2534,2558,1]];static Bhaiksuki=[[72704,72712,1],[72714,72758,1],[72760,72773,1],[72784,72812,1]];static Bopomofo=[[746,747,1],[12549,12591,1],[12704,12735,1]];static Brahmi=[[69632,69709,1],[69714,69749,1],[69759,69759,1]];static Braille=[[10240,10495,1]];static Buginese=[[6656,6683,1],[6686,6687,1]];static Buhid=[[5952,5971,1]];static Canadian_Aboriginal=[[5120,5759,1],[6320,6389,1],[72368,72383,1]];static Carian=[[66208,66256,1]];static Caucasian_Albanian=[[66864,66915,1],[66927,66927,1]];static Chakma=[[69888,69940,1],[69942,69959,1]];static Cham=[[43520,43574,1],[43584,43597,1],[43600,43609,1],[43612,43615,1]];static Cherokee=[[5024,5109,1],[5112,5117,1],[43888,43967,1]];static Chorasmian=[[69552,69579,1]];static Common=[[0,64,1],[91,96,1],[123,169,1],[171,185,1],[187,191,1],[215,247,32],[697,735,1],[741,745,1],[748,767,1],[884,894,10],[901,903,2],[1541,1548,7],[1563,1567,4],[1600,1757,157],[2274,2404,130],[2405,3647,1242],[4053,4056,1],[4347,5867,1520],[5868,5869,1],[5941,5942,1],[6146,6147,1],[6149,7379,1230],[7393,7401,8],[7402,7404,1],[7406,7411,1],[7413,7415,1],[7418,8192,774],[8193,8203,1],[8206,8292,1],[8294,8304,1],[8308,8318,1],[8320,8334,1],[8352,8384,1],[8448,8485,1],[8487,8489,1],[8492,8497,1],[8499,8525,1],[8527,8543,1],[8585,8587,1],[8592,9254,1],[9280,9290,1],[9312,10239,1],[10496,11123,1],[11126,11157,1],[11159,11263,1],[11776,11869,1],[12272,12292,1],[12294,12296,2],[12297,12320,1],[12336,12343,1],[12348,12351,1],[12443,12444,1],[12448,12539,91],[12540,12688,148],[12689,12703,1],[12736,12771,1],[12783,12832,49],[12833,12895,1],[12927,13007,1],[13055,13144,89],[13145,13311,1],[19904,19967,1],[42752,42785,1],[42888,42890,1],[43056,43065,1],[43310,43471,161],[43867,43882,15],[43883,64830,20947],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65126,1],[65128,65131,1],[65279,65281,2],[65282,65312,1],[65339,65344,1],[65371,65381,1],[65392,65438,46],[65439,65504,65],[65505,65510,1],[65512,65518,1],[65529,65533,1],[65792,65794,1],[65799,65843,1],[65847,65855,1],[65936,65948,1],[66e3,66044,1],[66273,66299,1],[113824,113827,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119142,1],[119146,119162,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119488,119507,1],[119520,119539,1],[119552,119638,1],[119648,119672,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120779,1],[120782,120831,1],[126065,126132,1],[126209,126269,1],[126976,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127232,127405,1],[127462,127487,1],[127489,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1],[130032,130041,1],[917505,917536,31],[917537,917631,1]];static foldCommon=[[924,956,32]];static Coptic=[[994,1007,1],[11392,11507,1],[11513,11519,1]];static Cuneiform=[[73728,74649,1],[74752,74862,1],[74864,74868,1],[74880,75075,1]];static Cypriot=[[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3]];static Cypro_Minoan=[[77712,77810,1]];static Cyrillic=[[1024,1156,1],[1159,1327,1],[7296,7304,1],[7467,7544,77],[11744,11775,1],[42560,42655,1],[65070,65071,1],[122928,122989,1],[123023,123023,1]];static Deseret=[[66560,66639,1]];static Devanagari=[[2304,2384,1],[2389,2403,1],[2406,2431,1],[43232,43263,1],[72448,72457,1]];static Dives_Akuru=[[71936,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71989,1],[71991,71992,1],[71995,72006,1],[72016,72025,1]];static Dogra=[[71680,71739,1]];static Duployan=[[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[113820,113823,1]];static Egyptian_Hieroglyphs=[[77824,78933,1]];static Elbasan=[[66816,66855,1]];static Elymaic=[[69600,69622,1]];static Ethiopic=[[4608,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4957,4988,1],[4992,5017,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1]];static Georgian=[[4256,4293,1],[4295,4301,6],[4304,4346,1],[4348,4351,1],[7312,7354,1],[7357,7359,1],[11520,11557,1],[11559,11565,6]];static Glagolitic=[[11264,11359,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1]];static Gothic=[[66352,66378,1]];static Grantha=[[70400,70403,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70460,70468,1],[70471,70472,1],[70475,70477,1],[70480,70487,7],[70493,70499,1],[70502,70508,1],[70512,70516,1]];static Greek=[[880,883,1],[885,887,1],[890,893,1],[895,900,5],[902,904,2],[905,906,1],[908,910,2],[911,929,1],[931,993,1],[1008,1023,1],[7462,7466,1],[7517,7521,1],[7526,7530,1],[7615,7936,321],[7937,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8132,1],[8134,8147,1],[8150,8155,1],[8157,8175,1],[8178,8180,1],[8182,8190,1],[8486,43877,35391],[65856,65934,1],[65952,119296,53344],[119297,119365,1]];static foldGreek=[[181,837,656]];static Gujarati=[[2689,2691,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2748,2757,1],[2759,2761,1],[2763,2765,1],[2768,2784,16],[2785,2787,1],[2790,2801,1],[2809,2815,1]];static Gunjala_Gondi=[[73056,73061,1],[73063,73064,1],[73066,73102,1],[73104,73105,1],[73107,73112,1],[73120,73129,1]];static Gurmukhi=[[2561,2563,1],[2565,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2649,8],[2650,2652,1],[2654,2662,8],[2663,2678,1]];static Han=[[11904,11929,1],[11931,12019,1],[12032,12245,1],[12293,12295,2],[12321,12329,1],[12344,12347,1],[13312,19903,1],[19968,40959,1],[63744,64109,1],[64112,64217,1],[94178,94179,1],[94192,94193,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Hangul=[[4352,4607,1],[12334,12335,1],[12593,12686,1],[12800,12830,1],[12896,12926,1],[43360,43388,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1]];static Hanifi_Rohingya=[[68864,68903,1],[68912,68921,1]];static Hanunoo=[[5920,5940,1]];static Hatran=[[67808,67826,1],[67828,67829,1],[67835,67839,1]];static Hebrew=[[1425,1479,1],[1488,1514,1],[1519,1524,1],[64285,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64335,1]];static Hiragana=[[12353,12438,1],[12445,12447,1],[110593,110879,1],[110898,110928,30],[110929,110930,1],[127488,127488,1]];static Imperial_Aramaic=[[67648,67669,1],[67671,67679,1]];static Inherited=[[768,879,1],[1157,1158,1],[1611,1621,1],[1648,2385,737],[2386,2388,1],[6832,6862,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8204,8205,1],[8400,8432,1],[12330,12333,1],[12441,12442,1],[65024,65039,1],[65056,65069,1],[66045,66272,227],[70459,118528,48069],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[917760,917999,1]];static foldInherited=[[921,953,32],[8126,8126,1]];static Inscriptional_Pahlavi=[[68448,68466,1],[68472,68479,1]];static Inscriptional_Parthian=[[68416,68437,1],[68440,68447,1]];static Javanese=[[43392,43469,1],[43472,43481,1],[43486,43487,1]];static Kaithi=[[69760,69826,1],[69837,69837,1]];static Kannada=[[3200,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3260,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3293,3294,1],[3296,3299,1],[3302,3311,1],[3313,3315,1]];static Katakana=[[12449,12538,1],[12541,12543,1],[12784,12799,1],[13008,13054,1],[13056,13143,1],[65382,65391,1],[65393,65437,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110880,288],[110881,110882,1],[110933,110948,15],[110949,110951,1]];static Kawi=[[73472,73488,1],[73490,73530,1],[73534,73561,1]];static Kayah_Li=[[43264,43309,1],[43311,43311,1]];static Kharoshthi=[[68096,68099,1],[68101,68102,1],[68108,68115,1],[68117,68119,1],[68121,68149,1],[68152,68154,1],[68159,68168,1],[68176,68184,1]];static Khitan_Small_Script=[[94180,101120,6940],[101121,101589,1]];static Khmer=[[6016,6109,1],[6112,6121,1],[6128,6137,1],[6624,6655,1]];static Khojki=[[70144,70161,1],[70163,70209,1]];static Khudawadi=[[70320,70378,1],[70384,70393,1]];static Lao=[[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3773,1],[3776,3780,1],[3782,3784,2],[3785,3790,1],[3792,3801,1],[3804,3807,1]];static Latin=[[65,90,1],[97,122,1],[170,186,16],[192,214,1],[216,246,1],[248,696,1],[736,740,1],[7424,7461,1],[7468,7516,1],[7522,7525,1],[7531,7543,1],[7545,7614,1],[7680,7935,1],[8305,8319,14],[8336,8348,1],[8490,8491,1],[8498,8526,28],[8544,8584,1],[11360,11391,1],[42786,42887,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43007,1],[43824,43866,1],[43868,43876,1],[43878,43881,1],[64256,64262,1],[65313,65338,1],[65345,65370,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[122624,122654,1],[122661,122666,1]];static Lepcha=[[7168,7223,1],[7227,7241,1],[7245,7247,1]];static Limbu=[[6400,6430,1],[6432,6443,1],[6448,6459,1],[6464,6468,4],[6469,6479,1]];static Linear_A=[[67072,67382,1],[67392,67413,1],[67424,67431,1]];static Linear_B=[[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1]];static Lisu=[[42192,42239,1],[73648,73648,1]];static Lycian=[[66176,66204,1]];static Lydian=[[67872,67897,1],[67903,67903,1]];static Mahajani=[[69968,70006,1]];static Makasar=[[73440,73464,1]];static Malayalam=[[3328,3340,1],[3342,3344,1],[3346,3396,1],[3398,3400,1],[3402,3407,1],[3412,3427,1],[3430,3455,1]];static Mandaic=[[2112,2139,1],[2142,2142,1]];static Manichaean=[[68288,68326,1],[68331,68342,1]];static Marchen=[[72816,72847,1],[72850,72871,1],[72873,72886,1]];static Masaram_Gondi=[[72960,72966,1],[72968,72969,1],[72971,73014,1],[73018,73020,2],[73021,73023,2],[73024,73031,1],[73040,73049,1]];static Medefaidrin=[[93760,93850,1]];static Meetei_Mayek=[[43744,43766,1],[43968,44013,1],[44016,44025,1]];static Mende_Kikakui=[[124928,125124,1],[125127,125142,1]];static Meroitic_Cursive=[[68e3,68023,1],[68028,68047,1],[68050,68095,1]];static Meroitic_Hieroglyphs=[[67968,67999,1]];static Miao=[[93952,94026,1],[94031,94087,1],[94095,94111,1]];static Modi=[[71168,71236,1],[71248,71257,1]];static Mongolian=[[6144,6145,1],[6148,6150,2],[6151,6169,1],[6176,6264,1],[6272,6314,1],[71264,71276,1]];static Mro=[[92736,92766,1],[92768,92777,1],[92782,92783,1]];static Multani=[[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70313,1]];static Myanmar=[[4096,4255,1],[43488,43518,1],[43616,43647,1]];static Nabataean=[[67712,67742,1],[67751,67759,1]];static Nag_Mundari=[[124112,124153,1]];static Nandinagari=[[72096,72103,1],[72106,72151,1],[72154,72164,1]];static New_Tai_Lue=[[6528,6571,1],[6576,6601,1],[6608,6618,1],[6622,6623,1]];static Newa=[[70656,70747,1],[70749,70753,1]];static Nko=[[1984,2042,1],[2045,2047,1]];static Nushu=[[94177,110960,16783],[110961,111355,1]];static Nyiakeng_Puachue_Hmong=[[123136,123180,1],[123184,123197,1],[123200,123209,1],[123214,123215,1]];static Ogham=[[5760,5788,1]];static Ol_Chiki=[[7248,7295,1]];static Old_Hungarian=[[68736,68786,1],[68800,68850,1],[68858,68863,1]];static Old_Italic=[[66304,66339,1],[66349,66351,1]];static Old_North_Arabian=[[68224,68255,1]];static Old_Permic=[[66384,66426,1]];static Old_Persian=[[66464,66499,1],[66504,66517,1]];static Old_Sogdian=[[69376,69415,1]];static Old_South_Arabian=[[68192,68223,1]];static Old_Turkic=[[68608,68680,1]];static Old_Uyghur=[[69488,69513,1]];static Oriya=[[2817,2819,1],[2821,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2876,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2908,2909,1],[2911,2915,1],[2918,2935,1]];static Osage=[[66736,66771,1],[66776,66811,1]];static Osmanya=[[66688,66717,1],[66720,66729,1]];static Pahawh_Hmong=[[92928,92997,1],[93008,93017,1],[93019,93025,1],[93027,93047,1],[93053,93071,1]];static Palmyrene=[[67680,67711,1]];static Pau_Cin_Hau=[[72384,72440,1]];static Phags_Pa=[[43072,43127,1]];static Phoenician=[[67840,67867,1],[67871,67871,1]];static Psalter_Pahlavi=[[68480,68497,1],[68505,68508,1],[68521,68527,1]];static Rejang=[[43312,43347,1],[43359,43359,1]];static Runic=[[5792,5866,1],[5870,5880,1]];static Samaritan=[[2048,2093,1],[2096,2110,1]];static Saurashtra=[[43136,43205,1],[43214,43225,1]];static Sharada=[[70016,70111,1]];static Shavian=[[66640,66687,1]];static Siddham=[[71040,71093,1],[71096,71133,1]];static SignWriting=[[120832,121483,1],[121499,121503,1],[121505,121519,1]];static Sinhala=[[3457,3459,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3558,3567,1],[3570,3572,1],[70113,70132,1]];static Sogdian=[[69424,69465,1]];static Sora_Sompeng=[[69840,69864,1],[69872,69881,1]];static Soyombo=[[72272,72354,1]];static Sundanese=[[7040,7103,1],[7360,7367,1]];static Syloti_Nagri=[[43008,43052,1]];static Syriac=[[1792,1805,1],[1807,1866,1],[1869,1871,1],[2144,2154,1]];static Tagalog=[[5888,5909,1],[5919,5919,1]];static Tagbanwa=[[5984,5996,1],[5998,6e3,1],[6002,6003,1]];static Tai_Le=[[6480,6509,1],[6512,6516,1]];static Tai_Tham=[[6688,6750,1],[6752,6780,1],[6783,6793,1],[6800,6809,1],[6816,6829,1]];static Tai_Viet=[[43648,43714,1],[43739,43743,1]];static Takri=[[71296,71353,1],[71360,71369,1]];static Tamil=[[2946,2947,1],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3006,3010,1],[3014,3016,1],[3018,3021,1],[3024,3031,7],[3046,3066,1],[73664,73713,1],[73727,73727,1]];static Tangsa=[[92784,92862,1],[92864,92873,1]];static Tangut=[[94176,94208,32],[94209,100343,1],[100352,101119,1],[101632,101640,1]];static Telugu=[[3072,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3132,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3160,3162,1],[3165,3168,3],[3169,3171,1],[3174,3183,1],[3191,3199,1]];static Thaana=[[1920,1969,1]];static Thai=[[3585,3642,1],[3648,3675,1]];static Tibetan=[[3840,3911,1],[3913,3948,1],[3953,3991,1],[3993,4028,1],[4030,4044,1],[4046,4052,1],[4057,4058,1]];static Tifinagh=[[11568,11623,1],[11631,11632,1],[11647,11647,1]];static Tirhuta=[[70784,70855,1],[70864,70873,1]];static Toto=[[123536,123566,1]];static Ugaritic=[[66432,66461,1],[66463,66463,1]];static Vai=[[42240,42539,1]];static Vithkuqi=[[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1]];static Wancho=[[123584,123641,1],[123647,123647,1]];static Warang_Citi=[[71840,71922,1],[71935,71935,1]];static Yezidi=[[69248,69289,1],[69291,69293,1],[69296,69297,1]];static Yi=[[40960,42124,1],[42128,42182,1]];static Zanabazar_Square=[[72192,72263,1]];static CATEGORIES=(()=>new Map([["C",nc.C],["Cc",nc.Cc],["Cf",nc.Cf],["Co",nc.Co],["Cs",nc.Cs],["L",nc.L],["Ll",nc.Ll],["Lm",nc.Lm],["Lo",nc.Lo],["Lt",nc.Lt],["Lu",nc.Lu],["M",nc.M],["Mc",nc.Mc],["Me",nc.Me],["Mn",nc.Mn],["N",nc.N],["Nd",nc.Nd],["Nl",nc.Nl],["No",nc.No],["P",nc.P],["Pc",nc.Pc],["Pd",nc.Pd],["Pe",nc.Pe],["Pf",nc.Pf],["Pi",nc.Pi],["Po",nc.Po],["Ps",nc.Ps],["S",nc.S],["Sc",nc.Sc],["Sk",nc.Sk],["Sm",nc.Sm],["So",nc.So],["Z",nc.Z],["Zl",nc.Zl],["Zp",nc.Zp],["Zs",nc.Zs]]))();static SCRIPTS=(()=>new Map([["Adlam",nc.Adlam],["Ahom",nc.Ahom],["Anatolian_Hieroglyphs",nc.Anatolian_Hieroglyphs],["Arabic",nc.Arabic],["Armenian",nc.Armenian],["Avestan",nc.Avestan],["Balinese",nc.Balinese],["Bamum",nc.Bamum],["Bassa_Vah",nc.Bassa_Vah],["Batak",nc.Batak],["Bengali",nc.Bengali],["Bhaiksuki",nc.Bhaiksuki],["Bopomofo",nc.Bopomofo],["Brahmi",nc.Brahmi],["Braille",nc.Braille],["Buginese",nc.Buginese],["Buhid",nc.Buhid],["Canadian_Aboriginal",nc.Canadian_Aboriginal],["Carian",nc.Carian],["Caucasian_Albanian",nc.Caucasian_Albanian],["Chakma",nc.Chakma],["Cham",nc.Cham],["Cherokee",nc.Cherokee],["Chorasmian",nc.Chorasmian],["Common",nc.Common],["Coptic",nc.Coptic],["Cuneiform",nc.Cuneiform],["Cypriot",nc.Cypriot],["Cypro_Minoan",nc.Cypro_Minoan],["Cyrillic",nc.Cyrillic],["Deseret",nc.Deseret],["Devanagari",nc.Devanagari],["Dives_Akuru",nc.Dives_Akuru],["Dogra",nc.Dogra],["Duployan",nc.Duployan],["Egyptian_Hieroglyphs",nc.Egyptian_Hieroglyphs],["Elbasan",nc.Elbasan],["Elymaic",nc.Elymaic],["Ethiopic",nc.Ethiopic],["Georgian",nc.Georgian],["Glagolitic",nc.Glagolitic],["Gothic",nc.Gothic],["Grantha",nc.Grantha],["Greek",nc.Greek],["Gujarati",nc.Gujarati],["Gunjala_Gondi",nc.Gunjala_Gondi],["Gurmukhi",nc.Gurmukhi],["Han",nc.Han],["Hangul",nc.Hangul],["Hanifi_Rohingya",nc.Hanifi_Rohingya],["Hanunoo",nc.Hanunoo],["Hatran",nc.Hatran],["Hebrew",nc.Hebrew],["Hiragana",nc.Hiragana],["Imperial_Aramaic",nc.Imperial_Aramaic],["Inherited",nc.Inherited],["Inscriptional_Pahlavi",nc.Inscriptional_Pahlavi],["Inscriptional_Parthian",nc.Inscriptional_Parthian],["Javanese",nc.Javanese],["Kaithi",nc.Kaithi],["Kannada",nc.Kannada],["Katakana",nc.Katakana],["Kawi",nc.Kawi],["Kayah_Li",nc.Kayah_Li],["Kharoshthi",nc.Kharoshthi],["Khitan_Small_Script",nc.Khitan_Small_Script],["Khmer",nc.Khmer],["Khojki",nc.Khojki],["Khudawadi",nc.Khudawadi],["Lao",nc.Lao],["Latin",nc.Latin],["Lepcha",nc.Lepcha],["Limbu",nc.Limbu],["Linear_A",nc.Linear_A],["Linear_B",nc.Linear_B],["Lisu",nc.Lisu],["Lycian",nc.Lycian],["Lydian",nc.Lydian],["Mahajani",nc.Mahajani],["Makasar",nc.Makasar],["Malayalam",nc.Malayalam],["Mandaic",nc.Mandaic],["Manichaean",nc.Manichaean],["Marchen",nc.Marchen],["Masaram_Gondi",nc.Masaram_Gondi],["Medefaidrin",nc.Medefaidrin],["Meetei_Mayek",nc.Meetei_Mayek],["Mende_Kikakui",nc.Mende_Kikakui],["Meroitic_Cursive",nc.Meroitic_Cursive],["Meroitic_Hieroglyphs",nc.Meroitic_Hieroglyphs],["Miao",nc.Miao],["Modi",nc.Modi],["Mongolian",nc.Mongolian],["Mro",nc.Mro],["Multani",nc.Multani],["Myanmar",nc.Myanmar],["Nabataean",nc.Nabataean],["Nag_Mundari",nc.Nag_Mundari],["Nandinagari",nc.Nandinagari],["New_Tai_Lue",nc.New_Tai_Lue],["Newa",nc.Newa],["Nko",nc.Nko],["Nushu",nc.Nushu],["Nyiakeng_Puachue_Hmong",nc.Nyiakeng_Puachue_Hmong],["Ogham",nc.Ogham],["Ol_Chiki",nc.Ol_Chiki],["Old_Hungarian",nc.Old_Hungarian],["Old_Italic",nc.Old_Italic],["Old_North_Arabian",nc.Old_North_Arabian],["Old_Permic",nc.Old_Permic],["Old_Persian",nc.Old_Persian],["Old_Sogdian",nc.Old_Sogdian],["Old_South_Arabian",nc.Old_South_Arabian],["Old_Turkic",nc.Old_Turkic],["Old_Uyghur",nc.Old_Uyghur],["Oriya",nc.Oriya],["Osage",nc.Osage],["Osmanya",nc.Osmanya],["Pahawh_Hmong",nc.Pahawh_Hmong],["Palmyrene",nc.Palmyrene],["Pau_Cin_Hau",nc.Pau_Cin_Hau],["Phags_Pa",nc.Phags_Pa],["Phoenician",nc.Phoenician],["Psalter_Pahlavi",nc.Psalter_Pahlavi],["Rejang",nc.Rejang],["Runic",nc.Runic],["Samaritan",nc.Samaritan],["Saurashtra",nc.Saurashtra],["Sharada",nc.Sharada],["Shavian",nc.Shavian],["Siddham",nc.Siddham],["SignWriting",nc.SignWriting],["Sinhala",nc.Sinhala],["Sogdian",nc.Sogdian],["Sora_Sompeng",nc.Sora_Sompeng],["Soyombo",nc.Soyombo],["Sundanese",nc.Sundanese],["Syloti_Nagri",nc.Syloti_Nagri],["Syriac",nc.Syriac],["Tagalog",nc.Tagalog],["Tagbanwa",nc.Tagbanwa],["Tai_Le",nc.Tai_Le],["Tai_Tham",nc.Tai_Tham],["Tai_Viet",nc.Tai_Viet],["Takri",nc.Takri],["Tamil",nc.Tamil],["Tangsa",nc.Tangsa],["Tangut",nc.Tangut],["Telugu",nc.Telugu],["Thaana",nc.Thaana],["Thai",nc.Thai],["Tibetan",nc.Tibetan],["Tifinagh",nc.Tifinagh],["Tirhuta",nc.Tirhuta],["Toto",nc.Toto],["Ugaritic",nc.Ugaritic],["Vai",nc.Vai],["Vithkuqi",nc.Vithkuqi],["Wancho",nc.Wancho],["Warang_Citi",nc.Warang_Citi],["Yezidi",nc.Yezidi],["Yi",nc.Yi],["Zanabazar_Square",nc.Zanabazar_Square]]))();static FOLD_CATEGORIES=(()=>new Map([["L",nc.foldL],["Ll",nc.foldLl],["Lt",nc.foldLt],["Lu",nc.foldLu],["M",nc.foldM],["Mn",nc.foldMn]]))();static FOLD_SCRIPT=(()=>new Map([["Common",nc.foldCommon],["Greek",nc.foldGreek],["Inherited",nc.foldInherited]]))()}class rc{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(e,t){let n=0,r=e.length;for(;n<r;){let s=n+Math.floor((r-n)/2),i=e[s];if(i[0]<=t&&t<=i[1])return(t-i[0])%i[2]===0;t<i[0]?r=s:n=s+1}return!1}static is(e,t){if(t<=this.MAX_LATIN1){for(let n of e)if(!(t>n[1]))return!(t<n[0])&&(t-n[0])%n[2]===0;return!1}return e.length>0&&t>=e[0][0]&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){const t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(nc.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e<127||e>=161&&173!==e:this.is(nc.L,e)||this.is(nc.M,e)||this.is(nc.N,e)||this.is(nc.P,e)||this.is(nc.S,e)}static simpleFold(e){if(nc.CASE_ORBIT.has(e))return nc.CASE_ORBIT.get(e);const t=tc.toLowerCase(e);return t!==e?t:tc.toUpperCase(e)}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return tc.CODES.get("A")<=e&&e<=tc.CODES.get("Z")&&(e|=32),tc.CODES.get("A")<=t&&t<=tc.CODES.get("Z")&&(t|=32),e===t;for(let n=this.simpleFold(e);n!==e;n=this.simpleFold(n))if(n===t)return!0;return!1}}class sc{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(e){return tc.CODES.get("0")<=e&&e<=tc.CODES.get("9")||tc.CODES.get("a")<=e&&e<=tc.CODES.get("z")||tc.CODES.get("A")<=e&&e<=tc.CODES.get("Z")}static unhex(e){return tc.CODES.get("0")<=e&&e<=tc.CODES.get("9")?e-tc.CODES.get("0"):tc.CODES.get("a")<=e&&e<=tc.CODES.get("f")?e-tc.CODES.get("a")+10:tc.CODES.get("A")<=e&&e<=tc.CODES.get("F")?e-tc.CODES.get("A")+10:-1}static escapeRune(e){let t="";if(rc.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+="\\"),t+=String.fromCodePoint(e);else switch(e){case tc.CODES.get('"'):t+='\\"';break;case tc.CODES.get("\\"):t+="\\\\";break;case tc.CODES.get("\t"):t+="\\t";break;case tc.CODES.get("\n"):t+="\\n";break;case tc.CODES.get("\r"):t+="\\r";break;case tc.CODES.get("\b"):t+="\\b";break;case tc.CODES.get("\f"):t+="\\f";break;default:{let n=e.toString(16);e<256?(t+="\\x",1===n.length&&(t+="0"),t+=n):t+=`\\x{${n}}`;break}}return t}static stringToRunes(e){return String(e).split("").map(e=>e.codePointAt(0))}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return tc.CODES.get("a")<=e&&e<=tc.CODES.get("z")||tc.CODES.get("A")<=e&&e<=tc.CODES.get("Z")||tc.CODES.get("0")<=e&&e<=tc.CODES.get("9")||e===tc.CODES.get("_")}static emptyOpContext(e,t){let n=0;return e<0&&(n|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),e===tc.CODES.get("\n")&&(n|=this.EMPTY_BEGIN_LINE),t<0&&(n|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),t===tc.CODES.get("\n")&&(n|=this.EMPTY_END_LINE),this.isWordRune(e)!==this.isWordRune(t)?n|=this.EMPTY_WORD_BOUNDARY:n|=this.EMPTY_NO_WORD_BOUNDARY,n}static quoteMeta(e){return e.split("").map(e=>this.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join("")}static charCount(e){return e>rc.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from((new TextEncoder).encode(e));{let t=[],n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=63&s|128):55296==(64512&s)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=63&s|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=63&s|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(e));{let t=[],n=0,r=0;for(;n<e.length;){let s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){let i=e[n++];t[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){let i=((7&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{let i=e[n++],a=e[n++];t[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&a)}}return t.join("")}}}const ic=(e=[],t=0)=>{const n={};for(let r=0;r<e.length;r++){const s=e[r],i=t+r;n[s]=i,n[i]=s}return Object.freeze(n)};class ac{static Encoding=(()=>ic(["UTF_16","UTF_8"]))();getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===ac.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===ac.Encoding.UTF_16}}class oc extends ac{constructor(e=null){super(),this.bytes=e}getEncoding(){return ac.Encoding.UTF_8}asCharSequence(){return sc.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}}class cc extends ac{constructor(e=null){super(),this.charSequence=e}getEncoding(){return ac.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(e=>e.codePointAt(0))}length(){return this.charSequence.length}}class uc{static utf16(e){return new cc(e)}static utf8(e){return Array.isArray(e)?new oc(e):new oc(sc.stringToUtf8ByteArray(e))}}class lc extends Error{constructor(e){super(e),this.name="RE2JSException"}}class hc extends lc{constructor(e,t=null){let n=`error parsing regexp: ${e}`;t&&(n+=`: \`${t}\``),super(n),this.name="RE2JSSyntaxException",this.message=n,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}}class dc extends lc{constructor(e){super(e),this.name="RE2JSCompileException"}}class pc extends lc{constructor(e){super(e),this.name="RE2JSGroupException"}}class fc extends lc{constructor(e){super(e),this.name="RE2JSFlagsException"}}class gc{static quoteReplacement(e){return e.indexOf("\\")<0&&e.indexOf("$")<0?e:e.split("").map(e=>{const t=e.codePointAt(0);return t===tc.CODES["\\"]||t===tc.CODES.$?`\\${e}`:e}).join("")}constructor(e,t){if(null===e)throw new Error("pattern is null");this.patternInput=e;const n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,t instanceof ac?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(uc.utf8(t)):this.resetMatcherInput(uc.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(null===e)throw new Error("input is null");return this.matcherInput=e,this.reset(),this}start(e=0){if("string"==typeof e){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new pc(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if("string"==typeof e){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new pc(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}group(e=0){if("string"==typeof e){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new pc(`group '${e}' not found`);e=t}const t=this.start(e),n=this.end(e);return t<0&&n<0?null:this.substring(t,n)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new pc(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new pc("perhaps no match attempted");if(0===e||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);const n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!n[0])throw new pc("inconsistency in matching group data");this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,ec.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,ec.ANCHOR_START)}find(e=null){if(null!==e){if(e<0||e>this.matcherInputLength)throw new pc(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,ec.UNANCHORED)}genMatch(e,t){const n=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return!!n[0]&&(this.groups=n[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0)}substring(e,t){return this.matcherInput.isUTF8Encoding()?sc.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let n="";const r=this.start(),s=this.end();return this.appendPos<r&&(n+=this.substring(this.appendPos,r)),this.appendPos=s,n+=t?this.appendReplacementInternalPerl(e):this.appendReplacementInternal(e),n}appendReplacementInternal(e){let t="",n=0;const r=e.length;for(let s=0;s<r-1;s++)if(e.codePointAt(s)!==tc.CODES.get("\\")){if(e.codePointAt(s)===tc.CODES.get("$")){let i=e.codePointAt(s+1);if(tc.CODES.get("0")<=i&&i<=tc.CODES.get("9")){let a=i-tc.CODES.get("0");for(n<s&&(t+=e.substring(n,s)),s+=2;s<r&&(i=e.codePointAt(s),!(i<tc.CODES.get("0")||i>tc.CODES.get("9")||10*a+i-tc.CODES.get("0")>this.patternGroupCount));s++)a=10*a+i-tc.CODES.get("0");if(a>this.patternGroupCount)throw new pc(`n > number of groups: ${a}`);const o=this.group(a);null!==o&&(t+=o),n=s,s--;continue}if(i===tc.CODES.get("{")){n<s&&(t+=e.substring(n,s)),s++;let r=s+1;for(;r<e.length&&e.codePointAt(r)!==tc.CODES.get("}")&&e.codePointAt(r)!==tc.CODES.get(" ");)r++;if(r===e.length||e.codePointAt(r)!==tc.CODES.get("}"))throw new pc("named capture group is missing trailing '}'");const i=e.substring(s+1,r);t+=this.group(i),n=r+1}}}else n<s&&(t+=e.substring(n,s)),s++,n=s;return n<r&&(t+=e.substring(n,r)),t}appendReplacementInternalPerl(e){let t="",n=0;const r=e.length;for(let s=0;s<r-1;s++)if(e.codePointAt(s)===tc.CODES.get("$")){let i=e.codePointAt(s+1);if(tc.CODES.get("$")===i){n<s&&(t+=e.substring(n,s)),t+="$",s++,n=s+1;continue}if(tc.CODES.get("&")===i){n<s&&(t+=e.substring(n,s));const r=this.group(0);t+=null!==r?r:"$&",s++,n=s+1;continue}if(tc.CODES.get("1")<=i&&i<=tc.CODES.get("9")){let a=i-tc.CODES.get("0");for(n<s&&(t+=e.substring(n,s)),s+=2;s<r&&(i=e.codePointAt(s),!(i<tc.CODES.get("0")||i>tc.CODES.get("9")||10*a+i-tc.CODES.get("0")>this.patternGroupCount));s++)a=10*a+i-tc.CODES.get("0");if(a>this.patternGroupCount){t+=`$${a}`,n=s,s--;continue}const o=this.group(a);null!==o&&(t+=o),n=s,s--;continue}if(i===tc.CODES.get("<")){n<s&&(t+=e.substring(n,s)),s++;let r=s+1;for(;r<e.length&&e.codePointAt(r)!==tc.CODES.get(">")&&e.codePointAt(r)!==tc.CODES.get(" ");)r++;if(r===e.length||e.codePointAt(r)!==tc.CODES.get(">")){t+=e.substring(s-1,r+1),n=r+1;continue}const i=e.substring(s+1,r);Object.prototype.hasOwnProperty.call(this.namedGroups,i)?t+=this.group(i):t+=`$<${i}>`,n=r+1}}return n<r&&(t+=e.substring(n,r)),t}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,n=!1){let r="";for(this.reset();this.find()&&(r+=this.appendReplacement(e,n),t););return r+=this.appendTail(),r}}class mc{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}}class yc extends mc{constructor(e,t=0,n=e.length){super(),this.bytes=e,this.start=t,this.end=n}step(e){if((e+=this.start)>=this.end)return mc.EOF();let t=255&this.bytes[e++];return 128&t?192==(224&t)?(t&=31,e>=this.end?mc.EOF():(t=t<<6|63&this.bytes[e++],t<<3|2)):224==(240&t)?(t&=15,e+1>=this.end?mc.EOF():(t=t<<6|63&this.bytes[e++],t=t<<6|63&this.bytes[e++],t<<3|3)):(t&=7,e+2>=this.end?mc.EOF():(t=t<<6|63&this.bytes[e++],t=t<<6|63&this.bytes[e++],t=t<<6|63&this.bytes[e++],t<<3|4)):t<<3|1}index(e,t){t+=this.start;const n=this.indexOf(this.bytes,e.prefixUTF8,t);return n<0?n:n-t}context(e){let t=-1;if((e+=this.start)>this.start&&e<=this.end){let n=e-1;if(t=this.bytes[n--],t>=128){let r=e-4;for(r<this.start&&(r=this.start);n>=r&&128==(192&this.bytes[n]);)n--;n<this.start&&(n=this.start),t=this.step(n)>>3}}const n=e<this.end?this.step(e)>>3:-1;return sc.emptyOpContext(t,n)}indexOf(e,t,n=0){let r=t.length;if(0===r)return-1;let s=e.length;for(let i=n;i<=s-r;i++)for(let n=0;n<r&&e[i+n]===t[n];n++)if(n===r-1)return i;return-1}}class _c extends mc{constructor(e,t=0,n=e.length){super(),this.charSequence=e,this.start=t,this.end=n}step(e){if((e+=this.start)<this.end){const t=this.charSequence.codePointAt(e);return t<<3|sc.charCount(t)}return mc.EOF()}index(e,t){t+=this.start;const n=this.charSequence.indexOf(e.prefix,t);return n<0?n:n-t}context(e){const t=(e+=this.start)>0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,n=e<this.charSequence.length?this.charSequence.codePointAt(e):-1;return sc.emptyOpContext(t,n)}}class wc{static fromUTF8(e,t=0,n=e.length){return new yc(e,t,n)}static fromUTF16(e,t=0,n=e.length){return new _c(e,t,n)}}class vc{static Op=(()=>ic(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]))();static isPseudoOp(e){return e>=vc.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===tc.CODES.get("-")?"\\":""}static fromRegexp(e){const t=new vc(e.op);return t.flags=e.flags,t.subs=e.subs,t.runes=e.runes,t.cap=e.cap,t.min=e.min,t.max=e.max,t.name=e.name,t.namedGroups=e.namedGroups,t}constructor(e){this.op=e,this.flags=0,this.subs=vc.emptySubs(),this.runes=null,this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=vc.emptySubs(),this.runes=null,this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let e="";switch(this.op){case vc.Op.NO_MATCH:e+="[^\\x00-\\x{10FFFF}]";break;case vc.Op.EMPTY_MATCH:e+="(?:)";break;case vc.Op.STAR:case vc.Op.PLUS:case vc.Op.QUEST:case vc.Op.REPEAT:{const t=this.subs[0];switch(t.op>vc.Op.CAPTURE||t.op===vc.Op.LITERAL&&t.runes.length>1?e+=`(?:${t.appendTo()})`:e+=t.appendTo(),this.op){case vc.Op.STAR:e+="*";break;case vc.Op.PLUS:e+="+";break;case vc.Op.QUEST:e+="?";break;case vc.Op.REPEAT:e+=`{${this.min}`,this.min!==this.max&&(e+=",",this.max>=0&&(e+=this.max)),e+="}"}0!==(this.flags&ec.NON_GREEDY)&&(e+="?");break}case vc.Op.CONCAT:for(let t of this.subs)t.op===vc.Op.ALTERNATE?e+=`(?:${t.appendTo()})`:e+=t.appendTo();break;case vc.Op.ALTERNATE:{let t="";for(let n of this.subs)e+=t,t="|",e+=n.appendTo();break}case vc.Op.LITERAL:0!==(this.flags&ec.FOLD_CASE)&&(e+="(?i:");for(let t of this.runes)e+=sc.escapeRune(t);0!==(this.flags&ec.FOLD_CASE)&&(e+=")");break;case vc.Op.ANY_CHAR_NOT_NL:e+="(?-s:.)";break;case vc.Op.ANY_CHAR:e+="(?s:.)";break;case vc.Op.CAPTURE:null===this.name||0===this.name.length?e+="(":e+=`(?P<${this.name}>`,this.subs[0].op!==vc.Op.EMPTY_MATCH&&(e+=this.subs[0].appendTo()),e+=")";break;case vc.Op.BEGIN_TEXT:e+="\\A";break;case vc.Op.END_TEXT:0!==(this.flags&ec.WAS_DOLLAR)?e+="(?-m:$)":e+="\\z";break;case vc.Op.BEGIN_LINE:e+="^";break;case vc.Op.END_LINE:e+="$";break;case vc.Op.WORD_BOUNDARY:e+="\\b";break;case vc.Op.NO_WORD_BOUNDARY:e+="\\B";break;case vc.Op.CHAR_CLASS:if(this.runes.length%2!=0){e+="[invalid char class]";break}if(e+="[",0===this.runes.length)e+="^\\x00-\\x{10FFFF}";else if(0===this.runes[0]&&this.runes[this.runes.length-1]===rc.MAX_RUNE){e+="^";for(let t=1;t<this.runes.length-1;t+=2){const n=this.runes[t]+1,r=this.runes[t+1]-1;e+=vc.quoteIfHyphen(n),e+=sc.escapeRune(n),n!==r&&(e+="-",e+=vc.quoteIfHyphen(r),e+=sc.escapeRune(r))}}else for(let t=0;t<this.runes.length;t+=2){const n=this.runes[t],r=this.runes[t+1];e+=vc.quoteIfHyphen(n),e+=sc.escapeRune(n),n!==r&&(e+="-",e+=vc.quoteIfHyphen(r),e+=sc.escapeRune(r))}e+="]";break;default:e+=this.op}return e}maxCap(){let e=0;if(this.op===vc.Op.CAPTURE&&(e=this.cap),null!==this.subs)for(let t of this.subs){const n=t.maxCap();e<n&&(e=n)}return e}equals(e){if(!(null!==e&&e instanceof vc))return!1;if(this.op!==e.op)return!1;switch(this.op){case vc.Op.END_TEXT:if((this.flags&ec.WAS_DOLLAR)!==(e.flags&ec.WAS_DOLLAR))return!1;break;case vc.Op.LITERAL:case vc.Op.CHAR_CLASS:if(null===this.runes&&null===e.runes)break;if(null===this.runes||null===e.runes)return!1;if(this.runes.length!==e.runes.length)return!1;for(let t=0;t<this.runes.length;t++)if(this.runes[t]!==e.runes[t])return!1;break;case vc.Op.ALTERNATE:case vc.Op.CONCAT:if(this.subs.length!==e.subs.length)return!1;for(let t=0;t<this.subs.length;++t)if(!this.subs[t].equals(e.subs[t]))return!1;break;case vc.Op.STAR:case vc.Op.PLUS:case vc.Op.QUEST:if((this.flags&ec.NON_GREEDY)!==(e.flags&ec.NON_GREEDY)||!this.subs[0].equals(e.subs[0]))return!1;break;case vc.Op.REPEAT:if((this.flags&ec.NON_GREEDY)!==(e.flags&ec.NON_GREEDY)||this.min!==e.min||this.max!==e.max||!this.subs[0].equals(e.subs[0]))return!1;break;case vc.Op.CAPTURE:if(this.cap!==e.cap||(null===this.name?null!==e.name:this.name!==e.name)||!this.subs[0].equals(e.subs[0]))return!1}return!0}}class bc{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(e){return bc.RUNE<=e&&e<=bc.RUNE_ANY_NOT_NL}static escapeRunes(e){let t='"';for(let n of e)t+=sc.escapeRune(n);return t+='"',t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=null}matchRune(e){if(1===this.runes.length){const t=this.runes[0];return 0!==(this.arg&ec.FOLD_CASE)?rc.equalsIgnoreCase(t,e):e===t}for(let t=0;t<this.runes.length&&t<=8;t+=2){if(e<this.runes[t])return!1;if(e<=this.runes[t+1])return!0}let t=0,n=this.runes.length/2|0;for(;t<n;){const r=t+((n-t)/2|0);if(this.runes[2*r]<=e){if(e<=this.runes[2*r+1])return!0;t=r+1}else n=r}return!1}toString(){switch(this.op){case bc.ALT:return`alt -> ${this.out}, ${this.arg}`;case bc.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case bc.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case bc.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case bc.MATCH:return"match";case bc.FAIL:return"fail";case bc.NOP:return`nop -> ${this.out}`;case bc.RUNE:return null===this.runes?"rune <null>":["rune ",bc.escapeRunes(this.runes),0!==(this.arg&ec.FOLD_CASE)?"/i":""," -> ",this.out].join("");case bc.RUNE1:return`rune1 ${bc.escapeRunes(this.runes)} -> ${this.out}`;case bc.RUNE_ANY:return`any -> ${this.out}`;case bc.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}}class Ec{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new bc(e))}skipNop(e){let t=this.inst[e];for(;t.op===bc.NOP||t.op===bc.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e="",t=this.skipNop(this.start);if(!bc.isRuneOp(t.op)||1!==t.runes.length)return[t.op===bc.MATCH,e];for(;bc.isRuneOp(t.op)&&1===t.runes.length&&0===(t.arg&ec.FOLD_CASE);)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===bc.MATCH,e]}startCond(){let e=0,t=this.start;e:for(;;){const n=this.inst[t];switch(n.op){case bc.EMPTY_WIDTH:e|=n.arg;break;case bc.FAIL:return-1;case bc.CAPTURE:case bc.NOP:break;default:break e}t=n.out}return e}next(e){const t=this.inst[e>>1];return 1&e?t.arg:t.out}patch(e,t){for(;0!==e;){const n=this.inst[e>>1];1&e?(e=n.arg,n.arg=t):(e=n.out,n.out=t)}}append(e,t){if(0===e)return t;if(0===t)return e;let n=e;for(;;){const e=this.next(n);if(0===e)break;n=e}const r=this.inst[n>>1];return 1&n?r.arg=t:r.out=t,e}toString(){let e="";for(let t=0;t<this.inst.length;t++){const n=e.length;e+=t,t===this.start&&(e+="*"),e+=" ".substring(e.length-n),e+=this.inst[t],e+="\n"}return e}}class Tc{constructor(e=0,t=0,n=!1){this.i=e,this.out=t,this.nullable=n}}class Sc{static ANY_RUNE_NOT_NL(){return[0,tc.CODES.get("\n")-1,tc.CODES.get("\n")+1,rc.MAX_RUNE]}static ANY_RUNE(){return[0,rc.MAX_RUNE]}static compileRegexp(e){const t=new Sc,n=t.compile(e);return t.prog.patch(n.out,t.newInst(bc.MATCH).i),t.prog.start=n.i,t.prog}constructor(){this.prog=new Ec,this.newInst(bc.FAIL)}newInst(e){return this.prog.addInst(e),new Tc(this.prog.numInst()-1,0,!0)}nop(){const e=this.newInst(bc.NOP);return e.out=e.i<<1,e}fail(){return new Tc}cap(e){const t=this.newInst(bc.CAPTURE);return t.out=t.i<<1,this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return 0===e.i||0===t.i?this.fail():(this.prog.patch(e.out,t.i),new Tc(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(0===e.i)return t;if(0===t.i)return e;const n=this.newInst(bc.ALT),r=this.prog.getInst(n.i);return r.out=e.i,r.arg=t.i,n.out=this.prog.append(e.out,t.out),n.nullable=e.nullable||t.nullable,n}loop(e,t){const n=this.newInst(bc.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),this.prog.patch(e.out,n.i),n}quest(e,t){const n=this.newInst(bc.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),n.out=this.prog.append(n.out,e.out),n}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new Tc(e.i,this.loop(e,t).out,e.nullable)}empty(e){const t=this.newInst(bc.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=t.i<<1,t}rune(e,t){const n=this.newInst(bc.RUNE);n.nullable=!1;const r=this.prog.getInst(n.i);return r.runes=e,t&=ec.FOLD_CASE,1===e.length&&rc.simpleFold(e[0])!==e[0]||(t&=-2),r.arg=t,n.out=n.i<<1,0===(t&ec.FOLD_CASE)&&1===e.length||2===e.length&&e[0]===e[1]?r.op=bc.RUNE1:2===e.length&&0===e[0]&&e[1]===rc.MAX_RUNE?r.op=bc.RUNE_ANY:4===e.length&&0===e[0]&&e[1]===tc.CODES.get("\n")-1&&e[2]===tc.CODES.get("\n")+1&&e[3]===rc.MAX_RUNE&&(r.op=bc.RUNE_ANY_NOT_NL),n}compile(e){switch(e.op){case vc.Op.NO_MATCH:return this.fail();case vc.Op.EMPTY_MATCH:return this.nop();case vc.Op.LITERAL:if(0===e.runes.length)return this.nop();{let t=null;for(let n of e.runes){const r=this.rune([n],e.flags);t=null===t?r:this.cat(t,r)}return t}case vc.Op.CHAR_CLASS:return this.rune(e.runes,e.flags);case vc.Op.ANY_CHAR_NOT_NL:return this.rune(Sc.ANY_RUNE_NOT_NL(),0);case vc.Op.ANY_CHAR:return this.rune(Sc.ANY_RUNE(),0);case vc.Op.BEGIN_LINE:return this.empty(sc.EMPTY_BEGIN_LINE);case vc.Op.END_LINE:return this.empty(sc.EMPTY_END_LINE);case vc.Op.BEGIN_TEXT:return this.empty(sc.EMPTY_BEGIN_TEXT);case vc.Op.END_TEXT:return this.empty(sc.EMPTY_END_TEXT);case vc.Op.WORD_BOUNDARY:return this.empty(sc.EMPTY_WORD_BOUNDARY);case vc.Op.NO_WORD_BOUNDARY:return this.empty(sc.EMPTY_NO_WORD_BOUNDARY);case vc.Op.CAPTURE:{const t=this.cap(e.cap<<1),n=this.compile(e.subs[0]),r=this.cap(e.cap<<1|1);return this.cat(this.cat(t,n),r)}case vc.Op.STAR:return this.star(this.compile(e.subs[0]),0!==(e.flags&ec.NON_GREEDY));case vc.Op.PLUS:return this.plus(this.compile(e.subs[0]),0!==(e.flags&ec.NON_GREEDY));case vc.Op.QUEST:return this.quest(this.compile(e.subs[0]),0!==(e.flags&ec.NON_GREEDY));case vc.Op.CONCAT:if(0===e.subs.length)return this.nop();{let t=null;for(let n of e.subs){const e=this.compile(n);t=null===t?e:this.cat(t,e)}return t}case vc.Op.ALTERNATE:if(0===e.subs.length)return this.nop();{let t=null;for(let n of e.subs){const e=this.compile(n);t=null===t?e:this.alt(t,e)}return t}default:throw new dc("regexp: unhandled case in compile")}}}class Ac{static simplify(e){if(null===e)return null;switch(e.op){case vc.Op.CAPTURE:case vc.Op.CONCAT:case vc.Op.ALTERNATE:{let t=e;for(let n=0;n<e.subs.length;n++){const r=e.subs[n],s=Ac.simplify(r);t===e&&s!==r&&(t=vc.fromRegexp(e),t.runes=null,t.subs=e.subs.slice(0,e.subs.length)),t!==e&&(t.subs[n]=s)}return t}case vc.Op.STAR:case vc.Op.PLUS:case vc.Op.QUEST:{const t=Ac.simplify(e.subs[0]);return Ac.simplify1(e.op,e.flags,t,e)}case vc.Op.REPEAT:{if(0===e.min&&0===e.max)return new vc(vc.Op.EMPTY_MATCH);const t=Ac.simplify(e.subs[0]);if(-1===e.max){if(0===e.min)return Ac.simplify1(vc.Op.STAR,e.flags,t,null);if(1===e.min)return Ac.simplify1(vc.Op.PLUS,e.flags,t,null);const n=new vc(vc.Op.CONCAT),r=[];for(let n=0;n<e.min-1;n++)r.push(t);return r.push(Ac.simplify1(vc.Op.PLUS,e.flags,t,null)),n.subs=r.slice(0),n}if(1===e.min&&1===e.max)return t;let n=null;if(e.min>0){n=[];for(let r=0;r<e.min;r++)n.push(t)}if(e.max>e.min){let r=Ac.simplify1(vc.Op.QUEST,e.flags,t,null);for(let n=e.min+1;n<e.max;n++){const n=new vc(vc.Op.CONCAT);n.subs=[t,r],r=Ac.simplify1(vc.Op.QUEST,e.flags,n,null)}if(null===n)return r;n.push(r)}if(null!==n){const e=new vc(vc.Op.CONCAT);return e.subs=n.slice(0),e}return new vc(vc.Op.NO_MATCH)}}return e}static simplify1(e,t,n,r){return n.op===vc.Op.EMPTY_MATCH||e===n.op&&(t&ec.NON_GREEDY)===(n.flags&ec.NON_GREEDY)?n:(null!==r&&r.op===e&&(r.flags&ec.NON_GREEDY)===(t&ec.NON_GREEDY)&&n===r.subs[0]||((r=new vc(e)).flags=t,r.subs=[n]),r)}}class Ic{constructor(e,t){this.sign=e,this.cls=t}}const Cc=[48,57],Oc=[9,10,12,13,32,32],Rc=[48,57,65,90,95,95,97,122],kc=new Map([["\\d",new Ic(1,Cc)],["\\D",new Ic(-1,Cc)],["\\s",new Ic(1,Oc)],["\\S",new Ic(-1,Oc)],["\\w",new Ic(1,Rc)],["\\W",new Ic(-1,Rc)]]),Nc=[48,57,65,90,97,122],xc=[65,90,97,122],Pc=[0,127],Dc=[9,9,32,32],Lc=[0,31,127,127],Uc=[48,57],Mc=[33,126],Vc=[97,122],Fc=[32,126],$c=[33,47,58,64,91,96,123,126],jc=[9,13,32,32],Bc=[65,90],Hc=[48,57,65,90,95,95,97,122],zc=[48,57,65,70,97,102],qc=new Map([["[:alnum:]",new Ic(1,Nc)],["[:^alnum:]",new Ic(-1,Nc)],["[:alpha:]",new Ic(1,xc)],["[:^alpha:]",new Ic(-1,xc)],["[:ascii:]",new Ic(1,Pc)],["[:^ascii:]",new Ic(-1,Pc)],["[:blank:]",new Ic(1,Dc)],["[:^blank:]",new Ic(-1,Dc)],["[:cntrl:]",new Ic(1,Lc)],["[:^cntrl:]",new Ic(-1,Lc)],["[:digit:]",new Ic(1,Uc)],["[:^digit:]",new Ic(-1,Uc)],["[:graph:]",new Ic(1,Mc)],["[:^graph:]",new Ic(-1,Mc)],["[:lower:]",new Ic(1,Vc)],["[:^lower:]",new Ic(-1,Vc)],["[:print:]",new Ic(1,Fc)],["[:^print:]",new Ic(-1,Fc)],["[:punct:]",new Ic(1,$c)],["[:^punct:]",new Ic(-1,$c)],["[:space:]",new Ic(1,jc)],["[:^space:]",new Ic(-1,jc)],["[:upper:]",new Ic(1,Bc)],["[:^upper:]",new Ic(-1,Bc)],["[:word:]",new Ic(1,Hc)],["[:^word:]",new Ic(-1,Hc)],["[:xdigit:]",new Ic(1,zc)],["[:^xdigit:]",new Ic(-1,zc)]]);class Gc{static charClassToString(e,t){let n="[";for(let r=0;r<t;r+=2){r>0&&(n+=" ");const t=e[r],s=e[r+1];n+=t===s?`0x${t.toString(16)}`:`0x${t.toString(16)}-0x${s.toString(16)}`}return n+="]",n}static cmp(e,t,n,r){const s=e[t]-n;return 0!==s?s:r-e[t+1]}static qsortIntPair(e,t,n){const r=(t+n)/2&-2,s=e[r],i=e[r+1];let a=t,o=n;for(;a<=o;){for(;a<n&&Gc.cmp(e,a,s,i)<0;)a+=2;for(;o>t&&Gc.cmp(e,o,s,i)>0;)o-=2;if(a<=o){if(a!==o){let t=e[a];e[a]=e[o],e[o]=t,t=e[a+1],e[a+1]=e[o+1],e[o+1]=t}a+=2,o-=2}}t<o&&Gc.qsortIntPair(e,t,o),a<n&&Gc.qsortIntPair(e,a,n)}constructor(e=sc.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;Gc.qsortIntPair(this.r,0,this.len-2);let e=2;for(let t=2;t<this.len;t+=2){const n=this.r[t],r=this.r[t+1];if(n<=this.r[e-1]+1){r>this.r[e-1]&&(this.r[e-1]=r);continue}this.r[e]=n,this.r[e+1]=r,e+=2}return this.len=e,this}appendLiteral(e,t){return 0!==(t&ec.FOLD_CASE)?this.appendFoldedRange(e,e):this.appendRange(e,e)}appendRange(e,t){if(this.len>0)for(let n=2;n<=4;n+=2)if(this.len>=n){const r=this.r[this.len-n],s=this.r[this.len-n+1];if(e<=s+1&&r<=t+1)return e<r&&(this.r[this.len-n]=e),t>s&&(this.r[this.len-n+1]=t),this}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=rc.MIN_FOLD&&t>=rc.MAX_FOLD)return this.appendRange(e,t);if(t<rc.MIN_FOLD||e>rc.MAX_FOLD)return this.appendRange(e,t);e<rc.MIN_FOLD&&(this.appendRange(e,rc.MIN_FOLD-1),e=rc.MIN_FOLD),t>rc.MAX_FOLD&&(this.appendRange(rc.MAX_FOLD+1,t),t=rc.MAX_FOLD);for(let n=e;n<=t;n++){this.appendRange(n,n);for(let e=rc.simpleFold(n);e!==n;e=rc.simpleFold(e))this.appendRange(e,e)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let n=0;n<e.length;n+=2){const r=e[n],s=e[n+1];t<=r-1&&this.appendRange(t,r-1),t=s+1}return t<=rc.MAX_RUNE&&this.appendRange(t,rc.MAX_RUNE),this}appendTable(e){for(let t of e){const e=t[0],n=t[1],r=t[2];if(1!==r)for(let t=e;t<=n;t+=r)this.appendRange(t,t);else this.appendRange(e,n)}return this}appendNegatedTable(e){let t=0;for(let n of e){const e=n[0],r=n[1],s=n[2];if(1!==s)for(let n=e;n<=r;n+=s)t<=n-1&&this.appendRange(t,n-1),t=n+1;else t<=e-1&&this.appendRange(t,e-1),t=r+1}return t<=rc.MAX_RUNE&&this.appendRange(t,rc.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let n=0;n<this.len;n+=2){const r=this.r[n],s=this.r[n+1];e<=r-1&&(this.r[t]=e,this.r[t+1]=r-1,t+=2),e=s+1}return this.len=t,e<=rc.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=rc.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(e,t){let n=e.cls;return t&&(n=(new Gc).appendFoldedClass(n).cleanClass().toArray()),this.appendClassWithSign(n,e.sign)}toString(){return Gc.charClassToString(this.r,this.len)}}class Kc{static of(e,t){return new Kc(e,t)}constructor(e,t){this.first=e,this.second=t}}class Wc{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){const e=this.str.codePointAt(this.position);return this.position+=sc.charCount(e),e}lookingAt(e){return this.rest().startsWith(e)}rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}}class Yc{static ERR_INTERNAL_ERROR="regexp/syntax: internal error";static ERR_INVALID_CHAR_RANGE="invalid character class range";static ERR_INVALID_ESCAPE="invalid escape sequence";static ERR_INVALID_NAMED_CAPTURE="invalid named capture";static ERR_INVALID_PERL_OP="invalid or unsupported Perl syntax";static ERR_INVALID_REPEAT_OP="invalid nested repetition operator";static ERR_INVALID_REPEAT_SIZE="invalid repeat count";static ERR_MISSING_BRACKET="missing closing ]";static ERR_MISSING_PAREN="missing closing )";static ERR_MISSING_REPEAT_ARGUMENT="missing argument to repetition operator";static ERR_TRAILING_BACKSLASH="trailing backslash at end of expression";static ERR_DUPLICATE_NAMED_CAPTURE="duplicate capture group name";static ANY_TABLE(){return[[0,rc.MAX_RUNE,1]]}static unicodeTable(e){return"Any"===e?Kc.of(Yc.ANY_TABLE(),Yc.ANY_TABLE()):nc.CATEGORIES.has(e)?Kc.of(nc.CATEGORIES.get(e),nc.FOLD_CATEGORIES.get(e)):nc.SCRIPTS.has(e)?Kc.of(nc.SCRIPTS.get(e),nc.FOLD_SCRIPT.get(e)):null}static minFoldRune(e){if(e<rc.MIN_FOLD||e>rc.MAX_FOLD)return e;let t=e;const n=e;for(e=rc.simpleFold(e);e!==n;e=rc.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===vc.Op.EMPTY_MATCH)return null;if(e.op===vc.Op.CONCAT&&e.subs.length>0){const t=e.subs[0];return t.op===vc.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){const n=new vc(vc.Op.LITERAL);return n.flags=t,n.runes=sc.stringToRunes(e),n}static parse(e,t){return new Yc(e,t).parseInternal()}static parseRepeat(e){const t=e.pos();if(!e.more()||!e.lookingAt("{"))return-1;e.skip(1);const n=Yc.parseInt(e);if(-1===n)return-1;if(!e.more())return-1;let r;if(e.lookingAt(",")){if(e.skip(1),!e.more())return-1;if(e.lookingAt("}"))r=-1;else if(-1===(r=Yc.parseInt(e)))return-1}else r=n;if(!e.more()||!e.lookingAt("}"))return-1;if(e.skip(1),n<0||n>1e3||-2===r||r>1e3||r>=0&&n>r)throw new hc(Yc.ERR_INVALID_REPEAT_SIZE,e.from(t));return n<<16|r&rc.MAX_BMP}static isValidCaptureName(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++){const n=e.codePointAt(t);if(n!==tc.CODES.get("_")&&!sc.isalnum(n))return!1}return!0}static parseInt(e){const t=e.pos();for(;e.more()&&e.peek()>=tc.CODES.get("0")&&e.peek()<=tc.CODES.get("9");)e.skip(1);const n=e.from(t);return 0===n.length||n.length>1&&n.codePointAt(0)===tc.CODES.get("0")?-1:n.length>8?-2:parseFloat(n,10)}static isCharClass(e){return e.op===vc.Op.LITERAL&&1===e.runes.length||e.op===vc.Op.CHAR_CLASS||e.op===vc.Op.ANY_CHAR_NOT_NL||e.op===vc.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case vc.Op.LITERAL:return 1===e.runes.length&&e.runes[0]===t;case vc.Op.CHAR_CLASS:for(let n=0;n<e.runes.length;n+=2)if(e.runes[n]<=t&&t<=e.runes[n+1])return!0;return!1;case vc.Op.ANY_CHAR_NOT_NL:return t!==tc.CODES.get("\n");case vc.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(e,t){switch(e.op){case vc.Op.ANY_CHAR:break;case vc.Op.ANY_CHAR_NOT_NL:Yc.matchRune(t,tc.CODES.get("\n"))&&(e.op=vc.Op.ANY_CHAR);break;case vc.Op.CHAR_CLASS:t.op===vc.Op.LITERAL?e.runes=new Gc(e.runes).appendLiteral(t.runes[0],t.flags).toArray():e.runes=new Gc(e.runes).appendClass(t.runes).toArray();break;case vc.Op.LITERAL:if(t.runes[0]===e.runes[0]&&t.flags===e.flags)break;e.op=vc.Op.CHAR_CLASS,e.runes=(new Gc).appendLiteral(e.runes[0],e.flags).appendLiteral(t.runes[0],t.flags).toArray()}}static parseEscape(e){const t=e.pos();if(e.skip(1),!e.more())throw new hc(Yc.ERR_TRAILING_BACKSLASH);let n=e.pop();e:switch(n){case tc.CODES.get("1"):case tc.CODES.get("2"):case tc.CODES.get("3"):case tc.CODES.get("4"):case tc.CODES.get("5"):case tc.CODES.get("6"):case tc.CODES.get("7"):if(!e.more()||e.peek()<tc.CODES.get("0")||e.peek()>tc.CODES.get("7"))break;case tc.CODES.get("0"):{let t=n-tc.CODES.get("0");for(let n=1;n<3&&!(!e.more()||e.peek()<tc.CODES.get("0")||e.peek()>tc.CODES.get("7"));n++)t=8*t+e.peek()-tc.CODES.get("0"),e.skip(1);return t}case tc.CODES.get("x"):{if(!e.more())break;if(n=e.pop(),n===tc.CODES.get("{")){let t=0,r=0;for(;;){if(!e.more())break e;if(n=e.pop(),n===tc.CODES.get("}"))break;const s=sc.unhex(n);if(s<0)break e;if(r=16*r+s,r>rc.MAX_RUNE)break e;t++}if(0===t)break e;return r}const t=sc.unhex(n);if(!e.more())break;n=e.pop();const r=sc.unhex(n);if(t<0||r<0)break;return 16*t+r}case tc.CODES.get("a"):return tc.CODES.get("");case tc.CODES.get("f"):return tc.CODES.get("\f");case tc.CODES.get("n"):return tc.CODES.get("\n");case tc.CODES.get("r"):return tc.CODES.get("\r");case tc.CODES.get("t"):return tc.CODES.get("\t");case tc.CODES.get("v"):return tc.CODES.get("\v");default:if(!sc.isalnum(n))return n}throw new hc(Yc.ERR_INVALID_ESCAPE,e.from(t))}static parseClassChar(e,t){if(!e.more())throw new hc(Yc.ERR_MISSING_BRACKET,e.from(t));return e.lookingAt("\\")?Yc.parseEscape(e):e.pop()}static concatRunes(e,t){return[...e,...t]}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null}newRegexp(e){let t=this.free;return null!==t&&null!==t.subs&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):t=new vc(e),t}reuse(e){null!==e.subs&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}pop(){return this.stack.pop()}popToPseudo(){const e=this.stack.length;let t=e;for(;t>0&&!vc.isPseudoOp(this.stack[t-1].op);)t--;const n=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),n}push(e){if(e.op===vc.Op.CHAR_CLASS&&2===e.runes.length&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],-2&this.flags))return null;e.op=vc.Op.LITERAL,e.runes=[e.runes[0]],e.flags=-2&this.flags}else if(e.op===vc.Op.CHAR_CLASS&&4===e.runes.length&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&rc.simpleFold(e.runes[0])===e.runes[2]&&rc.simpleFold(e.runes[2])===e.runes[0]||e.op===vc.Op.CHAR_CLASS&&2===e.runes.length&&e.runes[0]+1===e.runes[1]&&rc.simpleFold(e.runes[0])===e.runes[1]&&rc.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|ec.FOLD_CASE))return null;e.op=vc.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|ec.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),e}maybeConcat(e,t){const n=this.stack.length;if(n<2)return!1;const r=this.stack[n-1],s=this.stack[n-2];return r.op===vc.Op.LITERAL&&s.op===vc.Op.LITERAL&&(r.flags&ec.FOLD_CASE)===(s.flags&ec.FOLD_CASE)&&(s.runes=Yc.concatRunes(s.runes,r.runes),e>=0?(r.runes=[e],r.flags=t,!0):(this.pop(),this.reuse(r),!1))}newLiteral(e,t){const n=this.newRegexp(vc.Op.LITERAL);return n.flags=t,0!==(t&ec.FOLD_CASE)&&(e=Yc.minFoldRune(e)),n.runes=[e],n}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){const t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(e,t,n,r,s,i){let a=this.flags;if(0!==(a&ec.PERL_X)&&(s.more()&&s.lookingAt("?")&&(s.skip(1),a^=ec.NON_GREEDY),-1!==i))throw new hc(Yc.ERR_INVALID_REPEAT_OP,s.from(i));const o=this.stack.length;if(0===o)throw new hc(Yc.ERR_MISSING_REPEAT_ARGUMENT,s.from(r));const c=this.stack[o-1];if(vc.isPseudoOp(c.op))throw new hc(Yc.ERR_MISSING_REPEAT_ARGUMENT,s.from(r));const u=this.newRegexp(e);u.min=t,u.max=n,u.flags=a,u.subs=[c],this.stack[o-1]=u}concat(){this.maybeConcat(-1,0);const e=this.popToPseudo();return 0===e.length?this.push(this.newRegexp(vc.Op.EMPTY_MATCH)):this.push(this.collapse(e,vc.Op.CONCAT))}alternate(){const e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),0===e.length?this.push(this.newRegexp(vc.Op.NO_MATCH)):this.push(this.collapse(e,vc.Op.ALTERNATE))}cleanAlt(e){e.op===vc.Op.CHAR_CLASS&&(e.runes=new Gc(e.runes).cleanClass().toArray(),2===e.runes.length&&0===e.runes[0]&&e.runes[1]===rc.MAX_RUNE?(e.runes=null,e.op=vc.Op.ANY_CHAR):4===e.runes.length&&0===e.runes[0]&&e.runes[1]===tc.CODES.get("\n")-1&&e.runes[2]===tc.CODES.get("\n")+1&&e.runes[3]===rc.MAX_RUNE&&(e.runes=null,e.op=vc.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(1===e.length)return e[0];let n=0;for(let r of e)n+=r.op===t?r.subs.length:1;let r=new Array(n).fill(null),s=0;for(let n of e)n.op===t?(r.splice(s,n.subs.length,...n.subs),s+=n.subs.length,this.reuse(n)):r[s++]=n;let i=this.newRegexp(t);if(i.subs=r,t===vc.Op.ALTERNATE&&(i.subs=this.factor(i.subs),1===i.subs.length)){const e=i;i=i.subs[0],this.reuse(e)}return i}factor(e){if(e.length<2)return e;let t=0,n=e.length,r=0,s=null,i=0,a=0,o=0;for(let c=0;c<=n;c++){let u=null,l=0,h=0;if(c<n){let n=e[t+c];if(n.op===vc.Op.CONCAT&&n.subs.length>0&&(n=n.subs[0]),n.op===vc.Op.LITERAL&&(u=n.runes,l=n.runes.length,h=n.flags&ec.FOLD_CASE),h===a){let e=0;for(;e<i&&e<l&&s[e]===u[e];)e++;if(e>0){i=e;continue}}}if(c===o);else if(c===o+1)e[r++]=e[t+o];else{const n=this.newRegexp(vc.Op.LITERAL);n.flags=a,n.runes=s.slice(0,i);for(let n=o;n<c;n++)e[t+n]=this.removeLeadingString(e[t+n],i);const u=this.collapse(e.slice(t+o,t+c),vc.Op.ALTERNATE),l=this.newRegexp(vc.Op.CONCAT);l.subs=[n,u],e[r++]=l}o=c,s=u,i=l,a=h}n=r,t=0,o=0,r=0;let c=null;for(let s=0;s<=n;s++){let i=null;if(!(s<n&&(i=Yc.leadingRegexp(e[t+s]),null!==c&&c.equals(i)&&(Yc.isCharClass(c)||c.op===vc.Op.REPEAT&&c.min===c.max&&Yc.isCharClass(c.subs[0]))))){if(s===o);else if(s===o+1)e[r++]=e[t+o];else{const n=c;for(let n=o;n<s;n++){const r=n!==o;e[t+n]=this.removeLeadingRegexp(e[t+n],r)}const i=this.collapse(e.slice(t+o,t+s),vc.Op.ALTERNATE),a=this.newRegexp(vc.Op.CONCAT);a.subs=[n,i],e[r++]=a}o=s,c=i}}n=r,t=0,o=0,r=0;for(let s=0;s<=n;s++)if(!(s<n&&Yc.isCharClass(e[t+s]))){if(s===o);else if(s===o+1)e[r++]=e[t+o];else{let n=o;for(let r=o+1;r<s;r++){const s=e[t+n],i=e[t+r];(s.op<i.op||s.op===i.op&&(null!==s.runes?s.runes.length:0)<(null!==i.runes?i.runes.length:0))&&(n=r)}const i=e[t+o];e[t+o]=e[t+n],e[t+n]=i;for(let n=o+1;n<s;n++)Yc.mergeCharClass(e[t+o],e[t+n]),this.reuse(e[t+n]);this.cleanAlt(e[t+o]),e[r++]=e[t+o]}s<n&&(e[r++]=e[t+s]),o=s+1}n=r,t=0,o=0,r=0;for(let s=0;s<n;++s)s+1<n&&e[t+s].op===vc.Op.EMPTY_MATCH&&e[t+s+1].op===vc.Op.EMPTY_MATCH||(e[r++]=e[t+s]);return n=r,t=0,e.slice(t,n)}removeLeadingString(e,t){if(e.op===vc.Op.CONCAT&&e.subs.length>0){const n=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=n,n.op===vc.Op.EMPTY_MATCH)switch(this.reuse(n),e.subs.length){case 0:case 1:e.op=vc.Op.EMPTY_MATCH,e.subs=null;break;case 2:{const t=e;e=e.subs[1],this.reuse(t);break}default:e.subs=e.subs.slice(1,e.subs.length)}return e}return e.op===vc.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),0===e.runes.length&&(e.op=vc.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===vc.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:e.op=vc.Op.EMPTY_MATCH,e.subs=vc.emptySubs();break;case 1:{const t=e;e=e.subs[0],this.reuse(t);break}}return e}return t&&this.reuse(e),this.newRegexp(vc.Op.EMPTY_MATCH)}parseInternal(){if(0!==(this.flags&ec.LITERAL))return Yc.literalRegexp(this.wholeRegexp,this.flags);let e=-1,t=-1,n=-1;const r=new Wc(this.wholeRegexp);for(;r.more();){let s=-1;e:switch(r.peek()){case tc.CODES.get("("):if(0!==(this.flags&ec.PERL_X)&&r.lookingAt("(?")){this.parsePerlFlags(r);break}this.op(vc.Op.LEFT_PAREN).cap=++this.numCap,r.skip(1);break;case tc.CODES.get("|"):this.parseVerticalBar(),r.skip(1);break;case tc.CODES.get(")"):this.parseRightParen(),r.skip(1);break;case tc.CODES.get("^"):0!==(this.flags&ec.ONE_LINE)?this.op(vc.Op.BEGIN_TEXT):this.op(vc.Op.BEGIN_LINE),r.skip(1);break;case tc.CODES.get("$"):0!==(this.flags&ec.ONE_LINE)?this.op(vc.Op.END_TEXT).flags|=ec.WAS_DOLLAR:this.op(vc.Op.END_LINE),r.skip(1);break;case tc.CODES.get("."):0!==(this.flags&ec.DOT_NL)?this.op(vc.Op.ANY_CHAR):this.op(vc.Op.ANY_CHAR_NOT_NL),r.skip(1);break;case tc.CODES.get("["):this.parseClass(r);break;case tc.CODES.get("*"):case tc.CODES.get("+"):case tc.CODES.get("?"):{s=r.pos();let i=null;switch(r.pop()){case tc.CODES.get("*"):i=vc.Op.STAR;break;case tc.CODES.get("+"):i=vc.Op.PLUS;break;case tc.CODES.get("?"):i=vc.Op.QUEST}this.repeat(i,t,n,s,r,e);break}case tc.CODES.get("{"):{s=r.pos();const i=Yc.parseRepeat(r);if(i<0){r.rewindTo(s),this.literal(r.pop());break}t=i>>16,n=(i&rc.MAX_BMP)<<16>>16,this.repeat(vc.Op.REPEAT,t,n,s,r,e);break}case tc.CODES.get("\\"):{const e=r.pos();if(r.skip(1),0!==(this.flags&ec.PERL_X)&&r.more()){switch(r.pop()){case tc.CODES.get("A"):this.op(vc.Op.BEGIN_TEXT);break e;case tc.CODES.get("b"):this.op(vc.Op.WORD_BOUNDARY);break e;case tc.CODES.get("B"):this.op(vc.Op.NO_WORD_BOUNDARY);break e;case tc.CODES.get("C"):throw new hc(Yc.ERR_INVALID_ESCAPE,"\\C");case tc.CODES.get("Q"):{let e=r.rest();const t=e.indexOf("\\E");t>=0&&(e=e.substring(0,t)),r.skipString(e),r.skipString("\\E");let n=0;for(;n<e.length;){const t=e.codePointAt(n);this.literal(t),n+=sc.charCount(t)}break e}case tc.CODES.get("z"):this.op(vc.Op.END_TEXT);break e;default:r.rewindTo(e)}}const t=this.newRegexp(vc.Op.CHAR_CLASS);if(t.flags=this.flags,r.lookingAt("\\p")||r.lookingAt("\\P")){const e=new Gc;if(this.parseUnicodeClass(r,e)){t.runes=e.toArray(),this.push(t);break e}}const n=new Gc;if(this.parsePerlClassEscape(r,n)){t.runes=n.toArray(),this.push(t);break e}r.rewindTo(e),this.reuse(t),this.literal(Yc.parseEscape(r));break}default:this.literal(r.pop())}e=s}this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate();if(1!==this.stack.length)throw new hc(Yc.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(e){const t=e.pos(),n=e.rest();if(n.startsWith("(?P<")||n.startsWith("(?<")){const t="P"===n.charAt(2)?4:3,r=n.indexOf(">");if(r<0)throw new hc(Yc.ERR_INVALID_NAMED_CAPTURE,n);const s=n.substring(t,r);if(e.skipString(s),e.skip(t+1),!Yc.isValidCaptureName(s))throw new hc(Yc.ERR_INVALID_NAMED_CAPTURE,n.substring(0,r+1));const i=this.op(vc.Op.LEFT_PAREN);if(i.cap=++this.numCap,this.namedGroups[s])throw new hc(Yc.ERR_DUPLICATE_NAMED_CAPTURE,s);return this.namedGroups[s]=this.numCap,void(i.name=s)}e.skip(2);let r=this.flags,s=1,i=!1;e:for(;e.more();){const t=e.pop();switch(t){case tc.CODES.get("i"):r|=ec.FOLD_CASE,i=!0;break;case tc.CODES.get("m"):r&=-17,i=!0;break;case tc.CODES.get("s"):r|=ec.DOT_NL,i=!0;break;case tc.CODES.get("U"):r|=ec.NON_GREEDY,i=!0;break;case tc.CODES.get("-"):if(s<0)break e;s=-1,r=~r,i=!1;break;case tc.CODES.get(":"):case tc.CODES.get(")"):if(s<0){if(!i)break e;r=~r}return t===tc.CODES.get(":")&&this.op(vc.Op.LEFT_PAREN),void(this.flags=r);default:break e}}throw new hc(Yc.ERR_INVALID_PERL_OP,e.from(t))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(vc.Op.VERTICAL_BAR)}swapVerticalBar(){const e=this.stack.length;if(e>=3&&this.stack[e-2].op===vc.Op.VERTICAL_BAR&&Yc.isCharClass(this.stack[e-1])&&Yc.isCharClass(this.stack[e-3])){let t=this.stack[e-1],n=this.stack[e-3];if(t.op>n.op){const r=n;n=t,t=r,this.stack[e-3]=n}return Yc.mergeCharClass(n,t),this.reuse(t),this.pop(),!0}if(e>=2){const t=this.stack[e-1],n=this.stack[e-2];if(n.op===vc.Op.VERTICAL_BAR)return e>=3&&this.cleanAlt(this.stack[e-3]),this.stack[e-2]=t,this.stack[e-1]=n,!0}return!1}parseRightParen(){this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate();if(this.stack.length<2)throw new hc(Yc.ERR_INTERNAL_ERROR,"stack underflow");const e=this.pop(),t=this.pop();if(t.op!==vc.Op.LEFT_PAREN)throw new hc(Yc.ERR_MISSING_PAREN,this.wholeRegexp);this.flags=t.flags,0===t.cap?this.push(e):(t.op=vc.Op.CAPTURE,t.subs=[e],this.push(t))}parsePerlClassEscape(e,t){const n=e.pos();if(0===(this.flags&ec.PERL_X)||!e.more()||e.pop()!==tc.CODES.get("\\")||!e.more())return!1;e.pop();const r=e.from(n),s=kc.has(r)?kc.get(r):null;return null!==s&&(t.appendGroup(s,0!==(this.flags&ec.FOLD_CASE)),!0)}parseNamedClass(e,t){const n=e.rest(),r=n.indexOf(":]");if(r<0)return!1;const s=n.substring(0,r+2);e.skipString(s);const i=qc.has(s)?qc.get(s):null;if(null===i)throw new hc(Yc.ERR_INVALID_CHAR_RANGE,s);return t.appendGroup(i,0!==(this.flags&ec.FOLD_CASE)),!0}parseUnicodeClass(e,t){const n=e.pos();if(0===(this.flags&ec.UNICODE_GROUPS)||!e.lookingAt("\\p")&&!e.lookingAt("\\P"))return!1;e.skip(1);let r,s=1,i=e.pop();if(i===tc.CODES.get("P")&&(s=-1),!e.more())throw e.rewindTo(n),new hc(Yc.ERR_INVALID_CHAR_RANGE,e.rest());if(i=e.pop(),i!==tc.CODES.get("{"))r=sc.runeToString(i);else{const t=e.rest(),s=t.indexOf("}");if(s<0)throw e.rewindTo(n),new hc(Yc.ERR_INVALID_CHAR_RANGE,e.rest());r=t.substring(0,s),e.skipString(r),e.skip(1)}0!==r.length&&r.codePointAt(0)===tc.CODES.get("^")&&(s=0-s,r=r.substring(1));const a=Yc.unicodeTable(r);if(null===a)throw new hc(Yc.ERR_INVALID_CHAR_RANGE,e.from(n));const o=a.first,c=a.second;if(0===(this.flags&ec.FOLD_CASE)||null===c)t.appendTableWithSign(o,s);else{const e=(new Gc).appendTable(o).appendTable(c).cleanClass().toArray();t.appendClassWithSign(e,s)}return!0}parseClass(e){const t=e.pos();e.skip(1);const n=this.newRegexp(vc.Op.CHAR_CLASS);n.flags=this.flags;const r=new Gc;let s=1;e.more()&&e.lookingAt("^")&&(s=-1,e.skip(1),0===(this.flags&ec.CLASS_NL)&&r.appendRange(tc.CODES.get("\n"),tc.CODES.get("\n")));let i=!0;for(;!e.more()||e.peek()!==tc.CODES.get("]")||i;){if(e.more()&&e.lookingAt("-")&&0===(this.flags&ec.PERL_X)&&!i){const n=e.rest();if("-"===n||!n.startsWith("-]"))throw e.rewindTo(t),new hc(Yc.ERR_INVALID_CHAR_RANGE,e.rest())}i=!1;const n=e.pos();if(e.lookingAt("[:")){if(this.parseNamedClass(e,r))continue;e.rewindTo(n)}if(this.parseUnicodeClass(e,r))continue;if(this.parsePerlClassEscape(e,r))continue;e.rewindTo(n);const s=Yc.parseClassChar(e,t);let a=s;if(e.more()&&e.lookingAt("-"))if(e.skip(1),e.more()&&e.lookingAt("]"))e.skip(-1);else if(a=Yc.parseClassChar(e,t),a<s)throw new hc(Yc.ERR_INVALID_CHAR_RANGE,e.from(n));0===(this.flags&ec.FOLD_CASE)?r.appendRange(s,a):r.appendFoldedRange(s,a)}e.skip(1),r.cleanClass(),s<0&&r.negateClass(),n.runes=r.toArray(),this.push(n)}}class Xc{constructor(){this.inst=null,this.cap=[]}}class Qc{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){const t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return 0===this.size}add(e){const t=this.size++;return this.sparse[e]=t,this.denseThreads[t]=null,this.densePcs[t]=e,t}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let e="{";for(let t=0;t<this.size;t++)0!==t&&(e+=", "),e+=this.densePcs[t];return e+="}",e}}class Jc{static fromRE2(e){const t=new Jc;return t.prog=e.prog,t.re2=e,t.q0=new Qc(t.prog.numInst()),t.q1=new Qc(t.prog.numInst()),t.pool=[],t.poolSize=0,t.matched=!1,t.matchcap=Array(t.prog.numCap<2?2:t.prog.numCap).fill(0),t.ncap=0,t}static fromMachine(e){const t=new Jc;return t.re2=e.re2,t.prog=e.prog,t.q0=e.q0,t.q1=e.q1,t.pool=e.pool,t.poolSize=e.poolSize,t.matched=e.matched,t.matchcap=e.matchcap,t.ncap=e.ncap,t}init(e){this.ncap=e,e>this.matchcap.length?this.initNewCap(e):this.resetCap(e)}resetCap(e){for(let t=0;t<this.poolSize;t++){this.pool[t].cap=Array(e).fill(0)}}initNewCap(e){for(let t=0;t<this.poolSize;t++){this.pool[t].cap=Array(e).fill(0)}this.matchcap=Array(e).fill(0)}submatches(){return 0===this.ncap?sc.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(e){let t;return this.poolSize>0?(this.poolSize--,t=this.pool[this.poolSize]):t=new Xc,t.inst=e,t}freeQueue(e,t=0){const n=e.size-t,r=this.poolSize+n;this.pool.length<r&&(this.pool=this.pool.slice(0,Math.max(2*this.pool.length,r)));for(let n=t;n<e.size;n++){const t=e.denseThreads[n];null!==t&&(this.pool[this.poolSize]=t,this.poolSize++)}e.clear()}freeThread(e){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,2*this.pool.length)),this.pool[this.poolSize]=e,this.poolSize++}match(e,t,n){const r=this.re2.cond;if(r===sc.EMPTY_ALL)return!1;if((n===ec.ANCHOR_START||n===ec.ANCHOR_BOTH)&&0!==t)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let s,i=this.q0,a=this.q1,o=e.step(t),c=o>>3,u=7&o,l=-1,h=0;for(o!==mc.EOF()&&(o=e.step(t+u),l=o>>3,h=7&o),s=0===t?sc.emptyOpContext(-1,c):e.context(t);;){if(i.isEmpty()){if(0!==(r&sc.EMPTY_BEGIN_TEXT)&&0!==t)break;if(this.matched)break;if(0!==this.re2.prefix.length&&l!==this.re2.prefixRune&&e.canCheckPrefix()){const n=e.index(this.re2,t);if(n<0)break;t+=n,o=e.step(t),c=o>>3,u=7&o,o=e.step(t+u),l=o>>3,h=7&o}}this.matched||0!==t&&n!==ec.UNANCHORED||(this.ncap>0&&(this.matchcap[0]=t),this.add(i,this.prog.start,t,this.matchcap,s,null));const d=t+u;if(s=e.context(d),this.step(i,a,t,d,c,s,n,t===e.endPos()),0===u)break;if(0===this.ncap&&this.matched)break;t+=u,c=l,u=h,-1!==c&&(o=e.step(t+u),l=o>>3,h=7&o);const p=i;i=a,a=p}return this.freeQueue(a),this.matched}step(e,t,n,r,s,i,a,o){const c=this.re2.longest;for(let u=0;u<e.size;u++){let l=e.denseThreads[u];if(null===l)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<l.cap[0]){this.freeThread(l);continue}const h=l.inst;let d=!1;switch(h.op){case bc.MATCH:if(a===ec.ANCHOR_BOTH&&!o)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<n)&&(l.cap[1]=n,this.matchcap=l.cap.slice(0,this.ncap)),c||this.freeQueue(e,u+1),this.matched=!0;break;case bc.RUNE:d=h.matchRune(s);break;case bc.RUNE1:d=s===h.runes[0];break;case bc.RUNE_ANY:d=!0;break;case bc.RUNE_ANY_NOT_NL:d=s!==tc.CODES.get("\n");break;default:throw new Error("bad inst")}d&&(l=this.add(t,h.out,r,l.cap,i,l)),null!==l&&(this.freeThread(l),e.denseThreads[u]=null)}e.clear()}add(e,t,n,r,s,i){if(0===t)return i;if(e.contains(t))return i;const a=e.add(t),o=this.prog.inst[t];switch(o.op){case bc.FAIL:break;case bc.ALT:case bc.ALT_MATCH:i=this.add(e,o.out,n,r,s,i),i=this.add(e,o.arg,n,r,s,i);break;case bc.EMPTY_WIDTH:0===(o.arg&~s)&&(i=this.add(e,o.out,n,r,s,i));break;case bc.NOP:i=this.add(e,o.out,n,r,s,i);break;case bc.CAPTURE:if(o.arg<this.ncap){const t=r[o.arg];r[o.arg]=n,this.add(e,o.out,n,r,s,null),r[o.arg]=t}else i=this.add(e,o.out,n,r,s,i);break;case bc.MATCH:case bc.RUNE:case bc.RUNE1:case bc.RUNE_ANY:case bc.RUNE_ANY_NOT_NL:null===i?i=this.alloc(o):i.inst=o,this.ncap>0&&i.cap!==r&&(i.cap=r.slice(0,this.ncap)),e.denseThreads[a]=i,i=null;break;default:throw new Error("unhandled")}return i}}class Zc{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}compareAndSet(e,t){return this.value===e&&(this.value=t,!0)}}class eu{static initTest(e){const t=eu.compile(e),n=new eu(t.expr,t.prog,t.numSubexp,t.longest);return n.cond=t.cond,n.prefix=t.prefix,n.prefixUTF8=t.prefixUTF8,n.prefixComplete=t.prefixComplete,n.prefixRune=t.prefixRune,n}static compile(e){return eu.compileImpl(e,ec.PERL,!1)}static compilePOSIX(e){return eu.compileImpl(e,ec.POSIX,!0)}static compileImpl(e,t,n){let r=Yc.parse(e,t);const s=r.maxCap();r=Ac.simplify(r);const i=Sc.compileRegexp(r),a=new eu(e,i,s,n),[o,c]=i.prefix();return a.prefixComplete=o,a.prefix=c,a.prefixUTF8=sc.stringToUtf8ByteArray(a.prefix),a.prefix.length>0&&(a.prefixRune=a.prefix.codePointAt(0)),a.namedGroups=r.namedGroups,a}static match(e,t){return eu.compile(e).match(t)}constructor(e,t,n=0,r=0){this.expr=e,this.prog=t,this.numSubexp=n,this.longest=r,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new Zc}numberOfCapturingGroups(){return this.numSubexp}get(){let e;do{e=this.pooled.get()}while(e&&!this.pooled.compareAndSet(e,e.next));return e}reset(){this.pooled.set(null)}put(e,t){let n=this.pooled.get();do{n=this.pooled.get(),!t&&n&&(e=Jc.fromMachine(e),t=!0),e.next!==n&&(e.next=n)}while(!this.pooled.compareAndSet(n,e))}toString(){return this.expr}doExecute(e,t,n,r){let s=this.get(),i=!1;s?null!==s.next&&(s=Jc.fromMachine(s),i=!0):(s=Jc.fromRE2(this),i=!0),s.init(r);const a=s.match(e,t,n)?s.submatches():null;return this.put(s,i),a}match(e){return null!==this.doExecute(wc.fromUTF16(e),0,ec.UNANCHORED,0)}matchWithGroup(e,t,n,r,s){return e instanceof ac||(e=uc.utf16(e)),this.matchMachineInput(e,t,n,r,s)}matchMachineInput(e,t,n,r,s){if(t>n)return[!1,null];const i=e.isUTF16Encoding()?wc.fromUTF16(e.asCharSequence(),0,n):wc.fromUTF8(e.asBytes(),0,n),a=this.doExecute(i,t,r,2*s);return null===a?[!1,null]:[!0,a]}matchUTF8(e){return null!==this.doExecute(wc.fromUTF8(e),0,ec.UNANCHORED,0)}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,n){let r=0,s=0,i="";const a=wc.fromUTF16(e);let o=0;for(;s<=e.length;){const c=this.doExecute(a,s,ec.UNANCHORED,2);if(null===c||0===c.length)break;i+=e.substring(r,c[0]),(c[1]>r||0===c[0])&&(i+=t(e.substring(c[0],c[1])),o++),r=c[1];const u=7&a.step(s);if(s+u>c[1]?s+=u:s+1>c[1]?s++:s=c[1],o>=n)break}return i+=e.substring(r),i}pad(e){if(null===e)return null;let t=2*(1+this.numSubexp);if(e.length<t){let n=new Array(t).fill(-1);for(let t=0;t<e.length;t++)n[t]=e[t];e=n}return e}allMatches(e,t,n=e=>e){let r=[];const s=e.endPos();t<0&&(t=s+1);let i=0,a=0,o=-1;for(;a<t&&i<=s;){const t=this.doExecute(e,i,ec.UNANCHORED,this.prog.numCap);if(null===t||0===t.length)break;let c=!0;if(t[1]===i){t[0]===o&&(c=!1);const n=e.step(i);n<0?i=s+1:i+=7&n}else i=t[1];o=t[1],c&&(r.push(n(this.pad(t))),a++)}return r}findUTF8(e){const t=this.doExecute(wc.fromUTF8(e),0,ec.UNANCHORED,2);return null===t?null:e.slice(t[0],t[1])}findUTF8Index(e){const t=this.doExecute(wc.fromUTF8(e),0,ec.UNANCHORED,2);return null===t?null:t.slice(0,2)}find(e){const t=this.doExecute(wc.fromUTF16(e),0,ec.UNANCHORED,2);return null===t?"":e.substring(t[0],t[1])}findIndex(e){return this.doExecute(wc.fromUTF16(e),0,ec.UNANCHORED,2)}findUTF8Submatch(e){const t=this.doExecute(wc.fromUTF8(e),0,ec.UNANCHORED,this.prog.numCap);if(null===t)return null;const n=new Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n}findUTF8SubmatchIndex(e){return this.pad(this.doExecute(wc.fromUTF8(e),0,ec.UNANCHORED,this.prog.numCap))}findSubmatch(e){const t=this.doExecute(wc.fromUTF16(e),0,ec.UNANCHORED,this.prog.numCap);if(null===t)return null;const n=new Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n}findSubmatchIndex(e){return this.pad(this.doExecute(wc.fromUTF16(e),0,ec.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){const n=this.allMatches(wc.fromUTF8(e),t,t=>e.slice(t[0],t[1]));return 0===n.length?null:n}findAllUTF8Index(e,t){const n=this.allMatches(wc.fromUTF8(e),t,e=>e.slice(0,2));return 0===n.length?null:n}findAll(e,t){const n=this.allMatches(wc.fromUTF16(e),t,t=>e.substring(t[0],t[1]));return 0===n.length?null:n}findAllIndex(e,t){const n=this.allMatches(wc.fromUTF16(e),t,e=>e.slice(0,2));return 0===n.length?null:n}findAllUTF8Submatch(e,t){const n=this.allMatches(wc.fromUTF8(e),t,t=>{let n=new Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n});return 0===n.length?null:n}findAllUTF8SubmatchIndex(e,t){const n=this.allMatches(wc.fromUTF8(e),t);return 0===n.length?null:n}findAllSubmatch(e,t){const n=this.allMatches(wc.fromUTF16(e),t,t=>{let n=new Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n});return 0===n.length?null:n}findAllSubmatchIndex(e,t){const n=this.allMatches(wc.fromUTF16(e),t);return 0===n.length?null:n}}class tu{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(e){return sc.quoteMeta(e)}static compile(e,t=0){let n=e;if(0!==(t&tu.CASE_INSENSITIVE)&&(n=`(?i)${n}`),0!==(t&tu.DOTALL)&&(n=`(?s)${n}`),0!==(t&tu.MULTILINE)&&(n=`(?m)${n}`),-32&t)throw new fc("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let r=ec.PERL;0!==(t&tu.DISABLE_UNICODE_GROUPS)&&(r&=-129);const s=new tu(e,t);return s.re2Input=eu.compileImpl(n,r,0!==(t&tu.LONGEST_MATCH)),s}static matches(e,t){return tu.compile(e).matcher(t).matches()}static initTest(e,t,n){if(null==e)throw new Error("pattern is null");if(null==n)throw new Error("re2 is null");const r=new tu(e,t);return r.re2Input=n,r}constructor(e,t){this.patternInput=e,this.flagsInput=t}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.matcher(e).matches()}matcher(e){return Array.isArray(e)&&(e=uc.utf8(e)),new gc(this,e)}split(e,t=0){const n=this.matcher(e),r=[];let s=0,i=0;for(;n.find();)if(0!==i||0!==n.end()){if(t>0&&r.length===t-1)break;if(i===n.start()){if(0===t){s+=1,i=n.end();continue}}else for(;s>0;)r.push(""),s-=1;r.push(n.substring(i,n.start())),i=n.end()}else i=n.end();if(0===t&&i!==n.inputLength()){for(;s>0;)r.push(""),s-=1;r.push(n.substring(i,n.inputLength()))}return 0===t&&0!==r.length||r.push(n.substring(i,n.inputLength())),r}toString(){return this.patternInput}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e||null!==e&&this.constructor===e.constructor&&(this.flagsInput===e.flagsInput&&this.patternInput===e.patternInput)}}class nu{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}}nu.UNAUTHENTICATED=new nu(null),nu.GOOGLE_CREDENTIALS=new nu("google-credentials-uid"),nu.FIRST_PARTY=new nu("first-party-uid"),nu.MOCK_USER=new nu("mock-user");let ru="12.15.0";const su=new pr("@firebase/firestore");function iu(){return su.logLevel}function au(e,...t){if(su.logLevel<=cr.DEBUG){const n=t.map(uu);su.debug(`Firestore (${ru}): ${e}`,...n)}}function ou(e,...t){if(su.logLevel<=cr.ERROR){const n=t.map(uu);su.error(`Firestore (${ru}): ${e}`,...n)}}function cu(e,...t){if(su.logLevel<=cr.WARN){const n=t.map(uu);su.warn(`Firestore (${ru}): ${e}`,...n)}}function uu(e){if("string"==typeof e)return e;try{return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}function lu(e,t,n){let r="Unexpected state";"string"==typeof t?r=t:n=t,hu(e,r,n)}function hu(e,t,n){let r=`FIRESTORE (${ru}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==n)try{r+=" CONTEXT: "+JSON.stringify(n)}catch(e){r+=" CONTEXT: "+n}throw ou(r),new Error(r)}function du(e,t,n,r){let s="Unexpected state";"string"==typeof n?s=n:r=n,e||hu(t,s,r)}function pu(e,t){return e}const fu={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 gu extends zn{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class mu{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class yu{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class _u{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(nu.UNAUTHENTICATED))}shutdown(){}}class wu{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 vu{constructor(e){this.t=e,this.currentUser=nu.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){du(void 0===this.o,42304);let n=this.i;const r=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let s=new mu;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new mu,e.enqueueRetryable(()=>r(this.currentUser))};const i=()=>{const t=s;e.enqueueRetryable(async()=>{await t.promise,await r(this.currentUser)})},a=e=>{au("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),i())};this.t.onInit(e=>a(e)),setTimeout(()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?a(e):(au("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new mu)}},0),i()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(au("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(du("string"==typeof t.accessToken,31837,{l:t}),new yu(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 du(null===e||"string"==typeof e,2055,{h:e}),new nu(e)}}class bu{constructor(e,t,n){this.T=e,this.P=t,this.R=n,this.type="FirstParty",this.user=nu.FIRST_PARTY,this.I=new Map}A(){return this.R?this.R():null}get headers(){this.I.set("X-Goog-AuthUser",this.T);const e=this.A();return e&&this.I.set("Authorization",e),this.P&&this.I.set("X-Goog-Iam-Authorization-Token",this.P),this.I}}class Eu{constructor(e,t,n){this.T=e,this.P=t,this.R=n}getToken(){return Promise.resolve(new bu(this.T,this.P,this.R))}start(e,t){e.enqueueRetryable(()=>t(nu.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Tu{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 Su{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,ms(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){du(void 0===this.o,3512);const n=e=>{null!=e.error&&au("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,au("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};const r=e=>{au("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):au("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Tu(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(du("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new Tu(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 Au(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 Iu{static newId(){const e=62*Math.floor(256/62);let t="";for(;t.length<20;){const n=Au(40);for(let r=0;r<n.length;++r)t.length<20&&n[r]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[r]%62))}return t}}function Cu(e,t){return e<t?-1:e>t?1:0}function Ou(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=e.charAt(r),s=t.charAt(r);if(n!==s)return Nu(n)===Nu(s)?Cu(n,s):Nu(n)?1:-1}return Cu(e.length,t.length)}const Ru=55296,ku=57343;function Nu(e){const t=e.charCodeAt(0);return t>=Ru&&t<=ku}function xu(e,t,n){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}const Pu="__name__";class Du{constructor(e,t,n){void 0===t?t=0:t>e.length&&lu(637,{offset:t,range:e.length}),void 0===n?n=e.length-t:n>e.length-t&&lu(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===Du.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Du?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=Du.compareSegments(e.get(r),t.get(r));if(0!==n)return n}return Cu(e.length,t.length)}static compareSegments(e,t){const n=Du.isNumericId(e),r=Du.isNumericId(t);return n&&!r?-1:!n&&r?1:n&&r?Du.extractNumericId(e).compare(Du.extractNumericId(t)):Ou(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Ho.fromString(e.substring(4,e.length-2))}}class Lu extends Du{construct(e,t,n){return new Lu(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toStringWithLeadingSlash(){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 gu(fu.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new Lu(t)}static emptyPath(){return new Lu([])}}const Uu=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Mu extends Du{construct(e,t,n){return new Mu(e,t,n)}static isValidIdentifier(e){return Uu.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Mu.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===Pu}static keyField(){return new Mu([Pu])}static fromServerFormat(e){const t=[];let n="",r=0;const s=()=>{if(0===n.length)throw new gu(fu.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let i=!1;for(;r<e.length;){const t=e[r];if("\\"===t){if(r+1===e.length)throw new gu(fu.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new gu(fu.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,r+=2}else"`"===t?(i=!i,r++):"."!==t||i?(n+=t,r++):(s(),r++)}if(s(),i)throw new gu(fu.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new Mu(t)}static emptyPath(){return new Mu([])}}class Vu{constructor(e){this.path=e}static fromPath(e){return new Vu(Lu.fromString(e))}static fromName(e){return new Vu(Lu.fromString(e).popFirst(5))}static empty(){return new Vu(Lu.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===Lu.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return Lu.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Vu(new Lu(e.slice()))}}function Fu(e){if(!Vu.isDocumentKey(e))throw new gu(fu.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function $u(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function ju(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":lu(12329,{type:typeof e})}function Bu(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new gu(fu.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=ju(e);throw new gu(fu.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}function Hu(e,t){const n={typeString:e};return t&&(n.value=t),n}function zu(e,t){if(!$u(e))throw new gu(fu.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in t)if(t[r]){const s=t[r].typeString,i="value"in t[r]?{value:t[r].value}:void 0;if(!(r in e)){n=`JSON missing required field: '${r}'`;break}const a=e[r];if(s&&typeof a!==s){n=`JSON field '${r}' must be a ${s}.`;break}if(void 0!==i&&a!==i.value){n=`Expected '${r}' field to equal '${i.value}'`;break}}if(n)throw new gu(fu.INVALID_ARGUMENT,n);return!0}const qu=-62135596800,Gu=1e6;class Ku{static now(){return Ku.fromMillis(Date.now())}static fromDate(e){return Ku.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*Gu);return new Ku(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new gu(fu.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new gu(fu.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<qu)throw new gu(fu.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new gu(fu.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Gu}_compareTo(e){return this.seconds===e.seconds?Cu(this.nanoseconds,e.nanoseconds):Cu(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:Ku._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(zu(e,Ku._jsonSchema))return new Ku(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-qu;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Ku._jsonSchemaVersion="firestore/timestamp/1.0",Ku._jsonSchema={type:Hu("string",Ku._jsonSchemaVersion),seconds:Hu("number"),nanoseconds:Hu("number")};class Wu{static fromTimestamp(e){return new Wu(e)}static min(){return new Wu(new Ku(0,0))}static max(){return new Wu(new Ku(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 Yu(e){return new Xu(e.readTime,e.key,-1)}class Xu{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new Xu(Wu.min(),Vu.empty(),-1)}static max(){return new Xu(Wu.max(),Vu.empty(),-1)}}function Qu(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=Vu.comparator(e.documentKey,t.documentKey),0!==n?n:Cu(e.largestBatchId,t.largestBatchId))}class Ju{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function Zu(e){if(e.code!==fu.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;au("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&&lu(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,s=0,i=!1;e.forEach(e=>{++r,e.next(()=>{++s,i&&s===r&&t()},e=>n(e))}),i=!0,s===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 s=e.length,i=new Array(s);let a=0;for(let o=0;o<s;o++){const c=o;t(e[c]).next(e=>{i[c]=e,++a,a===s&&n(i)},e=>r(e))}})}static doWhile(e,t){return new el((n,r)=>{const s=()=>{!0===e()?t().next(()=>{s()},r):n()};s()})}}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 sl(e){return 0===e&&1/e==-1/0}function il(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 al(e){return e+""}class ol{constructor(e,t){this.comparator=e,this.root=t||ul.EMPTY}insert(e,t){return new ol(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,ul.BLACK,null,null))}remove(e){return new ol(this.comparator,this.root.remove(e,this.comparator).copy(null,null,ul.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 cl(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new cl(this.root,e,this.comparator,!1)}getReverseIterator(){return new cl(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new cl(this.root,e,this.comparator,!0)}}class cl{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,t&&r&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(0===s){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();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 ul{constructor(e,t,n,r,s){this.key=e,this.value=t,this.color=null!=n?n:ul.RED,this.left=null!=r?r:ul.EMPTY,this.right=null!=s?s:ul.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,r,s){return new ul(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this;const s=n(e,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===s?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 ul.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 ul.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,ul.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,ul.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 lu(43730,{key:this.key,value:this.value});if(this.right.isRed())throw lu(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw lu(27949);return e+(this.isRed()?0:1)}}ul.EMPTY=null,ul.RED=!0,ul.BLACK=!1,ul.EMPTY=new class{constructor(){this.size=0}get key(){throw lu(57766)}get value(){throw lu(16141)}get color(){throw lu(16727)}get left(){throw lu(29726)}get right(){throw lu(36894)}copy(e,t,n,r,s){return this}insert(e,t,n){return new ul(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 ll{constructor(e){this.comparator=e,this.data=new ol(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 hl(this.data.getIterator())}getIteratorFrom(e){return new hl(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 ll))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 ll(this.comparator);return t.data=e,t}}class hl{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class dl{constructor(e){this.fields=e,e.sort(Mu.comparator)}static empty(){return new dl([])}unionWith(e){let t=new ll(Mu.comparator);for(const e of this.fields)t=t.add(e);for(const n of e)t=t.add(n);return new dl(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return xu(this.fields,e.fields,(e,t)=>e.isEqual(t))}}function pl(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function fl(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function gl(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class ml extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class yl{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 ml("Invalid base64 string: "+e):e}}(e);return new yl(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 yl(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 Cu(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}yl.EMPTY_BYTE_STRING=new yl("");const _l=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function wl(e){if(du(!!e,39018),"string"==typeof e){let t=0;const n=_l.exec(e);if(du(!!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:vl(e.seconds),nanos:vl(e.nanos)}}function vl(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function bl(e){return"string"==typeof e?yl.fromBase64String(e):yl.fromUint8Array(e)}const El="server_timestamp",Tl="__type__",Sl="__previous_value__",Al="__local_write_time__";function Il(e){const t=(e?.mapValue?.fields||{})[Tl]?.stringValue;return t===El}function Cl(e){const t=e.mapValue.fields[Sl];return Il(t)?Cl(t):t}function Ol(e){const t=wl(e.mapValue.fields[Al].timestampValue);return new Ku(t.seconds,t.nanos)}class Rl{constructor(e,t,n,r,s,i,a,o,c,u,l){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=s,this.forceLongPolling=i,this.autoDetectLongPolling=a,this.longPollingOptions=o,this.useFetchStreams=c,this.isUsingEmulator=u,this.apiKey=l}}const kl="(default)";class Nl{constructor(e,t){this.projectId=e,this.database=t||kl}static empty(){return new Nl("","")}get isDefaultDatabase(){return this.database===kl}isEqual(e){return e instanceof Nl&&e.projectId===this.projectId&&e.database===this.database}}const xl="__type__",Pl="__max__",Dl={},Ll="__vector__",Ul="value",Ml={nullValue:"NULL_VALUE"},Vl={booleanValue:!0},Fl={booleanValue:!1};function $l(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?Il(e)?4:function(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===Pl}(e)?9007199254740991:nh(e)?10:11:lu(28295,{value:e})}function jl(e,t,n){if(e===t)return!0;const r=$l(e);if(r!==$l(t))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Ol(e).isEqual(Ol(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=wl(e.timestampValue),r=wl(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 bl(e.bytesValue).isEqual(bl(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return vl(e.geoPointValue.latitude)===vl(t.geoPointValue.latitude)&&vl(e.geoPointValue.longitude)===vl(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t,n){if("integerValue"in e&&"integerValue"in t)return vl(e.integerValue)===vl(t.integerValue);let r,s;if("doubleValue"in e&&"doubleValue"in t)r=vl(e.doubleValue),s=vl(t.doubleValue);else{if(!n?.Ee)return!1;r=vl(e.integerValue??e.doubleValue),s=vl(t.integerValue??t.doubleValue)}return r===s?!!n?.he||sl(r)===sl(s):!(void 0!==n&&!n.Te)&&isNaN(r)&&isNaN(s)}(e,t,n);case 9:return xu(e.arrayValue.values||[],t.arrayValue.values||[],(e,t)=>jl(e,t,n));case 10:case 11:return function(e,t,n){const r=e.mapValue.fields||{},s=t.mapValue.fields||{};if(pl(r)!==pl(s))return!1;for(const e in r)if(r.hasOwnProperty(e)&&(void 0===s[e]||!jl(r[e],s[e],n)))return!1;return!0}(e,t,n);default:return lu(52216,{left:e})}}function Bl(e,t){return void 0!==(e.values||[]).find(e=>jl(e,t))}function Hl(e,t){if(e===t)return 0;const n=$l(e),r=$l(t);if(n!==r)return Cu(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Cu(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=vl(e.integerValue||e.doubleValue),r=vl(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 zl(e.timestampValue,t.timestampValue);case 4:return zl(Ol(e),Ol(t));case 5:return Ou(e.stringValue,t.stringValue);case 6:return function(e,t){const n=bl(e),r=bl(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=Cu(n[e],r[e]);if(0!==t)return t}return Cu(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=Cu(vl(e.latitude),vl(t.latitude));return 0!==n?n:Cu(vl(e.longitude),vl(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return ql(e.arrayValue,t.arrayValue);case 10:return function(e,t){const n=e.fields||{},r=t.fields||{},s=n[Ul]?.arrayValue,i=r[Ul]?.arrayValue,a=Cu(s?.values?.length||0,i?.values?.length||0);return 0!==a?a:ql(s,i)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===Dl&&t===Dl)return 0;if(e===Dl)return 1;if(t===Dl)return-1;const n=e.fields||{},r=Object.keys(n),s=t.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let e=0;e<r.length&&e<i.length;++e){const t=Ou(r[e],i[e]);if(0!==t)return t;const a=Hl(n[r[e]],s[i[e]]);if(0!==a)return a}return Cu(r.length,i.length)}(e.mapValue,t.mapValue);default:throw lu(23264,{Pe:n})}}function zl(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return Cu(e,t);const n=wl(e),r=wl(t),s=Cu(n.seconds,r.seconds);return 0!==s?s:Cu(n.nanos,r.nanos)}function ql(e,t){const n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){const t=Hl(n[e],r[e]);if(void 0!==t&&0!==t)return t}return Cu(n.length,r.length)}function Gl(e){return Kl(e)}function Kl(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=wl(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return bl(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return Vu.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+=Kl(r);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",r=!0;for(const s of t)r?r=!1:n+=",",n+=`${s}:${Kl(e.fields[s])}`;return n+"}"}(e.mapValue):lu(61005,{value:e})}function Wl(e){switch($l(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+Wl(t):16;case 5:return 2*e.stringValue.length;case 6:return bl(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce((e,t)=>e+Wl(t),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return fl(e.fields,(e,n)=>{t+=e.length+Wl(n)}),t}(e.mapValue);default:throw lu(13486,{value:e})}}function Yl(e){return!!e&&"integerValue"in e}function Xl(e){return!!e&&"doubleValue"in e}function Ql(e){return Yl(e)||Xl(e)}function Jl(e){return!!e&&"arrayValue"in e}function Zl(e){return!!e&&"nullValue"in e}function eh(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function th(e){return!!e&&"mapValue"in e}function nh(e){const t=(e?.mapValue?.fields||{})[xl]?.stringValue;return t===Ll}function rh(e){return(e?.mapValue?.fields||{})[Ul]?.arrayValue}function sh(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 fl(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=sh(n)),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=sh(e.arrayValue.values[n]);return t}return{...e}}class ih{constructor(e){this.value=e}static empty(){return new ih({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)],!th(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=sh(t)}setAll(e){let t=Mu.emptyPath(),n={},r=[];e.forEach((e,s)=>{if(!t.isImmediateParentOf(s)){const e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=s.popLast()}e?n[s.lastSegment()]=sh(e):r.push(s.lastSegment())});const s=this.getFieldsMap(t);this.applyChanges(s,n,r)}delete(e){const t=this.field(e.popLast());th(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return jl(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)];th(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}applyChanges(e,t,n){fl(t,(t,n)=>e[t]=n);for(const t of n)delete e[t]}clone(){return new ih(sh(this.value))}}function ah(e){const t=[];return fl(e.fields,(e,n)=>{const r=new Mu([e]);if(th(n)){const e=ah(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 dl(t)}function oh(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:sl(t)?"-0":t}}function ch(e){return{integerValue:""+e}}function uh(e,t,n){return Number.isInteger(t)&&n?.preferIntegers||function(e){return"number"==typeof e&&Number.isInteger(e)&&!sl(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}(t)?ch(t):oh(e,t)}class lh{constructor(){this._=void 0}}function hh(e,t,n){return e instanceof fh?function(e,t){const n={fields:{[Tl]:{stringValue:El},[Al]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Il(t)&&(t=Cl(t)),t&&(n.fields[Sl]=t),{mapValue:n}}(n,t):e instanceof gh?mh(e,t):e instanceof yh?_h(e,t):e instanceof vh?function(e,t){const n=ph(e,t),r=Sh(n)+Sh(e.Re);return Yl(n)&&Yl(e.Re)?ch(r):oh(e.serializer,r)}(e,t):e instanceof bh?function(e,t){return Th(e,t,Math.min)}(e,t):e instanceof Eh?function(e,t){return Th(e,t,Math.max)}(e,t):void 0}function dh(e,t,n){return e instanceof gh?mh(e,t):e instanceof yh?_h(e,t):n}function ph(e,t){return e instanceof vh?Ql(t)?t:{integerValue:0}:null}class fh extends lh{}class gh extends lh{constructor(e){super(),this.elements=e}}function mh(e,t){const n=Ah(t);for(const t of e.elements)n.some(e=>jl(e,t))||n.push(t);return{arrayValue:{values:n}}}class yh extends lh{constructor(e){super(),this.elements=e}}function _h(e,t){let n=Ah(t);for(const t of e.elements)n=n.filter(e=>!jl(e,t));return{arrayValue:{values:n}}}class wh extends lh{constructor(e,t){super(),this.serializer=e,this.Re=t}}class vh extends wh{}class bh extends wh{}class Eh extends wh{}function Th(e,t,n){if(!Ql(t))return e.Re;const r=n(Sh(t),Sh(e.Re));return Yl(t)&&Yl(e.Re)?ch(r):oh(e.serializer,r)}function Sh(e){return vl(e.integerValue||e.doubleValue)}function Ah(e){return Jl(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Ih{constructor(e,t){this.version=e,this.transformResults=t}}class Ch{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Ch}static exists(e){return new Ch(void 0,e)}static updateTime(e){return new Ch(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 Rh{}function kh(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new $h(e.key,Ch.none()):new Lh(e.key,e.data,Ch.none());{const n=e.data,r=ih.empty();let s=new ll(Mu.comparator);for(let e of t.fields)if(!s.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?r.delete(e):r.set(e,t),s=s.add(e)}return new Uh(e.key,r,new dl(s.toArray()),Ch.none())}}function Nh(e,t,n){e instanceof Lh?function(e,t,n){const r=e.value.clone(),s=Vh(e.fieldTransforms,t,n.transformResults);r.setAll(s),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof Uh?function(e,t,n){if(!Oh(e.precondition,t))return void t.convertToUnknownDocument(n.version);const r=Vh(e.fieldTransforms,t,n.transformResults),s=t.data;s.setAll(Mh(e)),s.setAll(r),t.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function xh(e,t,n,r){return e instanceof Lh?function(e,t,n,r){if(!Oh(e.precondition,t))return n;const s=e.value.clone(),i=Fh(e.fieldTransforms,r,t);return s.setAll(i),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null}(e,t,n,r):e instanceof Uh?function(e,t,n,r){if(!Oh(e.precondition,t))return n;const s=Fh(e.fieldTransforms,r,t),i=t.data;return i.setAll(Mh(e)),i.setAll(s),t.convertToFoundDocument(t.version,i).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 Ph(e,t){let n=null;for(const r of e.fieldTransforms){const e=t.data.field(r.field),s=ph(r.transform,e||null);null!=s&&(null===n&&(n=ih.empty()),n.set(r.field,s))}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)&&xu(e,t,(e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof gh&&t instanceof gh||e instanceof yh&&t instanceof yh?xu(e.elements,t.elements,jl):e instanceof vh&&t instanceof vh||e instanceof bh&&t instanceof bh||e instanceof Eh&&t instanceof Eh?jl(e.Re,t.Re):e instanceof fh&&t instanceof fh}(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 Lh extends Rh{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 Uh extends Rh{constructor(e,t,n,r,s=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function Mh(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 Vh(e,t,n){const r=new Map;du(e.length===n.length,32656,{Ie:n.length,Ae:e.length});for(let s=0;s<n.length;s++){const i=e[s],a=i.transform,o=t.data.field(i.field);r.set(i.field,dh(a,o,n[s]))}return r}function Fh(e,t,n){const r=new Map;for(const s of e){const e=s.transform,i=n.data.field(s.field);r.set(s.field,hh(e,i,t))}return r}class $h extends Rh{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class jh extends Rh{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class Bh{constructor(e,t){this.position=e,this.inclusive=t}}function Hh(e,t,n){let r=0;for(let s=0;s<e.position.length;s++){const i=t[s],a=e.position[s];if(r=i.field.isKeyField()?Vu.comparator(Vu.fromName(a.referenceValue),n.key):Hl(a,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function zh(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(!jl(e.position[n],t.position[n]))return!1;return!0}class qh{}class Gh extends qh{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 Zh(e,t,n):"array-contains"===t?new rd(e,n):"in"===t?new sd(e,n):"not-in"===t?new id(e,n):"array-contains-any"===t?new ad(e,n):new Gh(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new ed(e,n):new td(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(Hl(t,this.value)):null!==t&&$l(this.value)===$l(t)&&this.matchesComparison(Hl(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 lu(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Kh extends qh{constructor(e,t){super(),this.filters=e,this.op=t,this.Ve=null}static create(e,t){return new Kh(e,t)}matches(e){return Wh(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.Ve||(this.Ve=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.Ve}getFilters(){return Object.assign([],this.filters)}}function Wh(e){return"and"===e.op}function Yh(e){return function(e){for(const t of e.filters)if(t instanceof Kh)return!1;return!0}(e)&&Wh(e)}function Xh(e){if(e instanceof Gh)return e.field.canonicalString()+e.op.toString()+Gl(e.value);if(Yh(e))return e.filters.map(e=>Xh(e)).join(",");{const t=e.filters.map(e=>Xh(e)).join(",");return`${e.op}(${t})`}}function Qh(e,t){return e instanceof Gh?function(e,t){return t instanceof Gh&&e.op===t.op&&e.field.isEqual(t.field)&&jl(e.value,t.value)}(e,t):e instanceof Kh?function(e,t){return t instanceof Kh&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((e,n,r)=>e&&Qh(n,t.filters[r]),!0)}(e,t):void lu(19439)}function Jh(e){return e instanceof Gh?function(e){return`${e.field.canonicalString()} ${e.op} ${Gl(e.value)}`}(e):e instanceof Kh?function(e){return e.op.toString()+" {"+e.getFilters().map(Jh).join(" ,")+"}"}(e):"Filter"}class Zh extends Gh{constructor(e,t,n){super(e,t,n),this.key=Vu.fromName(n.referenceValue)}matches(e){const t=Vu.comparator(e.key,this.key);return this.matchesComparison(t)}}class ed extends Gh{constructor(e,t){super(e,"in",t),this.keys=nd("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class td extends Gh{constructor(e,t){super(e,"not-in",t),this.keys=nd("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function nd(e,t){return(t.arrayValue?.values||[]).map(e=>Vu.fromName(e.referenceValue))}class rd extends Gh{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Jl(t)&&Bl(t.arrayValue,this.value)}}class sd extends Gh{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&Bl(this.value.arrayValue,t)}}class id extends Gh{constructor(e,t){super(e,"not-in",t)}matches(e){if(Bl(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!Bl(this.value.arrayValue,t)}}class ad extends Gh{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Jl(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>Bl(this.value.arrayValue,e))}}class od{constructor(e,t="asc"){this.field=e,this.dir=t}}function cd(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}class ud{constructor(e,t,n,r,s,i,a){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=s,this.data=i,this.documentState=a}static newInvalidDocument(e){return new ud(e,0,Wu.min(),Wu.min(),Wu.min(),ih.empty(),0)}static newFoundDocument(e,t,n,r){return new ud(e,1,t,Wu.min(),n,r,0)}static newNoDocument(e,t){return new ud(e,2,t,Wu.min(),Wu.min(),ih.empty(),0)}static newUnknownDocument(e,t){return new ud(e,3,t,Wu.min(),Wu.min(),ih.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(Wu.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=ih.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=ih.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Wu.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 ud&&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 ud(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 ld{constructor(e,t=null,n=[],r=[],s=null,i=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=a,this.de=null}}function hd(e,t=null,n=[],r=[],s=null,i=null,a=null){return new ld(e,t,n,r,s,i,a)}function dd(e){const t=pu(e);if(null===t.de){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map(e=>Xh(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=>Gl(e)).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(e=>Gl(e)).join(",")),t.de=e}return t.de}function pd(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(!cd(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(!Qh(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!zh(e.startAt,t.startAt)&&zh(e.endAt,t.endAt)}class fd{constructor(e,t=null,n=[],r=[],s=null,i="F",a=null,o=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=s,this.limitType=i,this.startAt=a,this.endAt=o,this.fe=null,this.me=null,this.pe=null,this.startAt,this.endAt}}function gd(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 md(e){const t=pu(e);if(null===t.fe){t.fe=[];const e=new Set;for(const n of t.explicitOrderBy)t.fe.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 ll(Mu.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.fe.push(new od(r,n))}),e.has(Mu.keyField().canonicalString())||t.fe.push(new od(Mu.keyField(),n))}return t.fe}function yd(e){const t=pu(e);return t.me||(t.me=function(e,t){if("F"===e.limitType)return hd(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 od(e.field,t)});const n=e.endAt?new Bh(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Bh(e.startAt.position,e.startAt.inclusive):null;return hd(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}(t,md(e))),t.me}function _d(e,t,n){return new fd(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function wd(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=>Jh(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=>Gl(e)).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>Gl(e)).join(",")),`Target(${t})`}(yd(e))}; limitType=${e.limitType})`}function vd(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):Vu.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of md(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=Hh(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,md(e),t))&&!(e.endAt&&!function(e,t,n){const r=Hh(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,md(e),t))}(e,t)}function bd(e){return(t,n)=>{let r=!1;for(const s of md(e)){const e=Ed(s,t,n);if(0!==e)return e;r=r||s.field.isKeyField()}return 0}}function Ed(e,t,n){const r=e.field.isKeyField()?Vu.comparator(t.key,n.key):function(e,t,n){const r=t.data.field(e),s=n.data.field(e);return null!==r&&null!==s?Hl(r,s):lu(42886)}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return lu(19790,{direction:e.dir})}}var Td,Sd;(Sd=Td||(Td={}))[Sd.OK=0]="OK",Sd[Sd.CANCELLED=1]="CANCELLED",Sd[Sd.UNKNOWN=2]="UNKNOWN",Sd[Sd.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Sd[Sd.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Sd[Sd.NOT_FOUND=5]="NOT_FOUND",Sd[Sd.ALREADY_EXISTS=6]="ALREADY_EXISTS",Sd[Sd.PERMISSION_DENIED=7]="PERMISSION_DENIED",Sd[Sd.UNAUTHENTICATED=16]="UNAUTHENTICATED",Sd[Sd.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Sd[Sd.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Sd[Sd.ABORTED=10]="ABORTED",Sd[Sd.OUT_OF_RANGE=11]="OUT_OF_RANGE",Sd[Sd.UNIMPLEMENTED=12]="UNIMPLEMENTED",Sd[Sd.INTERNAL=13]="INTERNAL",Sd[Sd.UNAVAILABLE=14]="UNAVAILABLE",Sd[Sd.DATA_LOSS=15]="DATA_LOSS";class Ad{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){fl(this.inner,(t,n)=>{for(const[t,r]of n)e(t,r)})}isEmpty(){return gl(this.inner)}size(){return this.innerSize}}const Id=new ol(Vu.comparator);function Cd(){return Id}const Od=new ol(Vu.comparator);function Rd(...e){let t=Od;for(const n of e)t=t.insert(n.key,n);return t}function kd(e){let t=Od;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function Nd(){return Pd()}function xd(){return Pd()}function Pd(){return new Ad(e=>e.toString(),(e,t)=>e.isEqual(t))}const Dd=new ol(Vu.comparator),Ld=new ll(Vu.comparator);function Ud(...e){let t=Ld;for(const n of e)t=t.add(n);return t}const Md=new ll(Cu);new Ho([4294967295,4294967295],0);class Vd{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Fd(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function $d(e){const t=wl(e);return new Ku(t.seconds,t.nanos)}function jd(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function Bd(e,t){return Fd(e,t.toTimestamp())}function Hd(e){return du(!!e,49232),Wu.fromTimestamp($d(e))}function zd(e,t){return qd(e,t).canonicalString()}function qd(e,t){const n=function(e){return new Lu(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function Gd(e,t){return zd(e.databaseId,t.path)}function Kd(e){const t=function(e){const t=Lu.fromString(e);return du(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?Lu.emptyPath():function(e){return du(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}(t)}function Wd(e,t,n){return{name:Gd(e,t),fields:n.value.mapValue.fields}}function Yd(e){let t=Kd(e.parent);const n=e.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){du(1===r,65062);const e=n.from[0];e.allDescendants?s=e.collectionId:t=t.child(e.collectionId)}let i=[];n.where&&(i=function(e){const t=Xd(e);return t instanceof Kh&&Yh(t)?t.getFilters():[t]}(n.where));let a=[];n.orderBy&&(a=function(e){return e.map(e=>function(e){return new od(Qd(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))}(n.orderBy));let o=null;n.limit&&(o=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 Bh(n,t)}(n.startAt));let u=null;return n.endAt&&(u=function(e){const t=!e.before,n=e.values||[];return new Bh(n,t)}(n.endAt)),function(e,t,n,r,s,i,a,o){return new fd(e,t,n,r,s,i,a,o)}(t,s,a,i,o,"F",c,u)}function Xd(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=Qd(e.unaryFilter.field);return Gh.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=Qd(e.unaryFilter.field);return Gh.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=Qd(e.unaryFilter.field);return Gh.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=Qd(e.unaryFilter.field);return Gh.create(s,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return lu(61313);default:return lu(60726)}}(e):void 0!==e.fieldFilter?function(e){return Gh.create(Qd(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 lu(58110);default:return lu(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return Kh.create(e.compositeFilter.filters.map(e=>Xd(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return lu(1026)}}(e.compositeFilter.op))}(e):lu(30097,{filter:e})}function Qd(e){return Mu.fromServerFormat(e.fieldPath)}function Jd(e){const t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}function Zd(e){return!!e&&"function"==typeof e._toProto&&"ProtoValue"===e._protoValueType}function ep(e,t){const n={fields:{}};return t.forEach((t,r)=>{if("string"!=typeof r)throw new Error(`Cannot encode map with non-string key: ${r}`);n.fields[r]=t._toProto(e)}),{mapValue:n}}function tp(e){return{stringValue:e}}function np(e){return new Vd(e,!0)}class rp{constructor(e){this._byteString=e}static fromBase64String(e){try{return new rp(yl.fromBase64String(e))}catch(e){throw new gu(fu.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new rp(yl.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:rp._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(zu(e,rp._jsonSchema))return rp.fromBase64String(e.bytes)}}rp._jsonSchemaVersion="firestore/bytes/1.0",rp._jsonSchema={type:Hu("string",rp._jsonSchemaVersion),bytes:Hu("string")};class sp{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new gu(fu.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Mu(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class ip{constructor(e){this._methodName=e}}class ap{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new gu(fu.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new gu(fu.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 Cu(this._lat,e._lat)||Cu(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:ap._jsonSchemaVersion}}static fromJSON(e){if(zu(e,ap._jsonSchema))return new ap(e.latitude,e.longitude)}}function op(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}ap._jsonSchemaVersion="firestore/geoPoint/1.0",ap._jsonSchema={type:Hu("string",ap._jsonSchemaVersion),latitude:Hu("number"),longitude:Hu("number")};class cp{bt(e){}shutdown(){}}const up="ConnectivityMonitor";class lp{constructor(){this.vt=()=>this.St(),this.Dt=()=>this.xt(),this.Ct=[],this.Ft()}bt(e){this.Ct.push(e)}shutdown(){window.removeEventListener("online",this.vt),window.removeEventListener("offline",this.Dt)}Ft(){window.addEventListener("online",this.vt),window.addEventListener("offline",this.Dt)}St(){au(up,"Network connectivity changed: AVAILABLE");for(const e of this.Ct)e(0)}xt(){au(up,"Network connectivity changed: UNAVAILABLE");for(const e of this.Ct)e(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let hp=null;function dp(){return null===hp?hp=268435456+Math.round(2147483648*Math.random()):hp++,"0x"+hp.toString(16)}const pp="RestConnection",fp={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class gp{get Ot(){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.Mt=t+"://"+e.host,this.Nt=`projects/${n}/databases/${r}`,this.Lt=this.databaseId.database===kl?`project_id=${n}`:`project_id=${n}&database_id=${r}`}Bt(e,t,n,r,s){const i=dp(),a=this.Ut(e,t.toUriEncodedString());au(pp,`Sending RPC '${e}' ${i}:`,a,n);const o={"google-cloud-resource-prefix":this.Nt,"x-goog-request-params":this.Lt};this.kt(o,r,s);const{host:c}=new URL(a),u=nr(c);return this.qt(e,a,o,n,u).then(t=>(au(pp,`Received RPC '${e}' ${i}: `,t),t),t=>{throw cu(pp,`RPC '${e}' ${i} failed with error: `,t,"url: ",a,"request:",n),t})}$t(e,t,n,r,s,i){return this.Bt(e,t,n,r,s)}kt(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+ru,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)}Ut(e,t){const n=fp[e];let r=`${this.Mt}/v1/${t}:${n}`;return this.databaseInfo.apiKey&&(r=`${r}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),r}terminate(){}}class mp{constructor(e){this.Kt=e.Kt,this.Wt=e.Wt}Qt(e){this.Gt=e}zt(e){this.jt=e}Ht(e){this.Jt=e}onMessage(e){this.Yt=e}close(){this.Wt()}send(e){this.Kt(e)}Zt(){this.Gt()}Xt(){this.jt()}en(e){this.Jt(e)}tn(e){this.Yt(e)}}const yp="WebChannelConnection",_p=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};class wp extends gp{constructor(e){super(e),this.nn=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static rn(){if(!wp.sn){const e=Qo();_p(e,Xo.STAT_EVENT,e=>{e.stat===Yo.PROXY?au(yp,"STAT_EVENT: detected buffering proxy"):e.stat===Yo.NOPROXY&&au(yp,"STAT_EVENT: detected no buffering proxy")}),wp.sn=!0}}qt(e,t,n,r,s){const i=dp();return new Promise((s,a)=>{const o=new qo;o.setWithCredentials(!0),o.listenOnce(Ko.COMPLETE,()=>{try{switch(o.getLastErrorCode()){case Wo.NO_ERROR:const t=o.getResponseJson();au(yp,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(t)),s(t);break;case Wo.TIMEOUT:au(yp,`RPC '${e}' ${i} timed out`),a(new gu(fu.DEADLINE_EXCEEDED,"Request time out"));break;case Wo.HTTP_ERROR:const n=o.getStatus();if(au(yp,`RPC '${e}' ${i} failed with status:`,n,"response text:",o.getResponseText()),n>0){let e=o.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(fu).indexOf(t)>=0?t:fu.UNKNOWN}(t.status);a(new gu(e,t.message))}else a(new gu(fu.UNKNOWN,"Server responded with status "+o.getStatus()))}else a(new gu(fu.UNAVAILABLE,"Connection failed."));break;default:lu(9055,{_n:e,streamId:i,an:o.getLastErrorCode(),un:o.getLastError()})}}finally{au(yp,`RPC '${e}' ${i} completed.`)}});const c=JSON.stringify(r);au(yp,`RPC '${e}' ${i} sending request:`,r),o.send(t,"POST",c,n,15)})}cn(e,t,n){const r=dp(),s=[this.Mt,"/","google.firestore.v1.Firestore","/",e,"/channel"],i=this.createWebChannelTransport(),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},o=this.longPollingOptions.timeoutSeconds;void 0!==o&&(a.longPollingTimeout=Math.round(1e3*o)),this.useFetchStreams&&(a.useFetchStreams=!0),this.kt(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const c=s.join("");au(yp,`Creating RPC '${e}' stream ${r}: ${c}`,a);const u=i.createWebChannel(c,a);this.En(u);let l=!1,h=!1;const d=new mp({Kt:t=>{h?au(yp,`Not sending because RPC '${e}' stream ${r} is closed:`,t):(l||(au(yp,`Opening RPC '${e}' stream ${r} transport.`),u.open(),l=!0),au(yp,`RPC '${e}' stream ${r} sending:`,t),u.send(t))},Wt:()=>u.close()});return _p(u,Go.EventType.OPEN,()=>{h||(au(yp,`RPC '${e}' stream ${r} transport opened.`),d.Zt())}),_p(u,Go.EventType.CLOSE,()=>{h||(h=!0,au(yp,`RPC '${e}' stream ${r} transport closed`),d.en(),this.hn(u))}),_p(u,Go.EventType.ERROR,t=>{h||(h=!0,cu(yp,`RPC '${e}' stream ${r} transport errored. Name:`,t.name,"Message:",t.message),d.en(new gu(fu.UNAVAILABLE,"The operation could not be completed")))}),_p(u,Go.EventType.MESSAGE,t=>{if(!h){const n=t.data[0];du(!!n,16349);const s=n,i=s?.error||s[0]?.error;if(i){au(yp,`RPC '${e}' stream ${r} received error:`,i);const t=i.status;let n=function(e){const t=Td[e];if(void 0!==t)return function(e){if(void 0===e)return ou("GRPC error has no .code"),fu.UNKNOWN;switch(e){case Td.OK:return fu.OK;case Td.CANCELLED:return fu.CANCELLED;case Td.UNKNOWN:return fu.UNKNOWN;case Td.DEADLINE_EXCEEDED:return fu.DEADLINE_EXCEEDED;case Td.RESOURCE_EXHAUSTED:return fu.RESOURCE_EXHAUSTED;case Td.INTERNAL:return fu.INTERNAL;case Td.UNAVAILABLE:return fu.UNAVAILABLE;case Td.UNAUTHENTICATED:return fu.UNAUTHENTICATED;case Td.INVALID_ARGUMENT:return fu.INVALID_ARGUMENT;case Td.NOT_FOUND:return fu.NOT_FOUND;case Td.ALREADY_EXISTS:return fu.ALREADY_EXISTS;case Td.PERMISSION_DENIED:return fu.PERMISSION_DENIED;case Td.FAILED_PRECONDITION:return fu.FAILED_PRECONDITION;case Td.ABORTED:return fu.ABORTED;case Td.OUT_OF_RANGE:return fu.OUT_OF_RANGE;case Td.UNIMPLEMENTED:return fu.UNIMPLEMENTED;case Td.DATA_LOSS:return fu.DATA_LOSS;default:return lu(39323,{code:e})}}(t)}(t),s=i.message;"NOT_FOUND"===t&&s.includes("database")&&s.includes("does not exist")&&s.includes(this.databaseId.database)&&cu(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),void 0===n&&(n=fu.INTERNAL,s="Unknown error status: "+t+" with message "+i.message),h=!0,d.en(new gu(n,s)),u.close()}else au(yp,`RPC '${e}' stream ${r} received:`,n),d.tn(n)}}),wp.rn(),setTimeout(()=>{d.Xt()},0),d}terminate(){this.nn.forEach(e=>e.close()),this.nn=[]}En(e){this.nn.push(e)}hn(e){this.nn=this.nn.filter(t=>t===e)}kt(e,t,n){super.kt(e,t,n),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return Jo()}}wp.sn=!1;class vp{constructor(e,t,n=1e3,r=1.5,s=6e4){this.Tn=e,this.timerId=t,this.Pn=n,this.Rn=r,this.In=s,this.An=0,this.Vn=null,this.dn=Date.now(),this.reset()}reset(){this.An=0}fn(){this.An=this.In}mn(e){this.cancel();const t=Math.floor(this.An+this.pn()),n=Math.max(0,Date.now()-this.dn),r=Math.max(0,t-n);r>0&&au("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.An} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Vn=this.Tn.enqueueAfterDelay(this.timerId,r,()=>(this.dn=Date.now(),e())),this.An*=this.Rn,this.An<this.Pn&&(this.An=this.Pn),this.An>this.In&&(this.An=this.In)}gn(){null!==this.Vn&&(this.Vn.skipDelay(),this.Vn=null)}cancel(){null!==this.Vn&&(this.Vn.cancel(),this.Vn=null)}pn(){return(Math.random()-.5)*this.An}}const bp="PersistentStream";class Ep{constructor(e,t,n,r,s,i,a,o){this.Tn=e,this.yn=n,this.wn=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=a,this.listener=o,this.state=0,this.bn=0,this.vn=null,this.Sn=null,this.stream=null,this.Dn=0,this.xn=new vp(e,t)}Cn(){return 1===this.state||5===this.state||this.Fn()}Fn(){return 2===this.state||3===this.state}start(){this.Dn=0,4!==this.state?this.auth():this.On()}async stop(){this.Cn()&&await this.close(0)}Mn(){this.state=0,this.xn.reset()}Nn(){this.Fn()&&null===this.vn&&(this.vn=this.Tn.enqueueAfterDelay(this.yn,6e4,()=>this.Ln()))}Bn(e){this.Un(),this.stream.send(e)}async Ln(){if(this.Fn())return this.close(0)}Un(){this.vn&&(this.vn.cancel(),this.vn=null)}kn(){this.Sn&&(this.Sn.cancel(),this.Sn=null)}async close(e,t){this.Un(),this.kn(),this.xn.cancel(),this.bn++,4!==e?this.xn.reset():t&&t.code===fu.RESOURCE_EXHAUSTED?(ou(t.toString()),ou("Using maximum backoff delay to prevent overloading the backend."),this.xn.fn()):t&&t.code===fu.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.qn(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Ht(t)}qn(){}auth(){this.state=1;const e=this.$n(this.bn),t=this.bn;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.bn===t&&this.Kn(e,n)},t=>{e(()=>{const e=new gu(fu.UNKNOWN,"Fetching auth token failed: "+t.message);return this.Wn(e)})})}Kn(e,t){const n=this.$n(this.bn);this.stream=this.Qn(e,t),this.stream.Qt(()=>{n(()=>this.listener.Qt())}),this.stream.zt(()=>{n(()=>(this.state=2,this.Sn=this.Tn.enqueueAfterDelay(this.wn,1e4,()=>(this.Fn()&&(this.state=3),Promise.resolve())),this.listener.zt()))}),this.stream.Ht(e=>{n(()=>this.Wn(e))}),this.stream.onMessage(e=>{n(()=>1==++this.Dn?this.Gn(e):this.onNext(e))})}On(){this.state=5,this.xn.mn(async()=>{this.state=0,this.start()})}Wn(e){return au(bp,`close with error: ${e}`),this.stream=null,this.close(4,e)}$n(e){return t=>{this.Tn.enqueueAndForget(()=>this.bn===e?t():(au(bp,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class Tp extends Ep{constructor(e,t,n,r,s,i){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,r,i),this.serializer=s}get Jn(){return this.Dn>0}start(){this.lastStreamToken=void 0,super.start()}qn(){this.Jn&&this.Yn([])}Qn(e,t){return this.connection.cn("Write",e,t)}Gn(e){return du(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,du(!e.writeResults||0===e.writeResults.length,55816),this.listener.Zn()}onNext(e){du(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.xn.reset();const t=function(e,t){return e&&e.length>0?(du(void 0!==t,14353),e.map(e=>function(e,t){let n=e.updateTime?Hd(e.updateTime):Hd(t);return n.isEqual(Wu.min())&&(n=Hd(t)),new Ih(n,e.transformResults||[])}(e,t))):[]}(e.writeResults,e.commitTime),n=Hd(e.commitTime);return this.listener.Xn(n,t)}er(){const e={};e.database=function(e){return new Lu(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}(this.serializer),this.Bn(e)}Yn(e){const t={streamToken:this.lastStreamToken,writes:e.map(e=>function(e,t){let n;if(t instanceof Lh)n={update:Wd(e,t.key,t.value)};else if(t instanceof $h)n={delete:Gd(e,t.key)};else if(t instanceof Uh)n={update:Wd(e,t.key,t.data),updateMask:Jd(t.fieldMask)};else{if(!(t instanceof jh))return lu(16599,{gt:t.type});n={verify:Gd(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(e=>function(e,t){const n=t.transform;if(n instanceof fh)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof gh)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof yh)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof vh)return{fieldPath:t.field.canonicalString(),increment:n.Re};if(n instanceof bh)return{fieldPath:t.field.canonicalString(),minimum:n.Re};if(n instanceof Eh)return{fieldPath:t.field.canonicalString(),maximum:n.Re};throw lu(20930,{transform:t.transform})}(0,e))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:Bd(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:lu(27497)}(e,t.precondition)),n}(this.serializer,e))};this.Bn(t)}}class Sp{}class Ap extends Sp{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.tr=!1}nr(){if(this.tr)throw new gu(fu.FAILED_PRECONDITION,"The client has already been terminated.")}Bt(e,t,n,r){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,i])=>this.connection.Bt(e,qd(t,n),r,s,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===fu.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new gu(fu.UNKNOWN,e.toString())})}$t(e,t,n,r,s){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,a])=>this.connection.$t(e,qd(t,n),r,i,a,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===fu.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new gu(fu.UNKNOWN,e.toString())})}terminate(){this.tr=!0,this.connection.terminate()}}const Ip=new Map;const Cp={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Op=41943040;class Rp{static withCacheSize(e){return new Rp(e,Rp.DEFAULT_COLLECTION_PERCENTILE,Rp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}}Rp.DEFAULT_COLLECTION_PERCENTILE=10,Rp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Rp.DEFAULT=new Rp(Op,Rp.DEFAULT_COLLECTION_PERCENTILE,Rp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Rp.DISABLED=new Rp(-1,0,0);const kp="LruGarbageCollector";function Np([e,t],[n,r]){const s=Cu(e,n);return 0===s?Cu(t,r):s}class xp{constructor(e){this.rr=e,this.buffer=new ll(Np),this.ir=0}sr(){return++this.ir}_r(e){const t=[e,this.sr()];if(this.buffer.size<this.rr)this.buffer=this.buffer.add(t);else{const e=this.buffer.last();Np(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}}class Pp{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.ar=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.ur(6e4)}stop(){this.ar&&(this.ar.cancel(),this.ar=null)}get started(){return null!==this.ar}ur(e){au(kp,`Garbage collection scheduled in ${e}ms`),this.ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){tl(e)?au(kp,"Ignoring IndexedDB error during garbage collection: ",e):await Zu(e)}await this.ur(3e5)})}}class Dp{constructor(e,t){this.cr=e,this.params=t}calculateTargetCount(e,t){return this.cr.lr(e).next(e=>Math.floor(t/100*e))}nthSequenceNumber(e,t){if(0===t)return el.resolve(nl.ce);const n=new xp(t);return this.cr.forEachTarget(e,e=>n._r(e.sequenceNumber)).next(()=>this.cr.Er(e,e=>n._r(e))).next(()=>n.maxValue)}removeTargets(e,t,n){return this.cr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.cr.removeOrphanedDocuments(e,t)}collect(e,t){return-1===this.params.cacheSizeCollectionThreshold?(au("LruGarbageCollector","Garbage collection skipped; disabled"),el.resolve(Cp)):this.getCacheSize(e).next(n=>n<this.params.cacheSizeCollectionThreshold?(au("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Cp):this.hr(e,t))}getCacheSize(e){return this.cr.getCacheSize(e)}hr(e,t){let n,r,s,i,a,o,c;const u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(t=>(t>this.params.maximumSequenceNumbersToCollect?(au("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),r=this.params.maximumSequenceNumbersToCollect):r=t,i=Date.now(),this.nthSequenceNumber(e,r))).next(r=>(n=r,a=Date.now(),this.removeTargets(e,n,t))).next(t=>(s=t,o=Date.now(),this.removeOrphanedDocuments(e,n))).next(e=>(c=Date.now(),iu()<=cr.DEBUG&&au("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${i-u}ms\n\tDetermined least recently used ${r} in `+(a-i)+"ms\n"+`\tRemoved ${s} targets in `+(o-a)+"ms\n"+`\tRemoved ${e} documents in `+(c-o)+"ms\n"+`Total Duration: ${c-u}ms`),el.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:s,documentsRemoved:e})))}}const Lp="firestore.googleapis.com",Up=!0;class Mp{constructor(e){if(void 0===e.host){if(void 0!==e.ssl)throw new gu(fu.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Lp,this.ssl=Up}else this.host=e.host,this.ssl=e.ssl??Up;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=Op;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new gu(fu.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,r){if(!0===t&&!0===r)throw new gu(fu.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=op(e.experimentalLongPollingOptions??{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new gu(fu.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new gu(fu.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new gu(fu.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 Vp{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 Mp({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new gu(fu.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 gu(fu.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 Mp(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new _u;switch(e.type){case"firstParty":return new Eu(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new gu(fu.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=Ip.get(e);t&&(au("ComponentProvider","Removing Datastore"),Ip.delete(e),t.terminate())}(this),Promise.resolve()}}class Fp{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new Fp(this.firestore,e,this._query)}}class $p{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 jp(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new $p(this.firestore,e,this._key)}toJSON(){return{type:$p._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(zu(t,$p._jsonSchema))return new $p(e,n||null,new Vu(Lu.fromString(t.referencePath)))}}$p._jsonSchemaVersion="firestore/documentReference/1.0",$p._jsonSchema={type:Hu("string",$p._jsonSchemaVersion),referencePath:Hu("string")};class jp extends Fp{constructor(e,t,n){super(e,t,function(e){return new fd(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 $p(this.firestore,null,new Vu(e))}withConverter(e){return new jp(this.firestore,e,this._path)}}function Bp(e,t,...n){if(e=tr(e),1===arguments.length&&(t=Iu.newId()),function(e,t,n){if(!n)throw new gu(fu.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}("doc","path",t),e instanceof Vp){const r=Lu.fromString(t,...n);return Fu(r),new $p(e,null,new Vu(r))}{if(!(e instanceof $p||e instanceof jp))throw new gu(fu.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(Lu.fromString(t,...n));return Fu(r),new $p(e.firestore,e instanceof jp?e.converter:null,new Vu(r))}}class Hp{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:Hp._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(zu(e,Hp._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new Hp(e.vectorValues);throw new gu(fu.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}function zp(e,t,n){if(qp(e=tr(e)))return function(e,t,n){if(!qp(n)||!$u(n)){const r=ju(n);throw"an object"===r?t.createError(e+" a custom object"):t.createError(e+" "+r)}}("Unsupported field value:",t,e),function(e,t){const n={};return gl(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):fl(e,(e,r)=>{const s=zp(r,t.childContextForField(e));null!=s&&(n[e]=s)}),{mapValue:{fields:n}}}(e,t);if(e instanceof ip)return function(e,t){if(!function(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw lu(40011,{dataSource:e})}}(t.dataSource))throw t.createError(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.createError(`${e._methodName}() is not currently supported inside arrays`);const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.arrayElement&&4!==t.dataSource)throw t.createError("Nested arrays are not supported");return function(e,t){const n=[];let r=0;for(const s of e){let e=zp(s,t.childContextForArray(r));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),r++}return{arrayValue:{values:n}}}(e,t)}return function(e,t,n){if(null===(e=tr(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return uh(t.serializer,e,n);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=Ku.fromDate(e);return{timestampValue:Fd(t.serializer,n)}}if(e instanceof Ku){const n=new Ku(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Fd(t.serializer,n)}}if(e instanceof ap)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof rp)return{bytesValue:jd(t.serializer,e._byteString)};if(e instanceof $p){const n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.createError(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:zd(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof Hp)return function(e,t){const n=e instanceof Hp?e.toArray():e,r={fields:{[xl]:{stringValue:Ll},[Ul]:{arrayValue:{values:n.map(e=>{if("number"!=typeof e)throw t.createError("VectorValues must only contain numeric values.");return oh(t.serializer,e)})}}}};return{mapValue:r}}(e,t);if(Zd(e))return e._toProto(t.serializer);throw t.createError(`Unsupported field value: ${ju(e)}`)}(e,t,n)}function qp(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof Ku||e instanceof ap||e instanceof rp||e instanceof $p||e instanceof ip||e instanceof Hp||Zd(e))}function Gp(e,t,n){if((t=tr(t))instanceof sp)return t._internalPath;if("string"==typeof t)return function(e,t){if(t.search(Kp)>=0)throw Wp(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e);try{return new sp(...t.split("."))._internalPath}catch(n){throw Wp(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e)}}(e,t);throw Wp("Field path arguments must be of type string or ",e)}Hp._jsonSchemaVersion="firestore/vectorValue/1.0",Hp._jsonSchema={type:Hu("string",Hp._jsonSchemaVersion),vectorValues:Hu("object")};const Kp=new RegExp("[~\\*/\\[\\]]");function Wp(e,t,n,r,s){let i=`Function ${t}() called with invalid data`;i+=". ";return new gu(fu.INVALID_ARGUMENT,i+e+"")}class Yp{constructor(e){this.optionDefinitions=e}_getKnownOptions(e,t){const n=ih.empty();for(const r in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(r)){const s=this.optionDefinitions[r];if(r in e){const i=e[r];let a;s.nestedOptions&&$u(i)?a={mapValue:{fields:new Yp(s.nestedOptions).getOptionsProto(t,i)}}:i&&(a=zp(i,t)??void 0),a&&n.set(Mu.fromServerFormat(s.serverName),a)}}return n}getOptionsProto(e,t,n){const r=this._getKnownOptions(t,e);if(n){const t=new Map(function(e,t){const n=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.push(t(e[r],r,e));return n}(n,(t,n)=>[Mu.fromServerFormat(n),void 0!==t?zp(t,e):null]));r.setAll(t)}return r.value.mapValue.fields??{}}}function Xp(e){let t;return e instanceof Zp?e:(t=$u(e)?function(e){const t=[];for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const r=e[n];t.push(of(n)),t.push(Xp(r))}return new uf("map",t,"map")}(e):e instanceof Array?function(e){return function(e,t){return new uf("array",e.map(e=>Xp(e)),t)}(e,"array")}(e):cf(e,void 0),t)}function Qp(e){if(e instanceof Zp)return e;if(e instanceof Hp)return of(e);if(Array.isArray(e))return of(function(e){return new Hp(e)}(e));throw new Error("Unsupported value: "+typeof e)}function Jp(e){return function(e){return"string"==typeof e}(e)?function(e){return function(e,t){return new sf("string"==typeof e?Pu===e?new sp(Pu)._internalPath:Gp("field",e):e._internalPath,t)}(e,"field")}(e):Xp(e)}class Zp{constructor(){this._protoValueType="ProtoValue"}add(e){return new uf("add",[this,Xp(e)],"add")}asBoolean(){if(this instanceof lf)return this;if(this instanceof af)return new df(this);if(this instanceof sf)return new pf(this);if(this instanceof uf)return new hf(this);throw new gu("invalid-argument",`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(e){return new uf("subtract",[this,Xp(e)],"subtract")}multiply(e){return new uf("multiply",[this,Xp(e)],"multiply")}divide(e){return new uf("divide",[this,Xp(e)],"divide")}mod(e){return new uf("mod",[this,Xp(e)],"mod")}equal(e){return new uf("equal",[this,Xp(e)],"equal").asBoolean()}notEqual(e){return new uf("not_equal",[this,Xp(e)],"notEqual").asBoolean()}lessThan(e){return new uf("less_than",[this,Xp(e)],"lessThan").asBoolean()}lessThanOrEqual(e){return new uf("less_than_or_equal",[this,Xp(e)],"lessThanOrEqual").asBoolean()}greaterThan(e){return new uf("greater_than",[this,Xp(e)],"greaterThan").asBoolean()}greaterThanOrEqual(e){return new uf("greater_than_or_equal",[this,Xp(e)],"greaterThanOrEqual").asBoolean()}arrayConcat(e,...t){const n=[e,...t].map(e=>Xp(e));return new uf("array_concat",[this,...n],"arrayConcat")}arrayContains(e){return new uf("array_contains",[this,Xp(e)],"arrayContains").asBoolean()}arrayContainsAll(e){const t=Array.isArray(e)?new rf(e.map(Xp),"arrayContainsAll"):e;return new uf("array_contains_all",[this,t],"arrayContainsAll").asBoolean()}arrayContainsAny(e){const t=Array.isArray(e)?new rf(e.map(Xp),"arrayContainsAny"):e;return new uf("array_contains_any",[this,t],"arrayContainsAny").asBoolean()}arrayReverse(){return new uf("array_reverse",[this])}arrayLength(){return new uf("array_length",[this],"arrayLength")}equalAny(e){const t=Array.isArray(e)?new rf(e.map(Xp),"equalAny"):e;return new uf("equal_any",[this,t],"equalAny").asBoolean()}notEqualAny(e){const t=Array.isArray(e)?new rf(e.map(Xp),"notEqualAny"):e;return new uf("not_equal_any",[this,t],"notEqualAny").asBoolean()}exists(){return new uf("exists",[this],"exists").asBoolean()}charLength(){return new uf("char_length",[this],"charLength")}like(e){return new uf("like",[this,Xp(e)],"like").asBoolean()}regexContains(e){return new uf("regex_contains",[this,Xp(e)],"regexContains").asBoolean()}regexFind(e){return new uf("regex_find",[this,Xp(e)],"regexFind")}regexFindAll(e){return new uf("regex_find_all",[this,Xp(e)],"regexFindAll")}regexMatch(e){return new uf("regex_match",[this,Xp(e)],"regexMatch").asBoolean()}stringContains(e){return new uf("string_contains",[this,Xp(e)],"stringContains").asBoolean()}startsWith(e){return new uf("starts_with",[this,Xp(e)],"startsWith").asBoolean()}endsWith(e){return new uf("ends_with",[this,Xp(e)],"endsWith").asBoolean()}toLower(){return new uf("to_lower",[this],"toLower")}toUpper(){return new uf("to_upper",[this],"toUpper")}trim(e){const t=[this];return e&&t.push(Xp(e)),new uf("trim",t,"trim")}ltrim(e){const t=[this];return e&&t.push(Xp(e)),new uf("ltrim",t,"ltrim")}rtrim(e){const t=[this];return e&&t.push(Xp(e)),new uf("rtrim",t,"rtrim")}type(){return new uf("type",[this])}isType(e){return new uf("is_type",[this,of(e)],"isType").asBoolean()}stringConcat(e,...t){const n=[e,...t].map(Xp);return new uf("string_concat",[this,...n],"stringConcat")}stringIndexOf(e){return new uf("string_index_of",[this,Xp(e)],"stringIndexOf")}stringRepeat(e){return new uf("string_repeat",[this,Xp(e)],"stringRepeat")}stringReplaceAll(e,t){return new uf("string_replace_all",[this,Xp(e),Xp(t)],"stringReplaceAll")}stringReplaceOne(e,t){return new uf("string_replace_one",[this,Xp(e),Xp(t)],"stringReplaceOne")}concat(e,...t){const n=[e,...t].map(Xp);return new uf("concat",[this,...n],"concat")}reverse(){return new uf("reverse",[this],"reverse")}arrayFilter(e,t){return new uf("array_filter",[this,Xp(e),t],"arrayFilter")}arrayTransform(e,t){return new uf("array_transform",[this,Xp(e),t],"arrayTransform")}arrayTransformWithIndex(e,t,n){return new uf("array_transform",[this,Xp(e),Xp(t),n],"arrayTransformWithIndex")}arraySlice(e,t){const n=[this,Xp(e)];return void 0!==t&&n.push(Xp(t)),new uf("array_slice",n,"arraySlice")}arrayFirst(){return new uf("array_first",[this],"arrayFirst")}arrayFirstN(e){return new uf("array_first_n",[this,Xp(e)],"arrayFirstN")}arrayLast(){return new uf("array_last",[this],"arrayLast")}arrayLastN(e){return new uf("array_last_n",[this,Xp(e)],"arrayLastN")}arrayMaximum(){return new uf("maximum",[this],"arrayMaximum")}arrayMaximumN(e){return new uf("maximum_n",[this,Xp(e)],"arrayMaximumN")}arrayMinimum(){return new uf("minimum",[this],"arrayMinimum")}arrayMinimumN(e){return new uf("minimum_n",[this,Xp(e)],"arrayMinimumN")}arrayIndexOf(e){return new uf("array_index_of",[this,Xp(e),Xp("first")],"arrayIndexOf")}arrayLastIndexOf(e){return new uf("array_index_of",[this,Xp(e),Xp("last")],"arrayLastIndexOf")}arrayIndexOfAll(e){return new uf("array_index_of_all",[this,Xp(e)],"arrayIndexOfAll")}byteLength(){return new uf("byte_length",[this],"byteLength")}ceil(){return new uf("ceil",[this])}floor(){return new uf("floor",[this])}abs(){return new uf("abs",[this])}exp(){return new uf("exp",[this])}mapGet(e){return new uf("map_get",[this,of(e)],"mapGet")}mapSet(e,t,...n){const r=[this,Xp(e),Xp(t),...n.map(Xp)];return new uf("map_set",r,"mapSet")}mapKeys(){return new uf("map_keys",[this],"mapKeys")}mapValues(){return new uf("map_values",[this],"mapValues")}mapEntries(){return new uf("map_entries",[this],"mapEntries")}getField(e){return new uf("get_field",[this,Xp(e)],"get_field")}count(){return ef._create("count",[this],"count")}sum(){return ef._create("sum",[this],"sum")}average(){return ef._create("average",[this],"average")}minimum(){return ef._create("minimum",[this],"minimum")}maximum(){return ef._create("maximum",[this],"maximum")}first(){return ef._create("first",[this],"first")}last(){return ef._create("last",[this],"last")}arrayAgg(){return ef._create("array_agg",[this],"arrayAgg")}arrayAggDistinct(){return ef._create("array_agg_distinct",[this],"arrayAggDistinct")}countDistinct(){return ef._create("count_distinct",[this],"countDistinct")}logicalMaximum(e,...t){const n=[e,...t];return new uf("maximum",[this,...n.map(Xp)],"logicalMaximum")}logicalMinimum(e,...t){const n=[e,...t];return new uf("minimum",[this,...n.map(Xp)],"minimum")}vectorLength(){return new uf("vector_length",[this],"vectorLength")}cosineDistance(e){return new uf("cosine_distance",[this,Qp(e)],"cosineDistance")}dotProduct(e){return new uf("dot_product",[this,Qp(e)],"dotProduct")}euclideanDistance(e){return new uf("euclidean_distance",[this,Qp(e)],"euclideanDistance")}unixMicrosToTimestamp(){return new uf("unix_micros_to_timestamp",[this],"unixMicrosToTimestamp")}timestampToUnixMicros(){return new uf("timestamp_to_unix_micros",[this],"timestampToUnixMicros")}unixMillisToTimestamp(){return new uf("unix_millis_to_timestamp",[this],"unixMillisToTimestamp")}timestampToUnixMillis(){return new uf("timestamp_to_unix_millis",[this],"timestampToUnixMillis")}unixSecondsToTimestamp(){return new uf("unix_seconds_to_timestamp",[this],"unixSecondsToTimestamp")}timestampToUnixSeconds(){return new uf("timestamp_to_unix_seconds",[this],"timestampToUnixSeconds")}timestampAdd(e,t){return new uf("timestamp_add",[this,Xp(e),Xp(t)],"timestampAdd")}timestampSubtract(e,t){return new uf("timestamp_subtract",[this,Xp(e),Xp(t)],"timestampSubtract")}timestampDiff(e,t){return new uf("timestamp_diff",[this,Jp(e),Xp(t)],"timestampDiff")}timestampExtract(e,t){const n=[this,Xp(e)];return t&&n.push(Xp(t)),new uf("timestamp_extract",n,"timestampExtract")}documentId(){return new uf("document_id",[this],"documentId")}parent(){return new uf("parent",[this],"parent")}substring(e,t){const n=Xp(e);return new uf("substring",void 0===t?[this,n]:[this,n,Xp(t)],"substring")}arrayGet(e){return new uf("array_get",[this,Xp(e)],"arrayGet")}isError(){return new uf("is_error",[this],"isError").asBoolean()}ifError(e){const t=new uf("if_error",[this,Xp(e)],"ifError");return e instanceof lf?t.asBoolean():t}isAbsent(){return new uf("is_absent",[this],"isAbsent").asBoolean()}mapRemove(e){return new uf("map_remove",[this,Xp(e)],"mapRemove")}mapMerge(e,...t){const n=Xp(e),r=t.map(Xp);return new uf("map_merge",[this,n,...r],"mapMerge")}pow(e){return new uf("pow",[this,Xp(e)])}trunc(e){return void 0===e?new uf("trunc",[this]):new uf("trunc",[this,Xp(e)],"trunc")}round(e){return void 0===e?new uf("round",[this]):new uf("round",[this,Xp(e)],"round")}collectionId(){return new uf("collection_id",[this])}length(){return new uf("length",[this])}ln(){return new uf("ln",[this])}sqrt(){return new uf("sqrt",[this])}stringReverse(){return new uf("string_reverse",[this])}ifAbsent(e){return new uf("if_absent",[this,Xp(e)],"ifAbsent")}ifNull(e){return new uf("if_null",[this,Xp(e)],"ifNull")}coalesce(e,...t){return new uf("coalesce",[this,Xp(e),...t.map(Xp)],"coalesce")}join(e){return new uf("join",[this,Xp(e)],"join")}log10(){return new uf("log10",[this])}arraySum(){return new uf("sum",[this])}split(e){return new uf("split",[this,Xp(e)])}timestampTruncate(e,t){const n=[this,Xp(e)];return t&&n.push(Xp(t)),new uf("timestamp_trunc",n)}ascending(){return function(e){return new ff(Jp(e),"ascending","ascending")}(this)}descending(){return function(e){return new ff(Jp(e),"descending","descending")}(this)}as(e){return new nf(this,e,"as")}}class ef{constructor(e,t){this.name=e,this.params=t,this.exprType="AggregateFunction",this._protoValueType="ProtoValue"}static _create(e,t,n){const r=new ef(e,t);return r._methodName=n,r}as(e){return new tf(this,e,"as")}_toProto(e){return{functionValue:{name:this.name,args:this.params.map(t=>t._toProto(e))}}}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach(t=>t._readUserData(e))}}class tf{constructor(e,t,n){this.aggregate=e,this.alias=t,this._methodName=n}_readUserData(e){this.aggregate._readUserData(e)}}class nf{constructor(e,t,n){this.expr=e,this.alias=t,this._methodName=n,this.exprType="AliasedExpression",this.selectable=!0}_readUserData(e){this.expr._readUserData(e)}}class rf extends Zp{constructor(e,t){super(),this.Rr=e,this._methodName=t,this.expressionType="ListOfExpressions"}_toProto(e){return{arrayValue:{values:this.Rr.map(t=>t._toProto(e))}}}_readUserData(e){this.Rr.forEach(t=>t._readUserData(e))}}class sf extends Zp{constructor(e,t){super(),this.fieldPath=e,this._methodName=t,this.expressionType="Field",this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(e){return new uf("geo_distance",[this,Xp(e)],"geoDistance")}_toProto(e){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(e){}}class af extends Zp{constructor(e,t){super(),this.value=e,this._methodName=t,this.expressionType="Constant"}static _fromProto(e){const t=new af(e,void 0);return t._protoValue=e,t}_toProto(e){return du(void 0!==this._protoValue,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,function(e){return"object"==typeof e&&null!==e&&!!("nullValue"in e&&(null===e.nullValue||"NULL_VALUE"===e.nullValue)||"booleanValue"in e&&(null===e.booleanValue||"boolean"==typeof e.booleanValue)||"integerValue"in e&&(null===e.integerValue||"number"==typeof e.integerValue||"string"==typeof e.integerValue)||"doubleValue"in e&&(null===e.doubleValue||"number"==typeof e.doubleValue)||"timestampValue"in e&&(null===e.timestampValue||function(e){return"object"==typeof e&&null!==e&&"seconds"in e&&(null===e.seconds||"number"==typeof e.seconds||"string"==typeof e.seconds)&&"nanos"in e&&(null===e.nanos||"number"==typeof e.nanos)}(e.timestampValue))||"stringValue"in e&&(null===e.stringValue||"string"==typeof e.stringValue)||"bytesValue"in e&&(null===e.bytesValue||e.bytesValue instanceof Uint8Array)||"referenceValue"in e&&(null===e.referenceValue||"string"==typeof e.referenceValue)||"geoPointValue"in e&&(null===e.geoPointValue||function(e){return"object"==typeof e&&null!==e&&"latitude"in e&&(null===e.latitude||"number"==typeof e.latitude)&&"longitude"in e&&(null===e.longitude||"number"==typeof e.longitude)}(e.geoPointValue))||"arrayValue"in e&&(null===e.arrayValue||function(e){return"object"==typeof e&&null!==e&&!(!("values"in e)||null!==e.values&&!Array.isArray(e.values))}(e.arrayValue))||"mapValue"in e&&(null===e.mapValue||function(e){return"object"==typeof e&&null!==e&&!(!("fields"in e)||null!==e.fields&&!$u(e.fields))}(e.mapValue))||"fieldReferenceValue"in e&&(null===e.fieldReferenceValue||"string"==typeof e.fieldReferenceValue)||"functionValue"in e&&(null===e.functionValue||function(e){return"object"==typeof e&&null!==e&&!(!("name"in e)||null!==e.name&&"string"!=typeof e.name||!("args"in e)||null!==e.args&&!Array.isArray(e.args))}(e.functionValue))||"pipelineValue"in e&&(null===e.pipelineValue||function(e){return"object"==typeof e&&null!==e&&!(!("stages"in e)||null!==e.stages&&!Array.isArray(e.stages))}(e.pipelineValue)))}(this._protoValue)||(this._protoValue=zp(this.value,e))}}function of(e,t){return cf(e,"constant")}function cf(e,t){const n=new af(e,t);return"boolean"==typeof e?new df(n):n}class uf extends Zp{constructor(e,t,n,r){super(),this.name=e,this.params=t,this.expressionType="Function",this._optionsProto=void 0,void 0!==n&&(this._methodName=n),void 0!==r&&(this._options=r)}get _optionsUtil(){return new Yp({})}_toProto(e){const t={functionValue:{name:this.name,args:this.params.map(t=>t._toProto(e))}};return this._optionsProto&&(t.functionValue.options=this._optionsProto),t}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach(t=>t._readUserData(e)),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(e,this._options))}}class lf extends Zp{get _methodName(){return this._expr._methodName}countIf(){return ef._create("count_if",[this],"countIf")}not(){return new uf("not",[this],"not").asBoolean()}conditional(e,t){return new uf("conditional",[this,e,t],"conditional")}ifError(e){const t=Xp(e),n=new uf("if_error",[this,t],"ifError");return t instanceof lf?n.asBoolean():n}_toProto(e){return this._expr._toProto(e)}_readUserData(e){this._expr._readUserData(e)}}class hf extends lf{constructor(e){super(),this._expr=e,this.expressionType="Function"}}class df extends lf{constructor(e){super(),this._expr=e,this.expressionType="Constant"}_getValue(){return this._expr._getValue()}}class pf extends lf{constructor(e){super(),this._expr=e,this.expressionType="Field"}}class ff{constructor(e,t,n){this.expr=e,this.direction=t,this._methodName=n,this._protoValueType="ProtoValue"}_toProto(e){return{mapValue:{fields:{direction:tp(this.direction),expression:this.expr._toProto(e)}}}}_readUserData(e){this.expr._readUserData(e)}}class gf{constructor(e){this.optionsProto=void 0,({rawOptions:this.rawOptions,...this.knownOptions}=e)}_readUserData(e){this.optionsProto=this._optionsUtil.getOptionsProto(e,this.knownOptions,this.rawOptions)}_toProto(e){return{name:this._name,options:this.optionsProto}}}class mf extends gf{get _name(){return"add_fields"}get _optionsUtil(){return new Yp({})}constructor(e,t){super(t),this.fields=e}_toProto(e){return{...super._toProto(e),args:[ep(e,this.fields)]}}_readUserData(e){super._readUserData(e),Rf(this.fields,e)}}class yf extends gf{get _name(){return"aggregate"}get _optionsUtil(){return new Yp({})}constructor(e,t,n){super(n),this.groups=e,this.accumulators=t}_toProto(e){return{...super._toProto(e),args:[ep(e,this.accumulators),ep(e,this.groups)]}}_readUserData(e){super._readUserData(e),Rf(this.groups,e),Rf(this.accumulators,e)}}class _f extends gf{get _name(){return"distinct"}get _optionsUtil(){return new Yp({})}constructor(e,t){super(t),this.groups=e}_toProto(e){return{...super._toProto(e),args:[ep(e,this.groups)]}}_readUserData(e){super._readUserData(e),Rf(this.groups,e)}}class wf extends gf{get _name(){return"collection"}get _optionsUtil(){return new Yp({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.Vr=e.startsWith("/")?e:"/"+e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:this.Vr}]}}_readUserData(e){super._readUserData(e)}}class vf extends gf{get _name(){return"collection_group"}get _optionsUtil(){return new Yp({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.collectionId=e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:""},{stringValue:this.collectionId}]}}_readUserData(e){super._readUserData(e)}}class bf extends gf{get _name(){return"database"}get _optionsUtil(){return new Yp({})}_toProto(e){return{...super._toProto(e)}}_readUserData(e){super._readUserData(e)}}class Ef extends gf{get _name(){return"documents"}get _optionsUtil(){return new Yp({})}constructor(e,t){if(super(t),!e||0===e.length)throw new gu(fu.INVALID_ARGUMENT,"Empty document paths are not allowed in DocumentsSource");const n=e.map(e=>e.startsWith("/")?e:"/"+e),r=new Set(n);if(r.size!==n.length)throw new gu(fu.INVALID_ARGUMENT,"Duplicate document paths are not allowed in DocumentsSource");this.dr=n,this.mr=r}_toProto(e){return{...super._toProto(e),args:this.dr.map(e=>({referenceValue:e}))}}_readUserData(e){super._readUserData(e)}}class Tf extends gf{get _name(){return"where"}get _optionsUtil(){return new Yp({})}constructor(e,t){super(t),this.condition=e}_toProto(e){return{...super._toProto(e),args:[this.condition._toProto(e)]}}_readUserData(e){super._readUserData(e),Rf(this.condition,e)}}class Sf extends gf{get _name(){return"limit"}get _optionsUtil(){return new Yp({})}constructor(e,t){du(!isNaN(e)&&e!==1/0&&e!==-1/0,34860),super(t),this.limit=e}_toProto(e){return{...super._toProto(e),args:[uh(e,this.limit)]}}}class Af extends gf{get _name(){return"offset"}get _optionsUtil(){return new Yp({})}constructor(e,t){super(t),this.offset=e}_toProto(e){return{...super._toProto(e),args:[uh(e,this.offset)]}}}class If extends gf{get _name(){return"select"}get _optionsUtil(){return new Yp({})}constructor(e,t){super(t),this.selections=e}_toProto(e){return{...super._toProto(e),args:[ep(e,this.selections)]}}_readUserData(e){super._readUserData(e),Rf(this.selections,e)}}class Cf extends gf{get _name(){return"sort"}get _optionsUtil(){return new Yp({})}constructor(e,t){super(t),this.orderings=e}_toProto(e){return{...super._toProto(e),args:this.orderings.map(t=>t._toProto(e))}}_readUserData(e){super._readUserData(e),Rf(this.orderings,e)}}class Of extends gf{get _name(){return"replace_with"}get _optionsUtil(){return new Yp({})}constructor(e,t){super(t),this.map=e}_toProto(e){return{...super._toProto(e),args:[this.map._toProto(e),tp(Of.pr)]}}_readUserData(e){super._readUserData(e),Rf(this.map,e)}}function Rf(e,t){return function(e){return"function"==typeof e._readUserData}(e)?e._readUserData(t):Array.isArray(e)||e instanceof Map?e.forEach(e=>e._readUserData(t)):Object.values(e).forEach(e=>e._readUserData(t)),e}Of.pr="full_replace";class kf{constructor(e,t,n){this.serializer=e,this.stages=t,this.listenOptions=n,this.isCorePipeline=!0}getPipelineCollection(){return xf(this)}getPipelineCollectionGroup(){return Pf(this)}getPipelineCollectionId(){return function(e){switch(Nf(e)){case"collection":return Lu.fromString(xf(e)).lastSegment();case"collection_group":return Pf(e);default:return}}(this)}getPipelineDocuments(){return Df(this)}getPipelineFlavor(){return function(e){let t="exact";return e.stages.forEach((n,r)=>{n._name!==_f.name&&n._name!==yf.name||(t="keyless"),n._name===If.name&&"exact"===t&&(t="augmented"),n._name===mf.name&&r<e.stages.length-1&&"exact"===t&&(t="augmented")}),t}(this)}getPipelineSourceType(){return Nf(this)}}function Nf(e){const t=e.stages[0];return t instanceof wf||t instanceof vf||t instanceof bf||t instanceof Ef?t._name:"unknown"}function xf(e){if("collection"===Nf(e))return e.stages[0].Vr}function Pf(e){if("collection_group"===Nf(e))return e.stages[0].collectionId}function Df(e){if("documents"===Nf(e))return e.stages[0].dr}class Lf{constructor(e,t){this.type=e,this.value=t}static vr(){return new Lf("ERROR",void 0)}static Sr(){return new Lf("UNSET",void 0)}static Dr(){return new Lf("NULL",Ml)}static newValue(e){return Zl(e)?new Lf("NULL",Ml):function(e){return!!e&&"booleanValue"in e}(e)?new Lf("BOOLEAN",e):Yl(e)?new Lf("INT",e):Xl(e)?new Lf("DOUBLE",e):function(e){return!!e&&"timestampValue"in e&&!!e.timestampValue}(e)?new Lf("TIMESTAMP",e):function(e){return!!e&&"stringValue"in e}(e)?new Lf("STRING",e):function(e){return!!e&&"bytesValue"in e}(e)?new Lf("BYTES",e):e.referenceValue?new Lf("REFERENCE",e):e.geoPointValue?new Lf("GEO_POINT",e):Jl(e)?new Lf("ARRAY",e):nh(e)?new Lf("VECTOR",e):th(e)?new Lf("MAP",e):new Lf("ERROR",void 0)}Cr(){return"ERROR"===this.type||"UNSET"===this.type}Fr(){return"NULL"===this.type}}function Uf(e){if(!e.Cr())return e.value}function Mf(e){return e instanceof lf?e._expr:e}function Vf(e){if((e=Mf(e))instanceof sf)return new Ff(e);if(e instanceof af)return new $f(e);if(e instanceof rf)return new jf(e);if(e instanceof uf){if("add"===e.name)return new Wf(e);if("subtract"===e.name)return new Yf(e);if("multiply"===e.name)return new Xf(e);if("divide"===e.name)return new Qf(e);if("mod"===e.name)return new Jf(e);if("and"===e.name)return new Zf(e);if("equal"===e.name)return new gg(e);if("not_equal"===e.name)return new mg(e);if("less_than"===e.name)return new yg(e);if("less_than_or_equal"===e.name)return new _g(e);if("greater_than"===e.name)return new wg(e);if("greater_than_or_equal"===e.name)return new vg(e);if("array_concat"===e.name)return new bg(e);if("array_reverse"===e.name)return new Eg(e);if("array_contains"===e.name)return new Tg(e);if("array_contains_all"===e.name)return new Sg(e);if("array_contains_any"===e.name)return new Ag(e);if("array_length"===e.name)return new Ig(e);if("array_element"===e.name)return new Cg(e);if("equal_any"===e.name)return new rg(e);if("not_equal_any"===e.name)return new sg(e);if("is_nan"===e.name)return new ig(e);if("is_not_nan"===e.name)return new ag(e);if("is_null"===e.name)return new og(e);if("is_not_null"===e.name)return new cg(e);if("is_error"===e.name)return new ug(e);if("exists"===e.name)return new lg(e);if("not"===e.name)return new eg(e);if("or"===e.name)return new tg(e);if("xor"===e.name)return new ng(e);if("conditional"===e.name)return new hg(e);if("maximum"===e.name)return new dg(e);if("minimum"===e.name)return new pg(e);if("reverse"===e.name)return new Og(e);if("replace_first"===e.name)return new Rg(e);if("replace_all"===e.name)return new kg(e);if("char_length"===e.name)return new Ng(e);if("byte_length"===e.name)return new xg(e);if("like"===e.name)return new Dg(e);if("regex_contains"===e.name)return new Lg(e);if("regex_match"===e.name)return new Ug(e);if("string_contains"===e.name)return new Mg(e);if("starts_with"===e.name)return new Vg(e);if("ends_with"===e.name)return new Fg(e);if("to_lower"===e.name)return new $g(e);if("to_upper"===e.name)return new jg(e);if("trim"===e.name)return new Bg(e);if("string_concat"===e.name)return new Hg(e);if("map_get"===e.name)return new zg(e);if("cosine_distance"===e.name)return new Gg(e);if("dot_product"===e.name)return new Kg(e);if("euclidean_distance"===e.name)return new Wg(e);if("vector_length"===e.name)return new Yg(e);if("unix_micros_to_timestamp"===e.name)return new lm(e);if("timestamp_to_unix_micros"===e.name)return new fm(e);if("unix_millis_to_timestamp"===e.name)return new hm(e);if("timestamp_to_unix_millis"===e.name)return new gm(e);if("unix_seconds_to_timestamp"===e.name)return new dm(e);if("timestamp_to_unix_seconds"===e.name)return new mm(e);if("timestamp_add"===e.name)return new _m(e);if("timestamp_subtract"===e.name)return new wm(e)}throw new Error(`Unknown Expr : ${e}`)}class Ff{constructor(e){this.expr=e}evaluate(e,t){if(this.expr.fieldName===Pu)return Lf.newValue({referenceValue:Gd(e.serializer,t.key)});if("__update_time__"===this.expr.fieldName)return Lf.newValue({timestampValue:Bd(e.serializer,t.version)});if("__create_time__"===this.expr.fieldName)return Lf.newValue({timestampValue:Bd(e.serializer,t.createTime)});const n=t.data.field(this.expr._fieldPath);return n?Il(n)?Lf.newValue(function(e,t){if("estimate"===e.serverTimestampBehavior)return{timestampValue:Bd(e.serializer,Wu.fromTimestamp(Ol(t)))};if("previous"===e.serverTimestampBehavior){const e=Cl(t);if(e)return e}return{nullValue:"NULL_VALUE"}}(e,n)):Lf.newValue(n):Lf.Sr()}}class $f{constructor(e){this.expr=e}evaluate(e,t){return Lf.newValue(this.expr._getValue())}}class jf{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.Rr.map(n=>Vf(n).evaluate(e,t));return n.some(e=>e.Cr())?Lf.vr():Lf.newValue({arrayValue:{values:n.map(e=>e.value)}})}}function Bf(e){return Xl(e)?Number(e.doubleValue):Number(e.integerValue)}function Hf(e){return BigInt(e.integerValue)}const zf=BigInt("0x7fffffffffffffff"),qf=-BigInt("0x8000000000000000");class Gf{constructor(e){this.expr=e}evaluate(e,t){du(this.expr.params.length>=2,24778);const n=Vf(this.expr.params[0]).evaluate(e,t),r=Vf(this.expr.params[1]).evaluate(e,t);let s=this.Or(n,r);for(const n of this.expr.params.slice(2)){const r=Vf(n).evaluate(e,t);s=this.Or(s,r)}return s}Or(e,t){if(e.Cr()||t.Cr())return Lf.vr();if(e.Fr()||t.Fr())return Lf.Dr();const n=e.value,r=t.value;if(!Xl(n)&&!Yl(n)||!Xl(r)&&!Yl(r))return Lf.vr();if(Xl(n)||Xl(r)){const e=this.Mr(n,r);return e?Lf.newValue(e):Lf.vr()}if(Yl(n)&&Yl(r)){const e=this.Nr(n,r);return void 0===e?Lf.vr():"number"==typeof e?Lf.newValue({doubleValue:e}):e<qf||e>zf?Lf.vr():Lf.newValue({integerValue:`${e}`})}return Lf.vr()}}function Kf(e,t){return $l(e)!==$l(t)?"TYPE_MISMATCH":eh(e)||eh(t)?"NOT_EQ":Zl(e)&&Zl(t)?"EQ":Zl(e)||Zl(t)?"NULL":Jl(e)&&Jl(t)?function(e,t){if(e.values?.length!==t.values?.length)return"NOT_EQ";let n=!1;for(let r=0;r<(e.values?.length??0);r++){const s=e.values[r],i=t.values[r];switch(Kf(s,i)){case"EQ":break;case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":n=!0;break;default:lu(44609,{Lr:s,Br:i})}}return n?"NULL":"EQ"}(e.arrayValue,t.arrayValue):nh(e)&&nh(t)||th(e)&&th(t)?function(e,t){const n=e.fields||{},r=t.fields||{};if(pl(n)!==pl(r))return"NOT_EQ";let s=!1;for(const e in n)if(n.hasOwnProperty(e)){if(void 0===r[e])return"NOT_EQ";switch(Kf(n[e],r[e])){case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":s=!0}}return s?"NULL":"EQ"}(e.mapValue,t.mapValue):function(e,t){return jl(e,t,{Te:!1,Ee:!0,he:!0})}(e,t)?"EQ":"NOT_EQ"}class Wf extends Gf{Nr(e,t){return Hf(e)+Hf(t)}Mr(e,t){return{doubleValue:Bf(e)+Bf(t)}}}class Yf extends Gf{constructor(e){super(e),this.expr=e}Nr(e,t){return Hf(e)-Hf(t)}Mr(e,t){return{doubleValue:Bf(e)-Bf(t)}}}class Xf extends Gf{constructor(e){super(e),this.expr=e}Nr(e,t){return Hf(e)*Hf(t)}Mr(e,t){return{doubleValue:Bf(e)*Bf(t)}}}class Qf extends Gf{constructor(e){super(e),this.expr=e}Nr(e,t){const n=Hf(t);if(n!==BigInt(0))return Hf(e)/n}Mr(e,t){const n=Bf(t);return 0===n?{doubleValue:sl(n)?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}:{doubleValue:Bf(e)/n}}}class Jf extends Gf{constructor(e){super(e),this.expr=e}Nr(e,t){const n=Hf(t);if(n!==BigInt(0))return Hf(e)%n}Mr(e,t){const n=Bf(t);if(0!==n)return{doubleValue:Bf(e)%n}}}class Zf{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(const s of this.expr.params){const i=Vf(s).evaluate(e,t);switch(i.type){case"BOOLEAN":if(!i.value?.booleanValue)return Lf.newValue(Fl);break;case"NULL":r=!0;break;default:n=!0}}return n?Lf.vr():r?Lf.Dr():Lf.newValue(Vl)}}class eg{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,9634);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BOOLEAN":return Lf.newValue({booleanValue:!n.value?.booleanValue});case"NULL":return Lf.Dr();default:return Lf.vr()}}}class tg{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(const s of this.expr.params){const i=Vf(s).evaluate(e,t);switch(i.type){case"BOOLEAN":if(i.value?.booleanValue)return Lf.newValue(Vl);break;case"NULL":r=!0;break;default:n=!0}}return n?Lf.vr():r?Lf.Dr():Lf.newValue(Fl)}}class ng{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(const s of this.expr.params){const i=Vf(s).evaluate(e,t);switch(i.type){case"BOOLEAN":n=ng.xor(n,!!i.value?.booleanValue);break;case"NULL":r=!0;break;default:return Lf.vr()}}return r?Lf.Dr():Lf.newValue({booleanValue:n})}static xor(e,t){return(e||t)&&!(e&&t)}}class rg{constructor(e){this.expr=e}evaluate(e,t){du(2===this.expr.params.length,55094);let n=!1;const r=Vf(this.expr.params[0]).evaluate(e,t);switch(r.type){case"NULL":n=!0;break;case"ERROR":case"UNSET":return Lf.vr()}const s=Vf(this.expr.params[1]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.vr()}if(n)return Lf.Dr();for(const e of s.value?.arrayValue?.values??[])switch(Zl(r.value)&&Zl(e)?"EQ":Kf(r.value,e)){case"EQ":return Lf.newValue(Vl);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:lu(44608,{value:r.value,candidate:e})}return n?Lf.Dr():Lf.newValue(Fl)}}class sg{constructor(e){this.expr=e}evaluate(e,t){return new eg(new uf("not",[new uf("equal_any",this.expr.params)])).evaluate(e,t)}}class ig{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,23322);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"INT":return Lf.newValue(Fl);case"DOUBLE":return Lf.newValue({booleanValue:isNaN(Bf(n.value))});case"NULL":return Lf.Dr();default:return Lf.vr()}}}class ag{constructor(e){this.expr=e}evaluate(e,t){return du(1===this.expr.params.length,50406),new eg(new uf("not",[new uf("is_nan",this.expr.params)])).evaluate(e,t)}}class og{constructor(e){this.expr=e}evaluate(e,t){switch(du(1===this.expr.params.length,23123),Vf(this.expr.params[0]).evaluate(e,t).type){case"NULL":return Lf.newValue(Vl);case"UNSET":case"ERROR":return Lf.vr();default:return Lf.newValue(Fl)}}}class cg{constructor(e){this.expr=e}evaluate(e,t){return du(1===this.expr.params.length,23167),new eg(new uf("not",[new uf("is_null",this.expr.params)])).evaluate(e,t)}}class ug{constructor(e){this.expr=e}evaluate(e,t){return du(1===this.expr.params.length,5228),"ERROR"===Vf(this.expr.params[0]).evaluate(e,t).type?Lf.newValue(Vl):Lf.newValue(Fl)}}class lg{constructor(e){this.expr=e}evaluate(e,t){switch(du(1===this.expr.params.length,6877),Vf(this.expr.params[0]).evaluate(e,t).type){case"ERROR":return Lf.vr();case"UNSET":return Lf.newValue(Fl);default:return Lf.newValue(Vl)}}}class hg{constructor(e){this.expr=e}evaluate(e,t){du(3===this.expr.params.length,11706);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BOOLEAN":return n.value?.booleanValue?Vf(this.expr.params[1]).evaluate(e,t):Vf(this.expr.params[2]).evaluate(e,t);case"NULL":return Vf(this.expr.params[2]).evaluate(e,t);default:return Lf.vr()}}}class dg{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map(n=>Vf(n).evaluate(e,t));let r;for(const e of n)switch(e.type){case"ERROR":case"UNSET":case"NULL":continue;default:r=void 0===r||Hl(e.value,r.value)>0?e:r}return void 0===r?Lf.Dr():r}}class pg{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map(n=>Vf(n).evaluate(e,t));let r;for(const e of n)switch(e.type){case"ERROR":case"UNSET":case"NULL":continue;default:r=void 0===r||Hl(e.value,r.value)<0?e:r}return void 0===r?Lf.Dr():r}}class fg{constructor(e){this.expr=e}evaluate(e,t){du(2===this.expr.params.length,31033,`${this.expr.name}() function should have exactly 2 params`);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"ERROR":case"UNSET":return Lf.vr()}const r=Vf(this.expr.params[1]).evaluate(e,t);switch(r.type){case"ERROR":case"UNSET":return Lf.vr()}return this.Ur(n,r)}}class gg extends fg{constructor(e){super(e),this.expr=e}Ur(e,t){if(e.Fr()&&t.Fr())return Lf.newValue(Vl);if(e.Fr()||t.Fr())return Lf.newValue(Fl);if(eh(e.value)||eh(t.value))return Lf.newValue(Fl);if($l(e.value)!==$l(t.value))return Lf.newValue(Fl);switch(Kf(e.value,t.value)){case"EQ":return Lf.newValue(Vl);case"NOT_EQ":return Lf.newValue(Fl);case"NULL":return Lf.Dr();default:lu(44615,{left:e,right:t})}}}class mg extends fg{constructor(e){super(e),this.expr=e}Ur(e,t){switch(Kf(e.value,t.value)){case"EQ":return Lf.newValue(Fl);case"NOT_EQ":case"TYPE_MISMATCH":return Lf.newValue(Vl);case"NULL":return Lf.Dr();default:lu(44614,{left:e,right:t})}}}class yg extends fg{constructor(e){super(e),this.expr=e}Ur(e,t){return $l(e.value)!==$l(t.value)||eh(e.value)||eh(t.value)?Lf.newValue(Fl):Lf.newValue({booleanValue:Hl(e.value,t.value)<0})}}class _g extends fg{constructor(e){super(e),this.expr=e}Ur(e,t){return $l(e.value)!==$l(t.value)||eh(e.value)||eh(t.value)?Lf.newValue(Fl):"EQ"===Kf(e.value,t.value)?Lf.newValue(Vl):Lf.newValue({booleanValue:Hl(e.value,t.value)<0})}}class wg extends fg{constructor(e){super(e),this.expr=e}Ur(e,t){return $l(e.value)!==$l(t.value)||eh(e.value)||eh(t.value)?Lf.newValue(Fl):Lf.newValue({booleanValue:Hl(e.value,t.value)>0})}}class vg extends fg{constructor(e){super(e),this.expr=e}Ur(e,t){return $l(e.value)!==$l(t.value)||eh(e.value)||eh(t.value)?Lf.newValue(Fl):"EQ"===Kf(e.value,t.value)?Lf.newValue(Vl):Lf.newValue({booleanValue:Hl(e.value,t.value)>0})}}class bg{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class Eg{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,216);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return Lf.Dr();case"ARRAY":{const e=n.value.arrayValue?.values??[];return Lf.newValue({arrayValue:{values:[...e].reverse()}})}default:return Lf.vr()}}}class Tg{constructor(e){this.expr=e}evaluate(e,t){return du(2===this.expr.params.length,52884),new rg(new uf("eq_any",[this.expr.params[1],this.expr.params[0]])).evaluate(e,t)}}class Sg{constructor(e){this.expr=e}evaluate(e,t){du(2===this.expr.params.length,1392);let n=!1;const r=Vf(this.expr.params[0]).evaluate(e,t);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.vr()}const s=Vf(this.expr.params[1]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.vr()}if(n)return Lf.Dr();const i=s.value?.arrayValue?.values??[],a=r.value?.arrayValue?.values??[];for(const e of i){let t=!1;n=!1;for(const r of a){switch(Zl(e)&&Zl(r)?"EQ":Kf(e,r)){case"EQ":t=!0;break;case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:lu(44613,{value:r,search:e})}if(t)break}if(!t)return Lf.newValue(Fl)}return Lf.newValue(Vl)}}class Ag{constructor(e){this.expr=e}evaluate(e,t){du(2===this.expr.params.length,2680);let n=!1;const r=Vf(this.expr.params[0]).evaluate(e,t);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.vr()}const s=Vf(this.expr.params[1]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.vr()}if(n)return Lf.Dr();const i=s.value?.arrayValue?.values??[],a=r.value?.arrayValue?.values??[];for(const e of a)for(const t of i)switch(Zl(e)&&Zl(t)?"EQ":Kf(e,t)){case"EQ":return Lf.newValue(Vl);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:lu(44608,{value:e,search:t})}return n?Lf.Dr():Lf.newValue(Fl)}}class Ig{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,38605);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return Lf.Dr();case"ARRAY":return Lf.newValue({integerValue:`${n.value?.arrayValue?.values?.length??0}`});default:return Lf.vr()}}}class Cg{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class Og{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,1508);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return Lf.Dr();case"BYTES":{const e=n.value?.bytesValue;if("string"==typeof e){const t=yl.fromBase64String(e).toUint8Array();return t.reverse(),Lf.newValue({bytesValue:yl.fromUint8Array(t).toBase64()})}return Lf.newValue({bytesValue:new Uint8Array(e).reverse()})}case"STRING":{const e=n.value?.stringValue,t=new Intl.__PRIVATE_Segmenter(void 0,{granularity:"grapheme"}).segment(e),r=Array.from(t,e=>e.segment).reverse();return Lf.newValue({stringValue:r.join("")})}default:return Lf.vr()}}}class Rg{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class kg{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class Ng{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,19400);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return Lf.Dr();case"STRING":{const e=function(e){let t=0;for(let n=0;n<e.length;n++){const r=e.codePointAt(n);if(void 0===r)return;if(r<=65535)if(r>=55296&&r<=57343)if(r<=56319){const r=e.codePointAt(n+1);void 0!==r&&r>=56320&&r<=57343?(t+=1,n++):t+=1}else t+=1;else t+=1;else{if(!(r<=1114111))return;t+=1,n++}}return t}(n.value.stringValue);return void 0===e?Lf.vr():Lf.newValue({integerValue:e})}default:return Lf.vr()}}}class xg{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,8486);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BYTES":{const e=n.value?.bytesValue;return"string"==typeof e?Lf.newValue({integerValue:yl.fromBase64String(e).toUint8Array().length}):Lf.newValue({integerValue:new Uint8Array(e).length})}case"STRING":{const e=function(e){let t=0;for(let n=0;n<e.length;n++){const r=e.codePointAt(n);if(void 0===r)return;if(r>=55296&&r<=57343){if(!(r<=56319))return;{const r=e.codePointAt(n+1);if(void 0===r||!(r>=56320&&r<=57343))return;t+=4,n++}}else if(r<=127)t+=1;else if(r<=2047)t+=2;else if(r<=65535)t+=3;else{if(!(r<=1114111))return;t+=4,n++}}return t}(n.value?.stringValue);return void 0===e?Lf.vr():Lf.newValue({integerValue:e})}case"NULL":return Lf.Dr();default:return Lf.vr()}}}class Pg{constructor(e){this.expr=e}evaluate(e,t){du(2===this.expr.params.length,39773,`${this.expr.name}() function should have exactly two parameters`);let n=!1;const r=Vf(this.expr.params[0]).evaluate(e,t);switch(r.type){case"STRING":break;case"NULL":n=!0;break;default:return Lf.vr()}const s=Vf(this.expr.params[1]).evaluate(e,t);switch(s.type){case"STRING":break;case"NULL":n=!0;break;default:return Lf.vr()}return n?Lf.Dr():this.kr(r.value?.stringValue,s.value?.stringValue)}}class Dg extends Pg{kr(e,t){try{const n=function(e){let t="";for(let n=0;n<e.length;n++){const r=e.charAt(n);switch(r){case"_":t+=".";break;case"%":t+=".*";break;case"\\":case".":case"*":case"?":case"+":case"^":case"$":case"|":case"(":case")":case"[":case"]":case"{":case"}":t+="\\"+r;break;default:t+=r}}return"^"+t+"$"}(t),r=tu.compile(n);return Lf.newValue({booleanValue:r.matches(e)})}catch(e){return cu(`Invalid LIKE pattern converted to regex: ${t}, returning error. Error: ${e}`),Lf.vr()}}}class Lg extends Pg{kr(e,t){try{const n=tu.compile(t);return Lf.newValue({booleanValue:n.matcher(e).find()})}catch(e){return cu(`Invalid regex pattern found in regex_contains: ${t}, returning error`),Lf.vr()}}}class Ug extends Pg{kr(e,t){try{return Lf.newValue({booleanValue:tu.compile(t).matches(e)})}catch(e){return cu(`Invalid regex pattern found in regex_match: ${t}, returning error`),Lf.vr()}}}class Mg extends Pg{kr(e,t){return Lf.newValue({booleanValue:e.includes(t)})}}class Vg extends Pg{kr(e,t){return Lf.newValue({booleanValue:e.startsWith(t)})}}class Fg extends Pg{kr(e,t){return Lf.newValue({booleanValue:e.endsWith(t)})}}class $g{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,29079);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return Lf.newValue({stringValue:n.value?.stringValue?.toLowerCase()});case"NULL":return Lf.Dr();default:return Lf.vr()}}}class jg{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,60487);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return Lf.newValue({stringValue:n.value?.stringValue?.toUpperCase()});case"NULL":return Lf.Dr();default:return Lf.vr()}}}class Bg{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,28544);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return Lf.newValue({stringValue:n.value?.stringValue?.trim()});case"NULL":return Lf.Dr();default:return Lf.vr()}}}class Hg{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map(n=>Vf(n).evaluate(e,t));let r="",s=!1;for(const e of n)switch(e.type){case"STRING":r+=e.value.stringValue;break;case"NULL":s=!0;break;default:return Lf.vr()}return s?Lf.Dr():Lf.newValue({stringValue:r})}}class zg{constructor(e){this.expr=e}evaluate(e,t){du(2===this.expr.params.length,4483);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"UNSET":return Lf.Sr();case"MAP":break;default:return Lf.vr()}const r=Vf(this.expr.params[1]).evaluate(e,t);if("STRING"!==r.type)return Lf.vr();const s=n.value?.mapValue?.fields?.[r.value?.stringValue];return void 0===s?Lf.Sr():Lf.newValue(s)}}class qg{constructor(e){this.expr=e}evaluate(e,t){du(2===this.expr.params.length,25231,`${this.expr.name}() function should have exactly 2 params`);let n=!1;const r=Vf(this.expr.params[0]).evaluate(e,t);switch(r.type){case"VECTOR":break;case"NULL":n=!0;break;default:return Lf.vr()}const s=Vf(this.expr.params[1]).evaluate(e,t);switch(s.type){case"VECTOR":break;case"NULL":n=!0;break;default:return Lf.vr()}if(n)return Lf.Dr();const i=rh(r.value),a=rh(s.value);if(void 0===i||void 0===a||i.values?.length!==a.values?.length)return Lf.vr();const o=this.qr(i,a);return void 0===o||isNaN(o)?Lf.vr():Lf.newValue({doubleValue:o})}}class Gg extends qg{qr(e,t){const n=e?.values??[],r=t?.values??[];if(0===n.length)return;let s=0,i=0,a=0;for(let e=0;e<n.length;e++){if(!Ql(n[e])||!Ql(r[e]))return;const t=Bf(n[e]),o=Bf(r[e]);s+=t*o,i+=t*t,a+=o*o}const o=Math.sqrt(i)*Math.sqrt(a);return 0!==o?1-Math.max(-1,Math.min(1,s/o)):void 0}}class Kg extends qg{qr(e,t){const n=e?.values??[],r=t?.values??[];if(0===n.length)return 0;let s=0;for(let e=0;e<n.length;e++){if(!Ql(n[e])||!Ql(r[e]))return;s+=Bf(n[e])*Bf(r[e])}return s}}class Wg extends qg{qr(e,t){const n=e?.values??[],r=t?.values??[];if(0===n.length)return 0;let s=0;for(let e=0;e<n.length;e++){if(!Ql(n[e])||!Ql(r[e]))return;const t=Bf(n[e]),i=Bf(r[e]);s+=Math.pow(t-i,2)}return Math.sqrt(s)}}class Yg{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,39044);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"VECTOR":{const e=rh(n.value);return Lf.newValue({integerValue:e?.values?.length??0})}case"NULL":return Lf.Dr();default:return Lf.vr()}}}const Xg=BigInt(-62135596800),Qg=BigInt(253402300799),Jg=BigInt(1e3),Zg=BigInt(1e6),em=Xg*Jg,tm=Qg*Jg+BigInt(999),nm=Xg*Zg,rm=Qg*Zg+BigInt(999999);function sm(e){return e>=nm&&e<=rm}function im(e){return e>=Xg&&e<=Qg}function am(e,t){const n=BigInt(e);return!(n<Xg||n>Qg||t<0||t>=1e9||n===Xg&&0!==t||n===Qg&&t>999999999)}function om(e,t){return t<0?{seconds:e-1,nanos:t+1e9}:{seconds:e,nanos:t}}function cm(e){return BigInt(e.seconds)*Zg+BigInt(Math.trunc(e.nanoseconds/1e3))}class um{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,49262,`${this.expr.name}() function should have exactly one parameter`);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"INT":return this.toTimestamp(BigInt(n.value.integerValue));case"NULL":return Lf.Dr();default:return Lf.vr()}}}class lm extends um{toTimestamp(e){if(!sm(e))return Lf.vr();let t=Number(e/Zg),n=Number(e%Zg*BigInt(1e3));const r=om(t,n);return t=r.seconds,n=r.nanos,am(t,n)?Lf.newValue({timestampValue:{seconds:t,nanos:n}}):Lf.vr()}}class hm extends um{toTimestamp(e){if(!function(e){return e>=em&&e<=tm}(e))return Lf.vr();let t=Number(e/Jg),n=Number(e%Jg*BigInt(1e6));const r=om(t,n);return t=r.seconds,n=r.nanos,am(t,n)?Lf.newValue({timestampValue:{seconds:t,nanos:n}}):Lf.vr()}}class dm extends um{toTimestamp(e){if(!im(e))return Lf.vr();const t=Number(e);return Lf.newValue({timestampValue:{seconds:t,nanos:0}})}}class pm{constructor(e){this.expr=e}evaluate(e,t){du(1===this.expr.params.length,1265,`${this.expr.name}() function should have exactly one parameter`);const n=Vf(this.expr.params[0]).evaluate(e,t);switch(n.type){case"TIMESTAMP":break;case"NULL":return Lf.Dr();default:return Lf.vr()}const r=$d(n.value.timestampValue);return am(r.seconds,r.nanoseconds)?this.$r(r):Lf.vr()}}class fm extends pm{$r(e){const t=cm(e);return sm(t)?Lf.newValue({integerValue:`${t.toString()}`}):Lf.vr()}}class gm extends pm{$r(e){const t=cm(e),n=t/BigInt(1e3),r=t%BigInt(1e3);return n>BigInt(0)||r===BigInt(0)?Lf.newValue({integerValue:n.toString()}):Lf.newValue({integerValue:(n-BigInt(1)).toString()})}}class mm extends pm{$r(e){const t=BigInt(e.seconds);return im(t)?Lf.newValue({integerValue:t.toString()}):Lf.vr()}}class ym{constructor(e){this.expr=e}evaluate(e,t){du(3===this.expr.params.length,2775,`${this.expr.name}() function should have exactly 3 parameters`);let n=!1;const r=Vf(this.expr.params[0]).evaluate(e,t);switch(r.type){case"TIMESTAMP":break;case"NULL":n=!0;break;default:return Lf.vr()}const s=Vf(this.expr.params[1]).evaluate(e,t);let i;switch(s.type){case"STRING":if(i=function(e){switch(e){case"microsecond":return"microsecond";case"millisecond":return"millisecond";case"second":return"second";case"minute":return"minute";case"hour":return"hour";case"day":return"day";default:return}}(s.value.stringValue),void 0===i)return Lf.vr();break;case"NULL":n=!0;break;default:return Lf.vr()}const a=Vf(this.expr.params[2]).evaluate(e,t);switch(a.type){case"INT":break;case"NULL":n=!0;break;default:return Lf.vr()}if(n)return Lf.Dr();const o=BigInt(a.value.integerValue);let c;try{switch(i){case"microsecond":c=o;break;case"millisecond":c=o*BigInt(1e3);break;case"second":c=o*BigInt(1e6);break;case"minute":c=o*BigInt(6e7);break;case"hour":c=o*BigInt(36e8);break;case"day":c=o*BigInt(864e8);break;default:return Lf.vr()}if("microsecond"!==i&&o!==BigInt(0)&&c/o!==BigInt(this.Kr(i)))return Lf.vr()}catch(e){return cu(`Error during timestamp arithmetic: ${e}`),Lf.vr()}const u=$d(r.value.timestampValue);if(!am(u.seconds,u.nanoseconds))return Lf.vr();const l=cm(u),h=this.Wr(l,c);if(!sm(h))return Lf.vr();const d=Number(h/Zg),p=h%Zg,f=Number((p<0?p+Zg:p)*BigInt(1e3)),g=p<0?d-1:d;return am(g,f)?Lf.newValue({timestampValue:{seconds:g,nanos:f}}):Lf.vr()}Kr(e){switch(e){case"millisecond":return 1e3;case"second":return 1e6;case"minute":return 6e7;case"hour":return 36e8;case"day":return 864e8;default:return 1}}}class _m extends ym{Wr(e,t){return e+t}}class wm extends ym{Wr(e,t){return e-t}}function vm(e){if((e=Mf(e))instanceof sf)return`fld(${e.fieldName})`;if(e instanceof af)return`cst(${function(e){return null===e?"null":"number"==typeof e?e.toString():"string"==typeof e?`"${e}"`:e instanceof $p?`ref(${e.path})`:e instanceof Hp?`vec(${JSON.stringify(e)})`:JSON.stringify(e)}(e.value)})`;if(e instanceof uf)return`fn(${e.name},[${e.params.map(vm).join(",")}])`;if("ListOfExpressions"===e.expressionType)return`list([${e.Rr.map(vm).join(",")}])`;throw new Error(`Unrecognized expr ${JSON.stringify(e,null,2)}`)}function bm(e){return`${Array.from(e.entries()).sort().map(([e,t])=>`${e}=${vm(t)}`).join(",")}`}function Em(e){return e.stages.map(e=>function(e){if(e instanceof mf)return`${e._name}(${bm(e.fields)})`;if(e instanceof yf){let t=`${e._name}(${bm(e.accumulators)})`;return e.groups.size>0&&(t+=`grouping(${bm(e.groups)})`),t}if(e instanceof _f)return`${e._name}(${bm(e.groups)})`;if(e instanceof wf)return`${e._name}(${e.Vr})`;if(e instanceof vf)return`${e._name}(${e.collectionId})`;if(e instanceof bf)return`${e._name}()`;if(e instanceof Ef)return`${e._name}(${e.dr.sort()})`;if(e instanceof Tf)return`${e._name}(${vm(e.condition)})`;if(e instanceof Sf)return`${e._name}(${e.limit})`;if(e instanceof Cf)return`${e._name}(${function(e){return e.map(e=>`${vm(e.expr)}${e.direction}`).join(",")}(e.orderings)})`;throw new Error(`Unrecognized stage ${e._name}`)}(e)).join("|")}function Tm(e,t){return Em(e)===Em(t)}function Sm(e){return e instanceof kf}function Am(e){return Sm(e)?Em(e):wd(e)}function Im(e){return Sm(e)?Em(e):function(e){return`${dd(yd(e))}|lt:${e.limitType}`}(e)}function Cm(e,t){return e instanceof kf&&t instanceof kf?Tm(e,t):!(e instanceof kf&&!(t instanceof kf)||!(e instanceof kf)&&t instanceof kf)&&function(e,t){return pd(yd(e),yd(t))&&e.limitType===t.limitType}(e,t)}function Om(e){return function(e){return!!e.isCorePipeline}(e)?Em(e):dd(e)}function Rm(e,t){return e instanceof kf&&t instanceof kf?Tm(e,t):!(e instanceof kf&&!(t instanceof kf)||!(e instanceof kf)&&t instanceof kf)&&pd(e,t)}class km{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)&&Nh(r,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=xh(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=xh(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=xd();return this.mutations.forEach(r=>{const s=e.get(r.key),i=s.overlayedDocument;let a=this.applyToLocalView(i,s.mutatedFields);a=t.has(r.key)?null:a;const o=kh(i,a);null!==o&&n.set(r.key,o),i.isValidDocument()||i.convertToNoDocument(Wu.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),Ud())}isEqual(e){return this.batchId===e.batchId&&xu(this.mutations,e.mutations,(e,t)=>Dh(e,t))&&xu(this.baseMutations,e.baseMutations,(e,t)=>Dh(e,t))}}class Nm{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(e,t,n){du(e.mutations.length===n.length,58842,{Qr:e.mutations.length,Gr:n.length});let r=Dd;const s=e.mutations;for(let e=0;e<s.length;e++)r=r.insert(s[e].key,n[e].version);return new Nm(e,t,n,r)}}class xm{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 }`}}class Pm{constructor(e){this.zr=e}}function Dm(e){const t=Yd({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?_d(t,t.limit,"L"):t}class Lm{constructor(){this.Hi=new Um}addToCollectionParentIndex(e,t){return this.Hi.add(t),el.resolve()}getCollectionParents(e,t){return el.resolve(this.Hi.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(Xu.min())}getMinOffsetFromCollectionGroup(e,t){return el.resolve(Xu.min())}updateCollectionGroup(e,t,n){return el.resolve()}updateIndexEntries(e,t){return el.resolve()}}class Um{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new ll(Lu.comparator),s=!r.has(n);return this.index[t]=r.add(n),s}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 ll(Lu.comparator)).toArray()}}class Mm{constructor(e){this.Ds=e}next(){return this.Ds+=2,this.Ds}static xs(){return new Mm(0)}static Cs(){return new Mm(-1)}}function Vm(e,t){return function(e,t){let n=t;for(const t of e.stages)n=Fm({serializer:e.serializer,serverTimestampBehavior:e.listenOptions?.serverTimestampBehavior},t,n);return n}(e,[t]).length>0}function Fm(e,t,n){if(t instanceof wf)return function(e,t,n){return n.filter(e=>e.isFoundDocument()&&`/${e.key.getCollectionPath().canonicalString()}`===t.Vr)}(0,t,n);if(t instanceof Tf)return function(e,t,n){return n.filter(n=>{const r=Uf(Vf(t.condition).evaluate(e,n));return void 0!==r&&jl(r,Vl)})}(e,t,n);if(t instanceof vf)return function(e,t,n){return n.filter(e=>e.isFoundDocument()&&e.key.getCollectionPath().lastSegment()===t.collectionId)}(0,t,n);if(t instanceof bf)return function(e,t,n){return n.filter(e=>e.isFoundDocument())}(0,0,n);if(t instanceof Ef)return function(e,t,n){return n.filter(e=>e.isFoundDocument()&&t.mr.has(e.key.path.toStringWithLeadingSlash()))}(0,t,n);if(t instanceof Sf)return function(e,t,n){return n.slice(0,t.limit)}(0,t,n);if(t instanceof Cf)return function(e,t,n){const r=t.orderings.map(e=>({ks:Vf(e.expr),direction:e.direction}));return[...n].sort((t,n)=>{for(const{ks:s,direction:i}of r){const r=Uf(s.evaluate(e,t)),a=Uf(s.evaluate(e,n)),o=Hl(r??Ml,a??Ml);if(0!==o)return"ascending"===i?o:-o}return 0})}(e,t,n);throw new Error(`Unknown stage: ${t._name}`)}class $m{constructor(){this.changes=new Ad(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,ud.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 jm{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class Bm{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&&xh(n.mutation,e,dl.empty(),Ku.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,Ud()).next(()=>t))}getLocalViewOfDocuments(e,t,n=Ud()){const r=Nd();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,n).next(e=>{let t=Rd();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){const n=Nd();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,Ud()))}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 s=Cd();const i=Pd(),a=Pd();return t.forEach((e,t)=>{const a=n.get(t.key);r.has(t.key)&&(void 0===a||a.mutation instanceof Uh)?s=s.insert(t.key,t):void 0!==a?(i.set(t.key,a.mutation.getFieldMask()),xh(a.mutation,t,a.mutation.getFieldMask(),Ku.now())):i.set(t.key,dl.empty())}),this.recalculateAndSaveOverlays(e,s).next(e=>(e.forEach((e,t)=>i.set(e,t)),t.forEach((e,t)=>a.set(e,new jm(t,i.get(e)??null))),a))}recalculateAndSaveOverlays(e,t){const n=Pd();let r=new ol((e,t)=>e-t),s=Ud();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(const s of e)s.keys().forEach(e=>{const i=t.get(e);if(null===i)return;let a=n.get(e)||dl.empty();a=s.applyToLocalView(i,a),n.set(e,a);const o=(r.get(s.batchId)||Ud()).add(e);r=r.insert(s.batchId,o)})}).next(()=>{const i=[],a=r.getReverseIterator();for(;a.hasNext();){const r=a.getNext(),o=r.key,c=r.value,u=xd();c.forEach(e=>{if(!s.has(e)){const r=kh(t.get(e),n.get(e));null!==r&&u.set(e,r),s=s.add(e)}}),i.push(this.documentOverlayCache.saveOverlays(e,o,u))}return el.waitFor(i)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,r){return Sm(t)?this.getDocumentsMatchingPipeline(e,t,n,r):function(e){return Vu.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(s=>{const i=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-s.size):el.resolve(Nd());let a=-1,o=s;return i.next(t=>el.forEach(t,(t,n)=>(a<n.largestBatchId&&(a=n.largestBatchId),s.get(t)?el.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{o=o.insert(t,e)}))).next(()=>this.populateOverlays(e,t,s)).next(()=>this.computeViews(e,o,t,Ud())).next(e=>({batchId:a,changes:kd(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new Vu(t)).next(e=>{let t=Rd();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){const s=t.collectionGroup;let i=Rd();return this.indexManager.getCollectionParents(e,s).next(a=>el.forEach(a,a=>{const o=function(e,t){return new fd(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,a.child(s));return this.getDocumentsMatchingCollectionQuery(e,o,n,r).next(e=>{e.forEach((e,t)=>{i=i.insert(e,t)})})}).next(()=>i))}getDocumentsMatchingCollectionQuery(e,t,n,r){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(i=>(s=i,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s,r))).next(e=>this.retrieveMatchingLocalDocuments(s,e,e=>vd(t,e)))}getDocumentsMatchingPipeline(e,t,n,r){if("collection_group"===Nf(t)){const s=Pf(t);let i=Rd();return this.indexManager.getCollectionParents(e,s).next(a=>el.forEach(a,a=>{const o=function(e,t){const n=e.stages.map(e=>e instanceof vf?new wf(t.canonicalString(),{}):e);return new kf(e.serializer,n)}(t,a.child(s));return this.getDocumentsMatchingPipeline(e,o,n,r).next(e=>{e.forEach((e,t)=>{i=i.insert(e,t)})})}).next(()=>i))}{let s;return this.getOverlaysForPipeline(e,t,n.largestBatchId).next(i=>{switch(s=i,Nf(t)){case"collection":return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s,r);case"documents":let i=Ud();for(const e of Df(t))i=i.add(Vu.fromPath(e));return this.remoteDocumentCache.getEntries(e,i);case"database":return this.remoteDocumentCache.getAllEntries(e);default:throw new gu("invalid-argument",`Invalid pipeline source to execute offline: ${Em(t)}`)}}).next(e=>this.retrieveMatchingLocalDocuments(s,e,e=>Vm(t,e)))}}retrieveMatchingLocalDocuments(e,t,n){e.forEach((e,n)=>{const r=n.getKey();null===t.get(r)&&(t=t.insert(r,ud.newInvalidDocument(r)))});let r=Rd();return t.forEach((t,s)=>{const i=e.get(t);void 0!==i&&xh(i.mutation,s,dl.empty(),Ku.now()),n(s)&&(r=r.insert(t,s))}),r}getOverlaysForPipeline(e,t,n){switch(Nf(t)){case"collection":return this.documentOverlayCache.getOverlaysForCollection(e,Lu.fromString(xf(t)),n);case"collection_group":throw new gu("invalid-argument",`Unexpected collection group pipeline: ${Em(t)}`);case"documents":return this.documentOverlayCache.getOverlays(e,Df(t).map(e=>Vu.fromPath(e)));case"database":return this.documentOverlayCache.getAllOverlays(e,n);default:throw new gu("invalid-argument",`Failed to get overlays for pipeline: ${Em(t)}`)}}}class Hm{constructor(e){this.serializer=e,this.Hs=new Map,this.Js=new Map}getBundleMetadata(e,t){return el.resolve(this.Hs.get(t))}saveBundleMetadata(e,t){return this.Hs.set(t.id,function(e){return{id:e.id,version:e.version,createTime:Hd(e.createTime)}}(t)),el.resolve()}getNamedQuery(e,t){return el.resolve(this.Js.get(t))}saveNamedQuery(e,t){return this.Js.set(t.name,function(e){return{name:e.name,query:Dm(e.bundledQuery),readTime:Hd(e.readTime)}}(t)),el.resolve()}}class zm{constructor(){this.overlays=new ol(Vu.comparator),this.Ys=new Map}getOverlay(e,t){return el.resolve(this.overlays.get(t))}getOverlays(e,t){const n=Nd();return el.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&n.set(t,e)})).next(()=>n)}getAllOverlays(e,t){const n=Nd();return this.overlays.forEach((e,r)=>{r.largestBatchId>t&&n.set(e,r)}),el.resolve(n)}saveOverlays(e,t,n){return n.forEach((n,r)=>{this.Hr(e,t,r)}),el.resolve()}removeOverlaysForBatchId(e,t,n){const r=this.Ys.get(n);return void 0!==r&&(r.forEach(e=>this.overlays=this.overlays.remove(e)),this.Ys.delete(n)),el.resolve()}getOverlaysForCollection(e,t,n){const r=Nd(),s=t.length+1,i=new Vu(t.child("")),a=this.overlays.getIteratorFrom(i);for(;a.hasNext();){const e=a.getNext().value,i=e.getKey();if(!t.isPrefixOf(i.path))break;i.path.length===s&&e.largestBatchId>n&&r.set(e.getKey(),e)}return el.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let s=new ol((e,t)=>e-t);const i=this.overlays.getIterator();for(;i.hasNext();){const e=i.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=s.get(e.largestBatchId);null===t&&(t=Nd(),s=s.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const a=Nd(),o=s.getIterator();for(;o.hasNext()&&(o.getNext().value.forEach((e,t)=>a.set(e,t)),!(a.size()>=r)););return el.resolve(a)}Hr(e,t,n){const r=this.overlays.get(n.key);if(null!==r){const e=this.Ys.get(r.largestBatchId).delete(n.key);this.Ys.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new xm(t,n));let s=this.Ys.get(t);void 0===s&&(s=Ud(),this.Ys.set(t,s)),this.Ys.set(t,s.add(n.key))}}class qm{constructor(){this.sessionToken=yl.EMPTY_BYTE_STRING}getSessionToken(e){return el.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,el.resolve()}}class Gm{constructor(){this.Zs=new ll(Km.Xs),this.e_=new ll(Km.t_)}isEmpty(){return this.Zs.isEmpty()}addReference(e,t){const n=new Km(e,t);this.Zs=this.Zs.add(n),this.e_=this.e_.add(n)}n_(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.r_(new Km(e,t))}i_(e,t){e.forEach(e=>this.removeReference(e,t))}s_(e){const t=new Vu(new Lu([])),n=new Km(t,e),r=new Km(t,e+1),s=[];return this.e_.forEachInRange([n,r],e=>{this.r_(e),s.push(e.key)}),s}__(){this.Zs.forEach(e=>this.r_(e))}r_(e){this.Zs=this.Zs.delete(e),this.e_=this.e_.delete(e)}o_(e){const t=new Vu(new Lu([])),n=new Km(t,e),r=new Km(t,e+1);let s=Ud();return this.e_.forEachInRange([n,r],e=>{s=s.add(e.key)}),s}containsKey(e){const t=new Km(e,0),n=this.Zs.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class Km{constructor(e,t){this.key=e,this.a_=t}static Xs(e,t){return Vu.comparator(e.key,t.key)||Cu(e.a_,t.a_)}static t_(e,t){return Cu(e.a_,t.a_)||Vu.comparator(e.key,t.key)}}class Wm{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.gs=1,this.u_=new ll(Km.Xs)}checkEmpty(e){return el.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,r){const s=this.gs;this.gs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new km(s,t,n,r);this.mutationQueue.push(i);for(const t of r)this.u_=this.u_.add(new Km(t.key,s)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return el.resolve(i)}lookupMutationBatch(e,t){return el.resolve(this.c_(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,r=this.l_(n),s=r<0?0:r;return el.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return el.resolve(0===this.mutationQueue.length?-1:this.gs-1)}getAllMutationBatches(e){return el.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new Km(t,0),r=new Km(t,Number.POSITIVE_INFINITY),s=[];return this.u_.forEachInRange([n,r],e=>{const t=this.c_(e.a_);s.push(t)}),el.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new ll(Cu);return t.forEach(e=>{const t=new Km(e,0),r=new Km(e,Number.POSITIVE_INFINITY);this.u_.forEachInRange([t,r],e=>{n=n.add(e.a_)})}),el.resolve(this.E_(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,r=n.length+1;let s=n;Vu.isDocumentKey(s)||(s=s.child(""));const i=new Km(new Vu(s),0);let a=new ll(Cu);return this.u_.forEachWhile(e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(a=a.add(e.a_)),!0)},i),el.resolve(this.E_(a))}E_(e){const t=[];return e.forEach(e=>{const n=this.c_(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){du(0===this.h_(t.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.u_;return el.forEach(t.mutations,r=>{const s=new Km(r.key,t.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)}).next(()=>{this.u_=n})}bs(e){}containsKey(e,t){const n=new Km(t,0),r=this.u_.firstAfterOrEqual(n);return el.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,el.resolve()}h_(e,t){return this.l_(e)}l_(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}c_(e){const t=this.l_(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class Ym{constructor(e){this.T_=e,this.docs=new ol(Vu.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,r=this.docs.get(n),s=r?r.size:0,i=this.T_(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:i}),this.size+=i-s,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():ud.newInvalidDocument(t))}getEntries(e,t){let n=Cd();return t.forEach(e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():ud.newInvalidDocument(e))}),el.resolve(n)}getAllEntries(e){let t=Cd();return this.docs.forEach((e,n)=>{t=t.insert(e,n.document)}),el.resolve(t)}getDocumentsMatchingQuery(e,t,n,r){let s,i;Sm(t)?(s=Lu.fromString(xf(t)),i=e=>Vm(t,e)):(s=t.path,i=e=>vd(t,e));let a=Cd();const o=new Vu(s.child("__id-9223372036854775808__")),c=this.docs.getIteratorFrom(o);for(;c.hasNext();){const{key:e,value:{document:t}}=c.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||Qu(Yu(t),n)<=0||(r.has(t.key)||i(t))&&(a=a.insert(t.key,t.mutableCopy()))}return el.resolve(a)}getAllFromCollectionGroup(e,t,n,r){lu(9500)}P_(e,t){return el.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new Xm(this)}getSize(e){return el.resolve(this.size)}}class Xm extends $m{constructor(e){super(),this.zs=e}applyChanges(e){const t=[];return this.changes.forEach((n,r)=>{r.isValidDocument()?t.push(this.zs.addEntry(e,r)):this.zs.removeEntry(n)}),el.waitFor(t)}getFromCache(e,t){return this.zs.getEntry(e,t)}getAllFromCache(e,t){return this.zs.getEntries(e,t)}}class Qm{constructor(e){this.persistence=e,this.R_=new Ad(e=>Om(e),Rm),this.lastRemoteSnapshotVersion=Wu.min(),this.highestTargetId=0,this.I_=0,this.A_=new Gm,this.targetCount=0,this.V_=Mm.xs()}forEachTarget(e,t){return this.R_.forEach((e,n)=>t(n)),el.resolve()}getLastRemoteSnapshotVersion(e){return el.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return el.resolve(this.I_)}allocateTargetId(e){return this.highestTargetId=this.V_.next(),el.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.I_&&(this.I_=t),el.resolve()}Ms(e){this.R_.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.V_=new Mm(t),this.highestTargetId=t),e.sequenceNumber>this.I_&&(this.I_=e.sequenceNumber)}addTargetData(e,t){return this.Ms(t),this.targetCount+=1,el.resolve()}updateTargetData(e,t){return this.Ms(t),el.resolve()}removeTargetData(e,t){return this.R_.delete(t.target),this.A_.s_(t.targetId),this.targetCount-=1,el.resolve()}removeTargets(e,t,n){let r=0;const s=[];return this.R_.forEach((i,a)=>{a.sequenceNumber<=t&&null===n.get(a.targetId)&&(this.R_.delete(i),s.push(this.removeMatchingKeysForTargetId(e,a.targetId)),r++)}),el.waitFor(s).next(()=>r)}getTargetCount(e){return el.resolve(this.targetCount)}getTargetData(e,t){const n=this.R_.get(t)||null;return el.resolve(n)}addMatchingKeys(e,t,n){return this.A_.n_(t,n),el.resolve()}removeMatchingKeys(e,t,n){this.A_.i_(t,n);const r=this.persistence.referenceDelegate,s=[];return r&&t.forEach(t=>{s.push(r.markPotentiallyOrphaned(e,t))}),el.waitFor(s)}removeMatchingKeysForTargetId(e,t){return this.A_.s_(t),el.resolve()}getMatchingKeysForTargetId(e,t){const n=this.A_.o_(t);return el.resolve(n)}containsKey(e,t){return el.resolve(this.A_.containsKey(t))}}class Jm{constructor(e,t){this.d_={},this.overlays={},this.f_=new nl(0),this.m_=!1,this.m_=!0,this.p_=new qm,this.referenceDelegate=e(this),this.g_=new Qm(this),this.indexManager=new Lm,this.remoteDocumentCache=function(e){return new Ym(e)}(e=>this.referenceDelegate.y_(e)),this.serializer=new Pm(t),this.w_=new Hm(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.m_=!1,Promise.resolve()}get started(){return this.m_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new zm,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.d_[e.toKey()];return n||(n=new Wm(t,this.referenceDelegate),this.d_[e.toKey()]=n),n}getGlobalsCache(){return this.p_}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.w_}runTransaction(e,t,n){au("MemoryPersistence","Starting transaction:",e);const r=new Zm(this.f_.next());return this.referenceDelegate.b_(),n(r).next(e=>this.referenceDelegate.v_(r).next(()=>e)).toPromise().then(e=>(r.raiseOnCommittedEvent(),e))}S_(e,t){return el.or(Object.values(this.d_).map(n=>()=>n.containsKey(e,t)))}}class Zm extends Ju{constructor(e){super(),this.currentSequenceNumber=e}}class ey{constructor(e){this.persistence=e,this.D_=new Gm,this.x_=null}static C_(e){return new ey(e)}get F_(){if(this.x_)return this.x_;throw lu(60996)}addReference(e,t,n){return this.D_.addReference(n,t),this.F_.delete(n.toString()),el.resolve()}removeReference(e,t,n){return this.D_.removeReference(n,t),this.F_.add(n.toString()),el.resolve()}markPotentiallyOrphaned(e,t){return this.F_.add(t.toString()),el.resolve()}removeTarget(e,t){this.D_.s_(t.targetId).forEach(e=>this.F_.add(e.toString()));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.F_.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}b_(){this.x_=new Set}v_(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return el.forEach(this.F_,n=>{const r=Vu.fromPath(n);return this.O_(e,r).next(e=>{e||t.removeEntry(r,Wu.min())})}).next(()=>(this.x_=null,t.apply(e)))}updateLimboDocument(e,t){return this.O_(e,t).next(e=>{e?this.F_.delete(t.toString()):this.F_.add(t.toString())})}y_(e){return 0}O_(e,t){return el.or([()=>el.resolve(this.D_.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.S_(e,t)])}}class ty{constructor(e,t){this.persistence=e,this.M_=new Ad(e=>function(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t=al(t)),t=il(e.get(n),t);return al(t)}(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=function(e,t){return new Dp(e,t)}(this,t)}static C_(e,t){return new ty(e,t)}b_(){}v_(e){return el.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}lr(e){const t=this.Ls(e);return this.persistence.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}Ls(e){let t=0;return this.Er(e,e=>{t++}).next(()=>t)}Er(e,t){return el.forEach(this.M_,(n,r)=>this.Us(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(),s=r.newChangeBuffer();return r.P_(e,r=>this.Us(e,r,t).next(e=>{e||(n++,s.removeEntry(r,Wu.min()))})).next(()=>s.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.M_.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.M_.set(n,e.currentSequenceNumber),el.resolve()}removeReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),el.resolve()}updateLimboDocument(e,t){return this.M_.set(t,e.currentSequenceNumber),el.resolve()}y_(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=Wl(e.data.value)),t}Us(e,t,n){return el.or([()=>this.persistence.S_(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const e=this.M_.get(t);return el.resolve(void 0!==e&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}class ny{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.wo=n,this.bo=r}static vo(e,t){let n=Ud(),r=Ud();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 ny(e,t.fromCache,n,r)}}function ry(e,t){return Vu.comparator(e.key,t.key)}class sy{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class iy{constructor(){this.So=!1,this.Do=!1,this.xo=100,this.Co=$n()?8:function(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}(Vn())>0?6:4}initialize(e,t){this.Fo=e,this.indexManager=t,this.So=!0}getDocumentsMatchingQuery(e,t,n,r){const s={result:null};return this.Oo(e,t).next(e=>{s.result=e}).next(()=>{if(!s.result)return this.Mo(e,t,r,n).next(e=>{s.result=e})}).next(()=>{if(s.result)return;const n=new sy;return this.No(e,t,n).next(r=>{if(s.result=r,this.Do)return this.Lo(e,t,n,r.size)})}).next(()=>s.result)}Lo(e,t,n,r){return Sm(t)?el.resolve():n.documentReadCount<this.xo?(iu()<=cr.DEBUG&&au("QueryEngine","SDK will not create cache indexes for query:",wd(t),"since it only creates cache indexes for collection contains","more than or equal to",this.xo,"documents"),el.resolve()):(iu()<=cr.DEBUG&&au("QueryEngine","Query:",wd(t),"scans",n.documentReadCount,"local documents and returns",r,"documents as results."),n.documentReadCount>this.Co*r?(iu()<=cr.DEBUG&&au("QueryEngine","The SDK decides to create cache indexes for query:",wd(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,yd(t))):el.resolve())}Oo(e,t){if(Sm(t))return el.resolve(null);let n=t;if(gd(n))return el.resolve(null);let r=yd(n);return this.indexManager.getIndexType(e,r).next(t=>0===t?null:(null!==n.limit&&1===t&&(n=_d(n,null,"F"),r=yd(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(t=>{const s=Ud(...t);return this.Fo.getDocuments(e,s).next(t=>this.indexManager.getMinOffset(e,r).next(r=>{const i=this.Bo(n,t);return this.Uo(n,i,s,r.readTime)?this.Oo(e,_d(n,null,"F")):this.ko(e,i,n,r)}))})))}Mo(e,t,n,r){return(Sm(t)?function(e){for(const t of e.stages){if(t instanceof Sf||t instanceof Af)return!1;if(t instanceof Tf){if(t.condition instanceof hf&&"exists"===t.condition._expr.name&&t.condition._expr.params[0]instanceof sf&&t.condition._expr.params[0].fieldName===Pu)continue;return!1}}return!0}(t):gd(t))||r.isEqual(Wu.min())?el.resolve(null):this.Fo.getDocuments(e,n).next(s=>{const i=this.Bo(t,s);return this.Uo(t,i,n,r)?el.resolve(null):(iu()<=cr.DEBUG&&au("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Am(t)),this.ko(e,i,t,function(e,t){const n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,s=Wu.fromTimestamp(1e9===r?new Ku(n+1,0):new Ku(n,r));return new Xu(s,Vu.empty(),t)}(r,-1)).next(e=>e))})}Bo(e,t){let n,r;return Sm(e)?(n=new ll(ry),r=t=>Vm(e,t)):(n=new ll(bd(e)),r=t=>vd(e,t)),t.forEach((e,t)=>{r(t)&&(n=n.add(t))}),n}Uo(e,t,n,r){if(Sm(e))return function(e){return e.stages.some(e=>e instanceof Sf||e instanceof Af)}(e);if(null===e.limit)return!1;if(n.size!==t.size)return!0;const s="F"===e.limitType?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}No(e,t,n){return iu()<=cr.DEBUG&&au("QueryEngine","Using full collection scan to execute query:",Am(t)),this.Fo.getDocumentsMatchingQuery(e,t,Xu.min(),n)}ko(e,t,n,r){return this.Fo.getDocumentsMatchingQuery(e,n,r).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}class ay{constructor(e,t,n,r){this.persistence=e,this.qo=t,this.serializer=r,this.$o=new ol(Cu),this.Ko=new Ad(e=>Om(e),Rm),this.Wo=new Map,this.Qo=e.getRemoteDocumentCache(),this.g_=e.getTargetCache(),this.w_=e.getBundleCache(),this.Go(n)}Go(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Bm(this.Qo,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Qo.setIndexManager(this.indexManager),this.qo.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.$o))}}async function oy(e,t){const n=pu(e);return await n.persistence.runTransaction("Handle user change","readonly",e=>{let r;return n.mutationQueue.getAllMutationBatches(e).next(s=>(r=s,n.Go(t),n.mutationQueue.getAllMutationBatches(e))).next(t=>{const s=[],i=[];let a=Ud();for(const e of r){s.push(e.batchId);for(const t of e.mutations)a=a.add(t.key)}for(const e of t){i.push(e.batchId);for(const t of e.mutations)a=a.add(t.key)}return n.localDocuments.getDocuments(e,a).next(e=>({zo:e,removedBatchIds:s,addedBatchIds:i}))})})}function cy(e,t){const n=pu(e);return n.persistence.runTransaction("Get next mutation batch","readonly",e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)))}class uy{constructor(){this.activeTargetIds=Md}na(e){this.activeTargetIds=this.activeTargetIds.add(e)}ra(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ta(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class ly{constructor(){this.Ua=new uy,this.ka={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Ua.na(e),this.ka[e]||"not-current"}updateQueryState(e,t,n){this.ka[e]=t}removeLocalQueryTarget(e){this.Ua.ra(e)}isLocalQueryTarget(e){return this.Ua.activeTargetIds.has(e)}clearQueryState(e){delete this.ka[e]}getAllActiveQueryTargets(){return this.Ua.activeTargetIds}isActiveQueryTarget(e){return this.Ua.activeTargetIds.has(e)}start(){return this.Ua=new uy,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}function hy(){return"undefined"!=typeof document?document:null}class dy{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.qa=0,this.$a=null,this.Ka=!0}Wa(){0===this.qa&&(this.Qa("Unknown"),this.$a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.$a=null,this.Ga("Backend didn't respond within 10 seconds."),this.Qa("Offline"),Promise.resolve())))}za(e){"Online"===this.state?this.Qa("Unknown"):(this.qa++,this.qa>=1&&(this.ja(),this.Ga(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.Qa("Offline")))}set(e){this.ja(),this.qa=0,"Online"===e&&(this.Ka=!1),this.Qa(e)}Qa(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}Ga(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.Ka?(ou(t),this.Ka=!1):au("OnlineStateTracker",t)}ja(){null!==this.$a&&(this.$a.cancel(),this.$a=null)}}const py="RemoteStore";class fy{constructor(e,t,n,r,s){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Ha=[],this.Ja=new Map,this.Ya=new Map,this.Za=new Map,this.Xa=new Mm(1e3),this.eu=new Mm(1001),this.tu=new Set,this.nu=[],this.ru=s,this.ru.bt(e=>{n.enqueueAndForget(async()=>{yy(this)&&(au(py,"Restarting streams for network reachability change."),await async function(e){const t=pu(e);t.tu.add(4),await my(t),t.iu.set("Unknown"),t.tu.delete(4),await gy(t)}(this))})}),this.iu=new dy(n,r)}}async function gy(e){if(yy(e))for(const t of e.nu)await t(!0)}async function my(e){for(const t of e.nu)await t(!1)}function yy(e){return 0===pu(e).tu.size}async function _y(e,t,n){if(!tl(t))throw t;e.tu.add(1),await my(e),e.iu.set("Offline"),n||(n=()=>function(e){const t=pu(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",e=>t.g_.getLastRemoteSnapshotVersion(e))}(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{au(py,"Retrying IndexedDB access"),await n(),e.tu.delete(1),await gy(e)})}function wy(e,t){return t().catch(n=>_y(e,n,t))}async function vy(e){const t=pu(e),n=ky(t);let r=t.Ha.length>0?t.Ha[t.Ha.length-1].batchId:-1;for(;by(t);)try{const e=await cy(t.localStore,r);if(null===e){0===t.Ha.length&&n.Nn();break}r=e.batchId,Ey(t,e)}catch(e){await _y(t,e)}Ty(t)&&Sy(t)}function by(e){return yy(e)&&e.Ha.length<10}function Ey(e,t){e.Ha.push(t);const n=ky(e);n.Fn()&&n.Jn&&n.Yn(t.mutations)}function Ty(e){return yy(e)&&!ky(e).Cn()&&e.Ha.length>0}function Sy(e){ky(e).start()}async function Ay(e){ky(e).er()}async function Iy(e){const t=ky(e);for(const n of e.Ha)t.Yn(n.mutations)}async function Cy(e,t,n){const r=e.Ha.shift(),s=Nm.from(r,t,n);await wy(e,()=>e.remoteSyncer.applySuccessfulWrite(s)),await vy(e)}async function Oy(e,t){t&&ky(e).Jn&&await async function(e,t){if(function(e){return function(e){switch(e){case fu.OK:return lu(64938);case fu.CANCELLED:case fu.UNKNOWN:case fu.DEADLINE_EXCEEDED:case fu.RESOURCE_EXHAUSTED:case fu.INTERNAL:case fu.UNAVAILABLE:case fu.UNAUTHENTICATED:return!1;case fu.INVALID_ARGUMENT:case fu.NOT_FOUND:case fu.ALREADY_EXISTS:case fu.PERMISSION_DENIED:case fu.FAILED_PRECONDITION:case fu.ABORTED:case fu.OUT_OF_RANGE:case fu.UNIMPLEMENTED:case fu.DATA_LOSS:return!0;default:return lu(15467,{code:e})}}(e)&&e!==fu.ABORTED}(t.code)){const n=e.Ha.shift();ky(e).Mn(),await wy(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await vy(e)}}(e,t),Ty(e)&&Sy(e)}async function Ry(e,t){const n=pu(e);n.asyncQueue.verifyOperationInProgress(),au(py,"RemoteStore received new credentials");const r=yy(n);n.tu.add(3),await my(n),r&&n.iu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.tu.delete(3),await gy(n)}function ky(e){return e.ou||(e.ou=function(e,t,n){const r=pu(e);return r.nr(),new Tp(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Qt:()=>Promise.resolve(),zt:Ay.bind(null,e),Ht:Oy.bind(null,e),Zn:Iy.bind(null,e),Xn:Cy.bind(null,e)}),e.nu.push(async t=>{t?(e.ou.Mn(),await vy(e)):(await e.ou.stop(),e.Ha.length>0&&(au(py,`Stopping write stream with ${e.Ha.length} pending writes`),e.Ha=[]))})),e.ou}class Ny{constructor(e,t,n,r,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new mu,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,s){const i=Date.now()+n,a=new Ny(e,t,i,r,s);return a.start(n),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new gu(fu.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 xy(e,t){if(ou("AsyncQueue",`${t}: ${e}`),tl(e))return new gu(fu.UNAVAILABLE,`${t}: ${e}`);throw e}class Py{constructor(){this.queries=Dy(),this.onlineState="Unknown",this.Pu=new Set}terminate(){!function(e,t){const n=pu(e),r=n.queries;n.queries=Dy(),r.forEach((e,n)=>{for(const e of n.Eu)e.onError(t)})}(this,new gu(fu.ABORTED,"Firestore shutting down"))}}function Dy(){return new Ad(e=>Im(e),Cm)}var Ly;!function(e){e.Default="default",e.Cache="cache"}(Ly||(Ly={}));class Uy{constructor(e,t,n,r,s,i){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.Xu={},this.ec=new Ad(e=>Im(e),Cm),this.tc=new Map,this.nc=new Set,this.rc=new ol(Vu.comparator),this.sc=new Map,this._c=new Gm,this.oc={},this.ac=new Map,this.uc=Mm.Cs(),this.onlineState="Unknown",this.cc=void 0}get isPrimaryClient(){return!0===this.cc}}async function My(e,t,n){const r=function(e){const t=pu(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Fy.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=$y.bind(null,t),t}(e);try{const e=await function(e,t){const n=pu(e),r=Ku.now(),s=t.reduce((e,t)=>e.add(t.key),Ud());let i,a;return n.persistence.runTransaction("Locally write mutations","readwrite",e=>{let o=Cd(),c=Ud();return n.Qo.getEntries(e,s).next(e=>{o=e,o.forEach((e,t)=>{t.isValidDocument()||(c=c.add(e))})}).next(()=>n.localDocuments.getOverlayedDocuments(e,o)).next(s=>{i=s;const a=[];for(const e of t){const t=Ph(e,i.get(e.key).overlayedDocument);null!=t&&a.push(new Uh(e.key,t,ah(t.value.mapValue),Ch.exists(!0)))}return n.mutationQueue.addMutationBatch(e,r,a,t)}).next(t=>{a=t;const r=t.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)})}).then(()=>({batchId:a.batchId,changes:kd(i)}))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.oc[e.currentUser.toKey()];r||(r=new ol(Cu)),r=r.insert(t,n),e.oc[e.currentUser.toKey()]=r}(r,e.batchId,n),await Hy(r,e.changes),await vy(r.remoteStore)}catch(e){const t=xy(e,"Failed to persist write");n.reject(t)}}function Vy(e,t,n){const r=pu(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const e=[];r.ec.forEach((n,r)=>{const s=r.view.Ru(t);s.snapshot&&e.push(s.snapshot)}),function(e,t){const n=pu(e);n.onlineState=t;let r=!1;n.queries.forEach((e,n)=>{for(const e of n.Eu)e.Ru(t)&&(r=!0)}),r&&function(e){e.Pu.forEach(e=>{e.next()})}(n)}(r.eventManager,t),e.length&&r.Xu.zn(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function Fy(e,t){const n=pu(e),r=t.batch.batchId;try{const e=await function(e,t){const n=pu(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{const r=t.batch.keys(),s=n.Qo.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){const s=n.batch,i=s.keys();let a=el.resolve();return i.forEach(e=>{a=a.next(()=>r.getEntry(t,e)).next(t=>{const i=n.docVersions.get(e);du(null!==i,48541),t.version.compareTo(i)<0&&(s.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))})}),a.next(()=>e.mutationQueue.removeMutationBatch(t,s))}(n,e,t,s).next(()=>s.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=Ud();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);By(n,r,null),jy(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await Hy(n,e)}catch(e){await Zu(e)}}async function $y(e,t,n){const r=pu(e);try{const e=await function(e,t){const n=pu(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let r;return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(du(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);By(r,t,n),jy(r,t),r.sharedClientState.updateMutationState(t,"rejected",n),await Hy(r,e)}catch(n){await Zu(n)}}function jy(e,t){(e.ac.get(t)||[]).forEach(e=>{e.resolve()}),e.ac.delete(t)}function By(e,t,n){const r=pu(e);let s=r.oc[r.currentUser.toKey()];if(s){const e=s.get(t);e&&(n?e.reject(n):e.resolve(),s=s.remove(t)),r.oc[r.currentUser.toKey()]=s}}async function Hy(e,t,n){const r=pu(e),s=[],i=[],a=[];r.ec.isEmpty()||(r.ec.forEach((e,o)=>{a.push(r.lc(o,t,n).then(e=>{if((e||n)&&r.isPrimaryClient){const t=e?!e.fromCache:n?.targetChanges.get(o.targetId)?.current;r.sharedClientState.updateQueryState(o.targetId,t?"current":"not-current")}if(e){s.push(e);const t=ny.vo(o.targetId,e);i.push(t)}}))}),await Promise.all(a),r.Xu.zn(s),await async function(e,t){const n=pu(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",e=>el.forEach(t,t=>el.forEach(t.wo,r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r)).next(()=>el.forEach(t.bo,r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))}catch(e){if(!tl(e))throw e;au("LocalStore","Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.$o.get(t),r=e.snapshotVersion,s=e.withLastLimboFreeSnapshotVersion(r);n.$o=n.$o.insert(t,s)}}}(r.localStore,i))}async function zy(e,t){const n=pu(e);if(!n.currentUser.isEqual(t)){au("SyncEngine","User change. New user:",t.toKey());const e=await oy(n.localStore,t);n.currentUser=t,function(e,t){e.ac.forEach(e=>{e.forEach(e=>{e.reject(new gu(fu.CANCELLED,t))})}),e.ac.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Hy(n,e.zo)}}class qy{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=np(e.databaseInfo.databaseId),this.sharedClientState=this.Rc(e),this.persistence=this.Ic(e),await this.persistence.start(),this.localStore=this.Ac(e),this.gcScheduler=this.Vc(e,this.localStore),this.indexBackfillerScheduler=this.dc(e,this.localStore)}Vc(e,t){return null}dc(e,t){return null}Ac(e){return function(e,t,n,r){return new ay(e,t,n,r)}(this.persistence,new iy,e.initialUser,this.serializer)}Ic(e){return new Jm(ey.C_,this.serializer)}Rc(e){return new ly}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}qy.provider={build:()=>new qy};class Gy extends qy{constructor(e){super(),this.cacheSizeBytes=e}Vc(e,t){du(this.persistence.referenceDelegate instanceof ty,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new Pp(n,e.asyncQueue,t)}Ic(e){const t=void 0!==this.cacheSizeBytes?Rp.withCacheSize(this.cacheSizeBytes):Rp.DEFAULT;return new Jm(e=>ty.C_(e,t),this.serializer)}}class Ky{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=>Vy(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=zy.bind(null,this.syncEngine),await async function(e,t){const n=pu(e);t?(n.tu.delete(2),await gy(n)):t||(n.tu.add(2),await my(n),n.iu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new Py}createDatastore(e){const t=np(e.databaseInfo.databaseId),n=function(e){return new wp(e)}(e.databaseInfo);return function(e,t,n,r){return new Ap(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,s){return new fy(e,t,n,r,s)}(this.localStore,this.datastore,e.asyncQueue,e=>Vy(this.syncEngine,e,0),lp.C()?new lp:new cp)}createSyncEngine(e,t){return function(e,t,n,r,s,i,a){const o=new Uy(e,t,n,r,s,i);return a&&(o.cc=!0),o}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){await async function(e){const t=pu(e);au(py,"RemoteStore shutting down."),t.tu.add(5),await my(t),t.ru.shutdown(),t.iu.set("Unknown")}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}Ky.provider={build:()=>new Ky};const Wy="FirestoreClient";class Yy{constructor(e,t,n,r,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this._databaseInfo=r,this.user=nu.UNAUTHENTICATED,this.clientId=Iu.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(n,async e=>{au(Wy,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(au(Wy,"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 mu;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=xy(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}}async function Xy(e,t){e.asyncQueue.verifyOperationInProgress(),au(Wy,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener(async e=>{r.isEqual(e)||(await oy(t.localStore,e),r=e)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}async function Qy(e,t){e.asyncQueue.verifyOperationInProgress();const n=await async function(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){au(Wy,"Using user provided OfflineComponentProvider");try{await Xy(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(e){return"FirebaseError"===e.name?e.code===fu.FAILED_PRECONDITION||e.code===fu.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}(n))throw n;cu("Error using user provided cache. Falling back to memory cache: "+n),await Xy(e,new qy)}}else au(Wy,"Using default OfflineComponentProvider"),await Xy(e,new Gy(void 0));return e._offlineComponents}(e);au(Wy,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>Ry(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>Ry(t.remoteStore,n)),e._onlineComponents=t}function Jy(e){return async function(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(au(Wy,"Using user provided OnlineComponentProvider"),await Qy(e,e._uninitializedComponentsProvider._online)):(au(Wy,"Using default OnlineComponentProvider"),await Qy(e,new Ky))),e._onlineComponents}(e).then(e=>e.syncEngine)}const Zy="AsyncQueue";class e_{constructor(e=Promise.resolve()){this.qc=[],this.$c=!1,this.Kc=[],this.Wc=null,this.Qc=!1,this.Gc=!1,this.zc=[],this.xn=new vp(this,"async_queue_retry"),this.jc=()=>{const e=hy();e&&au(Zy,"Visibility state changed to "+e.visibilityState),this.xn.gn()},this.Hc=e;const t=hy();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.jc)}get isShuttingDown(){return this.$c}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Jc(),this.Yc(e)}enterRestrictedMode(e){if(!this.$c){this.$c=!0,this.Gc=e||!1;const t=hy();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.jc)}}enqueue(e){if(this.Jc(),this.$c)return new Promise(()=>{});const t=new mu;return this.Yc(()=>this.$c&&this.Gc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.qc.push(e),this.Zc()))}async Zc(){if(0!==this.qc.length){try{await this.qc[0](),this.qc.shift(),this.xn.reset()}catch(e){if(!tl(e))throw e;au(Zy,"Operation failed with retryable error: "+e)}this.qc.length>0&&this.xn.mn(()=>this.Zc())}}Yc(e){const t=this.Hc.then(()=>(this.Qc=!0,e().catch(e=>{throw this.Wc=e,this.Qc=!1,ou("INTERNAL UNHANDLED ERROR: ",t_(e)),e}).then(e=>(this.Qc=!1,e))));return this.Hc=t,t}enqueueAfterDelay(e,t,n){this.Jc(),this.zc.indexOf(e)>-1&&(t=0);const r=Ny.createAndSchedule(this,e,t,n,e=>this.Xc(e));return this.Kc.push(r),r}Jc(){this.Wc&&lu(47125,{el:t_(this.Wc)})}verifyOperationInProgress(){}async tl(){let e;do{e=this.Hc,await e}while(e!==this.Hc)}nl(e){for(const t of this.Kc)if(t.timerId===e)return!0;return!1}rl(e){return this.tl().then(()=>{this.Kc.sort((e,t)=>e.targetTimeMs-t.targetTimeMs);for(const t of this.Kc)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.tl()})}il(e){this.zc.push(e)}Xc(e){const t=this.Kc.indexOf(e);this.Kc.splice(t,1)}}function t_(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}class n_ extends Vp{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new e_,this._persistenceKey=r?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new e_(e),this._firestoreClient=void 0,await e}}}function r_(e){if(e._terminated)throw new gu(fu.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){const t=e._freezeSettings(),n=function(e,t,n,r,s){return new Rl(e,t,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,op(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,r)}(e._databaseId,e._app?.options.appId||"",e._persistenceKey,e._app?.options.apiKey,t);e._componentsProvider||t.localCache?._offlineComponentProvider&&t.localCache?._onlineComponentProvider&&(e._componentsProvider={_offline:t.localCache._offlineComponentProvider,_online:t.localCache._onlineComponentProvider}),e._firestoreClient=new Yy(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}const s_="@firebase/firestore",i_="4.16.0";class a_{constructor(e,t,n,r,s){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new $p(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new o_(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){const t=this._document.data.field(Gp("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class o_ extends a_{data(){return super.data()}}class c_{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class u_ extends a_{constructor(e,t,n,r,s,i){super(e,t,n,r,i),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new l_(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(Gp("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new gu(fu.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=u_._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}}u_._jsonSchemaVersion="firestore/documentSnapshot/1.0",u_._jsonSchema={type:Hu("string",u_._jsonSchemaVersion),bundleSource:Hu("string","DocumentSnapshot"),bundleName:Hu("string"),bundle:Hu("string")};class l_ extends u_{data(e={}){return super.data(e)}}class h_{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new c_(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 l_(this._firestore,this._userDataWriter,n.key,n,new c_(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 gu(fu.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=>{Sm(e._snapshot.query)?function(e){const t=function(e){for(let t=e.stages.length-1;t>=0;t--){const n=e.stages[t];if(n instanceof Cf)return n.orderings}throw new Error("Pipeline must contain at least one Sort stage")}(e)}(e._snapshot.query):bd(e.query._query);const r=new l_(e._firestore,e._userDataWriter,n.doc.key,n.doc,new c_(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 l_(e._firestore,e._userDataWriter,t.doc.key,t.doc,new c_(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let s=-1,i=-1;return 0!==t.type&&(s=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),i=n.indexOf(t.doc.key)),{type:d_(t.type),doc:r,oldIndex:s,newIndex:i}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new gu(fu.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=h_._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Iu.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 d_(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return lu(61501,{type:e})}}function p_(e){return function(e,t){const n=r_(e);return function(e,t){const n=new mu;return e.asyncQueue.enqueueAndForget(async()=>My(await Jy(e),t,n)),n.promise}(n,t)}(Bu(e.firestore,n_),[new $h(e._key,Ch.none())])}h_._jsonSchemaVersion="firestore/querySnapshot/1.0",h_._jsonSchema={type:Hu("string",h_._jsonSchemaVersion),bundleSource:Hu("string","QuerySnapshot"),bundleName:Hu("string"),bundle:Hu("string")},function(e,t=!0){(function(e){ru=e})(ws),fs(new sr("firestore",(e,{instanceIdentifier:n,options:r})=>{const s=e.getProvider("app").getImmediate(),i=new n_(new vu(e.getProvider("auth-internal")),new Su(s,e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new gu(fu.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Nl(e.options.projectId,t)}(s,n),s);return r={useFetchStreams:t,...r},i._setSettings(r),i},"PUBLIC").setMultipleInstances(!0)),Es(s_,i_,e),Es(s_,i_,"esm2020")}();const f_="firebasestorage.googleapis.com",g_="storageBucket";class m_ extends zn{constructor(e,t,n=0){super(w_(e),`Firebase Storage: ${t} (${w_(e)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,m_.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return w_(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 y_,__;function w_(e){return"storage/"+e}function v_(){return new m_(y_.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function b_(){return new m_(y_.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function E_(){return new m_(y_.CANCELED,"User canceled the upload/download.")}function T_(){return new m_(y_.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function S_(e){return new m_(y_.INVALID_ARGUMENT,e)}function A_(){return new m_(y_.APP_DELETED,"The Firebase app was deleted.")}function I_(e,t){return new m_(y_.INVALID_FORMAT,"String does not match format '"+e+"': "+t)}function C_(e){throw new m_(y_.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"}(y_||(y_={}));class O_{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=O_.makeFromUrl(e,t)}catch(t){return new O_(e,"")}if(""===n.path)return n;throw r=e,new m_(y_.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+r+"'.");var r}static makeFromUrl(e,t){let n=null;const r="([A-Za-z0-9.\\-_]+)";const s=new RegExp("^gs://"+r+"(/(.*))?$","i");function i(e){e.path_=decodeURIComponent(e.path)}const a=t.replace(/[.]/g,"\\."),o=[{regex:s,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:new RegExp(`^https?://${a}/v[A-Za-z0-9_]+/b/${r}/o(/([^?#]*).*)?$`,"i"),indices:{bucket:1,path:3},postModify:i},{regex:new RegExp(`^https?://${t===f_?"(?:storage.googleapis.com|storage.cloud.google.com)":t}/${r}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:i}];for(let t=0;t<o.length;t++){const r=o[t],s=r.regex.exec(e);if(s){const e=s[r.indices.bucket];let t=s[r.indices.path];t||(t=""),n=new O_(e,t),r.postModify(n);break}}if(null==n)throw function(e){return new m_(y_.INVALID_URL,"Invalid URL '"+e+"'.")}(e);return n}}class R_{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}function k_(e){return"string"==typeof e||e instanceof String}function N_(e){return x_()&&e instanceof Blob}function x_(){return"undefined"!=typeof Blob}function P_(e,t,n,r){if(r<t)throw S_(`Invalid value for '${e}'. Expected ${t} or greater.`);if(r>n)throw S_(`Invalid value for '${e}'. Expected ${n} or less.`)}function D_(e,t,n){let r=t;return null==n&&(r=`https://${t}`),`${n}://${r}/v0${e}`}function L_(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 U_(e,t){const n=e>=500&&e<600,r=-1!==[408,429].indexOf(e),s=-1!==t.indexOf(e);return n||r||s}!function(e){e[e.NO_ERROR=0]="NO_ERROR",e[e.NETWORK_ERROR=1]="NETWORK_ERROR",e[e.ABORT=2]="ABORT"}(__||(__={}));class M_{constructor(e,t,n,r,s,i,a,o,c,u,l,h=!0,d=!1){this.url_=e,this.method_=t,this.headers_=n,this.body_=r,this.successCodes_=s,this.additionalRetryCodes_=i,this.callback_=a,this.errorCallback_=o,this.timeout_=c,this.progressCallback_=u,this.connectionFactory_=l,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 V_(!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()===__.NO_ERROR,s=n.getStatus();if(!t||U_(s,this.additionalRetryCodes_)&&this.retry){const t=n.getErrorCode()===__.ABORT;return void e(!1,new V_(!1,null,t))}const i=-1!==this.successCodes_.indexOf(s);e(!0,new V_(i,n))})},t=(e,t)=>{const n=this.resolve_,r=this.reject_,s=t.connection;if(t.wasSuccessCode)try{const e=this.callback_(s,s.getResponse());!function(e){return void 0!==e}(e)?n():n(e)}catch(e){r(e)}else if(null!==s){const e=v_();e.serverResponse=s.getErrorText(),this.errorCallback_?r(this.errorCallback_(s,e)):r(e)}else if(t.canceled){r(this.appDelete_?A_():E_())}else{r(b_())}};this.canceled_?t(0,new V_(!1,null,!0)):this.backoffId_=function(e,t,n){let r=1,s=null,i=null,a=!1,o=0;function c(){return 2===o}let u=!1;function l(...e){u||(u=!0,t.apply(null,e))}function h(t){s=setTimeout(()=>{s=null,e(p,c())},t)}function d(){i&&clearTimeout(i)}function p(e,...t){if(u)return void d();if(e)return d(),void l.call(null,e,...t);if(c()||a)return d(),void l.call(null,e,...t);let n;r<64&&(r*=2),1===o?(o=2,n=0):n=1e3*(r+Math.random()),h(n)}let f=!1;function g(e){f||(f=!0,d(),u||(null!==s?(e||(o=2),clearTimeout(s),h(0)):e||(o=1)))}return h(0),i=setTimeout(()=>{a=!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 V_{constructor(e,t,n){this.wasSuccessCode=e,this.connection=t,this.canceled=!!n}}function F_(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function $_(...e){const t=F_();if(void 0!==t){const n=new t;for(let t=0;t<e.length;t++)n.append(e[t]);return n.getBlob()}if(x_())return new Blob(e);throw new m_(y_.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}function j_(e){if("undefined"==typeof atob)throw t="base-64",new m_(y_.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 B_="raw",H_="base64",z_="base64url",q_="data_url";class G_{constructor(e,t){this.data=e,this.contentType=t||null}}function K_(e,t){switch(e){case B_:return new G_(W_(t));case H_:case z_:return new G_(Y_(e,t));case q_:return new G_(function(e){const t=new X_(e);return t.base64?Y_(H_,t.rest):function(e){let t;try{t=decodeURIComponent(e)}catch(e){throw I_(q_,"Malformed data URL.")}return W_(t)}(t.rest)}(t),new X_(t).contentType)}throw v_()}function W_(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 Y_(e,t){switch(e){case H_:{const n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r){throw I_(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?")}break}case z_:{const n=-1!==t.indexOf("+"),r=-1!==t.indexOf("/");if(n||r){throw I_(e,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?")}t=t.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=j_(t)}catch(t){if(t.message.includes("polyfill"))throw t;throw I_(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 X_{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(null===t)throw I_(q_,"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 Q_{constructor(e,t){let n=0,r="";N_(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(N_(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 Q_(n)}{const n=new Uint8Array(this.data_.buffer,e,t-e);return new Q_(n,!0)}}static getBlob(...e){if(x_()){const t=e.map(e=>e instanceof Q_?e.data_:e);return new Q_($_.apply(null,t))}{const t=e.map(e=>k_(e)?K_(B_,e).data:e.data_);let n=0;t.forEach(e=>{n+=e.byteLength});const r=new Uint8Array(n);let s=0;return t.forEach(e=>{for(let t=0;t<e.length;t++)r[s++]=e[t]}),new Q_(r,!0)}}uploadData(){return this.data_}}function J_(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 Z_(e){const t=e.lastIndexOf("/",e.length-2);return-1===t?e:e.slice(t+1)}function ew(e,t){return t}class tw{constructor(e,t,n,r){this.server=e,this.local=t||e,this.writable=!!n,this.xform=r||ew}}let nw=null;function rw(){if(nw)return nw;const e=[];e.push(new tw("bucket")),e.push(new tw("generation")),e.push(new tw("metageneration")),e.push(new tw("name","fullPath",!0));const t=new tw("name");t.xform=function(e,t){return function(e){return!k_(e)||e.length<2?e:Z_(e)}(t)},e.push(t);const n=new tw("size");return n.xform=function(e,t){return void 0!==t?Number(t):t},e.push(n),e.push(new tw("timeCreated")),e.push(new tw("updated")),e.push(new tw("md5Hash",null,!0)),e.push(new tw("cacheControl",null,!0)),e.push(new tw("contentDisposition",null,!0)),e.push(new tw("contentEncoding",null,!0)),e.push(new tw("contentLanguage",null,!0)),e.push(new tw("contentType",null,!0)),e.push(new tw("metadata","customMetadata",!0)),nw=e,nw}function sw(e,t,n){const r={type:"file"},s=n.length;for(let e=0;e<s;e++){const s=n[e];r[s.local]=s.xform(r,t[s.server])}return function(e,t){Object.defineProperty(e,"ref",{get:function(){const n=e.bucket,r=e.fullPath,s=new O_(n,r);return t._makeStorageReference(s)}})}(r,e),r}function iw(e,t,n){const r=J_(t);if(null===r)return null;return sw(e,r,n)}function aw(e,t){const n={},r=t.length;for(let s=0;s<r;s++){const r=t[s];r.writable&&(n[r.server]=e[r.local])}return JSON.stringify(n)}class ow{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 cw(e){if(!e)throw v_()}function uw(e,t){return function(n,r){const s=iw(e,r,t);return cw(null!==s),s}}function lw(e,t){return function(n,r){const s=iw(e,r,t);return cw(null!==s),function(e,t,n,r){const s=J_(t);if(null===s)return null;if(!k_(s.downloadTokens))return null;const i=s.downloadTokens;if(0===i.length)return null;const a=encodeURIComponent;return i.split(",").map(t=>{const s=e.bucket,i=e.fullPath;return D_("/b/"+a(s)+"/o/"+a(i),n,r)+L_({alt:"media",token:t})})[0]}(s,r,e.host,e._protocol)}}function hw(e){return function(t,n){let r;var s,i;return 401===t.getStatus()?r=t.getErrorText().includes("Firebase App Check token is invalid")?new m_(y_.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new m_(y_.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(i=e.bucket,r=new m_(y_.QUOTA_EXCEEDED,"Quota for bucket '"+i+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(s=e.path,r=new m_(y_.UNAUTHORIZED,"User does not have permission to access '"+s+"'.")):r=n,r.status=t.getStatus(),r.serverResponse=n.serverResponse,r}}function dw(e){const t=hw(e);return function(n,r){let s=t(n,r);var i;return 404===n.getStatus()&&(i=e.path,s=new m_(y_.OBJECT_NOT_FOUND,"Object '"+i+"' does not exist.")),s.serverResponse=r.serverResponse,s}}function pw(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 fw{constructor(e,t,n,r){this.current=e,this.total=t,this.finalized=!!n,this.metadata=r||null}}function gw(e,t){let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Status")}catch(e){cw(!1)}return cw(!!n&&-1!==(t||["active"]).indexOf(n)),n}const mw=262144;function yw(e,t,n,r,s,i,a,o){const c=new fw(0,0);if(a?(c.current=a.current,c.total=a.total):(c.current=0,c.total=r.size()),r.size()!==c.total)throw new m_(y_.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");const u=c.total-c.current;let l=u;s>0&&(l=Math.min(l,s));const h=c.current,d=h+l;let p="";p=0===l?"finalize":u===l?"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 T_();const m=t.maxUploadRetryTime,y=new ow(n,"POST",function(e,n){const s=gw(e,["active","final"]),a=c.current+l,o=r.size();let u;return u="final"===s?uw(t,i)(e,n):null,new fw(a,o,"final"===s,u)},m);return y.headers=f,y.body=g.uploadData(),y.progressCallback=o||null,y.errorHandler=hw(e),y}const _w="running",ww="paused",vw="success",bw="canceled",Ew="error";function Tw(e){switch(e){case"running":case"pausing":case"canceling":return _w;case"paused":return ww;case"success":return vw;case"canceled":return bw;default:return Ew}}class Sw{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 Aw(e){return(...t)=>{Promise.resolve().then(()=>e(...t))}}class Iw{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=__.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=__.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=__.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,n,r,s){if(this.sent_)throw C_("cannot .send() more than once");if(nr(e)&&n&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(t,e,!0),void 0!==s)for(const e in s)s.hasOwnProperty(e)&&this.xhr_.setRequestHeader(e,s[e].toString());return void 0!==r?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw C_("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw C_("cannot .getStatus() before sending");try{return this.xhr_.status}catch(e){return-1}}getResponse(){if(!this.sent_)throw C_("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw C_("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 Cw extends Iw{initXhr(){this.xhr_.responseType="text"}}function Ow(){return new Cw}class Rw{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=rw(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=e=>{if(this._request=void 0,this._chunkMultiplier=1,e._codeEquals(y_.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const t=this.isExponentialBackoffExpired();if(U_(e.status,[])){if(!t)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();e=b_()}this._error=e,this._transition("error")}},this._metadataErrorHandler=e=>{this._request=void 0,e._codeEquals(y_.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,s){const i=t.bucketOnlyServerUrl(),a=pw(t,r,s),o={name:a.fullPath},c=D_(i,e.host,e._protocol),u={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},l=aw(a,n),h=e.maxUploadRetryTime,d=new ow(c,"POST",function(e){let t;gw(e);try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(e){cw(!1)}return cw(k_(t)),t},h);return d.urlParams=o,d.headers=u,d.body=l,d.errorHandler=hw(t),d}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),r=this._ref.storage._makeRequest(n,Ow,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 s=e.maxUploadRetryTime,i=new ow(n,"POST",function(e){const t=gw(e,["active","final"]);let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(e){cw(!1)}n||cw(!1);const s=Number(n);return cw(!isNaN(s)),new fw(s,r.size(),"final"===t)},s);return i.headers={"X-Goog-Upload-Command":"query"},i.errorHandler=hw(t),i}(this._ref.storage,this._ref._location,e,this._blob),s=this._ref.storage._makeRequest(r,Ow,t,n);this._request=s,s.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=mw*this._chunkMultiplier,t=new fw(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken((r,s)=>{let i;try{i=yw(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 a=this._ref.storage._makeRequest(i,Ow,r,s,!1);this._request=a,a.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*(mw*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{const n=function(e,t,n){const r=D_(t.fullServerUrl(),e.host,e._protocol),s=e.maxOperationRetryTime,i=new ow(r,"GET",uw(e,n),s);return i.errorHandler=dw(t),i}(this._ref.storage,this._ref._location,this._mappings),r=this._ref.storage._makeRequest(n,Ow,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,s){const i=t.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"},o=function(){let e="";for(let t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}();a["Content-Type"]="multipart/related; boundary="+o;const c=pw(t,r,s),u="--"+o+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+aw(c,n)+"\r\n--"+o+"\r\nContent-Type: "+c.contentType+"\r\n\r\n",l="\r\n--"+o+"--",h=Q_.getBlob(u,r,l);if(null===h)throw T_();const d={name:c.fullPath},p=D_(i,e.host,e._protocol),f=e.maxUploadRetryTime,g=new ow(p,"POST",uw(e,n),f);return g.urlParams=d,g.headers=a,g.body=h.uploadData(),g.errorHandler=hw(t),g}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),r=this._ref.storage._makeRequest(n,Ow,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=E_(),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=Tw(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 s=new Sw(t||void 0,n||void 0,r||void 0);return this._addObserver(s),()=>{this._removeObserver(s)}}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(Tw(this._state)){case vw:Aw(this._resolve.bind(null,this.snapshot))();break;case bw:case Ew:Aw(this._reject.bind(null,this._error))();break;default:e=!1}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(Tw(this._state)){case _w:case ww:e.next&&Aw(e.next.bind(e,this.snapshot))();break;case vw:e.complete&&Aw(e.complete.bind(e))();break;default:e.error&&Aw(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 kw{constructor(e,t){this._service=e,this._location=t instanceof O_?t:O_.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new kw(e,t)}get root(){const e=new O_(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return Z_(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 O_(this._location.bucket,e);return new kw(this._service,t)}_throwIfRoot(e){if(""===this._location.path)throw function(e){return new m_(y_.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 Nw(e,t){e._throwIfRoot("updateMetadata");const n=function(e,t,n,r){const s=D_(t.fullServerUrl(),e.host,e._protocol),i=aw(n,r),a=e.maxOperationRetryTime,o=new ow(s,"PATCH",uw(e,r),a);return o.headers={"Content-Type":"application/json; charset=utf-8"},o.body=i,o.errorHandler=dw(t),o}(e.storage,e._location,t,rw());return e.storage.makeRequestWithTokens(n,Ow)}function xw(e){e._throwIfRoot("getDownloadURL");const t=function(e,t,n){const r=D_(t.fullServerUrl(),e.host,e._protocol),s=e.maxOperationRetryTime,i=new ow(r,"GET",lw(e,n),s);return i.errorHandler=dw(t),i}(e.storage,e._location,rw());return e.storage.makeRequestWithTokens(t,Ow).then(e=>{if(null===e)throw new m_(y_.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return e})}function Pw(e,t){if(e instanceof Uw){const n=e;if(null==n._bucket)throw new m_(y_.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+g_+"' property when initializing the app?");const r=new kw(n,n._bucket);return null!=t?Pw(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 O_(e._location.bucket,n);return new kw(e.storage,r)}(e,t):e}function Dw(e,t){if(t&&/^[A-Za-z]+:\/\//.test(t)){if(e instanceof Uw)return new kw(e,t);throw S_("To use ref(service, url), the first argument must be a Storage instance.")}return Pw(e,t)}function Lw(e,t){const n=t?.[g_];return null==n?null:O_.makeFromBucketSpec(n,e)}class Uw{constructor(e,t,n,r,s,i=!1){this.app=e,this._authProvider=t,this._appCheckProvider=n,this._url=r,this._firebaseVersion=s,this._isUsingEmulator=i,this._bucket=null,this._host=f_,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=r?O_.makeFromBucketSpec(r,this._host):Lw(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=O_.makeFromBucketSpec(this._url,e):this._bucket=Lw(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){P_("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){P_("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(ms(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 kw(this,e)}_makeRequest(e,t,n,r,s=!0){if(this._deleted)return new R_(A_());{const i=function(e,t,n,r,s,i,a=!0,o=!1){const c=L_(e.urlParams),u=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,i),function(e,t){null!==t&&(e["X-Firebase-AppCheck"]=t)}(l,r),new M_(u,e.method,l,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,s,a,o)}(e,this._appId,n,r,t,this._firebaseVersion,s,this._isUsingEmulator);return this._requests.add(i),i.getPromise().then(()=>this._requests.delete(i),()=>this._requests.delete(i)),i}}async makeRequestWithTokens(e,t){const[n,r]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,n,r).getPromise()}}const Mw="@firebase/storage",Vw="0.14.3",Fw="storage";function $w(e,t,n){return function(e,t,n){return e._throwIfRoot("uploadBytesResumable"),new Rw(e,new Q_(t),n)}(e=tr(e),t,n)}function jw(e,{instanceIdentifier:t}){const n=e.getProvider("app").getImmediate(),r=e.getProvider("auth-internal"),s=e.getProvider("app-check-internal");return new Uw(n,r,s,t,ws)}fs(new sr(Fw,jw,"PUBLIC").setMultipleInstances(!0)),Es(Mw,Vw,""),Es(Mw,Vw,"esm2020");const Bw=JSON.parse(process.env.FIREBASE_CONFIG||"{}"),Hw=vs(Bw),zw=function(e){const t="object"==typeof e?e:bs(),n="string"==typeof e?e:kl,r=gs(t,"firestore").getImmediate({identifier:n});if(!r._initialized){const e=Pn("firestore");e&&function(e,t,n,r={}){e=Bu(e,Vp);const s=nr(t),i=e._getSettings(),a={...i,emulatorOptions:e._getEmulatorOptions()},o=`${t}:${n}`;s&&rr(`https://${o}`),i.host!==Lp&&i.host!==o&&cu("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const c={...i,host:o,ssl:s,emulatorOptions:r};if(!Kn(c,a)&&(e._setSettings(c),r.mockUserToken)){let t,n;if("string"==typeof r.mockUserToken)t=r.mockUserToken,n=nu.MOCK_USER;else{t=Mn(r.mockUserToken,e._app?.options.projectId);const s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new gu(fu.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new nu(s)}e._authCredentials=new wu(new yu(t,n))}}(r,...e)}return r}(Hw),qw=function(e=bs(),t){const n=gs(e=tr(e),Fw).getImmediate({identifier:t}),r=Pn("storage");return r&&function(e,t,n,r={}){!function(e,t,n,r={}){e.host=`${t}:${n}`;const s=nr(t);s&&rr(`https://${e.host}/b`),e._isUsingEmulator=!0,e._protocol=s?"https":"http";const{mockUserToken:i}=r;i&&(e._overrideAuthToken="string"==typeof i?i:Mn(i,e.app.options.projectId))}(e,t,n,r)}(n,...r),n}(Hw),Gw=jo(Hw),Kw=Gw.currentUser,Ww=i`
|
|
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
|
-
|
|
198
|
+
`,Yw=i`
|
|
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
|
-
`,
|
|
219
|
+
`,Xw=i`
|
|
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
|
-
`,
|
|
240
|
+
`,Qw=i`
|
|
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
|
|
257
|
+
`;var Jw=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Zw=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let ev=class extends ie{constructor(){super(),this.source="",this.email="",this.password="",this.signIn=async(e,t)=>{const n=fa.credential(e,t);await async function(e,t){return Ia(qi(e),t)}(Gw,n).catch(e=>{})}}static get styles(){return[Sn,Yw,Xw,Ww,Qw,i`
|
|
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
|
|
270
|
+
`]}render(){return B`
|
|
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(){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});const $y=()=>{wn.dispatch(rn())};!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 Fy=async()=>function(e){return or(e).signOut()}(Lg),jy=async()=>{ty(My,"create_account")},Vy=async()=>{ty(My,"delete_account")},By=async(e,t)=>{await tf(Lp(Ng,e,t))};var zy=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},qy=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let Hy=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(()=>{jy()})}}static get styles(){return[In,$g,Fg,Ug,jg,s`
|
|
330
|
+
`}change(){wn.dispatch(Qt(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)}};Jw([le({type:String}),Zw("design:type",Object)],ev.prototype,"source",void 0),Jw([he(),Zw("design:type",Object)],ev.prototype,"email",void 0),Jw([he(),Zw("design:type",Object)],ev.prototype,"password",void 0),ev=Jw([oe("form-login"),Zw("design:paramtypes",[])],ev);const tv="@firebase/installations",nv="0.6.22",rv=1e4,sv=`w:${nv}`,iv="FIS_v2",av=36e5,ov=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 cv(e){return e instanceof zn&&e.code.includes("request-failed")}function uv({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function lv(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function hv(e,t){const n=(await t.json()).error;return ov.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function dv({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function pv(e,{refreshToken:t}){const n=dv(e);return n.append("Authorization",function(e){return`${iv} ${e}`}(t)),n}async function fv(e){const t=await e();return t.status>=500&&t.status<600?e():t}function gv(e){return new Promise(t=>{setTimeout(t,e)})}const mv=/^[cdef][\w-]{21}$/;function yv(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=function(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")}(e);return t.substr(0,22)}(e);return mv.test(t)?t:""}catch{return""}}function _v(e){return`${e.appName}!${e.appId}`}const wv=new Map;function vv(e,t){const n=_v(e);bv(n,t),function(e,t){const n=Tv();n&&n.postMessage({key:e,fid:t});Sv()}(n,t)}function bv(e,t){const n=wv.get(e);if(n)for(const e of n)e(t)}let Ev=null;function Tv(){return!Ev&&"BroadcastChannel"in self&&(Ev=new BroadcastChannel("[Firebase] FID Change"),Ev.onmessage=e=>{bv(e.data.key,e.data.fid)}),Ev}function Sv(){0===wv.size&&Ev&&(Ev.close(),Ev=null)}const Av="firebase-installations-store";let Iv=null;function Cv(){return Iv||(Iv=Ir("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(Av)}})),Iv}async function Ov(e,t){const n=_v(e),r=(await Cv()).transaction(Av,"readwrite"),s=r.objectStore(Av),i=await s.get(n);return await s.put(t,n),await r.done,i&&i.fid===t.fid||vv(e,t.fid),t}async function Rv(e){const t=_v(e),n=(await Cv()).transaction(Av,"readwrite");await n.objectStore(Av).delete(t),await n.done}async function kv(e,t){const n=_v(e),r=(await Cv()).transaction(Av,"readwrite"),s=r.objectStore(Av),i=await s.get(n),a=t(i);return void 0===a?await s.delete(n):await s.put(a,n),await r.done,!a||i&&i.fid===a.fid||vv(e,a.fid),a}async function Nv(e){let t;const n=await kv(e.appConfig,n=>{const r=function(e){const t=e||{fid:yv(),registrationStatus:0};return Dv(t)}(n),s=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(ov.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=uv(e),s=dv(e),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&s.append("x-firebase-client",e)}const a={fid:n,authVersion:iv,appId:e.appId,sdkVersion:sv},o={method:"POST",headers:s,body:JSON.stringify(a)},c=await fv(()=>fetch(r,o));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:lv(e.authToken)}}throw await hv("Create Installation",c)}(e,t);return Ov(e.appConfig,n)}catch(n){throw cv(n)&&409===n.customData.serverCode?await Rv(e.appConfig):await Ov(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:r}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:xv(e)}:{installationEntry:t}}(e,r);return t=s.registrationPromise,s.installationEntry});return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function xv(e){let t=await Pv(e.appConfig);for(;1===t.registrationStatus;)await gv(100),t=await Pv(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await Nv(e);return n||t}return t}function Pv(e){return kv(e,e=>{if(!e)throw ov.create("installation-not-found");return Dv(e)})}function Dv(e){return 1===(t=e).registrationStatus&&t.registrationTime+rv<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function Lv({appConfig:e,heartbeatServiceProvider:t},n){const r=function(e,{fid:t}){return`${uv(e)}/${t}/authTokens:generate`}(e,n),s=pv(e,n),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&s.append("x-firebase-client",e)}const a={installation:{sdkVersion:sv,appId:e.appId}},o={method:"POST",headers:s,body:JSON.stringify(a)},c=await fv(()=>fetch(r,o));if(c.ok){return lv(await c.json())}throw await hv("Generate Auth Token",c)}async function Uv(e,t=!1){let n;const r=await kv(e.appConfig,r=>{if(!Vv(r))throw ov.create("not-registered");const s=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+av}(e)}(s))return r;if(1===s.requestStatus)return n=async function(e,t){let n=await Mv(e.appConfig);for(;1===n.authToken.requestStatus;)await gv(100),n=await Mv(e.appConfig);const r=n.authToken;return 0===r.requestStatus?Uv(e,t):r}(e,t),r;{if(!navigator.onLine)throw ov.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 Lv(e,t),r={...t,authToken:n};return await Ov(e.appConfig,r),n}catch(n){if(!cv(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n={...t,authToken:{requestStatus:0}};await Ov(e.appConfig,n)}else await Rv(e.appConfig);throw n}}(e,t),t}});return n?await n:r.authToken}function Mv(e){return kv(e,e=>{if(!Vv(e))throw ov.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+rv<Date.now()?{...e,authToken:{requestStatus:0}}:e;var n})}function Vv(e){return void 0!==e&&2===e.registrationStatus}async function Fv(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await Nv(e);t&&await t}(n);return(await Uv(n,t)).token}function $v(e,t){const{appConfig:n}=e;return function(e,t){Tv();const n=_v(e);let r=wv.get(n);r||(r=new Set,wv.set(n,r)),r.add(t)}(n,t),()=>{!function(e,t){const n=_v(e),r=wv.get(n);r&&(r.delete(t),0===r.size&&wv.delete(n),Sv())}(n,t)}}function jv(e){return ov.create("missing-app-config-values",{valueName:e})}const Bv="installations",Hv=e=>{const t=gs(e.getProvider("app").getImmediate(),Bv).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:r}=await Nv(t);return r?r.catch(console.error):Uv(t).catch(console.error),n.fid}(t),getToken:e=>Fv(t,e)}};fs(new sr(Bv,e=>{const t=e.getProvider("app").getImmediate(),n=function(e){if(!e||!e.options)throw jv("App Configuration");if(!e.name)throw jv("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw jv(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:gs(t,"heartbeat"),_delete:()=>Promise.resolve()}},"PUBLIC")),fs(new sr("installations-internal",Hv,"PRIVATE")),Es(tv,nv),Es(tv,nv,"esm2020");const zv="analytics",qv="https://www.googletagmanager.com/gtag/js",Gv=new pr("@firebase/analytics"),Kv=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 Wv(e){if(!e.startsWith(qv)){const t=Kv.create("invalid-gtag-resource",{gtagURL:e});return Gv.warn(t.message),""}return e}function Yv(e){return Promise.all(e.map(e=>e.catch(e=>e)))}function Xv(e,t){const n=function(e,t){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(e,t)),n}("firebase-js-sdk-policy",{createScriptURL:Wv}),r=document.createElement("script"),s=`${qv}?l=${e}&id=${t}`;r.src=n?n?.createScriptURL(s):s,r.async=!0,document.head.appendChild(r)}function Qv(e,t,n,r){return async function(s,...i){try{if("event"===s){const[r,s]=i;await async function(e,t,n,r,s){try{let i=[];if(s&&s.send_to){let e=s.send_to;Array.isArray(e)||(e=[e]);const r=await Yv(n);for(const n of e){const e=r.find(e=>e.measurementId===n),s=e&&t[e.appId];if(!s){i=[];break}i.push(s)}}0===i.length&&(i=Object.values(t)),await Promise.all(i),e("event",r,s||{})}catch(e){Gv.error(e)}}(e,t,n,r,s)}else if("config"===s){const[s,a]=i;await async function(e,t,n,r,s,i){const a=r[s];try{if(a)await t[a];else{const e=(await Yv(n)).find(e=>e.measurementId===s);e&&await t[e.appId]}}catch(e){Gv.error(e)}e("config",s,i)}(e,t,n,r,s,a)}else if("consent"===s){const[t,n]=i;e("consent",t,n)}else if("get"===s){const[t,n,r]=i;e("get",t,n,r)}else if("set"===s){const[t]=i;e("set",t)}else e(s,...i)}catch(e){Gv.error(e)}}}const Jv=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 Zv(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function eb(e,t=Jv,n){const{appId:r,apiKey:s,measurementId:i}=e.options;if(!r)throw Kv.create("no-app-id");if(!s){if(i)return{measurementId:i,appId:r};throw Kv.create("no-api-key")}const a=t.getThrottleMetadata(r)||{backoffCount:0,throttleEndTimeMillis:Date.now()},o=new nb;return setTimeout(async()=>{o.abort()},6e4),tb({appId:r,apiKey:s,measurementId:i},a,o,t)}async function tb(e,{throttleEndTimeMillis:t,backoffCount:n},r,s=Jv){const{appId:i,measurementId:a}=e;try{await function(e,t){return new Promise((n,r)=>{const s=Math.max(t-Date.now(),0),i=setTimeout(n,s);e.addEventListener(()=>{clearTimeout(i),r(Kv.create("fetch-throttle",{throttleEndTimeMillis:t}))})})}(r,t)}catch(e){if(a)return Gv.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${a} provided in the "measurementId" field in the local Firebase config. [${e?.message}]`),{appId:i,measurementId:a};throw e}try{const t=await async function(e){const{appId:t,apiKey:n}=e,r={method:"GET",headers:Zv(n)},s="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",t),i=await fetch(s,r);if(200!==i.status&&304!==i.status){let e="";try{const t=await i.json();t.error?.message&&(e=t.error.message)}catch(e){}throw Kv.create("config-fetch-failed",{httpStatus:i.status,responseMessage:e})}return i.json()}(e);return s.deleteThrottleMetadata(i),t}catch(t){const o=t;if(!function(e){if(!(e instanceof zn&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(o)){if(s.deleteThrottleMetadata(i),a)return Gv.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${a} provided in the "measurementId" field in the local Firebase config. [${o?.message}]`),{appId:i,measurementId:a};throw t}const c=503===Number(o?.customData?.httpStatus)?er(n,s.intervalMillis,30):er(n,s.intervalMillis),u={throttleEndTimeMillis:Date.now()+c,backoffCount:n+1};return s.setThrottleMetadata(i,u),Gv.debug(`Calling attemptFetch again in ${c} millis`),tb(e,u,r,s)}}class nb{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}async function rb(e,t,n,r,s,i,a){const o=eb(e);o.then(t=>{n[t.measurementId]=t.appId,e.options.measurementId&&t.measurementId!==e.options.measurementId&&Gv.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=>Gv.error(e)),t.push(o);const c=async function(){if(!jn())return Gv.warn(Kv.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await Bn()}catch(e){return Gv.warn(Kv.create("indexeddb-unavailable",{errorInfo:e?.toString()}).message),!1}return!0}().then(e=>e?r.getId():void 0),[u,l]=await Promise.all([o,c]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(qv)&&n.src.includes(e))return n;return null})(i)||Xv(i,u.measurementId),s("js",new Date);const h=a?.config??{};return h.origin="firebase",h.update=!0,null!=l&&(h.firebase_id=l),s("config",u.measurementId,h),u.measurementId}class sb{constructor(e){this.app=e}_delete(){return delete ib[this.app.options.appId],Promise.resolve()}}let ib={},ab=[];const ob={};let cb,ub,lb="dataLayer",hb=!1;function db(e,t,n){!function(){const e=[];if(Fn()&&e.push("This is a browser extension environment."),Hn()||e.push("Cookies are not available."),e.length>0){const t=e.map((e,t)=>`(${t+1}) ${e}`).join(" "),n=Kv.create("invalid-analytics-context",{errorInfo:t});Gv.warn(n.message)}}();const r=e.options.appId;if(!r)throw Kv.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw Kv.create("no-api-key");Gv.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!=ib[r])throw Kv.create("already-exists",{id:r});if(!hb){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(lb);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,r,s){let i=function(...e){window[r].push(arguments)};return window[s]&&"function"==typeof window[s]&&(i=window[s]),window[s]=Qv(i,e,t,n),{gtagCore:i,wrappedGtag:window[s]}}(ib,ab,ob,lb,"gtag");ub=e,cb=t,hb=!0}ib[r]=rb(e,ab,ob,t,cb,lb,n);return new sb(e)}function pb(e=bs()){const t=gs(e=tr(e),zv);return t.isInitialized()?t.getImmediate():function(e,t={}){const n=gs(e,zv);if(n.isInitialized()){const e=n.getImmediate();if(Kn(t,n.getOptions()))return e;throw Kv.create("already-initialized")}const r=n.initialize({options:t});return r}(e)}function fb(e,t,n){e=tr(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})}(ub,ib[e.app.options.appId],t,n).catch(e=>Gv.error(e))}function gb(e,t,n,r){e=tr(e),async function(e,t,n,r,s){if(s&&s.global)e("event",n,r);else{const s=await t;e("event",n,{...r,send_to:s})}}(ub,ib[e.app.options.appId],t,n,r).catch(e=>Gv.error(e))}const mb="@firebase/analytics",yb="0.10.22";fs(new sr(zv,(e,{options:t})=>db(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t),"PUBLIC")),fs(new sr("analytics-internal",function(e){try{const t=e.getProvider(zv).getImmediate();return{logEvent:(e,n,r)=>gb(t,e,n,r),setUserProperties:(e,n)=>fb(t,e,n)}}catch(e){throw Kv.create("interop-component-reg-failed",{reason:e})}},"PRIVATE")),Es(mb,yb),Es(mb,yb,"esm2020");const _b="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",wb="google.c.a.c_id",vb=1e4;var bb,Eb;function Tb(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Sb(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"}(bb||(bb={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked",e.FID_REGISTERED="fid-registered"}(Eb||(Eb={}));const Ab="fcm_token_details_db",Ib="fcm_token_object_Store";const Cb=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.","fid-registration-failed":"A problem occurred while creating an FCM registration via FID: {$errorInfo}","fid-unregister-failed":"A problem occurred while unregistering the FCM registration via FID: {$errorInfo}","fid-registration-idb-schema-unavailable":"Unable to read or persist FID registration metadata because the messaging IndexedDB schema is unavailable (for example, the database could not be upgraded to the latest version).","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.","invalid-on-registered-handler":"No onRegistered callback handler was provided or registered. Implement onRegistered() before register()."}),Ob="firebase-messaging-database",Rb="firebase-messaging-store",kb="firebase-messaging-fid-registration-store";let Nb={openDB:Ir,deleteDB:Cr},xb=null;function Pb(e){return{upgrade:(t,n)=>{!function(e,t,n){switch(t){case 0:if(e.createObjectStore(Rb),1===n)break;case 1:2===n&&e.createObjectStore(kb)}}(t,n,e)},blocked:()=>{},blocking:(e,t,n)=>{xb=null,n.target?.close()},terminated:()=>{xb=null}}}function Db(){if(!xb){const e=Nb.openDB(Ob,2,Pb(2));xb=e.catch(()=>Nb.openDB(Ob,1,Pb(1)))}return xb}function Lb(e,t){return e.objectStoreNames.contains(t)}function Ub(e){if(!Lb(e,kb))throw Cb.create("fid-registration-idb-schema-unavailable")}async function Mb(e){const t=$b(e),n=await Db(),r=await n.transaction(Rb).objectStore(Rb).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(Ab))return null}let t=null;return(await Ir(Ab,5,{upgrade:async(n,r,s,i)=>{if(r<2)return;if(!n.objectStoreNames.contains(Ib))return;const a=i.objectStore(Ib),o=await a.index("fcmSenderId").get(e);if(await a.clear(),o)if(2===r){const e=o;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:Tb(e.vapidKey)}}}else if(3===r){const e=o;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:Tb(e.auth),p256dh:Tb(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:Tb(e.vapidKey)}}}else if(4===r){const e=o;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:Tb(e.auth),p256dh:Tb(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:Tb(e.vapidKey)}}}}})).close(),await Cr(Ab),await Cr("fcm_vapid_details_db"),await Cr("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 Vb(e,t),t}}async function Vb(e,t){const n=$b(e),r=await Db(),s=[Rb],i=Lb(r,kb);i&&s.push(kb);const a=r.transaction(s,"readwrite");return await a.objectStore(Rb).put(t,n),i&&await a.objectStore(kb).delete(n),await a.done,t}async function Fb(e){const t=$b(e),n=await Db();return Ub(n),await n.transaction(kb).objectStore(kb).get(t)}function $b({appConfig:e}){return e.appId}const jb="@firebase/messaging",Bb="0.13.0";async function Hb(e,t){const n=await Gb(e),r=Wb(t,e.appConfig.appName,!0),s={method:"POST",headers:n,body:JSON.stringify(r)};let i,a;try{i=await async function(e,t,n){let r;for(let s=0;s<t;s++)try{return await e()}catch(e){if(r=e,s<t-1){const e=n*Math.pow(2,s);await new Promise(t=>setTimeout(t,e))}}throw r}(()=>fetch(qb(e.appConfig),s),3,1e3)}catch(e){throw Cb.create("fid-registration-failed",{errorInfo:e?.toString()})}if(i.ok){const e=await async function(e){const t=await e.text();if(!t.trim())throw Cb.create("fid-registration-failed",{errorInfo:"CreateRegistration succeeded but response body is empty"});let n;try{n=JSON.parse(t)}catch{throw Cb.create("fid-registration-failed",{errorInfo:"CreateRegistration succeeded but response body is not valid JSON"})}const r=n.name;if("string"!=typeof r||0===r.length)throw Cb.create("fid-registration-failed",{errorInfo:"CreateRegistration succeeded but response did not include a non-empty name"});return function(e){const t=e.indexOf(zb);if(-1!==t){const n=e.slice(t+zb.length);if(n.length>0)return n}throw Cb.create("fid-registration-failed",{errorInfo:"CreateRegistration succeeded but response name is not a valid registration resource name"})}(r)}(i);return{responseFid:e}}try{a=await i.json()}catch(e){throw Cb.create("fid-registration-failed",{errorInfo:i.statusText})}const o=a.error?.message??i.statusText;throw Cb.create("fid-registration-failed",{errorInfo:o})}const zb="/registrations/";function qb({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function Gb({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 Kb(e,t){try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e))return new URL(e).host}catch{}try{if("undefined"!=typeof self&&self.location?.href)return new URL(e,self.location.origin).host}catch{}return"undefined"!=typeof self&&self.location?.host?self.location.host:t}function Wb({p256dh:e,auth:t,endpoint:n,vapidKey:r,swScope:s},i,a){const o={web:{origin:Kb(s,i),endpoint:n,auth:t,p256dh:e}};return a&&(o.fcm_sdk_version=Bb),r!==_b&&(o.web.applicationPubKey=r),o}async function Yb(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:Sb(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:Tb(t.getKey("auth")),p256dh:Tb(t.getKey("p256dh"))},r=await Mb(e.firebaseDependencies);if(r){if(function(e,t){const n=t.vapidKey===e.vapidKey,r=t.endpoint===e.endpoint,s=t.auth===e.auth,i=t.p256dh===e.p256dh;return n&&r&&s&&i}(r.subscriptionOptions,n))return Date.now()>=r.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await Gb(e),r=Wb(t.subscriptionOptions,e.appConfig.appName,!1),s={method:"PATCH",headers:n,body:JSON.stringify(r)};let i;try{const n=await fetch(`${qb(e.appConfig)}/${t.token}`,s);i=await n.json()}catch(e){throw Cb.create("token-update-failed",{errorInfo:e?.toString()})}if(i.error){const e=i.error.message;throw Cb.create("token-update-failed",{errorInfo:e})}if(!i.token)throw Cb.create("token-update-no-token");return i.token}(e.firebaseDependencies,t),r={...t,token:n,createTime:Date.now()};return await Vb(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 Gb(e)};try{const r=await fetch(`${qb(e.appConfig)}/${t}`,n),s=await r.json();if(s.error){const e=s.error.message;throw Cb.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw Cb.create("token-unsubscribe-failed",{errorInfo:e?.toString()})}}(e.firebaseDependencies,r.token)}catch(e){}return Xb(e.firebaseDependencies,n)}return Xb(e.firebaseDependencies,n)}async function Xb(e,t){const n=await async function(e,t){const n=await Gb(e),r=Wb(t,e.appConfig.appName,!1),s={method:"POST",headers:n,body:JSON.stringify(r)};let i;try{const t=await fetch(qb(e.appConfig),s);i=await t.json()}catch(e){throw Cb.create("token-subscribe-failed",{errorInfo:e?.toString()})}if(i.error){const e=i.error.message;throw Cb.create("token-subscribe-failed",{errorInfo:e})}if(!i.token)throw Cb.create("token-subscribe-no-token");return i.token}(e,t),r={token:n,createTime:Date.now(),subscriptionOptions:t};return await Vb(e,r),r.token}async function Qb(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")),vb),s=e.installing||e.waiting;e.active?(clearTimeout(r),t()):s?s.onstatechange=e=>{"activated"===e.target?.state&&(s.onstatechange=null,clearTimeout(r),t())}:(clearTimeout(r),n(new Error("No incoming service worker found.")))})}(e.swRegistration)}catch(e){throw Cb.create("failed-service-worker-registration",{browserErrorMessage:e?.message})}}async function Jb(e,t){if(t||e.swRegistration||await Qb(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw Cb.create("invalid-sw-registration");e.swRegistration=t}}async function Zb(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=_b)}async function eE(e,t){const n=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Sb(t)})}(e.swRegistration,e.vapidKey),r={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:n.endpoint,auth:Tb(n.getKey("auth")),p256dh:Tb(n.getKey("p256dh"))},s=e.firebaseDependencies.installations;for(let n=0;n<3;n++){const{responseFid:i}=await Hb(e.firebaseDependencies,r);if(i===t)return;n<2&&await s.getToken(!0)}throw Cb.create("fid-registration-failed",{errorInfo:"CreateRegistration response FID does not match Firebase Installation ID"})}async function tE(e,t){if(!navigator)throw Cb.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw Cb.create("permission-blocked");if(!e.onRegisteredHandler)throw Cb.create("invalid-on-registered-handler");await Zb(e,t?.vapidKey),await Jb(e,t?.serviceWorkerRegistration);const n=e._registerNotifyChain.catch(()=>{});return e._registerNotifyChain=n.then(async()=>{const t=await e.firebaseDependencies.installations.getId(),n=await Fb(e.firebaseDependencies),r=Date.now();(!n||n.fid!==t||r>=n.lastRegisterTime+6048e5)&&(await eE(e,t),await async function(e,t){const n=$b(e),r=await Db();Ub(r);const s=r.transaction([Rb,kb],"readwrite");return await s.objectStore(kb).put(t,n),await s.objectStore(Rb).delete(n),await s.done,t}(e.firebaseDependencies,{fid:t,lastRegisterTime:r,vapidKey:e.vapidKey}));if(!e.onRegisteredHandler)throw Cb.create("invalid-on-registered-handler");!function(e,t){const n=e.onRegisteredHandler;n&&("function"==typeof n?n(t):n.next(t))}(e,t)}),e._registerNotifyChain}function nE(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 s=t.notification.image;s&&(e.notification.image=s);const i=t.notification.icon;i&&(e.notification.icon=i)}(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 rE(e){return Cb.create("missing-app-config-values",{valueName:e})}class sE{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.onRegisteredHandler=null,this.onUnregisteredHandler=null,this._registerNotifyChain=Promise.resolve(),this._fidChangeUnsubscribe=null,this.logEvents=[],this.logQueue={state:"stopped"};const r=function(e){if(!e||!e.options)throw rE("App Configuration Object");if(!e.name)throw rE("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw rE(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 this._fidChangeUnsubscribe&&(this._fidChangeUnsubscribe(),this._fidChangeUnsubscribe=null),"scheduled"===this.logQueue.state&&clearTimeout(this.logQueue.timerId),this.logQueue={state:"stopped"},Promise.resolve()}}async function iE(e,t,n){const r=function(e){switch(e){case Eb.NOTIFICATION_CLICKED:return"notification_open";case Eb.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:n[wb],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 aE(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;if(e.onMessageHandler&&n.messageType===Eb.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(nE(n)):e.onMessageHandler.next(nE(n))),e.onRegisteredHandler&&n.messageType===Eb.FID_REGISTERED){const t=n.fid;"function"==typeof e.onRegisteredHandler?e.onRegisteredHandler(t):e.onRegisteredHandler.next(t)}const r=n.data;var s;"object"==typeof(s=r)&&s&&wb in s&&"1"===r["google.c.a.e"]&&await iE(e,n.messageType,r)}const oE=e=>{const t=new sE(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>aE(t,e)),t._fidChangeUnsubscribe=function(e,t){return $v(t,()=>{(async()=>{e.onRegisteredHandler&&await Fb(e.firebaseDependencies)&&await tE(e).catch(()=>{})})()})}(t,e.getProvider("installations").getImmediate()),t},cE=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>async function(e,t){if(!navigator)throw Cb.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw Cb.create("permission-blocked");return await Zb(e,t?.vapidKey),await Jb(e,t?.serviceWorkerRegistration),Yb(e)}(t,e),register:e=>tE(t,e)}};let uE;fs(new sr("messaging",oE,"PUBLIC")),fs(new sr("messaging-internal",cE,"PRIVATE")),Es(jb,Bb),Es(jb,Bb,"esm2020"),jo().useDeviceLanguage(),(async()=>{await async function(){try{await Bn()}catch(e){return!1}return"undefined"!=typeof window&&jn()&&Hn()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}()&&(uE=pb(Hw))})(),navigator,window;let lE=!1;window.addEventListener("userEmailChanged",()=>{lE=!0});const hE=()=>{wn.dispatch(rn())};!function(e,t,n,r){tr(e).onAuthStateChanged(t,n,r)}(Gw,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||"")),lE&&!e.emailVerified?Oa(e).then(()=>{lE=!1}).catch(e=>{lE=!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 dE=async()=>function(e){return tr(e).signOut()}(Gw),pE=async()=>{gb(uE,"create_account")},fE=async()=>{gb(uE,"delete_account")},gE=async(e,t)=>{await p_(Bp(zw,e,t))};var mE=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},yE=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let _E=class extends ie{constructor(){super(),this.source="",this.email="",this.password="",this.newAccount=async(e,t)=>{await Ca(Gw,e,t).then(e=>{Oa(e.user).then(()=>{})}).then(()=>{pE()})}}static get styles(){return[Sn,Yw,Xw,Ww,Qw,i`
|
|
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
|
|
343
|
+
`]}render(){return B`
|
|
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(){wn.dispatch(
|
|
407
|
+
`}change(){wn.dispatch(Qt(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)}};mE([le({type:String}),yE("design:type",Object)],_E.prototype,"source",void 0),mE([he(),yE("design:type",Object)],_E.prototype,"email",void 0),mE([he(),yE("design:type",Object)],_E.prototype,"password",void 0),_E=mE([oe("form-signup"),yE("design:paramtypes",[])],_E);var wE=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},vE=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let bE=class extends(de(wn)(ie)){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,Sn,Tn]}render(){return B`
|
|
408
408
|
|
|
409
409
|
<section class="service">
|
|
410
410
|
|
|
@@ -446,12 +446,12 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
446
446
|
|
|
447
447
|
</section>
|
|
448
448
|
|
|
449
|
-
`}};
|
|
449
|
+
`}};wE([le({type:Boolean,attribute:!0,reflect:!0}),vE("design:type",Object)],bE.prototype,"subscribe",void 0),wE([he(),vE("design:type",Object)],bE.prototype,"_name",void 0),wE([he(),vE("design:type",Object)],bE.prototype,"_log",void 0),wE([he(),vE("design:type",Object)],bE.prototype,"_sign",void 0),bE=wE([oe("user-login"),vE("design:paramtypes",[])],bE),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 EE=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>`,TE=i`
|
|
450
450
|
|
|
451
451
|
.spec[on] { display: grid; }
|
|
452
452
|
.spec { display: none; }
|
|
453
453
|
|
|
454
|
-
`,
|
|
454
|
+
`,SE=i`
|
|
455
455
|
|
|
456
456
|
:host {
|
|
457
457
|
position: var(--pwa_drawer_position, absolute);
|
|
@@ -525,7 +525,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
525
525
|
animation-timing-function: linear;
|
|
526
526
|
}
|
|
527
527
|
|
|
528
|
-
`,
|
|
528
|
+
`,AE=i`
|
|
529
529
|
|
|
530
530
|
.exit {
|
|
531
531
|
display: grid;
|
|
@@ -577,7 +577,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
577
577
|
|
|
578
578
|
|
|
579
579
|
|
|
580
|
-
`,
|
|
580
|
+
`,IE=i`
|
|
581
581
|
|
|
582
582
|
a {
|
|
583
583
|
text-transform: uppercase;
|
|
@@ -587,7 +587,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
587
587
|
text-decoration: none;
|
|
588
588
|
}
|
|
589
589
|
|
|
590
|
-
`,
|
|
590
|
+
`,CE=i`
|
|
591
591
|
|
|
592
592
|
.setLog > a {
|
|
593
593
|
padding: 16px;
|
|
@@ -607,7 +607,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
607
607
|
}
|
|
608
608
|
|
|
609
609
|
|
|
610
|
-
`;var
|
|
610
|
+
`;var OE=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},RE=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let kE=class extends(de(wn)(ie)){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&&dE(),wn.dispatch(nn())});this.shadowRoot.querySelectorAll("a").forEach(e=>{e.addEventListener("click",()=>{wn.dispatch(nn())})})}static get styles(){return[TE,Tn,SE,AE,IE,CE,Sn,i`
|
|
611
611
|
::slotted(a) {
|
|
612
612
|
text-transform: uppercase;
|
|
613
613
|
font-size: .6em;
|
|
@@ -622,7 +622,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
622
622
|
text-align: center;
|
|
623
623
|
cursor: pointer;
|
|
624
624
|
}
|
|
625
|
-
`]}render(){return
|
|
625
|
+
`]}render(){return B`
|
|
626
626
|
|
|
627
627
|
<!-- Drawer Wrapper -->
|
|
628
628
|
<section
|
|
@@ -632,7 +632,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
632
632
|
<header class="exit">
|
|
633
633
|
<div></div>
|
|
634
634
|
<h3>${!1===this.user?this.signup===this.subscribe?"Login":"Subscribe":this.name}</h3>
|
|
635
|
-
<button class="close">${
|
|
635
|
+
<button class="close">${EE}</button>
|
|
636
636
|
</header>
|
|
637
637
|
|
|
638
638
|
<!-- Logged-out State -->
|
|
@@ -677,7 +677,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
677
677
|
|
|
678
678
|
</section>
|
|
679
679
|
|
|
680
|
-
`}};
|
|
680
|
+
`}};OE([le({type:String,reflect:!0}),RE("design:type",Object)],kE.prototype,"url",void 0),OE([le({type:Boolean,attribute:!0,reflect:!0}),RE("design:type",Object)],kE.prototype,"drawer",void 0),OE([le({type:Boolean,attribute:!0,reflect:!0}),RE("design:type",Object)],kE.prototype,"subscribe",void 0),OE([he(),RE("design:type",Object)],kE.prototype,"name",void 0),OE([he(),RE("design:type",Object)],kE.prototype,"user",void 0),OE([he(),RE("design:type",Object)],kE.prototype,"signup",void 0),kE=OE([oe("user-drawer"),RE("design:paramtypes",[])],kE);const NE=i`
|
|
681
681
|
|
|
682
682
|
nav {
|
|
683
683
|
overflow: hidden;
|
|
@@ -745,7 +745,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
745
745
|
box-shadow: 0px 6px 6px -6px;
|
|
746
746
|
}
|
|
747
747
|
|
|
748
|
-
`;var
|
|
748
|
+
`;var xE=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},PE=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class DE extends(de(wn)(ie)){constructor(){super(),this.photo="",this.emptyArtwork="",this.user="",this.login=!1,this.progress=0,this.error="",this.status="",this.dispatchPhoto=async e=>{Gw.currentUser&&(await Ra(Gw.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[Yw,i`
|
|
749
749
|
|
|
750
750
|
:host {
|
|
751
751
|
box-sizing: border-box;
|
|
@@ -765,7 +765,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
765
765
|
box-shadow: 1px 1px 2px black, 0 0 25px grey, 0 0 5px #fff;
|
|
766
766
|
}
|
|
767
767
|
|
|
768
|
-
`]}render(){return
|
|
768
|
+
`]}render(){return B`
|
|
769
769
|
<label
|
|
770
770
|
for="pwa-uploader"
|
|
771
771
|
style="
|
|
@@ -831,11 +831,11 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
831
831
|
</label>
|
|
832
832
|
|
|
833
833
|
<p style="text-align:center;">${this.status}${this.error}</p>
|
|
834
|
-
`}async saveImage(){const e=this.shadowRoot.querySelector(".uploader");if(
|
|
834
|
+
`}async saveImage(){const e=this.shadowRoot.querySelector(".uploader");if(Gw.currentUser){this.error="",this.status="Uploading...";const r=this.shadowRoot.querySelector("#photoURL");if(!r)return;const s=(t=qw,n="/pwa-auth/"+this.user+"/"+r.files[0].name,Dw(t=tr(t),n)),i={cacheControl:"public,max-age=300",contentType:r.files[0].type},a=$w(s,r.files[0],i);a.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 xw(e=tr(e))}(a.snapshot.ref).then(t=>{(function(e,t){return Nw(e=tr(e),t)})(s,i).then(()=>{}).catch(e=>{}),Kw&&(Ra(Kw,{photoURL:t}).then(()=>{e.value=100,e.textContent="Complete"}),this.status="User profile updated successfully!",this.dispatchPhoto(t))}).catch(()=>{})})}var t,n}}xE([le(),PE("design:type",Object)],DE.prototype,"photo",void 0),xE([le({type:String,reflect:!0}),PE("design:type",Object)],DE.prototype,"emptyArtwork",void 0),xE([he(),PE("design:type",Object)],DE.prototype,"user",void 0),xE([he(),PE("design:type",Boolean)],DE.prototype,"login",void 0),xE([he(),PE("design:type",Number)],DE.prototype,"progress",void 0),xE([he(),PE("design:type",String)],DE.prototype,"error",void 0),xE([he(),PE("design:type",String)],DE.prototype,"status",void 0),customElements.define("contact-photo",DE);var LE=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},UE=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class ME extends(de(wn)(ie)){constructor(){super(),this.value="",this.login=!1,this.default=e=>{e.preventDefault()},this.alertProfile=async()=>{Gw.currentUser?await Ra(Gw.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[Yw,Xw,Ww,i`
|
|
835
835
|
|
|
836
836
|
:host, form { display: grid; }
|
|
837
837
|
|
|
838
|
-
`]}render(){return
|
|
838
|
+
`]}render(){return B`
|
|
839
839
|
|
|
840
840
|
<form
|
|
841
841
|
@submit="${this.default}">
|
|
@@ -861,11 +861,11 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
861
861
|
|
|
862
862
|
</form>
|
|
863
863
|
|
|
864
|
-
`}handleInput(e){const t=e.target;this.value=t.value}}
|
|
864
|
+
`}handleInput(e){const t=e.target;this.value=t.value}}LE([le({type:String,reflect:!0}),UE("design:type",Object)],ME.prototype,"value",void 0),LE([he(),UE("design:type",Boolean)],ME.prototype,"login",void 0),customElements.define("input-name",ME);var VE=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},FE=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class $E extends(de(wn)(ie)){constructor(){super(),this.email="",this.login=!1,this.mail="",this.default=e=>{e.preventDefault()},this.saveEmail=async()=>{if(Gw.currentUser){let e=this.shadowRoot?.querySelector("#pwa-email");await function(e,t){const n=tr(e);return ms(n.auth.app)?Promise.reject(js(n.auth)):ka(n,t,null)}(Gw.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[Yw,Xw,Ww,i`
|
|
865
865
|
|
|
866
866
|
:host, form { display: grid; }
|
|
867
867
|
|
|
868
|
-
`]}render(){return
|
|
868
|
+
`]}render(){return B`
|
|
869
869
|
|
|
870
870
|
<form
|
|
871
871
|
autocomplete="off"
|
|
@@ -893,7 +893,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
893
893
|
|
|
894
894
|
</form>
|
|
895
895
|
|
|
896
|
-
`}}
|
|
896
|
+
`}}VE([le({type:String,reflect:!0}),FE("design:type",Object)],$E.prototype,"email",void 0),VE([he(),FE("design:type",Boolean)],$E.prototype,"login",void 0),VE([he(),FE("design:type",String)],$E.prototype,"mail",void 0),customElements.define("contact-email",$E);var jE=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},BE=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class HE extends(de(wn)(ie)){constructor(){super(),this.message="",this.password="",this.login=!1,this.default=e=>{e.preventDefault()},this.updatePass=async e=>{Gw.currentUser?await function(e,t){return ka(tr(e),null,t)}(Gw.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[Yw,Xw,Ww,i`
|
|
897
897
|
|
|
898
898
|
:host{
|
|
899
899
|
display: grid;
|
|
@@ -903,7 +903,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
903
903
|
|
|
904
904
|
p.error { color: red; }
|
|
905
905
|
|
|
906
|
-
`]}render(){return
|
|
906
|
+
`]}render(){return B`
|
|
907
907
|
|
|
908
908
|
<form
|
|
909
909
|
autocomplete="off"
|
|
@@ -938,7 +938,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
938
938
|
|
|
939
939
|
</label>
|
|
940
940
|
|
|
941
|
-
${this.message?
|
|
941
|
+
${this.message?B`
|
|
942
942
|
|
|
943
943
|
<p
|
|
944
944
|
class=${this.message.includes("Password entered")?"":"error"}
|
|
@@ -959,7 +959,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
959
959
|
|
|
960
960
|
</form>
|
|
961
961
|
|
|
962
|
-
`}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)?
|
|
962
|
+
`}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)?Gw.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"}}jE([he(),BE("design:type",String)],HE.prototype,"message",void 0),jE([he(),BE("design:type",String)],HE.prototype,"password",void 0),jE([he(),BE("design:type",Boolean)],HE.prototype,"login",void 0),customElements.define("input-password",HE);var zE=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},qE=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class GE extends(de(wn)(ie)){constructor(){super(),this.login=!1,this.email="",this.officialDelete=async()=>{if(Gw.currentUser)return Gw.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[Ww,i`
|
|
963
963
|
|
|
964
964
|
:host {
|
|
965
965
|
display: grid;
|
|
@@ -968,9 +968,10 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
968
968
|
|
|
969
969
|
p {
|
|
970
970
|
padding: 0 16px;
|
|
971
|
+
color: black;
|
|
971
972
|
}
|
|
972
973
|
|
|
973
|
-
`]}render(){return
|
|
974
|
+
`]}render(){return B`
|
|
974
975
|
|
|
975
976
|
<p>Permanently delete the user account and data related to: ${this.email}</p>
|
|
976
977
|
|
|
@@ -978,10 +979,11 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
978
979
|
class="action-button deleteUser"
|
|
979
980
|
?disabled="${!1===this.login}">Delete</button>
|
|
980
981
|
|
|
981
|
-
`}alertDelete(){
|
|
982
|
+
`}alertDelete(){Gw.currentUser?this.deleteUser():alert("Please Login")}deleteUser(){1==confirm("Delete Account?")&&this.officialDelete()}}zE([he(),qE("design:type",Boolean)],GE.prototype,"login",void 0),zE([he(),qE("design:type",String)],GE.prototype,"email",void 0),customElements.define("delete-user",GE);var KE=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},WE=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let YE=class extends(de(wn)(ie)){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(Jt("profile"))}),this.shadowRoot.querySelector("button[value=verification]").addEventListener("click",()=>{wn.dispatch(Jt("verification"))}),this.shadowRoot.querySelector("button[value=password]").addEventListener("click",()=>{wn.dispatch(Jt("password"))}),this.shadowRoot.querySelector("button[value=delete]").addEventListener("click",()=>{wn.dispatch(Jt("delete"))})}stateChanged(e){this.profileTopic=e.frontend.settings,this.name=e.backend.name}static get styles(){return[NE,Sn,Tn,i`
|
|
982
983
|
|
|
983
984
|
:host {
|
|
984
985
|
display: grid;
|
|
986
|
+
grid-template-rows: auto 1fr;
|
|
985
987
|
background-color: var(--pwa_settings_background_color, white);
|
|
986
988
|
}
|
|
987
989
|
|
|
@@ -1000,7 +1002,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
1000
1002
|
}
|
|
1001
1003
|
}
|
|
1002
1004
|
|
|
1003
|
-
`]}render(){return
|
|
1005
|
+
`]}render(){return B`
|
|
1004
1006
|
|
|
1005
1007
|
<!-- Page Menu -->
|
|
1006
1008
|
<nav>
|
|
@@ -1098,7 +1100,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
1098
1100
|
</div>
|
|
1099
1101
|
</div>
|
|
1100
1102
|
|
|
1101
|
-
`}};
|
|
1103
|
+
`}};KE([le({type:String,reflect:!0}),WE("design:type",Object)],YE.prototype,"empty",void 0),KE([he(),WE("design:type",Object)],YE.prototype,"profileTopic",void 0),KE([he(),WE("design:type",Object)],YE.prototype,"name",void 0),YE=KE([oe("user-settings"),WE("design:paramtypes",[])],YE);const XE=i`
|
|
1102
1104
|
|
|
1103
1105
|
.icon, .login {
|
|
1104
1106
|
cursor: pointer;
|
|
@@ -1140,21 +1142,21 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
1140
1142
|
object-fit: cover;
|
|
1141
1143
|
transition-property: all;
|
|
1142
1144
|
transition-duration: 2s;
|
|
1143
|
-
clip-path: circle(50%)
|
|
1145
|
+
/*clip-path: circle(50%);*/
|
|
1144
1146
|
overflow: hidden;
|
|
1145
1147
|
width: calc(var(--pwa_icon_diameter, 40px) - 2px);
|
|
1146
1148
|
height: calc(var(--pwa_icon_diameter, 40px) - 2px);
|
|
1147
1149
|
margin: auto;
|
|
1148
1150
|
}
|
|
1149
1151
|
|
|
1150
|
-
`;var
|
|
1152
|
+
`;var QE=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},JE=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let ZE=class extends(de(wn)(ie)){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[XE,i`:host { border-radius: 8px; }`]}render(){return B`
|
|
1151
1153
|
|
|
1152
1154
|
<!-- two classes: icon / login -->
|
|
1153
1155
|
<button
|
|
1154
1156
|
class="${this._user?"icon":"login"} toggles"
|
|
1155
1157
|
aria-label="login">
|
|
1156
1158
|
|
|
1157
|
-
${this._user?
|
|
1159
|
+
${this._user?B`
|
|
1158
1160
|
<!-- <div
|
|
1159
1161
|
class = "iconArea"> -->
|
|
1160
1162
|
<input
|
|
@@ -1169,7 +1171,7 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
1169
1171
|
|
|
1170
1172
|
</button>
|
|
1171
1173
|
|
|
1172
|
-
`}};
|
|
1174
|
+
`}};QE([le({type:Boolean,reflect:!0}),JE("design:type",Object)],ZE.prototype,"subscribe",void 0),QE([le({type:String,reflect:!0}),JE("design:type",Object)],ZE.prototype,"empty",void 0),QE([he(),JE("design:type",Object)],ZE.prototype,"_user",void 0),QE([he(),JE("design:type",Object)],ZE.prototype,"_photoURL",void 0),ZE=QE([oe("user-icon"),JE("design:paramtypes",[])],ZE);var eT=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},tT=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class nT extends ie{constructor(){super(),this.active=!1}shouldUpdate(){return this.active}}eT([le({type:Boolean}),tT("design:type",Boolean)],nT.prototype,"active",void 0);var rT=function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},sT=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let iT=class extends nT{constructor(){super(),this.userEmail="",this.restPassword=async()=>{await async function(e,t){const n=qi(e),r={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};await ta(n,r,"getOobCode",ua)}(Gw,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`
|
|
1173
1175
|
|
|
1174
1176
|
<form class="resetPass">
|
|
1175
1177
|
|
|
@@ -1189,4 +1191,4 @@ const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
|
|
|
1189
1191
|
class ="phoneVerify"
|
|
1190
1192
|
type ="text" />
|
|
1191
1193
|
|
|
1192
|
-
`}};
|
|
1194
|
+
`}};rT([he(),sT("design:type",String)],iT.prototype,"userEmail",void 0),iT=rT([oe("email-reset"),sT("design:paramtypes",[])],iT);export{iT as EmailReset,kE as UserDrawer,ZE as UserIcon,bE as UserLogin,YE as UserSettings,Hw as application,Gw as auth,zw as db,gE as deleteDocument,Bw as firebaseConfig,pE as logAccount,fE as logAccountDelete,dE as logOut,hE as pwaDrawerToggle,qw as storage,Kw as user};
|