vendor: 4,617 bytes, lines 1-2
1/*! For license information please see 70066.1788868624859.js.LICENSE.txt */ 2"use strict";(globalThis.webpackChunkweb||=[]).push([[70066],{53607(e,t,n){n.d(t,{cY:()=>p,FA:()=>D,g:()=>O,u:()=>o,Uj:()=>a,Fy:()=>m,tD:()=>U,bD:()=>x,hp:()=>V,T9:()=>d,Tj:()=>l,yU:()=>h,XA:()=>f,mS:()=>c,Ku:()=>q,ZQ:()=>g,Bd:()=>_,sr:()=>I,zJ:()=>z,c1:()=>E,Im:()=>k,lT:()=>b,zW:()=>C,jZ:()=>y,lV:()=>T,nr:()=>S,Ov:()=>A,p7:()=>v,gE:()=>j,Am:()=>L,I9:()=>M,eX:()=>N});const r=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=63&s|128):55296==(64512&s)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=63&s|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=63&s|128)}return t},s={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){const s=e[t],i=t+1<e.length,a=i?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,u=s>>2,l=(3&s)<<4|a>>4;let h=(15&a)<<2|c>>6,d=63&c;o||(d=64,i||(h=64)),r.push(n[u],n[l],n[h],n[d])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(r(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=e[n++];t[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],a=e[n++];t[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){const s=n[e.charAt(t++)],a=t<e.length?n[e.charAt(t)]:0;++t;const o=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==s||null==a||null==o||null==c)throw new i;const u=s<<2|a>>4;if(r.push(u),64!==o){const e=a<<4&240|o>>2;if(r.push(e),64!==c){const e=o<<6&192|c;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class i extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const a=function(e){return function(e){const t=r(e);return s.encodeByteArray(t,!0)}(e).replace(/\./g,"")},o=function(e){try{return s.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function c(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof globalThis)return globalThis;throw new Error("Unable to locate global object.")}const u=()=>{try{return c().__FIREBASE_DEFAULTS__||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&o(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},l=e=>u()?.emulatorHosts?.[e],h=e=>{const t=l(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]},d=()=>u()?.config,f=e=>u()?.[`_${e}`];class p{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>
2{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}function m(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",r=e.iat||0,s=e.sub||e.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i={iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}},...e};return[a(JSON.stringify({alg:"none",type:"JWT"})),a(JSON.stringify(i)),""].join(".")}function g(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function y(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(g())}function w(){const e=u()?.forceEnvironment;if("node"===e)return!0;if("browser"===e)return!1;try{return"[object process]"===Object.prototype.toString.call(globalThis.process)}catch(e){return!1}}function _(){return"undefined"!=typeof window||v()}function v(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function E(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent}function I(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function T(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function b(){const e=g();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function S(){return!w()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function A(){return!w()&&!!navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function C(){try{return"object"==typeof indexedDB}catch(e){return!1}}function N(){return new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{t(s.error?.message||"")}}catch(e){t(e)}})}class O extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,O.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,D.prototype.create)}}class D{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,s=this.errors[e],i=s?function(e,t){return e.replace(R,(e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`})}(s,n):"Error",a=`${this.serviceName}: ${i} (${r}).`;return new O(r,a,n)}}const R=/\{\$([^}]+)}/g;function k(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function x(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const s of n){if(!r.includes(s))return!1;const n=e[s],i=t[s];if(P(n)&&P(i)){if(!x(n,i))return!1}else if(n!==i)return!1}for(const e of r)if(!n.includes(e))return!1;return!0}function P(e){return null!==e&&"object"==typeof e}function L(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function M(e){const t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){const[n,r]=e.split("=");
2t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t}function V(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}function U(e,t){const n=new F(e,t);return n.subscribe.bind(n)}class F{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=B),void 0===r.error&&(r.error=B),void 0===r.complete&&(r.complete=B);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}}),this.observers.push(r),s}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function B(){}function q(e){return e&&e._delegate?e._delegate:e}function z(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function j(e){return(await fetch(e,{credentials:"include"})).ok}},3849(e,t,n){n.d(t,{g:()=>i.g,MF:()=>ye,iF:()=>X,yi:()=>re,mq:()=>se,SV:()=>ee,HG:()=>he,yX:()=>ne,j6:()=>ae,U6:()=>ce,xZ:()=>le,Mw:()=>ue,om:()=>ie,Us:()=>oe,Tj:()=>te,NM:()=>Ie,Sx:()=>ve,Dk:()=>Ee,Wp:()=>we,pN:()=>_e,aP:()=>be,KO:()=>Te,He:()=>Se});var r=n(87594),s=n(7664),i=n(53607);let a,o;const c=new WeakMap,u=new WeakMap,l=new WeakMap,h=new WeakMap,d=new WeakMap;let f={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return u.get(e);if("objectStoreNames"===t)return e.objectStoreNames||l.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return g(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function p(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(o||(o=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(y(this),t),g(c.get(this))}:function(...t){return g(e.apply(y(this),t))}:function(t,...n){const r=e.call(y(this),t,...n);return l.set(r,t.sort?t.sort():[t]),g(r)}}function m(e){return"function"==typeof e?p(e):(e instanceof IDBTransaction&&function(e){if(u.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",i),e.removeEventListener("abort",i)},s=()=>{t(),r()},i=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",s),e.addEventListener("error",i),e.addEventListener("abort",i)});u.set(e,t)}(e),t=e,(a||(a=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,f):e);var t}function g(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",s),e.removeEventListener("error",i)},s=()=>{t(g(e.result)),r()},i=()=>{n(e.error),r()};e.addEventListener("success",s),e.addEventListener("error",i)});return t.then(t=>{t instanceof IDBCursor&&c.set(t,e)}).catch(()=>{}),d.set(t,e),t}(e);if(h.has(e))return h.get(e);const t=m(e);return t!==e&&(h.set(e,t),d.set(t,e)),t}const y=e=>d.get(e);const w=["get","getKey","getAll","getAllKeys","count"],_=["put","add","delete","clear"],v=new Map;function E(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(v.get(t))return v.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=_.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!w.includes(n))return;const i=async function(e,...t){const i=this.transaction(e,s?"readwrite":"readonly");let a=i.store;
2return r&&(a=a.index(t.shift())),(await Promise.all([a[n](...t),s&&i.done]))[0]};return v.set(t,i),i}f=(e=>({...e,get:(t,n,r)=>E(t,n)||e.get(t,n,r),has:(t,n)=>!!E(t,n)||e.has(t,n)}))(f);class I{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===t?.type}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const T="@firebase/app",b="0.15.0",S=new s.Vy("@firebase/app"),A="@firebase/app-compat",C="@firebase/analytics-compat",N="@firebase/analytics",O="@firebase/app-check-compat",D="@firebase/app-check",R="@firebase/auth",k="@firebase/auth-compat",x="@firebase/database",P="@firebase/data-connect",L="@firebase/database-compat",M="@firebase/functions",V="@firebase/functions-compat",U="@firebase/installations",F="@firebase/installations-compat",B="@firebase/messaging",q="@firebase/messaging-compat",z="@firebase/performance",j="@firebase/performance-compat",G="@firebase/remote-config",$="@firebase/remote-config-compat",H="@firebase/storage",K="@firebase/storage-compat",W="@firebase/firestore",Y="@firebase/ai",Q="@firebase/firestore-compat",J="firebase",X="[DEFAULT]",Z={[T]:"fire-core",[A]:"fire-core-compat",[N]:"fire-analytics",[C]:"fire-analytics-compat",[D]:"fire-app-check",[O]:"fire-app-check-compat",[R]:"fire-auth",[k]:"fire-auth-compat",[x]:"fire-rtdb",[P]:"fire-data-connect",[L]:"fire-rtdb-compat",[M]:"fire-fn",[V]:"fire-fn-compat",[U]:"fire-iid",[F]:"fire-iid-compat",[B]:"fire-fcm",[q]:"fire-fcm-compat",[z]:"fire-perf",[j]:"fire-perf-compat",[G]:"fire-rc",[$]:"fire-rc-compat",[H]:"fire-gcs",[K]:"fire-gcs-compat",[W]:"fire-fst",[Q]:"fire-fst-compat",[Y]:"fire-vertex","fire-js":"fire-js",[J]:"fire-js-all"},ee=new Map,te=new Map,ne=new Map;function re(e,t){try{e.container.addComponent(t)}catch(n){S.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function se(e,t){e.container.addOrOverwriteComponent(t)}function ie(e){const t=e.name;if(ne.has(t))return S.debug(`There were multiple attempts to register component ${t}.`),!1;ne.set(t,e);for(const t of ee.values())re(t,e);for(const t of te.values())re(t,e);return!0}function ae(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function oe(e,t,n=X){ae(e,t).clearInstance(n)}function ce(e){return void 0!==e.options}function ue(e){return!ce(e)&&("authIdToken"in e||"appCheckToken"in e||"releaseOnDeref"in e||"automaticDataCollectionEnabled"in e)}function le(e){return null!=e&&void 0!==e.settings}function he(){ne.clear()}const de={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invali
2d-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."},fe=new i.FA("app","Firebase",de);class pe{constructor(e,t,n){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new r.uA("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw fe.create("app-deleted",{appName:this._name})}}function me(e,t){const n=(0,i.u)(e.split(".")[1]);if(null===n)return void console.error(`FirebaseServerApp ${t} is invalid: second part could not be parsed.`);if(void 0===JSON.parse(n).exp)return void console.error(`FirebaseServerApp ${t} is invalid: expiration claim could not be parsed`);1e3*JSON.parse(n).exp-(new Date).getTime()<=0&&console.error(`FirebaseServerApp ${t} is invalid: the token has expired.`)}class ge extends pe{constructor(e,t,n,r){const s=void 0===t.automaticDataCollectionEnabled||t.automaticDataCollectionEnabled,i={name:n,automaticDataCollectionEnabled:s};if(void 0!==e.apiKey)super(e,i,r);else{super(e.options,i,r)}this._serverConfig={automaticDataCollectionEnabled:s,...t},this._serverConfig.authIdToken&&me(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&me(this._serverConfig.appCheckToken,"appCheckToken"),this._finalizationRegistry=null,"undefined"!=typeof FinalizationRegistry&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,t.releaseOnDeref=void 0,Te(T,b,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,void 0!==e&&null!==this._finalizationRegistry&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){Ie(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw fe.create("server-app-deleted")}}const ye="12.15.0";function we(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const s={name:X,automaticDataCollectionEnabled:!0,...t},a=s.name;if("string"!=typeof a||!a)throw fe.create("bad-app-name",{appName:String(a)});if(n||(n=(0,i.T9)()),!n)throw fe.create("no-options");const o=ee.get(a);if(o){if((0,i.bD)(n,o.options)&&(0,i.bD)(s,o.config))return o;throw fe.create("duplicate-app",{appName:a})}const c=new r.h1(a);for(const e of ne.values())c.addComponent(e);const u=new pe(n,s,c);return ee.set(a,u),u}function _e(e,t={}){if((0,i.Bd)()&&!(0,i.p7)())throw fe.create("invalid-server-app-environment");let n,s=t||{};if(e&&(ce(e)?n=e.options:ue(e)?s=e:n=e),void 0===s.automaticDataCollectionEnabled&&(s.automaticDataCollectionEnabled=!0),n||(n=(0,i.T9)()),!n)throw fe.create("no-options");const a={...s,...n};void 0!==a.releaseOnDeref&&delete a.releaseOnDeref;if(void 0!==s.releaseOnDeref&&"undefined"==typeof FinalizationRegistry)throw fe.create("finalization-registry-not-supported",{});const o=""+(c=JSON.stringify(a),[...c].reduce((e,t)=>
2Math.imul(31,e)+t.charCodeAt(0)|0,0));var c;const u=te.get(o);if(u)return u.incRefCount(s.releaseOnDeref),u;const l=new r.h1(o);for(const e of ne.values())l.addComponent(e);const h=new ge(n,s,o,l);return te.set(o,h),h}function ve(e=X){const t=ee.get(e);if(!t&&e===X&&(0,i.T9)())return we();if(!t)throw fe.create("no-app",{appName:e});return t}function Ee(){return Array.from(ee.values())}async function Ie(e){let t=!1;const n=e.name;if(ee.has(n))t=!0,ee.delete(n);else if(te.has(n)){e.decRefCount()<=0&&(te.delete(n),t=!0)}t&&(await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function Te(e,t,n){let s=Z[e]??e;n&&(s+=`-${n}`);const i=s.match(/\s|\//),a=t.match(/\s|\//);if(i||a){const e=[`Unable to register library "${s}" with version "${t}":`];return i&&e.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void S.warn(e.join(" "))}ie(new r.uA(`${s}-version`,()=>({library:s,version:t}),"VERSION"))}function be(e,t){if(null!==e&&"function"!=typeof e)throw fe.create("invalid-log-argument");(0,s.Ey)(e,t)}function Se(e){(0,s.He)(e)}const Ae="firebase-heartbeat-store";let Ce=null;function Ne(){return Ce||(Ce=function(e,t,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const a=indexedDB.open(e,t),o=g(a);return r&&a.addEventListener("upgradeneeded",e=>{r(g(a.result),e.oldVersion,e.newVersion,g(a.transaction),e)}),n&&a.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),o.then(e=>{i&&e.addEventListener("close",()=>i()),s&&e.addEventListener("versionchange",e=>s(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o}("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Ae)}catch(e){console.warn(e)}}}).catch(e=>{throw fe.create("idb-open",{originalErrorMessage:e.message})})),Ce}async function Oe(e,t){try{const n=(await Ne()).transaction(Ae,"readwrite"),r=n.objectStore(Ae);await r.put(t,De(e)),await n.done}catch(e){if(e instanceof i.g)S.warn(e.message);else{const t=fe.create("idb-set",{originalErrorMessage:e?.message});S.warn(t.message)}}}function De(e){return`${e.name}!${e.options.appId}`}class Re{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new xe(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){try{const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=ke();if(null==this._heartbeatsCache?.heartbeats&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats))return;if(this._heartbeatsCache.lastSentHeartbeatDate===t||this._heartbeatsCache.heartbeats.some(e=>e.date===t))return;if(this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats.length>30){const e=function(e){if(0===e.length)return-1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){S.warn(e)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats||0===this._heartbeatsCache.heartbeats.length)return"";const e=ke(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let r=e.slice();for(const s of e){const e=n.find(e=>e.agent===s.agent);if(e){if(e.dates.push(s.date),Pe(n)>t){e.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Pe(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),r=(0,i.Uj)(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(e){return S.warn(e),""}}}function ke(){return(new Date).toISOString().substring(0,10)}class xe{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,i.zW)()&&(0,i.eX
2)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Ne()).transaction(Ae),n=await t.objectStore(Ae).get(De(e));return await t.done,n}catch(e){if(e instanceof i.g)S.warn(e.message);else{const t=fe.create("idb-get",{originalErrorMessage:e?.message});S.warn(t.message)}}}(this.app);return e?.heartbeats?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const t=await this.read();return Oe(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){if(await this._canUseIndexedDBPromise){const t=await this.read();return Oe(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:[...t.heartbeats,...e.heartbeats]})}}}function Pe(e){return(0,i.Uj)(JSON.stringify({version:2,heartbeats:e})).length}var Le;Le="",ie(new r.uA("platform-logger",e=>new I(e),"PRIVATE")),ie(new r.uA("heartbeat",e=>new Re(e),"PRIVATE")),Te(T,b,Le),Te(T,b,"esm2020"),Te("fire-js","")},87594(e,t,n){n.d(t,{h1:()=>o,uA:()=>s});var r=n(53607);class s{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const i="[DEFAULT]";class a{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new r.cY;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e?.identifier),n=e?.optional??!1;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(n)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:i})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=i){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=i){return this.instances.has(e)}getOptions(e=i){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(r)}return r}onInit(e,t){const n=this.normalizeInstanceIdentifier(t),r=this.onInitCallbacks.get(n)??new Set;r.add(e),this.onInitCallbacks.set(n,r);const s=this.instances.get(n);return s&&e(s,n),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e,r===i?void 0:r),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch{}var r;return n||null}normalizeInstanceIdentifier(e=i){return this.component?this.component.multipleInstances?e:i:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class o{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new a(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}},7664(e,t,n){n.d(t,{$b:()=>s,Ey:()=>h,He:()=>l,Vy:()=>u});const r=[];var s;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.E
2RROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(s||(s={}));const i={debug:s.DEBUG,verbose:s.VERBOSE,info:s.INFO,warn:s.WARN,error:s.ERROR,silent:s.SILENT},a=s.INFO,o={[s.DEBUG]:"log",[s.VERBOSE]:"log",[s.INFO]:"info",[s.WARN]:"warn",[s.ERROR]:"error"},c=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),s=o[t];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[s](`[${r}] ${e.name}:`,...n)};class u{constructor(e){this.name=e,this._logLevel=a,this._logHandler=c,this._userLogHandler=null,r.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in s))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?i[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,s.DEBUG,...e),this._logHandler(this,s.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,s.VERBOSE,...e),this._logHandler(this,s.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,s.INFO,...e),this._logHandler(this,s.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,s.WARN,...e),this._logHandler(this,s.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,s.ERROR,...e),this._logHandler(this,s.ERROR,...e)}}function l(e){r.forEach(t=>{t.setLogLevel(e)})}function h(e,t){for(const n of r){let r=null;t&&t.level&&(r=i[t.level]),n.userLogHandler=null===e?null:(t,n,...i)=>{const a=i.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");n>=(r??t.logLevel)&&e({level:s[n].toLowerCase(),message:a,args:i,type:t.name})}}}},72873(e,t,n){n.r(t),n.d(t,{Dk:()=>r.Dk,HG:()=>r.HG,He:()=>r.He,KO:()=>r.KO,MF:()=>r.MF,Mw:()=>r.Mw,NM:()=>r.NM,SV:()=>r.SV,Sx:()=>r.Sx,Tj:()=>r.Tj,U6:()=>r.U6,Us:()=>r.Us,Wp:()=>r.Wp,aP:()=>r.aP,g:()=>r.g,iF:()=>r.iF,j6:()=>r.j6,mq:()=>r.mq,om:()=>r.om,pN:()=>r.pN,xZ:()=>r.xZ,yX:()=>r.yX,yi:()=>r.yi});var r=n(3849);(0,r.KO)("firebase","12.15.0","app")},91056(e,t,n){n.r(t),n.d(t,{n6:()=>h,JN:()=>lt,aJ:()=>Je,nC:()=>g,um:()=>st,IX:()=>dt,sk:()=>gt,VJ:()=>o,Dt:()=>wt,HF:()=>yt,RM:()=>at,LD:()=>mt,S5:()=>l,YJ:()=>ut,Oe:()=>wr,eQ:()=>ms,NI:()=>c,kT:()=>lr,rG:()=>vt,Ct:()=>u,p7:()=>gs,oj:()=>ws,ny:()=>Et,sv:()=>$t,l3:()=>wn,AN:()=>Fn,F0:()=>Ln,hk:()=>ds,iM:()=>qn,sB:()=>Ht,R4:()=>Gt,Wq:()=>We,eJ:()=>Wt,Oy:()=>f,hG:()=>bn,Wm:()=>Zt,B8:()=>fn,xI:()=>Ss,p9:()=>J,yx:()=>X,vZ:()=>Cn,Q4:()=>Fr,gz:()=>pe,Gt:()=>nr,Nu:()=>Ke,Qe:()=>mn,Pj:()=>Jt,OS:()=>Lt,uL:()=>fr,x8:()=>Nr,dC:()=>Ur,VO:()=>Rn,hg:()=>_n,iZ:()=>yn,mq:()=>ht,mm:()=>p,kZ:()=>Mt,Uy:()=>pr,Bm:()=>Cr,zT:()=>Vr,yQ:()=>ae,Kz:()=>Tn,gA:()=>en,J1:()=>jt,MN:()=>Qt,oM:()=>pn,zK:()=>St,eN:()=>Pt,p:()=>Vt,x9:()=>Yt,hK:()=>Xt,ik:()=>dr,df:()=>Ar,$2:()=>Mr,CI:()=>In,y1:()=>Ot,W3:()=>En,Ww:()=>rn,f3:()=>sn,NA:()=>gr,r7:()=>nn,eG:()=>vn,Oj:()=>gn,g0:()=>tn,RE:()=>Kt});var r=n(3849),s=n(53607),i=n(7664),a=n(87594);const o={PHONE:"phone",TOTP:"totp"},c={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},u={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},l={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},h={EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"};function d(){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."}}const f=function
vendor: 12,061 bytes, line 2
2(){return{"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","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.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","emulator-config-failed":'Auth instance has already been used to make a network call. Auth can no longer be configured to use the emulator. Try calling "connectAuthEmulator()" sooner.',"expired-action-code":"The action code has expired.","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal AuthError has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registered for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal AuthError has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-emulator-scheme":"Emulator URL must start with a valid scheme (http:// or https://).","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is incorrect, malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","login-blocked":"Login blocked by user-provided method: {$originalMessage}","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal AuthError has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.","missing-password":"A non-empty password must be provided","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal AuthError has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled.","already-initialized":"initializeAuth() has already been called with different options. To avoid this error, call initializeAuth() with the same options as when it was originally called, or call getAuth() to return the already initialized instance.","missing-recaptcha-token":"The reCAPTCHA token is missing when sending request to the backend.","invalid-recaptcha-token":"The reCAPTCHA token is invalid when sending request to the backend.","invalid-recaptcha-action":"The reCAPTCHA action is invalid when sending request to the backend.","recaptcha-not-enabled":"reCAPTCHA Enterprise integration is not enabled for this project.","missing-client-type":"The reCAPTCHA client type is missing when sending request to the backend.","missing-recaptcha-version":"The reCAPTCHA version is missing when sending request to the backend.","invalid-req-type":"Invalid request parameters.","invalid-recaptcha-version":"The reCAPTCHA version is invalid when sending request to the backend.","unsupported-password-policy-schema-version":"The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.","password-does-not-meet-requirements":"The password does not meet the requirements.","invalid-hosting-link-domain":"The provided Hosting link domain is not configured in Firebase Hosting or is not owned by the current project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`)."}}
2,p=d,m=new s.FA("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."}),g={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVALID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_
2NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_PASSWORD:"auth/missing-password",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type",INVALID_HOSTING_LINK_DOMAIN:"auth/invalid-hosting-link-domain"},y=new i.Vy("@firebase/auth");function w(e,...t){y.logLevel<=i.$b.ERROR&&y.error(`Auth (${r.MF}): ${e}`,...t)}function _(e,...t){throw b(e,...t)}function v(e,...t){return b(e,...t)}function E(e,t,n){const r={...p(),[t]:n};return new s.FA("auth","Firebase",r).create(t,{appName:e.name})}function I(e){return E(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function T(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&_(e,"argument-error"),E(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function b(e,...t){if("string"!=typeof e){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return m.create(e,...t)}function S(e,t,...n){if(!e)throw b(t,...n)}function A(e){const t="INTERNAL ASSERTION FAILED: "+e;throw w(t),new Error(t)}function C(e,t){e||A(t)}function N(){return"undefined"!=typeof self&&self.location?.href||""}function O(){return"http:"===D()||"https:"===D()}function D(){return"undefined"!=typeof self&&self.location?.protocol||null}class R{constructor(e,t){this.shortDelay=e,this.longDelay=t,C(t>e,"Short delay should be less than long delay!"),this.isMobile=(0,s.jZ)()||(0,s.lV)()}get(){return"undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(O()||(0,s.sr)()||"connection"in navigator)&&!navigator.onLine?Math.min(5e3,this.shortDelay):this.isMobile?this.longDelay:this.shortDelay}}function k(e,t){C(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class x{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void A("Could not find fetch implementation, make sure you call FetchProvi
2der.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 A("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 A("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const P={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"},L=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],M=new R(3e4,6e4);function V(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function U(e,t,n,r,i={}){return F(e,i,async()=>{let i={},a={};r&&("GET"===t?a=r:i={body:JSON.stringify(r)});const o=(0,s.Am)({...a,key:e.config.apiKey}).slice(1),c=await e._getAdditionalHeaders();c["Content-Type"]="application/json",e.languageCode&&(c["X-Firebase-Locale"]=e.languageCode);const u={method:t,headers:c,...i};return(0,s.c1)()||(u.referrerPolicy="strict-origin-when-cross-origin"),e.emulatorConfig&&(0,s.zJ)(e.emulatorConfig.host)&&(u.credentials="include"),x.fetch()(await q(e,e.config.apiHost,n,o),u)})}async function F(e,t,n){e._canInitEmulator=!1;const r={...P,...t};try{const t=new j(e),s=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw G(e,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const t=s.ok?i.errorMessage:i.error.message,[n,a]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw G(e,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw G(e,"email-already-in-use",i);if("USER_DISABLED"===n)throw G(e,"user-disabled",i);const o=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(a)throw E(e,o,a);_(e,o)}}catch(t){if(t instanceof s.g)throw t;_(e,"network-request-failed",{message:String(t)})}}async function B(e,t,n,r,s={}
2){const i=await U(e,t,n,r,s);return"mfaPendingCredential"in i&&_(e,"multi-factor-auth-required",{_serverResponse:i}),i}async function q(e,t,n,r){const s=`${t}${n}?${r}`,i=e,a=i.config.emulator?k(e.config,s):`${e.config.apiScheme}://${s}`;if(L.includes(n)&&(await i._persistenceManagerAvailable,"COOKIE"===i._getPersistenceType())){return i._getPersistence()._getFinalTarget(a).toString()}return a}function z(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class j{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(v(this.auth,"network-request-failed")),M.get())})}}function G(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=v(e,t,r);return s.customData._tokenResponse=n,s}function $(e){return void 0!==e&&void 0!==e.getResponse}function H(e){return void 0!==e&&void 0!==e.enterprise}class K{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return z(t.enforcementState);return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function W(e,t){return U(e,"GET","/v2/recaptchaConfig",V(e,t))}async function Y(e,t){return U(e,"POST","/v1/accounts:lookup",t)}function Q(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function J(e,t=!1){return(0,s.Ku)(e).getIdToken(t)}async function X(e,t=!1){const n=(0,s.Ku)(e),r=await n.getIdToken(t),i=ee(r);S(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const a="object"==typeof i.firebase?i.firebase:void 0,o=a?.sign_in_provider;return{claims:i,token:r,authTime:Q(Z(i.auth_time)),issuedAtTime:Q(Z(i.iat)),expirationTime:Q(Z(i.exp)),signInProvider:o||null,signInSecondFactor:a?.sign_in_second_factor||null}}function Z(e){return 1e3*Number(e)}function ee(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return w("JWT malformed, contained fewer than 3 sections"),null;try{const e=(0,s.u)(n);return e?JSON.parse(e):(w("Failed to decode base64 JWT payload"),null)}catch(e){return w("Caught error parsing JWT payload as JSON",e?.toString()),null}}function te(e){const t=ee(e);return S(t,"internal-error"),S(void 0!==t.exp,"internal-error"),S(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function ne(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof s.g&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class re{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===e?.code&&this.schedule(!0))}this.schedule()}}class se{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Q(this.lastLoginAt),this.creationTime=Q(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function ie(e){const t=e.auth,n=await e.getIdToken(),r=await ne(e,Y(t,{idToken:n}));S(r?.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const i=s.providerUserInfo?.length?oe(s.providerUserInfo):[],a=(o=e.providerData,c=i,[...o.filter(e=>!c.some(t=>t.providerId===e.providerId)),...c]);var o,c;const u=e.isAnonymous,l=!(e.email&&s.passwordHash||a?.length),h=!!u&&l,d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new se(s.createdAt,s.lastLoginAt),isAnonymous:h};Object.assign(e,d)}async function ae(e){const t=(0,s.Ku)(e);await ie(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function oe(e){return e.map(({providerId:e,...t})=>
vendor: 4,942 bytes, line 2
2({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}class ce{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){S(e.idToken,"internal-error"),S(void 0!==e.idToken,"internal-error"),S(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):te(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){S(0!==e.length,"internal-error");const t=te(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(S(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:r,expiresIn:i}=await async function(e,t){const n=await F(e,{},async()=>{const n=(0,s.Am)({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:i}=e.config,a=await q(e,r,"/v1/token",`key=${i}`),o=await e._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const c={method:"POST",headers:o,body:n};return e.emulatorConfig&&(0,s.zJ)(e.emulatorConfig.host)&&(c.credentials="include"),x.fetch()(a,c)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:r,expirationTime:s}=t,i=new ce;return n&&(S("string"==typeof n,"internal-error",{appName:e}),i.refreshToken=n),r&&(S("string"==typeof r,"internal-error",{appName:e}),i.accessToken=r),s&&(S("number"==typeof s,"internal-error",{appName:e}),i.expirationTime=s),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new ce,this.toJSON())}_performRefresh(){return A("not implemented")}}function ue(e,t){S("string"==typeof e||void 0===e,"internal-error",{appName:t})}class le{constructor({uid:e,auth:t,stsTokenManager:n,...r}){this.providerId="firebase",this.proactiveRefresh=new re(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new se(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await ne(this,this.stsTokenManager.getToken(this.auth,e));return S(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return X(this,e)}reload(){return ae(this)}_assign(e){this!==e&&(S(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>({...e})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new le({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){S(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await ie(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if((0,r.xZ)(this.auth.app))return Promise.reject(I(this.auth));const e=await this.getIdToken();return await ne(this,async function(e,t){return U(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
2nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){const n=t.displayName??void 0,r=t.email??void 0,s=t.phoneNumber??void 0,i=t.photoURL??void 0,a=t.tenantId??void 0,o=t._redirectEventId??void 0,c=t.createdAt??void 0,u=t.lastLoginAt??void 0,{uid:l,emailVerified:h,isAnonymous:d,providerData:f,stsTokenManager:p}=t;S(l&&p,e,"internal-error");const m=ce.fromJSON(this.name,p);S("string"==typeof l,e,"internal-error"),ue(n,e.name),ue(r,e.name),S("boolean"==typeof h,e,"internal-error"),S("boolean"==typeof d,e,"internal-error"),ue(s,e.name),ue(i,e.name),ue(a,e.name),ue(o,e.name),ue(c,e.name),ue(u,e.name);const g=new le({uid:l,auth:e,email:r,emailVerified:h,displayName:n,isAnonymous:d,photoURL:i,phoneNumber:s,tenantId:a,stsTokenManager:m,createdAt:c,lastLoginAt:u});return f&&Array.isArray(f)&&(g.providerData=f.map(e=>({...e}))),o&&(g._redirectEventId=o),g}static async _fromIdTokenResponse(e,t,n=!1){const r=new ce;r.updateFromServerResponse(t);const s=new le({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await ie(s),s}static async _fromGetAccountInfoResponse(e,t,n){const r=t.users[0];S(void 0!==r.localId,"internal-error");const s=void 0!==r.providerUserInfo?oe(r.providerUserInfo):[],i=!(r.email&&r.passwordHash||s?.length),a=new ce;a.updateFromIdToken(n);const o=new le({uid:r.localId,auth:e,stsTokenManager:a,isAnonymous:i}),c={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new se(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash||s?.length)};return Object.assign(o,c),o}}const he=new Map;function de(e){C(e instanceof Function,"Expected a class definition");let t=he.get(e);return t?(C(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,he.set(e,t),t)}class fe{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}fe.type="NONE";const pe=fe;function me(e,t,n){return`firebase:${e}:${t}:${n}`}class ge{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=me(this.userKey,r.apiKey,s),this.fullPersistenceKey=me("persistence",r.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){const t=await Y(this.auth,{idToken:e}).catch(()=>{});return t?le._fromGetAccountInfoResponse(this.auth,t,e):null}return le._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new ge(de(pe),e,n);const r=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let s=r[0]||de(pe);const i=me(n,e.config.apiKey,e.name);let a=null;for(const n of t)try{const t=await n._get(i);if(t){let r;if("string"==typeof t){const n=await Y(e,{idToken:t}).catch(()=>{});if(!n)break;r=await le._fromGetAccountInfoResponse(e,n,t)}else r=le._fromJSON(e,t);n!==s&&(a=r),s=n;break}}catch{}const o=r.filter(e=>e._shouldAllowMigration);return s._shouldAllowMigration&&o.length?(s=o[0],a&&await s._set(i,a.toJSON()),await Promise.all(t.map(async e=>{if(e!==s)try{await e._remove(i)}catch{}})),new ge(s,e,n)):new ge(s,e,n)}}function ye(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Ee(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(we(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Te(t))return"Blackberry";if(be(t))return"Webos";if(_e(t))return"Safari";
vendor: 5,294 bytes, line 2
2if((t.includes("chrome/")||ve(t))&&!t.includes("edge/"))return"Chrome";if(Ie(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===n?.length)return n[1]}return"Other"}function we(e=(0,s.ZQ)()){return/firefox\//i.test(e)}function _e(e=(0,s.ZQ)()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function ve(e=(0,s.ZQ)()){return/crios\//i.test(e)}function Ee(e=(0,s.ZQ)()){return/iemobile/i.test(e)}function Ie(e=(0,s.ZQ)()){return/android/i.test(e)}function Te(e=(0,s.ZQ)()){return/blackberry/i.test(e)}function be(e=(0,s.ZQ)()){return/webos/i.test(e)}function Se(e=(0,s.ZQ)()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Ae(e=(0,s.ZQ)()){return Se(e)||Ie(e)||be(e)||Te(e)||/windows phone/i.test(e)||Ee(e)}function Ce(e,t=[]){let n;switch(e){case"Browser":n=ye((0,s.ZQ)());break;case"Worker":n=`${ye((0,s.ZQ)())}-${e}`;break;default:n=e}const i=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${r.MF}/${i}`}class Ne{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise((n,r)=>{try{n(e(t))}catch(e){r(e)}});n.onAbort=t,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:e?.message})}}}class Oe{constructor(e){const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??6,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),void 0!==t.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),void 0!==t.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),void 0!==t.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),void 0!==t.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let r=0;r<e.length;r++)n=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,r,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}class De{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new ke(this),this.idTokenSubscription=new ke(this),this.beforeStateQueue=new Ne(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=m,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=de(t)),this._initializationPromise=this.queue(async()=>
2{if(!this._deleted&&(this.persistenceManager=await ge.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.uid||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await Y(this,{idToken:e}),n=await le._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if((0,r.xZ)(this.app)){const e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let n=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const t=this.redirectUser?._redirectEventId,r=n?._redirectEventId,i=await this.tryRedirectSignIn(e);t&&t!==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(e){n=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return S(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await ie(e)}catch(e){if("auth/network-request-failed"!==e?.code)return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if((0,r.xZ)(this.app))return Promise.reject(I(this));const t=e?(0,s.Ku)(e):null;return t&&S(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&S(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return(0,r.xZ)(this.app)?Promise.reject(I(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return(0,r.xZ)(this.app)?Promise.reject(I(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(de(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e,t={}){return U(e,"GET","/v2/passwordPolicy",V(e,t))}(this),t=new Oe(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new s.FA("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>
2{if(this.currentUser)e();else{const n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return U(e,"POST","/v2/accounts:revokeToken",V(e,t))}(this,t)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&de(e)||this._popupRedirectResolver;S(t,this,"argument-error"),this.redirectPersistenceManager=await ge.create(this,[de(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const s="function"==typeof t?t:t.next.bind(t);let i=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(S(a,this,"internal-error"),a.then(()=>{i||s(this.currentUser)}),"function"==typeof t){const s=e.addObserver(t,n,r);return()=>{i=!0,s()}}{const n=e.addObserver(t);return()=>{i=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return S(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ce(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await(this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader());t&&(e["X-Firebase-Client"]=t);const n=await this._getAppCheckToken();return n&&(e["X-Firebase-AppCheck"]=n),e}async _getAppCheckToken(){if((0,r.xZ)(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await(this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken());return e?.error&&function(e,...t){y.logLevel<=i.$b.WARN&&y.warn(`Auth (${r.MF}): ${e}`,...t)}(`Error while retrieving App Check token: ${e.error}`),e?.token}}function Re(e){return(0,s.Ku)(e)}class ke{constructor(e){this.auth=e,this.observer=null,this.addObserver=(0,s.tD)(e=>this.observer=e)}get next(){return S(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let xe={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Pe(e){return xe.loadJS(e)}function Le(e){return`__${e}${Math.floor(1e6*Math.random())}`}const Me=1e12;class Ve{constructor(e){this.auth=e,this.counter=Me,this._widgets=new Map}render(e,t){const n=this.counter;return this._widgets.set(n,new Be(e,this.auth.name,t||{})),this.counter++,n}reset(e){const t=e||Me;this._widgets.get(t)?.delete(),this._widgets.delete(t)}getResponse(e){const t=e||Me;return this._widgets.get(t)?.getResponse()||""}async execute(e){const t=e||Me;return this._widgets.get(t)?.execute(),""}}
2class Ue{constructor(){this.enterprise=new Fe}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Fe{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Be{constructor(e,t,n){this.params=n,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};const r="string"==typeof e?document.getElementById(e):e;S(r,"argument-error",{appName:t}),this.container=r,this.isVisible="invisible"!==this.params.size,this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),this.timerId||(this.timerId=window.setTimeout(()=>{this.responseToken=function(e){const t=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let r=0;r<e;r++)t.push(n.charAt(Math.floor(Math.random()*n.length)));return t.join("")}(50);const{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch(e){}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch(e){}this.isVisible&&this.execute()},6e4)},500))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}const qe="NO_RECAPTCHA",ze="onFirebaseAuthREInstanceReady";class je{constructor(e){this.type="recaptcha-enterprise",this.auth=Re(e)}async verify(e="verify",t=!1){function n(t,n,r){const s=window.grecaptcha;H(s)?s.enterprise.ready(()=>{s.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n(qe)})}):r(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new Ue).execute("siteKey",{action:"verify"})}return new Promise((e,r)=>{(async function(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,n)=>{W(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(r=>{if(void 0!==r.recaptchaKey){const n=new K(r);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))}).catch(e=>{n(e)})})})(this.auth).then(async i=>{if(!t&&H(window.grecaptcha)&&je.scriptInjectionDeferred)await je.scriptInjectionDeferred.promise,n(i,e,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let t=xe.recaptchaEnterpriseScript;0!==t.length&&(t+=i+`&onload=${ze}`),je.scriptInjectionDeferred=new s.cY,window[ze]=()=>{je.scriptInjectionDeferred?.resolve()},Pe(t).then(()=>je.scriptInjectionDeferred?.promise).then(()=>{n(i,e,r)}).catch(e=>{r(e)})}}).catch(e=>{r(e)})})}}async function Ge(e,t,n,r=!1,s=!1){const i=new je(e);let a;if(s)a=qe;else try{a=await i.verify(n)}catch(e){a=await i.verify(n,!0)}const o={...t};if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in o){const e=o.phoneEnrollmentInfo.phoneNumber,t=o.phoneEnrollmentInfo.recaptchaToken;Object.assign(o,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in o){const e=o.phoneSignInInfo.recaptchaToken;Object.assign(o,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return o}return r?Object.assign(o,{captchaResp:a}):Object.assign(o,{captchaResponse:a}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function $e(e,t,n,r,s){if("EMAIL_PASSWORD_PROVIDER"===s){if(e._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await Ge(e,t,n,"getOobCode"===n);return r(e,s)}return r(e,t).catch(async s=>
2{if("auth/missing-recaptcha-token"===s.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const s=await Ge(e,t,n,"getOobCode"===n);return r(e,s)}return Promise.reject(s)})}if("PHONE_PROVIDER"===s){if(e._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){const s=await Ge(e,t,n);return r(e,s).catch(async s=>{if("AUDIT"===e._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")&&("auth/missing-recaptcha-token"===s.code||"auth/invalid-app-credential"===s.code)){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`);const s=await Ge(e,t,n,!1,!0);return r(e,s)}return Promise.reject(s)})}{const s=await Ge(e,t,n,!1,!0);return r(e,s)}}return Promise.reject(s+" provider is not supported.")}async function He(e){const t=Re(e),n=await W(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),r=new K(n);if(null==t.tenantId?t._agentRecaptchaConfig=r:t._tenantRecaptchaConfigs[t.tenantId]=r,r.isAnyProviderEnabled()){new je(t).verify()}}function Ke(e,t){const n=(0,r.j6)(e,"auth");if(n.isInitialized()){const e=n.getImmediate(),r=n.getOptions();if((0,s.bD)(r,t??{}))return e;_(e,"already-initialized")}return n.initialize({options:t})}function We(e,t,n){const r=Re(e);S(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const i=!!n?.disableWarnings,a=Ye(t),{host:o,port:c}=function(e){const t=Ye(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const e=s[1];return{host:e,port:Qe(r.substr(e.length+1))}}{const[e,t]=r.split(":");return{host:e,port:Qe(t)}}}(t),u=null===c?"":`:${c}`,l={url:`${a}//${o}${u}/`},h=Object.freeze({host:o,port:c,protocol:a.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator)return S(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),void S((0,s.bD)(l,r.config.emulator)&&(0,s.bD)(h,r.emulatorConfig),r,"emulator-config-failed");r.config.emulator=l,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,(0,s.zJ)(o)?(0,s.gE)(`${a}//${o}${u}`):i||function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function Ye(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Qe(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}je.scriptInjectionDeferred=null;class Je{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return A("not implemented")}_getIdTokenResponse(e){return A("not implemented")}_linkToIdToken(e,t){return A("not implemented")}_getReauthenticationResolver(e){return A("not implemented")}}async function Xe(e,t){return U(e,"POST","/v1/accounts:resetPassword",V(e,t))}async function Ze(e,t){return U(e,"POST","/v1/accounts:signUp",t)}async function et(e,t){return B(e,"POST","/v1/accounts:signInWithPassword",V(e,t))}async function tt(e,t){return U(e,"POST","/v1/accounts:sendOobCode",V(e,t))}async function nt(e,t){return tt(e,t)}async function rt(e,t){return tt(e,t)}class st extends Je{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new st(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new st(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e;if(t?.email&&t?.password){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return $e(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",et,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return async function(e,t){return B(e,"POST","/v1/accounts:signInWithEmailLink",V(e,t))}(e,{email:this._email,oobCode:this._password});default:_(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return $e(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Ze,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return async function(e,t){return B(e,"POST","/v1/accounts:signInWithEmailLink",V(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:_(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function it(e,t){return B(e,"POST","/v1/accounts:signInWithIdp",V(e,t))}class at extends Je{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new at(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&
2(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):_("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:r,...s}=t;if(!n||!r)return null;const i=new at(n,r);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(e){return it(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,it(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,it(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=(0,s.Am)(t)}return e}}async function ot(e,t){return U(e,"POST","/v1/accounts:sendVerificationCode",V(e,t))}const ct={USER_NOT_FOUND:"user-not-found"};class ut extends Je{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new ut({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new ut({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return B(e,"POST","/v1/accounts:signInWithPhoneNumber",V(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){const n=await B(e,"POST","/v1/accounts:signInWithPhoneNumber",V(e,t));if(n.temporaryProof)throw G(e,"account-exists-with-different-credential",n);return n}(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return async function(e,t){return B(e,"POST","/v1/accounts:signInWithPhoneNumber",V(e,{...t,operation:"REAUTH"}),ct)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:r}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"==typeof e&&(e=JSON.parse(e));const{verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:s}=e;return n||t||r||s?new ut({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:s}):null}}class lt{constructor(e){const t=(0,s.I9)((0,s.hp)(e)),n=t.apiKey??null,r=t.oobCode??null,i=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(t.mode??null);S(n&&r&&i,"argument-error"),this.apiKey=n,this.operation=i,this.code=r,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){const t=function(e){const t=(0,s.I9)((0,s.hp)(e)).link,n=t?(0,s.I9)((0,s.hp)(t)).deep_link_id:null,r=(0,s.I9)((0,s.hp)(e)).deep_link_id;return(r?(0,s.I9)((0,s.hp)(r)).link:null)||r||n||t||e}(e);try{return new lt(t)}catch{return null}}}function ht(e){return lt.parseLink(e)}class dt{constructor(){this.providerId=dt.PROVIDER_ID}static credential(e,t){return st._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=lt.parseLink(t);return S(n,"argument-error"),st._fromEmailAndCode(e,n.code,n.tenantId)}}dt.PROVIDER_ID="password",dt.EMAIL_PASSWORD_SIGN_IN_METHOD="password",dt.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class ft{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class pt extends ft{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class mt extends pt{static credentialFromJSON(e){const t="string"==typeof e?JSON.parse(e):e;return S("providerId"in t&&"signInMethod"in t,"argument-error"),at._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return S(e.idToken||e.accessToken,"argument-error"),at._fromParams({...e,providerId:this.providerId,sign
vendor: 4,645 bytes, line 2
2InMethod:this.providerId})}static credentialFromResult(e){return mt.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return mt.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n,oauthTokenSecret:r,pendingToken:s,nonce:i,providerId:a}=e;if(!(n||r||t||s))return null;if(!a)return null;try{return new mt(a)._credential({idToken:t,accessToken:n,nonce:i,pendingToken:s})}catch(e){return null}}}class gt extends pt{constructor(){super("facebook.com")}static credential(e){return at._fromParams({providerId:gt.PROVIDER_ID,signInMethod:gt.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return gt.credentialFromTaggedObject(e)}static credentialFromError(e){return gt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return gt.credential(e.oauthAccessToken)}catch{return null}}}gt.FACEBOOK_SIGN_IN_METHOD="facebook.com",gt.PROVIDER_ID="facebook.com";class yt extends pt{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return at._fromParams({providerId:yt.PROVIDER_ID,signInMethod:yt.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return yt.credentialFromTaggedObject(e)}static credentialFromError(e){return yt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return yt.credential(t,n)}catch{return null}}}yt.GOOGLE_SIGN_IN_METHOD="google.com",yt.PROVIDER_ID="google.com";class wt extends pt{constructor(){super("github.com")}static credential(e){return at._fromParams({providerId:wt.PROVIDER_ID,signInMethod:wt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return wt.credentialFromTaggedObject(e)}static credentialFromError(e){return wt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return wt.credential(e.oauthAccessToken)}catch{return null}}}wt.GITHUB_SIGN_IN_METHOD="github.com",wt.PROVIDER_ID="github.com";class _t extends Je{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){return it(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,it(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,it(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:r,pendingToken:s}=t;return n&&r&&s&&n===r?new _t(n,s):null}static _create(e,t){return new _t(e,t)}buildRequest(){return{requestUri:"http://localhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}class vt extends ft{constructor(e){S(e.startsWith("saml."),"argument-error"),super(e)}static credentialFromResult(e){return vt.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return vt.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){const t=_t.fromJSON(e);return S(t,"argument-error"),t}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{pendingToken:t,providerId:n}=e;if(!t||!n)return null;try{return _t._create(n,t)}catch(e){return null}}}class Et extends pt{constructor(){super("twitter.com")}static credential(e,t){return at._fromParams({providerId:Et.PROVIDER_ID,signInMethod:Et.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Et.credentialFromTaggedObject(e)}static credentialFromError(e){return Et.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return Et.credential(t,n)}catch{return null}}}async function It(e,t){return B(e,"POST","/v1/accounts:signUp",V(e,t))}Et.TWITTER_SIGN_IN_METHOD="twitter.com",Et.PROVIDER_ID="twitter.com";class Tt{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,r=!1){const s=await le._fromIdTokenResponse(e,n,r),i=bt(n);return new Tt({user:s,providerId:i,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const r=bt(n);
2return new Tt({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function bt(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}async function St(e){if((0,r.xZ)(e.app))return Promise.reject(I(e));const t=Re(e);if(await t._initializationPromise,t.currentUser?.isAnonymous)return new Tt({user:t.currentUser,providerId:null,operationType:"signIn"});const n=await It(t,{returnSecureToken:!0}),s=await Tt._fromIdTokenResponse(t,"signIn",n,!0);return await t._updateCurrentUser(s.user),s}class At extends s.g{constructor(e,t,n,r){super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,At.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new At(e,t,n,r)}}function Ct(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw At._fromErrorAndOperation(e,n,t,r);throw n})}function Nt(e){return new Set(e.map(({providerId:e})=>e).filter(e=>!!e))}async function Ot(e,t){const n=(0,s.Ku)(e);await Rt(!0,n,t);const{providerUserInfo:r}=await async function(e,t){return U(e,"POST","/v1/accounts:update",t)}(n.auth,{idToken:await n.getIdToken(),deleteProvider:[t]}),i=Nt(r||[]);return n.providerData=n.providerData.filter(e=>i.has(e.providerId)),i.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function Dt(e,t,n=!1){const r=await ne(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return Tt._forOperation(e,"link",r)}async function Rt(e,t,n){await ie(t);const r=!1===e?"provider-already-linked":"no-such-provider";S(Nt(t.providerData).has(n)===e,t.auth,r)}async function kt(e,t,n=!1){const{auth:s}=e;if((0,r.xZ)(s.app))return Promise.reject(I(s));const i="reauthenticate";try{const r=await ne(e,Ct(s,i,t,e),n);S(r.idToken,s,"internal-error");const a=ee(r.idToken);S(a,s,"internal-error");const{sub:o}=a;return S(e.uid===o,s,"user-mismatch"),Tt._forOperation(e,i,r)}catch(e){throw"auth/user-not-found"===e?.code&&_(s,"user-mismatch"),e}}async function xt(e,t,n=!1){if((0,r.xZ)(e.app))return Promise.reject(I(e));const s="signIn",i=await Ct(e,s,t),a=await Tt._fromIdTokenResponse(e,s,i);return n||await e._updateCurrentUser(a.user),a}async function Pt(e,t){return xt(Re(e),t)}async function Lt(e,t){const n=(0,s.Ku)(e);return await Rt(!1,n,t.providerId),Dt(n,t)}async function Mt(e,t){return kt((0,s.Ku)(e),t)}async function Vt(e,t){if((0,r.xZ)(e.app))return Promise.reject(I(e));const n=Re(e),s=await async function(e,t){return B(e,"POST","/v1/accounts:signInWithCustomToken",V(e,t))}(n,{token:t,returnSecureToken:!0}),i=await Tt._fromIdTokenResponse(n,"signIn",s);return await n._updateCurrentUser(i.user),i}class Ut{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?Ft._fromServerResponse(e,t):"totpInfo"in t?Bt._fromServerResponse(e,t):_(e,"internal-error")}}class Ft extends Ut{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new Ft(t)}}class Bt extends Ut{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new Bt(t)}}function qt(e,t,n){S(n.url?.length>0,e,"invalid-continue-uri"),S(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),S(void 0===n.linkDomain||n.linkDomain.length>0,e,"invalid-hosting-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.linkDomain=n.linkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(S(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(S(n.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}async function zt(e){const t=Re(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function jt(e,t,n){const r=Re(e),s={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};
2n&&qt(r,s,n),await $e(r,s,"getOobCode",nt,"EMAIL_PASSWORD_PROVIDER")}async function Gt(e,t,n){await Xe((0,s.Ku)(e),{oobCode:t,newPassword:n}).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&zt(e),t})}async function $t(e,t){await async function(e,t){return U(e,"POST","/v1/accounts:update",V(e,t))}((0,s.Ku)(e),{oobCode:t})}async function Ht(e,t){const n=(0,s.Ku)(e),r=await Xe(n,{oobCode:t}),i=r.requestType;switch(S(i,n,"internal-error"),i){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":S(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":S(r.mfaInfo,n,"internal-error");default:S(r.email,n,"internal-error")}let a=null;return r.mfaInfo&&(a=Ut._fromServerResponse(Re(n),r.mfaInfo)),{data:{email:("VERIFY_AND_CHANGE_EMAIL"===r.requestType?r.newEmail:r.email)||null,previousEmail:("VERIFY_AND_CHANGE_EMAIL"===r.requestType?r.email:r.newEmail)||null,multiFactorInfo:a},operation:i}}async function Kt(e,t){const{data:n}=await Ht((0,s.Ku)(e),t);return n.email}async function Wt(e,t,n){if((0,r.xZ)(e.app))return Promise.reject(I(e));const s=Re(e),i=$e(s,{returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",It,"EMAIL_PASSWORD_PROVIDER"),a=await i.catch(t=>{throw"auth/password-does-not-meet-requirements"===t.code&&zt(e),t}),o=await Tt._fromIdTokenResponse(s,"signIn",a);return await s._updateCurrentUser(o.user),o}function Yt(e,t,n){return(0,r.xZ)(e.app)?Promise.reject(I(e)):Pt((0,s.Ku)(e),dt.credential(t,n)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&zt(e),t})}async function Qt(e,t,n){const r=Re(e),s={requestType:"EMAIL_SIGNIN",email:t,clientType:"CLIENT_TYPE_WEB"};!function(e,t){S(t.handleCodeInApp,r,"argument-error"),t&&qt(r,e,t)}(s,n),await $e(r,s,"getOobCode",rt,"EMAIL_PASSWORD_PROVIDER")}function Jt(e,t){const n=lt.parseLink(t);return"EMAIL_SIGNIN"===n?.operation}async function Xt(e,t,n){if((0,r.xZ)(e.app))return Promise.reject(I(e));const i=(0,s.Ku)(e),a=dt.credentialWithLink(t,n||N());return S(a._tenantId===(i.tenantId||null),i,"tenant-id-mismatch"),Pt(i,a)}async function Zt(e,t){const n={identifier:t,continueUri:O()?N():"http://localhost"},{signinMethods:r}=await async function(e,t){return U(e,"POST","/v1/accounts:createAuthUri",V(e,t))}((0,s.Ku)(e),n);return r||[]}async function en(e,t){const n=(0,s.Ku)(e),r={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&qt(n.auth,r,t);const{email:i}=await async function(e,t){return tt(e,t)}(n.auth,r);i!==e.email&&await e.reload()}async function tn(e,t,n){const r=(0,s.Ku)(e),i={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await e.getIdToken(),newEmail:t};n&&qt(r.auth,i,n);const{email:a}=await async function(e,t){return tt(e,t)}(r.auth,i);a!==e.email&&await e.reload()}async function nn(e,{displayName:t,photoURL:n}){if(void 0===t&&void 0===n)return;const r=(0,s.Ku)(e),i={idToken:await r.getIdToken(),displayName:t,photoUrl:n,returnSecureToken:!0},a=await ne(r,async function(e,t){return U(e,"POST","/v1/accounts:update",t)}(r.auth,i));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;const o=r.providerData.find(({providerId:e})=>"password"===e);o&&(o.displayName=r.displayName,o.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function rn(e,t){const n=(0,s.Ku)(e);return(0,r.xZ)(n.auth.app)?Promise.reject(I(n.auth)):an(n,t,null)}function sn(e,t){return an((0,s.Ku)(e),null,t)}async function an(e,t,n){const{auth:r}=e,s={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(s.email=t),n&&(s.password=n);const i=await ne(e,async function(e,t){return U(e,"POST","/v1/accounts:update",t)}(r,s));await e._updateTokensIfNecessary(i,!0)}class on{constructor(e,t,n={}){this.isNewUser=e,this.providerId=t,this.profile=n}}class cn extends on{constructor(e,t,n,r){super(e,t,n),this.username=r}}class un extends on{constructor(e,t){super(e,"facebook.com",t)}}class ln extends cn{constructor(e,t){super(e,"github.com",t,"string"==typeof t?.login?t?.login:null)}}class hn extends on{constructor(e,t){super(e,"google.com",t)}}class dn extends cn{constructor(e,t,n){super(e,"twitter.com",t,n)}}
2function fn(e){const{user:t,_tokenResponse:n}=e;return t.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:function(e){if(!e)return null;const{providerId:t}=e,n=e.rawUserInfo?JSON.parse(e.rawUserInfo):{},r=e.isNewUser||"identitytoolkit#SignupNewUserResponse"===e.kind;if(!t&&e?.idToken){const t=ee(e.idToken)?.firebase?.sign_in_provider;if(t)return new on(r,"anonymous"!==t&&"custom"!==t?t:null)}if(!t)return null;switch(t){case"facebook.com":return new un(r,n);case"github.com":return new ln(r,n);case"google.com":return new hn(r,n);case"twitter.com":return new dn(r,n,e.screenName||null);case"custom":case"anonymous":return new on(r,null);default:return new on(r,t,n)}}(n)}function pn(e,t){return(0,s.Ku)(e).setPersistence(t)}function mn(e){return He(e)}async function gn(e,t){return Re(e).validatePassword(t)}function yn(e,t,n,r){return(0,s.Ku)(e).onIdTokenChanged(t,n,r)}function wn(e,t,n){return(0,s.Ku)(e).beforeAuthStateChanged(t,n)}function _n(e,t,n,r){return(0,s.Ku)(e).onAuthStateChanged(t,n,r)}function vn(e){(0,s.Ku)(e).useDeviceLanguage()}function En(e,t){return(0,s.Ku)(e).updateCurrentUser(t)}function In(e){return(0,s.Ku)(e).signOut()}function Tn(e,t){return Re(e).revokeAccessToken(t)}async function bn(e){return(0,s.Ku)(e).delete()}class Sn{constructor(e,t,n){this.type=e,this.credential=t,this.user=n}static _fromIdtoken(e,t){return new Sn("enroll",e,t)}static _fromMfaPendingCredential(e){return new Sn("signin",e)}toJSON(){const e="enroll"===this.type?"idToken":"pendingCredential";return{multiFactorSession:{[e]:this.credential}}}static fromJSON(e){if(e?.multiFactorSession){if(e.multiFactorSession?.pendingCredential)return Sn._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(e.multiFactorSession?.idToken)return Sn._fromIdtoken(e.multiFactorSession.idToken)}return null}}class An{constructor(e,t,n){this.session=e,this.hints=t,this.signInResolver=n}static _fromError(e,t){const n=Re(e),r=t.customData._serverResponse,s=(r.mfaInfo||[]).map(e=>Ut._fromServerResponse(n,e));S(r.mfaPendingCredential,n,"internal-error");const i=Sn._fromMfaPendingCredential(r.mfaPendingCredential);return new An(i,s,async e=>{const s=await e._process(n,i);delete r.mfaInfo,delete r.mfaPendingCredential;const a={...r,idToken:s.idToken,refreshToken:s.refreshToken};switch(t.operationType){case"signIn":const e=await Tt._fromIdTokenResponse(n,t.operationType,a);return await n._updateCurrentUser(e.user),e;case"reauthenticate":return S(t.user,n,"internal-error"),Tt._forOperation(t.user,t.operationType,a);default:_(n,"internal-error")}})}async resolveSignIn(e){const t=e;return this.signInResolver(t)}}function Cn(e,t){const n=(0,s.Ku)(e),r=t;return S(t.customData.operationType,n,"argument-error"),S(r.customData._serverResponse?.mfaPendingCredential,n,"argument-error"),An._fromError(n,r)}function Nn(e,t){return U(e,"POST","/v2/accounts/mfaEnrollment:start",V(e,t))}class On{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map(t=>Ut._fromServerResponse(e.auth,t)))})}static _fromUser(e){return new On(e)}async getSession(){return Sn._fromIdtoken(await this.user.getIdToken(),this.user)}
2async enroll(e,t){const n=e,r=await this.getSession(),s=await ne(this.user,n._process(this.user.auth,r,t));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){const t="string"==typeof e?e:e.uid,n=await this.user.getIdToken();try{const e=await ne(this.user,(r=this.user.auth,s={idToken:n,mfaEnrollmentId:t},U(r,"POST","/v2/accounts/mfaEnrollment:withdraw",V(r,s))));this.enrolledFactors=this.enrolledFactors.filter(({uid:e})=>e!==t),await this.user._updateTokensIfNecessary(e),await this.user.reload()}catch(e){throw e}var r,s}}const Dn=new WeakMap;function Rn(e){const t=(0,s.Ku)(e);return Dn.has(t)||Dn.set(t,On._fromUser(t)),Dn.get(t)}const kn="__sak";class xn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(kn,"1"),this.storage.removeItem(kn),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class Pn extends xn{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Ae(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});const n=e.key;t?this.detachListener():this.stopPolling();const r=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},i=this.storage.getItem(n);(0,s.lT)()&&10===document.documentMode&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,10):r()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Pn.type="LOCAL";const Ln=Pn;function Mn(e){const t=e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),n=RegExp(`${t}=([^;]+)`);return document.cookie.match(n)?.[1]??null}function Vn(e){return`${"http:"===window.location.protocol?"__dev_":"__HOST-"}FIREBASE_${e.split(":")[3]}`}class Un{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(void 0===typeof window)return e;const t=new URL(`${window.location.origin}/__cookies__`);return t.searchParams.set("finalTarget",e),t}async _isAvailable(){return!("boolean"==typeof isSecureContext&&!isSecureContext)&&("undefined"!=typeof navigator&&"undefined"!=typeof document&&(navigator.cookieEnabled??!0))}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;const t=Vn(e);if(window.cookieStore){const e=await window.cookieStore.get(t);return e?.value}return Mn(t)}async _remove(e){if(!this._isAvailable())return;if(!await this._get(e))return;const t=Vn(e);document.cookie=`${t}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;
2Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,t){if(!this._isAvailable())return;const n=Vn(e);if(window.cookieStore){const e=e=>{const r=e.changed.find(e=>e.name===n);r&&t(r.value);e.deleted.find(e=>e.name===n)&&t(null)},r=()=>window.cookieStore.removeEventListener("change",e);return this.listenerUnsubscribes.set(t,r),window.cookieStore.addEventListener("change",e)}let r=Mn(n);const s=setInterval(()=>{const e=Mn(n);e!==r&&(t(e),r=e)},1e3);this.listenerUnsubscribes.set(t,()=>clearInterval(s))}_removeListener(e,t){const n=this.listenerUnsubscribes.get(t);n&&(n(),this.listenerUnsubscribes.delete(t))}}Un.type="COOKIE";const Fn=Un;class Bn extends xn{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Bn.type="SESSION";const qn=Bn;class zn{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;const n=new zn(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:s}=t.data,i=this.handlersMap[r];if(!i?.size)return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const a=Array.from(i).map(async e=>e(t.origin,s)),o=await function(e){return Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}}))}(a);t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:o})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function jn(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}zn.receivers=[];class Gn{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise((a,o)=>{const c=jn("",20);r.port1.start();const u=setTimeout(()=>{o(new Error("unsupported_event"))},n);i={messageChannel:r,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{o(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(t.data.response);break;default:clearTimeout(u),clearTimeout(s),o(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}function $n(){return window}function Hn(){return void 0!==$n().WorkerGlobalScope&&"function"==typeof $n().importScripts}const Kn="firebaseLocalStorageDb",Wn="firebaseLocalStorage",Yn="fbase_key";class Qn{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function Jn(e,t){return e.transaction([Wn],t?"readwrite":"readonly").objectStore(Wn)}function Xn(){const e=indexedDB.open(Kn,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(Wn,{keyPath:Yn})}catch(e){n(e)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(Wn)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Kn);return new Qn(e).toPromise()}(),t(await Xn()))})})}async function Zn(e,t,n){const r=Jn(e,!0).put({[Yn]:t,value:n});
2return new Qn(r).toPromise()}function er(e,t){const n=Jn(e,!0).delete(t);return new Qn(n).toPromise()}class tr{constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise||(this.dbPromise=Xn(),this.dbPromise.catch(()=>{this.dbPromise=null})),this.dbPromise}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;if(this.dbPromise){(await this.dbPromise).close(),this.dbPromise=null}}}async initializeServiceWorkerMessaging(){return Hn()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=zn._getInstance(Hn()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await async function(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}(),!this.activeServiceWorker)return;this.sender=new Gn(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&(navigator?.serviceWorker?.controller||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return!!indexedDB&&(await this._withRetries(async e=>{await Zn(e,kn,"1"),await er(e,kn)}),!0)}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Zn(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(t=>async function(e,t){const n=Jn(e,!1).get(t),r=await new Qn(n).toPromise();return void 0===r?null:r.value}(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>er(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(e=>{const t=Jn(e,!1).getAll();return new Qn(t).toPromise()});if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:r,value:s}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(const e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}tr.type="LOCAL";const nr=tr;function rr(e,t){return U(e,"POST","/v2/accounts/mfaSignIn:start",V(e,t))}const sr=Le("rcb"),ir=new R(3e4,6e4);class ar{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!$n().grecaptcha?.render}load(e,t=""){return S(function(e){return e.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(e)}(t),e,"argument-error"),this.shouldResolveImmediately(t)&&$($n().grecaptcha)?Promise.resolve($n().grecaptcha):new Promise((n,r)=>{const i=$n().setTimeout(()=>{r(v(e,"network-request-failed"))},ir.get());$n()[sr]=()=>{$n().clearTimeout(i),delete $n()[sr];const s=$n().grecaptcha;if(!s||!$(s))return void r(v(e,"internal-error"));const a=s.render;s.render=(e,t)=>{const n=a(e,t);return this.counter++,n},this.hostLanguage=t,n(s)};Pe(`${xe.recaptchaV2Script}?${(0,s.Am)({onload:sr,render:"explicit",hl:t})}`).catch(()=>{clearTimeout(i),r(v(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!$n().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}class or{async load(e){return new Ve(e)}clearedOneInstance(){}}const cr="recaptcha",ur={theme:"light",type:"image"};class lr{constructor(e,t,n={...ur}){this.parameters=n,this.type=cr,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=Re(e),this.isInvisible="invisible"===this.parameters.size,S("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment");const r="string"==typeof t?document.getElementById(t):t;S(r,this.auth,"argument-error"),this.container=r,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new or:new ar,this.validateStartingState()}async verify(){this.assertNotDestroyed();const e=await this.render(),t=this.getAssertedRecaptcha(),n=t.getResponse(e);return n||new Promise(n=>{const r=e=>{e&&(this.tokenChangeListeners.delete(r),n(e))};this.tokenChangeListeners.add(r),this.isInvisible&&t.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise||(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e})),this.renderPromise}_reset(){this.assertNotDestroyed(),null!==this.widgetId&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEac
2h(e=>{this.container.removeChild(e)})}validateStartingState(){S(!this.parameters.sitekey,this.auth,"argument-error"),S(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),S("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return t=>{if(this.tokenChangeListeners.forEach(e=>e(t)),"function"==typeof e)e(t);else if("string"==typeof e){const n=$n()[e];"function"==typeof n&&n(t)}}}assertNotDestroyed(){S(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){const t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){S(O()&&!Hn(),this.auth,"internal-error"),await function(){let e=null;return new Promise(t=>{"complete"!==document.readyState?(e=()=>t(),window.addEventListener("load",e)):t()}).catch(t=>{throw e&&window.removeEventListener("load",e),t})}(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);const e=await async function(e){return(await U(e,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}(this.auth);S(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return S(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class hr{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){const t=ut._fromVerification(this.verificationId,e);return this.onConfirmation(t)}}async function dr(e,t,n){if((0,r.xZ)(e.app))return Promise.reject(I(e));const i=Re(e),a=await mr(i,t,(0,s.Ku)(n));return new hr(a,e=>Pt(i,e))}async function fr(e,t,n){const r=(0,s.Ku)(e);await Rt(!1,r,"phone");const i=await mr(r.auth,t,(0,s.Ku)(n));return new hr(i,e=>Lt(r,e))}async function pr(e,t,n){const i=(0,s.Ku)(e);if((0,r.xZ)(i.auth.app))return Promise.reject(I(i.auth));const a=await mr(i.auth,t,(0,s.Ku)(n));return new hr(a,e=>Mt(i,e))}async function mr(e,t,n){if(!e._getRecaptchaConfig())try{await He(e)}catch(e){console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let r;if(r="string"==typeof t?{phoneNumber:t}:t,"session"in r){const t=r.session;if("phoneNumber"in r){S("enroll"===t.type,e,"internal-error");const s={idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}},i=$e(e,s,"mfaSmsEnrollment",async(e,t)=>{if(t.phoneEnrollmentInfo.captchaResponse===qe){S(n?.type===cr,e,"argument-error");return Nn(e,await yr(e,t,n))}return Nn(e,t)},"PHONE_PROVIDER");return(await i.catch(e=>Promise.reject(e))).phoneSessionInfo.sessionInfo}{S("signin"===t.type,e,"internal-error");const s=r.multiFactorHint?.uid||r.multiFactorUid;S(s,e,"missing-multi-factor-info");const i={mfaPendingCredential:t.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}},a=$e(e,i,"mfaSmsSignIn",async(e,t)=>{if(t.phoneSignInInfo.captchaResponse===qe){S(n?.type===cr,e,"argument-error");return rr(e,await yr(e,t,n))}return rr(e,t)},"PHONE_PROVIDER");return(await a.catch(e=>Promise.reject(e))).phoneResponseInfo.sessionInfo}}{const t={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"},s=$e(e,t,"sendVerificationCode",async(e,t)=>{if(t.captchaResponse===qe){S(n?.type===cr,e,"argument-error");return ot(e,await yr(e,t,n))}return ot(e,t)},"PHONE_PROVIDER");return(await s.catch(e=>Promise.reject(e))).sessionInfo}}finally{n?._reset()}}async function gr(e,t){const n=(0,s.Ku)(e);if((0,r.xZ)(n.auth.app))return Promise.reject(I(n.auth));await Dt(n,t)}async function yr(e,t,n){S(n.type===cr,e,"argument-error");const r=await n.verify();S("string"==typeof r,e,"argument-error");const s={...t};if("phoneEnrollmentInfo"in s){const e=s.phoneEnrollmentInfo.phoneNumber,t=s.phoneEnrollmentInfo.captchaResponse,n=s.phoneEnrollmentInfo.clientType,i=s.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(s,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:r,captchaResponse:t,clientType:n,recaptchaVersion:i}}),s}if("phoneSignInInfo"in s){const e=s.phoneSignInInfo.captchaResponse,t=s.phoneSignInInfo.clientType,n=s.phoneSignInInfo.recaptchaVersion;return Object.assign(s,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:e,clientType:t,recaptchaVersion:n}}),s}return Object.assign(s,{recaptchaToken:r}),s}class wr{constructor(e){this.providerId=wr.PROVIDER_ID,this.auth=Re(e)}verifyPhoneNumber(e,t){return mr(this.auth,e,(0,s.Ku)(t))}static credential(e,t){return ut._fromVerification(e,t)}static credentialFromResult(e){const t=e;return wr.credentialFromTaggedObject(t)}static credentialFromError(e){return wr.credentialFromTaggedObject(e.customData||{})}
2static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{phoneNumber:t,temporaryProof:n}=e;return t&&n?ut._fromTokenResponse(t,n):null}}function _r(e,t){return t?de(t):(S(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}wr.PROVIDER_ID="phone",wr.PHONE_SIGN_IN_METHOD="phone";class vr extends Je{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return it(e,this._buildIdpRequest())}_linkToIdToken(e,t){return it(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return it(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function Er(e){return xt(e.auth,new vr(e),e.bypassAuthState)}function Ir(e){const{auth:t,user:n}=e;return S(n,t,"internal-error"),kt(n,new vr(e),e.bypassAuthState)}async function Tr(e){const{auth:t,user:n}=e;return S(n,t,"internal-error"),Dt(n,new vr(e),e.bypassAuthState)}class br{constructor(e,t,n,r,s=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:r,tenantId:s,error:i,type:a}=e;if(i)return void this.reject(i);const o={auth:this.auth,requestUri:t,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(o))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Er;case"linkViaPopup":case"linkViaRedirect":return Tr;case"reauthViaPopup":case"reauthViaRedirect":return Ir;default:_(this.auth,"internal-error")}}resolve(e){C(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){C(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const Sr=new R(2e3,1e4);async function Ar(e,t,n){if((0,r.xZ)(e.app))return Promise.reject(v(e,"operation-not-supported-in-this-environment"));const s=Re(e);T(e,t,ft);const i=_r(s,n);return new Or(s,"signInViaPopup",t,i).executeNotNull()}async function Cr(e,t,n){const i=(0,s.Ku)(e);if((0,r.xZ)(i.auth.app))return Promise.reject(v(i.auth,"operation-not-supported-in-this-environment"));T(i.auth,t,ft);const a=_r(i.auth,n);return new Or(i.auth,"reauthViaPopup",t,a,i).executeNotNull()}async function Nr(e,t,n){const r=(0,s.Ku)(e);T(r.auth,t,ft);const i=_r(r.auth,n);return new Or(r.auth,"linkViaPopup",t,i,r).executeNotNull()}class Or extends br{constructor(e,t,n,r,s){super(e,t,r,s),this.provider=n,this.authWindow=null,this.pollId=null,Or.currentPopupAction&&Or.currentPopupAction.cancel(),Or.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return S(e,this.auth,"internal-error"),e}async onExecution(){C(1===this.filter.length,"Popup operations only handle one event");const e=jn();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(v(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(v(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Or.currentPopupAction=null}pollUserCancellation(){const e=()=>{this.authWindow?.window?.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(v(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(e,Sr.get())};e()}}Or.currentPopupAction=null;const Dr=new Map;class Rr extends br{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=Dr.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=Lr(t),r=Pr(e);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}Dr.set(this.auth._key(),e)}return this.bypassAuthState||Dr.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);
2if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}async function kr(e,t){return Pr(e)._set(Lr(t),"true")}function xr(e,t){Dr.set(e._key(),t)}function Pr(e){return de(e._redirectPersistence)}function Lr(e){return me("pendingRedirect",e.config.apiKey,e.name)}function Mr(e,t,n){return async function(e,t,n){if((0,r.xZ)(e.app))return Promise.reject(I(e));const s=Re(e);T(e,t,ft),await s._initializationPromise;const i=_r(s,n);return await kr(i,s),i._openRedirect(s,t,"signInViaRedirect")}(e,t,n)}function Vr(e,t,n){return async function(e,t,n){const i=(0,s.Ku)(e);if(T(i.auth,t,ft),(0,r.xZ)(i.auth.app))return Promise.reject(I(i.auth));await i.auth._initializationPromise;const a=_r(i.auth,n);await kr(a,i.auth);const o=await qr(i);return a._openRedirect(i.auth,t,"reauthViaRedirect",o)}(e,t,n)}function Ur(e,t,n){return async function(e,t,n){const r=(0,s.Ku)(e);T(r.auth,t,ft),await r.auth._initializationPromise;const i=_r(r.auth,n);await Rt(!1,r,t.providerId),await kr(i,r.auth);const a=await qr(r);return i._openRedirect(r.auth,t,"linkViaRedirect",a)}(e,t,n)}async function Fr(e,t){return await Re(e)._initializationPromise,Br(e,t,!1)}async function Br(e,t,n=!1){if((0,r.xZ)(e.app))return Promise.reject(I(e));const s=Re(e),i=_r(s,t),a=new Rr(s,i,n),o=await a.execute();return o&&!n&&(delete o.user._redirectEventId,await s._persistUserIfCurrent(o.user),await s._setRedirectUser(null,t)),o}async function qr(e){const t=jn(`${e.uid}:::`);return e._redirectEventId=t,await e.auth._setRedirectUser(e),await e.auth._persistUserIfCurrent(e),t}
2class zr{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Gr(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!Gr(e)){const n=e.error.code?.split("auth/")[1]||"internal-error";t.onError(v(this.auth,n))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(jr(e))}saveEventToCache(e){this.cachedEventUids.add(jr(e)),this.lastProcessedEventTime=Date.now()}}function jr(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function Gr({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===t?.code}const $r=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Hr=/^https?/;async function Kr(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return U(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(Wr(e))return}catch{}_(e,"unauthorized-domain")}function Wr(e){const t=N(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const s=new URL(e);return""===s.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===r}if(!Hr.test(n))return!1;if($r.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}const Yr=new R(3e4,6e4);function Qr(){const e=$n().___jsl;if(e?.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}function Jr(e){return new Promise((t,n)=>{function r(){Qr(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Qr(),n(v(e,"network-request-failed"))},timeout:Yr.get()})}if($n().gapi?.iframes?.Iframe)t(gapi.iframes.getContext());else{if(!$n().gapi?.load){const t=Le("iframefcb");return $n()[t]=()=>{gapi.load?r():n(v(e,"network-request-failed"))},Pe(`${xe.gapiScript}?onload=${t}`).catch(e=>n(e))}r()}}).catch(e=>{throw Xr=null,e})}let Xr=null;
2const Zr=new R(5e3,15e3),es={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},ts=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ns(e){const t=e.config;S(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?k(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,i={apiKey:t.apiKey,appName:e.name,v:r.MF},a=ts.get(e.config.apiHost);a&&(i.eid=a);const o=e._getFrameworks();return o.length&&(i.fw=o.join(",")),`${n}?${(0,s.Am)(i).slice(1)}`}async function rs(e){const t=await function(e){return Xr=Xr||Jr(e),Xr}(e),n=$n().gapi;return S(n,e,"internal-error"),t.open({where:document.body,url:ns(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:es,dontclear:!0},t=>new Promise(async(n,r)=>{await t.restyle({setHideOnLeave:!1});const s=v(e,"network-request-failed"),i=$n().setTimeout(()=>{r(s)},Zr.get());function a(){$n().clearTimeout(i),n(t)}t.ping(a).then(a,()=>{r(s)})}))}const ss={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class is{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function as(e,t,n,r=500,i=600){const a=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const u={...ss,width:r.toString(),height:i.toString(),top:a,left:o},l=(0,s.ZQ)().toLowerCase();n&&(c=ve(l)?"_blank":n),we(l)&&(t=t||"http://localhost",u.scrollbars="yes");const h=Object.entries(u).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=(0,s.ZQ)()){return Se(e)&&!!window.navigator?.standalone}(l)&&"_self"!==c)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",c),new is(null);const d=window.open(t||"",c,h);S(d,e,"popup-blocked");try{d.focus()}catch(e){}return new is(d)}const os="__/auth/handler",cs="emulator/auth/handler",us=encodeURIComponent("fac");async function ls(e,t,n,i,a,o){S(e.config.authDomain,e,"auth-domain-config-required"),S(e.config.apiKey,e,"invalid-api-key");const c={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:i,v:r.MF,eventId:a};if(t instanceof ft){t.setDefaultLanguage(e.languageCode),c.providerId=t.providerId||"",(0,s.Im)(t.getCustomParameters())||(c.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries(o||{}))c[e]=t}if(t instanceof pt){const e=t.getScopes().filter(e=>""!==e);e.length>0&&(c.scopes=e.join(","))}e.tenantId&&(c.tid=e.tenantId);const u=c;for(const e of Object.keys(u))void 0===u[e]&&delete u[e];const l=await e._getAppCheckToken(),h=l?`#${us}=${encodeURIComponent(l)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${os}`;return k(e,cs)}(e)}?${(0,s.Am)(u).slice(1)}${h}`}const hs="webStorageSupport";const ds=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=qn,this._completeRedirectFn=Br,this._overrideRedirectResult=xr}async _openPopup(e,t,n,r){C(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");return as(e,await ls(e,t,n,N(),r),jn())}async _openRedirect(e,t,n,r){await this._originValidation(e);return function(e){$n().location.href=e}(await ls(e,t,n,N(),r)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(C(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){const t=await rs(e),n=new zr(e);return t.register("authEvent",t=>{S(t?.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(hs,{type:hs},n=>{const r=n?.[0]?.[hs];void 0!==r&&t(!!r),_(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Kr
2(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Ae()||_e()||Se()}};class fs{constructor(e){this.factorId=e}_process(e,t,n){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,n);case"signin":return this._finalizeSignIn(e,t.credential);default:return A("unexpected MultiFactorSessionType")}}}class ps extends fs{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new ps(e)}_finalizeEnroll(e,t,n){return function(e,t){return U(e,"POST","/v2/accounts/mfaEnrollment:finalize",V(e,t))}(e,{idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){return function(e,t){return U(e,"POST","/v2/accounts/mfaSignIn:finalize",V(e,t))}(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}}class ms{constructor(){}static assertion(e){return ps._fromCredential(e)}}ms.FACTOR_ID="phone";class gs{static assertionForEnrollment(e,t){return ys._fromSecret(e,t)}static assertionForSignIn(e,t){return ys._fromEnrollmentId(e,t)}static async generateSecret(e){const t=e;S(void 0!==t.user?.auth,"internal-error");const n=await(r=t.user.auth,s={idToken:t.credential,totpEnrollmentInfo:{}},U(r,"POST","/v2/accounts/mfaEnrollment:start",V(r,s)));var r,s;return ws._fromStartTotpMfaEnrollmentResponse(n,t.user.auth)}}gs.FACTOR_ID="totp";class ys extends fs{constructor(e,t,n){super("totp"),this.otp=e,this.enrollmentId=t,this.secret=n}static _fromSecret(e,t){return new ys(t,void 0,e)}static _fromEnrollmentId(e,t){return new ys(t,e)}async _finalizeEnroll(e,t,n){return S(void 0!==this.secret,e,"argument-error"),function(e,t){return U(e,"POST","/v2/accounts/mfaEnrollment:finalize",V(e,t))}(e,{idToken:t,displayName:n,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,t){S(void 0!==this.enrollmentId&&void 0!==this.otp,e,"argument-error");const n={verificationCode:this.otp};return function(e,t){return U(e,"POST","/v2/accounts/mfaSignIn:finalize",V(e,t))}(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:n})}}class ws{constructor(e,t,n,r,s,i,a){this.sessionInfo=i,this.auth=a,this.secretKey=e,this.hashingAlgorithm=t,this.codeLength=n,this.codeIntervalSeconds=r,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,t){return new ws(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,t)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){let n=!1;return(_s(e)||_s(t))&&(n=!0),n&&(_s(e)&&(e=this.auth.currentUser?.email||"unknownuser"),_s(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}}function _s(e){return void 0===e||0===e?.length}var vs="@firebase/auth",Es="1.13.3";class Is{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){S(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const Ts=(0,s.XA)("authIdTokenMaxAge")||300;let bs=null;function Ss(e=(0,r.Sx)()){const t=(0,r.j6)(e,"auth");if(t.isInitialized())return t.getImmediate();const n=Ke(e,{popupRedirectResolver:ds,persistence:[nr,Ln,qn]}),i=(0,s.XA)("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(i,location.origin);if(location.origin===e.origin){const t=(a=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>Ts)return;const r=t?.token;bs!==r&&(bs=r,await fetch(a,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});wn(n,t,()=>t(n.currentUser)),yn(n,e=>t(e))}}var a;const o=(0,s.Tj)("auth");return o&&We(n,`http://${o}`),n}var As;xe={loadJS:e=>
2new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=v("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(r)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},As="Browser",(0,r.om)(new a.uA("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=n.options;S(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const o={apiKey:i,authDomain:a,clientPlatform:As,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ce(As)},c=new De(n,r,s,o);return function(e,t){const n=t?.persistence||[],r=(Array.isArray(n)?n:[n]).map(de);t?.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t?.popupRedirectResolver)}(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),(0,r.om)(new a.uA("auth-internal",e=>(e=>new Is(e))(Re(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),(0,r.KO)(vs,Es,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(As)),(0,r.KO)(vs,Es,"esm2020")},7223(e,t,n){n.r(t),n.d(t,{fS:()=>fy,Wc:()=>vy,oN:()=>Ey,Ix:()=>Ro,H6:()=>-1,YS:()=>bc,T1:()=>Tc,Wq:()=>ww,uY:()=>ko,S0:()=>Po,_7:()=>Xg,W6:()=>Ue,Ci:()=>Lo,Mh:()=>Jg,J_:()=>Yw,XK:()=>Ic,Li:()=>Dy,wx:()=>Ay,YQ:()=>vw,Gv:()=>qy,Cq:()=>Ny,xC:()=>Ly,jy:()=>xy,NJ:()=>Ew,$c:()=>Uy,mc:()=>yw,Dc:()=>vt,ZX:()=>Ow,V7:()=>Dc,GA:()=>Aw,Y$:()=>Qe,Rw:()=>Dr,cm:()=>Gr,K$:()=>ot,wy:()=>We,eQ:()=>qe,FA:()=>at,kA:()=>n_,lo:()=>pt,bI:()=>Le,AM:()=>gy,Z9:()=>my,qG:()=>Or,qi:()=>De,c8:()=>ut,gS:()=>Bw,gT:()=>ew,O8:()=>tw,Uo:()=>ky,C3:()=>lu,hq:()=>uu,G8:()=>Xy,me:()=>ay,rJ:()=>Sc,Cs:()=>Ac,vN:()=>Ec,U9:()=>Zy,yf:()=>Zw,kd:()=>Fw,CL:()=>ou,LA:()=>uy,mT:()=>Xw,H9:()=>Cc,Fs:()=>xo,_J:()=>_w,ol:()=>ry,Q5:()=>sy,Os:()=>cy,Bh:()=>Jw,FD:()=>jy,rf:()=>zy,Ws:()=>ty,z6:()=>Gw,O_:()=>rw,d_:()=>nw,x7:()=>Rw,nY:()=>kw,_e:()=>xw,GG:()=>Pw,kU:()=>Lw,Rr:()=>Mw,aU:()=>ey,F7:()=>Qw,GV:()=>hu,_A:()=>Zg,AB:()=>My,$1:()=>Vy,po:()=>hy,Ph:()=>fu,kL:()=>cw,ts:()=>lw,$$:()=>uw,Bp:()=>du,St:()=>dy,aQ:()=>qw,bg:()=>zw,FC:()=>jw,or:()=>Ry,My:()=>Py,vK:()=>hw,K7:()=>mw,cY:()=>pw,P:()=>Cy,B:()=>Oc,$t:()=>Iw,yx:()=>Nc,c4:()=>Dw,O5:()=>cu,BN:()=>Vw,LV:()=>Kw,He:()=>Ce,lN:()=>bw,HM:()=>By,EO:()=>Fy,cz:()=>Jy,MH:()=>ly,mZ:()=>Uw,i1:()=>pu,iB:()=>oy,_M:()=>Oy,wP:()=>Hw});var r,s,i=n(3849),a=n(87594),o=n(53607),c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},u={};(function(){var e;function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}function n(e,t,n){n||(n=0);const r=Array(16);if("string"==typeof t)for(var s=0;s<16;++s)r[s]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(s=0;s<16;++s)r[s]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],s=e.g[2];let i,a=e.g[3];i=t+(a^n&(s^a))+r[0]+3614090360&4294967295,i=a+(s^(t=n+(i<<7&4294967295|i>>>25))&(n^s))+r[1]+3905402710&4294967295,a=t+(i<<12&4294967295|i>>>20),i=s+(n^a&(t^n))+r[2]+606105819&4294967295,i=n+(t^(s=a+(i<<17&4294967295|i>>>15))&(a^t))+r[3]+3250441966&4294967295,i=t+(a^(n=s+(i<<22&4294967295|i>>>10))&(s^a))+r[4]+4118548399&4294967295,i=a+(s^(t=n+(i<<7&4294967295|i>>>25))&(n^s))+r[5]+1200080426&4294967295,a=t+(i<<12&4294967295|i>>>20),i=s+(n^a&(t^n))+r[6]+2821735955&4294967295,i=n+(t^(s=a+(i<<17&4294967295|i>>>15))&(a^t))+r[7]+4249261313&4294967295,i=t+(a^(n=s+(i<<22&4294967295|i>>>10))&(s^a))+r[8]+1770035416&4294967295,i=a+(s^(t=n+(i<<7&4294967295|i>>>25))&(n^s))+r[9]+2336552879&4294967295,a=t+(i<<12&4294967295|i>>>20),i=s+(n^a&(t^n))+r[10]+4294925233&4294967295,i=n+(t^(s=a+(i<<17&4294967295|i>>>
vendor: 6,009 bytes, line 2
215))&(a^t))+r[11]+2304563134&4294967295,i=t+(a^(n=s+(i<<22&4294967295|i>>>10))&(s^a))+r[12]+1804603682&4294967295,i=a+(s^(t=n+(i<<7&4294967295|i>>>25))&(n^s))+r[13]+4254626195&4294967295,a=t+(i<<12&4294967295|i>>>20),i=s+(n^a&(t^n))+r[14]+2792965006&4294967295,i=n+(t^(s=a+(i<<17&4294967295|i>>>15))&(a^t))+r[15]+1236535329&4294967295,i=t+(s^a&((n=s+(i<<22&4294967295|i>>>10))^s))+r[1]+4129170786&4294967295,i=a+(n^s&((t=n+(i<<5&4294967295|i>>>27))^n))+r[6]+3225465664&4294967295,a=t+(i<<9&4294967295|i>>>23),i=s+(t^n&(a^t))+r[11]+643717713&4294967295,i=n+(a^t&((s=a+(i<<14&4294967295|i>>>18))^a))+r[0]+3921069994&4294967295,i=t+(s^a&((n=s+(i<<20&4294967295|i>>>12))^s))+r[5]+3593408605&4294967295,i=a+(n^s&((t=n+(i<<5&4294967295|i>>>27))^n))+r[10]+38016083&4294967295,a=t+(i<<9&4294967295|i>>>23),i=s+(t^n&(a^t))+r[15]+3634488961&4294967295,i=n+(a^t&((s=a+(i<<14&4294967295|i>>>18))^a))+r[4]+3889429448&4294967295,i=t+(s^a&((n=s+(i<<20&4294967295|i>>>12))^s))+r[9]+568446438&4294967295,i=a+(n^s&((t=n+(i<<5&4294967295|i>>>27))^n))+r[14]+3275163606&4294967295,a=t+(i<<9&4294967295|i>>>23),i=s+(t^n&(a^t))+r[3]+4107603335&4294967295,i=n+(a^t&((s=a+(i<<14&4294967295|i>>>18))^a))+r[8]+1163531501&4294967295,i=t+(s^a&((n=s+(i<<20&4294967295|i>>>12))^s))+r[13]+2850285829&4294967295,i=a+(n^s&((t=n+(i<<5&4294967295|i>>>27))^n))+r[2]+4243563512&4294967295,a=t+(i<<9&4294967295|i>>>23),i=s+(t^n&(a^t))+r[7]+1735328473&4294967295,i=n+(a^t&((s=a+(i<<14&4294967295|i>>>18))^a))+r[12]+2368359562&4294967295,i=t+((n=s+(i<<20&4294967295|i>>>12))^s^a)+r[5]+4294588738&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^s)+r[8]+2272392833&4294967295,a=t+(i<<11&4294967295|i>>>21),i=s+(a^t^n)+r[11]+1839030562&4294967295,i=n+((s=a+(i<<16&4294967295|i>>>16))^a^t)+r[14]+4259657740&4294967295,i=t+((n=s+(i<<23&4294967295|i>>>9))^s^a)+r[1]+2763975236&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^s)+r[4]+1272893353&4294967295,a=t+(i<<11&4294967295|i>>>21),i=s+(a^t^n)+r[7]+4139469664&4294967295,i=n+((s=a+(i<<16&4294967295|i>>>16))^a^t)+r[10]+3200236656&4294967295,i=t+((n=s+(i<<23&4294967295|i>>>9))^s^a)+r[13]+681279174&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^s)+r[0]+3936430074&4294967295,a=t+(i<<11&4294967295|i>>>21),i=s+(a^t^n)+r[3]+3572445317&4294967295,i=n+((s=a+(i<<16&4294967295|i>>>16))^a^t)+r[6]+76029189&4294967295,i=t+((n=s+(i<<23&4294967295|i>>>9))^s^a)+r[9]+3654602809&4294967295,i=a+((t=n+(i<<4&4294967295|i>>>28))^n^s)+r[12]+3873151461&4294967295,a=t+(i<<11&4294967295|i>>>21),i=s+(a^t^n)+r[15]+530742520&4294967295,i=n+((s=a+(i<<16&4294967295|i>>>16))^a^t)+r[2]+3299628645&4294967295,i=t+(s^((n=s+(i<<23&4294967295|i>>>9))|~a))+r[0]+4096336452&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~s))+r[7]+1126891415&4294967295,a=t+(i<<10&4294967295|i>>>22),i=s+(t^(a|~n))+r[14]+2878612391&4294967295,i=n+(a^((s=a+(i<<15&4294967295|i>>>17))|~t))+r[5]+4237533241&4294967295,i=t+(s^((n=s+(i<<21&4294967295|i>>>11))|~a))+r[12]+1700485571&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~s))+r[3]+2399980690&4294967295,a=t+(i<<10&4294967295|i>>>22),i=s+(t^(a|~n))+r[10]+4293915773&4294967295,i=n+(a^((s=a+(i<<15&4294967295|i>>>17))|~t))+r[1]+2240044497&4294967295,i=t+(s^((n=s+(i<<21&4294967295|i>>>11))|~a))+r[8]+1873313359&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~s))+r[15]+4264355552&4294967295,a=t+(i<<10&4294967295|i>>>22),i=s+(t^(a|~n))+r[6]+2734768916&4294967295,i=n+(a^((s=a+(i<<15&4294967295|i>>>17))|~t))+r[13]+1309151649&4294967295,i=t+(s^((n=s+(i<<21&4294967295|i>>>11))|~a))+r[4]+4149444226&4294967295,i=a+(n^((t=n+(i<<6&4294967295|i>>>26))|~s))+r[11]+3174756917&4294967295,a=t+(i<<10&4294967295|i>>>22),i=s+(t^(a|~n))+r[2]+718787259&4294967295,i=n+(a^((s=a+(i<<15&4294967295|i>>>17))|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(s+(i<<21&4294967295|i>>>11))&4294967295,e.g[2]=e.g[2]+s&4294967295,e.g[3]=e.g[3]+a&4294967295}function i(e,t){this.h=t;const n=[];let r=!0;for(let s=e.length-1;s>=0;s--){const i=0|e[s];r&&i==t||(n[s]=i,r=!1)}this.g=n}!function(e,t){function n(){}n.prototype=t.prototype,e.F=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.D=function(e,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return t.prototype[n].apply(e,s)}}(t,function(){this.blockSize=-1}),t.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},t.prototype.v=function(e,t){void 0===t&&(t=e.length);const r=t-this.blockSize,s=this.C;let i=this.h,a=0;for(;a<t;){if(0==i)for(;a<=r;)n(this,e,a),a+=this.blockSize;if("string"==typeof e){for(;a<t;)if(s[i++]=e.charCodeAt(a++),i==this.blockSize){n(this,s),i=0;break}}else for(;a<t;)if(s[i++]=e[a++],i==this.blockSize){n(this,s),i=0;break}}this.h=i,this.o+=t},t.prototype.A=function(){var e=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;t=8*this.o;for(var n=e.length-8;n<e.length;++n)e[n]=255&t,t/=256;for(this.v(e),e=Array(16),t=0,n=0;n<4;++n)for(let r=0;r<32;r+=8)e[t++]=this.g[n]>>>r&255;return e};var a={};function o(e){return-128<=e&&e<128?function(e,t){var n=a;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,function(e){return new i([0|e],e<0?-1:0)}):new i([0|e],e<0?-1:0)}function c(e){if(isNaN(e)||!isFinite(e))return l;if(e<0)return m(c(-e));const t=[];let n=1;for(let r=0;e>=n;r++)t[r]=e/n|0,n*=4294967296;return new i(t,0)}var l=o(0),h=o(1),d=o(16777216);function f(e){if(0!=e.h)return!1;for(let t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function p(e){return-1==e.h}function m(e){const t=e.g.length,n=[];for(let r=0;r<t;r++)n[r]=~e.g[r];return new i(n,~e.h).add(h)}function g(e,t){return e.add(m(t))}function y(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function w(e,t){this.g=e,this.h=t}function _(e,t){if(f(t))throw Error("division by zero");if(f(e))return new w(l,l);if(p(e))return t=_(m(e),t),new w(m(t.g),m(t.h));if(p(t))return t=_(e,m(t)),new w(m(t.g),t.h);if(e.g.length>
vendor: 8,939 bytes, line 2
230){if(p(e)||p(t))throw Error("slowDivide_ only works with positive integers.");for(var n=h,r=t;r.l(e)<=0;)n=v(n),r=v(r);var s=E(n,1),i=E(r,1);for(r=E(r,2),n=E(n,2);!f(r);){var a=i.add(r);a.l(e)<=0&&(s=s.add(n),i=a),r=E(r,1),n=E(n,1)}return t=g(e,s.j(t)),new w(s,t)}for(s=l;e.l(t)>=0;){for(n=Math.max(1,Math.floor(e.m()/t.m())),r=(r=Math.ceil(Math.log(n)/Math.LN2))<=48?1:Math.pow(2,r-48),a=(i=c(n)).j(t);p(a)||a.l(e)>0;)a=(i=c(n-=r)).j(t);f(i)&&(i=h),s=s.add(i),e=g(e,a)}return new w(s,e)}function v(e){const t=e.g.length+1,n=[];for(let r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new i(n,e.h)}function E(e,t){const n=t>>5;t%=32;const r=e.g.length-n,s=[];for(let i=0;i<r;i++)s[i]=t>0?e.i(i+n)>>>t|e.i(i+n+1)<<32-t:e.i(i+n);return new i(s,e.h)}(e=i.prototype).m=function(){if(p(this))return-m(this).m();let e=0,t=1;for(let n=0;n<this.g.length;n++){const r=this.i(n);e+=(r>=0?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(e){if((e=e||10)<2||36<e)throw Error("radix out of range: "+e);if(f(this))return"0";if(p(this))return"-"+m(this).toString(e);const t=c(Math.pow(e,6));var n=this;let r="";for(;;){const s=_(n,t).g;let i=(((n=g(n,s.j(t))).g.length>0?n.g[0]:n.h)>>>0).toString(e);if(f(n=s))return i+r;for(;i.length<6;)i="0"+i;r=i+r}},e.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return p(e=g(this,e))?-1:f(e)?0:1},e.abs=function(){return p(this)?m(this):this},e.add=function(e){const t=Math.max(this.g.length,e.g.length),n=[];let r=0;for(let s=0;s<=t;s++){let t=r+(65535&this.i(s))+(65535&e.i(s)),i=(t>>>16)+(this.i(s)>>>16)+(e.i(s)>>>16);r=i>>>16,t&=65535,i&=65535,n[s]=i<<16|t}return new i(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(f(this)||f(e))return l;if(p(this))return p(e)?m(this).j(m(e)):m(m(this).j(e));if(p(e))return m(this.j(m(e)));if(this.l(d)<0&&e.l(d)<0)return c(this.m()*e.m());const t=this.g.length+e.g.length,n=[];for(var r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(let t=0;t<e.g.length;t++){const s=this.i(r)>>>16,i=65535&this.i(r),a=e.i(t)>>>16,o=65535&e.i(t);n[2*r+2*t]+=i*o,y(n,2*r+2*t),n[2*r+2*t+1]+=s*o,y(n,2*r+2*t+1),n[2*r+2*t+1]+=i*a,y(n,2*r+2*t+1),n[2*r+2*t+2]+=s*a,y(n,2*r+2*t+2)}for(e=0;e<t;e++)n[e]=n[2*e+1]<<16|n[2*e];for(e=t;e<2*t;e++)n[e]=0;return new i(n,0)},e.B=function(e){return _(this,e).h},e.and=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new i(n,this.h&e.h)},e.or=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new i(n,this.h|e.h)},e.xor=function(e){const t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new i(n,this.h^e.h)},t.prototype.digest=t.prototype.A,t.prototype.reset=t.prototype.u,t.prototype.update=t.prototype.v,s=u.Md5=t,i.prototype.add=i.prototype.add,i.prototype.multiply=i.prototype.j,i.prototype.modulo=i.prototype.B,i.prototype.compare=i.prototype.l,i.prototype.toNumber=i.prototype.m,i.prototype.toString=i.prototype.toString,i.prototype.getBits=i.prototype.i,i.fromNumber=c,i.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if((n=n||10)<2||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return m(e(t.substring(1),n));if(t.indexOf("-")>=0)throw Error('number format error: interior "-" character');const r=c(Math.pow(n,8));let s=l;for(let e=0;e<t.length;e+=8){var i=Math.min(8,t.length-e);const a=parseInt(t.substring(e,e+i),n);i<8?(i=c(Math.pow(n,i)),s=s.j(i).add(c(a))):(s=s.j(r),s=s.add(c(a)))}return s},r=u.Integer=i}).apply(void 0!==c?c:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var l,h,d,f,p,m,g,y,w=n(7664),_="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},v={};(function(){var e,t=Object.defineProperty;var n=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof _&&_];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function r(e,r){if(r)e:{var s=n;e=e.split(".");for(var i=0;i<e.length-1;i++){var a=e[i];if(!(a in s))break e;s=s[a]}(r=r(i=s[e=e[e.length-1]]))!=i&&null!=r&&t(s,e,{configurable:!0,writable:!0,value:r})}}r("Symbol.dispose",function(e){return e||Symbol("Symbol.dispose")}),r("Array.prototype.values",function(e){return e||function(){return this[Symbol.iterator]()}}),r("Object.entries",function(e){return e||function(e){var t,n=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push([t,e[t]]);return n}});var s=s||{},i=this||self;function a(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function o(e,t,n){return e.call.apply(e.bind,arguments)}function c(e,t,n){return(c=o).apply(null,arguments)}function u(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function w(e,t){function n(){}n.prototype=t.prototype,e.Z=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Ob=function(e,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return t.prototype[n].apply(e,s)}}var E="undefined"!=typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function I(e){const t=e.length;if(t>0){const n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function T(e,t){for(let t=1;t<arguments.length;t++){const r=arguments[t];var n=typeof r;if("array"==(n="object"!=n?n:r?Array.isArray(r)?"array":n:"null")||"object"==n&&"number"==typeof r.length){n=e.length||0;const t=r.length||0;e.length=n+t;for(let s=0;s<t;s++)e[n+s]=r[s]}else e.push(r)}}function b(e){i.setTimeout(()=>{throw e},0)}function S(){var e=D;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var A=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return this.h>0?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new C,e=>e.reset());class C{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let N,O=!1,D=new class{constructor(){this.h=this.g=null}add(e,t){const n=A.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},R=()=>{const e=Promise.resolve(void 0);N=()=>{e.then(k)}};function k(){for(var e;e=S();){try{e.h.call(e.g)}catch(e){b(e)}var t=A;t.j(e),t.h<100&&(t.h++,e.next=t.g,t.g=e)}O=!1}function x(){this.u=this.u,this.C=this.C}function P(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}x.prototype.u=!1,x.prototype.dispose=function(){this.u||(this.u=!0,this.N())},x.prototype[Symbol.dispose]=function(){this.dispose()},x.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},P.prototype.h=function(){this.defaultPrevented=!0};var L=function(){if(!i.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};i.addEventListener("test",e,t),i.removeEventListener("test",e,t)}catch(e){}return e}();function M(e){return/^[\s\xa0]*$/.test(e)}function V(e,t){P.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e&&this.init(e,t)}w(V,P),V.prototype.init=function(e,t){const n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,(t=e.relatedTarget)||("mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement)),this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType=e.pointerType,this.state=e.state,this.i=e,e.defaultPrevented&&V.Z.h.call(this)},V.prototype.h=function(){V.Z.h.call(this);const e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var U="closure_listenable_"+(1e6*Math.random()|0),F=0;function B(e,t,n,r,s){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=s,this.key=++F,this.da=this.fa=!1}function q(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function z(e,t,n){for(const r in e)t.call(n,e[r],r,e)}function j(e){const t={};for(const n in e)t[n]=e[n];return t}const G="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
2ing toString valueOf".split(" ");function $(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t],r)e[n]=r[n];for(let t=0;t<G.length;t++)n=G[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function H(e){this.src=e,this.g={},this.h=0}function K(e,t){const n=t.type;if(n in e.g){var r,s=e.g[n],i=Array.prototype.indexOf.call(s,t,void 0);(r=i>=0)&&Array.prototype.splice.call(s,i,1),r&&(q(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function W(e,t,n,r){for(let s=0;s<e.length;++s){const i=e[s];if(!i.da&&i.listener==t&&i.capture==!!n&&i.ha==r)return s}return-1}H.prototype.add=function(e,t,n,r,s){const i=e.toString();(e=this.g[i])||(e=this.g[i]=[],this.h++);const a=W(e,t,r,s);return a>-1?(t=e[a],n||(t.fa=!1)):((t=new B(t,this.src,i,!!r,s)).fa=n,e.push(t)),t};var Y="closure_lm_"+(1e6*Math.random()|0),Q={};function J(e,t,n,r,s){if(r&&r.once)return Z(e,t,n,r,s);if(Array.isArray(t)){for(let i=0;i<t.length;i++)J(e,t[i],n,r,s);return null}return n=ae(n),e&&e[U]?e.J(t,n,a(r)?!!r.capture:!!r,s):X(e,t,n,!1,r,s)}function X(e,t,n,r,s,i){if(!t)throw Error("Invalid event type");const o=a(s)?!!s.capture:!!s;let c=se(e);if(c||(e[Y]=c=new H(e)),(n=c.add(t,n,r,o,i)).proxy)return n;if(r=function(){function e(n){return t.call(e.src,e.listener,n)}const t=re;return e}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)L||(s=o),void 0===s&&(s=!1),e.addEventListener(t.toString(),r,s);else if(e.attachEvent)e.attachEvent(ne(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}return n}function Z(e,t,n,r,s){if(Array.isArray(t)){for(let i=0;i<t.length;i++)Z(e,t[i],n,r,s);return null}return n=ae(n),e&&e[U]?e.K(t,n,a(r)?!!r.capture:!!r,s):X(e,t,n,!0,r,s)}function ee(e,t,n,r,s){if(Array.isArray(t))for(var i=0;i<t.length;i++)ee(e,t[i],n,r,s);else r=a(r)?!!r.capture:!!r,n=ae(n),e&&e[U]?(e=e.i,(i=String(t).toString())in e.g&&((n=W(t=e.g[i],n,r,s))>-1&&(q(t[n]),Array.prototype.splice.call(t,n,1),0==t.length&&(delete e.g[i],e.h--)))):e&&(e=se(e))&&(t=e.g[t.toString()],e=-1,t&&(e=W(t,n,r,s)),(n=e>-1?t[e]:null)&&te(n))}function te(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[U])K(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(ne(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=se(t))?(K(n,e),0==n.h&&(n.src=null,t[Y]=null)):q(e)}}}function ne(e){return e in Q?Q[e]:Q[e]="on"+e}function re(e,t){if(e.da)e=!0;else{t=new V(t,this);const n=e.listener,r=e.ha||e.src;e.fa&&te(e),e=n.call(r,t)}return e}function se(e){return(e=e[Y])instanceof H?e:null}var ie="__closure_events_fn_"+(1e9*Math.random()>>>0);function ae(e){return"function"==typeof e?e:(e[ie]||(e[ie]=function(t){return e.handleEvent(t)}),e[ie])}function oe(){x.call(this),this.i=new H(this),this.M=this,this.G=null}function ce(e,t){var n,r=e.G;if(r)for(n=[];r;r=r.G)n.push(r);if(e=e.M,r=t.type||t,"string"==typeof t)t=new P(t,e);else if(t instanceof P)t.target=t.target||e;else{var s=t;$(t=new P(r,e),s)}let i,a;if(s=!0,n)for(a=n.length-1;a>=0;a--)i=t.g=n[a],s=ue(i,r,!0,t)&&s;if(i=t.g=e,s=ue(i,r,!0,t)&&s,s=ue(i,r,!1,t)&&s,n)for(a=0;a<n.length;a++)i=t.g=n[a],s=ue(i,r,!1,t)&&s}function ue(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();let s=!0;for(let i=0;i<t.length;++i){const a=t[i];if(a&&!a.da&&a.capture==n){const t=a.listener,n=a.ha||a.src;a.fa&&K(e.i,a),s=!1!==t.call(n,r)&&s}}return s&&!r.defaultPrevented}function le(e){e.g=function(e,t){if("function"!=typeof e){if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=c(e.handleEvent,e)}return Number(t)>2147483647?-1:i.setTimeout(e,t||0)}(()=>{e.g=null,e.i&&(e.i=!1,le(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}w(oe,x),oe.prototype[U]=!0,oe.prototype.removeEventListener=function(e,t,n,r){ee(this,e,t,n,r)},oe.prototype.N=function(){if(oe.Z.N.call(this),this.i){var e=this.i;for(const t in e.g){const n=e.g[t];for(let e=0;e<n.length;e++)q(n[e]);delete e.g[t],e.h--}}this.G=null},oe.prototype.J=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},oe.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};class he extends x{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:le(this)}N(){super.N(),this.g&&(i.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function de(e){x.call(this),this.h=e,this.g={}}w(de,x);var fe=[];function pe(e){z(e.g,function(e,t){this.g.hasOwnProperty(t)&&te(e)},e),e.g={}}de.prototype.N=function(){de.Z.N.call(this),pe(this)},de.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var me=i.JSON.stringify,ge=i.JSON.parse,ye=class{stringify(e){return i.JSON.stringify(e,void 0)}parse(e){return i.JSON.parse(e,void 0)}};function we(){}function _e(){}var ve={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function Ee(){P.call(this,"d")}function Ie(){P.call(this,"c")}w(Ee,P),w(Ie,P);var Te={},be=null;function Se(){return be=be||new oe}function Ae(e){P.call(this,Te.Ia,e)}function Ce(e){const t=Se();ce(t,new Ae(t))}function Ne(e,t){P.call(this,Te.STAT_EVENT,e),this.stat=t}function Oe(e){const t=Se();ce(t,new Ne(t,e))}function De(e,t){P.call(this,Te.Ja,e),this.size=t}function Re(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return i.setTimeout(function(){e()},t)}function ke(){this.g=!0}function xe(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{const i=JSON.parse(t);if(i)for(e=0;e<i.length;e++)if(Array.isArray(i[e])){var n=i[e];if(!(n.length<2)){var r=n[1];if(Array.isArray(r)&&!(r.length<1)){var s=r[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(let e=1;e<r.length;e++)r[e]=""}}}return me(i)}catch(e){return t}}(e,n)+(r?" "+r:"")})}Te.Ia="serverreachability",w(Ae,P),Te.STAT_EVENT="statevent",w(Ne,P),Te.Ja="timingevent",w(De,P),ke.prototype.ua=function(){this.g=!1},ke.prototype.info=function(){};var Pe,Le={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},Me={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"};function Ve(){}function Ue(e){return encodeURIComponent(String(e))}function Fe(e){var t=1;e=e.split(":");const n=[];for(;t>0&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function Be(e,t,n,r){this.j=e,this.i=t,this.l=n,this.S=r||1,this.V=new de(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 qe}function qe(){this.i=null,this.g="",this.h=!1}
vendor: 25,228 bytes, line 2
2w(Ve,we),Ve.prototype.g=function(){return new XMLHttpRequest},Pe=new Ve;var ze={},je={};function Ge(e,t,n){e.M=1,e.A=mt(lt(t)),e.u=n,e.R=!0,$e(e,null)}function $e(e,t){e.F=Date.now(),We(e),e.B=lt(e.A);var n=e.B,r=e.S;Array.isArray(r)||(r=[String(r)]),Ot(n.i,"t",r),e.C=0,n=e.j.L,e.h=new qe,e.g=gn(e.j,n?t:null,!e.u),e.P>0&&(e.O=new he(c(e.Y,e,e.g),e.P)),t=e.V,n=e.g,r=e.ba;var s="readystatechange";Array.isArray(s)||(s&&(fe[0]=s.toString()),s=fe);for(let e=0;e<s.length;e++){const i=J(n,s[e],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}t=e.J?j(e.J):{},e.u?(e.v||(e.v="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.B,e.v,e.u,t)):(e.v="GET",e.g.ea(e.B,e.v,null,t)),Ce(),function(e,t,n,r,s,i){e.info(function(){if(e.g)if(i){var a="",o=i.split("&");for(let e=0;e<o.length;e++){var c=o[e].split("=");if(c.length>1){const e=c[0];c=c[1];const t=e.split("_");a=t.length>=2&&"type"==t[1]?a+(e+"=")+c+"&":a+(e+"=redacted&")}}}else a=null;else a=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+t+"\n"+n+"\n"+a})}(e.i,e.v,e.B,e.l,e.S,e.u)}function He(e){return!!e.g&&("GET"==e.v&&2!=e.M&&e.j.Aa)}function Ke(e,t){var n=e.C,r=t.indexOf("\n",n);return-1==r?je:(n=Number(t.substring(n,r)),isNaN(n)?ze:(r+=1)+n>t.length?je:(t=t.slice(r,r+n),e.C=r+n,t))}function We(e){e.T=Date.now()+e.H,Ye(e,e.H)}function Ye(e,t){if(null!=e.D)throw Error("WatchDog timer not null");e.D=Re(c(e.aa,e),t)}function Qe(e){e.D&&(i.clearTimeout(e.D),e.D=null)}function Je(e){0==e.j.I||e.K||hn(e.j,e)}function Xe(e){Qe(e);var t=e.O;t&&"function"==typeof t.dispose&&t.dispose(),e.O=null,pe(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dispose())}function Ze(e,t){try{var n=e.j;if(0!=n.I&&(n.g==e||st(n.h,e)))if(!e.L&&st(n.h,e)&&3==n.I){try{var r=n.Ba.g.parse(t)}catch(e){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){e:if(!n.v){if(n.g){if(!(n.g.F+3e3<e.F))break e;ln(n),Zt(n)}on(n),Oe(18)}}else n.xa=s[1],0<n.xa-n.K&&s[2]<37500&&n.F&&0==n.A&&!n.C&&(n.C=Re(c(n.Va,n),6e3));rt(n.h)<=1&&n.ta&&(n.ta=void 0)}else fn(n,11)}else if((e.L||n.g==e)&&ln(n),!M(t))for(s=n.Ba.g.parse(t),t=0;t<s.length;t++){let c=s[t];const l=c[0];if(!(l<=n.K))if(n.K=l,c=c[1],2==n.I)if("c"==c[0]){n.M=c[1],n.ba=c[2];const t=c[3];null!=t&&(n.ka=t,n.j.info("VER="+n.ka));const s=c[4];null!=s&&(n.za=s,n.j.info("SVER="+n.za));const l=c[5];null!=l&&"number"==typeof l&&l>0&&(r=1.5*l,n.O=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;const h=e.g;if(h){const e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var i=r.h;i.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(i.j=i.l,i.g=new Set,i.h&&(it(i,i.h),i.h=null))}if(r.G){const e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(r.wa=e,pt(r.J,r.G,e))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-e.F,n.j.info("Handshake RTT: "+n.T+"ms"));var a=e;if((r=n).na=mn(r,r.L?r.ba:null,r.W),a.L){at(r.h,a);var o=a,u=r.O;u&&(o.H=u),o.D&&(Qe(o),We(o)),r.g=a}else an(r);n.i.length>0&&tn(n)}else"stop"!=c[0]&&"close"!=c[0]||fn(n,7);else 3==n.I&&("stop"==c[0]||"close"==c[0]?"stop"==c[0]?fn(n,7):Xt(n):"noop"!=c[0]&&n.l&&n.l.qa(c),n.A=0)}Ce()}catch(e){}}Be.prototype.ba=function(e){e=e.target;const t=this.O;t&&3==Wt(e)?t.j():this.Y(e)},Be.prototype.Y=function(e){try{if(e==this.g)e:{const c=Wt(this.g),u=this.g.ya();this.g.ca();if(!(c<3)&&(3!=c||this.g&&(this.h.h||this.g.la()||Yt(this.g)))){this.K||4!=c||7==u||Ce(),Qe(this);var t=this.g.ca();this.X=t;var n=function(e){if(!He(e))return e.g.la();const t=Yt(e.g);if(""===t)return"";let n="";const r=t.length,s=4==Wt(e.g);if(!e.h.i){if("undefined"==typeof TextDecoder)return Xe(e),Je(e),"";e.h.i=new i.TextDecoder}for(let i=0;i<r;i++)e.h.h=!0,n+=e.h.i.decode(t[i],{stream:!(s&&i==r-1)});return t.length=0,e.h.g+=n,e.C=0,e.h.g}(this);if(this.o=200==t,function(e,t,n,r,s,i,a){e.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+t+"\n"+n+"\n"+i+" "+a})}(this.i,this.v,this.B,this.l,this.S,c,t),this.o){if(this.U&&!this.L){t:{if(this.g){var r,s=this.g;if((r=s.g?s.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!M(r)){var a=r;break t}}a=null}if(!(e=a)){this.o=!1,this.m=3,Oe(12),Xe(this),Je(this);break e}xe(this.i,this.l,e,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,Ze(this,e)}if(this.R){let t;for(e=!0;!this.K&&this.C<n.length;){if(t=Ke(this,n),t==je){4==c&&(this.m=4,Oe(14),e=!1),xe(this.i,this.l,null,"[Incomplete Response]");break}if(t==ze){this.m=4,Oe(15),xe(this.i,this.l,n,"[Invalid Chunk]"),e=!1;break}xe(this.i,this.l,t,null),Ze(this,t)}if(He(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=c||0!=n.length||this.h.h||(this.m=1,Oe(16),e=!1),this.o=this.o&&e,e){if(n.length>0&&!this.W){this.W=!0;var o=this.j;o.g==this&&o.aa&&!o.P&&(o.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),cn(o),o.P=!0,Oe(11))}}else xe(this.i,this.l,n,"[Invalid Chunked Response]"),Xe(this),Je(this)}else xe(this.i,this.l,n,null),Ze(this,n);4==c&&Xe(this),this.o&&!this.K&&(4==c?hn(this.j,this):(this.o=!1,We(this)))}else(function(e){const t={};e=(e.g&&Wt(e)>=2&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let r=0;r<e.length;r++){if(M(e[r]))continue;var n=Fe(e[r]);const s=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const i=t[s]||[];t[s]=i,i.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==t&&n.indexOf("Unknown SID")>0?(this.m=3,Oe(12)):(this.m=0,Oe(13)),Xe(this),Je(this)}}}catch(e){}},Be.prototype.cancel=function(){this.K=!0,Xe(this)},Be.prototype.aa=function(){this.D=null;const e=Date.now();e-this.T>=0?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.B),2!=this.M&&(Ce(),Oe(17)),Xe(this),this.m=2,Je(this)):Ye(this,this.T-e)};var et=class{constructor(e,t){this.g=e,this.map=t}};function tt(e){this.l=e||10,i.PerformanceNavigationTiming?e=(e=i.performance.getEntriesByType("navigation")).length>0&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(i.chrome&&i.chrome.loadTimes&&i.chrome.loadTimes()&&i.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function nt(e){return!!e.h||!!e.g&&e.g.size>=e.j}function rt(e){return e.h?1:e.g?e.g.size:0}function st(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function it(e,t){e.g?e.g.add(t):e.h=t}function at(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function ot(e){if(null!=e.h)return e.i.concat(e.h.G);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.G);return t}return I(e.i)}tt.prototype.cancel=function(){if(this.i=ot(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var ct=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function ut(e){let t;this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1,e instanceof ut?(this.l=e.l,ht(this,e.j),this.o=e.o,this.g=e.g,dt(this,e.u),this.h=e.h,ft(this,Dt(e.i)),this.m=e.m):e&&(t=String(e).match(ct))?(this.l=!1,ht(this,t[1]||"",!0),this.o=gt(t[2]||""),this.g=gt(t[3]||"",!0),dt(this,t[4]),this.h=gt(t[5]||"",!0),ft(this,t[6]||"",!0),this.m=gt(t[7]||"")):(this.l=!1,this.i=new bt(null,this.l))}function lt(e){return new ut(e)}function ht(e,t,n){e.j=n?gt(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function dt(e,t){if(t){if(t=Number(t),isNaN(t)||t<0)throw Error("Bad port number "+t);e.u=t}else e.u=null}function ft(e,t,n){t instanceof bt?(e.i=t,function(e,t){t&&!e.j&&(St(e),e.i=null,e.g.forEach(function(e,t){const n=t.toLowerCase();t!=n&&(At(this,t),Ot(this,n,e))},e)),e.j=t}(e.i,e.l)):(n||(t=yt(t,It)),e.i=new bt(t,e.l))}function pt(e,t,n){e.i.set(t,n)}function mt(e){return pt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function gt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function yt(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,wt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function wt(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}ut.prototype.toString=function(){const e=[];var t=this.j;t&&e.push(yt(t,_t,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(yt(t,_t,!0),"@"),e.push(Ue(n).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.u)&&e.push(":",String(n))),(n=this.h)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(yt(n,"/"==n.charAt(0)?Et:vt,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",yt(n,Tt)),e.join("")},ut.prototype.resolve=function(e){const t=lt(this);let n=!!e.j;n?ht(t,e.j):n=!!e.o,n?t.o=e.o:n=!!e.g,n?t.g=e.g:n=null!=e.u;var r=e.h;if(n)dt(t,e.u);else if(n=!!e.h){if("/"!=r.charAt(0))if(this.g&&!this.h)r="/"+r;else{var s=t.h.lastIndexOf("/");-1!=s&&(r=t.h.slice(0,s+1)+r)}if(".."==(s=r)||"."==s)r="";else if(-1!=s.indexOf("./")||-1!=s.indexOf("/.")){r=0==s.lastIndexOf("/",0),s=s.split("/");const e=[];for(let t=0;t<s.length;){const n=s[t++];"."==n?r&&t==s.length&&e.push(""):".."==n?((e.length>1||1==e.length&&""!=e[0])&&e.pop(),r&&t==s.length&&e.push("")):(e.push(n),r=!0)}r=e.join("/")}else r=s}return n?t.h=r:n=""!==e.i.toString(),n?ft(t,Dt(e.i)):n=!!e.m,n&&(t.m=e.m),t};var _t=/[#\/\?@]/g,vt=/[#\?:]/g,Et=/[#\?]/g,It=/[#\?@]/g,Tt=/#/g;function bt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function St(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(let n=0;n<e.length;n++){const r=e[n].indexOf("=");let s,i=null;r>=0?(s=e[n].substring(0,r),i=e[n].substring(r+1)):s=e[n],t(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function At(e,t){St(e),t=Rt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Ct(e,t){return St(e),t=Rt(e,t),e.g.has(t)}function Nt(e,t){St(e);let n=[];if("string"==typeof t)Ct(e,t)&&(n=n.concat(e.g.get(Rt(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)n=n.concat(e[t]);return n}function Ot(e,t,n){At(e,t),n.length>0&&(e.i=null,e.g.set(Rt(e,t),I(n)),e.h+=n.length)}function Dt(e){const t=new bt;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function Rt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function kt(e,t,n,r,s){try{s&&(s.onload=null,s.onerror=null,s.onabort=null,s.ontimeout=null),r(n)}catch(e){}}function xt(){this.g=new ye}function Pt(e){this.i=e.Sb||null,this.h=e.ab||!1}function Lt(e,t){oe.call(this),this.H=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}function Mt(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}function Vt(e){e.readyState=4,e.l=null,e.j=null,e.B=null,Ut(e)}function Ut(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function Ft(e){let t="";return z(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function Bt(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=Ft(n),"string"==typeof e?null!=n&&Ue(n):pt(e,t,n))}function qt(e){oe.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}(e=bt.prototype).add=function(e,t){St(this),this.i=null,e=Rt(this,e);let n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){St(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)},e.set=function(e,t){return St(this),this.i=null,Ct(this,e=Rt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&(e=Nt(this,e)).length>0?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(let r=0;r<t.length;r++){var n=t[r];const s=Ue(n);n=Nt(this,n);for(let t=0;t<n.length;t++){let r=s;""!==n[t]&&(r+="="+Ue(n[t])),e.push(r)}}return this.i=e.join("&")},w(Pt,we),Pt.prototype.g=function(){return new Lt(this.i,this.h)},w(Lt,oe),(e=Lt.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=e,this.D=t,this.readyState=1,Ut(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};e&&(t.body=e),(this.H||i).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&4!=this.readyState&&(this.g=!1,Vt(this)),this.readyState=0},e.Pa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,Ut(this)),this.g&&(this.readyState=3,Ut(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(void 0!==i.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;Mt(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))},e.Ma=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?Vt(this):Ut(this),3==this.readyState&&Mt(this)}},e.Oa=function(e){this.g&&(this.response=this.responseText=e,Vt(this))},e.Na=function(e){this.g&&(this.response=e,Vt(this))},e.ga=function(){this.g&&Vt(this)},e.setRequestHeader=function(e,t){this.A.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Lt.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),w(qt,oe);var zt=/^https?$/i,jt=["POST","PUT"];function Gt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,$t(e),Kt(e)}function $t(e){e.A||(e.A=!0,ce(e,"complete"),ce(e,"error"))}function Ht(e){if(e.h&&void 0!==s)if(e.v&&4==Wt(e))setTimeout(e.Ca.bind(e),0);else if(ce(e,"readystatechange"),4==Wt(e)){e.h=!1;try{const s=e.ca();e:switch(s){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var r;if(r=0===s){let t=String(e.D).match(ct)[1]||null;!t&&i.self&&i.self.location&&(t=i.self.location.protocol.slice(0,-1)),r=!zt.test(t?t.toLowerCase():"")}n=r}if(n)ce(e,"complete"),ce(e,"success");else{e.o=6;try{var a=Wt(e)>2?e.g.statusText:""}catch(e){a=""}e.l=a+" ["+e.ca()+"]",$t(e)}}finally{Kt(e)}}}function Kt(e,t){if(e.g){e.m&&(clearTimeout(e.m),e.m=null);const n=e.g;e.g=null,t||ce(e,"ready");try{n.onreadystatechange=null}catch(e){}}}function Wt(e){return e.g?e.g.readyState:0}function Yt(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.F){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function Qt(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Jt(e){this.za=0,this.i=[],this.j=new ke,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=Qt("failFast",!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Qt("baseRetryDelayMs",5e3,e),this.Za=Qt("retryDelaySeedMs",1e4,e),this.Ta=Qt("forwardChannelMaxRetries",2,e),this.va=Qt("forwardChannelRequestTimeoutMs",2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M="",this.h=new tt(e&&e.concurrentRequestLimit),this.Ba=new xt,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&e.longPollingTimeout>0&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function Xt(e){if(en(e),3==e.I){var t=e.V++,n=lt(e.J);if(pt(n,"SID",e.M),pt(n,"RID",t),pt(n,"TYPE","terminate"),rn(e,n),(t=new Be(e,e.j,t)).M=2,t.A=mt(lt(n)),n=!1,i.navigator&&i.navigator.sendBeacon)try{n=i.navigator.sendBeacon(t.A.toString(),"")}catch(e){}!n&&i.Image&&((new Image).src=t.A,n=!0),n||(t.g=gn(t.j,null),t.g.ea(t.A)),t.F=Date.now(),We(t)}pn(e)}function Zt(e){e.g&&(cn(e),e.g.cancel(),e.g=null)}function en(e){Zt(e),e.v&&(i.clearTimeout(e.v),e.v=null),ln(e),e.h.cancel(),e.m&&("number"==typeof e.m&&i.clearTimeout(e.m),e.m=null)}function tn(e){if(!nt(e.h)&&!e.m){e.m=!0;var t=e.Ea;N||R(),O||(N(),O=!0),D.add(t,e),e.D=0}}function nn(e,t){var n;n=t?t.l:e.V++;const r=lt(e.J);pt(r,"SID",e.M),pt(r,"RID",n),pt(r,"AID",e.K),rn(e,r),e.u&&e.o&&Bt(r,e.u,e.o),n=new Be(e,e.j,n,e.D+1),null===e.u&&(n.J=e.o),t&&(e.i=t.G.concat(e.i)),t=sn(e,n,1e3),n.H=Math.round(.5*e.va)+Math.round(.5*e.va*Math.random()),it(e.h,n),Ge(n,r,t)}function rn(e,t){e.H&&z(e.H,function(e,n){pt(t,n,e)}),e.l&&z({},function(e,n){pt(t,n,e)})}function sn(e,t,n){n=Math.min(e.i.length,n);const r=e.l?c(e.l.Ka,e.l,e):null;e:{var s=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?n>0?(t=s[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let c=!0;for(let u=0;u<n;u++){var i=s[u].g;const n=s[u].map;if((i-=t)<0)t=Math.max(0,s[u].g-100),c=!1;else try{i="req"+i+"_"||0;try{var o=n instanceof Map?n:Object.entries(n);for(const[t,n]of o){let r=n;a(n)&&(r=me(n)),e.push(i+t+"="+encodeURIComponent(r))}}catch(t){throw e.push(i+"type="+encodeURIComponent("_badmap")),t}}catch(e){r&&r(n)}}if(c){o=e.join("&");break e}}o=void 0}return e=e.i.splice(0,n),t.G=e,o}function an(e){if(!e.g&&!e.v){e.Y=1;var t=e.Da;N||R(),O||(N(),O=!0),D.add(t,e),e.A=0}}function on(e){return!(e.g||e.v||e.A>=3)&&(e.Y++,e.v=Re(c(e.Da,e),dn(e,e.A)),e.A++,!0)}function cn(e){null!=e.B&&(i.clearTimeout(e.B),e.B=null)}function un(e){e.g=new Be(e,e.j,"rpc",e.Y),null===e.u&&(e.g.J=e.o),e.g.P=0;var t=lt(e.na);pt(t,"RID","rpc"),pt(t,"SID",e.M),pt(t,"AID",e.K),pt(t,"CI",e.F?"0":"1"),!e.F&&e.ia&&pt(t,"TO",e.ia),pt(t,"TYPE","xmlhttp"),rn(e,t),e.u&&e.o&&Bt(t,e.u,e.o),e.O&&(e.g.H=e.O);var n=e.g;e=e.ba,n.M=1,n.A=mt(lt(t)),n.u=null,n.R=!0,$e(n,e)}function ln(e){null!=e.C&&(i.clearTimeout(e.C),e.C=null)}function hn(e,t){var n=null;if(e.g==t){ln(e),cn(e),e.g=null;var r=2}else{if(!st(e.h,t))return;n=t.G,at(e.h,t),r=1}if(0!=e.I)if(t.o)if(1==r){n=t.u?t.u.length:0,t=Date.now()-t.F;var s=e.D;ce(r=Se(),new De(r,n)),tn(e)}else an(e);else if(3==(s=t.m)||0==s&&t.X>0||!(1==r&&function(e,t){return!(rt(e.h)>=e.h.j-(e.m?1:0)||(e.m?(e.i=t.G.concat(e.i),0):1==e.I||2==e.I||e.D>=(e.Sa?0:e.Ta)||(e.m=Re(c(e.Ea,e,t),dn(e,e.D)),e.D++,0)))}(e,t)||2==r&&on(e)))switch(n&&n.length>0&&(t=e.h,t.i=t.i.concat(n)),s){case 1:fn(e,5);break;case 4:fn(e,10);break;case 3:fn(e,6);break;default:fn(e,2)}}function dn(e,t){let n=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(n*=2),n*t}function fn(e,t){if(e.j.info("Error code "+t),2==t){var n=c(e.bb,e),r=e.Ua;const t=!r;r=new ut(r||"//www.google.com/images/cleardot.gif"),i.location&&"http"==i.location.protocol||ht(r,"https"),mt(r),t?function(e,t){const n=new ke;if(i.Image){const r=new Image;r.onload=u(kt,n,"TestLoadImage: loaded",!0,t,r),r.onerror=u(kt,n,"TestLoadImage: error",!1,t,r),r.onabort=u(kt,n,"TestLoadImage: abort",!1,t,r),r.ontimeout=u(kt,n,"TestLoadImage: timeout",!1,t,r),i.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}(r.toString(),n):function(e,t){new ke;const n=new AbortController,r=setTimeout(()=>{n.abort(),kt(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(r),e.ok?kt(0,0,!0,t):kt(0,0,!1,t)}).catch(()=>{clearTimeout(r),kt(0,0,!1,t)})}(r.toString(),n)}else Oe(2);e.I=0,e.l&&e.l.pa(t),pn(e),en(e)}function pn(e){if(e.I=0,e.ja=[],e.l){const t=ot(e.h);0==t.length&&0==e.i.length||(T(e.ja,t),T(e.ja,e.i),e.h.i.length=0,I(e.i),e.i.length=0),e.l.oa()}}function mn(e,t,n){var r=n instanceof ut?lt(n):new ut(n);if(""!=r.g)t&&(r.g=t+"."+r.g),dt(r,r.u);else{var s=i.location;r=s.protocol,t=t?t+"."+s.hostname:s.hostname,s=+s.port;const e=new ut(null);r&&ht(e,r),t&&(e.g=t),s&&dt(e,s),n&&(e.h=n),r=e}return n=e.G,t=e.wa,n&&t&&pt(r,n,t),pt(r,"VER",e.ka),rn(e,r),r}function gn(e,t,n){if(t&&!e.L)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Aa&&!e.ma?new qt(new Pt({ab:n})):new qt(e.ma)).Fa(e.L),t}function yn(){}function wn(){}function _n(e,t){oe.call(this),this.g=new Jt(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.sa&&(e?e["X-WebChannel-Client-Profile"]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!M(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!M(t)&&(this.g.G=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new In(this)}function vn(e){Ee.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(const n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function En(){Ie.call(this),this.status=1}function In(e){this.g=e}(e=qt.prototype).Fa=function(e){this.H=e},e.ea=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Pe.g(),this.g.onreadystatechange=E(c(this.Ca,this));try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void Gt(this,e)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var s in r)n.set(s,r[s]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));for(const e of r.keys())n.set(e,r.get(e))}r=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),s=i.FormData&&e instanceof i.FormData,!(Array.prototype.indexOf.call(jt,t,void 0)>=0)||r||s||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(e),this.v=!1}catch(e){Gt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,ce(this,"complete"),ce(this,"abort"),Kt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Kt(this,!0)),qt.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?Ht(this):this.Xa())},e.Xa=function(){Ht(this)},e.isActive=function(){return!!this.g},e.ca=function(){try{return Wt(this)>2?this.g.status:-1}catch(e){return-1}},e.la=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.La=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),ge(t)}},e.ya=function(){return this.o},e.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=Jt.prototype).ka=8,e.I=1,e.connect=function(e,t,n,r){Oe(0),this.W=e,this.H=t||{},n&&void 0!==r&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.J=mn(this,null,this.W),tn(this)},e.Ea=function(e){if(this.m)if(this.m=null,1==this.I){if(!e){this.V=Math.floor(1e5*Math.random()),e=this.V++;const s=new Be(this,this.j,e);let i=this.o;if(this.U&&(i?(i=j(i),$(i,this.U)):i=this.U),null!==this.u||this.R||(s.J=i,i=null),this.S)e:{for(var t=0,n=0;n<this.i.length;n++){var r=this.i[n];if(void 0===(r="__data__"in r.map&&"string"==typeof(r=r.map.__data__)?r.length:void 0))break;if((t+=r)>4096){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=sn(this,s,t),pt(n=lt(this.J),"RID",e),pt(n,"CVER",22),this.G&&pt(n,"X-HTTP-Session-Id",this.G),rn(this,n),i&&(this.R?t="headers="+Ue(Ft(i))+"&"+t:this.u&&Bt(n,this.u,i)),it(this.h,s),this.Ra&&pt(n,"TYPE","init"),this.S?(pt(n,"$req",t),pt(n,"SID","null"),s.U=!0,Ge(s,n,null)):Ge(s,n,t),this.I=2}}else 3==this.I&&(e?nn(this,e):0==this.i.length||nt(this.h)||nn(this))}
2,e.Da=function(){if(this.v=null,un(this),this.aa&&!(this.P||null==this.g||this.T<=0)){var e=4*this.T;this.j.info("BP detection timer enabled: "+e),this.B=Re(c(this.Wa,this),e)}},e.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,Oe(10),Zt(this),un(this))},e.Va=function(){null!=this.C&&(this.C=null,Zt(this),on(this),Oe(19))},e.bb=function(e){e?(this.j.info("Successfully pinged google.com"),Oe(2)):(this.j.info("Failed to ping google.com"),Oe(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=yn.prototype).ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){},wn.prototype.g=function(e,t){return new _n(e,t)},w(_n,oe),_n.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},_n.prototype.close=function(){Xt(this.g)},_n.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=me(e),e=n);t.i.push(new et(t.Ya++,e)),3==t.I&&tn(t)},_n.prototype.N=function(){this.g.l=null,delete this.j,Xt(this.g),delete this.g,_n.Z.N.call(this)},w(vn,Ee),w(En,Ie),w(In,yn),In.prototype.ra=function(){ce(this.g,"a")},In.prototype.qa=function(e){ce(this.g,new vn(e))},In.prototype.pa=function(e){ce(this.g,new En)},In.prototype.oa=function(){ce(this.g,"b")},wn.prototype.createWebChannel=wn.prototype.g,_n.prototype.send=_n.prototype.o,_n.prototype.open=_n.prototype.m,_n.prototype.close=_n.prototype.close,y=v.createWebChannelTransport=function(){return new wn},g=v.getStatEventTarget=function(){return Se()},m=v.Event=Te,p=v.Stat={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},Le.NO_ERROR=0,Le.TIMEOUT=8,Le.HTTP_ERROR=6,f=v.ErrorCode=Le,Me.COMPLETE="complete",d=v.EventType=Me,_e.EventType=ve,ve.OPEN="a",ve.CLOSE="b",ve.ERROR="c",ve.MESSAGE="d",oe.prototype.listen=oe.prototype.J,h=v.WebChannel=_e,v.FetchXmlHttpFactory=Pt,qt.prototype.listenOnce=qt.prototype.K,qt.prototype.getLastError=qt.prototype.Ha,qt.prototype.getLastErrorCode=qt.prototype.ya,qt.prototype.getStatus=qt.prototype.ca,qt.prototype.getResponseJson=qt.prototype.La,qt.prototype.getResponseText=qt.prototype.la,qt.prototype.send=qt.prototype.ea,qt.prototype.setWithCredentials=qt.prototype.Fa,l=v.XhrIo=qt}).apply(void 0!==_?_:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});class E{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=(()=>E.CLASS_NL|E.DOT_NL)();static PERL=(()=>E.CLASS_NL|E.ONE_LINE|E.PERL_X|E.UNICODE_GROUPS)();static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2}class I{static CODES=(()=>new Map([["�",7],["\b",8],["\t",9],["\n",10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]))();static toUpperCase(e){const t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;const n=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){const t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;const n=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}}class T{static CASE_ORBIT=(()=>new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8
2147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[937
271,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]))();static C=[[0,31,1],[127,159,1],[173,888,715],[889,896,7],[897,899,1],[907,909,2],[930,1328,398],[1367,1368,1],[1419,1420,1],[1424,1480,56],[1481,1487,1],[1515,1518,1],[1525,1541,1],[1564,1757,193],[1806,1807,1],[1867,1868,1],[1970,1983,1],[2043,2044,1],[2094,2095,1],[2111,2140,29],[2141,2143,2],[2155,2159,1],[2191,2199,1],[2274,2436,162],[2445,2446,1],[2449,2450,1],[2473,2481,8],[2483,2485,1],[2490,2491,1],[2501,2502,1],[2505,2506,1],[2511,2518,1],[2520,2523,1],[2526,2532,6],[2533,2559,26],[2560,2564,4],[2571,2574,1],[2577,2578,1],[2601,2609,8],[2612,2618,3],[2619,2621,2],[2627,2630,1],[2633,2634,1],[2638,2640,1],[2642,2648,1],[2653,2655,2],[2656,2661,1],[2679,2688,1],[2692,2702,10],[2706,2729,23],[2737,2740,3],[2746,2747,1],[2758,2766,4],[2767,2769,2],[2770,2783,1],[2788,2789,1],[2802,2808,1],[2816,2820,4],[2829,2830,1],[2833,2834,1],[2857,2865,8],[2868,2874,6],[2875,2885,10],[2886,2889,3],[2890,2894,4],[2895,2900,1],[2904,2907,1],[2910,2916,6],[2917,2936,19],[2937,2945,1],[2948,2955,7],[2956,2957,1],[2961,2966,5],[2967,2968,1],[2971,2973,2],[2976,2978,1],[2981,2983,1],[2987,2989,1],[3002,3005,1],[3011,3013,1],[3017,3022,5],[3023,3025,2],[3026,3030,1],[3032,3045,1],[3067,3071,1],[3085,3089,4],[3113,3130,17],[3131,3141,10],[3145,3150,5],[3151,3156,1],[3159,3163,4],[3164,3166,2],[3167,3172,5],[3173,3184,11],[3185,3190,1],[3213,3217,4],[3241,3252,11],[3258,3259,1],[3269,3273,4],[3278,3284,1],[3287,3292,1],[3295,3300,5],[3301,3312,11],[3316,3327,1],[3341,3345,4],[3397,3401,4],[3408,3411,1],[3428,3429,1],[3456,3460,4],[3479,3481,1],[3506,3516,10],[3518,3519,1],[3527,3529,1],[3531,3534,1],[3541,3543,2],[3552,3557,1],[3568,3569,1],[3573,3584,1],[3643,3646,1],[3676,3712,1],[3715,3717,2],[3723,3748,25],[3750,3774,24],[3775,3781,6],[3783,3791,8],[3802,3803,1],[3808,3839,1],[3912,3949,37],[3950,3952,1],[3992,4029,37],[4045,4059,14],[4060,4095,1],[4294,4296,2],[4297,4300,1],[4302,4303,1],[4681,4686,5],[4687,4695,8],[4697,4702,5],[4703,4745,42],[4750,4751,1],[4785,4790,5],[4791,4799,8],[4801,4806,5],[4807,4823,16],[4881,4886,5],[4887,4955,68],[4956,4989,33],[4990,4991,1],[5018,5023,1],[5110,5111,1],[5118,5119,1],[5789,5791,1],[5881,5887,1],[5910,5918,1],[5943,5951,1],[5972,5983,1],[5997,6001,4],[6004,6015,1],[6110,6111,1],[6122,6127,1],[6138,6143,1],[6158,6170,12],[6171,6175,1],[6265,6271,1],[6315,6319,1],[6390,6399,1],[6431,6444,13],[6445,6447,1],[6460,6463,1],[6465,6467,1],[6510,6511,1],[6517,6527,1],[6572,6575,1],[6602,6607,1],[6619,6621,1],[6684,6685,1],[6751,6781,30],[6782,6794,12],[6795,6799,1],[6810,6815,1],[6830,6831,1],[6863,6911,1],[6989,6991,1],[7039,7156,117],[7157,7163,1],[7224,7226,1],[7242,7244,1],[7305,7311,1],[7355,7356,1],[7368,7375,1],[7419,7423,1],[7958,7959,1],[7966,7967,1],[8006,8007,1],[8014,8015,1],[8024,8030,2],[8062,8063,1],[8117,8133,16],[8148,8149,1],[8156,8176,20],[8177,8181,4],[8191,8203,12],[8204,8207,1],[8234,8238,1],[8288,8303,1],[8306,8307,1],[8335,8349,14],[8350,8351,1],[8385,8399,1],[8433,8447,1],[8588,8591,1],[9255,9279,1],[9291,9311,1],[11124,11125,1],[11158,11508,350],[11509,11512,1],[11558,11560,2],[11561,11564,1],[11566,11567,1],[11624,11630,1],[11633,11646,1],[11671,11679,1],[11687,11743,8],[11870,11903,1],[11930,12020,90],[12021,12031,1],[12246,12271,1],[12352,12439,87],[12440,12544,104],[12545,12548,1],[12592,12687,95],[12772,12782,1],[12831,42125,29294],[42126,42127,1],[42183,42191,1],[42540,42559,1],[42744,42751,1],[42955,42959,1],[42962,42964,2],[42970,42993,1],[43053,43055,1],[43066,43071,1],[43128,43135,1],[43206,43213,1],[43226,43231,1],[43348,43358,1],[43389,43391,1],[43470,43482,12],[43483,43485,1],[43519,43575,56],[43576,43583,1],[43598,43599,1],[43610,43611,1],[43715,43738,1],[43767,43776,1],[43783,43784,1],[43791,43792,1],[43799,43807,1],[43815,43823,8],[43884,43887,1],[44014,44015,1],[44026,44031,1],[55204,55215,1],[55239,55242,1],[55292,63743,1],[64110,64111,1],[64218,64255,1],[64263,64274,1],[64280,64284,1],[64311,64317,6],[64319,64325,3],[64451,64466,1],[64912,64913,1],[64968,64974,1],[64976,65007,1],[65050,65055,1],[65107,65127,20],[65132,65135,1],[65141,65277,136],[65278,65280,1],[65471,65473,1],[65480,65481,1],[65488,65489,1],[65496,65497,1],[65501,65503,1],[65511,65519,8],[65520,65531,1],[65534,65535,1],[65548,65575,27],[65595,65598,3],[65614,65615,1],[65630,65663,1],[65787,65791,1],[65795,65798,1],[65844,65846,1],[65935,65949,14],[65950,65951,1],[65953,65999,1],[66046,66175,1],[66205,66207,1],[66257,66271,1],[66300,66303,1],[66340,66348,1],[66379,66383,1],[66427,66431,1],[66462,66500,38],[66501,66503,1],[66518,66559,1],[66718,66719,1],[66730,66735,1],[66772,66775,1],[66812,66815,1],[66856,66863,1],[66916,66926,1],[66939,66955,16],[66963,66966,3],[66978,66994,16],[67002,67005,3],[67006,67071,1],[67383,67391,1],[67414,67423,1],[67432,67455,1],[67462,67505,43],[67515,67583,1],[67590,67591,1],[67593,67638,45],[67641,67643,1],[67645,67646,1],[67670,67743,73],[67744,67750,1],[67760,67807,1],[67827,67830,3],[67831,67834,1],[67868,67870,1],[67898,67902,1],[67904,67967,1],[68024,68027,1],[68048,68049,1],[68100,68103,3],[68104,68107,1],[68116,68120,4],[68150,68151,1],[68155,68158,1],[68169,68175,1],[68185,68191,1],[68256,68287,1],[68327,68330,1],[68343,68351,1],[68406,68408,1],[68438,68439,1],[68467,68471,1],[68498,68504,1],[68509,68520,1],[68528,68607,1],[68681,68735,1],[68787,68799,1],[68851,68857,1],[68904,68911,1],[68922,69215,1],[69247,69290,43],[69294,69295,1],[69298,69372,1],[69416,69423,1],[69466,69487,1],[69514,69551,1],[69580,69599,1],[69623,69631,1],[69710,69713,1],[69750,69758,1],[69821,69827,6],[69828,69839,1],[69865,69871,1],[69882,69887,1],[69941,69960,19],[69961,69967,1],[70007,70015,1],[70112,70133,21],[70134,70143,1],[70162,70210,48],[70211,70271,1],[70279,70281,2],[70286,70302,16],[70314,70319,1],[70379,70383,1],[70394,70399,1],[70404,70413,9],[70414,70417,3],[70418,70441,23],[70449,70452,3],[70458,70469,11],[70470,70473,3],[70474,70478,4],[70479,70481,2],[70482,70486,1],[70488,70492,1],[70500,70501,1],[70509,70511,
21],[70517,70655,1],[70748,70754,6],[70755,70783,1],[70856,70863,1],[70874,71039,1],[71094,71095,1],[71134,71167,1],[71237,71247,1],[71258,71263,1],[71277,71295,1],[71354,71359,1],[71370,71423,1],[71451,71452,1],[71468,71471,1],[71495,71679,1],[71740,71839,1],[71923,71934,1],[71943,71944,1],[71946,71947,1],[71956,71959,3],[71990,71993,3],[71994,72007,13],[72008,72015,1],[72026,72095,1],[72104,72105,1],[72152,72153,1],[72165,72191,1],[72264,72271,1],[72355,72367,1],[72441,72447,1],[72458,72703,1],[72713,72759,46],[72774,72783,1],[72813,72815,1],[72848,72849,1],[72872,72887,15],[72888,72959,1],[72967,72970,3],[73015,73017,1],[73019,73022,3],[73032,73039,1],[73050,73055,1],[73062,73065,3],[73103,73106,3],[73113,73119,1],[73130,73439,1],[73465,73471,1],[73489,73531,42],[73532,73533,1],[73562,73647,1],[73649,73663,1],[73714,73726,1],[74650,74751,1],[74863,74869,6],[74870,74879,1],[75076,77711,1],[77811,77823,1],[78896,78911,1],[78934,82943,1],[83527,92159,1],[92729,92735,1],[92767,92778,11],[92779,92781,1],[92863,92874,11],[92875,92879,1],[92910,92911,1],[92918,92927,1],[92998,93007,1],[93018,93026,8],[93048,93052,1],[93072,93759,1],[93851,93951,1],[94027,94030,1],[94088,94094,1],[94112,94175,1],[94181,94191,1],[94194,94207,1],[100344,100351,1],[101590,101631,1],[101641,110575,1],[110580,110588,8],[110591,110883,292],[110884,110897,1],[110899,110927,1],[110931,110932,1],[110934,110947,1],[110952,110959,1],[111356,113663,1],[113771,113775,1],[113789,113791,1],[113801,113807,1],[113818,113819,1],[113824,118527,1],[118574,118575,1],[118599,118607,1],[118724,118783,1],[119030,119039,1],[119079,119080,1],[119155,119162,1],[119275,119295,1],[119366,119487,1],[119508,119519,1],[119540,119551,1],[119639,119647,1],[119673,119807,1],[119893,119965,72],[119968,119969,1],[119971,119972,1],[119975,119976,1],[119981,119994,13],[119996,120004,8],[120070,120075,5],[120076,120085,9],[120093,120122,29],[120127,120133,6],[120135,120137,1],[120145,120486,341],[120487,120780,293],[120781,121484,703],[121485,121498,1],[121504,121520,16],[121521,122623,1],[122655,122660,1],[122667,122879,1],[122887,122905,18],[122906,122914,8],[122917,122923,6],[122924,122927,1],[122990,123022,1],[123024,123135,1],[123181,123183,1],[123198,123199,1],[123210,123213,1],[123216,123535,1],[123567,123583,1],[123642,123646,1],[123648,124111,1],[124154,124895,1],[124903,124908,5],[124911,124927,16],[125125,125126,1],[125143,125183,1],[125260,125263,1],[125274,125277,1],[125280,126064,1],[126133,126208,1],[126270,126463,1],[126468,126496,28],[126499,126501,2],[126502,126504,2],[126515,126520,5],[126522,126524,2],[126525,126529,1],[126531,126534,1],[126536,126540,2],[126544,126547,3],[126549,126550,1],[126552,126560,2],[126563,126565,2],[126566,126571,5],[126579,126589,5],[126591,126602,11],[126620,126624,1],[126628,126634,6],[126652,126703,1],[126706,126975,1],[127020,127023,1],[127124,127135,1],[127151,127152,1],[127168,127184,16],[127222,127231,1],[127406,127461,1],[127491,127503,1],[127548,127551,1],[127561,127567,1],[127570,127583,1],[127590,127743,1],[128728,128731,1],[128749,128751,1],[128765,128767,1],[128887,128890,1],[128986,128991,1],[129004,129007,1],[129009,129023,1],[129036,129039,1],[129096,129103,1],[129114,129119,1],[129160,129167,1],[129198,129199,1],[129202,129279,1],[129620,129631,1],[129646,129647,1],[129661,129663,1],[129673,129679,1],[129726,129734,8],[129735,129741,1],[129756,129759,1],[129769,129775,1],[129785,129791,1],[129939,129995,56],[129996,130031,1],[130042,131071,1],[173792,173823,1],[177978,177983,1],[178206,178207,1],[183970,183983,1],[191457,191471,1],[192094,194559,1],[195102,196607,1],[201547,201551,1],[205744,917759,1],[918e3,1114111,1]];static Cc=[[0,31,1],[127,159,1]];static Cf=[[173,1536,1363],[1537,1541,1],[1564,1757,193],[1807,2192,385],[2193,2274,81],[6158,8203,2045],[8204,8207,1],[8234,8238,1],[8288,8292,1],[8294,8303,1],[65279,65529,250],[65530,65531,1],[69821,69837,16],[78896,78911,1],[113824,113827,1],[119155,119162,1],[917505,917536,31],[917537,917631,1]];static Co=[[57344,63743,1],[983040,1048573,1],[1048576,1114109,1]];static Cs=[[55296,57343,1]];static L=[[65,90,1],[97,122,1],[170,181,11],[186,192,6],[193,214,1],[216,246,1],[248,705,1],[710,721,1],[736,740,1],[748,750,2],[880,884,1],[886,887,1],[890,893,1],[895,902,7],[904,906,1],[908,910,2],[911,929,1],[931,1013,1],[1015,1153,1],[1162,1327,1],[1329,1366,1],[1369,1376,7
2],[1377,1416,1],[1488,1514,1],[1519,1522,1],[1568,1610,1],[1646,1647,1],[1649,1747,1],[1749,1765,16],[1766,1774,8],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2036,2037,1],[2042,2048,6],[2049,2069,1],[2074,2084,10],[2088,2112,24],[2113,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2249,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2417,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3654,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3782,3804,22],[3805,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4256,18],[4257,4293,1],[4295,4301,6],[4304,4346,1],[4348,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5024,5109,1],[5112,5117,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6103,6108,5],[6176,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6823,6917,94],[6918,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7293,1],[7296,7304,1],[7312,7354,1],[7357,7359,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,7424,6],[7425,7615,1],[7680,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8124,1],[8126,8130,4],[8131,8132,1],[8134,8140,1],[8144,8147,1],[8150,8155,1],[8160,8172,1],[8178,8180,1],[8182,8188,1],[8305,8319,14],[8336,8348,1],[8450,8455,5],[8458,8467,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8495,8505,1],[8508,8511,1],[8517,8521,1],[8526,8579,53],[8580,11264,2684],[11265,11492,1],[11499,11502,1],[11506,11507,1],[11520,11557,1],[11559,11565,6],[11568,11623,1],[11631,11648,17],[11649,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[11823,12293,470],[12294,12337,43],[12338,12341,1],[12347,12348,1],[12353,12438,1],[12445,12447,1],[12449,12538,1],[12540,12543,1],[12549,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,42124,1],[42192,42237,1],[42240,42508,1],[42512,42527,1],[42538,42539,1],[42560,42606,1],[42623,42653,1],[42656,42725,1],[42775,42783,1],[42786,42888,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43471,43488,17],[43489,43492,1],[43494,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43741,1],[43744,43754,1],[43762,43764,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43824,43866,1],[43868,43881,1],[43888,44002,1],[44032,55203,1],[55216,55238,1],[55243,5
25291,1],[63744,64109,1],[64112,64217,1],[64256,64262,1],[64275,64279,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65313,65338,1],[65345,65370,1],[65382,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66560,66717,1],[66736,66771,1],[66776,66811,1],[66816,66855,1],[66864,66915,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68736,68786,1],[68800,68850,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71840,71903,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[92992,92995,1],[93027,93047,1],[93053,93071,1],[93760,93823,1],[93952,94026,1],[94032,94099,67],[94100,94111,1],[94176,94177,1],[94179,94208,29],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120512,1],[120514,120538,1],[120540,120570,1],[120572,120596,1],[120598,120628,1],[120630,120654,1],[120656,120686,1],[120688,120712,1],[120714,120744,1],[120746,120770,1],[120772,120779,1],[122624,122654,1],[122661,122666,1],[122928,122989,1],[123136,123180,1],[123191,123197,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124139,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[125184,125251,1],[125259,126464,1205],[126465,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static foldL=[[837,837,1]];static Ll=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,311,2],[312,328,2],[329,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[397,402,5],[405,409,4],[410,411,1],[414,417,3],[419,421,2],[424,426,2],[427,429,2],[432,436,4],[438,441,3],[442,445,3],[446,447,1],[454,460,3],[462,476,2],[477,495,2],[496,499,3],[501,505,4],[507,563,2],[564,569,1],[572,575,3],[576,578,2],[583,591,2],[592,659,1],[661,687,1],[881,883,2],[887,891,4],[892,893,1],[912,940,28],[941,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1020,1072,52],[1073,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1376,1416,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7424,7467,1],[7531,7543,1],[7545,7578,1],[7681,7829,2],[7830,7837,1],[7839,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8016,8023,1],[8032,8039,1],[8048,8061,1],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8112,8116,1],[8118,8119,1],[8126,8130,4],[8131,8132,1],[8134,8135,1],[8144,8147,1],[8150,8151,1],[8160,8167,1],[8178,8180,1],[8182,8183,1],[8458,8462,4],[8463,8467,4],[8495,8505,5],[8508,8509,1],[8518,8521,1],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11377,11379,2],[11380,11382,2],[11383,11387,1],[11393,11491,2],[11492,11500,8],[11502,11507,5],[11520,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42800,42801,1],[42803,42865,2],[42866,42872,1],[42874,42876,2],[42879,42887,2],[42892,42894,2],[42897,42899,2],[42900,42901,1],[42903,42921,2],[42927,42933,6],[42935,42947,2],[42952,42954,2],[42961,42969,2],[42998,43002,4],[43824,43866,1],[43872,43880,1],[43888,43967,1],[64256,64262,1],[64275,64279,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[119834,119859,1],[119886,119892,1],[119894,119911,1],[119938,119963,1],[119990,119993,1],[119995,119997,2],[119998,120003,1],[120005,120015,1],[120042,120067,1],[120094,120119,1],[120146,120171,1],[120198,120223,1],[120250,12
20275,1],[120302,120327,1],[120354,120379,1],[120406,120431,1],[120458,120485,1],[120514,120538,1],[120540,120545,1],[120572,120596,1],[120598,120603,1],[120630,120654,1],[120656,120661,1],[120688,120712,1],[120714,120719,1],[120746,120770,1],[120772,120777,1],[120779,122624,1845],[122625,122633,1],[122635,122654,1],[122661,122666,1],[125218,125251,1]];static foldLl=[[65,90,1],[192,214,1],[216,222,1],[256,302,2],[306,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,453,1],[455,456,1],[458,459,1],[461,475,2],[478,494,2],[497,498,1],[500,502,2],[503,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[837,880,43],[882,886,4],[895,902,7],[904,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,984,9],[986,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8072,8079,1],[8088,8095,1],[8104,8111,1],[8120,8124,1],[8136,8140,1],[8152,8155,1],[8168,8172,1],[8184,8188,1],[8486,8490,4],[8491,8498,7],[8579,11264,2685],[11265,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[125184,125217,1]];static Lm=[[688,705,1],[710,721,1],[736,740,1],[748,750,2],[884,890,6],[1369,1600,231],[1765,1766,1],[2036,2037,1],[2042,2074,32],[2084,2088,4],[2249,2417,168],[3654,3782,128],[4348,6103,1755],[6211,6823,612],[7288,7293,1],[7468,7530,1],[7544,7579,35],[7580,7615,1],[8305,8319,14],[8336,8348,1],[11388,11389,1],[11631,11823,192],[12293,12337,44],[12338,12341,1],[12347,12445,98],[12446,12540,94],[12541,12542,1],[40981,42232,1251],[42233,42237,1],[42508,42623,115],[42652,42653,1],[42775,42783,1],[42864,42888,24],[42994,42996,1],[43e3,43001,1],[43471,43494,23],[43632,43741,109],[43763,43764,1],[43868,43871,1],[43881,65392,21511],[65438,65439,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[92992,92995,1],[94099,94111,1],[94176,94177,1],[94179,110576,16397],[110577,110579,1],[110581,110587,1],[110589,110590,1],[122928,122989,1],[123191,123197,1],[124139,125259,1120]];static Lo=[[170,186,16],[443,448,5],[449,451,1],[660,1488,828],[1489,1514,1],[1519,1522,1],[1568,1599,1],[1601,1610,1],[1646,1647,1],[1649,1747,1],[1749,1774,25],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2048,2069,1],[2112,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2248,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2418,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3653,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3804,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4352,114],[4353,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6108,6176,68],[6177,6210,1],[6212,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6917,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7287,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,8501,1083],[8502,8504,1],[11568,11623,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11
2742,1],[12294,12348,54],[12353,12438,1],[12447,12449,2],[12450,12538,1],[12543,12549,6],[12550,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,40980,1],[40982,42124,1],[42192,42231,1],[42240,42507,1],[42512,42527,1],[42538,42539,1],[42606,42656,50],[42657,42725,1],[42895,42999,104],[43003,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43488,43492,1],[43495,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43631,1],[43633,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43740,1],[43744,43754,1],[43762,43777,15],[43778,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43968,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65382,65391,1],[65393,65437,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66640,66717,1],[66816,66855,1],[66864,66915,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[93027,93047,1],[93053,93071,1],[93952,94026,1],[94032,94208,176],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[122634,123136,502],[123137,123180,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124138,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Lt=[[453,459,3],[498,8072,7574],[8073,8079,1],[8088,8095,1],[8104,8111,1],[8124,8140,16],[8188,8188,1]];static foldLt=[[452,454,2],[455,457,2],[458,460,2],[497,499,2],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8115,8131,16],[8179,8179,1]];static Lu=[[65,90,1],[192,214,1],[216,222,1],[256,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,461,3],[463,475,2],[478,494,2],[497,500,3],[502,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[880,882,2],[886,895,9],[902,904,2],[905,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,978,3],[979,980,1],[984,1006,2],[1012,1015,3],[1017,1018,1],[1021,10
271,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8120,8123,1],[8136,8139,1],[8152,8155,1],[8168,8172,1],[8184,8187,1],[8450,8455,5],[8459,8461,1],[8464,8466,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8496,8499,1],[8510,8511,1],[8517,8579,62],[11264,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[119808,119833,1],[119860,119885,1],[119912,119937,1],[119964,119966,2],[119967,119973,3],[119974,119977,3],[119978,119980,1],[119982,119989,1],[120016,120041,1],[120068,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120120,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120172,120197,1],[120224,120249,1],[120276,120301,1],[120328,120353,1],[120380,120405,1],[120432,120457,1],[120488,120512,1],[120546,120570,1],[120604,120628,1],[120662,120686,1],[120720,120744,1],[120778,125184,4406],[125185,125217,1]];static Upper=this.Lu;static foldLu=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,303,2],[307,311,2],[314,328,2],[331,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[402,405,3],[409,410,1],[414,417,3],[419,421,2],[424,429,5],[432,436,4],[438,441,3],[445,447,2],[453,454,1],[456,457,1],[459,460,1],[462,476,2],[477,495,2],[498,499,1],[501,505,4],[507,543,2],[547,563,2],[572,575,3],[576,578,2],[583,591,2],[592,596,1],[598,599,1],[601,603,2],[604,608,4],[609,613,2],[614,616,2],[617,620,1],[623,625,2],[626,629,3],[637,640,3],[642,643,1],[647,652,1],[658,669,11],[670,837,167],[881,883,2],[887,891,4],[892,893,1],[940,943,1],[945,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1072,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1377,1414,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7545,7549,4],[7566,7681,115],[7683,7829,2],[7835,7841,6],[7843,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8017,8023,2],[8032,8039,1],[8048,8061,1],[8112,8113,1],[8126,8144,18],[8145,8160,15],[8161,8165,4],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11379,11382,3],[11393,11491,2],[11500,11502,2],[11507,11520,13],[11521,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42803,42863,2],[42874,42876,2],[42879,42887,2],[42892,42897,5],[42899,42900,1],[42903,42921,2],[42933,42947,2],[42952,42954,2],[42961,42967,6],[42969,42998,29],[43859,43888,29],[43889,43967,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[125218,125251,1]];static M=[[768,879,1],[1155,1161,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2307,1],[2362,2364,1],[2366,2383,1],[2385,2391,1],[2402,2403,1],[2433,2435,1],[2492,2494,2],[2495,2500,1],[2503,2504,1],[2507,2509,1],[2519,2530,11],[2531,2558,27],[2561,2563,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2672,31],[2673,2677,4],[2689,2691,1],[2748,2750,2],[2751,2757,1],[2759,2761,1],[2763,2765,1],[2786,2787,1],[2810,2815,1],[2817,2819,1],[2876,2878,2],[2879,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2914,2915,1],[2946,3006,60],[3007,3010,1],[3014,3016,1],[3018,3021,1],[3031,3072,41],[3073,3076,1],[3132,3134,2],[3135,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3203,1],[3260,3262,2],[3263,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3298,3299,1],[3315,3328,13],[3329,3331,1],[3387,3388,1],[3390,3396,1],[3398,3400,1],[3402,3405,1],[3415,3426,11],[3427,3457,30],[3458,3459,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3570,3571,1],[3633,3636,3],[3637,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3902,3903,1],[3953,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4139,101],[4140,4158,1],[4182,4185,1],[4190,4192,1],[4194,4196,1],[4199,4205,1],[4209,4212,1],[4226,4237,1],[4239,4250,11],[4251,4253,1],[4957,4959,1],[5906,5909,1],[5938,5940,1],[5970,5971,1],[6002,6003,1],[6068,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6443,1],[6448,6459,1],[6679,6683,1],[6741,6750,1],[6752,6780,1],[6783,6832,49],[6833,6862,1],[6912,6916,1],[6964,6980,1],[7019,7027,1],[7040,7042,1],[7073,7085,
21],[7142,7155,1],[7204,7223,1],[7376,7378,1],[7380,7400,1],[7405,7412,7],[7415,7417,1],[7616,7679,1],[8400,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12335,1],[12441,12442,1],[42607,42610,1],[42612,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43043,24],[43044,43047,1],[43052,43136,84],[43137,43188,51],[43189,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43347,1],[43392,43395,1],[43443,43456,1],[43493,43561,68],[43562,43574,1],[43587,43596,9],[43597,43643,46],[43644,43645,1],[43696,43698,2],[43699,43700,1],[43703,43704,1],[43710,43711,1],[43713,43755,42],[43756,43759,1],[43765,43766,1],[44003,44010,1],[44012,44013,1],[64286,65024,738],[65025,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69632,69634,1],[69688,69702,1],[69744,69747,3],[69748,69759,11],[69760,69762,1],[69808,69818,1],[69826,69888,62],[69889,69890,1],[69927,69940,1],[69957,69958,1],[70003,70016,13],[70017,70018,1],[70067,70080,1],[70089,70092,1],[70094,70095,1],[70188,70199,1],[70206,70209,3],[70367,70378,1],[70400,70403,1],[70459,70460,1],[70462,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70502,3],[70503,70508,1],[70512,70516,1],[70709,70726,1],[70750,70832,82],[70833,70851,1],[71087,71093,1],[71096,71104,1],[71132,71133,1],[71216,71232,1],[71339,71351,1],[71453,71467,1],[71724,71738,1],[71984,71989,1],[71991,71992,1],[71995,71998,1],[72e3,72002,2],[72003,72145,142],[72146,72151,1],[72154,72160,1],[72164,72193,29],[72194,72202,1],[72243,72249,1],[72251,72254,1],[72263,72273,10],[72274,72283,1],[72330,72345,1],[72751,72758,1],[72760,72767,1],[72850,72871,1],[72873,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73098,67],[73099,73102,1],[73104,73105,1],[73107,73111,1],[73459,73462,1],[73472,73473,1],[73475,73524,49],[73525,73530,1],[73534,73538,1],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94033,2],[94034,94087,1],[94095,94098,1],[94180,94192,12],[94193,113821,19628],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119141,119145,1],[119149,119154,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldM=[[921,953,32],[8126,8126,1]];static Mc=[[2307,2363,56],[2366,2368,1],[2377,2380,1],[2382,2383,1],[2434,2435,1],[2494,2496,1],[2503,2504,1],[2507,2508,1],[2519,2563,44],[2622,2624,1],[2691,2750,59],[2751,2752,1],[2761,2763,2],[2764,2818,54],[2819,2878,59],[2880,2887,7],[2888,2891,3],[2892,2903,11],[3006,3007,1],[3009,3010,1],[3014,3016,1],[3018,3020,1],[3031,3073,42],[3074,3075,1],[3137,3140,1],[3202,3203,1],[3262,3264,2],[3265,3268,1],[3271,3272,1],[3274,3275,1],[3285,3286,1],[3315,3330,15],[3331,3390,59],[3391,3392,1],[3398,3400,1],[3402,3404,1],[3415,3458,43],[3459,3535,76],[3536,3537,1],[3544,3551,1],[3570,3571,1],[3902,3903,1],[3967,4139,172],[4140,4145,5],[4152,4155,3],[4156,4182,26],[4183,4194,11],[4195,4196,1],[4199,4205,1],[4227,4228,1],[4231,4236,1],[4239,4250,11],[4251,4252,1],[5909,5940,31],[6070,6078,8],[6079,6085,1],[6087,6088,1],[6435,6438,1],[6441,6443,1],[6448,6449,1],[6451,6456,1],[6681,6682,1],[6741,6743,2],[6753,6755,2],[6756,6765,9],[6766,6770,1],[6916,6965,49],[6971,6973,2],[6974,6977,1],[6979,6980,1],[7042,7073,31],[7078,7079,1],[7082,7143,61],[7146,7148,1],[7150,7154,4],[7155,7204,49],[7205,7211,1],[7220,7221,1],[7393,7415,22],[12334,12335,1],[43043,43044,1],[43047,43136,89],[43137,43188,51],[43189,43203,1],[43346,43347,1],[43395,43444,49],[43445,43450,5],[43451,43454,3],[43455,43456,1],[43567,43568,1],[43571,43572,1],[43597,43643,46],[43645,43755,110],[43758,43759,1],[43765,44003,238],[44004,44006,2],[44007,44009,2],[44010,44012,2],[69632,69634,2],[69762,69808,46],[69809,69810,1],[69815,69816,1],[69932,69957,25],[69958,70018,60],[70067,70069,1],[70079,70080,1],[70094,70188,94],[70189,70190,1],[70194,70195,1],[70197,70368,171],[70369,70370,1],[70402,70403,1],[70462,70463,1],[70465,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70709,210],[70710,70711,1],[70720,70721,1],[70725,70832,107],[70833,70834,1],[70841,70843,2],[70844,70846,1],[70849,71087,238],[71088,71089,1],[71096,71099,1],[71102,71216,114],[71217,71218,1],[71227,71228,1],[71230,71340,110],[71342,71343,1],[71350,71456,106],[71457,71462,5],[71724,71726,1],[71736,71984,248],[71985,71989,1],[71991,71992,1],[71997,72e3,3],[72002,72145,143],[72146,72147,1],[72156,72159,1],[72164,72249,85],[72279,72280,1],[72343,72751,408],[72766,72873,107],[72881,72884,3],[73098,73102,1],[73107,73108,1],[73110,73461,351],[73462,73475,13],[73524,73525,1],[73534,73535,1],[73537,94033,20496],[94034,94087,1],[94192,94193,1],[119141,119142,1],[119149,119154,1]];static Me=[[1160,1161,1],[6846,8413,1567],[8414,8416,1],[8418,8420,1],[42608,42610,1]];static Mn=[[768,879,1],[1155,1159,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,
21],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2306,1],[2362,2364,2],[2369,2376,1],[2381,2385,4],[2386,2391,1],[2402,2403,1],[2433,2492,59],[2497,2500,1],[2509,2530,21],[2531,2558,27],[2561,2562,1],[2620,2625,5],[2626,2631,5],[2632,2635,3],[2636,2637,1],[2641,2672,31],[2673,2677,4],[2689,2690,1],[2748,2753,5],[2754,2757,1],[2759,2760,1],[2765,2786,21],[2787,2810,23],[2811,2815,1],[2817,2876,59],[2879,2881,2],[2882,2884,1],[2893,2901,8],[2902,2914,12],[2915,2946,31],[3008,3021,13],[3072,3076,4],[3132,3134,2],[3135,3136,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3260,59],[3263,3270,7],[3276,3277,1],[3298,3299,1],[3328,3329,1],[3387,3388,1],[3393,3396,1],[3405,3426,21],[3427,3457,30],[3530,3538,8],[3539,3540,1],[3542,3633,91],[3636,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3953,3966,1],[3968,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4141,103],[4142,4144,1],[4146,4151,1],[4153,4154,1],[4157,4158,1],[4184,4185,1],[4190,4192,1],[4209,4212,1],[4226,4229,3],[4230,4237,7],[4253,4957,704],[4958,4959,1],[5906,5908,1],[5938,5939,1],[5970,5971,1],[6002,6003,1],[6068,6069,1],[6071,6077,1],[6086,6089,3],[6090,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6434,1],[6439,6440,1],[6450,6457,7],[6458,6459,1],[6679,6680,1],[6683,6742,59],[6744,6750,1],[6752,6754,2],[6757,6764,1],[6771,6780,1],[6783,6832,49],[6833,6845,1],[6847,6862,1],[6912,6915,1],[6964,6966,2],[6967,6970,1],[6972,6978,6],[7019,7027,1],[7040,7041,1],[7074,7077,1],[7080,7081,1],[7083,7085,1],[7142,7144,2],[7145,7149,4],[7151,7153,1],[7212,7219,1],[7222,7223,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8400,8412,1],[8417,8421,4],[8422,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12333,1],[12441,12442,1],[42607,42612,5],[42613,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43045,26],[43046,43052,6],[43204,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43345,1],[43392,43394,1],[43443,43446,3],[43447,43449,1],[43452,43453,1],[43493,43561,68],[43562,43566,1],[43569,43570,1],[43573,43574,1],[43587,43596,9],[43644,43696,52],[43698,43700,1],[43703,43704,1],[43710,43711,1],[43713,43756,43],[43757,43766,9],[44005,44008,3],[44013,64286,20273],[65024,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69633,69688,55],[69689,69702,1],[69744,69747,3],[69748,69759,11],[69760,69761,1],[69811,69814,1],[69817,69818,1],[69826,69888,62],[69889,69890,1],[69927,69931,1],[69933,69940,1],[70003,70016,13],[70017,70070,53],[70071,70078,1],[70089,70092,1],[70095,70191,96],[70192,70193,1],[70196,70198,2],[70199,70206,7],[70209,70367,158],[70371,70378,1],[70400,70401,1],[70459,70460,1],[70464,70502,38],[70503,70508,1],[70512,70516,1],[70712,70719,1],[70722,70724,1],[70726,70750,24],[70835,70840,1],[70842,70847,5],[70848,70850,2],[70851,71090,239],[71091,71093,1],[71100,71101,1],[71103,71104,1],[71132,71133,1],[71219,71226,1],[71229,71231,2],[71232,71339,107],[71341,71344,3],[71345,71349,1],[71351,71453,102],[71454,71455,1],[71458,71461,1],[71463,71467,1],[71727,71735,1],[71737,71738,1],[71995,71996,1],[71998,72003,5],[72148,72151,1],[72154,72155,1],[72160,72193,33],[72194,72202,1],[72243,72248,1],[72251,72254,1],[72263,72273,10],[72274,72278,1],[72281,72283,1],[72330,72342,1],[72344,72345,1],[72752,72758,1],[72760,72765,1],[72767,72850,83],[72851,72871,1],[72874,72880,1],[72882,72883,1],[72885,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73104,73],[73105,73109,4],[73111,73459,348],[73460,73472,12],[73473,73526,53],[73527,73530,1],[73536,73538,2],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94095,64],[94096,94098,1],[94180,113821,19641],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldMn=[[921,953,32],[8126,8126,1]];static N=[[48,57,1],[178,179,1],[185,188,3],[189,190,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2548,2553,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[2930,2935,1],[3046,3058,1],[3174,3183,1],[3192,3198,1],[3302,3311,1],[3416,3422,1],[3430,3448,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3891,1],[4160,4169,1],[4240,4249,1],[4969,4988,1],[5870,5872,1],[6112,6121,1],[6128,6137,1],[6160,6169,1],[6470,6479,1],[6608,6618,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[8304,8308,4],[8309,8313,1],[8320,8329,1],[8528,8578,1],[8581,8585,1],[9312,9371,1],[9450,9471,1],[10102,10131,1],[11517,12295,778],[12321,12329,1],[12344,12346,1],[12690,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[42528,42537,1],[42726,42735,1],[43056,43061,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[65799,65843,1],[65856,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[66369,66378,9],[66513,66517,1],[66720,66729,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[68912,68921,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70113,70132,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71483,1],[71904,71922,1],[72016,72025,1],[72784,72812,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[73664,73684,1],[74752,74862,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125127,125135,1],[125264,125273,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1],[130032,130041,1]];static Nd=[[48,57,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[3046,3055,1],[3174,3183,1],[3302,3311,1],[3430,3439,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3881,1],[4160,4169,1],[4240,4249,1],[6112,6121,1],[6160,6169,1],[6470,6479,1],[6608,6617,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[42528,42537,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[66720,66729,1],[68912,68921,1],[69734,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71481,1],[71904,71913,1],[72016,72025,1],[72784,72793,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125264,125273,1],[130032,130041,1]];static Nl=[[5870,5872,1],[8544,8578,1],[8581,8584,1],[12295,12321,26],[12322,12329,1],[12344,12346,1],[42726,42735,1],[65856,65908,1],[66369,66378,9],[66513,66517,1],[74752,74862,1]];
2static No=[[178,179,1],[185,188,3],[189,190,1],[2548,2553,1],[2930,2935,1],[3056,3058,1],[3192,3198,1],[3416,3422,1],[3440,3448,1],[3882,3891,1],[4969,4988,1],[6128,6137,1],[6618,8304,1686],[8308,8313,1],[8320,8329,1],[8528,8543,1],[8585,9312,727],[9313,9371,1],[9450,9471,1],[10102,10131,1],[11517,12690,1173],[12691,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[43056,43061,1],[65799,65843,1],[65909,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69733,1],[70113,70132,1],[71482,71483,1],[71914,71922,1],[72794,72812,1],[73664,73684,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[125127,125135,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1]];static P=[[33,35,1],[37,42,1],[44,47,1],[58,59,1],[63,64,1],[91,93,1],[95,123,28],[125,161,36],[167,171,4],[182,183,1],[187,191,4],[894,903,9],[1370,1375,1],[1417,1418,1],[1470,1472,2],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3898,38],[3899,3901,1],[3973,4048,75],[4049,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5120,5742,622],[5787,5788,1],[5867,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8208,829],[8209,8231,1],[8240,8259,1],[8261,8273,1],[8275,8286,1],[8317,8318,1],[8333,8334,1],[8968,8971,1],[9001,9002,1],[10088,10101,1],[10181,10182,1],[10214,10223,1],[10627,10648,1],[10712,10715,1],[10748,10749,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11822,1],[11824,11855,1],[11858,11869,1],[12289,12291,1],[12296,12305,1],[12308,12319,1],[12336,12349,13],[12448,12539,91],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,64830,20819],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65121,1],[65123,65128,5],[65130,65131,1],[65281,65283,1],[65285,65290,1],[65292,65295,1],[65306,65307,1],[65311,65312,1],[65339,65341,1],[65343,65371,28],[65373,65375,2],[65376,65381,1],[65792,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69293,69461,168],[69462,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Pc=[[95,8255,8160],[8256,8276,20],[65075,65076,1],[65101,65103,1],[65343,65343,1]];static Pd=[[45,1418,1373],[1470,5120,3650],[6150,8208,2058],[8209,8213,1],[11799,11802,3],[11834,11835,1],[11840,11869,29],[12316,12336,20],[12448,65073,52625],[65074,65112,38],[65123,65293,170],[69293,69293,1]];static Pe=[[41,93,52],[125,3899,3774],[3901,5788,1887],[8262,8318,56],[8334,8969,635],[8971,9002,31],[10089,10101,2],[10182,10215,33],[10217,10223,2],[10628,10648,2],[10713,10715,2],[10749,11811,1062],[11813,11817,2],[11862,11868,2],[12297,12305,2],[12309,12315,2],[12318,12319,1],[64830,65048,218],[65078,65092,2],[65096,65114,18],[65116,65118,2],[65289,65341,52],[65373,65379,3]];static Pf=[[187,8217,8030],[8221,8250,29],[11779,11781,2],[11786,11789,3],[11805,11809,4]];static Pi=[[171,8216,8045],[8219,8220,1],[8223,8249,26],[11778,11780,2],[11785,11788,3],[11804,11808,4]];static Po=[[33,35,1],[37,39,1],[42,46,2],[47,58,11],[59,63,4],[64,92,28],[161,167,6],[182,183,1],[191,894,703],[903,1370,467],[1371,1375,1],[1417,1472,55],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,3
268],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3973,113],[4048,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5742,5867,125],[5868,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6149,1],[6151,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8214,835],[8215,8224,9],[8225,8231,1],[8240,8248,1],[8251,8254,1],[8257,8259,1],[8263,8273,1],[8275,8277,2],[8278,8286,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11782,5],[11783,11784,1],[11787,11790,3],[11791,11798,1],[11800,11801,1],[11803,11806,3],[11807,11818,11],[11819,11822,1],[11824,11833,1],[11836,11839,1],[11841,11843,2],[11844,11855,1],[11858,11860,1],[12289,12291,1],[12349,12539,190],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,65040,21029],[65041,65046,1],[65049,65072,23],[65093,65094,1],[65097,65100,1],[65104,65106,1],[65108,65111,1],[65119,65121,1],[65128,65130,2],[65131,65281,150],[65282,65283,1],[65285,65287,1],[65290,65294,2],[65295,65306,11],[65307,65311,4],[65312,65340,28],[65377,65380,3],[65381,65792,411],[65793,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69461,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Ps=[[40,91,51],[123,3898,3775],[3900,5787,1887],[8218,8222,4],[8261,8317,56],[8333,8968,635],[8970,9001,31],[10088,10100,2],[10181,10214,33],[10216,10222,2],[10627,10647,2],[10712,10714,2],[10748,11810,1062],[11812,11816,2],[11842,11861,19],[11863,11867,2],[12296,12304,2],[12308,12314,2],[12317,64831,52514],[65047,65077,30],[65079,65091,2],[65095,65113,18],[65115,65117,2],[65288,65339,51],[65371,65375,4],[65378,65378,1]];static S=[[36,43,7],[60,62,1],[94,96,2],[124,126,2],[162,166,1],[168,169,1],[172,174,2],[175,177,1],[180,184,4],[215,247,32],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,1014,113],[1154,1421,267],[1422,1423,1],[1542,1544,1],[1547,1550,3],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2046,2047,1],[2184,2546,362],[2547,2554,7],[2555,2801,246],[2928,3059,131],[3060,3066,1],[3199,3407,208],[3449,3647,198],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6107,366],[6464,6622,158],[6623,6655,1],[7009,7018,1],[7028,7036,1],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8352,8384,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8472,1],[8478,8483,1],[8485,8489,2],[8494,8506,12],[8507,8512,5],[8513,8516,1],[8522,8525,1],[8527,8586,59],[8587,8592,5],[8593,8967,1],[8972,9e3,1],[9003,9254,1],[9280,9290,1],[9372,9449,1],[9472,10087,1],[10132,10180,1],[10183,10213,1],[10224,10626,1],[10649,10711,1],[10716,10747,1],[10750,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12443,12444,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,
21],[12992,13311,1],[19904,19967,1],[42128,42182,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43048,43051,1],[43062,43065,1],[43639,43641,1],[43867,43882,15],[43883,64297,20414],[64434,64450,1],[64832,64847,1],[64975,65020,45],[65021,65023,1],[65122,65124,2],[65125,65126,1],[65129,65284,155],[65291,65308,17],[65309,65310,1],[65342,65344,2],[65372,65374,2],[65504,65510,1],[65512,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,123647,432],[126124,126128,4],[126254,126704,450],[126705,126976,271],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Sc=[[36,162,126],[163,165,1],[1423,1547,124],[2046,2047,1],[2546,2547,1],[2555,2801,246],[3065,3647,582],[6107,8352,2245],[8353,8384,1],[43064,65020,21956],[65129,65284,155],[65504,65505,1],[65509,65510,1],[73693,73696,1],[123647,126128,2481]];static Sk=[[94,96,2],[168,175,7],[180,184,4],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,2184,1283],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[12443,12444,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43867,43882,15],[43883,64434,20551],[64435,64450,1],[65342,65344,2],[65507,127995,62488],[127996,127999,1]];static Sm=[[43,60,17],[61,62,1],[124,126,2],[172,177,5],[215,247,32],[1014,1542,528],[1543,1544,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8472,8512,40],[8513,8516,1],[8523,8592,69],[8593,8596,1],[8602,8603,1],[8608,8614,3],[8622,8654,32],[8655,8658,3],[8660,8692,32],[8693,8959,1],[8992,8993,1],[9084,9115,31],[9116,9139,1],[9180,9185,1],[9655,9665,10],[9720,9727,1],[9839,10176,337],[10177,10180,1],[10183,10213,1],[10224,10239,1],[10496,10626,1],[10649,10711,1],[10716,10747,1],[10750,11007,1],[11056,11076,1],[11079,11084,1],[64297,65122,825],[65124,65126,1],[65291,65308,17],[65309,65310,1],[65372,65374,2],[65506,65513,7],[65514,65516,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[126704,126705,1]];static So=[[166,169,3],[174,176,2],[1154,1421,267],[1422,1550,128],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2554,2928,374],[3059,3064,1],[3066,3199,133],[3407,3449,42],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6464,723],[6622,6655,1],[7009,7018,1],[7028,7036,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8478,7],[8479,8483,1],[8485,8489,2],[8494,8506,12],[8507,8522,15],[8524,8525,1],[8527,8586,59],[8587,8597,10],[8598,8601,1],[8604,8607,1],[8609,8610,1],[8612,8613,1],[8615,8621,1],[8623,8653,1],[8656,8657,1],[8659,8661,2],[8662,8691,1],[8960,8967,1],[8972,8991,1],[8994,9e3,1],[9003,9083,1],[9085,9114,1],[9140,9179,1],[9186,9254,1],[9280,9290,1],[9372,9449,1],[9472,9654,1],[9656,9664,1],[9666,9719,1],[9728,9838,1],[9840,10087,1],[10132,10175,1],[10240,10495,1],[11008,11055,1],[11077,11078,1],[11085,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,
21],[12992,13311,1],[19904,19967,1],[42128,42182,1],[43048,43051,1],[43062,43063,1],[43065,43639,574],[43640,43641,1],[64832,64847,1],[64975,65021,46],[65022,65023,1],[65508,65512,4],[65517,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73692,1],[73697,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,126124,2909],[126254,126976,722],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,127994,1],[128e3,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Z=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8232,8233,1],[8239,8287,48],[12288,12288,1]];static Zl=[[8232,8232,1]];static Zp=[[8233,8233,1]];static Zs=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8239,8287,48],[12288,12288,1]];static Adlam=[[125184,125259,1],[125264,125273,1],[125278,125279,1]];static Ahom=[[71424,71450,1],[71453,71467,1],[71472,71494,1]];static Anatolian_Hieroglyphs=[[82944,83526,1]];static Arabic=[[1536,1540,1],[1542,1547,1],[1549,1562,1],[1564,1566,1],[1568,1599,1],[1601,1610,1],[1622,1647,1],[1649,1756,1],[1758,1791,1],[1872,1919,1],[2160,2190,1],[2192,2193,1],[2200,2273,1],[2275,2303,1],[64336,64450,1],[64467,64829,1],[64832,64911,1],[64914,64967,1],[64975,65008,33],[65009,65023,1],[65136,65140,1],[65142,65276,1],[69216,69246,1],[69373,69375,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[126704,126705,1]];static Armenian=[[1329,1366,1],[1369,1418,1],[1421,1423,1],[64275,64279,1]];static Avestan=[[68352,68405,1],[68409,68415,1]];static Balinese=[[6912,6988,1],[6992,7038,1]];static Bamum=[[42656,42743,1],[92160,92728,1]];static Bassa_Vah=[[92880,92909,1],[92912,92917,1]];static Batak=[[7104,7155,1],[7164,7167,1]];static Bengali=[[2432,2435,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2492,2500,1],[2503,2504,1],[2507,2510,1],[2519,2524,5],[2525,2527,2],[2528,2531,1],[2534,2558,1]];static Bhaiksuki=[[72704,72712,1],[72714,72758,1],[72760,72773,1],[72784,72812,1]];static Bopomofo=[[746,747,1],[12549,12591,1],[12704,12735,1]];static Brahmi=[[69632,69709,1],[69714,69749,1],[69759,69759,1]];static Braille=[[10240,10495,1]];static Buginese=[[6656,6683,1],[6686,6687,1]];static Buhid=[[5952,5971,1]];static Canadian_Aboriginal=[[5120,5759,1],[6320,6389,1],[72368,72383,1]];static Carian=[[66208,66256,1]];static Caucasian_Albanian=[[66864,66915,1],[66927,66927,1]];static Chakma=[[69888,69940,1],[69942,69959,1]];static Cham=[[43520,43574,1],[43584,43597,1],[43600,43609,1],[43612,43615,1]];static Cherokee=[[5024,5109,1],[5112,5117,1],[43888,43967,1]];static Chorasmian=[[69552,69579,1]];static Common=[[0,64,1],[91,96,1],[123,169,1],[171,185,1],[187,191,1],[215,247,32],[697,735,1],[741,745,1],[748,767,1],[884,894,10],[901,903,2],[1541,1548,7],[1563,1567,4],[1600,1757,157],[2274,2404,130],[2405,3647,1242],[4053,4056,1],[4347,5867,1520],[5868,5869,1],[5941,5942,1],[6146,6147,1],[6149,7379,1230],[7393,7401,8],[7402,7404,1],[7406,7411,1],[7413,7415,1],[7418,8192,774],[8193,8203,1],[8206,8292,1],[8294,8304,1],[8308,8318,1],[8320,8334,1],[8352,8384,1],[8448,8485,1],[8487,8489,1],[8492,8497,1],[8499,8525,1],[8527,8543,1],[8585,8587,1],[8592,9254,1],[9280,9290,1],[9312,10239,1],[10496,11123,1],[11126,11157,1],[11159,11263,1],[11776,11869,1],[12272,12292,1],[12294,12296,2],[12297,12320,1],[12336,12343,1],[12348,12351,1],[12443,12444,1],[12448,12539,91],[12540,12688,148],[12689,12703,1],[12736,12771,1],[12783,12832,49],[12833,12895,1],[12927,13007,1],[13055,13144,89],[13145,13311,1],[19904,19967,1],[42752,42785,1],[42888,42890,1],[43056,43065,1],[43310,43471,161],[43867,43882,15],[43883,64830,20947],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65126,1],[65128,65131,1],[65279,65281,2],[65282,65312,1],[65339,65344,1],[65371,65381,1],[65392,65438,46],[65439,65504,65],[65505,65510,1],[65512,65518,1],[65529,65533,1],[65792,65794,1],[65799,65843,1],[65847,65855,1],[65936,65948,1],[66e3,66044,1],[66273,66299,1],[113824,113827,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119142,1],[119146,119162,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119488,119507,1],[119520,119539,1],[119552,119638,1],[119648,119672,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,
2119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120779,1],[120782,120831,1],[126065,126132,1],[126209,126269,1],[126976,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127232,127405,1],[127462,127487,1],[127489,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1],[130032,130041,1],[917505,917536,31],[917537,917631,1]];static foldCommon=[[924,956,32]];static Coptic=[[994,1007,1],[11392,11507,1],[11513,11519,1]];static Cuneiform=[[73728,74649,1],[74752,74862,1],[74864,74868,1],[74880,75075,1]];static Cypriot=[[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3]];static Cypro_Minoan=[[77712,77810,1]];static Cyrillic=[[1024,1156,1],[1159,1327,1],[7296,7304,1],[7467,7544,77],[11744,11775,1],[42560,42655,1],[65070,65071,1],[122928,122989,1],[123023,123023,1]];static Deseret=[[66560,66639,1]];static Devanagari=[[2304,2384,1],[2389,2403,1],[2406,2431,1],[43232,43263,1],[72448,72457,1]];static Dives_Akuru=[[71936,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71989,1],[71991,71992,1],[71995,72006,1],[72016,72025,1]];static Dogra=[[71680,71739,1]];static Duployan=[[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[113820,113823,1]];static Egyptian_Hieroglyphs=[[77824,78933,1]];static Elbasan=[[66816,66855,1]];static Elymaic=[[69600,69622,1]];static Ethiopic=[[4608,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4957,4988,1],[4992,5017,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1]];static Georgian=[[4256,4293,1],[4295,4301,6],[4304,4346,1],[4348,4351,1],[7312,7354,1],[7357,7359,1],[11520,11557,1],[11559,11565,6]];static Glagolitic=[[11264,11359,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1]];static Gothic=[[66352,66378,1]];static Grantha=[[70400,70403,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70460,70468,1],[70471,70472,1],[70475,70477,1],[70480,70487,7],[70493,70499,1],[70502,70508,1],[70512,70516,1]];static Greek=[[880,883,1],[885,887,1],[890,893,1],[895,900,5],[902,904,2],[905,906,1],[908,910,2],[911,929,1],[931,993,1],[1008,1023,1],[7462,7466,1],[7517,7521,1],[7526,7530,1],[7615,7936,321],[7937,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8132,1],[8134,8147,1],[8150,8155,1],[8157,8175,1],[8178,8180,1],[8182,8190,1],[8486,43877,35391],[65856,65934,1],[65952,119296,53344],[119297,119365,1]];static foldGreek=[[181,837,656]];static Gujarati=[[2689,2691,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2748,2757,1],[2759,2761,1],[2763,2765,1],[2768,2784,16],[2785,2787,1],[2790,2801,1],[2809,2815,1]];static Gunjala_Gondi=[[73056,73061,1],[73063,73064,1],[73066,73102,1],[73104,73105,1],[73107,73112,1],[73120,73129,1]];static Gurmukhi=[[2561,2563,1],[2565,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2649,8],[2650,2652,1],[2654,2662,8],[2663,2678,1]];static Han=[[11904,11929,1],[11931,12019,1],[12032,12245,1],[12293,12295,2],[12321,12329,1],[12344,12347,1],[13312,19903,1],[19968,40959,1],[63744,64109,1],[64112,64217,1],[94178,94179,1],[94192,94193,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];
2static Hangul=[[4352,4607,1],[12334,12335,1],[12593,12686,1],[12800,12830,1],[12896,12926,1],[43360,43388,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1]];static Hanifi_Rohingya=[[68864,68903,1],[68912,68921,1]];static Hanunoo=[[5920,5940,1]];static Hatran=[[67808,67826,1],[67828,67829,1],[67835,67839,1]];static Hebrew=[[1425,1479,1],[1488,1514,1],[1519,1524,1],[64285,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64335,1]];static Hiragana=[[12353,12438,1],[12445,12447,1],[110593,110879,1],[110898,110928,30],[110929,110930,1],[127488,127488,1]];static Imperial_Aramaic=[[67648,67669,1],[67671,67679,1]];static Inherited=[[768,879,1],[1157,1158,1],[1611,1621,1],[1648,2385,737],[2386,2388,1],[6832,6862,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8204,8205,1],[8400,8432,1],[12330,12333,1],[12441,12442,1],[65024,65039,1],[65056,65069,1],[66045,66272,227],[70459,118528,48069],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[917760,917999,1]];static foldInherited=[[921,953,32],[8126,8126,1]];static Inscriptional_Pahlavi=[[68448,68466,1],[68472,68479,1]];static Inscriptional_Parthian=[[68416,68437,1],[68440,68447,1]];static Javanese=[[43392,43469,1],[43472,43481,1],[43486,43487,1]];static Kaithi=[[69760,69826,1],[69837,69837,1]];static Kannada=[[3200,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3260,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3293,3294,1],[3296,3299,1],[3302,3311,1],[3313,3315,1]];static Katakana=[[12449,12538,1],[12541,12543,1],[12784,12799,1],[13008,13054,1],[13056,13143,1],[65382,65391,1],[65393,65437,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110880,288],[110881,110882,1],[110933,110948,15],[110949,110951,1]];static Kawi=[[73472,73488,1],[73490,73530,1],[73534,73561,1]];static Kayah_Li=[[43264,43309,1],[43311,43311,1]];static Kharoshthi=[[68096,68099,1],[68101,68102,1],[68108,68115,1],[68117,68119,1],[68121,68149,1],[68152,68154,1],[68159,68168,1],[68176,68184,1]];static Khitan_Small_Script=[[94180,101120,6940],[101121,101589,1]];static Khmer=[[6016,6109,1],[6112,6121,1],[6128,6137,1],[6624,6655,1]];static Khojki=[[70144,70161,1],[70163,70209,1]];static Khudawadi=[[70320,70378,1],[70384,70393,1]];static Lao=[[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3773,1],[3776,3780,1],[3782,3784,2],[3785,3790,1],[3792,3801,1],[3804,3807,1]];static Latin=[[65,90,1],[97,122,1],[170,186,16],[192,214,1],[216,246,1],[248,696,1],[736,740,1],[7424,7461,1],[7468,7516,1],[7522,7525,1],[7531,7543,1],[7545,7614,1],[7680,7935,1],[8305,8319,14],[8336,8348,1],[8490,8491,1],[8498,8526,28],[8544,8584,1],[11360,11391,1],[42786,42887,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43007,1],[43824,43866,1],[43868,43876,1],[43878,43881,1],[64256,64262,1],[65313,65338,1],[65345,65370,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[122624,122654,1],[122661,122666,1]];static Lepcha=[[7168,7223,1],[7227,7241,1],[7245,7247,1]];static Limbu=[[6400,6430,1],[6432,6443,1],[6448,6459,1],[6464,6468,4],[6469,6479,1]];static Linear_A=[[67072,67382,1],[67392,67413,1],[67424,67431,1]];static Linear_B=[[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1]];static Lisu=[[42192,42239,1],[73648,73648,1]];static Lycian=[[66176,66204,1]];static Lydian=[[67872,67897,1],[67903,67903,1]];static Mahajani=[[69968,70006,1]];static Makasar=[[73440,73464,1]];static Malayalam=[[3328,3340,1],[3342,3344,1],[3346,3396,1],[3398,3400,1],[3402,3407,1],[3412,3427,1],[3430,3455,1]];static Mandaic=[[2112,2139,1],[2142,2142,1]];static Manichaean=[[68288,68326,1],[68331,68342,1]];static Marchen=[[72816,72847,1],[72850,72871,1],[72873,72886,1]];static Masaram_Gondi=[[72960,72966,1],[72968,72969,1],[72971,73014,1],[73018,73020,2],[73021,73023,2],[73024,73031,1],[73040,73049,1]];static Medefaidrin=[[93760,93850,1]];static Meetei_Mayek=[[43744,43766,1],[43968,44013,1],[44016,44025,1]];static Mende_Kikakui=[[124928,125124,1],[125127,125142,1]];static Meroitic_Cursive=[[68e3,68023,1],[68028,68047,1],[68050,68095,1]];static Meroitic_Hieroglyphs=[[67968,67999,1]];static Miao=[[93952,94026,1],[94031,94087,1],[94095,94111,1]];static Modi=[[71168,71236,1],[71248,71257,1]];static Mongolian=[[6144,6145,1],[6148,6150,2],[6151,6169,1],[6176,6264,1],[6272,6314,1],[71264,71276,1]];static Mro=[[92736,92766,1],[92768,92777,1],[92782,92783,1]];static Multani=[[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70313,1]];static Myanmar=[[4096,4255,1],[43488,43518,1],[43616,43647,1]];static Nabataean=[[67712,67742,1],[67751,67759,1]];static Nag_Mundari=[[124112,124153,1]];static Nandinagari=[[72096,72103,1],[72106,72151,1],[72154,72164,1]];static New_Tai_Lue=[[6528,6571,1],[6576,6601,1],[6608,6618,1],[6622,6623,1]];static Newa=[[70656,70747,1],[70749,70753,1]];static Nko=[[1984,2042,1],[2045,2047,1]];
2static Nushu=[[94177,110960,16783],[110961,111355,1]];static Nyiakeng_Puachue_Hmong=[[123136,123180,1],[123184,123197,1],[123200,123209,1],[123214,123215,1]];static Ogham=[[5760,5788,1]];static Ol_Chiki=[[7248,7295,1]];static Old_Hungarian=[[68736,68786,1],[68800,68850,1],[68858,68863,1]];static Old_Italic=[[66304,66339,1],[66349,66351,1]];static Old_North_Arabian=[[68224,68255,1]];static Old_Permic=[[66384,66426,1]];static Old_Persian=[[66464,66499,1],[66504,66517,1]];static Old_Sogdian=[[69376,69415,1]];static Old_South_Arabian=[[68192,68223,1]];static Old_Turkic=[[68608,68680,1]];static Old_Uyghur=[[69488,69513,1]];static Oriya=[[2817,2819,1],[2821,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2876,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2908,2909,1],[2911,2915,1],[2918,2935,1]];static Osage=[[66736,66771,1],[66776,66811,1]];static Osmanya=[[66688,66717,1],[66720,66729,1]];static Pahawh_Hmong=[[92928,92997,1],[93008,93017,1],[93019,93025,1],[93027,93047,1],[93053,93071,1]];static Palmyrene=[[67680,67711,1]];static Pau_Cin_Hau=[[72384,72440,1]];static Phags_Pa=[[43072,43127,1]];static Phoenician=[[67840,67867,1],[67871,67871,1]];static Psalter_Pahlavi=[[68480,68497,1],[68505,68508,1],[68521,68527,1]];static Rejang=[[43312,43347,1],[43359,43359,1]];static Runic=[[5792,5866,1],[5870,5880,1]];static Samaritan=[[2048,2093,1],[2096,2110,1]];static Saurashtra=[[43136,43205,1],[43214,43225,1]];static Sharada=[[70016,70111,1]];static Shavian=[[66640,66687,1]];static Siddham=[[71040,71093,1],[71096,71133,1]];static SignWriting=[[120832,121483,1],[121499,121503,1],[121505,121519,1]];static Sinhala=[[3457,3459,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3558,3567,1],[3570,3572,1],[70113,70132,1]];static Sogdian=[[69424,69465,1]];static Sora_Sompeng=[[69840,69864,1],[69872,69881,1]];static Soyombo=[[72272,72354,1]];static Sundanese=[[7040,7103,1],[7360,7367,1]];static Syloti_Nagri=[[43008,43052,1]];static Syriac=[[1792,1805,1],[1807,1866,1],[1869,1871,1],[2144,2154,1]];static Tagalog=[[5888,5909,1],[5919,5919,1]];static Tagbanwa=[[5984,5996,1],[5998,6e3,1],[6002,6003,1]];static Tai_Le=[[6480,6509,1],[6512,6516,1]];static Tai_Tham=[[6688,6750,1],[6752,6780,1],[6783,6793,1],[6800,6809,1],[6816,6829,1]];static Tai_Viet=[[43648,43714,1],[43739,43743,1]];static Takri=[[71296,71353,1],[71360,71369,1]];static Tamil=[[2946,2947,1],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3006,3010,1],[3014,3016,1],[3018,3021,1],[3024,3031,7],[3046,3066,1],[73664,73713,1],[73727,73727,1]];static Tangsa=[[92784,92862,1],[92864,92873,1]];static Tangut=[[94176,94208,32],[94209,100343,1],[100352,101119,1],[101632,101640,1]];static Telugu=[[3072,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3132,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3160,3162,1],[3165,3168,3],[3169,3171,1],[3174,3183,1],[3191,3199,1]];static Thaana=[[1920,1969,1]];static Thai=[[3585,3642,1],[3648,3675,1]];static Tibetan=[[3840,3911,1],[3913,3948,1],[3953,3991,1],[3993,4028,1],[4030,4044,1],[4046,4052,1],[4057,4058,1]];static Tifinagh=[[11568,11623,1],[11631,11632,1],[11647,11647,1]];static Tirhuta=[[70784,70855,1],[70864,70873,1]];static Toto=[[123536,123566,1]];static Ugaritic=[[66432,66461,1],[66463,66463,1]];static Vai=[[42240,42539,1]];static Vithkuqi=[[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1]];static Wancho=[[123584,123641,1],[123647,123647,1]];static Warang_Citi=[[71840,71922,1],[71935,71935,1]];static Yezidi=[[69248,69289,1],[69291,69293,1],[69296,69297,1]];static Yi=[[40960,42124,1],[42128,42182,1]];static Zanabazar_Square=[[72192,72263,1]];static CATEGORIES=(()=>new Map([["C",T.C],["Cc",T.Cc],["Cf",T.Cf],["Co",T.Co],["Cs",T.Cs],["L",T.L],["Ll",T.Ll],["Lm",T.Lm],["Lo",T.Lo],["Lt",T.Lt],["Lu",T.Lu],["M",T.M],["Mc",T.Mc],["Me",T.Me],["Mn",T.Mn],["N",T.N],["Nd",T.Nd],["Nl",T.Nl],["No",T.No],["P",T.P],["Pc",T.Pc],["Pd",T.Pd],["Pe",T.Pe],["Pf",T.Pf],["Pi",T.P
2i],["Po",T.Po],["Ps",T.Ps],["S",T.S],["Sc",T.Sc],["Sk",T.Sk],["Sm",T.Sm],["So",T.So],["Z",T.Z],["Zl",T.Zl],["Zp",T.Zp],["Zs",T.Zs]]))();static SCRIPTS=(()=>new Map([["Adlam",T.Adlam],["Ahom",T.Ahom],["Anatolian_Hieroglyphs",T.Anatolian_Hieroglyphs],["Arabic",T.Arabic],["Armenian",T.Armenian],["Avestan",T.Avestan],["Balinese",T.Balinese],["Bamum",T.Bamum],["Bassa_Vah",T.Bassa_Vah],["Batak",T.Batak],["Bengali",T.Bengali],["Bhaiksuki",T.Bhaiksuki],["Bopomofo",T.Bopomofo],["Brahmi",T.Brahmi],["Braille",T.Braille],["Buginese",T.Buginese],["Buhid",T.Buhid],["Canadian_Aboriginal",T.Canadian_Aboriginal],["Carian",T.Carian],["Caucasian_Albanian",T.Caucasian_Albanian],["Chakma",T.Chakma],["Cham",T.Cham],["Cherokee",T.Cherokee],["Chorasmian",T.Chorasmian],["Common",T.Common],["Coptic",T.Coptic],["Cuneiform",T.Cuneiform],["Cypriot",T.Cypriot],["Cypro_Minoan",T.Cypro_Minoan],["Cyrillic",T.Cyrillic],["Deseret",T.Deseret],["Devanagari",T.Devanagari],["Dives_Akuru",T.Dives_Akuru],["Dogra",T.Dogra],["Duployan",T.Duployan],["Egyptian_Hieroglyphs",T.Egyptian_Hieroglyphs],["Elbasan",T.Elbasan],["Elymaic",T.Elymaic],["Ethiopic",T.Ethiopic],["Georgian",T.Georgian],["Glagolitic",T.Glagolitic],["Gothic",T.Gothic],["Grantha",T.Grantha],["Greek",T.Greek],["Gujarati",T.Gujarati],["Gunjala_Gondi",T.Gunjala_Gondi],["Gurmukhi",T.Gurmukhi],["Han",T.Han],["Hangul",T.Hangul],["Hanifi_Rohingya",T.Hanifi_Rohingya],["Hanunoo",T.Hanunoo],["Hatran",T.Hatran],["Hebrew",T.Hebrew],["Hiragana",T.Hiragana],["Imperial_Aramaic",T.Imperial_Aramaic],["Inherited",T.Inherited],["Inscriptional_Pahlavi",T.Inscriptional_Pahlavi],["Inscriptional_Parthian",T.Inscriptional_Parthian],["Javanese",T.Javanese],["Kaithi",T.Kaithi],["Kannada",T.Kannada],["Katakana",T.Katakana],["Kawi",T.Kawi],["Kayah_Li",T.Kayah_Li],["Kharoshthi",T.Kharoshthi],["Khitan_Small_Script",T.Khitan_Small_Script],["Khmer",T.Khmer],["Khojki",T.Khojki],["Khudawadi",T.Khudawadi],["Lao",T.Lao],["Latin",T.Latin],["Lepcha",T.Lepcha],["Limbu",T.Limbu],["Linear_A",T.Linear_A],["Linear_B",T.Linear_B],["Lisu",T.Lisu],["Lycian",T.Lycian],["Lydian",T.Lydian],["Mahajani",T.Mahajani],["Makasar",T.Makasar],["Malayalam",T.Malayalam],["Mandaic",T.Mandaic],["Manichaean",T.Manichaean],["Marchen",T.Marchen],["Masaram_Gondi",T.Masaram_Gondi],["Medefaidrin",T.Medefaidrin],["Meetei_Mayek",T.Meetei_Mayek],["Mende_Kikakui",T.Mende_Kikakui],["Meroitic_Cursive",T.Meroitic_Cursive],["Meroitic_Hieroglyphs",T.Meroitic_Hieroglyphs],["Miao",T.Miao],["Modi",T.Modi],["Mongolian",T.Mongolian],["Mro",T.Mro],["Multani",T.Multani],["Myanmar",T.Myanmar],["Nabataean",T.Nabataean],["Nag_Mundari",T.Nag_Mundari],["Nandinagari",T.Nandinagari],["New_Tai_Lue",T.New_Tai_Lue],["Newa",T.Newa],["Nko",T.Nko],["Nushu",T.Nushu],["Nyiakeng_Puachue_Hmong",T.Nyiakeng_Puachue_Hmong],["Ogham",T.Ogham],["Ol_Chiki",T.Ol_Chiki],["Old_Hungarian",T.Old_Hungarian],["Old_Italic",T.Old_Italic],["Old_North_Arabian",T.Old_North_Arabian],["Old_Permic",T.Old_Permic],["Old_Persian",T.Old_Persian],["Old_Sogdian",T.Old_Sogdian],["Old_South_Arabian",T.Old_South_Arabian],["Old_Turkic",T.Old_Turkic],["Old_Uyghur",T.Old_Uyghur],["Oriya",T.Oriya],["Osage",T.Osage],["Osmanya",T.Osmanya],["Pahawh_Hmong",T.Pahawh_Hmong],["Palmyrene",T.Palmyrene],["Pau_Cin_Hau",T.Pau_Cin_Hau],["Phags_Pa",T.Phags_Pa],["Phoenician",T.Phoenician],["Psalter_Pahlavi",T.Psalter_Pahlavi],["Rejang",T.Rejang],["Runic",T.Runic],["Samaritan",T.Samaritan],["Saurashtra",T.Saurashtra],["Sharada",T.Sharada],["Shavian",T.Shavian],["Siddham",T.Siddham],["SignWriting",T.SignWriting],["Sinhala",T.Sinhala],["Sogdian",T.Sogdian],["Sora_Sompeng",T.Sora_Sompeng],["Soyombo",T.Soyombo],["Sundanese",T.Sundanese],["Syloti_Nagri",T.Syloti_Nagri],["Syriac",T.Syriac],["Tagalog",T.Tagalog],["Tagbanwa",T.Tagbanwa],["Tai_Le",T.Tai_Le],["Tai_Tham",T.Tai_Tham],["Tai_Viet",T.Tai_Viet],["Takri",T.Takri],["Tamil",T.Tamil],["Tangsa",T.Tangsa],["Tangut",T.Tangut],["Telugu",T.Telugu],["Thaana",T.Thaana],["Thai",T.Thai],["Tibetan",T.Tibetan],["Tifinagh",T.Tifinagh],["Tirhuta",T.Tirhuta],["Toto",T.Toto],["Ugaritic",T.Ugaritic],["Vai",T.Vai],["Vithkuqi",T.Vithkuqi],["Wancho",T.Wancho],["Warang_Citi",T.Warang_Citi],["Yezidi",T.Yezidi],["Yi",T.Yi],["Zanabazar_Square",T.Zanabazar_Square]]))();static FOLD_CATEGORIES=(()=>new Map([["L",T.foldL],["Ll",T.foldLl],["Lt",T.foldLt],["Lu",T.foldLu],["M",T.foldM],["Mn",T.foldMn]]))();static FOLD_SCRIPT=(()=>new Map([["Common",T.foldCommon],["Greek",T.foldGreek],["Inherited",T.foldInherited]]))()}class b{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(e,t){let n=0,r=e.length;for(;n<r;){let s=n+Math.floor((r-n)/2),i=e[s];if(i[0]<=t&&t<=i[1])return(t-i[0])%i[2]===0;t<i[0]?r=s:n=s+1}return!1}static is(e,t){if(t<=this.MAX_LATIN1){for(let n of e)if(!(t>n[1]))return!(t<n[0])&&(t-n[0])%n[2]===0;return!1}return e.length>0&&t>=e[0][0]&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){const t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(T.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e<127||e>=161&&173!==e:this.is(T.L,e)||this.is(T.M,e)||this.is(T.N,e)||this.is(T.P,e)||this.is(T.S,e)}static simpleFold(e){if(T.CASE_ORBIT.has(e))return T.CASE_ORBIT.get(e);const t=I.toLowerCase(e);return t!==e?t:I.toUpperCase(e)}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;
2if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return I.CODES.get("A")<=e&&e<=I.CODES.get("Z")&&(e|=32),I.CODES.get("A")<=t&&t<=I.CODES.get("Z")&&(t|=32),e===t;for(let n=this.simpleFold(e);n!==e;n=this.simpleFold(n))if(n===t)return!0;return!1}}class S{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(e){return I.CODES.get("0")<=e&&e<=I.CODES.get("9")||I.CODES.get("a")<=e&&e<=I.CODES.get("z")||I.CODES.get("A")<=e&&e<=I.CODES.get("Z")}static unhex(e){return I.CODES.get("0")<=e&&e<=I.CODES.get("9")?e-I.CODES.get("0"):I.CODES.get("a")<=e&&e<=I.CODES.get("f")?e-I.CODES.get("a")+10:I.CODES.get("A")<=e&&e<=I.CODES.get("F")?e-I.CODES.get("A")+10:-1}static escapeRune(e){let t="";if(b.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+="\\"),t+=String.fromCodePoint(e);else switch(e){case I.CODES.get('"'):t+='\\"';break;case I.CODES.get("\\"):t+="\\\\";break;case I.CODES.get("\t"):t+="\\t";break;case I.CODES.get("\n"):t+="\\n";break;case I.CODES.get("\r"):t+="\\r";break;case I.CODES.get("\b"):t+="\\b";break;case I.CODES.get("\f"):t+="\\f";break;default:{let n=e.toString(16);e<256?(t+="\\x",1===n.length&&(t+="0"),t+=n):t+=`\\x{${n}}`;break}}return t}static stringToRunes(e){return String(e).split("").map(e=>e.codePointAt(0))}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return I.CODES.get("a")<=e&&e<=I.CODES.get("z")||I.CODES.get("A")<=e&&e<=I.CODES.get("Z")||I.CODES.get("0")<=e&&e<=I.CODES.get("9")||e===I.CODES.get("_")}static emptyOpContext(e,t){let n=0;return e<0&&(n|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),e===I.CODES.get("\n")&&(n|=this.EMPTY_BEGIN_LINE),t<0&&(n|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),t===I.CODES.get("\n")&&(n|=this.EMPTY_END_LINE),this.isWordRune(e)!==this.isWordRune(t)?n|=this.EMPTY_WORD_BOUNDARY:n|=this.EMPTY_NO_WORD_BOUNDARY,n}static quoteMeta(e){return e.split("").map(e=>this.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join("")}static charCount(e){return e>b.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from((new TextEncoder).encode(e));{let t=[],n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=63&s|128):55296==(64512&s)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=63&s|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=63&s|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(e));{let t=[],n=0,r=0;for(;n<e.length;){let s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){let i=e[n++];t[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){let i=((7&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{let i=e[n++],a=e[n++];t[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&a)}}return t.join("")}}}const A=(e=[],t=0)=>{const n={};for(let r=0;r<e.length;r++){const s=e[r],i=t+r;n[s]=i,n[i]=s}return Object.freeze(n)};class C{static Encoding=(()=>A(["UTF_16","UTF_8"]))();getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===C.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===C.Encoding.UTF_16}}class N extends C{constructor(e=null){super(),this.bytes=e}getEncoding(){return C.Encoding.UTF_8}asCharSequence(){return S.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}}class O extends C{constructor(e=null){super(),this.charSequence=e}getEncoding(){return C.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(e=>e.codePointAt(0))}length(){return this.charSequence.length}}class D{static utf16(e){return new O(e)}static utf8(e){return Array.isArray(e)?new N(e):new N(S.stringToUtf8ByteArray(e))}}
2class R extends Error{constructor(e){super(e),this.name="RE2JSException"}}class k extends R{constructor(e,t=null){let n=`error parsing regexp: ${e}`;t&&(n+=`: \`${t}\``),super(n),this.name="RE2JSSyntaxException",this.message=n,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}}class x extends R{constructor(e){super(e),this.name="RE2JSCompileException"}}class P extends R{constructor(e){super(e),this.name="RE2JSGroupException"}}class L extends R{constructor(e){super(e),this.name="RE2JSFlagsException"}}class M{static quoteReplacement(e){return e.indexOf("\\")<0&&e.indexOf("$")<0?e:e.split("").map(e=>{const t=e.codePointAt(0);return t===I.CODES["\\"]||t===I.CODES.$?`\\${e}`:e}).join("")}constructor(e,t){if(null===e)throw new Error("pattern is null");this.patternInput=e;const n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,t instanceof C?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(D.utf8(t)):this.resetMatcherInput(D.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(null===e)throw new Error("input is null");return this.matcherInput=e,this.reset(),this}start(e=0){if("string"==typeof e){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new P(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if("string"==typeof e){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new P(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}group(e=0){if("string"==typeof e){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new P(`group '${e}' not found`);e=t}const t=this.start(e),n=this.end(e);return t<0&&n<0?null:this.substring(t,n)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new P(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new P("perhaps no match attempted");if(0===e||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);const n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!n[0])throw new P("inconsistency in matching group data");this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,E.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,E.ANCHOR_START)}find(e=null){if(null!==e){if(e<0||e>this.matcherInputLength)throw new P(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,E.UNANCHORED)}genMatch(e,t){const n=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return!!n[0]&&(this.groups=n[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0)}substring(e,t){return this.matcherInput.isUTF8Encoding()?S.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let n="";const r=this.start(),s=this.end();return this.appendPos<r&&(n+=this.substring(this.appendPos,r)),this.appendPos=s,n+=t?this.appendReplacementInternalPerl(e):this.appendReplacementInternal(e),n}appendReplacementInternal(e){let t="",n=0;const r=e.length;for(let s=0;s<r-1;s++)if(e.codePointAt(s)!==I.CODES.get("\\")){if(e.codePointAt(s)===I.CODES.get("$")){let i=e.codePointAt(s+1);if(I.CODES.get("0")<=i&&i<=I.CODES.get("9")){let a=i-I.CODES.get("0");for(n<s&&(t+=e.substring(n,s)),s+=2;s<r&&(i=e.codePointAt(s),!(i<I.CODES.get("0")||i>I.CODES.get("9")||10*a+i-I.CODES.get("0")>this.patternGroupCount));s++)a=10*a+i-I.CODES.get("0");if(a>this.patternGroupCount)throw new P(`n > number of groups: ${a}`);const o=this.group(a);null!==o&&(t+=o),n=s,s--;continue}if(i===I.CODES.get("{")){n<s&&(t+=e.substring(n,s)),s++;let r=s+1;for(;r<e.length&&e.codePointAt(r)!==I.CODES.get("}")&&e.codePointAt(r)!==I.CODES.get(" ");)r++;if(r===e.length||e.codePointAt(r)!==I.CODES.get("}"))throw new P("named capture group is missing trailing '}'");const i=e.substring(s+1,r);t+=this.group(i),n=r+1}}}else n<s&&(t+=e.substring(n,s)),s++,n=s;return n<r&&(t+=e.substring(n,r)),t}appendReplacementInternalPerl(e){let t="",n=0;const r=e.length;for(let s=0;s<r-1;s++)if(e.codePointAt(s)===I.CODES.get("$")){let i=e.codePointAt(s+1);if(I.CODES.get("$")===i){n<s&&(t+=e.substring(n,s)),t+="$",s++,n=s+1;continue}if(I.CODES.get("&")===i){n<s&&(t+=e.substring(n,s));const r=this.group(0);t+=null!==r?r:"$&",s++,n=s+1;continue}if(I.CODES.get("1")<=i&&i<=I.CODES.get("9")){let a=i-I.CODES.get("0");for(n<s&&(t+=e.substring(n,s)),s+=2;s<r&&(i=e.codePointAt(s),!(i<I.CODES.get("0")||i>I.CODES.get("9")||10*a+i-I.CODES.get("0")>this.patternGroupCount));s++)a=10*a+i-I.CODES.get("0");if(a>this.patternGroupCount){t+=`$${a}`,n=s,s--;continue}const o=this.group(a);null!==o&&(t+=o),n=s,s--;continue}
2if(i===I.CODES.get("<")){n<s&&(t+=e.substring(n,s)),s++;let r=s+1;for(;r<e.length&&e.codePointAt(r)!==I.CODES.get(">")&&e.codePointAt(r)!==I.CODES.get(" ");)r++;if(r===e.length||e.codePointAt(r)!==I.CODES.get(">")){t+=e.substring(s-1,r+1),n=r+1;continue}const i=e.substring(s+1,r);Object.prototype.hasOwnProperty.call(this.namedGroups,i)?t+=this.group(i):t+=`$<${i}>`,n=r+1}}return n<r&&(t+=e.substring(n,r)),t}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,n=!1){let r="";for(this.reset();this.find()&&(r+=this.appendReplacement(e,n),t););return r+=this.appendTail(),r}}class V{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}}class U extends V{constructor(e,t=0,n=e.length){super(),this.bytes=e,this.start=t,this.end=n}step(e){if((e+=this.start)>=this.end)return V.EOF();let t=255&this.bytes[e++];return 128&t?192==(224&t)?(t&=31,e>=this.end?V.EOF():(t=t<<6|63&this.bytes[e++],t<<3|2)):224==(240&t)?(t&=15,e+1>=this.end?V.EOF():(t=t<<6|63&this.bytes[e++],t=t<<6|63&this.bytes[e++],t<<3|3)):(t&=7,e+2>=this.end?V.EOF():(t=t<<6|63&this.bytes[e++],t=t<<6|63&this.bytes[e++],t=t<<6|63&this.bytes[e++],t<<3|4)):t<<3|1}index(e,t){t+=this.start;const n=this.indexOf(this.bytes,e.prefixUTF8,t);return n<0?n:n-t}context(e){let t=-1;if((e+=this.start)>this.start&&e<=this.end){let n=e-1;if(t=this.bytes[n--],t>=128){let r=e-4;for(r<this.start&&(r=this.start);n>=r&&128==(192&this.bytes[n]);)n--;n<this.start&&(n=this.start),t=this.step(n)>>3}}const n=e<this.end?this.step(e)>>3:-1;return S.emptyOpContext(t,n)}indexOf(e,t,n=0){let r=t.length;if(0===r)return-1;let s=e.length;for(let i=n;i<=s-r;i++)for(let n=0;n<r&&e[i+n]===t[n];n++)if(n===r-1)return i;return-1}}class F extends V{constructor(e,t=0,n=e.length){super(),this.charSequence=e,this.start=t,this.end=n}step(e){if((e+=this.start)<this.end){const t=this.charSequence.codePointAt(e);return t<<3|S.charCount(t)}return V.EOF()}index(e,t){t+=this.start;const n=this.charSequence.indexOf(e.prefix,t);return n<0?n:n-t}context(e){const t=(e+=this.start)>0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,n=e<this.charSequence.length?this.charSequence.codePointAt(e):-1;return S.emptyOpContext(t,n)}}class B{static fromUTF8(e,t=0,n=e.length){return new U(e,t,n)}static fromUTF16(e,t=0,n=e.length){return new F(e,t,n)}}class q{static Op=(()=>A(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]))();static isPseudoOp(e){return e>=q.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===I.CODES.get("-")?"\\":""}static fromRegexp(e){const t=new q(e.op);return t.flags=e.flags,t.subs=e.subs,t.runes=e.runes,t.cap=e.cap,t.min=e.min,t.max=e.max,t.name=e.name,t.namedGroups=e.namedGroups,t}constructor(e){this.op=e,this.flags=0,this.subs=q.emptySubs(),this.runes=null,this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=q.emptySubs(),this.runes=null,this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let e="";switch(this.op){case q.Op.NO_MATCH:e+="[^\\x00-\\x{10FFFF}]";break;case q.Op.EMPTY_MATCH:e+="(?:)";break;case q.Op.STAR:case q.Op.PLUS:case q.Op.QUEST:case q.Op.REPEAT:{const t=this.subs[0];switch(t.op>q.Op.CAPTURE||t.op===q.Op.LITERAL&&t.runes.length>1?e+=`(?:${t.appendTo()})`:e+=t.appendTo(),this.op){case q.Op.STAR:e+="*";break;case q.Op.PLUS:e+="+";break;case q.Op.QUEST:e+="?";break;case q.Op.REPEAT:e+=`{${this.min}`,this.min!==this.max&&(e+=",",this.max>=0&&(e+=this.max)),e+="}"}0!==(this.flags&E.NON_GREEDY)&&(e+="?");break}case q.Op.CONCAT:for(let t of this.subs)t.op===q.Op.ALTERNATE?e+=`(?:${t.appendTo()})`:e+=t.appendTo();break;case q.Op.ALTERNATE:{let t="";for(let n of this.subs)e+=t,t="|",e+=n.appendTo();break}case q.Op.LITERAL:0!==(this.flags&E.FOLD_CASE)&&(e+="(?i:");for(let t of this.runes)e+=S.escapeRune(t);0!==(this.flags&E.FOLD_CASE)&&(e+=")");break;case q.Op.ANY_CHAR_NOT_NL:e+="(?-s:.)";break;case q.Op.ANY_CHAR:e+="(?s:.)";break;case q.Op.CAPTURE:null===this.name||0===this.name.length?e+="(":e+=`(?P<${this.name}>
2`,this.subs[0].op!==q.Op.EMPTY_MATCH&&(e+=this.subs[0].appendTo()),e+=")";break;case q.Op.BEGIN_TEXT:e+="\\A";break;case q.Op.END_TEXT:0!==(this.flags&E.WAS_DOLLAR)?e+="(?-m:$)":e+="\\z";break;case q.Op.BEGIN_LINE:e+="^";break;case q.Op.END_LINE:e+="$";break;case q.Op.WORD_BOUNDARY:e+="\\b";break;case q.Op.NO_WORD_BOUNDARY:e+="\\B";break;case q.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]===b.MAX_RUNE){e+="^";for(let t=1;t<this.runes.length-1;t+=2){const n=this.runes[t]+1,r=this.runes[t+1]-1;e+=q.quoteIfHyphen(n),e+=S.escapeRune(n),n!==r&&(e+="-",e+=q.quoteIfHyphen(r),e+=S.escapeRune(r))}}else for(let t=0;t<this.runes.length;t+=2){const n=this.runes[t],r=this.runes[t+1];e+=q.quoteIfHyphen(n),e+=S.escapeRune(n),n!==r&&(e+="-",e+=q.quoteIfHyphen(r),e+=S.escapeRune(r))}e+="]";break;default:e+=this.op}return e}maxCap(){let e=0;if(this.op===q.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 q))return!1;if(this.op!==e.op)return!1;switch(this.op){case q.Op.END_TEXT:if((this.flags&E.WAS_DOLLAR)!==(e.flags&E.WAS_DOLLAR))return!1;break;case q.Op.LITERAL:case q.Op.CHAR_CLASS:if(null===this.runes&&null===e.runes)break;if(null===this.runes||null===e.runes)return!1;if(this.runes.length!==e.runes.length)return!1;for(let t=0;t<this.runes.length;t++)if(this.runes[t]!==e.runes[t])return!1;break;case q.Op.ALTERNATE:case q.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 q.Op.STAR:case q.Op.PLUS:case q.Op.QUEST:if((this.flags&E.NON_GREEDY)!==(e.flags&E.NON_GREEDY)||!this.subs[0].equals(e.subs[0]))return!1;break;case q.Op.REPEAT:if((this.flags&E.NON_GREEDY)!==(e.flags&E.NON_GREEDY)||this.min!==e.min||this.max!==e.max||!this.subs[0].equals(e.subs[0]))return!1;break;case q.Op.CAPTURE:if(this.cap!==e.cap||(null===this.name?null!==e.name:this.name!==e.name)||!this.subs[0].equals(e.subs[0]))return!1}return!0}}class z{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(e){return z.RUNE<=e&&e<=z.RUNE_ANY_NOT_NL}static escapeRunes(e){let t='"';for(let n of e)t+=S.escapeRune(n);return t+='"',t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=null}matchRune(e){if(1===this.runes.length){const t=this.runes[0];return 0!==(this.arg&E.FOLD_CASE)?b.equalsIgnoreCase(t,e):e===t}for(let t=0;t<this.runes.length&&t<=8;t+=2){if(e<this.runes[t])return!1;if(e<=this.runes[t+1])return!0}let t=0,n=this.runes.length/2|0;for(;t<n;){const r=t+((n-t)/2|0);if(this.runes[2*r]<=e){if(e<=this.runes[2*r+1])return!0;t=r+1}else n=r}return!1}toString(){switch(this.op){case z.ALT:return`alt -> ${this.out}, ${this.arg}`;case z.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case z.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case z.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case z.MATCH:return"match";case z.FAIL:return"fail";case z.NOP:return`nop -> ${this.out}`;case z.RUNE:return null===this.runes?"rune <null>":["rune ",z.escapeRunes(this.runes),0!==(this.arg&E.FOLD_CASE)?"/i":""," -> ",this.out].join("");case z.RUNE1:return`rune1 ${z.escapeRunes(this.runes)} -> ${this.out}`;case z.RUNE_ANY:return`any -> ${this.out}`;case z.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}}class j{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new z(e))}skipNop(e){let t=this.inst[e];for(;t.op===z.NOP||t.op===z.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e="",t=this.skipNop(this.start);if(!z.isRuneOp(t.op)||1!==t.runes.length)return[t.op===z.MATCH,e];for(;z.isRuneOp(t.op)&&1===t.runes.length&&0===(t.arg&E.FOLD_CASE);)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===z.MATCH,e]}startCond(){let e=0,t=this.start;e:for(;;){const n=this.inst[t];switch(n.op){case z.EMPTY_WIDTH:e|=n.arg;break;case z.FAIL:return-1;case z.CAPTURE:case z.NOP:break;default:break e}t=n.out}return e}next(e){const t=this.inst[e>>1];return 1&e?t.arg:t.out}patch(e,t){for(;0!==e;){const n=this.inst[e>>1];1&e?(e=n.arg,n.arg=t):(e=n.out,n.out=t)}}append(e,t){if(0===e)return t;if(0===t)return e;let n=e;for(;;){const e=this.next(n);if(0===e)break;n=e}const r=this.inst[n>>1];return 1&n?r.arg=t:r.out=t,e}toString(){let e="";for(let t=0;t<this.inst.length;t++){const n=e.length;e+=t,t===this.start&&(e+="*"),e+=" ".substring(e.length-n),e+=this.inst[t],e+="\n"}return e}}class G{constructor(e=0,t=0,n=!1){this.i=e,this.out=t,this.nullable=n}}class ${static ANY_RUNE_NOT_NL(){return[0,I.CODES.get("\n")-1,I.CODES.get("\n")+1,b.MAX_RUNE]}static ANY_RUNE(){return[0,b.MAX_RUNE]}static compileRegexp(e){const t=new $,n=t.compile(e);return t.prog.patch(n.out,t.newInst(z.MATCH).i),t.prog.start=n.i,t.prog}constructor(){this.prog=new j,this.newInst(z.FAIL)}newInst(e){return this.prog.addInst(e),new G(this.prog.numInst()-1,0,!0)}nop(){const e=this.newInst(z.NOP);return e.out=e.i<<1,e}fail(){return new G}cap(e){const t=this.newInst(z.CAPTURE);return t.out=t.i<<1,this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return 0===e.i||0===t.i?this.fail():(this.prog.patch(e.out,t.i),new G(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(0===e.i)return t;if(0===t.i)return e;const n=this.newInst(z.ALT),r=this.prog.getInst(n.i);return r.out=e.i,r.arg=t.i,n.out=this.prog.append(e.out,t.out),n.nullable=e.nullable||t.nullable,n}loop(e,t){const n=this.newInst(z.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),this.prog.patch(e.out,n.i),n}quest(e,t){const n=this.newInst(z.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),n.out=this.prog.append(n.out,e.out),n}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new G(e.i,this.loop(e,t).out,e.nullable)}empty(e){const t=this.newInst(z.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=t.i<<1,t}rune(e,t){const n=this.newInst(z.RUNE);n.nullable=!1;const r=this.prog.getInst(n.i);return r.runes=e,t&=E.FOLD_CASE,1===e.length&&b.simpleFold(e[0])!==e[0]||(t&=~E.FOLD_CASE),r.arg=t,n.out=n.i<<1,0===(t&E.FOLD_CASE)&&1===e.length||2===e.length&&e[0]===e[1]?r.op=z.RUNE1:2===e.length&&0===e[0]&&e[1]===b.MAX_RUNE?r.op=z.RUNE_ANY:4===e.length&&0===e[0]&&e[1]===I.CODES.get("\n")-1&&e[2]===I.CODES.get("\n")+1&&e[3]===b.MAX_RUNE&&(r.op=z.RUNE_ANY_NOT_NL),n}compile(e){switch(e.op){case q.Op.NO_MATCH:return this.fail();case q.Op.EMPTY_MATCH:return this.nop();case q.Op.LITERAL:if(0===e.runes.length)return this.nop();{let t=null;for(let n of e.runes){const r=this.rune([n],e.flags);t=null===t?r:this.cat(t,r)}return t}case q.Op.CHAR_CLASS:return this.rune(e.runes,e.flags);case q.Op.ANY_CHAR_NOT_NL:return this.rune($.ANY_RUNE_NOT_NL(),0);case q.Op.ANY_CHAR:return this.rune($.ANY_RUNE(),0);case q.Op.BEGIN_LINE:return this.empty(S.EMPTY_BEGIN_LINE);case q.Op.END_LINE:return this.empty(S.EMPTY_END_LINE);case q.Op.BEGIN_TEXT:return this.empty(S.EMPTY_BEGIN_TEXT);case q.Op.END_TEXT:return this.empty(S.EMPTY_END_TEXT);case q.Op.WORD_BOUNDARY:return this.empty(S.EMPTY_WORD_BOUNDARY);case q.Op.NO_WORD_BOUNDARY:return this.empty(S.EMPTY_NO_WORD_BOUNDARY);case q.Op.CAPTURE:{const t=this.cap(e.cap<<1),n=this.compile(e.subs[0]),r
2=this.cap(e.cap<<1|1);return this.cat(this.cat(t,n),r)}case q.Op.STAR:return this.star(this.compile(e.subs[0]),0!==(e.flags&E.NON_GREEDY));case q.Op.PLUS:return this.plus(this.compile(e.subs[0]),0!==(e.flags&E.NON_GREEDY));case q.Op.QUEST:return this.quest(this.compile(e.subs[0]),0!==(e.flags&E.NON_GREEDY));case q.Op.CONCAT:if(0===e.subs.length)return this.nop();{let t=null;for(let n of e.subs){const e=this.compile(n);t=null===t?e:this.cat(t,e)}return t}case q.Op.ALTERNATE:if(0===e.subs.length)return this.nop();{let t=null;for(let n of e.subs){const e=this.compile(n);t=null===t?e:this.alt(t,e)}return t}default:throw new x("regexp: unhandled case in compile")}}}class H{static simplify(e){if(null===e)return null;switch(e.op){case q.Op.CAPTURE:case q.Op.CONCAT:case q.Op.ALTERNATE:{let t=e;for(let n=0;n<e.subs.length;n++){const r=e.subs[n],s=H.simplify(r);t===e&&s!==r&&(t=q.fromRegexp(e),t.runes=null,t.subs=e.subs.slice(0,e.subs.length)),t!==e&&(t.subs[n]=s)}return t}case q.Op.STAR:case q.Op.PLUS:case q.Op.QUEST:{const t=H.simplify(e.subs[0]);return H.simplify1(e.op,e.flags,t,e)}case q.Op.REPEAT:{if(0===e.min&&0===e.max)return new q(q.Op.EMPTY_MATCH);const t=H.simplify(e.subs[0]);if(-1===e.max){if(0===e.min)return H.simplify1(q.Op.STAR,e.flags,t,null);if(1===e.min)return H.simplify1(q.Op.PLUS,e.flags,t,null);const n=new q(q.Op.CONCAT),r=[];for(let n=0;n<e.min-1;n++)r.push(t);return r.push(H.simplify1(q.Op.PLUS,e.flags,t,null)),n.subs=r.slice(0),n}if(1===e.min&&1===e.max)return t;let n=null;if(e.min>0){n=[];for(let r=0;r<e.min;r++)n.push(t)}if(e.max>e.min){let r=H.simplify1(q.Op.QUEST,e.flags,t,null);for(let n=e.min+1;n<e.max;n++){const n=new q(q.Op.CONCAT);n.subs=[t,r],r=H.simplify1(q.Op.QUEST,e.flags,n,null)}if(null===n)return r;n.push(r)}if(null!==n){const e=new q(q.Op.CONCAT);return e.subs=n.slice(0),e}return new q(q.Op.NO_MATCH)}}return e}static simplify1(e,t,n,r){return n.op===q.Op.EMPTY_MATCH||e===n.op&&(t&E.NON_GREEDY)===(n.flags&E.NON_GREEDY)?n:(null!==r&&r.op===e&&(r.flags&E.NON_GREEDY)===(t&E.NON_GREEDY)&&n===r.subs[0]||((r=new q(e)).flags=t,r.subs=[n]),r)}}class K{constructor(e,t){this.sign=e,this.cls=t}}const W=[48,57],Y=[9,10,12,13,32,32],Q=[48,57,65,90,95,95,97,122],J=new Map([["\\d",new K(1,W)],["\\D",new K(-1,W)],["\\s",new K(1,Y)],["\\S",new K(-1,Y)],["\\w",new K(1,Q)],["\\W",new K(-1,Q)]]),X=[48,57,65,90,97,122],Z=[65,90,97,122],ee=[0,127],te=[9,9,32,32],ne=[0,31,127,127],re=[48,57],se=[33,126],ie=[97,122],ae=[32,126],oe=[33,47,58,64,91,96,123,126],ce=[9,13,32,32],ue=[65,90],le=[48,57,65,90,95,95,97,122],he=[48,57,65,70,97,102],de=new Map([["[:alnum:]",new K(1,X)],["[:^alnum:]",new K(-1,X)],["[:alpha:]",new K(1,Z)],["[:^alpha:]",new K(-1,Z)],["[:ascii:]",new K(1,ee)],["[:^ascii:]",new K(-1,ee)],["[:blank:]",new K(1,te)],["[:^blank:]",new K(-1,te)],["[:cntrl:]",new K(1,ne)],["[:^cntrl:]",new K(-1,ne)],["[:digit:]",new K(1,re)],["[:^digit:]",new K(-1,re)],["[:graph:]",new K(1,se)],["[:^graph:]",new K(-1,se)],["[:lower:]",new K(1,ie)],["[:^lower:]",new K(-1,ie)],["[:print:]",new K(1,ae)],["[:^print:]",new K(-1,ae)],["[:punct:]",new K(1,oe)],["[:^punct:]",new K(-1,oe)],["[:space:]",new K(1,ce)],["[:^space:]",new K(-1,ce)],["[:upper:]",new K(1,ue)],["[:^upper:]",new K(-1,ue)],["[:word:]",new K(1,le)],["[:^word:]",new K(-1,le)],["[:xdigit:]",new K(1,he)],["[:^xdigit:]",new K(-1,he)]]);class fe{static charClassToString(e,t){let n="[";for(let r=0;r<t;r+=2){r>0&&(n+=" ");const t=e[r],s=e[r+1];n+=t===s?`0x${t.toString(16)}`:`0x${t.toString(16)}-0x${s.toString(16)}`}return n+="]",n}static cmp(e,t,n,r){const s=e[t]-n;return 0!==s?s:r-e[t+1]}static qsortIntPair(e,t,n){const r=(t+n)/2&-2,s=e[r],i=e[r+1];let a=t,o=n;for(;a<=o;){for(;a<n&&fe.cmp(e,a,s,i)<0;)a+=2;for(;o>t&&fe.cmp(e,o,s,i)>0;)o-=2;if(a<=o){if(a!==o){let t=e[a];e[a]=e[o],e[o]=t,t=e[a+1],e[a+1]=e[o+1],e[o+1]=t}a+=2,o-=2}}t<o&&fe.qsortIntPair(e,t,o),a<n&&fe.qsortIntPair(e,a,n)}constructor(e=S.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;fe.qsortIntPair(this.r,0,this.len-2);let e=2;for(let t=2;t<this.len;t+=2){const n=this.r[t],r=this.r[t+1];if(n<=this.r[e-1]+1){r>this.r[e-1]&&(this.r[e-1]=r);continue}this.r[e]=n,this.r[e+1]=r,e+=2}return this.len=e,this}appendLiteral(e,t){return 0!==(t&E.FOLD_CASE)?this.appendFoldedRange(e,e):this.appendRange(e,e)}appendRange(e,t){if(this.len>0)for(let n=2;n<=4;n+=2)if(this.len>=n){const r=this.r[this.len-n],s=this.r[this.len-n+1];if(e<=s+1&&r<=t+1)return e<r&&(this.r[this.len-n]=e),t>s&&(this.r[this.len-n+1]=t),this}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=b.MIN_FOLD&&t>=b.MAX_FOLD)return this.appendRange(e,t);if(t<b.MIN_FOLD||e>b.MAX_FOLD)return this.appendRange(e,t);e<b.MIN_FOLD&&(this.appendRange(e,b.MIN_FOLD-1),e=b.MIN_FOLD),t>b.MAX_FOLD&&(this.appendRange(b.MAX_FOLD+1,t),t=b.MAX_FOLD);for(let n=e;n<=t;n++){this.appendRange(n,n);for(let e=b.simpleFold(n);e!==n;e=b.simpleFold(e))this.appendRange(e,e)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let n=0;n<e.length;n+=2){const r=e[n],s=e[n+1];t<=r-1&&this.appendRange(t,r-1),t=s+1}return t<=b.MAX_RUNE&&this.appendRange(t,b.MAX_RUNE),this}appendTable(e){for(let t of e){const e=t[0],n=t[1],r=t[2];if(1!==r)for(let t=e;t<=n;t+=r)this.appendRange(t,t);else this.appendRange(e,n)}return this}appendNegatedTable(e){let t=0;for(let n of e){const e=n[0],r=n[1],s=n[2];if(1!==s)for(let n=e;n<=r;n+=s)t<=n-1&&this.appendRange(t,n-1),t=n+1;else t<=e-1&&this.appendRange(t,e-1),t=r+1}return t<=b.MAX_RUNE&&this.appendRange(t,b.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let n=0;n<this.len;n+=2){const r=this.r[n],s=this.r[n+1];
vendor: 4,574 bytes, line 2
2e<=r-1&&(this.r[t]=e,this.r[t+1]=r-1,t+=2),e=s+1}return this.len=t,e<=b.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=b.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(e,t){let n=e.cls;return t&&(n=(new fe).appendFoldedClass(n).cleanClass().toArray()),this.appendClassWithSign(n,e.sign)}toString(){return fe.charClassToString(this.r,this.len)}}class pe{static of(e,t){return new pe(e,t)}constructor(e,t){this.first=e,this.second=t}}class me{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){const e=this.str.codePointAt(this.position);return this.position+=S.charCount(e),e}lookingAt(e){return this.rest().startsWith(e)}rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}}class ge{static ERR_INTERNAL_ERROR="regexp/syntax: internal error";static ERR_INVALID_CHAR_RANGE="invalid character class range";static ERR_INVALID_ESCAPE="invalid escape sequence";static ERR_INVALID_NAMED_CAPTURE="invalid named capture";static ERR_INVALID_PERL_OP="invalid or unsupported Perl syntax";static ERR_INVALID_REPEAT_OP="invalid nested repetition operator";static ERR_INVALID_REPEAT_SIZE="invalid repeat count";static ERR_MISSING_BRACKET="missing closing ]";static ERR_MISSING_PAREN="missing closing )";static ERR_MISSING_REPEAT_ARGUMENT="missing argument to repetition operator";static ERR_TRAILING_BACKSLASH="trailing backslash at end of expression";static ERR_DUPLICATE_NAMED_CAPTURE="duplicate capture group name";static ANY_TABLE(){return[[0,b.MAX_RUNE,1]]}static unicodeTable(e){return"Any"===e?pe.of(ge.ANY_TABLE(),ge.ANY_TABLE()):T.CATEGORIES.has(e)?pe.of(T.CATEGORIES.get(e),T.FOLD_CATEGORIES.get(e)):T.SCRIPTS.has(e)?pe.of(T.SCRIPTS.get(e),T.FOLD_SCRIPT.get(e)):null}static minFoldRune(e){if(e<b.MIN_FOLD||e>b.MAX_FOLD)return e;let t=e;const n=e;for(e=b.simpleFold(e);e!==n;e=b.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===q.Op.EMPTY_MATCH)return null;if(e.op===q.Op.CONCAT&&e.subs.length>0){const t=e.subs[0];return t.op===q.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){const n=new q(q.Op.LITERAL);return n.flags=t,n.runes=S.stringToRunes(e),n}static parse(e,t){return new ge(e,t).parseInternal()}static parseRepeat(e){const t=e.pos();if(!e.more()||!e.lookingAt("{"))return-1;e.skip(1);const n=ge.parseInt(e);if(-1===n)return-1;if(!e.more())return-1;let r;if(e.lookingAt(",")){if(e.skip(1),!e.more())return-1;if(e.lookingAt("}"))r=-1;else if(-1===(r=ge.parseInt(e)))return-1}else r=n;if(!e.more()||!e.lookingAt("}"))return-1;if(e.skip(1),n<0||n>1e3||-2===r||r>1e3||r>=0&&n>r)throw new k(ge.ERR_INVALID_REPEAT_SIZE,e.from(t));return n<<16|r&b.MAX_BMP}static isValidCaptureName(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++){const n=e.codePointAt(t);if(n!==I.CODES.get("_")&&!S.isalnum(n))return!1}return!0}static parseInt(e){const t=e.pos();for(;e.more()&&e.peek()>=I.CODES.get("0")&&e.peek()<=I.CODES.get("9");)e.skip(1);const n=e.from(t);return 0===n.length||n.length>1&&n.codePointAt(0)===I.CODES.get("0")?-1:n.length>8?-2:parseFloat(n,10)}static isCharClass(e){return e.op===q.Op.LITERAL&&1===e.runes.length||e.op===q.Op.CHAR_CLASS||e.op===q.Op.ANY_CHAR_NOT_NL||e.op===q.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case q.Op.LITERAL:return 1===e.runes.length&&e.runes[0]===t;case q.Op.CHAR_CLASS:for(let n=0;n<e.runes.length;n+=2)if(e.runes[n]<=t&&t<=e.runes[n+1])return!0;return!1;case q.Op.ANY_CHAR_NOT_NL:return t!==I.CODES.get("\n");case q.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(e,t){switch(e.op){case q.Op.ANY_CHAR:break;case q.Op.ANY_CHAR_NOT_NL:ge.matchRune(t,I.CODES.get("\n"))&&(e.op=q.Op.ANY_CHAR);break;case q.Op.CHAR_CLASS:t.op===q.Op.LITERAL?e.runes=new fe(e.runes).appendLiteral(t.runes[0],t.flags).toArray():e.runes=new fe(e.runes).appendClass(t.runes).toArray();break;case q.Op.LITERAL:if(t.runes[0]===e.runes[0]&&t.flags===e.flags)break;e.op=q.Op.CHAR_CLASS,e.runes=(new fe).appendLiteral(e.runes[0],e.flags).appendLiteral(t.runes[0],t.flags).toArray()}}static parseEscape(e){const t=e.pos();if(e.skip(1),!e.more())throw new k(ge.ERR_TRAILING_BACKSLASH);let n=e.pop();e:switch(n){case I.CODES.get("1"):case I.CODES.get("2"):case I.CODES.get("3"):case I.CODES.get("4"):case I.CODES.get("5"):case I.CODES.get("6"):case I.CODES.get("7"):if(!e.more(
2)||e.peek()<I.CODES.get("0")||e.peek()>I.CODES.get("7"))break;case I.CODES.get("0"):{let t=n-I.CODES.get("0");for(let n=1;n<3&&!(!e.more()||e.peek()<I.CODES.get("0")||e.peek()>I.CODES.get("7"));n++)t=8*t+e.peek()-I.CODES.get("0"),e.skip(1);return t}case I.CODES.get("x"):{if(!e.more())break;if(n=e.pop(),n===I.CODES.get("{")){let t=0,r=0;for(;;){if(!e.more())break e;if(n=e.pop(),n===I.CODES.get("}"))break;const s=S.unhex(n);if(s<0)break e;if(r=16*r+s,r>b.MAX_RUNE)break e;t++}if(0===t)break e;return r}const t=S.unhex(n);if(!e.more())break;n=e.pop();const r=S.unhex(n);if(t<0||r<0)break;return 16*t+r}case I.CODES.get("a"):return I.CODES.get("�");case I.CODES.get("f"):return I.CODES.get("\f");case I.CODES.get("n"):return I.CODES.get("\n");case I.CODES.get("r"):return I.CODES.get("\r");case I.CODES.get("t"):return I.CODES.get("\t");case I.CODES.get("v"):return I.CODES.get("\v");default:if(!S.isalnum(n))return n}throw new k(ge.ERR_INVALID_ESCAPE,e.from(t))}static parseClassChar(e,t){if(!e.more())throw new k(ge.ERR_MISSING_BRACKET,e.from(t));return e.lookingAt("\\")?ge.parseEscape(e):e.pop()}static concatRunes(e,t){return[...e,...t]}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null}newRegexp(e){let t=this.free;return null!==t&&null!==t.subs&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):t=new q(e),t}reuse(e){null!==e.subs&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}pop(){return this.stack.pop()}popToPseudo(){const e=this.stack.length;let t=e;for(;t>0&&!q.isPseudoOp(this.stack[t-1].op);)t--;const n=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),n}push(e){if(e.op===q.Op.CHAR_CLASS&&2===e.runes.length&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],this.flags&~E.FOLD_CASE))return null;e.op=q.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags&~E.FOLD_CASE}else if(e.op===q.Op.CHAR_CLASS&&4===e.runes.length&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&b.simpleFold(e.runes[0])===e.runes[2]&&b.simpleFold(e.runes[2])===e.runes[0]||e.op===q.Op.CHAR_CLASS&&2===e.runes.length&&e.runes[0]+1===e.runes[1]&&b.simpleFold(e.runes[0])===e.runes[1]&&b.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|E.FOLD_CASE))return null;e.op=q.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|E.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),e}maybeConcat(e,t){const n=this.stack.length;if(n<2)return!1;const r=this.stack[n-1],s=this.stack[n-2];return r.op===q.Op.LITERAL&&s.op===q.Op.LITERAL&&(r.flags&E.FOLD_CASE)===(s.flags&E.FOLD_CASE)&&(s.runes=ge.concatRunes(s.runes,r.runes),e>=0?(r.runes=[e],r.flags=t,!0):(this.pop(),this.reuse(r),!1))}newLiteral(e,t){const n=this.newRegexp(q.Op.LITERAL);return n.flags=t,0!==(t&E.FOLD_CASE)&&(e=ge.minFoldRune(e)),n.runes=[e],n}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){const t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(e,t,n,r,s,i){let a=this.flags;if(0!==(a&E.PERL_X)&&(s.more()&&s.lookingAt("?")&&(s.skip(1),a^=E.NON_GREEDY),-1!==i))throw new k(ge.ERR_INVALID_REPEAT_OP,s.from(i));const o=this.stack.length;if(0===o)throw new k(ge.ERR_MISSING_REPEAT_ARGUMENT,s.from(r));const c=this.stack[o-1];if(q.isPseudoOp(c.op))throw new k(ge.ERR_MISSING_REPEAT_ARGUMENT,s.from(r));const u=this.newRegexp(e);u.min=t,u.max=n,u.flags=a,u.subs=[c],this.stack[o-1]=u}concat(){this.maybeConcat(-1,0);const e=this.popToPseudo();return 0===e.length?this.push(this.newRegexp(q.Op.EMPTY_MATCH)):this.push(this.collapse(e,q.Op.CONCAT))}alternate(){const e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),0===e.length?this.push(this.newRegexp(q.Op.NO_MATCH)):this.push(this.collapse(e,q.Op.ALTERNATE))}cleanAlt(e){e.op===q.Op.CHAR_CLASS&&(e.runes=new fe(e.runes).cleanClass().toArray(),2===e.runes.length&&0===e.runes[0]&&e.runes[1]===b.MAX_RUNE?(e.runes=null,e.op=q.Op.ANY_CHAR):4===e.runes.length&&0===e.runes[0]&&e.runes[1]===I.CODES.get("\n")-1&&e.runes[2]===I.CODES.get("\n")+1&&e.runes[3]===b.MAX_RUNE&&(e.runes=null,e.op=q.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(1===e.length)return e[0];let n=0;for(let r of e)n+=r.op===t?r.subs.length:1;let r=new Array(n).fill(null),s=0;for(let n of e)n.op===t?(r.splice(s,n.subs.length,...n.subs),s+=n.subs.length,this.reuse(n)):r[s++]=n;let i=this.newRegexp(t);if(i.subs=r,t===q.Op.ALTERNATE&&(i.subs=this.factor(i.subs),1===i.subs.length)){const e=i;
vendor: 4,340 bytes, line 2
2i=i.subs[0],this.reuse(e)}return i}factor(e){if(e.length<2)return e;let t=0,n=e.length,r=0,s=null,i=0,a=0,o=0;for(let c=0;c<=n;c++){let u=null,l=0,h=0;if(c<n){let n=e[t+c];if(n.op===q.Op.CONCAT&&n.subs.length>0&&(n=n.subs[0]),n.op===q.Op.LITERAL&&(u=n.runes,l=n.runes.length,h=n.flags&E.FOLD_CASE),h===a){let e=0;for(;e<i&&e<l&&s[e]===u[e];)e++;if(e>0){i=e;continue}}}if(c===o);else if(c===o+1)e[r++]=e[t+o];else{const n=this.newRegexp(q.Op.LITERAL);n.flags=a,n.runes=s.slice(0,i);for(let n=o;n<c;n++)e[t+n]=this.removeLeadingString(e[t+n],i);const u=this.collapse(e.slice(t+o,t+c),q.Op.ALTERNATE),l=this.newRegexp(q.Op.CONCAT);l.subs=[n,u],e[r++]=l}o=c,s=u,i=l,a=h}n=r,t=0,o=0,r=0;let c=null;for(let s=0;s<=n;s++){let i=null;if(!(s<n&&(i=ge.leadingRegexp(e[t+s]),null!==c&&c.equals(i)&&(ge.isCharClass(c)||c.op===q.Op.REPEAT&&c.min===c.max&&ge.isCharClass(c.subs[0]))))){if(s===o);else if(s===o+1)e[r++]=e[t+o];else{const n=c;for(let n=o;n<s;n++){const r=n!==o;e[t+n]=this.removeLeadingRegexp(e[t+n],r)}const i=this.collapse(e.slice(t+o,t+s),q.Op.ALTERNATE),a=this.newRegexp(q.Op.CONCAT);a.subs=[n,i],e[r++]=a}o=s,c=i}}n=r,t=0,o=0,r=0;for(let s=0;s<=n;s++)if(!(s<n&&ge.isCharClass(e[t+s]))){if(s===o);else if(s===o+1)e[r++]=e[t+o];else{let n=o;for(let r=o+1;r<s;r++){const s=e[t+n],i=e[t+r];(s.op<i.op||s.op===i.op&&(null!==s.runes?s.runes.length:0)<(null!==i.runes?i.runes.length:0))&&(n=r)}const i=e[t+o];e[t+o]=e[t+n],e[t+n]=i;for(let n=o+1;n<s;n++)ge.mergeCharClass(e[t+o],e[t+n]),this.reuse(e[t+n]);this.cleanAlt(e[t+o]),e[r++]=e[t+o]}s<n&&(e[r++]=e[t+s]),o=s+1}n=r,t=0,o=0,r=0;for(let s=0;s<n;++s)s+1<n&&e[t+s].op===q.Op.EMPTY_MATCH&&e[t+s+1].op===q.Op.EMPTY_MATCH||(e[r++]=e[t+s]);return n=r,t=0,e.slice(t,n)}removeLeadingString(e,t){if(e.op===q.Op.CONCAT&&e.subs.length>0){const n=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=n,n.op===q.Op.EMPTY_MATCH)switch(this.reuse(n),e.subs.length){case 0:case 1:e.op=q.Op.EMPTY_MATCH,e.subs=null;break;case 2:{const t=e;e=e.subs[1],this.reuse(t);break}default:e.subs=e.subs.slice(1,e.subs.length)}return e}return e.op===q.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),0===e.runes.length&&(e.op=q.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===q.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:e.op=q.Op.EMPTY_MATCH,e.subs=q.emptySubs();break;case 1:{const t=e;e=e.subs[0],this.reuse(t);break}}return e}return t&&this.reuse(e),this.newRegexp(q.Op.EMPTY_MATCH)}parseInternal(){if(0!==(this.flags&E.LITERAL))return ge.literalRegexp(this.wholeRegexp,this.flags);let e=-1,t=-1,n=-1;const r=new me(this.wholeRegexp);for(;r.more();){let s=-1;e:switch(r.peek()){case I.CODES.get("("):if(0!==(this.flags&E.PERL_X)&&r.lookingAt("(?")){this.parsePerlFlags(r);break}this.op(q.Op.LEFT_PAREN).cap=++this.numCap,r.skip(1);break;case I.CODES.get("|"):this.parseVerticalBar(),r.skip(1);break;case I.CODES.get(")"):this.parseRightParen(),r.skip(1);break;case I.CODES.get("^"):0!==(this.flags&E.ONE_LINE)?this.op(q.Op.BEGIN_TEXT):this.op(q.Op.BEGIN_LINE),r.skip(1);break;case I.CODES.get("$"):0!==(this.flags&E.ONE_LINE)?this.op(q.Op.END_TEXT).flags|=E.WAS_DOLLAR:this.op(q.Op.END_LINE),r.skip(1);break;case I.CODES.get("."):0!==(this.flags&E.DOT_NL)?this.op(q.Op.ANY_CHAR):this.op(q.Op.ANY_CHAR_NOT_NL),r.skip(1);break;case I.CODES.get("["):this.parseClass(r);break;case I.CODES.get("*"):case I.CODES.get("+"):case I.CODES.get("?"):{s=r.pos();let i=null;switch(r.pop()){case I.CODES.get("*"):i=q.Op.STAR;break;case I.CODES.get("+"):i=q.Op.PLUS;break;case I.CODES.get("?"):i=q.Op.QUEST}this.repeat(i,t,n,s,r,e);break}case I.CODES.get("{"):{s=r.pos();const i=ge.parseRepeat(r);if(i<0){r.rewindTo(s),this.literal(r.pop());break}t=i>>16,n=(i&b.MAX_BMP)<<16>>16,this.repeat(q.Op.REPEAT,t,n,s,r,e);break}case I.CODES.get("\\"):{const e=r.pos();if(r.skip(1),0!==(this.flags&E.PERL_X)&&r.more()){switch(r.pop()){case I.CODES.get("A"):this.op(q.Op.BEGIN_TEXT);break e;case I.CODES.get("b"):this.op(q.Op.WORD_BOUNDARY);break e;case I.CODES.get("B"):this.op(q.Op.NO_WORD_BOUNDARY);break e;case I.CODES.get("C"):throw new k(ge.ERR_INVALID_ESCAPE,"\\C");case I.CODES.get("Q"):{let e=r.rest();const t=e.indexOf("\\E");t>=0&&(e=e.substring(0,t)),r.skipString(e),r.skipString("\\E");let n=0;for(;n<e.length;){const t=e.codePointAt(n);
2this.literal(t),n+=S.charCount(t)}break e}case I.CODES.get("z"):this.op(q.Op.END_TEXT);break e;default:r.rewindTo(e)}}const t=this.newRegexp(q.Op.CHAR_CLASS);if(t.flags=this.flags,r.lookingAt("\\p")||r.lookingAt("\\P")){const e=new fe;if(this.parseUnicodeClass(r,e)){t.runes=e.toArray(),this.push(t);break e}}const n=new fe;if(this.parsePerlClassEscape(r,n)){t.runes=n.toArray(),this.push(t);break e}r.rewindTo(e),this.reuse(t),this.literal(ge.parseEscape(r));break}default:this.literal(r.pop())}e=s}this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate();if(1!==this.stack.length)throw new k(ge.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(e){const t=e.pos(),n=e.rest();if(n.startsWith("(?P<")||n.startsWith("(?<")){const t="P"===n.charAt(2)?4:3,r=n.indexOf(">");if(r<0)throw new k(ge.ERR_INVALID_NAMED_CAPTURE,n);const s=n.substring(t,r);if(e.skipString(s),e.skip(t+1),!ge.isValidCaptureName(s))throw new k(ge.ERR_INVALID_NAMED_CAPTURE,n.substring(0,r+1));const i=this.op(q.Op.LEFT_PAREN);if(i.cap=++this.numCap,this.namedGroups[s])throw new k(ge.ERR_DUPLICATE_NAMED_CAPTURE,s);return this.namedGroups[s]=this.numCap,void(i.name=s)}e.skip(2);let r=this.flags,s=1,i=!1;e:for(;e.more();){const t=e.pop();switch(t){case I.CODES.get("i"):r|=E.FOLD_CASE,i=!0;break;case I.CODES.get("m"):r&=~E.ONE_LINE,i=!0;break;case I.CODES.get("s"):r|=E.DOT_NL,i=!0;break;case I.CODES.get("U"):r|=E.NON_GREEDY,i=!0;break;case I.CODES.get("-"):if(s<0)break e;s=-1,r=~r,i=!1;break;case I.CODES.get(":"):case I.CODES.get(")"):if(s<0){if(!i)break e;r=~r}return t===I.CODES.get(":")&&this.op(q.Op.LEFT_PAREN),void(this.flags=r);default:break e}}throw new k(ge.ERR_INVALID_PERL_OP,e.from(t))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(q.Op.VERTICAL_BAR)}swapVerticalBar(){const e=this.stack.length;if(e>=3&&this.stack[e-2].op===q.Op.VERTICAL_BAR&&ge.isCharClass(this.stack[e-1])&&ge.isCharClass(this.stack[e-3])){let t=this.stack[e-1],n=this.stack[e-3];if(t.op>n.op){const r=n;n=t,t=r,this.stack[e-3]=n}return ge.mergeCharClass(n,t),this.reuse(t),this.pop(),!0}if(e>=2){const t=this.stack[e-1],n=this.stack[e-2];if(n.op===q.Op.VERTICAL_BAR)return e>=3&&this.cleanAlt(this.stack[e-3]),this.stack[e-2]=t,this.stack[e-1]=n,!0}return!1}parseRightParen(){this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate();if(this.stack.length<2)throw new k(ge.ERR_INTERNAL_ERROR,"stack underflow");const e=this.pop(),t=this.pop();if(t.op!==q.Op.LEFT_PAREN)throw new k(ge.ERR_MISSING_PAREN,this.wholeRegexp);this.flags=t.flags,0===t.cap?this.push(e):(t.op=q.Op.CAPTURE,t.subs=[e],this.push(t))}parsePerlClassEscape(e,t){const n=e.pos();if(0===(this.flags&E.PERL_X)||!e.more()||e.pop()!==I.CODES.get("\\")||!e.more())return!1;e.pop();const r=e.from(n),s=J.has(r)?J.get(r):null;return null!==s&&(t.appendGroup(s,0!==(this.flags&E.FOLD_CASE)),!0)}parseNamedClass(e,t){const n=e.rest(),r=n.indexOf(":]");if(r<0)return!1;const s=n.substring(0,r+2);e.skipString(s);const i=de.has(s)?de.get(s):null;if(null===i)throw new k(ge.ERR_INVALID_CHAR_RANGE,s);return t.appendGroup(i,0!==(this.flags&E.FOLD_CASE)),!0}parseUnicodeClass(e,t){const n=e.pos();if(0===(this.flags&E.UNICODE_GROUPS)||!e.lookingAt("\\p")&&!e.lookingAt("\\P"))return!1;e.skip(1);let r,s=1,i=e.pop();if(i===I.CODES.get("P")&&(s=-1),!e.more())throw e.rewindTo(n),new k(ge.ERR_INVALID_CHAR_RANGE,e.rest());if(i=e.pop(),i!==I.CODES.get("{"))r=S.runeToString(i);else{const t=e.rest(),s=t.indexOf("}");if(s<0)throw e.rewindTo(n),new k(ge.ERR_INVALID_CHAR_RANGE,e.rest());r=t.substring(0,s),e.skipString(r),e.skip(1)}0!==r.length&&r.codePointAt(0)===I.CODES.get("^")&&(s=0-s,r=r.substring(1));const a=ge.unicodeTable(r);if(null===a)throw new k(ge.ERR_INVALID_CHAR_RANGE,e.from(n));const o=a.first,c=a.second;if(0===(this.flags&E.FOLD_CASE)||null===c)t.appendTableWithSign(o,s);else{const e=(new fe).appendTable(o).appendTable(c).cleanClass().toArray();t.appendClassWithSign(e,s)}return!0}parseClass(e){const t=e.pos();e.skip(1);const n=this.newRegexp(q.Op.CHAR_CLASS);n.flags=this.flags;const r=new fe;let s=1;e.more()&&e.lookingAt("^")&&(s=-1,e.skip(1),0===(this.flags&E.CLASS_NL)&&r.appendRange(I.CODES.get("\n"),I.CODES.get("\n")));let i=!0;for(;!e.more()||e.peek()!==I.CODES.get("]")||i;){if(e.more()&&e.lookingAt("-")&&0===(this.flags&E.PERL_X)&&!i){const n=e.rest();if("-"===n||!n.startsWith("-]"))throw e.rewindTo(t),new k(ge.ERR_INVALID_CHAR_RANGE,e.rest())}i=!1;const n=e.pos();if(e.lookingAt("[:")){if(this.parseNamedClass(e,r))continue;e.rewindTo(n)}if(this.parseUnicodeClass(e,r))continue;if(this.parsePerlClassEscape(e,r))continue;e.rewindTo(n);const s=ge.parseClassChar(e,t);let a=s;if(e.more()&&e.lookingAt("-"))if(e.skip(1),e.more()&&e.lookingAt("]"))e.skip(-1);else if(a=ge.parseClassChar(e,t),a<s)throw new k(ge.ERR_INVALID_CHAR_RANGE,e.from(n));0===(this.flags&E.FOLD_CASE)?r.appendRange(s,a):r.appendFoldedRange(s,a)}e.skip(1),r.cleanClass(),s<0&&r.negateClass(),n.runes=r.toArray(),this.push(n)}}class ye{constructor(){this.inst=null,this.cap=[]}}class we{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){const t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return 0===this.size}add(e){const t=this.size++;return this.sparse[e]=t,this.denseThreads[t]=null,this.densePcs[t]=e,t}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let e="{";for(let t=0;t<this.size;t++)0!==t&&(e+=", "),e+=this.densePcs[t];return e+="}",e}}class _e{static fromRE2(e){const t=new _e;return t.prog=e.prog,t.re2=e,t.q0=new we(t.prog.numInst()),t.q1=new we(t.prog.numInst()),t.pool=[],t.poolSize=0,t.matched=!1,t.matchcap=Array(t.prog.numCap<2?2:t.prog.numCap).fill(0),t.ncap=0,t}static fromMachine(e){const t=new _e;return t.re2=e.re2,t.prog=e.prog,t.q0=e.q0,t.q1=e.q1,t.pool=e.pool,t.poolSize=e.poolSize,t.matched=e.matched,t.matchcap=e.matchcap,t.ncap=e.ncap,t}init(e){this.ncap=e,e>this.matchcap.length?this.initNewCap(e):this.resetCap(e)}resetCap(e){for(let t=0;t<this.poolSize;t++){this.pool[t].cap=Array(e).fill(0)}}initNewCap(e){for(let t=0;t<this.poolSize;t++){this.pool[t].cap=Array(e).fill(0)}this.matchcap=Array(e).fill(0)}submatches(){return 0===this.ncap?S.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(e){let t;return this.poolSize>0?(this.poolSize--,t=this.pool[this.poolSize]):t=new ye,t.inst=e,t}freeQueue(e,t=0){const n=e.size-t,r=this.poolSize+n;this.pool.length<r&&(this.pool=this.pool.slice(0,Math.max(2*this.pool.length,r)));for(let n=t;n<e.size;n++){const t=e.denseThreads[n];null!==t&&(this.pool[this.poolSize]=t,this.poolSize++)}e.clear()}freeThread(e){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,2*this.pool.length)),this.pool[this.poolSize]=e,this.poolSize++}
2match(e,t,n){const r=this.re2.cond;if(r===S.EMPTY_ALL)return!1;if((n===E.ANCHOR_START||n===E.ANCHOR_BOTH)&&0!==t)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let s,i=this.q0,a=this.q1,o=e.step(t),c=o>>3,u=7&o,l=-1,h=0;for(o!==V.EOF()&&(o=e.step(t+u),l=o>>3,h=7&o),s=0===t?S.emptyOpContext(-1,c):e.context(t);;){if(i.isEmpty()){if(0!==(r&S.EMPTY_BEGIN_TEXT)&&0!==t)break;if(this.matched)break;if(0!==this.re2.prefix.length&&l!==this.re2.prefixRune&&e.canCheckPrefix()){const n=e.index(this.re2,t);if(n<0)break;t+=n,o=e.step(t),c=o>>3,u=7&o,o=e.step(t+u),l=o>>3,h=7&o}}this.matched||0!==t&&n!==E.UNANCHORED||(this.ncap>0&&(this.matchcap[0]=t),this.add(i,this.prog.start,t,this.matchcap,s,null));const d=t+u;if(s=e.context(d),this.step(i,a,t,d,c,s,n,t===e.endPos()),0===u)break;if(0===this.ncap&&this.matched)break;t+=u,c=l,u=h,-1!==c&&(o=e.step(t+u),l=o>>3,h=7&o);const f=i;i=a,a=f}return this.freeQueue(a),this.matched}step(e,t,n,r,s,i,a,o){const c=this.re2.longest;for(let u=0;u<e.size;u++){let l=e.denseThreads[u];if(null===l)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<l.cap[0]){this.freeThread(l);continue}const h=l.inst;let d=!1;switch(h.op){case z.MATCH:if(a===E.ANCHOR_BOTH&&!o)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<n)&&(l.cap[1]=n,this.matchcap=l.cap.slice(0,this.ncap)),c||this.freeQueue(e,u+1),this.matched=!0;break;case z.RUNE:d=h.matchRune(s);break;case z.RUNE1:d=s===h.runes[0];break;case z.RUNE_ANY:d=!0;break;case z.RUNE_ANY_NOT_NL:d=s!==I.CODES.get("\n");break;default:throw new Error("bad inst")}d&&(l=this.add(t,h.out,r,l.cap,i,l)),null!==l&&(this.freeThread(l),e.denseThreads[u]=null)}e.clear()}add(e,t,n,r,s,i){if(0===t)return i;if(e.contains(t))return i;const a=e.add(t),o=this.prog.inst[t];switch(o.op){case z.FAIL:break;case z.ALT:case z.ALT_MATCH:i=this.add(e,o.out,n,r,s,i),i=this.add(e,o.arg,n,r,s,i);break;case z.EMPTY_WIDTH:0===(o.arg&~s)&&(i=this.add(e,o.out,n,r,s,i));break;case z.NOP:i=this.add(e,o.out,n,r,s,i);break;case z.CAPTURE:if(o.arg<this.ncap){const t=r[o.arg];r[o.arg]=n,this.add(e,o.out,n,r,s,null),r[o.arg]=t}else i=this.add(e,o.out,n,r,s,i);break;case z.MATCH:case z.RUNE:case z.RUNE1:case z.RUNE_ANY:case z.RUNE_ANY_NOT_NL:null===i?i=this.alloc(o):i.inst=o,this.ncap>0&&i.cap!==r&&(i.cap=r.slice(0,this.ncap)),e.denseThreads[a]=i,i=null;break;default:throw new Error("unhandled")}return i}}class ve{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}compareAndSet(e,t){return this.value===e&&(this.value=t,!0)}}class Ee{static initTest(e){const t=Ee.compile(e),n=new Ee(t.expr,t.prog,t.numSubexp,t.longest);return n.cond=t.cond,n.prefix=t.prefix,n.prefixUTF8=t.prefixUTF8,n.prefixComplete=t.prefixComplete,n.prefixRune=t.prefixRune,n}static compile(e){return Ee.compileImpl(e,E.PERL,!1)}static compilePOSIX(e){return Ee.compileImpl(e,E.POSIX,!0)}static compileImpl(e,t,n){let r=ge.parse(e,t);const s=r.maxCap();r=H.simplify(r);const i=$.compileRegexp(r),a=new Ee(e,i,s,n),[o,c]=i.prefix();return a.prefixComplete=o,a.prefix=c,a.prefixUTF8=S.stringToUtf8ByteArray(a.prefix),a.prefix.length>0&&(a.prefixRune=a.prefix.codePointAt(0)),a.namedGroups=r.namedGroups,a}static match(e,t){return Ee.compile(e).match(t)}constructor(e,t,n=0,r=0){this.expr=e,this.prog=t,this.numSubexp=n,this.longest=r,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new ve}numberOfCapturingGroups(){return this.numSubexp}get(){let e;do{e=this.pooled.get()}while(e&&!this.pooled.compareAndSet(e,e.next));return e}reset(){this.pooled.set(null)}put(e,t){let n=this.pooled.get();do{n=this.pooled.get(),!t&&n&&(e=_e.fromMachine(e),t=!0),e.next!==n&&(e.next=n)}while(!this.pooled.compareAndSet(n,e))}toString(){return this.expr}doExecute(e,t,n,r){let s=this.get(),i=!1;s?null!==s.next&&(s=_e.fromMachine(s),i=!0):(s=_e.fromRE2(this),i=!0),s.init(r);const a=s.match(e,t,n)?s.submatches():null;return this.put(s,i),a}match(e){return null!==this.doExecute(B.fromUTF16(e),0,E.UNANCHORED,0)}matchWithGroup(e,t,n,r,s){return e instanceof C||(e=D.utf16(e)),this.matchMachineInput(e,t,n,r,s
2)}matchMachineInput(e,t,n,r,s){if(t>n)return[!1,null];const i=e.isUTF16Encoding()?B.fromUTF16(e.asCharSequence(),0,n):B.fromUTF8(e.asBytes(),0,n),a=this.doExecute(i,t,r,2*s);return null===a?[!1,null]:[!0,a]}matchUTF8(e){return null!==this.doExecute(B.fromUTF8(e),0,E.UNANCHORED,0)}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,n){let r=0,s=0,i="";const a=B.fromUTF16(e);let o=0;for(;s<=e.length;){const c=this.doExecute(a,s,E.UNANCHORED,2);if(null===c||0===c.length)break;i+=e.substring(r,c[0]),(c[1]>r||0===c[0])&&(i+=t(e.substring(c[0],c[1])),o++),r=c[1];const u=7&a.step(s);if(s+u>c[1]?s+=u:s+1>c[1]?s++:s=c[1],o>=n)break}return i+=e.substring(r),i}pad(e){if(null===e)return null;let t=2*(1+this.numSubexp);if(e.length<t){let n=new Array(t).fill(-1);for(let t=0;t<e.length;t++)n[t]=e[t];e=n}return e}allMatches(e,t,n=e=>e){let r=[];const s=e.endPos();t<0&&(t=s+1);let i=0,a=0,o=-1;for(;a<t&&i<=s;){const t=this.doExecute(e,i,E.UNANCHORED,this.prog.numCap);if(null===t||0===t.length)break;let c=!0;if(t[1]===i){t[0]===o&&(c=!1);const n=e.step(i);n<0?i=s+1:i+=7&n}else i=t[1];o=t[1],c&&(r.push(n(this.pad(t))),a++)}return r}findUTF8(e){const t=this.doExecute(B.fromUTF8(e),0,E.UNANCHORED,2);return null===t?null:e.slice(t[0],t[1])}findUTF8Index(e){const t=this.doExecute(B.fromUTF8(e),0,E.UNANCHORED,2);return null===t?null:t.slice(0,2)}find(e){const t=this.doExecute(B.fromUTF16(e),0,E.UNANCHORED,2);return null===t?"":e.substring(t[0],t[1])}findIndex(e){return this.doExecute(B.fromUTF16(e),0,E.UNANCHORED,2)}findUTF8Submatch(e){const t=this.doExecute(B.fromUTF8(e),0,E.UNANCHORED,this.prog.numCap);if(null===t)return null;const n=new Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n}findUTF8SubmatchIndex(e){return this.pad(this.doExecute(B.fromUTF8(e),0,E.UNANCHORED,this.prog.numCap))}findSubmatch(e){const t=this.doExecute(B.fromUTF16(e),0,E.UNANCHORED,this.prog.numCap);if(null===t)return null;const n=new Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n}findSubmatchIndex(e){return this.pad(this.doExecute(B.fromUTF16(e),0,E.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){const n=this.allMatches(B.fromUTF8(e),t,t=>e.slice(t[0],t[1]));return 0===n.length?null:n}findAllUTF8Index(e,t){const n=this.allMatches(B.fromUTF8(e),t,e=>e.slice(0,2));return 0===n.length?null:n}findAll(e,t){const n=this.allMatches(B.fromUTF16(e),t,t=>e.substring(t[0],t[1]));return 0===n.length?null:n}findAllIndex(e,t){const n=this.allMatches(B.fromUTF16(e),t,e=>e.slice(0,2));return 0===n.length?null:n}findAllUTF8Submatch(e,t){const n=this.allMatches(B.fromUTF8(e),t,t=>{let n=new Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n});return 0===n.length?null:n}findAllUTF8SubmatchIndex(e,t){const n=this.allMatches(B.fromUTF8(e),t);return 0===n.length?null:n}findAllSubmatch(e,t){const n=this.allMatches(B.fromUTF16(e),t,t=>{let n=new Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n});return 0===n.length?null:n}findAllSubmatchIndex(e,t){const n=this.allMatches(B.fromUTF16(e),t);return 0===n.length?null:n}}class Ie{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(e){return S.quoteMeta(e)}static compile(e,t=0){let n=e;if(0!==(t&Ie.CASE_INSENSITIVE)&&(n=`(?i)${n}`),0!==(t&Ie.DOTALL)&&(n=`(?s)${n}`),0!==(t&Ie.MULTILINE)&&(n=`(?m)${n}`),0!==(t&~(Ie.MULTILINE|Ie.DOTALL|Ie.CASE_INSENSITIVE|Ie.DISABLE_UNICODE_GROUPS|Ie.LONGEST_MATCH)))throw new L("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let r=E.PERL;0!==(t&Ie.DISABLE_UNICODE_GROUPS)&&(r&=~E.UNICODE_GROUPS);const s=new Ie(e,t);return s.re2Input=Ee.compileImpl(n,r,0!==(t&Ie.LONGEST_MATCH)),s}static matches(e,t){return Ie.compile(e).matcher(t).matches()}static initTest(e,t,n){if(null==e)throw new Error("pattern is null");if(null==n)throw new Error("re2 is null");const r=new Ie(e,t);return r.re2Input=n,r}
2constructor(e,t){this.patternInput=e,this.flagsInput=t}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.matcher(e).matches()}matcher(e){return Array.isArray(e)&&(e=D.utf8(e)),new M(this,e)}split(e,t=0){const n=this.matcher(e),r=[];let s=0,i=0;for(;n.find();)if(0!==i||0!==n.end()){if(t>0&&r.length===t-1)break;if(i===n.start()){if(0===t){s+=1,i=n.end();continue}}else for(;s>0;)r.push(""),s-=1;r.push(n.substring(i,n.start())),i=n.end()}else i=n.end();if(0===t&&i!==n.inputLength()){for(;s>0;)r.push(""),s-=1;r.push(n.substring(i,n.inputLength()))}return 0===t&&0!==r.length||r.push(n.substring(i,n.inputLength())),r}toString(){return this.patternInput}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e||null!==e&&this.constructor===e.constructor&&(this.flagsInput===e.flagsInput&&this.patternInput===e.patternInput)}}class Te{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Te.UNAUTHENTICATED=new Te(null),Te.GOOGLE_CREDENTIALS=new Te("google-credentials-uid"),Te.FIRST_PARTY=new Te("first-party-uid"),Te.MOCK_USER=new Te("mock-user");let be="12.15.0";const Se=new w.Vy("@firebase/firestore");function Ae(){return Se.logLevel}function Ce(e){Se.setLogLevel(e)}function Ne(e,...t){if(Se.logLevel<=w.$b.DEBUG){const n=t.map(Re);Se.debug(`Firestore (${be}): ${e}`,...n)}}function Oe(e,...t){if(Se.logLevel<=w.$b.ERROR){const n=t.map(Re);Se.error(`Firestore (${be}): ${e}`,...n)}}function De(e,...t){if(Se.logLevel<=w.$b.WARN){const n=t.map(Re);Se.warn(`Firestore (${be}): ${e}`,...n)}}function Re(e){if("string"==typeof e)return e;try{return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}function ke(e,t,n){let r="Unexpected state";"string"==typeof t?r=t:n=t,xe(e,r,n)}function xe(e,t,n){let r=`FIRESTORE (${be}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==n)try{r+=" CONTEXT: "+JSON.stringify(n)}catch(e){r+=" CONTEXT: "+n}throw Oe(r),new Error(r)}function Pe(e,t,n,r){let s="Unexpected state";"string"==typeof n?s=n:r=n,e||xe(t,s,r)}function Le(e,t){e||ke(57014,t)}function Me(e,t){return e}const Ve={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 Ue extends o.g{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class Fe{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class Be{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class qe{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(Te.UNAUTHENTICATED))}shutdown(){}}class ze{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class je{constructor(e){this.t=e,this.currentUser=Te.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Pe(void 0===this.o,42304);let n=this.i;const r=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let s=new Fe;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Fe,e.enqueueRetryable(()=>r(this.currentUser))};const i=()=>{const t=s;e.enqueueRetryable(async()=>{await t.promise,await r(this.currentUser)})},a=e=>{Ne("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),i())};this.t.onInit(e=>a(e)),setTimeout(()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?a(e):(Ne("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Fe)}}
2,0),i()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(Ne("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(Pe("string"==typeof t.accessToken,31837,{l:t}),new Be(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Pe(null===e||"string"==typeof e,2055,{h:e}),new Te(e)}}class Ge{constructor(e,t,n){this.T=e,this.P=t,this.R=n,this.type="FirstParty",this.user=Te.FIRST_PARTY,this.I=new Map}A(){return this.R?this.R():null}get headers(){this.I.set("X-Goog-AuthUser",this.T);const e=this.A();return e&&this.I.set("Authorization",e),this.P&&this.I.set("X-Goog-Iam-Authorization-Token",this.P),this.I}}class $e{constructor(e,t,n){this.T=e,this.P=t,this.R=n}getToken(){return Promise.resolve(new Ge(this.T,this.P,this.R))}start(e,t){e.enqueueRetryable(()=>t(Te.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class He{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Ke{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,(0,i.xZ)(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){Pe(void 0===this.o,3512);const n=e=>{null!=e.error&&Ne("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);const n=e.token!==this.m;return this.m=e.token,Ne("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};const r=e=>{Ne("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(e=>r(e)),setTimeout(()=>{if(!this.appCheck){const e=this.V.getImmediate({optional:!0});e?r(e):Ne("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new He(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(Pe("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new He(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}class We{getToken(){return Promise.resolve(new He(""))}invalidateToken(){}start(e,t){}shutdown(){}}function Ye(e){const t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}class Qe{static newId(){const e=62*Math.floor(256/62);let t="";for(;t.length<20;){const n=Ye(40);for(let r=0;r<n.length;++r)t.length<20&&n[r]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[r]%62))}return t}}function Je(e,t){return e<t?-1:e>t?1:0}function Xe(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=e.charAt(r),s=t.charAt(r);if(n!==s)return Ze(n)===Ze(s)?Je(n,s):Ze(n)?1:-1}return Je(e.length,t.length)}function Ze(e){const t=e.charCodeAt(0);return t>=55296&&t<=57343}function et(e,t,n){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function tt(e){return e+"\0"}const nt="__name__";class rt{constructor(e,t,n){void 0===t?t=0:t>e.length&&ke(637,{offset:t,range:e.length}),void 0===n?n=e.length-t:n>e.length-t&&ke(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===rt.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof rt?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=rt.compareSegments(e.get(r),t.get(r));if(0!==n)return n}return Je(e.length,t.length)}static compareSegments(e,t){const n=rt.isNumericId(e),r=rt.isNumericId(t);return n&&!r?-1:!n&&r?1:n&&r?rt.extractNumericId(e).compare(rt.extractNumericId(t)):Xe(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return r.fromString(e.substring(4,e.length-2))}}class st extends rt{construct(e,t,n){return new st(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}
vendor: 4,299 bytes, line 2
2toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const n of e){if(n.indexOf("//")>=0)throw new Ue(Ve.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new st(t)}static emptyPath(){return new st([])}}const it=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class at extends rt{construct(e,t,n){return new at(e,t,n)}static isValidIdentifier(e){return it.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),at.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===nt}static keyField(){return new at([nt])}static fromServerFormat(e){const t=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Ue(Ve.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let i=!1;for(;r<e.length;){const t=e[r];if("\\"===t){if(r+1===e.length)throw new Ue(Ve.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new Ue(Ve.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,r+=2}else"`"===t?(i=!i,r++):"."!==t||i?(n+=t,r++):(s(),r++)}if(s(),i)throw new Ue(Ve.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new at(t)}static emptyPath(){return new at([])}}class ot{constructor(e){this.path=e}static fromPath(e){return new ot(st.fromString(e))}static fromName(e){return new ot(st.fromString(e).popFirst(5))}static empty(){return new ot(st.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===st.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return st.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new ot(new st(e.slice()))}}function ct(e,t,n){if(!n)throw new Ue(Ve.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function ut(e,t,n,r){if(!0===t&&!0===r)throw new Ue(Ve.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)}function lt(e){if(!ot.isDocumentKey(e))throw new Ue(Ve.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function ht(e){if(ot.isDocumentKey(e))throw new Ue(Ve.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function dt(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function ft(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return"function"==typeof e?"a function":ke(12329,{type:typeof e})}function pt(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new Ue(Ve.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=ft(e);throw new Ue(Ve.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}function mt(e,t){if(t<=0)throw new Ue(Ve.INVALID_ARGUMENT,`Function ${e}() requires a positive number, but it was: ${t}.`)}function gt(e,t){const n={typeString:e};return t&&(n.value=t),n}function yt(e,t){if(!dt(e))throw new Ue(Ve.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in t)if(t[r]){const s=t[r].typeString,i="value"in t[r]?{value:t[r].value}:void 0;if(!(r in e)){n=`JSON missing required field: '${r}'`;break}const a=e[r];if(s&&typeof a!==s){n=`JSON field '${r}' must be a ${s}.`;break}if(void 0!==i&&a!==i.value){n=`Expected '${r}' field to equal '${i.value}'`;break}}
2if(n)throw new Ue(Ve.INVALID_ARGUMENT,n);return!0}const wt=-62135596800,_t=1e6;class vt{static now(){return vt.fromMillis(Date.now())}static fromDate(e){return vt.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*_t);return new vt(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new Ue(Ve.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new Ue(Ve.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<wt)throw new Ue(Ve.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Ue(Ve.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/_t}_compareTo(e){return this.seconds===e.seconds?Je(this.nanoseconds,e.nanoseconds):Je(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:vt._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(yt(e,vt._jsonSchema))return new vt(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-wt;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}vt._jsonSchemaVersion="firestore/timestamp/1.0",vt._jsonSchema={type:gt("string",vt._jsonSchemaVersion),seconds:gt("number"),nanoseconds:gt("number")};class Et{static fromTimestamp(e){return new Et(e)}static min(){return new Et(new vt(0,0))}static max(){return new Et(new vt(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}const It=-1;class Tt{constructor(e,t,n,r){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=r}}function bt(e){return e.fields.find(e=>2===e.kind)}function St(e){return e.fields.filter(e=>2!==e.kind)}function At(e,t){let n=Je(e.collectionGroup,t.collectionGroup);if(0!==n)return n;for(let r=0;r<Math.min(e.fields.length,t.fields.length);++r)if(n=Nt(e.fields[r],t.fields[r]),0!==n)return n;return Je(e.fields.length,t.fields.length)}Tt.UNKNOWN_ID=-1;class Ct{constructor(e,t){this.fieldPath=e,this.kind=t}}function Nt(e,t){const n=at.comparator(e.fieldPath,t.fieldPath);return 0!==n?n:Je(e.kind,t.kind)}class Ot{constructor(e,t){this.sequenceNumber=e,this.offset=t}static empty(){return new Ot(0,kt.min())}}function Dt(e,t){const n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,s=Et.fromTimestamp(1e9===r?new vt(n+1,0):new vt(n,r));return new kt(s,ot.empty(),t)}function Rt(e){return new kt(e.readTime,e.key,It)}class kt{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new kt(Et.min(),ot.empty(),It)}static max(){return new kt(Et.max(),ot.empty(),It)}}function xt(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=ot.comparator(e.documentKey,t.documentKey),0!==n?n:Je(e.largestBatchId,t.largestBatchId))}const Pt="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Lt{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function Mt(e){if(e.code!==Ve.FAILED_PRECONDITION||e.message!==Pt)throw e;Ne("LocalStore","Unexpectedly lost primary lease")}class Vt{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)},e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&ke(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new Vt((n,r)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,r)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,r)}})}toPromise(){return new Promise((e,t)=>
2{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof Vt?t:Vt.resolve(t)}catch(e){return Vt.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):Vt.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):Vt.reject(t)}static resolve(e){return new Vt((t,n)=>{t(e)})}static reject(e){return new Vt((t,n)=>{n(e)})}static waitFor(e){return new Vt((t,n)=>{let r=0,s=0,i=!1;e.forEach(e=>{++r,e.next(()=>{++s,i&&s===r&&t()},e=>n(e))}),i=!0,s===r&&t()})}static or(e){let t=Vt.resolve(!1);for(const n of e)t=t.next(e=>e?Vt.resolve(e):n());return t}static forEach(e,t){const n=[];return e.forEach((e,r)=>{n.push(t.call(this,e,r))}),this.waitFor(n)}static mapArray(e,t){return new Vt((n,r)=>{const s=e.length,i=new Array(s);let a=0;for(let o=0;o<s;o++){const c=o;t(e[c]).next(e=>{i[c]=e,++a,a===s&&n(i)},e=>r(e))}})}static doWhile(e,t){return new Vt((n,r)=>{const s=()=>{!0===e()?t().next(()=>{s()},r):n()};s()})}}const Ut="SimpleDb";class Ft{static open(e,t,n,r){try{return new Ft(t,e.transaction(r,n))}catch(e){throw new jt(t,e)}}constructor(e,t){this.action=e,this.transaction=t,this.aborted=!1,this.v=new Fe,this.transaction.oncomplete=()=>{this.v.resolve()},this.transaction.onabort=()=>{t.error?this.v.reject(new jt(e,t.error)):this.v.resolve()},this.transaction.onerror=t=>{const n=Wt(t.target.error);this.v.reject(new jt(e,n))}}get S(){return this.v.promise}abort(e){e&&this.v.reject(e),this.aborted||(Ne(Ut,"Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}D(){const e=this.transaction;this.aborted||"function"!=typeof e.commit||e.commit()}store(e){const t=this.transaction.objectStore(e);return new $t(t)}}class Bt{static delete(e){return Ne(Ut,"Removing database:",e),Ht((0,o.mS)().indexedDB.deleteDatabase(e)).toPromise()}static C(){if(!(0,o.zW)())return!1;if(Bt.F())return!0;const e=(0,o.ZQ)(),t=Bt.O(e),n=0<t&&t<10,r=qt(e),s=0<r&&r<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||n||s)}static F(){return"undefined"!=typeof process&&"YES"===process.__PRIVATE_env?.__PRIVATE_USE_MOCK_PERSISTENCE}static M(e,t){return e.store(t)}static O(e){const t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(n)}constructor(e,t,n){this.name=e,this.version=t,this.N=n,this.L=null,12.2===Bt.O((0,o.ZQ)())&&Oe("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}async B(e){return this.db||(Ne(Ut,"Opening database:",this.name),this.db=await new Promise((t,n)=>{const r=indexedDB.open(this.name,this.version);r.onsuccess=e=>{const n=e.target.result;t(n)},r.onblocked=()=>{n(new jt(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},r.onerror=t=>{const r=t.target.error;"VersionError"===r.name?n(new Ue(Ve.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):"InvalidStateError"===r.name?n(new Ue(Ve.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+r)):n(new jt(e,r))},r.onupgradeneeded=e=>{Ne(Ut,'Database "'+this.name+'" requires upgrade from version:',e.oldVersion);const t=e.target.result;this.N.U(t,r.transaction,e.oldVersion,this.version).next(()=>{Ne(Ut,"Database upgrade to version "+this.version+" complete")})}})),this.k&&(this.db.onversionchange=e=>this.k(e)),this.db}q(e){this.k=e,this.db&&(this.db.onversionchange=t=>e(t))}async runTransaction(e,t,n,r){const s="readonly"===t;let i=0;for(;;){++i;try{this.db=await this.B(e);const t=Ft.open(this.db,e,s?"readonly":"readwrite",n),i=r(t).next(e=>(t.D(),e)).catch(e=>(t.abort(e),Vt.reject(e))).toPromise();return i.catch(()=>{}),await t.S,i}catch(e){const t=e,n="FirebaseError"!==t.name&&i<3;if(Ne(Ut,"Transaction failed with error:",t.message,"Retrying:",n),this.close(),!n)return Promise.reject(t)}}}close(){this.db&&this.db.close(),this.db=void 0}}function qt(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}class zt{constructor(e){this.$=e,this.K=!1,this.W=null}get isDone(){return this.K}get G(){return this.W}set cursor(e){this.$=e}done(){this.K=!0}j(e){this.W=e}delete(){return Ht(this.$.delete())}}class jt extends Ue{constructor(e,t){super(Ve.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${t}`),this.name="IndexedDbTransactionError"}}function Gt(e){return"IndexedDbTransactionError"===e.name}class $t{constructor(e){this.store=e}put(e,t){let n;return void 0!==t?(Ne(Ut,"PUT",this.store.name,e,t),n=this.store.put(t,e)):(Ne(Ut,"PUT",this.store.name,"<auto-key>",e),n=this.store.put(e)),Ht(n)}add(e){return Ne(Ut,"ADD",this.store.name,e,e),Ht(this.store.add(e))}get(e){return Ht(this.store.get(e)).next(t=>(void 0===t&&(t=null),Ne(Ut,"GET",this.store.name,e,t),t))}delete(e){return Ne(Ut,"DELETE",this.store.name,e),Ht(this.store.delete(e))}count(){return Ne(Ut,"COUNT",this.store.name),Ht(this.store.count())}H(e,t){const n=this.options(e,t),r=n.index?this.store.index(n.index):this.store;if("function"==typeof r.getAll){const e=r.getAll(n.range);return new Vt((t,n)=>{e.onerror=e=>{n(e.target.error)},e.onsuccess=e=>{t(e.target.result)}})}{const e=this.cursor(n),t=[];return this.J(e,(e,n)=>{t.push(n)}).next(()=>t)}}Y(e,t){const n=this.store.getAll(e,null===t?void 0:t);return new Vt((e,t)=>{n.onerror=e=>{t(e.target.error)},n.onsuccess=t=>{e(t.target.result)}})}Z(e,t){Ne(Ut,"DELETE ALL",this.store.name);const n=this.options(e,t);n.X=!1;const r=this.cursor(n);return this.J(r,(e,t,n)=>n.delete())}ee(e,t){let n;t?n=e:(n={},t=e);const r=this.cursor(n);return this.J(r,t)}te(e){const t=this.cursor({});return new Vt((n,r)=>{t.onerror=e=>{const t=Wt(e.target.error);r(t)},t.onsuccess=t=>{const r=t.target.result;r?e(r.primaryKey,r.value).next(e=>{e?r.continue():n()}):n()}})}J(e,t){const n=[];return new Vt((r,s)=>{e.onerror=e=>{s(e.target.error)},e.onsuccess=e=>{const s=e.target.result;if(!s)return void r();const i=new zt(s),a=t(s.primaryKey,s.value,i);if(a instanceof Vt){const e=a.catch(e=>(i.done(),Vt.reject(e)));n.push(e)}i.isDone?r():null===i.G?s.continue():s.continue(i.G)}}).next(()=>Vt.waitFor(n))}options(e,t){let n;return void 0!==e&&("string"==typeof e?n=e:t=e),{index:n,range:t}}cursor(e){let t="next";if(e.reverse&&(t="prev"),e.index){const n=this.store.index(e.index);return e.X?n.openKeyCursor(e.range,t):n.openCursor(e.range,t)}return this.store.openCursor(e.range,t)}}function Ht(e){return new Vt((t,n)=>{e.onsuccess=e=>{const n=e.target.result;t(n)},e.onerror=e=>{const t=Wt(e.target.error);n(t)}})}let Kt=!1;function Wt(e){const t=Bt.O((0,o.ZQ)());if(t>=12.2&&t<13){const t="An internal error was encountered in the Indexed Database server";if(e.message.indexOf(t)>=0){const e=new Ue("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${t}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return Kt||(Kt=!0,setTimeout(()=>{throw e},0)),e}}return e}const Yt="IndexBackfiller";class Qt{constructor(e,t){this.asyncQueue=e,this.ne=t,this.task=null}start(){this.re(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return null!==this.task}re(e){Ne(Yt,`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,async()=>{this.task=null;try{const e=await this.ne.ie();
2Ne(Yt,`Documents written: ${e}`)}catch(e){Gt(e)?Ne(Yt,"Ignoring IndexedDB error during index backfill: ",e):await Mt(e)}await this.re(6e4)})}}class Jt{constructor(e,t){this.localStore=e,this.persistence=t}async ie(e=50){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",t=>this.se(t,e))}se(e,t){const n=new Set;let r=t,s=!0;return Vt.doWhile(()=>!0===s&&r>0,()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next(t=>{if(null!==t&&!n.has(t))return Ne(Yt,`Processing collection: ${t}`),this._e(e,t,r).next(e=>{r-=e,n.add(t)});s=!1})).next(()=>t-r)}_e(e,t,n){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(e,t).next(r=>this.localStore.localDocuments.getNextDocuments(e,t,r,n).next(n=>{const s=n.changes;return this.localStore.indexManager.updateIndexEntries(e,s).next(()=>this.oe(r,n)).next(n=>(Ne(Yt,`Updating offset: ${n}`),this.localStore.indexManager.updateCollectionGroup(e,t,n))).next(()=>s.size)}))}oe(e,t){let n=e;return t.changes.forEach((e,t)=>{const r=Rt(t);xt(r,n)>0&&(n=r)}),new kt(n.readTime,n.documentKey,Math.max(t.batchId,e.largestBatchId))}}class Xt{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ae(e),this.ue=e=>t.writeSequenceNumber(e))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}Xt.ce=-1;const Zt=-1;function en(e){return null==e}function tn(e){return 0===e&&1/e==-1/0}function nn(e){return"number"==typeof e&&Number.isInteger(e)&&!tn(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}function rn(e){return"string"==typeof e}const sn="�";function an(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t=cn(t)),t=on(e.get(n),t);return cn(t)}function on(e,t){let n=t;const r=e.length;for(let t=0;t<r;t++){const r=e.charAt(t);switch(r){case"\0":n+="��";break;case sn:n+="��";break;default:n+=r}}return n}function cn(e){return e+sn+"�"}function un(e){const t=e.length;if(Pe(t>=2,64408,{path:e}),2===t)return Pe(e.charAt(0)===sn&&"�"===e.charAt(1),56145,{path:e}),st.emptyPath();const n=t-2,r=[];let s="";for(let i=0;i<t;){const t=e.indexOf(sn,i);switch((t<0||t>n)&&ke(50515,{path:e}),e.charAt(t+1)){case"�":const n=e.substring(i,t);let a;0===s.length?a=n:(s+=n,a=s,s=""),r.push(a);break;case"�":s+=e.substring(i,t),s+="\0";break;case"�":s+=e.substring(i,t+1);break;default:ke(61167,{path:e})}i=t+2}return new st(r)}const ln="remoteDocuments",hn="owner",dn="owner",fn="mutationQueues",pn="mutations",mn="batchId",gn="userMutationsIndex",yn=["userId","batchId"];function wn(e,t){return[e,an(t)]}function _n(e,t,n){return[e,an(t),n]}const vn={},En="documentMutations",In="remoteDocumentsV14",Tn=["prefixPath","collectionGroup","readTime","documentId"],bn="documentKeyIndex",Sn=["prefixPath","collectionGroup","documentId"],An="collectionGroupIndex",Cn=["collectionGroup","readTime","prefixPath","documentId"],Nn="remoteDocumentGlobal",On="remoteDocumentGlobalKey",Dn="targets",Rn="queryTargetsIndex",kn=["canonicalId","targetId"],xn="targetDocuments",Pn=["targetId","path"],Ln="documentTargetsIndex",Mn=["path","targetId"],Vn="targetGlobalKey",Un="targetGlobal",Fn="collectionParents",Bn=["collectionId","parent"],qn="clientMetadata",zn="bundles",jn="namedQueries",Gn="indexConfiguration",$n="c
2ollectionGroupIndex",Hn="indexState",Kn=["indexId","uid"],Wn="sequenceNumberIndex",Yn=["uid","sequenceNumber"],Qn="indexEntries",Jn=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],Xn="documentKeyIndex",Zn=["indexId","uid","orderedDocumentKey"],er="documentOverlays",tr=["userId","collectionPath","documentId"],nr="collectionPathOverlayIndex",rr=["userId","collectionPath","largestBatchId"],sr="collectionGroupOverlayIndex",ir=["userId","collectionGroup","largestBatchId"],ar="globals",or=[fn,pn,En,ln,Dn,hn,Un,xn,qn,Nn,Fn,zn,jn],cr=[...or,er],ur=[fn,pn,En,In,Dn,hn,Un,xn,qn,Nn,Fn,zn,jn,er],lr=ur,hr=[...lr,Gn,Hn,Qn],dr=hr,fr=[...hr,ar],pr=fr;class mr extends Lt{constructor(e,t){super(),this.le=e,this.currentSequenceNumber=t}}function gr(e,t){const n=Me(e);return Bt.M(n.le,t)}class yr{constructor(e,t){this.comparator=e,this.root=t||_r.EMPTY}insert(e,t){return new yr(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,_r.BLACK,null,null))}remove(e){return new yr(this.comparator,this.root.remove(e,this.comparator).copy(null,null,_r.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,n)=>(e(t,n),!1))}toString(){const e=[];return this.inorderTraversal((t,n)=>(e.push(`${t}:${n}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new wr(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new wr(this.root,e,this.comparator,!1)}getReverseIterator(){return new wr(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new wr(this.root,e,this.comparator,!0)}}class wr{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,t&&r&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(0===s){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class _r{constructor(e,t,n,r,s){this.key=e,this.value=t,this.color=null!=n?n:_r.RED,this.left=null!=r?r:_r.EMPTY,this.right=null!=s?s:_r.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,r,s){return new _r(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this;const s=n(e,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===s?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return _r.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let n,r=this;if(t(e,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(e,t),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===t(e,r.key)){if(r.right.isEmpty())return _r.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(e,t))}return r.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,_r.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,_r.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw ke(43730,{key:this.key,value:this.value});if(this.right.isRed())throw ke(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw ke(27949);return e+(this.isRed()?0:1)}}
2_r.EMPTY=null,_r.RED=!0,_r.BLACK=!1,_r.EMPTY=new class{constructor(){this.size=0}get key(){throw ke(57766)}get value(){throw ke(16141)}get color(){throw ke(16727)}get left(){throw ke(29726)}get right(){throw ke(36894)}copy(e,t,n,r,s){return this}insert(e,t,n){return new _r(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class vr{constructor(e){this.comparator=e,this.data=new yr(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,n)=>(e(t),!1))}forEachInRange(e,t){const n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Er(this.data.getIterator())}getIteratorFrom(e){return new Er(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof vr))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(0!==this.comparator(e,r))return!1}return!0}toArray(){const e=[];return this.forEach(t=>{e.push(t)}),e}toString(){const e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){const t=new vr(this.comparator);return t.data=e,t}}class Er{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}function Ir(e){return e.hasNext()?e.getNext():void 0}class Tr{constructor(e){this.fields=e,e.sort(at.comparator)}static empty(){return new Tr([])}unionWith(e){let t=new vr(at.comparator);for(const e of this.fields)t=t.add(e);for(const n of e)t=t.add(n);return new Tr(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return et(this.fields,e.fields,(e,t)=>e.isEqual(t))}}function br(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Sr(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Ar(e,t){const n=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.push(t(e[r],r,e));return n}function Cr(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class Nr extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}function Or(){return"undefined"!=typeof atob}class Dr{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new Nr("Invalid base64 string: "+e):e}}(e);return new Dr(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new Dr(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return e=this.binaryString,btoa(e);var e}toUint8Array(){return function(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Je(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Dr.EMPTY_BYTE_STRING=new Dr("");const Rr=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function kr(e){if(Pe(!!e,39018),"string"==typeof e){let t=0;const n=Rr.exec(e);if(Pe(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const r=new Date(e);return{seconds:Math.floor(r.getTime()/1e3),nanos:t}}return{seconds:xr(e.seconds),nanos:xr(e.nanos)}}function xr(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function Pr(e){return"string"==typeof e?Dr.fromBase64String(e):Dr.fromUint8Array(e)}const Lr="server_timestamp",Mr="__type__",Vr="__previous_value__",Ur="__local_write_time__";function Fr(e){const t=(e?.mapValue?.fields||{})[Mr]?.stringValue;return t===Lr}function Br(e){const t=e.mapValue.fields[Vr];return Fr(t)?Br(t):t}function qr(e){const t=kr(e.mapValue.fields[Ur].timestampValue);return new vt(t.seconds,t.nanos)}
vendor: 9,396 bytes, line 2
2class zr{constructor(e,t,n,r,s,i,a,o,c,u,l){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=s,this.forceLongPolling=i,this.autoDetectLongPolling=a,this.longPollingOptions=o,this.useFetchStreams=c,this.isUsingEmulator=u,this.apiKey=l}}const jr="(default)";class Gr{constructor(e,t){this.projectId=e,this.database=t||jr}static empty(){return new Gr("","")}get isDefaultDatabase(){return this.database===jr}isEqual(e){return e instanceof Gr&&e.projectId===this.projectId&&e.database===this.database}}const $r="__type__",Hr="__max__",Kr={mapValue:{fields:{__type__:{stringValue:Hr}}}},Wr="__vector__",Yr="value",Qr={nullValue:"NULL_VALUE"},Jr={booleanValue:!0},Xr={booleanValue:!1};function Zr(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?Fr(e)?4:_s(e)?9007199254740991:gs(e)?10:11:ke(28295,{value:e})}function es(e,t,n){if(e===t)return!0;const r=Zr(e);if(r!==Zr(t))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return qr(e).isEqual(qr(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;const n=kr(e.timestampValue),r=kr(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Pr(e.bytesValue).isEqual(Pr(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return xr(e.geoPointValue.latitude)===xr(t.geoPointValue.latitude)&&xr(e.geoPointValue.longitude)===xr(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t,n){if("integerValue"in e&&"integerValue"in t)return xr(e.integerValue)===xr(t.integerValue);let r,s;if("doubleValue"in e&&"doubleValue"in t)r=xr(e.doubleValue),s=xr(t.doubleValue);else{if(!n?.Ee)return!1;r=xr(e.integerValue??e.doubleValue),s=xr(t.integerValue??t.doubleValue)}return r===s?!!n?.he||tn(r)===tn(s):!(void 0!==n&&!n.Te)&&isNaN(r)&&isNaN(s)}(e,t,n);case 9:return et(e.arrayValue.values||[],t.arrayValue.values||[],(e,t)=>es(e,t,n));case 10:case 11:return function(e,t,n){const r=e.mapValue.fields||{},s=t.mapValue.fields||{};if(br(r)!==br(s))return!1;for(const e in r)if(r.hasOwnProperty(e)&&(void 0===s[e]||!es(r[e],s[e],n)))return!1;return!0}(e,t,n);default:return ke(52216,{left:e})}}function ts(e,t){return void 0!==(e.values||[]).find(e=>es(e,t))}function ns(e,t){if(e===t)return 0;const n=Zr(e),r=Zr(t);if(n!==r)return Je(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Je(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=xr(e.integerValue||e.doubleValue),r=xr(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return rs(e.timestampValue,t.timestampValue);case 4:return rs(qr(e),qr(t));case 5:return Xe(e.stringValue,t.stringValue);case 6:return function(e,t){const n=Pr(e),r=Pr(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),r=t.split("/");for(let e=0;e<n.length&&e<r.length;e++){const t=Je(n[e],r[e]);if(0!==t)return t}return Je(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=Je(xr(e.latitude),xr(t.latitude));return 0!==n?n:Je(xr(e.longitude),xr(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return ss(e.arrayValue,t.arrayValue);case 10:return function(e,t){const n=e.fields||{},r=t.fields||{},s=n[Yr]?.arrayValue,i=r[Yr]?.arrayValue,a=Je(s?.values?.length||0,i?.values?.length||0);return 0!==a?a:ss(s,i)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===Kr.mapValue&&t===Kr.mapValue)return 0;if(e===Kr.mapValue)return 1;if(t===Kr.mapValue)return-1;const n=e.fields||{},r=Object.keys(n),s=t.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let e=0;e<r.length&&e<i.length;++e){const t=Xe(r[e],i[e]);if(0!==t)return t;const a=ns(n[r[e]],s[i[e]]);if(0!==a)return a}return Je(r.length,i.length)}(e.mapValue,t.mapValue);default:throw ke(23264,{Pe:n})}}function rs(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return Je(e,t);const n=kr(e),r=kr(t),s=Je(n.seconds,r.seconds);return 0!==s?s:Je(n.nanos,r.nanos)}function ss(e,t){const n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){const t=ns(n[e],r[e]);if(void 0!==t&&0!==t)return t}return Je(n.length,r.length)}function is(e){return as(e)}function as(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){const t=kr(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return Pr(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return ot.fromName(e).toString()}(e.referenceValue):"geoPointValue"in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):"arrayValue"in e?function(e){let t="[",n=!0;for(const r of e.values||[])n?n=!1:t+=",",t+=as(r);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",r=!0;for(const s of t)r?r=!1:n+=",",n+=`${s}:${as(e.fields[s])}`;return n+"}"}(e.mapValue):ke(61005,{value:e})}function os(e){switch(Zr(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Br(e);return t?16+os(t):16;case 5:return 2*e.stringValue.length;case 6:return Pr(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce((e,t)=>e+os(t),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return Sr(e.fields,(e,n)=>{t+=e.length+os(n)}),t}(e.mapValue);default:throw ke(13486,{value:e})}}function cs(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function us(e){return!!e&&"integerValue"in e}function ls(e){return!!e&&"doubleValue"in e}function hs(e){return us(e)||ls(e)}function ds(e){return!!e&&"arrayValue"in e}function fs(e){return!!e&&"nullValue"in e}function ps(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function ms(e){return!!e&&"mapValue"in e}function gs(e){const t=(e?.mapValue?.fields||{})[$r]?.stringValue;return t===Wr}function ys(e){return(e?.mapValue?.fields||{})[Yr]?.arrayValue}function ws(e){if(e.geoPointValue)return{geoPointValue:{...e.geoPointValue}};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:{...e.timestampValue}};if(e.mapValue){const t={mapValue:{fields:{}}};return Sr(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=ws(n)),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=ws(e.arrayValue.values[n]);return t}return{...e}}function _s(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===Hr}const vs={mapValue:{fields:{[$r]:{stringValue:Wr},[Yr]:{arrayValue:{}}}}};function Es(e){return"nullValue"in e?Qr:"booleanValue"in e?{booleanValue:!1}:"integerValue"in e||"doubleValue"in e?{doubleValue:NaN}:"timestampValue"in e?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in e?{stringValue:""}:"bytesValue"in e?{bytesValue:""}:"referenceValue"in e?cs(Gr.empty(),ot.empty()):"geoPointValue"in e?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in e?{arrayValue:{}}:"mapValue"in e?gs(e)?vs:{mapValue:{}}:ke(35942,{value:e})}function Is(e){return"nullValue"in e?{booleanValue:!1}:"booleanValue"in e?{doubleValue:NaN}:"integerValue"in e||"doubleValue"in e?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in e?{stringValue:""}:"stringValue"in e?{bytesValue:""}:"bytesValue"in e?cs(Gr.empty(),ot.empty()):"referenceValue"in e?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in e?{arrayValue:{}}:"arrayValue"in e?vs:"mapValue"in e?gs(e)?{mapValue:{}}:Kr:ke(61959,{value:e})}function Ts(e,t){const n=ns(e.value,t.value);return 0!==n?n:e.inclusive&&!t.inclusive?-1:!e.inclusive&&t.inclusive?1:0}function bs(e,t){const n=ns(e.value,t.value);return 0!==n?n:e.inclusive&&!t.inclusive?1:!e.inclusive&&t.inclusive?-1:0}class Ss{constructor(e){this.value=e}static empty(){return new Ss({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!ms(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=ws(t)}setAll(e){let t=at.emptyPath(),n={},r=[];e.forEach((e,s)=>{if(!t.isImmediateParentOf(s)){const e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=s.popLast()}e?n[s.lastSegment()]=ws(e):r.push(s.lastSegment())});const s=this.getFieldsMap(t);this.applyChanges(s,n,r)}delete(e){const t=this.field(e.popLast());ms(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return es(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let r=t.mapValue.fields[e.get(n)];ms(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}
2applyChanges(e,t,n){Sr(t,(t,n)=>e[t]=n);for(const t of n)delete e[t]}clone(){return new Ss(ws(this.value))}}function As(e){const t=[];return Sr(e.fields,(e,n)=>{const r=new at([e]);if(ms(n)){const e=As(n.mapValue).fields;if(0===e.length)t.push(r);else for(const n of e)t.push(r.child(n))}else t.push(r)}),new Tr(t)}function Cs(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:tn(t)?"-0":t}}function Ns(e){return{integerValue:""+e}}function Os(e,t,n){return Number.isInteger(t)&&n?.preferIntegers||nn(t)?Ns(t):Cs(e,t)}class Ds{constructor(){this._=void 0}}function Rs(e,t,n){return e instanceof Ps?function(e,t){const n={fields:{[Mr]:{stringValue:Lr},[Ur]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Fr(t)&&(t=Br(t)),t&&(n.fields[Vr]=t),{mapValue:n}}(n,t):e instanceof Ls?Ms(e,t):e instanceof Vs?Us(e,t):e instanceof Bs?function(e,t){const n=xs(e,t),r=Gs(n)+Gs(e.Re);return us(n)&&us(e.Re)?Ns(r):Cs(e.serializer,r)}(e,t):e instanceof qs?function(e,t){return js(e,t,Math.min)}(e,t):e instanceof zs?function(e,t){return js(e,t,Math.max)}(e,t):void 0}function ks(e,t,n){return e instanceof Ls?Ms(e,t):e instanceof Vs?Us(e,t):n}function xs(e,t){return e instanceof Bs?hs(t)?t:{integerValue:0}:null}class Ps extends Ds{}class Ls extends Ds{constructor(e){super(),this.elements=e}}function Ms(e,t){const n=$s(t);for(const t of e.elements)n.some(e=>es(e,t))||n.push(t);return{arrayValue:{values:n}}}class Vs extends Ds{constructor(e){super(),this.elements=e}}function Us(e,t){let n=$s(t);for(const t of e.elements)n=n.filter(e=>!es(e,t));return{arrayValue:{values:n}}}class Fs extends Ds{constructor(e,t){super(),this.serializer=e,this.Re=t}}class Bs extends Fs{}class qs extends Fs{}class zs extends Fs{}function js(e,t,n){if(!hs(t))return e.Re;const r=n(Gs(t),Gs(e.Re));return us(t)&&us(e.Re)?Ns(r):Cs(e.serializer,r)}function Gs(e){return xr(e.integerValue||e.doubleValue)}function $s(e){return ds(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Hs{constructor(e,t){this.field=e,this.transform=t}}class Ks{constructor(e,t){this.version=e,this.transformResults=t}}class Ws{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Ws}static exists(e){return new Ws(void 0,e)}static updateTime(e){return new Ws(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Ys(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class Qs{}function Js(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new oi(e.key,Ws.none()):new ni(e.key,e.data,Ws.none());{const n=e.data,r=Ss.empty();let s=new vr(at.comparator);for(let e of t.fields)if(!s.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?r.delete(e):r.set(e,t),s=s.add(e)}return new ri(e.key,r,new Tr(s.toArray()),Ws.none())}}function Xs(e,t,n){e instanceof ni?function(e,t,n){const r=e.value.clone(),s=ii(e.fieldTransforms,t,n.transformResults);r.setAll(s),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof ri?function(e,t,n){if(!Ys(e.precondition,t))return void t.convertToUnknownDocument(n.version);const r=ii(e.fieldTransforms,t,n.transformResults),s=t.data;s.setAll(si(e)),s.setAll(r),t.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function Zs(e,t,n,r){return e instanceof ni?function(e,t,n,r){if(!Ys(e.precondition,t))return n;const s=e.value.clone(),i=ai(e.fieldTransforms,r,t);return s.setAll(i),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null}(e,t,n,r):e instanceof ri?function(e,t,n,r){if(!Ys(e.precondition,t))return n;const s=ai(e.fieldTransforms,r,t),i=t.data;return i.setAll(si(e)),i.setAll(s),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,r):function(e,t,n){return Ys(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function ei(e,t){let n=null;for(const r of e.fieldTransforms){const e=t.data.field(r.field),s=xs(r.transform,e||null);null!=s&&(null===n&&(n=Ss.empty()),n.set(r.field,s))}return n||null}function ti(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&et(e,t,(e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Ls&&t instanceof Ls||e instanceof Vs&&t instanceof Vs?et(e.elements,t.elements,es):e instanceof Bs&&t instanceof Bs||e instanceof qs&&t instanceof qs||e instanceof zs&&t instanceof zs?es(e.Re,t.Re):e instanceof Ps&&t instanceof Ps}(e.transform,t.transform)}(e,t))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class ni extends Qs{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.prec
vendor: 7,400 bytes, line 2
2ondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class ri extends Qs{constructor(e,t,n,r,s=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function si(e){const t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=e.data.field(n);t.set(n,r)}}),t}function ii(e,t,n){const r=new Map;Pe(e.length===n.length,32656,{Ie:n.length,Ae:e.length});for(let s=0;s<n.length;s++){const i=e[s],a=i.transform,o=t.data.field(i.field);r.set(i.field,ks(a,o,n[s]))}return r}function ai(e,t,n){const r=new Map;for(const s of e){const e=s.transform,i=n.data.field(s.field);r.set(s.field,Rs(e,i,t))}return r}class oi extends Qs{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class ci extends Qs{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class ui{constructor(e,t,n){this.alias=e,this.aggregateType=t,this.fieldPath=n}}class li{constructor(e,t){this.position=e,this.inclusive=t}}function hi(e,t,n){let r=0;for(let s=0;s<e.position.length;s++){const i=t[s],a=e.position[s];if(r=i.field.isKeyField()?ot.comparator(ot.fromName(a.referenceValue),n.key):ns(a,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function di(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!es(e.position[n],t.position[n]))return!1;return!0}class fi{}class pi extends fi{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new bi(e,t,n):"array-contains"===t?new Ni(e,n):"in"===t?new Oi(e,n):"not-in"===t?new Di(e,n):"array-contains-any"===t?new Ri(e,n):new pi(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new Si(e,n):new Ai(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(ns(t,this.value)):null!==t&&Zr(this.value)===Zr(t)&&this.matchesComparison(ns(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return ke(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class mi extends fi{constructor(e,t){super(),this.filters=e,this.op=t,this.Ve=null}static create(e,t){return new mi(e,t)}matches(e){return gi(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.Ve||(this.Ve=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.Ve}getFilters(){return Object.assign([],this.filters)}}function gi(e){return"and"===e.op}function yi(e){return"or"===e.op}function wi(e){return _i(e)&&gi(e)}function _i(e){for(const t of e.filters)if(t instanceof mi)return!1;return!0}function vi(e){if(e instanceof pi)return e.field.canonicalString()+e.op.toString()+is(e.value);if(wi(e))return e.filters.map(e=>vi(e)).join(",");{const t=e.filters.map(e=>vi(e)).join(",");return`${e.op}(${t})`}}function Ei(e,t){return e instanceof pi?function(e,t){return t instanceof pi&&e.op===t.op&&e.field.isEqual(t.field)&&es(e.value,t.value)}(e,t):e instanceof mi?function(e,t){return t instanceof mi&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((e,n,r)=>e&&Ei(n,t.filters[r]),!0)}(e,t):void ke(19439)}function Ii(e,t){const n=e.filters.concat(t);return mi.create(n,e.op)}function Ti(e){return e instanceof pi?function(e){return`${e.field.canonicalString()} ${e.op} ${is(e.value)}`}(e):e instanceof mi?function(e){return e.op.toString()+" {"+e.getFilters().map(Ti).join(" ,")+"}"}(e):"Filter"}class bi extends pi{constructor(e,t,n){super(e,t,n),this.key=ot.fromName(n.referenceValue)}matches(e){const t=ot.comparator(e.key,this.key);return this.matchesComparison(t)}}class Si extends pi{constructor(e,t){super(e,"in",t),this.keys=Ci("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class Ai extends pi{constructor(e,t){super(e,"not-in",t),this.keys=Ci("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function Ci(e,t){return(t.arrayValue?.values||[]).map(e=>ot.fromName(e.referenceValue))}class Ni extends pi{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return ds(t)&&ts(t.arrayValue,this.value)}}class Oi extends pi{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&ts(this.value.arrayValue,t)}}class Di extends pi{constructor(e,t){super(e,"not-in",t)}matches(e){if(ts(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!ts(this.value.arrayValue,t)}}class Ri extends pi{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!ds(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>ts(this.value.arrayValue,e))}}class ki{constructor(e,t="asc"){this.field=e,this.dir=t}}function xi(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}class Pi{constructor(e,t,n,r,s,i,a){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=s,this.data=i,this.documentState=a}static newInvalidDocument(e){return new Pi(e,0,Et.min(),Et.min(),Et.min(),Ss.empty(),0)}static newFoundDocument(e,t,n,r){return new Pi(e,1,t,Et.min(),n,r,0)}static newNoDocument(e,t){return new Pi(e,2,t,Et.min(),Et.min(),Ss.empty(),0)}static newUnknownDocument(e,t){return new Pi(e,3,t,Et.min(),Et.min(),Ss.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(Et.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Ss.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Ss.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Et.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof Pi&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Pi(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}})`}}
2class Li{constructor(e,t=null,n=[],r=[],s=null,i=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=a,this.de=null}}function Mi(e,t=null,n=[],r=[],s=null,i=null,a=null){return new Li(e,t,n,r,s,i,a)}function Vi(e){const t=Me(e);if(null===t.de){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map(e=>vi(e)).join(","),e+="|ob:",e+=t.orderBy.map(e=>function(e){return e.field.canonicalString()+e.dir}(e)).join(","),en(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map(e=>is(e)).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(e=>is(e)).join(",")),t.de=e}return t.de}function Ui(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!xi(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!Ei(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!di(e.startAt,t.startAt)&&di(e.endAt,t.endAt)}function Fi(e){return!!e.isCorePipeline}function Bi(e){return!!e.path&&ot.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}function qi(e,t){return e.filters.filter(e=>e instanceof pi&&e.field.isEqual(t))}function zi(e,t,n){let r=Qr,s=!0;for(const n of qi(e,t)){let e=Qr,t=!0;switch(n.op){case"<":case"<=":e=Es(n.value);break;case"==":case"in":case">=":e=n.value;break;case">":e=n.value,t=!1;break;case"!=":case"not-in":e=Qr}Ts({value:r,inclusive:s},{value:e,inclusive:t})<0&&(r=e,s=t)}if(null!==n)for(let i=0;i<e.orderBy.length;++i)if(e.orderBy[i].field.isEqual(t)){const e=n.position[i];Ts({value:r,inclusive:s},{value:e,inclusive:n.inclusive})<0&&(r=e,s=n.inclusive);break}return{value:r,inclusive:s}}function ji(e,t,n){let r=Kr,s=!0;for(const n of qi(e,t)){let e=Kr,t=!0;switch(n.op){case">=":case">":e=Is(n.value),t=!1;break;case"==":case"in":case"<=":e=n.value;break;case"<":e=n.value,t=!1;break;case"!=":case"not-in":e=Kr}bs({value:r,inclusive:s},{value:e,inclusive:t})>0&&(r=e,s=t)}if(null!==n)for(let i=0;i<e.orderBy.length;++i)if(e.orderBy[i].field.isEqual(t)){const e=n.position[i];bs({value:r,inclusive:s},{value:e,inclusive:n.inclusive})>0&&(r=e,s=n.inclusive);break}return{value:r,inclusive:s}}class Gi{constructor(e,t=null,n=[],r=[],s=null,i="F",a=null,o=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=s,this.limitType=i,this.startAt=a,this.endAt=o,this.fe=null,this.me=null,this.pe=null,this.startAt,this.endAt}}function $i(e,t,n,r,s,i,a,o){return new Gi(e,t,n,r,s,i,a,o)}function Hi(e){return new Gi(e)}function Ki(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function Wi(e){return ot.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}function Yi(e){return null!==e.collectionGroup}function Qi(e){const t=Me(e);if(null===t.fe){t.fe=[];const e=new Set;for(const n of t.explicitOrderBy)t.fe.push(n),e.add(n.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",r=function(e){let t=new vr(at.comparator);return e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t}(t);r.forEach(r=>{e.has(r.canonicalString())||r.isKeyField()||t.fe.push(new ki(r,n))}),e.has(at.keyField().canonicalString())||t.fe.push(new ki(at.keyField(),n))}return t.fe}function Ji(e){const t=Me(e);return t.me||(t.me=Zi(t,Qi(e))),t.me}function Xi(e){const t=Me(e);return t.pe||(t.pe=Zi(t,e.explicitOrderBy)),t.pe}function Zi(e,t){if("F"===e.limitType)return Mi(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(e=>{const t="desc"===e.dir?"asc":"desc";return new ki(e.field,t)});const n=e.endAt?new li(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new li(e.startAt.position,e.startAt.inclusive):null;return Mi(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}function ea(e,t){const n=e.filters.concat([t]);return new Gi(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function ta(e,t,n){return new Gi(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function na(e,t){return Ui(Ji(e),Ji(t))&&e.limitType===t.limitType}function ra(e){return`Query(target=${function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map(e=>Ti(e)).join(", ")}]`),en(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map(e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e)).join(", ")}]`),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(e=>is(e)).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>is(e)).join(",")),`Target(${t})`}(Ji(e))}; limitType=${e.limitType})`}function sa(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):ot.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Qi(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const r=hi(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,Qi(e),t))&&!(e.endAt&&!function(e,t,n){const r=hi(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,Qi(e),t))}(e,t)}function ia(e){return(t,n)=>{let r=!1;
vendor: 14,821 bytes, line 2
2for(const s of Qi(e)){const e=aa(s,t,n);if(0!==e)return e;r=r||s.field.isKeyField()}return 0}}function aa(e,t,n){const r=e.field.isKeyField()?ot.comparator(t.key,n.key):function(e,t,n){const r=t.data.field(e),s=n.data.field(e);return null!==r&&null!==s?ns(r,s):ke(42886)}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return ke(19790,{direction:e.dir})}}class oa{constructor(e,t){this.count=e,this.unchangedNames=t}}var ca,ua;function la(e){switch(e){case Ve.OK:return ke(64938);case Ve.CANCELLED:case Ve.UNKNOWN:case Ve.DEADLINE_EXCEEDED:case Ve.RESOURCE_EXHAUSTED:case Ve.INTERNAL:case Ve.UNAVAILABLE:case Ve.UNAUTHENTICATED:return!1;case Ve.INVALID_ARGUMENT:case Ve.NOT_FOUND:case Ve.ALREADY_EXISTS:case Ve.PERMISSION_DENIED:case Ve.FAILED_PRECONDITION:case Ve.ABORTED:case Ve.OUT_OF_RANGE:case Ve.UNIMPLEMENTED:case Ve.DATA_LOSS:return!0;default:return ke(15467,{code:e})}}function ha(e){if(void 0===e)return Oe("GRPC error has no .code"),Ve.UNKNOWN;switch(e){case ca.OK:return Ve.OK;case ca.CANCELLED:return Ve.CANCELLED;case ca.UNKNOWN:return Ve.UNKNOWN;case ca.DEADLINE_EXCEEDED:return Ve.DEADLINE_EXCEEDED;case ca.RESOURCE_EXHAUSTED:return Ve.RESOURCE_EXHAUSTED;case ca.INTERNAL:return Ve.INTERNAL;case ca.UNAVAILABLE:return Ve.UNAVAILABLE;case ca.UNAUTHENTICATED:return Ve.UNAUTHENTICATED;case ca.INVALID_ARGUMENT:return Ve.INVALID_ARGUMENT;case ca.NOT_FOUND:return Ve.NOT_FOUND;case ca.ALREADY_EXISTS:return Ve.ALREADY_EXISTS;case ca.PERMISSION_DENIED:return Ve.PERMISSION_DENIED;case ca.FAILED_PRECONDITION:return Ve.FAILED_PRECONDITION;case ca.ABORTED:return Ve.ABORTED;case ca.OUT_OF_RANGE:return Ve.OUT_OF_RANGE;case ca.UNIMPLEMENTED:return Ve.UNIMPLEMENTED;case ca.DATA_LOSS:return Ve.DATA_LOSS;default:return ke(39323,{code:e})}}(ua=ca||(ca={}))[ua.OK=0]="OK",ua[ua.CANCELLED=1]="CANCELLED",ua[ua.UNKNOWN=2]="UNKNOWN",ua[ua.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",ua[ua.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",ua[ua.NOT_FOUND=5]="NOT_FOUND",ua[ua.ALREADY_EXISTS=6]="ALREADY_EXISTS",ua[ua.PERMISSION_DENIED=7]="PERMISSION_DENIED",ua[ua.UNAUTHENTICATED=16]="UNAUTHENTICATED",ua[ua.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",ua[ua.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",ua[ua.ABORTED=10]="ABORTED",ua[ua.OUT_OF_RANGE=11]="OUT_OF_RANGE",ua[ua.UNIMPLEMENTED=12]="UNIMPLEMENTED",ua[ua.INTERNAL=13]="INTERNAL",ua[ua.UNAVAILABLE=14]="UNAVAILABLE",ua[ua.DATA_LOSS=15]="DATA_LOSS";class da{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n)for(const[t,r]of n)if(this.equalsFn(t,e))return r}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){Sr(this.inner,(t,n)=>{for(const[t,r]of n)e(t,r)})}isEmpty(){return Cr(this.inner)}size(){return this.innerSize}}const fa=new yr(ot.comparator);function pa(){return fa}const ma=new yr(ot.comparator);function ga(...e){let t=ma;for(const n of e)t=t.insert(n.key,n);return t}function ya(e){let t=ma;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function wa(){return va()}function _a(){return va()}function va(){return new da(e=>e.toString(),(e,t)=>e.isEqual(t))}const Ea=new yr(ot.comparator),Ia=new vr(ot.comparator);function Ta(...e){let t=Ia;for(const n of e)t=t.add(n);return t}const ba=new vr(Je);function Sa(){return ba}let Aa=null;function Ca(){return new TextEncoder}const Na=new r([4294967295,4294967295],0);function Oa(e){const t=Ca().encode(e),n=new s;return n.update(t),new Uint8Array(n.digest())}function Da(e){const t=new DataView(e.buffer),n=t.getUint32(0,!0),s=t.getUint32(4,!0),i=t.getUint32(8,!0),a=t.getUint32(12,!0);return[new r([n,s],0),new r([i,a],0)]}class Ra{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new ka(`Invalid padding: ${t}`);if(n<0)throw new ka(`Invalid hash count: ${n}`);if(e.length>0&&0===this.hashCount)throw new ka(`Invalid hash count: ${n}`);if(0===e.length&&0!==t)throw new ka(`Invalid padding when bitmap length is 0: ${t}`);this.ge=8*e.length-t,this.ye=r.fromNumber(this.ge)}we(e,t,n){let s=e.add(t.multiply(r.fromNumber(n)));return 1===s.compare(Na)&&(s=new r([s.getBits(0),s.getBits(1)],0)),s.modulo(this.ye).toNumber()}be(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(0===this.ge)return!1;const t=Oa(e),[n,r]=Da(t);for(let e=0;e<this.hashCount;e++){const t=this.we(n,r,e);if(!this.be(t))return!1}return!0}static create(e,t,n){const r=e%8==0?0:8-e%8,s=new Uint8Array(Math.ceil(e/8)),i=new Ra(s,r,t);return n.forEach(e=>i.insert(e)),i}insert(e){if(0===this.ge)return;const t=Oa(e),[n,r]=Da(t);for(let e=0;e<this.hashCount;e++){const t=this.we(n,r,e);this.ve(t)}}ve(e){const t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}class ka extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class xa{constructor(e,t,n,r,s,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.augmentedDocumentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,n){const r=new Map;return r.set(e,Pa.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new xa(Et.min(),r,new yr(Je),pa(),pa(),Ta())}}class Pa{constructor(e,t,n,r,s){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new Pa(n,t,Ta(),Ta(),Ta())}}class La{constructor(e,t,n,r){this.Se=e,this.removedTargetIds=t,this.key=n,this.De=r}}class Ma{constructor(e,t){this.targetId=e,this.xe=t}}class Va{constructor(e,t,n=Dr.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}}class Ua{constructor(e){this.targetId=e,this.Ce=0,this.Fe=za(),this.Oe=Dr.EMPTY_BYTE_STRING,this.Me=!1,this.Ne=!0}get current(){return this.Me}get resumeToken(){return this.Oe}get Le(){return 0!==this.Ce}get Be(){return this.Ne}Ue(e){e.approximateByteSize()>0&&(this.Ne=!0,this.Oe=e)}ke(){let e=Ta(),t=Ta(),n=Ta();return this.Fe.forEach((r,s)=>{switch(s){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:ke(38017,{changeType:s})}}),new Pa(this.Oe,this.Me,e,t,n)}qe(){this.Ne=!1,this.Fe=za()}$e(e,t){this.Ne=!0,this.Fe=this.Fe.insert(e,t)}Ke(e){this.Ne=!0,this.Fe=this.Fe.remove(e)}We(){this.Ce+=1}Qe(){this.Ce-=1,Pe(this.Ce>=0,3241,{Ce:this.Ce,targetId:this.targetId})}Ge(){this.Ne=!0,this.Me=!0}}const Fa="WatchChangeAggregator";class Ba{constructor(e){this.ze=e,this.je=new Map,this.He=pa(),this.Je=qa(),this.Ye=pa(),this.Ze=qa(),this.Xe=new yr(Je)}et(e){for(const t of e.Se)e.De&&e.De.isFoundDocument()?this.tt(t,e.De):this.nt(t,e.key,e.De);for(const t of e.removedTargetIds)this.nt(t,e.key,e.De)}rt(e){this.forEachTarget(e,t=>{const n=this.je.get(t);if(n)switch(e.state){case 0:this.it(t)&&n.Ue(e.resumeToken);break;case 1:n.Qe(),n.Le||n.qe(),n.Ue(e.resumeToken);break;case 2:n.Qe(),n.Le||this.removeTarget(t);break;case 3:this.it(t)&&(n.Ge(),n.Ue(e.resumeToken));break;case 4:this.it(t)&&(this.st(t),n.Ue(e.resumeToken));break;default:ke(56790,{state:e.state})}else Ne(Fa,`handleTargetChange received targetChange for untracked target ID (${t}) with state (${e.state})`)})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.je.forEach((e,n)=>{this.it(n)&&t(n)})}_t(e){return Fi(e)?"documents"===e.getPipelineSourceType()&&1===e.getPipelineDocuments()?.length:Bi(e)}ot(e){const t=e.targetId,n=e.xe.count,r=this.ut(t);if(r){const s=r.target;if(this._t(s))if(0===n){const e=new ot(Fi(s)?st.fromString(s.getPipelineDocuments()[0]):s.path);this.nt(t,e,Pi.newNoDocument(e,Et.min()))}else Pe(1===n,20013,"Single document existence filter with count: "+n);else{const r=this.ct(t);if(r!==n){const n=this.lt(e),s=n?this.Et(n,e,r):1;if(0!==s){this.st(t);const e=2===s?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Xe=this.Xe.insert(t,e)}Aa?.u(function(e,t,n,r,s){const i={localCacheCount:e,existenceFilterCount:t.count,databaseId:n.database,projectId:n.projectId},a=t.unchangedNames;return a&&(i.bloomFilter={applied:0===s,hashCount:a?.hashCount??0,bitmapLength:a?.bits?.bitmap?.length??0,padding:a?.bits?.padding??0,mightContain:e=>r?.mightContain(e)??!1}),i}(r,e.xe,this.ze.Tt(),n,s))}}}}lt(e){const t=e.xe.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:r=0},hashCount:s=0}=t;let i,a;try{i=Pr(n).toUint8Array()}catch(e){if(e instanceof Nr)return De("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{a=new Ra(i,r,s)}catch(e){return De(e instanceof ka?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===a.ge?null:a}Et(e,t,n){return t.xe.count===n-this.Pt(e,t.targetId)?0:2}Pt(e,t){const n=this.ze.getRemoteKeysForTarget(t);let r=0;return n.forEach(n=>{const s=this.ze.Tt(),i=`projects/${s.projectId}/databases/${s.database}/documents/${n.path.canonicalString()}`;e.mightContain(i)||(this.nt(t,n,null),r++)}),r}Rt(e){const t=new Map;this.je.forEach((n,r)=>{const s=this.ut(r);if(s){if(n.current&&this._t(s.target)){const t=Fi(s.target)?st.fromString(s.target.getPipelineDocuments()[0]):s.target.path,n=new ot(t);this.It(n).has(r)||this.At(r,n)||this.nt(r,n,Pi.newNoDocument(n,e))}n.Be&&(t.set(r,n.ke()),n.qe())}});let n=Ta();this.Ze.forEach((e,t)=>{let r=!0;t.forEachWhile(e=>{const t=this.ut(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(r=!1,!1)}),r&&(n=n.add(e))}),this.He.forEach((t,n)=>n.setReadTime(e)),this.Ye.forEach((t,n)=>n.setReadTime(e));const r=new xa(e,t,this.Xe,this.He,this.Ye,n);return this.He=pa(),this.Je=qa(),this.Ye=pa(),this.Ze=qa(),this.Xe=new yr(Je),r}tt(e,t){const n=this.je.get(e);if(!n||!this.it(e))return void Ne(Fa,`addDocumentToTarget received document for unknown inactive target (${e})`);const r=this.At(e,t.key)?2:0;n.$e(t.key,r),Fi(this.ut(e).target)&&"exact"!==this.ut(e).target.getPipelineFlavor()?this.Ye=this.Ye.insert(t.key,t):this.He=this.He.insert(t.key,t),this.Je=this.Je.insert(t.key,this.It(t.key).add(e)),this.Ze=this.Ze.insert(t.key,this.Vt(t.key).add(e))}nt(e,t,n){const r=this.je.get(e);r&&this.it(e)?(this.At(e,t)?r.$e(t,1):r.Ke(t),this.Ze=this.Ze.insert(t,this.Vt(t).delete(e)),this.Ze=this.Ze.insert(t,this.Vt(t).add(e)),n&&(Fi(this.ut(e).target)&&"exact"!==this.ut(e).target.getPipelineFlavor()?this.Ye=this.Ye.insert(t,n):this.He=this.He.insert(t,n))):Ne(Fa,`removeDocumentFromTarget received document for unknown or inactive target (${e})`)}removeTarget(e){this.je.delete(e)}ct(e){const t=this.je.get(e);if(!t)return 0;const n=t.ke();return this.ze.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}We(e){let t=this.je.get(e);t||(Ne(Fa,`recordPendingTargetRequest set up tracking for target ID ${e}`),t=new Ua(e),this.je.set(e,t)),t.We()}Vt(e){let t=this.Ze.get(e);return t||(t=new vr(Je),this.Ze=this.Ze.insert(e,t)),t}It(e){let t=this.Je.get(e);return t||(t=new vr(Je),this.Je=this.Je.insert(e,t)),t}it(e){const t=null!==this.ut(e);return t||Ne(Fa,"Detected inactive target",e),t}ut(e){const t=this.je.get(e);return void 0===t||t.Le?null:this.ze.dt(e)}st(e){this.je.set(e,new Ua(e)),this.ze.getRemoteKeysForTarget(e).forEach(t=>{this.nt(e,t,null)})}At(e,t){return this.ze.getRemoteKeysForTarget(e).has(t)}}function qa(){return new yr(ot.comparator)}function za(){return new yr(ot.comparator)}const ja={asc:"ASCENDING",desc:"DESCENDING"},Ga={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},$a={and:"AND",or:"OR"};class Ha{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Ka(e,t){return e.useProto3Json||en(t)?t:{value:t}}function Wa(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Ya(e){const t=kr(e);return new vt(t.seconds,t.nanos)}function Qa(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function Ja(e,t){return Wa(e,t.toTimestamp())}function Xa(e){return Pe(!!e,49232),Et.fromTimestamp(Ya(e))}function Za(e,t){return eo(e,t).canonicalString()}function eo(e,t){const n=function(e){return new st(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function to(e){const t=st.fromString(e);return Pe(Ao(t),10190,{key:t.toString()}),t}function no(e,t){return Za(e.databaseId,t.path)}function ro(e,t){const n=to(t);if(n.get(1)!==e.databaseId.projectId)throw new Ue(Ve.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new Ue(Ve.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new ot(oo(n))}function so(e,t){return Za(e.databaseId,t)}function io(e){const t=to(e);return 4===t.length?st.emptyPath():oo(t)}function ao(e){return new st(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function oo(e){return Pe(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function co(e,t,n){return{name:no(e,t),fields:n.value.mapValue.fields}}function uo(e,t,n){const r=ro(e,t.name),s=Xa(t.updateTime),i=t.createTime?Xa(t.createTime):Et.min(),a=new Ss({mapValue:{fields:t.fields}}),o=Pi.newFoundDocument(r,s,i,a);return n&&o.setHasCommittedMutations(),n?o.setHasCommittedMutations():o}function lo(e,t){let n;if(t instanceof ni)n={update:co(e,t.key,t.value)};else if(t instanceof oi)n={delete:no(e,t.key)};else if(t instanceof ri)n={update:co(e,t.key,t.data),updateMask:So(t.fieldMask)};else{if(!(t instanceof ci))return ke(16599,{gt:t.type});n={verify:no(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(e=>function(e,t){const n=t.transform;if(n instanceof Ps)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Ls)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Vs)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Bs)return{fieldPath:t.field.canonicalString(),increment:n.Re};
2if(n instanceof qs)return{fieldPath:t.field.canonicalString(),minimum:n.Re};if(n instanceof zs)return{fieldPath:t.field.canonicalString(),maximum:n.Re};throw ke(20930,{transform:t.transform})}(0,e))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:Ja(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:ke(27497)}(e,t.precondition)),n}function ho(e,t){const n=t.currentDocument?function(e){return void 0!==e.updateTime?Ws.updateTime(Xa(e.updateTime)):void 0!==e.exists?Ws.exists(e.exists):Ws.none()}(t.currentDocument):Ws.none(),r=t.updateTransforms?t.updateTransforms.map(t=>function(e,t){let n=null;if("setToServerValue"in t)Pe("REQUEST_TIME"===t.setToServerValue,16630,{proto:t}),n=new Ps;else if("appendMissingElements"in t){const e=t.appendMissingElements.values||[];n=new Ls(e)}else if("removeAllFromArray"in t){const e=t.removeAllFromArray.values||[];n=new Vs(e)}else"increment"in t?n=new Bs(e,t.increment):"minimum"in t?n=new qs(e,t.minimum):"maximum"in t?n=new zs(e,t.maximum):ke(16584,{proto:t});const r=at.fromServerFormat(t.fieldPath);return new Hs(r,n)}(e,t)):[];if(t.update){t.update.name;const s=ro(e,t.update.name),i=new Ss({mapValue:{fields:t.update.fields}});if(t.updateMask){const e=function(e){const t=e.fieldPaths||[];return new Tr(t.map(e=>at.fromServerFormat(e)))}(t.updateMask);return new ri(s,i,e,n,r)}return new ni(s,i,n,r)}if(t.delete){const r=ro(e,t.delete);return new oi(r,n)}if(t.verify){const r=ro(e,t.verify);return new ci(r,n)}return ke(1463,{proto:t})}function fo(e,t){return{documents:[so(e,t.path)]}}function po(e,t){const n={structuredQuery:{}},r=t.path;let s;null!==t.collectionGroup?(s=r,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=so(e,s);const i=function(e){if(0!==e.length)return bo(mi.create(e,"and"))}(t.filters);i&&(n.structuredQuery.where=i);const a=function(e){if(0!==e.length)return e.map(e=>function(e){return{field:Io(e.field),direction:_o(e.dir)}}(e))}(t.orderBy);a&&(n.structuredQuery.orderBy=a);const o=Ka(e,t.limit);return null!==o&&(n.structuredQuery.limit=o),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{yt:n,parent:s}}function mo(e,t,n,r){const{yt:s,parent:i}=po(e,t),a={},o=[];let c=0;return n.forEach(e=>{const t=r?e.alias:"aggregate_"+c++;a[t]=e.alias,"count"===e.aggregateType?o.push({alias:t,count:{}}):"avg"===e.aggregateType?o.push({alias:t,avg:{field:Io(e.fieldPath)}}):"sum"===e.aggregateType&&o.push({alias:t,sum:{field:Io(e.fieldPath)}})}),{request:{structuredAggregationQuery:{aggregations:o,structuredQuery:s.structuredQuery},parent:s.parent},wt:a,parent:i}}function go(e){let t=io(e.parent);const n=e.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Pe(1===r,65062);const e=n.from[0];e.allDescendants?s=e.collectionId:t=t.child(e.collectionId)}let i=[];n.where&&(i=function(e){const t=wo(e);return t instanceof mi&&wi(t)?t.getFilters():[t]}(n.where));let a=[];n.orderBy&&(a=function(e){return e.map(e=>function(e){return new ki(To(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))}(n.orderBy));let o=null;n.limit&&(o=function(e){let t;return t="object"==typeof e?e.value:e,en(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new li(n,t)}(n.startAt));let u=null;return n.endAt&&(u=function(e){const t=!e.before,n=e.values||[];return new li(n,t)}(n.endAt)),$i(t,s,a,i,o,"F",c,u)}function yo(e,t){return{structuredPipeline:{pipeline:{stages:t.stages.map(t=>t._toProto(e))}}}}function wo(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=To(e.unaryFilter.field);return pi.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=To(e.unaryFilter.field);return pi.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=To(e.unaryFilter.field);return pi.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=To(e.unaryFilter.field);return pi.create(s,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return ke(61313);default:return ke(60726)}}(e):void 0!==e.fieldFilter?function(e){return pi.create(To(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return ke(58110);default:return ke(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return mi.create(e.compositeFilter.filters.map(e=>wo(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return ke(1026)}}(e.compositeFilter.op))}(e):ke(30097,{filter:e})}function _o(e){return ja[e]}function vo(e){return Ga[e]}function Eo(e){return $a[e]}function Io(e){return{fieldPath:e.canonicalString()}}function To(e){return at.fromServerFormat(e.fieldPath)}function bo(e){return e instanceof pi?function(e){if("=="===e.op){if(ps(e.value))return{unaryFilter:{field:Io(e.field),op:"IS_NAN"}};if(fs(e.value))return{unaryFilter:{field:Io(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(ps(e.value))return{unaryFilter:{field:Io(e.field),op:"IS_NOT_NA
2N"}};if(fs(e.value))return{unaryFilter:{field:Io(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Io(e.field),op:vo(e.op),value:e.value}}}(e):e instanceof mi?function(e){const t=e.getFilters().map(e=>bo(e));return 1===t.length?t[0]:{compositeFilter:{op:Eo(e.op),filters:t}}}(e):ke(54877,{filter:e})}function So(e){const t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}function Ao(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}function Co(e){return!!e&&"function"==typeof e._toProto&&"ProtoValue"===e._protoValueType}function No(e,t){const n={fields:{}};return t.forEach((t,r)=>{if("string"!=typeof r)throw new Error(`Cannot encode map with non-string key: ${r}`);n.fields[r]=t._toProto(e)}),{mapValue:n}}function Oo(e){return{stringValue:e}}function Do(e){return new Ha(e,!0)}class Ro{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Ro(Dr.fromBase64String(e))}catch(e){throw new Ue(Ve.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new Ro(Dr.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:Ro._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(yt(e,Ro._jsonSchema))return Ro.fromBase64String(e.bytes)}}Ro._jsonSchemaVersion="firestore/bytes/1.0",Ro._jsonSchema={type:gt("string",Ro._jsonSchemaVersion),bytes:gt("string")};class ko{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new Ue(Ve.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new at(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function xo(){return new ko(nt)}class Po{constructor(e){this._methodName=e}}class Lo{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new Ue(Ve.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new Ue(Ve.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Je(this._lat,e._lat)||Je(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Lo._jsonSchemaVersion}}static fromJSON(e){if(yt(e,Lo._jsonSchema))return new Lo(e.latitude,e.longitude)}}function Mo(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}Lo._jsonSchemaVersion="firestore/geoPoint/1.0",Lo._jsonSchema={type:gt("string",Lo._jsonSchemaVersion),latitude:gt("number"),longitude:gt("number")};class Vo{bt(e){}shutdown(){}}const Uo="ConnectivityMonitor";class Fo{constructor(){this.vt=()=>this.St(),this.Dt=()=>this.xt(),this.Ct=[],this.Ft()}bt(e){this.Ct.push(e)}shutdown(){window.removeEventListener("online",this.vt),window.removeEventListener("offline",this.Dt)}Ft(){window.addEventListener("online",this.vt),window.addEventListener("offline",this.Dt)}St(){Ne(Uo,"Network connectivity changed: AVAILABLE");for(const e of this.Ct)e(0)}xt(){Ne(Uo,"Network connectivity changed: UNAVAILABLE");for(const e of this.Ct)e(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let Bo=null;function qo(){return null===Bo?Bo=268435456+Math.round(2147483648*Math.random()):Bo++,"0x"+Bo.toString(16)}const zo="RestConnection",jo={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class Go{get Ot(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.Mt=t+"://"+e.host,this.Nt=`projects/${n}/databases/${r}`,this.Lt=this.databaseId.database===jr?`project_id=${n}`:`project_id=${n}&database_id=${r}`}
2Bt(e,t,n,r,s){const i=qo(),a=this.Ut(e,t.toUriEncodedString());Ne(zo,`Sending RPC '${e}' ${i}:`,a,n);const c={"google-cloud-resource-prefix":this.Nt,"x-goog-request-params":this.Lt};this.kt(c,r,s);const{host:u}=new URL(a),l=(0,o.zJ)(u);return this.qt(e,a,c,n,l).then(t=>(Ne(zo,`Received RPC '${e}' ${i}: `,t),t),t=>{throw De(zo,`RPC '${e}' ${i} failed with error: `,t,"url: ",a,"request:",n),t})}$t(e,t,n,r,s,i){return this.Bt(e,t,n,r,s)}kt(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+be,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((t,n)=>e[n]=t),n&&n.headers.forEach((t,n)=>e[n]=t)}Ut(e,t){const n=jo[e];let r=`${this.Mt}/v1/${t}:${n}`;return this.databaseInfo.apiKey&&(r=`${r}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),r}terminate(){}}class $o{constructor(e){this.Kt=e.Kt,this.Wt=e.Wt}Qt(e){this.Gt=e}zt(e){this.jt=e}Ht(e){this.Jt=e}onMessage(e){this.Yt=e}close(){this.Wt()}send(e){this.Kt(e)}Zt(){this.Gt()}Xt(){this.jt()}en(e){this.Jt(e)}tn(e){this.Yt(e)}}const Ho="WebChannelConnection",Ko=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};class Wo extends Go{constructor(e){super(e),this.nn=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static rn(){if(!Wo.sn){const e=g();Ko(e,m.STAT_EVENT,e=>{e.stat===p.PROXY?Ne(Ho,"STAT_EVENT: detected buffering proxy"):e.stat===p.NOPROXY&&Ne(Ho,"STAT_EVENT: detected no buffering proxy")}),Wo.sn=!0}}qt(e,t,n,r,s){const i=qo();return new Promise((s,a)=>{const o=new l;o.setWithCredentials(!0),o.listenOnce(d.COMPLETE,()=>{try{switch(o.getLastErrorCode()){case f.NO_ERROR:const t=o.getResponseJson();Ne(Ho,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(t)),s(t);break;case f.TIMEOUT:Ne(Ho,`RPC '${e}' ${i} timed out`),a(new Ue(Ve.DEADLINE_EXCEEDED,"Request time out"));break;case f.HTTP_ERROR:const n=o.getStatus();if(Ne(Ho,`RPC '${e}' ${i} failed with status:`,n,"response text:",o.getResponseText()),n>0){let e=o.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=e?.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(Ve).indexOf(t)>=0?t:Ve.UNKNOWN}(t.status);a(new Ue(e,t.message))}else a(new Ue(Ve.UNKNOWN,"Server responded with status "+o.getStatus()))}else a(new Ue(Ve.UNAVAILABLE,"Connection failed."));break;default:ke(9055,{_n:e,streamId:i,an:o.getLastErrorCode(),un:o.getLastError()})}}finally{Ne(Ho,`RPC '${e}' ${i} completed.`)}});const c=JSON.stringify(r);Ne(Ho,`RPC '${e}' ${i} sending request:`,r),o.send(t,"POST",c,n,15)})}cn(e,t,n){const r=qo(),s=[this.Mt,"/","google.firestore.v1.Firestore","/",e,"/channel"],i=this.createWebChannelTransport(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},o=this.longPollingOptions.timeoutSeconds;void 0!==o&&(a.longPollingTimeout=Math.round(1e3*o)),this.useFetchStreams&&(a.useFetchStreams=!0),this.kt(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const c=s.join("");Ne(Ho,`Creating RPC '${e}' stream ${r}: ${c}`,a);const u=i.createWebChannel(c,a);this.En(u);let l=!1,d=!1;const f=new $o({Kt:t=>{d?Ne(Ho,`Not sending because RPC '${e}' stream ${r} is closed:`,t):(l||(Ne(Ho,`Opening RPC '${e}' stream ${r} transport.`),u.open(),l=!0),Ne(Ho,`RPC '${e}' stream ${r} sending:`,t),u.send(t))},Wt:()=>u.close()});return Ko(u,h.EventType.OPEN,()=>{d||(Ne(Ho,`RPC '${e}' stream ${r} transport opened.`),f.Zt())}),Ko(u,h.EventType.CLOSE,()=>{d||(d=!0,Ne(Ho,`RPC '${e}' stream ${r} transport closed`),f.en(),this.hn(u))}),Ko(u,h.EventType.ERROR,t=>{d||(d=!0,De(Ho,`RPC '${e}' stream ${r} transport errored. Name:`,t.name,"Message:",t.message),f.en(new Ue(Ve.UNAVAILABLE,"The operation could not be completed")))}),Ko(u,h.EventType.MESSAGE,t=>{if(!d){const n=t.data[0];Pe(!!n,16349);const s=n,i=s?.error||s[0]?.error;if(i){Ne(Ho,`RPC '${e}' stream ${r} received error:`,i);const t=i.status;let n=function(e){const t=ca[e];if(void 0!==t)return ha(t)}(t),s=i.message;"NOT_FOUND"===t&&s.includes("database")&&s.includes("does not exist")&&s.includes(this.databaseId.database)&&De(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),void 0===n&&(n=Ve.INTERNAL,s="Unknown error status: "+t+" with message "+i.message),d=!0,f.en(new Ue(n,s)),u.close()}else Ne(Ho,`RPC '${e}' stream ${r} received:`,n),f.tn(n)}}),Wo.rn(),setTimeout(()=>{f.Xt()},0),f}
2terminate(){this.nn.forEach(e=>e.close()),this.nn=[]}En(e){this.nn.push(e)}hn(e){this.nn=this.nn.filter(t=>t===e)}kt(e,t,n){super.kt(e,t,n),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return y()}}function Yo(e){return new Wo(e)}Wo.sn=!1;class Qo{constructor(e,t,n=1e3,r=1.5,s=6e4){this.Tn=e,this.timerId=t,this.Pn=n,this.Rn=r,this.In=s,this.An=0,this.Vn=null,this.dn=Date.now(),this.reset()}reset(){this.An=0}fn(){this.An=this.In}mn(e){this.cancel();const t=Math.floor(this.An+this.pn()),n=Math.max(0,Date.now()-this.dn),r=Math.max(0,t-n);r>0&&Ne("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.An} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Vn=this.Tn.enqueueAfterDelay(this.timerId,r,()=>(this.dn=Date.now(),e())),this.An*=this.Rn,this.An<this.Pn&&(this.An=this.Pn),this.An>this.In&&(this.An=this.In)}gn(){null!==this.Vn&&(this.Vn.skipDelay(),this.Vn=null)}cancel(){null!==this.Vn&&(this.Vn.cancel(),this.Vn=null)}pn(){return(Math.random()-.5)*this.An}}const Jo="PersistentStream";class Xo{constructor(e,t,n,r,s,i,a,o){this.Tn=e,this.yn=n,this.wn=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=a,this.listener=o,this.state=0,this.bn=0,this.vn=null,this.Sn=null,this.stream=null,this.Dn=0,this.xn=new Qo(e,t)}Cn(){return 1===this.state||5===this.state||this.Fn()}Fn(){return 2===this.state||3===this.state}start(){this.Dn=0,4!==this.state?this.auth():this.On()}async stop(){this.Cn()&&await this.close(0)}Mn(){this.state=0,this.xn.reset()}Nn(){this.Fn()&&null===this.vn&&(this.vn=this.Tn.enqueueAfterDelay(this.yn,6e4,()=>this.Ln()))}Bn(e){this.Un(),this.stream.send(e)}async Ln(){if(this.Fn())return this.close(0)}Un(){this.vn&&(this.vn.cancel(),this.vn=null)}kn(){this.Sn&&(this.Sn.cancel(),this.Sn=null)}async close(e,t){this.Un(),this.kn(),this.xn.cancel(),this.bn++,4!==e?this.xn.reset():t&&t.code===Ve.RESOURCE_EXHAUSTED?(Oe(t.toString()),Oe("Using maximum backoff delay to prevent overloading the backend."),this.xn.fn()):t&&t.code===Ve.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.qn(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Ht(t)}qn(){}auth(){this.state=1;const e=this.$n(this.bn),t=this.bn;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.bn===t&&this.Kn(e,n)},t=>{e(()=>{const e=new Ue(Ve.UNKNOWN,"Fetching auth token failed: "+t.message);return this.Wn(e)})})}Kn(e,t){const n=this.$n(this.bn);this.stream=this.Qn(e,t),this.stream.Qt(()=>{n(()=>this.listener.Qt())}),this.stream.zt(()=>{n(()=>(this.state=2,this.Sn=this.Tn.enqueueAfterDelay(this.wn,1e4,()=>(this.Fn()&&(this.state=3),Promise.resolve())),this.listener.zt()))}),this.stream.Ht(e=>{n(()=>this.Wn(e))}),this.stream.onMessage(e=>{n(()=>1==++this.Dn?this.Gn(e):this.onNext(e))})}On(){this.state=5,this.xn.mn(async()=>{this.state=0,this.start()})}Wn(e){return Ne(Jo,`close with error: ${e}`),this.stream=null,this.close(4,e)}$n(e){return t=>{this.Tn.enqueueAndForget(()=>this.bn===e?t():(Ne(Jo,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class Zo extends Xo{constructor(e,t,n,r,s,i){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,r,i),this.serializer=s}Qn(e,t){return this.connection.cn("Listen",e,t)}Gn(e){return this.onNext(e)}onNext(e){this.xn.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const r=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:ke(39313,{state:e})}(t.targetChange.targetChangeType||"NO_CHANGE"),s=t.targetChange.targetIds||[],i=function(e,t){return e.useProto3Json?(Pe(void 0===t||"string"==typeof t,58123),Dr.fromBase64String(t||"")):(Pe(void 0===t||t instanceof Buffer||t instanceof Uint8Array,16193),Dr.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),a=t.targetChange.cause,o=a&&function(e){const t=void 0===e.code?Ve.UNKNOWN:ha(e.code);return new Ue(t,e.message||"")}(a);n=new Va(r,s,i,o||null)}else if("documentChange"in t){t.documentChange;const r=t.documentChange;r.document,r.document.name,r.document.updateTime;const s=ro(e,r.document.name),i=Xa(r.document.updateTime),a=r.document.createTime?Xa(r.document.createTime):Et.min(),o=new Ss({mapValue:{fields:r.document.fields}}),c=Pi.newFoundDocument(s,i,a,o),u=r.targetIds||[],l=r.removedTargetIds||[];n=new La(u,l,c.key,c)}else if("documentDelete"in t){t.documentDelete;const r=t.documentDelete;r.document;const s=ro(e,r.document),i=r.readTime?Xa(r.readTime):Et.min(),a=Pi.newNoDocument(s,i),o=r.removedTargetIds||[];n=new La([],o,a.key,a)}else if("documentRemove"in t){t.documentRemove;const r=t.documentRemove;r.document;const s=ro(e,r.document),i=r.removedTargetIds||[];n=new La([],i,s,null)}else{if(!("filter"in t))return ke(11601,{ft:t});{t.filter;const e=t.filter;e.targetId;const{count:r=0,unchangedNames:s}=e,i=new oa(r,s),a=e.targetId;n=new Ma(a,i)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return Et.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?Et.min():t.readTime?Xa(t.readTime):Et.min()}(e);return this.listener.zn(t,n)}jn(e){const t={};t.database=ao(this.serializer),t.addTarget=function(e,t){let n;const r=t.target;if(n=Fi(r)?{pipelineQuery:yo(e,r)}:Bi(r)?{documents:fo(e,r)}:{query:po(e,r).yt},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=Qa(e,t.resumeToken);const r=Ka(e,t.expectedCount);null!==r&&(n.expectedCount=r)}else if(t.snapshotVersion.compareTo(Et.min())>0){n.readTime=Wa(e,t.snapshotVersion.toTimestamp());const r=Ka(e,t.expectedCount);null!==r&&(n.expectedCount=r)}return n}(this.serializer,e);const n=function(e,t){const n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return ke(28987,{purpose:e})}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.Bn(t)}Hn(e){const t={};t.database=ao(this.serializer),t.removeTarget=e,this.Bn(t)}}class ec extends Xo{constructor(e,t,n,r,s,i){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,r,i),this.serializer
2=s}get Jn(){return this.Dn>0}start(){this.lastStreamToken=void 0,super.start()}qn(){this.Jn&&this.Yn([])}Qn(e,t){return this.connection.cn("Write",e,t)}Gn(e){return Pe(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Pe(!e.writeResults||0===e.writeResults.length,55816),this.listener.Zn()}onNext(e){Pe(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.xn.reset();const t=function(e,t){return e&&e.length>0?(Pe(void 0!==t,14353),e.map(e=>function(e,t){let n=e.updateTime?Xa(e.updateTime):Xa(t);return n.isEqual(Et.min())&&(n=Xa(t)),new Ks(n,e.transformResults||[])}(e,t))):[]}(e.writeResults,e.commitTime),n=Xa(e.commitTime);return this.listener.Xn(n,t)}er(){const e={};e.database=ao(this.serializer),this.Bn(e)}Yn(e){const t={streamToken:this.lastStreamToken,writes:e.map(e=>lo(this.serializer,e))};this.Bn(t)}}class tc{}class nc extends tc{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.tr=!1}nr(){if(this.tr)throw new Ue(Ve.FAILED_PRECONDITION,"The client has already been terminated.")}Bt(e,t,n,r){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,i])=>this.connection.Bt(e,eo(t,n),r,s,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===Ve.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new Ue(Ve.UNKNOWN,e.toString())})}$t(e,t,n,r,s){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,a])=>this.connection.$t(e,eo(t,n),r,i,a,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===Ve.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new Ue(Ve.UNKNOWN,e.toString())})}terminate(){this.tr=!0,this.connection.terminate()}}function rc(e,t,n,r){return new nc(e,t,n,r)}const sc="ComponentProvider",ic=new Map;function ac(e,t,n,r,s){return new zr(e,t,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,Mo(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,r)}const oc={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},cc=41943040;class uc{static withCacheSize(e){return new uc(e,uc.DEFAULT_COLLECTION_PERCENTILE,uc.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}}uc.DEFAULT_COLLECTION_PERCENTILE=10,uc.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,uc.DEFAULT=new uc(cc,uc.DEFAULT_COLLECTION_PERCENTILE,uc.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),uc.DISABLED=new uc(-1,0,0);const lc="LruGarbageCollector",hc=1048576;function dc([e,t],[n,r]){const s=Je(e,n);return 0===s?Je(t,r):s}class fc{constructor(e){this.rr=e,this.buffer=new vr(dc),this.ir=0}sr(){return++this.ir}_r(e){const t=[e,this.sr()];if(this.buffer.size<this.rr)this.buffer=this.buffer.add(t);else{const e=this.buffer.last();dc(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}}class pc{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.ar=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.ur(6e4)}stop(){this.ar&&(this.ar.cancel(),this.ar=null)}get started(){return null!==this.ar}ur(e){Ne(lc,`Garbage collection scheduled in ${e}ms`),this.ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){Gt(e)?Ne(lc,"Ignoring IndexedDB error during garbage collection: ",e):await Mt(e)}await this.ur(3e5)})}}class mc{constructor(e,t){this.cr=e,this.params=t}calculateTargetCount(e,t){return this.cr.lr(e).next(e=>Math.floor(t/100*e))}nthSequenceNumber(e,t){if(0===t)return Vt.resolve(Xt.ce);const n=new fc(t);return this.cr.forEachTarget(e,e=>n._r(e.sequenceNumber)).next(()=>this.cr.Er(e,e=>n._r(e))).next(()=>n.maxValue)}removeTargets(e,t,n){return this.cr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.cr.removeOrphanedDocuments(e,t)}collect(e,t){return-1===this.params.cacheSizeCollectionThreshold?(Ne("LruGarbageCollector","Garbage collection skipped; disabled"),Vt.resolve(oc)):this.getCacheSize(e).next(n=>n<this.params.cacheSizeCollectionThreshold?(Ne("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),oc):this.hr(e,t))}getCacheSize(e){return this.cr.getCacheSize(e)}hr(e,t){let n,r,s,i,a,o,c;const u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(t=>(t>this.params.maximumSequenceNumbersToCollect?(Ne("LruGarbageCollector",`C
2apping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),r=this.params.maximumSequenceNumbersToCollect):r=t,i=Date.now(),this.nthSequenceNumber(e,r))).next(r=>(n=r,a=Date.now(),this.removeTargets(e,n,t))).next(t=>(s=t,o=Date.now(),this.removeOrphanedDocuments(e,n))).next(e=>(c=Date.now(),Ae()<=w.$b.DEBUG&&Ne("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${i-u}ms\n\tDetermined least recently used ${r} in `+(a-i)+"ms\n"+`\tRemoved ${s} targets in `+(o-a)+"ms\n"+`\tRemoved ${e} documents in `+(c-o)+"ms\n"+`Total Duration: ${c-u}ms`),Vt.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:s,documentsRemoved:e})))}}function gc(e,t){return new mc(e,t)}const yc="firestore.googleapis.com",wc=!0;class _c{constructor(e){if(void 0===e.host){if(void 0!==e.ssl)throw new Ue(Ve.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=yc,this.ssl=wc}else this.host=e.host,this.ssl=e.ssl??wc;if(this.isUsingEmulator=void 0!==e.emulatorOptions,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=cc;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<hc)throw new Ue(Ve.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}ut("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Mo(e.experimentalLongPollingOptions??{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new Ue(Ve.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new Ue(Ve.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new Ue(Ve.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class vc{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new _c({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Ue(Ve.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new Ue(Ve.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 _c(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new qe;switch(e.type){case"firstParty":return new $e(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new Ue(Ve.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
2d credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=ic.get(e);t&&(Ne(sc,"Removing Datastore"),ic.delete(e),t.terminate())}(this),Promise.resolve()}}function Ec(e,t,n,r={}){e=pt(e,vc);const s=(0,o.zJ)(t),i=e._getSettings(),a={...i,emulatorOptions:e._getEmulatorOptions()},c=`${t}:${n}`;s&&(0,o.gE)(`https://${c}`),i.host!==yc&&i.host!==c&&De("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u={...i,host:c,ssl:s,emulatorOptions:r};if(!(0,o.bD)(u,a)&&(e._setSettings(u),r.mockUserToken)){let t,n;if("string"==typeof r.mockUserToken)t=r.mockUserToken,n=Te.MOCK_USER;else{t=(0,o.Fy)(r.mockUserToken,e._app?.options.projectId);const s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new Ue(Ve.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Te(s)}e._authCredentials=new ze(new Be(t,n))}}class Ic{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new Ic(this.firestore,e,this._query)}}class Tc{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new bc(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Tc(this.firestore,e,this._key)}toJSON(){return{type:Tc._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(yt(t,Tc._jsonSchema))return new Tc(e,n||null,new ot(st.fromString(t.referencePath)))}}Tc._jsonSchemaVersion="firestore/documentReference/1.0",Tc._jsonSchema={type:gt("string",Tc._jsonSchemaVersion),referencePath:gt("string")};class bc extends Ic{constructor(e,t,n){super(e,t,Hi(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Tc(this.firestore,null,new ot(e))}withConverter(e){return new bc(this.firestore,e,this._path)}}function Sc(e,t,...n){if(e=(0,o.Ku)(e),ct("collection","path",t),e instanceof vc){const r=st.fromString(t,...n);return ht(r),new bc(e,null,r)}{if(!(e instanceof Tc||e instanceof bc))throw new Ue(Ve.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(st.fromString(t,...n));return ht(r),new bc(e.firestore,null,r)}}function Ac(e,t){if(e=pt(e,vc),ct("collectionGroup","collection id",t),t.indexOf("/")>=0)throw new Ue(Ve.INVALID_ARGUMENT,`Invalid collection ID '${t}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new Ic(e,null,function(e){return new Gi(st.emptyPath(),e)}(t))}function Cc(e,t,...n){if(e=(0,o.Ku)(e),1===arguments.length&&(t=Qe.newId()),ct("doc","path",t),e instanceof vc){const r=st.fromString(t,...n);return lt(r),new Tc(e,null,new ot(r))}{if(!(e instanceof Tc||e instanceof bc))throw new Ue(Ve.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(st.fromString(t,...n));return lt(r),new Tc(e.firestore,e instanceof bc?e.converter:null,new ot(r))}}function Nc(e,t){return e=(0,o.Ku)(e),t=(0,o.Ku)(t),(e instanceof Tc||e instanceof bc)&&(t instanceof Tc||t instanceof bc)&&e.firestore===t.firestore&&e.path===t.path&&e.converter===t.converter}function Oc(e,t){return e=(0,o.Ku)(e),t=(0,o.Ku)(t),e instanceof Ic&&t instanceof Ic&&e.firestore===t.firestore&&na(e._query,t._query)&&e.converter===t.converter}class Dc{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:Dc._jsonSchemaVersion,vectorValues:this._values}}
vendor: 5,462 bytes, line 2
2static fromJSON(e){if(yt(e,Dc._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new Dc(e.vectorValues);throw new Ue(Ve.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Dc._jsonSchemaVersion="firestore/vectorValue/1.0",Dc._jsonSchema={type:gt("string",Dc._jsonSchemaVersion),vectorValues:gt("object")};const Rc=/^__.*__$/;class kc{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new ri(e,this.data,this.fieldMask,t,this.fieldTransforms):new ni(e,this.data,t,this.fieldTransforms)}}class xc{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new ri(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function Pc(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ke(40011,{dataSource:e})}}class Lc{constructor(e,t,n,r,s,i){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===s&&this.validatePath(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(e){return new Lc({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){const t=this.path?.child(e),n=this.contextWith({path:t,arrayElement:!1});return n.validatePathSegment(e),n}childContextForFieldPath(e){const t=this.path?.child(e),n=this.contextWith({path:t,arrayElement:!1});return n.validatePath(),n}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return ru(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(0===e.length)throw this.createError("Document fields must not be empty");if(Pc(this.dataSource)&&Rc.test(e))throw this.createError('Document fields cannot begin and end with "__"')}}class Mc{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||Do(e)}createContext(e,t,n,r=!1){return new Lc({dataSource:e,methodName:t,targetDoc:n,path:at.emptyPath(),arrayElement:!1,hasConverter:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Vc(e){const t=e._freezeSettings(),n=Do(e._databaseId);return new Mc(e._databaseId,!!t.ignoreUndefinedProperties,n)}function Uc(e,t,n,r,s,i={}){const a=e.createContext(i.merge||i.mergeFields?2:0,t,n,s);Zc("Data must be an object, but it was:",a,r);const o=Jc(r,a);let c,u;if(i.merge)c=new Tr(a.fieldMask),u=a.fieldTransforms;else if(i.mergeFields){const e=[];for(const r of i.mergeFields){const s=eu(t,r,n);if(!a.contains(s))throw new Ue(Ve.INVALID_ARGUMENT,`Field '${s}' is specified in your field mask but missing from your input data.`);su(e,s)||e.push(s)}c=new Tr(e),u=a.fieldTransforms.filter(e=>c.covers(e.field))}else c=null,u=a.fieldTransforms;return new kc(new Ss(o),c,u)}class Fc extends Po{_toFieldTransform(e){if(2!==e.dataSource)throw 1===e.dataSource?e.createError(`${this._methodName}() can only appear at the top level of your update data`):e.createError(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Fc}}function Bc(e,t,n){return new Lc({dataSource:3,targetDoc:t.settings.targetDoc,methodName:e._methodName,arrayElement:n},t.databaseId,t.serializer,t.ignoreUndefinedProperties)}class qc extends Po{_toFieldTransform(e){return new Hs(e.path,new Ps)}isEqual(e){return e instanceof qc}}class zc extends Po{constructor(e,t){super(e),this.Tr=t}_toFieldTransform(e){const t=Bc(this,e,!0),n=this.Tr.map(e=>Qc(e,t)),r=new Ls(n);return new Hs(e.path,r)}isEqual(e){return e instanceof zc&&(0,o.bD)(this.Tr,e.Tr)}}class jc extends Po{constructor(e,t){super(e),this.Tr=t}_toFieldTransform(e){const t=Bc(this,e,!0),n=this.Tr.map(e=>Qc(e,t)),r=new Vs(n);return new Hs(e.path,r)}isEqual(e){return e instanceof jc&&(0,o.bD)(this.Tr,e.Tr)}}class Gc extends Po{constructor(e,t){super(e),this.Pr=t}_toFieldTransform(e){const t=new Bs(e.serializer,Os(e.serializer,this.Pr));return new Hs(e.path,t)}isEqual(e){return e instanceof Gc&&(this.Pr===e.Pr||Number.isNaN(this.Pr)&&Number.isNaN(e.Pr))}}class $c extends Po{constructor(e,t){super(e),this.Pr=t}_toFieldTransform(e){const t=new qs(e.serializer,Os(e.serializer,this.Pr));return new Hs(e.path,t)}isEqual(e){return e instanceof $c&&(this.Pr===e.Pr||Number.isNaN(this.Pr)&&Number.isNaN(e.Pr))}}class Hc extends Po{constructor(e,t){super(e),this.Pr=t}_toFieldTransform(e){const t=new zs(e.serializer,Os(e.serializer,this.Pr));return new Hs(e.path,t)}isEqual(e){return e instanceof Hc&&(this.Pr===e.Pr||Number.isNaN(this.Pr)&&Number.isNaN(e.Pr))}}function Kc(e,t,n,r){const s=e.createContext(1,t,n);Zc("Data must be an object, but it was:",s,r);const i=[],a=Ss.empty();Sr(r,(e,r)=>{const c=nu(t,e,n);r=(0,o.Ku)(r);const u=s.childContextForFieldPath(c);if(r instanceof Fc)i.push(c);else{const e=Qc(r,u);null!=e&&(i.push(c),a.set(c,e))}});const c=new Tr(i);return new xc(a,c,s.fieldTransforms)}function Wc(e,t,n,r,s,i){const a=e.createContext(1,t,n),c=[eu(t,r,n)],u=[s];
2if(i.length%2!=0)throw new Ue(Ve.INVALID_ARGUMENT,`Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let e=0;e<i.length;e+=2)c.push(eu(t,i[e])),u.push(i[e+1]);const l=[],h=Ss.empty();for(let e=c.length-1;e>=0;--e)if(!su(l,c[e])){const t=c[e];let n=u[e];n=(0,o.Ku)(n);const r=a.childContextForFieldPath(t);if(n instanceof Fc)l.push(t);else{const e=Qc(n,r);null!=e&&(l.push(t),h.set(t,e))}}const d=new Tr(l);return new xc(h,d,a.fieldTransforms)}function Yc(e,t,n,r=!1){return Qc(n,e.createContext(r?4:3,t))}function Qc(e,t,n){if(Xc(e=(0,o.Ku)(e)))return Zc("Unsupported field value:",t,e),Jc(e,t);if(e instanceof Po)return function(e,t){if(!Pc(t.dataSource))throw t.createError(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.createError(`${e._methodName}() is not currently supported inside arrays`);const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.arrayElement&&4!==t.dataSource)throw t.createError("Nested arrays are not supported");return function(e,t){const n=[];let r=0;for(const s of e){let e=Qc(s,t.childContextForArray(r));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),r++}return{arrayValue:{values:n}}}(e,t)}return function(e,t,n){if(null===(e=(0,o.Ku)(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return Os(t.serializer,e,n);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=vt.fromDate(e);return{timestampValue:Wa(t.serializer,n)}}if(e instanceof vt){const n=new vt(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Wa(t.serializer,n)}}if(e instanceof Lo)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof Ro)return{bytesValue:Qa(t.serializer,e._byteString)};if(e instanceof Tc){const n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.createError(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Za(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof Dc)return function(e,t){const n=e instanceof Dc?e.toArray():e,r={fields:{[$r]:{stringValue:Wr},[Yr]:{arrayValue:{values:n.map(e=>{if("number"!=typeof e)throw t.createError("VectorValues must only contain numeric values.");return Cs(t.serializer,e)})}}}};return{mapValue:r}}(e,t);if(Co(e))return e._toProto(t.serializer);throw t.createError(`Unsupported field value: ${ft(e)}`)}(e,t,n)}function Jc(e,t){const n={};return Cr(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):Sr(e,(e,r)=>{const s=Qc(r,t.childContextForField(e));null!=s&&(n[e]=s)}),{mapValue:{fields:n}}}function Xc(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof vt||e instanceof Lo||e instanceof Ro||e instanceof Tc||e instanceof Po||e instanceof Dc||Co(e))}function Zc(e,t,n){if(!Xc(n)||!dt(n)){const r=ft(n);throw"an object"===r?t.createError(e+" a custom object"):t.createError(e+" "+r)}}function eu(e,t,n){if((t=(0,o.Ku)(t))instanceof ko)return t._internalPath;if("string"==typeof t)return nu(e,t);throw ru("Field path arguments must be of type string or ",e,!1,void 0,n)}
vendor: 15,936 bytes, line 2
2const tu=new RegExp("[~\\*/\\[\\]]");function nu(e,t,n){if(t.search(tu)>=0)throw ru(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new ko(...t.split("."))._internalPath}catch(r){throw ru(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function ru(e,t,n,r,s){const i=r&&!r.isEmpty(),a=void 0!==s;let o=`Function ${t}() called with invalid data`;n&&(o+=" (via `toFirestore()`)"),o+=". ";let c="";return(i||a)&&(c+=" (found",i&&(c+=` in field ${r}`),a&&(c+=` in document ${s}`),c+=")"),new Ue(Ve.INVALID_ARGUMENT,o+e+c)}function su(e,t){return e.some(e=>e.isEqual(t))}function iu(e){return"function"==typeof e._readUserData}class au{constructor(e){this.optionDefinitions=e}_getKnownOptions(e,t){const n=Ss.empty();for(const r in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(r)){const s=this.optionDefinitions[r];if(r in e){const i=e[r];let a;s.nestedOptions&&dt(i)?a={mapValue:{fields:new au(s.nestedOptions).getOptionsProto(t,i)}}:i&&(a=Qc(i,t)??void 0),a&&n.set(at.fromServerFormat(s.serverName),a)}}return n}getOptionsProto(e,t,n){const r=this._getKnownOptions(t,e);if(n){const t=new Map(Ar(n,(t,n)=>[at.fromServerFormat(n),void 0!==t?Qc(t,e):null]));r.setAll(t)}return r.value.mapValue.fields??{}}}function ou(){return new Fc("deleteField")}function cu(){return new qc("serverTimestamp")}function uu(...e){return new zc("arrayUnion",e)}function lu(...e){return new jc("arrayRemove",e)}function hu(e){return new Gc("increment",e)}function du(e){return new $c("minimum",e)}function fu(e){return new Hc("maximum",e)}function pu(e){return new Dc(e)}function mu(e){let t;return e instanceof wu?e:(t=dt(e)?xu(e):e instanceof Array?function(e){return function(e,t){return new Nu("array",e.map(e=>mu(e)),t)}(e,"array")}(e):Cu(e,void 0),t)}function gu(e){if(e instanceof wu)return e;if(e instanceof Dc)return Au(e);if(Array.isArray(e))return Au(pu(e));throw new Error("Unsupported value: "+typeof e)}function yu(e){return rn(e)?bu(e):mu(e)}class wu{constructor(){this._protoValueType="ProtoValue"}add(e){return new Nu("add",[this,mu(e)],"add")}asBoolean(){if(this instanceof Ou)return this;if(this instanceof Su)return new Ru(this);if(this instanceof Tu)return new ku(this);if(this instanceof Nu)return new Du(this);throw new Ue("invalid-argument",`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(e){return new Nu("subtract",[this,mu(e)],"subtract")}multiply(e){return new Nu("multiply",[this,mu(e)],"multiply")}divide(e){return new Nu("divide",[this,mu(e)],"divide")}mod(e){return new Nu("mod",[this,mu(e)],"mod")}equal(e){return new Nu("equal",[this,mu(e)],"equal").asBoolean()}notEqual(e){return new Nu("not_equal",[this,mu(e)],"notEqual").asBoolean()}lessThan(e){return new Nu("less_than",[this,mu(e)],"lessThan").asBoolean()}lessThanOrEqual(e){return new Nu("less_than_or_equal",[this,mu(e)],"lessThanOrEqual").asBoolean()}greaterThan(e){return new Nu("greater_than",[this,mu(e)],"greaterThan").asBoolean()}greaterThanOrEqual(e){return new Nu("greater_than_or_equal",[this,mu(e)],"greaterThanOrEqual").asBoolean()}arrayConcat(e,...t){const n=[e,...t].map(e=>mu(e));return new Nu("array_concat",[this,...n],"arrayConcat")}arrayContains(e){return new Nu("array_contains",[this,mu(e)],"arrayContains").asBoolean()}arrayContainsAll(e){const t=Array.isArray(e)?new Iu(e.map(mu),"arrayContainsAll"):e;return new Nu("array_contains_all",[this,t],"arrayContainsAll").asBoolean()}arrayContainsAny(e){const t=Array.isArray(e)?new Iu(e.map(mu),"arrayContainsAny"):e;return new Nu("array_contains_any",[this,t],"arrayContainsAny").asBoolean()}arrayReverse(){return new Nu("array_reverse",[this])}arrayLength(){return new Nu("array_length",[this],"arrayLength")}equalAny(e){const t=Array.isArray(e)?new Iu(e.map(mu),"equalAny"):e;return new Nu("equal_any",[this,t],"equalAny").asBoolean()}notEqualAny(e){const t=Array.isArray(e)?new Iu(e.map(mu),"notEqualAny"):e;return new Nu("not_equal_any",[this,t],"notEqualAny").asBoolean()}exists(){return new Nu("exists",[this],"exists").asBoolean()}charLength(){return new Nu("char_length",[this],"charLength")}like(e){return new Nu("like",[this,mu(e)],"like").asBoolean()}regexContains(e){return new Nu("regex_contains",[this,mu(e)],"regexContains").asBoolean()}regexFind(e){return new Nu("regex_find",[this,mu(e)],"regexFind")}regexFindAll(e){return new Nu("regex_find_all",[this,mu(e)],"regexFindAll")}regexMatch(e){return new Nu("regex_match",[this,mu(e)],"regexMatch").asBoolean()}stringContains(e){return new Nu("string_contains",[this,mu(e)],"stringContains").asBoolean()}startsWith(e){return new Nu("starts_with",[this,mu(e)],"startsWith").asBoolean()}endsWith(e){return new Nu("ends_with",[this,mu(e)],"endsWith").asBoolean()}toLower(){return new Nu("to_lower",[this],"toLower")}toUpper(){return new Nu("to_upper",[this],"toUpper")}trim(e){const t=[this];return e&&t.push(mu(e)),new Nu("trim",t,"trim")}ltrim(e){const t=[this];return e&&t.push(mu(e)),new Nu("ltrim",t,"ltrim")}rtrim(e){const t=[this];return e&&t.push(mu(e)),new Nu("rtrim",t,"rtrim")}type(){return new Nu("type",[this])}isType(e){return new Nu("is_type",[this,Au(e)],"isType").asBoolean()}stringConcat(e,...t){const n=[e,...t].map(mu);return new Nu("string_concat",[this,...n],"stringConcat")}stringIndexOf(e){return new Nu("string_index_of",[this,mu(e)],"stringIndexOf")}stringRepeat(e){return new Nu("string_repeat",[this,mu(e)],"stringRepeat")}stringReplaceAll(e,t){return new Nu("string_replace_all",[this,mu(e),mu(t)],"stringReplaceAll")}stringReplaceOne(e,t){return new Nu("string_replace_one",[this,mu(e),mu(t)],"stringReplaceOne")}concat(e,...t){const n=[e,...t].map(mu);return new Nu("concat",[this,...n],"concat")}reverse(){return new Nu("reverse",[this],"reverse")}arrayFilter(e,t){return new Nu("array_filter",[this,mu(e),t],"arrayFilter")}arrayTransform(e,t){return new Nu("array_transform",[this,mu(e),t],"arrayTransform")}arrayTransformWithIndex(e,t,n){return new Nu("array_transform",[this,mu(e),mu(t),n],"arrayTransformWithIndex")}arraySlice(e,t){const n=[this,mu(e)];return void 0!==t&&n.push(mu(t)),new Nu("array_slice",n,"arraySlice")}arrayFirst(){return new Nu("array_first",[this],"arrayFirst")}arrayFirstN(e){return new Nu("array_first_n",[this,mu(e)],"arrayFirstN")}arrayLast(){return new Nu("array_last",[this],"arrayLast")}arrayLastN(e){return new Nu("array_last_n",[this,mu(e)],"arrayLastN")}arrayMaximum(){return new Nu("maximum",[this],"arrayMaximum")}arrayMaximumN(e){return new Nu("maximum_n",[this,mu(e)],"arrayMaximumN")}arrayMinimum(){return new Nu("minimum",[this],"arrayMinimum")}arrayMinimumN(e){return new Nu("minimum_n",[this,mu(e)],"arrayMinimumN")}arrayIndexOf(e){return new Nu("array_index_of",[this,mu(e),mu("first")],"arrayIndexOf")}arrayLastIndexOf(e){return new Nu("array_index_of",[this,mu(e),mu("last")],"arrayLastIndexOf")}arrayIndexOfAll(e){return new Nu("array_index_of_all",[this,mu(e)],"arrayIndexOfAll")}byteLength(){return new Nu("byte_length",[this],"byteLength")}ceil(){return new Nu("ceil",[this])}floor(){return new Nu("floor",[this])}abs(){return new Nu("abs",[this])}exp(){return new Nu("exp",[this])}mapGet(e){return new Nu("map_get",[this,Au(e)],"mapGet")}mapSet(e,t,...n){const r=[this,mu(e),mu(t),...n.map(mu)];return new Nu("map_set",r,"mapSet")}mapKeys(){return new Nu("map_keys",[this],"mapKeys")}mapValues(){return new Nu("map_values",[this],"mapValues")}mapEntries(){return new Nu("map_entries",[this],"mapEntries")}getField(e){return new Nu("get_field",[this,mu(e)],"get_field")}count(){return _u._create("count",[this],"count")}sum(){return _u._create("sum",[this],"sum")}average(){return _u._create("average",[this],"average")}minimum(){return _u._create("minimum",[this],"minimum")}maximum(){return _u._create("maximum",[this],"maximum")}first(){return _u._create("first",[this],"first")}last(){return _u._create("last",[this],"last")}arrayAgg(){return _u._create("array_agg",[this],"arrayAgg")}arrayAggDistinct(){return _u._create("array_agg_distinct",[this],"arrayAggDistinct")}countDistinct(){return _u._create("count_distinct",[this],"countDistinct")}logicalMaximum(e,...t){const n=[e,...t];return new Nu("maximum",[this,...n.map(mu)],"logicalMaximum")}logicalMinimum(e,...t){const n=[e,...t];return new Nu("minimum",[this,...n.map(mu)],"minimum")}vectorLength(){return new Nu("vector_length",[this],"vectorLength")}cosineDistance(e){return new Nu("cosine_distance",[this,gu(e)],"cosineDistance")}dotProduct(e){return new Nu("dot_product",[this,gu(e)],"dotProduct")}euclideanDistance(e){return new Nu("euclidean_distance",[this,gu(e)],"euclideanDistance")}unixMicrosToTimestamp(){return new Nu("unix_micros_to_timestamp",[this],"unixMicrosToTimestamp")}timestampToUnixMicros(){return new Nu("timestamp_to_unix_micros",[this],"timestampToUnixMicros")}unixMillisToTimestamp(){return new Nu("unix_millis_to_timestamp",[this],"unixMillisToTimestamp")}timestampToUnixMillis(){return new Nu("timestamp_to_unix_millis",[this],"timestampToUnixMillis")}unixSecondsToTimestamp(){return new Nu("unix_seconds_to_timestamp",[this],"unixSecondsToTimestamp")}timestampToUnixSeconds(){return new Nu("timestamp_to_unix_seconds",[this],"timestampToUnixSeconds")}timestampAdd(e,t){return new Nu("timestamp_add",[this,mu(e),mu(t)],"timestampAdd")}timestampSubtract(e,t){return new Nu("timestamp_subtract",[this,mu(e),mu(t)],"timestampSubtract")}timestampDiff(e,t){return new Nu("timestamp_diff",[this,yu(e),mu(t)],"timestampDiff")}timestampExtract(e,t){const n=[this,mu(e)];return t&&n.push(mu(t)),new Nu("timestamp_extract",n,"timestampExtract")}documentId(){return new Nu("document_id",[this],"documentId")}parent(){return new Nu("parent",[this],"parent")}substring(e,t){const n=mu(e);return new Nu("substring",void 0===t?[this,n]:[this,n,mu(t)],"substring")}arrayGet(e){return new Nu("array_get",[this,mu(e)],"arrayGet")}isError(){return new Nu("is_error",[this],"isError").asBoolean()}ifError(e){const t=new Nu("if_error",[this,mu(e)],"ifError");return e instanceof Ou?t.asBoolean():t}isAbsent(){return new Nu("is_absent",[this],"isAbsent").asBoolean()}mapRemove(e){return new Nu("map_remove",[this,mu(e)],"mapRemove")}mapMerge(e,...t){const n=mu(e),r=t.map(mu);return new Nu("map_merge",[this,n,...r],"mapMerge")}pow(e){return new Nu("pow",[this,mu(e)])}trunc(e){return void 0===e?new Nu("trunc",[this]):new Nu("trunc",[this,mu(e)],"trunc")}round(e){return void 0===e?new Nu("round",[this]):new Nu("round",[this,mu(e)],"round")}collectionId(){return new Nu("collection_id",[this])}length(){return new Nu("length",[this])}ln(){return new Nu("ln",[this])}sqrt(){return new Nu("sqrt",[this])}stringReverse(){return new Nu("string_reverse",[this])}ifAbsent(e){return new Nu("if_absent",[this,mu(e)],"ifAbsent")}ifNull(e){return new Nu("if_null",[this,mu(e)],"ifNull")}coalesce(e,...t){return new Nu("coalesce",[this,mu(e),...t.map(mu)],"coalesce")}join(e){return new Nu("join",[this,mu(e)],"join")}log10(){return new Nu("log10",[this])}arraySum(){return new Nu("sum",[this])}split(e){return new Nu("split",[this,mu(e)])}timestampTruncate(e,t){const n=[this,mu(e)];return t&&n.push(mu(t)),new Nu("timestamp_trunc",n)}ascending(){return new Pu(yu(this),"ascending","ascending")}descending(){return new Pu(yu(this),"descending","descending")}as(e){return new Eu(this,e,"as")}}class _u{constructor(e,t){this.name=e,this.params=t,this.exprType="AggregateFunction",this._protoValueType="ProtoValue"}static _create(e,t,n){const r=new _u(e,t);return r._methodName=n,r}as(e){return new vu(this,e,"as")}_toProto(e){return{functionValue:{name:this.name,args:this.params.map(t=>t._toProto(e))}}}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach(t=>t._readUserData(e))}}class vu{constructor(e,t,n){this.aggregate=e,this.alias=t,this._methodName=n}_readUserData(e){this.aggregate._readUserData(e)}}class Eu{constructor(e,t,n){this.expr=e,this.alias=t,this._methodName=n,this.exprType="AliasedExpression",this.selectable=!0}_readUserData(e){this.expr._readUserData(e)}}class Iu extends wu{constructor(e,t){super(),this.Rr=e,this._methodName=t,this.expressionType="ListOfExpressions"}_toProto(e){return{arrayValue:{values:this.Rr.map(t=>t._toProto(e))}}}_readUserData(e){this.Rr.forEach(t=>t._readUserData(e))}}class Tu extends wu{constructor(e,t){super(),this.fieldPath=e,this._methodName=t,this.expressionType="Field",this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(e){return new Nu("geo_distance",[this,mu(e)],"geoDistance")}_toProto(e){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(e){}}function bu(e){return function(e,t){return new Tu("string"==typeof e?nt===e?xo()._internalPath:eu("field",e):e._internalPath,t)}(e,"field")}class Su extends wu{constructor(e,t){super(),this.value=e,this._methodName=t,this.expressionType="Constant"}static _fromProto(e){const t=new Su(e,void 0);return t._protoValue=e,t}_toProto(e){return Pe(void 0!==this._protoValue,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,function(e){return"object"==typeof e&&null!==e&&!!("nullValue"in e&&(null===e.nullValue||"NULL_VALUE"===e.nullValue)||"booleanValue"in e&&(null===e.booleanValue||"boolean"==typeof e.booleanValue)||"integerValue"in e&&(null===e.integerValue||"number"==typeof e.integerValue||"string"==typeof e.integerValue)||"doubleValue"in e&&(null===e.doubleValue||"number"==typeof e.doubleValue)||"timestampValue"in e&&(null===e.timestampValue||function(e){return"object"==typeof e&&null!==e&&"seconds"in e&&(null===e.seconds||"number"==typeof e.seconds||"string"==typeof e.seconds)&&"nanos"in e&&(null===e.nanos||"number"==typeof e.nanos)}(e.timestampValue))||"stringValue"in e&&(null===e.stringValue||"string"==typeof e.stringValue)||"bytesValue"in e&&(null===e.bytesValue||e.bytesValue instanceof Uint8Array)||"referenceValue"in e&&(null===e.referenceValue||"string"==typeof e.referenceValue)||"geoPointValue"in e&&(null===e.geoPointValue||function(e){return"object"==typeof e&&null!==e&&"latitude"in e&&(null===e.latitude||"number"==typeof e.latitude)&&"longitude"in e&&(null===e.longitude||"number"==typeof e.longitude)}(e.geoPointValue))||"arrayValue"in e&&(null===e.arrayValue||function(e){return"object"==typeof e&&null!==e&&!(!("values"in e)||null!==e.values&&!Array.isArray(e.values))}(e.arrayValue))||"mapValue"in e&&(null===e.mapValue||function(e){return"object"==typeof e&&null!==e&&!(!("fields"in e)||null!==e.fields&&!dt(e.fields))}(e.mapValue))||"fieldReferenceValue"in e&&(null===e.fieldReferenceValue||"string"==typeof e.fieldReferenceValue)||"functionValue"in e&&(null===e.functionValue||function(e){return"object"==typeof e&&null!==e&&!(!("name"in e)||null!==e.name&&"string"!=typeof e.name||!("args"in e)||null!==e.args&&!Array.isArray(e.args))}(e.functionValue))||"pipelineValue"in e&&(null===e.pipelineValue||function(e){return"object"==typeof e&&null!==e&&!(!("stages"in e)||null!==e.stages&&!Array.isArray(e.stages))}(e.pipelineValue)))}(this._protoValue)||(this._protoValue=Qc(this.value,e))}}function Au(e,t){return Cu(e,"constant")}function Cu(e,t){const n=new Su(e,t);return"boolean"==typeof e?new Ru(n):n}class Nu extends wu{constructor(e,t,n,r){super(),this.name=e,this.params=t,this.expressionType="Function",this._optionsProto=void 0,void 0!==n&&(this._methodName=n),void 0!==r&&(this._options=r)}get _optionsUtil(){return new au({})}_toProto(e){const t={functionValue:{name:this.name,args:this.params.map(t=>t._toProto(e))}};return this._optionsProto&&(t.functionValue.options=this._optionsProto),t}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}
vendor: 5,312 bytes, line 2
2):e,this.params.forEach(t=>t._readUserData(e)),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(e,this._options))}}class Ou extends wu{get _methodName(){return this._expr._methodName}countIf(){return _u._create("count_if",[this],"countIf")}not(){return new Nu("not",[this],"not").asBoolean()}conditional(e,t){return new Nu("conditional",[this,e,t],"conditional")}ifError(e){const t=mu(e),n=new Nu("if_error",[this,t],"ifError");return t instanceof Ou?n.asBoolean():n}_toProto(e){return this._expr._toProto(e)}_readUserData(e){this._expr._readUserData(e)}}class Du extends Ou{constructor(e){super(),this._expr=e,this.expressionType="Function"}}class Ru extends Ou{constructor(e){super(),this._expr=e,this.expressionType="Constant"}_getValue(){return this._expr._getValue()}}class ku extends Ou{constructor(e){super(),this._expr=e,this.expressionType="Field"}}function xu(e,t){const n=[];for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const r=e[t];n.push(Au(t)),n.push(mu(r))}return new Nu("map",n,"map")}class Pu{constructor(e,t,n){this.expr=e,this.direction=t,this._methodName=n,this._protoValueType="ProtoValue"}_toProto(e){return{mapValue:{fields:{direction:Oo(this.direction),expression:this.expr._toProto(e)}}}}_readUserData(e){this.expr._readUserData(e)}}class Lu{constructor(e){this.optionsProto=void 0,({rawOptions:this.rawOptions,...this.knownOptions}=e)}_readUserData(e){this.optionsProto=this._optionsUtil.getOptionsProto(e,this.knownOptions,this.rawOptions)}_toProto(e){return{name:this._name,options:this.optionsProto}}}class Mu extends Lu{get _name(){return"add_fields"}get _optionsUtil(){return new au({})}constructor(e,t){super(t),this.fields=e}_toProto(e){return{...super._toProto(e),args:[No(e,this.fields)]}}_readUserData(e){super._readUserData(e),Yu(this.fields,e)}}class Vu extends Lu{get _name(){return"aggregate"}get _optionsUtil(){return new au({})}constructor(e,t,n){super(n),this.groups=e,this.accumulators=t}_toProto(e){return{...super._toProto(e),args:[No(e,this.accumulators),No(e,this.groups)]}}_readUserData(e){super._readUserData(e),Yu(this.groups,e),Yu(this.accumulators,e)}}class Uu extends Lu{get _name(){return"distinct"}get _optionsUtil(){return new au({})}constructor(e,t){super(t),this.groups=e}_toProto(e){return{...super._toProto(e),args:[No(e,this.groups)]}}_readUserData(e){super._readUserData(e),Yu(this.groups,e)}}class Fu extends Lu{get _name(){return"collection"}get _optionsUtil(){return new au({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.Vr=e.startsWith("/")?e:"/"+e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:this.Vr}]}}_readUserData(e){super._readUserData(e)}}class Bu extends Lu{get _name(){return"collection_group"}get _optionsUtil(){return new au({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.collectionId=e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:""},{stringValue:this.collectionId}]}}_readUserData(e){super._readUserData(e)}}class qu extends Lu{get _name(){return"database"}get _optionsUtil(){return new au({})}_toProto(e){return{...super._toProto(e)}}_readUserData(e){super._readUserData(e)}}class zu extends Lu{get _name(){return"documents"}get _optionsUtil(){return new au({})}constructor(e,t){if(super(t),!e||0===e.length)throw new Ue(Ve.INVALID_ARGUMENT,"Empty document paths are not allowed in DocumentsSource");const n=e.map(e=>e.startsWith("/")?e:"/"+e),r=new Set(n);if(r.size!==n.length)throw new Ue(Ve.INVALID_ARGUMENT,"Duplicate document paths are not allowed in DocumentsSource");this.dr=n,this.mr=r}_toProto(e){return{...super._toProto(e),args:this.dr.map(e=>({referenceValue:e}))}}_readUserData(e){super._readUserData(e)}}class ju extends Lu{get _name(){return"where"}get _optionsUtil(){return new au({})}constructor(e,t){super(t),this.condition=e}_toProto(e){return{...super._toProto(e),args:[this.condition._toProto(e)]}}_readUserData(e){super._readUserData(e),Yu(this.condition,e)}}class Gu extends Lu{get _name(){return"limit"}get _optionsUtil(){return new au({})}constructor(e,t){Pe(!isNaN(e)&&e!==1/0&&e!==-1/0,34860),super(t),this.limit=e}_toProto(e){return{...super._toProto(e),args:[Os(e,this.limit)]}}}class $u extends Lu{get _name(){return"offset"}get _optionsUtil(){return new au({})}constructor(e,t){super(t),this.offset=e}_toProto(e){return{...super._toProto(e),args:[Os(e,this.offset)]}}}class Hu extends Lu{get _name(){return"select"}get _optionsUtil(){return new au({})}constructor(e,t){super(t),this.selections=e}_toProto(e){return{...super._toProto(e),args:[No(e,this.selections)]}}_readUserData(e){super._readUserData(e),Yu(this.selections,e)}}class Ku extends Lu{get _name(){return"sort"}get _optionsUtil(){return new au({})}constructor(e,t){super(t),this.orderings=e}_toProto(e){return{...super._toProto(e),args:this.orderings.map(t=>t._toProto(e))}}_readUserData(e){super._readUserData(e),Yu(this.orderings,e)}}class Wu extends Lu{get _name(){return"replace_with"}get _optionsUtil(){return new au({})}constructor(e,t){super(t),this.map=e}_toProto(e){return{...super._toProto(e),args:[this.map._toProto(e),Oo(Wu.pr)]}}_readUserData(e){super._readUserData(e),Yu(this.map,e)}}Wu.pr="full_replace";function Yu(e,t){return iu(e)?e._readUserData(t):Array.isArray(e)||e instanceof Map?e.forEach(e
2=>e._readUserData(t)):Object.values(e).forEach(e=>e._readUserData(t)),e}class Qu{constructor(e,t,n){this.serializer=e,this.stages=t,this.listenOptions=n,this.isCorePipeline=!0}getPipelineCollection(){return Xu(this)}getPipelineCollectionGroup(){return Zu(this)}getPipelineCollectionId(){return el(this)}getPipelineDocuments(){return tl(this)}getPipelineFlavor(){return function(e){let t="exact";return e.stages.forEach((n,r)=>{n._name!==Uu.name&&n._name!==Vu.name||(t="keyless"),n._name===Hu.name&&"exact"===t&&(t="augmented"),n._name===Mu.name&&r<e.stages.length-1&&"exact"===t&&(t="augmented")}),t}(this)}getPipelineSourceType(){return Ju(this)}}function Ju(e){const t=e.stages[0];return t instanceof Fu||t instanceof Bu||t instanceof qu||t instanceof zu?t._name:"unknown"}function Xu(e){if("collection"===Ju(e))return e.stages[0].Vr}function Zu(e){if("collection_group"===Ju(e))return e.stages[0].collectionId}function el(e){switch(Ju(e)){case"collection":return st.fromString(Xu(e)).lastSegment();case"collection_group":return Zu(e);default:return}}function tl(e){if("documents"===Ju(e))return e.stages[0].dr}class nl{constructor(e,t,n,r){this._db=e,this.userDataReader=t,this._userDataWriter=n,this.stages=r}wr(e,t){const n=this.userDataReader.createContext(3,e);return iu(t)?t._readUserData(n):(Array.isArray(t),t.forEach(e=>e._readUserData(n))),t}where(e){const t=this.stages.map(e=>e);return this.wr("where",e),t.push(new ju(e,{})),new nl(this._db,this.userDataReader,this._userDataWriter,t)}limit(e){const t=this.stages.map(e=>e);return t.push(new Gu(e,{})),new nl(this._db,this.userDataReader,this._userDataWriter,t)}sort(e,...t){const n=this.stages.map(e=>e);return"orderings"in e?n.push(new Ku(this.wr("sort",e.orderings),{})):n.push(new Ku(this.wr("sort",[e,...t]),{})),new nl(this._db,this.userDataReader,this._userDataWriter,n)}br(e){return{pipeline:{stages:this.stages.map(t=>t._toProto(e))}}}}class rl{constructor(e,t){this.type=e,this.value=t}static vr(){return new rl("ERROR",void 0)}static Sr(){return new rl("UNSET",void 0)}static Dr(){return new rl("NULL",Qr)}static newValue(e){return fs(e)?new rl("NULL",Qr):function(e){return!!e&&"booleanValue"in e}(e)?new rl("BOOLEAN",e):us(e)?new rl("INT",e):ls(e)?new rl("DOUBLE",e):function(e){return!!e&&"timestampValue"in e&&!!e.timestampValue}(e)?new rl("TIMESTAMP",e):function(e){return!!e&&"stringValue"in e}(e)?new rl("STRING",e):function(e){return!!e&&"bytesValue"in e}(e)?new rl("BYTES",e):e.referenceValue?new rl("REFERENCE",e):e.geoPointValue?new rl("GEO_POINT",e):ds(e)?new rl("ARRAY",e):gs(e)?new rl("VECTOR",e):ms(e)?new rl("MAP",e):new rl("ERROR",void 0)}Cr(){return"ERROR"===this.type||"UNSET"===this.type}Fr(){return"NULL"===this.type}}function sl(e){if(!e.Cr())return e.value}function il(e){return e instanceof Ou?e._expr:e}function al(e){if((e=il(e))instanceof Tu)return new ol(e);if(e instanceof Su)return new cl(e);if(e instanceof Iu)return new ul(e);if(e instanceof Nu){if("add"===e.name)return new gl(e);if("subtract"===e.name)return new yl(e);if("multiply"===e.name)return new wl(e);if("divide"===e.name)return new _l(e);if("mod"===e.name)return new vl(e);if("and"===e.name)return new El(e);if("equal"===e.name)return new Vl(e);if("not_equal"===e.name)return new Ul(e);if("less_than"===e.name)return new Fl(e);if("less_than_or_equal"===e.name)return new Bl(e);if("greater_than"===e.name)return new ql(e);if("greater_than_or_equal"===e.name)return new zl(e);if("array_concat"===e.name)return new jl(e);if("array_reverse"===e.name)return new Gl(e);if("array_contains"===e.name)return new $l(e);if("array_contains_all"===e.name)return new Hl(e);if("array_contains_any"===e.name)return new Kl(e);if("array_length"===e.name)return new Wl(e);if("array_element"===e.name)return new Yl(e);if("equal_any"===e.name)return new Sl(e);if("not_equal_any"===e.name)return new Al(e);if("is_nan"===e.name)return new Cl(e);if("is_not_nan"===e.name)return new Nl(e);if("is_null"===e.name)return new Ol(e);if("is_not_null"===e.name)return new Dl(e);if("is_error"===e.name)return new Rl(e);if("exists"===e.name)return new kl(e);if("not"===e.name)return new Il(e);if("or"===e.name)return new Tl(e);if("xor"===e.name)return new bl(e);
vendor: 26,430 bytes, line 2
2if("conditional"===e.name)return new xl(e);if("maximum"===e.name)return new Pl(e);if("minimum"===e.name)return new Ll(e);if("reverse"===e.name)return new Ql(e);if("replace_first"===e.name)return new Jl(e);if("replace_all"===e.name)return new Xl(e);if("char_length"===e.name)return new Zl(e);if("byte_length"===e.name)return new eh(e);if("like"===e.name)return new nh(e);if("regex_contains"===e.name)return new rh(e);if("regex_match"===e.name)return new sh(e);if("string_contains"===e.name)return new ih(e);if("starts_with"===e.name)return new ah(e);if("ends_with"===e.name)return new oh(e);if("to_lower"===e.name)return new ch(e);if("to_upper"===e.name)return new uh(e);if("trim"===e.name)return new lh(e);if("string_concat"===e.name)return new hh(e);if("map_get"===e.name)return new dh(e);if("cosine_distance"===e.name)return new ph(e);if("dot_product"===e.name)return new mh(e);if("euclidean_distance"===e.name)return new gh(e);if("vector_length"===e.name)return new yh(e);if("unix_micros_to_timestamp"===e.name)return new kh(e);if("timestamp_to_unix_micros"===e.name)return new Mh(e);if("unix_millis_to_timestamp"===e.name)return new xh(e);if("timestamp_to_unix_millis"===e.name)return new Vh(e);if("unix_seconds_to_timestamp"===e.name)return new Ph(e);if("timestamp_to_unix_seconds"===e.name)return new Uh(e);if("timestamp_add"===e.name)return new Bh(e);if("timestamp_subtract"===e.name)return new qh(e)}throw new Error(`Unknown Expr : ${e}`)}class ol{constructor(e){this.expr=e}evaluate(e,t){if(this.expr.fieldName===nt)return rl.newValue({referenceValue:no(e.serializer,t.key)});if("__update_time__"===this.expr.fieldName)return rl.newValue({timestampValue:Ja(e.serializer,t.version)});if("__create_time__"===this.expr.fieldName)return rl.newValue({timestampValue:Ja(e.serializer,t.createTime)});const n=t.data.field(this.expr._fieldPath);return n?Fr(n)?rl.newValue(function(e,t){if("estimate"===e.serverTimestampBehavior)return{timestampValue:Ja(e.serializer,Et.fromTimestamp(qr(t)))};if("previous"===e.serverTimestampBehavior){const e=Br(t);if(e)return e}return{nullValue:"NULL_VALUE"}}(e,n)):rl.newValue(n):rl.Sr()}}class cl{constructor(e){this.expr=e}evaluate(e,t){return rl.newValue(this.expr._getValue())}}class ul{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.Rr.map(n=>al(n).evaluate(e,t));return n.some(e=>e.Cr())?rl.vr():rl.newValue({arrayValue:{values:n.map(e=>e.value)}})}}function ll(e){return ls(e)?Number(e.doubleValue):Number(e.integerValue)}function hl(e){return BigInt(e.integerValue)}const dl=BigInt("0x7fffffffffffffff"),fl=-BigInt("0x8000000000000000");class pl{constructor(e){this.expr=e}evaluate(e,t){Pe(this.expr.params.length>=2,24778);const n=al(this.expr.params[0]).evaluate(e,t),r=al(this.expr.params[1]).evaluate(e,t);let s=this.Or(n,r);for(const n of this.expr.params.slice(2)){const r=al(n).evaluate(e,t);s=this.Or(s,r)}return s}Or(e,t){if(e.Cr()||t.Cr())return rl.vr();if(e.Fr()||t.Fr())return rl.Dr();const n=e.value,r=t.value;if(!ls(n)&&!us(n)||!ls(r)&&!us(r))return rl.vr();if(ls(n)||ls(r)){const e=this.Mr(n,r);return e?rl.newValue(e):rl.vr()}if(us(n)&&us(r)){const e=this.Nr(n,r);return void 0===e?rl.vr():"number"==typeof e?rl.newValue({doubleValue:e}):e<fl||e>dl?rl.vr():rl.newValue({integerValue:`${e}`})}return rl.vr()}}function ml(e,t){return Zr(e)!==Zr(t)?"TYPE_MISMATCH":ps(e)||ps(t)?"NOT_EQ":fs(e)&&fs(t)?"EQ":fs(e)||fs(t)?"NULL":ds(e)&&ds(t)?function(e,t){if(e.values?.length!==t.values?.length)return"NOT_EQ";let n=!1;for(let r=0;r<(e.values?.length??0);r++){const s=e.values[r],i=t.values[r];switch(ml(s,i)){case"EQ":break;case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":n=!0;break;default:ke(44609,{Lr:s,Br:i})}}return n?"NULL":"EQ"}(e.arrayValue,t.arrayValue):gs(e)&&gs(t)||ms(e)&&ms(t)?function(e,t){const n=e.fields||{},r=t.fields||{};if(br(n)!==br(r))return"NOT_EQ";let s=!1;for(const e in n)if(n.hasOwnProperty(e)){if(void 0===r[e])return"NOT_EQ";switch(ml(n[e],r[e])){case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":s=!0}}return s?"NULL":"EQ"}(e.mapValue,t.mapValue):function(e,t){return es(e,t,{Te:!1,Ee:!0,he:!0})}(e,t)?"EQ":"NOT_EQ"}class gl extends pl{Nr(e,t){return hl(e)+hl(t)}Mr(e,t){return{doubleValue:ll(e)+ll(t)}}}class yl extends pl{constructor(e){super(e),this.expr=e}Nr(e,t){return hl(e)-hl(t)}Mr(e,t){return{doubleValue:ll(e)-ll(t)}}}class wl extends pl{constructor(e){super(e),this.expr=e}Nr(e,t){return hl(e)*hl(t)}Mr(e,t){return{doubleValue:ll(e)*ll(t)}}}class _l extends pl{constructor(e){super(e),this.expr=e}Nr(e,t){const n=hl(t);if(n!==BigInt(0))return hl(e)/n}Mr(e,t){const n=ll(t);return 0===n?{doubleValue:tn(n)?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}:{doubleValue:ll(e)/n}}}class vl extends pl{constructor(e){super(e),this.expr=e}Nr(e,t){const n=hl(t);if(n!==BigInt(0))return hl(e)%n}Mr(e,t){const n=ll(t);if(0!==n)return{doubleValue:ll(e)%n}}}class El{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(const s of this.expr.params){const i=al(s).evaluate(e,t);switch(i.type){case"BOOLEAN":if(!i.value?.booleanValue)return rl.newValue(Xr);break;case"NULL":r=!0;break;default:n=!0}}return n?rl.vr():r?rl.Dr():rl.newValue(Jr)}}class Il{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,9634);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BOOLEAN":return rl.newValue({booleanValue:!n.value?.booleanValue});case"NULL":return rl.Dr();default:return rl.vr()}}}class Tl{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(const s of this.expr.params){const i=al(s).evaluate(e,t);switch(i.type){case"BOOLEAN":if(i.value?.booleanValue)return rl.newValue(Jr);break;case"NULL":r=!0;break;default:n=!0}}return n?rl.vr():r?rl.Dr():rl.newValue(Xr)}}class bl{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(const s of this.expr.params){const i=al(s).evaluate(e,t);switch(i.type){case"BOOLEAN":n=bl.xor(n,!!i.value?.booleanValue);break;case"NULL":r=!0;break;default:return rl.vr()}}return r?rl.Dr():rl.newValue({booleanValue:n})}static xor(e,t){return(e||t)&&!(e&&t)}}class Sl{constructor(e){this.expr=e}evaluate(e,t){Pe(2===this.expr.params.length,55094);let n=!1;const r=al(this.expr.params[0]).evaluate(e,t);switch(r.type){case"NULL":n=!0;break;case"ERROR":case"UNSET":return rl.vr()}const s=al(this.expr.params[1]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return rl.vr()}if(n)return rl.Dr();for(const e of s.value?.arrayValue?.values??[])switch(fs(r.value)&&fs(e)?"EQ":ml(r.value,e)){case"EQ":return rl.newValue(Jr);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:ke(44608,{value:r.value,candidate:e})}return n?rl.Dr():rl.newValue(Xr)}}class Al{constructor(e){this.expr=e}evaluate(e,t){return new Il(new Nu("not",[new Nu("equal_any",this.expr.params)])).evaluate(e,t)}}class Cl{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,23322);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"INT":return rl.newValue(Xr);case"DOUBLE":return rl.newValue({booleanValue:isNaN(ll(n.value))});case"NULL":return rl.Dr();default:return rl.vr()}}}class Nl{constructor(e){this.expr=e}evaluate(e,t){return Pe(1===this.expr.params.length,50406),new Il(new Nu("not",[new Nu("is_nan",this.expr.params)])).evaluate(e,t)}}class Ol{constructor(e){this.expr=e}evaluate(e,t){switch(Pe(1===this.expr.params.length,23123),al(this.expr.params[0]).evaluate(e,t).type){case"NULL":return rl.newValue(Jr);case"UNSET":case"ERROR":return rl.vr();default:return rl.newValue(Xr)}}}class Dl{constructor(e){this.expr=e}evaluate(e,t){return Pe(1===this.expr.params.length,23167),new Il(new Nu("not",[new Nu("is_null",this.expr.params)])).evaluate(e,t)}}class Rl{constructor(e){this.expr=e}evaluate(e,t){return Pe(1===this.expr.params.length,5228),"ERROR"===al(this.expr.params[0]).evaluate(e,t).type?rl.newValue(Jr):rl.newValue(Xr)}}class kl{constructor(e){this.expr=e}evaluate(e,t){switch(Pe(1===this.expr.params.length,6877),al(this.expr.params[0]).evaluate(e,t).type){case"ERROR":return rl.vr();case"UNSET":return rl.newValue(Xr);default:return rl.newValue(Jr)}}}class xl{constructor(e){this.expr=e}evaluate(e,t){Pe(3===this.expr.params.length,11706);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BOOLEAN":return n.value?.booleanValue?al(this.expr.params[1]).evaluate(e,t):al(this.expr.params[2]).evaluate(e,t);case"NULL":return al(this.expr.params[2]).evaluate(e,t);default:return rl.vr()}}}class Pl{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map(n=>al(n).evaluate(e,t));let r;for(const e of n)switch(e.type){case"ERROR":case"UNSET":case"NULL":continue;default:r=void 0===r||ns(e.value,r.value)>0?e:r}return void 0===r?rl.Dr():r}}class Ll{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map(n=>al(n).evaluate(e,t));let r;for(const e of n)switch(e.type){case"ERROR":case"UNSET":case"NULL":continue;default:r=void 0===r||ns(e.value,r.value)<0?e:r}return void 0===r?rl.Dr():r}}class Ml{constructor(e){this.expr=e}evaluate(e,t){Pe(2===this.expr.params.length,31033,`${this.expr.name}() function should have exactly 2 params`);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"ERROR":case"UNSET":return rl.vr()}const r=al(this.expr.params[1]).evaluate(e,t);switch(r.type){case"ERROR":case"UNSET":return rl.vr()}return this.Ur(n,r)}}class Vl extends Ml{constructor(e){super(e),this.expr=e}Ur(e,t){if(e.Fr()&&t.Fr())return rl.newValue(Jr);if(e.Fr()||t.Fr())return rl.newValue(Xr);if(ps(e.value)||ps(t.value))return rl.newValue(Xr);if(Zr(e.value)!==Zr(t.value))return rl.newValue(Xr);switch(ml(e.value,t.value)){case"EQ":return rl.newValue(Jr);case"NOT_EQ":return rl.newValue(Xr);case"NULL":return rl.Dr();default:ke(44615,{left:e,right:t})}}}class Ul extends Ml{constructor(e){super(e),this.expr=e}Ur(e,t){switch(ml(e.value,t.value)){case"EQ":return rl.newValue(Xr);case"NOT_EQ":case"TYPE_MISMATCH":return rl.newValue(Jr);case"NULL":return rl.Dr();default:ke(44614,{left:e,right:t})}}}class Fl extends Ml{constructor(e){super(e),this.expr=e}Ur(e,t){return Zr(e.value)!==Zr(t.value)||ps(e.value)||ps(t.value)?rl.newValue(Xr):rl.newValue({booleanValue:ns(e.value,t.value)<0})}}class Bl extends Ml{constructor(e){super(e),this.expr=e}Ur(e,t){return Zr(e.value)!==Zr(t.value)||ps(e.value)||ps(t.value)?rl.newValue(Xr):"EQ"===ml(e.value,t.value)?rl.newValue(Jr):rl.newValue({booleanValue:ns(e.value,t.value)<0})}}class ql extends Ml{constructor(e){super(e),this.expr=e}Ur(e,t){return Zr(e.value)!==Zr(t.value)||ps(e.value)||ps(t.value)?rl.newValue(Xr):rl.newValue({booleanValue:ns(e.value,t.value)>0})}}class zl extends Ml{constructor(e){super(e),this.expr=e}Ur(e,t){return Zr(e.value)!==Zr(t.value)||ps(e.value)||ps(t.value)?rl.newValue(Xr):"EQ"===ml(e.value,t.value)?rl.newValue(Jr):rl.newValue({booleanValue:ns(e.value,t.value)>0})}}class jl{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class Gl{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,216);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return rl.Dr();case"ARRAY":{const e=n.value.arrayValue?.values??[];return rl.newValue({arrayValue:{values:[...e].reverse()}})}default:return rl.vr()}}}class $l{constructor(e){this.expr=e}evaluate(e,t){return Pe(2===this.expr.params.length,52884),new Sl(new Nu("eq_any",[this.expr.params[1],this.expr.params[0]])).evaluate(e,t)}}class Hl{constructor(e){this.expr=e}evaluate(e,t){Pe(2===this.expr.params.length,1392);let n=!1;const r=al(this.expr.params[0]).evaluate(e,t);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return rl.vr()}const s=al(this.expr.params[1]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return rl.vr()}if(n)return rl.Dr();const i=s.value?.arrayValue?.values??[],a=r.value?.arrayValue?.values??[];for(const e of i){let t=!1;n=!1;for(const r of a){switch(fs(e)&&fs(r)?"EQ":ml(e,r)){case"EQ":t=!0;break;case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:ke(44613,{value:r,search:e})}if(t)break}if(!t)return rl.newValue(Xr)}return rl.newValue(Jr)}}class Kl{constructor(e){this.expr=e}evaluate(e,t){Pe(2===this.expr.params.length,2680);let n=!1;const r=al(this.expr.params[0]).evaluate(e,t);switch(r.type){case"ARRAY":break;case"NULL":n=!0;break;default:return rl.vr()}const s=al(this.expr.params[1]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return rl.vr()}if(n)return rl.Dr();const i=s.value?.arrayValue?.values??[],a=r.value?.arrayValue?.values??[];for(const e of a)for(const t of i)switch(fs(e)&&fs(t)?"EQ":ml(e,t)){case"EQ":return rl.newValue(Jr);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:ke(44608,{value:e,search:t})}return n?rl.Dr():rl.newValue(Xr)}}class Wl{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,38605);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return rl.Dr();case"ARRAY":return rl.newValue({integerValue:`${n.value?.arrayValue?.values?.length??0}`});default:return rl.vr()}}}class Yl{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class Ql{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,1508);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return rl.Dr();case"BYTES":{const e=n.value?.bytesValue;if("string"==typeof e){const t=Dr.fromBase64String(e).toUint8Array();return t.reverse(),rl.newValue({bytesValue:Dr.fromUint8Array(t).toBase64()})}return rl.newValue({bytesValue:new Uint8Array(e).reverse()})}case"STRING":{const e=n.value?.stringValue,t=new Intl.__PRIVATE_Segmenter(void 0,{granularity:"grapheme"}).segment(e),r=Array.from(t,e=>e.segment).reverse();return rl.newValue({stringValue:r.join("")})}default:return rl.vr()}}}class Jl{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class Xl{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class Zl{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,19400);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return rl.Dr();case"STRING":{const e=function(e){let t=0;for(let n=0;n<e.length;n++){const r=e.codePointAt(n);if(void 0===r)return;if(r<=65535)if(r>=55296&&r<=57343)if(r<=56319){const r=e.codePointAt(n+1);void 0!==r&&r>=56320&&r<=57343?(t+=1,n++):t+=1}else t+=1;else t+=1;else{if(!(r<=1114111))return;t+=1,n++}}return t}(n.value.stringValue);return void 0===e?rl.vr():rl.newValue({integerValue:e})}default:return rl.vr()}}}class eh{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,8486);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BYTES":{const e=n.value?.bytesValue;return"string"==typeof e?rl.newValue({integerValue:Dr.fromBase64String(e).toUint8Array().length}):rl.newValue({integerValue:new Uint8Array(e).length})}case"STRING":{const e=function(e){let t=0;for(let n=0;n<e.length;n++){const r=e.codePointAt(n);if(void 0===r)return;if(r>=55296&&r<=57343){if(!(r<=56319))return;{const r=e.codePointAt(n+1);if(void 0===r||!(r>=56320&&r<=57343))return;t+=4,n++}}else if(r<=127)t+=1;else if(r<=2047)t+=2;else if(r<=65535)t+=3;else{if(!(r<=1114111))return;t+=4,n++}}return t}(n.value?.stringValue);return void 0===e?rl.vr():rl.newValue({integerValue:e})}case"NULL":return rl.Dr();default:return rl.vr()}}}class th{constructor(e){this.expr=e}evaluate(e,t){Pe(2===this.expr.params.length,39773,`${this.expr.name}() function should have exactly two parameters`);let n=!1;const r=al(this.expr.params[0]).evaluate(e,t);switch(r.type){case"STRING":break;case"NULL":n=!0;break;default:return rl.vr()}const s=al(this.expr.params[1]).evaluate(e,t);switch(s.type){case"STRING":break;case"NULL":n=!0;break;default:return rl.vr()}return n?rl.Dr():this.kr(r.value?.stringValue,s.value?.stringValue)}}class nh extends th{kr(e,t){try{const n=function(e){let t="";for(let n=0;n<e.length;n++){const r=e.charAt(n);switch(r){case"_":t+=".";break;case"%":t+=".*";break;case"\\":case".":case"*":case"?":case"+":case"^":case"$":case"|":case"(":case")":case"[":case"]":case"{":case"}":t+="\\"+r;break;default:t+=r}}return"^"+t+"$"}(t),r=Ie.compile(n);return rl.newValue({booleanValue:r.matches(e)})}catch(e){return De(`Invalid LIKE pattern converted to regex: ${t}, returning error. Error: ${e}`),rl.vr()}}}class rh extends th{kr(e,t){try{const n=Ie.compile(t);return rl.newValue({booleanValue:n.matcher(e).find()})}catch(e){return De(`Invalid regex pattern found in regex_contains: ${t}, returning error`),rl.vr()}}}class sh extends th{kr(e,t){try{return rl.newValue({booleanValue:Ie.compile(t).matches(e)})}catch(e){return De(`Invalid regex pattern found in regex_match: ${t}, returning error`),rl.vr()}}}class ih extends th{kr(e,t){return rl.newValue({booleanValue:e.includes(t)})}}class ah extends th{kr(e,t){return rl.newValue({booleanValue:e.startsWith(t)})}}class oh extends th{kr(e,t){return rl.newValue({booleanValue:e.endsWith(t)})}}class ch{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,29079);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return rl.newValue({stringValue:n.value?.stringValue?.toLowerCase()});case"NULL":return rl.Dr();default:return rl.vr()}}}class uh{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,60487);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return rl.newValue({stringValue:n.value?.stringValue?.toUpperCase()});case"NULL":return rl.Dr();default:return rl.vr()}}}class lh{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,28544);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return rl.newValue({stringValue:n.value?.stringValue?.trim()});case"NULL":return rl.Dr();default:return rl.vr()}}}class hh{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map(n=>al(n).evaluate(e,t));let r="",s=!1;for(const e of n)switch(e.type){case"STRING":r+=e.value.stringValue;break;case"NULL":s=!0;break;default:return rl.vr()}return s?rl.Dr():rl.newValue({stringValue:r})}}class dh{constructor(e){this.expr=e}evaluate(e,t){Pe(2===this.expr.params.length,4483);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"UNSET":return rl.Sr();case"MAP":break;default:return rl.vr()}const r=al(this.expr.params[1]).evaluate(e,t);if("STRING"!==r.type)return rl.vr();const s=n.value?.mapValue?.fields?.[r.value?.stringValue];return void 0===s?rl.Sr():rl.newValue(s)}}class fh{constructor(e){this.expr=e}evaluate(e,t){Pe(2===this.expr.params.length,25231,`${this.expr.name}() function should have exactly 2 params`);let n=!1;const r=al(this.expr.params[0]).evaluate(e,t);switch(r.type){case"VECTOR":break;case"NULL":n=!0;break;default:return rl.vr()}const s=al(this.expr.params[1]).evaluate(e,t);switch(s.type){case"VECTOR":break;case"NULL":n=!0;break;default:return rl.vr()}if(n)return rl.Dr();const i=ys(r.value),a=ys(s.value);if(void 0===i||void 0===a||i.values?.length!==a.values?.length)return rl.vr();const o=this.qr(i,a);return void 0===o||isNaN(o)?rl.vr():rl.newValue({doubleValue:o})}}class ph extends fh{qr(e,t){const n=e?.values??[],r=t?.values??[];if(0===n.length)return;let s=0,i=0,a=0;for(let e=0;e<n.length;e++){if(!hs(n[e])||!hs(r[e]))return;const t=ll(n[e]),o=ll(r[e]);s+=t*o,i+=t*t,a+=o*o}const o=Math.sqrt(i)*Math.sqrt(a);return 0!==o?1-Math.max(-1,Math.min(1,s/o)):void 0}}class mh extends fh{qr(e,t){const n=e?.values??[],r=t?.values??[];if(0===n.length)return 0;let s=0;for(let e=0;e<n.length;e++){if(!hs(n[e])||!hs(r[e]))return;s+=ll(n[e])*ll(r[e])}return s}}class gh extends fh{qr(e,t){const n=e?.values??[],r=t?.values??[];if(0===n.length)return 0;let s=0;for(let e=0;e<n.length;e++){if(!hs(n[e])||!hs(r[e]))return;const t=ll(n[e]),i=ll(r[e]);s+=Math.pow(t-i,2)}return Math.sqrt(s)}}class yh{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,39044);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"VECTOR":{const e=ys(n.value);return rl.newValue({integerValue:e?.values?.length??0})}case"NULL":return rl.Dr();default:return rl.vr()}}}const wh=BigInt(-62135596800),_h=BigInt(253402300799),vh=BigInt(1e3),Eh=BigInt(1e6),Ih=wh*vh,Th=_h*vh+BigInt(999),bh=wh*Eh,Sh=_h*Eh+BigInt(999999);function Ah(e){return e>=bh&&e<=Sh}function Ch(e){return e>=wh&&e<=_h}function Nh(e,t){const n=BigInt(e);return!(n<wh||n>_h||t<0||t>=1e9||n===wh&&0!==t||n===_h&&t>999999999)}function Oh(e,t){return t<0?{seconds:e-1,nanos:t+1e9}:{seconds:e,nanos:t}}function Dh(e){return BigInt(e.seconds)*Eh+BigInt(Math.trunc(e.nanoseconds/1e3))}class Rh{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,49262,`${this.expr.name}() function should have exactly one parameter`);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"INT":return this.toTimestamp(BigInt(n.value.integerValue));case"NULL":return rl.Dr();default:return rl.vr()}}}class kh extends Rh{toTimestamp(e){if(!Ah(e))return rl.vr();let t=Number(e/Eh),n=Number(e%Eh*BigInt(1e3));const r=Oh(t,n);return t=r.seconds,n=r.nanos,Nh(t,n)?rl.newValue({timestampValue:{seconds:t,nanos:n}}):rl.vr()}}class xh extends Rh{toTimestamp(e){if(!function(e){return e>=Ih&&e<=Th}(e))return rl.vr();let t=Number(e/vh),n=Number(e%vh*BigInt(1e6));const r=Oh(t,n);return t=r.seconds,n=r.nanos,Nh(t,n)?rl.newValue({timestampValue:{seconds:t,nanos:n}}):rl.vr()}}class Ph extends Rh{toTimestamp(e){if(!Ch(e))return rl.vr();const t=Number(e);return rl.newValue({timestampValue:{seconds:t,nanos:0}})}}class Lh{constructor(e){this.expr=e}evaluate(e,t){Pe(1===this.expr.params.length,1265,`${this.expr.name}() function should have exactly one parameter`);const n=al(this.expr.params[0]).evaluate(e,t);switch(n.type){case"TIMESTAMP":break;case"NULL":return rl.Dr();default:return rl.vr()}const r=Ya(n.value.timestampValue);return Nh(r.seconds,r.nanoseconds)?this.$r(r):rl.vr()}}class Mh extends Lh{$r(e){const t=Dh(e);return Ah(t)?rl.newValue({integerValue:`${t.toString()}`}):rl.vr()}}class Vh extends Lh{$r(e){const t=Dh(e),n=t/BigInt(1e3),r=t%BigInt(1e3);return n>BigInt(0)||r===BigInt(0)?rl.newValue({integerValue:n.toString()}):rl.newValue({integerValue:(n-BigInt(1)).toString()})}}class Uh extends Lh{$r(e){const t=BigInt(e.seconds);return Ch(t)?rl.newValue({integerValue:t.toString()}):rl.vr()}}class Fh{constructor(e){this.expr=e}evaluate(e,t){Pe(3===this.expr.params.length,2775,`${this.expr.name}() function should have exactly 3 parameters`);let n=!1;const r=al(this.expr.params[0]).evaluate(e,t);switch(r.type){case"TIMESTAMP":break;case"NULL":n=!0;break;default:return rl.vr()}const s=al(this.expr.params[1]).evaluate(e,t);let i;switch(s.type){case"STRING":if(i=function(e){switch(e){case"microsecond":return"microsecond";case"millisecond":return"millisecond";case"second":return"second";case"minute":return"minute";case"hour":return"hour";case"day":return"day";default:return}}(s.value.stringValue),void 0===i)return rl.vr();break;case"NULL":n=!0;break;default:return rl.vr()}const a=al(this.expr.params[2]).evaluate(e,t);switch(a.type){case"INT":break;case"NULL":n=!0;break;default:return rl.vr()}if(n)return rl.Dr();const o=BigInt(a.value.integerValue);let c;try{switch(i){case"microsecond":c=o;break;case"millisecond":c=o*BigInt(1e3);break;case"second":c=o*BigInt(1e6);break;case"minute":c=o*BigInt(6e7);break;case"hour":c=o*BigInt(36e8);break;case"day":c=o*BigInt(864e8);break;default:return rl.vr()}if("microsecond"!==i&&o!==BigInt(0)&&c/o!==BigInt(this.Kr(i)))return rl.vr()}catch(e){return De(`Error during timestamp arithmetic: ${e}`),rl.vr()}const u=Ya(r.value.timestampValue);if(!Nh(u.seconds,u.nanoseconds))return rl.vr();const l=Dh(u),h=this.Wr(l,c);if(!Ah(h))return rl.vr();const d=Number(h/Eh),f=h%Eh,p=Number((f<0?f+Eh:f)*BigInt(1e3)),m=f<0?d-1:d;return Nh(m,p)?rl.newValue({timestampValue:{seconds:m,nanos:p}}):rl.vr()}Kr(e){switch(e){case"millisecond":return 1e3;case"second":return 1e6;case"minute":return 6e7;case"hour":return 36e8;case"day":return 864e8;default:return 1}}}class Bh extends Fh{Wr(e,t){return e+t}}class qh extends Fh{Wr(e,t){return e-t}}function zh(e){if((e=il(e))instanceof Tu)return`fld(${e.fieldName})`;if(e instanceof Su)return`cst(${function(e){return null===e?"null":"number"==typeof e?e.toString():"string"==typeof e?`"${e}"`:e instanceof Tc?`ref(${e.path})`:e instanceof Dc?`vec(${JSON.stringify(e)})`:JSON.stringify(e)}(e.value)})`;if(e instanceof Nu)return`fn(${e.name},[${e.params.map(zh).join(",")}])`;if("ListOfExpressions"===e.expressionType)return`list([${e.Rr.map(zh).join(",")}])`;throw new Error(`Unrecognized expr ${JSON.stringify(e,null,2)}`)}function jh(e){return`${Array.from(e.entries()).sort().map(([e,t])=>`${e}=${zh(t)}`).join(",")}`}function Gh(e){return e.stages.map(e=>function(e){if(e instanceof Mu)return`${e._name}(${jh(e.fields)})`;if(e instanceof Vu){let t=`${e._name}(${jh(e.accumulators)})`;return e.groups.size>0&&(t+=`grouping(${jh(e.groups)})`),t}if(e instanceof Uu)return`${e._name}(${jh(e.groups)})`;if(e instanceof Fu)return`${e._name}(${e.Vr})`;if(e instanceof Bu)return`${e._name}(${e.collectionId})`;if(e instanceof qu)return`${e._name}()`;if(e instanceof zu)return`${e._name}(${e.dr.sort()})`;if(e instanceof ju)return`${e._name}(${zh(e.condition)})`;if(e instanceof Gu)return`${e._name}(${e.limit})`;if(e instanceof Ku)return`${e._name}(${function(e){return e.map(e=>`${zh(e.expr)}${e.direction}`).join(",")}(e.orderings)})`;throw new Error(`Unrecognized stage ${e._name}`)}(e)).join("|")}function $h(e,t){return Gh(e)===Gh(t)}function Hh(e){return e instanceof Qu}function Kh(e){return Hh(e)?Gh(e):ra(e)}function Wh(e){return Hh(e)?Gh(e):function(e){return`${Vi(Ji(e))}|lt:${e.limitType}`}(e)}function Yh(e,t){return e instanceof Qu&&t instanceof Qu?$h(e,t):!(e instanceof Qu&&!(t instanceof Qu)||!(e instanceof Qu)&&t instanceof Qu)&&na(e,t)}function Qh(e){return Fi(e)?Gh(e):Vi(e)}function Jh(e,t){return e instanceof Qu&&t instanceof Qu?$h(e,t):!(e instanceof Qu&&!(t instanceof Qu)||!(e instanceof Qu)&&t instanceof Qu)&&Ui(e,t)}class Xh{constructor(e,t,n,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(e,t){const n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){const r=this.mutations[t];r.key.isEqual(e.key)&&Xs(r,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&
2(t=Zs(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=Zs(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=_a();return this.mutations.forEach(r=>{const s=e.get(r.key),i=s.overlayedDocument;let a=this.applyToLocalView(i,s.mutatedFields);a=t.has(r.key)?null:a;const o=Js(i,a);null!==o&&n.set(r.key,o),i.isValidDocument()||i.convertToNoDocument(Et.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),Ta())}isEqual(e){return this.batchId===e.batchId&&et(this.mutations,e.mutations,(e,t)=>ti(e,t))&&et(this.baseMutations,e.baseMutations,(e,t)=>ti(e,t))}}class Zh{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(e,t,n){Pe(e.mutations.length===n.length,58842,{Qr:e.mutations.length,Gr:n.length});let r=Ea;const s=e.mutations;for(let e=0;e<s.length;e++)r=r.insert(s[e].key,n[e].version);return new Zh(e,t,n,r)}}class ed{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}class td{constructor(e,t,n,r,s=Et.min(),i=Et.min(),a=Dr.EMPTY_BYTE_STRING,o=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=a,this.expectedCount=o}withSequenceNumber(e){return new td(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new td(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new td(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new td(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class nd{constructor(e){this.zr=e}}function rd(e,t){const n=t.key,r={prefixPath:n.getCollectionPath().popLast().toArray(),collectionGroup:n.collectionGroup,documentId:n.path.lastSegment(),readTime:sd(t.readTime),hasCommittedMutations:t.hasCommittedMutations};if(t.isFoundDocument())r.document=function(e,t){return{name:no(e,t.key),fields:t.data.value.mapValue.fields,updateTime:Wa(e,t.version.toTimestamp()),createTime:Wa(e,t.createTime.toTimestamp())}}(e.zr,t);else if(t.isNoDocument())r.noDocument={path:n.path.toArray(),readTime:id(t.version)};else{if(!t.isUnknownDocument())return ke(57904,{document:t});r.unknownDocument={path:n.path.toArray(),version:id(t.version)}}return r}function sd(e){const t=e.toTimestamp();return[t.seconds,t.nanoseconds]}function id(e){const t=e.toTimestamp();return{seconds:t.seconds,nanoseconds:t.nanoseconds}}function ad(e){const t=new vt(e.seconds,e.nanoseconds);return Et.fromTimestamp(t)}function od(e,t){const n=(t.baseMutations||[]).map(t=>ho(e.zr,t));for(let e=0;e<t.mutations.length-1;++e){const n=t.mutations[e];if(e+1<t.mutations.length&&void 0!==t.mutations[e+1].transform){const r=t.mutations[e+1];n.updateTransforms=r.transform.fieldTransforms,t.mutations.splice(e+1,1),++e}}const r=t.mutations.map(t=>ho(e.zr,t)),s=vt.fromMillis(t.localWriteTimeMs);return new Xh(t.batchId,s,n,r)}function cd(e,t){const n=ad(t.readTime),r=void 0!==t.lastLimboFreeSnapshotVersion?ad(t.lastLimboFreeSnapshotVersion):Et.min();let s;return s=function(e){return void 0!==e.structuredPipeline}(t.query)?function(e,t){const n=e.structuredPipeline;Pe((n?.pipeline?.stages??[]).length>0,1845);const r=n?.pipeline?.stages.map(pd);return new Qu(t,r)}(t.query,e.zr):function(e){return void 0!==e.documents}(t.query)?function(e){const t=e.documents.length;return Pe(1===t,1966,{count:t}),Ji(Hi(io(e.documents[0])))}(t.query):function(e){return Ji(go(e))}(t.query),new td(s,t.targetId,"TargetPurposeListen",t.lastListenSequenceNumber,n,r,Dr.fromBase64String(t.resumeToken))}function ud(e,t){const n=id(t.snapshotVersion),r=id(t.lastLimboFreeSnapshotVersion);let s;s=Fi(t.target)?yo(e.zr,t.target):Bi(t.target)?fo(e.zr,t.target):po(e.zr,t.target).yt;const i=t.resumeToken.toBase64();return{targetId:t.targetId,canonicalId:Qh(t.target),readTime:n,resumeToken:i,lastListenSequenceNumber:t.sequenceNumber,lastLimboFreeSnapshotVersion:r,query:s}}function ld(e){const t=go({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?ta(t,t.limit,"L"):t}function hd(e,t){return new ed(t.largestBatchId,ho(e.zr,t.overlayMutation))}function dd(e,t){const n=t.path.lastSegment();return[e,an(t.path.popLast()),n]}function fd(e,t,n,r){return{indexId:e,uid:t,sequenceNumber:n,readTime:id(r.readTime),documentKey:an(r.documentKey.path),largestBatchId:r.largestBatchId}}function pd(e){switch(e.name){case"collection":return new Fu(e.args[0].referenceValue,{});case"collection_group":return new Bu(e.args[1].stringValue,{});case"database":return new qu({});case"documents":return new zu(e.args.map(e=>e.referenceValue),{});case"where":return new ju(md(e.args[0]),{});case"limit":{const t=e.args[0].integerValue??e.args[0].doubleValue;return new Gu("number"==typeof t?t:Number(t),{})}case"sort":return new Ku(e.args.map(e=>function(e){const t=e.mapValue?.fields;return new Pu(md(t.expression),t.direction?.stringValue,"orderingFromProto")}(e)),{});default:throw new Error(`Stage type: ${e.name} not supported.`)}}function md(e){return e.fieldReferenceValue?new Tu(eu("_exprFromProto",e.fieldReferenceValue),"_exprFromProto"):e.functionValue?function(e){return new Nu(e.functionValue.name,e.functionValue.args?.map(md)||[])}(e):Su._fromProto(e)}class gd{getBundleMetadata(e,t){return yd(e).get(t).next(e=>{if(e)return function(e){return{id:e.bundleId,createTime:ad(e.createTime),version:e.version}}(e)})}saveBundleMetadata(e,t){return yd(e).put(function(e){return{bundleId:e.id,createTime:id(Xa(e.createTime)),version:e.version}}(t))}getNamedQuery(e,t){return wd(e).get(t).next(e=>{if(e)return function(e){return{name:e.name,query:ld(e.bundledQuery),readTime:ad(e.readTime)}}(e)})}saveNamedQuery(e,t){return wd(e).put(function(e){return{name:e.name,readTime:id(Xa(e.readTime)),bundledQuery:e.bundledQuery}}(t))}}function yd(e){return gr(e,zn)}function wd(e){return gr(e,jn)}
2class _d{constructor(e,t){this.serializer=e,this.userId=t}static jr(e,t){const n=t.uid||"";return new _d(e,n)}getOverlay(e,t){return vd(e).get(dd(this.userId,t)).next(e=>e?hd(this.serializer,e):null)}getOverlays(e,t){const n=wa();return Vt.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&n.set(t,e)})).next(()=>n)}getAllOverlays(e,t){const n=wa();return vd(e).ee((e,r)=>{const s=hd(this.serializer,r);s.largestBatchId>t&&n.set(s.getKey(),s)}).next(()=>n)}saveOverlays(e,t,n){const r=[];return n.forEach((n,s)=>{const i=new ed(t,s);r.push(this.Hr(e,i))}),Vt.waitFor(r)}removeOverlaysForBatchId(e,t,n){const r=new Set;t.forEach(e=>r.add(an(e.getCollectionPath())));const s=[];return r.forEach(t=>{const r=IDBKeyRange.bound([this.userId,t,n],[this.userId,t,n+1],!1,!0);s.push(vd(e).Z(nr,r))}),Vt.waitFor(s)}getOverlaysForCollection(e,t,n){const r=wa(),s=an(t),i=IDBKeyRange.bound([this.userId,s,n],[this.userId,s,Number.POSITIVE_INFINITY],!0);return vd(e).H(nr,i).next(e=>{for(const t of e){const e=hd(this.serializer,t);r.set(e.getKey(),e)}return r})}getOverlaysForCollectionGroup(e,t,n,r){const s=wa();let i;const a=IDBKeyRange.bound([this.userId,t,n],[this.userId,t,Number.POSITIVE_INFINITY],!0);return vd(e).ee({index:sr,range:a},(e,t,n)=>{const a=hd(this.serializer,t);s.size()<r||a.largestBatchId===i?(s.set(a.getKey(),a),i=a.largestBatchId):n.done()}).next(()=>s)}Hr(e,t){return vd(e).put(function(e,t,n){const[r,s,i]=dd(t,n.mutation.key);return{userId:t,collectionPath:s,documentId:i,collectionGroup:n.mutation.key.getCollectionGroup(),largestBatchId:n.largestBatchId,overlayMutation:lo(e.zr,n.mutation)}}(this.serializer,this.userId,t))}}function vd(e){return gr(e,er)}class Ed{Jr(e){return gr(e,ar)}getSessionToken(e){return this.Jr(e).get("sessionToken").next(e=>{const t=e?.value;return t?Dr.fromUint8Array(t):Dr.EMPTY_BYTE_STRING})}setSessionToken(e,t){return this.Jr(e).put({name:"sessionToken",value:t.toUint8Array()})}}class Id{constructor(){}Yr(e,t){this.Zr(e,t),t.Xr()}Zr(e,t){if("nullValue"in e)this.ei(t,5);else if("booleanValue"in e)this.ei(t,10),t.ti(e.booleanValue?1:0);else if("integerValue"in e)this.ei(t,15),t.ti(xr(e.integerValue));else if("doubleValue"in e){const n=xr(e.doubleValue);
vendor: 4,083 bytes, line 2
2isNaN(n)?this.ei(t,13):(this.ei(t,15),tn(n)?t.ti(0):t.ti(n))}else if("timestampValue"in e){let n=e.timestampValue;this.ei(t,20),"string"==typeof n&&(n=kr(n)),t.ni(`${n.seconds||""}`),t.ti(n.nanos||0)}else if("stringValue"in e)this.ri(e.stringValue,t),this.ii(t);else if("bytesValue"in e)this.ei(t,30),t.si(Pr(e.bytesValue)),this.ii(t);else if("referenceValue"in e)this._i(e.referenceValue,t);else if("geoPointValue"in e){const n=e.geoPointValue;this.ei(t,45),t.ti(n.latitude||0),t.ti(n.longitude||0)}else"mapValue"in e?_s(e)?this.ei(t,Number.MAX_SAFE_INTEGER):gs(e)?this.oi(e.mapValue,t):(this.ai(e.mapValue,t),this.ii(t)):"arrayValue"in e?(this.ui(e.arrayValue,t),this.ii(t)):ke(19022,{ci:e})}ri(e,t){this.ei(t,25),this.li(e,t)}li(e,t){t.ni(e)}ai(e,t){const n=e.fields||{};this.ei(t,55);for(const e of Object.keys(n))this.ri(e,t),this.Zr(n[e],t)}oi(e,t){const n=e.fields||{};this.ei(t,53);const r=Yr,s=n[r].arrayValue?.values?.length||0;this.ei(t,15),t.ti(xr(s)),this.ri(r,t),this.Zr(n[r],t)}ui(e,t){const n=e.values||[];this.ei(t,50);for(const e of n)this.Zr(e,t)}_i(e,t){this.ei(t,37),ot.fromName(e).path.forEach(e=>{this.ei(t,60),this.li(e,t)})}ei(e,t){e.ti(t)}ii(e){e.ti(2)}}Id.Ei=new Id;const Td=255;function bd(e){if(0===e)return 8;let t=0;return e>>4||(t+=4,e<<=4),e>>6||(t+=2,e<<=2),e>>7||(t+=1),t}function Sd(e){const t=64-function(e){let t=0;for(let n=0;n<8;++n){const r=bd(255&e[n]);if(t+=r,8!==r)break}return t}(e);return Math.ceil(t/8)}class Ad{constructor(){this.buffer=new Uint8Array(1024),this.position=0}hi(e){const t=e[Symbol.iterator]();let n=t.next();for(;!n.done;)this.Ti(n.value),n=t.next();this.Pi()}Ri(e){const t=e[Symbol.iterator]();let n=t.next();for(;!n.done;)this.Ii(n.value),n=t.next();this.Ai()}Vi(e){for(const t of e){const e=t.charCodeAt(0);if(e<128)this.Ti(e);else if(e<2048)this.Ti(960|e>>>6),this.Ti(128|63&e);else if(t<"\ud800"||"\udbff"<t)this.Ti(480|e>>>12),this.Ti(128|63&e>>>6),this.Ti(128|63&e);else{const e=t.codePointAt(0);this.Ti(240|e>>>18),this.Ti(128|63&e>>>12),this.Ti(128|63&e>>>6),this.Ti(128|63&e)}}this.Pi()}di(e){for(const t of e){const e=t.charCodeAt(0);if(e<128)this.Ii(e);else if(e<2048)this.Ii(960|e>>>6),this.Ii(128|63&e);else if(t<"\ud800"||"\udbff"<t)this.Ii(480|e>>>12),this.Ii(128|63&e>>>6),this.Ii(128|63&e);else{const e=t.codePointAt(0);this.Ii(240|e>>>18),this.Ii(128|63&e>>>12),this.Ii(128|63&e>>>6),this.Ii(128|63&e)}}this.Ai()}fi(e){const t=this.mi(e),n=Sd(t);this.pi(1+n),this.buffer[this.position++]=255&n;for(let e=t.length-n;e<t.length;++e)this.buffer[this.position++]=255&t[e]}gi(e){const t=this.mi(e),n=Sd(t);this.pi(1+n),this.buffer[this.position++]=~(255&n);for(let e=t.length-n;e<t.length;++e)this.buffer[this.position++]=~(255&t[e])}yi(){this.wi(Td),this.wi(255)}bi(){this.Si(Td),this.Si(255)}reset(){this.position=0}seed(e){this.pi(e.length),this.buffer.set(e,this.position),this.position+=e.length}Di(){return this.buffer.slice(0,this.position)}mi(e){const t=function(e){const t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e,!1),new Uint8Array(t.buffer)}(e),n=!!(128&t[0]);t[0]^=n?255:128;for(let e=1;e<t.length;++e)t[e]^=n?255:0;return t}Ti(e){const t=255&e;0===t?(this.wi(0),this.wi(255)):t===Td?(this.wi(Td),this.wi(0)):this.wi(t)}Ii(e){const t=255&e;0===t?(this.Si(0),this.Si(255)):t===Td?(this.Si(Td),this.Si(0)):this.Si(e)}Pi(){this.wi(0),this.wi(1)}Ai(){this.Si(0),this.Si(1)}wi(e){this.pi(1),this.buffer[this.position++]=e}Si(e){this.pi(1),this.buffer[this.position++]=~e}pi(e){const t=e+this.position;if(t<=this.buffer.length)return;let n=2*this.buffer.length;n<t&&(n=t);const r=new Uint8Array(n);r.set(this.buffer),this.buffer=r}}class Cd{constructor(e){this.xi=e}si(e){this.xi.hi(e)}ni(e){this.xi.Vi(e)}ti(e){this.xi.fi(e)}Xr(){this.xi.yi()}}class Nd{constructor(e){this.xi=e}si(e){this.xi.Ri(e)}ni(e){this.xi.di(e)}ti(e){this.xi.gi(e)}Xr(){this.xi.bi()}}class Od{constructor(){this.xi=new Ad,this.ascending=new Cd(this.xi),this.descending=new Nd(this.xi)}seed(e){this.xi.seed(e)}Ci(e){return 0===e?this.ascending:this.descending}Di(){return this.xi.Di()}reset(){this.xi.reset()}}
2class Dd{constructor(e,t,n,r){this.Fi=e,this.Oi=t,this.Mi=n,this.Ni=r}Li(){const e=this.Ni.length,t=0===e||255===this.Ni[e-1]?e+1:e,n=new Uint8Array(t);return n.set(this.Ni,0),t!==e?n.set([0],this.Ni.length):++n[n.length-1],new Dd(this.Fi,this.Oi,this.Mi,n)}Bi(e,t,n){return{indexId:this.Fi,uid:e,arrayValue:xd(this.Mi),directionalValue:xd(this.Ni),orderedDocumentKey:xd(t),documentKey:n.path.toArray()}}Ui(e,t,n){const r=this.Bi(e,t,n);return[r.indexId,r.uid,r.arrayValue,r.directionalValue,r.orderedDocumentKey,r.documentKey]}}function Rd(e,t){let n=e.Fi-t.Fi;return 0!==n?n:(n=kd(e.Mi,t.Mi),0!==n?n:(n=kd(e.Ni,t.Ni),0!==n?n:ot.comparator(e.Oi,t.Oi)))}function kd(e,t){for(let n=0;n<e.length&&n<t.length;++n){const r=e[n]-t[n];if(0!==r)return r}return e.length-t.length}function xd(e){return(0,o.Ov)()?function(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}(e):e}function Pd(e){return"string"!=typeof e?e:function(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(e)}class Ld{constructor(e){this.ki=new vr((e,t)=>at.comparator(e.field,t.field)),this.collectionId=null!=e.collectionGroup?e.collectionGroup:e.path.lastSegment(),this.qi=e.orderBy,this.$i=[];for(const t of e.filters){const e=t;e.isInequality()?this.ki=this.ki.add(e):this.$i.push(e)}}get Ki(){return this.ki.size>1}Wi(e){if(Pe(e.collectionGroup===this.collectionId,49279),this.Ki)return!1;const t=bt(e);if(void 0!==t&&!this.Qi(t))return!1;const n=St(e);let r=new Set,s=0,i=0;for(;s<n.length&&this.Qi(n[s]);++s)r=r.add(n[s].fieldPath.canonicalString());if(s===n.length)return!0;if(this.ki.size>0){const e=this.ki.getIterator().getNext();if(!r.has(e.field.canonicalString())){const t=n[s];if(!this.Gi(e,t)||!this.zi(this.qi[i++],t))return!1}++s}for(;s<n.length;++s){const e=n[s];if(i>=this.qi.length||!this.zi(this.qi[i++],e))return!1}return!0}ji(){if(this.Ki)return null;let e=new vr(at.comparator);const t=[];for(const n of this.$i)if(!n.field.isKeyField())if("array-contains"===n.op||"array-contains-any"===n.op)t.push(new Ct(n.field,2));else{if(e.has(n.field))continue;e=e.add(n.field),t.push(new Ct(n.field,0))}for(const n of this.qi)n.field.isKeyField()||e.has(n.field)||(e=e.add(n.field),t.push(new Ct(n.field,"asc"===n.dir?0:1)));return new Tt(Tt.UNKNOWN_ID,this.collectionId,t,Ot.empty())}Qi(e){for(const t of this.$i)if(this.Gi(t,e))return!0;return!1}Gi(e,t){if(void 0===e||!e.field.isEqual(t.fieldPath))return!1;const n="array-contains"===e.op||"array-contains-any"===e.op;return 2===t.kind===n}zi(e,t){return!!e.field.isEqual(t.fieldPath)&&(0===t.kind&&"asc"===e.dir||1===t.kind&&"desc"===e.dir)}}function Md(e){if(Pe(e instanceof pi||e instanceof mi,20012),e instanceof pi){if(e instanceof Oi){const t=e.value.arrayValue?.values?.map(t=>pi.create(e.field,"==",t))||[];return mi.create(t,"or")}return e}const t=e.filters.map(e=>Md(e));return mi.create(t,e.op)}function Vd(e){if(0===e.getFilters().length)return[];const t=qd(Md(e));return Pe(Bd(t),7391),Ud(t)||Fd(t)?[t]:t.getFilters()}function Ud(e){return e instanceof pi}function Fd(e){return e instanceof mi&&wi(e)}function Bd(e){return Ud(e)||Fd(e)||function(e){if(e instanceof mi&&yi(e)){for(const t of e.getFilters())if(!Ud(t)&&!Fd(t))return!1;return!0}return!1}(e)}function qd(e){if(Pe(e instanceof pi||e instanceof mi,34018),e instanceof pi)return e;if(1===e.filters.length)return qd(e.filters[0]);const t=e.filters.map(e=>qd(e));let n=mi.create(t,e.op);return n=Gd(n),Bd(n)?n:(Pe(n instanceof mi,64498),Pe(gi(n),40251),Pe(n.filters.length>1,57927),n.filters.reduce((e,t)=>zd(e,t)))}function zd(e,t){let n;return Pe(e instanceof pi||e instanceof mi,38388),Pe(t instanceof pi||t instanceof mi,25473),n=e instanceof pi?t instanceof pi?function(e,t){return mi.create([e,t],"and")}(e,t):jd(e,t):t instanceof pi?jd(t,e):function(e,t){if(Pe(e.filters.length>0&&t.filters.length>0,48005),gi(e)&&gi(t))return Ii(e,t.getFilters());const n=yi(e)?e:t,r=yi(e)?t:e,s=n.filters.map(e=>zd(e,r));return mi.create(s,"or")}(e,t),Gd(n)}function jd(e,t){if(gi(t))return Ii(t,e.getFilters());{const n=t.filters.map(t=>zd(e,t));return mi.create(n,"or")}}function Gd(e){if(Pe(e instanceof pi||e instanceof mi,11850),e instanceof pi)return e;const t=e.getFilters();if(1===t.length)return Gd(t[0]);if(_i(e))return e;const n=t.map(e=>Gd(e)),r=[];
2return n.forEach(t=>{t instanceof pi?r.push(t):t instanceof mi&&(t.op===e.op?r.push(...t.filters):r.push(t))}),1===r.length?r[0]:mi.create(r,e.op)}class $d{constructor(){this.Hi=new Hd}addToCollectionParentIndex(e,t){return this.Hi.add(t),Vt.resolve()}getCollectionParents(e,t){return Vt.resolve(this.Hi.getEntries(t))}addFieldIndex(e,t){return Vt.resolve()}deleteFieldIndex(e,t){return Vt.resolve()}deleteAllFieldIndexes(e){return Vt.resolve()}createTargetIndexes(e,t){return Vt.resolve()}getDocumentsMatchingTarget(e,t){return Vt.resolve(null)}getIndexType(e,t){return Vt.resolve(0)}getFieldIndexes(e,t){return Vt.resolve([])}getNextCollectionGroupToUpdate(e){return Vt.resolve(null)}getMinOffset(e,t){return Vt.resolve(kt.min())}getMinOffsetFromCollectionGroup(e,t){return Vt.resolve(kt.min())}updateCollectionGroup(e,t,n){return Vt.resolve()}updateIndexEntries(e,t){return Vt.resolve()}}class Hd{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new vr(st.comparator),s=!r.has(n);return this.index[t]=r.add(n),s}has(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new vr(st.comparator)).toArray()}}const Kd="IndexedDbIndexManager",Wd=new Uint8Array(0);class Yd{constructor(e,t){this.databaseId=t,this.Ji=new Hd,this.Yi=new da(e=>Vi(e),(e,t)=>Ui(e,t)),this.uid=e.uid||""}addToCollectionParentIndex(e,t){if(!this.Ji.has(t)){const n=t.lastSegment(),r=t.popLast();e.addOnCommittedListener(()=>{this.Ji.add(t)});const s={collectionId:n,parent:an(r)};return Qd(e).put(s)}return Vt.resolve()}getCollectionParents(e,t){const n=[],r=IDBKeyRange.bound([t,""],[tt(t),""],!1,!0);return Qd(e).H(r).next(e=>{for(const r of e){if(r.collectionId!==t)break;n.push(un(r.parent))}return n})}addFieldIndex(e,t){const n=Xd(e),r=function(e){return{indexId:e.indexId,collectionGroup:e.collectionGroup,fields:e.fields.map(e=>[e.fieldPath.canonicalString(),e.kind])}}(t);delete r.indexId;const s=n.add(r);if(t.indexState){const n=Zd(e);return s.next(e=>{n.put(fd(e,this.uid,t.indexState.sequenceNumber,t.indexState.offset))})}return s.next()}deleteFieldIndex(e,t){const n=Xd(e),r=Zd(e),s=Jd(e);return n.delete(t.indexId).next(()=>r.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0))).next(()=>s.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0)))}deleteAllFieldIndexes(e){const t=Xd(e),n=Jd(e),r=Zd(e);return t.Z().next(()=>n.Z()).next(()=>r.Z())}createTargetIndexes(e,t){return Vt.forEach(this.Zi(t),t=>this.getIndexType(e,t).next(n=>{if(0===n||1===n){const n=new Ld(t).ji();if(null!=n)return this.addFieldIndex(e,n)}}))}getDocumentsMatchingTarget(e,t){const n=Jd(e);let r=!0;const s=new Map;return Vt.forEach(this.Zi(t),t=>this.Xi(e,t).next(e=>{r&&(r=!!e),s.set(t,e)})).next(()=>{if(r){let e=Ta();const r=[];return Vt.forEach(s,(s,i)=>{Ne(Kd,`Using index ${function(e){return`id=${e.indexId}|cg=${e.collectionGroup}|f=${e.fields.map(e=>`${e.fieldPath}:${e.kind}`).join(",")}`}(s)} to execute ${Vi(t)}`);const a=function(e,t){const n=bt(t);if(void 0===n)return null;for(const t of qi(e,n.fieldPath))switch(t.op){case"array-contains-any":return t.value.arrayValue.values||[];case"array-contains":return[t.value]}return null}(i,s),o=function(e,t){const n=new Map;for(const r of St(t))for(const t of qi(e,r.fieldPath))switch(t.op){case"==":case"in":n.set(r.fieldPath.canonicalString(),t.value);break;case"not-in":case"!=":return n.set(r.fieldPath.canonicalString(),t.value),Array.from(n.values())}return null}(i,s),c=function(e,t){const n=[];let r=!0;for(const s of St(t)){const t=0===s.kind?zi(e,s.fieldPath,e.startAt):ji(e,s.fieldPath,e.startAt);n.push(t.value),r&&(r=t.inclusive)}return new li(n,r)}(i,s),u=function(e,t){const n=[];let r=!0;for(const s of St(t)){const t=0===s.kind?ji(e,s.fieldPath,e.endAt):zi(e,s.fieldPath,e.endAt);n.push(t.value),r&&(r=t.inclusive)}return new li(n,r)}(i,s),l=this.es(s,i,c),h=this.es(s,i,u),d=this.ts(s,i,o),f=this.ns(s.indexId,a,l,c.inclusive,h,u.inclusive,d);return Vt.forEach(f,s=>n.Y(s,t.limit).next(t=>{t.forEach(t=>{const n=ot.fromSegments(t.documentKey);e.has(n)||(e=e.add(n),r.push(n))})}))}).next(()=>r)}return Vt.resolve(null)})}Zi(e){let t=this.Yi.get(e);return t||(t=0===e.filters.length?[e]:Vd(mi.create(e.filters,"and")).map(t=>Mi(e.path,e.collectionGroup,e.orderBy,t.getFilters(),e.limit,e.startAt,e.endAt)),this.Yi.set(e,t),t)}ns(e,t,n,r,s,i,a){const o=(null!=t?t.length:1)*Math.max(n.length,s.length),c=o/(null!=t?t.length:1),u=[];for(let l=0;l<o;++l){const o=t?this.rs(t[l/c]):Wd,h=this.ss(e,o,n[l%c],r),d=this._s(e,o,s[l%c],i),f=a.map(t=>this.ss(e,o,t,!0));u.push(...this.createRange(h,d,f))}return u}ss(e,t,n,r){const s=new Dd(e,ot.empty(),t,n);return r?s:s.Li()}_s(e,t,n,r){const s=new Dd(e,ot.empty(),t,n);return r?s.Li():s}Xi(e,t){const n=new Ld(t),r=null!=t.collectionGroup?t.collectionGroup:t.path.lastSegment();return this.getFieldIndexes(e,r).next(e=>{let t=null;for(const r of e)n.Wi(r)&&(!t||r.fields.length>t.fields.length)&&(t=r);return t})}getIndexType(e,t){let n=2;const r=this.Zi(t);return Vt.forEach(r,t=>
2this.Xi(e,t).next(e=>{e?0!==n&&e.fields.length<function(e){let t=new vr(at.comparator),n=!1;for(const r of e.filters)for(const e of r.getFlattenedFilters())e.field.isKeyField()||("array-contains"===e.op||"array-contains-any"===e.op?n=!0:t=t.add(e.field));for(const n of e.orderBy)n.field.isKeyField()||(t=t.add(n.field));return t.size+(n?1:0)}(t)&&(n=1):n=0})).next(()=>function(e){return null!==e.limit}(t)&&r.length>1&&2===n?1:n)}us(e,t){const n=new Od;for(const r of St(e)){const e=t.data.field(r.fieldPath);if(null==e)return null;const s=n.Ci(r.kind);Id.Ei.Yr(e,s)}return n.Di()}rs(e){const t=new Od;return Id.Ei.Yr(e,t.Ci(0)),t.Di()}cs(e,t){const n=new Od;return Id.Ei.Yr(cs(this.databaseId,t),n.Ci(function(e){const t=St(e);return 0===t.length?0:t[t.length-1].kind}(e))),n.Di()}ts(e,t,n){if(null===n)return[];let r=[];r.push(new Od);let s=0;for(const i of St(e)){const e=n[s++];for(const n of r)if(this.ls(t,i.fieldPath)&&ds(e))r=this.Es(r,i,e);else{const t=n.Ci(i.kind);Id.Ei.Yr(e,t)}}return this.hs(r)}es(e,t,n){return this.ts(e,t,n.position)}hs(e){const t=[];for(let n=0;n<e.length;++n)t[n]=e[n].Di();return t}Es(e,t,n){const r=[...e],s=[];for(const e of n.arrayValue.values||[])for(const n of r){const r=new Od;r.seed(n.Di()),Id.Ei.Yr(e,r.Ci(t.kind)),s.push(r)}return s}ls(e,t){return!!e.filters.find(e=>e instanceof pi&&e.field.isEqual(t)&&("in"===e.op||"not-in"===e.op))}getFieldIndexes(e,t){const n=Xd(e),r=Zd(e);return(t?n.H($n,IDBKeyRange.bound(t,t)):n.H()).next(e=>{const t=[];return Vt.forEach(e,e=>r.get([e.indexId,this.uid]).next(n=>{t.push(function(e,t){const n=t?new Ot(t.sequenceNumber,new kt(ad(t.readTime),new ot(un(t.documentKey)),t.largestBatchId)):Ot.empty(),r=e.fields.map(([e,t])=>new Ct(at.fromServerFormat(e),t));return new Tt(e.indexId,e.collectionGroup,r,n)}(e,n))})).next(()=>t)})}getNextCollectionGroupToUpdate(e){return this.getFieldIndexes(e).next(e=>0===e.length?null:(e.sort((e,t)=>{const n=e.indexState.sequenceNumber-t.indexState.sequenceNumber;return 0!==n?n:Je(e.collectionGroup,t.collectionGroup)}),e[0].collectionGroup))}updateCollectionGroup(e,t,n){const r=Xd(e),s=Zd(e);return this.Ts(e).next(e=>r.H($n,IDBKeyRange.bound(t,t)).next(t=>Vt.forEach(t,t=>s.put(fd(t.indexId,this.uid,e,n)))))}updateIndexEntries(e,t){const n=new Map;return Vt.forEach(t,(t,r)=>{const s=n.get(t.collectionGroup);return(s?Vt.resolve(s):this.getFieldIndexes(e,t.collectionGroup)).next(s=>(n.set(t.collectionGroup,s),Vt.forEach(s,n=>this.Ps(e,t,n).next(t=>{const s=this.Rs(r,n);return t.isEqual(s)?Vt.resolve():this.Is(e,r,n,t,s)}))))})}As(e,t,n,r){return Jd(e).put(r.Bi(this.uid,this.cs(n,t.key),t.key))}Vs(e,t,n,r){return Jd(e).delete(r.Ui(this.uid,this.cs(n,t.key),t.key))}
2Ps(e,t,n){const r=Jd(e);let s=new vr(Rd);return r.ee({index:Xn,range:IDBKeyRange.only([n.indexId,this.uid,xd(this.cs(n,t))])},(e,r)=>{s=s.add(new Dd(n.indexId,t,Pd(r.arrayValue),Pd(r.directionalValue)))}).next(()=>s)}Rs(e,t){let n=new vr(Rd);const r=this.us(t,e);if(null==r)return n;const s=bt(t);if(null!=s){const i=e.data.field(s.fieldPath);if(ds(i))for(const s of i.arrayValue.values||[])n=n.add(new Dd(t.indexId,e.key,this.rs(s),r))}else n=n.add(new Dd(t.indexId,e.key,Wd,r));return n}Is(e,t,n,r,s){Ne(Kd,"Updating index entries for document '%s'",t.key);const i=[];return function(e,t,n,r,s){const i=e.getIterator(),a=t.getIterator();let o=Ir(i),c=Ir(a);for(;o||c;){let e=!1,t=!1;if(o&&c){const r=n(o,c);r<0?t=!0:r>0&&(e=!0)}else null!=o?t=!0:e=!0;e?(r(c),c=Ir(a)):t?(s(o),o=Ir(i)):(o=Ir(i),c=Ir(a))}}(r,s,Rd,r=>{i.push(this.As(e,t,n,r))},r=>{i.push(this.Vs(e,t,n,r))}),Vt.waitFor(i)}Ts(e){let t=1;return Zd(e).ee({index:Wn,reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},(e,n,r)=>{r.done(),t=n.sequenceNumber+1}).next(()=>t)}createRange(e,t,n){n=n.sort((e,t)=>Rd(e,t)).filter((e,t,n)=>!t||0!==Rd(e,n[t-1]));const r=[];r.push(e);for(const s of n){const n=Rd(s,e),i=Rd(s,t);if(0===n)r[0]=e.Li();else if(n>0&&i<0)r.push(s),r.push(s.Li());else if(i>0)break}r.push(t);const s=[];for(let e=0;e<r.length;e+=2){if(this.ds(r[e],r[e+1]))return[];const t=r[e].Ui(this.uid,Wd,ot.empty()),n=r[e+1].Ui(this.uid,Wd,ot.empty());s.push(IDBKeyRange.bound(t,n))}return s}ds(e,t){return Rd(e,t)>0}getMinOffsetFromCollectionGroup(e,t){return this.getFieldIndexes(e,t).next(ef)}getMinOffset(e,t){return Vt.mapArray(this.Zi(t),t=>this.Xi(e,t).next(e=>e||ke(44426))).next(ef)}}function Qd(e){return gr(e,Fn)}function Jd(e){return gr(e,Qn)}function Xd(e){return gr(e,Gn)}function Zd(e){return gr(e,Hn)}function ef(e){Pe(0!==e.length,28825);let t=e[0].indexState.offset,n=t.largestBatchId;for(let r=1;r<e.length;r++){const s=e[r].indexState.offset;xt(s,t)<0&&(t=s),n<s.largestBatchId&&(n=s.largestBatchId)}return new kt(t.readTime,t.documentKey,n)}function tf(e,t,n){const r=e.store(pn),s=e.store(En),i=[],a=IDBKeyRange.only(n.batchId);let o=0;const c=r.ee({range:a},(e,t,n)=>(o++,n.delete()));i.push(c.next(()=>{Pe(1===o,47070,{batchId:n.batchId})}));const u=[];for(const e of n.mutations){const r=_n(t,e.key.path,n.batchId);i.push(s.delete(r)),u.push(e.key)}return Vt.waitFor(i).next(()=>u)}function nf(e){if(!e)return 0;let t;if(e.document)t=e.document;else if(e.unknownDocument)t=e.unknownDocument;else{if(!e.noDocument)throw ke(14731);t=e.noDocument}return JSON.stringify(t).length}class rf{constructor(e,t,n,r){this.userId=e,this.serializer=t,this.indexManager=n,this.referenceDelegate=r,this.fs={}}static jr(e,t,n,r){Pe(""!==e.uid,64387);const s=e.isAuthenticated()?e.uid:"";return new rf(s,t,n,r)}checkEmpty(e){let t=!0;const n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return af(e).ee({index:gn,range:n},(e,n,r)=>{t=!1,r.done()}).next(()=>t)}addMutationBatch(e,t,n,r){const s=of(e),i=af(e);return i.add({}).next(a=>{Pe("number"==typeof a,49019);const o=new Xh(a,t,n,r),c=function(e,t,n){const r=n.baseMutations.map(t=>lo(e.zr,t)),s=n.mutations.map(t=>lo(e.zr,t));return{userId:t,batchId:n.batchId,localWriteTimeMs:n.localWriteTime.toMillis(),baseMutations:r,mutations:s}}(this.serializer,this.userId,o),u=[];let l=new vr((e,t)=>Je(e.canonicalString(),t.canonicalString()));for(const e of r){const t=_n(this.userId,e.key.path,a);l=l.add(e.key.path.popLast()),u.push(i.put(c)),u.push(s.put(t,vn))}return l.forEach(t=>{u.push(this.indexManager.addToCollectionParentIndex(e,t))}),e.addOnCommittedListener(()=>{this.fs[a]=o.keys()}),Vt.waitFor(u).next(()=>o)})}lookupMutationBatch(e,t){return af(e).get(t).next(e=>e?(Pe(e.userId===this.userId,48,"Unexpected user for mutation batch",{userId:e.userId,batchId:t}),od(this.serializer,e)):null)}ps(e,t){return this.fs[t]?Vt.resolve(this.fs[t]):this.lookupMutationBatch(e,t).next(e=>{if(e){const n=e.keys();return this.fs[t]=n,n}return null})}getNextMutationBatchAfterBatchId(e,t){const n=t+1,r=IDBKeyRange.lowerBound([this.userId,n]);let s=null;return af(e).ee({index:gn,range:r},(e,t,r)=>{t.userId===this.userId&&(Pe(t.batchId>=n,47524,{gs:n}),s=od(this.serializer,t)),r.done()}).next(()=>s)}getHighestUnacknowledgedBatchId(e){const t=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]);let n=Zt;return af(e).ee({index:gn,range:t,reverse:!0},(e,t,r)=>{n=t.batchId,r.done()}).next(()=>n)}getAllMutationBatches(e){const t=IDBKeyRange.bound([this.userId,Zt],[this.userId,Number.POSITIVE_INFINITY]);return af(e).H(gn,t).next(e=>e.map(e=>od(this.serializer,e)))}getAllMutationBatchesAffectingDocumentKey(e,t){const n=wn(this.userId,t.path),r=IDBKeyRange.lowerBound(n),s=[];return of(e).ee({range:r},(n,r,i)=>{const[a,o,c]=n,u=un(o);if(a===this.userId&&t.path.isEqual(u))return af(e).get(c).next(e=>{if(!e)throw ke(61480,{ys:n,batchId:c});Pe(e.userId===this.userId,10503,"Unexpected user for mutation batch",{userId:e.userId,batchId:c}),s.push(od(this.serializer,e))});i.done()}).next(()=>s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new vr(Je);const r=[];return t.forEach(t=>{const s=wn(this.userId,t.path),i=IDBKeyRange.lowerBound(s),a=of(e).ee({range:i},(e,r,s)=>{const[i,a,o]=e,c=un(a);i===this.userId&&t.path.isEqual(c)?n=n.add(o):s.done()});r.push(a)}),Vt.waitFor(r).next(()=>this.ws(e,n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,r=n.length+1,s=wn(this.userId,n),i=IDBKeyRange.lowerBound(s);let a=new vr(Je);return of(e).ee({range:i}
2,(e,t,s)=>{const[i,o,c]=e,u=un(o);i===this.userId&&n.isPrefixOf(u)?u.length===r&&(a=a.add(c)):s.done()}).next(()=>this.ws(e,a))}ws(e,t){const n=[],r=[];return t.forEach(t=>{r.push(af(e).get(t).next(e=>{if(null===e)throw ke(35274,{batchId:t});Pe(e.userId===this.userId,9748,"Unexpected user for mutation batch",{userId:e.userId,batchId:t}),n.push(od(this.serializer,e))}))}),Vt.waitFor(r).next(()=>n)}removeMutationBatch(e,t){return tf(e.le,this.userId,t).next(n=>(e.addOnCommittedListener(()=>{this.bs(t.batchId)}),Vt.forEach(n,t=>this.referenceDelegate.markPotentiallyOrphaned(e,t))))}bs(e){delete this.fs[e]}performConsistencyCheck(e){return this.checkEmpty(e).next(t=>{if(!t)return Vt.resolve();const n=IDBKeyRange.lowerBound(function(e){return[e]}(this.userId)),r=[];return of(e).ee({range:n},(e,t,n)=>{if(e[0]===this.userId){const t=un(e[1]);r.push(t)}else n.done()}).next(()=>{Pe(0===r.length,56720,{vs:r.map(e=>e.canonicalString())})})})}containsKey(e,t){return sf(e,this.userId,t)}Ss(e){return cf(e).get(this.userId).next(e=>e||{userId:this.userId,lastAcknowledgedBatchId:Zt,lastStreamToken:""})}}function sf(e,t,n){const r=wn(t,n.path),s=r[1],i=IDBKeyRange.lowerBound(r);let a=!1;return of(e).ee({range:i,X:!0},(e,n,r)=>{const[i,o,c]=e;i===t&&o===s&&(a=!0),r.done()}).next(()=>a)}function af(e){return gr(e,pn)}function of(e){return gr(e,En)}function cf(e){return gr(e,fn)}class uf{constructor(e){this.Ds=e}next(){return this.Ds+=2,this.Ds}static xs(){return new uf(0)}static Cs(){return new uf(-1)}}class lf{constructor(e,t){this.referenceDelegate=e,this.serializer=t}allocateTargetId(e){return this.Fs(e).next(t=>{const n=new uf(t.highestTargetId);return t.highestTargetId=n.next(),this.Os(e,t).next(()=>t.highestTargetId)})}getLastRemoteSnapshotVersion(e){return this.Fs(e).next(e=>Et.fromTimestamp(new vt(e.lastRemoteSnapshotVersion.seconds,e.lastRemoteSnapshotVersion.nanoseconds)))}getHighestSequenceNumber(e){return this.Fs(e).next(e=>e.highestListenSequenceNumber)}setTargetsMetadata(e,t,n){return this.Fs(e).next(r=>(r.highestListenSequenceNumber=t,n&&(r.lastRemoteSnapshotVersion=n.toTimestamp()),t>r.highestListenSequenceNumber&&(r.highestListenSequenceNumber=t),this.Os(e,r)))}addTargetData(e,t){return this.Ms(e,t).next(()=>this.Fs(e).next(n=>(n.targetCount+=1,this.Ns(t,n),this.Os(e,n))))}updateTargetData(e,t){return this.Ms(e,t)}removeTargetData(e,t){return this.removeMatchingKeysForTargetId(e,t.targetId).next(()=>hf(e).delete(t.targetId)).next(()=>this.Fs(e)).next(t=>(Pe(t.targetCount>0,8065),t.targetCount-=1,this.Os(e,t)))}removeTargets(e,t,n){let r=0;const s=[];return hf(e).ee((i,a)=>{const o=cd(this.serializer,a);o.sequenceNumber<=t&&null===n.get(o.targetId)&&(r++,s.push(this.removeTargetData(e,o)))}).next(()=>Vt.waitFor(s)).next(()=>r)}forEachTarget(e,t){return hf(e).ee((e,n)=>{const r=cd(this.serializer,n);t(r)})}Fs(e){return df(e).get(Vn).next(e=>(Pe(null!==e,2888),e))}Os(e,t){return df(e).put(Vn,t)}Ms(e,t){return hf(e).put(ud(this.serializer,t))}Ns(e,t){let n=!1;return e.targetId>t.highestTargetId&&(t.highestTargetId=e.targetId,n=!0),e.sequenceNumber>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=e.sequenceNumber,n=!0),n}getTargetCount(e){return this.Fs(e).next(e=>e.targetCount)}getTargetData(e,t){const n=Qh(t),r=IDBKeyRange.bound([n,Number.NEGATIVE_INFINITY],[n,Number.POSITIVE_INFINITY]);let s=null;return hf(e).ee({range:r,index:Rn},(e,n,r)=>{const i=cd(this.serializer,n);Jh(t,i.target)&&(s=i,r.done())}).next(()=>s)}addMatchingKeys(e,t,n){const r=[],s=ff(e);return t.forEach(t=>{const i=an(t.path);r.push(s.put({targetId:n,path:i})),r.push(this.referenceDelegate.addReference(e,n,t))}),Vt.waitFor(r)}removeMatchingKeys(e,t,n){const r=ff(e);return Vt.forEach(t,t=>{const s=an(t.path);return Vt.waitFor([r.delete([n,s]),this.referenceDelegate.removeReference(e,n,t)])})}removeMatchingKeysForTargetId(e,t){const n=ff(e),r=IDBKeyRange.bound([t],[t+1],!1,!0);return n.delete(r)}getMatchingKeysForTargetId(e,t){const n=IDBKeyRange.bound([t],[t+1],!1,!0),r=ff(e);let s=Ta();return r.ee({range:n,X:!0},(e,t,n)=>{const r=un(e[1]),i=new ot(r);s=s.add(i)}).next(()=>s)}containsKey(e,t){const n=an(t.path),r=IDBKeyRange.bound([n],[tt(n)],!1,!0);let s=0;return ff(e).ee({index:Ln,X:!0,range:r},([e,t],n,r)=>{0!==e&&(s++,r.done())}).next(()=>s>0)}dt(e,t){return hf(e).get(t).next(e=>e?cd(this.serializer,e):null)}}function hf(e){return gr(e,Dn)}function df(e){return gr(e,Un)}function ff(e){return gr(e,xn)}class pf{constructor(e,t){this.db=e,this.garbageCollector=gc(this,t)}lr(e){const t=this.Ls(e);return this.db.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}Ls(e){let t=0;return this.Er(e,e=>{t++}).next(()=>t)}
2forEachTarget(e,t){return this.db.getTargetCache().forEachTarget(e,t)}Er(e,t){return this.Bs(e,(e,n)=>t(n))}addReference(e,t,n){return mf(e,n)}removeReference(e,t,n){return mf(e,n)}removeTargets(e,t,n){return this.db.getTargetCache().removeTargets(e,t,n)}markPotentiallyOrphaned(e,t){return mf(e,t)}Us(e,t){return function(e,t){let n=!1;return cf(e).te(r=>sf(e,r,t).next(e=>(e&&(n=!0),Vt.resolve(!e)))).next(()=>n)}(e,t)}removeOrphanedDocuments(e,t){const n=this.db.getRemoteDocumentCache().newChangeBuffer(),r=[];let s=0;return this.Bs(e,(i,a)=>{if(a<=t){const t=this.Us(e,i).next(t=>{if(!t)return s++,n.getEntry(e,i).next(()=>(n.removeEntry(i,Et.min()),ff(e).delete(function(e){return[0,an(e.path)]}(i))))});r.push(t)}}).next(()=>Vt.waitFor(r)).next(()=>n.apply(e)).next(()=>s)}removeTarget(e,t){const n=t.withSequenceNumber(e.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(e,n)}updateLimboDocument(e,t){return mf(e,t)}Bs(e,t){const n=ff(e);let r,s=Xt.ce;return n.ee({index:Ln},([e,n],{path:i,sequenceNumber:a})=>{0===e?(s!==Xt.ce&&t(new ot(un(r)),s),s=a,r=i):s=Xt.ce}).next(()=>{s!==Xt.ce&&t(new ot(un(r)),s)})}getCacheSize(e){return this.db.getRemoteDocumentCache().getSize(e)}}function mf(e,t){return ff(e).put(function(e,t){return{targetId:0,path:an(e.path),sequenceNumber:t}}(t,e.currentSequenceNumber))}function gf(e,t){let n=t;for(const t of e.stages)n=_f({serializer:e.serializer,serverTimestampBehavior:e.listenOptions?.serverTimestampBehavior},t,n);return n}function yf(e,t){return gf(e,[t]).length>0}function wf(e,t){return Hh(e)?yf(e,t):sa(e,t)}function _f(e,t,n){if(t instanceof Fu)return function(e,t,n){return n.filter(e=>e.isFoundDocument()&&`/${e.key.getCollectionPath().canonicalString()}`===t.Vr)}(0,t,n);if(t instanceof ju)return function(e,t,n){return n.filter(n=>{const r=sl(al(t.condition).evaluate(e,n));return void 0!==r&&es(r,Jr)})}(e,t,n);if(t instanceof Bu)return function(e,t,n){return n.filter(e=>e.isFoundDocument()&&e.key.getCollectionPath().lastSegment()===t.collectionId)}(0,t,n);if(t instanceof qu)return function(e,t,n){return n.filter(e=>e.isFoundDocument())}(0,0,n);if(t instanceof zu)return function(e,t,n){return n.filter(e=>e.isFoundDocument()&&t.mr.has(e.key.path.toStringWithLeadingSlash()))}(0,t,n);if(t instanceof Gu)return function(e,t,n){return n.slice(0,t.limit)}(0,t,n);if(t instanceof Ku)return function(e,t,n){const r=t.orderings.map(e=>({ks:al(e.expr),direction:e.direction}));return[...n].sort((t,n)=>{for(const{ks:s,direction:i}of r){const r=sl(s.evaluate(e,t)),a=sl(s.evaluate(e,n)),o=ns(r??Qr,a??Qr);if(0!==o)return"ascending"===i?o:-o}return 0})}(e,t,n);throw new Error(`Unknown stage: ${t._name}`)}function vf(e){const t=function(e){for(let t=e.stages.length-1;t>=0;t--){const n=e.stages[t];if(n instanceof Ku)return n.orderings}throw new Error("Pipeline must contain at least one Sort stage")}(e);return(n,r)=>{for(const s of t){const t=sl(al(s.expr).evaluate({serializer:e.serializer},n)),i=sl(al(s.expr).evaluate({serializer:e.serializer},r)),a=ns(t||Qr,i||Qr);if(0!==a)return"ascending"===s.direction?a:-a}return 0}}function Ef(e){for(let t=e.stages.length-1;t>=0;t--){const n=e.stages[t];if(n instanceof Gu)return{limit:n.limit}}}class If{constructor(){this.changes=new da(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Pi.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?Vt.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}class Tf{constructor(e){this.serializer=e}setIndexManager(e){this.indexManager=e}addEntry(e,t,n){return Cf(e).put(n)}removeEntry(e,t,n){return Cf(e).delete(function(e,t){const n=e.path.toArray();return[n.slice(0,n.length-2),n[n.length-2],sd(t),n[n.length-1]]}(t,n))}updateMetadata(e,t){return this.getMetadata(e).next(n=>(n.byteSize+=t,this.qs(e,n)))}getEntry(e,t){let n=Pi.newInvalidDocument(t);return Cf(e).ee({index:bn,range:IDBKeyRange.only(Nf(t))},(e,r)=>{n=this.$s(t,r)}
2).next(()=>n)}Ks(e,t){let n={size:0,document:Pi.newInvalidDocument(t)};return Cf(e).ee({index:bn,range:IDBKeyRange.only(Nf(t))},(e,r)=>{n={document:this.$s(t,r),size:nf(r)}}).next(()=>n)}getEntries(e,t){let n=pa();return this.Ws(e,t,(e,t)=>{const r=this.$s(e,t);n=n.insert(e,r)}).next(()=>n)}getAllEntries(e){let t=pa();return Cf(e).ee((e,n)=>{const r=this.$s(ot.fromSegments(n.prefixPath.concat(n.collectionGroup,n.documentId)),n);t=t.insert(r.key,r)}).next(()=>t)}Qs(e,t){let n=pa(),r=new yr(ot.comparator);return this.Ws(e,t,(e,t)=>{const s=this.$s(e,t);n=n.insert(e,s),r=r.insert(e,nf(t))}).next(()=>({documents:n,Gs:r}))}Ws(e,t,n){if(t.isEmpty())return Vt.resolve();let r=new vr(Df);t.forEach(e=>r=r.add(e));const s=IDBKeyRange.bound(Nf(r.first()),Nf(r.last())),i=r.getIterator();let a=i.getNext();return Cf(e).ee({index:bn,range:s},(e,t,r)=>{const s=ot.fromSegments([...t.prefixPath,t.collectionGroup,t.documentId]);for(;a&&Df(a,s)<0;)n(a,null),a=i.getNext();a&&a.isEqual(s)&&(n(a,t),a=i.hasNext()?i.getNext():null),a?r.j(Nf(a)):r.done()}).next(()=>{for(;a;)n(a,null),a=i.hasNext()?i.getNext():null})}getDocumentsMatchingQuery(e,t,n,r,s){const i=Hh(t)?st.fromString(Xu(t)):t.path,a=[i.popLast().toArray(),i.lastSegment(),sd(n.readTime),n.documentKey.path.isEmpty()?"":n.documentKey.path.lastSegment()],o=[i.popLast().toArray(),i.lastSegment(),[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],""];return Cf(e).H(IDBKeyRange.bound(a,o,!0)).next(e=>{s?.incrementDocumentReadCount(e.length);let n=pa();for(const s of e){const e=this.$s(ot.fromSegments(s.prefixPath.concat(s.collectionGroup,s.documentId)),s);e.isFoundDocument()&&(wf(t,e)||r.has(e.key))&&(n=n.insert(e.key,e))}return n})}getAllFromCollectionGroup(e,t,n,r){let s=pa();const i=Of(t,n),a=Of(t,kt.max());return Cf(e).ee({index:An,range:IDBKeyRange.bound(i,a,!0)},(e,t,n)=>{const i=this.$s(ot.fromSegments(t.prefixPath.concat(t.collectionGroup,t.documentId)),t);s=s.insert(i.key,i),s.size===r&&n.done()}).next(()=>s)}
2newChangeBuffer(e){return new Sf(this,!!e&&e.trackRemovals)}getSize(e){return this.getMetadata(e).next(e=>e.byteSize)}getMetadata(e){return Af(e).get(On).next(e=>(Pe(!!e,20021),e))}qs(e,t){return Af(e).put(On,t)}$s(e,t){if(t){const e=function(e,t){let n;if(t.document)n=uo(e.zr,t.document,!!t.hasCommittedMutations);else if(t.noDocument){const e=ot.fromSegments(t.noDocument.path),r=ad(t.noDocument.readTime);n=Pi.newNoDocument(e,r),t.hasCommittedMutations&&n.setHasCommittedMutations()}else{if(!t.unknownDocument)return ke(56709);{const e=ot.fromSegments(t.unknownDocument.path),r=ad(t.unknownDocument.version);n=Pi.newUnknownDocument(e,r)}}return t.readTime&&n.setReadTime(function(e){const t=new vt(e[0],e[1]);return Et.fromTimestamp(t)}(t.readTime)),n}(this.serializer,t);if(!e.isNoDocument()||!e.version.isEqual(Et.min()))return e}return Pi.newInvalidDocument(e)}}function bf(e){return new Tf(e)}class Sf extends If{constructor(e,t){super(),this.zs=e,this.trackRemovals=t,this.js=new da(e=>e.toString(),(e,t)=>e.isEqual(t))}applyChanges(e){const t=[];let n=0,r=new vr((e,t)=>Je(e.canonicalString(),t.canonicalString()));
2return this.changes.forEach((s,i)=>{const a=this.js.get(s);if(t.push(this.zs.removeEntry(e,s,a.readTime)),i.isValidDocument()){const o=rd(this.zs.serializer,i);r=r.add(s.path.popLast());const c=nf(o);n+=c-a.size,t.push(this.zs.addEntry(e,s,o))}else if(n-=a.size,this.trackRemovals){const n=rd(this.zs.serializer,i.convertToNoDocument(Et.min()));t.push(this.zs.addEntry(e,s,n))}}),r.forEach(n=>{t.push(this.zs.indexManager.addToCollectionParentIndex(e,n))}),t.push(this.zs.updateMetadata(e,n)),Vt.waitFor(t)}getFromCache(e,t){return this.zs.Ks(e,t).next(e=>(this.js.set(t,{size:e.size,readTime:e.document.readTime}),e.document))}getAllFromCache(e,t){return this.zs.Qs(e,t).next(({documents:e,Gs:t})=>(t.forEach((t,n)=>{this.js.set(t,{size:n,readTime:e.get(t).readTime})}),e))}}function Af(e){return gr(e,Nn)}function Cf(e){return gr(e,In)}function Nf(e){const t=e.path.toArray();return[t.slice(0,t.length-2),t[t.length-2],t[t.length-1]]}function Of(e,t){const n=t.documentKey.path.toArray();return[e,sd(t.readTime),n.slice(0,n.length-2),n.length>0?n[n.length-1]:""]}function Df(e,t){const n=e.path.toArray(),r=t.path.toArray();let s=0;for(let e=0;e<n.length-2&&e<r.length-2;++e)if(s=Je(n[e],r[e]),s)return s;return s=Je(n.length,r.length),s||(s=Je(n[n.length-2],r[r.length-2]),s||Je(n[n.length-1],r[r.length-1]))}class Rf{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class kf{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(r=>(n=r,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&Zs(n.mutation,e,Tr.empty(),vt.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,Ta()).next(()=>t))}getLocalViewOfDocuments(e,t,n=Ta()){const r=wa();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,n).next(e=>{let t=ga();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){const n=wa();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,Ta()))}populateOverlays(e,t,n){const r=[];return n.forEach(e=>{t.has(e)||r.push(e)}),this.documentOverlayCache.getOverlays(e,r).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,r){let s=pa();const i=va(),a=va();return t.forEach((e,t)=>{const a=n.get(t.key);r.has(t.key)&&(void 0===a||a.mutation instanceof ri)?s=s.insert(t.key,t):void 0!==a?(i.set(t.key,a.mutation.getFieldMask()),Zs(a.mutation,t,a.mutation.getFieldMask(),vt.now())):i.set(t.key,Tr.empty())}),this.recalculateAndSaveOverlays(e,s).next(e=>(e.forEach((e,t)=>i.set(e,t)),t.forEach((e,t)=>a.set(e,new Rf(t,i.get(e)??null))),a))}recalculateAndSaveOverlays(e,t){const n=va();let r=new yr((e,t)=>e-t),s=Ta();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(const s of e)s.keys().forEach(e=>{const i=t.get(e);if(null===i)return;let a=n.get(e)||Tr.empty();a=s.applyToLocalView(i,a),n.set(e,a);const o=(r.get(s.batchId)||Ta()).add(e);r=r.insert(s.batchId,o)})}).next(()=>{const i=[],a=r.getReverseIterator();for(;a.hasNext();){const r=a.getNext(),o=r.key,c=r.value,u=_a();c.forEach(e=>{if(!s.has(e)){const r=Js(t.get(e),n.get(e));null!==r&&u.set(e,r),s=s.add(e)}}),i.push(this.documentOverlayCache.saveOverlays(e,o,u))}return Vt.waitFor(i)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,r){return Hh(t)?this.getDocumentsMatchingPipeline(e,t,n,r):Wi(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Yi(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next(s=>{const i=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-s.size):Vt.resolve(wa());let a=It,o=s;return i.next(t=>Vt.forEach(t,(t,n)=>(a<n.largestBatchId&&(a=n.largestBatchId),s.get(t)?Vt.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{o=o.insert(t,e)}))).next(()=>this.populateOverlays(e,t,s)).next(()=>this.computeViews(e,o,t,Ta())).next(e=>({batchId:a,changes:ya(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new ot(t)).next(e=>{let t=ga();
2return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){const s=t.collectionGroup;let i=ga();return this.indexManager.getCollectionParents(e,s).next(a=>Vt.forEach(a,a=>{const o=function(e,t){return new Gi(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,a.child(s));return this.getDocumentsMatchingCollectionQuery(e,o,n,r).next(e=>{e.forEach((e,t)=>{i=i.insert(e,t)})})}).next(()=>i))}getDocumentsMatchingCollectionQuery(e,t,n,r){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(i=>(s=i,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s,r))).next(e=>this.retrieveMatchingLocalDocuments(s,e,e=>sa(t,e)))}getDocumentsMatchingPipeline(e,t,n,r){if("collection_group"===Ju(t)){const s=Zu(t);let i=ga();return this.indexManager.getCollectionParents(e,s).next(a=>Vt.forEach(a,a=>{const o=function(e,t){const n=e.stages.map(e=>e instanceof Bu?new Fu(t.canonicalString(),{}):e);return new Qu(e.serializer,n)}(t,a.child(s));return this.getDocumentsMatchingPipeline(e,o,n,r).next(e=>{e.forEach((e,t)=>{i=i.insert(e,t)})})}).next(()=>i))}{let s;return this.getOverlaysForPipeline(e,t,n.largestBatchId).next(i=>{switch(s=i,Ju(t)){case"collection":return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s,r);case"documents":let i=Ta();for(const e of tl(t))i=i.add(ot.fromPath(e));return this.remoteDocumentCache.getEntries(e,i);case"database":return this.remoteDocumentCache.getAllEntries(e);default:throw new Ue("invalid-argument",`Invalid pipeline source to execute offline: ${Gh(t)}`)}}).next(e=>this.retrieveMatchingLocalDocuments(s,e,e=>yf(t,e)))}}retrieveMatchingLocalDocuments(e,t,n){e.forEach((e,n)=>{const r=n.getKey();null===t.get(r)&&(t=t.insert(r,Pi.newInvalidDocument(r)))});let r=ga();return t.forEach((t,s)=>{const i=e.get(t);void 0!==i&&Zs(i.mutation,s,Tr.empty(),vt.now()),n(s)&&(r=r.insert(t,s))}),r}getOverlaysForPipeline(e,t,n){switch(Ju(t)){case"collection":return this.documentOverlayCache.getOverlaysForCollection(e,st.fromString(Xu(t)),n);case"collection_group":throw new Ue("invalid-argument",`Unexpected collection group pipeline: ${Gh(t)}`);case"documents":return this.documentOverlayCache.getOverlays(e,tl(t).map(e=>ot.fromPath(e)));case"database":return this.documentOverlayCache.getAllOverlays(e,n);default:throw new Ue("invalid-argument",`Failed to get overlays for pipeline: ${Gh(t)}`)}}}class xf{constructor(e){this.serializer=e,this.Hs=new Map,this.Js=new Map}getBundleMetadata(e,t){return Vt.resolve(this.Hs.get(t))}saveBundleMetadata(e,t){return this.Hs.set(t.id,function(e){return{id:e.id,version:e.version,createTime:Xa(e.createTime)}}(t)),Vt.resolve()}getNamedQuery(e,t){return Vt.resolve(this.Js.get(t))}saveNamedQuery(e,t){return this.Js.set(t.name,function(e){return{name:e.name,query:ld(e.bundledQuery),readTime:Xa(e.readTime)}}(t)),Vt.resolve()}}class Pf{constructor(){this.overlays=new yr(ot.comparator),this.Ys=new Map}getOverlay(e,t){return Vt.resolve(this.overlays.get(t))}getOverlays(e,t){const n=wa();return Vt.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&n.set(t,e)})).next(()=>n)}getAllOverlays(e,t){const n=wa();return this.overlays.forEach((e,r)=>{r.largestBatchId>t&&n.set(e,r)}),Vt.resolve(n)}saveOverlays(e,t,n){return n.forEach((n,r)=>{this.Hr(e,t,r)}),Vt.resolve()}removeOverlaysForBatchId(e,t,n){const r=this.Ys.get(n);return void 0!==r&&(r.forEach(e=>this.overlays=this.overlays.remove(e)),this.Ys.delete(n)),Vt.resolve()}getOverlaysForCollection(e,t,n){const r=wa(),s=t.length+1,i=new ot(t.child("")),a=this.overlays.getIteratorFrom(i);for(;a.hasNext();){const e=a.getNext().value,i=e.getKey();if(!t.isPrefixOf(i.path))break;i.path.length===s&&e.largestBatchId>n&&r.set(e.getKey(),e)}return Vt.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let s=new yr((e,t)=>e-t);const i=this.overlays.getIterator();for(;i.hasNext();){const e=i.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=s.get(e.largestBatchId);null===t&&(t=wa(),s=s.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const a=wa(),o=s.getIterator();for(;o.hasNext()&&(o.getNext().value.forEach((e,t)=>a.set(e,t)),!(a.size()>=r)););return Vt.resolve(a)}Hr(e,t,n){const r=this.overlays.get(n.key);if(null!==r){const e=this.Ys.get(r.largestBatchId).delete(n.key);this.Ys.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new ed(t,n));let s=this.Ys.get(t);void 0===s&&(s=Ta(),this.Ys.set(t,s)),this.Ys.set(t,s.add(n.key))}}class Lf{constructor(){this.sessionToken=Dr.EMPTY_BYTE_STRING}getSessionToken(e){return Vt.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,Vt.resolve()}}class Mf{constructor(){this.Zs=new vr(Vf.Xs),this.e_=new vr(Vf.t_)}isEmpty(){return this.Zs.isEmpty()}addReference(e,t){const n=new Vf(e,t);this.Zs=this.Zs.add(n),this.e_=this.e_.add(n)}
2n_(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.r_(new Vf(e,t))}i_(e,t){e.forEach(e=>this.removeReference(e,t))}s_(e){const t=new ot(new st([])),n=new Vf(t,e),r=new Vf(t,e+1),s=[];return this.e_.forEachInRange([n,r],e=>{this.r_(e),s.push(e.key)}),s}__(){this.Zs.forEach(e=>this.r_(e))}r_(e){this.Zs=this.Zs.delete(e),this.e_=this.e_.delete(e)}o_(e){const t=new ot(new st([])),n=new Vf(t,e),r=new Vf(t,e+1);let s=Ta();return this.e_.forEachInRange([n,r],e=>{s=s.add(e.key)}),s}containsKey(e){const t=new Vf(e,0),n=this.Zs.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class Vf{constructor(e,t){this.key=e,this.a_=t}static Xs(e,t){return ot.comparator(e.key,t.key)||Je(e.a_,t.a_)}static t_(e,t){return Je(e.a_,t.a_)||ot.comparator(e.key,t.key)}}class Uf{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.gs=1,this.u_=new vr(Vf.Xs)}checkEmpty(e){return Vt.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,r){const s=this.gs;this.gs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new Xh(s,t,n,r);this.mutationQueue.push(i);for(const t of r)this.u_=this.u_.add(new Vf(t.key,s)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return Vt.resolve(i)}lookupMutationBatch(e,t){return Vt.resolve(this.c_(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,r=this.l_(n),s=r<0?0:r;return Vt.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return Vt.resolve(0===this.mutationQueue.length?Zt:this.gs-1)}getAllMutationBatches(e){return Vt.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new Vf(t,0),r=new Vf(t,Number.POSITIVE_INFINITY),s=[];return this.u_.forEachInRange([n,r],e=>{const t=this.c_(e.a_);s.push(t)}),Vt.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new vr(Je);return t.forEach(e=>{const t=new Vf(e,0),r=new Vf(e,Number.POSITIVE_INFINITY);this.u_.forEachInRange([t,r],e=>{n=n.add(e.a_)})}),Vt.resolve(this.E_(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,r=n.length+1;let s=n;ot.isDocumentKey(s)||(s=s.child(""));const i=new Vf(new ot(s),0);let a=new vr(Je);return this.u_.forEachWhile(e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(a=a.add(e.a_)),!0)},i),Vt.resolve(this.E_(a))}E_(e){const t=[];return e.forEach(e=>{const n=this.c_(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){Pe(0===this.h_(t.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.u_;return Vt.forEach(t.mutations,r=>{const s=new Vf(r.key,t.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)}).next(()=>{this.u_=n})}bs(e){}containsKey(e,t){const n=new Vf(t,0),r=this.u_.firstAfterOrEqual(n);return Vt.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,Vt.resolve()}h_(e,t){return this.l_(e)}l_(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}c_(e){const t=this.l_(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class Ff{constructor(e){this.T_=e,this.docs=new yr(ot.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,r=this.docs.get(n),s=r?r.size:0,i=this.T_(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:i}),this.size+=i-s,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return Vt.resolve(n?n.document.mutableCopy():Pi.newInvalidDocument(t))}getEntries(e,t){let n=pa();return t.forEach(e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():Pi.newInvalidDocument(e))}),Vt.resolve(n)}getAllEntries(e){let t=pa();return this.docs.forEach((e,n)=>{t=t.insert(e,n.document)}),Vt.resolve(t)}getDocumentsMatchingQuery(e,t,n,r){let s,i;Hh(t)?(s=st.fromString(Xu(t)),i=e=>yf(t,e)):(s=t.path,i=e=>sa(t,e));let a=pa();const o=new ot(s.child("__id-9223372036854775808__")),c=this.docs.getIteratorFrom(o);for(;c.hasNext();){const{key:e,value:{document:t}}=c.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||xt(Rt(t),n)<=0||(r.has(t.key)||i(t))&&(a=a.insert(t.key,t.mutableCopy()))}return Vt.resolve(a)}getAllFromCollectionGroup(e,t,n,r){ke(9500)}P_(e,t){return Vt.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new Bf(this)}getSize(e){return Vt.resolve(this.size)}}class Bf extends If{constructor(e){super(),this.zs=e}applyChanges(e){const t=[];
vendor: 4,778 bytes, line 2
2return this.changes.forEach((n,r)=>{r.isValidDocument()?t.push(this.zs.addEntry(e,r)):this.zs.removeEntry(n)}),Vt.waitFor(t)}getFromCache(e,t){return this.zs.getEntry(e,t)}getAllFromCache(e,t){return this.zs.getEntries(e,t)}}class qf{constructor(e){this.persistence=e,this.R_=new da(e=>Qh(e),Jh),this.lastRemoteSnapshotVersion=Et.min(),this.highestTargetId=0,this.I_=0,this.A_=new Mf,this.targetCount=0,this.V_=uf.xs()}forEachTarget(e,t){return this.R_.forEach((e,n)=>t(n)),Vt.resolve()}getLastRemoteSnapshotVersion(e){return Vt.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return Vt.resolve(this.I_)}allocateTargetId(e){return this.highestTargetId=this.V_.next(),Vt.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.I_&&(this.I_=t),Vt.resolve()}Ms(e){this.R_.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.V_=new uf(t),this.highestTargetId=t),e.sequenceNumber>this.I_&&(this.I_=e.sequenceNumber)}addTargetData(e,t){return this.Ms(t),this.targetCount+=1,Vt.resolve()}updateTargetData(e,t){return this.Ms(t),Vt.resolve()}removeTargetData(e,t){return this.R_.delete(t.target),this.A_.s_(t.targetId),this.targetCount-=1,Vt.resolve()}removeTargets(e,t,n){let r=0;const s=[];return this.R_.forEach((i,a)=>{a.sequenceNumber<=t&&null===n.get(a.targetId)&&(this.R_.delete(i),s.push(this.removeMatchingKeysForTargetId(e,a.targetId)),r++)}),Vt.waitFor(s).next(()=>r)}getTargetCount(e){return Vt.resolve(this.targetCount)}getTargetData(e,t){const n=this.R_.get(t)||null;return Vt.resolve(n)}addMatchingKeys(e,t,n){return this.A_.n_(t,n),Vt.resolve()}removeMatchingKeys(e,t,n){this.A_.i_(t,n);const r=this.persistence.referenceDelegate,s=[];return r&&t.forEach(t=>{s.push(r.markPotentiallyOrphaned(e,t))}),Vt.waitFor(s)}removeMatchingKeysForTargetId(e,t){return this.A_.s_(t),Vt.resolve()}getMatchingKeysForTargetId(e,t){const n=this.A_.o_(t);return Vt.resolve(n)}containsKey(e,t){return Vt.resolve(this.A_.containsKey(t))}}class zf{constructor(e,t){this.d_={},this.overlays={},this.f_=new Xt(0),this.m_=!1,this.m_=!0,this.p_=new Lf,this.referenceDelegate=e(this),this.g_=new qf(this),this.indexManager=new $d,this.remoteDocumentCache=function(e){return new Ff(e)}(e=>this.referenceDelegate.y_(e)),this.serializer=new nd(t),this.w_=new xf(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.m_=!1,Promise.resolve()}get started(){return this.m_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Pf,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.d_[e.toKey()];return n||(n=new Uf(t,this.referenceDelegate),this.d_[e.toKey()]=n),n}getGlobalsCache(){return this.p_}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.w_}runTransaction(e,t,n){Ne("MemoryPersistence","Starting transaction:",e);const r=new jf(this.f_.next());return this.referenceDelegate.b_(),n(r).next(e=>this.referenceDelegate.v_(r).next(()=>e)).toPromise().then(e=>(r.raiseOnCommittedEvent(),e))}S_(e,t){return Vt.or(Object.values(this.d_).map(n=>()=>n.containsKey(e,t)))}}class jf extends Lt{constructor(e){super(),this.currentSequenceNumber=e}}class Gf{constructor(e){this.persistence=e,this.D_=new Mf,this.x_=null}static C_(e){return new Gf(e)}get F_(){if(this.x_)return this.x_;throw ke(60996)}addReference(e,t,n){return this.D_.addReference(n,t),this.F_.delete(n.toString()),Vt.resolve()}removeReference(e,t,n){return this.D_.removeReference(n,t),this.F_.add(n.toString()),Vt.resolve()}markPotentiallyOrphaned(e,t){return this.F_.add(t.toString()),Vt.resolve()}removeTarget(e,t){this.D_.s_(t.targetId).forEach(e=>this.F_.add(e.toString()));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.F_.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}b_(){this.x_=new Set}v_(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Vt.forEach(this.F_,n=>{const r=ot.fromPath(n);return this.O_(e,r).next(e=>{e||t.removeEntry(r,Et.min())})}).next(()=>(this.x_=null,t.apply(e)))}updateLimboDocument(e,t){return this.O_(e,t).next(e=>{e?this.F_.delete(t.toString()):this.F_.add(t.toString())})}y_(e){return 0}O_(e,t){return Vt.or([()=>Vt.resolve(this.D_.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.S_(e,t)])}}class $f{constructor(e,t){this.persistence=e,this.M_=new da(e=>an(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=gc(this,t)}static C_(e,t){return new $f(e,t)}b_(){}v_(e){return Vt.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEac
2hTarget(e,t)}lr(e){const t=this.Ls(e);return this.persistence.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}Ls(e){let t=0;return this.Er(e,e=>{t++}).next(()=>t)}Er(e,t){return Vt.forEach(this.M_,(n,r)=>this.Us(e,n,r).next(e=>e?Vt.resolve():t(r)))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0;const r=this.persistence.getRemoteDocumentCache(),s=r.newChangeBuffer();return r.P_(e,r=>this.Us(e,r,t).next(e=>{e||(n++,s.removeEntry(r,Et.min()))})).next(()=>s.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.M_.set(t,e.currentSequenceNumber),Vt.resolve()}removeTarget(e,t){const n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),Vt.resolve()}removeReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),Vt.resolve()}updateLimboDocument(e,t){return this.M_.set(t,e.currentSequenceNumber),Vt.resolve()}y_(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=os(e.data.value)),t}Us(e,t,n){return Vt.or([()=>this.persistence.S_(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const e=this.M_.get(t);return Vt.resolve(void 0!==e&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}class Hf{constructor(e){this.serializer=e}U(e,t,n,r){const s=new Ft("createOrUpgrade",t);n<1&&r>=1&&(function(e){e.createObjectStore(hn)}(e),function(e){e.createObjectStore(fn,{keyPath:"userId"});e.createObjectStore(pn,{keyPath:mn,autoIncrement:!0}).createIndex(gn,yn,{unique:!0}),e.createObjectStore(En)}(e),Kf(e),function(e){e.createObjectStore(ln)}(e));let i=Vt.resolve();return n<3&&r>=3&&(0!==n&&(function(e){e.deleteObjectStore(xn),e.deleteObjectStore(Dn),e.deleteObjectStore(Un)}(e),Kf(e)),i=i.next(()=>function(e){const t=e.store(Un),n={highestTargetId:0,highestListenSequenceNumber:0,lastRemoteSnapshotVersion:Et.min().toTimestamp(),targetCount:0};return t.put(Vn,n)}(s))),n<4&&r>=4&&(0!==n&&(i=i.next(()=>function(e,t){return t.store(pn).H().next(n=>{e.deleteObjectStore(pn),e.createObjectStore(pn,{keyPath:mn,autoIncrement:!0}).createIndex(gn,yn,{unique:!0});const r=t.store(pn),s=n.map(e=>r.put(e));return Vt.waitFor(s)})}(e,s))),i=i.next(()=>{!function(e){e.createObjectStore(qn,{keyPath:"clientId"})}(e)})),n<5&&r>=5&&(i=i.next(()=>this.N_(s))),n<6&&r>=6&&(i=i.next(()=>(function(e){e.createObjectStore(Nn)}(e),this.L_(s)))),n<7&&r>=7&&(i=i.next(()=>this.B_(s))),n<8&&r>=8&&(i=i.next(()=>this.U_(e,s))),n<9&&r>=9&&(i=i.next(()=>{!function(e){e.objectStoreNames.contains("remoteDocumentChanges")&&e.deleteObjectStore("remoteDocumentChanges")}(e)})),n<10&&r>=10&&(i=i.next(()=>this.k_(s))),n<11&&r>=11&&(i=i.next(()=>{!function(e){e.createObjectStore(zn,{keyPath:"bundleId"})}(e),function(e){e.createObjectStore(jn,{keyPath:"name"})}(e)})),n<12&&r>=12&&(i=i.next(()=>{!function(e){const t=e.createObjectStore(er,{keyPath:tr});t.createIndex(nr,rr,{unique:!1}),t.createIndex(sr,ir,{unique:!1})}(e)})),n<13&&r>=13&&(i=i.next(()=>function(e){const t=e.createObjectStore(In,{keyPath:Tn});t.createIndex(bn,Sn),t.createIndex(An,Cn)}(e)).next(()=>this.q_(e,s)).next(()=>e.deleteObjectStore(ln))),n<14&&r>=14&&(i=i.next(()=>this.K_(e,s))),n<15&&r>=15&&(i=i.next(()=>function(e){e.createObjectStore(Gn,{keyPath:"indexId",autoIncrement:!0}).createIndex($n,"collectionGroup",{unique:!1});e.createObjectStore(Hn,{keyPath:Kn}).createIndex(Wn,Yn,{unique:!1});e.createObjectStore(Qn,{keyPath:Jn}).createIndex(Xn,Zn,{unique:!1})}(e))),n<16&&r>=16&&(i=i.next(()=>{t.objectStore(Hn).clear()}).next(()=>{t.objectStore(Qn).clear()})),n<17&&r>=17&&(i=i.next(()=>{!function(e){e.createObjectStore(ar,{keyPath:"name"})}(e)})),n<18&&r>=18&&(0,o.Ov)()&&(i=i.next(()=>{t.objectStore(Hn).clear()}).next(()=>{t.objectStore(Qn).clear()})),i}L_(e){let t=0;return e.store(ln).ee((e,n)=>{t+=nf(n)}).next(()=>{const n={byteSize:t};return e.store(Nn).put(On,n)})}N_(e){const t=e.store(fn),n=e.store(pn);return t.H().next(t=>Vt.forEach(t,t=>{const r=IDBKeyRange.bound([t.userId,Zt],[t.userId,t.lastAcknowledgedBatchId]);return n.H(gn,r).next(n=>Vt.forEach(n,n=>{Pe(n.userId===t.userId,18650,"Cannot process batch from unexpected user",{batchId:n.batchId});
2const r=od(this.serializer,n);return tf(e,t.userId,r).next(()=>{})}))}))}B_(e){const t=e.store(xn),n=e.store(ln);return e.store(Un).get(Vn).next(e=>{const r=[];return n.ee((n,s)=>{const i=new st(n),a=function(e){return[0,an(e)]}(i);r.push(t.get(a).next(n=>n?Vt.resolve():(n=>t.put({targetId:0,path:an(n),sequenceNumber:e.highestListenSequenceNumber}))(i)))}).next(()=>Vt.waitFor(r))})}U_(e,t){e.createObjectStore(Fn,{keyPath:Bn});const n=t.store(Fn),r=new Hd,s=e=>{if(r.add(e)){const t=e.lastSegment(),r=e.popLast();return n.put({collectionId:t,parent:an(r)})}};return t.store(ln).ee({X:!0},(e,t)=>{const n=new st(e);return s(n.popLast())}).next(()=>t.store(En).ee({X:!0},([e,t,n],r)=>{const i=un(t);return s(i.popLast())}))}k_(e){const t=e.store(Dn);return t.ee((e,n)=>{const r=cd(this.serializer,n),s=ud(this.serializer,r);return t.put(s)})}q_(e,t){const n=t.store(ln),r=[];return n.ee((e,n)=>{const s=t.store(In),i=function(e){return e.document?new ot(st.fromString(e.document.name).popFirst(5)):e.noDocument?ot.fromSegments(e.n
2oDocument.path):e.unknownDocument?ot.fromSegments(e.unknownDocument.path):ke(36783)}(n).path.toArray(),a={prefixPath:i.slice(0,i.length-2),collectionGroup:i[i.length-2],documentId:i[i.length-1],readTime:n.readTime||[0,0],unknownDocument:n.unknownDocument,noDocument:n.noDocument,document:n.document,hasCommittedMutations:!!n.hasCommittedMutations};r.push(s.put(a))}).next(()=>Vt.waitFor(r))}K_(e,t){const n=t.store(pn),r=bf(this.serializer),s=new zf(Gf.C_,this.serializer.zr);return n.H().next(e=>{const n=new Map;return e.forEach(e=>{let t=n.get(e.userId)??Ta();od(this.serializer,e).keys().forEach(e=>t=t.add(e)),n.set(e.userId,t)}),Vt.forEach(n,(e,n)=>{const i=new Te(n),a=_d.jr(this.serializer,i),o=s.getIndexManager(i),c=rf.jr(i,this.serializer,o,s.referenceDelegate);return new kf(r,c,a,o).recalculateAndSaveOverlaysForDocumentKeys(new mr(t,Xt.ce),e).next()})})}}function Kf(e){e.createObjectStore(xn,{keyPath:Pn}).createIndex(Ln,Mn,{unique:!0}),e.createObjectStore(Dn,{keyPath:"targetId"}).createIndex(Rn,kn,{unique:!0}),e.createObjectStore(Un)}const Wf="IndexedDbPersistence",Yf=18e5,Qf=5e3,Jf="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",Xf="main";class Zf{constructor(e,t,n,r,s,i,a,o,c,u,l=18){if(this.allowTabSynchronization=e,this.persistenceKey=t,this.clientId=n,this.Tn=s,this.window=i,this.document=a,this.W_=c,this.Q_=u,this.G_=l,this.f_=null,this.m_=!1,this.isPrimary=!1,this.networkEnabled=!0,this.z_=null,this.inForeground=!1,this.j_=null,this.H_=null,this.J_=Number.NEGATIVE_INFINITY,this.Y_=e=>Promise.resolve(),!Zf.C())throw new Ue(Ve.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new pf(this,r),this.Z_=t+Xf,this.serializer=new nd(o),this.X_=new Bt(this.Z_,this.G_,new Hf(this.serializer)),this.p_=new Ed,this.g_=new lf(this.referenceDelegate,this.serializer),this.remoteDocumentCache=bf(this.serializer),this.w_=new gd,this.window&&this.window.localStorage?this.eo=this.window.localStorage:(this.eo=null,!1===u&&Oe(Wf,"LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}start(){return this.no().then(()=>{if(!this.isPrimary&&!this.allowTabSynchronization)throw new Ue(Ve.FAILED_PRECONDITION,Jf);return this.ro(),this.io(),this.so(),this.runTransaction("getHighestListenSequenceNumber","readonly",e=>this.g_.getHighestSequenceNumber(e))}).then(e=>{this.f_=new Xt(e,this.W_)}).then(()=>{this.m_=!0}).catch(e=>(this.X_&&this.X_.close(),Promise.reject(e)))}_o(e){return this.Y_=async t=>{if(this.started)return e(t)},e(this.isPrimary)}setDatabaseDeletedListener(e){this.X_.q(async t=>{null===t.newVersion&&await e()})}setNetworkEnabled(e){this.networkEnabled!==e&&(this.networkEnabled=e,this.Tn.enqueueAndForget(async()=>{this.started&&await this.no()}))}no(){return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",e=>tp(e).put({clientId:this.clientId,updateTimeMs:Date.now(),networkEnabled:this.networkEnabled,inForeground:this.inForeground}).next(()=>{if(this.isPrimary)return this.oo(e).next(e=>{e||(this.isPrimary=!1,this.Tn.enqueueRetryable(()=>this.Y_(!1)))})}).next(()=>this.ao(e)).next(t=>this.isPrimary&&!t?this.uo(e).next(()=>!1):!!t&&this.co(e).next(()=>!0))).catch(e=>{if(Gt(e))return Ne(Wf,"Failed to extend owner lease: ",e),this.isPrimary;if(!this.allowTabSynchronization)throw e;return Ne(Wf,"Releasing owner lease after error during lease refresh",e),!1}).then(e=>{this.isPrimary!==e&&this.Tn.enqueueRetryable(()=>this.Y_(e)),this.isPrimary=e})}oo(e){return ep(e).get(dn).next(e=>Vt.resolve(this.lo(e)))}Eo(e){return tp(e).delete(this.clientId)}async ho(){if(this.isPrimary&&!this.To(this.J_,Yf)){this.J_=Date.now();const e=await this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",e=>{const t=gr(e,qn);return t.H().next(e=>{const n=this.Po(e,Yf),r=e.filter(e=>-1===n.indexOf(e));return Vt.forEach(r,e=>t.delete(e.clientId)).next(()=>r)})}).catch(()=>[]);if(this.eo)for(const t of e)this.eo.removeItem(this.Ro(t.clientId))}}so(){this.H_=this.Tn.enqueueAfterDelay("client_metadata_refresh",4e3,()=>this.no().then(()=>this.ho()).then(()=>this.so()))}lo(e){return!!e&&e.ownerId===this.clientId}ao(e){return this.Q_?Vt.resolve(!0):ep(e).get(dn).next(t=>
2{if(null!==t&&this.To(t.leaseTimestampMs,Qf)&&!this.Io(t.ownerId)){if(this.lo(t)&&this.networkEnabled)return!0;if(!this.lo(t)){if(!t.allowTabSynchronization)throw new Ue(Ve.FAILED_PRECONDITION,Jf);return!1}}return!(!this.networkEnabled||!this.inForeground)||tp(e).H().next(e=>void 0===this.Po(e,Qf).find(e=>{if(this.clientId!==e.clientId){const t=!this.networkEnabled&&e.networkEnabled,n=!this.inForeground&&e.inForeground,r=this.networkEnabled===e.networkEnabled;if(t||n&&r)return!0}return!1}))}).next(e=>(this.isPrimary!==e&&Ne(Wf,`Client ${e?"is":"is not"} eligible for a primary lease.`),e))}async shutdown(){this.m_=!1,this.Ao(),this.H_&&(this.H_.cancel(),this.H_=null),this.Vo(),this.fo(),await this.X_.runTransaction("shutdown","readwrite",[hn,qn],e=>{const t=new mr(e,Xt.ce);return this.uo(t).next(()=>this.Eo(t))}),this.X_.close(),this.mo()}Po(e,t){return e.filter(e=>this.To(e.updateTimeMs,t)&&!this.Io(e.clientId))}po(){return this.runTransaction("getActiveClients","readonly",e=>tp(e).H().next(e=>this.Po(e,Yf).map(e=>e.clientId)))}get started(){return this.m_}getGlobalsCache(){return this.p_}getMutationQueue(e,t){return rf.jr(e,this.serializer,t,this.referenceDelegate)}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getIndexManager(e){return new Yd(e,this.serializer.zr.databaseId)}getDocumentOverlayCache(e){return _d.jr(this.serializer,e)}getBundleCache(){return this.w_}runTransaction(e,t,n){Ne(Wf,"Starting transaction:",e);const r="readonly"===t?"readonly":"readwrite",s=function(e){return 18===e?pr:17===e?fr:16===e?dr:15===e?hr:14===e?lr:13===e?ur:12===e?cr:11===e?or:void ke(60245)}(this.G_);let i;return this.X_.runTransaction(e,r,s,r=>(i=new mr(r,this.f_?this.f_.next():Xt.ce),"readwrite-primary"===t?this.oo(i).next(e=>!!e||this.ao(i)).next(t=>{if(!t)throw Oe(`Failed to obtain primary lease for action '${e}'.`),this.isPrimary=!1,this.Tn.enqueueRetryable(()=>this.Y_(!1)),new Ue(Ve.FAILED_PRECONDITION,Pt);return n(i)}).next(e=>this.co(i).next(()=>e)):this.yo(i).next(()=>n(i)))).then(e=>(i.raiseOnCommittedEvent(),e))}yo(e){return ep(e).get(dn).next(e=>{if(null!==e&&this.To(e.leaseTimestampMs,Qf)&&!this.Io(e.ownerId)&&!this.lo(e)&&!(this.Q_||this.allowTabSynchronization&&e.allowTabSynchronization))throw new Ue(Ve.FAILED_PRECONDITION,Jf)})}co(e){const t={ownerId:this.clientId,allowTabSynchronization:this.allowTabSynchronization,leaseTimestampMs:Date.now()};return ep(e).put(dn,t)}static C(){return Bt.C()}uo(e){const t=ep(e);return t.get(dn).next(e=>this.lo(e)?(Ne(Wf,"Releasing primary lease."),t.delete(dn)):Vt.resolve())}To(e,t){const n=Date.now();return!(e<n-t||e>n&&(Oe(`Detected an update time that is in the future: ${e} > ${n}`),1))}ro(){null!==this.document&&"function"==typeof this.document.addEventListener&&(this.j_=()=>{this.Tn.enqueueAndForget(()=>(this.inForeground="visible"===this.document.visibilityState,this.no()))},this.document.addEventListener("visibilitychange",this.j_),this.inForeground="visible"===this.document.visibilityState)}Vo(){this.j_&&(this.document.removeEventListener("visibilitychange",this.j_),this.j_=null)}io(){"function"==typeof this.window?.addEventListener&&(this.z_=()=>{this.Ao();const e=/(?:Version|Mobile)\/1[456]/;(0,o.nr)()&&(navigator.appVersion.match(e)||navigator.userAgent.match(e))&&this.Tn.enterRestrictedMode(!0),this.Tn.enqueueAndForget(()=>this.shutdown())},this.window.addEventListener("pagehide",this.z_))}fo(){this.z_&&(this.window.removeEventListener("pagehide",this.z_),this.z_=null)}Io(e){try{const t=null!==this.eo?.getItem(this.Ro(e));return Ne(Wf,`Client '${e}' ${t?"is":"is not"} zombied in LocalStorage`),t}catch(e){return Oe(Wf,"Failed to get zombied client id.",e),!1}}Ao(){if(this.eo)try{this.eo.setItem(this.Ro(this.clientId),String(Date.now()))}catch(e){Oe("Failed to set zombie client id.",e)}}mo(){if(this.eo)try{this.eo.removeItem(this.Ro(this.clientId))}catch(e){}}Ro(e){return`firestore_zombie_${this.persistenceKey}_${e}`}}function ep(e){return gr(e,hn)}function tp(e){return gr(e,qn)}function np(e,t){let n=e.projectId;return e.isDefaultDatabase||(n+="."+e.database),"firestore/"+t+"/"+n+"/"}class rp{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.wo=n,this.bo=r}static vo(e,t){let n=Ta(),r=Ta();for(const e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:r=r.add(e.doc.key)}return new rp(e,t.fromCache,n,r)}}function sp(e,t){return ot.comparator(e.key,t.key)}class ip{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class ap{constructor(){this.So=!1,this.Do=!1,this.xo=100,this.Co=(0,o.nr)()?8:qt((0,o.ZQ)())>0?6:4}initialize(e,t){this.Fo=e,this.indexManager=t,this.So=!0}getDocumentsMatchingQuery(e,t,n,r){const s={result:null};return this.Oo(e,t).next(e=>{s.result=e}).next(()=>{if(!s.result)return this.Mo(e,t,r,n).next(e=>{s.result=e})}).next(()=>{if(s.result)return;const n=new ip;return this.No(e,t,n).next(r=>{if(s.result=r,this.Do)return this.Lo(e,t,n,r.size)})}).next(()=>s.result)}Lo(e,t,n,r){return Hh(t)?Vt.resolve():n.documentReadCount<this.xo?(Ae()<=w.$b.DEBUG&&Ne("QueryEngine","SDK will not create cache indexes for query:",ra(t),"since it only creates cache indexes for collection contains","more than or equal to",this.xo,"documents"),Vt.resolve()):(Ae()<=w.$b.DEBUG&&Ne("QueryEngine","Query:",ra(t),"scans",n.documentReadCount,"local documents and returns",r,"documents as results."),n.documentReadCount>this.Co*r?(Ae()<=w.$b.DEBUG&&Ne("QueryEngine","The SDK decides to create cache indexes for query:",ra(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Ji(t))):Vt.resolve())}Oo(e,t){if(Hh(t))return Vt.resolve(null);let n=t;if(Ki(n))return Vt.resolve(null);let r=Ji(n);return this.indexManager.getIndexType(e,r).next(t=>0===t?null:(null!==n.limit&&1===t&&(n=ta(n,null,"F"),r=Ji(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(t=>{const s=Ta(...t);return this.Fo.getDocuments(e,s).next(t=>this.indexManager.getMinOffset(e,r).next(r=>{const i=this.Bo(n,t);return this.Uo(n,i,s,r.readTime)?this.Oo(e,ta(n,null,"F")):this.ko(e,i,n,r)}))})))}Mo(e,t,n,r){return(Hh(t)?function(e){for(const t of e.stages){if(t instanceof Gu||t instanceof $u)return!1;if(t instanceof ju){if(t.condition instanceof Du&&"exists"===t.condition._expr.name&&t.condition._expr.params[0]instanceof Tu&&t.condition._expr.params[0].fieldName===nt)continue;return!1}}return!0}(t):Ki(t))||r.isEqual(Et.min())?Vt.resolve(null):this.Fo.getDocuments(e,n).next(s=>{const i=this.Bo(t,s);return this.Uo(t,i,n,r)?Vt.resolve(null):(Ae()<=w.$b.DEBUG&&Ne("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Kh(t)),this.ko(e,i,t,Dt(r,It)).next(e=>e))})}Bo(e,t){let n,r;return Hh(e)?(n=new vr(sp),r=t=>yf(e,t)):(n=new vr(ia(e)),r=t=>sa(e,t)),t.forEach((e,t)=>{r(t)&&(n=n.add(t))}),n}Uo(e,t,n,r){if(Hh(e))return function(e){return e.stages.some(e=>e instanceof Gu||e instanceof $u)}(e);if(null===e.limit)return!1;if(n.size!==t.size)return!0;const s="F"===e.limitType?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}
2No(e,t,n){return Ae()<=w.$b.DEBUG&&Ne("QueryEngine","Using full collection scan to execute query:",Kh(t)),this.Fo.getDocumentsMatchingQuery(e,t,kt.min(),n)}ko(e,t,n,r){return this.Fo.getDocumentsMatchingQuery(e,n,r).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}const op="LocalStore";class cp{constructor(e,t,n,r){this.persistence=e,this.qo=t,this.serializer=r,this.$o=new yr(Je),this.Ko=new da(e=>Qh(e),Jh),this.Wo=new Map,this.Qo=e.getRemoteDocumentCache(),this.g_=e.getTargetCache(),this.w_=e.getBundleCache(),this.Go(n)}Go(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new kf(this.Qo,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Qo.setIndexManager(this.indexManager),this.qo.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.$o))}}function up(e,t,n,r){return new cp(e,t,n,r)}async function lp(e,t){const n=Me(e);return await n.persistence.runTransaction("Handle user change","readonly",e=>{let r;
2return n.mutationQueue.getAllMutationBatches(e).next(s=>(r=s,n.Go(t),n.mutationQueue.getAllMutationBatches(e))).next(t=>{const s=[],i=[];let a=Ta();for(const e of r){s.push(e.batchId);for(const t of e.mutations)a=a.add(t.key)}for(const e of t){i.push(e.batchId);for(const t of e.mutations)a=a.add(t.key)}return n.localDocuments.getDocuments(e,a).next(e=>({zo:e,removedBatchIds:s,addedBatchIds:i}))})})}function hp(e){const t=Me(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",e=>t.g_.getLastRemoteSnapshotVersion(e))}function dp(e,t,n){let r=Ta(),s=Ta();return n.forEach(e=>r=r.add(e)),t.getEntries(e,r).next(e=>{let r=pa();return n.forEach((n,i)=>{const a=e.get(n);i.isFoundDocument()!==a.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(Et.min())?(t.removeEntry(n,i.readTime),r=r.insert(n,i)):!a.isValidDocument()||i.version.compareTo(a.version)>0||0===i.version.compareTo(a.version)&&a.hasPendingWrites?(t.addEntry(i),r=r.insert(n,i)):Ne(op,"Ignoring outdated watch update for ",n,". Current version:",a.version," Watch version:",i.version)}),{jo:r,Ho:s}})}function fp(e,t){const n=Me(e);return n.persistence.runTransaction("Get next mutation batch","readonly",e=>(void 0===t&&(t=Zt),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)))}function pp(e,t){const n=Me(e);return n.persistence.runTransaction("Allocate target","readwrite",e=>{let r;return n.g_.getTargetData(e,t).next(s=>s?(r=s,Vt.resolve(r)):n.g_.allocateTargetId(e).next(s=>(r=new td(t,s,"TargetPurposeListen",e.currentSequenceNumber),n.g_.addTargetData(e,r).next(()=>r))))}).then(e=>{const r=n.$o.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.$o=n.$o.insert(e.targetId,e),n.Ko.set(t,e.targetId)),e})}async function mp(e,t,n){const r=Me(e),s=r.$o.get(t),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,e=>r.persistence.referenceDelegate.removeTarget(e,s))}catch(e){if(!Gt(e))throw e;Ne(op,`Failed to update sequence numbers for target ${t}: ${e}`)}r.$o=r.$o.remove(t),r.Ko.delete(s.target)}function gp(e,t,n){const r=Me(e);let s=Et.min(),i=Ta();return r.persistence.runTransaction("Execute query","readwrite",e=>function(e,t,n){const r=Me(e),s=r.Ko.get(n);return void 0!==s?Vt.resolve(r.$o.get(s)):r.g_.getTargetData(t,n)}(r,e,Hh(t)?t:Ji(t)).next(t=>{if(t)return s=t.lastLimboFreeSnapshotVersion,r.g_.getMatchingKeysForTargetId(e,t.targetId).next(e=>{i=e})}).next(()=>r.qo.getDocumentsMatchingQuery(e,t,n?s:Et.min(),n?i:Ta())).next(e=>(_p(r,e),{documents:e,Jo:i})))}function yp(e,t){const n=Me(e),r=Me(n.g_),s=n.$o.get(t);return s?Promise.resolve(s.target??null):n.persistence.runTransaction("Get target data","readonly",e=>r.dt(e,t).next(e=>e?.target??null))}function wp(e,t){const n=Me(e),r=n.Wo.get(t)||Et.min();return n.persistence.runTransaction("Get new document changes","readonly",e=>n.Qo.getAllFromCollectionGroup(e,t,Dt(r,It),Number.MAX_SAFE_INTEGER)).then(e=>(_p(n,e),e))}function _p(e,t){t.forEach((t,n)=>{const r=n.key.getCollectionGroup(),s=e.Wo.get(r)||Et.min();n.readTime.compareTo(s)>0&&e.Wo.set(r,n.readTime)})}async function vp(e,t,n=Ta()){const r=await pp(e,Ji(ld(t.bundledQuery))),s=Me(e);return s.persistence.runTransaction("Save named query","readwrite",e=>{const i=Xa(t.readTime);if(r.snapshotVersion.compareTo(i)>=0)return s.w_.saveNamedQuery(e,t);const a=r.withResumeToken(Dr.EMPTY_BYTE_STRING,i);return s.$o=s.$o.insert(a.targetId,a),s.g_.updateTargetData(e,a).next(()=>s.g_.removeMatchingKeysForTargetId(e,r.targetId)).next(()=>s.g_.addMatchingKeys(e,n,r.targetId)).next(()=>s.w_.saveNamedQuery(e,t))})}const Ep="firestore_clients";function Ip(e,t){return`${Ep}_${e}_${t}`}const Tp="firestore_mutations";function bp(e,t,n){let r=`${Tp}_${e}_${n}`;return t.isAuthenticated()&&(r+=`_${t.uid}`),r}const Sp="firestore_targets";function Ap(e,t){return`${Sp}_${e}_${t}`}const Cp="SharedClientState";class Np{constructor(e,t,n,r){this.user=e,this.batchId=t,this.state=n,this.error=r}static ea(e,t,n){const r=JSON.parse(n);let s,i="object"==typeof r&&-1!==["pending","acknowledged","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error);return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code,i&&(s=new Ue(r.error.code,r.error.message))),i?new
vendor: 8,736 bytes, line 2
2Np(e,t,r.state,s):(Oe(Cp,`Failed to parse mutation state for ID '${t}': ${n}`),null)}ta(){const e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}}class Op{constructor(e,t,n){this.targetId=e,this.state=t,this.error=n}static ea(e,t){const n=JSON.parse(t);let r,s="object"==typeof n&&-1!==["not-current","current","rejected"].indexOf(n.state)&&(void 0===n.error||"object"==typeof n.error);return s&&n.error&&(s="string"==typeof n.error.message&&"string"==typeof n.error.code,s&&(r=new Ue(n.error.code,n.error.message))),s?new Op(e,n.state,r):(Oe(Cp,`Failed to parse target state for ID '${e}': ${t}`),null)}ta(){const e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}}class Dp{constructor(e,t){this.clientId=e,this.activeTargetIds=t}static ea(e,t){const n=JSON.parse(t);let r="object"==typeof n&&n.activeTargetIds instanceof Array,s=Sa();for(let e=0;r&&e<n.activeTargetIds.length;++e)r=nn(n.activeTargetIds[e]),s=s.add(n.activeTargetIds[e]);return r?new Dp(e,s):(Oe(Cp,`Failed to parse client data for instance '${e}': ${t}`),null)}}class Rp{constructor(e,t){this.clientId=e,this.onlineState=t}static ea(e){const t=JSON.parse(e);return"object"==typeof t&&-1!==["Unknown","Online","Offline"].indexOf(t.onlineState)&&"string"==typeof t.clientId?new Rp(t.clientId,t.onlineState):(Oe(Cp,`Failed to parse online state: ${e}`),null)}}class kp{constructor(){this.activeTargetIds=Sa()}na(e){this.activeTargetIds=this.activeTargetIds.add(e)}ra(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ta(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class xp{constructor(e,t,n,r,s){this.window=e,this.Tn=t,this.persistenceKey=n,this.ia=r,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.sa=this._a.bind(this),this.oa=new yr(Je),this.started=!1,this.aa=[];const i=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=s,this.ua=Ip(this.persistenceKey,this.ia),this.ca=function(e){return`firestore_sequence_number_${e}`}(this.persistenceKey),this.oa=this.oa.insert(this.ia,new kp),this.la=new RegExp(`^${Ep}_${i}_([^_]*)$`),this.Ea=new RegExp(`^${Tp}_${i}_(\\d+)(?:_(.*))?$`),this.ha=new RegExp(`^${Sp}_${i}_(\\d+)$`),this.Ta=function(e){return`firestore_online_state_${e}`}(this.persistenceKey),this.Pa=function(e){return`firestore_bundle_loaded_v2_${e}`}(this.persistenceKey),this.window.addEventListener("storage",this.sa)}static C(e){return!(!e||!e.localStorage)}async start(){const e=await this.syncEngine.po();for(const t of e){if(t===this.ia)continue;const e=this.getItem(Ip(this.persistenceKey,t));if(e){const n=Dp.ea(t,e);n&&(this.oa=this.oa.insert(n.clientId,n))}}this.Ra();const t=this.storage.getItem(this.Ta);if(t){const e=this.Ia(t);e&&this.Aa(e)}for(const e of this.aa)this._a(e);this.aa=[],this.window.addEventListener("pagehide",()=>this.shutdown()),this.started=!0}writeSequenceNumber(e){this.setItem(this.ca,JSON.stringify(e))}getAllActiveQueryTargets(){return this.Va(this.oa)}isActiveQueryTarget(e){let t=!1;return this.oa.forEach((n,r)=>{r.activeTargetIds.has(e)&&(t=!0)}),t}addPendingMutation(e){this.da(e,"pending")}updateMutationState(e,t,n){this.da(e,t,n),this.fa(e)}addLocalQueryTarget(e,t=!0){let n="not-current";if(this.isActiveQueryTarget(e)){const t=this.storage.getItem(Ap(this.persistenceKey,e));if(t){const r=Op.ea(e,t);r&&(n=r.state)}}return t&&this.ma.na(e),this.Ra(),n}removeLocalQueryTarget(e){this.ma.ra(e),this.Ra()}isLocalQueryTarget(e){return this.ma.activeTargetIds.has(e)}clearQueryState(e){this.removeItem(Ap(this.persistenceKey,e))}updateQueryState(e,t,n){this.pa(e,t,n)}handleUserChange(e,t,n){t.forEach(e=>{this.fa(e)}),this.currentUser=e,n.forEach(e=>{this.addPendingMutation(e)})}setOnlineState(e){this.ga(e)}notifyBundleLoaded(e){this.ya(e)}shutdown(){this.started&&(this.window.removeEventListener("storage",this.sa),this.removeItem(this.ua),this.started=!1)}getItem(e){const t=this.storage.getItem(e);return Ne(Cp,"READ",e,t),t}setItem(e,t){Ne(Cp,"SET",e,t),this.storage.setItem(e,t)}removeItem(e){Ne(Cp,"REMOVE",e),this.storage.removeItem(e)}_a(e){const t=e;if(t.storageArea===this.storage){if(Ne(Cp,"EVENT",t.key,t.newValue),t.key===this.ua)return void Oe("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.Tn.enqueueRetryable(async()=>{if(this.started){if(null!==t.key)if(this.la.test(t.key)){if(null==t.newValue){const e=this.wa(t.key);return this.ba(e,null)}{const e=this.va(t.key,t.newValue);if(e)return this.ba(e.clientId,e)}}else if(this.Ea.test(t.key)){if(null!==t.newValue){const e=this.Sa(t.key,t.newValue);if(e)return this.Da(e)}}else if(this.ha.test(t.key)){if(null!==t.newValue){const e=this.xa(t.key,t.newValue);if(e)return this.Ca(e)}}else if(t.key===this.Ta){if(null!==t.newValue){const e=this.Ia(t.newValue);if(e)return this.Aa(e)}}else if(t.key===this.ca){const e=function(e){let t=Xt.ce;if(null!=e)try{const n=JSON.parse(e);Pe("number"==typeof n,30636,{Fa:e}),t=n}catch(e){Oe(Cp,"Failed to read sequence number from WebStorage",e)}return t}(t.newValue);e!==Xt.ce&&this.sequenceNumberHandler(e)}else if(t.key===this.Pa){const e=this.Oa(t.newValue);await Promise.all(e.map(e=>this.syncEngine.Ma(e)))}}else this.aa.push(t)})}}get ma(){return this.oa.get(this.ia)}Ra(){this.setItem(this.ua,this.ma.ta())}da(e,t,n){const r=new Np(this.currentUser,e,t,n),s=bp(this.persistenceKey,this.currentUser,e);this.setItem(s,r.ta())}fa(e){const t=bp(this.persistenceKey,this.currentUser,e);this.removeItem(t)}ga(e){const t={clientId:this.ia,onlineState:e};this.storage.setItem(this.Ta,JSON.stringify(t))}pa(e,t,n){const r=Ap(this.persistenceKey,e),s=new Op(e,t,n);this.setItem(r,s.ta())}ya(e){const t=JSON.stringify(Array.from(e));this.setItem(this.Pa,t)}wa(e){const t=this.la.exec(e);return t?t[1]:null}va(e,t){const n=this.wa(e);return Dp.ea(n,t)}Sa(e,t){const n=this.Ea.exec(e),r=Number(n[1]),s=void 0!==n[2]?n[2]:null;return Np.ea(new Te(s),r,t)}xa(e,t){const n=this.ha.exec(e),r=Number(n[1]);return Op.ea(r,t)}Ia(e){return Rp.ea(e)}Oa(e){return JSON.parse(e)}async Da(e){if(e.user.uid===this.currentUser.uid)return this.syncEngine.Na(e.batchId,e.state,e.error);Ne(Cp,`Ignoring mutation for non-active user ${e.user.uid}`)}Ca(e){return this.syncEngine.La(e.targetId,e.state,e.error)}ba(e,t){const n=t?this.oa.insert(e,t):this.oa.remove(e),r=this.Va(this.oa),s=this.Va(n),i=[],a=[];return s.forEach(e=>{r.has(e)||i.push(e)}),r.forEach(e=>{s.has(e)||a.push(e)}),this.syncEngine.Ba(i,a).then(()=>{this.oa=n})}Aa(e){this.oa.get(e.clientId)&&this.onlineStateHandler(e.onlineState)}Va(e){let t=Sa();return e.forEach((e,n)=>{t=t.unionWith(n.activeTargetIds)}),t}}class Pp{constructor(){this.Ua=new kp,this.ka={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Ua.na(e),this.ka[e]||"not-current"}updateQueryState(e,t,n){this.ka[e]=t}removeLocalQueryTarget(e){this.Ua.ra(e)}isLocalQueryTarget(e){return this.Ua.activeTargetIds.has(e)}clearQueryState(e){delete this.ka[e]}getAllActiveQueryTargets(){return this.Ua.activeTargetIds}isActiveQueryTarget(e){return this.Ua.activeTargetIds.has(e)}start(){return this.Ua=new kp,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}function Lp(){return"undefined"!=typeof window?window:null}function Mp(){return"undefined"!=typeof document?document:null}class Vp{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.qa=0,this.$a=null,this.Ka=!0}Wa(){0===this.qa&&(this.Qa("Unknown"),this.$a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.$a=null,this.Ga("Backend didn't respond within 10 seconds."),this.Qa("Offline"),Promise.resolve())))}za(e){"Online"===this.state?this.Qa("Unknown"):(this.qa++,this.qa>=1&&(this.ja(),this.Ga(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.Qa("Offline")))}set(e){this.ja(),this.qa=0,"Online"===e&&(this.Ka=!1),this.Qa(e)}Qa(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}Ga(e){const t=`Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Ka?(Oe(t),this.Ka=!1):Ne("OnlineStateTracker",t)}ja(){null!==this.$a&&(this.$a.cancel(),this.$a=null)}}const Up="RemoteStore";
2class Fp{constructor(e,t,n,r,s){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Ha=[],this.Ja=new Map,this.Ya=new Map,this.Za=new Map,this.Xa=new uf(1e3),this.eu=new uf(1001),this.tu=new Set,this.nu=[],this.ru=s,this.ru.bt(e=>{n.enqueueAndForget(async()=>{Yp(this)&&(Ne(Up,"Restarting streams for network reachability change."),await async function(e){const t=Me(e);t.tu.add(4),await qp(t),t.iu.set("Unknown"),t.tu.delete(4),await Bp(t)}(this))})}),this.iu=new Vp(n,r)}}async function Bp(e){if(Yp(e))for(const t of e.nu)await t(!0)}async function qp(e){for(const t of e.nu)await t(!1)}function zp(e,t){return e.Ya.get(t)||void 0}function jp(e,t){const n=Me(e),r=zp(n,t.targetId);if(void 0!==r&&n.Ja.has(r))return;const s=function(e,t){const n=zp(e,t);void 0!==n&&e.Za.delete(n);const r=function(e,t){return t%2!=0?e.eu.next():e.Xa.next()}(e,t);return e.Ya.set(t,r),e.Za.set(r,t),r}(n,t.targetId);Ne(Up,"remoteStoreListen mapping SDK target ID to remote",t.targetId,s);const i=new td(t.target,s,t.purpose,t.sequenceNumber,t.snapshotVersion,t.lastLimboFreeSnapshotVersion,t.resumeToken);n.Ja.set(s,i),Wp(n)?Kp(n):pm(n).Fn()&&$p(n,i)}function Gp(e,t){const n=Me(e),r=pm(n),s=zp(n,t);Ne(Up,"remoteStoreUnlisten removing mapping of SDK target ID to remote",t,s),n.Ja.delete(s),n.Ya.delete(t),n.Za.delete(s),r.Fn()&&Hp(n,s),0===n.Ja.size&&(r.Fn()?r.Nn():Yp(n)&&n.iu.set("Unknown"))}function $p(e,t){if(e.su.We(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(Et.min())>0){const n=e.Za.get(t.targetId);if(void 0===n)return void Ne(Up,"SDK target ID not found for remote ID: "+t.targetId);const r=e.remoteSyncer.getRemoteKeysForTarget(n).size;t=t.withExpectedCount(r)}pm(e).jn(t)}function Hp(e,t){e.su.We(t),pm(e).Hn(t)}function Kp(e){e.su=new Ba({getRemoteKeysForTarget:t=>{const n=e.Za.get(t);return void 0!==n?e.remoteSyncer.getRemoteKeysForTarget(n):Ta()},dt:t=>e.Ja.get(t)||null,Tt:()=>e.datastore.serializer.databaseId}),pm(e).start(),e.iu.Wa()}function Wp(e){return Yp(e)&&!pm(e).Cn()&&e.Ja.size>0}function Yp(e){return 0===Me(e).tu.size}function Qp(e){e.su=void 0}async function Jp(e){e.iu.set("Online")}async function Xp(e){e.Ja.forEach((t,n)=>{$p(e,t)})}async function Zp(e,t){Qp(e),Wp(e)?(e.iu.za(t),Kp(e)):e.iu.set("Unknown")}async function em(e,t,n){if(e.iu.set("Online"),t instanceof Va&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const r of t.targetIds){if(e.Ja.has(r)){const t=e.Za.get(r);void 0!==t&&(await e.remoteSyncer.rejectListen(t,n),e.Ya.delete(t),e.Za.delete(r)),e.Ja.delete(r)}e.su.removeTarget(r)}}(e,t)}catch(n){Ne(Up,"Failed to remove targets %s: %s ",t.targetIds.join(","),n),await tm(e,n)}else if(t instanceof La?e.su.et(t):t instanceof Ma?e.su.ot(t):e.su.rt(t),!n.isEqual(Et.min()))try{const t=await hp(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.su.Rt(t);
2n.targetChanges.forEach((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const s=e.Ja.get(r);s&&e.Ja.set(r,s.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach((t,n)=>{const r=e.Ja.get(t);if(!r)return;e.Ja.set(t,r.withResumeToken(Dr.EMPTY_BYTE_STRING,r.snapshotVersion)),Hp(e,t);const s=new td(r.target,t,n,r.sequenceNumber);$p(e,s)});const r=function(e,t){const n=new Map;t.targetChanges.forEach((t,r)=>{const s=e.Za.get(r);void 0!==s&&n.set(s,t)});let r=new yr(Je);return t.targetMismatches.forEach((t,n)=>{const s=e.Za.get(t);void 0!==s&&(r=r.insert(s,n))}),new xa(t.snapshotVersion,n,r,t.documentUpdates,t.augmentedDocumentUpdates,t.resolvedLimboDocuments)}(e,n);return e.remoteSyncer.applyRemoteEvent(r)}(e,n)}catch(t){Ne(Up,"Failed to raise snapshot:",t),await tm(e,t)}}async function tm(e,t,n){if(!Gt(t))throw t;e.tu.add(1),await qp(e),e.iu.set("Offline"),n||(n=()=>hp(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{Ne(Up,"Retrying IndexedDB access"),await n(),e.tu.delete(1),await Bp(e)})}function nm(e,t){return t().catch(n=>tm(e,n,t))}async function rm(e){const t=Me(e),n=mm(t);let r=t.Ha.length>0?t.Ha[t.Ha.length-1].batchId:Zt;for(;sm(t);)try{const e=await fp(t.localStore,r);if(null===e){0===t.Ha.length&&n.Nn();break}r=e.batchId,im(t,e)}catch(e){await tm(t,e)}am(t)&&om(t)}function sm(e){return Yp(e)&&e.Ha.length<10}function im(e,t){e.Ha.push(t);const n=mm(e);n.Fn()&&n.Jn&&n.Yn(t.mutations)}function am(e){return Yp(e)&&!mm(e).Cn()&&e.Ha.length>0}function om(e){mm(e).start()}async function cm(e){mm(e).er()}async function um(e){const t=mm(e);for(const n of e.Ha)t.Yn(n.mutations)}async function lm(e,t,n){const r=e.Ha.shift(),s=Zh.from(r,t,n);await nm(e,()=>e.remoteSyncer.applySuccessfulWrite(s)),await rm(e)}async function hm(e,t){t&&mm(e).Jn&&await async function(e,t){if(function(e){return la(e)&&e!==Ve.ABORTED}(t.code)){const n=e.Ha.shift();mm(e).Mn(),await nm(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await rm(e)}}(e,t),am(e)&&om(e)}async function dm(e,t){const n=Me(e);n.asyncQueue.verifyOperationInProgress(),Ne(Up,"RemoteStore received new credentials");const r=Yp(n);n.tu.add(3),await qp(n),r&&n.iu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.tu.delete(3),await Bp(n)}async function fm(e,t){const n=Me(e);t?(n.tu.delete(2),await Bp(n)):t||(n.tu.add(2),await qp(n),n.iu.set("Unknown"))}function pm(e){return e._u||(e._u=function(e,t,n){const r=Me(e);return r.nr(),new Zo(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Qt:Jp.bind(null,e),zt:Xp.bind(null,e),Ht:Zp.bind(null,e),zn:em.bind(null,e)}
2),e.nu.push(async t=>{t?(e._u.Mn(),Wp(e)?Kp(e):e.iu.set("Unknown")):(await e._u.stop(),Qp(e))})),e._u}function mm(e){return e.ou||(e.ou=function(e,t,n){const r=Me(e);return r.nr(),new ec(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Qt:()=>Promise.resolve(),zt:cm.bind(null,e),Ht:hm.bind(null,e),Zn:um.bind(null,e),Xn:lm.bind(null,e)}),e.nu.push(async t=>{t?(e.ou.Mn(),await rm(e)):(await e.ou.stop(),e.Ha.length>0&&(Ne(Up,`Stopping write stream with ${e.Ha.length} pending writes`),e.Ha=[]))})),e.ou}class gm{constructor(e,t,n,r,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new Fe,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,r,s){const i=Date.now()+n,a=new gm(e,t,i,r,s);return a.start(n),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Ue(Ve.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function ym(e,t){if(Oe("AsyncQueue",`${t}: ${e}`),Gt(e))return new Ue(Ve.UNAVAILABLE,`${t}: ${e}`);throw e}class wm{static emptySet(e){return new wm(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||ot.comparator(t.key,n.key):(e,t)=>ot.comparator(e.key,t.key),this.keyedMap=ga(),this.sortedSet=new yr(this.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,n)=>(e(t),!1))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof wm))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(!e.isEqual(r))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new wm;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class _m{constructor(){this.au=new yr(ot.comparator)}track(e){const t=e.doc.key,n=this.au.get(t);n?0!==e.type&&3===n.type?this.au=this.au.insert(t,e):3===e.type&&1!==n.type?this.au=this.au.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.au=this.au.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.au=this.au.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.au=this.au.remove(t):1===e.type&&2===n.type?this.au=this.au.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.au=this.au.insert(t,{type:2,doc:e.doc}):ke(63341,{ft:e,uu:n}):this.au=this.au.insert(t,e)}cu(){const e=[];return this.au.inorderTraversal((t,n)=>{e.push(n)}),e}}class vm{constructor(e,t,n,r,s,i,a,o,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=s,this.fromCache=i,this.syncStateChanged=a,this.excludesMetadataChanges=o,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,r,s){const i=[];return t.forEach(e=>{i.push({type:0,doc:e})}),new vm(e,t,wm.emptySet(t),i,n,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Yh(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}class Em{constructor(){this.lu=void 0,this.Eu=[]}hu(){return this.Eu.some(e=>e.Tu())}}class Im{constructor(){this.queries=Tm(),this.onlineState="Unknown",this.Pu=new Set}terminate(){!function(e,t){const n=Me(e),r=n.queries;n.queries=Tm(),r.forEach((e,n)=>{for(const e of n.Eu)e.onError(t)})}(this,new Ue(Ve.ABORTED,"Firestore shutting down"))}}function Tm(){return new da(e=>Wh(e),Yh)}async function bm(e,t){const n=Me(e);let r=3;const s=t.query;let i=n.queries.get(s);i?!i.hu()&&t.Tu()&&(r=2):(i=new Em,r=t.Tu()?0:1);
2try{switch(r){case 0:i.lu=await n.onListen(s,!0);break;case 1:i.lu=await n.onListen(s,!1);break;case 2:await n.onFirstRemoteStoreListen(s)}}catch(e){const n=ym(e,`Initialization of query '${Hh(t.query)?Gh(t.query):ra(t.query)}' failed`);return void t.onError(n)}n.queries.set(s,i),i.Eu.push(t),t.Ru(n.onlineState),i.lu&&t.Iu(i.lu)&&Nm(n)}async function Sm(e,t){const n=Me(e),r=t.query;let s=3;const i=n.queries.get(r);if(i){const e=i.Eu.indexOf(t);e>=0&&(i.Eu.splice(e,1),0===i.Eu.length?s=t.Tu()?0:1:!i.hu()&&t.Tu()&&(s=2))}switch(s){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function Am(e,t){const n=Me(e);let r=!1;for(const e of t){const t=e.query,s=n.queries.get(t);if(s){for(const t of s.Eu)t.Iu(e)&&(r=!0);s.lu=e}}r&&Nm(n)}function Cm(e,t,n){const r=Me(e),s=r.queries.get(t);if(s)for(const e of s.Eu)e.onError(n);r.queries.delete(t)}function Nm(e){e.Pu.forEach(e=>{e.next()})}var Om,Dm;(Dm=Om||(Om={})).Default="default",Dm.Cache="cache";class Rm{constructor(e,t,n){this.query=e,this.Au=t,this.Vu=!1,this.du=null,this.onlineState="Unknown",this.options=n||{}}Iu(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new vm(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Vu?this.fu(e)&&(this.Au.next(e),t=!0):this.mu(e,this.onlineState)&&(this.pu(e),t=!0),this.du=e,t}onError(e){this.Au.error(e)}Ru(e){this.onlineState=e;let t=!1;return this.du&&!this.Vu&&this.mu(this.du,e)&&(this.pu(this.du),t=!0),t}mu(e,t){if(!e.fromCache)return!0;if(!this.Tu())return!0;const n="Offline"!==t;return(!this.options.waitForSyncWhenOnline||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}fu(e){if(e.docChanges.length>0)return!0;const t=this.du&&this.du.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}pu(e){e=vm.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Vu=!0,this.Au.next(e)}Tu(){return this.options.source!==Om.Cache}}class km{constructor(e,t){this.gu=e,this.byteLength=t}yu(){return"metadata"in this.gu}}class xm{constructor(e){this.serializer=e}Yo(e){return ro(this.serializer,e)}Zo(e){return e.metadata.exists?uo(this.serializer,e.document,!1):Pi.newNoDocument(this.Yo(e.metadata.name),this.Xo(e.metadata.readTime))}Xo(e){return Xa(e)}}class Pm{constructor(e,t){this.wu=e,this.serializer=t,this.bu=[],this.vu=[],this.collectionGroups=new Set,this.progress=Lm(e)}get queries(){return this.bu}get documents(){return this.vu}o(e){this.progress.bytesLoaded+=e.byteLength;let t=this.progress.documentsLoaded;if(e.gu.namedQuery)this.bu.push(e.gu.namedQuery);else if(e.gu.documentMetadata){this.vu.push({metadata:e.gu.documentMetadata}),e.gu.documentMetadata.exists||++t;const n=st.fromString(e.gu.documentMetadata.name);this.collectionGroups.add(n.get(n.length-2))}else e.gu.document&&(this.vu[this.vu.length-1].document=e.gu.document,++t);return t!==this.progress.documentsLoaded?(this.progress.documentsLoaded=t,{...this.progress}):null}Du(e){const t=new Map,n=new xm(this.serializer);for(const r of e)if(r.metadata.queries){const e=n.Yo(r.metadata.name);for(const n of r.metadata.queries){const r=(t.get(n)||Ta()).add(e);t.set(n,r)}}return t}async xu(e){const t=await async function(e,t,n,r){const s=Me(e);let i=Ta(),a=pa();for(const e of n){const n=t.Yo(e.metadata.name);e.document&&(i=i.add(n));const r=t.Zo(e);r.setReadTime(t.Xo(e.metadata.readTime)),a=a.insert(n,r)}const o=s.Qo.newChangeBuffer({trackRemovals:!0}),c=await pp(s,function(e){return Ji(Hi(st.fromString(`__bundle__/docs/${e}`)))}(r));return s.persistence.runTransaction("Apply bundle documents","readwrite",e=>dp(e,o,a).next(t=>(o.apply(e),t)).next(t=>s.g_.removeMatchingKeysForTargetId(e,c.targetId).next(()=>s.g_.addMatchingKeys(e,i,c.targetId)).next(()=>s.localDocuments.getLocalViewOfDocuments(e,t.jo,t.Ho)).next(()=>t.jo)))}(e,new xm(this.serializer),this.vu,this.wu.id),n=this.Du(this.documents);for(const t of this.bu)await vp(e,t,n.get(t.name));return this.progress.taskState="Success",{progress:this.progress,Cu:this.collectionGroups,Fu:t}}}function Lm(e){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:e.totalDocuments,totalBytes:e.totalBytes}}class Mm{constructor(e){this.key=e}}class Vm{constructor(e){this.key=e}}class Um{constructor(e,t){this.query=e,this.Ou=t,this.Mu=null,this.hasCachedResults=!1,this.current=!1,this.Nu=Ta(),this.mutatedKeys=Ta(),this.Lu=Hh(e)?vf(e):ia(e),this.Bu=new wm(this.Lu)}get Uu(){return this.Ou}ku(e,t){const n=t?t.qu:new _m,r=t?t.Bu:this.Bu;let s=t?t.mutatedKeys:this.mutatedKeys,i=r,a=!1;const[o,c]=this.$u(this.query,r);e.inorderTraversal((e,t)=>
2{const u=r.get(e),l=wf(this.query,t)?t:null,h=!!u&&this.mutatedKeys.has(u.key),d=!!l&&(l.hasLocalMutations||this.mutatedKeys.has(l.key)&&l.hasCommittedMutations);let f=!1;u&&l?u.data.isEqual(l.data)?h!==d&&(n.track({type:3,doc:l}),f=!0):this.Ku(u,l)||(n.track({type:2,doc:l}),f=!0,(o&&this.Lu(l,o)>0||c&&this.Lu(l,c)<0)&&(a=!0)):!u&&l?(n.track({type:0,doc:l}),f=!0):u&&!l&&(n.track({type:1,doc:u}),f=!0,(o||c)&&(a=!0)),f&&(l?(i=i.add(l),s=d?s.add(e):s.delete(e)):(i=i.delete(e),s=s.delete(e)))});const u=this.Wu(this.query);if(u)if(Hh(this.query)){const e=[];i.forEach(t=>e.push(t));const t=gf(this.query,e);let r=new wm(vf(this.query));for(const e of t)r=r.add(e);i.forEach(e=>{r.has(e.key)||(s=s.delete(e.key),n.track({type:1,doc:e}))}),i=r}else{const e=this.Qu(this.query);for(;i.size>u;){const t="F"===e?i.last():i.first();i=i.delete(t.key),s=s.delete(t.key),n.track({type:1,doc:t})}}return{Bu:i,qu:n,Uo:a,mutatedKeys:s}}Wu(e){return Hh(e)?Ef(e)?.limit:e.limit||void 0}Qu(e){if(Hh(e)){const t=Ef(e);return t&&t.limit<0?"L":"F"}return e.limitType}$u(e,t){if(Hh(e)){const n=Ef(e)?.limit;return[t.size===n?t.last():null,null]}return["F"===e.limitType&&t.size===this.Wu(this.query)?t.last():null,"L"===e.limitType&&t.size===this.Wu(this.query)?t.first():null]}Ku(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){const s=this.Bu;this.Bu=e.Bu,this.mutatedKeys=e.mutatedKeys;const i=e.qu.cu();i.sort((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ke(20277,{ft:e})}};return n(e)-n(t)}(e.type,t.type)||this.Lu(e.doc,t.doc)),this.Gu(n),r=r??!1;const a=t&&!r?this.zu():[],o=0===this.Nu.size&&this.current&&!r?1:0,c=o!==this.Mu;return this.Mu=o,0!==i.length||c?{snapshot:new vm(this.query,e.Bu,s,i,e.mutatedKeys,0===o,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),ju:a}:{ju:a}}Ru(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({Bu:this.Bu,qu:new _m,mutatedKeys:this.mutatedKeys,Uo:!1},!1)):{ju:[]}}Hu(e){return!this.Ou.has(e)&&!!this.Bu.has(e)&&!this.Bu.get(e).hasLocalMutations}Gu(e){e&&(e.addedDocuments.forEach(e=>this.Ou=this.Ou.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.Ou=this.Ou.delete(e)),this.current=e.current)}zu(){if(!this.current)return[];const e=this.Nu;this.Nu=Ta(),this.Bu.forEach(e=>{this.Hu(e.key)&&(this.Nu=this.Nu.add(e.key))});const t=[];return e.forEach(e=>{this.Nu.has(e)||t.push(new Vm(e))}),this.Nu.forEach(n=>{e.has(n)||t.push(new Mm(n))}),t}Ju(e){this.Ou=e.Jo,this.Nu=Ta();const t=this.ku(e.documents);return this.applyChanges(t,!0)}Yu(){return vm.fromInitialDocuments(this.query,this.Bu,this.mutatedKeys,0===this.Mu,this.hasCachedResults)}}const Fm="SyncEngine";class Bm{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class qm{constructor(e){this.key=e,this.Zu=!1}}class zm{constructor(e,t,n,r,s,i){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.Xu={},this.ec=new da(e=>Wh(e),Yh),this.tc=new Map,this.nc=new Set,this.rc=new yr(ot.comparator),this.sc=new Map,this._c=new Mf,this.oc={},this.ac=new Map,this.uc=uf.Cs(),this.onlineState="Unknown",this.cc=void 0}get isPrimaryClient(){return!0===this.cc}}async function jm(e,t,n=!0){const r=wg(e);let s;const i=r.ec.get(t);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.Yu()):s=await $m(r,t,n,!0),s}async function Gm(e,t){const n=wg(e);await $m(n,t,!0,!1)}async function $m(e,t,n,r){const s=await pp(e.localStore,Hh(t)?t:Ji(t)),i=s.targetId,a=e.sharedCl
2ientState.addLocalQueryTarget(i,n);let o;return r&&(o=await Hm(e,t,i,"current"===a,s.resumeToken)),e.isPrimaryClient&&n&&jp(e.remoteStore,s),o}async function Hm(e,t,n,r,s){e.lc=(t,n,r)=>async function(e,t,n,r){let s=t.view.ku(n);s.Uo&&(s=await gp(e.localStore,t.query,!1).then(({documents:e})=>t.view.ku(e,s)));const i=r&&r.targetChanges.get(t.targetId),a=r&&null!=r.targetMismatches.get(t.targetId),o=t.view.applyChanges(s,e.isPrimaryClient,i,a);return sg(e,t.targetId,o.ju),o.snapshot}(e,t,n,r);const i=await gp(e.localStore,t,!0),a=new Um(t,i.Jo),o=a.ku(i.documents),c=Pa.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==e.onlineState,s),u=a.applyChanges(o,e.isPrimaryClient,c);sg(e,n,u.ju);const l=new Bm(t,n,a);return e.ec.set(t,l),e.tc.has(n)?e.tc.get(n).push(t):e.tc.set(n,[t]),u.snapshot}async function Km(e,t,n){const r=Me(e),s=r.ec.get(t),i=r.tc.get(s.targetId);if(i.length>1)return r.tc.set(s.targetId,i.filter(e=>!Yh(e,t))),void r.ec.delete(t);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedCl
2ientState.isActiveQueryTarget(s.targetId)||await mp(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),n&&Gp(r.remoteStore,s.targetId),ng(r,s.targetId)}).catch(Mt)):(ng(r,s.targetId),await mp(r.localStore,s.targetId,!0))}async function Wm(e,t){const n=Me(e),r=n.ec.get(t),s=n.tc.get(r.targetId);n.isPrimaryClient&&1===s.length&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),Gp(n.remoteStore,r.targetId))}async function Ym(e,t){const n=Me(e);try{const e=await function(e,t){const n=Me(e),r=t.snapshotVersion;let s=n.$o;return n.persistence.runTransaction("Apply remote event","readwrite-primary",e=>{const i=n.Qo.newChangeBuffer({trackRemovals:!0});s=n.$o;const a=[];t.targetChanges.forEach((i,o)=>{const c=s.get(o);if(!c)return;a.push(n.g_.removeMatchingKeys(e,i.removedDocuments,o).next(()=>n.g_.addMatchingKeys(e,i.addedDocuments,o)));let u=c.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(o)?u=u.withResumeToken(Dr.EMPTY_BYTE_STRING,Et.min()).withLastLimboFreeSnapshotVersion(Et.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(o,u),function(e,t,n){return 0===e.resumeToken.approximateByteSize()||(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&a.push(n.g_.updateTargetData(e,u))});let o=pa(),c=Ta();if(t.documentUpdates.forEach(r=>{t.resolvedLimboDocuments.has(r)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))}),a.push(dp(e,i,t.documentUpdates).next(e=>{o=e.jo,c=e.Ho})),!r.isEqual(Et.min())){const t=n.g_.getLastRemoteSnapshotVersion(e).next(t=>n.g_.setTargetsMetadata(e,e.currentSequenceNumber,r));a.push(t)}return Vt.waitFor(a).next(()=>i.apply(e)).next(()=>n.localDocuments.getLocalViewOfDocuments(e,o,c)).next(()=>o)}).then(e=>(n.$o=s,e))}(n.localStore,t);
2t.targetChanges.forEach((e,t)=>{const r=n.sc.get(t);r&&(Pe(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?r.Zu=!0:e.modifiedDocuments.size>0?Pe(r.Zu,14607):e.removedDocuments.size>0&&(Pe(r.Zu,42227),r.Zu=!1))}),await og(n,e,t)}catch(e){await Mt(e)}}function Qm(e,t,n){const r=Me(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const e=[];r.ec.forEach((n,r)=>{const s=r.view.Ru(t);s.snapshot&&e.push(s.snapshot)}),function(e,t){const n=Me(e);n.onlineState=t;let r=!1;n.queries.forEach((e,n)=>{for(const e of n.Eu)e.Ru(t)&&(r=!0)}),r&&Nm(n)}(r.eventManager,t),e.length&&r.Xu.zn(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function Jm(e,t,n){const r=Me(e);r.sharedClientState.updateQueryState(t,"rejected",n);const s=r.sc.get(t),i=s&&s.key;if(i){let e=new yr(ot.comparator);e=e.insert(i,Pi.newNoDocument(i,Et.min()));const n=Ta().add(i),s=new xa(Et.min(),new Map,new yr(Je),e,pa(),n);await Ym(r,s),r.rc=r.rc.remove(i),r.sc.delete(t),ag(r)}else await mp(r.localStore,t,!1).then(()=>ng(r,t,n)).catch(Mt)}async function Xm(e,t){const n=Me(e),r=t.batch.batchId;try{const e=await function(e,t){const n=Me(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{const r=t.batch.keys(),s=n.Qo.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){const s=n.batch,i=s.keys();let a=Vt.resolve();return i.forEach(e=>{a=a.next(()=>r.getEntry(t,e)).next(t=>{const i=n.docVersions.get(e);Pe(null!==i,48541),t.version.compareTo(i)<0&&(s.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))})}),a.next(()=>e.mutationQueue.removeMutationBatch(t,s))}(n,e,t,s).next(()=>s.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=Ta();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))).next(()=>n.localDocuments.getDocuments(e,r))})}(n.localStore,t);tg(n,r,null),eg(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await og(n,e)}catch(e){await Mt(e)}}async function Zm(e,t,n){const r=Me(e);try{const e=await function(e,t){const n=Me(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let r;
2return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(Pe(null!==t,37113),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t))).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r)).next(()=>n.localDocuments.getDocuments(e,r))})}(r.localStore,t);tg(r,t,n),eg(r,t),r.sharedClientState.updateMutationState(t,"rejected",n),await og(r,e)}catch(n){await Mt(n)}}function eg(e,t){(e.ac.get(t)||[]).forEach(e=>{e.resolve()}),e.ac.delete(t)}function tg(e,t,n){const r=Me(e);let s=r.oc[r.currentUser.toKey()];if(s){const e=s.get(t);e&&(n?e.reject(n):e.resolve(),s=s.remove(t)),r.oc[r.currentUser.toKey()]=s}}function ng(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const r of e.tc.get(t))e.ec.delete(r),n&&e.Xu.Ec(r,n);e.tc.delete(t),e.isPrimaryClient&&e._c.s_(t).forEach(t=>{e._c.containsKey(t)||rg(e,t)})}function rg(e,t){e.nc.delete(t.path.canonicalString());const n=e.rc.get(t);null!==n&&(Gp(e.remoteStore,n),e.rc=e.rc.remove(t),e.sc.delete(n),ag(e))}function sg(e,t,n){for(const r of n)r instanceof Mm?(e._c.addReference(r.key,t),ig(e,r)):r instanceof Vm?(Ne(Fm,"Document no longer in limbo: "+r.key),e._c.removeReference(r.key,t),e._c.containsKey(r.key)||rg(e,r.key)):ke(19791,{hc:r})}function ig(e,t){const n=t.key,r=n.path.canonicalString();e.rc.get(n)||e.nc.has(r)||(Ne(Fm,"New document in limbo: "+n),e.nc.add(r),ag(e))}function ag(e){for(;e.nc.size>0&&e.rc.size<e.maxConcurrentLimboResolutions;){const t=e.nc.values().next().value;e.nc.delete(t);const n=new ot(st.fromString(t)),r=e.uc.next();e.sc.set(r,new qm(n)),e.rc=e.rc.insert(n,r),jp(e.remoteStore,new td(Ji(Hi(n.path)),r,"TargetPurposeLimboResolution",Xt.ce))}}async function og(e,t,n){const r=Me(e),s=[],i=[],a=[];r.ec.isEmpty()||(r.ec.forEach((e,o)=>{a.push(r.lc(o,t,n).then(e=>{if((e||n)&&r.isPrimaryClient){const t=e?!e.fromCache:n?.targetChanges.get(o.targetId)?.current;
2r.sharedClientState.updateQueryState(o.targetId,t?"current":"not-current")}if(e){s.push(e);const t=rp.vo(o.targetId,e);i.push(t)}}))}),await Promise.all(a),r.Xu.zn(s),await async function(e,t){const n=Me(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",e=>Vt.forEach(t,t=>Vt.forEach(t.wo,r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r)).next(()=>Vt.forEach(t.bo,r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))}catch(e){if(!Gt(e))throw e;Ne(op,"Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.$o.get(t),r=e.snapshotVersion,s=e.withLastLimboFreeSnapshotVersion(r);n.$o=n.$o.insert(t,s)}}}(r.localStore,i))}async function cg(e,t){const n=Me(e);if(!n.currentUser.isEqual(t)){Ne(Fm,"User change. New user:",t.toKey());const e=await lp(n.localStore,t);n.currentUser=t,function(e,t){e.ac.forEach(e=>{e.forEach(e=>{e.reject(new Ue(Ve.CANCELLED,t))})}),e.ac.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await og(n,e.zo)}}function ug(e,t){const n=Me(e),r=n.sc.get(t);if(r&&r.Zu)return Ta().add(r.key);{let e=Ta();const r=n.tc.get(t);if(!r)return e;for(const t of r??[]){const r=n.ec.get(t);e=e.unionWith(r.view.Uu)}return e}}async function lg(e,t){const n=Me(e),r=await gp(n.localStore,t.query,!0),s=t.view.Ju(r);return n.isPrimaryClient&&sg(n,t.targetId,s.ju),s}async function hg(e,t){const n=Me(e);return wp(n.localStore,t).then(e=>og(n,e))}async function dg(e,t,n,r){const s=Me(e),i=await function(e,t){const n=Me(e),r=Me(n.mutationQueue);return n.persistence.runTransaction("Lookup mutation documents","readonly",e=>r.ps(e,t).next(t=>t?n.localDocuments.getDocuments(e,t):Vt.resolve(null)))}(s.localStore,t);null!==i?("pending"===n?await rm(s.remoteStore):"acknowledged"===n||"rejected"===n?(tg(s,t,r||null),eg(s,t),function(e,t){Me(Me(e).mutationQueue).bs(t)}(s.localStore,t)):ke(6720,"Unknown batchState",{Tc:n}),await og(s,i)):Ne(Fm,"Cannot apply mutation batch with id: "+t)}async function fg(e,t,n){const r=Me(e),s=[],i=[];for(const e of t){let t;const n=r.tc.get(e);if(n&&0!==n.length){t=await pp(r.localStore,Hh(n[0])?n[0]:Ji(n[0]));for(const e of n){const t=r.ec.get(e),n=await lg(r,t);n.snapshot&&i.push(n.snapshot)}}else{const n=await yp(r.localStore,e);t=await pp(r.localStore,n),await Hm(r,pg(n),e,!1,t.resumeToken)}s.push(t)}return r.Xu.zn(i),s}function pg(e){return Fi(e)?e:$i(e.path,e.collectionGroup,e.orderBy,e.filters,e.limit,"F",e.startAt,e.endAt)}function mg(e){return function(e){return Me(Me(e).persistence).po()}(Me(e).localStore)}async function gg(e,t,n,r){const s=Me(e);if(s.cc)return void Ne(Fm,"Ignoring unexpected query state notification.");const i=s.tc.get(t);if(i&&i.length>0)switch(n){case"current":case"not-current":{let e;if(Hh(i[0]))switch(Ju(i[0])){case"collection_group":case"collection":e=await wp(s.localStore,el(i[0]));break;case"documents":e=await function(e,t){const n=Me(e),r=Ta(...tl(t).map(e=>ot.fromPath(e)));return n.persistence.runTransaction("Get documents for pipeline","readonly",e=>n.Qo.getEntries(e,r)).then(e=>e)}(s.localStore,i[0]);break;default:De(""),e=ga()}else e=await wp(s.localStore,function(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}(i[0]));const r=xa.createSynthesizedRemoteEventForCurrentChange(t,"current"===n,Dr.EMPTY_BYTE_STRING);await og(s,e,r);break}case"rejected":await mp(s.localStore,t,!0),ng(s,t,r);break;default:ke(64155,n)}}async function yg(e,t,n){const r=wg(e);if(r.cc){for(const e of t){if(r.tc.has(e)&&r.sharedClientState.isActiveQueryTarget(e)){Ne(Fm,"Adding an already active target "+e);continue}const t=await yp(r.localStore,e),n=await pp(r.localStore,t);await Hm(r,pg(t),n.targetId,!1,n.resumeToken),jp(r.remoteStore,n)}for(const e of n)r.tc.has(e)&&await mp(r.localStore,e,!1).then(()=>{Gp(r.remoteStore,e),ng(r,e)}).catch(Mt)}}function wg(e){const t=Me(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=Ym.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=ug.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=Jm.bind(null,t),t.Xu.zn=Am.bind(null,t.eventManager),t.Xu.Ec=Cm.bind(null,t.eventManager),t}function _g(e){const t=Me(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Xm.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=Zm.bind(null,t),t}class vg{constructor(){this.kind="memory",this.synchronizeTabs=!1}
2async initialize(e){this.serializer=Do(e.databaseInfo.databaseId),this.sharedClientState=this.Rc(e),this.persistence=this.Ic(e),await this.persistence.start(),this.localStore=this.Ac(e),this.gcScheduler=this.Vc(e,this.localStore),this.indexBackfillerScheduler=this.dc(e,this.localStore)}Vc(e,t){return null}dc(e,t){return null}Ac(e){return up(this.persistence,new ap,e.initialUser,this.serializer)}Ic(e){return new zf(Gf.C_,this.serializer)}Rc(e){return new Pp}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}vg.provider={build:()=>new vg};class Eg extends vg{constructor(e){super(),this.cacheSizeBytes=e}Vc(e,t){Pe(this.persistence.referenceDelegate instanceof $f,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new pc(n,e.asyncQueue,t)}Ic(e){const t=void 0!==this.cacheSizeBytes?uc.withCacheSize(this.cacheSizeBytes):uc.DEFAULT;return new zf(e=>$f.C_(e,t),this.serializer)}}class Ig extends vg{constructor(e,t,n){super(),this.fc=e,this.cacheSizeBytes=t,this.forceOwnership=n,this.kind="persistent",this.synchronizeTabs=!1}async initialize(e){await super.initialize(e),await this.fc.initialize(this,e),await _g(this.fc.syncEngine),await rm(this.fc.remoteStore),await this.persistence._o(()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve()))}Ac(e){return up(this.persistence,new ap,e.initialUser,this.serializer)}Vc(e,t){const n=this.persistence.referenceDelegate.garbageCollector;return new pc(n,e.asyncQueue,t)}dc(e,t){const n=new Jt(t,this.persistence);return new Qt(e.asyncQueue,n)}Ic(e){const t=np(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),n=void 0!==this.cacheSizeBytes?uc.withCacheSize(this.cacheSizeBytes):uc.DEFAULT;return new Zf(this.synchronizeTabs,t,e.clientId,n,e.asyncQueue,Lp(),Mp(),this.serializer,this.sharedClientState,!!this.forceOwnership)}Rc(e){return new Pp}}class Tg extends Ig{constructor(e,t){super(e,t,!1),this.fc=e,this.cacheSizeBytes=t,this.synchronizeTabs=!0}async initialize(e){await super.initialize(e);const t=this.fc.syncEngine;this.sharedClientState instanceof xp&&(this.sharedClientState.syncEngine={Na:dg.bind(null,t),La:gg.bind(null,t),Ba:yg.bind(null,t),po:mg.bind(null,t),Ma:hg.bind(null,t)},await this.sharedClientState.start()),await this.persistence._o(async e=>{await async function(e,t){const n=Me(e);if(wg(n),_g(n),!0===t&&!0!==n.cc){const e=n.sharedClientState.getAllActiveQueryTargets(),t=await fg(n,e.toArray());n.cc=!0,await fm(n.remoteStore,!0);for(const e of t)jp(n.remoteStore,e)}else if(!1===t&&!1!==n.cc){const e=[];let t=Promise.resolve();n.tc.forEach((r,s)=>{n.sharedClientState.isLocalQueryTarget(s)?e.push(s):t=t.then(()=>(ng(n,s),mp(n.localStore,s,!0))),Gp(n.remoteStore,s)}),await t,await fg(n,e),function(e){const t=Me(e);t.sc.forEach((e,n)=>{Gp(t.remoteStore,n)}),t._c.__(),t.sc=new Map,t.rc=new yr(ot.comparator)}(n),n.cc=!1,await fm(n.remoteStore,!1)}}(this.fc.syncEngine,e),this.gcScheduler&&(e&&!this.gcScheduler.started?this.gcScheduler.start():e||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(e&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():e||this.indexBackfillerScheduler.stop())})}Rc(e){const t=Lp();if(!xp.C(t))throw new Ue(Ve.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");const n=np(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new xp(t,e.asyncQueue,n,e.clientId,e.initialUser)}}class bg{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>Qm(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=cg.bind(null,this.syncEngine),await fm(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new Im}createDatastore(e){const t=Do(e.databaseInfo.databaseId),n=Yo(e.databaseInfo);return rc(e.authCredentials,e.appCheckCredentials,n,t)}
2createRemoteStore(e){return function(e,t,n,r,s){return new Fp(e,t,n,r,s)}(this.localStore,this.datastore,e.asyncQueue,e=>Qm(this.syncEngine,e,0),Fo.C()?new Fo:new Vo)}createSyncEngine(e,t){return function(e,t,n,r,s,i,a){const o=new zm(e,t,n,r,s,i);return a&&(o.cc=!0),o}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){await async function(e){const t=Me(e);Ne(Up,"RemoteStore shutting down."),t.tu.add(5),await qp(t),t.ru.shutdown(),t.iu.set("Unknown")}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}function Sg(e,t=10240){let n=0;return{async read(){if(n<e.byteLength){const r={value:e.slice(n,n+t),done:!1};return n+=t,r}return{done:!0}},async cancel(){},releaseLock(){},closed:Promise.resolve()}}bg.provider={build:()=>new bg};class Ag{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.mc(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.mc(this.observer.error,e):Oe("Uncaught Error in snapshot listener:",e.toString()))}gc(){this.muted=!0}mc(e,t){setTimeout(()=>{this.muted||e(t)},0)}}class Cg{constructor(e,t){this.yc=e,this.serializer=t,this.metadata=new Fe,this.buffer=new Uint8Array,this.wc=new TextDecoder("utf-8"),this.bc().then(e=>{e&&e.yu()?this.metadata.resolve(e.gu.metadata):this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is\n ${JSON.stringify(e?.gu)}`))},e=>this.metadata.reject(e))}close(){return this.yc.cancel()}async getMetadata(){return this.metadata.promise}async Pc(){return await this.getMetadata(),this.bc()}async bc(){const e=await this.vc();if(null===e)return null;const t=this.wc.decode(e),n=Number(t);isNaN(n)&&this.Sc(`length string (${t}) is not valid number`);const r=await this.Dc(n);return new km(JSON.parse(r),e.length+n)}xc(){return this.buffer.findIndex(e=>e==="{".charCodeAt(0))}async vc(){for(;this.xc()<0&&!await this.Cc(););if(0===this.buffer.length)return null;const e=this.xc();e<0&&this.Sc("Reached the end of bundle when a length string is expected.");const t=this.buffer.slice(0,e);return this.buffer=this.buffer.slice(e),t}async Dc(e){for(;this.buffer.length<e;)await this.Cc()&&this.Sc("Reached the end of bundle when more is expected.");const t=this.wc.decode(this.buffer.slice(0,e));return this.buffer=this.buffer.slice(e),t}Sc(e){throw this.yc.cancel(),new Error(`Invalid bundle format: ${e}`)}async Cc(){const e=await this.yc.read();if(!e.done){const t=new Uint8Array(this.buffer.length+e.value.length);t.set(this.buffer),t.set(e.value,this.buffer.length),this.buffer=t}return e.done}}class Ng{constructor(e,t){this.bundleData=e,this.serializer=t,this.cursor=0,this.elements=[];let n=this.Pc();if(!n||!n.yu())throw new Error(`The first element of the bundle is not a metadata object, it is\n ${JSON.stringify(n?.gu)}`);this.metadata=n;do{n=this.Pc(),null!==n&&this.elements.push(n)}while(null!==n)}getMetadata(){return this.metadata}t(){return this.elements}Pc(){if(this.cursor===this.bundleData.length)return null;const e=this.vc(),t=this.Dc(e);return new km(JSON.parse(t),e)}Dc(e){if(this.cursor+e>this.bundleData.length)throw new Ue(Ve.INTERNAL,"Reached the end of bundle when more is expected.");return this.bundleData.slice(this.cursor,this.cursor+=e)}vc(){const e=this.cursor;let t=this.cursor;for(;t<this.bundleData.length;){if("{"===this.bundleData[t]){if(t===e)throw new Error("First character is a bracket and not a number");return this.cursor=t,Number(this.bundleData.slice(e,t))}t++}throw new Error("Reached the end of bundle when more is expected.")}}class Og{constructor(e){this.datastore=e,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastTransactionError=null,this.writtenDocs=new Set}async lookup(e){if(this.ensureCommitNotCalled(),this.mutations.length>0)throw this.lastTransactionError=new Ue(Ve.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;const t=await async function(e,t){const n=Me(e),r={documents:t.map(e=>no(n.serializer,e))},s=await n.$t("BatchGetDocuments",n.serializer.databaseId,st.emptyPath(),r,t.length),i=new Map;
2s.forEach(e=>{const t=function(e,t){return"found"in t?function(e,t){Pe(!!t.found,43571),t.found.name,t.found.updateTime;const n=ro(e,t.found.name),r=Xa(t.found.updateTime),s=t.found.createTime?Xa(t.found.createTime):Et.min(),i=new Ss({mapValue:{fields:t.found.fields}});return Pi.newFoundDocument(n,r,s,i)}(e,t):"missing"in t?function(e,t){Pe(!!t.missing,3894),Pe(!!t.readTime,22933);const n=ro(e,t.missing),r=Xa(t.readTime);return Pi.newNoDocument(n,r)}(e,t):ke(7234,{result:t})}(n.serializer,e);i.set(t.key.toString(),t)});const a=[];return t.forEach(e=>{const t=i.get(e.toString());Pe(!!t,55234,{key:e}),a.push(t)}),a}(this.datastore,e);return t.forEach(e=>this.recordVersion(e)),t}set(e,t){this.write(t.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,t){try{this.write(t.toMutation(e,this.preconditionForUpdate(e)))}catch(e){this.lastTransactionError=e}this.writtenDocs.add(e.toString())}delete(e){this.write(new oi(e,this.precondition(e))),this.writtenDocs.add(e.toString())}async commit(){if(this.ensureCommitNotCalled(),this.lastTransactionError)throw this.lastTransactionError;const e=this.readVersions;this.mutations.forEach(t=>{e.delete(t.key.toString())}),e.forEach((e,t)=>{const n=ot.fromPath(t);this.mutations.push(new ci(n,this.precondition(n)))}),await async function(e,t){const n=Me(e),r={writes:t.map(e=>lo(n.serializer,e))};await n.Bt("Commit",n.serializer.databaseId,st.emptyPath(),r)}(this.datastore,this.mutations),this.committed=!0}recordVersion(e){let t;if(e.isFoundDocument())t=e.version;else{if(!e.isNoDocument())throw ke(50498,{Oc:e.constructor.name});t=Et.min()}const n=this.readVersions.get(e.key.toString());if(n){if(!t.isEqual(n))throw new Ue(Ve.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),t)}precondition(e){const t=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&t?t.isEqual(Et.min())?Ws.exists(!1):Ws.updateTime(t):Ws.none()}preconditionForUpdate(e){const t=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&t){if(t.isEqual(Et.min()))throw new Ue(Ve.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Ws.updateTime(t)}return Ws.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}}class Dg{constructor(e,t,n,r,s){this.asyncQueue=e,this.datastore=t,this.options=n,this.updateFunction=r,this.deferred=s,this.Mc=n.maxAttempts,this.xn=new Qo(this.asyncQueue,"transaction_retry")}Nc(){this.Mc-=1,this.Lc()}Lc(){this.xn.mn(async()=>{const e=new Og(this.datastore),t=this.Bc(e);t&&t.then(t=>{this.asyncQueue.enqueueAndForget(()=>e.commit().then(()=>{this.deferred.resolve(t)}).catch(e=>{this.Uc(e)}))}).catch(e=>{this.Uc(e)})})}Bc(e){try{const t=this.updateFunction(e);return!en(t)&&t.catch&&t.then?t:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(e){return this.deferred.reject(e),null}}Uc(e){this.Mc>0&&this.kc(e)?(this.Mc-=1,this.asyncQueue.enqueueAndForget(()=>(this.Lc(),Promise.resolve()))):this.deferred.reject(e)}kc(e){if("FirebaseError"===e?.name){const t=e.code;return"aborted"===t||"failed-precondition"===t||"already-exists"===t||!la(t)}return!1}}const Rg="FirestoreClient";class kg{constructor(e,t,n,r,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this._databaseInfo=r,this.user=Te.UNAUTHENTICATED,this.clientId=Qe.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(n,async e=>{Ne(Rg,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(Ne(Rg,"Received new app check token=",e),this.appCheckCredentialListener(e,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Fe;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const n=ym(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}}async function xg(e,t){e.asyncQueue.verifyOperationInProgress(),Ne(Rg,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener(async e=>{r.isEqual(e)||(await lp(t.localStore,e),r=e)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}async function Pg(e,t){e.asyncQueue.verifyOperationInProgress();const n=await Lg(e);Ne(Rg,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>dm(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>dm(t.remoteStore,n)),e._onlineComponents=t}async function Lg(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){Ne(Rg,"Using user provided OfflineComponentProvider");try{await xg(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(e){return"FirebaseError"===e.name?e.code===Ve.FAILED_PRECONDITION||e.code===Ve.UNIMPLEMENT
2ED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}(n))throw n;De("Error using user provided cache. Falling back to memory cache: "+n),await xg(e,new vg)}}else Ne(Rg,"Using default OfflineComponentProvider"),await xg(e,new Eg(void 0));return e._offlineComponents}async function Mg(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(Ne(Rg,"Using user provided OnlineComponentProvider"),await Pg(e,e._uninitializedComponentsProvider._online)):(Ne(Rg,"Using default OnlineComponentProvider"),await Pg(e,new bg))),e._onlineComponents}function Vg(e){return Lg(e).then(e=>e.persistence)}function Ug(e){return Lg(e).then(e=>e.localStore)}function Fg(e){return Mg(e).then(e=>e.remoteStore)}function Bg(e){return Mg(e).then(e=>e.syncEngine)}function qg(e){return Mg(e).then(e=>e.datastore)}async function zg(e){const t=await Mg(e),n=t.eventManager;return n.onListen=jm.bind(null,t.syncEngine),n.onUnlisten=Km.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=Gm.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=Wm.bind(null,t.syncEngine),n}function jg(e,t,n={}){const r=new Fe;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,r,s){const i=new Ag({next:o=>{i.gc(),t.enqueueAndForget(()=>Sm(e,a));const c=o.docs.has(n);!c&&o.fromCache?s.reject(new Ue(Ve.UNAVAILABLE,"Failed to get document because the client is offline.")):c&&o.fromCache&&r&&"server"===r.source?s.reject(new Ue(Ve.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(o)},error:e=>s.reject(e)}),a=new Rm(Hi(n.path),i,{includeMetadataChanges:!0,waitForSyncWhenOnline:!0});return bm(e,a)}(await zg(e),e.asyncQueue,t,n,r)),r.promise}function Gg(e,t,n={}){const r=new Fe;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,r,s){const i=new Ag({next:n=>{i.gc(),t.enqueueAndForget(()=>Sm(e,a)),n.fromCache&&"server"===r.source?s.reject(new Ue(Ve.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):s.resolve(n)},error:e=>s.reject(e)}),a=new Rm(n instanceof nl?function(e,t){const n=function(e){let t=!1;const n=[];for(const r of e)if(r instanceof Ku)if(t=!0,r.orderings.some(e=>e.expr instanceof Tu&&e.expr.fieldName===nt))n.push(r);else{const e=r.orderings.map(e=>e);e.push(bu(nt).ascending()),n.push(new Ku(e,{}))}else r instanceof Gu?(t||(n.push(new Ku([bu(nt).ascending()],{})),t=!0),n.push(r)):n.push(r);return t||n.push(new Ku([bu(nt).ascending()],{})),n}(e.stages);if(e.userDataReader){const t=e.userDataReader.createContext(3,"toCorePipeline");n.forEach(e=>e._readUserData(t))}return new Qu(e.userDataReader.serializer,n,t)}(n):n,i,{includeMetadataChanges:!0,waitForSyncWhenOnline:!0});return bm(e,a)}(await zg(e),e.asyncQueue,t,n,r)),r.promise}function $g(e,t){const n=new Fe;return e.asyncQueue.enqueueAndForget(async()=>async function(e,t,n){const r=_g(e);try{const e=await function(e,t){const n=Me(e),r=vt.now(),s=t.reduce((e,t)=>e.add(t.key),Ta());let i,a;return n.persistence.runTransaction("Locally write mutations","readwrite",e=>{let o=pa(),c=Ta();return n.Qo.getEntries(e,s).next(e=>{o=e,o.forEach((e,t)=>{t.isValidDocument()||(c=c.add(e))})}).next(()=>n.localDocuments.getOverlayedDocuments(e,o)).next(s=>{i=s;const a=[];for(const e of t){const t=ei(e,i.get(e.key).overlayedDocument);null!=t&&a.push(new ri(e.key,t,As(t.value.mapValue),Ws.exists(!0)))}
2return n.mutationQueue.addMutationBatch(e,r,a,t)}).next(t=>{a=t;const r=t.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)})}).then(()=>({batchId:a.batchId,changes:ya(i)}))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.oc[e.currentUser.toKey()];r||(r=new yr(Je)),r=r.insert(t,n),e.oc[e.currentUser.toKey()]=r}(r,e.batchId,n),await og(r,e.changes),await rm(r.remoteStore)}catch(e){const t=ym(e,"Failed to persist write");n.reject(t)}}(await Bg(e),t,n)),n.promise}function Hg(e,t,n,r){const s=function(e,t){let n;return n="string"==typeof e?Ca().encode(e):e,function(e,t){return new Cg(e,t)}(function(e,t){if(e instanceof Uint8Array)return Sg(e,t);if(e instanceof ArrayBuffer)return Sg(new Uint8Array(e),t);if(e instanceof ReadableStream)return e.getReader();throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream")}(n),t)}(n,Do(t));e.asyncQueue.enqueueAndForget(async()=>{!function(e,t,n){const r=Me(e);(async function(e,t,n){try{const r=await t.getMetadata();if(await function(e,t){const n=Me(e),r=Xa(t.createTime);return n.persistence.runTransaction("hasNewerBundle","readonly",e=>n.w_.getBundleMetadata(e,t.id)).then(e=>!!e&&e.createTime.compareTo(r)>=0)}(e.localStore,r))return await t.close(),n._completeWith(function(e){return{taskState:"Success",documentsLoaded:e.totalDocuments,bytesLoaded:e.totalBytes,totalDocuments:e.totalDocuments,totalBytes:e.totalBytes}}(r)),Promise.resolve(new Set);n._updateProgress(Lm(r));const s=new Pm(r,t.serializer);let i=await t.Pc();for(;i;){const e=await s.o(i);e&&n._updateProgress(e),i=await t.Pc()}const a=await s.xu(e.localStore);return await og(e,a.Fu,void 0),await function(e,t){const n=Me(e);return n.persistence.runTransaction("Save bundle","readwrite",e=>n.w_.saveBundleMetadata(e,t))}(e.localStore,r),n._completeWith(a.progress),Promise.resolve(a.Cu)}catch(e){return De(Fm,`Loading bundle failed with ${e}`),n._failWith(e),Promise.resolve(new Set)}})(r,t,n).then(e=>{r.sharedClientState.notifyBundleLoaded(e)})}(await Bg(e),s,r)})}function Kg(e,t){return function(e,t){return new Ng(e,t)}(e,t)}const Wg="AsyncQueue";class Yg{constructor(e=Promise.resolve()){this.qc=[],this.$c=!1,this.Kc=[],this.Wc=null,this.Qc=!1,this.Gc=!1,this.zc=[],this.xn=new Qo(this,"async_queue_retry"),this.jc=()=>{const e=Mp();e&&Ne(Wg,"Visibility state changed to "+e.visibilityState),this.xn.gn()},this.Hc=e;const t=Mp();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.jc)}get isShuttingDown(){return this.$c}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Jc(),this.Yc(e)}enterRestrictedMode(e){if(!this.$c){this.$c=!0,this.Gc=e||!1;const t=Mp();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.jc)}}enqueue(e){if(this.Jc(),this.$c)return new Promise(()=>{});const t=new Fe;return this.Yc(()=>this.$c&&this.Gc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.qc.push(e),this.Zc()))}async Zc(){if(0!==this.qc.length){try{await this.qc[0](),this.qc.shift(),this.xn.reset()}catch(e){if(!Gt(e))throw e;Ne(Wg,"Operation failed with retryable error: "+e)}this.qc.length>0&&this.xn.mn(()=>this.Zc())}}Yc(e){const t=this.Hc.then(()=>(this.Qc=!0,e().catch(e=>{throw this.Wc=e,this.Qc=!1,Oe("INTERNAL UNHANDLED ERROR: ",Qg(e)),e}).then(e=>(this.Qc=!1,e))));return this.Hc=t,t}enqueueAfterDelay(e,t,n){this.Jc(),this.zc.indexOf(e)>-1&&(t=0);const r=gm.createAndSchedule(this,e,t,n,e=>this.Xc(e));return this.Kc.push(r),r}Jc(){this.Wc&&ke(47125,{el:Qg(this.Wc)})}verifyOperationInProgress(){}async tl(){let e;do{e=this.Hc,await e}while(e!==this.Hc)}nl(e){for(const t of this.Kc)if(t.timerId===e)return!0;return!1}rl(e){return this.tl().then(()=>{this.Kc.sort((e,t)=>e.targetTimeMs-t.targetTimeMs);for(const t of this.Kc)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.tl()})}il(e){this.zc.push(e)}Xc(e){const t=this.Kc.indexOf(e);this.Kc.splice(t,1)}}function Qg(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}
2class Jg{constructor(){this._progressObserver={},this._taskCompletionResolver=new Fe,this._lastProgress={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}onProgress(e,t,n){this._progressObserver={next:e,error:t,complete:n}}catch(e){return this._taskCompletionResolver.promise.catch(e)}then(e,t){return this._taskCompletionResolver.promise.then(e,t)}_completeWith(e){this._updateProgress(e),this._progressObserver.complete&&this._progressObserver.complete(),this._taskCompletionResolver.resolve(e)}_failWith(e){this._lastProgress.taskState="Error",this._progressObserver.next&&this._progressObserver.next(this._lastProgress),this._progressObserver.error&&this._progressObserver.error(e),this._taskCompletionResolver.reject(e)}_updateProgress(e){this._lastProgress=e,this._progressObserver.next&&this._progressObserver.next(e)}}class Xg extends vc{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new Yg,this._persistenceKey=r?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Yg(e),this._firestoreClient=void 0,await e}}}function Zg(e,t,n){n||(n=jr);const r=(0,i.j6)(e,"firestore");if(r.isInitialized(n)){const e=r.getImmediate({identifier:n}),s=r.getOptions(n);if((0,o.bD)(s,t))return e;throw new Ue(Ve.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(void 0!==t.cacheSizeBytes&&void 0!==t.localCache)throw new Ue(Ve.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(void 0!==t.cacheSizeBytes&&-1!==t.cacheSizeBytes&&t.cacheSizeBytes<hc)throw new Ue(Ve.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return t.host&&(0,o.zJ)(t.host)&&(0,o.gE)(t.host),r.initialize({options:t,instanceIdentifier:n})}function ey(e,t){const n="object"==typeof e?e:(0,i.Sx)(),r="string"==typeof e?e:t||jr,s=(0,i.j6)(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const e=(0,o.yU)("firestore");e&&Ec(s,...e)}return s}function ty(e){if(e._terminated)throw new Ue(Ve.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||ny(e),e._firestoreClient}function ny(e){const t=e._freezeSettings(),n=ac(e._databaseId,e._app?.options.appId||"",e._persistenceKey,e._app?.options.apiKey,t);e._componentsProvider||t.localCache?._offlineComponentProvider&&t.localCache?._onlineComponentProvider&&(e._componentsProvider={_offline:t.localCache._offlineComponentProvider,_online:t.localCache._onlineComponentProvider}),e._firestoreClient=new kg(e._authCredentials,e._appCheckCredentials,e._queue,n,e._componentsProvider&&function(e){const t=e?._online.build();return{_offline:e?._offline.build(t),_online:t}}(e._componentsProvider))}function ry(e,t){De("enableIndexedDbPersistence() will be deprecated
2in the future, you can use `FirestoreSettings.cache` instead.");const n=e._freezeSettings();return iy(e,bg.provider,{build:e=>new Ig(e,n.cacheSizeBytes,t?.forceOwnership)}),Promise.resolve()}async function sy(e){De("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");const t=e._freezeSettings();iy(e,bg.provider,{build:e=>new Tg(e,t.cacheSizeBytes)})}function iy(e,t,n){if((e=pt(e,Xg))._firestoreClient||e._terminated)throw new Ue(Ve.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");if(e._componentsProvider||e._getSettings().localCache)throw new Ue(Ve.FAILED_PRECONDITION,"SDK cache is already specified.");e._componentsProvider={_online:t,_offline:n},ny(e)}function ay(e){if(e._initialized&&!e._terminated)throw new Ue(Ve.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");const t=new Fe;return e._queue.enqueueAndForgetEvenWhileRestricted(async()=>{try{await async function(e){if(!Bt.C())return Promise.resolve();const t=e+Xf;await Bt.delete(t)}(np(e._databaseId,e._persistenceKey)),t.resolve()}catch(e){t.reject(e)}}),t.promise}function oy(e){return function(e){const t=new Fe;return e.asyncQueue.enqueueAndForget(async()=>async function(e,t){const n=Me(e);Yp(n.remoteStore)||Ne(Fm,"The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");try{const e=await function(e){const t=Me(e);return t.persistence.runTransaction("Get highest unacknowledged batch id","readonly",e=>t.mutationQueue.getHighestUnacknowledgedBatchId(e))}(n.localStore);if(e===Zt)return void t.resolve();const r=n.ac.get(e)||[];r.push(t),n.ac.set(e,r)}catch(e){const n=ym(e,"Initialization of waitForPendingWrites() operation failed");t.reject(n)}}(await Bg(e),t)),t.promise}(ty(e=pt(e,Xg)))}function cy(e){return function(e){return e.asyncQueue.enqueue(async()=>{const t=await Vg(e),n=await Fg(e);return t.setNetworkEnabled(!0),function(e){const t=Me(e);return t.tu.delete(0),Bp(t)}(n)})}(ty(e=pt(e,Xg)))}function uy(e){return function(e){return e.asyncQueue.enqueue(async()=>{const t=await Vg(e),n=await Fg(e);return t.setNetworkEnabled(!1),async function(e){const t=Me(e);t.tu.add(0),await qp(t),t.iu.set("Offline")}(n)})}(ty(e=pt(e,Xg)))}function ly(e){return(0,i.Us)(e.app,"firestore",e._databaseId.database),e._delete()}function hy(e,t){const n=ty(e=pt(e,Xg)),r=new Jg;return Hg(n,e._databaseId,t,r),r}function dy(e,t){return function(e,t){return e.asyncQueue.enqueue(async()=>function(e,t){const n=Me(e);return n.persistence.runTransaction("Get named query","readonly",e=>n.w_.getNamedQuery(e,t))}(await Ug(e),t))}(ty(e=pt(e,Xg)),t).then(t=>t?new Ic(e,null,t.query):null)}class fy{convertValue(e,t="none"){switch(Zr(e)){case 0:return null;case 1:return e.booleanValue;case 2:return xr(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Pr(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw ke(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const n={};return Sr(e,(e,r)=>{n[e]=this.convertValue(r,t)}),n}convertVectorValue(e){const t=e.fields?.[Yr].arrayValue?.values?.map(e=>xr(e.doubleValue));return new Dc(t)}convertGeoPoint(e){return new Lo(xr(e.latitude),xr(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":const n=Br(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(qr(e));default:return null}}convertTimestamp(e){const t=kr(e);return new vt(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=st.fromString(e);Pe(Ao(n),9688,{name:e});const r=new Gr(n.get(1),n.get(3)),s=new ot(n.popFirst(5));return r.isEqual(t)||Oe(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),s}}class py extends fy{constructor(e){super(),this.firestore=e}convertBytes(e){return new Ro(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);
2return new Tc(this.firestore,null,t)}}function my(e){const t=ty(pt(e.firestore,Xg)),n=t._onlineComponents?.datastore.serializer;return void 0===n?null:po(n,Ji(e._query)).yt}function gy(e,t){const n=Ar(t,(e,t)=>new ui(t,e.aggregateType,e._internalFieldPath)),r=ty(pt(e.firestore,Xg)),s=r._onlineComponents?.datastore.serializer;return void 0===s?null:mo(s,Xi(e._query),n,!0).request}const yy="@firebase/firestore",wy="4.16.0";function _y(e){return function(e,t){if("object"!=typeof e||null===e)return!1;const n=e;for(const e of t)if(e in n&&"function"==typeof n[e])return!0;return!1}(e,["next","error","complete"])}class vy{constructor(e="count",t){this._internalFieldPath=t,this.type="AggregateField",this.aggregateType=e}}class Ey{constructor(e,t,n){this._userDataWriter=t,this._data=n,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}_fieldsProto(){return new Ss({mapValue:{fields:this._data}}).clone().value.mapValue.fields}}class Iy{constructor(e,t,n,r,s){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Tc(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Ty(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){const t=this._document.data.field(eu("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class Ty extends Iy{data(){return super.data()}}function by(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new Ue(Ve.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Sy{}class Ay extends Sy{}function Cy(e,t,...n){let r=[];t instanceof Sy&&r.push(t),r=r.concat(n),function(e){const t=e.filter(e=>e instanceof Dy).length,n=e.filter(e=>e instanceof Ny).length;if(t>1||t>0&&n>0)throw new Ue(Ve.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const t of r)e=t._apply(e);return e}class Ny extends Ay{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Ny(e,t,n)}_apply(e){const t=this._parse(e);return Ky(e._query,t),new Ic(e.firestore,e.converter,ea(e._query,t))}_parse(e){const t=Vc(e.firestore),n=function(e,t,n,r,s,i,a){let o;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Ue(Ve.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Hy(a,i);const t=[];for(const n of a)t.push($y(r,e,n));o={arrayValue:{values:t}}}else o=$y(r,e,a)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Hy(a,i),o=Yc(n,t,a,"in"===i||"not-in"===i);return pi.create(s,i,o)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}}function Oy(e,t,n){const r=t,s=eu("where",e);return Ny._create(s,r,n)}class Dy extends Sy{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Dy(e,t)}_parse(e){const t=this._queryConstraints.map(t=>t._parse(e)).filter(e=>e.getFilters().length>0);return 1===t.length?t[0]:mi.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const r=t.getFlattenedFilters();for(const e of r)Ky(n,e),n=ea(n,e)}(e._query,t),new Ic(e.firestore,e.converter,ea(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Ry(...e){return e.forEach(e=>Wy("or",e)),Dy._create("or",e)}
2function ky(...e){return e.forEach(e=>Wy("and",e)),Dy._create("and",e)}class xy extends Ay{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new xy(e,t)}_apply(e){const t=function(e,t,n){if(null!==e.startAt)throw new Ue(Ve.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==e.endAt)throw new Ue(Ve.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new ki(t,n)}(e._query,this._field,this._direction);return new Ic(e.firestore,e.converter,function(e,t){const n=e.explicitOrderBy.concat([t]);return new Gi(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(e._query,t))}}function Py(e,t="asc"){const n=t,r=eu("orderBy",e);return xy._create(r,n)}class Ly extends Ay{constructor(e,t,n){super(),this.type=e,this._limit=t,this._limitType=n}static _create(e,t,n){return new Ly(e,t,n)}_apply(e){return new Ic(e.firestore,e.converter,ta(e._query,this._limit,this._limitType))}}function My(e){return mt("limit",e),Ly._create("limit",e,"F")}function Vy(e){return mt("limitToLast",e),Ly._create("limitToLast",e,"L")}class Uy extends Ay{constructor(e,t,n){super(),this.type=e,this._docOrFields=t,this._inclusive=n}static _create(e,t,n){return new Uy(e,t,n)}_apply(e){const t=Gy(e,this.type,this._docOrFields,this._inclusive);return new Ic(e.firestore,e.converter,function(e,t){return new Gi(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,t,e.endAt)}(e._query,t))}}function Fy(...e){return Uy._create("startAt",e,!0)}function By(...e){return Uy._create("startAfter",e,!1)}class qy extends Ay{constructor(e,t,n){super(),this.type=e,this._docOrFields=t,this._inclusive=n}static _create(e,t,n){return new qy(e,t,n)}_apply(e){const t=Gy(e,this.type,this._docOrFields,this._inclusive);return new Ic(e.firestore,e.converter,function(e,t){return new Gi(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,t)}(e._query,t))}}function zy(...e){return qy._create("endBefore",e,!1)}function jy(...e){return qy._create("endAt",e,!0)}function Gy(e,t,n,r){if(n[0]=(0,o.Ku)(n[0]),n[0]instanceof Iy)return function(e,t,n,r,s){if(!r)throw new Ue(Ve.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${n}().`);const i=[];for(const n of Qi(e))if(n.field.isKeyField())i.push(cs(t,r.key));else{const e=r.data.field(n.field);if(Fr(e))throw new Ue(Ve.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+n.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===e){const e=n.field.canonicalString();throw new Ue(Ve.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${e}' (used as the orderBy) does not exist.`)}i.push(e)}return new li(i,s)}(e._query,e.firestore._databaseId,t,n[0]._document,r);{const s=Vc(e.firestore);return function(e,t,n,r,s,i){const a=e.explicitOrderBy;if(s.length>a.length)throw new Ue(Ve.INVALID_ARGUMENT,`Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const o=[];for(let i=0;i<s.length;i++){const c=s[i];if(a[i].field.isKeyField()){if("string"!=typeof c)throw new Ue(Ve.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);if(!Yi(e)&&-1!==c.indexOf("/"))throw new Ue(Ve.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);const n=e.path.child(st.fromString(c));if(!ot.isDocumentKey(n))throw new Ue(Ve.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);const s=new ot(n);o.push(cs(t,s))}else{const e=Yc(n,r,c);o.push(e)}}return new li(o,i)}(e._query,e.firestore._databaseId,s,t,n,r)}}function $y(e,t,n){if("string"==typeof(n=(0,o.Ku)(n))){if(""===n)throw new Ue(Ve.INVA
2LID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Yi(t)&&-1!==n.indexOf("/"))throw new Ue(Ve.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=t.path.child(st.fromString(n));if(!ot.isDocumentKey(r))throw new Ue(Ve.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return cs(e,new ot(r))}if(n instanceof Tc)return cs(e,n._key);throw new Ue(Ve.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ft(n)}.`)}function Hy(e,t){if(!Array.isArray(e)||0===e.length)throw new Ue(Ve.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Ky(e,t){const n=function(e,t){for(const n of e)for(const e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new Ue(Ve.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new Ue(Ve.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}function Wy(e,t){if(!(t instanceof Ny||t instanceof Dy))throw new Ue(Ve.INVALID_ARGUMENT,`Function ${e}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}function Yy(e,t,n){let r;return r=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,r}class Qy extends fy{constructor(e){super(),this.firestore=e}convertBytes(e){return new Ro(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Tc(this.firestore,null,t)}}function Jy(e){return new vy("sum",eu("sum",e))}function Xy(e){return new vy("avg",eu("average",e))}function Zy(){return new vy("count")}function ew(e,t){return e instanceof vy&&t instanceof vy&&e.aggregateType===t.aggregateType&&e._internalFieldPath?.canonicalString()===t._internalFieldPath?.canonicalString()}function tw(e,t){return Oc(e.query,t.query)&&(0,o.bD)(e.data(),t.data())}function nw(e){return rw(e,{count:Zy()})}function rw(e,t){const n=pt(e.firestore,Xg),r=ty(n),s=Ar(t,(e,t)=>new ui(t,e.aggregateType,e._internalFieldPath));return function(e,t,n){const r=new Fe;return e.asyncQueue.enqueueAndForget(async()=>{try{const s=await qg(e);r.resolve(async function(e,t,n){const r=Me(e),{request:s,wt:i,parent:a}=mo(r.serializer,Xi(t),n);r.connection.Ot||delete s.parent;const o=(await r.$t("RunAggregationQuery",r.serializer.databaseId,a,s,1)).filter(e=>!!e.result);Pe(1===o.length,64727);const c=o[0].result?.aggregateFields;return Object.keys(c).reduce((e,t)=>(e[i[t]]=c[t],e),{})}(s,t,n))}catch(e){r.reject(e)}}),r.promise}(r,e._query,s).then(t=>function(e,t,n){const r=new py(e);return new Ey(t,r,n)}(n,e,t))}class sw{constructor(e){this.kind="memory",this._onlineComponentProvider=bg.provider,this._offlineComponentProvider=e?.garbageCollector?e.garbageCollector._offlineComponentProvider:{build:()=>new Eg(void 0)}}toJSON(){return{kind:this.kind}}}class iw{constructor(e){let t;this.kind="persistent",e?.tabManager?(e.tabManager._initialize(e),t=e.tabManager):(t=pw(void 0),t._initialize(e)),this._onlineComponentProvider=t._onlineComponentProvider,this._offlineComponentProvider=t._offlineComponentProvider}toJSON(){return{kind:this.kind}}}class aw{constructor(){this.kind="memoryEager",this._offlineComponentProvider=vg.provider}toJSON(){return{kind:this.kind}}}class ow{constructor(e){this.kind="memoryLru",this._offlineComponentProvider={build:()=>new Eg(e)}}toJSON(){return{kind:this.kind}}}function cw(){return new aw}function uw(e){return new ow(e?.cacheSizeBytes)}function lw(e){return new sw(e)}function hw(e){return new iw(e)}class dw{constructor(e){this.forceOwnership=e,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=bg.provider,this._offlineComponentProvider={build:t=>new Ig(t,e?.cacheSizeBytes,this.forceOwnership)}}}class fw{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=bg.provider,this._offlineComponentProvider={build:t=>new Tg(t,e?.cacheSizeBytes)}}}function pw(e){return new dw(e?.forceOwnership)}function mw(){return new fw}const gw="NOT SUPPORTED";class yw{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class ww extends Iy{constructor(e,t,n,r,s,i){super(e,t,n,r,i),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new vw(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const n=this._document.data.field(eu("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Ue(Ve.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=ww._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),e&&e.isValidDocument()&&e.isFoundDocument()?(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t):t}}
2function _w(e,t,n){if(yt(t,ww._jsonSchema)){if(t.bundle===gw)throw new Ue(Ve.INVALID_ARGUMENT,"The provided JSON object was created in a client environment, which is not supported.");const r=Do(e._databaseId),s=Kg(t.bundle,r),i=s.t(),a=new Pm(s.getMetadata(),r);for(const e of i)a.o(e);const o=a.documents;if(1!==o.length)throw new Ue(Ve.INVALID_ARGUMENT,`Expected bundle data to contain 1 document, but it contains ${o.length} documents.`);const c=uo(r,o[0].document),u=new ot(st.fromString(t.bundleName));return new ww(e,new Qy(e),u,c,new yw(!1,!1),n||null)}}ww._jsonSchemaVersion="firestore/documentSnapshot/1.0",ww._jsonSchema={type:gt("string",ww._jsonSchemaVersion),bundleSource:gt("string","DocumentSnapshot"),bundleName:gt("string"),bundle:gt("string")};class vw extends ww{data(e={}){return super.data(e)}}class Ew{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new yw(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach(n=>{e.call(t,new vw(this._firestore,this._userDataWriter,n.key,n,new yw(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new Ue(Ve.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map(n=>{Hh(e._snapshot.query)?vf(e._snapshot.query):ia(e.query._query);const r=new vw(e._firestore,e._userDataWriter,n.doc.key,n.doc,new yw(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{const r=new vw(e._firestore,e._userDataWriter,t.doc.key,t.doc,new yw(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let s=-1,i=-1;return 0!==t.type&&(s=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),i=n.indexOf(t.doc.key)),{type:Tw(t.type),doc:r,oldIndex:s,newIndex:i}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Ue(Ve.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=Ew._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Qe.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],r=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),r.push(e.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function Iw(e,t,n){if(yt(t,Ew._jsonSchema)){if(t.bundle===gw)throw new Ue(Ve.INVALID_ARGUMENT,"The provided JSON object was created in a client environment, which is not supported.");const r=Do(e._databaseId),s=Kg(t.bundle,r),i=s.t(),a=new Pm(s.getMetadata(),r);for(const e of i)a.o(e);if(1!==a.queries.length)throw new Ue(Ve.INVALID_ARGUMENT,`Snapshot data expected 1 query but found ${a.queries.length} queries.`);const o=ld(a.queries[0].bundledQuery),c=a.documents;let u=new wm;c.map(e=>{const t=uo(r,e.document);u=u.add(t)});const l=vm.fromInitialDocuments(o,u,Ta(),!1,!1),h=new Ic(e,n||null,o);return new Ew(e,new Qy(e),h,l)}}function Tw(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ke(61501,{type:e})}}function bw(e,t){return e instanceof ww&&t instanceof ww?e._firestore===t._firestore&&e._key.isEqual(t._key)&&(null===e._document?null===t._document:e._document.isEqual(t._document))&&e._converter===t._converter:e instanceof Ew&&t instanceof Ew&&e._firestore===t._firestore&&Oc(e.query,t.query)&&e.metadata.isEqual(t.metadata)&&e._snapshot.isEqual(t._snapshot)}
2Ew._jsonSchemaVersion="firestore/querySnapshot/1.0",Ew._jsonSchema={type:gt("string",Ew._jsonSchemaVersion),bundleSource:gt("string","QuerySnapshot"),bundleName:gt("string"),bundle:gt("string")};const Sw={maxAttempts:5};class Aw{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=Vc(e)}set(e,t,n){this._verifyNotCommitted();const r=Cw(e,this._firestore),s=Yy(r.converter,t,n),i=Uc(this._dataReader,"WriteBatch.set",r._key,s,null!==r.converter,n);return this._mutations.push(i.toMutation(r._key,Ws.none())),this}update(e,t,n,...r){this._verifyNotCommitted();const s=Cw(e,this._firestore);let i;return i="string"==typeof(t=(0,o.Ku)(t))||t instanceof ko?Wc(this._dataReader,"WriteBatch.update",s._key,t,n,r):Kc(this._dataReader,"WriteBatch.update",s._key,t),this._mutations.push(i.toMutation(s._key,Ws.exists(!0))),this}delete(e){this._verifyNotCommitted();const t=Cw(e,this._firestore);return this._mutations=this._mutations.concat(new oi(t._key,Ws.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new Ue(Ve.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function Cw(e,t){if((e=(0,o.Ku)(e)).firestore!==t)throw new Ue(Ve.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}class Nw{constructor(e,t){this._firestore=e,this._transaction=t,this._dataReader=Vc(e)}get(e){const t=Cw(e,this._firestore),n=new Qy(this._firestore);return this._transaction.lookup([t._key]).then(e=>{if(!e||1!==e.length)return ke(24041);const r=e[0];if(r.isFoundDocument())return new Iy(this._firestore,n,r.key,r,t.converter);if(r.isNoDocument())return new Iy(this._firestore,n,t._key,null,t.converter);throw ke(18433,{doc:r})})}set(e,t,n){const r=Cw(e,this._firestore),s=Yy(r.converter,t,n),i=Uc(this._dataReader,"Transaction.set",r._key,s,null!==r.converter,n);return this._transaction.set(r._key,i),this}update(e,t,n,...r){const s=Cw(e,this._firestore);let i;return i="string"==typeof(t=(0,o.Ku)(t))||t instanceof ko?Wc(this._dataReader,"Transaction.update",s._key,t,n,r):Kc(this._dataReader,"Transaction.update",s._key,t),this._transaction.update(s._key,i),this}delete(e){const t=Cw(e,this._firestore);return this._transaction.delete(t._key),this}}class Ow extends Nw{constructor(e,t){super(e,t),this._firestore=e}get(e){const t=Cw(e,this._firestore),n=new py(this._firestore);return super.get(e).then(e=>new ww(this._firestore,n,t._key,e._document,new yw(!1,!1),t.converter))}}function Dw(e,t,n){e=pt(e,Xg);const r={...Sw,...n};!function(e){if(e.maxAttempts<1)throw new Ue(Ve.INVALID_ARGUMENT,"Max attempts must be at least 1")}(r);return function(e,t,n){const r=new Fe;return e.asyncQueue.enqueueAndForget(async()=>{const s=await qg(e);new Dg(e.asyncQueue,s,n,t,r).Nc()}),r.promise}(ty(e),n=>t(new Ow(e,n)),r)}function Rw(e){e=pt(e,Tc);const t=pt(e.firestore,Xg);return jg(ty(t),e._key).then(n=>$w(t,e,n))}function kw(e){e=pt(e,Tc);const t=pt(e.firestore,Xg),n=ty(t),r=new py(t);return function(e,t){const n=new Fe;return e.asyncQueue.enqueueAndForget(async()=>async function(e,t,n){try{const r=await function(e,t){const n=Me(e);return n.persistence.runTransaction("read document","readonly",e=>n.localDocuments.getDocument(e,t))}(e,t);r.isFoundDocument()?n.resolve(r):r.isNoDocument()?n.resolve(null):n.reject(new Ue(Ve.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)"))}catch(e){const r=ym(e,`Failed to get document '${t} from cache`);n.reject(r)}}(await Ug(e),t,n)),n.promise}(n,e._key).then(n=>new ww(t,r,e._key,n,new yw(null!==n&&n.hasLocalMutations,!0),e.converter))}function xw(e){e=pt(e,Tc);const t=pt(e.firestore,Xg);return jg(ty(t),e._key,{source:"server"}).then(n=>$w(t,e,n))}function Pw(e){e=pt(e,Ic);const t=pt(e.firestore,Xg),n=ty(t),r=new py(t);return by(e._query),Gg(n,e._query).then(n=>new Ew(t,r,e,n))}function Lw(e){e=pt(e,Ic);const t=pt(e.firestore,Xg),n=ty(t),r=new py(t);return function(e,t){const n=new Fe;return e.asyncQueue.enqueueAndForget(async()=>async function(e,t,n){try{const r=await gp(e,t,!0),s=new Um(t,r.Jo),i=s.ku(r.documents),a=s.applyChanges(i,!1);n.resolve(a.snapshot)}catch(e){const r=ym(e,`Failed to execute query '${t} against cache`);n.reject(r)}}(await Ug(e),t,n)),n.promise}(n,e._query).then(n=>new Ew(t,r,e,n))}function Mw(e){e=pt(e,Ic);const t=pt(e.firestore,Xg),n=ty(t),r=new py(t);return Gg(n,e._query,{source:"server"}).then(n=>new Ew(t,r,e,n))}function Vw(e,t,n){e=pt(e,Tc);const r=pt(e.firestore,Xg),s=Yy(e.converter,t,n);return Gw(r,[Uc(Vc(r),"setDoc",e._key,s,null!==e.converter,n).toMutation(e._key,Ws.none())])}function Uw(e,t,n,...r){e=pt(e,Tc);const s=pt(e.firestore,Xg),i=Vc(s);let a;
2return a="string"==typeof(t=(0,o.Ku)(t))||t instanceof ko?Wc(i,"updateDoc",e._key,t,n,r):Kc(i,"updateDoc",e._key,t),Gw(s,[a.toMutation(e._key,Ws.exists(!0))])}function Fw(e){return Gw(pt(e.firestore,Xg),[new oi(e._key,Ws.none())])}function Bw(e,t){const n=pt(e.firestore,Xg),r=Cc(e),s=Yy(e.converter,t);return Gw(n,[Uc(Vc(e.firestore),"addDoc",r._key,s,null!==e.converter,{}).toMutation(r._key,Ws.exists(!1))]).then(()=>r)}function qw(e,...t){e=(0,o.Ku)(e);let n={includeMetadataChanges:!1,source:"default"},r=0;"object"!=typeof t[r]||_y(t[r])||(n=t[r++]);const s={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(_y(t[r])){const e=t[r];t[r]=e.next?.bind(e),t[r+1]=e.error?.bind(e),t[r+2]=e.complete?.bind(e)}let i,a,c;if(e instanceof Tc)a=pt(e.firestore,Xg),c=Hi(e._key.path),i={next:n=>{t[r]&&t[r]($w(a,e,n))},error:t[r+1],complete:t[r+2]};else{const n=pt(e,Ic);a=pt(n.firestore,Xg),c=n._query;const s=new py(a);i={next:e=>{t[r]&&t[r](new Ew(a,s,n,e))},error:t[r+1],complete:t[r+2]},by(e._query)}return function(e,t,n,r){const s=new Ag(r),i=new Rm(t,s,n);return e.asyncQueue.enqueueAndForget(async()=>bm(await zg(e),i)),()=>{s.gc(),e.asyncQueue.enqueueAndForget(async()=>Sm(await zg(e),i))}}(ty(a),c,s,i)}function zw(e,t,...n){const r=(0,o.Ku)(e),s=function(e){const t={bundle:"",bundleName:"",bundleSource:""},n=["bundle","bundleName","bundleSource"];for(const r of n){if(!(r in e)){t.error=`snapshotJson missing required field: ${r}`;break}const n=e[r];if("string"!=typeof n){t.error=`snapshotJson field '${r}' must be a string.`;break}if(0===n.length){t.error=`snapshotJson field '${r}' cannot be an empty string.`;break}"bundle"===r?t.bundle=n:"bundleName"===r?t.bundleName=n:"bundleSource"===r&&(t.bundleSource=n)}return t}(t);if(s.error)throw new Ue(Ve.INVALID_ARGUMENT,s.error);let i,a=0;if("object"!=typeof n[a]||_y(n[a])||(i=n[a++]),"QuerySnapshot"===s.bundleSource){let e=null;if("object"==typeof n[a]&&_y(n[a])){const t=n[a++];e={next:t.next,error:t.error,complete:t.complete}}else e={next:n[a++],error:n[a++],complete:n[a++]};return function(e,t,n,r,s){let i,a=!1;return hy(e,t.bundle).then(()=>dy(e,t.bundleName)).then(e=>{e&&!a&&(s&&e.withConverter(s),i=qw(e,n||{},r))}).catch(e=>(r.error&&r.error(e),()=>{})),()=>{a||(a=!0,i&&i())}}(r,s,i,e,n[a])}if("DocumentSnapshot"===s.bundleSource){let e=null;if("object"==typeof n[a]&&_y(n[a])){const t=n[a++];e={next:t.next,error:t.error,complete:t.complete}}else e={next:n[a++],error:n[a++],complete:n[a++]};return function(e,t,n,r,s){let i,a=!1;return hy(e,t.bundle).then(()=>{if(!a){const a=new Tc(e,s||null,ot.fromPath(t.bundleName));i=qw(a,n||{},r)}}).catch(e=>(r.error&&r.error(e),()=>{})),()=>{a||(a=!0,i&&i())}}(r,s,i,e,n[a])}throw new Ue(Ve.INVALID_ARGUMENT,`unsupported bundle source: ${s.bundleSource}`)}function jw(e,t){return function(e,t){const n=new Ag(t);return e.asyncQueue.enqueueAndForget(async()=>function(e,t){Me(e).Pu.add(t),t.next()}(await zg(e),n)),()=>{n.gc(),e.asyncQueue.enqueueAndForget(async()=>function(e,t){Me(e).Pu.delete(t)}(await zg(e),n))}}(ty(e=pt(e,Xg)),_y(t)?t:{next:t})}function Gw(e,t){return $g(ty(e),t)}function $w(e,t,n){const r=n.docs.get(t._key),s=new py(e);return new ww(e,s,t._key,r,new yw(n.hasPendingWrites,n.fromCache),t.converter)}function Hw(e){return ty(e=pt(e,Xg)),new Aw(e,t=>Gw(e,t))}function Kw(e,t){const n=ty(e=pt(e,Xg));if(!n._uninitializedComponentsProvider||"memory"===n._uninitializedComponentsProvider._offline.kind)return De("Cannot enable indexes when persistence is disabled"),Promise.resolve();const r=function(e){const t="string"==typeof e?function(e){try{return JSON.parse(e)}catch(e){throw new Ue(Ve.INVALID_ARGUMENT,"Failed to parse JSON: "+e?.message)}}(e):e,n=[];if(Array.isArray(t.indexes))for(const e of t.indexes){const t=Ww(e,"collectionGroup"),r=[];if(Array.isArray(e.fields))for(const t of e.fields){const e=nu("setIndexConfiguration",Ww(t,"fieldPath"));"CONTAINS"===t.arrayConfig?r.push(new Ct(e,2)):"ASCENDING"===t.order?r.push(new Ct(e,0)):"DESCENDING"===t.order&&r.push(new Ct(e,1))}n.push(new Tt(Tt.UNKNOWN_ID,t,r,Ot.empty()))}return n}(t);return function(e,t){return e.asyncQueue.enqueue(async()=>async function(e,t){const n=Me(e),r=n.indexManager,s=[];return n.persistence.runTransaction("Configure indexes","readwrite",e=>r.getFieldIndexes(e).next(n=>
2function(e,t,n,r,s){e=[...e],t=[...t],e.sort(n),t.sort(n);const i=e.length,a=t.length;let o=0,c=0;for(;o<a&&c<i;){const i=n(e[c],t[o]);i<0?s(e[c++]):i>0?r(t[o++]):(o++,c++)}for(;o<a;)r(t[o++]);for(;c<i;)s(e[c++])}(n,t,At,t=>{s.push(r.addFieldIndex(e,t))},t=>{s.push(r.deleteFieldIndex(e,t))})).next(()=>Vt.waitFor(s)))}(await Ug(e),t))}(n,r)}function Ww(e,t){if("string"!=typeof e[t])throw new Ue(Ve.INVALID_ARGUMENT,"Missing string value for: "+t);return e[t]}class Yw{constructor(e){this._firestore=e,this.type="PersistentCacheIndexManager"}}function Qw(e){e=pt(e,Xg);const t=t_.get(e);if(t)return t;const n=ty(e);if("persistent"!==n._uninitializedComponentsProvider?._offline.kind)return null;const r=new Yw(e);return t_.set(e,r),r}function Jw(e){e_(e,!0)}function Xw(e){e_(e,!1)}function Zw(e){(function(e){return e.asyncQueue.enqueue(async()=>function(e){const t=Me(e),n=t.indexManager;return t.persistence.runTransaction("Delete All Indexes","readwrite",e=>n.deleteAllFieldIndexes(e))}(await Ug(e)))})(ty(e._firestore)).then(e=>Ne("deleting all persistent cache indexes succeeded")).catch(e=>De("deleting all persistent cache indexes failed",e))}function e_(e,t){(function(e,t){return e.asyncQueue.enqueue(async()=>function(e,t){Me(e).qo.Do=t}(await Ug(e),t))})(ty(e._firestore),t).then(e=>Ne(`setting persistent cache index auto creation isEnabled=${t} succeeded`)).catch(e=>De(`setting persistent cache index auto creation isEnabled=${t} failed`,e))}const t_=new WeakMap;class n_{constructor(){throw new Error("instances of this class should not be created")}static onExistenceFilterMismatch(e){return r_.instance.onExistenceFilterMismatch(e)}}class r_{constructor(){this.i=new Map}static get instance(){return s_||(s_=new r_,function(e){if(Aa)throw new Error("a TestingHooksSpi instance is already set");Aa=e}(s_)),s_}u(e){this.i.forEach(t=>t(e))}onExistenceFilterMismatch(e){const t=Symbol(),n=this.i;return n.set(t,e),()=>n.delete(t)}}let s_=null;!function(e,t=!0){(function(e){be=e})(i.MF),(0,i.om)(new a.uA("firestore",(e,{instanceIdentifier:n,options:r})=>{const s=e.getProvider("app").getImmediate(),i=new Xg(new je(e.getProvider("auth-internal")),new Ke(s,e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new Ue(Ve.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Gr(e.options.projectId,t)}(s,n),s);return r={useFetchStreams:t,...r},i._setSettings(r),i},"PUBLIC").setMultipleInstances(!0)),(0,i.KO)(yy,wy,e),(0,i.KO)(yy,wy,"esm2020")}()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.