pwa-auth 3.7.4 → 3.7.6
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/README.md +11 -4
- package/base/api/drawer.js +1 -1
- package/base/api/drawer.js.map +1 -1
- package/base/api/verify.js +1 -1
- package/base/firebase/interface.d.ts.map +1 -1
- package/base/firebase/interface.js +1 -8
- package/base/firebase/interface.js.map +1 -1
- package/base/redux/session.d.ts +158 -0
- package/base/redux/session.d.ts.map +1 -0
- package/base/redux/session.js +55 -0
- package/base/redux/session.js.map +1 -0
- package/base/store.d.ts +4 -30
- package/base/store.d.ts.map +1 -1
- package/base/store.js +2 -4
- package/base/store.js.map +1 -1
- package/base/webcomponents/css/svg.d.ts.map +1 -1
- package/base/webcomponents/css/svg.js +4 -1
- package/base/webcomponents/css/svg.js.map +1 -1
- package/base/webcomponents/drawer/css/exit.d.ts.map +1 -1
- package/base/webcomponents/drawer/css/exit.js +29 -11
- package/base/webcomponents/drawer/css/exit.js.map +1 -1
- package/base/webcomponents/drawer/drawer.d.ts +10 -15
- package/base/webcomponents/drawer/drawer.d.ts.map +1 -1
- package/base/webcomponents/drawer/drawer.js +76 -17
- package/base/webcomponents/drawer/drawer.js.map +1 -1
- package/base/webcomponents/form/forgot.js +3 -3
- package/base/webcomponents/form/forgot.js.map +1 -1
- package/base/webcomponents/form/login.js +1 -1
- package/base/webcomponents/form/login.js.map +1 -1
- package/base/webcomponents/form/signup.js +1 -1
- package/base/webcomponents/form/signup.js.map +1 -1
- package/base/webcomponents/icon/icon.d.ts +2 -15
- package/base/webcomponents/icon/icon.d.ts.map +1 -1
- package/base/webcomponents/icon/icon.js +6 -6
- package/base/webcomponents/icon/icon.js.map +1 -1
- package/base/webcomponents/login/css/auth.d.ts.map +1 -1
- package/base/webcomponents/login/css/auth.js +5 -0
- package/base/webcomponents/login/css/auth.js.map +1 -1
- package/base/webcomponents/login/page.d.ts +2 -15
- package/base/webcomponents/login/page.d.ts.map +1 -1
- package/base/webcomponents/login/page.js +5 -5
- package/base/webcomponents/login/page.js.map +1 -1
- package/base/webcomponents/settings/input/delete.d.ts +2 -15
- package/base/webcomponents/settings/input/delete.d.ts.map +1 -1
- package/base/webcomponents/settings/input/delete.js +2 -2
- package/base/webcomponents/settings/input/delete.js.map +1 -1
- package/base/webcomponents/settings/input/email.d.ts +2 -15
- package/base/webcomponents/settings/input/email.d.ts.map +1 -1
- package/base/webcomponents/settings/input/email.js +2 -2
- package/base/webcomponents/settings/input/email.js.map +1 -1
- package/base/webcomponents/settings/input/name.d.ts +2 -15
- package/base/webcomponents/settings/input/name.d.ts.map +1 -1
- package/base/webcomponents/settings/input/name.js +3 -5
- package/base/webcomponents/settings/input/name.js.map +1 -1
- package/base/webcomponents/settings/input/password.d.ts +2 -15
- package/base/webcomponents/settings/input/password.d.ts.map +1 -1
- package/base/webcomponents/settings/input/password.js +1 -1
- package/base/webcomponents/settings/input/password.js.map +1 -1
- package/base/webcomponents/settings/input/uploader.d.ts +2 -15
- package/base/webcomponents/settings/input/uploader.d.ts.map +1 -1
- package/base/webcomponents/settings/input/uploader.js +4 -4
- package/base/webcomponents/settings/input/uploader.js.map +1 -1
- package/base/webcomponents/settings/input/verify.d.ts +2 -15
- package/base/webcomponents/settings/input/verify.d.ts.map +1 -1
- package/base/webcomponents/settings/input/verify.js +3 -3
- package/base/webcomponents/settings/input/verify.js.map +1 -1
- package/base/webcomponents/settings/settings.d.ts +2 -15
- package/base/webcomponents/settings/settings.d.ts.map +1 -1
- package/base/webcomponents/settings/settings.js +5 -5
- package/base/webcomponents/settings/settings.js.map +1 -1
- package/docs/drawer-slide.md +4 -2
- package/package.json +1 -1
- package/source/pwa-auth.js +112 -86
- package/base/redux/backend.d.ts +0 -114
- package/base/redux/backend.d.ts.map +0 -1
- package/base/redux/backend.js +0 -44
- package/base/redux/backend.js.map +0 -1
- package/base/redux/frontend.d.ts +0 -200
- package/base/redux/frontend.d.ts.map +0 -1
- package/base/redux/frontend.js +0 -90
- package/base/redux/frontend.js.map +0 -1
package/source/pwa-auth.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),s=new WeakMap;let r=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const n=this.t;if(e&&void 0===t){const e=void 0!==n&&1===n.length;e&&(t=s.get(n)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(n,t))}return t}toString(){return this.cssText}};const i=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,n,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[s+1],t[0]);return new r(s,t,n)},o=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,n))(e)})(t):t,{is:a,defineProperty:B,getOwnPropertyDescriptor:c,getOwnPropertyNames:l,getOwnPropertySymbols:u,getPrototypeOf:h}=Object,d=globalThis,p=d.trustedTypes,f=p?p.emptyScript:"",C=d.reactiveElementPolyfillSupport,g=(t,e)=>t,m={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},w=(t,e)=>!a(t,e),y={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),d.litPropertyMetadata??=new WeakMap;let E=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=y){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),s=this.getPropertyDescriptor(t,n,e);void 0!==s&&B(this.prototype,t,s)}}static getPropertyDescriptor(t,e,n){const{get:s,set:r}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const i=s?.call(this);r?.call(this,e),this.requestUpdate(t,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y}static _$Ei(){if(this.hasOwnProperty(g("elementProperties")))return;const t=h(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(g("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(g("properties"))){const t=this.properties,e=[...l(t),...u(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((n,s)=>{if(e)n.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of s){const s=document.createElement("style"),r=t.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=e.cssText,n.appendChild(s)}})(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,n);if(void 0!==s&&!0===n.reflect){const r=(void 0!==n.converter?.toAttribute?n.converter:m).toAttribute(e,n.type);this._$Em=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){const n=this.constructor,s=n._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=n.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:m;this._$Em=s;const i=r.fromAttribute(e,t.type);this[s]=i??this._$Ej?.get(s)??i,this._$Em=null}}requestUpdate(t,e,n){if(void 0!==t){const s=this.constructor,r=this[t];if(n??=s.getPropertyOptions(t),!((n.hasChanged??w)(r,e)||n.useDefault&&n.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:s,wrapped:r},i){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),!0!==r||void 0!==i)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t){const{wrapped:t}=n,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,n,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};E.elementStyles=[],E.shadowRootOptions={mode:"open"},E[g("elementProperties")]=new Map,E[g("finalized")]=new Map,C?.({ReactiveElement:E}),(d.reactiveElementVersions??=[]).push("2.1.1");const D=globalThis,_=D.trustedTypes,b=_?_.createPolicy("lit-html",{createHTML:t=>t}):void 0,v="$lit$",I=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+I,O=`<${T}>`,A=document,S=()=>A.createComment(""),R=t=>null===t||"object"!=typeof t&&"function"!=typeof t,N=Array.isArray,x="[ \t\n\f\r]",k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,F=/>/g,P=RegExp(`>|${x}(?:([^\\s"'>=/]+)(${x}*=${x}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,G=/"/g,H=/^(?:script|style|textarea|title)$/i,U=(t=>(e,...n)=>({_$litType$:t,strings:e,values:n}))(1),V=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),$=new WeakMap,J=A.createTreeWalker(A,129);function q(t,e){if(!N(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==b?b.createHTML(e):e}const z=(t,e)=>{const n=t.length-1,s=[];let r,i=2===e?"<svg>":3===e?"<math>":"",o=k;for(let e=0;e<n;e++){const n=t[e];let a,B,c=-1,l=0;for(;l<n.length&&(o.lastIndex=l,B=o.exec(n),null!==B);)l=o.lastIndex,o===k?"!--"===B[1]?o=L:void 0!==B[1]?o=F:void 0!==B[2]?(H.test(B[2])&&(r=RegExp("</"+B[2],"g")),o=P):void 0!==B[3]&&(o=P):o===P?">"===B[0]?(o=r??k,c=-1):void 0===B[1]?c=-2:(c=o.lastIndex-B[2].length,a=B[1],o=void 0===B[3]?P:'"'===B[3]?G:M):o===G||o===M?o=P:o===L||o===F?o=k:(o=P,r=void 0);const u=o===P&&t[e+1].startsWith("/>")?" ":"";i+=o===k?n+O:c>=0?(s.push(a),n.slice(0,c)+v+n.slice(c)+I+u):n+I+(-2===c?e:u)}return[q(t,i+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class K{constructor({strings:t,_$litType$:e},n){let s;this.parts=[];let r=0,i=0;const o=t.length-1,a=this.parts,[B,c]=z(t,e);if(this.el=K.createElement(B,n),J.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=J.nextNode())&&a.length<o;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(v)){const e=c[i++],n=s.getAttribute(t).split(I),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:r,name:o[2],strings:n,ctor:"."===o[1]?Z:"?"===o[1]?tt:"@"===o[1]?et:X}),s.removeAttribute(t)}else t.startsWith(I)&&(a.push({type:6,index:r}),s.removeAttribute(t));if(H.test(s.tagName)){const t=s.textContent.split(I),e=t.length-1;if(e>0){s.textContent=_?_.emptyScript:"";for(let n=0;n<e;n++)s.append(t[n],S()),J.nextNode(),a.push({type:2,index:++r});s.append(t[e],S())}}}else if(8===s.nodeType)if(s.data===T)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(I,t+1));)a.push({type:7,index:r}),t+=I.length-1}r++}}static createElement(t,e){const n=A.createElement("template");return n.innerHTML=t,n}}function Q(t,e,n=t,s){if(e===V)return e;let r=void 0!==s?n._$Co?.[s]:n._$Cl;const i=R(e)?void 0:e._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),void 0===i?r=void 0:(r=new i(t),r._$AT(t,n,s)),void 0!==s?(n._$Co??=[])[s]=r:n._$Cl=r),void 0!==r&&(e=Q(t,r._$AS(t,e.values),r,s)),e}let W=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,s=(t?.creationScope??A).importNode(e,!0);J.currentNode=s;let r=J.nextNode(),i=0,o=0,a=n[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new Y(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new nt(r,this,t)),this._$AV.push(e),a=n[++o]}i!==a?.index&&(r=J.nextNode(),i++)}return J.currentNode=A,s}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}},Y=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,s){this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Q(this,t,e),R(t)?t===j||null==t||""===t?(this._$AH!==j&&this._$AR(),this._$AH=j):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>N(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==j&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(A.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=K.createElement(q(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new W(s,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=$.get(t.strings);return void 0===e&&$.set(t.strings,e=new K(t)),e}k(e){N(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,r=0;for(const i of e)r===n.length?n.push(s=new t(this.O(S()),this.O(S()),this,this.options)):s=n[r],s._$AI(i),r++;r<n.length&&(this._$AR(s&&s._$AB.nextSibling,r),n.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},X=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,s,r){this.type=1,this._$AH=j,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=j}_$AI(t,e=this,n,s){const r=this.strings;let i=!1;if(void 0===r)t=Q(this,t,e,0),i=!R(t)||t!==this._$AH&&t!==V,i&&(this._$AH=t);else{const s=t;let o,a;for(t=r[0],o=0;o<r.length-1;o++)a=Q(this,s[n+o],e,o),a===V&&(a=this._$AH[o]),i||=!R(a)||a!==this._$AH[o],a===j?t=j:t!==j&&(t+=(a??"")+r[o+1]),this._$AH[o]=a}i&&!s&&this.j(t)}j(t){t===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}};class Z extends X{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===j?void 0:t}}let tt=class extends X{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==j)}},et=class extends X{constructor(t,e,n,s,r){super(t,e,n,s,r),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??j)===V)return;const n=this._$AH,s=t===j&&n!==j||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==j&&(n===j||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}};class nt{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}}const st=D.litHtmlPolyfillSupport;st?.(K,Y),(D.litHtmlVersions??=[]).push("3.3.1");const rt=globalThis;let it=class extends E{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,n)=>{const s=n?.renderBefore??e;let r=s._$litPart$;if(void 0===r){const t=n?.renderBefore??null;s._$litPart$=r=new Y(e.insertBefore(S(),t),t,void 0,n??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};it._$litElement$=!0,it.finalized=!0,rt.litElementHydrateSupport?.({LitElement:it});const ot=rt.litElementPolyfillSupport;ot?.({LitElement:it}),(rt.litElementVersions??=[]).push("4.2.1");const at=t=>(e,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},Bt={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:w},ct=(t=Bt,e,n)=>{const{kind:s,metadata:r}=n;let i=globalThis.litPropertyMetadata.get(r);if(void 0===i&&globalThis.litPropertyMetadata.set(r,i=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),i.set(n.name,t),"accessor"===s){const{name:s}=n;return{set(n){const r=e.get.call(this);e.set.call(this,n),this.requestUpdate(s,r,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=n;return function(n){const r=this[s];e.call(this,n),this.requestUpdate(s,r,t)}}throw Error("Unsupported decorator location: "+s)};function lt(t){return(e,n)=>"object"==typeof n?ct(t,e,n):((t,e,n)=>{const s=e.hasOwnProperty(n);return e.constructor.createProperty(n,t),s?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}function ut(t){return lt({...t,state:!0,attribute:!1})}const ht=1,dt=t=>(...e)=>({_$litDirective$:t,values:e});let pt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};const ft=dt(class extends pt{constructor(t){if(super(t),t.type!==ht||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const n=t.element.classList;for(const t of this.st)t in e||(n.remove(t),this.st.delete(t));for(const t in e){const s=!!e[t];s===this.st.has(t)||this.nt?.has(t)||(s?(n.add(t),this.st.add(t)):(n.remove(t),this.st.delete(t)))}return V}}),Ct="important",gt=" !"+Ct,mt=dt(class extends pt{constructor(t){if(super(t),t.type!==ht||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,n)=>{const s=t[n];return null==s?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(t,[e]){const{style:n}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?n.removeProperty(t):n[t]=null);for(const t in e){const s=e[t];if(null!=s){this.ft.add(t);const e="string"==typeof s&&s.endsWith(gt);t.includes("-")||e?n.setProperty(t,e?s.slice(0,-11):s,e?Ct:""):n[t]=s}}return V}}),wt=t=>e=>class extends e{connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=t.subscribe(()=>this.stateChanged(t.getState())),this.stateChanged(t.getState())}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}stateChanged(t){}};function yt(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Et=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Dt=()=>Math.random().toString(36).substring(7).split("").join("."),_t={INIT:`@@redux/INIT${Dt()}`,REPLACE:`@@redux/REPLACE${Dt()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Dt()}`};function bt(t){if("object"!=typeof t||null===t)return!1;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||null===Object.getPrototypeOf(t)}function vt(t,e,n){if("function"!=typeof t)throw new Error(yt(2));if("function"==typeof e&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(yt(0));if("function"==typeof e&&void 0===n&&(n=e,e=void 0),void 0!==n){if("function"!=typeof n)throw new Error(yt(1));return n(vt)(t,e)}let s=t,r=e,i=new Map,o=i,a=0,B=!1;function c(){o===i&&(o=new Map,i.forEach((t,e)=>{o.set(e,t)}))}function l(){if(B)throw new Error(yt(3));return r}function u(t){if("function"!=typeof t)throw new Error(yt(4));if(B)throw new Error(yt(5));let e=!0;c();const n=a++;return o.set(n,t),function(){if(e){if(B)throw new Error(yt(6));e=!1,c(),o.delete(n),i=null}}}function h(t){if(!bt(t))throw new Error(yt(7));if(void 0===t.type)throw new Error(yt(8));if("string"!=typeof t.type)throw new Error(yt(17));if(B)throw new Error(yt(9));try{B=!0,r=s(r,t)}finally{B=!1}return(i=o).forEach(t=>{t()}),t}h({type:_t.INIT});return{dispatch:h,subscribe:u,getState:l,replaceReducer:function(t){if("function"!=typeof t)throw new Error(yt(10));s=t,h({type:_t.REPLACE})},[Et]:function(){const t=u;return{subscribe(e){if("object"!=typeof e||null===e)throw new Error(yt(11));function n(){const t=e;t.next&&t.next(l())}n();return{unsubscribe:t(n)}},[Et](){return this}}}}}function It(t){const e=Object.keys(t),n={};for(let s=0;s<e.length;s++){const r=e[s];"function"==typeof t[r]&&(n[r]=t[r])}const s=Object.keys(n);let r;try{!function(t){Object.keys(t).forEach(e=>{const n=t[e];if(void 0===n(void 0,{type:_t.INIT}))throw new Error(yt(12));if(void 0===n(void 0,{type:_t.PROBE_UNKNOWN_ACTION()}))throw new Error(yt(13))})}(n)}catch(t){r=t}return function(t={},e){if(r)throw r;let i=!1;const o={};for(let r=0;r<s.length;r++){const a=s[r],B=n[a],c=t[a],l=B(c,e);if(void 0===l)throw e&&e.type,new Error(yt(14));o[a]=l,i=i||l!==c}return i=i||s.length!==Object.keys(t).length,i?o:t}}function Tt(...t){return 0===t.length?t=>t:1===t.length?t[0]:t.reduce((t,e)=>(...n)=>t(e(...n)))}var Ot=Symbol.for("immer-nothing"),At=Symbol.for("immer-draftable"),St=Symbol.for("immer-state");function Rt(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Nt=Object,xt=Nt.getPrototypeOf,kt="constructor",Lt="prototype",Ft="configurable",Pt="enumerable",Mt="writable",Gt="value",Ht=t=>!!t&&!!t[St];function Ut(t){return!!t&&($t(t)||Wt(t)||!!t[At]||!!t[kt]?.[At]||Yt(t)||Xt(t))}var Vt=Nt[Lt][kt].toString(),jt=new WeakMap;function $t(t){if(!t||!Zt(t))return!1;const e=xt(t);if(null===e||e===Nt[Lt])return!0;const n=Nt.hasOwnProperty.call(e,kt)&&e[kt];if(n===Object)return!0;if(!te(n))return!1;let s=jt.get(n);return void 0===s&&(s=Function.toString.call(n),jt.set(n,s)),s===Vt}function Jt(t,e,n=!0){if(0===qt(t)){(n?Reflect.ownKeys(t):Nt.keys(t)).forEach(n=>{e(n,t[n],t)})}else t.forEach((n,s)=>e(s,n,t))}function qt(t){const e=t[St];return e?e.type_:Wt(t)?1:Yt(t)?2:Xt(t)?3:0}var zt=(t,e,n=qt(t))=>2===n?t.has(e):Nt[Lt].hasOwnProperty.call(t,e),Kt=(t,e,n=qt(t))=>2===n?t.get(e):t[e],Qt=(t,e,n,s=qt(t))=>{2===s?t.set(e,n):3===s?t.add(n):t[e]=n};var Wt=Array.isArray,Yt=t=>t instanceof Map,Xt=t=>t instanceof Set,Zt=t=>"object"==typeof t,te=t=>"function"==typeof t,ee=t=>"boolean"==typeof t;var ne=t=>t.copy_||t.base_,se=t=>t.modified_?t.copy_:t.base_;function re(t,e){if(Yt(t))return new Map(t);if(Xt(t))return new Set(t);if(Wt(t))return Array[Lt].slice.call(t);const n=$t(t);if(!0===e||"class_only"===e&&!n){const e=Nt.getOwnPropertyDescriptors(t);delete e[St];let n=Reflect.ownKeys(e);for(let s=0;s<n.length;s++){const r=n[s],i=e[r];!1===i[Mt]&&(i[Mt]=!0,i[Ft]=!0),(i.get||i.set)&&(e[r]={[Ft]:!0,[Mt]:!0,[Pt]:i[Pt],[Gt]:t[r]})}return Nt.create(xt(t),e)}{const e=xt(t);if(null!==e&&n)return{...t};const s=Nt.create(e);return Nt.assign(s,t)}}function ie(t,e=!1){return ae(t)||Ht(t)||!Ut(t)||(qt(t)>1&&Nt.defineProperties(t,{set:oe,add:oe,clear:oe,delete:oe}),Nt.freeze(t),e&&Jt(t,(t,e)=>{ie(e,!0)},!1)),t}var oe={[Gt]:function(){Rt(2)}};function ae(t){return null===t||!Zt(t)||Nt.isFrozen(t)}var Be="MapSet",ce="Patches",le="ArrayMethods",ue={};function he(t){const e=ue[t];return e||Rt(0),e}var de,pe=t=>!!ue[t],fe=()=>de;function Ce(t,e){e&&(t.patchPlugin_=he(ce),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function ge(t){me(t),t.drafts_.forEach(ye),t.drafts_=null}function me(t){t===de&&(de=t.parent_)}var we=t=>de={drafts_:[],parent_:de,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:pe(Be)?he(Be):void 0,arrayMethodsPlugin_:pe(le)?he(le):void 0};function ye(t){const e=t[St];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function Ee(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(void 0!==t&&t!==n){n[St].modified_&&(ge(e),Rt(4)),Ut(t)&&(t=De(e,t));const{patchPlugin_:s}=e;s&&s.generateReplacementPatches_(n[St].base_,t,e)}else t=De(e,n);return function(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&ie(e,n)}(e,t,!0),ge(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Ot?t:void 0}function De(t,e){if(ae(e))return e;const n=e[St];if(!n){return Oe(e,t.handledSet_,t)}if(!be(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:e}=n;if(e)for(;e.length>0;){e.pop()(t)}Te(n,t)}return n.copy_}function _e(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var be=(t,e)=>t.scope_===e,ve=[];function Ie(t,e,n,s){const r=ne(t),i=t.type_;if(void 0!==s){if(Kt(r,s,i)===e)return void Qt(r,s,n,i)}if(!t.draftLocations_){const e=t.draftLocations_=new Map;Jt(r,(t,n)=>{if(Ht(n)){const s=e.get(n)||[];s.push(t),e.set(n,s)}})}const o=t.draftLocations_.get(e)??ve;for(const t of o)Qt(r,t,n,i)}function Te(t,e){if(t.modified_&&!t.finalized_&&(3===t.type_||1===t.type_&&t.allIndicesReassigned_||(t.assigned_?.size??0)>0)){const{patchPlugin_:n}=e;if(n){const s=n.getPath(t);s&&n.generatePatches_(t,s,e)}_e(t)}}function Oe(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ht(t)||e.has(t)||!Ut(t)||ae(t)||(e.add(t),Jt(t,(s,r)=>{if(Ht(r)){const e=r[St];if(be(e,n)){const n=se(e);Qt(t,s,n,t.type_),_e(e)}}else Ut(r)&&Oe(r,e,n)})),t}var Ae={get(t,e){if(e===St)return t;let n=t.scope_.arrayMethodsPlugin_;const s=1===t.type_&&"string"==typeof e;if(s&&n?.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const r=ne(t);if(!zt(r,e,t.type_))return function(t,e,n){const s=Ne(e,n);return s?Gt in s?s[Gt]:s.get?.call(t.draft_):void 0}(t,r,e);const i=r[e];if(t.finalized_||!Ut(i))return i;if(s&&t.operationMethod&&n?.isMutatingArrayMethod(t.operationMethod)&&function(t){const e=+t;return Number.isInteger(e)&&String(e)===t}(e))return i;if(i===Re(t.base_,e)){ke(t);const n=1===t.type_?+e:e,s=Le(t.scope_,i,t,n);return t.copy_[n]=s}return i},has:(t,e)=>e in ne(t),ownKeys:t=>Reflect.ownKeys(ne(t)),set(t,e,n){const s=Ne(ne(t),e);if(s?.set)return s.set.call(t.draft_,n),!0;if(!t.modified_){const s=Re(ne(t),e),r=s?.[St];if(r&&r.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(n,s)&&(void 0!==n||zt(t.base_,e,t.type_)))return!0;ke(t),xe(t)}return t.copy_[e]===n&&(void 0!==n||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),function(t,e,n){const{scope_:s}=t;if(Ht(n)){const r=n[St];be(r,s)&&r.callbacks_.push(function(){ke(t);const s=se(r);Ie(t,n,s,e)})}else Ut(n)&&t.callbacks_.push(function(){const r=ne(t);3===t.type_?r.has(n)&&Oe(n,s.handledSet_,s):Kt(r,e,t.type_)===n&&s.drafts_.length>1&&!0===(t.assigned_.get(e)??!1)&&t.copy_&&Oe(Kt(t.copy_,e,t.type_),s.handledSet_,s)})}(t,e,n)),!0},deleteProperty:(t,e)=>(ke(t),void 0!==Re(t.base_,e)||e in t.base_?(t.assigned_.set(e,!1),xe(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const n=ne(t),s=Reflect.getOwnPropertyDescriptor(n,e);return s?{[Mt]:!0,[Ft]:1!==t.type_||"length"!==e,[Pt]:s[Pt],[Gt]:n[e]}:s},defineProperty(){Rt(11)},getPrototypeOf:t=>xt(t.base_),setPrototypeOf(){Rt(12)}},Se={};for(let t in Ae){let e=Ae[t];Se[t]=function(){const t=arguments;return t[0]=t[0][0],e.apply(this,t)}}function Re(t,e){const n=t[St];return(n?ne(n):t)[e]}function Ne(t,e){if(!(e in t))return;let n=xt(t);for(;n;){const t=Object.getOwnPropertyDescriptor(n,e);if(t)return t;n=xt(n)}}function xe(t){t.modified_||(t.modified_=!0,t.parent_&&xe(t.parent_))}function ke(t){t.copy_||(t.assigned_=new Map,t.copy_=re(t.base_,t.scope_.immer_.useStrictShallowCopy_))}Se.deleteProperty=function(t,e){return Se.set.call(this,t,e,void 0)},Se.set=function(t,e,n){return Ae.set.call(this,t[0],e,n,t[0])};function Le(t,e,n,s){const[r,i]=Yt(e)?he(Be).proxyMap_(e,n):Xt(e)?he(Be).proxySet_(e,n):function(t,e){const n=Wt(t),s={type_:n?1:0,scope_:e?e.scope_:fe(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let r=s,i=Ae;n&&(r=[s],i=Se);const{revoke:o,proxy:a}=Proxy.revocable(r,i);return s.draft_=a,s.revoke_=o,[a,s]}(e,n);return(n?.scope_??fe()).drafts_.push(r),i.callbacks_=n?.callbacks_??[],i.key_=s,n&&void 0!==s?function(t,e,n){t.callbacks_.push(function(s){const r=e;if(!r||!be(r,s))return;s.mapSetPlugin_?.fixSetContents(r);const i=se(r);Ie(t,r.draft_??r,i,n),Te(r,s)})}(n,i,s):i.callbacks_.push(function(t){t.mapSetPlugin_?.fixSetContents(i);const{patchPlugin_:e}=t;i.modified_&&e&&e.generatePatches_(i,[],t)}),r}function Fe(t){if(!Ut(t)||ae(t))return t;const e=t[St];let n,s=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=re(t,e.scope_.immer_.useStrictShallowCopy_),s=e.scope_.immer_.shouldUseStrictIteration()}else n=re(t,!0);return Jt(n,(t,e)=>{Qt(n,t,Fe(e))},s),e&&(e.finalized_=!1),n}var Pe=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,e,n)=>{if(te(t)&&!te(e)){const n=e;e=t;const s=this;return function(t=n,...r){return s.produce(t,t=>e.call(this,t,...r))}}let s;if(te(e)||Rt(6),void 0===n||te(n)||Rt(7),Ut(t)){const r=we(this),i=Le(r,t,void 0);let o=!0;try{s=e(i),o=!1}finally{o?ge(r):me(r)}return Ce(r,n),Ee(s,r)}if(!t||!Zt(t)){if(s=e(t),void 0===s&&(s=t),s===Ot&&(s=void 0),this.autoFreeze_&&ie(s,!0),n){const e=[],r=[];he(ce).generateReplacementPatches_(t,s,{patches_:e,inversePatches_:r}),n(e,r)}return s}Rt(1)},this.produceWithPatches=(t,e)=>{if(te(t))return(e,...n)=>this.produceWithPatches(e,e=>t(e,...n));let n,s;const r=this.produce(t,e,(t,e)=>{n=t,s=e});return[r,n,s]},ee(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),ee(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),ee(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Ut(t)||Rt(8),Ht(t)&&(t=function(t){Ht(t)||Rt(10);return Fe(t)}(t));const e=we(this),n=Le(e,t,void 0);return n[St].isManual_=!0,me(e),n}finishDraft(t,e){const n=t&&t[St];n&&n.isManual_||Rt(9);const{scope_:s}=n;return Ce(s,e),Ee(void 0,s)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const s=e[n];if(0===s.path.length&&"replace"===s.op){t=s.value;break}}n>-1&&(e=e.slice(n+1));const s=he(ce).applyPatches_;return Ht(t)?s(t,e):this.produce(t,t=>s(t,e))}},Me=Pe.produce;function Ge(t){return({dispatch:e,getState:n})=>s=>r=>"function"==typeof r?r(e,n,t):s(r)}var He=Ge(),Ue=Ge;const Ve="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Tt:Tt.apply(null,arguments)};function je(t,e){function n(...n){if(e){let s=e(...n);if(!s)throw new Error(nn(0));return{type:t,payload:s.payload,..."meta"in s&&{meta:s.meta},..."error"in s&&{error:s.error}}}return{type:t,payload:n[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=e=>function(t){return bt(t)&&"type"in t&&"string"==typeof t.type}(e)&&e.type===t,n}var $e=class t extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,t.prototype)}static get[Symbol.species](){return t}concat(...t){return super.concat.apply(this,t)}prepend(...e){return 1===e.length&&Array.isArray(e[0])?new t(...e[0].concat(this)):new t(...e.concat(this))}};function Je(t){return Ut(t)?Me(t,()=>{}):t}function qe(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}const ze=t=>e=>{setTimeout(e,t)},Ke=(t={type:"raf"})=>e=>(...n)=>{const s=e(...n);let r=!0,i=!1,o=!1;const a=new Set,B="tick"===t.type?queueMicrotask:"raf"===t.type?"undefined"!=typeof window&&window.requestAnimationFrame?(c=window.requestAnimationFrame,l=100,t=>{let e,n,s=!1;const r=()=>{s||(s=!0,cancelAnimationFrame(e),clearTimeout(n),t())};e=c(r),n=setTimeout(r,l)}):ze(10):"callback"===t.type?t.queueNotification:ze(t.timeout);var c,l;const u=()=>{o=!1,i&&(i=!1,a.forEach(t=>t()))};return Object.assign({},s,{subscribe(t){const e=s.subscribe(()=>r&&t());return a.add(t),()=>{e(),a.delete(t)}},dispatch(t){try{return r=!t?.meta?.RTK_autoBatch,i=!r,i&&(o||(o=!0,B(u))),s.dispatch(t)}finally{r=!0}}})};function Qe(t){const e={},n=[];let s;const r={addCase(t,n){const s="string"==typeof t?t:t.type;if(!s)throw new Error(nn(28));if(s in e)throw new Error(nn(29));return e[s]=n,r},addAsyncThunk:(t,s)=>(s.pending&&(e[t.pending.type]=s.pending),s.rejected&&(e[t.rejected.type]=s.rejected),s.fulfilled&&(e[t.fulfilled.type]=s.fulfilled),s.settled&&n.push({matcher:t.settled,reducer:s.settled}),r),addMatcher:(t,e)=>(n.push({matcher:t,reducer:e}),r),addDefaultCase:t=>(s=t,r)};return t(r),[e,n,s]}const We=Symbol.for("rtk-slice-createasyncthunk");function Ye(t,e){return`${t}/${e}`}function Xe({creators:t}={}){const e=t?.asyncThunk?.[We];return function(t){const{name:n,reducerPath:s=n}=t;if(!n)throw new Error(nn(11));const r=("function"==typeof t.reducers?t.reducers(function(){function t(t,e){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...e}}return t.withTypes=()=>t,{reducer:t=>Object.assign({[t.name]:(...e)=>t(...e)}[t.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(t,e)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:e}),asyncThunk:t}}()):t.reducers)||{},i=Object.keys(r),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(t,e){const n="string"==typeof t?t:t.type;if(!n)throw new Error(nn(12));if(n in o.sliceCaseReducersByType)throw new Error(nn(13));return o.sliceCaseReducersByType[n]=e,a},addMatcher:(t,e)=>(o.sliceMatchers.push({matcher:t,reducer:e}),a),exposeAction:(t,e)=>(o.actionCreators[t]=e,a),exposeCaseReducer:(t,e)=>(o.sliceCaseReducersByName[t]=e,a)};function B(){const[e={},n=[],s]="function"==typeof t.extraReducers?Qe(t.extraReducers):[t.extraReducers],r={...e,...o.sliceCaseReducersByType};return function(t,e){let n,[s,r,i]=Qe(e);if(function(t){return"function"==typeof t}(t))n=()=>Je(t());else{const e=Je(t);n=()=>e}function o(t=n(),e){let o=[s[e.type],...r.filter(({matcher:t})=>t(e)).map(({reducer:t})=>t)];return 0===o.filter(t=>!!t).length&&(o=[i]),o.reduce((t,n)=>{if(n){if(Ht(t)){const s=n(t,e);return void 0===s?t:s}if(Ut(t))return Me(t,t=>n(t,e));{const s=n(t,e);if(void 0===s){if(null===t)return t;throw new Error(nn(9))}return s}}return t},t)}return o.getInitialState=n,o}(t.initialState,t=>{for(let e in r)t.addCase(e,r[e]);for(let e of o.sliceMatchers)t.addMatcher(e.matcher,e.reducer);for(let e of n)t.addMatcher(e.matcher,e.reducer);s&&t.addDefaultCase(s)})}i.forEach(s=>{const i=r[s],o={reducerName:s,type:Ye(n,s),createNotation:"function"==typeof t.reducers};!function(t){return"asyncThunk"===t._reducerDefinitionType}(i)?function({type:t,reducerName:e,createNotation:n},s,r){let i,o;if("reducer"in s){if(n&&!function(t){return"reducerWithPrepare"===t._reducerDefinitionType}(s))throw new Error(nn(17));i=s.reducer,o=s.prepare}else i=s;r.addCase(t,i).exposeCaseReducer(e,i).exposeAction(e,o?je(t,o):je(t))}(o,i,a):function({type:t,reducerName:e},n,s,r){if(!r)throw new Error(nn(18));const{payloadCreator:i,fulfilled:o,pending:a,rejected:B,settled:c,options:l}=n,u=r(t,i,l);s.exposeAction(e,u),o&&s.addCase(u.fulfilled,o);a&&s.addCase(u.pending,a);B&&s.addCase(u.rejected,B);c&&s.addMatcher(u.settled,c);s.exposeCaseReducer(e,{fulfilled:o||en,pending:a||en,rejected:B||en,settled:c||en})}(o,i,a,e)});const c=t=>t,l=new Map,u=new WeakMap;let h;function d(t,e){return h||(h=B()),h(t,e)}function p(){return h||(h=B()),h.getInitialState()}function f(e,n=!1){function s(t){let r=t[e];return void 0===r&&n&&(r=qe(u,s,p)),r}function r(e=c){return qe(qe(l,n,()=>new WeakMap),e,()=>{const s={};for(const[r,i]of Object.entries(t.selectors??{}))s[r]=Ze(i,e,()=>qe(u,e,p),n);return s})}return{reducerPath:e,getSelectors:r,get selectors(){return r(s)},selectSlice:s}}const C={name:n,reducer:d,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:p,...f(s),injectInto(t,{reducerPath:e,...n}={}){const r=e??s;return t.inject({reducerPath:r,reducer:d},n),{...C,...f(r,!0)}}};return C}}function Ze(t,e,n,s){function r(r,...i){let o=e(r);return void 0===o&&s&&(o=n()),t(o,...i)}return r.unwrapped=t,r}const tn=Xe();function en(){}function nn(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}const sn=tn({name:"user",initialState:{settings:"profile",login:!1,drawer:!1,registerOne:!1,registerTwo:!1,userId:"user",customer:"",profileChoice:"unChosen",name:"",photoURL:"",phone:"(...) ... - ....",email:""},reducers:{navigateAuth:(t,e)=>{switch(e.payload){case"profile":case"verification":case"password":case"delete":break;default:e.payload="profile"}t.settings=e.payload},userAuth:(t,e)=>{t.login=e.payload},toggleSign:t=>{!0===t.drawer?t.drawer=!1:t.drawer=!0},openSign:t=>{t.drawer=!0},closeSign:t=>{t.drawer=!1},signUpAction:t=>{!1===t.registerOne?t.registerOne=!0:t.registerOne=!1},universalToggle:(t,e)=>{"drawer"===e.payload?!1===t.registerOne?t.registerOne=!0:t.registerOne=!1:!1===t.registerTwo?t.registerTwo=!0:t.registerTwo=!1},signUpClose:(t,e)=>{t.registerOne=e.payload},iconAuth:(t,e)=>{t.photoURL=e.payload},nameAuth:(t,e)=>{t.name=e.payload}}}),{universalToggle:rn,navigateAuth:on,iconAuth:an,nameAuth:Bn,userAuth:cn,toggleSign:ln,openSign:un,closeSign:hn,signUpAction:dn,signUpClose:pn}=sn.actions,fn=tn({name:"backend",initialState:{verified:!1,anon:!1,userId:"",name:"",email:"",photoURL:"",phone:"",msgToken:""},reducers:{accVerified:(t,e)=>{t.verified=e.payload},accAnon:(t,e)=>{t.anon=e.payload},accID:(t,e)=>{t.userId=e.payload},accName:(t,e)=>{t.name=e.payload},accPhone:(t,e)=>{t.phone=e.payload},accEmail:(t,e)=>{t.email=e.payload},accImage:(t,e)=>{t.photoURL=e.payload},messageId:(t,e)=>{t.msgToken=e.payload}}}),{accVerified:Cn,accID:gn,accName:mn,accPhone:wn,accEmail:yn,accImage:En,accAnon:Dn,messageId:_n}=fn.actions,bn=function(t){const e=function(t){const{thunk:e=!0,immutableCheck:n=!0,serializableCheck:s=!0,actionCreatorCheck:r=!0}=t??{};let i=new $e;return e&&(function(t){return"boolean"==typeof t}(e)?i.push(He):i.push(Ue(e.extraArgument))),i},{reducer:n,middleware:s,devTools:r=!0,preloadedState:i,enhancers:o}=t||{};let a,B;if("function"==typeof n)a=n;else{if(!bt(n))throw new Error(nn(1));a=It(n)}B="function"==typeof s?s(e):e();let c=Tt;r&&(c=Ve({trace:!1,..."object"==typeof r&&r}));const l=function(...t){return e=>(n,s)=>{const r=e(n,s);let i=()=>{throw new Error(yt(15))};const o={getState:r.getState,dispatch:(t,...e)=>i(t,...e)},a=t.map(t=>t(o));return i=Tt(...a)(r.dispatch),{...r,dispatch:i}}}(...B),u=(t=>function(e){const{autoBatch:n=!0}=e??{};let s=new $e(t);return n&&s.push(Ke("object"==typeof n?n:void 0)),s})(l);return vt(a,i,c(..."function"==typeof o?o(u):u()))}({reducer:{frontend:sn.reducer,backend:fn.reducer},devTools:!0}),vn=i`
|
|
7
|
+
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),s=new WeakMap;let r=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const n=this.t;if(e&&void 0===t){const e=void 0!==n&&1===n.length;e&&(t=s.get(n)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(n,t))}return t}toString(){return this.cssText}};const i=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,n,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[s+1],t[0]);return new r(s,t,n)},o=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,n))(e)})(t):t,{is:a,defineProperty:B,getOwnPropertyDescriptor:c,getOwnPropertyNames:l,getOwnPropertySymbols:u,getPrototypeOf:h}=Object,d=globalThis,p=d.trustedTypes,f=p?p.emptyScript:"",C=d.reactiveElementPolyfillSupport,g=(t,e)=>t,m={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},w=(t,e)=>!a(t,e),y={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),d.litPropertyMetadata??=new WeakMap;let E=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=y){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),s=this.getPropertyDescriptor(t,n,e);void 0!==s&&B(this.prototype,t,s)}}static getPropertyDescriptor(t,e,n){const{get:s,set:r}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const i=s?.call(this);r?.call(this,e),this.requestUpdate(t,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y}static _$Ei(){if(this.hasOwnProperty(g("elementProperties")))return;const t=h(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(g("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(g("properties"))){const t=this.properties,e=[...l(t),...u(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((n,s)=>{if(e)n.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of s){const s=document.createElement("style"),r=t.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=e.cssText,n.appendChild(s)}})(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,n);if(void 0!==s&&!0===n.reflect){const r=(void 0!==n.converter?.toAttribute?n.converter:m).toAttribute(e,n.type);this._$Em=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){const n=this.constructor,s=n._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=n.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:m;this._$Em=s;const i=r.fromAttribute(e,t.type);this[s]=i??this._$Ej?.get(s)??i,this._$Em=null}}requestUpdate(t,e,n){if(void 0!==t){const s=this.constructor,r=this[t];if(n??=s.getPropertyOptions(t),!((n.hasChanged??w)(r,e)||n.useDefault&&n.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:s,wrapped:r},i){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),!0!==r||void 0!==i)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t){const{wrapped:t}=n,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,n,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};E.elementStyles=[],E.shadowRootOptions={mode:"open"},E[g("elementProperties")]=new Map,E[g("finalized")]=new Map,C?.({ReactiveElement:E}),(d.reactiveElementVersions??=[]).push("2.1.1");const _=globalThis,D=_.trustedTypes,b=D?D.createPolicy("lit-html",{createHTML:t=>t}):void 0,v="$lit$",I=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+I,O=`<${T}>`,A=document,S=()=>A.createComment(""),R=t=>null===t||"object"!=typeof t&&"function"!=typeof t,N=Array.isArray,x="[ \t\n\f\r]",k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,F=/>/g,P=RegExp(`>|${x}(?:([^\\s"'>=/]+)(${x}*=${x}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,G=/"/g,H=/^(?:script|style|textarea|title)$/i,U=(t=>(e,...n)=>({_$litType$:t,strings:e,values:n}))(1),V=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),$=new WeakMap,J=A.createTreeWalker(A,129);function q(t,e){if(!N(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==b?b.createHTML(e):e}const z=(t,e)=>{const n=t.length-1,s=[];let r,i=2===e?"<svg>":3===e?"<math>":"",o=k;for(let e=0;e<n;e++){const n=t[e];let a,B,c=-1,l=0;for(;l<n.length&&(o.lastIndex=l,B=o.exec(n),null!==B);)l=o.lastIndex,o===k?"!--"===B[1]?o=L:void 0!==B[1]?o=F:void 0!==B[2]?(H.test(B[2])&&(r=RegExp("</"+B[2],"g")),o=P):void 0!==B[3]&&(o=P):o===P?">"===B[0]?(o=r??k,c=-1):void 0===B[1]?c=-2:(c=o.lastIndex-B[2].length,a=B[1],o=void 0===B[3]?P:'"'===B[3]?G:M):o===G||o===M?o=P:o===L||o===F?o=k:(o=P,r=void 0);const u=o===P&&t[e+1].startsWith("/>")?" ":"";i+=o===k?n+O:c>=0?(s.push(a),n.slice(0,c)+v+n.slice(c)+I+u):n+I+(-2===c?e:u)}return[q(t,i+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class K{constructor({strings:t,_$litType$:e},n){let s;this.parts=[];let r=0,i=0;const o=t.length-1,a=this.parts,[B,c]=z(t,e);if(this.el=K.createElement(B,n),J.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=J.nextNode())&&a.length<o;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(v)){const e=c[i++],n=s.getAttribute(t).split(I),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:r,name:o[2],strings:n,ctor:"."===o[1]?Z:"?"===o[1]?tt:"@"===o[1]?et:X}),s.removeAttribute(t)}else t.startsWith(I)&&(a.push({type:6,index:r}),s.removeAttribute(t));if(H.test(s.tagName)){const t=s.textContent.split(I),e=t.length-1;if(e>0){s.textContent=D?D.emptyScript:"";for(let n=0;n<e;n++)s.append(t[n],S()),J.nextNode(),a.push({type:2,index:++r});s.append(t[e],S())}}}else if(8===s.nodeType)if(s.data===T)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(I,t+1));)a.push({type:7,index:r}),t+=I.length-1}r++}}static createElement(t,e){const n=A.createElement("template");return n.innerHTML=t,n}}function Q(t,e,n=t,s){if(e===V)return e;let r=void 0!==s?n._$Co?.[s]:n._$Cl;const i=R(e)?void 0:e._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),void 0===i?r=void 0:(r=new i(t),r._$AT(t,n,s)),void 0!==s?(n._$Co??=[])[s]=r:n._$Cl=r),void 0!==r&&(e=Q(t,r._$AS(t,e.values),r,s)),e}let W=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,s=(t?.creationScope??A).importNode(e,!0);J.currentNode=s;let r=J.nextNode(),i=0,o=0,a=n[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new Y(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new nt(r,this,t)),this._$AV.push(e),a=n[++o]}i!==a?.index&&(r=J.nextNode(),i++)}return J.currentNode=A,s}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}},Y=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,s){this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Q(this,t,e),R(t)?t===j||null==t||""===t?(this._$AH!==j&&this._$AR(),this._$AH=j):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>N(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==j&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(A.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=K.createElement(q(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new W(s,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=$.get(t.strings);return void 0===e&&$.set(t.strings,e=new K(t)),e}k(e){N(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,r=0;for(const i of e)r===n.length?n.push(s=new t(this.O(S()),this.O(S()),this,this.options)):s=n[r],s._$AI(i),r++;r<n.length&&(this._$AR(s&&s._$AB.nextSibling,r),n.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},X=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,s,r){this.type=1,this._$AH=j,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=j}_$AI(t,e=this,n,s){const r=this.strings;let i=!1;if(void 0===r)t=Q(this,t,e,0),i=!R(t)||t!==this._$AH&&t!==V,i&&(this._$AH=t);else{const s=t;let o,a;for(t=r[0],o=0;o<r.length-1;o++)a=Q(this,s[n+o],e,o),a===V&&(a=this._$AH[o]),i||=!R(a)||a!==this._$AH[o],a===j?t=j:t!==j&&(t+=(a??"")+r[o+1]),this._$AH[o]=a}i&&!s&&this.j(t)}j(t){t===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}};class Z extends X{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===j?void 0:t}}let tt=class extends X{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==j)}},et=class extends X{constructor(t,e,n,s,r){super(t,e,n,s,r),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??j)===V)return;const n=this._$AH,s=t===j&&n!==j||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==j&&(n===j||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}};class nt{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}}const st=_.litHtmlPolyfillSupport;st?.(K,Y),(_.litHtmlVersions??=[]).push("3.3.1");const rt=globalThis;let it=class extends E{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,n)=>{const s=n?.renderBefore??e;let r=s._$litPart$;if(void 0===r){const t=n?.renderBefore??null;s._$litPart$=r=new Y(e.insertBefore(S(),t),t,void 0,n??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};it._$litElement$=!0,it.finalized=!0,rt.litElementHydrateSupport?.({LitElement:it});const ot=rt.litElementPolyfillSupport;ot?.({LitElement:it}),(rt.litElementVersions??=[]).push("4.2.1");const at=t=>(e,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},Bt={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:w},ct=(t=Bt,e,n)=>{const{kind:s,metadata:r}=n;let i=globalThis.litPropertyMetadata.get(r);if(void 0===i&&globalThis.litPropertyMetadata.set(r,i=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),i.set(n.name,t),"accessor"===s){const{name:s}=n;return{set(n){const r=e.get.call(this);e.set.call(this,n),this.requestUpdate(s,r,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=n;return function(n){const r=this[s];e.call(this,n),this.requestUpdate(s,r,t)}}throw Error("Unsupported decorator location: "+s)};function lt(t){return(e,n)=>"object"==typeof n?ct(t,e,n):((t,e,n)=>{const s=e.hasOwnProperty(n);return e.constructor.createProperty(n,t),s?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}function ut(t){return lt({...t,state:!0,attribute:!1})}const ht=1,dt=t=>(...e)=>({_$litDirective$:t,values:e});let pt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};const ft=dt(class extends pt{constructor(t){if(super(t),t.type!==ht||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const n=t.element.classList;for(const t of this.st)t in e||(n.remove(t),this.st.delete(t));for(const t in e){const s=!!e[t];s===this.st.has(t)||this.nt?.has(t)||(s?(n.add(t),this.st.add(t)):(n.remove(t),this.st.delete(t)))}return V}}),Ct="important",gt=" !"+Ct,mt=dt(class extends pt{constructor(t){if(super(t),t.type!==ht||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,n)=>{const s=t[n];return null==s?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(t,[e]){const{style:n}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?n.removeProperty(t):n[t]=null);for(const t in e){const s=e[t];if(null!=s){this.ft.add(t);const e="string"==typeof s&&s.endsWith(gt);t.includes("-")||e?n.setProperty(t,e?s.slice(0,-11):s,e?Ct:""):n[t]=s}}return V}}),wt=t=>e=>class extends e{connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=t.subscribe(()=>this.stateChanged(t.getState())),this.stateChanged(t.getState())}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}stateChanged(t){}};function yt(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Et=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),_t=()=>Math.random().toString(36).substring(7).split("").join("."),Dt={INIT:`@@redux/INIT${_t()}`,REPLACE:`@@redux/REPLACE${_t()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${_t()}`};function bt(t){if("object"!=typeof t||null===t)return!1;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||null===Object.getPrototypeOf(t)}function vt(t,e,n){if("function"!=typeof t)throw new Error(yt(2));if("function"==typeof e&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(yt(0));if("function"==typeof e&&void 0===n&&(n=e,e=void 0),void 0!==n){if("function"!=typeof n)throw new Error(yt(1));return n(vt)(t,e)}let s=t,r=e,i=new Map,o=i,a=0,B=!1;function c(){o===i&&(o=new Map,i.forEach((t,e)=>{o.set(e,t)}))}function l(){if(B)throw new Error(yt(3));return r}function u(t){if("function"!=typeof t)throw new Error(yt(4));if(B)throw new Error(yt(5));let e=!0;c();const n=a++;return o.set(n,t),function(){if(e){if(B)throw new Error(yt(6));e=!1,c(),o.delete(n),i=null}}}function h(t){if(!bt(t))throw new Error(yt(7));if(void 0===t.type)throw new Error(yt(8));if("string"!=typeof t.type)throw new Error(yt(17));if(B)throw new Error(yt(9));try{B=!0,r=s(r,t)}finally{B=!1}return(i=o).forEach(t=>{t()}),t}h({type:Dt.INIT});return{dispatch:h,subscribe:u,getState:l,replaceReducer:function(t){if("function"!=typeof t)throw new Error(yt(10));s=t,h({type:Dt.REPLACE})},[Et]:function(){const t=u;return{subscribe(e){if("object"!=typeof e||null===e)throw new Error(yt(11));function n(){const t=e;t.next&&t.next(l())}n();return{unsubscribe:t(n)}},[Et](){return this}}}}}function It(t){const e=Object.keys(t),n={};for(let s=0;s<e.length;s++){const r=e[s];"function"==typeof t[r]&&(n[r]=t[r])}const s=Object.keys(n);let r;try{!function(t){Object.keys(t).forEach(e=>{const n=t[e];if(void 0===n(void 0,{type:Dt.INIT}))throw new Error(yt(12));if(void 0===n(void 0,{type:Dt.PROBE_UNKNOWN_ACTION()}))throw new Error(yt(13))})}(n)}catch(t){r=t}return function(t={},e){if(r)throw r;let i=!1;const o={};for(let r=0;r<s.length;r++){const a=s[r],B=n[a],c=t[a],l=B(c,e);if(void 0===l)throw e&&e.type,new Error(yt(14));o[a]=l,i=i||l!==c}return i=i||s.length!==Object.keys(t).length,i?o:t}}function Tt(...t){return 0===t.length?t=>t:1===t.length?t[0]:t.reduce((t,e)=>(...n)=>t(e(...n)))}var Ot=Symbol.for("immer-nothing"),At=Symbol.for("immer-draftable"),St=Symbol.for("immer-state");function Rt(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Nt=Object,xt=Nt.getPrototypeOf,kt="constructor",Lt="prototype",Ft="configurable",Pt="enumerable",Mt="writable",Gt="value",Ht=t=>!!t&&!!t[St];function Ut(t){return!!t&&($t(t)||Wt(t)||!!t[At]||!!t[kt]?.[At]||Yt(t)||Xt(t))}var Vt=Nt[Lt][kt].toString(),jt=new WeakMap;function $t(t){if(!t||!Zt(t))return!1;const e=xt(t);if(null===e||e===Nt[Lt])return!0;const n=Nt.hasOwnProperty.call(e,kt)&&e[kt];if(n===Object)return!0;if(!te(n))return!1;let s=jt.get(n);return void 0===s&&(s=Function.toString.call(n),jt.set(n,s)),s===Vt}function Jt(t,e,n=!0){if(0===qt(t)){(n?Reflect.ownKeys(t):Nt.keys(t)).forEach(n=>{e(n,t[n],t)})}else t.forEach((n,s)=>e(s,n,t))}function qt(t){const e=t[St];return e?e.type_:Wt(t)?1:Yt(t)?2:Xt(t)?3:0}var zt=(t,e,n=qt(t))=>2===n?t.has(e):Nt[Lt].hasOwnProperty.call(t,e),Kt=(t,e,n=qt(t))=>2===n?t.get(e):t[e],Qt=(t,e,n,s=qt(t))=>{2===s?t.set(e,n):3===s?t.add(n):t[e]=n};var Wt=Array.isArray,Yt=t=>t instanceof Map,Xt=t=>t instanceof Set,Zt=t=>"object"==typeof t,te=t=>"function"==typeof t,ee=t=>"boolean"==typeof t;var ne=t=>t.copy_||t.base_,se=t=>t.modified_?t.copy_:t.base_;function re(t,e){if(Yt(t))return new Map(t);if(Xt(t))return new Set(t);if(Wt(t))return Array[Lt].slice.call(t);const n=$t(t);if(!0===e||"class_only"===e&&!n){const e=Nt.getOwnPropertyDescriptors(t);delete e[St];let n=Reflect.ownKeys(e);for(let s=0;s<n.length;s++){const r=n[s],i=e[r];!1===i[Mt]&&(i[Mt]=!0,i[Ft]=!0),(i.get||i.set)&&(e[r]={[Ft]:!0,[Mt]:!0,[Pt]:i[Pt],[Gt]:t[r]})}return Nt.create(xt(t),e)}{const e=xt(t);if(null!==e&&n)return{...t};const s=Nt.create(e);return Nt.assign(s,t)}}function ie(t,e=!1){return ae(t)||Ht(t)||!Ut(t)||(qt(t)>1&&Nt.defineProperties(t,{set:oe,add:oe,clear:oe,delete:oe}),Nt.freeze(t),e&&Jt(t,(t,e)=>{ie(e,!0)},!1)),t}var oe={[Gt]:function(){Rt(2)}};function ae(t){return null===t||!Zt(t)||Nt.isFrozen(t)}var Be="MapSet",ce="Patches",le="ArrayMethods",ue={};function he(t){const e=ue[t];return e||Rt(0),e}var de,pe=t=>!!ue[t],fe=()=>de;function Ce(t,e){e&&(t.patchPlugin_=he(ce),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function ge(t){me(t),t.drafts_.forEach(ye),t.drafts_=null}function me(t){t===de&&(de=t.parent_)}var we=t=>de={drafts_:[],parent_:de,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:pe(Be)?he(Be):void 0,arrayMethodsPlugin_:pe(le)?he(le):void 0};function ye(t){const e=t[St];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function Ee(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(void 0!==t&&t!==n){n[St].modified_&&(ge(e),Rt(4)),Ut(t)&&(t=_e(e,t));const{patchPlugin_:s}=e;s&&s.generateReplacementPatches_(n[St].base_,t,e)}else t=_e(e,n);return function(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&ie(e,n)}(e,t,!0),ge(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Ot?t:void 0}function _e(t,e){if(ae(e))return e;const n=e[St];if(!n){return Oe(e,t.handledSet_,t)}if(!be(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:e}=n;if(e)for(;e.length>0;){e.pop()(t)}Te(n,t)}return n.copy_}function De(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var be=(t,e)=>t.scope_===e,ve=[];function Ie(t,e,n,s){const r=ne(t),i=t.type_;if(void 0!==s){if(Kt(r,s,i)===e)return void Qt(r,s,n,i)}if(!t.draftLocations_){const e=t.draftLocations_=new Map;Jt(r,(t,n)=>{if(Ht(n)){const s=e.get(n)||[];s.push(t),e.set(n,s)}})}const o=t.draftLocations_.get(e)??ve;for(const t of o)Qt(r,t,n,i)}function Te(t,e){if(t.modified_&&!t.finalized_&&(3===t.type_||1===t.type_&&t.allIndicesReassigned_||(t.assigned_?.size??0)>0)){const{patchPlugin_:n}=e;if(n){const s=n.getPath(t);s&&n.generatePatches_(t,s,e)}De(t)}}function Oe(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ht(t)||e.has(t)||!Ut(t)||ae(t)||(e.add(t),Jt(t,(s,r)=>{if(Ht(r)){const e=r[St];if(be(e,n)){const n=se(e);Qt(t,s,n,t.type_),De(e)}}else Ut(r)&&Oe(r,e,n)})),t}var Ae={get(t,e){if(e===St)return t;let n=t.scope_.arrayMethodsPlugin_;const s=1===t.type_&&"string"==typeof e;if(s&&n?.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const r=ne(t);if(!zt(r,e,t.type_))return function(t,e,n){const s=Ne(e,n);return s?Gt in s?s[Gt]:s.get?.call(t.draft_):void 0}(t,r,e);const i=r[e];if(t.finalized_||!Ut(i))return i;if(s&&t.operationMethod&&n?.isMutatingArrayMethod(t.operationMethod)&&function(t){const e=+t;return Number.isInteger(e)&&String(e)===t}(e))return i;if(i===Re(t.base_,e)){ke(t);const n=1===t.type_?+e:e,s=Le(t.scope_,i,t,n);return t.copy_[n]=s}return i},has:(t,e)=>e in ne(t),ownKeys:t=>Reflect.ownKeys(ne(t)),set(t,e,n){const s=Ne(ne(t),e);if(s?.set)return s.set.call(t.draft_,n),!0;if(!t.modified_){const s=Re(ne(t),e),r=s?.[St];if(r&&r.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(n,s)&&(void 0!==n||zt(t.base_,e,t.type_)))return!0;ke(t),xe(t)}return t.copy_[e]===n&&(void 0!==n||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),function(t,e,n){const{scope_:s}=t;if(Ht(n)){const r=n[St];be(r,s)&&r.callbacks_.push(function(){ke(t);const s=se(r);Ie(t,n,s,e)})}else Ut(n)&&t.callbacks_.push(function(){const r=ne(t);3===t.type_?r.has(n)&&Oe(n,s.handledSet_,s):Kt(r,e,t.type_)===n&&s.drafts_.length>1&&!0===(t.assigned_.get(e)??!1)&&t.copy_&&Oe(Kt(t.copy_,e,t.type_),s.handledSet_,s)})}(t,e,n)),!0},deleteProperty:(t,e)=>(ke(t),void 0!==Re(t.base_,e)||e in t.base_?(t.assigned_.set(e,!1),xe(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const n=ne(t),s=Reflect.getOwnPropertyDescriptor(n,e);return s?{[Mt]:!0,[Ft]:1!==t.type_||"length"!==e,[Pt]:s[Pt],[Gt]:n[e]}:s},defineProperty(){Rt(11)},getPrototypeOf:t=>xt(t.base_),setPrototypeOf(){Rt(12)}},Se={};for(let t in Ae){let e=Ae[t];Se[t]=function(){const t=arguments;return t[0]=t[0][0],e.apply(this,t)}}function Re(t,e){const n=t[St];return(n?ne(n):t)[e]}function Ne(t,e){if(!(e in t))return;let n=xt(t);for(;n;){const t=Object.getOwnPropertyDescriptor(n,e);if(t)return t;n=xt(n)}}function xe(t){t.modified_||(t.modified_=!0,t.parent_&&xe(t.parent_))}function ke(t){t.copy_||(t.assigned_=new Map,t.copy_=re(t.base_,t.scope_.immer_.useStrictShallowCopy_))}Se.deleteProperty=function(t,e){return Se.set.call(this,t,e,void 0)},Se.set=function(t,e,n){return Ae.set.call(this,t[0],e,n,t[0])};function Le(t,e,n,s){const[r,i]=Yt(e)?he(Be).proxyMap_(e,n):Xt(e)?he(Be).proxySet_(e,n):function(t,e){const n=Wt(t),s={type_:n?1:0,scope_:e?e.scope_:fe(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let r=s,i=Ae;n&&(r=[s],i=Se);const{revoke:o,proxy:a}=Proxy.revocable(r,i);return s.draft_=a,s.revoke_=o,[a,s]}(e,n);return(n?.scope_??fe()).drafts_.push(r),i.callbacks_=n?.callbacks_??[],i.key_=s,n&&void 0!==s?function(t,e,n){t.callbacks_.push(function(s){const r=e;if(!r||!be(r,s))return;s.mapSetPlugin_?.fixSetContents(r);const i=se(r);Ie(t,r.draft_??r,i,n),Te(r,s)})}(n,i,s):i.callbacks_.push(function(t){t.mapSetPlugin_?.fixSetContents(i);const{patchPlugin_:e}=t;i.modified_&&e&&e.generatePatches_(i,[],t)}),r}function Fe(t){if(!Ut(t)||ae(t))return t;const e=t[St];let n,s=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=re(t,e.scope_.immer_.useStrictShallowCopy_),s=e.scope_.immer_.shouldUseStrictIteration()}else n=re(t,!0);return Jt(n,(t,e)=>{Qt(n,t,Fe(e))},s),e&&(e.finalized_=!1),n}var Pe=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,e,n)=>{if(te(t)&&!te(e)){const n=e;e=t;const s=this;return function(t=n,...r){return s.produce(t,t=>e.call(this,t,...r))}}let s;if(te(e)||Rt(6),void 0===n||te(n)||Rt(7),Ut(t)){const r=we(this),i=Le(r,t,void 0);let o=!0;try{s=e(i),o=!1}finally{o?ge(r):me(r)}return Ce(r,n),Ee(s,r)}if(!t||!Zt(t)){if(s=e(t),void 0===s&&(s=t),s===Ot&&(s=void 0),this.autoFreeze_&&ie(s,!0),n){const e=[],r=[];he(ce).generateReplacementPatches_(t,s,{patches_:e,inversePatches_:r}),n(e,r)}return s}Rt(1)},this.produceWithPatches=(t,e)=>{if(te(t))return(e,...n)=>this.produceWithPatches(e,e=>t(e,...n));let n,s;const r=this.produce(t,e,(t,e)=>{n=t,s=e});return[r,n,s]},ee(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),ee(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),ee(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Ut(t)||Rt(8),Ht(t)&&(t=function(t){Ht(t)||Rt(10);return Fe(t)}(t));const e=we(this),n=Le(e,t,void 0);return n[St].isManual_=!0,me(e),n}finishDraft(t,e){const n=t&&t[St];n&&n.isManual_||Rt(9);const{scope_:s}=n;return Ce(s,e),Ee(void 0,s)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const s=e[n];if(0===s.path.length&&"replace"===s.op){t=s.value;break}}n>-1&&(e=e.slice(n+1));const s=he(ce).applyPatches_;return Ht(t)?s(t,e):this.produce(t,t=>s(t,e))}},Me=Pe.produce;function Ge(t){return({dispatch:e,getState:n})=>s=>r=>"function"==typeof r?r(e,n,t):s(r)}var He=Ge(),Ue=Ge;const Ve="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Tt:Tt.apply(null,arguments)};function je(t,e){function n(...n){if(e){let s=e(...n);if(!s)throw new Error(nn(0));return{type:t,payload:s.payload,..."meta"in s&&{meta:s.meta},..."error"in s&&{error:s.error}}}return{type:t,payload:n[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=e=>function(t){return bt(t)&&"type"in t&&"string"==typeof t.type}(e)&&e.type===t,n}var $e=class t extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,t.prototype)}static get[Symbol.species](){return t}concat(...t){return super.concat.apply(this,t)}prepend(...e){return 1===e.length&&Array.isArray(e[0])?new t(...e[0].concat(this)):new t(...e.concat(this))}};function Je(t){return Ut(t)?Me(t,()=>{}):t}function qe(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}const ze=t=>e=>{setTimeout(e,t)},Ke=(t={type:"raf"})=>e=>(...n)=>{const s=e(...n);let r=!0,i=!1,o=!1;const a=new Set,B="tick"===t.type?queueMicrotask:"raf"===t.type?"undefined"!=typeof window&&window.requestAnimationFrame?(c=window.requestAnimationFrame,l=100,t=>{let e,n,s=!1;const r=()=>{s||(s=!0,cancelAnimationFrame(e),clearTimeout(n),t())};e=c(r),n=setTimeout(r,l)}):ze(10):"callback"===t.type?t.queueNotification:ze(t.timeout);var c,l;const u=()=>{o=!1,i&&(i=!1,a.forEach(t=>t()))};return Object.assign({},s,{subscribe(t){const e=s.subscribe(()=>r&&t());return a.add(t),()=>{e(),a.delete(t)}},dispatch(t){try{return r=!t?.meta?.RTK_autoBatch,i=!r,i&&(o||(o=!0,B(u))),s.dispatch(t)}finally{r=!0}}})};function Qe(t){const e={},n=[];let s;const r={addCase(t,n){const s="string"==typeof t?t:t.type;if(!s)throw new Error(nn(28));if(s in e)throw new Error(nn(29));return e[s]=n,r},addAsyncThunk:(t,s)=>(s.pending&&(e[t.pending.type]=s.pending),s.rejected&&(e[t.rejected.type]=s.rejected),s.fulfilled&&(e[t.fulfilled.type]=s.fulfilled),s.settled&&n.push({matcher:t.settled,reducer:s.settled}),r),addMatcher:(t,e)=>(n.push({matcher:t,reducer:e}),r),addDefaultCase:t=>(s=t,r)};return t(r),[e,n,s]}const We=Symbol.for("rtk-slice-createasyncthunk");function Ye(t,e){return`${t}/${e}`}function Xe({creators:t}={}){const e=t?.asyncThunk?.[We];return function(t){const{name:n,reducerPath:s=n}=t;if(!n)throw new Error(nn(11));const r=("function"==typeof t.reducers?t.reducers(function(){function t(t,e){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...e}}return t.withTypes=()=>t,{reducer:t=>Object.assign({[t.name]:(...e)=>t(...e)}[t.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(t,e)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:e}),asyncThunk:t}}()):t.reducers)||{},i=Object.keys(r),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(t,e){const n="string"==typeof t?t:t.type;if(!n)throw new Error(nn(12));if(n in o.sliceCaseReducersByType)throw new Error(nn(13));return o.sliceCaseReducersByType[n]=e,a},addMatcher:(t,e)=>(o.sliceMatchers.push({matcher:t,reducer:e}),a),exposeAction:(t,e)=>(o.actionCreators[t]=e,a),exposeCaseReducer:(t,e)=>(o.sliceCaseReducersByName[t]=e,a)};function B(){const[e={},n=[],s]="function"==typeof t.extraReducers?Qe(t.extraReducers):[t.extraReducers],r={...e,...o.sliceCaseReducersByType};return function(t,e){let n,[s,r,i]=Qe(e);if(function(t){return"function"==typeof t}(t))n=()=>Je(t());else{const e=Je(t);n=()=>e}function o(t=n(),e){let o=[s[e.type],...r.filter(({matcher:t})=>t(e)).map(({reducer:t})=>t)];return 0===o.filter(t=>!!t).length&&(o=[i]),o.reduce((t,n)=>{if(n){if(Ht(t)){const s=n(t,e);return void 0===s?t:s}if(Ut(t))return Me(t,t=>n(t,e));{const s=n(t,e);if(void 0===s){if(null===t)return t;throw new Error(nn(9))}return s}}return t},t)}return o.getInitialState=n,o}(t.initialState,t=>{for(let e in r)t.addCase(e,r[e]);for(let e of o.sliceMatchers)t.addMatcher(e.matcher,e.reducer);for(let e of n)t.addMatcher(e.matcher,e.reducer);s&&t.addDefaultCase(s)})}i.forEach(s=>{const i=r[s],o={reducerName:s,type:Ye(n,s),createNotation:"function"==typeof t.reducers};!function(t){return"asyncThunk"===t._reducerDefinitionType}(i)?function({type:t,reducerName:e,createNotation:n},s,r){let i,o;if("reducer"in s){if(n&&!function(t){return"reducerWithPrepare"===t._reducerDefinitionType}(s))throw new Error(nn(17));i=s.reducer,o=s.prepare}else i=s;r.addCase(t,i).exposeCaseReducer(e,i).exposeAction(e,o?je(t,o):je(t))}(o,i,a):function({type:t,reducerName:e},n,s,r){if(!r)throw new Error(nn(18));const{payloadCreator:i,fulfilled:o,pending:a,rejected:B,settled:c,options:l}=n,u=r(t,i,l);s.exposeAction(e,u),o&&s.addCase(u.fulfilled,o);a&&s.addCase(u.pending,a);B&&s.addCase(u.rejected,B);c&&s.addMatcher(u.settled,c);s.exposeCaseReducer(e,{fulfilled:o||en,pending:a||en,rejected:B||en,settled:c||en})}(o,i,a,e)});const c=t=>t,l=new Map,u=new WeakMap;let h;function d(t,e){return h||(h=B()),h(t,e)}function p(){return h||(h=B()),h.getInitialState()}function f(e,n=!1){function s(t){let r=t[e];return void 0===r&&n&&(r=qe(u,s,p)),r}function r(e=c){return qe(qe(l,n,()=>new WeakMap),e,()=>{const s={};for(const[r,i]of Object.entries(t.selectors??{}))s[r]=Ze(i,e,()=>qe(u,e,p),n);return s})}return{reducerPath:e,getSelectors:r,get selectors(){return r(s)},selectSlice:s}}const C={name:n,reducer:d,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:p,...f(s),injectInto(t,{reducerPath:e,...n}={}){const r=e??s;return t.inject({reducerPath:r,reducer:d},n),{...C,...f(r,!0)}}};return C}}function Ze(t,e,n,s){function r(r,...i){let o=e(r);return void 0===o&&s&&(o=n()),t(o,...i)}return r.unwrapped=t,r}const tn=Xe();function en(){}function nn(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}const sn=new Set(["profile","verification","password","delete"]),rn=tn({name:"session",initialState:{login:!1,drawer:!1,registerOne:!1,registerTwo:!1,settings:"profile",verified:!1,name:"",email:"",photoURL:""},reducers:{navigateAuth(t,e){t.settings=sn.has(e.payload)?e.payload:"profile"},userAuth(t,e){t.login=e.payload},toggleSign(t){t.drawer=!t.drawer},openSign(t){t.drawer=!0},closeSign(t){t.drawer=!1},universalToggle(t,e){"drawer"===e.payload?t.registerOne=!t.registerOne:t.registerTwo=!t.registerTwo},accName(t,e){t.name=e.payload},accEmail(t,e){t.email=e.payload},accImage(t,e){t.photoURL=e.payload},accVerified(t,e){t.verified=e.payload}}}),{navigateAuth:on,userAuth:an,toggleSign:Bn,openSign:cn,closeSign:ln,universalToggle:un,accName:hn,accEmail:dn,accImage:pn,accVerified:fn}=rn.actions,Cn=function(t){const e=function(t){const{thunk:e=!0,immutableCheck:n=!0,serializableCheck:s=!0,actionCreatorCheck:r=!0}=t??{};let i=new $e;return e&&(function(t){return"boolean"==typeof t}(e)?i.push(He):i.push(Ue(e.extraArgument))),i},{reducer:n,middleware:s,devTools:r=!0,preloadedState:i,enhancers:o}=t||{};let a,B;if("function"==typeof n)a=n;else{if(!bt(n))throw new Error(nn(1));a=It(n)}B="function"==typeof s?s(e):e();let c=Tt;r&&(c=Ve({trace:!1,..."object"==typeof r&&r}));const l=function(...t){return e=>(n,s)=>{const r=e(n,s);let i=()=>{throw new Error(yt(15))};const o={getState:r.getState,dispatch:(t,...e)=>i(t,...e)},a=t.map(t=>t(o));return i=Tt(...a)(r.dispatch),{...r,dispatch:i}}}(...B),u=(t=>function(e){const{autoBatch:n=!0}=e??{};let s=new $e(t);return n&&s.push(Ke("object"==typeof n?n:void 0)),s})(l);return vt(a,i,c(..."function"==typeof o?o(u):u()))}({reducer:{session:rn.reducer},devTools:!0}),gn=i`
|
|
8
8
|
|
|
9
9
|
:host {
|
|
10
10
|
/* Required - this host's clock. It does not inherit onto a sibling component. */
|
|
@@ -98,7 +98,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
`,
|
|
101
|
+
`,mn=i`
|
|
102
102
|
|
|
103
103
|
:host {
|
|
104
104
|
max-height: 0px;
|
|
@@ -113,7 +113,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
113
113
|
pointer-events: auto;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
`,
|
|
116
|
+
`,wn=[i`
|
|
117
117
|
|
|
118
118
|
:host([animation]) {
|
|
119
119
|
max-height: 100%;
|
|
@@ -147,14 +147,19 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
h2 {
|
|
150
|
+
box-sizing: border-box;
|
|
151
|
+
width: 100%;
|
|
152
|
+
justify-self: stretch;
|
|
150
153
|
margin: 0;
|
|
154
|
+
margin-inline: 0;
|
|
151
155
|
padding: 18px var(--pwa_inset, 0px) 14px;
|
|
152
156
|
font-size: 1.15rem;
|
|
153
157
|
font-weight: 600;
|
|
158
|
+
text-align: center;
|
|
154
159
|
border-bottom: 1px solid var(--pwa_line_color, #e3daca);
|
|
155
160
|
}
|
|
156
161
|
|
|
157
|
-
`],
|
|
162
|
+
`],yn=i`
|
|
158
163
|
|
|
159
164
|
a {
|
|
160
165
|
font-size: 0.95rem;
|
|
@@ -163,7 +168,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
163
168
|
text-decoration: none;
|
|
164
169
|
}
|
|
165
170
|
|
|
166
|
-
`,
|
|
171
|
+
`,En=i`
|
|
167
172
|
|
|
168
173
|
.setLog > p {
|
|
169
174
|
margin: 12px;
|
|
@@ -171,7 +176,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
171
176
|
text-align: center;
|
|
172
177
|
}
|
|
173
178
|
|
|
174
|
-
`,
|
|
179
|
+
`,_n=i`
|
|
175
180
|
|
|
176
181
|
ul {
|
|
177
182
|
list-style-type: none;
|
|
@@ -191,7 +196,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
191
196
|
margin: 0;
|
|
192
197
|
}
|
|
193
198
|
|
|
194
|
-
`,Rn=function(t){const e=[];let n=0;for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):55296==(64512&r)&&s+1<t.length&&56320==(64512&t.charCodeAt(s+1))?(r=65536+((1023&r)<<10)+(1023&t.charCodeAt(++s)),e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e},Nn={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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let e=0;e<t.length;e+=3){const r=t[e],i=e+1<t.length,o=i?t[e+1]:0,a=e+2<t.length,B=a?t[e+2]:0,c=r>>2,l=(3&r)<<4|o>>4;let u=(15&o)<<2|B>>6,h=63&B;a||(h=64,i||(u=64)),s.push(n[c],n[l],n[u],n[h])}return s.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Rn(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,s=0;for(;n<t.length;){const r=t[n++];if(r<128)e[s++]=String.fromCharCode(r);else if(r>191&&r<224){const i=t[n++];e[s++]=String.fromCharCode((31&r)<<6|63&i)}else if(r>239&&r<365){const i=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[s++]=String.fromCharCode(55296+(i>>10)),e[s++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[s++]=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let e=0;e<t.length;){const r=n[t.charAt(e++)],i=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==r||null==i||null==o||null==a)throw new xn;const B=r<<2|i>>4;if(s.push(B),64!==o){const t=i<<4&240|o>>2;if(s.push(t),64!==a){const t=o<<6&192|a;s.push(t)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class xn extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const kn=function(t){return function(t){const e=Rn(t);return Nn.encodeByteArray(e,!0)}(t).replace(/\./g,"")},Ln=function(t){try{return Nn.decodeString(t,!0)}catch(t){}return null};const Fn=()=>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 Fn()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&Ln(t[1]);return e&&JSON.parse(e)})()}catch(t){return}},Mn=t=>Pn()?.emulatorHosts?.[t],Gn=t=>{const e=Mn(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const s=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),s]:[e.substring(0,n),s]},Hn=()=>Pn()?.config,Un=t=>Pn()?.[`_${t}`];class Vn{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}wrapCallback(t){return(e,n)=>{e?this.reject(e):this.resolve(n),"function"==typeof t&&(this.promise.catch(()=>{}),1===t.length?t(e):t(e,n))}}}function jn(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",s=t.iat||0,r=t.sub||t.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i={iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}},...t};return[kn(JSON.stringify({alg:"none",type:"JWT"})),kn(JSON.stringify(i)),""].join(".")}function $n(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function Jn(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}function qn(){return!function(){const t=Pn()?.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(t){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function zn(){try{return"object"==typeof indexedDB}catch(t){return!1}}function Kn(){return new Promise((t,e)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(s),t(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{e(r.error?.message||"")}}catch(t){e(t)}})}function Qn(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class Wn extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,Wn.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Yn.prototype.create)}}class Yn{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},s=`${this.service}/${t}`,r=this.errors[t],i=r?function(t,e){try{let n=0,s="";for(;n<t.length;){const r=t.indexOf("{$",n);if(-1===r){s+=t.substring(n);break}const i=t.indexOf("}",r+2);if(-1===i){s+=t.substring(n);break}const o=t.substring(r+2,i),a=e[o];s+=t.substring(n,r)+(null!=a?String(a):`<${o}?>`),n=i+1}return s}catch(e){return t}}(r,n):"Error",o=`${this.serviceName}: ${i} (${s}).`;return new Wn(s,o,n)}}function Xn(t,e){if(t===e)return!0;const n=Object.keys(t),s=Object.keys(e);for(const r of n){if(!s.includes(r))return!1;const n=t[r],i=e[r];if(Zn(n)&&Zn(i)){if(!Xn(n,i))return!1}else if(n!==i)return!1}for(const t of s)if(!n.includes(t))return!1;return!0}function Zn(t){return null!==t&&"object"==typeof t}function ts(t){const e=[];for(const[n,s]of Object.entries(t))Array.isArray(s)?s.forEach(t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(s));return e.length?"&"+e.join("&"):""}function es(t){const e={};return t.replace(/^\?/,"").split("&").forEach(t=>{if(t){const[n,s]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(s)}}),e}function ns(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class ss{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(()=>{t(this)}).catch(t=>{this.error(t)})}next(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,e,n){let s;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");s=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===s.next&&(s.next=rs),void 0===s.error&&(s.error=rs),void 0===s.complete&&(s.complete=rs);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch(t){}}),this.observers.push(s),r}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error}})}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function rs(){}function is(t,e=1e3,n=2){const s=e*Math.pow(n,t),r=Math.round(.5*s*(Math.random()-.5)*2);return Math.min(144e5,s+r)}function os(t){return t&&t._delegate?t._delegate:t}function as(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Bs(t){return(await fetch(t,{credentials:"include"})).ok}class cs{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}const ls="[DEFAULT]";class us{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new Vn;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){const e=this.normalizeInstanceIdentifier(t?.identifier),n=t?.optional??!1;if(!this.isInitialized(e)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:e})}catch(t){if(n)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}(t))try{this.getOrInitializeService({instanceIdentifier:ls})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=ls){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...t.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return null!=this.component}isInitialized(t=ls){return this.instances.has(t)}getOptions(t=ls){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.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 s=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(s)}return s}onInit(t,e){const n=this.normalizeInstanceIdentifier(e),s=this.onInitCallbacks.get(n)??new Set;s.add(t),this.onInitCallbacks.set(n,s);const r=this.instances.get(n);return r&&t(r,n),()=>{s.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const s of n)try{s(t,e)}catch{}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=t,s===ls?void 0:s),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch{}var s;return n||null}normalizeInstanceIdentifier(t=ls){return this.component?this.component.multipleInstances?t:ls:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class hs{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new us(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}var ds;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(ds||(ds={}));const ps={debug:ds.DEBUG,verbose:ds.VERBOSE,info:ds.INFO,warn:ds.WARN,error:ds.ERROR,silent:ds.SILENT},fs=ds.INFO,Cs={[ds.DEBUG]:"log",[ds.VERBOSE]:"log",[ds.INFO]:"info",[ds.WARN]:"warn",[ds.ERROR]:"error"},gs=(t,e,...n)=>{if(e<t.logLevel)return;(new Date).toISOString();if(!Cs[e])throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class ms{constructor(t){this.name=t,this._logLevel=fs,this._logHandler=gs,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in ds))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?ps[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,ds.DEBUG,...t),this._logHandler(this,ds.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,ds.VERBOSE,...t),this._logHandler(this,ds.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,ds.INFO,...t),this._logHandler(this,ds.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,ds.WARN,...t),this._logHandler(this,ds.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,ds.ERROR,...t),this._logHandler(this,ds.ERROR,...t)}}let ws,ys;const Es=new WeakMap,Ds=new WeakMap,_s=new WeakMap,bs=new WeakMap,vs=new WeakMap;let Is={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return Ds.get(t);if("objectStoreNames"===e)return t.objectStoreNames||_s.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return As(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function Ts(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(ys||(ys=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(Ss(this),e),As(Es.get(this))}:function(...e){return As(t.apply(Ss(this),e))}:function(e,...n){const s=t.call(Ss(this),e,...n);return _s.set(s,e.sort?e.sort():[e]),As(s)}}function Os(t){return"function"==typeof t?Ts(t):(t instanceof IDBTransaction&&function(t){if(Ds.has(t))return;const e=new Promise((e,n)=>{const s=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),s()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)});Ds.set(t,e)}(t),e=t,(ws||(ws=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(t,Is):t);var e}function As(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,n)=>{const s=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(As(t.result)),s()},i=()=>{n(t.error),s()};t.addEventListener("success",r),t.addEventListener("error",i)});return e.then(e=>{e instanceof IDBCursor&&Es.set(e,t)}).catch(()=>{}),vs.set(e,t),e}(t);if(bs.has(t))return bs.get(t);const e=Os(t);return e!==t&&(bs.set(t,e),vs.set(e,t)),e}const Ss=t=>vs.get(t);function Rs(t,e,{blocked:n,upgrade:s,blocking:r,terminated:i}={}){const o=indexedDB.open(t,e),a=As(o);return s&&o.addEventListener("upgradeneeded",t=>{s(As(o.result),t.oldVersion,t.newVersion,As(o.transaction),t)}),n&&o.addEventListener("blocked",t=>n(t.oldVersion,t.newVersion,t)),a.then(t=>{i&&t.addEventListener("close",()=>i()),r&&t.addEventListener("versionchange",t=>r(t.oldVersion,t.newVersion,t))}).catch(()=>{}),a}const Ns=["get","getKey","getAll","getAllKeys","count"],xs=["put","add","delete","clear"],ks=new Map;function Ls(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(ks.get(e))return ks.get(e);const n=e.replace(/FromIndex$/,""),s=e!==n,r=xs.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!r&&!Ns.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let o=i.store;return s&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),r&&i.done]))[0]};return ks.set(e,i),i}Is=(t=>({...t,get:(e,n,s)=>Ls(e,n)||t.get(e,n,s),has:(e,n)=>!!Ls(e,n)||t.has(e,n)}))(Is);class Fs{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(function(t){const e=t.getComponent();return"VERSION"===e?.type}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null}).filter(t=>t).join(" ")}}const Ps="@firebase/app",Ms="0.16.2",Gs=new ms("@firebase/app"),Hs="@firebase/app-compat",Us="@firebase/analytics-compat",Vs="@firebase/analytics",js="@firebase/app-check-compat",$s="@firebase/app-check",Js="@firebase/auth",qs="@firebase/auth-compat",zs="@firebase/database",Ks="@firebase/data-connect",Qs="@firebase/database-compat",Ws="@firebase/functions",Ys="@firebase/functions-compat",Xs="@firebase/installations",Zs="@firebase/installations-compat",tr="@firebase/messaging",er="@firebase/messaging-compat",nr="@firebase/performance",sr="@firebase/performance-compat",rr="@firebase/remote-config",ir="@firebase/remote-config-compat",or="@firebase/storage",ar="@firebase/storage-compat",Br="@firebase/firestore",cr="@firebase/ai",lr="@firebase/firestore-compat",ur="firebase",hr="[DEFAULT]",dr={[Ps]:"fire-core",[Hs]:"fire-core-compat",[Vs]:"fire-analytics",[Us]:"fire-analytics-compat",[$s]:"fire-app-check",[js]:"fire-app-check-compat",[Js]:"fire-auth",[qs]:"fire-auth-compat",[zs]:"fire-rtdb",[Ks]:"fire-data-connect",[Qs]:"fire-rtdb-compat",[Ws]:"fire-fn",[Ys]:"fire-fn-compat",[Xs]:"fire-iid",[Zs]:"fire-iid-compat",[tr]:"fire-fcm",[er]:"fire-fcm-compat",[nr]:"fire-perf",[sr]:"fire-perf-compat",[rr]:"fire-rc",[ir]:"fire-rc-compat",[or]:"fire-gcs",[ar]:"fire-gcs-compat",[Br]:"fire-fst",[lr]:"fire-fst-compat",[cr]:"fire-vertex","fire-js":"fire-js",[ur]:"fire-js-all"},pr=new Map,fr=new Map,Cr=new Map;function gr(t,e){try{t.container.addComponent(e)}catch(n){Gs.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function mr(t){const e=t.name;if(Cr.has(e))return Gs.debug(`There were multiple attempts to register component ${e}.`),!1;Cr.set(e,t);for(const e of pr.values())gr(e,t);for(const e of fr.values())gr(e,t);return!0}function wr(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function yr(t){return null!=t&&void 0!==t.settings}const Er=new Yn("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 {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.","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 Dr{constructor(t,e,n){this._isDeleted=!1,this._options={...t},this._config={...e},this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new cs("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}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(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Er.create("app-deleted",{appName:this._name})}}const _r="12.19.0";function br(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const s={name:hr,automaticDataCollectionEnabled:!0,...e},r=s.name;if("string"!=typeof r||!r)throw Er.create("bad-app-name",{appName:String(r)});if(n||(n=Hn()),!n)throw Er.create("no-options");const i=pr.get(r);if(i){if(Xn(n,i.options)){if(Xn(s,i.config))return i;throw Er.create("duplicate-app",{appName:r,mismatchedParam:"config",oldValue:JSON.stringify(i.config),newValue:JSON.stringify(s)})}throw Er.create("duplicate-app",{appName:r,mismatchedParam:"options",oldValue:JSON.stringify(i.options),newValue:JSON.stringify(n)})}const o=new hs(r);for(const t of Cr.values())o.addComponent(t);const a=new Dr(n,s,o);return pr.set(r,a),a}function vr(t=hr){const e=pr.get(t);if(!e&&t===hr&&Hn())return br();if(!e)throw Er.create("no-app",{appName:t});return e}function Ir(t,e,n){let s=dr[t]??t;n&&(s+=`-${n}`);const r=s.match(/\s|\//),i=e.match(/\s|\//);if(r||i){const t=[`Unable to register library "${s}" with version "${e}":`];return r&&t.push(`library name "${s}" contains illegal characters (whitespace or "/")`),r&&i&&t.push("and"),i&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void Gs.warn(t.join(" "))}mr(new cs(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}const Tr="firebase-heartbeat-store";let Or=null;function Ar(){return Or||(Or=Rs("firebase-heartbeat-database",1,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore(Tr)}catch(t){}}}).catch(t=>{throw Er.create("idb-open",{originalErrorMessage:t.message})})),Or}async function Sr(t,e){try{const n=(await Ar()).transaction(Tr,"readwrite"),s=n.objectStore(Tr);await s.put(e,Rr(t)),await n.done}catch(t){if(t instanceof Wn)Gs.warn(t.message);else{const e=Er.create("idb-set",{originalErrorMessage:t?.message});Gs.warn(e.message)}}}function Rr(t){return`${t.name}!${t.options.appId}`}class Nr{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new kr(e),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){try{const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=xr();if(null==this._heartbeatsCache?.heartbeats&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats))return;if(this._heartbeatsCache.lastSentHeartbeatDate===e||this._heartbeatsCache.heartbeats.some(t=>t.date===e))return;if(this._heartbeatsCache.heartbeats.push({date:e,agent:t}),this._heartbeatsCache.heartbeats.length>30){const t=function(t){if(0===t.length)return-1;let e=0,n=t[0].date;for(let s=1;s<t.length;s++)t[s].date<n&&(n=t[s].date,e=s);return e}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(t,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(t){Gs.warn(t)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats||0===this._heartbeatsCache.heartbeats.length)return"";const t=xr(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let s=t.slice();for(const r of t){const t=n.find(t=>t.agent===r.agent);if(t){if(t.dates.push(r.date),Lr(n)>e){t.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),Lr(n)>e){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),s=kn(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return Gs.warn(t),""}}}function xr(){return(new Date).toISOString().substring(0,10)}class kr{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!zn()&&Kn().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=(await Ar()).transaction(Tr),n=await e.objectStore(Tr).get(Rr(t));return await e.done,n}catch(t){if(t instanceof Wn)Gs.warn(t.message);else{const e=Er.create("idb-get",{originalErrorMessage:t?.message});Gs.warn(e.message)}}}(this.app);return t?.heartbeats?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const e=await this.read();return Sr(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??e.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){if(await this._canUseIndexedDBPromise){const e=await this.read();return Sr(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??e.lastSentHeartbeatDate,heartbeats:[...e.heartbeats,...t.heartbeats]})}}}function Lr(t){return kn(JSON.stringify({version:2,heartbeats:t})).length}var Fr;function Pr(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}Fr="",mr(new cs("platform-logger",t=>new Fs(t),"PRIVATE")),mr(new cs("heartbeat",t=>new Nr(t),"PRIVATE")),Ir(Ps,Ms,Fr),Ir(Ps,Ms,"esm2020"),Ir("fire-js","");const Mr=Pr,Gr=new Yn("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."}),Hr=new ms("@firebase/auth");function Ur(t,...e){Hr.logLevel<=ds.WARN&&Hr.warn(`Auth (${_r}): ${t}`,...e)}function Vr(t,...e){Hr.logLevel<=ds.ERROR&&Hr.error(`Auth (${_r}): ${t}`,...e)}function jr(t,...e){throw Kr(t,...e)}function $r(t,...e){return Kr(t,...e)}function Jr(t,e,n){const s={...Mr(),[e]:n};return new Yn("auth","Firebase",s).create(e,{appName:t.name})}function qr(t){return Jr(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function zr(t,e,n){if(!(e instanceof n))throw n.name!==e.constructor.name&&jr(t,"argument-error"),Jr(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Kr(t,...e){if("string"!=typeof t){const n=e[0],s=[...e.slice(1)];return s[0]&&(s[0].appName=t.name),t._errorFactory.create(n,...s)}return Gr.create(t,...e)}function Qr(t,e,...n){if(!t)throw Kr(e,...n)}function Wr(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Vr(e),new Error(e)}function Yr(t,e){t||Wr(e)}function Xr(){return"undefined"!=typeof self&&self.location?.href||""}function Zr(){return"undefined"!=typeof self&&self.location?.protocol||null}function ti(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Zr()&&"https:"!==Zr()&&!Jn()&&!("connection"in navigator)||navigator.onLine}class ei{constructor(t,e){this.shortDelay=t,this.longDelay=e,Yr(e>t,"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($n())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return ti()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function ni(t,e){Yr(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class si{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),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 Wr("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 Wr("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 Wr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const ri={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"},ii=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],oi=new ei(3e4,6e4);function ai(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Bi(t,e,n,s,r={}){return ci(t,r,async()=>{let r={},i={};s&&("GET"===e?i=s:r={body:JSON.stringify(s)});const o=ts({...i,key:t.config.apiKey}).slice(1),a=await t._getAdditionalHeaders();a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode);const B={method:e,headers:a,...r};return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(B.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&as(t.emulatorConfig.host)&&(B.credentials="include"),si.fetch()(await ui(t,t.config.apiHost,n,o),B)})}async function ci(t,e,n){t._canInitEmulator=!1;const s={...ri,...e};try{const e=new di(t),r=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await r.json();if("needConfirmation"in i)throw pi(t,"account-exists-with-different-credential",i);if(r.ok&&!("errorMessage"in i))return i;{const e=r.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw pi(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw pi(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw pi(t,"user-disabled",i);const a=s[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Jr(t,a,o);jr(t,a)}}catch(e){if(e instanceof Wn)throw e;jr(t,"network-request-failed",{message:String(e)})}}async function li(t,e,n,s,r={}){const i=await Bi(t,e,n,s,r);return"mfaPendingCredential"in i&&jr(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function ui(t,e,n,s){const r=`${e}${n}?${s}`,i=t,o=i.config.emulator?ni(t.config,r):`${t.config.apiScheme}://${r}`;if(ii.includes(n)&&(await i._persistenceManagerAvailable,"COOKIE"===i._getPersistenceType())){return i._getPersistence()._getFinalTarget(o).toString()}return o}function hi(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class di{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((t,e)=>{this.timer=setTimeout(()=>e($r(this.auth,"network-request-failed")),oi.get())})}}function pi(t,e,n){const s={appName:t.name};n.email&&(s.email=n.email),n.phoneNumber&&(s.phoneNumber=n.phoneNumber);const r=$r(t,e,s);return r.customData._tokenResponse=n,r}function fi(t){return void 0!==t&&void 0!==t.enterprise}class Ci{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return hi(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function gi(t,e){return Bi(t,"POST","/v1/accounts:lookup",e)}function mi(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function wi(t){return 1e3*Number(t)}function yi(t){const[e,n,s]=t.split(".");if(void 0===e||void 0===n||void 0===s)return Vr("JWT malformed, contained fewer than 3 sections"),null;try{const t=Ln(n);return t?JSON.parse(t):(Vr("Failed to decode base64 JWT payload"),null)}catch(t){return Vr("Caught error parsing JWT payload as JSON",t?.toString()),null}}function Ei(t){const e=yi(t);return Qr(e,"internal-error"),Qr(void 0!==e.exp,"internal-error"),Qr(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}async function Di(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof Wn&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class _i{constructor(t){this.user=t,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(t){if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout(async()=>{await this.iteration()},e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===t?.code&&this.schedule(!0))}this.schedule()}}class bi{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=mi(this.lastLoginAt),this.creationTime=mi(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function vi(t){const e=t.auth,n=await t.getIdToken(),s=await Di(t,gi(e,{idToken:n}));Qr(s?.users.length,e,"internal-error");const r=s.users[0];t._notifyReloadListener(r);const i=r.providerUserInfo?.length?Ii(r.providerUserInfo):[],o=function(t,e){const n=t.filter(t=>!e.some(e=>e.providerId===t.providerId));return[...n,...e]}(t.providerData,i),a=t.isAnonymous,B=!(t.email&&r.passwordHash||o?.length),c=!!a&&B,l={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:o,metadata:new bi(r.createdAt,r.lastLoginAt),isAnonymous:c};Object.assign(t,l)}function Ii(t){return t.map(({providerId:t,...e})=>({providerId:t,uid:e.rawId||"",displayName:e.displayName||null,email:e.email||null,phoneNumber:e.phoneNumber||null,photoURL:e.photoUrl||null}))}class Ti{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Qr(t.idToken,"internal-error"),Qr(void 0!==t.idToken,"internal-error"),Qr(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):Ei(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){Qr(0!==t.length,"internal-error");const e=Ei(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(Qr(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:s,expiresIn:r}=await async function(t,e){const n=await ci(t,{},async()=>{const n=ts({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:r}=t.config,i=await ui(t,s,"/v1/token",`key=${r}`),o=await t._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:o,body:n};return t.emulatorConfig&&as(t.emulatorConfig.host)&&(a.credentials="include"),si.fetch()(i,a)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,s,Number(r))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:s,expirationTime:r}=e,i=new Ti;return n&&(Qr("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),s&&(Qr("string"==typeof s,"internal-error",{appName:t}),i.accessToken=s),r&&(Qr("number"==typeof r,"internal-error",{appName:t}),i.expirationTime=r),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new Ti,this.toJSON())}_performRefresh(){return Wr("not implemented")}}function Oi(t,e){Qr("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Ai{constructor({uid:t,auth:e,stsTokenManager:n,...s}){this.providerId="firebase",this.proactiveRefresh=new _i(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=e,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new bi(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await Di(this,this.stsTokenManager.getToken(this.auth,t));return Qr(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=os(t),s=await n.getIdToken(e),r=yi(s);Qr(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const i="object"==typeof r.firebase?r.firebase:void 0,o=i?.sign_in_provider;return{claims:r,token:s,authTime:mi(wi(r.auth_time)),issuedAtTime:mi(wi(r.iat)),expirationTime:mi(wi(r.exp)),signInProvider:o||null,signInSecondFactor:i?.sign_in_second_factor||null}}(this,t)}reload(){return async function(t){const e=os(t);await vi(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Qr(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map(t=>({...t})),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new Ai({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return e.metadata._copy(this.metadata),e}_onReload(t){Qr(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await vi(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(yr(this.auth.app))return Promise.reject(qr(this.auth));const t=await this.getIdToken();return await Di(this,async function(t,e){return Bi(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),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(t=>({...t})),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(t,e){const n=e.displayName??void 0,s=e.email??void 0,r=e.phoneNumber??void 0,i=e.photoURL??void 0,o=e.tenantId??void 0,a=e._redirectEventId??void 0,B=e.createdAt??void 0,c=e.lastLoginAt??void 0,{uid:l,emailVerified:u,isAnonymous:h,providerData:d,stsTokenManager:p}=e;Qr(l&&p,t,"internal-error");const f=Ti.fromJSON(this.name,p);Qr("string"==typeof l,t,"internal-error"),Oi(n,t.name),Oi(s,t.name),Qr("boolean"==typeof u,t,"internal-error"),Qr("boolean"==typeof h,t,"internal-error"),Oi(r,t.name),Oi(i,t.name),Oi(o,t.name),Oi(a,t.name),Oi(B,t.name),Oi(c,t.name);const C=new Ai({uid:l,auth:t,email:s,emailVerified:u,displayName:n,isAnonymous:h,photoURL:i,phoneNumber:r,tenantId:o,stsTokenManager:f,createdAt:B,lastLoginAt:c});return d&&Array.isArray(d)&&(C.providerData=d.map(t=>({...t}))),a&&(C._redirectEventId=a),C}static async _fromIdTokenResponse(t,e,n=!1){const s=new Ti;s.updateFromServerResponse(e);const r=new Ai({uid:e.localId,auth:t,stsTokenManager:s,isAnonymous:n});return await vi(r),r}static async _fromGetAccountInfoResponse(t,e,n){const s=e.users[0];Qr(void 0!==s.localId,"internal-error");const r=void 0!==s.providerUserInfo?Ii(s.providerUserInfo):[],i=!(s.email&&s.passwordHash||r?.length),o=new Ti;o.updateFromIdToken(n);const a=new Ai({uid:s.localId,auth:t,stsTokenManager:o,isAnonymous:i}),B={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:r,metadata:new bi(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash||r?.length)};return Object.assign(a,B),a}}const Si=new Map;function Ri(t){Yr(t instanceof Function,"Expected a class definition");let e=Si.get(t);return e?(Yr(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Si.set(t,e),e)}class Ni{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}Ni.type="NONE";const xi=Ni;function ki(t,e,n){return`firebase:${t}:${e}:${n}`}class Li{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:s,name:r}=this.auth;this.fullUserKey=ki(this.userKey,s.apiKey,r),this.fullPersistenceKey=ki("persistence",s.apiKey,r),this.boundEventHandler=e._onStorageEvent.bind(e);try{this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}catch{}}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);if(!t)return null;if("string"==typeof t){const e=await gi(this.auth,{idToken:t}).catch(()=>{});return e?Ai._fromGetAccountInfoResponse(this.auth,e,t):null}return Ai._fromJSON(this.auth,t)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){try{this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}catch{}}static async create(t,e,n="authUser"){if(!e.length)return new Li(Ri(xi),t,n);const s=(await Promise.all(e.map(async t=>{try{if(await t._isAvailable())return t}catch{return}}))).filter(t=>t);let r=s[0]||Ri(xi);const i=ki(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){let s;if("string"==typeof e){const n=await gi(t,{idToken:e}).catch(()=>{});if(!n)break;s=await Ai._fromGetAccountInfoResponse(t,n,e)}else s=Ai._fromJSON(t,e);n!==r&&(o=s),r=n;break}}catch{}const a=s.filter(t=>t._shouldAllowMigration);return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(i,o.toJSON()),await Promise.all(e.map(async t=>{if(t!==r)try{await t._remove(i)}catch{}})),new Li(r,t,n)):new Li(r,t,n)}}function Fi(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Hi(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Pi(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Vi(e))return"Blackberry";if(ji(e))return"Webos";if(Mi(e))return"Safari";if((e.includes("chrome/")||Gi(e))&&!e.includes("edge/"))return"Chrome";if(Ui(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===n?.length)return n[1]}return"Other"}function Pi(t=$n()){return/firefox\//i.test(t)}function Mi(t=$n()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Gi(t=$n()){return/crios\//i.test(t)}function Hi(t=$n()){return/iemobile/i.test(t)}function Ui(t=$n()){return/android/i.test(t)}function Vi(t=$n()){return/blackberry/i.test(t)}function ji(t=$n()){return/webos/i.test(t)}function $i(t=$n()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Ji(){return function(){const t=$n();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function qi(t=$n()){return $i(t)||Ui(t)||ji(t)||Vi(t)||/windows phone/i.test(t)||Hi(t)}function zi(t,e=[]){let n;switch(t){case"Browser":n=Fi($n());break;case"Worker":n=`${Fi($n())}-${t}`;break;default:n=t}const s=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${_r}/${s}`}class Ki{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise((n,s)=>{try{n(t(e))}catch(t){s(t)}});n.onAbort=e,this.queue.push(n);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}}class Qi{constructor(t){const e=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=e.minPasswordLength??6,e.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=e.maxPasswordLength),void 0!==e.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=e.containsLowercaseCharacter),void 0!==e.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=e.containsUppercaseCharacter),void 0!==e.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=e.containsNumericCharacter),void 0!==e.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=e.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=t.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=t.forceUpgradeOnSignin??!1,this.schemaVersion=t.schemaVersion}validatePassword(t){const e={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,e),this.validatePasswordCharacterOptions(t,e),e.isValid&&(e.isValid=e.meetsMinPasswordLength??!0),e.isValid&&(e.isValid=e.meetsMaxPasswordLength??!0),e.isValid&&(e.isValid=e.containsLowercaseLetter??!0),e.isValid&&(e.isValid=e.containsUppercaseLetter??!0),e.isValid&&(e.isValid=e.containsNumericCharacter??!0),e.isValid&&(e.isValid=e.containsNonAlphanumericCharacter??!0),e}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),s&&(e.meetsMaxPasswordLength=t.length<=s)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let s=0;s<t.length;s++)n=t.charAt(s),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,s,r){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=r))}}class Wi{constructor(t,e,n,s){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Xi(this),this.idTokenSubscription=new Xi(this),this.beforeStateQueue=new Ki(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=Gr,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=t.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(t=>this._resolvePersistenceManagerAvailable=t)}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Ri(e)),this._initializationPromise=this.queue(async()=>{if(!this._deleted){try{this.persistenceManager=await Li.create(this,t)}catch(t){Ur(`Failed to initialize persistence: ${t}`),this.persistenceManager=await Li.create(this,[])}finally{this._resolvePersistenceManagerAvailable?.()}if(!this._deleted){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}try{await this.initializeCurrentUser(e)}catch(t){Ur(`Failed to initialize current user: ${t}`),await this.directlySetCurrentUser(null).catch(()=>{})}this.lastNotifiedUid=this.currentUser?.uid||null,this._deleted||(this._isInitialized=!0)}}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await gi(this,{idToken:t}),n=await Ai._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){if(yr(this.app)){const t=this.app.settings.authIdToken;return t?new Promise(e=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(t).then(e,e))}):this.directlySetCurrentUser(null)}const e=await this.assertedPersistence.getCurrentUser();let n=e,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const e=this.redirectUser?._redirectEventId,r=n?._redirectEventId,i=await this.tryRedirectSignIn(t);e&&e!==r||!i?.user||(n=i.user,s=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(n)}catch(t){n=e,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(t))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return Qr(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await vi(t)}catch(t){if("auth/network-request-failed"!==t?.code)return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(yr(this.app))return Promise.reject(qr(this));const e=t?os(t):null;return e&&Qr(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&Qr(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue(async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()})}async signOut(){return yr(this.app)?Promise.reject(qr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return yr(this.app)?Promise.reject(qr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Ri(t))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return Bi(t,"GET","/v2/passwordPolicy",ai(t,e))}(this),e=new Qi(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new Yn("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged(()=>{n(),t()},e)}})}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Bi(t,"POST","/v2/accounts:revokeToken",ai(t,e))}(this,e)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&Ri(t)||this._popupRedirectResolver;Qr(e,this,"argument-error"),this.redirectPersistenceManager=await Li.create(this,[Ri(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===t?this._currentUser:this.redirectUser?._redirectEventId===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(t))}_notifyListenersIfCurrent(t){t===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 t=this.currentUser?.uid??null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,s){if(this._deleted)return()=>{};const r="function"==typeof e?e:e.next.bind(e);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Qr(o,this,"internal-error"),o.then(()=>{i||r(this.currentUser)}).catch(t=>{if(!i)if("function"!=typeof e&&e.error)e.error(t);else{if(!n)throw t;n(t)}}),"function"==typeof e){const r=t.addObserver(e,n,s);return()=>{i=!0,r()}}{const n=t.addObserver(e);return()=>{i=!0,n()}}}async directlySetCurrentUser(t){if(this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,this.persistenceManager)try{t?await this.persistenceManager.setCurrentUser(t):await this.persistenceManager.removeCurrentUser()}catch(t){const e=Jr(this,"internal-error",`An internal AuthError has occurred: ${t?.message||String(t)}`);throw e.customData={originalError:t},e}}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Qr(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=zi(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const e=await(this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader());e&&(t["X-Firebase-Client"]=e);const n=await this._getAppCheckToken();return n&&(t["X-Firebase-AppCheck"]=n),t}async _getAppCheckToken(){if(yr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken());return t?.error&&Ur(`Error while retrieving App Check token: ${t.error}`),t?.token}}function Yi(t){return os(t)}class Xi{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new ss(t,e);return n.subscribe.bind(n)}(t=>this.observer=t)}get next(){return Qr(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Zi={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function to(t){return Zi.loadJS(t)}class eo{constructor(){this.enterprise=new no}ready(t){t()}execute(t,e){return Promise.resolve("token")}render(t,e){return""}}class no{ready(t){t()}execute(t,e){return Promise.resolve("token")}render(t,e){return""}}const so="NO_RECAPTCHA",ro="onFirebaseAuthREInstanceReady";class io{constructor(t){this.type="recaptcha-enterprise",this.auth=Yi(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise(async(e,n)=>{(async function(t,e){return Bi(t,"GET","/v2/recaptchaConfig",ai(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(s=>{if(void 0!==s.recaptchaKey){const n=new Ci(s);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))}).catch(t=>{n(t)})})}function s(e,n,s){const r=window.grecaptcha;fi(r)?r.enterprise.ready(()=>{r.enterprise.execute(e,{action:t}).then(t=>{n(t)}).catch(()=>{n(so)})}):s(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new eo).execute("siteKey",{action:"verify"})}return new Promise((t,r)=>{n(this.auth).then(async n=>{if(!e&&fi(window.grecaptcha)&&io.scriptInjectionDeferred)await io.scriptInjectionDeferred.promise,s(n,t,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let e=Zi.recaptchaEnterpriseScript;0!==e.length&&(e+=n+`&onload=${ro}`),io.scriptInjectionDeferred=new Vn,window[ro]=()=>{io.scriptInjectionDeferred?.resolve()},to(e).then(()=>io.scriptInjectionDeferred?.promise).then(()=>{s(n,t,r)}).catch(t=>{r(t)})}}).catch(t=>{r(t)})})}}async function oo(t,e,n,s=!1,r=!1){const i=new io(t);let o;if(r)o=so;else try{o=await i.verify(n)}catch(t){o=await i.verify(n,!0)}const a={...e};if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in a){const t=a.phoneEnrollmentInfo.phoneNumber,e=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:t,recaptchaToken:e,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const t=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:t,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return s?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 ao(t,e,n,s,r){if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await oo(t,e,n,"getOobCode"===n);return s(t,r)}return s(t,e).catch(async r=>{if("auth/missing-recaptcha-token"===r.code){const r=await oo(t,e,n,"getOobCode"===n);return s(t,r)}return Promise.reject(r)})}function Bo(t,e,n){const s=Yi(t);Qr(/^https?:\/\//.test(e),s,"invalid-emulator-scheme");const r=co(e),{host:i,port:o}=function(t){const e=co(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const s=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(s);if(r){const t=r[1];return{host:t,port:lo(s.substr(t.length+1))}}{const[t,e]=s.split(":");return{host:t,port:lo(e)}}}(e),a=null===o?"":`:${o}`,B={url:`${r}//${i}${a}/`},c=Object.freeze({host:i,port:o,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!s._canInitEmulator)return Qr(s.config.emulator&&s.emulatorConfig,s,"emulator-config-failed"),void Qr(Xn(B,s.config.emulator)&&Xn(c,s.emulatorConfig),s,"emulator-config-failed");s.config.emulator=B,s.emulatorConfig=c,s.settings.appVerificationDisabledForTesting=!0,as(i)?Bs(`${r}//${i}${a}`):function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&console.info;"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}()}function co(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function lo(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}io.scriptInjectionDeferred=null;class uo{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Wr("not implemented")}_getIdTokenResponse(t){return Wr("not implemented")}_linkToIdToken(t,e){return Wr("not implemented")}_getReauthenticationResolver(t){return Wr("not implemented")}}async function ho(t,e){return Bi(t,"POST","/v1/accounts:signUp",e)}async function po(t,e){return li(t,"POST","/v1/accounts:signInWithPassword",ai(t,e))}async function fo(t,e){return Bi(t,"POST","/v1/accounts:sendOobCode",ai(t,e))}async function Co(t,e){return fo(t,e)}class go extends uo{constructor(t,e,n,s=null){super("password",n),this._email=t,this._password=e,this._tenantId=s}static _fromEmailAndPassword(t,e){return new go(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new go(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if(e?.email&&e?.password){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return ao(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",po);case"emailLink":return async function(t,e){return li(t,"POST","/v1/accounts:signInWithEmailLink",ai(t,e))}(t,{email:this._email,oobCode:this._password});default:jr(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return ao(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ho);case"emailLink":return async function(t,e){return li(t,"POST","/v1/accounts:signInWithEmailLink",ai(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:jr(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}async function mo(t,e){return li(t,"POST","/v1/accounts:signInWithIdp",ai(t,e))}class wo extends uo{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new wo(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):jr("argument-error"),e}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(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:s,...r}=e;if(!n||!s)return null;const i=new wo(n,s);return i.idToken=r.idToken||void 0,i.accessToken=r.accessToken||void 0,i.secret=r.secret,i.nonce=r.nonce,i.pendingToken=r.pendingToken||null,i}_getIdTokenResponse(t){return mo(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,mo(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,mo(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=ts(e)}return t}}class yo{constructor(t){const e=es(ns(t)),n=e.apiKey??null,s=e.oobCode??null,r=function(t){switch(t){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}}(e.mode??null);Qr(n&&s&&r,"argument-error"),this.apiKey=n,this.operation=r,this.code=s,this.continueUrl=e.continueUrl??null,this.languageCode=e.lang??null,this.tenantId=e.tenantId??null}static parseLink(t){const e=function(t){const e=es(ns(t)).link,n=e?es(ns(e)).deep_link_id:null,s=es(ns(t)).deep_link_id;return(s?es(ns(s)).link:null)||s||n||e||t}(t);try{return new yo(e)}catch{return null}}}class Eo{constructor(){this.providerId=Eo.PROVIDER_ID}static credential(t,e){return go._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=yo.parseLink(e);return Qr(n,"argument-error"),go._fromEmailAndCode(t,n.code,n.tenantId)}}Eo.PROVIDER_ID="password",Eo.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Eo.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class Do{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}class _o extends Do{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}class bo extends _o{constructor(){super("facebook.com")}static credential(t){return wo._fromParams({providerId:bo.PROVIDER_ID,signInMethod:bo.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return bo.credentialFromTaggedObject(t)}static credentialFromError(t){return bo.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return bo.credential(t.oauthAccessToken)}catch{return null}}}bo.FACEBOOK_SIGN_IN_METHOD="facebook.com",bo.PROVIDER_ID="facebook.com";class vo extends _o{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return wo._fromParams({providerId:vo.PROVIDER_ID,signInMethod:vo.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return vo.credentialFromTaggedObject(t)}static credentialFromError(t){return vo.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return vo.credential(e,n)}catch{return null}}}vo.GOOGLE_SIGN_IN_METHOD="google.com",vo.PROVIDER_ID="google.com";class Io extends _o{constructor(){super("github.com")}static credential(t){return wo._fromParams({providerId:Io.PROVIDER_ID,signInMethod:Io.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Io.credentialFromTaggedObject(t)}static credentialFromError(t){return Io.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Io.credential(t.oauthAccessToken)}catch{return null}}}Io.GITHUB_SIGN_IN_METHOD="github.com",Io.PROVIDER_ID="github.com";class To extends _o{constructor(){super("twitter.com")}static credential(t,e){return wo._fromParams({providerId:To.PROVIDER_ID,signInMethod:To.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return To.credentialFromTaggedObject(t)}static credentialFromError(t){return To.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return To.credential(e,n)}catch{return null}}}async function Oo(t,e){return li(t,"POST","/v1/accounts:signUp",ai(t,e))}To.TWITTER_SIGN_IN_METHOD="twitter.com",To.PROVIDER_ID="twitter.com";class Ao{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,s=!1){const r=await Ai._fromIdTokenResponse(t,n,s),i=So(n);return new Ao({user:r,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const s=So(n);return new Ao({user:t,providerId:s,_tokenResponse:n,operationType:e})}}function So(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class Ro extends Wn{constructor(t,e,n,s){super(e.code,e.message),this.operationType=n,this.user=s,Object.setPrototypeOf(this,Ro.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,s){return new Ro(t,e,n,s)}}function No(t,e,n,s){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw Ro._fromErrorAndOperation(t,n,e,s);throw n})}async function xo(t,e,n=!1){const{auth:s}=t;if(yr(s.app))return Promise.reject(qr(s));const r="reauthenticate";try{const i=await Di(t,No(s,r,e,t),n);Qr(i.idToken,s,"internal-error");const o=yi(i.idToken);Qr(o,s,"internal-error");const{sub:a}=o;return Qr(t.uid===a,s,"user-mismatch"),Ao._forOperation(t,r,i)}catch(t){throw"auth/user-not-found"===t?.code&&jr(s,"user-mismatch"),t}}async function ko(t,e,n=!1){if(yr(t.app))return Promise.reject(qr(t));const s="signIn",r=await No(t,s,e),i=await Ao._fromIdTokenResponse(t,s,r);return n||await t._updateCurrentUser(i.user),i}function Lo(t,e,n){Qr(n.url?.length>0,t,"invalid-continue-uri"),Qr(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),Qr(void 0===n.linkDomain||n.linkDomain.length>0,t,"invalid-hosting-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.linkDomain=n.linkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Qr(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Qr(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}async function Fo(t){const e=Yi(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function Po(t,e,n){const s=Yi(t),r={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};await ao(s,r,"getOobCode",Co)}function Mo(t,e,n){return yr(t.app)?Promise.reject(qr(t)):async function(t,e){return ko(Yi(t),e)}(os(t),Eo.credential(e,n)).catch(async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&Fo(t),e})}async function Go(t,e){const n=os(t),s={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()};e&&Lo(n.auth,s,e);const{email:r}=await async function(t,e){return fo(t,e)}(n.auth,s);r!==t.email&&await t.reload()}async function Ho(t,e,n){const s=os(t),r={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await t.getIdToken(),newEmail:e};n&&Lo(s.auth,r,n);const{email:i}=await async function(t,e){return fo(t,e)}(s.auth,r);i!==t.email&&await t.reload()}async function Uo(t,e){const{displayName:n,photoURL:s}=e;if(void 0===n&&void 0===s)return;const r=os(t),i={idToken:await r.getIdToken(),displayName:n,photoUrl:s,returnSecureToken:!0},o=await Di(r,async function(t,e){return Bi(t,"POST","/v1/accounts:update",e)}(r.auth,i));r.displayName=o.displayName||null,r.photoURL=o.photoUrl||null;const a=r.providerData.find(({providerId:t})=>"password"===t);a&&(a.displayName=r.displayName,a.photoURL=r.photoURL),await r._updateTokensIfNecessary(o)}function Vo(t,e){return async function(t,e,n){const{auth:s}=t,r=await t.getIdToken(),i={idToken:r,returnSecureToken:!0};n&&(i.password=n);const o=await Di(t,async function(t,e){return Bi(t,"POST","/v1/accounts:update",e)}(s,i));await t._updateTokensIfNecessary(o,!0)}(os(t),0,e)}function jo(t,e,n,s){return os(t).onAuthStateChanged(e,n,s)}const $o="__sak";class Jo{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem($o,"1"),this.storage.removeItem($o),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}class qo extends Jo{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=qi(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),s=this.localCache[e];n!==s&&t(e,s,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys((t,e,n)=>{this.notifyListeners(t,n)});const n=t.key;e?this.detachListener():this.stopPolling();const s=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},r=this.storage.getItem(n);Ji()&&r!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,10):s()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,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(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}qo.type="LOCAL";const zo=qo;class Ko extends Jo{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,e){}_removeListener(t,e){}}Ko.type="SESSION";const Qo=Ko;class Wo{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find(e=>e.isListeningto(t));if(e)return e;const n=new Wo(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:s,data:r}=e.data,i=this.handlersMap[s];if(!i?.size)return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:s});const o=Array.from(i).map(async t=>t(e.origin,r)),a=await function(t){return Promise.all(t.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}}))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:s,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function Yo(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}Wo.receivers=[];class Xo{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let r,i;return new Promise((o,a)=>{const B=Yo("",20);s.port1.start();const c=setTimeout(()=>{a(new Error("unsupported_event"))},n);i={messageChannel:s,onMessage(t){const e=t;if(e.data.eventId===B)switch(e.data.status){case"ack":clearTimeout(c),r=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(c),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:B,data:e},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}function Zo(){return window}function ta(){return void 0!==Zo().WorkerGlobalScope&&"function"==typeof Zo().importScripts}const ea="firebaseLocalStorageDb",na="firebaseLocalStorage",sa="fbase_key";class ra{constructor(t){this.request=t}toPromise(){return new Promise((t,e)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{e(this.request.error)})})}}function ia(t,e){return t.transaction([na],e?"readwrite":"readonly").objectStore(na)}function oa(){const t=indexedDB.open(ea,1);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const e=t.result;try{e.createObjectStore(na,{keyPath:sa})}catch(t){n(t)}}),t.addEventListener("success",async()=>{const n=t.result;n.objectStoreNames.contains(na)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(ea);return new ra(t).toPromise()}(),e(await oa()))})})}async function aa(t,e,n){const s=ia(t,!0).put({[sa]:e,value:n});return new ra(s).toPromise()}function Ba(t,e){const n=ia(t,!0).delete(e);return new ra(n).toPromise()}class ca{registerLifecycleListeners(){"undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow))}unregisterLifecycleListeners(){"undefined"!=typeof window&&"function"==typeof window.removeEventListener&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow))}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isClosing=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isClosing=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(t=>t.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isClosing&&(this.isClosing=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise||(this.dbPromise=oa(),this.dbPromise.catch(()=>{this.dbPromise=null})),this.dbPromise}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;if(this.dbPromise){const t=this.dbPromise;this.dbPromise=null;try{(await t).close()}catch{}}}}async initializeServiceWorkerMessaging(){return ta()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Wo._getInstance(ta()?self:null),this.receiver._subscribe("keyChanged",async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)})),this.receiver._subscribe("ping",async(t,e)=>["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 Xo(this.activeServiceWorker);const t=await this.sender._send("ping",{},800);t&&t[0]?.fulfilled&&t[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&(navigator?.serviceWorker?.controller||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return!!indexedDB&&(await this._withRetries(async t=>{await aa(t,$o,"1"),await Ba(t,$o)}),!0)}catch{}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite(async()=>(await this._withRetries(n=>aa(n,t,e)),this.localCache[t]=e,this.notifyServiceWorker(t)))}async _get(t){const e=await this._withRetries(e=>async function(t,e){const n=ia(t,!1).get(e),s=await new ra(n).toPromise();return void 0===s?null:s.value}(e,t));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(e=>Ba(e,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){if(this.isClosing)return[];try{const t=await this._withRetries(t=>{const e=ia(t,!1).getAll();return new ra(e).toPromise()});if(this.isClosing)return[];if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:s,value:r}of t)n.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(r)&&(this.notifyListeners(s,r),e.push(s));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}catch(t){return this.isClosing||Ur(`Firebase Auth cross-tab polling failed with error: ${t}`),[]}}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.startPolling(),this.registerLifecycleListeners()),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.stopPolling(),this.unregisterLifecycleListeners())}}ca.type="LOCAL";const la=ca;function ua(t,e){return e?Ri(e):(Qr(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}new ei(3e4,6e4);class ha extends uo{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return mo(t,this._buildIdpRequest())}_linkToIdToken(t,e){return mo(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return mo(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={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 t&&(e.idToken=t),e}}function da(t){return ko(t.auth,new ha(t),t.bypassAuthState)}function pa(t){const{auth:e,user:n}=t;return Qr(n,e,"internal-error"),xo(n,new ha(t),t.bypassAuthState)}async function fa(t){const{auth:e,user:n}=t;return Qr(n,e,"internal-error"),async function(t,e,n=!1){const s=await Di(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Ao._forOperation(t,"link",s)}(n,new ha(t),t.bypassAuthState)}class Ca{constructor(t,e,n,s,r=!1){this.auth=t,this.resolver=n,this.user=s,this.bypassAuthState=r,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise(async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:s,tenantId:r,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:r||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return da;case"linkViaPopup":case"linkViaRedirect":return fa;case"reauthViaPopup":case"reauthViaRedirect":return pa;default:jr(this.auth,"internal-error")}}resolve(t){Yr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Yr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const ga=new ei(2e3,1e4);class ma extends Ca{constructor(t,e,n,s,r){super(t,e,s,r),this.provider=n,this.authWindow=null,this.pollId=null,ma.currentPopupAction&&ma.currentPopupAction.cancel(),ma.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Qr(t,this.auth,"internal-error"),t}async onExecution(){Yr(1===this.filter.length,"Popup operations only handle one event");const t=Yo();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject($r(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject($r(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ma.currentPopupAction=null}pollUserCancellation(){const t=()=>{this.authWindow?.window?.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject($r(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(t,ga.get())};t()}}ma.currentPopupAction=null;const wa=new Map;class ya extends Ca{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=wa.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=_a(e),s=Da(t);if(!await s._isAvailable())return!1;const r="true"===await s._get(n);return await s._remove(n),r}(this.resolver,this.auth),n=e?await super.execute():null;t=()=>Promise.resolve(n)}catch(e){t=()=>Promise.reject(e)}wa.set(this.auth._key(),t)}return this.bypassAuthState||wa.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Ea(t,e){wa.set(t._key(),e)}function Da(t){return Ri(t._redirectPersistence)}function _a(t){return ki("pendingRedirect",t.config.apiKey,t.name)}function ba(t,e,n){return async function(t,e,n){if(yr(t.app))return Promise.reject(qr(t));const s=Yi(t);zr(t,e,Do),await s._initializationPromise;const r=ua(s,n);return await async function(t,e){return Da(t)._set(_a(e),"true")}(r,s),r._openRedirect(s,e,"signInViaRedirect")}(t,e,n)}async function va(t,e,n=!1){if(yr(t.app))return Promise.reject(qr(t));const s=Yi(t),r=ua(s,e),i=new ya(s,r,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await s._persistUserIfCurrent(o.user),await s._setRedirectUser(null,e)),o}class Ia{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Oa(t);default:return!1}}(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){if(t.error&&!Oa(t)){const n=t.error.code?.split("auth/")[1]||"internal-error";e.onError($r(this.auth,n))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ta(t))}saveEventToCache(t){this.cachedEventUids.add(Ta(t)),this.lastProcessedEventTime=Date.now()}}function Ta(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(t=>t).join("-")}function Oa({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===e?.code}const Aa=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Sa=/^https?/;async function Ra(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Bi(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Na(t))return}catch{}jr(t,"unauthorized-domain")}function Na(t){const e=Xr(),{protocol:n,hostname:s}=new URL(e);if(t.startsWith("chrome-extension://")){const r=new URL(t);return""===r.hostname&&""===s?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===s}if(!Sa.test(n))return!1;if(Aa.test(t))return s===t;const r=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(s)}const xa=new ei(3e4,6e4);function ka(){const t=Zo().___jsl;if(t?.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function La(t){return new Promise((e,n)=>{function s(){ka(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{ka(),n($r(t,"network-request-failed"))},timeout:xa.get()})}if(Zo().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else{if(!Zo().gapi?.load){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Zo()[e]=()=>{gapi.load?s():n($r(t,"network-request-failed"))},to(`${Zi.gapiScript}?onload=${e}`).catch(t=>n(t))}s()}}).catch(t=>{throw Fa=null,t})}let Fa=null;const Pa=new ei(5e3,15e3),Ma={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ga=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Ha(t){const e=t.config;Qr(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?ni(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,s={apiKey:e.apiKey,appName:t.name,v:_r},r=Ga.get(t.config.apiHost);r&&(s.eid=r);const i=t._getFrameworks();return i.length&&(s.fw=i.join(",")),`${n}?${ts(s).slice(1)}`}async function Ua(t){const e=await function(t){return Fa=Fa||La(t),Fa}(t),n=Zo().gapi;return Qr(n,t,"internal-error"),e.open({where:document.body,url:Ha(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Ma,dontclear:!0},e=>new Promise(async(n,s)=>{await e.restyle({setHideOnLeave:!1});const r=$r(t,"network-request-failed"),i=Zo().setTimeout(()=>{s(r)},Pa.get());function o(){Zo().clearTimeout(i),n(e)}e.ping(o).then(o,()=>{s(r)})}))}const Va={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class ja{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function $a(t,e,n,s=500,r=600){const i=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-s)/2,0).toString();let a="";const B={...Va,width:s.toString(),height:r.toString(),top:i,left:o},c=$n().toLowerCase();n&&(a=Gi(c)?"_blank":n),Pi(c)&&(e=e||"http://localhost",B.scrollbars="yes");const l=Object.entries(B).reduce((t,[e,n])=>`${t}${e}=${n},`,"");if(function(t=$n()){return $i(t)&&!!window.navigator?.standalone}(c)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const s=document.createEvent("MouseEvent");s.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(s)}(e||"",a),new ja(null);const u=window.open(e||"",a,l);Qr(u,t,"popup-blocked");try{u.focus()}catch(t){}return new ja(u)}const Ja="__/auth/handler",qa="emulator/auth/handler",za=encodeURIComponent("fac");async function Ka(t,e,n,s,r,i){Qr(t.config.authDomain,t,"auth-domain-config-required"),Qr(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:s,v:_r,eventId:r};if(e instanceof Do){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries({}))o[t]=e}if(e instanceof _o){const t=e.getScopes().filter(t=>""!==t);t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const B=await t._getAppCheckToken(),c=B?`#${za}=${encodeURIComponent(B)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Ja}`;return ni(t,qa)}(t)}?${ts(a).slice(1)}${c}`}const Qa="webStorageSupport";const Wa=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Qo,this._completeRedirectFn=va,this._overrideRedirectResult=Ea}async _openPopup(t,e,n,s){Yr(this.eventManagers[t._key()]?.manager,"_initialize() not called before _openPopup()");return $a(t,await Ka(t,e,n,Xr(),s),Yo())}async _openRedirect(t,e,n,s){await this._originValidation(t);return function(t){Zo().location.href=t}(await Ka(t,e,n,Xr(),s)),new Promise(()=>{})}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(Yr(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch(()=>{delete this.eventManagers[e]}),n}async initAndGetManager(t){const e=await Ua(t),n=new Ia(t);return e.register("authEvent",e=>{Qr(e?.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(Qa,{type:Qa},n=>{const s=n?.[0]?.[Qa];void 0!==s&&e(!!s),jr(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Ra(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return qi()||Mi()||$i()}};var Ya="@firebase/auth",Xa="1.13.6";class Za{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged(e=>{t(e?.stsTokenManager.accessToken||null)});this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){Qr(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const tB=Un("authIdTokenMaxAge")||300;let eB=null;function nB(t=vr()){const e=wr(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=wr(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(Xn(n.getOptions(),e??{}))return t;jr(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:Wa,persistence:[la,zo,Qo]}),s=Un("authTokenSyncURL");if(s&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(s,location.origin);if(location.origin===t.origin){const e=(r=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>tB)return;const s=e?.token;eB!==s&&(eB=s,await fetch(r,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))});!function(t,e,n){os(t).beforeAuthStateChanged(e,n)}(n,e,()=>e(n.currentUser)),function(t,e,n,s){os(t).onIdTokenChanged(e,n,s)}(n,t=>e(t))}}var r;const i=Mn("auth");return i&&Bo(n,`http://${i}`),n}var sB;!function(t){Zi=t}({loadJS:t=>new Promise((e,n)=>{const s=document.createElement("script");s.setAttribute("src",t),s.onload=e,s.onerror=t=>{const e=$r("internal-error");e.customData=t,n(e)},s.type="text/javascript",s.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(s)}),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="}),sB="Browser",mr(new cs("auth",(t,{options:e})=>{const n=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),r=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Qr(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:sB,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:zi(sB)},B=new Wi(n,s,r,a);return function(t,e){const n=e?.persistence||[],s=(Array.isArray(n)?n:[n]).map(Ri);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(s,e?.popupRedirectResolver)}(B,e),B},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,e,n)=>{t.getProvider("auth-internal").initialize()})),mr(new cs("auth-internal",t=>(t=>new Za(t))(Yi(t.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),Ir(Ya,Xa,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(sB)),Ir(Ya,Xa,"esm2020");Ir("firebase","12.19.0","app");var rB,iB="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var t;function e(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}function n(t,e,n){n||(n=0);const s=Array(16);if("string"==typeof e)for(var r=0;r<16;++r)s[r]=e.charCodeAt(n++)|e.charCodeAt(n++)<<8|e.charCodeAt(n++)<<16|e.charCodeAt(n++)<<24;else for(r=0;r<16;++r)s[r]=e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24;e=t.g[0],n=t.g[1],r=t.g[2];let i,o=t.g[3];i=e+(o^n&(r^o))+s[0]+3614090360&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[1]+3905402710&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[2]+606105819&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[3]+3250441966&4294967295,i=e+(o^(n=r+(i<<22&4294967295|i>>>10))&(r^o))+s[4]+4118548399&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[5]+1200080426&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[6]+2821735955&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[7]+4249261313&4294967295,i=e+(o^(n=r+(i<<22&4294967295|i>>>10))&(r^o))+s[8]+1770035416&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[9]+2336552879&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[10]+4294925233&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[11]+2304563134&4294967295,i=e+(o^(n=r+(i<<22&4294967295|i>>>10))&(r^o))+s[12]+1804603682&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[13]+4254626195&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[14]+2792965006&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[15]+1236535329&4294967295,i=e+(r^o&((n=r+(i<<22&4294967295|i>>>10))^r))+s[1]+4129170786&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[6]+3225465664&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[11]+643717713&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[0]+3921069994&4294967295,i=e+(r^o&((n=r+(i<<20&4294967295|i>>>12))^r))+s[5]+3593408605&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[10]+38016083&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[15]+3634488961&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[4]+3889429448&4294967295,i=e+(r^o&((n=r+(i<<20&4294967295|i>>>12))^r))+s[9]+568446438&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[14]+3275163606&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[3]+4107603335&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[8]+1163531501&4294967295,i=e+(r^o&((n=r+(i<<20&4294967295|i>>>12))^r))+s[13]+2850285829&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[2]+4243563512&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[7]+1735328473&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[12]+2368359562&4294967295,i=e+((n=r+(i<<20&4294967295|i>>>12))^r^o)+s[5]+4294588738&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[8]+2272392833&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[11]+1839030562&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[14]+4259657740&4294967295,i=e+((n=r+(i<<23&4294967295|i>>>9))^r^o)+s[1]+2763975236&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[4]+1272893353&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[7]+4139469664&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[10]+3200236656&4294967295,i=e+((n=r+(i<<23&4294967295|i>>>9))^r^o)+s[13]+681279174&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[0]+3936430074&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[3]+3572445317&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[6]+76029189&4294967295,i=e+((n=r+(i<<23&4294967295|i>>>9))^r^o)+s[9]+3654602809&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[12]+3873151461&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[15]+530742520&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[2]+3299628645&4294967295,i=e+(r^((n=r+(i<<23&4294967295|i>>>9))|~o))+s[0]+4096336452&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[7]+1126891415&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[14]+2878612391&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[5]+4237533241&4294967295,i=e+(r^((n=r+(i<<21&4294967295|i>>>11))|~o))+s[12]+1700485571&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[3]+2399980690&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[10]+4293915773&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[1]+2240044497&4294967295,i=e+(r^((n=r+(i<<21&4294967295|i>>>11))|~o))+s[8]+1873313359&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[15]+4264355552&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[6]+2734768916&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[13]+1309151649&4294967295,i=e+(r^((n=r+(i<<21&4294967295|i>>>11))|~o))+s[4]+4149444226&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[11]+3174756917&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[2]+718787259&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[9]+3951481745&4294967295,t.g[0]=t.g[0]+e&4294967295,t.g[1]=t.g[1]+(r+(i<<21&4294967295|i>>>11))&4294967295,t.g[2]=t.g[2]+r&4294967295,t.g[3]=t.g[3]+o&4294967295}function s(t,e){this.h=e;const n=[];let s=!0;for(let r=t.length-1;r>=0;r--){const i=0|t[r];s&&i==e||(n[r]=i,s=!1)}this.g=n}!function(t,e){function n(){}n.prototype=e.prototype,t.F=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.D=function(t,n,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.prototype[n].apply(t,r)}}(e,function(){this.blockSize=-1}),e.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},e.prototype.v=function(t,e){void 0===e&&(e=t.length);const s=e-this.blockSize,r=this.C;let i=this.h,o=0;for(;o<e;){if(0==i)for(;o<=s;)n(this,t,o),o+=this.blockSize;if("string"==typeof t){for(;o<e;)if(r[i++]=t.charCodeAt(o++),i==this.blockSize){n(this,r),i=0;break}}else for(;o<e;)if(r[i++]=t[o++],i==this.blockSize){n(this,r),i=0;break}}this.h=i,this.o+=e},e.prototype.A=function(){var t=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);t[0]=128;for(var e=1;e<t.length-8;++e)t[e]=0;e=8*this.o;for(var n=t.length-8;n<t.length;++n)t[n]=255&e,e/=256;for(this.v(t),t=Array(16),e=0,n=0;n<4;++n)for(let s=0;s<32;s+=8)t[e++]=this.g[n]>>>s&255;return t};var r={};function i(t){return-128<=t&&t<128?function(t,e){var n=r;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(t,function(t){return new s([0|t],t<0?-1:0)}):new s([0|t],t<0?-1:0)}function o(t){if(isNaN(t)||!isFinite(t))return a;if(t<0)return h(o(-t));const e=[];let n=1;for(let s=0;t>=n;s++)e[s]=t/n|0,n*=4294967296;return new s(e,0)}var a=i(0),B=i(1),c=i(16777216);function l(t){if(0!=t.h)return!1;for(let e=0;e<t.g.length;e++)if(0!=t.g[e])return!1;return!0}function u(t){return-1==t.h}function h(t){const e=t.g.length,n=[];for(let s=0;s<e;s++)n[s]=~t.g[s];return new s(n,~t.h).add(B)}function d(t,e){return t.add(h(e))}function p(t,e){for(;(65535&t[e])!=t[e];)t[e+1]+=t[e]>>>16,t[e]&=65535,e++}function f(t,e){this.g=t,this.h=e}function C(t,e){if(l(e))throw Error("division by zero");if(l(t))return new f(a,a);if(u(t))return e=C(h(t),e),new f(h(e.g),h(e.h));if(u(e))return e=C(t,h(e)),new f(h(e.g),e.h);if(t.g.length>30){if(u(t)||u(e))throw Error("slowDivide_ only works with positive integers.");for(var n=B,s=e;s.l(t)<=0;)n=g(n),s=g(s);var r=m(n,1),i=m(s,1);for(s=m(s,2),n=m(n,2);!l(s);){var c=i.add(s);c.l(t)<=0&&(r=r.add(n),i=c),s=m(s,1),n=m(n,1)}return e=d(t,r.j(e)),new f(r,e)}for(r=a;t.l(e)>=0;){for(n=Math.max(1,Math.floor(t.m()/e.m())),s=(s=Math.ceil(Math.log(n)/Math.LN2))<=48?1:Math.pow(2,s-48),c=(i=o(n)).j(e);u(c)||c.l(t)>0;)c=(i=o(n-=s)).j(e);l(i)&&(i=B),r=r.add(i),t=d(t,c)}return new f(r,t)}function g(t){const e=t.g.length+1,n=[];for(let s=0;s<e;s++)n[s]=t.i(s)<<1|t.i(s-1)>>>31;return new s(n,t.h)}function m(t,e){const n=e>>5;e%=32;const r=t.g.length-n,i=[];for(let s=0;s<r;s++)i[s]=e>0?t.i(s+n)>>>e|t.i(s+n+1)<<32-e:t.i(s+n);return new s(i,t.h)}(t=s.prototype).m=function(){if(u(this))return-h(this).m();let t=0,e=1;for(let n=0;n<this.g.length;n++){const s=this.i(n);t+=(s>=0?s:4294967296+s)*e,e*=4294967296}return t},t.toString=function(t){if((t=t||10)<2||36<t)throw Error("radix out of range: "+t);if(l(this))return"0";if(u(this))return"-"+h(this).toString(t);const e=o(Math.pow(t,6));var n=this;let s="";for(;;){const r=C(n,e).g;let i=(((n=d(n,r.j(e))).g.length>0?n.g[0]:n.h)>>>0).toString(t);if(l(n=r))return i+s;for(;i.length<6;)i="0"+i;s=i+s}},t.i=function(t){return t<0?0:t<this.g.length?this.g[t]:this.h},t.l=function(t){return u(t=d(this,t))?-1:l(t)?0:1},t.abs=function(){return u(this)?h(this):this},t.add=function(t){const e=Math.max(this.g.length,t.g.length),n=[];let r=0;for(let s=0;s<=e;s++){let e=r+(65535&this.i(s))+(65535&t.i(s)),i=(e>>>16)+(this.i(s)>>>16)+(t.i(s)>>>16);r=i>>>16,e&=65535,i&=65535,n[s]=i<<16|e}return new s(n,-2147483648&n[n.length-1]?-1:0)},t.j=function(t){if(l(this)||l(t))return a;if(u(this))return u(t)?h(this).j(h(t)):h(h(this).j(t));if(u(t))return h(this.j(h(t)));if(this.l(c)<0&&t.l(c)<0)return o(this.m()*t.m());const e=this.g.length+t.g.length,n=[];for(var r=0;r<2*e;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(let e=0;e<t.g.length;e++){const s=this.i(r)>>>16,i=65535&this.i(r),o=t.i(e)>>>16,a=65535&t.i(e);n[2*r+2*e]+=i*a,p(n,2*r+2*e),n[2*r+2*e+1]+=s*a,p(n,2*r+2*e+1),n[2*r+2*e+1]+=i*o,p(n,2*r+2*e+1),n[2*r+2*e+2]+=s*o,p(n,2*r+2*e+2)}for(t=0;t<e;t++)n[t]=n[2*t+1]<<16|n[2*t];for(t=e;t<2*e;t++)n[t]=0;return new s(n,0)},t.B=function(t){return C(this,t).h},t.and=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let s=0;s<e;s++)n[s]=this.i(s)&t.i(s);return new s(n,this.h&t.h)},t.or=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let s=0;s<e;s++)n[s]=this.i(s)|t.i(s);return new s(n,this.h|t.h)},t.xor=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let s=0;s<e;s++)n[s]=this.i(s)^t.i(s);return new s(n,this.h^t.h)},e.prototype.digest=e.prototype.A,e.prototype.reset=e.prototype.u,e.prototype.update=e.prototype.v,s.prototype.add=s.prototype.add,s.prototype.multiply=s.prototype.j,s.prototype.modulo=s.prototype.B,s.prototype.compare=s.prototype.l,s.prototype.toNumber=s.prototype.m,s.prototype.toString=s.prototype.toString,s.prototype.getBits=s.prototype.i,s.fromNumber=o,s.fromString=function t(e,n){if(0==e.length)throw Error("number format error: empty string");if((n=n||10)<2||36<n)throw Error("radix out of range: "+n);if("-"==e.charAt(0))return h(t(e.substring(1),n));if(e.indexOf("-")>=0)throw Error('number format error: interior "-" character');const s=o(Math.pow(n,8));let r=a;for(let t=0;t<e.length;t+=8){var i=Math.min(8,e.length-t);const a=parseInt(e.substring(t,t+i),n);i<8?(i=o(Math.pow(n,i)),r=r.j(i).add(o(a))):(r=r.j(s),r=r.add(o(a)))}return r},rB=s}).apply(void 0!==iB?iB:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var oB,aB,BB,cB,lB,uB,hB,dB,pB="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var t,e=Object.defineProperty;var n=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof pB&&pB];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function s(t,s){if(s)t:{var r=n;t=t.split(".");for(var i=0;i<t.length-1;i++){var o=t[i];if(!(o in r))break t;r=r[o]}(s=s(i=r[t=t[t.length-1]]))!=i&&null!=s&&e(r,t,{configurable:!0,writable:!0,value:s})}}s("Symbol.dispose",function(t){return t||Symbol("Symbol.dispose")}),s("Array.prototype.values",function(t){return t||function(){return this[Symbol.iterator]()}}),s("Object.entries",function(t){return t||function(t){var e,n=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.push([e,t[e]]);return n}});var r=r||{},i=this||self;function o(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}function a(t,e,n){return t.call.apply(t.bind,arguments)}function B(t,e,n){return(B=a).apply(null,arguments)}function c(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function l(t,e){function n(){}n.prototype=e.prototype,t.Z=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Ob=function(t,n,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.prototype[n].apply(t,r)}}var u="undefined"!=typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?t=>t&&AsyncContext.Snapshot.wrap(t):t=>t;function h(t){const e=t.length;if(e>0){const n=Array(e);for(let s=0;s<e;s++)n[s]=t[s];return n}return[]}function d(t,e){for(let e=1;e<arguments.length;e++){const s=arguments[e];var n=typeof s;if("array"==(n="object"!=n?n:s?Array.isArray(s)?"array":n:"null")||"object"==n&&"number"==typeof s.length){n=t.length||0;const e=s.length||0;t.length=n+e;for(let r=0;r<e;r++)t[n+r]=s[r]}else t.push(s)}}function p(t){i.setTimeout(()=>{throw t},0)}function f(){var t=y;let e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var C=new class{constructor(t,e){this.i=t,this.j=e,this.h=0,this.g=null}get(){let t;return this.h>0?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t}}(()=>new g,t=>t.reset());class g{constructor(){this.next=this.g=this.h=null}set(t,e){this.h=t,this.g=e,this.next=null}reset(){this.next=this.g=this.h=null}}let m,w=!1,y=new class{constructor(){this.h=this.g=null}add(t,e){const n=C.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n}},E=()=>{const t=Promise.resolve(void 0);m=()=>{t.then(D)}};function D(){for(var t;t=f();){try{t.h.call(t.g)}catch(t){p(t)}var e=C;e.j(t),e.h<100&&(e.h++,t.next=e.g,e.g=t)}w=!1}function _(){this.u=this.u,this.C=this.C}function b(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}_.prototype.u=!1,_.prototype.dispose=function(){this.u||(this.u=!0,this.N())},_.prototype[Symbol.dispose]=function(){this.dispose()},_.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},b.prototype.h=function(){this.defaultPrevented=!0};var v=function(){if(!i.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{const t=()=>{};i.addEventListener("test",t,e),i.removeEventListener("test",t,e)}catch(t){}return t}();function I(t){return/^[\s\xa0]*$/.test(t)}function T(t,e){b.call(this,t?t.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,t&&this.init(t,e)}l(T,b),T.prototype.init=function(t,e){const n=this.type=t.type,s=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;this.target=t.target||t.srcElement,this.g=e,(e=t.relatedTarget)||("mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement)),this.relatedTarget=e,s?(this.clientX=void 0!==s.clientX?s.clientX:s.pageX,this.clientY=void 0!==s.clientY?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=t.pointerType,this.state=t.state,this.i=t,t.defaultPrevented&&T.Z.h.call(this)},T.prototype.h=function(){T.Z.h.call(this);const t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var O="closure_listenable_"+(1e6*Math.random()|0),A=0;function S(t,e,n,s,r){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!s,this.ha=r,this.key=++A,this.da=this.fa=!1}function R(t){t.da=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function N(t,e,n){for(const s in t)e.call(n,t[s],s,t)}function x(t){const e={};for(const n in t)e[n]=t[n];return e}const k="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function L(t,e){let n,s;for(let e=1;e<arguments.length;e++){for(n in s=arguments[e],s)t[n]=s[n];for(let e=0;e<k.length;e++)n=k[e],Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}}function F(t){this.src=t,this.g={},this.h=0}function P(t,e){const n=e.type;if(n in t.g){var s,r=t.g[n],i=Array.prototype.indexOf.call(r,e,void 0);(s=i>=0)&&Array.prototype.splice.call(r,i,1),s&&(R(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function M(t,e,n,s){for(let r=0;r<t.length;++r){const i=t[r];if(!i.da&&i.listener==e&&i.capture==!!n&&i.ha==s)return r}return-1}F.prototype.add=function(t,e,n,s,r){const i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);const o=M(t,e,s,r);return o>-1?(e=t[o],n||(e.fa=!1)):((e=new S(e,this.src,i,!!s,r)).fa=n,t.push(e)),e};var G="closure_lm_"+(1e6*Math.random()|0),H={};function U(t,e,n,s,r){if(Array.isArray(e)){for(let i=0;i<e.length;i++)U(t,e[i],n,s,r);return null}return n=K(n),t&&t[O]?t.J(e,n,!!o(s)&&!!s.capture,r):function(t,e,n,s,r,i){if(!e)throw Error("Invalid event type");const a=o(r)?!!r.capture:!!r;let B=q(t);if(B||(t[G]=B=new F(t)),n=B.add(e,n,s,a,i),n.proxy)return n;if(s=function(){function t(n){return e.call(t.src,t.listener,n)}const e=J;return t}(),n.proxy=s,s.src=t,s.listener=n,t.addEventListener)v||(r=a),void 0===r&&(r=!1),t.addEventListener(e.toString(),s,r);else if(t.attachEvent)t.attachEvent($(e.toString()),s);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(s)}return n}(t,e,n,!1,s,r)}function V(t,e,n,s,r){if(Array.isArray(e))for(var i=0;i<e.length;i++)V(t,e[i],n,s,r);else s=o(s)?!!s.capture:!!s,n=K(n),t&&t[O]?(t=t.i,(i=String(e).toString())in t.g&&((n=M(e=t.g[i],n,s,r))>-1&&(R(e[n]),Array.prototype.splice.call(e,n,1),0==e.length&&(delete t.g[i],t.h--)))):t&&(t=q(t))&&(e=t.g[e.toString()],t=-1,e&&(t=M(e,n,s,r)),(n=t>-1?e[t]:null)&&j(n))}function j(t){if("number"!=typeof t&&t&&!t.da){var e=t.src;if(e&&e[O])P(e.i,t);else{var n=t.type,s=t.proxy;e.removeEventListener?e.removeEventListener(n,s,t.capture):e.detachEvent?e.detachEvent($(n),s):e.addListener&&e.removeListener&&e.removeListener(s),(n=q(e))?(P(n,t),0==n.h&&(n.src=null,e[G]=null)):R(t)}}}function $(t){return t in H?H[t]:H[t]="on"+t}function J(t,e){if(t.da)t=!0;else{e=new T(e,this);const n=t.listener,s=t.ha||t.src;t.fa&&j(t),t=n.call(s,e)}return t}function q(t){return(t=t[G])instanceof F?t:null}var z="__closure_events_fn_"+(1e9*Math.random()>>>0);function K(t){return"function"==typeof t?t:(t[z]||(t[z]=function(e){return t.handleEvent(e)}),t[z])}function Q(){_.call(this),this.i=new F(this),this.M=this,this.G=null}function W(t,e){var n,s=t.G;if(s)for(n=[];s;s=s.G)n.push(s);if(t=t.M,s=e.type||e,"string"==typeof e)e=new b(e,t);else if(e instanceof b)e.target=e.target||t;else{var r=e;L(e=new b(s,t),r)}let i,o;if(r=!0,n)for(o=n.length-1;o>=0;o--)i=e.g=n[o],r=Y(i,s,!0,e)&&r;if(i=e.g=t,r=Y(i,s,!0,e)&&r,r=Y(i,s,!1,e)&&r,n)for(o=0;o<n.length;o++)i=e.g=n[o],r=Y(i,s,!1,e)&&r}function Y(t,e,n,s){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();let r=!0;for(let i=0;i<e.length;++i){const o=e[i];if(o&&!o.da&&o.capture==n){const e=o.listener,n=o.ha||o.src;o.fa&&P(t.i,o),r=!1!==e.call(n,s)&&r}}return r&&!s.defaultPrevented}function X(t){t.g=function(t,e){if("function"!=typeof t){if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=B(t.handleEvent,t)}return Number(e)>2147483647?-1:i.setTimeout(t,e||0)}(()=>{t.g=null,t.i&&(t.i=!1,X(t))},t.l);const e=t.h;t.h=null,t.m.apply(null,e)}l(Q,_),Q.prototype[O]=!0,Q.prototype.removeEventListener=function(t,e,n,s){V(this,t,e,n,s)},Q.prototype.N=function(){if(Q.Z.N.call(this),this.i){var t=this.i;for(const e in t.g){const n=t.g[e];for(let t=0;t<n.length;t++)R(n[t]);delete t.g[e],t.h--}}this.G=null},Q.prototype.J=function(t,e,n,s){return this.i.add(String(t),e,!1,n,s)},Q.prototype.K=function(t,e,n,s){return this.i.add(String(t),e,!0,n,s)};class Z extends _{constructor(t,e){super(),this.m=t,this.l=e,this.h=null,this.i=!1,this.g=null}j(t){this.h=arguments,this.g?this.i=!0:X(this)}N(){super.N(),this.g&&(i.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function tt(t){_.call(this),this.h=t,this.g={}}l(tt,_);var et=[];function nt(t){N(t.g,function(t,e){this.g.hasOwnProperty(e)&&j(t)},t),t.g={}}tt.prototype.N=function(){tt.Z.N.call(this),nt(this)},tt.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var st=i.JSON.stringify,rt=i.JSON.parse,it=class{stringify(t){return i.JSON.stringify(t,void 0)}parse(t){return i.JSON.parse(t,void 0)}};function ot(){}function at(){}var Bt={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function ct(){b.call(this,"d")}function lt(){b.call(this,"c")}l(ct,b),l(lt,b);var ut={},ht=null;function dt(){return ht=ht||new Q}function pt(t){b.call(this,ut.Ia,t)}function ft(t){const e=dt();W(e,new pt(e))}function Ct(t,e){b.call(this,ut.STAT_EVENT,t),this.stat=e}function gt(t){const e=dt();W(e,new Ct(e,t))}function mt(t,e){b.call(this,ut.Ja,t),this.size=e}function wt(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return i.setTimeout(function(){t()},e)}function yt(){this.g=!0}function Et(t,e,n,s){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{const i=JSON.parse(e);if(i)for(t=0;t<i.length;t++)if(Array.isArray(i[t])){var n=i[t];if(!(n.length<2)){var s=n[1];if(Array.isArray(s)&&!(s.length<1)){var r=s[0];if("noop"!=r&&"stop"!=r&&"close"!=r)for(let t=1;t<s.length;t++)s[t]=""}}}return st(i)}catch(t){return e}}(t,n)+(s?" "+s:"")})}ut.Ia="serverreachability",l(pt,b),ut.STAT_EVENT="statevent",l(Ct,b),ut.Ja="timingevent",l(mt,b),yt.prototype.ua=function(){this.g=!1},yt.prototype.info=function(){};var Dt,_t={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},bt={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"};function vt(){}function It(t){return encodeURIComponent(String(t))}function Tt(t){var e=1;t=t.split(":");const n=[];for(;e>0&&t.length;)n.push(t.shift()),e--;return t.length&&n.push(t.join(":")),n}function Ot(t,e,n,s){this.j=t,this.i=e,this.l=n,this.S=s||1,this.V=new tt(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 At}function At(){this.i=null,this.g="",this.h=!1}l(vt,ot),vt.prototype.g=function(){return new XMLHttpRequest},Dt=new vt;var St={},Rt={};function Nt(t,e,n){t.M=1,t.A=se(Xt(e)),t.u=n,t.R=!0,xt(t,null)}function xt(t,e){t.F=Date.now(),Ft(t),t.B=Xt(t.A);var n=t.B,s=t.S;Array.isArray(s)||(s=[String(s)]),ge(n.i,"t",s),t.C=0,n=t.j.L,t.h=new At,t.g=sn(t.j,n?e:null,!t.u),t.P>0&&(t.O=new Z(B(t.Y,t,t.g),t.P)),e=t.V,n=t.g,s=t.ba;var r="readystatechange";Array.isArray(r)||(r&&(et[0]=r.toString()),r=et);for(let t=0;t<r.length;t++){const i=U(n,r[t],s||e.handleEvent,!1,e.h||e);if(!i)break;e.g[i.key]=i}e=t.J?x(t.J):{},t.u?(t.v||(t.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.ea(t.B,t.v,t.u,e)):(t.v="GET",t.g.ea(t.B,t.v,null,e)),ft(),function(t,e,n,s,r,i){t.info(function(){if(t.g)if(i){var o="",a=i.split("&");for(let t=0;t<a.length;t++){var B=a[t].split("=");if(B.length>1){const t=B[0];B=B[1];const e=t.split("_");o=e.length>=2&&"type"==e[1]?o+(t+"=")+B+"&":o+(t+"=redacted&")}}}else o=null;else o=i;return"XMLHTTP REQ ("+s+") [attempt "+r+"]: "+e+"\n"+n+"\n"+o})}(t.i,t.v,t.B,t.l,t.S,t.u)}function kt(t){return!!t.g&&("GET"==t.v&&2!=t.M&&t.j.Aa)}function Lt(t,e){var n=t.C,s=e.indexOf("\n",n);return-1==s?Rt:(n=Number(e.substring(n,s)),isNaN(n)?St:(s+=1)+n>e.length?Rt:(e=e.slice(s,s+n),t.C=s+n,e))}function Ft(t){t.T=Date.now()+t.H,Pt(t,t.H)}function Pt(t,e){if(null!=t.D)throw Error("WatchDog timer not null");t.D=wt(B(t.aa,t),e)}function Mt(t){t.D&&(i.clearTimeout(t.D),t.D=null)}function Gt(t){0==t.j.I||t.K||Xe(t.j,t)}function Ht(t){Mt(t);var e=t.O;e&&"function"==typeof e.dispose&&e.dispose(),t.O=null,nt(t.V),t.g&&(e=t.g,t.g=null,e.abort(),e.dispose())}function Ut(t,e){try{var n=t.j;if(0!=n.I&&(n.g==t||qt(n.h,t)))if(!t.L&&qt(n.h,t)&&3==n.I){try{var s=n.Ba.g.parse(e)}catch(t){s=null}if(Array.isArray(s)&&3==s.length){var r=s;if(0==r[0]){t:if(!n.v){if(n.g){if(!(n.g.F+3e3<t.F))break t;Ye(n),Ue(n)}Ke(n),gt(18)}}else n.xa=r[1],0<n.xa-n.K&&r[2]<37500&&n.F&&0==n.A&&!n.C&&(n.C=wt(B(n.Va,n),6e3));Jt(n.h)<=1&&n.ta&&(n.ta=void 0)}else tn(n,11)}else if((t.L||n.g==t)&&Ye(n),!I(e))for(r=n.Ba.g.parse(e),e=0;e<r.length;e++){let B=r[e];const l=B[0];if(!(l<=n.K))if(n.K=l,B=B[1],2==n.I)if("c"==B[0]){n.M=B[1],n.ba=B[2];const e=B[3];null!=e&&(n.ka=e,n.j.info("VER="+n.ka));const r=B[4];null!=r&&(n.za=r,n.j.info("SVER="+n.za));const l=B[5];null!=l&&"number"==typeof l&&l>0&&(s=1.5*l,n.O=s,n.j.info("backChannelRequestTimeoutMs_="+s)),s=n;const u=t.g;if(u){const t=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(t){var i=s.h;i.g||-1==t.indexOf("spdy")&&-1==t.indexOf("quic")&&-1==t.indexOf("h2")||(i.j=i.l,i.g=new Set,i.h&&(zt(i,i.h),i.h=null))}if(s.G){const t=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;t&&(s.wa=t,ne(s.J,s.G,t))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-t.F,n.j.info("Handshake RTT: "+n.T+"ms"));var o=t;if((s=n).na=nn(s,s.L?s.ba:null,s.W),o.L){Kt(s.h,o);var a=o,c=s.O;c&&(a.H=c),a.D&&(Mt(a),Ft(a)),s.g=o}else ze(s);n.i.length>0&&je(n)}else"stop"!=B[0]&&"close"!=B[0]||tn(n,7);else 3==n.I&&("stop"==B[0]||"close"==B[0]?"stop"==B[0]?tn(n,7):He(n):"noop"!=B[0]&&n.l&&n.l.qa(B),n.A=0)}ft()}catch(t){}}Ot.prototype.ba=function(t){t=t.target;const e=this.O;e&&3==Fe(t)?e.j():this.Y(t)},Ot.prototype.Y=function(t){try{if(t==this.g)t:{const B=Fe(this.g),c=this.g.ya();this.g.ca();if(!(B<3)&&(3!=B||this.g&&(this.h.h||this.g.la()||Pe(this.g)))){this.K||4!=B||7==c||ft(),Mt(this);var e=this.g.ca();this.X=e;var n=function(t){if(!kt(t))return t.g.la();const e=Pe(t.g);if(""===e)return"";let n="";const s=e.length,r=4==Fe(t.g);if(!t.h.i){if("undefined"==typeof TextDecoder)return Ht(t),Gt(t),"";t.h.i=new i.TextDecoder}for(let i=0;i<s;i++)t.h.h=!0,n+=t.h.i.decode(e[i],{stream:!(r&&i==s-1)});return e.length=0,t.h.g+=n,t.C=0,t.h.g}(this);if(this.o=200==e,function(t,e,n,s,r,i,o){t.info(function(){return"XMLHTTP RESP ("+s+") [ attempt "+r+"]: "+e+"\n"+n+"\n"+i+" "+o})}(this.i,this.v,this.B,this.l,this.S,B,e),this.o){if(this.U&&!this.L){e:{if(this.g){var s,r=this.g;if((s=r.g?r.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!I(s)){var o=s;break e}}o=null}if(!(t=o)){this.o=!1,this.m=3,gt(12),Ht(this),Gt(this);break t}Et(this.i,this.l,t,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,Ut(this,t)}if(this.R){let e;for(t=!0;!this.K&&this.C<n.length;){if(e=Lt(this,n),e==Rt){4==B&&(this.m=4,gt(14),t=!1),Et(this.i,this.l,null,"[Incomplete Response]");break}if(e==St){this.m=4,gt(15),Et(this.i,this.l,n,"[Invalid Chunk]"),t=!1;break}Et(this.i,this.l,e,null),Ut(this,e)}if(kt(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=B||0!=n.length||this.h.h||(this.m=1,gt(16),t=!1),this.o=this.o&&t,t){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),Qe(a),a.P=!0,gt(11))}}else Et(this.i,this.l,n,"[Invalid Chunked Response]"),Ht(this),Gt(this)}else Et(this.i,this.l,n,null),Ut(this,n);4==B&&Ht(this),this.o&&!this.K&&(4==B?Xe(this.j,this):(this.o=!1,Ft(this)))}else(function(t){const e={};t=(t.g&&Fe(t)>=2&&t.g.getAllResponseHeaders()||"").split("\r\n");for(let s=0;s<t.length;s++){if(I(t[s]))continue;var n=Tt(t[s]);const r=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const i=e[r]||[];e[r]=i,i.push(n)}!function(t,e){for(const n in t)e.call(void 0,t[n],n,t)}(e,function(t){return t.join(", ")})})(this.g),400==e&&n.indexOf("Unknown SID")>0?(this.m=3,gt(12)):(this.m=0,gt(13)),Ht(this),Gt(this)}}}catch(t){}},Ot.prototype.cancel=function(){this.K=!0,Ht(this)},Ot.prototype.aa=function(){this.D=null;const t=Date.now();t-this.T>=0?(function(t,e){t.info(function(){return"TIMEOUT: "+e})}(this.i,this.B),2!=this.M&&(ft(),gt(17)),Ht(this),this.m=2,Gt(this)):Pt(this,this.T-t)};var Vt=class{constructor(t,e){this.g=t,this.map=e}};function jt(t){this.l=t||10,i.PerformanceNavigationTiming?t=(t=i.performance.getEntriesByType("navigation")).length>0&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(i.chrome&&i.chrome.loadTimes&&i.chrome.loadTimes()&&i.chrome.loadTimes().wasFetchedViaSpdy),this.j=t?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function $t(t){return!!t.h||!!t.g&&t.g.size>=t.j}function Jt(t){return t.h?1:t.g?t.g.size:0}function qt(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function zt(t,e){t.g?t.g.add(e):t.h=e}function Kt(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Qt(t){if(null!=t.h)return t.i.concat(t.h.G);if(null!=t.g&&0!==t.g.size){let e=t.i;for(const n of t.g.values())e=e.concat(n.G);return e}return h(t.i)}jt.prototype.cancel=function(){if(this.i=Qt(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const t of this.g.values())t.cancel();this.g.clear()}};var Wt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Yt(t){let e;this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1,t instanceof Yt?(this.l=t.l,Zt(this,t.j),this.o=t.o,this.g=t.g,te(this,t.u),this.h=t.h,ee(this,me(t.i)),this.m=t.m):t&&(e=String(t).match(Wt))?(this.l=!1,Zt(this,e[1]||"",!0),this.o=re(e[2]||""),this.g=re(e[3]||"",!0),te(this,e[4]),this.h=re(e[5]||"",!0),ee(this,e[6]||"",!0),this.m=re(e[7]||"")):(this.l=!1,this.i=new he(null,this.l))}function Xt(t){return new Yt(t)}function Zt(t,e,n){t.j=n?re(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function te(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.u=e}else t.u=null}function ee(t,e,n){e instanceof he?(t.i=e,function(t,e){e&&!t.j&&(de(t),t.i=null,t.g.forEach(function(t,e){const n=e.toLowerCase();e!=n&&(pe(this,e),ge(this,n,t))},t)),t.j=e}(t.i,t.l)):(n||(e=ie(e,le)),t.i=new he(e,t.l))}function ne(t,e,n){t.i.set(e,n)}function se(t){return ne(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function re(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function ie(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,oe),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function oe(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Yt.prototype.toString=function(){const t=[];var e=this.j;e&&t.push(ie(e,ae,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.o)&&t.push(ie(e,ae,!0),"@"),t.push(It(n).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.u)&&t.push(":",String(n))),(n=this.h)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(ie(n,"/"==n.charAt(0)?ce:Be,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.m)&&t.push("#",ie(n,ue)),t.join("")},Yt.prototype.resolve=function(t){const e=Xt(this);let n=!!t.j;n?Zt(e,t.j):n=!!t.o,n?e.o=t.o:n=!!t.g,n?e.g=t.g:n=null!=t.u;var s=t.h;if(n)te(e,t.u);else if(n=!!t.h){if("/"!=s.charAt(0))if(this.g&&!this.h)s="/"+s;else{var r=e.h.lastIndexOf("/");-1!=r&&(s=e.h.slice(0,r+1)+s)}if(".."==(r=s)||"."==r)s="";else if(-1!=r.indexOf("./")||-1!=r.indexOf("/.")){s=0==r.lastIndexOf("/",0),r=r.split("/");const t=[];for(let e=0;e<r.length;){const n=r[e++];"."==n?s&&e==r.length&&t.push(""):".."==n?((t.length>1||1==t.length&&""!=t[0])&&t.pop(),s&&e==r.length&&t.push("")):(t.push(n),s=!0)}s=t.join("/")}else s=r}return n?e.h=s:n=""!==t.i.toString(),n?ee(e,me(t.i)):n=!!t.m,n&&(e.m=t.m),e};var ae=/[#\/\?@]/g,Be=/[#\?:]/g,ce=/[#\?]/g,le=/[#\?@]/g,ue=/#/g;function he(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function de(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(let n=0;n<t.length;n++){const s=t[n].indexOf("=");let r,i=null;s>=0?(r=t[n].substring(0,s),i=t[n].substring(s+1)):r=t[n],e(r,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}function pe(t,e){de(t),e=we(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function fe(t,e){return de(t),e=we(t,e),t.g.has(e)}function Ce(t,e){de(t);let n=[];if("string"==typeof e)fe(t,e)&&(n=n.concat(t.g.get(we(t,e))));else for(t=Array.from(t.g.values()),e=0;e<t.length;e++)n=n.concat(t[e]);return n}function ge(t,e,n){pe(t,e),n.length>0&&(t.i=null,t.g.set(we(t,e),h(n)),t.h+=n.length)}function me(t){const e=new he;return e.i=t.i,t.g&&(e.g=new Map(t.g),e.h=t.h),e}function we(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}function ye(t,e,n,s,r){try{r&&(r.onload=null,r.onerror=null,r.onabort=null,r.ontimeout=null),s(n)}catch(t){}}function Ee(){this.g=new it}function De(t){this.i=t.Sb||null,this.h=t.ab||!1}function _e(t,e){Q.call(this),this.H=t,this.o=e,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 be(t){t.j.read().then(t.Ma.bind(t)).catch(t.ga.bind(t))}function ve(t){t.readyState=4,t.l=null,t.j=null,t.B=null,Ie(t)}function Ie(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function Te(t){let e="";return N(t,function(t,n){e+=n,e+=":",e+=t,e+="\r\n"}),e}function Oe(t,e,n){t:{for(s in n){var s=!1;break t}s=!0}s||(n=Te(n),"string"==typeof t?null!=n&&It(n):ne(t,e,n))}function Ae(t){Q.call(this),this.headers=new Map,this.L=t||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}(t=he.prototype).add=function(t,e){de(this),this.i=null,t=we(this,t);let n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},t.forEach=function(t,e){de(this),this.g.forEach(function(n,s){n.forEach(function(n){t.call(e,n,s,this)},this)},this)},t.set=function(t,e){return de(this),this.i=null,fe(this,t=we(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},t.get=function(t,e){return t&&(t=Ce(this,t)).length>0?String(t[0]):e},t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const t=[],e=Array.from(this.g.keys());for(let s=0;s<e.length;s++){var n=e[s];const r=It(n);n=Ce(this,n);for(let e=0;e<n.length;e++){let s=r;""!==n[e]&&(s+="="+It(n[e])),t.push(s)}}return this.i=t.join("&")},l(De,ot),De.prototype.g=function(){return new _e(this.i,this.h)},l(_e,Q),(t=_e.prototype).open=function(t,e){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=t,this.D=e,this.readyState=1,Ie(this)},t.send=function(t){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 e={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};t&&(e.body=t),(this.H||i).fetch(new Request(this.D,e)).then(this.Pa.bind(this),this.ga.bind(this))},t.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,ve(this)),this.readyState=0},t.Pa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Ie(this)),this.g&&(this.readyState=3,Ie(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(void 0!==i.ReadableStream&&"body"in t){if(this.j=t.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;be(this)}else t.text().then(this.Oa.bind(this),this.ga.bind(this))},t.Ma=function(t){if(this.g){if(this.o&&t.value)this.response.push(t.value);else if(!this.o){var e=t.value?t.value:new Uint8Array(0);(e=this.B.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?ve(this):Ie(this),3==this.readyState&&be(this)}},t.Oa=function(t){this.g&&(this.response=this.responseText=t,ve(this))},t.Na=function(t){this.g&&(this.response=t,ve(this))},t.ga=function(){this.g&&ve(this)},t.setRequestHeader=function(t,e){this.A.append(t,e)},t.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const t=[],e=this.h.entries();for(var n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(_e.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}}),l(Ae,Q);var Se=/^https?$/i,Re=["POST","PUT"];function Ne(t,e){t.h=!1,t.g&&(t.j=!0,t.g.abort(),t.j=!1),t.l=e,t.o=5,xe(t),Le(t)}function xe(t){t.A||(t.A=!0,W(t,"complete"),W(t,"error"))}function ke(t){if(t.h&&void 0!==r)if(t.v&&4==Fe(t))setTimeout(t.Ca.bind(t),0);else if(W(t,"readystatechange"),4==Fe(t)){t.h=!1;try{const r=t.ca();t:switch(r){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break t;default:e=!1}var n;if(!(n=e)){var s;if(s=0===r){let e=String(t.D).match(Wt)[1]||null;!e&&i.self&&i.self.location&&(e=i.self.location.protocol.slice(0,-1)),s=!Se.test(e?e.toLowerCase():"")}n=s}if(n)W(t,"complete"),W(t,"success");else{t.o=6;try{var o=Fe(t)>2?t.g.statusText:""}catch(t){o=""}t.l=o+" ["+t.ca()+"]",xe(t)}}finally{Le(t)}}}function Le(t,e){if(t.g){t.m&&(clearTimeout(t.m),t.m=null);const n=t.g;t.g=null,e||W(t,"ready");try{n.onreadystatechange=null}catch(t){}}}function Fe(t){return t.g?t.g.readyState:0}function Pe(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.F){case"":case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Me(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Ge(t){this.za=0,this.i=[],this.j=new yt,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=Me("failFast",!1,t),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=Me("baseRetryDelayMs",5e3,t),this.Za=Me("retryDelaySeedMs",1e4,t),this.Ta=Me("forwardChannelMaxRetries",2,t),this.va=Me("forwardChannelRequestTimeoutMs",2e4,t),this.ma=t&&t.xmlHttpFactory||void 0,this.Ua=t&&t.Rb||void 0,this.Aa=t&&t.useFetchStreams||!1,this.O=void 0,this.L=t&&t.supportsCrossDomainXhr||!1,this.M="",this.h=new jt(t&&t.concurrentRequestLimit),this.Ba=new Ee,this.S=t&&t.fastHandshake||!1,this.R=t&&t.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=t&&t.Pb||!1,t&&t.ua&&this.j.ua(),t&&t.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&t&&t.detectBufferingProxy||!1,this.ia=void 0,t&&t.longPollingTimeout&&t.longPollingTimeout>0&&(this.ia=t.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function He(t){if(Ve(t),3==t.I){var e=t.V++,n=Xt(t.J);if(ne(n,"SID",t.M),ne(n,"RID",e),ne(n,"TYPE","terminate"),Je(t,n),(e=new Ot(t,t.j,e)).M=2,e.A=se(Xt(n)),n=!1,i.navigator&&i.navigator.sendBeacon)try{n=i.navigator.sendBeacon(e.A.toString(),"")}catch(t){}!n&&i.Image&&((new Image).src=e.A,n=!0),n||(e.g=sn(e.j,null),e.g.ea(e.A)),e.F=Date.now(),Ft(e)}en(t)}function Ue(t){t.g&&(Qe(t),t.g.cancel(),t.g=null)}function Ve(t){Ue(t),t.v&&(i.clearTimeout(t.v),t.v=null),Ye(t),t.h.cancel(),t.m&&("number"==typeof t.m&&i.clearTimeout(t.m),t.m=null)}function je(t){if(!$t(t.h)&&!t.m){t.m=!0;var e=t.Ea;m||E(),w||(m(),w=!0),y.add(e,t),t.D=0}}function $e(t,e){var n;n=e?e.l:t.V++;const s=Xt(t.J);ne(s,"SID",t.M),ne(s,"RID",n),ne(s,"AID",t.K),Je(t,s),t.u&&t.o&&Oe(s,t.u,t.o),n=new Ot(t,t.j,n,t.D+1),null===t.u&&(n.J=t.o),e&&(t.i=e.G.concat(t.i)),e=qe(t,n,1e3),n.H=Math.round(.5*t.va)+Math.round(.5*t.va*Math.random()),zt(t.h,n),Nt(n,s,e)}function Je(t,e){t.H&&N(t.H,function(t,n){ne(e,n,t)}),t.l&&N({},function(t,n){ne(e,n,t)})}function qe(t,e,n){n=Math.min(t.i.length,n);const s=t.l?B(t.l.Ka,t.l,t):null;t:{var r=t.i;let e=-1;for(;;){const t=["count="+n];-1==e?n>0?(e=r[0].g,t.push("ofs="+e)):e=0:t.push("ofs="+e);let B=!0;for(let c=0;c<n;c++){var i=r[c].g;const n=r[c].map;if((i-=e)<0)e=Math.max(0,r[c].g-100),B=!1;else try{i="req"+i+"_"||"";try{var a=n instanceof Map?n:Object.entries(n);for(const[e,n]of a){let s=n;o(n)&&(s=st(n)),t.push(i+e+"="+encodeURIComponent(s))}}catch(e){throw t.push(i+"type="+encodeURIComponent("_badmap")),e}}catch(t){s&&s(n)}}if(B){a=t.join("&");break t}}a=void 0}return t=t.i.splice(0,n),e.G=t,a}function ze(t){if(!t.g&&!t.v){t.Y=1;var e=t.Da;m||E(),w||(m(),w=!0),y.add(e,t),t.A=0}}function Ke(t){return!(t.g||t.v||t.A>=3)&&(t.Y++,t.v=wt(B(t.Da,t),Ze(t,t.A)),t.A++,!0)}function Qe(t){null!=t.B&&(i.clearTimeout(t.B),t.B=null)}function We(t){t.g=new Ot(t,t.j,"rpc",t.Y),null===t.u&&(t.g.J=t.o),t.g.P=0;var e=Xt(t.na);ne(e,"RID","rpc"),ne(e,"SID",t.M),ne(e,"AID",t.K),ne(e,"CI",t.F?"0":"1"),!t.F&&t.ia&&ne(e,"TO",t.ia),ne(e,"TYPE","xmlhttp"),Je(t,e),t.u&&t.o&&Oe(e,t.u,t.o),t.O&&(t.g.H=t.O);var n=t.g;t=t.ba,n.M=1,n.A=se(Xt(e)),n.u=null,n.R=!0,xt(n,t)}function Ye(t){null!=t.C&&(i.clearTimeout(t.C),t.C=null)}function Xe(t,e){var n=null;if(t.g==e){Ye(t),Qe(t),t.g=null;var s=2}else{if(!qt(t.h,e))return;n=e.G,Kt(t.h,e),s=1}if(0!=t.I)if(e.o)if(1==s){n=e.u?e.u.length:0,e=Date.now()-e.F;var r=t.D;W(s=dt(),new mt(s,n)),je(t)}else ze(t);else if(3==(r=e.m)||0==r&&e.X>0||!(1==s&&function(t,e){return!(Jt(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.G.concat(t.i),0):1==t.I||2==t.I||t.D>=(t.Sa?0:t.Ta)||(t.m=wt(B(t.Ea,t,e),Ze(t,t.D)),t.D++,0)))}(t,e)||2==s&&Ke(t)))switch(n&&n.length>0&&(e=t.h,e.i=e.i.concat(n)),r){case 1:tn(t,5);break;case 4:tn(t,10);break;case 3:tn(t,6);break;default:tn(t,2)}}function Ze(t,e){let n=t.Qa+Math.floor(Math.random()*t.Za);return t.isActive()||(n*=2),n*e}function tn(t,e){if(t.j.info("Error code "+e),2==e){var n=B(t.bb,t),s=t.Ua;const e=!s;s=new Yt(s||"//www.google.com/images/cleardot.gif"),i.location&&"http"==i.location.protocol||Zt(s,"https"),se(s),e?function(t,e){const n=new yt;if(i.Image){const s=new Image;s.onload=c(ye,n,"TestLoadImage: loaded",!0,e,s),s.onerror=c(ye,n,"TestLoadImage: error",!1,e,s),s.onabort=c(ye,n,"TestLoadImage: abort",!1,e,s),s.ontimeout=c(ye,n,"TestLoadImage: timeout",!1,e,s),i.setTimeout(function(){s.ontimeout&&s.ontimeout()},1e4),s.src=t}else e(!1)}(s.toString(),n):function(t,e){new yt;const n=new AbortController,s=setTimeout(()=>{n.abort(),ye(0,0,!1,e)},1e4);fetch(t,{signal:n.signal}).then(t=>{clearTimeout(s),t.ok?ye(0,0,!0,e):ye(0,0,!1,e)}).catch(()=>{clearTimeout(s),ye(0,0,!1,e)})}(s.toString(),n)}else gt(2);t.I=0,t.l&&t.l.pa(e),en(t),Ve(t)}function en(t){if(t.I=0,t.ja=[],t.l){const e=Qt(t.h);0==e.length&&0==t.i.length||(d(t.ja,e),d(t.ja,t.i),t.h.i.length=0,h(t.i),t.i.length=0),t.l.oa()}}function nn(t,e,n){var s=n instanceof Yt?Xt(n):new Yt(n);if(""!=s.g)e&&(s.g=e+"."+s.g),te(s,s.u);else{var r=i.location;s=r.protocol,e=e?e+"."+r.hostname:r.hostname,r=+r.port;const t=new Yt(null);s&&Zt(t,s),e&&(t.g=e),r&&te(t,r),n&&(t.h=n),s=t}return n=t.G,e=t.wa,n&&e&&ne(s,n,e),ne(s,"VER",t.ka),Je(t,s),s}function sn(t,e,n){if(e&&!t.L)throw Error("Can't create secondary domain capable XhrIo object.");return(e=t.Aa&&!t.ma?new Ae(new De({ab:n})):new Ae(t.ma)).Fa(t.L),e}function rn(){}function on(){}function an(t,e){Q.call(this),this.g=new Ge(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.o=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.sa&&(t?t["X-WebChannel-Client-Profile"]=e.sa:t={"X-WebChannel-Client-Profile":e.sa}),this.g.U=t,(t=e&&e.Qb)&&!I(t)&&(this.g.u=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!I(e)&&(this.g.G=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ln(this)}function Bn(t){ct.call(this),t.__headers__&&(this.headers=t.__headers__,this.statusCode=t.__status__,delete t.__headers__,delete t.__status__);var e=t.__sm__;if(e){t:{for(const n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function cn(){lt.call(this),this.status=1}function ln(t){this.g=t}(t=Ae.prototype).Fa=function(t){this.H=t},t.ea=function(t,e,n,s){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+t);e=e?e.toUpperCase():"GET",this.D=t,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Dt.g(),this.g.onreadystatechange=u(B(this.Ca,this));try{this.B=!0,this.g.open(e,String(t),!0),this.B=!1}catch(t){return void Ne(this,t)}if(t=n||"",n=new Map(this.headers),s)if(Object.getPrototypeOf(s)===Object.prototype)for(var r in s)n.set(r,s[r]);else{if("function"!=typeof s.keys||"function"!=typeof s.get)throw Error("Unknown input type for opt_headers: "+String(s));for(const t of s.keys())n.set(t,s.get(t))}s=Array.from(n.keys()).find(t=>"content-type"==t.toLowerCase()),r=i.FormData&&t instanceof i.FormData,!(Array.prototype.indexOf.call(Re,e,void 0)>=0)||s||r||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[t,e]of n)this.g.setRequestHeader(t,e);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(t),this.v=!1}catch(t){Ne(this,t)}},t.abort=function(t){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=t||7,W(this,"complete"),W(this,"abort"),Le(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Le(this,!0)),Ae.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?ke(this):this.Xa())},t.Xa=function(){ke(this)},t.isActive=function(){return!!this.g},t.ca=function(){try{return Fe(this)>2?this.g.status:-1}catch(t){return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},t.La=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),rt(e)}},t.ya=function(){return this.o},t.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(t=Ge.prototype).ka=8,t.I=1,t.connect=function(t,e,n,s){gt(0),this.W=t,this.H=e||{},n&&void 0!==s&&(this.H.OSID=n,this.H.OAID=s),this.F=this.X,this.J=nn(this,null,this.W),je(this)},t.Ea=function(t){if(this.m)if(this.m=null,1==this.I){if(!t){this.V=Math.floor(1e5*Math.random()),t=this.V++;const r=new Ot(this,this.j,t);let i=this.o;if(this.U&&(i?(i=x(i),L(i,this.U)):i=this.U),null!==this.u||this.R||(r.J=i,i=null),this.S)t:{for(var e=0,n=0;n<this.i.length;n++){var s=this.i[n];if(void 0===(s="__data__"in s.map&&"string"==typeof(s=s.map.__data__)?s.length:void 0))break;if((e+=s)>4096){e=n;break t}if(4096===e||n===this.i.length-1){e=n+1;break t}}e=1e3}else e=1e3;e=qe(this,r,e),ne(n=Xt(this.J),"RID",t),ne(n,"CVER",22),this.G&&ne(n,"X-HTTP-Session-Id",this.G),Je(this,n),i&&(this.R?e="headers="+It(Te(i))+"&"+e:this.u&&Oe(n,this.u,i)),zt(this.h,r),this.Ra&&ne(n,"TYPE","init"),this.S?(ne(n,"$req",e),ne(n,"SID","null"),r.U=!0,Nt(r,n,null)):Nt(r,n,e),this.I=2}}else 3==this.I&&(t?$e(this,t):0==this.i.length||$t(this.h)||$e(this))},t.Da=function(){if(this.v=null,We(this),this.aa&&!(this.P||null==this.g||this.T<=0)){var t=4*this.T;this.j.info("BP detection timer enabled: "+t),this.B=wt(B(this.Wa,this),t)}},t.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,gt(10),Ue(this),We(this))},t.Va=function(){null!=this.C&&(this.C=null,Ue(this),Ke(this),gt(19))},t.bb=function(t){t?(this.j.info("Successfully pinged google.com"),gt(2)):(this.j.info("Failed to ping google.com"),gt(1))},t.isActive=function(){return!!this.l&&this.l.isActive(this)},(t=rn.prototype).ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){},on.prototype.g=function(t,e){return new an(t,e)},l(an,Q),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(){He(this.g)},an.prototype.o=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=st(t),t=n);e.i.push(new Vt(e.Ya++,t)),3==e.I&&je(e)},an.prototype.N=function(){this.g.l=null,delete this.j,He(this.g),delete this.g,an.Z.N.call(this)},l(Bn,ct),l(cn,lt),l(ln,rn),ln.prototype.ra=function(){W(this.g,"a")},ln.prototype.qa=function(t){W(this.g,new Bn(t))},ln.prototype.pa=function(t){W(this.g,new cn)},ln.prototype.oa=function(){W(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,dB=function(){return new on},hB=function(){return dt()},uB=ut,lB={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},_t.NO_ERROR=0,_t.TIMEOUT=8,_t.HTTP_ERROR=6,cB=_t,bt.COMPLETE="complete",BB=bt,at.EventType=Bt,Bt.OPEN="a",Bt.CLOSE="b",Bt.ERROR="c",Bt.MESSAGE="d",Q.prototype.listen=Q.prototype.J,aB=at,Ae.prototype.listenOnce=Ae.prototype.K,Ae.prototype.getLastError=Ae.prototype.Ha,Ae.prototype.getLastErrorCode=Ae.prototype.ya,Ae.prototype.getStatus=Ae.prototype.ca,Ae.prototype.getResponseJson=Ae.prototype.La,Ae.prototype.getResponseText=Ae.prototype.la,Ae.prototype.send=Ae.prototype.ea,Ae.prototype.setWithCredentials=Ae.prototype.Fa,oB=Ae}).apply(void 0!==pB?pB:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var fB=class t{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 LOOKBEHIND=512;static MATCH_NL=t.CLASS_NL|t.DOT_NL;static PERL=t.CLASS_NL|t.ONE_LINE|t.PERL_X|t.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2};const CB=1,gB=2,mB=4,wB=8,yB=16,EB=512,DB=128,_B=new Int32Array(DB),bB=new Int32Array(DB),vB=65535;for(let t=0;t<DB;t++)_B[t]=t>=97&&t<=122?t-32:t,bB[t]=t>=65&&t<=90?t+32:t;var IB=class{static CODES=Object.freeze({"":7,"\b":8,"\t":9,"\n":10,"\v":11,"\f":12,"\r":13," ":32,'"':34,$:36,"&":38,"'":39,"(":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,"`":96,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(t){if(t<DB)return _B[t];const e=String.fromCodePoint(t).toUpperCase(),n=e.codePointAt(0)>vB?2:1;if(e.length>n)return t;const s=String.fromCodePoint(e.codePointAt(0)).toLowerCase(),r=s.codePointAt(0)>vB?2:1;return s.length>r||s.codePointAt(0)!==t?t:e.codePointAt(0)}static toLowerCase(t){if(t<DB)return bB[t];const e=String.fromCodePoint(t).toLowerCase(),n=e.codePointAt(0)>vB?2:1;if(e.length>n)return t;const s=String.fromCodePoint(e.codePointAt(0)).toUpperCase(),r=s.codePointAt(0)>vB?2:1;return s.length>r||s.codePointAt(0)!==t?t:e.codePointAt(0)}},TB=class{constructor(t,e=!1){this.data=t,this.isStride1=e,this.SIZE=e?2:3}getLo(t){return this.data[t*this.SIZE]}getHi(t){return this.data[t*this.SIZE+1]}getStride(t){return this.isStride1?1:this.data[t*this.SIZE+2]}get length(){return this.data.length/this.SIZE}};const OB=new Uint8Array(256);for(let t=0;t<64;t++)OB["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-".charCodeAt(t)]=t;const AB=t=>{const e=[];let n=0,s=0;for(let r=0;r<t.length;r++){const i=OB[t.charCodeAt(r)];n|=(31&i)<<s,32&i?s+=5:(e.push(n),n=0,s=0)}return e},SB=(t,e)=>{const n=AB(t),s=e?n.length/2:n.length/3,r=new Uint32Array(3*s);let i=0,o=0;for(let t=0;t<s;t++)i+=n[o++],r[3*t]=i,i+=n[o++],r[3*t+1]=i,r[3*t+2]=e?1:n[o++];return r};var RB=class{constructor(t){this.initializer=t,this.cache=new Map}has(t){return t in this.initializer}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.initializer[t],n=e?e():null;return this.cache.set(t,n),n}},NB=class{static _CASE_ORBIT=null;static get CASE_ORBIT(){return this._CASE_ORBIT||(this._CASE_ORBIT=(t=>{const e=AB(t),n=new Map;let s=0;for(let t=0;t<e.length;t+=2){s+=e[t];const r=e[t+1],i=r>>>1^-(1&r);n.set(s,s+i)}return n})("rCgCIgCY+rQI4QiCuuBLgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCCgCBgCBgCBgCBgCBgCBgCB+7OB-BB-BB-BB-BB-BBskQB-BB-BB-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BCDBCCCBIBCQBGCBCEBCQB1BBB",!1)),Armenian:()=>new TB(SB("xpBlBDxBDCks9BE",!0)),Avestan:()=>new TB(SB("g4iC1BEG",!0)),Balinese:()=>new TB(SB("g4GsCCxB",!0)),Bamum:()=>new TB(SB("g1pB3CpowB4R",!0)),Bassa_Vah:()=>new TB(SB("w26CdDF",!0)),Batak:()=>new TB(SB("g+GzBJD",!0)),Bengali:()=>new TB(SB("gsCDBCHBDBBDVBCGBCEEBCBDIBDBBDDBJFFBCCBDBDYB",!1)),Beria_Erfe:()=>new TB(SB("g17CYDY",!0)),Bhaiksuki:()=>new TB(SB("ggnCICsBCNLc",!0)),Bopomofo:()=>new TB(SB("qXB6wLqBxDf",!0)),Brahmi:()=>new TB(SB("ggkCtCFjBKA",!0)),Braille:()=>new TB(SB("ggK-H",!0)),Buginese:()=>new TB(SB("gwGbDB",!0)),Buhid:()=>new TB(SB("g6FT",!0)),Canadian_Aboriginal:()=>new TB(SB("ggF-TxRlC7tgCP",!0)),Carian:()=>new TB(SB("g1gCwB",!0)),Caucasian_Albanian:()=>new TB(SB("wphCzBMA",!0)),Chakma:()=>new TB(SB("gokC0BCR",!0)),Cham:()=>new TB(SB("gwqB2BKNDJDD",!0)),Cherokee:()=>new TB(SB("g9E1CDFz7lBvC",!0)),Chorasmian:()=>new TB(SB("w9jCb",!0)),Common:()=>new TB(SB("AgCBbFBbuBBCOBCEBYgBgBiOmBBGEBDTB1DKKHCC+THHPEEhB9E9ElQiEiEB6mB6mB2MDBjJwvBwvBBBBoCBBsGBBCumBumBOIIBCBCFBCCBDmYmYBKBD2CBCKBEKBCOBShBB-BlBBCCBDFBCaBCQBqBCBF5UBXKBW-cBhIzTBDpEBhQ9CBzMUBCCCBXBQHBFDB8CBBE7C7CB0E0EBOBhBlBBKxBxBB+BBgBwCBwB5C5CBmFBhuG-BBhoWhBBnDCBmFJB1HhFhFsMPPBzuUzuUBxGxGBIBXiBBCSBCDB0ECCBeBbFBbKBLuBuBBhChCBFBCGBLEBjICBFsBBEIBxCMB0BsBBlHaBltuBDB96D8HBEzNBHWBQQBgDzDB9B1HBLmBBD9BBEQBJBBIdBF8BB2GTBNTBN2CBKYBoE0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBDxBByjFjCBtC8BBjWrBBFjDBNOBDOBCOBCkBBLtFB5BZBCBBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBCmDBnghYffB+CB",!1)),Coptic:()=>new TB(SB("ifNxkKzDGG",!0)),Cuneiform:()=>new TB(SB("ggoC5cnDuDCEMjG",!0)),Cypriot:()=>new TB(SB("ggiCFBDCCBqBBCBBEDD",!1)),Cypro_Minoan:()=>new TB(SB("w8rCiD",!0)),Cyrillic:()=>new TB(SB("ggBkEBDoFBx6FKBhFtCtCojEfBhie-CBv8VBBhw4B9BBiBAB",!1)),Deseret:()=>new TB(SB("gghCvC",!0)),Devanagari:()=>new TB(SB("goCwCFODZh7nBfhwcJ",!0)),Dives_Akuru:()=>new TB(SB("gomCGBDDDBGBCBBCdBCBBDLBKJB",!1)),Dogra:()=>new TB(SB("ggmC7B",!0)),Duployan:()=>new TB(SB("ggvDqDGMEIIJDD",!0)),Egyptian_Hieroglyphs:()=>new TB(SB("ggsC1iBL68D",!0)),Elbasan:()=>new TB(SB("gohCnB",!0)),Elymaic:()=>new TB(SB("g-jCW",!0)),Ethiopic:()=>new TB(SB("gwEoCBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBDfBEZBnvGWBKGBCGBCGBCGBCGBCGBCGBCGBjpfFBDFBDFBKGBCGBylvCGBCDBCBBCOB",!1)),Garay:()=>new TB(SB("gqjClBEcJB",!0)),Georgian:()=>new TB(SB("glElBBCGGDqBBCDBx8CqBBDCBhiElBBCGG",!1)),Glagolitic:()=>new TB(SB("ggL-Ch9sDGCQDGCBCE",!0)),Gothic:()=>new TB(SB("w5gCa",!0)),Grantha:()=>new TB(SB("g4kCDBCHBDBBDVBCGBCBBCEBDIBDBBDCBDHHGGBDGBEEB",!1)),Greek:()=>new TB(SB("wbDBCCBDDBCFFCCCBBBCCCBSBC+BBPPBnpGEBzBEBFEB1ChKhKBUBDFBDlBBDFBDHBCGCBdBD0BBCOBCNBDFBCSBDCBCIBoJ-xiB-xiB7uVuCBSgj0Bgj0BBkCB",!1)),Gujarati:()=>new TB(SB("h0CCBCIBCCBCVBCGBCBBCEBDJBCCBCCBDQQBCBDLBIGB",!1)),Gunjala_Gondi:()=>new TB(SB("grnCFCBCkBCBCFIJ",!0)),Gurmukhi:()=>new TB(SB("hwCCBCFBFBBDVBCGBCBBCBBCBBDCCBDBFBBDCBEIIBCBCIIBPB",!1)),Gurung_Khema:()=>new TB(SB("go4C5B",!0)),Han:()=>new TB(SB("g0LZBC4CBN1GBwBCCaIBPDBle-tGBhC-vUBhoWtLBDpDBpodBBNGBqgkB-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Hangul:()=>new TB(SB("goE-HvxHBiI9CyDeiCei3dckUj9KNWFwBl9JeEFDFDFDC",!0)),Hanifi_Rohingya:()=>new TB(SB("gojCnBJJ",!0)),Hanunoo:()=>new TB(SB("g5FU",!0)),Hatran:()=>new TB(SB("gniCSCBGE",!0)),Hebrew:()=>new TB(SB("xsB2BBJaBFFBpp9BZBCEBCCCBCCBCCBIB",!1)),Hiragana:()=>new TB(SB("hiM1CBHCBi7-C+IBTeeBBBulQAB",!1)),Imperial_Aramaic:()=>new TB(SB("giiCVCI",!0)),Inherited:()=>new TB(SB("gYvDB2IBBlOKBbhXhXBCB8qEtBBDLBlPCBCMBCGBFHHEBBnG-BBtQBBjGgBB65DDBsDBBmrzBPBRNBwejHjH7iEl+uBl+uBBsBBDWBhRCBSHBDGBfDBz6rYvHB",!1)),Inscriptional_Pahlavi:()=>new TB(SB("g7iCSGH",!0)),Inscriptional_Parthian:()=>new TB(SB("g6iCVDH",!0)),Javanese:()=>new TB(SB("gsqBtCDJFB",!0)),Kaithi:()=>new TB(SB("gkkCiCLA",!0)),Kannada:()=>new TB(SB("gkDMCCCWCJCEDICCCDIBGCCDDJCC",!0)),Katakana:()=>new TB(SB("hlM5CBDCBxHPBxGuBBC3CBvgzBJBCsBBzisBDBCGBCBBCgJgJBBBzBPPBCB",!1)),Kawi:()=>new TB(SB("g4nCQCoBEc",!0)),Kayah_Li:()=>new TB(SB("goqBtBCA",!0)),Kharoshthi:()=>new TB(SB("gwiCDCBGHCCCcDCFJII",!0)),Khitan_Small_Script:()=>new TB(SB("k-7C84G84GB0OBqBAB",!1)),Khmer:()=>new TB(SB("g8F9CDJHJnPf",!0)),Khojki:()=>new TB(SB("gwkCRCuB",!0)),Khudawadi:()=>new TB(SB("w1kC6BGJ",!0)),Kirat_Rai:()=>new TB(SB("gq7C5B",!0)),Lao:()=>new TB(SB("h0DBBCCCBDBCXBCCCBVBDEBCCCBFBCJBDDB",!1)),Latin:()=>new TB(SB("hCZBHZBwBQQGWBCeBCgOBoBEB8wGlBBHwBBGDBGMBClCBiC-HByLOORMBuEBBHccSoBB42CfBj1elDBExCBVOBxZqBBCIBCDB38TGB7gBZBHZBmhCFBCpBBCIBm61BeBHFB",!1)),Lepcha:()=>new TB(SB("ggH3BEOEC",!0)),Limbu:()=>new TB(SB("goGeBCLBFLBFEEBKB",!1)),Linear_A:()=>new TB(SB("gwhC2JKVLH",!0)),Linear_B:()=>new TB(SB("gggCLCZCSCBCODNjB6D",!0)),Lisu:()=>new TB(SB("wmpBvBx1eA",!0)),Lycian:()=>new TB(SB("g0gCc",!0)),Lydian:()=>new TB(SB("gpiCZGA",!0)),Mahajani:()=>new TB(SB("wqkCmB",!0)),Makasar:()=>new TB(SB("g3nCY",!0)),Malayalam:()=>new TB(SB("goDMCCCyBCCCFFPDZ",!0)),Mandaic:()=>new TB(SB("giCbDA",!0)),Manichaean:()=>new TB(SB("g2iCmBFL",!0)),Marchen:()=>new TB(SB("wjnCfDVCN",!0)),Masaram_Gondi:()=>new TB(SB("gonCGBCBBCrBBECCBCCBHBJJB",!1)),Medefaidrin:()=>new TB(SB("gy7C6C",!0)),Meetei_Mayek:()=>new TB(SB("g3qBWqGtBDJ",!0)),Mende_Kikakui:()=>new TB(SB("gg6DkGDP",!0)),Meroitic_Cursive:()=>new TB(SB("gtiCXFTDtB",!0)),Meroitic_Hieroglyphs:()=>new TB(SB("gsiCf",!0)),Miao:()=>new TB(SB("g47CqCF4BIQ",!0)),Modi:()=>new TB(SB("gwlCkCMJ",!0)),Mongolian:()=>new TB(SB("ggGBBDCCBSBH4CBIqBB2t-BMB",!1)),Mro:()=>new TB(SB("gy6CeCJFB",!0)),Multani:()=>new TB(SB("g0kCGBCCCBCBCOBCKB",!1)),Myanmar:()=>new TB(SB("ggE-EhqmBeiDfxibT",!0)),Nabataean:()=>new TB(SB("gkiCeJI",!0)),Nag_Mundari:()=>new TB(SB("wm5DpB",!0)),Nandinagari:()=>new TB(SB("gtmCHDtBDK",!0)),New_Tai_Lue:()=>new TB(SB("gsGrBFZHKEB",!0)),Newa:()=>new TB(SB("gglC7CCE",!0)),Nko:()=>new TB(SB("g+B6BDC",!0)),Nushu:()=>new TB(SB("h-7CvsQvsQBqMB",!1)),Nyiakeng_Puachue_Hmong:()=>new TB(SB("go4DsBENDJFB",!0)),Ogham:()=>new TB(SB("g0Fc",!0)),Ol_Chiki:()=>new TB(SB("wiHvB",!0)),Ol_Onal:()=>new TB(SB("wu5DqBFA",!0)),Old_Hungarian:()=>new TB(SB("gkjCyBOyBIF",!0)),Old_Italic:()=>new TB(SB("g4gCjBKC",!0)),Old_North_Arabian:()=>new TB(SB("g0iCf",!0)),Old_Permic:()=>new TB(SB("w6gCqB",!0)),Old_Persian:()=>new TB(SB("g9gCjBFN",!0)),Old_Sogdian:()=>new TB(SB("g4jCnB",!0)),Old_South_Arabian:()=>new TB(SB("gziCf",!0)),Old_Turkic:()=>new TB(SB("ggjCoC",!0)),Old_Uyghur:()=>new TB(SB("w7jCZ",!0)),Oriya:()=>new TB(SB("h4CCCHDBDVCGCBCEDIDBDCICFBCEDR",!0)),Osage:()=>new TB(SB("wlhCjBFjB",!0)),Osmanya:()=>new TB(SB("gkhCdDJ",!0)),Pahawh_Hmong:()=>new TB(SB("g46ClCLJCGCUGS",!0)),Palmyrene:()=>new TB(SB("gjiCf",!0)),Pau_Cin_Hau:()=>new TB(SB("g2mC4B",!0)),Phags_Pa:()=>new TB(SB("giqB3B",!0)),Phoenician:()=>new TB(SB("goiCbEA",!0)),Psalter_Pahlavi:()=>new TB(SB("g8iCRIDNG",!0)),Rejang:()=>new TB(SB("wpqBjBMA",!0)),Runic:()=>new TB(SB("g1FqCEK",!0)),Samaritan:()=>new TB(SB("ggCtBDO",!0)),Saurashtra:()=>new TB(SB("gkqBlCJL",!0)),Sharada:()=>new TB(SB("gskC-ChsCH",!0)),Shavian:()=>new TB(SB("wihCvB",!0)),Siddham:()=>new TB(SB("gslC1BDlB",!0)),Sidetic:()=>new TB(SB("gqiCZ",!0)),SignWriting:()=>new TB(SB("gg2DrUQECO",!0)),Sinhala:()=>new TB(SB("hsDCBCRBEXBCIBCDDBFBEFFBEBCCCBGBHJBDCBt-gCTB",!1)),Sogdian:()=>new TB(SB("w5jCpB",!0)),Sora_Sompeng:()=>new TB(SB("wmkCYIJ",!0)),Soyombo:()=>new TB(SB("wymCyC",!0)),Sundanese:()=>new TB(SB("g8G-BhIH",!0)),Sunuwar:()=>new TB(SB("g+mChBPJ",!0)),Syloti_Nagri:()=>new TB(SB("ggqBsB",!0)),Syriac:()=>new TB(SB("g4BNC7BDCxIK",!0)),Tagalog:()=>new TB(SB("g4FVKA",!0)),Tagbanwa:()=>new TB(SB("g7FMCCCB",!0)),Tai_Le:()=>new TB(SB("wqGdDE",!0)),Tai_Tham:()=>new TB(SB("gxG+BCcDKHJHN",!0)),Tai_Viet:()=>new TB(SB("g0qBiCZE",!0)),Tai_Yo:()=>new TB(SB("g25DeCVJB",!0)),Takri:()=>new TB(SB("g0lC5BHJ",!0)),Tamil:()=>new TB(SB("i8CBBCFBECBCDBEBBCCCBEEBEEBBBELBFEBECBCDBDHHPUBm+kCxBBOAB",!1)),Tangsa:()=>new TB(SB("wz6CuCCJ",!0)),Tangut:()=>new TB(SB("g-7CgBgBB+3GBhQeBiDyDB",!1)),Telugu:()=>new TB(SB("ggDMCCCWCPDICCCDIBCCCBDDDJII",!0)),Thaana:()=>new TB(SB("g8BxB",!0)),Thai:()=>new TB(SB("hwD5BGb",!0)),Tibetan:()=>new TB(SB("g4DnCCjBFmBCjBCOCGFB",!0)),Tifinagh:()=>new TB(SB("wpL3BIBPA",!0)),Tirhuta:()=>new TB(SB("gklCnCJJ",!0)),Todhri:()=>new TB(SB("guhCzB",!0)),Tolong_Siki:()=>new TB(SB("wtnCrBFJ",!0)),Toto:()=>new TB(SB("w04De",!0)),Tulu_Tigalari:()=>new TB(SB("g8kCJBCDDClBBCJBCDDCDBCJBCBBJBB",!1)),Ugaritic:()=>new TB(SB("g8gCdCA",!0)),Unknown:()=>new TB(SB("4bBBHDBICCVuMuMnBBBzBBBE4B4BBGBcDBHKBvI9B9BBmDmDBMB8BBByBBBQddBCCMEBjBEBuHJJBDDBXXICCBBBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFF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BBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMB3iBJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBJ76DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBjGUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIm8yVBCdBhD-DBxHvw-FB",!1)),Vai:()=>new TB(SB("gopBrJ",!0)),Vithkuqi:()=>new TB(SB("wrhCKCOCGCBCKCOCGCB",!0)),Wancho:()=>new TB(SB("g24D5BGA",!0)),Warang_Citi:()=>new TB(SB("glmCyCNA",!0)),Yezidi:()=>new TB(SB("g0jCpBCCDB",!0)),Yi:()=>new TB(SB("ggoBskBE2B",!0)),Zanabazar_Square:()=>new TB(SB("gwmCnC",!0))});static FOLD_CATEGORIES=new RB({L:()=>new TB(SB("laA",!0)),LC:()=>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ographic:()=>new TB(SB("8mJA",!0)),Lowercase:()=>new TB(SB("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHuBPBUzZzZBYBx5BvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoyehBB",!1)),Math:()=>new TB(SB("ycGDCHHFMMDDDCHHFAB",!1)),Uppercase:()=>new TB(SB("hDZB7BqBqBBWBCHBCuBCEECDOCDsBCDECBBBDCCDEEGDDECBDDDCCCDFFDEECDDECCGBBCBBCBBCOCBSCDBBCEECkBCEQCJDDBCCFICBEBCBBCCCBEEBCCBCBCEBDCCBDDIDDCBBEFBGLLBnFnFsBCCEEEBBBvBDBCdBCBBECBCWCBDBCGD1BvBBCgBCK0BCDMCBgDCyBlBBq6CqBBDCB5XFBjkCIBCvHvHERRzD0ECGGGC8CCBHBJFBLHBJHBJFBMGCJHBJNBzBBBNSSBPPBEEpLiBiBBOBFsasaBYBn6BvBBCEEBGCHDDLiDCJCCFNNBkBBCGG0oesBCUaCoEMCE8BCLCCDICFFFCBBDSCMOCFCCDOCb9a9advCBi8UZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBvyehBB",!1))});static FOLD_SCRIPT=new RB({Common:()=>new TB(SB("8cgBgB",!1)),Greek:()=>new TB(SB("1FwUwU",!1)),Inherited:()=>new TB(SB("5cgBgBlgHAB",!1))})},xB=class t{static MAX_RUNE=1114111;static RUNE_ERROR=65533;static isUnsearchable(e){return e===t.RUNE_ERROR||e>=t.MIN_HIGH_SURROGATE&&e<=t.MAX_LOW_SURROGATE}static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static MIN_HIGH_SURROGATE=55296;static MAX_HIGH_SURROGATE=56319;static MIN_LOW_SURROGATE=56320;static MAX_LOW_SURROGATE=57343;static MIN_SUPPLEMENTARY_CODE_POINT=65536;static is32(t,e){let n=0,s=t.length;for(;n<s;){const r=n+Math.floor((s-n)/2),i=t.getLo(r),o=t.getHi(r);if(i<=e&&e<=o){return(e-i)%t.getStride(r)===0}e<i?s=r:n=r+1}return!1}static is(e,n){if(n<=t.MAX_LATIN1){for(let t=0;t<e.length;t++){if(n>e.getHi(t))continue;const s=e.getLo(t);if(n<s)return!1;return(n-s)%e.getStride(t)===0}return!1}return e.length>0&&n>=e.getLo(0)&&t.is32(e,n)}static isPrint(e){return e<=t.MAX_LATIN1?e>=32&&e<t.MAX_ASCII||e>=161&&173!==e:t.is(NB.Print,e)}static simpleFold(e){if(NB.CASE_ORBIT.has(e))return NB.CASE_ORBIT.get(e);if(e<=t.MAX_ASCII){const t=IB.toLowerCase(e);return t!==e?t:IB.toUpperCase(e)}return e}static equalsIgnoreCase(e,n){if(e===n)return!0;if(e<0||n<0)return!1;if(e<=t.MAX_ASCII&&n<=t.MAX_ASCII)return 65<=e&&e<=90&&(e|=32),65<=n&&n<=90&&(n|=32),e===n;for(let s=t.simpleFold(e);s!==e;s=t.simpleFold(s))if(s===n)return!0;return!1}};const kB=new Uint8Array(256);for(let t=0;t<256;t++)kB[t]=97<=t&&t<=122||65<=t&&t<=90||48<=t&&t<=57||95===t?1:0;let LB=null,FB=null;var PB=class t{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 isByteArray(t){return Array.isArray(t)||"[object Uint8Array]"===Object.prototype.toString.call(t)}static isalnum(t){return IB.CODES[0]<=t&&t<=IB.CODES[9]||IB.CODES.a<=t&&t<=IB.CODES.z||IB.CODES.A<=t&&t<=IB.CODES.Z}static unhex(t){return IB.CODES[0]<=t&&t<=IB.CODES[9]?t-IB.CODES[0]:IB.CODES.a<=t&&t<=IB.CODES.f?t-IB.CODES.a+10:IB.CODES.A<=t&&t<=IB.CODES.F?t-IB.CODES.A+10:-1}static escapeRune(e){let n="";if(xB.isPrint(e))t.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(n+="\\"),n+=String.fromCodePoint(e);else switch(e){case IB.CODES['"']:n+='\\"';break;case IB.CODES["\\"]:n+="\\\\";break;case IB.CODES["\t"]:n+="\\t";break;case IB.CODES["\n"]:n+="\\n";break;case IB.CODES["\r"]:n+="\\r";break;case IB.CODES["\b"]:n+="\\b";break;case IB.CODES["\f"]:n+="\\f";break;default:{let t=e.toString(16);e<256?(n+="\\x",1===t.length&&(n+="0"),n+=t):n+=`\\x{${t}}`;break}}return n}static stringToRunes(t){const e=String(t),n=[];let s=0;for(;s<e.length;){const t=e.codePointAt(s);n.push(t),s+=t>xB.MAX_BMP?2:1}return new Int32Array(n)}static runeToString(t){return String.fromCodePoint(t)}static isWordRune(t){return t<256&&1===kB[t]}static emptyOpContext(e,n){let s=0;return e<0&&(s|=t.EMPTY_BEGIN_TEXT|t.EMPTY_BEGIN_LINE),10===e&&(s|=t.EMPTY_BEGIN_LINE),n<0&&(s|=t.EMPTY_END_TEXT|t.EMPTY_END_LINE),10===n&&(s|=t.EMPTY_END_LINE),t.isWordRune(e)!==t.isWordRune(n)?s|=t.EMPTY_WORD_BOUNDARY:s|=t.EMPTY_NO_WORD_BOUNDARY,s}static quoteMeta(e){return e.split("").map(e=>t.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join("")}static charCount(t){return t>xB.MAX_BMP?2:1}static toArray(t){const e=t.length,n=new Array(e);for(let s=0;s<e;s++)n[s]=t[s];return n}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return LB||(LB=new TextEncoder),LB.encode(t);{let e=[],n=0;for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):(64512&r)===xB.MIN_HIGH_SURROGATE&&s+1<t.length&&(64512&t.charCodeAt(s+1))===xB.MIN_LOW_SURROGATE?(r=xB.MIN_SUPPLEMENTARY_CODE_POINT+((1023&r)<<10)+(1023&t.charCodeAt(++s)),e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder){FB||(FB=new TextDecoder("utf-8"));const e=t instanceof Uint8Array?t:new Uint8Array(t);return FB.decode(e)}{let e=[],n=0,s=0;for(;n<t.length;){let r=t[n++];if(r<128)e[s++]=String.fromCharCode(r);else if(r>191&&r<224){let i=t[n++];e[s++]=String.fromCharCode((31&r)<<6|63&i)}else if(r>239&&r<365){let i=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-xB.MIN_SUPPLEMENTARY_CODE_POINT;e[s++]=String.fromCharCode(xB.MIN_HIGH_SURROGATE+(i>>10)),e[s++]=String.fromCharCode(xB.MIN_LOW_SURROGATE+(1023&i))}else{let i=t[n++],o=t[n++];e[s++]=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o)}}return e.join("")}}};const MB=(t=[],e=0)=>{const n=Object.create(null);for(let s=0;s<t.length;s++){const r=t[s],i=e+s;n[r]=i,n[i]=r}return Object.freeze(n)};var GB=class t{static Encoding=MB(["UTF_16","UTF_8"]);getEncoding(){throw Error("not implemented")}asCharSequence(){throw Error("not implemented")}asBytes(){throw Error("not implemented")}length(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===t.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===t.Encoding.UTF_16}},HB=class extends GB{constructor(t=null){super(),this.bytes=t}getEncoding(){return GB.Encoding.UTF_8}asCharSequence(){return PB.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},UB=class extends GB{constructor(t=null){super(),this.charSequence=t}getEncoding(){return GB.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return PB.stringToUtf8ByteArray(this.charSequence.toString())}length(){return this.charSequence.length}},VB=class{static utf16(t){return new UB(t)}static utf8(t){return PB.isByteArray(t)?new HB(t):new HB(PB.stringToUtf8ByteArray(t))}},jB=class{static EOF(){return-8}constructor(){this.start=0,this.end=0}canCheckPrefix(){return!0}endPos(){return this.end-this.start}hasString(){return!1}hasAnyString(){return!1}prefixLength(){return 0}},$B=class t extends jB{static RUNE_ERROR_STEP=xB.RUNE_ERROR<<3|1;constructor(t,e=0,n=t.length){super(),this.bytes=t,this.start=e,this.end=n}hasString(t,e){const n=t.bytes;if(0===n.length)return!0;const s=this.indexOf(this.bytes,n,this.start+e);return-1!==s&&s<=this.end-n.length}hasAnyString(t,e){return t.automaton8().searchUTF8(this.bytes,this.start+e,this.end)}step(e){if((e+=this.start)>=this.end)return jB.EOF();const n=255&this.bytes[e];if(n<128)return n<<3|1;let s,r,i=128,o=191;if(n>=194&&n<=223)s=2,r=31&n;else if(n>=224&&n<=239)s=3,r=15&n,224===n?i=160:237===n&&(o=159);else{if(!(n>=240&&n<=244))return t.RUNE_ERROR_STEP;s=4,r=7&n,240===n?i=144:244===n&&(o=143)}if(e+s>this.end)return t.RUNE_ERROR_STEP;const a=255&this.bytes[e+1];if(a<i||a>o)return t.RUNE_ERROR_STEP;if(r=r<<6|63&a,s>2){const n=255&this.bytes[e+2];if(128!=(192&n))return t.RUNE_ERROR_STEP;if(r=r<<6|63&n,s>3){const n=255&this.bytes[e+3];if(128!=(192&n))return t.RUNE_ERROR_STEP;r=r<<6|63&n}}return r<<3|s}index(t,e){e+=this.start;const n=this.indexOf(this.bytes,t.prefixUTF8,e);return n<0?n:n-e}context(t){let e=-1;if((t+=this.start)>this.start&&t<=this.end){let n=t-1;if(e=this.bytes[n--],e>=128){let s=t-4;for(s<this.start&&(s=this.start);n>=s&&128==(192&this.bytes[n]);)n--;n<this.start&&(n=this.start);const r=this.step(n-this.start);e=n+(7&r)===t?r>>3:xB.RUNE_ERROR}}const n=t<this.end?this.step(t-this.start)>>3:-1;return PB.emptyOpContext(e,n)}indexOf(t,e,n=0){let s=e.length;if(0===s)return n<=this.end?n:-1;const r=e[0];let i=this.end-s;const o="function"==typeof t.indexOf;let a=n;for(;a<=i;){if(o){if(a=t.indexOf(r,a),-1===a||a>i)return-1}else{for(;a<=i&&t[a]!==r;)a++;if(a>i)return-1}let n=!0;for(let r=1;r<s;r++)if(t[a+r]!==e[r]){n=!1;break}if(n)return a;a++}return-1}prefixLength(t){return t.prefixUTF8.length}},JB=class extends jB{constructor(t,e=0,n=t.length){super(),this.charSequence=t,this.start=e,this.end=n}hasString(t,e){const n=this.charSequence.indexOf(t.str,this.start+e);return-1!==n&&n<=this.end-t.str.length}hasAnyString(t,e){return t.automaton16().searchUTF16(this.charSequence,this.start+e,this.end)}step(t){if((t+=this.start)>=this.end)return jB.EOF();const e=this.charSequence.charCodeAt(t);if(e<xB.MIN_HIGH_SURROGATE||e>xB.MAX_HIGH_SURROGATE||t+1>=this.end)return e<<3|1;const n=this.charSequence.charCodeAt(t+1);return n>=xB.MIN_LOW_SURROGATE&&n<=xB.MAX_LOW_SURROGATE?1024*(e-xB.MIN_HIGH_SURROGATE)+(n-xB.MIN_LOW_SURROGATE)+xB.MIN_SUPPLEMENTARY_CODE_POINT<<3|2:e<<3|1}index(t,e){e+=this.start;const n=this.charSequence.indexOf(t.prefix,e);return n<0||n>this.end-t.prefix.length?-1:n-e}context(t){const e=(t+=this.start)>this.start&&t<=this.end?this.charSequence.charCodeAt(t-1):-1,n=t<this.end?this.charSequence.charCodeAt(t):-1;return PB.emptyOpContext(e,n)}prefixLength(t){return t.prefix.length}},qB=class{static fromUTF8(t,e=0,n=t.length){return new $B(t,e,n)}static fromUTF16(t,e=0,n=t.length){return new JB(t,e,n)}},zB=class extends Error{constructor(t){super(t),this.name="RE2JSException"}},KB=class extends zB{constructor(t,e=null){let n=`error parsing regexp: ${t}`;e&&(n+=`: \`${e}\``),super(n),this.name="RE2JSSyntaxException",this.message=n,this.error=t,this.input=e}getDescription(){return this.error}getPattern(){return this.input}},QB=class extends zB{constructor(t){super(t),this.name="RE2JSCompileException"}},WB=class extends zB{constructor(t){super(t),this.name="RE2JSGroupException"}},YB=class extends zB{constructor(t){super(t),this.name="RE2JSFlagsException"}},XB=class extends zB{constructor(t){super(t),this.name="RE2JSInternalException"}},ZB=class t{static MAX_REPLACER_ARGS=65535;static quoteReplacement(t,e=!1){return e?t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(t=>{const e=t.codePointAt(0);return e===IB.CODES["\\"]||e===IB.CODES.$?`\\${t}`:t}).join(""):t.indexOf("$")<0?t:t.split("").map(t=>t.codePointAt(0)===IB.CODES.$?"$$":t).join("")}constructor(t,e){if(null===t)throw new Error("pattern is null");this.patternInput=t;const n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,this.hasNamedGroups=Object.keys(this.namedGroups).length>0,this.numberOfInstructions=n.numberOfInstructions(),this.lookbehindState=null,e instanceof GB?this.resetMatcherInput(e):PB.isByteArray(e)?this.resetMatcherInput(VB.utf8(e)):this.resetMatcherInput(VB.utf16(e))}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(t){if(null===t)throw new Error("input is null");return t instanceof GB||(t=PB.isByteArray(t)?VB.utf8(t):VB.utf16(t)),this.matcherInput=t,null!==this.lookbehindState?this.lookbehindState.reset():this.lookbehindState=this.patternInput.re2().createLookbehindState(),this.reset(),this}start(t=0){if("string"==typeof t){const e=this.namedGroups[t];if(!Number.isFinite(e))throw new WB(`group '${t}' not found`);t=e}return this.loadGroup(t),this.groups[2*t]}end(t=0){if("string"==typeof t){const e=this.namedGroups[t];if(!Number.isFinite(e))throw new WB(`group '${t}' not found`);t=e}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if("string"==typeof t){const e=this.namedGroups[t];if(!Number.isFinite(e))throw new WB(`group '${t}' not found`);t=e}const e=this.start(t),n=this.end(t);return e<0&&n<0?null:this.substring(e,n)}getNamedGroups(){if(!this.hasMatch)throw new WB("perhaps no match attempted");const t=Object.create(null);for(const e of Object.keys(this.namedGroups))t[e]=this.group(e);return t}groupCount(){return this.patternGroupCount}loadGroup(t){if(!Number.isInteger(t)||t<0||t>this.patternGroupCount)throw new WB(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new WB("perhaps no match attempted");if(0===t||this.hasGroups)return;const e=this.matcherInputLength,n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],e,this.anchorFlag,1+this.patternGroupCount,this.lookbehindState);if(!n[0])throw new WB("inconsistency in matching group data");this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,fB.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,fB.ANCHOR_START)}find(t=null){if(null!==t){if(!Number.isInteger(t)||t<0||t>this.matcherInputLength)throw new WB(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}if(t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1])){const e=(this.matcherInput.isUTF16Encoding()?qB.fromUTF16(this.matcherInput.asCharSequence(),0,this.matcherInputLength):qB.fromUTF8(this.matcherInput.asBytes(),0,this.matcherInputLength)).step(t);e<0?t++:t+=7&e}return this.genMatch(t,fB.UNANCHORED)}genMatch(t,e){const n=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,e,1,this.lookbehindState);return n[0]?(this.groups=n[1],this.hasMatch=!0,this.hasGroups=0===this.patternGroupCount,this.anchorFlag=e,!0):(this.hasMatch=!1,!1)}substring(t,e){return this.matcherInput.isUTF8Encoding()?PB.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,e)):this.matcherInput.asCharSequence().substring(t,e).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,e=!1){let n="";const s=this.start(),r=this.end();return this.appendPos<s&&(n+=this.substring(this.appendPos,s)),this.appendPos=r,n+=e?this.appendReplacementInternalJava(t):this.appendReplacementInternalJs(t),n}appendReplacementInternalJava(t){let e="",n=0;const s=t.length;let r=0;for(;r<s;){const i=t.codePointAt(r);if(i!==IB.CODES["\\"]){if(i===IB.CODES.$){if(n<r&&(e+=t.substring(n,r)),r+1>=s)throw new WB("Illegal group reference: group index is missing");const i=t.codePointAt(r+1);if(IB.CODES[0]<=i&&i<=IB.CODES[9]){let o=i-IB.CODES[0],a=r+2;for(;a<s;a++){const e=t.codePointAt(a);if(e<IB.CODES[0]||e>IB.CODES[9]||10*o+e-IB.CODES[0]>this.patternGroupCount)break;o=10*o+e-IB.CODES[0]}if(o>this.patternGroupCount)throw new WB(`n > number of groups: ${o}`);const B=this.group(o);null!==B&&(e+=B),r=a,n=r}else{if(i!==IB.CODES["{"])throw new WB("Illegal group reference");{let i=r+2;for(;i<s&&t.codePointAt(i)!==IB.CODES["}"];)i++;if(i>=s)throw new WB("named capture group is missing trailing '}'");const o=t.substring(r+2,i),a=this.group(o);null!==a&&(e+=a),r=i+1,n=r}}continue}r++}else{if(n<r&&(e+=t.substring(n,r)),r++,r>=s)throw new WB("character to be escaped is missing");n=r,r++}}return n<s&&(e+=t.substring(n,s)),e}appendReplacementInternalJs(t){const e=t=>t>=48&&t<=57,n=this.patternGroupCount;let s="",r=0;for(;r<t.length;){const i=t.indexOf("$",r);if(i<0)break;s+=t.substring(r,i),r=i;const o=t.charCodeAt(r+1);if(o===IB.CODES.$)s+="$",r+=2;else if(o===IB.CODES["&"])s+=this.group(0),r+=2;else if(o===IB.CODES["`"])s+=this.substring(0,this.start(0)),r+=2;else if(o===IB.CODES["'"])s+=this.substring(this.end(0),this.matcherInputLength),r+=2;else if(e(o)){let i=1,a=o-48;const B=t.charCodeAt(r+2);if(e(B)&&10*a+B-48<=n&&(i=2,a=10*a+B-48),a>=1&&a<=n){const t=this.group(a);null!==t&&(s+=t)}else s+=t.substring(r,r+1+i);r+=1+i}else if(o===IB.CODES["<"]&&this.hasNamedGroups){const e=t.indexOf(">",r+2);if(e<0)s+="$<",r+=2;else{const n=t.substring(r+2,e);if(Object.prototype.hasOwnProperty.call(this.namedGroups,n)){const t=this.group(n);null!==t&&(s+=t)}r=e+1}}else s+="$",r+=1}return s+t.substring(r)}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(t,e=!1){return this.replace(t,!0,e)}replaceFirst(t,e=!1){return this.replace(t,!1,e)}replace(e,n=!0,s=!1){let r="";this.reset();const i="function"==typeof e;let o=null;if(i){if(this.groupCount()>=t.MAX_REPLACER_ARGS)throw new WB("Too many capture groups to safely invoke replacer function");o=this.matcherInput.isUTF8Encoding()?this.matcherInput.asBytes():this.matcherInput.asCharSequence()}for(;this.find()&&(r+=i?this.appendReplacementFunc(e,o):this.appendReplacement(e,s),n););return r+=this.appendTail(),r}appendReplacementFunc(t,e){let n="";const s=this.start(),r=this.end();this.appendPos<s&&(n+=this.substring(this.appendPos,s)),this.appendPos=r;const i=this.matchArray();return i.push(s,e),this.hasNamedGroups&&i.push(this.namedGroupsObject()),n+=String(t(...i)),n}matchArray(){const t=[this.group(0)];for(let e=1;e<=this.patternGroupCount;e++){const n=this.group(e);t.push(null===n?void 0:n)}return t}namedGroupsObject(){if(!this.hasNamedGroups)return;const t=this.getNamedGroups();for(const e in t)null===t[e]&&(t[e]=void 0);return t}},tc=class t{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 LB_WRITE=12;static LB_CHECK=13;static isRuneOp(e){return t.RUNE<=e&&e<=t.RUNE_ANY_NOT_NL}static escapeRunes(t){let e='"';for(let n of t)e+=PB.escapeRune(n);return e+='"',e}constructor(t){this.op=t,this.out=0,this.arg=0,this.runes=new Int32Array(0),this.next=null}matchRune(t){if(1===this.runes.length){const e=this.runes[0];return 0!==(this.arg&fB.FOLD_CASE)?xB.equalsIgnoreCase(e,t):t===e}const e=this.runes.length;if(0===e)return!1;if(2===e||4===e||6===e||8===e){for(let n=0;n<e;n+=2){if(t<this.runes[n])return!1;if(t<=this.runes[n+1])return!0}return!1}let n=0,s=e>>1;for(;s>1;){const e=s>>1;n+=this.runes[n+e<<1]<=t?e:0,s-=e}n+=this.runes[n<<1]<=t?1:0;const r=n-1;return r>=0&&t<=this.runes[r<<1|1]}matchRunePos(t){if(1===this.runes.length){const e=this.runes[0];return 0!==(this.arg&fB.FOLD_CASE)?xB.equalsIgnoreCase(e,t)?0:-1:t===e?0:-1}const e=this.runes.length;if(0===e)return-1;if(2===e||4===e||6===e||8===e){for(let n=0;n<e;n+=2){if(t<this.runes[n])return-1;if(t<=this.runes[n+1])return Math.floor(n/2)}return-1}let n=0,s=e>>1;for(;s>1;){const e=s>>1;n+=this.runes[n+e<<1]<=t?e:0,s-=e}n+=this.runes[n<<1]<=t?1:0;const r=n-1;return r>=0&&t<=this.runes[r<<1|1]?r:-1}toString(){switch(this.op){case t.ALT:return`alt -> ${this.out}, ${this.arg}`;case t.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case t.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case t.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case t.MATCH:return"match"+(0!==this.arg?` ${this.arg}`:"");case t.FAIL:return"fail";case t.NOP:return`nop -> ${this.out}`;case t.LB_WRITE:return`lbwrite ${this.arg} -> ${this.out}`;case t.LB_CHECK:return`lbcheck ${this.arg} -> ${this.out}`;case t.RUNE:return null===this.runes?"rune <null>":["rune ",t.escapeRunes(this.runes),0!==(this.arg&fB.FOLD_CASE)?"/i":""," -> ",this.out].join("");case t.RUNE1:return`rune1 ${t.escapeRunes(this.runes)} -> ${this.out}`;case t.RUNE_ANY:return`any -> ${this.out}`;case t.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},ec=class t{constructor(t){this.sparse=new Int32Array(t),this.densePcs=new Int32Array(t),this.denseCaps=null,this.size=0,this.ncap=0,this.mainThreads=0}static INITIAL_THREADS=32;init(e){this.ncap=e;const n=Math.min(this.densePcs.length,t.INITIAL_THREADS)*e;(!this.denseCaps||this.denseCaps.length<n)&&(this.denseCaps=new Int32Array(n))}growCaps(t){const e=this.densePcs.length*this.ncap,n=new Int32Array(Math.min(e,Math.max(t,2*this.denseCaps.length)));n.set(this.denseCaps),this.denseCaps=n}contains(t){const e=this.sparse[t];return e<this.size&&this.densePcs[e]===t}isEmpty(){return 0===this.size}add(t){const e=this.size++;return this.sparse[t]=e,this.densePcs[e]=t,e}clear(){this.size=0,this.mainThreads=0}toString(){let t="{";for(let e=0;e<this.size;e++)0!==e&&(t+=", "),t+=this.densePcs[e];return t+="}",t}},nc=class{constructor(t){this.pos=-1,this.pcs=new Int32Array(t.numInst()),this.size=0,this.lbTable=new Int32Array(t.numLb+1)}reset(){this.pos=-1,this.size=0}},sc=class t{static fromRE2(e){const n=new t;return n.prog=e.prog,n.re2=e,n.q0=new ec(n.prog.numInst()),n.q1=new ec(n.prog.numInst()),n.addStack=new Int32Array(2*(n.prog.numInst()+1)),n.matched=!1,n.matchcap=new Int32Array(n.prog.numCap<2?2:n.prog.numCap),n.ncap=0,n}constructor(){this.prog=null,this.re2=null,this.q0=null,this.q1=null,this.addStack=null,this.matched=!1,this.matchcap=null,this.ncap=0,this.lbTable=null}init(t){this.ncap=t,t>this.matchcap.length?this.matchcap=new Int32Array(t).fill(-1):this.matchcap.fill(-1),this.q0.init(t),this.q1.init(t),this.prog.numLb>0&&((!this.lbTable||this.lbTable.length<this.prog.numLb+1)&&(this.lbTable=new Int32Array(this.prog.numLb+1)),this.lbTable.fill(-1))}submatches(){return 0===this.ncap?PB.emptyInts():PB.toArray(this.matchcap.subarray(0,this.ncap))}match(t,e,n,s=null){const r=this.re2.cond;if(r===PB.EMPTY_ALL)return!1;if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==e)return!1;this.matched=!1,this.matchcap.fill(-1);const i=this.prog.numLb>0,o=e;let a=e,B=!1;i&&(null!==s&&s.pos>=0&&s.pos<=e?(a=s.pos,B=!0):a=0);let c,l=i&&null!==s,u=this.q0,h=this.q1,d=t.step(a),p=d>>3,f=7&d,C=-1,g=0;for(d!==jB.EOF()&&(d=t.step(a+f),C=d>>3,g=7&d),c=0===a?PB.emptyOpContext(-1,p):t.context(a),i&&(B?this.restoreLookbehinds(s,u,c):this.spawnLookbehinds(u,a,c));;){if(0===u.mainThreads){if(0!==(r&PB.EMPTY_BEGIN_TEXT)&&0!==a)break;if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==a)break;if(this.matched)break;if(0===this.prog.numLb&&u.isEmpty()&&0!==this.re2.prefix.length&&C!==this.re2.prefixRune&&t.canCheckPrefix()){const e=t.index(this.re2,a);if(e<0)break;a+=e,d=t.step(a),p=d>>3,f=7&d,d=t.step(a+f),C=d>>3,g=7&d,c=t.context(a)}}a>=o&&(l&&(this.saveLookbehinds(s,u,a),l=!1),this.matched||0!==a&&n!==fB.UNANCHORED||(this.ncap>0&&(this.matchcap[0]=a),this.add(u,this.prog.start,a,this.matchcap,0,c)));const e=a+f;if(c=t.context(e),this.step(u,h,a,e,p,c,n,a===t.endPos()),0===f)break;if(0===this.ncap&&this.matched)break;a+=f,p=C,f=g,-1!==p&&(d=t.step(a+f),C=d>>3,g=7&d);const i=u;u=h,h=i}return u.clear(),h.clear(),this.matched}matchSet(t,e,n){const s=this.re2.cond;if(s===PB.EMPTY_ALL)return[];if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==e)return[];let r=this.prog.numLb>0?0:e,i=e,o=this.q0,a=this.q1,B=t.step(r),c=B>>3,l=7&B,u=-1,h=0;B!==jB.EOF()&&(B=t.step(r+l),u=B>>3,h=7&B);let d=0===r?PB.emptyOpContext(-1,c):t.context(r);const p=new Set;for(this.prog.numLb>0&&this.spawnLookbehinds(o,r,d);;){if(0===o.mainThreads){if(0!==(s&PB.EMPTY_BEGIN_TEXT)&&0!==r)break;if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==r)break}0!==r&&n!==fB.UNANCHORED||r>=i&&this.add(o,this.prog.start,r,this.matchcap,0,d);const e=r+l;d=t.context(e);for(let s=0;s<o.size;s++){const i=o.densePcs[s],B=this.prog.inst[i],l=s*this.ncap;let u=!1;switch(B.op){case tc.MATCH:if(n===fB.ANCHOR_BOTH&&r!==t.endPos())break;p.add(B.arg);break;case tc.RUNE:u=B.matchRune(c);break;case tc.RUNE1:u=c===B.runes[0];break;case tc.RUNE_ANY:u=!0;break;case tc.RUNE_ANY_NOT_NL:u=10!==c;break;default:continue}u&&this.add(a,B.out,e,o.denseCaps,l,d)}if(o.clear(),0===l)break;r+=l,c=u,l=h,-1!==c&&(B=t.step(r+l),u=B>>3,h=7&B);const f=o;o=a,a=f}return a.clear(),Array.from(p).sort((t,e)=>t-e)}step(t,e,n,s,r,i,o,a){const B=this.re2.longest;for(let c=0;c<t.size;c++){const l=t.densePcs[c],u=c*this.ncap;if(B&&this.matched&&this.ncap>0&&this.matchcap[0]<t.denseCaps[u])continue;const h=this.prog.inst[l];let d=!1;switch(h.op){case tc.MATCH:if(o===fB.ANCHOR_BOTH&&!a)break;if(this.ncap>0&&(!B||!this.matched||this.matchcap[1]<n)){t.denseCaps[u+1]=n;for(let e=0;e<this.ncap;e++)this.matchcap[e]=t.denseCaps[u+e]}B||(t.size=0),this.matched=!0;break;case tc.RUNE:d=h.matchRune(r);break;case tc.RUNE1:d=r===h.runes[0];break;case tc.RUNE_ANY:d=!0;break;case tc.RUNE_ANY_NOT_NL:d=10!==r;break;default:continue}d&&this.add(e,h.out,s,t.denseCaps,u,i)}t.clear()}spawnLookbehinds(t,e,n){for(let s=0;s<this.prog.lbStarts.length;s++)this.add(t,this.prog.lbStarts[s],e,this.matchcap,0,n)}restoreLookbehinds(t,e,n){this.lbTable.set(t.lbTable);for(let s=0;s<t.size;s++)this.add(e,t.pcs[s],t.pos,this.matchcap,0,n)}saveLookbehinds(t,e,n){let s=0;for(let n=0;n<e.size;n++){const r=e.densePcs[n];1===this.prog.lbInst[r]&&tc.isRuneOp(this.prog.inst[r].op)&&(t.pcs[s++]=r)}t.size=s,t.pos=n,t.lbTable.set(this.lbTable)}add(t,e,n,s,r,i){const o=this.addStack;let a=0;for(;;){for(;0!==e&&!t.contains(e);){const B=t.add(e),c=this.prog.inst[e];switch(c.op){case tc.FAIL:e=0;break;case tc.ALT:case tc.ALT_MATCH:o[a++]=c.arg,o[a++]=0,e=c.out;break;case tc.EMPTY_WIDTH:e=0===(c.arg&~i)?c.out:0;break;case tc.NOP:e=c.out;break;case tc.CAPTURE:c.arg<this.ncap&&(o[a++]=-c.arg-1,o[a++]=s[r+c.arg],s[r+c.arg]=n),e=c.out;break;case tc.LB_WRITE:this.lbTable[Math.abs(c.arg)]=n,e=c.out;break;case tc.LB_CHECK:e=c.arg>0?this.lbTable[c.arg]===n?c.out:0:this.lbTable[-c.arg]!==n?c.out:0;break;case tc.MATCH:case tc.RUNE:case tc.RUNE1:case tc.RUNE_ANY:case tc.RUNE_ANY_NOT_NL:if(0===this.prog.lbInst[e]&&t.mainThreads++,this.ncap>0){const e=B*this.ncap;e+this.ncap>t.denseCaps.length&&t.growCaps(e+this.ncap);for(let n=0;n<this.ncap;n++)t.denseCaps[e+n]=s[r+n]}e=0;break;default:throw new XB("unhandled")}}if(0===a)return;a-=2;const B=o[a];B<0?(s[r-B-1]=o[a+1],e=0):e=B}}};const rc=(t,e)=>{if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0},ic=(t,e,n,s)=>t.flag===n&&rc(t.nfaStates,e)&&rc(t.matchIDs,s),oc=[];var ac=class{constructor(t,e,n){this.nfaStates=t,this.flag=e,this.isMatch=0!==(e&Bc.FLAG_MATCH),this.matchIDs=n,this.next=null,this.nextAnchored=null}},Bc=class t{static FLAG_EMPTY_MASK=255;static FLAG_MATCH=256;static FLAG_LAST_WORD=512;static FLAG_NEED_SHIFT=16;static STATE_OVERHEAD=150;static ARRAY_OVERHEAD=40;static ELEMENT_SIZE=8;static TABLE_OVERHEAD=48;static PROGRESS_PER_STATE=10;constructor(t,e=8388608){this.prog=t,this.maxMem=e,this.stateCache=new Map,this.stateCount=0,this.startStates=new Map,this.failed=!1;for(let e=0;e<t.numInst();e++){const n=t.getInst(e).op;if(n===tc.LB_WRITE||n===tc.LB_CHECK){this.failed=!0;break}}this.computeRuneClasses(),this.stateBudget=e,this.memBudget=e}computeRuneClasses(){const t=new Set,e=(e,n)=>{t.add(e),t.add(n+1)};for(let t=0;t<this.prog.numInst();t++){const n=this.prog.getInst(t);switch(n.op){case tc.RUNE:case tc.RUNE1:if(1===n.runes.length){if(e(n.runes[0],n.runes[0]),0!==(n.arg&fB.FOLD_CASE))for(let t=xB.simpleFold(n.runes[0]);t!==n.runes[0];t=xB.simpleFold(t))e(t,t)}else for(let t=0;t<n.runes.length;t+=2)e(n.runes[t],n.runes[t+1]);break;case tc.RUNE_ANY_NOT_NL:e(10,10);break;case tc.EMPTY_WIDTH:0!==(n.arg&(PB.EMPTY_BEGIN_LINE|PB.EMPTY_END_LINE))&&e(10,10),0!==(n.arg&(PB.EMPTY_WORD_BOUNDARY|PB.EMPTY_NO_WORD_BOUNDARY))&&(e(48,57),e(65,90),e(95,95),e(97,122))}}t.delete(0),this.classBounds=Int32Array.from(t).sort(),this.numClasses=this.classBounds.length+1;const n=new Int32Array(xB.MAX_LATIN1+1);for(let t=0;t<=xB.MAX_LATIN1;t++)n[t]=this.searchClass(t);this.latin1Class=n}runeClass(t){return t<=xB.MAX_LATIN1?this.latin1Class[t]:this.searchClass(t)}searchClass(t){const e=this.classBounds;let n=0,s=e.length;for(;n<s;){const r=n+s>>1;e[r]<=t?n=r+1:s=r}return n}closure(t,e){const n=new Set,s=Array.from(t);let r=0;for(;s.length>0;){const t=s.pop();if(0===t||n.has(t))continue;n.add(t);const i=this.prog.getInst(t);switch(i.op){case tc.ALT:case tc.ALT_MATCH:s.push(i.out),s.push(i.arg);break;case tc.NOP:case tc.CAPTURE:s.push(i.out);break;case tc.EMPTY_WIDTH:r|=i.arg,0===(i.arg&~e)&&s.push(i.out)}}return{pcs:Array.from(n).sort((t,e)=>t-e),needflags:r}}getState(e,n,s){const r=((t,e,n)=>{let s=-2128831035;for(let e=0;e<t.length;e++)s^=t[e],s=Math.imul(s,16777619);s^=e,s=Math.imul(s,16777619);for(let t=0;t<n.length;t++)s^=n[t],s=Math.imul(s,16777619);return s})(e,n,s),i=this.stateCache.get(r);if(i instanceof ac){if(ic(i,e,n,s))return i}else if(void 0!==i)for(let t=0;t<i.length;t++)if(ic(i[t],e,n,s))return i[t];const o=t.stateCost(e,s);if(this.memBudget<o)return null;this.memBudget-=o;const a=new ac(e,n,s);return void 0===i?this.stateCache.set(r,a):i instanceof ac?this.stateCache.set(r,[i,a]):i.push(a),this.stateCount++,a}static stateCost(e,n){const s=0===n.length?0:t.ARRAY_OVERHEAD+t.ELEMENT_SIZE*n.length;return t.STATE_OVERHEAD+t.ELEMENT_SIZE*e.length+s}*cachedStates(){for(const t of this.stateCache.values())t instanceof ac?yield t:yield*t}makeState(e,n,s){const r=this.closure(e,n&t.FLAG_EMPTY_MASK);let i=n;return 0===r.needflags&&(i&=t.FLAG_MATCH),i|=r.needflags<<t.FLAG_NEED_SHIFT,this.getState(r.pcs,i,s)}allocTable(e,n){const s=this.numClasses+1,r=t.TABLE_OVERHEAD+t.ELEMENT_SIZE*s;if(this.memBudget<r)return null;this.memBudget-=r;const i=new Array(s).fill(null);return n===fB.UNANCHORED?e.next=i:e.nextAnchored=i,i}clearCache(){this.stateCache.clear(),this.stateCount=0,this.startStates.clear(),this.memBudget=this.stateBudget}resetCache(t){return this.clearCache(),this.getState(t.nfaStates,t.flag,t.matchIDs)}step(e,n,s,r){let i=r===fB.UNANCHORED?e.next:e.nextAnchored;if(null!==i){const t=i[n];if(null!==t)return t}else if(i=this.allocTable(e,r),null===i)return null;const o=e.flag>>>t.FLAG_NEED_SHIFT,a=e.flag&t.FLAG_EMPTY_MASK;let B=a,c=0;10===s&&(B|=PB.EMPTY_END_LINE,c|=PB.EMPTY_BEGIN_LINE),-1===s&&(B|=PB.EMPTY_END_LINE|PB.EMPTY_END_TEXT);const l=0!==(e.flag&t.FLAG_LAST_WORD),u=-1!==s&&PB.isWordRune(s);B|=u===l?PB.EMPTY_NO_WORD_BOUNDARY:PB.EMPTY_WORD_BOUNDARY;let h=e.nfaStates;0!==(B&~a&o)&&(h=this.closure(h,B).pcs);const d=[];let p=!1,f=oc;for(let t=0;t<h.length;t++){const e=this.prog.getInst(h[t]);e.op===tc.MATCH?(p||(p=!0,f=[]),f.push(e.arg)):-1!==s&&tc.isRuneOp(e.op)&&e.matchRune(s)&&d.push(e.out)}f.length>1&&f.sort((t,e)=>t-e),r===fB.UNANCHORED&&-1!==s&&d.push(this.prog.start);let C=c;p&&(C|=t.FLAG_MATCH),u&&(C|=t.FLAG_LAST_WORD);const g=this.makeState(d,C,f);return null===g?null:(i[n]=g,g)}start(e,n){const s=e.context(n);let r;if(0!==(s&PB.EMPTY_BEGIN_TEXT))r=PB.EMPTY_BEGIN_TEXT|PB.EMPTY_BEGIN_LINE;else if(0!==(s&PB.EMPTY_BEGIN_LINE))r=PB.EMPTY_BEGIN_LINE;else{const i=e.step(n),o=i>=0&&PB.isWordRune(i>>3);r=0!==(s&PB.EMPTY_WORD_BOUNDARY)!==o?t.FLAG_LAST_WORD:0}let i=this.startStates.get(r);if(void 0===i){if(i=this.makeState([this.prog.start],r,oc),null===i&&(this.clearCache(),i=this.makeState([this.prog.start],r,oc),null===i))return null;this.startStates.set(r,i)}return i}stepOrReset(e,n,s,r,i,o){let a=this.step(e,n,s,r);if(null!==a)return a;if(o.resetPos>=0&&i-o.resetPos<t.PROGRESS_PER_STATE*this.stateCount)return null;o.resetPos=i;const B=this.resetCache(e);return null===B?null:(a=this.step(B,n,s,r),a)}run(t,e,n,s,r){const i=t.endPos(),o=this.latin1Class,a=n===fB.UNANCHORED,B={resetPos:-1};let c=e;for(;c<i;){const e=t.step(c),i=e>>3,l=7&e;if(0===l)break;const u=i<=xB.MAX_LATIN1?o[i]:this.runeClass(i);let h=a&&null!==s.next?s.next[u]:null;if(null===h&&(h=this.stepOrReset(s,u,i,n,c,B),null===h))return null;if((s=h).isMatch&&r(s,!1))return!0;if(!a&&0===s.nfaStates.length)return!1;c+=l}return null===(s=this.stepOrReset(s,this.numClasses,-1,n,c,B))?null:s.isMatch&&r(s,!0)}match(t,e,n){if(this.failed)return null;if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==e)return!1;const s=this.start(t,e);return null===s?null:this.run(t,e,n,s,(t,e)=>n!==fB.ANCHOR_BOTH||e)}matchSet(t,e,n){if(this.failed)return null;if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==e)return[];const s=this.start(t,e);if(null===s)return null;const r=new Set;return null===this.run(t,e,n,s,(t,e)=>{if(n!==fB.ANCHOR_BOTH||e)for(let e=0;e<t.matchIDs.length;e++)r.add(t.matchIDs[e]);return!1})?null:Array.from(r).sort((t,e)=>t-e)}};var cc=class{constructor(){this.end=0,this.cap=new Int32Array(0),this.matchcap=new Int32Array(0),this.ncap=0,this.jobPc=new Int32Array(256),this.jobArg=new Uint8Array(256),this.jobPos=new Int32Array(256),this.jobLen=0,this.visited=new Uint32Array(0)}reset(t,e,n){this.end=e,this.jobLen=0,this.ncap=n;const s=t.numInst()*(e+1)+32-1>>>5;this.visited.length<s?this.visited=new Uint32Array(s):this.visited.fill(0,0,s),this.cap.length<n?this.cap=new Int32Array(n).fill(-1):this.cap.fill(-1,0,n),this.matchcap.length<n?this.matchcap=new Int32Array(n).fill(-1):this.matchcap.fill(-1,0,n)}shouldVisit(t,e){const n=t*(this.end+1)+e,s=n>>>5,r=1<<(31&n);return 0===(this.visited[s]&r)&&(this.visited[s]|=r,!0)}push(t,e,n,s){if(t.prog.getInst(e).op!==tc.FAIL&&(s||this.shouldVisit(e,n))){if(this.jobLen>=this.jobPc.length){const t=2*this.jobPc.length,e=new Int32Array(t);e.set(this.jobPc),this.jobPc=e;const n=new Uint8Array(t);n.set(this.jobArg),this.jobArg=n;const s=new Int32Array(t);s.set(this.jobPos),this.jobPos=s}this.jobPc[this.jobLen]=e,this.jobArg[this.jobLen]=s?1:0,this.jobPos[this.jobLen]=n,this.jobLen++}}tryBacktrack(t,e,n,s,r){const i=t.longest;for(this.push(t,n,s,!1);this.jobLen>0;){this.jobLen--;let n=this.jobPc[this.jobLen],s=1===this.jobArg[this.jobLen],o=this.jobPos[this.jobLen],a=!0;for(;a||this.shouldVisit(n,o);){a=!1;const B=t.prog.getInst(n);switch(B.op){case tc.FAIL:break;case tc.ALT:if(s){s=!1,n=B.arg;continue}this.push(t,n,o,!0),n=B.out;continue;case tc.ALT_MATCH:{const e=t.prog.getInst(B.out);if(tc.isRuneOp(e.op)){this.push(t,B.arg,o,!1),n=B.arg,o=this.end;continue}this.push(t,B.out,this.end,!1),n=B.out;continue}case tc.RUNE:{const t=e.step(o);if(t===jB.EOF())break;if(!B.matchRune(t>>3))break;o+=7&t,n=B.out;continue}case tc.RUNE1:{const t=e.step(o);if(t===jB.EOF())break;if(t>>3!==B.runes[0])break;o+=7&t,n=B.out;continue}case tc.RUNE_ANY_NOT_NL:{const t=e.step(o);if(t===jB.EOF())break;if(t>>3==10)break;o+=7&t,n=B.out;continue}case tc.RUNE_ANY:{const t=e.step(o);if(t===jB.EOF())break;o+=7&t,n=B.out;continue}case tc.CAPTURE:if(s){this.cap[B.arg]=o;break}B.arg<this.ncap&&(this.push(t,n,this.cap[B.arg],!0),this.cap[B.arg]=o),n=B.out;continue;case tc.EMPTY_WIDTH:{const t=e.context(o);if(0!==(B.arg&~t))break;n=B.out;continue}case tc.NOP:n=B.out;continue;case tc.MATCH:{if(r===fB.ANCHOR_BOTH&&o!==this.end)break;if(0===this.ncap)return!0;this.ncap>1&&(this.cap[1]=o);const t=this.matchcap[1];if((-1===t||i&&o>0&&o>t)&&this.matchcap.set(this.cap),!i)return!0;if(o===this.end)return!0;break}case tc.LB_WRITE:case tc.LB_CHECK:throw new XB("Backtracker cannot evaluate Lookbehind instructions");default:throw new XB("bad inst")}break}}return i&&this.matchcap.length>1&&this.matchcap[1]>=0}};const lc=[];var uc=class t{static shouldBacktrack(t){return t.numInst()<=500}static maxBitStateLen(e){return t.shouldBacktrack(e)?Math.floor(262144/e.numInst()):0}static execute(t,e,n,s,r){const i=t.cond;if(i===PB.EMPTY_ALL)return null;if((s===fB.ANCHOR_START||s===fB.ANCHOR_BOTH)&&0!==n)return null;if(0!==(i&PB.EMPTY_BEGIN_TEXT)&&0!==n)return null;const o=lc.length>0?lc.pop():new cc,a=e.endPos();o.reset(t.prog,a,r);let B=!1;if(0!==(i&PB.EMPTY_BEGIN_TEXT)||s===fB.ANCHOR_START||s===fB.ANCHOR_BOTH)o.ncap>0&&(o.cap[0]=n),o.tryBacktrack(t,e,t.prog.start,n,s)&&(B=!0);else{let r=-1;for(;n<=a&&0!==r;n+=r){if(t.prefix.length>0){const s=e.index(t,n);if(s<0)break;n+=s}if(o.ncap>0&&(o.cap[0]=n),o.tryBacktrack(t,e,t.prog.start,n,s)){B=!0;break}const i=e.step(n);r=i===jB.EOF()?0:7&i}}if(!B)return lc.push(o),null;const c=0===r?[]:PB.toArray(o.matchcap.subarray(0,r));return lc.push(o),c}},hc=class{constructor(t){this.sparse=new Uint32Array(t),this.dense=new Uint32Array(t),this.size=0,this.nextIndex=0}empty(){return this.nextIndex>=this.size}next(){return this.dense[this.nextIndex++]}clear(){this.size=0,this.nextIndex=0}contains(t){return t<this.sparse.length&&this.sparse[t]<this.size&&this.dense[this.sparse[t]]===t}insert(t){this.contains(t)||this.insertNew(t)}insertNew(t){t>=this.sparse.length||(this.sparse[t]=this.size,this.dense[this.size]=t,this.size++)}};var dc=class{constructor(t){this.start=t.start,this.numCap=t.numCap,this.inst=new Array(t.inst.length);for(let e=0;e<t.inst.length;e++){const n=t.inst[e],s=new tc(n.op);s.out=n.out,s.arg=n.arg,s.runes=n.runes?new Int32Array(n.runes):new Int32Array(0),s.next=null,this.inst[e]=s}}};var pc=class t{static compile(t){if(0===t.start)return null;if(t.numLb>0)return null;const e=t.inst[t.start];if(e.op!==tc.EMPTY_WIDTH||0===(e.arg&PB.EMPTY_BEGIN_TEXT))return null;let n=!1;for(let e=0;e<t.inst.length;e++)if(t.inst[e].op===tc.ALT||t.inst[e].op===tc.ALT_MATCH){n=!0;break}for(let e=0;e<t.inst.length;e++){const s=t.inst[e],r=t.inst[s.out].op;switch(s.op){case tc.ALT:case tc.ALT_MATCH:if(r===tc.MATCH||t.inst[s.arg].op===tc.MATCH)return null;break;case tc.EMPTY_WIDTH:if(r===tc.MATCH){if((s.arg&PB.EMPTY_END_TEXT)===PB.EMPTY_END_TEXT)continue;return null}break;default:if(r===tc.MATCH&&n)return null}}let s=(t=>{const e=new dc(t);for(let t=0;t<e.inst.length;t++){const n=e.inst[t];if(n.op!==tc.ALT&&n.op!==tc.ALT_MATCH)continue;let s="out",r="arg",i=e.inst[n[r]];if(i.op!==tc.ALT&&i.op!==tc.ALT_MATCH&&(s="arg",r="out",i=e.inst[n[r]],i.op!==tc.ALT&&i.op!==tc.ALT_MATCH))continue;const o=e.inst[n[s]];if(o.op===tc.ALT||o.op===tc.ALT_MATCH)continue;let a="out",B="arg",c=!1;i.out===t?c=!0:i.arg===t&&(c=!0,a="arg",B="out"),c&&(i[a]=n[s]),n[s]===i[a]&&(n[r]=i[B])}return e})(t);return s=(t=>{if(t.inst.length>=1e3)return null;const e=new hc(t.inst.length),n=new hc(t.inst.length),s=new Array(t.inst.length),r=new Array(t.inst.length).fill(!1),i=o=>{let a=!0;const B=t.inst[o];if(n.contains(o))return!0;switch(n.insert(o),B.op){case tc.ALT:case tc.ALT_MATCH:{a=i(B.out)&&i(B.arg);let t=r[B.out],e=r[B.arg];if(t&&e)return!1;if(e){const n=B.out;B.out=B.arg,B.arg=n;const s=t;t=e,e=s}t&&(r[o]=!0,B.op=tc.ALT_MATCH);const n=((t,e,n,s)=>{const r=t.length,i=e.length;let o=0,a=0;const B=[],c=[];let l=!0,u=-1;const h=r=>{const i=r?t:e,l=r?o:a,h=r?n:s;return!(u>0&&i[l]<=B[u]||(B.push(i[l],i[l+1]),r?o+=2:a+=2,u+=2,c.push(h),0))};for(;o<r||a<i;)if(l=a>=i?h(!0):o>=r||e[a]<t[o]?h(!1):h(!0),!l)return null;return{merged:B,next:c}})(s[B.out]||[],s[B.arg]||[],B.out,B.arg);if(!n)return!1;s[o]=new Int32Array(n.merged),B.next=new Uint32Array(n.next);break}case tc.CAPTURE:case tc.EMPTY_WIDTH:case tc.NOP:a=i(B.out),r[o]=r[B.out],s[o]=s[B.out]?new Int32Array(s[B.out]):new Int32Array(0),B.next=new Uint32Array(Math.floor(s[o].length/2)+1).fill(B.out);break;case tc.MATCH:case tc.FAIL:r[o]=B.op===tc.MATCH;break;case tc.RUNE:{if(r[o]=!1,B.next&&B.next.length>0)break;if(e.insert(B.out),!B.runes||0===B.runes.length){s[o]=new Int32Array(0),B.next=new Uint32Array([B.out]);break}let t=[];if(1===B.runes.length&&0!==(B.arg&fB.FOLD_CASE)){const e=B.runes[0];t.push(e,e);for(let n=xB.simpleFold(e);n!==e;n=xB.simpleFold(n))t.push(n,n);t.sort((t,e)=>t-e)}else for(let e=0;e<B.runes.length;e++)t.push(B.runes[e]);s[o]=new Int32Array(t),B.next=new Uint32Array(Math.floor(t.length/2)+1).fill(B.out),B.op=tc.RUNE;break}case tc.RUNE1:{if(r[o]=!1,B.next&&B.next.length>0)break;e.insert(B.out);let t=[];if(0!==(B.arg&fB.FOLD_CASE)){const e=B.runes[0];t.push(e,e);for(let n=xB.simpleFold(e);n!==e;n=xB.simpleFold(n))t.push(n,n);t.sort((t,e)=>t-e)}else t.push(B.runes[0],B.runes[0]);s[o]=new Int32Array(t),B.next=new Uint32Array(Math.floor(t.length/2)+1).fill(B.out),B.op=tc.RUNE;break}case tc.RUNE_ANY:if(r[o]=!1,B.next&&B.next.length>0)break;e.insert(B.out),s[o]=new Int32Array([0,xB.MAX_RUNE]),B.next=new Uint32Array([B.out]);break;case tc.RUNE_ANY_NOT_NL:if(r[o]=!1,B.next&&B.next.length>0)break;e.insert(B.out),s[o]=new Int32Array([0,9,11,xB.MAX_RUNE]),B.next=new Uint32Array(Math.floor(s[o].length/2)+1).fill(B.out)}return a};for(e.clear(),e.insert(t.start);!e.empty();)if(n.clear(),!i(e.next()))return null;for(let e=0;e<t.inst.length;e++)s[e]&&(t.inst[e].runes=s[e]);return t})(s),null!==s&&((t,e)=>{for(let n=0;n<e.inst.length;n++){const s=e.inst[n];switch(s.op){case tc.ALT:case tc.ALT_MATCH:case tc.RUNE:break;case tc.CAPTURE:case tc.EMPTY_WIDTH:case tc.NOP:case tc.MATCH:case tc.FAIL:t.inst[n].next=null;break;case tc.RUNE1:case tc.RUNE_ANY:case tc.RUNE_ANY_NOT_NL:t.inst[n].next=null,t.inst[n].op=s.op,t.inst[n].runes=s.runes?new Int32Array(s.runes):new Int32Array(0)}}})(s,t),s}static next(t,e){const n=t.matchRunePos(e);return n>=0?t.next[n]:t.op===tc.ALT_MATCH?t.out:0}static execute(e,n,s,r,i){const o=e.onepass;if(!o)return null;const a=new Int32Array(i).fill(-1);let B=!1,c=n.step(s),l=c>>3,u=7&c,h=jB.EOF(),d=-1,p=0;c!==jB.EOF()&&(h=n.step(s+u),h!==jB.EOF()&&(d=h>>3,p=7&h));let f,C=0===s?PB.emptyOpContext(-1,l):n.context(s),g=o.start;for(;;){switch(f=o.inst[g],g=f.out,f.op){case tc.MATCH:return r===fB.ANCHOR_BOTH&&s!==n.endPos()?null:(B=!0,a.length>0&&(a[0]=0,a[1]=s),0===i?[]:PB.toArray(a));case tc.RUNE:if(!f.matchRune(l))return null;break;case tc.RUNE1:if(l!==f.runes[0])return null;break;case tc.RUNE_ANY:break;case tc.RUNE_ANY_NOT_NL:if(10===l)return null;break;case tc.ALT:case tc.ALT_MATCH:g=t.next(f,l);continue;case tc.FAIL:return null;case tc.NOP:continue;case tc.EMPTY_WIDTH:if(0!==(f.arg&~C))return null;continue;case tc.CAPTURE:f.arg<a.length&&(a[f.arg]=s);continue;default:throw new XB("bad inst")}if(0===u)break;C=PB.emptyOpContext(l,d),s+=u,l=d,u=p,-1!==l&&(h=n.step(s+u),h!==jB.EOF()?(d=h>>3,p=7&h):(d=-1,p=0))}return B?0===i?[]:PB.toArray(a):null}},fc=class t{static Op=MB(["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","PLB","NLB","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(e){return e>=t.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(t){return t===IB.CODES["-"]?"\\":""}static fromRegexp(e){const n=new t(e.op);return n.flags=e.flags,n.subs=e.subs,n.runes=e.runes,n.cap=e.cap,n.min=e.min,n.max=e.max,n.name=e.name,n.namedGroups=e.namedGroups,n.lb=e.lb,n}constructor(e){this.op=e,this.flags=0,this.subs=t.emptySubs(),this.runes=new Int32Array(0),this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}reinit(){this.flags=0,this.subs=t.emptySubs(),this.runes=new Int32Array(0),this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}toString(){return this.appendTo()}appendTo(){let e="";switch(this.op){case t.Op.NO_MATCH:e+="[^\\x00-\\x{10FFFF}]";break;case t.Op.EMPTY_MATCH:e+="(?:)";break;case t.Op.STAR:case t.Op.PLUS:case t.Op.QUEST:case t.Op.REPEAT:{const n=this.subs[0];switch(n.op>t.Op.CAPTURE||n.op===t.Op.LITERAL&&n.runes.length>1?e+=`(?:${n.appendTo()})`:e+=n.appendTo(),this.op){case t.Op.STAR:e+="*";break;case t.Op.PLUS:e+="+";break;case t.Op.QUEST:e+="?";break;case t.Op.REPEAT:e+=`{${this.min}`,this.min!==this.max&&(e+=",",this.max>=0&&(e+=this.max)),e+="}"}0!==(this.flags&fB.NON_GREEDY)&&(e+="?");break}case t.Op.CONCAT:for(let n of this.subs)n.op===t.Op.ALTERNATE?e+=`(?:${n.appendTo()})`:e+=n.appendTo();break;case t.Op.ALTERNATE:{let t="";for(let n of this.subs)e+=t,t="|",e+=n.appendTo();break}case t.Op.LITERAL:0!==(this.flags&fB.FOLD_CASE)&&(e+="(?i:");for(let t of this.runes)e+=PB.escapeRune(t);0!==(this.flags&fB.FOLD_CASE)&&(e+=")");break;case t.Op.ANY_CHAR_NOT_NL:e+="(?-s:.)";break;case t.Op.ANY_CHAR:e+="(?s:.)";break;case t.Op.PLB:e+=`(?<=${this.subs[0].appendTo()})`;break;case t.Op.NLB:e+=`(?<!${this.subs[0].appendTo()})`;break;case t.Op.CAPTURE:null===this.name||0===this.name.length?e+="(":e+=`(?P<${this.name}>`,this.subs[0].op!==t.Op.EMPTY_MATCH&&(e+=this.subs[0].appendTo()),e+=")";break;case t.Op.BEGIN_TEXT:e+="\\A";break;case t.Op.END_TEXT:0!==(this.flags&fB.WAS_DOLLAR)?e+="(?-m:$)":e+="\\z";break;case t.Op.BEGIN_LINE:e+="^";break;case t.Op.END_LINE:e+="$";break;case t.Op.WORD_BOUNDARY:e+="\\b";break;case t.Op.NO_WORD_BOUNDARY:e+="\\B";break;case t.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]===xB.MAX_RUNE){e+="^";for(let n=1;n<this.runes.length-1;n+=2){const s=this.runes[n]+1,r=this.runes[n+1]-1;e+=t.quoteIfHyphen(s),e+=PB.escapeRune(s),s!==r&&(e+="-",e+=t.quoteIfHyphen(r),e+=PB.escapeRune(r))}}else for(let n=0;n<this.runes.length;n+=2){const s=this.runes[n],r=this.runes[n+1];e+=t.quoteIfHyphen(s),e+=PB.escapeRune(s),s!==r&&(e+="-",e+=t.quoteIfHyphen(r),e+=PB.escapeRune(r))}e+="]";break;default:e+=this.op}return e}maxCap(){let e=0;if(this.op===t.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 t))return!1;if(this.op!==e.op)return!1;switch(this.op){case t.Op.END_TEXT:if((this.flags&fB.WAS_DOLLAR)!==(e.flags&fB.WAS_DOLLAR))return!1;break;case t.Op.LITERAL:case t.Op.CHAR_CLASS:if((this.flags&fB.FOLD_CASE)!==(e.flags&fB.FOLD_CASE))return!1;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 t.Op.ALTERNATE:case t.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 t.Op.STAR:case t.Op.PLUS:case t.Op.QUEST:if((this.flags&fB.NON_GREEDY)!==(e.flags&fB.NON_GREEDY)||!this.subs[0].equals(e.subs[0]))return!1;break;case t.Op.REPEAT:if((this.flags&fB.NON_GREEDY)!==(e.flags&fB.NON_GREEDY)||this.min!==e.min||this.max!==e.max||!this.subs[0].equals(e.subs[0]))return!1;break;case t.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;break;case t.Op.PLB:case t.Op.NLB:if(this.lb!==e.lb||!this.subs[0].equals(e.subs[0]))return!1}return!0}},Cc=class{static walk(t,e){const n=[];let s,r=t;for(;;){if(0===r.subs.length)s=e.leaf(r);else{const t=e.enter(r);if(void 0===t.result){n.push({re:r,state:t,i:0}),r=r.subs[0];continue}s=t.result}for(;;){if(0===n.length)return s;const t=n[n.length-1];if(e.child(t.re,t.state,s,t.i),t.i++,void 0===t.state.result&&t.i<t.re.subs.length){r=t.re.subs[t.i];break}n.pop(),s=void 0!==t.state.result?t.state.result:e.leave(t.re,t.state)}}}},gc=class{constructor(t,e){const n=new Map,s=[0],r=[0],i=[0],o=[0];for(const a of t){let t=0;for(let B=0;B<a.length;B++){const c=t*e+a[B];let l=n.get(c);void 0===l&&(l=s.length,n.set(c,l),s.push(t),r.push(a[B]),i.push(i[t]+1),o.push(0)),t=l}o[t]=1}const a=s.length,B=new Int32Array(a-1);for(let t=1;t<a;t++)B[t-1]=t;B.sort((t,e)=>s[t]-s[e]||r[t]-r[e]);const c=new Int32Array(a+1);for(let t=1;t<a;t++)c[s[t]+1]++;for(let t=0;t<a;t++)c[t+1]+=c[t];const l=new Int32Array(a-1);for(let t=0;t<B.length;t++)l[t]=r[B[t]];this.childStart=c,this.childUnit=l,this.childNode=B;const u=new Int32Array(a);for(let t=0;t<a;t++)u[t]=t;u.sort((t,e)=>i[t]-i[e]);const h=new Int32Array(a),d=Uint8Array.from(o);for(let t=1;t<a;t++){const e=u[t],n=s[e];if(0!==n){let t=h[n],s=this.next(t,r[e]);for(;s<0&&0!==t;)t=h[t],s=this.next(t,r[e]);h[e]=s>=0?s:0}d[e]|=d[h[e]]}this.fail=h,this.match=d}next(t,e){let n=this.childStart[t],s=this.childStart[t+1];const r=this.childUnit;for(;n<s;){const t=n+s>>1,i=r[t];if(i===e)return this.childNode[t];i<e?n=t+1:s=t}return-1}advance(t,e){for(;;){const n=this.next(t,e);if(n>=0)return n;if(0===t)return 0;t=this.fail[t]}}searchUTF16(t,e,n){let s=0;for(let r=e;r<n;r++)if(s=this.advance(s,t.charCodeAt(r)),1===this.match[s])return!0;return!1}searchUTF8(t,e,n){let s=0;for(let r=e;r<n;r++)if(s=this.advance(s,t[r]),1===this.match[s])return!0;return!1}},mc=class t{static Type={NONE:0,EXACT:1,AND:2,OR:3};static MAX_SCANS=32;static MAX_AC_UNITS=1<<18;constructor(e){this.type=e,this.subs=[],this.str="",this.bytes=null,this.cost=e===t.Type.EXACT?1:0,this.allExact=!1,this.ac16=null,this.ac8=null}automaton16(){if(null===this.ac16){const t=this.subs.map(t=>{const e=new Array(t.str.length);for(let n=0;n<t.str.length;n++)e[n]=t.str.charCodeAt(n);return e});this.ac16=new gc(t,65536)}return this.ac16}automaton8(){return null===this.ac8&&(this.ac8=new gc(this.subs.map(t=>t.bytes),256)),this.ac8}eval(e,n){switch(this.type){case t.Type.NONE:return!0;case t.Type.EXACT:return e.hasString(this,n);case t.Type.AND:for(let t=0;t<this.subs.length;t++)if(!this.subs[t].eval(e,n))return!1;return!0;case t.Type.OR:if(this.allExact)return e.hasAnyString(this,n);for(let t=0;t<this.subs.length;t++)if(this.subs[t].eval(e,n))return!0;return!1;default:return!0}}},wc=class t{static build(e){return e?Cc.walk(e,t.WALKER):new mc(mc.Type.NONE)}static WALKER={leaf:e=>t.leaf(e),enter:e=>t.enter(e),child:(e,n,s)=>t.child(e,n,s),leave:(e,n)=>t.leave(e,n)};static leaf(t){if(t.op!==fc.Op.LITERAL)return new mc(mc.Type.NONE);if(0===t.runes.length||0!==(t.flags&fB.FOLD_CASE))return new mc(mc.Type.NONE);let e="";for(let n=0;n<t.runes.length;n++){if(xB.isUnsearchable(t.runes[n]))return new mc(mc.Type.NONE);e+=String.fromCodePoint(t.runes[n])}const n=new mc(mc.Type.EXACT);return n.str=e,n.bytes=PB.stringToUtf8ByteArray(n.str),n}static enter(t){switch(t.op){case fc.Op.CAPTURE:case fc.Op.PLUS:return{sub:null};case fc.Op.REPEAT:return t.min>=1?{sub:null}:{result:new mc(mc.Type.NONE)};case fc.Op.CONCAT:return{pf:new mc(mc.Type.AND),subs:[]};case fc.Op.ALTERNATE:return{pf:new mc(mc.Type.OR),subs:[]};default:return{result:new mc(mc.Type.NONE)}}}static child(t,e,n){if(void 0!==e.subs)if(e.pf.type!==mc.Type.AND)if(n.type!==mc.Type.NONE)if(n.type!==mc.Type.OR)e.subs.push(n);else for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);else e.result=new mc(mc.Type.NONE);else{if(n.type===mc.Type.NONE)return;if(n.type===mc.Type.AND){for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);return}e.subs.push(n)}else e.sub=n}static leave(t,e){if(void 0===e.subs)return e.sub;const n=e.pf,s=new Set,r=[];for(const t of e.subs){if(t.type===mc.Type.EXACT){if(s.has(t.str))continue;s.add(t.str)}r.push(t)}if(n.type===mc.Type.AND){const t=[];let e=0;for(const n of r)e+n.cost>mc.MAX_SCANS||(t.push(n),e+=n.cost);return 0===t.length?new mc(mc.Type.NONE):1===t.length?t[0]:(n.subs=t,n.cost=e,n)}if(0===r.length)return new mc(mc.Type.NONE);if(1===r.length)return r[0];n.subs=r;let i=!0,o=0,a=0;for(const t of r)t.type!==mc.Type.EXACT?i=!1:a+=t.bytes.length,o+=t.cost;return i?a>mc.MAX_AC_UNITS?new mc(mc.Type.NONE):(n.allExact=!0,n.cost=1,n):o>mc.MAX_SCANS?new mc(mc.Type.NONE):(n.cost=o,n)}},yc=class{constructor(t=0,e=0){this.head=t,this.tail=e}},Ec=class{constructor(){this.inst=[],this.start=0,this.numCap=2,this.lbStarts=[],this.numLb=0,this.lbInst=null}getInst(t){return this.inst[t]}numInst(){return this.inst.length}addInst(t){this.inst.push(new tc(t))}markLookbehindInsts(){const t=new Uint8Array(this.inst.length),e=this.lbStarts.slice();for(;e.length>0;){const n=e.pop();if(0===n||1===t[n])continue;t[n]=1;const s=this.inst[n];switch(s.op){case tc.ALT:case tc.ALT_MATCH:e.push(s.out,s.arg);break;case tc.MATCH:case tc.FAIL:break;default:e.push(s.out)}}this.lbInst=t}skipNop(t){let e=this.inst[t];for(;e.op===tc.NOP||e.op===tc.CAPTURE;)e=this.inst[t],t=e.out;return e}prefix(){let t="",e=this.skipNop(this.start);if(!tc.isRuneOp(e.op)||1!==e.runes.length)return[e.op===tc.MATCH,t];for(;tc.isRuneOp(e.op)&&1===e.runes.length&&0===(e.arg&fB.FOLD_CASE)&&!xB.isUnsearchable(e.runes[0]);)t+=String.fromCodePoint(e.runes[0]),e=this.skipNop(e.out);return[e.op===tc.MATCH,t]}startCond(){let t=0,e=this.start;t:for(;;){const n=this.inst[e];switch(n.op){case tc.EMPTY_WIDTH:t|=n.arg;break;case tc.FAIL:return-1;case tc.CAPTURE:case tc.NOP:break;default:break t}e=n.out}return t}patch(t,e){let n=t.head;for(;0!==n;){const t=this.inst[n>>1];1&n?(n=t.arg,t.arg=e):(n=t.out,t.out=e)}}append(t,e){if(0===t.head)return e;if(0===e.head)return t;const n=this.inst[t.tail>>1];return 1&t.tail?n.arg=e.head:n.out=e.head,new yc(t.head,e.tail)}toString(){let t="";for(let e=0;e<this.inst.length;e++){const n=t.length;t+=e,e===this.start&&(t+="*"),t+=" ".substring(t.length-n),t+=this.inst[e],t+="\n"}return t}};const Dc=new Int32Array([0,IB.CODES["\n"]-1,IB.CODES["\n"]+1,xB.MAX_RUNE]),_c=new Int32Array([0,xB.MAX_RUNE]);var bc=class{constructor(t=0,e=new yc,n=!1){this.i=t,this.out=e,this.nullable=n}},vc=class t{static compileRegexp(e){const n=new t,s=n.compile(e);return n.prog.patch(s.out,n.newInst(tc.MATCH).i),n.prog.start=s.i,n.prog.markLookbehindInsts(),n.prog}static compileSet(e){const n=new t;if(0===e.length)return n.prog.start=n.newInst(tc.FAIL).i,n.prog.markLookbehindInsts(),n.prog;let s=[];for(let t=0;t<e.length;t++){n.lbOffset=n.prog.numLb;const r=n.compile(e[t]),i=n.newInst(tc.MATCH);n.prog.getInst(i.i).arg=t,n.prog.patch(r.out,i.i),s.push(r.i)}let r=s[0];for(let t=1;t<s.length;t++){const e=n.newInst(tc.ALT),i=n.prog.getInst(e.i);i.out=r,i.arg=s[t],r=e.i}return n.prog.start=r,n.prog.markLookbehindInsts(),n.prog}constructor(){this.prog=new Ec,this.newInst(tc.FAIL),this.lbOffset=0,this.runeCache=new Map,this.walker={leaf:t=>this.leaf(t),enter:t=>this.enter(t),child:(t,e,n)=>this.child(t,e,n),leave:(t,e)=>this.leave(t,e)}}newInst(t){return this.prog.addInst(t),new bc(this.prog.numInst()-1,new yc,!0)}nop(){const t=this.newInst(tc.NOP);return t.out=new yc(t.i<<1,t.i<<1),t}fail(){return new bc}cap(t){const e=this.newInst(tc.CAPTURE);return e.out=new yc(e.i<<1,e.i<<1),this.prog.getInst(e.i).arg=t,this.prog.numCap<t+1&&(this.prog.numCap=t+1),e}cat(t,e){return 0===t.i||0===e.i?(this.prog.patch(t.out,0),this.prog.patch(e.out,0),this.fail()):(this.prog.patch(t.out,e.i),new bc(t.i,e.out,t.nullable&&e.nullable))}alt(t,e){if(0===t.i)return e;if(0===e.i)return t;const n=this.newInst(tc.ALT),s=this.prog.getInst(n.i);return s.out=t.i,s.arg=e.i,n.out=this.prog.append(t.out,e.out),n.nullable=t.nullable||e.nullable,n}loop(t,e){const n=this.newInst(tc.ALT),s=this.prog.getInst(n.i);return e?(s.arg=t.i,n.out=new yc(n.i<<1,n.i<<1)):(s.out=t.i,n.out=new yc(n.i<<1|1,n.i<<1|1)),this.prog.patch(t.out,n.i),n}quest(t,e){if(0===t.i)return this.nop();const n=this.newInst(tc.ALT),s=this.prog.getInst(n.i);return e?(s.arg=t.i,n.out=new yc(n.i<<1,n.i<<1)):(s.out=t.i,n.out=new yc(n.i<<1|1,n.i<<1|1)),n.out=this.prog.append(n.out,t.out),n}star(t,e){return 0===t.i?this.nop():t.nullable?this.quest(this.plus(t,e),e):this.loop(t,e)}plus(t,e){return 0===t.i?this.fail():new bc(t.i,this.loop(t,e).out,t.nullable)}empty(t){const e=this.newInst(tc.EMPTY_WIDTH);return this.prog.getInst(e.i).arg=t,e.out=new yc(e.i<<1,e.i<<1),e}rune(t,e){const n=this.newInst(tc.RUNE);n.nullable=!1;const s=this.prog.getInst(n.i);return s.runes=t,e&=fB.FOLD_CASE,1===t.length&&xB.simpleFold(t[0])!==t[0]||(e&=-2),s.arg=e,n.out=new yc(n.i<<1,n.i<<1),0===(e&fB.FOLD_CASE)&&1===t.length||2===t.length&&t[0]===t[1]?s.op=tc.RUNE1:2===t.length&&0===t[0]&&t[1]===xB.MAX_RUNE?s.op=tc.RUNE_ANY:4===t.length&&0===t[0]&&t[1]===IB.CODES["\n"]-1&&t[2]===IB.CODES["\n"]+1&&t[3]===xB.MAX_RUNE&&(s.op=tc.RUNE_ANY_NOT_NL),n}lookBehind(t,e){const n=Math.sign(e)*(Math.abs(e)+this.lbOffset),s=this.newInst(tc.LB_WRITE);this.prog.getInst(s.i).arg=n;const r=this.rune(_c,0),i=this.star(r,!0),o=this.cat(i,t);this.prog.patch(o.out,s.i);const a=this.newInst(tc.LB_CHECK);return this.prog.getInst(a.i).arg=n,this.prog.lbStarts.push(o.i),Math.abs(n)>this.prog.numLb&&(this.prog.numLb=Math.abs(n)),a.out=new yc(a.i<<1,a.i<<1),a}compile(t){return Cc.walk(t,this.walker)}leaf(t){switch(t.op){case fc.Op.NO_MATCH:return this.fail();case fc.Op.EMPTY_MATCH:return this.nop();case fc.Op.LITERAL:{if(0===t.runes.length)return this.nop();let e=null;for(let n of t.runes){let s=this.runeCache.get(n);void 0===s&&(s=new Int32Array([n]),this.runeCache.set(n,s));const r=this.rune(s,t.flags);e=null===e?r:this.cat(e,r)}return e}case fc.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case fc.Op.ANY_CHAR_NOT_NL:return this.rune(Dc,0);case fc.Op.ANY_CHAR:return this.rune(_c,0);case fc.Op.BEGIN_LINE:return this.empty(PB.EMPTY_BEGIN_LINE);case fc.Op.END_LINE:return this.empty(PB.EMPTY_END_LINE);case fc.Op.BEGIN_TEXT:return this.empty(PB.EMPTY_BEGIN_TEXT);case fc.Op.END_TEXT:return this.empty(PB.EMPTY_END_TEXT);case fc.Op.WORD_BOUNDARY:return this.empty(PB.EMPTY_WORD_BOUNDARY);case fc.Op.NO_WORD_BOUNDARY:return this.empty(PB.EMPTY_NO_WORD_BOUNDARY);case fc.Op.CONCAT:case fc.Op.ALTERNATE:return this.nop();default:throw new QB("regexp: unhandled case in compile")}}enter(t){switch(t.op){case fc.Op.PLB:case fc.Op.NLB:case fc.Op.STAR:case fc.Op.PLUS:case fc.Op.QUEST:return{sub:null};case fc.Op.CAPTURE:return{bra:this.cap(t.cap<<1),sub:null};case fc.Op.CONCAT:case fc.Op.ALTERNATE:return{f:null};default:throw new QB("regexp: unhandled case in compile")}}child(t,e,n){t.op===fc.Op.CONCAT?e.f=null===e.f?n:this.cat(e.f,n):t.op===fc.Op.ALTERNATE?e.f=null===e.f?n:this.alt(e.f,n):e.sub=n}leave(t,e){switch(t.op){case fc.Op.PLB:case fc.Op.NLB:return this.lookBehind(e.sub,t.lb);case fc.Op.CAPTURE:{const n=this.cap(t.cap<<1|1);return this.cat(this.cat(e.bra,e.sub),n)}case fc.Op.STAR:return this.star(e.sub,0!==(t.flags&fB.NON_GREEDY));case fc.Op.PLUS:return this.plus(e.sub,0!==(t.flags&fB.NON_GREEDY));case fc.Op.QUEST:return this.quest(e.sub,0!==(t.flags&fB.NON_GREEDY));case fc.Op.CONCAT:case fc.Op.ALTERNATE:return e.f;default:throw new QB("regexp: unhandled case in compile")}}},Ic=class t{static simplify(e){return null===e?null:Cc.walk(e,t.WALKER)}static WALKER={leaf:e=>t.leaf(e),enter:e=>t.enter(e),child:(e,n,s,r)=>t.child(e,n,s,r),leave:(e,n)=>t.leave(e,n)};static leaf(t){if(t.op===fc.Op.CHAR_CLASS){if(null===t.runes)return t;if(0===t.runes.length)return new fc(fc.Op.NO_MATCH);if(2===t.runes.length&&0===t.runes[0]&&t.runes[1]===xB.MAX_RUNE)return new fc(fc.Op.ANY_CHAR);if(4===t.runes.length&&0===t.runes[0]&&t.runes[1]===IB.CODES["\n"]-1&&t.runes[2]===IB.CODES["\n"]+1&&t.runes[3]===xB.MAX_RUNE)return new fc(fc.Op.ANY_CHAR_NOT_NL)}return t}static enter(t){switch(t.op){case fc.Op.PLB:case fc.Op.NLB:case fc.Op.CAPTURE:case fc.Op.STAR:case fc.Op.PLUS:case fc.Op.QUEST:return{sub:null};case fc.Op.CONCAT:case fc.Op.ALTERNATE:return{subs:[],changed:!1};case fc.Op.REPEAT:return 0===t.min&&0===t.max?{result:new fc(fc.Op.EMPTY_MATCH)}:{sub:null};default:return{result:t}}}static child(t,e,n,s){if(void 0!==e.subs){if(n!==t.subs[s]&&(e.changed=!0),t.op===fc.Op.CONCAT){if(n.op===fc.Op.NO_MATCH)return void(e.result=new fc(fc.Op.NO_MATCH));if(n.op===fc.Op.EMPTY_MATCH)return void(e.changed=!0);if(n.op===fc.Op.CONCAT){e.changed=!0;for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);return}}else{if(n.op===fc.Op.NO_MATCH)return void(e.changed=!0);if(n.op===fc.Op.ALTERNATE){e.changed=!0;for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);return}}e.subs.push(n)}else e.sub=n}static leave(e,n){switch(e.op){case fc.Op.PLB:case fc.Op.NLB:case fc.Op.CAPTURE:{const t=n.sub;if(t!==e.subs[0]){const n=fc.fromRegexp(e);return n.runes=new Int32Array(0),n.subs=[t],n}return e}case fc.Op.CONCAT:case fc.Op.ALTERNATE:if(n.changed){const t=n.subs;if(0===t.length)return new fc(e.op===fc.Op.CONCAT?fc.Op.EMPTY_MATCH:fc.Op.NO_MATCH);if(1===t.length)return t[0];const s=fc.fromRegexp(e);return s.runes=new Int32Array(0),s.subs=t,s}return e;case fc.Op.STAR:case fc.Op.PLUS:case fc.Op.QUEST:return t.simplify1(e.op,e.flags,n.sub,e);case fc.Op.REPEAT:return t.simplifyRepeat(e,n.sub);default:return e}}static simplifyRepeat(e,n){if(-1===e.max){if(0===e.min)return t.simplify1(fc.Op.STAR,e.flags,n,null);if(1===e.min)return t.simplify1(fc.Op.PLUS,e.flags,n,null);const s=[];for(let t=0;t<e.min-1;t++)s.push(n);return s.push(t.simplify1(fc.Op.PLUS,e.flags,n,null)),t.concat(s)}if(1===e.min&&1===e.max)return n;let s=null;if(e.min>0){s=[];for(let t=0;t<e.min;t++)s.push(n)}if(e.max>e.min){let r=t.simplify1(fc.Op.QUEST,e.flags,n,null);for(let s=e.min+1;s<e.max;s++)r=t.simplify1(fc.Op.QUEST,e.flags,t.concat([n,r]),null);if(null===s)return r;s.push(r)}return null!==s?t.concat(s):new fc(fc.Op.NO_MATCH)}static concat(t){const e=[];for(let n=0;n<t.length;n++){const s=t[n];if(s.op===fc.Op.NO_MATCH)return new fc(fc.Op.NO_MATCH);if(s.op!==fc.Op.EMPTY_MATCH)if(s.op!==fc.Op.CONCAT)e.push(s);else for(let t=0;t<s.subs.length;t++)e.push(s.subs[t])}if(0===e.length)return new fc(fc.Op.EMPTY_MATCH);if(1===e.length)return e[0];const n=new fc(fc.Op.CONCAT);return n.subs=e,n}static simplify1(t,e,n,s){if(n.op===fc.Op.EMPTY_MATCH)return n;if(n.op===fc.Op.NO_MATCH)return t===fc.Op.PLUS?n:new fc(fc.Op.EMPTY_MATCH);if(t===n.op&&(e&fB.NON_GREEDY)===(n.flags&fB.NON_GREEDY))return n;if(null!==s&&s.op===t&&(s.flags&fB.NON_GREEDY)===(e&fB.NON_GREEDY)&&n===s.subs[0])return s;const r=new fc(t);return r.flags=e,r.subs=[n],r}},Tc=class{constructor(t,e){this.sign=t,this.cls=e}};const Oc=[48,57],Ac=[9,10,12,13,32,32],Sc=[48,57,65,90,95,95,97,122],Rc=new Map([["\\d",new Tc(1,Oc)],["\\D",new Tc(-1,Oc)],["\\s",new Tc(1,Ac)],["\\S",new Tc(-1,Ac)],["\\w",new Tc(1,Sc)],["\\W",new Tc(-1,Sc)]]),Nc=[48,57,65,90,97,122],xc=[65,90,97,122],kc=[0,127],Lc=[9,9,32,32],Fc=[0,31,127,127],Pc=[48,57],Mc=[33,126],Gc=[97,122],Hc=[32,126],Uc=[33,47,58,64,91,96,123,126],Vc=[9,13,32,32],jc=[65,90],$c=[48,57,65,90,95,95,97,122],Jc=[48,57,65,70,97,102],qc=new Map([["[:alnum:]",new Tc(1,Nc)],["[:^alnum:]",new Tc(-1,Nc)],["[:alpha:]",new Tc(1,xc)],["[:^alpha:]",new Tc(-1,xc)],["[:ascii:]",new Tc(1,kc)],["[:^ascii:]",new Tc(-1,kc)],["[:blank:]",new Tc(1,Lc)],["[:^blank:]",new Tc(-1,Lc)],["[:cntrl:]",new Tc(1,Fc)],["[:^cntrl:]",new Tc(-1,Fc)],["[:digit:]",new Tc(1,Pc)],["[:^digit:]",new Tc(-1,Pc)],["[:graph:]",new Tc(1,Mc)],["[:^graph:]",new Tc(-1,Mc)],["[:lower:]",new Tc(1,Gc)],["[:^lower:]",new Tc(-1,Gc)],["[:print:]",new Tc(1,Hc)],["[:^print:]",new Tc(-1,Hc)],["[:punct:]",new Tc(1,Uc)],["[:^punct:]",new Tc(-1,Uc)],["[:space:]",new Tc(1,Vc)],["[:^space:]",new Tc(-1,Vc)],["[:upper:]",new Tc(1,jc)],["[:^upper:]",new Tc(-1,jc)],["[:word:]",new Tc(1,$c)],["[:^word:]",new Tc(-1,$c)],["[:xdigit:]",new Tc(1,Jc)],["[:^xdigit:]",new Tc(-1,Jc)]]);var zc=class t{static charClassToString(t,e){let n="[";for(let s=0;s<e;s+=2){s>0&&(n+=" ");const e=t[s],r=t[s+1];n+=e===r?`0x${e.toString(16)}`:`0x${e.toString(16)}-0x${r.toString(16)}`}return n+="]",n}static sortRanges(t,e){const n=e>>1,s=new Array(n);for(let t=0;t<n;t++)s[t]=t;s.sort((e,n)=>t[2*e]-t[2*n]||t[2*n+1]-t[2*e+1]);const r=t.slice(0,e);for(let e=0;e<n;e++)t[2*e]=r[2*s[e]],t[2*e+1]=r[2*s[e]+1]}constructor(t=PB.emptyInts()){this.r=t,this.len=t.length}toArray(){return this.r instanceof Int32Array?this.len===this.r.length?this.r:this.r.subarray(0,this.len):new Int32Array(this.len===this.r.length?this.r:this.r.slice(0,this.len))}toGrowableArray(){return Array.isArray(this.r)?(this.r.length=this.len,this.r):Array.from(this.r.subarray(0,this.len))}cleanClass(){if(this.len<4)return this;t.sortRanges(this.r,this.len);let e=2;for(let t=2;t<this.len;t+=2){const n=this.r[t],s=this.r[t+1];n<=this.r[e-1]+1?s>this.r[e-1]&&(this.r[e-1]=s):(this.r[e]=n,this.r[e+1]=s,e+=2)}return this.len=e,this}appendLiteral(t,e){return 0!==(e&fB.FOLD_CASE)?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,e){if(this.len>0)for(let n=2;n<=4;n+=2)if(this.len>=n){const s=this.r[this.len-n],r=this.r[this.len-n+1];if(t<=r+1&&s<=e+1)return t<s&&(this.r[this.len-n]=t),e>r&&(this.r[this.len-n+1]=e),this}return this.r[this.len++]=t,this.r[this.len++]=e,this}appendFoldedRange(t,e){if(t<=xB.MIN_FOLD&&e>=xB.MAX_FOLD)return this.appendRange(t,e);if(e<xB.MIN_FOLD||t>xB.MAX_FOLD)return this.appendRange(t,e);t<xB.MIN_FOLD&&(this.appendRange(t,xB.MIN_FOLD-1),t=xB.MIN_FOLD),e>xB.MAX_FOLD&&(this.appendRange(xB.MAX_FOLD+1,e),e=xB.MAX_FOLD);for(let n=t;n<=e;n++){this.appendRange(n,n);for(let t=xB.simpleFold(n);t!==n;t=xB.simpleFold(t))this.appendRange(t,t)}return this}appendClass(t){for(let e=0;e<t.length;e+=2)this.appendRange(t[e],t[e+1]);return this}appendFoldedClass(t){for(let e=0;e<t.length;e+=2)this.appendFoldedRange(t[e],t[e+1]);return this}appendNegatedClass(t){let e=0;for(let n=0;n<t.length;n+=2){const s=t[n],r=t[n+1];e<=s-1&&this.appendRange(e,s-1),e=r+1}return e<=xB.MAX_RUNE&&this.appendRange(e,xB.MAX_RUNE),this}appendTable(t){for(let e=0;e<t.length;++e){const n=t.getLo(e),s=t.getHi(e),r=t.getStride(e);if(1!==r)for(let t=n;t<=s;t+=r)this.appendRange(t,t);else this.appendRange(n,s)}return this}appendNegatedTable(t){let e=0;for(let n=0;n<t.length;++n){const s=t.getLo(n),r=t.getHi(n),i=t.getStride(n);if(1!==i)for(let t=s;t<=r;t+=i)e<=t-1&&this.appendRange(e,t-1),e=t+1;else e<=s-1&&this.appendRange(e,s-1),e=r+1}return e<=xB.MAX_RUNE&&this.appendRange(e,xB.MAX_RUNE),this}appendTableWithSign(t,e){return e<0?this.appendNegatedTable(t):this.appendTable(t)}negateClass(){let t=0,e=0;for(let n=0;n<this.len;n+=2){const s=this.r[n],r=this.r[n+1];t<=s-1&&(this.r[e]=t,this.r[e+1]=s-1,e+=2),t=r+1}return this.len=e,t<=xB.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=xB.MAX_RUNE),this}appendClassWithSign(t,e){return e<0?this.appendNegatedClass(t):this.appendClass(t)}appendGroup(e,n){let s=e.cls;return n&&(s=(new t).appendFoldedClass(s).cleanClass().toArray()),this.appendClassWithSign(s,e.sign)}toString(){return t.charClassToString(this.r,this.len)}},Kc=class{constructor(t){this.str=t,this.position=0}pos(){return this.position}rewindTo(t){this.position=t}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(t){this.position+=t}skipString(t){this.position+=t.length}pop(){const t=this.str.codePointAt(this.position);return this.position+=PB.charCount(t),t}lookingAt(t){return this.str.startsWith(t,this.position)}rest(){return this.str.substring(this.position)}from(t){return this.str.substring(t,this.position)}toString(){return this.rest()}},Qc=class t{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 ERR_UNEXPECTED_PAREN="unexpected )";static ERR_NESTING_DEPTH="expression nests too deeply";static ERR_LARGE="expression too large";static ERR_INVALID_CAPTURE_IN_LOOKBEHIND="invalid capture in lookbehind";static MAX_HEIGHT=1e3;static MAX_SIZE=1398101;static MAX_RUNES=33554432;static ANY_TABLE=new TB(new Uint32Array([0,xB.MAX_RUNE,1]));static ASCII_TABLE=new TB(new Uint32Array([0,127,1]));static ASCII_FOLD_TABLE=new TB(new Uint32Array([0,127,1,383,383,1,8490,8490,1]));static unicodeTable(e){return"Any"===e?{tab:t.ANY_TABLE,fold:t.ANY_TABLE,sign:1}:"Ascii"===e?{tab:t.ASCII_TABLE,fold:t.ASCII_FOLD_TABLE,sign:1}:"Assigned"===e?{tab:NB.CATEGORIES.get("Cn"),fold:NB.CATEGORIES.get("Cn"),sign:-1}:"Lc"===e?{tab:NB.CATEGORIES.get("LC"),fold:NB.FOLD_CATEGORIES.get("LC"),sign:1}:NB.CATEGORIES.has(e)?{tab:NB.CATEGORIES.get(e),fold:NB.FOLD_CATEGORIES.get(e),sign:1}:NB.SCRIPTS.has(e)?{tab:NB.SCRIPTS.get(e),fold:NB.FOLD_SCRIPT.get(e),sign:1}:null}static minFoldRune(t){if(t<xB.MIN_FOLD||t>xB.MAX_FOLD)return t;let e=t;const n=t;for(t=xB.simpleFold(t);t!==n;t=xB.simpleFold(t))e>t&&(e=t);return e}static leadingRegexp(t){if(t.op===fc.Op.EMPTY_MATCH)return null;if(t.op===fc.Op.CONCAT&&t.subs.length>0){const e=t.subs[0];return e.op===fc.Op.EMPTY_MATCH?null:e}return t}static literalRegexp(t,e){const n=new fc(fc.Op.LITERAL);return n.flags=e,n.runes=PB.stringToRunes(t),n}static parse(e,n){return new t(e,n).parseInternal()}static parseRepeat(e){const n=e.pos();if(!e.more()||!e.lookingAt("{"))return-1;e.skip(1);const s=t.parseInt(e);if(-1===s)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=t.parseInt(e)))return-1}else r=s;if(!e.more()||!e.lookingAt("}"))return-1;if(e.skip(1),s<0||s>1e3||-2===r||r>1e3||r>=0&&s>r)throw new KB(t.ERR_INVALID_REPEAT_SIZE,e.from(n));return s<<16|r&xB.MAX_BMP}static isValidCaptureName(t){if(0===t.length)return!1;for(let e=0;e<t.length;e++){const n=t.codePointAt(e);if(n!==IB.CODES._&&!PB.isalnum(n))return!1}return!0}static parseInt(t){const e=t.pos();for(;t.more()&&t.peek()>=IB.CODES[0]&&t.peek()<=IB.CODES[9];)t.skip(1);const n=t.from(e);return 0===n.length||n.length>1&&n.codePointAt(0)===IB.CODES[0]?-1:n.length>8?-2:parseInt(n,10)}static isCharClass(t){return t.op===fc.Op.LITERAL&&1===t.runes.length||t.op===fc.Op.CHAR_CLASS||t.op===fc.Op.ANY_CHAR_NOT_NL||t.op===fc.Op.ANY_CHAR}static matchRune(t,e){switch(t.op){case fc.Op.LITERAL:return 1===t.runes.length&&t.runes[0]===e;case fc.Op.CHAR_CLASS:for(let n=0;n<t.runes.length;n+=2)if(t.runes[n]<=e&&e<=t.runes[n+1])return!0;return!1;case fc.Op.ANY_CHAR_NOT_NL:return e!==IB.CODES["\n"];case fc.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(e,n){switch(e.op){case fc.Op.ANY_CHAR:break;case fc.Op.ANY_CHAR_NOT_NL:t.matchRune(n,IB.CODES["\n"])&&(e.op=fc.Op.ANY_CHAR);break;case fc.Op.CHAR_CLASS:{const t=new zc(Array.isArray(e.runes)?e.runes:Array.from(e.runes));n.op===fc.Op.LITERAL?t.appendLiteral(n.runes[0],n.flags):t.appendClass(n.runes),e.runes=t.toGrowableArray();break}case fc.Op.LITERAL:if(n.runes[0]===e.runes[0]&&n.flags===e.flags)break;e.op=fc.Op.CHAR_CLASS,e.runes=(new zc).appendLiteral(e.runes[0],e.flags).appendLiteral(n.runes[0],n.flags).toGrowableArray()}}static parseEscape(e){const n=e.pos();if(e.skip(1),!e.more())throw new KB(t.ERR_TRAILING_BACKSLASH);let s=e.pop();t:switch(s){case IB.CODES[1]:case IB.CODES[2]:case IB.CODES[3]:case IB.CODES[4]:case IB.CODES[5]:case IB.CODES[6]:case IB.CODES[7]:if(!e.more()||e.peek()<IB.CODES[0]||e.peek()>IB.CODES[7])break;case IB.CODES[0]:{let t=s-IB.CODES[0];for(let n=1;n<3&&!(!e.more()||e.peek()<IB.CODES[0]||e.peek()>IB.CODES[7]);n++)t=8*t+e.peek()-IB.CODES[0],e.skip(1);return t}case IB.CODES.x:{if(!e.more())break;if(s=e.pop(),s===IB.CODES["{"]){let t=0,n=0;for(;;){if(!e.more())break t;if(s=e.pop(),s===IB.CODES["}"])break;const r=PB.unhex(s);if(r<0)break t;if(n=16*n+r,n>xB.MAX_RUNE)break t;t++}if(0===t)break t;return n}const t=PB.unhex(s);if(!e.more())break;s=e.pop();const n=PB.unhex(s);if(t<0||n<0)break;return 16*t+n}case IB.CODES.a:return IB.CODES[""];case IB.CODES.f:return IB.CODES["\f"];case IB.CODES.n:return IB.CODES["\n"];case IB.CODES.r:return IB.CODES["\r"];case IB.CODES.t:return IB.CODES["\t"];case IB.CODES.v:return IB.CODES["\v"];default:if(s<=xB.MAX_ASCII&&!PB.isalnum(s))return s}throw new KB(t.ERR_INVALID_ESCAPE,e.from(n))}static parseClassChar(e,n){if(!e.more())throw new KB(t.ERR_MISSING_BRACKET,e.from(n));return e.lookingAt("\\")?t.parseEscape(e):e.pop()}static hasCapture(e){if(null===e)return!1;if(e.op===fc.Op.CAPTURE)return!0;if(e.subs)for(let n of e.subs)if(t.hasCapture(n))return!0;return!1}constructor(t,e=0){this.wholeRegexp=t,this.flags=e,this.numCap=0,this.namedGroups=Object.create(null),this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null,this.nlb=0}newRegexp(t){let e=this.free;return null!==e&&null!==e.subs&&e.subs.length>0?(this.free=e.subs[0],e.reinit(),e.op=t):(e=new fc(t),this.numRegexp+=1),e}reuse(t){null!==this.height&&this.height.has(t)&&this.height.delete(t),null!==t.subs&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(e){if(this.numRunes>t.MAX_RUNES)throw new KB(t.ERR_LARGE);this.checkSize(e),this.checkHeight(e)}checkSize(e){if(null===this.size){if(0===this.repeats&&(this.repeats=1),e.op===fc.Op.REPEAT){let n=e.max;-1===n&&(n=e.min),n<=0&&(n=1),n>Math.floor(t.MAX_SIZE/this.repeats)?this.repeats=t.MAX_SIZE:this.repeats*=n}if(this.numRegexp<Math.floor(t.MAX_SIZE/this.repeats))return;this.size=new Map;for(let t of this.stack)this.checkSize(t)}if(this.calcSize(e,!0)>t.MAX_SIZE)throw new KB(t.ERR_LARGE)}calcSize(t,e=!1){if(!e&&null!==this.size&&this.size.has(t))return this.size.get(t);let n=0;switch(t.op){case fc.Op.LITERAL:n=t.runes.length;break;case fc.Op.PLB:case fc.Op.NLB:case fc.Op.CAPTURE:case fc.Op.STAR:n=2+this.calcSize(t.subs[0]);break;case fc.Op.PLUS:case fc.Op.QUEST:n=1+this.calcSize(t.subs[0]);break;case fc.Op.CONCAT:for(let e of t.subs)n+=this.calcSize(e);break;case fc.Op.ALTERNATE:for(let e of t.subs)n+=this.calcSize(e);t.subs.length>1&&(n=n+t.subs.length-1);break;case fc.Op.REPEAT:{let e=this.calcSize(t.subs[0]);if(-1===t.max){n=0===t.min?2+e:1+t.min*e;break}n=t.max*e+(t.max-t.min);break}}return n=Math.max(1,n),null===this.size&&(this.size=new Map),this.size.set(t,n),n}checkHeight(e){if(!(this.numRegexp<t.MAX_HEIGHT)){if(null===this.height){this.height=new Map;for(let t of this.stack)this.checkHeight(t)}if(this.calcHeight(e,!0)>t.MAX_HEIGHT)throw new KB(t.ERR_NESTING_DEPTH)}}calcHeight(t,e=!1){if(!e&&null!==this.height&&this.height.has(t))return this.height.get(t);let n=1;for(let e of t.subs){const t=this.calcHeight(e);n<1+t&&(n=1+t)}return null===this.height&&(this.height=new Map),this.height.set(t,n),n}pop(){return this.stack.pop()}popToPseudo(){const t=this.stack.length;let e=t;for(;e>0&&!fc.isPseudoOp(this.stack[e-1].op);)e--;return this.stack.splice(e,t-e)}push(t){if(this.numRunes+=t.runes.length,t.op===fc.Op.CHAR_CLASS&&2===t.runes.length&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],-2&this.flags))return null;t.op=fc.Op.LITERAL,t.runes=[t.runes[0]],t.flags=-2&this.flags}else if(t.op===fc.Op.CHAR_CLASS&&4===t.runes.length&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&xB.simpleFold(t.runes[0])===t.runes[2]&&xB.simpleFold(t.runes[2])===t.runes[0]||t.op===fc.Op.CHAR_CLASS&&2===t.runes.length&&t.runes[0]+1===t.runes[1]&&xB.simpleFold(t.runes[0])===t.runes[1]&&xB.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|fB.FOLD_CASE))return null;t.op=fc.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|fB.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,e){const n=this.stack.length;if(n<2)return!1;const s=this.stack[n-1],r=this.stack[n-2];if(s.op!==fc.Op.LITERAL||r.op!==fc.Op.LITERAL||(s.flags&fB.FOLD_CASE)!==(r.flags&fB.FOLD_CASE))return!1;Array.isArray(r.runes)||(r.runes=Array.from(r.runes));for(let t=0;t<s.runes.length;t++)r.runes.push(s.runes[t]);return t>=0?(s.runes=[t],s.flags=e,!0):(this.pop(),this.reuse(s),!1)}newLiteral(e,n){const s=this.newRegexp(fc.Op.LITERAL);return s.flags=n,0!==(n&fB.FOLD_CASE)&&(e=t.minFoldRune(e)),s.runes=[e],s}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){const e=this.newRegexp(t);return e.flags=this.flags,this.push(e)}repeat(e,n,s,r,i,o){let a=this.flags;if(0!==(a&fB.PERL_X)&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=fB.NON_GREEDY),-1!==o))throw new KB(t.ERR_INVALID_REPEAT_OP,i.from(o));const B=this.stack.length;if(0===B)throw new KB(t.ERR_MISSING_REPEAT_ARGUMENT,i.from(r));const c=this.stack[B-1];if(fc.isPseudoOp(c.op))throw new KB(t.ERR_MISSING_REPEAT_ARGUMENT,i.from(r));const l=this.newRegexp(e);if(l.min=n,l.max=s,l.flags=a,l.subs=[c],this.stack[B-1]=l,this.checkLimits(l),e===fc.Op.REPEAT&&(n>=2||s>=2)&&!this.repeatIsValid(l,1e3))throw new KB(t.ERR_INVALID_REPEAT_SIZE,i.from(r))}repeatIsValid(t,e){if(t.op===fc.Op.REPEAT){let n=t.max;if(0===n)return!0;if(n<0&&(n=t.min),n>e)return!1;n>0&&(e=Math.trunc(e/n))}for(let n of t.subs)if(!this.repeatIsValid(n,e))return!1;return!0}concat(){this.maybeConcat(-1,0);const t=this.popToPseudo();return 0===t.length?this.push(this.newRegexp(fc.Op.EMPTY_MATCH)):this.push(this.collapse(t,fc.Op.CONCAT))}alternate(){const t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),0===t.length?this.push(this.newRegexp(fc.Op.NO_MATCH)):this.push(this.collapse(t,fc.Op.ALTERNATE))}cleanAlt(t){t.op===fc.Op.CHAR_CLASS&&(t.runes=new zc(Array.from(t.runes)).cleanClass().toArray(),2===t.runes.length&&0===t.runes[0]&&t.runes[1]===xB.MAX_RUNE?(t.runes=new Int32Array(0),t.op=fc.Op.ANY_CHAR):4===t.runes.length&&0===t.runes[0]&&t.runes[1]===IB.CODES["\n"]-1&&t.runes[2]===IB.CODES["\n"]+1&&t.runes[3]===xB.MAX_RUNE&&(t.runes=new Int32Array(0),t.op=fc.Op.ANY_CHAR_NOT_NL))}collapse(t,e){if(1===t.length)return t[0];let n=0;for(let s of t)n+=s.op===e?s.subs.length:1;let s=new Array(n).fill(null),r=0;for(let n of t)if(n.op===e){for(let t=0;t<n.subs.length;t++)s[r++]=n.subs[t];this.reuse(n)}else s[r++]=n;let i=this.newRegexp(e);if(i.subs=s,e===fc.Op.ALTERNATE&&(i.subs=this.factor(i.subs),1===i.subs.length)){const t=i;i=i.subs[0],this.reuse(t)}return i}factor(e){if(e.length<2)return e;let n=0,s=e.length,r=0,i=null,o=0,a=0,B=0;for(let t=0;t<=s;t++){let c=null,l=0,u=0;if(t<s){let s=e[n+t];if(s.op===fc.Op.CONCAT&&s.subs.length>0&&(s=s.subs[0]),s.op===fc.Op.LITERAL&&(c=s.runes,l=s.runes.length,u=s.flags&fB.FOLD_CASE),u===a){let t=0;for(;t<o&&t<l&&i[t]===c[t];)t++;if(t>0){o=t;continue}}}if(t===B);else if(t===B+1)e[r++]=e[n+B];else{const s=this.newRegexp(fc.Op.LITERAL);s.flags=a,s.runes=i.slice(0,o);for(let s=B;s<t;s++)e[n+s]=this.removeLeadingString(e[n+s],o),this.checkLimits(e[n+s]);const c=this.collapse(e.slice(n+B,n+t),fc.Op.ALTERNATE),l=this.newRegexp(fc.Op.CONCAT);l.subs=[s,c],e[r++]=l}B=t,i=c,o=l,a=u}s=r,n=0,B=0,r=0;let c=null;for(let i=0;i<=s;i++){let o=null;if(!(i<s&&(o=t.leadingRegexp(e[n+i]),null!==c&&c.equals(o)&&(t.isCharClass(c)||c.op===fc.Op.REPEAT&&c.min===c.max&&t.isCharClass(c.subs[0]))))){if(i===B);else if(i===B+1)e[r++]=e[n+B];else{const t=c;for(let t=B;t<i;t++){const s=t!==B;e[n+t]=this.removeLeadingRegexp(e[n+t],s),this.checkLimits(e[n+t])}const s=this.collapse(e.slice(n+B,n+i),fc.Op.ALTERNATE),o=this.newRegexp(fc.Op.CONCAT);o.subs=[t,s],e[r++]=o}B=i,c=o}}s=r,n=0,B=0,r=0;for(let i=0;i<=s;i++)if(!(i<s&&t.isCharClass(e[n+i]))){if(i===B);else if(i===B+1)e[r++]=e[n+B];else{let s=B;for(let t=B+1;t<i;t++){const r=e[n+s],i=e[n+t];(r.op<i.op||r.op===i.op&&(null!==r.runes?r.runes.length:0)<(null!==i.runes?i.runes.length:0))&&(s=t)}const o=e[n+B];e[n+B]=e[n+s],e[n+s]=o;for(let s=B+1;s<i;s++)t.mergeCharClass(e[n+B],e[n+s]),this.reuse(e[n+s]);this.cleanAlt(e[n+B]),e[r++]=e[n+B]}i<s&&(e[r++]=e[n+i]),B=i+1}s=r,n=0,B=0,r=0;for(let t=0;t<s;++t)t+1<s&&e[n+t].op===fc.Op.EMPTY_MATCH&&e[n+t+1].op===fc.Op.EMPTY_MATCH||(e[r++]=e[n+t]);return s=r,n=0,e.slice(n,s)}removeLeadingString(t,e){if(t.op===fc.Op.CONCAT&&t.subs.length>0){const n=this.removeLeadingString(t.subs[0],e);if(t.subs[0]=n,n.op===fc.Op.EMPTY_MATCH)switch(this.reuse(n),t.subs.length){case 0:case 1:t.op=fc.Op.EMPTY_MATCH,t.subs=fc.emptySubs();break;case 2:{const e=t;t=t.subs[1],this.reuse(e);break}default:t.subs=t.subs.slice(1,t.subs.length)}return t}return t.op===fc.Op.LITERAL&&(t.runes=t.runes.slice(e,t.runes.length),0===t.runes.length&&(t.op=fc.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,e){if(t.op===fc.Op.CONCAT&&t.subs.length>0){switch(e&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:t.op=fc.Op.EMPTY_MATCH,t.subs=fc.emptySubs();break;case 1:{const e=t;t=t.subs[0],this.reuse(e);break}}return t}return e&&this.reuse(t),this.newRegexp(fc.Op.EMPTY_MATCH)}parseInternal(){if(0!==(this.flags&fB.LITERAL))return t.literalRegexp(this.wholeRegexp,this.flags);let e=-1,n=-1,s=-1;const r=new Kc(this.wholeRegexp);for(;r.more();){let i=-1;t:switch(r.peek()){case IB.CODES["("]:if(0!==(this.flags&fB.LOOKBEHIND)){if(r.lookingAt("(?<=")){this.parsePosLookBehind(),r.skip(4);break}if(r.lookingAt("(?<!")){this.parseNegLookBehind(),r.skip(4);break}}if(0!==(this.flags&fB.PERL_X)&&r.lookingAt("(?")){this.parsePerlFlags(r);break}this.op(fc.Op.LEFT_PAREN).cap=++this.numCap,r.skip(1);break;case IB.CODES["|"]:this.parseVerticalBar(),r.skip(1);break;case IB.CODES[")"]:this.parseRightParen(),r.skip(1);break;case IB.CODES["^"]:0!==(this.flags&fB.ONE_LINE)?this.op(fc.Op.BEGIN_TEXT):this.op(fc.Op.BEGIN_LINE),r.skip(1);break;case IB.CODES.$:0!==(this.flags&fB.ONE_LINE)?this.op(fc.Op.END_TEXT).flags|=fB.WAS_DOLLAR:this.op(fc.Op.END_LINE),r.skip(1);break;case IB.CODES["."]:0!==(this.flags&fB.DOT_NL)?this.op(fc.Op.ANY_CHAR):this.op(fc.Op.ANY_CHAR_NOT_NL),r.skip(1);break;case IB.CODES["["]:this.parseClass(r);break;case IB.CODES["*"]:case IB.CODES["+"]:case IB.CODES["?"]:{i=r.pos();let t=null;switch(r.pop()){case IB.CODES["*"]:t=fc.Op.STAR;break;case IB.CODES["+"]:t=fc.Op.PLUS;break;case IB.CODES["?"]:t=fc.Op.QUEST}this.repeat(t,n,s,i,r,e);break}case IB.CODES["{"]:{const o=r.pos(),a=t.parseRepeat(r);if(a<0){r.rewindTo(o),this.literal(r.pop());break}i=o,n=a>>16,s=(a&xB.MAX_BMP)<<16>>16,this.repeat(fc.Op.REPEAT,n,s,i,r,e);break}case IB.CODES["\\"]:{const e=r.pos();if(r.skip(1),0!==(this.flags&fB.PERL_X)&&r.more())switch(r.pop()){case IB.CODES.A:this.op(fc.Op.BEGIN_TEXT);break t;case IB.CODES.b:this.op(fc.Op.WORD_BOUNDARY);break t;case IB.CODES.B:this.op(fc.Op.NO_WORD_BOUNDARY);break t;case IB.CODES.C:throw new KB(t.ERR_INVALID_ESCAPE,"\\C");case IB.CODES.Q:{let t=r.rest();const e=t.indexOf("\\E");e>=0?(t=t.substring(0,e),r.skipString(t),r.skipString("\\E")):r.skipString(t);let n=0;for(;n<t.length;){const e=t.codePointAt(n);this.literal(e),n+=PB.charCount(e)}break t}case IB.CODES.z:this.op(fc.Op.END_TEXT);break t;default:r.rewindTo(e)}else r.rewindTo(e);const n=this.newRegexp(fc.Op.CHAR_CLASS);if(n.flags=this.flags,r.lookingAt("\\p")||r.lookingAt("\\P")){const t=new zc;if(this.parseUnicodeClass(r,t)){n.runes=t.toArray(),this.push(n);break t}}const s=new zc;if(this.parsePerlClassEscape(r,s)){n.runes=s.toArray(),this.push(n);break t}r.rewindTo(e),this.reuse(n),this.literal(t.parseEscape(r));break}default:this.literal(r.pop())}e=i}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),1!==this.stack.length)throw new KB(t.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(e){const n=e.pos(),s=e.rest();if(s.startsWith("(?P<")||s.startsWith("(?<")){const n="P"===s.charAt(2)?4:3,r=s.indexOf(">");if(r<0)throw new KB(t.ERR_INVALID_NAMED_CAPTURE,s);const i=s.substring(n,r);if(e.skipString(i),e.skip(n+1),!t.isValidCaptureName(i))throw new KB(t.ERR_INVALID_NAMED_CAPTURE,s.substring(0,r+1));const o=this.op(fc.Op.LEFT_PAREN);if(o.cap=++this.numCap,this.namedGroups[i])throw new KB(t.ERR_DUPLICATE_NAMED_CAPTURE,i);return this.namedGroups[i]=this.numCap,void(o.name=i)}e.skip(2);let r=this.flags,i=1,o=!1;t:for(;e.more();){const t=e.pop();switch(t){case IB.CODES.i:r|=fB.FOLD_CASE,o=!0;break;case IB.CODES.m:r&=-17,o=!0;break;case IB.CODES.s:r|=fB.DOT_NL,o=!0;break;case IB.CODES.U:r|=fB.NON_GREEDY,o=!0;break;case IB.CODES["-"]:if(i<0)break t;i=-1,r=~r,o=!1;break;case IB.CODES[":"]:case IB.CODES[")"]:if(i<0){if(!o)break t;r=~r}return t===IB.CODES[":"]&&this.op(fc.Op.LEFT_PAREN),void(this.flags=r);default:break t}}throw new KB(t.ERR_INVALID_PERL_OP,e.from(n))}parsePosLookBehind(){const t=this.newRegexp(fc.Op.LEFT_PAREN);return t.flags=this.flags,t.lb=++this.nlb,this.push(t)}parseNegLookBehind(){const t=this.newRegexp(fc.Op.LEFT_PAREN);return t.flags=this.flags,t.lb=-++this.nlb,this.push(t)}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(fc.Op.VERTICAL_BAR)}swapVerticalBar(){const e=this.stack.length;if(e>=3&&this.stack[e-2].op===fc.Op.VERTICAL_BAR&&t.isCharClass(this.stack[e-1])&&t.isCharClass(this.stack[e-3])){let n=this.stack[e-1],s=this.stack[e-3];if(n.op>s.op){const t=s;s=n,n=t,this.stack[e-3]=s}return t.mergeCharClass(s,n),this.reuse(n),this.pop(),!0}if(e>=2){const t=this.stack[e-1],n=this.stack[e-2];if(n.op===fc.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(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new KB(t.ERR_UNEXPECTED_PAREN,this.wholeRegexp);const e=this.pop(),n=this.pop();if(n.op!==fc.Op.LEFT_PAREN)throw new KB(t.ERR_UNEXPECTED_PAREN,this.wholeRegexp);if(this.flags=n.flags,0!==n.lb){if(t.hasCapture(e))throw new KB(t.ERR_INVALID_CAPTURE_IN_LOOKBEHIND,this.wholeRegexp);return n.lb>0?n.op=fc.Op.PLB:n.op=fc.Op.NLB,n.subs=[e],void this.push(n)}0===n.cap?this.push(e):(n.op=fc.Op.CAPTURE,n.subs=[e],this.push(n))}parsePerlClassEscape(t,e){const n=t.pos();if(0===(this.flags&fB.PERL_X)||!t.more()||t.pop()!==IB.CODES["\\"]||!t.more())return!1;t.pop();const s=t.from(n),r=Rc.has(s)?Rc.get(s):null;return null!==r&&(e.appendGroup(r,0!==(this.flags&fB.FOLD_CASE)),!0)}parseNamedClass(e,n){const s=e.rest(),r=s.indexOf(":]");if(r<0)return!1;const i=s.substring(0,r+2);e.skipString(i);const o=qc.has(i)?qc.get(i):null;if(null===o)throw new KB(t.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,0!==(this.flags&fB.FOLD_CASE)),!0}parseUnicodeClass(e,n){const s=e.pos();if(0===(this.flags&fB.UNICODE_GROUPS)||!e.lookingAt("\\p")&&!e.lookingAt("\\P"))return!1;e.skip(1);let r,i=1,o=e.pop();if(o===IB.CODES.P&&(i=-1),!e.more())throw e.rewindTo(s),new KB(t.ERR_INVALID_CHAR_RANGE,e.rest());if(o=e.pop(),o!==IB.CODES["{"])r=PB.runeToString(o);else{const n=e.rest(),i=n.indexOf("}");if(i<0)throw e.rewindTo(s),new KB(t.ERR_INVALID_CHAR_RANGE,e.rest());r=n.substring(0,i),e.skipString(r),e.skip(1)}0!==r.length&&r.codePointAt(0)===IB.CODES["^"]&&(i=0-i,r=r.substring(1));const a=t.unicodeTable(r);if(null===a)throw new KB(t.ERR_INVALID_CHAR_RANGE,e.from(s));a.sign<0&&(i=0-i);const B=a.tab,c=a.fold;if(0===(this.flags&fB.FOLD_CASE)||null===c)n.appendTableWithSign(B,i);else{const t=(new zc).appendTable(B).appendTable(c).cleanClass().toArray();n.appendClassWithSign(Array.from(t),i)}return!0}parseClass(e){const n=e.pos();e.skip(1);const s=this.newRegexp(fc.Op.CHAR_CLASS);s.flags=this.flags;const r=new zc;let i=1;e.more()&&e.lookingAt("^")&&(i=-1,e.skip(1),0===(this.flags&fB.CLASS_NL)&&r.appendRange(IB.CODES["\n"],IB.CODES["\n"]));let o=!0;for(;!e.more()||e.peek()!==IB.CODES["]"]||o;){if(e.more()&&e.lookingAt("-")&&0===(this.flags&fB.PERL_X)&&!o){const s=e.rest();if("-"===s||!s.startsWith("-]"))throw e.rewindTo(n),new KB(t.ERR_INVALID_CHAR_RANGE,e.rest())}o=!1;const s=e.pos();if(e.lookingAt("[:")){if(this.parseNamedClass(e,r))continue;e.rewindTo(s)}if(this.parseUnicodeClass(e,r))continue;if(this.parsePerlClassEscape(e,r))continue;e.rewindTo(s);const i=t.parseClassChar(e,n);let a=i;if(e.more()&&e.lookingAt("-"))if(e.skip(1),e.more()&&e.lookingAt("]"))e.skip(-1);else if(a=t.parseClassChar(e,n),a<i)throw new KB(t.ERR_INVALID_CHAR_RANGE,e.from(s));0===(this.flags&fB.FOLD_CASE)?r.appendRange(i,a):r.appendFoldedRange(i,a)}e.skip(1),r.cleanClass(),i<0&&r.negateClass(),s.runes=r.toArray(),this.push(s)}},Wc=class t{static initTest(e){const n=t.compile(e),s=new t(n.expr,n.prog,n.numSubexp,n.longest);return s.cond=n.cond,s.prefix=n.prefix,s.prefixUTF8=n.prefixUTF8,s.prefixComplete=n.prefixComplete,s.prefixRune=n.prefixRune,s.prefilter=n.prefilter,s.namedGroups=n.namedGroups,s}static compile(e){return t.compileImpl(e,fB.PERL,!1)}static compilePOSIX(e){return t.compileImpl(e,fB.POSIX,!0)}static compileImpl(e,n,s){let r=Qc.parse(e,n);const i=r.maxCap(),o=r.namedGroups;r=Ic.simplify(r);const a=wc.build(r),B=vc.compileRegexp(r),c=new t(e,B,i,s);c.prefilter=a.type===mc.Type.NONE?null:a;const[l,u]=B.prefix();return c.prefixComplete=l,c.prefix=u,c.prefixUTF8=PB.stringToUtf8ByteArray(c.prefix),c.prefix.length>0&&(c.prefixRune=c.prefix.codePointAt(0)),c.namedGroups=o,c}static match(e,n){return t.compile(e).match(n)}constructor(t,e,n=0,s=0){this.expr=t,this.prog=e,this.numSubexp=n,this.longest=s,this.cond=e.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.namedGroups=Object.create(null),this.machinePool=[],this.lazyDFA=null,this.onepass=pc.compile(this.prog),this.prefilter=null}get dfa(){return null===this.lazyDFA&&(this.lazyDFA=new Bc(this.prog)),this.lazyDFA}matchPrefixComplete(t,e,n,s){if((n===fB.ANCHOR_START||n===fB.ANCHOR_BOTH)&&0!==e)return null;let r=-1,i=-1;const o=t.prefixLength(this);if(n===fB.UNANCHORED){const n=t.index(this,e);if(n<0)return null;r=e+n,i=r+o}else if(n===fB.ANCHOR_BOTH){if(t.endPos()!==o)return null;if(0!==t.index(this,0))return null;r=0,i=o}else if(n===fB.ANCHOR_START){if(0!==t.index(this,0))return null;r=0,i=o}if(r<0)return null;if(s>0){const t=new Int32Array(s).fill(-1);return t[0]=r,t[1]=i,Array.from(t)}return[]}createLookbehindState(){return this.prog.numLb>0?new nc(this.prog):null}executeEngine(t,e,n,s,r=null){if(this.prefixComplete&&(0===s||0===this.numSubexp))return this.matchPrefixComplete(t,e,n,s);if(null!==this.prefilter&&n===fB.UNANCHORED&&!this.prefilter.eval(t,e))return null;if(null!==this.onepass)return pc.execute(this,t,e,n,s);if(s>0)return 0===this.prog.numLb&&t.endPos()<=uc.maxBitStateLen(this.prog)?uc.execute(this,t,e,n,s):this.doExecuteNFA(t,e,n,s,r);if(0===this.prog.numLb){const r=this.dfa.match(t,e,n);if(null!==r)return r?[]:null;if(t.endPos()<=uc.maxBitStateLen(this.prog))return uc.execute(this,t,e,n,s)}return this.doExecuteNFA(t,e,n,s,r)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){return this.machinePool.length>0?this.machinePool.pop():null}reset(){this.machinePool.length=0}put(t){this.machinePool.push(t)}toString(){return this.expr}doExecuteNFA(t,e,n,s,r=null){let i=this.get();i||(i=sc.fromRE2(this)),i.init(s);const o=i.match(t,e,n,r)?i.submatches():null;return this.put(i),o}match(t){return null!==this.executeEngine(qB.fromUTF16(t),0,fB.UNANCHORED,0)}matchWithGroup(t,e,n,s,r,i=null){return t instanceof GB||(t=PB.isByteArray(t)?VB.utf8(t):VB.utf16(t)),this.matchMachineInput(t,e,n,s,r,i)}matchMachineInput(t,e,n,s,r,i=null){if(e>n)return[!1,null];const o=t.isUTF16Encoding()?qB.fromUTF16(t.asCharSequence(),0,n):qB.fromUTF8(t.asBytes(),0,n),a=this.executeEngine(o,e,s,2*r,i);return null===a?[!1,null]:[!0,a]}matchUTF8(t){return null!==this.executeEngine(qB.fromUTF8(t),0,fB.UNANCHORED,0)}replaceAll(t,e){return this.replaceAllFunc(t,()=>e,2*t.length+1)}replaceFirst(t,e){return this.replaceAllFunc(t,()=>e,1)}replaceAllFunc(t,e,n){let s=0,r=0,i="";const o=qB.fromUTF16(t),a=this.createLookbehindState();let B=0;for(;r<=t.length;){const c=this.executeEngine(o,r,fB.UNANCHORED,2,a);if(null===c||0===c.length)break;i+=t.substring(s,c[0]),(c[1]>s||0===c[0])&&(i+=e(t.substring(c[0],c[1])),B++),s=c[1];const l=7&o.step(r);if(r+l>c[1]?r+=l:r+1>c[1]?r++:r=c[1],B>=n)break}return i+=t.substring(s),i}pad(t){if(null===t)return null;let e=2*(1+this.numSubexp);if(t.length<e){let n=new Array(e).fill(-1);for(let e=0;e<t.length;e++)n[e]=t[e];t=n}return t}allMatches(t,e,n=t=>t){let s=[];const r=t.endPos();e<0&&(e=r+1);let i=0,o=0,a=-1;const B=this.createLookbehindState();for(;o<e&&i<=r;){const e=this.executeEngine(t,i,fB.UNANCHORED,this.prog.numCap,B);if(null===e||0===e.length)break;let c=!0;if(e[1]===i){e[0]===a&&(c=!1);const n=t.step(i);n<0?i=r+1:i+=7&n}else i=e[1];a=e[1],c&&(s.push(n(this.pad(e))),o++)}return s}findUTF8(t){const e=this.executeEngine(qB.fromUTF8(t),0,fB.UNANCHORED,2);return null===e?null:t.slice(e[0],e[1])}findUTF8Index(t){const e=this.executeEngine(qB.fromUTF8(t),0,fB.UNANCHORED,2);return null===e?null:e.slice(0,2)}find(t){const e=this.executeEngine(qB.fromUTF16(t),0,fB.UNANCHORED,2);return null===e?"":t.substring(e[0],e[1])}findIndex(t){return this.executeEngine(qB.fromUTF16(t),0,fB.UNANCHORED,2)}findUTF8Submatch(t){const e=this.executeEngine(qB.fromUTF8(t),0,fB.UNANCHORED,this.prog.numCap);if(null===e)return null;const n=new Array(1+this.numSubexp).fill(null);for(let s=0;s<n.length;s++)2*s<e.length&&e[2*s]>=0&&(n[s]=t.slice(e[2*s],e[2*s+1]));return n}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine(qB.fromUTF8(t),0,fB.UNANCHORED,this.prog.numCap))}findSubmatch(t){const e=this.executeEngine(qB.fromUTF16(t),0,fB.UNANCHORED,this.prog.numCap);if(null===e)return null;const n=new Array(1+this.numSubexp).fill(null);for(let s=0;s<n.length;s++)2*s<e.length&&e[2*s]>=0&&(n[s]=t.substring(e[2*s],e[2*s+1]));return n}findSubmatchIndex(t){return this.pad(this.executeEngine(qB.fromUTF16(t),0,fB.UNANCHORED,this.prog.numCap))}findAllUTF8(t,e){const n=this.allMatches(qB.fromUTF8(t),e,e=>t.slice(e[0],e[1]));return 0===n.length?null:n}findAllUTF8Index(t,e){const n=this.allMatches(qB.fromUTF8(t),e,t=>t.slice(0,2));return 0===n.length?null:n}findAll(t,e){const n=this.allMatches(qB.fromUTF16(t),e,e=>t.substring(e[0],e[1]));return 0===n.length?null:n}findAllIndex(t,e){const n=this.allMatches(qB.fromUTF16(t),e,t=>t.slice(0,2));return 0===n.length?null:n}findAllUTF8Submatch(t,e){const n=this.allMatches(qB.fromUTF8(t),e,e=>{let n=new Array(e.length/2|0).fill(null);for(let s=0;s<n.length;s++)e[2*s]>=0&&(n[s]=t.slice(e[2*s],e[2*s+1]));return n});return 0===n.length?null:n}findAllUTF8SubmatchIndex(t,e){const n=this.allMatches(qB.fromUTF8(t),e);return 0===n.length?null:n}findAllSubmatch(t,e){const n=this.allMatches(qB.fromUTF16(t),e,e=>{let n=new Array(e.length/2|0).fill(null);for(let s=0;s<n.length;s++)e[2*s]>=0&&(n[s]=t.substring(e[2*s],e[2*s+1]));return n});return 0===n.length?null:n}findAllSubmatchIndex(t,e){const n=this.allMatches(qB.fromUTF16(t),e);return 0===n.length?null:n}},Yc=class t{static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static translate(e){let n="";if(e instanceof RegExp&&(e.ignoreCase&&(n+="i"),e.multiline&&(n+="m"),e.dotAll&&(n+="s"),e=e.source),"string"!=typeof e)return e;let s="",r=!1,i=e.length;0===i&&(s="(?:)",r=!0);let o=!1,a=0;for(;a<i;){let n=e[a];if("\\"===n){if(a+1<i)switch(n=e[a+1],n){case"\\":s+="\\\\",a+=2;continue;case"c":if(a+2<i){let t=e[a+2].charCodeAt(0);if(t>=65&&t<=90||t>=97&&t<=122){let e=t%32;s+="\\x",s+=(e>>4).toString(16).toUpperCase(),s+=(15&e).toString(16).toUpperCase(),a+=3,r=!0;continue}}s+="c",a+=2,r=!0;continue;case"u":if(a+2<i)if("{"===e[a+2]){let n=a+3,o=!1,B=!1;for(;n<i;){const s=e[n];if("}"===s){B=!0;break}if(!t.isHexadecimal(s))break;o=!0,n++}if(B&&o){s+="\\x",a+=2,r=!0;continue}}else if(a+5<i){let n=!0;for(let s=0;s<4;s++)if(!t.isHexadecimal(e[a+2+s])){n=!1;break}if(n){s+="\\x{"+e.substring(a+2,a+6)+"}",a+=6,r=!0;continue}}s+="u",a+=2,r=!0;continue;case"x":{let n=!1;if(a+2<i&&"{"===e[a+2]){let s=a+3,r=!1,o=!1;for(;s<i;){const n=e[s];if("}"===n){o=!0;break}if(!t.isHexadecimal(n))break;r=!0,s++}o&&r&&(n=!0)}else a+3<i&&t.isHexadecimal(e[a+2])&&t.isHexadecimal(e[a+3])&&(n=!0);n?(s+="\\x",a+=2):(s+="x",a+=2,r=!0);continue}case"n":case"r":case"t":case"a":case"f":case"v":case"d":case"D":case"s":case"S":case"w":case"W":case"b":case"B":case"p":case"P":case"A":case"z":case"Q":case"E":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":s+="\\"+n,a+=2;continue;default:{let t=e.codePointAt(a+1);if(t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122){let n=PB.charCount(t);s+=e.substring(a+1,a+1+n),a+=n+1,r=!0}else{s+="\\";let n=PB.charCount(t);s+=e.substring(a+1,a+1+n),a+=n+1}continue}}}else{if("/"===n){s+="\\/",a+=1,r=!0;continue}if("["===n){if(!o&&"]"===e[a+1]){s+="[^\\x00-\\x{10FFFF}]",a+=2,r=!0;continue}if(!o&&"^"===e[a+1]&&"]"===e[a+2]){s+="[\\x00-\\x{10FFFF}]",a+=3,r=!0;continue}o=!0}else if("]"===n)o=!1;else if(!o&&"("===n&&a+2<i&&"?"===e[a+1]&&"<"===e[a+2]&&a+3<i&&!"=!>)".includes(e[a+3])){s+="(?P<",a+=3,r=!0;continue}}let B=e.codePointAt(a),c=PB.charCount(B);s+=e.substring(a,a+c),a+=c}const B=r?s:e;return n.length>0?`(?${n})${B}`:B}};const Xc=(t,e)=>{const n=t.matchArray();return n.index=t.start(0),n.input=e,n.groups=t.namedGroupsObject(),n};var Zc=class t{static CASE_INSENSITIVE=CB;static DOTALL=gB;static MULTILINE=mB;static DISABLE_UNICODE_GROUPS=wB;static LONGEST_MATCH=yB;static LOOKBEHINDS=EB;static quote(t){return PB.quoteMeta(t)}static quoteReplacement(t,e=!1){return ZB.quoteReplacement(t,e)}static translateRegExp(t){return Yc.translate(t)}static compile(e,n=0){let s=e;if(0!==(n&t.CASE_INSENSITIVE)&&(s=`(?i)${s}`),0!==(n&t.DOTALL)&&(s=`(?s)${s}`),0!==(n&t.MULTILINE)&&(s=`(?m)${s}`),-544&n)throw new YB("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH, LOOKBEHINDS");let r=fB.PERL;0!==(n&t.DISABLE_UNICODE_GROUPS)&&(r&=-129),0!==(n&t.LOOKBEHINDS)&&(r|=fB.LOOKBEHIND);const i=new t(e,n);return i.re2Input=Wc.compileImpl(s,r,0!==(n&t.LONGEST_MATCH)),i}static matches(e,n){return t.compile(e).testExact(n)}static initTest(e,n,s){if(null==e)throw new Error("pattern is null");if(null==s)throw new Error("re2 is null");const r=new t(e,n);return r.re2Input=s,r}constructor(t,e){this.patternInput=t,this.flagsInput=e,this.re2Input=null}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return PB.isByteArray(t)&&(t=VB.utf8(t)),new ZB(this,t)}test(t){return PB.isByteArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){const e=PB.isByteArray(t)?qB.fromUTF8(t):qB.fromUTF16(t);return null!==this.re2Input.executeEngine(e,0,fB.ANCHOR_BOTH,0)}exec(t){const e=this.matcher(t);return e.find()?Xc(e,t):null}split(t,e=0){const n=this.matcher(t),s=[];let r=0,i=0;for(;n.find();)if(0!==i||0!==n.end()){if(e>0&&s.length===e-1)break;if(i===n.start()){if(0===e){r+=1,i=n.end();continue}}else for(;r>0;)s.push(""),r-=1;s.push(n.substring(i,n.start())),i=n.end()}else i=n.end();if(0===e&&i!==n.inputLength()){for(;r>0;)s.push(""),r-=1;s.push(n.substring(i,n.inputLength()))}return 0===e&&(0!==s.length||i===n.inputLength()&&i>0)||s.push(n.substring(i,n.inputLength())),s}*matchAll(t){const e=this.matcher(t);for(;e.find();)yield Xc(e,t)}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t||null!==t&&this.constructor===t.constructor&&(this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput)}};let tl="12.19.0";const el=new ms("@firebase/firestore");function nl(){return el.logLevel}function sl(t,...e){if(el.logLevel<=ds.DEBUG){const n=e.map(ol);el.debug(`Firestore (${tl}): ${t}`,...n)}}function rl(t,...e){if(el.logLevel<=ds.ERROR){const n=e.map(ol);el.error(`Firestore (${tl}): ${t}`,...n)}}function il(t,...e){if(el.logLevel<=ds.WARN){const n=e.map(ol);el.warn(`Firestore (${tl}): ${t}`,...n)}}function ol(t){if("string"==typeof t)return t;try{return function(t){return JSON.stringify(t)}(t)}catch(e){return t}}function al(t,e,n){let s="Unexpected state";"string"==typeof e?s=e:n=e,Bl(t,s,n)}function Bl(t,e,n){let s=`FIRESTORE (${tl}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(void 0!==n)try{s+=" CONTEXT: "+JSON.stringify(n)}catch(t){s+=" CONTEXT: "+n}throw rl(s),new Error(s)}function cl(t,e,n,s){let r="Unexpected state";"string"==typeof n?r=n:s=n,t||Bl(e,r,s)}function ll(t,e){return t}function ul(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}class hl{static newId(){const t=62*Math.floor(256/62);let e="";for(;e.length<20;){const n=ul(40);for(let s=0;s<n.length;++s)e.length<20&&n[s]<t&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[s]%62))}return e}}function dl(t,e){return t<e?-1:t>e?1:0}function pl(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++){const n=t.charAt(s),r=e.charAt(s);if(n!==r)return gl(n)===gl(r)?dl(n,r):gl(n)?1:-1}return dl(t.length,e.length)}const fl=55296,Cl=57343;function gl(t){const e=t.charCodeAt(0);return e>=fl&&e<=Cl}function ml(t,e,n){return t.length===e.length&&t.every((t,s)=>n(t,e[s]))}class wl{constructor(t,e){this.comparator=t,this.root=e||El.EMPTY}insert(t,e){return new wl(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,El.BLACK,null,null))}remove(t){return new wl(this.comparator,this.root.remove(t,this.comparator).copy(null,null,El.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const s=this.comparator(t,n.key);if(0===s)return e+n.left.size;s<0?n=n.left:(e+=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(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal((e,n)=>(t(e,n),!1))}toString(){const t=[];return this.inorderTraversal((e,n)=>(t.push(`${e}:${n}`),!1)),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new yl(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new yl(this.root,t,this.comparator,!1)}getReverseIterator(){return new yl(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new yl(this.root,t,this.comparator,!0)}}class yl{constructor(t,e,n,s){this.isReverse=s,this.nodeStack=[];let r=1;for(;!t.isEmpty();)if(r=e?n(t.key,e):1,e&&s&&(r*=-1),r<0)t=this.isReverse?t.left:t.right;else{if(0===r){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class El{constructor(t,e,n,s,r){this.key=t,this.value=e,this.color=null!=n?n:El.RED,this.left=null!=s?s:El.EMPTY,this.right=null!=r?r:El.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,s,r){return new El(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=s?s:this.left,null!=r?r:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}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(t,e,n){let s=this;const r=n(t,s.key);return s=r<0?s.copy(null,null,null,s.left.insert(t,e,n),null):0===r?s.copy(null,e,null,null,null):s.copy(null,null,null,null,s.right.insert(t,e,n)),s.fixUp()}removeMin(){if(this.left.isEmpty())return El.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,s=this;if(e(t,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(t,e),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),0===e(t,s.key)){if(s.right.isEmpty())return El.EMPTY;n=s.right.min(),s=s.copy(n.key,n.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(t,e))}return s.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,El.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,El.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw al(43730,{key:this.key,value:this.value});if(this.right.isRed())throw al(14113,{key:this.key,value:this.value});const t=this.left.check();if(t!==this.right.check())throw al(27949);return t+(this.isRed()?0:1)}}El.EMPTY=null,El.RED=!0,El.BLACK=!1,El.EMPTY=new class{constructor(){this.size=0}get key(){throw al(57766)}get value(){throw al(16141)}get color(){throw al(16727)}get left(){throw al(29726)}get right(){throw al(36894)}copy(t,e,n,s,r){return this}insert(t,e,n){return new El(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class Dl{constructor(t){this.comparator=t,this.data=new wl(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal((e,n)=>(t(e),!1))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const s=n.getNext();if(this.comparator(s.key,t[1])>=0)return;e(s.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new _l(this.data.getIterator())}getIteratorFrom(t){return new _l(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach(t=>{e=e.add(t)}),e}isEqual(t){if(!(t instanceof Dl))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,s=n.getNext().key;if(0!==this.comparator(t,s))return!1}return!0}toArray(){const t=[];return this.forEach(e=>{t.push(e)}),t}toString(){const t=[];return this.forEach(e=>t.push(e)),"SortedSet("+t.toString()+")"}copy(t){const e=new Dl(this.comparator);return e.data=t,e}}class _l{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}const bl={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 vl extends Wn{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}const Il="__name__";class Tl{constructor(t,e,n){void 0===e?e=0:e>t.length&&al(637,{offset:e,range:t.length}),void 0===n?n=t.length-e:n>t.length-e&&al(1746,{length:n,range:t.length-e}),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===Tl.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof Tl?t.forEach(t=>{e.push(t)}):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}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(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++){const n=Tl.compareSegments(t.get(s),e.get(s));if(0!==n)return n}return dl(t.length,e.length)}static compareSegments(t,e){const n=Tl.isNumericId(t),s=Tl.isNumericId(e);return n&&!s?-1:!n&&s?1:n&&s?Tl.extractNumericId(t).compare(Tl.extractNumericId(e)):pl(t,e)}static isNumericId(t){return t.startsWith("__id")&&t.endsWith("__")}static extractNumericId(t){return rB.fromString(t.substring(4,t.length-2))}}class Ol extends Tl{construct(t,e,n){return new Ol(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new vl(bl.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter(t=>t.length>0))}return new Ol(e)}static emptyPath(){return new Ol([])}}const Al=/^[_a-zA-Z][_a-zA-Z0-9]*$/;let Sl=class t extends Tl{construct(e,n,s){return new t(e,n,s)}static isValidIdentifier(t){return Al.test(t)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),t.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===Il}static keyField(){return new t([Il])}static fromServerFormat(e){const n=[];let s="",r=0;const i=()=>{if(0===s.length)throw new vl(bl.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(s),s=""};let o=!1;for(;r<e.length;){const t=e[r];if("\\"===t){if(r+1===e.length)throw new vl(bl.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new vl(bl.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);s+=t,r+=2}else"`"===t?(o=!o,r++):"."!==t||o?(s+=t,r++):(i(),r++)}if(i(),o)throw new vl(bl.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new t(n)}static emptyPath(){return new t([])}};class Rl{constructor(t){this.fields=t,t.sort(Sl.comparator)}static empty(){return new Rl([])}unionWith(t){let e=new Dl(Sl.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new Rl(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return ml(this.fields,t.fields,(t,e)=>t.isEqual(e))}}function Nl(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function xl(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function kl(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}class Ll{constructor(t){this.path=t}static fromPath(t){return new Ll(Ol.fromString(t))}static fromName(t){return new Ll(Ol.fromString(t).popFirst(5))}static empty(){return new Ll(Ol.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===Ol.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Ol.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new Ll(new Ol(t.slice()))}}function Fl(t){if(!Ll.isDocumentKey(t))throw new vl(bl.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function Pl(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function Ml(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":al(12329,{type:typeof t})}function Gl(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new vl(bl.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Ml(t);throw new vl(bl.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}function Hl(t,e){const n={typeString:t};return e&&(n.value=e),n}function Ul(t,e){if(!Pl(t))throw new vl(bl.INVALID_ARGUMENT,"JSON must be an object");let n;for(const s in e)if(e[s]){const r=e[s].typeString,i="value"in e[s]?{value:e[s].value}:void 0;if(!(s in t)){n=`JSON missing required field: '${s}'`;break}const o=t[s];if(r&&typeof o!==r){n=`JSON field '${s}' must be a ${r}.`;break}if(void 0!==i&&o!==i.value){n=`Expected '${s}' field to equal '${i.value}'`;break}}if(n)throw new vl(bl.INVALID_ARGUMENT,n);return!0}const Vl=-62135596800,jl=1e6;class $l{static now(){return $l.fromMillis(Date.now())}static fromDate(t){return $l.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor((t-1e3*e)*jl);return new $l(e,n)}static fromInstant(t){if(!t||"bigint"!=typeof t.t)throw new vl(bl.INVALID_ARGUMENT,"Invalid Temporal.Instant object provided.");return $l._fromEpochNanoseconds(t.t)}static _fromEpochNanoseconds(t){let e,n;if(t>=0n)e=Number(t/1000000000n),n=Number(t%1000000000n);else{const s=t%1000000000n;0n===s?(e=Number(t/1000000000n),n=0):(e=Number(t/1000000000n-1n),n=Number(s+1000000000n))}return new $l(e,n)}constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new vl(bl.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new vl(bl.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<Vl)throw new vl(bl.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new vl(bl.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/jl}toInstant(){if("undefined"==typeof Temporal||!Temporal.Instant)throw new vl(bl.FAILED_PRECONDITION,"The Temporal object is not available in the current environment.");const t=1000000000n*BigInt(this.seconds)+BigInt(this.nanoseconds);return Temporal.Instant.__PRIVATE_fromEpochNanoseconds(t)}_compareTo(t){return this.seconds===t.seconds?dl(this.nanoseconds,t.nanoseconds):dl(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:$l._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(Ul(t,$l._jsonSchema))return new $l(t.seconds,t.nanoseconds)}valueOf(){const t=this.seconds-Vl;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}$l._jsonSchemaVersion="firestore/timestamp/1.0",$l._jsonSchema={type:Hl("string",$l._jsonSchemaVersion),seconds:Hl("number"),nanoseconds:Hl("number")};class Jl extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class ql{constructor(t){this.binaryString=t}static fromBase64String(t){const e=function(t){try{return atob(t)}catch(t){throw"undefined"!=typeof DOMException&&t instanceof DOMException?new Jl("Invalid base64 string: "+t):t}}(t);return new ql(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new ql(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(t){return btoa(t)}(this.binaryString)}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return dl(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}ql.EMPTY_BYTE_STRING=new ql("");const zl=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Kl(t){if(cl(!!t,39018),"string"==typeof t){let e=0;const n=zl.exec(t);if(cl(!!n,46558,{timestamp:t}),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const s=new Date(t);return{seconds:Math.floor(s.getTime()/1e3),nanos:e}}return{seconds:Ql(t.seconds),nanos:Ql(t.nanos)}}function Ql(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Wl(t){return"string"==typeof t?ql.fromBase64String(t):ql.fromUint8Array(t)}const Yl="server_timestamp",Xl="__type__",Zl="__previous_value__",tu="__local_write_time__";function eu(t){const e=(t?.mapValue?.fields||{})[Xl]?.stringValue;return e===Yl}function nu(t){const e=t.mapValue.fields[Zl];return eu(e)?nu(e):e}function su(t){const e=Kl(t.mapValue.fields[tu].timestampValue);return new $l(e.seconds,e.nanos)}class ru{constructor(t,e,n,s,r,i,o,a,B,c,l,u,h){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=s,this.ssl=r,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=B,this.isUsingEmulator=c,this.apiKey=l,this._customHeaders=u,this.grpcFlowControlWindow=h}}const iu="(default)";class ou{constructor(t,e){this.projectId=t,this.database=e||iu}static empty(){return new ou("","")}get isDefaultDatabase(){return this.database===iu}isEqual(t){return t instanceof ou&&t.projectId===this.projectId&&t.database===this.database}}function au(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new vl(bl.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ou(t.options.projectId,e)}function Bu(t){return null==t}function cu(t){return 0===t&&1/t==-1/0}const lu="__type__",uu="__max__",hu={},du="__vector__",pu="value",fu={nullValue:"NULL_VALUE"},Cu={booleanValue:!0},gu={booleanValue:!1};function mu(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?eu(t)?4:function(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===uu}(t)?9007199254740991:ku(t)?10:11:al(28295,{value:t})}function wu(t,e,n){if(t===e)return!0;const s=mu(t);if(s!==mu(e))return!1;switch(s){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return su(t).isEqual(su(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=Kl(t.timestampValue),s=Kl(e.timestampValue);return n.seconds===s.seconds&&n.nanos===s.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return Wl(t.bytesValue).isEqual(Wl(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Ql(t.geoPointValue.latitude)===Ql(e.geoPointValue.latitude)&&Ql(t.geoPointValue.longitude)===Ql(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e,n){if("integerValue"in t&&"integerValue"in e)return Ql(t.integerValue)===Ql(e.integerValue);let s,r;if("doubleValue"in t&&"doubleValue"in e)s=Ql(t.doubleValue),r=Ql(e.doubleValue);else{if(!n?.i)return!1;s=Ql(t.integerValue??t.doubleValue),r=Ql(e.integerValue??e.doubleValue)}return s===r?!!n?.o||cu(s)===cu(r):!(void 0!==n&&!n.u)&&isNaN(s)&&isNaN(r)}(t,e,n);case 9:return ml(t.arrayValue.values||[],e.arrayValue.values||[],(t,e)=>wu(t,e,n));case 10:case 11:return function(t,e,n){const s=t.mapValue.fields||{},r=e.mapValue.fields||{};if(Nl(s)!==Nl(r))return!1;for(const t in s)if(s.hasOwnProperty(t)&&(void 0===r[t]||!wu(s[t],r[t],n)))return!1;return!0}(t,e,n);default:return al(52216,{left:t})}}function yu(t,e){return void 0!==(t.values||[]).find(t=>wu(t,e))}function Eu(t,e){if(t===e)return 0;const n=mu(t),s=mu(e);if(n!==s)return dl(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return dl(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ql(t.integerValue||t.doubleValue),s=Ql(e.integerValue||e.doubleValue);return n<s?-1:n>s?1:n===s?0:isNaN(n)?isNaN(s)?0:-1:1}(t,e);case 3:return Du(t.timestampValue,e.timestampValue);case 4:return Du(su(t),su(e));case 5:return pl(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Wl(t),s=Wl(e);return n.compareTo(s)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),s=e.split("/");for(let t=0;t<n.length&&t<s.length;t++){const e=dl(n[t],s[t]);if(0!==e)return e}return dl(n.length,s.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=dl(Ql(t.latitude),Ql(e.latitude));return 0!==n?n:dl(Ql(t.longitude),Ql(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return _u(t.arrayValue,e.arrayValue);case 10:return function(t,e){const n=t.fields||{},s=e.fields||{},r=n[pu]?.arrayValue,i=s[pu]?.arrayValue,o=dl(r?.values?.length||0,i?.values?.length||0);return 0!==o?o:_u(r,i)}(t.mapValue,e.mapValue);case 11:return function(t,e){if(t===hu&&e===hu)return 0;if(t===hu)return 1;if(e===hu)return-1;const n=t.fields||{},s=Object.keys(n),r=e.fields||{},i=Object.keys(r);s.sort(),i.sort();for(let t=0;t<s.length&&t<i.length;++t){const e=pl(s[t],i[t]);if(0!==e)return e;const o=Eu(n[s[t]],r[i[t]]);if(0!==o)return o}return dl(s.length,i.length)}(t.mapValue,e.mapValue);default:throw al(23264,{l:n})}}function Du(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return dl(t,e);const n=Kl(t),s=Kl(e),r=dl(n.seconds,s.seconds);return 0!==r?r:dl(n.nanos,s.nanos)}function _u(t,e){const n=t.values||[],s=e.values||[];for(let t=0;t<n.length&&t<s.length;++t){const e=Eu(n[t],s[t]);if(void 0!==e&&0!==e)return e}return dl(n.length,s.length)}function bu(t){return vu(t)}function vu(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=Kl(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?function(t){return Wl(t).toBase64()}(t.bytesValue):"referenceValue"in t?function(t){return Ll.fromName(t).toString()}(t.referenceValue):"geoPointValue"in t?function(t){return`geo(${t.latitude},${t.longitude})`}(t.geoPointValue):"arrayValue"in t?function(t){let e="[",n=!0;for(const s of t.values||[])n?n=!1:e+=",",e+=vu(s);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",s=!0;for(const r of e)s?s=!1:n+=",",n+=`${r}:${vu(t.fields[r])}`;return n+"}"}(t.mapValue):al(61005,{value:t})}function Iu(t){switch(mu(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=nu(t);return e?16+Iu(e):16;case 5:return 2*t.stringValue.length;case 6:return Wl(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return function(t){return(t.values||[]).reduce((t,e)=>t+Iu(e),0)}(t.arrayValue);case 10:case 11:return function(t){let e=0;return xl(t.fields,(t,n)=>{e+=t.length+Iu(n)}),e}(t.mapValue);default:throw al(13486,{value:t})}}function Tu(t){return!!t&&"integerValue"in t}function Ou(t){return!!t&&"doubleValue"in t}function Au(t){return Tu(t)||Ou(t)}function Su(t){return!!t&&"arrayValue"in t}function Ru(t){return!!t&&"nullValue"in t}function Nu(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function xu(t){return!!t&&"mapValue"in t}function ku(t){const e=(t?.mapValue?.fields||{})[lu]?.stringValue;return e===du}function Lu(t){return(t?.mapValue?.fields||{})[pu]?.arrayValue}function Fu(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return xl(t.mapValue.fields,(t,n)=>e.mapValue.fields[t]=Fu(n)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Fu(t.arrayValue.values[n]);return e}return{...t}}class Pu{constructor(t){this.value=t}static empty(){return new Pu({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!xu(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Fu(e)}setAll(t){let e=Sl.emptyPath(),n={},s=[];t.forEach((t,r)=>{if(!e.isImmediateParentOf(r)){const t=this.getFieldsMap(e);this.applyChanges(t,n,s),n={},s=[],e=r.popLast()}t?n[r.lastSegment()]=Fu(t):s.push(r.lastSegment())});const r=this.getFieldsMap(e);this.applyChanges(r,n,s)}delete(t){const e=this.field(t.popLast());xu(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return wu(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let s=e.mapValue.fields[t.get(n)];xu(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=s),e=s}return e.mapValue.fields}applyChanges(t,e,n){xl(e,(e,n)=>t[e]=n);for(const e of n)delete t[e]}clone(){return new Pu(Fu(this.value))}}function Mu(t){const e=[];return xl(t.fields,(t,n)=>{const s=new Sl([t]);if(xu(n)){const t=Mu(n.mapValue).fields;if(0===t.length)e.push(s);else for(const n of t)e.push(s.child(n))}else e.push(s)}),new Rl(e)}function Gu(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:cu(e)?"-0":e}}function Hu(t){return{integerValue:""+t}}function Uu(t,e,n){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!cu(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Hu(e):Gu(t,e)}class Vu{constructor(){this._=void 0}}function ju(t,e,n){return t instanceof qu?function(t,e){const n={fields:{[Xl]:{stringValue:Yl},[tu]:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&eu(e)&&(e=nu(e)),e&&(n.fields[Zl]=e),{mapValue:n}}(n,e):t instanceof zu?Ku(t,e):t instanceof Qu?Wu(t,e):t instanceof Xu?function(t,e){const n=Ju(t,e),s=nh(n)+nh(t.h);return Tu(n)&&Tu(t.h)?Hu(s):Gu(t.serializer,s)}(t,e):t instanceof Zu?function(t,e){return eh(t,e,Math.min)}(t,e):t instanceof th?function(t,e){return eh(t,e,Math.max)}(t,e):void 0}function $u(t,e,n){return t instanceof zu?Ku(t,e):t instanceof Qu?Wu(t,e):n}function Ju(t,e){return t instanceof Xu?Au(e)?e:{integerValue:0}:null}class qu extends Vu{}class zu extends Vu{constructor(t){super(),this.elements=t}}function Ku(t,e){const n=sh(e);for(const e of t.elements)n.some(t=>wu(t,e))||n.push(e);return{arrayValue:{values:n}}}class Qu extends Vu{constructor(t){super(),this.elements=t}}function Wu(t,e){let n=sh(e);for(const e of t.elements)n=n.filter(t=>!wu(t,e));return{arrayValue:{values:n}}}class Yu extends Vu{constructor(t,e){super(),this.serializer=t,this.h=e}}class Xu extends Yu{}class Zu extends Yu{}class th extends Yu{}function eh(t,e,n){if(!Au(e))return t.h;const s=n(nh(e),nh(t.h));return Tu(e)&&Tu(t.h)?Hu(s):Gu(t.serializer,s)}function nh(t){return Ql(t.integerValue||t.doubleValue)}function sh(t){return Su(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class rh{constructor(t,e){this.version=t,this.transformResults=e}}class ih{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new ih}static exists(t){return new ih(void 0,t)}static updateTime(t){return new ih(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function oh(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ah{}function Bh(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new mh(t.key,ih.none()):new dh(t.key,t.data,ih.none());{const n=t.data,s=Pu.empty();let r=new Dl(Sl.comparator);for(let t of e.fields)if(!r.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?s.delete(t):s.set(t,e),r=r.add(t)}return new ph(t.key,s,new Rl(r.toArray()),ih.none())}}function ch(t,e,n){t instanceof dh?function(t,e,n){const s=t.value.clone(),r=Ch(t.fieldTransforms,e,n.transformResults);s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):t instanceof ph?function(t,e,n){if(!oh(t.precondition,e))return void e.convertToUnknownDocument(n.version);const s=Ch(t.fieldTransforms,e,n.transformResults),r=e.data;r.setAll(fh(t)),r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function lh(t,e,n,s){return t instanceof dh?function(t,e,n,s){if(!oh(t.precondition,e))return n;const r=t.value.clone(),i=gh(t.fieldTransforms,s,e);return r.setAll(i),e.convertToFoundDocument(e.version,r).setHasLocalMutations(),null}(t,e,n,s):t instanceof ph?function(t,e,n,s){if(!oh(t.precondition,e))return n;const r=gh(t.fieldTransforms,s,e),i=e.data;return i.setAll(fh(t)),i.setAll(r),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map(t=>t.field))}(t,e,n,s):function(t,e,n){return oh(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function uh(t,e){let n=null;for(const s of t.fieldTransforms){const t=e.data.field(s.field),r=Ju(s.transform,t||null);null!=r&&(null===n&&(n=Pu.empty()),n.set(s.field,r))}return n||null}function hh(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&ml(t,e,(t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof zu&&e instanceof zu||t instanceof Qu&&e instanceof Qu?ml(t.elements,e.elements,wu):t instanceof Xu&&e instanceof Xu||t instanceof Zu&&e instanceof Zu||t instanceof th&&e instanceof th?wu(t.h,e.h):t instanceof qu&&e instanceof qu}(t.transform,e.transform)}(t,e))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class dh extends ah{constructor(t,e,n,s=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class ph extends ah{constructor(t,e,n,s,r=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=s,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function fh(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const s=t.data.field(n);e.set(n,s)}}),e}function Ch(t,e,n){const s=new Map;cl(t.length===n.length,32656,{T:n.length,P:t.length});for(let r=0;r<n.length;r++){const i=t[r],o=i.transform,a=e.data.field(i.field);s.set(i.field,$u(o,a,n[r]))}return s}function gh(t,e,n){const s=new Map;for(const r of t){const t=r.transform,i=n.data.field(r.field);s.set(r.field,ju(t,i,e))}return s}class mh extends ah{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class wh extends ah{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class yh{constructor(t,e){this.position=t,this.inclusive=e}}function Eh(t,e,n){let s=0;for(let r=0;r<t.position.length;r++){const i=e[r],o=t.position[r];if(s=i.field.isKeyField()?Ll.comparator(Ll.fromName(o.referenceValue),n.key):Eu(o,n.data.field(i.field)),"desc"===i.dir&&(s*=-1),0!==s)break}return s}function Dh(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!wu(t.position[n],e.position[n]))return!1;return!0}class _h{}class bh extends _h{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new Rh(t,e,n):"array-contains"===e?new Lh(t,n):"in"===e?new Fh(t,n):"not-in"===e?new Ph(t,n):"array-contains-any"===e?new Mh(t,n):new bh(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new Nh(t,n):new xh(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&void 0===e.nullValue&&this.matchesComparison(Eu(e,this.value)):null!==e&&mu(this.value)===mu(e)&&this.matchesComparison(Eu(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return al(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class vh extends _h{constructor(t,e){super(),this.filters=t,this.op=e,this.I=null}static create(t,e){return new vh(t,e)}matches(t){return Ih(this)?void 0===this.filters.find(e=>!e.matches(t)):void 0!==this.filters.find(e=>e.matches(t))}getFlattenedFilters(){return null!==this.I||(this.I=this.filters.reduce((t,e)=>t.concat(e.getFlattenedFilters()),[])),this.I}getFilters(){return Object.assign([],this.filters)}}function Ih(t){return"and"===t.op}function Th(t){return function(t){for(const e of t.filters)if(e instanceof vh)return!1;return!0}(t)&&Ih(t)}function Oh(t){if(t instanceof bh)return t.field.canonicalString()+t.op.toString()+bu(t.value);if(Th(t))return t.filters.map(t=>Oh(t)).join(",");{const e=t.filters.map(t=>Oh(t)).join(",");return`${t.op}(${e})`}}function Ah(t,e){return t instanceof bh?function(t,e){return e instanceof bh&&t.op===e.op&&t.field.isEqual(e.field)&&wu(t.value,e.value)}(t,e):t instanceof vh?function(t,e){return e instanceof vh&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce((t,n,s)=>t&&Ah(n,e.filters[s]),!0)}(t,e):void al(19439)}function Sh(t){return t instanceof bh?function(t){return`${t.field.canonicalString()} ${t.op} ${bu(t.value)}`}(t):t instanceof vh?function(t){return t.op.toString()+" {"+t.getFilters().map(Sh).join(" ,")+"}"}(t):"Filter"}class Rh extends bh{constructor(t,e,n){super(t,e,n),this.key=Ll.fromName(n.referenceValue)}matches(t){const e=Ll.comparator(t.key,this.key);return this.matchesComparison(e)}}class Nh extends bh{constructor(t,e){super(t,"in",e),this.keys=kh("in",e)}matches(t){return this.keys.some(e=>e.isEqual(t.key))}}class xh extends bh{constructor(t,e){super(t,"not-in",e),this.keys=kh("not-in",e)}matches(t){return!this.keys.some(e=>e.isEqual(t.key))}}function kh(t,e){return(e.arrayValue?.values||[]).map(t=>Ll.fromName(t.referenceValue))}class Lh extends bh{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Su(e)&&yu(e.arrayValue,this.value)}}class Fh extends bh{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&yu(this.value.arrayValue,e)}}class Ph extends bh{constructor(t,e){super(t,"not-in",e)}matches(t){if(yu(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&void 0===e.nullValue&&!yu(this.value.arrayValue,e)}}class Mh extends bh{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Su(e)||!e.arrayValue.values)&&e.arrayValue.values.some(t=>yu(this.value.arrayValue,t))}}class Gh{constructor(t,e="asc"){this.field=t,this.dir=e}}function Hh(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}class Uh{static fromTimestamp(t){return new Uh(t)}static min(){return new Uh(new $l(0,0))}static max(){return new Uh(new $l(253402300799,999999999))}constructor(t){this.timestamp=t}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}class Vh{constructor(t,e,n,s,r,i,o){this.key=t,this.documentType=e,this.version=n,this.readTime=s,this.createTime=r,this.data=i,this.documentState=o}static newInvalidDocument(t){return new Vh(t,0,Uh.min(),Uh.min(),Uh.min(),Pu.empty(),0)}static newFoundDocument(t,e,n,s){return new Vh(t,1,e,Uh.min(),n,s,0)}static newNoDocument(t,e){return new Vh(t,2,e,Uh.min(),Uh.min(),Pu.empty(),0)}static newUnknownDocument(t,e){return new Vh(t,3,e,Uh.min(),Uh.min(),Pu.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(Uh.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=Pu.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=Pu.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Uh.min(),this}setReadTime(t){return this.readTime=t,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(t){return t instanceof Vh&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new Vh(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}})`}}function jh(t){return new $h(t.readTime,t.key,-1)}class $h{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new $h(Uh.min(),Ll.empty(),-1)}static max(){return new $h(Uh.max(),Ll.empty(),-1)}}function Jh(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=Ll.comparator(t.documentKey,e.documentKey),0!==n?n:dl(t.largestBatchId,e.largestBatchId))}class qh{constructor(t,e=null,n=[],s=[],r=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=s,this.limit=r,this.startAt=i,this.endAt=o,this.R=null}}function zh(t,e=null,n=[],s=[],r=null,i=null,o=null){return new qh(t,e,n,s,r,i,o)}function Kh(t){const e=ll(t);if(null===e.R){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(t=>Oh(t)).join(","),t+="|ob:",t+=e.orderBy.map(t=>function(t){return t.field.canonicalString()+t.dir}(t)).join(","),Bu(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(t=>bu(t)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(t=>bu(t)).join(",")),e.R=t}return e.R}function Qh(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!Hh(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!Ah(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Dh(t.startAt,e.startAt)&&Dh(t.endAt,e.endAt)}class Wh{constructor(t,e=null,n=[],s=[],r=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=s,this.limit=r,this.limitType=i,this.startAt=o,this.endAt=a,this.A=null,this.V=null,this.m=null,this.startAt,this.endAt}}function Yh(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function Xh(t){const e=ll(t);if(null===e.A){e.A=[];const t=new Set;for(const n of e.explicitOrderBy)e.A.push(n),t.add(n.field.canonicalString());const n=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc",s=function(t){let e=new Dl(Sl.comparator);return t.filters.forEach(t=>{t.getFlattenedFilters().forEach(t=>{t.isInequality()&&(e=e.add(t.field))})}),e}(e);s.forEach(s=>{t.has(s.canonicalString())||s.isKeyField()||e.A.push(new Gh(s,n))}),t.has(Sl.keyField().canonicalString())||e.A.push(new Gh(Sl.keyField(),n))}return e.A}function Zh(t){const e=ll(t);return e.V||(e.V=function(t,e){if("F"===t.limitType)return zh(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(t=>{const e="desc"===t.dir?"asc":"desc";return new Gh(t.field,e)});const n=t.endAt?new yh(t.endAt.position,t.endAt.inclusive):null,s=t.startAt?new yh(t.startAt.position,t.startAt.inclusive):null;return zh(t.path,t.collectionGroup,e,t.filters,t.limit,n,s)}}(e,Xh(t))),e.V}function td(t,e,n){return new Wh(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function ed(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map(t=>Sh(t)).join(", ")}]`),Bu(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map(t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t)).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map(t=>bu(t)).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(t=>bu(t)).join(",")),`Target(${e})`}(Zh(t))}; limitType=${t.limitType})`}function nd(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):Ll.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Xh(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const s=Eh(t,e,n);return t.inclusive?s<=0:s<0}(t.startAt,Xh(t),e))&&!(t.endAt&&!function(t,e,n){const s=Eh(t,e,n);return t.inclusive?s>=0:s>0}(t.endAt,Xh(t),e))}(t,e)}function sd(t){return(e,n)=>{let s=!1;for(const r of Xh(t)){const t=rd(r,e,n);if(0!==t)return t;s=s||r.field.isKeyField()}return 0}}function rd(t,e,n){const s=t.field.isKeyField()?Ll.comparator(e.key,n.key):function(t,e,n){const s=e.data.field(t),r=n.data.field(t);return null!==s&&null!==r?Eu(s,r):al(42886)}(t.field,e,n);switch(t.dir){case"asc":return s;case"desc":return-1*s;default:return al(19790,{direction:t.dir})}}var id,od;function ad(t){if(void 0===t)return rl("GRPC error has no .code"),bl.UNKNOWN;switch(t){case id.OK:return bl.OK;case id.CANCELLED:return bl.CANCELLED;case id.UNKNOWN:return bl.UNKNOWN;case id.DEADLINE_EXCEEDED:return bl.DEADLINE_EXCEEDED;case id.RESOURCE_EXHAUSTED:return bl.RESOURCE_EXHAUSTED;case id.INTERNAL:return bl.INTERNAL;case id.UNAVAILABLE:return bl.UNAVAILABLE;case id.UNAUTHENTICATED:return bl.UNAUTHENTICATED;case id.INVALID_ARGUMENT:return bl.INVALID_ARGUMENT;case id.NOT_FOUND:return bl.NOT_FOUND;case id.ALREADY_EXISTS:return bl.ALREADY_EXISTS;case id.PERMISSION_DENIED:return bl.PERMISSION_DENIED;case id.FAILED_PRECONDITION:return bl.FAILED_PRECONDITION;case id.ABORTED:return bl.ABORTED;case id.OUT_OF_RANGE:return bl.OUT_OF_RANGE;case id.UNIMPLEMENTED:return bl.UNIMPLEMENTED;case id.DATA_LOSS:return bl.DATA_LOSS;default:return al(39323,{code:t})}}(od=id||(id={}))[od.OK=0]="OK",od[od.CANCELLED=1]="CANCELLED",od[od.UNKNOWN=2]="UNKNOWN",od[od.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",od[od.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",od[od.NOT_FOUND=5]="NOT_FOUND",od[od.ALREADY_EXISTS=6]="ALREADY_EXISTS",od[od.PERMISSION_DENIED=7]="PERMISSION_DENIED",od[od.UNAUTHENTICATED=16]="UNAUTHENTICATED",od[od.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",od[od.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",od[od.ABORTED=10]="ABORTED",od[od.OUT_OF_RANGE=11]="OUT_OF_RANGE",od[od.UNIMPLEMENTED=12]="UNIMPLEMENTED",od[od.INTERNAL=13]="INTERNAL",od[od.UNAVAILABLE=14]="UNAVAILABLE",od[od.DATA_LOSS=15]="DATA_LOSS";class Bd{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,s]of n)if(this.equalsFn(e,t))return s}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),s=this.inner[n];if(void 0===s)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<s.length;n++)if(this.equalsFn(s[n][0],t))return void(s[n]=[t,e]);s.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],t))return 1===n.length?delete this.inner[e]:n.splice(s,1),this.innerSize--,!0;return!1}forEach(t){xl(this.inner,(e,n)=>{for(const[e,s]of n)t(e,s)})}isEmpty(){return kl(this.inner)}size(){return this.innerSize}}const cd=new wl(Ll.comparator);function ld(){return cd}const ud=new wl(Ll.comparator);function hd(...t){let e=ud;for(const n of t)e=e.insert(n.key,n);return e}function dd(t){let e=ud;return t.forEach((t,n)=>e=e.insert(t,n.overlayedDocument)),e}function pd(){return Cd()}function fd(){return Cd()}function Cd(){return new Bd(t=>t.toString(),(t,e)=>t.isEqual(e))}const gd=new wl(Ll.comparator),md=new Dl(Ll.comparator);function wd(...t){let e=md;for(const n of t)e=e.add(n);return e}const yd=new Dl(dl);new rB([4294967295,4294967295],0);class Ed{constructor(t,e){this.databaseId=t,this.useProto3Json=e}}function Dd(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function _d(t){const e=Kl(t);return new $l(e.seconds,e.nanos)}function bd(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function vd(t,e){return Dd(t,e.toTimestamp())}function Id(t){return cl(!!t,49232),Uh.fromTimestamp(_d(t))}function Td(t,e){return Od(t,e).canonicalString()}function Od(t,e){const n=function(t){return new Ol(["projects",t.projectId,"databases",t.database])}(t).child("documents");return void 0===e?n:n.child(e)}function Ad(t,e){return Td(t.databaseId,e.path)}function Sd(t){const e=function(t){const e=Ol.fromString(t);return cl(function(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}(e),10190,{key:e.toString()}),e}(t);return 4===e.length?Ol.emptyPath():function(t){return cl(t.length>4&&"documents"===t.get(4),29091,{key:t.toString()}),t.popFirst(5)}(e)}function Rd(t,e,n){return{name:Ad(t,e),fields:n.value.mapValue.fields}}function Nd(t){let e=Sd(t.parent);const n=t.structuredQuery,s=n.from?n.from.length:0;let r=null;if(s>0){cl(1===s,65062);const t=n.from[0];t.allDescendants?r=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=xd(t);return e instanceof vh&&Th(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=function(t){return t.map(t=>function(t){return new Gh(kd(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))}(n.orderBy));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,Bu(e)?null:e}(n.limit));let B=null;n.startAt&&(B=function(t){const e=!!t.before,n=t.values||[];return new yh(n,e)}(n.startAt));let c=null;return n.endAt&&(c=function(t){const e=!t.before,n=t.values||[];return new yh(n,e)}(n.endAt)),function(t,e,n,s,r,i,o,a){return new Wh(t,e,n,s,r,i,o,a)}(e,r,o,i,a,"F",B,c)}function xd(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=kd(t.unaryFilter.field);return bh.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=kd(t.unaryFilter.field);return bh.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=kd(t.unaryFilter.field);return bh.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=kd(t.unaryFilter.field);return bh.create(r,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return al(61313);default:return al(60726)}}(t):void 0!==t.fieldFilter?function(t){return bh.create(kd(t.fieldFilter.field),function(t){switch(t){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 al(58110);default:return al(50506)}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return vh.create(t.compositeFilter.filters.map(t=>xd(t)),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return al(1026)}}(t.compositeFilter.op))}(t):al(30097,{filter:t})}function kd(t){return Sl.fromServerFormat(t.fieldPath)}function Ld(t){const e=[];return t.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function Fd(t){return!!t&&"function"==typeof t._toProto&&"ProtoValue"===t._protoValueType}function Pd(t,e){const n={fields:{}};return e.forEach((e,s)=>{if("string"!=typeof s)throw new Error(`Cannot encode map with non-string key: ${s}`);n.fields[s]=e._toProto(t)}),{mapValue:n}}function Md(t){return{stringValue:t}}function Gd(t){return new Ed(t,!0)}class Hd{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Hd(ql.fromBase64String(t))}catch(t){throw new vl(bl.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Hd(ql.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}toJSON(){return{type:Hd._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(t){if(Ul(t,Hd._jsonSchema))return Hd.fromBase64String(t.bytes)}}Hd._jsonSchemaVersion="firestore/bytes/1.0",Hd._jsonSchema={type:Hl("string",Hd._jsonSchemaVersion),bytes:Hl("string")};class Ud{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new vl(bl.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Sl(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}class Vd{constructor(t){this._methodName=t}}class jd{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new vl(bl.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new vl(bl.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}_compareTo(t){return dl(this._lat,t._lat)||dl(this._long,t._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:jd._jsonSchemaVersion}}static fromJSON(t){if(Ul(t,jd._jsonSchema))return new jd(t.latitude,t.longitude)}}jd._jsonSchemaVersion="firestore/geoPoint/1.0",jd._jsonSchema={type:Hl("string",jd._jsonSchemaVersion),latitude:Hl("number"),longitude:Hl("number")};class $d{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}$d.UNAUTHENTICATED=new $d(null),$d.GOOGLE_CREDENTIALS=new $d("google-credentials-uid"),$d.FIRST_PARTY=new $d("first-party-uid"),$d.MOCK_USER=new $d("mock-user");class Jd{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}}class qd{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class zd{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable(()=>e($d.UNAUTHENTICATED))}shutdown(){}}class Kd{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable(()=>e(this.token.user))}shutdown(){this.changeListener=null}}class Qd{constructor(t){this.De=t,this.currentUser=$d.UNAUTHENTICATED,this.xe=0,this.forceRefresh=!1,this.auth=null}start(t,e){cl(void 0===this.Ce,42304);let n=this.xe;const s=t=>this.xe!==n?(n=this.xe,e(t)):Promise.resolve();let r=new Jd;this.Ce=()=>{this.xe++,this.currentUser=this.Fe(),r.resolve(),r=new Jd,t.enqueueRetryable(()=>s(this.currentUser))};const i=()=>{const e=r;t.enqueueRetryable(async()=>{await e.promise,await s(this.currentUser)})},o=t=>{sl("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.Ce&&(this.auth.addAuthTokenListener(this.Ce),i())};this.De.onInit(t=>o(t)),setTimeout(()=>{if(!this.auth){const t=this.De.getImmediate({optional:!0});t?o(t):(sl("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new Jd)}},0),i()}getToken(){const t=this.xe,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then(e=>this.xe!==t?(sl("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(cl("string"==typeof e.accessToken,31837,{Oe:e}),new qd(e.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.Ce&&this.auth.removeAuthTokenListener(this.Ce),this.Ce=void 0}Fe(){const t=this.auth&&this.auth.getUid();return cl(null===t||"string"==typeof t,2055,{Me:t}),new $d(t)}}class Wd{constructor(t,e,n){this.Ne=t,this.Le=e,this.Be=n,this.type="FirstParty",this.user=$d.FIRST_PARTY,this.Ue=new Map}ke(){return this.Be?this.Be():null}get headers(){this.Ue.set("X-Goog-AuthUser",this.Ne);const t=this.ke();return t&&this.Ue.set("Authorization",t),this.Le&&this.Ue.set("X-Goog-Iam-Authorization-Token",this.Le),this.Ue}}class Yd{constructor(t,e,n){this.Ne=t,this.Le=e,this.Be=n}getToken(){return Promise.resolve(new Wd(this.Ne,this.Le,this.Be))}start(t,e){t.enqueueRetryable(()=>e($d.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Xd{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Zd{constructor(t,e){this.qe=e,this.forceRefresh=!1,this.appCheck=null,this.$e=null,this.Ke=null,yr(t)&&t.settings.appCheckToken&&(this.Ke=t.settings.appCheckToken)}start(t,e){cl(void 0===this.Ce,3512);const n=t=>{null!=t.error&&sl("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.$e;return this.$e=t.token,sl("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.Ce=e=>{t.enqueueRetryable(()=>n(e))};const s=t=>{sl("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.Ce&&this.appCheck.addTokenListener(this.Ce)};this.qe.onInit(t=>s(t)),setTimeout(()=>{if(!this.appCheck){const t=this.qe.getImmediate({optional:!0});t?s(t):sl("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.Ke)return Promise.resolve(new Xd(this.Ke));const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then(t=>t?(cl("string"==typeof t.token,44558,{tokenResult:t}),this.$e=t.token,new Xd(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.Ce&&this.appCheck.removeTokenListener(this.Ce),this.Ce=void 0}}function tp(t){const e={};return void 0!==t.timeoutSeconds&&(e.timeoutSeconds=t.timeoutSeconds),e}class ep{Qe(t){}shutdown(){}}const np="ConnectivityMonitor";class sp{constructor(){this.We=()=>this.Ge(),this.ze=()=>this.je(),this.He=[],this.Je()}Qe(t){this.He.push(t)}shutdown(){window.removeEventListener("online",this.We),window.removeEventListener("offline",this.ze)}Je(){window.addEventListener("online",this.We),window.addEventListener("offline",this.ze)}Ge(){sl(np,"Network connectivity changed: AVAILABLE");for(const t of this.He)t(0)}je(){sl(np,"Network connectivity changed: UNAVAILABLE");for(const t of this.He)t(1)}static Ye(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let rp=null;function ip(){return null===rp?rp=268435456+Math.round(2147483648*Math.random()):rp++,"0x"+rp.toString(16)}const op="RestConnection",ap={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class Bp{get Ze(){return!1}constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Xe=e+"://"+t.host,this.et=`projects/${n}/databases/${s}`,this.tt=this.databaseId.database===iu?`project_id=${n}`:`project_id=${n}&database_id=${s}`}nt(t,e,n,s,r){const i=ip(),o=this.rt(t,e.toUriEncodedString());sl(op,`Sending RPC '${t}' ${i}:`,o,n);const a={"google-cloud-resource-prefix":this.et,"x-goog-request-params":this.tt};this.it(a,s,r);const{host:B}=new URL(o),c=as(B);return this.st(t,o,a,n,c).then(e=>(sl(op,`Received RPC '${t}' ${i}: `,e),e),e=>{throw il(op,`RPC '${t}' ${i} failed with error: `,e,"url: ",o,"request:",n),e})}_t(t,e,n,s,r,i){return this.nt(t,e,n,s,r)}it(t,e,n){if(t["X-Goog-Api-Client"]="gl-js/ fire/"+tl,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach((e,n)=>t[n]=e),n&&n.headers.forEach((e,n)=>t[n]=e),this.databaseInfo._customHeaders)for(const e of Object.keys(this.databaseInfo._customHeaders))t[e]=this.databaseInfo._customHeaders[e]}rt(t,e){const n=ap[t];let s=`${this.Xe}/v1/${e}:${n}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}class cp{constructor(t){this.ot=t.ot,this.ut=t.ut}ct(t){this.lt=t}Et(t){this.ht=t}Tt(t){this.Pt=t}onMessage(t){this.It=t}close(){this.ut()}send(t){this.ot(t)}Rt(){this.lt()}At(){this.ht()}Vt(t){this.Pt(t)}dt(t){this.It(t)}}const lp="WebChannelConnection",up=(t,e,n)=>{t.listen(e,t=>{try{n(t)}catch(t){setTimeout(()=>{throw t},0)}})};class hp extends Bp{constructor(t){super(t),this.ft=[],this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams,this.longPollingOptions=t.longPollingOptions}static gt(){if(!hp.yt){const t=hB();up(t,uB.STAT_EVENT,t=>{t.stat===lB.PROXY?sl(lp,"STAT_EVENT: detected buffering proxy"):t.stat===lB.NOPROXY&&sl(lp,"STAT_EVENT: detected no buffering proxy")}),hp.yt=!0}}st(t,e,n,s,r){const i=ip();return new Promise((r,o)=>{const a=new oB;a.setWithCredentials(!0),a.listenOnce(BB.COMPLETE,()=>{try{switch(a.getLastErrorCode()){case cB.NO_ERROR:const e=a.getResponseJson();sl(lp,`XHR for RPC '${t}' ${i} received:`,JSON.stringify(e)),r(e);break;case cB.TIMEOUT:sl(lp,`RPC '${t}' ${i} timed out`),o(new vl(bl.DEADLINE_EXCEEDED,"Request time out"));break;case cB.HTTP_ERROR:const n=a.getStatus();if(sl(lp,`RPC '${t}' ${i} failed with status:`,n,"response text:",a.getResponseText()),n>0){let t=a.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=t?.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(bl).indexOf(e)>=0?e:bl.UNKNOWN}(e.status);o(new vl(t,e.message))}else o(new vl(bl.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new vl(bl.UNAVAILABLE,"Connection failed."));break;default:al(9055,{wt:t,streamId:i,bt:a.getLastErrorCode(),St:a.getLastError()})}}finally{sl(lp,`RPC '${t}' ${i} completed.`)}});const B=JSON.stringify(s);sl(lp,`RPC '${t}' ${i} sending request:`,s),a.send(e,"POST",B,n,15)})}vt(t,e,n){const s=ip(),r=[this.Xe,"/","google.firestore.v1.Firestore","/",t,"/channel"],i=this.createWebChannelTransport(),o={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},a=this.longPollingOptions.timeoutSeconds;void 0!==a&&(o.longPollingTimeout=Math.round(1e3*a)),this.useFetchStreams&&(o.useFetchStreams=!0),this.it(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const B=r.join("");sl(lp,`Creating RPC '${t}' stream ${s}: ${B}`,o);const c=i.createWebChannel(B,o);this.Dt(c);let l=!1,u=!1;const h=new cp({ot:e=>{u?sl(lp,`Not sending because RPC '${t}' stream ${s} is closed:`,e):(l||(sl(lp,`Opening RPC '${t}' stream ${s} transport.`),c.open(),l=!0),sl(lp,`RPC '${t}' stream ${s} sending:`,e),c.send(e))},ut:()=>c.close()});return up(c,aB.EventType.OPEN,()=>{u||(sl(lp,`RPC '${t}' stream ${s} transport opened.`),h.Rt())}),up(c,aB.EventType.CLOSE,()=>{u||(u=!0,sl(lp,`RPC '${t}' stream ${s} transport closed`),h.Vt(),this.xt(c))}),up(c,aB.EventType.ERROR,e=>{u||(u=!0,il(lp,`RPC '${t}' stream ${s} transport errored. Name:`,e.name,"Message:",e.message),h.Vt(new vl(bl.UNAVAILABLE,"The operation could not be completed")))}),up(c,aB.EventType.MESSAGE,e=>{if(!u){const n=e.data[0];cl(!!n,16349);const r=n,i=r?.error||r[0]?.error;if(i){sl(lp,`RPC '${t}' stream ${s} received error:`,i);const e=i.status;let n=function(t){const e=id[t];if(void 0!==e)return ad(e)}(e),r=i.message;"NOT_FOUND"===e&&r.includes("database")&&r.includes("does not exist")&&r.includes(this.databaseId.database)&&il(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),void 0===n&&(n=bl.INTERNAL,r="Unknown error status: "+e+" with message "+i.message),u=!0,h.Vt(new vl(n,r)),c.close()}else sl(lp,`RPC '${t}' stream ${s} received:`,n),h.dt(n)}}),hp.gt(),setTimeout(()=>{h.At()},0),h}terminate(){this.ft.forEach(t=>t.close()),this.ft=[]}Dt(t){this.ft.push(t)}xt(t){this.ft=this.ft.filter(e=>e===t)}it(t,e,n){super.it(t,e,n),this.databaseInfo.apiKey&&(t["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return dB()}}hp.yt=!1;class dp{constructor(t,e,n=1e3,s=1.5,r=6e4){this.Ct=t,this.timerId=e,this.Ft=n,this.Ot=s,this.Mt=r,this.Nt=0,this.Lt=null,this.Bt=Date.now(),this.reset()}reset(){this.Nt=0}Ut(){this.Nt=this.Mt}kt(t){this.cancel();const e=Math.floor(this.Nt+this.qt()),n=Math.max(0,Date.now()-this.Bt),s=Math.max(0,e-n);s>0&&sl("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Nt} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.Lt=this.Ct.enqueueAfterDelay(this.timerId,s,()=>(this.Bt=Date.now(),t())),this.Nt*=this.Ot,this.Nt<this.Ft&&(this.Nt=this.Ft),this.Nt>this.Mt&&(this.Nt=this.Mt)}$t(){null!==this.Lt&&(this.Lt.skipDelay(),this.Lt=null)}cancel(){null!==this.Lt&&(this.Lt.cancel(),this.Lt=null)}qt(){return(Math.random()-.5)*this.Nt}}const pp="PersistentStream";class fp{constructor(t,e,n,s,r,i,o,a){this.Ct=t,this.Kt=n,this.Qt=s,this.connection=r,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.Wt=0,this.Gt=null,this.zt=null,this.stream=null,this.jt=0,this.Ht=new dp(t,e)}Jt(){return 1===this.state||5===this.state||this.Yt()}Yt(){return 2===this.state||3===this.state}start(){this.jt=0,4!==this.state?this.auth():this.Zt()}async stop(){this.Jt()&&await this.close(0)}Xt(){this.state=0,this.Ht.reset()}en(){this.Yt()&&null===this.Gt&&(this.Gt=this.Ct.enqueueAfterDelay(this.Kt,6e4,()=>this.tn()))}nn(t){this.rn(),this.stream.send(t)}async tn(){if(this.Yt())return this.close(0)}rn(){this.Gt&&(this.Gt.cancel(),this.Gt=null)}sn(){this.zt&&(this.zt.cancel(),this.zt=null)}async close(t,e){this.rn(),this.sn(),this.Ht.cancel(),this.Wt++,4!==t?this.Ht.reset():e&&e.code===bl.RESOURCE_EXHAUSTED?(rl(e.toString()),rl("Using maximum backoff delay to prevent overloading the backend."),this.Ht.Ut()):e&&e.code===bl.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this._n(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Tt(e)}_n(){}auth(){this.state=1;const t=this.an(this.Wt),e=this.Wt;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([t,n])=>{this.Wt===e&&this.un(t,n)},e=>{t(()=>{const t=new vl(bl.UNKNOWN,"Fetching auth token failed: "+e.message);return this.cn(t)})})}un(t,e){const n=this.an(this.Wt);this.stream=this.En(t,e),this.stream.ct(()=>{n(()=>this.listener.ct())}),this.stream.Et(()=>{n(()=>(this.state=2,this.zt=this.Ct.enqueueAfterDelay(this.Qt,1e4,()=>(this.Yt()&&(this.state=3),Promise.resolve())),this.listener.Et()))}),this.stream.Tt(t=>{n(()=>this.cn(t))}),this.stream.onMessage(t=>{n(()=>1==++this.jt?this.hn(t):this.onNext(t))})}Zt(){this.state=5,this.Ht.kt(async()=>{this.state=0,this.start()})}cn(t){return sl(pp,`close with error: ${t}`),this.stream=null,this.close(4,t)}an(t){return e=>{this.Ct.enqueueAndForget(()=>this.Wt===t?e():(sl(pp,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class Cp extends fp{constructor(t,e,n,s,r,i){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,s,i),this.serializer=r}get Rn(){return this.jt>0}start(){this.lastStreamToken=void 0,super.start()}_n(){this.Rn&&this.An([])}En(t,e){return this.connection.vt("Write",t,e)}hn(t){return cl(!!t.streamToken,31322),this.lastStreamToken=t.streamToken,cl(!t.writeResults||0===t.writeResults.length,55816),this.listener.Vn()}onNext(t){cl(!!t.streamToken,12678),this.lastStreamToken=t.streamToken,this.Ht.reset();const e=function(t,e){return t&&t.length>0?(cl(void 0!==e,14353),t.map(t=>function(t,e){let n=t.updateTime?Id(t.updateTime):Id(e);return n.isEqual(Uh.min())&&(n=Id(e)),new rh(n,t.transformResults||[])}(t,e))):[]}(t.writeResults,t.commitTime),n=Id(t.commitTime);return this.listener.dn(n,e)}fn(){const t={};t.database=function(t){return new Ol(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}(this.serializer),this.nn(t)}An(t){const e={streamToken:this.lastStreamToken,writes:t.map(t=>function(t,e){let n;if(e instanceof dh)n={update:Rd(t,e.key,e.value)};else if(e instanceof mh)n={delete:Ad(t,e.key)};else if(e instanceof ph)n={update:Rd(t,e.key,e.data),updateMask:Ld(e.fieldMask)};else{if(!(e instanceof wh))return al(16599,{be:e.type});n={verify:Ad(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(t=>function(t,e){const n=e.transform;if(n instanceof qu)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof zu)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Qu)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Xu)return{fieldPath:e.field.canonicalString(),increment:n.h};if(n instanceof Zu)return{fieldPath:e.field.canonicalString(),minimum:n.h};if(n instanceof th)return{fieldPath:e.field.canonicalString(),maximum:n.h};throw al(20930,{transform:e.transform})}(0,t))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:vd(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:al(27497)}(t,e.precondition)),n}(this.serializer,t))};this.nn(e)}}class gp{}class mp extends gp{constructor(t,e,n,s){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.serializer=s,this.mn=!1}pn(){if(this.mn)throw new vl(bl.FAILED_PRECONDITION,"The client has already been terminated.")}nt(t,e,n,s){return this.pn(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([r,i])=>this.connection.nt(t,Od(e,n),s,r,i)).catch(t=>{throw"FirebaseError"===t.name?(t.code===bl.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new vl(bl.UNKNOWN,t.toString())})}_t(t,e,n,s,r){return this.pn(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection._t(t,Od(e,n),s,i,o,r)).catch(t=>{throw"FirebaseError"===t.name?(t.code===bl.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new vl(bl.UNKNOWN,t.toString())})}terminate(){this.mn=!0,this.connection.terminate()}}const wp=new Map;const yp={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Ep=41943040;class Dp{static withCacheSize(t){return new Dp(t,Dp.DEFAULT_COLLECTION_PERCENTILE,Dp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(t,e,n){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=e,this.maximumSequenceNumbersToCollect=n}}Dp.DEFAULT_COLLECTION_PERCENTILE=10,Dp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Dp.DEFAULT=new Dp(Ep,Dp.DEFAULT_COLLECTION_PERCENTILE,Dp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Dp.DISABLED=new Dp(-1,0,0);class _p{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.gn(t),this.yn=t=>e.writeSequenceNumber(t))}gn(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.yn&&this.yn(t),t}}_p.wn=-1;class bp{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(t=>t())}}async function vp(t){if(t.code!==bl.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==t.message)throw t;sl("LocalStore","Unexpectedly lost primary lease")}class Ip{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)},t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)})}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&al(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new Ip((n,s)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,s)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,s)}})}toPromise(){return new Promise((t,e)=>{this.next(t,e)})}wrapUserFunction(t){try{const e=t();return e instanceof Ip?e:Ip.resolve(e)}catch(t){return Ip.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction(()=>t(e)):Ip.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction(()=>t(e)):Ip.reject(e)}static resolve(t){return new Ip((e,n)=>{e(t)})}static reject(t){return new Ip((e,n)=>{n(t)})}static waitFor(t){return new Ip((e,n)=>{let s=0,r=0,i=!1;t.forEach(t=>{++s,t.next(()=>{++r,i&&r===s&&e()},t=>n(t))}),i=!0,r===s&&e()})}static or(t){let e=Ip.resolve(!1);for(const n of t)e=e.next(t=>t?Ip.resolve(t):n());return e}static forEach(t,e){const n=[];return t.forEach((t,s)=>{n.push(e.call(this,t,s))}),this.waitFor(n)}static mapArray(t,e){return new Ip((n,s)=>{const r=t.length,i=new Array(r);let o=0;for(let a=0;a<r;a++){const B=a;e(t[B]).next(t=>{i[B]=t,++o,o===r&&n(i)},t=>s(t))}})}static doWhile(t,e){return new Ip((n,s)=>{const r=()=>{!0===t()?e().next(()=>{r()},s):n()};r()})}}function Tp(t){return"IndexedDbTransactionError"===t.name}const Op="LruGarbageCollector";function Ap([t,e],[n,s]){const r=dl(t,n);return 0===r?dl(e,s):r}class Sp{constructor(t){this.Yn=t,this.buffer=new Dl(Ap),this.Zn=0}Xn(){return++this.Zn}er(t){const e=[t,this.Xn()];if(this.buffer.size<this.Yn)this.buffer=this.buffer.add(e);else{const t=this.buffer.last();Ap(e,t)<0&&(this.buffer=this.buffer.delete(t).add(e))}}get maxValue(){return this.buffer.last()[0]}}class Rp{constructor(t,e,n){this.garbageCollector=t,this.asyncQueue=e,this.localStore=n,this.tr=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.nr(6e4)}stop(){this.tr&&(this.tr.cancel(),this.tr=null)}get started(){return null!==this.tr}nr(t){sl(Op,`Garbage collection scheduled in ${t}ms`),this.tr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",t,async()=>{this.tr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){Tp(t)?sl(Op,"Ignoring IndexedDB error during garbage collection: ",t):await vp(t)}await this.nr(3e5)})}}class Np{constructor(t,e){this.rr=t,this.params=e}calculateTargetCount(t,e){return this.rr.ir(t).next(t=>Math.floor(e/100*t))}nthSequenceNumber(t,e){if(0===e)return Ip.resolve(_p.wn);const n=new Sp(e);return this.rr.forEachTarget(t,t=>n.er(t.sequenceNumber)).next(()=>this.rr.sr(t,t=>n.er(t))).next(()=>n.maxValue)}removeTargets(t,e,n){return this.rr.removeTargets(t,e,n)}removeOrphanedDocuments(t,e){return this.rr.removeOrphanedDocuments(t,e)}collect(t,e){return-1===this.params.cacheSizeCollectionThreshold?(sl("LruGarbageCollector","Garbage collection skipped; disabled"),Ip.resolve(yp)):this.getCacheSize(t).next(n=>n<this.params.cacheSizeCollectionThreshold?(sl("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),yp):this._r(t,e))}getCacheSize(t){return this.rr.getCacheSize(t)}_r(t,e){let n,s,r,i,o,a,B;const c=Date.now();return this.calculateTargetCount(t,this.params.percentileToCollect).next(e=>(e>this.params.maximumSequenceNumbersToCollect?(sl("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),s=this.params.maximumSequenceNumbersToCollect):s=e,i=Date.now(),this.nthSequenceNumber(t,s))).next(s=>(n=s,o=Date.now(),this.removeTargets(t,n,e))).next(e=>(r=e,a=Date.now(),this.removeOrphanedDocuments(t,n))).next(t=>(B=Date.now(),nl()<=ds.DEBUG&&sl("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${i-c}ms\n\tDetermined least recently used ${s} in `+(o-i)+"ms\n"+`\tRemoved ${r} targets in `+(a-o)+"ms\n"+`\tRemoved ${t} documents in `+(B-a)+"ms\n"+`Total Duration: ${B-c}ms`),Ip.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:r,documentsRemoved:t})))}}const xp="firestore.googleapis.com",kp=!0;class Lp{constructor(t){if(void 0===t.host){if(void 0!==t.ssl)throw new vl(bl.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=xp,this.ssl=kp}else this.host=t.host,this.ssl=t.ssl??kp;if(this.isUsingEmulator=void 0!==t.emulatorOptions,this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,t._customHeaders&&(this._customHeaders={...t._customHeaders}),void 0===t.cacheSizeBytes)this.cacheSizeBytes=Ep;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new vl(bl.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}if(function(t,e,n,s){if(!0===e&&!0===s)throw new vl(bl.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===t.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=tp(t.experimentalLongPollingOptions??{}),function(t){if(void 0!==t.timeoutSeconds){if(isNaN(t.timeoutSeconds))throw new vl(bl.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (must not be NaN)`);if(t.timeoutSeconds<5)throw new vl(bl.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (minimum allowed value is 5)`);if(t.timeoutSeconds>30)throw new vl(bl.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams,void 0!==t.grpcFlowControlWindow){if("number"!=typeof t.grpcFlowControlWindow||t.grpcFlowControlWindow<=0||t.grpcFlowControlWindow>2147483647||!Number.isInteger(t.grpcFlowControlWindow))throw new vl(bl.INVALID_ARGUMENT,"grpcFlowControlWindow must be a positive integer and cannot exceed 2147483647");this.grpcFlowControlWindow=t.grpcFlowControlWindow}}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&function(t,e){return t.timeoutSeconds===e.timeoutSeconds}(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams&&this.grpcFlowControlWindow===t.grpcFlowControlWindow&&function(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(const s of n)if(t[s]!==e[s])return!1;return!0}(this._customHeaders,t._customHeaders)}}let Fp=class{constructor(t,e,n,s){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Lp({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new vl(bl.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(t){if(this._settingsFrozen)throw new vl(bl.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 Lp(t),this._emulatorOptions=t.emulatorOptions||{},void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new zd;switch(t.type){case"firstParty":return new Yd(t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new vl(bl.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.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(t){const e=wp.get(t);e&&(sl("ComponentProvider","Removing Datastore"),wp.delete(t),e.terminate())}(this),Promise.resolve()}};function Pp(t,e,n,s={}){t=Gl(t,Fp);const r=as(e),i=t._getSettings(),o={...i,emulatorOptions:t._getEmulatorOptions()},a=`${e}:${n}`;r&&Bs(`https://${a}`),i.host!==xp&&i.host!==a&&il("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const B={...i,host:a,ssl:r,emulatorOptions:s};if(!Xn(B,o)&&(t._setSettings(B),s.mockUserToken)){let e,n;if("string"==typeof s.mockUserToken)e=s.mockUserToken,n=$d.MOCK_USER;else{e=jn(s.mockUserToken,t._app?.options.projectId);const r=s.mockUserToken.sub||s.mockUserToken.user_id;if(!r)throw new vl(bl.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new $d(r)}t._authCredentials=new Kd(new qd(e,n))}}class Mp{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Mp(this.firestore,t,this._query)}}class Gp{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Hp(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Gp(this.firestore,t,this._key)}toJSON(){return{type:Gp._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,e,n){if(Ul(e,Gp._jsonSchema))return new Gp(t,n||null,new Ll(Ol.fromString(e.referencePath)))}}Gp._jsonSchemaVersion="firestore/documentReference/1.0",Gp._jsonSchema={type:Hl("string",Gp._jsonSchemaVersion),referencePath:Hl("string")};class Hp extends Mp{constructor(t,e,n){super(t,e,function(t){return new Wh(t)}(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Gp(this.firestore,null,new Ll(t))}withConverter(t){return new Hp(this.firestore,t,this._path)}}function Up(t,e,...n){if(t=os(t),1===arguments.length&&(e=hl.newId()),function(t,e,n){if(!n)throw new vl(bl.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}("doc","path",e),t instanceof Fp){const s=Ol.fromString(e,...n);return Fl(s),new Gp(t,null,new Ll(s))}{if(!(t instanceof Gp||t instanceof Hp))throw new vl(bl.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=t._path.child(Ol.fromString(e,...n));return Fl(s),new Gp(t.firestore,t instanceof Hp?t.converter:null,new Ll(s))}}class Vp{constructor(t){this._values=(t||[]).map(t=>t)}toArray(){return this._values.map(t=>t)}isEqual(t){return function(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}(this._values,t._values)}toJSON(){return{type:Vp._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(t){if(Ul(t,Vp._jsonSchema)){if(Array.isArray(t.vectorValues)&&t.vectorValues.every(t=>"number"==typeof t))return new Vp(t.vectorValues);throw new vl(bl.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}function jp(t,e,n){if(Jp(t=os(t)))return function(t,e,n){if(!Jp(n)||!Pl(n)){const s=Ml(n);throw"an object"===s?e.createError(t+" a custom object"):e.createError(t+" "+s)}}("Unsupported field value:",e,t),function(t,e){const n={};return kl(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):xl(t,(t,s)=>{const r=jp(s,e.childContextForField(t));null!=r&&(n[t]=r)}),{mapValue:{fields:n}}}(t,e);if(t instanceof Vd)return function(t,e){if(!function(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw al(40011,{dataSource:t})}}(e.dataSource))throw e.createError(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.createError(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.arrayElement&&4!==e.dataSource)throw e.createError("Nested arrays are not supported");return function(t,e){const n=[];let s=0;for(const r of t){let t=jp(r,e.childContextForArray(s));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),s++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=os(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Uu(e.serializer,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=$l.fromDate(t);return{timestampValue:Dd(e.serializer,n)}}if(t instanceof $l){const n=new $l(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Dd(e.serializer,n)}}if($p(t)){const n=$l.fromInstant(t),s=new $l(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:Dd(e.serializer,s)}}if(t instanceof jd)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Hd)return{bytesValue:bd(e.serializer,t._byteString)};if(t instanceof Gp){const n=e.databaseId,s=t.firestore._databaseId;if(!s.isEqual(n))throw e.createError(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Td(t.firestore._databaseId||e.databaseId,t._key.path)}}if(t instanceof Vp)return function(t,e){const n=t instanceof Vp?t.toArray():t,s={fields:{[lu]:{stringValue:du},[pu]:{arrayValue:{values:n.map(t=>{if("number"!=typeof t)throw e.createError("VectorValues must only contain numeric values.");return Gu(e.serializer,t)})}}}};return{mapValue:s}}(t,e);if(Fd(t))return t._toProto(e.serializer);throw e.createError(`Unsupported field value: ${Ml(t)}`)}(t,e)}function $p(t){if("object"!=typeof t||null===t)return!1;if("undefined"!=typeof Temporal&&"function"==typeof Temporal.Instant&&t instanceof Temporal.Instant)return!0;const e=t;return"Temporal.Instant"===e[Symbol.toStringTag]&&"bigint"==typeof e.t}function Jp(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof $l||t instanceof jd||t instanceof Hd||t instanceof Gp||t instanceof Vd||t instanceof Vp||$p(t)||Fd(t))}function qp(t,e,n){if((e=os(e))instanceof Ud)return e._internalPath;if("string"==typeof e)return function(t,e){if(e.search(zp)>=0)throw Kp(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t);try{return new Ud(...e.split("."))._internalPath}catch(n){throw Kp(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t)}}(t,e);throw Kp("Field path arguments must be of type string or ",t)}Vp._jsonSchemaVersion="firestore/vectorValue/1.0",Vp._jsonSchema={type:Hl("string",Vp._jsonSchemaVersion),vectorValues:Hl("object")};const zp=new RegExp("[~\\*/\\[\\]]");function Kp(t,e,n,s,r){let i=`Function ${e}() called with invalid data`;i+=". ";return new vl(bl.INVALID_ARGUMENT,i+t+"")}class Qp{constructor(t){this.optionDefinitions=t}_getKnownOptions(t,e){const n=Pu.empty();for(const s in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(s)){const r=this.optionDefinitions[s];if(s in t){const i=t[s];let o;r.nestedOptions&&Pl(i)?o={mapValue:{fields:new Qp(r.nestedOptions).getOptionsProto(e,i)}}:i&&(o=jp(i,e)??void 0),o&&n.set(Sl.fromServerFormat(r.serverName),o)}}return n}getOptionsProto(t,e,n){const s=this._getKnownOptions(e,t);if(n){const e=new Map(function(t,e){const n=[];for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&n.push(e(t[s],s,t));return n}(n,(e,n)=>[Sl.fromServerFormat(n),void 0!==e?jp(e,t):null]));s.setAll(e)}return s.value.mapValue.fields??{}}}function Wp(t){let e;return t instanceof Zp?t:(e=Pl(t)?function(t){const e=[];for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=t[n];e.push(af(n)),e.push(Wp(s))}return new cf("map",e,"map")}(t):t instanceof Array?function(t){return function(t,e){return new cf("array",t.map(t=>Wp(t)),e)}(t,"array")}(t):Bf(t,void 0),e)}function Yp(t){if(t instanceof Zp)return t;if(t instanceof Vp)return af(t);if(Array.isArray(t))return af(function(t){return new Vp(t)}(t));throw new Error("Unsupported value: "+typeof t)}function Xp(t){return function(t){return"string"==typeof t}(t)?function(t){return function(t,e){return new rf("string"==typeof t?Il===t?new Ud(Il)._internalPath:qp("field",t):t._internalPath,e)}(t,"field")}(t):Wp(t)}class Zp{constructor(){this._protoValueType="ProtoValue"}add(t){return new cf("add",[this,Wp(t)],"add")}asBoolean(){if(this instanceof lf)return this;if(this instanceof of)return new hf(this);if(this instanceof rf)return new df(this);if(this instanceof cf)return new uf(this);throw new vl("invalid-argument",`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(t){return new cf("subtract",[this,Wp(t)],"subtract")}multiply(t){return new cf("multiply",[this,Wp(t)],"multiply")}divide(t){return new cf("divide",[this,Wp(t)],"divide")}mod(t){return new cf("mod",[this,Wp(t)],"mod")}equal(t){return new cf("equal",[this,Wp(t)],"equal").asBoolean()}notEqual(t){return new cf("not_equal",[this,Wp(t)],"notEqual").asBoolean()}lessThan(t){return new cf("less_than",[this,Wp(t)],"lessThan").asBoolean()}lessThanOrEqual(t){return new cf("less_than_or_equal",[this,Wp(t)],"lessThanOrEqual").asBoolean()}greaterThan(t){return new cf("greater_than",[this,Wp(t)],"greaterThan").asBoolean()}greaterThanOrEqual(t){return new cf("greater_than_or_equal",[this,Wp(t)],"greaterThanOrEqual").asBoolean()}arrayConcat(t,...e){const n=[t,...e].map(t=>Wp(t));return new cf("array_concat",[this,...n],"arrayConcat")}arrayContains(t){return new cf("array_contains",[this,Wp(t)],"arrayContains").asBoolean()}arrayContainsAll(t){const e=Array.isArray(t)?new sf(t.map(Wp),"arrayContainsAll"):t;return new cf("array_contains_all",[this,e],"arrayContainsAll").asBoolean()}arrayContainsAny(t){const e=Array.isArray(t)?new sf(t.map(Wp),"arrayContainsAny"):t;return new cf("array_contains_any",[this,e],"arrayContainsAny").asBoolean()}arrayReverse(){return new cf("array_reverse",[this])}arrayLength(){return new cf("array_length",[this],"arrayLength")}equalAny(t){const e=Array.isArray(t)?new sf(t.map(Wp),"equalAny"):t;return new cf("equal_any",[this,e],"equalAny").asBoolean()}notEqualAny(t){const e=Array.isArray(t)?new sf(t.map(Wp),"notEqualAny"):t;return new cf("not_equal_any",[this,e],"notEqualAny").asBoolean()}exists(){return new cf("exists",[this],"exists").asBoolean()}charLength(){return new cf("char_length",[this],"charLength")}like(t){return new cf("like",[this,Wp(t)],"like").asBoolean()}regexContains(t){return new cf("regex_contains",[this,Wp(t)],"regexContains").asBoolean()}regexFind(t){return new cf("regex_find",[this,Wp(t)],"regexFind")}regexFindAll(t){return new cf("regex_find_all",[this,Wp(t)],"regexFindAll")}regexMatch(t){return new cf("regex_match",[this,Wp(t)],"regexMatch").asBoolean()}stringContains(t){return new cf("string_contains",[this,Wp(t)],"stringContains").asBoolean()}startsWith(t){return new cf("starts_with",[this,Wp(t)],"startsWith").asBoolean()}endsWith(t){return new cf("ends_with",[this,Wp(t)],"endsWith").asBoolean()}toLower(){return new cf("to_lower",[this],"toLower")}toUpper(){return new cf("to_upper",[this],"toUpper")}trim(t){const e=[this];return t&&e.push(Wp(t)),new cf("trim",e,"trim")}ltrim(t){const e=[this];return t&&e.push(Wp(t)),new cf("ltrim",e,"ltrim")}rtrim(t){const e=[this];return t&&e.push(Wp(t)),new cf("rtrim",e,"rtrim")}type(){return new cf("type",[this])}isType(t){return new cf("is_type",[this,af(t)],"isType").asBoolean()}stringConcat(t,...e){const n=[t,...e].map(Wp);return new cf("string_concat",[this,...n],"stringConcat")}stringIndexOf(t){return new cf("string_index_of",[this,Wp(t)],"stringIndexOf")}stringRepeat(t){return new cf("string_repeat",[this,Wp(t)],"stringRepeat")}stringReplaceAll(t,e){return new cf("string_replace_all",[this,Wp(t),Wp(e)],"stringReplaceAll")}stringReplaceOne(t,e){return new cf("string_replace_one",[this,Wp(t),Wp(e)],"stringReplaceOne")}concat(t,...e){const n=[t,...e].map(Wp);return new cf("concat",[this,...n],"concat")}reverse(){return new cf("reverse",[this],"reverse")}arrayFilter(t,e){return new cf("array_filter",[this,Wp(t),e],"arrayFilter")}arrayTransform(t,e){return new cf("array_transform",[this,Wp(t),e],"arrayTransform")}arrayTransformWithIndex(t,e,n){return new cf("array_transform",[this,Wp(t),Wp(e),n],"arrayTransformWithIndex")}arraySlice(t,e){const n=[this,Wp(t)];return void 0!==e&&n.push(Wp(e)),new cf("array_slice",n,"arraySlice")}arrayFirst(){return new cf("array_first",[this],"arrayFirst")}arrayFirstN(t){return new cf("array_first_n",[this,Wp(t)],"arrayFirstN")}arrayLast(){return new cf("array_last",[this],"arrayLast")}arrayLastN(t){return new cf("array_last_n",[this,Wp(t)],"arrayLastN")}arrayMaximum(){return new cf("maximum",[this],"arrayMaximum")}arrayMaximumN(t){return new cf("maximum_n",[this,Wp(t)],"arrayMaximumN")}arrayMinimum(){return new cf("minimum",[this],"arrayMinimum")}arrayMinimumN(t){return new cf("minimum_n",[this,Wp(t)],"arrayMinimumN")}arrayIndexOf(t){return new cf("array_index_of",[this,Wp(t),Wp("first")],"arrayIndexOf")}arrayLastIndexOf(t){return new cf("array_index_of",[this,Wp(t),Wp("last")],"arrayLastIndexOf")}arrayIndexOfAll(t){return new cf("array_index_of_all",[this,Wp(t)],"arrayIndexOfAll")}byteLength(){return new cf("byte_length",[this],"byteLength")}ceil(){return new cf("ceil",[this])}floor(){return new cf("floor",[this])}abs(){return new cf("abs",[this])}exp(){return new cf("exp",[this])}mapGet(t){return new cf("map_get",[this,af(t)],"mapGet")}mapSet(t,e,...n){const s=[this,Wp(t),Wp(e),...n.map(Wp)];return new cf("map_set",s,"mapSet")}mapKeys(){return new cf("map_keys",[this],"mapKeys")}mapValues(){return new cf("map_values",[this],"mapValues")}mapEntries(){return new cf("map_entries",[this],"mapEntries")}getField(t){return new cf("get_field",[this,Wp(t)],"get_field")}count(){return tf._create("count",[this],"count")}sum(){return tf._create("sum",[this],"sum")}average(){return tf._create("average",[this],"average")}minimum(){return tf._create("minimum",[this],"minimum")}maximum(){return tf._create("maximum",[this],"maximum")}first(){return tf._create("first",[this],"first")}last(){return tf._create("last",[this],"last")}arrayAgg(){return tf._create("array_agg",[this],"arrayAgg")}arrayAggDistinct(){return tf._create("array_agg_distinct",[this],"arrayAggDistinct")}countDistinct(){return tf._create("count_distinct",[this],"countDistinct")}logicalMaximum(t,...e){const n=[t,...e];return new cf("maximum",[this,...n.map(Wp)],"logicalMaximum")}logicalMinimum(t,...e){const n=[t,...e];return new cf("minimum",[this,...n.map(Wp)],"minimum")}vectorLength(){return new cf("vector_length",[this],"vectorLength")}cosineDistance(t){return new cf("cosine_distance",[this,Yp(t)],"cosineDistance")}dotProduct(t){return new cf("dot_product",[this,Yp(t)],"dotProduct")}euclideanDistance(t){return new cf("euclidean_distance",[this,Yp(t)],"euclideanDistance")}unixMicrosToTimestamp(){return new cf("unix_micros_to_timestamp",[this],"unixMicrosToTimestamp")}timestampToUnixMicros(){return new cf("timestamp_to_unix_micros",[this],"timestampToUnixMicros")}unixMillisToTimestamp(){return new cf("unix_millis_to_timestamp",[this],"unixMillisToTimestamp")}timestampToUnixMillis(){return new cf("timestamp_to_unix_millis",[this],"timestampToUnixMillis")}unixSecondsToTimestamp(){return new cf("unix_seconds_to_timestamp",[this],"unixSecondsToTimestamp")}timestampToUnixSeconds(){return new cf("timestamp_to_unix_seconds",[this],"timestampToUnixSeconds")}timestampAdd(t,e){return new cf("timestamp_add",[this,Wp(t),Wp(e)],"timestampAdd")}timestampSubtract(t,e){return new cf("timestamp_subtract",[this,Wp(t),Wp(e)],"timestampSubtract")}timestampDiff(t,e){return new cf("timestamp_diff",[this,Xp(t),Wp(e)],"timestampDiff")}timestampExtract(t,e){const n=[this,Wp(t)];return e&&n.push(Wp(e)),new cf("timestamp_extract",n,"timestampExtract")}documentId(){return new cf("document_id",[this],"documentId")}parent(){return new cf("parent",[this],"parent")}substring(t,e){const n=Wp(t);return new cf("substring",void 0===e?[this,n]:[this,n,Wp(e)],"substring")}arrayGet(t){return new cf("array_get",[this,Wp(t)],"arrayGet")}isError(){return new cf("is_error",[this],"isError").asBoolean()}ifError(t){const e=new cf("if_error",[this,Wp(t)],"ifError");return t instanceof lf?e.asBoolean():e}isAbsent(){return new cf("is_absent",[this],"isAbsent").asBoolean()}mapRemove(t){return new cf("map_remove",[this,Wp(t)],"mapRemove")}mapMerge(t,...e){const n=Wp(t),s=e.map(Wp);return new cf("map_merge",[this,n,...s],"mapMerge")}pow(t){return new cf("pow",[this,Wp(t)])}trunc(t){return void 0===t?new cf("trunc",[this]):new cf("trunc",[this,Wp(t)],"trunc")}round(t){return void 0===t?new cf("round",[this]):new cf("round",[this,Wp(t)],"round")}collectionId(){return new cf("collection_id",[this])}length(){return new cf("length",[this])}ln(){return new cf("ln",[this])}sqrt(){return new cf("sqrt",[this])}stringReverse(){return new cf("string_reverse",[this])}ifAbsent(t){return new cf("if_absent",[this,Wp(t)],"ifAbsent")}ifNull(t){return new cf("if_null",[this,Wp(t)],"ifNull")}coalesce(t,...e){return new cf("coalesce",[this,Wp(t),...e.map(Wp)],"coalesce")}join(t){return new cf("join",[this,Wp(t)],"join")}log10(){return new cf("log10",[this])}arraySum(){return new cf("sum",[this])}split(t){return new cf("split",[this,Wp(t)])}timestampTruncate(t,e){const n=[this,Wp(t)];return e&&n.push(Wp(e)),new cf("timestamp_trunc",n)}ascending(){return function(t){return new pf(Xp(t),"ascending","ascending")}(this)}descending(){return function(t){return new pf(Xp(t),"descending","descending")}(this)}as(t){return new nf(this,t,"as")}}class tf{constructor(t,e){this.name=t,this.params=e,this.exprType="AggregateFunction",this._protoValueType="ProtoValue"}static _create(t,e,n){const s=new tf(t,e);return s._methodName=n,s}as(t){return new ef(this,t,"as")}_toProto(t){return{functionValue:{name:this.name,args:this.params.map(e=>e._toProto(t))}}}_readUserData(t){t=this._methodName?t.contextWith({methodName:this._methodName}):t,this.params.forEach(e=>e._readUserData(t))}}class ef{constructor(t,e,n){this.aggregate=t,this.alias=e,this._methodName=n}_readUserData(t){this.aggregate._readUserData(t)}}class nf{constructor(t,e,n){this.expr=t,this.alias=e,this._methodName=n,this.exprType="AliasedExpression",this.selectable=!0}_readUserData(t){this.expr._readUserData(t)}}class sf extends Zp{constructor(t,e){super(),this.cr=t,this._methodName=e,this.expressionType="ListOfExpressions"}_toProto(t){return{arrayValue:{values:this.cr.map(e=>e._toProto(t))}}}_readUserData(t){this.cr.forEach(e=>e._readUserData(t))}}class rf extends Zp{constructor(t,e){super(),this.fieldPath=t,this._methodName=e,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(t){return new cf("geo_distance",[this,Wp(t)],"geoDistance")}_toProto(t){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(t){}}class of extends Zp{constructor(t,e){super(),this.value=t,this._methodName=e,this.expressionType="Constant"}static _fromProto(t){const e=new of(t,void 0);return e._protoValue=t,e}_toProto(t){return cl(void 0!==this._protoValue,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(t){t=this._methodName?t.contextWith({methodName:this._methodName}):t,function(t){return"object"==typeof t&&null!==t&&!!("nullValue"in t&&(null===t.nullValue||"NULL_VALUE"===t.nullValue)||"booleanValue"in t&&(null===t.booleanValue||"boolean"==typeof t.booleanValue)||"integerValue"in t&&(null===t.integerValue||"number"==typeof t.integerValue||"string"==typeof t.integerValue)||"doubleValue"in t&&(null===t.doubleValue||"number"==typeof t.doubleValue)||"timestampValue"in t&&(null===t.timestampValue||function(t){return"object"==typeof t&&null!==t&&"seconds"in t&&(null===t.seconds||"number"==typeof t.seconds||"string"==typeof t.seconds)&&"nanos"in t&&(null===t.nanos||"number"==typeof t.nanos)}(t.timestampValue))||"stringValue"in t&&(null===t.stringValue||"string"==typeof t.stringValue)||"bytesValue"in t&&(null===t.bytesValue||t.bytesValue instanceof Uint8Array)||"referenceValue"in t&&(null===t.referenceValue||"string"==typeof t.referenceValue)||"geoPointValue"in t&&(null===t.geoPointValue||function(t){return"object"==typeof t&&null!==t&&"latitude"in t&&(null===t.latitude||"number"==typeof t.latitude)&&"longitude"in t&&(null===t.longitude||"number"==typeof t.longitude)}(t.geoPointValue))||"arrayValue"in t&&(null===t.arrayValue||function(t){return"object"==typeof t&&null!==t&&!(!("values"in t)||null!==t.values&&!Array.isArray(t.values))}(t.arrayValue))||"mapValue"in t&&(null===t.mapValue||function(t){return"object"==typeof t&&null!==t&&!(!("fields"in t)||null!==t.fields&&!Pl(t.fields))}(t.mapValue))||"fieldReferenceValue"in t&&(null===t.fieldReferenceValue||"string"==typeof t.fieldReferenceValue)||"functionValue"in t&&(null===t.functionValue||function(t){return"object"==typeof t&&null!==t&&!(!("name"in t)||null!==t.name&&"string"!=typeof t.name||!("args"in t)||null!==t.args&&!Array.isArray(t.args))}(t.functionValue))||"pipelineValue"in t&&(null===t.pipelineValue||function(t){return"object"==typeof t&&null!==t&&!(!("stages"in t)||null!==t.stages&&!Array.isArray(t.stages))}(t.pipelineValue)))}(this._protoValue)||(this._protoValue=jp(this.value,t))}}function af(t,e){return Bf(t,"constant")}function Bf(t,e){const n=new of(t,e);return"boolean"==typeof t?new hf(n):n}class cf extends Zp{constructor(t,e,n,s){super(),this.name=t,this.params=e,this.expressionType="Function",this._optionsProto=void 0,void 0!==n&&(this._methodName=n),void 0!==s&&(this._options=s)}get _optionsUtil(){return new Qp({})}_toProto(t){const e={functionValue:{name:this.name,args:this.params.map(e=>e._toProto(t))}};return this._optionsProto&&(e.functionValue.options=this._optionsProto),e}_readUserData(t){t=this._methodName?t.contextWith({methodName:this._methodName}):t,this.params.forEach(e=>e._readUserData(t)),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(t,this._options))}}class lf extends Zp{get _methodName(){return this._expr._methodName}countIf(){return tf._create("count_if",[this],"countIf")}not(){return new cf("not",[this],"not").asBoolean()}conditional(t,e){return new cf("conditional",[this,t,e],"conditional")}ifError(t){const e=Wp(t),n=new cf("if_error",[this,e],"ifError");return e instanceof lf?n.asBoolean():n}_toProto(t){return this._expr._toProto(t)}_readUserData(t){this._expr._readUserData(t)}}class uf extends lf{constructor(t){super(),this._expr=t,this.expressionType="Function"}}class hf extends lf{constructor(t){super(),this._expr=t,this.expressionType="Constant"}_getValue(){return this._expr._getValue()}}class df extends lf{constructor(t){super(),this._expr=t,this.expressionType="Field"}}class pf{constructor(t,e,n){this.expr=t,this.direction=e,this._methodName=n,this._protoValueType="ProtoValue"}_toProto(t){return{mapValue:{fields:{direction:Md(this.direction),expression:this.expr._toProto(t)}}}}_readUserData(t){this.expr._readUserData(t)}}class ff{constructor(t){this.optionsProto=void 0,({rawOptions:this.rawOptions,...this.knownOptions}=t)}_readUserData(t){this.optionsProto=this._optionsUtil.getOptionsProto(t,this.knownOptions,this.rawOptions)}_toProto(t){return{name:this._name,options:this.optionsProto}}}class Cf extends ff{get _name(){return"add_fields"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.fields=t}_toProto(t){return{...super._toProto(t),args:[Pd(t,this.fields)]}}_readUserData(t){super._readUserData(t),Af(this.fields,t)}}class gf extends ff{get _name(){return"aggregate"}get _optionsUtil(){return new Qp({})}constructor(t,e,n){super(n),this.groups=t,this.accumulators=e}_toProto(t){return{...super._toProto(t),args:[Pd(t,this.accumulators),Pd(t,this.groups)]}}_readUserData(t){super._readUserData(t),Af(this.groups,t),Af(this.accumulators,t)}}class mf extends ff{get _name(){return"distinct"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.groups=t}_toProto(t){return{...super._toProto(t),args:[Pd(t,this.groups)]}}_readUserData(t){super._readUserData(t),Af(this.groups,t)}}class wf extends ff{get _name(){return"collection"}get _optionsUtil(){return new Qp({forceIndex:{serverName:"force_index"}})}constructor(t,e){super(e),this.hr=t.startsWith("/")?t:"/"+t}_toProto(t){return{...super._toProto(t),args:[{referenceValue:this.hr}]}}_readUserData(t){super._readUserData(t)}}class yf extends ff{get _name(){return"collection_group"}get _optionsUtil(){return new Qp({forceIndex:{serverName:"force_index"}})}constructor(t,e){super(e),this.collectionId=t}_toProto(t){return{...super._toProto(t),args:[{referenceValue:""},{stringValue:this.collectionId}]}}_readUserData(t){super._readUserData(t)}}class Ef extends ff{get _name(){return"database"}get _optionsUtil(){return new Qp({})}_toProto(t){return{...super._toProto(t)}}_readUserData(t){super._readUserData(t)}}class Df extends ff{get _name(){return"documents"}get _optionsUtil(){return new Qp({})}constructor(t,e){if(super(e),!t||0===t.length)throw new vl(bl.INVALID_ARGUMENT,"Empty document paths are not allowed in DocumentsSource");const n=t.map(t=>t.startsWith("/")?t:"/"+t),s=new Set(n);if(s.size!==n.length)throw new vl(bl.INVALID_ARGUMENT,"Duplicate document paths are not allowed in DocumentsSource");this.Tr=n,this.Pr=s}_toProto(t){return{...super._toProto(t),args:this.Tr.map(t=>({referenceValue:t}))}}_readUserData(t){super._readUserData(t)}}class _f extends ff{get _name(){return"where"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.condition=t}_toProto(t){return{...super._toProto(t),args:[this.condition._toProto(t)]}}_readUserData(t){super._readUserData(t),Af(this.condition,t)}}class bf extends ff{get _name(){return"limit"}get _optionsUtil(){return new Qp({})}constructor(t,e){cl(!isNaN(t)&&t!==1/0&&t!==-1/0,34860),super(e),this.limit=t}_toProto(t){return{...super._toProto(t),args:[Uu(t,this.limit)]}}}class vf extends ff{get _name(){return"offset"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.offset=t}_toProto(t){return{...super._toProto(t),args:[Uu(t,this.offset)]}}}class If extends ff{get _name(){return"select"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.selections=t}_toProto(t){return{...super._toProto(t),args:[Pd(t,this.selections)]}}_readUserData(t){super._readUserData(t),Af(this.selections,t)}}class Tf extends ff{get _name(){return"sort"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.orderings=t}_toProto(t){return{...super._toProto(t),args:this.orderings.map(e=>e._toProto(t))}}_readUserData(t){super._readUserData(t),Af(this.orderings,t)}}class Of extends ff{get _name(){return"replace_with"}get _optionsUtil(){return new Qp({})}constructor(t,e){super(e),this.map=t}_toProto(t){return{...super._toProto(t),args:[this.map._toProto(t),Md(Of.Ir)]}}_readUserData(t){super._readUserData(t),Af(this.map,t)}}function Af(t,e){return function(t){return"function"==typeof t._readUserData}(t)?t._readUserData(e):Array.isArray(t)||t instanceof Map?t.forEach(t=>t._readUserData(e)):Object.values(t).forEach(t=>t._readUserData(e)),t}Of.Ir="full_replace";class Sf{constructor(t,e,n){this.serializer=t,this.stages=e,this.listenOptions=n,this.isCorePipeline=!0}getPipelineCollection(){return Nf(this)}getPipelineCollectionGroup(){return xf(this)}getPipelineCollectionId(){return function(t){switch(Rf(t)){case"collection":return Ol.fromString(Nf(t)).lastSegment();case"collection_group":return xf(t);default:return}}(this)}getPipelineDocuments(){return kf(this)}getPipelineFlavor(){return function(t){let e="exact";return t.stages.forEach((n,s)=>{n._name!==mf.name&&n._name!==gf.name||(e="keyless"),n._name===If.name&&"exact"===e&&(e="augmented"),n._name===Cf.name&&s<t.stages.length-1&&"exact"===e&&(e="augmented")}),e}(this)}getPipelineSourceType(){return Rf(this)}}function Rf(t){const e=t.stages[0];return e instanceof wf||e instanceof yf||e instanceof Ef||e instanceof Df?e._name:"unknown"}function Nf(t){if("collection"===Rf(t))return t.stages[0].hr}function xf(t){if("collection_group"===Rf(t))return t.stages[0].collectionId}function kf(t){if("documents"===Rf(t))return t.stages[0].Tr}class Lf{constructor(t,e){this.type=t,this.value=e}static mr(){return new Lf("ERROR",void 0)}static pr(){return new Lf("UNSET",void 0)}static gr(){return new Lf("NULL",fu)}static newValue(t){return Ru(t)?new Lf("NULL",fu):function(t){return!!t&&"booleanValue"in t}(t)?new Lf("BOOLEAN",t):Tu(t)?new Lf("INT",t):Ou(t)?new Lf("DOUBLE",t):function(t){return!!t&&"timestampValue"in t&&!!t.timestampValue}(t)?new Lf("TIMESTAMP",t):function(t){return!!t&&"stringValue"in t}(t)?new Lf("STRING",t):function(t){return!!t&&"bytesValue"in t}(t)?new Lf("BYTES",t):t.referenceValue?new Lf("REFERENCE",t):t.geoPointValue?new Lf("GEO_POINT",t):Su(t)?new Lf("ARRAY",t):ku(t)?new Lf("VECTOR",t):xu(t)?new Lf("MAP",t):new Lf("ERROR",void 0)}yr(){return"ERROR"===this.type||"UNSET"===this.type}wr(){return"NULL"===this.type}}function Ff(t){if(!t.yr())return t.value}function Pf(t){return t instanceof lf?t._expr:t}function Mf(t){if((t=Pf(t))instanceof rf)return new Gf(t);if(t instanceof of)return new Hf(t);if(t instanceof sf)return new Uf(t);if(t instanceof cf){if("add"===t.name)return new Kf(t);if("subtract"===t.name)return new Qf(t);if("multiply"===t.name)return new Wf(t);if("divide"===t.name)return new Yf(t);if("mod"===t.name)return new Xf(t);if("and"===t.name)return new Zf(t);if("equal"===t.name)return new fC(t);if("not_equal"===t.name)return new CC(t);if("less_than"===t.name)return new gC(t);if("less_than_or_equal"===t.name)return new mC(t);if("greater_than"===t.name)return new wC(t);if("greater_than_or_equal"===t.name)return new yC(t);if("array_concat"===t.name)return new EC(t);if("array_reverse"===t.name)return new DC(t);if("array_contains"===t.name)return new _C(t);if("array_contains_all"===t.name)return new bC(t);if("array_contains_any"===t.name)return new vC(t);if("array_length"===t.name)return new IC(t);if("array_element"===t.name)return new TC(t);if("equal_any"===t.name)return new sC(t);if("not_equal_any"===t.name)return new rC(t);if("is_nan"===t.name)return new iC(t);if("is_not_nan"===t.name)return new oC(t);if("is_null"===t.name)return new aC(t);if("is_not_null"===t.name)return new BC(t);if("is_error"===t.name)return new cC(t);if("exists"===t.name)return new lC(t);if("not"===t.name)return new tC(t);if("or"===t.name)return new eC(t);if("xor"===t.name)return new nC(t);if("conditional"===t.name)return new uC(t);if("maximum"===t.name)return new hC(t);if("minimum"===t.name)return new dC(t);if("reverse"===t.name)return new OC(t);if("replace_first"===t.name)return new AC(t);if("replace_all"===t.name)return new SC(t);if("char_length"===t.name)return new RC(t);if("byte_length"===t.name)return new NC(t);if("like"===t.name)return new kC(t);if("regex_contains"===t.name)return new LC(t);if("regex_match"===t.name)return new FC(t);if("string_contains"===t.name)return new PC(t);if("starts_with"===t.name)return new MC(t);if("ends_with"===t.name)return new GC(t);if("to_lower"===t.name)return new HC(t);if("to_upper"===t.name)return new UC(t);if("trim"===t.name)return new VC(t);if("string_concat"===t.name)return new jC(t);if("map_get"===t.name)return new $C(t);if("cosine_distance"===t.name)return new qC(t);if("dot_product"===t.name)return new zC(t);if("euclidean_distance"===t.name)return new KC(t);if("vector_length"===t.name)return new QC(t);if("unix_micros_to_timestamp"===t.name)return new lg(t);if("timestamp_to_unix_micros"===t.name)return new pg(t);if("unix_millis_to_timestamp"===t.name)return new ug(t);if("timestamp_to_unix_millis"===t.name)return new fg(t);if("unix_seconds_to_timestamp"===t.name)return new hg(t);if("timestamp_to_unix_seconds"===t.name)return new Cg(t);if("timestamp_add"===t.name)return new mg(t);if("timestamp_subtract"===t.name)return new wg(t)}throw new Error(`Unknown Expr : ${t}`)}class Gf{constructor(t){this.expr=t}evaluate(t,e){if(this.expr.fieldName===Il)return Lf.newValue({referenceValue:Ad(t.serializer,e.key)});if("__update_time__"===this.expr.fieldName)return Lf.newValue({timestampValue:vd(t.serializer,e.version)});if("__create_time__"===this.expr.fieldName)return Lf.newValue({timestampValue:vd(t.serializer,e.createTime)});const n=e.data.field(this.expr._fieldPath);return n?eu(n)?Lf.newValue(function(t,e){if("estimate"===t.serverTimestampBehavior)return{timestampValue:vd(t.serializer,Uh.fromTimestamp(su(e)))};if("previous"===t.serverTimestampBehavior){const t=nu(e);if(t)return t}return{nullValue:"NULL_VALUE"}}(t,n)):Lf.newValue(n):Lf.pr()}}class Hf{constructor(t){this.expr=t}evaluate(t,e){return Lf.newValue(this.expr._getValue())}}class Uf{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.cr.map(n=>Mf(n).evaluate(t,e));return n.some(t=>t.yr())?Lf.mr():Lf.newValue({arrayValue:{values:n.map(t=>t.value)}})}}function Vf(t){return Ou(t)?Number(t.doubleValue):Number(t.integerValue)}function jf(t){return BigInt(t.integerValue)}const $f=BigInt("0x7fffffffffffffff"),Jf=-BigInt("0x8000000000000000");class qf{constructor(t){this.expr=t}evaluate(t,e){cl(this.expr.params.length>=2,24778);const n=Mf(this.expr.params[0]).evaluate(t,e),s=Mf(this.expr.params[1]).evaluate(t,e);let r=this.br(n,s);for(const n of this.expr.params.slice(2)){const s=Mf(n).evaluate(t,e);r=this.br(r,s)}return r}br(t,e){if(t.yr()||e.yr())return Lf.mr();if(t.wr()||e.wr())return Lf.gr();const n=t.value,s=e.value;if(!Ou(n)&&!Tu(n)||!Ou(s)&&!Tu(s))return Lf.mr();if(Ou(n)||Ou(s)){const t=this.Sr(n,s);return t?Lf.newValue(t):Lf.mr()}if(Tu(n)&&Tu(s)){const t=this.vr(n,s);return void 0===t?Lf.mr():"number"==typeof t?Lf.newValue({doubleValue:t}):t<Jf||t>$f?Lf.mr():Lf.newValue({integerValue:`${t}`})}return Lf.mr()}}function zf(t,e){return mu(t)!==mu(e)?"TYPE_MISMATCH":Nu(t)||Nu(e)?"NOT_EQ":Ru(t)&&Ru(e)?"EQ":Ru(t)||Ru(e)?"NULL":Su(t)&&Su(e)?function(t,e){if(t.values?.length!==e.values?.length)return"NOT_EQ";let n=!1;for(let s=0;s<(t.values?.length??0);s++){const r=t.values[s],i=e.values[s];switch(zf(r,i)){case"EQ":break;case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":n=!0;break;default:al(44609,{Dr:r,Cr:i})}}return n?"NULL":"EQ"}(t.arrayValue,e.arrayValue):ku(t)&&ku(e)||xu(t)&&xu(e)?function(t,e){const n=t.fields||{},s=e.fields||{};if(Nl(n)!==Nl(s))return"NOT_EQ";let r=!1;for(const t in n)if(n.hasOwnProperty(t)){if(void 0===s[t])return"NOT_EQ";switch(zf(n[t],s[t])){case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":r=!0}}return r?"NULL":"EQ"}(t.mapValue,e.mapValue):function(t,e){return wu(t,e,{u:!1,i:!0,o:!0})}(t,e)?"EQ":"NOT_EQ"}class Kf extends qf{vr(t,e){return jf(t)+jf(e)}Sr(t,e){return{doubleValue:Vf(t)+Vf(e)}}}class Qf extends qf{constructor(t){super(t),this.expr=t}vr(t,e){return jf(t)-jf(e)}Sr(t,e){return{doubleValue:Vf(t)-Vf(e)}}}class Wf extends qf{constructor(t){super(t),this.expr=t}vr(t,e){return jf(t)*jf(e)}Sr(t,e){return{doubleValue:Vf(t)*Vf(e)}}}class Yf extends qf{constructor(t){super(t),this.expr=t}vr(t,e){const n=jf(e);if(n!==BigInt(0))return jf(t)/n}Sr(t,e){const n=Vf(e);return 0===n?{doubleValue:cu(n)?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}:{doubleValue:Vf(t)/n}}}class Xf extends qf{constructor(t){super(t),this.expr=t}vr(t,e){const n=jf(e);if(n!==BigInt(0))return jf(t)%n}Sr(t,e){const n=Vf(e);if(0!==n)return{doubleValue:Vf(t)%n}}}class Zf{constructor(t){this.expr=t}evaluate(t,e){let n=!1,s=!1;for(const r of this.expr.params){const i=Mf(r).evaluate(t,e);switch(i.type){case"BOOLEAN":if(!i.value?.booleanValue)return Lf.newValue(gu);break;case"NULL":s=!0;break;default:n=!0}}return n?Lf.mr():s?Lf.gr():Lf.newValue(Cu)}}class tC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,9634);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"BOOLEAN":return Lf.newValue({booleanValue:!n.value?.booleanValue});case"NULL":return Lf.gr();default:return Lf.mr()}}}class eC{constructor(t){this.expr=t}evaluate(t,e){let n=!1,s=!1;for(const r of this.expr.params){const i=Mf(r).evaluate(t,e);switch(i.type){case"BOOLEAN":if(i.value?.booleanValue)return Lf.newValue(Cu);break;case"NULL":s=!0;break;default:n=!0}}return n?Lf.mr():s?Lf.gr():Lf.newValue(gu)}}class nC{constructor(t){this.expr=t}evaluate(t,e){let n=!1,s=!1;for(const r of this.expr.params){const i=Mf(r).evaluate(t,e);switch(i.type){case"BOOLEAN":n=nC.xor(n,!!i.value?.booleanValue);break;case"NULL":s=!0;break;default:return Lf.mr()}}return s?Lf.gr():Lf.newValue({booleanValue:n})}static xor(t,e){return(t||e)&&!(t&&e)}}class sC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,55094);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"NULL":n=!0;break;case"ERROR":case"UNSET":return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.mr()}if(n)return Lf.gr();for(const t of r.value?.arrayValue?.values??[])switch(Ru(s.value)&&Ru(t)?"EQ":zf(s.value,t)){case"EQ":return Lf.newValue(Cu);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:al(44608,{value:s.value,candidate:t})}return n?Lf.gr():Lf.newValue(gu)}}class rC{constructor(t){this.expr=t}evaluate(t,e){return new tC(new cf("not",[new cf("equal_any",this.expr.params)])).evaluate(t,e)}}class iC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,23322);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"INT":return Lf.newValue(gu);case"DOUBLE":return Lf.newValue({booleanValue:isNaN(Vf(n.value))});case"NULL":return Lf.gr();default:return Lf.mr()}}}class oC{constructor(t){this.expr=t}evaluate(t,e){return cl(1===this.expr.params.length,50406),new tC(new cf("not",[new cf("is_nan",this.expr.params)])).evaluate(t,e)}}class aC{constructor(t){this.expr=t}evaluate(t,e){switch(cl(1===this.expr.params.length,23123),Mf(this.expr.params[0]).evaluate(t,e).type){case"NULL":return Lf.newValue(Cu);case"UNSET":case"ERROR":return Lf.mr();default:return Lf.newValue(gu)}}}class BC{constructor(t){this.expr=t}evaluate(t,e){return cl(1===this.expr.params.length,23167),new tC(new cf("not",[new cf("is_null",this.expr.params)])).evaluate(t,e)}}class cC{constructor(t){this.expr=t}evaluate(t,e){return cl(1===this.expr.params.length,5228),"ERROR"===Mf(this.expr.params[0]).evaluate(t,e).type?Lf.newValue(Cu):Lf.newValue(gu)}}class lC{constructor(t){this.expr=t}evaluate(t,e){switch(cl(1===this.expr.params.length,6877),Mf(this.expr.params[0]).evaluate(t,e).type){case"ERROR":return Lf.mr();case"UNSET":return Lf.newValue(gu);default:return Lf.newValue(Cu)}}}class uC{constructor(t){this.expr=t}evaluate(t,e){cl(3===this.expr.params.length,11706);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"BOOLEAN":return n.value?.booleanValue?Mf(this.expr.params[1]).evaluate(t,e):Mf(this.expr.params[2]).evaluate(t,e);case"NULL":return Mf(this.expr.params[2]).evaluate(t,e);default:return Lf.mr()}}}class hC{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.params.map(n=>Mf(n).evaluate(t,e));let s;for(const t of n)switch(t.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=void 0===s||Eu(t.value,s.value)>0?t:s}return void 0===s?Lf.gr():s}}class dC{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.params.map(n=>Mf(n).evaluate(t,e));let s;for(const t of n)switch(t.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=void 0===s||Eu(t.value,s.value)<0?t:s}return void 0===s?Lf.gr():s}}class pC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,31033,`${this.expr.name}() function should have exactly 2 params`);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"ERROR":case"UNSET":return Lf.mr()}const s=Mf(this.expr.params[1]).evaluate(t,e);switch(s.type){case"ERROR":case"UNSET":return Lf.mr()}return this.Fr(n,s)}}class fC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){if(t.wr()&&e.wr())return Lf.newValue(Cu);if(t.wr()||e.wr())return Lf.newValue(gu);if(Nu(t.value)||Nu(e.value))return Lf.newValue(gu);if(mu(t.value)!==mu(e.value))return Lf.newValue(gu);switch(zf(t.value,e.value)){case"EQ":return Lf.newValue(Cu);case"NOT_EQ":return Lf.newValue(gu);case"NULL":return Lf.gr();default:al(44615,{left:t,right:e})}}}class CC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){switch(zf(t.value,e.value)){case"EQ":return Lf.newValue(gu);case"NOT_EQ":case"TYPE_MISMATCH":return Lf.newValue(Cu);case"NULL":return Lf.gr();default:al(44614,{left:t,right:e})}}}class gC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){return mu(t.value)!==mu(e.value)||Nu(t.value)||Nu(e.value)?Lf.newValue(gu):Lf.newValue({booleanValue:Eu(t.value,e.value)<0})}}class mC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){return mu(t.value)!==mu(e.value)||Nu(t.value)||Nu(e.value)?Lf.newValue(gu):"EQ"===zf(t.value,e.value)?Lf.newValue(Cu):Lf.newValue({booleanValue:Eu(t.value,e.value)<0})}}class wC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){return mu(t.value)!==mu(e.value)||Nu(t.value)||Nu(e.value)?Lf.newValue(gu):Lf.newValue({booleanValue:Eu(t.value,e.value)>0})}}class yC extends pC{constructor(t){super(t),this.expr=t}Fr(t,e){return mu(t.value)!==mu(e.value)||Nu(t.value)||Nu(e.value)?Lf.newValue(gu):"EQ"===zf(t.value,e.value)?Lf.newValue(Cu):Lf.newValue({booleanValue:Eu(t.value,e.value)>0})}}class EC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class DC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,216);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Lf.gr();case"ARRAY":{const t=n.value.arrayValue?.values??[];return Lf.newValue({arrayValue:{values:[...t].reverse()}})}default:return Lf.mr()}}}class _C{constructor(t){this.expr=t}evaluate(t,e){return cl(2===this.expr.params.length,52884),new sC(new cf("eq_any",[this.expr.params[1],this.expr.params[0]])).evaluate(t,e)}}class bC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,1392);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.mr()}if(n)return Lf.gr();const i=r.value?.arrayValue?.values??[],o=s.value?.arrayValue?.values??[];for(const t of i){let e=!1;n=!1;for(const s of o){switch(Ru(t)&&Ru(s)?"EQ":zf(t,s)){case"EQ":e=!0;break;case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:al(44613,{value:s,search:t})}if(e)break}if(!e)return Lf.newValue(gu)}return Lf.newValue(Cu)}}class vC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,2680);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Lf.mr()}if(n)return Lf.gr();const i=r.value?.arrayValue?.values??[],o=s.value?.arrayValue?.values??[];for(const t of o)for(const e of i)switch(Ru(t)&&Ru(e)?"EQ":zf(t,e)){case"EQ":return Lf.newValue(Cu);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:al(60403,{value:t,search:e})}return n?Lf.gr():Lf.newValue(gu)}}class IC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,38605);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Lf.gr();case"ARRAY":return Lf.newValue({integerValue:`${n.value?.arrayValue?.values?.length??0}`});default:return Lf.mr()}}}class TC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class OC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,1508);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Lf.gr();case"BYTES":{const t=n.value?.bytesValue;if("string"==typeof t){const e=ql.fromBase64String(t).toUint8Array();return e.reverse(),Lf.newValue({bytesValue:ql.fromUint8Array(e).toBase64()})}return Lf.newValue({bytesValue:new Uint8Array(t).reverse()})}case"STRING":{const t=n.value?.stringValue,e=new Intl.__PRIVATE_Segmenter(void 0,{granularity:"grapheme"}).segment(t),s=Array.from(e,t=>t.segment).reverse();return Lf.newValue({stringValue:s.join("")})}default:return Lf.mr()}}}class AC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class SC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class RC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,19400);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Lf.gr();case"STRING":{const t=function(t){let e=0;for(let n=0;n<t.length;n++){const s=t.codePointAt(n);if(void 0===s)return;if(s<=65535)if(s>=55296&&s<=57343)if(s<=56319){const s=t.codePointAt(n+1);void 0!==s&&s>=56320&&s<=57343?(e+=1,n++):e+=1}else e+=1;else e+=1;else{if(!(s<=1114111))return;e+=1,n++}}return e}(n.value.stringValue);return void 0===t?Lf.mr():Lf.newValue({integerValue:t})}default:return Lf.mr()}}}class NC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,8486);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"BYTES":{const t=n.value?.bytesValue;return"string"==typeof t?Lf.newValue({integerValue:ql.fromBase64String(t).toUint8Array().length}):Lf.newValue({integerValue:new Uint8Array(t).length})}case"STRING":{const t=function(t){let e=0;for(let n=0;n<t.length;n++){const s=t.codePointAt(n);if(void 0===s)return;if(s>=55296&&s<=57343){if(!(s<=56319))return;{const s=t.codePointAt(n+1);if(void 0===s||!(s>=56320&&s<=57343))return;e+=4,n++}}else if(s<=127)e+=1;else if(s<=2047)e+=2;else if(s<=65535)e+=3;else{if(!(s<=1114111))return;e+=4,n++}}return e}(n.value?.stringValue);return void 0===t?Lf.mr():Lf.newValue({integerValue:t})}case"NULL":return Lf.gr();default:return Lf.mr()}}}class xC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,39773,`${this.expr.name}() function should have exactly two parameters`);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"STRING":break;case"NULL":n=!0;break;default:return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"STRING":break;case"NULL":n=!0;break;default:return Lf.mr()}return n?Lf.gr():this.Or(s.value?.stringValue,r.value?.stringValue)}}class kC extends xC{Or(t,e){try{const n=function(t){let e="";for(let n=0;n<t.length;n++){const s=t.charAt(n);switch(s){case"_":e+=".";break;case"%":e+=".*";break;case"\\":case".":case"*":case"?":case"+":case"^":case"$":case"|":case"(":case")":case"[":case"]":case"{":case"}":e+="\\"+s;break;default:e+=s}}return"^"+e+"$"}(e),s=Zc.compile(n);return Lf.newValue({booleanValue:s.matches(t)})}catch(t){return il(`Invalid LIKE pattern converted to regex: ${e}, returning error. Error: ${t}`),Lf.mr()}}}class LC extends xC{Or(t,e){try{const n=Zc.compile(e);return Lf.newValue({booleanValue:n.test(t)})}catch(t){return il(`Invalid regex pattern found in regex_contains: ${e}, returning error`),Lf.mr()}}}class FC extends xC{Or(t,e){try{return Lf.newValue({booleanValue:Zc.compile(e).matches(t)})}catch(t){return il(`Invalid regex pattern found in regex_match: ${e}, returning error`),Lf.mr()}}}class PC extends xC{Or(t,e){return Lf.newValue({booleanValue:t.includes(e)})}}class MC extends xC{Or(t,e){return Lf.newValue({booleanValue:t.startsWith(e)})}}class GC extends xC{Or(t,e){return Lf.newValue({booleanValue:t.endsWith(e)})}}class HC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,29079);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"STRING":return Lf.newValue({stringValue:n.value?.stringValue?.toLowerCase()});case"NULL":return Lf.gr();default:return Lf.mr()}}}class UC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,60487);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"STRING":return Lf.newValue({stringValue:n.value?.stringValue?.toUpperCase()});case"NULL":return Lf.gr();default:return Lf.mr()}}}class VC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,28544);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"STRING":return Lf.newValue({stringValue:n.value?.stringValue?.trim()});case"NULL":return Lf.gr();default:return Lf.mr()}}}class jC{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.params.map(n=>Mf(n).evaluate(t,e));let s="",r=!1;for(const t of n)switch(t.type){case"STRING":s+=t.value.stringValue;break;case"NULL":r=!0;break;default:return Lf.mr()}return r?Lf.gr():Lf.newValue({stringValue:s})}}class $C{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,4483);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"UNSET":return Lf.pr();case"MAP":break;default:return Lf.mr()}const s=Mf(this.expr.params[1]).evaluate(t,e);if("STRING"!==s.type)return Lf.mr();const r=n.value?.mapValue?.fields?.[s.value?.stringValue];return void 0===r?Lf.pr():Lf.newValue(r)}}class JC{constructor(t){this.expr=t}evaluate(t,e){cl(2===this.expr.params.length,25231,`${this.expr.name}() function should have exactly 2 params`);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"VECTOR":break;case"NULL":n=!0;break;default:return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"VECTOR":break;case"NULL":n=!0;break;default:return Lf.mr()}if(n)return Lf.gr();const i=Lu(s.value),o=Lu(r.value);if(void 0===i||void 0===o||i.values?.length!==o.values?.length)return Lf.mr();const a=this.Mr(i,o);return void 0===a||isNaN(a)?Lf.mr():Lf.newValue({doubleValue:a})}}class qC extends JC{Mr(t,e){const n=t?.values??[],s=e?.values??[];if(0===n.length)return;let r=0,i=0,o=0;for(let t=0;t<n.length;t++){if(!Au(n[t])||!Au(s[t]))return;const e=Vf(n[t]),a=Vf(s[t]);r+=e*a,i+=e*e,o+=a*a}const a=Math.sqrt(i)*Math.sqrt(o);return 0!==a?1-Math.max(-1,Math.min(1,r/a)):void 0}}class zC extends JC{Mr(t,e){const n=t?.values??[],s=e?.values??[];if(0===n.length)return 0;let r=0;for(let t=0;t<n.length;t++){if(!Au(n[t])||!Au(s[t]))return;r+=Vf(n[t])*Vf(s[t])}return r}}class KC extends JC{Mr(t,e){const n=t?.values??[],s=e?.values??[];if(0===n.length)return 0;let r=0;for(let t=0;t<n.length;t++){if(!Au(n[t])||!Au(s[t]))return;const e=Vf(n[t]),i=Vf(s[t]);r+=Math.pow(e-i,2)}return Math.sqrt(r)}}class QC{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,39044);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"VECTOR":{const t=Lu(n.value);return Lf.newValue({integerValue:t?.values?.length??0})}case"NULL":return Lf.gr();default:return Lf.mr()}}}const WC=BigInt(-62135596800),YC=BigInt(253402300799),XC=BigInt(1e3),ZC=BigInt(1e6),tg=WC*XC,eg=YC*XC+BigInt(999),ng=WC*ZC,sg=YC*ZC+BigInt(999999);function rg(t){return t>=ng&&t<=sg}function ig(t){return t>=WC&&t<=YC}function og(t,e){const n=BigInt(t);return!(n<WC||n>YC||e<0||e>=1e9||n===WC&&0!==e||n===YC&&e>999999999)}function ag(t,e){return e<0?{seconds:t-1,nanos:e+1e9}:{seconds:t,nanos:e}}function Bg(t){return BigInt(t.seconds)*ZC+BigInt(Math.trunc(t.nanoseconds/1e3))}class cg{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,49262,`${this.expr.name}() function should have exactly one parameter`);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"INT":return this.toTimestamp(BigInt(n.value.integerValue));case"NULL":return Lf.gr();default:return Lf.mr()}}}class lg extends cg{toTimestamp(t){if(!rg(t))return Lf.mr();let e=Number(t/ZC),n=Number(t%ZC*BigInt(1e3));const s=ag(e,n);return e=s.seconds,n=s.nanos,og(e,n)?Lf.newValue({timestampValue:{seconds:e,nanos:n}}):Lf.mr()}}class ug extends cg{toTimestamp(t){if(!function(t){return t>=tg&&t<=eg}(t))return Lf.mr();let e=Number(t/XC),n=Number(t%XC*BigInt(1e6));const s=ag(e,n);return e=s.seconds,n=s.nanos,og(e,n)?Lf.newValue({timestampValue:{seconds:e,nanos:n}}):Lf.mr()}}class hg extends cg{toTimestamp(t){if(!ig(t))return Lf.mr();const e=Number(t);return Lf.newValue({timestampValue:{seconds:e,nanos:0}})}}class dg{constructor(t){this.expr=t}evaluate(t,e){cl(1===this.expr.params.length,1265,`${this.expr.name}() function should have exactly one parameter`);const n=Mf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"TIMESTAMP":break;case"NULL":return Lf.gr();default:return Lf.mr()}const s=_d(n.value.timestampValue);return og(s.seconds,s.nanoseconds)?this.Nr(s):Lf.mr()}}class pg extends dg{Nr(t){const e=Bg(t);return rg(e)?Lf.newValue({integerValue:`${e.toString()}`}):Lf.mr()}}class fg extends dg{Nr(t){const e=Bg(t),n=e/BigInt(1e3),s=e%BigInt(1e3);return n>BigInt(0)||s===BigInt(0)?Lf.newValue({integerValue:n.toString()}):Lf.newValue({integerValue:(n-BigInt(1)).toString()})}}class Cg extends dg{Nr(t){const e=BigInt(t.seconds);return ig(e)?Lf.newValue({integerValue:e.toString()}):Lf.mr()}}class gg{constructor(t){this.expr=t}evaluate(t,e){cl(3===this.expr.params.length,2775,`${this.expr.name}() function should have exactly 3 parameters`);let n=!1;const s=Mf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"TIMESTAMP":break;case"NULL":n=!0;break;default:return Lf.mr()}const r=Mf(this.expr.params[1]).evaluate(t,e);let i;switch(r.type){case"STRING":if(i=function(t){switch(t){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}}(r.value.stringValue),void 0===i)return Lf.mr();break;case"NULL":n=!0;break;default:return Lf.mr()}const o=Mf(this.expr.params[2]).evaluate(t,e);switch(o.type){case"INT":break;case"NULL":n=!0;break;default:return Lf.mr()}if(n)return Lf.gr();const a=BigInt(o.value.integerValue);let B;try{switch(i){case"microsecond":B=a;break;case"millisecond":B=a*BigInt(1e3);break;case"second":B=a*BigInt(1e6);break;case"minute":B=a*BigInt(6e7);break;case"hour":B=a*BigInt(36e8);break;case"day":B=a*BigInt(864e8);break;default:return Lf.mr()}if("microsecond"!==i&&a!==BigInt(0)&&B/a!==BigInt(this.Lr(i)))return Lf.mr()}catch(t){return il(`Error during timestamp arithmetic: ${t}`),Lf.mr()}const c=_d(s.value.timestampValue);if(!og(c.seconds,c.nanoseconds))return Lf.mr();const l=Bg(c),u=this.Br(l,B);if(!rg(u))return Lf.mr();const h=Number(u/ZC),d=u%ZC,p=Number((d<0?d+ZC:d)*BigInt(1e3)),f=d<0?h-1:h;return og(f,p)?Lf.newValue({timestampValue:{seconds:f,nanos:p}}):Lf.mr()}Lr(t){switch(t){case"millisecond":return 1e3;case"second":return 1e6;case"minute":return 6e7;case"hour":return 36e8;case"day":return 864e8;default:return 1}}}class mg extends gg{Br(t,e){return t+e}}class wg extends gg{Br(t,e){return t-e}}function yg(t){if((t=Pf(t))instanceof rf)return`fld(${t.fieldName})`;if(t instanceof of)return`cst(${function(t){return null===t?"null":"number"==typeof t?t.toString():"string"==typeof t?`"${t}"`:t instanceof Gp?`ref(${t.path})`:t instanceof Vp?`vec(${JSON.stringify(t)})`:JSON.stringify(t)}(t.value)})`;if(t instanceof cf)return`fn(${t.name},[${t.params.map(yg).join(",")}])`;if("ListOfExpressions"===t.expressionType)return`list([${t.cr.map(yg).join(",")}])`;throw new Error(`Unrecognized expr ${JSON.stringify(t,null,2)}`)}function Eg(t){return`${Array.from(t.entries()).sort().map(([t,e])=>`${t}=${yg(e)}`).join(",")}`}function Dg(t){return t.stages.map(t=>function(t){if(t instanceof Cf)return`${t._name}(${Eg(t.fields)})`;if(t instanceof gf){let e=`${t._name}(${Eg(t.accumulators)})`;return t.groups.size>0&&(e+=`grouping(${Eg(t.groups)})`),e}if(t instanceof mf)return`${t._name}(${Eg(t.groups)})`;if(t instanceof wf)return`${t._name}(${t.hr})`;if(t instanceof yf)return`${t._name}(${t.collectionId})`;if(t instanceof Ef)return`${t._name}()`;if(t instanceof Df)return`${t._name}(${t.Tr.sort()})`;if(t instanceof _f)return`${t._name}(${yg(t.condition)})`;if(t instanceof bf)return`${t._name}(${t.limit})`;if(t instanceof Tf)return`${t._name}(${function(t){return t.map(t=>`${yg(t.expr)}${t.direction}`).join(",")}(t.orderings)})`;throw new Error(`Unrecognized stage ${t._name}`)}(t)).join("|")}function _g(t,e){return Dg(t)===Dg(e)}function bg(t){return t instanceof Sf}function vg(t){return bg(t)?Dg(t):ed(t)}function Ig(t){return bg(t)?Dg(t):function(t){return`${Kh(Zh(t))}|lt:${t.limitType}`}(t)}function Tg(t,e){return t instanceof Sf&&e instanceof Sf?_g(t,e):!(t instanceof Sf&&!(e instanceof Sf)||!(t instanceof Sf)&&e instanceof Sf)&&function(t,e){return Qh(Zh(t),Zh(e))&&t.limitType===e.limitType}(t,e)}function Og(t){return function(t){return!!t.isCorePipeline}(t)?Dg(t):Kh(t)}function Ag(t,e){return t instanceof Sf&&e instanceof Sf?_g(t,e):!(t instanceof Sf&&!(e instanceof Sf)||!(t instanceof Sf)&&e instanceof Sf)&&Qh(t,e)}class Sg{constructor(t,e,n,s){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=s}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const s=this.mutations[e];s.key.isEqual(t.key)&&ch(s,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=lh(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=lh(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=fd();return this.mutations.forEach(s=>{const r=t.get(s.key),i=r.overlayedDocument;let o=this.applyToLocalView(i,r.mutatedFields);o=e.has(s.key)?null:o;const a=Bh(i,o);null!==a&&n.set(s.key,a),i.isValidDocument()||i.convertToNoDocument(Uh.min())}),n}keys(){return this.mutations.reduce((t,e)=>t.add(e.key),wd())}isEqual(t){return this.batchId===t.batchId&&ml(this.mutations,t.mutations,(t,e)=>hh(t,e))&&ml(this.baseMutations,t.baseMutations,(t,e)=>hh(t,e))}}class Rg{constructor(t,e,n,s){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=s}static from(t,e,n){cl(t.mutations.length===n.length,58842,{Ur:t.mutations.length,kr:n.length});let s=gd;const r=t.mutations;for(let t=0;t<r.length;t++)s=s.insert(r[t].key,n[t].version);return new Rg(t,e,n,s)}}function Ng(t,e){let n=e;const s=t.length;for(let e=0;e<s;e++){const s=t.charAt(e);switch(s){case"\0":n+="";break;case"":n+="";break;default:n+=s}}return n}function xg(t){return t+""}class kg{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return null!==t&&this.mutation===t.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}class Lg{constructor(t){this.$r=t}}function Fg(t){const e=Nd({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?td(e,e.limit,"L"):e}class Pg{constructor(){this.Zi=new Mg}addToCollectionParentIndex(t,e){return this.Zi.add(e),Ip.resolve()}getCollectionParents(t,e){return Ip.resolve(this.Zi.getEntries(e))}addFieldIndex(t,e){return Ip.resolve()}deleteFieldIndex(t,e){return Ip.resolve()}deleteAllFieldIndexes(t){return Ip.resolve()}createTargetIndexes(t,e){return Ip.resolve()}getDocumentsMatchingTarget(t,e){return Ip.resolve(null)}getIndexType(t,e){return Ip.resolve(0)}getFieldIndexes(t,e){return Ip.resolve([])}getNextCollectionGroupToUpdate(t){return Ip.resolve(null)}getMinOffset(t,e){return Ip.resolve($h.min())}getMinOffsetFromCollectionGroup(t,e){return Ip.resolve($h.min())}updateCollectionGroup(t,e,n){return Ip.resolve()}updateIndexEntries(t,e){return Ip.resolve()}}class Mg{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),s=this.index[e]||new Dl(Ol.comparator),r=!s.has(n);return this.index[e]=s.add(n),r}has(t){const e=t.lastSegment(),n=t.popLast(),s=this.index[e];return s&&s.has(n)}getEntries(t){return(this.index[t]||new Dl(Ol.comparator)).toArray()}}class Gg{constructor(t){this.ys=t}next(){return this.ys+=2,this.ys}static ws(){return new Gg(0)}static bs(){return new Gg(-1)}}function Hg(t,e){return function(t,e){let n=e;for(const e of t.stages)n=Ug({serializer:t.serializer,serverTimestampBehavior:t.listenOptions?.serverTimestampBehavior},e,n);return n}(t,[e]).length>0}function Ug(t,e,n){if(e instanceof wf)return function(t,e,n){return n.filter(t=>t.isFoundDocument()&&`/${t.key.getCollectionPath().canonicalString()}`===e.hr)}(0,e,n);if(e instanceof _f)return function(t,e,n){return n.filter(n=>{const s=Ff(Mf(e.condition).evaluate(t,n));return void 0!==s&&wu(s,Cu)})}(t,e,n);if(e instanceof yf)return function(t,e,n){return n.filter(t=>t.isFoundDocument()&&t.key.getCollectionPath().lastSegment()===e.collectionId)}(0,e,n);if(e instanceof Ef)return function(t,e,n){return n.filter(t=>t.isFoundDocument())}(0,0,n);if(e instanceof Df)return function(t,e,n){return n.filter(t=>t.isFoundDocument()&&e.Pr.has(t.key.path.toStringWithLeadingSlash()))}(0,e,n);if(e instanceof bf)return function(t,e,n){return n.slice(0,e.limit)}(0,e,n);if(e instanceof Tf)return function(t,e,n){const s=e.orderings.map(t=>({Ms:Mf(t.expr),direction:t.direction}));return[...n].sort((e,n)=>{for(const{Ms:r,direction:i}of s){const s=Ff(r.evaluate(t,e)),o=Ff(r.evaluate(t,n)),a=Eu(s??fu,o??fu);if(0!==a)return"ascending"===i?a:-a}return 0})}(t,e,n);throw new Error(`Unknown stage: ${e._name}`)}class Vg{constructor(){this.changes=new Bd(t=>t.toString(),(t,e)=>t.isEqual(e)),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,Vh.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?Ip.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}class jg{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}class $g{constructor(t,e,n,s){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=s}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next(s=>(n=s,this.remoteDocumentCache.getEntry(t,e))).next(t=>(null!==n&&lh(n.mutation,t,Rl.empty(),$l.now()),t))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next(e=>this.getLocalViewOfDocuments(t,e,wd()).next(()=>e))}getLocalViewOfDocuments(t,e,n=wd()){const s=pd();return this.populateOverlays(t,s,e).next(()=>this.computeViews(t,e,s,n).next(t=>{let e=hd();return t.forEach((t,n)=>{e=e.insert(t,n.overlayedDocument)}),e}))}getOverlayedDocuments(t,e){const n=pd();return this.populateOverlays(t,n,e).next(()=>this.computeViews(t,e,n,wd()))}populateOverlays(t,e,n){const s=[];return n.forEach(t=>{e.has(t)||s.push(t)}),this.documentOverlayCache.getOverlays(t,s).next(t=>{t.forEach((t,n)=>{e.set(t,n)})})}computeViews(t,e,n,s){let r=ld();const i=Cd(),o=Cd();return e.forEach((t,e)=>{const o=n.get(e.key);s.has(e.key)&&(void 0===o||o.mutation instanceof ph)?r=r.insert(e.key,e):void 0!==o?(i.set(e.key,o.mutation.getFieldMask()),lh(o.mutation,e,o.mutation.getFieldMask(),$l.now())):i.set(e.key,Rl.empty())}),this.recalculateAndSaveOverlays(t,r).next(t=>(t.forEach((t,e)=>i.set(t,e)),e.forEach((t,e)=>o.set(t,new jg(e,i.get(t)??null))),o))}recalculateAndSaveOverlays(t,e){const n=Cd();let s=new wl((t,e)=>t-e),r=wd();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next(t=>{for(const r of t)r.keys().forEach(t=>{const i=e.get(t);if(null===i)return;let o=n.get(t)||Rl.empty();o=r.applyToLocalView(i,o),n.set(t,o);const a=(s.get(r.batchId)||wd()).add(t);s=s.insert(r.batchId,a)})}).next(()=>{const i=[],o=s.getReverseIterator();for(;o.hasNext();){const s=o.getNext(),a=s.key,B=s.value,c=fd();B.forEach(t=>{if(!r.has(t)){const s=Bh(e.get(t),n.get(t));null!==s&&c.set(t,s),r=r.add(t)}}),i.push(this.documentOverlayCache.saveOverlays(t,a,c))}return Ip.waitFor(i)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next(e=>this.recalculateAndSaveOverlays(t,e))}getDocumentsMatchingQuery(t,e,n,s){return bg(e)?this.getDocumentsMatchingPipeline(t,e,n,s):function(t){return Ll.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):function(t){return null!==t.collectionGroup}(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n,s):this.getDocumentsMatchingCollectionQuery(t,e,n,s)}getNextDocuments(t,e,n,s){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,s).next(r=>{const i=s-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,s-r.size):Ip.resolve(pd());let o=-1,a=r;return i.next(e=>Ip.forEach(e,(e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),r.get(e)?Ip.resolve():this.remoteDocumentCache.getEntry(t,e).next(t=>{a=a.insert(e,t)}))).next(()=>this.populateOverlays(t,e,r)).next(()=>this.computeViews(t,a,e,wd())).next(t=>({batchId:o,changes:dd(t)})))})}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new Ll(e)).next(t=>{let e=hd();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e})}getDocumentsMatchingCollectionGroupQuery(t,e,n,s){const r=e.collectionGroup;let i=hd();return this.indexManager.getCollectionParents(t,r).next(o=>Ip.forEach(o,o=>{const a=function(t,e){return new Wh(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,o.child(r));return this.getDocumentsMatchingCollectionQuery(t,a,n,s).next(t=>{t.forEach((t,e)=>{i=i.insert(t,e)})})}).next(()=>i))}getDocumentsMatchingCollectionQuery(t,e,n,s){let r;return this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId).next(i=>(r=i,this.remoteDocumentCache.getDocumentsMatchingQuery(t,e,n,r,s))).next(t=>this.retrieveMatchingLocalDocuments(r,t,t=>nd(e,t)))}getDocumentsMatchingPipeline(t,e,n,s){if("collection_group"===Rf(e)){const r=xf(e);let i=hd();return this.indexManager.getCollectionParents(t,r).next(o=>Ip.forEach(o,o=>{const a=function(t,e){const n=t.stages.map(t=>t instanceof yf?new wf(e.canonicalString(),{}):t);return new Sf(t.serializer,n)}(e,o.child(r));return this.getDocumentsMatchingPipeline(t,a,n,s).next(t=>{t.forEach((t,e)=>{i=i.insert(t,e)})})}).next(()=>i))}{let r;return this.getOverlaysForPipeline(t,e,n.largestBatchId).next(i=>{switch(r=i,Rf(e)){case"collection":return this.remoteDocumentCache.getDocumentsMatchingQuery(t,e,n,r,s);case"documents":let i=wd();for(const t of kf(e))i=i.add(Ll.fromPath(t));return this.remoteDocumentCache.getEntries(t,i);case"database":return this.remoteDocumentCache.getAllEntries(t);default:throw new vl("invalid-argument",`Invalid pipeline source to execute offline: ${Dg(e)}`)}}).next(t=>this.retrieveMatchingLocalDocuments(r,t,t=>Hg(e,t)))}}retrieveMatchingLocalDocuments(t,e,n){t.forEach((t,n)=>{const s=n.getKey();null===e.get(s)&&(e=e.insert(s,Vh.newInvalidDocument(s)))});let s=hd();return e.forEach((e,r)=>{const i=t.get(e);void 0!==i&&lh(i.mutation,r,Rl.empty(),$l.now()),n(r)&&(s=s.insert(e,r))}),s}getOverlaysForPipeline(t,e,n){switch(Rf(e)){case"collection":return this.documentOverlayCache.getOverlaysForCollection(t,Ol.fromString(Nf(e)),n);case"collection_group":throw new vl("invalid-argument",`Unexpected collection group pipeline: ${Dg(e)}`);case"documents":return this.documentOverlayCache.getOverlays(t,kf(e).map(t=>Ll.fromPath(t)));case"database":return this.documentOverlayCache.getAllOverlays(t,n);default:throw new vl("invalid-argument",`Failed to get overlays for pipeline: ${Dg(e)}`)}}}class Jg{constructor(t){this.serializer=t,this.Qs=new Map,this.Ws=new Map}getBundleMetadata(t,e){return Ip.resolve(this.Qs.get(e))}saveBundleMetadata(t,e){return this.Qs.set(e.id,function(t){return{id:t.id,version:t.version,createTime:Id(t.createTime)}}(e)),Ip.resolve()}getNamedQuery(t,e){return Ip.resolve(this.Ws.get(e))}saveNamedQuery(t,e){return this.Ws.set(e.name,function(t){return{name:t.name,query:Fg(t.bundledQuery),readTime:Id(t.readTime)}}(e)),Ip.resolve()}}class qg{constructor(){this.overlays=new wl(Ll.comparator),this.Gs=new Map}getOverlay(t,e){return Ip.resolve(this.overlays.get(e))}getOverlays(t,e){const n=pd();return Ip.forEach(e,e=>this.getOverlay(t,e).next(t=>{null!==t&&n.set(e,t)})).next(()=>n)}getAllOverlays(t,e){const n=pd();return this.overlays.forEach((t,s)=>{s.largestBatchId>e&&n.set(t,s)}),Ip.resolve(n)}saveOverlays(t,e,n){return n.forEach((n,s)=>{this.Zr(t,e,s)}),Ip.resolve()}removeOverlaysForBatchId(t,e,n){const s=this.Gs.get(n);return void 0!==s&&(s.forEach(t=>this.overlays=this.overlays.remove(t)),this.Gs.delete(n)),Ip.resolve()}getOverlaysForCollection(t,e,n){const s=pd(),r=e.length+1,i=new Ll(e.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const t=o.getNext().value,i=t.getKey();if(!e.isPrefixOf(i.path))break;i.path.length===r&&t.largestBatchId>n&&s.set(t.getKey(),t)}return Ip.resolve(s)}getOverlaysForCollectionGroup(t,e,n,s){let r=new wl((t,e)=>t-e);const i=this.overlays.getIterator();for(;i.hasNext();){const t=i.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=r.get(t.largestBatchId);null===e&&(e=pd(),r=r.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=pd(),a=r.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach((t,e)=>o.set(t,e)),!(o.size()>=s)););return Ip.resolve(o)}Zr(t,e,n){const s=this.overlays.get(n.key);if(null!==s){const t=this.Gs.get(s.largestBatchId).delete(n.key);this.Gs.set(s.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new kg(e,n));let r=this.Gs.get(e);void 0===r&&(r=wd(),this.Gs.set(e,r)),this.Gs.set(e,r.add(n.key))}}class zg{constructor(){this.sessionToken=ql.EMPTY_BYTE_STRING}getSessionToken(t){return Ip.resolve(this.sessionToken)}setSessionToken(t,e){return this.sessionToken=e,Ip.resolve()}}class Kg{constructor(){this.zs=new Dl(Qg.js),this.Hs=new Dl(Qg.Js)}isEmpty(){return this.zs.isEmpty()}addReference(t,e){const n=new Qg(t,e);this.zs=this.zs.add(n),this.Hs=this.Hs.add(n)}Ys(t,e){t.forEach(t=>this.addReference(t,e))}removeReference(t,e){this.Zs(new Qg(t,e))}Xs(t,e){t.forEach(t=>this.removeReference(t,e))}e_(t){const e=new Ll(new Ol([])),n=new Qg(e,t),s=new Qg(e,t+1),r=[];return this.Hs.forEachInRange([n,s],t=>{this.Zs(t),r.push(t.key)}),r}t_(){this.zs.forEach(t=>this.Zs(t))}Zs(t){this.zs=this.zs.delete(t),this.Hs=this.Hs.delete(t)}n_(t){const e=new Ll(new Ol([])),n=new Qg(e,t),s=new Qg(e,t+1);let r=wd();return this.Hs.forEachInRange([n,s],t=>{r=r.add(t.key)}),r}containsKey(t){const e=new Qg(t,0),n=this.zs.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Qg{constructor(t,e){this.key=t,this.r_=e}static js(t,e){return Ll.comparator(t.key,e.key)||dl(t.r_,e.r_)}static Js(t,e){return dl(t.r_,e.r_)||Ll.comparator(t.key,e.key)}}class Wg{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.Gr=1,this.i_=new Dl(Qg.js)}checkEmpty(t){return Ip.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,s){const r=this.Gr;this.Gr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new Sg(r,e,n,s);this.mutationQueue.push(i);for(const e of s)this.i_=this.i_.add(new Qg(e.key,r)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return Ip.resolve(i)}lookupMutationBatch(t,e){return Ip.resolve(this.s_(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,s=this.__(n),r=s<0?0:s;return Ip.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return Ip.resolve(0===this.mutationQueue.length?-1:this.Gr-1)}getAllMutationBatches(t){return Ip.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Qg(e,0),s=new Qg(e,Number.POSITIVE_INFINITY),r=[];return this.i_.forEachInRange([n,s],t=>{const e=this.s_(t.r_);r.push(e)}),Ip.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new Dl(dl);return e.forEach(t=>{const e=new Qg(t,0),s=new Qg(t,Number.POSITIVE_INFINITY);this.i_.forEachInRange([e,s],t=>{n=n.add(t.r_)})}),Ip.resolve(this.o_(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,s=n.length+1;let r=n;Ll.isDocumentKey(r)||(r=r.child(""));const i=new Qg(new Ll(r),0);let o=new Dl(dl);return this.i_.forEachWhile(t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===s&&(o=o.add(t.r_)),!0)},i),Ip.resolve(this.o_(o))}o_(t){const e=[];return t.forEach(t=>{const n=this.s_(t);null!==n&&e.push(n)}),e}removeMutationBatch(t,e){cl(0===this.a_(e.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.i_;return Ip.forEach(e.mutations,s=>{const r=new Qg(s.key,e.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(t,s.key)}).next(()=>{this.i_=n})}Hr(t){}containsKey(t,e){const n=new Qg(e,0),s=this.i_.firstAfterOrEqual(n);return Ip.resolve(e.isEqual(s&&s.key))}performConsistencyCheck(t){return this.mutationQueue.length,Ip.resolve()}a_(t,e){return this.__(t)}__(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}s_(t){const e=this.__(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}class Yg{constructor(t){this.u_=t,this.docs=new wl(Ll.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,s=this.docs.get(n),r=s?s.size:0,i=this.u_(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:i}),this.size+=i-r,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return Ip.resolve(n?n.document.mutableCopy():Vh.newInvalidDocument(e))}getEntries(t,e){let n=ld();return e.forEach(t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():Vh.newInvalidDocument(t))}),Ip.resolve(n)}getAllEntries(t){let e=ld();return this.docs.forEach((t,n)=>{e=e.insert(t,n.document)}),Ip.resolve(e)}getDocumentsMatchingQuery(t,e,n,s){let r,i;bg(e)?(r=Ol.fromString(Nf(e)),i=t=>Hg(e,t)):(r=e.path,i=t=>nd(e,t));let o=ld();const a=new Ll(r.child("__id-9223372036854775808__")),B=this.docs.getIteratorFrom(a);for(;B.hasNext();){const{key:t,value:{document:e}}=B.getNext();if(!r.isPrefixOf(t.path))break;t.path.length>r.length+1||Jh(jh(e),n)<=0||(s.has(e.key)||i(e))&&(o=o.insert(e.key,e.mutableCopy()))}return Ip.resolve(o)}getAllFromCollectionGroup(t,e,n,s){al(9500)}c_(t,e){return Ip.forEach(this.docs,t=>e(t))}newChangeBuffer(t){return new Xg(this)}getSize(t){return Ip.resolve(this.size)}}class Xg extends Vg{constructor(t){super(),this.$s=t}applyChanges(t){const e=[];return this.changes.forEach((n,s)=>{s.isValidDocument()?e.push(this.$s.addEntry(t,s)):this.$s.removeEntry(n)}),Ip.waitFor(e)}getFromCache(t,e){return this.$s.getEntry(t,e)}getAllFromCache(t,e){return this.$s.getEntries(t,e)}}class Zg{constructor(t){this.persistence=t,this.l_=new Bd(t=>Og(t),Ag),this.lastRemoteSnapshotVersion=Uh.min(),this.highestTargetId=0,this.E_=0,this.h_=new Kg,this.targetCount=0,this.T_=Gg.ws()}forEachTarget(t,e){return this.l_.forEach((t,n)=>e(n)),Ip.resolve()}getLastRemoteSnapshotVersion(t){return Ip.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return Ip.resolve(this.E_)}allocateTargetId(t){return this.highestTargetId=this.T_.next(),Ip.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.E_&&(this.E_=e),Ip.resolve()}Ds(t){this.l_.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.T_=new Gg(e),this.highestTargetId=e),t.sequenceNumber>this.E_&&(this.E_=t.sequenceNumber)}addTargetData(t,e){return this.Ds(e),this.targetCount+=1,Ip.resolve()}updateTargetData(t,e){return this.Ds(e),Ip.resolve()}removeTargetData(t,e){return this.l_.delete(e.target),this.h_.e_(e.targetId),this.targetCount-=1,Ip.resolve()}removeTargets(t,e,n){let s=0;const r=[];return this.l_.forEach((i,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.l_.delete(i),r.push(this.removeMatchingKeysForTargetId(t,o.targetId)),s++)}),Ip.waitFor(r).next(()=>s)}getTargetCount(t){return Ip.resolve(this.targetCount)}getTargetData(t,e){const n=this.l_.get(e)||null;return Ip.resolve(n)}addMatchingKeys(t,e,n){return this.h_.Ys(e,n),Ip.resolve()}removeMatchingKeys(t,e,n){this.h_.Xs(e,n);const s=this.persistence.referenceDelegate,r=[];return s&&e.forEach(e=>{r.push(s.markPotentiallyOrphaned(t,e))}),Ip.waitFor(r)}removeMatchingKeysForTargetId(t,e){return this.h_.e_(e),Ip.resolve()}getMatchingKeysForTargetId(t,e){const n=this.h_.n_(e);return Ip.resolve(n)}containsKey(t,e){return Ip.resolve(this.h_.containsKey(e))}}class tm{constructor(t,e){this.P_={},this.overlays={},this.I_=new _p(0),this.R_=!1,this.R_=!0,this.A_=new zg,this.referenceDelegate=t(this),this.V_=new Zg(this),this.indexManager=new Pg,this.remoteDocumentCache=function(t){return new Yg(t)}(t=>this.referenceDelegate.d_(t)),this.serializer=new Lg(e),this.f_=new Jg(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.R_=!1,Promise.resolve()}get started(){return this.R_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new qg,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.P_[t.toKey()];return n||(n=new Wg(e,this.referenceDelegate),this.P_[t.toKey()]=n),n}getGlobalsCache(){return this.A_}getTargetCache(){return this.V_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.f_}runTransaction(t,e,n){sl("MemoryPersistence","Starting transaction:",t);const s=new em(this.I_.next());return this.referenceDelegate.m_(),n(s).next(t=>this.referenceDelegate.p_(s).next(()=>t)).toPromise().then(t=>(s.raiseOnCommittedEvent(),t))}g_(t,e){return Ip.or(Object.values(this.P_).map(n=>()=>n.containsKey(t,e)))}}class em extends bp{constructor(t){super(),this.currentSequenceNumber=t}}class nm{constructor(t){this.persistence=t,this.y_=new Kg,this.w_=null}static b_(t){return new nm(t)}get S_(){if(this.w_)return this.w_;throw al(60996)}addReference(t,e,n){return this.y_.addReference(n,e),this.S_.delete(n.toString()),Ip.resolve()}removeReference(t,e,n){return this.y_.removeReference(n,e),this.S_.add(n.toString()),Ip.resolve()}markPotentiallyOrphaned(t,e){return this.S_.add(e.toString()),Ip.resolve()}removeTarget(t,e){this.y_.e_(e.targetId).forEach(t=>this.S_.add(t.toString()));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next(t=>{t.forEach(t=>this.S_.add(t.toString()))}).next(()=>n.removeTargetData(t,e))}m_(){this.w_=new Set}p_(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Ip.forEach(this.S_,n=>{const s=Ll.fromPath(n);return this.v_(t,s).next(t=>{t||e.removeEntry(s,Uh.min())})}).next(()=>(this.w_=null,e.apply(t)))}updateLimboDocument(t,e){return this.v_(t,e).next(t=>{t?this.S_.delete(e.toString()):this.S_.add(e.toString())})}d_(t){return 0}v_(t,e){return Ip.or([()=>Ip.resolve(this.y_.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.g_(t,e)])}}class sm{constructor(t,e){this.persistence=t,this.D_=new Bd(t=>function(t){let e="";for(let n=0;n<t.length;n++)e.length>0&&(e=xg(e)),e=Ng(t.get(n),e);return xg(e)}(t.path),(t,e)=>t.isEqual(e)),this.garbageCollector=function(t,e){return new Np(t,e)}(this,e)}static b_(t,e){return new sm(t,e)}m_(){}p_(t){return Ip.resolve()}forEachTarget(t,e){return this.persistence.getTargetCache().forEachTarget(t,e)}ir(t){const e=this.Cs(t);return this.persistence.getTargetCache().getTargetCount(t).next(t=>e.next(e=>t+e))}Cs(t){let e=0;return this.sr(t,t=>{e++}).next(()=>e)}sr(t,e){return Ip.forEach(this.D_,(n,s)=>this.Os(t,n,s).next(t=>t?Ip.resolve():e(s)))}removeTargets(t,e,n){return this.persistence.getTargetCache().removeTargets(t,e,n)}removeOrphanedDocuments(t,e){let n=0;const s=this.persistence.getRemoteDocumentCache(),r=s.newChangeBuffer();return s.c_(t,s=>this.Os(t,s,e).next(t=>{t||(n++,r.removeEntry(s,Uh.min()))})).next(()=>r.apply(t)).next(()=>n)}markPotentiallyOrphaned(t,e){return this.D_.set(e,t.currentSequenceNumber),Ip.resolve()}removeTarget(t,e){const n=e.withSequenceNumber(t.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(t,n)}addReference(t,e,n){return this.D_.set(n,t.currentSequenceNumber),Ip.resolve()}removeReference(t,e,n){return this.D_.set(n,t.currentSequenceNumber),Ip.resolve()}updateLimboDocument(t,e){return this.D_.set(e,t.currentSequenceNumber),Ip.resolve()}d_(t){let e=t.key.toString().length;return t.isFoundDocument()&&(e+=Iu(t.data.value)),e}Os(t,e,n){return Ip.or([()=>this.persistence.g_(t,e),()=>this.persistence.getTargetCache().containsKey(t,e),()=>{const t=this.D_.get(e);return Ip.resolve(void 0!==t&&t>n)}])}getCacheSize(t){return this.persistence.getRemoteDocumentCache().getSize(t)}}class rm{constructor(t,e,n,s){this.targetId=t,this.fromCache=e,this.Vo=n,this.fo=s}static mo(t,e){let n=wd(),s=wd();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:s=s.add(t.doc.key)}return new rm(t,e.fromCache,n,s)}}function im(t,e){return Ll.comparator(t.key,e.key)}class om{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(t){this._documentReadCount+=t}}class am{constructor(){this.po=!1,this.yo=!1,this.wo=100,this.bo=qn()?8:function(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}($n())>0?6:4}initialize(t,e){this.So=t,this.indexManager=e,this.po=!0}getDocumentsMatchingQuery(t,e,n,s){const r={result:null};return this.vo(t,e).next(t=>{r.result=t}).next(()=>{if(!r.result)return this.Do(t,e,s,n).next(t=>{r.result=t})}).next(()=>{if(r.result)return;const n=new om;return this.xo(t,e,n).next(s=>{if(r.result=s,this.yo)return this.Co(t,e,n,s.size)})}).next(()=>r.result)}Co(t,e,n,s){return bg(e)?Ip.resolve():n.documentReadCount<this.wo?(nl()<=ds.DEBUG&&sl("QueryEngine","SDK will not create cache indexes for query:",ed(e),"since it only creates cache indexes for collection contains","more than or equal to",this.wo,"documents"),Ip.resolve()):(nl()<=ds.DEBUG&&sl("QueryEngine","Query:",ed(e),"scans",n.documentReadCount,"local documents and returns",s,"documents as results."),n.documentReadCount>this.bo*s?(nl()<=ds.DEBUG&&sl("QueryEngine","The SDK decides to create cache indexes for query:",ed(e),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(t,Zh(e))):Ip.resolve())}vo(t,e){if(bg(e))return Ip.resolve(null);let n=e;if(Yh(n))return Ip.resolve(null);let s=Zh(n);return this.indexManager.getIndexType(t,s).next(e=>0===e?null:(null!==n.limit&&1===e&&(n=td(n,null,"F"),s=Zh(n)),this.indexManager.getDocumentsMatchingTarget(t,s).next(e=>{const r=wd(...e);return this.So.getDocuments(t,r).next(e=>this.indexManager.getMinOffset(t,s).next(s=>{const i=this.Fo(n,e);return this.Oo(n,i,r,s.readTime)?this.vo(t,td(n,null,"F")):this.Mo(t,i,n,s)}))})))}Do(t,e,n,s){return(bg(e)?function(t){for(const e of t.stages){if(e instanceof bf||e instanceof vf)return!1;if(e instanceof _f){if(e.condition instanceof uf&&"exists"===e.condition._expr.name&&e.condition._expr.params[0]instanceof rf&&e.condition._expr.params[0].fieldName===Il)continue;return!1}}return!0}(e):Yh(e))||s.isEqual(Uh.min())?Ip.resolve(null):this.So.getDocuments(t,n).next(r=>{const i=this.Fo(e,r);return this.Oo(e,i,n,s)?Ip.resolve(null):(nl()<=ds.DEBUG&&sl("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),vg(e)),this.Mo(t,i,e,function(t,e){const n=t.toTimestamp().seconds,s=t.toTimestamp().nanoseconds+1,r=Uh.fromTimestamp(1e9===s?new $l(n+1,0):new $l(n,s));return new $h(r,Ll.empty(),e)}(s,-1)).next(t=>t))})}Fo(t,e){let n,s;return bg(t)?(n=new Dl(im),s=e=>Hg(t,e)):(n=new Dl(sd(t)),s=e=>nd(t,e)),e.forEach((t,e)=>{s(e)&&(n=n.add(e))}),n}Oo(t,e,n,s){if(bg(t))return function(t){return t.stages.some(t=>t instanceof bf||t instanceof vf)}(t);if(null===t.limit)return!1;if(n.size!==e.size)return!0;const r="F"===t.limitType?e.last():e.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(s)>0)}xo(t,e,n){return nl()<=ds.DEBUG&&sl("QueryEngine","Using full collection scan to execute query:",vg(e)),this.So.getDocumentsMatchingQuery(t,e,$h.min(),n)}Mo(t,e,n,s){return this.So.getDocumentsMatchingQuery(t,n,s).next(t=>(e.forEach(e=>{t=t.insert(e.key,e)}),t))}}class Bm{constructor(t,e,n,s){this.persistence=t,this.No=e,this.serializer=s,this.Lo=new wl(dl),this.Bo=new Bd(t=>Og(t),Ag),this.Uo=new Map,this.ko=t.getRemoteDocumentCache(),this.V_=t.getTargetCache(),this.f_=t.getBundleCache(),this.qo(n)}qo(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new $g(this.ko,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ko.setIndexManager(this.indexManager),this.No.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",e=>t.collect(e,this.Lo))}}async function cm(t,e){const n=ll(t);return await n.persistence.runTransaction("Handle user change","readonly",t=>{let s;return n.mutationQueue.getAllMutationBatches(t).next(r=>(s=r,n.qo(e),n.mutationQueue.getAllMutationBatches(t))).next(e=>{const r=[],i=[];let o=wd();for(const t of s){r.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next(t=>({$o:t,removedBatchIds:r,addedBatchIds:i}))})})}function lm(t,e){const n=ll(t);return n.persistence.runTransaction("Get next mutation batch","readonly",t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e)))}class um{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.Yo=0,this.Zo=null,this.Xo=!0}ea(){0===this.Yo&&(this.ta("Unknown"),this.Zo=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.Zo=null,this.na("Backend didn't respond within 10 seconds."),this.ta("Offline"),Promise.resolve())))}ra(t){"Online"===this.state?this.ta("Unknown"):(this.Yo++,this.Yo>=1&&(this.ia(),this.na(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.ta("Offline")))}set(t){this.ia(),this.Yo=0,"Online"===t&&(this.Xo=!1),this.ta(t)}ta(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}na(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Xo?(rl(e),this.Xo=!1):sl("OnlineStateTracker",e)}ia(){null!==this.Zo&&(this.Zo.cancel(),this.Zo=null)}}const hm="RemoteStore";class dm{constructor(t,e,n,s,r){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.sa=[],this._a=new Map,this.oa=new Map,this.aa=new Map,this.ua=new Gg(1e3),this.ca=new Gg(1001),this.la=new Set,this.Ea=[],this.ha=r,this.ha.Qe(t=>{n.enqueueAndForget(async()=>{Cm(this)&&(sl(hm,"Restarting streams for network reachability change."),await async function(t){const e=ll(t);e.la.add(4),await fm(e),e.Ta.set("Unknown"),e.la.delete(4),await pm(e)}(this))})}),this.Ta=new um(n,s)}}async function pm(t){if(Cm(t))for(const e of t.Ea)await e(!0)}async function fm(t){for(const e of t.Ea)await e(!1)}function Cm(t){return 0===ll(t).la.size}async function gm(t,e,n){if(!Tp(e))throw e;t.la.add(1),await fm(t),t.Ta.set("Offline"),n||(n=()=>function(t){const e=ll(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.V_.getLastRemoteSnapshotVersion(t))}(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{sl(hm,"Retrying IndexedDB access"),await n(),t.la.delete(1),await pm(t)})}function mm(t,e){return e().catch(n=>gm(t,n,e))}async function wm(t){const e=ll(t),n=Am(e);let s=e.sa.length>0?e.sa[e.sa.length-1].batchId:-1;for(;ym(e);)try{const t=await lm(e.localStore,s);if(null===t){0===e.sa.length&&n.en();break}s=t.batchId,Em(e,t)}catch(t){await gm(e,t)}Dm(e)&&_m(e)}function ym(t){return Cm(t)&&t.sa.length<10}function Em(t,e){t.sa.push(e);const n=Am(t);n.Yt()&&n.Rn&&n.An(e.mutations)}function Dm(t){return Cm(t)&&!Am(t).Jt()&&t.sa.length>0}function _m(t){Am(t).start()}async function bm(t){Am(t).fn()}async function vm(t){const e=Am(t);for(const n of t.sa)e.An(n.mutations)}async function Im(t,e,n){const s=t.sa.shift(),r=Rg.from(s,e,n);await mm(t,()=>t.remoteSyncer.applySuccessfulWrite(r)),await wm(t)}async function Tm(t,e){e&&Am(t).Rn&&await async function(t,e){if(function(t){return function(t){switch(t){case bl.OK:return al(64938);case bl.CANCELLED:case bl.UNKNOWN:case bl.DEADLINE_EXCEEDED:case bl.RESOURCE_EXHAUSTED:case bl.INTERNAL:case bl.UNAVAILABLE:case bl.UNAUTHENTICATED:return!1;case bl.INVALID_ARGUMENT:case bl.NOT_FOUND:case bl.ALREADY_EXISTS:case bl.PERMISSION_DENIED:case bl.FAILED_PRECONDITION:case bl.ABORTED:case bl.OUT_OF_RANGE:case bl.UNIMPLEMENTED:case bl.DATA_LOSS:return!0;default:return al(15467,{code:t})}}(t)&&t!==bl.ABORTED}(e.code)){const n=t.sa.shift();Am(t).Xt(),await mm(t,()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e)),await wm(t)}}(t,e),Dm(t)&&_m(t)}async function Om(t,e){const n=ll(t);n.asyncQueue.verifyOperationInProgress(),sl(hm,"RemoteStore received new credentials");const s=Cm(n);n.la.add(3),await fm(n),s&&n.Ta.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.la.delete(3),await pm(n)}function Am(t){return t.Ra||(t.Ra=function(t,e,n){const s=ll(t);return s.pn(),new Cp(e,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,n)}(t.datastore,t.asyncQueue,{ct:()=>Promise.resolve(),Et:bm.bind(null,t),Tt:Tm.bind(null,t),Vn:vm.bind(null,t),dn:Im.bind(null,t)}),t.Ea.push(async e=>{e?(t.Ra.Xt(),await wm(t)):(await t.Ra.stop(),t.sa.length>0&&(sl(hm,`Stopping write stream with ${t.sa.length} pending writes`),t.sa=[]))})),t.Ra}class Sm{constructor(t,e,n,s,r){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=s,this.removalCallback=r,this.deferred=new Jd,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(t=>{})}get promise(){return this.deferred.promise}static createAndSchedule(t,e,n,s,r){const i=Date.now()+n,o=new Sm(t,e,i,s,r);return o.start(n),o}start(t){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new vl(bl.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(t=>this.deferred.resolve(t))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Rm(t,e){if(rl("AsyncQueue",`${e}: ${t}`),Tp(t))return new vl(bl.UNAVAILABLE,`${e}: ${t}`);throw t}class Nm{constructor(){this.activeTargetIds=yd}Ba(t){this.activeTargetIds=this.activeTargetIds.add(t)}Ua(t){this.activeTargetIds=this.activeTargetIds.delete(t)}La(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class xm{constructor(){this.fu=new Nm,this.mu={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t,e=!0){return e&&this.fu.Ba(t),this.mu[t]||"not-current"}updateQueryState(t,e,n){this.mu[t]=e}removeLocalQueryTarget(t){this.fu.Ua(t)}isLocalQueryTarget(t){return this.fu.activeTargetIds.has(t)}clearQueryState(t){delete this.mu[t]}getAllActiveQueryTargets(){return this.fu.activeTargetIds}isActiveQueryTarget(t){return this.fu.activeTargetIds.has(t)}start(){return this.fu=new Nm,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}function km(){return"undefined"!=typeof document?document:null}class Lm{constructor(){this.queries=Fm(),this.onlineState="Unknown",this.Du=new Set}terminate(){!function(t,e){const n=ll(t),s=n.queries;n.queries=Fm(),s.forEach((t,n)=>{for(const t of n.bu)t.onError(e)})}(this,new vl(bl.ABORTED,"Firestore shutting down"))}}function Fm(){return new Bd(t=>Ig(t),Tg)}var Pm;!function(t){t.Default="default",t.Cache="cache"}(Pm||(Pm={}));class Mm{constructor(t,e,n,s,r,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=s,this.currentUser=r,this.maxConcurrentLimboResolutions=i,this.hc={},this.Tc=new Bd(t=>Ig(t),Tg),this.Pc=new Map,this.Ic=new Set,this.Rc=new wl(Ll.comparator),this.Ac=new Map,this.Vc=new Kg,this.dc={},this.fc=new Map,this.mc=Gg.bs(),this.onlineState="Unknown",this.gc=void 0}get isPrimaryClient(){return!0===this.gc}}async function Gm(t,e,n){const s=function(t){const e=ll(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Um.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=Vm.bind(null,e),e}(t);try{const t=await function(t,e){const n=ll(t),s=$l.now(),r=e.reduce((t,e)=>t.add(e.key),wd());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",t=>{let a=ld(),B=wd();return n.ko.getEntries(t,r).next(t=>{a=t,a.forEach((t,e)=>{e.isValidDocument()||(B=B.add(t))})}).next(()=>n.localDocuments.getOverlayedDocuments(t,a)).next(r=>{i=r;const o=[];for(const t of e){const e=uh(t,i.get(t.key).overlayedDocument);null!=e&&o.push(new ph(t.key,e,Mu(e.value.mapValue),ih.exists(!0)))}return n.mutationQueue.addMutationBatch(t,s,o,e)}).next(e=>{o=e;const s=e.applyToLocalDocumentSet(i,B);return n.documentOverlayCache.saveOverlays(t,e.batchId,s)})}).then(()=>({batchId:o.batchId,changes:dd(i)}))}(s.localStore,e);s.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let s=t.dc[t.currentUser.toKey()];s||(s=new wl(dl)),s=s.insert(e,n),t.dc[t.currentUser.toKey()]=s}(s,t.batchId,n),await Jm(s,t.changes),await wm(s.remoteStore)}catch(t){const e=Rm(t,"Failed to persist write");n.reject(e)}}function Hm(t,e,n){const s=ll(t);if(s.isPrimaryClient&&0===n||!s.isPrimaryClient&&1===n){const t=[];s.Tc.forEach((n,s)=>{const r=s.view.xu(e);r.snapshot&&t.push(r.snapshot)}),function(t,e){const n=ll(t);n.onlineState=e;let s=!1;n.queries.forEach((t,n)=>{for(const t of n.bu)t.xu(e)&&(s=!0)}),s&&function(t){t.Du.forEach(t=>{t.next()})}(n)}(s.eventManager,e),t.length&&s.hc.Tn(t),s.onlineState=e,s.isPrimaryClient&&s.sharedClientState.setOnlineState(e)}}async function Um(t,e){const n=ll(t),s=e.batch.batchId;try{const t=await function(t,e){const n=ll(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",t=>{const s=e.batch.keys(),r=n.ko.newChangeBuffer({trackRemovals:!0});return function(t,e,n,s){const r=n.batch,i=r.keys();let o=Ip.resolve();return i.forEach(t=>{o=o.next(()=>s.getEntry(e,t)).next(e=>{const i=n.docVersions.get(t);cl(null!==i,48541),e.version.compareTo(i)<0&&(r.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),s.addEntry(e)))})}),o.next(()=>t.mutationQueue.removeMutationBatch(e,r))}(n,t,e,r).next(()=>r.apply(t)).next(()=>n.mutationQueue.performConsistencyCheck(t)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(t,s,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=wd();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e))).next(()=>n.localDocuments.getDocuments(t,s))})}(n.localStore,e);$m(n,s,null),jm(n,s),n.sharedClientState.updateMutationState(s,"acknowledged"),await Jm(n,t)}catch(t){await vp(t)}}async function Vm(t,e,n){const s=ll(t);try{const t=await function(t,e){const n=ll(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",t=>{let s;return n.mutationQueue.lookupMutationBatch(t,e).next(e=>(cl(null!==e,37113),s=e.keys(),n.mutationQueue.removeMutationBatch(t,e))).next(()=>n.mutationQueue.performConsistencyCheck(t)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(t,s,e)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,s)).next(()=>n.localDocuments.getDocuments(t,s))})}(s.localStore,e);$m(s,e,n),jm(s,e),s.sharedClientState.updateMutationState(e,"rejected",n),await Jm(s,t)}catch(n){await vp(n)}}function jm(t,e){(t.fc.get(e)||[]).forEach(t=>{t.resolve()}),t.fc.delete(e)}function $m(t,e,n){const s=ll(t);let r=s.dc[s.currentUser.toKey()];if(r){const t=r.get(e);t&&(n?t.reject(n):t.resolve(),r=r.remove(e)),s.dc[s.currentUser.toKey()]=r}}async function Jm(t,e,n){const s=ll(t),r=[],i=[],o=[];s.Tc.isEmpty()||(s.Tc.forEach((t,a)=>{o.push(s.yc(a,e,n).then(t=>{if((t||n)&&s.isPrimaryClient){const e=t?!t.fromCache:n?.targetChanges.get(a.targetId)?.current;s.sharedClientState.updateQueryState(a.targetId,e?"current":"not-current")}if(t){r.push(t);const e=rm.mo(a.targetId,t);i.push(e)}}))}),await Promise.all(o),s.hc.Tn(r),await async function(t,e){const n=ll(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",t=>Ip.forEach(e,e=>Ip.forEach(e.Vo,s=>n.persistence.referenceDelegate.addReference(t,e.targetId,s)).next(()=>Ip.forEach(e.fo,s=>n.persistence.referenceDelegate.removeReference(t,e.targetId,s)))))}catch(t){if(!Tp(t))throw t;sl("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.Lo.get(e),s=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(s);n.Lo=n.Lo.insert(e,r)}}}(s.localStore,i))}async function qm(t,e){const n=ll(t);if(!n.currentUser.isEqual(e)){sl("SyncEngine","User change. New user:",e.toKey());const t=await cm(n.localStore,e);n.currentUser=e,function(t,e){t.fc.forEach(t=>{t.forEach(t=>{t.reject(new vl(bl.CANCELLED,e))})}),t.fc.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await Jm(n,t.$o)}}class zm{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(t){this.serializer=Gd(t.databaseInfo.databaseId),this.sharedClientState=this.vc(t),this.persistence=this.Dc(t),await this.persistence.start(),this.localStore=this.xc(t),this.gcScheduler=this.Cc(t,this.localStore),this.indexBackfillerScheduler=this.Fc(t,this.localStore)}Cc(t,e){return null}Fc(t,e){return null}xc(t){return function(t,e,n,s){return new Bm(t,e,n,s)}(this.persistence,new am,t.initialUser,this.serializer)}Dc(t){return new tm(nm.b_,this.serializer)}vc(t){return new xm}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}zm.provider={build:()=>new zm};class Km extends zm{constructor(t){super(),this.cacheSizeBytes=t}Cc(t,e){cl(this.persistence.referenceDelegate instanceof sm,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new Rp(n,t.asyncQueue,e)}Dc(t){const e=void 0!==this.cacheSizeBytes?Dp.withCacheSize(this.cacheSizeBytes):Dp.DEFAULT;return new tm(t=>sm.b_(t,e),this.serializer)}}class Qm{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>Hm(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=qm.bind(null,this.syncEngine),await async function(t,e){const n=ll(t);e?(n.la.delete(2),await pm(n)):e||(n.la.add(2),await fm(n),n.Ta.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Lm}createDatastore(t){const e=Gd(t.databaseInfo.databaseId),n=function(t){return new hp(t)}(t.databaseInfo);return function(t,e,n,s){return new mp(t,e,n,s)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return function(t,e,n,s,r){return new dm(t,e,n,s,r)}(this.localStore,this.datastore,t.asyncQueue,t=>Hm(this.syncEngine,t,0),sp.Ye()?new sp:new ep)}createSyncEngine(t,e){return function(t,e,n,s,r,i,o){const a=new Mm(t,e,n,s,r,i);return o&&(a.gc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}async terminate(){await async function(t){const e=ll(t);sl(hm,"RemoteStore shutting down."),e.la.add(5),await fm(e),e.ha.shutdown(),e.Ta.set("Unknown")}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}Qm.provider={build:()=>new Qm};const Wm="FirestoreClient";class Ym{constructor(t,e,n,s,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this._databaseInfo=s,this.user=$d.UNAUTHENTICATED,this.clientId=hl.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=r,this.authCredentials.start(n,async t=>{sl(Wm,"Received user=",t.uid),await this.authCredentialListener(t),this.user=t}),this.appCheckCredentials.start(n,t=>(sl(Wm,"Received new app check token=",t),this.appCheckCredentialListener(t,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(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Jd;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=Rm(e,"Failed to shutdown persistence");t.reject(n)}}),t.promise}}async function Xm(t,e){t.asyncQueue.verifyOperationInProgress(),sl(Wm,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let s=n.initialUser;t.setCredentialChangeListener(async t=>{s.isEqual(t)||(await cm(e.localStore,t),s=t)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function Zm(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){sl(Wm,"Using user provided OfflineComponentProvider");try{await Xm(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(t){return"FirebaseError"===t.name?t.code===bl.FAILED_PRECONDITION||t.code===bl.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code}(n))throw n;il("Error using user provided cache. Falling back to memory cache: "+n),await Xm(t,new zm)}}else sl(Wm,"Using default OfflineComponentProvider"),await Xm(t,new Km(void 0));return t._offlineComponents}(t);sl(Wm,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(t=>Om(e.remoteStore,t)),t.setAppCheckTokenChangeListener((t,n)=>Om(e.remoteStore,n)),t._onlineComponents=e}function tw(t){return async function(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(sl(Wm,"Using user provided OnlineComponentProvider"),await Zm(t,t._uninitializedComponentsProvider._online)):(sl(Wm,"Using default OnlineComponentProvider"),await Zm(t,new Qm))),t._onlineComponents}(t).then(t=>t.syncEngine)}let ew=class{constructor(t,e,n,s,r){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=s,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new Gp(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new nw(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(t){if(this._document){const e=this._document.data.field(qp("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}},nw=class extends ew{data(){return super.data()}};const sw="AsyncQueue";class rw{constructor(t=Promise.resolve()){this.$c=[],this.Kc=!1,this.Qc=[],this.Wc=null,this.Gc=!1,this.zc=!1,this.jc=[],this.Ht=new dp(this,"async_queue_retry"),this.Hc=()=>{const t=km();t&&sl(sw,"Visibility state changed to "+t.visibilityState),this.Ht.$t()},this.Jc=t;const e=km();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.Hc)}get isShuttingDown(){return this.Kc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.Yc(),this.Zc(t)}enterRestrictedMode(t){if(!this.Kc){this.Kc=!0,this.zc=t||!1;const e=km();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Hc)}}enqueue(t){if(this.Yc(),this.Kc)return new Promise(()=>{});const e=new Jd;return this.Zc(()=>this.Kc&&this.zc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise)).then(()=>e.promise)}enqueueRetryable(t){this.enqueueAndForget(()=>(this.$c.push(t),this.Xc()))}async Xc(){if(0!==this.$c.length){try{await this.$c[0](),this.$c.shift(),this.Ht.reset()}catch(t){if(!Tp(t))throw t;sl(sw,"Operation failed with retryable error: "+t)}this.$c.length>0&&this.Ht.kt(()=>this.Xc())}}Zc(t){const e=this.Jc.then(()=>(this.Gc=!0,t().catch(t=>{throw this.Wc=t,this.Gc=!1,rl("INTERNAL UNHANDLED ERROR: ",iw(t)),t}).then(t=>(this.Gc=!1,t))));return this.Jc=e,e}enqueueAfterDelay(t,e,n){this.Yc(),this.jc.indexOf(t)>-1&&(e=0);const s=Sm.createAndSchedule(this,t,e,n,t=>this.el(t));return this.Qc.push(s),s}Yc(){this.Wc&&al(47125,{tl:iw(this.Wc)})}verifyOperationInProgress(){}async nl(){let t;do{t=this.Jc,await t}while(t!==this.Jc)}rl(t){for(const e of this.Qc)if(e.timerId===t)return!0;return!1}il(t){return this.nl().then(()=>{this.Qc.sort((t,e)=>t.targetTimeMs-e.targetTimeMs);for(const e of this.Qc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.nl()})}sl(t){this.jc.push(t)}el(t){const e=this.Qc.indexOf(t);this.Qc.splice(e,1)}}function iw(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}class ow extends Fp{constructor(t,e,n,s){super(t,e,n,s),this.type="firestore",this._queue=new rw,this._persistenceKey=s?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const t=this._firestoreClient.terminate();this._queue=new rw(t),this._firestoreClient=void 0,await t}}}function aw(t){if(t._terminated)throw new vl(bl.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||function(t){const e=t._freezeSettings(),n=function(t,e,n,s,r){return new ru(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,tp(r.experimentalLongPollingOptions),r.useFetchStreams,r.isUsingEmulator,s,r._customHeaders,r.grpcFlowControlWindow)}(t._databaseId,t._app?.options.appId||"",t._persistenceKey,t._app?.options.apiKey,e);t._componentsProvider||e.localCache?._offlineComponentProvider&&e.localCache?._onlineComponentProvider&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new Ym(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(t){const e=t?._online.build();return{_offline:t?._offline.build(e),_online:e}}(t._componentsProvider))}(t),t._firestoreClient}class Bw{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class cw extends ew{constructor(t,e,n,s,r,i){super(t,e,n,s,i),this._firestore=t,this._firestoreImpl=t,this.metadata=r}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new lw(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(qp("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new vl(bl.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t=this._document,e={};return e.type=cw._jsonSchemaVersion,e.bundle="",e.bundleSource="DocumentSnapshot",e.bundleName=this._key.toString(),t&&t.isValidDocument()&&t.isFoundDocument()?(this._userDataWriter.convertObjectMap(t.data.value.mapValue.fields,"previous"),e.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),e):e}}cw._jsonSchemaVersion="firestore/documentSnapshot/1.0",cw._jsonSchema={type:Hl("string",cw._jsonSchemaVersion),bundleSource:Hl("string","DocumentSnapshot"),bundleName:Hl("string"),bundle:Hl("string")};class lw extends cw{data(t={}){return super.data(t)}}class uw{constructor(t,e,n,s){this._firestore=t,this._userDataWriter=e,this._snapshot=s,this.metadata=new Bw(s.hasPendingWrites,s.fromCache),this.query=n}get docs(){const t=[];return this.forEach(e=>t.push(e)),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach(n=>{t.call(e,new lw(this._firestore,this._userDataWriter,n.key,n,new Bw(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new vl(bl.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map(n=>{bg(t._snapshot.query)?function(t){const e=function(t){for(let e=t.stages.length-1;e>=0;e--){const n=t.stages[e];if(n instanceof Tf)return n.orderings}throw new Error("Pipeline must contain at least one Sort stage")}(t)}(t._snapshot.query):sd(t.query._query);const s=new lw(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Bw(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:s,oldIndex:-1,newIndex:e++}})}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter(t=>e||3!==t.type).map(e=>{const s=new lw(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Bw(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let r=-1,i=-1;return 0!==e.type&&(r=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:hw(e.type),doc:s,oldIndex:r,newIndex:i}})}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new vl(bl.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t={};t.type=uw._jsonSchemaVersion,t.bundleSource="QuerySnapshot",t.bundleName=hl.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const e=[],n=[],s=[];return this.docs.forEach(t=>{null!==t._document&&(e.push(t._document),n.push(this._userDataWriter.convertObjectMap(t._document.data.value.mapValue.fields,"previous")),s.push(t.ref.path))}),t.bundle=(this._firestore,this.query._query,t.bundleName,"NOT SUPPORTED"),t}}function hw(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return al(61501,{type:t})}}function dw(t){return function(t,e){const n=aw(t);return function(t,e){const n=new Jd;return t.asyncQueue.enqueueAndForget(async()=>Gm(await tw(t),e,n)),n.promise}(n,e)}(Gl(t.firestore,ow),[new mh(t._key,ih.none())])}uw._jsonSchemaVersion="firestore/querySnapshot/1.0",uw._jsonSchema={type:Hl("string",uw._jsonSchemaVersion),bundleSource:Hl("string","QuerySnapshot"),bundleName:Hl("string"),bundle:Hl("string")};const pw="@firebase/firestore",fw="4.17.2";!function(t,e=!0){(function(t){tl=t})(_r),mr(new cs("firestore",(t,{instanceIdentifier:n,options:s})=>{const r=t.getProvider("app").getImmediate(),i=new ow(new Qd(t.getProvider("auth-internal")),new Zd(r,t.getProvider("app-check-internal")),au(r,n),r);return s={useFetchStreams:e,...s},i._setSettings(s),i},"PUBLIC").setMultipleInstances(!0)),Ir(pw,fw,t),Ir(pw,fw,"esm2020")}();const Cw="firebasestorage.googleapis.com",gw="storageBucket";class mw extends Wn{constructor(t,e,n=0){super(Ew(t),`Firebase Storage: ${e} (${Ew(t)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,mw.prototype)}get status(){return this.status_}set status(t){this.status_=t}_codeEquals(t){return Ew(t)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(t){this.customData.serverResponse=t,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}}var ww,yw;function Ew(t){return"storage/"+t}function Dw(){return new mw(ww.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function _w(){return new mw(ww.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function bw(){return new mw(ww.CANCELED,"User canceled the upload/download.")}function vw(){return new mw(ww.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Iw(t){return new mw(ww.INVALID_ARGUMENT,t)}function Tw(){return new mw(ww.APP_DELETED,"The Firebase app was deleted.")}function Ow(t,e){return new mw(ww.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function Aw(t){throw new mw(ww.INTERNAL_ERROR,"Internal error: "+t)}!function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"}(ww||(ww={}));class Sw{constructor(t,e){this.bucket=t,this.path_=e}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(t,e){let n;try{n=Sw.makeFromUrl(t,e)}catch(e){return new Sw(t,"")}if(""===n.path)return n;throw s=t,new mw(ww.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+s+"'.");var s}static makeFromUrl(t,e){let n=null;const s="([A-Za-z0-9.\\-_]+)";const r=new RegExp("^gs://"+s+"(/(.*))?$","i");function i(t){t.path_=decodeURIComponent(t.path)}const o=e.replace(/[.]/g,"\\."),a=[{regex:r,indices:{bucket:1,path:3},postModify:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path_=t.path_.slice(0,-1))}},{regex:new RegExp(`^https?://${o}/v[A-Za-z0-9_]+/b/${s}/o(/([^?#]*).*)?$`,"i"),indices:{bucket:1,path:3},postModify:i},{regex:new RegExp(`^https?://${e===Cw?"(?:storage.googleapis.com|storage.cloud.google.com)":e}/${s}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:i}];for(let e=0;e<a.length;e++){const s=a[e],r=s.regex.exec(t);if(r){const t=r[s.indices.bucket];let e=r[s.indices.path];e||(e=""),n=new Sw(t,e),s.postModify(n);break}}if(null==n)throw function(t){return new mw(ww.INVALID_URL,"Invalid URL '"+t+"'.")}(t);return n}}class Rw{constructor(t){this.promise_=Promise.reject(t)}getPromise(){return this.promise_}cancel(t=!1){}}function Nw(t){return"string"==typeof t||t instanceof String}function xw(t){return kw()&&t instanceof Blob}function kw(){return"undefined"!=typeof Blob}function Lw(t,e,n,s){if(s<e)throw Iw(`Invalid value for '${t}'. Expected ${e} or greater.`);if(s>n)throw Iw(`Invalid value for '${t}'. Expected ${n} or less.`)}function Fw(t,e,n){let s=e;return null==n&&(s=`https://${e}`),`${n}://${s}/v0${t}`}function Pw(t){const e=encodeURIComponent;let n="?";for(const s in t)if(t.hasOwnProperty(s)){n=n+(e(s)+"="+e(t[s]))+"&"}return n=n.slice(0,-1),n}function Mw(t,e){const n=t>=500&&t<600,s=-1!==[408,429].indexOf(t),r=-1!==e.indexOf(t);return n||s||r}!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(yw||(yw={}));class Gw{constructor(t,e,n,s,r,i,o,a,B,c,l,u=!0,h=!1){this.url_=t,this.method_=e,this.headers_=n,this.body_=s,this.successCodes_=r,this.additionalRetryCodes_=i,this.callback_=o,this.errorCallback_=a,this.timeout_=B,this.progressCallback_=c,this.connectionFactory_=l,this.retry=u,this.isUsingEmulator=h,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((t,e)=>{this.resolve_=t,this.reject_=e,this.start_()})}start_(){const t=(t,e)=>{if(e)return void t(!1,new Hw(!1,null,!0));const n=this.connectionFactory_();this.pendingConnection_=n;const s=t=>{const e=t.loaded,n=t.lengthComputable?t.total:-1;null!==this.progressCallback_&&this.progressCallback_(e,n)};null!==this.progressCallback_&&n.addUploadProgressListener(s),n.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(s),this.pendingConnection_=null;const e=n.getErrorCode()===yw.NO_ERROR,r=n.getStatus();if(!e||Mw(r,this.additionalRetryCodes_)&&this.retry){const e=n.getErrorCode()===yw.ABORT;return void t(!1,new Hw(!1,null,e))}const i=-1!==this.successCodes_.indexOf(r);t(!0,new Hw(i,n))})},e=(t,e)=>{const n=this.resolve_,s=this.reject_,r=e.connection;if(e.wasSuccessCode)try{const t=this.callback_(r,r.getResponse());!function(t){return void 0!==t}(t)?n():n(t)}catch(t){s(t)}else if(null!==r){const t=Dw();t.serverResponse=r.getErrorText(),this.errorCallback_?s(this.errorCallback_(r,t)):s(t)}else if(e.canceled){s(this.appDelete_?Tw():bw())}else{s(_w())}};this.canceled_?e(0,new Hw(!1,null,!0)):this.backoffId_=function(t,e,n){let s=1,r=null,i=null,o=!1,a=0;function B(){return 2===a}let c=!1;function l(...t){c||(c=!0,e.apply(null,t))}function u(e){r=setTimeout(()=>{r=null,t(d,B())},e)}function h(){i&&clearTimeout(i)}function d(t,...e){if(c)return void h();if(t)return h(),void l.call(null,t,...e);if(B()||o)return h(),void l.call(null,t,...e);let n;s<64&&(s*=2),1===a?(a=2,n=0):n=1e3*(s+Math.random()),u(n)}let p=!1;function f(t){p||(p=!0,h(),c||(null!==r?(t||(a=2),clearTimeout(r),u(0)):t||(a=1)))}return u(0),i=setTimeout(()=>{o=!0,f(!0)},n),f}(t,e,this.timeout_)}getPromise(){return this.promise_}cancel(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class Hw{constructor(t,e,n){this.wasSuccessCode=t,this.connection=e,this.canceled=!!n}}function Uw(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function Vw(...t){const e=Uw();if(void 0!==e){const n=new e;for(let e=0;e<t.length;e++)n.append(t[e]);return n.getBlob()}if(kw())return new Blob(t);throw new mw(ww.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}function jw(t){if("undefined"==typeof atob)throw e="base-64",new mw(ww.UNSUPPORTED_ENVIRONMENT,`${e} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);var e;return atob(t)}const $w="raw",Jw="base64",qw="base64url",zw="data_url";class Kw{constructor(t,e){this.data=t,this.contentType=e||null}}function Qw(t,e){switch(t){case $w:return new Kw(Ww(e));case Jw:case qw:return new Kw(Yw(t,e));case zw:return new Kw(function(t){const e=new Xw(t);return e.base64?Yw(Jw,e.rest):function(t){let e;try{e=decodeURIComponent(t)}catch(t){throw Ow(zw,"Malformed data URL.")}return Ww(e)}(e.rest)}(e),new Xw(e).contentType)}throw Dw()}function Ww(t){const e=[];for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);if(s<=127)e.push(s);else if(s<=2047)e.push(192|s>>6,128|63&s);else if(55296==(64512&s)){if(n<t.length-1&&56320==(64512&t.charCodeAt(n+1))){s=65536|(1023&s)<<10|1023&t.charCodeAt(++n),e.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|63&s)}else e.push(239,191,189)}else 56320==(64512&s)?e.push(239,191,189):e.push(224|s>>12,128|s>>6&63,128|63&s)}return new Uint8Array(e)}function Yw(t,e){switch(t){case Jw:{const n=-1!==e.indexOf("-"),s=-1!==e.indexOf("_");if(n||s){throw Ow(t,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?")}break}case qw:{const n=-1!==e.indexOf("+"),s=-1!==e.indexOf("/");if(n||s){throw Ow(t,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?")}e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=jw(e)}catch(e){if(e.message.includes("polyfill"))throw e;throw Ow(t,"Invalid character found")}const s=new Uint8Array(n.length);for(let t=0;t<n.length;t++)s[t]=n.charCodeAt(t);return s}class Xw{constructor(t){this.base64=!1,this.contentType=null;const e=t.match(/^data:([^,]+)?,/);if(null===e)throw Ow(zw,"Must be formatted 'data:[<mediatype>][;base64],<data>");const n=e[1]||null;null!=n&&(this.base64=function(t,e){const n=t.length>=e.length;if(!n)return!1;return t.substring(t.length-e.length)===e}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=t.substring(t.indexOf(",")+1)}}class Zw{constructor(t,e){let n=0,s="";xw(t)?(this.data_=t,n=t.size,s=t.type):t instanceof ArrayBuffer?(e?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),n=this.data_.length):t instanceof Uint8Array&&(e?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),n=t.length),this.size_=n,this.type_=s}size(){return this.size_}type(){return this.type_}slice(t,e){if(xw(this.data_)){const n=function(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}(this.data_,t,e);return null===n?null:new Zw(n)}{const n=new Uint8Array(this.data_.buffer,t,e-t);return new Zw(n,!0)}}static getBlob(...t){if(kw()){const e=t.map(t=>t instanceof Zw?t.data_:t);return new Zw(Vw.apply(null,e))}{const e=t.map(t=>Nw(t)?Qw($w,t).data:t.data_);let n=0;e.forEach(t=>{n+=t.byteLength});const s=new Uint8Array(n);let r=0;return e.forEach(t=>{for(let e=0;e<t.length;e++)s[r++]=t[e]}),new Zw(s,!0)}}uploadData(){return this.data_}}function ty(t){let e;try{e=JSON.parse(t)}catch(t){return null}return function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?e:null}function ey(t){const e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function ny(t,e){return e}class sy{constructor(t,e,n,s){this.server=t,this.local=e||t,this.writable=!!n,this.xform=s||ny}}let ry=null;function iy(){if(ry)return ry;const t=[];t.push(new sy("bucket")),t.push(new sy("generation")),t.push(new sy("metageneration")),t.push(new sy("name","fullPath",!0));const e=new sy("name");e.xform=function(t,e){return function(t){return!Nw(t)||t.length<2?t:ey(t)}(e)},t.push(e);const n=new sy("size");return n.xform=function(t,e){return void 0!==e?Number(e):e},t.push(n),t.push(new sy("timeCreated")),t.push(new sy("updated")),t.push(new sy("md5Hash",null,!0)),t.push(new sy("cacheControl",null,!0)),t.push(new sy("contentDisposition",null,!0)),t.push(new sy("contentEncoding",null,!0)),t.push(new sy("contentLanguage",null,!0)),t.push(new sy("contentType",null,!0)),t.push(new sy("metadata","customMetadata",!0)),ry=t,ry}function oy(t,e,n){const s={type:"file"},r=n.length;for(let t=0;t<r;t++){const r=n[t];s[r.local]=r.xform(s,e[r.server])}return function(t,e){Object.defineProperty(t,"ref",{get:function(){const n=t.bucket,s=t.fullPath,r=new Sw(n,s);return e._makeStorageReference(r)}})}(s,t),s}function ay(t,e,n){const s=ty(e);if(null===s)return null;return oy(t,s,n)}function By(t,e){const n={},s=e.length;for(let r=0;r<s;r++){const s=e[r];s.writable&&(n[s.server]=t[s.local])}return JSON.stringify(n)}const cy="prefixes",ly="items";function uy(t,e,n){const s=ty(n);if(null===s)return null;return function(t,e,n){const s={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n[cy])for(const r of n[cy]){const n=r.replace(/\/$/,""),i=t._makeStorageReference(new Sw(e,n));s.prefixes.push(i)}if(n[ly])for(const r of n[ly]){const n=t._makeStorageReference(new Sw(e,r.name));s.items.push(n)}return s}(t,e,s)}class hy{constructor(t,e,n,s){this.url=t,this.method=e,this.handler=n,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function dy(t){if(!t)throw Dw()}function py(t,e){return function(n,s){const r=ay(t,s,e);return dy(null!==r),r}}function fy(t,e){return function(n,s){const r=ay(t,s,e);return dy(null!==r),function(t,e,n,s){const r=ty(e);if(null===r)return null;if(!Nw(r.downloadTokens))return null;const i=r.downloadTokens;if(0===i.length)return null;const o=encodeURIComponent;return i.split(",").map(e=>{const r=t.bucket,i=t.fullPath;return Fw("/b/"+o(r)+"/o/"+o(i),n,s)+Pw({alt:"media",token:e})})[0]}(r,s,t.host,t._protocol)}}function Cy(t){return function(e,n){let s;var r,i;return 401===e.getStatus()?s=e.getErrorText().includes("Firebase App Check token is invalid")?new mw(ww.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new mw(ww.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===e.getStatus()?(i=t.bucket,s=new mw(ww.QUOTA_EXCEEDED,"Quota for bucket '"+i+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===e.getStatus()?(r=t.path,s=new mw(ww.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):s=n,s.status=e.getStatus(),s.serverResponse=n.serverResponse,s}}function gy(t){const e=Cy(t);return function(n,s){let r=e(n,s);var i;return 404===n.getStatus()&&(i=t.path,r=new mw(ww.OBJECT_NOT_FOUND,"Object '"+i+"' does not exist.")),r.serverResponse=s.serverResponse,r}}function my(t,e,n,s,r){const i={};e.isRoot?i.prefix="":i.prefix=e.path+"/",n.length>0&&(i.delimiter=n),s&&(i.pageToken=s),r&&(i.maxResults=r);const o=Fw(e.bucketOnlyServerUrl(),t.host,t._protocol),a=t.maxOperationRetryTime,B=new hy(o,"GET",function(t,e){return function(n,s){const r=uy(t,e,s);return dy(null!==r),r}}(t,e.bucket),a);return B.urlParams=i,B.errorHandler=Cy(e),B}function wy(t,e,n){const s=Object.assign({},n);return s.fullPath=t.path,s.size=e.size(),s.contentType||(s.contentType=function(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}(null,e)),s}class yy{constructor(t,e,n,s){this.current=t,this.total=e,this.finalized=!!n,this.metadata=s||null}}function Ey(t,e){let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){dy(!1)}return dy(!!n&&-1!==(e||["active"]).indexOf(n)),n}const Dy=262144;function _y(t,e,n,s,r,i,o,a){const B=new yy(0,0);if(o?(B.current=o.current,B.total=o.total):(B.current=0,B.total=s.size()),s.size()!==B.total)throw new mw(ww.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");const c=B.total-B.current;let l=c;r>0&&(l=Math.min(l,r));const u=B.current,h=u+l;let d="";d=0===l?"finalize":c===l?"upload, finalize":"upload";const p={"X-Goog-Upload-Command":d,"X-Goog-Upload-Offset":`${B.current}`},f=s.slice(u,h);if(null===f)throw vw();const C=e.maxUploadRetryTime,g=new hy(n,"POST",function(t,n){const r=Ey(t,["active","final"]),o=B.current+l,a=s.size();let c;return c="final"===r?py(e,i)(t,n):null,new yy(o,a,"final"===r,c)},C);return g.headers=p,g.body=f.uploadData(),g.progressCallback=a||null,g.errorHandler=Cy(t),g}const by="running",vy="paused",Iy="success",Ty="canceled",Oy="error";function Ay(t){switch(t){case"running":case"pausing":case"canceling":return by;case"paused":return vy;case"success":return Iy;case"canceled":return Ty;default:return Oy}}class Sy{constructor(t,e,n){const s=function(t){return"function"==typeof t}(t)||null!=e||null!=n;if(s)this.next=t,this.error=e??void 0,this.complete=n??void 0;else{const e=t;this.next=e.next,this.error=e.error,this.complete=e.complete}}}function Ry(t){return(...e)=>{Promise.resolve().then(()=>t(...e))}}class Ny{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=yw.NO_ERROR,this.sendPromise_=new Promise(t=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=yw.ABORT,t()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=yw.NETWORK_ERROR,t()}),this.xhr_.addEventListener("load",()=>{t()})})}send(t,e,n,s,r){if(this.sent_)throw Aw("cannot .send() more than once");if(as(t)&&n&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(e,t,!0),void 0!==r)for(const t in r)r.hasOwnProperty(t)&&this.xhr_.setRequestHeader(t,r[t].toString());return void 0!==s?this.xhr_.send(s):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Aw("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Aw("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}}getResponse(){if(!this.sent_)throw Aw("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Aw("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(t){return this.xhr_.getResponseHeader(t)}addUploadProgressListener(t){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",t)}removeUploadProgressListener(t){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",t)}}class xy extends Ny{initXhr(){this.xhr_.responseType="text"}}function ky(){return new xy}class Ly{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(t,e,n=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=t,this._blob=e,this._metadata=n,this._mappings=iy(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=t=>{if(this._request=void 0,this._chunkMultiplier=1,t._codeEquals(ww.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const e=this.isExponentialBackoffExpired();if(Mw(t.status,[])){if(!e)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();t=_w()}this._error=t,this._transition("error")}},this._metadataErrorHandler=t=>{this._request=void 0,t._codeEquals(ww.CANCELED)?this.completeTransitions_():(this._error=t,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((t,e)=>{this._resolve=t,this._reject=e,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){const t=this._transferred;return e=>this._updateProgress(t+e)}_shouldDoResumable(t){return t.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(t){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([e,n])=>{switch(this._state){case"running":t(e,n);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}})}_createResumable(){this._resolveToken((t,e)=>{const n=function(t,e,n,s,r){const i=e.bucketOnlyServerUrl(),o=wy(e,s,r),a={name:o.fullPath},B=Fw(i,t.host,t._protocol),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${s.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},l=By(o,n),u=t.maxUploadRetryTime,h=new hy(B,"POST",function(t){let e;Ey(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){dy(!1)}return dy(Nw(e)),e},u);return h.urlParams=a,h.headers=c,h.body=l,h.errorHandler=Cy(e),h}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(n,ky,t,e);this._request=s,s.getPromise().then(t=>{this._request=void 0,this._uploadUrl=t,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const t=this._uploadUrl;this._resolveToken((e,n)=>{const s=function(t,e,n,s){const r=t.maxUploadRetryTime,i=new hy(n,"POST",function(t){const e=Ey(t,["active","final"]);let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){dy(!1)}n||dy(!1);const r=Number(n);return dy(!isNaN(r)),new yy(r,s.size(),"final"===e)},r);return i.headers={"X-Goog-Upload-Command":"query"},i.errorHandler=Cy(e),i}(this._ref.storage,this._ref._location,t,this._blob),r=this._ref.storage._makeRequest(s,ky,e,n);this._request=r,r.getPromise().then(t=>{this._request=void 0,this._updateProgress(t.current),this._needToFetchStatus=!1,t.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const t=Dy*this._chunkMultiplier,e=new yy(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken((s,r)=>{let i;try{i=_y(this._ref._location,this._ref.storage,n,this._blob,t,this._mappings,e,this._makeProgressCallback())}catch(t){return this._error=t,void this._transition("error")}const o=this._ref.storage._makeRequest(i,ky,s,r,!1);this._request=o,o.getPromise().then(t=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(t.current),t.finalized?(this._metadata=t.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){2*(Dy*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((t,e)=>{const n=function(t,e,n){const s=Fw(e.fullServerUrl(),t.host,t._protocol),r=t.maxOperationRetryTime,i=new hy(s,"GET",py(t,n),r);return i.errorHandler=gy(e),i}(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(n,ky,t,e);this._request=s,s.getPromise().then(t=>{this._request=void 0,this._metadata=t,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((t,e)=>{const n=function(t,e,n,s,r){const i=e.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"},a=function(){let t="";for(let e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();o["Content-Type"]="multipart/related; boundary="+a;const B=wy(e,s,r),c="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+By(B,n)+"\r\n--"+a+"\r\nContent-Type: "+B.contentType+"\r\n\r\n",l="\r\n--"+a+"--",u=Zw.getBlob(c,s,l);if(null===u)throw vw();const h={name:B.fullPath},d=Fw(i,t.host,t._protocol),p=t.maxUploadRetryTime,f=new hy(d,"POST",py(t,n),p);return f.urlParams=h,f.headers=o,f.body=u.uploadData(),f.errorHandler=Cy(e),f}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(n,ky,t,e);this._request=s,s.getPromise().then(t=>{this._request=void 0,this._metadata=t,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(t){const e=this._transferred;this._transferred=t,this._transferred!==e&&this._notifyObservers()}_transition(t){if(this._state!==t)switch(t){case"canceling":case"pausing":this._state=t,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const e="paused"===this._state;this._state=t,e&&(this._notifyObservers(),this._start());break;case"paused":case"error":case"success":this._state=t,this._notifyObservers();break;case"canceled":this._error=bw(),this._state=t,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 t=Ay(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:t,metadata:this._metadata,task:this,ref:this._ref}}on(t,e,n,s){const r=new Sy(e||void 0,n||void 0,s||void 0);return this._addObserver(r),()=>{this._removeObserver(r)}}then(t,e){return this._promise.then(t,e)}catch(t){return this.then(null,t)}_addObserver(t){this._observers.push(t),this._notifyObserver(t)}_removeObserver(t){const e=this._observers.indexOf(t);-1!==e&&this._observers.splice(e,1)}_notifyObservers(){this._finishPromise();this._observers.slice().forEach(t=>{this._notifyObserver(t)})}_finishPromise(){if(void 0!==this._resolve){let t=!0;switch(Ay(this._state)){case Iy:Ry(this._resolve.bind(null,this.snapshot))();break;case Ty:case Oy:Ry(this._reject.bind(null,this._error))();break;default:t=!1}t&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(t){switch(Ay(this._state)){case by:case vy:t.next&&Ry(t.next.bind(t,this.snapshot))();break;case Iy:t.complete&&Ry(t.complete.bind(t))();break;default:t.error&&Ry(t.error.bind(t,this._error))()}}resume(){const t="paused"===this._state||"pausing"===this._state;return t&&this._transition("running"),t}pause(){const t="running"===this._state;return t&&this._transition("pausing"),t}cancel(){const t="running"===this._state||"pausing"===this._state;return t&&this._transition("canceling"),t}}class Fy{constructor(t,e){this._service=t,this._location=e instanceof Sw?e:Sw.makeFromUrl(e,t.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(t,e){return new Fy(t,e)}get root(){const t=new Sw(this._location.bucket,"");return this._newRef(this._service,t)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return ey(this._location.path)}get storage(){return this._service}get parent(){const t=function(t){if(0===t.length)return null;const e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}(this._location.path);if(null===t)return null;const e=new Sw(this._location.bucket,t);return new Fy(this._service,e)}_throwIfRoot(t){if(""===this._location.path)throw function(t){return new mw(ww.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(t)}}function Py(t){const e={prefixes:[],items:[]};return My(t,e).then(()=>e)}async function My(t,e,n){const s={pageToken:n},r=await function(t,e){null!=e&&"number"==typeof e.maxResults&&Lw("options.maxResults",1,1e3,e.maxResults);const n=e||{},s=my(t.storage,t._location,"/",n.pageToken,n.maxResults);return t.storage.makeRequestWithTokens(s,ky)}(t,s);e.prefixes.push(...r.prefixes),e.items.push(...r.items),null!=r.nextPageToken&&await My(t,e,r.nextPageToken)}function Gy(t){t._throwIfRoot("getDownloadURL");const e=function(t,e,n){const s=Fw(e.fullServerUrl(),t.host,t._protocol),r=t.maxOperationRetryTime,i=new hy(s,"GET",fy(t,n),r);return i.errorHandler=gy(e),i}(t.storage,t._location,iy());return t.storage.makeRequestWithTokens(e,ky).then(t=>{if(null===t)throw new mw(ww.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return t})}function Hy(t){t._throwIfRoot("deleteObject");const e=function(t,e){const n=Fw(e.fullServerUrl(),t.host,t._protocol),s=t.maxOperationRetryTime,r=new hy(n,"DELETE",function(t,e){},s);return r.successCodes=[200,204],r.errorHandler=gy(e),r}(t.storage,t._location);return t.storage.makeRequestWithTokens(e,ky)}function Uy(t,e){if(t instanceof $y){const n=t;if(null==n._bucket)throw new mw(ww.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+gw+"' property when initializing the app?");const s=new Fy(n,n._bucket);return null!=e?Uy(s,e):s}return void 0!==e?function(t,e){const n=function(t,e){const n=e.split("/").filter(t=>t.length>0).join("/");return 0===t.length?n:t+"/"+n}(t._location.path,e),s=new Sw(t._location.bucket,n);return new Fy(t.storage,s)}(t,e):t}function Vy(t,e){if(e&&/^[A-Za-z]+:\/\//.test(e)){if(t instanceof $y)return new Fy(t,e);throw Iw("To use ref(service, url), the first argument must be a Storage instance.")}return Uy(t,e)}function jy(t,e){const n=e?.[gw];return null==n?null:Sw.makeFromBucketSpec(n,t)}class $y{constructor(t,e,n,s,r,i=!1){this.app=t,this._authProvider=e,this._appCheckProvider=n,this._url=s,this._firebaseVersion=r,this._isUsingEmulator=i,this._bucket=null,this._host=Cw,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=s?Sw.makeFromBucketSpec(s,this._host):jy(this._host,this.app.options)}get host(){return this._host}set host(t){this._host=t,null!=this._url?this._bucket=Sw.makeFromBucketSpec(this._url,t):this._bucket=jy(t,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(t){Lw("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(t){Lw("time",0,Number.POSITIVE_INFINITY,t),this._maxOperationRetryTime=t}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const t=this._authProvider.getImmediate({optional:!0});if(t){const e=await t.getToken();if(null!==e)return e.accessToken}return null}async _getAppCheckToken(){if(yr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=this._appCheckProvider.getImmediate({optional:!0});if(t){return(await t.getToken()).token}return null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(t=>t.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(t){return new Fy(this,t)}_makeRequest(t,e,n,s,r=!0){if(this._deleted)return new Rw(Tw());{const i=function(t,e,n,s,r,i,o=!0,a=!1){const B=Pw(t.urlParams),c=t.url+B,l=Object.assign({},t.headers);return function(t,e){e&&(t["X-Firebase-GMPID"]=e)}(l,e),function(t,e){null!==e&&e.length>0&&(t.Authorization="Firebase "+e)}(l,n),function(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}(l,i),function(t,e){null!==e&&(t["X-Firebase-AppCheck"]=e)}(l,s),new Gw(c,t.method,l,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,r,o,a)}(t,this._appId,n,s,e,this._firebaseVersion,r,this._isUsingEmulator);return this._requests.add(i),i.getPromise().then(()=>this._requests.delete(i),()=>this._requests.delete(i)),i}}async makeRequestWithTokens(t,e){const[n,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(t,e,n,s).getPromise()}}const Jy="@firebase/storage",qy="0.14.5",zy="storage";function Ky(t,e,n){return function(t,e,n){return t._throwIfRoot("uploadBytesResumable"),new Ly(t,new Zw(e),n)}(t=os(t),e,n)}function Qy(t){return Py(t=os(t))}function Wy(t){return Hy(t=os(t))}function Yy(t,e){return Vy(t=os(t),e)}function Xy(t=vr(),e){const n=wr(t=os(t),zy).getImmediate({identifier:e}),s=Gn("storage");return s&&function(t,e,n,s={}){!function(t,e,n,s={}){t.host=`${e}:${n}`;const r=as(e);r&&Bs(`https://${t.host}/b`),t._isUsingEmulator=!0,t._protocol=r?"https":"http";const{mockUserToken:i}=s;i&&(t._overrideAuthToken="string"==typeof i?i:jn(i,t.app.options.projectId))}(t,e,n,s)}(n,...s),n}function Zy(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),s=t.getProvider("auth-internal"),r=t.getProvider("app-check-internal");return new $y(n,s,r,e,_r)}mr(new cs(zy,Zy,"PUBLIC").setMultipleInstances(!0)),Ir(Jy,qy,""),Ir(Jy,qy,"esm2020");let tE,eE,nE,sE,rE={},iE=null,oE=!1;const aE=[];let BE;function cE(){return BE}function lE(){return oE}function uE(t){oE?t():aE.push(t)}function hE(){const t="undefined"==typeof process?void 0:process.env,e=t?.FIREBASE_CONFIG;if(!e)return null;const n=JSON.parse(e);return n&&n.apiKey?n:null}function dE(t){if(t&&Object.prototype.hasOwnProperty.call(t,"actionCodeSettings")&&(BE=t.actionCodeSettings),oE){if(t?.app&&t.app!==tE)throw new Error("pwa-auth: Firebase app is already set");return tE}if(t?.app)tE=t.app,rE=tE.options;else{const e=t?.config??hE();if(!e)throw new Error("pwa-auth: pass initialize({ config }) or set window.process.env.FIREBASE_CONFIG");rE=e,tE=br(rE)}return eE=function(t){const e="object"==typeof t?t:vr(),n="string"==typeof t?t:iu,s=wr(e,"firestore").getImmediate({identifier:n});if(!s._initialized){const t=Gn("firestore");t&&Pp(s,...t)}return s}(tE),nE=Xy(tE),sE=nB(tE),iE=sE.currentUser,oE=!0,aE.splice(0).forEach(t=>t()),tE}const pE=hE();pE&&dE({config:pE});const fE={bubbles:!0,composed:!0};function CE(t){return t?{uid:t.uid,displayName:t.displayName,email:t.email,photoURL:t.photoURL,emailVerified:!0===t.emailVerified}:null}function gE(t,e){window.dispatchEvent(new CustomEvent(t,{...fE,detail:e}))}function mE(t){if("object"==typeof t&&null!==t&&"code"in t){const e=String(t.code);return{code:e,message:t instanceof Error?t.message:e}}return{code:"pwa/unknown",message:t instanceof Error?t.message:"Authentication failed"}}const wE=new Set(["auth/popup-closed-by-user","auth/cancelled-popup-request","auth/user-cancelled"]);let yE=null,EE=!1;function DE(){const t=yE;return yE=null,t}function _E(){return new vo}async function bE(t){if(function(t){return/Android|iPhone|iPad|iPod/i.test(t)}("undefined"==typeof navigator?"":navigator.userAgent))return await ba(sE,_E()),"redirect";try{return await async function(t,e,n){if(yr(t.app))return Promise.reject($r(t,"operation-not-supported-in-this-environment"));const s=Yi(t);zr(t,e,Do);const r=ua(s,n);return new ma(s,"signInViaPopup",e,r).executeNotNull()}(sE,_E()),"ok"}catch(t){const e=mE(t).code;if(wE.has(e))return"quiet";if("auth/popup-blocked"===e)return await ba(sE,_E()),"redirect";throw t}}function vE(){EE||(EE=!0,uE(()=>{(async function(t,e){return await Yi(t)._initializationPromise,va(t,e,!1)})(sE).catch(t=>{!function(t){yE=mE(t)}(t)})}))}const IE="pwa-auth-changed",TE="pwa-login",OE="pwa-logout",AE="pwa-signup",SE="pwa-account-deleted",RE="pwa-profile-updated",NE="pwa-email-changed",xE="pwa-password-changed",kE="pwa-reset-sent",LE="pwa-drawer-toggle",FE="pwa-settings",PE="pwa-auth-error",ME="pwa-verification-sent",GE="pwa-email-verified",HE={authChanged:IE,login:TE,logout:OE,signup:AE,accountDeleted:SE,profileUpdated:RE,emailChanged:NE,passwordChanged:xE,resetSent:kE,drawerToggle:LE,settings:FE,authError:PE,verificationSent:ME,emailVerified:GE},UE=128,VE="At least 8 characters. A passphrase works well.",jE="Use at least 8 characters.",$E="Use at most 128 characters.",JE="Passwords don't match.";function qE(t){return t.length<8?{code:"pwa/short-password",message:jE}:t.length>UE?{code:"pwa/long-password",message:$E}:null}const zE={"auth/invalid-email":"Enter a valid email address.","auth/user-not-found":"No account uses that email.","auth/wrong-password":"That password is wrong.","auth/invalid-credential":"That email or password is wrong.","auth/invalid-login-credentials":"That email or password is wrong.","auth/user-token-expired":"This account is no longer available.","auth/invalid-user-token":"This account is no longer available.","auth/user-disabled":"This account is disabled.","auth/email-already-in-use":"An account already uses that email.","auth/account-exists-with-different-credential":"That email already has an account. Sign in with email and password.","auth/weak-password":jE,"auth/too-many-requests":"Too many tries. Wait and try again.","auth/network-request-failed":"Network problem. Try again.","auth/requires-recent-login":"Sign in again, then retry.","pwa/missing-email":"Enter an email address.","pwa/invalid-email":"Enter a valid email address.","pwa/missing-password":"Enter a password.","pwa/short-password":jE,"pwa/long-password":$E,"pwa/current-password":"Enter your current password.","pwa/password-mismatch":JE,"pwa/weak-password":jE,"pwa/signed-out":"Sign in first.","pwa/missing-file":"Choose a photo first.","pwa/not-image":"Choose an image file.","pwa/photo-too-large":"Choose an image under 5 MB.","pwa/photo-unreadable":"That image could not be prepared. Try another.","pwa/not-ready":"Sign-in is not ready yet.","pwa/unknown":"Something went wrong. Try again."};function KE(t){const e=mE(t);return zE[e.code]??"Something went wrong. Try again."}const QE=i`
|
|
199
|
+
`,Dn=function(t){const e=[];let n=0;for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):55296==(64512&r)&&s+1<t.length&&56320==(64512&t.charCodeAt(s+1))?(r=65536+((1023&r)<<10)+(1023&t.charCodeAt(++s)),e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e},bn={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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let e=0;e<t.length;e+=3){const r=t[e],i=e+1<t.length,o=i?t[e+1]:0,a=e+2<t.length,B=a?t[e+2]:0,c=r>>2,l=(3&r)<<4|o>>4;let u=(15&o)<<2|B>>6,h=63&B;a||(h=64,i||(u=64)),s.push(n[c],n[l],n[u],n[h])}return s.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Dn(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,s=0;for(;n<t.length;){const r=t[n++];if(r<128)e[s++]=String.fromCharCode(r);else if(r>191&&r<224){const i=t[n++];e[s++]=String.fromCharCode((31&r)<<6|63&i)}else if(r>239&&r<365){const i=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[s++]=String.fromCharCode(55296+(i>>10)),e[s++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[s++]=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let e=0;e<t.length;){const r=n[t.charAt(e++)],i=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==r||null==i||null==o||null==a)throw new vn;const B=r<<2|i>>4;if(s.push(B),64!==o){const t=i<<4&240|o>>2;if(s.push(t),64!==a){const t=o<<6&192|a;s.push(t)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class vn extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const In=function(t){return function(t){const e=Dn(t);return bn.encodeByteArray(e,!0)}(t).replace(/\./g,"")},Tn=function(t){try{return bn.decodeString(t,!0)}catch(t){}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__,An=()=>{try{return On()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&Tn(t[1]);return e&&JSON.parse(e)})()}catch(t){return}},Sn=t=>An()?.emulatorHosts?.[t],Rn=t=>{const e=Sn(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const s=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),s]:[e.substring(0,n),s]},Nn=()=>An()?.config,xn=t=>An()?.[`_${t}`];class kn{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}wrapCallback(t){return(e,n)=>{e?this.reject(e):this.resolve(n),"function"==typeof t&&(this.promise.catch(()=>{}),1===t.length?t(e):t(e,n))}}}function Ln(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",s=t.iat||0,r=t.sub||t.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i={iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}},...t};return[In(JSON.stringify({alg:"none",type:"JWT"})),In(JSON.stringify(i)),""].join(".")}function Fn(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function Pn(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}function Mn(){return!function(){const t=An()?.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(t){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Gn(){try{return"object"==typeof indexedDB}catch(t){return!1}}function Hn(){return new Promise((t,e)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(s),t(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{e(r.error?.message||"")}}catch(t){e(t)}})}function Un(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class Vn extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,Vn.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,jn.prototype.create)}}class jn{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},s=`${this.service}/${t}`,r=this.errors[t],i=r?function(t,e){try{let n=0,s="";for(;n<t.length;){const r=t.indexOf("{$",n);if(-1===r){s+=t.substring(n);break}const i=t.indexOf("}",r+2);if(-1===i){s+=t.substring(n);break}const o=t.substring(r+2,i),a=e[o];s+=t.substring(n,r)+(null!=a?String(a):`<${o}?>`),n=i+1}return s}catch(e){return t}}(r,n):"Error",o=`${this.serviceName}: ${i} (${s}).`;return new Vn(s,o,n)}}function $n(t,e){if(t===e)return!0;const n=Object.keys(t),s=Object.keys(e);for(const r of n){if(!s.includes(r))return!1;const n=t[r],i=e[r];if(Jn(n)&&Jn(i)){if(!$n(n,i))return!1}else if(n!==i)return!1}for(const t of s)if(!n.includes(t))return!1;return!0}function Jn(t){return null!==t&&"object"==typeof t}function qn(t){const e=[];for(const[n,s]of Object.entries(t))Array.isArray(s)?s.forEach(t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(s));return e.length?"&"+e.join("&"):""}function zn(t){const e={};return t.replace(/^\?/,"").split("&").forEach(t=>{if(t){const[n,s]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(s)}}),e}function Kn(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class Qn{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(()=>{t(this)}).catch(t=>{this.error(t)})}next(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,e,n){let s;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");s=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===s.next&&(s.next=Wn),void 0===s.error&&(s.error=Wn),void 0===s.complete&&(s.complete=Wn);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch(t){}}),this.observers.push(s),r}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error}})}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Wn(){}function Yn(t,e=1e3,n=2){const s=e*Math.pow(n,t),r=Math.round(.5*s*(Math.random()-.5)*2);return Math.min(144e5,s+r)}function Xn(t){return t&&t._delegate?t._delegate:t}function Zn(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function ts(t){return(await fetch(t,{credentials:"include"})).ok}class es{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}const ns="[DEFAULT]";class ss{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new kn;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){const e=this.normalizeInstanceIdentifier(t?.identifier),n=t?.optional??!1;if(!this.isInitialized(e)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:e})}catch(t){if(n)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}(t))try{this.getOrInitializeService({instanceIdentifier:ns})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=ns){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...t.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return null!=this.component}isInitialized(t=ns){return this.instances.has(t)}getOptions(t=ns){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.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 s=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(s)}return s}onInit(t,e){const n=this.normalizeInstanceIdentifier(e),s=this.onInitCallbacks.get(n)??new Set;s.add(t),this.onInitCallbacks.set(n,s);const r=this.instances.get(n);return r&&t(r,n),()=>{s.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const s of n)try{s(t,e)}catch{}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=t,s===ns?void 0:s),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch{}var s;return n||null}normalizeInstanceIdentifier(t=ns){return this.component?this.component.multipleInstances?t:ns:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class rs{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new ss(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}var is;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(is||(is={}));const os={debug:is.DEBUG,verbose:is.VERBOSE,info:is.INFO,warn:is.WARN,error:is.ERROR,silent:is.SILENT},as=is.INFO,Bs={[is.DEBUG]:"log",[is.VERBOSE]:"log",[is.INFO]:"info",[is.WARN]:"warn",[is.ERROR]:"error"},cs=(t,e,...n)=>{if(e<t.logLevel)return;(new Date).toISOString();if(!Bs[e])throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class ls{constructor(t){this.name=t,this._logLevel=as,this._logHandler=cs,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in is))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?os[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,is.DEBUG,...t),this._logHandler(this,is.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,is.VERBOSE,...t),this._logHandler(this,is.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,is.INFO,...t),this._logHandler(this,is.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,is.WARN,...t),this._logHandler(this,is.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,is.ERROR,...t),this._logHandler(this,is.ERROR,...t)}}let us,hs;const ds=new WeakMap,ps=new WeakMap,fs=new WeakMap,Cs=new WeakMap,gs=new WeakMap;let ms={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return ps.get(t);if("objectStoreNames"===e)return t.objectStoreNames||fs.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Es(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function ws(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(hs||(hs=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(_s(this),e),Es(ds.get(this))}:function(...e){return Es(t.apply(_s(this),e))}:function(e,...n){const s=t.call(_s(this),e,...n);return fs.set(s,e.sort?e.sort():[e]),Es(s)}}function ys(t){return"function"==typeof t?ws(t):(t instanceof IDBTransaction&&function(t){if(ps.has(t))return;const e=new Promise((e,n)=>{const s=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),s()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)});ps.set(t,e)}(t),e=t,(us||(us=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(t,ms):t);var e}function Es(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,n)=>{const s=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(Es(t.result)),s()},i=()=>{n(t.error),s()};t.addEventListener("success",r),t.addEventListener("error",i)});return e.then(e=>{e instanceof IDBCursor&&ds.set(e,t)}).catch(()=>{}),gs.set(e,t),e}(t);if(Cs.has(t))return Cs.get(t);const e=ys(t);return e!==t&&(Cs.set(t,e),gs.set(e,t)),e}const _s=t=>gs.get(t);function Ds(t,e,{blocked:n,upgrade:s,blocking:r,terminated:i}={}){const o=indexedDB.open(t,e),a=Es(o);return s&&o.addEventListener("upgradeneeded",t=>{s(Es(o.result),t.oldVersion,t.newVersion,Es(o.transaction),t)}),n&&o.addEventListener("blocked",t=>n(t.oldVersion,t.newVersion,t)),a.then(t=>{i&&t.addEventListener("close",()=>i()),r&&t.addEventListener("versionchange",t=>r(t.oldVersion,t.newVersion,t))}).catch(()=>{}),a}const bs=["get","getKey","getAll","getAllKeys","count"],vs=["put","add","delete","clear"],Is=new Map;function Ts(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Is.get(e))return Is.get(e);const n=e.replace(/FromIndex$/,""),s=e!==n,r=vs.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!r&&!bs.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let o=i.store;return s&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),r&&i.done]))[0]};return Is.set(e,i),i}ms=(t=>({...t,get:(e,n,s)=>Ts(e,n)||t.get(e,n,s),has:(e,n)=>!!Ts(e,n)||t.has(e,n)}))(ms);class Os{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(function(t){const e=t.getComponent();return"VERSION"===e?.type}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null}).filter(t=>t).join(" ")}}const As="@firebase/app",Ss="0.16.2",Rs=new ls("@firebase/app"),Ns="@firebase/app-compat",xs="@firebase/analytics-compat",ks="@firebase/analytics",Ls="@firebase/app-check-compat",Fs="@firebase/app-check",Ps="@firebase/auth",Ms="@firebase/auth-compat",Gs="@firebase/database",Hs="@firebase/data-connect",Us="@firebase/database-compat",Vs="@firebase/functions",js="@firebase/functions-compat",$s="@firebase/installations",Js="@firebase/installations-compat",qs="@firebase/messaging",zs="@firebase/messaging-compat",Ks="@firebase/performance",Qs="@firebase/performance-compat",Ws="@firebase/remote-config",Ys="@firebase/remote-config-compat",Xs="@firebase/storage",Zs="@firebase/storage-compat",tr="@firebase/firestore",er="@firebase/ai",nr="@firebase/firestore-compat",sr="firebase",rr="[DEFAULT]",ir={[As]:"fire-core",[Ns]:"fire-core-compat",[ks]:"fire-analytics",[xs]:"fire-analytics-compat",[Fs]:"fire-app-check",[Ls]:"fire-app-check-compat",[Ps]:"fire-auth",[Ms]:"fire-auth-compat",[Gs]:"fire-rtdb",[Hs]:"fire-data-connect",[Us]:"fire-rtdb-compat",[Vs]:"fire-fn",[js]:"fire-fn-compat",[$s]:"fire-iid",[Js]:"fire-iid-compat",[qs]:"fire-fcm",[zs]:"fire-fcm-compat",[Ks]:"fire-perf",[Qs]:"fire-perf-compat",[Ws]:"fire-rc",[Ys]:"fire-rc-compat",[Xs]:"fire-gcs",[Zs]:"fire-gcs-compat",[tr]:"fire-fst",[nr]:"fire-fst-compat",[er]:"fire-vertex","fire-js":"fire-js",[sr]:"fire-js-all"},or=new Map,ar=new Map,Br=new Map;function cr(t,e){try{t.container.addComponent(e)}catch(n){Rs.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function lr(t){const e=t.name;if(Br.has(e))return Rs.debug(`There were multiple attempts to register component ${e}.`),!1;Br.set(e,t);for(const e of or.values())cr(e,t);for(const e of ar.values())cr(e,t);return!0}function ur(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function hr(t){return null!=t&&void 0!==t.settings}const dr=new jn("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 {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.","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 pr{constructor(t,e,n){this._isDeleted=!1,this._options={...t},this._config={...e},this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new es("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}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(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw dr.create("app-deleted",{appName:this._name})}}const fr="12.19.0";function Cr(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const s={name:rr,automaticDataCollectionEnabled:!0,...e},r=s.name;if("string"!=typeof r||!r)throw dr.create("bad-app-name",{appName:String(r)});if(n||(n=Nn()),!n)throw dr.create("no-options");const i=or.get(r);if(i){if($n(n,i.options)){if($n(s,i.config))return i;throw dr.create("duplicate-app",{appName:r,mismatchedParam:"config",oldValue:JSON.stringify(i.config),newValue:JSON.stringify(s)})}throw dr.create("duplicate-app",{appName:r,mismatchedParam:"options",oldValue:JSON.stringify(i.options),newValue:JSON.stringify(n)})}const o=new rs(r);for(const t of Br.values())o.addComponent(t);const a=new pr(n,s,o);return or.set(r,a),a}function gr(t=rr){const e=or.get(t);if(!e&&t===rr&&Nn())return Cr();if(!e)throw dr.create("no-app",{appName:t});return e}function mr(t,e,n){let s=ir[t]??t;n&&(s+=`-${n}`);const r=s.match(/\s|\//),i=e.match(/\s|\//);if(r||i){const t=[`Unable to register library "${s}" with version "${e}":`];return r&&t.push(`library name "${s}" contains illegal characters (whitespace or "/")`),r&&i&&t.push("and"),i&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void Rs.warn(t.join(" "))}lr(new es(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}const wr="firebase-heartbeat-store";let yr=null;function Er(){return yr||(yr=Ds("firebase-heartbeat-database",1,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore(wr)}catch(t){}}}).catch(t=>{throw dr.create("idb-open",{originalErrorMessage:t.message})})),yr}async function _r(t,e){try{const n=(await Er()).transaction(wr,"readwrite"),s=n.objectStore(wr);await s.put(e,Dr(t)),await n.done}catch(t){if(t instanceof Vn)Rs.warn(t.message);else{const e=dr.create("idb-set",{originalErrorMessage:t?.message});Rs.warn(e.message)}}}function Dr(t){return`${t.name}!${t.options.appId}`}class br{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Ir(e),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){try{const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=vr();if(null==this._heartbeatsCache?.heartbeats&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats))return;if(this._heartbeatsCache.lastSentHeartbeatDate===e||this._heartbeatsCache.heartbeats.some(t=>t.date===e))return;if(this._heartbeatsCache.heartbeats.push({date:e,agent:t}),this._heartbeatsCache.heartbeats.length>30){const t=function(t){if(0===t.length)return-1;let e=0,n=t[0].date;for(let s=1;s<t.length;s++)t[s].date<n&&(n=t[s].date,e=s);return e}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(t,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(t){Rs.warn(t)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats||0===this._heartbeatsCache.heartbeats.length)return"";const t=vr(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let s=t.slice();for(const r of t){const t=n.find(t=>t.agent===r.agent);if(t){if(t.dates.push(r.date),Tr(n)>e){t.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),Tr(n)>e){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),s=In(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return Rs.warn(t),""}}}function vr(){return(new Date).toISOString().substring(0,10)}class Ir{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!Gn()&&Hn().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=(await Er()).transaction(wr),n=await e.objectStore(wr).get(Dr(t));return await e.done,n}catch(t){if(t instanceof Vn)Rs.warn(t.message);else{const e=dr.create("idb-get",{originalErrorMessage:t?.message});Rs.warn(e.message)}}}(this.app);return t?.heartbeats?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const e=await this.read();return _r(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??e.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){if(await this._canUseIndexedDBPromise){const e=await this.read();return _r(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??e.lastSentHeartbeatDate,heartbeats:[...e.heartbeats,...t.heartbeats]})}}}function Tr(t){return In(JSON.stringify({version:2,heartbeats:t})).length}var Or;function Ar(){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."}}Or="",lr(new es("platform-logger",t=>new Os(t),"PRIVATE")),lr(new es("heartbeat",t=>new br(t),"PRIVATE")),mr(As,Ss,Or),mr(As,Ss,"esm2020"),mr("fire-js","");const Sr=Ar,Rr=new jn("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."}),Nr=new ls("@firebase/auth");function xr(t,...e){Nr.logLevel<=is.WARN&&Nr.warn(`Auth (${fr}): ${t}`,...e)}function kr(t,...e){Nr.logLevel<=is.ERROR&&Nr.error(`Auth (${fr}): ${t}`,...e)}function Lr(t,...e){throw Hr(t,...e)}function Fr(t,...e){return Hr(t,...e)}function Pr(t,e,n){const s={...Sr(),[e]:n};return new jn("auth","Firebase",s).create(e,{appName:t.name})}function Mr(t){return Pr(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Gr(t,e,n){if(!(e instanceof n))throw n.name!==e.constructor.name&&Lr(t,"argument-error"),Pr(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Hr(t,...e){if("string"!=typeof t){const n=e[0],s=[...e.slice(1)];return s[0]&&(s[0].appName=t.name),t._errorFactory.create(n,...s)}return Rr.create(t,...e)}function Ur(t,e,...n){if(!t)throw Hr(e,...n)}function Vr(t){const e="INTERNAL ASSERTION FAILED: "+t;throw kr(e),new Error(e)}function jr(t,e){t||Vr(e)}function $r(){return"undefined"!=typeof self&&self.location?.href||""}function Jr(){return"undefined"!=typeof self&&self.location?.protocol||null}function qr(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Jr()&&"https:"!==Jr()&&!Pn()&&!("connection"in navigator)||navigator.onLine}class zr{constructor(t,e){this.shortDelay=t,this.longDelay=e,jr(e>t,"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(Fn())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return qr()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Kr(t,e){jr(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class Qr{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),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 Vr("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 Vr("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 Vr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Wr={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"},Yr=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Xr=new zr(3e4,6e4);function Zr(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function ti(t,e,n,s,r={}){return ei(t,r,async()=>{let r={},i={};s&&("GET"===e?i=s:r={body:JSON.stringify(s)});const o=qn({...i,key:t.config.apiKey}).slice(1),a=await t._getAdditionalHeaders();a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode);const B={method:e,headers:a,...r};return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(B.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&Zn(t.emulatorConfig.host)&&(B.credentials="include"),Qr.fetch()(await si(t,t.config.apiHost,n,o),B)})}async function ei(t,e,n){t._canInitEmulator=!1;const s={...Wr,...e};try{const e=new ii(t),r=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await r.json();if("needConfirmation"in i)throw oi(t,"account-exists-with-different-credential",i);if(r.ok&&!("errorMessage"in i))return i;{const e=r.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw oi(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw oi(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw oi(t,"user-disabled",i);const a=s[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Pr(t,a,o);Lr(t,a)}}catch(e){if(e instanceof Vn)throw e;Lr(t,"network-request-failed",{message:String(e)})}}async function ni(t,e,n,s,r={}){const i=await ti(t,e,n,s,r);return"mfaPendingCredential"in i&&Lr(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function si(t,e,n,s){const r=`${e}${n}?${s}`,i=t,o=i.config.emulator?Kr(t.config,r):`${t.config.apiScheme}://${r}`;if(Yr.includes(n)&&(await i._persistenceManagerAvailable,"COOKIE"===i._getPersistenceType())){return i._getPersistence()._getFinalTarget(o).toString()}return o}function ri(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class ii{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((t,e)=>{this.timer=setTimeout(()=>e(Fr(this.auth,"network-request-failed")),Xr.get())})}}function oi(t,e,n){const s={appName:t.name};n.email&&(s.email=n.email),n.phoneNumber&&(s.phoneNumber=n.phoneNumber);const r=Fr(t,e,s);return r.customData._tokenResponse=n,r}function ai(t){return void 0!==t&&void 0!==t.enterprise}class Bi{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return ri(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function ci(t,e){return ti(t,"POST","/v1/accounts:lookup",e)}function li(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function ui(t){return 1e3*Number(t)}function hi(t){const[e,n,s]=t.split(".");if(void 0===e||void 0===n||void 0===s)return kr("JWT malformed, contained fewer than 3 sections"),null;try{const t=Tn(n);return t?JSON.parse(t):(kr("Failed to decode base64 JWT payload"),null)}catch(t){return kr("Caught error parsing JWT payload as JSON",t?.toString()),null}}function di(t){const e=hi(t);return Ur(e,"internal-error"),Ur(void 0!==e.exp,"internal-error"),Ur(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}async function pi(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof Vn&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class fi{constructor(t){this.user=t,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(t){if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout(async()=>{await this.iteration()},e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===t?.code&&this.schedule(!0))}this.schedule()}}class Ci{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=li(this.lastLoginAt),this.creationTime=li(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function gi(t){const e=t.auth,n=await t.getIdToken(),s=await pi(t,ci(e,{idToken:n}));Ur(s?.users.length,e,"internal-error");const r=s.users[0];t._notifyReloadListener(r);const i=r.providerUserInfo?.length?mi(r.providerUserInfo):[],o=function(t,e){const n=t.filter(t=>!e.some(e=>e.providerId===t.providerId));return[...n,...e]}(t.providerData,i),a=t.isAnonymous,B=!(t.email&&r.passwordHash||o?.length),c=!!a&&B,l={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:o,metadata:new Ci(r.createdAt,r.lastLoginAt),isAnonymous:c};Object.assign(t,l)}function mi(t){return t.map(({providerId:t,...e})=>({providerId:t,uid:e.rawId||"",displayName:e.displayName||null,email:e.email||null,phoneNumber:e.phoneNumber||null,photoURL:e.photoUrl||null}))}class wi{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Ur(t.idToken,"internal-error"),Ur(void 0!==t.idToken,"internal-error"),Ur(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):di(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){Ur(0!==t.length,"internal-error");const e=di(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(Ur(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:s,expiresIn:r}=await async function(t,e){const n=await ei(t,{},async()=>{const n=qn({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:r}=t.config,i=await si(t,s,"/v1/token",`key=${r}`),o=await t._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:o,body:n};return t.emulatorConfig&&Zn(t.emulatorConfig.host)&&(a.credentials="include"),Qr.fetch()(i,a)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,s,Number(r))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:s,expirationTime:r}=e,i=new wi;return n&&(Ur("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),s&&(Ur("string"==typeof s,"internal-error",{appName:t}),i.accessToken=s),r&&(Ur("number"==typeof r,"internal-error",{appName:t}),i.expirationTime=r),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new wi,this.toJSON())}_performRefresh(){return Vr("not implemented")}}function yi(t,e){Ur("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Ei{constructor({uid:t,auth:e,stsTokenManager:n,...s}){this.providerId="firebase",this.proactiveRefresh=new fi(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=e,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Ci(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await pi(this,this.stsTokenManager.getToken(this.auth,t));return Ur(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=Xn(t),s=await n.getIdToken(e),r=hi(s);Ur(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const i="object"==typeof r.firebase?r.firebase:void 0,o=i?.sign_in_provider;return{claims:r,token:s,authTime:li(ui(r.auth_time)),issuedAtTime:li(ui(r.iat)),expirationTime:li(ui(r.exp)),signInProvider:o||null,signInSecondFactor:i?.sign_in_second_factor||null}}(this,t)}reload(){return async function(t){const e=Xn(t);await gi(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Ur(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map(t=>({...t})),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new Ei({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return e.metadata._copy(this.metadata),e}_onReload(t){Ur(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await gi(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(hr(this.auth.app))return Promise.reject(Mr(this.auth));const t=await this.getIdToken();return await pi(this,async function(t,e){return ti(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),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(t=>({...t})),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(t,e){const n=e.displayName??void 0,s=e.email??void 0,r=e.phoneNumber??void 0,i=e.photoURL??void 0,o=e.tenantId??void 0,a=e._redirectEventId??void 0,B=e.createdAt??void 0,c=e.lastLoginAt??void 0,{uid:l,emailVerified:u,isAnonymous:h,providerData:d,stsTokenManager:p}=e;Ur(l&&p,t,"internal-error");const f=wi.fromJSON(this.name,p);Ur("string"==typeof l,t,"internal-error"),yi(n,t.name),yi(s,t.name),Ur("boolean"==typeof u,t,"internal-error"),Ur("boolean"==typeof h,t,"internal-error"),yi(r,t.name),yi(i,t.name),yi(o,t.name),yi(a,t.name),yi(B,t.name),yi(c,t.name);const C=new Ei({uid:l,auth:t,email:s,emailVerified:u,displayName:n,isAnonymous:h,photoURL:i,phoneNumber:r,tenantId:o,stsTokenManager:f,createdAt:B,lastLoginAt:c});return d&&Array.isArray(d)&&(C.providerData=d.map(t=>({...t}))),a&&(C._redirectEventId=a),C}static async _fromIdTokenResponse(t,e,n=!1){const s=new wi;s.updateFromServerResponse(e);const r=new Ei({uid:e.localId,auth:t,stsTokenManager:s,isAnonymous:n});return await gi(r),r}static async _fromGetAccountInfoResponse(t,e,n){const s=e.users[0];Ur(void 0!==s.localId,"internal-error");const r=void 0!==s.providerUserInfo?mi(s.providerUserInfo):[],i=!(s.email&&s.passwordHash||r?.length),o=new wi;o.updateFromIdToken(n);const a=new Ei({uid:s.localId,auth:t,stsTokenManager:o,isAnonymous:i}),B={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:r,metadata:new Ci(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash||r?.length)};return Object.assign(a,B),a}}const _i=new Map;function Di(t){jr(t instanceof Function,"Expected a class definition");let e=_i.get(t);return e?(jr(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,_i.set(t,e),e)}class bi{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}bi.type="NONE";const vi=bi;function Ii(t,e,n){return`firebase:${t}:${e}:${n}`}class Ti{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:s,name:r}=this.auth;this.fullUserKey=Ii(this.userKey,s.apiKey,r),this.fullPersistenceKey=Ii("persistence",s.apiKey,r),this.boundEventHandler=e._onStorageEvent.bind(e);try{this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}catch{}}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);if(!t)return null;if("string"==typeof t){const e=await ci(this.auth,{idToken:t}).catch(()=>{});return e?Ei._fromGetAccountInfoResponse(this.auth,e,t):null}return Ei._fromJSON(this.auth,t)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){try{this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}catch{}}static async create(t,e,n="authUser"){if(!e.length)return new Ti(Di(vi),t,n);const s=(await Promise.all(e.map(async t=>{try{if(await t._isAvailable())return t}catch{return}}))).filter(t=>t);let r=s[0]||Di(vi);const i=Ii(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){let s;if("string"==typeof e){const n=await ci(t,{idToken:e}).catch(()=>{});if(!n)break;s=await Ei._fromGetAccountInfoResponse(t,n,e)}else s=Ei._fromJSON(t,e);n!==r&&(o=s),r=n;break}}catch{}const a=s.filter(t=>t._shouldAllowMigration);return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(i,o.toJSON()),await Promise.all(e.map(async t=>{if(t!==r)try{await t._remove(i)}catch{}})),new Ti(r,t,n)):new Ti(r,t,n)}}function Oi(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Ni(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Ai(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(ki(e))return"Blackberry";if(Li(e))return"Webos";if(Si(e))return"Safari";if((e.includes("chrome/")||Ri(e))&&!e.includes("edge/"))return"Chrome";if(xi(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===n?.length)return n[1]}return"Other"}function Ai(t=Fn()){return/firefox\//i.test(t)}function Si(t=Fn()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Ri(t=Fn()){return/crios\//i.test(t)}function Ni(t=Fn()){return/iemobile/i.test(t)}function xi(t=Fn()){return/android/i.test(t)}function ki(t=Fn()){return/blackberry/i.test(t)}function Li(t=Fn()){return/webos/i.test(t)}function Fi(t=Fn()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Pi(){return function(){const t=Fn();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function Mi(t=Fn()){return Fi(t)||xi(t)||Li(t)||ki(t)||/windows phone/i.test(t)||Ni(t)}function Gi(t,e=[]){let n;switch(t){case"Browser":n=Oi(Fn());break;case"Worker":n=`${Oi(Fn())}-${t}`;break;default:n=t}const s=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${fr}/${s}`}class Hi{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise((n,s)=>{try{n(t(e))}catch(t){s(t)}});n.onAbort=e,this.queue.push(n);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}}class Ui{constructor(t){const e=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=e.minPasswordLength??6,e.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=e.maxPasswordLength),void 0!==e.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=e.containsLowercaseCharacter),void 0!==e.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=e.containsUppercaseCharacter),void 0!==e.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=e.containsNumericCharacter),void 0!==e.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=e.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=t.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=t.forceUpgradeOnSignin??!1,this.schemaVersion=t.schemaVersion}validatePassword(t){const e={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,e),this.validatePasswordCharacterOptions(t,e),e.isValid&&(e.isValid=e.meetsMinPasswordLength??!0),e.isValid&&(e.isValid=e.meetsMaxPasswordLength??!0),e.isValid&&(e.isValid=e.containsLowercaseLetter??!0),e.isValid&&(e.isValid=e.containsUppercaseLetter??!0),e.isValid&&(e.isValid=e.containsNumericCharacter??!0),e.isValid&&(e.isValid=e.containsNonAlphanumericCharacter??!0),e}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),s&&(e.meetsMaxPasswordLength=t.length<=s)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let s=0;s<t.length;s++)n=t.charAt(s),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,s,r){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=r))}}class Vi{constructor(t,e,n,s){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new $i(this),this.idTokenSubscription=new $i(this),this.beforeStateQueue=new Hi(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=Rr,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=t.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(t=>this._resolvePersistenceManagerAvailable=t)}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Di(e)),this._initializationPromise=this.queue(async()=>{if(!this._deleted){try{this.persistenceManager=await Ti.create(this,t)}catch(t){xr(`Failed to initialize persistence: ${t}`),this.persistenceManager=await Ti.create(this,[])}finally{this._resolvePersistenceManagerAvailable?.()}if(!this._deleted){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}try{await this.initializeCurrentUser(e)}catch(t){xr(`Failed to initialize current user: ${t}`),await this.directlySetCurrentUser(null).catch(()=>{})}this.lastNotifiedUid=this.currentUser?.uid||null,this._deleted||(this._isInitialized=!0)}}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await ci(this,{idToken:t}),n=await Ei._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){if(hr(this.app)){const t=this.app.settings.authIdToken;return t?new Promise(e=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(t).then(e,e))}):this.directlySetCurrentUser(null)}const e=await this.assertedPersistence.getCurrentUser();let n=e,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const e=this.redirectUser?._redirectEventId,r=n?._redirectEventId,i=await this.tryRedirectSignIn(t);e&&e!==r||!i?.user||(n=i.user,s=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(n)}catch(t){n=e,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(t))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return Ur(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await gi(t)}catch(t){if("auth/network-request-failed"!==t?.code)return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(hr(this.app))return Promise.reject(Mr(this));const e=t?Xn(t):null;return e&&Ur(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&Ur(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue(async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()})}async signOut(){return hr(this.app)?Promise.reject(Mr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return hr(this.app)?Promise.reject(Mr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Di(t))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return ti(t,"GET","/v2/passwordPolicy",Zr(t,e))}(this),e=new Ui(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new jn("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged(()=>{n(),t()},e)}})}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return ti(t,"POST","/v2/accounts:revokeToken",Zr(t,e))}(this,e)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&Di(t)||this._popupRedirectResolver;Ur(e,this,"argument-error"),this.redirectPersistenceManager=await Ti.create(this,[Di(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===t?this._currentUser:this.redirectUser?._redirectEventId===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(t))}_notifyListenersIfCurrent(t){t===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 t=this.currentUser?.uid??null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,s){if(this._deleted)return()=>{};const r="function"==typeof e?e:e.next.bind(e);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ur(o,this,"internal-error"),o.then(()=>{i||r(this.currentUser)}).catch(t=>{if(!i)if("function"!=typeof e&&e.error)e.error(t);else{if(!n)throw t;n(t)}}),"function"==typeof e){const r=t.addObserver(e,n,s);return()=>{i=!0,r()}}{const n=t.addObserver(e);return()=>{i=!0,n()}}}async directlySetCurrentUser(t){if(this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,this.persistenceManager)try{t?await this.persistenceManager.setCurrentUser(t):await this.persistenceManager.removeCurrentUser()}catch(t){const e=Pr(this,"internal-error",`An internal AuthError has occurred: ${t?.message||String(t)}`);throw e.customData={originalError:t},e}}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Ur(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Gi(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const e=await(this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader());e&&(t["X-Firebase-Client"]=e);const n=await this._getAppCheckToken();return n&&(t["X-Firebase-AppCheck"]=n),t}async _getAppCheckToken(){if(hr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken());return t?.error&&xr(`Error while retrieving App Check token: ${t.error}`),t?.token}}function ji(t){return Xn(t)}class $i{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new Qn(t,e);return n.subscribe.bind(n)}(t=>this.observer=t)}get next(){return Ur(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Ji={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function qi(t){return Ji.loadJS(t)}class zi{constructor(){this.enterprise=new Ki}ready(t){t()}execute(t,e){return Promise.resolve("token")}render(t,e){return""}}class Ki{ready(t){t()}execute(t,e){return Promise.resolve("token")}render(t,e){return""}}const Qi="NO_RECAPTCHA",Wi="onFirebaseAuthREInstanceReady";class Yi{constructor(t){this.type="recaptcha-enterprise",this.auth=ji(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise(async(e,n)=>{(async function(t,e){return ti(t,"GET","/v2/recaptchaConfig",Zr(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(s=>{if(void 0!==s.recaptchaKey){const n=new Bi(s);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))}).catch(t=>{n(t)})})}function s(e,n,s){const r=window.grecaptcha;ai(r)?r.enterprise.ready(()=>{r.enterprise.execute(e,{action:t}).then(t=>{n(t)}).catch(()=>{n(Qi)})}):s(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new zi).execute("siteKey",{action:"verify"})}return new Promise((t,r)=>{n(this.auth).then(async n=>{if(!e&&ai(window.grecaptcha)&&Yi.scriptInjectionDeferred)await Yi.scriptInjectionDeferred.promise,s(n,t,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let e=Ji.recaptchaEnterpriseScript;0!==e.length&&(e+=n+`&onload=${Wi}`),Yi.scriptInjectionDeferred=new kn,window[Wi]=()=>{Yi.scriptInjectionDeferred?.resolve()},qi(e).then(()=>Yi.scriptInjectionDeferred?.promise).then(()=>{s(n,t,r)}).catch(t=>{r(t)})}}).catch(t=>{r(t)})})}}async function Xi(t,e,n,s=!1,r=!1){const i=new Yi(t);let o;if(r)o=Qi;else try{o=await i.verify(n)}catch(t){o=await i.verify(n,!0)}const a={...e};if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in a){const t=a.phoneEnrollmentInfo.phoneNumber,e=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:t,recaptchaToken:e,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const t=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:t,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return s?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 Zi(t,e,n,s,r){if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await Xi(t,e,n,"getOobCode"===n);return s(t,r)}return s(t,e).catch(async r=>{if("auth/missing-recaptcha-token"===r.code){const r=await Xi(t,e,n,"getOobCode"===n);return s(t,r)}return Promise.reject(r)})}function to(t,e,n){const s=ji(t);Ur(/^https?:\/\//.test(e),s,"invalid-emulator-scheme");const r=eo(e),{host:i,port:o}=function(t){const e=eo(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const s=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(s);if(r){const t=r[1];return{host:t,port:no(s.substr(t.length+1))}}{const[t,e]=s.split(":");return{host:t,port:no(e)}}}(e),a=null===o?"":`:${o}`,B={url:`${r}//${i}${a}/`},c=Object.freeze({host:i,port:o,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!s._canInitEmulator)return Ur(s.config.emulator&&s.emulatorConfig,s,"emulator-config-failed"),void Ur($n(B,s.config.emulator)&&$n(c,s.emulatorConfig),s,"emulator-config-failed");s.config.emulator=B,s.emulatorConfig=c,s.settings.appVerificationDisabledForTesting=!0,Zn(i)?ts(`${r}//${i}${a}`):function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&console.info;"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}()}function eo(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function no(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}Yi.scriptInjectionDeferred=null;class so{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Vr("not implemented")}_getIdTokenResponse(t){return Vr("not implemented")}_linkToIdToken(t,e){return Vr("not implemented")}_getReauthenticationResolver(t){return Vr("not implemented")}}async function ro(t,e){return ti(t,"POST","/v1/accounts:signUp",e)}async function io(t,e){return ni(t,"POST","/v1/accounts:signInWithPassword",Zr(t,e))}async function oo(t,e){return ti(t,"POST","/v1/accounts:sendOobCode",Zr(t,e))}async function ao(t,e){return oo(t,e)}class Bo extends so{constructor(t,e,n,s=null){super("password",n),this._email=t,this._password=e,this._tenantId=s}static _fromEmailAndPassword(t,e){return new Bo(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new Bo(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if(e?.email&&e?.password){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return Zi(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",io);case"emailLink":return async function(t,e){return ni(t,"POST","/v1/accounts:signInWithEmailLink",Zr(t,e))}(t,{email:this._email,oobCode:this._password});default:Lr(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Zi(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ro);case"emailLink":return async function(t,e){return ni(t,"POST","/v1/accounts:signInWithEmailLink",Zr(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:Lr(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}async function co(t,e){return ni(t,"POST","/v1/accounts:signInWithIdp",Zr(t,e))}class lo extends so{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new lo(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):Lr("argument-error"),e}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(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:s,...r}=e;if(!n||!s)return null;const i=new lo(n,s);return i.idToken=r.idToken||void 0,i.accessToken=r.accessToken||void 0,i.secret=r.secret,i.nonce=r.nonce,i.pendingToken=r.pendingToken||null,i}_getIdTokenResponse(t){return co(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,co(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,co(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=qn(e)}return t}}class uo{constructor(t){const e=zn(Kn(t)),n=e.apiKey??null,s=e.oobCode??null,r=function(t){switch(t){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}}(e.mode??null);Ur(n&&s&&r,"argument-error"),this.apiKey=n,this.operation=r,this.code=s,this.continueUrl=e.continueUrl??null,this.languageCode=e.lang??null,this.tenantId=e.tenantId??null}static parseLink(t){const e=function(t){const e=zn(Kn(t)).link,n=e?zn(Kn(e)).deep_link_id:null,s=zn(Kn(t)).deep_link_id;return(s?zn(Kn(s)).link:null)||s||n||e||t}(t);try{return new uo(e)}catch{return null}}}class ho{constructor(){this.providerId=ho.PROVIDER_ID}static credential(t,e){return Bo._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=uo.parseLink(e);return Ur(n,"argument-error"),Bo._fromEmailAndCode(t,n.code,n.tenantId)}}ho.PROVIDER_ID="password",ho.EMAIL_PASSWORD_SIGN_IN_METHOD="password",ho.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class po{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}class fo extends po{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}class Co extends fo{constructor(){super("facebook.com")}static credential(t){return lo._fromParams({providerId:Co.PROVIDER_ID,signInMethod:Co.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Co.credentialFromTaggedObject(t)}static credentialFromError(t){return Co.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Co.credential(t.oauthAccessToken)}catch{return null}}}Co.FACEBOOK_SIGN_IN_METHOD="facebook.com",Co.PROVIDER_ID="facebook.com";class go extends fo{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return lo._fromParams({providerId:go.PROVIDER_ID,signInMethod:go.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return go.credentialFromTaggedObject(t)}static credentialFromError(t){return go.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return go.credential(e,n)}catch{return null}}}go.GOOGLE_SIGN_IN_METHOD="google.com",go.PROVIDER_ID="google.com";class mo extends fo{constructor(){super("github.com")}static credential(t){return lo._fromParams({providerId:mo.PROVIDER_ID,signInMethod:mo.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return mo.credentialFromTaggedObject(t)}static credentialFromError(t){return mo.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return mo.credential(t.oauthAccessToken)}catch{return null}}}mo.GITHUB_SIGN_IN_METHOD="github.com",mo.PROVIDER_ID="github.com";class wo extends fo{constructor(){super("twitter.com")}static credential(t,e){return lo._fromParams({providerId:wo.PROVIDER_ID,signInMethod:wo.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return wo.credentialFromTaggedObject(t)}static credentialFromError(t){return wo.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return wo.credential(e,n)}catch{return null}}}async function yo(t,e){return ni(t,"POST","/v1/accounts:signUp",Zr(t,e))}wo.TWITTER_SIGN_IN_METHOD="twitter.com",wo.PROVIDER_ID="twitter.com";class Eo{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,s=!1){const r=await Ei._fromIdTokenResponse(t,n,s),i=_o(n);return new Eo({user:r,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const s=_o(n);return new Eo({user:t,providerId:s,_tokenResponse:n,operationType:e})}}function _o(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class Do extends Vn{constructor(t,e,n,s){super(e.code,e.message),this.operationType=n,this.user=s,Object.setPrototypeOf(this,Do.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,s){return new Do(t,e,n,s)}}function bo(t,e,n,s){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw Do._fromErrorAndOperation(t,n,e,s);throw n})}async function vo(t,e,n=!1){const{auth:s}=t;if(hr(s.app))return Promise.reject(Mr(s));const r="reauthenticate";try{const i=await pi(t,bo(s,r,e,t),n);Ur(i.idToken,s,"internal-error");const o=hi(i.idToken);Ur(o,s,"internal-error");const{sub:a}=o;return Ur(t.uid===a,s,"user-mismatch"),Eo._forOperation(t,r,i)}catch(t){throw"auth/user-not-found"===t?.code&&Lr(s,"user-mismatch"),t}}async function Io(t,e,n=!1){if(hr(t.app))return Promise.reject(Mr(t));const s="signIn",r=await bo(t,s,e),i=await Eo._fromIdTokenResponse(t,s,r);return n||await t._updateCurrentUser(i.user),i}function To(t,e,n){Ur(n.url?.length>0,t,"invalid-continue-uri"),Ur(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),Ur(void 0===n.linkDomain||n.linkDomain.length>0,t,"invalid-hosting-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.linkDomain=n.linkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Ur(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Ur(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}async function Oo(t){const e=ji(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function Ao(t,e,n){const s=ji(t),r={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};await Zi(s,r,"getOobCode",ao)}function So(t,e,n){return hr(t.app)?Promise.reject(Mr(t)):async function(t,e){return Io(ji(t),e)}(Xn(t),ho.credential(e,n)).catch(async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&Oo(t),e})}async function Ro(t,e){const n=Xn(t),s={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()};e&&To(n.auth,s,e);const{email:r}=await async function(t,e){return oo(t,e)}(n.auth,s);r!==t.email&&await t.reload()}async function No(t,e,n){const s=Xn(t),r={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await t.getIdToken(),newEmail:e};n&&To(s.auth,r,n);const{email:i}=await async function(t,e){return oo(t,e)}(s.auth,r);i!==t.email&&await t.reload()}async function xo(t,e){const{displayName:n,photoURL:s}=e;if(void 0===n&&void 0===s)return;const r=Xn(t),i={idToken:await r.getIdToken(),displayName:n,photoUrl:s,returnSecureToken:!0},o=await pi(r,async function(t,e){return ti(t,"POST","/v1/accounts:update",e)}(r.auth,i));r.displayName=o.displayName||null,r.photoURL=o.photoUrl||null;const a=r.providerData.find(({providerId:t})=>"password"===t);a&&(a.displayName=r.displayName,a.photoURL=r.photoURL),await r._updateTokensIfNecessary(o)}function ko(t,e){return async function(t,e,n){const{auth:s}=t,r=await t.getIdToken(),i={idToken:r,returnSecureToken:!0};n&&(i.password=n);const o=await pi(t,async function(t,e){return ti(t,"POST","/v1/accounts:update",e)}(s,i));await t._updateTokensIfNecessary(o,!0)}(Xn(t),0,e)}function Lo(t,e,n,s){return Xn(t).onAuthStateChanged(e,n,s)}const Fo="__sak";class Po{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(Fo,"1"),this.storage.removeItem(Fo),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}class Mo extends Po{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Mi(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),s=this.localCache[e];n!==s&&t(e,s,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys((t,e,n)=>{this.notifyListeners(t,n)});const n=t.key;e?this.detachListener():this.stopPolling();const s=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},r=this.storage.getItem(n);Pi()&&r!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,10):s()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,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(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}Mo.type="LOCAL";const Go=Mo;class Ho extends Po{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,e){}_removeListener(t,e){}}Ho.type="SESSION";const Uo=Ho;class Vo{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find(e=>e.isListeningto(t));if(e)return e;const n=new Vo(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:s,data:r}=e.data,i=this.handlersMap[s];if(!i?.size)return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:s});const o=Array.from(i).map(async t=>t(e.origin,r)),a=await function(t){return Promise.all(t.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}}))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:s,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function jo(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}Vo.receivers=[];class $o{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let r,i;return new Promise((o,a)=>{const B=jo("",20);s.port1.start();const c=setTimeout(()=>{a(new Error("unsupported_event"))},n);i={messageChannel:s,onMessage(t){const e=t;if(e.data.eventId===B)switch(e.data.status){case"ack":clearTimeout(c),r=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(c),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:B,data:e},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}function Jo(){return window}function qo(){return void 0!==Jo().WorkerGlobalScope&&"function"==typeof Jo().importScripts}const zo="firebaseLocalStorageDb",Ko="firebaseLocalStorage",Qo="fbase_key";class Wo{constructor(t){this.request=t}toPromise(){return new Promise((t,e)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{e(this.request.error)})})}}function Yo(t,e){return t.transaction([Ko],e?"readwrite":"readonly").objectStore(Ko)}function Xo(){const t=indexedDB.open(zo,1);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const e=t.result;try{e.createObjectStore(Ko,{keyPath:Qo})}catch(t){n(t)}}),t.addEventListener("success",async()=>{const n=t.result;n.objectStoreNames.contains(Ko)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(zo);return new Wo(t).toPromise()}(),e(await Xo()))})})}async function Zo(t,e,n){const s=Yo(t,!0).put({[Qo]:e,value:n});return new Wo(s).toPromise()}function ta(t,e){const n=Yo(t,!0).delete(e);return new Wo(n).toPromise()}class ea{registerLifecycleListeners(){"undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow))}unregisterLifecycleListeners(){"undefined"!=typeof window&&"function"==typeof window.removeEventListener&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow))}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isClosing=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isClosing=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(t=>t.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isClosing&&(this.isClosing=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise||(this.dbPromise=Xo(),this.dbPromise.catch(()=>{this.dbPromise=null})),this.dbPromise}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;if(this.dbPromise){const t=this.dbPromise;this.dbPromise=null;try{(await t).close()}catch{}}}}async initializeServiceWorkerMessaging(){return qo()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Vo._getInstance(qo()?self:null),this.receiver._subscribe("keyChanged",async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)})),this.receiver._subscribe("ping",async(t,e)=>["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 $o(this.activeServiceWorker);const t=await this.sender._send("ping",{},800);t&&t[0]?.fulfilled&&t[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&(navigator?.serviceWorker?.controller||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return!!indexedDB&&(await this._withRetries(async t=>{await Zo(t,Fo,"1"),await ta(t,Fo)}),!0)}catch{}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Zo(n,t,e)),this.localCache[t]=e,this.notifyServiceWorker(t)))}async _get(t){const e=await this._withRetries(e=>async function(t,e){const n=Yo(t,!1).get(e),s=await new Wo(n).toPromise();return void 0===s?null:s.value}(e,t));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(e=>ta(e,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){if(this.isClosing)return[];try{const t=await this._withRetries(t=>{const e=Yo(t,!1).getAll();return new Wo(e).toPromise()});if(this.isClosing)return[];if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:s,value:r}of t)n.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(r)&&(this.notifyListeners(s,r),e.push(s));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}catch(t){return this.isClosing||xr(`Firebase Auth cross-tab polling failed with error: ${t}`),[]}}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.startPolling(),this.registerLifecycleListeners()),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.stopPolling(),this.unregisterLifecycleListeners())}}ea.type="LOCAL";const na=ea;function sa(t,e){return e?Di(e):(Ur(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}new zr(3e4,6e4);class ra extends so{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return co(t,this._buildIdpRequest())}_linkToIdToken(t,e){return co(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return co(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={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 t&&(e.idToken=t),e}}function ia(t){return Io(t.auth,new ra(t),t.bypassAuthState)}function oa(t){const{auth:e,user:n}=t;return Ur(n,e,"internal-error"),vo(n,new ra(t),t.bypassAuthState)}async function aa(t){const{auth:e,user:n}=t;return Ur(n,e,"internal-error"),async function(t,e,n=!1){const s=await pi(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Eo._forOperation(t,"link",s)}(n,new ra(t),t.bypassAuthState)}class Ba{constructor(t,e,n,s,r=!1){this.auth=t,this.resolver=n,this.user=s,this.bypassAuthState=r,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise(async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:s,tenantId:r,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:r||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return ia;case"linkViaPopup":case"linkViaRedirect":return aa;case"reauthViaPopup":case"reauthViaRedirect":return oa;default:Lr(this.auth,"internal-error")}}resolve(t){jr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){jr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const ca=new zr(2e3,1e4);class la extends Ba{constructor(t,e,n,s,r){super(t,e,s,r),this.provider=n,this.authWindow=null,this.pollId=null,la.currentPopupAction&&la.currentPopupAction.cancel(),la.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Ur(t,this.auth,"internal-error"),t}async onExecution(){jr(1===this.filter.length,"Popup operations only handle one event");const t=jo();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(Fr(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(Fr(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,la.currentPopupAction=null}pollUserCancellation(){const t=()=>{this.authWindow?.window?.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Fr(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(t,ca.get())};t()}}la.currentPopupAction=null;const ua=new Map;class ha extends Ba{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=ua.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=fa(e),s=pa(t);if(!await s._isAvailable())return!1;const r="true"===await s._get(n);return await s._remove(n),r}(this.resolver,this.auth),n=e?await super.execute():null;t=()=>Promise.resolve(n)}catch(e){t=()=>Promise.reject(e)}ua.set(this.auth._key(),t)}return this.bypassAuthState||ua.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function da(t,e){ua.set(t._key(),e)}function pa(t){return Di(t._redirectPersistence)}function fa(t){return Ii("pendingRedirect",t.config.apiKey,t.name)}function Ca(t,e,n){return async function(t,e,n){if(hr(t.app))return Promise.reject(Mr(t));const s=ji(t);Gr(t,e,po),await s._initializationPromise;const r=sa(s,n);return await async function(t,e){return pa(t)._set(fa(e),"true")}(r,s),r._openRedirect(s,e,"signInViaRedirect")}(t,e,n)}async function ga(t,e,n=!1){if(hr(t.app))return Promise.reject(Mr(t));const s=ji(t),r=sa(s,e),i=new ha(s,r,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await s._persistUserIfCurrent(o.user),await s._setRedirectUser(null,e)),o}class ma{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ya(t);default:return!1}}(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){if(t.error&&!ya(t)){const n=t.error.code?.split("auth/")[1]||"internal-error";e.onError(Fr(this.auth,n))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(wa(t))}saveEventToCache(t){this.cachedEventUids.add(wa(t)),this.lastProcessedEventTime=Date.now()}}function wa(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(t=>t).join("-")}function ya({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===e?.code}const Ea=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,_a=/^https?/;async function Da(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return ti(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(ba(t))return}catch{}Lr(t,"unauthorized-domain")}function ba(t){const e=$r(),{protocol:n,hostname:s}=new URL(e);if(t.startsWith("chrome-extension://")){const r=new URL(t);return""===r.hostname&&""===s?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===s}if(!_a.test(n))return!1;if(Ea.test(t))return s===t;const r=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(s)}const va=new zr(3e4,6e4);function Ia(){const t=Jo().___jsl;if(t?.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function Ta(t){return new Promise((e,n)=>{function s(){Ia(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Ia(),n(Fr(t,"network-request-failed"))},timeout:va.get()})}if(Jo().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else{if(!Jo().gapi?.load){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Jo()[e]=()=>{gapi.load?s():n(Fr(t,"network-request-failed"))},qi(`${Ji.gapiScript}?onload=${e}`).catch(t=>n(t))}s()}}).catch(t=>{throw Oa=null,t})}let Oa=null;const Aa=new zr(5e3,15e3),Sa={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ra=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Na(t){const e=t.config;Ur(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Kr(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,s={apiKey:e.apiKey,appName:t.name,v:fr},r=Ra.get(t.config.apiHost);r&&(s.eid=r);const i=t._getFrameworks();return i.length&&(s.fw=i.join(",")),`${n}?${qn(s).slice(1)}`}async function xa(t){const e=await function(t){return Oa=Oa||Ta(t),Oa}(t),n=Jo().gapi;return Ur(n,t,"internal-error"),e.open({where:document.body,url:Na(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Sa,dontclear:!0},e=>new Promise(async(n,s)=>{await e.restyle({setHideOnLeave:!1});const r=Fr(t,"network-request-failed"),i=Jo().setTimeout(()=>{s(r)},Aa.get());function o(){Jo().clearTimeout(i),n(e)}e.ping(o).then(o,()=>{s(r)})}))}const ka={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class La{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function Fa(t,e,n,s=500,r=600){const i=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-s)/2,0).toString();let a="";const B={...ka,width:s.toString(),height:r.toString(),top:i,left:o},c=Fn().toLowerCase();n&&(a=Ri(c)?"_blank":n),Ai(c)&&(e=e||"http://localhost",B.scrollbars="yes");const l=Object.entries(B).reduce((t,[e,n])=>`${t}${e}=${n},`,"");if(function(t=Fn()){return Fi(t)&&!!window.navigator?.standalone}(c)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const s=document.createEvent("MouseEvent");s.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(s)}(e||"",a),new La(null);const u=window.open(e||"",a,l);Ur(u,t,"popup-blocked");try{u.focus()}catch(t){}return new La(u)}const Pa="__/auth/handler",Ma="emulator/auth/handler",Ga=encodeURIComponent("fac");async function Ha(t,e,n,s,r,i){Ur(t.config.authDomain,t,"auth-domain-config-required"),Ur(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:s,v:fr,eventId:r};if(e instanceof po){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries({}))o[t]=e}if(e instanceof fo){const t=e.getScopes().filter(t=>""!==t);t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const B=await t._getAppCheckToken(),c=B?`#${Ga}=${encodeURIComponent(B)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Pa}`;return Kr(t,Ma)}(t)}?${qn(a).slice(1)}${c}`}const Ua="webStorageSupport";const Va=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Uo,this._completeRedirectFn=ga,this._overrideRedirectResult=da}async _openPopup(t,e,n,s){jr(this.eventManagers[t._key()]?.manager,"_initialize() not called before _openPopup()");return Fa(t,await Ha(t,e,n,$r(),s),jo())}async _openRedirect(t,e,n,s){await this._originValidation(t);return function(t){Jo().location.href=t}(await Ha(t,e,n,$r(),s)),new Promise(()=>{})}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(jr(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch(()=>{delete this.eventManagers[e]}),n}async initAndGetManager(t){const e=await xa(t),n=new ma(t);return e.register("authEvent",e=>{Ur(e?.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(Ua,{type:Ua},n=>{const s=n?.[0]?.[Ua];void 0!==s&&e(!!s),Lr(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Da(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return Mi()||Si()||Fi()}};var ja="@firebase/auth",$a="1.13.6";class Ja{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged(e=>{t(e?.stsTokenManager.accessToken||null)});this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){Ur(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const qa=xn("authIdTokenMaxAge")||300;let za=null;function Ka(t=gr()){const e=ur(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=ur(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if($n(n.getOptions(),e??{}))return t;Lr(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:Va,persistence:[na,Go,Uo]}),s=xn("authTokenSyncURL");if(s&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(s,location.origin);if(location.origin===t.origin){const e=(r=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>qa)return;const s=e?.token;za!==s&&(za=s,await fetch(r,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))});!function(t,e,n){Xn(t).beforeAuthStateChanged(e,n)}(n,e,()=>e(n.currentUser)),function(t,e,n,s){Xn(t).onIdTokenChanged(e,n,s)}(n,t=>e(t))}}var r;const i=Sn("auth");return i&&to(n,`http://${i}`),n}var Qa;!function(t){Ji=t}({loadJS:t=>new Promise((e,n)=>{const s=document.createElement("script");s.setAttribute("src",t),s.onload=e,s.onerror=t=>{const e=Fr("internal-error");e.customData=t,n(e)},s.type="text/javascript",s.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(s)}),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",lr(new es("auth",(t,{options:e})=>{const n=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),r=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Ur(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:Qa,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Gi(Qa)},B=new Vi(n,s,r,a);return function(t,e){const n=e?.persistence||[],s=(Array.isArray(n)?n:[n]).map(Di);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(s,e?.popupRedirectResolver)}(B,e),B},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,e,n)=>{t.getProvider("auth-internal").initialize()})),lr(new es("auth-internal",t=>(t=>new Ja(t))(ji(t.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),mr(ja,$a,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Qa)),mr(ja,$a,"esm2020");mr("firebase","12.19.0","app");var Wa,Ya="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var t;function e(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}function n(t,e,n){n||(n=0);const s=Array(16);if("string"==typeof e)for(var r=0;r<16;++r)s[r]=e.charCodeAt(n++)|e.charCodeAt(n++)<<8|e.charCodeAt(n++)<<16|e.charCodeAt(n++)<<24;else for(r=0;r<16;++r)s[r]=e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24;e=t.g[0],n=t.g[1],r=t.g[2];let i,o=t.g[3];i=e+(o^n&(r^o))+s[0]+3614090360&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[1]+3905402710&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[2]+606105819&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[3]+3250441966&4294967295,i=e+(o^(n=r+(i<<22&4294967295|i>>>10))&(r^o))+s[4]+4118548399&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[5]+1200080426&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[6]+2821735955&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[7]+4249261313&4294967295,i=e+(o^(n=r+(i<<22&4294967295|i>>>10))&(r^o))+s[8]+1770035416&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[9]+2336552879&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[10]+4294925233&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[11]+2304563134&4294967295,i=e+(o^(n=r+(i<<22&4294967295|i>>>10))&(r^o))+s[12]+1804603682&4294967295,i=o+(r^(e=n+(i<<7&4294967295|i>>>25))&(n^r))+s[13]+4254626195&4294967295,o=e+(i<<12&4294967295|i>>>20),i=r+(n^o&(e^n))+s[14]+2792965006&4294967295,i=n+(e^(r=o+(i<<17&4294967295|i>>>15))&(o^e))+s[15]+1236535329&4294967295,i=e+(r^o&((n=r+(i<<22&4294967295|i>>>10))^r))+s[1]+4129170786&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[6]+3225465664&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[11]+643717713&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[0]+3921069994&4294967295,i=e+(r^o&((n=r+(i<<20&4294967295|i>>>12))^r))+s[5]+3593408605&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[10]+38016083&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[15]+3634488961&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[4]+3889429448&4294967295,i=e+(r^o&((n=r+(i<<20&4294967295|i>>>12))^r))+s[9]+568446438&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[14]+3275163606&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[3]+4107603335&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[8]+1163531501&4294967295,i=e+(r^o&((n=r+(i<<20&4294967295|i>>>12))^r))+s[13]+2850285829&4294967295,i=o+(n^r&((e=n+(i<<5&4294967295|i>>>27))^n))+s[2]+4243563512&4294967295,o=e+(i<<9&4294967295|i>>>23),i=r+(e^n&(o^e))+s[7]+1735328473&4294967295,i=n+(o^e&((r=o+(i<<14&4294967295|i>>>18))^o))+s[12]+2368359562&4294967295,i=e+((n=r+(i<<20&4294967295|i>>>12))^r^o)+s[5]+4294588738&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[8]+2272392833&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[11]+1839030562&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[14]+4259657740&4294967295,i=e+((n=r+(i<<23&4294967295|i>>>9))^r^o)+s[1]+2763975236&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[4]+1272893353&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[7]+4139469664&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[10]+3200236656&4294967295,i=e+((n=r+(i<<23&4294967295|i>>>9))^r^o)+s[13]+681279174&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[0]+3936430074&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[3]+3572445317&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[6]+76029189&4294967295,i=e+((n=r+(i<<23&4294967295|i>>>9))^r^o)+s[9]+3654602809&4294967295,i=o+((e=n+(i<<4&4294967295|i>>>28))^n^r)+s[12]+3873151461&4294967295,o=e+(i<<11&4294967295|i>>>21),i=r+(o^e^n)+s[15]+530742520&4294967295,i=n+((r=o+(i<<16&4294967295|i>>>16))^o^e)+s[2]+3299628645&4294967295,i=e+(r^((n=r+(i<<23&4294967295|i>>>9))|~o))+s[0]+4096336452&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[7]+1126891415&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[14]+2878612391&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[5]+4237533241&4294967295,i=e+(r^((n=r+(i<<21&4294967295|i>>>11))|~o))+s[12]+1700485571&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[3]+2399980690&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[10]+4293915773&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[1]+2240044497&4294967295,i=e+(r^((n=r+(i<<21&4294967295|i>>>11))|~o))+s[8]+1873313359&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[15]+4264355552&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[6]+2734768916&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[13]+1309151649&4294967295,i=e+(r^((n=r+(i<<21&4294967295|i>>>11))|~o))+s[4]+4149444226&4294967295,i=o+(n^((e=n+(i<<6&4294967295|i>>>26))|~r))+s[11]+3174756917&4294967295,o=e+(i<<10&4294967295|i>>>22),i=r+(e^(o|~n))+s[2]+718787259&4294967295,i=n+(o^((r=o+(i<<15&4294967295|i>>>17))|~e))+s[9]+3951481745&4294967295,t.g[0]=t.g[0]+e&4294967295,t.g[1]=t.g[1]+(r+(i<<21&4294967295|i>>>11))&4294967295,t.g[2]=t.g[2]+r&4294967295,t.g[3]=t.g[3]+o&4294967295}function s(t,e){this.h=e;const n=[];let s=!0;for(let r=t.length-1;r>=0;r--){const i=0|t[r];s&&i==e||(n[r]=i,s=!1)}this.g=n}!function(t,e){function n(){}n.prototype=e.prototype,t.F=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.D=function(t,n,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.prototype[n].apply(t,r)}}(e,function(){this.blockSize=-1}),e.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},e.prototype.v=function(t,e){void 0===e&&(e=t.length);const s=e-this.blockSize,r=this.C;let i=this.h,o=0;for(;o<e;){if(0==i)for(;o<=s;)n(this,t,o),o+=this.blockSize;if("string"==typeof t){for(;o<e;)if(r[i++]=t.charCodeAt(o++),i==this.blockSize){n(this,r),i=0;break}}else for(;o<e;)if(r[i++]=t[o++],i==this.blockSize){n(this,r),i=0;break}}this.h=i,this.o+=e},e.prototype.A=function(){var t=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);t[0]=128;for(var e=1;e<t.length-8;++e)t[e]=0;e=8*this.o;for(var n=t.length-8;n<t.length;++n)t[n]=255&e,e/=256;for(this.v(t),t=Array(16),e=0,n=0;n<4;++n)for(let s=0;s<32;s+=8)t[e++]=this.g[n]>>>s&255;return t};var r={};function i(t){return-128<=t&&t<128?function(t,e){var n=r;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(t,function(t){return new s([0|t],t<0?-1:0)}):new s([0|t],t<0?-1:0)}function o(t){if(isNaN(t)||!isFinite(t))return a;if(t<0)return h(o(-t));const e=[];let n=1;for(let s=0;t>=n;s++)e[s]=t/n|0,n*=4294967296;return new s(e,0)}var a=i(0),B=i(1),c=i(16777216);function l(t){if(0!=t.h)return!1;for(let e=0;e<t.g.length;e++)if(0!=t.g[e])return!1;return!0}function u(t){return-1==t.h}function h(t){const e=t.g.length,n=[];for(let s=0;s<e;s++)n[s]=~t.g[s];return new s(n,~t.h).add(B)}function d(t,e){return t.add(h(e))}function p(t,e){for(;(65535&t[e])!=t[e];)t[e+1]+=t[e]>>>16,t[e]&=65535,e++}function f(t,e){this.g=t,this.h=e}function C(t,e){if(l(e))throw Error("division by zero");if(l(t))return new f(a,a);if(u(t))return e=C(h(t),e),new f(h(e.g),h(e.h));if(u(e))return e=C(t,h(e)),new f(h(e.g),e.h);if(t.g.length>30){if(u(t)||u(e))throw Error("slowDivide_ only works with positive integers.");for(var n=B,s=e;s.l(t)<=0;)n=g(n),s=g(s);var r=m(n,1),i=m(s,1);for(s=m(s,2),n=m(n,2);!l(s);){var c=i.add(s);c.l(t)<=0&&(r=r.add(n),i=c),s=m(s,1),n=m(n,1)}return e=d(t,r.j(e)),new f(r,e)}for(r=a;t.l(e)>=0;){for(n=Math.max(1,Math.floor(t.m()/e.m())),s=(s=Math.ceil(Math.log(n)/Math.LN2))<=48?1:Math.pow(2,s-48),c=(i=o(n)).j(e);u(c)||c.l(t)>0;)c=(i=o(n-=s)).j(e);l(i)&&(i=B),r=r.add(i),t=d(t,c)}return new f(r,t)}function g(t){const e=t.g.length+1,n=[];for(let s=0;s<e;s++)n[s]=t.i(s)<<1|t.i(s-1)>>>31;return new s(n,t.h)}function m(t,e){const n=e>>5;e%=32;const r=t.g.length-n,i=[];for(let s=0;s<r;s++)i[s]=e>0?t.i(s+n)>>>e|t.i(s+n+1)<<32-e:t.i(s+n);return new s(i,t.h)}(t=s.prototype).m=function(){if(u(this))return-h(this).m();let t=0,e=1;for(let n=0;n<this.g.length;n++){const s=this.i(n);t+=(s>=0?s:4294967296+s)*e,e*=4294967296}return t},t.toString=function(t){if((t=t||10)<2||36<t)throw Error("radix out of range: "+t);if(l(this))return"0";if(u(this))return"-"+h(this).toString(t);const e=o(Math.pow(t,6));var n=this;let s="";for(;;){const r=C(n,e).g;let i=(((n=d(n,r.j(e))).g.length>0?n.g[0]:n.h)>>>0).toString(t);if(l(n=r))return i+s;for(;i.length<6;)i="0"+i;s=i+s}},t.i=function(t){return t<0?0:t<this.g.length?this.g[t]:this.h},t.l=function(t){return u(t=d(this,t))?-1:l(t)?0:1},t.abs=function(){return u(this)?h(this):this},t.add=function(t){const e=Math.max(this.g.length,t.g.length),n=[];let r=0;for(let s=0;s<=e;s++){let e=r+(65535&this.i(s))+(65535&t.i(s)),i=(e>>>16)+(this.i(s)>>>16)+(t.i(s)>>>16);r=i>>>16,e&=65535,i&=65535,n[s]=i<<16|e}return new s(n,-2147483648&n[n.length-1]?-1:0)},t.j=function(t){if(l(this)||l(t))return a;if(u(this))return u(t)?h(this).j(h(t)):h(h(this).j(t));if(u(t))return h(this.j(h(t)));if(this.l(c)<0&&t.l(c)<0)return o(this.m()*t.m());const e=this.g.length+t.g.length,n=[];for(var r=0;r<2*e;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(let e=0;e<t.g.length;e++){const s=this.i(r)>>>16,i=65535&this.i(r),o=t.i(e)>>>16,a=65535&t.i(e);n[2*r+2*e]+=i*a,p(n,2*r+2*e),n[2*r+2*e+1]+=s*a,p(n,2*r+2*e+1),n[2*r+2*e+1]+=i*o,p(n,2*r+2*e+1),n[2*r+2*e+2]+=s*o,p(n,2*r+2*e+2)}for(t=0;t<e;t++)n[t]=n[2*t+1]<<16|n[2*t];for(t=e;t<2*e;t++)n[t]=0;return new s(n,0)},t.B=function(t){return C(this,t).h},t.and=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let s=0;s<e;s++)n[s]=this.i(s)&t.i(s);return new s(n,this.h&t.h)},t.or=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let s=0;s<e;s++)n[s]=this.i(s)|t.i(s);return new s(n,this.h|t.h)},t.xor=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let s=0;s<e;s++)n[s]=this.i(s)^t.i(s);return new s(n,this.h^t.h)},e.prototype.digest=e.prototype.A,e.prototype.reset=e.prototype.u,e.prototype.update=e.prototype.v,s.prototype.add=s.prototype.add,s.prototype.multiply=s.prototype.j,s.prototype.modulo=s.prototype.B,s.prototype.compare=s.prototype.l,s.prototype.toNumber=s.prototype.m,s.prototype.toString=s.prototype.toString,s.prototype.getBits=s.prototype.i,s.fromNumber=o,s.fromString=function t(e,n){if(0==e.length)throw Error("number format error: empty string");if((n=n||10)<2||36<n)throw Error("radix out of range: "+n);if("-"==e.charAt(0))return h(t(e.substring(1),n));if(e.indexOf("-")>=0)throw Error('number format error: interior "-" character');const s=o(Math.pow(n,8));let r=a;for(let t=0;t<e.length;t+=8){var i=Math.min(8,e.length-t);const a=parseInt(e.substring(t,t+i),n);i<8?(i=o(Math.pow(n,i)),r=r.j(i).add(o(a))):(r=r.j(s),r=r.add(o(a)))}return r},Wa=s}).apply(void 0!==Ya?Ya:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Xa,Za,tB,eB,nB,sB,rB,iB,oB="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var t,e=Object.defineProperty;var n=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof oB&&oB];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function s(t,s){if(s)t:{var r=n;t=t.split(".");for(var i=0;i<t.length-1;i++){var o=t[i];if(!(o in r))break t;r=r[o]}(s=s(i=r[t=t[t.length-1]]))!=i&&null!=s&&e(r,t,{configurable:!0,writable:!0,value:s})}}s("Symbol.dispose",function(t){return t||Symbol("Symbol.dispose")}),s("Array.prototype.values",function(t){return t||function(){return this[Symbol.iterator]()}}),s("Object.entries",function(t){return t||function(t){var e,n=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.push([e,t[e]]);return n}});var r=r||{},i=this||self;function o(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}function a(t,e,n){return t.call.apply(t.bind,arguments)}function B(t,e,n){return(B=a).apply(null,arguments)}function c(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function l(t,e){function n(){}n.prototype=e.prototype,t.Z=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Ob=function(t,n,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.prototype[n].apply(t,r)}}var u="undefined"!=typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?t=>t&&AsyncContext.Snapshot.wrap(t):t=>t;function h(t){const e=t.length;if(e>0){const n=Array(e);for(let s=0;s<e;s++)n[s]=t[s];return n}return[]}function d(t,e){for(let e=1;e<arguments.length;e++){const s=arguments[e];var n=typeof s;if("array"==(n="object"!=n?n:s?Array.isArray(s)?"array":n:"null")||"object"==n&&"number"==typeof s.length){n=t.length||0;const e=s.length||0;t.length=n+e;for(let r=0;r<e;r++)t[n+r]=s[r]}else t.push(s)}}function p(t){i.setTimeout(()=>{throw t},0)}function f(){var t=y;let e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var C=new class{constructor(t,e){this.i=t,this.j=e,this.h=0,this.g=null}get(){let t;return this.h>0?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t}}(()=>new g,t=>t.reset());class g{constructor(){this.next=this.g=this.h=null}set(t,e){this.h=t,this.g=e,this.next=null}reset(){this.next=this.g=this.h=null}}let m,w=!1,y=new class{constructor(){this.h=this.g=null}add(t,e){const n=C.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n}},E=()=>{const t=Promise.resolve(void 0);m=()=>{t.then(_)}};function _(){for(var t;t=f();){try{t.h.call(t.g)}catch(t){p(t)}var e=C;e.j(t),e.h<100&&(e.h++,t.next=e.g,e.g=t)}w=!1}function D(){this.u=this.u,this.C=this.C}function b(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}D.prototype.u=!1,D.prototype.dispose=function(){this.u||(this.u=!0,this.N())},D.prototype[Symbol.dispose]=function(){this.dispose()},D.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},b.prototype.h=function(){this.defaultPrevented=!0};var v=function(){if(!i.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{const t=()=>{};i.addEventListener("test",t,e),i.removeEventListener("test",t,e)}catch(t){}return t}();function I(t){return/^[\s\xa0]*$/.test(t)}function T(t,e){b.call(this,t?t.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,t&&this.init(t,e)}l(T,b),T.prototype.init=function(t,e){const n=this.type=t.type,s=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;this.target=t.target||t.srcElement,this.g=e,(e=t.relatedTarget)||("mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement)),this.relatedTarget=e,s?(this.clientX=void 0!==s.clientX?s.clientX:s.pageX,this.clientY=void 0!==s.clientY?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=t.pointerType,this.state=t.state,this.i=t,t.defaultPrevented&&T.Z.h.call(this)},T.prototype.h=function(){T.Z.h.call(this);const t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var O="closure_listenable_"+(1e6*Math.random()|0),A=0;function S(t,e,n,s,r){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!s,this.ha=r,this.key=++A,this.da=this.fa=!1}function R(t){t.da=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function N(t,e,n){for(const s in t)e.call(n,t[s],s,t)}function x(t){const e={};for(const n in t)e[n]=t[n];return e}const k="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function L(t,e){let n,s;for(let e=1;e<arguments.length;e++){for(n in s=arguments[e],s)t[n]=s[n];for(let e=0;e<k.length;e++)n=k[e],Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}}function F(t){this.src=t,this.g={},this.h=0}function P(t,e){const n=e.type;if(n in t.g){var s,r=t.g[n],i=Array.prototype.indexOf.call(r,e,void 0);(s=i>=0)&&Array.prototype.splice.call(r,i,1),s&&(R(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function M(t,e,n,s){for(let r=0;r<t.length;++r){const i=t[r];if(!i.da&&i.listener==e&&i.capture==!!n&&i.ha==s)return r}return-1}F.prototype.add=function(t,e,n,s,r){const i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);const o=M(t,e,s,r);return o>-1?(e=t[o],n||(e.fa=!1)):((e=new S(e,this.src,i,!!s,r)).fa=n,t.push(e)),e};var G="closure_lm_"+(1e6*Math.random()|0),H={};function U(t,e,n,s,r){if(Array.isArray(e)){for(let i=0;i<e.length;i++)U(t,e[i],n,s,r);return null}return n=K(n),t&&t[O]?t.J(e,n,!!o(s)&&!!s.capture,r):function(t,e,n,s,r,i){if(!e)throw Error("Invalid event type");const a=o(r)?!!r.capture:!!r;let B=q(t);if(B||(t[G]=B=new F(t)),n=B.add(e,n,s,a,i),n.proxy)return n;if(s=function(){function t(n){return e.call(t.src,t.listener,n)}const e=J;return t}(),n.proxy=s,s.src=t,s.listener=n,t.addEventListener)v||(r=a),void 0===r&&(r=!1),t.addEventListener(e.toString(),s,r);else if(t.attachEvent)t.attachEvent($(e.toString()),s);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(s)}return n}(t,e,n,!1,s,r)}function V(t,e,n,s,r){if(Array.isArray(e))for(var i=0;i<e.length;i++)V(t,e[i],n,s,r);else s=o(s)?!!s.capture:!!s,n=K(n),t&&t[O]?(t=t.i,(i=String(e).toString())in t.g&&((n=M(e=t.g[i],n,s,r))>-1&&(R(e[n]),Array.prototype.splice.call(e,n,1),0==e.length&&(delete t.g[i],t.h--)))):t&&(t=q(t))&&(e=t.g[e.toString()],t=-1,e&&(t=M(e,n,s,r)),(n=t>-1?e[t]:null)&&j(n))}function j(t){if("number"!=typeof t&&t&&!t.da){var e=t.src;if(e&&e[O])P(e.i,t);else{var n=t.type,s=t.proxy;e.removeEventListener?e.removeEventListener(n,s,t.capture):e.detachEvent?e.detachEvent($(n),s):e.addListener&&e.removeListener&&e.removeListener(s),(n=q(e))?(P(n,t),0==n.h&&(n.src=null,e[G]=null)):R(t)}}}function $(t){return t in H?H[t]:H[t]="on"+t}function J(t,e){if(t.da)t=!0;else{e=new T(e,this);const n=t.listener,s=t.ha||t.src;t.fa&&j(t),t=n.call(s,e)}return t}function q(t){return(t=t[G])instanceof F?t:null}var z="__closure_events_fn_"+(1e9*Math.random()>>>0);function K(t){return"function"==typeof t?t:(t[z]||(t[z]=function(e){return t.handleEvent(e)}),t[z])}function Q(){D.call(this),this.i=new F(this),this.M=this,this.G=null}function W(t,e){var n,s=t.G;if(s)for(n=[];s;s=s.G)n.push(s);if(t=t.M,s=e.type||e,"string"==typeof e)e=new b(e,t);else if(e instanceof b)e.target=e.target||t;else{var r=e;L(e=new b(s,t),r)}let i,o;if(r=!0,n)for(o=n.length-1;o>=0;o--)i=e.g=n[o],r=Y(i,s,!0,e)&&r;if(i=e.g=t,r=Y(i,s,!0,e)&&r,r=Y(i,s,!1,e)&&r,n)for(o=0;o<n.length;o++)i=e.g=n[o],r=Y(i,s,!1,e)&&r}function Y(t,e,n,s){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();let r=!0;for(let i=0;i<e.length;++i){const o=e[i];if(o&&!o.da&&o.capture==n){const e=o.listener,n=o.ha||o.src;o.fa&&P(t.i,o),r=!1!==e.call(n,s)&&r}}return r&&!s.defaultPrevented}function X(t){t.g=function(t,e){if("function"!=typeof t){if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=B(t.handleEvent,t)}return Number(e)>2147483647?-1:i.setTimeout(t,e||0)}(()=>{t.g=null,t.i&&(t.i=!1,X(t))},t.l);const e=t.h;t.h=null,t.m.apply(null,e)}l(Q,D),Q.prototype[O]=!0,Q.prototype.removeEventListener=function(t,e,n,s){V(this,t,e,n,s)},Q.prototype.N=function(){if(Q.Z.N.call(this),this.i){var t=this.i;for(const e in t.g){const n=t.g[e];for(let t=0;t<n.length;t++)R(n[t]);delete t.g[e],t.h--}}this.G=null},Q.prototype.J=function(t,e,n,s){return this.i.add(String(t),e,!1,n,s)},Q.prototype.K=function(t,e,n,s){return this.i.add(String(t),e,!0,n,s)};class Z extends D{constructor(t,e){super(),this.m=t,this.l=e,this.h=null,this.i=!1,this.g=null}j(t){this.h=arguments,this.g?this.i=!0:X(this)}N(){super.N(),this.g&&(i.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function tt(t){D.call(this),this.h=t,this.g={}}l(tt,D);var et=[];function nt(t){N(t.g,function(t,e){this.g.hasOwnProperty(e)&&j(t)},t),t.g={}}tt.prototype.N=function(){tt.Z.N.call(this),nt(this)},tt.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var st=i.JSON.stringify,rt=i.JSON.parse,it=class{stringify(t){return i.JSON.stringify(t,void 0)}parse(t){return i.JSON.parse(t,void 0)}};function ot(){}function at(){}var Bt={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function ct(){b.call(this,"d")}function lt(){b.call(this,"c")}l(ct,b),l(lt,b);var ut={},ht=null;function dt(){return ht=ht||new Q}function pt(t){b.call(this,ut.Ia,t)}function ft(t){const e=dt();W(e,new pt(e))}function Ct(t,e){b.call(this,ut.STAT_EVENT,t),this.stat=e}function gt(t){const e=dt();W(e,new Ct(e,t))}function mt(t,e){b.call(this,ut.Ja,t),this.size=e}function wt(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return i.setTimeout(function(){t()},e)}function yt(){this.g=!0}function Et(t,e,n,s){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{const i=JSON.parse(e);if(i)for(t=0;t<i.length;t++)if(Array.isArray(i[t])){var n=i[t];if(!(n.length<2)){var s=n[1];if(Array.isArray(s)&&!(s.length<1)){var r=s[0];if("noop"!=r&&"stop"!=r&&"close"!=r)for(let t=1;t<s.length;t++)s[t]=""}}}return st(i)}catch(t){return e}}(t,n)+(s?" "+s:"")})}ut.Ia="serverreachability",l(pt,b),ut.STAT_EVENT="statevent",l(Ct,b),ut.Ja="timingevent",l(mt,b),yt.prototype.ua=function(){this.g=!1},yt.prototype.info=function(){};var _t,Dt={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},bt={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"};function vt(){}function It(t){return encodeURIComponent(String(t))}function Tt(t){var e=1;t=t.split(":");const n=[];for(;e>0&&t.length;)n.push(t.shift()),e--;return t.length&&n.push(t.join(":")),n}function Ot(t,e,n,s){this.j=t,this.i=e,this.l=n,this.S=s||1,this.V=new tt(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 At}function At(){this.i=null,this.g="",this.h=!1}l(vt,ot),vt.prototype.g=function(){return new XMLHttpRequest},_t=new vt;var St={},Rt={};function Nt(t,e,n){t.M=1,t.A=se(Xt(e)),t.u=n,t.R=!0,xt(t,null)}function xt(t,e){t.F=Date.now(),Ft(t),t.B=Xt(t.A);var n=t.B,s=t.S;Array.isArray(s)||(s=[String(s)]),ge(n.i,"t",s),t.C=0,n=t.j.L,t.h=new At,t.g=sn(t.j,n?e:null,!t.u),t.P>0&&(t.O=new Z(B(t.Y,t,t.g),t.P)),e=t.V,n=t.g,s=t.ba;var r="readystatechange";Array.isArray(r)||(r&&(et[0]=r.toString()),r=et);for(let t=0;t<r.length;t++){const i=U(n,r[t],s||e.handleEvent,!1,e.h||e);if(!i)break;e.g[i.key]=i}e=t.J?x(t.J):{},t.u?(t.v||(t.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.ea(t.B,t.v,t.u,e)):(t.v="GET",t.g.ea(t.B,t.v,null,e)),ft(),function(t,e,n,s,r,i){t.info(function(){if(t.g)if(i){var o="",a=i.split("&");for(let t=0;t<a.length;t++){var B=a[t].split("=");if(B.length>1){const t=B[0];B=B[1];const e=t.split("_");o=e.length>=2&&"type"==e[1]?o+(t+"=")+B+"&":o+(t+"=redacted&")}}}else o=null;else o=i;return"XMLHTTP REQ ("+s+") [attempt "+r+"]: "+e+"\n"+n+"\n"+o})}(t.i,t.v,t.B,t.l,t.S,t.u)}function kt(t){return!!t.g&&("GET"==t.v&&2!=t.M&&t.j.Aa)}function Lt(t,e){var n=t.C,s=e.indexOf("\n",n);return-1==s?Rt:(n=Number(e.substring(n,s)),isNaN(n)?St:(s+=1)+n>e.length?Rt:(e=e.slice(s,s+n),t.C=s+n,e))}function Ft(t){t.T=Date.now()+t.H,Pt(t,t.H)}function Pt(t,e){if(null!=t.D)throw Error("WatchDog timer not null");t.D=wt(B(t.aa,t),e)}function Mt(t){t.D&&(i.clearTimeout(t.D),t.D=null)}function Gt(t){0==t.j.I||t.K||Xe(t.j,t)}function Ht(t){Mt(t);var e=t.O;e&&"function"==typeof e.dispose&&e.dispose(),t.O=null,nt(t.V),t.g&&(e=t.g,t.g=null,e.abort(),e.dispose())}function Ut(t,e){try{var n=t.j;if(0!=n.I&&(n.g==t||qt(n.h,t)))if(!t.L&&qt(n.h,t)&&3==n.I){try{var s=n.Ba.g.parse(e)}catch(t){s=null}if(Array.isArray(s)&&3==s.length){var r=s;if(0==r[0]){t:if(!n.v){if(n.g){if(!(n.g.F+3e3<t.F))break t;Ye(n),Ue(n)}Ke(n),gt(18)}}else n.xa=r[1],0<n.xa-n.K&&r[2]<37500&&n.F&&0==n.A&&!n.C&&(n.C=wt(B(n.Va,n),6e3));Jt(n.h)<=1&&n.ta&&(n.ta=void 0)}else tn(n,11)}else if((t.L||n.g==t)&&Ye(n),!I(e))for(r=n.Ba.g.parse(e),e=0;e<r.length;e++){let B=r[e];const l=B[0];if(!(l<=n.K))if(n.K=l,B=B[1],2==n.I)if("c"==B[0]){n.M=B[1],n.ba=B[2];const e=B[3];null!=e&&(n.ka=e,n.j.info("VER="+n.ka));const r=B[4];null!=r&&(n.za=r,n.j.info("SVER="+n.za));const l=B[5];null!=l&&"number"==typeof l&&l>0&&(s=1.5*l,n.O=s,n.j.info("backChannelRequestTimeoutMs_="+s)),s=n;const u=t.g;if(u){const t=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(t){var i=s.h;i.g||-1==t.indexOf("spdy")&&-1==t.indexOf("quic")&&-1==t.indexOf("h2")||(i.j=i.l,i.g=new Set,i.h&&(zt(i,i.h),i.h=null))}if(s.G){const t=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;t&&(s.wa=t,ne(s.J,s.G,t))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-t.F,n.j.info("Handshake RTT: "+n.T+"ms"));var o=t;if((s=n).na=nn(s,s.L?s.ba:null,s.W),o.L){Kt(s.h,o);var a=o,c=s.O;c&&(a.H=c),a.D&&(Mt(a),Ft(a)),s.g=o}else ze(s);n.i.length>0&&je(n)}else"stop"!=B[0]&&"close"!=B[0]||tn(n,7);else 3==n.I&&("stop"==B[0]||"close"==B[0]?"stop"==B[0]?tn(n,7):He(n):"noop"!=B[0]&&n.l&&n.l.qa(B),n.A=0)}ft()}catch(t){}}Ot.prototype.ba=function(t){t=t.target;const e=this.O;e&&3==Fe(t)?e.j():this.Y(t)},Ot.prototype.Y=function(t){try{if(t==this.g)t:{const B=Fe(this.g),c=this.g.ya();this.g.ca();if(!(B<3)&&(3!=B||this.g&&(this.h.h||this.g.la()||Pe(this.g)))){this.K||4!=B||7==c||ft(),Mt(this);var e=this.g.ca();this.X=e;var n=function(t){if(!kt(t))return t.g.la();const e=Pe(t.g);if(""===e)return"";let n="";const s=e.length,r=4==Fe(t.g);if(!t.h.i){if("undefined"==typeof TextDecoder)return Ht(t),Gt(t),"";t.h.i=new i.TextDecoder}for(let i=0;i<s;i++)t.h.h=!0,n+=t.h.i.decode(e[i],{stream:!(r&&i==s-1)});return e.length=0,t.h.g+=n,t.C=0,t.h.g}(this);if(this.o=200==e,function(t,e,n,s,r,i,o){t.info(function(){return"XMLHTTP RESP ("+s+") [ attempt "+r+"]: "+e+"\n"+n+"\n"+i+" "+o})}(this.i,this.v,this.B,this.l,this.S,B,e),this.o){if(this.U&&!this.L){e:{if(this.g){var s,r=this.g;if((s=r.g?r.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!I(s)){var o=s;break e}}o=null}if(!(t=o)){this.o=!1,this.m=3,gt(12),Ht(this),Gt(this);break t}Et(this.i,this.l,t,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,Ut(this,t)}if(this.R){let e;for(t=!0;!this.K&&this.C<n.length;){if(e=Lt(this,n),e==Rt){4==B&&(this.m=4,gt(14),t=!1),Et(this.i,this.l,null,"[Incomplete Response]");break}if(e==St){this.m=4,gt(15),Et(this.i,this.l,n,"[Invalid Chunk]"),t=!1;break}Et(this.i,this.l,e,null),Ut(this,e)}if(kt(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=B||0!=n.length||this.h.h||(this.m=1,gt(16),t=!1),this.o=this.o&&t,t){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),Qe(a),a.P=!0,gt(11))}}else Et(this.i,this.l,n,"[Invalid Chunked Response]"),Ht(this),Gt(this)}else Et(this.i,this.l,n,null),Ut(this,n);4==B&&Ht(this),this.o&&!this.K&&(4==B?Xe(this.j,this):(this.o=!1,Ft(this)))}else(function(t){const e={};t=(t.g&&Fe(t)>=2&&t.g.getAllResponseHeaders()||"").split("\r\n");for(let s=0;s<t.length;s++){if(I(t[s]))continue;var n=Tt(t[s]);const r=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const i=e[r]||[];e[r]=i,i.push(n)}!function(t,e){for(const n in t)e.call(void 0,t[n],n,t)}(e,function(t){return t.join(", ")})})(this.g),400==e&&n.indexOf("Unknown SID")>0?(this.m=3,gt(12)):(this.m=0,gt(13)),Ht(this),Gt(this)}}}catch(t){}},Ot.prototype.cancel=function(){this.K=!0,Ht(this)},Ot.prototype.aa=function(){this.D=null;const t=Date.now();t-this.T>=0?(function(t,e){t.info(function(){return"TIMEOUT: "+e})}(this.i,this.B),2!=this.M&&(ft(),gt(17)),Ht(this),this.m=2,Gt(this)):Pt(this,this.T-t)};var Vt=class{constructor(t,e){this.g=t,this.map=e}};function jt(t){this.l=t||10,i.PerformanceNavigationTiming?t=(t=i.performance.getEntriesByType("navigation")).length>0&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(i.chrome&&i.chrome.loadTimes&&i.chrome.loadTimes()&&i.chrome.loadTimes().wasFetchedViaSpdy),this.j=t?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function $t(t){return!!t.h||!!t.g&&t.g.size>=t.j}function Jt(t){return t.h?1:t.g?t.g.size:0}function qt(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function zt(t,e){t.g?t.g.add(e):t.h=e}function Kt(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Qt(t){if(null!=t.h)return t.i.concat(t.h.G);if(null!=t.g&&0!==t.g.size){let e=t.i;for(const n of t.g.values())e=e.concat(n.G);return e}return h(t.i)}jt.prototype.cancel=function(){if(this.i=Qt(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const t of this.g.values())t.cancel();this.g.clear()}};var Wt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Yt(t){let e;this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1,t instanceof Yt?(this.l=t.l,Zt(this,t.j),this.o=t.o,this.g=t.g,te(this,t.u),this.h=t.h,ee(this,me(t.i)),this.m=t.m):t&&(e=String(t).match(Wt))?(this.l=!1,Zt(this,e[1]||"",!0),this.o=re(e[2]||""),this.g=re(e[3]||"",!0),te(this,e[4]),this.h=re(e[5]||"",!0),ee(this,e[6]||"",!0),this.m=re(e[7]||"")):(this.l=!1,this.i=new he(null,this.l))}function Xt(t){return new Yt(t)}function Zt(t,e,n){t.j=n?re(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function te(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.u=e}else t.u=null}function ee(t,e,n){e instanceof he?(t.i=e,function(t,e){e&&!t.j&&(de(t),t.i=null,t.g.forEach(function(t,e){const n=e.toLowerCase();e!=n&&(pe(this,e),ge(this,n,t))},t)),t.j=e}(t.i,t.l)):(n||(e=ie(e,le)),t.i=new he(e,t.l))}function ne(t,e,n){t.i.set(e,n)}function se(t){return ne(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function re(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function ie(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,oe),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function oe(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Yt.prototype.toString=function(){const t=[];var e=this.j;e&&t.push(ie(e,ae,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.o)&&t.push(ie(e,ae,!0),"@"),t.push(It(n).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.u)&&t.push(":",String(n))),(n=this.h)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(ie(n,"/"==n.charAt(0)?ce:Be,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.m)&&t.push("#",ie(n,ue)),t.join("")},Yt.prototype.resolve=function(t){const e=Xt(this);let n=!!t.j;n?Zt(e,t.j):n=!!t.o,n?e.o=t.o:n=!!t.g,n?e.g=t.g:n=null!=t.u;var s=t.h;if(n)te(e,t.u);else if(n=!!t.h){if("/"!=s.charAt(0))if(this.g&&!this.h)s="/"+s;else{var r=e.h.lastIndexOf("/");-1!=r&&(s=e.h.slice(0,r+1)+s)}if(".."==(r=s)||"."==r)s="";else if(-1!=r.indexOf("./")||-1!=r.indexOf("/.")){s=0==r.lastIndexOf("/",0),r=r.split("/");const t=[];for(let e=0;e<r.length;){const n=r[e++];"."==n?s&&e==r.length&&t.push(""):".."==n?((t.length>1||1==t.length&&""!=t[0])&&t.pop(),s&&e==r.length&&t.push("")):(t.push(n),s=!0)}s=t.join("/")}else s=r}return n?e.h=s:n=""!==t.i.toString(),n?ee(e,me(t.i)):n=!!t.m,n&&(e.m=t.m),e};var ae=/[#\/\?@]/g,Be=/[#\?:]/g,ce=/[#\?]/g,le=/[#\?@]/g,ue=/#/g;function he(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function de(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(let n=0;n<t.length;n++){const s=t[n].indexOf("=");let r,i=null;s>=0?(r=t[n].substring(0,s),i=t[n].substring(s+1)):r=t[n],e(r,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}function pe(t,e){de(t),e=we(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function fe(t,e){return de(t),e=we(t,e),t.g.has(e)}function Ce(t,e){de(t);let n=[];if("string"==typeof e)fe(t,e)&&(n=n.concat(t.g.get(we(t,e))));else for(t=Array.from(t.g.values()),e=0;e<t.length;e++)n=n.concat(t[e]);return n}function ge(t,e,n){pe(t,e),n.length>0&&(t.i=null,t.g.set(we(t,e),h(n)),t.h+=n.length)}function me(t){const e=new he;return e.i=t.i,t.g&&(e.g=new Map(t.g),e.h=t.h),e}function we(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}function ye(t,e,n,s,r){try{r&&(r.onload=null,r.onerror=null,r.onabort=null,r.ontimeout=null),s(n)}catch(t){}}function Ee(){this.g=new it}function _e(t){this.i=t.Sb||null,this.h=t.ab||!1}function De(t,e){Q.call(this),this.H=t,this.o=e,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 be(t){t.j.read().then(t.Ma.bind(t)).catch(t.ga.bind(t))}function ve(t){t.readyState=4,t.l=null,t.j=null,t.B=null,Ie(t)}function Ie(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function Te(t){let e="";return N(t,function(t,n){e+=n,e+=":",e+=t,e+="\r\n"}),e}function Oe(t,e,n){t:{for(s in n){var s=!1;break t}s=!0}s||(n=Te(n),"string"==typeof t?null!=n&&It(n):ne(t,e,n))}function Ae(t){Q.call(this),this.headers=new Map,this.L=t||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}(t=he.prototype).add=function(t,e){de(this),this.i=null,t=we(this,t);let n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},t.forEach=function(t,e){de(this),this.g.forEach(function(n,s){n.forEach(function(n){t.call(e,n,s,this)},this)},this)},t.set=function(t,e){return de(this),this.i=null,fe(this,t=we(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},t.get=function(t,e){return t&&(t=Ce(this,t)).length>0?String(t[0]):e},t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const t=[],e=Array.from(this.g.keys());for(let s=0;s<e.length;s++){var n=e[s];const r=It(n);n=Ce(this,n);for(let e=0;e<n.length;e++){let s=r;""!==n[e]&&(s+="="+It(n[e])),t.push(s)}}return this.i=t.join("&")},l(_e,ot),_e.prototype.g=function(){return new De(this.i,this.h)},l(De,Q),(t=De.prototype).open=function(t,e){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=t,this.D=e,this.readyState=1,Ie(this)},t.send=function(t){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 e={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};t&&(e.body=t),(this.H||i).fetch(new Request(this.D,e)).then(this.Pa.bind(this),this.ga.bind(this))},t.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,ve(this)),this.readyState=0},t.Pa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Ie(this)),this.g&&(this.readyState=3,Ie(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(void 0!==i.ReadableStream&&"body"in t){if(this.j=t.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;be(this)}else t.text().then(this.Oa.bind(this),this.ga.bind(this))},t.Ma=function(t){if(this.g){if(this.o&&t.value)this.response.push(t.value);else if(!this.o){var e=t.value?t.value:new Uint8Array(0);(e=this.B.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?ve(this):Ie(this),3==this.readyState&&be(this)}},t.Oa=function(t){this.g&&(this.response=this.responseText=t,ve(this))},t.Na=function(t){this.g&&(this.response=t,ve(this))},t.ga=function(){this.g&&ve(this)},t.setRequestHeader=function(t,e){this.A.append(t,e)},t.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const t=[],e=this.h.entries();for(var n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(De.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}}),l(Ae,Q);var Se=/^https?$/i,Re=["POST","PUT"];function Ne(t,e){t.h=!1,t.g&&(t.j=!0,t.g.abort(),t.j=!1),t.l=e,t.o=5,xe(t),Le(t)}function xe(t){t.A||(t.A=!0,W(t,"complete"),W(t,"error"))}function ke(t){if(t.h&&void 0!==r)if(t.v&&4==Fe(t))setTimeout(t.Ca.bind(t),0);else if(W(t,"readystatechange"),4==Fe(t)){t.h=!1;try{const r=t.ca();t:switch(r){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break t;default:e=!1}var n;if(!(n=e)){var s;if(s=0===r){let e=String(t.D).match(Wt)[1]||null;!e&&i.self&&i.self.location&&(e=i.self.location.protocol.slice(0,-1)),s=!Se.test(e?e.toLowerCase():"")}n=s}if(n)W(t,"complete"),W(t,"success");else{t.o=6;try{var o=Fe(t)>2?t.g.statusText:""}catch(t){o=""}t.l=o+" ["+t.ca()+"]",xe(t)}}finally{Le(t)}}}function Le(t,e){if(t.g){t.m&&(clearTimeout(t.m),t.m=null);const n=t.g;t.g=null,e||W(t,"ready");try{n.onreadystatechange=null}catch(t){}}}function Fe(t){return t.g?t.g.readyState:0}function Pe(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.F){case"":case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Me(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Ge(t){this.za=0,this.i=[],this.j=new yt,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=Me("failFast",!1,t),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=Me("baseRetryDelayMs",5e3,t),this.Za=Me("retryDelaySeedMs",1e4,t),this.Ta=Me("forwardChannelMaxRetries",2,t),this.va=Me("forwardChannelRequestTimeoutMs",2e4,t),this.ma=t&&t.xmlHttpFactory||void 0,this.Ua=t&&t.Rb||void 0,this.Aa=t&&t.useFetchStreams||!1,this.O=void 0,this.L=t&&t.supportsCrossDomainXhr||!1,this.M="",this.h=new jt(t&&t.concurrentRequestLimit),this.Ba=new Ee,this.S=t&&t.fastHandshake||!1,this.R=t&&t.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=t&&t.Pb||!1,t&&t.ua&&this.j.ua(),t&&t.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&t&&t.detectBufferingProxy||!1,this.ia=void 0,t&&t.longPollingTimeout&&t.longPollingTimeout>0&&(this.ia=t.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function He(t){if(Ve(t),3==t.I){var e=t.V++,n=Xt(t.J);if(ne(n,"SID",t.M),ne(n,"RID",e),ne(n,"TYPE","terminate"),Je(t,n),(e=new Ot(t,t.j,e)).M=2,e.A=se(Xt(n)),n=!1,i.navigator&&i.navigator.sendBeacon)try{n=i.navigator.sendBeacon(e.A.toString(),"")}catch(t){}!n&&i.Image&&((new Image).src=e.A,n=!0),n||(e.g=sn(e.j,null),e.g.ea(e.A)),e.F=Date.now(),Ft(e)}en(t)}function Ue(t){t.g&&(Qe(t),t.g.cancel(),t.g=null)}function Ve(t){Ue(t),t.v&&(i.clearTimeout(t.v),t.v=null),Ye(t),t.h.cancel(),t.m&&("number"==typeof t.m&&i.clearTimeout(t.m),t.m=null)}function je(t){if(!$t(t.h)&&!t.m){t.m=!0;var e=t.Ea;m||E(),w||(m(),w=!0),y.add(e,t),t.D=0}}function $e(t,e){var n;n=e?e.l:t.V++;const s=Xt(t.J);ne(s,"SID",t.M),ne(s,"RID",n),ne(s,"AID",t.K),Je(t,s),t.u&&t.o&&Oe(s,t.u,t.o),n=new Ot(t,t.j,n,t.D+1),null===t.u&&(n.J=t.o),e&&(t.i=e.G.concat(t.i)),e=qe(t,n,1e3),n.H=Math.round(.5*t.va)+Math.round(.5*t.va*Math.random()),zt(t.h,n),Nt(n,s,e)}function Je(t,e){t.H&&N(t.H,function(t,n){ne(e,n,t)}),t.l&&N({},function(t,n){ne(e,n,t)})}function qe(t,e,n){n=Math.min(t.i.length,n);const s=t.l?B(t.l.Ka,t.l,t):null;t:{var r=t.i;let e=-1;for(;;){const t=["count="+n];-1==e?n>0?(e=r[0].g,t.push("ofs="+e)):e=0:t.push("ofs="+e);let B=!0;for(let c=0;c<n;c++){var i=r[c].g;const n=r[c].map;if((i-=e)<0)e=Math.max(0,r[c].g-100),B=!1;else try{i="req"+i+"_"||"";try{var a=n instanceof Map?n:Object.entries(n);for(const[e,n]of a){let s=n;o(n)&&(s=st(n)),t.push(i+e+"="+encodeURIComponent(s))}}catch(e){throw t.push(i+"type="+encodeURIComponent("_badmap")),e}}catch(t){s&&s(n)}}if(B){a=t.join("&");break t}}a=void 0}return t=t.i.splice(0,n),e.G=t,a}function ze(t){if(!t.g&&!t.v){t.Y=1;var e=t.Da;m||E(),w||(m(),w=!0),y.add(e,t),t.A=0}}function Ke(t){return!(t.g||t.v||t.A>=3)&&(t.Y++,t.v=wt(B(t.Da,t),Ze(t,t.A)),t.A++,!0)}function Qe(t){null!=t.B&&(i.clearTimeout(t.B),t.B=null)}function We(t){t.g=new Ot(t,t.j,"rpc",t.Y),null===t.u&&(t.g.J=t.o),t.g.P=0;var e=Xt(t.na);ne(e,"RID","rpc"),ne(e,"SID",t.M),ne(e,"AID",t.K),ne(e,"CI",t.F?"0":"1"),!t.F&&t.ia&&ne(e,"TO",t.ia),ne(e,"TYPE","xmlhttp"),Je(t,e),t.u&&t.o&&Oe(e,t.u,t.o),t.O&&(t.g.H=t.O);var n=t.g;t=t.ba,n.M=1,n.A=se(Xt(e)),n.u=null,n.R=!0,xt(n,t)}function Ye(t){null!=t.C&&(i.clearTimeout(t.C),t.C=null)}function Xe(t,e){var n=null;if(t.g==e){Ye(t),Qe(t),t.g=null;var s=2}else{if(!qt(t.h,e))return;n=e.G,Kt(t.h,e),s=1}if(0!=t.I)if(e.o)if(1==s){n=e.u?e.u.length:0,e=Date.now()-e.F;var r=t.D;W(s=dt(),new mt(s,n)),je(t)}else ze(t);else if(3==(r=e.m)||0==r&&e.X>0||!(1==s&&function(t,e){return!(Jt(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.G.concat(t.i),0):1==t.I||2==t.I||t.D>=(t.Sa?0:t.Ta)||(t.m=wt(B(t.Ea,t,e),Ze(t,t.D)),t.D++,0)))}(t,e)||2==s&&Ke(t)))switch(n&&n.length>0&&(e=t.h,e.i=e.i.concat(n)),r){case 1:tn(t,5);break;case 4:tn(t,10);break;case 3:tn(t,6);break;default:tn(t,2)}}function Ze(t,e){let n=t.Qa+Math.floor(Math.random()*t.Za);return t.isActive()||(n*=2),n*e}function tn(t,e){if(t.j.info("Error code "+e),2==e){var n=B(t.bb,t),s=t.Ua;const e=!s;s=new Yt(s||"//www.google.com/images/cleardot.gif"),i.location&&"http"==i.location.protocol||Zt(s,"https"),se(s),e?function(t,e){const n=new yt;if(i.Image){const s=new Image;s.onload=c(ye,n,"TestLoadImage: loaded",!0,e,s),s.onerror=c(ye,n,"TestLoadImage: error",!1,e,s),s.onabort=c(ye,n,"TestLoadImage: abort",!1,e,s),s.ontimeout=c(ye,n,"TestLoadImage: timeout",!1,e,s),i.setTimeout(function(){s.ontimeout&&s.ontimeout()},1e4),s.src=t}else e(!1)}(s.toString(),n):function(t,e){new yt;const n=new AbortController,s=setTimeout(()=>{n.abort(),ye(0,0,!1,e)},1e4);fetch(t,{signal:n.signal}).then(t=>{clearTimeout(s),t.ok?ye(0,0,!0,e):ye(0,0,!1,e)}).catch(()=>{clearTimeout(s),ye(0,0,!1,e)})}(s.toString(),n)}else gt(2);t.I=0,t.l&&t.l.pa(e),en(t),Ve(t)}function en(t){if(t.I=0,t.ja=[],t.l){const e=Qt(t.h);0==e.length&&0==t.i.length||(d(t.ja,e),d(t.ja,t.i),t.h.i.length=0,h(t.i),t.i.length=0),t.l.oa()}}function nn(t,e,n){var s=n instanceof Yt?Xt(n):new Yt(n);if(""!=s.g)e&&(s.g=e+"."+s.g),te(s,s.u);else{var r=i.location;s=r.protocol,e=e?e+"."+r.hostname:r.hostname,r=+r.port;const t=new Yt(null);s&&Zt(t,s),e&&(t.g=e),r&&te(t,r),n&&(t.h=n),s=t}return n=t.G,e=t.wa,n&&e&&ne(s,n,e),ne(s,"VER",t.ka),Je(t,s),s}function sn(t,e,n){if(e&&!t.L)throw Error("Can't create secondary domain capable XhrIo object.");return(e=t.Aa&&!t.ma?new Ae(new _e({ab:n})):new Ae(t.ma)).Fa(t.L),e}function rn(){}function on(){}function an(t,e){Q.call(this),this.g=new Ge(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.o=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.sa&&(t?t["X-WebChannel-Client-Profile"]=e.sa:t={"X-WebChannel-Client-Profile":e.sa}),this.g.U=t,(t=e&&e.Qb)&&!I(t)&&(this.g.u=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!I(e)&&(this.g.G=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ln(this)}function Bn(t){ct.call(this),t.__headers__&&(this.headers=t.__headers__,this.statusCode=t.__status__,delete t.__headers__,delete t.__status__);var e=t.__sm__;if(e){t:{for(const n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function cn(){lt.call(this),this.status=1}function ln(t){this.g=t}(t=Ae.prototype).Fa=function(t){this.H=t},t.ea=function(t,e,n,s){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+t);e=e?e.toUpperCase():"GET",this.D=t,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():_t.g(),this.g.onreadystatechange=u(B(this.Ca,this));try{this.B=!0,this.g.open(e,String(t),!0),this.B=!1}catch(t){return void Ne(this,t)}if(t=n||"",n=new Map(this.headers),s)if(Object.getPrototypeOf(s)===Object.prototype)for(var r in s)n.set(r,s[r]);else{if("function"!=typeof s.keys||"function"!=typeof s.get)throw Error("Unknown input type for opt_headers: "+String(s));for(const t of s.keys())n.set(t,s.get(t))}s=Array.from(n.keys()).find(t=>"content-type"==t.toLowerCase()),r=i.FormData&&t instanceof i.FormData,!(Array.prototype.indexOf.call(Re,e,void 0)>=0)||s||r||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[t,e]of n)this.g.setRequestHeader(t,e);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(t),this.v=!1}catch(t){Ne(this,t)}},t.abort=function(t){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=t||7,W(this,"complete"),W(this,"abort"),Le(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Le(this,!0)),Ae.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?ke(this):this.Xa())},t.Xa=function(){ke(this)},t.isActive=function(){return!!this.g},t.ca=function(){try{return Fe(this)>2?this.g.status:-1}catch(t){return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},t.La=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),rt(e)}},t.ya=function(){return this.o},t.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(t=Ge.prototype).ka=8,t.I=1,t.connect=function(t,e,n,s){gt(0),this.W=t,this.H=e||{},n&&void 0!==s&&(this.H.OSID=n,this.H.OAID=s),this.F=this.X,this.J=nn(this,null,this.W),je(this)},t.Ea=function(t){if(this.m)if(this.m=null,1==this.I){if(!t){this.V=Math.floor(1e5*Math.random()),t=this.V++;const r=new Ot(this,this.j,t);let i=this.o;if(this.U&&(i?(i=x(i),L(i,this.U)):i=this.U),null!==this.u||this.R||(r.J=i,i=null),this.S)t:{for(var e=0,n=0;n<this.i.length;n++){var s=this.i[n];if(void 0===(s="__data__"in s.map&&"string"==typeof(s=s.map.__data__)?s.length:void 0))break;if((e+=s)>4096){e=n;break t}if(4096===e||n===this.i.length-1){e=n+1;break t}}e=1e3}else e=1e3;e=qe(this,r,e),ne(n=Xt(this.J),"RID",t),ne(n,"CVER",22),this.G&&ne(n,"X-HTTP-Session-Id",this.G),Je(this,n),i&&(this.R?e="headers="+It(Te(i))+"&"+e:this.u&&Oe(n,this.u,i)),zt(this.h,r),this.Ra&&ne(n,"TYPE","init"),this.S?(ne(n,"$req",e),ne(n,"SID","null"),r.U=!0,Nt(r,n,null)):Nt(r,n,e),this.I=2}}else 3==this.I&&(t?$e(this,t):0==this.i.length||$t(this.h)||$e(this))},t.Da=function(){if(this.v=null,We(this),this.aa&&!(this.P||null==this.g||this.T<=0)){var t=4*this.T;this.j.info("BP detection timer enabled: "+t),this.B=wt(B(this.Wa,this),t)}},t.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,gt(10),Ue(this),We(this))},t.Va=function(){null!=this.C&&(this.C=null,Ue(this),Ke(this),gt(19))},t.bb=function(t){t?(this.j.info("Successfully pinged google.com"),gt(2)):(this.j.info("Failed to ping google.com"),gt(1))},t.isActive=function(){return!!this.l&&this.l.isActive(this)},(t=rn.prototype).ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){},on.prototype.g=function(t,e){return new an(t,e)},l(an,Q),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(){He(this.g)},an.prototype.o=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=st(t),t=n);e.i.push(new Vt(e.Ya++,t)),3==e.I&&je(e)},an.prototype.N=function(){this.g.l=null,delete this.j,He(this.g),delete this.g,an.Z.N.call(this)},l(Bn,ct),l(cn,lt),l(ln,rn),ln.prototype.ra=function(){W(this.g,"a")},ln.prototype.qa=function(t){W(this.g,new Bn(t))},ln.prototype.pa=function(t){W(this.g,new cn)},ln.prototype.oa=function(){W(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,iB=function(){return new on},rB=function(){return dt()},sB=ut,nB={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},Dt.NO_ERROR=0,Dt.TIMEOUT=8,Dt.HTTP_ERROR=6,eB=Dt,bt.COMPLETE="complete",tB=bt,at.EventType=Bt,Bt.OPEN="a",Bt.CLOSE="b",Bt.ERROR="c",Bt.MESSAGE="d",Q.prototype.listen=Q.prototype.J,Za=at,Ae.prototype.listenOnce=Ae.prototype.K,Ae.prototype.getLastError=Ae.prototype.Ha,Ae.prototype.getLastErrorCode=Ae.prototype.ya,Ae.prototype.getStatus=Ae.prototype.ca,Ae.prototype.getResponseJson=Ae.prototype.La,Ae.prototype.getResponseText=Ae.prototype.la,Ae.prototype.send=Ae.prototype.ea,Ae.prototype.setWithCredentials=Ae.prototype.Fa,Xa=Ae}).apply(void 0!==oB?oB:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var aB=class t{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 LOOKBEHIND=512;static MATCH_NL=t.CLASS_NL|t.DOT_NL;static PERL=t.CLASS_NL|t.ONE_LINE|t.PERL_X|t.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2};const BB=1,cB=2,lB=4,uB=8,hB=16,dB=512,pB=128,fB=new Int32Array(pB),CB=new Int32Array(pB),gB=65535;for(let t=0;t<pB;t++)fB[t]=t>=97&&t<=122?t-32:t,CB[t]=t>=65&&t<=90?t+32:t;var mB=class{static CODES=Object.freeze({"":7,"\b":8,"\t":9,"\n":10,"\v":11,"\f":12,"\r":13," ":32,'"':34,$:36,"&":38,"'":39,"(":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,"`":96,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(t){if(t<pB)return fB[t];const e=String.fromCodePoint(t).toUpperCase(),n=e.codePointAt(0)>gB?2:1;if(e.length>n)return t;const s=String.fromCodePoint(e.codePointAt(0)).toLowerCase(),r=s.codePointAt(0)>gB?2:1;return s.length>r||s.codePointAt(0)!==t?t:e.codePointAt(0)}static toLowerCase(t){if(t<pB)return CB[t];const e=String.fromCodePoint(t).toLowerCase(),n=e.codePointAt(0)>gB?2:1;if(e.length>n)return t;const s=String.fromCodePoint(e.codePointAt(0)).toUpperCase(),r=s.codePointAt(0)>gB?2:1;return s.length>r||s.codePointAt(0)!==t?t:e.codePointAt(0)}},wB=class{constructor(t,e=!1){this.data=t,this.isStride1=e,this.SIZE=e?2:3}getLo(t){return this.data[t*this.SIZE]}getHi(t){return this.data[t*this.SIZE+1]}getStride(t){return this.isStride1?1:this.data[t*this.SIZE+2]}get length(){return this.data.length/this.SIZE}};const yB=new Uint8Array(256);for(let t=0;t<64;t++)yB["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-".charCodeAt(t)]=t;const EB=t=>{const e=[];let n=0,s=0;for(let r=0;r<t.length;r++){const i=yB[t.charCodeAt(r)];n|=(31&i)<<s,32&i?s+=5:(e.push(n),n=0,s=0)}return e},_B=(t,e)=>{const n=EB(t),s=e?n.length/2:n.length/3,r=new Uint32Array(3*s);let i=0,o=0;for(let t=0;t<s;t++)i+=n[o++],r[3*t]=i,i+=n[o++],r[3*t+1]=i,r[3*t+2]=e?1:n[o++];return r};var DB=class{constructor(t){this.initializer=t,this.cache=new Map}has(t){return t in this.initializer}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.initializer[t],n=e?e():null;return this.cache.set(t,n),n}},bB=class{static _CASE_ORBIT=null;static get CASE_ORBIT(){return this._CASE_ORBIT||(this._CASE_ORBIT=(t=>{const e=EB(t),n=new Map;let s=0;for(let t=0;t<e.length;t+=2){s+=e[t];const r=e[t+1],i=r>>>1^-(1&r);n.set(s,s+i)}return n})("rCgCIgCY+rQI4QiCuuBLgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCCgCBgCBgCBgCBgCBgCBgCB+7OB-BB-BB-BB-BB-BBskQB-BB-BB-BB-BB-BB-BB-BB-BB-BB-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B1BBB",!1)),Armenian:()=>new wB(_B("xpBlBDxBDCks9BE",!0)),Avestan:()=>new wB(_B("g4iC1BEG",!0)),Balinese:()=>new wB(_B("g4GsCCxB",!0)),Bamum:()=>new wB(_B("g1pB3CpowB4R",!0)),Bassa_Vah:()=>new wB(_B("w26CdDF",!0)),Batak:()=>new wB(_B("g+GzBJD",!0)),Bengali:()=>new wB(_B("gsCDBCHBDBBDVBCGBCEEBCBDIBDBBDDBJFFBCCBDBDYB",!1)),Beria_Erfe:()=>new wB(_B("g17CYDY",!0)),Bhaiksuki:()=>new wB(_B("ggnCICsBCNLc",!0)),Bopomofo:()=>new wB(_B("qXB6wLqBxDf",!0)),Brahmi:()=>new wB(_B("ggkCtCFjBKA",!0)),Braille:()=>new wB(_B("ggK-H",!0)),Buginese:()=>new wB(_B("gwGbDB",!0)),Buhid:()=>new wB(_B("g6FT",!0)),Canadian_Aboriginal:()=>new wB(_B("ggF-TxRlC7tgCP",!0)),Carian:()=>new wB(_B("g1gCwB",!0)),Caucasian_Albanian:()=>new wB(_B("wphCzBMA",!0)),Chakma:()=>new wB(_B("gokC0BCR",!0)),Cham:()=>new wB(_B("gwqB2BKNDJDD",!0)),Cherokee:()=>new wB(_B("g9E1CDFz7lBvC",!0)),Chorasmian:()=>new wB(_B("w9jCb",!0)),Common:()=>new wB(_B("AgCBbFBbuBBCOBCEBYgBgBiOmBBGEBDTB1DKKHCC+THHPEEhB9E9ElQiEiEB6mB6mB2MDBjJwvBwvBBBBoCBBsGBBCumBumBOIIBCBCFBCCBDmYmYBKBD2CBCKBEKBCOBShBB-BlBBCCBDFBCaBCQBqBCBF5UBXKBW-cBhIzTBDpEBhQ9CBzMUBCCCBXBQHBFDB8CBBE7C7CB0E0EBOBhBlBBKxBxBB+BBgBwCBwB5C5CBmFBhuG-BBhoWhBBnDCBmFJB1HhFhFsMPPBzuUzuUBxGxGBIBXiBBCSBCDB0ECCBeBbFBbKBLuBuBBhChCBFBCGBLEBjICBFsBBEIBxCMB0BsBBlHaBltuBDB96D8HBEzNBHWBQQBgDzDB9B1HBLmBBD9BBEQBJBBIdBF8BB2GTBNTBN2CBKYBoE0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBDxBByjFjCBtC8BBjWrBBFjDBNOBDOBCOBCkBBLtFB5BZBCBBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBCmDBnghYffB+CB",!1)),Coptic:()=>new wB(_B("ifNxkKzDGG",!0)),Cuneiform:()=>new wB(_B("ggoC5cnDuDCEMjG",!0)),Cypriot:()=>new wB(_B("ggiCFBDCCBqBBCBBEDD",!1)),Cypro_Minoan:()=>new wB(_B("w8rCiD",!0)),Cyrillic:()=>new wB(_B("ggBkEBDoFBx6FKBhFtCtCojEfBhie-CBv8VBBhw4B9BBiBAB",!1)),Deseret:()=>new wB(_B("gghCvC",!0)),Devanagari:()=>new wB(_B("goCwCFODZh7nBfhwcJ",!0)),Dives_Akuru:()=>new wB(_B("gomCGBDDDBGBCBBCdBCBBDLBKJB",!1)),Dogra:()=>new wB(_B("ggmC7B",!0)),Duployan:()=>new wB(_B("ggvDqDGMEIIJDD",!0)),Egyptian_Hieroglyphs:()=>new wB(_B("ggsC1iBL68D",!0)),Elbasan:()=>new wB(_B("gohCnB",!0)),Elymaic:()=>new wB(_B("g-jCW",!0)),Ethiopic:()=>new wB(_B("gwEoCBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBDfBEZBnvGWBKGBCGBCGBCGBCGBCGBCGBCGBjpfFBDFBDFBKGBCGBylvCGBCDBCBBCOB",!1)),Garay:()=>new wB(_B("gqjClBEcJB",!0)),Georgian:()=>new wB(_B("glElBBCGGDqBBCDBx8CqBBDCBhiElBBCGG",!1)),Glagolitic:()=>new wB(_B("ggL-Ch9sDGCQDGCBCE",!0)),Gothic:()=>new wB(_B("w5gCa",!0)),Grantha:()=>new wB(_B("g4kCDBCHBDBBDVBCGBCBBCEBDIBDBBDCBDHHGGBDGBEEB",!1)),Greek:()=>new wB(_B("wbDBCCBDDBCFFCCCBBBCCCBSBC+BBPPBnpGEBzBEBFEB1ChKhKBUBDFBDlBBDFBDHBCGCBdBD0BBCOBCNBDFBCSBDCBCIBoJ-xiB-xiB7uVuCBSgj0Bgj0BBkCB",!1)),Gujarati:()=>new wB(_B("h0CCBCIBCCBCVBCGBCBBCEBDJBCCBCCBDQQBCBDLBIGB",!1)),Gunjala_Gondi:()=>new wB(_B("grnCFCBCkBCBCFIJ",!0)),Gurmukhi:()=>new wB(_B("hwCCBCFBFBBDVBCGBCBBCBBCBBDCCBDBFBBDCBEIIBCBCIIBPB",!1)),Gurung_Khema:()=>new wB(_B("go4C5B",!0)),Han:()=>new wB(_B("g0LZBC4CBN1GBwBCCaIBPDBle-tGBhC-vUBhoWtLBDpDBpodBBNGBqgkB-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Hangul:()=>new wB(_B("goE-HvxHBiI9CyDeiCei3dckUj9KNWFwBl9JeEFDFDFDC",!0)),Hanifi_Rohingya:()=>new wB(_B("gojCnBJJ",!0)),Hanunoo:()=>new wB(_B("g5FU",!0)),Hatran:()=>new wB(_B("gniCSCBGE",!0)),Hebrew:()=>new wB(_B("xsB2BBJaBFFBpp9BZBCEBCCCBCCBCCBIB",!1)),Hiragana:()=>new wB(_B("hiM1CBHCBi7-C+IBTeeBBBulQAB",!1)),Imperial_Aramaic:()=>new wB(_B("giiCVCI",!0)),Inherited:()=>new wB(_B("gYvDB2IBBlOKBbhXhXBCB8qEtBBDLBlPCBCMBCGBFHHEBBnG-BBtQBBjGgBB65DDBsDBBmrzBPBRNBwejHjH7iEl+uBl+uBBsBBDWBhRCBSHBDGBfDBz6rYvHB",!1)),Inscriptional_Pahlavi:()=>new wB(_B("g7iCSGH",!0)),Inscriptional_Parthian:()=>new wB(_B("g6iCVDH",!0)),Javanese:()=>new wB(_B("gsqBtCDJFB",!0)),Kaithi:()=>new wB(_B("gkkCiCLA",!0)),Kannada:()=>new wB(_B("gkDMCCCWCJCEDICCCDIBGCCDDJCC",!0)),Katakana:()=>new wB(_B("hlM5CBDCBxHPBxGuBBC3CBvgzBJBCsBBzisBDBCGBCBBCgJgJBBBzBPPBCB",!1)),Kawi:()=>new wB(_B("g4nCQCoBEc",!0)),Kayah_Li:()=>new wB(_B("goqBtBCA",!0)),Kharoshthi:()=>new wB(_B("gwiCDCBGHCCCcDCFJII",!0)),Khitan_Small_Script:()=>new wB(_B("k-7C84G84GB0OBqBAB",!1)),Khmer:()=>new wB(_B("g8F9CDJHJnPf",!0)),Khojki:()=>new wB(_B("gwkCRCuB",!0)),Khudawadi:()=>new wB(_B("w1kC6BGJ",!0)),Kirat_Rai:()=>new wB(_B("gq7C5B",!0)),Lao:()=>new wB(_B("h0DBBCCCBDBCXBCCCBVBDEBCCCBFBCJBDDB",!1)),Latin:()=>new wB(_B("hCZBHZBwBQQGWBCeBCgOBoBEB8wGlBBHwBBGDBGMBClCBiC-HByLOORMBuEBBHccSoBB42CfBj1elDBExCBVOBxZqBBCIBCDB38TGB7gBZBHZBmhCFBCpBBCIBm61BeBHFB",!1)),Lepcha:()=>new wB(_B("ggH3BEOEC",!0)),Limbu:()=>new wB(_B("goGeBCLBFLBFEEBKB",!1)),Linear_A:()=>new wB(_B("gwhC2JKVLH",!0)),Linear_B:()=>new wB(_B("gggCLCZCSCBCODNjB6D",!0)),Lisu:()=>new wB(_B("wmpBvBx1eA",!0)),Lycian:()=>new wB(_B("g0gCc",!0)),Lydian:()=>new wB(_B("gpiCZGA",!0)),Mahajani:()=>new wB(_B("wqkCmB",!0)),Makasar:()=>new wB(_B("g3nCY",!0)),Malayalam:()=>new wB(_B("goDMCCCyBCCCFFPDZ",!0)),Mandaic:()=>new wB(_B("giCbDA",!0)),Manichaean:()=>new wB(_B("g2iCmBFL",!0)),Marchen:()=>new wB(_B("wjnCfDVCN",!0)),Masaram_Gondi:()=>new wB(_B("gonCGBCBBCrBBECCBCCBHBJJB",!1)),Medefaidrin:()=>new wB(_B("gy7C6C",!0)),Meetei_Mayek:()=>new wB(_B("g3qBWqGtBDJ",!0)),Mende_Kikakui:()=>new wB(_B("gg6DkGDP",!0)),Meroitic_Cursive:()=>new wB(_B("gtiCXFTDtB",!0)),Meroitic_Hieroglyphs:()=>new wB(_B("gsiCf",!0)),Miao:()=>new wB(_B("g47CqCF4BIQ",!0)),Modi:()=>new wB(_B("gwlCkCMJ",!0)),Mongolian:()=>new wB(_B("ggGBBDCCBSBH4CBIqBB2t-BMB",!1)),Mro:()=>new wB(_B("gy6CeCJFB",!0)),Multani:()=>new wB(_B("g0kCGBCCCBCBCOBCKB",!1)),Myanmar:()=>new wB(_B("ggE-EhqmBeiDfxibT",!0)),Nabataean:()=>new wB(_B("gkiCeJI",!0)),Nag_Mundari:()=>new wB(_B("wm5DpB",!0)),Nandinagari:()=>new wB(_B("gtmCHDtBDK",!0)),New_Tai_Lue:()=>new wB(_B("gsGrBFZHKEB",!0)),Newa:()=>new wB(_B("gglC7CCE",!0)),Nko:()=>new wB(_B("g+B6BDC",!0)),Nushu:()=>new wB(_B("h-7CvsQvsQBqMB",!1)),Nyiakeng_Puachue_Hmong:()=>new wB(_B("go4DsBENDJFB",!0)),Ogham:()=>new wB(_B("g0Fc",!0)),Ol_Chiki:()=>new wB(_B("wiHvB",!0)),Ol_Onal:()=>new wB(_B("wu5DqBFA",!0)),Old_Hungarian:()=>new wB(_B("gkjCyBOyBIF",!0)),Old_Italic:()=>new wB(_B("g4gCjBKC",!0)),Old_North_Arabian:()=>new wB(_B("g0iCf",!0)),Old_Permic:()=>new wB(_B("w6gCqB",!0)),Old_Persian:()=>new wB(_B("g9gCjBFN",!0)),Old_Sogdian:()=>new wB(_B("g4jCnB",!0)),Old_South_Arabian:()=>new wB(_B("gziCf",!0)),Old_Turkic:()=>new wB(_B("ggjCoC",!0)),Old_Uyghur:()=>new wB(_B("w7jCZ",!0)),Oriya:()=>new wB(_B("h4CCCHDBDVCGCBCEDIDBDCICFBCEDR",!0)),Osage:()=>new wB(_B("wlhCjBFjB",!0)),Osmanya:()=>new wB(_B("gkhCdDJ",!0)),Pahawh_Hmong:()=>new wB(_B("g46ClCLJCGCUGS",!0)),Palmyrene:()=>new wB(_B("gjiCf",!0)),Pau_Cin_Hau:()=>new wB(_B("g2mC4B",!0)),Phags_Pa:()=>new wB(_B("giqB3B",!0)),Phoenician:()=>new wB(_B("goiCbEA",!0)),Psalter_Pahlavi:()=>new wB(_B("g8iCRIDNG",!0)),Rejang:()=>new wB(_B("wpqBjBMA",!0)),Runic:()=>new wB(_B("g1FqCEK",!0)),Samaritan:()=>new wB(_B("ggCtBDO",!0)),Saurashtra:()=>new wB(_B("gkqBlCJL",!0)),Sharada:()=>new wB(_B("gskC-ChsCH",!0)),Shavian:()=>new wB(_B("wihCvB",!0)),Siddham:()=>new wB(_B("gslC1BDlB",!0)),Sidetic:()=>new wB(_B("gqiCZ",!0)),SignWriting:()=>new wB(_B("gg2DrUQECO",!0)),Sinhala:()=>new wB(_B("hsDCBCRBEXBCIBCDDBFBEFFBEBCCCBGBHJBDCBt-gCTB",!1)),Sogdian:()=>new wB(_B("w5jCpB",!0)),Sora_Sompeng:()=>new wB(_B("wmkCYIJ",!0)),Soyombo:()=>new wB(_B("wymCyC",!0)),Sundanese:()=>new wB(_B("g8G-BhIH",!0)),Sunuwar:()=>new wB(_B("g+mChBPJ",!0)),Syloti_Nagri:()=>new wB(_B("ggqBsB",!0)),Syriac:()=>new wB(_B("g4BNC7BDCxIK",!0)),Tagalog:()=>new wB(_B("g4FVKA",!0)),Tagbanwa:()=>new wB(_B("g7FMCCCB",!0)),Tai_Le:()=>new wB(_B("wqGdDE",!0)),Tai_Tham:()=>new wB(_B("gxG+BCcDKHJHN",!0)),Tai_Viet:()=>new wB(_B("g0qBiCZE",!0)),Tai_Yo:()=>new wB(_B("g25DeCVJB",!0)),Takri:()=>new wB(_B("g0lC5BHJ",!0)),Tamil:()=>new wB(_B("i8CBBCFBECBCDBEBBCCCBEEBEEBBBELBFEBECBCDBDHHPUBm+kCxBBOAB",!1)),Tangsa:()=>new wB(_B("wz6CuCCJ",!0)),Tangut:()=>new wB(_B("g-7CgBgBB+3GBhQeBiDyDB",!1)),Telugu:()=>new wB(_B("ggDMCCCWCPDICCCDIBCCCBDDDJII",!0)),Thaana:()=>new wB(_B("g8BxB",!0)),Thai:()=>new wB(_B("hwD5BGb",!0)),Tibetan:()=>new wB(_B("g4DnCCjBFmBCjBCOCGFB",!0)),Tifinagh:()=>new wB(_B("wpL3BIBPA",!0)),Tirhuta:()=>new wB(_B("gklCnCJJ",!0)),Todhri:()=>new wB(_B("guhCzB",!0)),Tolong_Siki:()=>new wB(_B("wtnCrBFJ",!0)),Toto:()=>new wB(_B("w04De",!0)),Tulu_Tigalari:()=>new wB(_B("g8kCJBCDDClBBCJBCDDCDBCJBCBBJBB",!1)),Ugaritic:()=>new wB(_B("g8gCdCA",!0)),Unknown:()=>new wB(_B("4bBBHDBICCVuMuMnBBBzBBBE4B4BBGBcDBHKBvI9B9BBmDmDBMB8BBByBBBQddBCCMEBjBEBuHJJBDDBXXICCBBBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ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J3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMB3iBJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBJ76DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBjGUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIm8yVBCdBhD-DBxHvw-FB",!1)),Vai:()=>new wB(_B("gopBrJ",!0)),Vithkuqi:()=>new wB(_B("wrhCKCOCGCBCKCOCGCB",!0)),Wancho:()=>new wB(_B("g24D5BGA",!0)),Warang_Citi:()=>new wB(_B("glmCyCNA",!0)),Yezidi:()=>new wB(_B("g0jCpBCCDB",!0)),Yi:()=>new wB(_B("ggoBskBE2B",!0)),Zanabazar_Square:()=>new wB(_B("gwmCnC",!0))});static FOLD_CATEGORIES=new DB({L:()=>new wB(_B("laA",!0)),LC:()=>new wB(_B("laA",!0)),Ll:()=>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vB=class t{static MAX_RUNE=1114111;static RUNE_ERROR=65533;static isUnsearchable(e){return e===t.RUNE_ERROR||e>=t.MIN_HIGH_SURROGATE&&e<=t.MAX_LOW_SURROGATE}static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static MIN_HIGH_SURROGATE=55296;static MAX_HIGH_SURROGATE=56319;static MIN_LOW_SURROGATE=56320;static MAX_LOW_SURROGATE=57343;static MIN_SUPPLEMENTARY_CODE_POINT=65536;static is32(t,e){let n=0,s=t.length;for(;n<s;){const r=n+Math.floor((s-n)/2),i=t.getLo(r),o=t.getHi(r);if(i<=e&&e<=o){return(e-i)%t.getStride(r)===0}e<i?s=r:n=r+1}return!1}static is(e,n){if(n<=t.MAX_LATIN1){for(let t=0;t<e.length;t++){if(n>e.getHi(t))continue;const s=e.getLo(t);if(n<s)return!1;return(n-s)%e.getStride(t)===0}return!1}return e.length>0&&n>=e.getLo(0)&&t.is32(e,n)}static isPrint(e){return e<=t.MAX_LATIN1?e>=32&&e<t.MAX_ASCII||e>=161&&173!==e:t.is(bB.Print,e)}static simpleFold(e){if(bB.CASE_ORBIT.has(e))return bB.CASE_ORBIT.get(e);if(e<=t.MAX_ASCII){const t=mB.toLowerCase(e);return t!==e?t:mB.toUpperCase(e)}return e}static equalsIgnoreCase(e,n){if(e===n)return!0;if(e<0||n<0)return!1;if(e<=t.MAX_ASCII&&n<=t.MAX_ASCII)return 65<=e&&e<=90&&(e|=32),65<=n&&n<=90&&(n|=32),e===n;for(let s=t.simpleFold(e);s!==e;s=t.simpleFold(s))if(s===n)return!0;return!1}};const IB=new Uint8Array(256);for(let t=0;t<256;t++)IB[t]=97<=t&&t<=122||65<=t&&t<=90||48<=t&&t<=57||95===t?1:0;let TB=null,OB=null;var AB=class t{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 isByteArray(t){return Array.isArray(t)||"[object Uint8Array]"===Object.prototype.toString.call(t)}static isalnum(t){return mB.CODES[0]<=t&&t<=mB.CODES[9]||mB.CODES.a<=t&&t<=mB.CODES.z||mB.CODES.A<=t&&t<=mB.CODES.Z}static unhex(t){return mB.CODES[0]<=t&&t<=mB.CODES[9]?t-mB.CODES[0]:mB.CODES.a<=t&&t<=mB.CODES.f?t-mB.CODES.a+10:mB.CODES.A<=t&&t<=mB.CODES.F?t-mB.CODES.A+10:-1}static escapeRune(e){let n="";if(vB.isPrint(e))t.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(n+="\\"),n+=String.fromCodePoint(e);else switch(e){case mB.CODES['"']:n+='\\"';break;case mB.CODES["\\"]:n+="\\\\";break;case mB.CODES["\t"]:n+="\\t";break;case mB.CODES["\n"]:n+="\\n";break;case mB.CODES["\r"]:n+="\\r";break;case mB.CODES["\b"]:n+="\\b";break;case mB.CODES["\f"]:n+="\\f";break;default:{let t=e.toString(16);e<256?(n+="\\x",1===t.length&&(n+="0"),n+=t):n+=`\\x{${t}}`;break}}return n}static stringToRunes(t){const e=String(t),n=[];let s=0;for(;s<e.length;){const t=e.codePointAt(s);n.push(t),s+=t>vB.MAX_BMP?2:1}return new Int32Array(n)}static runeToString(t){return String.fromCodePoint(t)}static isWordRune(t){return t<256&&1===IB[t]}static emptyOpContext(e,n){let s=0;return e<0&&(s|=t.EMPTY_BEGIN_TEXT|t.EMPTY_BEGIN_LINE),10===e&&(s|=t.EMPTY_BEGIN_LINE),n<0&&(s|=t.EMPTY_END_TEXT|t.EMPTY_END_LINE),10===n&&(s|=t.EMPTY_END_LINE),t.isWordRune(e)!==t.isWordRune(n)?s|=t.EMPTY_WORD_BOUNDARY:s|=t.EMPTY_NO_WORD_BOUNDARY,s}static quoteMeta(e){return e.split("").map(e=>t.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join("")}static charCount(t){return t>vB.MAX_BMP?2:1}static toArray(t){const e=t.length,n=new Array(e);for(let s=0;s<e;s++)n[s]=t[s];return n}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return TB||(TB=new TextEncoder),TB.encode(t);{let e=[],n=0;for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):(64512&r)===vB.MIN_HIGH_SURROGATE&&s+1<t.length&&(64512&t.charCodeAt(s+1))===vB.MIN_LOW_SURROGATE?(r=vB.MIN_SUPPLEMENTARY_CODE_POINT+((1023&r)<<10)+(1023&t.charCodeAt(++s)),e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder){OB||(OB=new TextDecoder("utf-8"));const e=t instanceof Uint8Array?t:new Uint8Array(t);return OB.decode(e)}{let e=[],n=0,s=0;for(;n<t.length;){let r=t[n++];if(r<128)e[s++]=String.fromCharCode(r);else if(r>191&&r<224){let i=t[n++];e[s++]=String.fromCharCode((31&r)<<6|63&i)}else if(r>239&&r<365){let i=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-vB.MIN_SUPPLEMENTARY_CODE_POINT;e[s++]=String.fromCharCode(vB.MIN_HIGH_SURROGATE+(i>>10)),e[s++]=String.fromCharCode(vB.MIN_LOW_SURROGATE+(1023&i))}else{let i=t[n++],o=t[n++];e[s++]=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o)}}return e.join("")}}};const SB=(t=[],e=0)=>{const n=Object.create(null);for(let s=0;s<t.length;s++){const r=t[s],i=e+s;n[r]=i,n[i]=r}return Object.freeze(n)};var RB=class t{static Encoding=SB(["UTF_16","UTF_8"]);getEncoding(){throw Error("not implemented")}asCharSequence(){throw Error("not implemented")}asBytes(){throw Error("not implemented")}length(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===t.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===t.Encoding.UTF_16}},NB=class extends RB{constructor(t=null){super(),this.bytes=t}getEncoding(){return RB.Encoding.UTF_8}asCharSequence(){return AB.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},xB=class extends RB{constructor(t=null){super(),this.charSequence=t}getEncoding(){return RB.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return AB.stringToUtf8ByteArray(this.charSequence.toString())}length(){return this.charSequence.length}},kB=class{static utf16(t){return new xB(t)}static utf8(t){return AB.isByteArray(t)?new NB(t):new NB(AB.stringToUtf8ByteArray(t))}},LB=class{static EOF(){return-8}constructor(){this.start=0,this.end=0}canCheckPrefix(){return!0}endPos(){return this.end-this.start}hasString(){return!1}hasAnyString(){return!1}prefixLength(){return 0}},FB=class t extends LB{static RUNE_ERROR_STEP=vB.RUNE_ERROR<<3|1;constructor(t,e=0,n=t.length){super(),this.bytes=t,this.start=e,this.end=n}hasString(t,e){const n=t.bytes;if(0===n.length)return!0;const s=this.indexOf(this.bytes,n,this.start+e);return-1!==s&&s<=this.end-n.length}hasAnyString(t,e){return t.automaton8().searchUTF8(this.bytes,this.start+e,this.end)}step(e){if((e+=this.start)>=this.end)return LB.EOF();const n=255&this.bytes[e];if(n<128)return n<<3|1;let s,r,i=128,o=191;if(n>=194&&n<=223)s=2,r=31&n;else if(n>=224&&n<=239)s=3,r=15&n,224===n?i=160:237===n&&(o=159);else{if(!(n>=240&&n<=244))return t.RUNE_ERROR_STEP;s=4,r=7&n,240===n?i=144:244===n&&(o=143)}if(e+s>this.end)return t.RUNE_ERROR_STEP;const a=255&this.bytes[e+1];if(a<i||a>o)return t.RUNE_ERROR_STEP;if(r=r<<6|63&a,s>2){const n=255&this.bytes[e+2];if(128!=(192&n))return t.RUNE_ERROR_STEP;if(r=r<<6|63&n,s>3){const n=255&this.bytes[e+3];if(128!=(192&n))return t.RUNE_ERROR_STEP;r=r<<6|63&n}}return r<<3|s}index(t,e){e+=this.start;const n=this.indexOf(this.bytes,t.prefixUTF8,e);return n<0?n:n-e}context(t){let e=-1;if((t+=this.start)>this.start&&t<=this.end){let n=t-1;if(e=this.bytes[n--],e>=128){let s=t-4;for(s<this.start&&(s=this.start);n>=s&&128==(192&this.bytes[n]);)n--;n<this.start&&(n=this.start);const r=this.step(n-this.start);e=n+(7&r)===t?r>>3:vB.RUNE_ERROR}}const n=t<this.end?this.step(t-this.start)>>3:-1;return AB.emptyOpContext(e,n)}indexOf(t,e,n=0){let s=e.length;if(0===s)return n<=this.end?n:-1;const r=e[0];let i=this.end-s;const o="function"==typeof t.indexOf;let a=n;for(;a<=i;){if(o){if(a=t.indexOf(r,a),-1===a||a>i)return-1}else{for(;a<=i&&t[a]!==r;)a++;if(a>i)return-1}let n=!0;for(let r=1;r<s;r++)if(t[a+r]!==e[r]){n=!1;break}if(n)return a;a++}return-1}prefixLength(t){return t.prefixUTF8.length}},PB=class extends LB{constructor(t,e=0,n=t.length){super(),this.charSequence=t,this.start=e,this.end=n}hasString(t,e){const n=this.charSequence.indexOf(t.str,this.start+e);return-1!==n&&n<=this.end-t.str.length}hasAnyString(t,e){return t.automaton16().searchUTF16(this.charSequence,this.start+e,this.end)}step(t){if((t+=this.start)>=this.end)return LB.EOF();const e=this.charSequence.charCodeAt(t);if(e<vB.MIN_HIGH_SURROGATE||e>vB.MAX_HIGH_SURROGATE||t+1>=this.end)return e<<3|1;const n=this.charSequence.charCodeAt(t+1);return n>=vB.MIN_LOW_SURROGATE&&n<=vB.MAX_LOW_SURROGATE?1024*(e-vB.MIN_HIGH_SURROGATE)+(n-vB.MIN_LOW_SURROGATE)+vB.MIN_SUPPLEMENTARY_CODE_POINT<<3|2:e<<3|1}index(t,e){e+=this.start;const n=this.charSequence.indexOf(t.prefix,e);return n<0||n>this.end-t.prefix.length?-1:n-e}context(t){const e=(t+=this.start)>this.start&&t<=this.end?this.charSequence.charCodeAt(t-1):-1,n=t<this.end?this.charSequence.charCodeAt(t):-1;return AB.emptyOpContext(e,n)}prefixLength(t){return t.prefix.length}},MB=class{static fromUTF8(t,e=0,n=t.length){return new FB(t,e,n)}static fromUTF16(t,e=0,n=t.length){return new PB(t,e,n)}},GB=class extends Error{constructor(t){super(t),this.name="RE2JSException"}},HB=class extends GB{constructor(t,e=null){let n=`error parsing regexp: ${t}`;e&&(n+=`: \`${e}\``),super(n),this.name="RE2JSSyntaxException",this.message=n,this.error=t,this.input=e}getDescription(){return this.error}getPattern(){return this.input}},UB=class extends GB{constructor(t){super(t),this.name="RE2JSCompileException"}},VB=class extends GB{constructor(t){super(t),this.name="RE2JSGroupException"}},jB=class extends GB{constructor(t){super(t),this.name="RE2JSFlagsException"}},$B=class extends GB{constructor(t){super(t),this.name="RE2JSInternalException"}},JB=class t{static MAX_REPLACER_ARGS=65535;static quoteReplacement(t,e=!1){return e?t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(t=>{const e=t.codePointAt(0);return e===mB.CODES["\\"]||e===mB.CODES.$?`\\${t}`:t}).join(""):t.indexOf("$")<0?t:t.split("").map(t=>t.codePointAt(0)===mB.CODES.$?"$$":t).join("")}constructor(t,e){if(null===t)throw new Error("pattern is null");this.patternInput=t;const n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,this.hasNamedGroups=Object.keys(this.namedGroups).length>0,this.numberOfInstructions=n.numberOfInstructions(),this.lookbehindState=null,e instanceof RB?this.resetMatcherInput(e):AB.isByteArray(e)?this.resetMatcherInput(kB.utf8(e)):this.resetMatcherInput(kB.utf16(e))}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(t){if(null===t)throw new Error("input is null");return t instanceof RB||(t=AB.isByteArray(t)?kB.utf8(t):kB.utf16(t)),this.matcherInput=t,null!==this.lookbehindState?this.lookbehindState.reset():this.lookbehindState=this.patternInput.re2().createLookbehindState(),this.reset(),this}start(t=0){if("string"==typeof t){const e=this.namedGroups[t];if(!Number.isFinite(e))throw new VB(`group '${t}' not found`);t=e}return this.loadGroup(t),this.groups[2*t]}end(t=0){if("string"==typeof t){const e=this.namedGroups[t];if(!Number.isFinite(e))throw new VB(`group '${t}' not found`);t=e}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if("string"==typeof t){const e=this.namedGroups[t];if(!Number.isFinite(e))throw new VB(`group '${t}' not found`);t=e}const e=this.start(t),n=this.end(t);return e<0&&n<0?null:this.substring(e,n)}getNamedGroups(){if(!this.hasMatch)throw new VB("perhaps no match attempted");const t=Object.create(null);for(const e of Object.keys(this.namedGroups))t[e]=this.group(e);return t}groupCount(){return this.patternGroupCount}loadGroup(t){if(!Number.isInteger(t)||t<0||t>this.patternGroupCount)throw new VB(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new VB("perhaps no match attempted");if(0===t||this.hasGroups)return;const e=this.matcherInputLength,n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],e,this.anchorFlag,1+this.patternGroupCount,this.lookbehindState);if(!n[0])throw new VB("inconsistency in matching group data");this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,aB.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,aB.ANCHOR_START)}find(t=null){if(null!==t){if(!Number.isInteger(t)||t<0||t>this.matcherInputLength)throw new VB(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}if(t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1])){const e=(this.matcherInput.isUTF16Encoding()?MB.fromUTF16(this.matcherInput.asCharSequence(),0,this.matcherInputLength):MB.fromUTF8(this.matcherInput.asBytes(),0,this.matcherInputLength)).step(t);e<0?t++:t+=7&e}return this.genMatch(t,aB.UNANCHORED)}genMatch(t,e){const n=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,e,1,this.lookbehindState);return n[0]?(this.groups=n[1],this.hasMatch=!0,this.hasGroups=0===this.patternGroupCount,this.anchorFlag=e,!0):(this.hasMatch=!1,!1)}substring(t,e){return this.matcherInput.isUTF8Encoding()?AB.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,e)):this.matcherInput.asCharSequence().substring(t,e).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,e=!1){let n="";const s=this.start(),r=this.end();return this.appendPos<s&&(n+=this.substring(this.appendPos,s)),this.appendPos=r,n+=e?this.appendReplacementInternalJava(t):this.appendReplacementInternalJs(t),n}appendReplacementInternalJava(t){let e="",n=0;const s=t.length;let r=0;for(;r<s;){const i=t.codePointAt(r);if(i!==mB.CODES["\\"]){if(i===mB.CODES.$){if(n<r&&(e+=t.substring(n,r)),r+1>=s)throw new VB("Illegal group reference: group index is missing");const i=t.codePointAt(r+1);if(mB.CODES[0]<=i&&i<=mB.CODES[9]){let o=i-mB.CODES[0],a=r+2;for(;a<s;a++){const e=t.codePointAt(a);if(e<mB.CODES[0]||e>mB.CODES[9]||10*o+e-mB.CODES[0]>this.patternGroupCount)break;o=10*o+e-mB.CODES[0]}if(o>this.patternGroupCount)throw new VB(`n > number of groups: ${o}`);const B=this.group(o);null!==B&&(e+=B),r=a,n=r}else{if(i!==mB.CODES["{"])throw new VB("Illegal group reference");{let i=r+2;for(;i<s&&t.codePointAt(i)!==mB.CODES["}"];)i++;if(i>=s)throw new VB("named capture group is missing trailing '}'");const o=t.substring(r+2,i),a=this.group(o);null!==a&&(e+=a),r=i+1,n=r}}continue}r++}else{if(n<r&&(e+=t.substring(n,r)),r++,r>=s)throw new VB("character to be escaped is missing");n=r,r++}}return n<s&&(e+=t.substring(n,s)),e}appendReplacementInternalJs(t){const e=t=>t>=48&&t<=57,n=this.patternGroupCount;let s="",r=0;for(;r<t.length;){const i=t.indexOf("$",r);if(i<0)break;s+=t.substring(r,i),r=i;const o=t.charCodeAt(r+1);if(o===mB.CODES.$)s+="$",r+=2;else if(o===mB.CODES["&"])s+=this.group(0),r+=2;else if(o===mB.CODES["`"])s+=this.substring(0,this.start(0)),r+=2;else if(o===mB.CODES["'"])s+=this.substring(this.end(0),this.matcherInputLength),r+=2;else if(e(o)){let i=1,a=o-48;const B=t.charCodeAt(r+2);if(e(B)&&10*a+B-48<=n&&(i=2,a=10*a+B-48),a>=1&&a<=n){const t=this.group(a);null!==t&&(s+=t)}else s+=t.substring(r,r+1+i);r+=1+i}else if(o===mB.CODES["<"]&&this.hasNamedGroups){const e=t.indexOf(">",r+2);if(e<0)s+="$<",r+=2;else{const n=t.substring(r+2,e);if(Object.prototype.hasOwnProperty.call(this.namedGroups,n)){const t=this.group(n);null!==t&&(s+=t)}r=e+1}}else s+="$",r+=1}return s+t.substring(r)}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(t,e=!1){return this.replace(t,!0,e)}replaceFirst(t,e=!1){return this.replace(t,!1,e)}replace(e,n=!0,s=!1){let r="";this.reset();const i="function"==typeof e;let o=null;if(i){if(this.groupCount()>=t.MAX_REPLACER_ARGS)throw new VB("Too many capture groups to safely invoke replacer function");o=this.matcherInput.isUTF8Encoding()?this.matcherInput.asBytes():this.matcherInput.asCharSequence()}for(;this.find()&&(r+=i?this.appendReplacementFunc(e,o):this.appendReplacement(e,s),n););return r+=this.appendTail(),r}appendReplacementFunc(t,e){let n="";const s=this.start(),r=this.end();this.appendPos<s&&(n+=this.substring(this.appendPos,s)),this.appendPos=r;const i=this.matchArray();return i.push(s,e),this.hasNamedGroups&&i.push(this.namedGroupsObject()),n+=String(t(...i)),n}matchArray(){const t=[this.group(0)];for(let e=1;e<=this.patternGroupCount;e++){const n=this.group(e);t.push(null===n?void 0:n)}return t}namedGroupsObject(){if(!this.hasNamedGroups)return;const t=this.getNamedGroups();for(const e in t)null===t[e]&&(t[e]=void 0);return t}},qB=class t{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 LB_WRITE=12;static LB_CHECK=13;static isRuneOp(e){return t.RUNE<=e&&e<=t.RUNE_ANY_NOT_NL}static escapeRunes(t){let e='"';for(let n of t)e+=AB.escapeRune(n);return e+='"',e}constructor(t){this.op=t,this.out=0,this.arg=0,this.runes=new Int32Array(0),this.next=null}matchRune(t){if(1===this.runes.length){const e=this.runes[0];return 0!==(this.arg&aB.FOLD_CASE)?vB.equalsIgnoreCase(e,t):t===e}const e=this.runes.length;if(0===e)return!1;if(2===e||4===e||6===e||8===e){for(let n=0;n<e;n+=2){if(t<this.runes[n])return!1;if(t<=this.runes[n+1])return!0}return!1}let n=0,s=e>>1;for(;s>1;){const e=s>>1;n+=this.runes[n+e<<1]<=t?e:0,s-=e}n+=this.runes[n<<1]<=t?1:0;const r=n-1;return r>=0&&t<=this.runes[r<<1|1]}matchRunePos(t){if(1===this.runes.length){const e=this.runes[0];return 0!==(this.arg&aB.FOLD_CASE)?vB.equalsIgnoreCase(e,t)?0:-1:t===e?0:-1}const e=this.runes.length;if(0===e)return-1;if(2===e||4===e||6===e||8===e){for(let n=0;n<e;n+=2){if(t<this.runes[n])return-1;if(t<=this.runes[n+1])return Math.floor(n/2)}return-1}let n=0,s=e>>1;for(;s>1;){const e=s>>1;n+=this.runes[n+e<<1]<=t?e:0,s-=e}n+=this.runes[n<<1]<=t?1:0;const r=n-1;return r>=0&&t<=this.runes[r<<1|1]?r:-1}toString(){switch(this.op){case t.ALT:return`alt -> ${this.out}, ${this.arg}`;case t.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case t.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case t.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case t.MATCH:return"match"+(0!==this.arg?` ${this.arg}`:"");case t.FAIL:return"fail";case t.NOP:return`nop -> ${this.out}`;case t.LB_WRITE:return`lbwrite ${this.arg} -> ${this.out}`;case t.LB_CHECK:return`lbcheck ${this.arg} -> ${this.out}`;case t.RUNE:return null===this.runes?"rune <null>":["rune ",t.escapeRunes(this.runes),0!==(this.arg&aB.FOLD_CASE)?"/i":""," -> ",this.out].join("");case t.RUNE1:return`rune1 ${t.escapeRunes(this.runes)} -> ${this.out}`;case t.RUNE_ANY:return`any -> ${this.out}`;case t.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},zB=class t{constructor(t){this.sparse=new Int32Array(t),this.densePcs=new Int32Array(t),this.denseCaps=null,this.size=0,this.ncap=0,this.mainThreads=0}static INITIAL_THREADS=32;init(e){this.ncap=e;const n=Math.min(this.densePcs.length,t.INITIAL_THREADS)*e;(!this.denseCaps||this.denseCaps.length<n)&&(this.denseCaps=new Int32Array(n))}growCaps(t){const e=this.densePcs.length*this.ncap,n=new Int32Array(Math.min(e,Math.max(t,2*this.denseCaps.length)));n.set(this.denseCaps),this.denseCaps=n}contains(t){const e=this.sparse[t];return e<this.size&&this.densePcs[e]===t}isEmpty(){return 0===this.size}add(t){const e=this.size++;return this.sparse[t]=e,this.densePcs[e]=t,e}clear(){this.size=0,this.mainThreads=0}toString(){let t="{";for(let e=0;e<this.size;e++)0!==e&&(t+=", "),t+=this.densePcs[e];return t+="}",t}},KB=class{constructor(t){this.pos=-1,this.pcs=new Int32Array(t.numInst()),this.size=0,this.lbTable=new Int32Array(t.numLb+1)}reset(){this.pos=-1,this.size=0}},QB=class t{static fromRE2(e){const n=new t;return n.prog=e.prog,n.re2=e,n.q0=new zB(n.prog.numInst()),n.q1=new zB(n.prog.numInst()),n.addStack=new Int32Array(2*(n.prog.numInst()+1)),n.matched=!1,n.matchcap=new Int32Array(n.prog.numCap<2?2:n.prog.numCap),n.ncap=0,n}constructor(){this.prog=null,this.re2=null,this.q0=null,this.q1=null,this.addStack=null,this.matched=!1,this.matchcap=null,this.ncap=0,this.lbTable=null}init(t){this.ncap=t,t>this.matchcap.length?this.matchcap=new Int32Array(t).fill(-1):this.matchcap.fill(-1),this.q0.init(t),this.q1.init(t),this.prog.numLb>0&&((!this.lbTable||this.lbTable.length<this.prog.numLb+1)&&(this.lbTable=new Int32Array(this.prog.numLb+1)),this.lbTable.fill(-1))}submatches(){return 0===this.ncap?AB.emptyInts():AB.toArray(this.matchcap.subarray(0,this.ncap))}match(t,e,n,s=null){const r=this.re2.cond;if(r===AB.EMPTY_ALL)return!1;if((n===aB.ANCHOR_START||n===aB.ANCHOR_BOTH)&&0!==e)return!1;this.matched=!1,this.matchcap.fill(-1);const i=this.prog.numLb>0,o=e;let a=e,B=!1;i&&(null!==s&&s.pos>=0&&s.pos<=e?(a=s.pos,B=!0):a=0);let c,l=i&&null!==s,u=this.q0,h=this.q1,d=t.step(a),p=d>>3,f=7&d,C=-1,g=0;for(d!==LB.EOF()&&(d=t.step(a+f),C=d>>3,g=7&d),c=0===a?AB.emptyOpContext(-1,p):t.context(a),i&&(B?this.restoreLookbehinds(s,u,c):this.spawnLookbehinds(u,a,c));;){if(0===u.mainThreads){if(0!==(r&AB.EMPTY_BEGIN_TEXT)&&0!==a)break;if((n===aB.ANCHOR_START||n===aB.ANCHOR_BOTH)&&0!==a)break;if(this.matched)break;if(0===this.prog.numLb&&u.isEmpty()&&0!==this.re2.prefix.length&&C!==this.re2.prefixRune&&t.canCheckPrefix()){const e=t.index(this.re2,a);if(e<0)break;a+=e,d=t.step(a),p=d>>3,f=7&d,d=t.step(a+f),C=d>>3,g=7&d,c=t.context(a)}}a>=o&&(l&&(this.saveLookbehinds(s,u,a),l=!1),this.matched||0!==a&&n!==aB.UNANCHORED||(this.ncap>0&&(this.matchcap[0]=a),this.add(u,this.prog.start,a,this.matchcap,0,c)));const e=a+f;if(c=t.context(e),this.step(u,h,a,e,p,c,n,a===t.endPos()),0===f)break;if(0===this.ncap&&this.matched)break;a+=f,p=C,f=g,-1!==p&&(d=t.step(a+f),C=d>>3,g=7&d);const i=u;u=h,h=i}return u.clear(),h.clear(),this.matched}matchSet(t,e,n){const s=this.re2.cond;if(s===AB.EMPTY_ALL)return[];if((n===aB.ANCHOR_START||n===aB.ANCHOR_BOTH)&&0!==e)return[];let r=this.prog.numLb>0?0:e,i=e,o=this.q0,a=this.q1,B=t.step(r),c=B>>3,l=7&B,u=-1,h=0;B!==LB.EOF()&&(B=t.step(r+l),u=B>>3,h=7&B);let d=0===r?AB.emptyOpContext(-1,c):t.context(r);const p=new Set;for(this.prog.numLb>0&&this.spawnLookbehinds(o,r,d);;){if(0===o.mainThreads){if(0!==(s&AB.EMPTY_BEGIN_TEXT)&&0!==r)break;if((n===aB.ANCHOR_START||n===aB.ANCHOR_BOTH)&&0!==r)break}0!==r&&n!==aB.UNANCHORED||r>=i&&this.add(o,this.prog.start,r,this.matchcap,0,d);const e=r+l;d=t.context(e);for(let s=0;s<o.size;s++){const i=o.densePcs[s],B=this.prog.inst[i],l=s*this.ncap;let u=!1;switch(B.op){case qB.MATCH:if(n===aB.ANCHOR_BOTH&&r!==t.endPos())break;p.add(B.arg);break;case qB.RUNE:u=B.matchRune(c);break;case qB.RUNE1:u=c===B.runes[0];break;case qB.RUNE_ANY:u=!0;break;case qB.RUNE_ANY_NOT_NL:u=10!==c;break;default:continue}u&&this.add(a,B.out,e,o.denseCaps,l,d)}if(o.clear(),0===l)break;r+=l,c=u,l=h,-1!==c&&(B=t.step(r+l),u=B>>3,h=7&B);const f=o;o=a,a=f}return a.clear(),Array.from(p).sort((t,e)=>t-e)}step(t,e,n,s,r,i,o,a){const B=this.re2.longest;for(let c=0;c<t.size;c++){const l=t.densePcs[c],u=c*this.ncap;if(B&&this.matched&&this.ncap>0&&this.matchcap[0]<t.denseCaps[u])continue;const h=this.prog.inst[l];let d=!1;switch(h.op){case qB.MATCH:if(o===aB.ANCHOR_BOTH&&!a)break;if(this.ncap>0&&(!B||!this.matched||this.matchcap[1]<n)){t.denseCaps[u+1]=n;for(let e=0;e<this.ncap;e++)this.matchcap[e]=t.denseCaps[u+e]}B||(t.size=0),this.matched=!0;break;case qB.RUNE:d=h.matchRune(r);break;case qB.RUNE1:d=r===h.runes[0];break;case qB.RUNE_ANY:d=!0;break;case qB.RUNE_ANY_NOT_NL:d=10!==r;break;default:continue}d&&this.add(e,h.out,s,t.denseCaps,u,i)}t.clear()}spawnLookbehinds(t,e,n){for(let s=0;s<this.prog.lbStarts.length;s++)this.add(t,this.prog.lbStarts[s],e,this.matchcap,0,n)}restoreLookbehinds(t,e,n){this.lbTable.set(t.lbTable);for(let s=0;s<t.size;s++)this.add(e,t.pcs[s],t.pos,this.matchcap,0,n)}saveLookbehinds(t,e,n){let s=0;for(let n=0;n<e.size;n++){const r=e.densePcs[n];1===this.prog.lbInst[r]&&qB.isRuneOp(this.prog.inst[r].op)&&(t.pcs[s++]=r)}t.size=s,t.pos=n,t.lbTable.set(this.lbTable)}add(t,e,n,s,r,i){const o=this.addStack;let a=0;for(;;){for(;0!==e&&!t.contains(e);){const B=t.add(e),c=this.prog.inst[e];switch(c.op){case qB.FAIL:e=0;break;case qB.ALT:case qB.ALT_MATCH:o[a++]=c.arg,o[a++]=0,e=c.out;break;case qB.EMPTY_WIDTH:e=0===(c.arg&~i)?c.out:0;break;case qB.NOP:e=c.out;break;case qB.CAPTURE:c.arg<this.ncap&&(o[a++]=-c.arg-1,o[a++]=s[r+c.arg],s[r+c.arg]=n),e=c.out;break;case qB.LB_WRITE:this.lbTable[Math.abs(c.arg)]=n,e=c.out;break;case qB.LB_CHECK:e=c.arg>0?this.lbTable[c.arg]===n?c.out:0:this.lbTable[-c.arg]!==n?c.out:0;break;case qB.MATCH:case qB.RUNE:case qB.RUNE1:case qB.RUNE_ANY:case qB.RUNE_ANY_NOT_NL:if(0===this.prog.lbInst[e]&&t.mainThreads++,this.ncap>0){const e=B*this.ncap;e+this.ncap>t.denseCaps.length&&t.growCaps(e+this.ncap);for(let n=0;n<this.ncap;n++)t.denseCaps[e+n]=s[r+n]}e=0;break;default:throw new $B("unhandled")}}if(0===a)return;a-=2;const B=o[a];B<0?(s[r-B-1]=o[a+1],e=0):e=B}}};const WB=(t,e)=>{if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0},YB=(t,e,n,s)=>t.flag===n&&WB(t.nfaStates,e)&&WB(t.matchIDs,s),XB=[];var ZB=class{constructor(t,e,n){this.nfaStates=t,this.flag=e,this.isMatch=0!==(e&tc.FLAG_MATCH),this.matchIDs=n,this.next=null,this.nextAnchored=null}},tc=class t{static FLAG_EMPTY_MASK=255;static FLAG_MATCH=256;static FLAG_LAST_WORD=512;static FLAG_NEED_SHIFT=16;static STATE_OVERHEAD=150;static ARRAY_OVERHEAD=40;static ELEMENT_SIZE=8;static TABLE_OVERHEAD=48;static PROGRESS_PER_STATE=10;constructor(t,e=8388608){this.prog=t,this.maxMem=e,this.stateCache=new Map,this.stateCount=0,this.startStates=new Map,this.failed=!1;for(let e=0;e<t.numInst();e++){const n=t.getInst(e).op;if(n===qB.LB_WRITE||n===qB.LB_CHECK){this.failed=!0;break}}this.computeRuneClasses(),this.stateBudget=e,this.memBudget=e}computeRuneClasses(){const t=new Set,e=(e,n)=>{t.add(e),t.add(n+1)};for(let t=0;t<this.prog.numInst();t++){const n=this.prog.getInst(t);switch(n.op){case qB.RUNE:case qB.RUNE1:if(1===n.runes.length){if(e(n.runes[0],n.runes[0]),0!==(n.arg&aB.FOLD_CASE))for(let t=vB.simpleFold(n.runes[0]);t!==n.runes[0];t=vB.simpleFold(t))e(t,t)}else for(let t=0;t<n.runes.length;t+=2)e(n.runes[t],n.runes[t+1]);break;case qB.RUNE_ANY_NOT_NL:e(10,10);break;case qB.EMPTY_WIDTH:0!==(n.arg&(AB.EMPTY_BEGIN_LINE|AB.EMPTY_END_LINE))&&e(10,10),0!==(n.arg&(AB.EMPTY_WORD_BOUNDARY|AB.EMPTY_NO_WORD_BOUNDARY))&&(e(48,57),e(65,90),e(95,95),e(97,122))}}t.delete(0),this.classBounds=Int32Array.from(t).sort(),this.numClasses=this.classBounds.length+1;const n=new Int32Array(vB.MAX_LATIN1+1);for(let t=0;t<=vB.MAX_LATIN1;t++)n[t]=this.searchClass(t);this.latin1Class=n}runeClass(t){return t<=vB.MAX_LATIN1?this.latin1Class[t]:this.searchClass(t)}searchClass(t){const e=this.classBounds;let n=0,s=e.length;for(;n<s;){const r=n+s>>1;e[r]<=t?n=r+1:s=r}return n}closure(t,e){const n=new Set,s=Array.from(t);let r=0;for(;s.length>0;){const t=s.pop();if(0===t||n.has(t))continue;n.add(t);const i=this.prog.getInst(t);switch(i.op){case qB.ALT:case qB.ALT_MATCH:s.push(i.out),s.push(i.arg);break;case qB.NOP:case qB.CAPTURE:s.push(i.out);break;case qB.EMPTY_WIDTH:r|=i.arg,0===(i.arg&~e)&&s.push(i.out)}}return{pcs:Array.from(n).sort((t,e)=>t-e),needflags:r}}getState(e,n,s){const r=((t,e,n)=>{let s=-2128831035;for(let e=0;e<t.length;e++)s^=t[e],s=Math.imul(s,16777619);s^=e,s=Math.imul(s,16777619);for(let t=0;t<n.length;t++)s^=n[t],s=Math.imul(s,16777619);return s})(e,n,s),i=this.stateCache.get(r);if(i instanceof ZB){if(YB(i,e,n,s))return i}else if(void 0!==i)for(let t=0;t<i.length;t++)if(YB(i[t],e,n,s))return i[t];const o=t.stateCost(e,s);if(this.memBudget<o)return null;this.memBudget-=o;const a=new ZB(e,n,s);return void 0===i?this.stateCache.set(r,a):i instanceof ZB?this.stateCache.set(r,[i,a]):i.push(a),this.stateCount++,a}static stateCost(e,n){const s=0===n.length?0:t.ARRAY_OVERHEAD+t.ELEMENT_SIZE*n.length;return t.STATE_OVERHEAD+t.ELEMENT_SIZE*e.length+s}*cachedStates(){for(const t of this.stateCache.values())t instanceof ZB?yield t:yield*t}makeState(e,n,s){const r=this.closure(e,n&t.FLAG_EMPTY_MASK);let i=n;return 0===r.needflags&&(i&=t.FLAG_MATCH),i|=r.needflags<<t.FLAG_NEED_SHIFT,this.getState(r.pcs,i,s)}allocTable(e,n){const s=this.numClasses+1,r=t.TABLE_OVERHEAD+t.ELEMENT_SIZE*s;if(this.memBudget<r)return null;this.memBudget-=r;const i=new Array(s).fill(null);return n===aB.UNANCHORED?e.next=i:e.nextAnchored=i,i}clearCache(){this.stateCache.clear(),this.stateCount=0,this.startStates.clear(),this.memBudget=this.stateBudget}resetCache(t){return this.clearCache(),this.getState(t.nfaStates,t.flag,t.matchIDs)}step(e,n,s,r){let i=r===aB.UNANCHORED?e.next:e.nextAnchored;if(null!==i){const t=i[n];if(null!==t)return t}else if(i=this.allocTable(e,r),null===i)return null;const o=e.flag>>>t.FLAG_NEED_SHIFT,a=e.flag&t.FLAG_EMPTY_MASK;let B=a,c=0;10===s&&(B|=AB.EMPTY_END_LINE,c|=AB.EMPTY_BEGIN_LINE),-1===s&&(B|=AB.EMPTY_END_LINE|AB.EMPTY_END_TEXT);const l=0!==(e.flag&t.FLAG_LAST_WORD),u=-1!==s&&AB.isWordRune(s);B|=u===l?AB.EMPTY_NO_WORD_BOUNDARY:AB.EMPTY_WORD_BOUNDARY;let h=e.nfaStates;0!==(B&~a&o)&&(h=this.closure(h,B).pcs);const d=[];let p=!1,f=XB;for(let t=0;t<h.length;t++){const e=this.prog.getInst(h[t]);e.op===qB.MATCH?(p||(p=!0,f=[]),f.push(e.arg)):-1!==s&&qB.isRuneOp(e.op)&&e.matchRune(s)&&d.push(e.out)}f.length>1&&f.sort((t,e)=>t-e),r===aB.UNANCHORED&&-1!==s&&d.push(this.prog.start);let C=c;p&&(C|=t.FLAG_MATCH),u&&(C|=t.FLAG_LAST_WORD);const g=this.makeState(d,C,f);return null===g?null:(i[n]=g,g)}start(e,n){const s=e.context(n);let r;if(0!==(s&AB.EMPTY_BEGIN_TEXT))r=AB.EMPTY_BEGIN_TEXT|AB.EMPTY_BEGIN_LINE;else if(0!==(s&AB.EMPTY_BEGIN_LINE))r=AB.EMPTY_BEGIN_LINE;else{const i=e.step(n),o=i>=0&&AB.isWordRune(i>>3);r=0!==(s&AB.EMPTY_WORD_BOUNDARY)!==o?t.FLAG_LAST_WORD:0}let i=this.startStates.get(r);if(void 0===i){if(i=this.makeState([this.prog.start],r,XB),null===i&&(this.clearCache(),i=this.makeState([this.prog.start],r,XB),null===i))return null;this.startStates.set(r,i)}return i}stepOrReset(e,n,s,r,i,o){let a=this.step(e,n,s,r);if(null!==a)return a;if(o.resetPos>=0&&i-o.resetPos<t.PROGRESS_PER_STATE*this.stateCount)return null;o.resetPos=i;const B=this.resetCache(e);return null===B?null:(a=this.step(B,n,s,r),a)}run(t,e,n,s,r){const i=t.endPos(),o=this.latin1Class,a=n===aB.UNANCHORED,B={resetPos:-1};let c=e;for(;c<i;){const e=t.step(c),i=e>>3,l=7&e;if(0===l)break;const u=i<=vB.MAX_LATIN1?o[i]:this.runeClass(i);let h=a&&null!==s.next?s.next[u]:null;if(null===h&&(h=this.stepOrReset(s,u,i,n,c,B),null===h))return null;if((s=h).isMatch&&r(s,!1))return!0;if(!a&&0===s.nfaStates.length)return!1;c+=l}return null===(s=this.stepOrReset(s,this.numClasses,-1,n,c,B))?null:s.isMatch&&r(s,!0)}match(t,e,n){if(this.failed)return null;if((n===aB.ANCHOR_START||n===aB.ANCHOR_BOTH)&&0!==e)return!1;const s=this.start(t,e);return null===s?null:this.run(t,e,n,s,(t,e)=>n!==aB.ANCHOR_BOTH||e)}matchSet(t,e,n){if(this.failed)return null;if((n===aB.ANCHOR_START||n===aB.ANCHOR_BOTH)&&0!==e)return[];const s=this.start(t,e);if(null===s)return null;const r=new Set;return null===this.run(t,e,n,s,(t,e)=>{if(n!==aB.ANCHOR_BOTH||e)for(let e=0;e<t.matchIDs.length;e++)r.add(t.matchIDs[e]);return!1})?null:Array.from(r).sort((t,e)=>t-e)}};var ec=class{constructor(){this.end=0,this.cap=new Int32Array(0),this.matchcap=new Int32Array(0),this.ncap=0,this.jobPc=new Int32Array(256),this.jobArg=new Uint8Array(256),this.jobPos=new Int32Array(256),this.jobLen=0,this.visited=new Uint32Array(0)}reset(t,e,n){this.end=e,this.jobLen=0,this.ncap=n;const s=t.numInst()*(e+1)+32-1>>>5;this.visited.length<s?this.visited=new Uint32Array(s):this.visited.fill(0,0,s),this.cap.length<n?this.cap=new Int32Array(n).fill(-1):this.cap.fill(-1,0,n),this.matchcap.length<n?this.matchcap=new Int32Array(n).fill(-1):this.matchcap.fill(-1,0,n)}shouldVisit(t,e){const n=t*(this.end+1)+e,s=n>>>5,r=1<<(31&n);return 0===(this.visited[s]&r)&&(this.visited[s]|=r,!0)}push(t,e,n,s){if(t.prog.getInst(e).op!==qB.FAIL&&(s||this.shouldVisit(e,n))){if(this.jobLen>=this.jobPc.length){const t=2*this.jobPc.length,e=new Int32Array(t);e.set(this.jobPc),this.jobPc=e;const n=new Uint8Array(t);n.set(this.jobArg),this.jobArg=n;const s=new Int32Array(t);s.set(this.jobPos),this.jobPos=s}this.jobPc[this.jobLen]=e,this.jobArg[this.jobLen]=s?1:0,this.jobPos[this.jobLen]=n,this.jobLen++}}tryBacktrack(t,e,n,s,r){const i=t.longest;for(this.push(t,n,s,!1);this.jobLen>0;){this.jobLen--;let n=this.jobPc[this.jobLen],s=1===this.jobArg[this.jobLen],o=this.jobPos[this.jobLen],a=!0;for(;a||this.shouldVisit(n,o);){a=!1;const B=t.prog.getInst(n);switch(B.op){case qB.FAIL:break;case qB.ALT:if(s){s=!1,n=B.arg;continue}this.push(t,n,o,!0),n=B.out;continue;case qB.ALT_MATCH:{const e=t.prog.getInst(B.out);if(qB.isRuneOp(e.op)){this.push(t,B.arg,o,!1),n=B.arg,o=this.end;continue}this.push(t,B.out,this.end,!1),n=B.out;continue}case qB.RUNE:{const t=e.step(o);if(t===LB.EOF())break;if(!B.matchRune(t>>3))break;o+=7&t,n=B.out;continue}case qB.RUNE1:{const t=e.step(o);if(t===LB.EOF())break;if(t>>3!==B.runes[0])break;o+=7&t,n=B.out;continue}case qB.RUNE_ANY_NOT_NL:{const t=e.step(o);if(t===LB.EOF())break;if(t>>3==10)break;o+=7&t,n=B.out;continue}case qB.RUNE_ANY:{const t=e.step(o);if(t===LB.EOF())break;o+=7&t,n=B.out;continue}case qB.CAPTURE:if(s){this.cap[B.arg]=o;break}B.arg<this.ncap&&(this.push(t,n,this.cap[B.arg],!0),this.cap[B.arg]=o),n=B.out;continue;case qB.EMPTY_WIDTH:{const t=e.context(o);if(0!==(B.arg&~t))break;n=B.out;continue}case qB.NOP:n=B.out;continue;case qB.MATCH:{if(r===aB.ANCHOR_BOTH&&o!==this.end)break;if(0===this.ncap)return!0;this.ncap>1&&(this.cap[1]=o);const t=this.matchcap[1];if((-1===t||i&&o>0&&o>t)&&this.matchcap.set(this.cap),!i)return!0;if(o===this.end)return!0;break}case qB.LB_WRITE:case qB.LB_CHECK:throw new $B("Backtracker cannot evaluate Lookbehind instructions");default:throw new $B("bad inst")}break}}return i&&this.matchcap.length>1&&this.matchcap[1]>=0}};const nc=[];var sc=class t{static shouldBacktrack(t){return t.numInst()<=500}static maxBitStateLen(e){return t.shouldBacktrack(e)?Math.floor(262144/e.numInst()):0}static execute(t,e,n,s,r){const i=t.cond;if(i===AB.EMPTY_ALL)return null;if((s===aB.ANCHOR_START||s===aB.ANCHOR_BOTH)&&0!==n)return null;if(0!==(i&AB.EMPTY_BEGIN_TEXT)&&0!==n)return null;const o=nc.length>0?nc.pop():new ec,a=e.endPos();o.reset(t.prog,a,r);let B=!1;if(0!==(i&AB.EMPTY_BEGIN_TEXT)||s===aB.ANCHOR_START||s===aB.ANCHOR_BOTH)o.ncap>0&&(o.cap[0]=n),o.tryBacktrack(t,e,t.prog.start,n,s)&&(B=!0);else{let r=-1;for(;n<=a&&0!==r;n+=r){if(t.prefix.length>0){const s=e.index(t,n);if(s<0)break;n+=s}if(o.ncap>0&&(o.cap[0]=n),o.tryBacktrack(t,e,t.prog.start,n,s)){B=!0;break}const i=e.step(n);r=i===LB.EOF()?0:7&i}}if(!B)return nc.push(o),null;const c=0===r?[]:AB.toArray(o.matchcap.subarray(0,r));return nc.push(o),c}},rc=class{constructor(t){this.sparse=new Uint32Array(t),this.dense=new Uint32Array(t),this.size=0,this.nextIndex=0}empty(){return this.nextIndex>=this.size}next(){return this.dense[this.nextIndex++]}clear(){this.size=0,this.nextIndex=0}contains(t){return t<this.sparse.length&&this.sparse[t]<this.size&&this.dense[this.sparse[t]]===t}insert(t){this.contains(t)||this.insertNew(t)}insertNew(t){t>=this.sparse.length||(this.sparse[t]=this.size,this.dense[this.size]=t,this.size++)}};var ic=class{constructor(t){this.start=t.start,this.numCap=t.numCap,this.inst=new Array(t.inst.length);for(let e=0;e<t.inst.length;e++){const n=t.inst[e],s=new qB(n.op);s.out=n.out,s.arg=n.arg,s.runes=n.runes?new Int32Array(n.runes):new Int32Array(0),s.next=null,this.inst[e]=s}}};var oc=class t{static compile(t){if(0===t.start)return null;if(t.numLb>0)return null;const e=t.inst[t.start];if(e.op!==qB.EMPTY_WIDTH||0===(e.arg&AB.EMPTY_BEGIN_TEXT))return null;let n=!1;for(let e=0;e<t.inst.length;e++)if(t.inst[e].op===qB.ALT||t.inst[e].op===qB.ALT_MATCH){n=!0;break}for(let e=0;e<t.inst.length;e++){const s=t.inst[e],r=t.inst[s.out].op;switch(s.op){case qB.ALT:case qB.ALT_MATCH:if(r===qB.MATCH||t.inst[s.arg].op===qB.MATCH)return null;break;case qB.EMPTY_WIDTH:if(r===qB.MATCH){if((s.arg&AB.EMPTY_END_TEXT)===AB.EMPTY_END_TEXT)continue;return null}break;default:if(r===qB.MATCH&&n)return null}}let s=(t=>{const e=new ic(t);for(let t=0;t<e.inst.length;t++){const n=e.inst[t];if(n.op!==qB.ALT&&n.op!==qB.ALT_MATCH)continue;let s="out",r="arg",i=e.inst[n[r]];if(i.op!==qB.ALT&&i.op!==qB.ALT_MATCH&&(s="arg",r="out",i=e.inst[n[r]],i.op!==qB.ALT&&i.op!==qB.ALT_MATCH))continue;const o=e.inst[n[s]];if(o.op===qB.ALT||o.op===qB.ALT_MATCH)continue;let a="out",B="arg",c=!1;i.out===t?c=!0:i.arg===t&&(c=!0,a="arg",B="out"),c&&(i[a]=n[s]),n[s]===i[a]&&(n[r]=i[B])}return e})(t);return s=(t=>{if(t.inst.length>=1e3)return null;const e=new rc(t.inst.length),n=new rc(t.inst.length),s=new Array(t.inst.length),r=new Array(t.inst.length).fill(!1),i=o=>{let a=!0;const B=t.inst[o];if(n.contains(o))return!0;switch(n.insert(o),B.op){case qB.ALT:case qB.ALT_MATCH:{a=i(B.out)&&i(B.arg);let t=r[B.out],e=r[B.arg];if(t&&e)return!1;if(e){const n=B.out;B.out=B.arg,B.arg=n;const s=t;t=e,e=s}t&&(r[o]=!0,B.op=qB.ALT_MATCH);const n=((t,e,n,s)=>{const r=t.length,i=e.length;let o=0,a=0;const B=[],c=[];let l=!0,u=-1;const h=r=>{const i=r?t:e,l=r?o:a,h=r?n:s;return!(u>0&&i[l]<=B[u]||(B.push(i[l],i[l+1]),r?o+=2:a+=2,u+=2,c.push(h),0))};for(;o<r||a<i;)if(l=a>=i?h(!0):o>=r||e[a]<t[o]?h(!1):h(!0),!l)return null;return{merged:B,next:c}})(s[B.out]||[],s[B.arg]||[],B.out,B.arg);if(!n)return!1;s[o]=new Int32Array(n.merged),B.next=new Uint32Array(n.next);break}case qB.CAPTURE:case qB.EMPTY_WIDTH:case qB.NOP:a=i(B.out),r[o]=r[B.out],s[o]=s[B.out]?new Int32Array(s[B.out]):new Int32Array(0),B.next=new Uint32Array(Math.floor(s[o].length/2)+1).fill(B.out);break;case qB.MATCH:case qB.FAIL:r[o]=B.op===qB.MATCH;break;case qB.RUNE:{if(r[o]=!1,B.next&&B.next.length>0)break;if(e.insert(B.out),!B.runes||0===B.runes.length){s[o]=new Int32Array(0),B.next=new Uint32Array([B.out]);break}let t=[];if(1===B.runes.length&&0!==(B.arg&aB.FOLD_CASE)){const e=B.runes[0];t.push(e,e);for(let n=vB.simpleFold(e);n!==e;n=vB.simpleFold(n))t.push(n,n);t.sort((t,e)=>t-e)}else for(let e=0;e<B.runes.length;e++)t.push(B.runes[e]);s[o]=new Int32Array(t),B.next=new Uint32Array(Math.floor(t.length/2)+1).fill(B.out),B.op=qB.RUNE;break}case qB.RUNE1:{if(r[o]=!1,B.next&&B.next.length>0)break;e.insert(B.out);let t=[];if(0!==(B.arg&aB.FOLD_CASE)){const e=B.runes[0];t.push(e,e);for(let n=vB.simpleFold(e);n!==e;n=vB.simpleFold(n))t.push(n,n);t.sort((t,e)=>t-e)}else t.push(B.runes[0],B.runes[0]);s[o]=new Int32Array(t),B.next=new Uint32Array(Math.floor(t.length/2)+1).fill(B.out),B.op=qB.RUNE;break}case qB.RUNE_ANY:if(r[o]=!1,B.next&&B.next.length>0)break;e.insert(B.out),s[o]=new Int32Array([0,vB.MAX_RUNE]),B.next=new Uint32Array([B.out]);break;case qB.RUNE_ANY_NOT_NL:if(r[o]=!1,B.next&&B.next.length>0)break;e.insert(B.out),s[o]=new Int32Array([0,9,11,vB.MAX_RUNE]),B.next=new Uint32Array(Math.floor(s[o].length/2)+1).fill(B.out)}return a};for(e.clear(),e.insert(t.start);!e.empty();)if(n.clear(),!i(e.next()))return null;for(let e=0;e<t.inst.length;e++)s[e]&&(t.inst[e].runes=s[e]);return t})(s),null!==s&&((t,e)=>{for(let n=0;n<e.inst.length;n++){const s=e.inst[n];switch(s.op){case qB.ALT:case qB.ALT_MATCH:case qB.RUNE:break;case qB.CAPTURE:case qB.EMPTY_WIDTH:case qB.NOP:case qB.MATCH:case qB.FAIL:t.inst[n].next=null;break;case qB.RUNE1:case qB.RUNE_ANY:case qB.RUNE_ANY_NOT_NL:t.inst[n].next=null,t.inst[n].op=s.op,t.inst[n].runes=s.runes?new Int32Array(s.runes):new Int32Array(0)}}})(s,t),s}static next(t,e){const n=t.matchRunePos(e);return n>=0?t.next[n]:t.op===qB.ALT_MATCH?t.out:0}static execute(e,n,s,r,i){const o=e.onepass;if(!o)return null;const a=new Int32Array(i).fill(-1);let B=!1,c=n.step(s),l=c>>3,u=7&c,h=LB.EOF(),d=-1,p=0;c!==LB.EOF()&&(h=n.step(s+u),h!==LB.EOF()&&(d=h>>3,p=7&h));let f,C=0===s?AB.emptyOpContext(-1,l):n.context(s),g=o.start;for(;;){switch(f=o.inst[g],g=f.out,f.op){case qB.MATCH:return r===aB.ANCHOR_BOTH&&s!==n.endPos()?null:(B=!0,a.length>0&&(a[0]=0,a[1]=s),0===i?[]:AB.toArray(a));case qB.RUNE:if(!f.matchRune(l))return null;break;case qB.RUNE1:if(l!==f.runes[0])return null;break;case qB.RUNE_ANY:break;case qB.RUNE_ANY_NOT_NL:if(10===l)return null;break;case qB.ALT:case qB.ALT_MATCH:g=t.next(f,l);continue;case qB.FAIL:return null;case qB.NOP:continue;case qB.EMPTY_WIDTH:if(0!==(f.arg&~C))return null;continue;case qB.CAPTURE:f.arg<a.length&&(a[f.arg]=s);continue;default:throw new $B("bad inst")}if(0===u)break;C=AB.emptyOpContext(l,d),s+=u,l=d,u=p,-1!==l&&(h=n.step(s+u),h!==LB.EOF()?(d=h>>3,p=7&h):(d=-1,p=0))}return B?0===i?[]:AB.toArray(a):null}},ac=class t{static Op=SB(["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","PLB","NLB","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(e){return e>=t.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(t){return t===mB.CODES["-"]?"\\":""}static fromRegexp(e){const n=new t(e.op);return n.flags=e.flags,n.subs=e.subs,n.runes=e.runes,n.cap=e.cap,n.min=e.min,n.max=e.max,n.name=e.name,n.namedGroups=e.namedGroups,n.lb=e.lb,n}constructor(e){this.op=e,this.flags=0,this.subs=t.emptySubs(),this.runes=new Int32Array(0),this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}reinit(){this.flags=0,this.subs=t.emptySubs(),this.runes=new Int32Array(0),this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}toString(){return this.appendTo()}appendTo(){let e="";switch(this.op){case t.Op.NO_MATCH:e+="[^\\x00-\\x{10FFFF}]";break;case t.Op.EMPTY_MATCH:e+="(?:)";break;case t.Op.STAR:case t.Op.PLUS:case t.Op.QUEST:case t.Op.REPEAT:{const n=this.subs[0];switch(n.op>t.Op.CAPTURE||n.op===t.Op.LITERAL&&n.runes.length>1?e+=`(?:${n.appendTo()})`:e+=n.appendTo(),this.op){case t.Op.STAR:e+="*";break;case t.Op.PLUS:e+="+";break;case t.Op.QUEST:e+="?";break;case t.Op.REPEAT:e+=`{${this.min}`,this.min!==this.max&&(e+=",",this.max>=0&&(e+=this.max)),e+="}"}0!==(this.flags&aB.NON_GREEDY)&&(e+="?");break}case t.Op.CONCAT:for(let n of this.subs)n.op===t.Op.ALTERNATE?e+=`(?:${n.appendTo()})`:e+=n.appendTo();break;case t.Op.ALTERNATE:{let t="";for(let n of this.subs)e+=t,t="|",e+=n.appendTo();break}case t.Op.LITERAL:0!==(this.flags&aB.FOLD_CASE)&&(e+="(?i:");for(let t of this.runes)e+=AB.escapeRune(t);0!==(this.flags&aB.FOLD_CASE)&&(e+=")");break;case t.Op.ANY_CHAR_NOT_NL:e+="(?-s:.)";break;case t.Op.ANY_CHAR:e+="(?s:.)";break;case t.Op.PLB:e+=`(?<=${this.subs[0].appendTo()})`;break;case t.Op.NLB:e+=`(?<!${this.subs[0].appendTo()})`;break;case t.Op.CAPTURE:null===this.name||0===this.name.length?e+="(":e+=`(?P<${this.name}>`,this.subs[0].op!==t.Op.EMPTY_MATCH&&(e+=this.subs[0].appendTo()),e+=")";break;case t.Op.BEGIN_TEXT:e+="\\A";break;case t.Op.END_TEXT:0!==(this.flags&aB.WAS_DOLLAR)?e+="(?-m:$)":e+="\\z";break;case t.Op.BEGIN_LINE:e+="^";break;case t.Op.END_LINE:e+="$";break;case t.Op.WORD_BOUNDARY:e+="\\b";break;case t.Op.NO_WORD_BOUNDARY:e+="\\B";break;case t.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]===vB.MAX_RUNE){e+="^";for(let n=1;n<this.runes.length-1;n+=2){const s=this.runes[n]+1,r=this.runes[n+1]-1;e+=t.quoteIfHyphen(s),e+=AB.escapeRune(s),s!==r&&(e+="-",e+=t.quoteIfHyphen(r),e+=AB.escapeRune(r))}}else for(let n=0;n<this.runes.length;n+=2){const s=this.runes[n],r=this.runes[n+1];e+=t.quoteIfHyphen(s),e+=AB.escapeRune(s),s!==r&&(e+="-",e+=t.quoteIfHyphen(r),e+=AB.escapeRune(r))}e+="]";break;default:e+=this.op}return e}maxCap(){let e=0;if(this.op===t.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 t))return!1;if(this.op!==e.op)return!1;switch(this.op){case t.Op.END_TEXT:if((this.flags&aB.WAS_DOLLAR)!==(e.flags&aB.WAS_DOLLAR))return!1;break;case t.Op.LITERAL:case t.Op.CHAR_CLASS:if((this.flags&aB.FOLD_CASE)!==(e.flags&aB.FOLD_CASE))return!1;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 t.Op.ALTERNATE:case t.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 t.Op.STAR:case t.Op.PLUS:case t.Op.QUEST:if((this.flags&aB.NON_GREEDY)!==(e.flags&aB.NON_GREEDY)||!this.subs[0].equals(e.subs[0]))return!1;break;case t.Op.REPEAT:if((this.flags&aB.NON_GREEDY)!==(e.flags&aB.NON_GREEDY)||this.min!==e.min||this.max!==e.max||!this.subs[0].equals(e.subs[0]))return!1;break;case t.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;break;case t.Op.PLB:case t.Op.NLB:if(this.lb!==e.lb||!this.subs[0].equals(e.subs[0]))return!1}return!0}},Bc=class{static walk(t,e){const n=[];let s,r=t;for(;;){if(0===r.subs.length)s=e.leaf(r);else{const t=e.enter(r);if(void 0===t.result){n.push({re:r,state:t,i:0}),r=r.subs[0];continue}s=t.result}for(;;){if(0===n.length)return s;const t=n[n.length-1];if(e.child(t.re,t.state,s,t.i),t.i++,void 0===t.state.result&&t.i<t.re.subs.length){r=t.re.subs[t.i];break}n.pop(),s=void 0!==t.state.result?t.state.result:e.leave(t.re,t.state)}}}},cc=class{constructor(t,e){const n=new Map,s=[0],r=[0],i=[0],o=[0];for(const a of t){let t=0;for(let B=0;B<a.length;B++){const c=t*e+a[B];let l=n.get(c);void 0===l&&(l=s.length,n.set(c,l),s.push(t),r.push(a[B]),i.push(i[t]+1),o.push(0)),t=l}o[t]=1}const a=s.length,B=new Int32Array(a-1);for(let t=1;t<a;t++)B[t-1]=t;B.sort((t,e)=>s[t]-s[e]||r[t]-r[e]);const c=new Int32Array(a+1);for(let t=1;t<a;t++)c[s[t]+1]++;for(let t=0;t<a;t++)c[t+1]+=c[t];const l=new Int32Array(a-1);for(let t=0;t<B.length;t++)l[t]=r[B[t]];this.childStart=c,this.childUnit=l,this.childNode=B;const u=new Int32Array(a);for(let t=0;t<a;t++)u[t]=t;u.sort((t,e)=>i[t]-i[e]);const h=new Int32Array(a),d=Uint8Array.from(o);for(let t=1;t<a;t++){const e=u[t],n=s[e];if(0!==n){let t=h[n],s=this.next(t,r[e]);for(;s<0&&0!==t;)t=h[t],s=this.next(t,r[e]);h[e]=s>=0?s:0}d[e]|=d[h[e]]}this.fail=h,this.match=d}next(t,e){let n=this.childStart[t],s=this.childStart[t+1];const r=this.childUnit;for(;n<s;){const t=n+s>>1,i=r[t];if(i===e)return this.childNode[t];i<e?n=t+1:s=t}return-1}advance(t,e){for(;;){const n=this.next(t,e);if(n>=0)return n;if(0===t)return 0;t=this.fail[t]}}searchUTF16(t,e,n){let s=0;for(let r=e;r<n;r++)if(s=this.advance(s,t.charCodeAt(r)),1===this.match[s])return!0;return!1}searchUTF8(t,e,n){let s=0;for(let r=e;r<n;r++)if(s=this.advance(s,t[r]),1===this.match[s])return!0;return!1}},lc=class t{static Type={NONE:0,EXACT:1,AND:2,OR:3};static MAX_SCANS=32;static MAX_AC_UNITS=1<<18;constructor(e){this.type=e,this.subs=[],this.str="",this.bytes=null,this.cost=e===t.Type.EXACT?1:0,this.allExact=!1,this.ac16=null,this.ac8=null}automaton16(){if(null===this.ac16){const t=this.subs.map(t=>{const e=new Array(t.str.length);for(let n=0;n<t.str.length;n++)e[n]=t.str.charCodeAt(n);return e});this.ac16=new cc(t,65536)}return this.ac16}automaton8(){return null===this.ac8&&(this.ac8=new cc(this.subs.map(t=>t.bytes),256)),this.ac8}eval(e,n){switch(this.type){case t.Type.NONE:return!0;case t.Type.EXACT:return e.hasString(this,n);case t.Type.AND:for(let t=0;t<this.subs.length;t++)if(!this.subs[t].eval(e,n))return!1;return!0;case t.Type.OR:if(this.allExact)return e.hasAnyString(this,n);for(let t=0;t<this.subs.length;t++)if(this.subs[t].eval(e,n))return!0;return!1;default:return!0}}},uc=class t{static build(e){return e?Bc.walk(e,t.WALKER):new lc(lc.Type.NONE)}static WALKER={leaf:e=>t.leaf(e),enter:e=>t.enter(e),child:(e,n,s)=>t.child(e,n,s),leave:(e,n)=>t.leave(e,n)};static leaf(t){if(t.op!==ac.Op.LITERAL)return new lc(lc.Type.NONE);if(0===t.runes.length||0!==(t.flags&aB.FOLD_CASE))return new lc(lc.Type.NONE);let e="";for(let n=0;n<t.runes.length;n++){if(vB.isUnsearchable(t.runes[n]))return new lc(lc.Type.NONE);e+=String.fromCodePoint(t.runes[n])}const n=new lc(lc.Type.EXACT);return n.str=e,n.bytes=AB.stringToUtf8ByteArray(n.str),n}static enter(t){switch(t.op){case ac.Op.CAPTURE:case ac.Op.PLUS:return{sub:null};case ac.Op.REPEAT:return t.min>=1?{sub:null}:{result:new lc(lc.Type.NONE)};case ac.Op.CONCAT:return{pf:new lc(lc.Type.AND),subs:[]};case ac.Op.ALTERNATE:return{pf:new lc(lc.Type.OR),subs:[]};default:return{result:new lc(lc.Type.NONE)}}}static child(t,e,n){if(void 0!==e.subs)if(e.pf.type!==lc.Type.AND)if(n.type!==lc.Type.NONE)if(n.type!==lc.Type.OR)e.subs.push(n);else for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);else e.result=new lc(lc.Type.NONE);else{if(n.type===lc.Type.NONE)return;if(n.type===lc.Type.AND){for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);return}e.subs.push(n)}else e.sub=n}static leave(t,e){if(void 0===e.subs)return e.sub;const n=e.pf,s=new Set,r=[];for(const t of e.subs){if(t.type===lc.Type.EXACT){if(s.has(t.str))continue;s.add(t.str)}r.push(t)}if(n.type===lc.Type.AND){const t=[];let e=0;for(const n of r)e+n.cost>lc.MAX_SCANS||(t.push(n),e+=n.cost);return 0===t.length?new lc(lc.Type.NONE):1===t.length?t[0]:(n.subs=t,n.cost=e,n)}if(0===r.length)return new lc(lc.Type.NONE);if(1===r.length)return r[0];n.subs=r;let i=!0,o=0,a=0;for(const t of r)t.type!==lc.Type.EXACT?i=!1:a+=t.bytes.length,o+=t.cost;return i?a>lc.MAX_AC_UNITS?new lc(lc.Type.NONE):(n.allExact=!0,n.cost=1,n):o>lc.MAX_SCANS?new lc(lc.Type.NONE):(n.cost=o,n)}},hc=class{constructor(t=0,e=0){this.head=t,this.tail=e}},dc=class{constructor(){this.inst=[],this.start=0,this.numCap=2,this.lbStarts=[],this.numLb=0,this.lbInst=null}getInst(t){return this.inst[t]}numInst(){return this.inst.length}addInst(t){this.inst.push(new qB(t))}markLookbehindInsts(){const t=new Uint8Array(this.inst.length),e=this.lbStarts.slice();for(;e.length>0;){const n=e.pop();if(0===n||1===t[n])continue;t[n]=1;const s=this.inst[n];switch(s.op){case qB.ALT:case qB.ALT_MATCH:e.push(s.out,s.arg);break;case qB.MATCH:case qB.FAIL:break;default:e.push(s.out)}}this.lbInst=t}skipNop(t){let e=this.inst[t];for(;e.op===qB.NOP||e.op===qB.CAPTURE;)e=this.inst[t],t=e.out;return e}prefix(){let t="",e=this.skipNop(this.start);if(!qB.isRuneOp(e.op)||1!==e.runes.length)return[e.op===qB.MATCH,t];for(;qB.isRuneOp(e.op)&&1===e.runes.length&&0===(e.arg&aB.FOLD_CASE)&&!vB.isUnsearchable(e.runes[0]);)t+=String.fromCodePoint(e.runes[0]),e=this.skipNop(e.out);return[e.op===qB.MATCH,t]}startCond(){let t=0,e=this.start;t:for(;;){const n=this.inst[e];switch(n.op){case qB.EMPTY_WIDTH:t|=n.arg;break;case qB.FAIL:return-1;case qB.CAPTURE:case qB.NOP:break;default:break t}e=n.out}return t}patch(t,e){let n=t.head;for(;0!==n;){const t=this.inst[n>>1];1&n?(n=t.arg,t.arg=e):(n=t.out,t.out=e)}}append(t,e){if(0===t.head)return e;if(0===e.head)return t;const n=this.inst[t.tail>>1];return 1&t.tail?n.arg=e.head:n.out=e.head,new hc(t.head,e.tail)}toString(){let t="";for(let e=0;e<this.inst.length;e++){const n=t.length;t+=e,e===this.start&&(t+="*"),t+=" ".substring(t.length-n),t+=this.inst[e],t+="\n"}return t}};const pc=new Int32Array([0,mB.CODES["\n"]-1,mB.CODES["\n"]+1,vB.MAX_RUNE]),fc=new Int32Array([0,vB.MAX_RUNE]);var Cc=class{constructor(t=0,e=new hc,n=!1){this.i=t,this.out=e,this.nullable=n}},gc=class t{static compileRegexp(e){const n=new t,s=n.compile(e);return n.prog.patch(s.out,n.newInst(qB.MATCH).i),n.prog.start=s.i,n.prog.markLookbehindInsts(),n.prog}static compileSet(e){const n=new t;if(0===e.length)return n.prog.start=n.newInst(qB.FAIL).i,n.prog.markLookbehindInsts(),n.prog;let s=[];for(let t=0;t<e.length;t++){n.lbOffset=n.prog.numLb;const r=n.compile(e[t]),i=n.newInst(qB.MATCH);n.prog.getInst(i.i).arg=t,n.prog.patch(r.out,i.i),s.push(r.i)}let r=s[0];for(let t=1;t<s.length;t++){const e=n.newInst(qB.ALT),i=n.prog.getInst(e.i);i.out=r,i.arg=s[t],r=e.i}return n.prog.start=r,n.prog.markLookbehindInsts(),n.prog}constructor(){this.prog=new dc,this.newInst(qB.FAIL),this.lbOffset=0,this.runeCache=new Map,this.walker={leaf:t=>this.leaf(t),enter:t=>this.enter(t),child:(t,e,n)=>this.child(t,e,n),leave:(t,e)=>this.leave(t,e)}}newInst(t){return this.prog.addInst(t),new Cc(this.prog.numInst()-1,new hc,!0)}nop(){const t=this.newInst(qB.NOP);return t.out=new hc(t.i<<1,t.i<<1),t}fail(){return new Cc}cap(t){const e=this.newInst(qB.CAPTURE);return e.out=new hc(e.i<<1,e.i<<1),this.prog.getInst(e.i).arg=t,this.prog.numCap<t+1&&(this.prog.numCap=t+1),e}cat(t,e){return 0===t.i||0===e.i?(this.prog.patch(t.out,0),this.prog.patch(e.out,0),this.fail()):(this.prog.patch(t.out,e.i),new Cc(t.i,e.out,t.nullable&&e.nullable))}alt(t,e){if(0===t.i)return e;if(0===e.i)return t;const n=this.newInst(qB.ALT),s=this.prog.getInst(n.i);return s.out=t.i,s.arg=e.i,n.out=this.prog.append(t.out,e.out),n.nullable=t.nullable||e.nullable,n}loop(t,e){const n=this.newInst(qB.ALT),s=this.prog.getInst(n.i);return e?(s.arg=t.i,n.out=new hc(n.i<<1,n.i<<1)):(s.out=t.i,n.out=new hc(n.i<<1|1,n.i<<1|1)),this.prog.patch(t.out,n.i),n}quest(t,e){if(0===t.i)return this.nop();const n=this.newInst(qB.ALT),s=this.prog.getInst(n.i);return e?(s.arg=t.i,n.out=new hc(n.i<<1,n.i<<1)):(s.out=t.i,n.out=new hc(n.i<<1|1,n.i<<1|1)),n.out=this.prog.append(n.out,t.out),n}star(t,e){return 0===t.i?this.nop():t.nullable?this.quest(this.plus(t,e),e):this.loop(t,e)}plus(t,e){return 0===t.i?this.fail():new Cc(t.i,this.loop(t,e).out,t.nullable)}empty(t){const e=this.newInst(qB.EMPTY_WIDTH);return this.prog.getInst(e.i).arg=t,e.out=new hc(e.i<<1,e.i<<1),e}rune(t,e){const n=this.newInst(qB.RUNE);n.nullable=!1;const s=this.prog.getInst(n.i);return s.runes=t,e&=aB.FOLD_CASE,1===t.length&&vB.simpleFold(t[0])!==t[0]||(e&=-2),s.arg=e,n.out=new hc(n.i<<1,n.i<<1),0===(e&aB.FOLD_CASE)&&1===t.length||2===t.length&&t[0]===t[1]?s.op=qB.RUNE1:2===t.length&&0===t[0]&&t[1]===vB.MAX_RUNE?s.op=qB.RUNE_ANY:4===t.length&&0===t[0]&&t[1]===mB.CODES["\n"]-1&&t[2]===mB.CODES["\n"]+1&&t[3]===vB.MAX_RUNE&&(s.op=qB.RUNE_ANY_NOT_NL),n}lookBehind(t,e){const n=Math.sign(e)*(Math.abs(e)+this.lbOffset),s=this.newInst(qB.LB_WRITE);this.prog.getInst(s.i).arg=n;const r=this.rune(fc,0),i=this.star(r,!0),o=this.cat(i,t);this.prog.patch(o.out,s.i);const a=this.newInst(qB.LB_CHECK);return this.prog.getInst(a.i).arg=n,this.prog.lbStarts.push(o.i),Math.abs(n)>this.prog.numLb&&(this.prog.numLb=Math.abs(n)),a.out=new hc(a.i<<1,a.i<<1),a}compile(t){return Bc.walk(t,this.walker)}leaf(t){switch(t.op){case ac.Op.NO_MATCH:return this.fail();case ac.Op.EMPTY_MATCH:return this.nop();case ac.Op.LITERAL:{if(0===t.runes.length)return this.nop();let e=null;for(let n of t.runes){let s=this.runeCache.get(n);void 0===s&&(s=new Int32Array([n]),this.runeCache.set(n,s));const r=this.rune(s,t.flags);e=null===e?r:this.cat(e,r)}return e}case ac.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case ac.Op.ANY_CHAR_NOT_NL:return this.rune(pc,0);case ac.Op.ANY_CHAR:return this.rune(fc,0);case ac.Op.BEGIN_LINE:return this.empty(AB.EMPTY_BEGIN_LINE);case ac.Op.END_LINE:return this.empty(AB.EMPTY_END_LINE);case ac.Op.BEGIN_TEXT:return this.empty(AB.EMPTY_BEGIN_TEXT);case ac.Op.END_TEXT:return this.empty(AB.EMPTY_END_TEXT);case ac.Op.WORD_BOUNDARY:return this.empty(AB.EMPTY_WORD_BOUNDARY);case ac.Op.NO_WORD_BOUNDARY:return this.empty(AB.EMPTY_NO_WORD_BOUNDARY);case ac.Op.CONCAT:case ac.Op.ALTERNATE:return this.nop();default:throw new UB("regexp: unhandled case in compile")}}enter(t){switch(t.op){case ac.Op.PLB:case ac.Op.NLB:case ac.Op.STAR:case ac.Op.PLUS:case ac.Op.QUEST:return{sub:null};case ac.Op.CAPTURE:return{bra:this.cap(t.cap<<1),sub:null};case ac.Op.CONCAT:case ac.Op.ALTERNATE:return{f:null};default:throw new UB("regexp: unhandled case in compile")}}child(t,e,n){t.op===ac.Op.CONCAT?e.f=null===e.f?n:this.cat(e.f,n):t.op===ac.Op.ALTERNATE?e.f=null===e.f?n:this.alt(e.f,n):e.sub=n}leave(t,e){switch(t.op){case ac.Op.PLB:case ac.Op.NLB:return this.lookBehind(e.sub,t.lb);case ac.Op.CAPTURE:{const n=this.cap(t.cap<<1|1);return this.cat(this.cat(e.bra,e.sub),n)}case ac.Op.STAR:return this.star(e.sub,0!==(t.flags&aB.NON_GREEDY));case ac.Op.PLUS:return this.plus(e.sub,0!==(t.flags&aB.NON_GREEDY));case ac.Op.QUEST:return this.quest(e.sub,0!==(t.flags&aB.NON_GREEDY));case ac.Op.CONCAT:case ac.Op.ALTERNATE:return e.f;default:throw new UB("regexp: unhandled case in compile")}}},mc=class t{static simplify(e){return null===e?null:Bc.walk(e,t.WALKER)}static WALKER={leaf:e=>t.leaf(e),enter:e=>t.enter(e),child:(e,n,s,r)=>t.child(e,n,s,r),leave:(e,n)=>t.leave(e,n)};static leaf(t){if(t.op===ac.Op.CHAR_CLASS){if(null===t.runes)return t;if(0===t.runes.length)return new ac(ac.Op.NO_MATCH);if(2===t.runes.length&&0===t.runes[0]&&t.runes[1]===vB.MAX_RUNE)return new ac(ac.Op.ANY_CHAR);if(4===t.runes.length&&0===t.runes[0]&&t.runes[1]===mB.CODES["\n"]-1&&t.runes[2]===mB.CODES["\n"]+1&&t.runes[3]===vB.MAX_RUNE)return new ac(ac.Op.ANY_CHAR_NOT_NL)}return t}static enter(t){switch(t.op){case ac.Op.PLB:case ac.Op.NLB:case ac.Op.CAPTURE:case ac.Op.STAR:case ac.Op.PLUS:case ac.Op.QUEST:return{sub:null};case ac.Op.CONCAT:case ac.Op.ALTERNATE:return{subs:[],changed:!1};case ac.Op.REPEAT:return 0===t.min&&0===t.max?{result:new ac(ac.Op.EMPTY_MATCH)}:{sub:null};default:return{result:t}}}static child(t,e,n,s){if(void 0!==e.subs){if(n!==t.subs[s]&&(e.changed=!0),t.op===ac.Op.CONCAT){if(n.op===ac.Op.NO_MATCH)return void(e.result=new ac(ac.Op.NO_MATCH));if(n.op===ac.Op.EMPTY_MATCH)return void(e.changed=!0);if(n.op===ac.Op.CONCAT){e.changed=!0;for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);return}}else{if(n.op===ac.Op.NO_MATCH)return void(e.changed=!0);if(n.op===ac.Op.ALTERNATE){e.changed=!0;for(let t=0;t<n.subs.length;t++)e.subs.push(n.subs[t]);return}}e.subs.push(n)}else e.sub=n}static leave(e,n){switch(e.op){case ac.Op.PLB:case ac.Op.NLB:case ac.Op.CAPTURE:{const t=n.sub;if(t!==e.subs[0]){const n=ac.fromRegexp(e);return n.runes=new Int32Array(0),n.subs=[t],n}return e}case ac.Op.CONCAT:case ac.Op.ALTERNATE:if(n.changed){const t=n.subs;if(0===t.length)return new ac(e.op===ac.Op.CONCAT?ac.Op.EMPTY_MATCH:ac.Op.NO_MATCH);if(1===t.length)return t[0];const s=ac.fromRegexp(e);return s.runes=new Int32Array(0),s.subs=t,s}return e;case ac.Op.STAR:case ac.Op.PLUS:case ac.Op.QUEST:return t.simplify1(e.op,e.flags,n.sub,e);case ac.Op.REPEAT:return t.simplifyRepeat(e,n.sub);default:return e}}static simplifyRepeat(e,n){if(-1===e.max){if(0===e.min)return t.simplify1(ac.Op.STAR,e.flags,n,null);if(1===e.min)return t.simplify1(ac.Op.PLUS,e.flags,n,null);const s=[];for(let t=0;t<e.min-1;t++)s.push(n);return s.push(t.simplify1(ac.Op.PLUS,e.flags,n,null)),t.concat(s)}if(1===e.min&&1===e.max)return n;let s=null;if(e.min>0){s=[];for(let t=0;t<e.min;t++)s.push(n)}if(e.max>e.min){let r=t.simplify1(ac.Op.QUEST,e.flags,n,null);for(let s=e.min+1;s<e.max;s++)r=t.simplify1(ac.Op.QUEST,e.flags,t.concat([n,r]),null);if(null===s)return r;s.push(r)}return null!==s?t.concat(s):new ac(ac.Op.NO_MATCH)}static concat(t){const e=[];for(let n=0;n<t.length;n++){const s=t[n];if(s.op===ac.Op.NO_MATCH)return new ac(ac.Op.NO_MATCH);if(s.op!==ac.Op.EMPTY_MATCH)if(s.op!==ac.Op.CONCAT)e.push(s);else for(let t=0;t<s.subs.length;t++)e.push(s.subs[t])}if(0===e.length)return new ac(ac.Op.EMPTY_MATCH);if(1===e.length)return e[0];const n=new ac(ac.Op.CONCAT);return n.subs=e,n}static simplify1(t,e,n,s){if(n.op===ac.Op.EMPTY_MATCH)return n;if(n.op===ac.Op.NO_MATCH)return t===ac.Op.PLUS?n:new ac(ac.Op.EMPTY_MATCH);if(t===n.op&&(e&aB.NON_GREEDY)===(n.flags&aB.NON_GREEDY))return n;if(null!==s&&s.op===t&&(s.flags&aB.NON_GREEDY)===(e&aB.NON_GREEDY)&&n===s.subs[0])return s;const r=new ac(t);return r.flags=e,r.subs=[n],r}},wc=class{constructor(t,e){this.sign=t,this.cls=e}};const yc=[48,57],Ec=[9,10,12,13,32,32],_c=[48,57,65,90,95,95,97,122],Dc=new Map([["\\d",new wc(1,yc)],["\\D",new wc(-1,yc)],["\\s",new wc(1,Ec)],["\\S",new wc(-1,Ec)],["\\w",new wc(1,_c)],["\\W",new wc(-1,_c)]]),bc=[48,57,65,90,97,122],vc=[65,90,97,122],Ic=[0,127],Tc=[9,9,32,32],Oc=[0,31,127,127],Ac=[48,57],Sc=[33,126],Rc=[97,122],Nc=[32,126],xc=[33,47,58,64,91,96,123,126],kc=[9,13,32,32],Lc=[65,90],Fc=[48,57,65,90,95,95,97,122],Pc=[48,57,65,70,97,102],Mc=new Map([["[:alnum:]",new wc(1,bc)],["[:^alnum:]",new wc(-1,bc)],["[:alpha:]",new wc(1,vc)],["[:^alpha:]",new wc(-1,vc)],["[:ascii:]",new wc(1,Ic)],["[:^ascii:]",new wc(-1,Ic)],["[:blank:]",new wc(1,Tc)],["[:^blank:]",new wc(-1,Tc)],["[:cntrl:]",new wc(1,Oc)],["[:^cntrl:]",new wc(-1,Oc)],["[:digit:]",new wc(1,Ac)],["[:^digit:]",new wc(-1,Ac)],["[:graph:]",new wc(1,Sc)],["[:^graph:]",new wc(-1,Sc)],["[:lower:]",new wc(1,Rc)],["[:^lower:]",new wc(-1,Rc)],["[:print:]",new wc(1,Nc)],["[:^print:]",new wc(-1,Nc)],["[:punct:]",new wc(1,xc)],["[:^punct:]",new wc(-1,xc)],["[:space:]",new wc(1,kc)],["[:^space:]",new wc(-1,kc)],["[:upper:]",new wc(1,Lc)],["[:^upper:]",new wc(-1,Lc)],["[:word:]",new wc(1,Fc)],["[:^word:]",new wc(-1,Fc)],["[:xdigit:]",new wc(1,Pc)],["[:^xdigit:]",new wc(-1,Pc)]]);var Gc=class t{static charClassToString(t,e){let n="[";for(let s=0;s<e;s+=2){s>0&&(n+=" ");const e=t[s],r=t[s+1];n+=e===r?`0x${e.toString(16)}`:`0x${e.toString(16)}-0x${r.toString(16)}`}return n+="]",n}static sortRanges(t,e){const n=e>>1,s=new Array(n);for(let t=0;t<n;t++)s[t]=t;s.sort((e,n)=>t[2*e]-t[2*n]||t[2*n+1]-t[2*e+1]);const r=t.slice(0,e);for(let e=0;e<n;e++)t[2*e]=r[2*s[e]],t[2*e+1]=r[2*s[e]+1]}constructor(t=AB.emptyInts()){this.r=t,this.len=t.length}toArray(){return this.r instanceof Int32Array?this.len===this.r.length?this.r:this.r.subarray(0,this.len):new Int32Array(this.len===this.r.length?this.r:this.r.slice(0,this.len))}toGrowableArray(){return Array.isArray(this.r)?(this.r.length=this.len,this.r):Array.from(this.r.subarray(0,this.len))}cleanClass(){if(this.len<4)return this;t.sortRanges(this.r,this.len);let e=2;for(let t=2;t<this.len;t+=2){const n=this.r[t],s=this.r[t+1];n<=this.r[e-1]+1?s>this.r[e-1]&&(this.r[e-1]=s):(this.r[e]=n,this.r[e+1]=s,e+=2)}return this.len=e,this}appendLiteral(t,e){return 0!==(e&aB.FOLD_CASE)?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,e){if(this.len>0)for(let n=2;n<=4;n+=2)if(this.len>=n){const s=this.r[this.len-n],r=this.r[this.len-n+1];if(t<=r+1&&s<=e+1)return t<s&&(this.r[this.len-n]=t),e>r&&(this.r[this.len-n+1]=e),this}return this.r[this.len++]=t,this.r[this.len++]=e,this}appendFoldedRange(t,e){if(t<=vB.MIN_FOLD&&e>=vB.MAX_FOLD)return this.appendRange(t,e);if(e<vB.MIN_FOLD||t>vB.MAX_FOLD)return this.appendRange(t,e);t<vB.MIN_FOLD&&(this.appendRange(t,vB.MIN_FOLD-1),t=vB.MIN_FOLD),e>vB.MAX_FOLD&&(this.appendRange(vB.MAX_FOLD+1,e),e=vB.MAX_FOLD);for(let n=t;n<=e;n++){this.appendRange(n,n);for(let t=vB.simpleFold(n);t!==n;t=vB.simpleFold(t))this.appendRange(t,t)}return this}appendClass(t){for(let e=0;e<t.length;e+=2)this.appendRange(t[e],t[e+1]);return this}appendFoldedClass(t){for(let e=0;e<t.length;e+=2)this.appendFoldedRange(t[e],t[e+1]);return this}appendNegatedClass(t){let e=0;for(let n=0;n<t.length;n+=2){const s=t[n],r=t[n+1];e<=s-1&&this.appendRange(e,s-1),e=r+1}return e<=vB.MAX_RUNE&&this.appendRange(e,vB.MAX_RUNE),this}appendTable(t){for(let e=0;e<t.length;++e){const n=t.getLo(e),s=t.getHi(e),r=t.getStride(e);if(1!==r)for(let t=n;t<=s;t+=r)this.appendRange(t,t);else this.appendRange(n,s)}return this}appendNegatedTable(t){let e=0;for(let n=0;n<t.length;++n){const s=t.getLo(n),r=t.getHi(n),i=t.getStride(n);if(1!==i)for(let t=s;t<=r;t+=i)e<=t-1&&this.appendRange(e,t-1),e=t+1;else e<=s-1&&this.appendRange(e,s-1),e=r+1}return e<=vB.MAX_RUNE&&this.appendRange(e,vB.MAX_RUNE),this}appendTableWithSign(t,e){return e<0?this.appendNegatedTable(t):this.appendTable(t)}negateClass(){let t=0,e=0;for(let n=0;n<this.len;n+=2){const s=this.r[n],r=this.r[n+1];t<=s-1&&(this.r[e]=t,this.r[e+1]=s-1,e+=2),t=r+1}return this.len=e,t<=vB.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=vB.MAX_RUNE),this}appendClassWithSign(t,e){return e<0?this.appendNegatedClass(t):this.appendClass(t)}appendGroup(e,n){let s=e.cls;return n&&(s=(new t).appendFoldedClass(s).cleanClass().toArray()),this.appendClassWithSign(s,e.sign)}toString(){return t.charClassToString(this.r,this.len)}},Hc=class{constructor(t){this.str=t,this.position=0}pos(){return this.position}rewindTo(t){this.position=t}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(t){this.position+=t}skipString(t){this.position+=t.length}pop(){const t=this.str.codePointAt(this.position);return this.position+=AB.charCount(t),t}lookingAt(t){return this.str.startsWith(t,this.position)}rest(){return this.str.substring(this.position)}from(t){return this.str.substring(t,this.position)}toString(){return this.rest()}},Uc=class t{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 ERR_UNEXPECTED_PAREN="unexpected )";static ERR_NESTING_DEPTH="expression nests too deeply";static ERR_LARGE="expression too large";static ERR_INVALID_CAPTURE_IN_LOOKBEHIND="invalid capture in lookbehind";static MAX_HEIGHT=1e3;static MAX_SIZE=1398101;static MAX_RUNES=33554432;static ANY_TABLE=new wB(new Uint32Array([0,vB.MAX_RUNE,1]));static ASCII_TABLE=new wB(new Uint32Array([0,127,1]));static ASCII_FOLD_TABLE=new wB(new Uint32Array([0,127,1,383,383,1,8490,8490,1]));static unicodeTable(e){return"Any"===e?{tab:t.ANY_TABLE,fold:t.ANY_TABLE,sign:1}:"Ascii"===e?{tab:t.ASCII_TABLE,fold:t.ASCII_FOLD_TABLE,sign:1}:"Assigned"===e?{tab:bB.CATEGORIES.get("Cn"),fold:bB.CATEGORIES.get("Cn"),sign:-1}:"Lc"===e?{tab:bB.CATEGORIES.get("LC"),fold:bB.FOLD_CATEGORIES.get("LC"),sign:1}:bB.CATEGORIES.has(e)?{tab:bB.CATEGORIES.get(e),fold:bB.FOLD_CATEGORIES.get(e),sign:1}:bB.SCRIPTS.has(e)?{tab:bB.SCRIPTS.get(e),fold:bB.FOLD_SCRIPT.get(e),sign:1}:null}static minFoldRune(t){if(t<vB.MIN_FOLD||t>vB.MAX_FOLD)return t;let e=t;const n=t;for(t=vB.simpleFold(t);t!==n;t=vB.simpleFold(t))e>t&&(e=t);return e}static leadingRegexp(t){if(t.op===ac.Op.EMPTY_MATCH)return null;if(t.op===ac.Op.CONCAT&&t.subs.length>0){const e=t.subs[0];return e.op===ac.Op.EMPTY_MATCH?null:e}return t}static literalRegexp(t,e){const n=new ac(ac.Op.LITERAL);return n.flags=e,n.runes=AB.stringToRunes(t),n}static parse(e,n){return new t(e,n).parseInternal()}static parseRepeat(e){const n=e.pos();if(!e.more()||!e.lookingAt("{"))return-1;e.skip(1);const s=t.parseInt(e);if(-1===s)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=t.parseInt(e)))return-1}else r=s;if(!e.more()||!e.lookingAt("}"))return-1;if(e.skip(1),s<0||s>1e3||-2===r||r>1e3||r>=0&&s>r)throw new HB(t.ERR_INVALID_REPEAT_SIZE,e.from(n));return s<<16|r&vB.MAX_BMP}static isValidCaptureName(t){if(0===t.length)return!1;for(let e=0;e<t.length;e++){const n=t.codePointAt(e);if(n!==mB.CODES._&&!AB.isalnum(n))return!1}return!0}static parseInt(t){const e=t.pos();for(;t.more()&&t.peek()>=mB.CODES[0]&&t.peek()<=mB.CODES[9];)t.skip(1);const n=t.from(e);return 0===n.length||n.length>1&&n.codePointAt(0)===mB.CODES[0]?-1:n.length>8?-2:parseInt(n,10)}static isCharClass(t){return t.op===ac.Op.LITERAL&&1===t.runes.length||t.op===ac.Op.CHAR_CLASS||t.op===ac.Op.ANY_CHAR_NOT_NL||t.op===ac.Op.ANY_CHAR}static matchRune(t,e){switch(t.op){case ac.Op.LITERAL:return 1===t.runes.length&&t.runes[0]===e;case ac.Op.CHAR_CLASS:for(let n=0;n<t.runes.length;n+=2)if(t.runes[n]<=e&&e<=t.runes[n+1])return!0;return!1;case ac.Op.ANY_CHAR_NOT_NL:return e!==mB.CODES["\n"];case ac.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(e,n){switch(e.op){case ac.Op.ANY_CHAR:break;case ac.Op.ANY_CHAR_NOT_NL:t.matchRune(n,mB.CODES["\n"])&&(e.op=ac.Op.ANY_CHAR);break;case ac.Op.CHAR_CLASS:{const t=new Gc(Array.isArray(e.runes)?e.runes:Array.from(e.runes));n.op===ac.Op.LITERAL?t.appendLiteral(n.runes[0],n.flags):t.appendClass(n.runes),e.runes=t.toGrowableArray();break}case ac.Op.LITERAL:if(n.runes[0]===e.runes[0]&&n.flags===e.flags)break;e.op=ac.Op.CHAR_CLASS,e.runes=(new Gc).appendLiteral(e.runes[0],e.flags).appendLiteral(n.runes[0],n.flags).toGrowableArray()}}static parseEscape(e){const n=e.pos();if(e.skip(1),!e.more())throw new HB(t.ERR_TRAILING_BACKSLASH);let s=e.pop();t:switch(s){case mB.CODES[1]:case mB.CODES[2]:case mB.CODES[3]:case mB.CODES[4]:case mB.CODES[5]:case mB.CODES[6]:case mB.CODES[7]:if(!e.more()||e.peek()<mB.CODES[0]||e.peek()>mB.CODES[7])break;case mB.CODES[0]:{let t=s-mB.CODES[0];for(let n=1;n<3&&!(!e.more()||e.peek()<mB.CODES[0]||e.peek()>mB.CODES[7]);n++)t=8*t+e.peek()-mB.CODES[0],e.skip(1);return t}case mB.CODES.x:{if(!e.more())break;if(s=e.pop(),s===mB.CODES["{"]){let t=0,n=0;for(;;){if(!e.more())break t;if(s=e.pop(),s===mB.CODES["}"])break;const r=AB.unhex(s);if(r<0)break t;if(n=16*n+r,n>vB.MAX_RUNE)break t;t++}if(0===t)break t;return n}const t=AB.unhex(s);if(!e.more())break;s=e.pop();const n=AB.unhex(s);if(t<0||n<0)break;return 16*t+n}case mB.CODES.a:return mB.CODES[""];case mB.CODES.f:return mB.CODES["\f"];case mB.CODES.n:return mB.CODES["\n"];case mB.CODES.r:return mB.CODES["\r"];case mB.CODES.t:return mB.CODES["\t"];case mB.CODES.v:return mB.CODES["\v"];default:if(s<=vB.MAX_ASCII&&!AB.isalnum(s))return s}throw new HB(t.ERR_INVALID_ESCAPE,e.from(n))}static parseClassChar(e,n){if(!e.more())throw new HB(t.ERR_MISSING_BRACKET,e.from(n));return e.lookingAt("\\")?t.parseEscape(e):e.pop()}static hasCapture(e){if(null===e)return!1;if(e.op===ac.Op.CAPTURE)return!0;if(e.subs)for(let n of e.subs)if(t.hasCapture(n))return!0;return!1}constructor(t,e=0){this.wholeRegexp=t,this.flags=e,this.numCap=0,this.namedGroups=Object.create(null),this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null,this.nlb=0}newRegexp(t){let e=this.free;return null!==e&&null!==e.subs&&e.subs.length>0?(this.free=e.subs[0],e.reinit(),e.op=t):(e=new ac(t),this.numRegexp+=1),e}reuse(t){null!==this.height&&this.height.has(t)&&this.height.delete(t),null!==t.subs&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(e){if(this.numRunes>t.MAX_RUNES)throw new HB(t.ERR_LARGE);this.checkSize(e),this.checkHeight(e)}checkSize(e){if(null===this.size){if(0===this.repeats&&(this.repeats=1),e.op===ac.Op.REPEAT){let n=e.max;-1===n&&(n=e.min),n<=0&&(n=1),n>Math.floor(t.MAX_SIZE/this.repeats)?this.repeats=t.MAX_SIZE:this.repeats*=n}if(this.numRegexp<Math.floor(t.MAX_SIZE/this.repeats))return;this.size=new Map;for(let t of this.stack)this.checkSize(t)}if(this.calcSize(e,!0)>t.MAX_SIZE)throw new HB(t.ERR_LARGE)}calcSize(t,e=!1){if(!e&&null!==this.size&&this.size.has(t))return this.size.get(t);let n=0;switch(t.op){case ac.Op.LITERAL:n=t.runes.length;break;case ac.Op.PLB:case ac.Op.NLB:case ac.Op.CAPTURE:case ac.Op.STAR:n=2+this.calcSize(t.subs[0]);break;case ac.Op.PLUS:case ac.Op.QUEST:n=1+this.calcSize(t.subs[0]);break;case ac.Op.CONCAT:for(let e of t.subs)n+=this.calcSize(e);break;case ac.Op.ALTERNATE:for(let e of t.subs)n+=this.calcSize(e);t.subs.length>1&&(n=n+t.subs.length-1);break;case ac.Op.REPEAT:{let e=this.calcSize(t.subs[0]);if(-1===t.max){n=0===t.min?2+e:1+t.min*e;break}n=t.max*e+(t.max-t.min);break}}return n=Math.max(1,n),null===this.size&&(this.size=new Map),this.size.set(t,n),n}checkHeight(e){if(!(this.numRegexp<t.MAX_HEIGHT)){if(null===this.height){this.height=new Map;for(let t of this.stack)this.checkHeight(t)}if(this.calcHeight(e,!0)>t.MAX_HEIGHT)throw new HB(t.ERR_NESTING_DEPTH)}}calcHeight(t,e=!1){if(!e&&null!==this.height&&this.height.has(t))return this.height.get(t);let n=1;for(let e of t.subs){const t=this.calcHeight(e);n<1+t&&(n=1+t)}return null===this.height&&(this.height=new Map),this.height.set(t,n),n}pop(){return this.stack.pop()}popToPseudo(){const t=this.stack.length;let e=t;for(;e>0&&!ac.isPseudoOp(this.stack[e-1].op);)e--;return this.stack.splice(e,t-e)}push(t){if(this.numRunes+=t.runes.length,t.op===ac.Op.CHAR_CLASS&&2===t.runes.length&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],-2&this.flags))return null;t.op=ac.Op.LITERAL,t.runes=[t.runes[0]],t.flags=-2&this.flags}else if(t.op===ac.Op.CHAR_CLASS&&4===t.runes.length&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&vB.simpleFold(t.runes[0])===t.runes[2]&&vB.simpleFold(t.runes[2])===t.runes[0]||t.op===ac.Op.CHAR_CLASS&&2===t.runes.length&&t.runes[0]+1===t.runes[1]&&vB.simpleFold(t.runes[0])===t.runes[1]&&vB.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|aB.FOLD_CASE))return null;t.op=ac.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|aB.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,e){const n=this.stack.length;if(n<2)return!1;const s=this.stack[n-1],r=this.stack[n-2];if(s.op!==ac.Op.LITERAL||r.op!==ac.Op.LITERAL||(s.flags&aB.FOLD_CASE)!==(r.flags&aB.FOLD_CASE))return!1;Array.isArray(r.runes)||(r.runes=Array.from(r.runes));for(let t=0;t<s.runes.length;t++)r.runes.push(s.runes[t]);return t>=0?(s.runes=[t],s.flags=e,!0):(this.pop(),this.reuse(s),!1)}newLiteral(e,n){const s=this.newRegexp(ac.Op.LITERAL);return s.flags=n,0!==(n&aB.FOLD_CASE)&&(e=t.minFoldRune(e)),s.runes=[e],s}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){const e=this.newRegexp(t);return e.flags=this.flags,this.push(e)}repeat(e,n,s,r,i,o){let a=this.flags;if(0!==(a&aB.PERL_X)&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=aB.NON_GREEDY),-1!==o))throw new HB(t.ERR_INVALID_REPEAT_OP,i.from(o));const B=this.stack.length;if(0===B)throw new HB(t.ERR_MISSING_REPEAT_ARGUMENT,i.from(r));const c=this.stack[B-1];if(ac.isPseudoOp(c.op))throw new HB(t.ERR_MISSING_REPEAT_ARGUMENT,i.from(r));const l=this.newRegexp(e);if(l.min=n,l.max=s,l.flags=a,l.subs=[c],this.stack[B-1]=l,this.checkLimits(l),e===ac.Op.REPEAT&&(n>=2||s>=2)&&!this.repeatIsValid(l,1e3))throw new HB(t.ERR_INVALID_REPEAT_SIZE,i.from(r))}repeatIsValid(t,e){if(t.op===ac.Op.REPEAT){let n=t.max;if(0===n)return!0;if(n<0&&(n=t.min),n>e)return!1;n>0&&(e=Math.trunc(e/n))}for(let n of t.subs)if(!this.repeatIsValid(n,e))return!1;return!0}concat(){this.maybeConcat(-1,0);const t=this.popToPseudo();return 0===t.length?this.push(this.newRegexp(ac.Op.EMPTY_MATCH)):this.push(this.collapse(t,ac.Op.CONCAT))}alternate(){const t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),0===t.length?this.push(this.newRegexp(ac.Op.NO_MATCH)):this.push(this.collapse(t,ac.Op.ALTERNATE))}cleanAlt(t){t.op===ac.Op.CHAR_CLASS&&(t.runes=new Gc(Array.from(t.runes)).cleanClass().toArray(),2===t.runes.length&&0===t.runes[0]&&t.runes[1]===vB.MAX_RUNE?(t.runes=new Int32Array(0),t.op=ac.Op.ANY_CHAR):4===t.runes.length&&0===t.runes[0]&&t.runes[1]===mB.CODES["\n"]-1&&t.runes[2]===mB.CODES["\n"]+1&&t.runes[3]===vB.MAX_RUNE&&(t.runes=new Int32Array(0),t.op=ac.Op.ANY_CHAR_NOT_NL))}collapse(t,e){if(1===t.length)return t[0];let n=0;for(let s of t)n+=s.op===e?s.subs.length:1;let s=new Array(n).fill(null),r=0;for(let n of t)if(n.op===e){for(let t=0;t<n.subs.length;t++)s[r++]=n.subs[t];this.reuse(n)}else s[r++]=n;let i=this.newRegexp(e);if(i.subs=s,e===ac.Op.ALTERNATE&&(i.subs=this.factor(i.subs),1===i.subs.length)){const t=i;i=i.subs[0],this.reuse(t)}return i}factor(e){if(e.length<2)return e;let n=0,s=e.length,r=0,i=null,o=0,a=0,B=0;for(let t=0;t<=s;t++){let c=null,l=0,u=0;if(t<s){let s=e[n+t];if(s.op===ac.Op.CONCAT&&s.subs.length>0&&(s=s.subs[0]),s.op===ac.Op.LITERAL&&(c=s.runes,l=s.runes.length,u=s.flags&aB.FOLD_CASE),u===a){let t=0;for(;t<o&&t<l&&i[t]===c[t];)t++;if(t>0){o=t;continue}}}if(t===B);else if(t===B+1)e[r++]=e[n+B];else{const s=this.newRegexp(ac.Op.LITERAL);s.flags=a,s.runes=i.slice(0,o);for(let s=B;s<t;s++)e[n+s]=this.removeLeadingString(e[n+s],o),this.checkLimits(e[n+s]);const c=this.collapse(e.slice(n+B,n+t),ac.Op.ALTERNATE),l=this.newRegexp(ac.Op.CONCAT);l.subs=[s,c],e[r++]=l}B=t,i=c,o=l,a=u}s=r,n=0,B=0,r=0;let c=null;for(let i=0;i<=s;i++){let o=null;if(!(i<s&&(o=t.leadingRegexp(e[n+i]),null!==c&&c.equals(o)&&(t.isCharClass(c)||c.op===ac.Op.REPEAT&&c.min===c.max&&t.isCharClass(c.subs[0]))))){if(i===B);else if(i===B+1)e[r++]=e[n+B];else{const t=c;for(let t=B;t<i;t++){const s=t!==B;e[n+t]=this.removeLeadingRegexp(e[n+t],s),this.checkLimits(e[n+t])}const s=this.collapse(e.slice(n+B,n+i),ac.Op.ALTERNATE),o=this.newRegexp(ac.Op.CONCAT);o.subs=[t,s],e[r++]=o}B=i,c=o}}s=r,n=0,B=0,r=0;for(let i=0;i<=s;i++)if(!(i<s&&t.isCharClass(e[n+i]))){if(i===B);else if(i===B+1)e[r++]=e[n+B];else{let s=B;for(let t=B+1;t<i;t++){const r=e[n+s],i=e[n+t];(r.op<i.op||r.op===i.op&&(null!==r.runes?r.runes.length:0)<(null!==i.runes?i.runes.length:0))&&(s=t)}const o=e[n+B];e[n+B]=e[n+s],e[n+s]=o;for(let s=B+1;s<i;s++)t.mergeCharClass(e[n+B],e[n+s]),this.reuse(e[n+s]);this.cleanAlt(e[n+B]),e[r++]=e[n+B]}i<s&&(e[r++]=e[n+i]),B=i+1}s=r,n=0,B=0,r=0;for(let t=0;t<s;++t)t+1<s&&e[n+t].op===ac.Op.EMPTY_MATCH&&e[n+t+1].op===ac.Op.EMPTY_MATCH||(e[r++]=e[n+t]);return s=r,n=0,e.slice(n,s)}removeLeadingString(t,e){if(t.op===ac.Op.CONCAT&&t.subs.length>0){const n=this.removeLeadingString(t.subs[0],e);if(t.subs[0]=n,n.op===ac.Op.EMPTY_MATCH)switch(this.reuse(n),t.subs.length){case 0:case 1:t.op=ac.Op.EMPTY_MATCH,t.subs=ac.emptySubs();break;case 2:{const e=t;t=t.subs[1],this.reuse(e);break}default:t.subs=t.subs.slice(1,t.subs.length)}return t}return t.op===ac.Op.LITERAL&&(t.runes=t.runes.slice(e,t.runes.length),0===t.runes.length&&(t.op=ac.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,e){if(t.op===ac.Op.CONCAT&&t.subs.length>0){switch(e&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:t.op=ac.Op.EMPTY_MATCH,t.subs=ac.emptySubs();break;case 1:{const e=t;t=t.subs[0],this.reuse(e);break}}return t}return e&&this.reuse(t),this.newRegexp(ac.Op.EMPTY_MATCH)}parseInternal(){if(0!==(this.flags&aB.LITERAL))return t.literalRegexp(this.wholeRegexp,this.flags);let e=-1,n=-1,s=-1;const r=new Hc(this.wholeRegexp);for(;r.more();){let i=-1;t:switch(r.peek()){case mB.CODES["("]:if(0!==(this.flags&aB.LOOKBEHIND)){if(r.lookingAt("(?<=")){this.parsePosLookBehind(),r.skip(4);break}if(r.lookingAt("(?<!")){this.parseNegLookBehind(),r.skip(4);break}}if(0!==(this.flags&aB.PERL_X)&&r.lookingAt("(?")){this.parsePerlFlags(r);break}this.op(ac.Op.LEFT_PAREN).cap=++this.numCap,r.skip(1);break;case mB.CODES["|"]:this.parseVerticalBar(),r.skip(1);break;case mB.CODES[")"]:this.parseRightParen(),r.skip(1);break;case mB.CODES["^"]:0!==(this.flags&aB.ONE_LINE)?this.op(ac.Op.BEGIN_TEXT):this.op(ac.Op.BEGIN_LINE),r.skip(1);break;case mB.CODES.$:0!==(this.flags&aB.ONE_LINE)?this.op(ac.Op.END_TEXT).flags|=aB.WAS_DOLLAR:this.op(ac.Op.END_LINE),r.skip(1);break;case mB.CODES["."]:0!==(this.flags&aB.DOT_NL)?this.op(ac.Op.ANY_CHAR):this.op(ac.Op.ANY_CHAR_NOT_NL),r.skip(1);break;case mB.CODES["["]:this.parseClass(r);break;case mB.CODES["*"]:case mB.CODES["+"]:case mB.CODES["?"]:{i=r.pos();let t=null;switch(r.pop()){case mB.CODES["*"]:t=ac.Op.STAR;break;case mB.CODES["+"]:t=ac.Op.PLUS;break;case mB.CODES["?"]:t=ac.Op.QUEST}this.repeat(t,n,s,i,r,e);break}case mB.CODES["{"]:{const o=r.pos(),a=t.parseRepeat(r);if(a<0){r.rewindTo(o),this.literal(r.pop());break}i=o,n=a>>16,s=(a&vB.MAX_BMP)<<16>>16,this.repeat(ac.Op.REPEAT,n,s,i,r,e);break}case mB.CODES["\\"]:{const e=r.pos();if(r.skip(1),0!==(this.flags&aB.PERL_X)&&r.more())switch(r.pop()){case mB.CODES.A:this.op(ac.Op.BEGIN_TEXT);break t;case mB.CODES.b:this.op(ac.Op.WORD_BOUNDARY);break t;case mB.CODES.B:this.op(ac.Op.NO_WORD_BOUNDARY);break t;case mB.CODES.C:throw new HB(t.ERR_INVALID_ESCAPE,"\\C");case mB.CODES.Q:{let t=r.rest();const e=t.indexOf("\\E");e>=0?(t=t.substring(0,e),r.skipString(t),r.skipString("\\E")):r.skipString(t);let n=0;for(;n<t.length;){const e=t.codePointAt(n);this.literal(e),n+=AB.charCount(e)}break t}case mB.CODES.z:this.op(ac.Op.END_TEXT);break t;default:r.rewindTo(e)}else r.rewindTo(e);const n=this.newRegexp(ac.Op.CHAR_CLASS);if(n.flags=this.flags,r.lookingAt("\\p")||r.lookingAt("\\P")){const t=new Gc;if(this.parseUnicodeClass(r,t)){n.runes=t.toArray(),this.push(n);break t}}const s=new Gc;if(this.parsePerlClassEscape(r,s)){n.runes=s.toArray(),this.push(n);break t}r.rewindTo(e),this.reuse(n),this.literal(t.parseEscape(r));break}default:this.literal(r.pop())}e=i}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),1!==this.stack.length)throw new HB(t.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(e){const n=e.pos(),s=e.rest();if(s.startsWith("(?P<")||s.startsWith("(?<")){const n="P"===s.charAt(2)?4:3,r=s.indexOf(">");if(r<0)throw new HB(t.ERR_INVALID_NAMED_CAPTURE,s);const i=s.substring(n,r);if(e.skipString(i),e.skip(n+1),!t.isValidCaptureName(i))throw new HB(t.ERR_INVALID_NAMED_CAPTURE,s.substring(0,r+1));const o=this.op(ac.Op.LEFT_PAREN);if(o.cap=++this.numCap,this.namedGroups[i])throw new HB(t.ERR_DUPLICATE_NAMED_CAPTURE,i);return this.namedGroups[i]=this.numCap,void(o.name=i)}e.skip(2);let r=this.flags,i=1,o=!1;t:for(;e.more();){const t=e.pop();switch(t){case mB.CODES.i:r|=aB.FOLD_CASE,o=!0;break;case mB.CODES.m:r&=-17,o=!0;break;case mB.CODES.s:r|=aB.DOT_NL,o=!0;break;case mB.CODES.U:r|=aB.NON_GREEDY,o=!0;break;case mB.CODES["-"]:if(i<0)break t;i=-1,r=~r,o=!1;break;case mB.CODES[":"]:case mB.CODES[")"]:if(i<0){if(!o)break t;r=~r}return t===mB.CODES[":"]&&this.op(ac.Op.LEFT_PAREN),void(this.flags=r);default:break t}}throw new HB(t.ERR_INVALID_PERL_OP,e.from(n))}parsePosLookBehind(){const t=this.newRegexp(ac.Op.LEFT_PAREN);return t.flags=this.flags,t.lb=++this.nlb,this.push(t)}parseNegLookBehind(){const t=this.newRegexp(ac.Op.LEFT_PAREN);return t.flags=this.flags,t.lb=-++this.nlb,this.push(t)}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(ac.Op.VERTICAL_BAR)}swapVerticalBar(){const e=this.stack.length;if(e>=3&&this.stack[e-2].op===ac.Op.VERTICAL_BAR&&t.isCharClass(this.stack[e-1])&&t.isCharClass(this.stack[e-3])){let n=this.stack[e-1],s=this.stack[e-3];if(n.op>s.op){const t=s;s=n,n=t,this.stack[e-3]=s}return t.mergeCharClass(s,n),this.reuse(n),this.pop(),!0}if(e>=2){const t=this.stack[e-1],n=this.stack[e-2];if(n.op===ac.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(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new HB(t.ERR_UNEXPECTED_PAREN,this.wholeRegexp);const e=this.pop(),n=this.pop();if(n.op!==ac.Op.LEFT_PAREN)throw new HB(t.ERR_UNEXPECTED_PAREN,this.wholeRegexp);if(this.flags=n.flags,0!==n.lb){if(t.hasCapture(e))throw new HB(t.ERR_INVALID_CAPTURE_IN_LOOKBEHIND,this.wholeRegexp);return n.lb>0?n.op=ac.Op.PLB:n.op=ac.Op.NLB,n.subs=[e],void this.push(n)}0===n.cap?this.push(e):(n.op=ac.Op.CAPTURE,n.subs=[e],this.push(n))}parsePerlClassEscape(t,e){const n=t.pos();if(0===(this.flags&aB.PERL_X)||!t.more()||t.pop()!==mB.CODES["\\"]||!t.more())return!1;t.pop();const s=t.from(n),r=Dc.has(s)?Dc.get(s):null;return null!==r&&(e.appendGroup(r,0!==(this.flags&aB.FOLD_CASE)),!0)}parseNamedClass(e,n){const s=e.rest(),r=s.indexOf(":]");if(r<0)return!1;const i=s.substring(0,r+2);e.skipString(i);const o=Mc.has(i)?Mc.get(i):null;if(null===o)throw new HB(t.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,0!==(this.flags&aB.FOLD_CASE)),!0}parseUnicodeClass(e,n){const s=e.pos();if(0===(this.flags&aB.UNICODE_GROUPS)||!e.lookingAt("\\p")&&!e.lookingAt("\\P"))return!1;e.skip(1);let r,i=1,o=e.pop();if(o===mB.CODES.P&&(i=-1),!e.more())throw e.rewindTo(s),new HB(t.ERR_INVALID_CHAR_RANGE,e.rest());if(o=e.pop(),o!==mB.CODES["{"])r=AB.runeToString(o);else{const n=e.rest(),i=n.indexOf("}");if(i<0)throw e.rewindTo(s),new HB(t.ERR_INVALID_CHAR_RANGE,e.rest());r=n.substring(0,i),e.skipString(r),e.skip(1)}0!==r.length&&r.codePointAt(0)===mB.CODES["^"]&&(i=0-i,r=r.substring(1));const a=t.unicodeTable(r);if(null===a)throw new HB(t.ERR_INVALID_CHAR_RANGE,e.from(s));a.sign<0&&(i=0-i);const B=a.tab,c=a.fold;if(0===(this.flags&aB.FOLD_CASE)||null===c)n.appendTableWithSign(B,i);else{const t=(new Gc).appendTable(B).appendTable(c).cleanClass().toArray();n.appendClassWithSign(Array.from(t),i)}return!0}parseClass(e){const n=e.pos();e.skip(1);const s=this.newRegexp(ac.Op.CHAR_CLASS);s.flags=this.flags;const r=new Gc;let i=1;e.more()&&e.lookingAt("^")&&(i=-1,e.skip(1),0===(this.flags&aB.CLASS_NL)&&r.appendRange(mB.CODES["\n"],mB.CODES["\n"]));let o=!0;for(;!e.more()||e.peek()!==mB.CODES["]"]||o;){if(e.more()&&e.lookingAt("-")&&0===(this.flags&aB.PERL_X)&&!o){const s=e.rest();if("-"===s||!s.startsWith("-]"))throw e.rewindTo(n),new HB(t.ERR_INVALID_CHAR_RANGE,e.rest())}o=!1;const s=e.pos();if(e.lookingAt("[:")){if(this.parseNamedClass(e,r))continue;e.rewindTo(s)}if(this.parseUnicodeClass(e,r))continue;if(this.parsePerlClassEscape(e,r))continue;e.rewindTo(s);const i=t.parseClassChar(e,n);let a=i;if(e.more()&&e.lookingAt("-"))if(e.skip(1),e.more()&&e.lookingAt("]"))e.skip(-1);else if(a=t.parseClassChar(e,n),a<i)throw new HB(t.ERR_INVALID_CHAR_RANGE,e.from(s));0===(this.flags&aB.FOLD_CASE)?r.appendRange(i,a):r.appendFoldedRange(i,a)}e.skip(1),r.cleanClass(),i<0&&r.negateClass(),s.runes=r.toArray(),this.push(s)}},Vc=class t{static initTest(e){const n=t.compile(e),s=new t(n.expr,n.prog,n.numSubexp,n.longest);return s.cond=n.cond,s.prefix=n.prefix,s.prefixUTF8=n.prefixUTF8,s.prefixComplete=n.prefixComplete,s.prefixRune=n.prefixRune,s.prefilter=n.prefilter,s.namedGroups=n.namedGroups,s}static compile(e){return t.compileImpl(e,aB.PERL,!1)}static compilePOSIX(e){return t.compileImpl(e,aB.POSIX,!0)}static compileImpl(e,n,s){let r=Uc.parse(e,n);const i=r.maxCap(),o=r.namedGroups;r=mc.simplify(r);const a=uc.build(r),B=gc.compileRegexp(r),c=new t(e,B,i,s);c.prefilter=a.type===lc.Type.NONE?null:a;const[l,u]=B.prefix();return c.prefixComplete=l,c.prefix=u,c.prefixUTF8=AB.stringToUtf8ByteArray(c.prefix),c.prefix.length>0&&(c.prefixRune=c.prefix.codePointAt(0)),c.namedGroups=o,c}static match(e,n){return t.compile(e).match(n)}constructor(t,e,n=0,s=0){this.expr=t,this.prog=e,this.numSubexp=n,this.longest=s,this.cond=e.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.namedGroups=Object.create(null),this.machinePool=[],this.lazyDFA=null,this.onepass=oc.compile(this.prog),this.prefilter=null}get dfa(){return null===this.lazyDFA&&(this.lazyDFA=new tc(this.prog)),this.lazyDFA}matchPrefixComplete(t,e,n,s){if((n===aB.ANCHOR_START||n===aB.ANCHOR_BOTH)&&0!==e)return null;let r=-1,i=-1;const o=t.prefixLength(this);if(n===aB.UNANCHORED){const n=t.index(this,e);if(n<0)return null;r=e+n,i=r+o}else if(n===aB.ANCHOR_BOTH){if(t.endPos()!==o)return null;if(0!==t.index(this,0))return null;r=0,i=o}else if(n===aB.ANCHOR_START){if(0!==t.index(this,0))return null;r=0,i=o}if(r<0)return null;if(s>0){const t=new Int32Array(s).fill(-1);return t[0]=r,t[1]=i,Array.from(t)}return[]}createLookbehindState(){return this.prog.numLb>0?new KB(this.prog):null}executeEngine(t,e,n,s,r=null){if(this.prefixComplete&&(0===s||0===this.numSubexp))return this.matchPrefixComplete(t,e,n,s);if(null!==this.prefilter&&n===aB.UNANCHORED&&!this.prefilter.eval(t,e))return null;if(null!==this.onepass)return oc.execute(this,t,e,n,s);if(s>0)return 0===this.prog.numLb&&t.endPos()<=sc.maxBitStateLen(this.prog)?sc.execute(this,t,e,n,s):this.doExecuteNFA(t,e,n,s,r);if(0===this.prog.numLb){const r=this.dfa.match(t,e,n);if(null!==r)return r?[]:null;if(t.endPos()<=sc.maxBitStateLen(this.prog))return sc.execute(this,t,e,n,s)}return this.doExecuteNFA(t,e,n,s,r)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){return this.machinePool.length>0?this.machinePool.pop():null}reset(){this.machinePool.length=0}put(t){this.machinePool.push(t)}toString(){return this.expr}doExecuteNFA(t,e,n,s,r=null){let i=this.get();i||(i=QB.fromRE2(this)),i.init(s);const o=i.match(t,e,n,r)?i.submatches():null;return this.put(i),o}match(t){return null!==this.executeEngine(MB.fromUTF16(t),0,aB.UNANCHORED,0)}matchWithGroup(t,e,n,s,r,i=null){return t instanceof RB||(t=AB.isByteArray(t)?kB.utf8(t):kB.utf16(t)),this.matchMachineInput(t,e,n,s,r,i)}matchMachineInput(t,e,n,s,r,i=null){if(e>n)return[!1,null];const o=t.isUTF16Encoding()?MB.fromUTF16(t.asCharSequence(),0,n):MB.fromUTF8(t.asBytes(),0,n),a=this.executeEngine(o,e,s,2*r,i);return null===a?[!1,null]:[!0,a]}matchUTF8(t){return null!==this.executeEngine(MB.fromUTF8(t),0,aB.UNANCHORED,0)}replaceAll(t,e){return this.replaceAllFunc(t,()=>e,2*t.length+1)}replaceFirst(t,e){return this.replaceAllFunc(t,()=>e,1)}replaceAllFunc(t,e,n){let s=0,r=0,i="";const o=MB.fromUTF16(t),a=this.createLookbehindState();let B=0;for(;r<=t.length;){const c=this.executeEngine(o,r,aB.UNANCHORED,2,a);if(null===c||0===c.length)break;i+=t.substring(s,c[0]),(c[1]>s||0===c[0])&&(i+=e(t.substring(c[0],c[1])),B++),s=c[1];const l=7&o.step(r);if(r+l>c[1]?r+=l:r+1>c[1]?r++:r=c[1],B>=n)break}return i+=t.substring(s),i}pad(t){if(null===t)return null;let e=2*(1+this.numSubexp);if(t.length<e){let n=new Array(e).fill(-1);for(let e=0;e<t.length;e++)n[e]=t[e];t=n}return t}allMatches(t,e,n=t=>t){let s=[];const r=t.endPos();e<0&&(e=r+1);let i=0,o=0,a=-1;const B=this.createLookbehindState();for(;o<e&&i<=r;){const e=this.executeEngine(t,i,aB.UNANCHORED,this.prog.numCap,B);if(null===e||0===e.length)break;let c=!0;if(e[1]===i){e[0]===a&&(c=!1);const n=t.step(i);n<0?i=r+1:i+=7&n}else i=e[1];a=e[1],c&&(s.push(n(this.pad(e))),o++)}return s}findUTF8(t){const e=this.executeEngine(MB.fromUTF8(t),0,aB.UNANCHORED,2);return null===e?null:t.slice(e[0],e[1])}findUTF8Index(t){const e=this.executeEngine(MB.fromUTF8(t),0,aB.UNANCHORED,2);return null===e?null:e.slice(0,2)}find(t){const e=this.executeEngine(MB.fromUTF16(t),0,aB.UNANCHORED,2);return null===e?"":t.substring(e[0],e[1])}findIndex(t){return this.executeEngine(MB.fromUTF16(t),0,aB.UNANCHORED,2)}findUTF8Submatch(t){const e=this.executeEngine(MB.fromUTF8(t),0,aB.UNANCHORED,this.prog.numCap);if(null===e)return null;const n=new Array(1+this.numSubexp).fill(null);for(let s=0;s<n.length;s++)2*s<e.length&&e[2*s]>=0&&(n[s]=t.slice(e[2*s],e[2*s+1]));return n}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine(MB.fromUTF8(t),0,aB.UNANCHORED,this.prog.numCap))}findSubmatch(t){const e=this.executeEngine(MB.fromUTF16(t),0,aB.UNANCHORED,this.prog.numCap);if(null===e)return null;const n=new Array(1+this.numSubexp).fill(null);for(let s=0;s<n.length;s++)2*s<e.length&&e[2*s]>=0&&(n[s]=t.substring(e[2*s],e[2*s+1]));return n}findSubmatchIndex(t){return this.pad(this.executeEngine(MB.fromUTF16(t),0,aB.UNANCHORED,this.prog.numCap))}findAllUTF8(t,e){const n=this.allMatches(MB.fromUTF8(t),e,e=>t.slice(e[0],e[1]));return 0===n.length?null:n}findAllUTF8Index(t,e){const n=this.allMatches(MB.fromUTF8(t),e,t=>t.slice(0,2));return 0===n.length?null:n}findAll(t,e){const n=this.allMatches(MB.fromUTF16(t),e,e=>t.substring(e[0],e[1]));return 0===n.length?null:n}findAllIndex(t,e){const n=this.allMatches(MB.fromUTF16(t),e,t=>t.slice(0,2));return 0===n.length?null:n}findAllUTF8Submatch(t,e){const n=this.allMatches(MB.fromUTF8(t),e,e=>{let n=new Array(e.length/2|0).fill(null);for(let s=0;s<n.length;s++)e[2*s]>=0&&(n[s]=t.slice(e[2*s],e[2*s+1]));return n});return 0===n.length?null:n}findAllUTF8SubmatchIndex(t,e){const n=this.allMatches(MB.fromUTF8(t),e);return 0===n.length?null:n}findAllSubmatch(t,e){const n=this.allMatches(MB.fromUTF16(t),e,e=>{let n=new Array(e.length/2|0).fill(null);for(let s=0;s<n.length;s++)e[2*s]>=0&&(n[s]=t.substring(e[2*s],e[2*s+1]));return n});return 0===n.length?null:n}findAllSubmatchIndex(t,e){const n=this.allMatches(MB.fromUTF16(t),e);return 0===n.length?null:n}},jc=class t{static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static translate(e){let n="";if(e instanceof RegExp&&(e.ignoreCase&&(n+="i"),e.multiline&&(n+="m"),e.dotAll&&(n+="s"),e=e.source),"string"!=typeof e)return e;let s="",r=!1,i=e.length;0===i&&(s="(?:)",r=!0);let o=!1,a=0;for(;a<i;){let n=e[a];if("\\"===n){if(a+1<i)switch(n=e[a+1],n){case"\\":s+="\\\\",a+=2;continue;case"c":if(a+2<i){let t=e[a+2].charCodeAt(0);if(t>=65&&t<=90||t>=97&&t<=122){let e=t%32;s+="\\x",s+=(e>>4).toString(16).toUpperCase(),s+=(15&e).toString(16).toUpperCase(),a+=3,r=!0;continue}}s+="c",a+=2,r=!0;continue;case"u":if(a+2<i)if("{"===e[a+2]){let n=a+3,o=!1,B=!1;for(;n<i;){const s=e[n];if("}"===s){B=!0;break}if(!t.isHexadecimal(s))break;o=!0,n++}if(B&&o){s+="\\x",a+=2,r=!0;continue}}else if(a+5<i){let n=!0;for(let s=0;s<4;s++)if(!t.isHexadecimal(e[a+2+s])){n=!1;break}if(n){s+="\\x{"+e.substring(a+2,a+6)+"}",a+=6,r=!0;continue}}s+="u",a+=2,r=!0;continue;case"x":{let n=!1;if(a+2<i&&"{"===e[a+2]){let s=a+3,r=!1,o=!1;for(;s<i;){const n=e[s];if("}"===n){o=!0;break}if(!t.isHexadecimal(n))break;r=!0,s++}o&&r&&(n=!0)}else a+3<i&&t.isHexadecimal(e[a+2])&&t.isHexadecimal(e[a+3])&&(n=!0);n?(s+="\\x",a+=2):(s+="x",a+=2,r=!0);continue}case"n":case"r":case"t":case"a":case"f":case"v":case"d":case"D":case"s":case"S":case"w":case"W":case"b":case"B":case"p":case"P":case"A":case"z":case"Q":case"E":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":s+="\\"+n,a+=2;continue;default:{let t=e.codePointAt(a+1);if(t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122){let n=AB.charCount(t);s+=e.substring(a+1,a+1+n),a+=n+1,r=!0}else{s+="\\";let n=AB.charCount(t);s+=e.substring(a+1,a+1+n),a+=n+1}continue}}}else{if("/"===n){s+="\\/",a+=1,r=!0;continue}if("["===n){if(!o&&"]"===e[a+1]){s+="[^\\x00-\\x{10FFFF}]",a+=2,r=!0;continue}if(!o&&"^"===e[a+1]&&"]"===e[a+2]){s+="[\\x00-\\x{10FFFF}]",a+=3,r=!0;continue}o=!0}else if("]"===n)o=!1;else if(!o&&"("===n&&a+2<i&&"?"===e[a+1]&&"<"===e[a+2]&&a+3<i&&!"=!>)".includes(e[a+3])){s+="(?P<",a+=3,r=!0;continue}}let B=e.codePointAt(a),c=AB.charCount(B);s+=e.substring(a,a+c),a+=c}const B=r?s:e;return n.length>0?`(?${n})${B}`:B}};const $c=(t,e)=>{const n=t.matchArray();return n.index=t.start(0),n.input=e,n.groups=t.namedGroupsObject(),n};var Jc=class t{static CASE_INSENSITIVE=BB;static DOTALL=cB;static MULTILINE=lB;static DISABLE_UNICODE_GROUPS=uB;static LONGEST_MATCH=hB;static LOOKBEHINDS=dB;static quote(t){return AB.quoteMeta(t)}static quoteReplacement(t,e=!1){return JB.quoteReplacement(t,e)}static translateRegExp(t){return jc.translate(t)}static compile(e,n=0){let s=e;if(0!==(n&t.CASE_INSENSITIVE)&&(s=`(?i)${s}`),0!==(n&t.DOTALL)&&(s=`(?s)${s}`),0!==(n&t.MULTILINE)&&(s=`(?m)${s}`),-544&n)throw new jB("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH, LOOKBEHINDS");let r=aB.PERL;0!==(n&t.DISABLE_UNICODE_GROUPS)&&(r&=-129),0!==(n&t.LOOKBEHINDS)&&(r|=aB.LOOKBEHIND);const i=new t(e,n);return i.re2Input=Vc.compileImpl(s,r,0!==(n&t.LONGEST_MATCH)),i}static matches(e,n){return t.compile(e).testExact(n)}static initTest(e,n,s){if(null==e)throw new Error("pattern is null");if(null==s)throw new Error("re2 is null");const r=new t(e,n);return r.re2Input=s,r}constructor(t,e){this.patternInput=t,this.flagsInput=e,this.re2Input=null}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return AB.isByteArray(t)&&(t=kB.utf8(t)),new JB(this,t)}test(t){return AB.isByteArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){const e=AB.isByteArray(t)?MB.fromUTF8(t):MB.fromUTF16(t);return null!==this.re2Input.executeEngine(e,0,aB.ANCHOR_BOTH,0)}exec(t){const e=this.matcher(t);return e.find()?$c(e,t):null}split(t,e=0){const n=this.matcher(t),s=[];let r=0,i=0;for(;n.find();)if(0!==i||0!==n.end()){if(e>0&&s.length===e-1)break;if(i===n.start()){if(0===e){r+=1,i=n.end();continue}}else for(;r>0;)s.push(""),r-=1;s.push(n.substring(i,n.start())),i=n.end()}else i=n.end();if(0===e&&i!==n.inputLength()){for(;r>0;)s.push(""),r-=1;s.push(n.substring(i,n.inputLength()))}return 0===e&&(0!==s.length||i===n.inputLength()&&i>0)||s.push(n.substring(i,n.inputLength())),s}*matchAll(t){const e=this.matcher(t);for(;e.find();)yield $c(e,t)}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t||null!==t&&this.constructor===t.constructor&&(this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput)}};let qc="12.19.0";const zc=new ls("@firebase/firestore");function Kc(){return zc.logLevel}function Qc(t,...e){if(zc.logLevel<=is.DEBUG){const n=e.map(Xc);zc.debug(`Firestore (${qc}): ${t}`,...n)}}function Wc(t,...e){if(zc.logLevel<=is.ERROR){const n=e.map(Xc);zc.error(`Firestore (${qc}): ${t}`,...n)}}function Yc(t,...e){if(zc.logLevel<=is.WARN){const n=e.map(Xc);zc.warn(`Firestore (${qc}): ${t}`,...n)}}function Xc(t){if("string"==typeof t)return t;try{return function(t){return JSON.stringify(t)}(t)}catch(e){return t}}function Zc(t,e,n){let s="Unexpected state";"string"==typeof e?s=e:n=e,tl(t,s,n)}function tl(t,e,n){let s=`FIRESTORE (${qc}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(void 0!==n)try{s+=" CONTEXT: "+JSON.stringify(n)}catch(t){s+=" CONTEXT: "+n}throw Wc(s),new Error(s)}function el(t,e,n,s){let r="Unexpected state";"string"==typeof n?r=n:s=n,t||tl(e,r,s)}function nl(t,e){return t}function sl(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}class rl{static newId(){const t=62*Math.floor(256/62);let e="";for(;e.length<20;){const n=sl(40);for(let s=0;s<n.length;++s)e.length<20&&n[s]<t&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[s]%62))}return e}}function il(t,e){return t<e?-1:t>e?1:0}function ol(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++){const n=t.charAt(s),r=e.charAt(s);if(n!==r)return cl(n)===cl(r)?il(n,r):cl(n)?1:-1}return il(t.length,e.length)}const al=55296,Bl=57343;function cl(t){const e=t.charCodeAt(0);return e>=al&&e<=Bl}function ll(t,e,n){return t.length===e.length&&t.every((t,s)=>n(t,e[s]))}class ul{constructor(t,e){this.comparator=t,this.root=e||dl.EMPTY}insert(t,e){return new ul(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,dl.BLACK,null,null))}remove(t){return new ul(this.comparator,this.root.remove(t,this.comparator).copy(null,null,dl.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const s=this.comparator(t,n.key);if(0===s)return e+n.left.size;s<0?n=n.left:(e+=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(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal((e,n)=>(t(e,n),!1))}toString(){const t=[];return this.inorderTraversal((e,n)=>(t.push(`${e}:${n}`),!1)),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new hl(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new hl(this.root,t,this.comparator,!1)}getReverseIterator(){return new hl(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new hl(this.root,t,this.comparator,!0)}}class hl{constructor(t,e,n,s){this.isReverse=s,this.nodeStack=[];let r=1;for(;!t.isEmpty();)if(r=e?n(t.key,e):1,e&&s&&(r*=-1),r<0)t=this.isReverse?t.left:t.right;else{if(0===r){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class dl{constructor(t,e,n,s,r){this.key=t,this.value=e,this.color=null!=n?n:dl.RED,this.left=null!=s?s:dl.EMPTY,this.right=null!=r?r:dl.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,s,r){return new dl(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=s?s:this.left,null!=r?r:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}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(t,e,n){let s=this;const r=n(t,s.key);return s=r<0?s.copy(null,null,null,s.left.insert(t,e,n),null):0===r?s.copy(null,e,null,null,null):s.copy(null,null,null,null,s.right.insert(t,e,n)),s.fixUp()}removeMin(){if(this.left.isEmpty())return dl.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,s=this;if(e(t,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(t,e),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),0===e(t,s.key)){if(s.right.isEmpty())return dl.EMPTY;n=s.right.min(),s=s.copy(n.key,n.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(t,e))}return s.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,dl.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,dl.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Zc(43730,{key:this.key,value:this.value});if(this.right.isRed())throw Zc(14113,{key:this.key,value:this.value});const t=this.left.check();if(t!==this.right.check())throw Zc(27949);return t+(this.isRed()?0:1)}}dl.EMPTY=null,dl.RED=!0,dl.BLACK=!1,dl.EMPTY=new class{constructor(){this.size=0}get key(){throw Zc(57766)}get value(){throw Zc(16141)}get color(){throw Zc(16727)}get left(){throw Zc(29726)}get right(){throw Zc(36894)}copy(t,e,n,s,r){return this}insert(t,e,n){return new dl(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class pl{constructor(t){this.comparator=t,this.data=new ul(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal((e,n)=>(t(e),!1))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const s=n.getNext();if(this.comparator(s.key,t[1])>=0)return;e(s.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new fl(this.data.getIterator())}getIteratorFrom(t){return new fl(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach(t=>{e=e.add(t)}),e}isEqual(t){if(!(t instanceof pl))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,s=n.getNext().key;if(0!==this.comparator(t,s))return!1}return!0}toArray(){const t=[];return this.forEach(e=>{t.push(e)}),t}toString(){const t=[];return this.forEach(e=>t.push(e)),"SortedSet("+t.toString()+")"}copy(t){const e=new pl(this.comparator);return e.data=t,e}}class fl{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}const Cl={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 gl extends Vn{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}const ml="__name__";class wl{constructor(t,e,n){void 0===e?e=0:e>t.length&&Zc(637,{offset:e,range:t.length}),void 0===n?n=t.length-e:n>t.length-e&&Zc(1746,{length:n,range:t.length-e}),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===wl.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof wl?t.forEach(t=>{e.push(t)}):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}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(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++){const n=wl.compareSegments(t.get(s),e.get(s));if(0!==n)return n}return il(t.length,e.length)}static compareSegments(t,e){const n=wl.isNumericId(t),s=wl.isNumericId(e);return n&&!s?-1:!n&&s?1:n&&s?wl.extractNumericId(t).compare(wl.extractNumericId(e)):ol(t,e)}static isNumericId(t){return t.startsWith("__id")&&t.endsWith("__")}static extractNumericId(t){return Wa.fromString(t.substring(4,t.length-2))}}class yl extends wl{construct(t,e,n){return new yl(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new gl(Cl.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter(t=>t.length>0))}return new yl(e)}static emptyPath(){return new yl([])}}const El=/^[_a-zA-Z][_a-zA-Z0-9]*$/;let _l=class t extends wl{construct(e,n,s){return new t(e,n,s)}static isValidIdentifier(t){return El.test(t)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),t.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===ml}static keyField(){return new t([ml])}static fromServerFormat(e){const n=[];let s="",r=0;const i=()=>{if(0===s.length)throw new gl(Cl.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(s),s=""};let o=!1;for(;r<e.length;){const t=e[r];if("\\"===t){if(r+1===e.length)throw new gl(Cl.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new gl(Cl.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);s+=t,r+=2}else"`"===t?(o=!o,r++):"."!==t||o?(s+=t,r++):(i(),r++)}if(i(),o)throw new gl(Cl.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new t(n)}static emptyPath(){return new t([])}};class Dl{constructor(t){this.fields=t,t.sort(_l.comparator)}static empty(){return new Dl([])}unionWith(t){let e=new pl(_l.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new Dl(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return ll(this.fields,t.fields,(t,e)=>t.isEqual(e))}}function bl(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function vl(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Il(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}class Tl{constructor(t){this.path=t}static fromPath(t){return new Tl(yl.fromString(t))}static fromName(t){return new Tl(yl.fromString(t).popFirst(5))}static empty(){return new Tl(yl.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===yl.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return yl.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new Tl(new yl(t.slice()))}}function Ol(t){if(!Tl.isDocumentKey(t))throw new gl(Cl.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function Al(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function Sl(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Zc(12329,{type:typeof t})}function Rl(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new gl(Cl.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Sl(t);throw new gl(Cl.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}function Nl(t,e){const n={typeString:t};return e&&(n.value=e),n}function xl(t,e){if(!Al(t))throw new gl(Cl.INVALID_ARGUMENT,"JSON must be an object");let n;for(const s in e)if(e[s]){const r=e[s].typeString,i="value"in e[s]?{value:e[s].value}:void 0;if(!(s in t)){n=`JSON missing required field: '${s}'`;break}const o=t[s];if(r&&typeof o!==r){n=`JSON field '${s}' must be a ${r}.`;break}if(void 0!==i&&o!==i.value){n=`Expected '${s}' field to equal '${i.value}'`;break}}if(n)throw new gl(Cl.INVALID_ARGUMENT,n);return!0}const kl=-62135596800,Ll=1e6;class Fl{static now(){return Fl.fromMillis(Date.now())}static fromDate(t){return Fl.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor((t-1e3*e)*Ll);return new Fl(e,n)}static fromInstant(t){if(!t||"bigint"!=typeof t.t)throw new gl(Cl.INVALID_ARGUMENT,"Invalid Temporal.Instant object provided.");return Fl._fromEpochNanoseconds(t.t)}static _fromEpochNanoseconds(t){let e,n;if(t>=0n)e=Number(t/1000000000n),n=Number(t%1000000000n);else{const s=t%1000000000n;0n===s?(e=Number(t/1000000000n),n=0):(e=Number(t/1000000000n-1n),n=Number(s+1000000000n))}return new Fl(e,n)}constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new gl(Cl.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new gl(Cl.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<kl)throw new gl(Cl.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new gl(Cl.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Ll}toInstant(){if("undefined"==typeof Temporal||!Temporal.Instant)throw new gl(Cl.FAILED_PRECONDITION,"The Temporal object is not available in the current environment.");const t=1000000000n*BigInt(this.seconds)+BigInt(this.nanoseconds);return Temporal.Instant.__PRIVATE_fromEpochNanoseconds(t)}_compareTo(t){return this.seconds===t.seconds?il(this.nanoseconds,t.nanoseconds):il(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:Fl._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(xl(t,Fl._jsonSchema))return new Fl(t.seconds,t.nanoseconds)}valueOf(){const t=this.seconds-kl;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Fl._jsonSchemaVersion="firestore/timestamp/1.0",Fl._jsonSchema={type:Nl("string",Fl._jsonSchemaVersion),seconds:Nl("number"),nanoseconds:Nl("number")};class Pl extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class Ml{constructor(t){this.binaryString=t}static fromBase64String(t){const e=function(t){try{return atob(t)}catch(t){throw"undefined"!=typeof DOMException&&t instanceof DOMException?new Pl("Invalid base64 string: "+t):t}}(t);return new Ml(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new Ml(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(t){return btoa(t)}(this.binaryString)}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return il(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}Ml.EMPTY_BYTE_STRING=new Ml("");const Gl=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Hl(t){if(el(!!t,39018),"string"==typeof t){let e=0;const n=Gl.exec(t);if(el(!!n,46558,{timestamp:t}),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const s=new Date(t);return{seconds:Math.floor(s.getTime()/1e3),nanos:e}}return{seconds:Ul(t.seconds),nanos:Ul(t.nanos)}}function Ul(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Vl(t){return"string"==typeof t?Ml.fromBase64String(t):Ml.fromUint8Array(t)}const jl="server_timestamp",$l="__type__",Jl="__previous_value__",ql="__local_write_time__";function zl(t){const e=(t?.mapValue?.fields||{})[$l]?.stringValue;return e===jl}function Kl(t){const e=t.mapValue.fields[Jl];return zl(e)?Kl(e):e}function Ql(t){const e=Hl(t.mapValue.fields[ql].timestampValue);return new Fl(e.seconds,e.nanos)}class Wl{constructor(t,e,n,s,r,i,o,a,B,c,l,u,h){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=s,this.ssl=r,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=B,this.isUsingEmulator=c,this.apiKey=l,this._customHeaders=u,this.grpcFlowControlWindow=h}}const Yl="(default)";class Xl{constructor(t,e){this.projectId=t,this.database=e||Yl}static empty(){return new Xl("","")}get isDefaultDatabase(){return this.database===Yl}isEqual(t){return t instanceof Xl&&t.projectId===this.projectId&&t.database===this.database}}function Zl(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new gl(Cl.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Xl(t.options.projectId,e)}function tu(t){return null==t}function eu(t){return 0===t&&1/t==-1/0}const nu="__type__",su="__max__",ru={},iu="__vector__",ou="value",au={nullValue:"NULL_VALUE"},Bu={booleanValue:!0},cu={booleanValue:!1};function lu(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?zl(t)?4:function(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===su}(t)?9007199254740991:Iu(t)?10:11:Zc(28295,{value:t})}function uu(t,e,n){if(t===e)return!0;const s=lu(t);if(s!==lu(e))return!1;switch(s){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ql(t).isEqual(Ql(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=Hl(t.timestampValue),s=Hl(e.timestampValue);return n.seconds===s.seconds&&n.nanos===s.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return Vl(t.bytesValue).isEqual(Vl(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Ul(t.geoPointValue.latitude)===Ul(e.geoPointValue.latitude)&&Ul(t.geoPointValue.longitude)===Ul(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e,n){if("integerValue"in t&&"integerValue"in e)return Ul(t.integerValue)===Ul(e.integerValue);let s,r;if("doubleValue"in t&&"doubleValue"in e)s=Ul(t.doubleValue),r=Ul(e.doubleValue);else{if(!n?.i)return!1;s=Ul(t.integerValue??t.doubleValue),r=Ul(e.integerValue??e.doubleValue)}return s===r?!!n?.o||eu(s)===eu(r):!(void 0!==n&&!n.u)&&isNaN(s)&&isNaN(r)}(t,e,n);case 9:return ll(t.arrayValue.values||[],e.arrayValue.values||[],(t,e)=>uu(t,e,n));case 10:case 11:return function(t,e,n){const s=t.mapValue.fields||{},r=e.mapValue.fields||{};if(bl(s)!==bl(r))return!1;for(const t in s)if(s.hasOwnProperty(t)&&(void 0===r[t]||!uu(s[t],r[t],n)))return!1;return!0}(t,e,n);default:return Zc(52216,{left:t})}}function hu(t,e){return void 0!==(t.values||[]).find(t=>uu(t,e))}function du(t,e){if(t===e)return 0;const n=lu(t),s=lu(e);if(n!==s)return il(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return il(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ul(t.integerValue||t.doubleValue),s=Ul(e.integerValue||e.doubleValue);return n<s?-1:n>s?1:n===s?0:isNaN(n)?isNaN(s)?0:-1:1}(t,e);case 3:return pu(t.timestampValue,e.timestampValue);case 4:return pu(Ql(t),Ql(e));case 5:return ol(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Vl(t),s=Vl(e);return n.compareTo(s)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),s=e.split("/");for(let t=0;t<n.length&&t<s.length;t++){const e=il(n[t],s[t]);if(0!==e)return e}return il(n.length,s.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=il(Ul(t.latitude),Ul(e.latitude));return 0!==n?n:il(Ul(t.longitude),Ul(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return fu(t.arrayValue,e.arrayValue);case 10:return function(t,e){const n=t.fields||{},s=e.fields||{},r=n[ou]?.arrayValue,i=s[ou]?.arrayValue,o=il(r?.values?.length||0,i?.values?.length||0);return 0!==o?o:fu(r,i)}(t.mapValue,e.mapValue);case 11:return function(t,e){if(t===ru&&e===ru)return 0;if(t===ru)return 1;if(e===ru)return-1;const n=t.fields||{},s=Object.keys(n),r=e.fields||{},i=Object.keys(r);s.sort(),i.sort();for(let t=0;t<s.length&&t<i.length;++t){const e=ol(s[t],i[t]);if(0!==e)return e;const o=du(n[s[t]],r[i[t]]);if(0!==o)return o}return il(s.length,i.length)}(t.mapValue,e.mapValue);default:throw Zc(23264,{l:n})}}function pu(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return il(t,e);const n=Hl(t),s=Hl(e),r=il(n.seconds,s.seconds);return 0!==r?r:il(n.nanos,s.nanos)}function fu(t,e){const n=t.values||[],s=e.values||[];for(let t=0;t<n.length&&t<s.length;++t){const e=du(n[t],s[t]);if(void 0!==e&&0!==e)return e}return il(n.length,s.length)}function Cu(t){return gu(t)}function gu(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=Hl(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?function(t){return Vl(t).toBase64()}(t.bytesValue):"referenceValue"in t?function(t){return Tl.fromName(t).toString()}(t.referenceValue):"geoPointValue"in t?function(t){return`geo(${t.latitude},${t.longitude})`}(t.geoPointValue):"arrayValue"in t?function(t){let e="[",n=!0;for(const s of t.values||[])n?n=!1:e+=",",e+=gu(s);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",s=!0;for(const r of e)s?s=!1:n+=",",n+=`${r}:${gu(t.fields[r])}`;return n+"}"}(t.mapValue):Zc(61005,{value:t})}function mu(t){switch(lu(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=Kl(t);return e?16+mu(e):16;case 5:return 2*t.stringValue.length;case 6:return Vl(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return function(t){return(t.values||[]).reduce((t,e)=>t+mu(e),0)}(t.arrayValue);case 10:case 11:return function(t){let e=0;return vl(t.fields,(t,n)=>{e+=t.length+mu(n)}),e}(t.mapValue);default:throw Zc(13486,{value:t})}}function wu(t){return!!t&&"integerValue"in t}function yu(t){return!!t&&"doubleValue"in t}function Eu(t){return wu(t)||yu(t)}function _u(t){return!!t&&"arrayValue"in t}function Du(t){return!!t&&"nullValue"in t}function bu(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function vu(t){return!!t&&"mapValue"in t}function Iu(t){const e=(t?.mapValue?.fields||{})[nu]?.stringValue;return e===iu}function Tu(t){return(t?.mapValue?.fields||{})[ou]?.arrayValue}function Ou(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return vl(t.mapValue.fields,(t,n)=>e.mapValue.fields[t]=Ou(n)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Ou(t.arrayValue.values[n]);return e}return{...t}}class Au{constructor(t){this.value=t}static empty(){return new Au({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!vu(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Ou(e)}setAll(t){let e=_l.emptyPath(),n={},s=[];t.forEach((t,r)=>{if(!e.isImmediateParentOf(r)){const t=this.getFieldsMap(e);this.applyChanges(t,n,s),n={},s=[],e=r.popLast()}t?n[r.lastSegment()]=Ou(t):s.push(r.lastSegment())});const r=this.getFieldsMap(e);this.applyChanges(r,n,s)}delete(t){const e=this.field(t.popLast());vu(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return uu(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let s=e.mapValue.fields[t.get(n)];vu(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=s),e=s}return e.mapValue.fields}applyChanges(t,e,n){vl(e,(e,n)=>t[e]=n);for(const e of n)delete t[e]}clone(){return new Au(Ou(this.value))}}function Su(t){const e=[];return vl(t.fields,(t,n)=>{const s=new _l([t]);if(vu(n)){const t=Su(n.mapValue).fields;if(0===t.length)e.push(s);else for(const n of t)e.push(s.child(n))}else e.push(s)}),new Dl(e)}function Ru(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:eu(e)?"-0":e}}function Nu(t){return{integerValue:""+t}}function xu(t,e,n){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!eu(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Nu(e):Ru(t,e)}class ku{constructor(){this._=void 0}}function Lu(t,e,n){return t instanceof Mu?function(t,e){const n={fields:{[$l]:{stringValue:jl},[ql]:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&zl(e)&&(e=Kl(e)),e&&(n.fields[Jl]=e),{mapValue:n}}(n,e):t instanceof Gu?Hu(t,e):t instanceof Uu?Vu(t,e):t instanceof $u?function(t,e){const n=Pu(t,e),s=Ku(n)+Ku(t.h);return wu(n)&&wu(t.h)?Nu(s):Ru(t.serializer,s)}(t,e):t instanceof Ju?function(t,e){return zu(t,e,Math.min)}(t,e):t instanceof qu?function(t,e){return zu(t,e,Math.max)}(t,e):void 0}function Fu(t,e,n){return t instanceof Gu?Hu(t,e):t instanceof Uu?Vu(t,e):n}function Pu(t,e){return t instanceof $u?Eu(e)?e:{integerValue:0}:null}class Mu extends ku{}class Gu extends ku{constructor(t){super(),this.elements=t}}function Hu(t,e){const n=Qu(e);for(const e of t.elements)n.some(t=>uu(t,e))||n.push(e);return{arrayValue:{values:n}}}class Uu extends ku{constructor(t){super(),this.elements=t}}function Vu(t,e){let n=Qu(e);for(const e of t.elements)n=n.filter(t=>!uu(t,e));return{arrayValue:{values:n}}}class ju extends ku{constructor(t,e){super(),this.serializer=t,this.h=e}}class $u extends ju{}class Ju extends ju{}class qu extends ju{}function zu(t,e,n){if(!Eu(e))return t.h;const s=n(Ku(e),Ku(t.h));return wu(e)&&wu(t.h)?Nu(s):Ru(t.serializer,s)}function Ku(t){return Ul(t.integerValue||t.doubleValue)}function Qu(t){return _u(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class Wu{constructor(t,e){this.version=t,this.transformResults=e}}class Yu{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Yu}static exists(t){return new Yu(void 0,t)}static updateTime(t){return new Yu(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function Xu(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class Zu{}function th(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new lh(t.key,Yu.none()):new ih(t.key,t.data,Yu.none());{const n=t.data,s=Au.empty();let r=new pl(_l.comparator);for(let t of e.fields)if(!r.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?s.delete(t):s.set(t,e),r=r.add(t)}return new oh(t.key,s,new Dl(r.toArray()),Yu.none())}}function eh(t,e,n){t instanceof ih?function(t,e,n){const s=t.value.clone(),r=Bh(t.fieldTransforms,e,n.transformResults);s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):t instanceof oh?function(t,e,n){if(!Xu(t.precondition,e))return void e.convertToUnknownDocument(n.version);const s=Bh(t.fieldTransforms,e,n.transformResults),r=e.data;r.setAll(ah(t)),r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function nh(t,e,n,s){return t instanceof ih?function(t,e,n,s){if(!Xu(t.precondition,e))return n;const r=t.value.clone(),i=ch(t.fieldTransforms,s,e);return r.setAll(i),e.convertToFoundDocument(e.version,r).setHasLocalMutations(),null}(t,e,n,s):t instanceof oh?function(t,e,n,s){if(!Xu(t.precondition,e))return n;const r=ch(t.fieldTransforms,s,e),i=e.data;return i.setAll(ah(t)),i.setAll(r),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map(t=>t.field))}(t,e,n,s):function(t,e,n){return Xu(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function sh(t,e){let n=null;for(const s of t.fieldTransforms){const t=e.data.field(s.field),r=Pu(s.transform,t||null);null!=r&&(null===n&&(n=Au.empty()),n.set(s.field,r))}return n||null}function rh(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&ll(t,e,(t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Gu&&e instanceof Gu||t instanceof Uu&&e instanceof Uu?ll(t.elements,e.elements,uu):t instanceof $u&&e instanceof $u||t instanceof Ju&&e instanceof Ju||t instanceof qu&&e instanceof qu?uu(t.h,e.h):t instanceof Mu&&e instanceof Mu}(t.transform,e.transform)}(t,e))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class ih extends Zu{constructor(t,e,n,s=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class oh extends Zu{constructor(t,e,n,s,r=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=s,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function ah(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const s=t.data.field(n);e.set(n,s)}}),e}function Bh(t,e,n){const s=new Map;el(t.length===n.length,32656,{T:n.length,P:t.length});for(let r=0;r<n.length;r++){const i=t[r],o=i.transform,a=e.data.field(i.field);s.set(i.field,Fu(o,a,n[r]))}return s}function ch(t,e,n){const s=new Map;for(const r of t){const t=r.transform,i=n.data.field(r.field);s.set(r.field,Lu(t,i,e))}return s}class lh extends Zu{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class uh extends Zu{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class hh{constructor(t,e){this.position=t,this.inclusive=e}}function dh(t,e,n){let s=0;for(let r=0;r<t.position.length;r++){const i=e[r],o=t.position[r];if(s=i.field.isKeyField()?Tl.comparator(Tl.fromName(o.referenceValue),n.key):du(o,n.data.field(i.field)),"desc"===i.dir&&(s*=-1),0!==s)break}return s}function ph(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!uu(t.position[n],e.position[n]))return!1;return!0}class fh{}class Ch extends fh{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new Dh(t,e,n):"array-contains"===e?new Th(t,n):"in"===e?new Oh(t,n):"not-in"===e?new Ah(t,n):"array-contains-any"===e?new Sh(t,n):new Ch(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new bh(t,n):new vh(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&void 0===e.nullValue&&this.matchesComparison(du(e,this.value)):null!==e&&lu(this.value)===lu(e)&&this.matchesComparison(du(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Zc(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class gh extends fh{constructor(t,e){super(),this.filters=t,this.op=e,this.I=null}static create(t,e){return new gh(t,e)}matches(t){return mh(this)?void 0===this.filters.find(e=>!e.matches(t)):void 0!==this.filters.find(e=>e.matches(t))}getFlattenedFilters(){return null!==this.I||(this.I=this.filters.reduce((t,e)=>t.concat(e.getFlattenedFilters()),[])),this.I}getFilters(){return Object.assign([],this.filters)}}function mh(t){return"and"===t.op}function wh(t){return function(t){for(const e of t.filters)if(e instanceof gh)return!1;return!0}(t)&&mh(t)}function yh(t){if(t instanceof Ch)return t.field.canonicalString()+t.op.toString()+Cu(t.value);if(wh(t))return t.filters.map(t=>yh(t)).join(",");{const e=t.filters.map(t=>yh(t)).join(",");return`${t.op}(${e})`}}function Eh(t,e){return t instanceof Ch?function(t,e){return e instanceof Ch&&t.op===e.op&&t.field.isEqual(e.field)&&uu(t.value,e.value)}(t,e):t instanceof gh?function(t,e){return e instanceof gh&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce((t,n,s)=>t&&Eh(n,e.filters[s]),!0)}(t,e):void Zc(19439)}function _h(t){return t instanceof Ch?function(t){return`${t.field.canonicalString()} ${t.op} ${Cu(t.value)}`}(t):t instanceof gh?function(t){return t.op.toString()+" {"+t.getFilters().map(_h).join(" ,")+"}"}(t):"Filter"}class Dh extends Ch{constructor(t,e,n){super(t,e,n),this.key=Tl.fromName(n.referenceValue)}matches(t){const e=Tl.comparator(t.key,this.key);return this.matchesComparison(e)}}class bh extends Ch{constructor(t,e){super(t,"in",e),this.keys=Ih("in",e)}matches(t){return this.keys.some(e=>e.isEqual(t.key))}}class vh extends Ch{constructor(t,e){super(t,"not-in",e),this.keys=Ih("not-in",e)}matches(t){return!this.keys.some(e=>e.isEqual(t.key))}}function Ih(t,e){return(e.arrayValue?.values||[]).map(t=>Tl.fromName(t.referenceValue))}class Th extends Ch{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return _u(e)&&hu(e.arrayValue,this.value)}}class Oh extends Ch{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&hu(this.value.arrayValue,e)}}class Ah extends Ch{constructor(t,e){super(t,"not-in",e)}matches(t){if(hu(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&void 0===e.nullValue&&!hu(this.value.arrayValue,e)}}class Sh extends Ch{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!_u(e)||!e.arrayValue.values)&&e.arrayValue.values.some(t=>hu(this.value.arrayValue,t))}}class Rh{constructor(t,e="asc"){this.field=t,this.dir=e}}function Nh(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}class xh{static fromTimestamp(t){return new xh(t)}static min(){return new xh(new Fl(0,0))}static max(){return new xh(new Fl(253402300799,999999999))}constructor(t){this.timestamp=t}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}class kh{constructor(t,e,n,s,r,i,o){this.key=t,this.documentType=e,this.version=n,this.readTime=s,this.createTime=r,this.data=i,this.documentState=o}static newInvalidDocument(t){return new kh(t,0,xh.min(),xh.min(),xh.min(),Au.empty(),0)}static newFoundDocument(t,e,n,s){return new kh(t,1,e,xh.min(),n,s,0)}static newNoDocument(t,e){return new kh(t,2,e,xh.min(),xh.min(),Au.empty(),0)}static newUnknownDocument(t,e){return new kh(t,3,e,xh.min(),xh.min(),Au.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(xh.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=Au.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=Au.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=xh.min(),this}setReadTime(t){return this.readTime=t,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(t){return t instanceof kh&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new kh(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}})`}}function Lh(t){return new Fh(t.readTime,t.key,-1)}class Fh{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new Fh(xh.min(),Tl.empty(),-1)}static max(){return new Fh(xh.max(),Tl.empty(),-1)}}function Ph(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=Tl.comparator(t.documentKey,e.documentKey),0!==n?n:il(t.largestBatchId,e.largestBatchId))}class Mh{constructor(t,e=null,n=[],s=[],r=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=s,this.limit=r,this.startAt=i,this.endAt=o,this.R=null}}function Gh(t,e=null,n=[],s=[],r=null,i=null,o=null){return new Mh(t,e,n,s,r,i,o)}function Hh(t){const e=nl(t);if(null===e.R){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(t=>yh(t)).join(","),t+="|ob:",t+=e.orderBy.map(t=>function(t){return t.field.canonicalString()+t.dir}(t)).join(","),tu(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(t=>Cu(t)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(t=>Cu(t)).join(",")),e.R=t}return e.R}function Uh(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!Nh(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!Eh(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!ph(t.startAt,e.startAt)&&ph(t.endAt,e.endAt)}class Vh{constructor(t,e=null,n=[],s=[],r=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=s,this.limit=r,this.limitType=i,this.startAt=o,this.endAt=a,this.A=null,this.V=null,this.m=null,this.startAt,this.endAt}}function jh(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function $h(t){const e=nl(t);if(null===e.A){e.A=[];const t=new Set;for(const n of e.explicitOrderBy)e.A.push(n),t.add(n.field.canonicalString());const n=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc",s=function(t){let e=new pl(_l.comparator);return t.filters.forEach(t=>{t.getFlattenedFilters().forEach(t=>{t.isInequality()&&(e=e.add(t.field))})}),e}(e);s.forEach(s=>{t.has(s.canonicalString())||s.isKeyField()||e.A.push(new Rh(s,n))}),t.has(_l.keyField().canonicalString())||e.A.push(new Rh(_l.keyField(),n))}return e.A}function Jh(t){const e=nl(t);return e.V||(e.V=function(t,e){if("F"===t.limitType)return Gh(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(t=>{const e="desc"===t.dir?"asc":"desc";return new Rh(t.field,e)});const n=t.endAt?new hh(t.endAt.position,t.endAt.inclusive):null,s=t.startAt?new hh(t.startAt.position,t.startAt.inclusive):null;return Gh(t.path,t.collectionGroup,e,t.filters,t.limit,n,s)}}(e,$h(t))),e.V}function qh(t,e,n){return new Vh(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function zh(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map(t=>_h(t)).join(", ")}]`),tu(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map(t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t)).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map(t=>Cu(t)).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(t=>Cu(t)).join(",")),`Target(${e})`}(Jh(t))}; limitType=${t.limitType})`}function Kh(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):Tl.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of $h(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const s=dh(t,e,n);return t.inclusive?s<=0:s<0}(t.startAt,$h(t),e))&&!(t.endAt&&!function(t,e,n){const s=dh(t,e,n);return t.inclusive?s>=0:s>0}(t.endAt,$h(t),e))}(t,e)}function Qh(t){return(e,n)=>{let s=!1;for(const r of $h(t)){const t=Wh(r,e,n);if(0!==t)return t;s=s||r.field.isKeyField()}return 0}}function Wh(t,e,n){const s=t.field.isKeyField()?Tl.comparator(e.key,n.key):function(t,e,n){const s=e.data.field(t),r=n.data.field(t);return null!==s&&null!==r?du(s,r):Zc(42886)}(t.field,e,n);switch(t.dir){case"asc":return s;case"desc":return-1*s;default:return Zc(19790,{direction:t.dir})}}var Yh,Xh;function Zh(t){if(void 0===t)return Wc("GRPC error has no .code"),Cl.UNKNOWN;switch(t){case Yh.OK:return Cl.OK;case Yh.CANCELLED:return Cl.CANCELLED;case Yh.UNKNOWN:return Cl.UNKNOWN;case Yh.DEADLINE_EXCEEDED:return Cl.DEADLINE_EXCEEDED;case Yh.RESOURCE_EXHAUSTED:return Cl.RESOURCE_EXHAUSTED;case Yh.INTERNAL:return Cl.INTERNAL;case Yh.UNAVAILABLE:return Cl.UNAVAILABLE;case Yh.UNAUTHENTICATED:return Cl.UNAUTHENTICATED;case Yh.INVALID_ARGUMENT:return Cl.INVALID_ARGUMENT;case Yh.NOT_FOUND:return Cl.NOT_FOUND;case Yh.ALREADY_EXISTS:return Cl.ALREADY_EXISTS;case Yh.PERMISSION_DENIED:return Cl.PERMISSION_DENIED;case Yh.FAILED_PRECONDITION:return Cl.FAILED_PRECONDITION;case Yh.ABORTED:return Cl.ABORTED;case Yh.OUT_OF_RANGE:return Cl.OUT_OF_RANGE;case Yh.UNIMPLEMENTED:return Cl.UNIMPLEMENTED;case Yh.DATA_LOSS:return Cl.DATA_LOSS;default:return Zc(39323,{code:t})}}(Xh=Yh||(Yh={}))[Xh.OK=0]="OK",Xh[Xh.CANCELLED=1]="CANCELLED",Xh[Xh.UNKNOWN=2]="UNKNOWN",Xh[Xh.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Xh[Xh.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Xh[Xh.NOT_FOUND=5]="NOT_FOUND",Xh[Xh.ALREADY_EXISTS=6]="ALREADY_EXISTS",Xh[Xh.PERMISSION_DENIED=7]="PERMISSION_DENIED",Xh[Xh.UNAUTHENTICATED=16]="UNAUTHENTICATED",Xh[Xh.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Xh[Xh.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Xh[Xh.ABORTED=10]="ABORTED",Xh[Xh.OUT_OF_RANGE=11]="OUT_OF_RANGE",Xh[Xh.UNIMPLEMENTED=12]="UNIMPLEMENTED",Xh[Xh.INTERNAL=13]="INTERNAL",Xh[Xh.UNAVAILABLE=14]="UNAVAILABLE",Xh[Xh.DATA_LOSS=15]="DATA_LOSS";class td{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,s]of n)if(this.equalsFn(e,t))return s}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),s=this.inner[n];if(void 0===s)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<s.length;n++)if(this.equalsFn(s[n][0],t))return void(s[n]=[t,e]);s.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],t))return 1===n.length?delete this.inner[e]:n.splice(s,1),this.innerSize--,!0;return!1}forEach(t){vl(this.inner,(e,n)=>{for(const[e,s]of n)t(e,s)})}isEmpty(){return Il(this.inner)}size(){return this.innerSize}}const ed=new ul(Tl.comparator);function nd(){return ed}const sd=new ul(Tl.comparator);function rd(...t){let e=sd;for(const n of t)e=e.insert(n.key,n);return e}function id(t){let e=sd;return t.forEach((t,n)=>e=e.insert(t,n.overlayedDocument)),e}function od(){return Bd()}function ad(){return Bd()}function Bd(){return new td(t=>t.toString(),(t,e)=>t.isEqual(e))}const cd=new ul(Tl.comparator),ld=new pl(Tl.comparator);function ud(...t){let e=ld;for(const n of t)e=e.add(n);return e}const hd=new pl(il);new Wa([4294967295,4294967295],0);class dd{constructor(t,e){this.databaseId=t,this.useProto3Json=e}}function pd(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function fd(t){const e=Hl(t);return new Fl(e.seconds,e.nanos)}function Cd(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function gd(t,e){return pd(t,e.toTimestamp())}function md(t){return el(!!t,49232),xh.fromTimestamp(fd(t))}function wd(t,e){return yd(t,e).canonicalString()}function yd(t,e){const n=function(t){return new yl(["projects",t.projectId,"databases",t.database])}(t).child("documents");return void 0===e?n:n.child(e)}function Ed(t,e){return wd(t.databaseId,e.path)}function _d(t){const e=function(t){const e=yl.fromString(t);return el(function(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}(e),10190,{key:e.toString()}),e}(t);return 4===e.length?yl.emptyPath():function(t){return el(t.length>4&&"documents"===t.get(4),29091,{key:t.toString()}),t.popFirst(5)}(e)}function Dd(t,e,n){return{name:Ed(t,e),fields:n.value.mapValue.fields}}function bd(t){let e=_d(t.parent);const n=t.structuredQuery,s=n.from?n.from.length:0;let r=null;if(s>0){el(1===s,65062);const t=n.from[0];t.allDescendants?r=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=vd(t);return e instanceof gh&&wh(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=function(t){return t.map(t=>function(t){return new Rh(Id(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))}(n.orderBy));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,tu(e)?null:e}(n.limit));let B=null;n.startAt&&(B=function(t){const e=!!t.before,n=t.values||[];return new hh(n,e)}(n.startAt));let c=null;return n.endAt&&(c=function(t){const e=!t.before,n=t.values||[];return new hh(n,e)}(n.endAt)),function(t,e,n,s,r,i,o,a){return new Vh(t,e,n,s,r,i,o,a)}(e,r,o,i,a,"F",B,c)}function vd(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=Id(t.unaryFilter.field);return Ch.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=Id(t.unaryFilter.field);return Ch.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=Id(t.unaryFilter.field);return Ch.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=Id(t.unaryFilter.field);return Ch.create(r,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return Zc(61313);default:return Zc(60726)}}(t):void 0!==t.fieldFilter?function(t){return Ch.create(Id(t.fieldFilter.field),function(t){switch(t){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 Zc(58110);default:return Zc(50506)}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return gh.create(t.compositeFilter.filters.map(t=>vd(t)),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Zc(1026)}}(t.compositeFilter.op))}(t):Zc(30097,{filter:t})}function Id(t){return _l.fromServerFormat(t.fieldPath)}function Td(t){const e=[];return t.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function Od(t){return!!t&&"function"==typeof t._toProto&&"ProtoValue"===t._protoValueType}function Ad(t,e){const n={fields:{}};return e.forEach((e,s)=>{if("string"!=typeof s)throw new Error(`Cannot encode map with non-string key: ${s}`);n.fields[s]=e._toProto(t)}),{mapValue:n}}function Sd(t){return{stringValue:t}}function Rd(t){return new dd(t,!0)}class Nd{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Nd(Ml.fromBase64String(t))}catch(t){throw new gl(Cl.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Nd(Ml.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}toJSON(){return{type:Nd._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(t){if(xl(t,Nd._jsonSchema))return Nd.fromBase64String(t.bytes)}}Nd._jsonSchemaVersion="firestore/bytes/1.0",Nd._jsonSchema={type:Nl("string",Nd._jsonSchemaVersion),bytes:Nl("string")};class xd{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new gl(Cl.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new _l(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}class kd{constructor(t){this._methodName=t}}class Ld{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new gl(Cl.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new gl(Cl.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}_compareTo(t){return il(this._lat,t._lat)||il(this._long,t._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Ld._jsonSchemaVersion}}static fromJSON(t){if(xl(t,Ld._jsonSchema))return new Ld(t.latitude,t.longitude)}}Ld._jsonSchemaVersion="firestore/geoPoint/1.0",Ld._jsonSchema={type:Nl("string",Ld._jsonSchemaVersion),latitude:Nl("number"),longitude:Nl("number")};class Fd{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}Fd.UNAUTHENTICATED=new Fd(null),Fd.GOOGLE_CREDENTIALS=new Fd("google-credentials-uid"),Fd.FIRST_PARTY=new Fd("first-party-uid"),Fd.MOCK_USER=new Fd("mock-user");class Pd{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}}class Md{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Gd{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable(()=>e(Fd.UNAUTHENTICATED))}shutdown(){}}class Hd{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable(()=>e(this.token.user))}shutdown(){this.changeListener=null}}class Ud{constructor(t){this.De=t,this.currentUser=Fd.UNAUTHENTICATED,this.xe=0,this.forceRefresh=!1,this.auth=null}start(t,e){el(void 0===this.Ce,42304);let n=this.xe;const s=t=>this.xe!==n?(n=this.xe,e(t)):Promise.resolve();let r=new Pd;this.Ce=()=>{this.xe++,this.currentUser=this.Fe(),r.resolve(),r=new Pd,t.enqueueRetryable(()=>s(this.currentUser))};const i=()=>{const e=r;t.enqueueRetryable(async()=>{await e.promise,await s(this.currentUser)})},o=t=>{Qc("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.Ce&&(this.auth.addAuthTokenListener(this.Ce),i())};this.De.onInit(t=>o(t)),setTimeout(()=>{if(!this.auth){const t=this.De.getImmediate({optional:!0});t?o(t):(Qc("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new Pd)}},0),i()}getToken(){const t=this.xe,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then(e=>this.xe!==t?(Qc("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(el("string"==typeof e.accessToken,31837,{Oe:e}),new Md(e.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.Ce&&this.auth.removeAuthTokenListener(this.Ce),this.Ce=void 0}Fe(){const t=this.auth&&this.auth.getUid();return el(null===t||"string"==typeof t,2055,{Me:t}),new Fd(t)}}class Vd{constructor(t,e,n){this.Ne=t,this.Le=e,this.Be=n,this.type="FirstParty",this.user=Fd.FIRST_PARTY,this.Ue=new Map}ke(){return this.Be?this.Be():null}get headers(){this.Ue.set("X-Goog-AuthUser",this.Ne);const t=this.ke();return t&&this.Ue.set("Authorization",t),this.Le&&this.Ue.set("X-Goog-Iam-Authorization-Token",this.Le),this.Ue}}class jd{constructor(t,e,n){this.Ne=t,this.Le=e,this.Be=n}getToken(){return Promise.resolve(new Vd(this.Ne,this.Le,this.Be))}start(t,e){t.enqueueRetryable(()=>e(Fd.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class $d{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Jd{constructor(t,e){this.qe=e,this.forceRefresh=!1,this.appCheck=null,this.$e=null,this.Ke=null,hr(t)&&t.settings.appCheckToken&&(this.Ke=t.settings.appCheckToken)}start(t,e){el(void 0===this.Ce,3512);const n=t=>{null!=t.error&&Qc("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.$e;return this.$e=t.token,Qc("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.Ce=e=>{t.enqueueRetryable(()=>n(e))};const s=t=>{Qc("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.Ce&&this.appCheck.addTokenListener(this.Ce)};this.qe.onInit(t=>s(t)),setTimeout(()=>{if(!this.appCheck){const t=this.qe.getImmediate({optional:!0});t?s(t):Qc("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.Ke)return Promise.resolve(new $d(this.Ke));const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then(t=>t?(el("string"==typeof t.token,44558,{tokenResult:t}),this.$e=t.token,new $d(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.Ce&&this.appCheck.removeTokenListener(this.Ce),this.Ce=void 0}}function qd(t){const e={};return void 0!==t.timeoutSeconds&&(e.timeoutSeconds=t.timeoutSeconds),e}class zd{Qe(t){}shutdown(){}}const Kd="ConnectivityMonitor";class Qd{constructor(){this.We=()=>this.Ge(),this.ze=()=>this.je(),this.He=[],this.Je()}Qe(t){this.He.push(t)}shutdown(){window.removeEventListener("online",this.We),window.removeEventListener("offline",this.ze)}Je(){window.addEventListener("online",this.We),window.addEventListener("offline",this.ze)}Ge(){Qc(Kd,"Network connectivity changed: AVAILABLE");for(const t of this.He)t(0)}je(){Qc(Kd,"Network connectivity changed: UNAVAILABLE");for(const t of this.He)t(1)}static Ye(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let Wd=null;function Yd(){return null===Wd?Wd=268435456+Math.round(2147483648*Math.random()):Wd++,"0x"+Wd.toString(16)}const Xd="RestConnection",Zd={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class tp{get Ze(){return!1}constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Xe=e+"://"+t.host,this.et=`projects/${n}/databases/${s}`,this.tt=this.databaseId.database===Yl?`project_id=${n}`:`project_id=${n}&database_id=${s}`}nt(t,e,n,s,r){const i=Yd(),o=this.rt(t,e.toUriEncodedString());Qc(Xd,`Sending RPC '${t}' ${i}:`,o,n);const a={"google-cloud-resource-prefix":this.et,"x-goog-request-params":this.tt};this.it(a,s,r);const{host:B}=new URL(o),c=Zn(B);return this.st(t,o,a,n,c).then(e=>(Qc(Xd,`Received RPC '${t}' ${i}: `,e),e),e=>{throw Yc(Xd,`RPC '${t}' ${i} failed with error: `,e,"url: ",o,"request:",n),e})}_t(t,e,n,s,r,i){return this.nt(t,e,n,s,r)}it(t,e,n){if(t["X-Goog-Api-Client"]="gl-js/ fire/"+qc,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach((e,n)=>t[n]=e),n&&n.headers.forEach((e,n)=>t[n]=e),this.databaseInfo._customHeaders)for(const e of Object.keys(this.databaseInfo._customHeaders))t[e]=this.databaseInfo._customHeaders[e]}rt(t,e){const n=Zd[t];let s=`${this.Xe}/v1/${e}:${n}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}class ep{constructor(t){this.ot=t.ot,this.ut=t.ut}ct(t){this.lt=t}Et(t){this.ht=t}Tt(t){this.Pt=t}onMessage(t){this.It=t}close(){this.ut()}send(t){this.ot(t)}Rt(){this.lt()}At(){this.ht()}Vt(t){this.Pt(t)}dt(t){this.It(t)}}const np="WebChannelConnection",sp=(t,e,n)=>{t.listen(e,t=>{try{n(t)}catch(t){setTimeout(()=>{throw t},0)}})};class rp extends tp{constructor(t){super(t),this.ft=[],this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams,this.longPollingOptions=t.longPollingOptions}static gt(){if(!rp.yt){const t=rB();sp(t,sB.STAT_EVENT,t=>{t.stat===nB.PROXY?Qc(np,"STAT_EVENT: detected buffering proxy"):t.stat===nB.NOPROXY&&Qc(np,"STAT_EVENT: detected no buffering proxy")}),rp.yt=!0}}st(t,e,n,s,r){const i=Yd();return new Promise((r,o)=>{const a=new Xa;a.setWithCredentials(!0),a.listenOnce(tB.COMPLETE,()=>{try{switch(a.getLastErrorCode()){case eB.NO_ERROR:const e=a.getResponseJson();Qc(np,`XHR for RPC '${t}' ${i} received:`,JSON.stringify(e)),r(e);break;case eB.TIMEOUT:Qc(np,`RPC '${t}' ${i} timed out`),o(new gl(Cl.DEADLINE_EXCEEDED,"Request time out"));break;case eB.HTTP_ERROR:const n=a.getStatus();if(Qc(np,`RPC '${t}' ${i} failed with status:`,n,"response text:",a.getResponseText()),n>0){let t=a.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=t?.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(Cl).indexOf(e)>=0?e:Cl.UNKNOWN}(e.status);o(new gl(t,e.message))}else o(new gl(Cl.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new gl(Cl.UNAVAILABLE,"Connection failed."));break;default:Zc(9055,{wt:t,streamId:i,bt:a.getLastErrorCode(),St:a.getLastError()})}}finally{Qc(np,`RPC '${t}' ${i} completed.`)}});const B=JSON.stringify(s);Qc(np,`RPC '${t}' ${i} sending request:`,s),a.send(e,"POST",B,n,15)})}vt(t,e,n){const s=Yd(),r=[this.Xe,"/","google.firestore.v1.Firestore","/",t,"/channel"],i=this.createWebChannelTransport(),o={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},a=this.longPollingOptions.timeoutSeconds;void 0!==a&&(o.longPollingTimeout=Math.round(1e3*a)),this.useFetchStreams&&(o.useFetchStreams=!0),this.it(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const B=r.join("");Qc(np,`Creating RPC '${t}' stream ${s}: ${B}`,o);const c=i.createWebChannel(B,o);this.Dt(c);let l=!1,u=!1;const h=new ep({ot:e=>{u?Qc(np,`Not sending because RPC '${t}' stream ${s} is closed:`,e):(l||(Qc(np,`Opening RPC '${t}' stream ${s} transport.`),c.open(),l=!0),Qc(np,`RPC '${t}' stream ${s} sending:`,e),c.send(e))},ut:()=>c.close()});return sp(c,Za.EventType.OPEN,()=>{u||(Qc(np,`RPC '${t}' stream ${s} transport opened.`),h.Rt())}),sp(c,Za.EventType.CLOSE,()=>{u||(u=!0,Qc(np,`RPC '${t}' stream ${s} transport closed`),h.Vt(),this.xt(c))}),sp(c,Za.EventType.ERROR,e=>{u||(u=!0,Yc(np,`RPC '${t}' stream ${s} transport errored. Name:`,e.name,"Message:",e.message),h.Vt(new gl(Cl.UNAVAILABLE,"The operation could not be completed")))}),sp(c,Za.EventType.MESSAGE,e=>{if(!u){const n=e.data[0];el(!!n,16349);const r=n,i=r?.error||r[0]?.error;if(i){Qc(np,`RPC '${t}' stream ${s} received error:`,i);const e=i.status;let n=function(t){const e=Yh[t];if(void 0!==e)return Zh(e)}(e),r=i.message;"NOT_FOUND"===e&&r.includes("database")&&r.includes("does not exist")&&r.includes(this.databaseId.database)&&Yc(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),void 0===n&&(n=Cl.INTERNAL,r="Unknown error status: "+e+" with message "+i.message),u=!0,h.Vt(new gl(n,r)),c.close()}else Qc(np,`RPC '${t}' stream ${s} received:`,n),h.dt(n)}}),rp.gt(),setTimeout(()=>{h.At()},0),h}terminate(){this.ft.forEach(t=>t.close()),this.ft=[]}Dt(t){this.ft.push(t)}xt(t){this.ft=this.ft.filter(e=>e===t)}it(t,e,n){super.it(t,e,n),this.databaseInfo.apiKey&&(t["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return iB()}}rp.yt=!1;class ip{constructor(t,e,n=1e3,s=1.5,r=6e4){this.Ct=t,this.timerId=e,this.Ft=n,this.Ot=s,this.Mt=r,this.Nt=0,this.Lt=null,this.Bt=Date.now(),this.reset()}reset(){this.Nt=0}Ut(){this.Nt=this.Mt}kt(t){this.cancel();const e=Math.floor(this.Nt+this.qt()),n=Math.max(0,Date.now()-this.Bt),s=Math.max(0,e-n);s>0&&Qc("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Nt} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.Lt=this.Ct.enqueueAfterDelay(this.timerId,s,()=>(this.Bt=Date.now(),t())),this.Nt*=this.Ot,this.Nt<this.Ft&&(this.Nt=this.Ft),this.Nt>this.Mt&&(this.Nt=this.Mt)}$t(){null!==this.Lt&&(this.Lt.skipDelay(),this.Lt=null)}cancel(){null!==this.Lt&&(this.Lt.cancel(),this.Lt=null)}qt(){return(Math.random()-.5)*this.Nt}}const op="PersistentStream";class ap{constructor(t,e,n,s,r,i,o,a){this.Ct=t,this.Kt=n,this.Qt=s,this.connection=r,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.Wt=0,this.Gt=null,this.zt=null,this.stream=null,this.jt=0,this.Ht=new ip(t,e)}Jt(){return 1===this.state||5===this.state||this.Yt()}Yt(){return 2===this.state||3===this.state}start(){this.jt=0,4!==this.state?this.auth():this.Zt()}async stop(){this.Jt()&&await this.close(0)}Xt(){this.state=0,this.Ht.reset()}en(){this.Yt()&&null===this.Gt&&(this.Gt=this.Ct.enqueueAfterDelay(this.Kt,6e4,()=>this.tn()))}nn(t){this.rn(),this.stream.send(t)}async tn(){if(this.Yt())return this.close(0)}rn(){this.Gt&&(this.Gt.cancel(),this.Gt=null)}sn(){this.zt&&(this.zt.cancel(),this.zt=null)}async close(t,e){this.rn(),this.sn(),this.Ht.cancel(),this.Wt++,4!==t?this.Ht.reset():e&&e.code===Cl.RESOURCE_EXHAUSTED?(Wc(e.toString()),Wc("Using maximum backoff delay to prevent overloading the backend."),this.Ht.Ut()):e&&e.code===Cl.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this._n(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Tt(e)}_n(){}auth(){this.state=1;const t=this.an(this.Wt),e=this.Wt;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([t,n])=>{this.Wt===e&&this.un(t,n)},e=>{t(()=>{const t=new gl(Cl.UNKNOWN,"Fetching auth token failed: "+e.message);return this.cn(t)})})}un(t,e){const n=this.an(this.Wt);this.stream=this.En(t,e),this.stream.ct(()=>{n(()=>this.listener.ct())}),this.stream.Et(()=>{n(()=>(this.state=2,this.zt=this.Ct.enqueueAfterDelay(this.Qt,1e4,()=>(this.Yt()&&(this.state=3),Promise.resolve())),this.listener.Et()))}),this.stream.Tt(t=>{n(()=>this.cn(t))}),this.stream.onMessage(t=>{n(()=>1==++this.jt?this.hn(t):this.onNext(t))})}Zt(){this.state=5,this.Ht.kt(async()=>{this.state=0,this.start()})}cn(t){return Qc(op,`close with error: ${t}`),this.stream=null,this.close(4,t)}an(t){return e=>{this.Ct.enqueueAndForget(()=>this.Wt===t?e():(Qc(op,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class Bp extends ap{constructor(t,e,n,s,r,i){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,s,i),this.serializer=r}get Rn(){return this.jt>0}start(){this.lastStreamToken=void 0,super.start()}_n(){this.Rn&&this.An([])}En(t,e){return this.connection.vt("Write",t,e)}hn(t){return el(!!t.streamToken,31322),this.lastStreamToken=t.streamToken,el(!t.writeResults||0===t.writeResults.length,55816),this.listener.Vn()}onNext(t){el(!!t.streamToken,12678),this.lastStreamToken=t.streamToken,this.Ht.reset();const e=function(t,e){return t&&t.length>0?(el(void 0!==e,14353),t.map(t=>function(t,e){let n=t.updateTime?md(t.updateTime):md(e);return n.isEqual(xh.min())&&(n=md(e)),new Wu(n,t.transformResults||[])}(t,e))):[]}(t.writeResults,t.commitTime),n=md(t.commitTime);return this.listener.dn(n,e)}fn(){const t={};t.database=function(t){return new yl(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}(this.serializer),this.nn(t)}An(t){const e={streamToken:this.lastStreamToken,writes:t.map(t=>function(t,e){let n;if(e instanceof ih)n={update:Dd(t,e.key,e.value)};else if(e instanceof lh)n={delete:Ed(t,e.key)};else if(e instanceof oh)n={update:Dd(t,e.key,e.data),updateMask:Td(e.fieldMask)};else{if(!(e instanceof uh))return Zc(16599,{be:e.type});n={verify:Ed(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(t=>function(t,e){const n=e.transform;if(n instanceof Mu)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Gu)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Uu)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof $u)return{fieldPath:e.field.canonicalString(),increment:n.h};if(n instanceof Ju)return{fieldPath:e.field.canonicalString(),minimum:n.h};if(n instanceof qu)return{fieldPath:e.field.canonicalString(),maximum:n.h};throw Zc(20930,{transform:e.transform})}(0,t))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:gd(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:Zc(27497)}(t,e.precondition)),n}(this.serializer,t))};this.nn(e)}}class cp{}class lp extends cp{constructor(t,e,n,s){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.serializer=s,this.mn=!1}pn(){if(this.mn)throw new gl(Cl.FAILED_PRECONDITION,"The client has already been terminated.")}nt(t,e,n,s){return this.pn(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([r,i])=>this.connection.nt(t,yd(e,n),s,r,i)).catch(t=>{throw"FirebaseError"===t.name?(t.code===Cl.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new gl(Cl.UNKNOWN,t.toString())})}_t(t,e,n,s,r){return this.pn(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection._t(t,yd(e,n),s,i,o,r)).catch(t=>{throw"FirebaseError"===t.name?(t.code===Cl.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new gl(Cl.UNKNOWN,t.toString())})}terminate(){this.mn=!0,this.connection.terminate()}}const up=new Map;const hp={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},dp=41943040;class pp{static withCacheSize(t){return new pp(t,pp.DEFAULT_COLLECTION_PERCENTILE,pp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(t,e,n){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=e,this.maximumSequenceNumbersToCollect=n}}pp.DEFAULT_COLLECTION_PERCENTILE=10,pp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,pp.DEFAULT=new pp(dp,pp.DEFAULT_COLLECTION_PERCENTILE,pp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),pp.DISABLED=new pp(-1,0,0);class fp{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.gn(t),this.yn=t=>e.writeSequenceNumber(t))}gn(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.yn&&this.yn(t),t}}fp.wn=-1;class Cp{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(t=>t())}}async function gp(t){if(t.code!==Cl.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==t.message)throw t;Qc("LocalStore","Unexpectedly lost primary lease")}class mp{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)},t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)})}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&Zc(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new mp((n,s)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,s)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,s)}})}toPromise(){return new Promise((t,e)=>{this.next(t,e)})}wrapUserFunction(t){try{const e=t();return e instanceof mp?e:mp.resolve(e)}catch(t){return mp.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction(()=>t(e)):mp.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction(()=>t(e)):mp.reject(e)}static resolve(t){return new mp((e,n)=>{e(t)})}static reject(t){return new mp((e,n)=>{n(t)})}static waitFor(t){return new mp((e,n)=>{let s=0,r=0,i=!1;t.forEach(t=>{++s,t.next(()=>{++r,i&&r===s&&e()},t=>n(t))}),i=!0,r===s&&e()})}static or(t){let e=mp.resolve(!1);for(const n of t)e=e.next(t=>t?mp.resolve(t):n());return e}static forEach(t,e){const n=[];return t.forEach((t,s)=>{n.push(e.call(this,t,s))}),this.waitFor(n)}static mapArray(t,e){return new mp((n,s)=>{const r=t.length,i=new Array(r);let o=0;for(let a=0;a<r;a++){const B=a;e(t[B]).next(t=>{i[B]=t,++o,o===r&&n(i)},t=>s(t))}})}static doWhile(t,e){return new mp((n,s)=>{const r=()=>{!0===t()?e().next(()=>{r()},s):n()};r()})}}function wp(t){return"IndexedDbTransactionError"===t.name}const yp="LruGarbageCollector";function Ep([t,e],[n,s]){const r=il(t,n);return 0===r?il(e,s):r}class _p{constructor(t){this.Yn=t,this.buffer=new pl(Ep),this.Zn=0}Xn(){return++this.Zn}er(t){const e=[t,this.Xn()];if(this.buffer.size<this.Yn)this.buffer=this.buffer.add(e);else{const t=this.buffer.last();Ep(e,t)<0&&(this.buffer=this.buffer.delete(t).add(e))}}get maxValue(){return this.buffer.last()[0]}}class Dp{constructor(t,e,n){this.garbageCollector=t,this.asyncQueue=e,this.localStore=n,this.tr=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.nr(6e4)}stop(){this.tr&&(this.tr.cancel(),this.tr=null)}get started(){return null!==this.tr}nr(t){Qc(yp,`Garbage collection scheduled in ${t}ms`),this.tr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",t,async()=>{this.tr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){wp(t)?Qc(yp,"Ignoring IndexedDB error during garbage collection: ",t):await gp(t)}await this.nr(3e5)})}}class bp{constructor(t,e){this.rr=t,this.params=e}calculateTargetCount(t,e){return this.rr.ir(t).next(t=>Math.floor(e/100*t))}nthSequenceNumber(t,e){if(0===e)return mp.resolve(fp.wn);const n=new _p(e);return this.rr.forEachTarget(t,t=>n.er(t.sequenceNumber)).next(()=>this.rr.sr(t,t=>n.er(t))).next(()=>n.maxValue)}removeTargets(t,e,n){return this.rr.removeTargets(t,e,n)}removeOrphanedDocuments(t,e){return this.rr.removeOrphanedDocuments(t,e)}collect(t,e){return-1===this.params.cacheSizeCollectionThreshold?(Qc("LruGarbageCollector","Garbage collection skipped; disabled"),mp.resolve(hp)):this.getCacheSize(t).next(n=>n<this.params.cacheSizeCollectionThreshold?(Qc("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),hp):this._r(t,e))}getCacheSize(t){return this.rr.getCacheSize(t)}_r(t,e){let n,s,r,i,o,a,B;const c=Date.now();return this.calculateTargetCount(t,this.params.percentileToCollect).next(e=>(e>this.params.maximumSequenceNumbersToCollect?(Qc("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),s=this.params.maximumSequenceNumbersToCollect):s=e,i=Date.now(),this.nthSequenceNumber(t,s))).next(s=>(n=s,o=Date.now(),this.removeTargets(t,n,e))).next(e=>(r=e,a=Date.now(),this.removeOrphanedDocuments(t,n))).next(t=>(B=Date.now(),Kc()<=is.DEBUG&&Qc("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${i-c}ms\n\tDetermined least recently used ${s} in `+(o-i)+"ms\n"+`\tRemoved ${r} targets in `+(a-o)+"ms\n"+`\tRemoved ${t} documents in `+(B-a)+"ms\n"+`Total Duration: ${B-c}ms`),mp.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:r,documentsRemoved:t})))}}const vp="firestore.googleapis.com",Ip=!0;class Tp{constructor(t){if(void 0===t.host){if(void 0!==t.ssl)throw new gl(Cl.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=vp,this.ssl=Ip}else this.host=t.host,this.ssl=t.ssl??Ip;if(this.isUsingEmulator=void 0!==t.emulatorOptions,this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,t._customHeaders&&(this._customHeaders={...t._customHeaders}),void 0===t.cacheSizeBytes)this.cacheSizeBytes=dp;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new gl(Cl.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}if(function(t,e,n,s){if(!0===e&&!0===s)throw new gl(Cl.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===t.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=qd(t.experimentalLongPollingOptions??{}),function(t){if(void 0!==t.timeoutSeconds){if(isNaN(t.timeoutSeconds))throw new gl(Cl.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (must not be NaN)`);if(t.timeoutSeconds<5)throw new gl(Cl.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (minimum allowed value is 5)`);if(t.timeoutSeconds>30)throw new gl(Cl.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams,void 0!==t.grpcFlowControlWindow){if("number"!=typeof t.grpcFlowControlWindow||t.grpcFlowControlWindow<=0||t.grpcFlowControlWindow>2147483647||!Number.isInteger(t.grpcFlowControlWindow))throw new gl(Cl.INVALID_ARGUMENT,"grpcFlowControlWindow must be a positive integer and cannot exceed 2147483647");this.grpcFlowControlWindow=t.grpcFlowControlWindow}}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&function(t,e){return t.timeoutSeconds===e.timeoutSeconds}(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams&&this.grpcFlowControlWindow===t.grpcFlowControlWindow&&function(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(const s of n)if(t[s]!==e[s])return!1;return!0}(this._customHeaders,t._customHeaders)}}let Op=class{constructor(t,e,n,s){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Tp({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new gl(Cl.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(t){if(this._settingsFrozen)throw new gl(Cl.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 Tp(t),this._emulatorOptions=t.emulatorOptions||{},void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Gd;switch(t.type){case"firstParty":return new jd(t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new gl(Cl.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.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(t){const e=up.get(t);e&&(Qc("ComponentProvider","Removing Datastore"),up.delete(t),e.terminate())}(this),Promise.resolve()}};function Ap(t,e,n,s={}){t=Rl(t,Op);const r=Zn(e),i=t._getSettings(),o={...i,emulatorOptions:t._getEmulatorOptions()},a=`${e}:${n}`;r&&ts(`https://${a}`),i.host!==vp&&i.host!==a&&Yc("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const B={...i,host:a,ssl:r,emulatorOptions:s};if(!$n(B,o)&&(t._setSettings(B),s.mockUserToken)){let e,n;if("string"==typeof s.mockUserToken)e=s.mockUserToken,n=Fd.MOCK_USER;else{e=Ln(s.mockUserToken,t._app?.options.projectId);const r=s.mockUserToken.sub||s.mockUserToken.user_id;if(!r)throw new gl(Cl.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Fd(r)}t._authCredentials=new Hd(new Md(e,n))}}class Sp{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Sp(this.firestore,t,this._query)}}class Rp{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Np(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Rp(this.firestore,t,this._key)}toJSON(){return{type:Rp._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,e,n){if(xl(e,Rp._jsonSchema))return new Rp(t,n||null,new Tl(yl.fromString(e.referencePath)))}}Rp._jsonSchemaVersion="firestore/documentReference/1.0",Rp._jsonSchema={type:Nl("string",Rp._jsonSchemaVersion),referencePath:Nl("string")};class Np extends Sp{constructor(t,e,n){super(t,e,function(t){return new Vh(t)}(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Rp(this.firestore,null,new Tl(t))}withConverter(t){return new Np(this.firestore,t,this._path)}}function xp(t,e,...n){if(t=Xn(t),1===arguments.length&&(e=rl.newId()),function(t,e,n){if(!n)throw new gl(Cl.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}("doc","path",e),t instanceof Op){const s=yl.fromString(e,...n);return Ol(s),new Rp(t,null,new Tl(s))}{if(!(t instanceof Rp||t instanceof Np))throw new gl(Cl.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=t._path.child(yl.fromString(e,...n));return Ol(s),new Rp(t.firestore,t instanceof Np?t.converter:null,new Tl(s))}}class kp{constructor(t){this._values=(t||[]).map(t=>t)}toArray(){return this._values.map(t=>t)}isEqual(t){return function(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}(this._values,t._values)}toJSON(){return{type:kp._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(t){if(xl(t,kp._jsonSchema)){if(Array.isArray(t.vectorValues)&&t.vectorValues.every(t=>"number"==typeof t))return new kp(t.vectorValues);throw new gl(Cl.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}function Lp(t,e,n){if(Pp(t=Xn(t)))return function(t,e,n){if(!Pp(n)||!Al(n)){const s=Sl(n);throw"an object"===s?e.createError(t+" a custom object"):e.createError(t+" "+s)}}("Unsupported field value:",e,t),function(t,e){const n={};return Il(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):vl(t,(t,s)=>{const r=Lp(s,e.childContextForField(t));null!=r&&(n[t]=r)}),{mapValue:{fields:n}}}(t,e);if(t instanceof kd)return function(t,e){if(!function(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Zc(40011,{dataSource:t})}}(e.dataSource))throw e.createError(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.createError(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.arrayElement&&4!==e.dataSource)throw e.createError("Nested arrays are not supported");return function(t,e){const n=[];let s=0;for(const r of t){let t=Lp(r,e.childContextForArray(s));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),s++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=Xn(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return xu(e.serializer,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Fl.fromDate(t);return{timestampValue:pd(e.serializer,n)}}if(t instanceof Fl){const n=new Fl(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:pd(e.serializer,n)}}if(Fp(t)){const n=Fl.fromInstant(t),s=new Fl(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:pd(e.serializer,s)}}if(t instanceof Ld)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Nd)return{bytesValue:Cd(e.serializer,t._byteString)};if(t instanceof Rp){const n=e.databaseId,s=t.firestore._databaseId;if(!s.isEqual(n))throw e.createError(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:wd(t.firestore._databaseId||e.databaseId,t._key.path)}}if(t instanceof kp)return function(t,e){const n=t instanceof kp?t.toArray():t,s={fields:{[nu]:{stringValue:iu},[ou]:{arrayValue:{values:n.map(t=>{if("number"!=typeof t)throw e.createError("VectorValues must only contain numeric values.");return Ru(e.serializer,t)})}}}};return{mapValue:s}}(t,e);if(Od(t))return t._toProto(e.serializer);throw e.createError(`Unsupported field value: ${Sl(t)}`)}(t,e)}function Fp(t){if("object"!=typeof t||null===t)return!1;if("undefined"!=typeof Temporal&&"function"==typeof Temporal.Instant&&t instanceof Temporal.Instant)return!0;const e=t;return"Temporal.Instant"===e[Symbol.toStringTag]&&"bigint"==typeof e.t}function Pp(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Fl||t instanceof Ld||t instanceof Nd||t instanceof Rp||t instanceof kd||t instanceof kp||Fp(t)||Od(t))}function Mp(t,e,n){if((e=Xn(e))instanceof xd)return e._internalPath;if("string"==typeof e)return function(t,e){if(e.search(Gp)>=0)throw Hp(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t);try{return new xd(...e.split("."))._internalPath}catch(n){throw Hp(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t)}}(t,e);throw Hp("Field path arguments must be of type string or ",t)}kp._jsonSchemaVersion="firestore/vectorValue/1.0",kp._jsonSchema={type:Nl("string",kp._jsonSchemaVersion),vectorValues:Nl("object")};const Gp=new RegExp("[~\\*/\\[\\]]");function Hp(t,e,n,s,r){let i=`Function ${e}() called with invalid data`;i+=". ";return new gl(Cl.INVALID_ARGUMENT,i+t+"")}class Up{constructor(t){this.optionDefinitions=t}_getKnownOptions(t,e){const n=Au.empty();for(const s in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(s)){const r=this.optionDefinitions[s];if(s in t){const i=t[s];let o;r.nestedOptions&&Al(i)?o={mapValue:{fields:new Up(r.nestedOptions).getOptionsProto(e,i)}}:i&&(o=Lp(i,e)??void 0),o&&n.set(_l.fromServerFormat(r.serverName),o)}}return n}getOptionsProto(t,e,n){const s=this._getKnownOptions(e,t);if(n){const e=new Map(function(t,e){const n=[];for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&n.push(e(t[s],s,t));return n}(n,(e,n)=>[_l.fromServerFormat(n),void 0!==e?Lp(e,t):null]));s.setAll(e)}return s.value.mapValue.fields??{}}}function Vp(t){let e;return t instanceof Jp?t:(e=Al(t)?function(t){const e=[];for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=t[n];e.push(Xp(n)),e.push(Vp(s))}return new tf("map",e,"map")}(t):t instanceof Array?function(t){return function(t,e){return new tf("array",t.map(t=>Vp(t)),e)}(t,"array")}(t):Zp(t,void 0),e)}function jp(t){if(t instanceof Jp)return t;if(t instanceof kp)return Xp(t);if(Array.isArray(t))return Xp(function(t){return new kp(t)}(t));throw new Error("Unsupported value: "+typeof t)}function $p(t){return function(t){return"string"==typeof t}(t)?function(t){return function(t,e){return new Wp("string"==typeof t?ml===t?new xd(ml)._internalPath:Mp("field",t):t._internalPath,e)}(t,"field")}(t):Vp(t)}class Jp{constructor(){this._protoValueType="ProtoValue"}add(t){return new tf("add",[this,Vp(t)],"add")}asBoolean(){if(this instanceof ef)return this;if(this instanceof Yp)return new sf(this);if(this instanceof Wp)return new rf(this);if(this instanceof tf)return new nf(this);throw new gl("invalid-argument",`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(t){return new tf("subtract",[this,Vp(t)],"subtract")}multiply(t){return new tf("multiply",[this,Vp(t)],"multiply")}divide(t){return new tf("divide",[this,Vp(t)],"divide")}mod(t){return new tf("mod",[this,Vp(t)],"mod")}equal(t){return new tf("equal",[this,Vp(t)],"equal").asBoolean()}notEqual(t){return new tf("not_equal",[this,Vp(t)],"notEqual").asBoolean()}lessThan(t){return new tf("less_than",[this,Vp(t)],"lessThan").asBoolean()}lessThanOrEqual(t){return new tf("less_than_or_equal",[this,Vp(t)],"lessThanOrEqual").asBoolean()}greaterThan(t){return new tf("greater_than",[this,Vp(t)],"greaterThan").asBoolean()}greaterThanOrEqual(t){return new tf("greater_than_or_equal",[this,Vp(t)],"greaterThanOrEqual").asBoolean()}arrayConcat(t,...e){const n=[t,...e].map(t=>Vp(t));return new tf("array_concat",[this,...n],"arrayConcat")}arrayContains(t){return new tf("array_contains",[this,Vp(t)],"arrayContains").asBoolean()}arrayContainsAll(t){const e=Array.isArray(t)?new Qp(t.map(Vp),"arrayContainsAll"):t;return new tf("array_contains_all",[this,e],"arrayContainsAll").asBoolean()}arrayContainsAny(t){const e=Array.isArray(t)?new Qp(t.map(Vp),"arrayContainsAny"):t;return new tf("array_contains_any",[this,e],"arrayContainsAny").asBoolean()}arrayReverse(){return new tf("array_reverse",[this])}arrayLength(){return new tf("array_length",[this],"arrayLength")}equalAny(t){const e=Array.isArray(t)?new Qp(t.map(Vp),"equalAny"):t;return new tf("equal_any",[this,e],"equalAny").asBoolean()}notEqualAny(t){const e=Array.isArray(t)?new Qp(t.map(Vp),"notEqualAny"):t;return new tf("not_equal_any",[this,e],"notEqualAny").asBoolean()}exists(){return new tf("exists",[this],"exists").asBoolean()}charLength(){return new tf("char_length",[this],"charLength")}like(t){return new tf("like",[this,Vp(t)],"like").asBoolean()}regexContains(t){return new tf("regex_contains",[this,Vp(t)],"regexContains").asBoolean()}regexFind(t){return new tf("regex_find",[this,Vp(t)],"regexFind")}regexFindAll(t){return new tf("regex_find_all",[this,Vp(t)],"regexFindAll")}regexMatch(t){return new tf("regex_match",[this,Vp(t)],"regexMatch").asBoolean()}stringContains(t){return new tf("string_contains",[this,Vp(t)],"stringContains").asBoolean()}startsWith(t){return new tf("starts_with",[this,Vp(t)],"startsWith").asBoolean()}endsWith(t){return new tf("ends_with",[this,Vp(t)],"endsWith").asBoolean()}toLower(){return new tf("to_lower",[this],"toLower")}toUpper(){return new tf("to_upper",[this],"toUpper")}trim(t){const e=[this];return t&&e.push(Vp(t)),new tf("trim",e,"trim")}ltrim(t){const e=[this];return t&&e.push(Vp(t)),new tf("ltrim",e,"ltrim")}rtrim(t){const e=[this];return t&&e.push(Vp(t)),new tf("rtrim",e,"rtrim")}type(){return new tf("type",[this])}isType(t){return new tf("is_type",[this,Xp(t)],"isType").asBoolean()}stringConcat(t,...e){const n=[t,...e].map(Vp);return new tf("string_concat",[this,...n],"stringConcat")}stringIndexOf(t){return new tf("string_index_of",[this,Vp(t)],"stringIndexOf")}stringRepeat(t){return new tf("string_repeat",[this,Vp(t)],"stringRepeat")}stringReplaceAll(t,e){return new tf("string_replace_all",[this,Vp(t),Vp(e)],"stringReplaceAll")}stringReplaceOne(t,e){return new tf("string_replace_one",[this,Vp(t),Vp(e)],"stringReplaceOne")}concat(t,...e){const n=[t,...e].map(Vp);return new tf("concat",[this,...n],"concat")}reverse(){return new tf("reverse",[this],"reverse")}arrayFilter(t,e){return new tf("array_filter",[this,Vp(t),e],"arrayFilter")}arrayTransform(t,e){return new tf("array_transform",[this,Vp(t),e],"arrayTransform")}arrayTransformWithIndex(t,e,n){return new tf("array_transform",[this,Vp(t),Vp(e),n],"arrayTransformWithIndex")}arraySlice(t,e){const n=[this,Vp(t)];return void 0!==e&&n.push(Vp(e)),new tf("array_slice",n,"arraySlice")}arrayFirst(){return new tf("array_first",[this],"arrayFirst")}arrayFirstN(t){return new tf("array_first_n",[this,Vp(t)],"arrayFirstN")}arrayLast(){return new tf("array_last",[this],"arrayLast")}arrayLastN(t){return new tf("array_last_n",[this,Vp(t)],"arrayLastN")}arrayMaximum(){return new tf("maximum",[this],"arrayMaximum")}arrayMaximumN(t){return new tf("maximum_n",[this,Vp(t)],"arrayMaximumN")}arrayMinimum(){return new tf("minimum",[this],"arrayMinimum")}arrayMinimumN(t){return new tf("minimum_n",[this,Vp(t)],"arrayMinimumN")}arrayIndexOf(t){return new tf("array_index_of",[this,Vp(t),Vp("first")],"arrayIndexOf")}arrayLastIndexOf(t){return new tf("array_index_of",[this,Vp(t),Vp("last")],"arrayLastIndexOf")}arrayIndexOfAll(t){return new tf("array_index_of_all",[this,Vp(t)],"arrayIndexOfAll")}byteLength(){return new tf("byte_length",[this],"byteLength")}ceil(){return new tf("ceil",[this])}floor(){return new tf("floor",[this])}abs(){return new tf("abs",[this])}exp(){return new tf("exp",[this])}mapGet(t){return new tf("map_get",[this,Xp(t)],"mapGet")}mapSet(t,e,...n){const s=[this,Vp(t),Vp(e),...n.map(Vp)];return new tf("map_set",s,"mapSet")}mapKeys(){return new tf("map_keys",[this],"mapKeys")}mapValues(){return new tf("map_values",[this],"mapValues")}mapEntries(){return new tf("map_entries",[this],"mapEntries")}getField(t){return new tf("get_field",[this,Vp(t)],"get_field")}count(){return qp._create("count",[this],"count")}sum(){return qp._create("sum",[this],"sum")}average(){return qp._create("average",[this],"average")}minimum(){return qp._create("minimum",[this],"minimum")}maximum(){return qp._create("maximum",[this],"maximum")}first(){return qp._create("first",[this],"first")}last(){return qp._create("last",[this],"last")}arrayAgg(){return qp._create("array_agg",[this],"arrayAgg")}arrayAggDistinct(){return qp._create("array_agg_distinct",[this],"arrayAggDistinct")}countDistinct(){return qp._create("count_distinct",[this],"countDistinct")}logicalMaximum(t,...e){const n=[t,...e];return new tf("maximum",[this,...n.map(Vp)],"logicalMaximum")}logicalMinimum(t,...e){const n=[t,...e];return new tf("minimum",[this,...n.map(Vp)],"minimum")}vectorLength(){return new tf("vector_length",[this],"vectorLength")}cosineDistance(t){return new tf("cosine_distance",[this,jp(t)],"cosineDistance")}dotProduct(t){return new tf("dot_product",[this,jp(t)],"dotProduct")}euclideanDistance(t){return new tf("euclidean_distance",[this,jp(t)],"euclideanDistance")}unixMicrosToTimestamp(){return new tf("unix_micros_to_timestamp",[this],"unixMicrosToTimestamp")}timestampToUnixMicros(){return new tf("timestamp_to_unix_micros",[this],"timestampToUnixMicros")}unixMillisToTimestamp(){return new tf("unix_millis_to_timestamp",[this],"unixMillisToTimestamp")}timestampToUnixMillis(){return new tf("timestamp_to_unix_millis",[this],"timestampToUnixMillis")}unixSecondsToTimestamp(){return new tf("unix_seconds_to_timestamp",[this],"unixSecondsToTimestamp")}timestampToUnixSeconds(){return new tf("timestamp_to_unix_seconds",[this],"timestampToUnixSeconds")}timestampAdd(t,e){return new tf("timestamp_add",[this,Vp(t),Vp(e)],"timestampAdd")}timestampSubtract(t,e){return new tf("timestamp_subtract",[this,Vp(t),Vp(e)],"timestampSubtract")}timestampDiff(t,e){return new tf("timestamp_diff",[this,$p(t),Vp(e)],"timestampDiff")}timestampExtract(t,e){const n=[this,Vp(t)];return e&&n.push(Vp(e)),new tf("timestamp_extract",n,"timestampExtract")}documentId(){return new tf("document_id",[this],"documentId")}parent(){return new tf("parent",[this],"parent")}substring(t,e){const n=Vp(t);return new tf("substring",void 0===e?[this,n]:[this,n,Vp(e)],"substring")}arrayGet(t){return new tf("array_get",[this,Vp(t)],"arrayGet")}isError(){return new tf("is_error",[this],"isError").asBoolean()}ifError(t){const e=new tf("if_error",[this,Vp(t)],"ifError");return t instanceof ef?e.asBoolean():e}isAbsent(){return new tf("is_absent",[this],"isAbsent").asBoolean()}mapRemove(t){return new tf("map_remove",[this,Vp(t)],"mapRemove")}mapMerge(t,...e){const n=Vp(t),s=e.map(Vp);return new tf("map_merge",[this,n,...s],"mapMerge")}pow(t){return new tf("pow",[this,Vp(t)])}trunc(t){return void 0===t?new tf("trunc",[this]):new tf("trunc",[this,Vp(t)],"trunc")}round(t){return void 0===t?new tf("round",[this]):new tf("round",[this,Vp(t)],"round")}collectionId(){return new tf("collection_id",[this])}length(){return new tf("length",[this])}ln(){return new tf("ln",[this])}sqrt(){return new tf("sqrt",[this])}stringReverse(){return new tf("string_reverse",[this])}ifAbsent(t){return new tf("if_absent",[this,Vp(t)],"ifAbsent")}ifNull(t){return new tf("if_null",[this,Vp(t)],"ifNull")}coalesce(t,...e){return new tf("coalesce",[this,Vp(t),...e.map(Vp)],"coalesce")}join(t){return new tf("join",[this,Vp(t)],"join")}log10(){return new tf("log10",[this])}arraySum(){return new tf("sum",[this])}split(t){return new tf("split",[this,Vp(t)])}timestampTruncate(t,e){const n=[this,Vp(t)];return e&&n.push(Vp(e)),new tf("timestamp_trunc",n)}ascending(){return function(t){return new of($p(t),"ascending","ascending")}(this)}descending(){return function(t){return new of($p(t),"descending","descending")}(this)}as(t){return new Kp(this,t,"as")}}class qp{constructor(t,e){this.name=t,this.params=e,this.exprType="AggregateFunction",this._protoValueType="ProtoValue"}static _create(t,e,n){const s=new qp(t,e);return s._methodName=n,s}as(t){return new zp(this,t,"as")}_toProto(t){return{functionValue:{name:this.name,args:this.params.map(e=>e._toProto(t))}}}_readUserData(t){t=this._methodName?t.contextWith({methodName:this._methodName}):t,this.params.forEach(e=>e._readUserData(t))}}class zp{constructor(t,e,n){this.aggregate=t,this.alias=e,this._methodName=n}_readUserData(t){this.aggregate._readUserData(t)}}class Kp{constructor(t,e,n){this.expr=t,this.alias=e,this._methodName=n,this.exprType="AliasedExpression",this.selectable=!0}_readUserData(t){this.expr._readUserData(t)}}class Qp extends Jp{constructor(t,e){super(),this.cr=t,this._methodName=e,this.expressionType="ListOfExpressions"}_toProto(t){return{arrayValue:{values:this.cr.map(e=>e._toProto(t))}}}_readUserData(t){this.cr.forEach(e=>e._readUserData(t))}}class Wp extends Jp{constructor(t,e){super(),this.fieldPath=t,this._methodName=e,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(t){return new tf("geo_distance",[this,Vp(t)],"geoDistance")}_toProto(t){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(t){}}class Yp extends Jp{constructor(t,e){super(),this.value=t,this._methodName=e,this.expressionType="Constant"}static _fromProto(t){const e=new Yp(t,void 0);return e._protoValue=t,e}_toProto(t){return el(void 0!==this._protoValue,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(t){t=this._methodName?t.contextWith({methodName:this._methodName}):t,function(t){return"object"==typeof t&&null!==t&&!!("nullValue"in t&&(null===t.nullValue||"NULL_VALUE"===t.nullValue)||"booleanValue"in t&&(null===t.booleanValue||"boolean"==typeof t.booleanValue)||"integerValue"in t&&(null===t.integerValue||"number"==typeof t.integerValue||"string"==typeof t.integerValue)||"doubleValue"in t&&(null===t.doubleValue||"number"==typeof t.doubleValue)||"timestampValue"in t&&(null===t.timestampValue||function(t){return"object"==typeof t&&null!==t&&"seconds"in t&&(null===t.seconds||"number"==typeof t.seconds||"string"==typeof t.seconds)&&"nanos"in t&&(null===t.nanos||"number"==typeof t.nanos)}(t.timestampValue))||"stringValue"in t&&(null===t.stringValue||"string"==typeof t.stringValue)||"bytesValue"in t&&(null===t.bytesValue||t.bytesValue instanceof Uint8Array)||"referenceValue"in t&&(null===t.referenceValue||"string"==typeof t.referenceValue)||"geoPointValue"in t&&(null===t.geoPointValue||function(t){return"object"==typeof t&&null!==t&&"latitude"in t&&(null===t.latitude||"number"==typeof t.latitude)&&"longitude"in t&&(null===t.longitude||"number"==typeof t.longitude)}(t.geoPointValue))||"arrayValue"in t&&(null===t.arrayValue||function(t){return"object"==typeof t&&null!==t&&!(!("values"in t)||null!==t.values&&!Array.isArray(t.values))}(t.arrayValue))||"mapValue"in t&&(null===t.mapValue||function(t){return"object"==typeof t&&null!==t&&!(!("fields"in t)||null!==t.fields&&!Al(t.fields))}(t.mapValue))||"fieldReferenceValue"in t&&(null===t.fieldReferenceValue||"string"==typeof t.fieldReferenceValue)||"functionValue"in t&&(null===t.functionValue||function(t){return"object"==typeof t&&null!==t&&!(!("name"in t)||null!==t.name&&"string"!=typeof t.name||!("args"in t)||null!==t.args&&!Array.isArray(t.args))}(t.functionValue))||"pipelineValue"in t&&(null===t.pipelineValue||function(t){return"object"==typeof t&&null!==t&&!(!("stages"in t)||null!==t.stages&&!Array.isArray(t.stages))}(t.pipelineValue)))}(this._protoValue)||(this._protoValue=Lp(this.value,t))}}function Xp(t,e){return Zp(t,"constant")}function Zp(t,e){const n=new Yp(t,e);return"boolean"==typeof t?new sf(n):n}class tf extends Jp{constructor(t,e,n,s){super(),this.name=t,this.params=e,this.expressionType="Function",this._optionsProto=void 0,void 0!==n&&(this._methodName=n),void 0!==s&&(this._options=s)}get _optionsUtil(){return new Up({})}_toProto(t){const e={functionValue:{name:this.name,args:this.params.map(e=>e._toProto(t))}};return this._optionsProto&&(e.functionValue.options=this._optionsProto),e}_readUserData(t){t=this._methodName?t.contextWith({methodName:this._methodName}):t,this.params.forEach(e=>e._readUserData(t)),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(t,this._options))}}class ef extends Jp{get _methodName(){return this._expr._methodName}countIf(){return qp._create("count_if",[this],"countIf")}not(){return new tf("not",[this],"not").asBoolean()}conditional(t,e){return new tf("conditional",[this,t,e],"conditional")}ifError(t){const e=Vp(t),n=new tf("if_error",[this,e],"ifError");return e instanceof ef?n.asBoolean():n}_toProto(t){return this._expr._toProto(t)}_readUserData(t){this._expr._readUserData(t)}}class nf extends ef{constructor(t){super(),this._expr=t,this.expressionType="Function"}}class sf extends ef{constructor(t){super(),this._expr=t,this.expressionType="Constant"}_getValue(){return this._expr._getValue()}}class rf extends ef{constructor(t){super(),this._expr=t,this.expressionType="Field"}}class of{constructor(t,e,n){this.expr=t,this.direction=e,this._methodName=n,this._protoValueType="ProtoValue"}_toProto(t){return{mapValue:{fields:{direction:Sd(this.direction),expression:this.expr._toProto(t)}}}}_readUserData(t){this.expr._readUserData(t)}}class af{constructor(t){this.optionsProto=void 0,({rawOptions:this.rawOptions,...this.knownOptions}=t)}_readUserData(t){this.optionsProto=this._optionsUtil.getOptionsProto(t,this.knownOptions,this.rawOptions)}_toProto(t){return{name:this._name,options:this.optionsProto}}}class Bf extends af{get _name(){return"add_fields"}get _optionsUtil(){return new Up({})}constructor(t,e){super(e),this.fields=t}_toProto(t){return{...super._toProto(t),args:[Ad(t,this.fields)]}}_readUserData(t){super._readUserData(t),Ef(this.fields,t)}}class cf extends af{get _name(){return"aggregate"}get _optionsUtil(){return new Up({})}constructor(t,e,n){super(n),this.groups=t,this.accumulators=e}_toProto(t){return{...super._toProto(t),args:[Ad(t,this.accumulators),Ad(t,this.groups)]}}_readUserData(t){super._readUserData(t),Ef(this.groups,t),Ef(this.accumulators,t)}}class lf extends af{get _name(){return"distinct"}get _optionsUtil(){return new Up({})}constructor(t,e){super(e),this.groups=t}_toProto(t){return{...super._toProto(t),args:[Ad(t,this.groups)]}}_readUserData(t){super._readUserData(t),Ef(this.groups,t)}}class uf extends af{get _name(){return"collection"}get _optionsUtil(){return new Up({forceIndex:{serverName:"force_index"}})}constructor(t,e){super(e),this.hr=t.startsWith("/")?t:"/"+t}_toProto(t){return{...super._toProto(t),args:[{referenceValue:this.hr}]}}_readUserData(t){super._readUserData(t)}}class hf extends af{get _name(){return"collection_group"}get _optionsUtil(){return new Up({forceIndex:{serverName:"force_index"}})}constructor(t,e){super(e),this.collectionId=t}_toProto(t){return{...super._toProto(t),args:[{referenceValue:""},{stringValue:this.collectionId}]}}_readUserData(t){super._readUserData(t)}}class df extends af{get _name(){return"database"}get _optionsUtil(){return new Up({})}_toProto(t){return{...super._toProto(t)}}_readUserData(t){super._readUserData(t)}}class pf extends af{get _name(){return"documents"}get _optionsUtil(){return new Up({})}constructor(t,e){if(super(e),!t||0===t.length)throw new gl(Cl.INVALID_ARGUMENT,"Empty document paths are not allowed in DocumentsSource");const n=t.map(t=>t.startsWith("/")?t:"/"+t),s=new Set(n);if(s.size!==n.length)throw new gl(Cl.INVALID_ARGUMENT,"Duplicate document paths are not allowed in DocumentsSource");this.Tr=n,this.Pr=s}_toProto(t){return{...super._toProto(t),args:this.Tr.map(t=>({referenceValue:t}))}}_readUserData(t){super._readUserData(t)}}class ff extends af{get _name(){return"where"}get _optionsUtil(){return new Up({})}constructor(t,e){super(e),this.condition=t}_toProto(t){return{...super._toProto(t),args:[this.condition._toProto(t)]}}_readUserData(t){super._readUserData(t),Ef(this.condition,t)}}class Cf extends af{get _name(){return"limit"}get _optionsUtil(){return new Up({})}constructor(t,e){el(!isNaN(t)&&t!==1/0&&t!==-1/0,34860),super(e),this.limit=t}_toProto(t){return{...super._toProto(t),args:[xu(t,this.limit)]}}}class gf extends af{get _name(){return"offset"}get _optionsUtil(){return new Up({})}constructor(t,e){super(e),this.offset=t}_toProto(t){return{...super._toProto(t),args:[xu(t,this.offset)]}}}class mf extends af{get _name(){return"select"}get _optionsUtil(){return new Up({})}constructor(t,e){super(e),this.selections=t}_toProto(t){return{...super._toProto(t),args:[Ad(t,this.selections)]}}_readUserData(t){super._readUserData(t),Ef(this.selections,t)}}class wf extends af{get _name(){return"sort"}get _optionsUtil(){return new Up({})}constructor(t,e){super(e),this.orderings=t}_toProto(t){return{...super._toProto(t),args:this.orderings.map(e=>e._toProto(t))}}_readUserData(t){super._readUserData(t),Ef(this.orderings,t)}}class yf extends af{get _name(){return"replace_with"}get _optionsUtil(){return new Up({})}constructor(t,e){super(e),this.map=t}_toProto(t){return{...super._toProto(t),args:[this.map._toProto(t),Sd(yf.Ir)]}}_readUserData(t){super._readUserData(t),Ef(this.map,t)}}function Ef(t,e){return function(t){return"function"==typeof t._readUserData}(t)?t._readUserData(e):Array.isArray(t)||t instanceof Map?t.forEach(t=>t._readUserData(e)):Object.values(t).forEach(t=>t._readUserData(e)),t}yf.Ir="full_replace";class _f{constructor(t,e,n){this.serializer=t,this.stages=e,this.listenOptions=n,this.isCorePipeline=!0}getPipelineCollection(){return bf(this)}getPipelineCollectionGroup(){return vf(this)}getPipelineCollectionId(){return function(t){switch(Df(t)){case"collection":return yl.fromString(bf(t)).lastSegment();case"collection_group":return vf(t);default:return}}(this)}getPipelineDocuments(){return If(this)}getPipelineFlavor(){return function(t){let e="exact";return t.stages.forEach((n,s)=>{n._name!==lf.name&&n._name!==cf.name||(e="keyless"),n._name===mf.name&&"exact"===e&&(e="augmented"),n._name===Bf.name&&s<t.stages.length-1&&"exact"===e&&(e="augmented")}),e}(this)}getPipelineSourceType(){return Df(this)}}function Df(t){const e=t.stages[0];return e instanceof uf||e instanceof hf||e instanceof df||e instanceof pf?e._name:"unknown"}function bf(t){if("collection"===Df(t))return t.stages[0].hr}function vf(t){if("collection_group"===Df(t))return t.stages[0].collectionId}function If(t){if("documents"===Df(t))return t.stages[0].Tr}class Tf{constructor(t,e){this.type=t,this.value=e}static mr(){return new Tf("ERROR",void 0)}static pr(){return new Tf("UNSET",void 0)}static gr(){return new Tf("NULL",au)}static newValue(t){return Du(t)?new Tf("NULL",au):function(t){return!!t&&"booleanValue"in t}(t)?new Tf("BOOLEAN",t):wu(t)?new Tf("INT",t):yu(t)?new Tf("DOUBLE",t):function(t){return!!t&&"timestampValue"in t&&!!t.timestampValue}(t)?new Tf("TIMESTAMP",t):function(t){return!!t&&"stringValue"in t}(t)?new Tf("STRING",t):function(t){return!!t&&"bytesValue"in t}(t)?new Tf("BYTES",t):t.referenceValue?new Tf("REFERENCE",t):t.geoPointValue?new Tf("GEO_POINT",t):_u(t)?new Tf("ARRAY",t):Iu(t)?new Tf("VECTOR",t):vu(t)?new Tf("MAP",t):new Tf("ERROR",void 0)}yr(){return"ERROR"===this.type||"UNSET"===this.type}wr(){return"NULL"===this.type}}function Of(t){if(!t.yr())return t.value}function Af(t){return t instanceof ef?t._expr:t}function Sf(t){if((t=Af(t))instanceof Wp)return new Rf(t);if(t instanceof Yp)return new Nf(t);if(t instanceof Qp)return new xf(t);if(t instanceof tf){if("add"===t.name)return new Hf(t);if("subtract"===t.name)return new Uf(t);if("multiply"===t.name)return new Vf(t);if("divide"===t.name)return new jf(t);if("mod"===t.name)return new $f(t);if("and"===t.name)return new Jf(t);if("equal"===t.name)return new aC(t);if("not_equal"===t.name)return new BC(t);if("less_than"===t.name)return new cC(t);if("less_than_or_equal"===t.name)return new lC(t);if("greater_than"===t.name)return new uC(t);if("greater_than_or_equal"===t.name)return new hC(t);if("array_concat"===t.name)return new dC(t);if("array_reverse"===t.name)return new pC(t);if("array_contains"===t.name)return new fC(t);if("array_contains_all"===t.name)return new CC(t);if("array_contains_any"===t.name)return new gC(t);if("array_length"===t.name)return new mC(t);if("array_element"===t.name)return new wC(t);if("equal_any"===t.name)return new Qf(t);if("not_equal_any"===t.name)return new Wf(t);if("is_nan"===t.name)return new Yf(t);if("is_not_nan"===t.name)return new Xf(t);if("is_null"===t.name)return new Zf(t);if("is_not_null"===t.name)return new tC(t);if("is_error"===t.name)return new eC(t);if("exists"===t.name)return new nC(t);if("not"===t.name)return new qf(t);if("or"===t.name)return new zf(t);if("xor"===t.name)return new Kf(t);if("conditional"===t.name)return new sC(t);if("maximum"===t.name)return new rC(t);if("minimum"===t.name)return new iC(t);if("reverse"===t.name)return new yC(t);if("replace_first"===t.name)return new EC(t);if("replace_all"===t.name)return new _C(t);if("char_length"===t.name)return new DC(t);if("byte_length"===t.name)return new bC(t);if("like"===t.name)return new IC(t);if("regex_contains"===t.name)return new TC(t);if("regex_match"===t.name)return new OC(t);if("string_contains"===t.name)return new AC(t);if("starts_with"===t.name)return new SC(t);if("ends_with"===t.name)return new RC(t);if("to_lower"===t.name)return new NC(t);if("to_upper"===t.name)return new xC(t);if("trim"===t.name)return new kC(t);if("string_concat"===t.name)return new LC(t);if("map_get"===t.name)return new FC(t);if("cosine_distance"===t.name)return new MC(t);if("dot_product"===t.name)return new GC(t);if("euclidean_distance"===t.name)return new HC(t);if("vector_length"===t.name)return new UC(t);if("unix_micros_to_timestamp"===t.name)return new ng(t);if("timestamp_to_unix_micros"===t.name)return new og(t);if("unix_millis_to_timestamp"===t.name)return new sg(t);if("timestamp_to_unix_millis"===t.name)return new ag(t);if("unix_seconds_to_timestamp"===t.name)return new rg(t);if("timestamp_to_unix_seconds"===t.name)return new Bg(t);if("timestamp_add"===t.name)return new lg(t);if("timestamp_subtract"===t.name)return new ug(t)}throw new Error(`Unknown Expr : ${t}`)}class Rf{constructor(t){this.expr=t}evaluate(t,e){if(this.expr.fieldName===ml)return Tf.newValue({referenceValue:Ed(t.serializer,e.key)});if("__update_time__"===this.expr.fieldName)return Tf.newValue({timestampValue:gd(t.serializer,e.version)});if("__create_time__"===this.expr.fieldName)return Tf.newValue({timestampValue:gd(t.serializer,e.createTime)});const n=e.data.field(this.expr._fieldPath);return n?zl(n)?Tf.newValue(function(t,e){if("estimate"===t.serverTimestampBehavior)return{timestampValue:gd(t.serializer,xh.fromTimestamp(Ql(e)))};if("previous"===t.serverTimestampBehavior){const t=Kl(e);if(t)return t}return{nullValue:"NULL_VALUE"}}(t,n)):Tf.newValue(n):Tf.pr()}}class Nf{constructor(t){this.expr=t}evaluate(t,e){return Tf.newValue(this.expr._getValue())}}class xf{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.cr.map(n=>Sf(n).evaluate(t,e));return n.some(t=>t.yr())?Tf.mr():Tf.newValue({arrayValue:{values:n.map(t=>t.value)}})}}function kf(t){return yu(t)?Number(t.doubleValue):Number(t.integerValue)}function Lf(t){return BigInt(t.integerValue)}const Ff=BigInt("0x7fffffffffffffff"),Pf=-BigInt("0x8000000000000000");class Mf{constructor(t){this.expr=t}evaluate(t,e){el(this.expr.params.length>=2,24778);const n=Sf(this.expr.params[0]).evaluate(t,e),s=Sf(this.expr.params[1]).evaluate(t,e);let r=this.br(n,s);for(const n of this.expr.params.slice(2)){const s=Sf(n).evaluate(t,e);r=this.br(r,s)}return r}br(t,e){if(t.yr()||e.yr())return Tf.mr();if(t.wr()||e.wr())return Tf.gr();const n=t.value,s=e.value;if(!yu(n)&&!wu(n)||!yu(s)&&!wu(s))return Tf.mr();if(yu(n)||yu(s)){const t=this.Sr(n,s);return t?Tf.newValue(t):Tf.mr()}if(wu(n)&&wu(s)){const t=this.vr(n,s);return void 0===t?Tf.mr():"number"==typeof t?Tf.newValue({doubleValue:t}):t<Pf||t>Ff?Tf.mr():Tf.newValue({integerValue:`${t}`})}return Tf.mr()}}function Gf(t,e){return lu(t)!==lu(e)?"TYPE_MISMATCH":bu(t)||bu(e)?"NOT_EQ":Du(t)&&Du(e)?"EQ":Du(t)||Du(e)?"NULL":_u(t)&&_u(e)?function(t,e){if(t.values?.length!==e.values?.length)return"NOT_EQ";let n=!1;for(let s=0;s<(t.values?.length??0);s++){const r=t.values[s],i=e.values[s];switch(Gf(r,i)){case"EQ":break;case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":n=!0;break;default:Zc(44609,{Dr:r,Cr:i})}}return n?"NULL":"EQ"}(t.arrayValue,e.arrayValue):Iu(t)&&Iu(e)||vu(t)&&vu(e)?function(t,e){const n=t.fields||{},s=e.fields||{};if(bl(n)!==bl(s))return"NOT_EQ";let r=!1;for(const t in n)if(n.hasOwnProperty(t)){if(void 0===s[t])return"NOT_EQ";switch(Gf(n[t],s[t])){case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":r=!0}}return r?"NULL":"EQ"}(t.mapValue,e.mapValue):function(t,e){return uu(t,e,{u:!1,i:!0,o:!0})}(t,e)?"EQ":"NOT_EQ"}class Hf extends Mf{vr(t,e){return Lf(t)+Lf(e)}Sr(t,e){return{doubleValue:kf(t)+kf(e)}}}class Uf extends Mf{constructor(t){super(t),this.expr=t}vr(t,e){return Lf(t)-Lf(e)}Sr(t,e){return{doubleValue:kf(t)-kf(e)}}}class Vf extends Mf{constructor(t){super(t),this.expr=t}vr(t,e){return Lf(t)*Lf(e)}Sr(t,e){return{doubleValue:kf(t)*kf(e)}}}class jf extends Mf{constructor(t){super(t),this.expr=t}vr(t,e){const n=Lf(e);if(n!==BigInt(0))return Lf(t)/n}Sr(t,e){const n=kf(e);return 0===n?{doubleValue:eu(n)?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}:{doubleValue:kf(t)/n}}}class $f extends Mf{constructor(t){super(t),this.expr=t}vr(t,e){const n=Lf(e);if(n!==BigInt(0))return Lf(t)%n}Sr(t,e){const n=kf(e);if(0!==n)return{doubleValue:kf(t)%n}}}class Jf{constructor(t){this.expr=t}evaluate(t,e){let n=!1,s=!1;for(const r of this.expr.params){const i=Sf(r).evaluate(t,e);switch(i.type){case"BOOLEAN":if(!i.value?.booleanValue)return Tf.newValue(cu);break;case"NULL":s=!0;break;default:n=!0}}return n?Tf.mr():s?Tf.gr():Tf.newValue(Bu)}}class qf{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,9634);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"BOOLEAN":return Tf.newValue({booleanValue:!n.value?.booleanValue});case"NULL":return Tf.gr();default:return Tf.mr()}}}class zf{constructor(t){this.expr=t}evaluate(t,e){let n=!1,s=!1;for(const r of this.expr.params){const i=Sf(r).evaluate(t,e);switch(i.type){case"BOOLEAN":if(i.value?.booleanValue)return Tf.newValue(Bu);break;case"NULL":s=!0;break;default:n=!0}}return n?Tf.mr():s?Tf.gr():Tf.newValue(cu)}}class Kf{constructor(t){this.expr=t}evaluate(t,e){let n=!1,s=!1;for(const r of this.expr.params){const i=Sf(r).evaluate(t,e);switch(i.type){case"BOOLEAN":n=Kf.xor(n,!!i.value?.booleanValue);break;case"NULL":s=!0;break;default:return Tf.mr()}}return s?Tf.gr():Tf.newValue({booleanValue:n})}static xor(t,e){return(t||e)&&!(t&&e)}}class Qf{constructor(t){this.expr=t}evaluate(t,e){el(2===this.expr.params.length,55094);let n=!1;const s=Sf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"NULL":n=!0;break;case"ERROR":case"UNSET":return Tf.mr()}const r=Sf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Tf.mr()}if(n)return Tf.gr();for(const t of r.value?.arrayValue?.values??[])switch(Du(s.value)&&Du(t)?"EQ":Gf(s.value,t)){case"EQ":return Tf.newValue(Bu);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:Zc(44608,{value:s.value,candidate:t})}return n?Tf.gr():Tf.newValue(cu)}}class Wf{constructor(t){this.expr=t}evaluate(t,e){return new qf(new tf("not",[new tf("equal_any",this.expr.params)])).evaluate(t,e)}}class Yf{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,23322);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"INT":return Tf.newValue(cu);case"DOUBLE":return Tf.newValue({booleanValue:isNaN(kf(n.value))});case"NULL":return Tf.gr();default:return Tf.mr()}}}class Xf{constructor(t){this.expr=t}evaluate(t,e){return el(1===this.expr.params.length,50406),new qf(new tf("not",[new tf("is_nan",this.expr.params)])).evaluate(t,e)}}class Zf{constructor(t){this.expr=t}evaluate(t,e){switch(el(1===this.expr.params.length,23123),Sf(this.expr.params[0]).evaluate(t,e).type){case"NULL":return Tf.newValue(Bu);case"UNSET":case"ERROR":return Tf.mr();default:return Tf.newValue(cu)}}}class tC{constructor(t){this.expr=t}evaluate(t,e){return el(1===this.expr.params.length,23167),new qf(new tf("not",[new tf("is_null",this.expr.params)])).evaluate(t,e)}}class eC{constructor(t){this.expr=t}evaluate(t,e){return el(1===this.expr.params.length,5228),"ERROR"===Sf(this.expr.params[0]).evaluate(t,e).type?Tf.newValue(Bu):Tf.newValue(cu)}}class nC{constructor(t){this.expr=t}evaluate(t,e){switch(el(1===this.expr.params.length,6877),Sf(this.expr.params[0]).evaluate(t,e).type){case"ERROR":return Tf.mr();case"UNSET":return Tf.newValue(cu);default:return Tf.newValue(Bu)}}}class sC{constructor(t){this.expr=t}evaluate(t,e){el(3===this.expr.params.length,11706);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"BOOLEAN":return n.value?.booleanValue?Sf(this.expr.params[1]).evaluate(t,e):Sf(this.expr.params[2]).evaluate(t,e);case"NULL":return Sf(this.expr.params[2]).evaluate(t,e);default:return Tf.mr()}}}class rC{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.params.map(n=>Sf(n).evaluate(t,e));let s;for(const t of n)switch(t.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=void 0===s||du(t.value,s.value)>0?t:s}return void 0===s?Tf.gr():s}}class iC{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.params.map(n=>Sf(n).evaluate(t,e));let s;for(const t of n)switch(t.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=void 0===s||du(t.value,s.value)<0?t:s}return void 0===s?Tf.gr():s}}class oC{constructor(t){this.expr=t}evaluate(t,e){el(2===this.expr.params.length,31033,`${this.expr.name}() function should have exactly 2 params`);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"ERROR":case"UNSET":return Tf.mr()}const s=Sf(this.expr.params[1]).evaluate(t,e);switch(s.type){case"ERROR":case"UNSET":return Tf.mr()}return this.Fr(n,s)}}class aC extends oC{constructor(t){super(t),this.expr=t}Fr(t,e){if(t.wr()&&e.wr())return Tf.newValue(Bu);if(t.wr()||e.wr())return Tf.newValue(cu);if(bu(t.value)||bu(e.value))return Tf.newValue(cu);if(lu(t.value)!==lu(e.value))return Tf.newValue(cu);switch(Gf(t.value,e.value)){case"EQ":return Tf.newValue(Bu);case"NOT_EQ":return Tf.newValue(cu);case"NULL":return Tf.gr();default:Zc(44615,{left:t,right:e})}}}class BC extends oC{constructor(t){super(t),this.expr=t}Fr(t,e){switch(Gf(t.value,e.value)){case"EQ":return Tf.newValue(cu);case"NOT_EQ":case"TYPE_MISMATCH":return Tf.newValue(Bu);case"NULL":return Tf.gr();default:Zc(44614,{left:t,right:e})}}}class cC extends oC{constructor(t){super(t),this.expr=t}Fr(t,e){return lu(t.value)!==lu(e.value)||bu(t.value)||bu(e.value)?Tf.newValue(cu):Tf.newValue({booleanValue:du(t.value,e.value)<0})}}class lC extends oC{constructor(t){super(t),this.expr=t}Fr(t,e){return lu(t.value)!==lu(e.value)||bu(t.value)||bu(e.value)?Tf.newValue(cu):"EQ"===Gf(t.value,e.value)?Tf.newValue(Bu):Tf.newValue({booleanValue:du(t.value,e.value)<0})}}class uC extends oC{constructor(t){super(t),this.expr=t}Fr(t,e){return lu(t.value)!==lu(e.value)||bu(t.value)||bu(e.value)?Tf.newValue(cu):Tf.newValue({booleanValue:du(t.value,e.value)>0})}}class hC extends oC{constructor(t){super(t),this.expr=t}Fr(t,e){return lu(t.value)!==lu(e.value)||bu(t.value)||bu(e.value)?Tf.newValue(cu):"EQ"===Gf(t.value,e.value)?Tf.newValue(Bu):Tf.newValue({booleanValue:du(t.value,e.value)>0})}}class dC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class pC{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,216);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Tf.gr();case"ARRAY":{const t=n.value.arrayValue?.values??[];return Tf.newValue({arrayValue:{values:[...t].reverse()}})}default:return Tf.mr()}}}class fC{constructor(t){this.expr=t}evaluate(t,e){return el(2===this.expr.params.length,52884),new Qf(new tf("eq_any",[this.expr.params[1],this.expr.params[0]])).evaluate(t,e)}}class CC{constructor(t){this.expr=t}evaluate(t,e){el(2===this.expr.params.length,1392);let n=!1;const s=Sf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Tf.mr()}const r=Sf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Tf.mr()}if(n)return Tf.gr();const i=r.value?.arrayValue?.values??[],o=s.value?.arrayValue?.values??[];for(const t of i){let e=!1;n=!1;for(const s of o){switch(Du(t)&&Du(s)?"EQ":Gf(t,s)){case"EQ":e=!0;break;case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:Zc(44613,{value:s,search:t})}if(e)break}if(!e)return Tf.newValue(cu)}return Tf.newValue(Bu)}}class gC{constructor(t){this.expr=t}evaluate(t,e){el(2===this.expr.params.length,2680);let n=!1;const s=Sf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Tf.mr()}const r=Sf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return Tf.mr()}if(n)return Tf.gr();const i=r.value?.arrayValue?.values??[],o=s.value?.arrayValue?.values??[];for(const t of o)for(const e of i)switch(Du(t)&&Du(e)?"EQ":Gf(t,e)){case"EQ":return Tf.newValue(Bu);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:Zc(60403,{value:t,search:e})}return n?Tf.gr():Tf.newValue(cu)}}class mC{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,38605);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Tf.gr();case"ARRAY":return Tf.newValue({integerValue:`${n.value?.arrayValue?.values?.length??0}`});default:return Tf.mr()}}}class wC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class yC{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,1508);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Tf.gr();case"BYTES":{const t=n.value?.bytesValue;if("string"==typeof t){const e=Ml.fromBase64String(t).toUint8Array();return e.reverse(),Tf.newValue({bytesValue:Ml.fromUint8Array(e).toBase64()})}return Tf.newValue({bytesValue:new Uint8Array(t).reverse()})}case"STRING":{const t=n.value?.stringValue,e=new Intl.__PRIVATE_Segmenter(void 0,{granularity:"grapheme"}).segment(t),s=Array.from(e,t=>t.segment).reverse();return Tf.newValue({stringValue:s.join("")})}default:return Tf.mr()}}}class EC{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class _C{constructor(t){this.expr=t}evaluate(t,e){throw new Error("Unimplemented")}}class DC{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,19400);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"NULL":return Tf.gr();case"STRING":{const t=function(t){let e=0;for(let n=0;n<t.length;n++){const s=t.codePointAt(n);if(void 0===s)return;if(s<=65535)if(s>=55296&&s<=57343)if(s<=56319){const s=t.codePointAt(n+1);void 0!==s&&s>=56320&&s<=57343?(e+=1,n++):e+=1}else e+=1;else e+=1;else{if(!(s<=1114111))return;e+=1,n++}}return e}(n.value.stringValue);return void 0===t?Tf.mr():Tf.newValue({integerValue:t})}default:return Tf.mr()}}}class bC{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,8486);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"BYTES":{const t=n.value?.bytesValue;return"string"==typeof t?Tf.newValue({integerValue:Ml.fromBase64String(t).toUint8Array().length}):Tf.newValue({integerValue:new Uint8Array(t).length})}case"STRING":{const t=function(t){let e=0;for(let n=0;n<t.length;n++){const s=t.codePointAt(n);if(void 0===s)return;if(s>=55296&&s<=57343){if(!(s<=56319))return;{const s=t.codePointAt(n+1);if(void 0===s||!(s>=56320&&s<=57343))return;e+=4,n++}}else if(s<=127)e+=1;else if(s<=2047)e+=2;else if(s<=65535)e+=3;else{if(!(s<=1114111))return;e+=4,n++}}return e}(n.value?.stringValue);return void 0===t?Tf.mr():Tf.newValue({integerValue:t})}case"NULL":return Tf.gr();default:return Tf.mr()}}}class vC{constructor(t){this.expr=t}evaluate(t,e){el(2===this.expr.params.length,39773,`${this.expr.name}() function should have exactly two parameters`);let n=!1;const s=Sf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"STRING":break;case"NULL":n=!0;break;default:return Tf.mr()}const r=Sf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"STRING":break;case"NULL":n=!0;break;default:return Tf.mr()}return n?Tf.gr():this.Or(s.value?.stringValue,r.value?.stringValue)}}class IC extends vC{Or(t,e){try{const n=function(t){let e="";for(let n=0;n<t.length;n++){const s=t.charAt(n);switch(s){case"_":e+=".";break;case"%":e+=".*";break;case"\\":case".":case"*":case"?":case"+":case"^":case"$":case"|":case"(":case")":case"[":case"]":case"{":case"}":e+="\\"+s;break;default:e+=s}}return"^"+e+"$"}(e),s=Jc.compile(n);return Tf.newValue({booleanValue:s.matches(t)})}catch(t){return Yc(`Invalid LIKE pattern converted to regex: ${e}, returning error. Error: ${t}`),Tf.mr()}}}class TC extends vC{Or(t,e){try{const n=Jc.compile(e);return Tf.newValue({booleanValue:n.test(t)})}catch(t){return Yc(`Invalid regex pattern found in regex_contains: ${e}, returning error`),Tf.mr()}}}class OC extends vC{Or(t,e){try{return Tf.newValue({booleanValue:Jc.compile(e).matches(t)})}catch(t){return Yc(`Invalid regex pattern found in regex_match: ${e}, returning error`),Tf.mr()}}}class AC extends vC{Or(t,e){return Tf.newValue({booleanValue:t.includes(e)})}}class SC extends vC{Or(t,e){return Tf.newValue({booleanValue:t.startsWith(e)})}}class RC extends vC{Or(t,e){return Tf.newValue({booleanValue:t.endsWith(e)})}}class NC{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,29079);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"STRING":return Tf.newValue({stringValue:n.value?.stringValue?.toLowerCase()});case"NULL":return Tf.gr();default:return Tf.mr()}}}class xC{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,60487);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"STRING":return Tf.newValue({stringValue:n.value?.stringValue?.toUpperCase()});case"NULL":return Tf.gr();default:return Tf.mr()}}}class kC{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,28544);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"STRING":return Tf.newValue({stringValue:n.value?.stringValue?.trim()});case"NULL":return Tf.gr();default:return Tf.mr()}}}class LC{constructor(t){this.expr=t}evaluate(t,e){const n=this.expr.params.map(n=>Sf(n).evaluate(t,e));let s="",r=!1;for(const t of n)switch(t.type){case"STRING":s+=t.value.stringValue;break;case"NULL":r=!0;break;default:return Tf.mr()}return r?Tf.gr():Tf.newValue({stringValue:s})}}class FC{constructor(t){this.expr=t}evaluate(t,e){el(2===this.expr.params.length,4483);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"UNSET":return Tf.pr();case"MAP":break;default:return Tf.mr()}const s=Sf(this.expr.params[1]).evaluate(t,e);if("STRING"!==s.type)return Tf.mr();const r=n.value?.mapValue?.fields?.[s.value?.stringValue];return void 0===r?Tf.pr():Tf.newValue(r)}}class PC{constructor(t){this.expr=t}evaluate(t,e){el(2===this.expr.params.length,25231,`${this.expr.name}() function should have exactly 2 params`);let n=!1;const s=Sf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"VECTOR":break;case"NULL":n=!0;break;default:return Tf.mr()}const r=Sf(this.expr.params[1]).evaluate(t,e);switch(r.type){case"VECTOR":break;case"NULL":n=!0;break;default:return Tf.mr()}if(n)return Tf.gr();const i=Tu(s.value),o=Tu(r.value);if(void 0===i||void 0===o||i.values?.length!==o.values?.length)return Tf.mr();const a=this.Mr(i,o);return void 0===a||isNaN(a)?Tf.mr():Tf.newValue({doubleValue:a})}}class MC extends PC{Mr(t,e){const n=t?.values??[],s=e?.values??[];if(0===n.length)return;let r=0,i=0,o=0;for(let t=0;t<n.length;t++){if(!Eu(n[t])||!Eu(s[t]))return;const e=kf(n[t]),a=kf(s[t]);r+=e*a,i+=e*e,o+=a*a}const a=Math.sqrt(i)*Math.sqrt(o);return 0!==a?1-Math.max(-1,Math.min(1,r/a)):void 0}}class GC extends PC{Mr(t,e){const n=t?.values??[],s=e?.values??[];if(0===n.length)return 0;let r=0;for(let t=0;t<n.length;t++){if(!Eu(n[t])||!Eu(s[t]))return;r+=kf(n[t])*kf(s[t])}return r}}class HC extends PC{Mr(t,e){const n=t?.values??[],s=e?.values??[];if(0===n.length)return 0;let r=0;for(let t=0;t<n.length;t++){if(!Eu(n[t])||!Eu(s[t]))return;const e=kf(n[t]),i=kf(s[t]);r+=Math.pow(e-i,2)}return Math.sqrt(r)}}class UC{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,39044);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"VECTOR":{const t=Tu(n.value);return Tf.newValue({integerValue:t?.values?.length??0})}case"NULL":return Tf.gr();default:return Tf.mr()}}}const VC=BigInt(-62135596800),jC=BigInt(253402300799),$C=BigInt(1e3),JC=BigInt(1e6),qC=VC*$C,zC=jC*$C+BigInt(999),KC=VC*JC,QC=jC*JC+BigInt(999999);function WC(t){return t>=KC&&t<=QC}function YC(t){return t>=VC&&t<=jC}function XC(t,e){const n=BigInt(t);return!(n<VC||n>jC||e<0||e>=1e9||n===VC&&0!==e||n===jC&&e>999999999)}function ZC(t,e){return e<0?{seconds:t-1,nanos:e+1e9}:{seconds:t,nanos:e}}function tg(t){return BigInt(t.seconds)*JC+BigInt(Math.trunc(t.nanoseconds/1e3))}class eg{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,49262,`${this.expr.name}() function should have exactly one parameter`);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"INT":return this.toTimestamp(BigInt(n.value.integerValue));case"NULL":return Tf.gr();default:return Tf.mr()}}}class ng extends eg{toTimestamp(t){if(!WC(t))return Tf.mr();let e=Number(t/JC),n=Number(t%JC*BigInt(1e3));const s=ZC(e,n);return e=s.seconds,n=s.nanos,XC(e,n)?Tf.newValue({timestampValue:{seconds:e,nanos:n}}):Tf.mr()}}class sg extends eg{toTimestamp(t){if(!function(t){return t>=qC&&t<=zC}(t))return Tf.mr();let e=Number(t/$C),n=Number(t%$C*BigInt(1e6));const s=ZC(e,n);return e=s.seconds,n=s.nanos,XC(e,n)?Tf.newValue({timestampValue:{seconds:e,nanos:n}}):Tf.mr()}}class rg extends eg{toTimestamp(t){if(!YC(t))return Tf.mr();const e=Number(t);return Tf.newValue({timestampValue:{seconds:e,nanos:0}})}}class ig{constructor(t){this.expr=t}evaluate(t,e){el(1===this.expr.params.length,1265,`${this.expr.name}() function should have exactly one parameter`);const n=Sf(this.expr.params[0]).evaluate(t,e);switch(n.type){case"TIMESTAMP":break;case"NULL":return Tf.gr();default:return Tf.mr()}const s=fd(n.value.timestampValue);return XC(s.seconds,s.nanoseconds)?this.Nr(s):Tf.mr()}}class og extends ig{Nr(t){const e=tg(t);return WC(e)?Tf.newValue({integerValue:`${e.toString()}`}):Tf.mr()}}class ag extends ig{Nr(t){const e=tg(t),n=e/BigInt(1e3),s=e%BigInt(1e3);return n>BigInt(0)||s===BigInt(0)?Tf.newValue({integerValue:n.toString()}):Tf.newValue({integerValue:(n-BigInt(1)).toString()})}}class Bg extends ig{Nr(t){const e=BigInt(t.seconds);return YC(e)?Tf.newValue({integerValue:e.toString()}):Tf.mr()}}class cg{constructor(t){this.expr=t}evaluate(t,e){el(3===this.expr.params.length,2775,`${this.expr.name}() function should have exactly 3 parameters`);let n=!1;const s=Sf(this.expr.params[0]).evaluate(t,e);switch(s.type){case"TIMESTAMP":break;case"NULL":n=!0;break;default:return Tf.mr()}const r=Sf(this.expr.params[1]).evaluate(t,e);let i;switch(r.type){case"STRING":if(i=function(t){switch(t){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}}(r.value.stringValue),void 0===i)return Tf.mr();break;case"NULL":n=!0;break;default:return Tf.mr()}const o=Sf(this.expr.params[2]).evaluate(t,e);switch(o.type){case"INT":break;case"NULL":n=!0;break;default:return Tf.mr()}if(n)return Tf.gr();const a=BigInt(o.value.integerValue);let B;try{switch(i){case"microsecond":B=a;break;case"millisecond":B=a*BigInt(1e3);break;case"second":B=a*BigInt(1e6);break;case"minute":B=a*BigInt(6e7);break;case"hour":B=a*BigInt(36e8);break;case"day":B=a*BigInt(864e8);break;default:return Tf.mr()}if("microsecond"!==i&&a!==BigInt(0)&&B/a!==BigInt(this.Lr(i)))return Tf.mr()}catch(t){return Yc(`Error during timestamp arithmetic: ${t}`),Tf.mr()}const c=fd(s.value.timestampValue);if(!XC(c.seconds,c.nanoseconds))return Tf.mr();const l=tg(c),u=this.Br(l,B);if(!WC(u))return Tf.mr();const h=Number(u/JC),d=u%JC,p=Number((d<0?d+JC:d)*BigInt(1e3)),f=d<0?h-1:h;return XC(f,p)?Tf.newValue({timestampValue:{seconds:f,nanos:p}}):Tf.mr()}Lr(t){switch(t){case"millisecond":return 1e3;case"second":return 1e6;case"minute":return 6e7;case"hour":return 36e8;case"day":return 864e8;default:return 1}}}class lg extends cg{Br(t,e){return t+e}}class ug extends cg{Br(t,e){return t-e}}function hg(t){if((t=Af(t))instanceof Wp)return`fld(${t.fieldName})`;if(t instanceof Yp)return`cst(${function(t){return null===t?"null":"number"==typeof t?t.toString():"string"==typeof t?`"${t}"`:t instanceof Rp?`ref(${t.path})`:t instanceof kp?`vec(${JSON.stringify(t)})`:JSON.stringify(t)}(t.value)})`;if(t instanceof tf)return`fn(${t.name},[${t.params.map(hg).join(",")}])`;if("ListOfExpressions"===t.expressionType)return`list([${t.cr.map(hg).join(",")}])`;throw new Error(`Unrecognized expr ${JSON.stringify(t,null,2)}`)}function dg(t){return`${Array.from(t.entries()).sort().map(([t,e])=>`${t}=${hg(e)}`).join(",")}`}function pg(t){return t.stages.map(t=>function(t){if(t instanceof Bf)return`${t._name}(${dg(t.fields)})`;if(t instanceof cf){let e=`${t._name}(${dg(t.accumulators)})`;return t.groups.size>0&&(e+=`grouping(${dg(t.groups)})`),e}if(t instanceof lf)return`${t._name}(${dg(t.groups)})`;if(t instanceof uf)return`${t._name}(${t.hr})`;if(t instanceof hf)return`${t._name}(${t.collectionId})`;if(t instanceof df)return`${t._name}()`;if(t instanceof pf)return`${t._name}(${t.Tr.sort()})`;if(t instanceof ff)return`${t._name}(${hg(t.condition)})`;if(t instanceof Cf)return`${t._name}(${t.limit})`;if(t instanceof wf)return`${t._name}(${function(t){return t.map(t=>`${hg(t.expr)}${t.direction}`).join(",")}(t.orderings)})`;throw new Error(`Unrecognized stage ${t._name}`)}(t)).join("|")}function fg(t,e){return pg(t)===pg(e)}function Cg(t){return t instanceof _f}function gg(t){return Cg(t)?pg(t):zh(t)}function mg(t){return Cg(t)?pg(t):function(t){return`${Hh(Jh(t))}|lt:${t.limitType}`}(t)}function wg(t,e){return t instanceof _f&&e instanceof _f?fg(t,e):!(t instanceof _f&&!(e instanceof _f)||!(t instanceof _f)&&e instanceof _f)&&function(t,e){return Uh(Jh(t),Jh(e))&&t.limitType===e.limitType}(t,e)}function yg(t){return function(t){return!!t.isCorePipeline}(t)?pg(t):Hh(t)}function Eg(t,e){return t instanceof _f&&e instanceof _f?fg(t,e):!(t instanceof _f&&!(e instanceof _f)||!(t instanceof _f)&&e instanceof _f)&&Uh(t,e)}class _g{constructor(t,e,n,s){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=s}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const s=this.mutations[e];s.key.isEqual(t.key)&&eh(s,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=nh(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=nh(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=ad();return this.mutations.forEach(s=>{const r=t.get(s.key),i=r.overlayedDocument;let o=this.applyToLocalView(i,r.mutatedFields);o=e.has(s.key)?null:o;const a=th(i,o);null!==a&&n.set(s.key,a),i.isValidDocument()||i.convertToNoDocument(xh.min())}),n}keys(){return this.mutations.reduce((t,e)=>t.add(e.key),ud())}isEqual(t){return this.batchId===t.batchId&&ll(this.mutations,t.mutations,(t,e)=>rh(t,e))&&ll(this.baseMutations,t.baseMutations,(t,e)=>rh(t,e))}}class Dg{constructor(t,e,n,s){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=s}static from(t,e,n){el(t.mutations.length===n.length,58842,{Ur:t.mutations.length,kr:n.length});let s=cd;const r=t.mutations;for(let t=0;t<r.length;t++)s=s.insert(r[t].key,n[t].version);return new Dg(t,e,n,s)}}function bg(t,e){let n=e;const s=t.length;for(let e=0;e<s;e++){const s=t.charAt(e);switch(s){case"\0":n+="";break;case"":n+="";break;default:n+=s}}return n}function vg(t){return t+""}class Ig{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return null!==t&&this.mutation===t.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}class Tg{constructor(t){this.$r=t}}function Og(t){const e=bd({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?qh(e,e.limit,"L"):e}class Ag{constructor(){this.Zi=new Sg}addToCollectionParentIndex(t,e){return this.Zi.add(e),mp.resolve()}getCollectionParents(t,e){return mp.resolve(this.Zi.getEntries(e))}addFieldIndex(t,e){return mp.resolve()}deleteFieldIndex(t,e){return mp.resolve()}deleteAllFieldIndexes(t){return mp.resolve()}createTargetIndexes(t,e){return mp.resolve()}getDocumentsMatchingTarget(t,e){return mp.resolve(null)}getIndexType(t,e){return mp.resolve(0)}getFieldIndexes(t,e){return mp.resolve([])}getNextCollectionGroupToUpdate(t){return mp.resolve(null)}getMinOffset(t,e){return mp.resolve(Fh.min())}getMinOffsetFromCollectionGroup(t,e){return mp.resolve(Fh.min())}updateCollectionGroup(t,e,n){return mp.resolve()}updateIndexEntries(t,e){return mp.resolve()}}class Sg{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),s=this.index[e]||new pl(yl.comparator),r=!s.has(n);return this.index[e]=s.add(n),r}has(t){const e=t.lastSegment(),n=t.popLast(),s=this.index[e];return s&&s.has(n)}getEntries(t){return(this.index[t]||new pl(yl.comparator)).toArray()}}class Rg{constructor(t){this.ys=t}next(){return this.ys+=2,this.ys}static ws(){return new Rg(0)}static bs(){return new Rg(-1)}}function Ng(t,e){return function(t,e){let n=e;for(const e of t.stages)n=xg({serializer:t.serializer,serverTimestampBehavior:t.listenOptions?.serverTimestampBehavior},e,n);return n}(t,[e]).length>0}function xg(t,e,n){if(e instanceof uf)return function(t,e,n){return n.filter(t=>t.isFoundDocument()&&`/${t.key.getCollectionPath().canonicalString()}`===e.hr)}(0,e,n);if(e instanceof ff)return function(t,e,n){return n.filter(n=>{const s=Of(Sf(e.condition).evaluate(t,n));return void 0!==s&&uu(s,Bu)})}(t,e,n);if(e instanceof hf)return function(t,e,n){return n.filter(t=>t.isFoundDocument()&&t.key.getCollectionPath().lastSegment()===e.collectionId)}(0,e,n);if(e instanceof df)return function(t,e,n){return n.filter(t=>t.isFoundDocument())}(0,0,n);if(e instanceof pf)return function(t,e,n){return n.filter(t=>t.isFoundDocument()&&e.Pr.has(t.key.path.toStringWithLeadingSlash()))}(0,e,n);if(e instanceof Cf)return function(t,e,n){return n.slice(0,e.limit)}(0,e,n);if(e instanceof wf)return function(t,e,n){const s=e.orderings.map(t=>({Ms:Sf(t.expr),direction:t.direction}));return[...n].sort((e,n)=>{for(const{Ms:r,direction:i}of s){const s=Of(r.evaluate(t,e)),o=Of(r.evaluate(t,n)),a=du(s??au,o??au);if(0!==a)return"ascending"===i?a:-a}return 0})}(t,e,n);throw new Error(`Unknown stage: ${e._name}`)}class kg{constructor(){this.changes=new td(t=>t.toString(),(t,e)=>t.isEqual(e)),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,kh.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?mp.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}class Lg{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}class Fg{constructor(t,e,n,s){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=s}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next(s=>(n=s,this.remoteDocumentCache.getEntry(t,e))).next(t=>(null!==n&&nh(n.mutation,t,Dl.empty(),Fl.now()),t))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next(e=>this.getLocalViewOfDocuments(t,e,ud()).next(()=>e))}getLocalViewOfDocuments(t,e,n=ud()){const s=od();return this.populateOverlays(t,s,e).next(()=>this.computeViews(t,e,s,n).next(t=>{let e=rd();return t.forEach((t,n)=>{e=e.insert(t,n.overlayedDocument)}),e}))}getOverlayedDocuments(t,e){const n=od();return this.populateOverlays(t,n,e).next(()=>this.computeViews(t,e,n,ud()))}populateOverlays(t,e,n){const s=[];return n.forEach(t=>{e.has(t)||s.push(t)}),this.documentOverlayCache.getOverlays(t,s).next(t=>{t.forEach((t,n)=>{e.set(t,n)})})}computeViews(t,e,n,s){let r=nd();const i=Bd(),o=Bd();return e.forEach((t,e)=>{const o=n.get(e.key);s.has(e.key)&&(void 0===o||o.mutation instanceof oh)?r=r.insert(e.key,e):void 0!==o?(i.set(e.key,o.mutation.getFieldMask()),nh(o.mutation,e,o.mutation.getFieldMask(),Fl.now())):i.set(e.key,Dl.empty())}),this.recalculateAndSaveOverlays(t,r).next(t=>(t.forEach((t,e)=>i.set(t,e)),e.forEach((t,e)=>o.set(t,new Lg(e,i.get(t)??null))),o))}recalculateAndSaveOverlays(t,e){const n=Bd();let s=new ul((t,e)=>t-e),r=ud();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next(t=>{for(const r of t)r.keys().forEach(t=>{const i=e.get(t);if(null===i)return;let o=n.get(t)||Dl.empty();o=r.applyToLocalView(i,o),n.set(t,o);const a=(s.get(r.batchId)||ud()).add(t);s=s.insert(r.batchId,a)})}).next(()=>{const i=[],o=s.getReverseIterator();for(;o.hasNext();){const s=o.getNext(),a=s.key,B=s.value,c=ad();B.forEach(t=>{if(!r.has(t)){const s=th(e.get(t),n.get(t));null!==s&&c.set(t,s),r=r.add(t)}}),i.push(this.documentOverlayCache.saveOverlays(t,a,c))}return mp.waitFor(i)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next(e=>this.recalculateAndSaveOverlays(t,e))}getDocumentsMatchingQuery(t,e,n,s){return Cg(e)?this.getDocumentsMatchingPipeline(t,e,n,s):function(t){return Tl.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):function(t){return null!==t.collectionGroup}(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n,s):this.getDocumentsMatchingCollectionQuery(t,e,n,s)}getNextDocuments(t,e,n,s){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,s).next(r=>{const i=s-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,s-r.size):mp.resolve(od());let o=-1,a=r;return i.next(e=>mp.forEach(e,(e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),r.get(e)?mp.resolve():this.remoteDocumentCache.getEntry(t,e).next(t=>{a=a.insert(e,t)}))).next(()=>this.populateOverlays(t,e,r)).next(()=>this.computeViews(t,a,e,ud())).next(t=>({batchId:o,changes:id(t)})))})}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new Tl(e)).next(t=>{let e=rd();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e})}getDocumentsMatchingCollectionGroupQuery(t,e,n,s){const r=e.collectionGroup;let i=rd();return this.indexManager.getCollectionParents(t,r).next(o=>mp.forEach(o,o=>{const a=function(t,e){return new Vh(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,o.child(r));return this.getDocumentsMatchingCollectionQuery(t,a,n,s).next(t=>{t.forEach((t,e)=>{i=i.insert(t,e)})})}).next(()=>i))}getDocumentsMatchingCollectionQuery(t,e,n,s){let r;return this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId).next(i=>(r=i,this.remoteDocumentCache.getDocumentsMatchingQuery(t,e,n,r,s))).next(t=>this.retrieveMatchingLocalDocuments(r,t,t=>Kh(e,t)))}getDocumentsMatchingPipeline(t,e,n,s){if("collection_group"===Df(e)){const r=vf(e);let i=rd();return this.indexManager.getCollectionParents(t,r).next(o=>mp.forEach(o,o=>{const a=function(t,e){const n=t.stages.map(t=>t instanceof hf?new uf(e.canonicalString(),{}):t);return new _f(t.serializer,n)}(e,o.child(r));return this.getDocumentsMatchingPipeline(t,a,n,s).next(t=>{t.forEach((t,e)=>{i=i.insert(t,e)})})}).next(()=>i))}{let r;return this.getOverlaysForPipeline(t,e,n.largestBatchId).next(i=>{switch(r=i,Df(e)){case"collection":return this.remoteDocumentCache.getDocumentsMatchingQuery(t,e,n,r,s);case"documents":let i=ud();for(const t of If(e))i=i.add(Tl.fromPath(t));return this.remoteDocumentCache.getEntries(t,i);case"database":return this.remoteDocumentCache.getAllEntries(t);default:throw new gl("invalid-argument",`Invalid pipeline source to execute offline: ${pg(e)}`)}}).next(t=>this.retrieveMatchingLocalDocuments(r,t,t=>Ng(e,t)))}}retrieveMatchingLocalDocuments(t,e,n){t.forEach((t,n)=>{const s=n.getKey();null===e.get(s)&&(e=e.insert(s,kh.newInvalidDocument(s)))});let s=rd();return e.forEach((e,r)=>{const i=t.get(e);void 0!==i&&nh(i.mutation,r,Dl.empty(),Fl.now()),n(r)&&(s=s.insert(e,r))}),s}getOverlaysForPipeline(t,e,n){switch(Df(e)){case"collection":return this.documentOverlayCache.getOverlaysForCollection(t,yl.fromString(bf(e)),n);case"collection_group":throw new gl("invalid-argument",`Unexpected collection group pipeline: ${pg(e)}`);case"documents":return this.documentOverlayCache.getOverlays(t,If(e).map(t=>Tl.fromPath(t)));case"database":return this.documentOverlayCache.getAllOverlays(t,n);default:throw new gl("invalid-argument",`Failed to get overlays for pipeline: ${pg(e)}`)}}}class Pg{constructor(t){this.serializer=t,this.Qs=new Map,this.Ws=new Map}getBundleMetadata(t,e){return mp.resolve(this.Qs.get(e))}saveBundleMetadata(t,e){return this.Qs.set(e.id,function(t){return{id:t.id,version:t.version,createTime:md(t.createTime)}}(e)),mp.resolve()}getNamedQuery(t,e){return mp.resolve(this.Ws.get(e))}saveNamedQuery(t,e){return this.Ws.set(e.name,function(t){return{name:t.name,query:Og(t.bundledQuery),readTime:md(t.readTime)}}(e)),mp.resolve()}}class Mg{constructor(){this.overlays=new ul(Tl.comparator),this.Gs=new Map}getOverlay(t,e){return mp.resolve(this.overlays.get(e))}getOverlays(t,e){const n=od();return mp.forEach(e,e=>this.getOverlay(t,e).next(t=>{null!==t&&n.set(e,t)})).next(()=>n)}getAllOverlays(t,e){const n=od();return this.overlays.forEach((t,s)=>{s.largestBatchId>e&&n.set(t,s)}),mp.resolve(n)}saveOverlays(t,e,n){return n.forEach((n,s)=>{this.Zr(t,e,s)}),mp.resolve()}removeOverlaysForBatchId(t,e,n){const s=this.Gs.get(n);return void 0!==s&&(s.forEach(t=>this.overlays=this.overlays.remove(t)),this.Gs.delete(n)),mp.resolve()}getOverlaysForCollection(t,e,n){const s=od(),r=e.length+1,i=new Tl(e.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const t=o.getNext().value,i=t.getKey();if(!e.isPrefixOf(i.path))break;i.path.length===r&&t.largestBatchId>n&&s.set(t.getKey(),t)}return mp.resolve(s)}getOverlaysForCollectionGroup(t,e,n,s){let r=new ul((t,e)=>t-e);const i=this.overlays.getIterator();for(;i.hasNext();){const t=i.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=r.get(t.largestBatchId);null===e&&(e=od(),r=r.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=od(),a=r.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach((t,e)=>o.set(t,e)),!(o.size()>=s)););return mp.resolve(o)}Zr(t,e,n){const s=this.overlays.get(n.key);if(null!==s){const t=this.Gs.get(s.largestBatchId).delete(n.key);this.Gs.set(s.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new Ig(e,n));let r=this.Gs.get(e);void 0===r&&(r=ud(),this.Gs.set(e,r)),this.Gs.set(e,r.add(n.key))}}class Gg{constructor(){this.sessionToken=Ml.EMPTY_BYTE_STRING}getSessionToken(t){return mp.resolve(this.sessionToken)}setSessionToken(t,e){return this.sessionToken=e,mp.resolve()}}class Hg{constructor(){this.zs=new pl(Ug.js),this.Hs=new pl(Ug.Js)}isEmpty(){return this.zs.isEmpty()}addReference(t,e){const n=new Ug(t,e);this.zs=this.zs.add(n),this.Hs=this.Hs.add(n)}Ys(t,e){t.forEach(t=>this.addReference(t,e))}removeReference(t,e){this.Zs(new Ug(t,e))}Xs(t,e){t.forEach(t=>this.removeReference(t,e))}e_(t){const e=new Tl(new yl([])),n=new Ug(e,t),s=new Ug(e,t+1),r=[];return this.Hs.forEachInRange([n,s],t=>{this.Zs(t),r.push(t.key)}),r}t_(){this.zs.forEach(t=>this.Zs(t))}Zs(t){this.zs=this.zs.delete(t),this.Hs=this.Hs.delete(t)}n_(t){const e=new Tl(new yl([])),n=new Ug(e,t),s=new Ug(e,t+1);let r=ud();return this.Hs.forEachInRange([n,s],t=>{r=r.add(t.key)}),r}containsKey(t){const e=new Ug(t,0),n=this.zs.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Ug{constructor(t,e){this.key=t,this.r_=e}static js(t,e){return Tl.comparator(t.key,e.key)||il(t.r_,e.r_)}static Js(t,e){return il(t.r_,e.r_)||Tl.comparator(t.key,e.key)}}class Vg{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.Gr=1,this.i_=new pl(Ug.js)}checkEmpty(t){return mp.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,s){const r=this.Gr;this.Gr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new _g(r,e,n,s);this.mutationQueue.push(i);for(const e of s)this.i_=this.i_.add(new Ug(e.key,r)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return mp.resolve(i)}lookupMutationBatch(t,e){return mp.resolve(this.s_(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,s=this.__(n),r=s<0?0:s;return mp.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return mp.resolve(0===this.mutationQueue.length?-1:this.Gr-1)}getAllMutationBatches(t){return mp.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Ug(e,0),s=new Ug(e,Number.POSITIVE_INFINITY),r=[];return this.i_.forEachInRange([n,s],t=>{const e=this.s_(t.r_);r.push(e)}),mp.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new pl(il);return e.forEach(t=>{const e=new Ug(t,0),s=new Ug(t,Number.POSITIVE_INFINITY);this.i_.forEachInRange([e,s],t=>{n=n.add(t.r_)})}),mp.resolve(this.o_(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,s=n.length+1;let r=n;Tl.isDocumentKey(r)||(r=r.child(""));const i=new Ug(new Tl(r),0);let o=new pl(il);return this.i_.forEachWhile(t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===s&&(o=o.add(t.r_)),!0)},i),mp.resolve(this.o_(o))}o_(t){const e=[];return t.forEach(t=>{const n=this.s_(t);null!==n&&e.push(n)}),e}removeMutationBatch(t,e){el(0===this.a_(e.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.i_;return mp.forEach(e.mutations,s=>{const r=new Ug(s.key,e.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(t,s.key)}).next(()=>{this.i_=n})}Hr(t){}containsKey(t,e){const n=new Ug(e,0),s=this.i_.firstAfterOrEqual(n);return mp.resolve(e.isEqual(s&&s.key))}performConsistencyCheck(t){return this.mutationQueue.length,mp.resolve()}a_(t,e){return this.__(t)}__(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}s_(t){const e=this.__(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}class jg{constructor(t){this.u_=t,this.docs=new ul(Tl.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,s=this.docs.get(n),r=s?s.size:0,i=this.u_(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:i}),this.size+=i-r,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return mp.resolve(n?n.document.mutableCopy():kh.newInvalidDocument(e))}getEntries(t,e){let n=nd();return e.forEach(t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():kh.newInvalidDocument(t))}),mp.resolve(n)}getAllEntries(t){let e=nd();return this.docs.forEach((t,n)=>{e=e.insert(t,n.document)}),mp.resolve(e)}getDocumentsMatchingQuery(t,e,n,s){let r,i;Cg(e)?(r=yl.fromString(bf(e)),i=t=>Ng(e,t)):(r=e.path,i=t=>Kh(e,t));let o=nd();const a=new Tl(r.child("__id-9223372036854775808__")),B=this.docs.getIteratorFrom(a);for(;B.hasNext();){const{key:t,value:{document:e}}=B.getNext();if(!r.isPrefixOf(t.path))break;t.path.length>r.length+1||Ph(Lh(e),n)<=0||(s.has(e.key)||i(e))&&(o=o.insert(e.key,e.mutableCopy()))}return mp.resolve(o)}getAllFromCollectionGroup(t,e,n,s){Zc(9500)}c_(t,e){return mp.forEach(this.docs,t=>e(t))}newChangeBuffer(t){return new $g(this)}getSize(t){return mp.resolve(this.size)}}class $g extends kg{constructor(t){super(),this.$s=t}applyChanges(t){const e=[];return this.changes.forEach((n,s)=>{s.isValidDocument()?e.push(this.$s.addEntry(t,s)):this.$s.removeEntry(n)}),mp.waitFor(e)}getFromCache(t,e){return this.$s.getEntry(t,e)}getAllFromCache(t,e){return this.$s.getEntries(t,e)}}class Jg{constructor(t){this.persistence=t,this.l_=new td(t=>yg(t),Eg),this.lastRemoteSnapshotVersion=xh.min(),this.highestTargetId=0,this.E_=0,this.h_=new Hg,this.targetCount=0,this.T_=Rg.ws()}forEachTarget(t,e){return this.l_.forEach((t,n)=>e(n)),mp.resolve()}getLastRemoteSnapshotVersion(t){return mp.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return mp.resolve(this.E_)}allocateTargetId(t){return this.highestTargetId=this.T_.next(),mp.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.E_&&(this.E_=e),mp.resolve()}Ds(t){this.l_.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.T_=new Rg(e),this.highestTargetId=e),t.sequenceNumber>this.E_&&(this.E_=t.sequenceNumber)}addTargetData(t,e){return this.Ds(e),this.targetCount+=1,mp.resolve()}updateTargetData(t,e){return this.Ds(e),mp.resolve()}removeTargetData(t,e){return this.l_.delete(e.target),this.h_.e_(e.targetId),this.targetCount-=1,mp.resolve()}removeTargets(t,e,n){let s=0;const r=[];return this.l_.forEach((i,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.l_.delete(i),r.push(this.removeMatchingKeysForTargetId(t,o.targetId)),s++)}),mp.waitFor(r).next(()=>s)}getTargetCount(t){return mp.resolve(this.targetCount)}getTargetData(t,e){const n=this.l_.get(e)||null;return mp.resolve(n)}addMatchingKeys(t,e,n){return this.h_.Ys(e,n),mp.resolve()}removeMatchingKeys(t,e,n){this.h_.Xs(e,n);const s=this.persistence.referenceDelegate,r=[];return s&&e.forEach(e=>{r.push(s.markPotentiallyOrphaned(t,e))}),mp.waitFor(r)}removeMatchingKeysForTargetId(t,e){return this.h_.e_(e),mp.resolve()}getMatchingKeysForTargetId(t,e){const n=this.h_.n_(e);return mp.resolve(n)}containsKey(t,e){return mp.resolve(this.h_.containsKey(e))}}class qg{constructor(t,e){this.P_={},this.overlays={},this.I_=new fp(0),this.R_=!1,this.R_=!0,this.A_=new Gg,this.referenceDelegate=t(this),this.V_=new Jg(this),this.indexManager=new Ag,this.remoteDocumentCache=function(t){return new jg(t)}(t=>this.referenceDelegate.d_(t)),this.serializer=new Tg(e),this.f_=new Pg(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.R_=!1,Promise.resolve()}get started(){return this.R_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new Mg,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.P_[t.toKey()];return n||(n=new Vg(e,this.referenceDelegate),this.P_[t.toKey()]=n),n}getGlobalsCache(){return this.A_}getTargetCache(){return this.V_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.f_}runTransaction(t,e,n){Qc("MemoryPersistence","Starting transaction:",t);const s=new zg(this.I_.next());return this.referenceDelegate.m_(),n(s).next(t=>this.referenceDelegate.p_(s).next(()=>t)).toPromise().then(t=>(s.raiseOnCommittedEvent(),t))}g_(t,e){return mp.or(Object.values(this.P_).map(n=>()=>n.containsKey(t,e)))}}class zg extends Cp{constructor(t){super(),this.currentSequenceNumber=t}}class Kg{constructor(t){this.persistence=t,this.y_=new Hg,this.w_=null}static b_(t){return new Kg(t)}get S_(){if(this.w_)return this.w_;throw Zc(60996)}addReference(t,e,n){return this.y_.addReference(n,e),this.S_.delete(n.toString()),mp.resolve()}removeReference(t,e,n){return this.y_.removeReference(n,e),this.S_.add(n.toString()),mp.resolve()}markPotentiallyOrphaned(t,e){return this.S_.add(e.toString()),mp.resolve()}removeTarget(t,e){this.y_.e_(e.targetId).forEach(t=>this.S_.add(t.toString()));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next(t=>{t.forEach(t=>this.S_.add(t.toString()))}).next(()=>n.removeTargetData(t,e))}m_(){this.w_=new Set}p_(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return mp.forEach(this.S_,n=>{const s=Tl.fromPath(n);return this.v_(t,s).next(t=>{t||e.removeEntry(s,xh.min())})}).next(()=>(this.w_=null,e.apply(t)))}updateLimboDocument(t,e){return this.v_(t,e).next(t=>{t?this.S_.delete(e.toString()):this.S_.add(e.toString())})}d_(t){return 0}v_(t,e){return mp.or([()=>mp.resolve(this.y_.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.g_(t,e)])}}class Qg{constructor(t,e){this.persistence=t,this.D_=new td(t=>function(t){let e="";for(let n=0;n<t.length;n++)e.length>0&&(e=vg(e)),e=bg(t.get(n),e);return vg(e)}(t.path),(t,e)=>t.isEqual(e)),this.garbageCollector=function(t,e){return new bp(t,e)}(this,e)}static b_(t,e){return new Qg(t,e)}m_(){}p_(t){return mp.resolve()}forEachTarget(t,e){return this.persistence.getTargetCache().forEachTarget(t,e)}ir(t){const e=this.Cs(t);return this.persistence.getTargetCache().getTargetCount(t).next(t=>e.next(e=>t+e))}Cs(t){let e=0;return this.sr(t,t=>{e++}).next(()=>e)}sr(t,e){return mp.forEach(this.D_,(n,s)=>this.Os(t,n,s).next(t=>t?mp.resolve():e(s)))}removeTargets(t,e,n){return this.persistence.getTargetCache().removeTargets(t,e,n)}removeOrphanedDocuments(t,e){let n=0;const s=this.persistence.getRemoteDocumentCache(),r=s.newChangeBuffer();return s.c_(t,s=>this.Os(t,s,e).next(t=>{t||(n++,r.removeEntry(s,xh.min()))})).next(()=>r.apply(t)).next(()=>n)}markPotentiallyOrphaned(t,e){return this.D_.set(e,t.currentSequenceNumber),mp.resolve()}removeTarget(t,e){const n=e.withSequenceNumber(t.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(t,n)}addReference(t,e,n){return this.D_.set(n,t.currentSequenceNumber),mp.resolve()}removeReference(t,e,n){return this.D_.set(n,t.currentSequenceNumber),mp.resolve()}updateLimboDocument(t,e){return this.D_.set(e,t.currentSequenceNumber),mp.resolve()}d_(t){let e=t.key.toString().length;return t.isFoundDocument()&&(e+=mu(t.data.value)),e}Os(t,e,n){return mp.or([()=>this.persistence.g_(t,e),()=>this.persistence.getTargetCache().containsKey(t,e),()=>{const t=this.D_.get(e);return mp.resolve(void 0!==t&&t>n)}])}getCacheSize(t){return this.persistence.getRemoteDocumentCache().getSize(t)}}class Wg{constructor(t,e,n,s){this.targetId=t,this.fromCache=e,this.Vo=n,this.fo=s}static mo(t,e){let n=ud(),s=ud();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:s=s.add(t.doc.key)}return new Wg(t,e.fromCache,n,s)}}function Yg(t,e){return Tl.comparator(t.key,e.key)}class Xg{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(t){this._documentReadCount+=t}}class Zg{constructor(){this.po=!1,this.yo=!1,this.wo=100,this.bo=Mn()?8:function(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}(Fn())>0?6:4}initialize(t,e){this.So=t,this.indexManager=e,this.po=!0}getDocumentsMatchingQuery(t,e,n,s){const r={result:null};return this.vo(t,e).next(t=>{r.result=t}).next(()=>{if(!r.result)return this.Do(t,e,s,n).next(t=>{r.result=t})}).next(()=>{if(r.result)return;const n=new Xg;return this.xo(t,e,n).next(s=>{if(r.result=s,this.yo)return this.Co(t,e,n,s.size)})}).next(()=>r.result)}Co(t,e,n,s){return Cg(e)?mp.resolve():n.documentReadCount<this.wo?(Kc()<=is.DEBUG&&Qc("QueryEngine","SDK will not create cache indexes for query:",zh(e),"since it only creates cache indexes for collection contains","more than or equal to",this.wo,"documents"),mp.resolve()):(Kc()<=is.DEBUG&&Qc("QueryEngine","Query:",zh(e),"scans",n.documentReadCount,"local documents and returns",s,"documents as results."),n.documentReadCount>this.bo*s?(Kc()<=is.DEBUG&&Qc("QueryEngine","The SDK decides to create cache indexes for query:",zh(e),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(t,Jh(e))):mp.resolve())}vo(t,e){if(Cg(e))return mp.resolve(null);let n=e;if(jh(n))return mp.resolve(null);let s=Jh(n);return this.indexManager.getIndexType(t,s).next(e=>0===e?null:(null!==n.limit&&1===e&&(n=qh(n,null,"F"),s=Jh(n)),this.indexManager.getDocumentsMatchingTarget(t,s).next(e=>{const r=ud(...e);return this.So.getDocuments(t,r).next(e=>this.indexManager.getMinOffset(t,s).next(s=>{const i=this.Fo(n,e);return this.Oo(n,i,r,s.readTime)?this.vo(t,qh(n,null,"F")):this.Mo(t,i,n,s)}))})))}Do(t,e,n,s){return(Cg(e)?function(t){for(const e of t.stages){if(e instanceof Cf||e instanceof gf)return!1;if(e instanceof ff){if(e.condition instanceof nf&&"exists"===e.condition._expr.name&&e.condition._expr.params[0]instanceof Wp&&e.condition._expr.params[0].fieldName===ml)continue;return!1}}return!0}(e):jh(e))||s.isEqual(xh.min())?mp.resolve(null):this.So.getDocuments(t,n).next(r=>{const i=this.Fo(e,r);return this.Oo(e,i,n,s)?mp.resolve(null):(Kc()<=is.DEBUG&&Qc("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),gg(e)),this.Mo(t,i,e,function(t,e){const n=t.toTimestamp().seconds,s=t.toTimestamp().nanoseconds+1,r=xh.fromTimestamp(1e9===s?new Fl(n+1,0):new Fl(n,s));return new Fh(r,Tl.empty(),e)}(s,-1)).next(t=>t))})}Fo(t,e){let n,s;return Cg(t)?(n=new pl(Yg),s=e=>Ng(t,e)):(n=new pl(Qh(t)),s=e=>Kh(t,e)),e.forEach((t,e)=>{s(e)&&(n=n.add(e))}),n}Oo(t,e,n,s){if(Cg(t))return function(t){return t.stages.some(t=>t instanceof Cf||t instanceof gf)}(t);if(null===t.limit)return!1;if(n.size!==e.size)return!0;const r="F"===t.limitType?e.last():e.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(s)>0)}xo(t,e,n){return Kc()<=is.DEBUG&&Qc("QueryEngine","Using full collection scan to execute query:",gg(e)),this.So.getDocumentsMatchingQuery(t,e,Fh.min(),n)}Mo(t,e,n,s){return this.So.getDocumentsMatchingQuery(t,n,s).next(t=>(e.forEach(e=>{t=t.insert(e.key,e)}),t))}}class tm{constructor(t,e,n,s){this.persistence=t,this.No=e,this.serializer=s,this.Lo=new ul(il),this.Bo=new td(t=>yg(t),Eg),this.Uo=new Map,this.ko=t.getRemoteDocumentCache(),this.V_=t.getTargetCache(),this.f_=t.getBundleCache(),this.qo(n)}qo(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new Fg(this.ko,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ko.setIndexManager(this.indexManager),this.No.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",e=>t.collect(e,this.Lo))}}async function em(t,e){const n=nl(t);return await n.persistence.runTransaction("Handle user change","readonly",t=>{let s;return n.mutationQueue.getAllMutationBatches(t).next(r=>(s=r,n.qo(e),n.mutationQueue.getAllMutationBatches(t))).next(e=>{const r=[],i=[];let o=ud();for(const t of s){r.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next(t=>({$o:t,removedBatchIds:r,addedBatchIds:i}))})})}function nm(t,e){const n=nl(t);return n.persistence.runTransaction("Get next mutation batch","readonly",t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e)))}class sm{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.Yo=0,this.Zo=null,this.Xo=!0}ea(){0===this.Yo&&(this.ta("Unknown"),this.Zo=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.Zo=null,this.na("Backend didn't respond within 10 seconds."),this.ta("Offline"),Promise.resolve())))}ra(t){"Online"===this.state?this.ta("Unknown"):(this.Yo++,this.Yo>=1&&(this.ia(),this.na(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.ta("Offline")))}set(t){this.ia(),this.Yo=0,"Online"===t&&(this.Xo=!1),this.ta(t)}ta(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}na(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Xo?(Wc(e),this.Xo=!1):Qc("OnlineStateTracker",e)}ia(){null!==this.Zo&&(this.Zo.cancel(),this.Zo=null)}}const rm="RemoteStore";class im{constructor(t,e,n,s,r){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.sa=[],this._a=new Map,this.oa=new Map,this.aa=new Map,this.ua=new Rg(1e3),this.ca=new Rg(1001),this.la=new Set,this.Ea=[],this.ha=r,this.ha.Qe(t=>{n.enqueueAndForget(async()=>{Bm(this)&&(Qc(rm,"Restarting streams for network reachability change."),await async function(t){const e=nl(t);e.la.add(4),await am(e),e.Ta.set("Unknown"),e.la.delete(4),await om(e)}(this))})}),this.Ta=new sm(n,s)}}async function om(t){if(Bm(t))for(const e of t.Ea)await e(!0)}async function am(t){for(const e of t.Ea)await e(!1)}function Bm(t){return 0===nl(t).la.size}async function cm(t,e,n){if(!wp(e))throw e;t.la.add(1),await am(t),t.Ta.set("Offline"),n||(n=()=>function(t){const e=nl(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.V_.getLastRemoteSnapshotVersion(t))}(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{Qc(rm,"Retrying IndexedDB access"),await n(),t.la.delete(1),await om(t)})}function lm(t,e){return e().catch(n=>cm(t,n,e))}async function um(t){const e=nl(t),n=Em(e);let s=e.sa.length>0?e.sa[e.sa.length-1].batchId:-1;for(;hm(e);)try{const t=await nm(e.localStore,s);if(null===t){0===e.sa.length&&n.en();break}s=t.batchId,dm(e,t)}catch(t){await cm(e,t)}pm(e)&&fm(e)}function hm(t){return Bm(t)&&t.sa.length<10}function dm(t,e){t.sa.push(e);const n=Em(t);n.Yt()&&n.Rn&&n.An(e.mutations)}function pm(t){return Bm(t)&&!Em(t).Jt()&&t.sa.length>0}function fm(t){Em(t).start()}async function Cm(t){Em(t).fn()}async function gm(t){const e=Em(t);for(const n of t.sa)e.An(n.mutations)}async function mm(t,e,n){const s=t.sa.shift(),r=Dg.from(s,e,n);await lm(t,()=>t.remoteSyncer.applySuccessfulWrite(r)),await um(t)}async function wm(t,e){e&&Em(t).Rn&&await async function(t,e){if(function(t){return function(t){switch(t){case Cl.OK:return Zc(64938);case Cl.CANCELLED:case Cl.UNKNOWN:case Cl.DEADLINE_EXCEEDED:case Cl.RESOURCE_EXHAUSTED:case Cl.INTERNAL:case Cl.UNAVAILABLE:case Cl.UNAUTHENTICATED:return!1;case Cl.INVALID_ARGUMENT:case Cl.NOT_FOUND:case Cl.ALREADY_EXISTS:case Cl.PERMISSION_DENIED:case Cl.FAILED_PRECONDITION:case Cl.ABORTED:case Cl.OUT_OF_RANGE:case Cl.UNIMPLEMENTED:case Cl.DATA_LOSS:return!0;default:return Zc(15467,{code:t})}}(t)&&t!==Cl.ABORTED}(e.code)){const n=t.sa.shift();Em(t).Xt(),await lm(t,()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e)),await um(t)}}(t,e),pm(t)&&fm(t)}async function ym(t,e){const n=nl(t);n.asyncQueue.verifyOperationInProgress(),Qc(rm,"RemoteStore received new credentials");const s=Bm(n);n.la.add(3),await am(n),s&&n.Ta.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.la.delete(3),await om(n)}function Em(t){return t.Ra||(t.Ra=function(t,e,n){const s=nl(t);return s.pn(),new Bp(e,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,n)}(t.datastore,t.asyncQueue,{ct:()=>Promise.resolve(),Et:Cm.bind(null,t),Tt:wm.bind(null,t),Vn:gm.bind(null,t),dn:mm.bind(null,t)}),t.Ea.push(async e=>{e?(t.Ra.Xt(),await um(t)):(await t.Ra.stop(),t.sa.length>0&&(Qc(rm,`Stopping write stream with ${t.sa.length} pending writes`),t.sa=[]))})),t.Ra}class _m{constructor(t,e,n,s,r){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=s,this.removalCallback=r,this.deferred=new Pd,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(t=>{})}get promise(){return this.deferred.promise}static createAndSchedule(t,e,n,s,r){const i=Date.now()+n,o=new _m(t,e,i,s,r);return o.start(n),o}start(t){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new gl(Cl.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(t=>this.deferred.resolve(t))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Dm(t,e){if(Wc("AsyncQueue",`${e}: ${t}`),wp(t))return new gl(Cl.UNAVAILABLE,`${e}: ${t}`);throw t}class bm{constructor(){this.activeTargetIds=hd}Ba(t){this.activeTargetIds=this.activeTargetIds.add(t)}Ua(t){this.activeTargetIds=this.activeTargetIds.delete(t)}La(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class vm{constructor(){this.fu=new bm,this.mu={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t,e=!0){return e&&this.fu.Ba(t),this.mu[t]||"not-current"}updateQueryState(t,e,n){this.mu[t]=e}removeLocalQueryTarget(t){this.fu.Ua(t)}isLocalQueryTarget(t){return this.fu.activeTargetIds.has(t)}clearQueryState(t){delete this.mu[t]}getAllActiveQueryTargets(){return this.fu.activeTargetIds}isActiveQueryTarget(t){return this.fu.activeTargetIds.has(t)}start(){return this.fu=new bm,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}function Im(){return"undefined"!=typeof document?document:null}class Tm{constructor(){this.queries=Om(),this.onlineState="Unknown",this.Du=new Set}terminate(){!function(t,e){const n=nl(t),s=n.queries;n.queries=Om(),s.forEach((t,n)=>{for(const t of n.bu)t.onError(e)})}(this,new gl(Cl.ABORTED,"Firestore shutting down"))}}function Om(){return new td(t=>mg(t),wg)}var Am;!function(t){t.Default="default",t.Cache="cache"}(Am||(Am={}));class Sm{constructor(t,e,n,s,r,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=s,this.currentUser=r,this.maxConcurrentLimboResolutions=i,this.hc={},this.Tc=new td(t=>mg(t),wg),this.Pc=new Map,this.Ic=new Set,this.Rc=new ul(Tl.comparator),this.Ac=new Map,this.Vc=new Hg,this.dc={},this.fc=new Map,this.mc=Rg.bs(),this.onlineState="Unknown",this.gc=void 0}get isPrimaryClient(){return!0===this.gc}}async function Rm(t,e,n){const s=function(t){const e=nl(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=xm.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=km.bind(null,e),e}(t);try{const t=await function(t,e){const n=nl(t),s=Fl.now(),r=e.reduce((t,e)=>t.add(e.key),ud());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",t=>{let a=nd(),B=ud();return n.ko.getEntries(t,r).next(t=>{a=t,a.forEach((t,e)=>{e.isValidDocument()||(B=B.add(t))})}).next(()=>n.localDocuments.getOverlayedDocuments(t,a)).next(r=>{i=r;const o=[];for(const t of e){const e=sh(t,i.get(t.key).overlayedDocument);null!=e&&o.push(new oh(t.key,e,Su(e.value.mapValue),Yu.exists(!0)))}return n.mutationQueue.addMutationBatch(t,s,o,e)}).next(e=>{o=e;const s=e.applyToLocalDocumentSet(i,B);return n.documentOverlayCache.saveOverlays(t,e.batchId,s)})}).then(()=>({batchId:o.batchId,changes:id(i)}))}(s.localStore,e);s.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let s=t.dc[t.currentUser.toKey()];s||(s=new ul(il)),s=s.insert(e,n),t.dc[t.currentUser.toKey()]=s}(s,t.batchId,n),await Pm(s,t.changes),await um(s.remoteStore)}catch(t){const e=Dm(t,"Failed to persist write");n.reject(e)}}function Nm(t,e,n){const s=nl(t);if(s.isPrimaryClient&&0===n||!s.isPrimaryClient&&1===n){const t=[];s.Tc.forEach((n,s)=>{const r=s.view.xu(e);r.snapshot&&t.push(r.snapshot)}),function(t,e){const n=nl(t);n.onlineState=e;let s=!1;n.queries.forEach((t,n)=>{for(const t of n.bu)t.xu(e)&&(s=!0)}),s&&function(t){t.Du.forEach(t=>{t.next()})}(n)}(s.eventManager,e),t.length&&s.hc.Tn(t),s.onlineState=e,s.isPrimaryClient&&s.sharedClientState.setOnlineState(e)}}async function xm(t,e){const n=nl(t),s=e.batch.batchId;try{const t=await function(t,e){const n=nl(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",t=>{const s=e.batch.keys(),r=n.ko.newChangeBuffer({trackRemovals:!0});return function(t,e,n,s){const r=n.batch,i=r.keys();let o=mp.resolve();return i.forEach(t=>{o=o.next(()=>s.getEntry(e,t)).next(e=>{const i=n.docVersions.get(t);el(null!==i,48541),e.version.compareTo(i)<0&&(r.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),s.addEntry(e)))})}),o.next(()=>t.mutationQueue.removeMutationBatch(e,r))}(n,t,e,r).next(()=>r.apply(t)).next(()=>n.mutationQueue.performConsistencyCheck(t)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(t,s,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=ud();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e))).next(()=>n.localDocuments.getDocuments(t,s))})}(n.localStore,e);Fm(n,s,null),Lm(n,s),n.sharedClientState.updateMutationState(s,"acknowledged"),await Pm(n,t)}catch(t){await gp(t)}}async function km(t,e,n){const s=nl(t);try{const t=await function(t,e){const n=nl(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",t=>{let s;return n.mutationQueue.lookupMutationBatch(t,e).next(e=>(el(null!==e,37113),s=e.keys(),n.mutationQueue.removeMutationBatch(t,e))).next(()=>n.mutationQueue.performConsistencyCheck(t)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(t,s,e)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,s)).next(()=>n.localDocuments.getDocuments(t,s))})}(s.localStore,e);Fm(s,e,n),Lm(s,e),s.sharedClientState.updateMutationState(e,"rejected",n),await Pm(s,t)}catch(n){await gp(n)}}function Lm(t,e){(t.fc.get(e)||[]).forEach(t=>{t.resolve()}),t.fc.delete(e)}function Fm(t,e,n){const s=nl(t);let r=s.dc[s.currentUser.toKey()];if(r){const t=r.get(e);t&&(n?t.reject(n):t.resolve(),r=r.remove(e)),s.dc[s.currentUser.toKey()]=r}}async function Pm(t,e,n){const s=nl(t),r=[],i=[],o=[];s.Tc.isEmpty()||(s.Tc.forEach((t,a)=>{o.push(s.yc(a,e,n).then(t=>{if((t||n)&&s.isPrimaryClient){const e=t?!t.fromCache:n?.targetChanges.get(a.targetId)?.current;s.sharedClientState.updateQueryState(a.targetId,e?"current":"not-current")}if(t){r.push(t);const e=Wg.mo(a.targetId,t);i.push(e)}}))}),await Promise.all(o),s.hc.Tn(r),await async function(t,e){const n=nl(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",t=>mp.forEach(e,e=>mp.forEach(e.Vo,s=>n.persistence.referenceDelegate.addReference(t,e.targetId,s)).next(()=>mp.forEach(e.fo,s=>n.persistence.referenceDelegate.removeReference(t,e.targetId,s)))))}catch(t){if(!wp(t))throw t;Qc("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.Lo.get(e),s=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(s);n.Lo=n.Lo.insert(e,r)}}}(s.localStore,i))}async function Mm(t,e){const n=nl(t);if(!n.currentUser.isEqual(e)){Qc("SyncEngine","User change. New user:",e.toKey());const t=await em(n.localStore,e);n.currentUser=e,function(t,e){t.fc.forEach(t=>{t.forEach(t=>{t.reject(new gl(Cl.CANCELLED,e))})}),t.fc.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await Pm(n,t.$o)}}class Gm{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(t){this.serializer=Rd(t.databaseInfo.databaseId),this.sharedClientState=this.vc(t),this.persistence=this.Dc(t),await this.persistence.start(),this.localStore=this.xc(t),this.gcScheduler=this.Cc(t,this.localStore),this.indexBackfillerScheduler=this.Fc(t,this.localStore)}Cc(t,e){return null}Fc(t,e){return null}xc(t){return function(t,e,n,s){return new tm(t,e,n,s)}(this.persistence,new Zg,t.initialUser,this.serializer)}Dc(t){return new qg(Kg.b_,this.serializer)}vc(t){return new vm}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Gm.provider={build:()=>new Gm};class Hm extends Gm{constructor(t){super(),this.cacheSizeBytes=t}Cc(t,e){el(this.persistence.referenceDelegate instanceof Qg,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new Dp(n,t.asyncQueue,e)}Dc(t){const e=void 0!==this.cacheSizeBytes?pp.withCacheSize(this.cacheSizeBytes):pp.DEFAULT;return new qg(t=>Qg.b_(t,e),this.serializer)}}class Um{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>Nm(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Mm.bind(null,this.syncEngine),await async function(t,e){const n=nl(t);e?(n.la.delete(2),await om(n)):e||(n.la.add(2),await am(n),n.Ta.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Tm}createDatastore(t){const e=Rd(t.databaseInfo.databaseId),n=function(t){return new rp(t)}(t.databaseInfo);return function(t,e,n,s){return new lp(t,e,n,s)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return function(t,e,n,s,r){return new im(t,e,n,s,r)}(this.localStore,this.datastore,t.asyncQueue,t=>Nm(this.syncEngine,t,0),Qd.Ye()?new Qd:new zd)}createSyncEngine(t,e){return function(t,e,n,s,r,i,o){const a=new Sm(t,e,n,s,r,i);return o&&(a.gc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}async terminate(){await async function(t){const e=nl(t);Qc(rm,"RemoteStore shutting down."),e.la.add(5),await am(e),e.ha.shutdown(),e.Ta.set("Unknown")}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}Um.provider={build:()=>new Um};const Vm="FirestoreClient";class jm{constructor(t,e,n,s,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this._databaseInfo=s,this.user=Fd.UNAUTHENTICATED,this.clientId=rl.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=r,this.authCredentials.start(n,async t=>{Qc(Vm,"Received user=",t.uid),await this.authCredentialListener(t),this.user=t}),this.appCheckCredentials.start(n,t=>(Qc(Vm,"Received new app check token=",t),this.appCheckCredentialListener(t,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(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Pd;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=Dm(e,"Failed to shutdown persistence");t.reject(n)}}),t.promise}}async function $m(t,e){t.asyncQueue.verifyOperationInProgress(),Qc(Vm,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let s=n.initialUser;t.setCredentialChangeListener(async t=>{s.isEqual(t)||(await em(e.localStore,t),s=t)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function Jm(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){Qc(Vm,"Using user provided OfflineComponentProvider");try{await $m(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(t){return"FirebaseError"===t.name?t.code===Cl.FAILED_PRECONDITION||t.code===Cl.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code}(n))throw n;Yc("Error using user provided cache. Falling back to memory cache: "+n),await $m(t,new Gm)}}else Qc(Vm,"Using default OfflineComponentProvider"),await $m(t,new Hm(void 0));return t._offlineComponents}(t);Qc(Vm,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(t=>ym(e.remoteStore,t)),t.setAppCheckTokenChangeListener((t,n)=>ym(e.remoteStore,n)),t._onlineComponents=e}function qm(t){return async function(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(Qc(Vm,"Using user provided OnlineComponentProvider"),await Jm(t,t._uninitializedComponentsProvider._online)):(Qc(Vm,"Using default OnlineComponentProvider"),await Jm(t,new Um))),t._onlineComponents}(t).then(t=>t.syncEngine)}let zm=class{constructor(t,e,n,s,r){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=s,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new Rp(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new Km(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(t){if(this._document){const e=this._document.data.field(Mp("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}},Km=class extends zm{data(){return super.data()}};const Qm="AsyncQueue";class Wm{constructor(t=Promise.resolve()){this.$c=[],this.Kc=!1,this.Qc=[],this.Wc=null,this.Gc=!1,this.zc=!1,this.jc=[],this.Ht=new ip(this,"async_queue_retry"),this.Hc=()=>{const t=Im();t&&Qc(Qm,"Visibility state changed to "+t.visibilityState),this.Ht.$t()},this.Jc=t;const e=Im();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.Hc)}get isShuttingDown(){return this.Kc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.Yc(),this.Zc(t)}enterRestrictedMode(t){if(!this.Kc){this.Kc=!0,this.zc=t||!1;const e=Im();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Hc)}}enqueue(t){if(this.Yc(),this.Kc)return new Promise(()=>{});const e=new Pd;return this.Zc(()=>this.Kc&&this.zc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise)).then(()=>e.promise)}enqueueRetryable(t){this.enqueueAndForget(()=>(this.$c.push(t),this.Xc()))}async Xc(){if(0!==this.$c.length){try{await this.$c[0](),this.$c.shift(),this.Ht.reset()}catch(t){if(!wp(t))throw t;Qc(Qm,"Operation failed with retryable error: "+t)}this.$c.length>0&&this.Ht.kt(()=>this.Xc())}}Zc(t){const e=this.Jc.then(()=>(this.Gc=!0,t().catch(t=>{throw this.Wc=t,this.Gc=!1,Wc("INTERNAL UNHANDLED ERROR: ",Ym(t)),t}).then(t=>(this.Gc=!1,t))));return this.Jc=e,e}enqueueAfterDelay(t,e,n){this.Yc(),this.jc.indexOf(t)>-1&&(e=0);const s=_m.createAndSchedule(this,t,e,n,t=>this.el(t));return this.Qc.push(s),s}Yc(){this.Wc&&Zc(47125,{tl:Ym(this.Wc)})}verifyOperationInProgress(){}async nl(){let t;do{t=this.Jc,await t}while(t!==this.Jc)}rl(t){for(const e of this.Qc)if(e.timerId===t)return!0;return!1}il(t){return this.nl().then(()=>{this.Qc.sort((t,e)=>t.targetTimeMs-e.targetTimeMs);for(const e of this.Qc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.nl()})}sl(t){this.jc.push(t)}el(t){const e=this.Qc.indexOf(t);this.Qc.splice(e,1)}}function Ym(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}class Xm extends Op{constructor(t,e,n,s){super(t,e,n,s),this.type="firestore",this._queue=new Wm,this._persistenceKey=s?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const t=this._firestoreClient.terminate();this._queue=new Wm(t),this._firestoreClient=void 0,await t}}}function Zm(t){if(t._terminated)throw new gl(Cl.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||function(t){const e=t._freezeSettings(),n=function(t,e,n,s,r){return new Wl(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,qd(r.experimentalLongPollingOptions),r.useFetchStreams,r.isUsingEmulator,s,r._customHeaders,r.grpcFlowControlWindow)}(t._databaseId,t._app?.options.appId||"",t._persistenceKey,t._app?.options.apiKey,e);t._componentsProvider||e.localCache?._offlineComponentProvider&&e.localCache?._onlineComponentProvider&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new jm(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(t){const e=t?._online.build();return{_offline:t?._offline.build(e),_online:e}}(t._componentsProvider))}(t),t._firestoreClient}class tw{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class ew extends zm{constructor(t,e,n,s,r,i){super(t,e,n,s,i),this._firestore=t,this._firestoreImpl=t,this.metadata=r}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new nw(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(Mp("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new gl(Cl.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t=this._document,e={};return e.type=ew._jsonSchemaVersion,e.bundle="",e.bundleSource="DocumentSnapshot",e.bundleName=this._key.toString(),t&&t.isValidDocument()&&t.isFoundDocument()?(this._userDataWriter.convertObjectMap(t.data.value.mapValue.fields,"previous"),e.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),e):e}}ew._jsonSchemaVersion="firestore/documentSnapshot/1.0",ew._jsonSchema={type:Nl("string",ew._jsonSchemaVersion),bundleSource:Nl("string","DocumentSnapshot"),bundleName:Nl("string"),bundle:Nl("string")};class nw extends ew{data(t={}){return super.data(t)}}class sw{constructor(t,e,n,s){this._firestore=t,this._userDataWriter=e,this._snapshot=s,this.metadata=new tw(s.hasPendingWrites,s.fromCache),this.query=n}get docs(){const t=[];return this.forEach(e=>t.push(e)),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach(n=>{t.call(e,new nw(this._firestore,this._userDataWriter,n.key,n,new tw(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new gl(Cl.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map(n=>{Cg(t._snapshot.query)?function(t){const e=function(t){for(let e=t.stages.length-1;e>=0;e--){const n=t.stages[e];if(n instanceof wf)return n.orderings}throw new Error("Pipeline must contain at least one Sort stage")}(t)}(t._snapshot.query):Qh(t.query._query);const s=new nw(t._firestore,t._userDataWriter,n.doc.key,n.doc,new tw(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:s,oldIndex:-1,newIndex:e++}})}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter(t=>e||3!==t.type).map(e=>{const s=new nw(t._firestore,t._userDataWriter,e.doc.key,e.doc,new tw(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let r=-1,i=-1;return 0!==e.type&&(r=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:rw(e.type),doc:s,oldIndex:r,newIndex:i}})}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new gl(Cl.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t={};t.type=sw._jsonSchemaVersion,t.bundleSource="QuerySnapshot",t.bundleName=rl.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const e=[],n=[],s=[];return this.docs.forEach(t=>{null!==t._document&&(e.push(t._document),n.push(this._userDataWriter.convertObjectMap(t._document.data.value.mapValue.fields,"previous")),s.push(t.ref.path))}),t.bundle=(this._firestore,this.query._query,t.bundleName,"NOT SUPPORTED"),t}}function rw(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Zc(61501,{type:t})}}function iw(t){return function(t,e){const n=Zm(t);return function(t,e){const n=new Pd;return t.asyncQueue.enqueueAndForget(async()=>Rm(await qm(t),e,n)),n.promise}(n,e)}(Rl(t.firestore,Xm),[new lh(t._key,Yu.none())])}sw._jsonSchemaVersion="firestore/querySnapshot/1.0",sw._jsonSchema={type:Nl("string",sw._jsonSchemaVersion),bundleSource:Nl("string","QuerySnapshot"),bundleName:Nl("string"),bundle:Nl("string")};const ow="@firebase/firestore",aw="4.17.2";!function(t,e=!0){(function(t){qc=t})(fr),lr(new es("firestore",(t,{instanceIdentifier:n,options:s})=>{const r=t.getProvider("app").getImmediate(),i=new Xm(new Ud(t.getProvider("auth-internal")),new Jd(r,t.getProvider("app-check-internal")),Zl(r,n),r);return s={useFetchStreams:e,...s},i._setSettings(s),i},"PUBLIC").setMultipleInstances(!0)),mr(ow,aw,t),mr(ow,aw,"esm2020")}();const Bw="firebasestorage.googleapis.com",cw="storageBucket";class lw extends Vn{constructor(t,e,n=0){super(dw(t),`Firebase Storage: ${e} (${dw(t)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,lw.prototype)}get status(){return this.status_}set status(t){this.status_=t}_codeEquals(t){return dw(t)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(t){this.customData.serverResponse=t,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}}var uw,hw;function dw(t){return"storage/"+t}function pw(){return new lw(uw.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function fw(){return new lw(uw.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function Cw(){return new lw(uw.CANCELED,"User canceled the upload/download.")}function gw(){return new lw(uw.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function mw(t){return new lw(uw.INVALID_ARGUMENT,t)}function ww(){return new lw(uw.APP_DELETED,"The Firebase app was deleted.")}function yw(t,e){return new lw(uw.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function Ew(t){throw new lw(uw.INTERNAL_ERROR,"Internal error: "+t)}!function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"}(uw||(uw={}));class _w{constructor(t,e){this.bucket=t,this.path_=e}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(t,e){let n;try{n=_w.makeFromUrl(t,e)}catch(e){return new _w(t,"")}if(""===n.path)return n;throw s=t,new lw(uw.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+s+"'.");var s}static makeFromUrl(t,e){let n=null;const s="([A-Za-z0-9.\\-_]+)";const r=new RegExp("^gs://"+s+"(/(.*))?$","i");function i(t){t.path_=decodeURIComponent(t.path)}const o=e.replace(/[.]/g,"\\."),a=[{regex:r,indices:{bucket:1,path:3},postModify:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path_=t.path_.slice(0,-1))}},{regex:new RegExp(`^https?://${o}/v[A-Za-z0-9_]+/b/${s}/o(/([^?#]*).*)?$`,"i"),indices:{bucket:1,path:3},postModify:i},{regex:new RegExp(`^https?://${e===Bw?"(?:storage.googleapis.com|storage.cloud.google.com)":e}/${s}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:i}];for(let e=0;e<a.length;e++){const s=a[e],r=s.regex.exec(t);if(r){const t=r[s.indices.bucket];let e=r[s.indices.path];e||(e=""),n=new _w(t,e),s.postModify(n);break}}if(null==n)throw function(t){return new lw(uw.INVALID_URL,"Invalid URL '"+t+"'.")}(t);return n}}class Dw{constructor(t){this.promise_=Promise.reject(t)}getPromise(){return this.promise_}cancel(t=!1){}}function bw(t){return"string"==typeof t||t instanceof String}function vw(t){return Iw()&&t instanceof Blob}function Iw(){return"undefined"!=typeof Blob}function Tw(t,e,n,s){if(s<e)throw mw(`Invalid value for '${t}'. Expected ${e} or greater.`);if(s>n)throw mw(`Invalid value for '${t}'. Expected ${n} or less.`)}function Ow(t,e,n){let s=e;return null==n&&(s=`https://${e}`),`${n}://${s}/v0${t}`}function Aw(t){const e=encodeURIComponent;let n="?";for(const s in t)if(t.hasOwnProperty(s)){n=n+(e(s)+"="+e(t[s]))+"&"}return n=n.slice(0,-1),n}function Sw(t,e){const n=t>=500&&t<600,s=-1!==[408,429].indexOf(t),r=-1!==e.indexOf(t);return n||s||r}!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(hw||(hw={}));class Rw{constructor(t,e,n,s,r,i,o,a,B,c,l,u=!0,h=!1){this.url_=t,this.method_=e,this.headers_=n,this.body_=s,this.successCodes_=r,this.additionalRetryCodes_=i,this.callback_=o,this.errorCallback_=a,this.timeout_=B,this.progressCallback_=c,this.connectionFactory_=l,this.retry=u,this.isUsingEmulator=h,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((t,e)=>{this.resolve_=t,this.reject_=e,this.start_()})}start_(){const t=(t,e)=>{if(e)return void t(!1,new Nw(!1,null,!0));const n=this.connectionFactory_();this.pendingConnection_=n;const s=t=>{const e=t.loaded,n=t.lengthComputable?t.total:-1;null!==this.progressCallback_&&this.progressCallback_(e,n)};null!==this.progressCallback_&&n.addUploadProgressListener(s),n.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(s),this.pendingConnection_=null;const e=n.getErrorCode()===hw.NO_ERROR,r=n.getStatus();if(!e||Sw(r,this.additionalRetryCodes_)&&this.retry){const e=n.getErrorCode()===hw.ABORT;return void t(!1,new Nw(!1,null,e))}const i=-1!==this.successCodes_.indexOf(r);t(!0,new Nw(i,n))})},e=(t,e)=>{const n=this.resolve_,s=this.reject_,r=e.connection;if(e.wasSuccessCode)try{const t=this.callback_(r,r.getResponse());!function(t){return void 0!==t}(t)?n():n(t)}catch(t){s(t)}else if(null!==r){const t=pw();t.serverResponse=r.getErrorText(),this.errorCallback_?s(this.errorCallback_(r,t)):s(t)}else if(e.canceled){s(this.appDelete_?ww():Cw())}else{s(fw())}};this.canceled_?e(0,new Nw(!1,null,!0)):this.backoffId_=function(t,e,n){let s=1,r=null,i=null,o=!1,a=0;function B(){return 2===a}let c=!1;function l(...t){c||(c=!0,e.apply(null,t))}function u(e){r=setTimeout(()=>{r=null,t(d,B())},e)}function h(){i&&clearTimeout(i)}function d(t,...e){if(c)return void h();if(t)return h(),void l.call(null,t,...e);if(B()||o)return h(),void l.call(null,t,...e);let n;s<64&&(s*=2),1===a?(a=2,n=0):n=1e3*(s+Math.random()),u(n)}let p=!1;function f(t){p||(p=!0,h(),c||(null!==r?(t||(a=2),clearTimeout(r),u(0)):t||(a=1)))}return u(0),i=setTimeout(()=>{o=!0,f(!0)},n),f}(t,e,this.timeout_)}getPromise(){return this.promise_}cancel(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class Nw{constructor(t,e,n){this.wasSuccessCode=t,this.connection=e,this.canceled=!!n}}function xw(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function kw(...t){const e=xw();if(void 0!==e){const n=new e;for(let e=0;e<t.length;e++)n.append(t[e]);return n.getBlob()}if(Iw())return new Blob(t);throw new lw(uw.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}function Lw(t){if("undefined"==typeof atob)throw e="base-64",new lw(uw.UNSUPPORTED_ENVIRONMENT,`${e} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);var e;return atob(t)}const Fw="raw",Pw="base64",Mw="base64url",Gw="data_url";class Hw{constructor(t,e){this.data=t,this.contentType=e||null}}function Uw(t,e){switch(t){case Fw:return new Hw(Vw(e));case Pw:case Mw:return new Hw(jw(t,e));case Gw:return new Hw(function(t){const e=new $w(t);return e.base64?jw(Pw,e.rest):function(t){let e;try{e=decodeURIComponent(t)}catch(t){throw yw(Gw,"Malformed data URL.")}return Vw(e)}(e.rest)}(e),new $w(e).contentType)}throw pw()}function Vw(t){const e=[];for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);if(s<=127)e.push(s);else if(s<=2047)e.push(192|s>>6,128|63&s);else if(55296==(64512&s)){if(n<t.length-1&&56320==(64512&t.charCodeAt(n+1))){s=65536|(1023&s)<<10|1023&t.charCodeAt(++n),e.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|63&s)}else e.push(239,191,189)}else 56320==(64512&s)?e.push(239,191,189):e.push(224|s>>12,128|s>>6&63,128|63&s)}return new Uint8Array(e)}function jw(t,e){switch(t){case Pw:{const n=-1!==e.indexOf("-"),s=-1!==e.indexOf("_");if(n||s){throw yw(t,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?")}break}case Mw:{const n=-1!==e.indexOf("+"),s=-1!==e.indexOf("/");if(n||s){throw yw(t,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?")}e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=Lw(e)}catch(e){if(e.message.includes("polyfill"))throw e;throw yw(t,"Invalid character found")}const s=new Uint8Array(n.length);for(let t=0;t<n.length;t++)s[t]=n.charCodeAt(t);return s}class $w{constructor(t){this.base64=!1,this.contentType=null;const e=t.match(/^data:([^,]+)?,/);if(null===e)throw yw(Gw,"Must be formatted 'data:[<mediatype>][;base64],<data>");const n=e[1]||null;null!=n&&(this.base64=function(t,e){const n=t.length>=e.length;if(!n)return!1;return t.substring(t.length-e.length)===e}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=t.substring(t.indexOf(",")+1)}}class Jw{constructor(t,e){let n=0,s="";vw(t)?(this.data_=t,n=t.size,s=t.type):t instanceof ArrayBuffer?(e?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),n=this.data_.length):t instanceof Uint8Array&&(e?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),n=t.length),this.size_=n,this.type_=s}size(){return this.size_}type(){return this.type_}slice(t,e){if(vw(this.data_)){const n=function(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}(this.data_,t,e);return null===n?null:new Jw(n)}{const n=new Uint8Array(this.data_.buffer,t,e-t);return new Jw(n,!0)}}static getBlob(...t){if(Iw()){const e=t.map(t=>t instanceof Jw?t.data_:t);return new Jw(kw.apply(null,e))}{const e=t.map(t=>bw(t)?Uw(Fw,t).data:t.data_);let n=0;e.forEach(t=>{n+=t.byteLength});const s=new Uint8Array(n);let r=0;return e.forEach(t=>{for(let e=0;e<t.length;e++)s[r++]=t[e]}),new Jw(s,!0)}}uploadData(){return this.data_}}function qw(t){let e;try{e=JSON.parse(t)}catch(t){return null}return function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?e:null}function zw(t){const e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function Kw(t,e){return e}class Qw{constructor(t,e,n,s){this.server=t,this.local=e||t,this.writable=!!n,this.xform=s||Kw}}let Ww=null;function Yw(){if(Ww)return Ww;const t=[];t.push(new Qw("bucket")),t.push(new Qw("generation")),t.push(new Qw("metageneration")),t.push(new Qw("name","fullPath",!0));const e=new Qw("name");e.xform=function(t,e){return function(t){return!bw(t)||t.length<2?t:zw(t)}(e)},t.push(e);const n=new Qw("size");return n.xform=function(t,e){return void 0!==e?Number(e):e},t.push(n),t.push(new Qw("timeCreated")),t.push(new Qw("updated")),t.push(new Qw("md5Hash",null,!0)),t.push(new Qw("cacheControl",null,!0)),t.push(new Qw("contentDisposition",null,!0)),t.push(new Qw("contentEncoding",null,!0)),t.push(new Qw("contentLanguage",null,!0)),t.push(new Qw("contentType",null,!0)),t.push(new Qw("metadata","customMetadata",!0)),Ww=t,Ww}function Xw(t,e,n){const s={type:"file"},r=n.length;for(let t=0;t<r;t++){const r=n[t];s[r.local]=r.xform(s,e[r.server])}return function(t,e){Object.defineProperty(t,"ref",{get:function(){const n=t.bucket,s=t.fullPath,r=new _w(n,s);return e._makeStorageReference(r)}})}(s,t),s}function Zw(t,e,n){const s=qw(e);if(null===s)return null;return Xw(t,s,n)}function ty(t,e){const n={},s=e.length;for(let r=0;r<s;r++){const s=e[r];s.writable&&(n[s.server]=t[s.local])}return JSON.stringify(n)}const ey="prefixes",ny="items";function sy(t,e,n){const s=qw(n);if(null===s)return null;return function(t,e,n){const s={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n[ey])for(const r of n[ey]){const n=r.replace(/\/$/,""),i=t._makeStorageReference(new _w(e,n));s.prefixes.push(i)}if(n[ny])for(const r of n[ny]){const n=t._makeStorageReference(new _w(e,r.name));s.items.push(n)}return s}(t,e,s)}class ry{constructor(t,e,n,s){this.url=t,this.method=e,this.handler=n,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function iy(t){if(!t)throw pw()}function oy(t,e){return function(n,s){const r=Zw(t,s,e);return iy(null!==r),r}}function ay(t,e){return function(n,s){const r=Zw(t,s,e);return iy(null!==r),function(t,e,n,s){const r=qw(e);if(null===r)return null;if(!bw(r.downloadTokens))return null;const i=r.downloadTokens;if(0===i.length)return null;const o=encodeURIComponent;return i.split(",").map(e=>{const r=t.bucket,i=t.fullPath;return Ow("/b/"+o(r)+"/o/"+o(i),n,s)+Aw({alt:"media",token:e})})[0]}(r,s,t.host,t._protocol)}}function By(t){return function(e,n){let s;var r,i;return 401===e.getStatus()?s=e.getErrorText().includes("Firebase App Check token is invalid")?new lw(uw.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new lw(uw.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===e.getStatus()?(i=t.bucket,s=new lw(uw.QUOTA_EXCEEDED,"Quota for bucket '"+i+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===e.getStatus()?(r=t.path,s=new lw(uw.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):s=n,s.status=e.getStatus(),s.serverResponse=n.serverResponse,s}}function cy(t){const e=By(t);return function(n,s){let r=e(n,s);var i;return 404===n.getStatus()&&(i=t.path,r=new lw(uw.OBJECT_NOT_FOUND,"Object '"+i+"' does not exist.")),r.serverResponse=s.serverResponse,r}}function ly(t,e,n,s,r){const i={};e.isRoot?i.prefix="":i.prefix=e.path+"/",n.length>0&&(i.delimiter=n),s&&(i.pageToken=s),r&&(i.maxResults=r);const o=Ow(e.bucketOnlyServerUrl(),t.host,t._protocol),a=t.maxOperationRetryTime,B=new ry(o,"GET",function(t,e){return function(n,s){const r=sy(t,e,s);return iy(null!==r),r}}(t,e.bucket),a);return B.urlParams=i,B.errorHandler=By(e),B}function uy(t,e,n){const s=Object.assign({},n);return s.fullPath=t.path,s.size=e.size(),s.contentType||(s.contentType=function(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}(null,e)),s}class hy{constructor(t,e,n,s){this.current=t,this.total=e,this.finalized=!!n,this.metadata=s||null}}function dy(t,e){let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){iy(!1)}return iy(!!n&&-1!==(e||["active"]).indexOf(n)),n}const py=262144;function fy(t,e,n,s,r,i,o,a){const B=new hy(0,0);if(o?(B.current=o.current,B.total=o.total):(B.current=0,B.total=s.size()),s.size()!==B.total)throw new lw(uw.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");const c=B.total-B.current;let l=c;r>0&&(l=Math.min(l,r));const u=B.current,h=u+l;let d="";d=0===l?"finalize":c===l?"upload, finalize":"upload";const p={"X-Goog-Upload-Command":d,"X-Goog-Upload-Offset":`${B.current}`},f=s.slice(u,h);if(null===f)throw gw();const C=e.maxUploadRetryTime,g=new ry(n,"POST",function(t,n){const r=dy(t,["active","final"]),o=B.current+l,a=s.size();let c;return c="final"===r?oy(e,i)(t,n):null,new hy(o,a,"final"===r,c)},C);return g.headers=p,g.body=f.uploadData(),g.progressCallback=a||null,g.errorHandler=By(t),g}const Cy="running",gy="paused",my="success",wy="canceled",yy="error";function Ey(t){switch(t){case"running":case"pausing":case"canceling":return Cy;case"paused":return gy;case"success":return my;case"canceled":return wy;default:return yy}}class _y{constructor(t,e,n){const s=function(t){return"function"==typeof t}(t)||null!=e||null!=n;if(s)this.next=t,this.error=e??void 0,this.complete=n??void 0;else{const e=t;this.next=e.next,this.error=e.error,this.complete=e.complete}}}function Dy(t){return(...e)=>{Promise.resolve().then(()=>t(...e))}}class by{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=hw.NO_ERROR,this.sendPromise_=new Promise(t=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=hw.ABORT,t()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=hw.NETWORK_ERROR,t()}),this.xhr_.addEventListener("load",()=>{t()})})}send(t,e,n,s,r){if(this.sent_)throw Ew("cannot .send() more than once");if(Zn(t)&&n&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(e,t,!0),void 0!==r)for(const t in r)r.hasOwnProperty(t)&&this.xhr_.setRequestHeader(t,r[t].toString());return void 0!==s?this.xhr_.send(s):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Ew("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Ew("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}}getResponse(){if(!this.sent_)throw Ew("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Ew("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(t){return this.xhr_.getResponseHeader(t)}addUploadProgressListener(t){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",t)}removeUploadProgressListener(t){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",t)}}class vy extends by{initXhr(){this.xhr_.responseType="text"}}function Iy(){return new vy}class Ty{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(t,e,n=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=t,this._blob=e,this._metadata=n,this._mappings=Yw(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=t=>{if(this._request=void 0,this._chunkMultiplier=1,t._codeEquals(uw.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const e=this.isExponentialBackoffExpired();if(Sw(t.status,[])){if(!e)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();t=fw()}this._error=t,this._transition("error")}},this._metadataErrorHandler=t=>{this._request=void 0,t._codeEquals(uw.CANCELED)?this.completeTransitions_():(this._error=t,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((t,e)=>{this._resolve=t,this._reject=e,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){const t=this._transferred;return e=>this._updateProgress(t+e)}_shouldDoResumable(t){return t.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(t){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([e,n])=>{switch(this._state){case"running":t(e,n);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}})}_createResumable(){this._resolveToken((t,e)=>{const n=function(t,e,n,s,r){const i=e.bucketOnlyServerUrl(),o=uy(e,s,r),a={name:o.fullPath},B=Ow(i,t.host,t._protocol),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${s.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},l=ty(o,n),u=t.maxUploadRetryTime,h=new ry(B,"POST",function(t){let e;dy(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){iy(!1)}return iy(bw(e)),e},u);return h.urlParams=a,h.headers=c,h.body=l,h.errorHandler=By(e),h}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(n,Iy,t,e);this._request=s,s.getPromise().then(t=>{this._request=void 0,this._uploadUrl=t,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const t=this._uploadUrl;this._resolveToken((e,n)=>{const s=function(t,e,n,s){const r=t.maxUploadRetryTime,i=new ry(n,"POST",function(t){const e=dy(t,["active","final"]);let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){iy(!1)}n||iy(!1);const r=Number(n);return iy(!isNaN(r)),new hy(r,s.size(),"final"===e)},r);return i.headers={"X-Goog-Upload-Command":"query"},i.errorHandler=By(e),i}(this._ref.storage,this._ref._location,t,this._blob),r=this._ref.storage._makeRequest(s,Iy,e,n);this._request=r,r.getPromise().then(t=>{this._request=void 0,this._updateProgress(t.current),this._needToFetchStatus=!1,t.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const t=py*this._chunkMultiplier,e=new hy(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken((s,r)=>{let i;try{i=fy(this._ref._location,this._ref.storage,n,this._blob,t,this._mappings,e,this._makeProgressCallback())}catch(t){return this._error=t,void this._transition("error")}const o=this._ref.storage._makeRequest(i,Iy,s,r,!1);this._request=o,o.getPromise().then(t=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(t.current),t.finalized?(this._metadata=t.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){2*(py*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((t,e)=>{const n=function(t,e,n){const s=Ow(e.fullServerUrl(),t.host,t._protocol),r=t.maxOperationRetryTime,i=new ry(s,"GET",oy(t,n),r);return i.errorHandler=cy(e),i}(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(n,Iy,t,e);this._request=s,s.getPromise().then(t=>{this._request=void 0,this._metadata=t,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((t,e)=>{const n=function(t,e,n,s,r){const i=e.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"},a=function(){let t="";for(let e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();o["Content-Type"]="multipart/related; boundary="+a;const B=uy(e,s,r),c="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+ty(B,n)+"\r\n--"+a+"\r\nContent-Type: "+B.contentType+"\r\n\r\n",l="\r\n--"+a+"--",u=Jw.getBlob(c,s,l);if(null===u)throw gw();const h={name:B.fullPath},d=Ow(i,t.host,t._protocol),p=t.maxUploadRetryTime,f=new ry(d,"POST",oy(t,n),p);return f.urlParams=h,f.headers=o,f.body=u.uploadData(),f.errorHandler=By(e),f}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(n,Iy,t,e);this._request=s,s.getPromise().then(t=>{this._request=void 0,this._metadata=t,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(t){const e=this._transferred;this._transferred=t,this._transferred!==e&&this._notifyObservers()}_transition(t){if(this._state!==t)switch(t){case"canceling":case"pausing":this._state=t,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const e="paused"===this._state;this._state=t,e&&(this._notifyObservers(),this._start());break;case"paused":case"error":case"success":this._state=t,this._notifyObservers();break;case"canceled":this._error=Cw(),this._state=t,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 t=Ey(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:t,metadata:this._metadata,task:this,ref:this._ref}}on(t,e,n,s){const r=new _y(e||void 0,n||void 0,s||void 0);return this._addObserver(r),()=>{this._removeObserver(r)}}then(t,e){return this._promise.then(t,e)}catch(t){return this.then(null,t)}_addObserver(t){this._observers.push(t),this._notifyObserver(t)}_removeObserver(t){const e=this._observers.indexOf(t);-1!==e&&this._observers.splice(e,1)}_notifyObservers(){this._finishPromise();this._observers.slice().forEach(t=>{this._notifyObserver(t)})}_finishPromise(){if(void 0!==this._resolve){let t=!0;switch(Ey(this._state)){case my:Dy(this._resolve.bind(null,this.snapshot))();break;case wy:case yy:Dy(this._reject.bind(null,this._error))();break;default:t=!1}t&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(t){switch(Ey(this._state)){case Cy:case gy:t.next&&Dy(t.next.bind(t,this.snapshot))();break;case my:t.complete&&Dy(t.complete.bind(t))();break;default:t.error&&Dy(t.error.bind(t,this._error))()}}resume(){const t="paused"===this._state||"pausing"===this._state;return t&&this._transition("running"),t}pause(){const t="running"===this._state;return t&&this._transition("pausing"),t}cancel(){const t="running"===this._state||"pausing"===this._state;return t&&this._transition("canceling"),t}}class Oy{constructor(t,e){this._service=t,this._location=e instanceof _w?e:_w.makeFromUrl(e,t.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(t,e){return new Oy(t,e)}get root(){const t=new _w(this._location.bucket,"");return this._newRef(this._service,t)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return zw(this._location.path)}get storage(){return this._service}get parent(){const t=function(t){if(0===t.length)return null;const e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}(this._location.path);if(null===t)return null;const e=new _w(this._location.bucket,t);return new Oy(this._service,e)}_throwIfRoot(t){if(""===this._location.path)throw function(t){return new lw(uw.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(t)}}function Ay(t){const e={prefixes:[],items:[]};return Sy(t,e).then(()=>e)}async function Sy(t,e,n){const s={pageToken:n},r=await function(t,e){null!=e&&"number"==typeof e.maxResults&&Tw("options.maxResults",1,1e3,e.maxResults);const n=e||{},s=ly(t.storage,t._location,"/",n.pageToken,n.maxResults);return t.storage.makeRequestWithTokens(s,Iy)}(t,s);e.prefixes.push(...r.prefixes),e.items.push(...r.items),null!=r.nextPageToken&&await Sy(t,e,r.nextPageToken)}function Ry(t){t._throwIfRoot("getDownloadURL");const e=function(t,e,n){const s=Ow(e.fullServerUrl(),t.host,t._protocol),r=t.maxOperationRetryTime,i=new ry(s,"GET",ay(t,n),r);return i.errorHandler=cy(e),i}(t.storage,t._location,Yw());return t.storage.makeRequestWithTokens(e,Iy).then(t=>{if(null===t)throw new lw(uw.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return t})}function Ny(t){t._throwIfRoot("deleteObject");const e=function(t,e){const n=Ow(e.fullServerUrl(),t.host,t._protocol),s=t.maxOperationRetryTime,r=new ry(n,"DELETE",function(t,e){},s);return r.successCodes=[200,204],r.errorHandler=cy(e),r}(t.storage,t._location);return t.storage.makeRequestWithTokens(e,Iy)}function xy(t,e){if(t instanceof Fy){const n=t;if(null==n._bucket)throw new lw(uw.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+cw+"' property when initializing the app?");const s=new Oy(n,n._bucket);return null!=e?xy(s,e):s}return void 0!==e?function(t,e){const n=function(t,e){const n=e.split("/").filter(t=>t.length>0).join("/");return 0===t.length?n:t+"/"+n}(t._location.path,e),s=new _w(t._location.bucket,n);return new Oy(t.storage,s)}(t,e):t}function ky(t,e){if(e&&/^[A-Za-z]+:\/\//.test(e)){if(t instanceof Fy)return new Oy(t,e);throw mw("To use ref(service, url), the first argument must be a Storage instance.")}return xy(t,e)}function Ly(t,e){const n=e?.[cw];return null==n?null:_w.makeFromBucketSpec(n,t)}class Fy{constructor(t,e,n,s,r,i=!1){this.app=t,this._authProvider=e,this._appCheckProvider=n,this._url=s,this._firebaseVersion=r,this._isUsingEmulator=i,this._bucket=null,this._host=Bw,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=s?_w.makeFromBucketSpec(s,this._host):Ly(this._host,this.app.options)}get host(){return this._host}set host(t){this._host=t,null!=this._url?this._bucket=_w.makeFromBucketSpec(this._url,t):this._bucket=Ly(t,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(t){Tw("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(t){Tw("time",0,Number.POSITIVE_INFINITY,t),this._maxOperationRetryTime=t}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const t=this._authProvider.getImmediate({optional:!0});if(t){const e=await t.getToken();if(null!==e)return e.accessToken}return null}async _getAppCheckToken(){if(hr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=this._appCheckProvider.getImmediate({optional:!0});if(t){return(await t.getToken()).token}return null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(t=>t.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(t){return new Oy(this,t)}_makeRequest(t,e,n,s,r=!0){if(this._deleted)return new Dw(ww());{const i=function(t,e,n,s,r,i,o=!0,a=!1){const B=Aw(t.urlParams),c=t.url+B,l=Object.assign({},t.headers);return function(t,e){e&&(t["X-Firebase-GMPID"]=e)}(l,e),function(t,e){null!==e&&e.length>0&&(t.Authorization="Firebase "+e)}(l,n),function(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}(l,i),function(t,e){null!==e&&(t["X-Firebase-AppCheck"]=e)}(l,s),new Rw(c,t.method,l,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,r,o,a)}(t,this._appId,n,s,e,this._firebaseVersion,r,this._isUsingEmulator);return this._requests.add(i),i.getPromise().then(()=>this._requests.delete(i),()=>this._requests.delete(i)),i}}async makeRequestWithTokens(t,e){const[n,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(t,e,n,s).getPromise()}}const Py="@firebase/storage",My="0.14.5",Gy="storage";function Hy(t,e,n){return function(t,e,n){return t._throwIfRoot("uploadBytesResumable"),new Ty(t,new Jw(e),n)}(t=Xn(t),e,n)}function Uy(t){return Ay(t=Xn(t))}function Vy(t){return Ny(t=Xn(t))}function jy(t,e){return ky(t=Xn(t),e)}function $y(t=gr(),e){const n=ur(t=Xn(t),Gy).getImmediate({identifier:e}),s=Rn("storage");return s&&function(t,e,n,s={}){!function(t,e,n,s={}){t.host=`${e}:${n}`;const r=Zn(e);r&&ts(`https://${t.host}/b`),t._isUsingEmulator=!0,t._protocol=r?"https":"http";const{mockUserToken:i}=s;i&&(t._overrideAuthToken="string"==typeof i?i:Ln(i,t.app.options.projectId))}(t,e,n,s)}(n,...s),n}function Jy(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),s=t.getProvider("auth-internal"),r=t.getProvider("app-check-internal");return new Fy(n,s,r,e,fr)}lr(new es(Gy,Jy,"PUBLIC").setMultipleInstances(!0)),mr(Py,My,""),mr(Py,My,"esm2020");let qy,zy,Ky,Qy,Wy={},Yy=null,Xy=!1;const Zy=[];let tE;function eE(){return tE}function nE(){return Xy}function sE(t){Xy?t():Zy.push(t)}function rE(){const t="undefined"==typeof process?void 0:process.env,e=t?.FIREBASE_CONFIG;if(!e)return null;const n=JSON.parse(e);return n&&n.apiKey?n:null}function iE(t){if(t&&Object.prototype.hasOwnProperty.call(t,"actionCodeSettings")&&(tE=t.actionCodeSettings),Xy){if(t?.app&&t.app!==qy)throw new Error("pwa-auth: Firebase app is already set");return qy}if(t?.app)qy=t.app,Wy=qy.options;else{const e=t?.config??rE();if(!e)throw new Error("pwa-auth: pass initialize({ config }) or set window.process.env.FIREBASE_CONFIG");Wy=e,qy=Cr(Wy)}return zy=function(t){const e="object"==typeof t?t:gr(),n="string"==typeof t?t:Yl,s=ur(e,"firestore").getImmediate({identifier:n});if(!s._initialized){const t=Rn("firestore");t&&Ap(s,...t)}return s}(qy),Ky=$y(qy),Qy=Ka(qy),Yy=Qy.currentUser,Xy=!0,Zy.splice(0).forEach(t=>t()),qy}const oE=rE();oE&&iE({config:oE});const aE={bubbles:!0,composed:!0};function BE(t){return t?{uid:t.uid,displayName:t.displayName,email:t.email,photoURL:t.photoURL,emailVerified:!0===t.emailVerified}:null}function cE(t,e){window.dispatchEvent(new CustomEvent(t,{...aE,detail:e}))}function lE(t){if("object"==typeof t&&null!==t&&"code"in t){const e=String(t.code);return{code:e,message:t instanceof Error?t.message:e}}return{code:"pwa/unknown",message:t instanceof Error?t.message:"Authentication failed"}}const uE=new Set(["auth/popup-closed-by-user","auth/cancelled-popup-request","auth/user-cancelled"]);let hE=null,dE=!1;function pE(){const t=hE;return hE=null,t}function fE(){return new go}async function CE(t){if(function(t){return/Android|iPhone|iPad|iPod/i.test(t)}("undefined"==typeof navigator?"":navigator.userAgent))return await Ca(Qy,fE()),"redirect";try{return await async function(t,e,n){if(hr(t.app))return Promise.reject(Fr(t,"operation-not-supported-in-this-environment"));const s=ji(t);Gr(t,e,po);const r=sa(s,n);return new la(s,"signInViaPopup",e,r).executeNotNull()}(Qy,fE()),"ok"}catch(t){const e=lE(t).code;if(uE.has(e))return"quiet";if("auth/popup-blocked"===e)return await Ca(Qy,fE()),"redirect";throw t}}function gE(){dE||(dE=!0,sE(()=>{(async function(t,e){return await ji(t)._initializationPromise,ga(t,e,!1)})(Qy).catch(t=>{!function(t){hE=lE(t)}(t)})}))}const mE="pwa-auth-changed",wE="pwa-login",yE="pwa-logout",EE="pwa-signup",_E="pwa-account-deleted",DE="pwa-profile-updated",bE="pwa-email-changed",vE="pwa-password-changed",IE="pwa-reset-sent",TE="pwa-drawer-toggle",OE="pwa-settings",AE="pwa-auth-error",SE="pwa-verification-sent",RE="pwa-email-verified",NE={authChanged:mE,login:wE,logout:yE,signup:EE,accountDeleted:_E,profileUpdated:DE,emailChanged:bE,passwordChanged:vE,resetSent:IE,drawerToggle:TE,settings:OE,authError:AE,verificationSent:SE,emailVerified:RE},xE=128,kE="At least 8 characters. A passphrase works well.",LE="Use at least 8 characters.",FE="Use at most 128 characters.",PE="Passwords don't match.";function ME(t){return t.length<8?{code:"pwa/short-password",message:LE}:t.length>xE?{code:"pwa/long-password",message:FE}:null}const GE={"auth/invalid-email":"Enter a valid email address.","auth/user-not-found":"No account uses that email.","auth/wrong-password":"That password is wrong.","auth/invalid-credential":"That email or password is wrong.","auth/invalid-login-credentials":"That email or password is wrong.","auth/user-token-expired":"This account is no longer available.","auth/invalid-user-token":"This account is no longer available.","auth/user-disabled":"This account is disabled.","auth/email-already-in-use":"An account already uses that email.","auth/account-exists-with-different-credential":"That email already has an account. Sign in with email and password.","auth/weak-password":LE,"auth/too-many-requests":"Too many tries. Wait and try again.","auth/network-request-failed":"Network problem. Try again.","auth/requires-recent-login":"Sign in again, then retry.","pwa/missing-email":"Enter an email address.","pwa/invalid-email":"Enter a valid email address.","pwa/missing-password":"Enter a password.","pwa/short-password":LE,"pwa/long-password":FE,"pwa/current-password":"Enter your current password.","pwa/password-mismatch":PE,"pwa/weak-password":LE,"pwa/signed-out":"Sign in first.","pwa/missing-file":"Choose a photo first.","pwa/not-image":"Choose an image file.","pwa/photo-too-large":"Choose an image under 5 MB.","pwa/photo-unreadable":"That image could not be prepared. Try another.","pwa/not-ready":"Sign-in is not ready yet.","pwa/unknown":"Something went wrong. Try again."};function HE(t){const e=lE(t);return GE[e.code]??"Something went wrong. Try again."}const UE=i`
|
|
195
200
|
|
|
196
201
|
.action-button:focus { outline: 0; }
|
|
197
202
|
|
|
@@ -298,7 +303,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
298
303
|
cursor: pointer;
|
|
299
304
|
}
|
|
300
305
|
|
|
301
|
-
`,
|
|
306
|
+
`,VE=i`
|
|
302
307
|
|
|
303
308
|
:host {
|
|
304
309
|
box-sizing: border-box;
|
|
@@ -343,7 +348,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
343
348
|
line-height: 1.4;
|
|
344
349
|
}
|
|
345
350
|
|
|
346
|
-
`,
|
|
351
|
+
`,jE=i`
|
|
347
352
|
|
|
348
353
|
input[type=text],
|
|
349
354
|
input[type=email],
|
|
@@ -382,7 +387,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
382
387
|
box-shadow: 0 0 0 1000px var(--pwa_input_background_color, var(--pwa_background, #fff)) inset;
|
|
383
388
|
}
|
|
384
389
|
|
|
385
|
-
|
|
390
|
+
`,$E=i`
|
|
386
391
|
|
|
387
392
|
.new {
|
|
388
393
|
display: block;
|
|
@@ -437,7 +442,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
437
442
|
opacity: 0.72;
|
|
438
443
|
}
|
|
439
444
|
|
|
440
|
-
`,
|
|
445
|
+
`,JE=i`
|
|
441
446
|
|
|
442
447
|
.status {
|
|
443
448
|
margin: 0 0 8px;
|
|
@@ -481,7 +486,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
481
486
|
margin: 0;
|
|
482
487
|
}
|
|
483
488
|
|
|
484
|
-
`;function
|
|
489
|
+
`;function qE(t,e,n){return U`
|
|
485
490
|
<p
|
|
486
491
|
id="${t}"
|
|
487
492
|
part="status"
|
|
@@ -489,13 +494,13 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
489
494
|
role="status"
|
|
490
495
|
aria-live="polite"
|
|
491
496
|
aria-atomic="true">${e}</p>
|
|
492
|
-
`}const
|
|
497
|
+
`}const zE=i`
|
|
493
498
|
|
|
494
499
|
:host {
|
|
495
500
|
--pwa_tap: 44px;
|
|
496
501
|
}
|
|
497
502
|
|
|
498
|
-
`;function
|
|
503
|
+
`;function KE(t,e){return U`
|
|
499
504
|
<button
|
|
500
505
|
type="button"
|
|
501
506
|
class="reveal"
|
|
@@ -503,24 +508,24 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
503
508
|
aria-pressed="${t?"true":"false"}"
|
|
504
509
|
aria-label="${t?"Hide password":"Show password"}"
|
|
505
510
|
@click="${e}">${t?"Hide":"Show"}</button>
|
|
506
|
-
`}const
|
|
511
|
+
`}const QE=U`
|
|
507
512
|
<svg class="g" viewBox="0 0 48 48" aria-hidden="true">
|
|
508
513
|
<path fill="#EA4335" d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"></path>
|
|
509
514
|
<path fill="#4285F4" d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"></path>
|
|
510
515
|
<path fill="#FBBC05" d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"></path>
|
|
511
516
|
<path fill="#34A853" d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"></path>
|
|
512
517
|
</svg>
|
|
513
|
-
`;function
|
|
518
|
+
`;function WE(t,e){return U`
|
|
514
519
|
<button
|
|
515
520
|
type="button"
|
|
516
521
|
part="google"
|
|
517
522
|
class="google"
|
|
518
523
|
?disabled="${t}"
|
|
519
524
|
@click="${e}">
|
|
520
|
-
${
|
|
525
|
+
${QE}
|
|
521
526
|
Continue with Google
|
|
522
527
|
</button>
|
|
523
|
-
`}let
|
|
528
|
+
`}let YE="";const XE=new Set;function ZE(t){const e=t.trim();e!==YE&&(YE=e,e&&XE.forEach(t=>t()))}function t_(){return YE}var e_=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},n_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let s_=class extends it{constructor(){super(),this.source="",this.hideGoogle=!1,this.email="",this.password="",this.status="",this.tone="",this.busy=!1,this.resetBusy=!1,this.showPassword=!1,this.signIn=async(t,e)=>{this.busy=!0,this.tone="",this.status="";try{const n=BE((await So(Qy,t,e)).user);n&&cE(wE,{user:n})}catch(t){this.show(lE(t))}finally{this.busy=!1}},this.forgot=async()=>{if(this.busy||this.resetBusy)return;this.readFields();const t=this.email.trim();if(t.length<4)this.show({code:"pwa/missing-email",message:"Enter an email address."});else if(/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)){this.resetBusy=!0,this.tone="",this.status="";try{await Ao(Qy,t),this.sent(t)}catch(e){"auth/user-not-found"===lE(e).code?this.sent(t):this.show(lE(e))}finally{this.resetBusy=!1}}else this.show({code:"pwa/invalid-email",message:"Enter a valid email address."})}}connectedCallback(){super.connectedCallback(),this.adoptRedirect()}updated(){this.adoptRedirect()}adoptRedirect(){if(!this.classList.contains("opened"))return;const t=pE();t&&this.show(t)}static get styles(){return[_n,VE,jE,UE,$E,JE,zE,i`
|
|
524
529
|
|
|
525
530
|
:host {
|
|
526
531
|
background-color: var(--pwa_background, var(--section_background_color, #fff));
|
|
@@ -583,7 +588,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
583
588
|
@input= "${this.handlePassword}"
|
|
584
589
|
@change= "${this.handlePassword}">
|
|
585
590
|
|
|
586
|
-
${
|
|
591
|
+
${KE(this.showPassword,()=>{this.showPassword=!this.showPassword})}
|
|
587
592
|
|
|
588
593
|
</span>
|
|
589
594
|
|
|
@@ -591,9 +596,9 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
591
596
|
|
|
592
597
|
<li>
|
|
593
598
|
|
|
594
|
-
${
|
|
599
|
+
${qE(n,this.status,this.tone)}
|
|
595
600
|
|
|
596
|
-
${this.hideGoogle?"":
|
|
601
|
+
${this.hideGoogle?"":WE(this.busy||this.resetBusy,()=>{this.google()})}
|
|
597
602
|
|
|
598
603
|
<button
|
|
599
604
|
type= "submit"
|
|
@@ -621,7 +626,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
621
626
|
|
|
622
627
|
</form>
|
|
623
628
|
|
|
624
|
-
`}change(){bn.dispatch(rn(this.source))}async google(){if(!this.busy&&!this.resetBusy){this.busy=!0,this.tone="",this.status="";try{await bE()}catch(t){this.show(mE(t))}finally{this.busy=!1}}}show(t,e=!0){this.tone=e?"error":"",this.status=KE(t),e&&gE(PE,t)}handleEmail(t){const e=t.target;this.email=e.value,aD(this.email)}handlePassword(t){const e=t.target;this.password=e.value}readFields(){const t=this.renderRoot.querySelector('input[type="email"]'),e=this.renderRoot.querySelector('input[name="password"]');this.email=t?.value??"",this.password=e?.value??"",aD(this.email)}_handleSubmit(t){t.preventDefault(),this.login()}async login(){this.busy||(this.readFields(),this.email.length<4?this.show({code:"pwa/missing-email",message:"Enter an email address."}):this.password?await this.signIn(this.email,this.password):this.show({code:"pwa/missing-password",message:"Enter a password."}))}sent(t){this.tone="",this.status="If an account uses that email, a reset link is on its way.",gE(kE,{email:t})}};cD([lt({type:String}),lD("design:type",Object)],uD.prototype,"source",void 0),cD([lt({type:Boolean,attribute:"hide-google",reflect:!0}),lD("design:type",Object)],uD.prototype,"hideGoogle",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"email",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"password",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"status",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"tone",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"busy",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"resetBusy",void 0),cD([ut(),lD("design:type",Object)],uD.prototype,"showPassword",void 0),uD=cD([at("form-login"),lD("design:paramtypes",[])],uD);const hD="@firebase/installations",dD="0.6.24",pD=1e4,fD=`w:${dD}`,CD="FIS_v2",gD=36e5,mD=new Yn("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 wD(t){return t instanceof Wn&&t.code.includes("request-failed")}function yD({projectId:t}){return`https://firebaseinstallations.googleapis.com/v1/projects/${t}/installations`}function ED(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}async function DD(t,e){const n=(await e.json()).error;return mD.create("request-failed",{requestName:t,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function _D({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function bD(t,{refreshToken:e}){const n=_D(t);return n.append("Authorization",function(t){return`${CD} ${t}`}(e)),n}async function vD(t){const e=await t();return e.status>=500&&e.status<600?t():e}function ID(t){return new Promise(e=>{setTimeout(e,t)})}const TD=/^[cdef][\w-]{21}$/;function OD(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const e=function(t){const e=(n=t,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return e.substr(0,22)}(t);return TD.test(e)?e:""}catch{return""}}function AD(t){return`${t.appName}!${t.appId}`}const SD=new Map;function RD(t,e){const n=AD(t);ND(n,e),function(t,e){const n=function(){!xD&&"BroadcastChannel"in self&&(xD=new BroadcastChannel("[Firebase] FID Change"),xD.onmessage=t=>{ND(t.data.key,t.data.fid)});return xD}();n&&n.postMessage({key:t,fid:e});0===SD.size&&xD&&(xD.close(),xD=null)}(n,e)}function ND(t,e){const n=SD.get(t);if(n)for(const t of n)t(e)}let xD=null;const kD="firebase-installations-store";let LD=null;function FD(){return LD||(LD=Rs("firebase-installations-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(kD)}})),LD}async function PD(t,e){const n=AD(t),s=(await FD()).transaction(kD,"readwrite"),r=s.objectStore(kD),i=await r.get(n);return await r.put(e,n),await s.done,i&&i.fid===e.fid||RD(t,e.fid),e}async function MD(t){const e=AD(t),n=(await FD()).transaction(kD,"readwrite");await n.objectStore(kD).delete(e),await n.done}async function GD(t,e){const n=AD(t),s=(await FD()).transaction(kD,"readwrite"),r=s.objectStore(kD),i=await r.get(n),o=e(i);return void 0===o?await r.delete(n):await r.put(o,n),await s.done,!o||i&&i.fid===o.fid||RD(t,o.fid),o}async function HD(t){let e;const n=await GD(t.appConfig,n=>{const s=function(t){const e=t||{fid:OD(),registrationStatus:0};return jD(e)}(n),r=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine){return{installationEntry:e,registrationPromise:Promise.reject(mD.create("app-offline"))}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},s=async function(t,e){try{const n=await async function({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const s=yD(t),r=_D(t),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&r.append("x-firebase-client",t)}const o={fid:n,authVersion:CD,appId:t.appId,sdkVersion:fD},a={method:"POST",headers:r,body:JSON.stringify(o)},B=await vD(()=>fetch(s,a));if(B.ok){const t=await B.json();return{fid:t.fid||n,registrationStatus:2,refreshToken:t.refreshToken,authToken:ED(t.authToken)}}throw await DD("Create Installation",B)}(t,e);return PD(t.appConfig,n)}catch(n){throw wD(n)&&409===n.customData.serverCode?await MD(t.appConfig):await PD(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}(t,n);return{installationEntry:n,registrationPromise:s}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:UD(t)}:{installationEntry:e}}(t,s);return e=r.registrationPromise,r.installationEntry});return""===n.fid?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}async function UD(t){let e=await VD(t.appConfig);for(;1===e.registrationStatus;)await ID(100),e=await VD(t.appConfig);if(0===e.registrationStatus){const{installationEntry:e,registrationPromise:n}=await HD(t);return n||e}return e}function VD(t){return GD(t,t=>{if(!t)throw mD.create("installation-not-found");return jD(t)})}function jD(t){return 1===(e=t).registrationStatus&&e.registrationTime+pD<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}async function $D({appConfig:t,heartbeatServiceProvider:e},n){const s=function(t,{fid:e}){return`${yD(t)}/${e}/authTokens:generate`}(t,n),r=bD(t,n),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&r.append("x-firebase-client",t)}const o={installation:{sdkVersion:fD,appId:t.appId}},a={method:"POST",headers:r,body:JSON.stringify(o)},B=await vD(()=>fetch(s,a));if(B.ok){return ED(await B.json())}throw await DD("Generate Auth Token",B)}async function JD(t,e=!1){let n;const s=await GD(t.appConfig,s=>{if(!zD(s))throw mD.create("not-registered");const r=s.authToken;if(!e&&function(t){return 2===t.requestStatus&&!function(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+gD}(t)}(r))return s;if(1===r.requestStatus)return n=async function(t,e){let n=await qD(t.appConfig);for(;1===n.authToken.requestStatus;)await ID(100),n=await qD(t.appConfig);const s=n.authToken;return 0===s.requestStatus?JD(t,e):s}(t,e),s;{if(!navigator.onLine)throw mD.create("app-offline");const e=function(t){const e={requestStatus:1,requestTime:Date.now()};return{...t,authToken:e}}(s);return n=async function(t,e){try{const n=await $D(t,e),s={...e,authToken:n};return await PD(t.appConfig,s),n}catch(n){if(!wD(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n={...e,authToken:{requestStatus:0}};await PD(t.appConfig,n)}else await MD(t.appConfig);throw n}}(t,e),e}});return n?await n:s.authToken}function qD(t){return GD(t,t=>{if(!zD(t))throw mD.create("not-registered");const e=t.authToken;return 1===(n=e).requestStatus&&n.requestTime+pD<Date.now()?{...t,authToken:{requestStatus:0}}:t;var n})}function zD(t){return void 0!==t&&2===t.registrationStatus}async function KD(t,e=!1){const n=t;await async function(t){const{registrationPromise:e}=await HD(t);e&&await e}(n);return(await JD(n,e)).token}function QD(t){return mD.create("missing-app-config-values",{valueName:t})}const WD="installations",YD=t=>{const e=wr(t.getProvider("app").getImmediate(),WD).getImmediate();return{getId:()=>async function(t){const e=t,{installationEntry:n,registrationPromise:s}=await HD(e);return s?s.catch(console.error):JD(e).catch(console.error),n.fid}(e),getToken:t=>KD(e,t)}};mr(new cs(WD,t=>{const e=t.getProvider("app").getImmediate(),n=function(t){if(!t||!t.options)throw QD("App Configuration");if(!t.name)throw QD("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw QD(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(e);return{app:e,appConfig:n,heartbeatServiceProvider:wr(e,"heartbeat"),_delete:()=>Promise.resolve()}},"PUBLIC")),mr(new cs("installations-internal",YD,"PRIVATE")),Ir(hD,dD),Ir(hD,dD,"esm2020");const XD="analytics",ZD="https://www.googletagmanager.com/gtag/js",t_=new ms("@firebase/analytics"),e_=new Yn("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 n_(t){if(!t.startsWith(ZD)){const e=e_.create("invalid-gtag-resource",{gtagURL:t});return t_.warn(e.message),""}return t}function s_(t){return Promise.all(t.map(t=>t.catch(t=>t)))}function r_(t,e){const n=function(t,e){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(t,e)),n}("firebase-js-sdk-policy",{createScriptURL:n_}),s=document.createElement("script"),r=`${ZD}?l=${t}&id=${e}`;s.src=n?n?.createScriptURL(r):r,s.async=!0,document.head.appendChild(s)}function i_(t,e,n,s){return async function(r,...i){try{if("event"===r){const[s,r]=i;await async function(t,e,n,s,r){try{let i=[];if(r&&r.send_to){let t=r.send_to;Array.isArray(t)||(t=[t]);const s=await s_(n);for(const n of t){const t=s.find(t=>t.measurementId===n),r=t&&e[t.appId];if(!r){i=[];break}i.push(r)}}0===i.length&&(i=Object.values(e)),await Promise.all(i),t("event",s,r||{})}catch(t){t_.error(t)}}(t,e,n,s,r)}else if("config"===r){const[r,o]=i;await async function(t,e,n,s,r,i){const o=s[r];try{if(o)await e[o];else{const t=(await s_(n)).find(t=>t.measurementId===r);t&&await e[t.appId]}}catch(t){t_.error(t)}t("config",r,i)}(t,e,n,s,r,o)}else if("consent"===r){const[e,n]=i;t("consent",e,n)}else if("get"===r){const[e,n,s]=i;t("get",e,n,s)}else if("set"===r){const[e]=i;t("set",e)}else t(r,...i)}catch(t){t_.error(t)}}}const o_=new class{constructor(t={},e=1e3){this.throttleMetadata=t,this.intervalMillis=e}getThrottleMetadata(t){return this.throttleMetadata[t]}setThrottleMetadata(t,e){this.throttleMetadata[t]=e}deleteThrottleMetadata(t){delete this.throttleMetadata[t]}};function a_(t){return new Headers({Accept:"application/json","x-goog-api-key":t})}async function B_(t,e=o_,n){const{appId:s,apiKey:r,measurementId:i}=t.options;if(!s)throw e_.create("no-app-id");if(!r){if(i)return{measurementId:i,appId:s};throw e_.create("no-api-key")}const o=e.getThrottleMetadata(s)||{backoffCount:0,throttleEndTimeMillis:Date.now()},a=new l_;return setTimeout(async()=>{a.abort()},6e4),c_({appId:s,apiKey:r,measurementId:i},o,a,e)}async function c_(t,{throttleEndTimeMillis:e,backoffCount:n},s,r=o_){const{appId:i,measurementId:o}=t;try{await function(t,e){return new Promise((n,s)=>{const r=Math.max(e-Date.now(),0),i=setTimeout(n,r);t.addEventListener(()=>{clearTimeout(i),s(e_.create("fetch-throttle",{throttleEndTimeMillis:e}))})})}(s,e)}catch(t){if(o)return t_.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. [${t?.message}]`),{appId:i,measurementId:o};throw t}try{const e=await async function(t){const{appId:e,apiKey:n}=t,s={method:"GET",headers:a_(n)},r="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",e),i=await fetch(r,s);if(200!==i.status&&304!==i.status){let t="";try{const e=await i.json();e.error?.message&&(t=e.error.message)}catch(t){}throw e_.create("config-fetch-failed",{httpStatus:i.status,responseMessage:t})}return i.json()}(t);return r.deleteThrottleMetadata(i),e}catch(e){const a=e;if(!function(t){if(!(t instanceof Wn&&t.customData))return!1;const e=Number(t.customData.httpStatus);return 429===e||500===e||503===e||504===e}(a)){if(r.deleteThrottleMetadata(i),o)return t_.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:i,measurementId:o};throw e}const B=503===Number(a?.customData?.httpStatus)?is(n,r.intervalMillis,30):is(n,r.intervalMillis),c={throttleEndTimeMillis:Date.now()+B,backoffCount:n+1};return r.setThrottleMetadata(i,c),t_.debug(`Calling attemptFetch again in ${B} millis`),c_(t,c,s,r)}}class l_{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}abort(){this.listeners.forEach(t=>t())}}async function u_(t,e,n,s,r,i,o){const a=B_(t);a.then(e=>{n[e.measurementId]=e.appId,t.options.measurementId&&e.measurementId!==t.options.measurementId&&t_.warn(`The measurement ID in the local Firebase config (${t.options.measurementId}) does not match the measurement ID fetched from the server (${e.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(t=>t_.error(t)),e.push(a);const B=async function(){if(!zn())return t_.warn(e_.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await Kn()}catch(t){return t_.warn(e_.create("indexeddb-unavailable",{errorInfo:t?.toString()}).message),!1}return!0}().then(t=>t?s.getId():void 0),[c,l]=await Promise.all([a,B]);(function(t){const e=window.document.getElementsByTagName("script");for(const n of Object.values(e))if(n.src&&n.src.includes(ZD)&&n.src.includes(t))return n;return null})(i)||r_(i,c.measurementId),r("js",new Date);const u=o?.config??{};return u.origin="firebase",u.update=!0,null!=l&&(u.firebase_id=l),r("config",c.measurementId,u),c.measurementId}class h_{constructor(t){this.app=t}_delete(){return delete d_[this.app.options.appId],Promise.resolve()}}let d_={},p_=[];const f_={};let C_,g_,m_="dataLayer",w_=!1;function y_(t,e,n){!function(){const t=[];if(Jn()&&t.push("This is a browser extension environment."),Qn()||t.push("Cookies are not available."),t.length>0){const e=t.map((t,e)=>`(${e+1}) ${t}`).join(" "),n=e_.create("invalid-analytics-context",{errorInfo:e});t_.warn(n.message)}}();const s=t.options.appId;if(!s)throw e_.create("no-app-id");if(!t.options.apiKey){if(!t.options.measurementId)throw e_.create("no-api-key");t_.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${t.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=d_[s])throw e_.create("already-exists",{id:s});if(!w_){!function(t){let e=[];Array.isArray(window[t])?e=window[t]:window[t]=e}(m_);const{wrappedGtag:t,gtagCore:e}=function(t,e,n,s,r){let i=function(...t){window[s].push(arguments)};return window[r]&&"function"==typeof window[r]&&(i=window[r]),window[r]=i_(i,t,e,n),{gtagCore:i,wrappedGtag:window[r]}}(d_,p_,f_,m_,"gtag");g_=t,C_=e,w_=!0}d_[s]=u_(t,p_,f_,e,C_,m_,n);return new h_(t)}function E_(t=vr()){const e=wr(t=os(t),XD);return e.isInitialized()?e.getImmediate():function(t,e={}){const n=wr(t,XD);if(n.isInitialized()){const t=n.getImmediate();if(Xn(e,n.getOptions()))return t;throw e_.create("already-initialized")}const s=n.initialize({options:e});return s}(t)}function D_(t,e,n){t=os(t),async function(t,e,n,s){if(s&&s.global){const e={};for(const t of Object.keys(n))e[`user_properties.${t}`]=n[t];return t("set",e),Promise.resolve()}t("config",await e,{update:!0,user_properties:n})}(g_,d_[t.app.options.appId],e,n).catch(t=>t_.error(t))}function __(t,e,n,s){t=os(t),async function(t,e,n,s,r){if(r&&r.global)t("event",n,s);else{const r=await e;t("event",n,{...s,send_to:r})}}(g_,d_[t.app.options.appId],e,n,s).catch(t=>t_.error(t))}const b_="@firebase/analytics",v_="0.10.25";mr(new cs(XD,(t,{options:e})=>y_(t.getProvider("app").getImmediate(),t.getProvider("installations-internal").getImmediate(),e),"PUBLIC")),mr(new cs("analytics-internal",function(t){try{const e=t.getProvider(XD).getImmediate();return{logEvent:(t,n,s)=>__(e,t,n,s),setUserProperties:(t,n)=>D_(e,t,n)}}catch(t){throw e_.create("interop-component-reg-failed",{reason:t})}},"PRIVATE")),Ir(b_,v_),Ir(b_,v_,"esm2020");let I_,T_=null;function O_(){const t=T_;return T_=null,t}function A_(t){T_=t,gE(PE,t)}let S_=Promise.resolve();const R_=()=>{bn.dispatch(hn())};uE(()=>{vE(),nB(tE).useDeviceLanguage(),S_=(async()=>{await async function(){if(Jn())return!1;if(!Qn())return!1;if(!zn())return!1;try{return await Kn()}catch(t){return!1}}()&&(I_=E_(tE))})(),jo(sE,t=>{gE(IE,{user:CE(t)}),t?(bn.dispatch(cn(!0)),bn.dispatch(hn()),bn.dispatch(gn(t.uid)),bn.dispatch(mn(t.displayName??"")),bn.dispatch(yn(t.email||"")),bn.dispatch(En(t.photoURL||"")),bn.dispatch(Cn(!0===t.emailVerified)),bn.dispatch(Bn(t.displayName??"")),bn.dispatch(an(t.photoURL||""))):(bn.dispatch(cn(!1)),bn.dispatch(gn("")),bn.dispatch(mn("")),bn.dispatch(yn("")),bn.dispatch(En("")),bn.dispatch(Cn(!1)),bn.dispatch(Bn("")),bn.dispatch(an("")))})});const N_=async t=>{const e=sE.currentUser;if(!e||!e.email)return A_({code:"pwa/signed-out",message:"Sign in first."}),!1;try{const n=Eo.credential(e.email,t);return await async function(t,e){return xo(os(t),e)}(e,n),!0}catch(t){return A_(mE(t)),!1}},x_=async()=>{if(!lE()){const t={code:"pwa/not-ready",message:"Sign-in is not ready yet."};throw gE(PE,t),new Error(t.message)}try{await function(t){return os(t).signOut()}(sE),gE(OE,{user:null})}catch(t){throw gE(PE,mE(t)),t}},k_=async()=>{await S_,I_&&__(I_,"create_account")},L_=async()=>{await S_,I_&&__(I_,"delete_account")},F_=async(t,e)=>{await dw(Up(eE,t,e))};let P_="",M_=!1,G_=!1;function H_(t){if(!t)return P_="",M_=!1,!1;const e=!0===t.emailVerified;return t.uid!==P_?(P_=t.uid,M_=e,!1):!M_&&e?(M_=!0,!0):(M_=e,!1)}function U_(t){bn.dispatch(Cn(!0));const e=CE({...t,emailVerified:!0});e&&gE(GE,{user:e})}async function V_(t){if(!lE())return!1;const e=sE.currentUser;if(!e)return H_(null),!1;try{await e.reload()}catch(n){return t&&gE(PE,mE(n)),!0===e.emailVerified}return bn.dispatch(Cn(!0===e.emailVerified)),H_(e)&&U_(e),!0===e.emailVerified}function j_(){V_(!1)}function $_(){"visible"===document.visibilityState&&V_(!1)}function J_(t,e){const n={code:t,message:e};throw gE(PE,n),Object.assign(new Error(e),n)}async function q_(){lE()||J_("pwa/not-ready","Sign-in is not ready yet.");const t=sE.currentUser;if(t||J_("pwa/signed-out","Sign in first."),t.email||J_("pwa/missing-email","Enter an email address."),t.emailVerified)return!1;const e=cE();try{e?await Go(t,e):await Go(t)}catch(t){throw gE(PE,mE(t)),t}return gE(ME,{email:t.email}),!0}async function z_(){return V_(!0)}G_||(G_=!0,uE(()=>{jo(sE,t=>{t&&H_(t)&&U_(t),t||H_(null)}),"undefined"!=typeof window&&(window.addEventListener("focus",j_),document.addEventListener("visibilitychange",$_))}));const K_=i`
|
|
629
|
+
`}change(){Cn.dispatch(un(this.source))}async google(){if(!this.busy&&!this.resetBusy){this.busy=!0,this.tone="",this.status="";try{await CE()}catch(t){this.show(lE(t))}finally{this.busy=!1}}}show(t,e=!0){this.tone=e?"error":"",this.status=HE(t),e&&cE(AE,t)}handleEmail(t){const e=t.target;this.email=e.value,ZE(this.email)}handlePassword(t){const e=t.target;this.password=e.value}readFields(){const t=this.renderRoot.querySelector('input[type="email"]'),e=this.renderRoot.querySelector('input[name="password"]');this.email=t?.value??"",this.password=e?.value??"",ZE(this.email)}_handleSubmit(t){t.preventDefault(),this.login()}async login(){this.busy||(this.readFields(),this.email.length<4?this.show({code:"pwa/missing-email",message:"Enter an email address."}):this.password?await this.signIn(this.email,this.password):this.show({code:"pwa/missing-password",message:"Enter a password."}))}sent(t){this.tone="",this.status="If an account uses that email, a reset link is on its way.",cE(IE,{email:t})}};e_([lt({type:String}),n_("design:type",Object)],s_.prototype,"source",void 0),e_([lt({type:Boolean,attribute:"hide-google",reflect:!0}),n_("design:type",Object)],s_.prototype,"hideGoogle",void 0),e_([ut(),n_("design:type",Object)],s_.prototype,"email",void 0),e_([ut(),n_("design:type",Object)],s_.prototype,"password",void 0),e_([ut(),n_("design:type",Object)],s_.prototype,"status",void 0),e_([ut(),n_("design:type",Object)],s_.prototype,"tone",void 0),e_([ut(),n_("design:type",Object)],s_.prototype,"busy",void 0),e_([ut(),n_("design:type",Object)],s_.prototype,"resetBusy",void 0),e_([ut(),n_("design:type",Object)],s_.prototype,"showPassword",void 0),s_=e_([at("form-login"),n_("design:paramtypes",[])],s_);const r_="@firebase/installations",i_="0.6.24",o_=1e4,a_=`w:${i_}`,B_="FIS_v2",c_=36e5,l_=new jn("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 u_(t){return t instanceof Vn&&t.code.includes("request-failed")}function h_({projectId:t}){return`https://firebaseinstallations.googleapis.com/v1/projects/${t}/installations`}function d_(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}async function p_(t,e){const n=(await e.json()).error;return l_.create("request-failed",{requestName:t,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function f_({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function C_(t,{refreshToken:e}){const n=f_(t);return n.append("Authorization",function(t){return`${B_} ${t}`}(e)),n}async function g_(t){const e=await t();return e.status>=500&&e.status<600?t():e}function m_(t){return new Promise(e=>{setTimeout(e,t)})}const w_=/^[cdef][\w-]{21}$/;function y_(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const e=function(t){const e=(n=t,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return e.substr(0,22)}(t);return w_.test(e)?e:""}catch{return""}}function E_(t){return`${t.appName}!${t.appId}`}const __=new Map;function D_(t,e){const n=E_(t);b_(n,e),function(t,e){const n=function(){!v_&&"BroadcastChannel"in self&&(v_=new BroadcastChannel("[Firebase] FID Change"),v_.onmessage=t=>{b_(t.data.key,t.data.fid)});return v_}();n&&n.postMessage({key:t,fid:e});0===__.size&&v_&&(v_.close(),v_=null)}(n,e)}function b_(t,e){const n=__.get(t);if(n)for(const t of n)t(e)}let v_=null;const I_="firebase-installations-store";let T_=null;function O_(){return T_||(T_=Ds("firebase-installations-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(I_)}})),T_}async function A_(t,e){const n=E_(t),s=(await O_()).transaction(I_,"readwrite"),r=s.objectStore(I_),i=await r.get(n);return await r.put(e,n),await s.done,i&&i.fid===e.fid||D_(t,e.fid),e}async function S_(t){const e=E_(t),n=(await O_()).transaction(I_,"readwrite");await n.objectStore(I_).delete(e),await n.done}async function R_(t,e){const n=E_(t),s=(await O_()).transaction(I_,"readwrite"),r=s.objectStore(I_),i=await r.get(n),o=e(i);return void 0===o?await r.delete(n):await r.put(o,n),await s.done,!o||i&&i.fid===o.fid||D_(t,o.fid),o}async function N_(t){let e;const n=await R_(t.appConfig,n=>{const s=function(t){const e=t||{fid:y_(),registrationStatus:0};return L_(e)}(n),r=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine){return{installationEntry:e,registrationPromise:Promise.reject(l_.create("app-offline"))}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},s=async function(t,e){try{const n=await async function({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const s=h_(t),r=f_(t),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&r.append("x-firebase-client",t)}const o={fid:n,authVersion:B_,appId:t.appId,sdkVersion:a_},a={method:"POST",headers:r,body:JSON.stringify(o)},B=await g_(()=>fetch(s,a));if(B.ok){const t=await B.json();return{fid:t.fid||n,registrationStatus:2,refreshToken:t.refreshToken,authToken:d_(t.authToken)}}throw await p_("Create Installation",B)}(t,e);return A_(t.appConfig,n)}catch(n){throw u_(n)&&409===n.customData.serverCode?await S_(t.appConfig):await A_(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}(t,n);return{installationEntry:n,registrationPromise:s}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:x_(t)}:{installationEntry:e}}(t,s);return e=r.registrationPromise,r.installationEntry});return""===n.fid?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}async function x_(t){let e=await k_(t.appConfig);for(;1===e.registrationStatus;)await m_(100),e=await k_(t.appConfig);if(0===e.registrationStatus){const{installationEntry:e,registrationPromise:n}=await N_(t);return n||e}return e}function k_(t){return R_(t,t=>{if(!t)throw l_.create("installation-not-found");return L_(t)})}function L_(t){return 1===(e=t).registrationStatus&&e.registrationTime+o_<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}async function F_({appConfig:t,heartbeatServiceProvider:e},n){const s=function(t,{fid:e}){return`${h_(t)}/${e}/authTokens:generate`}(t,n),r=C_(t,n),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&r.append("x-firebase-client",t)}const o={installation:{sdkVersion:a_,appId:t.appId}},a={method:"POST",headers:r,body:JSON.stringify(o)},B=await g_(()=>fetch(s,a));if(B.ok){return d_(await B.json())}throw await p_("Generate Auth Token",B)}async function P_(t,e=!1){let n;const s=await R_(t.appConfig,s=>{if(!G_(s))throw l_.create("not-registered");const r=s.authToken;if(!e&&function(t){return 2===t.requestStatus&&!function(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+c_}(t)}(r))return s;if(1===r.requestStatus)return n=async function(t,e){let n=await M_(t.appConfig);for(;1===n.authToken.requestStatus;)await m_(100),n=await M_(t.appConfig);const s=n.authToken;return 0===s.requestStatus?P_(t,e):s}(t,e),s;{if(!navigator.onLine)throw l_.create("app-offline");const e=function(t){const e={requestStatus:1,requestTime:Date.now()};return{...t,authToken:e}}(s);return n=async function(t,e){try{const n=await F_(t,e),s={...e,authToken:n};return await A_(t.appConfig,s),n}catch(n){if(!u_(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n={...e,authToken:{requestStatus:0}};await A_(t.appConfig,n)}else await S_(t.appConfig);throw n}}(t,e),e}});return n?await n:s.authToken}function M_(t){return R_(t,t=>{if(!G_(t))throw l_.create("not-registered");const e=t.authToken;return 1===(n=e).requestStatus&&n.requestTime+o_<Date.now()?{...t,authToken:{requestStatus:0}}:t;var n})}function G_(t){return void 0!==t&&2===t.registrationStatus}async function H_(t,e=!1){const n=t;await async function(t){const{registrationPromise:e}=await N_(t);e&&await e}(n);return(await P_(n,e)).token}function U_(t){return l_.create("missing-app-config-values",{valueName:t})}const V_="installations",j_=t=>{const e=ur(t.getProvider("app").getImmediate(),V_).getImmediate();return{getId:()=>async function(t){const e=t,{installationEntry:n,registrationPromise:s}=await N_(e);return s?s.catch(console.error):P_(e).catch(console.error),n.fid}(e),getToken:t=>H_(e,t)}};lr(new es(V_,t=>{const e=t.getProvider("app").getImmediate(),n=function(t){if(!t||!t.options)throw U_("App Configuration");if(!t.name)throw U_("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw U_(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(e);return{app:e,appConfig:n,heartbeatServiceProvider:ur(e,"heartbeat"),_delete:()=>Promise.resolve()}},"PUBLIC")),lr(new es("installations-internal",j_,"PRIVATE")),mr(r_,i_),mr(r_,i_,"esm2020");const $_="analytics",J_="https://www.googletagmanager.com/gtag/js",q_=new ls("@firebase/analytics"),z_=new jn("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 K_(t){if(!t.startsWith(J_)){const e=z_.create("invalid-gtag-resource",{gtagURL:t});return q_.warn(e.message),""}return t}function Q_(t){return Promise.all(t.map(t=>t.catch(t=>t)))}function W_(t,e){const n=function(t,e){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(t,e)),n}("firebase-js-sdk-policy",{createScriptURL:K_}),s=document.createElement("script"),r=`${J_}?l=${t}&id=${e}`;s.src=n?n?.createScriptURL(r):r,s.async=!0,document.head.appendChild(s)}function Y_(t,e,n,s){return async function(r,...i){try{if("event"===r){const[s,r]=i;await async function(t,e,n,s,r){try{let i=[];if(r&&r.send_to){let t=r.send_to;Array.isArray(t)||(t=[t]);const s=await Q_(n);for(const n of t){const t=s.find(t=>t.measurementId===n),r=t&&e[t.appId];if(!r){i=[];break}i.push(r)}}0===i.length&&(i=Object.values(e)),await Promise.all(i),t("event",s,r||{})}catch(t){q_.error(t)}}(t,e,n,s,r)}else if("config"===r){const[r,o]=i;await async function(t,e,n,s,r,i){const o=s[r];try{if(o)await e[o];else{const t=(await Q_(n)).find(t=>t.measurementId===r);t&&await e[t.appId]}}catch(t){q_.error(t)}t("config",r,i)}(t,e,n,s,r,o)}else if("consent"===r){const[e,n]=i;t("consent",e,n)}else if("get"===r){const[e,n,s]=i;t("get",e,n,s)}else if("set"===r){const[e]=i;t("set",e)}else t(r,...i)}catch(t){q_.error(t)}}}const X_=new class{constructor(t={},e=1e3){this.throttleMetadata=t,this.intervalMillis=e}getThrottleMetadata(t){return this.throttleMetadata[t]}setThrottleMetadata(t,e){this.throttleMetadata[t]=e}deleteThrottleMetadata(t){delete this.throttleMetadata[t]}};function Z_(t){return new Headers({Accept:"application/json","x-goog-api-key":t})}async function tD(t,e=X_,n){const{appId:s,apiKey:r,measurementId:i}=t.options;if(!s)throw z_.create("no-app-id");if(!r){if(i)return{measurementId:i,appId:s};throw z_.create("no-api-key")}const o=e.getThrottleMetadata(s)||{backoffCount:0,throttleEndTimeMillis:Date.now()},a=new nD;return setTimeout(async()=>{a.abort()},6e4),eD({appId:s,apiKey:r,measurementId:i},o,a,e)}async function eD(t,{throttleEndTimeMillis:e,backoffCount:n},s,r=X_){const{appId:i,measurementId:o}=t;try{await function(t,e){return new Promise((n,s)=>{const r=Math.max(e-Date.now(),0),i=setTimeout(n,r);t.addEventListener(()=>{clearTimeout(i),s(z_.create("fetch-throttle",{throttleEndTimeMillis:e}))})})}(s,e)}catch(t){if(o)return q_.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. [${t?.message}]`),{appId:i,measurementId:o};throw t}try{const e=await async function(t){const{appId:e,apiKey:n}=t,s={method:"GET",headers:Z_(n)},r="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",e),i=await fetch(r,s);if(200!==i.status&&304!==i.status){let t="";try{const e=await i.json();e.error?.message&&(t=e.error.message)}catch(t){}throw z_.create("config-fetch-failed",{httpStatus:i.status,responseMessage:t})}return i.json()}(t);return r.deleteThrottleMetadata(i),e}catch(e){const a=e;if(!function(t){if(!(t instanceof Vn&&t.customData))return!1;const e=Number(t.customData.httpStatus);return 429===e||500===e||503===e||504===e}(a)){if(r.deleteThrottleMetadata(i),o)return q_.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:i,measurementId:o};throw e}const B=503===Number(a?.customData?.httpStatus)?Yn(n,r.intervalMillis,30):Yn(n,r.intervalMillis),c={throttleEndTimeMillis:Date.now()+B,backoffCount:n+1};return r.setThrottleMetadata(i,c),q_.debug(`Calling attemptFetch again in ${B} millis`),eD(t,c,s,r)}}class nD{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}abort(){this.listeners.forEach(t=>t())}}async function sD(t,e,n,s,r,i,o){const a=tD(t);a.then(e=>{n[e.measurementId]=e.appId,t.options.measurementId&&e.measurementId!==t.options.measurementId&&q_.warn(`The measurement ID in the local Firebase config (${t.options.measurementId}) does not match the measurement ID fetched from the server (${e.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(t=>q_.error(t)),e.push(a);const B=async function(){if(!Gn())return q_.warn(z_.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await Hn()}catch(t){return q_.warn(z_.create("indexeddb-unavailable",{errorInfo:t?.toString()}).message),!1}return!0}().then(t=>t?s.getId():void 0),[c,l]=await Promise.all([a,B]);(function(t){const e=window.document.getElementsByTagName("script");for(const n of Object.values(e))if(n.src&&n.src.includes(J_)&&n.src.includes(t))return n;return null})(i)||W_(i,c.measurementId),r("js",new Date);const u=o?.config??{};return u.origin="firebase",u.update=!0,null!=l&&(u.firebase_id=l),r("config",c.measurementId,u),c.measurementId}class rD{constructor(t){this.app=t}_delete(){return delete iD[this.app.options.appId],Promise.resolve()}}let iD={},oD=[];const aD={};let BD,cD,lD="dataLayer",uD=!1;function hD(t,e,n){!function(){const t=[];if(Pn()&&t.push("This is a browser extension environment."),Un()||t.push("Cookies are not available."),t.length>0){const e=t.map((t,e)=>`(${e+1}) ${t}`).join(" "),n=z_.create("invalid-analytics-context",{errorInfo:e});q_.warn(n.message)}}();const s=t.options.appId;if(!s)throw z_.create("no-app-id");if(!t.options.apiKey){if(!t.options.measurementId)throw z_.create("no-api-key");q_.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${t.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=iD[s])throw z_.create("already-exists",{id:s});if(!uD){!function(t){let e=[];Array.isArray(window[t])?e=window[t]:window[t]=e}(lD);const{wrappedGtag:t,gtagCore:e}=function(t,e,n,s,r){let i=function(...t){window[s].push(arguments)};return window[r]&&"function"==typeof window[r]&&(i=window[r]),window[r]=Y_(i,t,e,n),{gtagCore:i,wrappedGtag:window[r]}}(iD,oD,aD,lD,"gtag");cD=t,BD=e,uD=!0}iD[s]=sD(t,oD,aD,e,BD,lD,n);return new rD(t)}function dD(t=gr()){const e=ur(t=Xn(t),$_);return e.isInitialized()?e.getImmediate():function(t,e={}){const n=ur(t,$_);if(n.isInitialized()){const t=n.getImmediate();if($n(e,n.getOptions()))return t;throw z_.create("already-initialized")}const s=n.initialize({options:e});return s}(t)}function pD(t,e,n){t=Xn(t),async function(t,e,n,s){if(s&&s.global){const e={};for(const t of Object.keys(n))e[`user_properties.${t}`]=n[t];return t("set",e),Promise.resolve()}t("config",await e,{update:!0,user_properties:n})}(cD,iD[t.app.options.appId],e,n).catch(t=>q_.error(t))}function fD(t,e,n,s){t=Xn(t),async function(t,e,n,s,r){if(r&&r.global)t("event",n,s);else{const r=await e;t("event",n,{...s,send_to:r})}}(cD,iD[t.app.options.appId],e,n,s).catch(t=>q_.error(t))}const CD="@firebase/analytics",gD="0.10.25";lr(new es($_,(t,{options:e})=>hD(t.getProvider("app").getImmediate(),t.getProvider("installations-internal").getImmediate(),e),"PUBLIC")),lr(new es("analytics-internal",function(t){try{const e=t.getProvider($_).getImmediate();return{logEvent:(t,n,s)=>fD(e,t,n,s),setUserProperties:(t,n)=>pD(e,t,n)}}catch(t){throw z_.create("interop-component-reg-failed",{reason:t})}},"PRIVATE")),mr(CD,gD),mr(CD,gD,"esm2020");let mD,wD=null;function yD(){const t=wD;return wD=null,t}function ED(t){wD=t,cE(AE,t)}let _D=Promise.resolve();const DD=()=>{Cn.dispatch(ln())};sE(()=>{gE(),Ka(qy).useDeviceLanguage(),_D=(async()=>{await async function(){if(Pn())return!1;if(!Un())return!1;if(!Gn())return!1;try{return await Hn()}catch(t){return!1}}()&&(mD=dD(qy))})(),Lo(Qy,t=>{cE(mE,{user:BE(t)}),t?(Cn.dispatch(an(!0)),Cn.dispatch(ln()),Cn.dispatch(hn(t.displayName??"")),Cn.dispatch(dn(t.email||"")),Cn.dispatch(pn(t.photoURL||"")),Cn.dispatch(fn(!0===t.emailVerified))):(Cn.dispatch(an(!1)),Cn.dispatch(hn("")),Cn.dispatch(dn("")),Cn.dispatch(pn("")),Cn.dispatch(fn(!1)))})});const bD=async t=>{const e=Qy.currentUser;if(!e||!e.email)return ED({code:"pwa/signed-out",message:"Sign in first."}),!1;try{const n=ho.credential(e.email,t);return await async function(t,e){return vo(Xn(t),e)}(e,n),!0}catch(t){return ED(lE(t)),!1}},vD=async()=>{if(!nE()){const t={code:"pwa/not-ready",message:"Sign-in is not ready yet."};throw cE(AE,t),new Error(t.message)}try{await function(t){return Xn(t).signOut()}(Qy),cE(yE,{user:null})}catch(t){throw cE(AE,lE(t)),t}},ID=async()=>{await _D,mD&&fD(mD,"create_account")},TD=async()=>{await _D,mD&&fD(mD,"delete_account")},OD=async(t,e)=>{await iw(xp(zy,t,e))};let AD="",SD=!1,RD=!1;function ND(t){if(!t)return AD="",SD=!1,!1;const e=!0===t.emailVerified;return t.uid!==AD?(AD=t.uid,SD=e,!1):!SD&&e?(SD=!0,!0):(SD=e,!1)}function xD(t){Cn.dispatch(fn(!0));const e=BE({...t,emailVerified:!0});e&&cE(RE,{user:e})}async function kD(t){if(!nE())return!1;const e=Qy.currentUser;if(!e)return ND(null),!1;try{await e.reload()}catch(n){return t&&cE(AE,lE(n)),!0===e.emailVerified}return Cn.dispatch(fn(!0===e.emailVerified)),ND(e)&&xD(e),!0===e.emailVerified}function LD(){kD(!1)}function FD(){"visible"===document.visibilityState&&kD(!1)}function PD(t,e){const n={code:t,message:e};throw cE(AE,n),Object.assign(new Error(e),n)}async function MD(){nE()||PD("pwa/not-ready","Sign-in is not ready yet.");const t=Qy.currentUser;if(t||PD("pwa/signed-out","Sign in first."),t.email||PD("pwa/missing-email","Enter an email address."),t.emailVerified)return!1;const e=eE();try{e?await Ro(t,e):await Ro(t)}catch(t){throw cE(AE,lE(t)),t}return cE(SE,{email:t.email}),!0}async function GD(){return kD(!0)}RD||(RD=!0,sE(()=>{Lo(Qy,t=>{t&&ND(t)&&xD(t),t||ND(null)}),"undefined"!=typeof window&&(window.addEventListener("focus",LD),document.addEventListener("visibilitychange",FD))}));const HD=i`
|
|
625
630
|
|
|
626
631
|
.notice {
|
|
627
632
|
margin: 4px 0 8px;
|
|
@@ -638,7 +643,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
638
643
|
line-height: 1.45;
|
|
639
644
|
}
|
|
640
645
|
|
|
641
|
-
`;let
|
|
646
|
+
`;let UD="";const VD=new Set;function jD(){return UD}function $D(t){return VD.add(t),()=>{VD.delete(t)}}var JD=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},qD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zD=class extends it{constructor(){super(),this.source="",this.hideGoogle=!1,this.email="",this.password="",this.status="",this.tone="",this.busy=!1,this.showPassword=!1,this.notice="",this.newAccount=async(t,e)=>{this.busy=!0,this.tone="",this.status="";try{const n=await async function(t,e,n){if(hr(t.app))return Promise.reject(Mr(t));const s=ji(t),r=Zi(s,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",yo),i=await r.catch(e=>{throw"auth/password-does-not-meet-requirements"===e.code&&Oo(t),e}),o=await Eo._fromIdTokenResponse(s,"signIn",i);return await s._updateCurrentUser(o.user),o}(Qy,t,e);await ID();const s=BE(n.user);s&&cE(EE,{user:s});try{await MD(),this.notice="Check your inbox for the verification email. You can still sign in.",function(t){UD=t,VD.forEach(t=>t())}(t)}catch(t){this.tone="error",this.status=HE(t)}}catch(t){this.show(lE(t))}finally{this.busy=!1}}}connectedCallback(){super.connectedCallback(),this.adoptRedirect()}updated(){this.adoptRedirect()}adoptRedirect(){if(!this.classList.contains("opened"))return;const t=pE();t&&this.show(t)}static get styles(){return[_n,VE,jE,UE,$E,JE,HD,zE,i`
|
|
642
647
|
|
|
643
648
|
:host {
|
|
644
649
|
background-color: var(--pwa_background, var(--section_background_color, #fff));
|
|
@@ -697,25 +702,25 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
697
702
|
type= "${this.showPassword?"text":"password"}"
|
|
698
703
|
autocomplete= "new-password"
|
|
699
704
|
minlength= "${8}"
|
|
700
|
-
maxlength= "${
|
|
705
|
+
maxlength= "${xE}"
|
|
701
706
|
aria-invalid= "${"error"===this.tone?"true":"false"}"
|
|
702
707
|
aria-describedby="${n} ${s}"
|
|
703
708
|
@input= "${this.handlePassword}"
|
|
704
709
|
@change= "${this.handlePassword}">
|
|
705
710
|
|
|
706
|
-
${
|
|
711
|
+
${KE(this.showPassword,()=>{this.showPassword=!this.showPassword})}
|
|
707
712
|
|
|
708
713
|
</span>
|
|
709
714
|
|
|
710
|
-
<p id="${n}" class="hint" part="hint">${
|
|
715
|
+
<p id="${n}" class="hint" part="hint">${kE}</p>
|
|
711
716
|
|
|
712
717
|
</li>
|
|
713
718
|
|
|
714
719
|
<li>
|
|
715
720
|
|
|
716
|
-
${
|
|
721
|
+
${qE(s,this.status,this.tone)}
|
|
717
722
|
|
|
718
|
-
${this.hideGoogle?"":
|
|
723
|
+
${this.hideGoogle?"":WE(this.busy,()=>{this.google()})}
|
|
719
724
|
|
|
720
725
|
<button
|
|
721
726
|
type= "submit"
|
|
@@ -740,7 +745,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
740
745
|
|
|
741
746
|
</form>
|
|
742
747
|
|
|
743
|
-
`}change(){
|
|
748
|
+
`}change(){Cn.dispatch(un(this.source))}async google(){if(!this.busy){this.busy=!0,this.tone="",this.status="";try{await CE()}catch(t){this.show(lE(t))}finally{this.busy=!1}}}show(t){this.tone="error",this.status=HE(t),cE(AE,t)}readFields(){const t=this.renderRoot.querySelector('input[type="email"]'),e=this.renderRoot.querySelector('input[name="new-password"]');this.email=t?.value??"",this.password=e?.value??""}_handleSubmit(t){t.preventDefault(),this.signUp()}handleEmail(t){const e=t.target;this.email=e.value}handlePassword(t){const e=t.target;this.password=e.value}async signUp(){if(this.busy)return;if(this.readFields(),this.email.length<4)return void this.show({code:"pwa/missing-email",message:"Enter an email address."});const t=ME(this.password);t?this.show(t):await this.newAccount(this.email,this.password)}};function KD(t){if(nE())return;const e=t.getAttribute("firebase-config");if(e)try{iE({config:JSON.parse(e)})}catch(t){cE(AE,lE(t))}}function QD(t,e){const n=t.trim();if(n){return n.split(/\s+/).slice(0,2).map(t=>t.charAt(0)).join("").toUpperCase()}const s=e.trim();return s?s.charAt(0).toUpperCase():""}function WD(t,e){const n=t.trim();if(n)return n;const s=e.trim();return s||"Account"}JD([lt({type:String}),qD("design:type",Object)],zD.prototype,"source",void 0),JD([lt({type:Boolean,attribute:"hide-google",reflect:!0}),qD("design:type",Object)],zD.prototype,"hideGoogle",void 0),JD([ut(),qD("design:type",Object)],zD.prototype,"email",void 0),JD([ut(),qD("design:type",Object)],zD.prototype,"password",void 0),JD([ut(),qD("design:type",Object)],zD.prototype,"status",void 0),JD([ut(),qD("design:type",Object)],zD.prototype,"tone",void 0),JD([ut(),qD("design:type",Object)],zD.prototype,"busy",void 0),JD([ut(),qD("design:type",Object)],zD.prototype,"showPassword",void 0),JD([ut(),qD("design:type",Object)],zD.prototype,"notice",void 0),zD=JD([at("form-signup"),qD("design:paramtypes",[])],zD);var YD=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},XD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ZD=class extends(wt(Cn)(it)){constructor(){super(),this.subscribe=!1,this.hideGoogle=!1,this._name="",this._email="",this._verified=!1,this._notice="",this._log=!1,this._sign=!1,this.motion=!1,this.clipHeight="auto",this.sheetShift="none",this.rollMotion=!1,this.booted=!1,this.stopNotice=null,this.heldHeight=null,this.columnWidth=0,this.columnObserver=null,this.onClipEnd=t=>{t instanceof TransitionEvent&&t.target===t.currentTarget&&"max-height"===t.propertyName&&this.rest()}}connectedCallback(){KD(this),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Account"),super.connectedCallback(),this._notice=jD(),this.stopNotice=$D(()=>{this._notice=jD()})}disconnectedCallback(){this.stopNotice?.(),this.stopNotice=null,this.columnObserver?.disconnect(),this.columnObserver=null,super.disconnectedCallback()}stateChanged(t){this._name=t.session.name,this._email=t.session.email,this._verified=Boolean(t.session.verified),this._log=t.session.login,this._sign=t.session.registerTwo}willUpdate(t){if(!this.booted)return;if(!t.has("_sign")&&!t.has("_log"))return;t.has("_sign")&&(this.motion=!0);const e=this.clip();e&&(this.heldHeight=Math.ceil(e.getBoundingClientRect().height),this.rollMotion=!1,this.clipHeight=`${this.heldHeight}px`,this.sheetShift="translate3d(0, 0, 0)")}updated(t){const e=!this.booted;if(this.booted=!0,e)return this.watchColumn(),void requestAnimationFrame(()=>{this.motion=!0});if(!t.has("_sign")&&!t.has("_log"))return;const n=this.clip(),s=this.sheet();if(!n||!s||null==this.heldHeight)return;const r=this.heldHeight;this.heldHeight=null;const i=Math.ceil(s.getBoundingClientRect().height);Math.abs(i-r)>1?this.rollBetween(n,s,r,i,i):this.rest()}watchColumn(){"undefined"!=typeof ResizeObserver&&(this.columnObserver=new ResizeObserver(()=>{const t=Math.round(this.getBoundingClientRect().width);if(!t||t===this.columnWidth)return;if(this.columnWidth=t,!this.rollMotion)return;const e=this.clip(),n=this.sheet();if(!e||!n)return;const s=Math.ceil(e.getBoundingClientRect().height),r=Math.ceil(n.getBoundingClientRect().height);this.rollBetween(e,n,s,r,r)}),this.columnObserver.observe(this))}clip(){return this.shadowRoot?.querySelector(".login-clip")??null}sheet(){return this.shadowRoot?.querySelector(".service")??null}reduced(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}rest(){this.rollMotion=!1,this.clipHeight="auto",this.sheetShift="none"}clipStyle(){const t=this.rollMotion&&!this.reduced();return{height:this.clipHeight,maxHeight:"auto"===this.clipHeight?"none":this.clipHeight,transition:t?"height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out":"none"}}sheetStyle(){const t=this.rollMotion&&!this.reduced();return{transform:this.sheetShift,transition:t?"transform var(--pwa_slide, 2s) ease-in-out":"none"}}rollBetween(t,e,n,s,r){const i=n-r,o=s-r,a=t=>`translate3d(0, ${t}px, 0)`;if(this.reduced()||Math.abs(s-n)<=1)return void this.rest();t.style.transition="none",e.style.transition="none",t.style.height=`${Math.max(0,n)}px`,t.style.maxHeight=`${Math.max(0,n)}px`,e.style.transform=a(i),t.offsetHeight,t.style.transition="height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out",e.style.transition="transform var(--pwa_slide, 2s) ease-in-out",t.style.height=`${Math.max(0,s)}px`,t.style.maxHeight=`${Math.max(0,s)}px`,e.style.transform=a(o),this.rollMotion=!0,this.clipHeight=`${Math.max(0,s)}px`,this.sheetShift=a(o)}static get styles(){return[wn,yn,En,_n,gn,zE,HD,i`
|
|
744
749
|
/* Required - this card's roll only. Block, so the sheet is not stretched to the clip. */
|
|
745
750
|
.login-clip {
|
|
746
751
|
display: block;
|
|
@@ -761,7 +766,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
761
766
|
<section class="service" part="panel" style=${mt(this.sheetStyle())}>
|
|
762
767
|
|
|
763
768
|
<div part="header">
|
|
764
|
-
<h2 part="title">${this._log?
|
|
769
|
+
<h2 part="title">${this._log?WD(this._name,this._email):this._sign===this.subscribe?"Login":"Subscribe"}</h2>
|
|
765
770
|
</div>
|
|
766
771
|
|
|
767
772
|
<!-- Logged-out State -->
|
|
@@ -811,12 +816,15 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
811
816
|
</section>
|
|
812
817
|
</div>
|
|
813
818
|
|
|
814
|
-
`}};
|
|
819
|
+
`}};YD([lt({type:Boolean,attribute:!0,reflect:!0}),XD("design:type",Object)],ZD.prototype,"subscribe",void 0),YD([lt({type:Boolean,attribute:"hide-google",reflect:!0}),XD("design:type",Object)],ZD.prototype,"hideGoogle",void 0),YD([ut(),XD("design:type",Object)],ZD.prototype,"_name",void 0),YD([ut(),XD("design:type",Object)],ZD.prototype,"_email",void 0),YD([ut(),XD("design:type",Object)],ZD.prototype,"_verified",void 0),YD([ut(),XD("design:type",Object)],ZD.prototype,"_notice",void 0),YD([ut(),XD("design:type",Object)],ZD.prototype,"_log",void 0),YD([ut(),XD("design:type",Object)],ZD.prototype,"_sign",void 0),YD([ut(),XD("design:type",Object)],ZD.prototype,"motion",void 0),YD([ut(),XD("design:type",Object)],ZD.prototype,"clipHeight",void 0),YD([ut(),XD("design:type",Object)],ZD.prototype,"sheetShift",void 0),YD([ut(),XD("design:type",Object)],ZD.prototype,"rollMotion",void 0),ZD=YD([at("user-login"),XD("design:paramtypes",[])],ZD);const tb=U`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none">
|
|
820
|
+
<line x1="7" y1="7" x2="17" y2="17" stroke="currentColor" stroke-width="2" stroke-linecap="round"></line>
|
|
821
|
+
<line x1="17" y1="7" x2="7" y2="17" stroke="currentColor" stroke-width="2" stroke-linecap="round"></line>
|
|
822
|
+
</svg>`,eb=i`
|
|
815
823
|
|
|
816
824
|
.spec[on] { display: grid; }
|
|
817
825
|
.spec { display: none; }
|
|
818
826
|
|
|
819
|
-
`,
|
|
827
|
+
`,nb=i`
|
|
820
828
|
|
|
821
829
|
:host {
|
|
822
830
|
/* Required - stay where the tag is. Height 0 so a closed drawer takes no space. */
|
|
@@ -867,12 +875,13 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
867
875
|
padding-top: env(safe-area-inset-top);
|
|
868
876
|
}
|
|
869
877
|
|
|
870
|
-
`,
|
|
878
|
+
`,sb=i`
|
|
871
879
|
|
|
872
880
|
.exit {
|
|
873
881
|
display: grid;
|
|
874
|
-
grid-template-columns:
|
|
875
|
-
|
|
882
|
+
grid-template-columns: var(--pwa_close_size, 44px) minmax(0, 1fr) var(--pwa_close_size, 44px);
|
|
883
|
+
align-items: center;
|
|
884
|
+
padding: 8px 12px;
|
|
876
885
|
z-index: 2;
|
|
877
886
|
background-color: var(--pwa_background, var(--pwa_drawer_background_color, #fff));
|
|
878
887
|
border-bottom: 1px solid var(--pwa_line_color, #e3daca);
|
|
@@ -907,25 +916,42 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
907
916
|
}
|
|
908
917
|
*/
|
|
909
918
|
.close {
|
|
910
|
-
|
|
919
|
+
appearance: none;
|
|
920
|
+
box-sizing: border-box;
|
|
921
|
+
display: grid;
|
|
922
|
+
place-items: center;
|
|
923
|
+
justify-self: end;
|
|
924
|
+
align-self: center;
|
|
925
|
+
width: var(--pwa_close_size, 44px);
|
|
926
|
+
height: var(--pwa_close_size, 44px);
|
|
911
927
|
min-width: var(--pwa_tap, 44px);
|
|
912
|
-
height:
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
border:
|
|
917
|
-
|
|
928
|
+
min-height: var(--pwa_tap, 44px);
|
|
929
|
+
margin: 0;
|
|
930
|
+
padding: 0;
|
|
931
|
+
border-radius: var(--pwa_close_radius, 10px);
|
|
932
|
+
border: var(--pwa_close_border, 1px solid var(--pwa_line_color, #e3daca));
|
|
933
|
+
background: var(--pwa_close_background, #fff);
|
|
934
|
+
color: var(--pwa_close_mark, var(--pwa_drawer_text_color, #1c2430));
|
|
935
|
+
cursor: pointer;
|
|
918
936
|
}
|
|
919
937
|
|
|
920
938
|
.close svg {
|
|
921
|
-
width:
|
|
922
|
-
height:
|
|
939
|
+
width: 18px;
|
|
940
|
+
height: 18px;
|
|
923
941
|
display: block;
|
|
924
942
|
}
|
|
925
943
|
|
|
944
|
+
.close:hover {
|
|
945
|
+
background: var(--pwa_close_hover, var(--pwa_nav_on_background, #f2f2f2));
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
.close:active {
|
|
949
|
+
background: var(--pwa_close_active, #e7e2d6);
|
|
950
|
+
}
|
|
951
|
+
|
|
926
952
|
|
|
927
953
|
|
|
928
|
-
`,
|
|
954
|
+
`,rb=i`
|
|
929
955
|
|
|
930
956
|
a {
|
|
931
957
|
font-size: 0.95rem;
|
|
@@ -934,7 +960,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
934
960
|
text-decoration: none;
|
|
935
961
|
}
|
|
936
962
|
|
|
937
|
-
`,
|
|
963
|
+
`,ib=i`
|
|
938
964
|
|
|
939
965
|
.setLog > a,
|
|
940
966
|
.setLog > button.settings {
|
|
@@ -978,13 +1004,13 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
978
1004
|
}
|
|
979
1005
|
|
|
980
1006
|
|
|
981
|
-
`;function
|
|
1007
|
+
`;function ob(t){const e=[],n=t=>{t.querySelectorAll("button, a[href], input, select, textarea").forEach(t=>{t.hasAttribute("disabled")||t.tabIndex<0||function(t){let e=t;for(;e;){if(e instanceof HTMLElement){if(e.classList.contains("closed"))return!0;if(e.classList.contains("spec")&&!e.hasAttribute("on"))return!0}if(e instanceof Element&&e.assignedSlot&&e.assignedSlot!==e){e=e.assignedSlot;continue}if(e.parentElement){e=e.parentElement;continue}const t=e.getRootNode();if(!(t instanceof ShadowRoot))break;e=t.host}return!1}(t)||e.push(t)}),t.querySelectorAll("*").forEach(t=>{t.shadowRoot&&n(t.shadowRoot)})};return t.shadowRoot&&n(t.shadowRoot),n(t),e.filter((t,n)=>e.indexOf(t)===n)}function ab(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement instanceof HTMLElement;)t=t.shadowRoot.activeElement;return t}const Bb=U`
|
|
982
1008
|
<span class="verified" part="verified" role="img" aria-label="Email verified">
|
|
983
1009
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
984
1010
|
<path d="M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"></path>
|
|
985
1011
|
</svg>
|
|
986
1012
|
</span>
|
|
987
|
-
`,
|
|
1013
|
+
`,cb=i`
|
|
988
1014
|
|
|
989
1015
|
.verified {
|
|
990
1016
|
display: inline-grid;
|
|
@@ -1019,7 +1045,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1019
1045
|
min-width: 0;
|
|
1020
1046
|
}
|
|
1021
1047
|
|
|
1022
|
-
`;var
|
|
1048
|
+
`;var lb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},ub=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class hb extends(wt(Cn)(it)){constructor(){super(),this.login=!1,this.verified=!1,this.email="",this.status="",this.tone="",this.busy=!1,this.cooldown=0,this.timer=0,this.resend=async t=>{if(t.preventDefault(),!(this.busy||this.cooldown>0||this.verified)){this.busy=!0,this.tone="",this.status="";try{await MD()&&this.showSent()}catch(t){this.showFirebase(t)}finally{this.busy=!1}}}}disconnectedCallback(){this.clearWait(),super.disconnectedCallback()}stateChanged(t){this.login=Boolean(t.session.login),this.verified=Boolean(t.session.verified),this.email=t.session.email??"",this.hidden=!this.login,this.verified&&this.clearWait()}static get styles(){return[UE,zE,cb,i`
|
|
1023
1049
|
|
|
1024
1050
|
:host {
|
|
1025
1051
|
display: block;
|
|
@@ -1117,7 +1143,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1117
1143
|
<div class="notice ok" part="notice">
|
|
1118
1144
|
<p class="row">
|
|
1119
1145
|
<span class="mail">${this.email}</span>
|
|
1120
|
-
${
|
|
1146
|
+
${Bb}
|
|
1121
1147
|
</p>
|
|
1122
1148
|
</div>
|
|
1123
1149
|
`;return U`
|
|
@@ -1152,7 +1178,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1152
1178
|
</form>
|
|
1153
1179
|
|
|
1154
1180
|
</div>
|
|
1155
|
-
`}showSent(){this.tone="",this.status="Check your inbox for the verification email.",this.cooldown=45,this.armCooldown(),this.updateComplete.then(()=>{this.focusStatus()})}showFirebase(t){this.tone="error",this.status=KE(t),this.updateComplete.then(()=>{this.focusStatus()})}focusStatus(){const t=this.renderRoot.querySelector("#pwa-verify-status");t?.focus()}clearWait(){window.clearInterval(this.timer),this.timer=0,this.cooldown=0}armCooldown(){window.clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.cooldown<=1)return this.cooldown=0,window.clearInterval(this.timer),void(this.timer=0);this.cooldown-=1},1e3)}}mb([ut(),wb("design:type",Object)],yb.prototype,"login",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"verified",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"email",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"status",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"tone",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"busy",void 0),mb([ut(),wb("design:type",Object)],yb.prototype,"cooldown",void 0),customElements.define("email-verify",yb);var Eb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Db=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let _b=class extends(wt(bn)(it)){constructor(){super(),this.url="",this.drawer=!1,this.subscribe=!1,this.hideGoogle=!1,this.name="",this.email="",this.verified=!1,this.notice="",this.user=!1,this.signup=!1,this.sliding=!1,this.motion=!1,this.clipHeight="0px",this.sheetShift="translate3d(0, -100%, 0)",this.rollMotion=!1,this.booted=!1,this.wasOpen=!1,this.sawOpen=!1,this.returnFocus=null,this.stopNotice=null,this.heldHeight=null,this.columnWidth=0,this.columnObserver=null,this.onClipEnd=t=>{if(!(t instanceof TransitionEvent))return;if(t.target!==t.currentTarget)return;if("max-height"!==t.propertyName)return;const e=t.currentTarget;e instanceof HTMLElement&&(this.drawer?this.restOpen():e.getBoundingClientRect().height>1||(this.sliding=!1,this.restShut()))},this.onKey=t=>{if(!this.drawer)return;if("Escape"===t.key)return t.preventDefault(),void bn.dispatch(hn());if("Tab"!==t.key)return;const e=pb(this);if(!e.length)return;const n=e[0],s=e[e.length-1],r=fb(),i=!!r&&e.includes(r);t.shiftKey?i&&r!==n||(t.preventDefault(),s.focus({preventScroll:!0})):i&&r!==s||(t.preventDefault(),n.focus({preventScroll:!0}))},this.onLightClick=t=>{if(t.defaultPrevented)return;const e=t.target;if(!(e instanceof Element))return;const n=e.closest("a, button");n instanceof HTMLElement&&this.contains(n)&&(this.shadowRoot?.contains(n)||bn.dispatch(hn()))},this.onSettings=t=>{const e=this.destination();if(!this.dispatchEvent(new CustomEvent(FE,{bubbles:!0,composed:!0,cancelable:!0,detail:{url:e}})))return void t.preventDefault();if(bn.dispatch(hn()),e)return;t.preventDefault();const n=document.querySelector("user-settings");n instanceof HTMLElement&&n.scrollIntoView({block:"nearest"})}}connectedCallback(){nb(this),this.id||(this.id="pwa-user-drawer"),super.connectedCallback(),this.addEventListener("keydown",this.onKey),this.addEventListener("click",this.onLightClick),this.notice=Y_(),this.stopNotice=X_(()=>{this.notice=Y_()})}disconnectedCallback(){this.removeEventListener("keydown",this.onKey),this.removeEventListener("click",this.onLightClick),this.stopNotice?.(),this.stopNotice=null,this.columnObserver?.disconnect(),this.columnObserver=null,super.disconnectedCallback()}stateChanged(t){const e=t.frontend.drawer;this.name=t.backend.name,this.email=t.backend.email,this.verified=Boolean(t.backend?.verified),e?this.sliding=!0:this.reduced()&&(this.sliding=!1),this.drawer=e,this.user=t.frontend.login,this.signup=t.frontend.registerOne;(this.sawOpen?e!==this.wasOpen:e)&&function(t,e,n){t.dispatchEvent(new CustomEvent(e,{...fE,detail:n}))}(this,LE,{open:e}),this.wasOpen=e,this.sawOpen=!0}willUpdate(t){if(!this.booted)return void(this.drawer&&this.restOpen());if(t.has("signup")&&(this.motion=!0),t.has("drawer")||!t.has("signup")||!this.drawer)return;const e=this.clip();e&&(this.heldHeight=Math.ceil(e.getBoundingClientRect().height),this.rollMotion=!1,this.clipHeight=`${this.heldHeight}px`,this.sheetShift="translate3d(0, 0, 0)")}updated(t){const e=!this.booted;if(this.booted=!0,!e&&t.has("drawer"))this.heldHeight=null,this.drawer?this.unroll():this.rollUp();else if(!e&&null!=this.heldHeight&&this.drawer){const t=this.heldHeight;this.heldHeight=null;const e=this.clip(),n=this.sheet();if(e&&n){const s=Math.ceil(n.getBoundingClientRect().height);Math.abs(s-t)>1?this.rollBetween(e,n,t,s,s):this.restOpen()}}if(e&&requestAnimationFrame(()=>{this.motion=!0}),!t.has("drawer"))return;if(this.drawer){const t=fb();return this.returnFocus=t&&!this.contains(t)?t:this.returnFocus,this.shadowRoot?.querySelector(".close")?.focus({preventScroll:!0}),void V_(!1)}const n=this.returnFocus??this.toggleButton();n?.focus(),this.returnFocus=null}clip(){return this.shadowRoot?.querySelector(".drawer-clip")??null}sheet(){return this.shadowRoot?.querySelector(".userDrawer")??null}toggleButton(){const t=document.querySelector("user-icon"),e=t?.shadowRoot?.querySelector("button");return e instanceof HTMLElement?e:null}reduced(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}restShut(){this.rollMotion=!1,this.clipHeight="0px",this.sheetShift="translate3d(0, -100%, 0)"}restOpen(){this.rollMotion=!1,this.clipHeight="auto",this.sheetShift="none"}clipStyle(){const t=this.rollMotion&&!this.reduced();return{height:this.clipHeight,maxHeight:"auto"===this.clipHeight?"none":this.clipHeight,transition:t?"height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out":"none"}}sheetStyle(){const t=this.rollMotion&&!this.reduced();return{transform:this.sheetShift,transition:t?"transform var(--pwa_slide, 2s) ease-in-out":"none"}}unroll(){const t=this.clip(),e=this.sheet();if(!t||!e)return;this.scrollTop=0,this.placeAnchor();const n=this.sheetPx(t,e),s=Math.ceil(t.getBoundingClientRect().height);this.rollBetween(t,e,s,n,n)}rollUp(){const t=this.clip(),e=this.sheet();if(!t||!e)return;const n=Math.ceil(e.getBoundingClientRect().height),s=Math.ceil(t.getBoundingClientRect().height);this.rollBetween(t,e,s,0,n),this.reduced()&&(this.sliding=!1)}sheetPx(t,e){const n=t.style.transition,s=t.style.maxHeight,r=t.style.height;t.style.transition="none",t.style.maxHeight="none",t.style.height="auto";const i=Math.ceil(e.getBoundingClientRect().height);return t.style.height=r,t.style.maxHeight=s,t.style.transition=n,i}rollBetween(t,e,n,s,r){const i=n-r,o=s-r,a=t=>`translate3d(0, ${t}px, 0)`;if(this.reduced()||Math.abs(s-n)<=1)return void(0===s?this.restShut():this.restOpen());t.style.transition="none",e.style.transition="none",t.style.height=`${Math.max(0,n)}px`,t.style.maxHeight=`${Math.max(0,n)}px`,e.style.transform=a(i),t.offsetHeight,t.style.transition="height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out",e.style.transition="transform var(--pwa_slide, 2s) ease-in-out",t.style.height=`${Math.max(0,s)}px`,t.style.maxHeight=`${Math.max(0,s)}px`,e.style.transform=a(o),this.rollMotion=!0,this.clipHeight=`${Math.max(0,s)}px`,this.sheetShift=a(o)}firstUpdated(){this.shadowRoot.querySelector(".close").addEventListener("click",()=>{bn.dispatch(hn())}),this.shadowRoot.querySelector(".leave").addEventListener("click",async()=>{if(this.user)try{await x_()}catch{return}bn.dispatch(hn())});this.shadowRoot.querySelectorAll("a").forEach(t=>{t.addEventListener("click",()=>{bn.dispatch(hn())})}),this.watchColumn()}placeAnchor(){const t=getComputedStyle(this).position;if("fixed"===t||"absolute"===t)return void(this.style.top&&(this.style.top=""));const e=this.parentElement;if(!e)return;const n=this.previousElementSibling,s=n?n.getBoundingClientRect().bottom:e.getBoundingClientRect().top+(parseFloat(getComputedStyle(e).paddingTop)||0),r=parseFloat(this.style.top)||0,i=s-(this.getBoundingClientRect().top-r);Math.abs(i-r)<=.5||(this.style.top=Math.abs(i)<=.5?"":`${i}px`)}watchColumn(){if("undefined"==typeof ResizeObserver)return;this.columnObserver=new ResizeObserver(()=>{this.placeAnchor();const t=Math.round(this.getBoundingClientRect().width);t&&t!==this.columnWidth&&(this.columnWidth=t,this.onColumnResize())}),this.columnObserver.observe(this);const t=this.previousElementSibling;t&&this.columnObserver.observe(t),this.placeAnchor()}onColumnResize(){if(!this.rollMotion)return;const t=this.clip(),e=this.sheet();if(!t||!e)return;const n=Math.ceil(t.getBoundingClientRect().height),s=this.sheetPx(t,e);this.rollBetween(t,e,n,this.drawer?s:0,s)}static get styles(){return[cb,vn,In,lb,ub,hb,db,Sn,eD,K_,gb,i`
|
|
1181
|
+
`}showSent(){this.tone="",this.status="Check your inbox for the verification email.",this.cooldown=45,this.armCooldown(),this.updateComplete.then(()=>{this.focusStatus()})}showFirebase(t){this.tone="error",this.status=HE(t),this.updateComplete.then(()=>{this.focusStatus()})}focusStatus(){const t=this.renderRoot.querySelector("#pwa-verify-status");t?.focus()}clearWait(){window.clearInterval(this.timer),this.timer=0,this.cooldown=0}armCooldown(){window.clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.cooldown<=1)return this.cooldown=0,window.clearInterval(this.timer),void(this.timer=0);this.cooldown-=1},1e3)}}lb([ut(),ub("design:type",Object)],hb.prototype,"login",void 0),lb([ut(),ub("design:type",Object)],hb.prototype,"verified",void 0),lb([ut(),ub("design:type",Object)],hb.prototype,"email",void 0),lb([ut(),ub("design:type",Object)],hb.prototype,"status",void 0),lb([ut(),ub("design:type",Object)],hb.prototype,"tone",void 0),lb([ut(),ub("design:type",Object)],hb.prototype,"busy",void 0),lb([ut(),ub("design:type",Object)],hb.prototype,"cooldown",void 0),customElements.define("email-verify",hb);var db=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fb=class extends(wt(Cn)(it)){constructor(){super(),this.url="",this.drawer=!1,this.subscribe=!1,this.hideGoogle=!1,this.name="",this.email="",this.verified=!1,this.notice="",this.user=!1,this.sheetSigned=!1,this.holdSheet=!1,this.openSheetPx=0,this.liveName="",this.liveEmail="",this.liveVerified=!1,this.signup=!1,this.sliding=!1,this.motion=!1,this.clipHeight="0px",this.sheetShift="translate3d(0, -100%, 0)",this.rollMotion=!1,this.booted=!1,this.wasOpen=!1,this.sawOpen=!1,this.returnFocus=null,this.stopNotice=null,this.heldHeight=null,this.columnWidth=0,this.columnObserver=null,this.onClipEnd=t=>{if(!(t instanceof TransitionEvent))return;if(t.target!==t.currentTarget)return;if("max-height"!==t.propertyName)return;const e=t.currentTarget;e instanceof HTMLElement&&(this.drawer?this.restOpen():e.getBoundingClientRect().height>1||(this.sliding=!1,this.restShut(),this.releaseSheet()))},this.onKey=t=>{if(!this.drawer)return;if("Escape"===t.key)return t.preventDefault(),void Cn.dispatch(ln());if("Tab"!==t.key)return;const e=ob(this);if(!e.length)return;const n=e[0],s=e[e.length-1],r=ab(),i=!!r&&e.includes(r);t.shiftKey?i&&r!==n||(t.preventDefault(),s.focus({preventScroll:!0})):i&&r!==s||(t.preventDefault(),n.focus({preventScroll:!0}))},this.onLightClick=t=>{if(t.defaultPrevented)return;const e=t.target;if(!(e instanceof Element))return;const n=e.closest("a, button");n instanceof HTMLElement&&this.contains(n)&&(this.shadowRoot?.contains(n)||Cn.dispatch(ln()))},this.onSettings=t=>{const e=this.destination();if(!this.dispatchEvent(new CustomEvent(OE,{bubbles:!0,composed:!0,cancelable:!0,detail:{url:e}})))return void t.preventDefault();if(Cn.dispatch(ln()),e)return;t.preventDefault();const n=document.querySelector("user-settings");n instanceof HTMLElement&&n.scrollIntoView({block:"nearest"})}}connectedCallback(){KD(this),this.id||(this.id="pwa-user-drawer"),super.connectedCallback(),this.addEventListener("keydown",this.onKey),this.addEventListener("click",this.onLightClick),this.notice=jD(),this.stopNotice=$D(()=>{this.notice=jD()})}disconnectedCallback(){this.removeEventListener("keydown",this.onKey),this.removeEventListener("click",this.onLightClick),this.stopNotice?.(),this.stopNotice=null,this.columnObserver?.disconnect(),this.columnObserver=null,super.disconnectedCallback()}stateChanged(t){const e=t.session.drawer,n=this.drawer,s=!0===this.user;this.liveName=t.session.name,this.liveEmail=t.session.email,this.liveVerified=Boolean(t.session.verified),e?this.sliding=!0:this.reduced()&&(this.sliding=!1),this.drawer=e,this.user=t.session.login,this.signup=t.session.registerOne,this.paintAccount(s,n);(this.sawOpen?e!==this.wasOpen:e)&&function(t,e,n){t.dispatchEvent(new CustomEvent(e,{...aE,detail:n}))}(this,TE,{open:e}),this.wasOpen=e,this.sawOpen=!0}paintAccount(t,e){if(!0===this.user)return this.holdSheet=!1,this.name=this.liveName,this.email=this.liveEmail,this.verified=this.liveVerified,void(this.sheetSigned=!0);if(t&&e){const t=this.sheet(),e=t?Math.ceil(t.getBoundingClientRect().height):0;return e>1&&(this.openSheetPx=e),this.holdSheet=!0,void(this.sheetSigned=!0)}this.holdSheet||(this.name=this.liveName,this.email=this.liveEmail,this.verified=this.liveVerified,this.sheetSigned=!1)}releaseSheet(){this.holdSheet&&(this.holdSheet=!1,this.name=this.liveName,this.email=this.liveEmail,this.verified=this.liveVerified,this.sheetSigned=!0===this.user)}willUpdate(t){if(!this.booted)return void(this.drawer&&this.restOpen());if(t.has("signup")&&(this.motion=!0),t.has("drawer")||!t.has("signup")||!this.drawer)return;const e=this.clip();e&&(this.heldHeight=Math.ceil(e.getBoundingClientRect().height),this.rollMotion=!1,this.clipHeight=`${this.heldHeight}px`,this.sheetShift="translate3d(0, 0, 0)")}updated(t){const e=!this.booted;if(this.booted=!0,!e&&t.has("drawer"))this.heldHeight=null,this.drawer?this.unroll():this.rollUp();else if(!e&&null!=this.heldHeight&&this.drawer){const t=this.heldHeight;this.heldHeight=null;const e=this.clip(),n=this.sheet();if(e&&n){const s=Math.ceil(n.getBoundingClientRect().height);Math.abs(s-t)>1?this.rollBetween(e,n,t,s,s):this.restOpen()}}if(e&&requestAnimationFrame(()=>{this.motion=!0}),!t.has("drawer"))return;if(this.drawer){const t=ab();return this.returnFocus=t&&!this.contains(t)?t:this.returnFocus,this.shadowRoot?.querySelector(".close")?.focus({preventScroll:!0}),void kD(!1)}const n=this.returnFocus??this.toggleButton();n?.focus({preventScroll:!0}),this.returnFocus=null}clip(){return this.shadowRoot?.querySelector(".drawer-clip")??null}sheet(){return this.shadowRoot?.querySelector(".userDrawer")??null}toggleButton(){const t=document.querySelector("user-icon"),e=t?.shadowRoot?.querySelector("button");return e instanceof HTMLElement?e:null}reduced(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}restShut(){this.rollMotion=!1,this.clipHeight="0px",this.sheetShift="translate3d(0, -100%, 0)";const t=this.sheet();t&&(t.style.minHeight="")}restOpen(){this.rollMotion=!1,this.clipHeight="auto",this.sheetShift="none"}clipStyle(){const t=this.rollMotion&&!this.reduced();return{height:this.clipHeight,maxHeight:"auto"===this.clipHeight?"none":this.clipHeight,transition:t?"height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out":"none"}}sheetStyle(){const t=this.rollMotion&&!this.reduced();return{transform:this.sheetShift,transition:t?"transform var(--pwa_slide, 2s) ease-in-out":"none"}}unroll(){const t=this.clip(),e=this.sheet();if(!t||!e)return;this.scrollTop=0,this.placeAnchor();const n=this.sheetPx(t,e),s=Math.ceil(t.getBoundingClientRect().height);this.rollBetween(t,e,s,n,n)}rollUp(){const t=this.clip(),e=this.sheet();if(!t||!e)return;this.placeAnchor();let n=Math.ceil(e.getBoundingClientRect().height),s=Math.ceil(t.getBoundingClientRect().height);this.holdSheet&&this.openSheetPx>1&&(s=this.openSheetPx,n=this.openSheetPx,e.style.minHeight=`${this.openSheetPx}px`),this.rollBetween(t,e,s,0,n),this.reduced()&&(this.sliding=!1)}sheetPx(t,e){const n=t.style.transition,s=t.style.maxHeight,r=t.style.height;t.style.transition="none",t.style.maxHeight="none",t.style.height="auto";const i=Math.ceil(e.getBoundingClientRect().height);return t.style.height=r,t.style.maxHeight=s,t.style.transition=n,i}rollBetween(t,e,n,s,r){const i=n-r,o=s-r,a=t=>`translate3d(0, ${t}px, 0)`;if(this.reduced()||Math.abs(s-n)<=1)return void(0===s?(this.restShut(),this.releaseSheet()):this.restOpen());t.style.transition="none",e.style.transition="none",t.style.height=`${Math.max(0,n)}px`,t.style.maxHeight=`${Math.max(0,n)}px`,e.style.transform=a(i),t.offsetHeight,t.style.transition="height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out",e.style.transition="transform var(--pwa_slide, 2s) ease-in-out",t.style.height=`${Math.max(0,s)}px`,t.style.maxHeight=`${Math.max(0,s)}px`,e.style.transform=a(o),this.rollMotion=!0,this.clipHeight=`${Math.max(0,s)}px`,this.sheetShift=a(o)}firstUpdated(){this.shadowRoot.querySelector(".close").addEventListener("click",()=>{Cn.dispatch(ln())}),this.shadowRoot.querySelector(".leave").addEventListener("click",async()=>{if(this.user)try{await vD()}catch{return}Cn.dispatch(ln())});this.shadowRoot.querySelectorAll("a").forEach(t=>{t.addEventListener("click",()=>{Cn.dispatch(ln())})}),this.watchColumn()}placeAnchor(){const t=getComputedStyle(this).position;if("fixed"===t||"absolute"===t)return void(this.style.top&&(this.style.top=""));const e=this.parentElement;if(!e)return;const n=this.previousElementSibling,s=n?n.getBoundingClientRect().bottom:e.getBoundingClientRect().top+(parseFloat(getComputedStyle(e).paddingTop)||0),r=parseFloat(this.style.top)||0,i=s-(this.getBoundingClientRect().top-r);Math.abs(i-r)<=.5||(this.style.top=Math.abs(i)<=.5?"":`${i}px`)}watchColumn(){if("undefined"==typeof ResizeObserver)return;this.columnObserver=new ResizeObserver(()=>{this.placeAnchor();const t=Math.round(this.getBoundingClientRect().width);t&&t!==this.columnWidth&&(this.columnWidth=t,this.onColumnResize())}),this.columnObserver.observe(this);const t=this.previousElementSibling;t&&this.columnObserver.observe(t),this.placeAnchor()}onColumnResize(){if(!this.rollMotion)return;const t=this.clip(),e=this.sheet();if(!t||!e)return;const n=Math.ceil(t.getBoundingClientRect().height),s=this.sheetPx(t,e);this.rollBetween(t,e,n,this.drawer?s:0,s)}static get styles(){return[eb,gn,mn,nb,sb,rb,ib,_n,zE,HD,cb,i`
|
|
1156
1182
|
/* Required - this drawer's roll only. The clip hangs from the tag and grows down. */
|
|
1157
1183
|
.drawer-clip {
|
|
1158
1184
|
display: block;
|
|
@@ -1248,16 +1274,16 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1248
1274
|
<div class="exit" part="header">
|
|
1249
1275
|
<div></div>
|
|
1250
1276
|
<h2 id="pwa-drawer-title" part="title">
|
|
1251
|
-
<span class="who">${!1===this.
|
|
1252
|
-
${this.
|
|
1277
|
+
<span class="who">${!1===this.sheetSigned?this.signup===this.subscribe?"Login":"Subscribe":WD(this.name,this.email)}</span>
|
|
1278
|
+
${this.sheetSigned?this.verified?Bb:U`<span class="unverified" part="unverified">Not verified</span>`:""}
|
|
1253
1279
|
</h2>
|
|
1254
|
-
<button class="close" part="close" type="button" aria-label="Close">${
|
|
1280
|
+
<button class="close" part="close" type="button" aria-label="Close">${tb}</button>
|
|
1255
1281
|
</div>
|
|
1256
1282
|
|
|
1257
1283
|
<!-- Logged-out State -->
|
|
1258
1284
|
<div
|
|
1259
1285
|
class="spec"
|
|
1260
|
-
?on="${!1===this.
|
|
1286
|
+
?on="${!1===this.sheetSigned}">
|
|
1261
1287
|
|
|
1262
1288
|
<div class= "wrapper">
|
|
1263
1289
|
<div class=${ft({inner:!0,motion:this.motion})}>
|
|
@@ -1290,7 +1316,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1290
1316
|
<!-- Logged-in State -->
|
|
1291
1317
|
<div
|
|
1292
1318
|
class="spec setLog"
|
|
1293
|
-
?on="${!0===this.
|
|
1319
|
+
?on="${!0===this.sheetSigned}">
|
|
1294
1320
|
|
|
1295
1321
|
<!-- Required - Jack's markers. A host link replaces the fallback. -->
|
|
1296
1322
|
<slot name="before"><a href="/settings">slotted - before</a></slot>
|
|
@@ -1299,11 +1325,11 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1299
1325
|
|
|
1300
1326
|
<slot><a href="/settings">slotted - default</a></slot>
|
|
1301
1327
|
|
|
1302
|
-
${this.
|
|
1328
|
+
${this.sheetSigned&&this.notice&&!this.verified?U`
|
|
1303
1329
|
<p class="notice" part="notice" role="status" aria-live="polite">Check your inbox for the verification email. You can still sign in.</p>
|
|
1304
1330
|
`:""}
|
|
1305
1331
|
|
|
1306
|
-
${this.
|
|
1332
|
+
${this.sheetSigned?U`<email-verify exportparts="notice: verify-notice, status: verify-status, submit: verify-submit, verified: email-verified, unverified"></email-verify>`:""}
|
|
1307
1333
|
|
|
1308
1334
|
<button class="leave" part="logout" type="button" aria-label="Log out">Log out</button>
|
|
1309
1335
|
|
|
@@ -1312,7 +1338,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1312
1338
|
</section>
|
|
1313
1339
|
</div>
|
|
1314
1340
|
|
|
1315
|
-
`}destination(){return(this.url||"").trim()}settingsControl(){const t=this.destination();return t?U`<a href="${t}" part="settings" @click="${this.onSettings}">Settings</a>`:U`<button type="button" class="settings" part="settings" @click="${this.onSettings}">Settings</button>`}};
|
|
1341
|
+
`}destination(){return(this.url||"").trim()}settingsControl(){const t=this.destination();return t?U`<a href="${t}" part="settings" @click="${this.onSettings}">Settings</a>`:U`<button type="button" class="settings" part="settings" @click="${this.onSettings}">Settings</button>`}};db([lt({type:String,reflect:!0}),pb("design:type",Object)],fb.prototype,"url",void 0),db([lt({type:Boolean,attribute:!0,reflect:!0}),pb("design:type",Object)],fb.prototype,"drawer",void 0),db([lt({type:Boolean,attribute:!0,reflect:!0}),pb("design:type",Object)],fb.prototype,"subscribe",void 0),db([lt({type:Boolean,attribute:"hide-google",reflect:!0}),pb("design:type",Object)],fb.prototype,"hideGoogle",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"name",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"email",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"verified",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"notice",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"user",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"sheetSigned",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"signup",void 0),db([lt({type:Boolean,reflect:!0}),pb("design:type",Object)],fb.prototype,"sliding",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"motion",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"clipHeight",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"sheetShift",void 0),db([ut(),pb("design:type",Object)],fb.prototype,"rollMotion",void 0),fb=db([at("user-drawer"),pb("design:paramtypes",[])],fb);const Cb=i`
|
|
1316
1342
|
|
|
1317
1343
|
nav {
|
|
1318
1344
|
overflow: hidden;
|
|
@@ -1397,7 +1423,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1397
1423
|
padding: 20px var(--pwa_inset, 0px) 4px;
|
|
1398
1424
|
}
|
|
1399
1425
|
|
|
1400
|
-
`;var
|
|
1426
|
+
`;var gb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},mb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function wb(t){return"pwa-auth/"+t+"/photo"}async function yb(t){const e=await async function(t){try{return await createImageBitmap(t,{imageOrientation:"from-image"})}catch{return await createImageBitmap(t)}}(t);try{if(e.width<1||e.height<1)throw new Error("empty image");const t=function(t,e){const n=Math.max(t,e);if(!(n>1024))return{width:Math.max(1,Math.round(t)),height:Math.max(1,Math.round(e))};const s=1024/n;return{width:Math.max(1,Math.round(t*s)),height:Math.max(1,Math.round(e*s))}}(e.width,e.height),n=document.createElement("canvas");n.width=t.width,n.height=t.height;const s=n.getContext("2d");if(!s)throw new Error("no canvas");s.drawImage(e,0,0,t.width,t.height);const r=await new Promise(t=>{n.toBlob(e=>t(e),"image/jpeg",.8)});if(!r)throw new Error("no jpeg");return r}finally{e.close()}}class Eb extends(wt(Cn)(it)){constructor(){super(),this.photo="",this.emptyArtwork="",this.signed=!1,this.person="",this.mail="",this.progress=0,this.error="",this.status="",this.tone="",this.busy=!1,this.stopAuth=null,this.saveImage=async t=>{const e=t.target,n=e?.files?.[0],s=Qy.currentUser;if(this.error="",this.tone="",!s)return this.resetPicker(),void this.fail({code:"pwa/signed-out",message:"Sign in first."});if(!n)return this.resetPicker(),void this.fail({code:"pwa/missing-file",message:"Choose a photo first."});const r=function(t){return t.type.startsWith("image/")?t.size>5242880?{code:"pwa/photo-too-large",message:"Choose an image under 5 MB."}:null:{code:"pwa/not-image",message:"Choose an image file."}}(n);if(r)return this.resetPicker(),void this.fail(r);let i;this.busy=!0,this.progress=0,this.status="Preparing…";try{i=await yb(n)}catch{return this.busy=!1,this.progress=0,this.resetPicker(),void this.fail({code:"pwa/photo-unreadable",message:"That image could not be prepared. Try another."})}const o=Qy.currentUser;if(!o)return this.busy=!1,this.progress=0,this.resetPicker(),void this.fail({code:"pwa/signed-out",message:"Sign in first."});this.status="Uploading…";const a=jy(Ky,wb(o.uid)),B={cacheControl:"public,max-age=300",contentType:i.type||"image/jpeg"},c=Hy(a,i,B);c.on("state_changed",t=>{const e=t.totalBytes>0?t.bytesTransferred/t.totalBytes*100:0;this.progress=isFinite(e)?e:0,this.status=`Uploading… ${Math.round(this.progress)}%`},t=>{this.busy=!1,this.progress=0,this.resetPicker(),this.fail(t)},async()=>{try{const t=await function(t){return Ry(t=Xn(t))}(c.snapshot.ref),e=Qy.currentUser;if(!e)return await Vy(a).catch(()=>{}),void this.fail({code:"pwa/signed-out",message:"Sign in first."});try{await xo(e,{photoURL:t})}catch(t){throw await Vy(a).catch(()=>{}),t}Cn.dispatch(pn(t)),this.photo=t,this.progress=100,this.tone="",this.error="",this.status="Photo saved.",cE(DE,{uid:e.uid,displayName:e.displayName,photoURL:t})}catch(t){this.fail(t)}finally{this.busy=!1,this.resetPicker()}})},this.clearPhoto=async()=>{const t=Qy.currentUser;if(t&&!this.busy){this.busy=!0,this.error="",this.tone="",this.status="";try{await xo(t,{photoURL:null}),Cn.dispatch(pn("")),this.photo="",await Vy(jy(Ky,wb(t.uid))).catch(()=>{}),this.status="Photo removed.",cE(DE,{uid:t.uid,displayName:t.displayName,photoURL:null})}catch(t){this.fail(t)}finally{this.busy=!1,this.resetPicker()}}}}connectedCallback(){super.connectedCallback(),sE(()=>{this.stopAuth?.(),this.stopAuth=Lo(Qy,t=>{if(this.signed=!!t,!t)return this.tone="",this.error="",void(this.status="Sign in to upload a photo.");"Sign in to upload a photo."===this.status&&(this.status="")})})}disconnectedCallback(){this.stopAuth?.(),this.stopAuth=null,super.disconnectedCallback()}stateChanged(t){this.photo=t.session.photoURL,this.person=t.session.name,this.mail=t.session.email}static get styles(){return[VE,JE,i`
|
|
1401
1427
|
|
|
1402
1428
|
:host {
|
|
1403
1429
|
position: relative;
|
|
@@ -1524,7 +1550,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1524
1550
|
opacity: 0.72;
|
|
1525
1551
|
}
|
|
1526
1552
|
|
|
1527
|
-
`]}letters(){return
|
|
1553
|
+
`]}letters(){return QD(this.person,this.mail)}resetPicker(){const t=this.renderRoot.querySelector("input[type=file]");t&&(t.value="")}render(){const t=this.letters(),e="string"==typeof this.photo?this.photo:"",n=!this.signed||this.busy;return U`
|
|
1528
1554
|
|
|
1529
1555
|
<div class="chooser">
|
|
1530
1556
|
<input
|
|
@@ -1570,8 +1596,8 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1570
1596
|
@click="${this.clearPhoto}">Remove photo</button>
|
|
1571
1597
|
`:""}
|
|
1572
1598
|
|
|
1573
|
-
${
|
|
1574
|
-
`}fail(t){const e="object"==typeof t&&null!==t&&"code"in t&&"message"in t&&!(t instanceof Error)?t:
|
|
1599
|
+
${qE("pwa-photo-status",this.error||this.status,this.tone)}
|
|
1600
|
+
`}fail(t){const e="object"==typeof t&&null!==t&&"code"in t&&"message"in t&&!(t instanceof Error)?t:lE(t);this.tone="error",this.error=HE(e),this.status="",cE(AE,e)}}gb([lt(),mb("design:type",Object)],Eb.prototype,"photo",void 0),gb([lt({type:String,reflect:!0}),mb("design:type",Object)],Eb.prototype,"emptyArtwork",void 0),gb([ut(),mb("design:type",Object)],Eb.prototype,"signed",void 0),gb([ut(),mb("design:type",Object)],Eb.prototype,"person",void 0),gb([ut(),mb("design:type",Object)],Eb.prototype,"mail",void 0),gb([ut(),mb("design:type",Number)],Eb.prototype,"progress",void 0),gb([ut(),mb("design:type",String)],Eb.prototype,"error",void 0),gb([ut(),mb("design:type",String)],Eb.prototype,"status",void 0),gb([ut(),mb("design:type",String)],Eb.prototype,"tone",void 0),gb([ut(),mb("design:type",Object)],Eb.prototype,"busy",void 0),customElements.define("contact-photo",Eb);var _b=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Db=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class bb extends(wt(Cn)(it)){constructor(){super(),this.login=!1,this.draft="",this.busy=!1,this.status="",this.tone="",this.dirty=!1,this.default=t=>{t.preventDefault(),this.alertProfile()},this.alertProfile=async()=>{if(this.busy)return;const t=this.renderRoot.querySelector("#pwa-name"),e=(t?.value??this.draft).trim(),n=Qy.currentUser;if(n){this.busy=!0,this.tone="",this.status="";try{await xo(n,{displayName:e}),this.dirty=!1,this.draft=e,Cn.dispatch(hn(e)),this.status="Name saved.",cE(DE,{uid:n.uid,displayName:e,photoURL:n.photoURL})}catch(t){this.show(lE(t))}finally{this.busy=!1}}else this.show({code:"pwa/signed-out",message:"Sign in first."})}}stateChanged(t){const e=Boolean(t.session.login);e!==this.login&&(this.dirty=!1),this.login=e,this.dirty||(this.draft=t.session.name??"")}static get styles(){return[VE,jE,UE,JE,i`
|
|
1575
1601
|
|
|
1576
1602
|
:host, form { display: grid; align-content: start; }
|
|
1577
1603
|
|
|
@@ -1598,7 +1624,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1598
1624
|
|
|
1599
1625
|
</label>
|
|
1600
1626
|
|
|
1601
|
-
${
|
|
1627
|
+
${qE("pwa-name-status",this.status,this.tone)}
|
|
1602
1628
|
|
|
1603
1629
|
<button
|
|
1604
1630
|
class="action-button save"
|
|
@@ -1609,7 +1635,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1609
1635
|
|
|
1610
1636
|
</form>
|
|
1611
1637
|
|
|
1612
|
-
`}handleInput(t){const e=t.target;this.dirty=!0,this.draft=e.value}show(t){this.tone="error",this.status=
|
|
1638
|
+
`}handleInput(t){const e=t.target;this.dirty=!0,this.draft=e.value}show(t){this.tone="error",this.status=HE(t),cE(AE,t)}}_b([ut(),Db("design:type",Object)],bb.prototype,"login",void 0),_b([ut(),Db("design:type",Object)],bb.prototype,"draft",void 0),_b([ut(),Db("design:type",Object)],bb.prototype,"busy",void 0),_b([ut(),Db("design:type",Object)],bb.prototype,"status",void 0),_b([ut(),Db("design:type",Object)],bb.prototype,"tone",void 0),customElements.define("input-name",bb);const vb="userEmailChanged";var Ib=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Tb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Ob extends(wt(Cn)(it)){constructor(){super(),this.email="",this.login=!1,this.mail="",this.busy=!1,this.status="",this.tone="",this.showPassword=!1,this.saveEmail=async t=>{if(t.preventDefault(),this.busy)return;const e=Qy.currentUser;if(!e)return void this.show({code:"pwa/signed-out",message:"Sign in first."});const n=this.shadowRoot?.querySelector("#pwa-current-email-password")?.value??"",s=this.shadowRoot?.querySelector("#pwa-email");if(!s)return;if(n.length<6)return void this.show({code:"pwa/current-password",message:"Enter your current password."});this.busy=!0,this.tone="",this.status="";if(!await bD(n)){const t=yD();return this.tone="error",this.status=HE(t??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}try{const t=eE();t?await No(e,s.value,t):await No(e,s.value);const n={email:s.value};if(cE(bE,n),function(t){window.dispatchEvent(new CustomEvent(vb,{detail:t,bubbles:!0,composed:!0}))}(n),this.tone="",this.status="Check your inbox to confirm the new address.",!e.emailVerified)try{await MD()}catch{}}catch(t){const e=lE(t);this.tone="error",this.status=HE(t),cE(AE,e)}finally{this.busy=!1}}}stateChanged(t){this.login=t.session.login,this.mail=t.session.email}handleEmail(t){const e=t.target;this.mail=e.value}static get styles(){return[VE,jE,UE,$E,JE,i`
|
|
1613
1639
|
|
|
1614
1640
|
:host, form { display: grid; align-content: start; }
|
|
1615
1641
|
|
|
@@ -1632,7 +1658,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1632
1658
|
aria-invalid = "${"error"===this.tone?"true":"false"}"
|
|
1633
1659
|
aria-describedby = "pwa-email-status"/>
|
|
1634
1660
|
|
|
1635
|
-
${
|
|
1661
|
+
${KE(this.showPassword,()=>{this.showPassword=!this.showPassword})}
|
|
1636
1662
|
|
|
1637
1663
|
</span>
|
|
1638
1664
|
|
|
@@ -1655,7 +1681,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1655
1681
|
|
|
1656
1682
|
</label>
|
|
1657
1683
|
|
|
1658
|
-
${
|
|
1684
|
+
${qE("pwa-email-status",this.status,this.tone)}
|
|
1659
1685
|
|
|
1660
1686
|
<button
|
|
1661
1687
|
type = "submit"
|
|
@@ -1666,7 +1692,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1666
1692
|
|
|
1667
1693
|
</form>
|
|
1668
1694
|
|
|
1669
|
-
`}show(t){this.tone="error",this.status=
|
|
1695
|
+
`}show(t){this.tone="error",this.status=HE(t),cE(AE,t)}}Ib([lt({type:String,reflect:!0}),Tb("design:type",Object)],Ob.prototype,"email",void 0),Ib([ut(),Tb("design:type",Boolean)],Ob.prototype,"login",void 0),Ib([ut(),Tb("design:type",String)],Ob.prototype,"mail",void 0),Ib([ut(),Tb("design:type",Object)],Ob.prototype,"busy",void 0),Ib([ut(),Tb("design:type",Object)],Ob.prototype,"status",void 0),Ib([ut(),Tb("design:type",Object)],Ob.prototype,"tone",void 0),Ib([ut(),Tb("design:type",Object)],Ob.prototype,"showPassword",void 0),customElements.define("contact-email",Ob);var Ab=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Sb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Rb extends(wt(Cn)(it)){constructor(){super(),this.message="",this.tone="",this.password="",this.login=!1,this.busy=!1,this.showCurrent=!1,this.showNext=!1,this.showVerify=!1,this.default=t=>{t.preventDefault(),this.alertPassword()},this.updatePass=async(t,e)=>{const n=Qy.currentUser;if(!n)return void this.show({code:"pwa/signed-out",message:"Sign in first."});this.busy=!0,this.tone="",this.message="";if(!await bD(t)){const t=yD();return this.tone="error",this.message=HE(t??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}try{await ko(n,e),this.tone="",this.message="Password saved.",cE(vE,{uid:n.uid})}catch(t){const e=lE(t);this.tone="error",this.message=HE(t),cE(AE,e)}finally{this.busy=!1}}}stateChanged(t){this.login=t.session.login}handleInputChange(t){const e=t.target;this.password=e.value}static get styles(){return[VE,jE,UE,$E,JE,i`
|
|
1670
1696
|
|
|
1671
1697
|
:host{
|
|
1672
1698
|
display: grid;
|
|
@@ -1696,7 +1722,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1696
1722
|
aria-invalid = "${"error"===this.tone?"true":"false"}"
|
|
1697
1723
|
aria-describedby = "pwa-password-status">
|
|
1698
1724
|
|
|
1699
|
-
${
|
|
1725
|
+
${KE(this.showCurrent,()=>{this.showCurrent=!this.showCurrent})}
|
|
1700
1726
|
|
|
1701
1727
|
</span>
|
|
1702
1728
|
|
|
@@ -1715,17 +1741,17 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1715
1741
|
type = "${this.showNext?"text":"password"}"
|
|
1716
1742
|
autocomplete = "new-password"
|
|
1717
1743
|
minlength = "${8}"
|
|
1718
|
-
maxlength = "${
|
|
1744
|
+
maxlength = "${xE}"
|
|
1719
1745
|
.value = "${this.password}"
|
|
1720
1746
|
@input = "${this.handleInputChange}"
|
|
1721
1747
|
aria-invalid = "${"error"===this.tone?"true":"false"}"
|
|
1722
1748
|
aria-describedby = "pwa-new-password-hint pwa-password-status">
|
|
1723
1749
|
|
|
1724
|
-
${
|
|
1750
|
+
${KE(this.showNext,()=>{this.showNext=!this.showNext})}
|
|
1725
1751
|
|
|
1726
1752
|
</span>
|
|
1727
1753
|
|
|
1728
|
-
<p id="pwa-new-password-hint" class="hint" part="hint">${
|
|
1754
|
+
<p id="pwa-new-password-hint" class="hint" part="hint">${kE}</p>
|
|
1729
1755
|
|
|
1730
1756
|
</div>
|
|
1731
1757
|
|
|
@@ -1742,17 +1768,17 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1742
1768
|
type = "${this.showVerify?"text":"password"}"
|
|
1743
1769
|
autocomplete = "new-password"
|
|
1744
1770
|
minlength = "${8}"
|
|
1745
|
-
maxlength = "${
|
|
1771
|
+
maxlength = "${xE}"
|
|
1746
1772
|
aria-invalid = "${"error"===this.tone?"true":"false"}"
|
|
1747
1773
|
aria-describedby = "pwa-password-status">
|
|
1748
1774
|
|
|
1749
|
-
${
|
|
1775
|
+
${KE(this.showVerify,()=>{this.showVerify=!this.showVerify})}
|
|
1750
1776
|
|
|
1751
1777
|
</span>
|
|
1752
1778
|
|
|
1753
1779
|
</div>
|
|
1754
1780
|
|
|
1755
|
-
${
|
|
1781
|
+
${qE("pwa-password-status",this.message,this.tone)}
|
|
1756
1782
|
|
|
1757
1783
|
<button
|
|
1758
1784
|
type="submit"
|
|
@@ -1763,7 +1789,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1763
1789
|
|
|
1764
1790
|
</form>
|
|
1765
1791
|
|
|
1766
|
-
`}show(t){this.tone="error",this.message=
|
|
1792
|
+
`}show(t){this.tone="error",this.message=HE(t),cE(AE,t)}async alertPassword(){if(this.busy)return;const t=this.shadowRoot.querySelector("#pwa-current-password").value,e=this.shadowRoot.querySelector("#pwa-new-password").value,n=this.shadowRoot.querySelector("#pwa-verify-password").value;if(this.password=e,t.length<6)return void this.show({code:"pwa/current-password",message:"Enter your current password."});const s=ME(this.password);s?this.show(s):this.password===n?Qy.currentUser?await this.updatePass(t,this.password):this.show({code:"pwa/signed-out",message:"Sign in first."}):this.show({code:"pwa/password-mismatch",message:PE})}}Ab([ut(),Sb("design:type",String)],Rb.prototype,"message",void 0),Ab([ut(),Sb("design:type",String)],Rb.prototype,"tone",void 0),Ab([ut(),Sb("design:type",String)],Rb.prototype,"password",void 0),Ab([ut(),Sb("design:type",Boolean)],Rb.prototype,"login",void 0),Ab([ut(),Sb("design:type",Boolean)],Rb.prototype,"busy",void 0),Ab([ut(),Sb("design:type",Object)],Rb.prototype,"showCurrent",void 0),Ab([ut(),Sb("design:type",Object)],Rb.prototype,"showNext",void 0),Ab([ut(),Sb("design:type",Object)],Rb.prototype,"showVerify",void 0),customElements.define("input-password",Rb);var Nb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},xb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class kb extends(wt(Cn)(it)){constructor(){super(),this.login=!1,this.email="",this.busy=!1,this.status="",this.tone="",this.showPassword=!1,this.alertDelete=()=>{if(this.busy)return;if(!Qy.currentUser)return void this.show({code:"pwa/signed-out",message:"Sign in first."});const t=this.shadowRoot.querySelector("#pwa-delete-password").value;if(t.length<6)return void this.show({code:"pwa/current-password",message:"Enter your current password."});1==confirm("Delete Account?")&&this.officialDelete(t)},this.officialDelete=async t=>{this.busy=!0,this.tone="",this.status="";if(!await bD(t)){const t=yD();return this.tone="error",this.status=HE(t??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}const e=Qy.currentUser;if(!e)return this.show({code:"pwa/signed-out",message:"Sign in first."}),void(this.busy=!1);try{const t=e.uid;await(async t=>{const e=jy(Ky,"pwa-auth/"+t),n=await Uy(e);await Promise.all(n.items.map(t=>Vy(t)));for(const t of n.prefixes){const e=await Uy(t);await Promise.all(e.items.map(t=>Vy(t)))}})(t),await TD(),await e.delete(),cE(_E,{uid:t})}catch(t){const e=lE(t);this.tone="error",this.status=HE(t),cE(AE,e)}finally{this.busy=!1}}}stateChanged(t){this.login=t.session.login,this.email=t.session.email}static get styles(){return[UE,VE,jE,$E,JE,i`
|
|
1767
1793
|
|
|
1768
1794
|
:host {
|
|
1769
1795
|
display: grid;
|
|
@@ -1800,11 +1826,11 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1800
1826
|
aria-invalid="${"error"===this.tone?"true":"false"}"
|
|
1801
1827
|
aria-describedby="pwa-delete-status"/>
|
|
1802
1828
|
|
|
1803
|
-
${
|
|
1829
|
+
${KE(this.showPassword,()=>{this.showPassword=!this.showPassword})}
|
|
1804
1830
|
|
|
1805
1831
|
</span>
|
|
1806
1832
|
|
|
1807
|
-
${
|
|
1833
|
+
${qE("pwa-delete-status",this.status,this.tone)}
|
|
1808
1834
|
|
|
1809
1835
|
<button
|
|
1810
1836
|
type="button"
|
|
@@ -1814,7 +1840,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1814
1840
|
?disabled="${!1===this.login||this.busy}"
|
|
1815
1841
|
@click="${this.alertDelete}">${this.busy?"Deleting…":"Delete"}</button>
|
|
1816
1842
|
|
|
1817
|
-
`}show(t){this.tone="error",this.status=
|
|
1843
|
+
`}show(t){this.tone="error",this.status=HE(t),cE(AE,t)}}Nb([ut(),xb("design:type",Boolean)],kb.prototype,"login",void 0),Nb([ut(),xb("design:type",String)],kb.prototype,"email",void 0),Nb([ut(),xb("design:type",Object)],kb.prototype,"busy",void 0),Nb([ut(),xb("design:type",Object)],kb.prototype,"status",void 0),Nb([ut(),xb("design:type",Object)],kb.prototype,"tone",void 0),Nb([ut(),xb("design:type",Object)],kb.prototype,"showPassword",void 0),customElements.define("delete-user",kb);var Lb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Fb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Pb=class extends(wt(Cn)(it)){constructor(){super(),this.empty="",this.profileTopic="",this.name="",this.email="",this.login=!1,this.clipHeight="auto",this.sheetShift="none",this.rollMotion=!1,this.leaving="",this.leaveClipHeight="0px",this.leaveSheetShift="translate3d(0, 0, 0)",this.leaveMotion=!1,this.booted=!1,this.heldHeight=null,this.leaveFrom=0,this.columnWidth=0,this.columnObserver=null,this.onSubmit=t=>{t.preventDefault()},this.onFrontEnd=t=>{t instanceof TransitionEvent&&t.target===t.currentTarget&&"max-height"===t.propertyName&&this.rest()},this.onBackEnd=t=>{t instanceof TransitionEvent&&t.target===t.currentTarget&&"max-height"===t.propertyName&&(this.leaving="",this.leaveMotion=!1)}}connectedCallback(){KD(this),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Account settings"),super.connectedCallback(),this.addEventListener("submit",this.onSubmit)}disconnectedCallback(){this.removeEventListener("submit",this.onSubmit),this.columnObserver?.disconnect(),this.columnObserver=null,super.disconnectedCallback()}onTabKey(t){if("ArrowRight"!==t.key&&"ArrowLeft"!==t.key)return;t.preventDefault();const e=["profile","verification","password","delete"],n=e.indexOf(this.profileTopic),s=e[(n+("ArrowRight"===t.key?1:-1)+e.length)%e.length];Cn.dispatch(on(s)),this.updateComplete.then(()=>{this.shadowRoot?.querySelector(`button[value="${s}"]`)?.focus()})}stateChanged(t){this.profileTopic=t.session.settings,this.login=Boolean(t.session.login),this.name=t.session.name,this.email=t.session.email}static get styles(){return[Cb,_n,zE,i`
|
|
1818
1844
|
|
|
1819
1845
|
:host {
|
|
1820
1846
|
display: block;
|
|
@@ -1887,7 +1913,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1887
1913
|
}
|
|
1888
1914
|
}
|
|
1889
1915
|
|
|
1890
|
-
`]}openTab(t){
|
|
1916
|
+
`]}openTab(t){Cn.dispatch(on(t))}tabOn(t){return(this.profileTopic||"profile")===t}willUpdate(t){if(!this.booted||!this.login||t.has("login"))return;if(!t.has("profileTopic"))return;if(this.reduced())return;const e=String(t.get("profileTopic")||"");if(!e||e===this.profileTopic)return;const n=this.clipFor(e);this.leaveFrom=n?Math.ceil(n.getBoundingClientRect().height):0,this.leaving=e,this.leaveMotion=!1,this.leaveClipHeight=`${this.leaveFrom}px`,this.leaveSheetShift="translate3d(0, 0, 0)",this.rollMotion=!1,this.clipHeight="0px",this.sheetShift="translate3d(0, -100%, 0)",this.heldHeight=0}updated(t){const e=!this.booted;if(this.booted=!0,e&&this.watchColumn(),e||!t.has("profileTopic")||!this.login||t.has("login"))return;const n=this.frontClip(),s=this.sheetOf(n);if(n&&s&&null!=this.heldHeight){const t=this.heldHeight;this.heldHeight=null;const e=this.sheetPx(n,s);Math.abs(e-t)>1?this.rollLayer("front",n,s,t,e,e):this.rest()}const r=this.backClip(),i=this.sheetOf(r);if(r&&i&&this.leaving){const t=this.sheetPx(r,i),e=this.leaveFrom||t;this.rollLayer("back",r,i,e,0,t)}}watchColumn(){"undefined"!=typeof ResizeObserver&&(this.columnObserver=new ResizeObserver(()=>{const t=Math.round(this.getBoundingClientRect().width);if(t&&t!==this.columnWidth){if(this.columnWidth=t,this.rollMotion){const t=this.frontClip(),e=this.sheetOf(t);if(t&&e){const n=Math.ceil(t.getBoundingClientRect().height),s=this.sheetPx(t,e);this.rollLayer("front",t,e,n,s,s)}}if(this.leaveMotion){const t=this.backClip(),e=this.sheetOf(t);if(t&&e){const n=Math.ceil(t.getBoundingClientRect().height),s=this.sheetPx(t,e);this.rollLayer("back",t,e,n,0,s)}}}}),this.columnObserver.observe(this))}clipFor(t){return this.shadowRoot?.querySelector(`.settings-clip[data-panel="${t}"]`)??null}frontClip(){return this.clipFor(this.profileTopic||"profile")}backClip(){return this.leaving?this.clipFor(this.leaving):null}sheetOf(t){return t?.querySelector(".settings-sheet")??null}reduced(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}sheetPx(t,e){const n=t.style.transition,s=t.style.maxHeight,r=t.style.height;t.style.transition="none",t.style.maxHeight="none",t.style.height="auto";const i=Math.ceil(e.offsetHeight);return t.style.height=r,t.style.maxHeight=s,t.style.transition=n,i}rest(){this.rollMotion=!1,this.clipHeight="auto",this.sheetShift="none"}layerStyle(t,e){return{height:e,maxHeight:"auto"===e?"none":e,transition:t&&!this.reduced()?"height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out":"none"}}shiftStyle(t,e){return{transform:e,transition:t&&!this.reduced()?"transform var(--pwa_slide, 2s) ease-in-out":"none"}}clipStyle(){return this.layerStyle(this.rollMotion,this.clipHeight)}sheetStyle(){return this.shiftStyle(this.rollMotion,this.sheetShift)}leaveClipStyle(){return this.layerStyle(this.leaveMotion,this.leaveClipHeight)}leaveSheetStyle(){return this.shiftStyle(this.leaveMotion,this.leaveSheetShift)}rollLayer(t,e,n,s,r,i){const o=s-i,a=r-i,B=t=>`translate3d(0, ${t}px, 0)`;if(this.reduced()||Math.abs(r-s)<=1)return void("front"===t?this.rest():this.leaving="");e.style.transition="none",n.style.transition="none",e.style.height=`${Math.max(0,s)}px`,e.style.maxHeight=`${Math.max(0,s)}px`,n.style.transform=B(o),e.offsetHeight,e.style.transition="height var(--pwa_slide, 2s) ease-in-out, max-height var(--pwa_slide, 2s) ease-in-out",n.style.transition="transform var(--pwa_slide, 2s) ease-in-out",e.style.height=`${Math.max(0,r)}px`,e.style.maxHeight=`${Math.max(0,r)}px`,n.style.transform=B(a),"front"===t?(this.rollMotion=!0,this.clipHeight=`${Math.max(0,r)}px`,this.sheetShift=B(a)):(this.leaveMotion=!0,this.leaveClipHeight=`${Math.max(0,r)}px`,this.leaveSheetShift=B(a))}layerOf(t){return t===this.leaving?"back":this.tabOn(t)?"front":"idle"}panel(t,e){const n=this.layerOf(t),s="front"===n,r="idle"===n,i=`pwa-panel-${t}`,o=`pwa-tab-${t}`,a="profile"===t?U`
|
|
1891
1917
|
<h2>${e}</h2>
|
|
1892
1918
|
<contact-photo emptyArtwork="${this.empty}" exportparts="progress, file, preview"></contact-photo>
|
|
1893
1919
|
`:"verification"===t?U`
|
|
@@ -1914,7 +1940,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1914
1940
|
</section>
|
|
1915
1941
|
`}render(){if(!this.login)return U`
|
|
1916
1942
|
<p class="signed-out" part="signed-out" role="status">Sign in to change the photo, name, email, or password.</p>
|
|
1917
|
-
`;const t=
|
|
1943
|
+
`;const t=WD(this.name,this.email);return U`
|
|
1918
1944
|
|
|
1919
1945
|
<!-- Page Menu -->
|
|
1920
1946
|
<nav aria-label="Account" @keydown="${this.onTabKey}">
|
|
@@ -2000,7 +2026,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
2000
2026
|
`})}
|
|
2001
2027
|
</div>
|
|
2002
2028
|
|
|
2003
|
-
`}};
|
|
2029
|
+
`}};Lb([lt({type:String,reflect:!0}),Fb("design:type",Object)],Pb.prototype,"empty",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"profileTopic",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"name",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"email",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"login",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"clipHeight",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"sheetShift",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"rollMotion",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"leaving",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"leaveClipHeight",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"leaveSheetShift",void 0),Lb([ut(),Fb("design:type",Object)],Pb.prototype,"leaveMotion",void 0),Pb=Lb([at("user-settings"),Fb("design:paramtypes",[])],Pb);const Mb=i`
|
|
2004
2030
|
|
|
2005
2031
|
:host {
|
|
2006
2032
|
display: block;
|
|
@@ -2072,7 +2098,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
2072
2098
|
letter-spacing: 0.04em;
|
|
2073
2099
|
}
|
|
2074
2100
|
|
|
2075
|
-
`;var
|
|
2101
|
+
`;var Gb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ub=class extends(wt(Cn)(it)){constructor(){super(),this.subscribe=!1,this.empty="",this._user=!1,this._open=!1,this._photoURL="",this._name="",this._email=""}connectedCallback(){KD(this),super.connectedCallback()}firstUpdated(){this.shadowRoot.querySelector(".toggles").addEventListener("click",()=>{Cn.dispatch(Bn())})}stateChanged(t){this._user=t.session.login,this._open=t.session.drawer,this._photoURL=t.session.photoURL,this._name=t.session.name,this._email=t.session.email}updated(){const t=this.shadowRoot?.querySelector("button"),e=document.querySelector("user-drawer");if(!(t&&e instanceof HTMLElement&&e.id))return;t.setAttribute("aria-controls",e.id);"ariaControlsElements"in t&&(t.ariaControlsElements=[e])}static get styles(){return[Mb,i`:host { border-radius: 10px; }`]}render(){return U`
|
|
2076
2102
|
|
|
2077
2103
|
<!-- two classes: icon / login -->
|
|
2078
2104
|
<button
|
|
@@ -2088,7 +2114,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
2088
2114
|
|
|
2089
2115
|
</button>
|
|
2090
2116
|
|
|
2091
|
-
`}face(){if(this._photoURL)return U`<img class="userImage" part="photo" alt="" src="${this._photoURL}">`;const t=
|
|
2117
|
+
`}face(){if(this._photoURL)return U`<img class="userImage" part="photo" alt="" src="${this._photoURL}">`;const t=QD(this._name,this._email);return t?U`<span class="initials" part="initials" aria-hidden="true">${t}</span>`:this.empty?U`<img class="userImage" part="photo" alt="" src="${this.empty}">`:U`<span class="initials" part="initials" aria-hidden="true">?</span>`}};Gb([lt({type:Boolean,reflect:!0}),Hb("design:type",Object)],Ub.prototype,"subscribe",void 0),Gb([lt({type:String,reflect:!0}),Hb("design:type",Object)],Ub.prototype,"empty",void 0),Gb([ut(),Hb("design:type",Object)],Ub.prototype,"_user",void 0),Gb([ut(),Hb("design:type",Object)],Ub.prototype,"_open",void 0),Gb([ut(),Hb("design:type",Object)],Ub.prototype,"_photoURL",void 0),Gb([ut(),Hb("design:type",Object)],Ub.prototype,"_name",void 0),Gb([ut(),Hb("design:type",Object)],Ub.prototype,"_email",void 0),Ub=Gb([at("user-icon"),Hb("design:paramtypes",[])],Ub);var Vb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},jb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class $b extends it{constructor(){super(),this.active=!1}shouldUpdate(){return this.active}}function Jb(){Cn.dispatch(cn())}function qb(){Cn.dispatch(ln())}function zb(){Cn.dispatch(Bn())}Vb([lt({type:Boolean}),jb("design:type",Boolean)],$b.prototype,"active",void 0);var Kb=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wb=class extends $b{constructor(){super(),this.userEmail="",this.status="",this.tone="",this.invalid=!1,this.busy=!1,this.cooldown=0,this.touched=!1,this.timer=0,this.stopDraft=null,this.resetPassword=async t=>{if(t.preventDefault(),this.busy||this.cooldown>0)return;const e=this.renderRoot.querySelector(".email");this.userEmail=(e?e.value:this.userEmail).trim(),e&&e.value!==this.userEmail&&(e.value=this.userEmail);const n=(s=this.userEmail).length<4?{code:"pwa/missing-email",message:"Enter an email address."}:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)?null:{code:"pwa/invalid-email",message:"Enter a valid email address."};var s;if(n)this.showError(n,"email");else{this.busy=!0,this.tone="",this.status="";try{await Ao(Qy,this.userEmail),this.showSent()}catch(t){!function(t){return"auth/user-not-found"===lE(t).code}(t)?this.showFirebase(t):this.showSent()}finally{this.busy=!1}}},this.backToSignIn=()=>{const t=document.querySelector("user-drawer");if(t){const e=t.hasAttribute("subscribe");return Boolean(Cn.getState().session?.registerOne)!==e&&Cn.dispatch(un("drawer")),void Jb()}const e=document.querySelector("user-login");if(!e)return;const n=e.hasAttribute("subscribe");Boolean(Cn.getState().session?.registerTwo)!==n&&Cn.dispatch(un("page")),e.scrollIntoView({block:"nearest"})}}static{this.styles=[VE,jE,UE,$E,i`
|
|
2092
2118
|
:host {
|
|
2093
2119
|
display: block;
|
|
2094
2120
|
background-color: var(--pwa_background, #fff);
|
|
@@ -2131,7 +2157,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
2131
2157
|
button.new {
|
|
2132
2158
|
display: block;
|
|
2133
2159
|
}
|
|
2134
|
-
`]}connectedCallback(){var t;this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Reset password"),super.connectedCallback(),this.stopDraft=(t=()=>{this.prefill()},
|
|
2160
|
+
`]}connectedCallback(){var t;this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Reset password"),super.connectedCallback(),this.stopDraft=(t=()=>{this.prefill()},XE.add(t),()=>{XE.delete(t)}),this.prefill()}disconnectedCallback(){window.clearInterval(this.timer),this.timer=0,this.stopDraft?.(),this.stopDraft=null,super.disconnectedCallback()}updated(){this.paintEmail()}prefill(){if(this.touched)return;const t=t_();t&&t!==this.userEmail&&(this.userEmail=t,this.paintEmail())}paintEmail(){if(this.touched)return;const t=this.renderRoot.querySelector(".email");t&&!t.value&&this.userEmail&&(t.value=this.userEmail)}handleEmail(t){const e=t.target;this.touched=!0,this.userEmail=e.value,this.invalid&&(this.invalid=!1)}buttonLabel(){return this.busy?"Sending…":this.cooldown>0?`Send again in ${this.cooldown}s`:"Send reset email"}render(){const t="pwa-reset-status";return U`
|
|
2135
2161
|
|
|
2136
2162
|
<form
|
|
2137
2163
|
class="resetPass"
|
|
@@ -2181,4 +2207,4 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
2181
2207
|
|
|
2182
2208
|
</form>
|
|
2183
2209
|
|
|
2184
|
-
`}showSent(){this.tone="",this.status="If an account uses that email, a reset link is on its way.",this.invalid=!1,this.cooldown=45,this.armCooldown(),
|
|
2210
|
+
`}showSent(){this.tone="",this.status="If an account uses that email, a reset link is on its way.",this.invalid=!1,this.cooldown=45,this.armCooldown(),cE(IE,{email:this.userEmail}),this.updateComplete.then(()=>{this.focusStatus()})}showError(t,e){this.tone="error",this.status=HE(t),this.invalid="email"===e,cE(AE,t),this.updateComplete.then(()=>{this.focusAfter(e)})}showFirebase(t){const e=lE(t);this.tone="error",this.status=HE(t),this.invalid="auth/invalid-email"===e.code,cE(AE,e),this.updateComplete.then(()=>{this.focusAfter(this.invalid?"email":"status")})}focusAfter(t){"email"===t?this.focusEmail():this.focusStatus()}focusEmail(){const t=this.renderRoot.querySelector(".email");t?.focus()}focusStatus(){const t=this.renderRoot.querySelector("#pwa-reset-status");t?.focus()}armCooldown(){window.clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.cooldown<=1)return this.cooldown=0,window.clearInterval(this.timer),void(this.timer=0);this.cooldown-=1},1e3)}};function Yb(){return nE()?BE(Qy.currentUser):null}function Xb(t){let e,n=!1;return sE(()=>{n||(e=Lo(Qy,e=>{t(BE(e))}))}),()=>{n=!0,e&&e()}}Kb([ut(),Qb("design:type",String)],Wb.prototype,"userEmail",void 0),Kb([ut(),Qb("design:type",String)],Wb.prototype,"status",void 0),Kb([ut(),Qb("design:type",String)],Wb.prototype,"tone",void 0),Kb([ut(),Qb("design:type",Boolean)],Wb.prototype,"invalid",void 0),Kb([ut(),Qb("design:type",Boolean)],Wb.prototype,"busy",void 0),Kb([ut(),Qb("design:type",Number)],Wb.prototype,"cooldown",void 0),Wb=Kb([at("email-reset"),Qb("design:paramtypes",[])],Wb);export{Wb as EmailReset,fb as UserDrawer,Ub as UserIcon,ZD as UserLogin,Pb as UserSettings,qy as application,Qy as auth,qb as closeDrawer,zy as db,OD as deleteDocument,NE as eventName,Wy as firebaseConfig,Yb as getCurrentUser,iE as initialize,GD as isEmailVerified,ID as logAccount,TD as logAccountDelete,vD as logOut,Xb as onUserChanged,Jb as openDrawer,_E as pwaAccountDeleted,mE as pwaAuthChanged,AE as pwaAuthError,DD as pwaDrawerToggle,TE as pwaDrawerToggleName,bE as pwaEmailChanged,RE as pwaEmailVerified,wE as pwaLogin,yE as pwaLogout,vE as pwaPasswordChanged,DE as pwaProfileUpdated,IE as pwaResetSent,OE as pwaSettings,EE as pwaSignup,SE as pwaVerificationSent,bD as reauthenticate,MD as sendVerification,Ky as storage,zb as toggleDrawer,Yy as user,vb as userEmailChanged};
|