pwa-auth 3.7.2 → 3.7.4
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 +1 -1
- package/base/firebase/message.d.ts.map +1 -1
- package/base/firebase/message.js +3 -0
- package/base/firebase/message.js.map +1 -1
- package/base/webcomponents/settings/input/uploader.d.ts +6 -1
- package/base/webcomponents/settings/input/uploader.d.ts.map +1 -1
- package/base/webcomponents/settings/input/uploader.js +301 -84
- package/base/webcomponents/settings/input/uploader.js.map +1 -1
- package/base/webcomponents/settings/settings.d.ts +19 -4
- package/base/webcomponents/settings/settings.d.ts.map +1 -1
- package/base/webcomponents/settings/settings.js +212 -129
- package/base/webcomponents/settings/settings.js.map +1 -1
- package/package.json +1 -1
- package/source/pwa-auth.js +206 -170
package/source/pwa-auth.js
CHANGED
|
@@ -191,7 +191,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
191
191
|
margin: 0;
|
|
192
192
|
}
|
|
193
193
|
|
|
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-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BC-BB-BB-BB-BB-BB-BB-BByHBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBDCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBxHBCBBBCBBBCBBB3SBmMBkNBCBBBCBBB8MBCBBB6MB6MBCBBC+EB0MB2MBCBBB6MB+MBiGBmNBiNBCBBBmKBikzCBmNBqNBkIBsNBCBBBCBBBCBBB0NBCBBB0N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BDBHGCBCBDDBLBBGbbBOBUzZzZBYBx5BvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoqZZBbZBbZBbCCBGDBDDBCBCHBbZBbBBCDBDHBCGBcBBCDBCEBCEEBFBcZBbZBbZBbZBbZBbZBfYBiBYBiBYBiBYBiBYBiB2pE2pEBgBBvgCZBHZBHZB",!1)),White_Space:()=>new TB(SB("JEBTlDlDbgvFgvFgsCKBeBBGwBwBh9DAB",!1))});static SCRIPTS=new RB({Adlam:()=>new TB(SB("go6DrCFJFB",!0)),Ahom:()=>new TB(SB("g4lCaDOFW",!0)),Anatolian_Hieroglyphs:()=>new TB(SB("ggxCmS",!0)),Arabic:()=>new TB(SB("gwBEBCFBCNBCCBCfBCJBMZBCrDBChBBxCvBBxHhBBGqCBCcBxy8BtPBDvEBhBPBxDEBCmEBk7DeBkCFBJIBiBFBh43BDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBB",!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("gkl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DGGBDB-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:()=>new TB(SB("laA",!0)),Ll:()=>new TB(SB("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGC3HrBrBCEEJHHCCBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHxC9zC9zCBuBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBC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jBB9EKBCOBCGBCBBr3ByBB+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-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`
|
|
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-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BC-BB-BB-BB-BB-BB-BB-BByHBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBDCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBxHBCBBBCBBBCBBB3SBmMBkNBCBBBCBBB8MBCBBB6MB6MBCBBC+EB0MB2MBCBBB6MB+MBiGBmNBiNBCBBBmKBikzCBmNBqNBkIBsNBCBBBCBBBCBBB0NBCBBB0NDCBBB0NBCBBByNByNBCBBBCBBB2NBCBBDCBBCwDFCBCBDBCBCBDBCBCBDBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBB9EBCBB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UCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoqZZBbZBbZBbCCBGDBDDBCBCHBbZBbBBCDBDHBCGBcBBCDBCEBCEEBFBcZBbZBbZBbZBbZBbZBfYBiBYBiBYBiBYBiBYBiB2pE2pEBgBBvgCZBHZBHZB",!1)),White_Space:()=>new TB(SB("JEBTlDlDbgvFgvFgsCKBeBBGwBwBh9DAB",!1))});static SCRIPTS=new RB({Adlam:()=>new TB(SB("go6DrCFJFB",!0)),Ahom:()=>new TB(SB("g4lCaDOFW",!0)),Anatolian_Hieroglyphs:()=>new TB(SB("ggxCmS",!0)),Arabic:()=>new TB(SB("gwBEBCFBCNBCCBCfBCJBMZBCrDBChBBxCvBBxHhBBGqCBCcBxy8BtPBDvEBhBPBxDEBCmEBk7DeBkCFBJIBiBFBh43BDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBB",!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)),Tul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B+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:()=>new TB(SB("laA",!0)),Ll:()=>new TB(SB("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGC3HrBrBCEEJHHCCBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHxC9zC9zCBuBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoyehBB",!1)),Lt:()=>new TB(SB("kOCCBCCBCClBCCtsHHBJHBJHBMQQwBAB",!1)),Lu:()=>new T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>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`
|
|
195
195
|
|
|
196
196
|
.action-button:focus { outline: 0; }
|
|
197
197
|
|
|
@@ -1397,15 +1397,15 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1397
1397
|
padding: 20px var(--pwa_inset, 0px) 4px;
|
|
1398
1398
|
}
|
|
1399
1399
|
|
|
1400
|
-
`;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},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};
|
|
1400
|
+
`;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},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function Tb(t){return"pwa-auth/"+t+"/photo"}async function Ob(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 Ab extends(wt(bn)(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=sE.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 Ob(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=sE.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=Yy(nE,Tb(o.uid)),B={cacheControl:"public,max-age=300",contentType:i.type||"image/jpeg"},c=Ky(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 Gy(t=os(t))}(c.snapshot.ref),e=sE.currentUser;if(!e)return await Wy(a).catch(()=>{}),void this.fail({code:"pwa/signed-out",message:"Sign in first."});try{await Uo(e,{photoURL:t})}catch(t){throw await Wy(a).catch(()=>{}),t}bn.dispatch(En(t)),this.photo=t,this.progress=100,this.tone="",this.error="",this.status="Photo saved.",gE(RE,{uid:e.uid,displayName:e.displayName,photoURL:t})}catch(t){this.fail(t)}finally{this.busy=!1,this.resetPicker()}})},this.clearPhoto=async()=>{const t=sE.currentUser;if(t&&!this.busy){this.busy=!0,this.error="",this.tone="",this.status="";try{await Uo(t,{photoURL:null}),bn.dispatch(En("")),this.photo="",await Wy(Yy(nE,Tb(t.uid))).catch(()=>{}),this.status="Photo removed.",gE(RE,{uid:t.uid,displayName:t.displayName,photoURL:null})}catch(t){this.fail(t)}finally{this.busy=!1,this.resetPicker()}}}}connectedCallback(){super.connectedCallback(),uE(()=>{this.stopAuth?.(),this.stopAuth=jo(sE,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.backend.photoURL,this.person=t.backend.name,this.mail=t.backend.email}static get styles(){return[WE,ZE,i`
|
|
1401
1401
|
|
|
1402
1402
|
:host {
|
|
1403
|
+
position: relative;
|
|
1403
1404
|
box-sizing: border-box;
|
|
1404
1405
|
-webkit-box-sizing: border-box;
|
|
1405
1406
|
display: grid;
|
|
1406
|
-
|
|
1407
|
-
grid-
|
|
1408
|
-
grid-template-columns: 1fr;
|
|
1407
|
+
justify-items: center;
|
|
1408
|
+
grid-gap: 12px;
|
|
1409
1409
|
width: 100%;
|
|
1410
1410
|
max-width: min(100%, var(--pwa_max_width, 400px));
|
|
1411
1411
|
min-width: 0;
|
|
@@ -1414,96 +1414,164 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1414
1414
|
align-content: start;
|
|
1415
1415
|
}
|
|
1416
1416
|
|
|
1417
|
-
|
|
1417
|
+
/* Required - the file box matches this control. iOS anchors the picker menu to the input, so a clipped input against the page opens in the upper-left. */
|
|
1418
|
+
.chooser {
|
|
1419
|
+
position: relative;
|
|
1420
|
+
display: grid;
|
|
1421
|
+
justify-items: center;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
.file {
|
|
1425
|
+
position: absolute;
|
|
1426
|
+
top: 0;
|
|
1427
|
+
right: 0;
|
|
1428
|
+
bottom: 0;
|
|
1429
|
+
left: 0;
|
|
1430
|
+
z-index: 1;
|
|
1431
|
+
width: auto;
|
|
1432
|
+
height: auto;
|
|
1433
|
+
margin: 0;
|
|
1434
|
+
padding: 0;
|
|
1435
|
+
opacity: 0;
|
|
1436
|
+
overflow: hidden;
|
|
1437
|
+
border: 0;
|
|
1438
|
+
cursor: pointer;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
.file:focus-visible + .pick {
|
|
1442
|
+
outline: 2px solid var(--pwa_focus, #1c2430);
|
|
1443
|
+
outline-offset: 4px;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
.pick {
|
|
1447
|
+
display: grid;
|
|
1448
|
+
justify-items: center;
|
|
1449
|
+
gap: 8px;
|
|
1450
|
+
margin: 0;
|
|
1451
|
+
padding: 0;
|
|
1452
|
+
cursor: pointer;
|
|
1453
|
+
color: var(--pwa_label_text_color, #1c2430);
|
|
1454
|
+
font-size: 0.85rem;
|
|
1455
|
+
font-weight: 600;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
.file:disabled {
|
|
1459
|
+
cursor: default;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
.file:disabled + .pick {
|
|
1463
|
+
cursor: default;
|
|
1464
|
+
opacity: 0.72;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
.frame {
|
|
1468
|
+
width: 96px;
|
|
1469
|
+
height: 96px;
|
|
1418
1470
|
border-radius: 50%;
|
|
1419
1471
|
overflow: hidden;
|
|
1420
|
-
|
|
1421
|
-
border: 2px solid #303030;
|
|
1422
|
-
box-shadow: 1px 1px 2px black, 0 0 25px grey, 0 0 5px #fff;
|
|
1472
|
+
background: var(--pwa_nav_on_background, #f2f2f2);
|
|
1423
1473
|
}
|
|
1424
1474
|
|
|
1425
|
-
img
|
|
1475
|
+
.frame img,
|
|
1426
1476
|
.mark {
|
|
1427
|
-
margin: auto;
|
|
1428
|
-
height: 200px;
|
|
1429
1477
|
width: 100%;
|
|
1430
|
-
|
|
1478
|
+
height: 100%;
|
|
1431
1479
|
display: block;
|
|
1480
|
+
box-sizing: border-box;
|
|
1432
1481
|
}
|
|
1433
1482
|
|
|
1434
|
-
|
|
1435
|
-
object-fit:
|
|
1483
|
+
.frame img {
|
|
1484
|
+
object-fit: cover;
|
|
1436
1485
|
}
|
|
1437
1486
|
|
|
1438
1487
|
.mark {
|
|
1439
1488
|
display: grid;
|
|
1440
1489
|
place-items: center;
|
|
1441
|
-
font-size:
|
|
1490
|
+
font-size: 2rem;
|
|
1442
1491
|
font-weight: 600;
|
|
1443
1492
|
letter-spacing: 0.04em;
|
|
1444
1493
|
color: var(--pwa_action_background_color, #2a6b45);
|
|
1445
|
-
background: var(--pwa_nav_on_background, #f2f2f2);
|
|
1446
1494
|
}
|
|
1447
1495
|
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
<
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1496
|
+
.meter {
|
|
1497
|
+
width: 100%;
|
|
1498
|
+
height: 8px;
|
|
1499
|
+
margin: 0;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
.clear {
|
|
1503
|
+
appearance: none;
|
|
1504
|
+
border: 0;
|
|
1505
|
+
background: transparent;
|
|
1506
|
+
color: var(--pwa_close_color, #9a3b32);
|
|
1507
|
+
cursor: pointer;
|
|
1508
|
+
font: inherit;
|
|
1509
|
+
font-size: 0.85rem;
|
|
1510
|
+
font-weight: 600;
|
|
1511
|
+
text-decoration: underline;
|
|
1512
|
+
text-underline-offset: 3px;
|
|
1513
|
+
min-height: var(--pwa_tap, 44px);
|
|
1514
|
+
padding: 0 8px;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
.clear:focus-visible {
|
|
1518
|
+
outline: 2px solid var(--pwa_focus, #1c2430);
|
|
1519
|
+
outline-offset: 2px;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
.clear:disabled {
|
|
1523
|
+
cursor: default;
|
|
1524
|
+
opacity: 0.72;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
`]}letters(){return sb(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
|
+
|
|
1529
|
+
<div class="chooser">
|
|
1530
|
+
<input
|
|
1531
|
+
id="pwa-photo-file"
|
|
1532
|
+
type="file"
|
|
1533
|
+
name="photo"
|
|
1534
|
+
part="file"
|
|
1535
|
+
class="file"
|
|
1536
|
+
accept="image/*"
|
|
1537
|
+
aria-describedby="pwa-photo-status"
|
|
1538
|
+
@change="${this.saveImage}"
|
|
1539
|
+
?disabled="${n}">
|
|
1540
|
+
|
|
1541
|
+
<label class="pick" for="pwa-photo-file" part="preview">
|
|
1542
|
+
<span class="frame">
|
|
1543
|
+
${e?U`
|
|
1544
|
+
<img alt="Profile photo" src="${e}">
|
|
1545
|
+
`:t?U`
|
|
1546
|
+
<span class="mark" part="initials" aria-hidden="true">${t}</span>
|
|
1547
|
+
`:this.emptyArtwork?U`
|
|
1548
|
+
<img alt="" src="${this.emptyArtwork}">
|
|
1549
|
+
`:U`
|
|
1550
|
+
<span class="mark" part="initials" aria-hidden="true">?</span>
|
|
1551
|
+
`}
|
|
1552
|
+
</span>
|
|
1553
|
+
<span>Choose a photo</span>
|
|
1554
|
+
</label>
|
|
1555
|
+
</div>
|
|
1556
|
+
|
|
1557
|
+
<progress
|
|
1558
|
+
class="meter"
|
|
1559
|
+
part="progress"
|
|
1560
|
+
value="${this.progress}"
|
|
1561
|
+
max="100"
|
|
1562
|
+
aria-label="Upload progress"
|
|
1563
|
+
?hidden="${!this.busy}"></progress>
|
|
1564
|
+
|
|
1565
|
+
${e?U`
|
|
1566
|
+
<button
|
|
1567
|
+
type="button"
|
|
1568
|
+
class="clear"
|
|
1569
|
+
?disabled="${n}"
|
|
1570
|
+
@click="${this.clearPhoto}">Remove photo</button>
|
|
1571
|
+
`:""}
|
|
1504
1572
|
|
|
1505
1573
|
${tD("pwa-photo-status",this.error||this.status,this.tone)}
|
|
1506
|
-
`}fail(t){const e="object"==typeof t&&null!==t&&"code"in t&&"message"in t&&!(t instanceof Error)?t:mE(t);this.tone="error",this.error=KE(e),this.status="",gE(PE,e)}}vb([lt(),Ib("design:type",Object)],
|
|
1574
|
+
`}fail(t){const e="object"==typeof t&&null!==t&&"code"in t&&"message"in t&&!(t instanceof Error)?t:mE(t);this.tone="error",this.error=KE(e),this.status="",gE(PE,e)}}vb([lt(),Ib("design:type",Object)],Ab.prototype,"photo",void 0),vb([lt({type:String,reflect:!0}),Ib("design:type",Object)],Ab.prototype,"emptyArtwork",void 0),vb([ut(),Ib("design:type",Object)],Ab.prototype,"signed",void 0),vb([ut(),Ib("design:type",Object)],Ab.prototype,"person",void 0),vb([ut(),Ib("design:type",Object)],Ab.prototype,"mail",void 0),vb([ut(),Ib("design:type",Number)],Ab.prototype,"progress",void 0),vb([ut(),Ib("design:type",String)],Ab.prototype,"error",void 0),vb([ut(),Ib("design:type",String)],Ab.prototype,"status",void 0),vb([ut(),Ib("design:type",String)],Ab.prototype,"tone",void 0),vb([ut(),Ib("design:type",Object)],Ab.prototype,"busy",void 0),customElements.define("contact-photo",Ab);var Sb=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},Rb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Nb extends(wt(bn)(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=sE.currentUser;if(n){this.busy=!0,this.tone="",this.status="";try{await Uo(n,{displayName:e}),this.dirty=!1,this.draft=e,bn.dispatch(mn(e)),bn.dispatch(Bn(e)),this.status="Name saved.",gE(RE,{uid:n.uid,displayName:e,photoURL:n.photoURL})}catch(t){this.show(mE(t))}finally{this.busy=!1}}else this.show({code:"pwa/signed-out",message:"Sign in first."})}}stateChanged(t){const e=Boolean(t.frontend?.login);e!==this.login&&(this.dirty=!1),this.login=e,this.dirty||(this.draft=t.backend?.name??"")}static get styles(){return[WE,YE,QE,ZE,i`
|
|
1507
1575
|
|
|
1508
1576
|
:host, form { display: grid; align-content: start; }
|
|
1509
1577
|
|
|
@@ -1541,7 +1609,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1541
1609
|
|
|
1542
1610
|
</form>
|
|
1543
1611
|
|
|
1544
|
-
`}handleInput(t){const e=t.target;this.dirty=!0,this.draft=e.value}show(t){this.tone="error",this.status=KE(t),gE(PE,t)}}
|
|
1612
|
+
`}handleInput(t){const e=t.target;this.dirty=!0,this.draft=e.value}show(t){this.tone="error",this.status=KE(t),gE(PE,t)}}Sb([ut(),Rb("design:type",Object)],Nb.prototype,"login",void 0),Sb([ut(),Rb("design:type",Object)],Nb.prototype,"draft",void 0),Sb([ut(),Rb("design:type",Object)],Nb.prototype,"busy",void 0),Sb([ut(),Rb("design:type",Object)],Nb.prototype,"status",void 0),Sb([ut(),Rb("design:type",Object)],Nb.prototype,"tone",void 0),customElements.define("input-name",Nb);const xb="userEmailChanged";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},Lb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Fb extends(wt(bn)(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=sE.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 N_(n)){const t=O_();return this.tone="error",this.status=KE(t??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}try{const t=cE();t?await Ho(e,s.value,t):await Ho(e,s.value);const n={email:s.value};if(gE(NE,n),function(t){window.dispatchEvent(new CustomEvent(xb,{detail:t,bubbles:!0,composed:!0}))}(n),this.tone="",this.status="Check your inbox to confirm the new address.",!e.emailVerified)try{await q_()}catch{}}catch(t){const e=mE(t);this.tone="error",this.status=KE(t),gE(PE,e)}finally{this.busy=!1}}}stateChanged(t){this.login=t.frontend.login,this.mail=t.backend.email}handleEmail(t){const e=t.target;this.mail=e.value}static get styles(){return[WE,YE,QE,XE,ZE,i`
|
|
1545
1613
|
|
|
1546
1614
|
:host, form { display: grid; align-content: start; }
|
|
1547
1615
|
|
|
@@ -1598,7 +1666,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1598
1666
|
|
|
1599
1667
|
</form>
|
|
1600
1668
|
|
|
1601
|
-
`}show(t){this.tone="error",this.status=KE(t),gE(PE,t)}}
|
|
1669
|
+
`}show(t){this.tone="error",this.status=KE(t),gE(PE,t)}}kb([lt({type:String,reflect:!0}),Lb("design:type",Object)],Fb.prototype,"email",void 0),kb([ut(),Lb("design:type",Boolean)],Fb.prototype,"login",void 0),kb([ut(),Lb("design:type",String)],Fb.prototype,"mail",void 0),kb([ut(),Lb("design:type",Object)],Fb.prototype,"busy",void 0),kb([ut(),Lb("design:type",Object)],Fb.prototype,"status",void 0),kb([ut(),Lb("design:type",Object)],Fb.prototype,"tone",void 0),kb([ut(),Lb("design:type",Object)],Fb.prototype,"showPassword",void 0),customElements.define("contact-email",Fb);var Pb=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)};class Gb extends(wt(bn)(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=sE.currentUser;if(!n)return void this.show({code:"pwa/signed-out",message:"Sign in first."});this.busy=!0,this.tone="",this.message="";if(!await N_(t)){const t=O_();return this.tone="error",this.message=KE(t??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}try{await Vo(n,e),this.tone="",this.message="Password saved.",gE(xE,{uid:n.uid})}catch(t){const e=mE(t);this.tone="error",this.message=KE(t),gE(PE,e)}finally{this.busy=!1}}}stateChanged(t){this.login=t.frontend.login}handleInputChange(t){const e=t.target;this.password=e.value}static get styles(){return[WE,YE,QE,XE,ZE,i`
|
|
1602
1670
|
|
|
1603
1671
|
:host{
|
|
1604
1672
|
display: grid;
|
|
@@ -1695,7 +1763,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1695
1763
|
|
|
1696
1764
|
</form>
|
|
1697
1765
|
|
|
1698
|
-
`}show(t){this.tone="error",this.message=KE(t),gE(PE,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=qE(this.password);s?this.show(s):this.password===n?sE.currentUser?await this.updatePass(t,this.password):this.show({code:"pwa/signed-out",message:"Sign in first."}):this.show({code:"pwa/password-mismatch",message:JE})}}
|
|
1766
|
+
`}show(t){this.tone="error",this.message=KE(t),gE(PE,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=qE(this.password);s?this.show(s):this.password===n?sE.currentUser?await this.updatePass(t,this.password):this.show({code:"pwa/signed-out",message:"Sign in first."}):this.show({code:"pwa/password-mismatch",message:JE})}}Pb([ut(),Mb("design:type",String)],Gb.prototype,"message",void 0),Pb([ut(),Mb("design:type",String)],Gb.prototype,"tone",void 0),Pb([ut(),Mb("design:type",String)],Gb.prototype,"password",void 0),Pb([ut(),Mb("design:type",Boolean)],Gb.prototype,"login",void 0),Pb([ut(),Mb("design:type",Boolean)],Gb.prototype,"busy",void 0),Pb([ut(),Mb("design:type",Object)],Gb.prototype,"showCurrent",void 0),Pb([ut(),Mb("design:type",Object)],Gb.prototype,"showNext",void 0),Pb([ut(),Mb("design:type",Object)],Gb.prototype,"showVerify",void 0),customElements.define("input-password",Gb);var Hb=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 Vb extends(wt(bn)(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(!sE.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 N_(t)){const t=O_();return this.tone="error",this.status=KE(t??{code:"pwa/unknown",message:"Something went wrong. Try again."}),void(this.busy=!1)}const e=sE.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=Yy(nE,"pwa-auth/"+t),n=await Qy(e);await Promise.all(n.items.map(t=>Wy(t)));for(const t of n.prefixes){const e=await Qy(t);await Promise.all(e.items.map(t=>Wy(t)))}})(t),await L_(),await e.delete(),gE(SE,{uid:t})}catch(t){const e=mE(t);this.tone="error",this.status=KE(t),gE(PE,e)}finally{this.busy=!1}}}stateChanged(t){this.login=t.frontend.login,this.email=t.backend.email}static get styles(){return[QE,WE,YE,XE,ZE,i`
|
|
1699
1767
|
|
|
1700
1768
|
:host {
|
|
1701
1769
|
display: grid;
|
|
@@ -1746,7 +1814,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1746
1814
|
?disabled="${!1===this.login||this.busy}"
|
|
1747
1815
|
@click="${this.alertDelete}">${this.busy?"Deleting…":"Delete"}</button>
|
|
1748
1816
|
|
|
1749
|
-
`}show(t){this.tone="error",this.status=KE(t),gE(PE,t)}}
|
|
1817
|
+
`}show(t){this.tone="error",this.status=KE(t),gE(PE,t)}}Hb([ut(),Ub("design:type",Boolean)],Vb.prototype,"login",void 0),Hb([ut(),Ub("design:type",String)],Vb.prototype,"email",void 0),Hb([ut(),Ub("design:type",Object)],Vb.prototype,"busy",void 0),Hb([ut(),Ub("design:type",Object)],Vb.prototype,"status",void 0),Hb([ut(),Ub("design:type",Object)],Vb.prototype,"tone",void 0),Hb([ut(),Ub("design:type",Object)],Vb.prototype,"showPassword",void 0),customElements.define("delete-user",Vb);var jb=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},$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Jb=class extends(wt(bn)(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(){nb(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];bn.dispatch(on(s)),this.updateComplete.then(()=>{this.shadowRoot?.querySelector(`button[value="${s}"]`)?.focus()})}stateChanged(t){this.profileTopic=t.frontend.settings,this.login=Boolean(t.frontend?.login),this.name=t.backend.name,this.email=t.backend.email}static get styles(){return[bb,Sn,eD,i`
|
|
1750
1818
|
|
|
1751
1819
|
:host {
|
|
1752
1820
|
display: block;
|
|
@@ -1763,13 +1831,25 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1763
1831
|
:host { --pwa_slide: 0s; }
|
|
1764
1832
|
}
|
|
1765
1833
|
|
|
1766
|
-
/* Required - this settings roll only.
|
|
1834
|
+
/* Required - this settings roll only. The two clips share one cell so the
|
|
1835
|
+
stage is as tall as the lower edge, and the incoming clip paints in front. */
|
|
1836
|
+
.settings-stage {
|
|
1837
|
+
display: grid;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1767
1840
|
.settings-clip {
|
|
1841
|
+
grid-area: 1 / 1;
|
|
1842
|
+
align-self: start;
|
|
1843
|
+
justify-self: stretch;
|
|
1768
1844
|
display: block;
|
|
1769
1845
|
overflow: hidden;
|
|
1770
1846
|
min-height: 0;
|
|
1847
|
+
width: 100%;
|
|
1771
1848
|
}
|
|
1772
1849
|
|
|
1850
|
+
.settings-clip.is-front { z-index: 2; }
|
|
1851
|
+
.settings-clip.is-back { z-index: 1; }
|
|
1852
|
+
|
|
1773
1853
|
.settings-sheet {
|
|
1774
1854
|
display: block;
|
|
1775
1855
|
height: auto;
|
|
@@ -1778,6 +1858,11 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1778
1858
|
background-color: var(--pwa_background, var(--pwa_settings_background_color, #fff));
|
|
1779
1859
|
}
|
|
1780
1860
|
|
|
1861
|
+
/* Required - an inactive tab stays fully behind the fold. */
|
|
1862
|
+
.settings-sheet > section[hidden] {
|
|
1863
|
+
display: none !important;
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1781
1866
|
form {
|
|
1782
1867
|
box-sizing: border-box;
|
|
1783
1868
|
display: grid;
|
|
@@ -1802,7 +1887,32 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1802
1887
|
}
|
|
1803
1888
|
}
|
|
1804
1889
|
|
|
1805
|
-
`]}openTab(t){bn.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;const e=
|
|
1890
|
+
`]}openTab(t){bn.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
|
+
<h2>${e}</h2>
|
|
1892
|
+
<contact-photo emptyArtwork="${this.empty}" exportparts="progress, file, preview"></contact-photo>
|
|
1893
|
+
`:"verification"===t?U`
|
|
1894
|
+
<h2>Contact Information</h2>
|
|
1895
|
+
<email-verify exportparts="notice, status: verify-status, submit: verify-submit, verified, unverified"></email-verify>
|
|
1896
|
+
<input-name exportparts="name, submit: name-submit"></input-name>
|
|
1897
|
+
<contact-email exportparts="email, submit: email-submit"></contact-email>
|
|
1898
|
+
`:"password"===t?U`
|
|
1899
|
+
<h2>Password</h2>
|
|
1900
|
+
<input-password exportparts="password, verify, submit: password-submit"></input-password>
|
|
1901
|
+
`:U`
|
|
1902
|
+
<h2>Delete Account</h2>
|
|
1903
|
+
<delete-user exportparts="submit: delete"></delete-user>
|
|
1904
|
+
`;return U`
|
|
1905
|
+
<section
|
|
1906
|
+
id="${i}"
|
|
1907
|
+
part="panel"
|
|
1908
|
+
role="tabpanel"
|
|
1909
|
+
aria-labelledby="${o}"
|
|
1910
|
+
aria-hidden="${s?"false":"true"}"
|
|
1911
|
+
?inert="${!s}"
|
|
1912
|
+
?hidden="${r}">
|
|
1913
|
+
${a}
|
|
1914
|
+
</section>
|
|
1915
|
+
`}render(){if(!this.login)return U`
|
|
1806
1916
|
<p class="signed-out" part="signed-out" role="status">Sign in to change the photo, name, email, or password.</p>
|
|
1807
1917
|
`;const t=rb(this.name,this.email);return U`
|
|
1808
1918
|
|
|
@@ -1876,95 +1986,21 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1876
1986
|
</nav>
|
|
1877
1987
|
|
|
1878
1988
|
|
|
1879
|
-
<div
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
aria-labelledby="pwa-tab-profile"
|
|
1892
|
-
aria-hidden="${this.tabOn("profile")?"false":"true"}"
|
|
1893
|
-
?inert="${!this.tabOn("profile")}"
|
|
1894
|
-
?hidden="${!this.tabOn("profile")}">
|
|
1895
|
-
|
|
1896
|
-
<!-- Display Username -->
|
|
1897
|
-
<h2>${t}</h2>
|
|
1898
|
-
|
|
1899
|
-
<!-- Custom Image Element - Display / Upload -->
|
|
1900
|
-
<contact-photo emptyArtwork="${this.empty}" exportparts="progress, file, preview"></contact-photo>
|
|
1901
|
-
|
|
1902
|
-
</section>
|
|
1903
|
-
|
|
1904
|
-
<!-- Page 2: Verification -->
|
|
1905
|
-
<section
|
|
1906
|
-
id="pwa-panel-verification"
|
|
1907
|
-
part="panel"
|
|
1908
|
-
role="tabpanel"
|
|
1909
|
-
aria-labelledby="pwa-tab-verification"
|
|
1910
|
-
aria-hidden="${this.tabOn("verification")?"false":"true"}"
|
|
1911
|
-
?inert="${!this.tabOn("verification")}"
|
|
1912
|
-
?hidden="${!this.tabOn("verification")}">
|
|
1913
|
-
|
|
1914
|
-
<!-- Page Title -->
|
|
1915
|
-
<h2>Contact Information</h2>
|
|
1916
|
-
|
|
1917
|
-
<!-- Required - unverified notice. Sign-in stays open. -->
|
|
1918
|
-
<email-verify exportparts="notice, status: verify-status, submit: verify-submit, verified, unverified"></email-verify>
|
|
1919
|
-
|
|
1920
|
-
<!-- Custom - Username -->
|
|
1921
|
-
<input-name exportparts="name, submit: name-submit"></input-name>
|
|
1922
|
-
|
|
1923
|
-
<!-- Custom - Email -->
|
|
1924
|
-
<contact-email exportparts="email, submit: email-submit"></contact-email>
|
|
1925
|
-
|
|
1926
|
-
</section>
|
|
1927
|
-
|
|
1928
|
-
<!-- Page 3: Password -->
|
|
1929
|
-
<section
|
|
1930
|
-
id="pwa-panel-password"
|
|
1931
|
-
part="panel"
|
|
1932
|
-
role="tabpanel"
|
|
1933
|
-
aria-labelledby="pwa-tab-password"
|
|
1934
|
-
aria-hidden="${this.tabOn("password")?"false":"true"}"
|
|
1935
|
-
?inert="${!this.tabOn("password")}"
|
|
1936
|
-
?hidden="${!this.tabOn("password")}">
|
|
1937
|
-
|
|
1938
|
-
<!-- Page Title -->
|
|
1939
|
-
<h2>Password</h2>
|
|
1940
|
-
|
|
1941
|
-
<!-- Custom - Password -->
|
|
1942
|
-
<input-password exportparts="password, verify, submit: password-submit"></input-password>
|
|
1943
|
-
|
|
1944
|
-
</section>
|
|
1945
|
-
|
|
1946
|
-
<!-- Page 4: Delete -->
|
|
1947
|
-
<section
|
|
1948
|
-
id="pwa-panel-delete"
|
|
1949
|
-
part="panel"
|
|
1950
|
-
role="tabpanel"
|
|
1951
|
-
aria-labelledby="pwa-tab-delete"
|
|
1952
|
-
aria-hidden="${this.tabOn("delete")?"false":"true"}"
|
|
1953
|
-
?inert="${!this.tabOn("delete")}"
|
|
1954
|
-
?hidden="${!this.tabOn("delete")}">
|
|
1955
|
-
|
|
1956
|
-
<!-- Page Title -->
|
|
1957
|
-
<h2>Delete Account</h2>
|
|
1958
|
-
|
|
1959
|
-
<!-- Custom - Delete -->
|
|
1960
|
-
<delete-user exportparts="submit: delete"></delete-user>
|
|
1961
|
-
|
|
1962
|
-
</section>
|
|
1963
|
-
|
|
1964
|
-
</div>
|
|
1989
|
+
<div class="settings-stage">
|
|
1990
|
+
${["profile","verification","password","delete"].map(e=>{const n=this.layerOf(e);return U`
|
|
1991
|
+
<div
|
|
1992
|
+
class="settings-clip ${"front"===n?"is-front":"back"===n?"is-back":""}"
|
|
1993
|
+
data-panel="${e}"
|
|
1994
|
+
style=${mt("back"===n?this.leaveClipStyle():"front"===n?this.clipStyle():{height:"0px",maxHeight:"0px",transition:"none"})}
|
|
1995
|
+
@transitionend=${"back"===n?this.onBackEnd:this.onFrontEnd}>
|
|
1996
|
+
<div class="settings-sheet" style=${mt("back"===n?this.leaveSheetStyle():"front"===n?this.sheetStyle():{transform:"translate3d(0, -100%, 0)",transition:"none"})}>
|
|
1997
|
+
${this.panel(e,t)}
|
|
1998
|
+
</div>
|
|
1999
|
+
</div>
|
|
2000
|
+
`})}
|
|
1965
2001
|
</div>
|
|
1966
2002
|
|
|
1967
|
-
`}};
|
|
2003
|
+
`}};jb([lt({type:String,reflect:!0}),$b("design:type",Object)],Jb.prototype,"empty",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"profileTopic",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"name",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"email",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"login",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"clipHeight",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"sheetShift",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"rollMotion",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"leaving",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"leaveClipHeight",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"leaveSheetShift",void 0),jb([ut(),$b("design:type",Object)],Jb.prototype,"leaveMotion",void 0),Jb=jb([at("user-settings"),$b("design:paramtypes",[])],Jb);const qb=i`
|
|
1968
2004
|
|
|
1969
2005
|
:host {
|
|
1970
2006
|
display: block;
|
|
@@ -2036,7 +2072,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
2036
2072
|
letter-spacing: 0.04em;
|
|
2037
2073
|
}
|
|
2038
2074
|
|
|
2039
|
-
`;var
|
|
2075
|
+
`;var zb=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},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Qb=class extends(wt(bn)(it)){constructor(){super(),this.subscribe=!1,this.empty="",this._user=!1,this._open=!1,this._photoURL="",this._name="",this._email=""}connectedCallback(){nb(this),super.connectedCallback()}firstUpdated(){this.shadowRoot.querySelector(".toggles").addEventListener("click",()=>{bn.dispatch(ln())})}stateChanged(t){this._user=t.frontend.login,this._open=t.frontend.drawer,this._photoURL=t.backend.photoURL,this._name=t.backend.name,this._email=t.backend.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[qb,i`:host { border-radius: 10px; }`]}render(){return U`
|
|
2040
2076
|
|
|
2041
2077
|
<!-- two classes: icon / login -->
|
|
2042
2078
|
<button
|
|
@@ -2052,7 +2088,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
2052
2088
|
|
|
2053
2089
|
</button>
|
|
2054
2090
|
|
|
2055
|
-
`}face(){if(this._photoURL)return U`<img class="userImage" part="photo" alt="" src="${this._photoURL}">`;const t=sb(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>`}};
|
|
2091
|
+
`}face(){if(this._photoURL)return U`<img class="userImage" part="photo" alt="" src="${this._photoURL}">`;const t=sb(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>`}};zb([lt({type:Boolean,reflect:!0}),Kb("design:type",Object)],Qb.prototype,"subscribe",void 0),zb([lt({type:String,reflect:!0}),Kb("design:type",Object)],Qb.prototype,"empty",void 0),zb([ut(),Kb("design:type",Object)],Qb.prototype,"_user",void 0),zb([ut(),Kb("design:type",Object)],Qb.prototype,"_open",void 0),zb([ut(),Kb("design:type",Object)],Qb.prototype,"_photoURL",void 0),zb([ut(),Kb("design:type",Object)],Qb.prototype,"_name",void 0),zb([ut(),Kb("design:type",Object)],Qb.prototype,"_email",void 0),Qb=zb([at("user-icon"),Kb("design:paramtypes",[])],Qb);var Wb=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},Yb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Xb extends it{constructor(){super(),this.active=!1}shouldUpdate(){return this.active}}function Zb(){bn.dispatch(un())}function tv(){bn.dispatch(hn())}function ev(){bn.dispatch(ln())}Wb([lt({type:Boolean}),Yb("design:type",Boolean)],Xb.prototype,"active",void 0);var nv=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},sv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rv=class extends Xb{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 Po(sE,this.userEmail),this.showSent()}catch(t){!function(t){return"auth/user-not-found"===mE(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(bn.getState().frontend?.registerOne)!==e&&bn.dispatch(rn("drawer")),void Zb()}const e=document.querySelector("user-login");if(!e)return;const n=e.hasAttribute("subscribe");Boolean(bn.getState().frontend?.registerTwo)!==n&&bn.dispatch(rn("page")),e.scrollIntoView({block:"nearest"})}}static{this.styles=[WE,YE,QE,XE,i`
|
|
2056
2092
|
:host {
|
|
2057
2093
|
display: block;
|
|
2058
2094
|
background-color: var(--pwa_background, #fff);
|
|
@@ -2145,4 +2181,4 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
2145
2181
|
|
|
2146
2182
|
</form>
|
|
2147
2183
|
|
|
2148
|
-
`}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(),gE(kE,{email:this.userEmail}),this.updateComplete.then(()=>{this.focusStatus()})}showError(t,e){this.tone="error",this.status=KE(t),this.invalid="email"===e,gE(PE,t),this.updateComplete.then(()=>{this.focusAfter(e)})}showFirebase(t){const e=mE(t);this.tone="error",this.status=KE(t),this.invalid="auth/invalid-email"===e.code,gE(PE,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
|
|
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(),gE(kE,{email:this.userEmail}),this.updateComplete.then(()=>{this.focusStatus()})}showError(t,e){this.tone="error",this.status=KE(t),this.invalid="email"===e,gE(PE,t),this.updateComplete.then(()=>{this.focusAfter(e)})}showFirebase(t){const e=mE(t);this.tone="error",this.status=KE(t),this.invalid="auth/invalid-email"===e.code,gE(PE,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 iv(){return lE()?CE(sE.currentUser):null}function ov(t){let e,n=!1;return uE(()=>{n||(e=jo(sE,e=>{t(CE(e))}))}),()=>{n=!0,e&&e()}}nv([ut(),sv("design:type",String)],rv.prototype,"userEmail",void 0),nv([ut(),sv("design:type",String)],rv.prototype,"status",void 0),nv([ut(),sv("design:type",String)],rv.prototype,"tone",void 0),nv([ut(),sv("design:type",Boolean)],rv.prototype,"invalid",void 0),nv([ut(),sv("design:type",Boolean)],rv.prototype,"busy",void 0),nv([ut(),sv("design:type",Number)],rv.prototype,"cooldown",void 0),rv=nv([at("email-reset"),sv("design:paramtypes",[])],rv);export{rv as EmailReset,_b as UserDrawer,Qb as UserIcon,ab as UserLogin,Jb as UserSettings,tE as application,sE as auth,tv as closeDrawer,eE as db,F_ as deleteDocument,HE as eventName,rE as firebaseConfig,iv as getCurrentUser,dE as initialize,z_ as isEmailVerified,k_ as logAccount,L_ as logAccountDelete,x_ as logOut,ov as onUserChanged,Zb as openDrawer,SE as pwaAccountDeleted,IE as pwaAuthChanged,PE as pwaAuthError,R_ as pwaDrawerToggle,LE as pwaDrawerToggleName,NE as pwaEmailChanged,GE as pwaEmailVerified,TE as pwaLogin,OE as pwaLogout,xE as pwaPasswordChanged,RE as pwaProfileUpdated,kE as pwaResetSent,FE as pwaSettings,AE as pwaSignup,ME as pwaVerificationSent,N_ as reauthenticate,q_ as sendVerification,nE as storage,ev as toggleDrawer,iE as user,xb as userEmailChanged};
|